@c4a/core 0.4.15-alpha.9 → 0.4.15-beta.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 (2) hide show
  1. package/index.js +1879 -1
  2. package/package.json +2 -1
package/index.js CHANGED
@@ -6978,6 +6978,1685 @@ var require_dist = __commonJS((exports) => {
6978
6978
  exports.visitAsync = visit.visitAsync;
6979
6979
  });
6980
6980
 
6981
+ // ../../node_modules/.bun/picomatch@4.0.4/node_modules/picomatch/lib/constants.js
6982
+ var require_constants = __commonJS((exports, module) => {
6983
+ var WIN_SLASH = "\\\\/";
6984
+ var WIN_NO_SLASH = `[^${WIN_SLASH}]`;
6985
+ var DEFAULT_MAX_EXTGLOB_RECURSION = 0;
6986
+ var DOT_LITERAL = "\\.";
6987
+ var PLUS_LITERAL = "\\+";
6988
+ var QMARK_LITERAL = "\\?";
6989
+ var SLASH_LITERAL = "\\/";
6990
+ var ONE_CHAR = "(?=.)";
6991
+ var QMARK = "[^/]";
6992
+ var END_ANCHOR = `(?:${SLASH_LITERAL}|$)`;
6993
+ var START_ANCHOR = `(?:^|${SLASH_LITERAL})`;
6994
+ var DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`;
6995
+ var NO_DOT = `(?!${DOT_LITERAL})`;
6996
+ var NO_DOTS = `(?!${START_ANCHOR}${DOTS_SLASH})`;
6997
+ var NO_DOT_SLASH = `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`;
6998
+ var NO_DOTS_SLASH = `(?!${DOTS_SLASH})`;
6999
+ var QMARK_NO_DOT = `[^.${SLASH_LITERAL}]`;
7000
+ var STAR = `${QMARK}*?`;
7001
+ var SEP = "/";
7002
+ var POSIX_CHARS = {
7003
+ DOT_LITERAL,
7004
+ PLUS_LITERAL,
7005
+ QMARK_LITERAL,
7006
+ SLASH_LITERAL,
7007
+ ONE_CHAR,
7008
+ QMARK,
7009
+ END_ANCHOR,
7010
+ DOTS_SLASH,
7011
+ NO_DOT,
7012
+ NO_DOTS,
7013
+ NO_DOT_SLASH,
7014
+ NO_DOTS_SLASH,
7015
+ QMARK_NO_DOT,
7016
+ STAR,
7017
+ START_ANCHOR,
7018
+ SEP
7019
+ };
7020
+ var WINDOWS_CHARS = {
7021
+ ...POSIX_CHARS,
7022
+ SLASH_LITERAL: `[${WIN_SLASH}]`,
7023
+ QMARK: WIN_NO_SLASH,
7024
+ STAR: `${WIN_NO_SLASH}*?`,
7025
+ DOTS_SLASH: `${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`,
7026
+ NO_DOT: `(?!${DOT_LITERAL})`,
7027
+ NO_DOTS: `(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
7028
+ NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}(?:[${WIN_SLASH}]|$))`,
7029
+ NO_DOTS_SLASH: `(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
7030
+ QMARK_NO_DOT: `[^.${WIN_SLASH}]`,
7031
+ START_ANCHOR: `(?:^|[${WIN_SLASH}])`,
7032
+ END_ANCHOR: `(?:[${WIN_SLASH}]|$)`,
7033
+ SEP: "\\"
7034
+ };
7035
+ var POSIX_REGEX_SOURCE = {
7036
+ __proto__: null,
7037
+ alnum: "a-zA-Z0-9",
7038
+ alpha: "a-zA-Z",
7039
+ ascii: "\\x00-\\x7F",
7040
+ blank: " \\t",
7041
+ cntrl: "\\x00-\\x1F\\x7F",
7042
+ digit: "0-9",
7043
+ graph: "\\x21-\\x7E",
7044
+ lower: "a-z",
7045
+ print: "\\x20-\\x7E ",
7046
+ punct: "\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",
7047
+ space: " \\t\\r\\n\\v\\f",
7048
+ upper: "A-Z",
7049
+ word: "A-Za-z0-9_",
7050
+ xdigit: "A-Fa-f0-9"
7051
+ };
7052
+ module.exports = {
7053
+ DEFAULT_MAX_EXTGLOB_RECURSION,
7054
+ MAX_LENGTH: 1024 * 64,
7055
+ POSIX_REGEX_SOURCE,
7056
+ REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g,
7057
+ REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/,
7058
+ REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/,
7059
+ REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g,
7060
+ REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g,
7061
+ REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g,
7062
+ REPLACEMENTS: {
7063
+ __proto__: null,
7064
+ "***": "*",
7065
+ "**/**": "**",
7066
+ "**/**/**": "**"
7067
+ },
7068
+ CHAR_0: 48,
7069
+ CHAR_9: 57,
7070
+ CHAR_UPPERCASE_A: 65,
7071
+ CHAR_LOWERCASE_A: 97,
7072
+ CHAR_UPPERCASE_Z: 90,
7073
+ CHAR_LOWERCASE_Z: 122,
7074
+ CHAR_LEFT_PARENTHESES: 40,
7075
+ CHAR_RIGHT_PARENTHESES: 41,
7076
+ CHAR_ASTERISK: 42,
7077
+ CHAR_AMPERSAND: 38,
7078
+ CHAR_AT: 64,
7079
+ CHAR_BACKWARD_SLASH: 92,
7080
+ CHAR_CARRIAGE_RETURN: 13,
7081
+ CHAR_CIRCUMFLEX_ACCENT: 94,
7082
+ CHAR_COLON: 58,
7083
+ CHAR_COMMA: 44,
7084
+ CHAR_DOT: 46,
7085
+ CHAR_DOUBLE_QUOTE: 34,
7086
+ CHAR_EQUAL: 61,
7087
+ CHAR_EXCLAMATION_MARK: 33,
7088
+ CHAR_FORM_FEED: 12,
7089
+ CHAR_FORWARD_SLASH: 47,
7090
+ CHAR_GRAVE_ACCENT: 96,
7091
+ CHAR_HASH: 35,
7092
+ CHAR_HYPHEN_MINUS: 45,
7093
+ CHAR_LEFT_ANGLE_BRACKET: 60,
7094
+ CHAR_LEFT_CURLY_BRACE: 123,
7095
+ CHAR_LEFT_SQUARE_BRACKET: 91,
7096
+ CHAR_LINE_FEED: 10,
7097
+ CHAR_NO_BREAK_SPACE: 160,
7098
+ CHAR_PERCENT: 37,
7099
+ CHAR_PLUS: 43,
7100
+ CHAR_QUESTION_MARK: 63,
7101
+ CHAR_RIGHT_ANGLE_BRACKET: 62,
7102
+ CHAR_RIGHT_CURLY_BRACE: 125,
7103
+ CHAR_RIGHT_SQUARE_BRACKET: 93,
7104
+ CHAR_SEMICOLON: 59,
7105
+ CHAR_SINGLE_QUOTE: 39,
7106
+ CHAR_SPACE: 32,
7107
+ CHAR_TAB: 9,
7108
+ CHAR_UNDERSCORE: 95,
7109
+ CHAR_VERTICAL_LINE: 124,
7110
+ CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279,
7111
+ extglobChars(chars) {
7112
+ return {
7113
+ "!": { type: "negate", open: "(?:(?!(?:", close: `))${chars.STAR})` },
7114
+ "?": { type: "qmark", open: "(?:", close: ")?" },
7115
+ "+": { type: "plus", open: "(?:", close: ")+" },
7116
+ "*": { type: "star", open: "(?:", close: ")*" },
7117
+ "@": { type: "at", open: "(?:", close: ")" }
7118
+ };
7119
+ },
7120
+ globChars(win32) {
7121
+ return win32 === true ? WINDOWS_CHARS : POSIX_CHARS;
7122
+ }
7123
+ };
7124
+ });
7125
+
7126
+ // ../../node_modules/.bun/picomatch@4.0.4/node_modules/picomatch/lib/utils.js
7127
+ var require_utils = __commonJS((exports) => {
7128
+ var {
7129
+ REGEX_BACKSLASH,
7130
+ REGEX_REMOVE_BACKSLASH,
7131
+ REGEX_SPECIAL_CHARS,
7132
+ REGEX_SPECIAL_CHARS_GLOBAL
7133
+ } = require_constants();
7134
+ exports.isObject = (val) => val !== null && typeof val === "object" && !Array.isArray(val);
7135
+ exports.hasRegexChars = (str) => REGEX_SPECIAL_CHARS.test(str);
7136
+ exports.isRegexChar = (str) => str.length === 1 && exports.hasRegexChars(str);
7137
+ exports.escapeRegex = (str) => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, "\\$1");
7138
+ exports.toPosixSlashes = (str) => str.replace(REGEX_BACKSLASH, "/");
7139
+ exports.isWindows = () => {
7140
+ if (typeof navigator !== "undefined" && navigator.platform) {
7141
+ const platform = navigator.platform.toLowerCase();
7142
+ return platform === "win32" || platform === "windows";
7143
+ }
7144
+ if (typeof process !== "undefined" && process.platform) {
7145
+ return process.platform === "win32";
7146
+ }
7147
+ return false;
7148
+ };
7149
+ exports.removeBackslashes = (str) => {
7150
+ return str.replace(REGEX_REMOVE_BACKSLASH, (match) => {
7151
+ return match === "\\" ? "" : match;
7152
+ });
7153
+ };
7154
+ exports.escapeLast = (input, char, lastIdx) => {
7155
+ const idx = input.lastIndexOf(char, lastIdx);
7156
+ if (idx === -1)
7157
+ return input;
7158
+ if (input[idx - 1] === "\\")
7159
+ return exports.escapeLast(input, char, idx - 1);
7160
+ return `${input.slice(0, idx)}\\${input.slice(idx)}`;
7161
+ };
7162
+ exports.removePrefix = (input, state = {}) => {
7163
+ let output = input;
7164
+ if (output.startsWith("./")) {
7165
+ output = output.slice(2);
7166
+ state.prefix = "./";
7167
+ }
7168
+ return output;
7169
+ };
7170
+ exports.wrapOutput = (input, state = {}, options = {}) => {
7171
+ const prepend = options.contains ? "" : "^";
7172
+ const append = options.contains ? "" : "$";
7173
+ let output = `${prepend}(?:${input})${append}`;
7174
+ if (state.negated === true) {
7175
+ output = `(?:^(?!${output}).*$)`;
7176
+ }
7177
+ return output;
7178
+ };
7179
+ exports.basename = (path2, { windows } = {}) => {
7180
+ const segs = path2.split(windows ? /[\\/]/ : "/");
7181
+ const last = segs[segs.length - 1];
7182
+ if (last === "") {
7183
+ return segs[segs.length - 2];
7184
+ }
7185
+ return last;
7186
+ };
7187
+ });
7188
+
7189
+ // ../../node_modules/.bun/picomatch@4.0.4/node_modules/picomatch/lib/scan.js
7190
+ var require_scan = __commonJS((exports, module) => {
7191
+ var utils = require_utils();
7192
+ var {
7193
+ CHAR_ASTERISK,
7194
+ CHAR_AT,
7195
+ CHAR_BACKWARD_SLASH,
7196
+ CHAR_COMMA,
7197
+ CHAR_DOT,
7198
+ CHAR_EXCLAMATION_MARK,
7199
+ CHAR_FORWARD_SLASH,
7200
+ CHAR_LEFT_CURLY_BRACE,
7201
+ CHAR_LEFT_PARENTHESES,
7202
+ CHAR_LEFT_SQUARE_BRACKET,
7203
+ CHAR_PLUS,
7204
+ CHAR_QUESTION_MARK,
7205
+ CHAR_RIGHT_CURLY_BRACE,
7206
+ CHAR_RIGHT_PARENTHESES,
7207
+ CHAR_RIGHT_SQUARE_BRACKET
7208
+ } = require_constants();
7209
+ var isPathSeparator = (code) => {
7210
+ return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH;
7211
+ };
7212
+ var depth = (token) => {
7213
+ if (token.isPrefix !== true) {
7214
+ token.depth = token.isGlobstar ? Infinity : 1;
7215
+ }
7216
+ };
7217
+ var scan = (input, options) => {
7218
+ const opts = options || {};
7219
+ const length = input.length - 1;
7220
+ const scanToEnd = opts.parts === true || opts.scanToEnd === true;
7221
+ const slashes = [];
7222
+ const tokens = [];
7223
+ const parts = [];
7224
+ let str = input;
7225
+ let index = -1;
7226
+ let start = 0;
7227
+ let lastIndex = 0;
7228
+ let isBrace = false;
7229
+ let isBracket = false;
7230
+ let isGlob = false;
7231
+ let isExtglob = false;
7232
+ let isGlobstar = false;
7233
+ let braceEscaped = false;
7234
+ let backslashes = false;
7235
+ let negated = false;
7236
+ let negatedExtglob = false;
7237
+ let finished = false;
7238
+ let braces = 0;
7239
+ let prev;
7240
+ let code;
7241
+ let token = { value: "", depth: 0, isGlob: false };
7242
+ const eos = () => index >= length;
7243
+ const peek = () => str.charCodeAt(index + 1);
7244
+ const advance = () => {
7245
+ prev = code;
7246
+ return str.charCodeAt(++index);
7247
+ };
7248
+ while (index < length) {
7249
+ code = advance();
7250
+ let next;
7251
+ if (code === CHAR_BACKWARD_SLASH) {
7252
+ backslashes = token.backslashes = true;
7253
+ code = advance();
7254
+ if (code === CHAR_LEFT_CURLY_BRACE) {
7255
+ braceEscaped = true;
7256
+ }
7257
+ continue;
7258
+ }
7259
+ if (braceEscaped === true || code === CHAR_LEFT_CURLY_BRACE) {
7260
+ braces++;
7261
+ while (eos() !== true && (code = advance())) {
7262
+ if (code === CHAR_BACKWARD_SLASH) {
7263
+ backslashes = token.backslashes = true;
7264
+ advance();
7265
+ continue;
7266
+ }
7267
+ if (code === CHAR_LEFT_CURLY_BRACE) {
7268
+ braces++;
7269
+ continue;
7270
+ }
7271
+ if (braceEscaped !== true && code === CHAR_DOT && (code = advance()) === CHAR_DOT) {
7272
+ isBrace = token.isBrace = true;
7273
+ isGlob = token.isGlob = true;
7274
+ finished = true;
7275
+ if (scanToEnd === true) {
7276
+ continue;
7277
+ }
7278
+ break;
7279
+ }
7280
+ if (braceEscaped !== true && code === CHAR_COMMA) {
7281
+ isBrace = token.isBrace = true;
7282
+ isGlob = token.isGlob = true;
7283
+ finished = true;
7284
+ if (scanToEnd === true) {
7285
+ continue;
7286
+ }
7287
+ break;
7288
+ }
7289
+ if (code === CHAR_RIGHT_CURLY_BRACE) {
7290
+ braces--;
7291
+ if (braces === 0) {
7292
+ braceEscaped = false;
7293
+ isBrace = token.isBrace = true;
7294
+ finished = true;
7295
+ break;
7296
+ }
7297
+ }
7298
+ }
7299
+ if (scanToEnd === true) {
7300
+ continue;
7301
+ }
7302
+ break;
7303
+ }
7304
+ if (code === CHAR_FORWARD_SLASH) {
7305
+ slashes.push(index);
7306
+ tokens.push(token);
7307
+ token = { value: "", depth: 0, isGlob: false };
7308
+ if (finished === true)
7309
+ continue;
7310
+ if (prev === CHAR_DOT && index === start + 1) {
7311
+ start += 2;
7312
+ continue;
7313
+ }
7314
+ lastIndex = index + 1;
7315
+ continue;
7316
+ }
7317
+ if (opts.noext !== true) {
7318
+ const isExtglobChar = code === CHAR_PLUS || code === CHAR_AT || code === CHAR_ASTERISK || code === CHAR_QUESTION_MARK || code === CHAR_EXCLAMATION_MARK;
7319
+ if (isExtglobChar === true && peek() === CHAR_LEFT_PARENTHESES) {
7320
+ isGlob = token.isGlob = true;
7321
+ isExtglob = token.isExtglob = true;
7322
+ finished = true;
7323
+ if (code === CHAR_EXCLAMATION_MARK && index === start) {
7324
+ negatedExtglob = true;
7325
+ }
7326
+ if (scanToEnd === true) {
7327
+ while (eos() !== true && (code = advance())) {
7328
+ if (code === CHAR_BACKWARD_SLASH) {
7329
+ backslashes = token.backslashes = true;
7330
+ code = advance();
7331
+ continue;
7332
+ }
7333
+ if (code === CHAR_RIGHT_PARENTHESES) {
7334
+ isGlob = token.isGlob = true;
7335
+ finished = true;
7336
+ break;
7337
+ }
7338
+ }
7339
+ continue;
7340
+ }
7341
+ break;
7342
+ }
7343
+ }
7344
+ if (code === CHAR_ASTERISK) {
7345
+ if (prev === CHAR_ASTERISK)
7346
+ isGlobstar = token.isGlobstar = true;
7347
+ isGlob = token.isGlob = true;
7348
+ finished = true;
7349
+ if (scanToEnd === true) {
7350
+ continue;
7351
+ }
7352
+ break;
7353
+ }
7354
+ if (code === CHAR_QUESTION_MARK) {
7355
+ isGlob = token.isGlob = true;
7356
+ finished = true;
7357
+ if (scanToEnd === true) {
7358
+ continue;
7359
+ }
7360
+ break;
7361
+ }
7362
+ if (code === CHAR_LEFT_SQUARE_BRACKET) {
7363
+ while (eos() !== true && (next = advance())) {
7364
+ if (next === CHAR_BACKWARD_SLASH) {
7365
+ backslashes = token.backslashes = true;
7366
+ advance();
7367
+ continue;
7368
+ }
7369
+ if (next === CHAR_RIGHT_SQUARE_BRACKET) {
7370
+ isBracket = token.isBracket = true;
7371
+ isGlob = token.isGlob = true;
7372
+ finished = true;
7373
+ break;
7374
+ }
7375
+ }
7376
+ if (scanToEnd === true) {
7377
+ continue;
7378
+ }
7379
+ break;
7380
+ }
7381
+ if (opts.nonegate !== true && code === CHAR_EXCLAMATION_MARK && index === start) {
7382
+ negated = token.negated = true;
7383
+ start++;
7384
+ continue;
7385
+ }
7386
+ if (opts.noparen !== true && code === CHAR_LEFT_PARENTHESES) {
7387
+ isGlob = token.isGlob = true;
7388
+ if (scanToEnd === true) {
7389
+ while (eos() !== true && (code = advance())) {
7390
+ if (code === CHAR_LEFT_PARENTHESES) {
7391
+ backslashes = token.backslashes = true;
7392
+ code = advance();
7393
+ continue;
7394
+ }
7395
+ if (code === CHAR_RIGHT_PARENTHESES) {
7396
+ finished = true;
7397
+ break;
7398
+ }
7399
+ }
7400
+ continue;
7401
+ }
7402
+ break;
7403
+ }
7404
+ if (isGlob === true) {
7405
+ finished = true;
7406
+ if (scanToEnd === true) {
7407
+ continue;
7408
+ }
7409
+ break;
7410
+ }
7411
+ }
7412
+ if (opts.noext === true) {
7413
+ isExtglob = false;
7414
+ isGlob = false;
7415
+ }
7416
+ let base2 = str;
7417
+ let prefix = "";
7418
+ let glob = "";
7419
+ if (start > 0) {
7420
+ prefix = str.slice(0, start);
7421
+ str = str.slice(start);
7422
+ lastIndex -= start;
7423
+ }
7424
+ if (base2 && isGlob === true && lastIndex > 0) {
7425
+ base2 = str.slice(0, lastIndex);
7426
+ glob = str.slice(lastIndex);
7427
+ } else if (isGlob === true) {
7428
+ base2 = "";
7429
+ glob = str;
7430
+ } else {
7431
+ base2 = str;
7432
+ }
7433
+ if (base2 && base2 !== "" && base2 !== "/" && base2 !== str) {
7434
+ if (isPathSeparator(base2.charCodeAt(base2.length - 1))) {
7435
+ base2 = base2.slice(0, -1);
7436
+ }
7437
+ }
7438
+ if (opts.unescape === true) {
7439
+ if (glob)
7440
+ glob = utils.removeBackslashes(glob);
7441
+ if (base2 && backslashes === true) {
7442
+ base2 = utils.removeBackslashes(base2);
7443
+ }
7444
+ }
7445
+ const state = {
7446
+ prefix,
7447
+ input,
7448
+ start,
7449
+ base: base2,
7450
+ glob,
7451
+ isBrace,
7452
+ isBracket,
7453
+ isGlob,
7454
+ isExtglob,
7455
+ isGlobstar,
7456
+ negated,
7457
+ negatedExtglob
7458
+ };
7459
+ if (opts.tokens === true) {
7460
+ state.maxDepth = 0;
7461
+ if (!isPathSeparator(code)) {
7462
+ tokens.push(token);
7463
+ }
7464
+ state.tokens = tokens;
7465
+ }
7466
+ if (opts.parts === true || opts.tokens === true) {
7467
+ let prevIndex;
7468
+ for (let idx = 0;idx < slashes.length; idx++) {
7469
+ const n = prevIndex ? prevIndex + 1 : start;
7470
+ const i = slashes[idx];
7471
+ const value = input.slice(n, i);
7472
+ if (opts.tokens) {
7473
+ if (idx === 0 && start !== 0) {
7474
+ tokens[idx].isPrefix = true;
7475
+ tokens[idx].value = prefix;
7476
+ } else {
7477
+ tokens[idx].value = value;
7478
+ }
7479
+ depth(tokens[idx]);
7480
+ state.maxDepth += tokens[idx].depth;
7481
+ }
7482
+ if (idx !== 0 || value !== "") {
7483
+ parts.push(value);
7484
+ }
7485
+ prevIndex = i;
7486
+ }
7487
+ if (prevIndex && prevIndex + 1 < input.length) {
7488
+ const value = input.slice(prevIndex + 1);
7489
+ parts.push(value);
7490
+ if (opts.tokens) {
7491
+ tokens[tokens.length - 1].value = value;
7492
+ depth(tokens[tokens.length - 1]);
7493
+ state.maxDepth += tokens[tokens.length - 1].depth;
7494
+ }
7495
+ }
7496
+ state.slashes = slashes;
7497
+ state.parts = parts;
7498
+ }
7499
+ return state;
7500
+ };
7501
+ module.exports = scan;
7502
+ });
7503
+
7504
+ // ../../node_modules/.bun/picomatch@4.0.4/node_modules/picomatch/lib/parse.js
7505
+ var require_parse = __commonJS((exports, module) => {
7506
+ var constants = require_constants();
7507
+ var utils = require_utils();
7508
+ var {
7509
+ MAX_LENGTH,
7510
+ POSIX_REGEX_SOURCE,
7511
+ REGEX_NON_SPECIAL_CHARS,
7512
+ REGEX_SPECIAL_CHARS_BACKREF,
7513
+ REPLACEMENTS
7514
+ } = constants;
7515
+ var expandRange = (args, options) => {
7516
+ if (typeof options.expandRange === "function") {
7517
+ return options.expandRange(...args, options);
7518
+ }
7519
+ args.sort();
7520
+ const value = `[${args.join("-")}]`;
7521
+ try {
7522
+ new RegExp(value);
7523
+ } catch (ex) {
7524
+ return args.map((v) => utils.escapeRegex(v)).join("..");
7525
+ }
7526
+ return value;
7527
+ };
7528
+ var syntaxError = (type, char) => {
7529
+ return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
7530
+ };
7531
+ var splitTopLevel = (input) => {
7532
+ const parts = [];
7533
+ let bracket = 0;
7534
+ let paren = 0;
7535
+ let quote = 0;
7536
+ let value = "";
7537
+ let escaped = false;
7538
+ for (const ch of input) {
7539
+ if (escaped === true) {
7540
+ value += ch;
7541
+ escaped = false;
7542
+ continue;
7543
+ }
7544
+ if (ch === "\\") {
7545
+ value += ch;
7546
+ escaped = true;
7547
+ continue;
7548
+ }
7549
+ if (ch === '"') {
7550
+ quote = quote === 1 ? 0 : 1;
7551
+ value += ch;
7552
+ continue;
7553
+ }
7554
+ if (quote === 0) {
7555
+ if (ch === "[") {
7556
+ bracket++;
7557
+ } else if (ch === "]" && bracket > 0) {
7558
+ bracket--;
7559
+ } else if (bracket === 0) {
7560
+ if (ch === "(") {
7561
+ paren++;
7562
+ } else if (ch === ")" && paren > 0) {
7563
+ paren--;
7564
+ } else if (ch === "|" && paren === 0) {
7565
+ parts.push(value);
7566
+ value = "";
7567
+ continue;
7568
+ }
7569
+ }
7570
+ }
7571
+ value += ch;
7572
+ }
7573
+ parts.push(value);
7574
+ return parts;
7575
+ };
7576
+ var isPlainBranch = (branch) => {
7577
+ let escaped = false;
7578
+ for (const ch of branch) {
7579
+ if (escaped === true) {
7580
+ escaped = false;
7581
+ continue;
7582
+ }
7583
+ if (ch === "\\") {
7584
+ escaped = true;
7585
+ continue;
7586
+ }
7587
+ if (/[?*+@!()[\]{}]/.test(ch)) {
7588
+ return false;
7589
+ }
7590
+ }
7591
+ return true;
7592
+ };
7593
+ var normalizeSimpleBranch = (branch) => {
7594
+ let value = branch.trim();
7595
+ let changed = true;
7596
+ while (changed === true) {
7597
+ changed = false;
7598
+ if (/^@\([^\\()[\]{}|]+\)$/.test(value)) {
7599
+ value = value.slice(2, -1);
7600
+ changed = true;
7601
+ }
7602
+ }
7603
+ if (!isPlainBranch(value)) {
7604
+ return;
7605
+ }
7606
+ return value.replace(/\\(.)/g, "$1");
7607
+ };
7608
+ var hasRepeatedCharPrefixOverlap = (branches) => {
7609
+ const values = branches.map(normalizeSimpleBranch).filter(Boolean);
7610
+ for (let i = 0;i < values.length; i++) {
7611
+ for (let j = i + 1;j < values.length; j++) {
7612
+ const a = values[i];
7613
+ const b = values[j];
7614
+ const char = a[0];
7615
+ if (!char || a !== char.repeat(a.length) || b !== char.repeat(b.length)) {
7616
+ continue;
7617
+ }
7618
+ if (a === b || a.startsWith(b) || b.startsWith(a)) {
7619
+ return true;
7620
+ }
7621
+ }
7622
+ }
7623
+ return false;
7624
+ };
7625
+ var parseRepeatedExtglob = (pattern, requireEnd = true) => {
7626
+ if (pattern[0] !== "+" && pattern[0] !== "*" || pattern[1] !== "(") {
7627
+ return;
7628
+ }
7629
+ let bracket = 0;
7630
+ let paren = 0;
7631
+ let quote = 0;
7632
+ let escaped = false;
7633
+ for (let i = 1;i < pattern.length; i++) {
7634
+ const ch = pattern[i];
7635
+ if (escaped === true) {
7636
+ escaped = false;
7637
+ continue;
7638
+ }
7639
+ if (ch === "\\") {
7640
+ escaped = true;
7641
+ continue;
7642
+ }
7643
+ if (ch === '"') {
7644
+ quote = quote === 1 ? 0 : 1;
7645
+ continue;
7646
+ }
7647
+ if (quote === 1) {
7648
+ continue;
7649
+ }
7650
+ if (ch === "[") {
7651
+ bracket++;
7652
+ continue;
7653
+ }
7654
+ if (ch === "]" && bracket > 0) {
7655
+ bracket--;
7656
+ continue;
7657
+ }
7658
+ if (bracket > 0) {
7659
+ continue;
7660
+ }
7661
+ if (ch === "(") {
7662
+ paren++;
7663
+ continue;
7664
+ }
7665
+ if (ch === ")") {
7666
+ paren--;
7667
+ if (paren === 0) {
7668
+ if (requireEnd === true && i !== pattern.length - 1) {
7669
+ return;
7670
+ }
7671
+ return {
7672
+ type: pattern[0],
7673
+ body: pattern.slice(2, i),
7674
+ end: i
7675
+ };
7676
+ }
7677
+ }
7678
+ }
7679
+ };
7680
+ var getStarExtglobSequenceOutput = (pattern) => {
7681
+ let index = 0;
7682
+ const chars = [];
7683
+ while (index < pattern.length) {
7684
+ const match = parseRepeatedExtglob(pattern.slice(index), false);
7685
+ if (!match || match.type !== "*") {
7686
+ return;
7687
+ }
7688
+ const branches = splitTopLevel(match.body).map((branch2) => branch2.trim());
7689
+ if (branches.length !== 1) {
7690
+ return;
7691
+ }
7692
+ const branch = normalizeSimpleBranch(branches[0]);
7693
+ if (!branch || branch.length !== 1) {
7694
+ return;
7695
+ }
7696
+ chars.push(branch);
7697
+ index += match.end + 1;
7698
+ }
7699
+ if (chars.length < 1) {
7700
+ return;
7701
+ }
7702
+ const source2 = chars.length === 1 ? utils.escapeRegex(chars[0]) : `[${chars.map((ch) => utils.escapeRegex(ch)).join("")}]`;
7703
+ return `${source2}*`;
7704
+ };
7705
+ var repeatedExtglobRecursion = (pattern) => {
7706
+ let depth = 0;
7707
+ let value = pattern.trim();
7708
+ let match = parseRepeatedExtglob(value);
7709
+ while (match) {
7710
+ depth++;
7711
+ value = match.body.trim();
7712
+ match = parseRepeatedExtglob(value);
7713
+ }
7714
+ return depth;
7715
+ };
7716
+ var analyzeRepeatedExtglob = (body, options) => {
7717
+ if (options.maxExtglobRecursion === false) {
7718
+ return { risky: false };
7719
+ }
7720
+ const max = typeof options.maxExtglobRecursion === "number" ? options.maxExtglobRecursion : constants.DEFAULT_MAX_EXTGLOB_RECURSION;
7721
+ const branches = splitTopLevel(body).map((branch) => branch.trim());
7722
+ if (branches.length > 1) {
7723
+ if (branches.some((branch) => branch === "") || branches.some((branch) => /^[*?]+$/.test(branch)) || hasRepeatedCharPrefixOverlap(branches)) {
7724
+ return { risky: true };
7725
+ }
7726
+ }
7727
+ for (const branch of branches) {
7728
+ const safeOutput = getStarExtglobSequenceOutput(branch);
7729
+ if (safeOutput) {
7730
+ return { risky: true, safeOutput };
7731
+ }
7732
+ if (repeatedExtglobRecursion(branch) > max) {
7733
+ return { risky: true };
7734
+ }
7735
+ }
7736
+ return { risky: false };
7737
+ };
7738
+ var parse = (input, options) => {
7739
+ if (typeof input !== "string") {
7740
+ throw new TypeError("Expected a string");
7741
+ }
7742
+ input = REPLACEMENTS[input] || input;
7743
+ const opts = { ...options };
7744
+ const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
7745
+ let len = input.length;
7746
+ if (len > max) {
7747
+ throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
7748
+ }
7749
+ const bos = { type: "bos", value: "", output: opts.prepend || "" };
7750
+ const tokens = [bos];
7751
+ const capture = opts.capture ? "" : "?:";
7752
+ const PLATFORM_CHARS = constants.globChars(opts.windows);
7753
+ const EXTGLOB_CHARS = constants.extglobChars(PLATFORM_CHARS);
7754
+ const {
7755
+ DOT_LITERAL,
7756
+ PLUS_LITERAL,
7757
+ SLASH_LITERAL,
7758
+ ONE_CHAR,
7759
+ DOTS_SLASH,
7760
+ NO_DOT,
7761
+ NO_DOT_SLASH,
7762
+ NO_DOTS_SLASH,
7763
+ QMARK,
7764
+ QMARK_NO_DOT,
7765
+ STAR,
7766
+ START_ANCHOR
7767
+ } = PLATFORM_CHARS;
7768
+ const globstar = (opts2) => {
7769
+ return `(${capture}(?:(?!${START_ANCHOR}${opts2.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
7770
+ };
7771
+ const nodot = opts.dot ? "" : NO_DOT;
7772
+ const qmarkNoDot = opts.dot ? QMARK : QMARK_NO_DOT;
7773
+ let star = opts.bash === true ? globstar(opts) : STAR;
7774
+ if (opts.capture) {
7775
+ star = `(${star})`;
7776
+ }
7777
+ if (typeof opts.noext === "boolean") {
7778
+ opts.noextglob = opts.noext;
7779
+ }
7780
+ const state = {
7781
+ input,
7782
+ index: -1,
7783
+ start: 0,
7784
+ dot: opts.dot === true,
7785
+ consumed: "",
7786
+ output: "",
7787
+ prefix: "",
7788
+ backtrack: false,
7789
+ negated: false,
7790
+ brackets: 0,
7791
+ braces: 0,
7792
+ parens: 0,
7793
+ quotes: 0,
7794
+ globstar: false,
7795
+ tokens
7796
+ };
7797
+ input = utils.removePrefix(input, state);
7798
+ len = input.length;
7799
+ const extglobs = [];
7800
+ const braces = [];
7801
+ const stack = [];
7802
+ let prev = bos;
7803
+ let value;
7804
+ const eos = () => state.index === len - 1;
7805
+ const peek = state.peek = (n = 1) => input[state.index + n];
7806
+ const advance = state.advance = () => input[++state.index] || "";
7807
+ const remaining = () => input.slice(state.index + 1);
7808
+ const consume = (value2 = "", num = 0) => {
7809
+ state.consumed += value2;
7810
+ state.index += num;
7811
+ };
7812
+ const append = (token) => {
7813
+ state.output += token.output != null ? token.output : token.value;
7814
+ consume(token.value);
7815
+ };
7816
+ const negate = () => {
7817
+ let count = 1;
7818
+ while (peek() === "!" && (peek(2) !== "(" || peek(3) === "?")) {
7819
+ advance();
7820
+ state.start++;
7821
+ count++;
7822
+ }
7823
+ if (count % 2 === 0) {
7824
+ return false;
7825
+ }
7826
+ state.negated = true;
7827
+ state.start++;
7828
+ return true;
7829
+ };
7830
+ const increment = (type) => {
7831
+ state[type]++;
7832
+ stack.push(type);
7833
+ };
7834
+ const decrement = (type) => {
7835
+ state[type]--;
7836
+ stack.pop();
7837
+ };
7838
+ const push = (tok) => {
7839
+ if (prev.type === "globstar") {
7840
+ const isBrace = state.braces > 0 && (tok.type === "comma" || tok.type === "brace");
7841
+ const isExtglob = tok.extglob === true || extglobs.length && (tok.type === "pipe" || tok.type === "paren");
7842
+ if (tok.type !== "slash" && tok.type !== "paren" && !isBrace && !isExtglob) {
7843
+ state.output = state.output.slice(0, -prev.output.length);
7844
+ prev.type = "star";
7845
+ prev.value = "*";
7846
+ prev.output = star;
7847
+ state.output += prev.output;
7848
+ }
7849
+ }
7850
+ if (extglobs.length && tok.type !== "paren") {
7851
+ extglobs[extglobs.length - 1].inner += tok.value;
7852
+ }
7853
+ if (tok.value || tok.output)
7854
+ append(tok);
7855
+ if (prev && prev.type === "text" && tok.type === "text") {
7856
+ prev.output = (prev.output || prev.value) + tok.value;
7857
+ prev.value += tok.value;
7858
+ return;
7859
+ }
7860
+ tok.prev = prev;
7861
+ tokens.push(tok);
7862
+ prev = tok;
7863
+ };
7864
+ const extglobOpen = (type, value2) => {
7865
+ const token = { ...EXTGLOB_CHARS[value2], conditions: 1, inner: "" };
7866
+ token.prev = prev;
7867
+ token.parens = state.parens;
7868
+ token.output = state.output;
7869
+ token.startIndex = state.index;
7870
+ token.tokensIndex = tokens.length;
7871
+ const output = (opts.capture ? "(" : "") + token.open;
7872
+ increment("parens");
7873
+ push({ type, value: value2, output: state.output ? "" : ONE_CHAR });
7874
+ push({ type: "paren", extglob: true, value: advance(), output });
7875
+ extglobs.push(token);
7876
+ };
7877
+ const extglobClose = (token) => {
7878
+ const literal = input.slice(token.startIndex, state.index + 1);
7879
+ const body = input.slice(token.startIndex + 2, state.index);
7880
+ const analysis = analyzeRepeatedExtglob(body, opts);
7881
+ if ((token.type === "plus" || token.type === "star") && analysis.risky) {
7882
+ const safeOutput = analysis.safeOutput ? (token.output ? "" : ONE_CHAR) + (opts.capture ? `(${analysis.safeOutput})` : analysis.safeOutput) : undefined;
7883
+ const open = tokens[token.tokensIndex];
7884
+ open.type = "text";
7885
+ open.value = literal;
7886
+ open.output = safeOutput || utils.escapeRegex(literal);
7887
+ for (let i = token.tokensIndex + 1;i < tokens.length; i++) {
7888
+ tokens[i].value = "";
7889
+ tokens[i].output = "";
7890
+ delete tokens[i].suffix;
7891
+ }
7892
+ state.output = token.output + open.output;
7893
+ state.backtrack = true;
7894
+ push({ type: "paren", extglob: true, value, output: "" });
7895
+ decrement("parens");
7896
+ return;
7897
+ }
7898
+ let output = token.close + (opts.capture ? ")" : "");
7899
+ let rest;
7900
+ if (token.type === "negate") {
7901
+ let extglobStar = star;
7902
+ if (token.inner && token.inner.length > 1 && token.inner.includes("/")) {
7903
+ extglobStar = globstar(opts);
7904
+ }
7905
+ if (extglobStar !== star || eos() || /^\)+$/.test(remaining())) {
7906
+ output = token.close = `)$))${extglobStar}`;
7907
+ }
7908
+ if (token.inner.includes("*") && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) {
7909
+ const expression = parse(rest, { ...options, fastpaths: false }).output;
7910
+ output = token.close = `)${expression})${extglobStar})`;
7911
+ }
7912
+ if (token.prev.type === "bos") {
7913
+ state.negatedExtglob = true;
7914
+ }
7915
+ }
7916
+ push({ type: "paren", extglob: true, value, output });
7917
+ decrement("parens");
7918
+ };
7919
+ if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input)) {
7920
+ let backslashes = false;
7921
+ let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc, chars, first, rest, index) => {
7922
+ if (first === "\\") {
7923
+ backslashes = true;
7924
+ return m;
7925
+ }
7926
+ if (first === "?") {
7927
+ if (esc) {
7928
+ return esc + first + (rest ? QMARK.repeat(rest.length) : "");
7929
+ }
7930
+ if (index === 0) {
7931
+ return qmarkNoDot + (rest ? QMARK.repeat(rest.length) : "");
7932
+ }
7933
+ return QMARK.repeat(chars.length);
7934
+ }
7935
+ if (first === ".") {
7936
+ return DOT_LITERAL.repeat(chars.length);
7937
+ }
7938
+ if (first === "*") {
7939
+ if (esc) {
7940
+ return esc + first + (rest ? star : "");
7941
+ }
7942
+ return star;
7943
+ }
7944
+ return esc ? m : `\\${m}`;
7945
+ });
7946
+ if (backslashes === true) {
7947
+ if (opts.unescape === true) {
7948
+ output = output.replace(/\\/g, "");
7949
+ } else {
7950
+ output = output.replace(/\\+/g, (m) => {
7951
+ return m.length % 2 === 0 ? "\\\\" : m ? "\\" : "";
7952
+ });
7953
+ }
7954
+ }
7955
+ if (output === input && opts.contains === true) {
7956
+ state.output = input;
7957
+ return state;
7958
+ }
7959
+ state.output = utils.wrapOutput(output, state, options);
7960
+ return state;
7961
+ }
7962
+ while (!eos()) {
7963
+ value = advance();
7964
+ if (value === "\x00") {
7965
+ continue;
7966
+ }
7967
+ if (value === "\\") {
7968
+ const next = peek();
7969
+ if (next === "/" && opts.bash !== true) {
7970
+ continue;
7971
+ }
7972
+ if (next === "." || next === ";") {
7973
+ continue;
7974
+ }
7975
+ if (!next) {
7976
+ value += "\\";
7977
+ push({ type: "text", value });
7978
+ continue;
7979
+ }
7980
+ const match = /^\\+/.exec(remaining());
7981
+ let slashes = 0;
7982
+ if (match && match[0].length > 2) {
7983
+ slashes = match[0].length;
7984
+ state.index += slashes;
7985
+ if (slashes % 2 !== 0) {
7986
+ value += "\\";
7987
+ }
7988
+ }
7989
+ if (opts.unescape === true) {
7990
+ value = advance();
7991
+ } else {
7992
+ value += advance();
7993
+ }
7994
+ if (state.brackets === 0) {
7995
+ push({ type: "text", value });
7996
+ continue;
7997
+ }
7998
+ }
7999
+ if (state.brackets > 0 && (value !== "]" || prev.value === "[" || prev.value === "[^")) {
8000
+ if (opts.posix !== false && value === ":") {
8001
+ const inner = prev.value.slice(1);
8002
+ if (inner.includes("[")) {
8003
+ prev.posix = true;
8004
+ if (inner.includes(":")) {
8005
+ const idx = prev.value.lastIndexOf("[");
8006
+ const pre = prev.value.slice(0, idx);
8007
+ const rest2 = prev.value.slice(idx + 2);
8008
+ const posix = POSIX_REGEX_SOURCE[rest2];
8009
+ if (posix) {
8010
+ prev.value = pre + posix;
8011
+ state.backtrack = true;
8012
+ advance();
8013
+ if (!bos.output && tokens.indexOf(prev) === 1) {
8014
+ bos.output = ONE_CHAR;
8015
+ }
8016
+ continue;
8017
+ }
8018
+ }
8019
+ }
8020
+ }
8021
+ if (value === "[" && peek() !== ":" || value === "-" && peek() === "]") {
8022
+ value = `\\${value}`;
8023
+ }
8024
+ if (value === "]" && (prev.value === "[" || prev.value === "[^")) {
8025
+ value = `\\${value}`;
8026
+ }
8027
+ if (opts.posix === true && value === "!" && prev.value === "[") {
8028
+ value = "^";
8029
+ }
8030
+ prev.value += value;
8031
+ append({ value });
8032
+ continue;
8033
+ }
8034
+ if (state.quotes === 1 && value !== '"') {
8035
+ value = utils.escapeRegex(value);
8036
+ prev.value += value;
8037
+ append({ value });
8038
+ continue;
8039
+ }
8040
+ if (value === '"') {
8041
+ state.quotes = state.quotes === 1 ? 0 : 1;
8042
+ if (opts.keepQuotes === true) {
8043
+ push({ type: "text", value });
8044
+ }
8045
+ continue;
8046
+ }
8047
+ if (value === "(") {
8048
+ increment("parens");
8049
+ push({ type: "paren", value });
8050
+ continue;
8051
+ }
8052
+ if (value === ")") {
8053
+ if (state.parens === 0 && opts.strictBrackets === true) {
8054
+ throw new SyntaxError(syntaxError("opening", "("));
8055
+ }
8056
+ const extglob = extglobs[extglobs.length - 1];
8057
+ if (extglob && state.parens === extglob.parens + 1) {
8058
+ extglobClose(extglobs.pop());
8059
+ continue;
8060
+ }
8061
+ push({ type: "paren", value, output: state.parens ? ")" : "\\)" });
8062
+ decrement("parens");
8063
+ continue;
8064
+ }
8065
+ if (value === "[") {
8066
+ if (opts.nobracket === true || !remaining().includes("]")) {
8067
+ if (opts.nobracket !== true && opts.strictBrackets === true) {
8068
+ throw new SyntaxError(syntaxError("closing", "]"));
8069
+ }
8070
+ value = `\\${value}`;
8071
+ } else {
8072
+ increment("brackets");
8073
+ }
8074
+ push({ type: "bracket", value });
8075
+ continue;
8076
+ }
8077
+ if (value === "]") {
8078
+ if (opts.nobracket === true || prev && prev.type === "bracket" && prev.value.length === 1) {
8079
+ push({ type: "text", value, output: `\\${value}` });
8080
+ continue;
8081
+ }
8082
+ if (state.brackets === 0) {
8083
+ if (opts.strictBrackets === true) {
8084
+ throw new SyntaxError(syntaxError("opening", "["));
8085
+ }
8086
+ push({ type: "text", value, output: `\\${value}` });
8087
+ continue;
8088
+ }
8089
+ decrement("brackets");
8090
+ const prevValue = prev.value.slice(1);
8091
+ if (prev.posix !== true && prevValue[0] === "^" && !prevValue.includes("/")) {
8092
+ value = `/${value}`;
8093
+ }
8094
+ prev.value += value;
8095
+ append({ value });
8096
+ if (opts.literalBrackets === false || utils.hasRegexChars(prevValue)) {
8097
+ continue;
8098
+ }
8099
+ const escaped = utils.escapeRegex(prev.value);
8100
+ state.output = state.output.slice(0, -prev.value.length);
8101
+ if (opts.literalBrackets === true) {
8102
+ state.output += escaped;
8103
+ prev.value = escaped;
8104
+ continue;
8105
+ }
8106
+ prev.value = `(${capture}${escaped}|${prev.value})`;
8107
+ state.output += prev.value;
8108
+ continue;
8109
+ }
8110
+ if (value === "{" && opts.nobrace !== true) {
8111
+ increment("braces");
8112
+ const open = {
8113
+ type: "brace",
8114
+ value,
8115
+ output: "(",
8116
+ outputIndex: state.output.length,
8117
+ tokensIndex: state.tokens.length
8118
+ };
8119
+ braces.push(open);
8120
+ push(open);
8121
+ continue;
8122
+ }
8123
+ if (value === "}") {
8124
+ const brace = braces[braces.length - 1];
8125
+ if (opts.nobrace === true || !brace) {
8126
+ push({ type: "text", value, output: value });
8127
+ continue;
8128
+ }
8129
+ let output = ")";
8130
+ if (brace.dots === true) {
8131
+ const arr = tokens.slice();
8132
+ const range = [];
8133
+ for (let i = arr.length - 1;i >= 0; i--) {
8134
+ tokens.pop();
8135
+ if (arr[i].type === "brace") {
8136
+ break;
8137
+ }
8138
+ if (arr[i].type !== "dots") {
8139
+ range.unshift(arr[i].value);
8140
+ }
8141
+ }
8142
+ output = expandRange(range, opts);
8143
+ state.backtrack = true;
8144
+ }
8145
+ if (brace.comma !== true && brace.dots !== true) {
8146
+ const out = state.output.slice(0, brace.outputIndex);
8147
+ const toks = state.tokens.slice(brace.tokensIndex);
8148
+ brace.value = brace.output = "\\{";
8149
+ value = output = "\\}";
8150
+ state.output = out;
8151
+ for (const t of toks) {
8152
+ state.output += t.output || t.value;
8153
+ }
8154
+ }
8155
+ push({ type: "brace", value, output });
8156
+ decrement("braces");
8157
+ braces.pop();
8158
+ continue;
8159
+ }
8160
+ if (value === "|") {
8161
+ if (extglobs.length > 0) {
8162
+ extglobs[extglobs.length - 1].conditions++;
8163
+ }
8164
+ push({ type: "text", value });
8165
+ continue;
8166
+ }
8167
+ if (value === ",") {
8168
+ let output = value;
8169
+ const brace = braces[braces.length - 1];
8170
+ if (brace && stack[stack.length - 1] === "braces") {
8171
+ brace.comma = true;
8172
+ output = "|";
8173
+ }
8174
+ push({ type: "comma", value, output });
8175
+ continue;
8176
+ }
8177
+ if (value === "/") {
8178
+ if (prev.type === "dot" && state.index === state.start + 1) {
8179
+ state.start = state.index + 1;
8180
+ state.consumed = "";
8181
+ state.output = "";
8182
+ tokens.pop();
8183
+ prev = bos;
8184
+ continue;
8185
+ }
8186
+ push({ type: "slash", value, output: SLASH_LITERAL });
8187
+ continue;
8188
+ }
8189
+ if (value === ".") {
8190
+ if (state.braces > 0 && prev.type === "dot") {
8191
+ if (prev.value === ".")
8192
+ prev.output = DOT_LITERAL;
8193
+ const brace = braces[braces.length - 1];
8194
+ prev.type = "dots";
8195
+ prev.output += value;
8196
+ prev.value += value;
8197
+ brace.dots = true;
8198
+ continue;
8199
+ }
8200
+ if (state.braces + state.parens === 0 && prev.type !== "bos" && prev.type !== "slash") {
8201
+ push({ type: "text", value, output: DOT_LITERAL });
8202
+ continue;
8203
+ }
8204
+ push({ type: "dot", value, output: DOT_LITERAL });
8205
+ continue;
8206
+ }
8207
+ if (value === "?") {
8208
+ const isGroup = prev && prev.value === "(";
8209
+ if (!isGroup && opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
8210
+ extglobOpen("qmark", value);
8211
+ continue;
8212
+ }
8213
+ if (prev && prev.type === "paren") {
8214
+ const next = peek();
8215
+ let output = value;
8216
+ if (prev.value === "(" && !/[!=<:]/.test(next) || next === "<" && !/<([!=]|\w+>)/.test(remaining())) {
8217
+ output = `\\${value}`;
8218
+ }
8219
+ push({ type: "text", value, output });
8220
+ continue;
8221
+ }
8222
+ if (opts.dot !== true && (prev.type === "slash" || prev.type === "bos")) {
8223
+ push({ type: "qmark", value, output: QMARK_NO_DOT });
8224
+ continue;
8225
+ }
8226
+ push({ type: "qmark", value, output: QMARK });
8227
+ continue;
8228
+ }
8229
+ if (value === "!") {
8230
+ if (opts.noextglob !== true && peek() === "(") {
8231
+ if (peek(2) !== "?" || !/[!=<:]/.test(peek(3))) {
8232
+ extglobOpen("negate", value);
8233
+ continue;
8234
+ }
8235
+ }
8236
+ if (opts.nonegate !== true && state.index === 0) {
8237
+ negate();
8238
+ continue;
8239
+ }
8240
+ }
8241
+ if (value === "+") {
8242
+ if (opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
8243
+ extglobOpen("plus", value);
8244
+ continue;
8245
+ }
8246
+ if (prev && prev.value === "(" || opts.regex === false) {
8247
+ push({ type: "plus", value, output: PLUS_LITERAL });
8248
+ continue;
8249
+ }
8250
+ if (prev && (prev.type === "bracket" || prev.type === "paren" || prev.type === "brace") || state.parens > 0) {
8251
+ push({ type: "plus", value });
8252
+ continue;
8253
+ }
8254
+ push({ type: "plus", value: PLUS_LITERAL });
8255
+ continue;
8256
+ }
8257
+ if (value === "@") {
8258
+ if (opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
8259
+ push({ type: "at", extglob: true, value, output: "" });
8260
+ continue;
8261
+ }
8262
+ push({ type: "text", value });
8263
+ continue;
8264
+ }
8265
+ if (value !== "*") {
8266
+ if (value === "$" || value === "^") {
8267
+ value = `\\${value}`;
8268
+ }
8269
+ const match = REGEX_NON_SPECIAL_CHARS.exec(remaining());
8270
+ if (match) {
8271
+ value += match[0];
8272
+ state.index += match[0].length;
8273
+ }
8274
+ push({ type: "text", value });
8275
+ continue;
8276
+ }
8277
+ if (prev && (prev.type === "globstar" || prev.star === true)) {
8278
+ prev.type = "star";
8279
+ prev.star = true;
8280
+ prev.value += value;
8281
+ prev.output = star;
8282
+ state.backtrack = true;
8283
+ state.globstar = true;
8284
+ consume(value);
8285
+ continue;
8286
+ }
8287
+ let rest = remaining();
8288
+ if (opts.noextglob !== true && /^\([^?]/.test(rest)) {
8289
+ extglobOpen("star", value);
8290
+ continue;
8291
+ }
8292
+ if (prev.type === "star") {
8293
+ if (opts.noglobstar === true) {
8294
+ consume(value);
8295
+ continue;
8296
+ }
8297
+ const prior = prev.prev;
8298
+ const before = prior.prev;
8299
+ const isStart = prior.type === "slash" || prior.type === "bos";
8300
+ const afterStar = before && (before.type === "star" || before.type === "globstar");
8301
+ if (opts.bash === true && (!isStart || rest[0] && rest[0] !== "/")) {
8302
+ push({ type: "star", value, output: "" });
8303
+ continue;
8304
+ }
8305
+ const isBrace = state.braces > 0 && (prior.type === "comma" || prior.type === "brace");
8306
+ const isExtglob = extglobs.length && (prior.type === "pipe" || prior.type === "paren");
8307
+ if (!isStart && prior.type !== "paren" && !isBrace && !isExtglob) {
8308
+ push({ type: "star", value, output: "" });
8309
+ continue;
8310
+ }
8311
+ while (rest.slice(0, 3) === "/**") {
8312
+ const after = input[state.index + 4];
8313
+ if (after && after !== "/") {
8314
+ break;
8315
+ }
8316
+ rest = rest.slice(3);
8317
+ consume("/**", 3);
8318
+ }
8319
+ if (prior.type === "bos" && eos()) {
8320
+ prev.type = "globstar";
8321
+ prev.value += value;
8322
+ prev.output = globstar(opts);
8323
+ state.output = prev.output;
8324
+ state.globstar = true;
8325
+ consume(value);
8326
+ continue;
8327
+ }
8328
+ if (prior.type === "slash" && prior.prev.type !== "bos" && !afterStar && eos()) {
8329
+ state.output = state.output.slice(0, -(prior.output + prev.output).length);
8330
+ prior.output = `(?:${prior.output}`;
8331
+ prev.type = "globstar";
8332
+ prev.output = globstar(opts) + (opts.strictSlashes ? ")" : "|$)");
8333
+ prev.value += value;
8334
+ state.globstar = true;
8335
+ state.output += prior.output + prev.output;
8336
+ consume(value);
8337
+ continue;
8338
+ }
8339
+ if (prior.type === "slash" && prior.prev.type !== "bos" && rest[0] === "/") {
8340
+ const end = rest[1] !== undefined ? "|$" : "";
8341
+ state.output = state.output.slice(0, -(prior.output + prev.output).length);
8342
+ prior.output = `(?:${prior.output}`;
8343
+ prev.type = "globstar";
8344
+ prev.output = `${globstar(opts)}${SLASH_LITERAL}|${SLASH_LITERAL}${end})`;
8345
+ prev.value += value;
8346
+ state.output += prior.output + prev.output;
8347
+ state.globstar = true;
8348
+ consume(value + advance());
8349
+ push({ type: "slash", value: "/", output: "" });
8350
+ continue;
8351
+ }
8352
+ if (prior.type === "bos" && rest[0] === "/") {
8353
+ prev.type = "globstar";
8354
+ prev.value += value;
8355
+ prev.output = `(?:^|${SLASH_LITERAL}|${globstar(opts)}${SLASH_LITERAL})`;
8356
+ state.output = prev.output;
8357
+ state.globstar = true;
8358
+ consume(value + advance());
8359
+ push({ type: "slash", value: "/", output: "" });
8360
+ continue;
8361
+ }
8362
+ state.output = state.output.slice(0, -prev.output.length);
8363
+ prev.type = "globstar";
8364
+ prev.output = globstar(opts);
8365
+ prev.value += value;
8366
+ state.output += prev.output;
8367
+ state.globstar = true;
8368
+ consume(value);
8369
+ continue;
8370
+ }
8371
+ const token = { type: "star", value, output: star };
8372
+ if (opts.bash === true) {
8373
+ token.output = ".*?";
8374
+ if (prev.type === "bos" || prev.type === "slash") {
8375
+ token.output = nodot + token.output;
8376
+ }
8377
+ push(token);
8378
+ continue;
8379
+ }
8380
+ if (prev && (prev.type === "bracket" || prev.type === "paren") && opts.regex === true) {
8381
+ token.output = value;
8382
+ push(token);
8383
+ continue;
8384
+ }
8385
+ if (state.index === state.start || prev.type === "slash" || prev.type === "dot") {
8386
+ if (prev.type === "dot") {
8387
+ state.output += NO_DOT_SLASH;
8388
+ prev.output += NO_DOT_SLASH;
8389
+ } else if (opts.dot === true) {
8390
+ state.output += NO_DOTS_SLASH;
8391
+ prev.output += NO_DOTS_SLASH;
8392
+ } else {
8393
+ state.output += nodot;
8394
+ prev.output += nodot;
8395
+ }
8396
+ if (peek() !== "*") {
8397
+ state.output += ONE_CHAR;
8398
+ prev.output += ONE_CHAR;
8399
+ }
8400
+ }
8401
+ push(token);
8402
+ }
8403
+ while (state.brackets > 0) {
8404
+ if (opts.strictBrackets === true)
8405
+ throw new SyntaxError(syntaxError("closing", "]"));
8406
+ state.output = utils.escapeLast(state.output, "[");
8407
+ decrement("brackets");
8408
+ }
8409
+ while (state.parens > 0) {
8410
+ if (opts.strictBrackets === true)
8411
+ throw new SyntaxError(syntaxError("closing", ")"));
8412
+ state.output = utils.escapeLast(state.output, "(");
8413
+ decrement("parens");
8414
+ }
8415
+ while (state.braces > 0) {
8416
+ if (opts.strictBrackets === true)
8417
+ throw new SyntaxError(syntaxError("closing", "}"));
8418
+ state.output = utils.escapeLast(state.output, "{");
8419
+ decrement("braces");
8420
+ }
8421
+ if (opts.strictSlashes !== true && (prev.type === "star" || prev.type === "bracket")) {
8422
+ push({ type: "maybe_slash", value: "", output: `${SLASH_LITERAL}?` });
8423
+ }
8424
+ if (state.backtrack === true) {
8425
+ state.output = "";
8426
+ for (const token of state.tokens) {
8427
+ state.output += token.output != null ? token.output : token.value;
8428
+ if (token.suffix) {
8429
+ state.output += token.suffix;
8430
+ }
8431
+ }
8432
+ }
8433
+ return state;
8434
+ };
8435
+ parse.fastpaths = (input, options) => {
8436
+ const opts = { ...options };
8437
+ const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
8438
+ const len = input.length;
8439
+ if (len > max) {
8440
+ throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
8441
+ }
8442
+ input = REPLACEMENTS[input] || input;
8443
+ const {
8444
+ DOT_LITERAL,
8445
+ SLASH_LITERAL,
8446
+ ONE_CHAR,
8447
+ DOTS_SLASH,
8448
+ NO_DOT,
8449
+ NO_DOTS,
8450
+ NO_DOTS_SLASH,
8451
+ STAR,
8452
+ START_ANCHOR
8453
+ } = constants.globChars(opts.windows);
8454
+ const nodot = opts.dot ? NO_DOTS : NO_DOT;
8455
+ const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT;
8456
+ const capture = opts.capture ? "" : "?:";
8457
+ const state = { negated: false, prefix: "" };
8458
+ let star = opts.bash === true ? ".*?" : STAR;
8459
+ if (opts.capture) {
8460
+ star = `(${star})`;
8461
+ }
8462
+ const globstar = (opts2) => {
8463
+ if (opts2.noglobstar === true)
8464
+ return star;
8465
+ return `(${capture}(?:(?!${START_ANCHOR}${opts2.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
8466
+ };
8467
+ const create = (str) => {
8468
+ switch (str) {
8469
+ case "*":
8470
+ return `${nodot}${ONE_CHAR}${star}`;
8471
+ case ".*":
8472
+ return `${DOT_LITERAL}${ONE_CHAR}${star}`;
8473
+ case "*.*":
8474
+ return `${nodot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
8475
+ case "*/*":
8476
+ return `${nodot}${star}${SLASH_LITERAL}${ONE_CHAR}${slashDot}${star}`;
8477
+ case "**":
8478
+ return nodot + globstar(opts);
8479
+ case "**/*":
8480
+ return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${ONE_CHAR}${star}`;
8481
+ case "**/*.*":
8482
+ return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
8483
+ case "**/.*":
8484
+ return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${DOT_LITERAL}${ONE_CHAR}${star}`;
8485
+ default: {
8486
+ const match = /^(.*?)\.(\w+)$/.exec(str);
8487
+ if (!match)
8488
+ return;
8489
+ const source3 = create(match[1]);
8490
+ if (!source3)
8491
+ return;
8492
+ return source3 + DOT_LITERAL + match[2];
8493
+ }
8494
+ }
8495
+ };
8496
+ const output = utils.removePrefix(input, state);
8497
+ let source2 = create(output);
8498
+ if (source2 && opts.strictSlashes !== true) {
8499
+ source2 += `${SLASH_LITERAL}?`;
8500
+ }
8501
+ return source2;
8502
+ };
8503
+ module.exports = parse;
8504
+ });
8505
+
8506
+ // ../../node_modules/.bun/picomatch@4.0.4/node_modules/picomatch/lib/picomatch.js
8507
+ var require_picomatch = __commonJS((exports, module) => {
8508
+ var scan = require_scan();
8509
+ var parse = require_parse();
8510
+ var utils = require_utils();
8511
+ var constants = require_constants();
8512
+ var isObject = (val) => val && typeof val === "object" && !Array.isArray(val);
8513
+ var picomatch = (glob, options, returnState = false) => {
8514
+ if (Array.isArray(glob)) {
8515
+ const fns = glob.map((input) => picomatch(input, options, returnState));
8516
+ const arrayMatcher = (str) => {
8517
+ for (const isMatch of fns) {
8518
+ const state2 = isMatch(str);
8519
+ if (state2)
8520
+ return state2;
8521
+ }
8522
+ return false;
8523
+ };
8524
+ return arrayMatcher;
8525
+ }
8526
+ const isState = isObject(glob) && glob.tokens && glob.input;
8527
+ if (glob === "" || typeof glob !== "string" && !isState) {
8528
+ throw new TypeError("Expected pattern to be a non-empty string");
8529
+ }
8530
+ const opts = options || {};
8531
+ const posix = opts.windows;
8532
+ const regex = isState ? picomatch.compileRe(glob, options) : picomatch.makeRe(glob, options, false, true);
8533
+ const state = regex.state;
8534
+ delete regex.state;
8535
+ let isIgnored = () => false;
8536
+ if (opts.ignore) {
8537
+ const ignoreOpts = { ...options, ignore: null, onMatch: null, onResult: null };
8538
+ isIgnored = picomatch(opts.ignore, ignoreOpts, returnState);
8539
+ }
8540
+ const matcher = (input, returnObject = false) => {
8541
+ const { isMatch, match, output } = picomatch.test(input, regex, options, { glob, posix });
8542
+ const result = { glob, state, regex, posix, input, output, match, isMatch };
8543
+ if (typeof opts.onResult === "function") {
8544
+ opts.onResult(result);
8545
+ }
8546
+ if (isMatch === false) {
8547
+ result.isMatch = false;
8548
+ return returnObject ? result : false;
8549
+ }
8550
+ if (isIgnored(input)) {
8551
+ if (typeof opts.onIgnore === "function") {
8552
+ opts.onIgnore(result);
8553
+ }
8554
+ result.isMatch = false;
8555
+ return returnObject ? result : false;
8556
+ }
8557
+ if (typeof opts.onMatch === "function") {
8558
+ opts.onMatch(result);
8559
+ }
8560
+ return returnObject ? result : true;
8561
+ };
8562
+ if (returnState) {
8563
+ matcher.state = state;
8564
+ }
8565
+ return matcher;
8566
+ };
8567
+ picomatch.test = (input, regex, options, { glob, posix } = {}) => {
8568
+ if (typeof input !== "string") {
8569
+ throw new TypeError("Expected input to be a string");
8570
+ }
8571
+ if (input === "") {
8572
+ return { isMatch: false, output: "" };
8573
+ }
8574
+ const opts = options || {};
8575
+ const format = opts.format || (posix ? utils.toPosixSlashes : null);
8576
+ let match = input === glob;
8577
+ let output = match && format ? format(input) : input;
8578
+ if (match === false) {
8579
+ output = format ? format(input) : input;
8580
+ match = output === glob;
8581
+ }
8582
+ if (match === false || opts.capture === true) {
8583
+ if (opts.matchBase === true || opts.basename === true) {
8584
+ match = picomatch.matchBase(input, regex, options, posix);
8585
+ } else {
8586
+ match = regex.exec(output);
8587
+ }
8588
+ }
8589
+ return { isMatch: Boolean(match), match, output };
8590
+ };
8591
+ picomatch.matchBase = (input, glob, options) => {
8592
+ const regex = glob instanceof RegExp ? glob : picomatch.makeRe(glob, options);
8593
+ return regex.test(utils.basename(input));
8594
+ };
8595
+ picomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str);
8596
+ picomatch.parse = (pattern, options) => {
8597
+ if (Array.isArray(pattern))
8598
+ return pattern.map((p) => picomatch.parse(p, options));
8599
+ return parse(pattern, { ...options, fastpaths: false });
8600
+ };
8601
+ picomatch.scan = (input, options) => scan(input, options);
8602
+ picomatch.compileRe = (state, options, returnOutput = false, returnState = false) => {
8603
+ if (returnOutput === true) {
8604
+ return state.output;
8605
+ }
8606
+ const opts = options || {};
8607
+ const prepend = opts.contains ? "" : "^";
8608
+ const append = opts.contains ? "" : "$";
8609
+ let source2 = `${prepend}(?:${state.output})${append}`;
8610
+ if (state && state.negated === true) {
8611
+ source2 = `^(?!${source2}).*$`;
8612
+ }
8613
+ const regex = picomatch.toRegex(source2, options);
8614
+ if (returnState === true) {
8615
+ regex.state = state;
8616
+ }
8617
+ return regex;
8618
+ };
8619
+ picomatch.makeRe = (input, options = {}, returnOutput = false, returnState = false) => {
8620
+ if (!input || typeof input !== "string") {
8621
+ throw new TypeError("Expected a non-empty string");
8622
+ }
8623
+ let parsed = { negated: false, fastpaths: true };
8624
+ if (options.fastpaths !== false && (input[0] === "." || input[0] === "*")) {
8625
+ parsed.output = parse.fastpaths(input, options);
8626
+ }
8627
+ if (!parsed.output) {
8628
+ parsed = parse(input, options);
8629
+ }
8630
+ return picomatch.compileRe(parsed, options, returnOutput, returnState);
8631
+ };
8632
+ picomatch.toRegex = (source2, options) => {
8633
+ try {
8634
+ const opts = options || {};
8635
+ return new RegExp(source2, opts.flags || (opts.nocase ? "i" : ""));
8636
+ } catch (err) {
8637
+ if (options && options.debug === true)
8638
+ throw err;
8639
+ return /$^/;
8640
+ }
8641
+ };
8642
+ picomatch.constants = constants;
8643
+ module.exports = picomatch;
8644
+ });
8645
+
8646
+ // ../../node_modules/.bun/picomatch@4.0.4/node_modules/picomatch/index.js
8647
+ var require_picomatch2 = __commonJS((exports, module) => {
8648
+ var pico = require_picomatch();
8649
+ var utils = require_utils();
8650
+ function picomatch(glob, options, returnState = false) {
8651
+ if (options && (options.windows === null || options.windows === undefined)) {
8652
+ options = { ...options, windows: utils.isWindows() };
8653
+ }
8654
+ return pico(glob, options, returnState);
8655
+ }
8656
+ Object.assign(picomatch, pico);
8657
+ module.exports = picomatch;
8658
+ });
8659
+
6981
8660
  // src/types/base.ts
6982
8661
  var EntityType;
6983
8662
  ((EntityType2) => {
@@ -7209,10 +8888,33 @@ var DEFAULT_SERVER_CONFIG = {
7209
8888
  default_model: "gemini-3-pro-preview"
7210
8889
  }
7211
8890
  },
8891
+ task: {
8892
+ concurrency: {
8893
+ code_index: 2,
8894
+ doc_index: 2,
8895
+ remote_clone: 2,
8896
+ modeling: 1
8897
+ },
8898
+ default_timeout_ms: 150 * 60 * 1000,
8899
+ memory_ttl_ms: 48 * 60 * 60 * 1000,
8900
+ cleanup_interval_ms: 10 * 60 * 1000,
8901
+ log_max_entries: 500
8902
+ },
7212
8903
  indexing: {
7213
8904
  task_timeout_ms: 150 * 60 * 1000,
7214
8905
  file_timeout_ms: 15 * 60 * 1000
7215
8906
  },
8907
+ intent_router: {
8908
+ provider: "huggingface",
8909
+ huggingface: {
8910
+ model_id: "context4ai/intent-router-onnx",
8911
+ cache_dir: "./models/intent-router"
8912
+ },
8913
+ xenova: {
8914
+ model_id: "context4ai/intent-router-onnx",
8915
+ cache_dir: "./models/intent-router"
8916
+ }
8917
+ },
7216
8918
  embedding: {
7217
8919
  provider: "huggingface",
7218
8920
  huggingface: {
@@ -7234,6 +8936,21 @@ var DEFAULT_SERVER_CONFIG = {
7234
8936
  api_key: "",
7235
8937
  model_id: "text-embedding-004"
7236
8938
  }
8939
+ },
8940
+ reranker: {
8941
+ enabled: false,
8942
+ provider: "huggingface",
8943
+ huggingface: {
8944
+ model_id: "context4ai/Qwen3-Reranker-0.6B-seq-cls-ONNX",
8945
+ dtype: "q8",
8946
+ cache_dir: "./models/reranker"
8947
+ },
8948
+ xenova: {
8949
+ model_id: "context4ai/Qwen3-Reranker-0.6B-seq-cls-ONNX",
8950
+ dtype: "q8",
8951
+ cache_dir: "./models/reranker"
8952
+ },
8953
+ max_rerank: 20
7237
8954
  }
7238
8955
  };
7239
8956
  // src/types/daemon.ts
@@ -11670,6 +13387,45 @@ var docChunkParagraphSchema = exports_external.object({
11670
13387
  var docChunkResultSchema = exports_external.object({
11671
13388
  paragraphs: exports_external.array(docChunkParagraphSchema)
11672
13389
  });
13390
+ // src/types/pathFilter.ts
13391
+ var PathFilterConfigSchema = exports_external.object({
13392
+ package: exports_external.object({ include: exports_external.array(exports_external.string()).default([]) }).default({}),
13393
+ code: exports_external.object({
13394
+ include: exports_external.array(exports_external.string()).default([]),
13395
+ exclude: exports_external.array(exports_external.string()).default([])
13396
+ }).default({}),
13397
+ doc: exports_external.object({
13398
+ include: exports_external.array(exports_external.string()).default([]),
13399
+ exclude: exports_external.array(exports_external.string()).default([])
13400
+ }).default({})
13401
+ });
13402
+ var DEFAULT_PATH_FILTER = {
13403
+ package: {
13404
+ include: [
13405
+ "**/{package.json,pyproject.toml,setup.py,go.mod,Cargo.toml,pom.xml,build.gradle}"
13406
+ ]
13407
+ },
13408
+ code: {
13409
+ include: ["**/*.{ts,tsx}"],
13410
+ exclude: [
13411
+ "**/__{tests,test,e2e,mocks,fixtures,snapshots}__/**",
13412
+ "**/*.{test,spec,d}.{ts,tsx}"
13413
+ ]
13414
+ },
13415
+ doc: {
13416
+ include: ["*.md", "docs/**/*.md"],
13417
+ exclude: ["**/CHANGELOG.md"]
13418
+ }
13419
+ };
13420
+ function resolvePathFilter(metadata) {
13421
+ const raw = metadata?.path_filter;
13422
+ if (raw == null)
13423
+ return { config: DEFAULT_PATH_FILTER, isDefault: true };
13424
+ const parsed = PathFilterConfigSchema.safeParse(raw);
13425
+ if (!parsed.success)
13426
+ return { config: DEFAULT_PATH_FILTER, isDefault: true };
13427
+ return { config: parsed.data, isDefault: false };
13428
+ }
11673
13429
  // src/schemas/entitySchema.ts
11674
13430
  var baseEntitySchema = exports_external.object({
11675
13431
  id: exports_external.string(),
@@ -11926,6 +13682,10 @@ var ErrorCode;
11926
13682
  ErrorCode2["DIGEST_NOT_FOUND"] = "DIGEST_NOT_FOUND";
11927
13683
  ErrorCode2["INVALID_REGEX"] = "INVALID_REGEX";
11928
13684
  ErrorCode2["SOURCE_ACCESS_DENIED"] = "SOURCE_ACCESS_DENIED";
13685
+ ErrorCode2["NOT_INDEXED"] = "NOT_INDEXED";
13686
+ ErrorCode2["QUERY_TIMEOUT"] = "QUERY_TIMEOUT";
13687
+ ErrorCode2["INTENT_NOT_AVAILABLE"] = "INTENT_NOT_AVAILABLE";
13688
+ ErrorCode2["SUB_PATH_CONFLICT"] = "SUB_PATH_CONFLICT";
11929
13689
  ErrorCode2["WORKSPACE_ISOLATION"] = "WORKSPACE_ISOLATION";
11930
13690
  ErrorCode2["VECTOR_DIMENSION_MISMATCH"] = "VECTOR_DIMENSION_MISMATCH";
11931
13691
  ErrorCode2["VECTOR_REBUILD_PARTIAL"] = "VECTOR_REBUILD_PARTIAL";
@@ -11962,9 +13722,11 @@ var ERROR_CODE_HTTP_STATUS = {
11962
13722
  ["BACKUP_DIR_NOT_FOUND" /* BACKUP_DIR_NOT_FOUND */]: 404,
11963
13723
  ["SOURCE_NOT_FOUND" /* SOURCE_NOT_FOUND */]: 404,
11964
13724
  ["DIGEST_NOT_FOUND" /* DIGEST_NOT_FOUND */]: 404,
13725
+ ["NOT_INDEXED" /* NOT_INDEXED */]: 422,
11965
13726
  ["STORAGE_CONFLICT" /* STORAGE_CONFLICT */]: 409,
11966
13727
  ["ENTITY_DUPLICATE" /* ENTITY_DUPLICATE */]: 409,
11967
13728
  ["INDEX_IN_PROGRESS" /* INDEX_IN_PROGRESS */]: 409,
13729
+ ["SUB_PATH_CONFLICT" /* SUB_PATH_CONFLICT */]: 409,
11968
13730
  ["API_UNAUTHORIZED" /* API_UNAUTHORIZED */]: 401,
11969
13731
  ["LLM_AUTH_FAILED" /* LLM_AUTH_FAILED */]: 401,
11970
13732
  ["AUTH_REQUIRED" /* AUTH_REQUIRED */]: 401,
@@ -11980,6 +13742,7 @@ var ERROR_CODE_HTTP_STATUS = {
11980
13742
  ["API_RATE_LIMITED" /* API_RATE_LIMITED */]: 429,
11981
13743
  ["GIT_API_RATE_LIMITED" /* GIT_API_RATE_LIMITED */]: 429,
11982
13744
  ["API_NOT_IMPLEMENTED" /* API_NOT_IMPLEMENTED */]: 501,
13745
+ ["INTENT_NOT_AVAILABLE" /* INTENT_NOT_AVAILABLE */]: 501,
11983
13746
  ["BATCH_PARTIAL_FAILURE" /* BATCH_PARTIAL_FAILURE */]: 200,
11984
13747
  ["VECTOR_REBUILD_PARTIAL" /* VECTOR_REBUILD_PARTIAL */]: 200,
11985
13748
  ["STORAGE_FAILED" /* STORAGE_FAILED */]: 500,
@@ -11992,6 +13755,7 @@ var ERROR_CODE_HTTP_STATUS = {
11992
13755
  ["GIT_ARCHIVE_FAILED" /* GIT_ARCHIVE_FAILED */]: 500,
11993
13756
  ["EMBEDDING_NOT_AVAILABLE" /* EMBEDDING_NOT_AVAILABLE */]: 503,
11994
13757
  ["LLM_NOT_AVAILABLE" /* LLM_NOT_AVAILABLE */]: 503,
13758
+ ["QUERY_TIMEOUT" /* QUERY_TIMEOUT */]: 504,
11995
13759
  ["DAEMON_OFFLINE" /* DAEMON_OFFLINE */]: 503,
11996
13760
  ["DAEMON_AUTO_START_FAILED" /* DAEMON_AUTO_START_FAILED */]: 503,
11997
13761
  ["GIT_API_AUTH_FAILED" /* GIT_API_AUTH_FAILED */]: 502,
@@ -12024,6 +13788,26 @@ import { createHash as createHash2 } from "node:crypto";
12024
13788
  function contentHash(content) {
12025
13789
  return createHash2("sha256").update(content).digest("hex");
12026
13790
  }
13791
+ // src/utils/object.ts
13792
+ function isPlainObject(value) {
13793
+ return typeof value === "object" && value !== null && !Array.isArray(value);
13794
+ }
13795
+ function mergeDefaults(defaults, override) {
13796
+ const result = { ...defaults };
13797
+ for (const [key, value] of Object.entries(override)) {
13798
+ if (!(key in defaults))
13799
+ continue;
13800
+ const defaultValue = defaults[key];
13801
+ if (isPlainObject(defaultValue)) {
13802
+ if (isPlainObject(value)) {
13803
+ result[key] = mergeDefaults(defaultValue, value);
13804
+ }
13805
+ } else if (value !== undefined && value !== null) {
13806
+ result[key] = value;
13807
+ }
13808
+ }
13809
+ return result;
13810
+ }
12027
13811
  // src/utils/path.ts
12028
13812
  import path from "node:path";
12029
13813
  function isPathSafe(inputPath) {
@@ -12059,6 +13843,29 @@ function parseYaml(value) {
12059
13843
  throw new C4AError("PARSE_YAML" /* PARSE_YAML */, message, { input: value });
12060
13844
  }
12061
13845
  }
13846
+ // src/utils/glob.ts
13847
+ var import_picomatch = __toESM(require_picomatch2(), 1);
13848
+ var globToRegex = (glob) => import_picomatch.default.makeRe(glob, { dot: false });
13849
+ function createPathMatcher(rules) {
13850
+ if (rules.include.length === 0)
13851
+ return () => false;
13852
+ const isIncluded = import_picomatch.default(rules.include, { dot: false });
13853
+ const isExcluded = rules.exclude.length > 0 ? import_picomatch.default(rules.exclude, { dot: false }) : () => false;
13854
+ return (path2) => isIncluded(path2) && !isExcluded(path2);
13855
+ }
13856
+ function matchesPathFilter(path2, category, config) {
13857
+ const section = config[category];
13858
+ const include = section.include;
13859
+ const exclude = "exclude" in section ? section.exclude : [];
13860
+ if (include.length === 0)
13861
+ return false;
13862
+ const isIncluded = import_picomatch.default.isMatch(path2, include, { dot: false });
13863
+ if (!isIncluded)
13864
+ return false;
13865
+ if (exclude.length > 0 && import_picomatch.default.isMatch(path2, exclude, { dot: false }))
13866
+ return false;
13867
+ return true;
13868
+ }
12062
13869
  // src/constants.ts
12063
13870
  var DEFAULT_WORKSPACE_NAME = "My Brain";
12064
13871
  var DEFAULT_CLOUD_LIBRARY_NAME = "My Drive";
@@ -12068,6 +13875,52 @@ var RESERVED_USER_NAMES = ["SuperTest"];
12068
13875
  var DAEMON_HEARTBEAT_INTERVAL = 30000;
12069
13876
  var DAEMON_OFFLINE_THRESHOLD = 60000;
12070
13877
  var CLOUD_DAEMON_IDLE_TIMEOUT = 300000;
13878
+ var SCAN_EXCLUDED_DIRS = new Set([
13879
+ ".git",
13880
+ ".svn",
13881
+ ".hg",
13882
+ "node_modules",
13883
+ "dist",
13884
+ "build",
13885
+ "out",
13886
+ "coverage",
13887
+ ".next",
13888
+ ".nuxt",
13889
+ ".turbo",
13890
+ ".cache",
13891
+ ".parcel-cache",
13892
+ "__pycache__",
13893
+ ".venv",
13894
+ "venv",
13895
+ ".mypy_cache",
13896
+ ".pytest_cache",
13897
+ ".ruff_cache",
13898
+ "site-packages",
13899
+ ".eggs",
13900
+ "vendor",
13901
+ "target",
13902
+ ".gradle",
13903
+ ".m2",
13904
+ "__tests__",
13905
+ "__test__",
13906
+ "__e2e__",
13907
+ "__mocks__",
13908
+ "__fixtures__",
13909
+ "__snapshots__",
13910
+ "fixtures",
13911
+ ".tmp"
13912
+ ]);
13913
+ var CODE_DIGEST_TYPE = "code_tc_b";
13914
+ var hasExcludedSegment = (filePath) => {
13915
+ const segments = filePath.split("/");
13916
+ for (let i = 0;i < segments.length - 1; i++) {
13917
+ const seg = segments[i];
13918
+ if (SCAN_EXCLUDED_DIRS.has(seg) || seg.startsWith(".") && seg !== "." || seg.endsWith(".egg-info")) {
13919
+ return true;
13920
+ }
13921
+ }
13922
+ return false;
13923
+ };
12071
13924
  // src/contentTypeRegistry.ts
12072
13925
  var DEFAULT_CONTENT_TYPES = [
12073
13926
  {
@@ -12189,7 +14042,7 @@ var INDEXABLE_EXTENSIONS = new Set([
12189
14042
  var UPLOAD_ALLOWED_EXTENSIONS = collectExtensions(() => true);
12190
14043
  var TEXT_EXTENSIONS = collectExtensions((definition) => definition.cas.encoding === "utf8");
12191
14044
  var UPLOAD_MAX_FILE_SIZE = 5 * 1024 * 1024;
12192
- var UPLOAD_MAX_FILES = 10;
14045
+ var UPLOAD_MAX_FILES = 20;
12193
14046
  function getFileExtension(name) {
12194
14047
  const dot = name.lastIndexOf(".");
12195
14048
  return dot >= 0 ? name.slice(dot).toLowerCase() : "";
@@ -12211,6 +14064,13 @@ var WS_INDEX_PROGRESS = "index/progress";
12211
14064
  var WS_INDEX_DONE = "index/done";
12212
14065
  var WS_INDEX_ERROR = "index/error";
12213
14066
  var WS_INDEX_TIMEOUT = "index/timeout";
14067
+ var WS_TASK_QUEUED = "task/queued";
14068
+ var WS_TASK_STARTED = "task/started";
14069
+ var WS_TASK_PROGRESS = "task/progress";
14070
+ var WS_TASK_DONE = "task/done";
14071
+ var WS_TASK_FAILED = "task/failed";
14072
+ var WS_TASK_CANCELLED = "task/cancelled";
14073
+ var WS_TASK_QUEUE_UPDATE = "task/queue_update";
12214
14074
  export {
12215
14075
  validateAtomsWhitelist,
12216
14076
  transitionAtomSchema,
@@ -12226,6 +14086,7 @@ export {
12226
14086
  scopeSchema,
12227
14087
  ruleAtomSchema,
12228
14088
  roleAtomSchema,
14089
+ resolvePathFilter,
12229
14090
  relationTypeSchema,
12230
14091
  relationSchema,
12231
14092
  relationDataSchema,
@@ -12240,12 +14101,17 @@ export {
12240
14101
  metricMilestoneSchema,
12241
14102
  metricAtomSchema,
12242
14103
  metadataSchema,
14104
+ mergeDefaults,
14105
+ matchesPathFilter,
12243
14106
  mapErrorCodeToStatus,
12244
14107
  kindSchema,
12245
14108
  isValidManifest,
12246
14109
  isRefPointer,
14110
+ isPlainObject,
12247
14111
  isPathSafe,
12248
14112
  isIndexableFile,
14113
+ hasExcludedSegment,
14114
+ globToRegex,
12249
14115
  getFileExtension,
12250
14116
  generateUUID,
12251
14117
  generateId,
@@ -12269,6 +14135,7 @@ export {
12269
14135
  decisionPhaseSchema,
12270
14136
  decisionAtomSchema,
12271
14137
  dataAtomsSchema,
14138
+ createPathMatcher,
12272
14139
  contractEntitySchema,
12273
14140
  contractDataSchema,
12274
14141
  contentHash,
@@ -12287,6 +14154,13 @@ export {
12287
14154
  alternativeSchema,
12288
14155
  allowedAtomFieldSchema,
12289
14156
  adrDataSchema,
14157
+ WS_TASK_STARTED,
14158
+ WS_TASK_QUEUE_UPDATE,
14159
+ WS_TASK_QUEUED,
14160
+ WS_TASK_PROGRESS,
14161
+ WS_TASK_FAILED,
14162
+ WS_TASK_DONE,
14163
+ WS_TASK_CANCELLED,
12290
14164
  WS_SESSION_STATUS,
12291
14165
  WS_SESSION_PROGRESS,
12292
14166
  WS_LIBRARY_UPDATED,
@@ -12305,9 +14179,11 @@ export {
12305
14179
  TEXT_EXTENSIONS,
12306
14180
  SUPERTEST_USER_NAME,
12307
14181
  SUPERTEST_EMAIL,
14182
+ SCAN_EXCLUDED_DIRS,
12308
14183
  RelationType,
12309
14184
  RESERVED_USER_NAMES,
12310
14185
  Perspective,
14186
+ PathFilterConfigSchema,
12311
14187
  Kind,
12312
14188
  INDEXABLE_EXTENSIONS,
12313
14189
  INDEXABLE_DOC_EXTENSIONS,
@@ -12317,12 +14193,14 @@ export {
12317
14193
  EDGE_SYNC_RULES,
12318
14194
  DEFAULT_WORKSPACE_NAME,
12319
14195
  DEFAULT_SERVER_CONFIG,
14196
+ DEFAULT_PATH_FILTER,
12320
14197
  DEFAULT_CONTENT_TYPE_DEFINITIONS,
12321
14198
  DEFAULT_CLOUD_LIBRARY_NAME,
12322
14199
  DAEMON_OFFLINE_THRESHOLD,
12323
14200
  DAEMON_HEARTBEAT_INTERVAL,
12324
14201
  ContentTypeRegistry,
12325
14202
  CODE_PACKAGE_FILES,
14203
+ CODE_DIGEST_TYPE,
12326
14204
  CLOUD_DAEMON_IDLE_TIMEOUT,
12327
14205
  C4AError,
12328
14206
  AtomField