@finchtech/cli 0.5.2 → 0.5.4
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/README.md +33 -13
- package/dist/finch.js +1278 -868
- package/package.json +4 -4
package/dist/finch.js
CHANGED
|
@@ -1082,52 +1082,52 @@ var require_util = __commonJS({
|
|
|
1082
1082
|
return hash5;
|
|
1083
1083
|
}
|
|
1084
1084
|
exports.toHash = toHash;
|
|
1085
|
-
function alwaysValidSchema(it,
|
|
1086
|
-
if (typeof
|
|
1087
|
-
return
|
|
1088
|
-
if (Object.keys(
|
|
1085
|
+
function alwaysValidSchema(it, schema6) {
|
|
1086
|
+
if (typeof schema6 == "boolean")
|
|
1087
|
+
return schema6;
|
|
1088
|
+
if (Object.keys(schema6).length === 0)
|
|
1089
1089
|
return true;
|
|
1090
|
-
checkUnknownRules(it,
|
|
1091
|
-
return !schemaHasRules(
|
|
1090
|
+
checkUnknownRules(it, schema6);
|
|
1091
|
+
return !schemaHasRules(schema6, it.self.RULES.all);
|
|
1092
1092
|
}
|
|
1093
1093
|
exports.alwaysValidSchema = alwaysValidSchema;
|
|
1094
|
-
function checkUnknownRules(it,
|
|
1094
|
+
function checkUnknownRules(it, schema6 = it.schema) {
|
|
1095
1095
|
const { opts, self } = it;
|
|
1096
1096
|
if (!opts.strictSchema)
|
|
1097
1097
|
return;
|
|
1098
|
-
if (typeof
|
|
1098
|
+
if (typeof schema6 === "boolean")
|
|
1099
1099
|
return;
|
|
1100
1100
|
const rules = self.RULES.keywords;
|
|
1101
|
-
for (const key in
|
|
1101
|
+
for (const key in schema6) {
|
|
1102
1102
|
if (!rules[key])
|
|
1103
1103
|
checkStrictMode(it, `unknown keyword: "${key}"`);
|
|
1104
1104
|
}
|
|
1105
1105
|
}
|
|
1106
1106
|
exports.checkUnknownRules = checkUnknownRules;
|
|
1107
|
-
function schemaHasRules(
|
|
1108
|
-
if (typeof
|
|
1109
|
-
return !
|
|
1110
|
-
for (const key in
|
|
1107
|
+
function schemaHasRules(schema6, rules) {
|
|
1108
|
+
if (typeof schema6 == "boolean")
|
|
1109
|
+
return !schema6;
|
|
1110
|
+
for (const key in schema6)
|
|
1111
1111
|
if (rules[key])
|
|
1112
1112
|
return true;
|
|
1113
1113
|
return false;
|
|
1114
1114
|
}
|
|
1115
1115
|
exports.schemaHasRules = schemaHasRules;
|
|
1116
|
-
function schemaHasRulesButRef(
|
|
1117
|
-
if (typeof
|
|
1118
|
-
return !
|
|
1119
|
-
for (const key in
|
|
1116
|
+
function schemaHasRulesButRef(schema6, RULES) {
|
|
1117
|
+
if (typeof schema6 == "boolean")
|
|
1118
|
+
return !schema6;
|
|
1119
|
+
for (const key in schema6)
|
|
1120
1120
|
if (key !== "$ref" && RULES.all[key])
|
|
1121
1121
|
return true;
|
|
1122
1122
|
return false;
|
|
1123
1123
|
}
|
|
1124
1124
|
exports.schemaHasRulesButRef = schemaHasRulesButRef;
|
|
1125
|
-
function schemaRefOrVal({ topSchemaRef, schemaPath },
|
|
1125
|
+
function schemaRefOrVal({ topSchemaRef, schemaPath }, schema6, keyword, $data) {
|
|
1126
1126
|
if (!$data) {
|
|
1127
|
-
if (typeof
|
|
1128
|
-
return
|
|
1129
|
-
if (typeof
|
|
1130
|
-
return (0, codegen_1._)`${
|
|
1127
|
+
if (typeof schema6 == "number" || typeof schema6 == "boolean")
|
|
1128
|
+
return schema6;
|
|
1129
|
+
if (typeof schema6 == "string")
|
|
1130
|
+
return (0, codegen_1._)`${schema6}`;
|
|
1131
1131
|
}
|
|
1132
1132
|
return (0, codegen_1._)`${topSchemaRef}${schemaPath}${(0, codegen_1.getProperty)(keyword)}`;
|
|
1133
1133
|
}
|
|
@@ -1408,10 +1408,10 @@ var require_boolSchema = __commonJS({
|
|
|
1408
1408
|
message: "boolean schema is false"
|
|
1409
1409
|
};
|
|
1410
1410
|
function topBoolOrEmptySchema(it) {
|
|
1411
|
-
const { gen: gen2, schema:
|
|
1412
|
-
if (
|
|
1411
|
+
const { gen: gen2, schema: schema6, validateName } = it;
|
|
1412
|
+
if (schema6 === false) {
|
|
1413
1413
|
falseSchemaError(it, false);
|
|
1414
|
-
} else if (typeof
|
|
1414
|
+
} else if (typeof schema6 == "object" && schema6.$async === true) {
|
|
1415
1415
|
gen2.return(names_1.default.data);
|
|
1416
1416
|
} else {
|
|
1417
1417
|
gen2.assign((0, codegen_1._)`${validateName}.errors`, null);
|
|
@@ -1420,8 +1420,8 @@ var require_boolSchema = __commonJS({
|
|
|
1420
1420
|
}
|
|
1421
1421
|
exports.topBoolOrEmptySchema = topBoolOrEmptySchema;
|
|
1422
1422
|
function boolOrEmptySchema(it, valid) {
|
|
1423
|
-
const { gen: gen2, schema:
|
|
1424
|
-
if (
|
|
1423
|
+
const { gen: gen2, schema: schema6 } = it;
|
|
1424
|
+
if (schema6 === false) {
|
|
1425
1425
|
gen2.var(valid, false);
|
|
1426
1426
|
falseSchemaError(it);
|
|
1427
1427
|
} else {
|
|
@@ -1483,18 +1483,18 @@ var require_applicability = __commonJS({
|
|
|
1483
1483
|
"use strict";
|
|
1484
1484
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1485
1485
|
exports.shouldUseRule = exports.shouldUseGroup = exports.schemaHasRulesForType = void 0;
|
|
1486
|
-
function schemaHasRulesForType({ schema:
|
|
1486
|
+
function schemaHasRulesForType({ schema: schema6, self }, type) {
|
|
1487
1487
|
const group = self.RULES.types[type];
|
|
1488
|
-
return group && group !== true && shouldUseGroup(
|
|
1488
|
+
return group && group !== true && shouldUseGroup(schema6, group);
|
|
1489
1489
|
}
|
|
1490
1490
|
exports.schemaHasRulesForType = schemaHasRulesForType;
|
|
1491
|
-
function shouldUseGroup(
|
|
1492
|
-
return group.rules.some((rule) => shouldUseRule(
|
|
1491
|
+
function shouldUseGroup(schema6, group) {
|
|
1492
|
+
return group.rules.some((rule) => shouldUseRule(schema6, rule));
|
|
1493
1493
|
}
|
|
1494
1494
|
exports.shouldUseGroup = shouldUseGroup;
|
|
1495
|
-
function shouldUseRule(
|
|
1495
|
+
function shouldUseRule(schema6, rule) {
|
|
1496
1496
|
var _a4;
|
|
1497
|
-
return
|
|
1497
|
+
return schema6[rule.keyword] !== void 0 || ((_a4 = rule.definition.implements) === null || _a4 === void 0 ? void 0 : _a4.some((kwd) => schema6[kwd] !== void 0));
|
|
1498
1498
|
}
|
|
1499
1499
|
exports.shouldUseRule = shouldUseRule;
|
|
1500
1500
|
}
|
|
@@ -1516,17 +1516,17 @@ var require_dataType = __commonJS({
|
|
|
1516
1516
|
DataType2[DataType2["Correct"] = 0] = "Correct";
|
|
1517
1517
|
DataType2[DataType2["Wrong"] = 1] = "Wrong";
|
|
1518
1518
|
})(DataType || (exports.DataType = DataType = {}));
|
|
1519
|
-
function getSchemaTypes(
|
|
1520
|
-
const types = getJSONTypes(
|
|
1519
|
+
function getSchemaTypes(schema6) {
|
|
1520
|
+
const types = getJSONTypes(schema6.type);
|
|
1521
1521
|
const hasNull = types.includes("null");
|
|
1522
1522
|
if (hasNull) {
|
|
1523
|
-
if (
|
|
1523
|
+
if (schema6.nullable === false)
|
|
1524
1524
|
throw new Error("type: null contradicts nullable: false");
|
|
1525
1525
|
} else {
|
|
1526
|
-
if (!types.length &&
|
|
1526
|
+
if (!types.length && schema6.nullable !== void 0) {
|
|
1527
1527
|
throw new Error('"nullable" cannot be used without "type"');
|
|
1528
1528
|
}
|
|
1529
|
-
if (
|
|
1529
|
+
if (schema6.nullable === true)
|
|
1530
1530
|
types.push("null");
|
|
1531
1531
|
}
|
|
1532
1532
|
return types;
|
|
@@ -1658,8 +1658,8 @@ var require_dataType = __commonJS({
|
|
|
1658
1658
|
}
|
|
1659
1659
|
exports.checkDataTypes = checkDataTypes;
|
|
1660
1660
|
var typeError = {
|
|
1661
|
-
message: ({ schema:
|
|
1662
|
-
params: ({ schema:
|
|
1661
|
+
message: ({ schema: schema6 }) => `must be ${schema6}`,
|
|
1662
|
+
params: ({ schema: schema6, schemaValue }) => typeof schema6 == "string" ? (0, codegen_1._)`{type: ${schema6}}` : (0, codegen_1._)`{type: ${schemaValue}}`
|
|
1663
1663
|
};
|
|
1664
1664
|
function reportTypeError(it) {
|
|
1665
1665
|
const cxt = getTypeErrorContext(it);
|
|
@@ -1667,16 +1667,16 @@ var require_dataType = __commonJS({
|
|
|
1667
1667
|
}
|
|
1668
1668
|
exports.reportTypeError = reportTypeError;
|
|
1669
1669
|
function getTypeErrorContext(it) {
|
|
1670
|
-
const { gen: gen2, data, schema:
|
|
1671
|
-
const schemaCode = (0, util_1.schemaRefOrVal)(it,
|
|
1670
|
+
const { gen: gen2, data, schema: schema6 } = it;
|
|
1671
|
+
const schemaCode = (0, util_1.schemaRefOrVal)(it, schema6, "type");
|
|
1672
1672
|
return {
|
|
1673
1673
|
gen: gen2,
|
|
1674
1674
|
keyword: "type",
|
|
1675
1675
|
data,
|
|
1676
|
-
schema:
|
|
1676
|
+
schema: schema6.type,
|
|
1677
1677
|
schemaCode,
|
|
1678
1678
|
schemaValue: schemaCode,
|
|
1679
|
-
parentSchema:
|
|
1679
|
+
parentSchema: schema6,
|
|
1680
1680
|
params: {},
|
|
1681
1681
|
it
|
|
1682
1682
|
};
|
|
@@ -1829,15 +1829,15 @@ var require_code2 = __commonJS({
|
|
|
1829
1829
|
}
|
|
1830
1830
|
exports.validateArray = validateArray;
|
|
1831
1831
|
function validateUnion(cxt) {
|
|
1832
|
-
const { gen: gen2, schema:
|
|
1833
|
-
if (!Array.isArray(
|
|
1832
|
+
const { gen: gen2, schema: schema6, keyword, it } = cxt;
|
|
1833
|
+
if (!Array.isArray(schema6))
|
|
1834
1834
|
throw new Error("ajv implementation error");
|
|
1835
|
-
const alwaysValid =
|
|
1835
|
+
const alwaysValid = schema6.some((sch) => (0, util_1.alwaysValidSchema)(it, sch));
|
|
1836
1836
|
if (alwaysValid && !it.opts.unevaluated)
|
|
1837
1837
|
return;
|
|
1838
1838
|
const valid = gen2.let("valid", false);
|
|
1839
1839
|
const schValid = gen2.name("_valid");
|
|
1840
|
-
gen2.block(() =>
|
|
1840
|
+
gen2.block(() => schema6.forEach((_sch, i2) => {
|
|
1841
1841
|
const schCxt = cxt.subschema({
|
|
1842
1842
|
keyword,
|
|
1843
1843
|
schemaProp: i2,
|
|
@@ -1865,8 +1865,8 @@ var require_keyword = __commonJS({
|
|
|
1865
1865
|
var code_1 = require_code2();
|
|
1866
1866
|
var errors_1 = require_errors();
|
|
1867
1867
|
function macroKeywordCode(cxt, def) {
|
|
1868
|
-
const { gen: gen2, keyword, schema:
|
|
1869
|
-
const macroSchema = def.macro.call(it.self,
|
|
1868
|
+
const { gen: gen2, keyword, schema: schema6, parentSchema, it } = cxt;
|
|
1869
|
+
const macroSchema = def.macro.call(it.self, schema6, parentSchema, it);
|
|
1870
1870
|
const schemaRef = useKeyword(gen2, keyword, macroSchema);
|
|
1871
1871
|
if (it.opts.validateSchema !== false)
|
|
1872
1872
|
it.self.validateSchema(macroSchema, true);
|
|
@@ -1883,9 +1883,9 @@ var require_keyword = __commonJS({
|
|
|
1883
1883
|
exports.macroKeywordCode = macroKeywordCode;
|
|
1884
1884
|
function funcKeywordCode(cxt, def) {
|
|
1885
1885
|
var _a4;
|
|
1886
|
-
const { gen: gen2, keyword, schema:
|
|
1886
|
+
const { gen: gen2, keyword, schema: schema6, parentSchema, $data, it } = cxt;
|
|
1887
1887
|
checkAsyncKeyword(it, def);
|
|
1888
|
-
const validate7 = !$data && def.compile ? def.compile.call(it.self,
|
|
1888
|
+
const validate7 = !$data && def.compile ? def.compile.call(it.self, schema6, parentSchema, it) : def.validate;
|
|
1889
1889
|
const validateRef = useKeyword(gen2, keyword, validate7);
|
|
1890
1890
|
const valid = gen2.let("valid");
|
|
1891
1891
|
cxt.block$data(valid, validateKeyword);
|
|
@@ -1945,20 +1945,20 @@ var require_keyword = __commonJS({
|
|
|
1945
1945
|
throw new Error(`keyword "${keyword}" failed to compile`);
|
|
1946
1946
|
return gen2.scopeValue("keyword", typeof result2 == "function" ? { ref: result2 } : { ref: result2, code: (0, codegen_1.stringify)(result2) });
|
|
1947
1947
|
}
|
|
1948
|
-
function validSchemaType(
|
|
1949
|
-
return !schemaType.length || schemaType.some((st) => st === "array" ? Array.isArray(
|
|
1948
|
+
function validSchemaType(schema6, schemaType, allowUndefined = false) {
|
|
1949
|
+
return !schemaType.length || schemaType.some((st) => st === "array" ? Array.isArray(schema6) : st === "object" ? schema6 && typeof schema6 == "object" && !Array.isArray(schema6) : typeof schema6 == st || allowUndefined && typeof schema6 == "undefined");
|
|
1950
1950
|
}
|
|
1951
1951
|
exports.validSchemaType = validSchemaType;
|
|
1952
|
-
function validateKeywordUsage({ schema:
|
|
1952
|
+
function validateKeywordUsage({ schema: schema6, opts, self, errSchemaPath }, def, keyword) {
|
|
1953
1953
|
if (Array.isArray(def.keyword) ? !def.keyword.includes(keyword) : def.keyword !== keyword) {
|
|
1954
1954
|
throw new Error("ajv implementation error");
|
|
1955
1955
|
}
|
|
1956
1956
|
const deps = def.dependencies;
|
|
1957
|
-
if (deps === null || deps === void 0 ? void 0 : deps.some((kwd) => !Object.prototype.hasOwnProperty.call(
|
|
1957
|
+
if (deps === null || deps === void 0 ? void 0 : deps.some((kwd) => !Object.prototype.hasOwnProperty.call(schema6, kwd))) {
|
|
1958
1958
|
throw new Error(`parent schema must have dependencies of ${keyword}: ${deps.join(",")}`);
|
|
1959
1959
|
}
|
|
1960
1960
|
if (def.validateSchema) {
|
|
1961
|
-
const valid = def.validateSchema(
|
|
1961
|
+
const valid = def.validateSchema(schema6[keyword]);
|
|
1962
1962
|
if (!valid) {
|
|
1963
1963
|
const msg = `keyword "${keyword}" value is invalid at path "${errSchemaPath}": ` + self.errorsText(def.validateSchema.errors);
|
|
1964
1964
|
if (opts.validateSchema === "log")
|
|
@@ -1980,8 +1980,8 @@ var require_subschema = __commonJS({
|
|
|
1980
1980
|
exports.extendSubschemaMode = exports.extendSubschemaData = exports.getSubschema = void 0;
|
|
1981
1981
|
var codegen_1 = require_codegen();
|
|
1982
1982
|
var util_1 = require_util();
|
|
1983
|
-
function getSubschema(it, { keyword, schemaProp, schema:
|
|
1984
|
-
if (keyword !== void 0 &&
|
|
1983
|
+
function getSubschema(it, { keyword, schemaProp, schema: schema6, schemaPath, errSchemaPath, topSchemaRef }) {
|
|
1984
|
+
if (keyword !== void 0 && schema6 !== void 0) {
|
|
1985
1985
|
throw new Error('both "keyword" and "schema" passed, only one allowed');
|
|
1986
1986
|
}
|
|
1987
1987
|
if (keyword !== void 0) {
|
|
@@ -1996,12 +1996,12 @@ var require_subschema = __commonJS({
|
|
|
1996
1996
|
errSchemaPath: `${it.errSchemaPath}/${keyword}/${(0, util_1.escapeFragment)(schemaProp)}`
|
|
1997
1997
|
};
|
|
1998
1998
|
}
|
|
1999
|
-
if (
|
|
1999
|
+
if (schema6 !== void 0) {
|
|
2000
2000
|
if (schemaPath === void 0 || errSchemaPath === void 0 || topSchemaRef === void 0) {
|
|
2001
2001
|
throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');
|
|
2002
2002
|
}
|
|
2003
2003
|
return {
|
|
2004
|
-
schema:
|
|
2004
|
+
schema: schema6,
|
|
2005
2005
|
schemaPath,
|
|
2006
2006
|
topSchemaRef,
|
|
2007
2007
|
errSchemaPath
|
|
@@ -2094,7 +2094,7 @@ var require_fast_deep_equal = __commonJS({
|
|
|
2094
2094
|
var require_json_schema_traverse = __commonJS({
|
|
2095
2095
|
"../../node_modules/.pnpm/json-schema-traverse@1.0.0/node_modules/json-schema-traverse/index.js"(exports, module) {
|
|
2096
2096
|
"use strict";
|
|
2097
|
-
var traverse = module.exports = function(
|
|
2097
|
+
var traverse = module.exports = function(schema6, opts, cb) {
|
|
2098
2098
|
if (typeof opts == "function") {
|
|
2099
2099
|
cb = opts;
|
|
2100
2100
|
opts = {};
|
|
@@ -2104,7 +2104,7 @@ var require_json_schema_traverse = __commonJS({
|
|
|
2104
2104
|
};
|
|
2105
2105
|
var post = cb.post || function() {
|
|
2106
2106
|
};
|
|
2107
|
-
_traverse(opts, pre, post,
|
|
2107
|
+
_traverse(opts, pre, post, schema6, "", schema6);
|
|
2108
2108
|
};
|
|
2109
2109
|
traverse.keywords = {
|
|
2110
2110
|
additionalItems: true,
|
|
@@ -2150,26 +2150,26 @@ var require_json_schema_traverse = __commonJS({
|
|
|
2150
2150
|
maxProperties: true,
|
|
2151
2151
|
minProperties: true
|
|
2152
2152
|
};
|
|
2153
|
-
function _traverse(opts, pre, post,
|
|
2154
|
-
if (
|
|
2155
|
-
pre(
|
|
2156
|
-
for (var key in
|
|
2157
|
-
var sch =
|
|
2153
|
+
function _traverse(opts, pre, post, schema6, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex) {
|
|
2154
|
+
if (schema6 && typeof schema6 == "object" && !Array.isArray(schema6)) {
|
|
2155
|
+
pre(schema6, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex);
|
|
2156
|
+
for (var key in schema6) {
|
|
2157
|
+
var sch = schema6[key];
|
|
2158
2158
|
if (Array.isArray(sch)) {
|
|
2159
2159
|
if (key in traverse.arrayKeywords) {
|
|
2160
2160
|
for (var i2 = 0; i2 < sch.length; i2++)
|
|
2161
|
-
_traverse(opts, pre, post, sch[i2], jsonPtr + "/" + key + "/" + i2, rootSchema, jsonPtr, key,
|
|
2161
|
+
_traverse(opts, pre, post, sch[i2], jsonPtr + "/" + key + "/" + i2, rootSchema, jsonPtr, key, schema6, i2);
|
|
2162
2162
|
}
|
|
2163
2163
|
} else if (key in traverse.propsKeywords) {
|
|
2164
2164
|
if (sch && typeof sch == "object") {
|
|
2165
2165
|
for (var prop in sch)
|
|
2166
|
-
_traverse(opts, pre, post, sch[prop], jsonPtr + "/" + key + "/" + escapeJsonPtr(prop), rootSchema, jsonPtr, key,
|
|
2166
|
+
_traverse(opts, pre, post, sch[prop], jsonPtr + "/" + key + "/" + escapeJsonPtr(prop), rootSchema, jsonPtr, key, schema6, prop);
|
|
2167
2167
|
}
|
|
2168
2168
|
} else if (key in traverse.keywords || opts.allKeys && !(key in traverse.skipKeywords)) {
|
|
2169
|
-
_traverse(opts, pre, post, sch, jsonPtr + "/" + key, rootSchema, jsonPtr, key,
|
|
2169
|
+
_traverse(opts, pre, post, sch, jsonPtr + "/" + key, rootSchema, jsonPtr, key, schema6);
|
|
2170
2170
|
}
|
|
2171
2171
|
}
|
|
2172
|
-
post(
|
|
2172
|
+
post(schema6, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex);
|
|
2173
2173
|
}
|
|
2174
2174
|
}
|
|
2175
2175
|
function escapeJsonPtr(str) {
|
|
@@ -2205,14 +2205,14 @@ var require_resolve = __commonJS({
|
|
|
2205
2205
|
"enum",
|
|
2206
2206
|
"const"
|
|
2207
2207
|
]);
|
|
2208
|
-
function inlineRef(
|
|
2209
|
-
if (typeof
|
|
2208
|
+
function inlineRef(schema6, limit = true) {
|
|
2209
|
+
if (typeof schema6 == "boolean")
|
|
2210
2210
|
return true;
|
|
2211
2211
|
if (limit === true)
|
|
2212
|
-
return !hasRef(
|
|
2212
|
+
return !hasRef(schema6);
|
|
2213
2213
|
if (!limit)
|
|
2214
2214
|
return false;
|
|
2215
|
-
return countKeys(
|
|
2215
|
+
return countKeys(schema6) <= limit;
|
|
2216
2216
|
}
|
|
2217
2217
|
exports.inlineRef = inlineRef;
|
|
2218
2218
|
var REF_KEYWORDS = /* @__PURE__ */ new Set([
|
|
@@ -2222,11 +2222,11 @@ var require_resolve = __commonJS({
|
|
|
2222
2222
|
"$dynamicRef",
|
|
2223
2223
|
"$dynamicAnchor"
|
|
2224
2224
|
]);
|
|
2225
|
-
function hasRef(
|
|
2226
|
-
for (const key in
|
|
2225
|
+
function hasRef(schema6) {
|
|
2226
|
+
for (const key in schema6) {
|
|
2227
2227
|
if (REF_KEYWORDS.has(key))
|
|
2228
2228
|
return true;
|
|
2229
|
-
const sch =
|
|
2229
|
+
const sch = schema6[key];
|
|
2230
2230
|
if (Array.isArray(sch) && sch.some(hasRef))
|
|
2231
2231
|
return true;
|
|
2232
2232
|
if (typeof sch == "object" && hasRef(sch))
|
|
@@ -2234,16 +2234,16 @@ var require_resolve = __commonJS({
|
|
|
2234
2234
|
}
|
|
2235
2235
|
return false;
|
|
2236
2236
|
}
|
|
2237
|
-
function countKeys(
|
|
2237
|
+
function countKeys(schema6) {
|
|
2238
2238
|
let count = 0;
|
|
2239
|
-
for (const key in
|
|
2239
|
+
for (const key in schema6) {
|
|
2240
2240
|
if (key === "$ref")
|
|
2241
2241
|
return Infinity;
|
|
2242
2242
|
count++;
|
|
2243
2243
|
if (SIMPLE_INLINED.has(key))
|
|
2244
2244
|
continue;
|
|
2245
|
-
if (typeof
|
|
2246
|
-
(0, util_1.eachItem)(
|
|
2245
|
+
if (typeof schema6[key] == "object") {
|
|
2246
|
+
(0, util_1.eachItem)(schema6[key], (sch) => count += countKeys(sch));
|
|
2247
2247
|
}
|
|
2248
2248
|
if (count === Infinity)
|
|
2249
2249
|
return Infinity;
|
|
@@ -2273,16 +2273,16 @@ var require_resolve = __commonJS({
|
|
|
2273
2273
|
}
|
|
2274
2274
|
exports.resolveUrl = resolveUrl;
|
|
2275
2275
|
var ANCHOR = /^[a-z_][-a-z0-9._]*$/i;
|
|
2276
|
-
function getSchemaRefs(
|
|
2277
|
-
if (typeof
|
|
2276
|
+
function getSchemaRefs(schema6, baseId) {
|
|
2277
|
+
if (typeof schema6 == "boolean")
|
|
2278
2278
|
return {};
|
|
2279
2279
|
const { schemaId, uriResolver } = this.opts;
|
|
2280
|
-
const schId = normalizeId(
|
|
2280
|
+
const schId = normalizeId(schema6[schemaId] || baseId);
|
|
2281
2281
|
const baseIds = { "": schId };
|
|
2282
2282
|
const pathPrefix = getFullPath(uriResolver, schId, false);
|
|
2283
2283
|
const localRefs = {};
|
|
2284
2284
|
const schemaRefs = /* @__PURE__ */ new Set();
|
|
2285
|
-
traverse(
|
|
2285
|
+
traverse(schema6, { allKeys: true }, (sch, jsonPtr, _, parentJsonPtr) => {
|
|
2286
2286
|
if (parentJsonPtr === void 0)
|
|
2287
2287
|
return;
|
|
2288
2288
|
const fullPath = pathPrefix + jsonPtr;
|
|
@@ -2363,15 +2363,15 @@ var require_validate = __commonJS({
|
|
|
2363
2363
|
validateFunction(it, () => (0, boolSchema_1.topBoolOrEmptySchema)(it));
|
|
2364
2364
|
}
|
|
2365
2365
|
exports.validateFunctionCode = validateFunctionCode;
|
|
2366
|
-
function validateFunction({ gen: gen2, validateName, schema:
|
|
2366
|
+
function validateFunction({ gen: gen2, validateName, schema: schema6, schemaEnv, opts }, body) {
|
|
2367
2367
|
if (opts.code.es5) {
|
|
2368
2368
|
gen2.func(validateName, (0, codegen_1._)`${names_1.default.data}, ${names_1.default.valCxt}`, schemaEnv.$async, () => {
|
|
2369
|
-
gen2.code((0, codegen_1._)`"use strict"; ${funcSourceUrl(
|
|
2369
|
+
gen2.code((0, codegen_1._)`"use strict"; ${funcSourceUrl(schema6, opts)}`);
|
|
2370
2370
|
destructureValCxtES5(gen2, opts);
|
|
2371
2371
|
gen2.code(body);
|
|
2372
2372
|
});
|
|
2373
2373
|
} else {
|
|
2374
|
-
gen2.func(validateName, (0, codegen_1._)`${names_1.default.data}, ${destructureValCxt(opts)}`, schemaEnv.$async, () => gen2.code(funcSourceUrl(
|
|
2374
|
+
gen2.func(validateName, (0, codegen_1._)`${names_1.default.data}, ${destructureValCxt(opts)}`, schemaEnv.$async, () => gen2.code(funcSourceUrl(schema6, opts)).code(body));
|
|
2375
2375
|
}
|
|
2376
2376
|
}
|
|
2377
2377
|
function destructureValCxt(opts) {
|
|
@@ -2395,9 +2395,9 @@ var require_validate = __commonJS({
|
|
|
2395
2395
|
});
|
|
2396
2396
|
}
|
|
2397
2397
|
function topSchemaObjCode(it) {
|
|
2398
|
-
const { schema:
|
|
2398
|
+
const { schema: schema6, opts, gen: gen2 } = it;
|
|
2399
2399
|
validateFunction(it, () => {
|
|
2400
|
-
if (opts.$comment &&
|
|
2400
|
+
if (opts.$comment && schema6.$comment)
|
|
2401
2401
|
commentKeyword(it);
|
|
2402
2402
|
checkNoDefault(it);
|
|
2403
2403
|
gen2.let(names_1.default.vErrors, null);
|
|
@@ -2415,8 +2415,8 @@ var require_validate = __commonJS({
|
|
|
2415
2415
|
gen2.if((0, codegen_1._)`${it.evaluated}.dynamicProps`, () => gen2.assign((0, codegen_1._)`${it.evaluated}.props`, (0, codegen_1._)`undefined`));
|
|
2416
2416
|
gen2.if((0, codegen_1._)`${it.evaluated}.dynamicItems`, () => gen2.assign((0, codegen_1._)`${it.evaluated}.items`, (0, codegen_1._)`undefined`));
|
|
2417
2417
|
}
|
|
2418
|
-
function funcSourceUrl(
|
|
2419
|
-
const schId = typeof
|
|
2418
|
+
function funcSourceUrl(schema6, opts) {
|
|
2419
|
+
const schId = typeof schema6 == "object" && schema6[opts.schemaId];
|
|
2420
2420
|
return schId && (opts.code.source || opts.code.process) ? (0, codegen_1._)`/*# sourceURL=${schId} */` : codegen_1.nil;
|
|
2421
2421
|
}
|
|
2422
2422
|
function subschemaCode(it, valid) {
|
|
@@ -2429,10 +2429,10 @@ var require_validate = __commonJS({
|
|
|
2429
2429
|
}
|
|
2430
2430
|
(0, boolSchema_1.boolOrEmptySchema)(it, valid);
|
|
2431
2431
|
}
|
|
2432
|
-
function schemaCxtHasRules({ schema:
|
|
2433
|
-
if (typeof
|
|
2434
|
-
return !
|
|
2435
|
-
for (const key in
|
|
2432
|
+
function schemaCxtHasRules({ schema: schema6, self }) {
|
|
2433
|
+
if (typeof schema6 == "boolean")
|
|
2434
|
+
return !schema6;
|
|
2435
|
+
for (const key in schema6)
|
|
2436
2436
|
if (self.RULES.all[key])
|
|
2437
2437
|
return true;
|
|
2438
2438
|
return false;
|
|
@@ -2441,8 +2441,8 @@ var require_validate = __commonJS({
|
|
|
2441
2441
|
return typeof it.schema != "boolean";
|
|
2442
2442
|
}
|
|
2443
2443
|
function subSchemaObjCode(it, valid) {
|
|
2444
|
-
const { schema:
|
|
2445
|
-
if (opts.$comment &&
|
|
2444
|
+
const { schema: schema6, gen: gen2, opts } = it;
|
|
2445
|
+
if (opts.$comment && schema6.$comment)
|
|
2446
2446
|
commentKeyword(it);
|
|
2447
2447
|
updateContext(it);
|
|
2448
2448
|
checkAsyncSchema(it);
|
|
@@ -2462,14 +2462,14 @@ var require_validate = __commonJS({
|
|
|
2462
2462
|
schemaKeywords(it, types, !checkedTypes, errsCount);
|
|
2463
2463
|
}
|
|
2464
2464
|
function checkRefsAndKeywords(it) {
|
|
2465
|
-
const { schema:
|
|
2466
|
-
if (
|
|
2465
|
+
const { schema: schema6, errSchemaPath, opts, self } = it;
|
|
2466
|
+
if (schema6.$ref && opts.ignoreKeywordsWithRef && (0, util_1.schemaHasRulesButRef)(schema6, self.RULES)) {
|
|
2467
2467
|
self.logger.warn(`$ref: keywords ignored in schema at path "${errSchemaPath}"`);
|
|
2468
2468
|
}
|
|
2469
2469
|
}
|
|
2470
2470
|
function checkNoDefault(it) {
|
|
2471
|
-
const { schema:
|
|
2472
|
-
if (
|
|
2471
|
+
const { schema: schema6, opts } = it;
|
|
2472
|
+
if (schema6.default !== void 0 && opts.useDefaults && opts.strictSchema) {
|
|
2473
2473
|
(0, util_1.checkStrictMode)(it, "default is ignored in the schema root");
|
|
2474
2474
|
}
|
|
2475
2475
|
}
|
|
@@ -2482,8 +2482,8 @@ var require_validate = __commonJS({
|
|
|
2482
2482
|
if (it.schema.$async && !it.schemaEnv.$async)
|
|
2483
2483
|
throw new Error("async schema in sync schema");
|
|
2484
2484
|
}
|
|
2485
|
-
function commentKeyword({ gen: gen2, schemaEnv, schema:
|
|
2486
|
-
const msg =
|
|
2485
|
+
function commentKeyword({ gen: gen2, schemaEnv, schema: schema6, errSchemaPath, opts }) {
|
|
2486
|
+
const msg = schema6.$comment;
|
|
2487
2487
|
if (opts.$comment === true) {
|
|
2488
2488
|
gen2.code((0, codegen_1._)`${names_1.default.self}.logger.log(${msg})`);
|
|
2489
2489
|
} else if (typeof opts.$comment == "function") {
|
|
@@ -2510,9 +2510,9 @@ var require_validate = __commonJS({
|
|
|
2510
2510
|
gen2.assign((0, codegen_1._)`${evaluated}.items`, items);
|
|
2511
2511
|
}
|
|
2512
2512
|
function schemaKeywords(it, types, typeErrors, errsCount) {
|
|
2513
|
-
const { gen: gen2, schema:
|
|
2513
|
+
const { gen: gen2, schema: schema6, data, allErrors, opts, self } = it;
|
|
2514
2514
|
const { RULES } = self;
|
|
2515
|
-
if (
|
|
2515
|
+
if (schema6.$ref && (opts.ignoreKeywordsWithRef || !(0, util_1.schemaHasRulesButRef)(schema6, RULES))) {
|
|
2516
2516
|
gen2.block(() => keywordCode(it, "$ref", RULES.all.$ref.definition));
|
|
2517
2517
|
return;
|
|
2518
2518
|
}
|
|
@@ -2524,7 +2524,7 @@ var require_validate = __commonJS({
|
|
|
2524
2524
|
groupKeywords(RULES.post);
|
|
2525
2525
|
});
|
|
2526
2526
|
function groupKeywords(group) {
|
|
2527
|
-
if (!(0, applicability_1.shouldUseGroup)(
|
|
2527
|
+
if (!(0, applicability_1.shouldUseGroup)(schema6, group))
|
|
2528
2528
|
return;
|
|
2529
2529
|
if (group.type) {
|
|
2530
2530
|
gen2.if((0, dataType_2.checkDataType)(group.type, data, opts.strictNumbers));
|
|
@@ -2542,12 +2542,12 @@ var require_validate = __commonJS({
|
|
|
2542
2542
|
}
|
|
2543
2543
|
}
|
|
2544
2544
|
function iterateKeywords(it, group) {
|
|
2545
|
-
const { gen: gen2, schema:
|
|
2545
|
+
const { gen: gen2, schema: schema6, opts: { useDefaults } } = it;
|
|
2546
2546
|
if (useDefaults)
|
|
2547
2547
|
(0, defaults_1.assignDefaults)(it, group.type);
|
|
2548
2548
|
gen2.block(() => {
|
|
2549
2549
|
for (const rule of group.rules) {
|
|
2550
|
-
if ((0, applicability_1.shouldUseRule)(
|
|
2550
|
+
if ((0, applicability_1.shouldUseRule)(schema6, rule)) {
|
|
2551
2551
|
keywordCode(it, rule.keyword, rule.definition, group.type);
|
|
2552
2552
|
}
|
|
2553
2553
|
}
|
|
@@ -2892,17 +2892,17 @@ var require_compile = __commonJS({
|
|
|
2892
2892
|
var _a4;
|
|
2893
2893
|
this.refs = {};
|
|
2894
2894
|
this.dynamicAnchors = {};
|
|
2895
|
-
let
|
|
2895
|
+
let schema6;
|
|
2896
2896
|
if (typeof env.schema == "object")
|
|
2897
|
-
|
|
2897
|
+
schema6 = env.schema;
|
|
2898
2898
|
this.schema = env.schema;
|
|
2899
2899
|
this.schemaId = env.schemaId;
|
|
2900
2900
|
this.root = env.root || this;
|
|
2901
|
-
this.baseId = (_a4 = env.baseId) !== null && _a4 !== void 0 ? _a4 : (0, resolve_1.normalizeId)(
|
|
2901
|
+
this.baseId = (_a4 = env.baseId) !== null && _a4 !== void 0 ? _a4 : (0, resolve_1.normalizeId)(schema6 === null || schema6 === void 0 ? void 0 : schema6[env.schemaId || "$id"]);
|
|
2902
2902
|
this.schemaPath = env.schemaPath;
|
|
2903
2903
|
this.localRefs = env.localRefs;
|
|
2904
2904
|
this.meta = env.meta;
|
|
2905
|
-
this.$async =
|
|
2905
|
+
this.$async = schema6 === null || schema6 === void 0 ? void 0 : schema6.$async;
|
|
2906
2906
|
this.refs = {};
|
|
2907
2907
|
}
|
|
2908
2908
|
};
|
|
@@ -3001,10 +3001,10 @@ var require_compile = __commonJS({
|
|
|
3001
3001
|
return schOrFunc;
|
|
3002
3002
|
let _sch = resolve4.call(this, root, ref);
|
|
3003
3003
|
if (_sch === void 0) {
|
|
3004
|
-
const
|
|
3004
|
+
const schema6 = (_a4 = root.localRefs) === null || _a4 === void 0 ? void 0 : _a4[ref];
|
|
3005
3005
|
const { schemaId } = this.opts;
|
|
3006
|
-
if (
|
|
3007
|
-
_sch = new SchemaEnv({ schema:
|
|
3006
|
+
if (schema6)
|
|
3007
|
+
_sch = new SchemaEnv({ schema: schema6, schemaId, root, baseId });
|
|
3008
3008
|
}
|
|
3009
3009
|
if (_sch === void 0)
|
|
3010
3010
|
return;
|
|
@@ -3052,12 +3052,12 @@ var require_compile = __commonJS({
|
|
|
3052
3052
|
if (!schOrRef.validate)
|
|
3053
3053
|
compileSchema.call(this, schOrRef);
|
|
3054
3054
|
if (id === (0, resolve_1.normalizeId)(ref)) {
|
|
3055
|
-
const { schema:
|
|
3055
|
+
const { schema: schema6 } = schOrRef;
|
|
3056
3056
|
const { schemaId } = this.opts;
|
|
3057
|
-
const schId =
|
|
3057
|
+
const schId = schema6[schemaId];
|
|
3058
3058
|
if (schId)
|
|
3059
3059
|
baseId = (0, resolve_1.resolveUrl)(this.opts.uriResolver, baseId, schId);
|
|
3060
|
-
return new SchemaEnv({ schema:
|
|
3060
|
+
return new SchemaEnv({ schema: schema6, schemaId, root, baseId });
|
|
3061
3061
|
}
|
|
3062
3062
|
return getJsonPointer.call(this, p, schOrRef);
|
|
3063
3063
|
}
|
|
@@ -3069,29 +3069,29 @@ var require_compile = __commonJS({
|
|
|
3069
3069
|
"dependencies",
|
|
3070
3070
|
"definitions"
|
|
3071
3071
|
]);
|
|
3072
|
-
function getJsonPointer(parsedRef, { baseId, schema:
|
|
3072
|
+
function getJsonPointer(parsedRef, { baseId, schema: schema6, root }) {
|
|
3073
3073
|
var _a4;
|
|
3074
3074
|
if (((_a4 = parsedRef.fragment) === null || _a4 === void 0 ? void 0 : _a4[0]) !== "/")
|
|
3075
3075
|
return;
|
|
3076
3076
|
for (const part of parsedRef.fragment.slice(1).split("/")) {
|
|
3077
|
-
if (typeof
|
|
3077
|
+
if (typeof schema6 === "boolean")
|
|
3078
3078
|
return;
|
|
3079
|
-
const partSchema =
|
|
3079
|
+
const partSchema = schema6[(0, util_1.unescapeFragment)(part)];
|
|
3080
3080
|
if (partSchema === void 0)
|
|
3081
3081
|
return;
|
|
3082
|
-
|
|
3083
|
-
const schId = typeof
|
|
3082
|
+
schema6 = partSchema;
|
|
3083
|
+
const schId = typeof schema6 === "object" && schema6[this.opts.schemaId];
|
|
3084
3084
|
if (!PREVENT_SCOPE_CHANGE.has(part) && schId) {
|
|
3085
3085
|
baseId = (0, resolve_1.resolveUrl)(this.opts.uriResolver, baseId, schId);
|
|
3086
3086
|
}
|
|
3087
3087
|
}
|
|
3088
3088
|
let env;
|
|
3089
|
-
if (typeof
|
|
3090
|
-
const $ref = (0, resolve_1.resolveUrl)(this.opts.uriResolver, baseId,
|
|
3089
|
+
if (typeof schema6 != "boolean" && schema6.$ref && !(0, util_1.schemaHasRulesButRef)(schema6, this.RULES)) {
|
|
3090
|
+
const $ref = (0, resolve_1.resolveUrl)(this.opts.uriResolver, baseId, schema6.$ref);
|
|
3091
3091
|
env = resolveSchema.call(this, root, $ref);
|
|
3092
3092
|
}
|
|
3093
3093
|
const { schemaId } = this.opts;
|
|
3094
|
-
env = env || new SchemaEnv({ schema:
|
|
3094
|
+
env = env || new SchemaEnv({ schema: schema6, schemaId, root, baseId });
|
|
3095
3095
|
if (env.schema !== env.root.schema)
|
|
3096
3096
|
return env;
|
|
3097
3097
|
return void 0;
|
|
@@ -3791,18 +3791,18 @@ var require_fast_uri = __commonJS({
|
|
|
3791
3791
|
var URI_PARSE = /^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;
|
|
3792
3792
|
var AUTHORITY_PREFIX = /^(?:[^#/:?]+:)?\/\/([^/?#]*)/;
|
|
3793
3793
|
var AUTHORITY_INTRODUCER_REGION = /^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;
|
|
3794
|
-
function getParseError(
|
|
3795
|
-
if (matches[2] !== void 0 &&
|
|
3794
|
+
function getParseError(parsed3, matches) {
|
|
3795
|
+
if (matches[2] !== void 0 && parsed3.path && parsed3.path[0] !== "/") {
|
|
3796
3796
|
return 'URI path must start with "/" when authority is present.';
|
|
3797
3797
|
}
|
|
3798
|
-
if (typeof
|
|
3798
|
+
if (typeof parsed3.port === "number" && (parsed3.port < 0 || parsed3.port > 65535)) {
|
|
3799
3799
|
return "URI port is malformed.";
|
|
3800
3800
|
}
|
|
3801
3801
|
return void 0;
|
|
3802
3802
|
}
|
|
3803
3803
|
function parseWithStatus(uri, opts) {
|
|
3804
3804
|
const options = Object.assign({}, opts);
|
|
3805
|
-
const
|
|
3805
|
+
const parsed3 = {
|
|
3806
3806
|
scheme: void 0,
|
|
3807
3807
|
userinfo: void 0,
|
|
3808
3808
|
host: "",
|
|
@@ -3822,7 +3822,7 @@ var require_fast_uri = __commonJS({
|
|
|
3822
3822
|
}
|
|
3823
3823
|
const authorityMatch = uri.match(AUTHORITY_PREFIX);
|
|
3824
3824
|
if (authorityMatch !== null && authorityMatch[1].indexOf("\\") !== -1) {
|
|
3825
|
-
|
|
3825
|
+
parsed3.error = "URI authority must not contain a literal backslash.";
|
|
3826
3826
|
malformedAuthorityOrPort = true;
|
|
3827
3827
|
}
|
|
3828
3828
|
const introducerMatch = uri.match(AUTHORITY_INTRODUCER_REGION);
|
|
@@ -3831,90 +3831,90 @@ var require_fast_uri = __commonJS({
|
|
|
3831
3831
|
const normalizedRegion = region.replace(/[\t\n\r]/g, "");
|
|
3832
3832
|
if (normalizedRegion.length >= 2) {
|
|
3833
3833
|
if (normalizedRegion.slice(0, 2) !== "//") {
|
|
3834
|
-
|
|
3834
|
+
parsed3.error = parsed3.error || "URI authority must not contain a literal backslash.";
|
|
3835
3835
|
malformedAuthorityOrPort = true;
|
|
3836
3836
|
} else if (region.length !== normalizedRegion.length) {
|
|
3837
|
-
|
|
3837
|
+
parsed3.error = parsed3.error || "URI authority introducer must not contain whitespace.";
|
|
3838
3838
|
malformedAuthorityOrPort = true;
|
|
3839
3839
|
}
|
|
3840
3840
|
}
|
|
3841
3841
|
}
|
|
3842
3842
|
const matches = uri.match(URI_PARSE);
|
|
3843
3843
|
if (matches) {
|
|
3844
|
-
|
|
3845
|
-
|
|
3846
|
-
|
|
3847
|
-
|
|
3848
|
-
|
|
3849
|
-
|
|
3850
|
-
|
|
3851
|
-
if (isNaN(
|
|
3852
|
-
|
|
3853
|
-
}
|
|
3854
|
-
const parseError = getParseError(
|
|
3844
|
+
parsed3.scheme = matches[1];
|
|
3845
|
+
parsed3.userinfo = matches[3];
|
|
3846
|
+
parsed3.host = matches[4];
|
|
3847
|
+
parsed3.port = parseInt(matches[5], 10);
|
|
3848
|
+
parsed3.path = matches[6] || "";
|
|
3849
|
+
parsed3.query = matches[7];
|
|
3850
|
+
parsed3.fragment = matches[8];
|
|
3851
|
+
if (isNaN(parsed3.port)) {
|
|
3852
|
+
parsed3.port = matches[5];
|
|
3853
|
+
}
|
|
3854
|
+
const parseError = getParseError(parsed3, matches);
|
|
3855
3855
|
if (parseError !== void 0) {
|
|
3856
|
-
|
|
3856
|
+
parsed3.error = parsed3.error || parseError;
|
|
3857
3857
|
malformedAuthorityOrPort = true;
|
|
3858
3858
|
}
|
|
3859
|
-
if (
|
|
3860
|
-
const ipv4result = isIPv4(
|
|
3859
|
+
if (parsed3.host) {
|
|
3860
|
+
const ipv4result = isIPv4(parsed3.host);
|
|
3861
3861
|
if (ipv4result === false) {
|
|
3862
|
-
const ipv6result = normalizeIPv6(
|
|
3863
|
-
|
|
3862
|
+
const ipv6result = normalizeIPv6(parsed3.host);
|
|
3863
|
+
parsed3.host = ipv6result.host.toLowerCase();
|
|
3864
3864
|
isIP2 = ipv6result.isIPV6;
|
|
3865
3865
|
} else {
|
|
3866
3866
|
isIP2 = true;
|
|
3867
3867
|
}
|
|
3868
3868
|
}
|
|
3869
|
-
if (
|
|
3870
|
-
|
|
3871
|
-
} else if (
|
|
3872
|
-
|
|
3873
|
-
} else if (
|
|
3874
|
-
|
|
3869
|
+
if (parsed3.scheme === void 0 && parsed3.userinfo === void 0 && parsed3.host === void 0 && parsed3.port === void 0 && parsed3.query === void 0 && !parsed3.path) {
|
|
3870
|
+
parsed3.reference = "same-document";
|
|
3871
|
+
} else if (parsed3.scheme === void 0) {
|
|
3872
|
+
parsed3.reference = "relative";
|
|
3873
|
+
} else if (parsed3.fragment === void 0) {
|
|
3874
|
+
parsed3.reference = "absolute";
|
|
3875
3875
|
} else {
|
|
3876
|
-
|
|
3876
|
+
parsed3.reference = "uri";
|
|
3877
3877
|
}
|
|
3878
|
-
if (options.reference && options.reference !== "suffix" && options.reference !==
|
|
3879
|
-
|
|
3878
|
+
if (options.reference && options.reference !== "suffix" && options.reference !== parsed3.reference) {
|
|
3879
|
+
parsed3.error = parsed3.error || "URI is not a " + options.reference + " reference.";
|
|
3880
3880
|
}
|
|
3881
|
-
const schemeHandler = getSchemeHandler(options.scheme ||
|
|
3881
|
+
const schemeHandler = getSchemeHandler(options.scheme || parsed3.scheme);
|
|
3882
3882
|
if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport)) {
|
|
3883
|
-
if (
|
|
3883
|
+
if (parsed3.host && (options.domainHost || schemeHandler && schemeHandler.domainHost) && isIP2 === false && nonSimpleDomain(parsed3.host)) {
|
|
3884
3884
|
try {
|
|
3885
|
-
|
|
3885
|
+
parsed3.host = new URL("http://" + parsed3.host).hostname;
|
|
3886
3886
|
} catch (e) {
|
|
3887
|
-
|
|
3887
|
+
parsed3.error = parsed3.error || "Host's domain name can not be converted to ASCII: " + e;
|
|
3888
3888
|
}
|
|
3889
3889
|
}
|
|
3890
3890
|
}
|
|
3891
3891
|
if (!schemeHandler || schemeHandler && !schemeHandler.skipNormalize) {
|
|
3892
3892
|
if (uri.indexOf("%") !== -1) {
|
|
3893
|
-
if (
|
|
3894
|
-
|
|
3893
|
+
if (parsed3.scheme !== void 0) {
|
|
3894
|
+
parsed3.scheme = unescape(parsed3.scheme);
|
|
3895
3895
|
}
|
|
3896
|
-
if (
|
|
3897
|
-
|
|
3896
|
+
if (parsed3.host !== void 0) {
|
|
3897
|
+
parsed3.host = reescapeHostDelimiters(unescape(parsed3.host), isIP2);
|
|
3898
3898
|
}
|
|
3899
3899
|
}
|
|
3900
|
-
if (
|
|
3901
|
-
|
|
3900
|
+
if (parsed3.path) {
|
|
3901
|
+
parsed3.path = normalizePathEncoding(parsed3.path);
|
|
3902
3902
|
}
|
|
3903
|
-
if (
|
|
3903
|
+
if (parsed3.fragment) {
|
|
3904
3904
|
try {
|
|
3905
|
-
|
|
3905
|
+
parsed3.fragment = encodeURI(decodeURIComponent(parsed3.fragment));
|
|
3906
3906
|
} catch {
|
|
3907
|
-
|
|
3907
|
+
parsed3.error = parsed3.error || "URI malformed";
|
|
3908
3908
|
}
|
|
3909
3909
|
}
|
|
3910
3910
|
}
|
|
3911
3911
|
if (schemeHandler && schemeHandler.parse) {
|
|
3912
|
-
schemeHandler.parse(
|
|
3912
|
+
schemeHandler.parse(parsed3, options);
|
|
3913
3913
|
}
|
|
3914
3914
|
} else {
|
|
3915
|
-
|
|
3915
|
+
parsed3.error = parsed3.error || "URI can not be parsed.";
|
|
3916
3916
|
}
|
|
3917
|
-
return { parsed:
|
|
3917
|
+
return { parsed: parsed3, malformedAuthorityOrPort };
|
|
3918
3918
|
}
|
|
3919
3919
|
function parse4(uri, opts) {
|
|
3920
3920
|
return parseWithStatus(uri, opts).parsed;
|
|
@@ -3923,9 +3923,9 @@ var require_fast_uri = __commonJS({
|
|
|
3923
3923
|
return normalizeStringWithStatus(uri, opts).normalized;
|
|
3924
3924
|
}
|
|
3925
3925
|
function normalizeStringWithStatus(uri, opts) {
|
|
3926
|
-
const { parsed:
|
|
3926
|
+
const { parsed: parsed3, malformedAuthorityOrPort } = parseWithStatus(uri, opts);
|
|
3927
3927
|
return {
|
|
3928
|
-
normalized: malformedAuthorityOrPort ? uri : serialize(
|
|
3928
|
+
normalized: malformedAuthorityOrPort ? uri : serialize(parsed3, opts),
|
|
3929
3929
|
malformedAuthorityOrPort
|
|
3930
3930
|
};
|
|
3931
3931
|
}
|
|
@@ -4133,16 +4133,16 @@ var require_core = __commonJS({
|
|
|
4133
4133
|
this.errors = v.errors;
|
|
4134
4134
|
return valid;
|
|
4135
4135
|
}
|
|
4136
|
-
compile(
|
|
4137
|
-
const sch = this._addSchema(
|
|
4136
|
+
compile(schema6, _meta) {
|
|
4137
|
+
const sch = this._addSchema(schema6, _meta);
|
|
4138
4138
|
return sch.validate || this._compileSchemaEnv(sch);
|
|
4139
4139
|
}
|
|
4140
|
-
compileAsync(
|
|
4140
|
+
compileAsync(schema6, meta3) {
|
|
4141
4141
|
if (typeof this.opts.loadSchema != "function") {
|
|
4142
4142
|
throw new Error("options.loadSchema should be a function");
|
|
4143
4143
|
}
|
|
4144
4144
|
const { loadSchema } = this.opts;
|
|
4145
|
-
return runCompileAsync.call(this,
|
|
4145
|
+
return runCompileAsync.call(this, schema6, meta3);
|
|
4146
4146
|
async function runCompileAsync(_schema, _meta) {
|
|
4147
4147
|
await loadMetaSchema.call(this, _schema.$schema);
|
|
4148
4148
|
const sch = this._addSchema(_schema, _meta);
|
|
@@ -4188,37 +4188,37 @@ var require_core = __commonJS({
|
|
|
4188
4188
|
}
|
|
4189
4189
|
}
|
|
4190
4190
|
// Adds schema to the instance
|
|
4191
|
-
addSchema(
|
|
4192
|
-
if (Array.isArray(
|
|
4193
|
-
for (const sch of
|
|
4191
|
+
addSchema(schema6, key, _meta, _validateSchema = this.opts.validateSchema) {
|
|
4192
|
+
if (Array.isArray(schema6)) {
|
|
4193
|
+
for (const sch of schema6)
|
|
4194
4194
|
this.addSchema(sch, void 0, _meta, _validateSchema);
|
|
4195
4195
|
return this;
|
|
4196
4196
|
}
|
|
4197
4197
|
let id;
|
|
4198
|
-
if (typeof
|
|
4198
|
+
if (typeof schema6 === "object") {
|
|
4199
4199
|
const { schemaId } = this.opts;
|
|
4200
|
-
id =
|
|
4200
|
+
id = schema6[schemaId];
|
|
4201
4201
|
if (id !== void 0 && typeof id != "string") {
|
|
4202
4202
|
throw new Error(`schema ${schemaId} must be string`);
|
|
4203
4203
|
}
|
|
4204
4204
|
}
|
|
4205
4205
|
key = (0, resolve_1.normalizeId)(key || id);
|
|
4206
4206
|
this._checkUnique(key);
|
|
4207
|
-
this.schemas[key] = this._addSchema(
|
|
4207
|
+
this.schemas[key] = this._addSchema(schema6, _meta, key, _validateSchema, true);
|
|
4208
4208
|
return this;
|
|
4209
4209
|
}
|
|
4210
4210
|
// Add schema that will be used to validate other schemas
|
|
4211
4211
|
// options in META_IGNORE_OPTIONS are alway set to false
|
|
4212
|
-
addMetaSchema(
|
|
4213
|
-
this.addSchema(
|
|
4212
|
+
addMetaSchema(schema6, key, _validateSchema = this.opts.validateSchema) {
|
|
4213
|
+
this.addSchema(schema6, key, true, _validateSchema);
|
|
4214
4214
|
return this;
|
|
4215
4215
|
}
|
|
4216
4216
|
// Validate schema against its meta-schema
|
|
4217
|
-
validateSchema(
|
|
4218
|
-
if (typeof
|
|
4217
|
+
validateSchema(schema6, throwOrLogError) {
|
|
4218
|
+
if (typeof schema6 == "boolean")
|
|
4219
4219
|
return true;
|
|
4220
4220
|
let $schema;
|
|
4221
|
-
$schema =
|
|
4221
|
+
$schema = schema6.$schema;
|
|
4222
4222
|
if ($schema !== void 0 && typeof $schema != "string") {
|
|
4223
4223
|
throw new Error("$schema must be a string");
|
|
4224
4224
|
}
|
|
@@ -4228,7 +4228,7 @@ var require_core = __commonJS({
|
|
|
4228
4228
|
this.errors = null;
|
|
4229
4229
|
return true;
|
|
4230
4230
|
}
|
|
4231
|
-
const valid = this.validate($schema,
|
|
4231
|
+
const valid = this.validate($schema, schema6);
|
|
4232
4232
|
if (!valid && throwOrLogError) {
|
|
4233
4233
|
const message = "schema is invalid: " + this.errorsText();
|
|
4234
4234
|
if (this.opts.validateSchema === "log")
|
|
@@ -4371,9 +4371,9 @@ var require_core = __commonJS({
|
|
|
4371
4371
|
if (typeof rule != "object")
|
|
4372
4372
|
continue;
|
|
4373
4373
|
const { $data } = rule.definition;
|
|
4374
|
-
const
|
|
4375
|
-
if ($data &&
|
|
4376
|
-
keywords[key] = schemaOrData(
|
|
4374
|
+
const schema6 = keywords[key];
|
|
4375
|
+
if ($data && schema6)
|
|
4376
|
+
keywords[key] = schemaOrData(schema6);
|
|
4377
4377
|
}
|
|
4378
4378
|
}
|
|
4379
4379
|
return metaSchema;
|
|
@@ -4391,23 +4391,23 @@ var require_core = __commonJS({
|
|
|
4391
4391
|
}
|
|
4392
4392
|
}
|
|
4393
4393
|
}
|
|
4394
|
-
_addSchema(
|
|
4394
|
+
_addSchema(schema6, meta3, baseId, validateSchema = this.opts.validateSchema, addSchema = this.opts.addUsedSchema) {
|
|
4395
4395
|
let id;
|
|
4396
4396
|
const { schemaId } = this.opts;
|
|
4397
|
-
if (typeof
|
|
4398
|
-
id =
|
|
4397
|
+
if (typeof schema6 == "object") {
|
|
4398
|
+
id = schema6[schemaId];
|
|
4399
4399
|
} else {
|
|
4400
4400
|
if (this.opts.jtd)
|
|
4401
4401
|
throw new Error("schema must be object");
|
|
4402
|
-
else if (typeof
|
|
4402
|
+
else if (typeof schema6 != "boolean")
|
|
4403
4403
|
throw new Error("schema must be object or boolean");
|
|
4404
4404
|
}
|
|
4405
|
-
let sch = this._cache.get(
|
|
4405
|
+
let sch = this._cache.get(schema6);
|
|
4406
4406
|
if (sch !== void 0)
|
|
4407
4407
|
return sch;
|
|
4408
4408
|
baseId = (0, resolve_1.normalizeId)(id || baseId);
|
|
4409
|
-
const localRefs = resolve_1.getSchemaRefs.call(this,
|
|
4410
|
-
sch = new compile_1.SchemaEnv({ schema:
|
|
4409
|
+
const localRefs = resolve_1.getSchemaRefs.call(this, schema6, baseId);
|
|
4410
|
+
sch = new compile_1.SchemaEnv({ schema: schema6, schemaId, meta: meta3, baseId, localRefs });
|
|
4411
4411
|
this._cache.set(sch.schema, sch);
|
|
4412
4412
|
if (addSchema && !baseId.startsWith("#")) {
|
|
4413
4413
|
if (baseId)
|
|
@@ -4415,7 +4415,7 @@ var require_core = __commonJS({
|
|
|
4415
4415
|
this.refs[baseId] = sch;
|
|
4416
4416
|
}
|
|
4417
4417
|
if (validateSchema)
|
|
4418
|
-
this.validateSchema(
|
|
4418
|
+
this.validateSchema(schema6, true);
|
|
4419
4419
|
return sch;
|
|
4420
4420
|
}
|
|
4421
4421
|
_checkUnique(id) {
|
|
@@ -4569,8 +4569,8 @@ var require_core = __commonJS({
|
|
|
4569
4569
|
var $dataRef = {
|
|
4570
4570
|
$ref: "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"
|
|
4571
4571
|
};
|
|
4572
|
-
function schemaOrData(
|
|
4573
|
-
return { anyOf: [
|
|
4572
|
+
function schemaOrData(schema6) {
|
|
4573
|
+
return { anyOf: [schema6, $dataRef] };
|
|
4574
4574
|
}
|
|
4575
4575
|
}
|
|
4576
4576
|
});
|
|
@@ -4870,7 +4870,7 @@ var require_pattern = __commonJS({
|
|
|
4870
4870
|
$data: true,
|
|
4871
4871
|
error: error51,
|
|
4872
4872
|
code(cxt) {
|
|
4873
|
-
const { gen: gen2, data, $data, schema:
|
|
4873
|
+
const { gen: gen2, data, $data, schema: schema6, schemaCode, it } = cxt;
|
|
4874
4874
|
const u = it.opts.unicodeRegExp ? "u" : "";
|
|
4875
4875
|
if ($data) {
|
|
4876
4876
|
const { regExp } = it.opts.code;
|
|
@@ -4879,7 +4879,7 @@ var require_pattern = __commonJS({
|
|
|
4879
4879
|
gen2.try(() => gen2.assign(valid, (0, codegen_1._)`${regExpCode}(${schemaCode}, ${u}).test(${data})`), () => gen2.assign(valid, false));
|
|
4880
4880
|
cxt.fail$data((0, codegen_1._)`!${valid}`);
|
|
4881
4881
|
} else {
|
|
4882
|
-
const regExp = (0, code_1.usePattern)(cxt,
|
|
4882
|
+
const regExp = (0, code_1.usePattern)(cxt, schema6);
|
|
4883
4883
|
cxt.fail$data((0, codegen_1._)`!${regExp}.test(${data})`);
|
|
4884
4884
|
}
|
|
4885
4885
|
}
|
|
@@ -4936,11 +4936,11 @@ var require_required = __commonJS({
|
|
|
4936
4936
|
$data: true,
|
|
4937
4937
|
error: error51,
|
|
4938
4938
|
code(cxt) {
|
|
4939
|
-
const { gen: gen2, schema:
|
|
4939
|
+
const { gen: gen2, schema: schema6, schemaCode, data, $data, it } = cxt;
|
|
4940
4940
|
const { opts } = it;
|
|
4941
|
-
if (!$data &&
|
|
4941
|
+
if (!$data && schema6.length === 0)
|
|
4942
4942
|
return;
|
|
4943
|
-
const useLoop =
|
|
4943
|
+
const useLoop = schema6.length >= opts.loopRequired;
|
|
4944
4944
|
if (it.allErrors)
|
|
4945
4945
|
allErrorsMode();
|
|
4946
4946
|
else
|
|
@@ -4948,7 +4948,7 @@ var require_required = __commonJS({
|
|
|
4948
4948
|
if (opts.strictRequired) {
|
|
4949
4949
|
const props = cxt.parentSchema.properties;
|
|
4950
4950
|
const { definedProperties } = cxt.it;
|
|
4951
|
-
for (const requiredKey of
|
|
4951
|
+
for (const requiredKey of schema6) {
|
|
4952
4952
|
if ((props === null || props === void 0 ? void 0 : props[requiredKey]) === void 0 && !definedProperties.has(requiredKey)) {
|
|
4953
4953
|
const schemaPath = it.schemaEnv.baseId + it.errSchemaPath;
|
|
4954
4954
|
const msg = `required property "${requiredKey}" is not defined at "${schemaPath}" (strictRequired)`;
|
|
@@ -4960,7 +4960,7 @@ var require_required = __commonJS({
|
|
|
4960
4960
|
if (useLoop || $data) {
|
|
4961
4961
|
cxt.block$data(codegen_1.nil, loopAllRequired);
|
|
4962
4962
|
} else {
|
|
4963
|
-
for (const prop of
|
|
4963
|
+
for (const prop of schema6) {
|
|
4964
4964
|
(0, code_1.checkReportMissingProp)(cxt, prop);
|
|
4965
4965
|
}
|
|
4966
4966
|
}
|
|
@@ -4972,7 +4972,7 @@ var require_required = __commonJS({
|
|
|
4972
4972
|
cxt.block$data(valid, () => loopUntilMissing(missing, valid));
|
|
4973
4973
|
cxt.ok(valid);
|
|
4974
4974
|
} else {
|
|
4975
|
-
gen2.if((0, code_1.checkMissingProp)(cxt,
|
|
4975
|
+
gen2.if((0, code_1.checkMissingProp)(cxt, schema6, missing));
|
|
4976
4976
|
(0, code_1.reportMissingProp)(cxt, missing);
|
|
4977
4977
|
gen2.else();
|
|
4978
4978
|
}
|
|
@@ -5059,8 +5059,8 @@ var require_uniqueItems = __commonJS({
|
|
|
5059
5059
|
$data: true,
|
|
5060
5060
|
error: error51,
|
|
5061
5061
|
code(cxt) {
|
|
5062
|
-
const { gen: gen2, data, $data, schema:
|
|
5063
|
-
if (!$data && !
|
|
5062
|
+
const { gen: gen2, data, $data, schema: schema6, parentSchema, schemaCode, it } = cxt;
|
|
5063
|
+
if (!$data && !schema6)
|
|
5064
5064
|
return;
|
|
5065
5065
|
const valid = gen2.let("valid");
|
|
5066
5066
|
const itemTypes = parentSchema.items ? (0, dataType_1.getSchemaTypes)(parentSchema.items) : [];
|
|
@@ -5123,11 +5123,11 @@ var require_const = __commonJS({
|
|
|
5123
5123
|
$data: true,
|
|
5124
5124
|
error: error51,
|
|
5125
5125
|
code(cxt) {
|
|
5126
|
-
const { gen: gen2, data, $data, schemaCode, schema:
|
|
5127
|
-
if ($data ||
|
|
5126
|
+
const { gen: gen2, data, $data, schemaCode, schema: schema6 } = cxt;
|
|
5127
|
+
if ($data || schema6 && typeof schema6 == "object") {
|
|
5128
5128
|
cxt.fail$data((0, codegen_1._)`!${(0, util_1.useFunc)(gen2, equal_1.default)}(${data}, ${schemaCode})`);
|
|
5129
5129
|
} else {
|
|
5130
|
-
cxt.fail((0, codegen_1._)`${
|
|
5130
|
+
cxt.fail((0, codegen_1._)`${schema6} !== ${data}`);
|
|
5131
5131
|
}
|
|
5132
5132
|
}
|
|
5133
5133
|
};
|
|
@@ -5153,10 +5153,10 @@ var require_enum = __commonJS({
|
|
|
5153
5153
|
$data: true,
|
|
5154
5154
|
error: error51,
|
|
5155
5155
|
code(cxt) {
|
|
5156
|
-
const { gen: gen2, data, $data, schema:
|
|
5157
|
-
if (!$data &&
|
|
5156
|
+
const { gen: gen2, data, $data, schema: schema6, schemaCode, it } = cxt;
|
|
5157
|
+
if (!$data && schema6.length === 0)
|
|
5158
5158
|
throw new Error("enum must have non-empty array");
|
|
5159
|
-
const useLoop =
|
|
5159
|
+
const useLoop = schema6.length >= it.opts.loopEnum;
|
|
5160
5160
|
let eql;
|
|
5161
5161
|
const getEql = () => eql !== null && eql !== void 0 ? eql : eql = (0, util_1.useFunc)(gen2, equal_1.default);
|
|
5162
5162
|
let valid;
|
|
@@ -5164,10 +5164,10 @@ var require_enum = __commonJS({
|
|
|
5164
5164
|
valid = gen2.let("valid");
|
|
5165
5165
|
cxt.block$data(valid, loopEnum);
|
|
5166
5166
|
} else {
|
|
5167
|
-
if (!Array.isArray(
|
|
5167
|
+
if (!Array.isArray(schema6))
|
|
5168
5168
|
throw new Error("ajv implementation error");
|
|
5169
5169
|
const vSchema = gen2.const("vSchema", schemaCode);
|
|
5170
|
-
valid = (0, codegen_1.or)(...
|
|
5170
|
+
valid = (0, codegen_1.or)(...schema6.map((_x, i2) => equalCode(vSchema, i2)));
|
|
5171
5171
|
}
|
|
5172
5172
|
cxt.pass(valid);
|
|
5173
5173
|
function loopEnum() {
|
|
@@ -5175,7 +5175,7 @@ var require_enum = __commonJS({
|
|
|
5175
5175
|
gen2.forOf("v", schemaCode, (v) => gen2.if((0, codegen_1._)`${getEql()}(${data}, ${v})`, () => gen2.assign(valid, true).break()));
|
|
5176
5176
|
}
|
|
5177
5177
|
function equalCode(vSchema, i2) {
|
|
5178
|
-
const sch =
|
|
5178
|
+
const sch = schema6[i2];
|
|
5179
5179
|
return typeof sch === "object" && sch !== null ? (0, codegen_1._)`${getEql()}(${data}, ${vSchema}[${i2}])` : (0, codegen_1._)`${data} === ${sch}`;
|
|
5180
5180
|
}
|
|
5181
5181
|
}
|
|
@@ -5251,13 +5251,13 @@ var require_additionalItems = __commonJS({
|
|
|
5251
5251
|
}
|
|
5252
5252
|
};
|
|
5253
5253
|
function validateAdditionalItems(cxt, items) {
|
|
5254
|
-
const { gen: gen2, schema:
|
|
5254
|
+
const { gen: gen2, schema: schema6, data, keyword, it } = cxt;
|
|
5255
5255
|
it.items = true;
|
|
5256
5256
|
const len = gen2.const("len", (0, codegen_1._)`${data}.length`);
|
|
5257
|
-
if (
|
|
5257
|
+
if (schema6 === false) {
|
|
5258
5258
|
cxt.setParams({ len: items.length });
|
|
5259
5259
|
cxt.pass((0, codegen_1._)`${len} <= ${items.length}`);
|
|
5260
|
-
} else if (typeof
|
|
5260
|
+
} else if (typeof schema6 == "object" && !(0, util_1.alwaysValidSchema)(it, schema6)) {
|
|
5261
5261
|
const valid = gen2.var("valid", (0, codegen_1._)`${len} <= ${items.length}`);
|
|
5262
5262
|
gen2.if((0, codegen_1.not)(valid), () => validateItems(valid));
|
|
5263
5263
|
cxt.ok(valid);
|
|
@@ -5290,11 +5290,11 @@ var require_items = __commonJS({
|
|
|
5290
5290
|
schemaType: ["object", "array", "boolean"],
|
|
5291
5291
|
before: "uniqueItems",
|
|
5292
5292
|
code(cxt) {
|
|
5293
|
-
const { schema:
|
|
5294
|
-
if (Array.isArray(
|
|
5295
|
-
return validateTuple(cxt, "additionalItems",
|
|
5293
|
+
const { schema: schema6, it } = cxt;
|
|
5294
|
+
if (Array.isArray(schema6))
|
|
5295
|
+
return validateTuple(cxt, "additionalItems", schema6);
|
|
5296
5296
|
it.items = true;
|
|
5297
|
-
if ((0, util_1.alwaysValidSchema)(it,
|
|
5297
|
+
if ((0, util_1.alwaysValidSchema)(it, schema6))
|
|
5298
5298
|
return;
|
|
5299
5299
|
cxt.ok((0, code_1.validateArray)(cxt));
|
|
5300
5300
|
}
|
|
@@ -5369,10 +5369,10 @@ var require_items2020 = __commonJS({
|
|
|
5369
5369
|
before: "uniqueItems",
|
|
5370
5370
|
error: error51,
|
|
5371
5371
|
code(cxt) {
|
|
5372
|
-
const { schema:
|
|
5372
|
+
const { schema: schema6, parentSchema, it } = cxt;
|
|
5373
5373
|
const { prefixItems } = parentSchema;
|
|
5374
5374
|
it.items = true;
|
|
5375
|
-
if ((0, util_1.alwaysValidSchema)(it,
|
|
5375
|
+
if ((0, util_1.alwaysValidSchema)(it, schema6))
|
|
5376
5376
|
return;
|
|
5377
5377
|
if (prefixItems)
|
|
5378
5378
|
(0, additionalItems_1.validateAdditionalItems)(cxt, prefixItems);
|
|
@@ -5403,7 +5403,7 @@ var require_contains = __commonJS({
|
|
|
5403
5403
|
trackErrors: true,
|
|
5404
5404
|
error: error51,
|
|
5405
5405
|
code(cxt) {
|
|
5406
|
-
const { gen: gen2, schema:
|
|
5406
|
+
const { gen: gen2, schema: schema6, parentSchema, data, it } = cxt;
|
|
5407
5407
|
let min;
|
|
5408
5408
|
let max2;
|
|
5409
5409
|
const { minContains, maxContains } = parentSchema;
|
|
@@ -5424,7 +5424,7 @@ var require_contains = __commonJS({
|
|
|
5424
5424
|
cxt.fail();
|
|
5425
5425
|
return;
|
|
5426
5426
|
}
|
|
5427
|
-
if ((0, util_1.alwaysValidSchema)(it,
|
|
5427
|
+
if ((0, util_1.alwaysValidSchema)(it, schema6)) {
|
|
5428
5428
|
let cond = (0, codegen_1._)`${len} >= ${min}`;
|
|
5429
5429
|
if (max2 !== void 0)
|
|
5430
5430
|
cond = (0, codegen_1._)`${cond} && ${len} <= ${max2}`;
|
|
@@ -5509,14 +5509,14 @@ var require_dependencies = __commonJS({
|
|
|
5509
5509
|
validateSchemaDeps(cxt, schDeps);
|
|
5510
5510
|
}
|
|
5511
5511
|
};
|
|
5512
|
-
function splitDependencies({ schema:
|
|
5512
|
+
function splitDependencies({ schema: schema6 }) {
|
|
5513
5513
|
const propertyDeps = {};
|
|
5514
5514
|
const schemaDeps = {};
|
|
5515
|
-
for (const key in
|
|
5515
|
+
for (const key in schema6) {
|
|
5516
5516
|
if (key === "__proto__")
|
|
5517
5517
|
continue;
|
|
5518
|
-
const deps = Array.isArray(
|
|
5519
|
-
deps[key] =
|
|
5518
|
+
const deps = Array.isArray(schema6[key]) ? propertyDeps : schemaDeps;
|
|
5519
|
+
deps[key] = schema6[key];
|
|
5520
5520
|
}
|
|
5521
5521
|
return [propertyDeps, schemaDeps];
|
|
5522
5522
|
}
|
|
@@ -5589,8 +5589,8 @@ var require_propertyNames = __commonJS({
|
|
|
5589
5589
|
schemaType: ["object", "boolean"],
|
|
5590
5590
|
error: error51,
|
|
5591
5591
|
code(cxt) {
|
|
5592
|
-
const { gen: gen2, schema:
|
|
5593
|
-
if ((0, util_1.alwaysValidSchema)(it,
|
|
5592
|
+
const { gen: gen2, schema: schema6, data, it } = cxt;
|
|
5593
|
+
if ((0, util_1.alwaysValidSchema)(it, schema6))
|
|
5594
5594
|
return;
|
|
5595
5595
|
const valid = gen2.name("valid");
|
|
5596
5596
|
gen2.forIn("key", data, (key) => {
|
|
@@ -5636,12 +5636,12 @@ var require_additionalProperties = __commonJS({
|
|
|
5636
5636
|
trackErrors: true,
|
|
5637
5637
|
error: error51,
|
|
5638
5638
|
code(cxt) {
|
|
5639
|
-
const { gen: gen2, schema:
|
|
5639
|
+
const { gen: gen2, schema: schema6, parentSchema, data, errsCount, it } = cxt;
|
|
5640
5640
|
if (!errsCount)
|
|
5641
5641
|
throw new Error("ajv implementation error");
|
|
5642
5642
|
const { allErrors, opts } = it;
|
|
5643
5643
|
it.props = true;
|
|
5644
|
-
if (opts.removeAdditional !== "all" && (0, util_1.alwaysValidSchema)(it,
|
|
5644
|
+
if (opts.removeAdditional !== "all" && (0, util_1.alwaysValidSchema)(it, schema6))
|
|
5645
5645
|
return;
|
|
5646
5646
|
const props = (0, code_1.allSchemaProperties)(parentSchema.properties);
|
|
5647
5647
|
const patProps = (0, code_1.allSchemaProperties)(parentSchema.patternProperties);
|
|
@@ -5674,18 +5674,18 @@ var require_additionalProperties = __commonJS({
|
|
|
5674
5674
|
gen2.code((0, codegen_1._)`delete ${data}[${key}]`);
|
|
5675
5675
|
}
|
|
5676
5676
|
function additionalPropertyCode(key) {
|
|
5677
|
-
if (opts.removeAdditional === "all" || opts.removeAdditional &&
|
|
5677
|
+
if (opts.removeAdditional === "all" || opts.removeAdditional && schema6 === false) {
|
|
5678
5678
|
deleteAdditional(key);
|
|
5679
5679
|
return;
|
|
5680
5680
|
}
|
|
5681
|
-
if (
|
|
5681
|
+
if (schema6 === false) {
|
|
5682
5682
|
cxt.setParams({ additionalProperty: key });
|
|
5683
5683
|
cxt.error();
|
|
5684
5684
|
if (!allErrors)
|
|
5685
5685
|
gen2.break();
|
|
5686
5686
|
return;
|
|
5687
5687
|
}
|
|
5688
|
-
if (typeof
|
|
5688
|
+
if (typeof schema6 == "object" && !(0, util_1.alwaysValidSchema)(it, schema6)) {
|
|
5689
5689
|
const valid = gen2.name("valid");
|
|
5690
5690
|
if (opts.removeAdditional === "failing") {
|
|
5691
5691
|
applyAdditionalSchema(key, valid, false);
|
|
@@ -5735,18 +5735,18 @@ var require_properties = __commonJS({
|
|
|
5735
5735
|
type: "object",
|
|
5736
5736
|
schemaType: "object",
|
|
5737
5737
|
code(cxt) {
|
|
5738
|
-
const { gen: gen2, schema:
|
|
5738
|
+
const { gen: gen2, schema: schema6, parentSchema, data, it } = cxt;
|
|
5739
5739
|
if (it.opts.removeAdditional === "all" && parentSchema.additionalProperties === void 0) {
|
|
5740
5740
|
additionalProperties_1.default.code(new validate_1.KeywordCxt(it, additionalProperties_1.default, "additionalProperties"));
|
|
5741
5741
|
}
|
|
5742
|
-
const allProps = (0, code_1.allSchemaProperties)(
|
|
5742
|
+
const allProps = (0, code_1.allSchemaProperties)(schema6);
|
|
5743
5743
|
for (const prop of allProps) {
|
|
5744
5744
|
it.definedProperties.add(prop);
|
|
5745
5745
|
}
|
|
5746
5746
|
if (it.opts.unevaluated && allProps.length && it.props !== true) {
|
|
5747
5747
|
it.props = util_1.mergeEvaluated.props(gen2, (0, util_1.toHash)(allProps), it.props);
|
|
5748
5748
|
}
|
|
5749
|
-
const properties = allProps.filter((p) => !(0, util_1.alwaysValidSchema)(it,
|
|
5749
|
+
const properties = allProps.filter((p) => !(0, util_1.alwaysValidSchema)(it, schema6[p]));
|
|
5750
5750
|
if (properties.length === 0)
|
|
5751
5751
|
return;
|
|
5752
5752
|
const valid = gen2.name("valid");
|
|
@@ -5764,7 +5764,7 @@ var require_properties = __commonJS({
|
|
|
5764
5764
|
cxt.ok(valid);
|
|
5765
5765
|
}
|
|
5766
5766
|
function hasDefault(prop) {
|
|
5767
|
-
return it.opts.useDefaults && !it.compositeRule &&
|
|
5767
|
+
return it.opts.useDefaults && !it.compositeRule && schema6[prop].default !== void 0;
|
|
5768
5768
|
}
|
|
5769
5769
|
function applyPropertySchema(prop) {
|
|
5770
5770
|
cxt.subschema({
|
|
@@ -5793,10 +5793,10 @@ var require_patternProperties = __commonJS({
|
|
|
5793
5793
|
type: "object",
|
|
5794
5794
|
schemaType: "object",
|
|
5795
5795
|
code(cxt) {
|
|
5796
|
-
const { gen: gen2, schema:
|
|
5796
|
+
const { gen: gen2, schema: schema6, data, parentSchema, it } = cxt;
|
|
5797
5797
|
const { opts } = it;
|
|
5798
|
-
const patterns = (0, code_1.allSchemaProperties)(
|
|
5799
|
-
const alwaysValidPatterns = patterns.filter((p) => (0, util_1.alwaysValidSchema)(it,
|
|
5798
|
+
const patterns = (0, code_1.allSchemaProperties)(schema6);
|
|
5799
|
+
const alwaysValidPatterns = patterns.filter((p) => (0, util_1.alwaysValidSchema)(it, schema6[p]));
|
|
5800
5800
|
if (patterns.length === 0 || alwaysValidPatterns.length === patterns.length && (!it.opts.unevaluated || it.props === true)) {
|
|
5801
5801
|
return;
|
|
5802
5802
|
}
|
|
@@ -5864,8 +5864,8 @@ var require_not = __commonJS({
|
|
|
5864
5864
|
schemaType: ["object", "boolean"],
|
|
5865
5865
|
trackErrors: true,
|
|
5866
5866
|
code(cxt) {
|
|
5867
|
-
const { gen: gen2, schema:
|
|
5868
|
-
if ((0, util_1.alwaysValidSchema)(it,
|
|
5867
|
+
const { gen: gen2, schema: schema6, it } = cxt;
|
|
5868
|
+
if ((0, util_1.alwaysValidSchema)(it, schema6)) {
|
|
5869
5869
|
cxt.fail();
|
|
5870
5870
|
return;
|
|
5871
5871
|
}
|
|
@@ -5918,12 +5918,12 @@ var require_oneOf = __commonJS({
|
|
|
5918
5918
|
trackErrors: true,
|
|
5919
5919
|
error: error51,
|
|
5920
5920
|
code(cxt) {
|
|
5921
|
-
const { gen: gen2, schema:
|
|
5922
|
-
if (!Array.isArray(
|
|
5921
|
+
const { gen: gen2, schema: schema6, parentSchema, it } = cxt;
|
|
5922
|
+
if (!Array.isArray(schema6))
|
|
5923
5923
|
throw new Error("ajv implementation error");
|
|
5924
5924
|
if (it.opts.discriminator && parentSchema.discriminator)
|
|
5925
5925
|
return;
|
|
5926
|
-
const schArr =
|
|
5926
|
+
const schArr = schema6;
|
|
5927
5927
|
const valid = gen2.let("valid", false);
|
|
5928
5928
|
const passing = gen2.let("passing", null);
|
|
5929
5929
|
const schValid = gen2.name("_valid");
|
|
@@ -5969,11 +5969,11 @@ var require_allOf = __commonJS({
|
|
|
5969
5969
|
keyword: "allOf",
|
|
5970
5970
|
schemaType: "array",
|
|
5971
5971
|
code(cxt) {
|
|
5972
|
-
const { gen: gen2, schema:
|
|
5973
|
-
if (!Array.isArray(
|
|
5972
|
+
const { gen: gen2, schema: schema6, it } = cxt;
|
|
5973
|
+
if (!Array.isArray(schema6))
|
|
5974
5974
|
throw new Error("ajv implementation error");
|
|
5975
5975
|
const valid = gen2.name("valid");
|
|
5976
|
-
|
|
5976
|
+
schema6.forEach((sch, i2) => {
|
|
5977
5977
|
if ((0, util_1.alwaysValidSchema)(it, sch))
|
|
5978
5978
|
return;
|
|
5979
5979
|
const schCxt = cxt.subschema({ keyword: "allOf", schemaProp: i2 }, valid);
|
|
@@ -6048,8 +6048,8 @@ var require_if = __commonJS({
|
|
|
6048
6048
|
}
|
|
6049
6049
|
};
|
|
6050
6050
|
function hasSchema(it, keyword) {
|
|
6051
|
-
const
|
|
6052
|
-
return
|
|
6051
|
+
const schema6 = it.schema[keyword];
|
|
6052
|
+
return schema6 !== void 0 && !(0, util_1.alwaysValidSchema)(it, schema6);
|
|
6053
6053
|
}
|
|
6054
6054
|
exports.default = def;
|
|
6055
6055
|
}
|
|
@@ -6138,7 +6138,7 @@ var require_format = __commonJS({
|
|
|
6138
6138
|
$data: true,
|
|
6139
6139
|
error: error51,
|
|
6140
6140
|
code(cxt, ruleType) {
|
|
6141
|
-
const { gen: gen2, data, $data, schema:
|
|
6141
|
+
const { gen: gen2, data, $data, schema: schema6, schemaCode, it } = cxt;
|
|
6142
6142
|
const { opts, errSchemaPath, schemaEnv, self } = it;
|
|
6143
6143
|
if (!opts.validateFormats)
|
|
6144
6144
|
return;
|
|
@@ -6168,7 +6168,7 @@ var require_format = __commonJS({
|
|
|
6168
6168
|
}
|
|
6169
6169
|
}
|
|
6170
6170
|
function validateFormat() {
|
|
6171
|
-
const formatDef = self.formats[
|
|
6171
|
+
const formatDef = self.formats[schema6];
|
|
6172
6172
|
if (!formatDef) {
|
|
6173
6173
|
unknownFormat();
|
|
6174
6174
|
return;
|
|
@@ -6185,12 +6185,12 @@ var require_format = __commonJS({
|
|
|
6185
6185
|
}
|
|
6186
6186
|
throw new Error(unknownMsg());
|
|
6187
6187
|
function unknownMsg() {
|
|
6188
|
-
return `unknown format "${
|
|
6188
|
+
return `unknown format "${schema6}" ignored in schema at path "${errSchemaPath}"`;
|
|
6189
6189
|
}
|
|
6190
6190
|
}
|
|
6191
6191
|
function getFormat(fmtDef) {
|
|
6192
|
-
const code = fmtDef instanceof RegExp ? (0, codegen_1.regexpCode)(fmtDef) : opts.code.formats ? (0, codegen_1._)`${opts.code.formats}${(0, codegen_1.getProperty)(
|
|
6193
|
-
const fmt = gen2.scopeValue("formats", { key:
|
|
6192
|
+
const code = fmtDef instanceof RegExp ? (0, codegen_1.regexpCode)(fmtDef) : opts.code.formats ? (0, codegen_1._)`${opts.code.formats}${(0, codegen_1.getProperty)(schema6)}` : void 0;
|
|
6193
|
+
const fmt = gen2.scopeValue("formats", { key: schema6, ref: fmtDef, code });
|
|
6194
6194
|
if (typeof fmtDef == "object" && !(fmtDef instanceof RegExp)) {
|
|
6195
6195
|
return [fmtDef.type || "string", fmtDef.validate, (0, codegen_1._)`${fmt}.validate`];
|
|
6196
6196
|
}
|
|
@@ -6301,15 +6301,15 @@ var require_discriminator = __commonJS({
|
|
|
6301
6301
|
schemaType: "object",
|
|
6302
6302
|
error: error51,
|
|
6303
6303
|
code(cxt) {
|
|
6304
|
-
const { gen: gen2, data, schema:
|
|
6304
|
+
const { gen: gen2, data, schema: schema6, parentSchema, it } = cxt;
|
|
6305
6305
|
const { oneOf } = parentSchema;
|
|
6306
6306
|
if (!it.opts.discriminator) {
|
|
6307
6307
|
throw new Error("discriminator: requires discriminator option");
|
|
6308
6308
|
}
|
|
6309
|
-
const tagName =
|
|
6309
|
+
const tagName = schema6.propertyName;
|
|
6310
6310
|
if (typeof tagName != "string")
|
|
6311
6311
|
throw new Error("discriminator: requires propertyName");
|
|
6312
|
-
if (
|
|
6312
|
+
if (schema6.mapping)
|
|
6313
6313
|
throw new Error("discriminator: mapping is not supported");
|
|
6314
6314
|
if (!oneOf)
|
|
6315
6315
|
throw new Error("discriminator: requires oneOf keyword");
|
|
@@ -6619,7 +6619,7 @@ var init_package = __esm({
|
|
|
6619
6619
|
"package.json"() {
|
|
6620
6620
|
package_default = {
|
|
6621
6621
|
name: "@finchtech/cli",
|
|
6622
|
-
version: "0.5.
|
|
6622
|
+
version: "0.5.4",
|
|
6623
6623
|
description: "Finch Agent CLI for wallet custody, Session-owned execution, and MCP OAuth approval.",
|
|
6624
6624
|
type: "module",
|
|
6625
6625
|
bin: {
|
|
@@ -6718,7 +6718,7 @@ var init_cli_signing = __esm({
|
|
|
6718
6718
|
stageSchema = strictObjectSchema({
|
|
6719
6719
|
request: openObjectSchema,
|
|
6720
6720
|
intent: openObjectSchema,
|
|
6721
|
-
status: { type: "string", enum: ["awaiting_execution", "receipt_confirmed", "projected"] },
|
|
6721
|
+
status: { type: "string", enum: ["awaiting_execution", "chain_confirmed", "receipt_confirmed", "projected"] },
|
|
6722
6722
|
transactionHash: { anyOf: [transactionHashSchema, { type: "null" }] },
|
|
6723
6723
|
blockNumber: { type: ["string", "null"], pattern: "^[1-9][0-9]*$" }
|
|
6724
6724
|
});
|
|
@@ -6738,12 +6738,12 @@ var init_cli_signing = __esm({
|
|
|
6738
6738
|
owner: { type: "string", pattern: "^0x[0-9a-fA-F]{40}$" }
|
|
6739
6739
|
}, ["skillId"]) },
|
|
6740
6740
|
prepare: { method: "post", path: `${resource}/prepare`, requestSchema: openObjectSchema, responseSchema: stageSchema },
|
|
6741
|
-
confirm: { method: "post", path: `${resource}/confirm`, requestSchema: strictObjectSchema({
|
|
6741
|
+
confirm: { method: "post", path: `${resource}/confirm`, requestSchema: { oneOf: [strictObjectSchema({
|
|
6742
6742
|
stage: { type: "string", enum: ["primary", "uri", "lit"] },
|
|
6743
6743
|
transactionHash: transactionHashSchema
|
|
6744
|
-
}), responseSchema: strictObjectSchema({
|
|
6744
|
+
}), strictObjectSchema({ stage: { type: "string", enum: ["primary", "uri", "lit"] }, request: openObjectSchema })] }, responseSchema: strictObjectSchema({
|
|
6745
6745
|
status: { type: "string", enum: ["projected", "indexing_pending"] },
|
|
6746
|
-
transactionHash: transactionHashSchema,
|
|
6746
|
+
transactionHash: { anyOf: [transactionHashSchema, { type: "null" }] },
|
|
6747
6747
|
blockNumber: { type: "string", pattern: "^[1-9][0-9]*$" }
|
|
6748
6748
|
}) },
|
|
6749
6749
|
adopt: { method: "post", path: "/api/v1/agent-cli/signing-intents/skills/adopt", requestSchema: strictObjectSchema({ intent: openObjectSchema, transactionHash: transactionHashSchema }), responseSchema: skillCliIntentSchema }
|
|
@@ -6995,8 +6995,8 @@ function mergeDefs(...defs) {
|
|
|
6995
6995
|
}
|
|
6996
6996
|
return Object.defineProperties({}, mergedDescriptors);
|
|
6997
6997
|
}
|
|
6998
|
-
function cloneDef(
|
|
6999
|
-
return mergeDefs(
|
|
6998
|
+
function cloneDef(schema6) {
|
|
6999
|
+
return mergeDefs(schema6._zod.def);
|
|
7000
7000
|
}
|
|
7001
7001
|
function getElementAtPath(obj, path2) {
|
|
7002
7002
|
if (!path2)
|
|
@@ -7137,14 +7137,14 @@ function optionalKeys(shape) {
|
|
|
7137
7137
|
return shape[k]._zod.optin === "optional" && shape[k]._zod.optout === "optional";
|
|
7138
7138
|
});
|
|
7139
7139
|
}
|
|
7140
|
-
function pick(
|
|
7141
|
-
const currDef =
|
|
7140
|
+
function pick(schema6, mask) {
|
|
7141
|
+
const currDef = schema6._zod.def;
|
|
7142
7142
|
const checks = currDef.checks;
|
|
7143
7143
|
const hasChecks = checks && checks.length > 0;
|
|
7144
7144
|
if (hasChecks) {
|
|
7145
7145
|
throw new Error(".pick() cannot be used on object schemas containing refinements");
|
|
7146
7146
|
}
|
|
7147
|
-
const def = mergeDefs(
|
|
7147
|
+
const def = mergeDefs(schema6._zod.def, {
|
|
7148
7148
|
get shape() {
|
|
7149
7149
|
const newShape = {};
|
|
7150
7150
|
for (const key in mask) {
|
|
@@ -7160,18 +7160,18 @@ function pick(schema5, mask) {
|
|
|
7160
7160
|
},
|
|
7161
7161
|
checks: []
|
|
7162
7162
|
});
|
|
7163
|
-
return clone(
|
|
7163
|
+
return clone(schema6, def);
|
|
7164
7164
|
}
|
|
7165
|
-
function omit(
|
|
7166
|
-
const currDef =
|
|
7165
|
+
function omit(schema6, mask) {
|
|
7166
|
+
const currDef = schema6._zod.def;
|
|
7167
7167
|
const checks = currDef.checks;
|
|
7168
7168
|
const hasChecks = checks && checks.length > 0;
|
|
7169
7169
|
if (hasChecks) {
|
|
7170
7170
|
throw new Error(".omit() cannot be used on object schemas containing refinements");
|
|
7171
7171
|
}
|
|
7172
|
-
const def = mergeDefs(
|
|
7172
|
+
const def = mergeDefs(schema6._zod.def, {
|
|
7173
7173
|
get shape() {
|
|
7174
|
-
const newShape = { ...
|
|
7174
|
+
const newShape = { ...schema6._zod.def.shape };
|
|
7175
7175
|
for (const key in mask) {
|
|
7176
7176
|
if (!(key in currDef.shape)) {
|
|
7177
7177
|
throw new Error(`Unrecognized key: "${key}"`);
|
|
@@ -7185,43 +7185,43 @@ function omit(schema5, mask) {
|
|
|
7185
7185
|
},
|
|
7186
7186
|
checks: []
|
|
7187
7187
|
});
|
|
7188
|
-
return clone(
|
|
7188
|
+
return clone(schema6, def);
|
|
7189
7189
|
}
|
|
7190
|
-
function extend(
|
|
7190
|
+
function extend(schema6, shape) {
|
|
7191
7191
|
if (!isPlainObject(shape)) {
|
|
7192
7192
|
throw new Error("Invalid input to extend: expected a plain object");
|
|
7193
7193
|
}
|
|
7194
|
-
const checks =
|
|
7194
|
+
const checks = schema6._zod.def.checks;
|
|
7195
7195
|
const hasChecks = checks && checks.length > 0;
|
|
7196
7196
|
if (hasChecks) {
|
|
7197
|
-
const existingShape =
|
|
7197
|
+
const existingShape = schema6._zod.def.shape;
|
|
7198
7198
|
for (const key in shape) {
|
|
7199
7199
|
if (Object.getOwnPropertyDescriptor(existingShape, key) !== void 0) {
|
|
7200
7200
|
throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.");
|
|
7201
7201
|
}
|
|
7202
7202
|
}
|
|
7203
7203
|
}
|
|
7204
|
-
const def = mergeDefs(
|
|
7204
|
+
const def = mergeDefs(schema6._zod.def, {
|
|
7205
7205
|
get shape() {
|
|
7206
|
-
const _shape = { ...
|
|
7206
|
+
const _shape = { ...schema6._zod.def.shape, ...shape };
|
|
7207
7207
|
assignProp(this, "shape", _shape);
|
|
7208
7208
|
return _shape;
|
|
7209
7209
|
}
|
|
7210
7210
|
});
|
|
7211
|
-
return clone(
|
|
7211
|
+
return clone(schema6, def);
|
|
7212
7212
|
}
|
|
7213
|
-
function safeExtend(
|
|
7213
|
+
function safeExtend(schema6, shape) {
|
|
7214
7214
|
if (!isPlainObject(shape)) {
|
|
7215
7215
|
throw new Error("Invalid input to safeExtend: expected a plain object");
|
|
7216
7216
|
}
|
|
7217
|
-
const def = mergeDefs(
|
|
7217
|
+
const def = mergeDefs(schema6._zod.def, {
|
|
7218
7218
|
get shape() {
|
|
7219
|
-
const _shape = { ...
|
|
7219
|
+
const _shape = { ...schema6._zod.def.shape, ...shape };
|
|
7220
7220
|
assignProp(this, "shape", _shape);
|
|
7221
7221
|
return _shape;
|
|
7222
7222
|
}
|
|
7223
7223
|
});
|
|
7224
|
-
return clone(
|
|
7224
|
+
return clone(schema6, def);
|
|
7225
7225
|
}
|
|
7226
7226
|
function merge(a, b) {
|
|
7227
7227
|
if (a._zod.def.checks?.length) {
|
|
@@ -7240,16 +7240,16 @@ function merge(a, b) {
|
|
|
7240
7240
|
});
|
|
7241
7241
|
return clone(a, def);
|
|
7242
7242
|
}
|
|
7243
|
-
function partial(Class2,
|
|
7244
|
-
const currDef =
|
|
7243
|
+
function partial(Class2, schema6, mask) {
|
|
7244
|
+
const currDef = schema6._zod.def;
|
|
7245
7245
|
const checks = currDef.checks;
|
|
7246
7246
|
const hasChecks = checks && checks.length > 0;
|
|
7247
7247
|
if (hasChecks) {
|
|
7248
7248
|
throw new Error(".partial() cannot be used on object schemas containing refinements");
|
|
7249
7249
|
}
|
|
7250
|
-
const def = mergeDefs(
|
|
7250
|
+
const def = mergeDefs(schema6._zod.def, {
|
|
7251
7251
|
get shape() {
|
|
7252
|
-
const oldShape =
|
|
7252
|
+
const oldShape = schema6._zod.def.shape;
|
|
7253
7253
|
const shape = { ...oldShape };
|
|
7254
7254
|
if (mask) {
|
|
7255
7255
|
for (const key in mask) {
|
|
@@ -7276,12 +7276,12 @@ function partial(Class2, schema5, mask) {
|
|
|
7276
7276
|
},
|
|
7277
7277
|
checks: []
|
|
7278
7278
|
});
|
|
7279
|
-
return clone(
|
|
7279
|
+
return clone(schema6, def);
|
|
7280
7280
|
}
|
|
7281
|
-
function required(Class2,
|
|
7282
|
-
const def = mergeDefs(
|
|
7281
|
+
function required(Class2, schema6, mask) {
|
|
7282
|
+
const def = mergeDefs(schema6._zod.def, {
|
|
7283
7283
|
get shape() {
|
|
7284
|
-
const oldShape =
|
|
7284
|
+
const oldShape = schema6._zod.def.shape;
|
|
7285
7285
|
const shape = { ...oldShape };
|
|
7286
7286
|
if (mask) {
|
|
7287
7287
|
for (const key in mask) {
|
|
@@ -7307,7 +7307,7 @@ function required(Class2, schema5, mask) {
|
|
|
7307
7307
|
return shape;
|
|
7308
7308
|
}
|
|
7309
7309
|
});
|
|
7310
|
-
return clone(
|
|
7310
|
+
return clone(schema6, def);
|
|
7311
7311
|
}
|
|
7312
7312
|
function aborted(x2, startIndex = 0) {
|
|
7313
7313
|
if (x2.aborted === true)
|
|
@@ -7687,9 +7687,9 @@ var init_parse = __esm({
|
|
|
7687
7687
|
init_core();
|
|
7688
7688
|
init_errors();
|
|
7689
7689
|
init_util();
|
|
7690
|
-
_parse = (_Err) => (
|
|
7690
|
+
_parse = (_Err) => (schema6, value, _ctx, _params) => {
|
|
7691
7691
|
const ctx = _ctx ? { ..._ctx, async: false } : { async: false };
|
|
7692
|
-
const result2 =
|
|
7692
|
+
const result2 = schema6._zod.run({ value, issues: [] }, ctx);
|
|
7693
7693
|
if (result2 instanceof Promise) {
|
|
7694
7694
|
throw new $ZodAsyncError();
|
|
7695
7695
|
}
|
|
@@ -7701,9 +7701,9 @@ var init_parse = __esm({
|
|
|
7701
7701
|
return result2.value;
|
|
7702
7702
|
};
|
|
7703
7703
|
parse = /* @__PURE__ */ _parse($ZodRealError);
|
|
7704
|
-
_parseAsync = (_Err) => async (
|
|
7704
|
+
_parseAsync = (_Err) => async (schema6, value, _ctx, params) => {
|
|
7705
7705
|
const ctx = _ctx ? { ..._ctx, async: true } : { async: true };
|
|
7706
|
-
let result2 =
|
|
7706
|
+
let result2 = schema6._zod.run({ value, issues: [] }, ctx);
|
|
7707
7707
|
if (result2 instanceof Promise)
|
|
7708
7708
|
result2 = await result2;
|
|
7709
7709
|
if (result2.issues.length) {
|
|
@@ -7714,9 +7714,9 @@ var init_parse = __esm({
|
|
|
7714
7714
|
return result2.value;
|
|
7715
7715
|
};
|
|
7716
7716
|
parseAsync = /* @__PURE__ */ _parseAsync($ZodRealError);
|
|
7717
|
-
_safeParse = (_Err) => (
|
|
7717
|
+
_safeParse = (_Err) => (schema6, value, _ctx) => {
|
|
7718
7718
|
const ctx = _ctx ? { ..._ctx, async: false } : { async: false };
|
|
7719
|
-
const result2 =
|
|
7719
|
+
const result2 = schema6._zod.run({ value, issues: [] }, ctx);
|
|
7720
7720
|
if (result2 instanceof Promise) {
|
|
7721
7721
|
throw new $ZodAsyncError();
|
|
7722
7722
|
}
|
|
@@ -7726,9 +7726,9 @@ var init_parse = __esm({
|
|
|
7726
7726
|
} : { success: true, data: result2.value };
|
|
7727
7727
|
};
|
|
7728
7728
|
safeParse = /* @__PURE__ */ _safeParse($ZodRealError);
|
|
7729
|
-
_safeParseAsync = (_Err) => async (
|
|
7729
|
+
_safeParseAsync = (_Err) => async (schema6, value, _ctx) => {
|
|
7730
7730
|
const ctx = _ctx ? { ..._ctx, async: true } : { async: true };
|
|
7731
|
-
let result2 =
|
|
7731
|
+
let result2 = schema6._zod.run({ value, issues: [] }, ctx);
|
|
7732
7732
|
if (result2 instanceof Promise)
|
|
7733
7733
|
result2 = await result2;
|
|
7734
7734
|
return result2.issues.length ? {
|
|
@@ -7737,40 +7737,40 @@ var init_parse = __esm({
|
|
|
7737
7737
|
} : { success: true, data: result2.value };
|
|
7738
7738
|
};
|
|
7739
7739
|
safeParseAsync = /* @__PURE__ */ _safeParseAsync($ZodRealError);
|
|
7740
|
-
_encode = (_Err) => (
|
|
7740
|
+
_encode = (_Err) => (schema6, value, _ctx) => {
|
|
7741
7741
|
const ctx = _ctx ? { ..._ctx, direction: "backward" } : { direction: "backward" };
|
|
7742
|
-
return _parse(_Err)(
|
|
7742
|
+
return _parse(_Err)(schema6, value, ctx);
|
|
7743
7743
|
};
|
|
7744
7744
|
encode = /* @__PURE__ */ _encode($ZodRealError);
|
|
7745
|
-
_decode = (_Err) => (
|
|
7746
|
-
return _parse(_Err)(
|
|
7745
|
+
_decode = (_Err) => (schema6, value, _ctx) => {
|
|
7746
|
+
return _parse(_Err)(schema6, value, _ctx);
|
|
7747
7747
|
};
|
|
7748
7748
|
decode = /* @__PURE__ */ _decode($ZodRealError);
|
|
7749
|
-
_encodeAsync = (_Err) => async (
|
|
7749
|
+
_encodeAsync = (_Err) => async (schema6, value, _ctx) => {
|
|
7750
7750
|
const ctx = _ctx ? { ..._ctx, direction: "backward" } : { direction: "backward" };
|
|
7751
|
-
return _parseAsync(_Err)(
|
|
7751
|
+
return _parseAsync(_Err)(schema6, value, ctx);
|
|
7752
7752
|
};
|
|
7753
7753
|
encodeAsync = /* @__PURE__ */ _encodeAsync($ZodRealError);
|
|
7754
|
-
_decodeAsync = (_Err) => async (
|
|
7755
|
-
return _parseAsync(_Err)(
|
|
7754
|
+
_decodeAsync = (_Err) => async (schema6, value, _ctx) => {
|
|
7755
|
+
return _parseAsync(_Err)(schema6, value, _ctx);
|
|
7756
7756
|
};
|
|
7757
7757
|
decodeAsync = /* @__PURE__ */ _decodeAsync($ZodRealError);
|
|
7758
|
-
_safeEncode = (_Err) => (
|
|
7758
|
+
_safeEncode = (_Err) => (schema6, value, _ctx) => {
|
|
7759
7759
|
const ctx = _ctx ? { ..._ctx, direction: "backward" } : { direction: "backward" };
|
|
7760
|
-
return _safeParse(_Err)(
|
|
7760
|
+
return _safeParse(_Err)(schema6, value, ctx);
|
|
7761
7761
|
};
|
|
7762
7762
|
safeEncode = /* @__PURE__ */ _safeEncode($ZodRealError);
|
|
7763
|
-
_safeDecode = (_Err) => (
|
|
7764
|
-
return _safeParse(_Err)(
|
|
7763
|
+
_safeDecode = (_Err) => (schema6, value, _ctx) => {
|
|
7764
|
+
return _safeParse(_Err)(schema6, value, _ctx);
|
|
7765
7765
|
};
|
|
7766
7766
|
safeDecode = /* @__PURE__ */ _safeDecode($ZodRealError);
|
|
7767
|
-
_safeEncodeAsync = (_Err) => async (
|
|
7767
|
+
_safeEncodeAsync = (_Err) => async (schema6, value, _ctx) => {
|
|
7768
7768
|
const ctx = _ctx ? { ..._ctx, direction: "backward" } : { direction: "backward" };
|
|
7769
|
-
return _safeParseAsync(_Err)(
|
|
7769
|
+
return _safeParseAsync(_Err)(schema6, value, ctx);
|
|
7770
7770
|
};
|
|
7771
7771
|
safeEncodeAsync = /* @__PURE__ */ _safeEncodeAsync($ZodRealError);
|
|
7772
|
-
_safeDecodeAsync = (_Err) => async (
|
|
7773
|
-
return _safeParseAsync(_Err)(
|
|
7772
|
+
_safeDecodeAsync = (_Err) => async (schema6, value, _ctx) => {
|
|
7773
|
+
return _safeParseAsync(_Err)(schema6, value, _ctx);
|
|
7774
7774
|
};
|
|
7775
7775
|
safeDecodeAsync = /* @__PURE__ */ _safeDecodeAsync($ZodRealError);
|
|
7776
7776
|
}
|
|
@@ -9659,9 +9659,9 @@ var init_schemas = __esm({
|
|
|
9659
9659
|
for (const key of normalized.keys) {
|
|
9660
9660
|
const id = ids[key];
|
|
9661
9661
|
const k = esc(key);
|
|
9662
|
-
const
|
|
9663
|
-
const isOptionalIn =
|
|
9664
|
-
const isOptionalOut =
|
|
9662
|
+
const schema6 = shape[key];
|
|
9663
|
+
const isOptionalIn = schema6?._zod?.optin === "optional";
|
|
9664
|
+
const isOptionalOut = schema6?._zod?.optout === "optional";
|
|
9665
9665
|
doc.write(`const ${id} = ${parseStr(key)};`);
|
|
9666
9666
|
if (isOptionalIn && isOptionalOut) {
|
|
9667
9667
|
doc.write(`
|
|
@@ -16991,11 +16991,11 @@ var init_registries = __esm({
|
|
|
16991
16991
|
this._map = /* @__PURE__ */ new WeakMap();
|
|
16992
16992
|
this._idmap = /* @__PURE__ */ new Map();
|
|
16993
16993
|
}
|
|
16994
|
-
add(
|
|
16994
|
+
add(schema6, ..._meta) {
|
|
16995
16995
|
const meta3 = _meta[0];
|
|
16996
|
-
this._map.set(
|
|
16996
|
+
this._map.set(schema6, meta3);
|
|
16997
16997
|
if (meta3 && typeof meta3 === "object" && "id" in meta3) {
|
|
16998
|
-
this._idmap.set(meta3.id,
|
|
16998
|
+
this._idmap.set(meta3.id, schema6);
|
|
16999
16999
|
}
|
|
17000
17000
|
return this;
|
|
17001
17001
|
}
|
|
@@ -17004,26 +17004,26 @@ var init_registries = __esm({
|
|
|
17004
17004
|
this._idmap = /* @__PURE__ */ new Map();
|
|
17005
17005
|
return this;
|
|
17006
17006
|
}
|
|
17007
|
-
remove(
|
|
17008
|
-
const meta3 = this._map.get(
|
|
17007
|
+
remove(schema6) {
|
|
17008
|
+
const meta3 = this._map.get(schema6);
|
|
17009
17009
|
if (meta3 && typeof meta3 === "object" && "id" in meta3) {
|
|
17010
17010
|
this._idmap.delete(meta3.id);
|
|
17011
17011
|
}
|
|
17012
|
-
this._map.delete(
|
|
17012
|
+
this._map.delete(schema6);
|
|
17013
17013
|
return this;
|
|
17014
17014
|
}
|
|
17015
|
-
get(
|
|
17016
|
-
const p =
|
|
17015
|
+
get(schema6) {
|
|
17016
|
+
const p = schema6._zod.parent;
|
|
17017
17017
|
if (p) {
|
|
17018
17018
|
const pm = { ...this.get(p) ?? {} };
|
|
17019
17019
|
delete pm.id;
|
|
17020
|
-
const f = { ...pm, ...this._map.get(
|
|
17020
|
+
const f = { ...pm, ...this._map.get(schema6) };
|
|
17021
17021
|
return Object.keys(f).length ? f : void 0;
|
|
17022
17022
|
}
|
|
17023
|
-
return this._map.get(
|
|
17023
|
+
return this._map.get(schema6);
|
|
17024
17024
|
}
|
|
17025
|
-
has(
|
|
17026
|
-
return this._map.has(
|
|
17025
|
+
has(schema6) {
|
|
17026
|
+
return this._map.has(schema6);
|
|
17027
17027
|
}
|
|
17028
17028
|
};
|
|
17029
17029
|
(_a2 = globalThis).__zod_globalRegistry ?? (_a2.__zod_globalRegistry = registry());
|
|
@@ -17668,11 +17668,11 @@ function _endsWith(suffix, params) {
|
|
|
17668
17668
|
});
|
|
17669
17669
|
}
|
|
17670
17670
|
// @__NO_SIDE_EFFECTS__
|
|
17671
|
-
function _property(property,
|
|
17671
|
+
function _property(property, schema6, params) {
|
|
17672
17672
|
return new $ZodCheckProperty({
|
|
17673
17673
|
check: "property",
|
|
17674
17674
|
property,
|
|
17675
|
-
schema:
|
|
17675
|
+
schema: schema6,
|
|
17676
17676
|
...normalizeParams(params)
|
|
17677
17677
|
});
|
|
17678
17678
|
}
|
|
@@ -17920,23 +17920,23 @@ function _promise(Class2, innerType) {
|
|
|
17920
17920
|
function _custom(Class2, fn, _params) {
|
|
17921
17921
|
const norm = normalizeParams(_params);
|
|
17922
17922
|
norm.abort ?? (norm.abort = true);
|
|
17923
|
-
const
|
|
17923
|
+
const schema6 = new Class2({
|
|
17924
17924
|
type: "custom",
|
|
17925
17925
|
check: "custom",
|
|
17926
17926
|
fn,
|
|
17927
17927
|
...norm
|
|
17928
17928
|
});
|
|
17929
|
-
return
|
|
17929
|
+
return schema6;
|
|
17930
17930
|
}
|
|
17931
17931
|
// @__NO_SIDE_EFFECTS__
|
|
17932
17932
|
function _refine(Class2, fn, _params) {
|
|
17933
|
-
const
|
|
17933
|
+
const schema6 = new Class2({
|
|
17934
17934
|
type: "custom",
|
|
17935
17935
|
check: "custom",
|
|
17936
17936
|
fn,
|
|
17937
17937
|
...normalizeParams(_params)
|
|
17938
17938
|
});
|
|
17939
|
-
return
|
|
17939
|
+
return schema6;
|
|
17940
17940
|
}
|
|
17941
17941
|
// @__NO_SIDE_EFFECTS__
|
|
17942
17942
|
function _superRefine(fn, params) {
|
|
@@ -18101,40 +18101,40 @@ function initializeContext(params) {
|
|
|
18101
18101
|
external: params?.external ?? void 0
|
|
18102
18102
|
};
|
|
18103
18103
|
}
|
|
18104
|
-
function process2(
|
|
18104
|
+
function process2(schema6, ctx, _params = { path: [], schemaPath: [] }) {
|
|
18105
18105
|
var _a4;
|
|
18106
|
-
const def =
|
|
18107
|
-
const seen = ctx.seen.get(
|
|
18106
|
+
const def = schema6._zod.def;
|
|
18107
|
+
const seen = ctx.seen.get(schema6);
|
|
18108
18108
|
if (seen) {
|
|
18109
18109
|
seen.count++;
|
|
18110
|
-
const isCycle = _params.schemaPath.includes(
|
|
18110
|
+
const isCycle = _params.schemaPath.includes(schema6);
|
|
18111
18111
|
if (isCycle) {
|
|
18112
18112
|
seen.cycle = _params.path;
|
|
18113
18113
|
}
|
|
18114
18114
|
return seen.schema;
|
|
18115
18115
|
}
|
|
18116
18116
|
const result2 = { schema: {}, count: 1, cycle: void 0, path: _params.path };
|
|
18117
|
-
ctx.seen.set(
|
|
18118
|
-
const overrideSchema =
|
|
18117
|
+
ctx.seen.set(schema6, result2);
|
|
18118
|
+
const overrideSchema = schema6._zod.toJSONSchema?.();
|
|
18119
18119
|
if (overrideSchema) {
|
|
18120
18120
|
result2.schema = overrideSchema;
|
|
18121
18121
|
} else {
|
|
18122
18122
|
const params = {
|
|
18123
18123
|
..._params,
|
|
18124
|
-
schemaPath: [..._params.schemaPath,
|
|
18124
|
+
schemaPath: [..._params.schemaPath, schema6],
|
|
18125
18125
|
path: _params.path
|
|
18126
18126
|
};
|
|
18127
|
-
if (
|
|
18128
|
-
|
|
18127
|
+
if (schema6._zod.processJSONSchema) {
|
|
18128
|
+
schema6._zod.processJSONSchema(ctx, result2.schema, params);
|
|
18129
18129
|
} else {
|
|
18130
18130
|
const _json = result2.schema;
|
|
18131
18131
|
const processor = ctx.processors[def.type];
|
|
18132
18132
|
if (!processor) {
|
|
18133
18133
|
throw new Error(`[toJSONSchema]: Non-representable type encountered: ${def.type}`);
|
|
18134
18134
|
}
|
|
18135
|
-
processor(
|
|
18135
|
+
processor(schema6, ctx, _json, params);
|
|
18136
18136
|
}
|
|
18137
|
-
const parent =
|
|
18137
|
+
const parent = schema6._zod.parent;
|
|
18138
18138
|
if (parent) {
|
|
18139
18139
|
if (!result2.ref)
|
|
18140
18140
|
result2.ref = parent;
|
|
@@ -18142,21 +18142,21 @@ function process2(schema5, ctx, _params = { path: [], schemaPath: [] }) {
|
|
|
18142
18142
|
ctx.seen.get(parent).isParent = true;
|
|
18143
18143
|
}
|
|
18144
18144
|
}
|
|
18145
|
-
const meta3 = ctx.metadataRegistry.get(
|
|
18145
|
+
const meta3 = ctx.metadataRegistry.get(schema6);
|
|
18146
18146
|
if (meta3)
|
|
18147
18147
|
Object.assign(result2.schema, meta3);
|
|
18148
|
-
if (ctx.io === "input" && isTransforming(
|
|
18148
|
+
if (ctx.io === "input" && isTransforming(schema6)) {
|
|
18149
18149
|
delete result2.schema.examples;
|
|
18150
18150
|
delete result2.schema.default;
|
|
18151
18151
|
}
|
|
18152
18152
|
if (ctx.io === "input" && "_prefault" in result2.schema)
|
|
18153
18153
|
(_a4 = result2.schema).default ?? (_a4.default = result2.schema._prefault);
|
|
18154
18154
|
delete result2.schema._prefault;
|
|
18155
|
-
const _result = ctx.seen.get(
|
|
18155
|
+
const _result = ctx.seen.get(schema6);
|
|
18156
18156
|
return _result.schema;
|
|
18157
18157
|
}
|
|
18158
|
-
function extractDefs(ctx,
|
|
18159
|
-
const root = ctx.seen.get(
|
|
18158
|
+
function extractDefs(ctx, schema6) {
|
|
18159
|
+
const root = ctx.seen.get(schema6);
|
|
18160
18160
|
if (!root)
|
|
18161
18161
|
throw new Error("Unprocessed schema. This is a bug in Zod.");
|
|
18162
18162
|
const idToSchema = /* @__PURE__ */ new Map();
|
|
@@ -18199,11 +18199,11 @@ function extractDefs(ctx, schema5) {
|
|
|
18199
18199
|
seen.def = { ...seen.schema };
|
|
18200
18200
|
if (defId)
|
|
18201
18201
|
seen.defId = defId;
|
|
18202
|
-
const
|
|
18203
|
-
for (const key in
|
|
18204
|
-
delete
|
|
18202
|
+
const schema7 = seen.schema;
|
|
18203
|
+
for (const key in schema7) {
|
|
18204
|
+
delete schema7[key];
|
|
18205
18205
|
}
|
|
18206
|
-
|
|
18206
|
+
schema7.$ref = ref;
|
|
18207
18207
|
};
|
|
18208
18208
|
if (ctx.cycles === "throw") {
|
|
18209
18209
|
for (const entry2 of ctx.seen.entries()) {
|
|
@@ -18217,13 +18217,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
18217
18217
|
}
|
|
18218
18218
|
for (const entry2 of ctx.seen.entries()) {
|
|
18219
18219
|
const seen = entry2[1];
|
|
18220
|
-
if (
|
|
18220
|
+
if (schema6 === entry2[0]) {
|
|
18221
18221
|
extractToDef(entry2);
|
|
18222
18222
|
continue;
|
|
18223
18223
|
}
|
|
18224
18224
|
if (ctx.external) {
|
|
18225
18225
|
const ext = ctx.external.registry.get(entry2[0])?.id;
|
|
18226
|
-
if (
|
|
18226
|
+
if (schema6 !== entry2[0] && ext) {
|
|
18227
18227
|
extractToDef(entry2);
|
|
18228
18228
|
continue;
|
|
18229
18229
|
}
|
|
@@ -18245,16 +18245,16 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
18245
18245
|
}
|
|
18246
18246
|
}
|
|
18247
18247
|
}
|
|
18248
|
-
function finalize(ctx,
|
|
18249
|
-
const root = ctx.seen.get(
|
|
18248
|
+
function finalize(ctx, schema6) {
|
|
18249
|
+
const root = ctx.seen.get(schema6);
|
|
18250
18250
|
if (!root)
|
|
18251
18251
|
throw new Error("Unprocessed schema. This is a bug in Zod.");
|
|
18252
18252
|
const flattenRef = (zodSchema) => {
|
|
18253
18253
|
const seen = ctx.seen.get(zodSchema);
|
|
18254
18254
|
if (seen.ref === null)
|
|
18255
18255
|
return;
|
|
18256
|
-
const
|
|
18257
|
-
const _cached = { ...
|
|
18256
|
+
const schema7 = seen.def ?? seen.schema;
|
|
18257
|
+
const _cached = { ...schema7 };
|
|
18258
18258
|
const ref = seen.ref;
|
|
18259
18259
|
seen.ref = null;
|
|
18260
18260
|
if (ref) {
|
|
@@ -18262,28 +18262,28 @@ function finalize(ctx, schema5) {
|
|
|
18262
18262
|
const refSeen = ctx.seen.get(ref);
|
|
18263
18263
|
const refSchema = refSeen.schema;
|
|
18264
18264
|
if (refSchema.$ref && (ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0")) {
|
|
18265
|
-
|
|
18266
|
-
|
|
18265
|
+
schema7.allOf = schema7.allOf ?? [];
|
|
18266
|
+
schema7.allOf.push(refSchema);
|
|
18267
18267
|
} else {
|
|
18268
|
-
Object.assign(
|
|
18268
|
+
Object.assign(schema7, refSchema);
|
|
18269
18269
|
}
|
|
18270
|
-
Object.assign(
|
|
18270
|
+
Object.assign(schema7, _cached);
|
|
18271
18271
|
const isParentRef = zodSchema._zod.parent === ref;
|
|
18272
18272
|
if (isParentRef) {
|
|
18273
|
-
for (const key in
|
|
18273
|
+
for (const key in schema7) {
|
|
18274
18274
|
if (key === "$ref" || key === "allOf")
|
|
18275
18275
|
continue;
|
|
18276
18276
|
if (!(key in _cached)) {
|
|
18277
|
-
delete
|
|
18277
|
+
delete schema7[key];
|
|
18278
18278
|
}
|
|
18279
18279
|
}
|
|
18280
18280
|
}
|
|
18281
18281
|
if (refSchema.$ref && refSeen.def) {
|
|
18282
|
-
for (const key in
|
|
18282
|
+
for (const key in schema7) {
|
|
18283
18283
|
if (key === "$ref" || key === "allOf")
|
|
18284
18284
|
continue;
|
|
18285
|
-
if (key in refSeen.def && JSON.stringify(
|
|
18286
|
-
delete
|
|
18285
|
+
if (key in refSeen.def && JSON.stringify(schema7[key]) === JSON.stringify(refSeen.def[key])) {
|
|
18286
|
+
delete schema7[key];
|
|
18287
18287
|
}
|
|
18288
18288
|
}
|
|
18289
18289
|
}
|
|
@@ -18293,13 +18293,13 @@ function finalize(ctx, schema5) {
|
|
|
18293
18293
|
flattenRef(parent);
|
|
18294
18294
|
const parentSeen = ctx.seen.get(parent);
|
|
18295
18295
|
if (parentSeen?.schema.$ref) {
|
|
18296
|
-
|
|
18296
|
+
schema7.$ref = parentSeen.schema.$ref;
|
|
18297
18297
|
if (parentSeen.def) {
|
|
18298
|
-
for (const key in
|
|
18298
|
+
for (const key in schema7) {
|
|
18299
18299
|
if (key === "$ref" || key === "allOf")
|
|
18300
18300
|
continue;
|
|
18301
|
-
if (key in parentSeen.def && JSON.stringify(
|
|
18302
|
-
delete
|
|
18301
|
+
if (key in parentSeen.def && JSON.stringify(schema7[key]) === JSON.stringify(parentSeen.def[key])) {
|
|
18302
|
+
delete schema7[key];
|
|
18303
18303
|
}
|
|
18304
18304
|
}
|
|
18305
18305
|
}
|
|
@@ -18307,7 +18307,7 @@ function finalize(ctx, schema5) {
|
|
|
18307
18307
|
}
|
|
18308
18308
|
ctx.override({
|
|
18309
18309
|
zodSchema,
|
|
18310
|
-
jsonSchema:
|
|
18310
|
+
jsonSchema: schema7,
|
|
18311
18311
|
path: seen.path ?? []
|
|
18312
18312
|
});
|
|
18313
18313
|
};
|
|
@@ -18325,13 +18325,13 @@ function finalize(ctx, schema5) {
|
|
|
18325
18325
|
} else {
|
|
18326
18326
|
}
|
|
18327
18327
|
if (ctx.external?.uri) {
|
|
18328
|
-
const id = ctx.external.registry.get(
|
|
18328
|
+
const id = ctx.external.registry.get(schema6)?.id;
|
|
18329
18329
|
if (!id)
|
|
18330
18330
|
throw new Error("Schema is missing an `id` property");
|
|
18331
18331
|
result2.$id = ctx.external.uri(id);
|
|
18332
18332
|
}
|
|
18333
18333
|
Object.assign(result2, root.def ?? root.schema);
|
|
18334
|
-
const rootMetaId = ctx.metadataRegistry.get(
|
|
18334
|
+
const rootMetaId = ctx.metadataRegistry.get(schema6)?.id;
|
|
18335
18335
|
if (rootMetaId !== void 0 && result2.id === rootMetaId)
|
|
18336
18336
|
delete result2.id;
|
|
18337
18337
|
const defs = ctx.external?.defs ?? {};
|
|
@@ -18357,10 +18357,10 @@ function finalize(ctx, schema5) {
|
|
|
18357
18357
|
const finalized = JSON.parse(JSON.stringify(result2));
|
|
18358
18358
|
Object.defineProperty(finalized, "~standard", {
|
|
18359
18359
|
value: {
|
|
18360
|
-
...
|
|
18360
|
+
...schema6["~standard"],
|
|
18361
18361
|
jsonSchema: {
|
|
18362
|
-
input: createStandardJSONSchemaMethod(
|
|
18363
|
-
output: createStandardJSONSchemaMethod(
|
|
18362
|
+
input: createStandardJSONSchemaMethod(schema6, "input", ctx.processors),
|
|
18363
|
+
output: createStandardJSONSchemaMethod(schema6, "output", ctx.processors)
|
|
18364
18364
|
}
|
|
18365
18365
|
},
|
|
18366
18366
|
enumerable: false,
|
|
@@ -18428,18 +18428,18 @@ var createToJSONSchemaMethod, createStandardJSONSchemaMethod;
|
|
|
18428
18428
|
var init_to_json_schema = __esm({
|
|
18429
18429
|
"../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/to-json-schema.js"() {
|
|
18430
18430
|
init_registries();
|
|
18431
|
-
createToJSONSchemaMethod = (
|
|
18431
|
+
createToJSONSchemaMethod = (schema6, processors = {}) => (params) => {
|
|
18432
18432
|
const ctx = initializeContext({ ...params, processors });
|
|
18433
|
-
process2(
|
|
18434
|
-
extractDefs(ctx,
|
|
18435
|
-
return finalize(ctx,
|
|
18433
|
+
process2(schema6, ctx);
|
|
18434
|
+
extractDefs(ctx, schema6);
|
|
18435
|
+
return finalize(ctx, schema6);
|
|
18436
18436
|
};
|
|
18437
|
-
createStandardJSONSchemaMethod = (
|
|
18437
|
+
createStandardJSONSchemaMethod = (schema6, io, processors = {}) => (params) => {
|
|
18438
18438
|
const { libraryOptions, target } = params ?? {};
|
|
18439
18439
|
const ctx = initializeContext({ ...libraryOptions ?? {}, target, io, processors });
|
|
18440
|
-
process2(
|
|
18441
|
-
extractDefs(ctx,
|
|
18442
|
-
return finalize(ctx,
|
|
18440
|
+
process2(schema6, ctx);
|
|
18441
|
+
extractDefs(ctx, schema6);
|
|
18442
|
+
return finalize(ctx, schema6);
|
|
18443
18443
|
};
|
|
18444
18444
|
}
|
|
18445
18445
|
});
|
|
@@ -18451,8 +18451,8 @@ function toJSONSchema(input, params) {
|
|
|
18451
18451
|
const ctx2 = initializeContext({ ...params, processors: allProcessors });
|
|
18452
18452
|
const defs = {};
|
|
18453
18453
|
for (const entry2 of registry2._idmap.entries()) {
|
|
18454
|
-
const [_,
|
|
18455
|
-
process2(
|
|
18454
|
+
const [_, schema6] = entry2;
|
|
18455
|
+
process2(schema6, ctx2);
|
|
18456
18456
|
}
|
|
18457
18457
|
const schemas = {};
|
|
18458
18458
|
const external = {
|
|
@@ -18462,9 +18462,9 @@ function toJSONSchema(input, params) {
|
|
|
18462
18462
|
};
|
|
18463
18463
|
ctx2.external = external;
|
|
18464
18464
|
for (const entry2 of registry2._idmap.entries()) {
|
|
18465
|
-
const [key,
|
|
18466
|
-
extractDefs(ctx2,
|
|
18467
|
-
schemas[key] = finalize(ctx2,
|
|
18465
|
+
const [key, schema6] = entry2;
|
|
18466
|
+
extractDefs(ctx2, schema6);
|
|
18467
|
+
schemas[key] = finalize(ctx2, schema6);
|
|
18468
18468
|
}
|
|
18469
18469
|
if (Object.keys(defs).length > 0) {
|
|
18470
18470
|
const defsSegment = ctx2.target === "draft-2020-12" ? "$defs" : "definitions";
|
|
@@ -18492,10 +18492,10 @@ var init_json_schema_processors = __esm({
|
|
|
18492
18492
|
regex: ""
|
|
18493
18493
|
// do not set
|
|
18494
18494
|
};
|
|
18495
|
-
stringProcessor = (
|
|
18495
|
+
stringProcessor = (schema6, ctx, _json, _params) => {
|
|
18496
18496
|
const json2 = _json;
|
|
18497
18497
|
json2.type = "string";
|
|
18498
|
-
const { minimum, maximum, format: format3, patterns, contentEncoding } =
|
|
18498
|
+
const { minimum, maximum, format: format3, patterns, contentEncoding } = schema6._zod.bag;
|
|
18499
18499
|
if (typeof minimum === "number")
|
|
18500
18500
|
json2.minLength = minimum;
|
|
18501
18501
|
if (typeof maximum === "number")
|
|
@@ -18524,9 +18524,9 @@ var init_json_schema_processors = __esm({
|
|
|
18524
18524
|
}
|
|
18525
18525
|
}
|
|
18526
18526
|
};
|
|
18527
|
-
numberProcessor = (
|
|
18527
|
+
numberProcessor = (schema6, ctx, _json, _params) => {
|
|
18528
18528
|
const json2 = _json;
|
|
18529
|
-
const { minimum, maximum, format: format3, multipleOf, exclusiveMaximum, exclusiveMinimum } =
|
|
18529
|
+
const { minimum, maximum, format: format3, multipleOf, exclusiveMaximum, exclusiveMinimum } = schema6._zod.bag;
|
|
18530
18530
|
if (typeof format3 === "string" && format3.includes("int"))
|
|
18531
18531
|
json2.type = "integer";
|
|
18532
18532
|
else
|
|
@@ -18601,8 +18601,8 @@ var init_json_schema_processors = __esm({
|
|
|
18601
18601
|
throw new Error("Date cannot be represented in JSON Schema");
|
|
18602
18602
|
}
|
|
18603
18603
|
};
|
|
18604
|
-
enumProcessor = (
|
|
18605
|
-
const def =
|
|
18604
|
+
enumProcessor = (schema6, _ctx, json2, _params) => {
|
|
18605
|
+
const def = schema6._zod.def;
|
|
18606
18606
|
const values = getEnumValues(def.entries);
|
|
18607
18607
|
if (values.every((v) => typeof v === "number"))
|
|
18608
18608
|
json2.type = "number";
|
|
@@ -18610,8 +18610,8 @@ var init_json_schema_processors = __esm({
|
|
|
18610
18610
|
json2.type = "string";
|
|
18611
18611
|
json2.enum = values;
|
|
18612
18612
|
};
|
|
18613
|
-
literalProcessor = (
|
|
18614
|
-
const def =
|
|
18613
|
+
literalProcessor = (schema6, ctx, json2, _params) => {
|
|
18614
|
+
const def = schema6._zod.def;
|
|
18615
18615
|
const vals = [];
|
|
18616
18616
|
for (const val of def.values) {
|
|
18617
18617
|
if (val === void 0) {
|
|
@@ -18655,22 +18655,22 @@ var init_json_schema_processors = __esm({
|
|
|
18655
18655
|
throw new Error("NaN cannot be represented in JSON Schema");
|
|
18656
18656
|
}
|
|
18657
18657
|
};
|
|
18658
|
-
templateLiteralProcessor = (
|
|
18658
|
+
templateLiteralProcessor = (schema6, _ctx, json2, _params) => {
|
|
18659
18659
|
const _json = json2;
|
|
18660
|
-
const pattern =
|
|
18660
|
+
const pattern = schema6._zod.pattern;
|
|
18661
18661
|
if (!pattern)
|
|
18662
18662
|
throw new Error("Pattern not found in template literal");
|
|
18663
18663
|
_json.type = "string";
|
|
18664
18664
|
_json.pattern = pattern.source;
|
|
18665
18665
|
};
|
|
18666
|
-
fileProcessor = (
|
|
18666
|
+
fileProcessor = (schema6, _ctx, json2, _params) => {
|
|
18667
18667
|
const _json = json2;
|
|
18668
18668
|
const file2 = {
|
|
18669
18669
|
type: "string",
|
|
18670
18670
|
format: "binary",
|
|
18671
18671
|
contentEncoding: "binary"
|
|
18672
18672
|
};
|
|
18673
|
-
const { minimum, maximum, mime } =
|
|
18673
|
+
const { minimum, maximum, mime } = schema6._zod.bag;
|
|
18674
18674
|
if (minimum !== void 0)
|
|
18675
18675
|
file2.minLength = minimum;
|
|
18676
18676
|
if (maximum !== void 0)
|
|
@@ -18715,10 +18715,10 @@ var init_json_schema_processors = __esm({
|
|
|
18715
18715
|
throw new Error("Set cannot be represented in JSON Schema");
|
|
18716
18716
|
}
|
|
18717
18717
|
};
|
|
18718
|
-
arrayProcessor = (
|
|
18718
|
+
arrayProcessor = (schema6, ctx, _json, params) => {
|
|
18719
18719
|
const json2 = _json;
|
|
18720
|
-
const def =
|
|
18721
|
-
const { minimum, maximum } =
|
|
18720
|
+
const def = schema6._zod.def;
|
|
18721
|
+
const { minimum, maximum } = schema6._zod.bag;
|
|
18722
18722
|
if (typeof minimum === "number")
|
|
18723
18723
|
json2.minItems = minimum;
|
|
18724
18724
|
if (typeof maximum === "number")
|
|
@@ -18729,9 +18729,9 @@ var init_json_schema_processors = __esm({
|
|
|
18729
18729
|
path: [...params.path, "items"]
|
|
18730
18730
|
});
|
|
18731
18731
|
};
|
|
18732
|
-
objectProcessor = (
|
|
18732
|
+
objectProcessor = (schema6, ctx, _json, params) => {
|
|
18733
18733
|
const json2 = _json;
|
|
18734
|
-
const def =
|
|
18734
|
+
const def = schema6._zod.def;
|
|
18735
18735
|
json2.type = "object";
|
|
18736
18736
|
json2.properties = {};
|
|
18737
18737
|
const shape = def.shape;
|
|
@@ -18765,8 +18765,8 @@ var init_json_schema_processors = __esm({
|
|
|
18765
18765
|
});
|
|
18766
18766
|
}
|
|
18767
18767
|
};
|
|
18768
|
-
unionProcessor = (
|
|
18769
|
-
const def =
|
|
18768
|
+
unionProcessor = (schema6, ctx, json2, params) => {
|
|
18769
|
+
const def = schema6._zod.def;
|
|
18770
18770
|
const isExclusive = def.inclusive === false;
|
|
18771
18771
|
const options = def.options.map((x2, i2) => process2(x2, ctx, {
|
|
18772
18772
|
...params,
|
|
@@ -18778,8 +18778,8 @@ var init_json_schema_processors = __esm({
|
|
|
18778
18778
|
json2.anyOf = options;
|
|
18779
18779
|
}
|
|
18780
18780
|
};
|
|
18781
|
-
intersectionProcessor = (
|
|
18782
|
-
const def =
|
|
18781
|
+
intersectionProcessor = (schema6, ctx, json2, params) => {
|
|
18782
|
+
const def = schema6._zod.def;
|
|
18783
18783
|
const a = process2(def.left, ctx, {
|
|
18784
18784
|
...params,
|
|
18785
18785
|
path: [...params.path, "allOf", 0]
|
|
@@ -18795,9 +18795,9 @@ var init_json_schema_processors = __esm({
|
|
|
18795
18795
|
];
|
|
18796
18796
|
json2.allOf = allOf;
|
|
18797
18797
|
};
|
|
18798
|
-
tupleProcessor = (
|
|
18798
|
+
tupleProcessor = (schema6, ctx, _json, params) => {
|
|
18799
18799
|
const json2 = _json;
|
|
18800
|
-
const def =
|
|
18800
|
+
const def = schema6._zod.def;
|
|
18801
18801
|
json2.type = "array";
|
|
18802
18802
|
const prefixPath = ctx.target === "draft-2020-12" ? "prefixItems" : "items";
|
|
18803
18803
|
const restPath = ctx.target === "draft-2020-12" ? "items" : ctx.target === "openapi-3.0" ? "items" : "additionalItems";
|
|
@@ -18831,15 +18831,15 @@ var init_json_schema_processors = __esm({
|
|
|
18831
18831
|
json2.additionalItems = rest;
|
|
18832
18832
|
}
|
|
18833
18833
|
}
|
|
18834
|
-
const { minimum, maximum } =
|
|
18834
|
+
const { minimum, maximum } = schema6._zod.bag;
|
|
18835
18835
|
if (typeof minimum === "number")
|
|
18836
18836
|
json2.minItems = minimum;
|
|
18837
18837
|
if (typeof maximum === "number")
|
|
18838
18838
|
json2.maxItems = maximum;
|
|
18839
18839
|
};
|
|
18840
|
-
recordProcessor = (
|
|
18840
|
+
recordProcessor = (schema6, ctx, _json, params) => {
|
|
18841
18841
|
const json2 = _json;
|
|
18842
|
-
const def =
|
|
18842
|
+
const def = schema6._zod.def;
|
|
18843
18843
|
json2.type = "object";
|
|
18844
18844
|
const keyType = def.keyType;
|
|
18845
18845
|
const keyBag = keyType._zod.bag;
|
|
@@ -18873,10 +18873,10 @@ var init_json_schema_processors = __esm({
|
|
|
18873
18873
|
}
|
|
18874
18874
|
}
|
|
18875
18875
|
};
|
|
18876
|
-
nullableProcessor = (
|
|
18877
|
-
const def =
|
|
18876
|
+
nullableProcessor = (schema6, ctx, json2, params) => {
|
|
18877
|
+
const def = schema6._zod.def;
|
|
18878
18878
|
const inner = process2(def.innerType, ctx, params);
|
|
18879
|
-
const seen = ctx.seen.get(
|
|
18879
|
+
const seen = ctx.seen.get(schema6);
|
|
18880
18880
|
if (ctx.target === "openapi-3.0") {
|
|
18881
18881
|
seen.ref = def.innerType;
|
|
18882
18882
|
json2.nullable = true;
|
|
@@ -18884,31 +18884,31 @@ var init_json_schema_processors = __esm({
|
|
|
18884
18884
|
json2.anyOf = [inner, { type: "null" }];
|
|
18885
18885
|
}
|
|
18886
18886
|
};
|
|
18887
|
-
nonoptionalProcessor = (
|
|
18888
|
-
const def =
|
|
18887
|
+
nonoptionalProcessor = (schema6, ctx, _json, params) => {
|
|
18888
|
+
const def = schema6._zod.def;
|
|
18889
18889
|
process2(def.innerType, ctx, params);
|
|
18890
|
-
const seen = ctx.seen.get(
|
|
18890
|
+
const seen = ctx.seen.get(schema6);
|
|
18891
18891
|
seen.ref = def.innerType;
|
|
18892
18892
|
};
|
|
18893
|
-
defaultProcessor = (
|
|
18894
|
-
const def =
|
|
18893
|
+
defaultProcessor = (schema6, ctx, json2, params) => {
|
|
18894
|
+
const def = schema6._zod.def;
|
|
18895
18895
|
process2(def.innerType, ctx, params);
|
|
18896
|
-
const seen = ctx.seen.get(
|
|
18896
|
+
const seen = ctx.seen.get(schema6);
|
|
18897
18897
|
seen.ref = def.innerType;
|
|
18898
18898
|
json2.default = JSON.parse(JSON.stringify(def.defaultValue));
|
|
18899
18899
|
};
|
|
18900
|
-
prefaultProcessor = (
|
|
18901
|
-
const def =
|
|
18900
|
+
prefaultProcessor = (schema6, ctx, json2, params) => {
|
|
18901
|
+
const def = schema6._zod.def;
|
|
18902
18902
|
process2(def.innerType, ctx, params);
|
|
18903
|
-
const seen = ctx.seen.get(
|
|
18903
|
+
const seen = ctx.seen.get(schema6);
|
|
18904
18904
|
seen.ref = def.innerType;
|
|
18905
18905
|
if (ctx.io === "input")
|
|
18906
18906
|
json2._prefault = JSON.parse(JSON.stringify(def.defaultValue));
|
|
18907
18907
|
};
|
|
18908
|
-
catchProcessor = (
|
|
18909
|
-
const def =
|
|
18908
|
+
catchProcessor = (schema6, ctx, json2, params) => {
|
|
18909
|
+
const def = schema6._zod.def;
|
|
18910
18910
|
process2(def.innerType, ctx, params);
|
|
18911
|
-
const seen = ctx.seen.get(
|
|
18911
|
+
const seen = ctx.seen.get(schema6);
|
|
18912
18912
|
seen.ref = def.innerType;
|
|
18913
18913
|
let catchValue;
|
|
18914
18914
|
try {
|
|
@@ -18918,37 +18918,37 @@ var init_json_schema_processors = __esm({
|
|
|
18918
18918
|
}
|
|
18919
18919
|
json2.default = catchValue;
|
|
18920
18920
|
};
|
|
18921
|
-
pipeProcessor = (
|
|
18922
|
-
const def =
|
|
18921
|
+
pipeProcessor = (schema6, ctx, _json, params) => {
|
|
18922
|
+
const def = schema6._zod.def;
|
|
18923
18923
|
const inIsTransform = def.in._zod.traits.has("$ZodTransform");
|
|
18924
18924
|
const innerType = ctx.io === "input" ? inIsTransform ? def.out : def.in : def.out;
|
|
18925
18925
|
process2(innerType, ctx, params);
|
|
18926
|
-
const seen = ctx.seen.get(
|
|
18926
|
+
const seen = ctx.seen.get(schema6);
|
|
18927
18927
|
seen.ref = innerType;
|
|
18928
18928
|
};
|
|
18929
|
-
readonlyProcessor = (
|
|
18930
|
-
const def =
|
|
18929
|
+
readonlyProcessor = (schema6, ctx, json2, params) => {
|
|
18930
|
+
const def = schema6._zod.def;
|
|
18931
18931
|
process2(def.innerType, ctx, params);
|
|
18932
|
-
const seen = ctx.seen.get(
|
|
18932
|
+
const seen = ctx.seen.get(schema6);
|
|
18933
18933
|
seen.ref = def.innerType;
|
|
18934
18934
|
json2.readOnly = true;
|
|
18935
18935
|
};
|
|
18936
|
-
promiseProcessor = (
|
|
18937
|
-
const def =
|
|
18936
|
+
promiseProcessor = (schema6, ctx, _json, params) => {
|
|
18937
|
+
const def = schema6._zod.def;
|
|
18938
18938
|
process2(def.innerType, ctx, params);
|
|
18939
|
-
const seen = ctx.seen.get(
|
|
18939
|
+
const seen = ctx.seen.get(schema6);
|
|
18940
18940
|
seen.ref = def.innerType;
|
|
18941
18941
|
};
|
|
18942
|
-
optionalProcessor = (
|
|
18943
|
-
const def =
|
|
18942
|
+
optionalProcessor = (schema6, ctx, _json, params) => {
|
|
18943
|
+
const def = schema6._zod.def;
|
|
18944
18944
|
process2(def.innerType, ctx, params);
|
|
18945
|
-
const seen = ctx.seen.get(
|
|
18945
|
+
const seen = ctx.seen.get(schema6);
|
|
18946
18946
|
seen.ref = def.innerType;
|
|
18947
18947
|
};
|
|
18948
|
-
lazyProcessor = (
|
|
18949
|
-
const innerType =
|
|
18948
|
+
lazyProcessor = (schema6, ctx, _json, params) => {
|
|
18949
|
+
const innerType = schema6._zod.innerType;
|
|
18950
18950
|
process2(innerType, ctx, params);
|
|
18951
|
-
const seen = ctx.seen.get(
|
|
18951
|
+
const seen = ctx.seen.get(schema6);
|
|
18952
18952
|
seen.ref = innerType;
|
|
18953
18953
|
};
|
|
18954
18954
|
allProcessors = {
|
|
@@ -19052,14 +19052,14 @@ var init_json_schema_generator = __esm({
|
|
|
19052
19052
|
* Process a schema to prepare it for JSON Schema generation.
|
|
19053
19053
|
* This must be called before emit().
|
|
19054
19054
|
*/
|
|
19055
|
-
process(
|
|
19056
|
-
return process2(
|
|
19055
|
+
process(schema6, _params = { path: [], schemaPath: [] }) {
|
|
19056
|
+
return process2(schema6, this.ctx, _params);
|
|
19057
19057
|
}
|
|
19058
19058
|
/**
|
|
19059
19059
|
* Emit the final JSON Schema after processing.
|
|
19060
19060
|
* Must call process() first.
|
|
19061
19061
|
*/
|
|
19062
|
-
emit(
|
|
19062
|
+
emit(schema6, _params) {
|
|
19063
19063
|
if (_params) {
|
|
19064
19064
|
if (_params.cycles)
|
|
19065
19065
|
this.ctx.cycles = _params.cycles;
|
|
@@ -19068,8 +19068,8 @@ var init_json_schema_generator = __esm({
|
|
|
19068
19068
|
if (_params.external)
|
|
19069
19069
|
this.ctx.external = _params.external;
|
|
19070
19070
|
}
|
|
19071
|
-
extractDefs(this.ctx,
|
|
19072
|
-
const result2 = finalize(this.ctx,
|
|
19071
|
+
extractDefs(this.ctx, schema6);
|
|
19072
|
+
const result2 = finalize(this.ctx, schema6);
|
|
19073
19073
|
const { "~standard": _, ...plainResult } = result2;
|
|
19074
19074
|
return plainResult;
|
|
19075
19075
|
}
|
|
@@ -19898,8 +19898,8 @@ function date3(params) {
|
|
|
19898
19898
|
function array(element, params) {
|
|
19899
19899
|
return _array(ZodArray, element, params);
|
|
19900
19900
|
}
|
|
19901
|
-
function keyof(
|
|
19902
|
-
const shape =
|
|
19901
|
+
function keyof(schema6) {
|
|
19902
|
+
const shape = schema6._zod.def.shape;
|
|
19903
19903
|
return _enum2(Object.keys(shape));
|
|
19904
19904
|
}
|
|
19905
19905
|
function object(shape, params) {
|
|
@@ -20214,11 +20214,11 @@ function json(params) {
|
|
|
20214
20214
|
});
|
|
20215
20215
|
return jsonSchema;
|
|
20216
20216
|
}
|
|
20217
|
-
function preprocess(fn,
|
|
20217
|
+
function preprocess(fn, schema6) {
|
|
20218
20218
|
return new ZodPreprocess({
|
|
20219
20219
|
type: "pipe",
|
|
20220
20220
|
in: transform(fn),
|
|
20221
|
-
out:
|
|
20221
|
+
out: schema6
|
|
20222
20222
|
});
|
|
20223
20223
|
}
|
|
20224
20224
|
var _installedGroups, ZodType, _ZodString, ZodString, ZodStringFormat, ZodEmail, ZodGUID, ZodUUID, ZodURL, ZodEmoji, ZodNanoID, ZodCUID, ZodCUID2, ZodULID, ZodXID, ZodKSUID, ZodIPv4, ZodMAC, ZodIPv6, ZodCIDRv4, ZodCIDRv6, ZodBase64, ZodBase64URL, ZodE164, ZodJWT, ZodCustomStringFormat, ZodNumber, ZodNumberFormat, ZodBoolean, ZodBigInt, ZodBigIntFormat, ZodSymbol, ZodUndefined, ZodNull, ZodAny, ZodUnknown, ZodNever, ZodVoid, ZodDate, ZodArray, ZodObject, ZodUnion, ZodXor, ZodDiscriminatedUnion, ZodIntersection, ZodTuple, ZodRecord, ZodMap, ZodSet, ZodEnum, ZodLiteral, ZodFile, ZodTransform, ZodOptional, ZodExactOptional, ZodNullable, ZodDefault, ZodPrefault, ZodNonOptional, ZodSuccess, ZodCatch, ZodNaN, ZodPipe, ZodCodec, ZodPreprocess, ZodReadonly, ZodTemplateLiteral, ZodLazy, ZodPromise, ZodFunction, ZodCustom, describe2, meta2, stringbool;
|
|
@@ -21042,8 +21042,8 @@ var init_compat = __esm({
|
|
|
21042
21042
|
});
|
|
21043
21043
|
|
|
21044
21044
|
// ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/from-json-schema.js
|
|
21045
|
-
function detectVersion(
|
|
21046
|
-
const $schema =
|
|
21045
|
+
function detectVersion(schema6, defaultTarget) {
|
|
21046
|
+
const $schema = schema6.$schema;
|
|
21047
21047
|
if ($schema === "https://json-schema.org/draft/2020-12/schema") {
|
|
21048
21048
|
return "draft-2020-12";
|
|
21049
21049
|
}
|
|
@@ -21073,27 +21073,27 @@ function resolveRef(ref, ctx) {
|
|
|
21073
21073
|
}
|
|
21074
21074
|
throw new Error(`Reference not found: ${ref}`);
|
|
21075
21075
|
}
|
|
21076
|
-
function convertBaseSchema(
|
|
21077
|
-
if (
|
|
21078
|
-
if (typeof
|
|
21076
|
+
function convertBaseSchema(schema6, ctx) {
|
|
21077
|
+
if (schema6.not !== void 0) {
|
|
21078
|
+
if (typeof schema6.not === "object" && Object.keys(schema6.not).length === 0) {
|
|
21079
21079
|
return z.never();
|
|
21080
21080
|
}
|
|
21081
21081
|
throw new Error("not is not supported in Zod (except { not: {} } for never)");
|
|
21082
21082
|
}
|
|
21083
|
-
if (
|
|
21083
|
+
if (schema6.unevaluatedItems !== void 0) {
|
|
21084
21084
|
throw new Error("unevaluatedItems is not supported");
|
|
21085
21085
|
}
|
|
21086
|
-
if (
|
|
21086
|
+
if (schema6.unevaluatedProperties !== void 0) {
|
|
21087
21087
|
throw new Error("unevaluatedProperties is not supported");
|
|
21088
21088
|
}
|
|
21089
|
-
if (
|
|
21089
|
+
if (schema6.if !== void 0 || schema6.then !== void 0 || schema6.else !== void 0) {
|
|
21090
21090
|
throw new Error("Conditional schemas (if/then/else) are not supported");
|
|
21091
21091
|
}
|
|
21092
|
-
if (
|
|
21092
|
+
if (schema6.dependentSchemas !== void 0 || schema6.dependentRequired !== void 0) {
|
|
21093
21093
|
throw new Error("dependentSchemas and dependentRequired are not supported");
|
|
21094
21094
|
}
|
|
21095
|
-
if (
|
|
21096
|
-
const refPath =
|
|
21095
|
+
if (schema6.$ref) {
|
|
21096
|
+
const refPath = schema6.$ref;
|
|
21097
21097
|
if (ctx.refs.has(refPath)) {
|
|
21098
21098
|
return ctx.refs.get(refPath);
|
|
21099
21099
|
}
|
|
@@ -21112,9 +21112,9 @@ function convertBaseSchema(schema5, ctx) {
|
|
|
21112
21112
|
ctx.processing.delete(refPath);
|
|
21113
21113
|
return zodSchema2;
|
|
21114
21114
|
}
|
|
21115
|
-
if (
|
|
21116
|
-
const enumValues =
|
|
21117
|
-
if (ctx.version === "openapi-3.0" &&
|
|
21115
|
+
if (schema6.enum !== void 0) {
|
|
21116
|
+
const enumValues = schema6.enum;
|
|
21117
|
+
if (ctx.version === "openapi-3.0" && schema6.nullable === true && enumValues.length === 1 && enumValues[0] === null) {
|
|
21118
21118
|
return z.null();
|
|
21119
21119
|
}
|
|
21120
21120
|
if (enumValues.length === 0) {
|
|
@@ -21132,13 +21132,13 @@ function convertBaseSchema(schema5, ctx) {
|
|
|
21132
21132
|
}
|
|
21133
21133
|
return z.union([literalSchemas[0], literalSchemas[1], ...literalSchemas.slice(2)]);
|
|
21134
21134
|
}
|
|
21135
|
-
if (
|
|
21136
|
-
return z.literal(
|
|
21135
|
+
if (schema6.const !== void 0) {
|
|
21136
|
+
return z.literal(schema6.const);
|
|
21137
21137
|
}
|
|
21138
|
-
const type =
|
|
21138
|
+
const type = schema6.type;
|
|
21139
21139
|
if (Array.isArray(type)) {
|
|
21140
21140
|
const typeSchemas = type.map((t) => {
|
|
21141
|
-
const typeSchema = { ...
|
|
21141
|
+
const typeSchema = { ...schema6, type: t };
|
|
21142
21142
|
return convertBaseSchema(typeSchema, ctx);
|
|
21143
21143
|
});
|
|
21144
21144
|
if (typeSchemas.length === 0) {
|
|
@@ -21156,8 +21156,8 @@ function convertBaseSchema(schema5, ctx) {
|
|
|
21156
21156
|
switch (type) {
|
|
21157
21157
|
case "string": {
|
|
21158
21158
|
let stringSchema = z.string();
|
|
21159
|
-
if (
|
|
21160
|
-
const format3 =
|
|
21159
|
+
if (schema6.format) {
|
|
21160
|
+
const format3 = schema6.format;
|
|
21161
21161
|
if (format3 === "email") {
|
|
21162
21162
|
stringSchema = stringSchema.check(z.email());
|
|
21163
21163
|
} else if (format3 === "uri" || format3 === "uri-reference") {
|
|
@@ -21206,14 +21206,14 @@ function convertBaseSchema(schema5, ctx) {
|
|
|
21206
21206
|
stringSchema = stringSchema.check(z.ksuid());
|
|
21207
21207
|
}
|
|
21208
21208
|
}
|
|
21209
|
-
if (typeof
|
|
21210
|
-
stringSchema = stringSchema.min(
|
|
21209
|
+
if (typeof schema6.minLength === "number") {
|
|
21210
|
+
stringSchema = stringSchema.min(schema6.minLength);
|
|
21211
21211
|
}
|
|
21212
|
-
if (typeof
|
|
21213
|
-
stringSchema = stringSchema.max(
|
|
21212
|
+
if (typeof schema6.maxLength === "number") {
|
|
21213
|
+
stringSchema = stringSchema.max(schema6.maxLength);
|
|
21214
21214
|
}
|
|
21215
|
-
if (
|
|
21216
|
-
stringSchema = stringSchema.regex(new RegExp(
|
|
21215
|
+
if (schema6.pattern) {
|
|
21216
|
+
stringSchema = stringSchema.regex(new RegExp(schema6.pattern));
|
|
21217
21217
|
}
|
|
21218
21218
|
zodSchema = stringSchema;
|
|
21219
21219
|
break;
|
|
@@ -21221,24 +21221,24 @@ function convertBaseSchema(schema5, ctx) {
|
|
|
21221
21221
|
case "number":
|
|
21222
21222
|
case "integer": {
|
|
21223
21223
|
let numberSchema = type === "integer" ? z.number().int() : z.number();
|
|
21224
|
-
if (typeof
|
|
21225
|
-
numberSchema = numberSchema.min(
|
|
21224
|
+
if (typeof schema6.minimum === "number") {
|
|
21225
|
+
numberSchema = numberSchema.min(schema6.minimum);
|
|
21226
21226
|
}
|
|
21227
|
-
if (typeof
|
|
21228
|
-
numberSchema = numberSchema.max(
|
|
21227
|
+
if (typeof schema6.maximum === "number") {
|
|
21228
|
+
numberSchema = numberSchema.max(schema6.maximum);
|
|
21229
21229
|
}
|
|
21230
|
-
if (typeof
|
|
21231
|
-
numberSchema = numberSchema.gt(
|
|
21232
|
-
} else if (
|
|
21233
|
-
numberSchema = numberSchema.gt(
|
|
21230
|
+
if (typeof schema6.exclusiveMinimum === "number") {
|
|
21231
|
+
numberSchema = numberSchema.gt(schema6.exclusiveMinimum);
|
|
21232
|
+
} else if (schema6.exclusiveMinimum === true && typeof schema6.minimum === "number") {
|
|
21233
|
+
numberSchema = numberSchema.gt(schema6.minimum);
|
|
21234
21234
|
}
|
|
21235
|
-
if (typeof
|
|
21236
|
-
numberSchema = numberSchema.lt(
|
|
21237
|
-
} else if (
|
|
21238
|
-
numberSchema = numberSchema.lt(
|
|
21235
|
+
if (typeof schema6.exclusiveMaximum === "number") {
|
|
21236
|
+
numberSchema = numberSchema.lt(schema6.exclusiveMaximum);
|
|
21237
|
+
} else if (schema6.exclusiveMaximum === true && typeof schema6.maximum === "number") {
|
|
21238
|
+
numberSchema = numberSchema.lt(schema6.maximum);
|
|
21239
21239
|
}
|
|
21240
|
-
if (typeof
|
|
21241
|
-
numberSchema = numberSchema.multipleOf(
|
|
21240
|
+
if (typeof schema6.multipleOf === "number") {
|
|
21241
|
+
numberSchema = numberSchema.multipleOf(schema6.multipleOf);
|
|
21242
21242
|
}
|
|
21243
21243
|
zodSchema = numberSchema;
|
|
21244
21244
|
break;
|
|
@@ -21253,15 +21253,15 @@ function convertBaseSchema(schema5, ctx) {
|
|
|
21253
21253
|
}
|
|
21254
21254
|
case "object": {
|
|
21255
21255
|
const shape = {};
|
|
21256
|
-
const properties =
|
|
21257
|
-
const requiredSet = new Set(
|
|
21256
|
+
const properties = schema6.properties || {};
|
|
21257
|
+
const requiredSet = new Set(schema6.required || []);
|
|
21258
21258
|
for (const [key, propSchema] of Object.entries(properties)) {
|
|
21259
21259
|
const propZodSchema = convertSchema(propSchema, ctx);
|
|
21260
21260
|
shape[key] = requiredSet.has(key) ? propZodSchema : propZodSchema.optional();
|
|
21261
21261
|
}
|
|
21262
|
-
if (
|
|
21263
|
-
const keySchema = convertSchema(
|
|
21264
|
-
const valueSchema =
|
|
21262
|
+
if (schema6.propertyNames) {
|
|
21263
|
+
const keySchema = convertSchema(schema6.propertyNames, ctx);
|
|
21264
|
+
const valueSchema = schema6.additionalProperties && typeof schema6.additionalProperties === "object" ? convertSchema(schema6.additionalProperties, ctx) : z.any();
|
|
21265
21265
|
if (Object.keys(shape).length === 0) {
|
|
21266
21266
|
zodSchema = z.record(keySchema, valueSchema);
|
|
21267
21267
|
break;
|
|
@@ -21271,8 +21271,8 @@ function convertBaseSchema(schema5, ctx) {
|
|
|
21271
21271
|
zodSchema = z.intersection(objectSchema2, recordSchema);
|
|
21272
21272
|
break;
|
|
21273
21273
|
}
|
|
21274
|
-
if (
|
|
21275
|
-
const patternProps =
|
|
21274
|
+
if (schema6.patternProperties) {
|
|
21275
|
+
const patternProps = schema6.patternProperties;
|
|
21276
21276
|
const patternKeys = Object.keys(patternProps);
|
|
21277
21277
|
const looseRecords = [];
|
|
21278
21278
|
for (const pattern of patternKeys) {
|
|
@@ -21299,18 +21299,18 @@ function convertBaseSchema(schema5, ctx) {
|
|
|
21299
21299
|
break;
|
|
21300
21300
|
}
|
|
21301
21301
|
const objectSchema = z.object(shape);
|
|
21302
|
-
if (
|
|
21302
|
+
if (schema6.additionalProperties === false) {
|
|
21303
21303
|
zodSchema = objectSchema.strict();
|
|
21304
|
-
} else if (typeof
|
|
21305
|
-
zodSchema = objectSchema.catchall(convertSchema(
|
|
21304
|
+
} else if (typeof schema6.additionalProperties === "object") {
|
|
21305
|
+
zodSchema = objectSchema.catchall(convertSchema(schema6.additionalProperties, ctx));
|
|
21306
21306
|
} else {
|
|
21307
21307
|
zodSchema = objectSchema.passthrough();
|
|
21308
21308
|
}
|
|
21309
21309
|
break;
|
|
21310
21310
|
}
|
|
21311
21311
|
case "array": {
|
|
21312
|
-
const prefixItems =
|
|
21313
|
-
const items =
|
|
21312
|
+
const prefixItems = schema6.prefixItems;
|
|
21313
|
+
const items = schema6.items;
|
|
21314
21314
|
if (prefixItems && Array.isArray(prefixItems)) {
|
|
21315
21315
|
const tupleItems = prefixItems.map((item) => convertSchema(item, ctx));
|
|
21316
21316
|
const rest = items && typeof items === "object" && !Array.isArray(items) ? convertSchema(items, ctx) : void 0;
|
|
@@ -21319,34 +21319,34 @@ function convertBaseSchema(schema5, ctx) {
|
|
|
21319
21319
|
} else {
|
|
21320
21320
|
zodSchema = z.tuple(tupleItems);
|
|
21321
21321
|
}
|
|
21322
|
-
if (typeof
|
|
21323
|
-
zodSchema = zodSchema.check(z.minLength(
|
|
21322
|
+
if (typeof schema6.minItems === "number") {
|
|
21323
|
+
zodSchema = zodSchema.check(z.minLength(schema6.minItems));
|
|
21324
21324
|
}
|
|
21325
|
-
if (typeof
|
|
21326
|
-
zodSchema = zodSchema.check(z.maxLength(
|
|
21325
|
+
if (typeof schema6.maxItems === "number") {
|
|
21326
|
+
zodSchema = zodSchema.check(z.maxLength(schema6.maxItems));
|
|
21327
21327
|
}
|
|
21328
21328
|
} else if (Array.isArray(items)) {
|
|
21329
21329
|
const tupleItems = items.map((item) => convertSchema(item, ctx));
|
|
21330
|
-
const rest =
|
|
21330
|
+
const rest = schema6.additionalItems && typeof schema6.additionalItems === "object" ? convertSchema(schema6.additionalItems, ctx) : void 0;
|
|
21331
21331
|
if (rest) {
|
|
21332
21332
|
zodSchema = z.tuple(tupleItems).rest(rest);
|
|
21333
21333
|
} else {
|
|
21334
21334
|
zodSchema = z.tuple(tupleItems);
|
|
21335
21335
|
}
|
|
21336
|
-
if (typeof
|
|
21337
|
-
zodSchema = zodSchema.check(z.minLength(
|
|
21336
|
+
if (typeof schema6.minItems === "number") {
|
|
21337
|
+
zodSchema = zodSchema.check(z.minLength(schema6.minItems));
|
|
21338
21338
|
}
|
|
21339
|
-
if (typeof
|
|
21340
|
-
zodSchema = zodSchema.check(z.maxLength(
|
|
21339
|
+
if (typeof schema6.maxItems === "number") {
|
|
21340
|
+
zodSchema = zodSchema.check(z.maxLength(schema6.maxItems));
|
|
21341
21341
|
}
|
|
21342
21342
|
} else if (items !== void 0) {
|
|
21343
21343
|
const element = convertSchema(items, ctx);
|
|
21344
21344
|
let arraySchema = z.array(element);
|
|
21345
|
-
if (typeof
|
|
21346
|
-
arraySchema = arraySchema.min(
|
|
21345
|
+
if (typeof schema6.minItems === "number") {
|
|
21346
|
+
arraySchema = arraySchema.min(schema6.minItems);
|
|
21347
21347
|
}
|
|
21348
|
-
if (typeof
|
|
21349
|
-
arraySchema = arraySchema.max(
|
|
21348
|
+
if (typeof schema6.maxItems === "number") {
|
|
21349
|
+
arraySchema = arraySchema.max(schema6.maxItems);
|
|
21350
21350
|
}
|
|
21351
21351
|
zodSchema = arraySchema;
|
|
21352
21352
|
} else {
|
|
@@ -21359,76 +21359,76 @@ function convertBaseSchema(schema5, ctx) {
|
|
|
21359
21359
|
}
|
|
21360
21360
|
return zodSchema;
|
|
21361
21361
|
}
|
|
21362
|
-
function convertSchema(
|
|
21363
|
-
if (typeof
|
|
21364
|
-
return
|
|
21362
|
+
function convertSchema(schema6, ctx) {
|
|
21363
|
+
if (typeof schema6 === "boolean") {
|
|
21364
|
+
return schema6 ? z.any() : z.never();
|
|
21365
21365
|
}
|
|
21366
|
-
let baseSchema = convertBaseSchema(
|
|
21367
|
-
const hasExplicitType =
|
|
21368
|
-
if (
|
|
21369
|
-
const options =
|
|
21366
|
+
let baseSchema = convertBaseSchema(schema6, ctx);
|
|
21367
|
+
const hasExplicitType = schema6.type || schema6.enum !== void 0 || schema6.const !== void 0;
|
|
21368
|
+
if (schema6.anyOf && Array.isArray(schema6.anyOf)) {
|
|
21369
|
+
const options = schema6.anyOf.map((s) => convertSchema(s, ctx));
|
|
21370
21370
|
const anyOfUnion = z.union(options);
|
|
21371
21371
|
baseSchema = hasExplicitType ? z.intersection(baseSchema, anyOfUnion) : anyOfUnion;
|
|
21372
21372
|
}
|
|
21373
|
-
if (
|
|
21374
|
-
const options =
|
|
21373
|
+
if (schema6.oneOf && Array.isArray(schema6.oneOf)) {
|
|
21374
|
+
const options = schema6.oneOf.map((s) => convertSchema(s, ctx));
|
|
21375
21375
|
const oneOfUnion = z.xor(options);
|
|
21376
21376
|
baseSchema = hasExplicitType ? z.intersection(baseSchema, oneOfUnion) : oneOfUnion;
|
|
21377
21377
|
}
|
|
21378
|
-
if (
|
|
21379
|
-
if (
|
|
21378
|
+
if (schema6.allOf && Array.isArray(schema6.allOf)) {
|
|
21379
|
+
if (schema6.allOf.length === 0) {
|
|
21380
21380
|
baseSchema = hasExplicitType ? baseSchema : z.any();
|
|
21381
21381
|
} else {
|
|
21382
|
-
let result2 = hasExplicitType ? baseSchema : convertSchema(
|
|
21382
|
+
let result2 = hasExplicitType ? baseSchema : convertSchema(schema6.allOf[0], ctx);
|
|
21383
21383
|
const startIdx = hasExplicitType ? 0 : 1;
|
|
21384
|
-
for (let i2 = startIdx; i2 <
|
|
21385
|
-
result2 = z.intersection(result2, convertSchema(
|
|
21384
|
+
for (let i2 = startIdx; i2 < schema6.allOf.length; i2++) {
|
|
21385
|
+
result2 = z.intersection(result2, convertSchema(schema6.allOf[i2], ctx));
|
|
21386
21386
|
}
|
|
21387
21387
|
baseSchema = result2;
|
|
21388
21388
|
}
|
|
21389
21389
|
}
|
|
21390
|
-
if (
|
|
21390
|
+
if (schema6.nullable === true && ctx.version === "openapi-3.0") {
|
|
21391
21391
|
baseSchema = z.nullable(baseSchema);
|
|
21392
21392
|
}
|
|
21393
|
-
if (
|
|
21393
|
+
if (schema6.readOnly === true) {
|
|
21394
21394
|
baseSchema = z.readonly(baseSchema);
|
|
21395
21395
|
}
|
|
21396
|
-
if (
|
|
21397
|
-
baseSchema = baseSchema.default(
|
|
21396
|
+
if (schema6.default !== void 0) {
|
|
21397
|
+
baseSchema = baseSchema.default(schema6.default);
|
|
21398
21398
|
}
|
|
21399
21399
|
const extraMeta = {};
|
|
21400
21400
|
const coreMetadataKeys = ["$id", "id", "$comment", "$anchor", "$vocabulary", "$dynamicRef", "$dynamicAnchor"];
|
|
21401
21401
|
for (const key of coreMetadataKeys) {
|
|
21402
|
-
if (key in
|
|
21403
|
-
extraMeta[key] =
|
|
21402
|
+
if (key in schema6) {
|
|
21403
|
+
extraMeta[key] = schema6[key];
|
|
21404
21404
|
}
|
|
21405
21405
|
}
|
|
21406
21406
|
const contentMetadataKeys = ["contentEncoding", "contentMediaType", "contentSchema"];
|
|
21407
21407
|
for (const key of contentMetadataKeys) {
|
|
21408
|
-
if (key in
|
|
21409
|
-
extraMeta[key] =
|
|
21408
|
+
if (key in schema6) {
|
|
21409
|
+
extraMeta[key] = schema6[key];
|
|
21410
21410
|
}
|
|
21411
21411
|
}
|
|
21412
|
-
for (const key of Object.keys(
|
|
21412
|
+
for (const key of Object.keys(schema6)) {
|
|
21413
21413
|
if (!RECOGNIZED_KEYS.has(key)) {
|
|
21414
|
-
extraMeta[key] =
|
|
21414
|
+
extraMeta[key] = schema6[key];
|
|
21415
21415
|
}
|
|
21416
21416
|
}
|
|
21417
21417
|
if (Object.keys(extraMeta).length > 0) {
|
|
21418
21418
|
ctx.registry.add(baseSchema, extraMeta);
|
|
21419
21419
|
}
|
|
21420
|
-
if (
|
|
21421
|
-
baseSchema = baseSchema.describe(
|
|
21420
|
+
if (schema6.description) {
|
|
21421
|
+
baseSchema = baseSchema.describe(schema6.description);
|
|
21422
21422
|
}
|
|
21423
21423
|
return baseSchema;
|
|
21424
21424
|
}
|
|
21425
|
-
function fromJSONSchema(
|
|
21426
|
-
if (typeof
|
|
21427
|
-
return
|
|
21425
|
+
function fromJSONSchema(schema6, params) {
|
|
21426
|
+
if (typeof schema6 === "boolean") {
|
|
21427
|
+
return schema6 ? z.any() : z.never();
|
|
21428
21428
|
}
|
|
21429
21429
|
let normalized;
|
|
21430
21430
|
try {
|
|
21431
|
-
normalized = JSON.parse(JSON.stringify(
|
|
21431
|
+
normalized = JSON.parse(JSON.stringify(schema6));
|
|
21432
21432
|
} catch {
|
|
21433
21433
|
throw new Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas");
|
|
21434
21434
|
}
|
|
@@ -22263,6 +22263,33 @@ var init_skill_protocol = __esm({
|
|
|
22263
22263
|
factoryFirstBlock: "96438471",
|
|
22264
22264
|
confirmations: 2
|
|
22265
22265
|
}
|
|
22266
|
+
},
|
|
22267
|
+
"1776": {
|
|
22268
|
+
enabled: true,
|
|
22269
|
+
network: {
|
|
22270
|
+
chainId: 1776,
|
|
22271
|
+
name: "Injective",
|
|
22272
|
+
explorerUrl: "https://blockscout.injective.network",
|
|
22273
|
+
defaultRpcUrls: [
|
|
22274
|
+
"https://sentry.evm-rpc.injective.network"
|
|
22275
|
+
]
|
|
22276
|
+
},
|
|
22277
|
+
sourceRepository: "FinchipAI/finchip-protocol",
|
|
22278
|
+
sourceCommit: "fcaa22761169b1e45aca5ea783d2315341c243a5",
|
|
22279
|
+
abiSourceCommit: "61982867d271ea9ebf0730b1a650bee1b9894642",
|
|
22280
|
+
contracts: {
|
|
22281
|
+
skillToken: "0x7ed98f8d72a447483446f28a973288d3301863cc",
|
|
22282
|
+
revenueRight: "0x6e8360b46225f40ecd66ef7c2b7fbfa4fa72dc82",
|
|
22283
|
+
skillInstance: "0xad8999ae8a63fc30dac591dc613105dccbb74c99",
|
|
22284
|
+
skillFactory: "0x6a82c248ffa66b064e3ddd913aa3be18e292a5ee",
|
|
22285
|
+
skillMarket: "0xa21716201931de0744230a58b58f48b94462ed8c",
|
|
22286
|
+
feeRouter: "0x5f3ecf942953e7acbce0b9b49b2ff7e159921de9"
|
|
22287
|
+
},
|
|
22288
|
+
deployment: {
|
|
22289
|
+
firstBlock: "187103028",
|
|
22290
|
+
factoryFirstBlock: "187103063",
|
|
22291
|
+
confirmations: 2
|
|
22292
|
+
}
|
|
22266
22293
|
}
|
|
22267
22294
|
}
|
|
22268
22295
|
}
|
|
@@ -22285,6 +22312,7 @@ var init_task_protocol = __esm({
|
|
|
22285
22312
|
chains: {
|
|
22286
22313
|
"84532": {
|
|
22287
22314
|
enabled: true,
|
|
22315
|
+
creationOpen: true,
|
|
22288
22316
|
network: {
|
|
22289
22317
|
chainId: 84532,
|
|
22290
22318
|
name: "Base Sepolia",
|
|
@@ -22330,6 +22358,7 @@ var init_task_protocol = __esm({
|
|
|
22330
22358
|
chains: {
|
|
22331
22359
|
"8453": {
|
|
22332
22360
|
enabled: true,
|
|
22361
|
+
creationOpen: true,
|
|
22333
22362
|
network: {
|
|
22334
22363
|
chainId: 8453,
|
|
22335
22364
|
name: "Base",
|
|
@@ -22370,6 +22399,7 @@ var init_task_protocol = __esm({
|
|
|
22370
22399
|
},
|
|
22371
22400
|
"1776": {
|
|
22372
22401
|
enabled: true,
|
|
22402
|
+
creationOpen: false,
|
|
22373
22403
|
network: {
|
|
22374
22404
|
chainId: 1776,
|
|
22375
22405
|
name: "Injective",
|
|
@@ -22422,12 +22452,12 @@ function resolveSkillProtocolEnvironment(raw) {
|
|
|
22422
22452
|
`FINCH_ENVIRONMENT must explicitly be local, test, or production; received ${received}.`
|
|
22423
22453
|
);
|
|
22424
22454
|
}
|
|
22425
|
-
function parseTypedRegistry(
|
|
22426
|
-
const
|
|
22427
|
-
if (!
|
|
22428
|
-
throw new DeploymentManifestError(`Invalid chain deployment manifest: ${external_exports.prettifyError(
|
|
22455
|
+
function parseTypedRegistry(schema6, value) {
|
|
22456
|
+
const parsed3 = schema6.safeParse(value);
|
|
22457
|
+
if (!parsed3.success) {
|
|
22458
|
+
throw new DeploymentManifestError(`Invalid chain deployment manifest: ${external_exports.prettifyError(parsed3.error)}`);
|
|
22429
22459
|
}
|
|
22430
|
-
return
|
|
22460
|
+
return parsed3.data;
|
|
22431
22461
|
}
|
|
22432
22462
|
function clientDeploymentsByChain(protocol, deployments) {
|
|
22433
22463
|
const byChain = {};
|
|
@@ -22528,7 +22558,8 @@ function getTaskProtocolDeployment(environment3, chainId) {
|
|
|
22528
22558
|
paymentTokenDecimals: value.policy.paymentTokenDecimals,
|
|
22529
22559
|
expectedAwardAttestorAddress: value.authority.awardAttestor,
|
|
22530
22560
|
expectedCreditGranterAddress: value.authority.creditGranter ?? null,
|
|
22531
|
-
defaultRpcUrls: Object.freeze([...value.network.defaultRpcUrls])
|
|
22561
|
+
defaultRpcUrls: Object.freeze([...value.network.defaultRpcUrls]),
|
|
22562
|
+
creationOpen: value.creationOpen
|
|
22532
22563
|
});
|
|
22533
22564
|
}
|
|
22534
22565
|
function getTaskProtocolDeploymentByChainId(chainId) {
|
|
@@ -22717,6 +22748,14 @@ var init_chains = __esm({
|
|
|
22717
22748
|
});
|
|
22718
22749
|
taskActiveSchema = external_exports.strictObject({
|
|
22719
22750
|
enabled: external_exports.literal(true),
|
|
22751
|
+
/**
|
|
22752
|
+
* Whether publishers may create new Tasks on this chain. A chain can be
|
|
22753
|
+
* deployed and reviewed — drafts, reads, and settlement stay resolvable —
|
|
22754
|
+
* while creation stays closed because its treasury, gas funding, or RPC
|
|
22755
|
+
* retention is not production-ready. Opening a chain is a one-line manifest
|
|
22756
|
+
* review, never a UI edit.
|
|
22757
|
+
*/
|
|
22758
|
+
creationOpen: external_exports.boolean(),
|
|
22720
22759
|
network: networkSchema,
|
|
22721
22760
|
...sourceSchema,
|
|
22722
22761
|
abiSourceCommit: commitSchema,
|
|
@@ -22877,6 +22916,7 @@ var init_chains = __esm({
|
|
|
22877
22916
|
8453: "production",
|
|
22878
22917
|
42161: "production",
|
|
22879
22918
|
43114: "production",
|
|
22919
|
+
1776: "production",
|
|
22880
22920
|
84532: "test"
|
|
22881
22921
|
});
|
|
22882
22922
|
REVIEWED_NETWORKS = Object.freeze({
|
|
@@ -22919,6 +22959,57 @@ var init_dashboard_prices2 = __esm({
|
|
|
22919
22959
|
}
|
|
22920
22960
|
});
|
|
22921
22961
|
|
|
22962
|
+
// ../../packages/deployment-manifest/src/platform/sales-inquiries.json
|
|
22963
|
+
var sales_inquiries_default;
|
|
22964
|
+
var init_sales_inquiries = __esm({
|
|
22965
|
+
"../../packages/deployment-manifest/src/platform/sales-inquiries.json"() {
|
|
22966
|
+
sales_inquiries_default = {
|
|
22967
|
+
schemaVersion: 1,
|
|
22968
|
+
kind: "sales_inquiries",
|
|
22969
|
+
environments: {
|
|
22970
|
+
local: {
|
|
22971
|
+
enabled: false,
|
|
22972
|
+
ipHourlyLimit: 5,
|
|
22973
|
+
emailDailyLimit: 10,
|
|
22974
|
+
emailFrom: "Finch <notifications@notify.finchtech.ai>",
|
|
22975
|
+
emailReplyTo: "customersupport@finchtech.ai",
|
|
22976
|
+
opsOrigin: "http://localhost:3002"
|
|
22977
|
+
},
|
|
22978
|
+
test: {
|
|
22979
|
+
enabled: true,
|
|
22980
|
+
ipHourlyLimit: 5,
|
|
22981
|
+
emailDailyLimit: 10,
|
|
22982
|
+
emailFrom: "Finch <notifications@notify.finchtech.ai>",
|
|
22983
|
+
emailReplyTo: "customersupport@finchtech.ai",
|
|
22984
|
+
opsOrigin: "https://finch-ops-git-staging-fin-chip-team.vercel.app"
|
|
22985
|
+
},
|
|
22986
|
+
production: {
|
|
22987
|
+
enabled: false,
|
|
22988
|
+
ipHourlyLimit: 5,
|
|
22989
|
+
emailDailyLimit: 10,
|
|
22990
|
+
emailFrom: "Finch <notifications@notify.finchtech.ai>",
|
|
22991
|
+
emailReplyTo: "customersupport@finchtech.ai",
|
|
22992
|
+
opsOrigin: "https://ops.finchtech.ai"
|
|
22993
|
+
}
|
|
22994
|
+
}
|
|
22995
|
+
};
|
|
22996
|
+
}
|
|
22997
|
+
});
|
|
22998
|
+
|
|
22999
|
+
// ../../packages/deployment-manifest/src/platform/sales-inquiries.ts
|
|
23000
|
+
var policy, schema, parseSalesInquiryManifest, parsed;
|
|
23001
|
+
var init_sales_inquiries2 = __esm({
|
|
23002
|
+
"../../packages/deployment-manifest/src/platform/sales-inquiries.ts"() {
|
|
23003
|
+
"use strict";
|
|
23004
|
+
init_zod();
|
|
23005
|
+
init_sales_inquiries();
|
|
23006
|
+
policy = external_exports.strictObject({ enabled: external_exports.boolean(), ipHourlyLimit: external_exports.number().int().min(1).max(100), emailDailyLimit: external_exports.number().int().min(1).max(100), emailFrom: external_exports.string().regex(/^Finch <[^<>\r\n]+>$/u).refine((value) => external_exports.email().safeParse(value.slice(7, -1)).success), emailReplyTo: external_exports.email(), opsOrigin: external_exports.url() });
|
|
23007
|
+
schema = external_exports.strictObject({ schemaVersion: external_exports.literal(1), kind: external_exports.literal("sales_inquiries"), environments: external_exports.strictObject({ local: policy, test: policy, production: policy }) });
|
|
23008
|
+
parseSalesInquiryManifest = (value) => schema.parse(value);
|
|
23009
|
+
parsed = parseSalesInquiryManifest(sales_inquiries_default);
|
|
23010
|
+
}
|
|
23011
|
+
});
|
|
23012
|
+
|
|
22922
23013
|
// ../../packages/deployment-manifest/src/platform/get-help.json
|
|
22923
23014
|
var get_help_default;
|
|
22924
23015
|
var init_get_help = __esm({
|
|
@@ -22936,25 +23027,25 @@ var init_get_help = __esm({
|
|
|
22936
23027
|
});
|
|
22937
23028
|
|
|
22938
23029
|
// ../../packages/deployment-manifest/src/platform/get-help.ts
|
|
22939
|
-
var
|
|
23030
|
+
var policy2, schema2, parseGetHelpManifest, parsed2;
|
|
22940
23031
|
var init_get_help2 = __esm({
|
|
22941
23032
|
"../../packages/deployment-manifest/src/platform/get-help.ts"() {
|
|
22942
23033
|
"use strict";
|
|
22943
23034
|
init_zod();
|
|
22944
23035
|
init_get_help();
|
|
22945
|
-
|
|
23036
|
+
policy2 = external_exports.strictObject({
|
|
22946
23037
|
enabled: external_exports.boolean(),
|
|
22947
23038
|
ipHourlyLimit: external_exports.number().int().min(1).max(100),
|
|
22948
23039
|
emailDailyLimit: external_exports.number().int().min(1).max(100),
|
|
22949
23040
|
dailyUploadBytes: external_exports.number().int().min(2097152).max(1073741824)
|
|
22950
23041
|
});
|
|
22951
|
-
|
|
23042
|
+
schema2 = external_exports.strictObject({
|
|
22952
23043
|
schemaVersion: external_exports.literal(1),
|
|
22953
23044
|
kind: external_exports.literal("get_help"),
|
|
22954
|
-
environments: external_exports.strictObject({ local:
|
|
23045
|
+
environments: external_exports.strictObject({ local: policy2, test: policy2, production: policy2 })
|
|
22955
23046
|
});
|
|
22956
|
-
parseGetHelpManifest = (value) =>
|
|
22957
|
-
|
|
23047
|
+
parseGetHelpManifest = (value) => schema2.parse(value);
|
|
23048
|
+
parsed2 = parseGetHelpManifest(get_help_default);
|
|
22958
23049
|
}
|
|
22959
23050
|
});
|
|
22960
23051
|
|
|
@@ -22985,9 +23076,9 @@ var init_passkey_safe = __esm({
|
|
|
22985
23076
|
|
|
22986
23077
|
// ../../packages/deployment-manifest/src/platform/passkey-safe.ts
|
|
22987
23078
|
function parsePasskeySafeManifest(input) {
|
|
22988
|
-
return
|
|
23079
|
+
return schema3.parse(input);
|
|
22989
23080
|
}
|
|
22990
|
-
var disabled, enabled,
|
|
23081
|
+
var disabled, enabled, schema3, manifest2;
|
|
22991
23082
|
var init_passkey_safe2 = __esm({
|
|
22992
23083
|
"../../packages/deployment-manifest/src/platform/passkey-safe.ts"() {
|
|
22993
23084
|
"use strict";
|
|
@@ -23004,7 +23095,7 @@ var init_passkey_safe2 = __esm({
|
|
|
23004
23095
|
minimumGasWei: external_exports.string().regex(/^[1-9][0-9]*$/),
|
|
23005
23096
|
maxGasPerTransaction: external_exports.string().regex(/^[1-9][0-9]*$/)
|
|
23006
23097
|
});
|
|
23007
|
-
|
|
23098
|
+
schema3 = external_exports.strictObject({
|
|
23008
23099
|
schemaVersion: external_exports.literal(1),
|
|
23009
23100
|
kind: external_exports.literal("passkey_safe"),
|
|
23010
23101
|
environments: external_exports.strictObject({
|
|
@@ -23180,6 +23271,15 @@ var init_skill_delivery = __esm({
|
|
|
23180
23271
|
pkpId: "0xdf87a5d625926cedc0ad0ef74888adb643936f25",
|
|
23181
23272
|
groupId: 1
|
|
23182
23273
|
}
|
|
23274
|
+
},
|
|
23275
|
+
"1776": {
|
|
23276
|
+
chainId: 1776,
|
|
23277
|
+
chainTag: "injective",
|
|
23278
|
+
lit: {
|
|
23279
|
+
provider: "chipotle",
|
|
23280
|
+
pkpId: "0xdf87a5d625926cedc0ad0ef74888adb643936f25",
|
|
23281
|
+
groupId: 1
|
|
23282
|
+
}
|
|
23183
23283
|
}
|
|
23184
23284
|
}
|
|
23185
23285
|
}
|
|
@@ -23270,9 +23370,9 @@ var init_agenton_payout = __esm({
|
|
|
23270
23370
|
|
|
23271
23371
|
// ../../packages/deployment-manifest/src/platform/agenton-payout.ts
|
|
23272
23372
|
function parseAgentonPayoutManifest(input) {
|
|
23273
|
-
return
|
|
23373
|
+
return schema4.parse(input);
|
|
23274
23374
|
}
|
|
23275
|
-
var origin, environment,
|
|
23375
|
+
var origin, environment, schema4, manifest3;
|
|
23276
23376
|
var init_agenton_payout2 = __esm({
|
|
23277
23377
|
"../../packages/deployment-manifest/src/platform/agenton-payout.ts"() {
|
|
23278
23378
|
"use strict";
|
|
@@ -23283,7 +23383,7 @@ var init_agenton_payout2 = __esm({
|
|
|
23283
23383
|
return url2.protocol === "https:" && url2.origin === value && !url2.username && !url2.password;
|
|
23284
23384
|
});
|
|
23285
23385
|
environment = external_exports.strictObject({ enabled: external_exports.boolean(), mandateId: external_exports.string().min(1).nullable() });
|
|
23286
|
-
|
|
23386
|
+
schema4 = external_exports.strictObject({
|
|
23287
23387
|
schemaVersion: external_exports.literal(1),
|
|
23288
23388
|
kind: external_exports.literal("agenton_payout"),
|
|
23289
23389
|
agentIdBaseUrl: origin,
|
|
@@ -23322,22 +23422,22 @@ var init_merchant_avatar_video = __esm({
|
|
|
23322
23422
|
|
|
23323
23423
|
// ../../packages/deployment-manifest/src/platform/merchant-avatar-video.ts
|
|
23324
23424
|
function parseMerchantAvatarVideoManifest(input) {
|
|
23325
|
-
return
|
|
23425
|
+
return schema5.parse(input);
|
|
23326
23426
|
}
|
|
23327
|
-
var
|
|
23427
|
+
var policy3, schema5, manifest4;
|
|
23328
23428
|
var init_merchant_avatar_video2 = __esm({
|
|
23329
23429
|
"../../packages/deployment-manifest/src/platform/merchant-avatar-video.ts"() {
|
|
23330
23430
|
"use strict";
|
|
23331
23431
|
init_zod();
|
|
23332
23432
|
init_merchant_avatar_video();
|
|
23333
|
-
|
|
23433
|
+
policy3 = external_exports.discriminatedUnion("enabled", [
|
|
23334
23434
|
external_exports.strictObject({ enabled: external_exports.literal(false) }),
|
|
23335
23435
|
external_exports.strictObject({ enabled: external_exports.literal(true), offerId: external_exports.uuid(), dailyLimit: external_exports.number().int().min(1).max(1e4) })
|
|
23336
23436
|
]);
|
|
23337
|
-
|
|
23437
|
+
schema5 = external_exports.strictObject({
|
|
23338
23438
|
schemaVersion: external_exports.literal(1),
|
|
23339
23439
|
kind: external_exports.literal("merchant_avatar_video"),
|
|
23340
|
-
environments: external_exports.strictObject({ local:
|
|
23440
|
+
environments: external_exports.strictObject({ local: policy3, test: policy3, production: policy3 })
|
|
23341
23441
|
});
|
|
23342
23442
|
manifest4 = parseMerchantAvatarVideoManifest(merchant_avatar_video_default);
|
|
23343
23443
|
}
|
|
@@ -23357,26 +23457,26 @@ var init_generator = __esm({
|
|
|
23357
23457
|
});
|
|
23358
23458
|
|
|
23359
23459
|
// ../../packages/deployment-manifest/src/platform/generator.ts
|
|
23360
|
-
var
|
|
23460
|
+
var policy4, manifest5;
|
|
23361
23461
|
var init_generator2 = __esm({
|
|
23362
23462
|
"../../packages/deployment-manifest/src/platform/generator.ts"() {
|
|
23363
23463
|
"use strict";
|
|
23364
23464
|
init_zod();
|
|
23365
23465
|
init_generator();
|
|
23366
|
-
|
|
23367
|
-
manifest5 = external_exports.strictObject({ schemaVersion: external_exports.literal(1), kind: external_exports.literal("generator"), provider: external_exports.strictObject({ endpoint: external_exports.literal("https://api.tokenrouter.com/v1"), model: external_exports.literal("openai/gpt-6-luna") }), environments: external_exports.strictObject({ local:
|
|
23466
|
+
policy4 = external_exports.strictObject({ enabled: external_exports.boolean() });
|
|
23467
|
+
manifest5 = external_exports.strictObject({ schemaVersion: external_exports.literal(1), kind: external_exports.literal("generator"), provider: external_exports.strictObject({ endpoint: external_exports.literal("https://api.tokenrouter.com/v1"), model: external_exports.literal("openai/gpt-6-luna") }), environments: external_exports.strictObject({ local: policy4, test: policy4, production: policy4 }) }).parse(generator_default);
|
|
23368
23468
|
}
|
|
23369
23469
|
});
|
|
23370
23470
|
|
|
23371
23471
|
// ../../packages/deployment-manifest/src/platform/index.ts
|
|
23372
|
-
function parseManifest(label,
|
|
23373
|
-
const
|
|
23374
|
-
if (!
|
|
23472
|
+
function parseManifest(label, schema6, value) {
|
|
23473
|
+
const parsed3 = schema6.safeParse(value);
|
|
23474
|
+
if (!parsed3.success) {
|
|
23375
23475
|
throw new DeploymentManifestError(
|
|
23376
|
-
`Invalid ${label} deployment manifest: ${external_exports.prettifyError(
|
|
23476
|
+
`Invalid ${label} deployment manifest: ${external_exports.prettifyError(parsed3.error)}`
|
|
23377
23477
|
);
|
|
23378
23478
|
}
|
|
23379
|
-
return
|
|
23479
|
+
return parsed3.data;
|
|
23380
23480
|
}
|
|
23381
23481
|
function parseInternalAppsManifest(value) {
|
|
23382
23482
|
return parseManifest("internal-apps", internalAppsManifestSchema, value);
|
|
@@ -23405,7 +23505,7 @@ function getSkillDeliveryDeployment(environment3, chainId) {
|
|
|
23405
23505
|
});
|
|
23406
23506
|
}
|
|
23407
23507
|
function getSkillDeliveryDeploymentByChainId(chainId) {
|
|
23408
|
-
const environment3 = chainId === 84532 ? "test" : [1, 10, 56, 8453, 42161, 43114].includes(chainId) ? "production" : void 0;
|
|
23508
|
+
const environment3 = chainId === 84532 ? "test" : [1, 10, 56, 8453, 42161, 43114, 1776].includes(chainId) ? "production" : void 0;
|
|
23409
23509
|
if (!environment3) throw new DeploymentManifestError(`Skill delivery has no reviewed binding for chain ${chainId}.`);
|
|
23410
23510
|
return getSkillDeliveryDeployment(environment3, chainId);
|
|
23411
23511
|
}
|
|
@@ -23415,6 +23515,7 @@ var init_platform = __esm({
|
|
|
23415
23515
|
"use strict";
|
|
23416
23516
|
init_zod();
|
|
23417
23517
|
init_dashboard_prices2();
|
|
23518
|
+
init_sales_inquiries2();
|
|
23418
23519
|
init_get_help2();
|
|
23419
23520
|
init_passkey_safe2();
|
|
23420
23521
|
init_web_analytics();
|
|
@@ -23495,7 +23596,7 @@ var init_platform = __esm({
|
|
|
23495
23596
|
});
|
|
23496
23597
|
skillDeliveryBindingSchema = external_exports.strictObject({
|
|
23497
23598
|
chainId: external_exports.number().int().positive(),
|
|
23498
|
-
chainTag: external_exports.enum(["base", "baseSepolia", "ethereum", "optimism", "bsc", "arbitrum", "avalanche"]),
|
|
23599
|
+
chainTag: external_exports.enum(["base", "baseSepolia", "ethereum", "optimism", "bsc", "arbitrum", "avalanche", "injective"]),
|
|
23499
23600
|
lit: external_exports.strictObject({
|
|
23500
23601
|
provider: external_exports.literal("chipotle"),
|
|
23501
23602
|
pkpId: external_exports.string().min(1).max(512),
|
|
@@ -23581,6 +23682,52 @@ var init_public = __esm({
|
|
|
23581
23682
|
}
|
|
23582
23683
|
});
|
|
23583
23684
|
|
|
23685
|
+
// ../../packages/skill-market-contracts/src/publication-state.ts
|
|
23686
|
+
async function readSkillPublicationState(reader, input) {
|
|
23687
|
+
const { request: request2 } = input;
|
|
23688
|
+
if (!["createSkill", "updateSkill", "setSkillURI", "setLitData"].includes(String(request2.action)) || !/^0x[0-9a-fA-F]{40}$/u.test(input.walletAddress) || !/^0x[0-9a-fA-F]{64}$/u.test(input.packageHash) || !Number.isSafeInteger(input.targetVersion) || input.targetVersion < 1) throw new TypeError("Invalid Skill publication authority.");
|
|
23689
|
+
const blockNumber2 = await reader.blockNumber();
|
|
23690
|
+
if (blockNumber2 < BigInt(1)) throw new TypeError("Skill RPC has no confirmed publication block.");
|
|
23691
|
+
const read2 = (functionName, args, contract = "token") => reader.read({ contract, functionName, args, blockNumber: blockNumber2 });
|
|
23692
|
+
const id = request2.action === "createSkill" ? await read2("skillIdBySlug", [request2.slug]) : BigInt(String(request2.skillId));
|
|
23693
|
+
if (typeof id !== "bigint" || id < BigInt(0)) throw new TypeError("Invalid on-chain Skill id.");
|
|
23694
|
+
const result2 = (completed) => ({ completed, skillId: id === BigInt(0) ? null : id.toString(), blockNumber: blockNumber2.toString() });
|
|
23695
|
+
if (id === BigInt(0)) return result2(false);
|
|
23696
|
+
const owner = await read2("ownerOf", [id]);
|
|
23697
|
+
if (typeof owner !== "string" || !/^0x[0-9a-fA-F]{40}$/u.test(owner)) throw new TypeError("Invalid on-chain Skill owner.");
|
|
23698
|
+
if (owner.toLowerCase() !== input.walletAddress.toLowerCase()) throw new SkillPublicationConflictError(
|
|
23699
|
+
request2.action === "createSkill" ? "SLUG_TAKEN" : "PUBLICATION_CONFLICT",
|
|
23700
|
+
request2.action === "createSkill" ? "This Skill slug is already occupied by another wallet." : "This Skill no longer belongs to the signing wallet."
|
|
23701
|
+
);
|
|
23702
|
+
const binding = await read2("skillOf", [id]);
|
|
23703
|
+
if (!binding || typeof binding !== "object" || !("version" in binding) || !("packageHash" in binding) || typeof binding.version !== "bigint" || typeof binding.packageHash !== "string" || !/^0x[0-9a-fA-F]{64}$/u.test(binding.packageHash)) throw new TypeError("Invalid on-chain Skill binding.");
|
|
23704
|
+
const matches = binding.version === BigInt(input.targetVersion) && binding.packageHash.toLowerCase() === input.packageHash.toLowerCase();
|
|
23705
|
+
if (!matches) {
|
|
23706
|
+
if (request2.action === "updateSkill" && binding.version === BigInt(input.targetVersion - 1)) return result2(false);
|
|
23707
|
+
throw new SkillPublicationConflictError("PUBLICATION_CONFLICT", "On-chain Skill content no longer matches this publication plan.");
|
|
23708
|
+
}
|
|
23709
|
+
if (request2.action === "setSkillURI") return result2(await read2("skillURI", [id]) === request2.packageURI);
|
|
23710
|
+
if (request2.action === "setLitData") {
|
|
23711
|
+
const set2 = await read2("litDataSet", [id, BigInt(input.targetVersion)], "instance");
|
|
23712
|
+
if (typeof set2 !== "boolean") throw new TypeError("Invalid on-chain Skill key state.");
|
|
23713
|
+
return result2(set2);
|
|
23714
|
+
}
|
|
23715
|
+
return result2(true);
|
|
23716
|
+
}
|
|
23717
|
+
var SkillPublicationConflictError;
|
|
23718
|
+
var init_publication_state = __esm({
|
|
23719
|
+
"../../packages/skill-market-contracts/src/publication-state.ts"() {
|
|
23720
|
+
"use strict";
|
|
23721
|
+
SkillPublicationConflictError = class extends Error {
|
|
23722
|
+
constructor(code, message) {
|
|
23723
|
+
super(message);
|
|
23724
|
+
this.code = code;
|
|
23725
|
+
}
|
|
23726
|
+
code;
|
|
23727
|
+
};
|
|
23728
|
+
}
|
|
23729
|
+
});
|
|
23730
|
+
|
|
23584
23731
|
// ../../packages/skill-market-contracts/src/client.ts
|
|
23585
23732
|
function skillV3SourceCommit(chainId) {
|
|
23586
23733
|
return getSkillProtocolDeploymentByChainId(chainId).sourceCommit;
|
|
@@ -23612,6 +23759,7 @@ var init_client = __esm({
|
|
|
23612
23759
|
init_common();
|
|
23613
23760
|
init_public();
|
|
23614
23761
|
init_cli_signing();
|
|
23762
|
+
init_publication_state();
|
|
23615
23763
|
SKILL_V3_CHAIN_IDS = getAllSkillProtocolChainIds();
|
|
23616
23764
|
SKILL_V3_DEPLOYMENTS = Object.freeze(SKILL_V3_CHAIN_IDS.map((chainId) => {
|
|
23617
23765
|
const deployment = getSkillProtocolDeploymentByChainId(chainId);
|
|
@@ -24243,7 +24391,7 @@ function localFailureMessage(error51) {
|
|
|
24243
24391
|
if (publicInputMessages.includes(error51.message)) return error51.message;
|
|
24244
24392
|
return "Command input does not match the expected schema. Check finch help for this command.";
|
|
24245
24393
|
}
|
|
24246
|
-
var CliAuthorityError, CliProductionUnavailableError, BrowserOpenError, MCP_AUTHORIZATION_FLOW_GUIDANCE, McpAuthorizationFlowError, CliUsageError, CLI_SESSION_RENEWAL_GUIDANCE, CliSkillSourceError, CliSkillPresentationStaleError,
|
|
24394
|
+
var CliAuthorityError, CliProductionUnavailableError, BrowserOpenError, MCP_AUTHORIZATION_FLOW_GUIDANCE, McpAuthorizationFlowError, CliUsageError, CLI_SESSION_RENEWAL_GUIDANCE, CliSkillSourceError, CliSkillPresentationStaleError, CliSkillPublicationError, SkillPublicationTransactionFailedError;
|
|
24247
24395
|
var init_cli_error = __esm({
|
|
24248
24396
|
"src/cli-error.ts"() {
|
|
24249
24397
|
"use strict";
|
|
@@ -24322,14 +24470,6 @@ var init_cli_error = __esm({
|
|
|
24322
24470
|
planVersion;
|
|
24323
24471
|
liveVersion;
|
|
24324
24472
|
};
|
|
24325
|
-
CliSkillRecoveryUncertainError = class extends Error {
|
|
24326
|
-
constructor(detail) {
|
|
24327
|
-
super(`Skill recovery stage ${detail.stage} has no receipt and a ${detail.marker} pre-send marker in a version ${detail.journalVersion} journal.`);
|
|
24328
|
-
this.detail = detail;
|
|
24329
|
-
this.name = "CliSkillRecoveryUncertainError";
|
|
24330
|
-
}
|
|
24331
|
-
detail;
|
|
24332
|
-
};
|
|
24333
24473
|
CliSkillPublicationError = class extends Error {
|
|
24334
24474
|
constructor(diagnostic, cause) {
|
|
24335
24475
|
super(cause instanceof Error ? cause.message : "Skill publication failed.", { cause });
|
|
@@ -24338,6 +24478,12 @@ var init_cli_error = __esm({
|
|
|
24338
24478
|
}
|
|
24339
24479
|
diagnostic;
|
|
24340
24480
|
};
|
|
24481
|
+
SkillPublicationTransactionFailedError = class extends Error {
|
|
24482
|
+
constructor() {
|
|
24483
|
+
super("Skill publication transaction reverted; retry the same publication command.");
|
|
24484
|
+
this.name = "SkillPublicationTransactionFailedError";
|
|
24485
|
+
}
|
|
24486
|
+
};
|
|
24341
24487
|
}
|
|
24342
24488
|
});
|
|
24343
24489
|
|
|
@@ -29687,6 +29833,64 @@ var init_credentials = __esm({
|
|
|
29687
29833
|
}
|
|
29688
29834
|
});
|
|
29689
29835
|
|
|
29836
|
+
// ../../packages/agent-market-contracts/src/v1/diagnostics.ts
|
|
29837
|
+
function safeFailureDiagnostic(cause) {
|
|
29838
|
+
let category = "unexpected";
|
|
29839
|
+
let errorType = "NonErrorFailure";
|
|
29840
|
+
let transportCode = null;
|
|
29841
|
+
let sqlState = null;
|
|
29842
|
+
let httpStatus = null;
|
|
29843
|
+
let rpcMethod = null;
|
|
29844
|
+
const seen = /* @__PURE__ */ new Set();
|
|
29845
|
+
let current = cause;
|
|
29846
|
+
for (let depth = 0; depth < 8 && current !== null && typeof current === "object" && !seen.has(current); depth++) {
|
|
29847
|
+
seen.add(current);
|
|
29848
|
+
const value = current;
|
|
29849
|
+
if (typeof value.name === "string" && [
|
|
29850
|
+
"Error",
|
|
29851
|
+
"TypeError",
|
|
29852
|
+
"SyntaxError",
|
|
29853
|
+
"AbortError",
|
|
29854
|
+
"TimeoutError",
|
|
29855
|
+
"HttpRequestError",
|
|
29856
|
+
"RpcRequestError",
|
|
29857
|
+
"TransactionExecutionError",
|
|
29858
|
+
"ContractFunctionExecutionError",
|
|
29859
|
+
"ContractFunctionRevertedError",
|
|
29860
|
+
"WaitForTransactionReceiptTimeoutError"
|
|
29861
|
+
].includes(value.name)) errorType = value.name;
|
|
29862
|
+
if (typeof value.code === "string" && /^(?:E(?:CONNRESET|CONNREFUSED|HOSTUNREACH|NETUNREACH|NOTFOUND|AI_AGAIN|TIMEDOUT)|UND_ERR_(?:CONNECT_TIMEOUT|HEADERS_TIMEOUT|BODY_TIMEOUT|SOCKET))$/u.test(value.code)) {
|
|
29863
|
+
transportCode = value.code;
|
|
29864
|
+
category = value.code.includes("TIME") ? "timeout" : "connection_failure";
|
|
29865
|
+
}
|
|
29866
|
+
if (typeof value.code === "string" && ["08000", "08001", "08003", "08006", "08004", "08007", "08P01", "23505", "42501", "42703", "42P01", "42883", "57014", "53300", "57P01", "XX000"].includes(value.code)) {
|
|
29867
|
+
sqlState = value.code;
|
|
29868
|
+
category = value.code.startsWith("08") ? "connection_failure" : value.code === "57014" ? "timeout" : "database_failure";
|
|
29869
|
+
}
|
|
29870
|
+
if (typeof value.status === "number" && Number.isInteger(value.status) && value.status >= 400 && value.status <= 599) {
|
|
29871
|
+
httpStatus = value.status;
|
|
29872
|
+
category = value.status === 429 ? "rate_limited" : value.status === 401 ? "authentication" : value.status === 403 ? "permission" : "http_failure";
|
|
29873
|
+
}
|
|
29874
|
+
if (typeof value.method === "string" && ["eth_chainId", "eth_call", "eth_sendRawTransaction", "eth_sendTransaction", "eth_getTransactionReceipt", "eth_getTransactionByHash"].includes(value.method)) rpcMethod = value.method;
|
|
29875
|
+
if (typeof value.name === "string" && ["AbortError", "TimeoutError", "WaitForTransactionReceiptTimeoutError"].includes(value.name)) category = "timeout";
|
|
29876
|
+
if (value.name === "ContractFunctionRevertedError") category = "transaction_reverted";
|
|
29877
|
+
current = value.cause;
|
|
29878
|
+
}
|
|
29879
|
+
return Object.freeze({ category, errorType, transportCode, httpStatus, rpcMethod, sqlState });
|
|
29880
|
+
}
|
|
29881
|
+
var ONLINE_API_TECHNICAL_ERROR_CODES;
|
|
29882
|
+
var init_diagnostics = __esm({
|
|
29883
|
+
"../../packages/agent-market-contracts/src/v1/diagnostics.ts"() {
|
|
29884
|
+
"use strict";
|
|
29885
|
+
ONLINE_API_TECHNICAL_ERROR_CODES = [
|
|
29886
|
+
"API_CONNECTION_FAILED",
|
|
29887
|
+
"API_TIMEOUT",
|
|
29888
|
+
"API_RATE_LIMITED",
|
|
29889
|
+
"API_RESPONSE_INVALID"
|
|
29890
|
+
];
|
|
29891
|
+
}
|
|
29892
|
+
});
|
|
29893
|
+
|
|
29690
29894
|
// ../../packages/agent-market-contracts/src/v1/validation-input.ts
|
|
29691
29895
|
var VALIDATION_INPUT_MAX_CANONICAL_BYTES, VALIDATION_INPUT_MAX_DEPTH, VALIDATION_INPUT_MAX_NODES, VALIDATION_INPUT_CONTRACT, VALIDATION_INPUT_CANONICAL_JSON_CONTRACT, validationInputReasonCodes, validationInputSchema, VALIDATION_INPUT_PARITY_VECTORS, VALIDATION_INPUT_BOUNDARY_VECTORS;
|
|
29692
29896
|
var init_validation_input = __esm({
|
|
@@ -29750,10 +29954,11 @@ var init_validation_input = __esm({
|
|
|
29750
29954
|
});
|
|
29751
29955
|
|
|
29752
29956
|
// ../../packages/agent-market-contracts/src/v1/errors.ts
|
|
29753
|
-
var creatorRequestReasonCodes, buyerStateReasonCodes, agentMarketErrorCodes, nextActionValues, AGENT_MARKET_ERROR_DEFINITIONS, nullableStringSchema, nullableUuidSchema, nullableRevisionSchema2, agentMarketErrorEnvelopeSchema;
|
|
29957
|
+
var creatorRequestReasonCodes, buyerStateReasonCodes, FREE_CALL_FAILURE_MESSAGES, agentMarketErrorCodes, nextActionValues, AGENT_MARKET_ERROR_DEFINITIONS, nullableStringSchema, nullableUuidSchema, nullableRevisionSchema2, agentMarketErrorEnvelopeSchema;
|
|
29754
29958
|
var init_errors3 = __esm({
|
|
29755
29959
|
"../../packages/agent-market-contracts/src/v1/errors.ts"() {
|
|
29756
29960
|
"use strict";
|
|
29961
|
+
init_diagnostics();
|
|
29757
29962
|
init_common3();
|
|
29758
29963
|
init_validation_input();
|
|
29759
29964
|
creatorRequestReasonCodes = [
|
|
@@ -29771,7 +29976,14 @@ var init_errors3 = __esm({
|
|
|
29771
29976
|
"AVATAR_VIDEO_ACCOUNT_DAILY_LIMIT_REACHED",
|
|
29772
29977
|
"AVATAR_VIDEO_PLATFORM_DAILY_LIMIT_REACHED"
|
|
29773
29978
|
];
|
|
29979
|
+
FREE_CALL_FAILURE_MESSAGES = Object.freeze({
|
|
29980
|
+
AGENT_FREE_ONLY_NOT_AVAILABLE: "This free Agent call is no longer available. Refresh your free allowance or connect your wallet to use purchased Credits.",
|
|
29981
|
+
AGENT_FREE_PAID_CONFIRMATION_REQUIRED: "This Agent has reached its daily free usage limit. Confirm paid Credits before continuing.",
|
|
29982
|
+
AGENT_FREE_DAILY_LIMIT_REACHED: "This Agent has reached its daily free usage limit. Please try again tomorrow.",
|
|
29983
|
+
AGENT_FREE_CALLS_PENDING: "Your remaining free calls are reserved by running requests. Wait for them to finish before starting another call."
|
|
29984
|
+
});
|
|
29774
29985
|
agentMarketErrorCodes = [
|
|
29986
|
+
...ONLINE_API_TECHNICAL_ERROR_CODES,
|
|
29775
29987
|
"AGENT_MARKET_AUTH_REQUIRED",
|
|
29776
29988
|
"AGENT_MARKET_SCOPE_DENIED",
|
|
29777
29989
|
"AGENT_MARKET_REQUEST_INVALID",
|
|
@@ -29786,6 +29998,10 @@ var init_errors3 = __esm({
|
|
|
29786
29998
|
"PRODUCTION_NOT_AVAILABLE",
|
|
29787
29999
|
"INTEGRATION_FAMILY_IN_DEVELOPMENT",
|
|
29788
30000
|
"AGENT_MARKET_STATE_CONFLICT",
|
|
30001
|
+
"AGENT_FREE_PAID_CONFIRMATION_REQUIRED",
|
|
30002
|
+
"AGENT_FREE_ONLY_NOT_AVAILABLE",
|
|
30003
|
+
"AGENT_FREE_DAILY_LIMIT_REACHED",
|
|
30004
|
+
"AGENT_FREE_CALLS_PENDING",
|
|
29789
30005
|
"AGENT_MARKET_VALIDATION_REQUIRED",
|
|
29790
30006
|
"AGENT_MARKET_OPERATION_NOT_FOUND",
|
|
29791
30007
|
"AGENT_MARKET_INPUT_INVALID",
|
|
@@ -29815,6 +30031,10 @@ var init_errors3 = __esm({
|
|
|
29815
30031
|
"none"
|
|
29816
30032
|
];
|
|
29817
30033
|
AGENT_MARKET_ERROR_DEFINITIONS = Object.freeze({
|
|
30034
|
+
API_CONNECTION_FAILED: { httpStatus: 503, retryable: true, nextAction: "retry_later" },
|
|
30035
|
+
API_TIMEOUT: { httpStatus: 504, retryable: true, nextAction: "retry_later" },
|
|
30036
|
+
API_RATE_LIMITED: { httpStatus: 429, retryable: true, nextAction: "retry_later" },
|
|
30037
|
+
API_RESPONSE_INVALID: { httpStatus: 502, retryable: false, nextAction: "contact_support" },
|
|
29818
30038
|
AGENT_MARKET_AUTH_REQUIRED: { httpStatus: 401, retryable: false, nextAction: "authenticate" },
|
|
29819
30039
|
AGENT_MARKET_SCOPE_DENIED: { httpStatus: 403, retryable: false, nextAction: "request_scope" },
|
|
29820
30040
|
AGENT_MARKET_REQUEST_INVALID: { httpStatus: 400, retryable: false, nextAction: "fix_request" },
|
|
@@ -29829,6 +30049,10 @@ var init_errors3 = __esm({
|
|
|
29829
30049
|
PRODUCTION_NOT_AVAILABLE: { httpStatus: 409, retryable: false, nextAction: "none" },
|
|
29830
30050
|
INTEGRATION_FAMILY_IN_DEVELOPMENT: { httpStatus: 409, retryable: false, nextAction: "choose_supported_integration" },
|
|
29831
30051
|
AGENT_MARKET_STATE_CONFLICT: { httpStatus: 409, retryable: false, nextAction: "refresh_resource" },
|
|
30052
|
+
AGENT_FREE_PAID_CONFIRMATION_REQUIRED: { httpStatus: 409, retryable: false, nextAction: "refresh_resource" },
|
|
30053
|
+
AGENT_FREE_ONLY_NOT_AVAILABLE: { httpStatus: 409, retryable: false, nextAction: "refresh_resource" },
|
|
30054
|
+
AGENT_FREE_DAILY_LIMIT_REACHED: { httpStatus: 429, retryable: true, nextAction: "retry_tomorrow" },
|
|
30055
|
+
AGENT_FREE_CALLS_PENDING: { httpStatus: 409, retryable: true, nextAction: "retry_later" },
|
|
29832
30056
|
AGENT_MARKET_VALIDATION_REQUIRED: { httpStatus: 409, retryable: false, nextAction: "run_connection_test" },
|
|
29833
30057
|
AGENT_MARKET_OPERATION_NOT_FOUND: { httpStatus: 404, retryable: false, nextAction: "none" },
|
|
29834
30058
|
AGENT_MARKET_INPUT_INVALID: { httpStatus: 422, retryable: false, nextAction: "fix_request" },
|
|
@@ -30213,7 +30437,7 @@ var init_agent_cli = __esm({
|
|
|
30213
30437
|
operationId: { type: "null" },
|
|
30214
30438
|
currentRevision: { type: "null" },
|
|
30215
30439
|
currentEtag: nullableCliStringSchema,
|
|
30216
|
-
traceId:
|
|
30440
|
+
traceId: nullableCliStringSchema
|
|
30217
30441
|
})
|
|
30218
30442
|
});
|
|
30219
30443
|
AGENT_CLI_RECOVERY_CONTRACT = Object.freeze({
|
|
@@ -30947,7 +31171,7 @@ var init_transfers = __esm({
|
|
|
30947
31171
|
"../../packages/agent-market-contracts/src/v1/transfers.ts"() {
|
|
30948
31172
|
"use strict";
|
|
30949
31173
|
init_common3();
|
|
30950
|
-
described = (
|
|
31174
|
+
described = (schema6, description) => Object.freeze({ ...schema6, description });
|
|
30951
31175
|
nullSchema = Object.freeze({ type: "null" });
|
|
30952
31176
|
nonNegativeIntegerStringSchema = Object.freeze({ type: "string", pattern: "^(0|[1-9][0-9]*)$" });
|
|
30953
31177
|
headerMapSchema = Object.freeze({
|
|
@@ -31103,7 +31327,7 @@ function taskProjectionSchema(properties) {
|
|
|
31103
31327
|
terminalContent: taskPresentationContentSchema
|
|
31104
31328
|
}, Object.keys(properties));
|
|
31105
31329
|
}
|
|
31106
|
-
var booleanSchema2, jsonValueSchema, nullSchema2, agentOnInitialInputSchema, agentOnFollowUpContentSchema, feeBpsCapSchema, createPurchaseIntentRequestSchema, purchaseIntentAcceptedSchema, PURCHASE_FEE_DECISION_CONTRACT, feeSnapshotCommon, purchaseFeeDecisionSnapshotSchema, PURCHASE_LIFECYCLE_CONTRACT, FINANCIAL_AUTHORIZATION_CONTRACT, nonNegativeIntegerStringSchema2, callRightPurchaseBatchSchema, callRightsListResponseSchema, CALL_RIGHTS_PAGE_CONTRACT, CALL_FUNDING_SOURCES, fundingSourceSchema, callEligibilityQuerySchema, described2, callEligibilityResponseSchema, invocationStartRequestSchema, invocationContinueRequestSchema, runtimeHandoffStateSchema, p1InvocationReceiptProperties, p1InvocationReceiptSchema, p1InvocationAcceptedSchema, directInvocationAcceptedSchema, supplementalQuestionOptionSchema, p1QuestionSchema, p1QuestionsSchema, p1AwaitingCompletionQuestionsSchema, taskQuestionSchema, taskQuestionsSchema, closedPublicFailureSchema, timeoutFailureSchema, invocationCommon, p1InvocationResponseSchema, directInvocationCommon, directPublicFailureSchema, directInvocationResponseSchema, DIRECT_INVOCATION_READ_CONTRACT, invocationResponseSchema, createTaskRequestSchema, TASK_QUANTITY_AUTHORITY_CONTRACT, taskCreateReceiptProperties, taskCreateReceiptSchema, taskCreateAcceptedSchema, taskStrongEtagSchema, taskInputReceiptSchema, taskInputAcceptedSchema, taskCommon, buyerOutputArtifactSchema, buyerOutputArtifactsSchema, taskFailureCodeSchema, taskFailureSchema, taskPresentationContentSchema, taskResponseSchema, BUYER_AGENTON_RECOVERY_CONTRACT, appendTaskInputRequestSchema, directInvocationRequestSchema, TASK_COMPLETED_CANONICALIZATION;
|
|
31330
|
+
var booleanSchema2, jsonValueSchema, nullSchema2, agentOnInitialInputSchema, agentOnFollowUpContentSchema, feeBpsCapSchema, createPurchaseIntentRequestSchema, purchaseIntentAcceptedSchema, PURCHASE_FEE_DECISION_CONTRACT, feeSnapshotCommon, purchaseFeeDecisionSnapshotSchema, PURCHASE_LIFECYCLE_CONTRACT, FINANCIAL_AUTHORIZATION_CONTRACT, nonNegativeIntegerStringSchema2, callRightPurchaseBatchSchema, callRightsListResponseSchema, CALL_RIGHTS_PAGE_CONTRACT, CALL_FUNDING_SOURCES, fundingSourceSchema, callEligibilityQuerySchema, described2, freeConsentFields, freeCallConsentRequestSchema, freeCallConsentResponseSchema, callEligibilityResponseSchema, invocationStartRequestSchema, invocationContinueRequestSchema, runtimeHandoffStateSchema, p1InvocationReceiptProperties, p1InvocationReceiptSchema, p1InvocationAcceptedSchema, directInvocationAcceptedSchema, supplementalQuestionOptionSchema, p1QuestionSchema, p1QuestionsSchema, p1AwaitingCompletionQuestionsSchema, taskQuestionSchema, taskQuestionsSchema, closedPublicFailureSchema, timeoutFailureSchema, invocationCommon, p1InvocationResponseSchema, directInvocationCommon, directPublicFailureSchema, directInvocationResponseSchema, DIRECT_INVOCATION_READ_CONTRACT, invocationResponseSchema, createTaskRequestSchema, TASK_QUANTITY_AUTHORITY_CONTRACT, taskCreateReceiptProperties, taskCreateReceiptSchema, taskCreateAcceptedSchema, taskStrongEtagSchema, taskInputReceiptSchema, taskInputAcceptedSchema, taskCommon, buyerOutputArtifactSchema, buyerOutputArtifactsSchema, taskFailureCodeSchema, taskFailureSchema, taskPresentationContentSchema, taskResponseSchema, BUYER_AGENTON_RECOVERY_CONTRACT, appendTaskInputRequestSchema, directInvocationRequestSchema, TASK_COMPLETED_CANONICALIZATION;
|
|
31107
31331
|
var init_buyer = __esm({
|
|
31108
31332
|
"../../packages/agent-market-contracts/src/v1/buyer.ts"() {
|
|
31109
31333
|
"use strict";
|
|
@@ -31270,7 +31494,31 @@ var init_buyer = __esm({
|
|
|
31270
31494
|
description: "Units of work for a generation offer; 1 for conversation, task, and Direct calls."
|
|
31271
31495
|
}
|
|
31272
31496
|
}, []);
|
|
31273
|
-
described2 = (
|
|
31497
|
+
described2 = (schema6, description) => Object.freeze({ ...schema6, description });
|
|
31498
|
+
freeConsentFields = {
|
|
31499
|
+
confirmed: { const: true, description: "Must be true only after the user explicitly approves paid fallback for this one call." },
|
|
31500
|
+
requiredUnits: { ...positiveIntegerStringSchema2, maxLength: 78, description: "Exact paid unit cost returned by call eligibility; a changed price invalidates this consent." }
|
|
31501
|
+
};
|
|
31502
|
+
freeCallConsentRequestSchema = Object.freeze({
|
|
31503
|
+
oneOf: [
|
|
31504
|
+
strictObjectSchema2({
|
|
31505
|
+
...freeConsentFields,
|
|
31506
|
+
offerId: canonicalUuidSchema2,
|
|
31507
|
+
versionId: nullSchema2,
|
|
31508
|
+
quantity: { type: "integer", minimum: 1, maximum: 2147483647 }
|
|
31509
|
+
}),
|
|
31510
|
+
strictObjectSchema2({
|
|
31511
|
+
...freeConsentFields,
|
|
31512
|
+
offerId: nullSchema2,
|
|
31513
|
+
versionId: canonicalUuidSchema2,
|
|
31514
|
+
quantity: { const: 1 }
|
|
31515
|
+
})
|
|
31516
|
+
]
|
|
31517
|
+
});
|
|
31518
|
+
freeCallConsentResponseSchema = strictObjectSchema2({ confirmed: {
|
|
31519
|
+
const: true,
|
|
31520
|
+
description: "The exact one-request paid fallback consent was recorded; no invocation was admitted or charged."
|
|
31521
|
+
} });
|
|
31274
31522
|
callEligibilityResponseSchema = strictObjectSchema2({
|
|
31275
31523
|
serviceVersionId: described2(canonicalUuidSchema2, "Service version the call would run on."),
|
|
31276
31524
|
offerId: { anyOf: [canonicalUuidSchema2, nullSchema2], description: "The checked AgentOn offer, or null for a Direct API version." },
|
|
@@ -31278,18 +31526,18 @@ var init_buyer = __esm({
|
|
|
31278
31526
|
requiredUnits: described2(positiveIntegerStringSchema2, "Call-right units a paid call would reserve, as a decimal integer string."),
|
|
31279
31527
|
fundingSource: {
|
|
31280
31528
|
enum: ["merchant_self_test", "promotion", "paid", "insufficient"],
|
|
31281
|
-
description: "
|
|
31529
|
+
description: "merchant_self_test and promotion are free; paid reserves requiredUnits purchased call rights. If unused personal calls remain but dailyRemaining is zero, paid funding requires explicit one-request confirmation first. insufficient can mean missing purchased rights or all remaining free calls are still in flight."
|
|
31282
31530
|
},
|
|
31283
31531
|
merchantSelfTest: described2(booleanSchema2, "True when the caller owns this contract-tested agent, so calls are a free owner self-test."),
|
|
31284
31532
|
promotion: {
|
|
31285
31533
|
anyOf: [strictObjectSchema2({
|
|
31286
|
-
availableOperations: described2(nonNegativeIntegerStringSchema2, "Free calls usable now
|
|
31287
|
-
personalRemaining: described2(nonNegativeIntegerStringSchema2, "
|
|
31288
|
-
expiresAt: described2(canonicalSecondTimestampSchema, "
|
|
31289
|
-
dailyRemaining: { anyOf: [nonNegativeIntegerStringSchema2, nullSchema2], description: "
|
|
31290
|
-
dailyResetsAt: { anyOf: [canonicalSecondTimestampSchema, nullSchema2], description: "
|
|
31534
|
+
availableOperations: described2(nonNegativeIntegerStringSchema2, "Free calls usable now after deducting running reservations and applying the shared Agent daily ceiling."),
|
|
31535
|
+
personalRemaining: described2(nonNegativeIntegerStringSchema2, "Unexpired unused calls out of the account/Agent lifetime grant of 10. Only success consumes a call; in-flight reservations are not consumption. This balance ignores shared daily capacity."),
|
|
31536
|
+
expiresAt: described2(canonicalSecondTimestampSchema, "Exclusive Beijing midnight on day 31, starting on max(first Agent publication date, account registration date). Display the preceding Beijing date."),
|
|
31537
|
+
dailyRemaining: { anyOf: [nonNegativeIntegerStringSchema2, nullSchema2], description: "Remaining shared capacity out of 100 free calls per canonical Agent and Beijing calendar day; includes running reservations." },
|
|
31538
|
+
dailyResetsAt: { anyOf: [canonicalSecondTimestampSchema, nullSchema2], description: "Next Beijing (UTC+8) midnight. Revisions and republication never reset daily capacity." }
|
|
31291
31539
|
}), nullSchema2],
|
|
31292
|
-
description: "The
|
|
31540
|
+
description: "The canonical account/Agent trial, including expired or exhausted trials for status display; null when no first publication is known. Never renews on login, Revision or republication."
|
|
31293
31541
|
},
|
|
31294
31542
|
paid: Object.freeze({
|
|
31295
31543
|
...strictObjectSchema2({
|
|
@@ -32521,6 +32769,7 @@ var PRODUCTION_AUTH_CHAIN_IDS, TEST_AUTH_CHAIN_IDS, IDENTITY_SCOPE_ORDER_CONTRAC
|
|
|
32521
32769
|
var init_identity = __esm({
|
|
32522
32770
|
"../../packages/agent-market-contracts/src/v1/identity.ts"() {
|
|
32523
32771
|
"use strict";
|
|
32772
|
+
init_diagnostics();
|
|
32524
32773
|
init_common3();
|
|
32525
32774
|
PRODUCTION_AUTH_CHAIN_IDS = Object.freeze([1, 10, 56, 8453, 42161, 43114, 1776]);
|
|
32526
32775
|
TEST_AUTH_CHAIN_IDS = Object.freeze([84532]);
|
|
@@ -32580,6 +32829,7 @@ var init_identity = __esm({
|
|
|
32580
32829
|
}
|
|
32581
32830
|
});
|
|
32582
32831
|
identityErrorCodes = [
|
|
32832
|
+
...ONLINE_API_TECHNICAL_ERROR_CODES,
|
|
32583
32833
|
"AGENT_AUTH_REQUEST_INVALID",
|
|
32584
32834
|
"AGENT_AUTH_CHAIN_UNSUPPORTED",
|
|
32585
32835
|
"AGENT_CLI_WALLET_KIND_UNSUPPORTED",
|
|
@@ -33237,7 +33487,7 @@ var init_owner_configuration = __esm({
|
|
|
33237
33487
|
"use strict";
|
|
33238
33488
|
init_common3();
|
|
33239
33489
|
init_localization();
|
|
33240
|
-
nullable2 = (
|
|
33490
|
+
nullable2 = (schema6) => ({ anyOf: [schema6, { type: "null" }] });
|
|
33241
33491
|
text3 = { type: "string" };
|
|
33242
33492
|
time3 = { type: "string", format: "date-time" };
|
|
33243
33493
|
revision = positiveRevisionSchema;
|
|
@@ -33389,7 +33639,7 @@ var init_buyer_library = __esm({
|
|
|
33389
33639
|
init_common3();
|
|
33390
33640
|
units = { type: "string", pattern: "^[0-9]+$" };
|
|
33391
33641
|
time4 = { type: "string", format: "date-time" };
|
|
33392
|
-
nullable3 = (
|
|
33642
|
+
nullable3 = (schema6) => ({ anyOf: [schema6, { type: "null" }] });
|
|
33393
33643
|
buyerAgentLibraryAssetSchema = strictObjectSchema2({
|
|
33394
33644
|
serviceVersionId: canonicalUuidSchema2,
|
|
33395
33645
|
acquiredAt: time4,
|
|
@@ -33449,7 +33699,7 @@ var init_merchant_calls = __esm({
|
|
|
33449
33699
|
"../../packages/agent-market-contracts/src/v1/merchant-calls.ts"() {
|
|
33450
33700
|
"use strict";
|
|
33451
33701
|
init_common3();
|
|
33452
|
-
described3 = (
|
|
33702
|
+
described3 = (schema6, description) => Object.freeze({ ...schema6, description });
|
|
33453
33703
|
nullSchema5 = Object.freeze({ type: "null" });
|
|
33454
33704
|
unitsSchema = Object.freeze({ type: "string", pattern: "^(0|[1-9][0-9]*)$" });
|
|
33455
33705
|
instantSchema = Object.freeze({ type: "string", format: "date-time" });
|
|
@@ -33509,7 +33759,7 @@ var init_reviews = __esm({
|
|
|
33509
33759
|
"../../packages/agent-market-contracts/src/v1/reviews.ts"() {
|
|
33510
33760
|
"use strict";
|
|
33511
33761
|
init_common3();
|
|
33512
|
-
described4 = (
|
|
33762
|
+
described4 = (schema6, description) => Object.freeze({ ...schema6, description });
|
|
33513
33763
|
nullSchema6 = Object.freeze({ type: "null" });
|
|
33514
33764
|
ratingSchema = Object.freeze({ type: "integer", minimum: 1, maximum: 5 });
|
|
33515
33765
|
averageSchema = Object.freeze({ anyOf: [{ type: "number", minimum: 1, maximum: 5 }, nullSchema6] });
|
|
@@ -33826,12 +34076,12 @@ var init_public_catalog = __esm({
|
|
|
33826
34076
|
});
|
|
33827
34077
|
|
|
33828
34078
|
// ../../packages/agent-market-contracts/src/v1/public-catalog-wire.ts
|
|
33829
|
-
function describeSummary(
|
|
33830
|
-
const properties =
|
|
33831
|
-
const alternatives =
|
|
34079
|
+
function describeSummary(schema6) {
|
|
34080
|
+
const properties = schema6.properties;
|
|
34081
|
+
const alternatives = schema6.anyOf;
|
|
33832
34082
|
return {
|
|
33833
|
-
...
|
|
33834
|
-
...
|
|
34083
|
+
...schema6,
|
|
34084
|
+
...schema6.const === "pdf" ? { type: "string" } : {},
|
|
33835
34085
|
...properties ? { properties: Object.fromEntries(Object.entries(properties).map(([name, property]) => [name, {
|
|
33836
34086
|
...describeSummary(property),
|
|
33837
34087
|
...descriptions[name] ? { description: [descriptions[name], property.description].filter(Boolean).join(" ") } : {}
|
|
@@ -33839,9 +34089,9 @@ function describeSummary(schema5) {
|
|
|
33839
34089
|
...alternatives ? { anyOf: alternatives.map(describeSummary) } : {}
|
|
33840
34090
|
};
|
|
33841
34091
|
}
|
|
33842
|
-
function pageSchema(
|
|
33843
|
-
const properties =
|
|
33844
|
-
return { ...
|
|
34092
|
+
function pageSchema(schema6) {
|
|
34093
|
+
const properties = schema6.properties;
|
|
34094
|
+
return { ...schema6, properties: {
|
|
33845
34095
|
...properties,
|
|
33846
34096
|
services: { ...properties.services, items: publicCatalogWireServiceSchema }
|
|
33847
34097
|
} };
|
|
@@ -34541,6 +34791,19 @@ var init_operations = __esm({
|
|
|
34541
34791
|
integrationFamilies: families.active,
|
|
34542
34792
|
writes: false
|
|
34543
34793
|
}),
|
|
34794
|
+
"buyer_free_call_consent.confirm": operation({
|
|
34795
|
+
id: "buyer_free_call_consent.confirm",
|
|
34796
|
+
requiredScope: "agent_market:buyer:invoke",
|
|
34797
|
+
http: http("post", "/api/v1/agent-market/buyer/call-eligibility", 200, {
|
|
34798
|
+
requestSchema: freeCallConsentRequestSchema,
|
|
34799
|
+
responseSchema: freeCallConsentResponseSchema,
|
|
34800
|
+
idempotencyRequired: true
|
|
34801
|
+
}),
|
|
34802
|
+
mcp: { name: "agent_market_buyer_free_call_consent_confirm" },
|
|
34803
|
+
cli: null,
|
|
34804
|
+
integrationFamilies: families.active,
|
|
34805
|
+
writes: true
|
|
34806
|
+
}),
|
|
34544
34807
|
"buyer_p1_invocations.create": operation({
|
|
34545
34808
|
id: "buyer_p1_invocations.create",
|
|
34546
34809
|
requiredScope: "agent_market:buyer:invoke",
|
|
@@ -34942,18 +35205,18 @@ var init_operations = __esm({
|
|
|
34942
35205
|
});
|
|
34943
35206
|
|
|
34944
35207
|
// ../../packages/agent-market-contracts/src/v1/mcp.ts
|
|
34945
|
-
function bodyVariants(
|
|
34946
|
-
if (
|
|
34947
|
-
const candidate =
|
|
35208
|
+
function bodyVariants(schema6) {
|
|
35209
|
+
if (schema6 === void 0) return [{}];
|
|
35210
|
+
const candidate = schema6;
|
|
34948
35211
|
if (candidate.oneOf !== void 0) return candidate.oneOf.flatMap((variant) => bodyVariants(variant));
|
|
34949
35212
|
return [candidate];
|
|
34950
35213
|
}
|
|
34951
35214
|
function unionProperties(variants) {
|
|
34952
35215
|
const candidates = /* @__PURE__ */ new Map();
|
|
34953
35216
|
for (const { properties } of variants) {
|
|
34954
|
-
for (const [field,
|
|
35217
|
+
for (const [field, schema6] of Object.entries(properties ?? {})) {
|
|
34955
35218
|
const alternatives = candidates.get(field) ?? /* @__PURE__ */ new Map();
|
|
34956
|
-
alternatives.set(JSON.stringify(
|
|
35219
|
+
alternatives.set(JSON.stringify(schema6), schema6);
|
|
34957
35220
|
candidates.set(field, alternatives);
|
|
34958
35221
|
}
|
|
34959
35222
|
}
|
|
@@ -35059,12 +35322,12 @@ var init_mcp = __esm({
|
|
|
35059
35322
|
});
|
|
35060
35323
|
|
|
35061
35324
|
// ../../packages/agent-market-contracts/src/v1/openapi.ts
|
|
35062
|
-
function mediaTypeContent(contentType,
|
|
35063
|
-
return { content: { [contentType]: { schema:
|
|
35325
|
+
function mediaTypeContent(contentType, schema6) {
|
|
35326
|
+
return { content: { [contentType]: { schema: schema6 } } };
|
|
35064
35327
|
}
|
|
35065
35328
|
function responseHeaderObjects(schemas) {
|
|
35066
35329
|
return Object.fromEntries(
|
|
35067
|
-
Object.entries(schemas).map(([name,
|
|
35330
|
+
Object.entries(schemas).map(([name, schema6]) => [name, { schema: schema6 }])
|
|
35068
35331
|
);
|
|
35069
35332
|
}
|
|
35070
35333
|
function operationParameters(http3) {
|
|
@@ -35074,16 +35337,16 @@ function operationParameters(http3) {
|
|
|
35074
35337
|
required: true,
|
|
35075
35338
|
schema: canonicalUuidSchema2
|
|
35076
35339
|
}));
|
|
35077
|
-
for (const [name,
|
|
35340
|
+
for (const [name, schema6] of Object.entries(http3.querySchema?.properties ?? {})) {
|
|
35078
35341
|
parameters.push({
|
|
35079
35342
|
name,
|
|
35080
35343
|
in: "query",
|
|
35081
35344
|
required: http3.querySchema?.required?.includes(name) ?? false,
|
|
35082
|
-
schema:
|
|
35345
|
+
schema: schema6
|
|
35083
35346
|
});
|
|
35084
35347
|
}
|
|
35085
|
-
for (const [name,
|
|
35086
|
-
parameters.push({ name, in: "header", required: true, schema:
|
|
35348
|
+
for (const [name, schema6] of Object.entries(http3.requestHeaders ?? {})) {
|
|
35349
|
+
parameters.push({ name, in: "header", required: true, schema: schema6 });
|
|
35087
35350
|
}
|
|
35088
35351
|
if (http3.idempotencyRequired) parameters.push({ $ref: "#/components/parameters/IdempotencyKey" });
|
|
35089
35352
|
if (http3.ifMatchRequired) parameters.push({ $ref: "#/components/parameters/IfMatch" });
|
|
@@ -35440,6 +35703,7 @@ var init_v1 = __esm({
|
|
|
35440
35703
|
init_avatar_video();
|
|
35441
35704
|
init_owner_configuration();
|
|
35442
35705
|
init_buyer_library();
|
|
35706
|
+
init_diagnostics();
|
|
35443
35707
|
}
|
|
35444
35708
|
});
|
|
35445
35709
|
|
|
@@ -35520,6 +35784,7 @@ var init_schemas3 = __esm({
|
|
|
35520
35784
|
deadline: nullableString,
|
|
35521
35785
|
startAt: nullableString,
|
|
35522
35786
|
goals: { type: "array", maxItems: 5, items: openObjectSchema2 },
|
|
35787
|
+
chainId: positiveInteger,
|
|
35523
35788
|
publishNow: { const: false }
|
|
35524
35789
|
}, ["title", "goal", "rewardAmount", "publishNow"]);
|
|
35525
35790
|
taskSubmissionRequestSchema = strictObjectSchema3({
|
|
@@ -35632,7 +35897,7 @@ var init_schemas3 = __esm({
|
|
|
35632
35897
|
_mutation: openObjectSchema2
|
|
35633
35898
|
}, ["taskId", "poolIdBytes32", "chainId", "vaultAddress", "amountAtomic", "signingAuthority", "_mutation"]);
|
|
35634
35899
|
taskErrorEnvelopeSchema = strictObjectSchema3({
|
|
35635
|
-
error: strictObjectSchema3({ code: { type: "string", minLength: 1, maxLength: 100 }, message: { type: "string", minLength: 1, maxLength: 500 } })
|
|
35900
|
+
error: strictObjectSchema3({ code: { description: "Includes stable technical codes API_CONNECTION_FAILED, API_TIMEOUT, API_RATE_LIMITED and API_RESPONSE_INVALID; execution certainty is independent of the code.", type: "string", minLength: 1, maxLength: 100 }, message: { type: "string", minLength: 1, maxLength: 500 } })
|
|
35636
35901
|
});
|
|
35637
35902
|
}
|
|
35638
35903
|
});
|
|
@@ -35641,24 +35906,24 @@ var init_schemas3 = __esm({
|
|
|
35641
35906
|
function operation2(value) {
|
|
35642
35907
|
return Object.freeze(value);
|
|
35643
35908
|
}
|
|
35644
|
-
function schemaFields(
|
|
35645
|
-
if (
|
|
35646
|
-
const shape =
|
|
35909
|
+
function schemaFields(schema6) {
|
|
35910
|
+
if (schema6 === void 0) return {};
|
|
35911
|
+
const shape = schema6;
|
|
35647
35912
|
return Object.freeze(Object.assign(
|
|
35648
35913
|
{},
|
|
35649
35914
|
shape.properties ?? {},
|
|
35650
35915
|
...(shape.oneOf ?? []).map((variant) => schemaFields(variant))
|
|
35651
35916
|
));
|
|
35652
35917
|
}
|
|
35653
|
-
function requiredFields(
|
|
35654
|
-
return
|
|
35918
|
+
function requiredFields(schema6) {
|
|
35919
|
+
return schema6?.required ?? [];
|
|
35655
35920
|
}
|
|
35656
35921
|
function inputSchema(fields, required4, body) {
|
|
35657
|
-
const
|
|
35922
|
+
const schema6 = strictObjectSchema3(fields, required4);
|
|
35658
35923
|
const variants = body?.oneOf ?? [];
|
|
35659
|
-
if (variants.length === 0) return
|
|
35924
|
+
if (variants.length === 0) return schema6;
|
|
35660
35925
|
return Object.freeze({
|
|
35661
|
-
...
|
|
35926
|
+
...schema6,
|
|
35662
35927
|
oneOf: variants.map((variant) => Object.freeze({ required: requiredFields(variant) }))
|
|
35663
35928
|
});
|
|
35664
35929
|
}
|
|
@@ -35758,11 +36023,11 @@ var init_src4 = __esm({
|
|
|
35758
36023
|
});
|
|
35759
36024
|
|
|
35760
36025
|
// src/api.ts
|
|
35761
|
-
function assertRequestSchema(
|
|
35762
|
-
let validator = validatorCache.get(
|
|
36026
|
+
function assertRequestSchema(schema6, value) {
|
|
36027
|
+
let validator = validatorCache.get(schema6);
|
|
35763
36028
|
if (validator === void 0) {
|
|
35764
|
-
validator = ajv.compile(
|
|
35765
|
-
validatorCache.set(
|
|
36029
|
+
validator = ajv.compile(schema6);
|
|
36030
|
+
validatorCache.set(schema6, validator);
|
|
35766
36031
|
}
|
|
35767
36032
|
if (!validator(value)) throw new TypeError("Custody request does not match the shared operation schema.");
|
|
35768
36033
|
}
|
|
@@ -35778,11 +36043,11 @@ function skillHttpDiagnostic(response, value) {
|
|
|
35778
36043
|
...traceId !== null && TRACE_ID_PATTERN.test(traceId) ? { remoteTraceId: traceId } : {}
|
|
35779
36044
|
};
|
|
35780
36045
|
}
|
|
35781
|
-
function assertSchema(
|
|
35782
|
-
let validator = validatorCache.get(
|
|
36046
|
+
function assertSchema(schema6, value, diagnosticPaths) {
|
|
36047
|
+
let validator = validatorCache.get(schema6);
|
|
35783
36048
|
if (validator === void 0) {
|
|
35784
|
-
const compiled = ajv.compile(
|
|
35785
|
-
validatorCache.set(
|
|
36049
|
+
const compiled = ajv.compile(schema6);
|
|
36050
|
+
validatorCache.set(schema6, compiled);
|
|
35786
36051
|
validator = compiled;
|
|
35787
36052
|
}
|
|
35788
36053
|
if (!validator(value)) {
|
|
@@ -35799,11 +36064,11 @@ function requiredSkillIntentId(intentId) {
|
|
|
35799
36064
|
return parseCanonicalUuid(intentId, "intentId");
|
|
35800
36065
|
}
|
|
35801
36066
|
function canonicalOrigin2(input) {
|
|
35802
|
-
const
|
|
35803
|
-
if (
|
|
36067
|
+
const parsed3 = new URL(input);
|
|
36068
|
+
if (parsed3.origin !== input || parsed3.username !== "" || parsed3.password !== "" || parsed3.pathname !== "/" || parsed3.search !== "" || parsed3.hash !== "" || !["http:", "https:"].includes(parsed3.protocol)) {
|
|
35804
36069
|
throw new TypeError("AgentCLI origin must be canonical.");
|
|
35805
36070
|
}
|
|
35806
|
-
return
|
|
36071
|
+
return parsed3.origin;
|
|
35807
36072
|
}
|
|
35808
36073
|
function jsonObject(value) {
|
|
35809
36074
|
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
@@ -35935,10 +36200,10 @@ async function readBoundedBytes(response, minimumBytes, maximumBytes) {
|
|
|
35935
36200
|
}
|
|
35936
36201
|
}
|
|
35937
36202
|
function parseRemoteError(contract, response, value, diagnose = false) {
|
|
35938
|
-
const
|
|
36203
|
+
const schema6 = contract === "agent_market" ? agentCliErrorEnvelopeSchema : contract === "identity" ? identityErrorEnvelopeSchema : contract === "task_market" ? taskErrorEnvelopeSchema : contract === "skill_market" ? skillErrorEnvelopeSchema : oauthErrorResponseSchema;
|
|
35939
36204
|
let envelope;
|
|
35940
36205
|
try {
|
|
35941
|
-
envelope = assertSchema(
|
|
36206
|
+
envelope = assertSchema(schema6, value, diagnose ? skillErrorDiagnosticPaths : void 0);
|
|
35942
36207
|
} catch (cause) {
|
|
35943
36208
|
throw new CliHttpError("CLI_RESPONSE_INVALID", response.status, {
|
|
35944
36209
|
cause,
|
|
@@ -36115,7 +36380,7 @@ var init_api2 = __esm({
|
|
|
36115
36380
|
} catch (cause) {
|
|
36116
36381
|
throw new CliHttpError("CLI_REMOTE_UNAVAILABLE", null, { cause });
|
|
36117
36382
|
}
|
|
36118
|
-
if (response.status
|
|
36383
|
+
if (!(typeof expectedStatus === "number" ? response.status === expectedStatus : expectedStatus.includes(response.status))) {
|
|
36119
36384
|
let value;
|
|
36120
36385
|
try {
|
|
36121
36386
|
value = await readBoundedJson(response, 65536, true);
|
|
@@ -36367,6 +36632,7 @@ var init_api2 = __esm({
|
|
|
36367
36632
|
body: JSON.stringify(body)
|
|
36368
36633
|
});
|
|
36369
36634
|
const stage = await readBoundedJson(response, 65536, true);
|
|
36635
|
+
if (stage.status === "chain_confirmed") return { publicationCompleted: true };
|
|
36370
36636
|
return assertSchema(skillUnsignedIntentResponseSchema, stage.intent, intentDiagnosticPaths);
|
|
36371
36637
|
} catch (cause) {
|
|
36372
36638
|
if (!(cause instanceof CliHttpError)) throw cause;
|
|
@@ -36382,6 +36648,26 @@ var init_api2 = __esm({
|
|
|
36382
36648
|
});
|
|
36383
36649
|
}
|
|
36384
36650
|
}
|
|
36651
|
+
/** Only a validated historical publication journal without a Session intent uses this admission route. */
|
|
36652
|
+
async requestLegacySkillPublicationIntent(body, bearer) {
|
|
36653
|
+
const response = await this.skillFetch("/api/skills/intents", {
|
|
36654
|
+
method: "POST",
|
|
36655
|
+
headers: { authorization: `Bearer ${bearer}`, "content-type": "application/json" },
|
|
36656
|
+
body: JSON.stringify(body)
|
|
36657
|
+
});
|
|
36658
|
+
return assertSchema(skillUnsignedIntentResponseSchema, await readBoundedJson(response, 65536, true), intentDiagnosticPaths);
|
|
36659
|
+
}
|
|
36660
|
+
async confirmLegacySkillProjection(chainId, transactionHash3, bearer) {
|
|
36661
|
+
const response = await this.skillFetch("/api/skills/projection", {
|
|
36662
|
+
method: "POST",
|
|
36663
|
+
headers: { authorization: `Bearer ${bearer}`, "content-type": "application/json" },
|
|
36664
|
+
body: JSON.stringify({ chainId, transactionHash: transactionHash3 })
|
|
36665
|
+
}, [200, 202]);
|
|
36666
|
+
if (response.status === 200) return "projected";
|
|
36667
|
+
if (response.status === 202) return "indexing_pending";
|
|
36668
|
+
await readBoundedJson(response);
|
|
36669
|
+
throw new CliHttpError("CLI_RESPONSE_INVALID", response.status);
|
|
36670
|
+
}
|
|
36385
36671
|
async resolveSkillId(_chainId, _slug, bearer, intentId) {
|
|
36386
36672
|
return (await this.skillIntentState(requiredSkillIntentId(intentId), bearer)).skillId;
|
|
36387
36673
|
}
|
|
@@ -36443,6 +36729,15 @@ var init_api2 = __esm({
|
|
|
36443
36729
|
});
|
|
36444
36730
|
return readBoundedBytes(response, 1, MAX_SKILL_PACKAGE_BYTES);
|
|
36445
36731
|
}
|
|
36732
|
+
async confirmSkillPublicationState(request2, bearer, intentId, stage) {
|
|
36733
|
+
const response = await this.skillFetch(`${skillCliIntentPath(requiredSkillIntentId(intentId))}/confirm`, {
|
|
36734
|
+
method: "POST",
|
|
36735
|
+
headers: { authorization: `Bearer ${bearer}`, "content-type": "application/json" },
|
|
36736
|
+
body: JSON.stringify({ stage, request: request2 })
|
|
36737
|
+
});
|
|
36738
|
+
const body = await readBoundedJson(response, 65536, true);
|
|
36739
|
+
if (body.status !== "indexing_pending" && body.status !== "projected") throw new CliHttpError("CLI_RESPONSE_INVALID", 200);
|
|
36740
|
+
}
|
|
36446
36741
|
async confirmSkillProjection(_chainId, transactionHash3, bearer, intentId, stage = "primary") {
|
|
36447
36742
|
const receipt = await this.confirmSkillSigningIntent(requiredSkillIntentId(intentId), stage, transactionHash3, bearer);
|
|
36448
36743
|
if (receipt.status !== "projected" && receipt.status !== "indexing_pending") throw new CliHttpError("CLI_RESPONSE_INVALID", 200);
|
|
@@ -36461,13 +36756,13 @@ var init_api2 = __esm({
|
|
|
36461
36756
|
});
|
|
36462
36757
|
}
|
|
36463
36758
|
authorizeMcp(requestPath, bearer) {
|
|
36464
|
-
let
|
|
36759
|
+
let parsed3;
|
|
36465
36760
|
try {
|
|
36466
|
-
|
|
36761
|
+
parsed3 = new URL(requestPath, this.origin);
|
|
36467
36762
|
} catch {
|
|
36468
36763
|
throw new TypeError("MCP authorization request path is invalid.");
|
|
36469
36764
|
}
|
|
36470
|
-
if (
|
|
36765
|
+
if (parsed3.origin !== this.origin || parsed3.pathname !== "/oauth/authorize" || parsed3.hash !== "" || requestPath !== `${parsed3.pathname}${parsed3.search}` || parsed3.search === "") {
|
|
36471
36766
|
throw new TypeError("MCP authorization request path is invalid.");
|
|
36472
36767
|
}
|
|
36473
36768
|
return this.request({
|
|
@@ -44751,12 +45046,12 @@ var init_utils4 = __esm({
|
|
|
44751
45046
|
getContractAddress = (address2) => address2;
|
|
44752
45047
|
getUrl = (url2) => {
|
|
44753
45048
|
try {
|
|
44754
|
-
const
|
|
44755
|
-
if (!
|
|
45049
|
+
const parsed3 = new URL(url2);
|
|
45050
|
+
if (!parsed3.username && !parsed3.password)
|
|
44756
45051
|
return url2;
|
|
44757
|
-
|
|
44758
|
-
|
|
44759
|
-
return
|
|
45052
|
+
parsed3.username = "";
|
|
45053
|
+
parsed3.password = "";
|
|
45054
|
+
return parsed3.toString();
|
|
44760
45055
|
} catch {
|
|
44761
45056
|
return url2;
|
|
44762
45057
|
}
|
|
@@ -56007,13 +56302,13 @@ var init_validateSiweMessage = __esm({
|
|
|
56007
56302
|
// ../../node_modules/.pnpm/viem@2.55.15_bufferutil@4.1_ce20031be19c56210207d462110a7a29/node_modules/viem/_esm/actions/siwe/verifySiweMessage.js
|
|
56008
56303
|
async function verifySiweMessage(client, parameters) {
|
|
56009
56304
|
const { address: address2, domain: domain2, message, nonce, scheme, signature, time: time5 = /* @__PURE__ */ new Date(), ...callRequest } = parameters;
|
|
56010
|
-
const
|
|
56011
|
-
if (!
|
|
56305
|
+
const parsed3 = parseSiweMessage(message);
|
|
56306
|
+
if (!parsed3.address)
|
|
56012
56307
|
return false;
|
|
56013
56308
|
const isValid = validateSiweMessage({
|
|
56014
56309
|
address: address2,
|
|
56015
56310
|
domain: domain2,
|
|
56016
|
-
message:
|
|
56311
|
+
message: parsed3,
|
|
56017
56312
|
nonce,
|
|
56018
56313
|
scheme,
|
|
56019
56314
|
time: time5
|
|
@@ -56022,7 +56317,7 @@ async function verifySiweMessage(client, parameters) {
|
|
|
56022
56317
|
return false;
|
|
56023
56318
|
const hash5 = hashMessage(message);
|
|
56024
56319
|
return verifyHash(client, {
|
|
56025
|
-
address:
|
|
56320
|
+
address: parsed3.address,
|
|
56026
56321
|
hash: hash5,
|
|
56027
56322
|
signature,
|
|
56028
56323
|
...callRequest
|
|
@@ -57479,9 +57774,11 @@ var init_esm2 = __esm({
|
|
|
57479
57774
|
init_createPublicClient();
|
|
57480
57775
|
init_createWalletClient();
|
|
57481
57776
|
init_http2();
|
|
57777
|
+
init_transaction();
|
|
57482
57778
|
init_decodeFunctionData();
|
|
57483
57779
|
init_encodeFunctionData();
|
|
57484
57780
|
init_getAddress();
|
|
57781
|
+
init_keccak256();
|
|
57485
57782
|
}
|
|
57486
57783
|
});
|
|
57487
57784
|
|
|
@@ -57579,16 +57876,16 @@ function assertLocalAction(value, command, skillId) {
|
|
|
57579
57876
|
}
|
|
57580
57877
|
}
|
|
57581
57878
|
function intent(value, walletAddress2) {
|
|
57582
|
-
const
|
|
57583
|
-
exact2(
|
|
57584
|
-
const chainId = skillChain(
|
|
57879
|
+
const parsed3 = object2(value, "Skill intent");
|
|
57880
|
+
exact2(parsed3, ["chainId", "to", "data", "value", "summary", "signingAuthority"], "Skill intent");
|
|
57881
|
+
const chainId = skillChain(parsed3.chainId, "Skill intent chain");
|
|
57585
57882
|
return Object.freeze({
|
|
57586
57883
|
chainId,
|
|
57587
|
-
to: string4(
|
|
57588
|
-
data: string4(
|
|
57589
|
-
value: string4(
|
|
57590
|
-
summary: string4(
|
|
57591
|
-
signingAuthority: signingAuthority(
|
|
57884
|
+
to: string4(parsed3.to, "Skill intent target", /^0x[0-9a-fA-F]{40}$/u),
|
|
57885
|
+
data: string4(parsed3.data, "Skill intent calldata", /^0x(?:[0-9a-fA-F]{2})+$/u),
|
|
57886
|
+
value: string4(parsed3.value, "Skill intent value", DECIMAL),
|
|
57887
|
+
summary: string4(parsed3.summary, "Skill intent summary"),
|
|
57888
|
+
signingAuthority: signingAuthority(parsed3.signingAuthority, walletAddress2)
|
|
57592
57889
|
});
|
|
57593
57890
|
}
|
|
57594
57891
|
function legacyIntent(value, walletAddress2, authority) {
|
|
@@ -57652,7 +57949,7 @@ function publishPlan(value, context) {
|
|
|
57652
57949
|
const chainId = assertAuthority(plan, "publish", context.walletAddress);
|
|
57653
57950
|
assertLocalAction(plan.localAction, "skill publish-submit");
|
|
57654
57951
|
const request2 = object2(plan.request, "Skill publish request");
|
|
57655
|
-
exact2(request2, ["chainId", "slug", "name", "category", "licenseTypeName", "imageURI", "sourceKind", "contentMode", "unitPrice", "maxSupply", ...Object.hasOwn(request2, "summary") ? ["summary"] : []], "Skill publish request");
|
|
57952
|
+
exact2(request2, ["chainId", "slug", "name", "category", "licenseTypeName", "imageURI", "sourceKind", "contentMode", "unitPrice", "maxSupply", ...Object.hasOwn(request2, "summary") ? ["summary"] : [], ...Object.hasOwn(request2, "sourceLocale") ? ["sourceLocale"] : []], "Skill publish request");
|
|
57656
57953
|
if (request2.chainId !== chainId) throw new TypeError("Skill publish request chain is invalid.");
|
|
57657
57954
|
string4(request2.slug, "Skill slug");
|
|
57658
57955
|
string4(request2.name, "Skill name");
|
|
@@ -57662,6 +57959,7 @@ function publishPlan(value, context) {
|
|
|
57662
57959
|
throw new TypeError("Skill publish metadata is invalid.");
|
|
57663
57960
|
}
|
|
57664
57961
|
if (Object.hasOwn(request2, "summary") && (typeof request2.summary !== "string" || request2.summary.length > 500)) throw new TypeError("Skill summary is invalid.");
|
|
57962
|
+
if (request2.sourceLocale !== void 0 && !["en", "zh", "zh-TW"].includes(String(request2.sourceLocale))) throw new TypeError("Skill source language is invalid.");
|
|
57665
57963
|
sourceKind(request2.sourceKind);
|
|
57666
57964
|
contentMode(request2.contentMode);
|
|
57667
57965
|
string4(request2.unitPrice, "Skill unitPrice", DECIMAL);
|
|
@@ -57770,9 +58068,10 @@ function required2(value, name) {
|
|
|
57770
58068
|
function recoveryReceipt(value, name) {
|
|
57771
58069
|
if (value === null) return null;
|
|
57772
58070
|
const receipt = object2(value, name);
|
|
57773
|
-
exact2(receipt, ["transactionHash", "blockNumber"], name);
|
|
58071
|
+
exact2(receipt, ["transactionHash", "blockNumber", ...receipt.nonce === void 0 ? [] : ["nonce"]], name);
|
|
57774
58072
|
return Object.freeze({
|
|
57775
|
-
transactionHash: string4(receipt.transactionHash, `${name} transaction hash`, HASH2),
|
|
58073
|
+
transactionHash: receipt.transactionHash === null ? null : string4(receipt.transactionHash, `${name} transaction hash`, HASH2),
|
|
58074
|
+
...receipt.nonce === void 0 ? {} : { nonce: integer2(receipt.nonce, `${name} nonce`, 0) },
|
|
57776
58075
|
blockNumber: receipt.blockNumber === null ? null : string4(receipt.blockNumber, `${name} block number`, /^[1-9][0-9]*$/u)
|
|
57777
58076
|
});
|
|
57778
58077
|
}
|
|
@@ -57821,20 +58120,20 @@ function recoveryJournal(value, fingerprint, kind, context) {
|
|
|
57821
58120
|
"targetVersion",
|
|
57822
58121
|
"requests",
|
|
57823
58122
|
"receipts",
|
|
57824
|
-
...journal.version === 5 || journal.version === 6 ? ["sourceHash"] : [],
|
|
57825
|
-
...journal.version
|
|
58123
|
+
...journal.version === 5 || journal.version === 6 || journal.version === 7 ? ["sourceHash"] : [],
|
|
58124
|
+
...Number(journal.version) >= 6 ? ["pendingStage"] : [],
|
|
57826
58125
|
...journal.intentId === void 0 ? [] : ["intentId", "origin"]
|
|
57827
58126
|
], "Skill publication recovery");
|
|
57828
58127
|
if (journal.intentId !== void 0 && (typeof journal.intentId !== "string" || !UUID.test(journal.intentId) || journal.origin !== context.origin)) throw new TypeError("Skill recovery endpoint or intent is invalid.");
|
|
57829
58128
|
const chainId = skillChain(journal.chainId, "Skill recovery chain");
|
|
57830
|
-
if (journal.version !== 4 && journal.version !== 5 && journal.version !== 6 || journal.kind !== kind || journal.fingerprint !== fingerprint || !/^[0-9a-f]{64}$/u.test(fingerprint) || typeof journal.walletAddress !== "string" || journal.walletAddress.toLowerCase() !== context.walletAddress.toLowerCase()) throw new TypeError("Skill publication recovery authority does not match this command.");
|
|
58129
|
+
if (journal.version !== 4 && journal.version !== 5 && journal.version !== 6 && journal.version !== 7 || journal.kind !== kind || journal.fingerprint !== fingerprint || !/^[0-9a-f]{64}$/u.test(fingerprint) || typeof journal.walletAddress !== "string" || journal.walletAddress.toLowerCase() !== context.walletAddress.toLowerCase()) throw new TypeError("Skill publication recovery authority does not match this command.");
|
|
57831
58130
|
const recoveredAuthority = assertPublicationAuthority(
|
|
57832
58131
|
signingAuthority(journal.signingAuthority, context.walletAddress),
|
|
57833
58132
|
context
|
|
57834
58133
|
);
|
|
57835
58134
|
string4(journal.packageHash, "Skill recovery package hash", HASH2);
|
|
57836
|
-
if (journal.version === 5 || journal.version === 6) string4(journal.sourceHash, "Skill recovery source hash", HASH2);
|
|
57837
|
-
if (journal.version
|
|
58135
|
+
if (journal.version === 5 || journal.version === 6 || journal.version === 7) string4(journal.sourceHash, "Skill recovery source hash", HASH2);
|
|
58136
|
+
if (Number(journal.version) >= 6 && journal.pendingStage !== null && !["primary", "uri", "lit"].includes(String(journal.pendingStage))) {
|
|
57838
58137
|
throw new TypeError("Skill recovery pending stage is invalid.");
|
|
57839
58138
|
}
|
|
57840
58139
|
const encodedPackage = string4(journal.packageBytesBase64, "Skill recovery package bytes");
|
|
@@ -57922,11 +58221,11 @@ var init_skill_local_flow = __esm({
|
|
|
57922
58221
|
} catch (cause) {
|
|
57923
58222
|
const journal = progress.journal;
|
|
57924
58223
|
const unconfirmed = journal ? unconfirmedActions(journal) : [];
|
|
57925
|
-
if (journal &&
|
|
58224
|
+
if (journal && journal.pendingStage != null) {
|
|
57926
58225
|
progress.uncertain = true;
|
|
57927
58226
|
}
|
|
57928
58227
|
const transactionHashes = Object.fromEntries([
|
|
57929
|
-
...Object.entries(progress.journal?.receipts ?? {}).flatMap(([stage, receipt]) => receipt && HASH2.test(receipt.transactionHash) ? [[stage, receipt.transactionHash]] : []),
|
|
58228
|
+
...Object.entries(progress.journal?.receipts ?? {}).flatMap(([stage, receipt]) => receipt && typeof receipt.transactionHash === "string" && HASH2.test(receipt.transactionHash) ? [[stage, receipt.transactionHash]] : []),
|
|
57930
58229
|
...Object.entries(progress.broadcast ?? {}).filter(([, hash5]) => HASH2.test(hash5))
|
|
57931
58230
|
]);
|
|
57932
58231
|
const fingerprint = progress.journal && progress.fingerprint ? progress.fingerprint : progress.walletFingerprint ?? null;
|
|
@@ -57936,8 +58235,8 @@ var init_skill_local_flow = __esm({
|
|
|
57936
58235
|
transactionHashes,
|
|
57937
58236
|
unconfirmedActions: unconfirmed,
|
|
57938
58237
|
submissionStatus: progress.uncertain ? "uncertain" : Object.keys(transactionHashes).length ? "hash_known" : "not_attempted",
|
|
57939
|
-
recoveryCommand: progress.journalSaved &&
|
|
57940
|
-
resubmitSafe: progress.resubmitSafe === true
|
|
58238
|
+
recoveryCommand: progress.journalSaved && progress.phase !== "cleanup" && fingerprint ? `finch skill recover ${progress.walletFingerprint ? "intent" : "publication"} ${fingerprint}` : null,
|
|
58239
|
+
resubmitSafe: progress.resubmitSafe === true || journal !== void 0
|
|
57941
58240
|
}, cause);
|
|
57942
58241
|
}
|
|
57943
58242
|
}
|
|
@@ -57950,14 +58249,15 @@ var init_skill_local_flow = __esm({
|
|
|
57950
58249
|
async recoverPublication(fingerprint, context) {
|
|
57951
58250
|
return this.publication((progress) => this.recoverWithProgress(fingerprint, context, progress));
|
|
57952
58251
|
}
|
|
57953
|
-
async send(context, action, request2, prepared, authority, onBroadcast) {
|
|
58252
|
+
async send(context, action, request2, prepared, authority, onBroadcast, onSending) {
|
|
57954
58253
|
return required2(this.sender.submitPrepared, "Skill prepared-intent sender").call(this.sender, {
|
|
57955
58254
|
privateKey: context.privateKey,
|
|
57956
58255
|
walletAddress: context.walletAddress,
|
|
57957
58256
|
action,
|
|
57958
58257
|
request: request2,
|
|
57959
58258
|
intent: authority === void 0 ? intent(prepared, context.walletAddress) : legacyIntent(prepared, context.walletAddress, authority),
|
|
57960
|
-
onBroadcast
|
|
58259
|
+
onBroadcast,
|
|
58260
|
+
onSending
|
|
57961
58261
|
});
|
|
57962
58262
|
}
|
|
57963
58263
|
async upload(input) {
|
|
@@ -58087,6 +58387,10 @@ var init_skill_local_flow = __esm({
|
|
|
58087
58387
|
chain: sealed.chain
|
|
58088
58388
|
};
|
|
58089
58389
|
}
|
|
58390
|
+
async currentVersion(context, chainId, skillId) {
|
|
58391
|
+
if (this.sender.readCurrentVersion) return this.sender.readCurrentVersion({ privateKey: context.privateKey, walletAddress: context.walletAddress, chainId, skillId });
|
|
58392
|
+
return required2(this.api.readSkillCurrentVersion, "Skill version API").call(this.api, chainId, skillId, context.bearer, context.intentId);
|
|
58393
|
+
}
|
|
58090
58394
|
async settle(read2, name) {
|
|
58091
58395
|
for (let attempt2 = 0; attempt2 < 60; attempt2 += 1) {
|
|
58092
58396
|
if (await read2()) return;
|
|
@@ -58094,13 +58398,14 @@ var init_skill_local_flow = __esm({
|
|
|
58094
58398
|
}
|
|
58095
58399
|
throw new TypeError(`${name} transaction confirmed but the settled chain read did not advance.`);
|
|
58096
58400
|
}
|
|
58097
|
-
async verify(context, action, request2, receipt) {
|
|
58098
|
-
return required2(this.sender.verifyPrepared, "Skill transaction verifier").call(this.sender, { privateKey: context.privateKey, walletAddress: context.walletAddress, action, request: request2, ...receipt });
|
|
58099
|
-
}
|
|
58100
58401
|
async save(fingerprint, journal) {
|
|
58101
58402
|
await required2(this.recovery, "Skill publication recovery").saveSkillPublicationRecovery(fingerprint, journal);
|
|
58102
58403
|
}
|
|
58103
58404
|
async project(chainId, transactionHash3, bearer, intentId, stage, requireReady = true) {
|
|
58405
|
+
if (intentId === void 0 && this.api.confirmLegacySkillProjection) {
|
|
58406
|
+
await this.api.confirmLegacySkillProjection(chainId, transactionHash3, bearer);
|
|
58407
|
+
return;
|
|
58408
|
+
}
|
|
58104
58409
|
if (intentId === void 0 && this.api.confirmSkillProjection === void 0) return;
|
|
58105
58410
|
const status = await required2(this.api.confirmSkillProjection, "Skill projection confirmation").call(this.api, chainId, transactionHash3, bearer, intentId, stage);
|
|
58106
58411
|
if (requireReady && intentId !== void 0 && status !== "projected") throw new TypeError("The Skill transaction is confirmed; presentation projection is pending. Resume the saved Skill recovery to retry projection without sending another transaction.");
|
|
@@ -58110,56 +58415,107 @@ var init_skill_local_flow = __esm({
|
|
|
58110
58415
|
progress.fingerprint = fingerprint;
|
|
58111
58416
|
progress.journalSaved = true;
|
|
58112
58417
|
progress.phase = "transaction";
|
|
58113
|
-
const
|
|
58114
|
-
|
|
58115
|
-
|
|
58116
|
-
|
|
58418
|
+
const read2 = () => required2(this.sender.readPublicationState, "Skill publication chain reader").call(this.sender, {
|
|
58419
|
+
privateKey: context.privateKey,
|
|
58420
|
+
walletAddress: context.walletAddress,
|
|
58421
|
+
request: request2,
|
|
58422
|
+
targetVersion: journal.targetVersion,
|
|
58423
|
+
packageHash: journal.packageHash
|
|
58424
|
+
});
|
|
58425
|
+
const complete = async (state) => {
|
|
58426
|
+
if (!state.completed) return false;
|
|
58427
|
+
const receipt = journal.receipts[stage];
|
|
58428
|
+
journal.receipts[stage] = receipt?.blockNumber ? receipt : { transactionHash: null, blockNumber: state.blockNumber };
|
|
58429
|
+
if (state.skillId !== null && journal.kind === "publish") journal.skillId = state.skillId;
|
|
58430
|
+
journal.pendingStage = null;
|
|
58117
58431
|
await this.save(fingerprint, journal);
|
|
58432
|
+
if (context.intentId !== void 0) await required2(this.api.confirmSkillPublicationState, "Skill chain confirmation API").call(
|
|
58433
|
+
this.api,
|
|
58434
|
+
journal.kind === "version" && stage === "primary" ? { ...request2, packageURI: journal.manifestURI } : request2,
|
|
58435
|
+
context.bearer,
|
|
58436
|
+
context.intentId,
|
|
58437
|
+
stage
|
|
58438
|
+
);
|
|
58118
58439
|
progress.uncertain = false;
|
|
58119
|
-
|
|
58120
|
-
|
|
58121
|
-
|
|
58122
|
-
|
|
58123
|
-
|
|
58124
|
-
|
|
58125
|
-
|
|
58126
|
-
|
|
58127
|
-
|
|
58128
|
-
|
|
58129
|
-
|
|
58130
|
-
|
|
58440
|
+
return true;
|
|
58441
|
+
};
|
|
58442
|
+
journal.sourceHash ??= journal.packageHash;
|
|
58443
|
+
journal.version = 7;
|
|
58444
|
+
journal.pendingStage ??= null;
|
|
58445
|
+
if (await complete(await read2())) return;
|
|
58446
|
+
const existing = journal.receipts[stage];
|
|
58447
|
+
if (existing?.transactionHash) {
|
|
58448
|
+
const resumed = await required2(this.sender.resumePublicationTransaction, "Skill pending transaction recovery").call(this.sender, {
|
|
58449
|
+
privateKey: context.privateKey,
|
|
58450
|
+
walletAddress: context.walletAddress,
|
|
58451
|
+
action,
|
|
58452
|
+
request: request2,
|
|
58453
|
+
transactionHash: existing.transactionHash,
|
|
58454
|
+
blockNumber: existing.blockNumber,
|
|
58455
|
+
...existing.nonce === void 0 ? {} : { nonce: existing.nonce }
|
|
58131
58456
|
});
|
|
58457
|
+
if (resumed !== null) {
|
|
58458
|
+
journal.receipts[stage] = resumed;
|
|
58459
|
+
await this.save(fingerprint, journal);
|
|
58460
|
+
await this.settle(async () => complete(await read2()), `Skill ${action} publication`);
|
|
58461
|
+
await this.project(journal.chainId, resumed.transactionHash, context.bearer, context.intentId, stage, false);
|
|
58462
|
+
return;
|
|
58463
|
+
}
|
|
58464
|
+
journal.receipts[stage] = null;
|
|
58465
|
+
journal.pendingStage = null;
|
|
58466
|
+
await this.save(fingerprint, journal);
|
|
58467
|
+
if (await complete(await read2())) return;
|
|
58132
58468
|
}
|
|
58469
|
+
journal.receipts[stage] = null;
|
|
58470
|
+
journal.pendingStage = null;
|
|
58471
|
+
await this.save(fingerprint, journal);
|
|
58133
58472
|
progress.phase = "intent";
|
|
58134
|
-
const prepared = await prepare();
|
|
58135
|
-
|
|
58136
|
-
|
|
58137
|
-
|
|
58138
|
-
journal.pendingStage = stage;
|
|
58139
|
-
await this.save(fingerprint, journal);
|
|
58473
|
+
const prepared = context.intentId === void 0 && this.api.requestLegacySkillPublicationIntent ? await this.api.requestLegacySkillPublicationIntent(journal.kind === "version" && stage === "primary" ? { ...request2, packageURI: journal.manifestURI } : request2, context.bearer) : await prepare();
|
|
58474
|
+
if (prepared && typeof prepared === "object" && "publicationCompleted" in prepared && prepared.publicationCompleted === true) {
|
|
58475
|
+
if (await complete(await read2())) return;
|
|
58476
|
+
throw new TypeError("Gateway completion could not be confirmed on chain. Retry the same command.");
|
|
58140
58477
|
}
|
|
58141
|
-
progress.
|
|
58142
|
-
|
|
58143
|
-
|
|
58144
|
-
|
|
58145
|
-
|
|
58146
|
-
|
|
58147
|
-
|
|
58148
|
-
|
|
58149
|
-
|
|
58150
|
-
|
|
58151
|
-
if (marks) {
|
|
58478
|
+
progress.phase = "transaction";
|
|
58479
|
+
try {
|
|
58480
|
+
journal.receipts[stage] = await this.send(
|
|
58481
|
+
context,
|
|
58482
|
+
action,
|
|
58483
|
+
request2,
|
|
58484
|
+
prepared,
|
|
58485
|
+
journal.signingAuthority,
|
|
58486
|
+
async ({ transactionHash: transactionHash3 }) => {
|
|
58487
|
+
journal.receipts[stage] = { ...journal.receipts[stage], transactionHash: transactionHash3, blockNumber: null };
|
|
58152
58488
|
journal.pendingStage = null;
|
|
58153
58489
|
await this.save(fingerprint, journal);
|
|
58490
|
+
},
|
|
58491
|
+
async (checkpoint) => {
|
|
58492
|
+
journal.pendingStage = stage;
|
|
58493
|
+
if (checkpoint !== void 0) journal.receipts[stage] = { ...checkpoint, blockNumber: null };
|
|
58494
|
+
await this.save(fingerprint, journal);
|
|
58154
58495
|
}
|
|
58155
|
-
|
|
58496
|
+
);
|
|
58497
|
+
} catch (cause) {
|
|
58498
|
+
let state;
|
|
58499
|
+
try {
|
|
58500
|
+
state = await read2();
|
|
58501
|
+
} catch {
|
|
58502
|
+
throw cause;
|
|
58156
58503
|
}
|
|
58157
|
-
|
|
58158
|
-
|
|
58504
|
+
if (await complete(state)) return;
|
|
58505
|
+
if (cause instanceof SkillPublicationTransactionFailedError) {
|
|
58506
|
+
journal.receipts[stage] = null;
|
|
58507
|
+
journal.pendingStage = null;
|
|
58508
|
+
await this.save(fingerprint, journal);
|
|
58509
|
+
}
|
|
58510
|
+
throw cause;
|
|
58511
|
+
}
|
|
58512
|
+
journal.pendingStage = null;
|
|
58159
58513
|
await this.save(fingerprint, journal);
|
|
58160
58514
|
progress.uncertain = false;
|
|
58515
|
+
const submitted = required2(journal.receipts[stage].transactionHash, "Skill transaction hash");
|
|
58516
|
+
await this.settle(async () => complete(await read2()), `Skill ${action} publication`);
|
|
58161
58517
|
progress.phase = "projection";
|
|
58162
|
-
await this.project(journal.chainId,
|
|
58518
|
+
await this.project(journal.chainId, submitted, context.bearer, context.intentId, stage, false);
|
|
58163
58519
|
}
|
|
58164
58520
|
async recoverWithProgress(fingerprint, context, progress) {
|
|
58165
58521
|
progress.phase = "recovery";
|
|
@@ -58193,7 +58549,7 @@ var init_skill_local_flow = __esm({
|
|
|
58193
58549
|
const slug = string4(journal.requests.primary.slug, "Skill recovery slug");
|
|
58194
58550
|
let skillId2 = journal.skillId;
|
|
58195
58551
|
await this.settle(async () => {
|
|
58196
|
-
skillId2 = await required2(this.api.resolveSkillId, "Skill resolve API").call(
|
|
58552
|
+
skillId2 = journal.skillId ?? await required2(this.api.resolveSkillId, "Skill resolve API").call(
|
|
58197
58553
|
this.api,
|
|
58198
58554
|
journal.chainId,
|
|
58199
58555
|
slug,
|
|
@@ -58259,13 +58615,7 @@ var init_skill_local_flow = __esm({
|
|
|
58259
58615
|
() => required2(this.api.requestSkillIntent, "Skill intent API").call(this.api, journal.kind === "version" ? { ...journal.requests.primary, packageURI: journal.manifestURI } : journal.requests.primary, context.bearer, context.intentId)
|
|
58260
58616
|
);
|
|
58261
58617
|
await this.settle(
|
|
58262
|
-
async () => await
|
|
58263
|
-
this.api,
|
|
58264
|
-
journal.chainId,
|
|
58265
|
-
skillId,
|
|
58266
|
-
context.bearer,
|
|
58267
|
-
context.intentId
|
|
58268
|
-
) === journal.targetVersion,
|
|
58618
|
+
async () => await this.currentVersion(context, journal.chainId, skillId) === journal.targetVersion,
|
|
58269
58619
|
`Skill ${skillId} version ${journal.targetVersion}`
|
|
58270
58620
|
);
|
|
58271
58621
|
const uriRequest = required2(journal.requests.uri, "Skill URI recovery request");
|
|
@@ -58375,7 +58725,7 @@ var init_skill_local_flow = __esm({
|
|
|
58375
58725
|
objectKind: "manifest"
|
|
58376
58726
|
});
|
|
58377
58727
|
const chainMetadata = Object.fromEntries(
|
|
58378
|
-
Object.entries(request2).filter(([key]) => key !== "sourceKind" && key !== "contentMode" && key !== "summary")
|
|
58728
|
+
Object.entries(request2).filter(([key]) => key !== "sourceKind" && key !== "contentMode" && key !== "summary" && key !== "sourceLocale")
|
|
58379
58729
|
);
|
|
58380
58730
|
const createRequest = {
|
|
58381
58731
|
action: "createSkill",
|
|
@@ -58386,7 +58736,7 @@ var init_skill_local_flow = __esm({
|
|
|
58386
58736
|
packageURI: manifestURI
|
|
58387
58737
|
};
|
|
58388
58738
|
journal = {
|
|
58389
|
-
version:
|
|
58739
|
+
version: 7,
|
|
58390
58740
|
...context.intentId === void 0 ? {} : { intentId: context.intentId, origin: context.origin },
|
|
58391
58741
|
pendingStage: null,
|
|
58392
58742
|
sourceHash: packaged.packageHash,
|
|
@@ -58426,7 +58776,7 @@ var init_skill_local_flow = __esm({
|
|
|
58426
58776
|
);
|
|
58427
58777
|
let skillId = journal.skillId;
|
|
58428
58778
|
await this.settle(async () => {
|
|
58429
|
-
skillId = await required2(this.api.resolveSkillId, "Skill resolve API").call(
|
|
58779
|
+
skillId = journal.skillId ?? await required2(this.api.resolveSkillId, "Skill resolve API").call(
|
|
58430
58780
|
this.api,
|
|
58431
58781
|
journal.chainId,
|
|
58432
58782
|
String(request2.slug),
|
|
@@ -58478,13 +58828,7 @@ var init_skill_local_flow = __esm({
|
|
|
58478
58828
|
progress.fingerprint = fingerprint;
|
|
58479
58829
|
progress.journalSaved = true;
|
|
58480
58830
|
}
|
|
58481
|
-
const observedVersion = await
|
|
58482
|
-
this.api,
|
|
58483
|
-
plan.chainId,
|
|
58484
|
-
String(plan.request.skillId),
|
|
58485
|
-
context.bearer,
|
|
58486
|
-
context.intentId
|
|
58487
|
-
);
|
|
58831
|
+
const observedVersion = await this.currentVersion(context, plan.chainId, String(plan.request.skillId));
|
|
58488
58832
|
if (prior === null && observedVersion !== plan.currentVersion) {
|
|
58489
58833
|
throw new TypeError(`Skill current version ${observedVersion} no longer matches plan version ${plan.currentVersion}.`);
|
|
58490
58834
|
}
|
|
@@ -58533,7 +58877,7 @@ var init_skill_local_flow = __esm({
|
|
|
58533
58877
|
const updateRequest = { action: "updateSkill", chainId: plan.chainId, skillId: plan.request.skillId, mdHash: packaged.mdHash, packageHash: entry2.packageHash, packageURI: manifestURI };
|
|
58534
58878
|
const uriRequest2 = { action: "setSkillURI", chainId: plan.chainId, skillId: plan.request.skillId, packageURI: manifestURI };
|
|
58535
58879
|
journal = {
|
|
58536
|
-
version:
|
|
58880
|
+
version: 7,
|
|
58537
58881
|
...context.intentId === void 0 ? {} : { intentId: context.intentId, origin: context.origin },
|
|
58538
58882
|
pendingStage: null,
|
|
58539
58883
|
sourceHash: packaged.packageHash,
|
|
@@ -58571,13 +58915,7 @@ var init_skill_local_flow = __esm({
|
|
|
58571
58915
|
journal.requests.primary,
|
|
58572
58916
|
() => required2(this.api.requestSkillIntent, "Skill intent API").call(this.api, journal.kind === "version" ? { ...journal.requests.primary, packageURI: journal.manifestURI } : journal.requests.primary, context.bearer, context.intentId)
|
|
58573
58917
|
);
|
|
58574
|
-
await this.settle(async () => await
|
|
58575
|
-
this.api,
|
|
58576
|
-
journal.chainId,
|
|
58577
|
-
String(plan.request.skillId),
|
|
58578
|
-
context.bearer,
|
|
58579
|
-
context.intentId
|
|
58580
|
-
) === plan.nextVersion, `Skill ${plan.request.skillId} version ${plan.nextVersion}`);
|
|
58918
|
+
await this.settle(async () => await this.currentVersion(context, journal.chainId, String(plan.request.skillId)) === plan.nextVersion, `Skill ${plan.request.skillId} version ${plan.nextVersion}`);
|
|
58581
58919
|
const uriRequest = required2(journal.requests.uri, "Skill URI recovery request");
|
|
58582
58920
|
await this.stage(
|
|
58583
58921
|
progress,
|
|
@@ -59419,14 +59757,14 @@ var init_application = __esm({
|
|
|
59419
59757
|
}
|
|
59420
59758
|
async loginSite(requestUrl) {
|
|
59421
59759
|
const profile = await this.authorizedProfile();
|
|
59422
|
-
let
|
|
59760
|
+
let parsed3;
|
|
59423
59761
|
try {
|
|
59424
|
-
|
|
59762
|
+
parsed3 = new URL(requestUrl);
|
|
59425
59763
|
} catch {
|
|
59426
59764
|
throw new TypeError("Browser login request URL is invalid.");
|
|
59427
59765
|
}
|
|
59428
|
-
const match = /^\/auth\/agent\/request\/([0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12})$/u.exec(
|
|
59429
|
-
if (
|
|
59766
|
+
const match = /^\/auth\/agent\/request\/([0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12})$/u.exec(parsed3.pathname);
|
|
59767
|
+
if (parsed3.origin !== profile.origin || requestUrl !== `${profile.origin}${parsed3.pathname}` || parsed3.search !== "" || parsed3.hash !== "" || match === null) {
|
|
59430
59768
|
throw new TypeError("Browser login request origin or path does not match the active profile origin.");
|
|
59431
59769
|
}
|
|
59432
59770
|
const authority = await this.verifiedAgentCliAuthority();
|
|
@@ -61108,20 +61446,20 @@ var require_resolveCommand = __commonJS({
|
|
|
61108
61446
|
var path2 = __require("path");
|
|
61109
61447
|
var which = require_which();
|
|
61110
61448
|
var getPathKey = require_path_key();
|
|
61111
|
-
function resolveCommandAttempt(
|
|
61112
|
-
const env =
|
|
61449
|
+
function resolveCommandAttempt(parsed3, withoutPathExt) {
|
|
61450
|
+
const env = parsed3.options.env || process.env;
|
|
61113
61451
|
const cwd = process.cwd();
|
|
61114
|
-
const hasCustomCwd =
|
|
61452
|
+
const hasCustomCwd = parsed3.options.cwd != null;
|
|
61115
61453
|
const shouldSwitchCwd = hasCustomCwd && process.chdir !== void 0 && !process.chdir.disabled;
|
|
61116
61454
|
if (shouldSwitchCwd) {
|
|
61117
61455
|
try {
|
|
61118
|
-
process.chdir(
|
|
61456
|
+
process.chdir(parsed3.options.cwd);
|
|
61119
61457
|
} catch (err2) {
|
|
61120
61458
|
}
|
|
61121
61459
|
}
|
|
61122
61460
|
let resolved;
|
|
61123
61461
|
try {
|
|
61124
|
-
resolved = which.sync(
|
|
61462
|
+
resolved = which.sync(parsed3.command, {
|
|
61125
61463
|
path: env[getPathKey({ env })],
|
|
61126
61464
|
pathExt: withoutPathExt ? path2.delimiter : void 0
|
|
61127
61465
|
});
|
|
@@ -61132,12 +61470,12 @@ var require_resolveCommand = __commonJS({
|
|
|
61132
61470
|
}
|
|
61133
61471
|
}
|
|
61134
61472
|
if (resolved) {
|
|
61135
|
-
resolved = path2.resolve(hasCustomCwd ?
|
|
61473
|
+
resolved = path2.resolve(hasCustomCwd ? parsed3.options.cwd : "", resolved);
|
|
61136
61474
|
}
|
|
61137
61475
|
return resolved;
|
|
61138
61476
|
}
|
|
61139
|
-
function resolveCommand(
|
|
61140
|
-
return resolveCommandAttempt(
|
|
61477
|
+
function resolveCommand(parsed3) {
|
|
61478
|
+
return resolveCommandAttempt(parsed3) || resolveCommandAttempt(parsed3, true);
|
|
61141
61479
|
}
|
|
61142
61480
|
module.exports = resolveCommand;
|
|
61143
61481
|
}
|
|
@@ -61229,33 +61567,33 @@ var require_parse = __commonJS({
|
|
|
61229
61567
|
var isWin = process.platform === "win32";
|
|
61230
61568
|
var isExecutableRegExp = /\.(?:com|exe)$/i;
|
|
61231
61569
|
var isCmdShimRegExp = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
|
|
61232
|
-
function detectShebang(
|
|
61233
|
-
|
|
61234
|
-
const shebang =
|
|
61570
|
+
function detectShebang(parsed3) {
|
|
61571
|
+
parsed3.file = resolveCommand(parsed3);
|
|
61572
|
+
const shebang = parsed3.file && readShebang(parsed3.file);
|
|
61235
61573
|
if (shebang) {
|
|
61236
|
-
|
|
61237
|
-
|
|
61238
|
-
return resolveCommand(
|
|
61574
|
+
parsed3.args.unshift(parsed3.file);
|
|
61575
|
+
parsed3.command = shebang;
|
|
61576
|
+
return resolveCommand(parsed3);
|
|
61239
61577
|
}
|
|
61240
|
-
return
|
|
61578
|
+
return parsed3.file;
|
|
61241
61579
|
}
|
|
61242
|
-
function parseNonShell(
|
|
61580
|
+
function parseNonShell(parsed3) {
|
|
61243
61581
|
if (!isWin) {
|
|
61244
|
-
return
|
|
61582
|
+
return parsed3;
|
|
61245
61583
|
}
|
|
61246
|
-
const commandFile = detectShebang(
|
|
61584
|
+
const commandFile = detectShebang(parsed3);
|
|
61247
61585
|
const needsShell = !isExecutableRegExp.test(commandFile);
|
|
61248
|
-
if (
|
|
61586
|
+
if (parsed3.options.forceShell || needsShell) {
|
|
61249
61587
|
const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
|
|
61250
|
-
|
|
61251
|
-
|
|
61252
|
-
|
|
61253
|
-
const shellCommand = [
|
|
61254
|
-
|
|
61255
|
-
|
|
61256
|
-
|
|
61588
|
+
parsed3.command = path2.normalize(parsed3.command);
|
|
61589
|
+
parsed3.command = escape2.command(parsed3.command);
|
|
61590
|
+
parsed3.args = parsed3.args.map((arg) => escape2.argument(arg, needsDoubleEscapeMetaChars));
|
|
61591
|
+
const shellCommand = [parsed3.command].concat(parsed3.args).join(" ");
|
|
61592
|
+
parsed3.args = ["/d", "/s", "/c", `"${shellCommand}"`];
|
|
61593
|
+
parsed3.command = process.env.comspec || "cmd.exe";
|
|
61594
|
+
parsed3.options.windowsVerbatimArguments = true;
|
|
61257
61595
|
}
|
|
61258
|
-
return
|
|
61596
|
+
return parsed3;
|
|
61259
61597
|
}
|
|
61260
61598
|
function parse4(command, args, options) {
|
|
61261
61599
|
if (args && !Array.isArray(args)) {
|
|
@@ -61264,7 +61602,7 @@ var require_parse = __commonJS({
|
|
|
61264
61602
|
}
|
|
61265
61603
|
args = args ? args.slice(0) : [];
|
|
61266
61604
|
options = Object.assign({}, options);
|
|
61267
|
-
const
|
|
61605
|
+
const parsed3 = {
|
|
61268
61606
|
command,
|
|
61269
61607
|
args,
|
|
61270
61608
|
options,
|
|
@@ -61274,7 +61612,7 @@ var require_parse = __commonJS({
|
|
|
61274
61612
|
args
|
|
61275
61613
|
}
|
|
61276
61614
|
};
|
|
61277
|
-
return options.shell ?
|
|
61615
|
+
return options.shell ? parsed3 : parseNonShell(parsed3);
|
|
61278
61616
|
}
|
|
61279
61617
|
module.exports = parse4;
|
|
61280
61618
|
}
|
|
@@ -61294,14 +61632,14 @@ var require_enoent = __commonJS({
|
|
|
61294
61632
|
spawnargs: original.args
|
|
61295
61633
|
});
|
|
61296
61634
|
}
|
|
61297
|
-
function hookChildProcess(cp,
|
|
61635
|
+
function hookChildProcess(cp, parsed3) {
|
|
61298
61636
|
if (!isWin) {
|
|
61299
61637
|
return;
|
|
61300
61638
|
}
|
|
61301
61639
|
const originalEmit = cp.emit;
|
|
61302
61640
|
cp.emit = function(name, arg1) {
|
|
61303
61641
|
if (name === "exit") {
|
|
61304
|
-
const err2 = verifyENOENT(arg1,
|
|
61642
|
+
const err2 = verifyENOENT(arg1, parsed3);
|
|
61305
61643
|
if (err2) {
|
|
61306
61644
|
return originalEmit.call(cp, "error", err2);
|
|
61307
61645
|
}
|
|
@@ -61309,15 +61647,15 @@ var require_enoent = __commonJS({
|
|
|
61309
61647
|
return originalEmit.apply(cp, arguments);
|
|
61310
61648
|
};
|
|
61311
61649
|
}
|
|
61312
|
-
function verifyENOENT(status,
|
|
61313
|
-
if (isWin && status === 1 && !
|
|
61314
|
-
return notFoundError(
|
|
61650
|
+
function verifyENOENT(status, parsed3) {
|
|
61651
|
+
if (isWin && status === 1 && !parsed3.file) {
|
|
61652
|
+
return notFoundError(parsed3.original, "spawn");
|
|
61315
61653
|
}
|
|
61316
61654
|
return null;
|
|
61317
61655
|
}
|
|
61318
|
-
function verifyENOENTSync(status,
|
|
61319
|
-
if (isWin && status === 1 && !
|
|
61320
|
-
return notFoundError(
|
|
61656
|
+
function verifyENOENTSync(status, parsed3) {
|
|
61657
|
+
if (isWin && status === 1 && !parsed3.file) {
|
|
61658
|
+
return notFoundError(parsed3.original, "spawnSync");
|
|
61321
61659
|
}
|
|
61322
61660
|
return null;
|
|
61323
61661
|
}
|
|
@@ -61338,15 +61676,15 @@ var require_cross_spawn = __commonJS({
|
|
|
61338
61676
|
var parse4 = require_parse();
|
|
61339
61677
|
var enoent = require_enoent();
|
|
61340
61678
|
function spawn2(command, args, options) {
|
|
61341
|
-
const
|
|
61342
|
-
const spawned = cp.spawn(
|
|
61343
|
-
enoent.hookChildProcess(spawned,
|
|
61679
|
+
const parsed3 = parse4(command, args, options);
|
|
61680
|
+
const spawned = cp.spawn(parsed3.command, parsed3.args, parsed3.options);
|
|
61681
|
+
enoent.hookChildProcess(spawned, parsed3);
|
|
61344
61682
|
return spawned;
|
|
61345
61683
|
}
|
|
61346
61684
|
function spawnSync2(command, args, options) {
|
|
61347
|
-
const
|
|
61348
|
-
const result2 = cp.spawnSync(
|
|
61349
|
-
result2.error = result2.error || enoent.verifyENOENTSync(result2.status,
|
|
61685
|
+
const parsed3 = parse4(command, args, options);
|
|
61686
|
+
const result2 = cp.spawnSync(parsed3.command, parsed3.args, parsed3.options);
|
|
61687
|
+
result2.error = result2.error || enoent.verifyENOENTSync(result2.status, parsed3);
|
|
61350
61688
|
return result2;
|
|
61351
61689
|
}
|
|
61352
61690
|
module.exports = spawn2;
|
|
@@ -61812,12 +62150,12 @@ function environment2(value) {
|
|
|
61812
62150
|
}
|
|
61813
62151
|
function endpointOrigin(value) {
|
|
61814
62152
|
if (typeof value !== "string" || !URL.canParse(value)) throw new CliStateError("CLI_STATE_CORRUPT");
|
|
61815
|
-
const
|
|
61816
|
-
const loopbackHttp =
|
|
61817
|
-
if (
|
|
62153
|
+
const parsed3 = new URL(value);
|
|
62154
|
+
const loopbackHttp = parsed3.protocol === "http:" && ["127.0.0.1", "localhost", "[::1]"].includes(parsed3.hostname);
|
|
62155
|
+
if (parsed3.origin !== value || parsed3.username !== "" || parsed3.password !== "" || parsed3.pathname !== "/" || parsed3.search !== "" || parsed3.hash !== "" || parsed3.protocol !== "https:" && !loopbackHttp) {
|
|
61818
62156
|
throw new CliStateError("CLI_STATE_CORRUPT");
|
|
61819
62157
|
}
|
|
61820
|
-
return
|
|
62158
|
+
return parsed3.origin;
|
|
61821
62159
|
}
|
|
61822
62160
|
function secretRecord(value, name) {
|
|
61823
62161
|
try {
|
|
@@ -62773,11 +63111,11 @@ var init_custody_chains = __esm({
|
|
|
62773
63111
|
|
|
62774
63112
|
// src/purchase-sender.ts
|
|
62775
63113
|
function parseRpcUrl(value) {
|
|
62776
|
-
const
|
|
62777
|
-
if (
|
|
63114
|
+
const parsed3 = new URL(value);
|
|
63115
|
+
if (parsed3.protocol !== "https:" || parsed3.username !== "" || parsed3.password !== "" || parsed3.hash !== "") {
|
|
62778
63116
|
throw new TypeError("The reviewed Agent RPC must be HTTPS without userinfo or fragment.");
|
|
62779
63117
|
}
|
|
62780
|
-
return
|
|
63118
|
+
return parsed3.href;
|
|
62781
63119
|
}
|
|
62782
63120
|
function privateKey2(value) {
|
|
62783
63121
|
if (!/^0x[0-9a-f]{64}$/u.test(value)) {
|
|
@@ -63072,11 +63410,11 @@ var init_purchase_sender = __esm({
|
|
|
63072
63410
|
|
|
63073
63411
|
// src/task-protocol-sender.ts
|
|
63074
63412
|
function parseRpcUrl2(value) {
|
|
63075
|
-
const
|
|
63076
|
-
if (
|
|
63413
|
+
const parsed3 = new URL(value);
|
|
63414
|
+
if (parsed3.protocol !== "https:" || parsed3.username !== "" || parsed3.password !== "" || parsed3.hash !== "") {
|
|
63077
63415
|
throw new TypeError("The reviewed Task RPC must be HTTPS without userinfo or fragment.");
|
|
63078
63416
|
}
|
|
63079
|
-
return
|
|
63417
|
+
return parsed3.href;
|
|
63080
63418
|
}
|
|
63081
63419
|
function installedPrivateKey(value) {
|
|
63082
63420
|
if (!/^0x[0-9a-f]{64}$/u.test(value)) throw new TypeError("The installed wallet private key is invalid.");
|
|
@@ -63102,9 +63440,9 @@ function unsigned(value, name) {
|
|
|
63102
63440
|
}
|
|
63103
63441
|
function uint642(value, name) {
|
|
63104
63442
|
if (!Number.isSafeInteger(value) || Number(value) < 0) throw new TypeError(`${name} is invalid.`);
|
|
63105
|
-
const
|
|
63106
|
-
if (
|
|
63107
|
-
return
|
|
63443
|
+
const parsed3 = BigInt(Number(value));
|
|
63444
|
+
if (parsed3 > 18446744073709551615n) throw new TypeError(`${name} is invalid.`);
|
|
63445
|
+
return parsed3;
|
|
63108
63446
|
}
|
|
63109
63447
|
function uint16(value, name) {
|
|
63110
63448
|
if (!Number.isSafeInteger(value) || Number(value) < 0 || Number(value) > 65535) {
|
|
@@ -63452,11 +63790,11 @@ var init_task_protocol_sender = __esm({
|
|
|
63452
63790
|
|
|
63453
63791
|
// src/skill-intent-sender.ts
|
|
63454
63792
|
function parseRpcUrl3(value) {
|
|
63455
|
-
const
|
|
63456
|
-
if (
|
|
63793
|
+
const parsed3 = new URL(value);
|
|
63794
|
+
if (parsed3.protocol !== "https:" || parsed3.username !== "" || parsed3.password !== "" || parsed3.hash !== "") {
|
|
63457
63795
|
throw new TypeError("The reviewed Skill RPC must be HTTPS without userinfo or fragment.");
|
|
63458
63796
|
}
|
|
63459
|
-
return
|
|
63797
|
+
return parsed3.href;
|
|
63460
63798
|
}
|
|
63461
63799
|
function installedPrivateKey2(value) {
|
|
63462
63800
|
if (!/^0x[0-9a-f]{64}$/u.test(value)) throw new TypeError("The installed wallet private key is invalid.");
|
|
@@ -63485,7 +63823,7 @@ function textValue(value, name, allowEmpty = false) {
|
|
|
63485
63823
|
return value;
|
|
63486
63824
|
}
|
|
63487
63825
|
function resolveSkillViemChain(chainId) {
|
|
63488
|
-
const chain = [mainnet, optimism, bsc, base2, arbitrum, avalanche, baseSepolia].find((candidate) => candidate.id === chainId);
|
|
63826
|
+
const chain = [mainnet, optimism, bsc, base2, arbitrum, avalanche, injective, baseSepolia].find((candidate) => candidate.id === chainId);
|
|
63489
63827
|
if (chain !== void 0) return chain;
|
|
63490
63828
|
throw new TypeError(`Unsupported Skill chain ${String(chainId)}.`);
|
|
63491
63829
|
}
|
|
@@ -63553,11 +63891,23 @@ function assertIntentMatches(raw, expected, chainId) {
|
|
|
63553
63891
|
throw new TypeError("Skill intent calldata, target, or value does not match its reviewed request.");
|
|
63554
63892
|
}
|
|
63555
63893
|
}
|
|
63894
|
+
async function rpcOperation(method2, operation3) {
|
|
63895
|
+
try {
|
|
63896
|
+
return await operation3();
|
|
63897
|
+
} catch (cause) {
|
|
63898
|
+
throw Object.assign(new Error(cause instanceof Error ? cause.message : "Skill RPC failed.", { cause }), { method: typeof method2 === "function" ? method2() : method2 });
|
|
63899
|
+
}
|
|
63900
|
+
}
|
|
63901
|
+
function receiptFailure(action) {
|
|
63902
|
+
return ["createSkill", "updateSkill", "setSkillURI", "setLitData"].includes(action) ? new SkillPublicationTransactionFailedError() : new TypeError("Skill transaction reverted.");
|
|
63903
|
+
}
|
|
63556
63904
|
var import_ajv4, instanceAbi, tokenAbi, revenueAbi, factoryAbi, validateIntent2, viemFactory2, InstalledSkillIntentSender;
|
|
63557
63905
|
var init_skill_intent_sender = __esm({
|
|
63558
63906
|
"src/skill-intent-sender.ts"() {
|
|
63559
63907
|
"use strict";
|
|
63560
63908
|
import_ajv4 = __toESM(require_ajv(), 1);
|
|
63909
|
+
init_cli_error();
|
|
63910
|
+
init_cli_error();
|
|
63561
63911
|
init_client();
|
|
63562
63912
|
init_chains();
|
|
63563
63913
|
init_esm2();
|
|
@@ -63567,11 +63917,16 @@ var init_skill_intent_sender = __esm({
|
|
|
63567
63917
|
instanceAbi = parseAbi([
|
|
63568
63918
|
"function purchase(uint256 skillId, uint64 version, uint256 quantity) payable",
|
|
63569
63919
|
"function convert(uint256 skillId, uint64 fromVersion, uint64 toVersion, uint256 quantity)",
|
|
63570
|
-
"function setLitData(uint256 skillId, uint64 version, string ciphertext, string scheme, string chain)"
|
|
63920
|
+
"function setLitData(uint256 skillId, uint64 version, string ciphertext, string scheme, string chain)",
|
|
63921
|
+
"function litDataSet(uint256 skillId, uint64 version) view returns (bool)"
|
|
63571
63922
|
]);
|
|
63572
63923
|
tokenAbi = parseAbi([
|
|
63573
63924
|
"function updateSkill(uint256 skillId, bytes32 mdHash, bytes32 packageHash)",
|
|
63574
|
-
"function setSkillURI(uint256 skillId, string packageURI)"
|
|
63925
|
+
"function setSkillURI(uint256 skillId, string packageURI)",
|
|
63926
|
+
"function skillIdBySlug(string slug) view returns (uint256)",
|
|
63927
|
+
"function ownerOf(uint256 skillId) view returns (address)",
|
|
63928
|
+
"function skillOf(uint256 skillId) view returns ((bytes32 mdHash, bytes32 packageHash, uint64 version))",
|
|
63929
|
+
"function skillURI(uint256 skillId) view returns (string)"
|
|
63575
63930
|
]);
|
|
63576
63931
|
revenueAbi = parseAbi([
|
|
63577
63932
|
"function setUnitPrice(uint256 skillId, uint256 unitPrice)",
|
|
@@ -63593,7 +63948,26 @@ var init_skill_intent_sender = __esm({
|
|
|
63593
63948
|
simulateTransaction: async (input) => {
|
|
63594
63949
|
await publicClient.call({ account, ...input });
|
|
63595
63950
|
},
|
|
63596
|
-
sendTransaction: (input) =>
|
|
63951
|
+
sendTransaction: async (input, onSending) => {
|
|
63952
|
+
const transaction2 = await walletClient.prepareTransactionRequest({ account, chain, ...input });
|
|
63953
|
+
const serializedTransaction = await walletClient.signTransaction(transaction2);
|
|
63954
|
+
await onSending?.({ transactionHash: keccak256(serializedTransaction), nonce: transaction2.nonce });
|
|
63955
|
+
return walletClient.sendRawTransaction({ serializedTransaction });
|
|
63956
|
+
},
|
|
63957
|
+
getConfirmedNonce: () => publicClient.getTransactionCount({ address: account.address, blockTag: "latest" }),
|
|
63958
|
+
publicationReader: {
|
|
63959
|
+
blockNumber: async () => await publicClient.getBlockNumber({ cacheTime: 0 }) - BigInt(confirmations - 1),
|
|
63960
|
+
read: async ({ contract, functionName, args, blockNumber: blockNumber2 }) => {
|
|
63961
|
+
const deployment = getSkillProtocolDeploymentByChainId(chainId);
|
|
63962
|
+
return publicClient.readContract({
|
|
63963
|
+
address: getAddress(contract === "token" ? deployment.skillTokenAddress : deployment.skillInstanceAddress),
|
|
63964
|
+
abi: contract === "token" ? tokenAbi : instanceAbi,
|
|
63965
|
+
functionName,
|
|
63966
|
+
args,
|
|
63967
|
+
blockNumber: blockNumber2
|
|
63968
|
+
});
|
|
63969
|
+
}
|
|
63970
|
+
},
|
|
63597
63971
|
waitForReceipt: async (hash5) => {
|
|
63598
63972
|
const receipt = await publicClient.waitForTransactionReceipt({ hash: hash5, confirmations, timeout: 12e4 });
|
|
63599
63973
|
return Object.freeze({ status: receipt.status, blockNumber: receipt.blockNumber });
|
|
@@ -63626,6 +64000,7 @@ var init_skill_intent_sender = __esm({
|
|
|
63626
64000
|
async rpc(privateKey3, walletAddress2, deployment) {
|
|
63627
64001
|
const key = installedPrivateKey2(privateKey3);
|
|
63628
64002
|
let reachable = false;
|
|
64003
|
+
let lastCause;
|
|
63629
64004
|
for (const rpcUrl of deployment.defaultRpcUrls) {
|
|
63630
64005
|
const rpc = this.rpcFactory(
|
|
63631
64006
|
key,
|
|
@@ -63642,10 +64017,11 @@ var init_skill_intent_sender = __esm({
|
|
|
63642
64017
|
}
|
|
63643
64018
|
return rpc;
|
|
63644
64019
|
} catch (cause) {
|
|
64020
|
+
lastCause = cause;
|
|
63645
64021
|
if (cause instanceof TypeError && cause.message.includes("wallet")) throw cause;
|
|
63646
64022
|
}
|
|
63647
64023
|
}
|
|
63648
|
-
throw new TypeError(reachable ? "CLI_RPC_CHAIN_MISMATCH: No reviewed Skill RPC serves the plan chain." : "CLI_RPC_UNAVAILABLE: No reviewed Skill RPC is reachable.");
|
|
64024
|
+
throw new TypeError(reachable ? "CLI_RPC_CHAIN_MISMATCH: No reviewed Skill RPC serves the plan chain." : "CLI_RPC_UNAVAILABLE: No reviewed Skill RPC is reachable.", { cause: lastCause });
|
|
63649
64025
|
}
|
|
63650
64026
|
buyerCall(input) {
|
|
63651
64027
|
if (!validateIntent2(input.intent)) throw new TypeError("Skill intent does not match the frozen contract.");
|
|
@@ -63669,10 +64045,10 @@ var init_skill_intent_sender = __esm({
|
|
|
63669
64045
|
async submit(input) {
|
|
63670
64046
|
const { expected, deployment } = this.buyerCall(input);
|
|
63671
64047
|
const rpc = await this.rpc(input.privateKey, input.walletAddress, deployment);
|
|
63672
|
-
await rpc.simulateTransaction(expected);
|
|
63673
|
-
const transactionHash3 = await rpc.sendTransaction(expected);
|
|
64048
|
+
await rpcOperation("eth_call", () => rpc.simulateTransaction(expected));
|
|
64049
|
+
const transactionHash3 = await rpcOperation("eth_sendRawTransaction", () => rpc.sendTransaction(expected));
|
|
63674
64050
|
await input.onBroadcast?.({ fingerprint: skillBuyerIntentFingerprint(input.intent), transactionHash: transactionHash3 });
|
|
63675
|
-
const receipt = await rpc.waitForReceipt(transactionHash3);
|
|
64051
|
+
const receipt = await rpcOperation("eth_getTransactionReceipt", () => rpc.waitForReceipt(transactionHash3));
|
|
63676
64052
|
if (receipt.status !== "success") throw new TypeError("Skill transaction reverted.");
|
|
63677
64053
|
return Object.freeze({ transactionHash: transactionHash3, blockNumber: receipt.blockNumber.toString() });
|
|
63678
64054
|
}
|
|
@@ -63684,7 +64060,7 @@ var init_skill_intent_sender = __esm({
|
|
|
63684
64060
|
if (input.blockNumber === null) {
|
|
63685
64061
|
const transaction2 = await rpc.getTransactionCall(transactionHash3);
|
|
63686
64062
|
if (!exactTransaction2(transaction2)) throw new TypeError("Skill recovery transaction does not match its exact buyer intent.");
|
|
63687
|
-
const receipt = await rpc.waitForReceipt(transactionHash3);
|
|
64063
|
+
const receipt = await rpcOperation("eth_getTransactionReceipt", () => rpc.waitForReceipt(transactionHash3));
|
|
63688
64064
|
if (receipt.status !== "success") throw new TypeError("Skill recovery transaction reverted.");
|
|
63689
64065
|
return Object.freeze({ transactionHash: transactionHash3, blockNumber: receipt.blockNumber.toString() });
|
|
63690
64066
|
}
|
|
@@ -63703,30 +64079,68 @@ var init_skill_intent_sender = __esm({
|
|
|
63703
64079
|
const expected = expectedPreparedCall(input.action, request2, deployment);
|
|
63704
64080
|
assertIntentMatches(input.intent, expected, deployment.chainId);
|
|
63705
64081
|
const rpc = await this.rpc(input.privateKey, input.walletAddress, deployment);
|
|
63706
|
-
await rpc.simulateTransaction(expected);
|
|
63707
|
-
|
|
64082
|
+
await rpcOperation("eth_call", () => rpc.simulateTransaction(expected));
|
|
64083
|
+
let sending = false;
|
|
64084
|
+
const transactionHash3 = await rpcOperation(() => sending ? "eth_sendRawTransaction" : null, () => rpc.sendTransaction(expected, async (checkpoint) => {
|
|
64085
|
+
await input.onSending?.(checkpoint);
|
|
64086
|
+
sending = true;
|
|
64087
|
+
}));
|
|
63708
64088
|
await input.onBroadcast?.({ transactionHash: transactionHash3 });
|
|
63709
|
-
const receipt = await rpc.waitForReceipt(transactionHash3);
|
|
63710
|
-
if (receipt.status !== "success") throw
|
|
64089
|
+
const receipt = await rpcOperation("eth_getTransactionReceipt", () => rpc.waitForReceipt(transactionHash3));
|
|
64090
|
+
if (receipt.status !== "success") throw receiptFailure(input.action);
|
|
63711
64091
|
return Object.freeze({ transactionHash: transactionHash3, blockNumber: receipt.blockNumber.toString() });
|
|
63712
64092
|
}
|
|
64093
|
+
async readCurrentVersion(input) {
|
|
64094
|
+
const rpc = await this.rpc(input.privateKey, input.walletAddress, this.authority(input.chainId));
|
|
64095
|
+
if (!rpc.publicationReader) throw new TypeError("Skill publication reader is unavailable.");
|
|
64096
|
+
const blockNumber2 = await rpc.publicationReader.blockNumber();
|
|
64097
|
+
const binding = record5(await rpc.publicationReader.read({ contract: "token", functionName: "skillOf", args: [unsigned2(input.skillId, "Skill id", true)], blockNumber: blockNumber2 }), "Skill binding");
|
|
64098
|
+
if (typeof binding.version !== "bigint" || binding.version < BigInt(1) || binding.version > BigInt(4294967295)) throw new TypeError("Invalid on-chain Skill version.");
|
|
64099
|
+
return Number(binding.version);
|
|
64100
|
+
}
|
|
64101
|
+
async readPublicationState(input) {
|
|
64102
|
+
const deployment = this.authority(input.request.chainId);
|
|
64103
|
+
const rpc = await this.rpc(input.privateKey, input.walletAddress, deployment);
|
|
64104
|
+
if (!rpc.publicationReader) throw new TypeError("Skill publication reader is unavailable.");
|
|
64105
|
+
return readSkillPublicationState(rpc.publicationReader, input);
|
|
64106
|
+
}
|
|
64107
|
+
async resumePublicationTransaction(input) {
|
|
64108
|
+
try {
|
|
64109
|
+
return await this.verifyPrepared(input);
|
|
64110
|
+
} catch (error51) {
|
|
64111
|
+
if (error51 instanceof SkillPublicationTransactionFailedError) return null;
|
|
64112
|
+
const cause = error51 instanceof Error && error51.cause ? error51.cause : error51;
|
|
64113
|
+
if (!(cause instanceof WaitForTransactionReceiptTimeoutError) && !(cause instanceof TransactionNotFoundError)) throw error51;
|
|
64114
|
+
const rpc = await this.rpc(input.privateKey, input.walletAddress, this.authority(input.request.chainId));
|
|
64115
|
+
if (input.nonce !== void 0 && rpc.getConfirmedNonce && await rpc.getConfirmedNonce() > input.nonce) return null;
|
|
64116
|
+
if (cause instanceof WaitForTransactionReceiptTimeoutError) return null;
|
|
64117
|
+
try {
|
|
64118
|
+
const receipt = await rpc.waitForReceipt(hash4(input.transactionHash, "Skill recovery transaction hash"));
|
|
64119
|
+
if (receipt.status !== "success") return null;
|
|
64120
|
+
return await this.verifyPrepared({ ...input, blockNumber: receipt.blockNumber.toString() });
|
|
64121
|
+
} catch (waiting) {
|
|
64122
|
+
if (waiting instanceof WaitForTransactionReceiptTimeoutError) return null;
|
|
64123
|
+
throw waiting;
|
|
64124
|
+
}
|
|
64125
|
+
}
|
|
64126
|
+
}
|
|
63713
64127
|
async verifyPrepared(input) {
|
|
63714
64128
|
const request2 = record5(input.request, "Skill prepared request");
|
|
63715
64129
|
const deployment = this.authority(request2.chainId);
|
|
63716
64130
|
const expected = expectedPreparedCall(input.action, request2, deployment);
|
|
63717
64131
|
const rpc = await this.rpc(input.privateKey, input.walletAddress, deployment);
|
|
63718
64132
|
const transactionHash3 = hash4(input.transactionHash, "Skill recovery transaction hash");
|
|
63719
|
-
const exactTransaction2 = (actual2) => actual2.from.toLowerCase() === input.walletAddress && actual2.to?.toLowerCase() === expected.to.toLowerCase() && actual2.data === expected.data && actual2.value === expected.value;
|
|
64133
|
+
const exactTransaction2 = (actual2) => actual2.from.toLowerCase() === input.walletAddress.toLowerCase() && actual2.to?.toLowerCase() === expected.to.toLowerCase() && actual2.data === expected.data && actual2.value === expected.value;
|
|
63720
64134
|
if (input.blockNumber === null) {
|
|
63721
64135
|
const transaction2 = await rpc.getTransactionCall(transactionHash3);
|
|
63722
64136
|
if (!exactTransaction2(transaction2)) throw new TypeError("Skill recovery transaction does not match its exact prepared action and receipt.");
|
|
63723
|
-
const receipt = await rpc.waitForReceipt(transactionHash3);
|
|
63724
|
-
if (receipt.status !== "success") throw
|
|
64137
|
+
const receipt = await rpcOperation("eth_getTransactionReceipt", () => rpc.waitForReceipt(transactionHash3));
|
|
64138
|
+
if (receipt.status !== "success") throw receiptFailure(input.action);
|
|
63725
64139
|
return Object.freeze({ transactionHash: transactionHash3, blockNumber: receipt.blockNumber.toString() });
|
|
63726
64140
|
}
|
|
63727
64141
|
const blockNumber2 = unsigned2(input.blockNumber, "Skill recovery block number", true);
|
|
63728
64142
|
const actual = await rpc.getTransactionRecord(transactionHash3);
|
|
63729
|
-
if (actual.status !== "success") throw
|
|
64143
|
+
if (actual.status !== "success") throw receiptFailure(input.action);
|
|
63730
64144
|
if (actual.blockNumber !== blockNumber2 || !exactTransaction2(actual)) {
|
|
63731
64145
|
throw new TypeError("Skill recovery transaction does not match its exact prepared action and receipt.");
|
|
63732
64146
|
}
|
|
@@ -63853,11 +64267,12 @@ var output_exports = {};
|
|
|
63853
64267
|
__export(output_exports, {
|
|
63854
64268
|
emitCliOutcome: () => emitCliOutcome
|
|
63855
64269
|
});
|
|
64270
|
+
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
63856
64271
|
function resubmitSafeGuidance(diagnostic) {
|
|
63857
64272
|
if (diagnostic.submissionStatus === "not_attempted") {
|
|
63858
64273
|
return "No transaction was sent. Submitting the same plan again is safe.";
|
|
63859
64274
|
}
|
|
63860
|
-
return `${diagnostic.submissionStatus === "uncertain" ? "A transaction may have been broadcast without a returned hash." : "The transaction was broadcast and may still have reverted."}
|
|
64275
|
+
return `${diagnostic.submissionStatus === "uncertain" ? "A transaction may have been broadcast without a returned hash." : "The transaction was broadcast and may still have reverted."} Retry the same command; publication recovery checks chain state before sending, and a URI assignment converges on the same value.`;
|
|
63861
64276
|
}
|
|
63862
64277
|
function remoteCallerAction(status) {
|
|
63863
64278
|
if (status === 401 || status === 403) return "authenticate";
|
|
@@ -63875,6 +64290,7 @@ function remoteExitCode(status) {
|
|
|
63875
64290
|
return AGENT_CLI_OUTPUT_CONTRACT.exitCodes.remoteOrProviderUnavailable;
|
|
63876
64291
|
}
|
|
63877
64292
|
function failure(error51) {
|
|
64293
|
+
if (error51 instanceof SkillPublicationConflictError) return { code: "AGENT_MARKET_STATE_CONFLICT", exitCode: AGENT_CLI_OUTPUT_CONTRACT.exitCodes.conflictOrPrecondition, message: error51.message };
|
|
63878
64294
|
if (error51 instanceof CliSkillSourceError) {
|
|
63879
64295
|
return {
|
|
63880
64296
|
code: "AGENT_MARKET_REQUEST_INVALID",
|
|
@@ -63904,16 +64320,6 @@ function failure(error51) {
|
|
|
63904
64320
|
message: error51.reason === "version_moved" ? `The Skill is now at version ${error51.liveVersion}; this presentation plan was prepared for version ${error51.planVersion}. Prepare the presentation again against the current version.` : "The Skill URI on chain does not hold a version manifest this CLI can extend. Re-read the Skill, then prepare the presentation again."
|
|
63905
64321
|
};
|
|
63906
64322
|
}
|
|
63907
|
-
if (error51 instanceof CliSkillRecoveryUncertainError) {
|
|
63908
|
-
const { stage, marker, kind, targetVersion } = error51.detail;
|
|
63909
|
-
const unknown2 = stage === "uri" ? "the prepared manifest URI was set" : stage === "lit" ? `the delivery key for version ${targetVersion} was set` : kind === "version" ? `version ${targetVersion} was added` : "the Skill was created";
|
|
63910
|
-
const settled = stage === "uri" ? "the Skill points to the exact prepared manifest URI" : stage === "lit" ? `version ${targetVersion} is already deliverable` : kind === "version" ? `the Skill is already at version ${targetVersion}` : "a Skill is already registered under this slug";
|
|
63911
|
-
return {
|
|
63912
|
-
code: "AGENT_MARKET_STATE_CONFLICT",
|
|
63913
|
-
exitCode: AGENT_CLI_OUTPUT_CONTRACT.exitCodes.conflictOrPrecondition,
|
|
63914
|
-
message: `${marker === "pending" ? "This recovery stopped after the transaction was prepared for sending" : "This recovery journal predates the pre-send marker"}, so whether ${unknown2} cannot be established locally. Read the Skill on chain first: if ${settled}, the transaction landed and only the local journal is behind. Contact support with this state rather than re-running the command.`
|
|
63915
|
-
};
|
|
63916
|
-
}
|
|
63917
64323
|
if (error51 instanceof CliHttpError) {
|
|
63918
64324
|
if (error51.code === "CLI_RESPONSE_INVALID") {
|
|
63919
64325
|
return { code: "CLI_RESPONSE_INVALID", exitCode: 7, message: "Remote response is invalid." };
|
|
@@ -63946,12 +64352,12 @@ function emitCliOutcome(outcome, sinks) {
|
|
|
63946
64352
|
const envelope2 = JSON.parse(serialized);
|
|
63947
64353
|
const source = cause instanceof CliSkillSourceError ? cause : null;
|
|
63948
64354
|
const remote = cause instanceof CliHttpError && cause.envelope !== null;
|
|
63949
|
-
const uncertainRecovery = cause instanceof CliSkillRecoveryUncertainError;
|
|
63950
64355
|
const diagnostic = outcome.diagnostic;
|
|
63951
|
-
const inputBound = source !== null || !(cause instanceof CliHttpError) && diagnostic.phase === "validation";
|
|
64356
|
+
const inputBound = source !== null || cause instanceof SkillPublicationConflictError || !(cause instanceof CliHttpError) && diagnostic.phase === "validation";
|
|
63952
64357
|
const remoteAction = remoteCallerAction(cause instanceof CliHttpError ? cause.status : null);
|
|
63953
64358
|
const safeRepeat = diagnostic.resubmitSafe && !inputBound && remoteAction === null;
|
|
63954
64359
|
envelope2.error.state = JSON.stringify({
|
|
64360
|
+
causeDiagnostic: safeFailureDiagnostic(cause),
|
|
63955
64361
|
diagnosticCode: source?.diagnosticCode ?? "SKILL_PUBLICATION_FAILED",
|
|
63956
64362
|
...source?.details,
|
|
63957
64363
|
...diagnostic,
|
|
@@ -63961,7 +64367,7 @@ function emitCliOutcome(outcome, sinks) {
|
|
|
63961
64367
|
...remote ? { remoteStatus: cause.status, remoteState: envelope2.error.state, remoteMessage: envelope2.error.message } : {}
|
|
63962
64368
|
});
|
|
63963
64369
|
envelope2.error.retryable = false;
|
|
63964
|
-
if (!source && !
|
|
64370
|
+
if (!source && !(cause instanceof SkillPublicationConflictError) && !remote && diagnostic.phase !== "validation") envelope2.error.message = `Skill publication failed during ${diagnostic.phase}. ${diagnostic.recoveryCommand ? diagnostic.resubmitSafe ? "Retry the same publication command, or use the recovery command in state." : "Use the recovery command in state; do not resubmit." : safeRepeat ? resubmitSafeGuidance(diagnostic) : "Contact support with the public diagnostic state before retrying."}`;
|
|
63965
64371
|
envelope2.error.nextAction = diagnostic.recoveryCommand ? "refresh_resource" : inputBound ? envelope2.error.nextAction : remoteAction !== null ? remoteAction : safeRepeat ? "refresh_resource" : diagnostic.submissionStatus === "uncertain" ? "contact_support" : (remote || diagnostic.phase === "validation") && ["authenticate", "request_scope", "fix_request"].includes(String(envelope2.error.nextAction)) ? envelope2.error.nextAction : "contact_support";
|
|
63966
64372
|
if (safeRepeat) envelope2.error.retryable = true;
|
|
63967
64373
|
if (diagnostic.phase === "projection" && diagnostic.submissionStatus === "hash_known") {
|
|
@@ -64020,6 +64426,9 @@ function emitCliOutcome(outcome, sinks) {
|
|
|
64020
64426
|
}
|
|
64021
64427
|
const mapped = failure(outcome);
|
|
64022
64428
|
const definition = mapped.code === "CLI_REMOTE_UNAVAILABLE" ? { retryable: true, nextAction: "retry_later" } : mapped.code === "CLI_RESPONSE_INVALID" ? { retryable: false, nextAction: "contact_support" } : AGENT_MARKET_ERROR_DEFINITIONS[mapped.code];
|
|
64429
|
+
const traceId = randomUUID2();
|
|
64430
|
+
sinks.stderr(`${JSON.stringify({ event: "finch_cli_local_failure", traceId, ...safeFailureDiagnostic(outcome) })}
|
|
64431
|
+
`);
|
|
64023
64432
|
const envelope = {
|
|
64024
64433
|
error: {
|
|
64025
64434
|
code: mapped.code,
|
|
@@ -64031,7 +64440,7 @@ function emitCliOutcome(outcome, sinks) {
|
|
|
64031
64440
|
operationId: null,
|
|
64032
64441
|
currentRevision: null,
|
|
64033
64442
|
currentEtag: null,
|
|
64034
|
-
traceId
|
|
64443
|
+
traceId
|
|
64035
64444
|
}
|
|
64036
64445
|
};
|
|
64037
64446
|
sinks.stdout(`${JSON.stringify(envelope)}
|
|
@@ -64042,6 +64451,7 @@ var init_output = __esm({
|
|
|
64042
64451
|
"src/output.ts"() {
|
|
64043
64452
|
"use strict";
|
|
64044
64453
|
init_v1();
|
|
64454
|
+
init_client();
|
|
64045
64455
|
init_chains();
|
|
64046
64456
|
init_api2();
|
|
64047
64457
|
init_cli_error();
|