token-goat 2.6.31 → 2.6.32

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 (34) hide show
  1. package/README.md +1 -1
  2. package/SECURITY.md +67 -3
  3. package/dist/{token-goat-chunk-VYC34TBW.mjs → token-goat-chunk-3KW5C2KQ.mjs} +1 -1
  4. package/dist/{token-goat-chunk-4WGVGN6W.mjs → token-goat-chunk-3UOG7PSZ.mjs} +12 -3
  5. package/dist/{token-goat-chunk-Q4N6SQWR.mjs → token-goat-chunk-4M7PSAO3.mjs} +8 -8
  6. package/dist/{token-goat-chunk-X7PIWZMB.mjs → token-goat-chunk-5EXIMDHA.mjs} +3 -227
  7. package/dist/{token-goat-chunk-PWD5XZ6C.mjs → token-goat-chunk-DFBD2FFU.mjs} +276 -90
  8. package/dist/{token-goat-chunk-56C3XUQY.mjs → token-goat-chunk-DNEPSN3P.mjs} +4 -4
  9. package/dist/{token-goat-chunk-N2S7UAVU.mjs → token-goat-chunk-GWZJ5SI2.mjs} +12 -2
  10. package/dist/{token-goat-chunk-P7I6LS5H.mjs → token-goat-chunk-N53GXI2Z.mjs} +39 -22
  11. package/dist/{token-goat-chunk-OIBTYBVR.mjs → token-goat-chunk-O7TGKV5I.mjs} +4 -4
  12. package/dist/{token-goat-chunk-XEJBPPD7.mjs → token-goat-chunk-RD6O3PJU.mjs} +150 -89
  13. package/dist/{token-goat-chunk-J6JTYE2B.mjs → token-goat-chunk-TBCLQTPG.mjs} +7 -7
  14. package/dist/{token-goat-chunk-QL2743EW.mjs → token-goat-chunk-W3MX4LQV.mjs} +6 -6
  15. package/dist/{token-goat-chunk-HPY7XE77.mjs → token-goat-chunk-X5OPORR4.mjs} +28 -8
  16. package/dist/{token-goat-chunk-DCGBS2YZ.mjs → token-goat-chunk-YWYITDOS.mjs} +4 -4
  17. package/dist/{token-goat-hook-chunk-YHRJMMEF.mjs → token-goat-hook-chunk-6NF4WM2U.mjs} +151 -90
  18. package/dist/token-goat-hook-chunk-ANFXTEQO.mjs +23 -0
  19. package/dist/{token-goat-hook-chunk-NIVRFAJ4.mjs → token-goat-hook-chunk-DHW6SRHR.mjs} +3 -227
  20. package/dist/{token-goat-hook-chunk-2K7FV2ME.mjs → token-goat-hook-chunk-DJZGX27J.mjs} +275 -89
  21. package/dist/{token-goat-hook-chunk-KNVHTGEX.mjs → token-goat-hook-chunk-J2ZK2FYW.mjs} +1 -1
  22. package/dist/{token-goat-hook-chunk-7WC2H3EW.mjs → token-goat-hook-chunk-K33JMLL7.mjs} +12 -3
  23. package/dist/{token-goat-hook-chunk-JT5RMRIY.mjs → token-goat-hook-chunk-LFYT4DLB.mjs} +4 -4
  24. package/dist/{token-goat-hook-chunk-5AQYD2SZ.mjs → token-goat-hook-chunk-PCP4W65Z.mjs} +4 -4
  25. package/dist/{token-goat-hook-chunk-66W63A4Y.mjs → token-goat-hook-chunk-Q5URQRIF.mjs} +39 -22
  26. package/dist/{token-goat-hook-chunk-K6HLYRRI.mjs → token-goat-hook-chunk-TBJ5PUPQ.mjs} +6 -6
  27. package/dist/{token-goat-hook-chunk-FKZ5RBT4.mjs → token-goat-hook-chunk-TKXOXN4J.mjs} +8 -8
  28. package/dist/{token-goat-hook-chunk-3OJELLK5.mjs → token-goat-hook-chunk-UXD3B4OY.mjs} +4 -4
  29. package/dist/{token-goat-hook-chunk-JVJUBWKT.mjs → token-goat-hook-chunk-VHZECEQD.mjs} +12 -2
  30. package/dist/{token-goat-hook-chunk-SJM4BUZQ.mjs → token-goat-hook-chunk-WBTHUYJP.mjs} +28 -8
  31. package/dist/token-goat-hook.mjs +7 -7
  32. package/dist/token-goat.core.mjs +7 -7
  33. package/package.json +12 -4
  34. package/dist/token-goat-hook-chunk-ULGSXGZK.mjs +0 -23
@@ -56,13 +56,13 @@ import {
56
56
  withFileLock,
57
57
  writeIfDifferent,
58
58
  writeJsonSettings
59
- } from "./token-goat-chunk-X7PIWZMB.mjs";
59
+ } from "./token-goat-chunk-5EXIMDHA.mjs";
60
60
  import {
61
61
  registerReset
62
- } from "./token-goat-chunk-VYC34TBW.mjs";
62
+ } from "./token-goat-chunk-3KW5C2KQ.mjs";
63
63
  import {
64
64
  init_define_import_meta_env
65
- } from "./token-goat-chunk-4WGVGN6W.mjs";
65
+ } from "./token-goat-chunk-3UOG7PSZ.mjs";
66
66
 
67
67
  // src/parser_types.ts
68
68
  init_define_import_meta_env();
@@ -17107,8 +17107,9 @@ function isTooShallowToPrune(rootPrefix) {
17107
17107
  return segments.length === 0;
17108
17108
  }
17109
17109
  function foldedBounds(rootPrefix) {
17110
- const prefix = rootPrefix.endsWith("/") ? rootPrefix : `${rootPrefix}/`;
17111
- return { foldedRootPrefix: foldPath(rootPrefix), foldedPrefix: foldPath(prefix) };
17110
+ const normalized = normalizePath(rootPrefix);
17111
+ const prefix = normalized.endsWith("/") ? normalized : `${normalized}/`;
17112
+ return { foldedRootPrefix: foldPath(normalized), foldedPrefix: foldPath(prefix) };
17112
17113
  }
17113
17114
  function allIndexedPaths(dbPath) {
17114
17115
  const db = getDb(dbPath);
@@ -17118,7 +17119,7 @@ function allIndexedPaths(dbPath) {
17118
17119
  function foldedPathsUnderRoot(rootPrefix, dbPath) {
17119
17120
  const { foldedRootPrefix, foldedPrefix } = foldedBounds(rootPrefix);
17120
17121
  return allIndexedPaths(dbPath).filter((p) => {
17121
- const foldedP = foldPath(p);
17122
+ const foldedP = foldPath(normalizePath(p));
17122
17123
  return foldedP === foldedRootPrefix || foldedP.startsWith(foldedPrefix);
17123
17124
  });
17124
17125
  }
@@ -17164,6 +17165,11 @@ function pruneDeletedFiles(rootPrefix, dbPath = globalDbPath()) {
17164
17165
  const db = getDb(dbPath);
17165
17166
  return removeDeletedFilesBestEffort(db, findDeletablePaths(rootPrefix, dbPath)).length;
17166
17167
  }
17168
+ function pruneBlockedRoot(rootPrefix, dbPath = globalDbPath()) {
17169
+ const normalized = normalizePath(rootPrefix);
17170
+ if (isTooShallowToPrune(normalized)) return [];
17171
+ return removeFilesBestEffort(getDb(dbPath), foldedPathsUnderRoot(normalized, dbPath));
17172
+ }
17167
17173
  function findSystemTempFiles(dbPath = globalDbPath()) {
17168
17174
  return allIndexedPaths(dbPath).filter((p) => isUnderSystemTemp(p));
17169
17175
  }
@@ -17426,7 +17432,7 @@ function cleanupWorkerStateFiles(dir) {
17426
17432
  }
17427
17433
  sweepExpiredKnownRootMarkers(dir);
17428
17434
  }
17429
- var INDEX_FAILED = Symbol("indexFailed");
17435
+ var INDEX_FAILED = /* @__PURE__ */ Symbol("indexFailed");
17430
17436
  var inFlightEmbeddings = /* @__PURE__ */ new Map();
17431
17437
  var activeEmbedSlots = 0;
17432
17438
  var embedSlotWaiters = [];
@@ -17974,6 +17980,7 @@ registerHook("pre_compact", preCompactIndexHandler, { advisory: true });
17974
17980
 
17975
17981
  // src/url_policy.ts
17976
17982
  init_define_import_meta_env();
17983
+ import { domainToUnicode } from "node:url";
17977
17984
  function wildcardToRegExp(pattern) {
17978
17985
  const escaped = pattern.replace(/[.+^${}()|[\]\\?]/g, "\\$&").replace(/\*/g, ".*");
17979
17986
  return new RegExp(`^${escaped}$`, "i");
@@ -17996,9 +18003,15 @@ function urlSpellings(url) {
17996
18003
  const parsed = new URL(url);
17997
18004
  if (parsed.hostname.endsWith(".")) parsed.hostname = parsed.hostname.replace(/\.+$/, "");
17998
18005
  if (!out.includes(parsed.href)) out.push(parsed.href);
18006
+ const spellWith = (authority) => `${parsed.protocol}//${parsed.username === "" && parsed.password === "" ? "" : `${parsed.username}${parsed.password === "" ? "" : `:${parsed.password}`}@`}${authority}${parsed.pathname}${parsed.search}${parsed.hash}`;
17999
18007
  const defaultPort = DEFAULT_PORTS[parsed.protocol];
18000
18008
  if (parsed.port === "" && defaultPort !== void 0) {
18001
- const spelled = `${parsed.protocol}//${parsed.username === "" && parsed.password === "" ? "" : `${parsed.username}${parsed.password === "" ? "" : `:${parsed.password}`}@`}${parsed.hostname}:${defaultPort}${parsed.pathname}${parsed.search}${parsed.hash}`;
18009
+ const spelled = spellWith(`${parsed.hostname}:${defaultPort}`);
18010
+ if (!out.includes(spelled)) out.push(spelled);
18011
+ }
18012
+ const unicodeHost = domainToUnicode(parsed.hostname);
18013
+ if (unicodeHost !== "" && unicodeHost !== parsed.hostname) {
18014
+ const spelled = spellWith(parsed.port === "" ? unicodeHost : `${unicodeHost}:${parsed.port}`);
18002
18015
  if (!out.includes(spelled)) out.push(spelled);
18003
18016
  }
18004
18017
  } catch {
@@ -18029,6 +18042,12 @@ function urlAuthorities(url) {
18029
18042
  const hosts = [parsed.host, parsed.hostname];
18030
18043
  const defaultPort = DEFAULT_PORTS[parsed.protocol];
18031
18044
  if (parsed.port === "" && defaultPort !== void 0) hosts.push(`${parsed.hostname}:${defaultPort}`);
18045
+ const unicodeHost = domainToUnicode(parsed.hostname);
18046
+ if (unicodeHost !== "" && unicodeHost !== parsed.hostname) {
18047
+ hosts.push(unicodeHost);
18048
+ if (parsed.port !== "") hosts.push(`${unicodeHost}:${parsed.port}`);
18049
+ else if (defaultPort !== void 0) hosts.push(`${unicodeHost}:${defaultPort}`);
18050
+ }
18032
18051
  return hosts;
18033
18052
  } catch {
18034
18053
  return null;
@@ -18290,6 +18309,7 @@ export {
18290
18309
  indexFileEmbeddings,
18291
18310
  removeFileFromIndex,
18292
18311
  pruneDeletedFiles,
18312
+ pruneBlockedRoot,
18293
18313
  findSystemTempFiles,
18294
18314
  pruneSystemTempFiles,
18295
18315
  recordKnownRootThrottled,
@@ -2,10 +2,10 @@ import { createRequire as __cjsRequire } from 'node:module';
2
2
  const require = __cjsRequire(import.meta.url);
3
3
  import {
4
4
  clearModuleCaches
5
- } from "./token-goat-chunk-VYC34TBW.mjs";
5
+ } from "./token-goat-chunk-3KW5C2KQ.mjs";
6
6
  import {
7
7
  init_define_import_meta_env
8
- } from "./token-goat-chunk-4WGVGN6W.mjs";
8
+ } from "./token-goat-chunk-3UOG7PSZ.mjs";
9
9
 
10
10
  // src/batch_serve.ts
11
11
  init_define_import_meta_env();
@@ -23,12 +23,12 @@ function captureOutput() {
23
23
  let errText = "";
24
24
  const realOut = process.stdout.write.bind(process.stdout);
25
25
  const realErr = process.stderr.write.bind(process.stderr);
26
- const sink = (append) => (chunk, enc, cb) => {
26
+ const sink = (append) => ((chunk, enc, cb) => {
27
27
  append(typeof chunk === "string" ? chunk : String(chunk));
28
28
  const done = typeof enc === "function" ? enc : cb;
29
29
  if (typeof done === "function") done();
30
30
  return true;
31
- };
31
+ });
32
32
  process.stdout.write = sink((s) => {
33
33
  out += s;
34
34
  });
@@ -82,7 +82,7 @@ import {
82
82
  runZipRead,
83
83
  symbolNamesInFile,
84
84
  upsertNote
85
- } from "./token-goat-hook-chunk-66W63A4Y.mjs";
85
+ } from "./token-goat-hook-chunk-Q5URQRIF.mjs";
86
86
  import {
87
87
  BASH_OUTPUT_SUBDIR,
88
88
  GEMINI_TOOL_NAME_MAP,
@@ -103,7 +103,7 @@ import {
103
103
  readStdinJson,
104
104
  searchRecall,
105
105
  storeWebOutput
106
- } from "./token-goat-hook-chunk-JT5RMRIY.mjs";
106
+ } from "./token-goat-hook-chunk-LFYT4DLB.mjs";
107
107
  import {
108
108
  AGENT_SALT_MARKER,
109
109
  CONTEXT_AUTOCOMPACT_TOKENS,
@@ -204,6 +204,7 @@ import {
204
204
  pptxSlideText,
205
205
  pptxTextGrep,
206
206
  pruneBlobs,
207
+ pruneBlockedRoot,
207
208
  pruneDeletedFiles,
208
209
  pruneSkillOutputs,
209
210
  pruneSystemTempFiles,
@@ -235,7 +236,7 @@ import {
235
236
  vscodeDecoderConfigured,
236
237
  walkProject,
237
238
  writeCompact
238
- } from "./token-goat-hook-chunk-SJM4BUZQ.mjs";
239
+ } from "./token-goat-hook-chunk-WBTHUYJP.mjs";
239
240
  import {
240
241
  C,
241
242
  CONFIG_KEY_ENV_OVERRIDES,
@@ -307,15 +308,15 @@ import {
307
308
  withFileLock,
308
309
  withRetryOnLock,
309
310
  writeJsonSettings
310
- } from "./token-goat-hook-chunk-NIVRFAJ4.mjs";
311
- import "./token-goat-hook-chunk-KNVHTGEX.mjs";
311
+ } from "./token-goat-hook-chunk-DHW6SRHR.mjs";
312
+ import "./token-goat-hook-chunk-J2ZK2FYW.mjs";
312
313
  import {
313
314
  __commonJS,
314
315
  __export,
315
316
  __require,
316
317
  __toESM,
317
318
  init_define_import_meta_env
318
- } from "./token-goat-hook-chunk-7WC2H3EW.mjs";
319
+ } from "./token-goat-hook-chunk-K33JMLL7.mjs";
319
320
 
320
321
  // node_modules/commander/lib/error.js
321
322
  var require_error = __commonJS({
@@ -1928,8 +1929,8 @@ Expecting one of '${allowedValues.join("', '")}'`);
1928
1929
  * @param {boolean} [combine] - if `true` or omitted, an optional value can be specified directly after the flag.
1929
1930
  * @return {Command} `this` command for chaining
1930
1931
  */
1931
- combineFlagAndOptionalValue(combine = true) {
1932
- this._combineFlagAndOptionalValue = !!combine;
1932
+ combineFlagAndOptionalValue(combine2 = true) {
1933
+ this._combineFlagAndOptionalValue = !!combine2;
1933
1934
  return this;
1934
1935
  }
1935
1936
  /**
@@ -6359,6 +6360,7 @@ var closePattern = /\\}/g;
6359
6360
  var commaPattern = /\\,/g;
6360
6361
  var periodPattern = /\\\./g;
6361
6362
  var EXPANSION_MAX = 1e5;
6363
+ var EXPANSION_MAX_LENGTH = 4e6;
6362
6364
  function numeric(str) {
6363
6365
  return !isNaN(str) ? parseInt(str, 10) : str.charCodeAt(0);
6364
6366
  }
@@ -6393,11 +6395,11 @@ function expand(str, options = {}) {
6393
6395
  if (!str) {
6394
6396
  return [];
6395
6397
  }
6396
- const { max = EXPANSION_MAX } = options;
6398
+ const { max = EXPANSION_MAX, maxLength = EXPANSION_MAX_LENGTH } = options;
6397
6399
  if (str.slice(0, 2) === "{}") {
6398
6400
  str = "\\{\\}" + str.slice(2);
6399
6401
  }
6400
- return expand_(escapeBraces(str), max, true).map(unescapeBraces);
6402
+ return expand_(escapeBraces(str), max, maxLength, true).map(unescapeBraces);
6401
6403
  }
6402
6404
  function embrace(str) {
6403
6405
  return "{" + str + "}";
@@ -6411,19 +6413,88 @@ function lte(i, y) {
6411
6413
  function gte(i, y) {
6412
6414
  return i >= y;
6413
6415
  }
6414
- function expand_(str, max, isTop) {
6415
- const expansions = [];
6416
- const m = balanced("{", "}", str);
6417
- if (!m)
6418
- return [str];
6419
- const pre = m.pre;
6420
- const post = m.post.length ? expand_(m.post, max, false) : [""];
6421
- if (/\$$/.test(m.pre)) {
6422
- for (let k = 0; k < post.length && k < max; k++) {
6423
- const expansion = pre + "{" + m.body + "}" + post[k];
6424
- expansions.push(expansion);
6416
+ function combine(acc, pre, values, max, maxLength, dropEmpties) {
6417
+ const out2 = [];
6418
+ let length = 0;
6419
+ for (let a = 0; a < acc.length; a++) {
6420
+ for (let v = 0; v < values.length; v++) {
6421
+ if (out2.length >= max)
6422
+ return out2;
6423
+ const expansion = acc[a] + pre + values[v];
6424
+ if (dropEmpties && !expansion)
6425
+ continue;
6426
+ if (length + expansion.length > maxLength)
6427
+ return out2;
6428
+ out2.push(expansion);
6429
+ length += expansion.length;
6430
+ }
6431
+ }
6432
+ return out2;
6433
+ }
6434
+ function expandSequence(body, isAlphaSequence, max, maxLength) {
6435
+ const n = body.split(/\.\./);
6436
+ const N = [];
6437
+ if (n[0] === void 0 || n[1] === void 0) {
6438
+ return N;
6439
+ }
6440
+ const x = numeric(n[0]);
6441
+ const y = numeric(n[1]);
6442
+ const width = Math.max(n[0].length, n[1].length);
6443
+ let incr = n.length === 3 && n[2] !== void 0 ? Math.max(Math.abs(numeric(n[2])), 1) : 1;
6444
+ let test = lte;
6445
+ const reverse = y < x;
6446
+ if (reverse) {
6447
+ incr *= -1;
6448
+ test = gte;
6449
+ }
6450
+ const pad2 = n.some(isPadded);
6451
+ let length = 0;
6452
+ for (let i = x; test(i, y) && N.length < max; i += incr) {
6453
+ let c;
6454
+ if (isAlphaSequence) {
6455
+ c = String.fromCharCode(i);
6456
+ if (c === "\\") {
6457
+ c = "";
6458
+ }
6459
+ } else {
6460
+ c = String(i);
6461
+ if (pad2) {
6462
+ const need = width - c.length;
6463
+ if (need > 0) {
6464
+ const z = new Array(need + 1).join("0");
6465
+ if (i < 0) {
6466
+ c = "-" + z + c.slice(1);
6467
+ } else {
6468
+ c = z + c;
6469
+ }
6470
+ }
6471
+ }
6472
+ }
6473
+ if (length + c.length > maxLength)
6474
+ break;
6475
+ N.push(c);
6476
+ length += c.length;
6477
+ }
6478
+ return N;
6479
+ }
6480
+ function expand_(str, max, maxLength, isTop) {
6481
+ let acc = [""];
6482
+ let dropEmpties = false;
6483
+ let firstGroup = true;
6484
+ for (; ; ) {
6485
+ const m = balanced("{", "}", str);
6486
+ if (!m) {
6487
+ return combine(acc, str, [""], max, maxLength, dropEmpties);
6488
+ }
6489
+ const pre = m.pre;
6490
+ if (/\$$/.test(pre)) {
6491
+ acc = combine(acc, pre + "{" + m.body + "}", [""], max, maxLength, dropEmpties && !m.post.length);
6492
+ firstGroup = false;
6493
+ if (!m.post.length)
6494
+ break;
6495
+ str = m.post;
6496
+ continue;
6425
6497
  }
6426
- } else {
6427
6498
  const isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
6428
6499
  const isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
6429
6500
  const isSequence = isNumericSequence || isAlphaSequence;
@@ -6431,75 +6502,58 @@ function expand_(str, max, isTop) {
6431
6502
  if (!isSequence && !isOptions) {
6432
6503
  if (m.post.match(/,(?!,).*\}/)) {
6433
6504
  str = m.pre + "{" + m.body + escClose + m.post;
6434
- return expand_(str, max, true);
6505
+ isTop = true;
6506
+ continue;
6435
6507
  }
6436
- return [str];
6508
+ return combine(acc, pre + "{" + m.body + "}" + m.post, [""], max, maxLength, dropEmpties);
6437
6509
  }
6438
- let n;
6510
+ if (firstGroup) {
6511
+ dropEmpties = isTop && !isSequence;
6512
+ firstGroup = false;
6513
+ }
6514
+ let values;
6439
6515
  if (isSequence) {
6440
- n = m.body.split(/\.\./);
6516
+ values = expandSequence(m.body, isAlphaSequence, max, maxLength);
6441
6517
  } else {
6442
- n = parseCommaParts(m.body);
6518
+ let n = parseCommaParts(m.body);
6443
6519
  if (n.length === 1 && n[0] !== void 0) {
6444
- n = expand_(n[0], max, false).map(embrace);
6520
+ n = expand_(n[0], max, maxLength, false).map(embrace);
6445
6521
  if (n.length === 1) {
6446
- return post.map((p) => m.pre + n[0] + p);
6447
- }
6448
- }
6449
- }
6450
- let N;
6451
- if (isSequence && n[0] !== void 0 && n[1] !== void 0) {
6452
- const x = numeric(n[0]);
6453
- const y = numeric(n[1]);
6454
- const width = Math.max(n[0].length, n[1].length);
6455
- let incr = n.length === 3 && n[2] !== void 0 ? Math.max(Math.abs(numeric(n[2])), 1) : 1;
6456
- let test = lte;
6457
- const reverse = y < x;
6458
- if (reverse) {
6459
- incr *= -1;
6460
- test = gte;
6461
- }
6462
- const pad2 = n.some(isPadded);
6463
- N = [];
6464
- for (let i = x; test(i, y) && N.length < max; i += incr) {
6465
- let c;
6466
- if (isAlphaSequence) {
6467
- c = String.fromCharCode(i);
6468
- if (c === "\\") {
6469
- c = "";
6470
- }
6471
- } else {
6472
- c = String(i);
6473
- if (pad2) {
6474
- const need = width - c.length;
6475
- if (need > 0) {
6476
- const z = new Array(need + 1).join("0");
6477
- if (i < 0) {
6478
- c = "-" + z + c.slice(1);
6479
- } else {
6480
- c = z + c;
6481
- }
6482
- }
6483
- }
6522
+ acc = combine(acc, pre + n[0], [""], max, maxLength, dropEmpties && !m.post.length);
6523
+ if (!m.post.length)
6524
+ break;
6525
+ str = m.post;
6526
+ continue;
6484
6527
  }
6485
- N.push(c);
6486
6528
  }
6487
- } else {
6488
- N = [];
6489
- for (let j = 0; j < n.length; j++) {
6490
- N.push.apply(N, expand_(n[j], max, false));
6529
+ let dropsEmpties = dropEmpties && !m.post.length && !pre;
6530
+ for (let d = 0; dropsEmpties && d < acc.length; d++) {
6531
+ if (acc[d]) {
6532
+ dropsEmpties = false;
6533
+ }
6491
6534
  }
6492
- }
6493
- for (let j = 0; j < N.length; j++) {
6494
- for (let k = 0; k < post.length && expansions.length < max; k++) {
6495
- const expansion = pre + N[j] + post[k];
6496
- if (!isTop || isSequence || expansion) {
6497
- expansions.push(expansion);
6535
+ values = [];
6536
+ let valuesLength = 0;
6537
+ outer: for (let j = 0; j < n.length; j++) {
6538
+ const expanded = expand_(n[j], max, maxLength, false);
6539
+ for (let k = 0; k < expanded.length; k++) {
6540
+ const v = expanded[k];
6541
+ if (dropsEmpties && !v)
6542
+ continue;
6543
+ if (values.length >= max || valuesLength + v.length > maxLength) {
6544
+ break outer;
6545
+ }
6546
+ values.push(v);
6547
+ valuesLength += v.length;
6498
6548
  }
6499
6549
  }
6500
6550
  }
6551
+ acc = combine(acc, pre, values, max, maxLength, dropEmpties && !m.post.length);
6552
+ if (!m.post.length)
6553
+ break;
6554
+ str = m.post;
6501
6555
  }
6502
- return expansions;
6556
+ return acc;
6503
6557
  }
6504
6558
 
6505
6559
  // node_modules/minimatch/dist/esm/assert-valid-pattern.js
@@ -6716,7 +6770,7 @@ var AST = class {
6716
6770
  get depth() {
6717
6771
  return (this.#parent?.depth ?? -1) + 1;
6718
6772
  }
6719
- [Symbol.for("nodejs.util.inspect.custom")]() {
6773
+ [/* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom")]() {
6720
6774
  return {
6721
6775
  "@@type": "AST",
6722
6776
  id: this.id,
@@ -7354,7 +7408,7 @@ var path11 = {
7354
7408
  };
7355
7409
  var sep2 = defaultPlatform === "win32" ? path11.win32.sep : path11.posix.sep;
7356
7410
  minimatch.sep = sep2;
7357
- var GLOBSTAR = Symbol("globstar **");
7411
+ var GLOBSTAR = /* @__PURE__ */ Symbol("globstar **");
7358
7412
  minimatch.GLOBSTAR = GLOBSTAR;
7359
7413
  var qmark2 = "[^/]";
7360
7414
  var star2 = qmark2 + "*?";
@@ -11446,11 +11500,15 @@ function cmdProject(opts) {
11446
11500
  cfg.worker.blocked_roots = [...cfg.worker.blocked_roots, target];
11447
11501
  saveConfigSafe(cfg);
11448
11502
  invalidateConfigCache();
11503
+ const purged = pruneBlockedRoot(target);
11449
11504
  if (opts.json === true) {
11450
- emit(JSON.stringify({ excluded: target, blocked_roots: cfg.worker.blocked_roots }, null, 2));
11505
+ emit(JSON.stringify({ excluded: target, purgedFromIndex: purged.length, blocked_roots: cfg.worker.blocked_roots }, null, 2));
11451
11506
  return;
11452
11507
  }
11453
11508
  emit(`Excluded: ${target}`);
11509
+ if (purged.length > 0) {
11510
+ emit(`Removed ${purged.length} already-indexed file${purged.length === 1 ? "" : "s"} under it from the index.`);
11511
+ }
11454
11512
  return;
11455
11513
  }
11456
11514
  if (action === "prune") {
@@ -12963,7 +13021,10 @@ async function cmdIndex(pathArg, opts = {}) {
12963
13021
  fileIdx += 1;
12964
13022
  paintProgress("scanning");
12965
13023
  const key = resolveIndexPath(f);
12966
- if (isUnderBlockedRoot(key, blockedRoots)) continue;
13024
+ if (isUnderBlockedRoot(key, blockedRoots)) {
13025
+ removeFileFromIndex(getDb(dbPath), key);
13026
+ continue;
13027
+ }
12967
13028
  if (detectLanguage(key) === "unknown" && !isEmbeddableDocument(key)) continue;
12968
13029
  if (isParseSkipEligible(key, ixCfg)) {
12969
13030
  removeFileFromIndex(getDb(dbPath), key);
@@ -13053,7 +13114,7 @@ async function cmdMcpServe() {
13053
13114
  let StdioServerTransport;
13054
13115
  try {
13055
13116
  ;
13056
- ({ createMcpServer } = await import("./token-goat-hook-chunk-K6HLYRRI.mjs"));
13117
+ ({ createMcpServer } = await import("./token-goat-hook-chunk-TBJ5PUPQ.mjs"));
13057
13118
  ({ StdioServerTransport } = await import("@modelcontextprotocol/sdk/server/stdio.js"));
13058
13119
  } catch (err2) {
13059
13120
  process.stderr.write(
@@ -13074,7 +13135,7 @@ async function cmdHook(event, opts) {
13074
13135
  if (typeof opts.harness === "string" && opts.harness.length > 0) {
13075
13136
  process.env[ENV_KEYS.HARNESS_OVERRIDE] = opts.harness;
13076
13137
  }
13077
- const { relay } = await import("./token-goat-hook-chunk-ULGSXGZK.mjs");
13138
+ const { relay } = await import("./token-goat-hook-chunk-ANFXTEQO.mjs");
13078
13139
  await relay(event);
13079
13140
  }
13080
13141
  async function cmdInstall(opts) {
@@ -13849,11 +13910,11 @@ function cmdOpenApiOutline(file, opts) {
13849
13910
  function cmdOpenApiOp(file, operation, opts) {
13850
13911
  process.exitCode = runOpenApiOp({ file, operation, ...opts });
13851
13912
  }
13852
- function cmdZipList(file, opts) {
13853
- process.exitCode = runZipList({ file, ...opts });
13913
+ async function cmdZipList(file, opts) {
13914
+ process.exitCode = await runZipList({ file, ...opts });
13854
13915
  }
13855
- function cmdZipRead(file, entry, opts) {
13856
- process.exitCode = runZipRead({ file, entry, ...opts });
13916
+ async function cmdZipRead(file, entry, opts) {
13917
+ process.exitCode = await runZipRead({ file, entry, ...opts });
13857
13918
  }
13858
13919
  function cmdPrSlice(pr, slice, opts) {
13859
13920
  process.exitCode = runPrSlice({ pr, slice, ...opts });
@@ -13911,7 +13972,7 @@ function emitExtraFileArgsNote(command, first, extras, opts = {}) {
13911
13972
  }
13912
13973
  async function cmdCompress(opts) {
13913
13974
  try {
13914
- const bashRunner = await import("./token-goat-hook-chunk-3OJELLK5.mjs");
13975
+ const bashRunner = await import("./token-goat-hook-chunk-UXD3B4OY.mjs");
13915
13976
  if (opts.compress === false) {
13916
13977
  process.exitCode = bashRunner.runRaw(opts.cmd, parseTimeout(opts.timeout, bashRunner.DEFAULT_TIMEOUT_SECONDS));
13917
13978
  return;
@@ -15507,7 +15568,7 @@ async function run(argv = process.argv) {
15507
15568
  return;
15508
15569
  }
15509
15570
  if (argv[2] === "--batch-serve" && typeof argv[3] === "string") {
15510
- const { serveBatch } = await import("./token-goat-hook-chunk-5AQYD2SZ.mjs");
15571
+ const { serveBatch } = await import("./token-goat-hook-chunk-PCP4W65Z.mjs");
15511
15572
  serveBatch(argv[3], (a) => run(a));
15512
15573
  return;
15513
15574
  }
@@ -0,0 +1,23 @@
1
+ import { createRequire as __cjsRequire } from 'node:module';
2
+ const require = __cjsRequire(import.meta.url);
3
+ import {
4
+ buildEvent,
5
+ relay,
6
+ relayInProcess
7
+ } from "./token-goat-hook-chunk-DJZGX27J.mjs";
8
+ import "./token-goat-hook-chunk-VHZECEQD.mjs";
9
+ import {
10
+ MAX_STDIN_BYTES,
11
+ readStdinJson
12
+ } from "./token-goat-hook-chunk-LFYT4DLB.mjs";
13
+ import "./token-goat-hook-chunk-WBTHUYJP.mjs";
14
+ import "./token-goat-hook-chunk-DHW6SRHR.mjs";
15
+ import "./token-goat-hook-chunk-J2ZK2FYW.mjs";
16
+ import "./token-goat-hook-chunk-K33JMLL7.mjs";
17
+ export {
18
+ MAX_STDIN_BYTES,
19
+ buildEvent,
20
+ readStdinJson,
21
+ relay,
22
+ relayInProcess
23
+ };