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,63 @@
1
+ import { createRequire as __cjsRequire } from 'node:module';
2
+ const require = __cjsRequire(import.meta.url);
3
+ import {
4
+ INSTALL_INDEX_ENV,
5
+ formatInstallIndexResult,
6
+ queueInstallIndex
7
+ } from "./token-goat-chunk-UZOROKIS.mjs";
8
+ import "./token-goat-chunk-M3LFJDPU.mjs";
9
+ import "./token-goat-chunk-ZNMNUPAZ.mjs";
10
+ import "./token-goat-chunk-PFWIMH2E.mjs";
11
+ import "./token-goat-chunk-OBOFIHKN.mjs";
12
+ import "./token-goat-chunk-QH7YVYOY.mjs";
13
+ import "./token-goat-chunk-NOSS5VWY.mjs";
14
+ import "./token-goat-chunk-NMD42SFQ.mjs";
15
+ import "./token-goat-chunk-SAMFDIS2.mjs";
16
+ import "./token-goat-chunk-4SMRO4TO.mjs";
17
+ import "./token-goat-chunk-WBA5SKT4.mjs";
18
+ import "./token-goat-chunk-MNWKPRAL.mjs";
19
+ import "./token-goat-chunk-CIMQ2BB3.mjs";
20
+ import "./token-goat-chunk-WDH44VAU.mjs";
21
+ import "./token-goat-chunk-BPGCUMR7.mjs";
22
+ import "./token-goat-chunk-KQBLRPBN.mjs";
23
+ import "./token-goat-chunk-4ZBFWLXF.mjs";
24
+ import "./token-goat-chunk-C75NA7PL.mjs";
25
+ import "./token-goat-chunk-P6VGNTQT.mjs";
26
+ import "./token-goat-chunk-76FGDLRO.mjs";
27
+ import "./token-goat-chunk-GL3ETKSC.mjs";
28
+ import "./token-goat-chunk-OXFMP75N.mjs";
29
+ import "./token-goat-chunk-NISNMD7T.mjs";
30
+ import "./token-goat-chunk-EVMZJ27Z.mjs";
31
+ import "./token-goat-chunk-IK2DRMFX.mjs";
32
+ import "./token-goat-chunk-5Y6ZYL6U.mjs";
33
+ import "./token-goat-chunk-U4WHMG6Y.mjs";
34
+ import "./token-goat-chunk-GVB2MUST.mjs";
35
+ import "./token-goat-chunk-XB5KKOCG.mjs";
36
+ import "./token-goat-chunk-OUKDTVNU.mjs";
37
+ import "./token-goat-chunk-3BTK54F3.mjs";
38
+ import "./token-goat-chunk-4GILLLWY.mjs";
39
+ import "./token-goat-chunk-BFCWY73P.mjs";
40
+ import "./token-goat-chunk-KGEFFSHD.mjs";
41
+ import "./token-goat-chunk-XX6O25RN.mjs";
42
+ import "./token-goat-chunk-HAVAOB3S.mjs";
43
+ import "./token-goat-chunk-F6PAUIEK.mjs";
44
+ import "./token-goat-chunk-65N4RHP4.mjs";
45
+ import "./token-goat-chunk-X2SUP3EI.mjs";
46
+ import "./token-goat-chunk-T5P5ACNQ.mjs";
47
+ import "./token-goat-chunk-7EZTZOMC.mjs";
48
+ import "./token-goat-chunk-QYHO5CPH.mjs";
49
+ import "./token-goat-chunk-4GBVPH3D.mjs";
50
+ import "./token-goat-chunk-YZAAZU2S.mjs";
51
+ import "./token-goat-chunk-IVE6U7KV.mjs";
52
+ import "./token-goat-chunk-Y4AFKTHK.mjs";
53
+ import "./token-goat-chunk-HU4TORC5.mjs";
54
+ import "./token-goat-chunk-GGGG7RWB.mjs";
55
+ import "./token-goat-chunk-AM5V6GSX.mjs";
56
+ import "./token-goat-chunk-FNFBKLRD.mjs";
57
+ import "./token-goat-chunk-CO3UYX6G.mjs";
58
+ import "./token-goat-chunk-A37V4PBF.mjs";
59
+ export {
60
+ INSTALL_INDEX_ENV,
61
+ formatInstallIndexResult,
62
+ queueInstallIndex
63
+ };
@@ -0,0 +1,242 @@
1
+ import { createRequire as __cjsRequire } from 'node:module';
2
+ const require = __cjsRequire(import.meta.url);
3
+ import {
4
+ registerReset
5
+ } from "./token-goat-chunk-YZAAZU2S.mjs";
6
+ import {
7
+ extractErrorMessage,
8
+ runGit
9
+ } from "./token-goat-chunk-HU4TORC5.mjs";
10
+ import {
11
+ canonicalize,
12
+ foldPath
13
+ } from "./token-goat-chunk-AM5V6GSX.mjs";
14
+ import {
15
+ normalizeDarwinSystemAlias
16
+ } from "./token-goat-chunk-FNFBKLRD.mjs";
17
+ import {
18
+ init_define_import_meta_env
19
+ } from "./token-goat-chunk-A37V4PBF.mjs";
20
+
21
+ // src/fingerprint.ts
22
+ init_define_import_meta_env();
23
+ import { createHash } from "node:crypto";
24
+ import * as fs from "node:fs";
25
+ function fingerprintContent(content) {
26
+ const hash = createHash("sha256");
27
+ hash.update(typeof content === "string" ? Buffer.from(content, "utf-8") : content);
28
+ return hash.digest("hex");
29
+ }
30
+ function shortFingerprint(content) {
31
+ return fingerprintContent(content).slice(0, 16);
32
+ }
33
+ function indexedFileIsGone(filePath) {
34
+ return statIndexedFile(filePath) === "gone";
35
+ }
36
+ function statIndexedFile(filePath) {
37
+ try {
38
+ const st = fs.statSync(filePath);
39
+ return st.isFile() ? st : "gone";
40
+ } catch (err) {
41
+ const code = err?.code;
42
+ return code === "ENOENT" || code === "ENOTDIR" ? "gone" : null;
43
+ }
44
+ }
45
+ function fingerprintFile(filePath) {
46
+ let data;
47
+ try {
48
+ data = fs.readFileSync(filePath);
49
+ } catch {
50
+ return null;
51
+ }
52
+ return fingerprintContent(data);
53
+ }
54
+ function fileIsAbsent(filePath) {
55
+ try {
56
+ return fs.statSync(filePath, { throwIfNoEntry: false }) === void 0;
57
+ } catch {
58
+ return false;
59
+ }
60
+ }
61
+
62
+ // src/project.ts
63
+ init_define_import_meta_env();
64
+ import * as fs2 from "node:fs";
65
+ import * as os from "node:os";
66
+ import * as path from "node:path";
67
+ var PROJECT_MARKERS = [
68
+ ".git",
69
+ "package.json",
70
+ "pyproject.toml",
71
+ "Cargo.toml",
72
+ "go.mod",
73
+ "shopify.app.toml",
74
+ "_config.yml",
75
+ "deno.json",
76
+ "deno.jsonc"
77
+ ];
78
+ var REPO_CONTAINER_THRESHOLD = 3;
79
+ function projectHash(canonicalRoot) {
80
+ return shortFingerprint(foldPath(canonicalRoot));
81
+ }
82
+ function makeProjectAt(root) {
83
+ let canonical;
84
+ try {
85
+ canonical = canonicalize(root);
86
+ } catch (exc) {
87
+ throw new Error(
88
+ `makeProjectAt: could not resolve path: ${extractErrorMessage(exc)}`,
89
+ { cause: exc }
90
+ );
91
+ }
92
+ try {
93
+ const stat = fs2.statSync(canonical);
94
+ if (!stat.isDirectory()) {
95
+ throw new Error(`makeProjectAt: path is not a directory: ${canonical}`);
96
+ }
97
+ } catch (exc) {
98
+ if (exc instanceof Error && exc.message.includes("ENOENT")) {
99
+ throw new Error(`makeProjectAt: path does not exist: ${canonical}`, { cause: exc });
100
+ }
101
+ throw exc;
102
+ }
103
+ const hash = projectHash(canonical);
104
+ return { root: canonical, hash, marker: "manual" };
105
+ }
106
+ function isRepoContainer(pathStr) {
107
+ let nestedRepos = 0;
108
+ try {
109
+ const entries = fs2.readdirSync(pathStr, { withFileTypes: true });
110
+ for (const entry of entries) {
111
+ if (entry.isDirectory()) {
112
+ const gitPath = path.join(pathStr, entry.name, ".git");
113
+ if (fs2.existsSync(gitPath)) {
114
+ let isGitDir = false;
115
+ try {
116
+ isGitDir = fs2.statSync(gitPath).isDirectory();
117
+ } catch {
118
+ }
119
+ if (isGitDir) {
120
+ nestedRepos++;
121
+ if (nestedRepos >= REPO_CONTAINER_THRESHOLD) {
122
+ return true;
123
+ }
124
+ }
125
+ }
126
+ }
127
+ }
128
+ } catch {
129
+ return false;
130
+ }
131
+ return false;
132
+ }
133
+ function markerExists(current, marker) {
134
+ const markerPath = path.join(current, marker);
135
+ try {
136
+ if (!fs2.existsSync(markerPath)) {
137
+ return false;
138
+ }
139
+ const stat = fs2.lstatSync(markerPath);
140
+ if (!stat.isSymbolicLink()) {
141
+ return true;
142
+ }
143
+ const resolved = fs2.realpathSync(markerPath);
144
+ const rel = path.relative(path.resolve(current), path.resolve(resolved));
145
+ return !rel.startsWith("..") && !path.isAbsolute(rel);
146
+ } catch {
147
+ return false;
148
+ }
149
+ }
150
+ function findProject(cwd) {
151
+ let p;
152
+ try {
153
+ p = canonicalize(cwd);
154
+ } catch {
155
+ return null;
156
+ }
157
+ let sysTemp = null;
158
+ try {
159
+ sysTemp = canonicalize(os.tmpdir());
160
+ } catch {
161
+ }
162
+ let current = p;
163
+ while (true) {
164
+ if (sysTemp && normalizeDarwinSystemAlias(foldPath(current)) === normalizeDarwinSystemAlias(foldPath(sysTemp))) {
165
+ break;
166
+ }
167
+ for (const marker of PROJECT_MARKERS) {
168
+ if (markerExists(current, marker)) {
169
+ if (!isRepoContainer(current)) {
170
+ return {
171
+ root: current,
172
+ hash: projectHash(current),
173
+ marker
174
+ };
175
+ }
176
+ break;
177
+ }
178
+ }
179
+ const parent = path.dirname(current);
180
+ if (parent === current) {
181
+ break;
182
+ }
183
+ current = parent;
184
+ }
185
+ return null;
186
+ }
187
+ var _displayRootCache = null;
188
+ function getDisplayRoot(explicitRoot) {
189
+ if (explicitRoot !== void 0) return explicitRoot;
190
+ const cwd = process.cwd();
191
+ if (_displayRootCache !== null && _displayRootCache.cwd === cwd) return _displayRootCache.root;
192
+ const project = findProject(cwd);
193
+ const root = project !== null ? project.root : void 0;
194
+ _displayRootCache = { cwd, root };
195
+ return root;
196
+ }
197
+ registerReset(() => {
198
+ _displayRootCache = null;
199
+ }, { perRequest: true });
200
+ function isUnderSystemTemp(filePath) {
201
+ let sysTemp;
202
+ try {
203
+ sysTemp = canonicalize(os.tmpdir());
204
+ } catch {
205
+ return false;
206
+ }
207
+ let target;
208
+ try {
209
+ target = canonicalize(filePath);
210
+ } catch {
211
+ return false;
212
+ }
213
+ const foldedTemp = normalizeDarwinSystemAlias(foldPath(sysTemp));
214
+ const foldedTarget = normalizeDarwinSystemAlias(foldPath(target));
215
+ return foldedTarget === foldedTemp || foldedTarget.startsWith(`${foldedTemp}/`);
216
+ }
217
+ function resolveProjectRoot(opts) {
218
+ const base = opts?.project !== void 0 ? path.resolve(opts.project) : process.cwd();
219
+ const toplevel = runGit(["rev-parse", "--show-toplevel"], { cwd: base });
220
+ if (toplevel.exitCode === 0) {
221
+ const trimmed = toplevel.stdout.trim();
222
+ if (trimmed.length > 0) return canonicalize(trimmed);
223
+ }
224
+ const project = findProject(base);
225
+ if (project !== null) return project.root;
226
+ return canonicalize(base);
227
+ }
228
+
229
+ export {
230
+ fingerprintContent,
231
+ shortFingerprint,
232
+ indexedFileIsGone,
233
+ statIndexedFile,
234
+ fingerprintFile,
235
+ fileIsAbsent,
236
+ projectHash,
237
+ makeProjectAt,
238
+ findProject,
239
+ getDisplayRoot,
240
+ isUnderSystemTemp,
241
+ resolveProjectRoot
242
+ };
@@ -2,7 +2,10 @@ import { createRequire as __cjsRequire } from 'node:module';
2
2
  const require = __cjsRequire(import.meta.url);
3
3
  import {
4
4
  stripAnsiEscapes
5
- } from "./token-goat-chunk-CIQ2FTY3.mjs";
5
+ } from "./token-goat-chunk-HAVAOB3S.mjs";
6
+ import {
7
+ countNoun
8
+ } from "./token-goat-chunk-HU4TORC5.mjs";
6
9
  import {
7
10
  init_define_import_meta_env
8
11
  } from "./token-goat-chunk-A37V4PBF.mjs";
@@ -36,12 +39,24 @@ function clipWideLines(text, maxChars = INPUT_MAX_LINE_CHARS) {
36
39
  let clipped = 0;
37
40
  const out = text.split("\n").map((line) => {
38
41
  if (line.length <= maxChars) return line;
42
+ const marker = CLIPPED_MARKER_RE.exec(line);
43
+ if (marker && line.length - marker[0].length <= maxChars) return line;
39
44
  clipped += 1;
40
45
  const keep = Math.floor(maxChars / 2);
41
46
  return line.slice(0, keep) + ` ... [${line.length - maxChars} chars clipped] ... ` + line.slice(line.length - (maxChars - keep));
42
47
  });
43
48
  return clipped === 0 ? text : out.join("\n");
44
49
  }
50
+ function isWholeJsonDocument(text) {
51
+ const t = text.trim();
52
+ if (t[0] !== "{" && t[0] !== "[") return false;
53
+ try {
54
+ JSON.parse(t);
55
+ return true;
56
+ } catch {
57
+ return false;
58
+ }
59
+ }
45
60
  function clampKeepingEnds(text, maxBytes) {
46
61
  const buf = Buffer.from(text, "utf8");
47
62
  if (buf.length <= maxBytes) return null;
@@ -195,7 +210,7 @@ function dedupeConsecutive(lines, opts = {}) {
195
210
  let count = 0;
196
211
  const flush = () => {
197
212
  if (prev === null) return;
198
- if (count >= minRun) out.push(fmt(prev, count));
213
+ if (count >= minRun) out.push(prev.trim() === "" ? "" : fmt(prev, count));
199
214
  else for (let i = 0; i < count; i++) out.push(prev);
200
215
  };
201
216
  for (const line of lines) {
@@ -206,7 +221,7 @@ function dedupeConsecutive(lines, opts = {}) {
206
221
  out.push(line);
207
222
  continue;
208
223
  }
209
- if (line === prev) {
224
+ if (line === prev || prev !== null && prev.trim() === "" && line.trim() === "") {
210
225
  count += 1;
211
226
  continue;
212
227
  }
@@ -331,11 +346,11 @@ function capTokens(text, maxTokens) {
331
346
  }
332
347
  return truncated;
333
348
  }
334
- function headTailCompress(lines, head, tail, label = "items") {
349
+ function headTailCompress(lines, head, tail, noun = "item", plural = `${noun}s`) {
335
350
  const total = lines.length;
336
351
  if (total <= head + tail) return lines.join("\n");
337
352
  const elided = total - head - tail;
338
- return [...lines.slice(0, head), `... [${elided} more ${label} elided by token-goat]`, ...lines.slice(total - tail)].join(
353
+ return [...lines.slice(0, head), `... [${countNoun(elided, `more ${noun}`, `more ${plural}`)} elided by token-goat]`, ...lines.slice(total - tail)].join(
339
354
  "\n"
340
355
  );
341
356
  }
@@ -353,7 +368,7 @@ function truncateTableRows(text, maxRows, hint) {
353
368
  for (let i = 0; i < rows.length && wanted.size < maxRows; i++) wanted.add(i);
354
369
  const kept = [...wanted].sort((a, b) => a - b);
355
370
  const elided = rows.length - kept.length;
356
- const note = anomalies ? `[token-goat: ${elided} more rows; ${anomalies} row(s) kept for a not-ready status, the rest from the top; ${hint}]` : `[token-goat: ${elided} more rows; ${hint}]`;
371
+ const note = anomalies ? `[token-goat: ${countNoun(elided, "more row")}; ${countNoun(anomalies, "row")} kept for a not-ready status, the rest from the top; ${hint}]` : `[token-goat: ${countNoun(elided, "more row")}; ${hint}]`;
357
372
  return `${[header, ...kept.map((i) => rows[i])].join("\n")}
358
373
  ${note}`;
359
374
  }
@@ -370,7 +385,7 @@ function trimRepeatedPrefix(lines, pattern, keep) {
370
385
  out.push(line);
371
386
  }
372
387
  }
373
- if (dropped) out.push(`[token-goat: +${dropped} more lines matching ${pattern.source}]`);
388
+ if (dropped) out.push(`[token-goat: +${countNoun(dropped, "more line")} matching ${pattern.source}]`);
374
389
  return out;
375
390
  }
376
391
  function stripTimestamps(lines) {
@@ -723,6 +738,7 @@ function shlexSplit(cmd) {
723
738
  if (has) tokens.push(cur);
724
739
  return tokens;
725
740
  }
741
+ var CLIP_MIN_OVERFLOW = 64;
726
742
  function capLongLines(lines, maxChars = FALLBACK_MAX_LINE_CHARS) {
727
743
  return lines.map((line) => {
728
744
  if (line.length <= maxChars) return line;
@@ -732,6 +748,7 @@ function capLongLines(lines, maxChars = FALLBACK_MAX_LINE_CHARS) {
732
748
  const high = line.charCodeAt(cut - 1);
733
749
  const low = line.charCodeAt(cut);
734
750
  if (high >= 55296 && high <= 56319 && low >= 56320 && low <= 57343) cut -= 1;
751
+ if (line.length - cut <= CLIP_MIN_OVERFLOW) return line;
735
752
  const carried = priorClip !== null && priorClip.index >= cut ? Number(priorClip[1]) - priorClip[0].length : 0;
736
753
  return `${line.slice(0, cut)} \u2026 [${line.length - cut + carried} chars elided]`;
737
754
  });
@@ -907,14 +924,18 @@ export {
907
924
  DEFAULT_MAX_LINES,
908
925
  DEFAULT_MAX_BYTES,
909
926
  MAX_INSPECT_BYTES,
927
+ DEFAULT_MAX_INPUT_BYTES,
928
+ FALLBACK_MAX_LINE_CHARS,
910
929
  LONG_LINE_MAX_CHARS,
911
930
  getMaxInputBytes,
912
931
  INPUT_MAX_LINE_CHARS,
913
932
  clipWideLines,
933
+ isWholeJsonDocument,
914
934
  clampKeepingEnds,
915
935
  compressionMarker,
916
936
  combineStreams,
917
937
  ERROR_SIGNAL_RE,
938
+ TABLE_ROW_ANOMALY_RE,
918
939
  TIMESTAMP_PREFIX_RE,
919
940
  REDIRECT_TOKEN_RE,
920
941
  maskQuotedSpans,
@@ -924,9 +945,13 @@ export {
924
945
  hasUnquotedOperator,
925
946
  splitOwnTrailingNotices,
926
947
  safeDecode,
948
+ sanitizeControlChars,
949
+ stripProgress,
927
950
  normalise,
928
951
  hasHighEntropyToken,
929
952
  dedupeConsecutive,
953
+ dedupeNumericRuns,
954
+ truncateMiddle,
930
955
  truncateMiddleSmart,
931
956
  capBytes,
932
957
  capTokens,
@@ -945,6 +970,8 @@ export {
945
970
  resolvePackageManagerScript,
946
971
  shlexSplit,
947
972
  capLongLines,
973
+ GREP_MAX_LINE_CHARS,
974
+ grepLiteralPattern,
948
975
  clipLongMatchLine,
949
976
  clipGrepLines,
950
977
  fallbackTruncate,
@@ -0,0 +1,90 @@
1
+ import { createRequire as __cjsRequire } from 'node:module';
2
+ const require = __cjsRequire(import.meta.url);
3
+ import {
4
+ recordStat
5
+ } from "./token-goat-chunk-U4WHMG6Y.mjs";
6
+ import {
7
+ redactSecrets
8
+ } from "./token-goat-chunk-T5P5ACNQ.mjs";
9
+ import {
10
+ loadConfig
11
+ } from "./token-goat-chunk-7EZTZOMC.mjs";
12
+ import {
13
+ UNTRUSTED_FILE_TAG,
14
+ displaySafeText,
15
+ fenceUntrustedContent,
16
+ scanForInjectionPatterns
17
+ } from "./token-goat-chunk-FNFBKLRD.mjs";
18
+ import {
19
+ init_define_import_meta_env
20
+ } from "./token-goat-chunk-A37V4PBF.mjs";
21
+
22
+ // src/untrusted_fence.ts
23
+ init_define_import_meta_env();
24
+ function injectionFencingEnabled() {
25
+ try {
26
+ return loadConfig().injection.enabled;
27
+ } catch {
28
+ return true;
29
+ }
30
+ }
31
+ function fenceUntrusted(text, tag) {
32
+ if (!injectionFencingEnabled()) return text;
33
+ return fenceUntrustedContent(text, scanAndRecord(text), tag);
34
+ }
35
+ function fenceUntrustedSpans(spans, tag) {
36
+ const joined = spans.map((s) => s.text).join("");
37
+ if (!injectionFencingEnabled()) return joined;
38
+ return fenceUntrustedContent(spans, scanAndRecord(spans.filter((s) => s.own !== true).map((s) => s.text).join("")), tag);
39
+ }
40
+ function fenceWithMatches(text, matches, tag) {
41
+ if (!injectionFencingEnabled()) return text;
42
+ return tag === void 0 ? fenceUntrustedContent(text, matches) : fenceUntrustedContent(text, matches, tag);
43
+ }
44
+ function scanAndRecord(text) {
45
+ if (!injectionFencingEnabled()) return [];
46
+ let matches;
47
+ try {
48
+ matches = scanForInjectionPatterns(text);
49
+ } catch {
50
+ matches = [];
51
+ }
52
+ if (matches.length > 0) recordStat("injection_detected", 0, 0, void 0, matches.join(","));
53
+ return matches;
54
+ }
55
+ function fenceFileText(text) {
56
+ return fenceUntrusted(redactSecrets(text).text, UNTRUSTED_FILE_TAG);
57
+ }
58
+ function fenceIfScanMatched(text, tag) {
59
+ const matches = scanAndRecord(text);
60
+ if (matches.length === 0) return text;
61
+ return fenceUntrustedContent(text, matches, tag);
62
+ }
63
+ function fenceFieldIfMatched(text, tag) {
64
+ const redacted = redactSecrets(text).text;
65
+ const fenced = fenceIfScanMatched(redacted, tag);
66
+ return fenced === redacted ? displaySafeText(redacted) : fenced;
67
+ }
68
+ function fenceFileFieldIfMatched(text) {
69
+ return fenceFieldIfMatched(text, UNTRUSTED_FILE_TAG);
70
+ }
71
+ function fenceJsonStrings(value, field) {
72
+ if (typeof value === "string") return field(value);
73
+ if (Array.isArray(value)) return value.map((v) => fenceJsonStrings(v, field));
74
+ if (value === null || typeof value !== "object") return value;
75
+ if (typeof value.toJSON === "function") return value;
76
+ return Object.fromEntries(Object.entries(value).map(([k, v]) => [field(k), fenceJsonStrings(v, field)]));
77
+ }
78
+
79
+ export {
80
+ injectionFencingEnabled,
81
+ fenceUntrusted,
82
+ fenceUntrustedSpans,
83
+ fenceWithMatches,
84
+ scanAndRecord,
85
+ fenceFileText,
86
+ fenceIfScanMatched,
87
+ fenceFieldIfMatched,
88
+ fenceFileFieldIfMatched,
89
+ fenceJsonStrings
90
+ };