@wezzard/mcp-relay 0.17.1 → 0.19.0
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/.claude-plugin/plugin.json +1 -1
- package/README.md +16 -7
- package/dist/build-info.json +5 -4
- package/dist/doctor.mjs +4 -3
- package/dist/integrity.json +2 -2
- package/dist/server.mjs +948 -611
- package/package.json +2 -2
- package/pi-mcp.json +1 -1
package/dist/server.mjs
CHANGED
|
@@ -27,9 +27,9 @@ var __export = (target, all) => {
|
|
|
27
27
|
};
|
|
28
28
|
var __copyProps = (to, from, except, desc) => {
|
|
29
29
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
30
|
-
for (let
|
|
31
|
-
if (!__hasOwnProp.call(to,
|
|
32
|
-
__defProp(to,
|
|
30
|
+
for (let key2 of __getOwnPropNames(from))
|
|
31
|
+
if (!__hasOwnProp.call(to, key2) && key2 !== except)
|
|
32
|
+
__defProp(to, key2, { get: () => from[key2], enumerable: !(desc = __getOwnPropDesc(from, key2)) || desc.enumerable });
|
|
33
33
|
}
|
|
34
34
|
return to;
|
|
35
35
|
};
|
|
@@ -178,15 +178,15 @@ var require_code = __commonJS({
|
|
|
178
178
|
return JSON.stringify(x).replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
|
|
179
179
|
}
|
|
180
180
|
exports.safeStringify = safeStringify;
|
|
181
|
-
function getProperty(
|
|
182
|
-
return typeof
|
|
181
|
+
function getProperty(key2) {
|
|
182
|
+
return typeof key2 == "string" && exports.IDENTIFIER.test(key2) ? new _Code(`.${key2}`) : _`[${key2}]`;
|
|
183
183
|
}
|
|
184
184
|
exports.getProperty = getProperty;
|
|
185
|
-
function getEsmExportName(
|
|
186
|
-
if (typeof
|
|
187
|
-
return new _Code(`${
|
|
185
|
+
function getEsmExportName(key2) {
|
|
186
|
+
if (typeof key2 == "string" && exports.IDENTIFIER.test(key2)) {
|
|
187
|
+
return new _Code(`${key2}`);
|
|
188
188
|
}
|
|
189
|
-
throw new Error(`CodeGen: invalid export name: ${
|
|
189
|
+
throw new Error(`CodeGen: invalid export name: ${key2}, use explicit $id name mapping`);
|
|
190
190
|
}
|
|
191
191
|
exports.getEsmExportName = getEsmExportName;
|
|
192
192
|
function regexpCode(rx) {
|
|
@@ -813,11 +813,11 @@ var require_codegen = __commonJS({
|
|
|
813
813
|
// returns code for object literal for the passed argument list of key-value pairs
|
|
814
814
|
object(...keyValues) {
|
|
815
815
|
const code = ["{"];
|
|
816
|
-
for (const [
|
|
816
|
+
for (const [key2, value] of keyValues) {
|
|
817
817
|
if (code.length > 1)
|
|
818
818
|
code.push(",");
|
|
819
|
-
code.push(
|
|
820
|
-
if (
|
|
819
|
+
code.push(key2);
|
|
820
|
+
if (key2 !== value || this.opts.es5) {
|
|
821
821
|
code.push(":");
|
|
822
822
|
(0, code_1.addCodeArg)(code, value);
|
|
823
823
|
}
|
|
@@ -1092,17 +1092,17 @@ var require_util = __commonJS({
|
|
|
1092
1092
|
if (typeof schema === "boolean")
|
|
1093
1093
|
return;
|
|
1094
1094
|
const rules = self.RULES.keywords;
|
|
1095
|
-
for (const
|
|
1096
|
-
if (!rules[
|
|
1097
|
-
checkStrictMode(it, `unknown keyword: "${
|
|
1095
|
+
for (const key2 in schema) {
|
|
1096
|
+
if (!rules[key2])
|
|
1097
|
+
checkStrictMode(it, `unknown keyword: "${key2}"`);
|
|
1098
1098
|
}
|
|
1099
1099
|
}
|
|
1100
1100
|
exports.checkUnknownRules = checkUnknownRules;
|
|
1101
1101
|
function schemaHasRules(schema, rules) {
|
|
1102
1102
|
if (typeof schema == "boolean")
|
|
1103
1103
|
return !schema;
|
|
1104
|
-
for (const
|
|
1105
|
-
if (rules[
|
|
1104
|
+
for (const key2 in schema)
|
|
1105
|
+
if (rules[key2])
|
|
1106
1106
|
return true;
|
|
1107
1107
|
return false;
|
|
1108
1108
|
}
|
|
@@ -1110,8 +1110,8 @@ var require_util = __commonJS({
|
|
|
1110
1110
|
function schemaHasRulesButRef(schema, RULES) {
|
|
1111
1111
|
if (typeof schema == "boolean")
|
|
1112
1112
|
return !schema;
|
|
1113
|
-
for (const
|
|
1114
|
-
if (
|
|
1113
|
+
for (const key2 in schema)
|
|
1114
|
+
if (key2 !== "$ref" && RULES.all[key2])
|
|
1115
1115
|
return true;
|
|
1116
1116
|
return false;
|
|
1117
1117
|
}
|
|
@@ -1689,8 +1689,8 @@ var require_defaults = __commonJS({
|
|
|
1689
1689
|
function assignDefaults(it, ty) {
|
|
1690
1690
|
const { properties, items } = it.schema;
|
|
1691
1691
|
if (ty === "object" && properties) {
|
|
1692
|
-
for (const
|
|
1693
|
-
assignDefault(it,
|
|
1692
|
+
for (const key2 in properties) {
|
|
1693
|
+
assignDefault(it, key2, properties[key2].default);
|
|
1694
1694
|
}
|
|
1695
1695
|
} else if (ty === "array" && Array.isArray(items)) {
|
|
1696
1696
|
items.forEach((sch, i) => assignDefault(it, i, sch.default));
|
|
@@ -2074,8 +2074,8 @@ var require_fast_deep_equal = __commonJS({
|
|
|
2074
2074
|
for (i = length; i-- !== 0; )
|
|
2075
2075
|
if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;
|
|
2076
2076
|
for (i = length; i-- !== 0; ) {
|
|
2077
|
-
var
|
|
2078
|
-
if (!equal(a[
|
|
2077
|
+
var key2 = keys[i];
|
|
2078
|
+
if (!equal(a[key2], b[key2])) return false;
|
|
2079
2079
|
}
|
|
2080
2080
|
return true;
|
|
2081
2081
|
}
|
|
@@ -2147,20 +2147,20 @@ var require_json_schema_traverse = __commonJS({
|
|
|
2147
2147
|
function _traverse(opts, pre, post, schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex) {
|
|
2148
2148
|
if (schema && typeof schema == "object" && !Array.isArray(schema)) {
|
|
2149
2149
|
pre(schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex);
|
|
2150
|
-
for (var
|
|
2151
|
-
var sch = schema[
|
|
2150
|
+
for (var key2 in schema) {
|
|
2151
|
+
var sch = schema[key2];
|
|
2152
2152
|
if (Array.isArray(sch)) {
|
|
2153
|
-
if (
|
|
2153
|
+
if (key2 in traverse.arrayKeywords) {
|
|
2154
2154
|
for (var i = 0; i < sch.length; i++)
|
|
2155
|
-
_traverse(opts, pre, post, sch[i], jsonPtr + "/" +
|
|
2155
|
+
_traverse(opts, pre, post, sch[i], jsonPtr + "/" + key2 + "/" + i, rootSchema, jsonPtr, key2, schema, i);
|
|
2156
2156
|
}
|
|
2157
|
-
} else if (
|
|
2157
|
+
} else if (key2 in traverse.propsKeywords) {
|
|
2158
2158
|
if (sch && typeof sch == "object") {
|
|
2159
2159
|
for (var prop in sch)
|
|
2160
|
-
_traverse(opts, pre, post, sch[prop], jsonPtr + "/" +
|
|
2160
|
+
_traverse(opts, pre, post, sch[prop], jsonPtr + "/" + key2 + "/" + escapeJsonPtr(prop), rootSchema, jsonPtr, key2, schema, prop);
|
|
2161
2161
|
}
|
|
2162
|
-
} else if (
|
|
2163
|
-
_traverse(opts, pre, post, sch, jsonPtr + "/" +
|
|
2162
|
+
} else if (key2 in traverse.keywords || opts.allKeys && !(key2 in traverse.skipKeywords)) {
|
|
2163
|
+
_traverse(opts, pre, post, sch, jsonPtr + "/" + key2, rootSchema, jsonPtr, key2, schema);
|
|
2164
2164
|
}
|
|
2165
2165
|
}
|
|
2166
2166
|
post(schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex);
|
|
@@ -2217,10 +2217,10 @@ var require_resolve = __commonJS({
|
|
|
2217
2217
|
"$dynamicAnchor"
|
|
2218
2218
|
]);
|
|
2219
2219
|
function hasRef(schema) {
|
|
2220
|
-
for (const
|
|
2221
|
-
if (REF_KEYWORDS.has(
|
|
2220
|
+
for (const key2 in schema) {
|
|
2221
|
+
if (REF_KEYWORDS.has(key2))
|
|
2222
2222
|
return true;
|
|
2223
|
-
const sch = schema[
|
|
2223
|
+
const sch = schema[key2];
|
|
2224
2224
|
if (Array.isArray(sch) && sch.some(hasRef))
|
|
2225
2225
|
return true;
|
|
2226
2226
|
if (typeof sch == "object" && hasRef(sch))
|
|
@@ -2230,14 +2230,14 @@ var require_resolve = __commonJS({
|
|
|
2230
2230
|
}
|
|
2231
2231
|
function countKeys(schema) {
|
|
2232
2232
|
let count = 0;
|
|
2233
|
-
for (const
|
|
2234
|
-
if (
|
|
2233
|
+
for (const key2 in schema) {
|
|
2234
|
+
if (key2 === "$ref")
|
|
2235
2235
|
return Infinity;
|
|
2236
2236
|
count++;
|
|
2237
|
-
if (SIMPLE_INLINED.has(
|
|
2237
|
+
if (SIMPLE_INLINED.has(key2))
|
|
2238
2238
|
continue;
|
|
2239
|
-
if (typeof schema[
|
|
2240
|
-
(0, util_1.eachItem)(schema[
|
|
2239
|
+
if (typeof schema[key2] == "object") {
|
|
2240
|
+
(0, util_1.eachItem)(schema[key2], (sch) => count += countKeys(sch));
|
|
2241
2241
|
}
|
|
2242
2242
|
if (count === Infinity)
|
|
2243
2243
|
return Infinity;
|
|
@@ -2426,8 +2426,8 @@ var require_validate = __commonJS({
|
|
|
2426
2426
|
function schemaCxtHasRules({ schema, self }) {
|
|
2427
2427
|
if (typeof schema == "boolean")
|
|
2428
2428
|
return !schema;
|
|
2429
|
-
for (const
|
|
2430
|
-
if (self.RULES.all[
|
|
2429
|
+
for (const key2 in schema)
|
|
2430
|
+
if (self.RULES.all[key2])
|
|
2431
2431
|
return true;
|
|
2432
2432
|
return false;
|
|
2433
2433
|
}
|
|
@@ -3496,7 +3496,7 @@ var require_utils = __commonJS({
|
|
|
3496
3496
|
function encodeUserinfo(input) {
|
|
3497
3497
|
return encodeComponent(input, isUserinfoCharacter);
|
|
3498
3498
|
}
|
|
3499
|
-
function
|
|
3499
|
+
function encodeQuery2(input) {
|
|
3500
3500
|
return encodeComponent(input, isQueryFragmentCharacter);
|
|
3501
3501
|
}
|
|
3502
3502
|
function encodeFragment(input) {
|
|
@@ -3602,7 +3602,7 @@ var require_utils = __commonJS({
|
|
|
3602
3602
|
serializePathEncoding,
|
|
3603
3603
|
normalizeQueryFragmentEncoding,
|
|
3604
3604
|
encodeUserinfo,
|
|
3605
|
-
encodeQuery,
|
|
3605
|
+
encodeQuery: encodeQuery2,
|
|
3606
3606
|
encodeFragment,
|
|
3607
3607
|
escapePreservingEscapes,
|
|
3608
3608
|
removeDotSegments,
|
|
@@ -3829,7 +3829,7 @@ var require_schemes = __commonJS({
|
|
|
3829
3829
|
var require_fast_uri = __commonJS({
|
|
3830
3830
|
"node_modules/fast-uri/index.js"(exports, module) {
|
|
3831
3831
|
"use strict";
|
|
3832
|
-
var { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, serializePathEncoding, normalizeQueryFragmentEncoding, encodeQuery, encodeFragment, reescapeHostDelimiters, isIPv4, nonSimpleDomain } = require_utils();
|
|
3832
|
+
var { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, serializePathEncoding, normalizeQueryFragmentEncoding, encodeQuery: encodeQuery2, encodeFragment, reescapeHostDelimiters, isIPv4, nonSimpleDomain } = require_utils();
|
|
3833
3833
|
var { SCHEMES, getSchemeHandler } = require_schemes();
|
|
3834
3834
|
var VALID_SCHEME = /^[A-Za-z][A-Za-z0-9+.-]*$/u;
|
|
3835
3835
|
var MALFORMED_SCHEME_ERROR = "URI scheme is malformed.";
|
|
@@ -4002,7 +4002,7 @@ var require_fast_uri = __commonJS({
|
|
|
4002
4002
|
uriTokens.push(s);
|
|
4003
4003
|
}
|
|
4004
4004
|
if (component.query !== void 0) {
|
|
4005
|
-
uriTokens.push("?",
|
|
4005
|
+
uriTokens.push("?", encodeQuery2(component.query));
|
|
4006
4006
|
}
|
|
4007
4007
|
if (component.fragment !== void 0) {
|
|
4008
4008
|
uriTokens.push("#", encodeFragment(component.fragment));
|
|
@@ -4465,7 +4465,7 @@ var require_core = __commonJS({
|
|
|
4465
4465
|
}
|
|
4466
4466
|
}
|
|
4467
4467
|
// Adds schema to the instance
|
|
4468
|
-
addSchema(schema,
|
|
4468
|
+
addSchema(schema, key2, _meta, _validateSchema = this.opts.validateSchema) {
|
|
4469
4469
|
if (Array.isArray(schema)) {
|
|
4470
4470
|
for (const sch of schema)
|
|
4471
4471
|
this.addSchema(sch, void 0, _meta, _validateSchema);
|
|
@@ -4479,15 +4479,15 @@ var require_core = __commonJS({
|
|
|
4479
4479
|
throw new Error(`schema ${schemaId} must be string`);
|
|
4480
4480
|
}
|
|
4481
4481
|
}
|
|
4482
|
-
|
|
4483
|
-
this._checkUnique(
|
|
4484
|
-
this.schemas[
|
|
4482
|
+
key2 = (0, resolve_1.normalizeId)(key2 || id2);
|
|
4483
|
+
this._checkUnique(key2);
|
|
4484
|
+
this.schemas[key2] = this._addSchema(schema, _meta, key2, _validateSchema, true);
|
|
4485
4485
|
return this;
|
|
4486
4486
|
}
|
|
4487
4487
|
// Add schema that will be used to validate other schemas
|
|
4488
4488
|
// options in META_IGNORE_OPTIONS are alway set to false
|
|
4489
|
-
addMetaSchema(schema,
|
|
4490
|
-
this.addSchema(schema,
|
|
4489
|
+
addMetaSchema(schema, key2, _validateSchema = this.opts.validateSchema) {
|
|
4490
|
+
this.addSchema(schema, key2, true, _validateSchema);
|
|
4491
4491
|
return this;
|
|
4492
4492
|
}
|
|
4493
4493
|
// Validate schema against its meta-schema
|
|
@@ -4643,14 +4643,14 @@ var require_core = __commonJS({
|
|
|
4643
4643
|
let keywords = metaSchema;
|
|
4644
4644
|
for (const seg of segments)
|
|
4645
4645
|
keywords = keywords[seg];
|
|
4646
|
-
for (const
|
|
4647
|
-
const rule = rules[
|
|
4646
|
+
for (const key2 in rules) {
|
|
4647
|
+
const rule = rules[key2];
|
|
4648
4648
|
if (typeof rule != "object")
|
|
4649
4649
|
continue;
|
|
4650
4650
|
const { $data } = rule.definition;
|
|
4651
|
-
const schema = keywords[
|
|
4651
|
+
const schema = keywords[key2];
|
|
4652
4652
|
if ($data && schema)
|
|
4653
|
-
keywords[
|
|
4653
|
+
keywords[key2] = schemaOrData(schema);
|
|
4654
4654
|
}
|
|
4655
4655
|
}
|
|
4656
4656
|
return metaSchema;
|
|
@@ -4723,10 +4723,10 @@ var require_core = __commonJS({
|
|
|
4723
4723
|
Ajv2.MissingRefError = ref_error_1.default;
|
|
4724
4724
|
exports.default = Ajv2;
|
|
4725
4725
|
function checkOptions(checkOpts, options, msg, log = "error") {
|
|
4726
|
-
for (const
|
|
4727
|
-
const opt =
|
|
4726
|
+
for (const key2 in checkOpts) {
|
|
4727
|
+
const opt = key2;
|
|
4728
4728
|
if (opt in options)
|
|
4729
|
-
this.logger[log](`${msg}: option ${
|
|
4729
|
+
this.logger[log](`${msg}: option ${key2}. ${checkOpts[opt]}`);
|
|
4730
4730
|
}
|
|
4731
4731
|
}
|
|
4732
4732
|
function getSchEnv(keyRef) {
|
|
@@ -4740,8 +4740,8 @@ var require_core = __commonJS({
|
|
|
4740
4740
|
if (Array.isArray(optsSchemas))
|
|
4741
4741
|
this.addSchema(optsSchemas);
|
|
4742
4742
|
else
|
|
4743
|
-
for (const
|
|
4744
|
-
this.addSchema(optsSchemas[
|
|
4743
|
+
for (const key2 in optsSchemas)
|
|
4744
|
+
this.addSchema(optsSchemas[key2], key2);
|
|
4745
4745
|
}
|
|
4746
4746
|
function addInitialFormats() {
|
|
4747
4747
|
for (const name in this.opts.formats) {
|
|
@@ -5789,11 +5789,11 @@ var require_dependencies = __commonJS({
|
|
|
5789
5789
|
function splitDependencies({ schema }) {
|
|
5790
5790
|
const propertyDeps = {};
|
|
5791
5791
|
const schemaDeps = {};
|
|
5792
|
-
for (const
|
|
5793
|
-
if (
|
|
5792
|
+
for (const key2 in schema) {
|
|
5793
|
+
if (key2 === "__proto__")
|
|
5794
5794
|
continue;
|
|
5795
|
-
const deps = Array.isArray(schema[
|
|
5796
|
-
deps[
|
|
5795
|
+
const deps = Array.isArray(schema[key2]) ? propertyDeps : schemaDeps;
|
|
5796
|
+
deps[key2] = schema[key2];
|
|
5797
5797
|
}
|
|
5798
5798
|
return [propertyDeps, schemaDeps];
|
|
5799
5799
|
}
|
|
@@ -5870,13 +5870,13 @@ var require_propertyNames = __commonJS({
|
|
|
5870
5870
|
if ((0, util_1.alwaysValidSchema)(it, schema))
|
|
5871
5871
|
return;
|
|
5872
5872
|
const valid = gen.name("valid");
|
|
5873
|
-
gen.forIn("key", data, (
|
|
5874
|
-
cxt.setParams({ propertyName:
|
|
5873
|
+
gen.forIn("key", data, (key2) => {
|
|
5874
|
+
cxt.setParams({ propertyName: key2 });
|
|
5875
5875
|
cxt.subschema({
|
|
5876
5876
|
keyword: "propertyNames",
|
|
5877
|
-
data:
|
|
5877
|
+
data: key2,
|
|
5878
5878
|
dataTypes: ["string"],
|
|
5879
|
-
propertyName:
|
|
5879
|
+
propertyName: key2,
|
|
5880
5880
|
compositeRule: true
|
|
5881
5881
|
}, valid);
|
|
5882
5882
|
gen.if((0, codegen_1.not)(valid), () => {
|
|
@@ -5925,38 +5925,38 @@ var require_additionalProperties = __commonJS({
|
|
|
5925
5925
|
checkAdditionalProperties();
|
|
5926
5926
|
cxt.ok((0, codegen_1._)`${errsCount} === ${names_1.default.errors}`);
|
|
5927
5927
|
function checkAdditionalProperties() {
|
|
5928
|
-
gen.forIn("key", data, (
|
|
5928
|
+
gen.forIn("key", data, (key2) => {
|
|
5929
5929
|
if (!props.length && !patProps.length)
|
|
5930
|
-
additionalPropertyCode(
|
|
5930
|
+
additionalPropertyCode(key2);
|
|
5931
5931
|
else
|
|
5932
|
-
gen.if(isAdditional(
|
|
5932
|
+
gen.if(isAdditional(key2), () => additionalPropertyCode(key2));
|
|
5933
5933
|
});
|
|
5934
5934
|
}
|
|
5935
|
-
function isAdditional(
|
|
5935
|
+
function isAdditional(key2) {
|
|
5936
5936
|
let definedProp;
|
|
5937
5937
|
if (props.length > 8) {
|
|
5938
5938
|
const propsSchema = (0, util_1.schemaRefOrVal)(it, parentSchema.properties, "properties");
|
|
5939
|
-
definedProp = (0, code_1.isOwnProperty)(gen, propsSchema,
|
|
5939
|
+
definedProp = (0, code_1.isOwnProperty)(gen, propsSchema, key2);
|
|
5940
5940
|
} else if (props.length) {
|
|
5941
|
-
definedProp = (0, codegen_1.or)(...props.map((p) => (0, codegen_1._)`${
|
|
5941
|
+
definedProp = (0, codegen_1.or)(...props.map((p) => (0, codegen_1._)`${key2} === ${p}`));
|
|
5942
5942
|
} else {
|
|
5943
5943
|
definedProp = codegen_1.nil;
|
|
5944
5944
|
}
|
|
5945
5945
|
if (patProps.length) {
|
|
5946
|
-
definedProp = (0, codegen_1.or)(definedProp, ...patProps.map((p) => (0, codegen_1._)`${(0, code_1.usePattern)(cxt, p)}.test(${
|
|
5946
|
+
definedProp = (0, codegen_1.or)(definedProp, ...patProps.map((p) => (0, codegen_1._)`${(0, code_1.usePattern)(cxt, p)}.test(${key2})`));
|
|
5947
5947
|
}
|
|
5948
5948
|
return (0, codegen_1.not)(definedProp);
|
|
5949
5949
|
}
|
|
5950
|
-
function deleteAdditional(
|
|
5951
|
-
gen.code((0, codegen_1._)`delete ${data}[${
|
|
5950
|
+
function deleteAdditional(key2) {
|
|
5951
|
+
gen.code((0, codegen_1._)`delete ${data}[${key2}]`);
|
|
5952
5952
|
}
|
|
5953
|
-
function additionalPropertyCode(
|
|
5953
|
+
function additionalPropertyCode(key2) {
|
|
5954
5954
|
if (opts.removeAdditional === "all" || opts.removeAdditional && schema === false) {
|
|
5955
|
-
deleteAdditional(
|
|
5955
|
+
deleteAdditional(key2);
|
|
5956
5956
|
return;
|
|
5957
5957
|
}
|
|
5958
5958
|
if (schema === false) {
|
|
5959
|
-
cxt.setParams({ additionalProperty:
|
|
5959
|
+
cxt.setParams({ additionalProperty: key2 });
|
|
5960
5960
|
cxt.error();
|
|
5961
5961
|
if (!allErrors)
|
|
5962
5962
|
gen.break();
|
|
@@ -5965,22 +5965,22 @@ var require_additionalProperties = __commonJS({
|
|
|
5965
5965
|
if (typeof schema == "object" && !(0, util_1.alwaysValidSchema)(it, schema)) {
|
|
5966
5966
|
const valid = gen.name("valid");
|
|
5967
5967
|
if (opts.removeAdditional === "failing") {
|
|
5968
|
-
applyAdditionalSchema(
|
|
5968
|
+
applyAdditionalSchema(key2, valid, false);
|
|
5969
5969
|
gen.if((0, codegen_1.not)(valid), () => {
|
|
5970
5970
|
cxt.reset();
|
|
5971
|
-
deleteAdditional(
|
|
5971
|
+
deleteAdditional(key2);
|
|
5972
5972
|
});
|
|
5973
5973
|
} else {
|
|
5974
|
-
applyAdditionalSchema(
|
|
5974
|
+
applyAdditionalSchema(key2, valid);
|
|
5975
5975
|
if (!allErrors)
|
|
5976
5976
|
gen.if((0, codegen_1.not)(valid), () => gen.break());
|
|
5977
5977
|
}
|
|
5978
5978
|
}
|
|
5979
5979
|
}
|
|
5980
|
-
function applyAdditionalSchema(
|
|
5980
|
+
function applyAdditionalSchema(key2, valid, errors) {
|
|
5981
5981
|
const subschema = {
|
|
5982
5982
|
keyword: "additionalProperties",
|
|
5983
|
-
dataProp:
|
|
5983
|
+
dataProp: key2,
|
|
5984
5984
|
dataPropType: util_1.Type.Str
|
|
5985
5985
|
};
|
|
5986
5986
|
if (errors === false) {
|
|
@@ -6105,19 +6105,19 @@ var require_patternProperties = __commonJS({
|
|
|
6105
6105
|
}
|
|
6106
6106
|
}
|
|
6107
6107
|
function validateProperties(pat) {
|
|
6108
|
-
gen.forIn("key", data, (
|
|
6109
|
-
gen.if((0, codegen_1._)`${(0, code_1.usePattern)(cxt, pat)}.test(${
|
|
6108
|
+
gen.forIn("key", data, (key2) => {
|
|
6109
|
+
gen.if((0, codegen_1._)`${(0, code_1.usePattern)(cxt, pat)}.test(${key2})`, () => {
|
|
6110
6110
|
const alwaysValid = alwaysValidPatterns.includes(pat);
|
|
6111
6111
|
if (!alwaysValid) {
|
|
6112
6112
|
cxt.subschema({
|
|
6113
6113
|
keyword: "patternProperties",
|
|
6114
6114
|
schemaProp: pat,
|
|
6115
|
-
dataProp:
|
|
6115
|
+
dataProp: key2,
|
|
6116
6116
|
dataPropType: util_2.Type.Str
|
|
6117
6117
|
}, valid);
|
|
6118
6118
|
}
|
|
6119
6119
|
if (it.opts.unevaluated && props !== true) {
|
|
6120
|
-
gen.assign((0, codegen_1._)`${props}[${
|
|
6120
|
+
gen.assign((0, codegen_1._)`${props}[${key2}]`, true);
|
|
6121
6121
|
} else if (!alwaysValid && !it.allErrors) {
|
|
6122
6122
|
gen.if((0, codegen_1.not)(valid), () => gen.break());
|
|
6123
6123
|
}
|
|
@@ -7600,9 +7600,9 @@ function floatSafeRemainder(val, step2) {
|
|
|
7600
7600
|
return ratio - roundedRatio;
|
|
7601
7601
|
}
|
|
7602
7602
|
var EVALUATING = /* @__PURE__ */ Symbol("evaluating");
|
|
7603
|
-
function defineLazy(object6,
|
|
7603
|
+
function defineLazy(object6, key2, getter) {
|
|
7604
7604
|
let value = void 0;
|
|
7605
|
-
Object.defineProperty(object6,
|
|
7605
|
+
Object.defineProperty(object6, key2, {
|
|
7606
7606
|
get() {
|
|
7607
7607
|
if (value === EVALUATING) {
|
|
7608
7608
|
return void 0;
|
|
@@ -7614,7 +7614,7 @@ function defineLazy(object6, key, getter) {
|
|
|
7614
7614
|
return value;
|
|
7615
7615
|
},
|
|
7616
7616
|
set(v) {
|
|
7617
|
-
Object.defineProperty(object6,
|
|
7617
|
+
Object.defineProperty(object6, key2, {
|
|
7618
7618
|
value: v
|
|
7619
7619
|
// configurable: true,
|
|
7620
7620
|
});
|
|
@@ -7640,47 +7640,47 @@ function rawShape(def) {
|
|
|
7640
7640
|
function sourceShape(schema) {
|
|
7641
7641
|
return rawShape(schema._zod.def) ?? schema._zod.def.shape;
|
|
7642
7642
|
}
|
|
7643
|
-
function deferProp(target,
|
|
7644
|
-
Object.defineProperty(target,
|
|
7643
|
+
function deferProp(target, key2, getter) {
|
|
7644
|
+
Object.defineProperty(target, key2, {
|
|
7645
7645
|
get() {
|
|
7646
7646
|
const value = getter();
|
|
7647
|
-
assignProp(this,
|
|
7647
|
+
assignProp(this, key2, value);
|
|
7648
7648
|
return value;
|
|
7649
7649
|
},
|
|
7650
7650
|
enumerable: true,
|
|
7651
7651
|
configurable: true
|
|
7652
7652
|
});
|
|
7653
7653
|
}
|
|
7654
|
-
function putProp(target,
|
|
7655
|
-
if (
|
|
7656
|
-
assignProp(target,
|
|
7654
|
+
function putProp(target, key2, value) {
|
|
7655
|
+
if (key2 in target)
|
|
7656
|
+
assignProp(target, key2, value);
|
|
7657
7657
|
else
|
|
7658
|
-
target[
|
|
7658
|
+
target[key2] = value;
|
|
7659
7659
|
}
|
|
7660
7660
|
function mirrorShape(target, source, keys, wrap) {
|
|
7661
7661
|
const raw = sourceShape(source);
|
|
7662
|
-
for (const
|
|
7663
|
-
const desc = Object.getOwnPropertyDescriptor(raw,
|
|
7662
|
+
for (const key2 of keys) {
|
|
7663
|
+
const desc = Object.getOwnPropertyDescriptor(raw, key2);
|
|
7664
7664
|
if (!desc.enumerable)
|
|
7665
7665
|
continue;
|
|
7666
7666
|
if (desc.get) {
|
|
7667
|
-
deferProp(target,
|
|
7668
|
-
const value = source._zod.def.shape[
|
|
7669
|
-
return wrap ? wrap(value,
|
|
7667
|
+
deferProp(target, key2, () => {
|
|
7668
|
+
const value = source._zod.def.shape[key2];
|
|
7669
|
+
return wrap ? wrap(value, key2) : value;
|
|
7670
7670
|
});
|
|
7671
7671
|
} else
|
|
7672
|
-
putProp(target,
|
|
7672
|
+
putProp(target, key2, wrap ? wrap(desc.value, key2) : desc.value);
|
|
7673
7673
|
}
|
|
7674
7674
|
}
|
|
7675
7675
|
function mirrorProps(target, source) {
|
|
7676
|
-
for (const
|
|
7677
|
-
const desc = Object.getOwnPropertyDescriptor(source,
|
|
7676
|
+
for (const key2 of Reflect.ownKeys(source)) {
|
|
7677
|
+
const desc = Object.getOwnPropertyDescriptor(source, key2);
|
|
7678
7678
|
if (!desc.enumerable)
|
|
7679
7679
|
continue;
|
|
7680
7680
|
if (desc.get)
|
|
7681
|
-
deferProp(target,
|
|
7681
|
+
deferProp(target, key2, () => source[key2]);
|
|
7682
7682
|
else
|
|
7683
|
-
putProp(target,
|
|
7683
|
+
putProp(target, key2, desc.value);
|
|
7684
7684
|
}
|
|
7685
7685
|
}
|
|
7686
7686
|
function mergeDefs(...defs) {
|
|
@@ -7697,11 +7697,11 @@ function cloneDef(schema) {
|
|
|
7697
7697
|
function getElementAtPath(obj, path) {
|
|
7698
7698
|
if (!path)
|
|
7699
7699
|
return obj;
|
|
7700
|
-
return path.reduce((acc,
|
|
7700
|
+
return path.reduce((acc, key2) => acc?.[key2], obj);
|
|
7701
7701
|
}
|
|
7702
7702
|
function promiseAllObject(promisesObj) {
|
|
7703
7703
|
const keys = Object.keys(promisesObj);
|
|
7704
|
-
const promises = keys.map((
|
|
7704
|
+
const promises = keys.map((key2) => promisesObj[key2]);
|
|
7705
7705
|
return Promise.all(promises).then((results) => {
|
|
7706
7706
|
const resolvedObj = {};
|
|
7707
7707
|
for (let i = 0; i < keys.length; i++) {
|
|
@@ -7773,8 +7773,8 @@ function shallowClone(o) {
|
|
|
7773
7773
|
}
|
|
7774
7774
|
function numKeys(data) {
|
|
7775
7775
|
let keyCount = 0;
|
|
7776
|
-
for (const
|
|
7777
|
-
if (Object.prototype.hasOwnProperty.call(data,
|
|
7776
|
+
for (const key2 in data) {
|
|
7777
|
+
if (Object.prototype.hasOwnProperty.call(data, key2)) {
|
|
7778
7778
|
keyCount++;
|
|
7779
7779
|
}
|
|
7780
7780
|
}
|
|
@@ -7928,12 +7928,12 @@ function pick(schema, mask) {
|
|
|
7928
7928
|
function maskedKeys(schema, mask) {
|
|
7929
7929
|
const raw = sourceShape(schema);
|
|
7930
7930
|
const keys = [];
|
|
7931
|
-
for (const
|
|
7932
|
-
if (!Object.getOwnPropertyDescriptor(raw,
|
|
7933
|
-
throw new Error(`Unrecognized key: "${String(
|
|
7931
|
+
for (const key2 of Reflect.ownKeys(mask)) {
|
|
7932
|
+
if (!Object.getOwnPropertyDescriptor(raw, key2)?.enumerable) {
|
|
7933
|
+
throw new Error(`Unrecognized key: "${String(key2)}"`);
|
|
7934
7934
|
}
|
|
7935
|
-
if (mask[
|
|
7936
|
-
keys.push(
|
|
7935
|
+
if (mask[key2])
|
|
7936
|
+
keys.push(key2);
|
|
7937
7937
|
}
|
|
7938
7938
|
return keys;
|
|
7939
7939
|
}
|
|
@@ -7946,7 +7946,7 @@ function omit(schema, mask) {
|
|
|
7946
7946
|
}
|
|
7947
7947
|
const omitted = new Set(maskedKeys(schema, mask));
|
|
7948
7948
|
const newShape = {};
|
|
7949
|
-
mirrorShape(newShape, schema, Reflect.ownKeys(sourceShape(schema)).filter((
|
|
7949
|
+
mirrorShape(newShape, schema, Reflect.ownKeys(sourceShape(schema)).filter((key2) => !omitted.has(key2)));
|
|
7950
7950
|
return clone(schema, mergeDefs(currDef, { shape: newShape, checks: [] }));
|
|
7951
7951
|
}
|
|
7952
7952
|
function extend(schema, shape) {
|
|
@@ -7957,8 +7957,8 @@ function extend(schema, shape) {
|
|
|
7957
7957
|
const hasChecks = checks && checks.length > 0;
|
|
7958
7958
|
if (hasChecks) {
|
|
7959
7959
|
const existingShape = sourceShape(schema);
|
|
7960
|
-
for (const
|
|
7961
|
-
if (Object.getOwnPropertyDescriptor(existingShape,
|
|
7960
|
+
for (const key2 of Reflect.ownKeys(shape)) {
|
|
7961
|
+
if (Object.getOwnPropertyDescriptor(existingShape, key2) !== void 0) {
|
|
7962
7962
|
throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.");
|
|
7963
7963
|
}
|
|
7964
7964
|
}
|
|
@@ -8005,15 +8005,15 @@ function partial(Class2, schema, mask, name = "partial") {
|
|
|
8005
8005
|
}
|
|
8006
8006
|
const selected = mask ? new Set(maskedKeys(schema, mask)) : void 0;
|
|
8007
8007
|
const newShape = {};
|
|
8008
|
-
mirrorShape(newShape, schema, Reflect.ownKeys(sourceShape(schema)), Class2 && ((value,
|
|
8008
|
+
mirrorShape(newShape, schema, Reflect.ownKeys(sourceShape(schema)), Class2 && ((value, key2) => selected && !selected.has(key2) ? value : new Class2({ type: "optional", innerType: value })));
|
|
8009
8009
|
return clone(schema, mergeDefs(schema._zod.def, { shape: newShape, checks: [] }));
|
|
8010
8010
|
}
|
|
8011
8011
|
function required(Class2, schema, mask) {
|
|
8012
8012
|
const selected = mask ? new Set(maskedKeys(schema, mask)) : void 0;
|
|
8013
8013
|
const newShape = {};
|
|
8014
|
-
mirrorShape(newShape, schema, Reflect.ownKeys(sourceShape(schema)), (value,
|
|
8014
|
+
mirrorShape(newShape, schema, Reflect.ownKeys(sourceShape(schema)), (value, key2) => (
|
|
8015
8015
|
// overwrite with non-optional
|
|
8016
|
-
selected && !selected.has(
|
|
8016
|
+
selected && !selected.has(key2) ? value : new Class2({ type: "nonoptional", innerType: value })
|
|
8017
8017
|
));
|
|
8018
8018
|
return clone(schema, mergeDefs(schema._zod.def, { shape: newShape }));
|
|
8019
8019
|
}
|
|
@@ -8188,46 +8188,46 @@ var Class = class {
|
|
|
8188
8188
|
}
|
|
8189
8189
|
};
|
|
8190
8190
|
function members(proto, table2) {
|
|
8191
|
-
for (const
|
|
8192
|
-
const desc = Object.getOwnPropertyDescriptor(table2,
|
|
8191
|
+
for (const key2 in table2) {
|
|
8192
|
+
const desc = Object.getOwnPropertyDescriptor(table2, key2);
|
|
8193
8193
|
if (desc.get)
|
|
8194
|
-
Object.defineProperty(proto,
|
|
8194
|
+
Object.defineProperty(proto, key2, { ...desc, enumerable: false });
|
|
8195
8195
|
else
|
|
8196
|
-
defineBound(proto,
|
|
8196
|
+
defineBound(proto, key2, desc.value);
|
|
8197
8197
|
}
|
|
8198
8198
|
}
|
|
8199
|
-
function own(inst,
|
|
8200
|
-
Object.defineProperty(inst,
|
|
8199
|
+
function own(inst, key2, value, enumerable = true) {
|
|
8200
|
+
Object.defineProperty(inst, key2, { configurable: true, writable: true, enumerable, value });
|
|
8201
8201
|
return value;
|
|
8202
8202
|
}
|
|
8203
|
-
function hide(inst,
|
|
8204
|
-
return own(inst,
|
|
8203
|
+
function hide(inst, key2, value) {
|
|
8204
|
+
return own(inst, key2, value, false);
|
|
8205
8205
|
}
|
|
8206
8206
|
// @__NO_SIDE_EFFECTS__
|
|
8207
8207
|
function derived(computes, table2) {
|
|
8208
|
-
for (const
|
|
8209
|
-
const compute = computes[
|
|
8210
|
-
Object.defineProperty(table2,
|
|
8208
|
+
for (const key2 in computes) {
|
|
8209
|
+
const compute = computes[key2];
|
|
8210
|
+
Object.defineProperty(table2, key2, {
|
|
8211
8211
|
configurable: true,
|
|
8212
8212
|
enumerable: true,
|
|
8213
8213
|
get() {
|
|
8214
|
-
return own(this,
|
|
8214
|
+
return own(this, key2, compute(this));
|
|
8215
8215
|
},
|
|
8216
8216
|
set(value) {
|
|
8217
|
-
own(this,
|
|
8217
|
+
own(this, key2, value);
|
|
8218
8218
|
}
|
|
8219
8219
|
});
|
|
8220
8220
|
}
|
|
8221
8221
|
return table2;
|
|
8222
8222
|
}
|
|
8223
|
-
function defineBound(proto,
|
|
8224
|
-
Object.defineProperty(proto,
|
|
8223
|
+
function defineBound(proto, key2, fn) {
|
|
8224
|
+
Object.defineProperty(proto, key2, {
|
|
8225
8225
|
configurable: true,
|
|
8226
8226
|
get() {
|
|
8227
|
-
return this == null ? fn : own(this,
|
|
8227
|
+
return this == null ? fn : own(this, key2, fn.bind(this));
|
|
8228
8228
|
},
|
|
8229
8229
|
set(value) {
|
|
8230
|
-
own(this,
|
|
8230
|
+
own(this, key2, value);
|
|
8231
8231
|
}
|
|
8232
8232
|
});
|
|
8233
8233
|
}
|
|
@@ -8244,53 +8244,53 @@ var breaker = {
|
|
|
8244
8244
|
return void 0;
|
|
8245
8245
|
}
|
|
8246
8246
|
};
|
|
8247
|
-
function defineLazyInternal(inst,
|
|
8247
|
+
function defineLazyInternal(inst, key2, compute) {
|
|
8248
8248
|
const proto = Object.getPrototypeOf(inst._zod);
|
|
8249
|
-
if (
|
|
8249
|
+
if (key2 in proto && installing !== inst._zod) {
|
|
8250
8250
|
installing = void 0;
|
|
8251
8251
|
return;
|
|
8252
8252
|
}
|
|
8253
8253
|
installing = inst._zod;
|
|
8254
|
-
Object.defineProperty(proto,
|
|
8254
|
+
Object.defineProperty(proto, key2, {
|
|
8255
8255
|
configurable: true,
|
|
8256
8256
|
get() {
|
|
8257
|
-
Object.defineProperty(this,
|
|
8257
|
+
Object.defineProperty(this, key2, breaker);
|
|
8258
8258
|
const outer = broke;
|
|
8259
8259
|
broke = false;
|
|
8260
8260
|
try {
|
|
8261
8261
|
const value = compute(this);
|
|
8262
8262
|
if (broke)
|
|
8263
|
-
delete this[
|
|
8263
|
+
delete this[key2];
|
|
8264
8264
|
else
|
|
8265
|
-
Object.defineProperty(this,
|
|
8265
|
+
Object.defineProperty(this, key2, { configurable: true, writable: true, value });
|
|
8266
8266
|
broke = broke || outer;
|
|
8267
8267
|
return value;
|
|
8268
8268
|
} catch (err) {
|
|
8269
|
-
delete this[
|
|
8269
|
+
delete this[key2];
|
|
8270
8270
|
broke = broke || outer;
|
|
8271
8271
|
throw err;
|
|
8272
8272
|
}
|
|
8273
8273
|
},
|
|
8274
8274
|
set(value) {
|
|
8275
|
-
Object.defineProperty(this,
|
|
8275
|
+
Object.defineProperty(this, key2, { configurable: true, writable: true, value });
|
|
8276
8276
|
}
|
|
8277
8277
|
});
|
|
8278
8278
|
}
|
|
8279
|
-
function installLazyProp(inst,
|
|
8280
|
-
const proto = claim(inst,
|
|
8279
|
+
function installLazyProp(inst, key2, make, enumerable) {
|
|
8280
|
+
const proto = claim(inst, key2);
|
|
8281
8281
|
if (!proto)
|
|
8282
8282
|
return;
|
|
8283
|
-
Object.defineProperty(proto,
|
|
8283
|
+
Object.defineProperty(proto, key2, {
|
|
8284
8284
|
configurable: true,
|
|
8285
8285
|
get() {
|
|
8286
8286
|
const desc = { configurable: true, writable: true, enumerable, value: void 0 };
|
|
8287
|
-
Object.defineProperty(this,
|
|
8287
|
+
Object.defineProperty(this, key2, desc);
|
|
8288
8288
|
desc.value = make(this);
|
|
8289
|
-
Object.defineProperty(this,
|
|
8289
|
+
Object.defineProperty(this, key2, desc);
|
|
8290
8290
|
return desc.value;
|
|
8291
8291
|
},
|
|
8292
8292
|
set(value) {
|
|
8293
|
-
Object.defineProperty(this,
|
|
8293
|
+
Object.defineProperty(this, key2, { configurable: true, writable: true, enumerable, value });
|
|
8294
8294
|
}
|
|
8295
8295
|
});
|
|
8296
8296
|
}
|
|
@@ -8463,15 +8463,15 @@ var $ZodError = $constructor("$ZodError", initializer);
|
|
|
8463
8463
|
var $ZodRealError = $constructor("$ZodError", initializer, void 0, {
|
|
8464
8464
|
Parent: Error
|
|
8465
8465
|
});
|
|
8466
|
-
function node(obj,
|
|
8467
|
-
if (!Object.prototype.hasOwnProperty.call(obj,
|
|
8468
|
-
if (
|
|
8469
|
-
Object.defineProperty(obj,
|
|
8466
|
+
function node(obj, key2, make) {
|
|
8467
|
+
if (!Object.prototype.hasOwnProperty.call(obj, key2)) {
|
|
8468
|
+
if (key2 === "__proto__") {
|
|
8469
|
+
Object.defineProperty(obj, key2, { value: make(), writable: true, enumerable: true, configurable: true });
|
|
8470
8470
|
} else {
|
|
8471
|
-
obj[
|
|
8471
|
+
obj[key2] = make();
|
|
8472
8472
|
}
|
|
8473
8473
|
}
|
|
8474
|
-
return obj[
|
|
8474
|
+
return obj[key2];
|
|
8475
8475
|
}
|
|
8476
8476
|
function flattenError(error2, mapper = (issue2) => issue2.message) {
|
|
8477
8477
|
const fieldErrors = {};
|
|
@@ -9725,8 +9725,8 @@ var $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
|
|
|
9725
9725
|
return payload;
|
|
9726
9726
|
};
|
|
9727
9727
|
});
|
|
9728
|
-
function handlePropertyResult(result2, final,
|
|
9729
|
-
const isPresent =
|
|
9728
|
+
function handlePropertyResult(result2, final, key2, input, optin, optout) {
|
|
9729
|
+
const isPresent = key2 in input;
|
|
9730
9730
|
const isOptionalOut = optout === "optional";
|
|
9731
9731
|
if (!isPresent && isOptionalOut && optin === "optional") {
|
|
9732
9732
|
return;
|
|
@@ -9735,7 +9735,7 @@ function handlePropertyResult(result2, final, key, input, optin, optout) {
|
|
|
9735
9735
|
if (optin !== void 0 && isOptionalOut && !isPresent) {
|
|
9736
9736
|
return;
|
|
9737
9737
|
}
|
|
9738
|
-
final.issues.push(...prefixIssues(
|
|
9738
|
+
final.issues.push(...prefixIssues(key2, result2.issues));
|
|
9739
9739
|
}
|
|
9740
9740
|
if (!isPresent && optin === void 0) {
|
|
9741
9741
|
if (!result2.issues.length) {
|
|
@@ -9743,17 +9743,17 @@ function handlePropertyResult(result2, final, key, input, optin, optout) {
|
|
|
9743
9743
|
code: "invalid_type",
|
|
9744
9744
|
expected: "nonoptional",
|
|
9745
9745
|
input: void 0,
|
|
9746
|
-
path: [
|
|
9746
|
+
path: [key2]
|
|
9747
9747
|
});
|
|
9748
9748
|
}
|
|
9749
9749
|
return;
|
|
9750
9750
|
}
|
|
9751
9751
|
if (result2.value === void 0) {
|
|
9752
9752
|
if (isPresent || optin === "defaulted" && !isOptionalOut) {
|
|
9753
|
-
final.value[
|
|
9753
|
+
final.value[key2] = void 0;
|
|
9754
9754
|
}
|
|
9755
9755
|
} else {
|
|
9756
|
-
final.value[
|
|
9756
|
+
final.value[key2] = result2.value;
|
|
9757
9757
|
}
|
|
9758
9758
|
}
|
|
9759
9759
|
var NO_SYMBOL_KEYS = [];
|
|
@@ -9786,28 +9786,28 @@ function handleCatchall(proms, input, payload, ctx, def, inst, abortEarly) {
|
|
|
9786
9786
|
const optin = _catchall.optin;
|
|
9787
9787
|
const optout = _catchall.optout;
|
|
9788
9788
|
let seen = 0;
|
|
9789
|
-
for (const
|
|
9789
|
+
for (const key2 in input) {
|
|
9790
9790
|
if (abortEarly && payload.issues.length !== seen) {
|
|
9791
9791
|
if (aborted(payload, seen))
|
|
9792
9792
|
break;
|
|
9793
9793
|
seen = payload.issues.length;
|
|
9794
9794
|
}
|
|
9795
|
-
if (keySet.has(
|
|
9795
|
+
if (keySet.has(key2))
|
|
9796
9796
|
continue;
|
|
9797
|
-
if (
|
|
9797
|
+
if (key2 === "__proto__") {
|
|
9798
9798
|
if (t === "never")
|
|
9799
|
-
unrecognized.push(
|
|
9799
|
+
unrecognized.push(key2);
|
|
9800
9800
|
continue;
|
|
9801
9801
|
}
|
|
9802
9802
|
if (t === "never") {
|
|
9803
|
-
unrecognized.push(
|
|
9803
|
+
unrecognized.push(key2);
|
|
9804
9804
|
continue;
|
|
9805
9805
|
}
|
|
9806
|
-
const r = _catchall.run({ value: input[
|
|
9806
|
+
const r = _catchall.run({ value: input[key2], issues: [] }, ctx);
|
|
9807
9807
|
if (r instanceof Promise) {
|
|
9808
|
-
proms.push(r.then((r2) => handlePropertyResult(r2, payload,
|
|
9808
|
+
proms.push(r.then((r2) => handlePropertyResult(r2, payload, key2, input, optin, optout)));
|
|
9809
9809
|
} else {
|
|
9810
|
-
handlePropertyResult(r, payload,
|
|
9810
|
+
handlePropertyResult(r, payload, key2, input, optin, optout);
|
|
9811
9811
|
}
|
|
9812
9812
|
}
|
|
9813
9813
|
if (unrecognized.length) {
|
|
@@ -9844,16 +9844,16 @@ var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
|
|
|
9844
9844
|
defineLazyInternal(inst, "propValues", (zod) => {
|
|
9845
9845
|
const shape = zod.def.shape;
|
|
9846
9846
|
const propValues = {};
|
|
9847
|
-
for (const
|
|
9848
|
-
const field = shape[
|
|
9847
|
+
for (const key2 in shape) {
|
|
9848
|
+
const field = shape[key2]._zod;
|
|
9849
9849
|
if (field.values) {
|
|
9850
|
-
if (!Object.prototype.hasOwnProperty.call(propValues,
|
|
9851
|
-
assignProp(propValues,
|
|
9850
|
+
if (!Object.prototype.hasOwnProperty.call(propValues, key2)) {
|
|
9851
|
+
assignProp(propValues, key2, /* @__PURE__ */ new Set());
|
|
9852
9852
|
}
|
|
9853
9853
|
for (const v of field.values)
|
|
9854
|
-
propValues[
|
|
9854
|
+
propValues[key2].add(v);
|
|
9855
9855
|
if (field.optin !== void 0)
|
|
9856
|
-
propValues[
|
|
9856
|
+
propValues[key2].add(void 0);
|
|
9857
9857
|
}
|
|
9858
9858
|
}
|
|
9859
9859
|
return propValues;
|
|
@@ -9880,22 +9880,22 @@ var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
|
|
|
9880
9880
|
const shape = value.shape;
|
|
9881
9881
|
const abortEarly = ctx?.abortEarly;
|
|
9882
9882
|
let seen = payload.issues.length;
|
|
9883
|
-
for (const
|
|
9883
|
+
for (const key2 of value.allKeys) {
|
|
9884
9884
|
if (abortEarly && payload.issues.length !== seen) {
|
|
9885
9885
|
if (aborted(payload, seen))
|
|
9886
9886
|
break;
|
|
9887
9887
|
seen = payload.issues.length;
|
|
9888
9888
|
}
|
|
9889
|
-
if (
|
|
9889
|
+
if (key2 === "__proto__")
|
|
9890
9890
|
continue;
|
|
9891
|
-
const el = shape[
|
|
9891
|
+
const el = shape[key2];
|
|
9892
9892
|
const optin = el._zod.optin;
|
|
9893
9893
|
const optout = el._zod.optout;
|
|
9894
|
-
const r = el._zod.run({ value: input[
|
|
9894
|
+
const r = el._zod.run({ value: input[key2], issues: [] }, ctx);
|
|
9895
9895
|
if (r instanceof Promise) {
|
|
9896
|
-
proms.push(r.then((r2) => handlePropertyResult(r2, payload,
|
|
9896
|
+
proms.push(r.then((r2) => handlePropertyResult(r2, payload, key2, input, optin, optout)));
|
|
9897
9897
|
} else {
|
|
9898
|
-
handlePropertyResult(r, payload,
|
|
9898
|
+
handlePropertyResult(r, payload, key2, input, optin, optout);
|
|
9899
9899
|
}
|
|
9900
9900
|
}
|
|
9901
9901
|
if (!catchall) {
|
|
@@ -9929,17 +9929,17 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
9929
9929
|
doc.write(`const input = payload.value;`);
|
|
9930
9930
|
const ids = /* @__PURE__ */ Object.create(null);
|
|
9931
9931
|
let counter = 0;
|
|
9932
|
-
for (const
|
|
9933
|
-
ids[
|
|
9932
|
+
for (const key2 of normalized.allKeys) {
|
|
9933
|
+
ids[key2] = `key_${counter++}`;
|
|
9934
9934
|
}
|
|
9935
9935
|
doc.write(memo2 ? `const newResult = memo.alloc(inst, payload, {}, ctx);` : `const newResult = {};`);
|
|
9936
|
-
for (const
|
|
9937
|
-
if (
|
|
9936
|
+
for (const key2 of normalized.allKeys) {
|
|
9937
|
+
if (key2 === "__proto__")
|
|
9938
9938
|
continue;
|
|
9939
|
-
const id2 = ids[
|
|
9940
|
-
const k = typeof
|
|
9939
|
+
const id2 = ids[key2];
|
|
9940
|
+
const k = typeof key2 === "symbol" ? `syms[${syms.indexOf(key2)}]` : esc(key2);
|
|
9941
9941
|
const isPresent = `${k} in input`;
|
|
9942
|
-
const schema = shape[
|
|
9942
|
+
const schema = shape[key2];
|
|
9943
9943
|
const optin = schema?._zod?.optin;
|
|
9944
9944
|
const isOptionalIn = optin !== void 0;
|
|
9945
9945
|
const isOptionalOut = schema?._zod?.optout === "optional";
|
|
@@ -10203,21 +10203,21 @@ function mergeValues(a, b) {
|
|
|
10203
10203
|
}
|
|
10204
10204
|
if (isPlainObject(a) && isPlainObject(b)) {
|
|
10205
10205
|
const bKeys = Object.keys(b);
|
|
10206
|
-
const sharedKeys = Object.keys(a).filter((
|
|
10206
|
+
const sharedKeys = Object.keys(a).filter((key2) => bKeys.indexOf(key2) !== -1);
|
|
10207
10207
|
const newObj = { ...a, ...b };
|
|
10208
10208
|
if (Object.prototype.hasOwnProperty.call(newObj, "__proto__"))
|
|
10209
10209
|
delete newObj.__proto__;
|
|
10210
|
-
for (const
|
|
10211
|
-
if (
|
|
10210
|
+
for (const key2 of sharedKeys) {
|
|
10211
|
+
if (key2 === "__proto__")
|
|
10212
10212
|
continue;
|
|
10213
|
-
const sharedValue = mergeValues(a[
|
|
10213
|
+
const sharedValue = mergeValues(a[key2], b[key2]);
|
|
10214
10214
|
if (!sharedValue.valid) {
|
|
10215
10215
|
return {
|
|
10216
10216
|
valid: false,
|
|
10217
|
-
mergeErrorPath: [
|
|
10217
|
+
mergeErrorPath: [key2, ...sharedValue.mergeErrorPath]
|
|
10218
10218
|
};
|
|
10219
10219
|
}
|
|
10220
|
-
newObj[
|
|
10220
|
+
newObj[key2] = sharedValue.data;
|
|
10221
10221
|
}
|
|
10222
10222
|
return { valid: true, data: newObj };
|
|
10223
10223
|
}
|
|
@@ -10313,12 +10313,12 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
10313
10313
|
if (values && !def.partial) {
|
|
10314
10314
|
payload.value = memo2 ? memo2.alloc(inst, payload, {}, ctx) : {};
|
|
10315
10315
|
const recordKeys = /* @__PURE__ */ new Set();
|
|
10316
|
-
for (const
|
|
10317
|
-
if (typeof
|
|
10318
|
-
recordKeys.add(typeof
|
|
10319
|
-
if (
|
|
10316
|
+
for (const key2 of values) {
|
|
10317
|
+
if (typeof key2 === "string" || typeof key2 === "number" || typeof key2 === "symbol") {
|
|
10318
|
+
recordKeys.add(typeof key2 === "number" ? key2.toString() : key2);
|
|
10319
|
+
if (key2 === "__proto__")
|
|
10320
10320
|
continue;
|
|
10321
|
-
const keyResult = def.keyType._zod.run({ value:
|
|
10321
|
+
const keyResult = def.keyType._zod.run({ value: key2, issues: [] }, ctx);
|
|
10322
10322
|
if (keyResult instanceof Promise) {
|
|
10323
10323
|
throw new Error("Async schemas not supported in object keys currently");
|
|
10324
10324
|
}
|
|
@@ -10327,8 +10327,8 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
10327
10327
|
code: "invalid_key",
|
|
10328
10328
|
origin: "record",
|
|
10329
10329
|
issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config())),
|
|
10330
|
-
input:
|
|
10331
|
-
path: [
|
|
10330
|
+
input: key2,
|
|
10331
|
+
path: [key2],
|
|
10332
10332
|
inst
|
|
10333
10333
|
});
|
|
10334
10334
|
continue;
|
|
@@ -10336,32 +10336,32 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
10336
10336
|
const outKey = keyResult.value;
|
|
10337
10337
|
if (outKey === "__proto__")
|
|
10338
10338
|
continue;
|
|
10339
|
-
const result2 = def.valueType._zod.run({ value: input[
|
|
10339
|
+
const result2 = def.valueType._zod.run({ value: input[key2], issues: [] }, ctx);
|
|
10340
10340
|
if (result2 instanceof Promise) {
|
|
10341
10341
|
proms.push(result2.then((result3) => {
|
|
10342
10342
|
if (result3.issues.length) {
|
|
10343
|
-
payload.issues.push(...prefixIssues(
|
|
10343
|
+
payload.issues.push(...prefixIssues(key2, result3.issues));
|
|
10344
10344
|
}
|
|
10345
10345
|
payload.value[outKey] = result3.value;
|
|
10346
10346
|
}));
|
|
10347
10347
|
} else {
|
|
10348
10348
|
if (result2.issues.length) {
|
|
10349
|
-
payload.issues.push(...prefixIssues(
|
|
10349
|
+
payload.issues.push(...prefixIssues(key2, result2.issues));
|
|
10350
10350
|
}
|
|
10351
10351
|
payload.value[outKey] = result2.value;
|
|
10352
10352
|
}
|
|
10353
10353
|
}
|
|
10354
10354
|
}
|
|
10355
10355
|
let unrecognized;
|
|
10356
|
-
for (const
|
|
10357
|
-
if (!recordKeys.has(
|
|
10356
|
+
for (const key2 in input) {
|
|
10357
|
+
if (!recordKeys.has(key2)) {
|
|
10358
10358
|
if (def.mode === "loose") {
|
|
10359
|
-
if (
|
|
10359
|
+
if (key2 === "__proto__")
|
|
10360
10360
|
continue;
|
|
10361
|
-
payload.value[
|
|
10361
|
+
payload.value[key2] = input[key2];
|
|
10362
10362
|
} else {
|
|
10363
10363
|
unrecognized = unrecognized ?? [];
|
|
10364
|
-
unrecognized.push(
|
|
10364
|
+
unrecognized.push(key2);
|
|
10365
10365
|
}
|
|
10366
10366
|
}
|
|
10367
10367
|
}
|
|
@@ -10377,18 +10377,18 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
10377
10377
|
} else {
|
|
10378
10378
|
payload.value = memo2 ? memo2.alloc(inst, payload, {}, ctx) : {};
|
|
10379
10379
|
let unrecognized;
|
|
10380
|
-
for (const
|
|
10381
|
-
if (
|
|
10380
|
+
for (const key2 of Reflect.ownKeys(input)) {
|
|
10381
|
+
if (key2 === "__proto__")
|
|
10382
10382
|
continue;
|
|
10383
|
-
if (!Object.prototype.propertyIsEnumerable.call(input,
|
|
10383
|
+
if (!Object.prototype.propertyIsEnumerable.call(input, key2))
|
|
10384
10384
|
continue;
|
|
10385
|
-
let keyResult = def.keyType._zod.run({ value:
|
|
10385
|
+
let keyResult = def.keyType._zod.run({ value: key2, issues: [] }, ctx);
|
|
10386
10386
|
if (keyResult instanceof Promise) {
|
|
10387
10387
|
throw new Error("Async schemas not supported in object keys currently");
|
|
10388
10388
|
}
|
|
10389
|
-
const checkNumericKey = typeof
|
|
10389
|
+
const checkNumericKey = typeof key2 === "string" && number.test(key2) && keyResult.issues.length;
|
|
10390
10390
|
if (checkNumericKey) {
|
|
10391
|
-
const retryResult = def.keyType._zod.run({ value: Number(
|
|
10391
|
+
const retryResult = def.keyType._zod.run({ value: Number(key2), issues: [] }, ctx);
|
|
10392
10392
|
if (retryResult instanceof Promise) {
|
|
10393
10393
|
throw new Error("Async schemas not supported in object keys currently");
|
|
10394
10394
|
}
|
|
@@ -10398,17 +10398,17 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
10398
10398
|
}
|
|
10399
10399
|
if (keyResult.issues.length) {
|
|
10400
10400
|
if (def.mode === "loose") {
|
|
10401
|
-
payload.value[
|
|
10401
|
+
payload.value[key2] = input[key2];
|
|
10402
10402
|
} else if (values) {
|
|
10403
10403
|
unrecognized = unrecognized ?? [];
|
|
10404
|
-
unrecognized.push(
|
|
10404
|
+
unrecognized.push(key2);
|
|
10405
10405
|
} else {
|
|
10406
10406
|
payload.issues.push({
|
|
10407
10407
|
code: "invalid_key",
|
|
10408
10408
|
origin: "record",
|
|
10409
10409
|
issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config())),
|
|
10410
|
-
input:
|
|
10411
|
-
path: [
|
|
10410
|
+
input: key2,
|
|
10411
|
+
path: [key2],
|
|
10412
10412
|
inst
|
|
10413
10413
|
});
|
|
10414
10414
|
}
|
|
@@ -10417,17 +10417,17 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
10417
10417
|
const outKey = keyResult.value;
|
|
10418
10418
|
if (outKey === "__proto__")
|
|
10419
10419
|
continue;
|
|
10420
|
-
const result2 = def.valueType._zod.run({ value: input[
|
|
10420
|
+
const result2 = def.valueType._zod.run({ value: input[key2], issues: [] }, ctx);
|
|
10421
10421
|
if (result2 instanceof Promise) {
|
|
10422
10422
|
proms.push(result2.then((result3) => {
|
|
10423
10423
|
if (result3.issues.length) {
|
|
10424
|
-
payload.issues.push(...prefixIssues(
|
|
10424
|
+
payload.issues.push(...prefixIssues(key2, result3.issues));
|
|
10425
10425
|
}
|
|
10426
10426
|
payload.value[outKey] = result3.value;
|
|
10427
10427
|
}));
|
|
10428
10428
|
} else {
|
|
10429
10429
|
if (result2.issues.length) {
|
|
10430
|
-
payload.issues.push(...prefixIssues(
|
|
10430
|
+
payload.issues.push(...prefixIssues(key2, result2.issues));
|
|
10431
10431
|
}
|
|
10432
10432
|
payload.value[outKey] = result2.value;
|
|
10433
10433
|
}
|
|
@@ -10789,8 +10789,8 @@ function isRecursive(inst, stack, resolve11) {
|
|
|
10789
10789
|
};
|
|
10790
10790
|
const shape = (sh, spread) => {
|
|
10791
10791
|
let answer = NONE;
|
|
10792
|
-
for (const
|
|
10793
|
-
const desc = Object.getOwnPropertyDescriptor(sh,
|
|
10792
|
+
for (const key2 of Reflect.ownKeys(sh)) {
|
|
10793
|
+
const desc = Object.getOwnPropertyDescriptor(sh, key2);
|
|
10794
10794
|
if (spread && !desc.enumerable)
|
|
10795
10795
|
continue;
|
|
10796
10796
|
const child = desc.get ? ASSUMED : desc.value?._zod ? isRecursive(desc.value, stack, resolve11) : NONE;
|
|
@@ -10886,8 +10886,8 @@ function isRecursive(inst, stack, resolve11) {
|
|
|
10886
10886
|
break;
|
|
10887
10887
|
default: {
|
|
10888
10888
|
kind;
|
|
10889
|
-
for (const
|
|
10890
|
-
const desc = Object.getOwnPropertyDescriptor(def,
|
|
10889
|
+
for (const key2 in def) {
|
|
10890
|
+
const desc = Object.getOwnPropertyDescriptor(def, key2);
|
|
10891
10891
|
if (!desc || desc.get)
|
|
10892
10892
|
continue;
|
|
10893
10893
|
const value = desc.value;
|
|
@@ -11730,9 +11730,9 @@ function _check(fn, params) {
|
|
|
11730
11730
|
// node_modules/zod/v4/core/to-json-schema.js
|
|
11731
11731
|
function assignProps(target, ...sources) {
|
|
11732
11732
|
for (const source of sources) {
|
|
11733
|
-
for (const
|
|
11734
|
-
if (Object.prototype.propertyIsEnumerable.call(source,
|
|
11735
|
-
assignProp(target,
|
|
11733
|
+
for (const key2 of Reflect.ownKeys(source)) {
|
|
11734
|
+
if (Object.prototype.propertyIsEnumerable.call(source, key2)) {
|
|
11735
|
+
assignProp(target, key2, source[key2]);
|
|
11736
11736
|
}
|
|
11737
11737
|
}
|
|
11738
11738
|
}
|
|
@@ -11878,8 +11878,8 @@ function extractDefs(ctx, schema) {
|
|
|
11878
11878
|
if (defId)
|
|
11879
11879
|
seen.defId = defId;
|
|
11880
11880
|
const schema2 = seen.schema;
|
|
11881
|
-
for (const
|
|
11882
|
-
delete schema2[
|
|
11881
|
+
for (const key2 in schema2) {
|
|
11882
|
+
delete schema2[key2];
|
|
11883
11883
|
}
|
|
11884
11884
|
schema2.$ref = ref;
|
|
11885
11885
|
};
|
|
@@ -11960,8 +11960,8 @@ function foldObjects(members2) {
|
|
|
11960
11960
|
for (const member of members2) {
|
|
11961
11961
|
if (typeof member !== "object" || member.type !== "object")
|
|
11962
11962
|
return null;
|
|
11963
|
-
for (const
|
|
11964
|
-
if (!FOLDABLE_KEYS.has(
|
|
11963
|
+
for (const key2 in member) {
|
|
11964
|
+
if (!FOLDABLE_KEYS.has(key2))
|
|
11965
11965
|
return null;
|
|
11966
11966
|
}
|
|
11967
11967
|
objects.push(member);
|
|
@@ -11969,22 +11969,22 @@ function foldObjects(members2) {
|
|
|
11969
11969
|
const properties = {};
|
|
11970
11970
|
const required2 = /* @__PURE__ */ new Set();
|
|
11971
11971
|
for (const object6 of objects) {
|
|
11972
|
-
for (const
|
|
11973
|
-
if (Object.prototype.hasOwnProperty.call(properties,
|
|
11972
|
+
for (const key2 in object6.properties) {
|
|
11973
|
+
if (Object.prototype.hasOwnProperty.call(properties, key2))
|
|
11974
11974
|
continue;
|
|
11975
11975
|
const parts = [];
|
|
11976
11976
|
for (const other of objects) {
|
|
11977
|
-
const part = other.properties?.[
|
|
11977
|
+
const part = other.properties?.[key2] ?? undeclaredConstraint(other);
|
|
11978
11978
|
if (part === null || part === void 0)
|
|
11979
11979
|
continue;
|
|
11980
11980
|
if (!parts.some((seen) => JSON.stringify(seen) === JSON.stringify(part)))
|
|
11981
11981
|
parts.push(part);
|
|
11982
11982
|
}
|
|
11983
11983
|
const merged = parts.length === 1 ? parts[0] : foldObjects(parts) ?? { allOf: parts };
|
|
11984
|
-
assignProp(properties,
|
|
11984
|
+
assignProp(properties, key2, merged);
|
|
11985
11985
|
}
|
|
11986
|
-
for (const
|
|
11987
|
-
required2.add(
|
|
11986
|
+
for (const key2 of object6.required ?? [])
|
|
11987
|
+
required2.add(key2);
|
|
11988
11988
|
}
|
|
11989
11989
|
const folded = { type: "object", properties };
|
|
11990
11990
|
if (required2.size)
|
|
@@ -12009,8 +12009,8 @@ function foldIntersection(json2) {
|
|
|
12009
12009
|
const allOf = json2.allOf;
|
|
12010
12010
|
if (!Array.isArray(allOf) || allOf.length < 2)
|
|
12011
12011
|
return;
|
|
12012
|
-
for (const
|
|
12013
|
-
if (
|
|
12012
|
+
for (const key2 of FOLDABLE_KEYS)
|
|
12013
|
+
if (key2 in json2)
|
|
12014
12014
|
return;
|
|
12015
12015
|
const unions = allOf.filter((m) => UNION_KEYS.some((k) => Array.isArray(m[k])));
|
|
12016
12016
|
let folded = null;
|
|
@@ -12057,20 +12057,20 @@ function finalize(ctx, schema) {
|
|
|
12057
12057
|
assignProps(schema2, _cached);
|
|
12058
12058
|
const isParentRef = zodSchema._zod.parent === ref;
|
|
12059
12059
|
if (isParentRef) {
|
|
12060
|
-
for (const
|
|
12061
|
-
if (
|
|
12060
|
+
for (const key2 in schema2) {
|
|
12061
|
+
if (key2 === "$ref" || key2 === "allOf")
|
|
12062
12062
|
continue;
|
|
12063
|
-
if (!(
|
|
12064
|
-
delete schema2[
|
|
12063
|
+
if (!(key2 in _cached)) {
|
|
12064
|
+
delete schema2[key2];
|
|
12065
12065
|
}
|
|
12066
12066
|
}
|
|
12067
12067
|
}
|
|
12068
12068
|
if (refSchema.$ref && refSeen.def) {
|
|
12069
|
-
for (const
|
|
12070
|
-
if (
|
|
12069
|
+
for (const key2 in schema2) {
|
|
12070
|
+
if (key2 === "$ref" || key2 === "allOf")
|
|
12071
12071
|
continue;
|
|
12072
|
-
if (
|
|
12073
|
-
delete schema2[
|
|
12072
|
+
if (key2 in refSeen.def && JSON.stringify(schema2[key2]) === JSON.stringify(refSeen.def[key2])) {
|
|
12073
|
+
delete schema2[key2];
|
|
12074
12074
|
}
|
|
12075
12075
|
}
|
|
12076
12076
|
}
|
|
@@ -12082,11 +12082,11 @@ function finalize(ctx, schema) {
|
|
|
12082
12082
|
if (parentSeen?.schema.$ref) {
|
|
12083
12083
|
schema2.$ref = parentSeen.schema.$ref;
|
|
12084
12084
|
if (parentSeen.def) {
|
|
12085
|
-
for (const
|
|
12086
|
-
if (
|
|
12085
|
+
for (const key2 in schema2) {
|
|
12086
|
+
if (key2 === "$ref" || key2 === "allOf")
|
|
12087
12087
|
continue;
|
|
12088
|
-
if (
|
|
12089
|
-
delete schema2[
|
|
12088
|
+
if (key2 in parentSeen.def && JSON.stringify(schema2[key2]) === JSON.stringify(parentSeen.def[key2])) {
|
|
12089
|
+
delete schema2[key2];
|
|
12090
12090
|
}
|
|
12091
12091
|
}
|
|
12092
12092
|
}
|
|
@@ -12219,8 +12219,8 @@ function isTransforming(_schema, _ctx) {
|
|
|
12219
12219
|
return isTransforming(def.in, ctx) || isTransforming(def.out, ctx);
|
|
12220
12220
|
}
|
|
12221
12221
|
if (def.type === "object") {
|
|
12222
|
-
for (const
|
|
12223
|
-
if (isTransforming(def.shape[
|
|
12222
|
+
for (const key2 in def.shape) {
|
|
12223
|
+
if (isTransforming(def.shape[key2], ctx))
|
|
12224
12224
|
return true;
|
|
12225
12225
|
}
|
|
12226
12226
|
return false;
|
|
@@ -12258,13 +12258,13 @@ var createStandardJSONSchemaMethod = (schema, io, processors = {}) => (params) =
|
|
|
12258
12258
|
};
|
|
12259
12259
|
|
|
12260
12260
|
// node_modules/zod/v4/core/json-schema-processors.js
|
|
12261
|
-
var narrowMin = (agg,
|
|
12262
|
-
if (agg[
|
|
12263
|
-
agg[
|
|
12261
|
+
var narrowMin = (agg, key2, value) => {
|
|
12262
|
+
if (agg[key2] === void 0 || value > agg[key2])
|
|
12263
|
+
agg[key2] = value;
|
|
12264
12264
|
};
|
|
12265
|
-
var narrowMax = (agg,
|
|
12266
|
-
if (agg[
|
|
12267
|
-
agg[
|
|
12265
|
+
var narrowMax = (agg, key2, value) => {
|
|
12266
|
+
if (agg[key2] === void 0 || value < agg[key2])
|
|
12267
|
+
agg[key2] = value;
|
|
12268
12268
|
};
|
|
12269
12269
|
var narrowBoth = (agg, value) => {
|
|
12270
12270
|
narrowMin(agg, "minimum", value);
|
|
@@ -12543,17 +12543,17 @@ var objectProcessor = (schema, ctx, _json, params) => {
|
|
|
12543
12543
|
}
|
|
12544
12544
|
json2.type = "object";
|
|
12545
12545
|
json2.properties = {};
|
|
12546
|
-
for (const
|
|
12547
|
-
assignProp(json2.properties,
|
|
12546
|
+
for (const key2 in shape) {
|
|
12547
|
+
assignProp(json2.properties, key2, processSchema(shape[key2], ctx, {
|
|
12548
12548
|
...params,
|
|
12549
|
-
path: [...params.path, "properties",
|
|
12549
|
+
path: [...params.path, "properties", key2]
|
|
12550
12550
|
}));
|
|
12551
12551
|
}
|
|
12552
12552
|
const requiredKeys = [];
|
|
12553
|
-
for (const
|
|
12554
|
-
const field = def.shape[
|
|
12553
|
+
for (const key2 of Object.keys(shape)) {
|
|
12554
|
+
const field = def.shape[key2];
|
|
12555
12555
|
if (ctx.io === "input" ? inputOptin(field) === void 0 : field._zod.optout === void 0) {
|
|
12556
|
-
requiredKeys.push(
|
|
12556
|
+
requiredKeys.push(key2);
|
|
12557
12557
|
}
|
|
12558
12558
|
}
|
|
12559
12559
|
if (requiredKeys.length > 0) {
|
|
@@ -12860,17 +12860,17 @@ function getLiteralValue(schema) {
|
|
|
12860
12860
|
|
|
12861
12861
|
// node_modules/zod/v4/classic/errors.js
|
|
12862
12862
|
var _installedErrorProtos = /* @__PURE__ */ new WeakSet([Object.prototype, Error.prototype]);
|
|
12863
|
-
function _lazyMethod(proto,
|
|
12864
|
-
Object.defineProperty(proto,
|
|
12863
|
+
function _lazyMethod(proto, key2, make) {
|
|
12864
|
+
Object.defineProperty(proto, key2, {
|
|
12865
12865
|
configurable: true,
|
|
12866
12866
|
enumerable: false,
|
|
12867
12867
|
get() {
|
|
12868
12868
|
const value = make(this);
|
|
12869
|
-
Object.defineProperty(this,
|
|
12869
|
+
Object.defineProperty(this, key2, { value, configurable: true, writable: true });
|
|
12870
12870
|
return value;
|
|
12871
12871
|
},
|
|
12872
12872
|
set(value) {
|
|
12873
|
-
Object.defineProperty(this,
|
|
12873
|
+
Object.defineProperty(this, key2, { value, configurable: true, writable: true });
|
|
12874
12874
|
}
|
|
12875
12875
|
});
|
|
12876
12876
|
}
|
|
@@ -16373,8 +16373,8 @@ function isPlainObject2(value) {
|
|
|
16373
16373
|
}
|
|
16374
16374
|
function mergeCapabilities(base, additional) {
|
|
16375
16375
|
const result2 = { ...base };
|
|
16376
|
-
for (const
|
|
16377
|
-
const k =
|
|
16376
|
+
for (const key2 in additional) {
|
|
16377
|
+
const k = key2;
|
|
16378
16378
|
const addValue = additional[k];
|
|
16379
16379
|
if (addValue === void 0)
|
|
16380
16380
|
continue;
|
|
@@ -17253,9 +17253,9 @@ function loadEnvironment(path, env = process.env, home = env.HOME ?? homedir())
|
|
|
17253
17253
|
let next = i + 1;
|
|
17254
17254
|
while (/\s/.test(text5[next] ?? "") && next < text5.length) next++;
|
|
17255
17255
|
if (depth === 1 && text5[next] === ":") {
|
|
17256
|
-
const
|
|
17257
|
-
if (seen.has(
|
|
17258
|
-
seen.add(
|
|
17256
|
+
const key2 = JSON.parse(text5.slice(start, i + 1));
|
|
17257
|
+
if (seen.has(key2)) throw new Error(`Duplicate environment profile key: ${key2}`);
|
|
17258
|
+
seen.add(key2);
|
|
17259
17259
|
}
|
|
17260
17260
|
} else if (text5[i] === "{" || text5[i] === "[") depth++;
|
|
17261
17261
|
else if (text5[i] === "}" || text5[i] === "]") depth--;
|
|
@@ -17266,24 +17266,24 @@ function loadEnvironment(path, env = process.env, home = env.HOME ?? homedir())
|
|
|
17266
17266
|
const p = raw;
|
|
17267
17267
|
if (p.schemaVersion !== 2 || typeof p.id !== "string" || !/^[a-z0-9][a-z0-9-]{0,47}$/.test(p.id)) throw new Error("Invalid environment schemaVersion or id");
|
|
17268
17268
|
const profile = { schemaVersion: 2, id: p.id, vmServiceUrl: endpoint(p.vmServiceUrl) };
|
|
17269
|
-
for (const
|
|
17269
|
+
for (const key2 of paths) profile[key2] = canonicalPath(p[key2]);
|
|
17270
17270
|
if (!statSync(profile.imageRepository).isDirectory() || !statSync(join(profile.imageRepository, "images")).isDirectory()) throw new Error("Selected imageRepository must contain images/");
|
|
17271
|
-
for (const
|
|
17272
|
-
if (!statSync(profile[
|
|
17273
|
-
accessSync(profile[
|
|
17271
|
+
for (const key2 of ["machctlPath", "tartPath"]) {
|
|
17272
|
+
if (!statSync(profile[key2]).isFile()) throw new Error(`${key2} must be a regular executable file`);
|
|
17273
|
+
accessSync(profile[key2], constants.X_OK);
|
|
17274
17274
|
}
|
|
17275
17275
|
const state = env.XDG_STATE_HOME ? canonicalPath(env.XDG_STATE_HOME) : join(canonicalPath(home), ".local/state");
|
|
17276
17276
|
const names = ["machine-service", "vm-service", "pilot-images", "mcp-relay", "mcp-vm-relay"];
|
|
17277
17277
|
const defaults = [join(canonicalPath(home), ".tart"), ...names.map((n) => join(state, n)), ...names.map((n) => join(canonicalPath(home), ".local/state", n))].map(canonicalPath);
|
|
17278
|
-
for (const
|
|
17279
|
-
const value = profile[
|
|
17278
|
+
for (const key2 of mutable) {
|
|
17279
|
+
const value = profile[key2];
|
|
17280
17280
|
try {
|
|
17281
|
-
if (!statSync(value).isDirectory()) throw new Error(`${
|
|
17281
|
+
if (!statSync(value).isDirectory()) throw new Error(`${key2} must be a directory`);
|
|
17282
17282
|
} catch (error2) {
|
|
17283
17283
|
if (error2.code !== "ENOENT") throw error2;
|
|
17284
17284
|
}
|
|
17285
|
-
if (overlaps(value, profile.imageRepository) || defaults.some((root) => overlaps(value, root))) throw new Error(`${
|
|
17286
|
-
for (const other of mutable) if (
|
|
17285
|
+
if (overlaps(value, profile.imageRepository) || defaults.some((root) => overlaps(value, root))) throw new Error(`${key2} overlaps the repository or a legacy default store/state root`);
|
|
17286
|
+
for (const other of mutable) if (key2 !== other && overlaps(value, profile[other])) throw new Error("Environment mutable roots must be disjoint");
|
|
17287
17287
|
}
|
|
17288
17288
|
const ordered = Object.fromEntries(Object.keys(profile).sort().map((k) => [k, profile[k]]));
|
|
17289
17289
|
const fingerprint = createHash("sha256").update(JSON.stringify(ordered), "utf8").digest("hex");
|
|
@@ -17325,7 +17325,7 @@ function environmentVariables(selected) {
|
|
|
17325
17325
|
function matchesEnvironment(actual, selected) {
|
|
17326
17326
|
if (!actual || typeof actual !== "object" || Array.isArray(actual)) return false;
|
|
17327
17327
|
const identity = actual;
|
|
17328
|
-
return Object.keys(identity).length === Object.keys(selected.identity).length && Object.entries(selected.identity).every(([
|
|
17328
|
+
return Object.keys(identity).length === Object.keys(selected.identity).length && Object.entries(selected.identity).every(([key2, value]) => identity[key2] === value);
|
|
17329
17329
|
}
|
|
17330
17330
|
|
|
17331
17331
|
// src/config.ts
|
|
@@ -17821,7 +17821,7 @@ var MachineService = class {
|
|
|
17821
17821
|
const host = url.hostname.replace(/^\[|\]$/g, "");
|
|
17822
17822
|
const loopback = host === "localhost" || host === "::1" || isIP2(host) === 4 && host.startsWith("127.");
|
|
17823
17823
|
if (!loopback && !options.listed || !["http:", "https:"].includes(url.protocol) || url.username || url.password || url.search || url.hash || url.pathname !== "/") {
|
|
17824
|
-
throw new TypeError("machine-service baseUrl must be a loopback HTTP(S) origin, or one
|
|
17824
|
+
throw new TypeError("machine-service baseUrl must be a loopback HTTP(S) origin, or one discovery found, without credentials, path, query or fragment");
|
|
17825
17825
|
}
|
|
17826
17826
|
this.baseUrl = url.origin;
|
|
17827
17827
|
this.timeoutMs = positive(options.timeoutMs ?? 66e4, "timeoutMs");
|
|
@@ -17862,7 +17862,8 @@ var MachineService = class {
|
|
|
17862
17862
|
}
|
|
17863
17863
|
}
|
|
17864
17864
|
async get(vm, options = {}) {
|
|
17865
|
-
|
|
17865
|
+
const path = this.path(vm) + (options.lease_id ? `?${new URLSearchParams({ lease_id: options.lease_id })}` : "");
|
|
17866
|
+
return named(await this.request(path, void 0, options));
|
|
17866
17867
|
}
|
|
17867
17868
|
/**
|
|
17868
17869
|
* Cancellation before dispatch prevents allocation. Once dispatched we deliberately
|
|
@@ -17977,7 +17978,7 @@ var MachineService = class {
|
|
|
17977
17978
|
const controller = new AbortController();
|
|
17978
17979
|
const abort = () => controller.abort(options.signal?.reason);
|
|
17979
17980
|
options.signal?.addEventListener("abort", abort, { once: true });
|
|
17980
|
-
const expire = () => controller.abort(new MachineServiceError(`machine-service ${path} timed out after ${timeoutMs2}ms${stream.idle ? " without a byte" : ""}`));
|
|
17981
|
+
const expire = () => controller.abort(Object.assign(new MachineServiceError(`machine-service ${path} timed out after ${timeoutMs2}ms${stream.idle ? " without a byte" : ""}`), { code: "ETIMEDOUT" }));
|
|
17981
17982
|
let timer = setTimeout(expire, timeoutMs2);
|
|
17982
17983
|
try {
|
|
17983
17984
|
const response = await fetch(`${this.baseUrl}${path}`, {
|
|
@@ -18053,10 +18054,10 @@ var RegistryError = class extends Error {
|
|
|
18053
18054
|
};
|
|
18054
18055
|
var columns = ["machine", "os", "taskName", "agent", "project", "startDate"];
|
|
18055
18056
|
function cells(row) {
|
|
18056
|
-
return columns.map((
|
|
18057
|
-
const value = row[
|
|
18057
|
+
return columns.map((key2) => {
|
|
18058
|
+
const value = row[key2];
|
|
18058
18059
|
if (typeof value !== "string" || !value.trim() || value !== value.trim() || /[|\r\n\u0000-\u001f\u007f]/.test(value)) {
|
|
18059
|
-
throw new RegistryError(`Registry ${
|
|
18060
|
+
throw new RegistryError(`Registry ${key2} must be nonempty trimmed text without pipes or control characters`);
|
|
18060
18061
|
}
|
|
18061
18062
|
return value;
|
|
18062
18063
|
});
|
|
@@ -18957,9 +18958,9 @@ var Transfer = class {
|
|
|
18957
18958
|
await bounded3(async () => {
|
|
18958
18959
|
await this.options.onRetry?.({ operation: "pull", attempt, diagnostic });
|
|
18959
18960
|
});
|
|
18960
|
-
const
|
|
18961
|
-
if (
|
|
18962
|
-
const timer2 = setTimeout(done,
|
|
18961
|
+
const wait2 = options.retryDelaysMs?.[attempt - 1];
|
|
18962
|
+
if (wait2) await bounded3(() => new Promise((done) => {
|
|
18963
|
+
const timer2 = setTimeout(done, wait2);
|
|
18963
18964
|
controller.signal.addEventListener("abort", () => {
|
|
18964
18965
|
clearTimeout(timer2);
|
|
18965
18966
|
done();
|
|
@@ -19224,7 +19225,7 @@ var VmTransport = class {
|
|
|
19224
19225
|
await assertHostPath(this.hostRoot, local, true);
|
|
19225
19226
|
await jsonFile(local, payload);
|
|
19226
19227
|
await this.transfer.pushFile(local, remote, this.hostRoot);
|
|
19227
|
-
const
|
|
19228
|
+
const wait2 = request.snapshots?.group?.afterIntervalMs ?? request.snapshots?.afterIntervalMs ?? 0;
|
|
19228
19229
|
let response;
|
|
19229
19230
|
try {
|
|
19230
19231
|
const result2 = await this.transfer.vm.exec(this.transfer.name, [
|
|
@@ -19236,7 +19237,7 @@ var VmTransport = class {
|
|
|
19236
19237
|
INVOKE,
|
|
19237
19238
|
join8(this.guestRoot, "receiver.mjs"),
|
|
19238
19239
|
remote
|
|
19239
|
-
], this.timeoutMs + 18e4 +
|
|
19240
|
+
], this.timeoutMs + 18e4 + wait2, { signal: this.signal });
|
|
19240
19241
|
if (result2.code !== 0) throw new Error(`Receiver exit ${result2.code}: ${result2.stderr.slice(0, 1e3)}`);
|
|
19241
19242
|
const guestReceipt = join8(this.guestRoot, "state", "receiver", "receipts", `${request.executionId}.json`);
|
|
19242
19243
|
const originalReceipt = join8(this.hostRoot, "receiver-receipts", `${request.executionId}.json`);
|
|
@@ -19460,9 +19461,9 @@ async function analyze(root, options, files) {
|
|
|
19460
19461
|
const receipts = [];
|
|
19461
19462
|
const retainReceipt = (raw, envelope) => {
|
|
19462
19463
|
const receipt = object3(raw, "execution receipt");
|
|
19463
|
-
for (const
|
|
19464
|
-
if (receipt[
|
|
19465
|
-
if (envelope?.[
|
|
19464
|
+
for (const key2 of ["executionId", "actionId", "sessionId"]) {
|
|
19465
|
+
if (receipt[key2] !== void 0) text(receipt[key2], `receipt ${key2}`);
|
|
19466
|
+
if (envelope?.[key2] !== void 0 && receipt[key2] !== void 0 && envelope[key2] !== receipt[key2]) throw new Error(`receipt ${key2} identity mismatch`);
|
|
19466
19467
|
}
|
|
19467
19468
|
if (receipt.sessionId !== void 0 && receipt.sessionId !== options.sessionId) throw new Error("receipt session identity mismatch");
|
|
19468
19469
|
const executionId = receipt.executionId ?? envelope?.executionId;
|
|
@@ -19574,7 +19575,7 @@ Original subprocess/action evidence (not an authoritative input-success verdict)
|
|
|
19574
19575
|
}
|
|
19575
19576
|
}
|
|
19576
19577
|
const bearing = (finding) => /^action \S+ (has no retained start or refusal|is missing reverse snapshot reference |has no materialized action record|lacks durable reverse snapshot references)/.test(finding) ? "defects" : /^request \S+ has no retained guest execution$/.test(finding) ? "execution" : "snapshots";
|
|
19577
|
-
const explained = (
|
|
19578
|
+
const explained = (key2) => findings.filter((f) => bearing(f) === key2).map((finding) => explainFinding(finding, steps, stepsByExecution));
|
|
19578
19579
|
const snapshotReasons = explained("snapshots"), unexecuted = explained("execution"), defectReasons = explained("defects");
|
|
19579
19580
|
const completeness = snapshotReasons.length ? "incomplete" : "complete";
|
|
19580
19581
|
const receiptFailed = receipts.some((r) => ["refused", "failed"].includes(receiptOutcome(r)));
|
|
@@ -20102,14 +20103,14 @@ function Counted(value, callback) {
|
|
|
20102
20103
|
function ShiftLeft(array2, true_, false_) {
|
|
20103
20104
|
return IsEqual(array2.length, 0) ? false_() : true_(array2[0], array2.slice(1));
|
|
20104
20105
|
}
|
|
20105
|
-
function IsUnsafePropertyKey(
|
|
20106
|
-
return IsEqual(
|
|
20106
|
+
function IsUnsafePropertyKey(key2) {
|
|
20107
|
+
return IsEqual(key2, "__proto__") || IsEqual(key2, "constructor") || IsEqual(key2, "prototype");
|
|
20107
20108
|
}
|
|
20108
|
-
function HasPropertyKey(value,
|
|
20109
|
-
return IsUnsafePropertyKey(
|
|
20109
|
+
function HasPropertyKey(value, key2) {
|
|
20110
|
+
return IsUnsafePropertyKey(key2) ? Object.prototype.hasOwnProperty.call(value, key2) : key2 in value;
|
|
20110
20111
|
}
|
|
20111
20112
|
function EntriesRegExp(value) {
|
|
20112
|
-
return Keys(value).map((
|
|
20113
|
+
return Keys(value).map((key2) => [new RegExp(`^${key2}$`), value[key2]]);
|
|
20113
20114
|
}
|
|
20114
20115
|
function Entries(value) {
|
|
20115
20116
|
return Object.entries(value);
|
|
@@ -20127,7 +20128,7 @@ function DeepEqualObject(left, right) {
|
|
|
20127
20128
|
if (!IsObject(right))
|
|
20128
20129
|
return false;
|
|
20129
20130
|
const keys = Keys(left);
|
|
20130
|
-
return IsEqual(keys.length, Keys(right).length) && keys.every((
|
|
20131
|
+
return IsEqual(keys.length, Keys(right).length) && keys.every((key2) => IsDeepEqual(left[key2], right[key2]));
|
|
20131
20132
|
}
|
|
20132
20133
|
function DeepEqualArray(left, right) {
|
|
20133
20134
|
return IsArray(right) && IsEqual(left.length, right.length) && left.every((_, index) => IsDeepEqual(left[index], right[index]));
|
|
@@ -20244,10 +20245,10 @@ function Reset() {
|
|
|
20244
20245
|
settings.unionPrioritySort = true;
|
|
20245
20246
|
}
|
|
20246
20247
|
function Set2(options) {
|
|
20247
|
-
for (const
|
|
20248
|
-
const value = options[
|
|
20248
|
+
for (const key2 of guard_exports.Keys(options)) {
|
|
20249
|
+
const value = options[key2];
|
|
20249
20250
|
if (value !== void 0) {
|
|
20250
|
-
Object.defineProperty(settings,
|
|
20251
|
+
Object.defineProperty(settings, key2, { value });
|
|
20251
20252
|
}
|
|
20252
20253
|
}
|
|
20253
20254
|
}
|
|
@@ -20275,28 +20276,28 @@ function IsSchemaObject(value) {
|
|
|
20275
20276
|
}
|
|
20276
20277
|
function FromSchemaObject(value) {
|
|
20277
20278
|
const result2 = {};
|
|
20278
|
-
for (const
|
|
20279
|
-
if (guard_exports.IsUnsafePropertyKey(
|
|
20279
|
+
for (const key2 of guard_exports.Keys(value)) {
|
|
20280
|
+
if (guard_exports.IsUnsafePropertyKey(key2))
|
|
20280
20281
|
continue;
|
|
20281
|
-
const descriptor = Object.getOwnPropertyDescriptor(value,
|
|
20282
|
+
const descriptor = Object.getOwnPropertyDescriptor(value, key2);
|
|
20282
20283
|
descriptor.value = FromValue(descriptor.value);
|
|
20283
20284
|
if (guard_exports.IsEqual(descriptor.enumerable, true)) {
|
|
20284
|
-
result2[
|
|
20285
|
+
result2[key2] = descriptor.value;
|
|
20285
20286
|
} else {
|
|
20286
|
-
Object.defineProperty(result2,
|
|
20287
|
+
Object.defineProperty(result2, key2, descriptor);
|
|
20287
20288
|
}
|
|
20288
20289
|
}
|
|
20289
20290
|
return result2;
|
|
20290
20291
|
}
|
|
20291
20292
|
function FromPlainObject(value) {
|
|
20292
20293
|
const result2 = {};
|
|
20293
|
-
for (const
|
|
20294
|
-
if (guard_exports.IsUnsafePropertyKey(
|
|
20294
|
+
for (const key2 of guard_exports.Keys(value)) {
|
|
20295
|
+
if (guard_exports.IsUnsafePropertyKey(key2))
|
|
20295
20296
|
continue;
|
|
20296
|
-
result2[
|
|
20297
|
+
result2[key2] = FromValue(value[key2]);
|
|
20297
20298
|
}
|
|
20298
|
-
for (const
|
|
20299
|
-
result2[
|
|
20299
|
+
for (const key2 of guard_exports.Symbols(value)) {
|
|
20300
|
+
result2[key2] = FromValue(value[key2]);
|
|
20300
20301
|
}
|
|
20301
20302
|
return result2;
|
|
20302
20303
|
}
|
|
@@ -20328,12 +20329,12 @@ function Clone(value) {
|
|
|
20328
20329
|
|
|
20329
20330
|
// node_modules/typebox/build/system/memory/create.mjs
|
|
20330
20331
|
function MergeHidden(left, right) {
|
|
20331
|
-
for (const
|
|
20332
|
-
Object.defineProperty(left,
|
|
20332
|
+
for (const key2 of Object.keys(right)) {
|
|
20333
|
+
Object.defineProperty(left, key2, {
|
|
20333
20334
|
configurable: true,
|
|
20334
20335
|
writable: true,
|
|
20335
20336
|
enumerable: false,
|
|
20336
|
-
value: right[
|
|
20337
|
+
value: right[key2]
|
|
20337
20338
|
});
|
|
20338
20339
|
}
|
|
20339
20340
|
return left;
|
|
@@ -20352,12 +20353,12 @@ function Create(hidden, enumerable, options = {}) {
|
|
|
20352
20353
|
function Discard(value, propertyKeys) {
|
|
20353
20354
|
Metrics.discard += 1;
|
|
20354
20355
|
const result2 = {};
|
|
20355
|
-
for (const
|
|
20356
|
-
if (propertyKeys.includes(
|
|
20356
|
+
for (const key2 of guard_exports.Keys(value)) {
|
|
20357
|
+
if (propertyKeys.includes(key2))
|
|
20357
20358
|
continue;
|
|
20358
|
-
const descriptor = Object.getOwnPropertyDescriptor(value,
|
|
20359
|
+
const descriptor = Object.getOwnPropertyDescriptor(value, key2);
|
|
20359
20360
|
descriptor.value = Clone(descriptor.value);
|
|
20360
|
-
Object.defineProperty(result2,
|
|
20361
|
+
Object.defineProperty(result2, key2, descriptor);
|
|
20361
20362
|
}
|
|
20362
20363
|
return Freeze(result2);
|
|
20363
20364
|
}
|
|
@@ -20367,20 +20368,20 @@ function Update(current, hidden, enumerable) {
|
|
|
20367
20368
|
Metrics.update += 1;
|
|
20368
20369
|
const settings2 = settings_exports.Get();
|
|
20369
20370
|
const result2 = Clone(current);
|
|
20370
|
-
for (const
|
|
20371
|
-
Object.defineProperty(result2,
|
|
20371
|
+
for (const key2 of Object.keys(hidden)) {
|
|
20372
|
+
Object.defineProperty(result2, key2, {
|
|
20372
20373
|
configurable: true,
|
|
20373
20374
|
writable: true,
|
|
20374
20375
|
enumerable: settings2.enumerableKind,
|
|
20375
|
-
value: hidden[
|
|
20376
|
+
value: hidden[key2]
|
|
20376
20377
|
});
|
|
20377
20378
|
}
|
|
20378
|
-
for (const
|
|
20379
|
-
Object.defineProperty(result2,
|
|
20379
|
+
for (const key2 of Object.keys(enumerable)) {
|
|
20380
|
+
Object.defineProperty(result2, key2, {
|
|
20380
20381
|
configurable: true,
|
|
20381
20382
|
enumerable: true,
|
|
20382
20383
|
writable: true,
|
|
20383
|
-
value: enumerable[
|
|
20384
|
+
value: enumerable[key2]
|
|
20384
20385
|
});
|
|
20385
20386
|
}
|
|
20386
20387
|
return Freeze(result2);
|
|
@@ -20512,7 +20513,7 @@ function IsOptional(value) {
|
|
|
20512
20513
|
|
|
20513
20514
|
// node_modules/typebox/build/type/types/properties.mjs
|
|
20514
20515
|
function RequiredArray(properties) {
|
|
20515
|
-
return guard_exports.Keys(properties).filter((
|
|
20516
|
+
return guard_exports.Keys(properties).filter((key2) => !IsOptional(properties[key2]));
|
|
20516
20517
|
}
|
|
20517
20518
|
function PropertyKeys(properties) {
|
|
20518
20519
|
return guard_exports.Keys(properties);
|
|
@@ -20544,8 +20545,8 @@ function IsUnknown(value) {
|
|
|
20544
20545
|
|
|
20545
20546
|
// node_modules/typebox/build/type/types/cyclic.mjs
|
|
20546
20547
|
function Cyclic($defs, $ref, options) {
|
|
20547
|
-
const defs = guard_exports.Keys($defs).reduce((result2,
|
|
20548
|
-
return { ...result2, [
|
|
20548
|
+
const defs = guard_exports.Keys($defs).reduce((result2, key2) => {
|
|
20549
|
+
return { ...result2, [key2]: memory_exports.Update($defs[key2], {}, { $id: key2 }) };
|
|
20549
20550
|
}, {});
|
|
20550
20551
|
return memory_exports.Create({ ["~kind"]: "Cyclic" }, { $defs: defs, $ref }, options);
|
|
20551
20552
|
}
|
|
@@ -20600,8 +20601,8 @@ function IsTypeScriptEnumLike(value) {
|
|
|
20600
20601
|
return guard_exports.IsObjectNotArray(value);
|
|
20601
20602
|
}
|
|
20602
20603
|
function TypeScriptEnumToEnumValues(type) {
|
|
20603
|
-
const keys = guard_exports.Keys(type).filter((
|
|
20604
|
-
return keys.reduce((result2,
|
|
20604
|
+
const keys = guard_exports.Keys(type).filter((key2) => isNaN(key2));
|
|
20605
|
+
return keys.reduce((result2, key2) => [...result2, type[key2]], []);
|
|
20605
20606
|
}
|
|
20606
20607
|
|
|
20607
20608
|
// node_modules/typebox/build/type/types/enum.mjs
|
|
@@ -20644,9 +20645,9 @@ function InstanceKeys(value) {
|
|
|
20644
20645
|
const propertyKeys = /* @__PURE__ */ new Set();
|
|
20645
20646
|
let current = value;
|
|
20646
20647
|
while (current && current !== Object.prototype) {
|
|
20647
|
-
for (const
|
|
20648
|
-
if (
|
|
20649
|
-
propertyKeys.add(
|
|
20648
|
+
for (const key2 of Reflect.ownKeys(current)) {
|
|
20649
|
+
if (key2 !== "constructor" && typeof key2 !== "symbol")
|
|
20650
|
+
propertyKeys.add(key2);
|
|
20650
20651
|
}
|
|
20651
20652
|
current = Object.getPrototypeOf(current);
|
|
20652
20653
|
}
|
|
@@ -20730,9 +20731,9 @@ function FromNumber(value) {
|
|
|
20730
20731
|
}
|
|
20731
20732
|
function FromObject2(value) {
|
|
20732
20733
|
FNV1A64_OP(ByteMarker.Object);
|
|
20733
|
-
for (const
|
|
20734
|
-
FromValue2(
|
|
20735
|
-
FromValue2(value[
|
|
20734
|
+
for (const key2 of InstanceKeys(value).sort()) {
|
|
20735
|
+
FromValue2(key2);
|
|
20736
|
+
FromValue2(value[key2]);
|
|
20736
20737
|
}
|
|
20737
20738
|
}
|
|
20738
20739
|
function FromRegExp2(value) {
|
|
@@ -21137,9 +21138,9 @@ function TemplateLiteralDecode(pattern) {
|
|
|
21137
21138
|
}
|
|
21138
21139
|
|
|
21139
21140
|
// node_modules/typebox/build/type/engine/record/record_create.mjs
|
|
21140
|
-
function CreateRecord(
|
|
21141
|
+
function CreateRecord(key2, value) {
|
|
21141
21142
|
const type = "object";
|
|
21142
|
-
const patternProperties = { [
|
|
21143
|
+
const patternProperties = { [key2]: value };
|
|
21143
21144
|
return memory_exports.Create({ ["~kind"]: "Record" }, { type, patternProperties });
|
|
21144
21145
|
}
|
|
21145
21146
|
|
|
@@ -21237,13 +21238,13 @@ function CompositeProperty(left, right) {
|
|
|
21237
21238
|
const property = RemoveReadonly(RemoveOptional(evaluated));
|
|
21238
21239
|
return isReadonly && isOptional ? AddReadonly(AddOptional(property)) : isReadonly && !isOptional ? AddReadonly(property) : !isReadonly && isOptional ? AddOptional(property) : property;
|
|
21239
21240
|
}
|
|
21240
|
-
function CompositePropertyKey(left, right,
|
|
21241
|
-
return
|
|
21241
|
+
function CompositePropertyKey(left, right, key2) {
|
|
21242
|
+
return key2 in left ? key2 in right ? CompositeProperty(left[key2], right[key2]) : left[key2] : key2 in right ? right[key2] : Never();
|
|
21242
21243
|
}
|
|
21243
21244
|
function CompositeProperties(left, right) {
|
|
21244
21245
|
const keys = /* @__PURE__ */ new Set([...guard_exports.Keys(left), ...guard_exports.Keys(right)]);
|
|
21245
|
-
const result2 = [...keys].reduce((result3,
|
|
21246
|
-
return { ...result3, [
|
|
21246
|
+
const result2 = [...keys].reduce((result3, key2) => {
|
|
21247
|
+
return { ...result3, [key2]: CompositePropertyKey(left, right, key2) };
|
|
21247
21248
|
}, {});
|
|
21248
21249
|
return result2;
|
|
21249
21250
|
}
|
|
@@ -21368,8 +21369,8 @@ function FromIntersectKey(types, value) {
|
|
|
21368
21369
|
}
|
|
21369
21370
|
|
|
21370
21371
|
// node_modules/typebox/build/type/engine/record/from_key_literal.mjs
|
|
21371
|
-
function FromLiteralKey(
|
|
21372
|
-
return guard_exports.IsString(
|
|
21372
|
+
function FromLiteralKey(key2, value) {
|
|
21373
|
+
return guard_exports.IsString(key2) || guard_exports.IsNumber(key2) ? _Object_({ [key2]: value }) : guard_exports.IsEqual(key2, false) ? _Object_({ false: value }) : guard_exports.IsEqual(key2, true) ? _Object_({ true: value }) : _Object_({});
|
|
21373
21374
|
}
|
|
21374
21375
|
|
|
21375
21376
|
// node_modules/typebox/build/type/engine/record/from_key_number.mjs
|
|
@@ -21379,8 +21380,8 @@ function FromNumberKey(_key, value) {
|
|
|
21379
21380
|
}
|
|
21380
21381
|
|
|
21381
21382
|
// node_modules/typebox/build/type/engine/record/from_key_string.mjs
|
|
21382
|
-
function FromStringKey(
|
|
21383
|
-
return guard_exports.HasPropertyKey(
|
|
21383
|
+
function FromStringKey(key2, value) {
|
|
21384
|
+
return guard_exports.HasPropertyKey(key2, "pattern") && (guard_exports.IsString(key2.pattern) || key2.pattern instanceof RegExp) ? CreateRecord(key2.pattern.toString(), value) : CreateRecord(StringKey, value);
|
|
21384
21385
|
}
|
|
21385
21386
|
|
|
21386
21387
|
// node_modules/typebox/build/type/engine/record/from_key_template_literal.mjs
|
|
@@ -21424,18 +21425,18 @@ function FromUnionKey(types, value) {
|
|
|
21424
21425
|
}
|
|
21425
21426
|
|
|
21426
21427
|
// node_modules/typebox/build/type/engine/record/from_key.mjs
|
|
21427
|
-
function FromKey(
|
|
21428
|
-
const result2 = IsAny(
|
|
21428
|
+
function FromKey(key2, value) {
|
|
21429
|
+
const result2 = IsAny(key2) ? FromAnyKey(value) : IsBoolean3(key2) ? FromBooleanKey(value) : IsEnum(key2) ? FromEnumKey(key2.enum, value) : IsInteger2(key2) ? FromIntegerKey(key2, value) : IsIntersect(key2) ? FromIntersectKey(key2.allOf, value) : IsLiteral(key2) ? FromLiteralKey(key2.const, value) : IsNumber3(key2) ? FromNumberKey(key2, value) : IsUnion(key2) ? FromUnionKey(key2.anyOf, value) : IsString3(key2) ? FromStringKey(key2, value) : IsTemplateLiteral(key2) ? FromTemplateKey(key2.pattern, value) : _Object_({});
|
|
21429
21430
|
return result2;
|
|
21430
21431
|
}
|
|
21431
21432
|
|
|
21432
21433
|
// node_modules/typebox/build/type/engine/record/instantiate.mjs
|
|
21433
|
-
function RecordAction(
|
|
21434
|
-
const result2 = CanInstantiate([
|
|
21434
|
+
function RecordAction(key2, value, options) {
|
|
21435
|
+
const result2 = CanInstantiate([key2]) ? memory_exports.Update(FromKey(key2, value), {}, options) : RecordDeferred(key2, value, options);
|
|
21435
21436
|
return result2;
|
|
21436
21437
|
}
|
|
21437
|
-
function RecordInstantiate(context, state,
|
|
21438
|
-
const instantiatedKey = InstantiateType(context, state,
|
|
21438
|
+
function RecordInstantiate(context, state, key2, value, options) {
|
|
21439
|
+
const instantiatedKey = InstantiateType(context, state, key2);
|
|
21439
21440
|
const instantiatedValue = InstantiateType(context, state, value);
|
|
21440
21441
|
return RecordAction(instantiatedKey, instantiatedValue, options);
|
|
21441
21442
|
}
|
|
@@ -21444,11 +21445,11 @@ function RecordInstantiate(context, state, key, value, options) {
|
|
|
21444
21445
|
var IntegerKey = `^${IntegerPattern}$`;
|
|
21445
21446
|
var NumberKey = `^${NumberPattern}$`;
|
|
21446
21447
|
var StringKey = `^${StringPattern}$`;
|
|
21447
|
-
function RecordDeferred(
|
|
21448
|
-
return Deferred("Record", [
|
|
21448
|
+
function RecordDeferred(key2, value, options = {}) {
|
|
21449
|
+
return Deferred("Record", [key2, value], options);
|
|
21449
21450
|
}
|
|
21450
|
-
function Record(
|
|
21451
|
-
return RecordAction(
|
|
21451
|
+
function Record(key2, value, options = {}) {
|
|
21452
|
+
return RecordAction(key2, value, options);
|
|
21452
21453
|
}
|
|
21453
21454
|
function RecordFromPattern(pattern, value) {
|
|
21454
21455
|
return CreateRecord(pattern, value);
|
|
@@ -21719,9 +21720,9 @@ function OptionalMapping(input) {
|
|
|
21719
21720
|
return input.length > 0;
|
|
21720
21721
|
}
|
|
21721
21722
|
function PropertyMapping(input) {
|
|
21722
|
-
const [isReadonly,
|
|
21723
|
+
const [isReadonly, key2, isOptional, _colon, type] = input;
|
|
21723
21724
|
return {
|
|
21724
|
-
[
|
|
21725
|
+
[key2]: isReadonly && isOptional ? AddReadonlyDeferred(AddOptionalDeferred(type)) : isReadonly && !isOptional ? AddReadonlyDeferred(type) : !isReadonly && isOptional ? AddOptionalDeferred(type) : type
|
|
21725
21726
|
};
|
|
21726
21727
|
}
|
|
21727
21728
|
function PropertyDelimiterMapping(input) {
|
|
@@ -22625,8 +22626,8 @@ function ExtendsProperty(inferred, left, right) {
|
|
|
22625
22626
|
);
|
|
22626
22627
|
}
|
|
22627
22628
|
function ExtractInferredProperties(keys, properties) {
|
|
22628
|
-
return keys.reduce((result2,
|
|
22629
|
-
return
|
|
22629
|
+
return keys.reduce((result2, key2) => {
|
|
22630
|
+
return key2 in properties ? IsExtendsTrueLike(properties[key2]) ? { ...result2, ...properties[key2].inferred } : Unreachable() : Unreachable();
|
|
22630
22631
|
}, {});
|
|
22631
22632
|
}
|
|
22632
22633
|
function ExtendsPropertiesComparer(inferred, left, right) {
|
|
@@ -22646,10 +22647,10 @@ function ExtendsObjectToObject(inferred, left, right) {
|
|
|
22646
22647
|
return ExtendsProperties(inferred, left, right);
|
|
22647
22648
|
}
|
|
22648
22649
|
function RecordMergeInferred(left, right) {
|
|
22649
|
-
return guard_exports.Keys(right).reduce((result2,
|
|
22650
|
+
return guard_exports.Keys(right).reduce((result2, key2) => {
|
|
22650
22651
|
return {
|
|
22651
22652
|
...result2,
|
|
22652
|
-
[
|
|
22653
|
+
[key2]: guard_exports.HasPropertyKey(left, key2) ? IsUnion(result2[key2]) ? Union([...result2[key2].anyOf, right[key2]]) : Union([left[key2], right[key2]]) : right[key2]
|
|
22653
22654
|
};
|
|
22654
22655
|
}, left);
|
|
22655
22656
|
}
|
|
@@ -22879,8 +22880,8 @@ function FromTypes3(context, types, result2) {
|
|
|
22879
22880
|
function FromType4(context, type, result2) {
|
|
22880
22881
|
return IsRef(type) ? FromRef2(context, type.$ref, result2) : IsArray2(type) ? FromType4(context, type.items, result2) : IsConstructor2(type) ? FromTypes3(context, [...type.parameters, type.instanceType], result2) : IsFunction2(type) ? FromTypes3(context, [...type.parameters, type.returnType], result2) : IsInterfaceDeferred(type) ? FromProperties2(context, type.parameters[1], result2) : IsIntersect(type) ? FromTypes3(context, type.allOf, result2) : IsObject2(type) ? FromProperties2(context, type.properties, result2) : IsUnion(type) ? FromTypes3(context, type.anyOf, result2) : IsTuple(type) ? FromTypes3(context, type.items, result2) : IsRecord(type) ? FromType4(context, RecordValue(type), result2) : result2;
|
|
22881
22882
|
}
|
|
22882
|
-
function CyclicDependencies(context,
|
|
22883
|
-
const result2 = FromType4(context, type, [
|
|
22883
|
+
function CyclicDependencies(context, key2, type) {
|
|
22884
|
+
const result2 = FromType4(context, type, [key2]);
|
|
22884
22885
|
return result2;
|
|
22885
22886
|
}
|
|
22886
22887
|
|
|
@@ -22889,8 +22890,8 @@ function FromRef3(_ref) {
|
|
|
22889
22890
|
return Any();
|
|
22890
22891
|
}
|
|
22891
22892
|
function FromProperties3(properties) {
|
|
22892
|
-
return guard_exports.Keys(properties).reduce((result2,
|
|
22893
|
-
return { ...result2, [
|
|
22893
|
+
return guard_exports.Keys(properties).reduce((result2, key2) => {
|
|
22894
|
+
return { ...result2, [key2]: FromType5(properties[key2]) };
|
|
22894
22895
|
}, {});
|
|
22895
22896
|
}
|
|
22896
22897
|
function FromTypes4(types) {
|
|
@@ -22916,11 +22917,11 @@ function CyclicInterface(context, heritage, properties) {
|
|
|
22916
22917
|
return evaluatedInterface;
|
|
22917
22918
|
}
|
|
22918
22919
|
function CyclicDefinitions(context, dependencies) {
|
|
22919
|
-
const keys = guard_exports.Keys(context).filter((
|
|
22920
|
-
return keys.reduce((result2,
|
|
22921
|
-
const type = context[
|
|
22920
|
+
const keys = guard_exports.Keys(context).filter((key2) => dependencies.includes(key2));
|
|
22921
|
+
return keys.reduce((result2, key2) => {
|
|
22922
|
+
const type = context[key2];
|
|
22922
22923
|
const instantiatedType = IsInterfaceDeferred(type) ? CyclicInterface(context, type.parameters[0], type.parameters[1]) : type;
|
|
22923
|
-
return { ...result2, [
|
|
22924
|
+
return { ...result2, [key2]: instantiatedType };
|
|
22924
22925
|
}, {});
|
|
22925
22926
|
}
|
|
22926
22927
|
function InstantiateCyclic(context, ref, type) {
|
|
@@ -23403,12 +23404,12 @@ function FromDependent(if_, then_, else_) {
|
|
|
23403
23404
|
|
|
23404
23405
|
// node_modules/typebox/build/type/engine/object/from_intersect.mjs
|
|
23405
23406
|
function CollapseIntersectProperties(left, right) {
|
|
23406
|
-
const leftKeys = guard_exports.Keys(left).filter((
|
|
23407
|
-
const rightKeys = guard_exports.Keys(right).filter((
|
|
23408
|
-
const sharedKeys = guard_exports.Keys(left).filter((
|
|
23409
|
-
const leftProperties = leftKeys.reduce((result2,
|
|
23410
|
-
const rightProperties = rightKeys.reduce((result2,
|
|
23411
|
-
const sharedProperties = sharedKeys.reduce((result2,
|
|
23407
|
+
const leftKeys = guard_exports.Keys(left).filter((key2) => !guard_exports.HasPropertyKey(right, key2));
|
|
23408
|
+
const rightKeys = guard_exports.Keys(right).filter((key2) => !guard_exports.HasPropertyKey(left, key2));
|
|
23409
|
+
const sharedKeys = guard_exports.Keys(left).filter((key2) => guard_exports.HasPropertyKey(right, key2));
|
|
23410
|
+
const leftProperties = leftKeys.reduce((result2, key2) => ({ ...result2, [key2]: left[key2] }), {});
|
|
23411
|
+
const rightProperties = rightKeys.reduce((result2, key2) => ({ ...result2, [key2]: right[key2] }), {});
|
|
23412
|
+
const sharedProperties = sharedKeys.reduce((result2, key2) => ({ ...result2, [key2]: EvaluateIntersect([left[key2], right[key2]]) }), {});
|
|
23412
23413
|
const unique = memory_exports.Assign(leftProperties, rightProperties);
|
|
23413
23414
|
const shared = memory_exports.Assign(unique, sharedProperties);
|
|
23414
23415
|
return shared;
|
|
@@ -23433,9 +23434,9 @@ function FromTuple(types) {
|
|
|
23433
23434
|
|
|
23434
23435
|
// node_modules/typebox/build/type/engine/object/from_union.mjs
|
|
23435
23436
|
function CollapseUnionProperties(left, right) {
|
|
23436
|
-
const sharedKeys = guard_exports.Keys(left).filter((
|
|
23437
|
-
const result2 = sharedKeys.reduce((result3,
|
|
23438
|
-
return { ...result3, [
|
|
23437
|
+
const sharedKeys = guard_exports.Keys(left).filter((key2) => key2 in right);
|
|
23438
|
+
const result2 = sharedKeys.reduce((result3, key2) => {
|
|
23439
|
+
return { ...result3, [key2]: EvaluateUnion([left[key2], right[key2]]) };
|
|
23439
23440
|
}, {});
|
|
23440
23441
|
return result2;
|
|
23441
23442
|
}
|
|
@@ -23557,8 +23558,8 @@ function ExpandThis(properties, type) {
|
|
|
23557
23558
|
}
|
|
23558
23559
|
|
|
23559
23560
|
// node_modules/typebox/build/type/engine/indexed/from_object.mjs
|
|
23560
|
-
function IndexProperty(properties,
|
|
23561
|
-
const selectedType =
|
|
23561
|
+
function IndexProperty(properties, key2) {
|
|
23562
|
+
const selectedType = key2 in properties ? properties[key2] : Never();
|
|
23562
23563
|
const result2 = ExpandThis(properties, selectedType);
|
|
23563
23564
|
return result2;
|
|
23564
23565
|
}
|
|
@@ -23575,7 +23576,7 @@ function FromIndexer(properties, indexer) {
|
|
|
23575
23576
|
}
|
|
23576
23577
|
var NumericKeyPattern = new RegExp(IntegerKey);
|
|
23577
23578
|
function NumericKeys(keys) {
|
|
23578
|
-
const result2 = keys.filter((
|
|
23579
|
+
const result2 = keys.filter((key2) => NumericKeyPattern.test(key2));
|
|
23579
23580
|
return result2;
|
|
23580
23581
|
}
|
|
23581
23582
|
function FromIndexerNumber(properties) {
|
|
@@ -23805,16 +23806,16 @@ function MappedInstantiate(context, state, identifier, type, as, property, optio
|
|
|
23805
23806
|
// node_modules/typebox/build/type/engine/module/instantiate.mjs
|
|
23806
23807
|
function InstantiateCyclics(context, declarations, cyclicKeys) {
|
|
23807
23808
|
const declarationContext = memory_exports.Assign(context, declarations);
|
|
23808
|
-
const declarationKeys = guard_exports.Keys(declarations).filter((
|
|
23809
|
-
return declarationKeys.reduce((result2,
|
|
23810
|
-
return { ...result2, [
|
|
23809
|
+
const declarationKeys = guard_exports.Keys(declarations).filter((key2) => cyclicKeys.includes(key2));
|
|
23810
|
+
return declarationKeys.reduce((result2, key2) => {
|
|
23811
|
+
return { ...result2, [key2]: InstantiateCyclic(declarationContext, key2, declarations[key2]) };
|
|
23811
23812
|
}, {});
|
|
23812
23813
|
}
|
|
23813
23814
|
function InstantiateNonCyclics(context, declarations, cyclicKeys) {
|
|
23814
23815
|
const declarationContext = memory_exports.Assign(context, declarations);
|
|
23815
|
-
const declarationKeys = guard_exports.Keys(declarations).filter((
|
|
23816
|
-
return declarationKeys.reduce((result2,
|
|
23817
|
-
return { ...result2, [
|
|
23816
|
+
const declarationKeys = guard_exports.Keys(declarations).filter((key2) => !cyclicKeys.includes(key2));
|
|
23817
|
+
return declarationKeys.reduce((result2, key2) => {
|
|
23818
|
+
return { ...result2, [key2]: InstantiateType(declarationContext, State([], []), declarations[key2]) };
|
|
23818
23819
|
}, {});
|
|
23819
23820
|
}
|
|
23820
23821
|
function InstantiateModule(context, declarations, options) {
|
|
@@ -23869,8 +23870,8 @@ function ToIndexable(type) {
|
|
|
23869
23870
|
|
|
23870
23871
|
// node_modules/typebox/build/type/engine/omit/from_type.mjs
|
|
23871
23872
|
function FromKeys(properties, keys) {
|
|
23872
|
-
const result2 = guard_exports.Keys(properties).reduce((result3,
|
|
23873
|
-
return keys.includes(
|
|
23873
|
+
const result2 = guard_exports.Keys(properties).reduce((result3, key2) => {
|
|
23874
|
+
return keys.includes(key2) ? result3 : { ...result3, [key2]: properties[key2] };
|
|
23874
23875
|
}, {});
|
|
23875
23876
|
return result2;
|
|
23876
23877
|
}
|
|
@@ -23988,8 +23989,8 @@ function Pick(type, indexer_or_keys, options = {}) {
|
|
|
23988
23989
|
|
|
23989
23990
|
// node_modules/typebox/build/type/engine/pick/from_type.mjs
|
|
23990
23991
|
function FromKeys2(properties, keys) {
|
|
23991
|
-
const result2 = guard_exports.Keys(properties).reduce((result3,
|
|
23992
|
-
return keys.includes(
|
|
23992
|
+
const result2 = guard_exports.Keys(properties).reduce((result3, key2) => {
|
|
23993
|
+
return keys.includes(key2) ? memory_exports.Assign(result3, { [key2]: properties[key2] }) : result3;
|
|
23993
23994
|
}, {});
|
|
23994
23995
|
return result2;
|
|
23995
23996
|
}
|
|
@@ -24209,8 +24210,8 @@ function CanInstantiate(types) {
|
|
|
24209
24210
|
return guard_exports.ShiftLeft(types, (left, right) => IsRef(left) ? false : CanInstantiate(right), () => true);
|
|
24210
24211
|
}
|
|
24211
24212
|
function InstantiateProperties(context, state, properties) {
|
|
24212
|
-
return guard_exports.Keys(properties).reduce((result2,
|
|
24213
|
-
return { ...result2, [
|
|
24213
|
+
return guard_exports.Keys(properties).reduce((result2, key2) => {
|
|
24214
|
+
return { ...result2, [key2]: InstantiateType(context, state, properties[key2]) };
|
|
24214
24215
|
}, {});
|
|
24215
24216
|
}
|
|
24216
24217
|
function InstantiateElements(context, state, types) {
|
|
@@ -24737,8 +24738,8 @@ var CheckContext = class {
|
|
|
24737
24738
|
this.GetIndices().add(index);
|
|
24738
24739
|
return true;
|
|
24739
24740
|
}
|
|
24740
|
-
AddKey(
|
|
24741
|
-
this.GetKeys().add(
|
|
24741
|
+
AddKey(key2) {
|
|
24742
|
+
this.GetKeys().add(key2);
|
|
24742
24743
|
return true;
|
|
24743
24744
|
}
|
|
24744
24745
|
GetIndices() {
|
|
@@ -24831,7 +24832,7 @@ function RegisterResourceAnchors(anchors, schema, isRoot = true) {
|
|
|
24831
24832
|
if (!isRoot && IsId(schema))
|
|
24832
24833
|
return anchors;
|
|
24833
24834
|
const next = !isRoot && IsDynamicAnchor(schema) ? [...anchors, schema] : anchors;
|
|
24834
|
-
return Object.keys(schema).reduce((result2,
|
|
24835
|
+
return Object.keys(schema).reduce((result2, key2) => RegisterResourceAnchors(result2, schema[key2], false), next);
|
|
24835
24836
|
}
|
|
24836
24837
|
function ResourceEntry(stack, schema) {
|
|
24837
24838
|
return stack.resourceEntries.get(schema);
|
|
@@ -24934,8 +24935,8 @@ function UnicodeRegExp(pattern) {
|
|
|
24934
24935
|
}
|
|
24935
24936
|
|
|
24936
24937
|
// node_modules/typebox/build/schema/engine/additionalProperties.mjs
|
|
24937
|
-
function GetPropertyKeyAsPattern(
|
|
24938
|
-
const escaped =
|
|
24938
|
+
function GetPropertyKeyAsPattern(key2) {
|
|
24939
|
+
const escaped = key2.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
24939
24940
|
return `^${escaped}$`;
|
|
24940
24941
|
}
|
|
24941
24942
|
function GetPropertiesPattern(schema) {
|
|
@@ -24948,20 +24949,20 @@ function GetPropertiesPattern(schema) {
|
|
|
24948
24949
|
}
|
|
24949
24950
|
function CheckAdditionalProperties(stack, context, schema, value) {
|
|
24950
24951
|
const regexp = UnicodeRegExp(GetPropertiesPattern(schema));
|
|
24951
|
-
const isAdditionalProperties = guard_exports.Every(guard_exports.Keys(value), 0, (
|
|
24952
|
-
return regexp.test(
|
|
24952
|
+
const isAdditionalProperties = guard_exports.Every(guard_exports.Keys(value), 0, (key2, _index) => {
|
|
24953
|
+
return regexp.test(key2) || CheckSchemaPushStack(stack, context, schema.additionalProperties, value[key2]) && context.AddKey(key2);
|
|
24953
24954
|
});
|
|
24954
24955
|
return isAdditionalProperties;
|
|
24955
24956
|
}
|
|
24956
24957
|
function ErrorAdditionalProperties(stack, context, schemaPath, instancePath, schema, value) {
|
|
24957
24958
|
const regexp = UnicodeRegExp(GetPropertiesPattern(schema));
|
|
24958
24959
|
const additionalProperties = [];
|
|
24959
|
-
const isAdditionalProperties = guard_exports.EveryAll(guard_exports.Keys(value), 0, (
|
|
24960
|
+
const isAdditionalProperties = guard_exports.EveryAll(guard_exports.Keys(value), 0, (key2, _index) => {
|
|
24960
24961
|
const nextSchemaPath = `${schemaPath}/additionalProperties`;
|
|
24961
|
-
const nextInstancePath = `${instancePath}/${EncodeFragment(
|
|
24962
|
-
const isAdditionalProperty = regexp.test(
|
|
24962
|
+
const nextInstancePath = `${instancePath}/${EncodeFragment(key2)}`;
|
|
24963
|
+
const isAdditionalProperty = regexp.test(key2) || ErrorSchemaPushStack(stack, context, nextSchemaPath, nextInstancePath, schema.additionalProperties, value[key2]) && context.AddKey(key2);
|
|
24963
24964
|
if (!isAdditionalProperty)
|
|
24964
|
-
additionalProperties.push(
|
|
24965
|
+
additionalProperties.push(key2);
|
|
24965
24966
|
return isAdditionalProperty;
|
|
24966
24967
|
});
|
|
24967
24968
|
return isAdditionalProperties || context.AddError("additionalProperties", schemaPath, instancePath, { additionalProperties });
|
|
@@ -25049,16 +25050,16 @@ function ErrorContains(stack, context, schemaPath, instancePath, schema, value)
|
|
|
25049
25050
|
// node_modules/typebox/build/schema/engine/dependencies.mjs
|
|
25050
25051
|
function CheckDependencies(stack, context, schema, value) {
|
|
25051
25052
|
const isLength = guard_exports.IsEqual(guard_exports.Keys(value).length, 0);
|
|
25052
|
-
const isEvery = guard_exports.Every(guard_exports.Entries(schema.dependencies), 0, ([
|
|
25053
|
-
return !guard_exports.HasPropertyKey(value,
|
|
25053
|
+
const isEvery = guard_exports.Every(guard_exports.Entries(schema.dependencies), 0, ([key2, schema2]) => {
|
|
25054
|
+
return !guard_exports.HasPropertyKey(value, key2) || (guard_exports.IsArray(schema2) ? schema2.every((key3) => guard_exports.HasPropertyKey(value, key3)) : CheckSchema(stack, context, schema2, value));
|
|
25054
25055
|
});
|
|
25055
25056
|
return isLength || isEvery;
|
|
25056
25057
|
}
|
|
25057
25058
|
function ErrorDependencies(stack, context, schemaPath, instancePath, schema, value) {
|
|
25058
25059
|
const isLength = guard_exports.IsEqual(guard_exports.Keys(value).length, 0);
|
|
25059
|
-
const isEvery = guard_exports.EveryAll(guard_exports.Entries(schema.dependencies), 0, ([
|
|
25060
|
-
const nextSchemaPath = `${schemaPath}/dependencies/${EncodeFragment(
|
|
25061
|
-
return !guard_exports.HasPropertyKey(value,
|
|
25060
|
+
const isEvery = guard_exports.EveryAll(guard_exports.Entries(schema.dependencies), 0, ([key2, schema2]) => {
|
|
25061
|
+
const nextSchemaPath = `${schemaPath}/dependencies/${EncodeFragment(key2)}`;
|
|
25062
|
+
return !guard_exports.HasPropertyKey(value, key2) || (guard_exports.IsArray(schema2) ? schema2.every((dependency) => guard_exports.HasPropertyKey(value, dependency) || context.AddError("dependencies", schemaPath, instancePath, { property: key2, dependencies: schema2 })) : ErrorSchema(stack, context, nextSchemaPath, instancePath, schema2, value));
|
|
25062
25063
|
});
|
|
25063
25064
|
return isLength || isEvery;
|
|
25064
25065
|
}
|
|
@@ -25066,15 +25067,15 @@ function ErrorDependencies(stack, context, schemaPath, instancePath, schema, val
|
|
|
25066
25067
|
// node_modules/typebox/build/schema/engine/dependentRequired.mjs
|
|
25067
25068
|
function CheckDependentRequired(_stack, _context, schema, value) {
|
|
25068
25069
|
const isLength = guard_exports.IsEqual(guard_exports.Keys(value).length, 0);
|
|
25069
|
-
const isEvery = guard_exports.Every(guard_exports.Entries(schema.dependentRequired), 0, ([
|
|
25070
|
-
return !guard_exports.HasPropertyKey(value,
|
|
25070
|
+
const isEvery = guard_exports.Every(guard_exports.Entries(schema.dependentRequired), 0, ([key2, keys]) => {
|
|
25071
|
+
return !guard_exports.HasPropertyKey(value, key2) || keys.every((key3) => guard_exports.HasPropertyKey(value, key3));
|
|
25071
25072
|
});
|
|
25072
25073
|
return isLength || isEvery;
|
|
25073
25074
|
}
|
|
25074
25075
|
function ErrorDependentRequired(_stack, context, schemaPath, instancePath, schema, value) {
|
|
25075
25076
|
const isLength = guard_exports.IsEqual(guard_exports.Keys(value).length, 0);
|
|
25076
|
-
const isEveryEntry = guard_exports.EveryAll(guard_exports.Entries(schema.dependentRequired), 0, ([
|
|
25077
|
-
return !guard_exports.HasPropertyKey(value,
|
|
25077
|
+
const isEveryEntry = guard_exports.EveryAll(guard_exports.Entries(schema.dependentRequired), 0, ([key2, keys]) => {
|
|
25078
|
+
return !guard_exports.HasPropertyKey(value, key2) || guard_exports.EveryAll(keys, 0, (dependency) => guard_exports.HasPropertyKey(value, dependency) || context.AddError("dependentRequired", schemaPath, instancePath, { property: key2, dependencies: keys }));
|
|
25078
25079
|
});
|
|
25079
25080
|
return isLength || isEveryEntry;
|
|
25080
25081
|
}
|
|
@@ -25082,16 +25083,16 @@ function ErrorDependentRequired(_stack, context, schemaPath, instancePath, schem
|
|
|
25082
25083
|
// node_modules/typebox/build/schema/engine/dependentSchemas.mjs
|
|
25083
25084
|
function CheckDependentSchemas(stack, context, schema, value) {
|
|
25084
25085
|
const isLength = guard_exports.IsEqual(guard_exports.Keys(value).length, 0);
|
|
25085
|
-
const isEvery = guard_exports.Every(guard_exports.Entries(schema.dependentSchemas), 0, ([
|
|
25086
|
-
return !guard_exports.HasPropertyKey(value,
|
|
25086
|
+
const isEvery = guard_exports.Every(guard_exports.Entries(schema.dependentSchemas), 0, ([key2, schema2]) => {
|
|
25087
|
+
return !guard_exports.HasPropertyKey(value, key2) || CheckSchema(stack, context, schema2, value);
|
|
25087
25088
|
});
|
|
25088
25089
|
return isLength || isEvery;
|
|
25089
25090
|
}
|
|
25090
25091
|
function ErrorDependentSchemas(stack, context, schemaPath, instancePath, schema, value) {
|
|
25091
25092
|
const isLength = guard_exports.IsEqual(guard_exports.Keys(value).length, 0);
|
|
25092
|
-
const isEvery = guard_exports.EveryAll(guard_exports.Entries(schema.dependentSchemas), 0, ([
|
|
25093
|
-
const nextSchemaPath = `${schemaPath}/dependentSchemas/${EncodeFragment(
|
|
25094
|
-
return !guard_exports.HasPropertyKey(value,
|
|
25093
|
+
const isEvery = guard_exports.EveryAll(guard_exports.Entries(schema.dependentSchemas), 0, ([key2, schema2]) => {
|
|
25094
|
+
const nextSchemaPath = `${schemaPath}/dependentSchemas/${EncodeFragment(key2)}`;
|
|
25095
|
+
return !guard_exports.HasPropertyKey(value, key2) || ErrorSchema(stack, context, nextSchemaPath, instancePath, schema2, value);
|
|
25095
25096
|
});
|
|
25096
25097
|
return isLength || isEvery;
|
|
25097
25098
|
}
|
|
@@ -25203,8 +25204,8 @@ function SearchDynamicAnchor(schema, name) {
|
|
|
25203
25204
|
return schema;
|
|
25204
25205
|
}
|
|
25205
25206
|
if (guard_exports.IsObject(schema)) {
|
|
25206
|
-
for (const
|
|
25207
|
-
const result2 = SearchDynamicAnchor(schema[
|
|
25207
|
+
for (const key2 of guard_exports.Keys(schema)) {
|
|
25208
|
+
const result2 = SearchDynamicAnchor(schema[key2], name);
|
|
25208
25209
|
if (result2)
|
|
25209
25210
|
return result2;
|
|
25210
25211
|
}
|
|
@@ -25222,8 +25223,8 @@ function SearchBase(schema, base, target) {
|
|
|
25222
25223
|
return result2;
|
|
25223
25224
|
}
|
|
25224
25225
|
} else if (guard_exports.IsObject(schema)) {
|
|
25225
|
-
for (const
|
|
25226
|
-
const result2 = SearchBase(schema[
|
|
25226
|
+
for (const key2 of guard_exports.Keys(schema)) {
|
|
25227
|
+
const result2 = SearchBase(schema[key2], nextBase, target);
|
|
25227
25228
|
if (!guard_exports.IsUndefined(result2))
|
|
25228
25229
|
return result2;
|
|
25229
25230
|
}
|
|
@@ -25281,10 +25282,10 @@ function MatchFromArray(schema, base, ref) {
|
|
|
25281
25282
|
function MatchFromObject(schema, base, ref) {
|
|
25282
25283
|
if (!guard_exports.IsObject(schema))
|
|
25283
25284
|
return void 0;
|
|
25284
|
-
return guard_exports.Keys(schema).reduce((result2,
|
|
25285
|
-
if (guard_exports.IsEqual(
|
|
25285
|
+
return guard_exports.Keys(schema).reduce((result2, key2) => {
|
|
25286
|
+
if (guard_exports.IsEqual(key2, "const") || guard_exports.IsEqual(key2, "enum"))
|
|
25286
25287
|
return result2;
|
|
25287
|
-
const match = Match4(schema[
|
|
25288
|
+
const match = Match4(schema[key2], base, ref);
|
|
25288
25289
|
return !guard_exports.IsUndefined(match) ? match : result2;
|
|
25289
25290
|
}, void 0);
|
|
25290
25291
|
}
|
|
@@ -26235,8 +26236,8 @@ function ErrorPattern(stack, context, schemaPath, instancePath, schema, value) {
|
|
|
26235
26236
|
function CheckPatternProperties(stack, context, schema, value) {
|
|
26236
26237
|
return guard_exports.Every(guard_exports.Entries(schema.patternProperties), 0, ([pattern, schema2]) => {
|
|
26237
26238
|
const regexp = UnicodeRegExp(pattern);
|
|
26238
|
-
return guard_exports.Every(guard_exports.Entries(value), 0, ([
|
|
26239
|
-
return !regexp.test(
|
|
26239
|
+
return guard_exports.Every(guard_exports.Entries(value), 0, ([key2, prop]) => {
|
|
26240
|
+
return !regexp.test(key2) || CheckSchemaPushStack(stack, context, schema2, prop) && context.AddKey(key2);
|
|
26240
26241
|
});
|
|
26241
26242
|
});
|
|
26242
26243
|
}
|
|
@@ -26244,10 +26245,10 @@ function ErrorPatternProperties(stack, context, schemaPath, instancePath, schema
|
|
|
26244
26245
|
return guard_exports.EveryAll(guard_exports.Entries(schema.patternProperties), 0, ([pattern, schema2]) => {
|
|
26245
26246
|
const nextSchemaPath = `${schemaPath}/patternProperties/${EncodeFragment(pattern)}`;
|
|
26246
26247
|
const regexp = UnicodeRegExp(pattern);
|
|
26247
|
-
return guard_exports.EveryAll(guard_exports.Entries(value), 0, ([
|
|
26248
|
-
const nextInstancePath = `${instancePath}/${EncodeFragment(
|
|
26249
|
-
const notKey = !regexp.test(
|
|
26250
|
-
return notKey || ErrorSchemaPushStack(stack, context, nextSchemaPath, nextInstancePath, schema2, value2) && context.AddKey(
|
|
26248
|
+
return guard_exports.EveryAll(guard_exports.Entries(value), 0, ([key2, value2]) => {
|
|
26249
|
+
const nextInstancePath = `${instancePath}/${EncodeFragment(key2)}`;
|
|
26250
|
+
const notKey = !regexp.test(key2);
|
|
26251
|
+
return notKey || ErrorSchemaPushStack(stack, context, nextSchemaPath, nextInstancePath, schema2, value2) && context.AddKey(key2);
|
|
26251
26252
|
});
|
|
26252
26253
|
});
|
|
26253
26254
|
}
|
|
@@ -26267,45 +26268,45 @@ function ErrorPrefixItems(stack, context, schemaPath, instancePath, schema, valu
|
|
|
26267
26268
|
}
|
|
26268
26269
|
|
|
26269
26270
|
// node_modules/typebox/build/schema/engine/_exact_optional.mjs
|
|
26270
|
-
function IsExactOptional(required2,
|
|
26271
|
-
return required2.includes(
|
|
26271
|
+
function IsExactOptional(required2, key2) {
|
|
26272
|
+
return required2.includes(key2) || settings_exports.Get().exactOptionalPropertyTypes;
|
|
26272
26273
|
}
|
|
26273
|
-
function InexactOptionalCheck(value,
|
|
26274
|
-
return guard_exports.IsUndefined(value[
|
|
26274
|
+
function InexactOptionalCheck(value, key2) {
|
|
26275
|
+
return guard_exports.IsUndefined(value[key2]);
|
|
26275
26276
|
}
|
|
26276
26277
|
|
|
26277
26278
|
// node_modules/typebox/build/schema/engine/properties.mjs
|
|
26278
26279
|
function CheckProperties(stack, context, schema, value) {
|
|
26279
26280
|
const required2 = IsRequired(schema) ? schema.required : [];
|
|
26280
|
-
const isProperties = guard_exports.Every(guard_exports.Entries(schema.properties), 0, ([
|
|
26281
|
-
const isProperty = !guard_exports.HasPropertyKey(value,
|
|
26282
|
-
return IsExactOptional(required2,
|
|
26281
|
+
const isProperties = guard_exports.Every(guard_exports.Entries(schema.properties), 0, ([key2, schema2]) => {
|
|
26282
|
+
const isProperty = !guard_exports.HasPropertyKey(value, key2) || CheckSchemaPushStack(stack, context, schema2, value[key2]) && context.AddKey(key2);
|
|
26283
|
+
return IsExactOptional(required2, key2) ? isProperty : InexactOptionalCheck(value, key2) || isProperty;
|
|
26283
26284
|
});
|
|
26284
26285
|
return isProperties;
|
|
26285
26286
|
}
|
|
26286
26287
|
function ErrorProperties(stack, context, schemaPath, instancePath, schema, value) {
|
|
26287
26288
|
const required2 = IsRequired(schema) ? schema.required : [];
|
|
26288
|
-
const isProperties = guard_exports.EveryAll(guard_exports.Entries(schema.properties), 0, ([
|
|
26289
|
-
const nextSchemaPath = `${schemaPath}/properties/${EncodeFragment(
|
|
26290
|
-
const nextInstancePath = `${instancePath}/${EncodeFragment(
|
|
26291
|
-
const isProperty = () => !guard_exports.HasPropertyKey(value,
|
|
26292
|
-
return IsExactOptional(required2,
|
|
26289
|
+
const isProperties = guard_exports.EveryAll(guard_exports.Entries(schema.properties), 0, ([key2, schema2]) => {
|
|
26290
|
+
const nextSchemaPath = `${schemaPath}/properties/${EncodeFragment(key2)}`;
|
|
26291
|
+
const nextInstancePath = `${instancePath}/${EncodeFragment(key2)}`;
|
|
26292
|
+
const isProperty = () => !guard_exports.HasPropertyKey(value, key2) || ErrorSchemaPushStack(stack, context, nextSchemaPath, nextInstancePath, schema2, value[key2]) && context.AddKey(key2);
|
|
26293
|
+
return IsExactOptional(required2, key2) ? isProperty() : InexactOptionalCheck(value, key2) || isProperty();
|
|
26293
26294
|
});
|
|
26294
26295
|
return isProperties;
|
|
26295
26296
|
}
|
|
26296
26297
|
|
|
26297
26298
|
// node_modules/typebox/build/schema/engine/propertyNames.mjs
|
|
26298
26299
|
function CheckPropertyNames(stack, context, schema, value) {
|
|
26299
|
-
return guard_exports.Every(guard_exports.Keys(value), 0, (
|
|
26300
|
+
return guard_exports.Every(guard_exports.Keys(value), 0, (key2, _index) => CheckSchema(stack, context, schema.propertyNames, key2));
|
|
26300
26301
|
}
|
|
26301
26302
|
function ErrorPropertyNames(stack, context, schemaPath, instancePath, schema, value) {
|
|
26302
26303
|
const propertyNames = [];
|
|
26303
|
-
const isPropertyNames = guard_exports.EveryAll(guard_exports.Keys(value), 0, (
|
|
26304
|
-
const nextInstancePath = `${instancePath}/${EncodeFragment(
|
|
26304
|
+
const isPropertyNames = guard_exports.EveryAll(guard_exports.Keys(value), 0, (key2, _index) => {
|
|
26305
|
+
const nextInstancePath = `${instancePath}/${EncodeFragment(key2)}`;
|
|
26305
26306
|
const nextSchemaPath = `${schemaPath}/propertyNames`;
|
|
26306
|
-
const isPropertyName = ErrorSchema(stack, context, nextSchemaPath, nextInstancePath, schema.propertyNames,
|
|
26307
|
+
const isPropertyName = ErrorSchema(stack, context, nextSchemaPath, nextInstancePath, schema.propertyNames, key2);
|
|
26307
26308
|
if (!isPropertyName)
|
|
26308
|
-
propertyNames.push(
|
|
26309
|
+
propertyNames.push(key2);
|
|
26309
26310
|
return isPropertyName;
|
|
26310
26311
|
});
|
|
26311
26312
|
return isPropertyNames || context.AddError("propertyNames", schemaPath, instancePath, { propertyNames });
|
|
@@ -26347,14 +26348,14 @@ function ErrorRef(stack, context, schemaPath, instancePath, schema, value) {
|
|
|
26347
26348
|
|
|
26348
26349
|
// node_modules/typebox/build/schema/engine/required.mjs
|
|
26349
26350
|
function CheckRequired(_stack, _context, schema, value) {
|
|
26350
|
-
return guard_exports.Every(schema.required, 0, (
|
|
26351
|
+
return guard_exports.Every(schema.required, 0, (key2) => guard_exports.HasPropertyKey(value, key2));
|
|
26351
26352
|
}
|
|
26352
26353
|
function ErrorRequired(_stack, context, schemaPath, instancePath, schema, value) {
|
|
26353
26354
|
const requiredProperties = [];
|
|
26354
|
-
const isRequired = guard_exports.EveryAll(schema.required, 0, (
|
|
26355
|
-
const hasKey = guard_exports.HasPropertyKey(value,
|
|
26355
|
+
const isRequired = guard_exports.EveryAll(schema.required, 0, (key2) => {
|
|
26356
|
+
const hasKey = guard_exports.HasPropertyKey(value, key2);
|
|
26356
26357
|
if (!hasKey)
|
|
26357
|
-
requiredProperties.push(
|
|
26358
|
+
requiredProperties.push(key2);
|
|
26358
26359
|
return hasKey;
|
|
26359
26360
|
});
|
|
26360
26361
|
return isRequired || context.AddError("required", schemaPath, instancePath, { requiredProperties });
|
|
@@ -26404,18 +26405,18 @@ function ErrorUnevaluatedItems(stack, context, schemaPath, instancePath, schema,
|
|
|
26404
26405
|
// node_modules/typebox/build/schema/engine/unevaluatedProperties.mjs
|
|
26405
26406
|
function CheckUnevaluatedProperties(stack, context, schema, value) {
|
|
26406
26407
|
const keys = context.GetKeys();
|
|
26407
|
-
return guard_exports.Every(guard_exports.Entries(value), 0, ([
|
|
26408
|
-
return keys.has(
|
|
26408
|
+
return guard_exports.Every(guard_exports.Entries(value), 0, ([key2, prop]) => {
|
|
26409
|
+
return keys.has(key2) || CheckSchema(stack, context, schema.unevaluatedProperties, prop) && context.AddKey(key2);
|
|
26409
26410
|
});
|
|
26410
26411
|
}
|
|
26411
26412
|
function ErrorUnevaluatedProperties(stack, context, schemaPath, instancePath, schema, value) {
|
|
26412
26413
|
const keys = context.GetKeys();
|
|
26413
26414
|
const unevaluatedProperties = [];
|
|
26414
|
-
const isUnevaluatedProperties = guard_exports.EveryAll(guard_exports.Entries(value), 0, ([
|
|
26415
|
+
const isUnevaluatedProperties = guard_exports.EveryAll(guard_exports.Entries(value), 0, ([key2, prop]) => {
|
|
26415
26416
|
const nextContext = new ErrorContext();
|
|
26416
|
-
const isEvaluatedProperty = keys.has(
|
|
26417
|
+
const isEvaluatedProperty = keys.has(key2) || ErrorSchema(stack, nextContext, schemaPath, instancePath, schema.unevaluatedProperties, prop) && context.AddKey(key2);
|
|
26417
26418
|
if (!isEvaluatedProperty)
|
|
26418
|
-
unevaluatedProperties.push(
|
|
26419
|
+
unevaluatedProperties.push(key2);
|
|
26419
26420
|
return isEvaluatedProperty;
|
|
26420
26421
|
});
|
|
26421
26422
|
return isUnevaluatedProperties || context.AddError("unevaluatedProperties", schemaPath, instancePath, { unevaluatedProperties });
|
|
@@ -26572,20 +26573,20 @@ function FromObject10(context, type, value) {
|
|
|
26572
26573
|
if (!guard_exports.IsObject(value) || guard_exports.IsArray(value))
|
|
26573
26574
|
return value;
|
|
26574
26575
|
const additionalProperties = GetAdditionalProperties(type);
|
|
26575
|
-
for (const
|
|
26576
|
-
if (guard_exports.HasPropertyKey(type.properties,
|
|
26577
|
-
value[
|
|
26576
|
+
for (const key2 of guard_exports.Keys(value)) {
|
|
26577
|
+
if (guard_exports.HasPropertyKey(type.properties, key2) && IsSchema(type.properties[key2])) {
|
|
26578
|
+
value[key2] = FromType19(context, type.properties[key2], value[key2]);
|
|
26578
26579
|
continue;
|
|
26579
26580
|
}
|
|
26580
26581
|
const unknownCheck = (
|
|
26581
26582
|
// 1. additionalProperties: true
|
|
26582
|
-
guard_exports.IsBoolean(additionalProperties) && guard_exports.IsEqual(additionalProperties, true) || IsSchema(additionalProperties) && Check2(context, additionalProperties, value[
|
|
26583
|
+
guard_exports.IsBoolean(additionalProperties) && guard_exports.IsEqual(additionalProperties, true) || IsSchema(additionalProperties) && Check2(context, additionalProperties, value[key2])
|
|
26583
26584
|
);
|
|
26584
26585
|
if (unknownCheck) {
|
|
26585
|
-
value[
|
|
26586
|
+
value[key2] = FromType19(context, additionalProperties, value[key2]);
|
|
26586
26587
|
continue;
|
|
26587
26588
|
}
|
|
26588
|
-
delete value[
|
|
26589
|
+
delete value[key2];
|
|
26589
26590
|
}
|
|
26590
26591
|
return value;
|
|
26591
26592
|
}
|
|
@@ -26596,20 +26597,20 @@ function FromRecord3(context, type, value) {
|
|
|
26596
26597
|
return value;
|
|
26597
26598
|
const additionalProperties = GetAdditionalProperties(type);
|
|
26598
26599
|
const [recordPattern, recordValue] = [new RegExp(RecordPattern(type)), RecordValue(type)];
|
|
26599
|
-
for (const
|
|
26600
|
-
if (recordPattern.test(
|
|
26601
|
-
value[
|
|
26600
|
+
for (const key2 of guard_exports.Keys(value)) {
|
|
26601
|
+
if (recordPattern.test(key2)) {
|
|
26602
|
+
value[key2] = FromType19(context, recordValue, value[key2]);
|
|
26602
26603
|
continue;
|
|
26603
26604
|
}
|
|
26604
26605
|
const unknownCheck = (
|
|
26605
26606
|
// 1. additionalProperties: true
|
|
26606
|
-
guard_exports.IsBoolean(additionalProperties) && guard_exports.IsEqual(additionalProperties, true) || IsSchema(additionalProperties) && Check2(context, additionalProperties, value[
|
|
26607
|
+
guard_exports.IsBoolean(additionalProperties) && guard_exports.IsEqual(additionalProperties, true) || IsSchema(additionalProperties) && Check2(context, additionalProperties, value[key2])
|
|
26607
26608
|
);
|
|
26608
26609
|
if (unknownCheck) {
|
|
26609
|
-
value[
|
|
26610
|
+
value[key2] = FromType19(context, additionalProperties, value[key2]);
|
|
26610
26611
|
continue;
|
|
26611
26612
|
}
|
|
26612
|
-
delete value[
|
|
26613
|
+
delete value[key2];
|
|
26613
26614
|
}
|
|
26614
26615
|
return value;
|
|
26615
26616
|
}
|
|
@@ -26652,17 +26653,17 @@ function FromType19(context, type, value) {
|
|
|
26652
26653
|
|
|
26653
26654
|
// node_modules/typebox/build/value/shared/union_priority_sort.mjs
|
|
26654
26655
|
function Modifiers(type, next) {
|
|
26655
|
-
for (const
|
|
26656
|
-
if (guard_default.HasPropertyKey(next,
|
|
26656
|
+
for (const key2 of guard_default.Keys(type)) {
|
|
26657
|
+
if (guard_default.HasPropertyKey(next, key2))
|
|
26657
26658
|
continue;
|
|
26658
|
-
next[
|
|
26659
|
+
next[key2] = type[key2];
|
|
26659
26660
|
}
|
|
26660
26661
|
return next;
|
|
26661
26662
|
}
|
|
26662
26663
|
function FromProperties4(properties) {
|
|
26663
26664
|
const result2 = {};
|
|
26664
|
-
for (const
|
|
26665
|
-
result2[
|
|
26665
|
+
for (const key2 of guard_default.Keys(properties))
|
|
26666
|
+
result2[key2] = FromType20(properties[key2]);
|
|
26666
26667
|
return result2;
|
|
26667
26668
|
}
|
|
26668
26669
|
function FromRecordKey(type) {
|
|
@@ -26912,9 +26913,9 @@ function FromNumber5(_context, _type, value) {
|
|
|
26912
26913
|
function FromAdditionalProperties(context, entries, additionalProperties, value) {
|
|
26913
26914
|
const keys = guard_exports.Keys(value);
|
|
26914
26915
|
for (const [regexp, _] of entries) {
|
|
26915
|
-
for (const
|
|
26916
|
-
if (!regexp.test(
|
|
26917
|
-
value[
|
|
26916
|
+
for (const key2 of keys) {
|
|
26917
|
+
if (!regexp.test(key2)) {
|
|
26918
|
+
value[key2] = FromType21(context, additionalProperties, value[key2]);
|
|
26918
26919
|
}
|
|
26919
26920
|
}
|
|
26920
26921
|
}
|
|
@@ -26922,8 +26923,8 @@ function FromAdditionalProperties(context, entries, additionalProperties, value)
|
|
|
26922
26923
|
}
|
|
26923
26924
|
|
|
26924
26925
|
// node_modules/typebox/build/value/shared/optional_undefined.mjs
|
|
26925
|
-
function IsOptionalUndefined(property,
|
|
26926
|
-
return IsOptional(property) && guard_exports.IsUndefined(value[
|
|
26926
|
+
function IsOptionalUndefined(property, key2, value) {
|
|
26927
|
+
return IsOptional(property) && guard_exports.IsUndefined(value[key2]);
|
|
26927
26928
|
}
|
|
26928
26929
|
|
|
26929
26930
|
// node_modules/typebox/build/value/convert/from_object.mjs
|
|
@@ -26931,10 +26932,10 @@ function FromProperties5(context, type, value) {
|
|
|
26931
26932
|
const entries = guard_exports.EntriesRegExp(type.properties);
|
|
26932
26933
|
const keys = guard_exports.Keys(value);
|
|
26933
26934
|
for (const [regexp, property] of entries) {
|
|
26934
|
-
for (const
|
|
26935
|
-
if (!regexp.test(
|
|
26935
|
+
for (const key2 of keys) {
|
|
26936
|
+
if (!regexp.test(key2) || IsOptionalUndefined(property, key2, value))
|
|
26936
26937
|
continue;
|
|
26937
|
-
value[
|
|
26938
|
+
value[key2] = FromType21(context, property, value[key2]);
|
|
26938
26939
|
}
|
|
26939
26940
|
}
|
|
26940
26941
|
return guard_exports.HasPropertyKey(type, "additionalProperties") && guard_exports.IsObject(type.additionalProperties) ? FromAdditionalProperties(context, entries, type.additionalProperties, value) : value;
|
|
@@ -26948,9 +26949,9 @@ function FromPatternProperties(context, type, value) {
|
|
|
26948
26949
|
const entries = guard_exports.EntriesRegExp(type.patternProperties);
|
|
26949
26950
|
const keys = guard_exports.Keys(value);
|
|
26950
26951
|
for (const [regexp, schema] of entries) {
|
|
26951
|
-
for (const
|
|
26952
|
-
if (regexp.test(
|
|
26953
|
-
value[
|
|
26952
|
+
for (const key2 of keys) {
|
|
26953
|
+
if (regexp.test(key2)) {
|
|
26954
|
+
value[key2] = FromType21(context, schema, value[key2]);
|
|
26954
26955
|
}
|
|
26955
26956
|
}
|
|
26956
26957
|
}
|
|
@@ -26997,8 +26998,8 @@ function FromUnion10(context, type, value) {
|
|
|
26997
26998
|
const matched = type.anyOf.some((type2) => Check2(context, type2, value));
|
|
26998
26999
|
if (matched)
|
|
26999
27000
|
return value;
|
|
27000
|
-
const
|
|
27001
|
-
const selected =
|
|
27001
|
+
const candidates2 = type.anyOf.map((type2) => FromType21(context, type2, Clone2(value)));
|
|
27002
|
+
const selected = candidates2.find((value2) => Check2(context, type, value2));
|
|
27002
27003
|
return guard_exports.IsUndefined(selected) ? value : selected;
|
|
27003
27004
|
}
|
|
27004
27005
|
|
|
@@ -27056,19 +27057,19 @@ function FromObject12(context, type, value) {
|
|
|
27056
27057
|
if (!guard_exports.IsObject(value))
|
|
27057
27058
|
return value;
|
|
27058
27059
|
const knownPropertyKeys = guard_exports.Keys(type.properties);
|
|
27059
|
-
for (const
|
|
27060
|
-
const propertyValue = FromType22(context, type.properties[
|
|
27061
|
-
const isUnassignableUndefined = guard_exports.IsUndefined(propertyValue) && (IsOptional(type.properties[
|
|
27060
|
+
for (const key2 of knownPropertyKeys) {
|
|
27061
|
+
const propertyValue = FromType22(context, type.properties[key2], value[key2]);
|
|
27062
|
+
const isUnassignableUndefined = guard_exports.IsUndefined(propertyValue) && (IsOptional(type.properties[key2]) || !guard_exports.HasPropertyKey(type.properties[key2], "default"));
|
|
27062
27063
|
if (isUnassignableUndefined)
|
|
27063
27064
|
continue;
|
|
27064
|
-
value[
|
|
27065
|
+
value[key2] = propertyValue;
|
|
27065
27066
|
}
|
|
27066
27067
|
if (!IsAdditionalProperties(type) || guard_exports.IsBoolean(type.additionalProperties))
|
|
27067
27068
|
return value;
|
|
27068
|
-
for (const
|
|
27069
|
-
if (knownPropertyKeys.includes(
|
|
27069
|
+
for (const key2 of guard_exports.Keys(value)) {
|
|
27070
|
+
if (knownPropertyKeys.includes(key2))
|
|
27070
27071
|
continue;
|
|
27071
|
-
value[
|
|
27072
|
+
value[key2] = FromType22(context, type.additionalProperties, value[key2]);
|
|
27072
27073
|
}
|
|
27073
27074
|
return value;
|
|
27074
27075
|
}
|
|
@@ -27078,17 +27079,17 @@ function FromRecord5(context, type, value) {
|
|
|
27078
27079
|
if (!guard_exports.IsObject(value))
|
|
27079
27080
|
return value;
|
|
27080
27081
|
const [recordKey, recordValue] = [new RegExp(RecordPattern(type)), RecordValue(type)];
|
|
27081
|
-
for (const
|
|
27082
|
-
if (!(recordKey.test(
|
|
27082
|
+
for (const key2 of guard_exports.Keys(value)) {
|
|
27083
|
+
if (!(recordKey.test(key2) && IsDefault(recordValue)))
|
|
27083
27084
|
continue;
|
|
27084
|
-
value[
|
|
27085
|
+
value[key2] = FromType22(context, recordValue, value[key2]);
|
|
27085
27086
|
}
|
|
27086
27087
|
if (!IsAdditionalProperties(type))
|
|
27087
27088
|
return value;
|
|
27088
|
-
for (const
|
|
27089
|
-
if (recordKey.test(
|
|
27089
|
+
for (const key2 of guard_exports.Keys(value)) {
|
|
27090
|
+
if (recordKey.test(key2))
|
|
27090
27091
|
continue;
|
|
27091
|
-
value[
|
|
27092
|
+
value[key2] = FromType22(context, type.additionalProperties, value[key2]);
|
|
27092
27093
|
}
|
|
27093
27094
|
return value;
|
|
27094
27095
|
}
|
|
@@ -27224,10 +27225,10 @@ function FromIntersect9(direction, context, type, value) {
|
|
|
27224
27225
|
function Decode6(direction, context, type, value) {
|
|
27225
27226
|
if (!guard_exports.IsObjectNotArray(value))
|
|
27226
27227
|
return value;
|
|
27227
|
-
for (const
|
|
27228
|
-
if (!guard_exports.HasPropertyKey(value,
|
|
27228
|
+
for (const key2 of guard_exports.Keys(type.properties)) {
|
|
27229
|
+
if (!guard_exports.HasPropertyKey(value, key2) || IsOptionalUndefined(type.properties[key2], key2, value))
|
|
27229
27230
|
continue;
|
|
27230
|
-
value[
|
|
27231
|
+
value[key2] = FromType23(direction, context, type.properties[key2], value[key2]);
|
|
27231
27232
|
}
|
|
27232
27233
|
return Callback(direction, context, type, value);
|
|
27233
27234
|
}
|
|
@@ -27235,10 +27236,10 @@ function Encode6(direction, context, type, value) {
|
|
|
27235
27236
|
const exterior = Callback(direction, context, type, value);
|
|
27236
27237
|
if (!guard_exports.IsObjectNotArray(exterior))
|
|
27237
27238
|
return exterior;
|
|
27238
|
-
for (const
|
|
27239
|
-
if (!guard_exports.HasPropertyKey(exterior,
|
|
27239
|
+
for (const key2 of guard_exports.Keys(type.properties)) {
|
|
27240
|
+
if (!guard_exports.HasPropertyKey(exterior, key2) || IsOptionalUndefined(type.properties[key2], key2, exterior))
|
|
27240
27241
|
continue;
|
|
27241
|
-
exterior[
|
|
27242
|
+
exterior[key2] = FromType23(direction, context, type.properties[key2], exterior[key2]);
|
|
27242
27243
|
}
|
|
27243
27244
|
return exterior;
|
|
27244
27245
|
}
|
|
@@ -27251,10 +27252,10 @@ function Decode7(direction, context, type, value) {
|
|
|
27251
27252
|
if (!guard_exports.IsObjectNotArray(value))
|
|
27252
27253
|
return value;
|
|
27253
27254
|
const regexp = new RegExp(RecordPattern(type));
|
|
27254
|
-
for (const
|
|
27255
|
-
if (!regexp.test(
|
|
27255
|
+
for (const key2 of guard_exports.Keys(value)) {
|
|
27256
|
+
if (!regexp.test(key2))
|
|
27256
27257
|
continue;
|
|
27257
|
-
value[
|
|
27258
|
+
value[key2] = FromType23(direction, context, RecordValue(type), value[key2]);
|
|
27258
27259
|
}
|
|
27259
27260
|
return Callback(direction, context, type, value);
|
|
27260
27261
|
}
|
|
@@ -27263,10 +27264,10 @@ function Encode7(direction, context, type, value) {
|
|
|
27263
27264
|
if (!guard_exports.IsObjectNotArray(exterior))
|
|
27264
27265
|
return exterior;
|
|
27265
27266
|
const regexp = new RegExp(RecordPattern(type));
|
|
27266
|
-
for (const
|
|
27267
|
-
if (!regexp.test(
|
|
27267
|
+
for (const key2 of guard_exports.Keys(exterior)) {
|
|
27268
|
+
if (!regexp.test(key2))
|
|
27268
27269
|
continue;
|
|
27269
|
-
exterior[
|
|
27270
|
+
exterior[key2] = FromType23(direction, context, RecordValue(type), exterior[key2]);
|
|
27270
27271
|
}
|
|
27271
27272
|
return exterior;
|
|
27272
27273
|
}
|
|
@@ -27633,13 +27634,13 @@ function consoleStatus(value) {
|
|
|
27633
27634
|
session_binding: token(v.session_binding) ?? "unknown",
|
|
27634
27635
|
readiness_scope: token(v.readiness_scope) ?? "unknown"
|
|
27635
27636
|
};
|
|
27636
|
-
for (const
|
|
27637
|
-
const s = token(v[
|
|
27638
|
-
if (s) result2[
|
|
27637
|
+
for (const key2 of ["vm", "lease_id", "console_id", "backend", "source"]) {
|
|
27638
|
+
const s = token(v[key2]);
|
|
27639
|
+
if (s) result2[key2] = s;
|
|
27639
27640
|
}
|
|
27640
27641
|
if (v.environment_fingerprint === null) result2.environment_fingerprint = null;
|
|
27641
27642
|
else if (token(v.environment_fingerprint)) result2.environment_fingerprint = token(v.environment_fingerprint);
|
|
27642
|
-
for (const
|
|
27643
|
+
for (const key2 of ["observed_at", "access_expires_at"]) if (typeof v[key2] === "number" && Number.isFinite(v[key2])) result2[key2] = v[key2];
|
|
27643
27644
|
if (v.attempt !== void 0) {
|
|
27644
27645
|
const a = object4(v.attempt);
|
|
27645
27646
|
result2.attempt = {
|
|
@@ -27907,7 +27908,7 @@ function decodePng(bytes, size) {
|
|
|
27907
27908
|
};
|
|
27908
27909
|
const rawSample = (row, index) => depth === 16 ? scan[row * stride + index * 2] << 8 | scan[row * stride + index * 2 + 1] : sample(row, index);
|
|
27909
27910
|
const scale = depth < 8 ? 255 / max : 1;
|
|
27910
|
-
const
|
|
27911
|
+
const key2 = trns && (colorType === 0 || colorType === 2) ? Array.from({ length: channels }, (_, i) => trns.readUInt16BE(i * 2)) : void 0;
|
|
27911
27912
|
for (let y = 0; y < height; y++) for (let x = 0; x < width; x++) {
|
|
27912
27913
|
const o = (y * width + x) * 4, i = x * channels;
|
|
27913
27914
|
if (colorType === 3) {
|
|
@@ -27919,7 +27920,7 @@ function decodePng(bytes, size) {
|
|
|
27919
27920
|
rgba[o + 3] = trns && sample(y, x) < trns.length ? trns[sample(y, x)] : 255;
|
|
27920
27921
|
continue;
|
|
27921
27922
|
}
|
|
27922
|
-
const keyed =
|
|
27923
|
+
const keyed = key2 !== void 0 && key2.every((value, c) => rawSample(y, i + c) === value);
|
|
27923
27924
|
if (colorType === 0 || colorType === 4) {
|
|
27924
27925
|
const g = Math.round(sample(y, i) * scale);
|
|
27925
27926
|
rgba[o] = g;
|
|
@@ -28143,7 +28144,7 @@ function imageFailure(error2) {
|
|
|
28143
28144
|
return { status: code && known.has(code) ? code : "transfer-failed", diagnostic: error2 instanceof ImageError ? error2.message : code && known.has(code) ? `Image operation failed: ${code}` : "Image delivery could not complete; execution was not replayed." };
|
|
28144
28145
|
}
|
|
28145
28146
|
function canonical(value) {
|
|
28146
|
-
return JSON.stringify(value, (_key, item) => item && typeof item === "object" && !Array.isArray(item) ? Object.fromEntries(Object.keys(item).sort().map((
|
|
28147
|
+
return JSON.stringify(value, (_key, item) => item && typeof item === "object" && !Array.isArray(item) ? Object.fromEntries(Object.keys(item).sort().map((key2) => [key2, item[key2]])) : item);
|
|
28147
28148
|
}
|
|
28148
28149
|
function guard(signal) {
|
|
28149
28150
|
if (signal?.aborted) fail("transfer-failed", "Image delivery cancelled or deadline exceeded.");
|
|
@@ -28541,8 +28542,8 @@ var ImageStore = class {
|
|
|
28541
28542
|
for (const name of names.filter((n) => n.endsWith(".json"))) {
|
|
28542
28543
|
const record3 = await this.load(name.slice(0, -5)).catch(() => void 0);
|
|
28543
28544
|
if (!record3 || record3.recording !== recordingRoot || record3.descriptor.source !== "display") continue;
|
|
28544
|
-
const
|
|
28545
|
-
held.set(
|
|
28545
|
+
const key2 = `${record3.descriptor.sha256}:${record3.descriptor.bytes}`;
|
|
28546
|
+
held.set(key2, [...held.get(key2) ?? [], record3.local]);
|
|
28546
28547
|
}
|
|
28547
28548
|
return held;
|
|
28548
28549
|
}
|
|
@@ -28666,7 +28667,7 @@ var DownloadQueue = class {
|
|
|
28666
28667
|
}
|
|
28667
28668
|
}
|
|
28668
28669
|
/** Shutdown: nothing more starts or is written; the download in flight is aborted. `wait` waits for it to stop. */
|
|
28669
|
-
async close(
|
|
28670
|
+
async close(wait2) {
|
|
28670
28671
|
this.state = "closed";
|
|
28671
28672
|
for (const job of this.queued.splice(0)) {
|
|
28672
28673
|
job.end = "cancelled";
|
|
@@ -28674,7 +28675,7 @@ var DownloadQueue = class {
|
|
|
28674
28675
|
}
|
|
28675
28676
|
const current = this.current;
|
|
28676
28677
|
current?.controller.abort(new Error("The relay is shutting down"));
|
|
28677
|
-
if (
|
|
28678
|
+
if (wait2) await current?.done;
|
|
28678
28679
|
}
|
|
28679
28680
|
kick() {
|
|
28680
28681
|
if (this.current || this.state === "closed" || !this.queued.length || this.paused && !this.queued[0].promoted) return;
|
|
@@ -28829,6 +28830,193 @@ async function refreshEvidenceState(incoming, destination, archiveRoot, options
|
|
|
28829
28830
|
}
|
|
28830
28831
|
|
|
28831
28832
|
// src/discovery.ts
|
|
28833
|
+
import { existsSync } from "node:fs";
|
|
28834
|
+
|
|
28835
|
+
// src/mdns.ts
|
|
28836
|
+
import { spawn as spawn5 } from "node:child_process";
|
|
28837
|
+
import { createSocket } from "node:dgram";
|
|
28838
|
+
import { lookup } from "node:dns/promises";
|
|
28839
|
+
var TYPE = { A: 1, PTR: 12, TXT: 16, SRV: 33 };
|
|
28840
|
+
var GROUP = "224.0.0.251";
|
|
28841
|
+
var PORT = 5353;
|
|
28842
|
+
var key = (name) => name.replace(/\.$/, "").toLowerCase();
|
|
28843
|
+
function encodeName(name) {
|
|
28844
|
+
const parts = name.replace(/\.$/, "").split(".").map((label) => Buffer.from(label, "utf8"));
|
|
28845
|
+
if (parts.some((part) => part.length === 0 || part.length > 63)) throw new Error(`Invalid DNS name ${name}`);
|
|
28846
|
+
return Buffer.concat([...parts.flatMap((part) => [Buffer.from([part.length]), part]), Buffer.from([0])]);
|
|
28847
|
+
}
|
|
28848
|
+
function encodeQuery(questions) {
|
|
28849
|
+
const header2 = Buffer.alloc(12);
|
|
28850
|
+
header2.writeUInt16BE(questions.length, 4);
|
|
28851
|
+
return Buffer.concat([header2, ...questions.flatMap((q) => {
|
|
28852
|
+
const tail = Buffer.alloc(4);
|
|
28853
|
+
tail.writeUInt16BE(q.type, 0);
|
|
28854
|
+
tail.writeUInt16BE(1, 2);
|
|
28855
|
+
return [encodeName(q.name), tail];
|
|
28856
|
+
})]);
|
|
28857
|
+
}
|
|
28858
|
+
function readName(message3, offset) {
|
|
28859
|
+
const labels = [];
|
|
28860
|
+
let at = offset, end = -1, jumps = 0;
|
|
28861
|
+
for (; ; ) {
|
|
28862
|
+
if (at >= message3.length) throw new Error("DNS name runs past the message");
|
|
28863
|
+
const length = message3[at];
|
|
28864
|
+
if (length === 0) {
|
|
28865
|
+
at += 1;
|
|
28866
|
+
break;
|
|
28867
|
+
}
|
|
28868
|
+
if ((length & 192) === 192) {
|
|
28869
|
+
if (at + 1 >= message3.length || ++jumps > 32) throw new Error("Invalid DNS name pointer");
|
|
28870
|
+
if (end < 0) end = at + 2;
|
|
28871
|
+
at = (length & 63) << 8 | message3[at + 1];
|
|
28872
|
+
continue;
|
|
28873
|
+
}
|
|
28874
|
+
if (at + 1 + length > message3.length) throw new Error("DNS label runs past the message");
|
|
28875
|
+
labels.push(message3.toString("utf8", at + 1, at + 1 + length));
|
|
28876
|
+
at += 1 + length;
|
|
28877
|
+
}
|
|
28878
|
+
return [labels.join("."), end < 0 ? at : end];
|
|
28879
|
+
}
|
|
28880
|
+
function parseRecords(message3) {
|
|
28881
|
+
const records = [];
|
|
28882
|
+
try {
|
|
28883
|
+
if (message3.length < 12 || !(message3[2] & 128)) return records;
|
|
28884
|
+
const questions = message3.readUInt16BE(4), total = message3.readUInt16BE(6) + message3.readUInt16BE(8) + message3.readUInt16BE(10);
|
|
28885
|
+
let at = 12;
|
|
28886
|
+
for (let i = 0; i < questions; i++) at = readName(message3, at)[1] + 4;
|
|
28887
|
+
for (let i = 0; i < total; i++) {
|
|
28888
|
+
const [name, next] = readName(message3, at);
|
|
28889
|
+
const type = message3.readUInt16BE(next), length = message3.readUInt16BE(next + 8), start = next + 10;
|
|
28890
|
+
if (start + length > message3.length) break;
|
|
28891
|
+
records.push({ name, type, data: message3.subarray(start, start + length), message: message3, offset: start });
|
|
28892
|
+
at = start + length;
|
|
28893
|
+
}
|
|
28894
|
+
} catch {
|
|
28895
|
+
}
|
|
28896
|
+
return records;
|
|
28897
|
+
}
|
|
28898
|
+
function txtOf(data) {
|
|
28899
|
+
const txt = {};
|
|
28900
|
+
for (let at = 0; at < data.length; ) {
|
|
28901
|
+
const length = data[at];
|
|
28902
|
+
if (at + 1 + length > data.length) break;
|
|
28903
|
+
const pair = data.toString("utf8", at + 1, at + 1 + length);
|
|
28904
|
+
at += 1 + length;
|
|
28905
|
+
if (!pair) continue;
|
|
28906
|
+
const split = pair.indexOf("=");
|
|
28907
|
+
txt[(split < 0 ? pair : pair.slice(0, split)).toLowerCase()] = split < 0 ? "" : pair.slice(split + 1);
|
|
28908
|
+
}
|
|
28909
|
+
return txt;
|
|
28910
|
+
}
|
|
28911
|
+
function assemble(service, records) {
|
|
28912
|
+
const by = (type, name) => records.filter((r) => r.type === type && key(r.name) === key(name));
|
|
28913
|
+
const names = new Set(by(TYPE.PTR, service).map((r) => readName(r.message, r.offset)[0]));
|
|
28914
|
+
const found = [];
|
|
28915
|
+
for (const full of names) {
|
|
28916
|
+
const srv = by(TYPE.SRV, full)[0];
|
|
28917
|
+
if (!srv || srv.data.length < 7) continue;
|
|
28918
|
+
const port = srv.data.readUInt16BE(4), host = readName(srv.message, srv.offset + 6)[0];
|
|
28919
|
+
const txt = Object.assign({}, ...by(TYPE.TXT, full).map((r) => txtOf(r.data)));
|
|
28920
|
+
const a = by(TYPE.A, host).find((r) => r.data.length === 4);
|
|
28921
|
+
const name = full.slice(0, full.length - service.length - 1);
|
|
28922
|
+
found.push({ name, instance: txt.instance || name, ...txt.machine_id ? { machine_id: txt.machine_id } : {}, host: host.replace(/\.$/, ""), ...a ? { address: [...a.data].join(".") } : {}, port, txt });
|
|
28923
|
+
}
|
|
28924
|
+
return found.sort((x, y) => x.name.localeCompare(y.name));
|
|
28925
|
+
}
|
|
28926
|
+
var udpTransport = (receive) => new Promise((resolve11, reject) => {
|
|
28927
|
+
const socket = createSocket({ type: "udp4", reuseAddr: true });
|
|
28928
|
+
socket.on("message", (message3) => receive(message3));
|
|
28929
|
+
socket.once("error", reject);
|
|
28930
|
+
socket.bind(0, () => {
|
|
28931
|
+
socket.setMulticastTTL(255);
|
|
28932
|
+
resolve11({ send: (query) => socket.send(query, PORT, GROUP), close: () => socket.close() });
|
|
28933
|
+
});
|
|
28934
|
+
});
|
|
28935
|
+
var wait = (ms) => new Promise((done) => setTimeout(done, ms));
|
|
28936
|
+
async function browse(service, windowMs = 2e3, followUpMs = 1e3, open9 = udpTransport) {
|
|
28937
|
+
const records = [];
|
|
28938
|
+
const transport = await open9((message3) => records.push(...parseRecords(message3)));
|
|
28939
|
+
try {
|
|
28940
|
+
const question = encodeQuery([{ name: service, type: TYPE.PTR }]);
|
|
28941
|
+
transport.send(question);
|
|
28942
|
+
await wait(windowMs / 2);
|
|
28943
|
+
transport.send(question);
|
|
28944
|
+
await wait(windowMs / 2);
|
|
28945
|
+
const missing = [...new Set(records.filter((r) => r.type === TYPE.PTR && key(r.name) === key(service)).map((r) => readName(r.message, r.offset)[0]))].filter((full) => !assemble(service, records).some((found) => key(`${found.name}.${service}`) === key(full) && found.address));
|
|
28946
|
+
if (missing.length) {
|
|
28947
|
+
const hosts = records.filter((r) => r.type === TYPE.SRV).map((r) => readName(r.message, r.offset + 6)[0]);
|
|
28948
|
+
transport.send(encodeQuery([...missing.flatMap((name) => [{ name, type: TYPE.SRV }, { name, type: TYPE.TXT }]), ...hosts.map((name) => ({ name, type: TYPE.A }))]));
|
|
28949
|
+
await wait(followUpMs);
|
|
28950
|
+
}
|
|
28951
|
+
return assemble(service, records);
|
|
28952
|
+
} finally {
|
|
28953
|
+
transport.close();
|
|
28954
|
+
}
|
|
28955
|
+
}
|
|
28956
|
+
var unescape2 = (text5) => Buffer.from(text5.replace(/\\(\d{3})|\\(.)/g, (_, code, char) => code ? String.fromCharCode(Number(code)) : char), "latin1").toString("utf8");
|
|
28957
|
+
function parseZone(zone) {
|
|
28958
|
+
const lines = zone.split("\n").map((line) => line.replace(/\s;.*$/, "").trim()).filter((line) => line && !line.startsWith(";"));
|
|
28959
|
+
const field = (line) => line.match(/^(\S+)\s+(PTR|SRV|TXT)\s+(.*)$/);
|
|
28960
|
+
const order = [], srv = /* @__PURE__ */ new Map(), txt = /* @__PURE__ */ new Map();
|
|
28961
|
+
for (const line of lines) {
|
|
28962
|
+
const match = field(line);
|
|
28963
|
+
if (!match) continue;
|
|
28964
|
+
const [, owner, type, rest] = match;
|
|
28965
|
+
if (type === "PTR") {
|
|
28966
|
+
const full = rest.trim();
|
|
28967
|
+
if (!order.includes(full)) order.push(full);
|
|
28968
|
+
} else if (type === "SRV") {
|
|
28969
|
+
const [, , port, host] = rest.trim().split(/\s+/);
|
|
28970
|
+
if (port && host) srv.set(owner, { port: Number(port), host: host.replace(/\.$/, "") });
|
|
28971
|
+
} else txt.set(owner, Object.fromEntries([...rest.matchAll(/"((?:[^"\\]|\\.)*)"/g)].map(([, pair]) => unescape2(pair)).filter((pair) => pair).map((pair) => {
|
|
28972
|
+
const at = pair.indexOf("=");
|
|
28973
|
+
return at < 0 ? [pair.toLowerCase(), ""] : [pair.slice(0, at).toLowerCase(), pair.slice(at + 1)];
|
|
28974
|
+
})));
|
|
28975
|
+
}
|
|
28976
|
+
return order.flatMap((full) => {
|
|
28977
|
+
const target = srv.get(full);
|
|
28978
|
+
if (!target) return [];
|
|
28979
|
+
const name = unescape2(full.split(/(?<!\\)\./)[0]);
|
|
28980
|
+
const record3 = txt.get(full) ?? {};
|
|
28981
|
+
return [{ name, instance: record3.instance || name, ...record3.machine_id ? { machine_id: record3.machine_id } : {}, host: target.host, port: target.port, txt: record3 }];
|
|
28982
|
+
});
|
|
28983
|
+
}
|
|
28984
|
+
var systemTools = {
|
|
28985
|
+
run: (argv, ms) => new Promise((resolve11) => {
|
|
28986
|
+
const child = spawn5(argv[0], argv.slice(1), { stdio: ["ignore", "pipe", "ignore"] });
|
|
28987
|
+
let out = "";
|
|
28988
|
+
child.stdout.setEncoding("utf8").on("data", (chunk) => {
|
|
28989
|
+
out += chunk;
|
|
28990
|
+
});
|
|
28991
|
+
const timer = setTimeout(() => child.kill("SIGTERM"), ms);
|
|
28992
|
+
child.on("close", () => {
|
|
28993
|
+
clearTimeout(timer);
|
|
28994
|
+
resolve11(out);
|
|
28995
|
+
});
|
|
28996
|
+
child.on("error", () => {
|
|
28997
|
+
clearTimeout(timer);
|
|
28998
|
+
resolve11(out);
|
|
28999
|
+
});
|
|
29000
|
+
}),
|
|
29001
|
+
lookup: (host) => lookup(host, { family: 4 }).then((found) => found.address, () => void 0)
|
|
29002
|
+
};
|
|
29003
|
+
var DNS_SD = "/usr/bin/dns-sd";
|
|
29004
|
+
async function systemBrowse(service, windowMs = 1500, tools = systemTools) {
|
|
29005
|
+
const type = service.replace(/\.local\.?$/, "");
|
|
29006
|
+
const found = parseZone(await tools.run([DNS_SD, "-Z", type, "local."], windowMs));
|
|
29007
|
+
return Promise.all(found.map(async (advert) => {
|
|
29008
|
+
const address = await tools.lookup(advert.host);
|
|
29009
|
+
return address ? { ...advert, address } : advert;
|
|
29010
|
+
}));
|
|
29011
|
+
}
|
|
29012
|
+
|
|
29013
|
+
// src/discovery.ts
|
|
29014
|
+
var SERVICE_TYPE = "_machine-service._tcp.local";
|
|
29015
|
+
function discoveryMode(value = process.env.MACHINE_SERVICE_DISCOVERY) {
|
|
29016
|
+
if (!value || value === "bonjour") return "bonjour";
|
|
29017
|
+
if (value === "consul") return "consul";
|
|
29018
|
+
throw new Error(`MACHINE_SERVICE_DISCOVERY must be one of bonjour, consul; got ${JSON.stringify(value)}`);
|
|
29019
|
+
}
|
|
28832
29020
|
var TIMEOUT_MS = 5e3;
|
|
28833
29021
|
function consulAddress(value = process.env.CONSUL_HTTP_ADDR) {
|
|
28834
29022
|
const address = value?.trim() || "http://127.0.0.1:8500";
|
|
@@ -28847,34 +29035,89 @@ function parseRegistrations(answer) {
|
|
|
28847
29035
|
const host = text3(service?.Address) || text3(node2?.Address);
|
|
28848
29036
|
if (!host || !Number.isSafeInteger(port)) return [];
|
|
28849
29037
|
const meta2 = service?.Meta ?? {};
|
|
28850
|
-
return [{ node: text3(node2?.Node), origin: new URL(`http://${host.includes(":") ? `[${host}]` : host}:${port}`).origin, ...text3(meta2.instance) ? { instance: text3(meta2.instance) } : {}, loopbackOnly: meta2.loopback_only === "true" }];
|
|
29038
|
+
return [{ node: text3(node2?.Node), origin: new URL(`http://${host.includes(":") ? `[${host}]` : host}:${port}`).origin, ...text3(meta2.instance) ? { instance: text3(meta2.instance) } : {}, ...text3(meta2.machine_id) ? { machine_id: text3(meta2.machine_id) } : {}, loopbackOnly: meta2.loopback_only === "true" }];
|
|
28851
29039
|
});
|
|
28852
29040
|
}
|
|
28853
|
-
async function
|
|
29041
|
+
async function candidates(options, mode) {
|
|
29042
|
+
if (mode === "bonjour") {
|
|
29043
|
+
try {
|
|
29044
|
+
const advertised = await (options.browse ?? (() => existsSync(DNS_SD) ? systemBrowse(SERVICE_TYPE) : browse(SERVICE_TYPE)))();
|
|
29045
|
+
return { found: advertised.map((a) => ({ origin: new URL(`http://${a.address ?? a.host}:${a.port}`).origin, expected: a.instance, ...a.machine_id || a.txt.machine_id ? { machine_id: a.machine_id || a.txt.machine_id } : {} })) };
|
|
29046
|
+
} catch (error2) {
|
|
29047
|
+
return { found: [], error: `the Bonjour browse failed (${error2 instanceof Error ? error2.message : String(error2)})` };
|
|
29048
|
+
}
|
|
29049
|
+
}
|
|
28854
29050
|
const consul = options.consul ?? consulAddress();
|
|
28855
|
-
const make = options.backend ?? ((origin) => new MachineService({ baseUrl: origin, listed: true }));
|
|
28856
|
-
const candidates = [{ origin: new URL(options.local.baseUrl).origin, backend: options.local }];
|
|
28857
|
-
let consulError;
|
|
28858
29051
|
try {
|
|
28859
|
-
|
|
28860
|
-
|
|
28861
|
-
candidates.push({ origin: registration.origin, backend: make(registration.origin) });
|
|
28862
|
-
}
|
|
29052
|
+
const rows = parseRegistrations(await (options.fetchJson ?? fetchJson)(`${consul}/v1/health/service/machine-service`));
|
|
29053
|
+
return { found: rows.filter((row) => !row.loopbackOnly).map((row) => ({ origin: row.origin, ...row.instance ? { expected: row.instance } : {}, ...row.machine_id ? { machine_id: row.machine_id } : {} })) };
|
|
28863
29054
|
} catch (error2) {
|
|
28864
|
-
|
|
29055
|
+
return { found: [], error: `the Consul agent at ${consul} did not answer (${error2 instanceof Error ? error2.message : String(error2)})` };
|
|
28865
29056
|
}
|
|
28866
|
-
|
|
28867
|
-
|
|
28868
|
-
|
|
28869
|
-
|
|
28870
|
-
|
|
28871
|
-
|
|
28872
|
-
|
|
28873
|
-
|
|
28874
|
-
})
|
|
28875
|
-
|
|
28876
|
-
|
|
28877
|
-
|
|
29057
|
+
}
|
|
29058
|
+
function confirmed(health, expected, machine_id) {
|
|
29059
|
+
if (health.service !== void 0 && health.service !== "machine-service") return `it answers as ${String(health.service)}, not machine-service`;
|
|
29060
|
+
if (machine_id) return health.machine_id === machine_id ? void 0 : `it was found with machine_id ${machine_id}, but its /health answers machine_id ${String(health.machine_id ?? "none")}`;
|
|
29061
|
+
if (expected && health.instance !== expected) return `it was found as ${expected}, but its /health answers ${String(health.instance ?? "no instance")}`;
|
|
29062
|
+
return void 0;
|
|
29063
|
+
}
|
|
29064
|
+
function findDurableOwner(machine, options) {
|
|
29065
|
+
return findOwner({ name: machine }, options);
|
|
29066
|
+
}
|
|
29067
|
+
function findDurableOwnerById(machine_id, options) {
|
|
29068
|
+
return findOwner({ machine_id }, options);
|
|
29069
|
+
}
|
|
29070
|
+
async function findOwner(target, options) {
|
|
29071
|
+
const machine = target.name ?? `with machine_id ${target.machine_id}`;
|
|
29072
|
+
const mode = options.mode ?? discoveryMode();
|
|
29073
|
+
const make = options.backend ?? ((origin) => new MachineService({ baseUrl: origin, listed: true }));
|
|
29074
|
+
const localOrigin = new URL(options.local.baseUrl).origin;
|
|
29075
|
+
const look = async () => {
|
|
29076
|
+
const { found, error: discoveryError2 } = await candidates(options, mode);
|
|
29077
|
+
const asked = [{ origin: localOrigin, backend: options.local }];
|
|
29078
|
+
for (const candidate of found) if (!asked.some((a) => a.origin === candidate.origin)) asked.push({ ...candidate, backend: make(candidate.origin) });
|
|
29079
|
+
const owners = [];
|
|
29080
|
+
const refused2 = [];
|
|
29081
|
+
await Promise.all(asked.map(async ({ origin, backend, expected, machine_id: advertisedId }) => {
|
|
29082
|
+
try {
|
|
29083
|
+
const health = await backend.health({ timeoutMs: TIMEOUT_MS }).catch((error2) => {
|
|
29084
|
+
if (expected || advertisedId || target.machine_id) throw error2;
|
|
29085
|
+
return {};
|
|
29086
|
+
});
|
|
29087
|
+
const why = confirmed(health, expected, advertisedId);
|
|
29088
|
+
if (why) {
|
|
29089
|
+
refused2.push(`${origin}: ${why}`);
|
|
29090
|
+
return;
|
|
29091
|
+
}
|
|
29092
|
+
if (target.machine_id && health.machine_id !== target.machine_id) return;
|
|
29093
|
+
const machines = (await backend.list({ timeoutMs: TIMEOUT_MS })).machines;
|
|
29094
|
+
const record3 = target.name ? machines[target.name] : Object.values(machines).find((record4) => record4.kind === "durable" && (!record4.machine_id || record4.machine_id === target.machine_id));
|
|
29095
|
+
if (record3?.kind === "durable") {
|
|
29096
|
+
const recordId = text3(record3.machine_id), healthId = text3(health.machine_id);
|
|
29097
|
+
if (recordId && healthId && recordId !== healthId) {
|
|
29098
|
+
refused2.push(`${origin}: its durable record machine_id ${recordId} differs from /health machine_id ${healthId}`);
|
|
29099
|
+
return;
|
|
29100
|
+
}
|
|
29101
|
+
const machine_id = healthId || recordId;
|
|
29102
|
+
owners.push({ backend, origin, instance: machine_id && text3(health.instance) || record3.instance || machine, ...machine_id ? { machine_id } : {} });
|
|
29103
|
+
}
|
|
29104
|
+
} catch {
|
|
29105
|
+
}
|
|
29106
|
+
}));
|
|
29107
|
+
owners.sort((a, b) => Number(b.origin === localOrigin) - Number(a.origin === localOrigin));
|
|
29108
|
+
const identity = (owner) => owner.machine_id ? `${owner.machine_id}:${new URL(owner.origin).port || (new URL(owner.origin).protocol === "https:" ? "443" : "80")}` : owner.instance;
|
|
29109
|
+
const distinct2 = owners.filter((owner, index) => owners.findIndex((other) => identity(other) === identity(owner)) === index);
|
|
29110
|
+
return { distinct: distinct2, refused: refused2, discoveryError: discoveryError2 };
|
|
29111
|
+
};
|
|
29112
|
+
let { distinct, refused, discoveryError } = await look();
|
|
29113
|
+
if (!distinct.length && mode === "bonjour") {
|
|
29114
|
+
await new Promise((resolve11) => setTimeout(resolve11, options.secondLookMs ?? 2e3));
|
|
29115
|
+
({ distinct, refused, discoveryError } = await look());
|
|
29116
|
+
}
|
|
29117
|
+
if (distinct.length === 1) return distinct[0];
|
|
29118
|
+
if (distinct.length > 1) throw new Error(`Durable machine ${machine} is listed by more than one instance (${distinct.map((owner) => owner.origin).join(", ")}); nothing was acquired`);
|
|
29119
|
+
const hint = mode === "bonjour" ? "Check the name with `machctl list`; the Mac's machine-service must be bound to all interfaces to advertise itself, or set MACHINE_SERVICE_DISCOVERY=consul to use a Consul agent." : "Check the name with `machctl list`, and point CONSUL_HTTP_ADDR at a reachable Consul agent.";
|
|
29120
|
+
throw new Error(`No machine-service instance lists a durable machine ${target.name ? `named ${target.name}` : machine}${discoveryError ? `, and ${discoveryError}` : ""}${refused.length ? `; unconfirmed: ${refused.join("; ")}` : ""}; nothing was acquired. ${hint}`);
|
|
28878
29121
|
}
|
|
28879
29122
|
|
|
28880
29123
|
// src/capture-gate.ts
|
|
@@ -28920,6 +29163,15 @@ async function settleEach(work) {
|
|
|
28920
29163
|
const failed = (await Promise.allSettled(work)).find((result2) => result2.status === "rejected");
|
|
28921
29164
|
if (failed) throw failed.reason;
|
|
28922
29165
|
}
|
|
29166
|
+
function originUnavailable(error2) {
|
|
29167
|
+
if (!(error2 instanceof MachineServiceError) || error2.status !== void 0) return false;
|
|
29168
|
+
const seen = /* @__PURE__ */ new Set();
|
|
29169
|
+
for (let cause = error2; cause instanceof Error && !seen.has(cause); cause = cause.cause) {
|
|
29170
|
+
seen.add(cause);
|
|
29171
|
+
if (["ECONNREFUSED", "ECONNRESET", "EPIPE", "UND_ERR_SOCKET", "ETIMEDOUT", "EHOSTUNREACH", "ENETUNREACH", "UND_ERR_CONNECT_TIMEOUT"].includes(String(cause.code))) return true;
|
|
29172
|
+
}
|
|
29173
|
+
return false;
|
|
29174
|
+
}
|
|
28923
29175
|
var instructions = "This server offers fourteen tools for guests, machines that run the work you choose to run there: VMs from an image, or durable machines, real Macs named with `machine`: relay_search, relay_probe, relay_acquisition_capabilities, relay_acquire, relay_stage, the run tool relay_script, relay_image, relay_extract, relay_finish, relay_release, relay_console_resolve, relay_console_open, relay_console_cancel and relay_status. relay_script runs a shell, JavaScript, TypeScript or Python script, given inline or as a project file; a command is a shell script, and the script drives whatever the image lists, such as cua-driver, Playwright or Chrome DevTools, through their own libraries or command lines. Staging needs only Node.js in the guest, and a run takes before and after snapshots only when the image lists capture software (cua-driver). Evidence is automatic, and a run's after-image is returned as pending and downloaded in the background, so call relay_image with the imageId when you need to see it. Acquire one guest for each machine your work needs; several guests may run at once, up to the session's limit that relay_status reports. relay_acquire answers each guest's name, `guest`, and every call that acts on a guest names it with `guest`. Calls on different guests run at the same time; calls on one guest keep their order. Work each guest in order: relay_probe, then relay_acquire, then relay_stage, then relay_script, then relay_image or relay_extract as needed, then relay_finish or relay_release; finishing or releasing one guest leaves the others running. Always call relay_finish or relay_release explicitly for every guest before you return an answer; ending the session never finishes a guest: it pauses lease renewal and keeps the VMs or, where the relay is set up to, releases them, and the backend's own expiry is the last-resort safeguard. A refused, uncertain or nonzero operation keeps the VM so you can diagnose and submit a corrected operation; never replay input whose effect is uncertain. A tool result, an attached image or a verified evidence package, is evidence for a human reviewer, never the review itself. A durable machine is a real Mac on the home network, leased whole for one session: it is not isolated from the home network, a CI job may share its desktop, and its runs take snapshots only while its cua-driver daemon holds Screen Recording. The relay never targets its own host's display and offers no video or spawn API. Every tool's text result is capped at 50 KiB / 2000 lines; a larger result is retained whole in a local file the result names.";
|
|
28924
29176
|
var NO_OWNED_LEASE = "This session owns no lease: it holds no guest, so nothing was released. Each server process has its own session identity (a new random one unless MCP_RELAY_SESSION sets it); a lease acquired under another identity is not visible here. Restart the server with that MCP_RELAY_SESSION to reconcile and release it, or let the backend TTL expire it.";
|
|
28925
29177
|
var RelayManager = class {
|
|
@@ -28961,8 +29213,8 @@ var RelayManager = class {
|
|
|
28961
29213
|
/** Set once shutdown has paused the guests: no new acquisition or guest operation starts. */
|
|
28962
29214
|
shuttingDown = false;
|
|
28963
29215
|
/** The instance that owns a durable machine, found as machctl finds it (DC-29). */
|
|
28964
|
-
durableOwner(machine) {
|
|
28965
|
-
return findDurableOwner(machine, { local: this.vm, ...this.options.consul ? { consul: this.options.consul } : {}, ...this.options.durableBackend ? { backend: this.options.durableBackend } : {}, ...this.options.consulFetch ? { fetchJson: this.options.consulFetch } : {} });
|
|
29216
|
+
durableOwner(machine, machineId) {
|
|
29217
|
+
return (machineId ? findDurableOwnerById : findDurableOwner)(machineId ?? machine, { local: this.vm, ...this.options.discovery ? { mode: this.options.discovery } : {}, ...this.options.bonjourBrowse ? { browse: this.options.bonjourBrowse } : {}, ...this.options.consul ? { consul: this.options.consul } : {}, ...this.options.durableBackend ? { backend: this.options.durableBackend } : {}, ...this.options.consulFetch ? { fetchJson: this.options.consulFetch } : {} });
|
|
28966
29218
|
}
|
|
28967
29219
|
serialized(fn) {
|
|
28968
29220
|
const next = this.queue.then(fn, fn);
|
|
@@ -29092,7 +29344,7 @@ var RelayManager = class {
|
|
|
29092
29344
|
if (e.machine) return !!e.backend?.endpoint && !!e.backend.instance;
|
|
29093
29345
|
if (e.backend) {
|
|
29094
29346
|
const expected = this.binding();
|
|
29095
|
-
return Object.keys(e.backend).length === Object.keys(expected).length && Object.entries(expected).every(([
|
|
29347
|
+
return Object.keys(e.backend).length === Object.keys(expected).length && Object.entries(expected).every(([key2, value]) => e.backend[key2] === value);
|
|
29096
29348
|
}
|
|
29097
29349
|
return !this.environment && new URL(this.vm.baseUrl).origin === "http://localhost:6240" && this.tartHome === canonicalPath(join13(process.env.HOME ?? homedir4(), ".tart"));
|
|
29098
29350
|
}
|
|
@@ -29110,6 +29362,17 @@ var RelayManager = class {
|
|
|
29110
29362
|
}
|
|
29111
29363
|
}
|
|
29112
29364
|
/** Every guest the session holds, with its state; `active` is true while any guest's lease is being renewed. */
|
|
29365
|
+
/**
|
|
29366
|
+
* The status after reading the session's saved guests, host-only, so a
|
|
29367
|
+
* restarted relay reports what it still owns. A session with nothing saved
|
|
29368
|
+
* creates nothing, and a session it cannot load reports what it has in memory.
|
|
29369
|
+
*/
|
|
29370
|
+
async loadedStatus() {
|
|
29371
|
+
const saved = await Promise.all([join13(this.root, "guests"), join13(this.root, "lease.json")].map((path) => access(path).then(() => true, () => false)));
|
|
29372
|
+
if (saved.some(Boolean)) await this.load().catch(() => {
|
|
29373
|
+
});
|
|
29374
|
+
return this.status();
|
|
29375
|
+
}
|
|
29113
29376
|
status() {
|
|
29114
29377
|
const guests = [...this.guests.values()].map((guest2) => guest2.status());
|
|
29115
29378
|
return { active: guests.some((guest2) => guest2.active), guests, maxGuests: this.maxGuests };
|
|
@@ -29430,29 +29693,92 @@ var Guest = class {
|
|
|
29430
29693
|
const durable = !!this.enclosure?.machine;
|
|
29431
29694
|
return {
|
|
29432
29695
|
exec: async (name, argv, timeoutMs2 = 18e4, options) => {
|
|
29433
|
-
const result2 = await this.
|
|
29696
|
+
const result2 = await this.withOwner((backend) => backend.exec(this.enclosure?.machine ?? name, { argv, timeout: Math.ceil(timeoutMs2 / 1e3), ...identity() }, { timeoutMs: options?.timeoutMs ?? timeoutMs2 + 3e4, signal: options?.signal }), options);
|
|
29434
29697
|
return { stdout: result2.output, stderr: result2.output, code: result2.rc };
|
|
29435
29698
|
},
|
|
29436
29699
|
push: async (name, local_path, remote_path) => {
|
|
29437
29700
|
if (!durable) return this.vm.push(name, { local_path, remote_path, ...identity() });
|
|
29438
|
-
|
|
29439
|
-
return this.
|
|
29701
|
+
const bytes = await readFile9(local_path);
|
|
29702
|
+
return this.withOwner((backend) => {
|
|
29703
|
+
if (!backend.pushBytes) throw new Error("Backend lacks byte transfers; upgrade machine-service");
|
|
29704
|
+
return backend.pushBytes(this.enclosure.machine, { remote_path, bytes, ...identity() });
|
|
29705
|
+
});
|
|
29440
29706
|
},
|
|
29441
29707
|
pull: async (name, remote_path, local_path, options) => {
|
|
29442
29708
|
if (!durable) return this.vm.pull(name, { remote_path, local_path, ...identity() }, options);
|
|
29443
|
-
if (!this.vm.pullBytes) throw new Error("Backend lacks byte transfers; upgrade machine-service");
|
|
29444
29709
|
await rm5(local_path, { force: true });
|
|
29445
|
-
await this.
|
|
29710
|
+
await this.withOwner((backend) => {
|
|
29711
|
+
if (!backend.pullBytes) throw new Error("Backend lacks byte transfers; upgrade machine-service");
|
|
29712
|
+
return backend.pullBytes(this.enclosure.machine, { remote_path, to: local_path, ...identity() }, options);
|
|
29713
|
+
}, options);
|
|
29446
29714
|
return { vm: name, pulled: remote_path, to: local_path };
|
|
29447
29715
|
}
|
|
29448
29716
|
};
|
|
29449
29717
|
}
|
|
29450
|
-
/**
|
|
29451
|
-
async findOwner(e) {
|
|
29452
|
-
if (!e.machine || this.owner) return;
|
|
29453
|
-
|
|
29454
|
-
|
|
29455
|
-
|
|
29718
|
+
/** A saved machine ID survives renames; legacy ownership still requires its name and origin. */
|
|
29719
|
+
async findOwner(e, force = false) {
|
|
29720
|
+
if (!e.machine || this.owner && !force) return;
|
|
29721
|
+
try {
|
|
29722
|
+
const owner = await this.m.durableOwner(e.machine, e.backend?.machine_id);
|
|
29723
|
+
if (e.backend?.machine_id) {
|
|
29724
|
+
if (owner.machine_id !== e.backend.machine_id) throw new Error(`Durable owner machine_id mismatch; nothing was sent`);
|
|
29725
|
+
} else if (e.backend?.endpoint && (owner.origin !== e.backend.endpoint || owner.instance !== e.backend.instance)) {
|
|
29726
|
+
throw new Error(`Durable machine ${e.machine} is now listed by ${owner.origin} (${owner.instance}), not by ${e.backend.endpoint} (${e.backend.instance}) where this guest leased it; ownership retained, nothing was sent`);
|
|
29727
|
+
}
|
|
29728
|
+
this.owner = owner.backend;
|
|
29729
|
+
e.backend = { ...e.backend, endpoint: owner.origin, instance: owner.instance };
|
|
29730
|
+
await this.save();
|
|
29731
|
+
} catch (error2) {
|
|
29732
|
+
await this.unknownOwner(e, error2);
|
|
29733
|
+
}
|
|
29734
|
+
}
|
|
29735
|
+
async unknownOwner(e, cause) {
|
|
29736
|
+
this.owner = void 0;
|
|
29737
|
+
e.guestState = "unknown";
|
|
29738
|
+
const error2 = new Error(`Cannot confirm durable machine ${e.machine}: ${message(cause)}; ownership retained, guest state unknown`, { cause });
|
|
29739
|
+
e.lastError = error2.message;
|
|
29740
|
+
await this.save();
|
|
29741
|
+
throw error2;
|
|
29742
|
+
}
|
|
29743
|
+
/** Retry a durable request once after discovery confirms the saved machine ID. Acquisition never uses this. */
|
|
29744
|
+
async withOwner(operation, options = {}) {
|
|
29745
|
+
options.signal?.throwIfAborted();
|
|
29746
|
+
if (this.enclosure?.machine && !this.owner) await this.findOwner(this.enclosure);
|
|
29747
|
+
try {
|
|
29748
|
+
return await operation(this.vm);
|
|
29749
|
+
} catch (error2) {
|
|
29750
|
+
const e = this.enclosure;
|
|
29751
|
+
if (!e?.machine || !e.backend?.machine_id || options.signal?.aborted || !originUnavailable(error2)) throw error2;
|
|
29752
|
+
await this.findOwner(e, true);
|
|
29753
|
+
options.signal?.throwIfAborted();
|
|
29754
|
+
try {
|
|
29755
|
+
return await operation(this.vm);
|
|
29756
|
+
} catch (retryError) {
|
|
29757
|
+
if (!options.signal?.aborted && originUnavailable(retryError)) return this.unknownOwner(e, retryError);
|
|
29758
|
+
throw retryError;
|
|
29759
|
+
}
|
|
29760
|
+
}
|
|
29761
|
+
}
|
|
29762
|
+
/** A durable 404 proves nothing: rediscover and inspect the owner's inventory (DC-36). */
|
|
29763
|
+
async leaseRecord(e, options = {}) {
|
|
29764
|
+
const request = { timeoutMs: 1e4, ...options };
|
|
29765
|
+
try {
|
|
29766
|
+
try {
|
|
29767
|
+
const record3 = await this.withOwner((backend) => backend.get(e.machine ?? e.lease.vm, { ...request, ...e.machine ? { lease_id: e.lease?.lease_id } : {} }), request);
|
|
29768
|
+
if (e.machine && e.backend?.machine_id && record3.machine_id && record3.machine_id !== e.backend.machine_id) throw new Error("Durable owner machine_id mismatch");
|
|
29769
|
+
return record3;
|
|
29770
|
+
} catch (error2) {
|
|
29771
|
+
if (!e.machine || !(error2 instanceof MachineServiceError) || error2.status !== 404) throw error2;
|
|
29772
|
+
await this.findOwner(e, true);
|
|
29773
|
+
const records = Object.entries((await this.vm.list(request)).machines).filter(([name, record4]) => record4.kind === "durable" && (e.backend?.machine_id ? !record4.machine_id || record4.machine_id === e.backend.machine_id : name === e.machine));
|
|
29774
|
+
const record3 = records.length === 1 ? records[0][1] : void 0;
|
|
29775
|
+
if (!record3) throw new Error(`Cannot read the record of durable machine ${e.machine}`);
|
|
29776
|
+
return record3;
|
|
29777
|
+
}
|
|
29778
|
+
} catch (error2) {
|
|
29779
|
+
if (e.machine && !options.signal?.aborted) return this.unknownOwner(e, error2);
|
|
29780
|
+
throw error2;
|
|
29781
|
+
}
|
|
29456
29782
|
}
|
|
29457
29783
|
serialized(fn) {
|
|
29458
29784
|
const next = this.queue.then(fn, fn);
|
|
@@ -29509,14 +29835,14 @@ var Guest = class {
|
|
|
29509
29835
|
await this.findOwner(e);
|
|
29510
29836
|
e.backend ??= this.m.binding();
|
|
29511
29837
|
if (!e.lease) {
|
|
29512
|
-
const matches = Object.values((await this.
|
|
29838
|
+
const matches = Object.values((await this.withOwner((backend) => backend.list({ timeoutMs: 1e4 }))).machines).filter((v) => v.purpose === e.purpose);
|
|
29513
29839
|
if (matches.length !== 1) throw new Error(`Cannot reconcile acquisition for ${e.purpose}; ownership retained, never automatically reacquire`);
|
|
29514
29840
|
e.lease = matches[0];
|
|
29515
29841
|
e.acquisitionInFlight = false;
|
|
29516
29842
|
if (e.machine && e.lease.workspace) e.guestRoot = durableRoot(e.lease.workspace, e.purpose);
|
|
29517
29843
|
}
|
|
29518
29844
|
try {
|
|
29519
|
-
const lease = await this.
|
|
29845
|
+
const lease = await this.leaseRecord(e);
|
|
29520
29846
|
if (e.machine && lease.lease_id !== e.lease.lease_id) {
|
|
29521
29847
|
await this.m.registry.remove(e.row);
|
|
29522
29848
|
await jsonFile(`${e.hostRoot}.lifecycle.json`, { purpose: e.purpose, machine: e.machine, released: true, reason: "the durable machine no longer names this lease", finishedAt: (/* @__PURE__ */ new Date()).toISOString() });
|
|
@@ -29531,7 +29857,7 @@ var Guest = class {
|
|
|
29531
29857
|
lease.console = consoleStatus(lease.console);
|
|
29532
29858
|
if (lease.console.status === "revoked") e.consoleObservation = lease.console;
|
|
29533
29859
|
}
|
|
29534
|
-
e.lease = lease;
|
|
29860
|
+
e.lease = e.machine ? { ...lease, vm: e.machine } : lease;
|
|
29535
29861
|
e.guestState = lease.state;
|
|
29536
29862
|
e.expiresAt = lease.ttl_expires_at;
|
|
29537
29863
|
if (e.failed) {
|
|
@@ -29541,7 +29867,7 @@ var Guest = class {
|
|
|
29541
29867
|
await this.save();
|
|
29542
29868
|
} catch (error2) {
|
|
29543
29869
|
e.guestState = "unknown";
|
|
29544
|
-
if (error2 instanceof MachineServiceError && error2.status === 404 && await this.destroyed(e.lease.vm)) {
|
|
29870
|
+
if (!e.machine && error2 instanceof MachineServiceError && error2.status === 404 && await this.destroyed(e.lease.vm)) {
|
|
29545
29871
|
await this.m.registry.remove(e.row);
|
|
29546
29872
|
await jsonFile(`${e.hostRoot}.lifecycle.json`, { purpose: e.purpose, vm: e.lease.vm, released: true, reason: "backend lease absent and destruction verified", finishedAt: (/* @__PURE__ */ new Date()).toISOString() });
|
|
29547
29873
|
this.enclosure = void 0;
|
|
@@ -29581,7 +29907,7 @@ var Guest = class {
|
|
|
29581
29907
|
const tsx = checks[1], nodeVersion = /^v(\d+)\.(\d+)/.exec(String(checks[0].stdout ?? ""));
|
|
29582
29908
|
if (!tsx.ready && nodeVersion && (Number(nodeVersion[1]) > 22 || Number(nodeVersion[1]) === 22 && Number(nodeVersion[2]) >= 6)) Object.assign(tsx, { ready: true, runsWith: "Node.js type stripping" });
|
|
29583
29909
|
let software;
|
|
29584
|
-
if (e.machine) software = { machine: e.machine, software: (await this.
|
|
29910
|
+
if (e.machine) software = { machine: e.machine, software: (await this.leaseRecord(e)).capabilities?.software ?? null };
|
|
29585
29911
|
else try {
|
|
29586
29912
|
const catalog = await this.vm.applications({ timeoutMs: 1e4 });
|
|
29587
29913
|
validateCatalog(catalog);
|
|
@@ -29711,7 +30037,7 @@ var Guest = class {
|
|
|
29711
30037
|
const hostRoot = join13(this.m.options.outputRoot ?? resolve9(project, "relay-evidence"), purpose);
|
|
29712
30038
|
const subject = input.machine ?? input.image;
|
|
29713
30039
|
const row = { machine: owner ? `${input.machine} (durable, ${owner.origin}; ${purpose})` : environment ? `${environment.profile.vmServiceUrl} (${environment.profile.id}; ${purpose})` : `127.0.0.1 (machine-service ${purpose})`, os: owner ? "macos (durable)" : subject, taskName: purpose, agent: `mcp-relay ${this.m.options.sessionId}`, project: resolve9(project), startDate: stamp };
|
|
29714
|
-
const e = this.enclosure = { backend: owner ? { endpoint: owner.origin, instance: owner.instance } : this.m.binding(), purpose, task: input.task, image: subject, ...input.machine ? { machine: input.machine } : {}, project, startedAt, guestRoot: `/var/tmp/${stamp}-mcp-relay-${purpose}`, hostRoot, ttlHours, extractions: input.extractions, fullWorkspace: input.fullWorkspace ?? false, row, staged: false };
|
|
30040
|
+
const e = this.enclosure = { backend: owner ? { endpoint: owner.origin, instance: owner.instance, ...owner.machine_id ? { machine_id: owner.machine_id } : {} } : this.m.binding(), purpose, task: input.task, image: subject, ...input.machine ? { machine: input.machine } : {}, project, startedAt, guestRoot: `/var/tmp/${stamp}-mcp-relay-${purpose}`, hostRoot, ttlHours, extractions: input.extractions, fullWorkspace: input.fullWorkspace ?? false, row, staged: false };
|
|
29715
30041
|
if (owner) this.owner = owner.backend;
|
|
29716
30042
|
let refused = false;
|
|
29717
30043
|
try {
|
|
@@ -29737,7 +30063,12 @@ var Guest = class {
|
|
|
29737
30063
|
try {
|
|
29738
30064
|
const ttl_hours = Math.min(this.m.renewalWindowMs(), ttlHours * 36e5) / 36e5;
|
|
29739
30065
|
e.lease = await this.vm.acquire(input.machine ? { purpose, machine: input.machine, env: input.env ?? "none", ttl_hours } : { purpose, image: input.image, env: input.env ?? "none", ttl_hours, wait: true, network, ...input.vnc === void 0 ? {} : { vnc: input.vnc } }, { signal });
|
|
29740
|
-
if (e.machine)
|
|
30066
|
+
if (e.machine) {
|
|
30067
|
+
e.lease.vm = e.machine;
|
|
30068
|
+
if (e.backend?.machine_id && e.lease.machine_id && e.lease.machine_id !== e.backend.machine_id) await this.unknownOwner(e, new Error("Durable owner machine_id mismatch"));
|
|
30069
|
+
e.backend.machine_id ??= e.lease.machine_id;
|
|
30070
|
+
e.guestRoot = durableRoot(e.lease.workspace, purpose);
|
|
30071
|
+
}
|
|
29741
30072
|
e.acquisitionInFlight = false;
|
|
29742
30073
|
granted = asked;
|
|
29743
30074
|
break;
|
|
@@ -29868,7 +30199,7 @@ Guest ${this.name} keeps this acquisition's ownership record: name it to reconci
|
|
|
29868
30199
|
}
|
|
29869
30200
|
this.assertBinding();
|
|
29870
30201
|
await this.m.assertBackend();
|
|
29871
|
-
const renewed = await this.
|
|
30202
|
+
const renewed = await this.withOwner((backend) => backend.heartbeat(e.machine ?? lease.vm, { ttl_hours: Math.min(this.m.renewalWindowMs(), remaining) / 36e5, ...lease.lease_id ? { lease_id: lease.lease_id } : {} }, { timeoutMs: 1e4 }));
|
|
29872
30203
|
if (this.enclosure !== e || e.released) return;
|
|
29873
30204
|
e.expiresAt = renewed.ttl_expires_at;
|
|
29874
30205
|
e.guestState = renewed.state;
|
|
@@ -29986,7 +30317,7 @@ VM state: ${JSON.stringify(this.status())}`, { cause: error2 });
|
|
|
29986
30317
|
* Recording (DC-32).
|
|
29987
30318
|
*/
|
|
29988
30319
|
async durableCapture(e, cuaDriver, signal) {
|
|
29989
|
-
const software = (await this.
|
|
30320
|
+
const software = (await this.leaseRecord(e, { signal })).capabilities?.software;
|
|
29990
30321
|
let answer;
|
|
29991
30322
|
if (software && typeof software === "object" && software.cua_driver) {
|
|
29992
30323
|
try {
|
|
@@ -30097,7 +30428,7 @@ VM state: ${JSON.stringify(this.status())}`, { cause: error2 });
|
|
|
30097
30428
|
return new ImageStore({
|
|
30098
30429
|
owner: this.m.options.sessionId,
|
|
30099
30430
|
enclosure: e.purpose,
|
|
30100
|
-
backend: e.backend,
|
|
30431
|
+
backend: e.machine && e.backend?.machine_id ? { machine_id: e.backend.machine_id } : e.backend,
|
|
30101
30432
|
catalogRoot: join13(this.m.root, "image-catalog", e.purpose),
|
|
30102
30433
|
hostRoot: e.hostRoot,
|
|
30103
30434
|
guestRoot: e.guestRoot,
|
|
@@ -30112,7 +30443,7 @@ VM state: ${JSON.stringify(this.status())}`, { cause: error2 });
|
|
|
30112
30443
|
if (!health.ok || !matchesEnvironment(health.environment, this.m.environment)) throw Object.assign(new Error("Selected backend identity changed."), { code: "unauthorized-reference" });
|
|
30113
30444
|
}
|
|
30114
30445
|
try {
|
|
30115
|
-
const lease = await this.
|
|
30446
|
+
const lease = await this.leaseRecord(e, options);
|
|
30116
30447
|
if (lease.purpose !== e.purpose || e.lease.lease_id && lease.lease_id !== e.lease.lease_id) throw Object.assign(new Error("Lease ownership identity changed."), { code: "unauthorized-reference" });
|
|
30117
30448
|
} catch (error2) {
|
|
30118
30449
|
if (error2 instanceof MachineServiceError && error2.status === 404) throw Object.assign(new Error("Saved image guest is no longer available."), { code: "stale-reference" });
|
|
@@ -30205,9 +30536,9 @@ VM state: ${JSON.stringify(this.status())}`, { cause: error2 });
|
|
|
30205
30536
|
} catch (error2) {
|
|
30206
30537
|
const transient2 = !bounded3.aborted && transientTransfer(error2);
|
|
30207
30538
|
if (attempt >= 3 || !transient2) return { status: transient2 || bounded3.aborted ? "transfer-failed" : "integrity-failed", diagnostic: `Step evidence download failed: ${String(error2)}` };
|
|
30208
|
-
const
|
|
30539
|
+
const wait2 = retryDelaysMs[attempt - 1] ?? 0;
|
|
30209
30540
|
await new Promise((done) => {
|
|
30210
|
-
const timer = setTimeout(done,
|
|
30541
|
+
const timer = setTimeout(done, wait2);
|
|
30211
30542
|
bounded3.addEventListener("abort", () => {
|
|
30212
30543
|
clearTimeout(timer);
|
|
30213
30544
|
done();
|
|
@@ -30244,8 +30575,8 @@ VM state: ${JSON.stringify(this.status())}`, { cause: error2 });
|
|
|
30244
30575
|
} catch {
|
|
30245
30576
|
continue;
|
|
30246
30577
|
}
|
|
30247
|
-
const
|
|
30248
|
-
copies.set(
|
|
30578
|
+
const key2 = `${file.sha256}:${file.bytes}`;
|
|
30579
|
+
copies.set(key2, [...copies.get(key2) ?? [], path]);
|
|
30249
30580
|
}
|
|
30250
30581
|
}
|
|
30251
30582
|
return copies;
|
|
@@ -30254,8 +30585,8 @@ VM state: ${JSON.stringify(this.status())}`, { cause: error2 });
|
|
|
30254
30585
|
async localState(recording) {
|
|
30255
30586
|
const held = await this.imageStore().heldOriginals(recording), steps = await this.stepCopies(recording, "state/");
|
|
30256
30587
|
return { root: recording, candidates: (file) => {
|
|
30257
|
-
const
|
|
30258
|
-
return [join13(recording, "state", file.path), ...steps.get(
|
|
30588
|
+
const key2 = `${file.sha256}:${file.bytes}`, receipt = /^receiver\/receipts\/([^/]+\.json)$/.exec(file.path)?.[1];
|
|
30589
|
+
return [join13(recording, "state", file.path), ...steps.get(key2) ?? [], ...receipt ? [join13(recording, "host", "receiver-receipts", receipt)] : [], ...held.get(key2) ?? []];
|
|
30259
30590
|
} };
|
|
30260
30591
|
}
|
|
30261
30592
|
/** AD-7: the step folders are a staging area; once their files are in the recording's state they go. */
|
|
@@ -30503,11 +30834,12 @@ VM state: ${JSON.stringify(this.status())}`, { cause: error2 });
|
|
|
30503
30834
|
this.stopTimer();
|
|
30504
30835
|
if (!e.released) {
|
|
30505
30836
|
if (!e.lease) {
|
|
30506
|
-
const list = await this.
|
|
30837
|
+
const list = await this.withOwner((backend) => backend.list({ timeoutMs: 1e4 }));
|
|
30507
30838
|
const matches = Object.values(list.machines).filter((lease) => lease.purpose === e.purpose);
|
|
30508
30839
|
if (matches.length > 1) throw new Error("Ambiguous acquisition; refusing to remove ownership record");
|
|
30509
30840
|
if (!matches.length && e.acquisitionInFlight) throw new Error(`Acquire outcome still indeterminate for ${e.purpose}; ownership record retained at ${this.dir}. Reconcile before retrying; never blindly acquire again.`);
|
|
30510
30841
|
e.lease = matches[0];
|
|
30842
|
+
if (e.machine && e.lease) e.lease.vm = e.machine;
|
|
30511
30843
|
await this.save().catch(() => {
|
|
30512
30844
|
});
|
|
30513
30845
|
}
|
|
@@ -30515,7 +30847,7 @@ VM state: ${JSON.stringify(this.status())}`, { cause: error2 });
|
|
|
30515
30847
|
let released = false;
|
|
30516
30848
|
for (let attempt = 0; attempt < attempts; attempt++) {
|
|
30517
30849
|
try {
|
|
30518
|
-
const response = await this.
|
|
30850
|
+
const response = await this.withOwner((backend) => backend.release(e.machine ?? e.lease.vm, { reason: reason2, ...e.lease.lease_id ? { lease_id: e.lease.lease_id } : {} }, { timeoutMs: timeoutMs2 }));
|
|
30519
30851
|
if (!response.released) throw new Error("machine-service did not confirm destruction");
|
|
30520
30852
|
if (e.machine) {
|
|
30521
30853
|
e.hygiene = response.hygiene;
|
|
@@ -30527,16 +30859,20 @@ VM state: ${JSON.stringify(this.status())}`, { cause: error2 });
|
|
|
30527
30859
|
} catch (error2) {
|
|
30528
30860
|
await this.log("release-error", void 0, { vm: e.lease.vm, cause: reason2, attempt: attempt + 1, error: String(error2) }).catch(() => {
|
|
30529
30861
|
});
|
|
30530
|
-
|
|
30531
|
-
|
|
30532
|
-
if (
|
|
30862
|
+
if (e.machine) {
|
|
30863
|
+
if (error2 instanceof MachineServiceError && error2.status === 404) await this.findOwner(e, true);
|
|
30864
|
+
if (await this.durableReleased(e)) {
|
|
30533
30865
|
released = true;
|
|
30534
30866
|
break;
|
|
30535
30867
|
}
|
|
30536
|
-
}
|
|
30537
|
-
|
|
30538
|
-
|
|
30539
|
-
|
|
30868
|
+
} else {
|
|
30869
|
+
try {
|
|
30870
|
+
await this.vm.get(e.lease.vm, { timeoutMs: 5e3 });
|
|
30871
|
+
} catch (getError) {
|
|
30872
|
+
if (getError instanceof MachineServiceError && getError.status === 404) {
|
|
30873
|
+
released = true;
|
|
30874
|
+
break;
|
|
30875
|
+
}
|
|
30540
30876
|
}
|
|
30541
30877
|
}
|
|
30542
30878
|
if (attempt === attempts - 1) throw error2;
|
|
@@ -30563,7 +30899,7 @@ VM state: ${JSON.stringify(this.status())}`, { cause: error2 });
|
|
|
30563
30899
|
}
|
|
30564
30900
|
/** A durable release is verified when the machine no longer names the lease (DC-33). */
|
|
30565
30901
|
async durableReleased(e) {
|
|
30566
|
-
return (await this.
|
|
30902
|
+
return (await this.leaseRecord(e)).lease_id !== e.lease.lease_id;
|
|
30567
30903
|
}
|
|
30568
30904
|
async destroyed(vm) {
|
|
30569
30905
|
if (this.m.options.verifyDestroyed) return this.m.options.verifyDestroyed(vm);
|
|
@@ -30597,7 +30933,7 @@ VM state: ${JSON.stringify(this.status())}`, { cause: error2 });
|
|
|
30597
30933
|
const remaining = this.remainingMs(e);
|
|
30598
30934
|
if (remaining < MIN_RENEWAL_MS) return;
|
|
30599
30935
|
try {
|
|
30600
|
-
const renewed = await this.
|
|
30936
|
+
const renewed = await this.withOwner((backend) => backend.heartbeat(e.machine ?? e.lease.vm, { ttl_hours: remaining / 36e5, ...e.lease.lease_id ? { lease_id: e.lease.lease_id } : {} }, { timeoutMs: 1e4 }));
|
|
30601
30937
|
if (this.enclosure === e && !e.released) {
|
|
30602
30938
|
e.expiresAt = renewed.ttl_expires_at;
|
|
30603
30939
|
e.guestState = renewed.state;
|
|
@@ -30672,10 +31008,10 @@ var relayContract = typebox_exports.Union([
|
|
|
30672
31008
|
]);
|
|
30673
31009
|
var projected = {};
|
|
30674
31010
|
for (const branch of relayContract.anyOf) {
|
|
30675
|
-
for (const [
|
|
30676
|
-
if (
|
|
30677
|
-
const previous = projected[
|
|
30678
|
-
projected[
|
|
31011
|
+
for (const [key2, schema] of Object.entries(branch.properties)) {
|
|
31012
|
+
if (key2 === "action") continue;
|
|
31013
|
+
const previous = projected[key2];
|
|
31014
|
+
projected[key2] = previous && JSON.stringify(previous) !== JSON.stringify(schema) ? typebox_exports.Optional(typebox_exports.Union([previous, schema])) : typebox_exports.Optional(schema);
|
|
30679
31015
|
}
|
|
30680
31016
|
}
|
|
30681
31017
|
var parameterObject = typebox_exports.Object({
|
|
@@ -30691,7 +31027,7 @@ function branchFor(action) {
|
|
|
30691
31027
|
function toolInputSchema(action) {
|
|
30692
31028
|
const raw = JSON.parse(JSON.stringify(branchFor(action)));
|
|
30693
31029
|
const { action: _action, ...properties } = raw.properties;
|
|
30694
|
-
const required2 = (raw.required ?? []).filter((
|
|
31030
|
+
const required2 = (raw.required ?? []).filter((key2) => key2 !== "action");
|
|
30695
31031
|
return { type: raw.type, properties, ...required2.length ? { required: required2 } : {}, additionalProperties: raw.additionalProperties ?? false };
|
|
30696
31032
|
}
|
|
30697
31033
|
function validateRelayInput(value) {
|
|
@@ -30902,7 +31238,7 @@ async function relayCall(host, raw, options = {}) {
|
|
|
30902
31238
|
|
|
30903
31239
|
// src/server.ts
|
|
30904
31240
|
var SERVER_NAME = "relay";
|
|
30905
|
-
var SERVER_VERSION = true ? "0.
|
|
31241
|
+
var SERVER_VERSION = true ? "0.19.0" : JSON.parse(readFileSync(fileURLToPath(new URL("../package.json", import.meta.url)), "utf8")).version;
|
|
30906
31242
|
var STATUS_TOOL = "relay_status";
|
|
30907
31243
|
var PLUGIN_TOOL_PREFIX = "mcp__plugin_mcp-relay_relay__";
|
|
30908
31244
|
var message2 = (error2) => error2 instanceof Error ? error2.message : String(error2);
|
|
@@ -30944,10 +31280,11 @@ function createRelayServer(options = {}) {
|
|
|
30944
31280
|
}
|
|
30945
31281
|
return manager;
|
|
30946
31282
|
});
|
|
30947
|
-
const statusPayload = () => {
|
|
31283
|
+
const statusPayload = async () => {
|
|
30948
31284
|
const environment = selectedEnvironment();
|
|
30949
31285
|
const service = environment?.profile.vmServiceUrl ?? process.env.MCP_RELAY_URL ?? "http://localhost:6240";
|
|
30950
|
-
|
|
31286
|
+
const owned = get();
|
|
31287
|
+
return { ...await owned.loadedStatus(), project, service, environment: environment?.identity };
|
|
30951
31288
|
};
|
|
30952
31289
|
const shutdownController = new AbortController();
|
|
30953
31290
|
const server = new Server({ name: SERVER_NAME, version: SERVER_VERSION }, { capabilities: { tools: {} }, instructions });
|
|
@@ -30955,7 +31292,7 @@ function createRelayServer(options = {}) {
|
|
|
30955
31292
|
server.setRequestHandler(CallToolRequestSchema, async (request, extra) => {
|
|
30956
31293
|
const { name, arguments: args } = request.params;
|
|
30957
31294
|
try {
|
|
30958
|
-
if (name === STATUS_TOOL) return text4(JSON.stringify(statusPayload(), null, 2));
|
|
31295
|
+
if (name === STATUS_TOOL) return text4(JSON.stringify(await statusPayload(), null, 2));
|
|
30959
31296
|
if (relayTools.some((tool) => tool.name === name)) return relayContent(await relayCall(get, relayToolInput(name, args ?? {}), { signal: AbortSignal.any([extra.signal, shutdownController.signal]), toolCallId: String(extra.requestId) }));
|
|
30960
31297
|
throw new Error(`Unknown tool: ${name}`);
|
|
30961
31298
|
} catch (error2) {
|