@chosengeneration/light-code 0.179.0 → 0.180.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/dist/cli.cjs +970 -775
- package/dist/server.cjs +965 -770
- package/package.json +1 -1
package/dist/server.cjs
CHANGED
|
@@ -3425,9 +3425,9 @@ var require_util2 = __commonJS({
|
|
|
3425
3425
|
}
|
|
3426
3426
|
const strongest = getStrongestMetadata(parsedMetadata);
|
|
3427
3427
|
const metadata = filterMetadataListByAlgorithm(parsedMetadata, strongest);
|
|
3428
|
-
for (const
|
|
3429
|
-
const algorithm =
|
|
3430
|
-
const expectedValue =
|
|
3428
|
+
for (const item2 of metadata) {
|
|
3429
|
+
const algorithm = item2.algo;
|
|
3430
|
+
const expectedValue = item2.hash;
|
|
3431
3431
|
let actualValue = crypto8.createHash(algorithm).update(bytes).digest("base64");
|
|
3432
3432
|
if (actualValue[actualValue.length - 1] === "=") {
|
|
3433
3433
|
if (actualValue[actualValue.length - 2] === "=") {
|
|
@@ -8188,12 +8188,12 @@ var require_pool_base = __commonJS({
|
|
|
8188
8188
|
const queue = pool[kQueue];
|
|
8189
8189
|
let needDrain = false;
|
|
8190
8190
|
while (!needDrain) {
|
|
8191
|
-
const
|
|
8192
|
-
if (!
|
|
8191
|
+
const item2 = queue.shift();
|
|
8192
|
+
if (!item2) {
|
|
8193
8193
|
break;
|
|
8194
8194
|
}
|
|
8195
8195
|
pool[kQueued]--;
|
|
8196
|
-
needDrain = !this.dispatch(
|
|
8196
|
+
needDrain = !this.dispatch(item2.opts, item2.handler);
|
|
8197
8197
|
}
|
|
8198
8198
|
this[kNeedDrain] = needDrain;
|
|
8199
8199
|
if (!this[kNeedDrain] && pool[kNeedDrain]) {
|
|
@@ -8259,11 +8259,11 @@ var require_pool_base = __commonJS({
|
|
|
8259
8259
|
}
|
|
8260
8260
|
async [kDestroy](err) {
|
|
8261
8261
|
while (true) {
|
|
8262
|
-
const
|
|
8263
|
-
if (!
|
|
8262
|
+
const item2 = this[kQueue].shift();
|
|
8263
|
+
if (!item2) {
|
|
8264
8264
|
break;
|
|
8265
8265
|
}
|
|
8266
|
-
|
|
8266
|
+
item2.handler.onError(err);
|
|
8267
8267
|
}
|
|
8268
8268
|
return Promise.all(this[kClients].map((c2) => c2.destroy(err)));
|
|
8269
8269
|
}
|
|
@@ -16826,8 +16826,8 @@ var require_code = __commonJS({
|
|
|
16826
16826
|
emptyStr() {
|
|
16827
16827
|
if (this._items.length > 1)
|
|
16828
16828
|
return false;
|
|
16829
|
-
const
|
|
16830
|
-
return
|
|
16829
|
+
const item2 = this._items[0];
|
|
16830
|
+
return item2 === "" || item2 === '""';
|
|
16831
16831
|
}
|
|
16832
16832
|
get str() {
|
|
16833
16833
|
var _a3;
|
|
@@ -17816,57 +17816,57 @@ var require_util8 = __commonJS({
|
|
|
17816
17816
|
var code_1 = require_code();
|
|
17817
17817
|
function toHash(arr) {
|
|
17818
17818
|
const hash3 = {};
|
|
17819
|
-
for (const
|
|
17820
|
-
hash3[
|
|
17819
|
+
for (const item2 of arr)
|
|
17820
|
+
hash3[item2] = true;
|
|
17821
17821
|
return hash3;
|
|
17822
17822
|
}
|
|
17823
17823
|
exports2.toHash = toHash;
|
|
17824
|
-
function alwaysValidSchema(it,
|
|
17825
|
-
if (typeof
|
|
17826
|
-
return
|
|
17827
|
-
if (Object.keys(
|
|
17824
|
+
function alwaysValidSchema(it, schema11) {
|
|
17825
|
+
if (typeof schema11 == "boolean")
|
|
17826
|
+
return schema11;
|
|
17827
|
+
if (Object.keys(schema11).length === 0)
|
|
17828
17828
|
return true;
|
|
17829
|
-
checkUnknownRules(it,
|
|
17830
|
-
return !schemaHasRules(
|
|
17829
|
+
checkUnknownRules(it, schema11);
|
|
17830
|
+
return !schemaHasRules(schema11, it.self.RULES.all);
|
|
17831
17831
|
}
|
|
17832
17832
|
exports2.alwaysValidSchema = alwaysValidSchema;
|
|
17833
|
-
function checkUnknownRules(it,
|
|
17833
|
+
function checkUnknownRules(it, schema11 = it.schema) {
|
|
17834
17834
|
const { opts, self } = it;
|
|
17835
17835
|
if (!opts.strictSchema)
|
|
17836
17836
|
return;
|
|
17837
|
-
if (typeof
|
|
17837
|
+
if (typeof schema11 === "boolean")
|
|
17838
17838
|
return;
|
|
17839
17839
|
const rules = self.RULES.keywords;
|
|
17840
|
-
for (const key3 in
|
|
17840
|
+
for (const key3 in schema11) {
|
|
17841
17841
|
if (!rules[key3])
|
|
17842
17842
|
checkStrictMode(it, `unknown keyword: "${key3}"`);
|
|
17843
17843
|
}
|
|
17844
17844
|
}
|
|
17845
17845
|
exports2.checkUnknownRules = checkUnknownRules;
|
|
17846
|
-
function schemaHasRules(
|
|
17847
|
-
if (typeof
|
|
17848
|
-
return !
|
|
17849
|
-
for (const key3 in
|
|
17846
|
+
function schemaHasRules(schema11, rules) {
|
|
17847
|
+
if (typeof schema11 == "boolean")
|
|
17848
|
+
return !schema11;
|
|
17849
|
+
for (const key3 in schema11)
|
|
17850
17850
|
if (rules[key3])
|
|
17851
17851
|
return true;
|
|
17852
17852
|
return false;
|
|
17853
17853
|
}
|
|
17854
17854
|
exports2.schemaHasRules = schemaHasRules;
|
|
17855
|
-
function schemaHasRulesButRef(
|
|
17856
|
-
if (typeof
|
|
17857
|
-
return !
|
|
17858
|
-
for (const key3 in
|
|
17855
|
+
function schemaHasRulesButRef(schema11, RULES) {
|
|
17856
|
+
if (typeof schema11 == "boolean")
|
|
17857
|
+
return !schema11;
|
|
17858
|
+
for (const key3 in schema11)
|
|
17859
17859
|
if (key3 !== "$ref" && RULES.all[key3])
|
|
17860
17860
|
return true;
|
|
17861
17861
|
return false;
|
|
17862
17862
|
}
|
|
17863
17863
|
exports2.schemaHasRulesButRef = schemaHasRulesButRef;
|
|
17864
|
-
function schemaRefOrVal({ topSchemaRef, schemaPath },
|
|
17864
|
+
function schemaRefOrVal({ topSchemaRef, schemaPath }, schema11, keyword, $data) {
|
|
17865
17865
|
if (!$data) {
|
|
17866
|
-
if (typeof
|
|
17867
|
-
return
|
|
17868
|
-
if (typeof
|
|
17869
|
-
return (0, codegen_1._)`${
|
|
17866
|
+
if (typeof schema11 == "number" || typeof schema11 == "boolean")
|
|
17867
|
+
return schema11;
|
|
17868
|
+
if (typeof schema11 == "string")
|
|
17869
|
+
return (0, codegen_1._)`${schema11}`;
|
|
17870
17870
|
}
|
|
17871
17871
|
return (0, codegen_1._)`${topSchemaRef}${schemaPath}${(0, codegen_1.getProperty)(keyword)}`;
|
|
17872
17872
|
}
|
|
@@ -18147,10 +18147,10 @@ var require_boolSchema = __commonJS({
|
|
|
18147
18147
|
message: "boolean schema is false"
|
|
18148
18148
|
};
|
|
18149
18149
|
function topBoolOrEmptySchema(it) {
|
|
18150
|
-
const { gen, schema:
|
|
18151
|
-
if (
|
|
18150
|
+
const { gen, schema: schema11, validateName } = it;
|
|
18151
|
+
if (schema11 === false) {
|
|
18152
18152
|
falseSchemaError(it, false);
|
|
18153
|
-
} else if (typeof
|
|
18153
|
+
} else if (typeof schema11 == "object" && schema11.$async === true) {
|
|
18154
18154
|
gen.return(names_1.default.data);
|
|
18155
18155
|
} else {
|
|
18156
18156
|
gen.assign((0, codegen_1._)`${validateName}.errors`, null);
|
|
@@ -18159,8 +18159,8 @@ var require_boolSchema = __commonJS({
|
|
|
18159
18159
|
}
|
|
18160
18160
|
exports2.topBoolOrEmptySchema = topBoolOrEmptySchema;
|
|
18161
18161
|
function boolOrEmptySchema(it, valid) {
|
|
18162
|
-
const { gen, schema:
|
|
18163
|
-
if (
|
|
18162
|
+
const { gen, schema: schema11 } = it;
|
|
18163
|
+
if (schema11 === false) {
|
|
18164
18164
|
gen.var(valid, false);
|
|
18165
18165
|
falseSchemaError(it);
|
|
18166
18166
|
} else {
|
|
@@ -18222,18 +18222,18 @@ var require_applicability = __commonJS({
|
|
|
18222
18222
|
"use strict";
|
|
18223
18223
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
18224
18224
|
exports2.shouldUseRule = exports2.shouldUseGroup = exports2.schemaHasRulesForType = void 0;
|
|
18225
|
-
function schemaHasRulesForType({ schema:
|
|
18225
|
+
function schemaHasRulesForType({ schema: schema11, self }, type) {
|
|
18226
18226
|
const group = self.RULES.types[type];
|
|
18227
|
-
return group && group !== true && shouldUseGroup(
|
|
18227
|
+
return group && group !== true && shouldUseGroup(schema11, group);
|
|
18228
18228
|
}
|
|
18229
18229
|
exports2.schemaHasRulesForType = schemaHasRulesForType;
|
|
18230
|
-
function shouldUseGroup(
|
|
18231
|
-
return group.rules.some((rule) => shouldUseRule(
|
|
18230
|
+
function shouldUseGroup(schema11, group) {
|
|
18231
|
+
return group.rules.some((rule) => shouldUseRule(schema11, rule));
|
|
18232
18232
|
}
|
|
18233
18233
|
exports2.shouldUseGroup = shouldUseGroup;
|
|
18234
|
-
function shouldUseRule(
|
|
18234
|
+
function shouldUseRule(schema11, rule) {
|
|
18235
18235
|
var _a3;
|
|
18236
|
-
return
|
|
18236
|
+
return schema11[rule.keyword] !== void 0 || ((_a3 = rule.definition.implements) === null || _a3 === void 0 ? void 0 : _a3.some((kwd) => schema11[kwd] !== void 0));
|
|
18237
18237
|
}
|
|
18238
18238
|
exports2.shouldUseRule = shouldUseRule;
|
|
18239
18239
|
}
|
|
@@ -18255,17 +18255,17 @@ var require_dataType = __commonJS({
|
|
|
18255
18255
|
DataType2[DataType2["Correct"] = 0] = "Correct";
|
|
18256
18256
|
DataType2[DataType2["Wrong"] = 1] = "Wrong";
|
|
18257
18257
|
})(DataType || (exports2.DataType = DataType = {}));
|
|
18258
|
-
function getSchemaTypes(
|
|
18259
|
-
const types = getJSONTypes(
|
|
18258
|
+
function getSchemaTypes(schema11) {
|
|
18259
|
+
const types = getJSONTypes(schema11.type);
|
|
18260
18260
|
const hasNull = types.includes("null");
|
|
18261
18261
|
if (hasNull) {
|
|
18262
|
-
if (
|
|
18262
|
+
if (schema11.nullable === false)
|
|
18263
18263
|
throw new Error("type: null contradicts nullable: false");
|
|
18264
18264
|
} else {
|
|
18265
|
-
if (!types.length &&
|
|
18265
|
+
if (!types.length && schema11.nullable !== void 0) {
|
|
18266
18266
|
throw new Error('"nullable" cannot be used without "type"');
|
|
18267
18267
|
}
|
|
18268
|
-
if (
|
|
18268
|
+
if (schema11.nullable === true)
|
|
18269
18269
|
types.push("null");
|
|
18270
18270
|
}
|
|
18271
18271
|
return types;
|
|
@@ -18397,8 +18397,8 @@ var require_dataType = __commonJS({
|
|
|
18397
18397
|
}
|
|
18398
18398
|
exports2.checkDataTypes = checkDataTypes;
|
|
18399
18399
|
var typeError = {
|
|
18400
|
-
message: ({ schema:
|
|
18401
|
-
params: ({ schema:
|
|
18400
|
+
message: ({ schema: schema11 }) => `must be ${schema11}`,
|
|
18401
|
+
params: ({ schema: schema11, schemaValue }) => typeof schema11 == "string" ? (0, codegen_1._)`{type: ${schema11}}` : (0, codegen_1._)`{type: ${schemaValue}}`
|
|
18402
18402
|
};
|
|
18403
18403
|
function reportTypeError(it) {
|
|
18404
18404
|
const cxt = getTypeErrorContext(it);
|
|
@@ -18406,16 +18406,16 @@ var require_dataType = __commonJS({
|
|
|
18406
18406
|
}
|
|
18407
18407
|
exports2.reportTypeError = reportTypeError;
|
|
18408
18408
|
function getTypeErrorContext(it) {
|
|
18409
|
-
const { gen, data, schema:
|
|
18410
|
-
const schemaCode = (0, util_1.schemaRefOrVal)(it,
|
|
18409
|
+
const { gen, data, schema: schema11 } = it;
|
|
18410
|
+
const schemaCode = (0, util_1.schemaRefOrVal)(it, schema11, "type");
|
|
18411
18411
|
return {
|
|
18412
18412
|
gen,
|
|
18413
18413
|
keyword: "type",
|
|
18414
18414
|
data,
|
|
18415
|
-
schema:
|
|
18415
|
+
schema: schema11.type,
|
|
18416
18416
|
schemaCode,
|
|
18417
18417
|
schemaValue: schemaCode,
|
|
18418
|
-
parentSchema:
|
|
18418
|
+
parentSchema: schema11,
|
|
18419
18419
|
params: {},
|
|
18420
18420
|
it
|
|
18421
18421
|
};
|
|
@@ -18568,15 +18568,15 @@ var require_code2 = __commonJS({
|
|
|
18568
18568
|
}
|
|
18569
18569
|
exports2.validateArray = validateArray;
|
|
18570
18570
|
function validateUnion(cxt) {
|
|
18571
|
-
const { gen, schema:
|
|
18572
|
-
if (!Array.isArray(
|
|
18571
|
+
const { gen, schema: schema11, keyword, it } = cxt;
|
|
18572
|
+
if (!Array.isArray(schema11))
|
|
18573
18573
|
throw new Error("ajv implementation error");
|
|
18574
|
-
const alwaysValid =
|
|
18574
|
+
const alwaysValid = schema11.some((sch) => (0, util_1.alwaysValidSchema)(it, sch));
|
|
18575
18575
|
if (alwaysValid && !it.opts.unevaluated)
|
|
18576
18576
|
return;
|
|
18577
18577
|
const valid = gen.let("valid", false);
|
|
18578
18578
|
const schValid = gen.name("_valid");
|
|
18579
|
-
gen.block(() =>
|
|
18579
|
+
gen.block(() => schema11.forEach((_sch, i) => {
|
|
18580
18580
|
const schCxt = cxt.subschema({
|
|
18581
18581
|
keyword,
|
|
18582
18582
|
schemaProp: i,
|
|
@@ -18604,8 +18604,8 @@ var require_keyword = __commonJS({
|
|
|
18604
18604
|
var code_1 = require_code2();
|
|
18605
18605
|
var errors_1 = require_errors2();
|
|
18606
18606
|
function macroKeywordCode(cxt, def) {
|
|
18607
|
-
const { gen, keyword, schema:
|
|
18608
|
-
const macroSchema2 = def.macro.call(it.self,
|
|
18607
|
+
const { gen, keyword, schema: schema11, parentSchema, it } = cxt;
|
|
18608
|
+
const macroSchema2 = def.macro.call(it.self, schema11, parentSchema, it);
|
|
18609
18609
|
const schemaRef = useKeyword(gen, keyword, macroSchema2);
|
|
18610
18610
|
if (it.opts.validateSchema !== false)
|
|
18611
18611
|
it.self.validateSchema(macroSchema2, true);
|
|
@@ -18622,9 +18622,9 @@ var require_keyword = __commonJS({
|
|
|
18622
18622
|
exports2.macroKeywordCode = macroKeywordCode;
|
|
18623
18623
|
function funcKeywordCode(cxt, def) {
|
|
18624
18624
|
var _a3;
|
|
18625
|
-
const { gen, keyword, schema:
|
|
18625
|
+
const { gen, keyword, schema: schema11, parentSchema, $data, it } = cxt;
|
|
18626
18626
|
checkAsyncKeyword(it, def);
|
|
18627
|
-
const validate = !$data && def.compile ? def.compile.call(it.self,
|
|
18627
|
+
const validate = !$data && def.compile ? def.compile.call(it.self, schema11, parentSchema, it) : def.validate;
|
|
18628
18628
|
const validateRef = useKeyword(gen, keyword, validate);
|
|
18629
18629
|
const valid = gen.let("valid");
|
|
18630
18630
|
cxt.block$data(valid, validateKeyword);
|
|
@@ -18684,20 +18684,20 @@ var require_keyword = __commonJS({
|
|
|
18684
18684
|
throw new Error(`keyword "${keyword}" failed to compile`);
|
|
18685
18685
|
return gen.scopeValue("keyword", typeof result == "function" ? { ref: result } : { ref: result, code: (0, codegen_1.stringify)(result) });
|
|
18686
18686
|
}
|
|
18687
|
-
function validSchemaType(
|
|
18688
|
-
return !schemaType.length || schemaType.some((st) => st === "array" ? Array.isArray(
|
|
18687
|
+
function validSchemaType(schema11, schemaType, allowUndefined = false) {
|
|
18688
|
+
return !schemaType.length || schemaType.some((st) => st === "array" ? Array.isArray(schema11) : st === "object" ? schema11 && typeof schema11 == "object" && !Array.isArray(schema11) : typeof schema11 == st || allowUndefined && typeof schema11 == "undefined");
|
|
18689
18689
|
}
|
|
18690
18690
|
exports2.validSchemaType = validSchemaType;
|
|
18691
|
-
function validateKeywordUsage({ schema:
|
|
18691
|
+
function validateKeywordUsage({ schema: schema11, opts, self, errSchemaPath }, def, keyword) {
|
|
18692
18692
|
if (Array.isArray(def.keyword) ? !def.keyword.includes(keyword) : def.keyword !== keyword) {
|
|
18693
18693
|
throw new Error("ajv implementation error");
|
|
18694
18694
|
}
|
|
18695
18695
|
const deps = def.dependencies;
|
|
18696
|
-
if (deps === null || deps === void 0 ? void 0 : deps.some((kwd) => !Object.prototype.hasOwnProperty.call(
|
|
18696
|
+
if (deps === null || deps === void 0 ? void 0 : deps.some((kwd) => !Object.prototype.hasOwnProperty.call(schema11, kwd))) {
|
|
18697
18697
|
throw new Error(`parent schema must have dependencies of ${keyword}: ${deps.join(",")}`);
|
|
18698
18698
|
}
|
|
18699
18699
|
if (def.validateSchema) {
|
|
18700
|
-
const valid = def.validateSchema(
|
|
18700
|
+
const valid = def.validateSchema(schema11[keyword]);
|
|
18701
18701
|
if (!valid) {
|
|
18702
18702
|
const msg = `keyword "${keyword}" value is invalid at path "${errSchemaPath}": ` + self.errorsText(def.validateSchema.errors);
|
|
18703
18703
|
if (opts.validateSchema === "log")
|
|
@@ -18719,8 +18719,8 @@ var require_subschema = __commonJS({
|
|
|
18719
18719
|
exports2.extendSubschemaMode = exports2.extendSubschemaData = exports2.getSubschema = void 0;
|
|
18720
18720
|
var codegen_1 = require_codegen();
|
|
18721
18721
|
var util_1 = require_util8();
|
|
18722
|
-
function getSubschema(it, { keyword, schemaProp, schema:
|
|
18723
|
-
if (keyword !== void 0 &&
|
|
18722
|
+
function getSubschema(it, { keyword, schemaProp, schema: schema11, schemaPath, errSchemaPath, topSchemaRef }) {
|
|
18723
|
+
if (keyword !== void 0 && schema11 !== void 0) {
|
|
18724
18724
|
throw new Error('both "keyword" and "schema" passed, only one allowed');
|
|
18725
18725
|
}
|
|
18726
18726
|
if (keyword !== void 0) {
|
|
@@ -18735,12 +18735,12 @@ var require_subschema = __commonJS({
|
|
|
18735
18735
|
errSchemaPath: `${it.errSchemaPath}/${keyword}/${(0, util_1.escapeFragment)(schemaProp)}`
|
|
18736
18736
|
};
|
|
18737
18737
|
}
|
|
18738
|
-
if (
|
|
18738
|
+
if (schema11 !== void 0) {
|
|
18739
18739
|
if (schemaPath === void 0 || errSchemaPath === void 0 || topSchemaRef === void 0) {
|
|
18740
18740
|
throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');
|
|
18741
18741
|
}
|
|
18742
18742
|
return {
|
|
18743
|
-
schema:
|
|
18743
|
+
schema: schema11,
|
|
18744
18744
|
schemaPath,
|
|
18745
18745
|
topSchemaRef,
|
|
18746
18746
|
errSchemaPath
|
|
@@ -18833,7 +18833,7 @@ var require_fast_deep_equal = __commonJS({
|
|
|
18833
18833
|
var require_json_schema_traverse = __commonJS({
|
|
18834
18834
|
"../../node_modules/.pnpm/json-schema-traverse@1.0.0/node_modules/json-schema-traverse/index.js"(exports2, module2) {
|
|
18835
18835
|
"use strict";
|
|
18836
|
-
var traverse = module2.exports = function(
|
|
18836
|
+
var traverse = module2.exports = function(schema11, opts, cb) {
|
|
18837
18837
|
if (typeof opts == "function") {
|
|
18838
18838
|
cb = opts;
|
|
18839
18839
|
opts = {};
|
|
@@ -18843,7 +18843,7 @@ var require_json_schema_traverse = __commonJS({
|
|
|
18843
18843
|
};
|
|
18844
18844
|
var post = cb.post || function() {
|
|
18845
18845
|
};
|
|
18846
|
-
_traverse(opts, pre, post,
|
|
18846
|
+
_traverse(opts, pre, post, schema11, "", schema11);
|
|
18847
18847
|
};
|
|
18848
18848
|
traverse.keywords = {
|
|
18849
18849
|
additionalItems: true,
|
|
@@ -18889,26 +18889,26 @@ var require_json_schema_traverse = __commonJS({
|
|
|
18889
18889
|
maxProperties: true,
|
|
18890
18890
|
minProperties: true
|
|
18891
18891
|
};
|
|
18892
|
-
function _traverse(opts, pre, post,
|
|
18893
|
-
if (
|
|
18894
|
-
pre(
|
|
18895
|
-
for (var key3 in
|
|
18896
|
-
var sch =
|
|
18892
|
+
function _traverse(opts, pre, post, schema11, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex) {
|
|
18893
|
+
if (schema11 && typeof schema11 == "object" && !Array.isArray(schema11)) {
|
|
18894
|
+
pre(schema11, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex);
|
|
18895
|
+
for (var key3 in schema11) {
|
|
18896
|
+
var sch = schema11[key3];
|
|
18897
18897
|
if (Array.isArray(sch)) {
|
|
18898
18898
|
if (key3 in traverse.arrayKeywords) {
|
|
18899
18899
|
for (var i = 0; i < sch.length; i++)
|
|
18900
|
-
_traverse(opts, pre, post, sch[i], jsonPtr + "/" + key3 + "/" + i, rootSchema, jsonPtr, key3,
|
|
18900
|
+
_traverse(opts, pre, post, sch[i], jsonPtr + "/" + key3 + "/" + i, rootSchema, jsonPtr, key3, schema11, i);
|
|
18901
18901
|
}
|
|
18902
18902
|
} else if (key3 in traverse.propsKeywords) {
|
|
18903
18903
|
if (sch && typeof sch == "object") {
|
|
18904
18904
|
for (var prop in sch)
|
|
18905
|
-
_traverse(opts, pre, post, sch[prop], jsonPtr + "/" + key3 + "/" + escapeJsonPtr(prop), rootSchema, jsonPtr, key3,
|
|
18905
|
+
_traverse(opts, pre, post, sch[prop], jsonPtr + "/" + key3 + "/" + escapeJsonPtr(prop), rootSchema, jsonPtr, key3, schema11, prop);
|
|
18906
18906
|
}
|
|
18907
18907
|
} else if (key3 in traverse.keywords || opts.allKeys && !(key3 in traverse.skipKeywords)) {
|
|
18908
|
-
_traverse(opts, pre, post, sch, jsonPtr + "/" + key3, rootSchema, jsonPtr, key3,
|
|
18908
|
+
_traverse(opts, pre, post, sch, jsonPtr + "/" + key3, rootSchema, jsonPtr, key3, schema11);
|
|
18909
18909
|
}
|
|
18910
18910
|
}
|
|
18911
|
-
post(
|
|
18911
|
+
post(schema11, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex);
|
|
18912
18912
|
}
|
|
18913
18913
|
}
|
|
18914
18914
|
function escapeJsonPtr(str) {
|
|
@@ -18944,14 +18944,14 @@ var require_resolve = __commonJS({
|
|
|
18944
18944
|
"enum",
|
|
18945
18945
|
"const"
|
|
18946
18946
|
]);
|
|
18947
|
-
function inlineRef(
|
|
18948
|
-
if (typeof
|
|
18947
|
+
function inlineRef(schema11, limit = true) {
|
|
18948
|
+
if (typeof schema11 == "boolean")
|
|
18949
18949
|
return true;
|
|
18950
18950
|
if (limit === true)
|
|
18951
|
-
return !hasRef(
|
|
18951
|
+
return !hasRef(schema11);
|
|
18952
18952
|
if (!limit)
|
|
18953
18953
|
return false;
|
|
18954
|
-
return countKeys(
|
|
18954
|
+
return countKeys(schema11) <= limit;
|
|
18955
18955
|
}
|
|
18956
18956
|
exports2.inlineRef = inlineRef;
|
|
18957
18957
|
var REF_KEYWORDS = /* @__PURE__ */ new Set([
|
|
@@ -18961,11 +18961,11 @@ var require_resolve = __commonJS({
|
|
|
18961
18961
|
"$dynamicRef",
|
|
18962
18962
|
"$dynamicAnchor"
|
|
18963
18963
|
]);
|
|
18964
|
-
function hasRef(
|
|
18965
|
-
for (const key3 in
|
|
18964
|
+
function hasRef(schema11) {
|
|
18965
|
+
for (const key3 in schema11) {
|
|
18966
18966
|
if (REF_KEYWORDS.has(key3))
|
|
18967
18967
|
return true;
|
|
18968
|
-
const sch =
|
|
18968
|
+
const sch = schema11[key3];
|
|
18969
18969
|
if (Array.isArray(sch) && sch.some(hasRef))
|
|
18970
18970
|
return true;
|
|
18971
18971
|
if (typeof sch == "object" && hasRef(sch))
|
|
@@ -18973,16 +18973,16 @@ var require_resolve = __commonJS({
|
|
|
18973
18973
|
}
|
|
18974
18974
|
return false;
|
|
18975
18975
|
}
|
|
18976
|
-
function countKeys(
|
|
18976
|
+
function countKeys(schema11) {
|
|
18977
18977
|
let count3 = 0;
|
|
18978
|
-
for (const key3 in
|
|
18978
|
+
for (const key3 in schema11) {
|
|
18979
18979
|
if (key3 === "$ref")
|
|
18980
18980
|
return Infinity;
|
|
18981
18981
|
count3++;
|
|
18982
18982
|
if (SIMPLE_INLINED.has(key3))
|
|
18983
18983
|
continue;
|
|
18984
|
-
if (typeof
|
|
18985
|
-
(0, util_1.eachItem)(
|
|
18984
|
+
if (typeof schema11[key3] == "object") {
|
|
18985
|
+
(0, util_1.eachItem)(schema11[key3], (sch) => count3 += countKeys(sch));
|
|
18986
18986
|
}
|
|
18987
18987
|
if (count3 === Infinity)
|
|
18988
18988
|
return Infinity;
|
|
@@ -19012,16 +19012,16 @@ var require_resolve = __commonJS({
|
|
|
19012
19012
|
}
|
|
19013
19013
|
exports2.resolveUrl = resolveUrl;
|
|
19014
19014
|
var ANCHOR = /^[a-z_][-a-z0-9._]*$/i;
|
|
19015
|
-
function getSchemaRefs(
|
|
19016
|
-
if (typeof
|
|
19015
|
+
function getSchemaRefs(schema11, baseId) {
|
|
19016
|
+
if (typeof schema11 == "boolean")
|
|
19017
19017
|
return {};
|
|
19018
19018
|
const { schemaId, uriResolver } = this.opts;
|
|
19019
|
-
const schId = normalizeId(
|
|
19019
|
+
const schId = normalizeId(schema11[schemaId] || baseId);
|
|
19020
19020
|
const baseIds = { "": schId };
|
|
19021
19021
|
const pathPrefix = getFullPath(uriResolver, schId, false);
|
|
19022
19022
|
const localRefs = {};
|
|
19023
19023
|
const schemaRefs = /* @__PURE__ */ new Set();
|
|
19024
|
-
traverse(
|
|
19024
|
+
traverse(schema11, { allKeys: true }, (sch, jsonPtr, _, parentJsonPtr) => {
|
|
19025
19025
|
if (parentJsonPtr === void 0)
|
|
19026
19026
|
return;
|
|
19027
19027
|
const fullPath = pathPrefix + jsonPtr;
|
|
@@ -19102,15 +19102,15 @@ var require_validate = __commonJS({
|
|
|
19102
19102
|
validateFunction(it, () => (0, boolSchema_1.topBoolOrEmptySchema)(it));
|
|
19103
19103
|
}
|
|
19104
19104
|
exports2.validateFunctionCode = validateFunctionCode;
|
|
19105
|
-
function validateFunction({ gen, validateName, schema:
|
|
19105
|
+
function validateFunction({ gen, validateName, schema: schema11, schemaEnv, opts }, body) {
|
|
19106
19106
|
if (opts.code.es5) {
|
|
19107
19107
|
gen.func(validateName, (0, codegen_1._)`${names_1.default.data}, ${names_1.default.valCxt}`, schemaEnv.$async, () => {
|
|
19108
|
-
gen.code((0, codegen_1._)`"use strict"; ${funcSourceUrl(
|
|
19108
|
+
gen.code((0, codegen_1._)`"use strict"; ${funcSourceUrl(schema11, opts)}`);
|
|
19109
19109
|
destructureValCxtES5(gen, opts);
|
|
19110
19110
|
gen.code(body);
|
|
19111
19111
|
});
|
|
19112
19112
|
} else {
|
|
19113
|
-
gen.func(validateName, (0, codegen_1._)`${names_1.default.data}, ${destructureValCxt(opts)}`, schemaEnv.$async, () => gen.code(funcSourceUrl(
|
|
19113
|
+
gen.func(validateName, (0, codegen_1._)`${names_1.default.data}, ${destructureValCxt(opts)}`, schemaEnv.$async, () => gen.code(funcSourceUrl(schema11, opts)).code(body));
|
|
19114
19114
|
}
|
|
19115
19115
|
}
|
|
19116
19116
|
function destructureValCxt(opts) {
|
|
@@ -19134,9 +19134,9 @@ var require_validate = __commonJS({
|
|
|
19134
19134
|
});
|
|
19135
19135
|
}
|
|
19136
19136
|
function topSchemaObjCode(it) {
|
|
19137
|
-
const { schema:
|
|
19137
|
+
const { schema: schema11, opts, gen } = it;
|
|
19138
19138
|
validateFunction(it, () => {
|
|
19139
|
-
if (opts.$comment &&
|
|
19139
|
+
if (opts.$comment && schema11.$comment)
|
|
19140
19140
|
commentKeyword(it);
|
|
19141
19141
|
checkNoDefault(it);
|
|
19142
19142
|
gen.let(names_1.default.vErrors, null);
|
|
@@ -19154,8 +19154,8 @@ var require_validate = __commonJS({
|
|
|
19154
19154
|
gen.if((0, codegen_1._)`${it.evaluated}.dynamicProps`, () => gen.assign((0, codegen_1._)`${it.evaluated}.props`, (0, codegen_1._)`undefined`));
|
|
19155
19155
|
gen.if((0, codegen_1._)`${it.evaluated}.dynamicItems`, () => gen.assign((0, codegen_1._)`${it.evaluated}.items`, (0, codegen_1._)`undefined`));
|
|
19156
19156
|
}
|
|
19157
|
-
function funcSourceUrl(
|
|
19158
|
-
const schId = typeof
|
|
19157
|
+
function funcSourceUrl(schema11, opts) {
|
|
19158
|
+
const schId = typeof schema11 == "object" && schema11[opts.schemaId];
|
|
19159
19159
|
return schId && (opts.code.source || opts.code.process) ? (0, codegen_1._)`/*# sourceURL=${schId} */` : codegen_1.nil;
|
|
19160
19160
|
}
|
|
19161
19161
|
function subschemaCode(it, valid) {
|
|
@@ -19168,10 +19168,10 @@ var require_validate = __commonJS({
|
|
|
19168
19168
|
}
|
|
19169
19169
|
(0, boolSchema_1.boolOrEmptySchema)(it, valid);
|
|
19170
19170
|
}
|
|
19171
|
-
function schemaCxtHasRules({ schema:
|
|
19172
|
-
if (typeof
|
|
19173
|
-
return !
|
|
19174
|
-
for (const key3 in
|
|
19171
|
+
function schemaCxtHasRules({ schema: schema11, self }) {
|
|
19172
|
+
if (typeof schema11 == "boolean")
|
|
19173
|
+
return !schema11;
|
|
19174
|
+
for (const key3 in schema11)
|
|
19175
19175
|
if (self.RULES.all[key3])
|
|
19176
19176
|
return true;
|
|
19177
19177
|
return false;
|
|
@@ -19180,8 +19180,8 @@ var require_validate = __commonJS({
|
|
|
19180
19180
|
return typeof it.schema != "boolean";
|
|
19181
19181
|
}
|
|
19182
19182
|
function subSchemaObjCode(it, valid) {
|
|
19183
|
-
const { schema:
|
|
19184
|
-
if (opts.$comment &&
|
|
19183
|
+
const { schema: schema11, gen, opts } = it;
|
|
19184
|
+
if (opts.$comment && schema11.$comment)
|
|
19185
19185
|
commentKeyword(it);
|
|
19186
19186
|
updateContext(it);
|
|
19187
19187
|
checkAsyncSchema(it);
|
|
@@ -19201,14 +19201,14 @@ var require_validate = __commonJS({
|
|
|
19201
19201
|
schemaKeywords(it, types, !checkedTypes, errsCount);
|
|
19202
19202
|
}
|
|
19203
19203
|
function checkRefsAndKeywords(it) {
|
|
19204
|
-
const { schema:
|
|
19205
|
-
if (
|
|
19204
|
+
const { schema: schema11, errSchemaPath, opts, self } = it;
|
|
19205
|
+
if (schema11.$ref && opts.ignoreKeywordsWithRef && (0, util_1.schemaHasRulesButRef)(schema11, self.RULES)) {
|
|
19206
19206
|
self.logger.warn(`$ref: keywords ignored in schema at path "${errSchemaPath}"`);
|
|
19207
19207
|
}
|
|
19208
19208
|
}
|
|
19209
19209
|
function checkNoDefault(it) {
|
|
19210
|
-
const { schema:
|
|
19211
|
-
if (
|
|
19210
|
+
const { schema: schema11, opts } = it;
|
|
19211
|
+
if (schema11.default !== void 0 && opts.useDefaults && opts.strictSchema) {
|
|
19212
19212
|
(0, util_1.checkStrictMode)(it, "default is ignored in the schema root");
|
|
19213
19213
|
}
|
|
19214
19214
|
}
|
|
@@ -19221,8 +19221,8 @@ var require_validate = __commonJS({
|
|
|
19221
19221
|
if (it.schema.$async && !it.schemaEnv.$async)
|
|
19222
19222
|
throw new Error("async schema in sync schema");
|
|
19223
19223
|
}
|
|
19224
|
-
function commentKeyword({ gen, schemaEnv, schema:
|
|
19225
|
-
const msg =
|
|
19224
|
+
function commentKeyword({ gen, schemaEnv, schema: schema11, errSchemaPath, opts }) {
|
|
19225
|
+
const msg = schema11.$comment;
|
|
19226
19226
|
if (opts.$comment === true) {
|
|
19227
19227
|
gen.code((0, codegen_1._)`${names_1.default.self}.logger.log(${msg})`);
|
|
19228
19228
|
} else if (typeof opts.$comment == "function") {
|
|
@@ -19249,9 +19249,9 @@ var require_validate = __commonJS({
|
|
|
19249
19249
|
gen.assign((0, codegen_1._)`${evaluated}.items`, items);
|
|
19250
19250
|
}
|
|
19251
19251
|
function schemaKeywords(it, types, typeErrors, errsCount) {
|
|
19252
|
-
const { gen, schema:
|
|
19252
|
+
const { gen, schema: schema11, data, allErrors, opts, self } = it;
|
|
19253
19253
|
const { RULES } = self;
|
|
19254
|
-
if (
|
|
19254
|
+
if (schema11.$ref && (opts.ignoreKeywordsWithRef || !(0, util_1.schemaHasRulesButRef)(schema11, RULES))) {
|
|
19255
19255
|
gen.block(() => keywordCode(it, "$ref", RULES.all.$ref.definition));
|
|
19256
19256
|
return;
|
|
19257
19257
|
}
|
|
@@ -19263,7 +19263,7 @@ var require_validate = __commonJS({
|
|
|
19263
19263
|
groupKeywords(RULES.post);
|
|
19264
19264
|
});
|
|
19265
19265
|
function groupKeywords(group) {
|
|
19266
|
-
if (!(0, applicability_1.shouldUseGroup)(
|
|
19266
|
+
if (!(0, applicability_1.shouldUseGroup)(schema11, group))
|
|
19267
19267
|
return;
|
|
19268
19268
|
if (group.type) {
|
|
19269
19269
|
gen.if((0, dataType_2.checkDataType)(group.type, data, opts.strictNumbers));
|
|
@@ -19281,12 +19281,12 @@ var require_validate = __commonJS({
|
|
|
19281
19281
|
}
|
|
19282
19282
|
}
|
|
19283
19283
|
function iterateKeywords(it, group) {
|
|
19284
|
-
const { gen, schema:
|
|
19284
|
+
const { gen, schema: schema11, opts: { useDefaults } } = it;
|
|
19285
19285
|
if (useDefaults)
|
|
19286
19286
|
(0, defaults_1.assignDefaults)(it, group.type);
|
|
19287
19287
|
gen.block(() => {
|
|
19288
19288
|
for (const rule of group.rules) {
|
|
19289
|
-
if ((0, applicability_1.shouldUseRule)(
|
|
19289
|
+
if ((0, applicability_1.shouldUseRule)(schema11, rule)) {
|
|
19290
19290
|
keywordCode(it, rule.keyword, rule.definition, group.type);
|
|
19291
19291
|
}
|
|
19292
19292
|
}
|
|
@@ -19631,17 +19631,17 @@ var require_compile = __commonJS({
|
|
|
19631
19631
|
var _a3;
|
|
19632
19632
|
this.refs = {};
|
|
19633
19633
|
this.dynamicAnchors = {};
|
|
19634
|
-
let
|
|
19634
|
+
let schema11;
|
|
19635
19635
|
if (typeof env2.schema == "object")
|
|
19636
|
-
|
|
19636
|
+
schema11 = env2.schema;
|
|
19637
19637
|
this.schema = env2.schema;
|
|
19638
19638
|
this.schemaId = env2.schemaId;
|
|
19639
19639
|
this.root = env2.root || this;
|
|
19640
|
-
this.baseId = (_a3 = env2.baseId) !== null && _a3 !== void 0 ? _a3 : (0, resolve_1.normalizeId)(
|
|
19640
|
+
this.baseId = (_a3 = env2.baseId) !== null && _a3 !== void 0 ? _a3 : (0, resolve_1.normalizeId)(schema11 === null || schema11 === void 0 ? void 0 : schema11[env2.schemaId || "$id"]);
|
|
19641
19641
|
this.schemaPath = env2.schemaPath;
|
|
19642
19642
|
this.localRefs = env2.localRefs;
|
|
19643
19643
|
this.meta = env2.meta;
|
|
19644
|
-
this.$async =
|
|
19644
|
+
this.$async = schema11 === null || schema11 === void 0 ? void 0 : schema11.$async;
|
|
19645
19645
|
this.refs = {};
|
|
19646
19646
|
}
|
|
19647
19647
|
};
|
|
@@ -19740,10 +19740,10 @@ var require_compile = __commonJS({
|
|
|
19740
19740
|
return schOrFunc;
|
|
19741
19741
|
let _sch = resolve.call(this, root, ref);
|
|
19742
19742
|
if (_sch === void 0) {
|
|
19743
|
-
const
|
|
19743
|
+
const schema11 = (_a3 = root.localRefs) === null || _a3 === void 0 ? void 0 : _a3[ref];
|
|
19744
19744
|
const { schemaId } = this.opts;
|
|
19745
|
-
if (
|
|
19746
|
-
_sch = new SchemaEnv({ schema:
|
|
19745
|
+
if (schema11)
|
|
19746
|
+
_sch = new SchemaEnv({ schema: schema11, schemaId, root, baseId });
|
|
19747
19747
|
}
|
|
19748
19748
|
if (_sch === void 0)
|
|
19749
19749
|
return;
|
|
@@ -19791,12 +19791,12 @@ var require_compile = __commonJS({
|
|
|
19791
19791
|
if (!schOrRef.validate)
|
|
19792
19792
|
compileSchema.call(this, schOrRef);
|
|
19793
19793
|
if (id === (0, resolve_1.normalizeId)(ref)) {
|
|
19794
|
-
const { schema:
|
|
19794
|
+
const { schema: schema11 } = schOrRef;
|
|
19795
19795
|
const { schemaId } = this.opts;
|
|
19796
|
-
const schId =
|
|
19796
|
+
const schId = schema11[schemaId];
|
|
19797
19797
|
if (schId)
|
|
19798
19798
|
baseId = (0, resolve_1.resolveUrl)(this.opts.uriResolver, baseId, schId);
|
|
19799
|
-
return new SchemaEnv({ schema:
|
|
19799
|
+
return new SchemaEnv({ schema: schema11, schemaId, root, baseId });
|
|
19800
19800
|
}
|
|
19801
19801
|
return getJsonPointer.call(this, p, schOrRef);
|
|
19802
19802
|
}
|
|
@@ -19808,29 +19808,29 @@ var require_compile = __commonJS({
|
|
|
19808
19808
|
"dependencies",
|
|
19809
19809
|
"definitions"
|
|
19810
19810
|
]);
|
|
19811
|
-
function getJsonPointer(parsedRef, { baseId, schema:
|
|
19811
|
+
function getJsonPointer(parsedRef, { baseId, schema: schema11, root }) {
|
|
19812
19812
|
var _a3;
|
|
19813
19813
|
if (((_a3 = parsedRef.fragment) === null || _a3 === void 0 ? void 0 : _a3[0]) !== "/")
|
|
19814
19814
|
return;
|
|
19815
19815
|
for (const part of parsedRef.fragment.slice(1).split("/")) {
|
|
19816
|
-
if (typeof
|
|
19816
|
+
if (typeof schema11 === "boolean")
|
|
19817
19817
|
return;
|
|
19818
|
-
const partSchema =
|
|
19818
|
+
const partSchema = schema11[(0, util_1.unescapeFragment)(part)];
|
|
19819
19819
|
if (partSchema === void 0)
|
|
19820
19820
|
return;
|
|
19821
|
-
|
|
19822
|
-
const schId = typeof
|
|
19821
|
+
schema11 = partSchema;
|
|
19822
|
+
const schId = typeof schema11 === "object" && schema11[this.opts.schemaId];
|
|
19823
19823
|
if (!PREVENT_SCOPE_CHANGE.has(part) && schId) {
|
|
19824
19824
|
baseId = (0, resolve_1.resolveUrl)(this.opts.uriResolver, baseId, schId);
|
|
19825
19825
|
}
|
|
19826
19826
|
}
|
|
19827
19827
|
let env2;
|
|
19828
|
-
if (typeof
|
|
19829
|
-
const $ref = (0, resolve_1.resolveUrl)(this.opts.uriResolver, baseId,
|
|
19828
|
+
if (typeof schema11 != "boolean" && schema11.$ref && !(0, util_1.schemaHasRulesButRef)(schema11, this.RULES)) {
|
|
19829
|
+
const $ref = (0, resolve_1.resolveUrl)(this.opts.uriResolver, baseId, schema11.$ref);
|
|
19830
19830
|
env2 = resolveSchema.call(this, root, $ref);
|
|
19831
19831
|
}
|
|
19832
19832
|
const { schemaId } = this.opts;
|
|
19833
|
-
env2 = env2 || new SchemaEnv({ schema:
|
|
19833
|
+
env2 = env2 || new SchemaEnv({ schema: schema11, schemaId, root, baseId });
|
|
19834
19834
|
if (env2.schema !== env2.root.schema)
|
|
19835
19835
|
return env2;
|
|
19836
19836
|
return void 0;
|
|
@@ -20852,16 +20852,16 @@ var require_core = __commonJS({
|
|
|
20852
20852
|
this.errors = v.errors;
|
|
20853
20853
|
return valid;
|
|
20854
20854
|
}
|
|
20855
|
-
compile(
|
|
20856
|
-
const sch = this._addSchema(
|
|
20855
|
+
compile(schema11, _meta) {
|
|
20856
|
+
const sch = this._addSchema(schema11, _meta);
|
|
20857
20857
|
return sch.validate || this._compileSchemaEnv(sch);
|
|
20858
20858
|
}
|
|
20859
|
-
compileAsync(
|
|
20859
|
+
compileAsync(schema11, meta3) {
|
|
20860
20860
|
if (typeof this.opts.loadSchema != "function") {
|
|
20861
20861
|
throw new Error("options.loadSchema should be a function");
|
|
20862
20862
|
}
|
|
20863
20863
|
const { loadSchema } = this.opts;
|
|
20864
|
-
return runCompileAsync.call(this,
|
|
20864
|
+
return runCompileAsync.call(this, schema11, meta3);
|
|
20865
20865
|
async function runCompileAsync(_schema, _meta) {
|
|
20866
20866
|
await loadMetaSchema.call(this, _schema.$schema);
|
|
20867
20867
|
const sch = this._addSchema(_schema, _meta);
|
|
@@ -20907,37 +20907,37 @@ var require_core = __commonJS({
|
|
|
20907
20907
|
}
|
|
20908
20908
|
}
|
|
20909
20909
|
// Adds schema to the instance
|
|
20910
|
-
addSchema(
|
|
20911
|
-
if (Array.isArray(
|
|
20912
|
-
for (const sch of
|
|
20910
|
+
addSchema(schema11, key3, _meta, _validateSchema = this.opts.validateSchema) {
|
|
20911
|
+
if (Array.isArray(schema11)) {
|
|
20912
|
+
for (const sch of schema11)
|
|
20913
20913
|
this.addSchema(sch, void 0, _meta, _validateSchema);
|
|
20914
20914
|
return this;
|
|
20915
20915
|
}
|
|
20916
20916
|
let id;
|
|
20917
|
-
if (typeof
|
|
20917
|
+
if (typeof schema11 === "object") {
|
|
20918
20918
|
const { schemaId } = this.opts;
|
|
20919
|
-
id =
|
|
20919
|
+
id = schema11[schemaId];
|
|
20920
20920
|
if (id !== void 0 && typeof id != "string") {
|
|
20921
20921
|
throw new Error(`schema ${schemaId} must be string`);
|
|
20922
20922
|
}
|
|
20923
20923
|
}
|
|
20924
20924
|
key3 = (0, resolve_1.normalizeId)(key3 || id);
|
|
20925
20925
|
this._checkUnique(key3);
|
|
20926
|
-
this.schemas[key3] = this._addSchema(
|
|
20926
|
+
this.schemas[key3] = this._addSchema(schema11, _meta, key3, _validateSchema, true);
|
|
20927
20927
|
return this;
|
|
20928
20928
|
}
|
|
20929
20929
|
// Add schema that will be used to validate other schemas
|
|
20930
20930
|
// options in META_IGNORE_OPTIONS are alway set to false
|
|
20931
|
-
addMetaSchema(
|
|
20932
|
-
this.addSchema(
|
|
20931
|
+
addMetaSchema(schema11, key3, _validateSchema = this.opts.validateSchema) {
|
|
20932
|
+
this.addSchema(schema11, key3, true, _validateSchema);
|
|
20933
20933
|
return this;
|
|
20934
20934
|
}
|
|
20935
20935
|
// Validate schema against its meta-schema
|
|
20936
|
-
validateSchema(
|
|
20937
|
-
if (typeof
|
|
20936
|
+
validateSchema(schema11, throwOrLogError) {
|
|
20937
|
+
if (typeof schema11 == "boolean")
|
|
20938
20938
|
return true;
|
|
20939
20939
|
let $schema;
|
|
20940
|
-
$schema =
|
|
20940
|
+
$schema = schema11.$schema;
|
|
20941
20941
|
if ($schema !== void 0 && typeof $schema != "string") {
|
|
20942
20942
|
throw new Error("$schema must be a string");
|
|
20943
20943
|
}
|
|
@@ -20947,7 +20947,7 @@ var require_core = __commonJS({
|
|
|
20947
20947
|
this.errors = null;
|
|
20948
20948
|
return true;
|
|
20949
20949
|
}
|
|
20950
|
-
const valid = this.validate($schema,
|
|
20950
|
+
const valid = this.validate($schema, schema11);
|
|
20951
20951
|
if (!valid && throwOrLogError) {
|
|
20952
20952
|
const message5 = "schema is invalid: " + this.errorsText();
|
|
20953
20953
|
if (this.opts.validateSchema === "log")
|
|
@@ -21090,9 +21090,9 @@ var require_core = __commonJS({
|
|
|
21090
21090
|
if (typeof rule != "object")
|
|
21091
21091
|
continue;
|
|
21092
21092
|
const { $data } = rule.definition;
|
|
21093
|
-
const
|
|
21094
|
-
if ($data &&
|
|
21095
|
-
keywords[key3] = schemaOrData(
|
|
21093
|
+
const schema11 = keywords[key3];
|
|
21094
|
+
if ($data && schema11)
|
|
21095
|
+
keywords[key3] = schemaOrData(schema11);
|
|
21096
21096
|
}
|
|
21097
21097
|
}
|
|
21098
21098
|
return metaSchema;
|
|
@@ -21110,23 +21110,23 @@ var require_core = __commonJS({
|
|
|
21110
21110
|
}
|
|
21111
21111
|
}
|
|
21112
21112
|
}
|
|
21113
|
-
_addSchema(
|
|
21113
|
+
_addSchema(schema11, meta3, baseId, validateSchema = this.opts.validateSchema, addSchema = this.opts.addUsedSchema) {
|
|
21114
21114
|
let id;
|
|
21115
21115
|
const { schemaId } = this.opts;
|
|
21116
|
-
if (typeof
|
|
21117
|
-
id =
|
|
21116
|
+
if (typeof schema11 == "object") {
|
|
21117
|
+
id = schema11[schemaId];
|
|
21118
21118
|
} else {
|
|
21119
21119
|
if (this.opts.jtd)
|
|
21120
21120
|
throw new Error("schema must be object");
|
|
21121
|
-
else if (typeof
|
|
21121
|
+
else if (typeof schema11 != "boolean")
|
|
21122
21122
|
throw new Error("schema must be object or boolean");
|
|
21123
21123
|
}
|
|
21124
|
-
let sch = this._cache.get(
|
|
21124
|
+
let sch = this._cache.get(schema11);
|
|
21125
21125
|
if (sch !== void 0)
|
|
21126
21126
|
return sch;
|
|
21127
21127
|
baseId = (0, resolve_1.normalizeId)(id || baseId);
|
|
21128
|
-
const localRefs = resolve_1.getSchemaRefs.call(this,
|
|
21129
|
-
sch = new compile_1.SchemaEnv({ schema:
|
|
21128
|
+
const localRefs = resolve_1.getSchemaRefs.call(this, schema11, baseId);
|
|
21129
|
+
sch = new compile_1.SchemaEnv({ schema: schema11, schemaId, meta: meta3, baseId, localRefs });
|
|
21130
21130
|
this._cache.set(sch.schema, sch);
|
|
21131
21131
|
if (addSchema && !baseId.startsWith("#")) {
|
|
21132
21132
|
if (baseId)
|
|
@@ -21134,7 +21134,7 @@ var require_core = __commonJS({
|
|
|
21134
21134
|
this.refs[baseId] = sch;
|
|
21135
21135
|
}
|
|
21136
21136
|
if (validateSchema)
|
|
21137
|
-
this.validateSchema(
|
|
21137
|
+
this.validateSchema(schema11, true);
|
|
21138
21138
|
return sch;
|
|
21139
21139
|
}
|
|
21140
21140
|
_checkUnique(id) {
|
|
@@ -21288,8 +21288,8 @@ var require_core = __commonJS({
|
|
|
21288
21288
|
var $dataRef = {
|
|
21289
21289
|
$ref: "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"
|
|
21290
21290
|
};
|
|
21291
|
-
function schemaOrData(
|
|
21292
|
-
return { anyOf: [
|
|
21291
|
+
function schemaOrData(schema11) {
|
|
21292
|
+
return { anyOf: [schema11, $dataRef] };
|
|
21293
21293
|
}
|
|
21294
21294
|
}
|
|
21295
21295
|
});
|
|
@@ -21589,7 +21589,7 @@ var require_pattern = __commonJS({
|
|
|
21589
21589
|
$data: true,
|
|
21590
21590
|
error: error51,
|
|
21591
21591
|
code(cxt) {
|
|
21592
|
-
const { gen, data, $data, schema:
|
|
21592
|
+
const { gen, data, $data, schema: schema11, schemaCode, it } = cxt;
|
|
21593
21593
|
const u = it.opts.unicodeRegExp ? "u" : "";
|
|
21594
21594
|
if ($data) {
|
|
21595
21595
|
const { regExp } = it.opts.code;
|
|
@@ -21598,7 +21598,7 @@ var require_pattern = __commonJS({
|
|
|
21598
21598
|
gen.try(() => gen.assign(valid, (0, codegen_1._)`${regExpCode}(${schemaCode}, ${u}).test(${data})`), () => gen.assign(valid, false));
|
|
21599
21599
|
cxt.fail$data((0, codegen_1._)`!${valid}`);
|
|
21600
21600
|
} else {
|
|
21601
|
-
const regExp = (0, code_1.usePattern)(cxt,
|
|
21601
|
+
const regExp = (0, code_1.usePattern)(cxt, schema11);
|
|
21602
21602
|
cxt.fail$data((0, codegen_1._)`!${regExp}.test(${data})`);
|
|
21603
21603
|
}
|
|
21604
21604
|
}
|
|
@@ -21655,11 +21655,11 @@ var require_required = __commonJS({
|
|
|
21655
21655
|
$data: true,
|
|
21656
21656
|
error: error51,
|
|
21657
21657
|
code(cxt) {
|
|
21658
|
-
const { gen, schema:
|
|
21658
|
+
const { gen, schema: schema11, schemaCode, data, $data, it } = cxt;
|
|
21659
21659
|
const { opts } = it;
|
|
21660
|
-
if (!$data &&
|
|
21660
|
+
if (!$data && schema11.length === 0)
|
|
21661
21661
|
return;
|
|
21662
|
-
const useLoop =
|
|
21662
|
+
const useLoop = schema11.length >= opts.loopRequired;
|
|
21663
21663
|
if (it.allErrors)
|
|
21664
21664
|
allErrorsMode();
|
|
21665
21665
|
else
|
|
@@ -21667,7 +21667,7 @@ var require_required = __commonJS({
|
|
|
21667
21667
|
if (opts.strictRequired) {
|
|
21668
21668
|
const props = cxt.parentSchema.properties;
|
|
21669
21669
|
const { definedProperties } = cxt.it;
|
|
21670
|
-
for (const requiredKey of
|
|
21670
|
+
for (const requiredKey of schema11) {
|
|
21671
21671
|
if ((props === null || props === void 0 ? void 0 : props[requiredKey]) === void 0 && !definedProperties.has(requiredKey)) {
|
|
21672
21672
|
const schemaPath = it.schemaEnv.baseId + it.errSchemaPath;
|
|
21673
21673
|
const msg = `required property "${requiredKey}" is not defined at "${schemaPath}" (strictRequired)`;
|
|
@@ -21679,7 +21679,7 @@ var require_required = __commonJS({
|
|
|
21679
21679
|
if (useLoop || $data) {
|
|
21680
21680
|
cxt.block$data(codegen_1.nil, loopAllRequired);
|
|
21681
21681
|
} else {
|
|
21682
|
-
for (const prop of
|
|
21682
|
+
for (const prop of schema11) {
|
|
21683
21683
|
(0, code_1.checkReportMissingProp)(cxt, prop);
|
|
21684
21684
|
}
|
|
21685
21685
|
}
|
|
@@ -21691,7 +21691,7 @@ var require_required = __commonJS({
|
|
|
21691
21691
|
cxt.block$data(valid, () => loopUntilMissing(missing, valid));
|
|
21692
21692
|
cxt.ok(valid);
|
|
21693
21693
|
} else {
|
|
21694
|
-
gen.if((0, code_1.checkMissingProp)(cxt,
|
|
21694
|
+
gen.if((0, code_1.checkMissingProp)(cxt, schema11, missing));
|
|
21695
21695
|
(0, code_1.reportMissingProp)(cxt, missing);
|
|
21696
21696
|
gen.else();
|
|
21697
21697
|
}
|
|
@@ -21778,8 +21778,8 @@ var require_uniqueItems = __commonJS({
|
|
|
21778
21778
|
$data: true,
|
|
21779
21779
|
error: error51,
|
|
21780
21780
|
code(cxt) {
|
|
21781
|
-
const { gen, data, $data, schema:
|
|
21782
|
-
if (!$data && !
|
|
21781
|
+
const { gen, data, $data, schema: schema11, parentSchema, schemaCode, it } = cxt;
|
|
21782
|
+
if (!$data && !schema11)
|
|
21783
21783
|
return;
|
|
21784
21784
|
const valid = gen.let("valid");
|
|
21785
21785
|
const itemTypes = parentSchema.items ? (0, dataType_1.getSchemaTypes)(parentSchema.items) : [];
|
|
@@ -21796,19 +21796,19 @@ var require_uniqueItems = __commonJS({
|
|
|
21796
21796
|
return itemTypes.length > 0 && !itemTypes.some((t) => t === "object" || t === "array");
|
|
21797
21797
|
}
|
|
21798
21798
|
function loopN(i, j) {
|
|
21799
|
-
const
|
|
21800
|
-
const wrongType = (0, dataType_1.checkDataTypes)(itemTypes,
|
|
21799
|
+
const item2 = gen.name("item");
|
|
21800
|
+
const wrongType = (0, dataType_1.checkDataTypes)(itemTypes, item2, it.opts.strictNumbers, dataType_1.DataType.Wrong);
|
|
21801
21801
|
const indices = gen.const("indices", (0, codegen_1._)`{}`);
|
|
21802
21802
|
gen.for((0, codegen_1._)`;${i}--;`, () => {
|
|
21803
|
-
gen.let(
|
|
21803
|
+
gen.let(item2, (0, codegen_1._)`${data}[${i}]`);
|
|
21804
21804
|
gen.if(wrongType, (0, codegen_1._)`continue`);
|
|
21805
21805
|
if (itemTypes.length > 1)
|
|
21806
|
-
gen.if((0, codegen_1._)`typeof ${
|
|
21807
|
-
gen.if((0, codegen_1._)`typeof ${indices}[${
|
|
21808
|
-
gen.assign(j, (0, codegen_1._)`${indices}[${
|
|
21806
|
+
gen.if((0, codegen_1._)`typeof ${item2} == "string"`, (0, codegen_1._)`${item2} += "_"`);
|
|
21807
|
+
gen.if((0, codegen_1._)`typeof ${indices}[${item2}] == "number"`, () => {
|
|
21808
|
+
gen.assign(j, (0, codegen_1._)`${indices}[${item2}]`);
|
|
21809
21809
|
cxt.error();
|
|
21810
21810
|
gen.assign(valid, false).break();
|
|
21811
|
-
}).code((0, codegen_1._)`${indices}[${
|
|
21811
|
+
}).code((0, codegen_1._)`${indices}[${item2}] = ${i}`);
|
|
21812
21812
|
});
|
|
21813
21813
|
}
|
|
21814
21814
|
function loopN2(i, j) {
|
|
@@ -21842,11 +21842,11 @@ var require_const = __commonJS({
|
|
|
21842
21842
|
$data: true,
|
|
21843
21843
|
error: error51,
|
|
21844
21844
|
code(cxt) {
|
|
21845
|
-
const { gen, data, $data, schemaCode, schema:
|
|
21846
|
-
if ($data ||
|
|
21845
|
+
const { gen, data, $data, schemaCode, schema: schema11 } = cxt;
|
|
21846
|
+
if ($data || schema11 && typeof schema11 == "object") {
|
|
21847
21847
|
cxt.fail$data((0, codegen_1._)`!${(0, util_1.useFunc)(gen, equal_1.default)}(${data}, ${schemaCode})`);
|
|
21848
21848
|
} else {
|
|
21849
|
-
cxt.fail((0, codegen_1._)`${
|
|
21849
|
+
cxt.fail((0, codegen_1._)`${schema11} !== ${data}`);
|
|
21850
21850
|
}
|
|
21851
21851
|
}
|
|
21852
21852
|
};
|
|
@@ -21872,10 +21872,10 @@ var require_enum = __commonJS({
|
|
|
21872
21872
|
$data: true,
|
|
21873
21873
|
error: error51,
|
|
21874
21874
|
code(cxt) {
|
|
21875
|
-
const { gen, data, $data, schema:
|
|
21876
|
-
if (!$data &&
|
|
21875
|
+
const { gen, data, $data, schema: schema11, schemaCode, it } = cxt;
|
|
21876
|
+
if (!$data && schema11.length === 0)
|
|
21877
21877
|
throw new Error("enum must have non-empty array");
|
|
21878
|
-
const useLoop =
|
|
21878
|
+
const useLoop = schema11.length >= it.opts.loopEnum;
|
|
21879
21879
|
let eql;
|
|
21880
21880
|
const getEql = () => eql !== null && eql !== void 0 ? eql : eql = (0, util_1.useFunc)(gen, equal_1.default);
|
|
21881
21881
|
let valid;
|
|
@@ -21883,10 +21883,10 @@ var require_enum = __commonJS({
|
|
|
21883
21883
|
valid = gen.let("valid");
|
|
21884
21884
|
cxt.block$data(valid, loopEnum);
|
|
21885
21885
|
} else {
|
|
21886
|
-
if (!Array.isArray(
|
|
21886
|
+
if (!Array.isArray(schema11))
|
|
21887
21887
|
throw new Error("ajv implementation error");
|
|
21888
21888
|
const vSchema = gen.const("vSchema", schemaCode);
|
|
21889
|
-
valid = (0, codegen_1.or)(...
|
|
21889
|
+
valid = (0, codegen_1.or)(...schema11.map((_x, i) => equalCode(vSchema, i)));
|
|
21890
21890
|
}
|
|
21891
21891
|
cxt.pass(valid);
|
|
21892
21892
|
function loopEnum() {
|
|
@@ -21894,7 +21894,7 @@ var require_enum = __commonJS({
|
|
|
21894
21894
|
gen.forOf("v", schemaCode, (v) => gen.if((0, codegen_1._)`${getEql()}(${data}, ${v})`, () => gen.assign(valid, true).break()));
|
|
21895
21895
|
}
|
|
21896
21896
|
function equalCode(vSchema, i) {
|
|
21897
|
-
const sch =
|
|
21897
|
+
const sch = schema11[i];
|
|
21898
21898
|
return typeof sch === "object" && sch !== null ? (0, codegen_1._)`${getEql()}(${data}, ${vSchema}[${i}])` : (0, codegen_1._)`${data} === ${sch}`;
|
|
21899
21899
|
}
|
|
21900
21900
|
}
|
|
@@ -21970,13 +21970,13 @@ var require_additionalItems = __commonJS({
|
|
|
21970
21970
|
}
|
|
21971
21971
|
};
|
|
21972
21972
|
function validateAdditionalItems(cxt, items) {
|
|
21973
|
-
const { gen, schema:
|
|
21973
|
+
const { gen, schema: schema11, data, keyword, it } = cxt;
|
|
21974
21974
|
it.items = true;
|
|
21975
21975
|
const len = gen.const("len", (0, codegen_1._)`${data}.length`);
|
|
21976
|
-
if (
|
|
21976
|
+
if (schema11 === false) {
|
|
21977
21977
|
cxt.setParams({ len: items.length });
|
|
21978
21978
|
cxt.pass((0, codegen_1._)`${len} <= ${items.length}`);
|
|
21979
|
-
} else if (typeof
|
|
21979
|
+
} else if (typeof schema11 == "object" && !(0, util_1.alwaysValidSchema)(it, schema11)) {
|
|
21980
21980
|
const valid = gen.var("valid", (0, codegen_1._)`${len} <= ${items.length}`);
|
|
21981
21981
|
gen.if((0, codegen_1.not)(valid), () => validateItems(valid));
|
|
21982
21982
|
cxt.ok(valid);
|
|
@@ -22009,11 +22009,11 @@ var require_items = __commonJS({
|
|
|
22009
22009
|
schemaType: ["object", "array", "boolean"],
|
|
22010
22010
|
before: "uniqueItems",
|
|
22011
22011
|
code(cxt) {
|
|
22012
|
-
const { schema:
|
|
22013
|
-
if (Array.isArray(
|
|
22014
|
-
return validateTuple(cxt, "additionalItems",
|
|
22012
|
+
const { schema: schema11, it } = cxt;
|
|
22013
|
+
if (Array.isArray(schema11))
|
|
22014
|
+
return validateTuple(cxt, "additionalItems", schema11);
|
|
22015
22015
|
it.items = true;
|
|
22016
|
-
if ((0, util_1.alwaysValidSchema)(it,
|
|
22016
|
+
if ((0, util_1.alwaysValidSchema)(it, schema11))
|
|
22017
22017
|
return;
|
|
22018
22018
|
cxt.ok((0, code_1.validateArray)(cxt));
|
|
22019
22019
|
}
|
|
@@ -22088,10 +22088,10 @@ var require_items2020 = __commonJS({
|
|
|
22088
22088
|
before: "uniqueItems",
|
|
22089
22089
|
error: error51,
|
|
22090
22090
|
code(cxt) {
|
|
22091
|
-
const { schema:
|
|
22091
|
+
const { schema: schema11, parentSchema, it } = cxt;
|
|
22092
22092
|
const { prefixItems } = parentSchema;
|
|
22093
22093
|
it.items = true;
|
|
22094
|
-
if ((0, util_1.alwaysValidSchema)(it,
|
|
22094
|
+
if ((0, util_1.alwaysValidSchema)(it, schema11))
|
|
22095
22095
|
return;
|
|
22096
22096
|
if (prefixItems)
|
|
22097
22097
|
(0, additionalItems_1.validateAdditionalItems)(cxt, prefixItems);
|
|
@@ -22122,7 +22122,7 @@ var require_contains = __commonJS({
|
|
|
22122
22122
|
trackErrors: true,
|
|
22123
22123
|
error: error51,
|
|
22124
22124
|
code(cxt) {
|
|
22125
|
-
const { gen, schema:
|
|
22125
|
+
const { gen, schema: schema11, parentSchema, data, it } = cxt;
|
|
22126
22126
|
let min;
|
|
22127
22127
|
let max;
|
|
22128
22128
|
const { minContains, maxContains } = parentSchema;
|
|
@@ -22143,7 +22143,7 @@ var require_contains = __commonJS({
|
|
|
22143
22143
|
cxt.fail();
|
|
22144
22144
|
return;
|
|
22145
22145
|
}
|
|
22146
|
-
if ((0, util_1.alwaysValidSchema)(it,
|
|
22146
|
+
if ((0, util_1.alwaysValidSchema)(it, schema11)) {
|
|
22147
22147
|
let cond = (0, codegen_1._)`${len} >= ${min}`;
|
|
22148
22148
|
if (max !== void 0)
|
|
22149
22149
|
cond = (0, codegen_1._)`${cond} && ${len} <= ${max}`;
|
|
@@ -22228,14 +22228,14 @@ var require_dependencies = __commonJS({
|
|
|
22228
22228
|
validateSchemaDeps(cxt, schDeps);
|
|
22229
22229
|
}
|
|
22230
22230
|
};
|
|
22231
|
-
function splitDependencies({ schema:
|
|
22231
|
+
function splitDependencies({ schema: schema11 }) {
|
|
22232
22232
|
const propertyDeps = {};
|
|
22233
22233
|
const schemaDeps = {};
|
|
22234
|
-
for (const key3 in
|
|
22234
|
+
for (const key3 in schema11) {
|
|
22235
22235
|
if (key3 === "__proto__")
|
|
22236
22236
|
continue;
|
|
22237
|
-
const deps = Array.isArray(
|
|
22238
|
-
deps[key3] =
|
|
22237
|
+
const deps = Array.isArray(schema11[key3]) ? propertyDeps : schemaDeps;
|
|
22238
|
+
deps[key3] = schema11[key3];
|
|
22239
22239
|
}
|
|
22240
22240
|
return [propertyDeps, schemaDeps];
|
|
22241
22241
|
}
|
|
@@ -22308,8 +22308,8 @@ var require_propertyNames = __commonJS({
|
|
|
22308
22308
|
schemaType: ["object", "boolean"],
|
|
22309
22309
|
error: error51,
|
|
22310
22310
|
code(cxt) {
|
|
22311
|
-
const { gen, schema:
|
|
22312
|
-
if ((0, util_1.alwaysValidSchema)(it,
|
|
22311
|
+
const { gen, schema: schema11, data, it } = cxt;
|
|
22312
|
+
if ((0, util_1.alwaysValidSchema)(it, schema11))
|
|
22313
22313
|
return;
|
|
22314
22314
|
const valid = gen.name("valid");
|
|
22315
22315
|
gen.forIn("key", data, (key3) => {
|
|
@@ -22355,12 +22355,12 @@ var require_additionalProperties = __commonJS({
|
|
|
22355
22355
|
trackErrors: true,
|
|
22356
22356
|
error: error51,
|
|
22357
22357
|
code(cxt) {
|
|
22358
|
-
const { gen, schema:
|
|
22358
|
+
const { gen, schema: schema11, parentSchema, data, errsCount, it } = cxt;
|
|
22359
22359
|
if (!errsCount)
|
|
22360
22360
|
throw new Error("ajv implementation error");
|
|
22361
22361
|
const { allErrors, opts } = it;
|
|
22362
22362
|
it.props = true;
|
|
22363
|
-
if (opts.removeAdditional !== "all" && (0, util_1.alwaysValidSchema)(it,
|
|
22363
|
+
if (opts.removeAdditional !== "all" && (0, util_1.alwaysValidSchema)(it, schema11))
|
|
22364
22364
|
return;
|
|
22365
22365
|
const props = (0, code_1.allSchemaProperties)(parentSchema.properties);
|
|
22366
22366
|
const patProps = (0, code_1.allSchemaProperties)(parentSchema.patternProperties);
|
|
@@ -22393,18 +22393,18 @@ var require_additionalProperties = __commonJS({
|
|
|
22393
22393
|
gen.code((0, codegen_1._)`delete ${data}[${key3}]`);
|
|
22394
22394
|
}
|
|
22395
22395
|
function additionalPropertyCode(key3) {
|
|
22396
|
-
if (opts.removeAdditional === "all" || opts.removeAdditional &&
|
|
22396
|
+
if (opts.removeAdditional === "all" || opts.removeAdditional && schema11 === false) {
|
|
22397
22397
|
deleteAdditional(key3);
|
|
22398
22398
|
return;
|
|
22399
22399
|
}
|
|
22400
|
-
if (
|
|
22400
|
+
if (schema11 === false) {
|
|
22401
22401
|
cxt.setParams({ additionalProperty: key3 });
|
|
22402
22402
|
cxt.error();
|
|
22403
22403
|
if (!allErrors)
|
|
22404
22404
|
gen.break();
|
|
22405
22405
|
return;
|
|
22406
22406
|
}
|
|
22407
|
-
if (typeof
|
|
22407
|
+
if (typeof schema11 == "object" && !(0, util_1.alwaysValidSchema)(it, schema11)) {
|
|
22408
22408
|
const valid = gen.name("valid");
|
|
22409
22409
|
if (opts.removeAdditional === "failing") {
|
|
22410
22410
|
applyAdditionalSchema(key3, valid, false);
|
|
@@ -22454,18 +22454,18 @@ var require_properties = __commonJS({
|
|
|
22454
22454
|
type: "object",
|
|
22455
22455
|
schemaType: "object",
|
|
22456
22456
|
code(cxt) {
|
|
22457
|
-
const { gen, schema:
|
|
22457
|
+
const { gen, schema: schema11, parentSchema, data, it } = cxt;
|
|
22458
22458
|
if (it.opts.removeAdditional === "all" && parentSchema.additionalProperties === void 0) {
|
|
22459
22459
|
additionalProperties_1.default.code(new validate_1.KeywordCxt(it, additionalProperties_1.default, "additionalProperties"));
|
|
22460
22460
|
}
|
|
22461
|
-
const allProps = (0, code_1.allSchemaProperties)(
|
|
22461
|
+
const allProps = (0, code_1.allSchemaProperties)(schema11);
|
|
22462
22462
|
for (const prop of allProps) {
|
|
22463
22463
|
it.definedProperties.add(prop);
|
|
22464
22464
|
}
|
|
22465
22465
|
if (it.opts.unevaluated && allProps.length && it.props !== true) {
|
|
22466
22466
|
it.props = util_1.mergeEvaluated.props(gen, (0, util_1.toHash)(allProps), it.props);
|
|
22467
22467
|
}
|
|
22468
|
-
const properties = allProps.filter((p) => !(0, util_1.alwaysValidSchema)(it,
|
|
22468
|
+
const properties = allProps.filter((p) => !(0, util_1.alwaysValidSchema)(it, schema11[p]));
|
|
22469
22469
|
if (properties.length === 0)
|
|
22470
22470
|
return;
|
|
22471
22471
|
const valid = gen.name("valid");
|
|
@@ -22483,7 +22483,7 @@ var require_properties = __commonJS({
|
|
|
22483
22483
|
cxt.ok(valid);
|
|
22484
22484
|
}
|
|
22485
22485
|
function hasDefault(prop) {
|
|
22486
|
-
return it.opts.useDefaults && !it.compositeRule &&
|
|
22486
|
+
return it.opts.useDefaults && !it.compositeRule && schema11[prop].default !== void 0;
|
|
22487
22487
|
}
|
|
22488
22488
|
function applyPropertySchema(prop) {
|
|
22489
22489
|
cxt.subschema({
|
|
@@ -22512,10 +22512,10 @@ var require_patternProperties = __commonJS({
|
|
|
22512
22512
|
type: "object",
|
|
22513
22513
|
schemaType: "object",
|
|
22514
22514
|
code(cxt) {
|
|
22515
|
-
const { gen, schema:
|
|
22515
|
+
const { gen, schema: schema11, data, parentSchema, it } = cxt;
|
|
22516
22516
|
const { opts } = it;
|
|
22517
|
-
const patterns = (0, code_1.allSchemaProperties)(
|
|
22518
|
-
const alwaysValidPatterns = patterns.filter((p) => (0, util_1.alwaysValidSchema)(it,
|
|
22517
|
+
const patterns = (0, code_1.allSchemaProperties)(schema11);
|
|
22518
|
+
const alwaysValidPatterns = patterns.filter((p) => (0, util_1.alwaysValidSchema)(it, schema11[p]));
|
|
22519
22519
|
if (patterns.length === 0 || alwaysValidPatterns.length === patterns.length && (!it.opts.unevaluated || it.props === true)) {
|
|
22520
22520
|
return;
|
|
22521
22521
|
}
|
|
@@ -22583,8 +22583,8 @@ var require_not = __commonJS({
|
|
|
22583
22583
|
schemaType: ["object", "boolean"],
|
|
22584
22584
|
trackErrors: true,
|
|
22585
22585
|
code(cxt) {
|
|
22586
|
-
const { gen, schema:
|
|
22587
|
-
if ((0, util_1.alwaysValidSchema)(it,
|
|
22586
|
+
const { gen, schema: schema11, it } = cxt;
|
|
22587
|
+
if ((0, util_1.alwaysValidSchema)(it, schema11)) {
|
|
22588
22588
|
cxt.fail();
|
|
22589
22589
|
return;
|
|
22590
22590
|
}
|
|
@@ -22637,12 +22637,12 @@ var require_oneOf = __commonJS({
|
|
|
22637
22637
|
trackErrors: true,
|
|
22638
22638
|
error: error51,
|
|
22639
22639
|
code(cxt) {
|
|
22640
|
-
const { gen, schema:
|
|
22641
|
-
if (!Array.isArray(
|
|
22640
|
+
const { gen, schema: schema11, parentSchema, it } = cxt;
|
|
22641
|
+
if (!Array.isArray(schema11))
|
|
22642
22642
|
throw new Error("ajv implementation error");
|
|
22643
22643
|
if (it.opts.discriminator && parentSchema.discriminator)
|
|
22644
22644
|
return;
|
|
22645
|
-
const schArr =
|
|
22645
|
+
const schArr = schema11;
|
|
22646
22646
|
const valid = gen.let("valid", false);
|
|
22647
22647
|
const passing = gen.let("passing", null);
|
|
22648
22648
|
const schValid = gen.name("_valid");
|
|
@@ -22688,11 +22688,11 @@ var require_allOf = __commonJS({
|
|
|
22688
22688
|
keyword: "allOf",
|
|
22689
22689
|
schemaType: "array",
|
|
22690
22690
|
code(cxt) {
|
|
22691
|
-
const { gen, schema:
|
|
22692
|
-
if (!Array.isArray(
|
|
22691
|
+
const { gen, schema: schema11, it } = cxt;
|
|
22692
|
+
if (!Array.isArray(schema11))
|
|
22693
22693
|
throw new Error("ajv implementation error");
|
|
22694
22694
|
const valid = gen.name("valid");
|
|
22695
|
-
|
|
22695
|
+
schema11.forEach((sch, i) => {
|
|
22696
22696
|
if ((0, util_1.alwaysValidSchema)(it, sch))
|
|
22697
22697
|
return;
|
|
22698
22698
|
const schCxt = cxt.subschema({ keyword: "allOf", schemaProp: i }, valid);
|
|
@@ -22767,8 +22767,8 @@ var require_if = __commonJS({
|
|
|
22767
22767
|
}
|
|
22768
22768
|
};
|
|
22769
22769
|
function hasSchema(it, keyword) {
|
|
22770
|
-
const
|
|
22771
|
-
return
|
|
22770
|
+
const schema11 = it.schema[keyword];
|
|
22771
|
+
return schema11 !== void 0 && !(0, util_1.alwaysValidSchema)(it, schema11);
|
|
22772
22772
|
}
|
|
22773
22773
|
exports2.default = def;
|
|
22774
22774
|
}
|
|
@@ -22857,7 +22857,7 @@ var require_format = __commonJS({
|
|
|
22857
22857
|
$data: true,
|
|
22858
22858
|
error: error51,
|
|
22859
22859
|
code(cxt, ruleType) {
|
|
22860
|
-
const { gen, data, $data, schema:
|
|
22860
|
+
const { gen, data, $data, schema: schema11, schemaCode, it } = cxt;
|
|
22861
22861
|
const { opts, errSchemaPath, schemaEnv, self } = it;
|
|
22862
22862
|
if (!opts.validateFormats)
|
|
22863
22863
|
return;
|
|
@@ -22887,7 +22887,7 @@ var require_format = __commonJS({
|
|
|
22887
22887
|
}
|
|
22888
22888
|
}
|
|
22889
22889
|
function validateFormat() {
|
|
22890
|
-
const formatDef = self.formats[
|
|
22890
|
+
const formatDef = self.formats[schema11];
|
|
22891
22891
|
if (!formatDef) {
|
|
22892
22892
|
unknownFormat();
|
|
22893
22893
|
return;
|
|
@@ -22904,12 +22904,12 @@ var require_format = __commonJS({
|
|
|
22904
22904
|
}
|
|
22905
22905
|
throw new Error(unknownMsg());
|
|
22906
22906
|
function unknownMsg() {
|
|
22907
|
-
return `unknown format "${
|
|
22907
|
+
return `unknown format "${schema11}" ignored in schema at path "${errSchemaPath}"`;
|
|
22908
22908
|
}
|
|
22909
22909
|
}
|
|
22910
22910
|
function getFormat(fmtDef) {
|
|
22911
|
-
const code = fmtDef instanceof RegExp ? (0, codegen_1.regexpCode)(fmtDef) : opts.code.formats ? (0, codegen_1._)`${opts.code.formats}${(0, codegen_1.getProperty)(
|
|
22912
|
-
const fmt = gen.scopeValue("formats", { key:
|
|
22911
|
+
const code = fmtDef instanceof RegExp ? (0, codegen_1.regexpCode)(fmtDef) : opts.code.formats ? (0, codegen_1._)`${opts.code.formats}${(0, codegen_1.getProperty)(schema11)}` : void 0;
|
|
22912
|
+
const fmt = gen.scopeValue("formats", { key: schema11, ref: fmtDef, code });
|
|
22913
22913
|
if (typeof fmtDef == "object" && !(fmtDef instanceof RegExp)) {
|
|
22914
22914
|
return [fmtDef.type || "string", fmtDef.validate, (0, codegen_1._)`${fmt}.validate`];
|
|
22915
22915
|
}
|
|
@@ -23020,15 +23020,15 @@ var require_discriminator = __commonJS({
|
|
|
23020
23020
|
schemaType: "object",
|
|
23021
23021
|
error: error51,
|
|
23022
23022
|
code(cxt) {
|
|
23023
|
-
const { gen, data, schema:
|
|
23023
|
+
const { gen, data, schema: schema11, parentSchema, it } = cxt;
|
|
23024
23024
|
const { oneOf } = parentSchema;
|
|
23025
23025
|
if (!it.opts.discriminator) {
|
|
23026
23026
|
throw new Error("discriminator: requires discriminator option");
|
|
23027
23027
|
}
|
|
23028
|
-
const tagName =
|
|
23028
|
+
const tagName = schema11.propertyName;
|
|
23029
23029
|
if (typeof tagName != "string")
|
|
23030
23030
|
throw new Error("discriminator: requires propertyName");
|
|
23031
|
-
if (
|
|
23031
|
+
if (schema11.mapping)
|
|
23032
23032
|
throw new Error("discriminator: mapping is not supported");
|
|
23033
23033
|
if (!oneOf)
|
|
23034
23034
|
throw new Error("discriminator: requires oneOf keyword");
|
|
@@ -25418,8 +25418,8 @@ function mergeDefs(...defs) {
|
|
|
25418
25418
|
}
|
|
25419
25419
|
return Object.defineProperties({}, mergedDescriptors);
|
|
25420
25420
|
}
|
|
25421
|
-
function cloneDef(
|
|
25422
|
-
return mergeDefs(
|
|
25421
|
+
function cloneDef(schema11) {
|
|
25422
|
+
return mergeDefs(schema11._zod.def);
|
|
25423
25423
|
}
|
|
25424
25424
|
function getElementAtPath(obj, path65) {
|
|
25425
25425
|
if (!path65)
|
|
@@ -25641,14 +25641,14 @@ var BIGINT_FORMAT_RANGES = {
|
|
|
25641
25641
|
int64: [/* @__PURE__ */ BigInt("-9223372036854775808"), /* @__PURE__ */ BigInt("9223372036854775807")],
|
|
25642
25642
|
uint64: [/* @__PURE__ */ BigInt(0), /* @__PURE__ */ BigInt("18446744073709551615")]
|
|
25643
25643
|
};
|
|
25644
|
-
function pick(
|
|
25645
|
-
const currDef =
|
|
25644
|
+
function pick(schema11, mask) {
|
|
25645
|
+
const currDef = schema11._zod.def;
|
|
25646
25646
|
const checks = currDef.checks;
|
|
25647
25647
|
const hasChecks = checks && checks.length > 0;
|
|
25648
25648
|
if (hasChecks) {
|
|
25649
25649
|
throw new Error(".pick() cannot be used on object schemas containing refinements");
|
|
25650
25650
|
}
|
|
25651
|
-
const def = mergeDefs(
|
|
25651
|
+
const def = mergeDefs(schema11._zod.def, {
|
|
25652
25652
|
get shape() {
|
|
25653
25653
|
const newShape = {};
|
|
25654
25654
|
for (const key3 in mask) {
|
|
@@ -25664,18 +25664,18 @@ function pick(schema10, mask) {
|
|
|
25664
25664
|
},
|
|
25665
25665
|
checks: []
|
|
25666
25666
|
});
|
|
25667
|
-
return clone(
|
|
25667
|
+
return clone(schema11, def);
|
|
25668
25668
|
}
|
|
25669
|
-
function omit(
|
|
25670
|
-
const currDef =
|
|
25669
|
+
function omit(schema11, mask) {
|
|
25670
|
+
const currDef = schema11._zod.def;
|
|
25671
25671
|
const checks = currDef.checks;
|
|
25672
25672
|
const hasChecks = checks && checks.length > 0;
|
|
25673
25673
|
if (hasChecks) {
|
|
25674
25674
|
throw new Error(".omit() cannot be used on object schemas containing refinements");
|
|
25675
25675
|
}
|
|
25676
|
-
const def = mergeDefs(
|
|
25676
|
+
const def = mergeDefs(schema11._zod.def, {
|
|
25677
25677
|
get shape() {
|
|
25678
|
-
const newShape = { ...
|
|
25678
|
+
const newShape = { ...schema11._zod.def.shape };
|
|
25679
25679
|
for (const key3 in mask) {
|
|
25680
25680
|
if (!(key3 in currDef.shape)) {
|
|
25681
25681
|
throw new Error(`Unrecognized key: "${key3}"`);
|
|
@@ -25689,43 +25689,43 @@ function omit(schema10, mask) {
|
|
|
25689
25689
|
},
|
|
25690
25690
|
checks: []
|
|
25691
25691
|
});
|
|
25692
|
-
return clone(
|
|
25692
|
+
return clone(schema11, def);
|
|
25693
25693
|
}
|
|
25694
|
-
function extend(
|
|
25694
|
+
function extend(schema11, shape) {
|
|
25695
25695
|
if (!isPlainObject(shape)) {
|
|
25696
25696
|
throw new Error("Invalid input to extend: expected a plain object");
|
|
25697
25697
|
}
|
|
25698
|
-
const checks =
|
|
25698
|
+
const checks = schema11._zod.def.checks;
|
|
25699
25699
|
const hasChecks = checks && checks.length > 0;
|
|
25700
25700
|
if (hasChecks) {
|
|
25701
|
-
const existingShape =
|
|
25701
|
+
const existingShape = schema11._zod.def.shape;
|
|
25702
25702
|
for (const key3 in shape) {
|
|
25703
25703
|
if (Object.getOwnPropertyDescriptor(existingShape, key3) !== void 0) {
|
|
25704
25704
|
throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.");
|
|
25705
25705
|
}
|
|
25706
25706
|
}
|
|
25707
25707
|
}
|
|
25708
|
-
const def = mergeDefs(
|
|
25708
|
+
const def = mergeDefs(schema11._zod.def, {
|
|
25709
25709
|
get shape() {
|
|
25710
|
-
const _shape = { ...
|
|
25710
|
+
const _shape = { ...schema11._zod.def.shape, ...shape };
|
|
25711
25711
|
assignProp(this, "shape", _shape);
|
|
25712
25712
|
return _shape;
|
|
25713
25713
|
}
|
|
25714
25714
|
});
|
|
25715
|
-
return clone(
|
|
25715
|
+
return clone(schema11, def);
|
|
25716
25716
|
}
|
|
25717
|
-
function safeExtend(
|
|
25717
|
+
function safeExtend(schema11, shape) {
|
|
25718
25718
|
if (!isPlainObject(shape)) {
|
|
25719
25719
|
throw new Error("Invalid input to safeExtend: expected a plain object");
|
|
25720
25720
|
}
|
|
25721
|
-
const def = mergeDefs(
|
|
25721
|
+
const def = mergeDefs(schema11._zod.def, {
|
|
25722
25722
|
get shape() {
|
|
25723
|
-
const _shape = { ...
|
|
25723
|
+
const _shape = { ...schema11._zod.def.shape, ...shape };
|
|
25724
25724
|
assignProp(this, "shape", _shape);
|
|
25725
25725
|
return _shape;
|
|
25726
25726
|
}
|
|
25727
25727
|
});
|
|
25728
|
-
return clone(
|
|
25728
|
+
return clone(schema11, def);
|
|
25729
25729
|
}
|
|
25730
25730
|
function merge(a, b) {
|
|
25731
25731
|
if (a._zod.def.checks?.length) {
|
|
@@ -25744,16 +25744,16 @@ function merge(a, b) {
|
|
|
25744
25744
|
});
|
|
25745
25745
|
return clone(a, def);
|
|
25746
25746
|
}
|
|
25747
|
-
function partial(Class2,
|
|
25748
|
-
const currDef =
|
|
25747
|
+
function partial(Class2, schema11, mask) {
|
|
25748
|
+
const currDef = schema11._zod.def;
|
|
25749
25749
|
const checks = currDef.checks;
|
|
25750
25750
|
const hasChecks = checks && checks.length > 0;
|
|
25751
25751
|
if (hasChecks) {
|
|
25752
25752
|
throw new Error(".partial() cannot be used on object schemas containing refinements");
|
|
25753
25753
|
}
|
|
25754
|
-
const def = mergeDefs(
|
|
25754
|
+
const def = mergeDefs(schema11._zod.def, {
|
|
25755
25755
|
get shape() {
|
|
25756
|
-
const oldShape =
|
|
25756
|
+
const oldShape = schema11._zod.def.shape;
|
|
25757
25757
|
const shape = { ...oldShape };
|
|
25758
25758
|
if (mask) {
|
|
25759
25759
|
for (const key3 in mask) {
|
|
@@ -25780,12 +25780,12 @@ function partial(Class2, schema10, mask) {
|
|
|
25780
25780
|
},
|
|
25781
25781
|
checks: []
|
|
25782
25782
|
});
|
|
25783
|
-
return clone(
|
|
25783
|
+
return clone(schema11, def);
|
|
25784
25784
|
}
|
|
25785
|
-
function required(Class2,
|
|
25786
|
-
const def = mergeDefs(
|
|
25785
|
+
function required(Class2, schema11, mask) {
|
|
25786
|
+
const def = mergeDefs(schema11._zod.def, {
|
|
25787
25787
|
get shape() {
|
|
25788
|
-
const oldShape =
|
|
25788
|
+
const oldShape = schema11._zod.def.shape;
|
|
25789
25789
|
const shape = { ...oldShape };
|
|
25790
25790
|
if (mask) {
|
|
25791
25791
|
for (const key3 in mask) {
|
|
@@ -25811,7 +25811,7 @@ function required(Class2, schema10, mask) {
|
|
|
25811
25811
|
return shape;
|
|
25812
25812
|
}
|
|
25813
25813
|
});
|
|
25814
|
-
return clone(
|
|
25814
|
+
return clone(schema11, def);
|
|
25815
25815
|
}
|
|
25816
25816
|
function aborted(x, startIndex = 0) {
|
|
25817
25817
|
if (x.aborted === true)
|
|
@@ -26090,9 +26090,9 @@ function prettifyError(error51) {
|
|
|
26090
26090
|
}
|
|
26091
26091
|
|
|
26092
26092
|
// ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/parse.js
|
|
26093
|
-
var _parse = (_Err) => (
|
|
26093
|
+
var _parse = (_Err) => (schema11, value, _ctx, _params) => {
|
|
26094
26094
|
const ctx = _ctx ? { ..._ctx, async: false } : { async: false };
|
|
26095
|
-
const result =
|
|
26095
|
+
const result = schema11._zod.run({ value, issues: [] }, ctx);
|
|
26096
26096
|
if (result instanceof Promise) {
|
|
26097
26097
|
throw new $ZodAsyncError();
|
|
26098
26098
|
}
|
|
@@ -26104,9 +26104,9 @@ var _parse = (_Err) => (schema10, value, _ctx, _params) => {
|
|
|
26104
26104
|
return result.value;
|
|
26105
26105
|
};
|
|
26106
26106
|
var parse = /* @__PURE__ */ _parse($ZodRealError);
|
|
26107
|
-
var _parseAsync = (_Err) => async (
|
|
26107
|
+
var _parseAsync = (_Err) => async (schema11, value, _ctx, params3) => {
|
|
26108
26108
|
const ctx = _ctx ? { ..._ctx, async: true } : { async: true };
|
|
26109
|
-
let result =
|
|
26109
|
+
let result = schema11._zod.run({ value, issues: [] }, ctx);
|
|
26110
26110
|
if (result instanceof Promise)
|
|
26111
26111
|
result = await result;
|
|
26112
26112
|
if (result.issues.length) {
|
|
@@ -26117,9 +26117,9 @@ var _parseAsync = (_Err) => async (schema10, value, _ctx, params3) => {
|
|
|
26117
26117
|
return result.value;
|
|
26118
26118
|
};
|
|
26119
26119
|
var parseAsync = /* @__PURE__ */ _parseAsync($ZodRealError);
|
|
26120
|
-
var _safeParse = (_Err) => (
|
|
26120
|
+
var _safeParse = (_Err) => (schema11, value, _ctx) => {
|
|
26121
26121
|
const ctx = _ctx ? { ..._ctx, async: false } : { async: false };
|
|
26122
|
-
const result =
|
|
26122
|
+
const result = schema11._zod.run({ value, issues: [] }, ctx);
|
|
26123
26123
|
if (result instanceof Promise) {
|
|
26124
26124
|
throw new $ZodAsyncError();
|
|
26125
26125
|
}
|
|
@@ -26129,9 +26129,9 @@ var _safeParse = (_Err) => (schema10, value, _ctx) => {
|
|
|
26129
26129
|
} : { success: true, data: result.value };
|
|
26130
26130
|
};
|
|
26131
26131
|
var safeParse = /* @__PURE__ */ _safeParse($ZodRealError);
|
|
26132
|
-
var _safeParseAsync = (_Err) => async (
|
|
26132
|
+
var _safeParseAsync = (_Err) => async (schema11, value, _ctx) => {
|
|
26133
26133
|
const ctx = _ctx ? { ..._ctx, async: true } : { async: true };
|
|
26134
|
-
let result =
|
|
26134
|
+
let result = schema11._zod.run({ value, issues: [] }, ctx);
|
|
26135
26135
|
if (result instanceof Promise)
|
|
26136
26136
|
result = await result;
|
|
26137
26137
|
return result.issues.length ? {
|
|
@@ -26140,40 +26140,40 @@ var _safeParseAsync = (_Err) => async (schema10, value, _ctx) => {
|
|
|
26140
26140
|
} : { success: true, data: result.value };
|
|
26141
26141
|
};
|
|
26142
26142
|
var safeParseAsync = /* @__PURE__ */ _safeParseAsync($ZodRealError);
|
|
26143
|
-
var _encode = (_Err) => (
|
|
26143
|
+
var _encode = (_Err) => (schema11, value, _ctx) => {
|
|
26144
26144
|
const ctx = _ctx ? { ..._ctx, direction: "backward" } : { direction: "backward" };
|
|
26145
|
-
return _parse(_Err)(
|
|
26145
|
+
return _parse(_Err)(schema11, value, ctx);
|
|
26146
26146
|
};
|
|
26147
26147
|
var encode = /* @__PURE__ */ _encode($ZodRealError);
|
|
26148
|
-
var _decode = (_Err) => (
|
|
26149
|
-
return _parse(_Err)(
|
|
26148
|
+
var _decode = (_Err) => (schema11, value, _ctx) => {
|
|
26149
|
+
return _parse(_Err)(schema11, value, _ctx);
|
|
26150
26150
|
};
|
|
26151
26151
|
var decode = /* @__PURE__ */ _decode($ZodRealError);
|
|
26152
|
-
var _encodeAsync = (_Err) => async (
|
|
26152
|
+
var _encodeAsync = (_Err) => async (schema11, value, _ctx) => {
|
|
26153
26153
|
const ctx = _ctx ? { ..._ctx, direction: "backward" } : { direction: "backward" };
|
|
26154
|
-
return _parseAsync(_Err)(
|
|
26154
|
+
return _parseAsync(_Err)(schema11, value, ctx);
|
|
26155
26155
|
};
|
|
26156
26156
|
var encodeAsync = /* @__PURE__ */ _encodeAsync($ZodRealError);
|
|
26157
|
-
var _decodeAsync = (_Err) => async (
|
|
26158
|
-
return _parseAsync(_Err)(
|
|
26157
|
+
var _decodeAsync = (_Err) => async (schema11, value, _ctx) => {
|
|
26158
|
+
return _parseAsync(_Err)(schema11, value, _ctx);
|
|
26159
26159
|
};
|
|
26160
26160
|
var decodeAsync = /* @__PURE__ */ _decodeAsync($ZodRealError);
|
|
26161
|
-
var _safeEncode = (_Err) => (
|
|
26161
|
+
var _safeEncode = (_Err) => (schema11, value, _ctx) => {
|
|
26162
26162
|
const ctx = _ctx ? { ..._ctx, direction: "backward" } : { direction: "backward" };
|
|
26163
|
-
return _safeParse(_Err)(
|
|
26163
|
+
return _safeParse(_Err)(schema11, value, ctx);
|
|
26164
26164
|
};
|
|
26165
26165
|
var safeEncode = /* @__PURE__ */ _safeEncode($ZodRealError);
|
|
26166
|
-
var _safeDecode = (_Err) => (
|
|
26167
|
-
return _safeParse(_Err)(
|
|
26166
|
+
var _safeDecode = (_Err) => (schema11, value, _ctx) => {
|
|
26167
|
+
return _safeParse(_Err)(schema11, value, _ctx);
|
|
26168
26168
|
};
|
|
26169
26169
|
var safeDecode = /* @__PURE__ */ _safeDecode($ZodRealError);
|
|
26170
|
-
var _safeEncodeAsync = (_Err) => async (
|
|
26170
|
+
var _safeEncodeAsync = (_Err) => async (schema11, value, _ctx) => {
|
|
26171
26171
|
const ctx = _ctx ? { ..._ctx, direction: "backward" } : { direction: "backward" };
|
|
26172
|
-
return _safeParseAsync(_Err)(
|
|
26172
|
+
return _safeParseAsync(_Err)(schema11, value, ctx);
|
|
26173
26173
|
};
|
|
26174
26174
|
var safeEncodeAsync = /* @__PURE__ */ _safeEncodeAsync($ZodRealError);
|
|
26175
|
-
var _safeDecodeAsync = (_Err) => async (
|
|
26176
|
-
return _safeParseAsync(_Err)(
|
|
26175
|
+
var _safeDecodeAsync = (_Err) => async (schema11, value, _ctx) => {
|
|
26176
|
+
return _safeParseAsync(_Err)(schema11, value, _ctx);
|
|
26177
26177
|
};
|
|
26178
26178
|
var safeDecodeAsync = /* @__PURE__ */ _safeDecodeAsync($ZodRealError);
|
|
26179
26179
|
|
|
@@ -27567,9 +27567,9 @@ var $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
|
|
|
27567
27567
|
payload.value = Array(input.length);
|
|
27568
27568
|
const proms = [];
|
|
27569
27569
|
for (let i = 0; i < input.length; i++) {
|
|
27570
|
-
const
|
|
27570
|
+
const item2 = input[i];
|
|
27571
27571
|
const result = def.element._zod.run({
|
|
27572
|
-
value:
|
|
27572
|
+
value: item2,
|
|
27573
27573
|
issues: []
|
|
27574
27574
|
}, ctx);
|
|
27575
27575
|
if (result instanceof Promise) {
|
|
@@ -27749,9 +27749,9 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
27749
27749
|
for (const key3 of normalized.keys) {
|
|
27750
27750
|
const id = ids[key3];
|
|
27751
27751
|
const k = esc(key3);
|
|
27752
|
-
const
|
|
27753
|
-
const isOptionalIn =
|
|
27754
|
-
const isOptionalOut =
|
|
27752
|
+
const schema11 = shape[key3];
|
|
27753
|
+
const isOptionalIn = schema11?._zod?.optin === "optional";
|
|
27754
|
+
const isOptionalOut = schema11?._zod?.optout === "optional";
|
|
27755
27755
|
doc.write(`const ${id} = ${parseStr(key3)};`);
|
|
27756
27756
|
if (isOptionalIn && isOptionalOut) {
|
|
27757
27757
|
doc.write(`
|
|
@@ -28446,8 +28446,8 @@ var $ZodSet = /* @__PURE__ */ $constructor("$ZodSet", (inst, def) => {
|
|
|
28446
28446
|
}
|
|
28447
28447
|
const proms = [];
|
|
28448
28448
|
payload.value = /* @__PURE__ */ new Set();
|
|
28449
|
-
for (const
|
|
28450
|
-
const result = def.valueType._zod.run({ value:
|
|
28449
|
+
for (const item2 of input) {
|
|
28450
|
+
const result = def.valueType._zod.run({ value: item2, issues: [] }, ctx);
|
|
28451
28451
|
if (result instanceof Promise) {
|
|
28452
28452
|
proms.push(result.then((result2) => handleSetResult(result2, payload)));
|
|
28453
28453
|
} else
|
|
@@ -34984,11 +34984,11 @@ var $ZodRegistry = class {
|
|
|
34984
34984
|
this._map = /* @__PURE__ */ new WeakMap();
|
|
34985
34985
|
this._idmap = /* @__PURE__ */ new Map();
|
|
34986
34986
|
}
|
|
34987
|
-
add(
|
|
34987
|
+
add(schema11, ..._meta) {
|
|
34988
34988
|
const meta3 = _meta[0];
|
|
34989
|
-
this._map.set(
|
|
34989
|
+
this._map.set(schema11, meta3);
|
|
34990
34990
|
if (meta3 && typeof meta3 === "object" && "id" in meta3) {
|
|
34991
|
-
this._idmap.set(meta3.id,
|
|
34991
|
+
this._idmap.set(meta3.id, schema11);
|
|
34992
34992
|
}
|
|
34993
34993
|
return this;
|
|
34994
34994
|
}
|
|
@@ -34997,26 +34997,26 @@ var $ZodRegistry = class {
|
|
|
34997
34997
|
this._idmap = /* @__PURE__ */ new Map();
|
|
34998
34998
|
return this;
|
|
34999
34999
|
}
|
|
35000
|
-
remove(
|
|
35001
|
-
const meta3 = this._map.get(
|
|
35000
|
+
remove(schema11) {
|
|
35001
|
+
const meta3 = this._map.get(schema11);
|
|
35002
35002
|
if (meta3 && typeof meta3 === "object" && "id" in meta3) {
|
|
35003
35003
|
this._idmap.delete(meta3.id);
|
|
35004
35004
|
}
|
|
35005
|
-
this._map.delete(
|
|
35005
|
+
this._map.delete(schema11);
|
|
35006
35006
|
return this;
|
|
35007
35007
|
}
|
|
35008
|
-
get(
|
|
35009
|
-
const p =
|
|
35008
|
+
get(schema11) {
|
|
35009
|
+
const p = schema11._zod.parent;
|
|
35010
35010
|
if (p) {
|
|
35011
35011
|
const pm = { ...this.get(p) ?? {} };
|
|
35012
35012
|
delete pm.id;
|
|
35013
|
-
const f = { ...pm, ...this._map.get(
|
|
35013
|
+
const f = { ...pm, ...this._map.get(schema11) };
|
|
35014
35014
|
return Object.keys(f).length ? f : void 0;
|
|
35015
35015
|
}
|
|
35016
|
-
return this._map.get(
|
|
35016
|
+
return this._map.get(schema11);
|
|
35017
35017
|
}
|
|
35018
|
-
has(
|
|
35019
|
-
return this._map.has(
|
|
35018
|
+
has(schema11) {
|
|
35019
|
+
return this._map.has(schema11);
|
|
35020
35020
|
}
|
|
35021
35021
|
};
|
|
35022
35022
|
function registry() {
|
|
@@ -35669,11 +35669,11 @@ function _endsWith(suffix, params3) {
|
|
|
35669
35669
|
});
|
|
35670
35670
|
}
|
|
35671
35671
|
// @__NO_SIDE_EFFECTS__
|
|
35672
|
-
function _property(property,
|
|
35672
|
+
function _property(property, schema11, params3) {
|
|
35673
35673
|
return new $ZodCheckProperty({
|
|
35674
35674
|
check: "property",
|
|
35675
35675
|
property,
|
|
35676
|
-
schema:
|
|
35676
|
+
schema: schema11,
|
|
35677
35677
|
...normalizeParams(params3)
|
|
35678
35678
|
});
|
|
35679
35679
|
}
|
|
@@ -35921,23 +35921,23 @@ function _promise(Class2, innerType) {
|
|
|
35921
35921
|
function _custom(Class2, fn, _params) {
|
|
35922
35922
|
const norm2 = normalizeParams(_params);
|
|
35923
35923
|
norm2.abort ?? (norm2.abort = true);
|
|
35924
|
-
const
|
|
35924
|
+
const schema11 = new Class2({
|
|
35925
35925
|
type: "custom",
|
|
35926
35926
|
check: "custom",
|
|
35927
35927
|
fn,
|
|
35928
35928
|
...norm2
|
|
35929
35929
|
});
|
|
35930
|
-
return
|
|
35930
|
+
return schema11;
|
|
35931
35931
|
}
|
|
35932
35932
|
// @__NO_SIDE_EFFECTS__
|
|
35933
35933
|
function _refine(Class2, fn, _params) {
|
|
35934
|
-
const
|
|
35934
|
+
const schema11 = new Class2({
|
|
35935
35935
|
type: "custom",
|
|
35936
35936
|
check: "custom",
|
|
35937
35937
|
fn,
|
|
35938
35938
|
...normalizeParams(_params)
|
|
35939
35939
|
});
|
|
35940
|
-
return
|
|
35940
|
+
return schema11;
|
|
35941
35941
|
}
|
|
35942
35942
|
// @__NO_SIDE_EFFECTS__
|
|
35943
35943
|
function _superRefine(fn, params3) {
|
|
@@ -36086,40 +36086,40 @@ function initializeContext(params3) {
|
|
|
36086
36086
|
external: params3?.external ?? void 0
|
|
36087
36087
|
};
|
|
36088
36088
|
}
|
|
36089
|
-
function process2(
|
|
36089
|
+
function process2(schema11, ctx, _params = { path: [], schemaPath: [] }) {
|
|
36090
36090
|
var _a3;
|
|
36091
|
-
const def =
|
|
36092
|
-
const seen = ctx.seen.get(
|
|
36091
|
+
const def = schema11._zod.def;
|
|
36092
|
+
const seen = ctx.seen.get(schema11);
|
|
36093
36093
|
if (seen) {
|
|
36094
36094
|
seen.count++;
|
|
36095
|
-
const isCycle = _params.schemaPath.includes(
|
|
36095
|
+
const isCycle = _params.schemaPath.includes(schema11);
|
|
36096
36096
|
if (isCycle) {
|
|
36097
36097
|
seen.cycle = _params.path;
|
|
36098
36098
|
}
|
|
36099
36099
|
return seen.schema;
|
|
36100
36100
|
}
|
|
36101
36101
|
const result = { schema: {}, count: 1, cycle: void 0, path: _params.path };
|
|
36102
|
-
ctx.seen.set(
|
|
36103
|
-
const overrideSchema =
|
|
36102
|
+
ctx.seen.set(schema11, result);
|
|
36103
|
+
const overrideSchema = schema11._zod.toJSONSchema?.();
|
|
36104
36104
|
if (overrideSchema) {
|
|
36105
36105
|
result.schema = overrideSchema;
|
|
36106
36106
|
} else {
|
|
36107
36107
|
const params3 = {
|
|
36108
36108
|
..._params,
|
|
36109
|
-
schemaPath: [..._params.schemaPath,
|
|
36109
|
+
schemaPath: [..._params.schemaPath, schema11],
|
|
36110
36110
|
path: _params.path
|
|
36111
36111
|
};
|
|
36112
|
-
if (
|
|
36113
|
-
|
|
36112
|
+
if (schema11._zod.processJSONSchema) {
|
|
36113
|
+
schema11._zod.processJSONSchema(ctx, result.schema, params3);
|
|
36114
36114
|
} else {
|
|
36115
36115
|
const _json = result.schema;
|
|
36116
36116
|
const processor = ctx.processors[def.type];
|
|
36117
36117
|
if (!processor) {
|
|
36118
36118
|
throw new Error(`[toJSONSchema]: Non-representable type encountered: ${def.type}`);
|
|
36119
36119
|
}
|
|
36120
|
-
processor(
|
|
36120
|
+
processor(schema11, ctx, _json, params3);
|
|
36121
36121
|
}
|
|
36122
|
-
const parent =
|
|
36122
|
+
const parent = schema11._zod.parent;
|
|
36123
36123
|
if (parent) {
|
|
36124
36124
|
if (!result.ref)
|
|
36125
36125
|
result.ref = parent;
|
|
@@ -36127,21 +36127,21 @@ function process2(schema10, ctx, _params = { path: [], schemaPath: [] }) {
|
|
|
36127
36127
|
ctx.seen.get(parent).isParent = true;
|
|
36128
36128
|
}
|
|
36129
36129
|
}
|
|
36130
|
-
const meta3 = ctx.metadataRegistry.get(
|
|
36130
|
+
const meta3 = ctx.metadataRegistry.get(schema11);
|
|
36131
36131
|
if (meta3)
|
|
36132
36132
|
Object.assign(result.schema, meta3);
|
|
36133
|
-
if (ctx.io === "input" && isTransforming(
|
|
36133
|
+
if (ctx.io === "input" && isTransforming(schema11)) {
|
|
36134
36134
|
delete result.schema.examples;
|
|
36135
36135
|
delete result.schema.default;
|
|
36136
36136
|
}
|
|
36137
36137
|
if (ctx.io === "input" && "_prefault" in result.schema)
|
|
36138
36138
|
(_a3 = result.schema).default ?? (_a3.default = result.schema._prefault);
|
|
36139
36139
|
delete result.schema._prefault;
|
|
36140
|
-
const _result = ctx.seen.get(
|
|
36140
|
+
const _result = ctx.seen.get(schema11);
|
|
36141
36141
|
return _result.schema;
|
|
36142
36142
|
}
|
|
36143
|
-
function extractDefs(ctx,
|
|
36144
|
-
const root = ctx.seen.get(
|
|
36143
|
+
function extractDefs(ctx, schema11) {
|
|
36144
|
+
const root = ctx.seen.get(schema11);
|
|
36145
36145
|
if (!root)
|
|
36146
36146
|
throw new Error("Unprocessed schema. This is a bug in Zod.");
|
|
36147
36147
|
const idToSchema = /* @__PURE__ */ new Map();
|
|
@@ -36184,11 +36184,11 @@ function extractDefs(ctx, schema10) {
|
|
|
36184
36184
|
seen.def = { ...seen.schema };
|
|
36185
36185
|
if (defId)
|
|
36186
36186
|
seen.defId = defId;
|
|
36187
|
-
const
|
|
36188
|
-
for (const key3 in
|
|
36189
|
-
delete
|
|
36187
|
+
const schema12 = seen.schema;
|
|
36188
|
+
for (const key3 in schema12) {
|
|
36189
|
+
delete schema12[key3];
|
|
36190
36190
|
}
|
|
36191
|
-
|
|
36191
|
+
schema12.$ref = ref;
|
|
36192
36192
|
};
|
|
36193
36193
|
if (ctx.cycles === "throw") {
|
|
36194
36194
|
for (const entry of ctx.seen.entries()) {
|
|
@@ -36202,13 +36202,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
36202
36202
|
}
|
|
36203
36203
|
for (const entry of ctx.seen.entries()) {
|
|
36204
36204
|
const seen = entry[1];
|
|
36205
|
-
if (
|
|
36205
|
+
if (schema11 === entry[0]) {
|
|
36206
36206
|
extractToDef(entry);
|
|
36207
36207
|
continue;
|
|
36208
36208
|
}
|
|
36209
36209
|
if (ctx.external) {
|
|
36210
36210
|
const ext = ctx.external.registry.get(entry[0])?.id;
|
|
36211
|
-
if (
|
|
36211
|
+
if (schema11 !== entry[0] && ext) {
|
|
36212
36212
|
extractToDef(entry);
|
|
36213
36213
|
continue;
|
|
36214
36214
|
}
|
|
@@ -36230,16 +36230,16 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
36230
36230
|
}
|
|
36231
36231
|
}
|
|
36232
36232
|
}
|
|
36233
|
-
function finalize(ctx,
|
|
36234
|
-
const root = ctx.seen.get(
|
|
36233
|
+
function finalize(ctx, schema11) {
|
|
36234
|
+
const root = ctx.seen.get(schema11);
|
|
36235
36235
|
if (!root)
|
|
36236
36236
|
throw new Error("Unprocessed schema. This is a bug in Zod.");
|
|
36237
36237
|
const flattenRef = (zodSchema) => {
|
|
36238
36238
|
const seen = ctx.seen.get(zodSchema);
|
|
36239
36239
|
if (seen.ref === null)
|
|
36240
36240
|
return;
|
|
36241
|
-
const
|
|
36242
|
-
const _cached = { ...
|
|
36241
|
+
const schema12 = seen.def ?? seen.schema;
|
|
36242
|
+
const _cached = { ...schema12 };
|
|
36243
36243
|
const ref = seen.ref;
|
|
36244
36244
|
seen.ref = null;
|
|
36245
36245
|
if (ref) {
|
|
@@ -36247,28 +36247,28 @@ function finalize(ctx, schema10) {
|
|
|
36247
36247
|
const refSeen = ctx.seen.get(ref);
|
|
36248
36248
|
const refSchema = refSeen.schema;
|
|
36249
36249
|
if (refSchema.$ref && (ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0")) {
|
|
36250
|
-
|
|
36251
|
-
|
|
36250
|
+
schema12.allOf = schema12.allOf ?? [];
|
|
36251
|
+
schema12.allOf.push(refSchema);
|
|
36252
36252
|
} else {
|
|
36253
|
-
Object.assign(
|
|
36253
|
+
Object.assign(schema12, refSchema);
|
|
36254
36254
|
}
|
|
36255
|
-
Object.assign(
|
|
36255
|
+
Object.assign(schema12, _cached);
|
|
36256
36256
|
const isParentRef = zodSchema._zod.parent === ref;
|
|
36257
36257
|
if (isParentRef) {
|
|
36258
|
-
for (const key3 in
|
|
36258
|
+
for (const key3 in schema12) {
|
|
36259
36259
|
if (key3 === "$ref" || key3 === "allOf")
|
|
36260
36260
|
continue;
|
|
36261
36261
|
if (!(key3 in _cached)) {
|
|
36262
|
-
delete
|
|
36262
|
+
delete schema12[key3];
|
|
36263
36263
|
}
|
|
36264
36264
|
}
|
|
36265
36265
|
}
|
|
36266
36266
|
if (refSchema.$ref && refSeen.def) {
|
|
36267
|
-
for (const key3 in
|
|
36267
|
+
for (const key3 in schema12) {
|
|
36268
36268
|
if (key3 === "$ref" || key3 === "allOf")
|
|
36269
36269
|
continue;
|
|
36270
|
-
if (key3 in refSeen.def && JSON.stringify(
|
|
36271
|
-
delete
|
|
36270
|
+
if (key3 in refSeen.def && JSON.stringify(schema12[key3]) === JSON.stringify(refSeen.def[key3])) {
|
|
36271
|
+
delete schema12[key3];
|
|
36272
36272
|
}
|
|
36273
36273
|
}
|
|
36274
36274
|
}
|
|
@@ -36278,13 +36278,13 @@ function finalize(ctx, schema10) {
|
|
|
36278
36278
|
flattenRef(parent);
|
|
36279
36279
|
const parentSeen = ctx.seen.get(parent);
|
|
36280
36280
|
if (parentSeen?.schema.$ref) {
|
|
36281
|
-
|
|
36281
|
+
schema12.$ref = parentSeen.schema.$ref;
|
|
36282
36282
|
if (parentSeen.def) {
|
|
36283
|
-
for (const key3 in
|
|
36283
|
+
for (const key3 in schema12) {
|
|
36284
36284
|
if (key3 === "$ref" || key3 === "allOf")
|
|
36285
36285
|
continue;
|
|
36286
|
-
if (key3 in parentSeen.def && JSON.stringify(
|
|
36287
|
-
delete
|
|
36286
|
+
if (key3 in parentSeen.def && JSON.stringify(schema12[key3]) === JSON.stringify(parentSeen.def[key3])) {
|
|
36287
|
+
delete schema12[key3];
|
|
36288
36288
|
}
|
|
36289
36289
|
}
|
|
36290
36290
|
}
|
|
@@ -36292,7 +36292,7 @@ function finalize(ctx, schema10) {
|
|
|
36292
36292
|
}
|
|
36293
36293
|
ctx.override({
|
|
36294
36294
|
zodSchema,
|
|
36295
|
-
jsonSchema:
|
|
36295
|
+
jsonSchema: schema12,
|
|
36296
36296
|
path: seen.path ?? []
|
|
36297
36297
|
});
|
|
36298
36298
|
};
|
|
@@ -36310,13 +36310,13 @@ function finalize(ctx, schema10) {
|
|
|
36310
36310
|
} else {
|
|
36311
36311
|
}
|
|
36312
36312
|
if (ctx.external?.uri) {
|
|
36313
|
-
const id = ctx.external.registry.get(
|
|
36313
|
+
const id = ctx.external.registry.get(schema11)?.id;
|
|
36314
36314
|
if (!id)
|
|
36315
36315
|
throw new Error("Schema is missing an `id` property");
|
|
36316
36316
|
result.$id = ctx.external.uri(id);
|
|
36317
36317
|
}
|
|
36318
36318
|
Object.assign(result, root.def ?? root.schema);
|
|
36319
|
-
const rootMetaId = ctx.metadataRegistry.get(
|
|
36319
|
+
const rootMetaId = ctx.metadataRegistry.get(schema11)?.id;
|
|
36320
36320
|
if (rootMetaId !== void 0 && result.id === rootMetaId)
|
|
36321
36321
|
delete result.id;
|
|
36322
36322
|
const defs = ctx.external?.defs ?? {};
|
|
@@ -36342,10 +36342,10 @@ function finalize(ctx, schema10) {
|
|
|
36342
36342
|
const finalized = JSON.parse(JSON.stringify(result));
|
|
36343
36343
|
Object.defineProperty(finalized, "~standard", {
|
|
36344
36344
|
value: {
|
|
36345
|
-
...
|
|
36345
|
+
...schema11["~standard"],
|
|
36346
36346
|
jsonSchema: {
|
|
36347
|
-
input: createStandardJSONSchemaMethod(
|
|
36348
|
-
output: createStandardJSONSchemaMethod(
|
|
36347
|
+
input: createStandardJSONSchemaMethod(schema11, "input", ctx.processors),
|
|
36348
|
+
output: createStandardJSONSchemaMethod(schema11, "output", ctx.processors)
|
|
36349
36349
|
}
|
|
36350
36350
|
},
|
|
36351
36351
|
enumerable: false,
|
|
@@ -36399,8 +36399,8 @@ function isTransforming(_schema, _ctx) {
|
|
|
36399
36399
|
return false;
|
|
36400
36400
|
}
|
|
36401
36401
|
if (def.type === "tuple") {
|
|
36402
|
-
for (const
|
|
36403
|
-
if (isTransforming(
|
|
36402
|
+
for (const item2 of def.items) {
|
|
36403
|
+
if (isTransforming(item2, ctx))
|
|
36404
36404
|
return true;
|
|
36405
36405
|
}
|
|
36406
36406
|
if (def.rest && isTransforming(def.rest, ctx))
|
|
@@ -36409,18 +36409,18 @@ function isTransforming(_schema, _ctx) {
|
|
|
36409
36409
|
}
|
|
36410
36410
|
return false;
|
|
36411
36411
|
}
|
|
36412
|
-
var createToJSONSchemaMethod = (
|
|
36412
|
+
var createToJSONSchemaMethod = (schema11, processors = {}) => (params3) => {
|
|
36413
36413
|
const ctx = initializeContext({ ...params3, processors });
|
|
36414
|
-
process2(
|
|
36415
|
-
extractDefs(ctx,
|
|
36416
|
-
return finalize(ctx,
|
|
36414
|
+
process2(schema11, ctx);
|
|
36415
|
+
extractDefs(ctx, schema11);
|
|
36416
|
+
return finalize(ctx, schema11);
|
|
36417
36417
|
};
|
|
36418
|
-
var createStandardJSONSchemaMethod = (
|
|
36418
|
+
var createStandardJSONSchemaMethod = (schema11, io, processors = {}) => (params3) => {
|
|
36419
36419
|
const { libraryOptions, target } = params3 ?? {};
|
|
36420
36420
|
const ctx = initializeContext({ ...libraryOptions ?? {}, target, io, processors });
|
|
36421
|
-
process2(
|
|
36422
|
-
extractDefs(ctx,
|
|
36423
|
-
return finalize(ctx,
|
|
36421
|
+
process2(schema11, ctx);
|
|
36422
|
+
extractDefs(ctx, schema11);
|
|
36423
|
+
return finalize(ctx, schema11);
|
|
36424
36424
|
};
|
|
36425
36425
|
|
|
36426
36426
|
// ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/json-schema-processors.js
|
|
@@ -36432,10 +36432,10 @@ var formatMap = {
|
|
|
36432
36432
|
regex: ""
|
|
36433
36433
|
// do not set
|
|
36434
36434
|
};
|
|
36435
|
-
var stringProcessor = (
|
|
36435
|
+
var stringProcessor = (schema11, ctx, _json, _params) => {
|
|
36436
36436
|
const json2 = _json;
|
|
36437
36437
|
json2.type = "string";
|
|
36438
|
-
const { minimum, maximum, format, patterns, contentEncoding } =
|
|
36438
|
+
const { minimum, maximum, format, patterns, contentEncoding } = schema11._zod.bag;
|
|
36439
36439
|
if (typeof minimum === "number")
|
|
36440
36440
|
json2.minLength = minimum;
|
|
36441
36441
|
if (typeof maximum === "number")
|
|
@@ -36464,9 +36464,9 @@ var stringProcessor = (schema10, ctx, _json, _params) => {
|
|
|
36464
36464
|
}
|
|
36465
36465
|
}
|
|
36466
36466
|
};
|
|
36467
|
-
var numberProcessor = (
|
|
36467
|
+
var numberProcessor = (schema11, ctx, _json, _params) => {
|
|
36468
36468
|
const json2 = _json;
|
|
36469
|
-
const { minimum, maximum, format, multipleOf, exclusiveMaximum, exclusiveMinimum } =
|
|
36469
|
+
const { minimum, maximum, format, multipleOf, exclusiveMaximum, exclusiveMinimum } = schema11._zod.bag;
|
|
36470
36470
|
if (typeof format === "string" && format.includes("int"))
|
|
36471
36471
|
json2.type = "integer";
|
|
36472
36472
|
else
|
|
@@ -36541,8 +36541,8 @@ var dateProcessor = (_schema, ctx, _json, _params) => {
|
|
|
36541
36541
|
throw new Error("Date cannot be represented in JSON Schema");
|
|
36542
36542
|
}
|
|
36543
36543
|
};
|
|
36544
|
-
var enumProcessor = (
|
|
36545
|
-
const def =
|
|
36544
|
+
var enumProcessor = (schema11, _ctx, json2, _params) => {
|
|
36545
|
+
const def = schema11._zod.def;
|
|
36546
36546
|
const values = getEnumValues(def.entries);
|
|
36547
36547
|
if (values.every((v) => typeof v === "number"))
|
|
36548
36548
|
json2.type = "number";
|
|
@@ -36550,8 +36550,8 @@ var enumProcessor = (schema10, _ctx, json2, _params) => {
|
|
|
36550
36550
|
json2.type = "string";
|
|
36551
36551
|
json2.enum = values;
|
|
36552
36552
|
};
|
|
36553
|
-
var literalProcessor = (
|
|
36554
|
-
const def =
|
|
36553
|
+
var literalProcessor = (schema11, ctx, json2, _params) => {
|
|
36554
|
+
const def = schema11._zod.def;
|
|
36555
36555
|
const vals = [];
|
|
36556
36556
|
for (const val of def.values) {
|
|
36557
36557
|
if (val === void 0) {
|
|
@@ -36595,22 +36595,22 @@ var nanProcessor = (_schema, ctx, _json, _params) => {
|
|
|
36595
36595
|
throw new Error("NaN cannot be represented in JSON Schema");
|
|
36596
36596
|
}
|
|
36597
36597
|
};
|
|
36598
|
-
var templateLiteralProcessor = (
|
|
36598
|
+
var templateLiteralProcessor = (schema11, _ctx, json2, _params) => {
|
|
36599
36599
|
const _json = json2;
|
|
36600
|
-
const pattern =
|
|
36600
|
+
const pattern = schema11._zod.pattern;
|
|
36601
36601
|
if (!pattern)
|
|
36602
36602
|
throw new Error("Pattern not found in template literal");
|
|
36603
36603
|
_json.type = "string";
|
|
36604
36604
|
_json.pattern = pattern.source;
|
|
36605
36605
|
};
|
|
36606
|
-
var fileProcessor = (
|
|
36606
|
+
var fileProcessor = (schema11, _ctx, json2, _params) => {
|
|
36607
36607
|
const _json = json2;
|
|
36608
36608
|
const file2 = {
|
|
36609
36609
|
type: "string",
|
|
36610
36610
|
format: "binary",
|
|
36611
36611
|
contentEncoding: "binary"
|
|
36612
36612
|
};
|
|
36613
|
-
const { minimum, maximum, mime } =
|
|
36613
|
+
const { minimum, maximum, mime } = schema11._zod.bag;
|
|
36614
36614
|
if (minimum !== void 0)
|
|
36615
36615
|
file2.minLength = minimum;
|
|
36616
36616
|
if (maximum !== void 0)
|
|
@@ -36655,10 +36655,10 @@ var setProcessor = (_schema, ctx, _json, _params) => {
|
|
|
36655
36655
|
throw new Error("Set cannot be represented in JSON Schema");
|
|
36656
36656
|
}
|
|
36657
36657
|
};
|
|
36658
|
-
var arrayProcessor = (
|
|
36658
|
+
var arrayProcessor = (schema11, ctx, _json, params3) => {
|
|
36659
36659
|
const json2 = _json;
|
|
36660
|
-
const def =
|
|
36661
|
-
const { minimum, maximum } =
|
|
36660
|
+
const def = schema11._zod.def;
|
|
36661
|
+
const { minimum, maximum } = schema11._zod.bag;
|
|
36662
36662
|
if (typeof minimum === "number")
|
|
36663
36663
|
json2.minItems = minimum;
|
|
36664
36664
|
if (typeof maximum === "number")
|
|
@@ -36669,9 +36669,9 @@ var arrayProcessor = (schema10, ctx, _json, params3) => {
|
|
|
36669
36669
|
path: [...params3.path, "items"]
|
|
36670
36670
|
});
|
|
36671
36671
|
};
|
|
36672
|
-
var objectProcessor = (
|
|
36672
|
+
var objectProcessor = (schema11, ctx, _json, params3) => {
|
|
36673
36673
|
const json2 = _json;
|
|
36674
|
-
const def =
|
|
36674
|
+
const def = schema11._zod.def;
|
|
36675
36675
|
json2.type = "object";
|
|
36676
36676
|
json2.properties = {};
|
|
36677
36677
|
const shape = def.shape;
|
|
@@ -36705,8 +36705,8 @@ var objectProcessor = (schema10, ctx, _json, params3) => {
|
|
|
36705
36705
|
});
|
|
36706
36706
|
}
|
|
36707
36707
|
};
|
|
36708
|
-
var unionProcessor = (
|
|
36709
|
-
const def =
|
|
36708
|
+
var unionProcessor = (schema11, ctx, json2, params3) => {
|
|
36709
|
+
const def = schema11._zod.def;
|
|
36710
36710
|
const isExclusive = def.inclusive === false;
|
|
36711
36711
|
const options = def.options.map((x, i) => process2(x, ctx, {
|
|
36712
36712
|
...params3,
|
|
@@ -36718,8 +36718,8 @@ var unionProcessor = (schema10, ctx, json2, params3) => {
|
|
|
36718
36718
|
json2.anyOf = options;
|
|
36719
36719
|
}
|
|
36720
36720
|
};
|
|
36721
|
-
var intersectionProcessor = (
|
|
36722
|
-
const def =
|
|
36721
|
+
var intersectionProcessor = (schema11, ctx, json2, params3) => {
|
|
36722
|
+
const def = schema11._zod.def;
|
|
36723
36723
|
const a = process2(def.left, ctx, {
|
|
36724
36724
|
...params3,
|
|
36725
36725
|
path: [...params3.path, "allOf", 0]
|
|
@@ -36735,9 +36735,9 @@ var intersectionProcessor = (schema10, ctx, json2, params3) => {
|
|
|
36735
36735
|
];
|
|
36736
36736
|
json2.allOf = allOf;
|
|
36737
36737
|
};
|
|
36738
|
-
var tupleProcessor = (
|
|
36738
|
+
var tupleProcessor = (schema11, ctx, _json, params3) => {
|
|
36739
36739
|
const json2 = _json;
|
|
36740
|
-
const def =
|
|
36740
|
+
const def = schema11._zod.def;
|
|
36741
36741
|
json2.type = "array";
|
|
36742
36742
|
const prefixPath = ctx.target === "draft-2020-12" ? "prefixItems" : "items";
|
|
36743
36743
|
const restPath = ctx.target === "draft-2020-12" ? "items" : ctx.target === "openapi-3.0" ? "items" : "additionalItems";
|
|
@@ -36771,15 +36771,15 @@ var tupleProcessor = (schema10, ctx, _json, params3) => {
|
|
|
36771
36771
|
json2.additionalItems = rest;
|
|
36772
36772
|
}
|
|
36773
36773
|
}
|
|
36774
|
-
const { minimum, maximum } =
|
|
36774
|
+
const { minimum, maximum } = schema11._zod.bag;
|
|
36775
36775
|
if (typeof minimum === "number")
|
|
36776
36776
|
json2.minItems = minimum;
|
|
36777
36777
|
if (typeof maximum === "number")
|
|
36778
36778
|
json2.maxItems = maximum;
|
|
36779
36779
|
};
|
|
36780
|
-
var recordProcessor = (
|
|
36780
|
+
var recordProcessor = (schema11, ctx, _json, params3) => {
|
|
36781
36781
|
const json2 = _json;
|
|
36782
|
-
const def =
|
|
36782
|
+
const def = schema11._zod.def;
|
|
36783
36783
|
json2.type = "object";
|
|
36784
36784
|
const keyType = def.keyType;
|
|
36785
36785
|
const keyBag = keyType._zod.bag;
|
|
@@ -36813,10 +36813,10 @@ var recordProcessor = (schema10, ctx, _json, params3) => {
|
|
|
36813
36813
|
}
|
|
36814
36814
|
}
|
|
36815
36815
|
};
|
|
36816
|
-
var nullableProcessor = (
|
|
36817
|
-
const def =
|
|
36816
|
+
var nullableProcessor = (schema11, ctx, json2, params3) => {
|
|
36817
|
+
const def = schema11._zod.def;
|
|
36818
36818
|
const inner = process2(def.innerType, ctx, params3);
|
|
36819
|
-
const seen = ctx.seen.get(
|
|
36819
|
+
const seen = ctx.seen.get(schema11);
|
|
36820
36820
|
if (ctx.target === "openapi-3.0") {
|
|
36821
36821
|
seen.ref = def.innerType;
|
|
36822
36822
|
json2.nullable = true;
|
|
@@ -36824,31 +36824,31 @@ var nullableProcessor = (schema10, ctx, json2, params3) => {
|
|
|
36824
36824
|
json2.anyOf = [inner, { type: "null" }];
|
|
36825
36825
|
}
|
|
36826
36826
|
};
|
|
36827
|
-
var nonoptionalProcessor = (
|
|
36828
|
-
const def =
|
|
36827
|
+
var nonoptionalProcessor = (schema11, ctx, _json, params3) => {
|
|
36828
|
+
const def = schema11._zod.def;
|
|
36829
36829
|
process2(def.innerType, ctx, params3);
|
|
36830
|
-
const seen = ctx.seen.get(
|
|
36830
|
+
const seen = ctx.seen.get(schema11);
|
|
36831
36831
|
seen.ref = def.innerType;
|
|
36832
36832
|
};
|
|
36833
|
-
var defaultProcessor = (
|
|
36834
|
-
const def =
|
|
36833
|
+
var defaultProcessor = (schema11, ctx, json2, params3) => {
|
|
36834
|
+
const def = schema11._zod.def;
|
|
36835
36835
|
process2(def.innerType, ctx, params3);
|
|
36836
|
-
const seen = ctx.seen.get(
|
|
36836
|
+
const seen = ctx.seen.get(schema11);
|
|
36837
36837
|
seen.ref = def.innerType;
|
|
36838
36838
|
json2.default = JSON.parse(JSON.stringify(def.defaultValue));
|
|
36839
36839
|
};
|
|
36840
|
-
var prefaultProcessor = (
|
|
36841
|
-
const def =
|
|
36840
|
+
var prefaultProcessor = (schema11, ctx, json2, params3) => {
|
|
36841
|
+
const def = schema11._zod.def;
|
|
36842
36842
|
process2(def.innerType, ctx, params3);
|
|
36843
|
-
const seen = ctx.seen.get(
|
|
36843
|
+
const seen = ctx.seen.get(schema11);
|
|
36844
36844
|
seen.ref = def.innerType;
|
|
36845
36845
|
if (ctx.io === "input")
|
|
36846
36846
|
json2._prefault = JSON.parse(JSON.stringify(def.defaultValue));
|
|
36847
36847
|
};
|
|
36848
|
-
var catchProcessor = (
|
|
36849
|
-
const def =
|
|
36848
|
+
var catchProcessor = (schema11, ctx, json2, params3) => {
|
|
36849
|
+
const def = schema11._zod.def;
|
|
36850
36850
|
process2(def.innerType, ctx, params3);
|
|
36851
|
-
const seen = ctx.seen.get(
|
|
36851
|
+
const seen = ctx.seen.get(schema11);
|
|
36852
36852
|
seen.ref = def.innerType;
|
|
36853
36853
|
let catchValue;
|
|
36854
36854
|
try {
|
|
@@ -36858,37 +36858,37 @@ var catchProcessor = (schema10, ctx, json2, params3) => {
|
|
|
36858
36858
|
}
|
|
36859
36859
|
json2.default = catchValue;
|
|
36860
36860
|
};
|
|
36861
|
-
var pipeProcessor = (
|
|
36862
|
-
const def =
|
|
36861
|
+
var pipeProcessor = (schema11, ctx, _json, params3) => {
|
|
36862
|
+
const def = schema11._zod.def;
|
|
36863
36863
|
const inIsTransform = def.in._zod.traits.has("$ZodTransform");
|
|
36864
36864
|
const innerType = ctx.io === "input" ? inIsTransform ? def.out : def.in : def.out;
|
|
36865
36865
|
process2(innerType, ctx, params3);
|
|
36866
|
-
const seen = ctx.seen.get(
|
|
36866
|
+
const seen = ctx.seen.get(schema11);
|
|
36867
36867
|
seen.ref = innerType;
|
|
36868
36868
|
};
|
|
36869
|
-
var readonlyProcessor = (
|
|
36870
|
-
const def =
|
|
36869
|
+
var readonlyProcessor = (schema11, ctx, json2, params3) => {
|
|
36870
|
+
const def = schema11._zod.def;
|
|
36871
36871
|
process2(def.innerType, ctx, params3);
|
|
36872
|
-
const seen = ctx.seen.get(
|
|
36872
|
+
const seen = ctx.seen.get(schema11);
|
|
36873
36873
|
seen.ref = def.innerType;
|
|
36874
36874
|
json2.readOnly = true;
|
|
36875
36875
|
};
|
|
36876
|
-
var promiseProcessor = (
|
|
36877
|
-
const def =
|
|
36876
|
+
var promiseProcessor = (schema11, ctx, _json, params3) => {
|
|
36877
|
+
const def = schema11._zod.def;
|
|
36878
36878
|
process2(def.innerType, ctx, params3);
|
|
36879
|
-
const seen = ctx.seen.get(
|
|
36879
|
+
const seen = ctx.seen.get(schema11);
|
|
36880
36880
|
seen.ref = def.innerType;
|
|
36881
36881
|
};
|
|
36882
|
-
var optionalProcessor = (
|
|
36883
|
-
const def =
|
|
36882
|
+
var optionalProcessor = (schema11, ctx, _json, params3) => {
|
|
36883
|
+
const def = schema11._zod.def;
|
|
36884
36884
|
process2(def.innerType, ctx, params3);
|
|
36885
|
-
const seen = ctx.seen.get(
|
|
36885
|
+
const seen = ctx.seen.get(schema11);
|
|
36886
36886
|
seen.ref = def.innerType;
|
|
36887
36887
|
};
|
|
36888
|
-
var lazyProcessor = (
|
|
36889
|
-
const innerType =
|
|
36888
|
+
var lazyProcessor = (schema11, ctx, _json, params3) => {
|
|
36889
|
+
const innerType = schema11._zod.innerType;
|
|
36890
36890
|
process2(innerType, ctx, params3);
|
|
36891
|
-
const seen = ctx.seen.get(
|
|
36891
|
+
const seen = ctx.seen.get(schema11);
|
|
36892
36892
|
seen.ref = innerType;
|
|
36893
36893
|
};
|
|
36894
36894
|
var allProcessors = {
|
|
@@ -36938,8 +36938,8 @@ function toJSONSchema(input, params3) {
|
|
|
36938
36938
|
const ctx2 = initializeContext({ ...params3, processors: allProcessors });
|
|
36939
36939
|
const defs = {};
|
|
36940
36940
|
for (const entry of registry2._idmap.entries()) {
|
|
36941
|
-
const [_,
|
|
36942
|
-
process2(
|
|
36941
|
+
const [_, schema11] = entry;
|
|
36942
|
+
process2(schema11, ctx2);
|
|
36943
36943
|
}
|
|
36944
36944
|
const schemas = {};
|
|
36945
36945
|
const external = {
|
|
@@ -36949,9 +36949,9 @@ function toJSONSchema(input, params3) {
|
|
|
36949
36949
|
};
|
|
36950
36950
|
ctx2.external = external;
|
|
36951
36951
|
for (const entry of registry2._idmap.entries()) {
|
|
36952
|
-
const [key3,
|
|
36953
|
-
extractDefs(ctx2,
|
|
36954
|
-
schemas[key3] = finalize(ctx2,
|
|
36952
|
+
const [key3, schema11] = entry;
|
|
36953
|
+
extractDefs(ctx2, schema11);
|
|
36954
|
+
schemas[key3] = finalize(ctx2, schema11);
|
|
36955
36955
|
}
|
|
36956
36956
|
if (Object.keys(defs).length > 0) {
|
|
36957
36957
|
const defsSegment = ctx2.target === "draft-2020-12" ? "$defs" : "definitions";
|
|
@@ -37019,14 +37019,14 @@ var JSONSchemaGenerator = class {
|
|
|
37019
37019
|
* Process a schema to prepare it for JSON Schema generation.
|
|
37020
37020
|
* This must be called before emit().
|
|
37021
37021
|
*/
|
|
37022
|
-
process(
|
|
37023
|
-
return process2(
|
|
37022
|
+
process(schema11, _params = { path: [], schemaPath: [] }) {
|
|
37023
|
+
return process2(schema11, this.ctx, _params);
|
|
37024
37024
|
}
|
|
37025
37025
|
/**
|
|
37026
37026
|
* Emit the final JSON Schema after processing.
|
|
37027
37027
|
* Must call process() first.
|
|
37028
37028
|
*/
|
|
37029
|
-
emit(
|
|
37029
|
+
emit(schema11, _params) {
|
|
37030
37030
|
if (_params) {
|
|
37031
37031
|
if (_params.cycles)
|
|
37032
37032
|
this.ctx.cycles = _params.cycles;
|
|
@@ -37035,8 +37035,8 @@ var JSONSchemaGenerator = class {
|
|
|
37035
37035
|
if (_params.external)
|
|
37036
37036
|
this.ctx.external = _params.external;
|
|
37037
37037
|
}
|
|
37038
|
-
extractDefs(this.ctx,
|
|
37039
|
-
const result = finalize(this.ctx,
|
|
37038
|
+
extractDefs(this.ctx, schema11);
|
|
37039
|
+
const result = finalize(this.ctx, schema11);
|
|
37040
37040
|
const { "~standard": _, ...plainResult } = result;
|
|
37041
37041
|
return plainResult;
|
|
37042
37042
|
}
|
|
@@ -38001,8 +38001,8 @@ var ZodArray = /* @__PURE__ */ $constructor("ZodArray", (inst, def) => {
|
|
|
38001
38001
|
function array(element, params3) {
|
|
38002
38002
|
return _array(ZodArray, element, params3);
|
|
38003
38003
|
}
|
|
38004
|
-
function keyof(
|
|
38005
|
-
const shape =
|
|
38004
|
+
function keyof(schema11) {
|
|
38005
|
+
const shape = schema11._zod.def.shape;
|
|
38006
38006
|
return _enum2(Object.keys(shape));
|
|
38007
38007
|
}
|
|
38008
38008
|
var ZodObject = /* @__PURE__ */ $constructor("ZodObject", (inst, def) => {
|
|
@@ -38627,11 +38627,11 @@ function json(params3) {
|
|
|
38627
38627
|
});
|
|
38628
38628
|
return jsonSchema;
|
|
38629
38629
|
}
|
|
38630
|
-
function preprocess(fn,
|
|
38630
|
+
function preprocess(fn, schema11) {
|
|
38631
38631
|
return new ZodPreprocess({
|
|
38632
38632
|
type: "pipe",
|
|
38633
38633
|
in: transform(fn),
|
|
38634
|
-
out:
|
|
38634
|
+
out: schema11
|
|
38635
38635
|
});
|
|
38636
38636
|
}
|
|
38637
38637
|
|
|
@@ -38738,8 +38738,8 @@ var RECOGNIZED_KEYS = /* @__PURE__ */ new Set([
|
|
|
38738
38738
|
"nullable",
|
|
38739
38739
|
"readOnly"
|
|
38740
38740
|
]);
|
|
38741
|
-
function detectVersion(
|
|
38742
|
-
const $schema =
|
|
38741
|
+
function detectVersion(schema11, defaultTarget) {
|
|
38742
|
+
const $schema = schema11.$schema;
|
|
38743
38743
|
if ($schema === "https://json-schema.org/draft/2020-12/schema") {
|
|
38744
38744
|
return "draft-2020-12";
|
|
38745
38745
|
}
|
|
@@ -38769,27 +38769,27 @@ function resolveRef(ref, ctx) {
|
|
|
38769
38769
|
}
|
|
38770
38770
|
throw new Error(`Reference not found: ${ref}`);
|
|
38771
38771
|
}
|
|
38772
|
-
function convertBaseSchema(
|
|
38773
|
-
if (
|
|
38774
|
-
if (typeof
|
|
38772
|
+
function convertBaseSchema(schema11, ctx) {
|
|
38773
|
+
if (schema11.not !== void 0) {
|
|
38774
|
+
if (typeof schema11.not === "object" && Object.keys(schema11.not).length === 0) {
|
|
38775
38775
|
return z.never();
|
|
38776
38776
|
}
|
|
38777
38777
|
throw new Error("not is not supported in Zod (except { not: {} } for never)");
|
|
38778
38778
|
}
|
|
38779
|
-
if (
|
|
38779
|
+
if (schema11.unevaluatedItems !== void 0) {
|
|
38780
38780
|
throw new Error("unevaluatedItems is not supported");
|
|
38781
38781
|
}
|
|
38782
|
-
if (
|
|
38782
|
+
if (schema11.unevaluatedProperties !== void 0) {
|
|
38783
38783
|
throw new Error("unevaluatedProperties is not supported");
|
|
38784
38784
|
}
|
|
38785
|
-
if (
|
|
38785
|
+
if (schema11.if !== void 0 || schema11.then !== void 0 || schema11.else !== void 0) {
|
|
38786
38786
|
throw new Error("Conditional schemas (if/then/else) are not supported");
|
|
38787
38787
|
}
|
|
38788
|
-
if (
|
|
38788
|
+
if (schema11.dependentSchemas !== void 0 || schema11.dependentRequired !== void 0) {
|
|
38789
38789
|
throw new Error("dependentSchemas and dependentRequired are not supported");
|
|
38790
38790
|
}
|
|
38791
|
-
if (
|
|
38792
|
-
const refPath =
|
|
38791
|
+
if (schema11.$ref) {
|
|
38792
|
+
const refPath = schema11.$ref;
|
|
38793
38793
|
if (ctx.refs.has(refPath)) {
|
|
38794
38794
|
return ctx.refs.get(refPath);
|
|
38795
38795
|
}
|
|
@@ -38808,9 +38808,9 @@ function convertBaseSchema(schema10, ctx) {
|
|
|
38808
38808
|
ctx.processing.delete(refPath);
|
|
38809
38809
|
return zodSchema2;
|
|
38810
38810
|
}
|
|
38811
|
-
if (
|
|
38812
|
-
const enumValues =
|
|
38813
|
-
if (ctx.version === "openapi-3.0" &&
|
|
38811
|
+
if (schema11.enum !== void 0) {
|
|
38812
|
+
const enumValues = schema11.enum;
|
|
38813
|
+
if (ctx.version === "openapi-3.0" && schema11.nullable === true && enumValues.length === 1 && enumValues[0] === null) {
|
|
38814
38814
|
return z.null();
|
|
38815
38815
|
}
|
|
38816
38816
|
if (enumValues.length === 0) {
|
|
@@ -38828,13 +38828,13 @@ function convertBaseSchema(schema10, ctx) {
|
|
|
38828
38828
|
}
|
|
38829
38829
|
return z.union([literalSchemas[0], literalSchemas[1], ...literalSchemas.slice(2)]);
|
|
38830
38830
|
}
|
|
38831
|
-
if (
|
|
38832
|
-
return z.literal(
|
|
38831
|
+
if (schema11.const !== void 0) {
|
|
38832
|
+
return z.literal(schema11.const);
|
|
38833
38833
|
}
|
|
38834
|
-
const type =
|
|
38834
|
+
const type = schema11.type;
|
|
38835
38835
|
if (Array.isArray(type)) {
|
|
38836
38836
|
const typeSchemas = type.map((t) => {
|
|
38837
|
-
const typeSchema = { ...
|
|
38837
|
+
const typeSchema = { ...schema11, type: t };
|
|
38838
38838
|
return convertBaseSchema(typeSchema, ctx);
|
|
38839
38839
|
});
|
|
38840
38840
|
if (typeSchemas.length === 0) {
|
|
@@ -38852,8 +38852,8 @@ function convertBaseSchema(schema10, ctx) {
|
|
|
38852
38852
|
switch (type) {
|
|
38853
38853
|
case "string": {
|
|
38854
38854
|
let stringSchema = z.string();
|
|
38855
|
-
if (
|
|
38856
|
-
const format =
|
|
38855
|
+
if (schema11.format) {
|
|
38856
|
+
const format = schema11.format;
|
|
38857
38857
|
if (format === "email") {
|
|
38858
38858
|
stringSchema = stringSchema.check(z.email());
|
|
38859
38859
|
} else if (format === "uri" || format === "uri-reference") {
|
|
@@ -38902,14 +38902,14 @@ function convertBaseSchema(schema10, ctx) {
|
|
|
38902
38902
|
stringSchema = stringSchema.check(z.ksuid());
|
|
38903
38903
|
}
|
|
38904
38904
|
}
|
|
38905
|
-
if (typeof
|
|
38906
|
-
stringSchema = stringSchema.min(
|
|
38905
|
+
if (typeof schema11.minLength === "number") {
|
|
38906
|
+
stringSchema = stringSchema.min(schema11.minLength);
|
|
38907
38907
|
}
|
|
38908
|
-
if (typeof
|
|
38909
|
-
stringSchema = stringSchema.max(
|
|
38908
|
+
if (typeof schema11.maxLength === "number") {
|
|
38909
|
+
stringSchema = stringSchema.max(schema11.maxLength);
|
|
38910
38910
|
}
|
|
38911
|
-
if (
|
|
38912
|
-
stringSchema = stringSchema.regex(new RegExp(
|
|
38911
|
+
if (schema11.pattern) {
|
|
38912
|
+
stringSchema = stringSchema.regex(new RegExp(schema11.pattern));
|
|
38913
38913
|
}
|
|
38914
38914
|
zodSchema = stringSchema;
|
|
38915
38915
|
break;
|
|
@@ -38917,24 +38917,24 @@ function convertBaseSchema(schema10, ctx) {
|
|
|
38917
38917
|
case "number":
|
|
38918
38918
|
case "integer": {
|
|
38919
38919
|
let numberSchema = type === "integer" ? z.number().int() : z.number();
|
|
38920
|
-
if (typeof
|
|
38921
|
-
numberSchema = numberSchema.min(
|
|
38920
|
+
if (typeof schema11.minimum === "number") {
|
|
38921
|
+
numberSchema = numberSchema.min(schema11.minimum);
|
|
38922
38922
|
}
|
|
38923
|
-
if (typeof
|
|
38924
|
-
numberSchema = numberSchema.max(
|
|
38923
|
+
if (typeof schema11.maximum === "number") {
|
|
38924
|
+
numberSchema = numberSchema.max(schema11.maximum);
|
|
38925
38925
|
}
|
|
38926
|
-
if (typeof
|
|
38927
|
-
numberSchema = numberSchema.gt(
|
|
38928
|
-
} else if (
|
|
38929
|
-
numberSchema = numberSchema.gt(
|
|
38926
|
+
if (typeof schema11.exclusiveMinimum === "number") {
|
|
38927
|
+
numberSchema = numberSchema.gt(schema11.exclusiveMinimum);
|
|
38928
|
+
} else if (schema11.exclusiveMinimum === true && typeof schema11.minimum === "number") {
|
|
38929
|
+
numberSchema = numberSchema.gt(schema11.minimum);
|
|
38930
38930
|
}
|
|
38931
|
-
if (typeof
|
|
38932
|
-
numberSchema = numberSchema.lt(
|
|
38933
|
-
} else if (
|
|
38934
|
-
numberSchema = numberSchema.lt(
|
|
38931
|
+
if (typeof schema11.exclusiveMaximum === "number") {
|
|
38932
|
+
numberSchema = numberSchema.lt(schema11.exclusiveMaximum);
|
|
38933
|
+
} else if (schema11.exclusiveMaximum === true && typeof schema11.maximum === "number") {
|
|
38934
|
+
numberSchema = numberSchema.lt(schema11.maximum);
|
|
38935
38935
|
}
|
|
38936
|
-
if (typeof
|
|
38937
|
-
numberSchema = numberSchema.multipleOf(
|
|
38936
|
+
if (typeof schema11.multipleOf === "number") {
|
|
38937
|
+
numberSchema = numberSchema.multipleOf(schema11.multipleOf);
|
|
38938
38938
|
}
|
|
38939
38939
|
zodSchema = numberSchema;
|
|
38940
38940
|
break;
|
|
@@ -38949,15 +38949,15 @@ function convertBaseSchema(schema10, ctx) {
|
|
|
38949
38949
|
}
|
|
38950
38950
|
case "object": {
|
|
38951
38951
|
const shape = {};
|
|
38952
|
-
const properties =
|
|
38953
|
-
const requiredSet = new Set(
|
|
38952
|
+
const properties = schema11.properties || {};
|
|
38953
|
+
const requiredSet = new Set(schema11.required || []);
|
|
38954
38954
|
for (const [key3, propSchema] of Object.entries(properties)) {
|
|
38955
38955
|
const propZodSchema = convertSchema(propSchema, ctx);
|
|
38956
38956
|
shape[key3] = requiredSet.has(key3) ? propZodSchema : propZodSchema.optional();
|
|
38957
38957
|
}
|
|
38958
|
-
if (
|
|
38959
|
-
const keySchema2 = convertSchema(
|
|
38960
|
-
const valueSchema =
|
|
38958
|
+
if (schema11.propertyNames) {
|
|
38959
|
+
const keySchema2 = convertSchema(schema11.propertyNames, ctx);
|
|
38960
|
+
const valueSchema = schema11.additionalProperties && typeof schema11.additionalProperties === "object" ? convertSchema(schema11.additionalProperties, ctx) : z.any();
|
|
38961
38961
|
if (Object.keys(shape).length === 0) {
|
|
38962
38962
|
zodSchema = z.record(keySchema2, valueSchema);
|
|
38963
38963
|
break;
|
|
@@ -38967,8 +38967,8 @@ function convertBaseSchema(schema10, ctx) {
|
|
|
38967
38967
|
zodSchema = z.intersection(objectSchema2, recordSchema);
|
|
38968
38968
|
break;
|
|
38969
38969
|
}
|
|
38970
|
-
if (
|
|
38971
|
-
const patternProps =
|
|
38970
|
+
if (schema11.patternProperties) {
|
|
38971
|
+
const patternProps = schema11.patternProperties;
|
|
38972
38972
|
const patternKeys = Object.keys(patternProps);
|
|
38973
38973
|
const looseRecords = [];
|
|
38974
38974
|
for (const pattern of patternKeys) {
|
|
@@ -38995,54 +38995,54 @@ function convertBaseSchema(schema10, ctx) {
|
|
|
38995
38995
|
break;
|
|
38996
38996
|
}
|
|
38997
38997
|
const objectSchema = z.object(shape);
|
|
38998
|
-
if (
|
|
38998
|
+
if (schema11.additionalProperties === false) {
|
|
38999
38999
|
zodSchema = objectSchema.strict();
|
|
39000
|
-
} else if (typeof
|
|
39001
|
-
zodSchema = objectSchema.catchall(convertSchema(
|
|
39000
|
+
} else if (typeof schema11.additionalProperties === "object") {
|
|
39001
|
+
zodSchema = objectSchema.catchall(convertSchema(schema11.additionalProperties, ctx));
|
|
39002
39002
|
} else {
|
|
39003
39003
|
zodSchema = objectSchema.passthrough();
|
|
39004
39004
|
}
|
|
39005
39005
|
break;
|
|
39006
39006
|
}
|
|
39007
39007
|
case "array": {
|
|
39008
|
-
const prefixItems =
|
|
39009
|
-
const items =
|
|
39008
|
+
const prefixItems = schema11.prefixItems;
|
|
39009
|
+
const items = schema11.items;
|
|
39010
39010
|
if (prefixItems && Array.isArray(prefixItems)) {
|
|
39011
|
-
const tupleItems = prefixItems.map((
|
|
39011
|
+
const tupleItems = prefixItems.map((item2) => convertSchema(item2, ctx));
|
|
39012
39012
|
const rest = items && typeof items === "object" && !Array.isArray(items) ? convertSchema(items, ctx) : void 0;
|
|
39013
39013
|
if (rest) {
|
|
39014
39014
|
zodSchema = z.tuple(tupleItems).rest(rest);
|
|
39015
39015
|
} else {
|
|
39016
39016
|
zodSchema = z.tuple(tupleItems);
|
|
39017
39017
|
}
|
|
39018
|
-
if (typeof
|
|
39019
|
-
zodSchema = zodSchema.check(z.minLength(
|
|
39018
|
+
if (typeof schema11.minItems === "number") {
|
|
39019
|
+
zodSchema = zodSchema.check(z.minLength(schema11.minItems));
|
|
39020
39020
|
}
|
|
39021
|
-
if (typeof
|
|
39022
|
-
zodSchema = zodSchema.check(z.maxLength(
|
|
39021
|
+
if (typeof schema11.maxItems === "number") {
|
|
39022
|
+
zodSchema = zodSchema.check(z.maxLength(schema11.maxItems));
|
|
39023
39023
|
}
|
|
39024
39024
|
} else if (Array.isArray(items)) {
|
|
39025
|
-
const tupleItems = items.map((
|
|
39026
|
-
const rest =
|
|
39025
|
+
const tupleItems = items.map((item2) => convertSchema(item2, ctx));
|
|
39026
|
+
const rest = schema11.additionalItems && typeof schema11.additionalItems === "object" ? convertSchema(schema11.additionalItems, ctx) : void 0;
|
|
39027
39027
|
if (rest) {
|
|
39028
39028
|
zodSchema = z.tuple(tupleItems).rest(rest);
|
|
39029
39029
|
} else {
|
|
39030
39030
|
zodSchema = z.tuple(tupleItems);
|
|
39031
39031
|
}
|
|
39032
|
-
if (typeof
|
|
39033
|
-
zodSchema = zodSchema.check(z.minLength(
|
|
39032
|
+
if (typeof schema11.minItems === "number") {
|
|
39033
|
+
zodSchema = zodSchema.check(z.minLength(schema11.minItems));
|
|
39034
39034
|
}
|
|
39035
|
-
if (typeof
|
|
39036
|
-
zodSchema = zodSchema.check(z.maxLength(
|
|
39035
|
+
if (typeof schema11.maxItems === "number") {
|
|
39036
|
+
zodSchema = zodSchema.check(z.maxLength(schema11.maxItems));
|
|
39037
39037
|
}
|
|
39038
39038
|
} else if (items !== void 0) {
|
|
39039
39039
|
const element = convertSchema(items, ctx);
|
|
39040
39040
|
let arraySchema = z.array(element);
|
|
39041
|
-
if (typeof
|
|
39042
|
-
arraySchema = arraySchema.min(
|
|
39041
|
+
if (typeof schema11.minItems === "number") {
|
|
39042
|
+
arraySchema = arraySchema.min(schema11.minItems);
|
|
39043
39043
|
}
|
|
39044
|
-
if (typeof
|
|
39045
|
-
arraySchema = arraySchema.max(
|
|
39044
|
+
if (typeof schema11.maxItems === "number") {
|
|
39045
|
+
arraySchema = arraySchema.max(schema11.maxItems);
|
|
39046
39046
|
}
|
|
39047
39047
|
zodSchema = arraySchema;
|
|
39048
39048
|
} else {
|
|
@@ -39055,76 +39055,76 @@ function convertBaseSchema(schema10, ctx) {
|
|
|
39055
39055
|
}
|
|
39056
39056
|
return zodSchema;
|
|
39057
39057
|
}
|
|
39058
|
-
function convertSchema(
|
|
39059
|
-
if (typeof
|
|
39060
|
-
return
|
|
39058
|
+
function convertSchema(schema11, ctx) {
|
|
39059
|
+
if (typeof schema11 === "boolean") {
|
|
39060
|
+
return schema11 ? z.any() : z.never();
|
|
39061
39061
|
}
|
|
39062
|
-
let baseSchema = convertBaseSchema(
|
|
39063
|
-
const hasExplicitType =
|
|
39064
|
-
if (
|
|
39065
|
-
const options =
|
|
39062
|
+
let baseSchema = convertBaseSchema(schema11, ctx);
|
|
39063
|
+
const hasExplicitType = schema11.type || schema11.enum !== void 0 || schema11.const !== void 0;
|
|
39064
|
+
if (schema11.anyOf && Array.isArray(schema11.anyOf)) {
|
|
39065
|
+
const options = schema11.anyOf.map((s) => convertSchema(s, ctx));
|
|
39066
39066
|
const anyOfUnion = z.union(options);
|
|
39067
39067
|
baseSchema = hasExplicitType ? z.intersection(baseSchema, anyOfUnion) : anyOfUnion;
|
|
39068
39068
|
}
|
|
39069
|
-
if (
|
|
39070
|
-
const options =
|
|
39069
|
+
if (schema11.oneOf && Array.isArray(schema11.oneOf)) {
|
|
39070
|
+
const options = schema11.oneOf.map((s) => convertSchema(s, ctx));
|
|
39071
39071
|
const oneOfUnion = z.xor(options);
|
|
39072
39072
|
baseSchema = hasExplicitType ? z.intersection(baseSchema, oneOfUnion) : oneOfUnion;
|
|
39073
39073
|
}
|
|
39074
|
-
if (
|
|
39075
|
-
if (
|
|
39074
|
+
if (schema11.allOf && Array.isArray(schema11.allOf)) {
|
|
39075
|
+
if (schema11.allOf.length === 0) {
|
|
39076
39076
|
baseSchema = hasExplicitType ? baseSchema : z.any();
|
|
39077
39077
|
} else {
|
|
39078
|
-
let result = hasExplicitType ? baseSchema : convertSchema(
|
|
39078
|
+
let result = hasExplicitType ? baseSchema : convertSchema(schema11.allOf[0], ctx);
|
|
39079
39079
|
const startIdx = hasExplicitType ? 0 : 1;
|
|
39080
|
-
for (let i = startIdx; i <
|
|
39081
|
-
result = z.intersection(result, convertSchema(
|
|
39080
|
+
for (let i = startIdx; i < schema11.allOf.length; i++) {
|
|
39081
|
+
result = z.intersection(result, convertSchema(schema11.allOf[i], ctx));
|
|
39082
39082
|
}
|
|
39083
39083
|
baseSchema = result;
|
|
39084
39084
|
}
|
|
39085
39085
|
}
|
|
39086
|
-
if (
|
|
39086
|
+
if (schema11.nullable === true && ctx.version === "openapi-3.0") {
|
|
39087
39087
|
baseSchema = z.nullable(baseSchema);
|
|
39088
39088
|
}
|
|
39089
|
-
if (
|
|
39089
|
+
if (schema11.readOnly === true) {
|
|
39090
39090
|
baseSchema = z.readonly(baseSchema);
|
|
39091
39091
|
}
|
|
39092
|
-
if (
|
|
39093
|
-
baseSchema = baseSchema.default(
|
|
39092
|
+
if (schema11.default !== void 0) {
|
|
39093
|
+
baseSchema = baseSchema.default(schema11.default);
|
|
39094
39094
|
}
|
|
39095
39095
|
const extraMeta = {};
|
|
39096
39096
|
const coreMetadataKeys = ["$id", "id", "$comment", "$anchor", "$vocabulary", "$dynamicRef", "$dynamicAnchor"];
|
|
39097
39097
|
for (const key3 of coreMetadataKeys) {
|
|
39098
|
-
if (key3 in
|
|
39099
|
-
extraMeta[key3] =
|
|
39098
|
+
if (key3 in schema11) {
|
|
39099
|
+
extraMeta[key3] = schema11[key3];
|
|
39100
39100
|
}
|
|
39101
39101
|
}
|
|
39102
39102
|
const contentMetadataKeys = ["contentEncoding", "contentMediaType", "contentSchema"];
|
|
39103
39103
|
for (const key3 of contentMetadataKeys) {
|
|
39104
|
-
if (key3 in
|
|
39105
|
-
extraMeta[key3] =
|
|
39104
|
+
if (key3 in schema11) {
|
|
39105
|
+
extraMeta[key3] = schema11[key3];
|
|
39106
39106
|
}
|
|
39107
39107
|
}
|
|
39108
|
-
for (const key3 of Object.keys(
|
|
39108
|
+
for (const key3 of Object.keys(schema11)) {
|
|
39109
39109
|
if (!RECOGNIZED_KEYS.has(key3)) {
|
|
39110
|
-
extraMeta[key3] =
|
|
39110
|
+
extraMeta[key3] = schema11[key3];
|
|
39111
39111
|
}
|
|
39112
39112
|
}
|
|
39113
39113
|
if (Object.keys(extraMeta).length > 0) {
|
|
39114
39114
|
ctx.registry.add(baseSchema, extraMeta);
|
|
39115
39115
|
}
|
|
39116
|
-
if (
|
|
39117
|
-
baseSchema = baseSchema.describe(
|
|
39116
|
+
if (schema11.description) {
|
|
39117
|
+
baseSchema = baseSchema.describe(schema11.description);
|
|
39118
39118
|
}
|
|
39119
39119
|
return baseSchema;
|
|
39120
39120
|
}
|
|
39121
|
-
function fromJSONSchema(
|
|
39122
|
-
if (typeof
|
|
39123
|
-
return
|
|
39121
|
+
function fromJSONSchema(schema11, params3) {
|
|
39122
|
+
if (typeof schema11 === "boolean") {
|
|
39123
|
+
return schema11 ? z.any() : z.never();
|
|
39124
39124
|
}
|
|
39125
39125
|
let normalized;
|
|
39126
39126
|
try {
|
|
39127
|
-
normalized = JSON.parse(JSON.stringify(
|
|
39127
|
+
normalized = JSON.parse(JSON.stringify(schema11));
|
|
39128
39128
|
} catch {
|
|
39129
39129
|
throw new Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas");
|
|
39130
39130
|
}
|
|
@@ -39379,7 +39379,13 @@ var strategyEdgeSchema = external_exports.object({
|
|
|
39379
39379
|
* The sender is told its answer must contain it, the receiver what it will be given - so what was agreed between
|
|
39380
39380
|
* two specialists is written down rather than left to each model's guess.
|
|
39381
39381
|
*/
|
|
39382
|
-
contract: external_exports.string().max(1e3).optional()
|
|
39382
|
+
contract: external_exports.string().max(1e3).optional(),
|
|
39383
|
+
/**
|
|
39384
|
+
* What the contract requires, item by item ("Changed files", "Tests run") - checked, not hoped for. The sender is
|
|
39385
|
+
* told to give each on a line of its own, "Item: ...", and after it answers Light Code checks every item is there
|
|
39386
|
+
* and asks the same specialist for the missing ones (twice at most) before anything moves on. See `contractCheck`.
|
|
39387
|
+
*/
|
|
39388
|
+
requires: external_exports.array(external_exports.string().trim().min(1).max(80)).max(10).optional()
|
|
39383
39389
|
});
|
|
39384
39390
|
var strategySchema = external_exports.object({
|
|
39385
39391
|
id: external_exports.string().min(1).max(60),
|
|
@@ -39464,7 +39470,7 @@ function describeStrategy(strategy, roleName) {
|
|
|
39464
39470
|
};
|
|
39465
39471
|
const lines2 = [`## Strategy: ${strategy.name}`, "", "The user drew how this work must be done. Steps, each done by consulting that role with ask_agent:"];
|
|
39466
39472
|
for (const node of order2) {
|
|
39467
|
-
const next = strategy.edges.filter((edge) => edge.from === node.id && edge.twoWay !== true).map((edge) => `${label(edge.to)}${edge.contract !== void 0 && edge.contract.trim().length > 0 ? ` (passing on: ${firstLine(edge.contract)})` : ""}`);
|
|
39473
|
+
const next = strategy.edges.filter((edge) => edge.from === node.id && edge.twoWay !== true).map((edge) => `${label(edge.to)}${edge.contract !== void 0 && edge.contract.trim().length > 0 ? ` (passing on: ${firstLine(edge.contract)})` : ""}${requiredOf(edge).length > 0 ? ` [required: ${requiredOf(edge).join(", ")}]` : ""}`);
|
|
39468
39474
|
lines2.push(`${String(number5.get(node.id))}. ${roleName(node.role)}${node.readOnly === true ? " - read-only: may not change anything" : ""}${node.instructions !== void 0 && node.instructions.trim().length > 0 ? ` - the user's instructions for it: "${firstLine(node.instructions)}"` : " - what it does here is yours to plan"}` + (next.length > 0 ? `; then ${next.join(" and ")}` : ""));
|
|
39469
39475
|
}
|
|
39470
39476
|
const loops = strategy.edges.filter((edge) => edge.twoWay === true);
|
|
@@ -39472,7 +39478,7 @@ function describeStrategy(strategy, roleName) {
|
|
|
39472
39478
|
lines2.push("", "Back-and-forth between roles:");
|
|
39473
39479
|
for (const edge of loops) {
|
|
39474
39480
|
const judge = label(edge.to);
|
|
39475
|
-
lines2.push(`- ${label(edge.from)} and ${judge}: after ${label(edge.from)}, ${judge} checks; if not done, back to ${label(edge.from)}. ` + (edge.until !== void 0 && edge.until.trim().length > 0 ? `Repeat until: "${edge.until.trim()}" (judged by ${judge}), ` : "Repeat ") + `at most ${String(roundsOf(edge))} round${roundsOf(edge) === 1 ? "" : "s"}.${edge.label !== void 0 ? ` (${edge.label})` : ""}` + (edge.contract !== void 0 && edge.contract.trim().length > 0 ? ` Each round ${label(edge.from)} passes on: ${firstLine(edge.contract)}.` : ""));
|
|
39481
|
+
lines2.push(`- ${label(edge.from)} and ${judge}: after ${label(edge.from)}, ${judge} checks; if not done, back to ${label(edge.from)}. ` + (edge.until !== void 0 && edge.until.trim().length > 0 ? `Repeat until: "${edge.until.trim()}" (judged by ${judge}), ` : "Repeat ") + `at most ${String(roundsOf(edge))} round${roundsOf(edge) === 1 ? "" : "s"}.${edge.label !== void 0 ? ` (${edge.label})` : ""}` + (edge.contract !== void 0 && edge.contract.trim().length > 0 ? ` Each round ${label(edge.from)} passes on: ${firstLine(edge.contract)}.` : "") + (requiredOf(edge).length > 0 ? ` Required in every hand-over: ${requiredOf(edge).join(", ")}.` : ""));
|
|
39476
39482
|
}
|
|
39477
39483
|
}
|
|
39478
39484
|
const boxes = (strategy.groups ?? []).map((group) => ({ group, inside: order2.filter((node) => node.group === group.id) })).filter((box) => box.inside.length > 1);
|
|
@@ -39481,7 +39487,7 @@ function describeStrategy(strategy, roleName) {
|
|
|
39481
39487
|
for (const box of boxes)
|
|
39482
39488
|
lines2.push(`- ${box.group.label ?? "Parallel"}: ${box.inside.map((node) => label(node.id)).join(", ")}`);
|
|
39483
39489
|
}
|
|
39484
|
-
lines2.push("", "How to follow it:", "- Before doing anything else in a task, propose a plan with update_plan that carries out every step above in order, naming the role for each step and writing each back-and-forth as one step with its condition and its maximum rounds. Then follow the plan.", "- Give each specialist what it needs from the earlier steps: it does not see this conversation, only what you send it. A step's own instructions from the user reach it with every question; plan the steps that have none.", "- In a back-and-forth, Light Code counts the rounds and tells you after each answer where the loop stands; it refuses a round past the maximum. If the maximum is reached without the condition, stop and tell the user what is still open rather than working around it.", "- A question from the user that is not part of the strategy is answered normally.");
|
|
39490
|
+
lines2.push("", "How to follow it:", "- Before doing anything else in a task, propose a plan with update_plan that carries out every step above in order, naming the role for each step and writing each back-and-forth as one step with its condition and its maximum rounds. Then follow the plan.", "- Give each specialist what it needs from the earlier steps: it does not see this conversation, only what you send it. A step's own instructions from the user reach it with every question; plan the steps that have none.", "- Connectors with no contract: before starting, propose what should pass along them with set_strategy_contracts (the user approves it). Light Code checks every required item after each answer, asks the specialist again for what is missing, and tells you if it is still missing - pass on what arrived, and say what did not.", "- In a back-and-forth, Light Code counts the rounds and tells you after each answer where the loop stands; it refuses a round past the maximum. If the maximum is reached without the condition, stop and tell the user what is still open rather than working around it.", "- A question from the user that is not part of the strategy is answered normally.");
|
|
39485
39491
|
return lines2.join("\n");
|
|
39486
39492
|
}
|
|
39487
39493
|
function readVerdict(answer) {
|
|
@@ -39516,6 +39522,15 @@ function beforeConsult(strategy, progress, lastRole, role, roleName) {
|
|
|
39516
39522
|
notes.push(`You are the judge of a back-and-forth with ${roleName(from.role)}, which ends when: "${edge.until.trim()}". Judge it against what you can check, and end your answer with exactly one line: \`CONDITION: MET\` or \`CONDITION: NOT MET - <what is still missing>\`.`);
|
|
39517
39523
|
}
|
|
39518
39524
|
}
|
|
39525
|
+
for (const edge of strategy.edges) {
|
|
39526
|
+
const items = requiredOf(edge);
|
|
39527
|
+
const from = strategy.nodes.find((n) => n.id === edge.from);
|
|
39528
|
+
const to = strategy.nodes.find((n) => n.id === edge.to);
|
|
39529
|
+
if (items.length === 0 || from === void 0 || to === void 0 || role !== from.role)
|
|
39530
|
+
continue;
|
|
39531
|
+
notes.push(`Required in your answer for ${roleName(to.role)}, each on a line of its own starting with its name and a colon:
|
|
39532
|
+
` + items.map((item2) => `${item2}: ...`).join("\n") + "\nLight Code checks these and will ask you again for any that are missing.");
|
|
39533
|
+
}
|
|
39519
39534
|
for (const edge of strategy.edges) {
|
|
39520
39535
|
const contract = edge.contract?.trim() ?? "";
|
|
39521
39536
|
if (contract.length === 0)
|
|
@@ -39580,6 +39595,48 @@ function exchangeOf(role, question, answer, before, after, parallel) {
|
|
|
39580
39595
|
const loops = Object.entries(after).filter(([id, state]) => JSON.stringify(state) !== JSON.stringify(before[id])).map(([edgeId, state]) => ({ edgeId, rounds: state.rounds, ...state.verdict !== void 0 ? { verdict: state.verdict } : {}, ...state.met !== void 0 ? { met: state.met } : {} }));
|
|
39581
39596
|
return { at: Date.now(), role, question: cap3(question), answer: cap3(answer), ...parallel ? { parallel: true } : {}, ...loops.length > 0 ? { loops } : {} };
|
|
39582
39597
|
}
|
|
39598
|
+
function requiredOf(edge) {
|
|
39599
|
+
return (edge.requires ?? []).map((item2) => item2.trim()).filter((item2) => item2.length > 0);
|
|
39600
|
+
}
|
|
39601
|
+
function missingItems(answer, items) {
|
|
39602
|
+
const lines2 = answer.split(/\r?\n/);
|
|
39603
|
+
const norm2 = (text2) => text2.toLowerCase().replace(/[*_`#>]/g, "").replace(/\s+/g, " ").trim();
|
|
39604
|
+
const given = (wanted) => lines2.some((line, i) => {
|
|
39605
|
+
const clean = norm2(line);
|
|
39606
|
+
if (!clean.startsWith(wanted))
|
|
39607
|
+
return false;
|
|
39608
|
+
const after = clean.slice(wanted.length).trim();
|
|
39609
|
+
if (/^[:\-–—]\s*\S/.test(after))
|
|
39610
|
+
return true;
|
|
39611
|
+
if (after !== "" && after !== ":")
|
|
39612
|
+
return false;
|
|
39613
|
+
const next = lines2.slice(i + 1).find((l) => l.trim().length > 0);
|
|
39614
|
+
return next !== void 0 && !next.trim().startsWith("#");
|
|
39615
|
+
});
|
|
39616
|
+
return items.filter((item2) => !given(norm2(item2)));
|
|
39617
|
+
}
|
|
39618
|
+
function contractCheck(strategy, role, answer) {
|
|
39619
|
+
const out = [];
|
|
39620
|
+
for (const edge of strategy.edges) {
|
|
39621
|
+
const items = requiredOf(edge);
|
|
39622
|
+
const from = strategy.nodes.find((n) => n.id === edge.from);
|
|
39623
|
+
const to = strategy.nodes.find((n) => n.id === edge.to);
|
|
39624
|
+
if (items.length === 0 || from === void 0 || to === void 0 || from.role !== role)
|
|
39625
|
+
continue;
|
|
39626
|
+
out.push({ edgeId: edge.id, to: to.role, required: items, missing: missingItems(answer, items) });
|
|
39627
|
+
}
|
|
39628
|
+
return out;
|
|
39629
|
+
}
|
|
39630
|
+
function askForMissing(missing, previous) {
|
|
39631
|
+
return [
|
|
39632
|
+
`Your answer is missing what the strategy requires: ${missing.join(", ")}.`,
|
|
39633
|
+
`Give only these now, each on a line of its own starting with its name and a colon (${missing.map((m) => `"${m}: ..."`).join(", ")}).`,
|
|
39634
|
+
"If one does not apply, say so on its line rather than leaving it out.",
|
|
39635
|
+
"",
|
|
39636
|
+
"Your previous answer, for reference:",
|
|
39637
|
+
previous.length > 6e3 ? `${previous.slice(0, 6e3)}\u2026` : previous
|
|
39638
|
+
].join("\n");
|
|
39639
|
+
}
|
|
39583
39640
|
|
|
39584
39641
|
// ../../packages/core/dist/mcp/types.js
|
|
39585
39642
|
var mcpDenyRuleSchema = external_exports.object({
|
|
@@ -43280,13 +43337,13 @@ var GEMINI_UNSUPPORTED = /* @__PURE__ */ new Set([
|
|
|
43280
43337
|
function isRecord(value) {
|
|
43281
43338
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
43282
43339
|
}
|
|
43283
|
-
function pruneSchema(
|
|
43284
|
-
if (Array.isArray(
|
|
43285
|
-
return
|
|
43286
|
-
if (!isRecord(
|
|
43287
|
-
return
|
|
43340
|
+
function pruneSchema(schema11, keep) {
|
|
43341
|
+
if (Array.isArray(schema11))
|
|
43342
|
+
return schema11.map((entry) => pruneSchema(entry, keep));
|
|
43343
|
+
if (!isRecord(schema11))
|
|
43344
|
+
return schema11;
|
|
43288
43345
|
const result = {};
|
|
43289
|
-
for (const [key3, value] of Object.entries(
|
|
43346
|
+
for (const [key3, value] of Object.entries(schema11)) {
|
|
43290
43347
|
if (!keep(key3))
|
|
43291
43348
|
continue;
|
|
43292
43349
|
if (key3 === "properties" && isRecord(value)) {
|
|
@@ -45450,32 +45507,32 @@ function parseCheckpoints(plan3) {
|
|
|
45450
45507
|
line: index
|
|
45451
45508
|
});
|
|
45452
45509
|
});
|
|
45453
|
-
const ordered = items.filter((
|
|
45510
|
+
const ordered = items.filter((item2) => item2.ordered);
|
|
45454
45511
|
const candidates = ordered.length > 0 ? ordered : items;
|
|
45455
|
-
const shallowest = candidates.reduce((least,
|
|
45456
|
-
const steps = candidates.filter((
|
|
45512
|
+
const shallowest = candidates.reduce((least, item2) => Math.min(least, item2.indent), Number.POSITIVE_INFINITY);
|
|
45513
|
+
const steps = candidates.filter((item2) => item2.indent === shallowest);
|
|
45457
45514
|
const texts = steps.length > 0 ? steps : (
|
|
45458
45515
|
// No list at all: plenty of people write a plan as bare lines, and a progress view that
|
|
45459
45516
|
// only worked for bullet-point authors would read as broken.
|
|
45460
|
-
lines2.map((line, index) => ({ indent: 0, ordered: false, text: line.trim(), line: index })).filter((
|
|
45517
|
+
lines2.map((line, index) => ({ indent: 0, ordered: false, text: line.trim(), line: index })).filter((item2) => item2.text.length > 0)
|
|
45461
45518
|
);
|
|
45462
45519
|
const chosen = texts.slice(0, MAX_CHECKPOINTS);
|
|
45463
45520
|
const seen = /* @__PURE__ */ new Map();
|
|
45464
|
-
return chosen.map((
|
|
45465
|
-
const key3 = normalise(
|
|
45521
|
+
return chosen.map((item2, position) => {
|
|
45522
|
+
const key3 = normalise(item2.text);
|
|
45466
45523
|
const occurrence = (seen.get(key3) ?? 0) + 1;
|
|
45467
45524
|
seen.set(key3, occurrence);
|
|
45468
45525
|
const until = chosen[position + 1]?.line ?? lines2.length;
|
|
45469
45526
|
return {
|
|
45470
45527
|
id: occurrence === 1 ? idFor(key3) : `${idFor(key3)}-${String(occurrence)}`,
|
|
45471
45528
|
index: position + 1,
|
|
45472
|
-
text:
|
|
45529
|
+
text: item2.text,
|
|
45473
45530
|
/*
|
|
45474
45531
|
* Who the plan says should be involved, read from the step *and everything under it* —
|
|
45475
45532
|
* which is where the allocation actually lives, since a specialist is usually named on a
|
|
45476
45533
|
* continuation line ("Owner: reviewer") or inside a sub-point rather than in the heading.
|
|
45477
45534
|
*/
|
|
45478
|
-
plannedRoles: rolesMentionedIn(lines2.slice(
|
|
45535
|
+
plannedRoles: rolesMentionedIn(lines2.slice(item2.line, until).join(" "))
|
|
45479
45536
|
};
|
|
45480
45537
|
});
|
|
45481
45538
|
}
|
|
@@ -47017,6 +47074,8 @@ var ALWAYS_ASK_TOOLS = /* @__PURE__ */ new Set([
|
|
|
47017
47074
|
* prompt would look right afterwards, because both would be reading the new plan.
|
|
47018
47075
|
*/
|
|
47019
47076
|
"update_plan",
|
|
47077
|
+
// The contracts a strategy's hand-overs are checked against: the user sees and approves every change.
|
|
47078
|
+
"set_strategy_contracts",
|
|
47020
47079
|
/*
|
|
47021
47080
|
* A role's prompt is prose injected into a model that then advises on this repository's code —
|
|
47022
47081
|
* the reason `agents` is user-scope only. Softening a reviewer does not error; it approves
|
|
@@ -48037,7 +48096,7 @@ var OpenSearchIndexWriter = class {
|
|
|
48037
48096
|
const result = await this.request("/_bulk", "POST", `${lines2.join("\n")}
|
|
48038
48097
|
`, signal);
|
|
48039
48098
|
if (result.errors === true) {
|
|
48040
|
-
const firstError = (result.items ?? []).map((
|
|
48099
|
+
const firstError = (result.items ?? []).map((item2) => item2.index?.error?.reason).find((reason) => typeof reason === "string");
|
|
48041
48100
|
throw new OpenSearchError(`Some documents were rejected. First reason: ${String(firstError ?? "unknown")}`);
|
|
48042
48101
|
}
|
|
48043
48102
|
}
|
|
@@ -53008,17 +53067,17 @@ var WHY_SCHEMA = {
|
|
|
53008
53067
|
type: "string",
|
|
53009
53068
|
description: "One short sentence, for the person watching: why you are making this call and what you expect to learn or change. Not a restatement of the tool name."
|
|
53010
53069
|
};
|
|
53011
|
-
function withWhy(
|
|
53012
|
-
if (typeof
|
|
53013
|
-
return
|
|
53014
|
-
const record2 =
|
|
53070
|
+
function withWhy(schema11) {
|
|
53071
|
+
if (typeof schema11 !== "object" || schema11 === null || Array.isArray(schema11))
|
|
53072
|
+
return schema11;
|
|
53073
|
+
const record2 = schema11;
|
|
53015
53074
|
if (record2.type !== "object")
|
|
53016
|
-
return
|
|
53075
|
+
return schema11;
|
|
53017
53076
|
const properties = record2.properties;
|
|
53018
53077
|
if (properties !== void 0 && (typeof properties !== "object" || properties === null))
|
|
53019
|
-
return
|
|
53078
|
+
return schema11;
|
|
53020
53079
|
if (properties !== void 0 && WHY_PARAMETER in properties)
|
|
53021
|
-
return
|
|
53080
|
+
return schema11;
|
|
53022
53081
|
return {
|
|
53023
53082
|
...record2,
|
|
53024
53083
|
properties: { ...properties ?? {}, [WHY_PARAMETER]: WHY_SCHEMA }
|
|
@@ -53041,6 +53100,8 @@ function toToolDefinitions(tools) {
|
|
|
53041
53100
|
|
|
53042
53101
|
// ../../packages/core/dist/schedule/runner.js
|
|
53043
53102
|
var NEVER_AVAILABLE_TO_SCHEDULES = [
|
|
53103
|
+
// A run rewriting the contracts it is checked against would be bound by nothing (the plan's reasoning).
|
|
53104
|
+
"set_strategy_contracts",
|
|
53044
53105
|
// Mass copies and moves need a person reading the plan; an unattended run has none.
|
|
53045
53106
|
"transfer_files",
|
|
53046
53107
|
"archive_files",
|
|
@@ -53854,27 +53915,27 @@ function createPlanProgressTool(access) {
|
|
|
53854
53915
|
|
|
53855
53916
|
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1_ed45788dfbfe808cc09dd7daea6bd385/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js
|
|
53856
53917
|
function isZ4Schema(s) {
|
|
53857
|
-
const
|
|
53858
|
-
return !!
|
|
53918
|
+
const schema11 = s;
|
|
53919
|
+
return !!schema11._zod;
|
|
53859
53920
|
}
|
|
53860
|
-
function safeParse3(
|
|
53861
|
-
if (isZ4Schema(
|
|
53862
|
-
const result2 = safeParse(
|
|
53921
|
+
function safeParse3(schema11, data) {
|
|
53922
|
+
if (isZ4Schema(schema11)) {
|
|
53923
|
+
const result2 = safeParse(schema11, data);
|
|
53863
53924
|
return result2;
|
|
53864
53925
|
}
|
|
53865
|
-
const v3Schema =
|
|
53926
|
+
const v3Schema = schema11;
|
|
53866
53927
|
const result = v3Schema.safeParse(data);
|
|
53867
53928
|
return result;
|
|
53868
53929
|
}
|
|
53869
|
-
function getObjectShape(
|
|
53870
|
-
if (!
|
|
53930
|
+
function getObjectShape(schema11) {
|
|
53931
|
+
if (!schema11)
|
|
53871
53932
|
return void 0;
|
|
53872
53933
|
let rawShape;
|
|
53873
|
-
if (isZ4Schema(
|
|
53874
|
-
const v4Schema =
|
|
53934
|
+
if (isZ4Schema(schema11)) {
|
|
53935
|
+
const v4Schema = schema11;
|
|
53875
53936
|
rawShape = v4Schema._zod?.def?.shape;
|
|
53876
53937
|
} else {
|
|
53877
|
-
const v3Schema =
|
|
53938
|
+
const v3Schema = schema11;
|
|
53878
53939
|
rawShape = v3Schema.shape;
|
|
53879
53940
|
}
|
|
53880
53941
|
if (!rawShape)
|
|
@@ -53888,9 +53949,9 @@ function getObjectShape(schema10) {
|
|
|
53888
53949
|
}
|
|
53889
53950
|
return rawShape;
|
|
53890
53951
|
}
|
|
53891
|
-
function getLiteralValue(
|
|
53892
|
-
if (isZ4Schema(
|
|
53893
|
-
const v4Schema =
|
|
53952
|
+
function getLiteralValue(schema11) {
|
|
53953
|
+
if (isZ4Schema(schema11)) {
|
|
53954
|
+
const v4Schema = schema11;
|
|
53894
53955
|
const def2 = v4Schema._zod?.def;
|
|
53895
53956
|
if (def2) {
|
|
53896
53957
|
if (def2.value !== void 0)
|
|
@@ -53900,7 +53961,7 @@ function getLiteralValue(schema10) {
|
|
|
53900
53961
|
}
|
|
53901
53962
|
}
|
|
53902
53963
|
}
|
|
53903
|
-
const v3Schema =
|
|
53964
|
+
const v3Schema = schema11;
|
|
53904
53965
|
const def = v3Schema._def;
|
|
53905
53966
|
if (def) {
|
|
53906
53967
|
if (def.value !== void 0)
|
|
@@ -53909,7 +53970,7 @@ function getLiteralValue(schema10) {
|
|
|
53909
53970
|
return def.values[0];
|
|
53910
53971
|
}
|
|
53911
53972
|
}
|
|
53912
|
-
const directValue =
|
|
53973
|
+
const directValue = schema11.value;
|
|
53913
53974
|
if (directValue !== void 0)
|
|
53914
53975
|
return directValue;
|
|
53915
53976
|
return void 0;
|
|
@@ -55444,8 +55505,8 @@ function isTerminal(status2) {
|
|
|
55444
55505
|
var ALPHA_NUMERIC = new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");
|
|
55445
55506
|
|
|
55446
55507
|
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1_ed45788dfbfe808cc09dd7daea6bd385/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-json-schema-compat.js
|
|
55447
|
-
function getMethodLiteral(
|
|
55448
|
-
const shape = getObjectShape(
|
|
55508
|
+
function getMethodLiteral(schema11) {
|
|
55509
|
+
const shape = getObjectShape(schema11);
|
|
55449
55510
|
const methodSchema = shape?.method;
|
|
55450
55511
|
if (!methodSchema) {
|
|
55451
55512
|
throw new Error("Schema is missing a method literal");
|
|
@@ -55456,8 +55517,8 @@ function getMethodLiteral(schema10) {
|
|
|
55456
55517
|
}
|
|
55457
55518
|
return value;
|
|
55458
55519
|
}
|
|
55459
|
-
function parseWithCompat(
|
|
55460
|
-
const result = safeParse3(
|
|
55520
|
+
function parseWithCompat(schema11, data) {
|
|
55521
|
+
const result = safeParse3(schema11, data);
|
|
55461
55522
|
if (!result.success) {
|
|
55462
55523
|
throw result.error;
|
|
55463
55524
|
}
|
|
@@ -56465,8 +56526,8 @@ var AjvJsonSchemaValidator = class {
|
|
|
56465
56526
|
* @param schema - Standard JSON Schema object
|
|
56466
56527
|
* @returns A validator function that validates input data
|
|
56467
56528
|
*/
|
|
56468
|
-
getValidator(
|
|
56469
|
-
const ajvValidator = "$id" in
|
|
56529
|
+
getValidator(schema11) {
|
|
56530
|
+
const ajvValidator = "$id" in schema11 && typeof schema11.$id === "string" ? this._ajv.getSchema(schema11.$id) ?? this._ajv.compile(schema11) : this._ajv.compile(schema11);
|
|
56470
56531
|
return (input) => {
|
|
56471
56532
|
const valid = ajvValidator(input);
|
|
56472
56533
|
if (valid) {
|
|
@@ -56676,12 +56737,12 @@ function assertClientRequestTaskCapability(requests, method, entityName) {
|
|
|
56676
56737
|
}
|
|
56677
56738
|
|
|
56678
56739
|
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1_ed45788dfbfe808cc09dd7daea6bd385/node_modules/@modelcontextprotocol/sdk/dist/esm/client/index.js
|
|
56679
|
-
function applyElicitationDefaults(
|
|
56680
|
-
if (!
|
|
56740
|
+
function applyElicitationDefaults(schema11, data) {
|
|
56741
|
+
if (!schema11 || data === null || typeof data !== "object")
|
|
56681
56742
|
return;
|
|
56682
|
-
if (
|
|
56743
|
+
if (schema11.type === "object" && schema11.properties && typeof schema11.properties === "object") {
|
|
56683
56744
|
const obj = data;
|
|
56684
|
-
const props =
|
|
56745
|
+
const props = schema11.properties;
|
|
56685
56746
|
for (const key3 of Object.keys(props)) {
|
|
56686
56747
|
const propSchema = props[key3];
|
|
56687
56748
|
if (obj[key3] === void 0 && Object.prototype.hasOwnProperty.call(propSchema, "default")) {
|
|
@@ -56692,15 +56753,15 @@ function applyElicitationDefaults(schema10, data) {
|
|
|
56692
56753
|
}
|
|
56693
56754
|
}
|
|
56694
56755
|
}
|
|
56695
|
-
if (Array.isArray(
|
|
56696
|
-
for (const sub of
|
|
56756
|
+
if (Array.isArray(schema11.anyOf)) {
|
|
56757
|
+
for (const sub of schema11.anyOf) {
|
|
56697
56758
|
if (typeof sub !== "boolean") {
|
|
56698
56759
|
applyElicitationDefaults(sub, data);
|
|
56699
56760
|
}
|
|
56700
56761
|
}
|
|
56701
56762
|
}
|
|
56702
|
-
if (Array.isArray(
|
|
56703
|
-
for (const sub of
|
|
56763
|
+
if (Array.isArray(schema11.oneOf)) {
|
|
56764
|
+
for (const sub of schema11.oneOf) {
|
|
56704
56765
|
if (typeof sub !== "boolean") {
|
|
56705
56766
|
applyElicitationDefaults(sub, data);
|
|
56706
56767
|
}
|
|
@@ -65136,8 +65197,8 @@ async function inBatches(items, size, work) {
|
|
|
65136
65197
|
let next = 0;
|
|
65137
65198
|
const runners = Array.from({ length: Math.min(size, items.length) }, async () => {
|
|
65138
65199
|
while (next < items.length) {
|
|
65139
|
-
const
|
|
65140
|
-
await work(
|
|
65200
|
+
const item2 = items[next++];
|
|
65201
|
+
await work(item2);
|
|
65141
65202
|
}
|
|
65142
65203
|
});
|
|
65143
65204
|
await Promise.all(runners);
|
|
@@ -66848,17 +66909,17 @@ async function planMigration(options) {
|
|
|
66848
66909
|
async function runMigration(plan3) {
|
|
66849
66910
|
const copied = [];
|
|
66850
66911
|
const failed2 = [];
|
|
66851
|
-
for (const
|
|
66912
|
+
for (const item2 of plan3.copy) {
|
|
66852
66913
|
try {
|
|
66853
|
-
await import_promises22.default.mkdir(import_node_path38.default.dirname(
|
|
66854
|
-
await import_promises22.default.cp(
|
|
66855
|
-
recursive:
|
|
66914
|
+
await import_promises22.default.mkdir(import_node_path38.default.dirname(item2.destination), { recursive: true });
|
|
66915
|
+
await import_promises22.default.cp(item2.source, item2.destination, {
|
|
66916
|
+
recursive: item2.directory,
|
|
66856
66917
|
force: false,
|
|
66857
66918
|
errorOnExist: true
|
|
66858
66919
|
});
|
|
66859
|
-
copied.push(
|
|
66920
|
+
copied.push(item2.name);
|
|
66860
66921
|
} catch (error51) {
|
|
66861
|
-
failed2.push({ name:
|
|
66922
|
+
failed2.push({ name: item2.name, problem: error51 instanceof Error ? error51.message : String(error51) });
|
|
66862
66923
|
}
|
|
66863
66924
|
}
|
|
66864
66925
|
return { copied, skipped: plan3.skip, failed: failed2 };
|
|
@@ -67251,15 +67312,15 @@ var transferSchema = external_exports.object({
|
|
|
67251
67312
|
async function transferPaths(context, params3) {
|
|
67252
67313
|
const items = [];
|
|
67253
67314
|
let outside = false;
|
|
67254
|
-
for (const
|
|
67255
|
-
const from = await resolveToolPath(context,
|
|
67315
|
+
for (const item2 of params3.items) {
|
|
67316
|
+
const from = await resolveToolPath(context, item2.from, params3.action === "move" ? { write: true } : {});
|
|
67256
67317
|
if (!from.ok)
|
|
67257
67318
|
return from;
|
|
67258
|
-
const to = await resolveToolPath(context,
|
|
67319
|
+
const to = await resolveToolPath(context, item2.to, { write: true });
|
|
67259
67320
|
if (!to.ok)
|
|
67260
67321
|
return to;
|
|
67261
67322
|
if (isSecretPath(from.realPath) || isSecretPath(to.realPath)) {
|
|
67262
|
-
return { ok: false, message: `"${
|
|
67323
|
+
return { ok: false, message: `"${item2.from}" \u2192 "${item2.to}" touches a folder that holds keys or credentials.` };
|
|
67263
67324
|
}
|
|
67264
67325
|
outside ||= to.outsideWorkspace === true || from.outsideWorkspace === true;
|
|
67265
67326
|
items.push({ from: from.realPath, to: to.realPath });
|
|
@@ -67719,8 +67780,8 @@ Rows ${String(offset + 1)}\u2013${String(offset + rows.length)} of ${String(answ
|
|
|
67719
67780
|
const answer = await runHelper(exe, { op: "transfer", action: params3.action, overwrite: params3.overwrite === true, items: paths.items }, context.signal);
|
|
67720
67781
|
if (answer.ok !== true && answer.files === void 0)
|
|
67721
67782
|
return { content: answer.error ?? "Nothing was copied.", isError: true };
|
|
67722
|
-
for (const
|
|
67723
|
-
context.changedFiles?.add(
|
|
67783
|
+
for (const item2 of paths.items)
|
|
67784
|
+
context.changedFiles?.add(item2.to);
|
|
67724
67785
|
const errors = answer.errors ?? [];
|
|
67725
67786
|
const verb = params3.action === "move" ? "Moved" : "Copied";
|
|
67726
67787
|
return {
|
|
@@ -68562,7 +68623,7 @@ function composeHandoff(note, facts, previousTitle) {
|
|
|
68562
68623
|
const list2 = (title, items, code) => {
|
|
68563
68624
|
if (items.length === 0)
|
|
68564
68625
|
return;
|
|
68565
|
-
lines2.push("", `## ${title}`, ...items.map((
|
|
68626
|
+
lines2.push("", `## ${title}`, ...items.map((item2) => `- ${code ? `\`${item2.replace(/`/g, "'")}\`` : item2}`));
|
|
68566
68627
|
};
|
|
68567
68628
|
list2("Files changed", facts.filesChanged, true);
|
|
68568
68629
|
list2("Files read", facts.filesRead, true);
|
|
@@ -73979,12 +74040,12 @@ ${text2.slice(-2e4)}`);
|
|
|
73979
74040
|
return {};
|
|
73980
74041
|
let why;
|
|
73981
74042
|
for (let attempt = 0; attempt < 12; attempt += 1) {
|
|
73982
|
-
const
|
|
73983
|
-
if (
|
|
73984
|
-
return { queueUrl: location ?? "", number:
|
|
73985
|
-
if (
|
|
74043
|
+
const item2 = await this.rest.json("following the queued build", `/queue/item/${queueId}/api/json`, { method: "GET" }, signal).catch(() => void 0);
|
|
74044
|
+
if (item2?.executable?.number !== void 0)
|
|
74045
|
+
return { queueUrl: location ?? "", number: item2.executable.number };
|
|
74046
|
+
if (item2?.cancelled === true)
|
|
73986
74047
|
return { queueUrl: location ?? "", why: "The queued build was cancelled." };
|
|
73987
|
-
why =
|
|
74048
|
+
why = item2?.why ?? why;
|
|
73988
74049
|
await new Promise((resolve) => setTimeout(resolve, 1e3));
|
|
73989
74050
|
}
|
|
73990
74051
|
return { ...location !== void 0 ? { queueUrl: location } : {}, ...why !== void 0 ? { why } : {} };
|
|
@@ -74086,12 +74147,12 @@ function createJenkinsFindJobsTool(options) {
|
|
|
74086
74147
|
};
|
|
74087
74148
|
}
|
|
74088
74149
|
function createJenkinsJobTool(options) {
|
|
74089
|
-
const
|
|
74150
|
+
const schema11 = external_exports.object({ job: jobParam(options) });
|
|
74090
74151
|
const tool = {
|
|
74091
74152
|
name: "jenkins_job",
|
|
74092
74153
|
group: "read",
|
|
74093
74154
|
description: "Read a Jenkins job: health, whether it is building or queued, its last ten builds with results and durations, the last good and last failed build, and the parameters it takes with their defaults and choices.",
|
|
74094
|
-
parametersSchema:
|
|
74155
|
+
parametersSchema: schema11,
|
|
74095
74156
|
async execute(params3) {
|
|
74096
74157
|
try {
|
|
74097
74158
|
const client = await options.client();
|
|
@@ -74124,12 +74185,12 @@ function createJenkinsJobTool(options) {
|
|
|
74124
74185
|
return tool;
|
|
74125
74186
|
}
|
|
74126
74187
|
function createJenkinsBuildTool(options) {
|
|
74127
|
-
const
|
|
74188
|
+
const schema11 = external_exports.object({ job: jobParam(options), build: buildParam });
|
|
74128
74189
|
const tool = {
|
|
74129
74190
|
name: "jenkins_build",
|
|
74130
74191
|
group: "read",
|
|
74131
74192
|
description: "Read one Jenkins build: result, what started it, its parameters, the commits in it, pipeline stages with their status, failed tests with their errors, and artifacts. Start here to find out why a build failed, then read the failing stage\u2019s log with jenkins_build_log.",
|
|
74132
|
-
parametersSchema:
|
|
74193
|
+
parametersSchema: schema11,
|
|
74133
74194
|
async execute(params3) {
|
|
74134
74195
|
try {
|
|
74135
74196
|
const client = await options.client();
|
|
@@ -74167,7 +74228,7 @@ function createJenkinsBuildTool(options) {
|
|
|
74167
74228
|
return tool;
|
|
74168
74229
|
}
|
|
74169
74230
|
function createJenkinsBuildLogTool(options) {
|
|
74170
|
-
const
|
|
74231
|
+
const schema11 = external_exports.object({
|
|
74171
74232
|
job: jobParam(options),
|
|
74172
74233
|
build: buildParam,
|
|
74173
74234
|
stage: external_exports.string().optional().describe("A pipeline stage name: returns the log of that stage\u2019s failed steps (or all its steps if none failed)."),
|
|
@@ -74178,7 +74239,7 @@ function createJenkinsBuildLogTool(options) {
|
|
|
74178
74239
|
name: "jenkins_build_log",
|
|
74179
74240
|
group: "read",
|
|
74180
74241
|
description: "Read a Jenkins build\u2019s console log without loading all of it: the end of it, only lines matching a pattern, or one pipeline stage\u2019s steps. Use jenkins_build first to see which stage failed.",
|
|
74181
|
-
parametersSchema:
|
|
74242
|
+
parametersSchema: schema11,
|
|
74182
74243
|
async execute(params3) {
|
|
74183
74244
|
try {
|
|
74184
74245
|
const client = await options.client();
|
|
@@ -74236,7 +74297,7 @@ function createJenkinsQueueTool(options) {
|
|
|
74236
74297
|
return {
|
|
74237
74298
|
content: [
|
|
74238
74299
|
queue.length === 0 ? "Nothing is queued." : `${String(queue.length)} queued:`,
|
|
74239
|
-
...queue.map((
|
|
74300
|
+
...queue.map((item2) => `- ${item2.task?.name ?? "?"} since ${when2(item2.inQueueSince)}${item2.stuck === true ? " (stuck)" : ""}${item2.blocked === true ? " (blocked)" : ""}: ${item2.why ?? ""}`),
|
|
74240
74301
|
"",
|
|
74241
74302
|
`Agents: ${String(agents.length)}, ${String(offline.length)} offline, ${String(agents.filter((agent) => agent.offline !== true && agent.idle === false).length)} busy.`,
|
|
74242
74303
|
...offline.map((agent) => `- ${agent.displayName ?? "?"} offline${agent.temporarilyOffline === true ? " (taken offline)" : ""}${agent.offlineCauseReason ? `: ${agent.offlineCauseReason}` : ""}`)
|
|
@@ -74249,7 +74310,7 @@ function createJenkinsQueueTool(options) {
|
|
|
74249
74310
|
};
|
|
74250
74311
|
}
|
|
74251
74312
|
function createJenkinsStartBuildTool(options) {
|
|
74252
|
-
const
|
|
74313
|
+
const schema11 = external_exports.object({
|
|
74253
74314
|
job: jobParam(options),
|
|
74254
74315
|
parameters: external_exports.record(external_exports.string(), external_exports.union([external_exports.string(), external_exports.number(), external_exports.boolean()])).optional().describe("Build parameters by name. Unset ones take the job\u2019s defaults. See jenkins_job for what it takes.")
|
|
74255
74316
|
});
|
|
@@ -74258,7 +74319,7 @@ function createJenkinsStartBuildTool(options) {
|
|
|
74258
74319
|
name: "jenkins_start_build",
|
|
74259
74320
|
group: "command",
|
|
74260
74321
|
description: "Start a Jenkins build now, with parameters if the job takes them. It runs on shared CI under the user\u2019s name, so it is always shown to the user first. Returns the build number when Jenkins starts it within a few seconds.",
|
|
74261
|
-
parametersSchema:
|
|
74322
|
+
parametersSchema: schema11,
|
|
74262
74323
|
async preview(params3) {
|
|
74263
74324
|
const client = await options.client();
|
|
74264
74325
|
const job = jobOf(options, params3.job);
|
|
@@ -74296,12 +74357,12 @@ Link: ${client.base}${jobPath(job, client.base)}/${String(started.number)}/` };
|
|
|
74296
74357
|
return tool;
|
|
74297
74358
|
}
|
|
74298
74359
|
function createJenkinsStopBuildTool(options) {
|
|
74299
|
-
const
|
|
74360
|
+
const schema11 = external_exports.object({ job: jobParam(options), build: external_exports.union([external_exports.number().int().positive(), external_exports.string()]).describe("The build number to stop.") });
|
|
74300
74361
|
const tool = {
|
|
74301
74362
|
name: "jenkins_stop_build",
|
|
74302
74363
|
group: "command",
|
|
74303
74364
|
description: "Abort a running Jenkins build. Always shown to the user first.",
|
|
74304
|
-
parametersSchema:
|
|
74365
|
+
parametersSchema: schema11,
|
|
74305
74366
|
async preview(params3) {
|
|
74306
74367
|
const client = await options.client();
|
|
74307
74368
|
const job = jobOf(options, params3.job);
|
|
@@ -74362,7 +74423,7 @@ function createJenkinsCheckJenkinsfileTool(options) {
|
|
|
74362
74423
|
};
|
|
74363
74424
|
}
|
|
74364
74425
|
function createJenkinsTryJenkinsfileTool(options) {
|
|
74365
|
-
const
|
|
74426
|
+
const schema11 = external_exports.object({
|
|
74366
74427
|
job: jobParam(options),
|
|
74367
74428
|
path: external_exports.string().optional().describe("The local Jenkinsfile to run. Default Jenkinsfile."),
|
|
74368
74429
|
build: external_exports.union([external_exports.number().int().positive(), external_exports.string()]).optional().describe("The build to replay \u2014 its parameters and revision are reused. Default last."),
|
|
@@ -74372,7 +74433,7 @@ function createJenkinsTryJenkinsfileTool(options) {
|
|
|
74372
74433
|
name: "jenkins_try_jenkinsfile",
|
|
74373
74434
|
group: "command",
|
|
74374
74435
|
description: "Find out whether a locally edited Jenkinsfile actually runs on Jenkins, without committing it: Jenkins Replay re-runs a recent build of a pipeline job with the local file as its script, on the job\u2019s own agents, parameters and credentials, and this waits for the result \u2014 success, or the failing stage and the end of its log. Check the file with jenkins_check_jenkinsfile first; this one really runs, so it is always shown to the user first, with the whole file. Needs an existing pipeline job that has run at least once, and the Replay permission.",
|
|
74375
|
-
parametersSchema:
|
|
74436
|
+
parametersSchema: schema11,
|
|
74376
74437
|
async preview(params3, context) {
|
|
74377
74438
|
const client = await options.client();
|
|
74378
74439
|
const job = jobOf(options, params3.job);
|
|
@@ -74470,7 +74531,7 @@ var parameterInput = external_exports.object({
|
|
|
74470
74531
|
choices: external_exports.array(external_exports.string()).optional().describe("For a choice parameter: every choice.")
|
|
74471
74532
|
});
|
|
74472
74533
|
function createJenkinsWriteJobTool(options) {
|
|
74473
|
-
const
|
|
74534
|
+
const schema11 = external_exports.object({
|
|
74474
74535
|
action: external_exports.enum(["create", "copy", "update"]).describe(`create: a new job from a whole config (or an existing job's config given as from). copy: a new job copied from "from", optionally changed. update: change an existing job.`),
|
|
74475
74536
|
job: external_exports.string().describe("The job to create (copy, create) or change (update), as folder/name. For create and copy it must not exist yet."),
|
|
74476
74537
|
from: external_exports.string().optional().describe("copy: the existing job to copy, as folder/name or its URL."),
|
|
@@ -74519,7 +74580,7 @@ function createJenkinsWriteJobTool(options) {
|
|
|
74519
74580
|
name: "jenkins_write_job",
|
|
74520
74581
|
group: "command",
|
|
74521
74582
|
description: `Create a Jenkins job, copy an existing job into a new one, or change a job's configuration - most often its parameters (add, change default/choices/description, remove), and anything else by exact text edits of its config.xml. To make a job "like X but with new parameters", use copy with from: X and parameters.set. Never deletes a job and never replaces an existing one by creating over it. Always shown to the user first as a diff of the configuration Jenkins will be sent; it cannot be set to always allow.`,
|
|
74522
|
-
parametersSchema:
|
|
74583
|
+
parametersSchema: schema11,
|
|
74523
74584
|
async preview(params3) {
|
|
74524
74585
|
try {
|
|
74525
74586
|
const client = await options.client();
|
|
@@ -78242,8 +78303,8 @@ var JiraClient = class {
|
|
|
78242
78303
|
}
|
|
78243
78304
|
};
|
|
78244
78305
|
function fieldInfo(id, field2) {
|
|
78245
|
-
const
|
|
78246
|
-
const type =
|
|
78306
|
+
const schema11 = field2.schema ?? {};
|
|
78307
|
+
const type = schema11.type === "array" ? `array of ${schema11.items ?? "?"}` : schema11.type ?? "?";
|
|
78247
78308
|
return {
|
|
78248
78309
|
id,
|
|
78249
78310
|
name: field2.name ?? id,
|
|
@@ -78844,9 +78905,9 @@ function describeReply(quote) {
|
|
|
78844
78905
|
${blockQuote(quote.excerpt)}`;
|
|
78845
78906
|
}
|
|
78846
78907
|
function describeReactions(reactions) {
|
|
78847
|
-
const lines2 = reactions.map((
|
|
78848
|
-
const excerpt2 = clipQuote(
|
|
78849
|
-
return `- ${REACTION_LABELS[
|
|
78908
|
+
const lines2 = reactions.map((item2) => {
|
|
78909
|
+
const excerpt2 = clipQuote(item2.quote.excerpt, MAX_REACTION_QUOTE_CHARS).replace(/\s+/g, " ");
|
|
78910
|
+
return `- ${REACTION_LABELS[item2.reaction]}: "${excerpt2}"${sourceNote(item2.quote)}`;
|
|
78850
78911
|
});
|
|
78851
78912
|
return `[My reactions to what you wrote \u2014 weigh them in what you do next]
|
|
78852
78913
|
${lines2.join("\n")}`;
|
|
@@ -79139,7 +79200,7 @@ function block(node) {
|
|
|
79139
79200
|
return `<p>${inline(node.content)}</p>`;
|
|
79140
79201
|
case "list": {
|
|
79141
79202
|
const tag = node.ordered ? "ol" : "ul";
|
|
79142
|
-
return `<${tag}>${node.items.map((
|
|
79203
|
+
return `<${tag}>${node.items.map((item2) => `<li>${inline(item2)}</li>`).join("")}</${tag}>`;
|
|
79143
79204
|
}
|
|
79144
79205
|
case "quote":
|
|
79145
79206
|
return `<blockquote><p>${inline(node.content)}</p></blockquote>`;
|
|
@@ -80016,7 +80077,7 @@ function coerceFormValue(field2, raw) {
|
|
|
80016
80077
|
if (field2.type === "boolean")
|
|
80017
80078
|
return { value: raw === true };
|
|
80018
80079
|
if (field2.type === "list") {
|
|
80019
|
-
const items = String(raw ?? "").split(/[,\n]/).map((
|
|
80080
|
+
const items = String(raw ?? "").split(/[,\n]/).map((item2) => item2.trim()).filter((item2) => item2.length > 0);
|
|
80020
80081
|
if (field2.required !== false && items.length === 0)
|
|
80021
80082
|
return { error: `"${field2.label}" needs at least one value.` };
|
|
80022
80083
|
return { value: items };
|
|
@@ -81204,16 +81265,16 @@ function computeDashboard(given) {
|
|
|
81204
81265
|
heatmap[local.getUTCDay()][local.getUTCHours()]++;
|
|
81205
81266
|
}
|
|
81206
81267
|
const installed = /* @__PURE__ */ new Map();
|
|
81207
|
-
for (const
|
|
81208
|
-
if (!installed.has(key2(
|
|
81209
|
-
installed.set(key2(
|
|
81268
|
+
for (const item2 of input.inventory)
|
|
81269
|
+
if (!installed.has(key2(item2.kind, item2.name)))
|
|
81270
|
+
installed.set(key2(item2.kind, item2.name), item2);
|
|
81210
81271
|
const ranked = /* @__PURE__ */ new Map();
|
|
81211
81272
|
for (const event of current) {
|
|
81212
81273
|
const id = key2(event.k, event.n);
|
|
81213
81274
|
let entry = ranked.get(id);
|
|
81214
81275
|
if (entry === void 0) {
|
|
81215
|
-
const
|
|
81216
|
-
const author = event.a ??
|
|
81276
|
+
const item2 = installed.get(inventoryKey(event));
|
|
81277
|
+
const author = event.a ?? item2?.author;
|
|
81217
81278
|
entry = {
|
|
81218
81279
|
kind: event.k === "skill" ? "skill" : "tool",
|
|
81219
81280
|
name: event.n,
|
|
@@ -81224,9 +81285,9 @@ function computeDashboard(given) {
|
|
|
81224
81285
|
failures: 0,
|
|
81225
81286
|
lastUsed: 0,
|
|
81226
81287
|
spark: new Array(buckets.length).fill(0),
|
|
81227
|
-
installed:
|
|
81288
|
+
installed: item2 !== void 0,
|
|
81228
81289
|
...author !== void 0 ? { author } : {},
|
|
81229
|
-
...
|
|
81290
|
+
...item2 !== void 0 ? { filePath: item2.filePath, deletable: item2.deletable } : {},
|
|
81230
81291
|
people: /* @__PURE__ */ new Set(),
|
|
81231
81292
|
durations: []
|
|
81232
81293
|
};
|
|
@@ -81252,9 +81313,9 @@ function computeDashboard(given) {
|
|
|
81252
81313
|
...durations.length > 0 ? { averageMs: Math.round(durations.reduce((sum, value) => sum + value, 0) / durations.length) } : {}
|
|
81253
81314
|
}));
|
|
81254
81315
|
const byUses = (a, b) => b.uses - a.uses || b.lastUsed - a.lastUsed;
|
|
81255
|
-
const topSkills = finished.filter((
|
|
81256
|
-
const topTools = finished.filter((
|
|
81257
|
-
const rising = finished.filter((
|
|
81316
|
+
const topSkills = finished.filter((item2) => item2.kind === "skill").sort(byUses).slice(0, 15);
|
|
81317
|
+
const topTools = finished.filter((item2) => item2.kind === "tool").sort(byUses).slice(0, 15);
|
|
81318
|
+
const rising = finished.filter((item2) => item2.kind === "skill" && item2.uses >= 3 && item2.uses > item2.previous).sort((a, b) => b.uses - b.previous - (a.uses - a.previous)).slice(0, 5);
|
|
81258
81319
|
const personMap = /* @__PURE__ */ new Map();
|
|
81259
81320
|
for (const event of current) {
|
|
81260
81321
|
const person = personMap.get(event.u) ?? { uses: 0, skills: /* @__PURE__ */ new Set(), tools: /* @__PURE__ */ new Set(), counts: /* @__PURE__ */ new Map(), last: 0 };
|
|
@@ -81286,16 +81347,16 @@ function computeDashboard(given) {
|
|
|
81286
81347
|
}
|
|
81287
81348
|
return entry;
|
|
81288
81349
|
};
|
|
81289
|
-
for (const
|
|
81290
|
-
if (
|
|
81350
|
+
for (const item2 of input.inventory) {
|
|
81351
|
+
if (item2.author === void 0)
|
|
81291
81352
|
continue;
|
|
81292
|
-
const entry = contributor(
|
|
81293
|
-
(
|
|
81294
|
-
if (
|
|
81295
|
-
entry.lastUpdated =
|
|
81296
|
-
const when4 =
|
|
81353
|
+
const entry = contributor(item2.author);
|
|
81354
|
+
(item2.kind === "skill" ? entry.skills : entry.tools).add(item2.name);
|
|
81355
|
+
if (item2.updated !== void 0 && (entry.lastUpdated === void 0 || item2.updated > entry.lastUpdated))
|
|
81356
|
+
entry.lastUpdated = item2.updated;
|
|
81357
|
+
const when4 = item2.updated !== void 0 ? Date.parse(item2.updated) : NaN;
|
|
81297
81358
|
if (Number.isFinite(when4) && when4 >= from && when4 <= to) {
|
|
81298
|
-
if (
|
|
81359
|
+
if (item2.version === void 0 || item2.version <= 1)
|
|
81299
81360
|
entry.added++;
|
|
81300
81361
|
else
|
|
81301
81362
|
entry.updated++;
|
|
@@ -81343,22 +81404,22 @@ function computeDashboard(given) {
|
|
|
81343
81404
|
};
|
|
81344
81405
|
const usedKeys = new Set(allInRange.map(inventoryKey));
|
|
81345
81406
|
const yearAgo = to - 365 * DAY;
|
|
81346
|
-
const unused = input.inventory.filter((
|
|
81347
|
-
kind:
|
|
81348
|
-
name:
|
|
81349
|
-
filePath:
|
|
81350
|
-
...
|
|
81351
|
-
...
|
|
81352
|
-
location:
|
|
81353
|
-
deletable:
|
|
81354
|
-
stale:
|
|
81407
|
+
const unused = input.inventory.filter((item2) => !usedKeys.has(key2(item2.kind, item2.name))).map((item2) => ({
|
|
81408
|
+
kind: item2.kind,
|
|
81409
|
+
name: item2.name,
|
|
81410
|
+
filePath: item2.filePath,
|
|
81411
|
+
...item2.author !== void 0 ? { author: item2.author } : {},
|
|
81412
|
+
...item2.updated !== void 0 ? { updated: item2.updated } : {},
|
|
81413
|
+
location: item2.location,
|
|
81414
|
+
deletable: item2.deletable,
|
|
81415
|
+
stale: item2.updated !== void 0 && Date.parse(item2.updated) < yearAgo
|
|
81355
81416
|
})).sort((a, b) => Number(b.stale) - Number(a.stale) || (a.updated ?? "").localeCompare(b.updated ?? ""));
|
|
81356
|
-
const recent = input.inventory.filter((
|
|
81357
|
-
kind:
|
|
81358
|
-
name:
|
|
81359
|
-
...
|
|
81360
|
-
updated:
|
|
81361
|
-
location:
|
|
81417
|
+
const recent = input.inventory.filter((item2) => item2.updated !== void 0 && Date.parse(item2.updated) >= from && Date.parse(item2.updated) <= to).map((item2) => ({
|
|
81418
|
+
kind: item2.kind,
|
|
81419
|
+
name: item2.name,
|
|
81420
|
+
...item2.author !== void 0 ? { author: item2.author } : {},
|
|
81421
|
+
updated: item2.updated,
|
|
81422
|
+
location: item2.location
|
|
81362
81423
|
})).sort((a, b) => b.updated.localeCompare(a.updated)).slice(0, 12);
|
|
81363
81424
|
const problems = findProblems(input.inventory, finished, allInRange, installed);
|
|
81364
81425
|
const teamMap = /* @__PURE__ */ new Map();
|
|
@@ -81407,107 +81468,107 @@ function computeDashboard(given) {
|
|
|
81407
81468
|
recent,
|
|
81408
81469
|
problems,
|
|
81409
81470
|
inventory: {
|
|
81410
|
-
skills: input.inventory.filter((
|
|
81411
|
-
tools: input.inventory.filter((
|
|
81412
|
-
authors: new Set(input.inventory.map((
|
|
81471
|
+
skills: input.inventory.filter((item2) => item2.kind === "skill").length,
|
|
81472
|
+
tools: input.inventory.filter((item2) => item2.kind === "tool").length,
|
|
81473
|
+
authors: new Set(input.inventory.map((item2) => item2.author).filter((author) => author !== void 0)).size
|
|
81413
81474
|
},
|
|
81414
81475
|
eventsInStore: allInRange.length,
|
|
81415
81476
|
tokens
|
|
81416
81477
|
};
|
|
81417
81478
|
}
|
|
81418
|
-
function asProblemItem(
|
|
81419
|
-
return { kind:
|
|
81479
|
+
function asProblemItem(item2, note) {
|
|
81480
|
+
return { kind: item2.kind, name: item2.name, filePath: item2.filePath, deletable: item2.deletable, ...note !== void 0 ? { note } : {} };
|
|
81420
81481
|
}
|
|
81421
81482
|
function findProblems(inventory, ranked, events, installed) {
|
|
81422
81483
|
const problems = [];
|
|
81423
81484
|
for (const kind of ["skill", "tool"]) {
|
|
81424
81485
|
const noun = kind === "skill" ? "skill" : "Python tool";
|
|
81425
|
-
const items = inventory.filter((
|
|
81486
|
+
const items = inventory.filter((item2) => item2.kind === kind);
|
|
81426
81487
|
const byName = /* @__PURE__ */ new Map();
|
|
81427
|
-
for (const
|
|
81428
|
-
byName.set(
|
|
81429
|
-
const conflicting = [...byName.values()].filter((group) => group.length > 1 && new Set(group.map((
|
|
81488
|
+
for (const item2 of items)
|
|
81489
|
+
byName.set(item2.name, [...byName.get(item2.name) ?? [], item2]);
|
|
81490
|
+
const conflicting = [...byName.values()].filter((group) => group.length > 1 && new Set(group.map((item2) => item2.contentHash ?? item2.filePath)).size > 1);
|
|
81430
81491
|
if (conflicting.length > 0) {
|
|
81431
81492
|
problems.push({
|
|
81432
81493
|
severity: "warning",
|
|
81433
81494
|
id: `${kind}-name-conflict`,
|
|
81434
81495
|
title: `${String(conflicting.length)} ${noun} name${conflicting.length === 1 ? " is" : "s are"} used for different content`,
|
|
81435
81496
|
detail: `Only the first folder's copy is used. Rename one, or delete the copy nobody should be using.`,
|
|
81436
|
-
items: conflicting.flatMap((group) => group.map((
|
|
81497
|
+
items: conflicting.flatMap((group) => group.map((item2, index) => asProblemItem(item2, index === 0 ? `in use (${item2.location})` : `hidden (${item2.location})`)))
|
|
81437
81498
|
});
|
|
81438
81499
|
}
|
|
81439
81500
|
const byHash = /* @__PURE__ */ new Map();
|
|
81440
|
-
for (const
|
|
81441
|
-
if (
|
|
81501
|
+
for (const item2 of items) {
|
|
81502
|
+
if (item2.contentHash === void 0)
|
|
81442
81503
|
continue;
|
|
81443
|
-
byHash.set(
|
|
81504
|
+
byHash.set(item2.contentHash, [...byHash.get(item2.contentHash) ?? [], item2]);
|
|
81444
81505
|
}
|
|
81445
|
-
const copies = [...byHash.values()].filter((group) => new Set(group.map((
|
|
81506
|
+
const copies = [...byHash.values()].filter((group) => new Set(group.map((item2) => item2.name)).size > 1);
|
|
81446
81507
|
if (copies.length > 0) {
|
|
81447
81508
|
problems.push({
|
|
81448
81509
|
severity: "warning",
|
|
81449
81510
|
id: `${kind}-duplicate-content`,
|
|
81450
81511
|
title: `${String(copies.length)} ${noun}${copies.length === 1 ? " exists" : "s exist"} under more than one name`,
|
|
81451
81512
|
detail: "Identical content under different names. Keep one name and delete the others, or the assistant may pick either.",
|
|
81452
|
-
items: copies.flatMap((group) => group.map((
|
|
81513
|
+
items: copies.flatMap((group) => group.map((item2) => asProblemItem(item2, `same content as ${group.filter((other) => other.name !== item2.name).map((other) => other.name).join(", ")}`)))
|
|
81453
81514
|
});
|
|
81454
81515
|
}
|
|
81455
81516
|
const byNormal = /* @__PURE__ */ new Map();
|
|
81456
|
-
for (const
|
|
81457
|
-
byNormal.set(normalisedName(
|
|
81458
|
-
const similar = [...byNormal.values()].filter((group) => new Set(group.map((
|
|
81517
|
+
for (const item2 of items)
|
|
81518
|
+
byNormal.set(normalisedName(item2.name), [...byNormal.get(normalisedName(item2.name)) ?? [], item2]);
|
|
81519
|
+
const similar = [...byNormal.values()].filter((group) => new Set(group.map((item2) => item2.name)).size > 1);
|
|
81459
81520
|
if (similar.length > 0) {
|
|
81460
81521
|
problems.push({
|
|
81461
81522
|
severity: "info",
|
|
81462
81523
|
id: `${kind}-similar-names`,
|
|
81463
81524
|
title: `${String(similar.length)} set${similar.length === 1 ? "" : "s"} of ${noun}s with near-identical names`,
|
|
81464
81525
|
detail: "Names that differ only by case or punctuation. Probably one thing written twice.",
|
|
81465
|
-
items: similar.flat().map((
|
|
81526
|
+
items: similar.flat().map((item2) => asProblemItem(item2))
|
|
81466
81527
|
});
|
|
81467
81528
|
}
|
|
81468
|
-
const undescribed = items.filter((
|
|
81529
|
+
const undescribed = items.filter((item2) => kind === "skill" && (item2.description ?? "").trim().length === 0);
|
|
81469
81530
|
if (undescribed.length > 0) {
|
|
81470
81531
|
problems.push({
|
|
81471
81532
|
severity: "info",
|
|
81472
81533
|
id: "skill-no-description",
|
|
81473
81534
|
title: `${String(undescribed.length)} skill${undescribed.length === 1 ? " has" : "s have"} no description`,
|
|
81474
81535
|
detail: "Only the description reaches the assistant until it opens a skill, so a skill without one is rarely found.",
|
|
81475
|
-
items: undescribed.map((
|
|
81536
|
+
items: undescribed.map((item2) => asProblemItem(item2))
|
|
81476
81537
|
});
|
|
81477
81538
|
}
|
|
81478
|
-
const unattributed = items.filter((
|
|
81539
|
+
const unattributed = items.filter((item2) => item2.author === void 0);
|
|
81479
81540
|
if (unattributed.length > 0) {
|
|
81480
81541
|
problems.push({
|
|
81481
81542
|
severity: "info",
|
|
81482
81543
|
id: `${kind}-no-author`,
|
|
81483
81544
|
title: `${String(unattributed.length)} ${noun}${unattributed.length === 1 ? " has" : "s have"} no author`,
|
|
81484
81545
|
detail: 'Contribution counts skip them. Label them in Settings \u2192 Project \u2192 "Label existing skills and tools".',
|
|
81485
|
-
items: unattributed.slice(0, 40).map((
|
|
81546
|
+
items: unattributed.slice(0, 40).map((item2) => asProblemItem(item2))
|
|
81486
81547
|
});
|
|
81487
81548
|
}
|
|
81488
81549
|
}
|
|
81489
|
-
const broken = inventory.filter((
|
|
81550
|
+
const broken = inventory.filter((item2) => item2.issue !== void 0);
|
|
81490
81551
|
if (broken.length > 0) {
|
|
81491
81552
|
problems.push({
|
|
81492
81553
|
severity: "error",
|
|
81493
81554
|
id: "tool-not-loaded",
|
|
81494
81555
|
title: `${String(broken.length)} Python tool${broken.length === 1 ? " is" : "s are"} not loaded`,
|
|
81495
81556
|
detail: "Waiting for approval, changed since approval, or failing to import. See Settings \u2192 Python.",
|
|
81496
|
-
items: broken.map((
|
|
81557
|
+
items: broken.map((item2) => asProblemItem(item2, item2.issue))
|
|
81497
81558
|
});
|
|
81498
81559
|
}
|
|
81499
|
-
const failing = ranked.filter((
|
|
81560
|
+
const failing = ranked.filter((item2) => item2.kind === "tool" && item2.uses >= 3 && item2.failures / item2.uses >= 0.3);
|
|
81500
81561
|
if (failing.length > 0) {
|
|
81501
81562
|
problems.push({
|
|
81502
81563
|
severity: "warning",
|
|
81503
81564
|
id: "tool-failing",
|
|
81504
81565
|
title: `${String(failing.length)} tool${failing.length === 1 ? " fails" : "s fail"} often`,
|
|
81505
81566
|
detail: "At least three calls in this range, and three in ten or more failed.",
|
|
81506
|
-
items: failing.map((
|
|
81567
|
+
items: failing.map((item2) => ({
|
|
81507
81568
|
kind: "tool",
|
|
81508
|
-
name:
|
|
81509
|
-
...
|
|
81510
|
-
note: `${String(
|
|
81569
|
+
name: item2.label,
|
|
81570
|
+
...item2.filePath !== void 0 ? { filePath: item2.filePath } : {},
|
|
81571
|
+
note: `${String(item2.failures)} of ${String(item2.uses)} failed`
|
|
81511
81572
|
}))
|
|
81512
81573
|
});
|
|
81513
81574
|
}
|
|
@@ -81750,8 +81811,8 @@ function renderSummary(d, storeLabel) {
|
|
|
81750
81811
|
return;
|
|
81751
81812
|
lines2.push("", `## ${title}`, header2, `|${header2.split("|").slice(1, -1).map(() => "---").join("|")}|`, ...rows);
|
|
81752
81813
|
};
|
|
81753
|
-
table("Most used skills", "| Skill | Uses | Previous | People | Author |", d.topSkills.slice(0, 15).map((
|
|
81754
|
-
table("Most used tools", "| Tool | Calls | Failed | People | Avg ms |", d.topTools.slice(0, 15).map((
|
|
81814
|
+
table("Most used skills", "| Skill | Uses | Previous | People | Author |", d.topSkills.slice(0, 15).map((item2) => `| ${item2.label} | ${String(item2.uses)} | ${String(item2.previous)} | ${String(item2.users)} | ${item2.author ?? ""} |`));
|
|
81815
|
+
table("Most used tools", "| Tool | Calls | Failed | People | Avg ms |", d.topTools.slice(0, 15).map((item2) => `| ${item2.label} | ${String(item2.uses)} | ${String(item2.failures)} | ${String(item2.users)} | ${item2.averageMs !== void 0 ? String(item2.averageMs) : ""} |`));
|
|
81755
81816
|
table("Leaderboard", "| Author | Team | Skills | Tools | Added in range | Updated in range | Uses of their work | People reached | Impact |", d.contributors.slice(0, 15).map((c2) => `| ${name(c2.author, c2.displayName)} | ${c2.team ?? ""} | ${String(c2.skills)} | ${String(c2.tools)} | ${String(c2.added)} | ${String(c2.updated)} | ${String(c2.uses)} | ${String(c2.reached)} | ${String(c2.impact)} |`));
|
|
81756
81817
|
if (d.scope === "team") {
|
|
81757
81818
|
table("People", "| Person | Team | Uses | Skills | Favourite skill |", d.people.slice(0, 20).map((p) => `| ${name(p.user, p.displayName)} | ${p.team ?? ""} | ${String(p.uses)} | ${String(p.skills)} | ${p.favourite ?? ""} |`));
|
|
@@ -81763,11 +81824,11 @@ function renderSummary(d, storeLabel) {
|
|
|
81763
81824
|
if (d.problems.length > 0) {
|
|
81764
81825
|
lines2.push("", "## Needs attention");
|
|
81765
81826
|
for (const problem of d.problems)
|
|
81766
|
-
lines2.push(`- **${problem.severity}**: ${problem.title} - ${problem.items.slice(0, 8).map((
|
|
81827
|
+
lines2.push(`- **${problem.severity}**: ${problem.title} - ${problem.items.slice(0, 8).map((item2) => item2.name).join(", ")}${problem.items.length > 8 ? ", ..." : ""}`);
|
|
81767
81828
|
}
|
|
81768
81829
|
if (d.unused.length > 0) {
|
|
81769
81830
|
lines2.push("", `## Unused by anybody in range (${String(d.unused.length)})`);
|
|
81770
|
-
lines2.push(d.unused.slice(0, 30).map((
|
|
81831
|
+
lines2.push(d.unused.slice(0, 30).map((item2) => `${item2.kind} ${item2.name}${item2.stale ? " (stale)" : ""}`).join(", ") + (d.unused.length > 30 ? ", ..." : ""));
|
|
81771
81832
|
}
|
|
81772
81833
|
return lines2.join("\n");
|
|
81773
81834
|
}
|
|
@@ -81784,16 +81845,16 @@ function createUsageStatsTool(deps) {
|
|
|
81784
81845
|
if (input.action === "inventory") {
|
|
81785
81846
|
const items = await deps.inventory();
|
|
81786
81847
|
return {
|
|
81787
|
-
content: JSON.stringify(items.map((
|
|
81788
|
-
kind:
|
|
81789
|
-
name:
|
|
81790
|
-
author:
|
|
81791
|
-
project:
|
|
81792
|
-
version:
|
|
81793
|
-
updated:
|
|
81794
|
-
location:
|
|
81795
|
-
deletableHere:
|
|
81796
|
-
notLoaded:
|
|
81848
|
+
content: JSON.stringify(items.map((item2) => ({
|
|
81849
|
+
kind: item2.kind,
|
|
81850
|
+
name: item2.name,
|
|
81851
|
+
author: item2.author ?? null,
|
|
81852
|
+
project: item2.project ?? null,
|
|
81853
|
+
version: item2.version ?? null,
|
|
81854
|
+
updated: item2.updated ?? null,
|
|
81855
|
+
location: item2.location,
|
|
81856
|
+
deletableHere: item2.deletable,
|
|
81857
|
+
notLoaded: item2.issue ?? null
|
|
81797
81858
|
})))
|
|
81798
81859
|
};
|
|
81799
81860
|
}
|
|
@@ -82097,10 +82158,10 @@ var AuditIndex = class {
|
|
|
82097
82158
|
if (status2 >= 300)
|
|
82098
82159
|
this.fail("adding audit records", status2, json2);
|
|
82099
82160
|
const items = Array.isArray(json2["items"]) ? json2["items"] : [];
|
|
82100
|
-
const failed2 = items.filter((
|
|
82161
|
+
const failed2 = items.filter((item2) => (item2.create?.status ?? 200) >= 300 && item2.create?.status !== 409);
|
|
82101
82162
|
if (failed2.length > 0)
|
|
82102
82163
|
throw new Error(`OpenSearch did not take ${String(failed2.length)} audit record(s): ${failed2[0]?.create?.error?.reason ?? "no reason given"}`);
|
|
82103
|
-
return items.filter((
|
|
82164
|
+
return items.filter((item2) => item2.create?.status === 201).length;
|
|
82104
82165
|
}
|
|
82105
82166
|
async search(query, workspace) {
|
|
82106
82167
|
const filter = [];
|
|
@@ -83153,6 +83214,82 @@ function createStrategyHistoryTool(deps) {
|
|
|
83153
83214
|
};
|
|
83154
83215
|
}
|
|
83155
83216
|
|
|
83217
|
+
// ../../packages/core/dist/strategy/contractsTool.js
|
|
83218
|
+
var item = external_exports.object({
|
|
83219
|
+
from: external_exports.string().min(1).describe('The role that hands over, e.g. "programmer".'),
|
|
83220
|
+
to: external_exports.string().min(1).describe('The role that receives it, e.g. "tester".'),
|
|
83221
|
+
contract: external_exports.string().max(1e3).optional().describe("What passes along this connector, in a sentence."),
|
|
83222
|
+
requires: external_exports.array(external_exports.string().trim().min(1).max(80)).max(10).optional().describe('The items the hand-over must contain, each a short name ("Changed files", "Tests run"). Light Code checks every one.')
|
|
83223
|
+
});
|
|
83224
|
+
var schema7 = external_exports.object({
|
|
83225
|
+
contracts: external_exports.array(item).min(1).max(20).describe("One entry per connector to set. A connector is named by the two roles it joins.")
|
|
83226
|
+
});
|
|
83227
|
+
function findEdge(strategy, from, to) {
|
|
83228
|
+
const roleOf = (id) => strategy.nodes.find((n) => n.id === id)?.role;
|
|
83229
|
+
return strategy.edges.find((e) => roleOf(e.from) === from && roleOf(e.to) === to) ?? strategy.edges.find((e) => e.twoWay === true && roleOf(e.from) === to && roleOf(e.to) === from);
|
|
83230
|
+
}
|
|
83231
|
+
function applyContracts(strategy, params3, roleName) {
|
|
83232
|
+
const lines2 = [];
|
|
83233
|
+
const unknown2 = [];
|
|
83234
|
+
let edges = strategy.edges;
|
|
83235
|
+
for (const entry of params3.contracts) {
|
|
83236
|
+
const from = entry.from.trim().toLowerCase();
|
|
83237
|
+
const to = entry.to.trim().toLowerCase();
|
|
83238
|
+
const edge = findEdge({ ...strategy, edges }, from, to);
|
|
83239
|
+
if (edge === void 0) {
|
|
83240
|
+
unknown2.push(`${roleName(from)} \u2192 ${roleName(to)}`);
|
|
83241
|
+
continue;
|
|
83242
|
+
}
|
|
83243
|
+
const next = {
|
|
83244
|
+
...edge,
|
|
83245
|
+
...entry.contract !== void 0 ? { contract: entry.contract.trim() } : {},
|
|
83246
|
+
...entry.requires !== void 0 ? { requires: entry.requires.map((r) => r.trim()).filter((r) => r.length > 0) } : {}
|
|
83247
|
+
};
|
|
83248
|
+
edges = edges.map((e) => e.id === edge.id ? next : e);
|
|
83249
|
+
lines2.push(`${roleName(from)} \u2192 ${roleName(to)}:`, ` contract: ${edge.contract ?? "(none)"} \u2192 ${next.contract ?? "(none)"}`, ` required: ${(edge.requires ?? []).join(", ") || "(none)"} \u2192 ${(next.requires ?? []).join(", ") || "(none)"}`);
|
|
83250
|
+
}
|
|
83251
|
+
return { strategy: { ...strategy, edges, updatedAt: Date.now() }, lines: lines2, unknown: unknown2 };
|
|
83252
|
+
}
|
|
83253
|
+
function createSetStrategyContractsTool(deps) {
|
|
83254
|
+
return {
|
|
83255
|
+
name: "set_strategy_contracts",
|
|
83256
|
+
group: "edit",
|
|
83257
|
+
description: "Propose what passes between steps of this chat's strategy: a contract and the items each hand-over must contain, for connectors that have none (or to sharpen one). The user approves the change; Light Code then checks every required item after each answer and asks the specialist again for what is missing.",
|
|
83258
|
+
parametersSchema: schema7,
|
|
83259
|
+
async preview(params3) {
|
|
83260
|
+
const strategy = deps.current();
|
|
83261
|
+
if (strategy === void 0)
|
|
83262
|
+
return { kind: "text", text: "No strategy is in use in this chat, so there is nothing to change." };
|
|
83263
|
+
const { lines: lines2, unknown: unknown2 } = applyContracts(strategy, params3, deps.roleName);
|
|
83264
|
+
return {
|
|
83265
|
+
kind: "text",
|
|
83266
|
+
text: [
|
|
83267
|
+
`Change the contracts of the strategy "${strategy.name}" in this chat:`,
|
|
83268
|
+
"",
|
|
83269
|
+
...lines2,
|
|
83270
|
+
...unknown2.length > 0 ? ["", `Not in the strategy, so left alone: ${unknown2.join(", ")}`] : [],
|
|
83271
|
+
"",
|
|
83272
|
+
"Only this chat is changed; save it in the Strategy window to keep it in your library."
|
|
83273
|
+
].join("\n")
|
|
83274
|
+
};
|
|
83275
|
+
},
|
|
83276
|
+
async execute(params3) {
|
|
83277
|
+
const strategy = deps.current();
|
|
83278
|
+
if (strategy === void 0)
|
|
83279
|
+
return { content: "No strategy is in use in this chat.", isError: true };
|
|
83280
|
+
const { strategy: next, lines: lines2, unknown: unknown2 } = applyContracts(strategy, params3, deps.roleName);
|
|
83281
|
+
if (lines2.length === 0)
|
|
83282
|
+
return { content: `None of those connectors are in the strategy: ${unknown2.join(", ")}.`, isError: true };
|
|
83283
|
+
await deps.apply(next);
|
|
83284
|
+
return {
|
|
83285
|
+
content: `Contracts set. Light Code now checks the required items after each hand-over.
|
|
83286
|
+
${lines2.join("\n")}` + (unknown2.length > 0 ? `
|
|
83287
|
+
Not in the strategy, so left alone: ${unknown2.join(", ")}` : "")
|
|
83288
|
+
};
|
|
83289
|
+
}
|
|
83290
|
+
};
|
|
83291
|
+
}
|
|
83292
|
+
|
|
83156
83293
|
// ../../packages/core/dist/team/admins.js
|
|
83157
83294
|
var import_node_crypto19 = require("node:crypto");
|
|
83158
83295
|
var import_node_os6 = __toESM(require("node:os"), 1);
|
|
@@ -84027,7 +84164,7 @@ ${preview.text}` } : {}
|
|
|
84027
84164
|
ui.showInfo(plan3.skip.length > 0 ? `Nothing to copy - all ${String(plan3.skip.length)} are already here.` : `Nothing in ${source} to copy.`);
|
|
84028
84165
|
return;
|
|
84029
84166
|
}
|
|
84030
|
-
const shown2 = plan3.copy.slice(0, 12).map((
|
|
84167
|
+
const shown2 = plan3.copy.slice(0, 12).map((item2) => item2.name).join(", ");
|
|
84031
84168
|
const more = plan3.copy.length > 12 ? `, and ${String(plan3.copy.length - 12)} more` : "";
|
|
84032
84169
|
const confirmed = await ui.showActionMessage(`Copy into ${to}: ${shown2}${more}.` + (plan3.skip.length > 0 ? ` ${String(plan3.skip.length)} already here and left alone.` : "") + (kind === "tools" ? " They will arrive unapproved, to be read before they can run." : ""), "Copy", "info");
|
|
84033
84170
|
if (!confirmed)
|
|
@@ -85560,8 +85697,10 @@ ${preview.text}` } : {}
|
|
|
85560
85697
|
consult: async (agent, request) => consultAgent(agent, request)
|
|
85561
85698
|
}));
|
|
85562
85699
|
}
|
|
85563
|
-
if (activeStrategy !== void 0)
|
|
85700
|
+
if (activeStrategy !== void 0) {
|
|
85564
85701
|
combined.register(strategyHistoryTool);
|
|
85702
|
+
combined.register(strategyContractsTool);
|
|
85703
|
+
}
|
|
85565
85704
|
if (expert !== void 0) {
|
|
85566
85705
|
combined.register(createRecallExpertTool({ history: () => expertAdvice }));
|
|
85567
85706
|
combined.register(createAskExpertTool({
|
|
@@ -86356,12 +86495,22 @@ ${error51.stack.split("\n").slice(1, 6).join("\n")}`;
|
|
|
86356
86495
|
await postTeam();
|
|
86357
86496
|
}
|
|
86358
86497
|
let activeStrategy;
|
|
86498
|
+
const strategyContractsTool = createSetStrategyContractsTool({
|
|
86499
|
+
current: () => activeStrategy,
|
|
86500
|
+
apply: async (next) => {
|
|
86501
|
+
activeStrategy = next;
|
|
86502
|
+
await persistActiveTask();
|
|
86503
|
+
await postStrategies();
|
|
86504
|
+
},
|
|
86505
|
+
roleName: (role) => roleInfo(role, cachedAgentDefinitions).name
|
|
86506
|
+
});
|
|
86359
86507
|
const strategyHistoryTool = createStrategyHistoryTool({
|
|
86360
86508
|
current: () => ({ strategy: activeStrategy, progress: strategyProgress, exchanges: strategyExchanges }),
|
|
86361
86509
|
roleName: (role) => roleInfo(role, cachedAgentDefinitions).name
|
|
86362
86510
|
});
|
|
86363
86511
|
let strategyProgress = {};
|
|
86364
86512
|
let strategyLastRole;
|
|
86513
|
+
const MAX_CONTRACT_RETRIES = 2;
|
|
86365
86514
|
const strategyRunning = /* @__PURE__ */ new Set();
|
|
86366
86515
|
let strategyExchanges = [];
|
|
86367
86516
|
let agentApprovalQueue = Promise.resolve();
|
|
@@ -91918,7 +92067,7 @@ ${last}` : ""}`);
|
|
|
91918
92067
|
for (const dir of skillSearchPath().slice(1)) {
|
|
91919
92068
|
const loaded = await loadSkills([dir]).catch(() => ({ skills: [] }));
|
|
91920
92069
|
for (const skill of loaded.skills) {
|
|
91921
|
-
if (items.some((
|
|
92070
|
+
if (items.some((item2) => item2.kind === "skill" && samePath(item2.filePath, skill.filePath)))
|
|
91922
92071
|
continue;
|
|
91923
92072
|
const hash3 = await contentHash2(skill.filePath);
|
|
91924
92073
|
items.push({
|
|
@@ -91954,7 +92103,7 @@ ${last}` : ""}`);
|
|
|
91954
92103
|
for (const issue2 of status2.issues) {
|
|
91955
92104
|
if (issue2.kind === "shadowed" || issue2.kind === "declined")
|
|
91956
92105
|
continue;
|
|
91957
|
-
if (items.some((
|
|
92106
|
+
if (items.some((item2) => item2.kind === "tool" && samePath(item2.filePath, issue2.filePath)))
|
|
91958
92107
|
continue;
|
|
91959
92108
|
items.push({
|
|
91960
92109
|
kind: "tool",
|
|
@@ -92952,21 +93101,38 @@ ${planned.addToPrompt}` : request.question;
|
|
|
92952
93101
|
strategyLastRole = agent.role;
|
|
92953
93102
|
void postStrategies();
|
|
92954
93103
|
let answer;
|
|
93104
|
+
const askedAgain = /* @__PURE__ */ new Map();
|
|
93105
|
+
let checks;
|
|
92955
93106
|
try {
|
|
92956
93107
|
answer = await consultAgentNow(agent, { ...request, question }, planned.readOnly);
|
|
93108
|
+
checks = contractCheck(strategy, agent.role, answer.advice);
|
|
93109
|
+
for (let attempt = 0; attempt < MAX_CONTRACT_RETRIES && checks.some((check2) => check2.missing.length > 0); attempt += 1) {
|
|
93110
|
+
const missing = [...new Set(checks.flatMap((check2) => check2.missing))];
|
|
93111
|
+
for (const check2 of checks)
|
|
93112
|
+
if (check2.missing.length > 0)
|
|
93113
|
+
askedAgain.set(check2.edgeId, (askedAgain.get(check2.edgeId) ?? 0) + 1);
|
|
93114
|
+
const more = await consultAgentNow(agent, { ...request, question: askForMissing(missing, answer.advice) }, planned.readOnly);
|
|
93115
|
+
answer = { ...answer, advice: `${answer.advice}
|
|
93116
|
+
|
|
93117
|
+
${more.advice}` };
|
|
93118
|
+
checks = contractCheck(strategy, agent.role, answer.advice);
|
|
93119
|
+
}
|
|
92957
93120
|
} finally {
|
|
92958
93121
|
strategyRunning.delete(agent.role);
|
|
92959
93122
|
}
|
|
92960
93123
|
const before = strategyProgress;
|
|
92961
93124
|
const recorded = afterConsult(strategy, strategyProgress, agent.role, answer.advice, name);
|
|
92962
93125
|
strategyProgress = recorded.progress;
|
|
92963
|
-
|
|
93126
|
+
const exchange2 = exchangeOf(agent.role, request.question, answer.advice, before, recorded.progress, request.parallel === true);
|
|
93127
|
+
recordExchange(checks.length > 0 ? { ...exchange2, contracts: checks.map((check2) => ({ ...check2, askedAgain: askedAgain.get(check2.edgeId) ?? 0 })) } : exchange2);
|
|
92964
93128
|
strategyLastRole = agent.role;
|
|
92965
93129
|
persistSoon();
|
|
92966
93130
|
void postStrategies();
|
|
92967
|
-
|
|
93131
|
+
const contractNotes = checks.filter((check2) => check2.missing.length > 0 || (askedAgain.get(check2.edgeId) ?? 0) > 0).map((check2) => check2.missing.length > 0 ? `[Strategy] The hand-over to ${name(check2.to)} is incomplete even after asking again: missing ${check2.missing.join(", ")}. Pass on what arrived and say plainly what is missing.` : `[Strategy] The hand-over to ${name(check2.to)} is complete (${check2.required.join(", ")}), after asking ${name(agent.role)} again for what it had left out.`);
|
|
93132
|
+
const notes = [...contractNotes, ...recorded.note !== void 0 ? [recorded.note] : []];
|
|
93133
|
+
return notes.length > 0 ? { ...answer, advice: `${answer.advice}
|
|
92968
93134
|
|
|
92969
|
-
${
|
|
93135
|
+
${notes.join("\n")}` } : answer;
|
|
92970
93136
|
}
|
|
92971
93137
|
function recordExchange(exchange2) {
|
|
92972
93138
|
strategyExchanges = [...strategyExchanges, exchange2].slice(-MAX_EXCHANGES);
|
|
@@ -95583,14 +95749,14 @@ ${lines2.join("\n")}${relevant.length > cap3 ? `
|
|
|
95583
95749
|
}
|
|
95584
95750
|
|
|
95585
95751
|
// ../../packages/core/dist/tools/diagnostics.js
|
|
95586
|
-
var
|
|
95752
|
+
var schema8 = external_exports.object({
|
|
95587
95753
|
paths: external_exports.array(external_exports.string().min(1)).min(1).max(20).describe("Files to check.")
|
|
95588
95754
|
});
|
|
95589
95755
|
var getDiagnosticsTool = {
|
|
95590
95756
|
name: "get_diagnostics",
|
|
95591
95757
|
group: "read",
|
|
95592
95758
|
description: "Compile errors, type errors and warnings for files, from the language server (Python, TypeScript/JavaScript, Java, C#, Go, Rust, C/C++ and more, where installed) \u2014 without running a build. After edits, the edit result already lists new problems in that file; use this to check other files that depend on it.",
|
|
95593
|
-
parametersSchema:
|
|
95759
|
+
parametersSchema: schema8,
|
|
95594
95760
|
async execute(params3, context) {
|
|
95595
95761
|
if (context.diagnostics === void 0)
|
|
95596
95762
|
return { content: "No language support is available here.", isError: true };
|
|
@@ -96025,8 +96191,11 @@ approval gate in front of everything that acts. It ships with **no default endpo
|
|
|
96025
96191
|
install contacts nothing until a provider is configured.
|
|
96026
96192
|
|
|
96027
96193
|
**Settings** is the gear icon in the chat header. It has these tabs: Providers, Project, Approvals,
|
|
96028
|
-
MCP, Search, Agents, Schedules, Python, Tools, DevOps, Outlook, Custom data, Skills, Usage, Network and
|
|
96029
|
-
Appearance - plus
|
|
96194
|
+
MCP, Add-ons, Search, Agents, Schedules, Python, Tools, DevOps, Outlook, Custom data, Skills, Usage, Network and
|
|
96195
|
+
Appearance - plus **Team reviews** for team admins and owners with a change to decide, an add-on's own tab while it
|
|
96196
|
+
is enabled, and Review and Variables on a shared server (\`light-code --server\`) only. **Project** also holds Team
|
|
96197
|
+
admins, the Auditor and the Anti Hallucinator. Beside the mode picker (Auto, Ask, Agent team) is **Strategy**,
|
|
96198
|
+
once a specialist is assigned.
|
|
96030
96199
|
|
|
96031
96200
|
**Everything the panel writes goes into one JSON file**, and that file can be hand-edited \u2014 the UI
|
|
96032
96201
|
and the loader share one schema, so a bad hand-edit and a bad save fail identically.
|
|
@@ -97656,6 +97825,10 @@ them becomes one notice. With a model chosen, the Auditor also reviews each batc
|
|
|
97656
97825
|
alerts. Agents can read the record back with **read_audit_log** (summary first, then records with filters;
|
|
97657
97826
|
rows go straight into the dataframe tool for custom analysis).
|
|
97658
97827
|
|
|
97828
|
+
**Their instructions are yours to edit**: each panel has an **Instructions** box (Reset to default puts the shipped
|
|
97829
|
+
text back). The reply format and the running notes they must keep are always added after your text, so an edit
|
|
97830
|
+
cannot stop the reviews being read or the handoff working.
|
|
97831
|
+
|
|
97659
97832
|
**The Anti Hallucinator watches the agent's reasoning and results** and, when it states something the evidence
|
|
97660
97833
|
does not support, contradicts a result, drifts from what you asked or loops, sends it a short note at its next
|
|
97661
97834
|
step. The note is labelled as the reviewer's, shown in the chat as such, never counts as your words, and grants
|
|
@@ -97863,11 +98036,15 @@ delete those from Settings \u2192 Skills or Python.
|
|
|
97863
98036
|
"vs code rust",
|
|
97864
98037
|
"tools in vs code",
|
|
97865
98038
|
"bundled helper",
|
|
97866
|
-
"without fire code"
|
|
98039
|
+
"without fire code",
|
|
98040
|
+
"node host rust",
|
|
98041
|
+
"fire-fs agent",
|
|
98042
|
+
"fire-fs watch"
|
|
97867
98043
|
],
|
|
97868
98044
|
body: `
|
|
97869
98045
|
A Rust helper (\`fire-fs.exe\`) runs file and data work on every CPU core. Fire Code ships the full one;
|
|
97870
|
-
the Windows VS Code package
|
|
98046
|
+
the Windows VS Code package and the Windows Node host package carry a slim one with every tool below except
|
|
98047
|
+
\`dataframe\`. Its tools:
|
|
97871
98048
|
|
|
97872
98049
|
- \`find_files\` - find files by name, type, size or date across drives and shares; summarise a folder; find
|
|
97873
98050
|
duplicate files by content.
|
|
@@ -97885,15 +98062,23 @@ the Windows VS Code package carries a slim one with every tool below except \`da
|
|
|
97885
98062
|
- \`python_library\` - call a Python library's functions many times in parallel processes (pricing DLLs).
|
|
97886
98063
|
- \`transfer_files\` / \`archive_files\` - copy or move, and zip/unzip, showing the plan before anything changes.
|
|
97887
98064
|
|
|
98065
|
+
It also runs two kinds of agent as processes of their own, each with its own model and context:
|
|
98066
|
+
- **\`fire-fs agent\`** - each specialist of the agent team (tester, programmer, reviewer...) on an OpenAI,
|
|
98067
|
+
Anthropic or Gemini profile: a sub-agent that remembers the chat and hands off its own key points near its
|
|
98068
|
+
context limit; its tool calls come back to Light Code and your approvals (see the Strategy topic).
|
|
98069
|
+
- **\`fire-fs watch\`** - the Auditor and the Anti Hallucinator (see the Auditor topic).
|
|
98070
|
+
|
|
97888
98071
|
**Where they are available**
|
|
97889
98072
|
- **Fire Code**: always.
|
|
97890
98073
|
- **VS Code on Windows**: always - every tool but \`dataframe\`, from the helper bundled with the
|
|
97891
98074
|
extension. With Fire Code installed on the same machine, its full helper is used instead and
|
|
97892
98075
|
\`dataframe\` is there too. Nothing to configure; reload the VS Code window after installing or
|
|
97893
98076
|
updating Fire Code.
|
|
97894
|
-
- **\`light-code\` run on its own (Node host)**:
|
|
97895
|
-
|
|
97896
|
-
|
|
98077
|
+
- **\`light-code\` run on its own (Node host) on Windows**: always - the slim helper is in the npm package;
|
|
98078
|
+
Fire Code's full one is used instead when Fire Code is installed.
|
|
98079
|
+
- **Not**: on a shared server (\`--server\`), or on a platform other than Windows. There the built-in tools
|
|
98080
|
+
(read_file, search_files, list_files) do the work, specialists answer each question on its own, and the
|
|
98081
|
+
Auditor records without a model reviewing.
|
|
97897
98082
|
|
|
97898
98083
|
To see whether they are on right now, look at the tool list in Settings \u2192 Tools, or ask "which tools do
|
|
97899
98084
|
you have?" - the assistant answers from the tools it was actually given.
|
|
@@ -99000,7 +99185,17 @@ cannot change anything: it gets no tool that edits or runs commands, and recomme
|
|
|
99000
99185
|
|
|
99001
99186
|
**A contract on a connector** ("What passes along here"): what one step hands to the next, such as "the failing
|
|
99002
99187
|
tests, each with file:line". The first is told its answer must contain it, the second that it will be given it and to
|
|
99003
|
-
say what is missing - so what was agreed between them is written down.
|
|
99188
|
+
say what is missing - so what was agreed between them is written down.
|
|
99189
|
+
|
|
99190
|
+
**Checked contracts.** Under the contract, **Required items** (one per line: "Changed files", "Tests run") are
|
|
99191
|
+
checked, not hoped for. The sending specialist is told to give each on a line of its own ("Changed files: ...");
|
|
99192
|
+
after it answers, Light Code checks every item is there and asks the same specialist again for any it left out -
|
|
99193
|
+
twice at most - before anything moves on. The main agent is told if a hand-over is still incomplete, and the exchange
|
|
99194
|
+
log marks each contract kept or what was missing. The check reads the text; no model is asked whether it was kept.
|
|
99195
|
+
|
|
99196
|
+
**The agent proposes contracts** for connectors you left without one: when it plans, it calls
|
|
99197
|
+
set_strategy_contracts with a contract and required items, and you approve it (the prompt shows every change). It
|
|
99198
|
+
changes this chat's copy; save in the Strategy window to keep it in your library. **Where to see it:** click the arrow - the
|
|
99004
99199
|
contract is on the right; with nothing selected, the right-hand panel lists every contract in the strategy, and an
|
|
99005
99200
|
arrow carrying one is labelled "contract". What was actually sent and answered along it is under "What passed
|
|
99006
99201
|
between them" (select the arrow to narrow it to those two).
|
|
@@ -100204,7 +100399,7 @@ var writeToFileTool = {
|
|
|
100204
100399
|
|
|
100205
100400
|
// ../../packages/core/dist/tools/wait.js
|
|
100206
100401
|
var MAX_WAIT_SECONDS = 900;
|
|
100207
|
-
var
|
|
100402
|
+
var schema9 = external_exports.object({
|
|
100208
100403
|
seconds: external_exports.number().int().min(1).max(MAX_WAIT_SECONDS).describe(`How long to wait, 1\u2013${String(MAX_WAIT_SECONDS)} seconds. Prefer fewer, longer waits: every check and every wait is a step.`),
|
|
100209
100404
|
reason: external_exports.string().max(200).optional().describe('What you are waiting for, shown to the user \u2014 e.g. "PAY_EOD to finish".')
|
|
100210
100405
|
});
|
|
@@ -100215,7 +100410,7 @@ function createWaitTool(options = {}) {
|
|
|
100215
100410
|
name: "wait",
|
|
100216
100411
|
group: "always",
|
|
100217
100412
|
description: `Wait before looking again \u2014 for a job, build, deployment or file that is not ready yet. Check with the ordinary tool, wait, then check again; say what you are waiting for in \`reason\`. Ends early if the user sends a message. Up to ${String(MAX_WAIT_SECONDS)} seconds per call; for longer, wait again after checking.`,
|
|
100218
|
-
parametersSchema:
|
|
100413
|
+
parametersSchema: schema9,
|
|
100219
100414
|
async execute(params3, context) {
|
|
100220
100415
|
const started = now();
|
|
100221
100416
|
const until = started + params3.seconds * 1e3;
|
|
@@ -100620,7 +100815,7 @@ function describeNestedCall(caller, callee) {
|
|
|
100620
100815
|
}
|
|
100621
100816
|
|
|
100622
100817
|
// ../../packages/core/dist/tools/checkCollectorTool.js
|
|
100623
|
-
var
|
|
100818
|
+
var schema10 = external_exports.object({
|
|
100624
100819
|
name: external_exports.string().min(1).describe("The Python tool to examine, with or without the `py__` prefix."),
|
|
100625
100820
|
arguments: external_exports.record(external_exports.string(), external_exports.unknown()).optional().describe("Arguments to call it with, if it needs any. `since` is supplied automatically by a sync.")
|
|
100626
100821
|
});
|
|
@@ -100647,7 +100842,7 @@ function createCheckCollectorTool(options) {
|
|
|
100647
100842
|
name: "check_collector",
|
|
100648
100843
|
group: "read",
|
|
100649
100844
|
description: "Runs a Python tool and says whether its output can be indexed as a custom dataset, and if not, exactly what to change. Use it when a dataset sync reports that records are not usable, when adapting an existing tool into a collector, or after writing one to confirm it before the user configures a dataset around it. Changes nothing \u2014 it reports; fixing is an ordinary update_python_tool edit.",
|
|
100650
|
-
parametersSchema:
|
|
100845
|
+
parametersSchema: schema10,
|
|
100651
100846
|
execute: async (params3) => {
|
|
100652
100847
|
const bare = params3.name.replace(/^py__/, "");
|
|
100653
100848
|
const full = `py__${bare}`;
|
|
@@ -101951,12 +102146,12 @@ var ReviewQueue = class {
|
|
|
101951
102146
|
return [...await this.load()];
|
|
101952
102147
|
}
|
|
101953
102148
|
async pending() {
|
|
101954
|
-
return (await this.load()).filter((
|
|
102149
|
+
return (await this.load()).filter((item2) => item2.status === "pending");
|
|
101955
102150
|
}
|
|
101956
102151
|
async submit(request) {
|
|
101957
102152
|
const items = await this.load();
|
|
101958
102153
|
const superseded = items.findIndex(
|
|
101959
|
-
(
|
|
102154
|
+
(item2) => item2.status === "pending" && item2.kind === request.kind && item2.name === request.name
|
|
101960
102155
|
);
|
|
101961
102156
|
const queued = {
|
|
101962
102157
|
...request,
|
|
@@ -101971,14 +102166,14 @@ var ReviewQueue = class {
|
|
|
101971
102166
|
}
|
|
101972
102167
|
async decide(id, decision) {
|
|
101973
102168
|
const items = await this.load();
|
|
101974
|
-
const
|
|
101975
|
-
if (
|
|
101976
|
-
|
|
101977
|
-
|
|
101978
|
-
|
|
101979
|
-
if (decision.reason !== void 0 && decision.reason.length > 0)
|
|
102169
|
+
const item2 = items.find((candidate) => candidate.id === id);
|
|
102170
|
+
if (item2 === void 0 || item2.status !== "pending") return void 0;
|
|
102171
|
+
item2.status = decision.approved ? "approved" : "rejected";
|
|
102172
|
+
item2.decidedBy = decision.by;
|
|
102173
|
+
item2.decidedAt = Date.now();
|
|
102174
|
+
if (decision.reason !== void 0 && decision.reason.length > 0) item2.reason = decision.reason;
|
|
101980
102175
|
await this.persist(items);
|
|
101981
|
-
return
|
|
102176
|
+
return item2;
|
|
101982
102177
|
}
|
|
101983
102178
|
/**
|
|
101984
102179
|
* Drops decided items older than the cutoff.
|
|
@@ -101990,7 +102185,7 @@ var ReviewQueue = class {
|
|
|
101990
102185
|
async prune(olderThanMs) {
|
|
101991
102186
|
const cutoff = Date.now() - olderThanMs;
|
|
101992
102187
|
const items = await this.load();
|
|
101993
|
-
const kept = items.filter((
|
|
102188
|
+
const kept = items.filter((item2) => item2.status === "pending" || (item2.decidedAt ?? 0) > cutoff);
|
|
101994
102189
|
if (kept.length !== items.length) await this.persist(kept);
|
|
101995
102190
|
}
|
|
101996
102191
|
};
|
|
@@ -103230,22 +103425,22 @@ async function startServer(options) {
|
|
|
103230
103425
|
async function postReviews(principal, connection) {
|
|
103231
103426
|
const canDecide = isAdminSession(principal);
|
|
103232
103427
|
const all = await reviews.list();
|
|
103233
|
-
const visible = canDecide ? all : all.filter((
|
|
103428
|
+
const visible = canDecide ? all : all.filter((item2) => item2.authorId === principal.id);
|
|
103234
103429
|
connection.transport.post({
|
|
103235
103430
|
type: "reviews",
|
|
103236
103431
|
canDecide,
|
|
103237
|
-
items: visible.sort((a, b) => b.submittedAt - a.submittedAt).map((
|
|
103238
|
-
id:
|
|
103239
|
-
kind:
|
|
103240
|
-
name:
|
|
103241
|
-
content:
|
|
103242
|
-
existingContent:
|
|
103243
|
-
authorName:
|
|
103244
|
-
submittedAt:
|
|
103245
|
-
status:
|
|
103246
|
-
...
|
|
103247
|
-
...
|
|
103248
|
-
...
|
|
103432
|
+
items: visible.sort((a, b) => b.submittedAt - a.submittedAt).map((item2) => ({
|
|
103433
|
+
id: item2.id,
|
|
103434
|
+
kind: item2.kind,
|
|
103435
|
+
name: item2.name,
|
|
103436
|
+
content: item2.content,
|
|
103437
|
+
existingContent: item2.existingContent,
|
|
103438
|
+
authorName: item2.authorName,
|
|
103439
|
+
submittedAt: item2.submittedAt,
|
|
103440
|
+
status: item2.status,
|
|
103441
|
+
...item2.producedBy !== void 0 ? { producedBy: item2.producedBy } : {},
|
|
103442
|
+
...item2.decidedBy !== void 0 ? { decidedBy: item2.decidedBy } : {},
|
|
103443
|
+
...item2.reason !== void 0 ? { reason: item2.reason } : {}
|
|
103249
103444
|
}))
|
|
103250
103445
|
});
|
|
103251
103446
|
}
|
|
@@ -103254,19 +103449,19 @@ async function startServer(options) {
|
|
|
103254
103449
|
await postReviews({ id, displayName: id }, connection);
|
|
103255
103450
|
}
|
|
103256
103451
|
}
|
|
103257
|
-
async function applyApproval(
|
|
103452
|
+
async function applyApproval(item2) {
|
|
103258
103453
|
if (options.workspaceRoot === void 0)
|
|
103259
103454
|
return "No workspace is open, so there is nowhere to write it.";
|
|
103260
103455
|
try {
|
|
103261
|
-
if (
|
|
103456
|
+
if (item2.kind === "skill") {
|
|
103262
103457
|
const dir2 = import_node_path65.default.join(options.workspaceRoot, ".lightcode", "skills");
|
|
103263
103458
|
await import_promises36.default.mkdir(dir2, { recursive: true });
|
|
103264
|
-
await import_promises36.default.writeFile(import_node_path65.default.join(dir2, `${
|
|
103459
|
+
await import_promises36.default.writeFile(import_node_path65.default.join(dir2, `${item2.name}.md`), item2.content, "utf8");
|
|
103265
103460
|
return void 0;
|
|
103266
103461
|
}
|
|
103267
103462
|
const dir = import_node_path65.default.join(options.workspaceRoot, ".lightcode", "tools");
|
|
103268
103463
|
await import_promises36.default.mkdir(dir, { recursive: true });
|
|
103269
|
-
await import_promises36.default.writeFile(import_node_path65.default.join(dir, `${
|
|
103464
|
+
await import_promises36.default.writeFile(import_node_path65.default.join(dir, `${item2.name}.py`), item2.content, "utf8");
|
|
103270
103465
|
return void 0;
|
|
103271
103466
|
} catch (error51) {
|
|
103272
103467
|
return error51 instanceof Error ? error51.message : String(error51);
|