token-goat 2.9.30 → 2.9.31

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 (172) hide show
  1. package/README.md +24 -7
  2. package/SECURITY.md +10 -2
  3. package/THIRD_PARTY_NOTICES.md +1 -1
  4. package/dist/native/linux-arm64/tg-hook +0 -0
  5. package/dist/native/linux-x64/tg-hook +0 -0
  6. package/dist/native/win32-arm64/tg-hook.exe +0 -0
  7. package/dist/native/win32-x64/tg-hook.exe +0 -0
  8. package/dist/{token-goat-chunk-QSBRTGM2.mjs → token-goat-chunk-25TRAWET.mjs} +17 -7
  9. package/dist/token-goat-chunk-2KXO6V2B.mjs +203 -0
  10. package/dist/{token-goat-chunk-IVKIZWAB.mjs → token-goat-chunk-2M7E4PF7.mjs} +41 -12
  11. package/dist/{token-goat-chunk-SMVRN2HU.mjs → token-goat-chunk-2UPZGKKY.mjs} +2 -2
  12. package/dist/token-goat-chunk-2WLPWKHV.mjs +135 -0
  13. package/dist/token-goat-chunk-2XBMMDBD.mjs +126 -0
  14. package/dist/token-goat-chunk-32ZOY4N5.mjs +23 -0
  15. package/dist/token-goat-chunk-3EZRNKTK.mjs +188 -0
  16. package/dist/token-goat-chunk-4ADZHI7J.mjs +63 -0
  17. package/dist/token-goat-chunk-4GBVPH3D.mjs +242 -0
  18. package/dist/{token-goat-chunk-KWPNJBDH.mjs → token-goat-chunk-4GILLLWY.mjs} +7 -4
  19. package/dist/{token-goat-chunk-67TQJ76B.mjs → token-goat-chunk-4NAPX7BA.mjs} +36 -3
  20. package/dist/{token-goat-chunk-PU7V3FD6.mjs → token-goat-chunk-4SC7UJYV.mjs} +3354 -2553
  21. package/dist/token-goat-chunk-4SMRO4TO.mjs +366 -0
  22. package/dist/{token-goat-chunk-AFLYLHDH.mjs → token-goat-chunk-4ZBFWLXF.mjs} +283 -427
  23. package/dist/{token-goat-chunk-JDWCRD6M.mjs → token-goat-chunk-57BIAXJL.mjs} +73 -40
  24. package/dist/token-goat-chunk-5AC66HNP.mjs +115 -0
  25. package/dist/token-goat-chunk-5IMLKSOP.mjs +145 -0
  26. package/dist/token-goat-chunk-646E6U44.mjs +398 -0
  27. package/dist/token-goat-chunk-65N4RHP4.mjs +33 -0
  28. package/dist/{token-goat-chunk-JN4XMLSD.mjs → token-goat-chunk-6DG6HWP3.mjs} +8 -2
  29. package/dist/token-goat-chunk-6ENQSNRZ.mjs +573 -0
  30. package/dist/token-goat-chunk-6ZY4GNF2.mjs +91 -0
  31. package/dist/{token-goat-chunk-VPBBTSJR.mjs → token-goat-chunk-76FGDLRO.mjs} +262 -255
  32. package/dist/{token-goat-chunk-7IN2MKDS.mjs → token-goat-chunk-7EZTZOMC.mjs} +121 -289
  33. package/dist/{token-goat-chunk-OJBNYTJP.mjs → token-goat-chunk-7MAOA6X4.mjs} +640 -80
  34. package/dist/token-goat-chunk-7R2ZVVAX.mjs +218 -0
  35. package/dist/{token-goat-chunk-PD5VKH46.mjs → token-goat-chunk-AUNGYYQX.mjs} +2 -2
  36. package/dist/{token-goat-chunk-HG45AF2B.mjs → token-goat-chunk-AUQYRMMH.mjs} +794 -37
  37. package/dist/token-goat-chunk-B3PEKBYG.mjs +128 -0
  38. package/dist/{token-goat-chunk-A3CK6N5Z.mjs → token-goat-chunk-BA4HI6BW.mjs} +1309 -110
  39. package/dist/{token-goat-chunk-JB6QN6VF.mjs → token-goat-chunk-BFCWY73P.mjs} +59 -23
  40. package/dist/{token-goat-chunk-B45VMIIH.mjs → token-goat-chunk-BWGFUZZE.mjs} +7 -5
  41. package/dist/{token-goat-chunk-P4QMM4WK.mjs → token-goat-chunk-C75NA7PL.mjs} +50 -23
  42. package/dist/token-goat-chunk-CBIQ7WTD.mjs +87 -0
  43. package/dist/token-goat-chunk-CETM74KC.mjs +307 -0
  44. package/dist/{token-goat-chunk-H2PHHGM5.mjs → token-goat-chunk-CIMQ2BB3.mjs} +57 -12
  45. package/dist/{token-goat-chunk-N2NMER56.mjs → token-goat-chunk-CJLS3CDL.mjs} +46 -4
  46. package/dist/{token-goat-chunk-VES7EL7O.mjs → token-goat-chunk-CO3UYX6G.mjs} +1 -1
  47. package/dist/token-goat-chunk-COPNXRJM.mjs +154 -0
  48. package/dist/token-goat-chunk-CSJ5L3NL.mjs +479 -0
  49. package/dist/{token-goat-chunk-4LCCNRTG.mjs → token-goat-chunk-CVCEVUGK.mjs} +8 -6
  50. package/dist/{token-goat-chunk-B2RZZCSS.mjs → token-goat-chunk-CXHOFN7R.mjs} +37 -20
  51. package/dist/token-goat-chunk-D735C4QM.mjs +603 -0
  52. package/dist/{token-goat-chunk-APGZXSPS.mjs → token-goat-chunk-DGS2LVNA.mjs} +47 -30
  53. package/dist/{token-goat-chunk-54K3EUV3.mjs → token-goat-chunk-DOWRSMWO.mjs} +1 -1
  54. package/dist/token-goat-chunk-E45INMY3.mjs +71 -0
  55. package/dist/token-goat-chunk-EC5F37F4.mjs +244 -0
  56. package/dist/{token-goat-chunk-XTQAOTSO.mjs → token-goat-chunk-EDBDRVH5.mjs} +4 -1
  57. package/dist/{token-goat-chunk-5BCIJXMO.mjs → token-goat-chunk-EELTBKDM.mjs} +14 -10
  58. package/dist/{token-goat-chunk-W3QCJS6G.mjs → token-goat-chunk-F4HYL64R.mjs} +8 -6
  59. package/dist/token-goat-chunk-F6PAUIEK.mjs +624 -0
  60. package/dist/token-goat-chunk-FDSREWLX.mjs +692 -0
  61. package/dist/token-goat-chunk-GGGG7RWB.mjs +236 -0
  62. package/dist/{token-goat-chunk-C63JQV5K.mjs → token-goat-chunk-GL3ETKSC.mjs} +233 -15
  63. package/dist/token-goat-chunk-GVB2MUST.mjs +1298 -0
  64. package/dist/token-goat-chunk-GWFLAUMQ.mjs +307 -0
  65. package/dist/{token-goat-chunk-ZEJVMUQH.mjs → token-goat-chunk-HLPW63A7.mjs} +2 -2
  66. package/dist/{token-goat-chunk-GOLEOXZP.mjs → token-goat-chunk-HU4TORC5.mjs} +44 -26
  67. package/dist/{token-goat-chunk-Z57YODA2.mjs → token-goat-chunk-I7VKZZAW.mjs} +2 -2
  68. package/dist/{token-goat-chunk-NYKZLXMK.mjs → token-goat-chunk-IA6XSPE3.mjs} +6 -6
  69. package/dist/{token-goat-chunk-E3OQX2XT.mjs → token-goat-chunk-IAGXMHIK.mjs} +81 -42
  70. package/dist/{token-goat-chunk-HYBFA5X3.mjs → token-goat-chunk-IK2DRMFX.mjs} +24 -68
  71. package/dist/{token-goat-chunk-COBQGL5S.mjs → token-goat-chunk-INNPTRUX.mjs} +249 -299
  72. package/dist/{token-goat-chunk-7NADEDKJ.mjs → token-goat-chunk-JJ5BX4F4.mjs} +6 -1
  73. package/dist/{token-goat-chunk-PEPTHRFF.mjs → token-goat-chunk-JVFSHVFJ.mjs} +6 -6
  74. package/dist/token-goat-chunk-KGEFFSHD.mjs +50 -0
  75. package/dist/token-goat-chunk-KQBLRPBN.mjs +433 -0
  76. package/dist/{token-goat-chunk-Q5VTGRH7.mjs → token-goat-chunk-LCNQ2CNN.mjs} +55 -319
  77. package/dist/token-goat-chunk-M3LFJDPU.mjs +58 -0
  78. package/dist/token-goat-chunk-M52KPT3C.mjs +87 -0
  79. package/dist/token-goat-chunk-MBEG42H7.mjs +150 -0
  80. package/dist/{token-goat-chunk-EVC4TOLE.mjs → token-goat-chunk-METECDOH.mjs} +3 -12
  81. package/dist/{token-goat-chunk-T4FK7VOV.mjs → token-goat-chunk-MHX7XCC3.mjs} +2 -1
  82. package/dist/token-goat-chunk-N5LSOVSU.mjs +137 -0
  83. package/dist/{token-goat-chunk-LOBGHXPB.mjs → token-goat-chunk-N5MMR2IW.mjs} +1 -1
  84. package/dist/token-goat-chunk-N7B3JQ2C.mjs +160 -0
  85. package/dist/{token-goat-chunk-RHXKCZX3.mjs → token-goat-chunk-NISNMD7T.mjs} +2182 -2959
  86. package/dist/token-goat-chunk-NMD42SFQ.mjs +434 -0
  87. package/dist/token-goat-chunk-NOSS5VWY.mjs +174 -0
  88. package/dist/{token-goat-chunk-KQNZDCBD.mjs → token-goat-chunk-NSNSPPBG.mjs} +25 -3
  89. package/dist/token-goat-chunk-OBOFIHKN.mjs +38 -0
  90. package/dist/token-goat-chunk-OBRFJ5O5.mjs +76 -0
  91. package/dist/{token-goat-chunk-JTQQGXZH.mjs → token-goat-chunk-ODBT2USM.mjs} +124 -57
  92. package/dist/token-goat-chunk-OS5EM5PP.mjs +107 -0
  93. package/dist/token-goat-chunk-OUKDTVNU.mjs +1178 -0
  94. package/dist/token-goat-chunk-OXFMP75N.mjs +566 -0
  95. package/dist/{token-goat-chunk-DZX2YDPT.mjs → token-goat-chunk-OYIYKDDT.mjs} +2 -2
  96. package/dist/{token-goat-chunk-QCLDAQTS.mjs → token-goat-chunk-P6HQSWQ3.mjs} +50 -53
  97. package/dist/token-goat-chunk-P6VGNTQT.mjs +71 -0
  98. package/dist/{token-goat-chunk-7BXSNBY5.mjs → token-goat-chunk-PFWIMH2E.mjs} +23 -15
  99. package/dist/token-goat-chunk-PJZXIS3G.mjs +39 -0
  100. package/dist/token-goat-chunk-PUO5INXP.mjs +606 -0
  101. package/dist/{token-goat-chunk-GFBSN7BD.mjs → token-goat-chunk-PX5PQWTY.mjs} +22 -250
  102. package/dist/token-goat-chunk-Q5QDBC6O.mjs +111 -0
  103. package/dist/token-goat-chunk-QFNQXSDT.mjs +40 -0
  104. package/dist/{token-goat-chunk-FBNQNSJK.mjs → token-goat-chunk-QH7YVYOY.mjs} +2198 -2782
  105. package/dist/{token-goat-chunk-64FBPDTK.mjs → token-goat-chunk-QLMUHEPB.mjs} +12 -9
  106. package/dist/{token-goat-chunk-RZRTDST7.mjs → token-goat-chunk-QQOJIHL3.mjs} +37 -11
  107. package/dist/{token-goat-chunk-XKI4SEMX.mjs → token-goat-chunk-QQTWJY2O.mjs} +19 -0
  108. package/dist/{token-goat-chunk-U4N3BN2W.mjs → token-goat-chunk-QYHO5CPH.mjs} +3 -2
  109. package/dist/token-goat-chunk-RELAVWAD.mjs +27 -0
  110. package/dist/{token-goat-chunk-ETBHVDB6.mjs → token-goat-chunk-RSLPOBKQ.mjs} +22 -11
  111. package/dist/token-goat-chunk-SAMFDIS2.mjs +712 -0
  112. package/dist/token-goat-chunk-SDELXLDM.mjs +48 -0
  113. package/dist/{token-goat-chunk-4JJS54TR.mjs → token-goat-chunk-SOAFZNNZ.mjs} +161 -38
  114. package/dist/{token-goat-chunk-664RTTUV.mjs → token-goat-chunk-SRTHT7KV.mjs} +21 -16
  115. package/dist/{token-goat-chunk-4FVIAHSI.mjs → token-goat-chunk-T5P5ACNQ.mjs} +7 -6
  116. package/dist/token-goat-chunk-T5YGG4V3.mjs +45 -0
  117. package/dist/token-goat-chunk-TAUZ4OFS.mjs +110 -0
  118. package/dist/{token-goat-chunk-COTXZHTS.mjs → token-goat-chunk-TM6MC754.mjs} +4 -3
  119. package/dist/token-goat-chunk-TWUKBOMP.mjs +72 -0
  120. package/dist/{token-goat-chunk-3CHUNJ2O.mjs → token-goat-chunk-U2KSB4SG.mjs} +8 -5
  121. package/dist/{token-goat-chunk-3Z5S4KGM.mjs → token-goat-chunk-U4WHMG6Y.mjs} +29 -49
  122. package/dist/{token-goat-chunk-PY533T7F.mjs → token-goat-chunk-UGJHGR5A.mjs} +21 -15
  123. package/dist/{token-goat-chunk-CYCEYAEO.mjs → token-goat-chunk-UOUDVA5U.mjs} +1 -1
  124. package/dist/{token-goat-chunk-JDHE26RP.mjs → token-goat-chunk-URRJ33GR.mjs} +16 -5
  125. package/dist/{token-goat-chunk-56EIMS3E.mjs → token-goat-chunk-UZOROKIS.mjs} +23 -17
  126. package/dist/{token-goat-chunk-CZ3LUXYZ.mjs → token-goat-chunk-VIHGGGEI.mjs} +427 -308
  127. package/dist/token-goat-chunk-VTJLAA7P.mjs +21 -0
  128. package/dist/token-goat-chunk-VWDXLT4F.mjs +678 -0
  129. package/dist/{token-goat-chunk-YARZFCZS.mjs → token-goat-chunk-VWZA2H4P.mjs} +62 -53
  130. package/dist/{token-goat-chunk-SQSSNQPE.mjs → token-goat-chunk-VXEXMJDL.mjs} +3979 -4745
  131. package/dist/token-goat-chunk-WBA5SKT4.mjs +547 -0
  132. package/dist/{token-goat-chunk-SJHWVNDQ.mjs → token-goat-chunk-WDH44VAU.mjs} +7 -4
  133. package/dist/token-goat-chunk-X2SUP3EI.mjs +107 -0
  134. package/dist/token-goat-chunk-X3BELZSJ.mjs +125 -0
  135. package/dist/{token-goat-chunk-FZ3NEW5O.mjs → token-goat-chunk-XLRBNZCC.mjs} +13 -8
  136. package/dist/{token-goat-chunk-Z44YO3QZ.mjs → token-goat-chunk-XRKUX6CM.mjs} +1 -1
  137. package/dist/token-goat-chunk-XX6O25RN.mjs +82 -0
  138. package/dist/token-goat-chunk-XZSUHBVS.mjs +65 -0
  139. package/dist/{token-goat-chunk-WY3L4DVT.mjs → token-goat-chunk-Y2ZTQOCL.mjs} +13 -8
  140. package/dist/{token-goat-chunk-UQ5UK2T7.mjs → token-goat-chunk-YB4VMGK2.mjs} +1 -1
  141. package/dist/token-goat-chunk-YBIIY3HR.mjs +51 -0
  142. package/dist/{token-goat-chunk-ZQSJMO2R.mjs → token-goat-chunk-YHVDKQBR.mjs} +105 -105
  143. package/dist/{token-goat-chunk-H2K3QP6H.mjs → token-goat-chunk-YJB5XLWI.mjs} +8 -6
  144. package/dist/{token-goat-chunk-ZCDTCVIS.mjs → token-goat-chunk-YKB6AQG3.mjs} +5 -2
  145. package/dist/token-goat-chunk-YMTG2YA5.mjs +35 -0
  146. package/dist/token-goat-chunk-YPBZYQRV.mjs +40 -0
  147. package/dist/{token-goat-chunk-HOJLCGDP.mjs → token-goat-chunk-YY6AVUFL.mjs} +2033 -2251
  148. package/dist/token-goat-chunk-Z7N5OMMP.mjs +98 -0
  149. package/dist/token-goat-chunk-ZNMNUPAZ.mjs +938 -0
  150. package/dist/token-goat-hook-client.cjs +1 -1
  151. package/dist/token-goat-hook-client.mjs +3 -3
  152. package/dist/token-goat-hook.mjs +67 -38
  153. package/dist/token-goat.core.mjs +4 -4
  154. package/docs/C4_RUNTIME_ARCHITECTURE.md +1 -1
  155. package/docs/cli.md +40 -21
  156. package/docs/install.md +19 -9
  157. package/docs/security.md +5 -3
  158. package/package.json +2 -1
  159. package/dist/token-goat-chunk-5KDMCMF2.mjs +0 -362
  160. package/dist/token-goat-chunk-6QMAS7AB.mjs +0 -42
  161. package/dist/token-goat-chunk-7F2UBPD3.mjs +0 -397
  162. package/dist/token-goat-chunk-ARDNEC2U.mjs +0 -248
  163. package/dist/token-goat-chunk-ATCPY7EQ.mjs +0 -134
  164. package/dist/token-goat-chunk-EFHMMIGP.mjs +0 -68
  165. package/dist/token-goat-chunk-IVALLT3S.mjs +0 -48
  166. package/dist/token-goat-chunk-JDU3EXSU.mjs +0 -65
  167. package/dist/token-goat-chunk-MKPF4CL5.mjs +0 -37
  168. package/dist/token-goat-chunk-RC35RBUL.mjs +0 -312
  169. package/dist/token-goat-chunk-USILZ3T3.mjs +0 -53
  170. package/dist/token-goat-chunk-VL3YIFHZ.mjs +0 -2975
  171. package/dist/token-goat-chunk-XU4P6Z24.mjs +0 -133
  172. package/dist/token-goat-chunk-Y776AENC.mjs +0 -1597
@@ -0,0 +1,150 @@
1
+ import { createRequire as __cjsRequire } from 'node:module';
2
+ const require = __cjsRequire(import.meta.url);
3
+ import {
4
+ ABSENT_PIN,
5
+ ConfinementIdentityError,
6
+ DELETED_TAG,
7
+ docCommentLines,
8
+ emitGuarded,
9
+ fileExists,
10
+ fileIdentity,
11
+ fileIsGone,
12
+ findSpecSeparator,
13
+ guardJsonRows,
14
+ guardText,
15
+ healStaleIndex,
16
+ healStaleResultFiles,
17
+ indexFileSyncPinned,
18
+ indexFreshness,
19
+ isValidUtf8,
20
+ largestFileSize,
21
+ pinKey,
22
+ readFileBytes,
23
+ readFileText,
24
+ recordReadStat,
25
+ recordStaleServed,
26
+ resolveAgainstProjectRoot,
27
+ resolveBody,
28
+ runGrep,
29
+ runImageMeta,
30
+ runImageText,
31
+ runPdfExtractText,
32
+ runPdfLocate,
33
+ runPdfMeta,
34
+ runPdfOutline,
35
+ runPrSlice,
36
+ runRead,
37
+ runScreenshot,
38
+ sinkGoneRows,
39
+ staleWarning,
40
+ sumFileSizes,
41
+ truncationFooter,
42
+ truncationNotice,
43
+ warnIfFilesStale,
44
+ withPinnedReads
45
+ } from "./token-goat-chunk-4SC7UJYV.mjs";
46
+ import "./token-goat-chunk-QQTWJY2O.mjs";
47
+ import "./token-goat-chunk-EC5F37F4.mjs";
48
+ import "./token-goat-chunk-ZNMNUPAZ.mjs";
49
+ import "./token-goat-chunk-32ZOY4N5.mjs";
50
+ import "./token-goat-chunk-SOAFZNNZ.mjs";
51
+ import "./token-goat-chunk-M52KPT3C.mjs";
52
+ import "./token-goat-chunk-CJLS3CDL.mjs";
53
+ import "./token-goat-chunk-VWZA2H4P.mjs";
54
+ import "./token-goat-chunk-N5LSOVSU.mjs";
55
+ import "./token-goat-chunk-OBOFIHKN.mjs";
56
+ import "./token-goat-chunk-QH7YVYOY.mjs";
57
+ import "./token-goat-chunk-NOSS5VWY.mjs";
58
+ import "./token-goat-chunk-NMD42SFQ.mjs";
59
+ import "./token-goat-chunk-SAMFDIS2.mjs";
60
+ import "./token-goat-chunk-4SMRO4TO.mjs";
61
+ import "./token-goat-chunk-WBA5SKT4.mjs";
62
+ import "./token-goat-chunk-MNWKPRAL.mjs";
63
+ import "./token-goat-chunk-CIMQ2BB3.mjs";
64
+ import "./token-goat-chunk-WDH44VAU.mjs";
65
+ import "./token-goat-chunk-BPGCUMR7.mjs";
66
+ import "./token-goat-chunk-KQBLRPBN.mjs";
67
+ import "./token-goat-chunk-4ZBFWLXF.mjs";
68
+ import "./token-goat-chunk-C75NA7PL.mjs";
69
+ import "./token-goat-chunk-CBIQ7WTD.mjs";
70
+ import "./token-goat-chunk-P6VGNTQT.mjs";
71
+ import "./token-goat-chunk-76FGDLRO.mjs";
72
+ import "./token-goat-chunk-GL3ETKSC.mjs";
73
+ import "./token-goat-chunk-OXFMP75N.mjs";
74
+ import "./token-goat-chunk-NISNMD7T.mjs";
75
+ import "./token-goat-chunk-EVMZJ27Z.mjs";
76
+ import "./token-goat-chunk-IK2DRMFX.mjs";
77
+ import "./token-goat-chunk-5Y6ZYL6U.mjs";
78
+ import "./token-goat-chunk-4NAPX7BA.mjs";
79
+ import "./token-goat-chunk-U4WHMG6Y.mjs";
80
+ import "./token-goat-chunk-GVB2MUST.mjs";
81
+ import "./token-goat-chunk-XB5KKOCG.mjs";
82
+ import "./token-goat-chunk-OUKDTVNU.mjs";
83
+ import "./token-goat-chunk-3BTK54F3.mjs";
84
+ import "./token-goat-chunk-4GILLLWY.mjs";
85
+ import "./token-goat-chunk-BFCWY73P.mjs";
86
+ import "./token-goat-chunk-KGEFFSHD.mjs";
87
+ import "./token-goat-chunk-XX6O25RN.mjs";
88
+ import "./token-goat-chunk-HAVAOB3S.mjs";
89
+ import "./token-goat-chunk-F6PAUIEK.mjs";
90
+ import "./token-goat-chunk-65N4RHP4.mjs";
91
+ import "./token-goat-chunk-X2SUP3EI.mjs";
92
+ import "./token-goat-chunk-25TRAWET.mjs";
93
+ import "./token-goat-chunk-T5P5ACNQ.mjs";
94
+ import "./token-goat-chunk-7EZTZOMC.mjs";
95
+ import "./token-goat-chunk-QYHO5CPH.mjs";
96
+ import "./token-goat-chunk-4GBVPH3D.mjs";
97
+ import "./token-goat-chunk-YZAAZU2S.mjs";
98
+ import "./token-goat-chunk-IVE6U7KV.mjs";
99
+ import "./token-goat-chunk-EDBDRVH5.mjs";
100
+ import "./token-goat-chunk-AH6QILZM.mjs";
101
+ import "./token-goat-chunk-Y4AFKTHK.mjs";
102
+ import "./token-goat-chunk-HU4TORC5.mjs";
103
+ import "./token-goat-chunk-GGGG7RWB.mjs";
104
+ import "./token-goat-chunk-AM5V6GSX.mjs";
105
+ import "./token-goat-chunk-FNFBKLRD.mjs";
106
+ import "./token-goat-chunk-CO3UYX6G.mjs";
107
+ import "./token-goat-chunk-A37V4PBF.mjs";
108
+ export {
109
+ ABSENT_PIN,
110
+ ConfinementIdentityError,
111
+ DELETED_TAG,
112
+ docCommentLines,
113
+ emitGuarded,
114
+ fileExists,
115
+ fileIdentity,
116
+ fileIsGone,
117
+ findSpecSeparator,
118
+ guardJsonRows,
119
+ guardText,
120
+ healStaleIndex,
121
+ healStaleResultFiles,
122
+ indexFileSyncPinned,
123
+ indexFreshness,
124
+ isValidUtf8,
125
+ largestFileSize,
126
+ pinKey,
127
+ readFileBytes,
128
+ readFileText,
129
+ recordReadStat,
130
+ recordStaleServed,
131
+ resolveAgainstProjectRoot,
132
+ resolveBody,
133
+ runGrep,
134
+ runImageMeta,
135
+ runImageText,
136
+ runPdfExtractText,
137
+ runPdfLocate,
138
+ runPdfMeta,
139
+ runPdfOutline,
140
+ runPrSlice,
141
+ runRead,
142
+ runScreenshot,
143
+ sinkGoneRows,
144
+ staleWarning,
145
+ sumFileSizes,
146
+ truncationFooter,
147
+ truncationNotice,
148
+ warnIfFilesStale,
149
+ withPinnedReads
150
+ };
@@ -16,9 +16,7 @@ var StdioServerTransport = class {
16
16
  onmessage;
17
17
  onclose;
18
18
  onerror;
19
- // Arrow properties rather than bound methods so `off()` can remove the exact same function
20
- // reference `on()` added -- a fresh `.bind(this)` at removal time would leave the listener
21
- // attached, and a second `mcp-serve` in the same process would then see every message twice.
19
+ // Arrow properties rather than bound methods so `off()` can remove the exact same function reference `on()` added -- a fresh `.bind(this)` at removal time would leave the listener attached, and a second `mcp-serve` in the same process would then see every message twice.
22
20
  ondata = (chunk) => {
23
21
  const size = (this.buffer?.length ?? 0) + chunk.length;
24
22
  if (size > STDIO_MAX_BUFFER_BYTES) {
@@ -44,11 +42,7 @@ var StdioServerTransport = class {
44
42
  this.stdin.on("error", this.onstreamerror);
45
43
  return Promise.resolve();
46
44
  }
47
- /**
48
- * Consumes every complete line currently buffered. A line that is not valid JSON is reported and
49
- * skipped rather than closing the connection: one malformed message is not a reason to drop a
50
- * working session, and the next line may well be fine.
51
- */
45
+ /** Consumes every complete line currently buffered. A line that is not valid JSON is reported and skipped rather than closing the connection: one malformed message is not a reason to drop a working session, and the next line may well be fine. */
52
46
  drain() {
53
47
  for (; ; ) {
54
48
  const buffer = this.buffer;
@@ -68,10 +62,7 @@ var StdioServerTransport = class {
68
62
  this.onmessage?.(message);
69
63
  }
70
64
  }
71
- /**
72
- * Resolves once the message is handed off. Waiting for `drain` when the stream says it is full
73
- * is what keeps a long reply from being silently truncated on a slow or small pipe.
74
- */
65
+ /** Resolves once the message is handed off. Waiting for `drain` when the stream says it is full is what keeps a long reply from being silently truncated on a slow or small pipe. */
75
66
  send(message) {
76
67
  return new Promise((resolve) => {
77
68
  if (this.stdout.write(`${JSON.stringify(message)}
@@ -11,8 +11,9 @@ import {
11
11
  openReadonlySqlite,
12
12
  runReadOnlySqliteQuery,
13
13
  validateReadOnlySelect
14
- } from "./token-goat-chunk-ZCDTCVIS.mjs";
14
+ } from "./token-goat-chunk-YKB6AQG3.mjs";
15
15
  import "./token-goat-chunk-XB5KKOCG.mjs";
16
+ import "./token-goat-chunk-GGGG7RWB.mjs";
16
17
  import "./token-goat-chunk-FNFBKLRD.mjs";
17
18
  import "./token-goat-chunk-A37V4PBF.mjs";
18
19
  export {
@@ -0,0 +1,137 @@
1
+ import { createRequire as __cjsRequire } from 'node:module';
2
+ const require = __cjsRequire(import.meta.url);
3
+ import {
4
+ init_define_import_meta_env
5
+ } from "./token-goat-chunk-A37V4PBF.mjs";
6
+
7
+ // src/process_tree.ts
8
+ init_define_import_meta_env();
9
+ import { spawn, spawnSync } from "node:child_process";
10
+ import * as os from "node:os";
11
+ import * as path from "node:path";
12
+ var HELPER_TIMEOUT_MS = 1e4;
13
+ var MAX_FREEZE_PASSES = 64;
14
+ var OWNER_SIGNALS = ["SIGINT", "SIGTERM", "SIGHUP"];
15
+ function taskkillPath() {
16
+ const root = process.env["SystemRoot"] ?? process.env["windir"] ?? "C:\\Windows";
17
+ return path.join(root, "System32", "taskkill.exe");
18
+ }
19
+ function childrenByParent() {
20
+ const listed = spawnSync("ps", ["-A", "-o", "pid=,ppid="], { encoding: "utf8", timeout: HELPER_TIMEOUT_MS, maxBuffer: 64 * 1024 * 1024, windowsHide: true });
21
+ if (listed.status !== 0 || typeof listed.stdout !== "string") return null;
22
+ const table = /* @__PURE__ */ new Map();
23
+ for (const line of listed.stdout.split("\n")) {
24
+ const [pid, ppid] = line.trim().split(/\s+/).map(Number);
25
+ if (!Number.isInteger(pid) || !Number.isInteger(ppid)) continue;
26
+ const siblings = table.get(ppid);
27
+ if (siblings === void 0) table.set(ppid, [pid]);
28
+ else siblings.push(pid);
29
+ }
30
+ return table;
31
+ }
32
+ function descendantsOf(root, table) {
33
+ const found = [];
34
+ const queue = [root];
35
+ for (let next = queue.shift(); next !== void 0; next = queue.shift()) {
36
+ for (const child of table.get(next) ?? []) {
37
+ found.push(child);
38
+ queue.push(child);
39
+ }
40
+ }
41
+ return found;
42
+ }
43
+ function signalPid(pid, signal) {
44
+ try {
45
+ process.kill(pid, signal);
46
+ } catch {
47
+ }
48
+ }
49
+ function killProcessTree(pid) {
50
+ if (pid === void 0 || !Number.isInteger(pid) || pid <= 0) return { ok: true };
51
+ if (process.platform === "win32") {
52
+ const result = spawnSync(taskkillPath(), ["/T", "/F", "/PID", String(pid)], { stdio: "ignore", windowsHide: true, timeout: HELPER_TIMEOUT_MS });
53
+ if (result.status === 0) return { ok: true };
54
+ return { ok: false, note: `taskkill ended with ${result.status === null ? result.error?.message ?? "no status" : `status ${result.status}`}` };
55
+ }
56
+ signalPid(pid, "SIGSTOP");
57
+ const frozen = [pid];
58
+ const known = new Set(frozen);
59
+ let note;
60
+ let settled = false;
61
+ for (let pass = 0; pass < MAX_FREEZE_PASSES && !settled; pass++) {
62
+ const table = childrenByParent();
63
+ if (table === null) {
64
+ note = "the process table could not be listed, so only the shell was killed";
65
+ settled = true;
66
+ break;
67
+ }
68
+ settled = true;
69
+ for (const d of descendantsOf(pid, table)) {
70
+ if (known.has(d)) continue;
71
+ known.add(d);
72
+ frozen.push(d);
73
+ signalPid(d, "SIGSTOP");
74
+ settled = false;
75
+ }
76
+ }
77
+ if (!settled) note = `the tree was still growing after ${MAX_FREEZE_PASSES} passes, so it was killed as found`;
78
+ for (const p of frozen.reverse()) signalPid(p, "SIGKILL");
79
+ return note === void 0 ? { ok: true } : { ok: false, note };
80
+ }
81
+ var live = /* @__PURE__ */ new Set();
82
+ var hooked = false;
83
+ function onProcessExit() {
84
+ for (const owned of [...live]) owned.kill();
85
+ }
86
+ function onProcessSignal(signal) {
87
+ unhook();
88
+ for (const owned of [...live]) owned.kill();
89
+ if (process.platform === "win32") process.exit(128 + (os.constants.signals[signal] ?? 0));
90
+ process.kill(process.pid, signal);
91
+ }
92
+ function hook() {
93
+ if (hooked) return;
94
+ hooked = true;
95
+ process.on("exit", onProcessExit);
96
+ for (const s of OWNER_SIGNALS) process.on(s, onProcessSignal);
97
+ }
98
+ function unhook() {
99
+ if (!hooked) return;
100
+ hooked = false;
101
+ process.removeListener("exit", onProcessExit);
102
+ for (const s of OWNER_SIGNALS) process.removeListener(s, onProcessSignal);
103
+ }
104
+ function spawnOwned(file, args, options) {
105
+ const child = spawn(file, args, options);
106
+ let killed = false;
107
+ let ended = false;
108
+ const onChildEnd = () => {
109
+ ended = true;
110
+ };
111
+ child.once("exit", onChildEnd);
112
+ child.once("close", onChildEnd);
113
+ child.once("error", () => {
114
+ if (child.pid === void 0) ended = true;
115
+ });
116
+ const kill = () => {
117
+ if (killed || ended || child.pid === void 0) return;
118
+ killed = true;
119
+ const result = killProcessTree(child.pid);
120
+ if (!result.ok && !ended) process.stderr.write(`[token-goat: could not end the process tree of pid ${child.pid}: ${result.note ?? "unknown reason"}]
121
+ `);
122
+ };
123
+ const handle = { kill };
124
+ const release = () => {
125
+ live.delete(handle);
126
+ if (live.size === 0) unhook();
127
+ };
128
+ live.add(handle);
129
+ hook();
130
+ child.once("close", release);
131
+ child.once("error", release);
132
+ return { child, kill, release };
133
+ }
134
+
135
+ export {
136
+ spawnOwned
137
+ };
@@ -3,7 +3,7 @@ const require = __cjsRequire(import.meta.url);
3
3
  import {
4
4
  configPath,
5
5
  dataDir
6
- } from "./token-goat-chunk-VES7EL7O.mjs";
6
+ } from "./token-goat-chunk-CO3UYX6G.mjs";
7
7
  import {
8
8
  init_define_import_meta_env
9
9
  } from "./token-goat-chunk-A37V4PBF.mjs";
@@ -0,0 +1,160 @@
1
+ import { createRequire as __cjsRequire } from 'node:module';
2
+ const require = __cjsRequire(import.meta.url);
3
+ import {
4
+ isTokenGoatResidentProcess,
5
+ isWorkerRunning
6
+ } from "./token-goat-chunk-F6PAUIEK.mjs";
7
+ import {
8
+ windowsPowerShellPath
9
+ } from "./token-goat-chunk-65N4RHP4.mjs";
10
+ import {
11
+ powerShellCommandArgs
12
+ } from "./token-goat-chunk-X2SUP3EI.mjs";
13
+ import {
14
+ displaySafeText
15
+ } from "./token-goat-chunk-FNFBKLRD.mjs";
16
+ import {
17
+ init_define_import_meta_env
18
+ } from "./token-goat-chunk-A37V4PBF.mjs";
19
+
20
+ // src/cli_doctor_process.ts
21
+ init_define_import_meta_env();
22
+ import { spawnSync } from "node:child_process";
23
+ var ProcessListTimeout = class extends Error {
24
+ };
25
+ var PROCESS_LIST_TIMEOUT_MS = 2e4;
26
+ var INTERPRETER_BASENAMES = /* @__PURE__ */ new Set(["node.exe", "python.exe", "python3.exe", "pwsh.exe", "powershell.exe", "cmd.exe"]);
27
+ function describeProcess(commandLine) {
28
+ for (const m of commandLine.matchAll(/[^\s"]+\.(?:js|mjs|cjs|ts|py|exe)\b/gi)) {
29
+ const basename = m[0].replace(/\\/g, "/").split("/").pop() ?? m[0];
30
+ if (!INTERPRETER_BASENAMES.has(basename.toLowerCase())) return basename;
31
+ }
32
+ const trimmed = commandLine.trim();
33
+ return trimmed.length > 0 ? trimmed.length > 60 ? trimmed.slice(0, 60) + "\u2026" : trimmed : "(no command line)";
34
+ }
35
+ function checkMcpProcessHealth(processes) {
36
+ if (!Array.isArray(processes)) {
37
+ const failure = processes;
38
+ const query = `Get-CimInstance Win32_Process -Filter "Name='node.exe'" | Select-Object ProcessId,ParentProcessId,CommandLine`;
39
+ const advice = failure.transient === true ? `Run doctor again once the machine is less busy, or list them yourself with: ${query}` : `List them yourself with: ${query}`;
40
+ return {
41
+ name: "MCP process health",
42
+ status: "warn",
43
+ message: `could not read the process list (${displaySafeText(failure.reason)}), so duplicate MCP launchers and orphaned Node processes were not checked. ${advice}`
44
+ };
45
+ }
46
+ const byPid = new Set(processes.map((process2) => process2.processId));
47
+ const nodeProcesses = processes.filter((process2) => process2.name.toLowerCase() === "node.exe");
48
+ const chromeLaunchers = nodeProcesses.filter((process2) => /npx-cli\.js.*chrome-devtools-mcp/i.test(process2.commandLine));
49
+ const playwrightLaunchers = nodeProcesses.filter((process2) => /npx-cli\.js.*@playwright[\\/]mcp/i.test(process2.commandLine));
50
+ const orphanedNodeProcesses = nodeProcesses.filter(
51
+ (process2) => !byPid.has(process2.parentProcessId) && !isTokenGoatResidentProcess(process2.commandLine)
52
+ );
53
+ const launchers = chromeLaunchers.length + playwrightLaunchers.length;
54
+ if (launchers > 2 || orphanedNodeProcesses.length > 0) {
55
+ const details = [];
56
+ if (chromeLaunchers.length > 1) details.push(`${chromeLaunchers.length} Chrome DevTools MCP launchers (PIDs: ${chromeLaunchers.map((p) => p.processId).join(", ")})`);
57
+ if (playwrightLaunchers.length > 1) details.push(`${playwrightLaunchers.length} Playwright MCP launchers (PIDs: ${playwrightLaunchers.map((p) => p.processId).join(", ")})`);
58
+ if (orphanedNodeProcesses.length > 0) {
59
+ const described = orphanedNodeProcesses.map((p) => `${p.processId} (${describeProcess(p.commandLine)})`).join(", ");
60
+ details.push(`${orphanedNodeProcesses.length} orphaned Node process${orphanedNodeProcesses.length === 1 ? "" : "es"}: ${described}`);
61
+ }
62
+ return {
63
+ name: "MCP process health",
64
+ status: "warn",
65
+ message: `${details.join("; ")} detected. None of these are token-goat's own processes -- they are host-managed Node/MCP processes left by closed terminal or CLI sessions; confirm what each one is (the name shown above is a starting point) before stopping it with Stop-Process -Id <PID>.`
66
+ };
67
+ }
68
+ return { name: "MCP process health", status: "ok", message: "no duplicate MCP launchers or orphaned Node processes detected" };
69
+ }
70
+ function runProcessListCommand() {
71
+ const command = "Get-CimInstance Win32_Process | Select-Object ProcessId,ParentProcessId,Name,CommandLine | ConvertTo-Json -Compress";
72
+ const result = spawnSync(windowsPowerShellPath(), powerShellCommandArgs(command), {
73
+ encoding: "utf8",
74
+ timeout: PROCESS_LIST_TIMEOUT_MS,
75
+ maxBuffer: 10 * 1024 * 1024,
76
+ windowsHide: true
77
+ });
78
+ return processListOutput(result);
79
+ }
80
+ function processListOutput(result) {
81
+ if (result.error !== void 0) {
82
+ const code = result.error.code;
83
+ if (code === "ETIMEDOUT") throw new ProcessListTimeout(`PowerShell did not finish within ${PROCESS_LIST_TIMEOUT_MS / 1e3}s`);
84
+ if (code === "ENOENT") throw new Error("powershell.exe was not found");
85
+ throw result.error;
86
+ }
87
+ const stdout = result.stdout ?? "";
88
+ if (result.status !== 0 && stdout.trim() === "") {
89
+ const firstLine = (result.stderr ?? "").split(/\r?\n/).map((line) => line.trim()).find((line) => line !== "");
90
+ throw new Error(`PowerShell exited with code ${String(result.status)}${firstLine !== void 0 ? `: ${firstLine}` : ""}`);
91
+ }
92
+ return stdout;
93
+ }
94
+ function parseProcessListJson(output) {
95
+ try {
96
+ return JSON.parse(output);
97
+ } catch (first) {
98
+ const escaped = output.replace(/[\u0000-\u001f]/g, (c) => `\\u${c.charCodeAt(0).toString(16).padStart(4, "0")}`);
99
+ if (escaped === output) throw first;
100
+ return JSON.parse(escaped);
101
+ }
102
+ }
103
+ function readWindowsProcesses(runCommand = runProcessListCommand) {
104
+ if (process.platform !== "win32") return [];
105
+ try {
106
+ const output = runCommand().trim();
107
+ if (output === "") return [];
108
+ let parsed;
109
+ try {
110
+ parsed = parseProcessListJson(output);
111
+ } catch {
112
+ return { reason: "PowerShell printed something other than the JSON process list" };
113
+ }
114
+ const rows = Array.isArray(parsed) ? parsed : [parsed];
115
+ return rows.flatMap((row) => {
116
+ if (typeof row !== "object" || row === null) return [];
117
+ const value = row;
118
+ if (typeof value["ProcessId"] !== "number" || typeof value["ParentProcessId"] !== "number" || typeof value["Name"] !== "string") return [];
119
+ return [{
120
+ processId: value["ProcessId"],
121
+ parentProcessId: value["ParentProcessId"],
122
+ name: value["Name"],
123
+ commandLine: typeof value["CommandLine"] === "string" ? value["CommandLine"] : ""
124
+ }];
125
+ });
126
+ } catch (e) {
127
+ const reason = e instanceof Error ? e.message : String(e);
128
+ return e instanceof ProcessListTimeout ? { reason, transient: true } : { reason };
129
+ }
130
+ }
131
+ function parsePsProcessList(stdout) {
132
+ return stdout.split(/\r?\n/).flatMap((line) => {
133
+ const m = /^\s*(\d+)\s+(\d+)\s+(\S.*)$/.exec(line);
134
+ if (m === null) return [];
135
+ const commandLine = m[3] ?? "";
136
+ return [{ processId: Number(m[1]), parentProcessId: Number(m[2]), name: (commandLine.split(/\s+/)[0] ?? "").split("/").pop() ?? "", commandLine }];
137
+ });
138
+ }
139
+ function readPosixProcesses() {
140
+ const result = spawnSync("ps", ["-A", "-ww", "-o", "pid=,ppid=,args="], { encoding: "utf8", timeout: PROCESS_LIST_TIMEOUT_MS, maxBuffer: 10 * 1024 * 1024 });
141
+ if (result.error !== void 0) {
142
+ const code = result.error.code;
143
+ return code === "ETIMEDOUT" ? { reason: `ps did not finish within ${PROCESS_LIST_TIMEOUT_MS / 1e3}s`, transient: true } : { reason: result.error.message };
144
+ }
145
+ if (result.status !== 0) return { reason: `ps exited with code ${String(result.status)}` };
146
+ return parsePsProcessList(result.stdout);
147
+ }
148
+ function readAllProcesses() {
149
+ return process.platform === "win32" ? readWindowsProcesses() : readPosixProcesses();
150
+ }
151
+ function checkWorkerRunning(dataDir) {
152
+ return dataDir !== void 0 ? isWorkerRunning(dataDir) : isWorkerRunning();
153
+ }
154
+
155
+ export {
156
+ checkMcpProcessHealth,
157
+ readWindowsProcesses,
158
+ readAllProcesses,
159
+ checkWorkerRunning
160
+ };