agent-contracts 0.30.0 → 0.30.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -3951,7 +3951,7 @@ var require_lodash = __commonJS({
3951
3951
  }
3952
3952
  return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, undefined2, comparator) : [];
3953
3953
  });
3954
- function join3(array, separator) {
3954
+ function join4(array, separator) {
3955
3955
  return array == null ? "" : nativeJoin.call(array, separator);
3956
3956
  }
3957
3957
  function last(array) {
@@ -5875,7 +5875,7 @@ var require_lodash = __commonJS({
5875
5875
  lodash.isUndefined = isUndefined;
5876
5876
  lodash.isWeakMap = isWeakMap;
5877
5877
  lodash.isWeakSet = isWeakSet;
5878
- lodash.join = join3;
5878
+ lodash.join = join4;
5879
5879
  lodash.kebabCase = kebabCase;
5880
5880
  lodash.last = last;
5881
5881
  lodash.lastIndexOf = lastIndexOf;
@@ -7496,7 +7496,7 @@ var require_stable = __commonJS({
7496
7496
  return result;
7497
7497
  }
7498
7498
  function stringifyFullFn(key, parent, stack, replacer, indent) {
7499
- var i3, res, join3;
7499
+ var i3, res, join4;
7500
7500
  const originalIndentation = indentation;
7501
7501
  var value = parent[key];
7502
7502
  if (typeof value === "object" && value !== null && typeof value.toJSON === "function") {
@@ -7522,12 +7522,12 @@ var require_stable = __commonJS({
7522
7522
  indentation += indent;
7523
7523
  res += `
7524
7524
  ${indentation}`;
7525
- join3 = `,
7525
+ join4 = `,
7526
7526
  ${indentation}`;
7527
7527
  for (i3 = 0; i3 < value.length - 1; i3++) {
7528
7528
  const tmp2 = stringifyFullFn(i3, value, stack, replacer, indent);
7529
7529
  res += tmp2 !== void 0 ? tmp2 : "null";
7530
- res += join3;
7530
+ res += join4;
7531
7531
  }
7532
7532
  const tmp = stringifyFullFn(i3, value, stack, replacer, indent);
7533
7533
  res += tmp !== void 0 ? tmp : "null";
@@ -7549,7 +7549,7 @@ ${originalIndentation}`;
7549
7549
  indentation += indent;
7550
7550
  res += `
7551
7551
  ${indentation}`;
7552
- join3 = `,
7552
+ join4 = `,
7553
7553
  ${indentation}`;
7554
7554
  var separator = "";
7555
7555
  for (i3 = 0; i3 < keys.length; i3++) {
@@ -7557,7 +7557,7 @@ ${indentation}`;
7557
7557
  const tmp = stringifyFullFn(key, value, stack, replacer, indent);
7558
7558
  if (tmp !== void 0) {
7559
7559
  res += `${separator}"${strEscape(key)}": ${tmp}`;
7560
- separator = join3;
7560
+ separator = join4;
7561
7561
  }
7562
7562
  }
7563
7563
  if (separator !== "") {
@@ -7579,7 +7579,7 @@ ${originalIndentation}`;
7579
7579
  }
7580
7580
  }
7581
7581
  function stringifyFullArr(key, value, stack, replacer, indent) {
7582
- var i3, res, join3;
7582
+ var i3, res, join4;
7583
7583
  const originalIndentation = indentation;
7584
7584
  if (typeof value === "object" && value !== null && typeof value.toJSON === "function") {
7585
7585
  value = value.toJSON(key);
@@ -7603,12 +7603,12 @@ ${originalIndentation}`;
7603
7603
  indentation += indent;
7604
7604
  res += `
7605
7605
  ${indentation}`;
7606
- join3 = `,
7606
+ join4 = `,
7607
7607
  ${indentation}`;
7608
7608
  for (i3 = 0; i3 < value.length - 1; i3++) {
7609
7609
  const tmp2 = stringifyFullArr(i3, value[i3], stack, replacer, indent);
7610
7610
  res += tmp2 !== void 0 ? tmp2 : "null";
7611
- res += join3;
7611
+ res += join4;
7612
7612
  }
7613
7613
  const tmp = stringifyFullArr(i3, value[i3], stack, replacer, indent);
7614
7614
  res += tmp !== void 0 ? tmp : "null";
@@ -7629,7 +7629,7 @@ ${originalIndentation}`;
7629
7629
  indentation += indent;
7630
7630
  res += `
7631
7631
  ${indentation}`;
7632
- join3 = `,
7632
+ join4 = `,
7633
7633
  ${indentation}`;
7634
7634
  var separator = "";
7635
7635
  for (i3 = 0; i3 < replacer.length; i3++) {
@@ -7638,7 +7638,7 @@ ${indentation}`;
7638
7638
  const tmp = stringifyFullArr(key, value[key], stack, replacer, indent);
7639
7639
  if (tmp !== void 0) {
7640
7640
  res += `${separator}"${strEscape(key)}": ${tmp}`;
7641
- separator = join3;
7641
+ separator = join4;
7642
7642
  }
7643
7643
  }
7644
7644
  }
@@ -7661,7 +7661,7 @@ ${originalIndentation}`;
7661
7661
  }
7662
7662
  }
7663
7663
  function stringifyIndent(key, value, stack, indent) {
7664
- var i3, res, join3;
7664
+ var i3, res, join4;
7665
7665
  const originalIndentation = indentation;
7666
7666
  switch (typeof value) {
7667
7667
  case "object":
@@ -7691,12 +7691,12 @@ ${originalIndentation}`;
7691
7691
  indentation += indent;
7692
7692
  res += `
7693
7693
  ${indentation}`;
7694
- join3 = `,
7694
+ join4 = `,
7695
7695
  ${indentation}`;
7696
7696
  for (i3 = 0; i3 < value.length - 1; i3++) {
7697
7697
  const tmp2 = stringifyIndent(i3, value[i3], stack, indent);
7698
7698
  res += tmp2 !== void 0 ? tmp2 : "null";
7699
- res += join3;
7699
+ res += join4;
7700
7700
  }
7701
7701
  const tmp = stringifyIndent(i3, value[i3], stack, indent);
7702
7702
  res += tmp !== void 0 ? tmp : "null";
@@ -7718,7 +7718,7 @@ ${originalIndentation}`;
7718
7718
  indentation += indent;
7719
7719
  res += `
7720
7720
  ${indentation}`;
7721
- join3 = `,
7721
+ join4 = `,
7722
7722
  ${indentation}`;
7723
7723
  var separator = "";
7724
7724
  for (i3 = 0; i3 < keys.length; i3++) {
@@ -7726,7 +7726,7 @@ ${indentation}`;
7726
7726
  const tmp = stringifyIndent(key, value[key], stack, indent);
7727
7727
  if (tmp !== void 0) {
7728
7728
  res += `${separator}"${strEscape(key)}": ${tmp}`;
7729
- separator = join3;
7729
+ separator = join4;
7730
7730
  }
7731
7731
  }
7732
7732
  if (separator !== "") {
@@ -39127,916 +39127,19 @@ var require_runner3 = __commonJS({
39127
39127
  }
39128
39128
  });
39129
39129
 
39130
- // node_modules/concat-map/index.js
39131
- var require_concat_map = __commonJS({
39132
- "node_modules/concat-map/index.js"(exports, module) {
39133
- "use strict";
39134
- module.exports = function(xs, fn) {
39135
- var res = [];
39136
- for (var i3 = 0; i3 < xs.length; i3++) {
39137
- var x3 = fn(xs[i3], i3);
39138
- if (isArray(x3)) res.push.apply(res, x3);
39139
- else res.push(x3);
39140
- }
39141
- return res;
39142
- };
39143
- var isArray = Array.isArray || function(xs) {
39144
- return Object.prototype.toString.call(xs) === "[object Array]";
39145
- };
39146
- }
39147
- });
39148
-
39149
- // node_modules/balanced-match/index.js
39150
- var require_balanced_match = __commonJS({
39151
- "node_modules/balanced-match/index.js"(exports, module) {
39152
- "use strict";
39153
- module.exports = balanced;
39154
- function balanced(a3, b3, str) {
39155
- if (a3 instanceof RegExp) a3 = maybeMatch(a3, str);
39156
- if (b3 instanceof RegExp) b3 = maybeMatch(b3, str);
39157
- var r3 = range(a3, b3, str);
39158
- return r3 && {
39159
- start: r3[0],
39160
- end: r3[1],
39161
- pre: str.slice(0, r3[0]),
39162
- body: str.slice(r3[0] + a3.length, r3[1]),
39163
- post: str.slice(r3[1] + b3.length)
39164
- };
39165
- }
39166
- function maybeMatch(reg, str) {
39167
- var m2 = str.match(reg);
39168
- return m2 ? m2[0] : null;
39169
- }
39170
- balanced.range = range;
39171
- function range(a3, b3, str) {
39172
- var begs, beg, left, right, result;
39173
- var ai = str.indexOf(a3);
39174
- var bi = str.indexOf(b3, ai + 1);
39175
- var i3 = ai;
39176
- if (ai >= 0 && bi > 0) {
39177
- if (a3 === b3) {
39178
- return [ai, bi];
39179
- }
39180
- begs = [];
39181
- left = str.length;
39182
- while (i3 >= 0 && !result) {
39183
- if (i3 == ai) {
39184
- begs.push(i3);
39185
- ai = str.indexOf(a3, i3 + 1);
39186
- } else if (begs.length == 1) {
39187
- result = [begs.pop(), bi];
39188
- } else {
39189
- beg = begs.pop();
39190
- if (beg < left) {
39191
- left = beg;
39192
- right = bi;
39193
- }
39194
- bi = str.indexOf(b3, i3 + 1);
39195
- }
39196
- i3 = ai < bi && ai >= 0 ? ai : bi;
39197
- }
39198
- if (begs.length) {
39199
- result = [left, right];
39200
- }
39201
- }
39202
- return result;
39203
- }
39204
- }
39205
- });
39206
-
39207
- // node_modules/brace-expansion/index.js
39208
- var require_brace_expansion = __commonJS({
39209
- "node_modules/brace-expansion/index.js"(exports, module) {
39210
- "use strict";
39211
- var concatMap = require_concat_map();
39212
- var balanced = require_balanced_match();
39213
- module.exports = expandTop;
39214
- var escSlash = "\0SLASH" + Math.random() + "\0";
39215
- var escOpen = "\0OPEN" + Math.random() + "\0";
39216
- var escClose = "\0CLOSE" + Math.random() + "\0";
39217
- var escComma = "\0COMMA" + Math.random() + "\0";
39218
- var escPeriod = "\0PERIOD" + Math.random() + "\0";
39219
- function numeric(str) {
39220
- return parseInt(str, 10) == str ? parseInt(str, 10) : str.charCodeAt(0);
39221
- }
39222
- function escapeBraces(str) {
39223
- return str.split("\\\\").join(escSlash).split("\\{").join(escOpen).split("\\}").join(escClose).split("\\,").join(escComma).split("\\.").join(escPeriod);
39224
- }
39225
- function unescapeBraces(str) {
39226
- return str.split(escSlash).join("\\").split(escOpen).join("{").split(escClose).join("}").split(escComma).join(",").split(escPeriod).join(".");
39227
- }
39228
- function parseCommaParts(str) {
39229
- if (!str)
39230
- return [""];
39231
- var parts = [];
39232
- var m2 = balanced("{", "}", str);
39233
- if (!m2)
39234
- return str.split(",");
39235
- var pre = m2.pre;
39236
- var body = m2.body;
39237
- var post = m2.post;
39238
- var p2 = pre.split(",");
39239
- p2[p2.length - 1] += "{" + body + "}";
39240
- var postParts = parseCommaParts(post);
39241
- if (post.length) {
39242
- p2[p2.length - 1] += postParts.shift();
39243
- p2.push.apply(p2, postParts);
39244
- }
39245
- parts.push.apply(parts, p2);
39246
- return parts;
39247
- }
39248
- function expandTop(str, options) {
39249
- if (!str)
39250
- return [];
39251
- options = options || {};
39252
- var max = options.max == null ? Infinity : options.max;
39253
- if (str.substr(0, 2) === "{}") {
39254
- str = "\\{\\}" + str.substr(2);
39255
- }
39256
- return expand(escapeBraces(str), max, true).map(unescapeBraces);
39257
- }
39258
- function embrace(str) {
39259
- return "{" + str + "}";
39260
- }
39261
- function isPadded(el) {
39262
- return /^-?0\d/.test(el);
39263
- }
39264
- function lte(i3, y) {
39265
- return i3 <= y;
39266
- }
39267
- function gte(i3, y) {
39268
- return i3 >= y;
39269
- }
39270
- function expand(str, max, isTop) {
39271
- var expansions = [];
39272
- var m2 = balanced("{", "}", str);
39273
- if (!m2 || /\$$/.test(m2.pre)) return [str];
39274
- var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m2.body);
39275
- var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m2.body);
39276
- var isSequence = isNumericSequence || isAlphaSequence;
39277
- var isOptions = m2.body.indexOf(",") >= 0;
39278
- if (!isSequence && !isOptions) {
39279
- if (m2.post.match(/,(?!,).*\}/)) {
39280
- str = m2.pre + "{" + m2.body + escClose + m2.post;
39281
- return expand(str, max, true);
39282
- }
39283
- return [str];
39284
- }
39285
- var n3;
39286
- if (isSequence) {
39287
- n3 = m2.body.split(/\.\./);
39288
- } else {
39289
- n3 = parseCommaParts(m2.body);
39290
- if (n3.length === 1) {
39291
- n3 = expand(n3[0], max, false).map(embrace);
39292
- if (n3.length === 1) {
39293
- var post = m2.post.length ? expand(m2.post, max, false) : [""];
39294
- return post.map(function(p2) {
39295
- return m2.pre + n3[0] + p2;
39296
- });
39297
- }
39298
- }
39299
- }
39300
- var pre = m2.pre;
39301
- var post = m2.post.length ? expand(m2.post, max, false) : [""];
39302
- var N2;
39303
- if (isSequence) {
39304
- var x3 = numeric(n3[0]);
39305
- var y = numeric(n3[1]);
39306
- var width = Math.max(n3[0].length, n3[1].length);
39307
- var incr = n3.length == 3 ? Math.max(Math.abs(numeric(n3[2])), 1) : 1;
39308
- var test = lte;
39309
- var reverse = y < x3;
39310
- if (reverse) {
39311
- incr *= -1;
39312
- test = gte;
39313
- }
39314
- var pad = n3.some(isPadded);
39315
- N2 = [];
39316
- for (var i3 = x3; test(i3, y); i3 += incr) {
39317
- var c2;
39318
- if (isAlphaSequence) {
39319
- c2 = String.fromCharCode(i3);
39320
- if (c2 === "\\")
39321
- c2 = "";
39322
- } else {
39323
- c2 = String(i3);
39324
- if (pad) {
39325
- var need = width - c2.length;
39326
- if (need > 0) {
39327
- var z21 = new Array(need + 1).join("0");
39328
- if (i3 < 0)
39329
- c2 = "-" + z21 + c2.slice(1);
39330
- else
39331
- c2 = z21 + c2;
39332
- }
39333
- }
39334
- }
39335
- N2.push(c2);
39336
- }
39337
- } else {
39338
- N2 = concatMap(n3, function(el) {
39339
- return expand(el, max, false);
39340
- });
39341
- }
39342
- for (var j2 = 0; j2 < N2.length; j2++) {
39343
- for (var k2 = 0; k2 < post.length && expansions.length < max; k2++) {
39344
- var expansion = pre + N2[j2] + post[k2];
39345
- if (!isTop || isSequence || expansion)
39346
- expansions.push(expansion);
39347
- }
39348
- }
39349
- return expansions;
39350
- }
39351
- }
39352
- });
39353
-
39354
- // node_modules/minimatch/minimatch.js
39355
- var require_minimatch = __commonJS({
39356
- "node_modules/minimatch/minimatch.js"(exports, module) {
39357
- "use strict";
39358
- module.exports = minimatch;
39359
- minimatch.Minimatch = Minimatch;
39360
- var path = (function() {
39361
- try {
39362
- return __require("path");
39363
- } catch (e3) {
39364
- }
39365
- })() || {
39366
- sep: "/"
39367
- };
39368
- minimatch.sep = path.sep;
39369
- var GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {};
39370
- var expand = require_brace_expansion();
39371
- var plTypes = {
39372
- "!": { open: "(?:(?!(?:", close: "))[^/]*?)" },
39373
- "?": { open: "(?:", close: ")?" },
39374
- "+": { open: "(?:", close: ")+" },
39375
- "*": { open: "(?:", close: ")*" },
39376
- "@": { open: "(?:", close: ")" }
39377
- };
39378
- var qmark = "[^/]";
39379
- var star = qmark + "*?";
39380
- var twoStarDot = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?";
39381
- var twoStarNoDot = "(?:(?!(?:\\/|^)\\.).)*?";
39382
- var reSpecials = charSet("().*{}+?[]^$\\!");
39383
- function charSet(s2) {
39384
- return s2.split("").reduce(function(set, c2) {
39385
- set[c2] = true;
39386
- return set;
39387
- }, {});
39388
- }
39389
- var slashSplit = /\/+/;
39390
- minimatch.filter = filter;
39391
- function filter(pattern, options) {
39392
- options = options || {};
39393
- return function(p2, i3, list) {
39394
- return minimatch(p2, pattern, options);
39395
- };
39396
- }
39397
- function ext(a3, b3) {
39398
- b3 = b3 || {};
39399
- var t3 = {};
39400
- Object.keys(a3).forEach(function(k2) {
39401
- t3[k2] = a3[k2];
39402
- });
39403
- Object.keys(b3).forEach(function(k2) {
39404
- t3[k2] = b3[k2];
39405
- });
39406
- return t3;
39407
- }
39408
- minimatch.defaults = function(def) {
39409
- if (!def || typeof def !== "object" || !Object.keys(def).length) {
39410
- return minimatch;
39411
- }
39412
- var orig = minimatch;
39413
- var m2 = function minimatch2(p2, pattern, options) {
39414
- return orig(p2, pattern, ext(def, options));
39415
- };
39416
- m2.Minimatch = function Minimatch2(pattern, options) {
39417
- return new orig.Minimatch(pattern, ext(def, options));
39418
- };
39419
- m2.Minimatch.defaults = function defaults(options) {
39420
- return orig.defaults(ext(def, options)).Minimatch;
39421
- };
39422
- m2.filter = function filter2(pattern, options) {
39423
- return orig.filter(pattern, ext(def, options));
39424
- };
39425
- m2.defaults = function defaults(options) {
39426
- return orig.defaults(ext(def, options));
39427
- };
39428
- m2.makeRe = function makeRe2(pattern, options) {
39429
- return orig.makeRe(pattern, ext(def, options));
39430
- };
39431
- m2.braceExpand = function braceExpand2(pattern, options) {
39432
- return orig.braceExpand(pattern, ext(def, options));
39433
- };
39434
- m2.match = function(list, pattern, options) {
39435
- return orig.match(list, pattern, ext(def, options));
39436
- };
39437
- return m2;
39438
- };
39439
- Minimatch.defaults = function(def) {
39440
- return minimatch.defaults(def).Minimatch;
39441
- };
39442
- function minimatch(p2, pattern, options) {
39443
- assertValidPattern(pattern);
39444
- if (!options) options = {};
39445
- if (!options.nocomment && pattern.charAt(0) === "#") {
39446
- return false;
39447
- }
39448
- return new Minimatch(pattern, options).match(p2);
39449
- }
39450
- function Minimatch(pattern, options) {
39451
- if (!(this instanceof Minimatch)) {
39452
- return new Minimatch(pattern, options);
39453
- }
39454
- assertValidPattern(pattern);
39455
- if (!options) options = {};
39456
- pattern = pattern.trim();
39457
- if (!options.allowWindowsEscape && path.sep !== "/") {
39458
- pattern = pattern.split(path.sep).join("/");
39459
- }
39460
- this.options = options;
39461
- this.maxGlobstarRecursion = options.maxGlobstarRecursion !== void 0 ? options.maxGlobstarRecursion : 200;
39462
- this.set = [];
39463
- this.pattern = pattern;
39464
- this.regexp = null;
39465
- this.negate = false;
39466
- this.comment = false;
39467
- this.empty = false;
39468
- this.partial = !!options.partial;
39469
- this.make();
39470
- }
39471
- Minimatch.prototype.debug = function() {
39472
- };
39473
- Minimatch.prototype.make = make;
39474
- function make() {
39475
- var pattern = this.pattern;
39476
- var options = this.options;
39477
- if (!options.nocomment && pattern.charAt(0) === "#") {
39478
- this.comment = true;
39479
- return;
39480
- }
39481
- if (!pattern) {
39482
- this.empty = true;
39483
- return;
39484
- }
39485
- this.parseNegate();
39486
- var set = this.globSet = this.braceExpand();
39487
- if (options.debug) this.debug = function debug() {
39488
- console.error.apply(console, arguments);
39489
- };
39490
- this.debug(this.pattern, set);
39491
- set = this.globParts = set.map(function(s2) {
39492
- return s2.split(slashSplit);
39493
- });
39494
- this.debug(this.pattern, set);
39495
- set = set.map(function(s2, si, set2) {
39496
- return s2.map(this.parse, this);
39497
- }, this);
39498
- this.debug(this.pattern, set);
39499
- set = set.filter(function(s2) {
39500
- return s2.indexOf(false) === -1;
39501
- });
39502
- this.debug(this.pattern, set);
39503
- this.set = set;
39504
- }
39505
- Minimatch.prototype.parseNegate = parseNegate;
39506
- function parseNegate() {
39507
- var pattern = this.pattern;
39508
- var negate = false;
39509
- var options = this.options;
39510
- var negateOffset = 0;
39511
- if (options.nonegate) return;
39512
- for (var i3 = 0, l2 = pattern.length; i3 < l2 && pattern.charAt(i3) === "!"; i3++) {
39513
- negate = !negate;
39514
- negateOffset++;
39515
- }
39516
- if (negateOffset) this.pattern = pattern.substr(negateOffset);
39517
- this.negate = negate;
39518
- }
39519
- minimatch.braceExpand = function(pattern, options) {
39520
- return braceExpand(pattern, options);
39521
- };
39522
- Minimatch.prototype.braceExpand = braceExpand;
39523
- function braceExpand(pattern, options) {
39524
- if (!options) {
39525
- if (this instanceof Minimatch) {
39526
- options = this.options;
39527
- } else {
39528
- options = {};
39529
- }
39530
- }
39531
- pattern = typeof pattern === "undefined" ? this.pattern : pattern;
39532
- assertValidPattern(pattern);
39533
- if (options.nobrace || !/\{(?:(?!\{).)*\}/.test(pattern)) {
39534
- return [pattern];
39535
- }
39536
- return expand(pattern);
39537
- }
39538
- var MAX_PATTERN_LENGTH = 1024 * 64;
39539
- var assertValidPattern = function(pattern) {
39540
- if (typeof pattern !== "string") {
39541
- throw new TypeError("invalid pattern");
39542
- }
39543
- if (pattern.length > MAX_PATTERN_LENGTH) {
39544
- throw new TypeError("pattern is too long");
39545
- }
39546
- };
39547
- Minimatch.prototype.parse = parse2;
39548
- var SUBPARSE = {};
39549
- function parse2(pattern, isSub) {
39550
- assertValidPattern(pattern);
39551
- var options = this.options;
39552
- if (pattern === "**") {
39553
- if (!options.noglobstar)
39554
- return GLOBSTAR;
39555
- else
39556
- pattern = "*";
39557
- }
39558
- if (pattern === "") return "";
39559
- var re2 = "";
39560
- var hasMagic = !!options.nocase;
39561
- var escaping = false;
39562
- var patternListStack = [];
39563
- var negativeLists = [];
39564
- var stateChar;
39565
- var inClass = false;
39566
- var reClassStart = -1;
39567
- var classStart = -1;
39568
- var patternStart = pattern.charAt(0) === "." ? "" : options.dot ? "(?!(?:^|\\/)\\.{1,2}(?:$|\\/))" : "(?!\\.)";
39569
- var self2 = this;
39570
- function clearStateChar() {
39571
- if (stateChar) {
39572
- switch (stateChar) {
39573
- case "*":
39574
- re2 += star;
39575
- hasMagic = true;
39576
- break;
39577
- case "?":
39578
- re2 += qmark;
39579
- hasMagic = true;
39580
- break;
39581
- default:
39582
- re2 += "\\" + stateChar;
39583
- break;
39584
- }
39585
- self2.debug("clearStateChar %j %j", stateChar, re2);
39586
- stateChar = false;
39587
- }
39588
- }
39589
- for (var i3 = 0, len = pattern.length, c2; i3 < len && (c2 = pattern.charAt(i3)); i3++) {
39590
- this.debug("%s %s %s %j", pattern, i3, re2, c2);
39591
- if (escaping && reSpecials[c2]) {
39592
- re2 += "\\" + c2;
39593
- escaping = false;
39594
- continue;
39595
- }
39596
- switch (c2) {
39597
- /* istanbul ignore next */
39598
- case "/": {
39599
- return false;
39600
- }
39601
- case "\\":
39602
- clearStateChar();
39603
- escaping = true;
39604
- continue;
39605
- // the various stateChar values
39606
- // for the "extglob" stuff.
39607
- case "?":
39608
- case "*":
39609
- case "+":
39610
- case "@":
39611
- case "!":
39612
- this.debug("%s %s %s %j <-- stateChar", pattern, i3, re2, c2);
39613
- if (inClass) {
39614
- this.debug(" in class");
39615
- if (c2 === "!" && i3 === classStart + 1) c2 = "^";
39616
- re2 += c2;
39617
- continue;
39618
- }
39619
- if (c2 === "*" && stateChar === "*") continue;
39620
- self2.debug("call clearStateChar %j", stateChar);
39621
- clearStateChar();
39622
- stateChar = c2;
39623
- if (options.noext) clearStateChar();
39624
- continue;
39625
- case "(":
39626
- if (inClass) {
39627
- re2 += "(";
39628
- continue;
39629
- }
39630
- if (!stateChar) {
39631
- re2 += "\\(";
39632
- continue;
39633
- }
39634
- patternListStack.push({
39635
- type: stateChar,
39636
- start: i3 - 1,
39637
- reStart: re2.length,
39638
- open: plTypes[stateChar].open,
39639
- close: plTypes[stateChar].close
39640
- });
39641
- re2 += stateChar === "!" ? "(?:(?!(?:" : "(?:";
39642
- this.debug("plType %j %j", stateChar, re2);
39643
- stateChar = false;
39644
- continue;
39645
- case ")":
39646
- if (inClass || !patternListStack.length) {
39647
- re2 += "\\)";
39648
- continue;
39649
- }
39650
- clearStateChar();
39651
- hasMagic = true;
39652
- var pl = patternListStack.pop();
39653
- re2 += pl.close;
39654
- if (pl.type === "!") {
39655
- negativeLists.push(pl);
39656
- }
39657
- pl.reEnd = re2.length;
39658
- continue;
39659
- case "|":
39660
- if (inClass || !patternListStack.length || escaping) {
39661
- re2 += "\\|";
39662
- escaping = false;
39663
- continue;
39664
- }
39665
- clearStateChar();
39666
- re2 += "|";
39667
- continue;
39668
- // these are mostly the same in regexp and glob
39669
- case "[":
39670
- clearStateChar();
39671
- if (inClass) {
39672
- re2 += "\\" + c2;
39673
- continue;
39674
- }
39675
- inClass = true;
39676
- classStart = i3;
39677
- reClassStart = re2.length;
39678
- re2 += c2;
39679
- continue;
39680
- case "]":
39681
- if (i3 === classStart + 1 || !inClass) {
39682
- re2 += "\\" + c2;
39683
- escaping = false;
39684
- continue;
39685
- }
39686
- var cs = pattern.substring(classStart + 1, i3);
39687
- try {
39688
- RegExp("[" + cs + "]");
39689
- } catch (er) {
39690
- var sp = this.parse(cs, SUBPARSE);
39691
- re2 = re2.substr(0, reClassStart) + "\\[" + sp[0] + "\\]";
39692
- hasMagic = hasMagic || sp[1];
39693
- inClass = false;
39694
- continue;
39695
- }
39696
- hasMagic = true;
39697
- inClass = false;
39698
- re2 += c2;
39699
- continue;
39700
- default:
39701
- clearStateChar();
39702
- if (escaping) {
39703
- escaping = false;
39704
- } else if (reSpecials[c2] && !(c2 === "^" && inClass)) {
39705
- re2 += "\\";
39706
- }
39707
- re2 += c2;
39708
- }
39709
- }
39710
- if (inClass) {
39711
- cs = pattern.substr(classStart + 1);
39712
- sp = this.parse(cs, SUBPARSE);
39713
- re2 = re2.substr(0, reClassStart) + "\\[" + sp[0];
39714
- hasMagic = hasMagic || sp[1];
39715
- }
39716
- for (pl = patternListStack.pop(); pl; pl = patternListStack.pop()) {
39717
- var tail = re2.slice(pl.reStart + pl.open.length);
39718
- this.debug("setting tail", re2, pl);
39719
- tail = tail.replace(/((?:\\{2}){0,64})(\\?)\|/g, function(_2, $1, $2) {
39720
- if (!$2) {
39721
- $2 = "\\";
39722
- }
39723
- return $1 + $1 + $2 + "|";
39724
- });
39725
- this.debug("tail=%j\n %s", tail, tail, pl, re2);
39726
- var t3 = pl.type === "*" ? star : pl.type === "?" ? qmark : "\\" + pl.type;
39727
- hasMagic = true;
39728
- re2 = re2.slice(0, pl.reStart) + t3 + "\\(" + tail;
39729
- }
39730
- clearStateChar();
39731
- if (escaping) {
39732
- re2 += "\\\\";
39733
- }
39734
- var addPatternStart = false;
39735
- switch (re2.charAt(0)) {
39736
- case "[":
39737
- case ".":
39738
- case "(":
39739
- addPatternStart = true;
39740
- }
39741
- for (var n3 = negativeLists.length - 1; n3 > -1; n3--) {
39742
- var nl = negativeLists[n3];
39743
- var nlBefore = re2.slice(0, nl.reStart);
39744
- var nlFirst = re2.slice(nl.reStart, nl.reEnd - 8);
39745
- var nlLast = re2.slice(nl.reEnd - 8, nl.reEnd);
39746
- var nlAfter = re2.slice(nl.reEnd);
39747
- nlLast += nlAfter;
39748
- var openParensBefore = nlBefore.split("(").length - 1;
39749
- var cleanAfter = nlAfter;
39750
- for (i3 = 0; i3 < openParensBefore; i3++) {
39751
- cleanAfter = cleanAfter.replace(/\)[+*?]?/, "");
39752
- }
39753
- nlAfter = cleanAfter;
39754
- var dollar = "";
39755
- if (nlAfter === "" && isSub !== SUBPARSE) {
39756
- dollar = "$";
39757
- }
39758
- var newRe = nlBefore + nlFirst + nlAfter + dollar + nlLast;
39759
- re2 = newRe;
39760
- }
39761
- if (re2 !== "" && hasMagic) {
39762
- re2 = "(?=.)" + re2;
39763
- }
39764
- if (addPatternStart) {
39765
- re2 = patternStart + re2;
39766
- }
39767
- if (isSub === SUBPARSE) {
39768
- return [re2, hasMagic];
39769
- }
39770
- if (!hasMagic) {
39771
- return globUnescape(pattern);
39772
- }
39773
- var flags = options.nocase ? "i" : "";
39774
- try {
39775
- var regExp = new RegExp("^" + re2 + "$", flags);
39776
- } catch (er) {
39777
- return new RegExp("$.");
39778
- }
39779
- regExp._glob = pattern;
39780
- regExp._src = re2;
39781
- return regExp;
39782
- }
39783
- minimatch.makeRe = function(pattern, options) {
39784
- return new Minimatch(pattern, options || {}).makeRe();
39785
- };
39786
- Minimatch.prototype.makeRe = makeRe;
39787
- function makeRe() {
39788
- if (this.regexp || this.regexp === false) return this.regexp;
39789
- var set = this.set;
39790
- if (!set.length) {
39791
- this.regexp = false;
39792
- return this.regexp;
39793
- }
39794
- var options = this.options;
39795
- var twoStar = options.noglobstar ? star : options.dot ? twoStarDot : twoStarNoDot;
39796
- var flags = options.nocase ? "i" : "";
39797
- var re2 = set.map(function(pattern) {
39798
- return pattern.map(function(p2) {
39799
- return p2 === GLOBSTAR ? twoStar : typeof p2 === "string" ? regExpEscape(p2) : p2._src;
39800
- }).join("\\/");
39801
- }).join("|");
39802
- re2 = "^(?:" + re2 + ")$";
39803
- if (this.negate) re2 = "^(?!" + re2 + ").*$";
39804
- try {
39805
- this.regexp = new RegExp(re2, flags);
39806
- } catch (ex) {
39807
- this.regexp = false;
39808
- }
39809
- return this.regexp;
39810
- }
39811
- minimatch.match = function(list, pattern, options) {
39812
- options = options || {};
39813
- var mm = new Minimatch(pattern, options);
39814
- list = list.filter(function(f2) {
39815
- return mm.match(f2);
39816
- });
39817
- if (mm.options.nonull && !list.length) {
39818
- list.push(pattern);
39819
- }
39820
- return list;
39821
- };
39822
- Minimatch.prototype.match = function match(f2, partial) {
39823
- if (typeof partial === "undefined") partial = this.partial;
39824
- this.debug("match", f2, this.pattern);
39825
- if (this.comment) return false;
39826
- if (this.empty) return f2 === "";
39827
- if (f2 === "/" && partial) return true;
39828
- var options = this.options;
39829
- if (path.sep !== "/") {
39830
- f2 = f2.split(path.sep).join("/");
39831
- }
39832
- f2 = f2.split(slashSplit);
39833
- this.debug(this.pattern, "split", f2);
39834
- var set = this.set;
39835
- this.debug(this.pattern, "set", set);
39836
- var filename;
39837
- var i3;
39838
- for (i3 = f2.length - 1; i3 >= 0; i3--) {
39839
- filename = f2[i3];
39840
- if (filename) break;
39841
- }
39842
- for (i3 = 0; i3 < set.length; i3++) {
39843
- var pattern = set[i3];
39844
- var file = f2;
39845
- if (options.matchBase && pattern.length === 1) {
39846
- file = [filename];
39847
- }
39848
- var hit = this.matchOne(file, pattern, partial);
39849
- if (hit) {
39850
- if (options.flipNegate) return true;
39851
- return !this.negate;
39852
- }
39853
- }
39854
- if (options.flipNegate) return false;
39855
- return this.negate;
39856
- };
39857
- Minimatch.prototype.matchOne = function(file, pattern, partial) {
39858
- if (pattern.indexOf(GLOBSTAR) !== -1) {
39859
- return this._matchGlobstar(file, pattern, partial, 0, 0);
39860
- }
39861
- return this._matchOne(file, pattern, partial, 0, 0);
39862
- };
39863
- Minimatch.prototype._matchGlobstar = function(file, pattern, partial, fileIndex, patternIndex) {
39864
- var i3;
39865
- var firstgs = -1;
39866
- for (i3 = patternIndex; i3 < pattern.length; i3++) {
39867
- if (pattern[i3] === GLOBSTAR) {
39868
- firstgs = i3;
39869
- break;
39870
- }
39871
- }
39872
- var lastgs = -1;
39873
- for (i3 = pattern.length - 1; i3 >= 0; i3--) {
39874
- if (pattern[i3] === GLOBSTAR) {
39875
- lastgs = i3;
39876
- break;
39877
- }
39878
- }
39879
- var head = pattern.slice(patternIndex, firstgs);
39880
- var body = partial ? pattern.slice(firstgs + 1) : pattern.slice(firstgs + 1, lastgs);
39881
- var tail = partial ? [] : pattern.slice(lastgs + 1);
39882
- if (head.length) {
39883
- var fileHead = file.slice(fileIndex, fileIndex + head.length);
39884
- if (!this._matchOne(fileHead, head, partial, 0, 0)) {
39885
- return false;
39886
- }
39887
- fileIndex += head.length;
39888
- }
39889
- var fileTailMatch = 0;
39890
- if (tail.length) {
39891
- if (tail.length + fileIndex > file.length) return false;
39892
- var tailStart = file.length - tail.length;
39893
- if (this._matchOne(file, tail, partial, tailStart, 0)) {
39894
- fileTailMatch = tail.length;
39895
- } else {
39896
- if (file[file.length - 1] !== "" || fileIndex + tail.length === file.length) {
39897
- return false;
39898
- }
39899
- tailStart--;
39900
- if (!this._matchOne(file, tail, partial, tailStart, 0)) {
39901
- return false;
39902
- }
39903
- fileTailMatch = tail.length + 1;
39904
- }
39905
- }
39906
- if (!body.length) {
39907
- var sawSome = !!fileTailMatch;
39908
- for (i3 = fileIndex; i3 < file.length - fileTailMatch; i3++) {
39909
- var f2 = String(file[i3]);
39910
- sawSome = true;
39911
- if (f2 === "." || f2 === ".." || !this.options.dot && f2.charAt(0) === ".") {
39912
- return false;
39913
- }
39914
- }
39915
- return partial || sawSome;
39916
- }
39917
- var bodySegments = [[[], 0]];
39918
- var currentBody = bodySegments[0];
39919
- var nonGsParts = 0;
39920
- var nonGsPartsSums = [0];
39921
- for (var bi = 0; bi < body.length; bi++) {
39922
- var b3 = body[bi];
39923
- if (b3 === GLOBSTAR) {
39924
- nonGsPartsSums.push(nonGsParts);
39925
- currentBody = [[], 0];
39926
- bodySegments.push(currentBody);
39927
- } else {
39928
- currentBody[0].push(b3);
39929
- nonGsParts++;
39930
- }
39931
- }
39932
- var idx = bodySegments.length - 1;
39933
- var fileLength = file.length - fileTailMatch;
39934
- for (var si = 0; si < bodySegments.length; si++) {
39935
- bodySegments[si][1] = fileLength - (nonGsPartsSums[idx--] + bodySegments[si][0].length);
39936
- }
39937
- return !!this._matchGlobStarBodySections(
39938
- file,
39939
- bodySegments,
39940
- fileIndex,
39941
- 0,
39942
- partial,
39943
- 0,
39944
- !!fileTailMatch
39945
- );
39946
- };
39947
- Minimatch.prototype._matchGlobStarBodySections = function(file, bodySegments, fileIndex, bodyIndex, partial, globStarDepth, sawTail) {
39948
- var bs = bodySegments[bodyIndex];
39949
- if (!bs) {
39950
- for (var i3 = fileIndex; i3 < file.length; i3++) {
39951
- sawTail = true;
39952
- var f2 = file[i3];
39953
- if (f2 === "." || f2 === ".." || !this.options.dot && f2.charAt(0) === ".") {
39954
- return false;
39955
- }
39956
- }
39957
- return sawTail;
39958
- }
39959
- var body = bs[0];
39960
- var after = bs[1];
39961
- while (fileIndex <= after) {
39962
- var m2 = this._matchOne(
39963
- file.slice(0, fileIndex + body.length),
39964
- body,
39965
- partial,
39966
- fileIndex,
39967
- 0
39968
- );
39969
- if (m2 && globStarDepth < this.maxGlobstarRecursion) {
39970
- var sub = this._matchGlobStarBodySections(
39971
- file,
39972
- bodySegments,
39973
- fileIndex + body.length,
39974
- bodyIndex + 1,
39975
- partial,
39976
- globStarDepth + 1,
39977
- sawTail
39978
- );
39979
- if (sub !== false) {
39980
- return sub;
39981
- }
39982
- }
39983
- var f2 = file[fileIndex];
39984
- if (f2 === "." || f2 === ".." || !this.options.dot && f2.charAt(0) === ".") {
39985
- return false;
39986
- }
39987
- fileIndex++;
39988
- }
39989
- return partial || null;
39990
- };
39991
- Minimatch.prototype._matchOne = function(file, pattern, partial, fileIndex, patternIndex) {
39992
- var fi, pi, fl, pl;
39993
- for (fi = fileIndex, pi = patternIndex, fl = file.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
39994
- this.debug("matchOne loop");
39995
- var p2 = pattern[pi];
39996
- var f2 = file[fi];
39997
- this.debug(pattern, p2, f2);
39998
- if (p2 === false || p2 === GLOBSTAR) return false;
39999
- var hit;
40000
- if (typeof p2 === "string") {
40001
- hit = f2 === p2;
40002
- this.debug("string match", p2, f2, hit);
40003
- } else {
40004
- hit = f2.match(p2);
40005
- this.debug("pattern match", p2, f2, hit);
40006
- }
40007
- if (!hit) return false;
40008
- }
40009
- if (fi === fl && pi === pl) {
40010
- return true;
40011
- } else if (fi === fl) {
40012
- return partial;
40013
- } else if (pi === pl) {
40014
- return fi === fl - 1 && file[fi] === "";
40015
- }
40016
- throw new Error("wtf?");
40017
- };
40018
- function globUnescape(s2) {
40019
- return s2.replace(/\\(.)/g, "$1");
40020
- }
40021
- function regExpEscape(s2) {
40022
- return s2.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
40023
- }
40024
- }
40025
- });
40026
-
40027
39130
  // node_modules/@stoplight/spectral-core/dist/ruleset/utils/minimatch.js
40028
- var require_minimatch2 = __commonJS({
39131
+ var require_minimatch = __commonJS({
40029
39132
  "node_modules/@stoplight/spectral-core/dist/ruleset/utils/minimatch.js"(exports) {
40030
39133
  "use strict";
40031
39134
  Object.defineProperty(exports, "__esModule", { value: true });
40032
39135
  exports.minimatch = void 0;
40033
39136
  var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
40034
- var minimatch_1 = (0, tslib_1.__importDefault)(require_minimatch());
39137
+ var minimatch_1 = (0, tslib_1.__importDefault)(__require("minimatch"));
40035
39138
  var DEFAULT_OPTS = { matchBase: true };
40036
- function minimatch(source, pattern) {
39139
+ function minimatch3(source, pattern) {
40037
39140
  return (0, minimatch_1.default)(source, pattern, DEFAULT_OPTS);
40038
39141
  }
40039
- exports.minimatch = minimatch;
39142
+ exports.minimatch = minimatch3;
40040
39143
  }
40041
39144
  });
40042
39145
 
@@ -40189,7 +39292,7 @@ var require_rule = __commonJS({
40189
39292
  var path_1 = (init_index_es(), __toCommonJS(index_es_exports));
40190
39293
  var json_1 = (init_index_es2(), __toCommonJS(index_es_exports2));
40191
39294
  var severity_1 = require_severity();
40192
- var minimatch_1 = require_minimatch2();
39295
+ var minimatch_1 = require_minimatch();
40193
39296
  var formats_1 = require_formats();
40194
39297
  var alias_1 = require_alias();
40195
39298
  var Rule = class _Rule {
@@ -40341,17 +39444,19 @@ var require_errors = __commonJS({
40341
39444
  exports.convertAjvErrors = exports.RulesetValidationError = void 0;
40342
39445
  var isAggregateError_1 = require_isAggregateError();
40343
39446
  var RulesetValidationError = class extends Error {
40344
- constructor(code, message, path) {
39447
+ constructor(code, message, path, location2) {
40345
39448
  super(message);
40346
39449
  this.code = code;
40347
39450
  this.message = message;
40348
39451
  this.path = path;
39452
+ this.range = location2 === null || location2 === void 0 ? void 0 : location2.range;
39453
+ this.source = location2 === null || location2 === void 0 ? void 0 : location2.source;
40349
39454
  }
40350
39455
  };
40351
39456
  exports.RulesetValidationError = RulesetValidationError;
40352
39457
  var RULE_INSTANCE_PATH = /^\/rules\/[^/]+/;
40353
39458
  var GENERIC_INSTANCE_PATH = /^\/(?:aliases|extends|overrides(?:\/\d+\/extends)?)/;
40354
- function convertAjvErrors(errors) {
39459
+ function convertAjvErrors(errors, sourceContext) {
40355
39460
  const sortedErrors = [...errors].sort((errorA, errorB) => {
40356
39461
  const diff = errorA.instancePath.length - errorB.instancePath.length;
40357
39462
  return diff === 0 ? errorA.keyword === "errorMessage" && errorB.keyword !== "errorMessage" ? -1 : 0 : diff;
@@ -40384,10 +39489,12 @@ var require_errors = __commonJS({
40384
39489
  return filteredErrors.flatMap((error) => {
40385
39490
  var _a;
40386
39491
  if (error.keyword === "x-spectral-runtime") {
40387
- return flatErrors(error.params.errors);
39492
+ const flat = flatErrors(error.params.errors);
39493
+ const list = Array.isArray(flat) ? flat : [flat];
39494
+ return list.map((e3) => enrichWithLocation(e3, sourceContext));
40388
39495
  }
40389
39496
  const path = error.instancePath.slice(1).split("/");
40390
- return new RulesetValidationError(inferErrorCode(path, error.keyword), (_a = error.message) !== null && _a !== void 0 ? _a : "unknown error", path);
39497
+ return new RulesetValidationError(inferErrorCode(path, error.keyword), (_a = error.message) !== null && _a !== void 0 ? _a : "unknown error", path, resolveLocation(path, sourceContext));
40391
39498
  });
40392
39499
  }
40393
39500
  exports.convertAjvErrors = convertAjvErrors;
@@ -40397,6 +39504,22 @@ var require_errors = __commonJS({
40397
39504
  }
40398
39505
  return error;
40399
39506
  }
39507
+ function resolveLocation(path, sourceContext) {
39508
+ var _a;
39509
+ if (sourceContext === void 0) {
39510
+ return void 0;
39511
+ }
39512
+ return {
39513
+ source: sourceContext.source,
39514
+ range: (_a = sourceContext.getLocationForJsonPath(path)) === null || _a === void 0 ? void 0 : _a.range
39515
+ };
39516
+ }
39517
+ function enrichWithLocation(error, sourceContext) {
39518
+ if (sourceContext === void 0 || error.source !== void 0 || error.range !== void 0) {
39519
+ return error;
39520
+ }
39521
+ return new RulesetValidationError(error.code, error.message, error.path, resolveLocation(error.path, sourceContext));
39522
+ }
40400
39523
  function inferErrorCode(path, keyword) {
40401
39524
  if (path.length === 0) {
40402
39525
  return "generic-validation-error";
@@ -45917,17 +45040,17 @@ var require_assertions = __commonJS({
45917
45040
  var ajv_1 = require_ajv();
45918
45041
  var errors_1 = require_errors();
45919
45042
  var es_aggregate_error_1 = (0, tslib_1.__importDefault)(require_es_aggregate_error());
45920
- function assertValidRuleset(ruleset2, format2 = "js") {
45921
- var _a;
45043
+ function assertValidRuleset(ruleset2, format2 = "js", sourceContext) {
45044
+ var _a, _b;
45922
45045
  if (!(0, json_1.isPlainObject)(ruleset2)) {
45923
- throw new errors_1.RulesetValidationError("invalid-ruleset-definition", "Provided ruleset is not an object", []);
45046
+ throw new errors_1.RulesetValidationError("invalid-ruleset-definition", "Provided ruleset is not an object", [], sourceContext === void 0 ? void 0 : { source: sourceContext.source });
45924
45047
  }
45925
45048
  if (!("rules" in ruleset2) && !("extends" in ruleset2) && !("overrides" in ruleset2)) {
45926
- throw new errors_1.RulesetValidationError("invalid-ruleset-definition", "Ruleset must have rules or extends or overrides defined", []);
45049
+ throw new errors_1.RulesetValidationError("invalid-ruleset-definition", "Ruleset must have rules or extends or overrides defined", [], sourceContext === void 0 ? void 0 : { source: sourceContext.source, range: (_a = sourceContext.getLocationForJsonPath([])) === null || _a === void 0 ? void 0 : _a.range });
45927
45050
  }
45928
45051
  const validate = (0, ajv_1.createValidator)(format2);
45929
45052
  if (!validate(ruleset2)) {
45930
- throw new es_aggregate_error_1.default((0, errors_1.convertAjvErrors)((_a = validate.errors) !== null && _a !== void 0 ? _a : []));
45053
+ throw new es_aggregate_error_1.default((0, errors_1.convertAjvErrors)((_b = validate.errors) !== null && _b !== void 0 ? _b : [], sourceContext));
45931
45054
  }
45932
45055
  }
45933
45056
  exports.assertValidRuleset = assertValidRuleset;
@@ -46074,7 +45197,7 @@ var require_ruleset = __commonJS({
46074
45197
  var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
46075
45198
  var path_1 = (init_index_es(), __toCommonJS(index_es_exports));
46076
45199
  var json_1 = (init_index_es2(), __toCommonJS(index_es_exports2));
46077
- var minimatch_1 = require_minimatch2();
45200
+ var minimatch_1 = require_minimatch();
46078
45201
  var rule_1 = require_rule();
46079
45202
  var index_1 = require_validation();
46080
45203
  var rules_1 = require_rules();
@@ -46097,10 +45220,10 @@ var require_ruleset = __commonJS({
46097
45220
  let definition;
46098
45221
  if ((0, json_1.isPlainObject)(maybeDefinition) && "extends" in maybeDefinition) {
46099
45222
  const { extends: _2, ...def } = maybeDefinition;
46100
- (0, index_1.assertValidRuleset)({ extends: [], ...def }, "js");
45223
+ (0, index_1.assertValidRuleset)({ extends: [], ...def }, "js", context === null || context === void 0 ? void 0 : context.sourceContext);
46101
45224
  definition = maybeDefinition;
46102
45225
  } else {
46103
- (0, index_1.assertValidRuleset)(maybeDefinition, "js");
45226
+ (0, index_1.assertValidRuleset)(maybeDefinition, "js", context === null || context === void 0 ? void 0 : context.sourceContext);
46104
45227
  definition = maybeDefinition;
46105
45228
  }
46106
45229
  this.definition = definition;
@@ -55121,6 +54244,9 @@ var AuditConfigSchema = z19.object({
55121
54244
  temperature: z19.number().min(0).max(2).optional(),
55122
54245
  cache_dir: z19.string().optional()
55123
54246
  }).optional();
54247
+ var ArtifactCoverageConfigSchema = z19.object({
54248
+ exclude_patterns: z19.array(z19.string()).default([])
54249
+ }).optional();
55124
54250
  var AgentContractsConfigSchema = z19.object({
55125
54251
  dsl: z19.string().optional(),
55126
54252
  vars: z19.record(z19.string(), z19.string()).optional(),
@@ -55129,7 +54255,8 @@ var AgentContractsConfigSchema = z19.object({
55129
54255
  active_guardrail_policy: z19.string().optional(),
55130
54256
  paths: z19.record(z19.string(), z19.string()).optional(),
55131
54257
  teams: z19.record(z19.string(), TeamConfigSchema).optional(),
55132
- audit: AuditConfigSchema
54258
+ audit: AuditConfigSchema,
54259
+ artifact_coverage: ArtifactCoverageConfigSchema
55133
54260
  }).superRefine((data, ctx) => {
55134
54261
  if (data.dsl !== void 0 && data.teams !== void 0) {
55135
54262
  ctx.addIssue({
@@ -55257,7 +54384,8 @@ ${issues}`,
55257
54384
  activeGuardrailPolicy: void 0,
55258
54385
  paths: void 0,
55259
54386
  teams: resolveTeamConfigs(config.teams, configDir),
55260
- audit: config.audit ?? void 0
54387
+ audit: config.audit ?? void 0,
54388
+ artifactCoverage: config.artifact_coverage ?? void 0
55261
54389
  };
55262
54390
  }
55263
54391
  return {
@@ -55268,7 +54396,8 @@ ${issues}`,
55268
54396
  bindings: (config.bindings ?? []).map((b3) => resolve5(configDir, b3)),
55269
54397
  activeGuardrailPolicy: config.active_guardrail_policy,
55270
54398
  paths: config.paths,
55271
- audit: config.audit ?? void 0
54399
+ audit: config.audit ?? void 0,
54400
+ artifactCoverage: config.artifact_coverage ?? void 0
55272
54401
  };
55273
54402
  }
55274
54403
  function resolveDslPath(dirArg, dirArgDefault, config) {
@@ -57044,6 +56173,155 @@ function resolveBindingRenderOutputPath(output, paths) {
57044
56173
  return value !== void 0 ? value : match;
57045
56174
  });
57046
56175
  }
56176
+
56177
+ // src/artifact-coverage/enumerator.ts
56178
+ import { execSync } from "child_process";
56179
+ import { readdirSync } from "fs";
56180
+ import { join as join3 } from "path";
56181
+ import { minimatch } from "minimatch";
56182
+ function enumerateProjectFiles(cwd, excludePatterns) {
56183
+ const filePaths = listFiles(cwd);
56184
+ if (excludePatterns.length === 0) {
56185
+ return filePaths;
56186
+ }
56187
+ return filePaths.filter(
56188
+ (f2) => !excludePatterns.some((p2) => minimatch(f2, p2, { dot: true }))
56189
+ );
56190
+ }
56191
+ function listFiles(cwd) {
56192
+ try {
56193
+ const output = execSync("git ls-files", {
56194
+ encoding: "utf-8",
56195
+ cwd
56196
+ });
56197
+ return output.trim().split("\n").filter(Boolean);
56198
+ } catch {
56199
+ return walkDir(cwd, cwd);
56200
+ }
56201
+ }
56202
+ var IGNORE_DIRS = /* @__PURE__ */ new Set(["node_modules", ".git", "dist", ".next", "coverage"]);
56203
+ function walkDir(root, dir) {
56204
+ const results = [];
56205
+ for (const entry of readdirSync(dir, { withFileTypes: true })) {
56206
+ if (entry.isDirectory()) {
56207
+ if (IGNORE_DIRS.has(entry.name)) continue;
56208
+ results.push(...walkDir(root, join3(dir, entry.name)));
56209
+ } else {
56210
+ const rel = join3(dir, entry.name).slice(root.length + 1).replace(/\\/g, "/");
56211
+ results.push(rel);
56212
+ }
56213
+ }
56214
+ return results;
56215
+ }
56216
+
56217
+ // src/artifact-coverage/matcher.ts
56218
+ import { minimatch as minimatch2 } from "minimatch";
56219
+ function matchFileToArtifacts(filePath, artifacts) {
56220
+ const normalized = filePath.replace(/\\/g, "/");
56221
+ return Object.entries(artifacts).filter(([, art]) => {
56222
+ const included = art.path_patterns.some(
56223
+ (p2) => minimatch2(normalized, p2, { dot: true })
56224
+ );
56225
+ if (!included) return false;
56226
+ if (art.exclude_patterns.length === 0) return true;
56227
+ return !art.exclude_patterns.some(
56228
+ (p2) => minimatch2(normalized, p2, { dot: true })
56229
+ );
56230
+ }).map(([id]) => id);
56231
+ }
56232
+
56233
+ // src/artifact-coverage/reporter.ts
56234
+ function buildCoverageReport(files, artifacts) {
56235
+ const uncovered = [];
56236
+ const overlapping = [];
56237
+ const artifactHits = {};
56238
+ for (const id of Object.keys(artifacts)) {
56239
+ artifactHits[id] = 0;
56240
+ }
56241
+ for (const file of files) {
56242
+ const matches = matchFileToArtifacts(file, artifacts);
56243
+ if (matches.length === 0) {
56244
+ uncovered.push(file);
56245
+ } else if (matches.length > 1) {
56246
+ overlapping.push({ path: file, artifacts: matches });
56247
+ }
56248
+ for (const id of matches) {
56249
+ artifactHits[id] = (artifactHits[id] ?? 0) + 1;
56250
+ }
56251
+ }
56252
+ const totalFiles = files.length;
56253
+ const coveredFiles = totalFiles - uncovered.length;
56254
+ const coveragePercent = totalFiles === 0 ? 100 : Math.round(coveredFiles / totalFiles * 1e3) / 10;
56255
+ const perArtifact = {};
56256
+ for (const [id, info] of Object.entries(artifacts)) {
56257
+ perArtifact[id] = {
56258
+ matched_files: artifactHits[id] ?? 0,
56259
+ patterns: info.path_patterns
56260
+ };
56261
+ }
56262
+ return {
56263
+ summary: {
56264
+ total_files: totalFiles,
56265
+ covered_files: coveredFiles,
56266
+ uncovered_files: uncovered.length,
56267
+ overlapping_files: overlapping.length,
56268
+ coverage_percent: coveragePercent
56269
+ },
56270
+ uncovered: uncovered.sort(),
56271
+ overlapping: overlapping.sort((a3, b3) => a3.path.localeCompare(b3.path)),
56272
+ per_artifact: perArtifact
56273
+ };
56274
+ }
56275
+ function formatCoverageText(report) {
56276
+ const { summary } = report;
56277
+ const lines = [];
56278
+ lines.push("=== Artifact Coverage ===");
56279
+ lines.push("");
56280
+ lines.push(`Total files: ${summary.total_files}`);
56281
+ lines.push(
56282
+ `Covered: ${summary.covered_files} (${summary.coverage_percent}%)`
56283
+ );
56284
+ lines.push(
56285
+ `Uncovered: ${summary.uncovered_files} (${(100 - summary.coverage_percent).toFixed(1)}%)`
56286
+ );
56287
+ lines.push(
56288
+ `Overlapping: ${summary.overlapping_files} (${summary.total_files === 0 ? 0 : (summary.overlapping_files / summary.total_files * 100).toFixed(1)}%)`
56289
+ );
56290
+ if (report.uncovered.length > 0) {
56291
+ const byDir = groupByDirectory(report.uncovered);
56292
+ lines.push("");
56293
+ lines.push("--- Uncovered files (by directory) ---");
56294
+ for (const [dir, count] of byDir.slice(0, 10)) {
56295
+ lines.push(`${dir.padEnd(20)} ${count} file${count > 1 ? "s" : ""}`);
56296
+ }
56297
+ if (byDir.length > 10) {
56298
+ lines.push(`... and ${byDir.length - 10} more directories`);
56299
+ }
56300
+ lines.push("");
56301
+ lines.push("--- Uncovered files ---");
56302
+ for (const f2 of report.uncovered) {
56303
+ lines.push(f2);
56304
+ }
56305
+ }
56306
+ if (report.overlapping.length > 0) {
56307
+ lines.push("");
56308
+ lines.push("--- Overlapping files ---");
56309
+ for (const o3 of report.overlapping) {
56310
+ lines.push(`${o3.path} [${o3.artifacts.join(", ")}]`);
56311
+ }
56312
+ }
56313
+ lines.push("");
56314
+ return lines.join("\n");
56315
+ }
56316
+ function groupByDirectory(files) {
56317
+ const dirs = {};
56318
+ for (const f2 of files) {
56319
+ const parts = f2.split("/");
56320
+ const dir = parts.length > 1 ? parts.slice(0, -1).join("/") + "/" : "./";
56321
+ dirs[dir] = (dirs[dir] ?? 0) + 1;
56322
+ }
56323
+ return Object.entries(dirs).sort((a3, b3) => b3[1] - a3[1]);
56324
+ }
57047
56325
  export {
57048
56326
  AgentContractsConfigSchema,
57049
56327
  AgentSchema,
@@ -57100,6 +56378,7 @@ export {
57100
56378
  XExtensionDeclSchema,
57101
56379
  buildArtifactContext,
57102
56380
  buildAuditContext,
56381
+ buildCoverageReport,
57103
56382
  buildGlobalContext,
57104
56383
  buildGuardrailContext,
57105
56384
  buildGuardrailPolicyContext,
@@ -57116,14 +56395,17 @@ export {
57116
56395
  checkDriftFromConfig,
57117
56396
  checkReferences,
57118
56397
  computeExitCode,
56398
+ enumerateProjectFiles,
57119
56399
  expandDefaults,
57120
56400
  formatAuditResult,
57121
56401
  formatAuditResults,
56402
+ formatCoverageText,
57122
56403
  generateGuardrails,
57123
56404
  lint,
57124
56405
  loadBindings,
57125
56406
  loadConfig,
57126
56407
  loadDsl,
56408
+ matchFileToArtifacts,
57127
56409
  mergeDsl,
57128
56410
  renderFromConfig,
57129
56411
  resolve3 as resolve,