@finchtech/cli 0.5.2 → 0.5.3

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.
Files changed (3) hide show
  1. package/README.md +25 -13
  2. package/dist/finch.js +1152 -853
  3. 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, schema5) {
1086
- if (typeof schema5 == "boolean")
1087
- return schema5;
1088
- if (Object.keys(schema5).length === 0)
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, schema5);
1091
- return !schemaHasRules(schema5, it.self.RULES.all);
1090
+ checkUnknownRules(it, schema6);
1091
+ return !schemaHasRules(schema6, it.self.RULES.all);
1092
1092
  }
1093
1093
  exports.alwaysValidSchema = alwaysValidSchema;
1094
- function checkUnknownRules(it, schema5 = it.schema) {
1094
+ function checkUnknownRules(it, schema6 = it.schema) {
1095
1095
  const { opts, self } = it;
1096
1096
  if (!opts.strictSchema)
1097
1097
  return;
1098
- if (typeof schema5 === "boolean")
1098
+ if (typeof schema6 === "boolean")
1099
1099
  return;
1100
1100
  const rules = self.RULES.keywords;
1101
- for (const key in schema5) {
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(schema5, rules) {
1108
- if (typeof schema5 == "boolean")
1109
- return !schema5;
1110
- for (const key in schema5)
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(schema5, RULES) {
1117
- if (typeof schema5 == "boolean")
1118
- return !schema5;
1119
- for (const key in schema5)
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 }, schema5, keyword, $data) {
1125
+ function schemaRefOrVal({ topSchemaRef, schemaPath }, schema6, keyword, $data) {
1126
1126
  if (!$data) {
1127
- if (typeof schema5 == "number" || typeof schema5 == "boolean")
1128
- return schema5;
1129
- if (typeof schema5 == "string")
1130
- return (0, codegen_1._)`${schema5}`;
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: schema5, validateName } = it;
1412
- if (schema5 === false) {
1411
+ const { gen: gen2, schema: schema6, validateName } = it;
1412
+ if (schema6 === false) {
1413
1413
  falseSchemaError(it, false);
1414
- } else if (typeof schema5 == "object" && schema5.$async === true) {
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: schema5 } = it;
1424
- if (schema5 === false) {
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: schema5, self }, type) {
1486
+ function schemaHasRulesForType({ schema: schema6, self }, type) {
1487
1487
  const group = self.RULES.types[type];
1488
- return group && group !== true && shouldUseGroup(schema5, group);
1488
+ return group && group !== true && shouldUseGroup(schema6, group);
1489
1489
  }
1490
1490
  exports.schemaHasRulesForType = schemaHasRulesForType;
1491
- function shouldUseGroup(schema5, group) {
1492
- return group.rules.some((rule) => shouldUseRule(schema5, rule));
1491
+ function shouldUseGroup(schema6, group) {
1492
+ return group.rules.some((rule) => shouldUseRule(schema6, rule));
1493
1493
  }
1494
1494
  exports.shouldUseGroup = shouldUseGroup;
1495
- function shouldUseRule(schema5, rule) {
1495
+ function shouldUseRule(schema6, rule) {
1496
1496
  var _a4;
1497
- return schema5[rule.keyword] !== void 0 || ((_a4 = rule.definition.implements) === null || _a4 === void 0 ? void 0 : _a4.some((kwd) => schema5[kwd] !== void 0));
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(schema5) {
1520
- const types = getJSONTypes(schema5.type);
1519
+ function getSchemaTypes(schema6) {
1520
+ const types = getJSONTypes(schema6.type);
1521
1521
  const hasNull = types.includes("null");
1522
1522
  if (hasNull) {
1523
- if (schema5.nullable === false)
1523
+ if (schema6.nullable === false)
1524
1524
  throw new Error("type: null contradicts nullable: false");
1525
1525
  } else {
1526
- if (!types.length && schema5.nullable !== void 0) {
1526
+ if (!types.length && schema6.nullable !== void 0) {
1527
1527
  throw new Error('"nullable" cannot be used without "type"');
1528
1528
  }
1529
- if (schema5.nullable === true)
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: schema5 }) => `must be ${schema5}`,
1662
- params: ({ schema: schema5, schemaValue }) => typeof schema5 == "string" ? (0, codegen_1._)`{type: ${schema5}}` : (0, codegen_1._)`{type: ${schemaValue}}`
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: schema5 } = it;
1671
- const schemaCode = (0, util_1.schemaRefOrVal)(it, schema5, "type");
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: schema5.type,
1676
+ schema: schema6.type,
1677
1677
  schemaCode,
1678
1678
  schemaValue: schemaCode,
1679
- parentSchema: schema5,
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: schema5, keyword, it } = cxt;
1833
- if (!Array.isArray(schema5))
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 = schema5.some((sch) => (0, util_1.alwaysValidSchema)(it, sch));
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(() => schema5.forEach((_sch, i2) => {
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: schema5, parentSchema, it } = cxt;
1869
- const macroSchema = def.macro.call(it.self, schema5, parentSchema, it);
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: schema5, parentSchema, $data, it } = cxt;
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, schema5, parentSchema, it) : def.validate;
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(schema5, schemaType, allowUndefined = false) {
1949
- return !schemaType.length || schemaType.some((st) => st === "array" ? Array.isArray(schema5) : st === "object" ? schema5 && typeof schema5 == "object" && !Array.isArray(schema5) : typeof schema5 == st || allowUndefined && typeof schema5 == "undefined");
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: schema5, opts, self, errSchemaPath }, def, keyword) {
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(schema5, kwd))) {
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(schema5[keyword]);
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: schema5, schemaPath, errSchemaPath, topSchemaRef }) {
1984
- if (keyword !== void 0 && schema5 !== 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 (schema5 !== void 0) {
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: schema5,
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(schema5, opts, cb) {
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, schema5, "", schema5);
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, schema5, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex) {
2154
- if (schema5 && typeof schema5 == "object" && !Array.isArray(schema5)) {
2155
- pre(schema5, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex);
2156
- for (var key in schema5) {
2157
- var sch = schema5[key];
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, schema5, i2);
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, schema5, prop);
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, schema5);
2169
+ _traverse(opts, pre, post, sch, jsonPtr + "/" + key, rootSchema, jsonPtr, key, schema6);
2170
2170
  }
2171
2171
  }
2172
- post(schema5, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex);
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(schema5, limit = true) {
2209
- if (typeof schema5 == "boolean")
2208
+ function inlineRef(schema6, limit = true) {
2209
+ if (typeof schema6 == "boolean")
2210
2210
  return true;
2211
2211
  if (limit === true)
2212
- return !hasRef(schema5);
2212
+ return !hasRef(schema6);
2213
2213
  if (!limit)
2214
2214
  return false;
2215
- return countKeys(schema5) <= limit;
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(schema5) {
2226
- for (const key in schema5) {
2225
+ function hasRef(schema6) {
2226
+ for (const key in schema6) {
2227
2227
  if (REF_KEYWORDS.has(key))
2228
2228
  return true;
2229
- const sch = schema5[key];
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(schema5) {
2237
+ function countKeys(schema6) {
2238
2238
  let count = 0;
2239
- for (const key in schema5) {
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 schema5[key] == "object") {
2246
- (0, util_1.eachItem)(schema5[key], (sch) => count += countKeys(sch));
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(schema5, baseId) {
2277
- if (typeof schema5 == "boolean")
2276
+ function getSchemaRefs(schema6, baseId) {
2277
+ if (typeof schema6 == "boolean")
2278
2278
  return {};
2279
2279
  const { schemaId, uriResolver } = this.opts;
2280
- const schId = normalizeId(schema5[schemaId] || baseId);
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(schema5, { allKeys: true }, (sch, jsonPtr, _, parentJsonPtr) => {
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: schema5, schemaEnv, opts }, body) {
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(schema5, opts)}`);
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(schema5, opts)).code(body));
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: schema5, opts, gen: gen2 } = it;
2398
+ const { schema: schema6, opts, gen: gen2 } = it;
2399
2399
  validateFunction(it, () => {
2400
- if (opts.$comment && schema5.$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(schema5, opts) {
2419
- const schId = typeof schema5 == "object" && schema5[opts.schemaId];
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: schema5, self }) {
2433
- if (typeof schema5 == "boolean")
2434
- return !schema5;
2435
- for (const key in schema5)
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: schema5, gen: gen2, opts } = it;
2445
- if (opts.$comment && schema5.$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: schema5, errSchemaPath, opts, self } = it;
2466
- if (schema5.$ref && opts.ignoreKeywordsWithRef && (0, util_1.schemaHasRulesButRef)(schema5, self.RULES)) {
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: schema5, opts } = it;
2472
- if (schema5.default !== void 0 && opts.useDefaults && opts.strictSchema) {
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: schema5, errSchemaPath, opts }) {
2486
- const msg = schema5.$comment;
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: schema5, data, allErrors, opts, self } = it;
2513
+ const { gen: gen2, schema: schema6, data, allErrors, opts, self } = it;
2514
2514
  const { RULES } = self;
2515
- if (schema5.$ref && (opts.ignoreKeywordsWithRef || !(0, util_1.schemaHasRulesButRef)(schema5, RULES))) {
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)(schema5, group))
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: schema5, opts: { useDefaults } } = it;
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)(schema5, rule)) {
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 schema5;
2895
+ let schema6;
2896
2896
  if (typeof env.schema == "object")
2897
- schema5 = env.schema;
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)(schema5 === null || schema5 === void 0 ? void 0 : schema5[env.schemaId || "$id"]);
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 = schema5 === null || schema5 === void 0 ? void 0 : schema5.$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 schema5 = (_a4 = root.localRefs) === null || _a4 === void 0 ? void 0 : _a4[ref];
3004
+ const schema6 = (_a4 = root.localRefs) === null || _a4 === void 0 ? void 0 : _a4[ref];
3005
3005
  const { schemaId } = this.opts;
3006
- if (schema5)
3007
- _sch = new SchemaEnv({ schema: schema5, schemaId, root, baseId });
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: schema5 } = schOrRef;
3055
+ const { schema: schema6 } = schOrRef;
3056
3056
  const { schemaId } = this.opts;
3057
- const schId = schema5[schemaId];
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: schema5, schemaId, root, baseId });
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: schema5, root }) {
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 schema5 === "boolean")
3077
+ if (typeof schema6 === "boolean")
3078
3078
  return;
3079
- const partSchema = schema5[(0, util_1.unescapeFragment)(part)];
3079
+ const partSchema = schema6[(0, util_1.unescapeFragment)(part)];
3080
3080
  if (partSchema === void 0)
3081
3081
  return;
3082
- schema5 = partSchema;
3083
- const schId = typeof schema5 === "object" && schema5[this.opts.schemaId];
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 schema5 != "boolean" && schema5.$ref && !(0, util_1.schemaHasRulesButRef)(schema5, this.RULES)) {
3090
- const $ref = (0, resolve_1.resolveUrl)(this.opts.uriResolver, baseId, schema5.$ref);
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: schema5, schemaId, root, baseId });
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(parsed2, matches) {
3795
- if (matches[2] !== void 0 && parsed2.path && parsed2.path[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 parsed2.port === "number" && (parsed2.port < 0 || parsed2.port > 65535)) {
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 parsed2 = {
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
- parsed2.error = "URI authority must not contain a literal backslash.";
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
- parsed2.error = parsed2.error || "URI authority must not contain a literal backslash.";
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
- parsed2.error = parsed2.error || "URI authority introducer must not contain whitespace.";
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
- parsed2.scheme = matches[1];
3845
- parsed2.userinfo = matches[3];
3846
- parsed2.host = matches[4];
3847
- parsed2.port = parseInt(matches[5], 10);
3848
- parsed2.path = matches[6] || "";
3849
- parsed2.query = matches[7];
3850
- parsed2.fragment = matches[8];
3851
- if (isNaN(parsed2.port)) {
3852
- parsed2.port = matches[5];
3853
- }
3854
- const parseError = getParseError(parsed2, matches);
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
- parsed2.error = parsed2.error || parseError;
3856
+ parsed3.error = parsed3.error || parseError;
3857
3857
  malformedAuthorityOrPort = true;
3858
3858
  }
3859
- if (parsed2.host) {
3860
- const ipv4result = isIPv4(parsed2.host);
3859
+ if (parsed3.host) {
3860
+ const ipv4result = isIPv4(parsed3.host);
3861
3861
  if (ipv4result === false) {
3862
- const ipv6result = normalizeIPv6(parsed2.host);
3863
- parsed2.host = ipv6result.host.toLowerCase();
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 (parsed2.scheme === void 0 && parsed2.userinfo === void 0 && parsed2.host === void 0 && parsed2.port === void 0 && parsed2.query === void 0 && !parsed2.path) {
3870
- parsed2.reference = "same-document";
3871
- } else if (parsed2.scheme === void 0) {
3872
- parsed2.reference = "relative";
3873
- } else if (parsed2.fragment === void 0) {
3874
- parsed2.reference = "absolute";
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
- parsed2.reference = "uri";
3876
+ parsed3.reference = "uri";
3877
3877
  }
3878
- if (options.reference && options.reference !== "suffix" && options.reference !== parsed2.reference) {
3879
- parsed2.error = parsed2.error || "URI is not a " + options.reference + " reference.";
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 || parsed2.scheme);
3881
+ const schemeHandler = getSchemeHandler(options.scheme || parsed3.scheme);
3882
3882
  if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport)) {
3883
- if (parsed2.host && (options.domainHost || schemeHandler && schemeHandler.domainHost) && isIP2 === false && nonSimpleDomain(parsed2.host)) {
3883
+ if (parsed3.host && (options.domainHost || schemeHandler && schemeHandler.domainHost) && isIP2 === false && nonSimpleDomain(parsed3.host)) {
3884
3884
  try {
3885
- parsed2.host = new URL("http://" + parsed2.host).hostname;
3885
+ parsed3.host = new URL("http://" + parsed3.host).hostname;
3886
3886
  } catch (e) {
3887
- parsed2.error = parsed2.error || "Host's domain name can not be converted to ASCII: " + e;
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 (parsed2.scheme !== void 0) {
3894
- parsed2.scheme = unescape(parsed2.scheme);
3893
+ if (parsed3.scheme !== void 0) {
3894
+ parsed3.scheme = unescape(parsed3.scheme);
3895
3895
  }
3896
- if (parsed2.host !== void 0) {
3897
- parsed2.host = reescapeHostDelimiters(unescape(parsed2.host), isIP2);
3896
+ if (parsed3.host !== void 0) {
3897
+ parsed3.host = reescapeHostDelimiters(unescape(parsed3.host), isIP2);
3898
3898
  }
3899
3899
  }
3900
- if (parsed2.path) {
3901
- parsed2.path = normalizePathEncoding(parsed2.path);
3900
+ if (parsed3.path) {
3901
+ parsed3.path = normalizePathEncoding(parsed3.path);
3902
3902
  }
3903
- if (parsed2.fragment) {
3903
+ if (parsed3.fragment) {
3904
3904
  try {
3905
- parsed2.fragment = encodeURI(decodeURIComponent(parsed2.fragment));
3905
+ parsed3.fragment = encodeURI(decodeURIComponent(parsed3.fragment));
3906
3906
  } catch {
3907
- parsed2.error = parsed2.error || "URI malformed";
3907
+ parsed3.error = parsed3.error || "URI malformed";
3908
3908
  }
3909
3909
  }
3910
3910
  }
3911
3911
  if (schemeHandler && schemeHandler.parse) {
3912
- schemeHandler.parse(parsed2, options);
3912
+ schemeHandler.parse(parsed3, options);
3913
3913
  }
3914
3914
  } else {
3915
- parsed2.error = parsed2.error || "URI can not be parsed.";
3915
+ parsed3.error = parsed3.error || "URI can not be parsed.";
3916
3916
  }
3917
- return { parsed: parsed2, malformedAuthorityOrPort };
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: parsed2, malformedAuthorityOrPort } = parseWithStatus(uri, opts);
3926
+ const { parsed: parsed3, malformedAuthorityOrPort } = parseWithStatus(uri, opts);
3927
3927
  return {
3928
- normalized: malformedAuthorityOrPort ? uri : serialize(parsed2, opts),
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(schema5, _meta) {
4137
- const sch = this._addSchema(schema5, _meta);
4136
+ compile(schema6, _meta) {
4137
+ const sch = this._addSchema(schema6, _meta);
4138
4138
  return sch.validate || this._compileSchemaEnv(sch);
4139
4139
  }
4140
- compileAsync(schema5, meta3) {
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, schema5, meta3);
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(schema5, key, _meta, _validateSchema = this.opts.validateSchema) {
4192
- if (Array.isArray(schema5)) {
4193
- for (const sch of schema5)
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 schema5 === "object") {
4198
+ if (typeof schema6 === "object") {
4199
4199
  const { schemaId } = this.opts;
4200
- id = schema5[schemaId];
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(schema5, _meta, key, _validateSchema, true);
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(schema5, key, _validateSchema = this.opts.validateSchema) {
4213
- this.addSchema(schema5, key, true, _validateSchema);
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(schema5, throwOrLogError) {
4218
- if (typeof schema5 == "boolean")
4217
+ validateSchema(schema6, throwOrLogError) {
4218
+ if (typeof schema6 == "boolean")
4219
4219
  return true;
4220
4220
  let $schema;
4221
- $schema = schema5.$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, schema5);
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 schema5 = keywords[key];
4375
- if ($data && schema5)
4376
- keywords[key] = schemaOrData(schema5);
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(schema5, meta3, baseId, validateSchema = this.opts.validateSchema, addSchema = this.opts.addUsedSchema) {
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 schema5 == "object") {
4398
- id = schema5[schemaId];
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 schema5 != "boolean")
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(schema5);
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, schema5, baseId);
4410
- sch = new compile_1.SchemaEnv({ schema: schema5, schemaId, meta: meta3, baseId, localRefs });
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(schema5, true);
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(schema5) {
4573
- return { anyOf: [schema5, $dataRef] };
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: schema5, schemaCode, it } = cxt;
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, schema5);
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: schema5, schemaCode, data, $data, it } = cxt;
4939
+ const { gen: gen2, schema: schema6, schemaCode, data, $data, it } = cxt;
4940
4940
  const { opts } = it;
4941
- if (!$data && schema5.length === 0)
4941
+ if (!$data && schema6.length === 0)
4942
4942
  return;
4943
- const useLoop = schema5.length >= opts.loopRequired;
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 schema5) {
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 schema5) {
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, schema5, missing));
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: schema5, parentSchema, schemaCode, it } = cxt;
5063
- if (!$data && !schema5)
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: schema5 } = cxt;
5127
- if ($data || schema5 && typeof schema5 == "object") {
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._)`${schema5} !== ${data}`);
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: schema5, schemaCode, it } = cxt;
5157
- if (!$data && schema5.length === 0)
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 = schema5.length >= it.opts.loopEnum;
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(schema5))
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)(...schema5.map((_x, i2) => equalCode(vSchema, i2)));
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 = schema5[i2];
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: schema5, data, keyword, it } = cxt;
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 (schema5 === false) {
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 schema5 == "object" && !(0, util_1.alwaysValidSchema)(it, schema5)) {
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: schema5, it } = cxt;
5294
- if (Array.isArray(schema5))
5295
- return validateTuple(cxt, "additionalItems", schema5);
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, schema5))
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: schema5, parentSchema, it } = cxt;
5372
+ const { schema: schema6, parentSchema, it } = cxt;
5373
5373
  const { prefixItems } = parentSchema;
5374
5374
  it.items = true;
5375
- if ((0, util_1.alwaysValidSchema)(it, schema5))
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: schema5, parentSchema, data, it } = cxt;
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, schema5)) {
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: schema5 }) {
5512
+ function splitDependencies({ schema: schema6 }) {
5513
5513
  const propertyDeps = {};
5514
5514
  const schemaDeps = {};
5515
- for (const key in schema5) {
5515
+ for (const key in schema6) {
5516
5516
  if (key === "__proto__")
5517
5517
  continue;
5518
- const deps = Array.isArray(schema5[key]) ? propertyDeps : schemaDeps;
5519
- deps[key] = schema5[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: schema5, data, it } = cxt;
5593
- if ((0, util_1.alwaysValidSchema)(it, schema5))
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: schema5, parentSchema, data, errsCount, it } = cxt;
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, schema5))
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 && schema5 === false) {
5677
+ if (opts.removeAdditional === "all" || opts.removeAdditional && schema6 === false) {
5678
5678
  deleteAdditional(key);
5679
5679
  return;
5680
5680
  }
5681
- if (schema5 === false) {
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 schema5 == "object" && !(0, util_1.alwaysValidSchema)(it, schema5)) {
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: schema5, parentSchema, data, it } = cxt;
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)(schema5);
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, schema5[p]));
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 && schema5[prop].default !== void 0;
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: schema5, data, parentSchema, it } = cxt;
5796
+ const { gen: gen2, schema: schema6, data, parentSchema, it } = cxt;
5797
5797
  const { opts } = it;
5798
- const patterns = (0, code_1.allSchemaProperties)(schema5);
5799
- const alwaysValidPatterns = patterns.filter((p) => (0, util_1.alwaysValidSchema)(it, schema5[p]));
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: schema5, it } = cxt;
5868
- if ((0, util_1.alwaysValidSchema)(it, schema5)) {
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: schema5, parentSchema, it } = cxt;
5922
- if (!Array.isArray(schema5))
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 = schema5;
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: schema5, it } = cxt;
5973
- if (!Array.isArray(schema5))
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
- schema5.forEach((sch, i2) => {
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 schema5 = it.schema[keyword];
6052
- return schema5 !== void 0 && !(0, util_1.alwaysValidSchema)(it, schema5);
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: schema5, schemaCode, it } = cxt;
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[schema5];
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 "${schema5}" ignored in schema at path "${errSchemaPath}"`;
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)(schema5)}` : void 0;
6193
- const fmt = gen2.scopeValue("formats", { key: schema5, ref: fmtDef, code });
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: schema5, parentSchema, it } = cxt;
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 = schema5.propertyName;
6309
+ const tagName = schema6.propertyName;
6310
6310
  if (typeof tagName != "string")
6311
6311
  throw new Error("discriminator: requires propertyName");
6312
- if (schema5.mapping)
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.2",
6622
+ version: "0.5.3",
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(schema5) {
6999
- return mergeDefs(schema5._zod.def);
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(schema5, mask) {
7141
- const currDef = schema5._zod.def;
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(schema5._zod.def, {
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(schema5, def);
7163
+ return clone(schema6, def);
7164
7164
  }
7165
- function omit(schema5, mask) {
7166
- const currDef = schema5._zod.def;
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(schema5._zod.def, {
7172
+ const def = mergeDefs(schema6._zod.def, {
7173
7173
  get shape() {
7174
- const newShape = { ...schema5._zod.def.shape };
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(schema5, def);
7188
+ return clone(schema6, def);
7189
7189
  }
7190
- function extend(schema5, shape) {
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 = schema5._zod.def.checks;
7194
+ const checks = schema6._zod.def.checks;
7195
7195
  const hasChecks = checks && checks.length > 0;
7196
7196
  if (hasChecks) {
7197
- const existingShape = schema5._zod.def.shape;
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(schema5._zod.def, {
7204
+ const def = mergeDefs(schema6._zod.def, {
7205
7205
  get shape() {
7206
- const _shape = { ...schema5._zod.def.shape, ...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(schema5, def);
7211
+ return clone(schema6, def);
7212
7212
  }
7213
- function safeExtend(schema5, shape) {
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(schema5._zod.def, {
7217
+ const def = mergeDefs(schema6._zod.def, {
7218
7218
  get shape() {
7219
- const _shape = { ...schema5._zod.def.shape, ...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(schema5, def);
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, schema5, mask) {
7244
- const currDef = schema5._zod.def;
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(schema5._zod.def, {
7250
+ const def = mergeDefs(schema6._zod.def, {
7251
7251
  get shape() {
7252
- const oldShape = schema5._zod.def.shape;
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(schema5, def);
7279
+ return clone(schema6, def);
7280
7280
  }
7281
- function required(Class2, schema5, mask) {
7282
- const def = mergeDefs(schema5._zod.def, {
7281
+ function required(Class2, schema6, mask) {
7282
+ const def = mergeDefs(schema6._zod.def, {
7283
7283
  get shape() {
7284
- const oldShape = schema5._zod.def.shape;
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(schema5, def);
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) => (schema5, value, _ctx, _params) => {
7690
+ _parse = (_Err) => (schema6, value, _ctx, _params) => {
7691
7691
  const ctx = _ctx ? { ..._ctx, async: false } : { async: false };
7692
- const result2 = schema5._zod.run({ value, issues: [] }, ctx);
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 (schema5, value, _ctx, params) => {
7704
+ _parseAsync = (_Err) => async (schema6, value, _ctx, params) => {
7705
7705
  const ctx = _ctx ? { ..._ctx, async: true } : { async: true };
7706
- let result2 = schema5._zod.run({ value, issues: [] }, ctx);
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) => (schema5, value, _ctx) => {
7717
+ _safeParse = (_Err) => (schema6, value, _ctx) => {
7718
7718
  const ctx = _ctx ? { ..._ctx, async: false } : { async: false };
7719
- const result2 = schema5._zod.run({ value, issues: [] }, ctx);
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 (schema5, value, _ctx) => {
7729
+ _safeParseAsync = (_Err) => async (schema6, value, _ctx) => {
7730
7730
  const ctx = _ctx ? { ..._ctx, async: true } : { async: true };
7731
- let result2 = schema5._zod.run({ value, issues: [] }, ctx);
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) => (schema5, value, _ctx) => {
7740
+ _encode = (_Err) => (schema6, value, _ctx) => {
7741
7741
  const ctx = _ctx ? { ..._ctx, direction: "backward" } : { direction: "backward" };
7742
- return _parse(_Err)(schema5, value, ctx);
7742
+ return _parse(_Err)(schema6, value, ctx);
7743
7743
  };
7744
7744
  encode = /* @__PURE__ */ _encode($ZodRealError);
7745
- _decode = (_Err) => (schema5, value, _ctx) => {
7746
- return _parse(_Err)(schema5, value, _ctx);
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 (schema5, value, _ctx) => {
7749
+ _encodeAsync = (_Err) => async (schema6, value, _ctx) => {
7750
7750
  const ctx = _ctx ? { ..._ctx, direction: "backward" } : { direction: "backward" };
7751
- return _parseAsync(_Err)(schema5, value, ctx);
7751
+ return _parseAsync(_Err)(schema6, value, ctx);
7752
7752
  };
7753
7753
  encodeAsync = /* @__PURE__ */ _encodeAsync($ZodRealError);
7754
- _decodeAsync = (_Err) => async (schema5, value, _ctx) => {
7755
- return _parseAsync(_Err)(schema5, value, _ctx);
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) => (schema5, value, _ctx) => {
7758
+ _safeEncode = (_Err) => (schema6, value, _ctx) => {
7759
7759
  const ctx = _ctx ? { ..._ctx, direction: "backward" } : { direction: "backward" };
7760
- return _safeParse(_Err)(schema5, value, ctx);
7760
+ return _safeParse(_Err)(schema6, value, ctx);
7761
7761
  };
7762
7762
  safeEncode = /* @__PURE__ */ _safeEncode($ZodRealError);
7763
- _safeDecode = (_Err) => (schema5, value, _ctx) => {
7764
- return _safeParse(_Err)(schema5, value, _ctx);
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 (schema5, value, _ctx) => {
7767
+ _safeEncodeAsync = (_Err) => async (schema6, value, _ctx) => {
7768
7768
  const ctx = _ctx ? { ..._ctx, direction: "backward" } : { direction: "backward" };
7769
- return _safeParseAsync(_Err)(schema5, value, ctx);
7769
+ return _safeParseAsync(_Err)(schema6, value, ctx);
7770
7770
  };
7771
7771
  safeEncodeAsync = /* @__PURE__ */ _safeEncodeAsync($ZodRealError);
7772
- _safeDecodeAsync = (_Err) => async (schema5, value, _ctx) => {
7773
- return _safeParseAsync(_Err)(schema5, value, _ctx);
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 schema5 = shape[key];
9663
- const isOptionalIn = schema5?._zod?.optin === "optional";
9664
- const isOptionalOut = schema5?._zod?.optout === "optional";
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(schema5, ..._meta) {
16994
+ add(schema6, ..._meta) {
16995
16995
  const meta3 = _meta[0];
16996
- this._map.set(schema5, meta3);
16996
+ this._map.set(schema6, meta3);
16997
16997
  if (meta3 && typeof meta3 === "object" && "id" in meta3) {
16998
- this._idmap.set(meta3.id, schema5);
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(schema5) {
17008
- const meta3 = this._map.get(schema5);
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(schema5);
17012
+ this._map.delete(schema6);
17013
17013
  return this;
17014
17014
  }
17015
- get(schema5) {
17016
- const p = schema5._zod.parent;
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(schema5) };
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(schema5);
17023
+ return this._map.get(schema6);
17024
17024
  }
17025
- has(schema5) {
17026
- return this._map.has(schema5);
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, schema5, params) {
17671
+ function _property(property, schema6, params) {
17672
17672
  return new $ZodCheckProperty({
17673
17673
  check: "property",
17674
17674
  property,
17675
- schema: schema5,
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 schema5 = new Class2({
17923
+ const schema6 = new Class2({
17924
17924
  type: "custom",
17925
17925
  check: "custom",
17926
17926
  fn,
17927
17927
  ...norm
17928
17928
  });
17929
- return schema5;
17929
+ return schema6;
17930
17930
  }
17931
17931
  // @__NO_SIDE_EFFECTS__
17932
17932
  function _refine(Class2, fn, _params) {
17933
- const schema5 = new Class2({
17933
+ const schema6 = new Class2({
17934
17934
  type: "custom",
17935
17935
  check: "custom",
17936
17936
  fn,
17937
17937
  ...normalizeParams(_params)
17938
17938
  });
17939
- return schema5;
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(schema5, ctx, _params = { path: [], schemaPath: [] }) {
18104
+ function process2(schema6, ctx, _params = { path: [], schemaPath: [] }) {
18105
18105
  var _a4;
18106
- const def = schema5._zod.def;
18107
- const seen = ctx.seen.get(schema5);
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(schema5);
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(schema5, result2);
18118
- const overrideSchema = schema5._zod.toJSONSchema?.();
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, schema5],
18124
+ schemaPath: [..._params.schemaPath, schema6],
18125
18125
  path: _params.path
18126
18126
  };
18127
- if (schema5._zod.processJSONSchema) {
18128
- schema5._zod.processJSONSchema(ctx, result2.schema, params);
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(schema5, ctx, _json, params);
18135
+ processor(schema6, ctx, _json, params);
18136
18136
  }
18137
- const parent = schema5._zod.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(schema5);
18145
+ const meta3 = ctx.metadataRegistry.get(schema6);
18146
18146
  if (meta3)
18147
18147
  Object.assign(result2.schema, meta3);
18148
- if (ctx.io === "input" && isTransforming(schema5)) {
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(schema5);
18155
+ const _result = ctx.seen.get(schema6);
18156
18156
  return _result.schema;
18157
18157
  }
18158
- function extractDefs(ctx, schema5) {
18159
- const root = ctx.seen.get(schema5);
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 schema6 = seen.schema;
18203
- for (const key in schema6) {
18204
- delete schema6[key];
18202
+ const schema7 = seen.schema;
18203
+ for (const key in schema7) {
18204
+ delete schema7[key];
18205
18205
  }
18206
- schema6.$ref = ref;
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 (schema5 === entry2[0]) {
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 (schema5 !== entry2[0] && ext) {
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, schema5) {
18249
- const root = ctx.seen.get(schema5);
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 schema6 = seen.def ?? seen.schema;
18257
- const _cached = { ...schema6 };
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
- schema6.allOf = schema6.allOf ?? [];
18266
- schema6.allOf.push(refSchema);
18265
+ schema7.allOf = schema7.allOf ?? [];
18266
+ schema7.allOf.push(refSchema);
18267
18267
  } else {
18268
- Object.assign(schema6, refSchema);
18268
+ Object.assign(schema7, refSchema);
18269
18269
  }
18270
- Object.assign(schema6, _cached);
18270
+ Object.assign(schema7, _cached);
18271
18271
  const isParentRef = zodSchema._zod.parent === ref;
18272
18272
  if (isParentRef) {
18273
- for (const key in schema6) {
18273
+ for (const key in schema7) {
18274
18274
  if (key === "$ref" || key === "allOf")
18275
18275
  continue;
18276
18276
  if (!(key in _cached)) {
18277
- delete schema6[key];
18277
+ delete schema7[key];
18278
18278
  }
18279
18279
  }
18280
18280
  }
18281
18281
  if (refSchema.$ref && refSeen.def) {
18282
- for (const key in schema6) {
18282
+ for (const key in schema7) {
18283
18283
  if (key === "$ref" || key === "allOf")
18284
18284
  continue;
18285
- if (key in refSeen.def && JSON.stringify(schema6[key]) === JSON.stringify(refSeen.def[key])) {
18286
- delete schema6[key];
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
- schema6.$ref = parentSeen.schema.$ref;
18296
+ schema7.$ref = parentSeen.schema.$ref;
18297
18297
  if (parentSeen.def) {
18298
- for (const key in schema6) {
18298
+ for (const key in schema7) {
18299
18299
  if (key === "$ref" || key === "allOf")
18300
18300
  continue;
18301
- if (key in parentSeen.def && JSON.stringify(schema6[key]) === JSON.stringify(parentSeen.def[key])) {
18302
- delete schema6[key];
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: schema6,
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(schema5)?.id;
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(schema5)?.id;
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
- ...schema5["~standard"],
18360
+ ...schema6["~standard"],
18361
18361
  jsonSchema: {
18362
- input: createStandardJSONSchemaMethod(schema5, "input", ctx.processors),
18363
- output: createStandardJSONSchemaMethod(schema5, "output", ctx.processors)
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 = (schema5, processors = {}) => (params) => {
18431
+ createToJSONSchemaMethod = (schema6, processors = {}) => (params) => {
18432
18432
  const ctx = initializeContext({ ...params, processors });
18433
- process2(schema5, ctx);
18434
- extractDefs(ctx, schema5);
18435
- return finalize(ctx, schema5);
18433
+ process2(schema6, ctx);
18434
+ extractDefs(ctx, schema6);
18435
+ return finalize(ctx, schema6);
18436
18436
  };
18437
- createStandardJSONSchemaMethod = (schema5, io, processors = {}) => (params) => {
18437
+ createStandardJSONSchemaMethod = (schema6, io, processors = {}) => (params) => {
18438
18438
  const { libraryOptions, target } = params ?? {};
18439
18439
  const ctx = initializeContext({ ...libraryOptions ?? {}, target, io, processors });
18440
- process2(schema5, ctx);
18441
- extractDefs(ctx, schema5);
18442
- return finalize(ctx, schema5);
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 [_, schema5] = entry2;
18455
- process2(schema5, ctx2);
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, schema5] = entry2;
18466
- extractDefs(ctx2, schema5);
18467
- schemas[key] = finalize(ctx2, schema5);
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 = (schema5, ctx, _json, _params) => {
18495
+ stringProcessor = (schema6, ctx, _json, _params) => {
18496
18496
  const json2 = _json;
18497
18497
  json2.type = "string";
18498
- const { minimum, maximum, format: format3, patterns, contentEncoding } = schema5._zod.bag;
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 = (schema5, ctx, _json, _params) => {
18527
+ numberProcessor = (schema6, ctx, _json, _params) => {
18528
18528
  const json2 = _json;
18529
- const { minimum, maximum, format: format3, multipleOf, exclusiveMaximum, exclusiveMinimum } = schema5._zod.bag;
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 = (schema5, _ctx, json2, _params) => {
18605
- const def = schema5._zod.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 = (schema5, ctx, json2, _params) => {
18614
- const def = schema5._zod.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 = (schema5, _ctx, json2, _params) => {
18658
+ templateLiteralProcessor = (schema6, _ctx, json2, _params) => {
18659
18659
  const _json = json2;
18660
- const pattern = schema5._zod.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 = (schema5, _ctx, json2, _params) => {
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 } = schema5._zod.bag;
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 = (schema5, ctx, _json, params) => {
18718
+ arrayProcessor = (schema6, ctx, _json, params) => {
18719
18719
  const json2 = _json;
18720
- const def = schema5._zod.def;
18721
- const { minimum, maximum } = schema5._zod.bag;
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 = (schema5, ctx, _json, params) => {
18732
+ objectProcessor = (schema6, ctx, _json, params) => {
18733
18733
  const json2 = _json;
18734
- const def = schema5._zod.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 = (schema5, ctx, json2, params) => {
18769
- const def = schema5._zod.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 = (schema5, ctx, json2, params) => {
18782
- const def = schema5._zod.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 = (schema5, ctx, _json, params) => {
18798
+ tupleProcessor = (schema6, ctx, _json, params) => {
18799
18799
  const json2 = _json;
18800
- const def = schema5._zod.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 } = schema5._zod.bag;
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 = (schema5, ctx, _json, params) => {
18840
+ recordProcessor = (schema6, ctx, _json, params) => {
18841
18841
  const json2 = _json;
18842
- const def = schema5._zod.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 = (schema5, ctx, json2, params) => {
18877
- const def = schema5._zod.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(schema5);
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 = (schema5, ctx, _json, params) => {
18888
- const def = schema5._zod.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(schema5);
18890
+ const seen = ctx.seen.get(schema6);
18891
18891
  seen.ref = def.innerType;
18892
18892
  };
18893
- defaultProcessor = (schema5, ctx, json2, params) => {
18894
- const def = schema5._zod.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(schema5);
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 = (schema5, ctx, json2, params) => {
18901
- const def = schema5._zod.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(schema5);
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 = (schema5, ctx, json2, params) => {
18909
- const def = schema5._zod.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(schema5);
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 = (schema5, ctx, _json, params) => {
18922
- const def = schema5._zod.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(schema5);
18926
+ const seen = ctx.seen.get(schema6);
18927
18927
  seen.ref = innerType;
18928
18928
  };
18929
- readonlyProcessor = (schema5, ctx, json2, params) => {
18930
- const def = schema5._zod.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(schema5);
18932
+ const seen = ctx.seen.get(schema6);
18933
18933
  seen.ref = def.innerType;
18934
18934
  json2.readOnly = true;
18935
18935
  };
18936
- promiseProcessor = (schema5, ctx, _json, params) => {
18937
- const def = schema5._zod.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(schema5);
18939
+ const seen = ctx.seen.get(schema6);
18940
18940
  seen.ref = def.innerType;
18941
18941
  };
18942
- optionalProcessor = (schema5, ctx, _json, params) => {
18943
- const def = schema5._zod.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(schema5);
18945
+ const seen = ctx.seen.get(schema6);
18946
18946
  seen.ref = def.innerType;
18947
18947
  };
18948
- lazyProcessor = (schema5, ctx, _json, params) => {
18949
- const innerType = schema5._zod.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(schema5);
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(schema5, _params = { path: [], schemaPath: [] }) {
19056
- return process2(schema5, this.ctx, _params);
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(schema5, _params) {
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, schema5);
19072
- const result2 = finalize(this.ctx, schema5);
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(schema5) {
19902
- const shape = schema5._zod.def.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, schema5) {
20217
+ function preprocess(fn, schema6) {
20218
20218
  return new ZodPreprocess({
20219
20219
  type: "pipe",
20220
20220
  in: transform(fn),
20221
- out: schema5
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(schema5, defaultTarget) {
21046
- const $schema = schema5.$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(schema5, ctx) {
21077
- if (schema5.not !== void 0) {
21078
- if (typeof schema5.not === "object" && Object.keys(schema5.not).length === 0) {
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 (schema5.unevaluatedItems !== void 0) {
21083
+ if (schema6.unevaluatedItems !== void 0) {
21084
21084
  throw new Error("unevaluatedItems is not supported");
21085
21085
  }
21086
- if (schema5.unevaluatedProperties !== void 0) {
21086
+ if (schema6.unevaluatedProperties !== void 0) {
21087
21087
  throw new Error("unevaluatedProperties is not supported");
21088
21088
  }
21089
- if (schema5.if !== void 0 || schema5.then !== void 0 || schema5.else !== void 0) {
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 (schema5.dependentSchemas !== void 0 || schema5.dependentRequired !== void 0) {
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 (schema5.$ref) {
21096
- const refPath = schema5.$ref;
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 (schema5.enum !== void 0) {
21116
- const enumValues = schema5.enum;
21117
- if (ctx.version === "openapi-3.0" && schema5.nullable === true && enumValues.length === 1 && enumValues[0] === null) {
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 (schema5.const !== void 0) {
21136
- return z.literal(schema5.const);
21135
+ if (schema6.const !== void 0) {
21136
+ return z.literal(schema6.const);
21137
21137
  }
21138
- const type = schema5.type;
21138
+ const type = schema6.type;
21139
21139
  if (Array.isArray(type)) {
21140
21140
  const typeSchemas = type.map((t) => {
21141
- const typeSchema = { ...schema5, type: t };
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 (schema5.format) {
21160
- const format3 = schema5.format;
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 schema5.minLength === "number") {
21210
- stringSchema = stringSchema.min(schema5.minLength);
21209
+ if (typeof schema6.minLength === "number") {
21210
+ stringSchema = stringSchema.min(schema6.minLength);
21211
21211
  }
21212
- if (typeof schema5.maxLength === "number") {
21213
- stringSchema = stringSchema.max(schema5.maxLength);
21212
+ if (typeof schema6.maxLength === "number") {
21213
+ stringSchema = stringSchema.max(schema6.maxLength);
21214
21214
  }
21215
- if (schema5.pattern) {
21216
- stringSchema = stringSchema.regex(new RegExp(schema5.pattern));
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 schema5.minimum === "number") {
21225
- numberSchema = numberSchema.min(schema5.minimum);
21224
+ if (typeof schema6.minimum === "number") {
21225
+ numberSchema = numberSchema.min(schema6.minimum);
21226
21226
  }
21227
- if (typeof schema5.maximum === "number") {
21228
- numberSchema = numberSchema.max(schema5.maximum);
21227
+ if (typeof schema6.maximum === "number") {
21228
+ numberSchema = numberSchema.max(schema6.maximum);
21229
21229
  }
21230
- if (typeof schema5.exclusiveMinimum === "number") {
21231
- numberSchema = numberSchema.gt(schema5.exclusiveMinimum);
21232
- } else if (schema5.exclusiveMinimum === true && typeof schema5.minimum === "number") {
21233
- numberSchema = numberSchema.gt(schema5.minimum);
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 schema5.exclusiveMaximum === "number") {
21236
- numberSchema = numberSchema.lt(schema5.exclusiveMaximum);
21237
- } else if (schema5.exclusiveMaximum === true && typeof schema5.maximum === "number") {
21238
- numberSchema = numberSchema.lt(schema5.maximum);
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 schema5.multipleOf === "number") {
21241
- numberSchema = numberSchema.multipleOf(schema5.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 = schema5.properties || {};
21257
- const requiredSet = new Set(schema5.required || []);
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 (schema5.propertyNames) {
21263
- const keySchema = convertSchema(schema5.propertyNames, ctx);
21264
- const valueSchema = schema5.additionalProperties && typeof schema5.additionalProperties === "object" ? convertSchema(schema5.additionalProperties, ctx) : z.any();
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 (schema5.patternProperties) {
21275
- const patternProps = schema5.patternProperties;
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 (schema5.additionalProperties === false) {
21302
+ if (schema6.additionalProperties === false) {
21303
21303
  zodSchema = objectSchema.strict();
21304
- } else if (typeof schema5.additionalProperties === "object") {
21305
- zodSchema = objectSchema.catchall(convertSchema(schema5.additionalProperties, ctx));
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 = schema5.prefixItems;
21313
- const items = schema5.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 schema5.minItems === "number") {
21323
- zodSchema = zodSchema.check(z.minLength(schema5.minItems));
21322
+ if (typeof schema6.minItems === "number") {
21323
+ zodSchema = zodSchema.check(z.minLength(schema6.minItems));
21324
21324
  }
21325
- if (typeof schema5.maxItems === "number") {
21326
- zodSchema = zodSchema.check(z.maxLength(schema5.maxItems));
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 = schema5.additionalItems && typeof schema5.additionalItems === "object" ? convertSchema(schema5.additionalItems, ctx) : void 0;
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 schema5.minItems === "number") {
21337
- zodSchema = zodSchema.check(z.minLength(schema5.minItems));
21336
+ if (typeof schema6.minItems === "number") {
21337
+ zodSchema = zodSchema.check(z.minLength(schema6.minItems));
21338
21338
  }
21339
- if (typeof schema5.maxItems === "number") {
21340
- zodSchema = zodSchema.check(z.maxLength(schema5.maxItems));
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 schema5.minItems === "number") {
21346
- arraySchema = arraySchema.min(schema5.minItems);
21345
+ if (typeof schema6.minItems === "number") {
21346
+ arraySchema = arraySchema.min(schema6.minItems);
21347
21347
  }
21348
- if (typeof schema5.maxItems === "number") {
21349
- arraySchema = arraySchema.max(schema5.maxItems);
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(schema5, ctx) {
21363
- if (typeof schema5 === "boolean") {
21364
- return schema5 ? z.any() : z.never();
21362
+ function convertSchema(schema6, ctx) {
21363
+ if (typeof schema6 === "boolean") {
21364
+ return schema6 ? z.any() : z.never();
21365
21365
  }
21366
- let baseSchema = convertBaseSchema(schema5, ctx);
21367
- const hasExplicitType = schema5.type || schema5.enum !== void 0 || schema5.const !== void 0;
21368
- if (schema5.anyOf && Array.isArray(schema5.anyOf)) {
21369
- const options = schema5.anyOf.map((s) => convertSchema(s, ctx));
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 (schema5.oneOf && Array.isArray(schema5.oneOf)) {
21374
- const options = schema5.oneOf.map((s) => convertSchema(s, ctx));
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 (schema5.allOf && Array.isArray(schema5.allOf)) {
21379
- if (schema5.allOf.length === 0) {
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(schema5.allOf[0], ctx);
21382
+ let result2 = hasExplicitType ? baseSchema : convertSchema(schema6.allOf[0], ctx);
21383
21383
  const startIdx = hasExplicitType ? 0 : 1;
21384
- for (let i2 = startIdx; i2 < schema5.allOf.length; i2++) {
21385
- result2 = z.intersection(result2, convertSchema(schema5.allOf[i2], ctx));
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 (schema5.nullable === true && ctx.version === "openapi-3.0") {
21390
+ if (schema6.nullable === true && ctx.version === "openapi-3.0") {
21391
21391
  baseSchema = z.nullable(baseSchema);
21392
21392
  }
21393
- if (schema5.readOnly === true) {
21393
+ if (schema6.readOnly === true) {
21394
21394
  baseSchema = z.readonly(baseSchema);
21395
21395
  }
21396
- if (schema5.default !== void 0) {
21397
- baseSchema = baseSchema.default(schema5.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 schema5) {
21403
- extraMeta[key] = schema5[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 schema5) {
21409
- extraMeta[key] = schema5[key];
21408
+ if (key in schema6) {
21409
+ extraMeta[key] = schema6[key];
21410
21410
  }
21411
21411
  }
21412
- for (const key of Object.keys(schema5)) {
21412
+ for (const key of Object.keys(schema6)) {
21413
21413
  if (!RECOGNIZED_KEYS.has(key)) {
21414
- extraMeta[key] = schema5[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 (schema5.description) {
21421
- baseSchema = baseSchema.describe(schema5.description);
21420
+ if (schema6.description) {
21421
+ baseSchema = baseSchema.describe(schema6.description);
21422
21422
  }
21423
21423
  return baseSchema;
21424
21424
  }
21425
- function fromJSONSchema(schema5, params) {
21426
- if (typeof schema5 === "boolean") {
21427
- return schema5 ? z.any() : z.never();
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(schema5));
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
  }
@@ -22422,12 +22422,12 @@ function resolveSkillProtocolEnvironment(raw) {
22422
22422
  `FINCH_ENVIRONMENT must explicitly be local, test, or production; received ${received}.`
22423
22423
  );
22424
22424
  }
22425
- function parseTypedRegistry(schema5, value) {
22426
- const parsed2 = schema5.safeParse(value);
22427
- if (!parsed2.success) {
22428
- throw new DeploymentManifestError(`Invalid chain deployment manifest: ${external_exports.prettifyError(parsed2.error)}`);
22425
+ function parseTypedRegistry(schema6, value) {
22426
+ const parsed3 = schema6.safeParse(value);
22427
+ if (!parsed3.success) {
22428
+ throw new DeploymentManifestError(`Invalid chain deployment manifest: ${external_exports.prettifyError(parsed3.error)}`);
22429
22429
  }
22430
- return parsed2.data;
22430
+ return parsed3.data;
22431
22431
  }
22432
22432
  function clientDeploymentsByChain(protocol, deployments) {
22433
22433
  const byChain = {};
@@ -22919,6 +22919,48 @@ var init_dashboard_prices2 = __esm({
22919
22919
  }
22920
22920
  });
22921
22921
 
22922
+ // ../../packages/deployment-manifest/src/platform/sales-inquiries.json
22923
+ var sales_inquiries_default;
22924
+ var init_sales_inquiries = __esm({
22925
+ "../../packages/deployment-manifest/src/platform/sales-inquiries.json"() {
22926
+ sales_inquiries_default = {
22927
+ schemaVersion: 1,
22928
+ kind: "sales_inquiries",
22929
+ environments: {
22930
+ local: {
22931
+ enabled: false,
22932
+ ipHourlyLimit: 5,
22933
+ emailDailyLimit: 10
22934
+ },
22935
+ test: {
22936
+ enabled: true,
22937
+ ipHourlyLimit: 5,
22938
+ emailDailyLimit: 10
22939
+ },
22940
+ production: {
22941
+ enabled: false,
22942
+ ipHourlyLimit: 5,
22943
+ emailDailyLimit: 10
22944
+ }
22945
+ }
22946
+ };
22947
+ }
22948
+ });
22949
+
22950
+ // ../../packages/deployment-manifest/src/platform/sales-inquiries.ts
22951
+ var policy, schema, parseSalesInquiryManifest, parsed;
22952
+ var init_sales_inquiries2 = __esm({
22953
+ "../../packages/deployment-manifest/src/platform/sales-inquiries.ts"() {
22954
+ "use strict";
22955
+ init_zod();
22956
+ init_sales_inquiries();
22957
+ 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) });
22958
+ 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 }) });
22959
+ parseSalesInquiryManifest = (value) => schema.parse(value);
22960
+ parsed = parseSalesInquiryManifest(sales_inquiries_default);
22961
+ }
22962
+ });
22963
+
22922
22964
  // ../../packages/deployment-manifest/src/platform/get-help.json
22923
22965
  var get_help_default;
22924
22966
  var init_get_help = __esm({
@@ -22936,25 +22978,25 @@ var init_get_help = __esm({
22936
22978
  });
22937
22979
 
22938
22980
  // ../../packages/deployment-manifest/src/platform/get-help.ts
22939
- var policy, schema, parseGetHelpManifest, parsed;
22981
+ var policy2, schema2, parseGetHelpManifest, parsed2;
22940
22982
  var init_get_help2 = __esm({
22941
22983
  "../../packages/deployment-manifest/src/platform/get-help.ts"() {
22942
22984
  "use strict";
22943
22985
  init_zod();
22944
22986
  init_get_help();
22945
- policy = external_exports.strictObject({
22987
+ policy2 = external_exports.strictObject({
22946
22988
  enabled: external_exports.boolean(),
22947
22989
  ipHourlyLimit: external_exports.number().int().min(1).max(100),
22948
22990
  emailDailyLimit: external_exports.number().int().min(1).max(100),
22949
22991
  dailyUploadBytes: external_exports.number().int().min(2097152).max(1073741824)
22950
22992
  });
22951
- schema = external_exports.strictObject({
22993
+ schema2 = external_exports.strictObject({
22952
22994
  schemaVersion: external_exports.literal(1),
22953
22995
  kind: external_exports.literal("get_help"),
22954
- environments: external_exports.strictObject({ local: policy, test: policy, production: policy })
22996
+ environments: external_exports.strictObject({ local: policy2, test: policy2, production: policy2 })
22955
22997
  });
22956
- parseGetHelpManifest = (value) => schema.parse(value);
22957
- parsed = parseGetHelpManifest(get_help_default);
22998
+ parseGetHelpManifest = (value) => schema2.parse(value);
22999
+ parsed2 = parseGetHelpManifest(get_help_default);
22958
23000
  }
22959
23001
  });
22960
23002
 
@@ -22985,9 +23027,9 @@ var init_passkey_safe = __esm({
22985
23027
 
22986
23028
  // ../../packages/deployment-manifest/src/platform/passkey-safe.ts
22987
23029
  function parsePasskeySafeManifest(input) {
22988
- return schema2.parse(input);
23030
+ return schema3.parse(input);
22989
23031
  }
22990
- var disabled, enabled, schema2, manifest2;
23032
+ var disabled, enabled, schema3, manifest2;
22991
23033
  var init_passkey_safe2 = __esm({
22992
23034
  "../../packages/deployment-manifest/src/platform/passkey-safe.ts"() {
22993
23035
  "use strict";
@@ -23004,7 +23046,7 @@ var init_passkey_safe2 = __esm({
23004
23046
  minimumGasWei: external_exports.string().regex(/^[1-9][0-9]*$/),
23005
23047
  maxGasPerTransaction: external_exports.string().regex(/^[1-9][0-9]*$/)
23006
23048
  });
23007
- schema2 = external_exports.strictObject({
23049
+ schema3 = external_exports.strictObject({
23008
23050
  schemaVersion: external_exports.literal(1),
23009
23051
  kind: external_exports.literal("passkey_safe"),
23010
23052
  environments: external_exports.strictObject({
@@ -23270,9 +23312,9 @@ var init_agenton_payout = __esm({
23270
23312
 
23271
23313
  // ../../packages/deployment-manifest/src/platform/agenton-payout.ts
23272
23314
  function parseAgentonPayoutManifest(input) {
23273
- return schema3.parse(input);
23315
+ return schema4.parse(input);
23274
23316
  }
23275
- var origin, environment, schema3, manifest3;
23317
+ var origin, environment, schema4, manifest3;
23276
23318
  var init_agenton_payout2 = __esm({
23277
23319
  "../../packages/deployment-manifest/src/platform/agenton-payout.ts"() {
23278
23320
  "use strict";
@@ -23283,7 +23325,7 @@ var init_agenton_payout2 = __esm({
23283
23325
  return url2.protocol === "https:" && url2.origin === value && !url2.username && !url2.password;
23284
23326
  });
23285
23327
  environment = external_exports.strictObject({ enabled: external_exports.boolean(), mandateId: external_exports.string().min(1).nullable() });
23286
- schema3 = external_exports.strictObject({
23328
+ schema4 = external_exports.strictObject({
23287
23329
  schemaVersion: external_exports.literal(1),
23288
23330
  kind: external_exports.literal("agenton_payout"),
23289
23331
  agentIdBaseUrl: origin,
@@ -23322,22 +23364,22 @@ var init_merchant_avatar_video = __esm({
23322
23364
 
23323
23365
  // ../../packages/deployment-manifest/src/platform/merchant-avatar-video.ts
23324
23366
  function parseMerchantAvatarVideoManifest(input) {
23325
- return schema4.parse(input);
23367
+ return schema5.parse(input);
23326
23368
  }
23327
- var policy2, schema4, manifest4;
23369
+ var policy3, schema5, manifest4;
23328
23370
  var init_merchant_avatar_video2 = __esm({
23329
23371
  "../../packages/deployment-manifest/src/platform/merchant-avatar-video.ts"() {
23330
23372
  "use strict";
23331
23373
  init_zod();
23332
23374
  init_merchant_avatar_video();
23333
- policy2 = external_exports.discriminatedUnion("enabled", [
23375
+ policy3 = external_exports.discriminatedUnion("enabled", [
23334
23376
  external_exports.strictObject({ enabled: external_exports.literal(false) }),
23335
23377
  external_exports.strictObject({ enabled: external_exports.literal(true), offerId: external_exports.uuid(), dailyLimit: external_exports.number().int().min(1).max(1e4) })
23336
23378
  ]);
23337
- schema4 = external_exports.strictObject({
23379
+ schema5 = external_exports.strictObject({
23338
23380
  schemaVersion: external_exports.literal(1),
23339
23381
  kind: external_exports.literal("merchant_avatar_video"),
23340
- environments: external_exports.strictObject({ local: policy2, test: policy2, production: policy2 })
23382
+ environments: external_exports.strictObject({ local: policy3, test: policy3, production: policy3 })
23341
23383
  });
23342
23384
  manifest4 = parseMerchantAvatarVideoManifest(merchant_avatar_video_default);
23343
23385
  }
@@ -23357,26 +23399,26 @@ var init_generator = __esm({
23357
23399
  });
23358
23400
 
23359
23401
  // ../../packages/deployment-manifest/src/platform/generator.ts
23360
- var policy3, manifest5;
23402
+ var policy4, manifest5;
23361
23403
  var init_generator2 = __esm({
23362
23404
  "../../packages/deployment-manifest/src/platform/generator.ts"() {
23363
23405
  "use strict";
23364
23406
  init_zod();
23365
23407
  init_generator();
23366
- policy3 = external_exports.strictObject({ enabled: external_exports.boolean() });
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: policy3, test: policy3, production: policy3 }) }).parse(generator_default);
23408
+ policy4 = external_exports.strictObject({ enabled: external_exports.boolean() });
23409
+ 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
23410
  }
23369
23411
  });
23370
23412
 
23371
23413
  // ../../packages/deployment-manifest/src/platform/index.ts
23372
- function parseManifest(label, schema5, value) {
23373
- const parsed2 = schema5.safeParse(value);
23374
- if (!parsed2.success) {
23414
+ function parseManifest(label, schema6, value) {
23415
+ const parsed3 = schema6.safeParse(value);
23416
+ if (!parsed3.success) {
23375
23417
  throw new DeploymentManifestError(
23376
- `Invalid ${label} deployment manifest: ${external_exports.prettifyError(parsed2.error)}`
23418
+ `Invalid ${label} deployment manifest: ${external_exports.prettifyError(parsed3.error)}`
23377
23419
  );
23378
23420
  }
23379
- return parsed2.data;
23421
+ return parsed3.data;
23380
23422
  }
23381
23423
  function parseInternalAppsManifest(value) {
23382
23424
  return parseManifest("internal-apps", internalAppsManifestSchema, value);
@@ -23415,6 +23457,7 @@ var init_platform = __esm({
23415
23457
  "use strict";
23416
23458
  init_zod();
23417
23459
  init_dashboard_prices2();
23460
+ init_sales_inquiries2();
23418
23461
  init_get_help2();
23419
23462
  init_passkey_safe2();
23420
23463
  init_web_analytics();
@@ -23581,6 +23624,52 @@ var init_public = __esm({
23581
23624
  }
23582
23625
  });
23583
23626
 
23627
+ // ../../packages/skill-market-contracts/src/publication-state.ts
23628
+ async function readSkillPublicationState(reader, input) {
23629
+ const { request: request2 } = input;
23630
+ 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.");
23631
+ const blockNumber2 = await reader.blockNumber();
23632
+ if (blockNumber2 < BigInt(1)) throw new TypeError("Skill RPC has no confirmed publication block.");
23633
+ const read2 = (functionName, args, contract = "token") => reader.read({ contract, functionName, args, blockNumber: blockNumber2 });
23634
+ const id = request2.action === "createSkill" ? await read2("skillIdBySlug", [request2.slug]) : BigInt(String(request2.skillId));
23635
+ if (typeof id !== "bigint" || id < BigInt(0)) throw new TypeError("Invalid on-chain Skill id.");
23636
+ const result2 = (completed) => ({ completed, skillId: id === BigInt(0) ? null : id.toString(), blockNumber: blockNumber2.toString() });
23637
+ if (id === BigInt(0)) return result2(false);
23638
+ const owner = await read2("ownerOf", [id]);
23639
+ if (typeof owner !== "string" || !/^0x[0-9a-fA-F]{40}$/u.test(owner)) throw new TypeError("Invalid on-chain Skill owner.");
23640
+ if (owner.toLowerCase() !== input.walletAddress.toLowerCase()) throw new SkillPublicationConflictError(
23641
+ request2.action === "createSkill" ? "SLUG_TAKEN" : "PUBLICATION_CONFLICT",
23642
+ request2.action === "createSkill" ? "This Skill slug is already occupied by another wallet." : "This Skill no longer belongs to the signing wallet."
23643
+ );
23644
+ const binding = await read2("skillOf", [id]);
23645
+ 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.");
23646
+ const matches = binding.version === BigInt(input.targetVersion) && binding.packageHash.toLowerCase() === input.packageHash.toLowerCase();
23647
+ if (!matches) {
23648
+ if (request2.action === "updateSkill" && binding.version === BigInt(input.targetVersion - 1)) return result2(false);
23649
+ throw new SkillPublicationConflictError("PUBLICATION_CONFLICT", "On-chain Skill content no longer matches this publication plan.");
23650
+ }
23651
+ if (request2.action === "setSkillURI") return result2(await read2("skillURI", [id]) === request2.packageURI);
23652
+ if (request2.action === "setLitData") {
23653
+ const set2 = await read2("litDataSet", [id, BigInt(input.targetVersion)], "instance");
23654
+ if (typeof set2 !== "boolean") throw new TypeError("Invalid on-chain Skill key state.");
23655
+ return result2(set2);
23656
+ }
23657
+ return result2(true);
23658
+ }
23659
+ var SkillPublicationConflictError;
23660
+ var init_publication_state = __esm({
23661
+ "../../packages/skill-market-contracts/src/publication-state.ts"() {
23662
+ "use strict";
23663
+ SkillPublicationConflictError = class extends Error {
23664
+ constructor(code, message) {
23665
+ super(message);
23666
+ this.code = code;
23667
+ }
23668
+ code;
23669
+ };
23670
+ }
23671
+ });
23672
+
23584
23673
  // ../../packages/skill-market-contracts/src/client.ts
23585
23674
  function skillV3SourceCommit(chainId) {
23586
23675
  return getSkillProtocolDeploymentByChainId(chainId).sourceCommit;
@@ -23612,6 +23701,7 @@ var init_client = __esm({
23612
23701
  init_common();
23613
23702
  init_public();
23614
23703
  init_cli_signing();
23704
+ init_publication_state();
23615
23705
  SKILL_V3_CHAIN_IDS = getAllSkillProtocolChainIds();
23616
23706
  SKILL_V3_DEPLOYMENTS = Object.freeze(SKILL_V3_CHAIN_IDS.map((chainId) => {
23617
23707
  const deployment = getSkillProtocolDeploymentByChainId(chainId);
@@ -24243,7 +24333,7 @@ function localFailureMessage(error51) {
24243
24333
  if (publicInputMessages.includes(error51.message)) return error51.message;
24244
24334
  return "Command input does not match the expected schema. Check finch help for this command.";
24245
24335
  }
24246
- var CliAuthorityError, CliProductionUnavailableError, BrowserOpenError, MCP_AUTHORIZATION_FLOW_GUIDANCE, McpAuthorizationFlowError, CliUsageError, CLI_SESSION_RENEWAL_GUIDANCE, CliSkillSourceError, CliSkillPresentationStaleError, CliSkillRecoveryUncertainError, CliSkillPublicationError;
24336
+ var CliAuthorityError, CliProductionUnavailableError, BrowserOpenError, MCP_AUTHORIZATION_FLOW_GUIDANCE, McpAuthorizationFlowError, CliUsageError, CLI_SESSION_RENEWAL_GUIDANCE, CliSkillSourceError, CliSkillPresentationStaleError, CliSkillPublicationError, SkillPublicationTransactionFailedError;
24247
24337
  var init_cli_error = __esm({
24248
24338
  "src/cli-error.ts"() {
24249
24339
  "use strict";
@@ -24322,14 +24412,6 @@ var init_cli_error = __esm({
24322
24412
  planVersion;
24323
24413
  liveVersion;
24324
24414
  };
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
24415
  CliSkillPublicationError = class extends Error {
24334
24416
  constructor(diagnostic, cause) {
24335
24417
  super(cause instanceof Error ? cause.message : "Skill publication failed.", { cause });
@@ -24338,6 +24420,12 @@ var init_cli_error = __esm({
24338
24420
  }
24339
24421
  diagnostic;
24340
24422
  };
24423
+ SkillPublicationTransactionFailedError = class extends Error {
24424
+ constructor() {
24425
+ super("Skill publication transaction reverted; retry the same publication command.");
24426
+ this.name = "SkillPublicationTransactionFailedError";
24427
+ }
24428
+ };
24341
24429
  }
24342
24430
  });
24343
24431
 
@@ -29687,6 +29775,64 @@ var init_credentials = __esm({
29687
29775
  }
29688
29776
  });
29689
29777
 
29778
+ // ../../packages/agent-market-contracts/src/v1/diagnostics.ts
29779
+ function safeFailureDiagnostic(cause) {
29780
+ let category = "unexpected";
29781
+ let errorType = "NonErrorFailure";
29782
+ let transportCode = null;
29783
+ let sqlState = null;
29784
+ let httpStatus = null;
29785
+ let rpcMethod = null;
29786
+ const seen = /* @__PURE__ */ new Set();
29787
+ let current = cause;
29788
+ for (let depth = 0; depth < 8 && current !== null && typeof current === "object" && !seen.has(current); depth++) {
29789
+ seen.add(current);
29790
+ const value = current;
29791
+ if (typeof value.name === "string" && [
29792
+ "Error",
29793
+ "TypeError",
29794
+ "SyntaxError",
29795
+ "AbortError",
29796
+ "TimeoutError",
29797
+ "HttpRequestError",
29798
+ "RpcRequestError",
29799
+ "TransactionExecutionError",
29800
+ "ContractFunctionExecutionError",
29801
+ "ContractFunctionRevertedError",
29802
+ "WaitForTransactionReceiptTimeoutError"
29803
+ ].includes(value.name)) errorType = value.name;
29804
+ 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)) {
29805
+ transportCode = value.code;
29806
+ category = value.code.includes("TIME") ? "timeout" : "connection_failure";
29807
+ }
29808
+ if (typeof value.code === "string" && ["08000", "08001", "08003", "08006", "08004", "08007", "08P01", "23505", "42501", "42703", "42P01", "42883", "57014", "53300", "57P01", "XX000"].includes(value.code)) {
29809
+ sqlState = value.code;
29810
+ category = value.code.startsWith("08") ? "connection_failure" : value.code === "57014" ? "timeout" : "database_failure";
29811
+ }
29812
+ if (typeof value.status === "number" && Number.isInteger(value.status) && value.status >= 400 && value.status <= 599) {
29813
+ httpStatus = value.status;
29814
+ category = value.status === 429 ? "rate_limited" : value.status === 401 ? "authentication" : value.status === 403 ? "permission" : "http_failure";
29815
+ }
29816
+ if (typeof value.method === "string" && ["eth_chainId", "eth_call", "eth_sendRawTransaction", "eth_sendTransaction", "eth_getTransactionReceipt", "eth_getTransactionByHash"].includes(value.method)) rpcMethod = value.method;
29817
+ if (typeof value.name === "string" && ["AbortError", "TimeoutError", "WaitForTransactionReceiptTimeoutError"].includes(value.name)) category = "timeout";
29818
+ if (value.name === "ContractFunctionRevertedError") category = "transaction_reverted";
29819
+ current = value.cause;
29820
+ }
29821
+ return Object.freeze({ category, errorType, transportCode, httpStatus, rpcMethod, sqlState });
29822
+ }
29823
+ var ONLINE_API_TECHNICAL_ERROR_CODES;
29824
+ var init_diagnostics = __esm({
29825
+ "../../packages/agent-market-contracts/src/v1/diagnostics.ts"() {
29826
+ "use strict";
29827
+ ONLINE_API_TECHNICAL_ERROR_CODES = [
29828
+ "API_CONNECTION_FAILED",
29829
+ "API_TIMEOUT",
29830
+ "API_RATE_LIMITED",
29831
+ "API_RESPONSE_INVALID"
29832
+ ];
29833
+ }
29834
+ });
29835
+
29690
29836
  // ../../packages/agent-market-contracts/src/v1/validation-input.ts
29691
29837
  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
29838
  var init_validation_input = __esm({
@@ -29754,6 +29900,7 @@ var creatorRequestReasonCodes, buyerStateReasonCodes, agentMarketErrorCodes, nex
29754
29900
  var init_errors3 = __esm({
29755
29901
  "../../packages/agent-market-contracts/src/v1/errors.ts"() {
29756
29902
  "use strict";
29903
+ init_diagnostics();
29757
29904
  init_common3();
29758
29905
  init_validation_input();
29759
29906
  creatorRequestReasonCodes = [
@@ -29772,6 +29919,7 @@ var init_errors3 = __esm({
29772
29919
  "AVATAR_VIDEO_PLATFORM_DAILY_LIMIT_REACHED"
29773
29920
  ];
29774
29921
  agentMarketErrorCodes = [
29922
+ ...ONLINE_API_TECHNICAL_ERROR_CODES,
29775
29923
  "AGENT_MARKET_AUTH_REQUIRED",
29776
29924
  "AGENT_MARKET_SCOPE_DENIED",
29777
29925
  "AGENT_MARKET_REQUEST_INVALID",
@@ -29815,6 +29963,10 @@ var init_errors3 = __esm({
29815
29963
  "none"
29816
29964
  ];
29817
29965
  AGENT_MARKET_ERROR_DEFINITIONS = Object.freeze({
29966
+ API_CONNECTION_FAILED: { httpStatus: 503, retryable: true, nextAction: "retry_later" },
29967
+ API_TIMEOUT: { httpStatus: 504, retryable: true, nextAction: "retry_later" },
29968
+ API_RATE_LIMITED: { httpStatus: 429, retryable: true, nextAction: "retry_later" },
29969
+ API_RESPONSE_INVALID: { httpStatus: 502, retryable: false, nextAction: "contact_support" },
29818
29970
  AGENT_MARKET_AUTH_REQUIRED: { httpStatus: 401, retryable: false, nextAction: "authenticate" },
29819
29971
  AGENT_MARKET_SCOPE_DENIED: { httpStatus: 403, retryable: false, nextAction: "request_scope" },
29820
29972
  AGENT_MARKET_REQUEST_INVALID: { httpStatus: 400, retryable: false, nextAction: "fix_request" },
@@ -30213,7 +30365,7 @@ var init_agent_cli = __esm({
30213
30365
  operationId: { type: "null" },
30214
30366
  currentRevision: { type: "null" },
30215
30367
  currentEtag: nullableCliStringSchema,
30216
- traceId: { type: "null" }
30368
+ traceId: nullableCliStringSchema
30217
30369
  })
30218
30370
  });
30219
30371
  AGENT_CLI_RECOVERY_CONTRACT = Object.freeze({
@@ -30947,7 +31099,7 @@ var init_transfers = __esm({
30947
31099
  "../../packages/agent-market-contracts/src/v1/transfers.ts"() {
30948
31100
  "use strict";
30949
31101
  init_common3();
30950
- described = (schema5, description) => Object.freeze({ ...schema5, description });
31102
+ described = (schema6, description) => Object.freeze({ ...schema6, description });
30951
31103
  nullSchema = Object.freeze({ type: "null" });
30952
31104
  nonNegativeIntegerStringSchema = Object.freeze({ type: "string", pattern: "^(0|[1-9][0-9]*)$" });
30953
31105
  headerMapSchema = Object.freeze({
@@ -31270,7 +31422,7 @@ var init_buyer = __esm({
31270
31422
  description: "Units of work for a generation offer; 1 for conversation, task, and Direct calls."
31271
31423
  }
31272
31424
  }, []);
31273
- described2 = (schema5, description) => Object.freeze({ ...schema5, description });
31425
+ described2 = (schema6, description) => Object.freeze({ ...schema6, description });
31274
31426
  callEligibilityResponseSchema = strictObjectSchema2({
31275
31427
  serviceVersionId: described2(canonicalUuidSchema2, "Service version the call would run on."),
31276
31428
  offerId: { anyOf: [canonicalUuidSchema2, nullSchema2], description: "The checked AgentOn offer, or null for a Direct API version." },
@@ -32521,6 +32673,7 @@ var PRODUCTION_AUTH_CHAIN_IDS, TEST_AUTH_CHAIN_IDS, IDENTITY_SCOPE_ORDER_CONTRAC
32521
32673
  var init_identity = __esm({
32522
32674
  "../../packages/agent-market-contracts/src/v1/identity.ts"() {
32523
32675
  "use strict";
32676
+ init_diagnostics();
32524
32677
  init_common3();
32525
32678
  PRODUCTION_AUTH_CHAIN_IDS = Object.freeze([1, 10, 56, 8453, 42161, 43114, 1776]);
32526
32679
  TEST_AUTH_CHAIN_IDS = Object.freeze([84532]);
@@ -32580,6 +32733,7 @@ var init_identity = __esm({
32580
32733
  }
32581
32734
  });
32582
32735
  identityErrorCodes = [
32736
+ ...ONLINE_API_TECHNICAL_ERROR_CODES,
32583
32737
  "AGENT_AUTH_REQUEST_INVALID",
32584
32738
  "AGENT_AUTH_CHAIN_UNSUPPORTED",
32585
32739
  "AGENT_CLI_WALLET_KIND_UNSUPPORTED",
@@ -33237,7 +33391,7 @@ var init_owner_configuration = __esm({
33237
33391
  "use strict";
33238
33392
  init_common3();
33239
33393
  init_localization();
33240
- nullable2 = (schema5) => ({ anyOf: [schema5, { type: "null" }] });
33394
+ nullable2 = (schema6) => ({ anyOf: [schema6, { type: "null" }] });
33241
33395
  text3 = { type: "string" };
33242
33396
  time3 = { type: "string", format: "date-time" };
33243
33397
  revision = positiveRevisionSchema;
@@ -33389,7 +33543,7 @@ var init_buyer_library = __esm({
33389
33543
  init_common3();
33390
33544
  units = { type: "string", pattern: "^[0-9]+$" };
33391
33545
  time4 = { type: "string", format: "date-time" };
33392
- nullable3 = (schema5) => ({ anyOf: [schema5, { type: "null" }] });
33546
+ nullable3 = (schema6) => ({ anyOf: [schema6, { type: "null" }] });
33393
33547
  buyerAgentLibraryAssetSchema = strictObjectSchema2({
33394
33548
  serviceVersionId: canonicalUuidSchema2,
33395
33549
  acquiredAt: time4,
@@ -33449,7 +33603,7 @@ var init_merchant_calls = __esm({
33449
33603
  "../../packages/agent-market-contracts/src/v1/merchant-calls.ts"() {
33450
33604
  "use strict";
33451
33605
  init_common3();
33452
- described3 = (schema5, description) => Object.freeze({ ...schema5, description });
33606
+ described3 = (schema6, description) => Object.freeze({ ...schema6, description });
33453
33607
  nullSchema5 = Object.freeze({ type: "null" });
33454
33608
  unitsSchema = Object.freeze({ type: "string", pattern: "^(0|[1-9][0-9]*)$" });
33455
33609
  instantSchema = Object.freeze({ type: "string", format: "date-time" });
@@ -33509,7 +33663,7 @@ var init_reviews = __esm({
33509
33663
  "../../packages/agent-market-contracts/src/v1/reviews.ts"() {
33510
33664
  "use strict";
33511
33665
  init_common3();
33512
- described4 = (schema5, description) => Object.freeze({ ...schema5, description });
33666
+ described4 = (schema6, description) => Object.freeze({ ...schema6, description });
33513
33667
  nullSchema6 = Object.freeze({ type: "null" });
33514
33668
  ratingSchema = Object.freeze({ type: "integer", minimum: 1, maximum: 5 });
33515
33669
  averageSchema = Object.freeze({ anyOf: [{ type: "number", minimum: 1, maximum: 5 }, nullSchema6] });
@@ -33826,12 +33980,12 @@ var init_public_catalog = __esm({
33826
33980
  });
33827
33981
 
33828
33982
  // ../../packages/agent-market-contracts/src/v1/public-catalog-wire.ts
33829
- function describeSummary(schema5) {
33830
- const properties = schema5.properties;
33831
- const alternatives = schema5.anyOf;
33983
+ function describeSummary(schema6) {
33984
+ const properties = schema6.properties;
33985
+ const alternatives = schema6.anyOf;
33832
33986
  return {
33833
- ...schema5,
33834
- ...schema5.const === "pdf" ? { type: "string" } : {},
33987
+ ...schema6,
33988
+ ...schema6.const === "pdf" ? { type: "string" } : {},
33835
33989
  ...properties ? { properties: Object.fromEntries(Object.entries(properties).map(([name, property]) => [name, {
33836
33990
  ...describeSummary(property),
33837
33991
  ...descriptions[name] ? { description: [descriptions[name], property.description].filter(Boolean).join(" ") } : {}
@@ -33839,9 +33993,9 @@ function describeSummary(schema5) {
33839
33993
  ...alternatives ? { anyOf: alternatives.map(describeSummary) } : {}
33840
33994
  };
33841
33995
  }
33842
- function pageSchema(schema5) {
33843
- const properties = schema5.properties;
33844
- return { ...schema5, properties: {
33996
+ function pageSchema(schema6) {
33997
+ const properties = schema6.properties;
33998
+ return { ...schema6, properties: {
33845
33999
  ...properties,
33846
34000
  services: { ...properties.services, items: publicCatalogWireServiceSchema }
33847
34001
  } };
@@ -34942,18 +35096,18 @@ var init_operations = __esm({
34942
35096
  });
34943
35097
 
34944
35098
  // ../../packages/agent-market-contracts/src/v1/mcp.ts
34945
- function bodyVariants(schema5) {
34946
- if (schema5 === void 0) return [{}];
34947
- const candidate = schema5;
35099
+ function bodyVariants(schema6) {
35100
+ if (schema6 === void 0) return [{}];
35101
+ const candidate = schema6;
34948
35102
  if (candidate.oneOf !== void 0) return candidate.oneOf.flatMap((variant) => bodyVariants(variant));
34949
35103
  return [candidate];
34950
35104
  }
34951
35105
  function unionProperties(variants) {
34952
35106
  const candidates = /* @__PURE__ */ new Map();
34953
35107
  for (const { properties } of variants) {
34954
- for (const [field, schema5] of Object.entries(properties ?? {})) {
35108
+ for (const [field, schema6] of Object.entries(properties ?? {})) {
34955
35109
  const alternatives = candidates.get(field) ?? /* @__PURE__ */ new Map();
34956
- alternatives.set(JSON.stringify(schema5), schema5);
35110
+ alternatives.set(JSON.stringify(schema6), schema6);
34957
35111
  candidates.set(field, alternatives);
34958
35112
  }
34959
35113
  }
@@ -35059,12 +35213,12 @@ var init_mcp = __esm({
35059
35213
  });
35060
35214
 
35061
35215
  // ../../packages/agent-market-contracts/src/v1/openapi.ts
35062
- function mediaTypeContent(contentType, schema5) {
35063
- return { content: { [contentType]: { schema: schema5 } } };
35216
+ function mediaTypeContent(contentType, schema6) {
35217
+ return { content: { [contentType]: { schema: schema6 } } };
35064
35218
  }
35065
35219
  function responseHeaderObjects(schemas) {
35066
35220
  return Object.fromEntries(
35067
- Object.entries(schemas).map(([name, schema5]) => [name, { schema: schema5 }])
35221
+ Object.entries(schemas).map(([name, schema6]) => [name, { schema: schema6 }])
35068
35222
  );
35069
35223
  }
35070
35224
  function operationParameters(http3) {
@@ -35074,16 +35228,16 @@ function operationParameters(http3) {
35074
35228
  required: true,
35075
35229
  schema: canonicalUuidSchema2
35076
35230
  }));
35077
- for (const [name, schema5] of Object.entries(http3.querySchema?.properties ?? {})) {
35231
+ for (const [name, schema6] of Object.entries(http3.querySchema?.properties ?? {})) {
35078
35232
  parameters.push({
35079
35233
  name,
35080
35234
  in: "query",
35081
35235
  required: http3.querySchema?.required?.includes(name) ?? false,
35082
- schema: schema5
35236
+ schema: schema6
35083
35237
  });
35084
35238
  }
35085
- for (const [name, schema5] of Object.entries(http3.requestHeaders ?? {})) {
35086
- parameters.push({ name, in: "header", required: true, schema: schema5 });
35239
+ for (const [name, schema6] of Object.entries(http3.requestHeaders ?? {})) {
35240
+ parameters.push({ name, in: "header", required: true, schema: schema6 });
35087
35241
  }
35088
35242
  if (http3.idempotencyRequired) parameters.push({ $ref: "#/components/parameters/IdempotencyKey" });
35089
35243
  if (http3.ifMatchRequired) parameters.push({ $ref: "#/components/parameters/IfMatch" });
@@ -35440,6 +35594,7 @@ var init_v1 = __esm({
35440
35594
  init_avatar_video();
35441
35595
  init_owner_configuration();
35442
35596
  init_buyer_library();
35597
+ init_diagnostics();
35443
35598
  }
35444
35599
  });
35445
35600
 
@@ -35632,7 +35787,7 @@ var init_schemas3 = __esm({
35632
35787
  _mutation: openObjectSchema2
35633
35788
  }, ["taskId", "poolIdBytes32", "chainId", "vaultAddress", "amountAtomic", "signingAuthority", "_mutation"]);
35634
35789
  taskErrorEnvelopeSchema = strictObjectSchema3({
35635
- error: strictObjectSchema3({ code: { type: "string", minLength: 1, maxLength: 100 }, message: { type: "string", minLength: 1, maxLength: 500 } })
35790
+ 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
35791
  });
35637
35792
  }
35638
35793
  });
@@ -35641,24 +35796,24 @@ var init_schemas3 = __esm({
35641
35796
  function operation2(value) {
35642
35797
  return Object.freeze(value);
35643
35798
  }
35644
- function schemaFields(schema5) {
35645
- if (schema5 === void 0) return {};
35646
- const shape = schema5;
35799
+ function schemaFields(schema6) {
35800
+ if (schema6 === void 0) return {};
35801
+ const shape = schema6;
35647
35802
  return Object.freeze(Object.assign(
35648
35803
  {},
35649
35804
  shape.properties ?? {},
35650
35805
  ...(shape.oneOf ?? []).map((variant) => schemaFields(variant))
35651
35806
  ));
35652
35807
  }
35653
- function requiredFields(schema5) {
35654
- return schema5?.required ?? [];
35808
+ function requiredFields(schema6) {
35809
+ return schema6?.required ?? [];
35655
35810
  }
35656
35811
  function inputSchema(fields, required4, body) {
35657
- const schema5 = strictObjectSchema3(fields, required4);
35812
+ const schema6 = strictObjectSchema3(fields, required4);
35658
35813
  const variants = body?.oneOf ?? [];
35659
- if (variants.length === 0) return schema5;
35814
+ if (variants.length === 0) return schema6;
35660
35815
  return Object.freeze({
35661
- ...schema5,
35816
+ ...schema6,
35662
35817
  oneOf: variants.map((variant) => Object.freeze({ required: requiredFields(variant) }))
35663
35818
  });
35664
35819
  }
@@ -35758,11 +35913,11 @@ var init_src4 = __esm({
35758
35913
  });
35759
35914
 
35760
35915
  // src/api.ts
35761
- function assertRequestSchema(schema5, value) {
35762
- let validator = validatorCache.get(schema5);
35916
+ function assertRequestSchema(schema6, value) {
35917
+ let validator = validatorCache.get(schema6);
35763
35918
  if (validator === void 0) {
35764
- validator = ajv.compile(schema5);
35765
- validatorCache.set(schema5, validator);
35919
+ validator = ajv.compile(schema6);
35920
+ validatorCache.set(schema6, validator);
35766
35921
  }
35767
35922
  if (!validator(value)) throw new TypeError("Custody request does not match the shared operation schema.");
35768
35923
  }
@@ -35778,11 +35933,11 @@ function skillHttpDiagnostic(response, value) {
35778
35933
  ...traceId !== null && TRACE_ID_PATTERN.test(traceId) ? { remoteTraceId: traceId } : {}
35779
35934
  };
35780
35935
  }
35781
- function assertSchema(schema5, value, diagnosticPaths) {
35782
- let validator = validatorCache.get(schema5);
35936
+ function assertSchema(schema6, value, diagnosticPaths) {
35937
+ let validator = validatorCache.get(schema6);
35783
35938
  if (validator === void 0) {
35784
- const compiled = ajv.compile(schema5);
35785
- validatorCache.set(schema5, compiled);
35939
+ const compiled = ajv.compile(schema6);
35940
+ validatorCache.set(schema6, compiled);
35786
35941
  validator = compiled;
35787
35942
  }
35788
35943
  if (!validator(value)) {
@@ -35799,11 +35954,11 @@ function requiredSkillIntentId(intentId) {
35799
35954
  return parseCanonicalUuid(intentId, "intentId");
35800
35955
  }
35801
35956
  function canonicalOrigin2(input) {
35802
- const parsed2 = new URL(input);
35803
- if (parsed2.origin !== input || parsed2.username !== "" || parsed2.password !== "" || parsed2.pathname !== "/" || parsed2.search !== "" || parsed2.hash !== "" || !["http:", "https:"].includes(parsed2.protocol)) {
35957
+ const parsed3 = new URL(input);
35958
+ if (parsed3.origin !== input || parsed3.username !== "" || parsed3.password !== "" || parsed3.pathname !== "/" || parsed3.search !== "" || parsed3.hash !== "" || !["http:", "https:"].includes(parsed3.protocol)) {
35804
35959
  throw new TypeError("AgentCLI origin must be canonical.");
35805
35960
  }
35806
- return parsed2.origin;
35961
+ return parsed3.origin;
35807
35962
  }
35808
35963
  function jsonObject(value) {
35809
35964
  if (typeof value !== "object" || value === null || Array.isArray(value)) {
@@ -35935,10 +36090,10 @@ async function readBoundedBytes(response, minimumBytes, maximumBytes) {
35935
36090
  }
35936
36091
  }
35937
36092
  function parseRemoteError(contract, response, value, diagnose = false) {
35938
- const schema5 = contract === "agent_market" ? agentCliErrorEnvelopeSchema : contract === "identity" ? identityErrorEnvelopeSchema : contract === "task_market" ? taskErrorEnvelopeSchema : contract === "skill_market" ? skillErrorEnvelopeSchema : oauthErrorResponseSchema;
36093
+ const schema6 = contract === "agent_market" ? agentCliErrorEnvelopeSchema : contract === "identity" ? identityErrorEnvelopeSchema : contract === "task_market" ? taskErrorEnvelopeSchema : contract === "skill_market" ? skillErrorEnvelopeSchema : oauthErrorResponseSchema;
35939
36094
  let envelope;
35940
36095
  try {
35941
- envelope = assertSchema(schema5, value, diagnose ? skillErrorDiagnosticPaths : void 0);
36096
+ envelope = assertSchema(schema6, value, diagnose ? skillErrorDiagnosticPaths : void 0);
35942
36097
  } catch (cause) {
35943
36098
  throw new CliHttpError("CLI_RESPONSE_INVALID", response.status, {
35944
36099
  cause,
@@ -36115,7 +36270,7 @@ var init_api2 = __esm({
36115
36270
  } catch (cause) {
36116
36271
  throw new CliHttpError("CLI_REMOTE_UNAVAILABLE", null, { cause });
36117
36272
  }
36118
- if (response.status !== expectedStatus) {
36273
+ if (!(typeof expectedStatus === "number" ? response.status === expectedStatus : expectedStatus.includes(response.status))) {
36119
36274
  let value;
36120
36275
  try {
36121
36276
  value = await readBoundedJson(response, 65536, true);
@@ -36367,6 +36522,7 @@ var init_api2 = __esm({
36367
36522
  body: JSON.stringify(body)
36368
36523
  });
36369
36524
  const stage = await readBoundedJson(response, 65536, true);
36525
+ if (stage.status === "chain_confirmed") return { publicationCompleted: true };
36370
36526
  return assertSchema(skillUnsignedIntentResponseSchema, stage.intent, intentDiagnosticPaths);
36371
36527
  } catch (cause) {
36372
36528
  if (!(cause instanceof CliHttpError)) throw cause;
@@ -36382,6 +36538,26 @@ var init_api2 = __esm({
36382
36538
  });
36383
36539
  }
36384
36540
  }
36541
+ /** Only a validated historical publication journal without a Session intent uses this admission route. */
36542
+ async requestLegacySkillPublicationIntent(body, bearer) {
36543
+ const response = await this.skillFetch("/api/skills/intents", {
36544
+ method: "POST",
36545
+ headers: { authorization: `Bearer ${bearer}`, "content-type": "application/json" },
36546
+ body: JSON.stringify(body)
36547
+ });
36548
+ return assertSchema(skillUnsignedIntentResponseSchema, await readBoundedJson(response, 65536, true), intentDiagnosticPaths);
36549
+ }
36550
+ async confirmLegacySkillProjection(chainId, transactionHash3, bearer) {
36551
+ const response = await this.skillFetch("/api/skills/projection", {
36552
+ method: "POST",
36553
+ headers: { authorization: `Bearer ${bearer}`, "content-type": "application/json" },
36554
+ body: JSON.stringify({ chainId, transactionHash: transactionHash3 })
36555
+ }, [200, 202]);
36556
+ if (response.status === 200) return "projected";
36557
+ if (response.status === 202) return "indexing_pending";
36558
+ await readBoundedJson(response);
36559
+ throw new CliHttpError("CLI_RESPONSE_INVALID", response.status);
36560
+ }
36385
36561
  async resolveSkillId(_chainId, _slug, bearer, intentId) {
36386
36562
  return (await this.skillIntentState(requiredSkillIntentId(intentId), bearer)).skillId;
36387
36563
  }
@@ -36443,6 +36619,15 @@ var init_api2 = __esm({
36443
36619
  });
36444
36620
  return readBoundedBytes(response, 1, MAX_SKILL_PACKAGE_BYTES);
36445
36621
  }
36622
+ async confirmSkillPublicationState(request2, bearer, intentId, stage) {
36623
+ const response = await this.skillFetch(`${skillCliIntentPath(requiredSkillIntentId(intentId))}/confirm`, {
36624
+ method: "POST",
36625
+ headers: { authorization: `Bearer ${bearer}`, "content-type": "application/json" },
36626
+ body: JSON.stringify({ stage, request: request2 })
36627
+ });
36628
+ const body = await readBoundedJson(response, 65536, true);
36629
+ if (body.status !== "indexing_pending" && body.status !== "projected") throw new CliHttpError("CLI_RESPONSE_INVALID", 200);
36630
+ }
36446
36631
  async confirmSkillProjection(_chainId, transactionHash3, bearer, intentId, stage = "primary") {
36447
36632
  const receipt = await this.confirmSkillSigningIntent(requiredSkillIntentId(intentId), stage, transactionHash3, bearer);
36448
36633
  if (receipt.status !== "projected" && receipt.status !== "indexing_pending") throw new CliHttpError("CLI_RESPONSE_INVALID", 200);
@@ -36461,13 +36646,13 @@ var init_api2 = __esm({
36461
36646
  });
36462
36647
  }
36463
36648
  authorizeMcp(requestPath, bearer) {
36464
- let parsed2;
36649
+ let parsed3;
36465
36650
  try {
36466
- parsed2 = new URL(requestPath, this.origin);
36651
+ parsed3 = new URL(requestPath, this.origin);
36467
36652
  } catch {
36468
36653
  throw new TypeError("MCP authorization request path is invalid.");
36469
36654
  }
36470
- if (parsed2.origin !== this.origin || parsed2.pathname !== "/oauth/authorize" || parsed2.hash !== "" || requestPath !== `${parsed2.pathname}${parsed2.search}` || parsed2.search === "") {
36655
+ if (parsed3.origin !== this.origin || parsed3.pathname !== "/oauth/authorize" || parsed3.hash !== "" || requestPath !== `${parsed3.pathname}${parsed3.search}` || parsed3.search === "") {
36471
36656
  throw new TypeError("MCP authorization request path is invalid.");
36472
36657
  }
36473
36658
  return this.request({
@@ -44751,12 +44936,12 @@ var init_utils4 = __esm({
44751
44936
  getContractAddress = (address2) => address2;
44752
44937
  getUrl = (url2) => {
44753
44938
  try {
44754
- const parsed2 = new URL(url2);
44755
- if (!parsed2.username && !parsed2.password)
44939
+ const parsed3 = new URL(url2);
44940
+ if (!parsed3.username && !parsed3.password)
44756
44941
  return url2;
44757
- parsed2.username = "";
44758
- parsed2.password = "";
44759
- return parsed2.toString();
44942
+ parsed3.username = "";
44943
+ parsed3.password = "";
44944
+ return parsed3.toString();
44760
44945
  } catch {
44761
44946
  return url2;
44762
44947
  }
@@ -56007,13 +56192,13 @@ var init_validateSiweMessage = __esm({
56007
56192
  // ../../node_modules/.pnpm/viem@2.55.15_bufferutil@4.1_ce20031be19c56210207d462110a7a29/node_modules/viem/_esm/actions/siwe/verifySiweMessage.js
56008
56193
  async function verifySiweMessage(client, parameters) {
56009
56194
  const { address: address2, domain: domain2, message, nonce, scheme, signature, time: time5 = /* @__PURE__ */ new Date(), ...callRequest } = parameters;
56010
- const parsed2 = parseSiweMessage(message);
56011
- if (!parsed2.address)
56195
+ const parsed3 = parseSiweMessage(message);
56196
+ if (!parsed3.address)
56012
56197
  return false;
56013
56198
  const isValid = validateSiweMessage({
56014
56199
  address: address2,
56015
56200
  domain: domain2,
56016
- message: parsed2,
56201
+ message: parsed3,
56017
56202
  nonce,
56018
56203
  scheme,
56019
56204
  time: time5
@@ -56022,7 +56207,7 @@ async function verifySiweMessage(client, parameters) {
56022
56207
  return false;
56023
56208
  const hash5 = hashMessage(message);
56024
56209
  return verifyHash(client, {
56025
- address: parsed2.address,
56210
+ address: parsed3.address,
56026
56211
  hash: hash5,
56027
56212
  signature,
56028
56213
  ...callRequest
@@ -57479,9 +57664,11 @@ var init_esm2 = __esm({
57479
57664
  init_createPublicClient();
57480
57665
  init_createWalletClient();
57481
57666
  init_http2();
57667
+ init_transaction();
57482
57668
  init_decodeFunctionData();
57483
57669
  init_encodeFunctionData();
57484
57670
  init_getAddress();
57671
+ init_keccak256();
57485
57672
  }
57486
57673
  });
57487
57674
 
@@ -57579,16 +57766,16 @@ function assertLocalAction(value, command, skillId) {
57579
57766
  }
57580
57767
  }
57581
57768
  function intent(value, walletAddress2) {
57582
- const parsed2 = object2(value, "Skill intent");
57583
- exact2(parsed2, ["chainId", "to", "data", "value", "summary", "signingAuthority"], "Skill intent");
57584
- const chainId = skillChain(parsed2.chainId, "Skill intent chain");
57769
+ const parsed3 = object2(value, "Skill intent");
57770
+ exact2(parsed3, ["chainId", "to", "data", "value", "summary", "signingAuthority"], "Skill intent");
57771
+ const chainId = skillChain(parsed3.chainId, "Skill intent chain");
57585
57772
  return Object.freeze({
57586
57773
  chainId,
57587
- to: string4(parsed2.to, "Skill intent target", /^0x[0-9a-fA-F]{40}$/u),
57588
- data: string4(parsed2.data, "Skill intent calldata", /^0x(?:[0-9a-fA-F]{2})+$/u),
57589
- value: string4(parsed2.value, "Skill intent value", DECIMAL),
57590
- summary: string4(parsed2.summary, "Skill intent summary"),
57591
- signingAuthority: signingAuthority(parsed2.signingAuthority, walletAddress2)
57774
+ to: string4(parsed3.to, "Skill intent target", /^0x[0-9a-fA-F]{40}$/u),
57775
+ data: string4(parsed3.data, "Skill intent calldata", /^0x(?:[0-9a-fA-F]{2})+$/u),
57776
+ value: string4(parsed3.value, "Skill intent value", DECIMAL),
57777
+ summary: string4(parsed3.summary, "Skill intent summary"),
57778
+ signingAuthority: signingAuthority(parsed3.signingAuthority, walletAddress2)
57592
57779
  });
57593
57780
  }
57594
57781
  function legacyIntent(value, walletAddress2, authority) {
@@ -57770,9 +57957,10 @@ function required2(value, name) {
57770
57957
  function recoveryReceipt(value, name) {
57771
57958
  if (value === null) return null;
57772
57959
  const receipt = object2(value, name);
57773
- exact2(receipt, ["transactionHash", "blockNumber"], name);
57960
+ exact2(receipt, ["transactionHash", "blockNumber", ...receipt.nonce === void 0 ? [] : ["nonce"]], name);
57774
57961
  return Object.freeze({
57775
- transactionHash: string4(receipt.transactionHash, `${name} transaction hash`, HASH2),
57962
+ transactionHash: receipt.transactionHash === null ? null : string4(receipt.transactionHash, `${name} transaction hash`, HASH2),
57963
+ ...receipt.nonce === void 0 ? {} : { nonce: integer2(receipt.nonce, `${name} nonce`, 0) },
57776
57964
  blockNumber: receipt.blockNumber === null ? null : string4(receipt.blockNumber, `${name} block number`, /^[1-9][0-9]*$/u)
57777
57965
  });
57778
57966
  }
@@ -57821,20 +58009,20 @@ function recoveryJournal(value, fingerprint, kind, context) {
57821
58009
  "targetVersion",
57822
58010
  "requests",
57823
58011
  "receipts",
57824
- ...journal.version === 5 || journal.version === 6 ? ["sourceHash"] : [],
57825
- ...journal.version === 6 ? ["pendingStage"] : [],
58012
+ ...journal.version === 5 || journal.version === 6 || journal.version === 7 ? ["sourceHash"] : [],
58013
+ ...Number(journal.version) >= 6 ? ["pendingStage"] : [],
57826
58014
  ...journal.intentId === void 0 ? [] : ["intentId", "origin"]
57827
58015
  ], "Skill publication recovery");
57828
58016
  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
58017
  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.");
58018
+ 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
58019
  const recoveredAuthority = assertPublicationAuthority(
57832
58020
  signingAuthority(journal.signingAuthority, context.walletAddress),
57833
58021
  context
57834
58022
  );
57835
58023
  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 === 6 && journal.pendingStage !== null && !["primary", "uri", "lit"].includes(String(journal.pendingStage))) {
58024
+ if (journal.version === 5 || journal.version === 6 || journal.version === 7) string4(journal.sourceHash, "Skill recovery source hash", HASH2);
58025
+ if (Number(journal.version) >= 6 && journal.pendingStage !== null && !["primary", "uri", "lit"].includes(String(journal.pendingStage))) {
57838
58026
  throw new TypeError("Skill recovery pending stage is invalid.");
57839
58027
  }
57840
58028
  const encodedPackage = string4(journal.packageBytesBase64, "Skill recovery package bytes");
@@ -57922,11 +58110,11 @@ var init_skill_local_flow = __esm({
57922
58110
  } catch (cause) {
57923
58111
  const journal = progress.journal;
57924
58112
  const unconfirmed = journal ? unconfirmedActions(journal) : [];
57925
- if (journal && (journal.pendingStage != null || journal.version !== 6 && unconfirmed.length > 0)) {
58113
+ if (journal && journal.pendingStage != null) {
57926
58114
  progress.uncertain = true;
57927
58115
  }
57928
58116
  const transactionHashes = Object.fromEntries([
57929
- ...Object.entries(progress.journal?.receipts ?? {}).flatMap(([stage, receipt]) => receipt && HASH2.test(receipt.transactionHash) ? [[stage, receipt.transactionHash]] : []),
58117
+ ...Object.entries(progress.journal?.receipts ?? {}).flatMap(([stage, receipt]) => receipt && typeof receipt.transactionHash === "string" && HASH2.test(receipt.transactionHash) ? [[stage, receipt.transactionHash]] : []),
57930
58118
  ...Object.entries(progress.broadcast ?? {}).filter(([, hash5]) => HASH2.test(hash5))
57931
58119
  ]);
57932
58120
  const fingerprint = progress.journal && progress.fingerprint ? progress.fingerprint : progress.walletFingerprint ?? null;
@@ -57936,8 +58124,8 @@ var init_skill_local_flow = __esm({
57936
58124
  transactionHashes,
57937
58125
  unconfirmedActions: unconfirmed,
57938
58126
  submissionStatus: progress.uncertain ? "uncertain" : Object.keys(transactionHashes).length ? "hash_known" : "not_attempted",
57939
- recoveryCommand: progress.journalSaved && !progress.uncertain && progress.phase !== "cleanup" && fingerprint ? `finch skill recover ${progress.walletFingerprint ? "intent" : "publication"} ${fingerprint}` : null,
57940
- resubmitSafe: progress.resubmitSafe === true
58127
+ recoveryCommand: progress.journalSaved && progress.phase !== "cleanup" && fingerprint ? `finch skill recover ${progress.walletFingerprint ? "intent" : "publication"} ${fingerprint}` : null,
58128
+ resubmitSafe: progress.resubmitSafe === true || journal !== void 0
57941
58129
  }, cause);
57942
58130
  }
57943
58131
  }
@@ -57950,14 +58138,15 @@ var init_skill_local_flow = __esm({
57950
58138
  async recoverPublication(fingerprint, context) {
57951
58139
  return this.publication((progress) => this.recoverWithProgress(fingerprint, context, progress));
57952
58140
  }
57953
- async send(context, action, request2, prepared, authority, onBroadcast) {
58141
+ async send(context, action, request2, prepared, authority, onBroadcast, onSending) {
57954
58142
  return required2(this.sender.submitPrepared, "Skill prepared-intent sender").call(this.sender, {
57955
58143
  privateKey: context.privateKey,
57956
58144
  walletAddress: context.walletAddress,
57957
58145
  action,
57958
58146
  request: request2,
57959
58147
  intent: authority === void 0 ? intent(prepared, context.walletAddress) : legacyIntent(prepared, context.walletAddress, authority),
57960
- onBroadcast
58148
+ onBroadcast,
58149
+ onSending
57961
58150
  });
57962
58151
  }
57963
58152
  async upload(input) {
@@ -58087,6 +58276,10 @@ var init_skill_local_flow = __esm({
58087
58276
  chain: sealed.chain
58088
58277
  };
58089
58278
  }
58279
+ async currentVersion(context, chainId, skillId) {
58280
+ if (this.sender.readCurrentVersion) return this.sender.readCurrentVersion({ privateKey: context.privateKey, walletAddress: context.walletAddress, chainId, skillId });
58281
+ return required2(this.api.readSkillCurrentVersion, "Skill version API").call(this.api, chainId, skillId, context.bearer, context.intentId);
58282
+ }
58090
58283
  async settle(read2, name) {
58091
58284
  for (let attempt2 = 0; attempt2 < 60; attempt2 += 1) {
58092
58285
  if (await read2()) return;
@@ -58094,13 +58287,14 @@ var init_skill_local_flow = __esm({
58094
58287
  }
58095
58288
  throw new TypeError(`${name} transaction confirmed but the settled chain read did not advance.`);
58096
58289
  }
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
58290
  async save(fingerprint, journal) {
58101
58291
  await required2(this.recovery, "Skill publication recovery").saveSkillPublicationRecovery(fingerprint, journal);
58102
58292
  }
58103
58293
  async project(chainId, transactionHash3, bearer, intentId, stage, requireReady = true) {
58294
+ if (intentId === void 0 && this.api.confirmLegacySkillProjection) {
58295
+ await this.api.confirmLegacySkillProjection(chainId, transactionHash3, bearer);
58296
+ return;
58297
+ }
58104
58298
  if (intentId === void 0 && this.api.confirmSkillProjection === void 0) return;
58105
58299
  const status = await required2(this.api.confirmSkillProjection, "Skill projection confirmation").call(this.api, chainId, transactionHash3, bearer, intentId, stage);
58106
58300
  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 +58304,107 @@ var init_skill_local_flow = __esm({
58110
58304
  progress.fingerprint = fingerprint;
58111
58305
  progress.journalSaved = true;
58112
58306
  progress.phase = "transaction";
58113
- const existing = journal.receipts[stage];
58114
- if (existing !== null) {
58115
- journal.receipts[stage] = context.intentId !== void 0 && existing.blockNumber !== null ? existing : await this.verify(context, action, request2, existing);
58116
- if (journal.pendingStage === stage) journal.pendingStage = null;
58307
+ const read2 = () => required2(this.sender.readPublicationState, "Skill publication chain reader").call(this.sender, {
58308
+ privateKey: context.privateKey,
58309
+ walletAddress: context.walletAddress,
58310
+ request: request2,
58311
+ targetVersion: journal.targetVersion,
58312
+ packageHash: journal.packageHash
58313
+ });
58314
+ const complete = async (state) => {
58315
+ if (!state.completed) return false;
58316
+ const receipt = journal.receipts[stage];
58317
+ journal.receipts[stage] = receipt?.blockNumber ? receipt : { transactionHash: null, blockNumber: state.blockNumber };
58318
+ if (state.skillId !== null && journal.kind === "publish") journal.skillId = state.skillId;
58319
+ journal.pendingStage = null;
58117
58320
  await this.save(fingerprint, journal);
58321
+ if (context.intentId !== void 0) await required2(this.api.confirmSkillPublicationState, "Skill chain confirmation API").call(
58322
+ this.api,
58323
+ journal.kind === "version" && stage === "primary" ? { ...request2, packageURI: journal.manifestURI } : request2,
58324
+ context.bearer,
58325
+ context.intentId,
58326
+ stage
58327
+ );
58118
58328
  progress.uncertain = false;
58119
- progress.phase = "projection";
58120
- await this.project(journal.chainId, journal.receipts[stage].transactionHash, context.bearer, context.intentId, stage, journal.kind !== "version" || stage !== "primary");
58121
- return;
58122
- }
58123
- if ((stage !== "uri" || context.intentId !== void 0) && (journal.pendingStage != null || journal.version !== 6)) {
58124
- progress.uncertain = true;
58125
- throw new CliSkillRecoveryUncertainError({
58126
- stage,
58127
- journalVersion: journal.version,
58128
- kind: journal.kind,
58129
- targetVersion: journal.targetVersion,
58130
- marker: journal.pendingStage != null ? "pending" : "absent"
58329
+ return true;
58330
+ };
58331
+ journal.sourceHash ??= journal.packageHash;
58332
+ journal.version = 7;
58333
+ journal.pendingStage ??= null;
58334
+ if (await complete(await read2())) return;
58335
+ const existing = journal.receipts[stage];
58336
+ if (existing?.transactionHash) {
58337
+ const resumed = await required2(this.sender.resumePublicationTransaction, "Skill pending transaction recovery").call(this.sender, {
58338
+ privateKey: context.privateKey,
58339
+ walletAddress: context.walletAddress,
58340
+ action,
58341
+ request: request2,
58342
+ transactionHash: existing.transactionHash,
58343
+ blockNumber: existing.blockNumber,
58344
+ ...existing.nonce === void 0 ? {} : { nonce: existing.nonce }
58131
58345
  });
58346
+ if (resumed !== null) {
58347
+ journal.receipts[stage] = resumed;
58348
+ await this.save(fingerprint, journal);
58349
+ await this.settle(async () => complete(await read2()), `Skill ${action} publication`);
58350
+ await this.project(journal.chainId, resumed.transactionHash, context.bearer, context.intentId, stage, false);
58351
+ return;
58352
+ }
58353
+ journal.receipts[stage] = null;
58354
+ journal.pendingStage = null;
58355
+ await this.save(fingerprint, journal);
58356
+ if (await complete(await read2())) return;
58132
58357
  }
58358
+ journal.receipts[stage] = null;
58359
+ journal.pendingStage = null;
58360
+ await this.save(fingerprint, journal);
58133
58361
  progress.phase = "intent";
58134
- const prepared = await prepare();
58135
- progress.phase = "transaction";
58136
- const marks = journal.version === 6;
58137
- if (marks) {
58138
- journal.pendingStage = stage;
58139
- await this.save(fingerprint, journal);
58362
+ 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();
58363
+ if (prepared && typeof prepared === "object" && "publicationCompleted" in prepared && prepared.publicationCompleted === true) {
58364
+ if (await complete(await read2())) return;
58365
+ throw new TypeError("Gateway completion could not be confirmed on chain. Retry the same command.");
58140
58366
  }
58141
- progress.uncertain = true;
58142
- journal.receipts[stage] = await this.send(
58143
- context,
58144
- action,
58145
- request2,
58146
- prepared,
58147
- journal.signingAuthority,
58148
- async ({ transactionHash: transactionHash3 }) => {
58149
- journal.receipts[stage] = { transactionHash: transactionHash3, blockNumber: null };
58150
- await this.save(fingerprint, journal);
58151
- if (marks) {
58367
+ progress.phase = "transaction";
58368
+ try {
58369
+ journal.receipts[stage] = await this.send(
58370
+ context,
58371
+ action,
58372
+ request2,
58373
+ prepared,
58374
+ journal.signingAuthority,
58375
+ async ({ transactionHash: transactionHash3 }) => {
58376
+ journal.receipts[stage] = { ...journal.receipts[stage], transactionHash: transactionHash3, blockNumber: null };
58152
58377
  journal.pendingStage = null;
58153
58378
  await this.save(fingerprint, journal);
58379
+ },
58380
+ async (checkpoint) => {
58381
+ journal.pendingStage = stage;
58382
+ if (checkpoint !== void 0) journal.receipts[stage] = { ...checkpoint, blockNumber: null };
58383
+ await this.save(fingerprint, journal);
58154
58384
  }
58155
- progress.uncertain = false;
58385
+ );
58386
+ } catch (cause) {
58387
+ let state;
58388
+ try {
58389
+ state = await read2();
58390
+ } catch {
58391
+ throw cause;
58156
58392
  }
58157
- );
58158
- if (marks) journal.pendingStage = null;
58393
+ if (await complete(state)) return;
58394
+ if (cause instanceof SkillPublicationTransactionFailedError) {
58395
+ journal.receipts[stage] = null;
58396
+ journal.pendingStage = null;
58397
+ await this.save(fingerprint, journal);
58398
+ }
58399
+ throw cause;
58400
+ }
58401
+ journal.pendingStage = null;
58159
58402
  await this.save(fingerprint, journal);
58160
58403
  progress.uncertain = false;
58404
+ const submitted = required2(journal.receipts[stage].transactionHash, "Skill transaction hash");
58405
+ await this.settle(async () => complete(await read2()), `Skill ${action} publication`);
58161
58406
  progress.phase = "projection";
58162
- await this.project(journal.chainId, journal.receipts[stage].transactionHash, context.bearer, context.intentId, stage, journal.kind !== "version" || stage !== "primary");
58407
+ await this.project(journal.chainId, submitted, context.bearer, context.intentId, stage, false);
58163
58408
  }
58164
58409
  async recoverWithProgress(fingerprint, context, progress) {
58165
58410
  progress.phase = "recovery";
@@ -58193,7 +58438,7 @@ var init_skill_local_flow = __esm({
58193
58438
  const slug = string4(journal.requests.primary.slug, "Skill recovery slug");
58194
58439
  let skillId2 = journal.skillId;
58195
58440
  await this.settle(async () => {
58196
- skillId2 = await required2(this.api.resolveSkillId, "Skill resolve API").call(
58441
+ skillId2 = journal.skillId ?? await required2(this.api.resolveSkillId, "Skill resolve API").call(
58197
58442
  this.api,
58198
58443
  journal.chainId,
58199
58444
  slug,
@@ -58259,13 +58504,7 @@ var init_skill_local_flow = __esm({
58259
58504
  () => 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
58505
  );
58261
58506
  await this.settle(
58262
- async () => await required2(this.api.readSkillCurrentVersion, "Skill version API").call(
58263
- this.api,
58264
- journal.chainId,
58265
- skillId,
58266
- context.bearer,
58267
- context.intentId
58268
- ) === journal.targetVersion,
58507
+ async () => await this.currentVersion(context, journal.chainId, skillId) === journal.targetVersion,
58269
58508
  `Skill ${skillId} version ${journal.targetVersion}`
58270
58509
  );
58271
58510
  const uriRequest = required2(journal.requests.uri, "Skill URI recovery request");
@@ -58386,7 +58625,7 @@ var init_skill_local_flow = __esm({
58386
58625
  packageURI: manifestURI
58387
58626
  };
58388
58627
  journal = {
58389
- version: 6,
58628
+ version: 7,
58390
58629
  ...context.intentId === void 0 ? {} : { intentId: context.intentId, origin: context.origin },
58391
58630
  pendingStage: null,
58392
58631
  sourceHash: packaged.packageHash,
@@ -58426,7 +58665,7 @@ var init_skill_local_flow = __esm({
58426
58665
  );
58427
58666
  let skillId = journal.skillId;
58428
58667
  await this.settle(async () => {
58429
- skillId = await required2(this.api.resolveSkillId, "Skill resolve API").call(
58668
+ skillId = journal.skillId ?? await required2(this.api.resolveSkillId, "Skill resolve API").call(
58430
58669
  this.api,
58431
58670
  journal.chainId,
58432
58671
  String(request2.slug),
@@ -58478,13 +58717,7 @@ var init_skill_local_flow = __esm({
58478
58717
  progress.fingerprint = fingerprint;
58479
58718
  progress.journalSaved = true;
58480
58719
  }
58481
- const observedVersion = await required2(this.api.readSkillCurrentVersion, "Skill version API").call(
58482
- this.api,
58483
- plan.chainId,
58484
- String(plan.request.skillId),
58485
- context.bearer,
58486
- context.intentId
58487
- );
58720
+ const observedVersion = await this.currentVersion(context, plan.chainId, String(plan.request.skillId));
58488
58721
  if (prior === null && observedVersion !== plan.currentVersion) {
58489
58722
  throw new TypeError(`Skill current version ${observedVersion} no longer matches plan version ${plan.currentVersion}.`);
58490
58723
  }
@@ -58533,7 +58766,7 @@ var init_skill_local_flow = __esm({
58533
58766
  const updateRequest = { action: "updateSkill", chainId: plan.chainId, skillId: plan.request.skillId, mdHash: packaged.mdHash, packageHash: entry2.packageHash, packageURI: manifestURI };
58534
58767
  const uriRequest2 = { action: "setSkillURI", chainId: plan.chainId, skillId: plan.request.skillId, packageURI: manifestURI };
58535
58768
  journal = {
58536
- version: 6,
58769
+ version: 7,
58537
58770
  ...context.intentId === void 0 ? {} : { intentId: context.intentId, origin: context.origin },
58538
58771
  pendingStage: null,
58539
58772
  sourceHash: packaged.packageHash,
@@ -58571,13 +58804,7 @@ var init_skill_local_flow = __esm({
58571
58804
  journal.requests.primary,
58572
58805
  () => 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
58806
  );
58574
- await this.settle(async () => await required2(this.api.readSkillCurrentVersion, "Skill version API").call(
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}`);
58807
+ await this.settle(async () => await this.currentVersion(context, journal.chainId, String(plan.request.skillId)) === plan.nextVersion, `Skill ${plan.request.skillId} version ${plan.nextVersion}`);
58581
58808
  const uriRequest = required2(journal.requests.uri, "Skill URI recovery request");
58582
58809
  await this.stage(
58583
58810
  progress,
@@ -59419,14 +59646,14 @@ var init_application = __esm({
59419
59646
  }
59420
59647
  async loginSite(requestUrl) {
59421
59648
  const profile = await this.authorizedProfile();
59422
- let parsed2;
59649
+ let parsed3;
59423
59650
  try {
59424
- parsed2 = new URL(requestUrl);
59651
+ parsed3 = new URL(requestUrl);
59425
59652
  } catch {
59426
59653
  throw new TypeError("Browser login request URL is invalid.");
59427
59654
  }
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(parsed2.pathname);
59429
- if (parsed2.origin !== profile.origin || requestUrl !== `${profile.origin}${parsed2.pathname}` || parsed2.search !== "" || parsed2.hash !== "" || match === null) {
59655
+ 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);
59656
+ if (parsed3.origin !== profile.origin || requestUrl !== `${profile.origin}${parsed3.pathname}` || parsed3.search !== "" || parsed3.hash !== "" || match === null) {
59430
59657
  throw new TypeError("Browser login request origin or path does not match the active profile origin.");
59431
59658
  }
59432
59659
  const authority = await this.verifiedAgentCliAuthority();
@@ -61108,20 +61335,20 @@ var require_resolveCommand = __commonJS({
61108
61335
  var path2 = __require("path");
61109
61336
  var which = require_which();
61110
61337
  var getPathKey = require_path_key();
61111
- function resolveCommandAttempt(parsed2, withoutPathExt) {
61112
- const env = parsed2.options.env || process.env;
61338
+ function resolveCommandAttempt(parsed3, withoutPathExt) {
61339
+ const env = parsed3.options.env || process.env;
61113
61340
  const cwd = process.cwd();
61114
- const hasCustomCwd = parsed2.options.cwd != null;
61341
+ const hasCustomCwd = parsed3.options.cwd != null;
61115
61342
  const shouldSwitchCwd = hasCustomCwd && process.chdir !== void 0 && !process.chdir.disabled;
61116
61343
  if (shouldSwitchCwd) {
61117
61344
  try {
61118
- process.chdir(parsed2.options.cwd);
61345
+ process.chdir(parsed3.options.cwd);
61119
61346
  } catch (err2) {
61120
61347
  }
61121
61348
  }
61122
61349
  let resolved;
61123
61350
  try {
61124
- resolved = which.sync(parsed2.command, {
61351
+ resolved = which.sync(parsed3.command, {
61125
61352
  path: env[getPathKey({ env })],
61126
61353
  pathExt: withoutPathExt ? path2.delimiter : void 0
61127
61354
  });
@@ -61132,12 +61359,12 @@ var require_resolveCommand = __commonJS({
61132
61359
  }
61133
61360
  }
61134
61361
  if (resolved) {
61135
- resolved = path2.resolve(hasCustomCwd ? parsed2.options.cwd : "", resolved);
61362
+ resolved = path2.resolve(hasCustomCwd ? parsed3.options.cwd : "", resolved);
61136
61363
  }
61137
61364
  return resolved;
61138
61365
  }
61139
- function resolveCommand(parsed2) {
61140
- return resolveCommandAttempt(parsed2) || resolveCommandAttempt(parsed2, true);
61366
+ function resolveCommand(parsed3) {
61367
+ return resolveCommandAttempt(parsed3) || resolveCommandAttempt(parsed3, true);
61141
61368
  }
61142
61369
  module.exports = resolveCommand;
61143
61370
  }
@@ -61229,33 +61456,33 @@ var require_parse = __commonJS({
61229
61456
  var isWin = process.platform === "win32";
61230
61457
  var isExecutableRegExp = /\.(?:com|exe)$/i;
61231
61458
  var isCmdShimRegExp = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
61232
- function detectShebang(parsed2) {
61233
- parsed2.file = resolveCommand(parsed2);
61234
- const shebang = parsed2.file && readShebang(parsed2.file);
61459
+ function detectShebang(parsed3) {
61460
+ parsed3.file = resolveCommand(parsed3);
61461
+ const shebang = parsed3.file && readShebang(parsed3.file);
61235
61462
  if (shebang) {
61236
- parsed2.args.unshift(parsed2.file);
61237
- parsed2.command = shebang;
61238
- return resolveCommand(parsed2);
61463
+ parsed3.args.unshift(parsed3.file);
61464
+ parsed3.command = shebang;
61465
+ return resolveCommand(parsed3);
61239
61466
  }
61240
- return parsed2.file;
61467
+ return parsed3.file;
61241
61468
  }
61242
- function parseNonShell(parsed2) {
61469
+ function parseNonShell(parsed3) {
61243
61470
  if (!isWin) {
61244
- return parsed2;
61471
+ return parsed3;
61245
61472
  }
61246
- const commandFile = detectShebang(parsed2);
61473
+ const commandFile = detectShebang(parsed3);
61247
61474
  const needsShell = !isExecutableRegExp.test(commandFile);
61248
- if (parsed2.options.forceShell || needsShell) {
61475
+ if (parsed3.options.forceShell || needsShell) {
61249
61476
  const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
61250
- parsed2.command = path2.normalize(parsed2.command);
61251
- parsed2.command = escape2.command(parsed2.command);
61252
- parsed2.args = parsed2.args.map((arg) => escape2.argument(arg, needsDoubleEscapeMetaChars));
61253
- const shellCommand = [parsed2.command].concat(parsed2.args).join(" ");
61254
- parsed2.args = ["/d", "/s", "/c", `"${shellCommand}"`];
61255
- parsed2.command = process.env.comspec || "cmd.exe";
61256
- parsed2.options.windowsVerbatimArguments = true;
61477
+ parsed3.command = path2.normalize(parsed3.command);
61478
+ parsed3.command = escape2.command(parsed3.command);
61479
+ parsed3.args = parsed3.args.map((arg) => escape2.argument(arg, needsDoubleEscapeMetaChars));
61480
+ const shellCommand = [parsed3.command].concat(parsed3.args).join(" ");
61481
+ parsed3.args = ["/d", "/s", "/c", `"${shellCommand}"`];
61482
+ parsed3.command = process.env.comspec || "cmd.exe";
61483
+ parsed3.options.windowsVerbatimArguments = true;
61257
61484
  }
61258
- return parsed2;
61485
+ return parsed3;
61259
61486
  }
61260
61487
  function parse4(command, args, options) {
61261
61488
  if (args && !Array.isArray(args)) {
@@ -61264,7 +61491,7 @@ var require_parse = __commonJS({
61264
61491
  }
61265
61492
  args = args ? args.slice(0) : [];
61266
61493
  options = Object.assign({}, options);
61267
- const parsed2 = {
61494
+ const parsed3 = {
61268
61495
  command,
61269
61496
  args,
61270
61497
  options,
@@ -61274,7 +61501,7 @@ var require_parse = __commonJS({
61274
61501
  args
61275
61502
  }
61276
61503
  };
61277
- return options.shell ? parsed2 : parseNonShell(parsed2);
61504
+ return options.shell ? parsed3 : parseNonShell(parsed3);
61278
61505
  }
61279
61506
  module.exports = parse4;
61280
61507
  }
@@ -61294,14 +61521,14 @@ var require_enoent = __commonJS({
61294
61521
  spawnargs: original.args
61295
61522
  });
61296
61523
  }
61297
- function hookChildProcess(cp, parsed2) {
61524
+ function hookChildProcess(cp, parsed3) {
61298
61525
  if (!isWin) {
61299
61526
  return;
61300
61527
  }
61301
61528
  const originalEmit = cp.emit;
61302
61529
  cp.emit = function(name, arg1) {
61303
61530
  if (name === "exit") {
61304
- const err2 = verifyENOENT(arg1, parsed2);
61531
+ const err2 = verifyENOENT(arg1, parsed3);
61305
61532
  if (err2) {
61306
61533
  return originalEmit.call(cp, "error", err2);
61307
61534
  }
@@ -61309,15 +61536,15 @@ var require_enoent = __commonJS({
61309
61536
  return originalEmit.apply(cp, arguments);
61310
61537
  };
61311
61538
  }
61312
- function verifyENOENT(status, parsed2) {
61313
- if (isWin && status === 1 && !parsed2.file) {
61314
- return notFoundError(parsed2.original, "spawn");
61539
+ function verifyENOENT(status, parsed3) {
61540
+ if (isWin && status === 1 && !parsed3.file) {
61541
+ return notFoundError(parsed3.original, "spawn");
61315
61542
  }
61316
61543
  return null;
61317
61544
  }
61318
- function verifyENOENTSync(status, parsed2) {
61319
- if (isWin && status === 1 && !parsed2.file) {
61320
- return notFoundError(parsed2.original, "spawnSync");
61545
+ function verifyENOENTSync(status, parsed3) {
61546
+ if (isWin && status === 1 && !parsed3.file) {
61547
+ return notFoundError(parsed3.original, "spawnSync");
61321
61548
  }
61322
61549
  return null;
61323
61550
  }
@@ -61338,15 +61565,15 @@ var require_cross_spawn = __commonJS({
61338
61565
  var parse4 = require_parse();
61339
61566
  var enoent = require_enoent();
61340
61567
  function spawn2(command, args, options) {
61341
- const parsed2 = parse4(command, args, options);
61342
- const spawned = cp.spawn(parsed2.command, parsed2.args, parsed2.options);
61343
- enoent.hookChildProcess(spawned, parsed2);
61568
+ const parsed3 = parse4(command, args, options);
61569
+ const spawned = cp.spawn(parsed3.command, parsed3.args, parsed3.options);
61570
+ enoent.hookChildProcess(spawned, parsed3);
61344
61571
  return spawned;
61345
61572
  }
61346
61573
  function spawnSync2(command, args, options) {
61347
- const parsed2 = parse4(command, args, options);
61348
- const result2 = cp.spawnSync(parsed2.command, parsed2.args, parsed2.options);
61349
- result2.error = result2.error || enoent.verifyENOENTSync(result2.status, parsed2);
61574
+ const parsed3 = parse4(command, args, options);
61575
+ const result2 = cp.spawnSync(parsed3.command, parsed3.args, parsed3.options);
61576
+ result2.error = result2.error || enoent.verifyENOENTSync(result2.status, parsed3);
61350
61577
  return result2;
61351
61578
  }
61352
61579
  module.exports = spawn2;
@@ -61812,12 +62039,12 @@ function environment2(value) {
61812
62039
  }
61813
62040
  function endpointOrigin(value) {
61814
62041
  if (typeof value !== "string" || !URL.canParse(value)) throw new CliStateError("CLI_STATE_CORRUPT");
61815
- const parsed2 = new URL(value);
61816
- const loopbackHttp = parsed2.protocol === "http:" && ["127.0.0.1", "localhost", "[::1]"].includes(parsed2.hostname);
61817
- if (parsed2.origin !== value || parsed2.username !== "" || parsed2.password !== "" || parsed2.pathname !== "/" || parsed2.search !== "" || parsed2.hash !== "" || parsed2.protocol !== "https:" && !loopbackHttp) {
62042
+ const parsed3 = new URL(value);
62043
+ const loopbackHttp = parsed3.protocol === "http:" && ["127.0.0.1", "localhost", "[::1]"].includes(parsed3.hostname);
62044
+ if (parsed3.origin !== value || parsed3.username !== "" || parsed3.password !== "" || parsed3.pathname !== "/" || parsed3.search !== "" || parsed3.hash !== "" || parsed3.protocol !== "https:" && !loopbackHttp) {
61818
62045
  throw new CliStateError("CLI_STATE_CORRUPT");
61819
62046
  }
61820
- return parsed2.origin;
62047
+ return parsed3.origin;
61821
62048
  }
61822
62049
  function secretRecord(value, name) {
61823
62050
  try {
@@ -62773,11 +63000,11 @@ var init_custody_chains = __esm({
62773
63000
 
62774
63001
  // src/purchase-sender.ts
62775
63002
  function parseRpcUrl(value) {
62776
- const parsed2 = new URL(value);
62777
- if (parsed2.protocol !== "https:" || parsed2.username !== "" || parsed2.password !== "" || parsed2.hash !== "") {
63003
+ const parsed3 = new URL(value);
63004
+ if (parsed3.protocol !== "https:" || parsed3.username !== "" || parsed3.password !== "" || parsed3.hash !== "") {
62778
63005
  throw new TypeError("The reviewed Agent RPC must be HTTPS without userinfo or fragment.");
62779
63006
  }
62780
- return parsed2.href;
63007
+ return parsed3.href;
62781
63008
  }
62782
63009
  function privateKey2(value) {
62783
63010
  if (!/^0x[0-9a-f]{64}$/u.test(value)) {
@@ -63072,11 +63299,11 @@ var init_purchase_sender = __esm({
63072
63299
 
63073
63300
  // src/task-protocol-sender.ts
63074
63301
  function parseRpcUrl2(value) {
63075
- const parsed2 = new URL(value);
63076
- if (parsed2.protocol !== "https:" || parsed2.username !== "" || parsed2.password !== "" || parsed2.hash !== "") {
63302
+ const parsed3 = new URL(value);
63303
+ if (parsed3.protocol !== "https:" || parsed3.username !== "" || parsed3.password !== "" || parsed3.hash !== "") {
63077
63304
  throw new TypeError("The reviewed Task RPC must be HTTPS without userinfo or fragment.");
63078
63305
  }
63079
- return parsed2.href;
63306
+ return parsed3.href;
63080
63307
  }
63081
63308
  function installedPrivateKey(value) {
63082
63309
  if (!/^0x[0-9a-f]{64}$/u.test(value)) throw new TypeError("The installed wallet private key is invalid.");
@@ -63102,9 +63329,9 @@ function unsigned(value, name) {
63102
63329
  }
63103
63330
  function uint642(value, name) {
63104
63331
  if (!Number.isSafeInteger(value) || Number(value) < 0) throw new TypeError(`${name} is invalid.`);
63105
- const parsed2 = BigInt(Number(value));
63106
- if (parsed2 > 18446744073709551615n) throw new TypeError(`${name} is invalid.`);
63107
- return parsed2;
63332
+ const parsed3 = BigInt(Number(value));
63333
+ if (parsed3 > 18446744073709551615n) throw new TypeError(`${name} is invalid.`);
63334
+ return parsed3;
63108
63335
  }
63109
63336
  function uint16(value, name) {
63110
63337
  if (!Number.isSafeInteger(value) || Number(value) < 0 || Number(value) > 65535) {
@@ -63452,11 +63679,11 @@ var init_task_protocol_sender = __esm({
63452
63679
 
63453
63680
  // src/skill-intent-sender.ts
63454
63681
  function parseRpcUrl3(value) {
63455
- const parsed2 = new URL(value);
63456
- if (parsed2.protocol !== "https:" || parsed2.username !== "" || parsed2.password !== "" || parsed2.hash !== "") {
63682
+ const parsed3 = new URL(value);
63683
+ if (parsed3.protocol !== "https:" || parsed3.username !== "" || parsed3.password !== "" || parsed3.hash !== "") {
63457
63684
  throw new TypeError("The reviewed Skill RPC must be HTTPS without userinfo or fragment.");
63458
63685
  }
63459
- return parsed2.href;
63686
+ return parsed3.href;
63460
63687
  }
63461
63688
  function installedPrivateKey2(value) {
63462
63689
  if (!/^0x[0-9a-f]{64}$/u.test(value)) throw new TypeError("The installed wallet private key is invalid.");
@@ -63553,11 +63780,23 @@ function assertIntentMatches(raw, expected, chainId) {
63553
63780
  throw new TypeError("Skill intent calldata, target, or value does not match its reviewed request.");
63554
63781
  }
63555
63782
  }
63783
+ async function rpcOperation(method2, operation3) {
63784
+ try {
63785
+ return await operation3();
63786
+ } catch (cause) {
63787
+ throw Object.assign(new Error(cause instanceof Error ? cause.message : "Skill RPC failed.", { cause }), { method: typeof method2 === "function" ? method2() : method2 });
63788
+ }
63789
+ }
63790
+ function receiptFailure(action) {
63791
+ return ["createSkill", "updateSkill", "setSkillURI", "setLitData"].includes(action) ? new SkillPublicationTransactionFailedError() : new TypeError("Skill transaction reverted.");
63792
+ }
63556
63793
  var import_ajv4, instanceAbi, tokenAbi, revenueAbi, factoryAbi, validateIntent2, viemFactory2, InstalledSkillIntentSender;
63557
63794
  var init_skill_intent_sender = __esm({
63558
63795
  "src/skill-intent-sender.ts"() {
63559
63796
  "use strict";
63560
63797
  import_ajv4 = __toESM(require_ajv(), 1);
63798
+ init_cli_error();
63799
+ init_cli_error();
63561
63800
  init_client();
63562
63801
  init_chains();
63563
63802
  init_esm2();
@@ -63567,11 +63806,16 @@ var init_skill_intent_sender = __esm({
63567
63806
  instanceAbi = parseAbi([
63568
63807
  "function purchase(uint256 skillId, uint64 version, uint256 quantity) payable",
63569
63808
  "function convert(uint256 skillId, uint64 fromVersion, uint64 toVersion, uint256 quantity)",
63570
- "function setLitData(uint256 skillId, uint64 version, string ciphertext, string scheme, string chain)"
63809
+ "function setLitData(uint256 skillId, uint64 version, string ciphertext, string scheme, string chain)",
63810
+ "function litDataSet(uint256 skillId, uint64 version) view returns (bool)"
63571
63811
  ]);
63572
63812
  tokenAbi = parseAbi([
63573
63813
  "function updateSkill(uint256 skillId, bytes32 mdHash, bytes32 packageHash)",
63574
- "function setSkillURI(uint256 skillId, string packageURI)"
63814
+ "function setSkillURI(uint256 skillId, string packageURI)",
63815
+ "function skillIdBySlug(string slug) view returns (uint256)",
63816
+ "function ownerOf(uint256 skillId) view returns (address)",
63817
+ "function skillOf(uint256 skillId) view returns ((bytes32 mdHash, bytes32 packageHash, uint64 version))",
63818
+ "function skillURI(uint256 skillId) view returns (string)"
63575
63819
  ]);
63576
63820
  revenueAbi = parseAbi([
63577
63821
  "function setUnitPrice(uint256 skillId, uint256 unitPrice)",
@@ -63593,7 +63837,26 @@ var init_skill_intent_sender = __esm({
63593
63837
  simulateTransaction: async (input) => {
63594
63838
  await publicClient.call({ account, ...input });
63595
63839
  },
63596
- sendTransaction: (input) => walletClient.sendTransaction({ account, chain, ...input }),
63840
+ sendTransaction: async (input, onSending) => {
63841
+ const transaction2 = await walletClient.prepareTransactionRequest({ account, chain, ...input });
63842
+ const serializedTransaction = await walletClient.signTransaction(transaction2);
63843
+ await onSending?.({ transactionHash: keccak256(serializedTransaction), nonce: transaction2.nonce });
63844
+ return walletClient.sendRawTransaction({ serializedTransaction });
63845
+ },
63846
+ getConfirmedNonce: () => publicClient.getTransactionCount({ address: account.address, blockTag: "latest" }),
63847
+ publicationReader: {
63848
+ blockNumber: async () => await publicClient.getBlockNumber({ cacheTime: 0 }) - BigInt(confirmations - 1),
63849
+ read: async ({ contract, functionName, args, blockNumber: blockNumber2 }) => {
63850
+ const deployment = getSkillProtocolDeploymentByChainId(chainId);
63851
+ return publicClient.readContract({
63852
+ address: getAddress(contract === "token" ? deployment.skillTokenAddress : deployment.skillInstanceAddress),
63853
+ abi: contract === "token" ? tokenAbi : instanceAbi,
63854
+ functionName,
63855
+ args,
63856
+ blockNumber: blockNumber2
63857
+ });
63858
+ }
63859
+ },
63597
63860
  waitForReceipt: async (hash5) => {
63598
63861
  const receipt = await publicClient.waitForTransactionReceipt({ hash: hash5, confirmations, timeout: 12e4 });
63599
63862
  return Object.freeze({ status: receipt.status, blockNumber: receipt.blockNumber });
@@ -63626,6 +63889,7 @@ var init_skill_intent_sender = __esm({
63626
63889
  async rpc(privateKey3, walletAddress2, deployment) {
63627
63890
  const key = installedPrivateKey2(privateKey3);
63628
63891
  let reachable = false;
63892
+ let lastCause;
63629
63893
  for (const rpcUrl of deployment.defaultRpcUrls) {
63630
63894
  const rpc = this.rpcFactory(
63631
63895
  key,
@@ -63642,10 +63906,11 @@ var init_skill_intent_sender = __esm({
63642
63906
  }
63643
63907
  return rpc;
63644
63908
  } catch (cause) {
63909
+ lastCause = cause;
63645
63910
  if (cause instanceof TypeError && cause.message.includes("wallet")) throw cause;
63646
63911
  }
63647
63912
  }
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.");
63913
+ 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
63914
  }
63650
63915
  buyerCall(input) {
63651
63916
  if (!validateIntent2(input.intent)) throw new TypeError("Skill intent does not match the frozen contract.");
@@ -63669,10 +63934,10 @@ var init_skill_intent_sender = __esm({
63669
63934
  async submit(input) {
63670
63935
  const { expected, deployment } = this.buyerCall(input);
63671
63936
  const rpc = await this.rpc(input.privateKey, input.walletAddress, deployment);
63672
- await rpc.simulateTransaction(expected);
63673
- const transactionHash3 = await rpc.sendTransaction(expected);
63937
+ await rpcOperation("eth_call", () => rpc.simulateTransaction(expected));
63938
+ const transactionHash3 = await rpcOperation("eth_sendRawTransaction", () => rpc.sendTransaction(expected));
63674
63939
  await input.onBroadcast?.({ fingerprint: skillBuyerIntentFingerprint(input.intent), transactionHash: transactionHash3 });
63675
- const receipt = await rpc.waitForReceipt(transactionHash3);
63940
+ const receipt = await rpcOperation("eth_getTransactionReceipt", () => rpc.waitForReceipt(transactionHash3));
63676
63941
  if (receipt.status !== "success") throw new TypeError("Skill transaction reverted.");
63677
63942
  return Object.freeze({ transactionHash: transactionHash3, blockNumber: receipt.blockNumber.toString() });
63678
63943
  }
@@ -63684,7 +63949,7 @@ var init_skill_intent_sender = __esm({
63684
63949
  if (input.blockNumber === null) {
63685
63950
  const transaction2 = await rpc.getTransactionCall(transactionHash3);
63686
63951
  if (!exactTransaction2(transaction2)) throw new TypeError("Skill recovery transaction does not match its exact buyer intent.");
63687
- const receipt = await rpc.waitForReceipt(transactionHash3);
63952
+ const receipt = await rpcOperation("eth_getTransactionReceipt", () => rpc.waitForReceipt(transactionHash3));
63688
63953
  if (receipt.status !== "success") throw new TypeError("Skill recovery transaction reverted.");
63689
63954
  return Object.freeze({ transactionHash: transactionHash3, blockNumber: receipt.blockNumber.toString() });
63690
63955
  }
@@ -63703,30 +63968,68 @@ var init_skill_intent_sender = __esm({
63703
63968
  const expected = expectedPreparedCall(input.action, request2, deployment);
63704
63969
  assertIntentMatches(input.intent, expected, deployment.chainId);
63705
63970
  const rpc = await this.rpc(input.privateKey, input.walletAddress, deployment);
63706
- await rpc.simulateTransaction(expected);
63707
- const transactionHash3 = await rpc.sendTransaction(expected);
63971
+ await rpcOperation("eth_call", () => rpc.simulateTransaction(expected));
63972
+ let sending = false;
63973
+ const transactionHash3 = await rpcOperation(() => sending ? "eth_sendRawTransaction" : null, () => rpc.sendTransaction(expected, async (checkpoint) => {
63974
+ await input.onSending?.(checkpoint);
63975
+ sending = true;
63976
+ }));
63708
63977
  await input.onBroadcast?.({ transactionHash: transactionHash3 });
63709
- const receipt = await rpc.waitForReceipt(transactionHash3);
63710
- if (receipt.status !== "success") throw new TypeError("Skill transaction reverted.");
63978
+ const receipt = await rpcOperation("eth_getTransactionReceipt", () => rpc.waitForReceipt(transactionHash3));
63979
+ if (receipt.status !== "success") throw receiptFailure(input.action);
63711
63980
  return Object.freeze({ transactionHash: transactionHash3, blockNumber: receipt.blockNumber.toString() });
63712
63981
  }
63982
+ async readCurrentVersion(input) {
63983
+ const rpc = await this.rpc(input.privateKey, input.walletAddress, this.authority(input.chainId));
63984
+ if (!rpc.publicationReader) throw new TypeError("Skill publication reader is unavailable.");
63985
+ const blockNumber2 = await rpc.publicationReader.blockNumber();
63986
+ const binding = record5(await rpc.publicationReader.read({ contract: "token", functionName: "skillOf", args: [unsigned2(input.skillId, "Skill id", true)], blockNumber: blockNumber2 }), "Skill binding");
63987
+ if (typeof binding.version !== "bigint" || binding.version < BigInt(1) || binding.version > BigInt(4294967295)) throw new TypeError("Invalid on-chain Skill version.");
63988
+ return Number(binding.version);
63989
+ }
63990
+ async readPublicationState(input) {
63991
+ const deployment = this.authority(input.request.chainId);
63992
+ const rpc = await this.rpc(input.privateKey, input.walletAddress, deployment);
63993
+ if (!rpc.publicationReader) throw new TypeError("Skill publication reader is unavailable.");
63994
+ return readSkillPublicationState(rpc.publicationReader, input);
63995
+ }
63996
+ async resumePublicationTransaction(input) {
63997
+ try {
63998
+ return await this.verifyPrepared(input);
63999
+ } catch (error51) {
64000
+ if (error51 instanceof SkillPublicationTransactionFailedError) return null;
64001
+ const cause = error51 instanceof Error && error51.cause ? error51.cause : error51;
64002
+ if (!(cause instanceof WaitForTransactionReceiptTimeoutError) && !(cause instanceof TransactionNotFoundError)) throw error51;
64003
+ const rpc = await this.rpc(input.privateKey, input.walletAddress, this.authority(input.request.chainId));
64004
+ if (input.nonce !== void 0 && rpc.getConfirmedNonce && await rpc.getConfirmedNonce() > input.nonce) return null;
64005
+ if (cause instanceof WaitForTransactionReceiptTimeoutError) return null;
64006
+ try {
64007
+ const receipt = await rpc.waitForReceipt(hash4(input.transactionHash, "Skill recovery transaction hash"));
64008
+ if (receipt.status !== "success") return null;
64009
+ return await this.verifyPrepared({ ...input, blockNumber: receipt.blockNumber.toString() });
64010
+ } catch (waiting) {
64011
+ if (waiting instanceof WaitForTransactionReceiptTimeoutError) return null;
64012
+ throw waiting;
64013
+ }
64014
+ }
64015
+ }
63713
64016
  async verifyPrepared(input) {
63714
64017
  const request2 = record5(input.request, "Skill prepared request");
63715
64018
  const deployment = this.authority(request2.chainId);
63716
64019
  const expected = expectedPreparedCall(input.action, request2, deployment);
63717
64020
  const rpc = await this.rpc(input.privateKey, input.walletAddress, deployment);
63718
64021
  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;
64022
+ const exactTransaction2 = (actual2) => actual2.from.toLowerCase() === input.walletAddress.toLowerCase() && actual2.to?.toLowerCase() === expected.to.toLowerCase() && actual2.data === expected.data && actual2.value === expected.value;
63720
64023
  if (input.blockNumber === null) {
63721
64024
  const transaction2 = await rpc.getTransactionCall(transactionHash3);
63722
64025
  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 new TypeError("Skill recovery transaction reverted.");
64026
+ const receipt = await rpcOperation("eth_getTransactionReceipt", () => rpc.waitForReceipt(transactionHash3));
64027
+ if (receipt.status !== "success") throw receiptFailure(input.action);
63725
64028
  return Object.freeze({ transactionHash: transactionHash3, blockNumber: receipt.blockNumber.toString() });
63726
64029
  }
63727
64030
  const blockNumber2 = unsigned2(input.blockNumber, "Skill recovery block number", true);
63728
64031
  const actual = await rpc.getTransactionRecord(transactionHash3);
63729
- if (actual.status !== "success") throw new TypeError("Skill recovery transaction reverted.");
64032
+ if (actual.status !== "success") throw receiptFailure(input.action);
63730
64033
  if (actual.blockNumber !== blockNumber2 || !exactTransaction2(actual)) {
63731
64034
  throw new TypeError("Skill recovery transaction does not match its exact prepared action and receipt.");
63732
64035
  }
@@ -63853,11 +64156,12 @@ var output_exports = {};
63853
64156
  __export(output_exports, {
63854
64157
  emitCliOutcome: () => emitCliOutcome
63855
64158
  });
64159
+ import { randomUUID as randomUUID2 } from "node:crypto";
63856
64160
  function resubmitSafeGuidance(diagnostic) {
63857
64161
  if (diagnostic.submissionStatus === "not_attempted") {
63858
64162
  return "No transaction was sent. Submitting the same plan again is safe.";
63859
64163
  }
63860
- return `${diagnostic.submissionStatus === "uncertain" ? "A transaction may have been broadcast without a returned hash." : "The transaction was broadcast and may still have reverted."} Read the Skill on chain first; resubmitting the same plan cannot apply twice, because it sets the same URI rather than creating anything.`;
64164
+ 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
64165
  }
63862
64166
  function remoteCallerAction(status) {
63863
64167
  if (status === 401 || status === 403) return "authenticate";
@@ -63875,6 +64179,7 @@ function remoteExitCode(status) {
63875
64179
  return AGENT_CLI_OUTPUT_CONTRACT.exitCodes.remoteOrProviderUnavailable;
63876
64180
  }
63877
64181
  function failure(error51) {
64182
+ if (error51 instanceof SkillPublicationConflictError) return { code: "AGENT_MARKET_STATE_CONFLICT", exitCode: AGENT_CLI_OUTPUT_CONTRACT.exitCodes.conflictOrPrecondition, message: error51.message };
63878
64183
  if (error51 instanceof CliSkillSourceError) {
63879
64184
  return {
63880
64185
  code: "AGENT_MARKET_REQUEST_INVALID",
@@ -63904,16 +64209,6 @@ function failure(error51) {
63904
64209
  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
64210
  };
63906
64211
  }
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
64212
  if (error51 instanceof CliHttpError) {
63918
64213
  if (error51.code === "CLI_RESPONSE_INVALID") {
63919
64214
  return { code: "CLI_RESPONSE_INVALID", exitCode: 7, message: "Remote response is invalid." };
@@ -63946,12 +64241,12 @@ function emitCliOutcome(outcome, sinks) {
63946
64241
  const envelope2 = JSON.parse(serialized);
63947
64242
  const source = cause instanceof CliSkillSourceError ? cause : null;
63948
64243
  const remote = cause instanceof CliHttpError && cause.envelope !== null;
63949
- const uncertainRecovery = cause instanceof CliSkillRecoveryUncertainError;
63950
64244
  const diagnostic = outcome.diagnostic;
63951
- const inputBound = source !== null || !(cause instanceof CliHttpError) && diagnostic.phase === "validation";
64245
+ const inputBound = source !== null || cause instanceof SkillPublicationConflictError || !(cause instanceof CliHttpError) && diagnostic.phase === "validation";
63952
64246
  const remoteAction = remoteCallerAction(cause instanceof CliHttpError ? cause.status : null);
63953
64247
  const safeRepeat = diagnostic.resubmitSafe && !inputBound && remoteAction === null;
63954
64248
  envelope2.error.state = JSON.stringify({
64249
+ causeDiagnostic: safeFailureDiagnostic(cause),
63955
64250
  diagnosticCode: source?.diagnosticCode ?? "SKILL_PUBLICATION_FAILED",
63956
64251
  ...source?.details,
63957
64252
  ...diagnostic,
@@ -63961,7 +64256,7 @@ function emitCliOutcome(outcome, sinks) {
63961
64256
  ...remote ? { remoteStatus: cause.status, remoteState: envelope2.error.state, remoteMessage: envelope2.error.message } : {}
63962
64257
  });
63963
64258
  envelope2.error.retryable = false;
63964
- if (!source && !remote && !uncertainRecovery && diagnostic.phase !== "validation") envelope2.error.message = `Skill publication failed during ${diagnostic.phase}. ${diagnostic.recoveryCommand ? "Use the recovery command in state; do not resubmit." : safeRepeat ? resubmitSafeGuidance(diagnostic) : diagnostic.submissionStatus === "uncertain" ? "Broadcast outcome or checkpoint is uncertain. Contact support before retrying or recovering." : "Contact support with the public diagnostic state before retrying."}`;
64259
+ 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
64260
  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
64261
  if (safeRepeat) envelope2.error.retryable = true;
63967
64262
  if (diagnostic.phase === "projection" && diagnostic.submissionStatus === "hash_known") {
@@ -64020,6 +64315,9 @@ function emitCliOutcome(outcome, sinks) {
64020
64315
  }
64021
64316
  const mapped = failure(outcome);
64022
64317
  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];
64318
+ const traceId = randomUUID2();
64319
+ sinks.stderr(`${JSON.stringify({ event: "finch_cli_local_failure", traceId, ...safeFailureDiagnostic(outcome) })}
64320
+ `);
64023
64321
  const envelope = {
64024
64322
  error: {
64025
64323
  code: mapped.code,
@@ -64031,7 +64329,7 @@ function emitCliOutcome(outcome, sinks) {
64031
64329
  operationId: null,
64032
64330
  currentRevision: null,
64033
64331
  currentEtag: null,
64034
- traceId: null
64332
+ traceId
64035
64333
  }
64036
64334
  };
64037
64335
  sinks.stdout(`${JSON.stringify(envelope)}
@@ -64042,6 +64340,7 @@ var init_output = __esm({
64042
64340
  "src/output.ts"() {
64043
64341
  "use strict";
64044
64342
  init_v1();
64343
+ init_client();
64045
64344
  init_chains();
64046
64345
  init_api2();
64047
64346
  init_cli_error();