token-goat 2.9.29 → 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 (197) hide show
  1. package/README.md +53 -42
  2. package/SECURITY.md +37 -11
  3. package/THIRD_PARTY_NOTICES.md +41 -4
  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/ort-wasm-simd-threaded.mjs +59 -0
  9. package/dist/{token-goat-chunk-SE6E4BKJ.mjs → token-goat-chunk-25TRAWET.mjs} +23 -6
  10. package/dist/token-goat-chunk-2KXO6V2B.mjs +203 -0
  11. package/dist/{token-goat-chunk-UXSXQQIY.mjs → token-goat-chunk-2M7E4PF7.mjs} +43 -14
  12. package/dist/token-goat-chunk-2UPZGKKY.mjs +188 -0
  13. package/dist/token-goat-chunk-2WLPWKHV.mjs +135 -0
  14. package/dist/token-goat-chunk-2XBMMDBD.mjs +126 -0
  15. package/dist/token-goat-chunk-32ZOY4N5.mjs +23 -0
  16. package/dist/token-goat-chunk-3EZRNKTK.mjs +188 -0
  17. package/dist/token-goat-chunk-4ADZHI7J.mjs +63 -0
  18. package/dist/token-goat-chunk-4GBVPH3D.mjs +242 -0
  19. package/dist/{token-goat-chunk-2WOUYWLM.mjs → token-goat-chunk-4GILLLWY.mjs} +34 -7
  20. package/dist/token-goat-chunk-4NAPX7BA.mjs +90 -0
  21. package/dist/{token-goat-chunk-NMBWLRHW.mjs → token-goat-chunk-4SC7UJYV.mjs} +9981 -11563
  22. package/dist/token-goat-chunk-4SMRO4TO.mjs +366 -0
  23. package/dist/{token-goat-chunk-O6I2XU4P.mjs → token-goat-chunk-4ZBFWLXF.mjs} +310 -441
  24. package/dist/token-goat-chunk-57BIAXJL.mjs +286 -0
  25. package/dist/token-goat-chunk-5AC66HNP.mjs +115 -0
  26. package/dist/token-goat-chunk-5IMLKSOP.mjs +145 -0
  27. package/dist/token-goat-chunk-5RG5SBL6.mjs +221 -0
  28. package/dist/{token-goat-chunk-RRNZMM3A.mjs → token-goat-chunk-5Y6ZYL6U.mjs} +21 -2
  29. package/dist/token-goat-chunk-646E6U44.mjs +398 -0
  30. package/dist/token-goat-chunk-65N4RHP4.mjs +33 -0
  31. package/dist/{token-goat-chunk-6AK46ZT7.mjs → token-goat-chunk-6DG6HWP3.mjs} +13 -3
  32. package/dist/token-goat-chunk-6ENQSNRZ.mjs +573 -0
  33. package/dist/token-goat-chunk-6ZY4GNF2.mjs +91 -0
  34. package/dist/{token-goat-chunk-E5TK5DNO.mjs → token-goat-chunk-76FGDLRO.mjs} +574 -340
  35. package/dist/{token-goat-chunk-TGOXNAHW.mjs → token-goat-chunk-7EZTZOMC.mjs} +780 -767
  36. package/dist/token-goat-chunk-7MAOA6X4.mjs +3647 -0
  37. package/dist/token-goat-chunk-7R2ZVVAX.mjs +218 -0
  38. package/dist/{token-goat-chunk-TCQANXYC.mjs → token-goat-chunk-AM5V6GSX.mjs} +18 -2
  39. package/dist/token-goat-chunk-AUNGYYQX.mjs +184 -0
  40. package/dist/token-goat-chunk-AUQYRMMH.mjs +2985 -0
  41. package/dist/token-goat-chunk-B3PEKBYG.mjs +128 -0
  42. package/dist/{token-goat-chunk-KOPIR3KZ.mjs → token-goat-chunk-BA4HI6BW.mjs} +1910 -165
  43. package/dist/{token-goat-chunk-52NSDWYY.mjs → token-goat-chunk-BFCWY73P.mjs} +58 -20
  44. package/dist/token-goat-chunk-BPGCUMR7.mjs +30 -0
  45. package/dist/token-goat-chunk-BWGFUZZE.mjs +25 -0
  46. package/dist/token-goat-chunk-C75NA7PL.mjs +322 -0
  47. package/dist/token-goat-chunk-CBIQ7WTD.mjs +87 -0
  48. package/dist/token-goat-chunk-CETM74KC.mjs +307 -0
  49. package/dist/token-goat-chunk-CIMQ2BB3.mjs +233 -0
  50. package/dist/{token-goat-chunk-DNSPXQXQ.mjs → token-goat-chunk-CJLS3CDL.mjs} +70 -18
  51. package/dist/{token-goat-chunk-MELOKFDJ.mjs → token-goat-chunk-CO3UYX6G.mjs} +7 -1
  52. package/dist/token-goat-chunk-COPNXRJM.mjs +154 -0
  53. package/dist/token-goat-chunk-CSJ5L3NL.mjs +479 -0
  54. package/dist/token-goat-chunk-CVCEVUGK.mjs +315 -0
  55. package/dist/token-goat-chunk-CXHOFN7R.mjs +371 -0
  56. package/dist/token-goat-chunk-D735C4QM.mjs +603 -0
  57. package/dist/{token-goat-chunk-E4ZOJIZK.mjs → token-goat-chunk-DGS2LVNA.mjs} +70 -160
  58. package/dist/{token-goat-chunk-L7H3U27L.mjs → token-goat-chunk-DOWRSMWO.mjs} +1 -1
  59. package/dist/token-goat-chunk-E45INMY3.mjs +71 -0
  60. package/dist/token-goat-chunk-EC5F37F4.mjs +244 -0
  61. package/dist/{token-goat-chunk-XTQAOTSO.mjs → token-goat-chunk-EDBDRVH5.mjs} +4 -1
  62. package/dist/token-goat-chunk-EELTBKDM.mjs +613 -0
  63. package/dist/token-goat-chunk-EVMZJ27Z.mjs +147 -0
  64. package/dist/token-goat-chunk-EXKGNHEG.mjs +2096 -0
  65. package/dist/{token-goat-chunk-YOOVFPTP.mjs → token-goat-chunk-F4HYL64R.mjs} +12 -2
  66. package/dist/token-goat-chunk-F6PAUIEK.mjs +624 -0
  67. package/dist/token-goat-chunk-FDSREWLX.mjs +692 -0
  68. package/dist/{token-goat-chunk-NMTKNYGF.mjs → token-goat-chunk-FNFBKLRD.mjs} +74 -9
  69. package/dist/token-goat-chunk-G5PJ7AGM.mjs +36 -0
  70. package/dist/token-goat-chunk-GGGG7RWB.mjs +236 -0
  71. package/dist/{token-goat-chunk-TDUT2CL6.mjs → token-goat-chunk-GL3ETKSC.mjs} +276 -19
  72. package/dist/{token-goat-chunk-7CPMDFGB.mjs → token-goat-chunk-GVB2MUST.mjs} +265 -1567
  73. package/dist/token-goat-chunk-GWFLAUMQ.mjs +307 -0
  74. package/dist/token-goat-chunk-HAVAOB3S.mjs +87 -0
  75. package/dist/token-goat-chunk-HLPW63A7.mjs +48 -0
  76. package/dist/token-goat-chunk-HU4TORC5.mjs +1377 -0
  77. package/dist/token-goat-chunk-I7VKZZAW.mjs +35 -0
  78. package/dist/token-goat-chunk-IA6XSPE3.mjs +218 -0
  79. package/dist/token-goat-chunk-IAGXMHIK.mjs +863 -0
  80. package/dist/{token-goat-chunk-435UQTKD.mjs → token-goat-chunk-IK2DRMFX.mjs} +129 -74
  81. package/dist/{token-goat-chunk-ZER6EAXZ.mjs → token-goat-chunk-INNPTRUX.mjs} +2954 -2783
  82. package/dist/token-goat-chunk-JJ5BX4F4.mjs +129 -0
  83. package/dist/token-goat-chunk-JVFSHVFJ.mjs +129 -0
  84. package/dist/token-goat-chunk-KGEFFSHD.mjs +50 -0
  85. package/dist/token-goat-chunk-KKUFXAPD.mjs +25 -0
  86. package/dist/token-goat-chunk-KQBLRPBN.mjs +433 -0
  87. package/dist/token-goat-chunk-LCNQ2CNN.mjs +497 -0
  88. package/dist/token-goat-chunk-M3LFJDPU.mjs +58 -0
  89. package/dist/token-goat-chunk-M52KPT3C.mjs +87 -0
  90. package/dist/token-goat-chunk-MBEG42H7.mjs +150 -0
  91. package/dist/{token-goat-chunk-EVC4TOLE.mjs → token-goat-chunk-METECDOH.mjs} +3 -12
  92. package/dist/{token-goat-chunk-2AWQ2R5X.mjs → token-goat-chunk-MHX7XCC3.mjs} +3 -2
  93. package/dist/token-goat-chunk-MNWKPRAL.mjs +13 -0
  94. package/dist/token-goat-chunk-N5LSOVSU.mjs +137 -0
  95. package/dist/{token-goat-chunk-DPNLUJWB.mjs → token-goat-chunk-N5MMR2IW.mjs} +30 -8
  96. package/dist/token-goat-chunk-N7B3JQ2C.mjs +160 -0
  97. package/dist/{token-goat-chunk-VMFWNHGR.mjs → token-goat-chunk-NISNMD7T.mjs} +2545 -2953
  98. package/dist/token-goat-chunk-NMD42SFQ.mjs +434 -0
  99. package/dist/token-goat-chunk-NOSS5VWY.mjs +174 -0
  100. package/dist/token-goat-chunk-NSNSPPBG.mjs +69 -0
  101. package/dist/token-goat-chunk-OBOFIHKN.mjs +38 -0
  102. package/dist/token-goat-chunk-OBRFJ5O5.mjs +76 -0
  103. package/dist/token-goat-chunk-ODBT2USM.mjs +800 -0
  104. package/dist/token-goat-chunk-OS5EM5PP.mjs +107 -0
  105. package/dist/token-goat-chunk-OUKDTVNU.mjs +1178 -0
  106. package/dist/token-goat-chunk-OXFMP75N.mjs +566 -0
  107. package/dist/{token-goat-chunk-ASLWOQ3I.mjs → token-goat-chunk-OYIYKDDT.mjs} +2 -1
  108. package/dist/{token-goat-chunk-67BNIKKO.mjs → token-goat-chunk-P6HQSWQ3.mjs} +55 -47
  109. package/dist/token-goat-chunk-P6VGNTQT.mjs +71 -0
  110. package/dist/token-goat-chunk-PFWIMH2E.mjs +261 -0
  111. package/dist/token-goat-chunk-PJZXIS3G.mjs +39 -0
  112. package/dist/token-goat-chunk-PUO5INXP.mjs +606 -0
  113. package/dist/token-goat-chunk-PX5PQWTY.mjs +462 -0
  114. package/dist/token-goat-chunk-Q5QDBC6O.mjs +111 -0
  115. package/dist/token-goat-chunk-QFNQXSDT.mjs +40 -0
  116. package/dist/token-goat-chunk-QH7YVYOY.mjs +3957 -0
  117. package/dist/token-goat-chunk-QLMUHEPB.mjs +43 -0
  118. package/dist/{token-goat-chunk-PYSUADX4.mjs → token-goat-chunk-QQOJIHL3.mjs} +50 -14
  119. package/dist/token-goat-chunk-QQTWJY2O.mjs +85 -0
  120. package/dist/token-goat-chunk-QYHO5CPH.mjs +93 -0
  121. package/dist/token-goat-chunk-RELAVWAD.mjs +27 -0
  122. package/dist/token-goat-chunk-RSLPOBKQ.mjs +339 -0
  123. package/dist/token-goat-chunk-SAMFDIS2.mjs +712 -0
  124. package/dist/token-goat-chunk-SDELXLDM.mjs +48 -0
  125. package/dist/{token-goat-chunk-PGTH2U4C.mjs → token-goat-chunk-SOAFZNNZ.mjs} +164 -40
  126. package/dist/{token-goat-chunk-G23DWHV4.mjs → token-goat-chunk-SRTHT7KV.mjs} +33 -15
  127. package/dist/token-goat-chunk-T5P5ACNQ.mjs +212 -0
  128. package/dist/token-goat-chunk-T5YGG4V3.mjs +45 -0
  129. package/dist/token-goat-chunk-TAUZ4OFS.mjs +110 -0
  130. package/dist/token-goat-chunk-TM6MC754.mjs +40 -0
  131. package/dist/token-goat-chunk-TWUKBOMP.mjs +72 -0
  132. package/dist/token-goat-chunk-U2KSB4SG.mjs +56 -0
  133. package/dist/token-goat-chunk-U4WHMG6Y.mjs +898 -0
  134. package/dist/token-goat-chunk-UA5V6P3P.mjs +122 -0
  135. package/dist/token-goat-chunk-UGJHGR5A.mjs +52 -0
  136. package/dist/{token-goat-chunk-RQGGMPCR.mjs → token-goat-chunk-UOUDVA5U.mjs} +76 -16
  137. package/dist/{token-goat-chunk-HNFZZHFW.mjs → token-goat-chunk-URRJ33GR.mjs} +22 -4
  138. package/dist/token-goat-chunk-UZOROKIS.mjs +165 -0
  139. package/dist/token-goat-chunk-VIHGGGEI.mjs +4234 -0
  140. package/dist/token-goat-chunk-VTJLAA7P.mjs +21 -0
  141. package/dist/token-goat-chunk-VWDXLT4F.mjs +678 -0
  142. package/dist/token-goat-chunk-VWZA2H4P.mjs +368 -0
  143. package/dist/{token-goat-chunk-QO3LXVVR.mjs → token-goat-chunk-VXEXMJDL.mjs} +2964 -3153
  144. package/dist/token-goat-chunk-WBA5SKT4.mjs +547 -0
  145. package/dist/{token-goat-chunk-ONXH6NZ5.mjs → token-goat-chunk-WDH44VAU.mjs} +19 -22
  146. package/dist/token-goat-chunk-X2SUP3EI.mjs +107 -0
  147. package/dist/token-goat-chunk-X3BELZSJ.mjs +125 -0
  148. package/dist/{token-goat-chunk-RLP6J7WR.mjs → token-goat-chunk-XLRBNZCC.mjs} +40 -21
  149. package/dist/{token-goat-chunk-S4VSXURL.mjs → token-goat-chunk-XRKUX6CM.mjs} +4 -0
  150. package/dist/token-goat-chunk-XX6O25RN.mjs +82 -0
  151. package/dist/token-goat-chunk-XZSUHBVS.mjs +65 -0
  152. package/dist/token-goat-chunk-Y2ZTQOCL.mjs +35 -0
  153. package/dist/{token-goat-chunk-UA5BKWWQ.mjs → token-goat-chunk-YB4VMGK2.mjs} +15 -4
  154. package/dist/token-goat-chunk-YBIIY3HR.mjs +51 -0
  155. package/dist/{token-goat-chunk-PKRWMHVP.mjs → token-goat-chunk-YHVDKQBR.mjs} +389 -221
  156. package/dist/token-goat-chunk-YJB5XLWI.mjs +26 -0
  157. package/dist/{token-goat-chunk-PQ53BSCF.mjs → token-goat-chunk-YKB6AQG3.mjs} +53 -31
  158. package/dist/token-goat-chunk-YMTG2YA5.mjs +35 -0
  159. package/dist/token-goat-chunk-YPBZYQRV.mjs +40 -0
  160. package/dist/{token-goat-chunk-HUYUHODZ.mjs → token-goat-chunk-YY6AVUFL.mjs} +13246 -12247
  161. package/dist/token-goat-chunk-Z7N5OMMP.mjs +98 -0
  162. package/dist/{token-goat-chunk-BGHSSJUA.mjs → token-goat-chunk-ZFOBKUWH.mjs} +1 -1
  163. package/dist/token-goat-chunk-ZMBL6UVV.mjs +110 -0
  164. package/dist/token-goat-chunk-ZNMNUPAZ.mjs +938 -0
  165. package/dist/token-goat-hook-client.cjs +87 -23
  166. package/dist/token-goat-hook-client.mjs +3 -3
  167. package/dist/token-goat-hook.mjs +76 -31
  168. package/dist/token-goat.core.mjs +6 -6
  169. package/docs/C4_RUNTIME_ARCHITECTURE.md +2 -2
  170. package/docs/cli.md +113 -60
  171. package/docs/install.md +63 -20
  172. package/docs/security.md +10 -8
  173. package/package.json +18 -7
  174. package/scripts/verify-native-dist.mjs +386 -0
  175. package/dist/token-goat-chunk-2NNUA2LR.mjs +0 -143
  176. package/dist/token-goat-chunk-44BM7DDQ.mjs +0 -294
  177. package/dist/token-goat-chunk-BGYOZ6DO.mjs +0 -24
  178. package/dist/token-goat-chunk-C5YPNZKQ.mjs +0 -318
  179. package/dist/token-goat-chunk-CIQ2FTY3.mjs +0 -1990
  180. package/dist/token-goat-chunk-D4ETHJD6.mjs +0 -246
  181. package/dist/token-goat-chunk-DNRPXHYH.mjs +0 -1062
  182. package/dist/token-goat-chunk-EUSDXRXU.mjs +0 -1429
  183. package/dist/token-goat-chunk-FTP4U4QA.mjs +0 -64
  184. package/dist/token-goat-chunk-G7IWXCFF.mjs +0 -456
  185. package/dist/token-goat-chunk-GLXRTTLE.mjs +0 -36
  186. package/dist/token-goat-chunk-H5J3C56Q.mjs +0 -1511
  187. package/dist/token-goat-chunk-IVWI2OCK.mjs +0 -368
  188. package/dist/token-goat-chunk-JTKCQMQA.mjs +0 -418
  189. package/dist/token-goat-chunk-LZNBQTDK.mjs +0 -26
  190. package/dist/token-goat-chunk-ORNFMIER.mjs +0 -295
  191. package/dist/token-goat-chunk-RTMVLHWX.mjs +0 -7113
  192. package/dist/token-goat-chunk-VQ6F6T7X.mjs +0 -36
  193. package/dist/token-goat-chunk-VZQEWRVH.mjs +0 -312
  194. package/dist/token-goat-chunk-XYWPOSCN.mjs +0 -807
  195. package/dist/token-goat-chunk-YAGLESS3.mjs +0 -23
  196. package/dist/token-goat-chunk-YKSRAWUU.mjs +0 -33
  197. package/dist/token-goat-chunk-Z6KBMOBI.mjs +0 -53
@@ -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,9 +11,10 @@ import {
11
11
  openReadonlySqlite,
12
12
  runReadOnlySqliteQuery,
13
13
  validateReadOnlySelect
14
- } from "./token-goat-chunk-PQ53BSCF.mjs";
14
+ } from "./token-goat-chunk-YKB6AQG3.mjs";
15
15
  import "./token-goat-chunk-XB5KKOCG.mjs";
16
- import "./token-goat-chunk-NMTKNYGF.mjs";
16
+ import "./token-goat-chunk-GGGG7RWB.mjs";
17
+ import "./token-goat-chunk-FNFBKLRD.mjs";
17
18
  import "./token-goat-chunk-A37V4PBF.mjs";
18
19
  export {
19
20
  SQLITE_QUERY_ROW_CAP,
@@ -0,0 +1,13 @@
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/delivering_deny.ts
8
+ init_define_import_meta_env();
9
+ var DELIVERS_CONTENT_RE = /is inlined below instead of the full body|headings below instead of the full body|in place of the full file/;
10
+
11
+ export {
12
+ DELIVERS_CONTENT_RE
13
+ };
@@ -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-MELOKFDJ.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";
@@ -19,20 +19,35 @@ var PROTOCOL_VERSION = 1;
19
19
  var SERVER_SLOTS = 3;
20
20
  var MAX_FRAME_BYTES = 64 * 1024 * 1024;
21
21
  var KEY_BYTES = 32;
22
- function bundleDir() {
23
- const dir = path.dirname(fileURLToPath(import.meta.url));
22
+ var HARNESS_PROTOCOL_VERSION = 2;
23
+ function challengeMacV2(key, nc, ns, harness, noop, noops) {
24
+ return mac(key, "S", nc, ns, harness, noop, ...noops.flat());
25
+ }
26
+ function requestMacV2(key, nc, ns, harness, body) {
27
+ return mac(key, "C", nc, ns, harness, body);
28
+ }
29
+ function outFrameMac(key, nc, ns, seq, data) {
30
+ return mac(key, "O", nc, ns, String(seq), data);
31
+ }
32
+ function doneFrameMac(key, nc, ns, stdout, exit, n) {
33
+ return mac(key, "D", nc, ns, stdout, String(exit), String(n));
34
+ }
35
+ function resolveBundleDir(dir) {
24
36
  try {
25
37
  return fs.realpathSync.native(dir);
26
38
  } catch {
27
39
  return dir;
28
40
  }
29
41
  }
30
- function endpointId(dir) {
42
+ function bundleDir() {
43
+ return resolveBundleDir(path.dirname(fileURLToPath(import.meta.url)));
44
+ }
45
+ function endpointId(dir, bundle) {
31
46
  const fold = (p) => process.platform === "win32" ? p.toLowerCase() : p;
32
- return crypto.createHash("sha256").update(`${fold(dir)}\0${fold(bundleDir())}`).digest("hex").slice(0, 16);
47
+ return crypto.createHash("sha256").update(`${fold(dir)}\0${fold(bundle)}`).digest("hex").slice(0, 16);
33
48
  }
34
- function endpointFor(slot, dir = dataDir()) {
35
- const id = `${endpointId(dir)}-${slot}`;
49
+ function endpointFor(slot, dir = dataDir(), bundle = bundleDir()) {
50
+ const id = `${endpointId(dir, bundle)}-${slot}`;
36
51
  if (process.platform === "win32") return String.raw`\\.\pipe\token-goat-hooks-` + id;
37
52
  const inData = path.join(dir, `hooks-${id}.sock`);
38
53
  if (Buffer.byteLength(inData) < 100) return inData;
@@ -103,7 +118,9 @@ function mac(key, ...parts) {
103
118
  }
104
119
  function macMatches(expected, actual) {
105
120
  if (typeof actual !== "string" || actual.length !== expected.length) return false;
106
- return crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(actual));
121
+ const want = Buffer.from(expected);
122
+ const got = Buffer.from(actual);
123
+ return want.length === got.length && crypto.timingSafeEqual(want, got);
107
124
  }
108
125
  function writeFrame(socket, message) {
109
126
  socket.write(encodeFrame(message));
@@ -198,6 +215,11 @@ function launcherPath() {
198
215
  export {
199
216
  PROTOCOL_VERSION,
200
217
  SERVER_SLOTS,
218
+ HARNESS_PROTOCOL_VERSION,
219
+ challengeMacV2,
220
+ requestMacV2,
221
+ outFrameMac,
222
+ doneFrameMac,
201
223
  endpointFor,
202
224
  serverKeyPath,
203
225
  readServerKey,
@@ -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
+ };