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,307 @@
1
+ import { createRequire as __cjsRequire } from 'node:module';
2
+ const require = __cjsRequire(import.meta.url);
3
+ import {
4
+ evaluateVerification
5
+ } from "./token-goat-chunk-2WLPWKHV.mjs";
6
+ import {
7
+ claimsCommittedChange
8
+ } from "./token-goat-chunk-PUO5INXP.mjs";
9
+ import "./token-goat-chunk-2XBMMDBD.mjs";
10
+ import "./token-goat-chunk-PFWIMH2E.mjs";
11
+ import "./token-goat-chunk-GWFLAUMQ.mjs";
12
+ import "./token-goat-chunk-PJZXIS3G.mjs";
13
+ import "./token-goat-chunk-OBOFIHKN.mjs";
14
+ import "./token-goat-chunk-NOSS5VWY.mjs";
15
+ import "./token-goat-chunk-SAMFDIS2.mjs";
16
+ import {
17
+ sessionSidecarPath
18
+ } from "./token-goat-chunk-WBA5SKT4.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 {
25
+ sessionStateKey
26
+ } from "./token-goat-chunk-C75NA7PL.mjs";
27
+ import {
28
+ contextOutput,
29
+ getCwd,
30
+ passOutput
31
+ } from "./token-goat-chunk-76FGDLRO.mjs";
32
+ import "./token-goat-chunk-GL3ETKSC.mjs";
33
+ import "./token-goat-chunk-NISNMD7T.mjs";
34
+ import "./token-goat-chunk-EVMZJ27Z.mjs";
35
+ import "./token-goat-chunk-IK2DRMFX.mjs";
36
+ import {
37
+ recordStat
38
+ } from "./token-goat-chunk-U4WHMG6Y.mjs";
39
+ import "./token-goat-chunk-GVB2MUST.mjs";
40
+ import "./token-goat-chunk-XB5KKOCG.mjs";
41
+ import "./token-goat-chunk-OUKDTVNU.mjs";
42
+ import "./token-goat-chunk-4GILLLWY.mjs";
43
+ import "./token-goat-chunk-BFCWY73P.mjs";
44
+ import "./token-goat-chunk-KGEFFSHD.mjs";
45
+ import "./token-goat-chunk-XX6O25RN.mjs";
46
+ import "./token-goat-chunk-HAVAOB3S.mjs";
47
+ import "./token-goat-chunk-F6PAUIEK.mjs";
48
+ import "./token-goat-chunk-65N4RHP4.mjs";
49
+ import "./token-goat-chunk-X2SUP3EI.mjs";
50
+ import {
51
+ redactSecrets
52
+ } from "./token-goat-chunk-T5P5ACNQ.mjs";
53
+ import {
54
+ loadConfig
55
+ } from "./token-goat-chunk-7EZTZOMC.mjs";
56
+ import {
57
+ getHarnessName
58
+ } from "./token-goat-chunk-QYHO5CPH.mjs";
59
+ import "./token-goat-chunk-4GBVPH3D.mjs";
60
+ import "./token-goat-chunk-YZAAZU2S.mjs";
61
+ import "./token-goat-chunk-IVE6U7KV.mjs";
62
+ import "./token-goat-chunk-Y4AFKTHK.mjs";
63
+ import {
64
+ atomicWriteText,
65
+ ensureDirSync,
66
+ isWithinQuietHours,
67
+ runGit,
68
+ withFileLock
69
+ } from "./token-goat-chunk-HU4TORC5.mjs";
70
+ import {
71
+ echoedCommand,
72
+ nameSubject
73
+ } from "./token-goat-chunk-GGGG7RWB.mjs";
74
+ import "./token-goat-chunk-AM5V6GSX.mjs";
75
+ import "./token-goat-chunk-FNFBKLRD.mjs";
76
+ import "./token-goat-chunk-CO3UYX6G.mjs";
77
+ import {
78
+ init_define_import_meta_env
79
+ } from "./token-goat-chunk-A37V4PBF.mjs";
80
+
81
+ // src/agent_receipt.ts
82
+ init_define_import_meta_env();
83
+ import { createHash } from "node:crypto";
84
+ import { existsSync, readFileSync } from "node:fs";
85
+ import { dirname } from "node:path";
86
+
87
+ // src/change_claim.ts
88
+ init_define_import_meta_env();
89
+ var CHANGE_VERBS = "fixed|implemented|added|created|wrote|written|refactored|updated|changed|edited|modified|deleted|removed|patched|resolved|replaced|improved|applied|renamed|rewrote|rewritten";
90
+ var OPENER_VERBS = "fixed|implemented|added|created|wrote|refactored|updated|changed|edited|modified|deleted|removed|patched|replaced|renamed|rewrote";
91
+ var NOT_AN_EDIT_OBJECT = "(?![ \\t]+(?:(?:the|a|an|my|our|this|these|some)[ \\t]+)?(?:summary|report|review|analysis|findings?|notes?|plan|mind|understanding|that|following[ \\t]+(?:findings?|notes?|observations?|points?|issues?[ \\t]+(?:I|we)[ \\t]+(?:found|noticed|saw)))\\b)";
92
+ var FENCED_BLOCK_RE = /```[\s\S]*?(?:```|$)|~~~[\s\S]*?(?:~~~|$)/g;
93
+ var QUOTED_LINE_RE = /^(?:[ \t]*>.*|(?: {4}|\t)(?![ \t]*(?:[-*•]|\d+[.)])[ \t]).*)$/gm;
94
+ var DIFF_EVIDENCE_RE = /^[ \t]*(?:@@|diff --git)|^[ \t]*\+[ \t].*\n[ \t]*[+-][ \t]|^[ \t]*-[ \t].*\n[ \t]*\+[ \t]/m;
95
+ var DIFF_LINE_RE = /^[ \t]*(?:[+-][ \t]|@@).*$/gm;
96
+ var FIRST_PERSON_CLAIM_RE = new RegExp(
97
+ `(?<!\\b(?:if|whether|when|unless|should|would|could)[ \\t]+)\\b(?:I|we)(?:['\u2019]ve|[ \\t]+have)?[ \\t]+(?:(?:also|then|just|now|already|both)[ \\t]+)*(?:(?:${CHANGE_VERBS})\\b(?![ \\t]+up\\b)(?![ \\t]*(?::[ \\t]*)?(?:nothing|none|anything|no|not|neither)\\b)${NOT_AN_EDIT_OBJECT}|made[ \\t]+(?:(?:the|some|several|a[ \\t]+few|these|those|following|minor|small)[ \\t]+)*(?:changes?|edits?|modifications?|fixes|updates?)\\b)`,
98
+ "i"
99
+ );
100
+ var OPENER_CLAIM_RE = new RegExp(`^[ \\t]{0,3}(?:${OPENER_VERBS})${NOT_AN_EDIT_OBJECT}[ \\t]+(?:(?:the|a|an|this|these|my|our)[ \\t]|\`[^\`\\n]+\`|[\\w./-]+\\.[A-Za-z]{1,5}\\b)`, "im");
101
+ var CHANGES_HEADER_RE = /(?:^|\n)[ \t]*(?:#{1,6}[ \t]*)?[*_]*(?:changes(?: made)?|what (?:I|we) (?:changed|did)|files (?:changed|modified|edited))[*_]*[ \t]*(?::[*_]*[ \t]*|(?=\n))([^\n]*(?:\n[ \t]*(?:[-*•]|\d+[.)])[ \t]+[^\n]*)*)/i;
102
+ var NEGATED_LIST_RE = /^[([]?\s*(?:none|nothing|n\/a|na|no|not|zero|0|[-–—]+)\b|^[-–—]+\s*$/i;
103
+ var NOT_A_REPORT_ITEM_RE = /^(?:recommend|suggest|propos|consider|could|should)|\b(?:only read|read[- ]only|no (?:changes|edits)|made no (?:changes|edits))\b/i;
104
+ function claimsOwnChange(report) {
105
+ const text = report.replace(FENCED_BLOCK_RE, "").replace(QUOTED_LINE_RE, "").replace(/\n[ \t]*(?=\n)/g, "");
106
+ const header = CHANGES_HEADER_RE.exec(text);
107
+ if (header !== null) {
108
+ const listed = (header[1] ?? "").trim().replace(/^(?:[-*•]|\d+[.)])[ \t]*/, "");
109
+ const firstItem = listed.split("\n")[0] ?? "";
110
+ if (listed !== "" && !NEGATED_LIST_RE.test(listed) && !NOT_A_REPORT_ITEM_RE.test(firstItem)) return true;
111
+ }
112
+ const prose = DIFF_EVIDENCE_RE.test(text) ? text.replace(DIFF_LINE_RE, "") : text;
113
+ return FIRST_PERSON_CLAIM_RE.test(prose) || OPENER_CLAIM_RE.test(prose);
114
+ }
115
+
116
+ // src/agent_receipt.ts
117
+ var RECEIPTS_SUFFIX = ".agent-receipts";
118
+ var MAX_RECEIPTS = 16;
119
+ var MAX_NAMED_FILES = 3;
120
+ var GIT_STATUS_TIMEOUT_MS = 5e3;
121
+ var LINE_PREFIX = "token-goat:";
122
+ var RECEIPT_TTL_MS = 30 * 60 * 1e3;
123
+ var RECEIPTS_LOCK_SUFFIX = ".agent-receipts.lock";
124
+ var RECEIPT_LOCK_WAIT_MS = 2e3;
125
+ function capReceipts(receipts) {
126
+ let excess = receipts.length - MAX_RECEIPTS;
127
+ if (excess <= 0) return receipts;
128
+ const dropped = /* @__PURE__ */ new Set();
129
+ for (const wantClean of [true, false]) {
130
+ for (const r of receipts) {
131
+ if (excess > 0 && r.text === "" === wantClean && !dropped.has(r)) {
132
+ dropped.add(r);
133
+ excess--;
134
+ }
135
+ }
136
+ }
137
+ return receipts.filter((r) => !dropped.has(r));
138
+ }
139
+ function reportHash(trimmedReport) {
140
+ return createHash("sha256").update(trimmedReport).digest("hex").slice(0, 16);
141
+ }
142
+ function receiptLines(state, claimsChangeWithoutEdit) {
143
+ const lines = [];
144
+ if (state.failingUnresolved && state.latestRun !== void 0) {
145
+ lines.push(`${LINE_PREFIX} this subagent's last check failed: ${echoedCommand(state.latestRun.command)} (exit ${state.latestRun.exitCode}).`);
146
+ }
147
+ if (state.editedSinceLastPass.length > 0) {
148
+ const named = state.editedSinceLastPass.slice(0, MAX_NAMED_FILES).map((name) => nameSubject("file", name)).join(", ");
149
+ const more = state.editedSinceLastPass.length - MAX_NAMED_FILES;
150
+ lines.push(`${LINE_PREFIX} this subagent edited after its last passing check: ${named}${more > 0 ? ` (+${more} more)` : ""}.`);
151
+ }
152
+ if (claimsChangeWithoutEdit) lines.push(`${LINE_PREFIX} the report claims a change, but this subagent recorded no edit and the working tree is clean.`);
153
+ return lines;
154
+ }
155
+ function claimsChangeTheTreeLacks(report, cwd) {
156
+ if (cwd === null || !claimsOwnChange(report) || claimsCommittedChange(report)) return false;
157
+ const result = runGit(["status", "--porcelain"], { cwd, timeoutMs: GIT_STATUS_TIMEOUT_MS });
158
+ return result.exitCode === 0 && result.stdout.trim() === "";
159
+ }
160
+ function receiptForStoppedAgent(event, redactedReport) {
161
+ const config = loadConfig().hints;
162
+ if (!config.agent_receipt || isWithinQuietHours(config.quiet_hours)) return null;
163
+ const state = evaluateVerification(sessionStateKey(event));
164
+ const claimsWithoutEdit = !state.editedAnyFile && claimsChangeTheTreeLacks(redactedReport, getCwd(event) || null);
165
+ const lines = receiptLines(state, claimsWithoutEdit);
166
+ return lines.length === 0 ? null : lines.join("\n");
167
+ }
168
+ function readReceipts(target) {
169
+ try {
170
+ const parsed = JSON.parse(readFileSync(target, "utf8"));
171
+ if (!Array.isArray(parsed)) return [];
172
+ const oldest = Date.now() - RECEIPT_TTL_MS;
173
+ return parsed.filter(
174
+ (r) => r !== null && typeof r === "object" && typeof r.hash === "string" && typeof r.length === "number" && typeof r.text === "string" && typeof r.at === "number" && r.at >= oldest
175
+ );
176
+ } catch {
177
+ return [];
178
+ }
179
+ }
180
+ function withReceipts(sessionId, create, work) {
181
+ const target = sessionSidecarPath(sessionId, RECEIPTS_SUFFIX);
182
+ const lockPath = sessionSidecarPath(sessionId, RECEIPTS_LOCK_SUFFIX);
183
+ if (target === null || lockPath === null) return null;
184
+ if (!create && (!existsSync(target) || readReceipts(target).length === 0)) return null;
185
+ try {
186
+ ensureDirSync(dirname(target));
187
+ const held = withFileLock(
188
+ lockPath,
189
+ () => {
190
+ const receipts = readReceipts(target);
191
+ const before = JSON.stringify(receipts);
192
+ const out = work(receipts);
193
+ const after = JSON.stringify(capReceipts(receipts));
194
+ if (after !== before) atomicWriteText(target, after);
195
+ return { out };
196
+ },
197
+ { waitMs: RECEIPT_LOCK_WAIT_MS }
198
+ );
199
+ return held === void 0 ? null : held.out;
200
+ } catch {
201
+ return null;
202
+ }
203
+ }
204
+ function parkAgentReceipt(sessionId, redactedReport, text, agentId) {
205
+ const trimmed = redactedReport.trim();
206
+ if (trimmed === "") return;
207
+ const entry = { hash: reportHash(trimmed), length: trimmed.length, text: redactSecrets(text).text, at: Date.now(), ...agentId ? { agentId } : {} };
208
+ withReceipts(sessionId, true, (receipts) => {
209
+ receipts.push(entry);
210
+ });
211
+ }
212
+ var AGENT_ID_TRAILER_RE = /\bagentId:\s*([A-Za-z0-9_-]{6,})/g;
213
+ function trailerAgentId(resultText) {
214
+ const matches = [...resultText.slice(-600).matchAll(AGENT_ID_TRAILER_RE)];
215
+ return matches.at(-1)?.[1];
216
+ }
217
+ function takeAgentReceipt(sessionId, resultText, agentId) {
218
+ const trimmed = resultText.trim();
219
+ const wantedId = agentId ?? trailerAgentId(trimmed);
220
+ const endsReport = (r) => r.length === trimmed.length || trimmed[r.length] === "\n" || trimmed[r.length] === "\r";
221
+ const sameText = (r) => r.length <= trimmed.length && endsReport(r) && reportHash(trimmed.slice(0, r.length)) === r.hash;
222
+ return withReceipts(sessionId, false, (receipts) => {
223
+ const byId = wantedId === void 0 ? -1 : receipts.findIndex((r) => r.agentId === wantedId);
224
+ if (byId >= 0 && (agentId !== void 0 || sameText(receipts[byId]))) return receipts.splice(byId, 1)[0]?.text || null;
225
+ if (agentId !== void 0) return null;
226
+ const candidates = receipts.map((r, i) => ({ r, i })).filter(({ r }) => sameText(r) && (wantedId === void 0 || r.agentId === void 0));
227
+ if (candidates.length === 0 || candidates.some(({ r }) => r.text !== candidates[0].r.text)) return null;
228
+ return receipts.splice(candidates[0].i, 1)[0]?.text || null;
229
+ });
230
+ }
231
+ function subagentReceiptHandler(event) {
232
+ try {
233
+ const raw = event.raw["last_assistant_message"];
234
+ if (getHarnessName() === "copilot_cli" || !event.sessionId || typeof raw !== "string" || raw === "" || event.raw["stop_hook_active"] === true) return passOutput();
235
+ const report = redactSecrets(raw).text;
236
+ const text = receiptForStoppedAgent(event, report);
237
+ if (text !== null || loadConfig().hints.agent_receipt) parkAgentReceipt(event.sessionId, report, text ?? "", event.agentId);
238
+ return passOutput();
239
+ } catch {
240
+ return passOutput();
241
+ }
242
+ }
243
+ function subagentStopHandler(event) {
244
+ try {
245
+ const cwd = getCwd(event);
246
+ if (!event.sessionId || !cwd) return passOutput();
247
+ const message = typeof event.raw["last_assistant_message"] === "string" ? event.raw["last_assistant_message"] : "";
248
+ if (!claimsOwnChange(message) || claimsCommittedChange(message)) return passOutput();
249
+ const result = runGit(["status", "--porcelain"], { cwd, timeoutMs: loadConfig().hints.git_hint_max_ms });
250
+ if (result.exitCode === 0 && result.stdout.trim() === "") {
251
+ console.warn(`subagent-stop: possible hallucination \u2014 session=${event.sessionId} but git status is clean`);
252
+ }
253
+ return passOutput();
254
+ } catch {
255
+ return passOutput();
256
+ }
257
+ }
258
+ function completedSubagents(toolResponse) {
259
+ let parsed = toolResponse;
260
+ if (typeof toolResponse === "string") {
261
+ try {
262
+ parsed = JSON.parse(toolResponse);
263
+ } catch {
264
+ return [];
265
+ }
266
+ }
267
+ const status = parsed !== null && typeof parsed === "object" ? parsed["status"] : void 0;
268
+ if (status === null || typeof status !== "object") return [];
269
+ const out = [];
270
+ for (const [agentId, value] of Object.entries(status)) {
271
+ const report = value !== null && typeof value === "object" ? value["completed"] : void 0;
272
+ if (typeof report === "string" && report !== "") out.push({ agentId, report });
273
+ }
274
+ return out;
275
+ }
276
+ function waitAgentReceipts(sessionId, toolResponse) {
277
+ const finished = completedSubagents(toolResponse);
278
+ const blocks = [];
279
+ for (const { agentId, report } of finished) {
280
+ const text = takeAgentReceipt(sessionId, redactSecrets(report).text, agentId);
281
+ if (text !== null) blocks.push(finished.length > 1 ? `${LINE_PREFIX} agent ${echoedCommand(agentId)}:
282
+ ${text}` : text);
283
+ }
284
+ return blocks;
285
+ }
286
+ function waitAgentHandler(event) {
287
+ try {
288
+ if (!event.sessionId) return passOutput();
289
+ const blocks = waitAgentReceipts(event.sessionId, event.raw["tool_response"]);
290
+ if (blocks.length === 0) return passOutput();
291
+ recordStat("agent_receipt", 0, 0, void 0, "agent");
292
+ return contextOutput(blocks.join("\n"));
293
+ } catch {
294
+ return passOutput();
295
+ }
296
+ }
297
+ export {
298
+ claimsChangeTheTreeLacks,
299
+ parkAgentReceipt,
300
+ receiptForStoppedAgent,
301
+ receiptLines,
302
+ subagentReceiptHandler,
303
+ subagentStopHandler,
304
+ takeAgentReceipt,
305
+ waitAgentHandler,
306
+ waitAgentReceipts
307
+ };
@@ -0,0 +1,233 @@
1
+ import { createRequire as __cjsRequire } from 'node:module';
2
+ const require = __cjsRequire(import.meta.url);
3
+ import {
4
+ registerHook
5
+ } from "./token-goat-chunk-C75NA7PL.mjs";
6
+ import {
7
+ passOutput
8
+ } from "./token-goat-chunk-76FGDLRO.mjs";
9
+ import {
10
+ ensureWorkerAlive
11
+ } from "./token-goat-chunk-F6PAUIEK.mjs";
12
+ import {
13
+ isUnderSystemTemp
14
+ } from "./token-goat-chunk-4GBVPH3D.mjs";
15
+ import {
16
+ atomicWriteBytes,
17
+ ensureDirSync
18
+ } from "./token-goat-chunk-HU4TORC5.mjs";
19
+ import {
20
+ foldPath
21
+ } from "./token-goat-chunk-AM5V6GSX.mjs";
22
+ import {
23
+ normalizePath,
24
+ resolveIndexPath
25
+ } from "./token-goat-chunk-FNFBKLRD.mjs";
26
+ import {
27
+ dataDir
28
+ } from "./token-goat-chunk-CO3UYX6G.mjs";
29
+ import {
30
+ init_define_import_meta_env
31
+ } from "./token-goat-chunk-A37V4PBF.mjs";
32
+
33
+ // src/dirty_queue.ts
34
+ init_define_import_meta_env();
35
+ import * as fs from "node:fs";
36
+ import * as path from "node:path";
37
+ function dirtyQueuePathFor(dir) {
38
+ return path.join(dir, "queue", "dirty.txt");
39
+ }
40
+ var ENCODED_LINE_MARKER = "!";
41
+ function encodeDirtyQueueLine(absPath) {
42
+ const needsEncoding = /[\r\n]/.test(absPath) || absPath !== absPath.trim();
43
+ return needsEncoding ? ENCODED_LINE_MARKER + JSON.stringify(absPath) : absPath;
44
+ }
45
+ function decodeDirtyQueueLine(line) {
46
+ if (!line.startsWith(ENCODED_LINE_MARKER)) return line;
47
+ try {
48
+ const decoded = JSON.parse(line.slice(ENCODED_LINE_MARKER.length));
49
+ return typeof decoded === "string" ? decoded : line;
50
+ } catch {
51
+ return line;
52
+ }
53
+ }
54
+ function parseDirtyQueueLines(raw) {
55
+ const seen = /* @__PURE__ */ new Set();
56
+ const out = [];
57
+ for (const line of raw.split("\n")) {
58
+ const trimmed = decodeDirtyQueueLine(line.trim());
59
+ if (trimmed === "") continue;
60
+ const normalized = normalizePath(trimmed);
61
+ const dedupeKey = foldPath(normalized);
62
+ if (seen.has(dedupeKey)) continue;
63
+ seen.add(dedupeKey);
64
+ out.push(trimmed);
65
+ }
66
+ return out;
67
+ }
68
+ function getDirtyPathsFor(dir) {
69
+ let raw;
70
+ try {
71
+ raw = fs.readFileSync(dirtyQueuePathFor(dir), "utf8");
72
+ } catch {
73
+ return [];
74
+ }
75
+ return parseDirtyQueueLines(raw);
76
+ }
77
+ function dirtyQueueLeadingNewline(queuePath) {
78
+ let fd;
79
+ try {
80
+ const size = fs.statSync(queuePath).size;
81
+ if (size === 0) return "";
82
+ fd = fs.openSync(queuePath, "r");
83
+ const tail = Buffer.allocUnsafe(1);
84
+ fs.readSync(fd, tail, 0, 1, size - 1);
85
+ return tail[0] === 10 ? "" : "\n";
86
+ } catch {
87
+ return "";
88
+ } finally {
89
+ if (fd !== void 0) {
90
+ try {
91
+ fs.closeSync(fd);
92
+ } catch {
93
+ }
94
+ }
95
+ }
96
+ }
97
+ function appendToLiveQueue(queuePath, data) {
98
+ const fd = fs.openSync(queuePath, "a");
99
+ try {
100
+ fs.writeFileSync(fd, data);
101
+ return fs.statSync(queuePath, { bigint: true, throwIfNoEntry: false })?.ino === fs.fstatSync(fd, { bigint: true }).ino;
102
+ } finally {
103
+ fs.closeSync(fd);
104
+ }
105
+ }
106
+ function renderDirtyQueueLines(absPaths) {
107
+ return absPaths.map((p) => `${encodeDirtyQueueLine(p)}
108
+ `).join("");
109
+ }
110
+ function appendDirtyQueueFile(filePath, absPaths) {
111
+ if (absPaths.length === 0) return;
112
+ fs.appendFileSync(filePath, `${dirtyQueueLeadingNewline(filePath)}${renderDirtyQueueLines(absPaths)}`);
113
+ }
114
+ function appendDirtyQueuePaths(dir, absPaths) {
115
+ if (absPaths.length === 0) return true;
116
+ return appendToClaimableFile(dirtyQueuePathFor(dir), renderDirtyQueueLines(absPaths));
117
+ }
118
+ function appendToClaimableFile(queuePath, body) {
119
+ const queueDir = path.dirname(queuePath);
120
+ try {
121
+ ensureDirSync(queueDir);
122
+ } catch (e) {
123
+ if (e.code !== "EEXIST" || !fs.existsSync(queueDir)) throw e;
124
+ }
125
+ for (let attempt = 0; attempt < 3; attempt++) {
126
+ if (appendToLiveQueue(queuePath, `${dirtyQueueLeadingNewline(queuePath)}${body}`)) return true;
127
+ }
128
+ return false;
129
+ }
130
+ function reconcileRequestPathFor(dir) {
131
+ return path.join(dir, "queue", "reconcile.txt");
132
+ }
133
+ function appendReconcileRequest(dir, projectDir) {
134
+ return appendToClaimableFile(reconcileRequestPathFor(dir), `${JSON.stringify(projectDir)}
135
+ `);
136
+ }
137
+ function parseReconcileRequests(raw) {
138
+ const seen = /* @__PURE__ */ new Set();
139
+ const out = [];
140
+ for (const line of raw.split("\n")) {
141
+ const trimmed = line.trim();
142
+ if (trimmed === "") continue;
143
+ let dir;
144
+ try {
145
+ dir = JSON.parse(trimmed);
146
+ } catch {
147
+ continue;
148
+ }
149
+ if (typeof dir !== "string" || dir === "") continue;
150
+ const key = foldPath(normalizePath(dir));
151
+ if (seen.has(key)) continue;
152
+ seen.add(key);
153
+ out.push(dir);
154
+ }
155
+ return out;
156
+ }
157
+
158
+ // src/hooks_index.ts
159
+ init_define_import_meta_env();
160
+ import * as path2 from "node:path";
161
+ function appendDirtyPaths(normalizedPaths) {
162
+ appendDirtyQueuePaths(dataDir(), normalizedPaths);
163
+ }
164
+ function appendDirtyPath(normalizedPath) {
165
+ appendDirtyPaths([normalizedPath]);
166
+ }
167
+ function enqueueDirtyPathSafe(filePath, opts) {
168
+ enqueueDirtyPathsSafe([filePath], opts);
169
+ }
170
+ function enqueueDirtyPathsSafe(filePaths, opts) {
171
+ const resolved = [];
172
+ try {
173
+ for (const filePath of filePaths) {
174
+ const r = opts?.alreadyResolved === true ? filePath : resolveIndexPath(filePath);
175
+ if (isUnderSystemTemp(r)) continue;
176
+ resolved.push(r);
177
+ }
178
+ if (resolved.length === 0) return 0;
179
+ if (opts?.dir !== void 0) appendDirtyQueuePaths(opts.dir, resolved);
180
+ else appendDirtyPaths(resolved);
181
+ } catch {
182
+ return 0;
183
+ }
184
+ try {
185
+ ensureWorkerAlive();
186
+ } catch {
187
+ }
188
+ return resolved.length;
189
+ }
190
+ function requestReconcileSafe(projectDir) {
191
+ try {
192
+ if (!appendReconcileRequest(dataDir(), projectDir)) return false;
193
+ } catch {
194
+ return false;
195
+ }
196
+ try {
197
+ ensureWorkerAlive();
198
+ } catch {
199
+ }
200
+ return true;
201
+ }
202
+ function getDirtyPaths() {
203
+ return getDirtyPathsFor(dataDir());
204
+ }
205
+ function preCompactIndexHandler(_event) {
206
+ const paths = getDirtyPaths();
207
+ if (paths.length > 0) {
208
+ const sidecar = path2.join(dataDir(), "queue", "pending.txt");
209
+ try {
210
+ ensureDirSync(path2.dirname(sidecar));
211
+ atomicWriteBytes(sidecar, Buffer.from(`${paths.join("\n")}
212
+ `, "utf8"));
213
+ } catch {
214
+ }
215
+ }
216
+ return passOutput();
217
+ }
218
+ registerHook("pre_compact", preCompactIndexHandler, { advisory: true });
219
+
220
+ export {
221
+ dirtyQueuePathFor,
222
+ parseDirtyQueueLines,
223
+ getDirtyPathsFor,
224
+ appendDirtyQueueFile,
225
+ appendDirtyQueuePaths,
226
+ reconcileRequestPathFor,
227
+ appendReconcileRequest,
228
+ parseReconcileRequests,
229
+ appendDirtyPath,
230
+ enqueueDirtyPathSafe,
231
+ enqueueDirtyPathsSafe,
232
+ requestReconcileSafe
233
+ };