token-goat 2.9.21 → 2.9.23

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 (49) hide show
  1. package/THIRD_PARTY_NOTICES.md +2 -2
  2. package/dist/{token-goat-chunk-DISVHOW6.mjs → token-goat-chunk-2KNXKM4P.mjs} +4 -4
  3. package/dist/{token-goat-chunk-MEKVJZUN.mjs → token-goat-chunk-3DFULEOA.mjs} +2 -2
  4. package/dist/{token-goat-chunk-QCQUIPIP.mjs → token-goat-chunk-3U6ZYVX5.mjs} +1582 -773
  5. package/dist/{token-goat-chunk-KRPJIXCT.mjs → token-goat-chunk-45JI3MB7.mjs} +2 -2
  6. package/dist/{token-goat-chunk-ZJWPJL7O.mjs → token-goat-chunk-4BTOJTZD.mjs} +3 -3
  7. package/dist/{token-goat-chunk-FZN77SZD.mjs → token-goat-chunk-4NEYQA2B.mjs} +27 -27
  8. package/dist/{token-goat-chunk-M43UJVYQ.mjs → token-goat-chunk-5IID4N52.mjs} +5 -5
  9. package/dist/{token-goat-chunk-IAMIQLCV.mjs → token-goat-chunk-6AMDBNXA.mjs} +200 -207
  10. package/dist/{token-goat-chunk-XQSSPX3X.mjs → token-goat-chunk-7SPQ6IIS.mjs} +2 -2
  11. package/dist/{token-goat-chunk-PDYQA3AP.mjs → token-goat-chunk-7ZJCWBZI.mjs} +4 -4
  12. package/dist/{token-goat-chunk-KQI24O4B.mjs → token-goat-chunk-AIXKS6UY.mjs} +2 -2
  13. package/dist/{token-goat-chunk-T6M7DAW3.mjs → token-goat-chunk-CHLHM42P.mjs} +13 -1
  14. package/dist/{token-goat-chunk-PPYZS7TI.mjs → token-goat-chunk-DN5TDA7X.mjs} +3 -3
  15. package/dist/{token-goat-chunk-VXKT3W4C.mjs → token-goat-chunk-EYYDRFKA.mjs} +3 -3
  16. package/dist/{token-goat-chunk-ORRDWKLA.mjs → token-goat-chunk-F66GO3BZ.mjs} +1 -1
  17. package/dist/{token-goat-chunk-SMUYPBF5.mjs → token-goat-chunk-FIBB6HUJ.mjs} +51 -17
  18. package/dist/{token-goat-chunk-SHV6QQAS.mjs → token-goat-chunk-FZ7QU7BN.mjs} +1 -1
  19. package/dist/{token-goat-chunk-4V4OZHHV.mjs → token-goat-chunk-GE5FV4K4.mjs} +8 -8
  20. package/dist/{token-goat-chunk-QTIRVK3M.mjs → token-goat-chunk-GEYF6V37.mjs} +1 -1
  21. package/dist/{token-goat-chunk-MZQORUX5.mjs → token-goat-chunk-GUPX2MSL.mjs} +1 -1
  22. package/dist/{token-goat-chunk-IJUHQX2M.mjs → token-goat-chunk-J3WHKFP2.mjs} +1 -1
  23. package/dist/{token-goat-chunk-CMAJGP3E.mjs → token-goat-chunk-JIWV3M7J.mjs} +4 -4
  24. package/dist/{token-goat-chunk-PCR43MCM.mjs → token-goat-chunk-K2WEBYUH.mjs} +2 -2
  25. package/dist/{token-goat-chunk-6AQLZMCO.mjs → token-goat-chunk-K6B5REAF.mjs} +10 -14
  26. package/dist/{token-goat-chunk-M6CDVASA.mjs → token-goat-chunk-P2OWJWPJ.mjs} +1 -1
  27. package/dist/{token-goat-chunk-2ZHD3XCD.mjs → token-goat-chunk-P5DTTFWQ.mjs} +16 -2
  28. package/dist/{token-goat-chunk-KVAXTA2W.mjs → token-goat-chunk-PLIZZDYM.mjs} +10 -10
  29. package/dist/{token-goat-chunk-MQACN7VG.mjs → token-goat-chunk-QGBQOANR.mjs} +3 -3
  30. package/dist/{token-goat-chunk-BKHJRFDE.mjs → token-goat-chunk-R7SWCKV2.mjs} +14 -14
  31. package/dist/{token-goat-chunk-XJUPKJF5.mjs → token-goat-chunk-RZ5V2RJ6.mjs} +40 -32
  32. package/dist/{token-goat-chunk-MECDAPXB.mjs → token-goat-chunk-SM3XG5YA.mjs} +4 -4
  33. package/dist/{token-goat-chunk-64OEF3UN.mjs → token-goat-chunk-SVFSQRFS.mjs} +6 -6
  34. package/dist/{token-goat-chunk-BIEDTF6V.mjs → token-goat-chunk-TETLHLL4.mjs} +3 -3
  35. package/dist/{token-goat-chunk-LK3YOKDF.mjs → token-goat-chunk-UN6R6DKG.mjs} +2 -2
  36. package/dist/{token-goat-chunk-PHDNWISV.mjs → token-goat-chunk-UUCJI7X3.mjs} +3 -3
  37. package/dist/token-goat-chunk-V3CHCE6G.mjs +41 -0
  38. package/dist/{token-goat-chunk-QUM3UNWS.mjs → token-goat-chunk-VMJWBG3B.mjs} +5 -5
  39. package/dist/{token-goat-chunk-TGBSMHPM.mjs → token-goat-chunk-VVCGXBVQ.mjs} +1 -1
  40. package/dist/{token-goat-chunk-4IIU3GNS.mjs → token-goat-chunk-W3EV7NRO.mjs} +8 -8
  41. package/dist/{token-goat-chunk-OMNQUUIT.mjs → token-goat-chunk-XBESNWEX.mjs} +1 -1
  42. package/dist/{token-goat-chunk-GO7OWONJ.mjs → token-goat-chunk-XJRKKQYI.mjs} +17 -17
  43. package/dist/{token-goat-chunk-DDP64XR7.mjs → token-goat-chunk-Y4FGECX5.mjs} +3 -3
  44. package/dist/{token-goat-chunk-CZ5ZFJSN.mjs → token-goat-chunk-YBG7SMAK.mjs} +24 -22
  45. package/dist/{token-goat-chunk-CAHN4QU7.mjs → token-goat-chunk-ZVYT6SOT.mjs} +10 -10
  46. package/dist/token-goat-hook.mjs +17 -17
  47. package/dist/token-goat.core.mjs +27 -27
  48. package/package.json +1 -1
  49. package/dist/token-goat-chunk-CMHBTXMY.mjs +0 -41
@@ -2,12 +2,12 @@ import { createRequire as __cjsRequire } from 'node:module';
2
2
  const require = __cjsRequire(import.meta.url);
3
3
  import {
4
4
  getDb
5
- } from "./token-goat-chunk-2ZHD3XCD.mjs";
5
+ } from "./token-goat-chunk-P5DTTFWQ.mjs";
6
6
  import {
7
7
  foldPath,
8
8
  globalDbPath,
9
9
  isCaseInsensitiveFs
10
- } from "./token-goat-chunk-TGBSMHPM.mjs";
10
+ } from "./token-goat-chunk-VVCGXBVQ.mjs";
11
11
  import {
12
12
  normalizePath
13
13
  } from "./token-goat-chunk-NMTKNYGF.mjs";
@@ -11,18 +11,18 @@ import {
11
11
  isNoisePath,
12
12
  listSiblingSessionStates,
13
13
  loadSessionCache
14
- } from "./token-goat-chunk-MECDAPXB.mjs";
14
+ } from "./token-goat-chunk-SM3XG5YA.mjs";
15
15
  import {
16
16
  getBashOutput
17
- } from "./token-goat-chunk-M43UJVYQ.mjs";
17
+ } from "./token-goat-chunk-5IID4N52.mjs";
18
18
  import {
19
19
  loadConfig
20
- } from "./token-goat-chunk-M6CDVASA.mjs";
20
+ } from "./token-goat-chunk-P2OWJWPJ.mjs";
21
21
  import {
22
22
  foldPath,
23
23
  runGit,
24
24
  toKB
25
- } from "./token-goat-chunk-TGBSMHPM.mjs";
25
+ } from "./token-goat-chunk-VVCGXBVQ.mjs";
26
26
  import {
27
27
  displaySafePath,
28
28
  displaySafeText,
@@ -6,12 +6,12 @@ import {
6
6
  createResidentContextStats,
7
7
  estimateTokens,
8
8
  summarizeResidentContext
9
- } from "./token-goat-chunk-MEKVJZUN.mjs";
9
+ } from "./token-goat-chunk-3DFULEOA.mjs";
10
10
  import {
11
11
  commandHash,
12
12
  getBashOutput,
13
13
  normalizeCommandForCacheKey
14
- } from "./token-goat-chunk-M43UJVYQ.mjs";
14
+ } from "./token-goat-chunk-5IID4N52.mjs";
15
15
  import {
16
16
  init_define_import_meta_env
17
17
  } from "./token-goat-chunk-A37V4PBF.mjs";
@@ -4,6 +4,7 @@ import {
4
4
  $brand,
5
5
  $input,
6
6
  $output,
7
+ INVALID,
7
8
  NEVER,
8
9
  TimePrecision,
9
10
  ZodAny,
@@ -37,12 +38,14 @@ import {
37
38
  ZodFirstPartyTypeKind,
38
39
  ZodFunction,
39
40
  ZodGUID,
41
+ ZodIBAN,
40
42
  ZodIPv4,
41
43
  ZodIPv6,
42
44
  ZodISODate,
43
45
  ZodISODateTime,
44
46
  ZodISODuration,
45
47
  ZodISOTime,
48
+ ZodInstanceOf,
46
49
  ZodIntersection,
47
50
  ZodIssueCode,
48
51
  ZodJWT,
@@ -143,6 +146,7 @@ import {
143
146
  creditCard,
144
147
  cuid,
145
148
  cuid2,
149
+ currencyCode,
146
150
  custom,
147
151
  date,
148
152
  decode,
@@ -171,6 +175,7 @@ import {
171
175
  hex,
172
176
  hostname,
173
177
  httpUrl,
178
+ iban,
174
179
  input,
175
180
  int,
176
181
  int32,
@@ -251,14 +256,16 @@ import {
251
256
  uuidv7,
252
257
  validate,
253
258
  validateAsync,
259
+ withParser,
254
260
  xid,
255
261
  xor
256
- } from "./token-goat-chunk-QCQUIPIP.mjs";
262
+ } from "./token-goat-chunk-3U6ZYVX5.mjs";
257
263
  import "./token-goat-chunk-A37V4PBF.mjs";
258
264
  export {
259
265
  $brand,
260
266
  $input,
261
267
  $output,
268
+ INVALID,
262
269
  NEVER,
263
270
  TimePrecision,
264
271
  ZodAny,
@@ -292,12 +299,14 @@ export {
292
299
  ZodFirstPartyTypeKind,
293
300
  ZodFunction,
294
301
  ZodGUID,
302
+ ZodIBAN,
295
303
  ZodIPv4,
296
304
  ZodIPv6,
297
305
  ZodISODate,
298
306
  ZodISODateTime,
299
307
  ZodISODuration,
300
308
  ZodISOTime,
309
+ ZodInstanceOf,
301
310
  ZodIntersection,
302
311
  ZodIssueCode,
303
312
  ZodJWT,
@@ -363,6 +372,7 @@ export {
363
372
  creditCard,
364
373
  cuid,
365
374
  cuid2,
375
+ currencyCode,
366
376
  custom,
367
377
  date,
368
378
  decode,
@@ -396,6 +406,7 @@ export {
396
406
  hex,
397
407
  hostname,
398
408
  httpUrl,
409
+ iban,
399
410
  _includes as includes,
400
411
  input,
401
412
  _instanceof as instanceof,
@@ -507,6 +518,7 @@ export {
507
518
  validate,
508
519
  validateAsync,
509
520
  _void as void,
521
+ withParser,
510
522
  xid,
511
523
  xor,
512
524
  external_exports as z
@@ -3,14 +3,14 @@ const require = __cjsRequire(import.meta.url);
3
3
  import {
4
4
  findLatestTranscript,
5
5
  readFileLines
6
- } from "./token-goat-chunk-KQI24O4B.mjs";
6
+ } from "./token-goat-chunk-AIXKS6UY.mjs";
7
7
  import {
8
8
  copilotCliUserRoot,
9
9
  readCopilotMcpTools
10
- } from "./token-goat-chunk-MQACN7VG.mjs";
10
+ } from "./token-goat-chunk-QGBQOANR.mjs";
11
11
  import {
12
12
  canonicalize
13
- } from "./token-goat-chunk-TGBSMHPM.mjs";
13
+ } from "./token-goat-chunk-VVCGXBVQ.mjs";
14
14
  import {
15
15
  init_define_import_meta_env
16
16
  } from "./token-goat-chunk-A37V4PBF.mjs";
@@ -5,11 +5,11 @@ import {
5
5
  docxTables,
6
6
  docxText,
7
7
  formatDocxTables
8
- } from "./token-goat-chunk-ORRDWKLA.mjs";
9
- import "./token-goat-chunk-QTIRVK3M.mjs";
8
+ } from "./token-goat-chunk-F66GO3BZ.mjs";
9
+ import "./token-goat-chunk-GEYF6V37.mjs";
10
10
  import "./token-goat-chunk-XTQAOTSO.mjs";
11
11
  import "./token-goat-chunk-AH6QILZM.mjs";
12
- import "./token-goat-chunk-TGBSMHPM.mjs";
12
+ import "./token-goat-chunk-VVCGXBVQ.mjs";
13
13
  import "./token-goat-chunk-NMTKNYGF.mjs";
14
14
  import "./token-goat-chunk-Y4AFKTHK.mjs";
15
15
  import "./token-goat-chunk-GMOUBOX4.mjs";
@@ -11,7 +11,7 @@ import {
11
11
  ooxmlPartBudget,
12
12
  parseOoxmlPart,
13
13
  readOoxmlZip
14
- } from "./token-goat-chunk-QTIRVK3M.mjs";
14
+ } from "./token-goat-chunk-GEYF6V37.mjs";
15
15
  import {
16
16
  displaySafeText
17
17
  } from "./token-goat-chunk-NMTKNYGF.mjs";
@@ -3,12 +3,12 @@ const require = __cjsRequire(import.meta.url);
3
3
  import {
4
4
  isRewriteWorthwhile,
5
5
  resolveMinNetSavingsBytes
6
- } from "./token-goat-chunk-DDP64XR7.mjs";
6
+ } from "./token-goat-chunk-Y4FGECX5.mjs";
7
7
  import {
8
8
  COPILOT_CLI_TOOL_NAME_MAP,
9
9
  foldToolName,
10
10
  readCopilotMcpTools
11
- } from "./token-goat-chunk-MQACN7VG.mjs";
11
+ } from "./token-goat-chunk-QGBQOANR.mjs";
12
12
  import {
13
13
  contentHash,
14
14
  exportSessionState,
@@ -36,11 +36,11 @@ import {
36
36
  wasFileReadThisSession,
37
37
  wasFileTruncatedThisSession,
38
38
  writeSessionManifest
39
- } from "./token-goat-chunk-MECDAPXB.mjs";
39
+ } from "./token-goat-chunk-SM3XG5YA.mjs";
40
40
  import {
41
41
  claudeConfigDir,
42
42
  estimateTokens
43
- } from "./token-goat-chunk-MEKVJZUN.mjs";
43
+ } from "./token-goat-chunk-3DFULEOA.mjs";
44
44
  import {
45
45
  getBashOutput,
46
46
  isGeneratedFile,
@@ -48,7 +48,7 @@ import {
48
48
  isLockFile,
49
49
  isManifestFile,
50
50
  storeBashOutputSync
51
- } from "./token-goat-chunk-M43UJVYQ.mjs";
51
+ } from "./token-goat-chunk-5IID4N52.mjs";
52
52
  import {
53
53
  DEFAULT_MAX_AGE_MS,
54
54
  SOURCE_HINT,
@@ -60,7 +60,7 @@ import {
60
60
  savedTokensFromBytes,
61
61
  summarize,
62
62
  sweepCacheRoots
63
- } from "./token-goat-chunk-PHDNWISV.mjs";
63
+ } from "./token-goat-chunk-UUCJI7X3.mjs";
64
64
  import {
65
65
  parse
66
66
  } from "./token-goat-chunk-3BTK54F3.mjs";
@@ -94,13 +94,13 @@ import {
94
94
  maxChunksEmbedSha,
95
95
  parseSourceSymbolsTreeSitterOnly,
96
96
  parserFingerprintForLanguage
97
- } from "./token-goat-chunk-IAMIQLCV.mjs";
97
+ } from "./token-goat-chunk-6AMDBNXA.mjs";
98
98
  import {
99
99
  getFileEntry,
100
100
  pathEqClause,
101
101
  projectScopeClause,
102
102
  querySymbols
103
- } from "./token-goat-chunk-XQSSPX3X.mjs";
103
+ } from "./token-goat-chunk-7SPQ6IIS.mjs";
104
104
  import {
105
105
  detectLanguage,
106
106
  detectLanguageOfFile,
@@ -108,7 +108,7 @@ import {
108
108
  getDb,
109
109
  languageHasFlag,
110
110
  redactIfDotenv
111
- } from "./token-goat-chunk-2ZHD3XCD.mjs";
111
+ } from "./token-goat-chunk-P5DTTFWQ.mjs";
112
112
  import {
113
113
  detectHarness,
114
114
  fileIsAbsent,
@@ -122,7 +122,7 @@ import {
122
122
  ownGet,
123
123
  resolveProjectRoot,
124
124
  shortFingerprint
125
- } from "./token-goat-chunk-M6CDVASA.mjs";
125
+ } from "./token-goat-chunk-P2OWJWPJ.mjs";
126
126
  import {
127
127
  registerReset
128
128
  } from "./token-goat-chunk-EEIDFMEM.mjs";
@@ -152,7 +152,7 @@ import {
152
152
  statSize,
153
153
  toKB,
154
154
  tokenGoatHome
155
- } from "./token-goat-chunk-TGBSMHPM.mjs";
155
+ } from "./token-goat-chunk-VVCGXBVQ.mjs";
156
156
  import {
157
157
  TOOL_RESULTS_ID_CHARS,
158
158
  displaySafeJson,
@@ -1354,7 +1354,7 @@ ${dataUrl2}`);
1354
1354
  }
1355
1355
  recordStat("image_shrink", shrinkSaved, shrinkTokens, void 0, basename10);
1356
1356
  if (loadConfig().image_shrink.ocr_enabled) {
1357
- const { ocrImage, isTextHeavy, formatOcrSummary } = await import("./token-goat-chunk-QUM3UNWS.mjs");
1357
+ const { ocrImage, isTextHeavy, formatOcrSummary } = await import("./token-goat-chunk-VMJWBG3B.mjs");
1358
1358
  const ocr = await ocrImage(result.data);
1359
1359
  if (ocr !== null && isTextHeavy(ocr, loadConfig().image_shrink.ocr_min_confidence)) {
1360
1360
  const emitted = formatOcrSummary(ocr, basename10, result.originalBytes);
@@ -1534,6 +1534,7 @@ function removeFileFromIndex(db, filePath) {
1534
1534
  const tx = db.transaction(() => {
1535
1535
  deleteFileRows(db, filePath);
1536
1536
  deleteFileEmbeddings(db, filePath);
1537
+ db.prepare(`DELETE FROM index_retries WHERE ${pathEqClause("path")}`).run(foldPath(filePath));
1537
1538
  });
1538
1539
  tx.immediate();
1539
1540
  }
@@ -1638,6 +1639,31 @@ function orphanedChunkGroups(db) {
1638
1639
  }
1639
1640
  return [...byFolded.values()];
1640
1641
  }
1642
+ function findDeadRetryPaths(dbPath = globalDbPath()) {
1643
+ const rows = getDb(dbPath).prepare("SELECT path FROM index_retries").all();
1644
+ return rows.map((r) => r.path).filter(pathIsGone);
1645
+ }
1646
+ function pathIsGone(p) {
1647
+ try {
1648
+ return fs6.statSync(p, { throwIfNoEntry: false }) === void 0;
1649
+ } catch {
1650
+ return false;
1651
+ }
1652
+ }
1653
+ function pruneDeadRetryRows(dbPath = globalDbPath()) {
1654
+ const db = getDb(dbPath);
1655
+ const stmt = db.prepare(`DELETE FROM index_retries WHERE ${pathEqClause("path")}`);
1656
+ const removed = [];
1657
+ for (const p of findDeadRetryPaths(dbPath)) {
1658
+ if (!pathIsGone(p)) continue;
1659
+ try {
1660
+ stmt.run(foldPath(p));
1661
+ removed.push(p);
1662
+ } catch {
1663
+ }
1664
+ }
1665
+ return removed;
1666
+ }
1641
1667
  function pruneOrphanedChunks(dbPath = globalDbPath()) {
1642
1668
  const db = getDb(dbPath);
1643
1669
  const removed = [];
@@ -1715,7 +1741,15 @@ function sweepKnownRoots(dbPath = globalDbPath(), opts) {
1715
1741
  }
1716
1742
  const prunedOrphanChunkPaths = dryRun ? findOrphanedChunkPaths(dbPath) : pruneOrphanedChunks(dbPath);
1717
1743
  const prunedOrphanVectors = dryRun ? 0 : pruneOrphanedVectors(dbPath);
1718
- return { prunedRows, prunedRoots, flaggedRoots, prunedOrphanChunkPaths, prunedOrphanVectors };
1744
+ const prunedDeadRetryPaths = dryRun ? findDeadRetryPaths(dbPath) : pruneDeadRetryRows(dbPath);
1745
+ return {
1746
+ prunedRows,
1747
+ prunedRoots,
1748
+ flaggedRoots,
1749
+ prunedOrphanChunkPaths,
1750
+ prunedOrphanVectors,
1751
+ prunedDeadRetryPaths
1752
+ };
1719
1753
  }
1720
1754
  function findTopIndexedProjects(dbPath = globalDbPath(), limit = 3) {
1721
1755
  try {
@@ -2159,13 +2193,13 @@ function bumpRetryCount(dbPath, absPath) {
2159
2193
  const normalized = normalizePath(absPath);
2160
2194
  const folded = foldPath(normalized);
2161
2195
  const tx = db.transaction(() => {
2162
- const row = db.prepare(`SELECT retry_count FROM files WHERE ${pathEqClause("path")}`).get(folded);
2196
+ const row = db.prepare(`SELECT retry_count FROM index_retries WHERE ${pathEqClause("path")}`).get(folded);
2163
2197
  if (row !== void 0) {
2164
2198
  const next = (row.retry_count ?? 0) + 1;
2165
- db.prepare(`UPDATE files SET retry_count = ? WHERE ${pathEqClause("path")}`).run(next, folded);
2199
+ db.prepare(`UPDATE index_retries SET retry_count = ? WHERE ${pathEqClause("path")}`).run(next, folded);
2166
2200
  return next;
2167
2201
  }
2168
- db.prepare("INSERT INTO files (path, retry_count) VALUES (?, 1)").run(normalized);
2202
+ db.prepare("INSERT INTO index_retries (path, retry_count) VALUES (?, 1)").run(normalized);
2169
2203
  return 1;
2170
2204
  });
2171
2205
  return tx.immediate();
@@ -2174,7 +2208,7 @@ function clearRetryCount(dbPath, absPath) {
2174
2208
  try {
2175
2209
  const db = getDb(dbPath);
2176
2210
  const folded = foldPath(normalizePath(absPath));
2177
- db.prepare(`UPDATE files SET retry_count = 0 WHERE ${pathEqClause("path")}`).run(folded);
2211
+ db.prepare(`DELETE FROM index_retries WHERE ${pathEqClause("path")}`).run(folded);
2178
2212
  } catch {
2179
2213
  }
2180
2214
  }
@@ -5,7 +5,7 @@ import {
5
5
  } from "./token-goat-chunk-3BTK54F3.mjs";
6
6
  import {
7
7
  filtersFilteredToEmptyNotice
8
- } from "./token-goat-chunk-TGBSMHPM.mjs";
8
+ } from "./token-goat-chunk-VVCGXBVQ.mjs";
9
9
  import {
10
10
  displaySafeText
11
11
  } from "./token-goat-chunk-NMTKNYGF.mjs";
@@ -6,34 +6,34 @@ import {
6
6
  getToolName,
7
7
  getTrackedFiles,
8
8
  scanAndRecord
9
- } from "./token-goat-chunk-SMUYPBF5.mjs";
9
+ } from "./token-goat-chunk-FIBB6HUJ.mjs";
10
10
  import {
11
11
  RECALL_DEFAULT_LIMIT,
12
12
  indexRecallEntry,
13
13
  listRecentRecall,
14
14
  searchRecall
15
- } from "./token-goat-chunk-M43UJVYQ.mjs";
15
+ } from "./token-goat-chunk-5IID4N52.mjs";
16
16
  import {
17
17
  isBlobStale,
18
18
  loadBlob,
19
19
  redactSecrets,
20
20
  storeBlob
21
- } from "./token-goat-chunk-PHDNWISV.mjs";
21
+ } from "./token-goat-chunk-UUCJI7X3.mjs";
22
22
  import {
23
23
  parserFingerprintForLanguage
24
- } from "./token-goat-chunk-IAMIQLCV.mjs";
24
+ } from "./token-goat-chunk-6AMDBNXA.mjs";
25
25
  import {
26
26
  getProjectFileEntries,
27
27
  projectScopeClause
28
- } from "./token-goat-chunk-XQSSPX3X.mjs";
28
+ } from "./token-goat-chunk-7SPQ6IIS.mjs";
29
29
  import {
30
30
  getDb
31
- } from "./token-goat-chunk-2ZHD3XCD.mjs";
31
+ } from "./token-goat-chunk-P5DTTFWQ.mjs";
32
32
  import {
33
33
  fingerprintFile,
34
34
  getDisplayRoot,
35
35
  shortFingerprint
36
- } from "./token-goat-chunk-M6CDVASA.mjs";
36
+ } from "./token-goat-chunk-P2OWJWPJ.mjs";
37
37
  import {
38
38
  registerReset
39
39
  } from "./token-goat-chunk-EEIDFMEM.mjs";
@@ -44,7 +44,7 @@ import {
44
44
  foldPath,
45
45
  globalDbPath,
46
46
  pad
47
- } from "./token-goat-chunk-TGBSMHPM.mjs";
47
+ } from "./token-goat-chunk-VVCGXBVQ.mjs";
48
48
  import {
49
49
  UNTRUSTED_TOOL_TAG,
50
50
  UNTRUSTED_WEB_TAG,
@@ -12,7 +12,7 @@ import {
12
12
  } from "./token-goat-chunk-AH6QILZM.mjs";
13
13
  import {
14
14
  pushAll
15
- } from "./token-goat-chunk-TGBSMHPM.mjs";
15
+ } from "./token-goat-chunk-VVCGXBVQ.mjs";
16
16
  import {
17
17
  DocumentRefusedError,
18
18
  MAX_DOCUMENT_WORK_MILLIS
@@ -12,7 +12,7 @@ import {
12
12
  parseOoxmlPart,
13
13
  readOoxmlZip,
14
14
  sortNumberedParts
15
- } from "./token-goat-chunk-QTIRVK3M.mjs";
15
+ } from "./token-goat-chunk-GEYF6V37.mjs";
16
16
  import {
17
17
  compileGuardedRegex
18
18
  } from "./token-goat-chunk-GMOUBOX4.mjs";
@@ -10,7 +10,7 @@ import {
10
10
  stripMultilineStringSpan,
11
11
  stripNestedBlockCommentSpan,
12
12
  stripStringLiterals
13
- } from "./token-goat-chunk-2ZHD3XCD.mjs";
13
+ } from "./token-goat-chunk-P5DTTFWQ.mjs";
14
14
  import {
15
15
  init_define_import_meta_env
16
16
  } from "./token-goat-chunk-A37V4PBF.mjs";
@@ -7,19 +7,19 @@ import {
7
7
  dispatchArgv,
8
8
  filterByName,
9
9
  selectFilter
10
- } from "./token-goat-chunk-DDP64XR7.mjs";
10
+ } from "./token-goat-chunk-Y4FGECX5.mjs";
11
11
  import {
12
12
  capTokens,
13
13
  shlexSplit,
14
14
  storeBashOutputSync
15
- } from "./token-goat-chunk-M43UJVYQ.mjs";
15
+ } from "./token-goat-chunk-5IID4N52.mjs";
16
16
  import {
17
17
  recordStat
18
- } from "./token-goat-chunk-PHDNWISV.mjs";
18
+ } from "./token-goat-chunk-UUCJI7X3.mjs";
19
19
  import {
20
20
  detectHarness,
21
21
  loadConfig
22
- } from "./token-goat-chunk-M6CDVASA.mjs";
22
+ } from "./token-goat-chunk-P2OWJWPJ.mjs";
23
23
  import {
24
24
  init_define_import_meta_env
25
25
  } from "./token-goat-chunk-A37V4PBF.mjs";
@@ -5,11 +5,11 @@ import {
5
5
  isSupportedOcrLang,
6
6
  loadConfig,
7
7
  resolveOcrLangs
8
- } from "./token-goat-chunk-M6CDVASA.mjs";
8
+ } from "./token-goat-chunk-P2OWJWPJ.mjs";
9
9
  import {
10
10
  ensureDirSync,
11
11
  tokenGoatHome
12
- } from "./token-goat-chunk-TGBSMHPM.mjs";
12
+ } from "./token-goat-chunk-VVCGXBVQ.mjs";
13
13
  import {
14
14
  fenceUntrustedOcrText
15
15
  } from "./token-goat-chunk-NMTKNYGF.mjs";
@@ -25,11 +25,11 @@ import {
25
25
  extractSwift,
26
26
  extractThrift,
27
27
  extractWgsl
28
- } from "./token-goat-chunk-IJUHQX2M.mjs";
28
+ } from "./token-goat-chunk-J3WHKFP2.mjs";
29
29
  import {
30
30
  extractShellBannerHeading
31
- } from "./token-goat-chunk-IAMIQLCV.mjs";
32
- import "./token-goat-chunk-XQSSPX3X.mjs";
31
+ } from "./token-goat-chunk-6AMDBNXA.mjs";
32
+ import "./token-goat-chunk-7SPQ6IIS.mjs";
33
33
  import {
34
34
  GENERIC_CLAUSE,
35
35
  assignBraceBlockSpans,
@@ -40,6 +40,7 @@ import {
40
40
  findHtmlHeadingMatches,
41
41
  findMatchingBraceEndLine,
42
42
  isInsideStringLiteral,
43
+ lineTextAt,
43
44
  makeLineSymbol,
44
45
  makeSpanSymbol,
45
46
  makeSymbolEmitter,
@@ -58,15 +59,15 @@ import {
58
59
  stripMultilineStringSpan,
59
60
  stripStringLiterals,
60
61
  stripXmlComments
61
- } from "./token-goat-chunk-2ZHD3XCD.mjs";
62
- import "./token-goat-chunk-M6CDVASA.mjs";
62
+ } from "./token-goat-chunk-P5DTTFWQ.mjs";
63
+ import "./token-goat-chunk-P2OWJWPJ.mjs";
63
64
  import "./token-goat-chunk-EEIDFMEM.mjs";
64
65
  import "./token-goat-chunk-OSUFN2FV.mjs";
65
66
  import {
66
67
  countContentLines,
67
68
  escapeRegExp,
68
69
  pushAll
69
- } from "./token-goat-chunk-TGBSMHPM.mjs";
70
+ } from "./token-goat-chunk-VVCGXBVQ.mjs";
70
71
  import "./token-goat-chunk-NMTKNYGF.mjs";
71
72
  import "./token-goat-chunk-Y4AFKTHK.mjs";
72
73
  import "./token-goat-chunk-GMOUBOX4.mjs";
@@ -4403,12 +4404,6 @@ function componentName(filePath) {
4403
4404
  const normalized = filePath.replaceAll("\\", "/");
4404
4405
  return path3.posix.basename(normalized).replace(/\.[^.]+$/, "");
4405
4406
  }
4406
- function matchLine(content, offset) {
4407
- return content.slice(0, offset).split("\n").length;
4408
- }
4409
- function lineContext(content, line) {
4410
- return content.split("\n")[line - 1]?.trim() ?? "";
4411
- }
4412
4407
  function blankJsStringLiterals(content) {
4413
4408
  let out = "";
4414
4409
  let i = 0;
@@ -4464,13 +4459,14 @@ function isComponentTag(tag, allowKebab) {
4464
4459
  }
4465
4460
  function extractComponentRefs(markup, filePath, startLine, allowKebab) {
4466
4461
  const refs = [];
4462
+ const lineIndex = buildLineIndex(markup);
4467
4463
  for (const m of markup.matchAll(OPEN_TAG_RE)) {
4468
4464
  const tag = m[1] ?? "";
4469
4465
  if (!tag || !isComponentTag(tag, allowKebab)) continue;
4470
4466
  const offset = m.index ?? 0;
4471
- const relLine = matchLine(markup, offset);
4467
+ const relLine = offsetToLine(lineIndex, offset);
4472
4468
  const line = startLine - 1 + relLine;
4473
- refs.push({ filePath, name: tag, line, col: 0, context: lineContext(markup, relLine) });
4469
+ refs.push({ filePath, name: tag, line, col: 0, context: lineTextAt(markup, lineIndex, relLine) });
4474
4470
  }
4475
4471
  return refs;
4476
4472
  }
@@ -13,7 +13,7 @@ import {
13
13
  foldPath,
14
14
  projectConfigPath,
15
15
  runGit
16
- } from "./token-goat-chunk-TGBSMHPM.mjs";
16
+ } from "./token-goat-chunk-VVCGXBVQ.mjs";
17
17
  import {
18
18
  normalizeDarwinSystemAlias
19
19
  } from "./token-goat-chunk-NMTKNYGF.mjs";
@@ -15,7 +15,7 @@ import {
15
15
  foldCase,
16
16
  foldPath,
17
17
  sleepSync
18
- } from "./token-goat-chunk-TGBSMHPM.mjs";
18
+ } from "./token-goat-chunk-VVCGXBVQ.mjs";
19
19
  import {
20
20
  safeJoin
21
21
  } from "./token-goat-chunk-NMTKNYGF.mjs";
@@ -114,6 +114,12 @@ function offsetToLine(lineIndex, offset) {
114
114
  }
115
115
  return lo + 1;
116
116
  }
117
+ function lineTextAt(content, lineIndex, line) {
118
+ const start = lineIndex[line - 1];
119
+ if (start === void 0) return "";
120
+ const next = lineIndex[line];
121
+ return content.slice(start, next === void 0 ? content.length : next - 1).trim();
122
+ }
117
123
  function stripCstyleComments(text, lineCommentRe) {
118
124
  const lines = text.split("\n");
119
125
  let inComment = false;
@@ -1943,6 +1949,13 @@ CREATE TABLE IF NOT EXISTS files (
1943
1949
  -- -- no MIGRATIONS entry or SCHEMA_VERSION bump is needed for this index.
1944
1950
  CREATE INDEX IF NOT EXISTS idx_files_path_folded ON files(TG_LOWER(path));
1945
1951
 
1952
+ -- Transient-read-failure counters, keyed by path. See the note above SCHEMA_SQL for why they are not in files.
1953
+ CREATE TABLE IF NOT EXISTS index_retries (
1954
+ path TEXT PRIMARY KEY,
1955
+ retry_count INTEGER NOT NULL
1956
+ );
1957
+ CREATE INDEX IF NOT EXISTS idx_index_retries_path_folded ON index_retries(TG_LOWER(path));
1958
+
1946
1959
  CREATE TABLE IF NOT EXISTS symbols (
1947
1960
  id INTEGER PRIMARY KEY AUTOINCREMENT,
1948
1961
  file_path TEXT,
@@ -2274,7 +2287,7 @@ function rebuildFtsAtCurrentTokenizer(conn) {
2274
2287
  var MIGRATIONS = {
2275
2288
  // v1 -> v2: adds files.embed_sha, tracked separately from files.sha so embedding freshness can be gated independently of parse freshness (see makeIndexer in worker.ts). A pre-existing v1 database's `files` table predates the column, so it needs an explicit ALTER TABLE here; a brand-new database already has the column from SCHEMA_SQL's CREATE TABLE above, so the ALTER TABLE would fail with "duplicate column name" there -- swallow exactly that error and rethrow anything else, so a genuine ALTER TABLE failure is never silently lost.
2276
2289
  1: (conn) => alterTableIdempotent(conn, "ALTER TABLE files ADD COLUMN embed_sha TEXT"),
2277
- // v2 -> v3: adds files.retry_count, a durable per-path counter for consecutive transient-read-failure requeues (see MAX_TRANSIENT_RETRIES / requeueDirtyPath / clearRetryCount in worker.ts). Previously this counter lived only in an in-memory Map inside worker.ts, which meant the retry-count reset -- run at the time in the short-lived hook CLI process -- could never actually reach the long-lived detached daemon process's own copy of that Map: they are different Node processes with no shared memory, so the reset was a silent no-op in the real deployed topology. Persisting the counter in `files` makes it visible to both processes via the one thing they do share: the index DB. Same swallow-duplicate-column pattern as v1 -> v2 above.
2290
+ // v2 -> v3: adds files.retry_count, a durable per-path counter for consecutive transient-read-failure requeues (see MAX_TRANSIENT_RETRIES / requeueDirtyPath / clearRetryCount in worker.ts). Previously this counter lived only in an in-memory Map inside worker.ts, which meant the retry-count reset -- run at the time in the short-lived hook CLI process -- could never actually reach the long-lived detached daemon process's own copy of that Map: they are different Node processes with no shared memory, so the reset was a silent no-op in the real deployed topology. Persisting the counter in `files` makes it visible to both processes via the one thing they do share: the index DB. Same swallow-duplicate-column pattern as v1 -> v2 above. Superseded since: the counter shares the DB but no longer the table, because holding it in `files` meant a never-indexed path got a `files` row the moment one read failed, and three readers take a `files` row to mean the file is indexed -- see the `index_retries` comment in SCHEMA_SQL above. This column is still created for databases that predate that move; nothing reads or writes it.
2278
2291
  2: (conn) => alterTableIdempotent(conn, "ALTER TABLE files ADD COLUMN retry_count INTEGER NOT NULL DEFAULT 0"),
2279
2292
  // v8 -> v9: adds symbols.parent (see SCHEMA_VERSION comment above for why). A pre-existing v8 database's `symbols` table predates the column, so it needs an explicit ALTER TABLE here; a brand-new database already has the column from SCHEMA_SQL's CREATE TABLE above, so the ALTER TABLE would fail with "duplicate column name" there -- swallow exactly that error and rethrow anything else, same pattern as v1 -> v2 / v2 -> v3 above.
2280
2293
  8: (conn) => alterTableIdempotent(conn, "ALTER TABLE symbols ADD COLUMN parent TEXT NOT NULL DEFAULT ''"),
@@ -2406,6 +2419,7 @@ export {
2406
2419
  precedingDocComment,
2407
2420
  buildLineIndex,
2408
2421
  offsetToLine,
2422
+ lineTextAt,
2409
2423
  stripCstyleComments,
2410
2424
  stripXmlComments,
2411
2425
  scanQuotedStringEnd,
@@ -4,22 +4,22 @@ import {
4
4
  buildCopilotWasteReport,
5
5
  findProjectSession,
6
6
  isCopilotTranscript
7
- } from "./token-goat-chunk-PPYZS7TI.mjs";
7
+ } from "./token-goat-chunk-DN5TDA7X.mjs";
8
8
  import {
9
9
  buildWasteReport
10
- } from "./token-goat-chunk-KQI24O4B.mjs";
11
- import "./token-goat-chunk-MQACN7VG.mjs";
12
- import "./token-goat-chunk-MEKVJZUN.mjs";
13
- import "./token-goat-chunk-M43UJVYQ.mjs";
14
- import "./token-goat-chunk-PHDNWISV.mjs";
15
- import "./token-goat-chunk-XQSSPX3X.mjs";
16
- import "./token-goat-chunk-2ZHD3XCD.mjs";
10
+ } from "./token-goat-chunk-AIXKS6UY.mjs";
11
+ import "./token-goat-chunk-QGBQOANR.mjs";
12
+ import "./token-goat-chunk-3DFULEOA.mjs";
13
+ import "./token-goat-chunk-5IID4N52.mjs";
14
+ import "./token-goat-chunk-UUCJI7X3.mjs";
15
+ import "./token-goat-chunk-7SPQ6IIS.mjs";
16
+ import "./token-goat-chunk-P5DTTFWQ.mjs";
17
17
  import {
18
18
  resolveProjectRoot
19
- } from "./token-goat-chunk-M6CDVASA.mjs";
19
+ } from "./token-goat-chunk-P2OWJWPJ.mjs";
20
20
  import "./token-goat-chunk-EEIDFMEM.mjs";
21
21
  import "./token-goat-chunk-OSUFN2FV.mjs";
22
- import "./token-goat-chunk-TGBSMHPM.mjs";
22
+ import "./token-goat-chunk-VVCGXBVQ.mjs";
23
23
  import {
24
24
  displaySafeJson
25
25
  } from "./token-goat-chunk-NMTKNYGF.mjs";