autohand-cli 0.8.3 → 0.9.0

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 (510) hide show
  1. package/README.md +173 -74
  2. package/dist/AgentRegistry-EGBDIUAK.cjs +10 -0
  3. package/dist/{AgentRegistry-ODDXPAFR.js → AgentRegistry-XPWSVO3Q.js} +2 -2
  4. package/dist/{AutomodeManager-EOVHGRPP.js → AutomodeManager-APLLPEYJ.js} +31 -17
  5. package/dist/{AutomodeManager-6ATBE7Q5.cjs → AutomodeManager-MPSXT2RH.cjs} +38 -24
  6. package/dist/CommunitySkillsCache-2OIUV227.cjs +8 -0
  7. package/dist/{CommunitySkillsCache-QLE57BN5.js → CommunitySkillsCache-ZEQWP6YM.js} +2 -2
  8. package/dist/GitHubRegistryFetcher-CYJLF2XL.cjs +7 -0
  9. package/dist/{GitHubRegistryFetcher-NT5GFZXS.js → GitHubRegistryFetcher-J2BWPXJF.js} +1 -1
  10. package/dist/{HookManager-B2F35M27.js → HookManager-CWLTFKWO.js} +1 -1
  11. package/dist/{HookManager-PFAFE3FK.cjs → HookManager-TMAJQU4S.cjs} +2 -2
  12. package/dist/{ImportWizard-CJRZPPHL.cjs → ImportWizard-MQXEED2U.cjs} +37 -13
  13. package/dist/{ImportWizard-OHRKBANZ.js → ImportWizard-QBKQEXDW.js} +33 -9
  14. package/dist/LearnAdvisor-46FG2XIP.js +9 -0
  15. package/dist/LearnAdvisor-XBRDNAGH.cjs +9 -0
  16. package/dist/{McpClientManager-NQ3EW2IF.cjs → McpClientManager-BNSKLHIN.cjs} +2 -2
  17. package/dist/{McpClientManager-VBIMGKXU.js → McpClientManager-SL35BR24.js} +1 -1
  18. package/dist/MemoryManager-34L4YOKA.cjs +8 -0
  19. package/dist/{MemoryManager-2LAT7IHS.js → MemoryManager-WJMLPWGU.js} +2 -2
  20. package/dist/NVIDIAProvider-2HR737UE.js +14 -0
  21. package/dist/NVIDIAProvider-MVTL62PR.cjs +14 -0
  22. package/dist/PermissionManager-5OOJ7FAT.cjs +11 -0
  23. package/dist/{PermissionManager-7NQHRCHY.js → PermissionManager-KMYILJ4Z.js} +3 -3
  24. package/dist/{ProjectProfiler-UG42W6WD.cjs → ProjectProfiler-CDAE7ECW.cjs} +1 -0
  25. package/dist/{ProjectProfiler-P4QJQWWA.js → ProjectProfiler-NZTJDRHD.js} +1 -0
  26. package/dist/ProviderFactory-C3YPXTDD.cjs +11 -0
  27. package/dist/{ProviderFactory-2IYJ5OPW.js → ProviderFactory-HFPRVQ25.js} +3 -1
  28. package/dist/{SessionManager-4U4JFQ3C.js → SessionManager-PNBTJJTQ.js} +2 -2
  29. package/dist/SessionManager-WAPTFMDO.cjs +10 -0
  30. package/dist/{SkillsRegistry-RFEINXRT.js → SkillsRegistry-4RRD5GMX.js} +2 -2
  31. package/dist/SkillsRegistry-7AJP74GJ.cjs +9 -0
  32. package/dist/SubAgent-FDIH3DXB.js +11 -0
  33. package/dist/SubAgent-HVL2ICVZ.cjs +11 -0
  34. package/dist/{SyncApiClient-B5RT2ECG.js → SyncApiClient-LRPFNCKJ.js} +1 -1
  35. package/dist/SyncApiClient-VMBOLQ6H.cjs +11 -0
  36. package/dist/about-BW3PDZUU.js +14 -0
  37. package/dist/about-FCAX37YC.cjs +14 -0
  38. package/dist/acp-EOETGAHC.cjs +1517 -0
  39. package/dist/acp-VHEL7BOW.js +1517 -0
  40. package/dist/actionExecutor-33I47NZS.js +24 -0
  41. package/dist/actionExecutor-4YBMR3YH.cjs +24 -0
  42. package/dist/add-dir-7SS6KSH5.cjs +11 -0
  43. package/dist/{add-dir-TUJM3PG5.js → add-dir-VFX7QT4E.js} +3 -2
  44. package/dist/agent-DMRUFU4M.cjs +116 -0
  45. package/dist/agent-WCJEYQJT.js +116 -0
  46. package/dist/agents/builtin/code-cleaner.md +1 -1
  47. package/dist/agents/builtin/docs-writer.md +1 -1
  48. package/dist/agents/builtin/researcher.md +2 -2
  49. package/dist/agents/builtin/reviewer.md +1 -1
  50. package/dist/agents/builtin/tester.md +1 -1
  51. package/dist/agents/builtin/todo-resolver.md +1 -1
  52. package/dist/agents-CHROO3VU.cjs +17 -0
  53. package/dist/agents-UVDUL65K.js +17 -0
  54. package/dist/agents-new-AUBWSOXP.js +17 -0
  55. package/dist/agents-new-Y562WC47.cjs +17 -0
  56. package/dist/{autoSkill-LQEVQFIH.js → autoSkill-EFMK6WU6.js} +2 -2
  57. package/dist/autoSkill-YOLLFTP2.cjs +20 -0
  58. package/dist/{automode-R6P3VHLS.js → automode-BMYSRM34.js} +2 -2
  59. package/dist/automode-DBLKTTKD.cjs +10 -0
  60. package/dist/browserToolBridge-BXRQB4B4.cjs +58 -0
  61. package/dist/browserToolBridge-F5N66PE7.js +58 -0
  62. package/dist/chrome-ATC4OO5I.cjs +20 -0
  63. package/dist/chrome-NHJ44WUN.js +50 -0
  64. package/dist/chrome-O62WXV7F.js +20 -0
  65. package/dist/chrome-XHJLCO4M.cjs +50 -0
  66. package/dist/chromeSkill-53TH55PM.js +105 -0
  67. package/dist/chromeSkill-THW7N4IY.cjs +105 -0
  68. package/dist/{chunk-EGPXJERY.cjs → chunk-2CGE7ZV3.cjs} +26 -26
  69. package/dist/chunk-2H5O745H.js +63 -0
  70. package/dist/chunk-2HOLOHVK.js +2219 -0
  71. package/dist/{chunk-3PDTTAKJ.js → chunk-2QL6MNXG.js} +15 -8
  72. package/dist/{chunk-U55TWFJI.cjs → chunk-2VHB43IX.cjs} +24 -6
  73. package/dist/{chunk-VG34MG2U.js → chunk-37M5UM6I.js} +9 -6
  74. package/dist/{chunk-KLWJIPU2.cjs → chunk-3DDL2E55.cjs} +20 -16
  75. package/dist/chunk-3EDDDZS2.cjs +5 -0
  76. package/dist/{chunk-2UC22DJU.js → chunk-3GUEUCZK.js} +28 -4
  77. package/dist/{chunk-DVUHHH3B.cjs → chunk-3KLSNNRW.cjs} +4 -4
  78. package/dist/chunk-3LJJG5YY.cjs +387 -0
  79. package/dist/chunk-3OF56EMA.cjs +197 -0
  80. package/dist/chunk-3PXKRVCW.js +108 -0
  81. package/dist/{chunk-ADUFCS4Q.cjs → chunk-3S563FNF.cjs} +160 -79
  82. package/dist/chunk-3UT7R3XV.js +663 -0
  83. package/dist/chunk-4256YRCO.cjs +80 -0
  84. package/dist/chunk-46C73ZKK.cjs +663 -0
  85. package/dist/chunk-46MTALKD.js +44 -0
  86. package/dist/{chunk-AEJH23FO.cjs → chunk-47PHDKNW.cjs} +6 -6
  87. package/dist/chunk-4LMUDS2K.js +124 -0
  88. package/dist/{chunk-HLHTG5ZU.cjs → chunk-5CMYEM3R.cjs} +14 -12
  89. package/dist/{chunk-MBBY4ZIK.js → chunk-5F6ZKSHO.js} +4 -1
  90. package/dist/chunk-5JFTY3VU.js +74 -0
  91. package/dist/chunk-5JTTM5SC.js +59 -0
  92. package/dist/{chunk-IETRBBMP.cjs → chunk-5K3CDSWZ.cjs} +108 -31
  93. package/dist/{chunk-GJH7XMSK.js → chunk-5VHP6HDQ.js} +8 -6
  94. package/dist/{chunk-6ZCULLCA.js → chunk-62RTC3XX.js} +1 -1
  95. package/dist/{chunk-64H4FRM3.cjs → chunk-6GUODJKM.cjs} +32 -34
  96. package/dist/{chunk-47CKWKEX.cjs → chunk-6HH236FV.cjs} +9 -4
  97. package/dist/{chunk-WHE2SWHU.js → chunk-6NVAK6CK.js} +2 -2
  98. package/dist/chunk-6R25D2H5.js +121 -0
  99. package/dist/{chunk-OUZQXMHL.cjs → chunk-6XVVIY54.cjs} +55 -25
  100. package/dist/{chunk-3L53OA4E.cjs → chunk-75EDROHL.cjs} +10 -10
  101. package/dist/{chunk-G4CAKI3V.js → chunk-7HPWMALN.js} +7 -2
  102. package/dist/chunk-7JLT2VNW.cjs +18963 -0
  103. package/dist/chunk-7LWQCE4Y.cjs +987 -0
  104. package/dist/{chunk-OLSBBZW6.cjs → chunk-7MU7LWF3.cjs} +5 -5
  105. package/dist/{chunk-TUD3Z3BD.js → chunk-7RFJB75Y.js} +140 -59
  106. package/dist/{chunk-X2MSVKDV.js → chunk-A7HHCIDQ.js} +2 -2
  107. package/dist/{chunk-SKYG33B2.cjs → chunk-AC7DZ6SK.cjs} +3 -3
  108. package/dist/{chunk-XX2ZO7DS.js → chunk-ACDQGA4Z.js} +90 -16
  109. package/dist/{chunk-CZXGCVTR.cjs → chunk-AOKCI722.cjs} +2 -2
  110. package/dist/chunk-ARBEHFCG.js +715 -0
  111. package/dist/{chunk-OOKY3HPZ.js → chunk-AT7OWLY5.js} +50 -9
  112. package/dist/chunk-AU6JAGZJ.cjs +231 -0
  113. package/dist/chunk-AUFNACED.js +18963 -0
  114. package/dist/{chunk-N2BLVUPM.cjs → chunk-AUYSIEVV.cjs} +3 -3
  115. package/dist/chunk-B4HSNOIH.cjs +354 -0
  116. package/dist/{chunk-EGMZDTSL.js → chunk-B5CGDNMR.js} +10 -2
  117. package/dist/{chunk-FTYY5JJD.js → chunk-BFQDQRDE.js} +2 -2
  118. package/dist/{chunk-2AA5MFES.js → chunk-BL2UC7HC.js} +8 -5
  119. package/dist/{chunk-T2M64VHA.cjs → chunk-BQ22N3TX.cjs} +56 -41
  120. package/dist/chunk-BQU3HAE7.js +21 -0
  121. package/dist/chunk-BWF4VDYE.js +3897 -0
  122. package/dist/chunk-BYE7RQFZ.cjs +121 -0
  123. package/dist/{chunk-APIXPPMT.js → chunk-CBFH2J3O.js} +855 -33
  124. package/dist/chunk-CCVMREXI.js +420 -0
  125. package/dist/chunk-CFAWTLSC.js +13 -0
  126. package/dist/{chunk-G27PQQFD.js → chunk-CFFE4VA3.js} +1 -1
  127. package/dist/{chunk-ZYQMLKOK.cjs → chunk-CH2J4PVE.cjs} +212 -70
  128. package/dist/{chunk-7BTSG4ME.cjs → chunk-CHI52KFR.cjs} +855 -33
  129. package/dist/{chunk-DJDE4DTT.cjs → chunk-CWINVFRI.cjs} +25 -19
  130. package/dist/{chunk-HXGBSJL5.cjs → chunk-D2OSPLYC.cjs} +2 -2
  131. package/dist/{chunk-GBHDROGL.js → chunk-D6GZBSOX.js} +16 -4
  132. package/dist/{chunk-CNBKZEX5.cjs → chunk-DA7NBAJK.cjs} +49 -17
  133. package/dist/chunk-DEQVRSV5.cjs +866 -0
  134. package/dist/{chunk-RGR6ME5J.cjs → chunk-DI57A4BX.cjs} +25 -28
  135. package/dist/{chunk-K2C56QGS.cjs → chunk-DIZTWFVR.cjs} +1499 -482
  136. package/dist/{chunk-YZXUDM5X.js → chunk-DLP436GI.js} +204 -62
  137. package/dist/{chunk-OHUZKDGX.js → chunk-DMRXF5DU.js} +3 -3
  138. package/dist/{chunk-U46VYPLR.cjs → chunk-DPSIGY6L.cjs} +9 -9
  139. package/dist/{chunk-SEKD5FH3.cjs → chunk-E26KKI46.cjs} +5 -2
  140. package/dist/{chunk-SJAVBCOA.js → chunk-E46DJH5S.js} +3 -3
  141. package/dist/{chunk-DV2ZHK7B.cjs → chunk-E6GFD7VR.cjs} +49 -26
  142. package/dist/chunk-ES2HJQ4N.js +37 -0
  143. package/dist/chunk-EZJHLOWP.js +80 -0
  144. package/dist/chunk-FFBDRUO5.cjs +59 -0
  145. package/dist/{chunk-SV2WA57F.js → chunk-FGT6KK6T.js} +38 -15
  146. package/dist/{chunk-SAHBLB3E.js → chunk-FP46B4X3.js} +208 -3
  147. package/dist/{chunk-QXH5RCFI.js → chunk-FQAVGSPW.js} +2 -2
  148. package/dist/chunk-FQVG6ZHF.js +197 -0
  149. package/dist/chunk-GBMDFWJX.cjs +152 -0
  150. package/dist/{chunk-NAGQ2PDC.js → chunk-GGLKUENP.js} +1453 -436
  151. package/dist/{chunk-S52YW5ZQ.js → chunk-GNBBIAMD.js} +16 -19
  152. package/dist/{chunk-MYISNQH4.js → chunk-GWO66KBI.js} +1 -1
  153. package/dist/chunk-GWY26SUD.cjs +63 -0
  154. package/dist/{chunk-YGN4CQIP.js → chunk-GZ6DV2UG.js} +1 -1
  155. package/dist/{chunk-EZMINVLU.js → chunk-H4D2Q2AL.js} +5 -2
  156. package/dist/{chunk-3WVJEL7K.cjs → chunk-HDK2EHVH.cjs} +3 -1
  157. package/dist/chunk-HJIXWGQZ.js +139 -0
  158. package/dist/{chunk-ULDM2SNB.js → chunk-HKYZSUQ5.js} +48 -47
  159. package/dist/{chunk-LQGVEP3E.js → chunk-HQUSEWT4.js} +45 -13
  160. package/dist/{chunk-HTLINWX6.cjs → chunk-HQWQZML5.cjs} +16 -13
  161. package/dist/{chunk-DVZOENQ7.cjs → chunk-HS4USDND.cjs} +9 -4
  162. package/dist/chunk-HSCUPEA4.cjs +3897 -0
  163. package/dist/{chunk-JCLYQ2JC.js → chunk-HXJEGMGB.js} +12 -6
  164. package/dist/{chunk-LJFUXC56.cjs → chunk-HXQREVTA.cjs} +9 -6
  165. package/dist/{chunk-N7LI55V4.js → chunk-I24CWKKK.js} +15 -8
  166. package/dist/chunk-IAGCRVJ3.js +355 -0
  167. package/dist/chunk-IEXKKKOF.cjs +92 -0
  168. package/dist/{chunk-5IXII4HX.cjs → chunk-IGMPWJ2I.cjs} +19 -12
  169. package/dist/chunk-IKUMVBCW.cjs +33 -0
  170. package/dist/{chunk-XTB6VJVQ.cjs → chunk-J2K57QM7.cjs} +6 -6
  171. package/dist/{chunk-56SWIDEL.cjs → chunk-J5ADZN6V.cjs} +57 -56
  172. package/dist/chunk-J5HE6CUM.cjs +124 -0
  173. package/dist/{chunk-LIEXWM2M.js → chunk-JAQO6XDB.js} +19 -1
  174. package/dist/chunk-JIMSII7R.js +987 -0
  175. package/dist/chunk-JJ4KA7HK.cjs +2219 -0
  176. package/dist/{chunk-ZLSGXMGQ.js → chunk-JMN3GZU6.js} +2 -0
  177. package/dist/{chunk-X5VSP65C.cjs → chunk-JP3YHTQ2.cjs} +4 -4
  178. package/dist/{chunk-SKV2F3NM.js → chunk-JYKPWK5O.js} +1 -1
  179. package/dist/{chunk-NNPAM4HC.cjs → chunk-KNTUI4TZ.cjs} +12 -6
  180. package/dist/{chunk-HIVRCQS2.js → chunk-L4F7SUYL.js} +56 -25
  181. package/dist/{chunk-C5IJIM2V.cjs → chunk-LDJQ5QHG.cjs} +68 -37
  182. package/dist/{chunk-ULQ6MDSJ.cjs → chunk-LFDPTJYF.cjs} +43 -35
  183. package/dist/chunk-LJD7KR3L.cjs +44 -0
  184. package/dist/chunk-LN7D3EJZ.js +387 -0
  185. package/dist/{chunk-KANW6OYC.cjs → chunk-LQBONA55.cjs} +32 -8
  186. package/dist/{chunk-NCC6ETZS.js → chunk-LUMV3DB2.js} +41 -33
  187. package/dist/chunk-M4KNC5BQ.js +78 -0
  188. package/dist/chunk-MO4KP6XS.cjs +229 -0
  189. package/dist/{chunk-BVKXEQVG.cjs → chunk-MOJ7ADW4.cjs} +22 -10
  190. package/dist/chunk-MPULXVC4.cjs +715 -0
  191. package/dist/{chunk-VEKDGU2Q.cjs → chunk-MQESBFBZ.cjs} +46 -23
  192. package/dist/chunk-MUNUUFU7.cjs +21 -0
  193. package/dist/{chunk-ZSPXQYG2.js → chunk-MX75JYIY.js} +7 -5
  194. package/dist/chunk-MXVIDIC6.cjs +139 -0
  195. package/dist/{chunk-3K2ESU53.cjs → chunk-N6O3XUZ2.cjs} +2 -2
  196. package/dist/{chunk-BYONM7UM.js → chunk-NBGOIFKP.js} +265 -18
  197. package/dist/{chunk-SLQAYV3W.js → chunk-NMQ47RCG.js} +8 -2
  198. package/dist/{chunk-JYTDYJVW.js → chunk-O64I2GYI.js} +1 -1
  199. package/dist/{chunk-IFFXSTOM.cjs → chunk-O6TQP7U7.cjs} +3 -3
  200. package/dist/{chunk-AYS2ASM7.js → chunk-OHWMWKJQ.js} +1 -1
  201. package/dist/{chunk-N23UAW4I.js → chunk-OM24WXEE.js} +7 -2
  202. package/dist/{chunk-NAJ4IZKD.cjs → chunk-OPNI6O7F.cjs} +8 -6
  203. package/dist/chunk-OR67YXQK.cjs +13 -0
  204. package/dist/{chunk-XVUHNWMX.js → chunk-OV3PVUYN.js} +17 -19
  205. package/dist/{chunk-TNZRZQ7Q.js → chunk-PB7W7R72.js} +3 -78
  206. package/dist/chunk-PCM3N3CL.cjs +37 -0
  207. package/dist/{chunk-A4IJHHV7.cjs → chunk-PDHT7LQS.cjs} +52 -11
  208. package/dist/{chunk-HPHJ73GU.cjs → chunk-PHJO5YAL.cjs} +9 -9
  209. package/dist/{chunk-KPELYZ6L.js → chunk-PQLKJCIE.js} +2 -2
  210. package/dist/chunk-PUD76XQT.cjs +78 -0
  211. package/dist/chunk-Q2IL4DDI.cjs +355 -0
  212. package/dist/{chunk-WPVWQSL7.cjs → chunk-Q6AC3PHY.cjs} +16 -13
  213. package/dist/{chunk-XRZEUWKF.js → chunk-QCHIDZBA.js} +1 -1
  214. package/dist/chunk-QKP772OZ.js +4291 -0
  215. package/dist/chunk-QQ7PANOP.js +59 -0
  216. package/dist/{chunk-YHD6TUIR.cjs → chunk-QW2RW2GY.cjs} +2 -0
  217. package/dist/chunk-RAKO7UN7.js +114 -0
  218. package/dist/chunk-RBHANOYY.js +33 -0
  219. package/dist/chunk-RBZ7AFX7.cjs +29 -0
  220. package/dist/{chunk-GCXYXLRA.cjs → chunk-REMGR23V.cjs} +46 -49
  221. package/dist/chunk-ROLA6EFO.cjs +85 -0
  222. package/dist/{chunk-RDF37HKB.cjs → chunk-SOLBYSLY.cjs} +3 -2
  223. package/dist/{chunk-KQGPTCQJ.js → chunk-SWCQM52V.js} +68 -25
  224. package/dist/{chunk-L3TWPROA.js → chunk-TBOLJDUG.js} +39 -24
  225. package/dist/chunk-TH26BQJG.js +101 -0
  226. package/dist/{chunk-245KJE5Y.cjs → chunk-TJNBASFD.cjs} +14 -6
  227. package/dist/chunk-TKKN34TV.js +229 -0
  228. package/dist/chunk-TQ33WBY5.cjs +74 -0
  229. package/dist/{chunk-EGFT4PGW.js → chunk-TWQDAUZU.js} +5 -2
  230. package/dist/{chunk-J2GSFVUV.cjs → chunk-TXPSTCG7.cjs} +74 -59
  231. package/dist/{chunk-5K6NGAVM.js → chunk-U4C3HW6P.js} +67 -52
  232. package/dist/{chunk-3WICOC33.js → chunk-UEIXJG45.js} +105 -81
  233. package/dist/{chunk-22D2CNTP.cjs → chunk-UGFVM77J.cjs} +5 -2
  234. package/dist/chunk-UOQECODR.js +34 -0
  235. package/dist/chunk-UR27UDTB.js +354 -0
  236. package/dist/chunk-UWFG2R2I.cjs +420 -0
  237. package/dist/{chunk-Y72HH2TF.cjs → chunk-UXLW45ZE.cjs} +102 -28
  238. package/dist/{chunk-FPHU2ES6.cjs → chunk-VBOFPU5M.cjs} +6 -0
  239. package/dist/{chunk-NTSDP2WB.js → chunk-VDWJMWDF.js} +54 -24
  240. package/dist/{chunk-3O3MOK5C.cjs → chunk-VGEV44V2.cjs} +944 -133
  241. package/dist/{chunk-IDFF5J2E.js → chunk-VKBIE6I6.js} +38 -7
  242. package/dist/{chunk-HBZU3RBZ.js → chunk-VRMZO6TB.js} +31 -8
  243. package/dist/chunk-VUGOOGHB.js +400 -0
  244. package/dist/chunk-WBU4Q4GS.cjs +400 -0
  245. package/dist/chunk-WGLBC5AY.cjs +59 -0
  246. package/dist/{chunk-KWXVKLQ5.cjs → chunk-WGNMOVMT.cjs} +7 -82
  247. package/dist/{chunk-RKJTGGMU.cjs → chunk-WKRDBCP2.cjs} +221 -16
  248. package/dist/chunk-WRTXCQ3V.cjs +4291 -0
  249. package/dist/chunk-WTB7AFL6.cjs +101 -0
  250. package/dist/{chunk-NDMIPTV4.js → chunk-WZV6UVPY.js} +8 -3
  251. package/dist/chunk-XF2WIKHR.cjs +34 -0
  252. package/dist/{chunk-W7RYQJLO.cjs → chunk-XGMI6IYB.cjs} +46 -15
  253. package/dist/{chunk-NA6WQDYW.js → chunk-XIVFAD2L.js} +918 -107
  254. package/dist/chunk-XV2HXRHX.js +85 -0
  255. package/dist/{chunk-3VTAFAL2.js → chunk-Y3M2DABP.js} +16 -12
  256. package/dist/{chunk-QNGEW5TC.js → chunk-YV63VW4K.js} +1 -1
  257. package/dist/{chunk-UJ2JSM6H.js → chunk-YVQI26H4.js} +2 -0
  258. package/dist/{chunk-X2YOZQIP.cjs → chunk-YWTIXHU6.cjs} +266 -19
  259. package/dist/chunk-YZWE7XSM.js +5 -0
  260. package/dist/{chunk-TUAITHWL.js → chunk-Z3XSSF7B.js} +2 -1
  261. package/dist/{chunk-6UJMCWRY.js → chunk-Z4LIPMPM.js} +6 -0
  262. package/dist/chunk-ZASDSY7P.cjs +114 -0
  263. package/dist/{chunk-R33VKSH5.cjs → chunk-ZHJ7JGME.cjs} +11 -11
  264. package/dist/chunk-ZPD2AO3U.js +866 -0
  265. package/dist/{chunk-7UOUW76C.js → chunk-ZQAT5VT5.js} +101 -24
  266. package/dist/chunk-ZR46OJNZ.js +152 -0
  267. package/dist/{chunk-7TQH3CL4.cjs → chunk-ZZ63NW7A.cjs} +78 -35
  268. package/dist/clear-33TWQ2ES.cjs +12 -0
  269. package/dist/{clear-A3N4GK2S.js → clear-OFLFQ3MR.js} +3 -3
  270. package/dist/{communityInstaller-LOP2EDH5.js → communityInstaller-COB2KTOW.js} +8 -5
  271. package/dist/communityInstaller-TWMGPSYM.cjs +22 -0
  272. package/dist/completion-IIZMHXYP.cjs +17 -0
  273. package/dist/completion-PT4VM2H2.js +17 -0
  274. package/dist/config-KL6WU7R2.cjs +20 -0
  275. package/dist/{config-HPJPKTO6.js → config-R4O7GBTY.js} +6 -4
  276. package/dist/{constants-LISJW3DD.js → constants-HVCHVQAF.js} +1 -1
  277. package/dist/constants-RLMJ5D5P.cjs +21 -0
  278. package/dist/{defaultHooks-IHSJR2AX.cjs → defaultHooks-2V2CQL63.cjs} +25 -10
  279. package/dist/{defaultHooks-KUKHK3AG.js → defaultHooks-TMHDU3FS.js} +25 -10
  280. package/dist/export-3PK3VFCE.js +15 -0
  281. package/dist/export-WLGNWEMJ.cjs +15 -0
  282. package/dist/feedback-G635NCLJ.js +18 -0
  283. package/dist/feedback-LLMK3TZH.cjs +18 -0
  284. package/dist/fffSearchProvider-2YCNKOYD.js +412 -0
  285. package/dist/fffSearchProvider-W6627E2V.cjs +412 -0
  286. package/dist/{filesystem-Z7BWAWMZ.js → filesystem-L6DQKGWK.js} +3 -2
  287. package/dist/filesystem-PGUPCMVK.cjs +11 -0
  288. package/dist/help-BAXLP2M2.cjs +12 -0
  289. package/dist/{help-GFQXNZOK.js → help-X3OAZ3CY.js} +2 -2
  290. package/dist/history-6HOJSEMT.cjs +14 -0
  291. package/dist/{history-E3N6BJP7.js → history-YKFPHBJN.js} +2 -2
  292. package/dist/hooks-7TA4PIIB.js +18 -0
  293. package/dist/hooks-XVFU67T2.cjs +18 -0
  294. package/dist/{i18n-SY7QRM22.js → i18n-2KBUU7XL.js} +1 -1
  295. package/dist/i18n-MUJMKTFM.cjs +33 -0
  296. package/dist/ide-CCQ33PGC.cjs +15 -0
  297. package/dist/ide-VLVFBZ5F.js +15 -0
  298. package/dist/immediateCommandRouter-MTEHZXQX.js +15 -0
  299. package/dist/immediateCommandRouter-ROXU3MWT.cjs +15 -0
  300. package/dist/{import-W7SVLSTC.js → import-4CHYLS4K.js} +3 -3
  301. package/dist/{import-ADI37ZUR.cjs → import-I7T4ZHYL.cjs} +3 -3
  302. package/dist/import-J46F54JY.cjs +10 -0
  303. package/dist/{import-KGKKZ3B7.js → import-JWPYKXCZ.js} +2 -2
  304. package/dist/index.cjs +744 -23015
  305. package/dist/index.d.cts +93 -0
  306. package/dist/index.d.ts +93 -0
  307. package/dist/index.js +780 -23051
  308. package/dist/{init-7MFK626E.js → init-262MWZV4.js} +2 -2
  309. package/dist/init-EE5Y7RBL.cjs +10 -0
  310. package/dist/inkMode-VUE6ZDLD.cjs +7 -0
  311. package/dist/inkMode-WBNFOSAT.js +7 -0
  312. package/dist/inputPrompt-IIFKCX5Q.cjs +90 -0
  313. package/dist/inputPrompt-YGBHDUEP.js +90 -0
  314. package/dist/language-CVLPB7OV.js +21 -0
  315. package/dist/language-ZTWFHUSV.cjs +21 -0
  316. package/dist/learn-PON7I5QS.js +23 -0
  317. package/dist/learn-XLRSVNA3.cjs +23 -0
  318. package/dist/login-223QTGBG.cjs +26 -0
  319. package/dist/login-6IKTBUBY.js +26 -0
  320. package/dist/logout-RN2AG6SI.js +23 -0
  321. package/dist/logout-U3M4FFX7.cjs +23 -0
  322. package/dist/mcp-5O6PUL4G.js +20 -0
  323. package/dist/mcp-NUQ76QQB.cjs +20 -0
  324. package/dist/{mcp-install-2FEROZTL.js → mcp-install-6XWXLFVY.js} +17 -10
  325. package/dist/{mcp-install-WM6BQRI5.cjs → mcp-install-P6DHES7V.cjs} +21 -14
  326. package/dist/memory-CYMDQ2YC.cjs +10 -0
  327. package/dist/{memory-J73WZH2I.js → memory-Q54CESNM.js} +2 -2
  328. package/dist/{model-AES267IN.js → model-6AJ77PJG.js} +2 -2
  329. package/dist/model-IDRCKDML.cjs +10 -0
  330. package/dist/new-7LEWOUF2.cjs +12 -0
  331. package/dist/{new-5CLF3MKH.js → new-ZXHEWC2S.js} +3 -3
  332. package/dist/onboarding-FXX7YHSJ.cjs +35 -0
  333. package/dist/onboarding-JYNMK6NI.js +35 -0
  334. package/dist/permissions-YBNSANIA.cjs +10 -0
  335. package/dist/permissions-YHJMVA6L.js +10 -0
  336. package/dist/plan-XEJMOT55.cjs +13 -0
  337. package/dist/{plan-65HMS5HQ.js → plan-YYUAXPTL.js} +3 -1
  338. package/dist/pr-review-CW6J7P62.cjs +9 -0
  339. package/dist/pr-review-YZSBQVT2.js +9 -0
  340. package/dist/quit-B43SJ6E4.cjs +10 -0
  341. package/dist/{quit-XDZYRSPU.js → quit-GWTNHQSP.js} +2 -2
  342. package/dist/rawMode-6W5AXAKI.cjs +7 -0
  343. package/dist/rawMode-GFNLXQPU.js +7 -0
  344. package/dist/{registry-PTHWERKC.js → registry-34GL6BNJ.js} +29 -44
  345. package/dist/{registry-IVT4G2RT.cjs → registry-V24W7YK6.cjs} +65 -80
  346. package/dist/repeat-P4FAPE3Y.cjs +17 -0
  347. package/dist/{repeat-EVCWUL6Z.js → repeat-RALE6AUO.js} +7 -3
  348. package/dist/resume-DYVOQN5L.cjs +16 -0
  349. package/dist/resume-M25UQKOX.js +16 -0
  350. package/dist/review-QHP2KP4Q.js +9 -0
  351. package/dist/review-UWHWQHCB.cjs +9 -0
  352. package/dist/ripgrep-67SCU2BA.cjs +9 -0
  353. package/dist/ripgrep-VHJQQ55W.js +9 -0
  354. package/dist/rpc-NPS3PU4O.cjs +3730 -0
  355. package/dist/rpc-S3DGW6KV.js +3730 -0
  356. package/dist/search-CPX4PWHP.js +20 -0
  357. package/dist/search-VUF3M4N3.cjs +20 -0
  358. package/dist/{sessions-6GWEBMKS.js → sessions-IYAXMK23.js} +2 -2
  359. package/dist/sessions-JODKER5D.cjs +10 -0
  360. package/dist/{settings-BXR6SBJP.js → settings-55BNW6BF.js} +11 -8
  361. package/dist/settings-BKTS7OMC.cjs +33 -0
  362. package/dist/setup-IRC5HQG2.js +29 -0
  363. package/dist/setup-MMQ7TWOP.cjs +29 -0
  364. package/dist/share-6JRQECAH.cjs +17 -0
  365. package/dist/share-YM5MJKMO.js +17 -0
  366. package/dist/{skills-PG542VEB.cjs → skills-GGMZOVIE.cjs} +13 -10
  367. package/dist/skills-LWSOKOSH.cjs +29 -0
  368. package/dist/{skills-ZZCIAS7C.js → skills-MVIZNHT4.js} +12 -9
  369. package/dist/skills-VWOMV3CR.js +29 -0
  370. package/dist/{skills-install-SRC3Z2MS.js → skills-install-QBA5RCV6.js} +21 -70
  371. package/dist/{skills-install-67DOBPJC.cjs → skills-install-VTAMCNNY.cjs} +34 -83
  372. package/dist/skills-new-GPL46YV2.js +18 -0
  373. package/dist/skills-new-L5BEZN5V.cjs +18 -0
  374. package/dist/slashCommands-FBPCIWM5.cjs +95 -0
  375. package/dist/slashCommands-FCWY5DXW.js +95 -0
  376. package/dist/status-3B5SDZPL.js +17 -0
  377. package/dist/status-TTGRF6NC.cjs +17 -0
  378. package/dist/summarizer-DGPHE5IQ.js +17 -0
  379. package/dist/summarizer-JNXLUAQG.cjs +17 -0
  380. package/dist/sync-77CXVVTK.cjs +21 -0
  381. package/dist/{sync-VU2NSJ4O.js → sync-7BILIQHP.js} +3 -3
  382. package/dist/sync-7OKF6636.js +21 -0
  383. package/dist/sync-EH4K5U3N.cjs +40 -0
  384. package/dist/{teammate-SD26GR37.js → teammate-GZQSCIMS.js} +28 -7
  385. package/dist/{teammate-SXRVXNQV.cjs → teammate-J6PHGL23.cjs} +29 -8
  386. package/dist/theme-64BYGJ57.cjs +21 -0
  387. package/dist/theme-YJE6HEON.js +21 -0
  388. package/dist/tools-3PPTTKFV.js +9 -0
  389. package/dist/tools-THIQA7WC.cjs +9 -0
  390. package/dist/ui/questionModal.cjs +8 -5
  391. package/dist/ui/questionModal.js +7 -4
  392. package/dist/undo-PRTEGL2J.cjs +10 -0
  393. package/dist/{undo-OL2EDBRY.js → undo-SZEHLX7X.js} +2 -2
  394. package/dist/web-3BA2WV37.cjs +37 -0
  395. package/dist/web-6FYGBX5K.js +37 -0
  396. package/dist/workspaceSafety-MDJGHK6D.cjs +9 -0
  397. package/dist/workspaceSafety-XOUMUBVB.js +9 -0
  398. package/dist/yolo-GF2YD7ZI.js +9 -0
  399. package/dist/yolo-OGDA7HNC.cjs +9 -0
  400. package/dist/yoloMode-3DJDA75U.cjs +17 -0
  401. package/dist/yoloMode-4JOOSU26.js +17 -0
  402. package/package.json +46 -49
  403. package/dist/AgentRegistry-HRPN6ZOF.cjs +0 -10
  404. package/dist/CommunitySkillsCache-KE435RAR.cjs +0 -8
  405. package/dist/GitHubRegistryFetcher-I45SESIL.cjs +0 -7
  406. package/dist/LearnAdvisor-FLBA6FDD.js +0 -9
  407. package/dist/LearnAdvisor-GG3CXQF3.cjs +0 -9
  408. package/dist/MemoryManager-2LQPIYVE.cjs +0 -8
  409. package/dist/PermissionManager-X57BXHJ6.cjs +0 -11
  410. package/dist/ProviderFactory-KPJOGQWF.cjs +0 -9
  411. package/dist/SessionManager-YBJAZXNO.cjs +0 -10
  412. package/dist/SkillsRegistry-7O72A6TZ.cjs +0 -9
  413. package/dist/SubAgent-JT4HZHN7.js +0 -11
  414. package/dist/SubAgent-VPNYDWAU.cjs +0 -11
  415. package/dist/SyncApiClient-HQXJL5BT.cjs +0 -11
  416. package/dist/about-4DB5KTHW.js +0 -12
  417. package/dist/about-LXAOXZFT.cjs +0 -12
  418. package/dist/actionExecutor-23JB2WUC.js +0 -19
  419. package/dist/actionExecutor-X5UEZSKH.cjs +0 -19
  420. package/dist/add-dir-YC37DMSF.cjs +0 -10
  421. package/dist/agents-YF3BSUU5.js +0 -12
  422. package/dist/agents-ZOUHPMYR.cjs +0 -12
  423. package/dist/agents-new-HSH4GQPG.js +0 -14
  424. package/dist/agents-new-VYUDOCE7.cjs +0 -14
  425. package/dist/autoSkill-X5W52WOE.cjs +0 -20
  426. package/dist/automode-SJGM7VEI.cjs +0 -10
  427. package/dist/chunk-ALYU6VTM.js +0 -105
  428. package/dist/chunk-B53A2NM2.js +0 -2030
  429. package/dist/chunk-BJXSNT46.js +0 -100
  430. package/dist/chunk-CB4E2T5N.cjs +0 -312
  431. package/dist/chunk-DNUOXBHL.js +0 -539
  432. package/dist/chunk-EFX2QSZX.cjs +0 -33
  433. package/dist/chunk-H2ZRHQQV.js +0 -33
  434. package/dist/chunk-HNRPK5MY.cjs +0 -85
  435. package/dist/chunk-HVKOZ2VP.cjs +0 -115
  436. package/dist/chunk-JJLYWH5Y.cjs +0 -100
  437. package/dist/chunk-LWUJFGOZ.js +0 -115
  438. package/dist/chunk-MERYP6AM.cjs +0 -539
  439. package/dist/chunk-MZAPWNAC.cjs +0 -207
  440. package/dist/chunk-PGESAU2W.cjs +0 -2030
  441. package/dist/chunk-SYVYLZZF.cjs +0 -24
  442. package/dist/chunk-SZOLA6FR.js +0 -111
  443. package/dist/chunk-VWDHR4HV.js +0 -168
  444. package/dist/chunk-Y45G6ZO5.cjs +0 -168
  445. package/dist/chunk-YRLYSQEQ.cjs +0 -105
  446. package/dist/chunk-ZYVS43MU.js +0 -312
  447. package/dist/clear-GK4IEUUS.cjs +0 -12
  448. package/dist/communityInstaller-XXC7RLE4.cjs +0 -19
  449. package/dist/completion-HWABSAEL.js +0 -14
  450. package/dist/completion-IUUVQG4D.cjs +0 -14
  451. package/dist/config-HF7WOLZF.cjs +0 -18
  452. package/dist/constants-PEO3P2SJ.cjs +0 -21
  453. package/dist/export-QJAV2FCZ.js +0 -12
  454. package/dist/export-XSRFXGWU.cjs +0 -12
  455. package/dist/feedback-4TCIL3ML.cjs +0 -15
  456. package/dist/feedback-SJ6VVEY3.js +0 -15
  457. package/dist/filesystem-W56QZUJF.cjs +0 -10
  458. package/dist/help-ISBVQL3S.cjs +0 -12
  459. package/dist/history-XQ4GTSFU.cjs +0 -14
  460. package/dist/hooks-CJNKJ5PF.js +0 -13
  461. package/dist/hooks-UTMBTAXT.cjs +0 -13
  462. package/dist/i18n-N7QQ7A5M.cjs +0 -33
  463. package/dist/ide-RTA4UJV4.js +0 -12
  464. package/dist/ide-VWVOLIFF.cjs +0 -12
  465. package/dist/immediateCommandRouter-BW34JNXL.js +0 -9
  466. package/dist/immediateCommandRouter-SHOVNB5X.cjs +0 -9
  467. package/dist/import-ZLJVONXH.cjs +0 -10
  468. package/dist/init-TBKAB4LZ.cjs +0 -10
  469. package/dist/language-MDSHEXHB.cjs +0 -18
  470. package/dist/language-PXTQSHIG.js +0 -18
  471. package/dist/learn-623TW5EK.cjs +0 -20
  472. package/dist/learn-BCPV7GM2.js +0 -20
  473. package/dist/localProjectPermissions-BHQXEWZJ.cjs +0 -18
  474. package/dist/localProjectPermissions-GMOUYQM6.js +0 -18
  475. package/dist/login-QMVEETWJ.js +0 -20
  476. package/dist/login-QYMXAL3K.cjs +0 -20
  477. package/dist/logout-2CMTDAOJ.js +0 -18
  478. package/dist/logout-ZOHVZAUK.cjs +0 -18
  479. package/dist/mcp-IUVKK65S.js +0 -18
  480. package/dist/mcp-TXC7PYG3.cjs +0 -18
  481. package/dist/memory-WRIHDEPK.cjs +0 -10
  482. package/dist/model-RLP75SF5.cjs +0 -10
  483. package/dist/new-HLSFL6A4.cjs +0 -12
  484. package/dist/permissions-GP6FTGZ2.js +0 -13
  485. package/dist/permissions-O6EKKPOG.cjs +0 -13
  486. package/dist/plan-MCAXDIM2.cjs +0 -11
  487. package/dist/quit-TQX6GXA5.cjs +0 -10
  488. package/dist/repeat-BSPS5TWD.cjs +0 -13
  489. package/dist/resume-2GOPDLL4.cjs +0 -13
  490. package/dist/resume-37IUVDA6.js +0 -13
  491. package/dist/search-7KUSHIBL.cjs +0 -17
  492. package/dist/search-OJGDRIMA.js +0 -17
  493. package/dist/sessions-CYYCHSQG.cjs +0 -10
  494. package/dist/settings-2D7CAO66.cjs +0 -30
  495. package/dist/share-BXQY5IQU.js +0 -14
  496. package/dist/share-OSFXZBGS.cjs +0 -14
  497. package/dist/skills-FL6O6AOM.cjs +0 -26
  498. package/dist/skills-PNKQZRNK.js +0 -26
  499. package/dist/skills-new-XFMEHHIF.cjs +0 -15
  500. package/dist/skills-new-ZNZPHUKS.js +0 -15
  501. package/dist/slashCommands-LLCNPK3X.js +0 -76
  502. package/dist/slashCommands-RXZZS6RE.cjs +0 -76
  503. package/dist/status-BCECUJXT.cjs +0 -11
  504. package/dist/status-EFO7MQU3.js +0 -11
  505. package/dist/sync-IJYJ6KKM.js +0 -18
  506. package/dist/sync-LFT6SBPF.cjs +0 -18
  507. package/dist/sync-U7SDPBNZ.cjs +0 -40
  508. package/dist/theme-AWBHSG7J.cjs +0 -18
  509. package/dist/theme-TQLBPJ2E.js +0 -18
  510. package/dist/undo-IBBGP7A2.cjs +0 -10
@@ -1,34 +1,46 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } async function _asyncNullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return await rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } async function _asyncNullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return await rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class; var _class2; var _class3;
2
2
 
3
- var _chunkMERYP6AMcjs = require('./chunk-MERYP6AM.cjs');
3
+ var _chunkHXQREVTAcjs = require('./chunk-HXQREVTA.cjs');
4
4
 
5
5
 
6
6
  var _chunk4JNNTOGFcjs = require('./chunk-4JNNTOGF.cjs');
7
7
 
8
8
 
9
+ var _chunkDEQVRSV5cjs = require('./chunk-DEQVRSV5.cjs');
9
10
 
10
11
 
11
12
 
12
13
 
13
- var _chunkRKJTGGMUcjs = require('./chunk-RKJTGGMU.cjs');
14
+ var _chunkJ5HE6CUMcjs = require('./chunk-J5HE6CUM.cjs');
14
15
 
15
16
 
17
+ var _chunkWTB7AFL6cjs = require('./chunk-WTB7AFL6.cjs');
16
18
 
17
- var _chunkZYQMLKOKcjs = require('./chunk-ZYQMLKOK.cjs');
18
19
 
20
+ var _chunkWBU4Q4GScjs = require('./chunk-WBU4Q4GS.cjs');
19
21
 
20
22
 
23
+ var _chunkLFDPTJYFcjs = require('./chunk-LFDPTJYF.cjs');
21
24
 
22
- var _chunkU55TWFJIcjs = require('./chunk-U55TWFJI.cjs');
23
25
 
24
26
 
25
- var _chunkSEKD5FH3cjs = require('./chunk-SEKD5FH3.cjs');
26
27
 
27
28
 
28
- var _chunkULQ6MDSJcjs = require('./chunk-ULQ6MDSJ.cjs');
29
29
 
30
+ var _chunkWKRDBCP2cjs = require('./chunk-WKRDBCP2.cjs');
30
31
 
31
- var _chunkLJFUXC56cjs = require('./chunk-LJFUXC56.cjs');
32
+
33
+
34
+ var _chunkCH2J4PVEcjs = require('./chunk-CH2J4PVE.cjs');
35
+
36
+
37
+
38
+
39
+ var _chunk2VHB43IXcjs = require('./chunk-2VHB43IX.cjs');
40
+
41
+
42
+
43
+ var _chunkE26KKI46cjs = require('./chunk-E26KKI46.cjs');
32
44
 
33
45
  // src/core/actionExecutor.ts
34
46
  var _chalk = require('chalk'); var _chalk2 = _interopRequireDefault(_chalk);
@@ -515,8 +527,8 @@ function tokenize(code, language) {
515
527
  return tokens;
516
528
  }
517
529
  function colorToken(token) {
518
- if (_chunkU55TWFJIcjs.isThemeInitialized.call(void 0, )) {
519
- const theme = _chunkU55TWFJIcjs.getTheme.call(void 0, );
530
+ if (_chunk2VHB43IXcjs.isThemeInitialized.call(void 0, )) {
531
+ const theme = _chunk2VHB43IXcjs.getTheme.call(void 0, );
520
532
  switch (token.type) {
521
533
  case "keyword":
522
534
  return theme.fg("syntaxKeyword", token.value);
@@ -596,88 +608,6 @@ async function removeDependency(cwd, name, options = {}) {
596
608
  }
597
609
  }
598
610
 
599
- // src/actions/command.ts
600
- var _child_process = require('child_process');
601
-
602
- function runCommand(cmd, args, cwd, options = {}) {
603
- if (!cmd || typeof cmd !== "string") {
604
- return Promise.reject(new Error("Command is required and must be a string"));
605
- }
606
- return new Promise((resolve, reject) => {
607
- const workDir = options.directory ? _path.join.call(void 0, cwd, options.directory) : cwd;
608
- const spawnOptions = {
609
- cwd: workDir,
610
- shell: _nullishCoalesce(options.shell, () => ( false)),
611
- env: {
612
- ...process.env,
613
- AUTOHAND_CLI: "1",
614
- ...options.env
615
- }
616
- };
617
- if (options.background) {
618
- spawnOptions.detached = true;
619
- spawnOptions.stdio = ["ignore", "pipe", "pipe"];
620
- }
621
- let child;
622
- try {
623
- child = _child_process.spawn.call(void 0, cmd, args, spawnOptions);
624
- } catch (error) {
625
- const err = error;
626
- if (err.code === "ENOENT") {
627
- reject(new Error(`Command not found: ${cmd}`));
628
- } else {
629
- reject(error);
630
- }
631
- return;
632
- }
633
- if (options.background) {
634
- child.unref();
635
- resolve({
636
- stdout: "",
637
- stderr: "",
638
- code: null,
639
- backgroundPid: child.pid,
640
- signal: null
641
- });
642
- return;
643
- }
644
- let stdout = "";
645
- let stderr = "";
646
- let timeoutId;
647
- if (options.timeout && options.timeout > 0) {
648
- timeoutId = setTimeout(() => {
649
- child.kill("SIGTERM");
650
- }, options.timeout);
651
- }
652
- _optionalChain([child, 'access', _ => _.stdout, 'optionalAccess', _2 => _2.on, 'call', _3 => _3("data", (chunk) => {
653
- const text = typeof chunk === "string" ? chunk : chunk.toString("utf8");
654
- stdout += text;
655
- _optionalChain([options, 'access', _4 => _4.onStdout, 'optionalCall', _5 => _5(text)]);
656
- })]);
657
- _optionalChain([child, 'access', _6 => _6.stderr, 'optionalAccess', _7 => _7.on, 'call', _8 => _8("data", (chunk) => {
658
- const text = typeof chunk === "string" ? chunk : chunk.toString("utf8");
659
- stderr += text;
660
- _optionalChain([options, 'access', _9 => _9.onStderr, 'optionalCall', _10 => _10(text)]);
661
- })]);
662
- child.once("error", (error) => {
663
- if (timeoutId) clearTimeout(timeoutId);
664
- if (error.code === "ENOENT") {
665
- reject(new Error(`Command not found: ${cmd}`));
666
- } else {
667
- reject(error);
668
- }
669
- });
670
- child.once("close", (code, signal) => {
671
- if (timeoutId) clearTimeout(timeoutId);
672
- resolve({ stdout, stderr, code, signal });
673
- });
674
- });
675
- }
676
- var SHELL_PATTERN = /[|><;&`]|\$[({A-Za-z_]|&&|\|\||[*?](?![\w./-]*$)/;
677
- function needsShell(cmd) {
678
- return SHELL_PATTERN.test(cmd);
679
- }
680
-
681
611
  // src/actions/metadata.ts
682
612
  var _crypto = require('crypto'); var _crypto2 = _interopRequireDefault(_crypto);
683
613
 
@@ -688,12 +618,7 @@ async function listDirectoryTree(root, options = {}) {
688
618
  const maxEntries = _nullishCoalesce(options.maxEntries, () => ( 200));
689
619
  const workspaceRoot = _nullishCoalesce(options.workspaceRoot, () => ( root));
690
620
  const result = [];
691
- const resolvedRoot = _path2.default.resolve(root);
692
- const resolvedWorkspace = _path2.default.resolve(workspaceRoot);
693
- if (!resolvedRoot.startsWith(resolvedWorkspace)) {
694
- throw new Error(`Path ${root} is outside the workspace root.`);
695
- }
696
- const ignoreFilter = new (0, _chunkLJFUXC56cjs.GitIgnoreParser)(workspaceRoot);
621
+ const ignoreFilter = new (0, _chunkHXQREVTAcjs.GitIgnoreParser)(workspaceRoot);
697
622
  async function walk(current, prefix, currentDepth) {
698
623
  if (result.length >= maxEntries) {
699
624
  return;
@@ -759,7 +684,7 @@ async function checksumFile(root, relativePath, algorithm = "sha256") {
759
684
  }
760
685
 
761
686
  // src/actions/git.ts
762
-
687
+ var _child_process = require('child_process');
763
688
  var GIT_SAFETY = {
764
689
  /** Branches where force push is blocked */
765
690
  PROTECTED_BRANCHES: ["main", "master", "develop", "production", "staging"],
@@ -768,7 +693,7 @@ var GIT_SAFETY = {
768
693
  };
769
694
  function getCurrentBranch(cwd) {
770
695
  const result = _child_process.spawnSync.call(void 0, "git", ["rev-parse", "--abbrev-ref", "HEAD"], { cwd, encoding: "utf8" });
771
- return _optionalChain([result, 'access', _11 => _11.stdout, 'optionalAccess', _12 => _12.trim, 'call', _13 => _13()]) || "";
696
+ return _optionalChain([result, 'access', _ => _.stdout, 'optionalAccess', _2 => _2.trim, 'call', _3 => _3()]) || "";
772
697
  }
773
698
  function getCommitsAhead(cwd, remote = "origin", branch) {
774
699
  const currentBranch = branch || getCurrentBranch(cwd);
@@ -777,7 +702,7 @@ function getCommitsAhead(cwd, remote = "origin", branch) {
777
702
  cwd,
778
703
  encoding: "utf8"
779
704
  });
780
- return parseInt(_optionalChain([result, 'access', _14 => _14.stdout, 'optionalAccess', _15 => _15.trim, 'call', _16 => _16()]) || "0", 10) || 0;
705
+ return parseInt(_optionalChain([result, 'access', _4 => _4.stdout, 'optionalAccess', _5 => _5.trim, 'call', _6 => _6()]) || "0", 10) || 0;
781
706
  }
782
707
  function applyGitPatch(cwd, patch) {
783
708
  const result = _child_process.spawnSync.call(void 0, "git", ["apply", "-"], {
@@ -797,6 +722,13 @@ function diffFile(cwd, file) {
797
722
  }
798
723
  return result.stdout || "No diff";
799
724
  }
725
+ function diffWorkspace(cwd) {
726
+ const result = _child_process.spawnSync.call(void 0, "git", ["diff"], { cwd, encoding: "utf8" });
727
+ if (result.status !== 0) {
728
+ throw new Error(result.stderr || "git diff failed");
729
+ }
730
+ return result.stdout || "No diff";
731
+ }
800
732
  function checkoutFile(cwd, file) {
801
733
  const result = _child_process.spawnSync.call(void 0, "git", ["checkout", "--", file], { cwd, encoding: "utf8" });
802
734
  if (result.status !== 0) {
@@ -833,7 +765,7 @@ function gitDiffRange(cwd, options = {}) {
833
765
  if (options.range) {
834
766
  args.push(options.range);
835
767
  }
836
- if (_optionalChain([options, 'access', _17 => _17.paths, 'optionalAccess', _18 => _18.length])) {
768
+ if (_optionalChain([options, 'access', _7 => _7.paths, 'optionalAccess', _8 => _8.length])) {
837
769
  args.push("--", ...options.paths);
838
770
  }
839
771
  const result = _child_process.spawnSync.call(void 0, "git", args, { cwd, encoding: "utf8" });
@@ -1132,7 +1064,7 @@ function getAutoCommitInfo(cwd) {
1132
1064
  diffSummary: ""
1133
1065
  };
1134
1066
  }
1135
- const changes = _optionalChain([statusResult, 'access', _19 => _19.stdout, 'optionalAccess', _20 => _20.trim, 'call', _21 => _21(), 'access', _22 => _22.split, 'call', _23 => _23("\n"), 'access', _24 => _24.filter, 'call', _25 => _25(Boolean)]) || [];
1067
+ const changes = _optionalChain([statusResult, 'access', _9 => _9.stdout, 'optionalAccess', _10 => _10.trim, 'call', _11 => _11(), 'access', _12 => _12.split, 'call', _13 => _13("\n"), 'access', _14 => _14.filter, 'call', _15 => _15(Boolean)]) || [];
1136
1068
  if (changes.length === 0) {
1137
1069
  return {
1138
1070
  canCommit: false,
@@ -1160,7 +1092,7 @@ function getAutoCommitInfo(cwd) {
1160
1092
  }
1161
1093
  }
1162
1094
  const diffStatResult = _child_process.spawnSync.call(void 0, "git", ["diff", "--stat", "HEAD"], { cwd, encoding: "utf8" });
1163
- const diffSummary = _optionalChain([diffStatResult, 'access', _26 => _26.stdout, 'optionalAccess', _27 => _27.trim, 'call', _28 => _28()]) || "";
1095
+ const diffSummary = _optionalChain([diffStatResult, 'access', _16 => _16.stdout, 'optionalAccess', _17 => _17.trim, 'call', _18 => _18()]) || "";
1164
1096
  const suggestedMessage = generateCommitMessage(added, modified, deleted, renamed);
1165
1097
  return {
1166
1098
  canCommit: true,
@@ -1215,7 +1147,7 @@ function generateCommitMessage(added, modified, deleted, renamed) {
1215
1147
  }
1216
1148
  function executeAutoCommit(cwd, message, stageAll = true) {
1217
1149
  const statusResult = _child_process.spawnSync.call(void 0, "git", ["status", "--porcelain"], { cwd, encoding: "utf8" });
1218
- const changes = _optionalChain([statusResult, 'access', _29 => _29.stdout, 'optionalAccess', _30 => _30.trim, 'call', _31 => _31(), 'access', _32 => _32.split, 'call', _33 => _33("\n"), 'access', _34 => _34.filter, 'call', _35 => _35(Boolean)]) || [];
1150
+ const changes = _optionalChain([statusResult, 'access', _19 => _19.stdout, 'optionalAccess', _20 => _20.trim, 'call', _21 => _21(), 'access', _22 => _22.split, 'call', _23 => _23("\n"), 'access', _24 => _24.filter, 'call', _25 => _25(Boolean)]) || [];
1219
1151
  if (stageAll) {
1220
1152
  const addResult = _child_process.spawnSync.call(void 0, "git", ["add", "-A"], { cwd, encoding: "utf8" });
1221
1153
  if (addResult.status !== 0) {
@@ -1235,7 +1167,7 @@ function executeAutoCommit(cwd, message, stageAll = true) {
1235
1167
  };
1236
1168
  }
1237
1169
  const hashResult = _child_process.spawnSync.call(void 0, "git", ["rev-parse", "--short", "HEAD"], { cwd, encoding: "utf8" });
1238
- const commitHash = _optionalChain([hashResult, 'access', _36 => _36.stdout, 'optionalAccess', _37 => _37.trim, 'call', _38 => _38()]);
1170
+ const commitHash = _optionalChain([hashResult, 'access', _26 => _26.stdout, 'optionalAccess', _27 => _27.trim, 'call', _28 => _28()]);
1239
1171
  return {
1240
1172
  success: true,
1241
1173
  message: `Committed ${changes.length} file(s): ${commitHash}`,
@@ -1363,6 +1295,9 @@ var DEFAULT_TEMPLATES = [
1363
1295
  }
1364
1296
  ];
1365
1297
  var WorktreeManager = class {
1298
+
1299
+
1300
+
1366
1301
  constructor(cwd) {
1367
1302
  this.repoRoot = this.findGitRoot(cwd);
1368
1303
  this.repoName = _path2.default.basename(this.repoRoot);
@@ -1446,7 +1381,7 @@ var WorktreeManager = class {
1446
1381
  if (result.status !== 0) {
1447
1382
  throw new Error(result.stderr || "Failed to create worktree");
1448
1383
  }
1449
- if (_optionalChain([template, 'optionalAccess', _39 => _39.setupCommands]) && options.runSetup !== false) {
1384
+ if (_optionalChain([template, 'optionalAccess', _29 => _29.setupCommands]) && options.runSetup !== false) {
1450
1385
  for (const cmd of template.setupCommands) {
1451
1386
  await this.runInWorktree(worktreePath, cmd);
1452
1387
  }
@@ -1460,7 +1395,7 @@ var WorktreeManager = class {
1460
1395
  const absolutePath = _path2.default.isAbsolute(worktreePath) ? worktreePath : _path2.default.resolve(this.repoRoot, worktreePath);
1461
1396
  const worktrees = this.list();
1462
1397
  const wt = worktrees.find((w) => w.path === absolutePath);
1463
- const branchToDelete = _optionalChain([wt, 'optionalAccess', _40 => _40.branch]);
1398
+ const branchToDelete = _optionalChain([wt, 'optionalAccess', _30 => _30.branch]);
1464
1399
  const args = ["worktree", "remove"];
1465
1400
  if (options.force) {
1466
1401
  args.push("--force");
@@ -1825,10 +1760,96 @@ var WorktreeManager = class {
1825
1760
  }
1826
1761
  };
1827
1762
 
1763
+ // src/actions/notebook.ts
1764
+ function createNotebookCell(cellType, source) {
1765
+ if (cellType === "code") {
1766
+ return {
1767
+ cell_type: "code",
1768
+ source,
1769
+ metadata: {},
1770
+ outputs: [],
1771
+ execution_count: null
1772
+ };
1773
+ }
1774
+ return {
1775
+ cell_type: "markdown",
1776
+ source,
1777
+ metadata: {}
1778
+ };
1779
+ }
1780
+ function resolveCellIndex(notebook, input) {
1781
+ if (typeof input.cell_index === "number") {
1782
+ return input.cell_index;
1783
+ }
1784
+ if (input.cell_id) {
1785
+ const index = notebook.cells.findIndex((cell) => cell.id === input.cell_id);
1786
+ if (index === -1) {
1787
+ throw new Error(`Notebook cell "${input.cell_id}" not found.`);
1788
+ }
1789
+ return index;
1790
+ }
1791
+ return -1;
1792
+ }
1793
+ function applyNotebookEdit(rawContent, input) {
1794
+ if (!input.path.endsWith(".ipynb")) {
1795
+ throw new Error("notebook_edit only supports .ipynb files.");
1796
+ }
1797
+ let notebook;
1798
+ try {
1799
+ notebook = JSON.parse(rawContent);
1800
+ } catch (e7) {
1801
+ throw new Error(`Notebook ${input.path} is not valid JSON.`);
1802
+ }
1803
+ if (!Array.isArray(notebook.cells)) {
1804
+ throw new Error(`Notebook ${input.path} does not contain a valid cells array.`);
1805
+ }
1806
+ const editMode = _nullishCoalesce(input.edit_mode, () => ( "replace"));
1807
+ const index = resolveCellIndex(notebook, input);
1808
+ if (editMode === "insert") {
1809
+ if (!input.cell_type) {
1810
+ throw new Error('notebook_edit insert requires "cell_type".');
1811
+ }
1812
+ if (typeof input.new_source !== "string") {
1813
+ throw new Error('notebook_edit insert requires "new_source".');
1814
+ }
1815
+ const insertAt = index >= 0 ? index + 1 : notebook.cells.length;
1816
+ notebook.cells.splice(insertAt, 0, createNotebookCell(input.cell_type, input.new_source));
1817
+ return {
1818
+ updated: `${JSON.stringify(notebook, null, 2)}
1819
+ `,
1820
+ summary: `Inserted notebook cell at index ${insertAt} in ${input.path}.`
1821
+ };
1822
+ }
1823
+ if (index < 0 || index >= notebook.cells.length) {
1824
+ throw new Error('notebook_edit requires a valid "cell_index" or "cell_id".');
1825
+ }
1826
+ if (editMode === "delete") {
1827
+ notebook.cells.splice(index, 1);
1828
+ return {
1829
+ updated: `${JSON.stringify(notebook, null, 2)}
1830
+ `,
1831
+ summary: `Deleted notebook cell ${index} in ${input.path}.`
1832
+ };
1833
+ }
1834
+ if (typeof input.new_source !== "string") {
1835
+ throw new Error('notebook_edit replace requires "new_source".');
1836
+ }
1837
+ const target = notebook.cells[index];
1838
+ target.source = input.new_source;
1839
+ if (input.cell_type) {
1840
+ target.cell_type = input.cell_type;
1841
+ }
1842
+ return {
1843
+ updated: `${JSON.stringify(notebook, null, 2)}
1844
+ `,
1845
+ summary: `Updated notebook cell ${index} in ${input.path}.`
1846
+ };
1847
+ }
1848
+
1828
1849
  // src/core/customCommands.ts
1829
1850
 
1830
1851
 
1831
- var COMMANDS_DIR = _chunkSEKD5FH3cjs.AUTOHAND_PATHS.commands;
1852
+ var COMMANDS_DIR = _chunkE26KKI46cjs.AUTOHAND_PATHS.commands;
1832
1853
  async function loadCustomCommand(name) {
1833
1854
  const filePath = _path2.default.join(COMMANDS_DIR, `${sanitizeName(name)}.json`);
1834
1855
  if (!await _fsextra2.default.pathExists(filePath)) {
@@ -1968,7 +1989,7 @@ async function fetchGitHubInfo(parsed) {
1968
1989
  stars: data.stargazers_count,
1969
1990
  language: data.language,
1970
1991
  defaultBranch: data.default_branch,
1971
- license: _optionalChain([data, 'access', _41 => _41.license, 'optionalAccess', _42 => _42.spdx_id]) || null
1992
+ license: _optionalChain([data, 'access', _31 => _31.license, 'optionalAccess', _32 => _32.spdx_id]) || null
1972
1993
  };
1973
1994
  }
1974
1995
  async function fetchGitLabInfo(parsed) {
@@ -2220,7 +2241,7 @@ async function runGh(args) {
2220
2241
  return;
2221
2242
  }
2222
2243
  const error = err;
2223
- if (error.code === "ENOENT" || _optionalChain([error, 'access', _43 => _43.message, 'optionalAccess', _44 => _44.includes, 'call', _45 => _45("command not found")])) {
2244
+ if (error.code === "ENOENT" || _optionalChain([error, 'access', _33 => _33.message, 'optionalAccess', _34 => _34.includes, 'call', _35 => _35("command not found")])) {
2224
2245
  reject(new Error("gh CLI is not installed. Install it from https://cli.github.com"));
2225
2246
  return;
2226
2247
  }
@@ -2308,14 +2329,139 @@ async function getUser() {
2308
2329
 
2309
2330
  // src/core/toolsRegistry.ts
2310
2331
 
2332
+ var _promises = require('fs/promises'); var _promises2 = _interopRequireDefault(_promises);
2333
+
2311
2334
 
2312
- var ToolsRegistry = class {
2313
- constructor(toolsDir = _chunkSEKD5FH3cjs.AUTOHAND_PATHS.tools) {
2314
- this.toolsDir = toolsDir;
2315
- this.metaToolCache = /* @__PURE__ */ new Map();
2335
+ // src/core/metaTools/schema.ts
2336
+
2337
+ var _zod = require('zod');
2338
+ var META_TOOL_SCHEMA_VERSION = 1;
2339
+ var META_TOOL_NAME_PATTERN = /^[a-z][a-z0-9_]*$/;
2340
+ var META_TOOL_SCOPES = ["user", "project"];
2341
+ var JsonSchemaObject = _zod.z.record(_zod.z.string(), _zod.z.unknown()).refine((value) => value.type === "object", 'parameters must be a JSON Schema object with type "object"');
2342
+ var MetaToolCreateInputSchema = _zod.z.object({
2343
+ name: _zod.z.string().trim().regex(META_TOOL_NAME_PATTERN, "name must be snake_case and start with a lowercase letter"),
2344
+ description: _zod.z.string().trim().min(1).max(300),
2345
+ parameters: JsonSchemaObject,
2346
+ handler: _zod.z.string().trim().min(1).max(2e3),
2347
+ source: _zod.z.enum(["agent", "user"]).default("agent"),
2348
+ scope: _zod.z.enum(META_TOOL_SCOPES).default("user")
2349
+ });
2350
+ var MetaToolDefinitionSchema = MetaToolCreateInputSchema.extend({
2351
+ schemaVersion: _zod.z.literal(META_TOOL_SCHEMA_VERSION),
2352
+ createdAt: _zod.z.string().min(1),
2353
+ updatedAt: _zod.z.string().min(1).optional(),
2354
+ fingerprint: _zod.z.string().min(16),
2355
+ disabled: _zod.z.boolean().optional()
2356
+ });
2357
+ function canonicalize(value) {
2358
+ if (Array.isArray(value)) {
2359
+ return `[${value.map(canonicalize).join(",")}]`;
2360
+ }
2361
+ if (value && typeof value === "object") {
2362
+ const record = value;
2363
+ return `{${Object.keys(record).sort().map((key) => `${JSON.stringify(key)}:${canonicalize(record[key])}`).join(",")}}`;
2364
+ }
2365
+ return JSON.stringify(value);
2366
+ }
2367
+ function fingerprintMetaTool(input) {
2368
+ return _crypto.createHash.call(void 0, "sha256").update(canonicalize({
2369
+ name: input.name,
2370
+ description: input.description,
2371
+ parameters: input.parameters,
2372
+ handler: input.handler
2373
+ })).digest("hex");
2374
+ }
2375
+ function normalizeMetaToolDefinition(candidate) {
2376
+ if (!candidate || typeof candidate !== "object") {
2377
+ return null;
2378
+ }
2379
+ const value = candidate;
2380
+ const source = value.source === "user" ? "user" : "agent";
2381
+ const scope = value.scope === "project" ? "project" : "user";
2382
+ const definition = {
2383
+ ...value,
2384
+ schemaVersion: _nullishCoalesce(value.schemaVersion, () => ( META_TOOL_SCHEMA_VERSION)),
2385
+ source,
2386
+ scope,
2387
+ createdAt: typeof value.createdAt === "string" ? value.createdAt : (/* @__PURE__ */ new Date(0)).toISOString()
2388
+ };
2389
+ const parsedCreateInput = MetaToolCreateInputSchema.safeParse(definition);
2390
+ if (!parsedCreateInput.success) {
2391
+ return null;
2392
+ }
2393
+ const parsed = MetaToolDefinitionSchema.safeParse({
2394
+ ...definition,
2395
+ fingerprint: typeof value.fingerprint === "string" ? value.fingerprint : fingerprintMetaTool(parsedCreateInput.data)
2396
+ });
2397
+ return parsed.success ? parsed.data : null;
2398
+ }
2399
+
2400
+ // src/core/metaTools/safety.ts
2401
+ var DANGEROUS_PATTERNS = [
2402
+ { pattern: /rm\s+(-[rf]+\s+)*\/(?!\w)/i, description: "rm with root path" },
2403
+ { pattern: /rm\s+.*--no-preserve-root/i, description: "rm --no-preserve-root" },
2404
+ { pattern: /dd\s+.*(?:of|if)=\/dev\/[sh]d/i, description: "dd to disk device" },
2405
+ { pattern: /mkfs\./i, description: "filesystem format" },
2406
+ { pattern: /wipefs/i, description: "disk wipe" },
2407
+ { pattern: /\bsudo\s/i, description: "sudo command" },
2408
+ { pattern: /\bsu\s+-?\s*\w/i, description: "su command" },
2409
+ { pattern: /chmod\s+[0-7]*7[0-7]*/i, description: "world-writable chmod" },
2410
+ { pattern: /chown\s+root/i, description: "chown to root" },
2411
+ { pattern: /curl\s+.*\|\s*(ba)?sh/i, description: "curl | bash" },
2412
+ { pattern: /wget\s+.*\|\s*(ba)?sh/i, description: "wget | sh" },
2413
+ { pattern: /\beval\s+[`$]/i, description: "eval with expansion" },
2414
+ { pattern: /:\(\)\s*\{\s*:\s*\|\s*:\s*&\s*\}\s*;/i, description: "fork bomb" },
2415
+ { pattern: /while\s+true.*do.*done/i, description: "infinite loop" },
2416
+ { pattern: /nc\s+.*-e\s*\/bin/i, description: "netcat reverse shell" },
2417
+ { pattern: /ncat\s+.*-e\s*\/bin/i, description: "ncat reverse shell" },
2418
+ { pattern: /bash\s+-i\s+>&?\s*\/dev\/tcp/i, description: "bash reverse shell" },
2419
+ { pattern: /iptables\s+-F/i, description: "flush firewall rules" },
2420
+ { pattern: /gpg\s+.*--encrypt.*-r\s+\S+\s+\//i, description: "gpg encrypt root" }
2421
+ ];
2422
+ function assertSafeMetaToolHandler(handler) {
2423
+ for (const { pattern, description } of DANGEROUS_PATTERNS) {
2424
+ if (pattern.test(handler)) {
2425
+ throw new Error(`Handler contains dangerous pattern: ${description}`);
2426
+ }
2427
+ }
2428
+ }
2429
+
2430
+ // src/core/toolsRegistry.ts
2431
+ function locationKey(scope, name) {
2432
+ return `${scope}:${name}`;
2433
+ }
2434
+ function normalizeLocations(input) {
2435
+ if (Array.isArray(input)) {
2436
+ return input;
2316
2437
  }
2438
+ return [{ scope: "user", dir: _nullishCoalesce(input, () => ( _chunkE26KKI46cjs.AUTOHAND_PATHS.tools)) }];
2439
+ }
2440
+ function delay(ms) {
2441
+ return new Promise((resolve) => setTimeout(resolve, ms));
2442
+ }
2443
+ function createToolsRegistry(workspaceRoot, userToolsDir = _chunkE26KKI46cjs.AUTOHAND_PATHS.tools) {
2444
+ const locations = workspaceRoot ? [
2445
+ { scope: "project", dir: _path2.default.join(workspaceRoot, _chunkE26KKI46cjs.PROJECT_DIR_NAME, "tools") },
2446
+ { scope: "user", dir: userToolsDir }
2447
+ ] : [{ scope: "user", dir: userToolsDir }];
2448
+ return new ToolsRegistry(locations);
2449
+ }
2450
+ var ToolsRegistry = (_class = class {
2451
+ __init() {this.metaToolCache = /* @__PURE__ */ new Map()}
2452
+ __init2() {this.metaToolRecords = /* @__PURE__ */ new Map()}
2453
+ __init3() {this.diagnostics = []}
2454
+ constructor(locations) {;_class.prototype.__init.call(this);_class.prototype.__init2.call(this);_class.prototype.__init3.call(this);
2455
+ this.locations = normalizeLocations(locations);
2456
+ }
2457
+
2317
2458
  async initialize() {
2318
- await _fsextra2.default.ensureDir(this.toolsDir);
2459
+ this.metaToolCache.clear();
2460
+ this.metaToolRecords.clear();
2461
+ this.diagnostics = [];
2462
+ for (const location of this.locations) {
2463
+ await _fsextra2.default.ensureDir(location.dir);
2464
+ }
2319
2465
  await this.loadMetaToolDefinitions();
2320
2466
  }
2321
2467
  async listTools(builtIns) {
@@ -2341,20 +2487,41 @@ var ToolsRegistry = class {
2341
2487
  entries.push({
2342
2488
  name: tool.name,
2343
2489
  description: tool.description,
2344
- source: "meta"
2490
+ source: "meta",
2491
+ scope: tool.scope,
2492
+ disabled: tool.disabled,
2493
+ createdAt: tool.createdAt,
2494
+ schemaVersion: tool.schemaVersion,
2495
+ handlerPreview: tool.handler.length > 140 ? `${tool.handler.slice(0, 137)}...` : tool.handler,
2496
+ reuseHint: `Use ${tool.name} instead of creating another tool for: ${tool.description}`
2345
2497
  });
2346
2498
  seen.add(name);
2347
2499
  }
2348
2500
  return entries;
2349
2501
  }
2350
2502
  async saveMetaTool(definition) {
2351
- const fullDef = {
2352
- ...definition,
2353
- createdAt: (/* @__PURE__ */ new Date()).toISOString()
2354
- };
2355
- const filePath = _path2.default.join(this.toolsDir, `${definition.name}.json`);
2356
- await _fsextra2.default.writeJson(filePath, fullDef, { spaces: 2 });
2357
- this.metaToolCache.set(definition.name, fullDef);
2503
+ const fullDef = normalizeMetaToolDefinition(definition);
2504
+ if (!fullDef) {
2505
+ throw new Error(`Invalid meta-tool definition for "${definition.name}"`);
2506
+ }
2507
+ assertSafeMetaToolHandler(fullDef.handler);
2508
+ const location = this.getLocationForScope(fullDef.scope);
2509
+ const filePath = _path2.default.join(location.dir, `${fullDef.name}.json`);
2510
+ const release = await this.acquireLock(location.dir, fullDef.name);
2511
+ try {
2512
+ const existing = await this.readDefinition(filePath);
2513
+ if (existing) {
2514
+ if (existing.fingerprint === fullDef.fingerprint) {
2515
+ this.upsertRecord(existing, filePath);
2516
+ return existing;
2517
+ }
2518
+ throw new Error(`Meta-tool "${fullDef.name}" already exists in ${fullDef.scope} scope`);
2519
+ }
2520
+ await this.writeDefinition(filePath, fullDef);
2521
+ } finally {
2522
+ await release();
2523
+ }
2524
+ this.upsertRecord(fullDef, filePath);
2358
2525
  return fullDef;
2359
2526
  }
2360
2527
  getMetaTool(name) {
@@ -2366,6 +2533,71 @@ var ToolsRegistry = class {
2366
2533
  getAllMetaTools() {
2367
2534
  return Array.from(this.metaToolCache.values());
2368
2535
  }
2536
+ listMetaTools(options = {}) {
2537
+ if (!options.includeDisabled) {
2538
+ return this.getAllMetaTools();
2539
+ }
2540
+ return Array.from(this.metaToolRecords.values()).map((record) => record.definition);
2541
+ }
2542
+ getDiagnostics() {
2543
+ return [...this.diagnostics];
2544
+ }
2545
+ async deleteMetaTool(name, scope) {
2546
+ const record = this.findRecord(name, scope);
2547
+ if (!record) {
2548
+ throw new Error(`Meta-tool "${name}" not found`);
2549
+ }
2550
+ await _fsextra2.default.remove(record.filePath);
2551
+ this.deleteRecord(record.definition);
2552
+ return record.definition;
2553
+ }
2554
+ async setMetaToolDisabled(name, disabled, scope) {
2555
+ const record = this.findRecord(name, scope);
2556
+ if (!record) {
2557
+ throw new Error(`Meta-tool "${name}" not found`);
2558
+ }
2559
+ const updated = {
2560
+ ...record.definition,
2561
+ disabled,
2562
+ updatedAt: (/* @__PURE__ */ new Date()).toISOString()
2563
+ };
2564
+ await this.writeDefinition(record.filePath, updated);
2565
+ this.upsertRecord(updated, record.filePath);
2566
+ this.rebuildActiveCache();
2567
+ return updated;
2568
+ }
2569
+ async renameMetaTool(name, newName, scope) {
2570
+ if (!META_TOOL_NAME_PATTERN.test(newName)) {
2571
+ throw new Error("new name must be snake_case and start with a lowercase letter");
2572
+ }
2573
+ const record = this.findRecord(name, scope);
2574
+ if (!record) {
2575
+ throw new Error(`Meta-tool "${name}" not found`);
2576
+ }
2577
+ if (this.findRecord(newName)) {
2578
+ throw new Error(`Meta-tool "${newName}" already exists`);
2579
+ }
2580
+ const renamed = {
2581
+ ...record.definition,
2582
+ name: newName,
2583
+ updatedAt: (/* @__PURE__ */ new Date()).toISOString()
2584
+ };
2585
+ const normalized = normalizeMetaToolDefinition({
2586
+ ...renamed,
2587
+ fingerprint: fingerprintMetaTool(renamed)
2588
+ });
2589
+ if (!normalized) {
2590
+ throw new Error(`Invalid meta-tool definition for "${newName}"`);
2591
+ }
2592
+ const location = this.getLocationForScope(normalized.scope);
2593
+ const nextFilePath = _path2.default.join(location.dir, `${newName}.json`);
2594
+ await this.writeDefinition(nextFilePath, normalized);
2595
+ await _fsextra2.default.remove(record.filePath);
2596
+ this.deleteRecord(record.definition);
2597
+ this.upsertRecord(normalized, nextFilePath);
2598
+ this.rebuildActiveCache();
2599
+ return normalized;
2600
+ }
2369
2601
  toToolDefinitions() {
2370
2602
  return this.getAllMetaTools().map((tool) => {
2371
2603
  const params = tool.parameters;
@@ -2381,163 +2613,375 @@ var ToolsRegistry = class {
2381
2613
  });
2382
2614
  }
2383
2615
  async loadMetaToolDefinitions() {
2384
- try {
2385
- const exists = await _fsextra2.default.pathExists(this.toolsDir);
2386
- if (!exists) {
2387
- return;
2388
- }
2389
- const files = await _fsextra2.default.readdir(this.toolsDir);
2390
- for (const file of files) {
2391
- if (!file.endsWith(".json")) {
2616
+ for (const location of this.locations) {
2617
+ try {
2618
+ const exists = await _fsextra2.default.pathExists(location.dir);
2619
+ if (!exists) {
2392
2620
  continue;
2393
2621
  }
2394
- const fullPath = _path2.default.join(this.toolsDir, file);
2395
- try {
2396
- const data = await _fsextra2.default.readJson(fullPath);
2397
- if (this.isValidMetaTool(data)) {
2398
- this.metaToolCache.set(data.name, data);
2622
+ const files = await _fsextra2.default.readdir(location.dir);
2623
+ for (const file of files) {
2624
+ if (!file.endsWith(".json")) {
2625
+ continue;
2626
+ }
2627
+ const fullPath = _path2.default.join(location.dir, file);
2628
+ try {
2629
+ const data = normalizeMetaToolDefinition({
2630
+ ...await _fsextra2.default.readJson(fullPath),
2631
+ scope: location.scope
2632
+ });
2633
+ if (data) {
2634
+ assertSafeMetaToolHandler(data.handler);
2635
+ this.metaToolRecords.set(locationKey(data.scope, data.name), { definition: data, filePath: fullPath });
2636
+ } else {
2637
+ this.diagnostics.push({ file: fullPath, reason: "invalid meta-tool definition" });
2638
+ }
2639
+ } catch (error) {
2640
+ const reason = error instanceof Error ? error.message : "invalid meta-tool file";
2641
+ this.diagnostics.push({ file: fullPath, reason });
2399
2642
  }
2400
- } catch (e7) {
2401
2643
  }
2644
+ } catch (error) {
2645
+ const reason = error instanceof Error ? error.message : "tools directory could not be read";
2646
+ this.diagnostics.push({ file: location.dir, reason });
2402
2647
  }
2403
- } catch (e8) {
2404
2648
  }
2649
+ this.rebuildActiveCache();
2405
2650
  }
2406
- isValidMetaTool(candidate) {
2407
- if (!candidate || typeof candidate !== "object") {
2408
- return false;
2651
+ getLocationForScope(scope) {
2652
+ const location = this.locations.find((candidate) => candidate.scope === scope);
2653
+ if (!location) {
2654
+ throw new Error(`No tools directory configured for ${scope} scope`);
2409
2655
  }
2410
- const value = candidate;
2411
- return typeof value.name === "string" && typeof value.description === "string" && typeof value.handler === "string" && typeof value.parameters === "object";
2656
+ return location;
2412
2657
  }
2413
- };
2658
+ async readDefinition(filePath) {
2659
+ if (!await _fsextra2.default.pathExists(filePath)) {
2660
+ return null;
2661
+ }
2662
+ return normalizeMetaToolDefinition(await _fsextra2.default.readJson(filePath));
2663
+ }
2664
+ async writeDefinition(filePath, definition) {
2665
+ const tempPath = `${filePath}.${process.pid}.${Date.now()}.tmp`;
2666
+ try {
2667
+ await _fsextra2.default.ensureDir(_path2.default.dirname(filePath));
2668
+ await _fsextra2.default.outputFile(tempPath, `${JSON.stringify(definition, null, 2)}
2669
+ `, { mode: 384 });
2670
+ const handle = await _promises2.default.open(tempPath, "r");
2671
+ try {
2672
+ await handle.sync();
2673
+ } finally {
2674
+ await handle.close();
2675
+ }
2676
+ await _promises2.default.rename(tempPath, filePath);
2677
+ } catch (error) {
2678
+ await _fsextra2.default.remove(tempPath).catch(() => {
2679
+ });
2680
+ throw error;
2681
+ }
2682
+ }
2683
+ async acquireLock(dir, name) {
2684
+ await _fsextra2.default.ensureDir(dir);
2685
+ const lockPath = _path2.default.join(dir, `${name}.lock`);
2686
+ for (let attempt = 0; attempt < 40; attempt++) {
2687
+ try {
2688
+ const handle = await _promises2.default.open(lockPath, "wx", 384);
2689
+ await handle.close();
2690
+ return async () => {
2691
+ await _fsextra2.default.remove(lockPath).catch(() => {
2692
+ });
2693
+ };
2694
+ } catch (error) {
2695
+ const code = typeof error === "object" && error && "code" in error ? error.code : void 0;
2696
+ if (code === "EEXIST") {
2697
+ await delay(25);
2698
+ continue;
2699
+ }
2700
+ throw error;
2701
+ }
2702
+ }
2703
+ throw new Error(`Timed out waiting for meta-tool lock "${name}"`);
2704
+ }
2705
+ upsertRecord(definition, filePath) {
2706
+ this.metaToolRecords.set(locationKey(definition.scope, definition.name), { definition, filePath });
2707
+ this.rebuildActiveCache();
2708
+ }
2709
+ deleteRecord(definition) {
2710
+ this.metaToolRecords.delete(locationKey(definition.scope, definition.name));
2711
+ this.rebuildActiveCache();
2712
+ }
2713
+ findRecord(name, scope) {
2714
+ if (scope) {
2715
+ return this.metaToolRecords.get(locationKey(scope, name));
2716
+ }
2717
+ for (const location of this.locations) {
2718
+ const record = this.metaToolRecords.get(locationKey(location.scope, name));
2719
+ if (record) {
2720
+ return record;
2721
+ }
2722
+ }
2723
+ return void 0;
2724
+ }
2725
+ rebuildActiveCache() {
2726
+ this.metaToolCache.clear();
2727
+ for (const location of this.locations) {
2728
+ for (const record of this.metaToolRecords.values()) {
2729
+ if (record.definition.scope !== location.scope || record.definition.disabled) {
2730
+ continue;
2731
+ }
2732
+ if (!this.metaToolCache.has(record.definition.name)) {
2733
+ this.metaToolCache.set(record.definition.name, record.definition);
2734
+ }
2735
+ }
2736
+ }
2737
+ }
2738
+ }, _class);
2414
2739
 
2415
- // src/core/SecurityScanner.ts
2416
- var SecurityScanner = class {
2417
- constructor() {
2418
- /**
2419
- * Built-in secret detection patterns
2420
- */
2421
- this.patterns = [
2422
- // AWS
2423
- {
2424
- name: "AWS Access Key",
2425
- regex: /AKIA[0-9A-Z]{16}/,
2426
- severity: "high",
2427
- description: "AWS Access Key ID"
2428
- },
2429
- // GitHub
2430
- {
2431
- name: "GitHub Token",
2432
- regex: /ghp_[a-zA-Z0-9]{36}/,
2433
- severity: "high",
2434
- description: "GitHub Personal Access Token"
2435
- },
2436
- {
2437
- name: "GitHub OAuth",
2438
- regex: /gho_[a-zA-Z0-9]{36}/,
2439
- severity: "high",
2440
- description: "GitHub OAuth Token"
2441
- },
2442
- {
2443
- name: "GitHub App Token",
2444
- regex: /ghu_[a-zA-Z0-9]{36}/,
2445
- severity: "high",
2446
- description: "GitHub App User Token"
2447
- },
2448
- // OpenAI / Anthropic
2449
- {
2450
- name: "OpenAI Key",
2451
- regex: /sk-proj-[a-zA-Z0-9]{32,}/,
2452
- severity: "high",
2453
- description: "OpenAI Project API Key"
2454
- },
2455
- {
2456
- name: "Anthropic Key",
2457
- regex: /sk-ant-api[a-zA-Z0-9-]{32,}/,
2458
- severity: "high",
2459
- description: "Anthropic API Key"
2460
- },
2461
- // Google
2462
- {
2463
- name: "Google API Key",
2464
- regex: /AIzaSy[0-9A-Za-z-_]{33}/,
2465
- severity: "high",
2466
- description: "Google API Key"
2467
- },
2468
- // Stripe
2469
- {
2470
- name: "Stripe Live Key",
2471
- regex: /sk_live_[0-9a-zA-Z]{24,}/,
2472
- severity: "high",
2473
- description: "Stripe Live Secret Key"
2474
- },
2475
- {
2476
- name: "Stripe Test Key",
2477
- regex: /sk_test_[0-9a-zA-Z]{24,}/,
2478
- severity: "low",
2479
- description: "Stripe Test Secret Key"
2480
- },
2481
- // Private Keys
2482
- {
2483
- name: "Private Key",
2484
- regex: /-----BEGIN (RSA |EC |DSA |OPENSSH )?PRIVATE KEY-----/,
2485
- severity: "high",
2486
- description: "Private Key File"
2487
- },
2488
- // Database URLs with credentials
2489
- {
2490
- name: "Database URL",
2491
- regex: /(postgres|postgresql|mysql|mongodb|redis):\/\/[^:]+:[^@]+@/,
2492
- severity: "high",
2493
- description: "Database URL with credentials"
2494
- },
2495
- // JWT Tokens
2496
- {
2497
- name: "JWT Token",
2498
- regex: /eyJ[a-zA-Z0-9]{10,}\.eyJ[a-zA-Z0-9]{10,}\.[a-zA-Z0-9_-]{10,}/,
2499
- severity: "medium",
2500
- description: "JSON Web Token"
2501
- },
2502
- // Generic patterns (lower priority)
2503
- {
2504
- name: "Generic API Key",
2505
- regex: /[aA][pP][iI][-_]?[kK][eE][yY]\s*[:=]\s*['"][a-zA-Z0-9]{16,}['"]/,
2506
- severity: "medium",
2507
- description: "Generic API Key Assignment"
2508
- },
2509
- {
2510
- name: "Generic Secret",
2511
- regex: /[sS][eE][cC][rR][eE][tT]\s*[:=]\s*['"][^'"]{8,}['"]/,
2512
- severity: "medium",
2513
- description: "Generic Secret Assignment"
2514
- },
2515
- {
2516
- name: "Password Assignment",
2517
- regex: /[pP][aA][sS][sS][wW][oO][rR][dD]\s*[:=]\s*['"][^'"]{4,}['"]/,
2518
- severity: "medium",
2519
- description: "Password Assignment"
2740
+ // src/core/metaTools/MetaToolService.ts
2741
+ var STOP_WORDS = /* @__PURE__ */ new Set([
2742
+ "a",
2743
+ "an",
2744
+ "and",
2745
+ "by",
2746
+ "for",
2747
+ "from",
2748
+ "in",
2749
+ "of",
2750
+ "on",
2751
+ "the",
2752
+ "to",
2753
+ "with",
2754
+ "find",
2755
+ "search",
2756
+ "list",
2757
+ "get",
2758
+ "show",
2759
+ "analyze",
2760
+ "count",
2761
+ "run",
2762
+ "quick",
2763
+ "tool",
2764
+ "tools",
2765
+ "file",
2766
+ "files",
2767
+ "codebase",
2768
+ "workspace",
2769
+ "source",
2770
+ "across"
2771
+ ]);
2772
+ function normalizeHandler(handler) {
2773
+ return handler.trim().replace(/\s+/g, " ");
2774
+ }
2775
+ function tokenize2(value) {
2776
+ const tokens = value.toLowerCase().split(/[^a-z0-9]+/).map((token) => token.endsWith("s") ? token.slice(0, -1) : token).filter((token) => token.length > 1 && !STOP_WORDS.has(token));
2777
+ return new Set(tokens);
2778
+ }
2779
+ function overlapRatio(left, right) {
2780
+ if (left.size === 0 || right.size === 0) {
2781
+ return 0;
2782
+ }
2783
+ let intersection = 0;
2784
+ for (const token of left) {
2785
+ if (right.has(token)) {
2786
+ intersection++;
2787
+ }
2788
+ }
2789
+ return intersection / Math.min(left.size, right.size);
2790
+ }
2791
+ function isSimilarTool(candidate, existing) {
2792
+ const candidateNameTokens = tokenize2(candidate.name);
2793
+ const existingNameTokens = tokenize2(existing.name);
2794
+ if (overlapRatio(candidateNameTokens, existingNameTokens) >= 0.75) {
2795
+ return true;
2796
+ }
2797
+ const candidateDescriptionTokens = tokenize2(candidate.description);
2798
+ const existingDescriptionTokens = tokenize2(_nullishCoalesce(existing.description, () => ( "")));
2799
+ return overlapRatio(candidateDescriptionTokens, existingDescriptionTokens) >= 0.75;
2800
+ }
2801
+ var MetaToolService = class {
2802
+ constructor(registry) {
2803
+ this.registry = registry;
2804
+ }
2805
+
2806
+ async createMetaTool(input, registeredTools) {
2807
+ const parsed = MetaToolCreateInputSchema.safeParse(input);
2808
+ if (!parsed.success) {
2809
+ throw new Error(`Invalid meta-tool definition: ${_nullishCoalesce(_optionalChain([parsed, 'access', _36 => _36.error, 'access', _37 => _37.issues, 'access', _38 => _38[0], 'optionalAccess', _39 => _39.message]), () => ( "unknown validation error"))}`);
2810
+ }
2811
+ const definitionInput = parsed.data;
2812
+ assertSafeMetaToolHandler(definitionInput.handler);
2813
+ const fingerprint = fingerprintMetaTool(definitionInput);
2814
+ const existingByName = this.registry.getMetaTool(definitionInput.name);
2815
+ if (existingByName) {
2816
+ if (existingByName.fingerprint === fingerprint) {
2817
+ return {
2818
+ status: "existing",
2819
+ definition: existingByName,
2820
+ message: `Meta-tool "${definitionInput.name}" already exists with the same definition.`
2821
+ };
2520
2822
  }
2823
+ throw new Error(`Cannot create meta-tool "${definitionInput.name}": already exists with a different definition`);
2824
+ }
2825
+ const registeredNameConflict = registeredTools.find((tool) => tool.name === definitionInput.name);
2826
+ if (registeredNameConflict) {
2827
+ throw new Error(`Cannot create meta-tool "${definitionInput.name}": conflicts with existing tool`);
2828
+ }
2829
+ for (const existing of this.registry.getAllMetaTools()) {
2830
+ if (normalizeHandler(existing.handler) === normalizeHandler(definitionInput.handler)) {
2831
+ throw new Error(`Cannot create meta-tool "${definitionInput.name}": same handler already exists as "${existing.name}"`);
2832
+ }
2833
+ }
2834
+ const existingTools = [
2835
+ ...registeredTools,
2836
+ ...this.registry.getAllMetaTools().map((tool) => ({
2837
+ name: tool.name,
2838
+ description: tool.description
2839
+ }))
2521
2840
  ];
2522
- /**
2523
- * Placeholder patterns to ignore (false positives)
2524
- * These must be exact matches or specific patterns, not substrings
2525
- */
2526
- this.placeholderPatterns = [
2527
- /your[-_]?api[-_]?key/i,
2528
- /your[-_]?secret/i,
2529
- /\*\*\*/,
2530
- /\.\.\.$/,
2531
- /-example/i,
2532
- /placeholder/i,
2533
- /sk-xxx$/i,
2534
- /sk-your/i,
2535
- /<your[-_]?key[-_]?here>/i,
2536
- /\$\{[A-Z_]+\}/,
2537
- // Environment variable placeholders
2538
- /process\.env\./
2539
- ];
2841
+ const similar = existingTools.find((tool) => tool.name !== definitionInput.name && isSimilarTool(definitionInput, tool));
2842
+ if (similar) {
2843
+ throw new Error(`Cannot create meta-tool "${definitionInput.name}": similar existing tool "${similar.name}" should be reused`);
2844
+ }
2845
+ const now = (/* @__PURE__ */ new Date()).toISOString();
2846
+ const saved = await this.registry.saveMetaTool({
2847
+ ...definitionInput,
2848
+ schemaVersion: 1,
2849
+ createdAt: now,
2850
+ updatedAt: now,
2851
+ fingerprint
2852
+ });
2853
+ return {
2854
+ status: "created",
2855
+ definition: saved,
2856
+ message: `Created meta-tool "${saved.name}" - available in this and future sessions`
2857
+ };
2540
2858
  }
2859
+ };
2860
+
2861
+ // src/core/SecurityScanner.ts
2862
+ var SecurityScanner = (_class2 = class {constructor() { _class2.prototype.__init4.call(this);_class2.prototype.__init5.call(this); }
2863
+ /**
2864
+ * Built-in secret detection patterns
2865
+ */
2866
+ __init4() {this.patterns = [
2867
+ // AWS
2868
+ {
2869
+ name: "AWS Access Key",
2870
+ regex: /AKIA[0-9A-Z]{16}/,
2871
+ severity: "high",
2872
+ description: "AWS Access Key ID"
2873
+ },
2874
+ // GitHub
2875
+ {
2876
+ name: "GitHub Token",
2877
+ regex: /ghp_[a-zA-Z0-9]{36}/,
2878
+ severity: "high",
2879
+ description: "GitHub Personal Access Token"
2880
+ },
2881
+ {
2882
+ name: "GitHub OAuth",
2883
+ regex: /gho_[a-zA-Z0-9]{36}/,
2884
+ severity: "high",
2885
+ description: "GitHub OAuth Token"
2886
+ },
2887
+ {
2888
+ name: "GitHub App Token",
2889
+ regex: /ghu_[a-zA-Z0-9]{36}/,
2890
+ severity: "high",
2891
+ description: "GitHub App User Token"
2892
+ },
2893
+ // OpenAI / Anthropic
2894
+ {
2895
+ name: "OpenAI Key",
2896
+ regex: /sk-proj-[a-zA-Z0-9]{32,}/,
2897
+ severity: "high",
2898
+ description: "OpenAI Project API Key"
2899
+ },
2900
+ {
2901
+ name: "Anthropic Key",
2902
+ regex: /sk-ant-api[a-zA-Z0-9-]{32,}/,
2903
+ severity: "high",
2904
+ description: "Anthropic API Key"
2905
+ },
2906
+ // Google
2907
+ {
2908
+ name: "Google API Key",
2909
+ regex: /AIzaSy[0-9A-Za-z-_]{33}/,
2910
+ severity: "high",
2911
+ description: "Google API Key"
2912
+ },
2913
+ // Stripe
2914
+ {
2915
+ name: "Stripe Live Key",
2916
+ regex: /sk_live_[0-9a-zA-Z]{24,}/,
2917
+ severity: "high",
2918
+ description: "Stripe Live Secret Key"
2919
+ },
2920
+ {
2921
+ name: "Stripe Test Key",
2922
+ regex: /sk_test_[0-9a-zA-Z]{24,}/,
2923
+ severity: "low",
2924
+ description: "Stripe Test Secret Key"
2925
+ },
2926
+ // Private Keys
2927
+ {
2928
+ name: "Private Key",
2929
+ regex: /-----BEGIN (RSA |EC |DSA |OPENSSH )?PRIVATE KEY-----/,
2930
+ severity: "high",
2931
+ description: "Private Key File"
2932
+ },
2933
+ // Database URLs with credentials
2934
+ {
2935
+ name: "Database URL",
2936
+ regex: /(postgres|postgresql|mysql|mongodb|redis):\/\/[^:]+:[^@]+@/,
2937
+ severity: "high",
2938
+ description: "Database URL with credentials"
2939
+ },
2940
+ // JWT Tokens
2941
+ {
2942
+ name: "JWT Token",
2943
+ regex: /eyJ[a-zA-Z0-9]{10,}\.eyJ[a-zA-Z0-9]{10,}\.[a-zA-Z0-9_-]{10,}/,
2944
+ severity: "medium",
2945
+ description: "JSON Web Token"
2946
+ },
2947
+ // Generic patterns (lower priority)
2948
+ {
2949
+ name: "Generic API Key",
2950
+ regex: /[aA][pP][iI][-_]?[kK][eE][yY]\s*[:=]\s*['"][a-zA-Z0-9]{16,}['"]/,
2951
+ severity: "medium",
2952
+ description: "Generic API Key Assignment"
2953
+ },
2954
+ {
2955
+ name: "Generic Secret",
2956
+ regex: /[sS][eE][cC][rR][eE][tT]\s*[:=]\s*['"][^'"]{8,}['"]/,
2957
+ severity: "medium",
2958
+ description: "Generic Secret Assignment"
2959
+ },
2960
+ {
2961
+ name: "Password Assignment",
2962
+ regex: /[pP][aA][sS][sS][wW][oO][rR][dD]\s*[:=]\s*['"][^'"]{4,}['"]/,
2963
+ severity: "medium",
2964
+ description: "Password Assignment"
2965
+ }
2966
+ ]}
2967
+ /**
2968
+ * Placeholder patterns to ignore (false positives)
2969
+ * These must be exact matches or specific patterns, not substrings
2970
+ */
2971
+ __init5() {this.placeholderPatterns = [
2972
+ /your[-_]?api[-_]?key/i,
2973
+ /your[-_]?secret/i,
2974
+ /\*\*\*/,
2975
+ /\.\.\.$/,
2976
+ /-example/i,
2977
+ /placeholder/i,
2978
+ /sk-xxx$/i,
2979
+ /sk-your/i,
2980
+ /<your[-_]?key[-_]?here>/i,
2981
+ /\$\{[A-Z_]+\}/,
2982
+ // Environment variable placeholders
2983
+ /process\.env\./
2984
+ ]}
2541
2985
  /**
2542
2986
  * Scan git diff for secrets
2543
2987
  * @param diff - Git diff output
@@ -2697,7 +3141,9 @@ var SecurityScanner = class {
2697
3141
  lines.push("");
2698
3142
  }
2699
3143
  if (result.blockedCount > 0) {
2700
- lines.push(`[BLOCKED] ${result.blockedCount} high-severity secrets found`);
3144
+ lines.push(
3145
+ `[BLOCKED] ${result.blockedCount} high-severity secrets found`
3146
+ );
2701
3147
  lines.push(" Remove secrets before committing.");
2702
3148
  lines.push(" Consider using environment variables instead.");
2703
3149
  } else if (result.warningCount > 0) {
@@ -2716,7 +3162,7 @@ var SecurityScanner = class {
2716
3162
  const redacted = secret.slice(0, 4) + "*".repeat(secret.length - 8) + secret.slice(-4);
2717
3163
  return line.replace(secret, redacted);
2718
3164
  }
2719
- };
3165
+ }, _class2);
2720
3166
 
2721
3167
  // src/core/actionExecutor.ts
2722
3168
 
@@ -2725,8 +3171,9 @@ var SecurityScanner = class {
2725
3171
 
2726
3172
 
2727
3173
  var PlanFileStorage = class {
3174
+
2728
3175
  constructor() {
2729
- this.plansDir = _chunkSEKD5FH3cjs.AUTOHAND_PATHS.plans;
3176
+ this.plansDir = _chunkE26KKI46cjs.AUTOHAND_PATHS.plans;
2730
3177
  }
2731
3178
  /**
2732
3179
  * Get the plans directory path
@@ -2859,10 +3306,9 @@ var PlanFileStorage = class {
2859
3306
 
2860
3307
  // src/core/actionExecutor.ts
2861
3308
 
2862
- var ActionExecutor = class _ActionExecutor {
2863
- constructor(deps) {
3309
+ var ActionExecutor = (_class3 = class _ActionExecutor {
3310
+ constructor(deps) {;_class3.prototype.__init6.call(this);_class3.prototype.__init7.call(this);_class3.prototype.__init8.call(this);_class3.prototype.__init9.call(this);
2864
3311
  this.deps = deps;
2865
- this.searchCache = /* @__PURE__ */ new Map();
2866
3312
  this.runtime = deps.runtime;
2867
3313
  this.files = deps.files;
2868
3314
  this.resolveWorkspacePath = deps.resolveWorkspacePath;
@@ -2870,17 +3316,91 @@ var ActionExecutor = class _ActionExecutor {
2870
3316
  this.projectManager = deps.projectManager;
2871
3317
  this.sessionId = deps.sessionId;
2872
3318
  this.logExploration = deps.onExploration;
2873
- this.toolsRegistry = _nullishCoalesce(deps.toolsRegistry, () => ( new ToolsRegistry()));
3319
+ this.toolsRegistry = _nullishCoalesce(deps.toolsRegistry, () => ( createToolsRegistry(deps.runtime.workspaceRoot)));
3320
+ this.metaToolService = _nullishCoalesce(deps.metaToolService, () => ( new MetaToolService(this.toolsRegistry)));
2874
3321
  this.getRegisteredTools = _nullishCoalesce(deps.getRegisteredTools, () => ( (() => [])));
2875
- this.permissionManager = _nullishCoalesce(deps.permissionManager, () => ( new (0, _chunkMERYP6AMcjs.PermissionManager)(deps.runtime.config.permissions)));
3322
+ this.permissionManager = _nullishCoalesce(deps.permissionManager, () => ( new (0, _chunkDEQVRSV5cjs.PermissionManager)(deps.runtime.config.permissions)));
2876
3323
  this.memoryManager = deps.memoryManager;
2877
3324
  this.onToolOutput = deps.onToolOutput;
2878
3325
  this.onFileModified = deps.onFileModified;
2879
3326
  this.onAskFollowup = deps.onAskFollowup;
2880
3327
  this.onPlanCreated = deps.onPlanCreated;
2881
3328
  this.onPermissionRequest = deps.onPermissionRequest;
3329
+ this.onReviewHook = deps.onReviewHook;
3330
+ this.onModalPause = deps.onModalPause;
3331
+ this.onRequestDirectoryAccess = deps.onRequestDirectoryAccess;
3332
+ this.onLiveCommandStart = deps.onLiveCommandStart;
3333
+ this.onLiveCommandOutput = deps.onLiveCommandOutput;
3334
+ this.onLiveCommandRemove = deps.onLiveCommandRemove;
3335
+ this.onMetaToolCreated = deps.onMetaToolCreated;
2882
3336
  this.securityScanner = new SecurityScanner();
2883
3337
  }
3338
+
3339
+
3340
+
3341
+
3342
+
3343
+
3344
+
3345
+
3346
+
3347
+
3348
+
3349
+
3350
+
3351
+
3352
+
3353
+
3354
+
3355
+
3356
+
3357
+
3358
+
3359
+
3360
+
3361
+
3362
+
3363
+
3364
+ __init6() {this.searchCache = /* @__PURE__ */ new Map()}
3365
+ __init7() {this.fffSearchProviderPromise = null}
3366
+ __init8() {this.fffSearchWorkspaceRoot = null}
3367
+ __init9() {this.fffSearchIdleTimer = null}
3368
+ static __initStatic() {this.FFF_SEARCH_IDLE_TTL_MS = 6e4}
3369
+ async getFFFSearchProvider() {
3370
+ if (this.fffSearchIdleTimer) {
3371
+ clearTimeout(this.fffSearchIdleTimer);
3372
+ this.fffSearchIdleTimer = null;
3373
+ }
3374
+ const workspaceRoot = this.runtime.workspaceRoot;
3375
+ if (this.fffSearchProviderPromise && this.fffSearchWorkspaceRoot === workspaceRoot) {
3376
+ return this.fffSearchProviderPromise;
3377
+ }
3378
+ if (this.fffSearchProviderPromise) {
3379
+ this.fffSearchProviderPromise.then((provider) => provider.destroy()).catch(() => {
3380
+ });
3381
+ }
3382
+ const { FFFSearchProvider } = await Promise.resolve().then(() => _interopRequireWildcard(require("./fffSearchProvider-W6627E2V.cjs")));
3383
+ this.fffSearchWorkspaceRoot = workspaceRoot;
3384
+ this.fffSearchProviderPromise = FFFSearchProvider.create(workspaceRoot);
3385
+ return this.fffSearchProviderPromise;
3386
+ }
3387
+ scheduleFFFSearchProviderCleanup() {
3388
+ if (!this.fffSearchProviderPromise) {
3389
+ return;
3390
+ }
3391
+ if (this.fffSearchIdleTimer) {
3392
+ clearTimeout(this.fffSearchIdleTimer);
3393
+ }
3394
+ this.fffSearchIdleTimer = setTimeout(() => {
3395
+ const providerPromise = this.fffSearchProviderPromise;
3396
+ this.fffSearchProviderPromise = null;
3397
+ this.fffSearchWorkspaceRoot = null;
3398
+ this.fffSearchIdleTimer = null;
3399
+ _optionalChain([providerPromise, 'optionalAccess', _40 => _40.then, 'call', _41 => _41((provider) => provider.destroy()), 'access', _42 => _42.catch, 'call', _43 => _43(() => {
3400
+ })]);
3401
+ }, _ActionExecutor.FFF_SEARCH_IDLE_TTL_MS);
3402
+ _optionalChain([this, 'access', _44 => _44.fffSearchIdleTimer, 'access', _45 => _45.unref, 'optionalCall', _46 => _46()]);
3403
+ }
2884
3404
  /**
2885
3405
  * Check permission hooks before prompting user.
2886
3406
  * Returns true if allowed, false if denied/blocked, undefined if should ask user.
@@ -2890,7 +3410,7 @@ var ActionExecutor = class _ActionExecutor {
2890
3410
  return {};
2891
3411
  }
2892
3412
  const hookResponse = await this.onPermissionRequest(context);
2893
- if (!_optionalChain([hookResponse, 'optionalAccess', _46 => _46.decision])) {
3413
+ if (!_optionalChain([hookResponse, 'optionalAccess', _47 => _47.decision])) {
2894
3414
  return {};
2895
3415
  }
2896
3416
  switch (hookResponse.decision) {
@@ -2906,7 +3426,7 @@ var ActionExecutor = class _ActionExecutor {
2906
3426
  }
2907
3427
  }
2908
3428
  async execute(action, context) {
2909
- if (this.runtime.options.dryRun && action.type !== "search" && action.type !== "plan") {
3429
+ if (this.runtime.options.dryRun && !["fff_grep", "fff_find", "find", "search", "search_with_context", "semantic_search", "glob", "plan"].includes(action.type)) {
2910
3430
  return "Dry-run mode: skipped mutation";
2911
3431
  }
2912
3432
  switch (action.type) {
@@ -2931,7 +3451,7 @@ var ActionExecutor = class _ActionExecutor {
2931
3451
  console.log(_chalk2.default.gray(`
2932
3452
  \u{1F9F9} Cleaned up ${cleanedCount} plan(s) older than 30 days`));
2933
3453
  }
2934
- const planModeManager = _chunkULQ6MDSJcjs.getPlanModeManager.call(void 0, );
3454
+ const planModeManager = _chunkLFDPTJYFcjs.getPlanModeManager.call(void 0, );
2935
3455
  if (planModeManager.isEnabled() && this.onAskFollowup) {
2936
3456
  const refreshedPlanIds = await storage.listPlans();
2937
3457
  const incompletePlans = [];
@@ -3101,11 +3621,15 @@ ${steps.map((s) => `${s.number}. ${s.description}`).join("\n")}`;
3101
3621
  const receivedKeys = Object.keys(action).filter((k) => k !== "type").join(", ") || "none";
3102
3622
  throw new Error(`write_file requires a "path" argument. Received arguments: [${receivedKeys}]`);
3103
3623
  }
3624
+ if (action.contents === void 0 && action.content === void 0) {
3625
+ return 'Error: write_file requires "contents" argument.';
3626
+ }
3104
3627
  const filePath = this.resolveWorkspacePath(action.path);
3105
3628
  const fs7 = await Promise.resolve().then(() => _interopRequireWildcard(require("fs-extra")));
3106
3629
  const exists = this.files.root && await fs7.pathExists(filePath);
3107
3630
  const oldContent = exists ? await this.files.readFile(action.path) : "";
3108
3631
  const newContent = _nullishCoalesce(this.pickText(action.contents, action.content), () => ( ""));
3632
+ let resultOutput = null;
3109
3633
  if (!exists) {
3110
3634
  const permContext = {
3111
3635
  tool: "write_file",
@@ -3151,16 +3675,18 @@ ${steps.map((s) => `${s.number}. ${s.description}`).join("\n")}`;
3151
3675
  }
3152
3676
  }
3153
3677
  }
3678
+ resultOutput = this.formatDiffPreview("", newContent, action.path);
3154
3679
  } else if (oldContent === newContent) {
3155
3680
  return `No changes needed for ${action.path} (content identical)`;
3156
3681
  } else {
3157
3682
  console.log(_chalk2.default.cyan(`
3158
3683
  \u{1F4DD} ${action.path}:`));
3159
3684
  this.showDiff(oldContent, newContent, action.path);
3685
+ resultOutput = this.formatDiffPreview(oldContent, newContent, action.path);
3160
3686
  }
3161
3687
  await this.files.writeFile(action.path, newContent);
3162
- _optionalChain([this, 'access', _47 => _47.onFileModified, 'optionalCall', _48 => _48(action.path)]);
3163
- return exists ? `Updated ${action.path}` : `Created ${action.path}`;
3688
+ _optionalChain([this, 'access', _48 => _48.onFileModified, 'optionalCall', _49 => _49(action.path, exists ? "modify" : "create")]);
3689
+ return _nullishCoalesce(resultOutput, () => ( (exists ? `Updated ${action.path}` : `Created ${action.path}`)));
3164
3690
  }
3165
3691
  case "append_file": {
3166
3692
  if (!action.path) {
@@ -3173,17 +3699,17 @@ ${steps.map((s) => `${s.number}. ${s.description}`).join("\n")}`;
3173
3699
  \u{1F4DD} ${action.path}:`));
3174
3700
  this.showDiff(oldContent, newContent, action.path);
3175
3701
  await this.files.appendFile(action.path, addition);
3176
- _optionalChain([this, 'access', _49 => _49.onFileModified, 'optionalCall', _50 => _50(action.path)]);
3177
- return `Appended to ${action.path}`;
3702
+ _optionalChain([this, 'access', _50 => _50.onFileModified, 'optionalCall', _51 => _51(action.path, "modify")]);
3703
+ return this.formatDiffPreview(oldContent, newContent, action.path);
3178
3704
  }
3179
3705
  case "apply_patch": {
3180
3706
  if (!action.path) {
3181
- throw new Error('apply_patch requires a "path" argument.');
3707
+ return 'Error: apply_patch requires a "path" argument.';
3182
3708
  }
3183
3709
  const oldContent = await this.files.readFile(action.path).catch(() => "");
3184
3710
  const patch = this.pickText(action.patch, action.diff);
3185
3711
  if (!patch) {
3186
- throw new Error("apply_patch requires patch or diff content.");
3712
+ return 'Error: apply_patch requires a "patch" argument.';
3187
3713
  }
3188
3714
  console.log(_chalk2.default.cyan(`
3189
3715
  \u{1F527} ${action.path}:`));
@@ -3191,58 +3717,60 @@ ${steps.map((s) => `${s.number}. ${s.description}`).join("\n")}`;
3191
3717
  await this.files.applyPatch(action.path, patch);
3192
3718
  const newContent = await this.files.readFile(action.path);
3193
3719
  this.showDiff(oldContent, newContent, action.path);
3194
- _optionalChain([this, 'access', _51 => _51.onFileModified, 'optionalCall', _52 => _52(action.path)]);
3195
- return `Patched ${action.path}`;
3720
+ _optionalChain([this, 'access', _52 => _52.onFileModified, 'optionalCall', _53 => _53(action.path, "modify")]);
3721
+ return this.formatDiffPreview(oldContent, newContent, action.path);
3722
+ }
3723
+ case "notebook_edit": {
3724
+ if (!action.path) {
3725
+ throw new Error('notebook_edit requires a "path" argument.');
3726
+ }
3727
+ const current = await this.files.readFile(action.path);
3728
+ const { updated, summary } = applyNotebookEdit(current, action);
3729
+ await this.files.writeFile(action.path, updated);
3730
+ _optionalChain([this, 'access', _54 => _54.onFileModified, 'optionalCall', _55 => _55(action.path, "modify")]);
3731
+ return summary;
3196
3732
  }
3197
3733
  case "tools_registry": {
3198
3734
  const tools = await this.toolsRegistry.listTools(this.getRegisteredTools());
3199
3735
  return JSON.stringify(tools, null, 2);
3200
3736
  }
3201
- case "search": {
3202
- const cacheKey = `search:${action.query}:${action.path || ""}`;
3203
- if (this.searchCache.has(cacheKey)) {
3204
- return `[Cached] ${this.searchCache.get(cacheKey)}`;
3737
+ case "tool_search": {
3738
+ const query = _optionalChain([action, 'access', _56 => _56.query, 'optionalAccess', _57 => _57.trim, 'call', _58 => _58()]);
3739
+ if (!query) {
3740
+ throw new Error('tool_search requires a non-empty "query" argument.');
3205
3741
  }
3206
- const hits = this.files.search(action.query, action.path);
3207
- this.recordExploration("search", action.query);
3208
- const result = hits.slice(0, 10).map((hit) => `${hit.file}:${hit.line}: ${hit.text}`).join("\n");
3209
- this.searchCache.set(cacheKey, result);
3210
- return result;
3211
- }
3212
- case "search_with_context": {
3213
- const cacheKey = `search_ctx:${action.query}:${action.path || ""}:${action.limit || ""}:${action.context || ""}`;
3214
- if (this.searchCache.has(cacheKey)) {
3215
- return `[Cached] ${this.searchCache.get(cacheKey)}`;
3216
- }
3217
- this.recordExploration("search", action.query);
3218
- const result = this.files.searchWithContext(action.query, {
3219
- limit: action.limit,
3220
- context: action.context,
3221
- relativePath: action.path
3222
- });
3223
- this.searchCache.set(cacheKey, result);
3224
- return result;
3225
- }
3226
- case "semantic_search": {
3227
- const cacheKey = `semantic:${action.query}:${action.path || ""}:${action.limit || ""}:${action.window || ""}`;
3228
- if (this.searchCache.has(cacheKey)) {
3229
- return `[Cached] ${this.searchCache.get(cacheKey)}`;
3230
- }
3231
- const results = this.files.semanticSearch(action.query, {
3232
- limit: action.limit,
3233
- window: action.window,
3234
- relativePath: action.path
3235
- });
3236
- if (!results.length) {
3237
- this.searchCache.set(cacheKey, "No matches found.");
3238
- return "No matches found.";
3239
- }
3240
- const result = results.map((hit) => `${_chalk2.default.cyan(hit.file)}
3241
- ${hit.snippet}`).join("\n\n");
3242
- this.searchCache.set(cacheKey, result);
3243
- return result;
3742
+ const limit = Math.max(1, _nullishCoalesce(action.limit, () => ( 10)));
3743
+ const tools = await this.toolsRegistry.listTools(this.getRegisteredTools());
3744
+ const terms = query.toLowerCase().split(/\s+/).filter(Boolean);
3745
+ const scored = tools.map((tool) => {
3746
+ const haystack = `${tool.name} ${tool.description}`.toLowerCase();
3747
+ let score = 0;
3748
+ for (const term of terms) {
3749
+ if (tool.name.toLowerCase() === term) {
3750
+ score += 10;
3751
+ } else if (tool.name.toLowerCase().includes(term)) {
3752
+ score += 6;
3753
+ }
3754
+ if (haystack.includes(term)) {
3755
+ score += 2;
3756
+ }
3757
+ }
3758
+ return { tool, score };
3759
+ }).filter((entry) => entry.score > 0).sort((a, b) => b.score - a.score || a.tool.name.localeCompare(b.tool.name)).slice(0, limit).map((entry) => entry.tool);
3760
+ return JSON.stringify(scored, null, 2);
3244
3761
  }
3762
+ case "find":
3763
+ return this.executeFind(action);
3764
+ case "glob":
3765
+ return this.executeGlob(action);
3766
+ case "fff_grep":
3767
+ return this.executeFFFGrep(action);
3768
+ case "fff_find":
3769
+ return this.executeFFFFind(action);
3245
3770
  case "create_directory": {
3771
+ if (!action.path) {
3772
+ return 'Error: create_directory requires a "path" argument.';
3773
+ }
3246
3774
  await this.files.createDirectory(action.path);
3247
3775
  return `Created directory ${action.path}`;
3248
3776
  }
@@ -3257,14 +3785,24 @@ ${hit.snippet}`).join("\n\n");
3257
3785
  if (!confirmed) {
3258
3786
  return `Skipped deleting ${action.path}`;
3259
3787
  }
3788
+ const oldDeleteContent = await this.files.readFile(action.path).catch(() => null);
3260
3789
  await this.files.deletePath(action.path);
3261
- return `Deleted ${action.path}`;
3790
+ if (oldDeleteContent !== null) {
3791
+ console.log(_chalk2.default.cyan(`
3792
+ \u{1F5D1}\uFE0F ${action.path}:`));
3793
+ this.showDiff(oldDeleteContent, "", action.path);
3794
+ _optionalChain([this, 'access', _59 => _59.onFileModified, 'optionalCall', _60 => _60(action.path, "delete")]);
3795
+ return this.formatDiffPreview(oldDeleteContent, "", action.path);
3796
+ }
3797
+ _optionalChain([this, 'access', _61 => _61.onFileModified, 'optionalCall', _62 => _62(action.path, "delete")]);
3798
+ return `Deleted directory ${action.path}`;
3262
3799
  }
3263
3800
  case "rename_path": {
3264
3801
  if (!action.from || !action.to) {
3265
3802
  throw new Error('rename_path requires "from" and "to" arguments.');
3266
3803
  }
3267
3804
  await this.files.renamePath(action.from, action.to);
3805
+ _optionalChain([this, 'access', _63 => _63.onFileModified, 'optionalCall', _64 => _64(action.to, "create")]);
3268
3806
  return `Renamed ${action.from} -> ${action.to}`;
3269
3807
  }
3270
3808
  case "copy_path": {
@@ -3272,9 +3810,16 @@ ${hit.snippet}`).join("\n\n");
3272
3810
  throw new Error('copy_path requires "from" and "to" arguments.');
3273
3811
  }
3274
3812
  await this.files.copyPath(action.from, action.to);
3813
+ _optionalChain([this, 'access', _65 => _65.onFileModified, 'optionalCall', _66 => _66(action.to, "create")]);
3275
3814
  return `Copied ${action.from} -> ${action.to}`;
3276
3815
  }
3277
3816
  case "search_replace": {
3817
+ if (!action.path) {
3818
+ return 'Error: search_replace requires a "path" argument.';
3819
+ }
3820
+ if (!action.blocks) {
3821
+ return 'Error: search_replace requires a "blocks" argument.';
3822
+ }
3278
3823
  const content = await this.files.readFile(action.path);
3279
3824
  const result = this.applySearchReplaceBlocks(content, action.blocks);
3280
3825
  if (content !== result) {
@@ -3282,49 +3827,91 @@ ${hit.snippet}`).join("\n\n");
3282
3827
  \u{1F504} ${action.path}:`));
3283
3828
  this.showDiff(content, result, action.path);
3284
3829
  await this.files.writeFile(action.path, result);
3285
- _optionalChain([this, 'access', _53 => _53.onFileModified, 'optionalCall', _54 => _54(action.path)]);
3830
+ _optionalChain([this, 'access', _67 => _67.onFileModified, 'optionalCall', _68 => _68(action.path, "modify")]);
3831
+ return this.formatDiffPreview(content, result, action.path);
3286
3832
  }
3287
- return `Updated ${action.path}`;
3833
+ return `No changes needed for ${action.path} (content identical)`;
3288
3834
  }
3289
3835
  case "format_file": {
3290
3836
  if (!action.path) {
3291
3837
  throw new Error('format_file requires a "path" argument.');
3292
3838
  }
3839
+ const oldFormatContent = await this.files.readFile(action.path).catch(() => "");
3293
3840
  await this.files.formatFile(action.path, (contents, file) => _chunk4JNNTOGFcjs.applyFormatter.call(void 0, action.formatter, contents, file));
3294
- return `Formatted ${action.path} (${action.formatter})`;
3841
+ const newFormatContent = await this.files.readFile(action.path).catch(() => "");
3842
+ if (oldFormatContent !== newFormatContent) {
3843
+ console.log(_chalk2.default.cyan(`
3844
+ \u{1F3A8} ${action.path}:`));
3845
+ this.showDiff(oldFormatContent, newFormatContent, action.path);
3846
+ _optionalChain([this, 'access', _69 => _69.onFileModified, 'optionalCall', _70 => _70(action.path, "modify")]);
3847
+ return this.formatDiffPreview(oldFormatContent, newFormatContent, action.path);
3848
+ }
3849
+ return `No changes needed (already formatted): ${action.path}`;
3295
3850
  }
3296
3851
  case "run_command": {
3297
3852
  if (!action.command || typeof action.command !== "string") {
3298
3853
  return 'Error: run_command requires a "command" argument (string)';
3299
3854
  }
3300
3855
  const shouldStreamOutput = Boolean(
3301
- this.onToolOutput && _optionalChain([context, 'optionalAccess', _55 => _55.toolCallId]) && !action.background && process.env.AUTOHAND_STREAM_TOOL_OUTPUT === "1"
3856
+ this.onToolOutput && _optionalChain([context, 'optionalAccess', _71 => _71.toolCallId]) && !action.background && process.env.AUTOHAND_STREAM_TOOL_OUTPUT === "1"
3302
3857
  );
3303
3858
  const emitOutput = (stream, data) => {
3304
3859
  if (!shouldStreamOutput) {
3305
3860
  return;
3306
3861
  }
3307
- _optionalChain([this, 'access', _56 => _56.onToolOutput, 'optionalCall', _57 => _57({
3862
+ _optionalChain([this, 'access', _72 => _72.onToolOutput, 'optionalCall', _73 => _73({
3308
3863
  tool: action.type,
3309
- toolCallId: _optionalChain([context, 'optionalAccess', _58 => _58.toolCallId]),
3864
+ toolCallId: _optionalChain([context, 'optionalAccess', _74 => _74.toolCallId]),
3310
3865
  stream,
3311
3866
  data
3312
3867
  })]);
3313
3868
  };
3314
3869
  const cmdStr = `${action.command} ${(_nullishCoalesce(action.args, () => ( []))).join(" ")}`.trim();
3870
+ if (action.interactive) {
3871
+ const onModalPause = this.onModalPause;
3872
+ if (onModalPause) {
3873
+ return await onModalPause(async () => {
3874
+ let result2;
3875
+ try {
3876
+ result2 = await _chunkWTB7AFL6cjs.runCommand.call(void 0,
3877
+ cmdStr,
3878
+ [],
3879
+ this.runtime.workspaceRoot,
3880
+ {
3881
+ directory: action.directory,
3882
+ shell: true,
3883
+ interactive: true
3884
+ }
3885
+ );
3886
+ } catch (err) {
3887
+ const error = err;
3888
+ if (error.code === "ENOENT" || error.message.includes("Command not found")) {
3889
+ return `Error: Command not found: "${action.command}". Make sure it is installed and available on your PATH.`;
3890
+ }
3891
+ return `Error running "${cmdStr}": ${error.message}`;
3892
+ }
3893
+ const header2 = action.description ? `$ ${action.description}
3894
+ > ${cmdStr}` : `$ ${cmdStr}`;
3895
+ const dirInfo2 = action.directory ? `[dir: ${action.directory}]` : "";
3896
+ const parts2 = [dirInfo2 ? `${header2} ${dirInfo2}` : header2];
3897
+ if (result2.code !== 0) {
3898
+ parts2.push(`(exit code: ${result2.code})`);
3899
+ }
3900
+ return parts2.join("\n");
3901
+ });
3902
+ }
3903
+ }
3315
3904
  let result;
3316
- const useShell = needsShell(action.command);
3317
- const shellCmd = useShell ? `${action.command} ${(_nullishCoalesce(action.args, () => ( []))).join(" ")}`.trim() : action.command;
3318
- const shellArgs = useShell ? [] : _nullishCoalesce(action.args, () => ( []));
3905
+ const shellCmd = cmdStr;
3319
3906
  try {
3320
- result = await runCommand(
3907
+ result = await _chunkWTB7AFL6cjs.runCommand.call(void 0,
3321
3908
  shellCmd,
3322
- shellArgs,
3909
+ [],
3323
3910
  this.runtime.workspaceRoot,
3324
3911
  {
3325
3912
  directory: action.directory,
3326
3913
  background: action.background,
3327
- shell: useShell,
3914
+ shell: true,
3328
3915
  onStdout: (chunk) => emitOutput("stdout", chunk),
3329
3916
  onStderr: (chunk) => emitOutput("stderr", chunk)
3330
3917
  }
@@ -3349,12 +3936,100 @@ ${hit.snippet}`).join("\n\n");
3349
3936
  }
3350
3937
  return parts.join("\n");
3351
3938
  }
3939
+ case "shell": {
3940
+ if (!action.command || typeof action.command !== "string") {
3941
+ return 'Error: shell requires a "command" argument (string)';
3942
+ }
3943
+ const cmdStr = `${action.command} ${(_nullishCoalesce(action.args, () => ( []))).join(" ")}`.trim();
3944
+ const commandId = _optionalChain([this, 'access', _75 => _75.onLiveCommandStart, 'optionalCall', _76 => _76(cmdStr)]);
3945
+ const hasLiveDisplay = Boolean(commandId);
3946
+ if (hasLiveDisplay) {
3947
+ const liveId = commandId;
3948
+ try {
3949
+ const result2 = await _chunkWBU4Q4GScjs.executeStreamingShellCommand.call(void 0,
3950
+ cmdStr,
3951
+ this.runtime.workspaceRoot,
3952
+ {
3953
+ onStdout: (chunk) => this.onLiveCommandOutput(liveId, "stdout", chunk),
3954
+ onStderr: (chunk) => this.onLiveCommandOutput(liveId, "stderr", chunk),
3955
+ preferPty: process.stdin.isTTY && process.stdout.isTTY,
3956
+ columns: process.stdout.columns,
3957
+ rows: process.stdout.rows,
3958
+ background: action.background
3959
+ }
3960
+ );
3961
+ this.onLiveCommandRemove(liveId);
3962
+ const header2 = action.description ? `$ ${action.description}
3963
+ > ${cmdStr}` : `$ ${cmdStr}`;
3964
+ const dirInfo2 = action.directory ? `[dir: ${action.directory}]` : "";
3965
+ const parts2 = [dirInfo2 ? `${header2} ${dirInfo2}` : header2];
3966
+ if (result2.output) parts2.push(result2.output);
3967
+ if (result2.error) parts2.push(result2.error);
3968
+ if (result2.backgroundPid) parts2.push(`[Background PID: ${result2.backgroundPid}]`);
3969
+ return parts2.join("\n");
3970
+ } catch (err) {
3971
+ this.onLiveCommandRemove(liveId);
3972
+ const error = err;
3973
+ return `Error running "${cmdStr}": ${error.message}`;
3974
+ }
3975
+ }
3976
+ let result;
3977
+ try {
3978
+ result = await _chunkWTB7AFL6cjs.runCommand.call(void 0,
3979
+ cmdStr,
3980
+ [],
3981
+ this.runtime.workspaceRoot,
3982
+ {
3983
+ directory: action.directory,
3984
+ shell: true,
3985
+ background: action.background
3986
+ }
3987
+ );
3988
+ } catch (err) {
3989
+ const error = err;
3990
+ if (error.code === "ENOENT" || error.message.includes("Command not found")) {
3991
+ return `Error: Command not found: "${action.command}". Make sure it is installed and available on your PATH.`;
3992
+ }
3993
+ return `Error running "${cmdStr}": ${error.message}`;
3994
+ }
3995
+ const header = action.description ? `$ ${action.description}
3996
+ > ${cmdStr}` : `$ ${cmdStr}`;
3997
+ const dirInfo = action.directory ? `[dir: ${action.directory}]` : "";
3998
+ const parts = [
3999
+ dirInfo ? `${header} ${dirInfo}` : header,
4000
+ result.stdout,
4001
+ result.stderr
4002
+ ].filter(Boolean);
4003
+ return parts.join("\n");
4004
+ }
3352
4005
  case "add_dependency": {
4006
+ const fseAdd = (await Promise.resolve().then(() => _interopRequireWildcard(require("fs-extra")))).default;
4007
+ const pkgPathAdd = `${this.runtime.workspaceRoot}/package.json`;
4008
+ const oldPkgAdd = await fseAdd.readFile(pkgPathAdd, "utf-8").catch(() => "");
3353
4009
  await addDependency(this.runtime.workspaceRoot, action.name, action.version, { dev: action.dev });
4010
+ const newPkgAdd = await fseAdd.readFile(pkgPathAdd, "utf-8").catch(() => "");
4011
+ if (oldPkgAdd !== newPkgAdd) {
4012
+ console.log(_chalk2.default.cyan(`
4013
+ \u{1F4E6} package.json:`));
4014
+ this.showDiff(oldPkgAdd, newPkgAdd, "package.json");
4015
+ _optionalChain([this, 'access', _77 => _77.onFileModified, 'optionalCall', _78 => _78("package.json", "modify")]);
4016
+ return this.formatDiffPreview(oldPkgAdd, newPkgAdd, "package.json");
4017
+ }
3354
4018
  return `Added dependency ${action.name}@${action.version}${action.dev ? " (dev)" : ""}`;
3355
4019
  }
3356
4020
  case "remove_dependency": {
4021
+ const fseRm = (await Promise.resolve().then(() => _interopRequireWildcard(require("fs-extra")))).default;
4022
+ const pkgPathRm = `${this.runtime.workspaceRoot}/package.json`;
4023
+ const oldPkgRm = await fseRm.readFile(pkgPathRm, "utf-8").catch(() => "");
3357
4024
  await removeDependency(this.runtime.workspaceRoot, action.name, { dev: action.dev });
4025
+ const newPkgRm = await fseRm.readFile(pkgPathRm, "utf-8").catch(() => "");
4026
+ if (oldPkgRm !== newPkgRm) {
4027
+ console.log(_chalk2.default.cyan(`
4028
+ \u{1F4E6} package.json:`));
4029
+ this.showDiff(oldPkgRm, newPkgRm, "package.json");
4030
+ _optionalChain([this, 'access', _79 => _79.onFileModified, 'optionalCall', _80 => _80("package.json", "modify")]);
4031
+ return this.formatDiffPreview(oldPkgRm, newPkgRm, "package.json");
4032
+ }
3358
4033
  return `Removed dependency ${action.name}${action.dev ? " (dev)" : ""}`;
3359
4034
  }
3360
4035
  case "list_tree": {
@@ -3383,11 +4058,7 @@ ${hit.snippet}`).join("\n\n");
3383
4058
  return `${_nullishCoalesce(action.algorithm, () => ( "sha256"))} ${action.path}: ${sum}`;
3384
4059
  }
3385
4060
  case "git_diff": {
3386
- if (!action.path) {
3387
- throw new Error('git_diff requires a "path" argument.');
3388
- }
3389
- this.resolveWorkspacePath(action.path);
3390
- const rawDiff = diffFile(this.runtime.workspaceRoot, action.path);
4061
+ const rawDiff = action.path ? (this.resolveWorkspacePath(action.path), diffFile(this.runtime.workspaceRoot, action.path)) : diffWorkspace(this.runtime.workspaceRoot);
3391
4062
  return this.colorizeGitDiff(rawDiff);
3392
4063
  }
3393
4064
  case "git_checkout": {
@@ -3395,8 +4066,17 @@ ${hit.snippet}`).join("\n\n");
3395
4066
  throw new Error('git_checkout requires a "path" argument.');
3396
4067
  }
3397
4068
  this.resolveWorkspacePath(action.path);
4069
+ const oldCheckoutContent = await this.files.readFile(action.path).catch(() => "");
3398
4070
  checkoutFile(this.runtime.workspaceRoot, action.path);
3399
- return `Restored ${action.path} from git.`;
4071
+ const newCheckoutContent = await this.files.readFile(action.path).catch(() => "");
4072
+ if (oldCheckoutContent !== newCheckoutContent) {
4073
+ console.log(_chalk2.default.cyan(`
4074
+ \u21A9\uFE0F ${action.path}:`));
4075
+ this.showDiff(oldCheckoutContent, newCheckoutContent, action.path);
4076
+ _optionalChain([this, 'access', _81 => _81.onFileModified, 'optionalCall', _82 => _82(action.path, "modify")]);
4077
+ return this.formatDiffPreview(oldCheckoutContent, newCheckoutContent, action.path);
4078
+ }
4079
+ return `Restored ${action.path} from git (no changes).`;
3400
4080
  }
3401
4081
  case "git_status":
3402
4082
  return gitStatus(this.runtime.workspaceRoot);
@@ -3666,8 +4346,10 @@ ${result.removed.map((p) => ` - ${p}`).join("\n")}`;
3666
4346
  console.log(_chalk2.default.cyan("Suggested commit message:"));
3667
4347
  console.log(_chalk2.default.white(` ${commitMessage}`));
3668
4348
  console.log();
4349
+ const normalizedYolo = _chunkJ5HE6CUMcjs.normalizeYoloInput.call(void 0, this.runtime.options.yolo);
4350
+ const yoloAllowsCommit = normalizedYolo && _chunkJ5HE6CUMcjs.isToolAllowedByYolo.call(void 0, "auto_commit", _chunkJ5HE6CUMcjs.parseYoloPattern.call(void 0, normalizedYolo));
3669
4351
  const autoApproveCommit = Boolean(
3670
- this.runtime.options.yes || process.env.CI === "1" || process.env.AUTOHAND_NON_INTERACTIVE === "1"
4352
+ this.runtime.options.unrestricted || this.runtime.options.yes || yoloAllowsCommit || process.env.CI === "1" || process.env.AUTOHAND_NON_INTERACTIVE === "1"
3671
4353
  );
3672
4354
  if (autoApproveCommit) {
3673
4355
  console.log(_chalk2.default.gray("Auto-commit approval enabled; committing without prompt."));
@@ -3682,26 +4364,36 @@ ${result.removed.map((p) => ` - ${p}`).join("\n")}`;
3682
4364
  return result2.message;
3683
4365
  }
3684
4366
  const options = [
3685
- { label: "Yes - commit with this message", value: "y" },
4367
+ { label: `Yes - commit with this message`, value: "y" },
3686
4368
  { label: "Edit - modify the message", value: "e" },
3687
4369
  { label: "No - cancel commit", value: "n" }
3688
4370
  ];
3689
- const modalResult = await _chunkZYQMLKOKcjs.showModal.call(void 0, {
3690
- title: "Commit with this message?",
3691
- options
3692
- });
3693
- if (!modalResult || modalResult.value === "n") {
4371
+ const runModal = async () => {
4372
+ const modalResult = await _chunkCH2J4PVEcjs.showModal.call(void 0, {
4373
+ title: `Commit with this message?
4374
+
4375
+ "${commitMessage}"`,
4376
+ options
4377
+ });
4378
+ if (!modalResult || modalResult.value === "n") {
4379
+ return { cancelled: true, editedMessage: null };
4380
+ }
4381
+ if (modalResult.value === "e") {
4382
+ const editedMessage = await _chunkCH2J4PVEcjs.showInput.call(void 0, {
4383
+ title: "Enter commit message:",
4384
+ defaultValue: commitMessage
4385
+ });
4386
+ return { cancelled: false, editedMessage };
4387
+ }
4388
+ return { cancelled: false, editedMessage: null };
4389
+ };
4390
+ const modalOutcome = this.onModalPause ? await this.onModalPause(runModal) : await runModal();
4391
+ if (modalOutcome.cancelled) {
3694
4392
  console.log(_chalk2.default.yellow("Commit cancelled."));
3695
4393
  return "Commit cancelled by user";
3696
4394
  }
3697
- if (modalResult.value === "e") {
3698
- const editedMessage = await _chunkZYQMLKOKcjs.showInput.call(void 0, {
3699
- title: "Enter commit message:",
3700
- defaultValue: commitMessage
3701
- });
3702
- if (editedMessage) {
3703
- commitMessage = editedMessage;
3704
- }
4395
+ if (modalOutcome.editedMessage) {
4396
+ commitMessage = modalOutcome.editedMessage;
3705
4397
  }
3706
4398
  const result = executeAutoCommit(this.runtime.workspaceRoot, commitMessage, action.stage_all !== false);
3707
4399
  if (result.success) {
@@ -3735,6 +4427,12 @@ ${result.removed.map((p) => ` - ${p}`).join("\n")}`;
3735
4427
  case "custom_command":
3736
4428
  return this.executeCustomCommand(action);
3737
4429
  case "multi_file_edit": {
4430
+ if (!action.file_path) {
4431
+ return 'Error: multi_file_edit requires a "file_path" argument.';
4432
+ }
4433
+ if (!action.edits || !Array.isArray(action.edits)) {
4434
+ return 'Error: multi_file_edit requires an "edits" argument (array).';
4435
+ }
3738
4436
  const oldContent = await this.files.readFile(action.file_path);
3739
4437
  let newContent = oldContent;
3740
4438
  console.log(_chalk2.default.cyan(`
@@ -3775,14 +4473,20 @@ ${result.removed.map((p) => ` - ${p}`).join("\n")}`;
3775
4473
  }
3776
4474
  }
3777
4475
  if (firstIndex === -1) {
3778
- console.log(_chalk2.default.red(` \u2717 Edit ${i + 1}: Could not find text to replace`));
3779
- console.log(_chalk2.default.gray(` Looking for (${edit.old_string.length} chars):`));
3780
- console.log(_chalk2.default.gray(` "${edit.old_string.substring(0, 80)}${edit.old_string.length > 80 ? "..." : ""}"`));
3781
4476
  const similar = this.findSimilarText(newContent, edit.old_string);
3782
4477
  if (similar) {
3783
- console.log(_chalk2.default.yellow(` Did you mean:`));
3784
- console.log(_chalk2.default.yellow(` "${similar.substring(0, 80)}${similar.length > 80 ? "..." : ""}"`));
4478
+ const similarIndex = newContent.indexOf(similar);
4479
+ if (similarIndex !== -1) {
4480
+ newContent = newContent.substring(0, similarIndex) + edit.new_string + newContent.substring(similarIndex + similar.length);
4481
+ console.log(_chalk2.default.yellow(` \u26A0 Edit ${i + 1}: Applied with fuzzy match (whitespace/indentation differed)`));
4482
+ console.log(_chalk2.default.gray(` Original search: "${edit.old_string.substring(0, 60)}${edit.old_string.length > 60 ? "..." : ""}"`));
4483
+ console.log(_chalk2.default.gray(` Matched: "${similar.substring(0, 60)}${similar.length > 60 ? "..." : ""}"`));
4484
+ continue;
4485
+ }
3785
4486
  }
4487
+ console.log(_chalk2.default.red(` \u2717 Edit ${i + 1}: Could not find text to replace`));
4488
+ console.log(_chalk2.default.gray(` Looking for (${edit.old_string.length} chars):`));
4489
+ console.log(_chalk2.default.gray(` "${edit.old_string.substring(0, 80)}${edit.old_string.length > 80 ? "..." : ""}"`));
3786
4490
  if (edit.old_string.length < 100) {
3787
4491
  const nonAscii = edit.old_string.match(/[^\x20-\x7E\n\r\t]/g);
3788
4492
  if (nonAscii && nonAscii.length > 0) {
@@ -3798,9 +4502,10 @@ ${result.removed.map((p) => ` - ${p}`).join("\n")}`;
3798
4502
  if (oldContent !== newContent) {
3799
4503
  this.showDiff(oldContent, newContent, action.file_path);
3800
4504
  await this.files.writeFile(action.file_path, newContent);
3801
- _optionalChain([this, 'access', _59 => _59.onFileModified, 'optionalCall', _60 => _60(action.file_path)]);
4505
+ _optionalChain([this, 'access', _83 => _83.onFileModified, 'optionalCall', _84 => _84(action.file_path, "modify")]);
4506
+ return this.formatDiffPreview(oldContent, newContent, action.file_path);
3802
4507
  }
3803
- return `Applied ${action.edits.length} edit(s) to ${action.file_path}`;
4508
+ return `No changes needed for ${action.file_path} (content identical)`;
3804
4509
  }
3805
4510
  case "todo_write": {
3806
4511
  const todoPath = ".autohand/agents/tasks/todos.json";
@@ -3810,17 +4515,17 @@ ${result.removed.map((p) => ` - ${p}`).join("\n")}`;
3810
4515
  }
3811
4516
  const validTasks = action.tasks.filter((task) => {
3812
4517
  if (!task) return false;
3813
- const hasId = !!task.id;
3814
4518
  const hasContent = !!(task.content || task.title);
3815
- return hasId && hasContent;
4519
+ return hasContent;
3816
4520
  });
3817
- const normalizedTasks = validTasks.map((task) => {
4521
+ const normalizedTasks = validTasks.map((task, index) => {
3818
4522
  const content = task.content || task.title || "";
3819
4523
  const title = content;
3820
4524
  return {
3821
4525
  ...task,
3822
4526
  // Preserve extra properties like priority, tags, etc.
3823
- id: task.id,
4527
+ id: task.id || `task-${Date.now()}-${index}`,
4528
+ // Auto-generate id if missing
3824
4529
  title,
3825
4530
  content,
3826
4531
  // Keep original content field
@@ -3831,24 +4536,51 @@ ${result.removed.map((p) => ` - ${p}`).join("\n")}`;
3831
4536
  });
3832
4537
  const allTodos = normalizedTasks;
3833
4538
  await this.files.writeFile(todoPath, JSON.stringify(allTodos, null, 2));
3834
- console.log(_chalk2.default.cyan("\n\u{1F4CB} Task Progress:"));
4539
+ _optionalChain([this, 'access', _85 => _85.onFileModified, 'optionalCall', _86 => _86(todoPath, "modify")]);
3835
4540
  const total = allTodos.length;
3836
- const completed = allTodos.filter((t) => t.status === "completed").length;
4541
+ if (total === 0) {
4542
+ console.log(_chalk2.default.dim("\n\u{1F4CB} Task list cleared"));
4543
+ console.log();
4544
+ return "Task list cleared (0 tasks)";
4545
+ }
4546
+ const completedTasks = allTodos.filter((t) => t.status === "completed");
3837
4547
  const inProgress = allTodos.filter((t) => t.status === "in_progress");
3838
- const pending = allTodos.filter((t) => t.status === "pending").length;
3839
- const percent = total > 0 ? Math.round(completed / total * 100) : 0;
4548
+ const pendingTasks = allTodos.filter((t) => t.status === "pending");
4549
+ const completed = completedTasks.length;
4550
+ const pending = pendingTasks.length;
4551
+ const percent = Math.round(completed / total * 100);
3840
4552
  const barWidth = 20;
3841
4553
  const filled = Math.round(barWidth * percent / 100);
3842
4554
  const bar = "\u2588".repeat(filled) + "\u2591".repeat(barWidth - filled);
3843
- console.log(` ${_chalk2.default.green(bar)} ${percent}%`);
3844
- console.log(_chalk2.default.gray(` ${completed} done \xB7 ${inProgress.length} in progress \xB7 ${pending} pending`));
4555
+ const titleOf = (task) => {
4556
+ const title = _nullishCoalesce(task.title, () => ( task.content));
4557
+ return typeof title === "string" && title.trim().length > 0 ? title : "Untitled task";
4558
+ };
4559
+ const outputLines = [
4560
+ _chalk2.default.cyan("\n\u{1F4CB} Task Progress:"),
4561
+ ` ${_chalk2.default.green(bar)} ${percent}%`,
4562
+ _chalk2.default.gray(` ${completed} done \xB7 ${inProgress.length} in progress \xB7 ${pending} pending`)
4563
+ ];
4564
+ if (completedTasks.length > 0) {
4565
+ outputLines.push("", _chalk2.default.green(" \u2705 Completed Tasks:"));
4566
+ for (const task of completedTasks) {
4567
+ outputLines.push(_chalk2.default.green(` \u2713 ${titleOf(task)}`));
4568
+ }
4569
+ }
3845
4570
  if (inProgress.length > 0) {
3846
- console.log(_chalk2.default.yellow("\n \u{1F504} Active Tasks:"));
4571
+ outputLines.push("", _chalk2.default.yellow(" \u{1F504} Active Tasks:"));
3847
4572
  for (const task of inProgress) {
3848
- console.log(` \u2022 ${task.title || task.content}`);
4573
+ outputLines.push(_chalk2.default.yellow(` \u2022 ${titleOf(task)}`));
3849
4574
  }
3850
4575
  }
3851
- console.log();
4576
+ if (pendingTasks.length > 0) {
4577
+ outputLines.push("", _chalk2.default.cyan(" \u23F3 Pending Tasks:"));
4578
+ for (const task of pendingTasks) {
4579
+ outputLines.push(_chalk2.default.dim(` \u25CB ${titleOf(task)}`));
4580
+ }
4581
+ }
4582
+ console.log(`${outputLines.join("\n")}
4583
+ `);
3852
4584
  return `Updated task list: ${percent}% complete (${completed}/${total})`;
3853
4585
  }
3854
4586
  case "save_memory": {
@@ -3876,58 +4608,21 @@ ${result.removed.map((p) => ` - ${p}`).join("\n")}`;
3876
4608
  return formatted;
3877
4609
  }
3878
4610
  case "create_meta_tool": {
3879
- if (!action.name || !action.description || !action.handler) {
3880
- throw new Error("create_meta_tool requires name, description, and handler");
3881
- }
3882
- const builtInNames = this.getRegisteredTools().map((t) => t.name);
3883
- if (builtInNames.includes(action.name)) {
3884
- throw new Error(`Cannot create meta-tool "${action.name}": conflicts with built-in tool`);
3885
- }
3886
- const dangerousPatterns = [
3887
- // Destructive file operations
3888
- { pattern: /rm\s+(-[rf]+\s+)*\/(?!\w)/i, description: "rm with root path" },
3889
- { pattern: /rm\s+.*--no-preserve-root/i, description: "rm --no-preserve-root" },
3890
- { pattern: /dd\s+.*(?:of|if)=\/dev\/[sh]d/i, description: "dd to disk device" },
3891
- { pattern: /mkfs\./i, description: "filesystem format" },
3892
- { pattern: /wipefs/i, description: "disk wipe" },
3893
- // Privilege escalation
3894
- { pattern: /\bsudo\s/i, description: "sudo command" },
3895
- { pattern: /\bsu\s+-?\s*\w/i, description: "su command" },
3896
- { pattern: /chmod\s+[0-7]*7[0-7]*/i, description: "world-writable chmod" },
3897
- { pattern: /chown\s+root/i, description: "chown to root" },
3898
- // Remote code execution
3899
- { pattern: /curl\s+.*\|\s*(ba)?sh/i, description: "curl | bash" },
3900
- { pattern: /wget\s+.*\|\s*(ba)?sh/i, description: "wget | sh" },
3901
- { pattern: /\beval\s+[`$]/i, description: "eval with expansion" },
3902
- // Fork bomb and resource exhaustion
3903
- { pattern: /:\(\)\s*\{\s*:\s*\|\s*:\s*&\s*\}\s*;/i, description: "fork bomb" },
3904
- { pattern: /while\s+true.*do.*done/i, description: "infinite loop" },
3905
- // Reverse shell indicators
3906
- { pattern: /nc\s+.*-e\s*\/bin/i, description: "netcat reverse shell" },
3907
- { pattern: /ncat\s+.*-e\s*\/bin/i, description: "ncat reverse shell" },
3908
- { pattern: /bash\s+-i\s+>&?\s*\/dev\/tcp/i, description: "bash reverse shell" },
3909
- // Dangerous network operations
3910
- { pattern: /iptables\s+-F/i, description: "flush firewall rules" },
3911
- // Crypto operations that could lock out user
3912
- { pattern: /gpg\s+.*--encrypt.*-r\s+\S+\s+\//i, description: "gpg encrypt root" }
3913
- ];
3914
- for (const { pattern, description } of dangerousPatterns) {
3915
- if (pattern.test(action.handler)) {
3916
- throw new Error(`Handler contains dangerous pattern: ${description}`);
3917
- }
3918
- }
3919
- await this.toolsRegistry.saveMetaTool({
4611
+ const result = await this.metaToolService.createMetaTool({
3920
4612
  name: action.name,
3921
4613
  description: action.description,
3922
4614
  parameters: _nullishCoalesce(action.parameters, () => ( { type: "object", properties: {} })),
3923
4615
  handler: action.handler,
3924
- source: "agent"
3925
- });
4616
+ source: "agent",
4617
+ scope: _nullishCoalesce(action.scope, () => ( "user"))
4618
+ }, this.getRegisteredTools());
4619
+ const metaTool = result.definition;
4620
+ _optionalChain([this, 'access', _87 => _87.onMetaToolCreated, 'optionalCall', _88 => _88(metaTool)]);
3926
4621
  console.log(_chalk2.default.green(`
3927
- \u{1F527} Created meta-tool: ${action.name}`));
4622
+ \u{1F527} ${result.status === "created" ? "Created" : "Reused"} meta-tool: ${metaTool.name}`));
3928
4623
  console.log(_chalk2.default.gray(` ${action.description}`));
3929
4624
  console.log(_chalk2.default.gray(` Handler: ${action.handler}`));
3930
- return `Created meta-tool "${action.name}" - available in this and future sessions`;
4625
+ return result.message;
3931
4626
  }
3932
4627
  // Web Search Operations
3933
4628
  case "web_search": {
@@ -3936,11 +4631,11 @@ ${result.removed.map((p) => ` - ${p}`).join("\n")}`;
3936
4631
  }
3937
4632
  console.log(_chalk2.default.cyan(`
3938
4633
  \u{1F50D} Searching web: "${action.query}"...`));
3939
- const results = await _chunkRKJTGGMUcjs.webSearch.call(void 0, action.query, {
4634
+ const results = await _chunkWKRDBCP2cjs.webSearch.call(void 0, action.query, {
3940
4635
  maxResults: action.max_results,
3941
4636
  searchType: action.search_type
3942
4637
  });
3943
- const formatted = _chunkRKJTGGMUcjs.formatSearchResults.call(void 0, results);
4638
+ const formatted = _chunkWKRDBCP2cjs.formatSearchResults.call(void 0, results);
3944
4639
  console.log(_chalk2.default.gray(formatted.split("\n").slice(0, 10).join("\n")));
3945
4640
  if (results.length > 3) {
3946
4641
  console.log(_chalk2.default.gray(" ..."));
@@ -3953,7 +4648,7 @@ ${result.removed.map((p) => ` - ${p}`).join("\n")}`;
3953
4648
  }
3954
4649
  console.log(_chalk2.default.cyan(`
3955
4650
  \u{1F310} Fetching: ${action.url}...`));
3956
- const content = await _chunkRKJTGGMUcjs.fetchUrl.call(void 0, action.url, {
4651
+ const content = await _chunkWKRDBCP2cjs.fetchUrl.call(void 0, action.url, {
3957
4652
  maxLength: action.max_length
3958
4653
  });
3959
4654
  const preview = content.slice(0, 500);
@@ -3967,11 +4662,11 @@ ${result.removed.map((p) => ` - ${p}`).join("\n")}`;
3967
4662
  const registryLabel = action.registry ? ` (${action.registry})` : "";
3968
4663
  console.log(_chalk2.default.cyan(`
3969
4664
  \u{1F4E6} Getting package info: ${action.package_name}${action.version ? `@${action.version}` : ""}${registryLabel}...`));
3970
- const info = await _chunkRKJTGGMUcjs.getPackageInfo.call(void 0, action.package_name, {
4665
+ const info = await _chunkWKRDBCP2cjs.getPackageInfo.call(void 0, action.package_name, {
3971
4666
  registry: action.registry,
3972
4667
  version: action.version
3973
4668
  });
3974
- const formatted = _chunkRKJTGGMUcjs.formatPackageInfo.call(void 0, info);
4669
+ const formatted = _chunkWKRDBCP2cjs.formatPackageInfo.call(void 0, info);
3975
4670
  console.log(_chalk2.default.gray(formatted));
3976
4671
  return formatted;
3977
4672
  }
@@ -4023,7 +4718,7 @@ ${result.removed.map((p) => ` - ${p}`).join("\n")}`;
4023
4718
  const query = _nullishCoalesce(action.query, () => ( ""));
4024
4719
  console.log(_chalk2.default.cyan(`
4025
4720
  Searching skills: "${query}"${action.category ? ` [${action.category}]` : ""}...`));
4026
- const { searchCommunitySkills } = await Promise.resolve().then(() => _interopRequireWildcard(require("./skills-PG542VEB.cjs")));
4721
+ const { searchCommunitySkills } = await Promise.resolve().then(() => _interopRequireWildcard(require("./skills-GGMZOVIE.cjs")));
4027
4722
  const result = await searchCommunitySkills(query, {
4028
4723
  category: action.category,
4029
4724
  limit: action.limit
@@ -4049,17 +4744,17 @@ Searching skills: "${query}"${action.category ? ` [${action.category}]` : ""}...
4049
4744
  label: `${options.length + 1}. Other (type your own answer)`,
4050
4745
  value: "__other__"
4051
4746
  });
4052
- const result = await _chunkZYQMLKOKcjs.showModal.call(void 0, {
4747
+ const result = await _chunkCH2J4PVEcjs.showModal.call(void 0, {
4053
4748
  title: "Select an answer:",
4054
4749
  options
4055
4750
  });
4056
- const selected = _optionalChain([result, 'optionalAccess', _61 => _61.value]);
4751
+ const selected = _optionalChain([result, 'optionalAccess', _89 => _89.value]);
4057
4752
  if (!selected) {
4058
4753
  console.log(_chalk2.default.yellow("\nAnswer cancelled.\n"));
4059
4754
  return "<answer>No answer provided</answer>";
4060
4755
  }
4061
4756
  if (selected === "__other__") {
4062
- const answer = await _chunkZYQMLKOKcjs.showInput.call(void 0, {
4757
+ const answer = await _chunkCH2J4PVEcjs.showInput.call(void 0, {
4063
4758
  title: "Your answer:"
4064
4759
  });
4065
4760
  if (!answer) {
@@ -4076,7 +4771,7 @@ Searching skills: "${query}"${action.category ? ` [${action.category}]` : ""}...
4076
4771
  `));
4077
4772
  return `<answer>${selected}</answer>`;
4078
4773
  } else {
4079
- const answer = await _chunkZYQMLKOKcjs.showInput.call(void 0, {
4774
+ const answer = await _chunkCH2J4PVEcjs.showInput.call(void 0, {
4080
4775
  title: "Your answer:"
4081
4776
  });
4082
4777
  const finalAnswer = answer || "No answer provided";
@@ -4086,6 +4781,32 @@ Searching skills: "${query}"${action.category ? ` [${action.category}]` : ""}...
4086
4781
  return `<answer>${finalAnswer}</answer>`;
4087
4782
  }
4088
4783
  }
4784
+ // Code review tool
4785
+ // Directory access tool
4786
+ case "request_directory_access": {
4787
+ return this.executeRequestDirectoryAccess(action);
4788
+ }
4789
+ case "code_review": {
4790
+ return this.executeCodeReview(action);
4791
+ }
4792
+ // Browser tools — forwarded to Chrome extension via RPC
4793
+ case "browser_screenshot":
4794
+ case "browser_click":
4795
+ case "browser_type":
4796
+ case "browser_navigate":
4797
+ case "browser_scroll":
4798
+ case "browser_find_element":
4799
+ case "browser_press_key":
4800
+ case "browser_get_page_context":
4801
+ case "browser_get_element":
4802
+ case "browser_wait_for_element":
4803
+ case "browser_read_network":
4804
+ case "browser_read_console":
4805
+ case "browser_get_tabs":
4806
+ case "browser_get_tab_groups":
4807
+ case "browser_execute_js": {
4808
+ return this.executeBrowserTool(action);
4809
+ }
4089
4810
  default: {
4090
4811
  const actionType = action.type;
4091
4812
  const metaTool = this.toolsRegistry.getMetaTool(actionType);
@@ -4096,6 +4817,145 @@ Searching skills: "${query}"${action.category ? ` [${action.category}]` : ""}...
4096
4817
  }
4097
4818
  }
4098
4819
  }
4820
+ async executeBrowserTool(action) {
4821
+ const { type, ...params } = action;
4822
+ const toolName = type;
4823
+ const { invokeBrowserTool } = await Promise.resolve().then(() => _interopRequireWildcard(require("./browserToolBridge-BXRQB4B4.cjs")));
4824
+ return invokeBrowserTool(toolName, params);
4825
+ }
4826
+ async executeRequestDirectoryAccess(action) {
4827
+ const path8 = await Promise.resolve().then(() => _interopRequireWildcard(require("path")));
4828
+ const fs7 = (await Promise.resolve().then(() => _interopRequireWildcard(require("fs-extra")))).default;
4829
+ const { checkWorkspaceSafety } = await Promise.resolve().then(() => _interopRequireWildcard(require("./workspaceSafety-MDJGHK6D.cjs")));
4830
+ const resolvedPath = path8.resolve(action.path);
4831
+ if (!await fs7.pathExists(resolvedPath)) {
4832
+ return `Error: Directory does not exist: ${resolvedPath}`;
4833
+ }
4834
+ const stats = await fs7.stat(resolvedPath);
4835
+ if (!stats.isDirectory()) {
4836
+ return `Error: Path is not a directory: ${resolvedPath}`;
4837
+ }
4838
+ const safetyResult = checkWorkspaceSafety(resolvedPath);
4839
+ if (!safetyResult.safe) {
4840
+ return `Error: Unsafe directory: ${resolvedPath}. ${safetyResult.reason}`;
4841
+ }
4842
+ const workspaceRoot = this.runtime.workspaceRoot;
4843
+ const additionalDirs = this.files.getAllowedDirectories();
4844
+ if (resolvedPath === workspaceRoot || additionalDirs.includes(resolvedPath)) {
4845
+ return `Directory is already accessible: ${resolvedPath}`;
4846
+ }
4847
+ const normalizedResolved = resolvedPath.endsWith(path8.sep) ? resolvedPath.slice(0, -1) : resolvedPath;
4848
+ const normalizedWorkspace = workspaceRoot.endsWith(path8.sep) ? workspaceRoot.slice(0, -1) : workspaceRoot;
4849
+ if (normalizedResolved.startsWith(normalizedWorkspace + path8.sep)) {
4850
+ return `Directory is already within workspace: ${resolvedPath}`;
4851
+ }
4852
+ for (const dir of additionalDirs) {
4853
+ const normalizedDir = dir.endsWith(path8.sep) ? dir.slice(0, -1) : dir;
4854
+ if (normalizedResolved.startsWith(normalizedDir + path8.sep) || normalizedResolved === normalizedDir) {
4855
+ return `Directory is already accessible: ${resolvedPath}`;
4856
+ }
4857
+ }
4858
+ if (this.onRequestDirectoryAccess) {
4859
+ const result = await this.onRequestDirectoryAccess(resolvedPath, action.reason);
4860
+ if (result) {
4861
+ this.files.addAdditionalDirectory(resolvedPath);
4862
+ return `Access granted to directory: ${resolvedPath}
4863
+
4864
+ You can now use file tools (read_file, write_file, glob, find, etc.) to work with files in this directory.`;
4865
+ } else {
4866
+ return `Access denied to directory: ${resolvedPath}`;
4867
+ }
4868
+ }
4869
+ const normalizedYolo = _chunkJ5HE6CUMcjs.normalizeYoloInput.call(void 0, this.runtime.options.yolo);
4870
+ if (normalizedYolo) {
4871
+ this.files.addAdditionalDirectory(resolvedPath);
4872
+ return `Access auto-granted (yolo mode) to directory: ${resolvedPath}
4873
+
4874
+ You can now use file tools (read_file, write_file, glob, find, etc.) to work with files in this directory.`;
4875
+ }
4876
+ if (this.runtime.options.unrestricted || this.runtime.options.yes) {
4877
+ this.files.addAdditionalDirectory(resolvedPath);
4878
+ return `Access auto-granted to directory: ${resolvedPath}
4879
+
4880
+ You can now use file tools (read_file, write_file, glob, find, etc.) to work with files in this directory.`;
4881
+ }
4882
+ return `Directory access required: ${resolvedPath}
4883
+
4884
+ To grant access, use:
4885
+ /add-dir ${resolvedPath}
4886
+
4887
+ Or restart with:
4888
+ --add-dir ${resolvedPath}`;
4889
+ }
4890
+ async executeCodeReview(action) {
4891
+ const targetPath = action.path ? this.resolveWorkspacePath(action.path) : this.runtime.workspaceRoot;
4892
+ const scope = action.scope || "full";
4893
+ await _optionalChain([this, 'access', _90 => _90.onReviewHook, 'optionalCall', _91 => _91("review:start", {
4894
+ reviewPath: targetPath,
4895
+ reviewScope: scope,
4896
+ reviewInstructions: action.instructions
4897
+ })]);
4898
+ try {
4899
+ let context = "";
4900
+ if (scope === "diff") {
4901
+ const { execFile: execFile2 } = await Promise.resolve().then(() => _interopRequireWildcard(require("child_process")));
4902
+ const { promisify } = await Promise.resolve().then(() => _interopRequireWildcard(require("util")));
4903
+ const execFileAsync = promisify(execFile2);
4904
+ const result2 = await execFileAsync("git", ["diff", "--stat"], {
4905
+ cwd: this.runtime.workspaceRoot,
4906
+ encoding: "utf8"
4907
+ }).catch(() => null);
4908
+ context = _optionalChain([result2, 'optionalAccess', _92 => _92.stdout]) || "No uncommitted changes found.";
4909
+ } else if (scope === "file" && action.path) {
4910
+ const fse = (await Promise.resolve().then(() => _interopRequireWildcard(require("fs-extra")))).default;
4911
+ context = await fse.readFile(targetPath, "utf-8").catch(() => `Could not read ${targetPath}`);
4912
+ } else {
4913
+ const { execFile: execFile2 } = await Promise.resolve().then(() => _interopRequireWildcard(require("child_process")));
4914
+ const { promisify } = await Promise.resolve().then(() => _interopRequireWildcard(require("util")));
4915
+ const execFileAsync = promisify(execFile2);
4916
+ const tree = await execFileAsync("find", [
4917
+ targetPath,
4918
+ "-maxdepth",
4919
+ "3",
4920
+ "-type",
4921
+ "f",
4922
+ "-not",
4923
+ "-path",
4924
+ "*/node_modules/*",
4925
+ "-not",
4926
+ "-path",
4927
+ "*/.git/*"
4928
+ ], {
4929
+ cwd: this.runtime.workspaceRoot,
4930
+ encoding: "utf8"
4931
+ }).catch(() => null);
4932
+ context = _optionalChain([tree, 'optionalAccess', _93 => _93.stdout]) || "";
4933
+ }
4934
+ const result = [
4935
+ `Code review initiated for: ${targetPath}`,
4936
+ `Scope: ${scope}`,
4937
+ action.instructions ? `Focus: ${action.instructions}` : "",
4938
+ "",
4939
+ "Project structure:",
4940
+ context.slice(0, 5e3)
4941
+ ].filter(Boolean).join("\n");
4942
+ await _optionalChain([this, 'access', _94 => _94.onReviewHook, 'optionalCall', _95 => _95("review:completed", {
4943
+ reviewPath: targetPath,
4944
+ reviewScope: scope,
4945
+ reviewInstructions: action.instructions
4946
+ })]);
4947
+ return result;
4948
+ } catch (error) {
4949
+ const message = error instanceof Error ? error.message : String(error);
4950
+ await _optionalChain([this, 'access', _96 => _96.onReviewHook, 'optionalCall', _97 => _97("review:failed", {
4951
+ reviewPath: targetPath,
4952
+ reviewScope: scope,
4953
+ reviewInstructions: action.instructions,
4954
+ reviewError: message
4955
+ })]);
4956
+ return `Review failed: ${message}`;
4957
+ }
4958
+ }
4099
4959
  pickText(...values) {
4100
4960
  for (const value of values) {
4101
4961
  if (typeof value === "string") {
@@ -4109,7 +4969,7 @@ Searching skills: "${query}"${action.category ? ` [${action.category}]` : ""}...
4109
4969
  * Identifies imports, classes, functions, and key sections with line numbers.
4110
4970
  */
4111
4971
  extractFileOutline(lines, filePath) {
4112
- const ext = _optionalChain([filePath, 'access', _62 => _62.split, 'call', _63 => _63("."), 'access', _64 => _64.pop, 'call', _65 => _65(), 'optionalAccess', _66 => _66.toLowerCase, 'call', _67 => _67()]) || "";
4972
+ const ext = _optionalChain([filePath, 'access', _98 => _98.split, 'call', _99 => _99("."), 'access', _100 => _100.pop, 'call', _101 => _101(), 'optionalAccess', _102 => _102.toLowerCase, 'call', _103 => _103()]) || "";
4113
4973
  const outline = [];
4114
4974
  const patterns = {
4115
4975
  ts: [
@@ -4192,11 +5052,127 @@ Searching skills: "${query}"${action.category ? ` [${action.category}]` : ""}...
4192
5052
  }
4193
5053
  return result.length > 0 ? result.join("\n") : "No structure detected";
4194
5054
  }
5055
+ executeFind(action) {
5056
+ console.warn(_chalk2.default.yellow("[DEPRECATED] The `find` tool is deprecated. Use `fff_grep` instead. Will be removed in v0.9.0."));
5057
+ const mode = _nullishCoalesce(action.mode, () => ( (action.context && action.context > 0 ? "context" : "exact")));
5058
+ const cacheKey = `find:${mode}:${action.query}:${action.path || ""}:${action.limit || ""}:${action.context || ""}:${action.window || ""}`;
5059
+ if (this.searchCache.has(cacheKey)) {
5060
+ return `[Cached] ${this.searchCache.get(cacheKey)}`;
5061
+ }
5062
+ this.recordExploration("search", action.query);
5063
+ if (mode === "semantic") {
5064
+ const results = this.files.semanticSearch(action.query, {
5065
+ limit: action.limit,
5066
+ window: action.window,
5067
+ relativePath: action.path
5068
+ });
5069
+ if (!results.length) {
5070
+ this.searchCache.set(cacheKey, "No matches found.");
5071
+ return "No matches found.";
5072
+ }
5073
+ const result2 = results.map((hit) => `${_chalk2.default.cyan(hit.file)}
5074
+ ${hit.snippet}`).join("\n\n");
5075
+ this.searchCache.set(cacheKey, result2);
5076
+ return result2;
5077
+ }
5078
+ if (mode === "context") {
5079
+ const result2 = this.files.searchWithContext(action.query, {
5080
+ limit: action.limit,
5081
+ context: action.context,
5082
+ relativePath: action.path
5083
+ });
5084
+ this.searchCache.set(cacheKey, result2);
5085
+ return result2;
5086
+ }
5087
+ const hits = this.files.search(action.query, action.path);
5088
+ const result = hits.slice(0, _nullishCoalesce(action.limit, () => ( 10))).map((hit) => `${hit.file}:${hit.line}: ${hit.text}`).join("\n");
5089
+ this.searchCache.set(cacheKey, result);
5090
+ return result;
5091
+ }
5092
+ async executeGlob(action) {
5093
+ console.warn(_chalk2.default.yellow("[DEPRECATED] The `glob` tool is deprecated. Use `fff_find` instead. Will be removed in v0.9.0."));
5094
+ const { resolveRipgrepCommand } = await Promise.resolve().then(() => _interopRequireWildcard(require("./ripgrep-67SCU2BA.cjs")));
5095
+ const rgPath = resolveRipgrepCommand();
5096
+ const searchPath = action.path ? this.resolveWorkspacePath(action.path) : this.runtime.workspaceRoot;
5097
+ const limit = _nullishCoalesce(action.limit, () => ( 100));
5098
+ const args = ["--files"];
5099
+ const patterns = _nullishCoalesce(action.patterns, () => ( (action.pattern ? [action.pattern] : ["**/*"])));
5100
+ for (const p of patterns) {
5101
+ args.push("--glob", p);
5102
+ }
5103
+ args.push(searchPath);
5104
+ const { execFile: execFile2 } = await Promise.resolve().then(() => _interopRequireWildcard(require("child_process")));
5105
+ const { promisify } = await Promise.resolve().then(() => _interopRequireWildcard(require("util")));
5106
+ const execFileAsync = promisify(execFile2);
5107
+ try {
5108
+ const result = await execFileAsync(rgPath, args, {
5109
+ cwd: this.runtime.workspaceRoot,
5110
+ encoding: "utf8",
5111
+ maxBuffer: 10 * 1024 * 1024
5112
+ });
5113
+ const files = result.stdout.trim().split("\n").filter(Boolean);
5114
+ if (files.length === 0) {
5115
+ return "No files found matching the pattern.";
5116
+ }
5117
+ const fse = (await Promise.resolve().then(() => _interopRequireWildcard(require("fs-extra")))).default;
5118
+ const withStats = await Promise.all(
5119
+ files.map(async (f) => {
5120
+ try {
5121
+ const stat = await fse.stat(f);
5122
+ return { file: f, mtime: stat.mtimeMs };
5123
+ } catch (e8) {
5124
+ return { file: f, mtime: 0 };
5125
+ }
5126
+ })
5127
+ );
5128
+ withStats.sort((a, b) => b.mtime - a.mtime);
5129
+ const sorted = withStats.map((s) => s.file);
5130
+ const limited = sorted.slice(0, limit);
5131
+ const header = `Found ${files.length} file${files.length === 1 ? "" : "s"}${files.length > limit ? ` (showing first ${limit})` : ""}`;
5132
+ this.recordExploration("list", _nullishCoalesce(_nullishCoalesce(action.pattern, () => ( _optionalChain([action, 'access', _104 => _104.patterns, 'optionalAccess', _105 => _105.join, 'call', _106 => _106(", ")]))), () => ( "*")));
5133
+ return `${header}
5134
+ ${limited.join("\n")}`;
5135
+ } catch (error) {
5136
+ const exitCode = _optionalChain([error, 'optionalAccess', _107 => _107.code]);
5137
+ if (exitCode === 1 || exitCode === "1") {
5138
+ return "No files found matching the pattern.";
5139
+ }
5140
+ throw error;
5141
+ }
5142
+ }
5143
+ async executeFFFGrep(action) {
5144
+ const provider = await this.getFFFSearchProvider();
5145
+ try {
5146
+ return await provider.grep({
5147
+ query: action.query,
5148
+ path: action.path,
5149
+ exclude: action.exclude,
5150
+ caseSensitive: action.caseSensitive,
5151
+ beforeContext: action.beforeContext,
5152
+ afterContext: action.afterContext,
5153
+ classifyDefinitions: action.classifyDefinitions,
5154
+ limit: action.limit
5155
+ });
5156
+ } finally {
5157
+ this.scheduleFFFSearchProviderCleanup();
5158
+ }
5159
+ }
5160
+ async executeFFFFind(action) {
5161
+ const provider = await this.getFFFSearchProvider();
5162
+ try {
5163
+ return await provider.fileSearch({
5164
+ query: action.query,
5165
+ limit: action.limit
5166
+ });
5167
+ } finally {
5168
+ this.scheduleFFFSearchProviderCleanup();
5169
+ }
5170
+ }
4195
5171
  recordExploration(kind, target) {
4196
5172
  if (!target) {
4197
5173
  return;
4198
5174
  }
4199
- _optionalChain([this, 'access', _68 => _68.logExploration, 'optionalCall', _69 => _69({ kind, target })]);
5175
+ _optionalChain([this, 'access', _108 => _108.logExploration, 'optionalCall', _109 => _109({ kind, target })]);
4200
5176
  }
4201
5177
  async executeCustomCommand(action) {
4202
5178
  const existing = await loadCustomCommand(action.name);
@@ -4226,19 +5202,13 @@ Searching skills: "${query}"${action.category ? ` [${action.category}]` : ""}...
4226
5202
  }
4227
5203
  await saveCustomCommand(definition);
4228
5204
  }
4229
- const result = await runCommand(definition.command, _nullishCoalesce(definition.args, () => ( [])), this.runtime.workspaceRoot);
5205
+ const result = await _chunkWTB7AFL6cjs.runCommand.call(void 0, definition.command, _nullishCoalesce(definition.args, () => ( [])), this.runtime.workspaceRoot);
4230
5206
  return [`$ ${definition.command} ${(_nullishCoalesce(definition.args, () => ( []))).join(" ")}`, result.stdout, result.stderr].filter(Boolean).join("\n");
4231
5207
  }
4232
5208
  isDestructiveCommand(command) {
4233
5209
  const lowered = command.toLowerCase();
4234
5210
  return lowered.includes("rm ") || lowered.includes("sudo ") || lowered.includes("dd ");
4235
5211
  }
4236
- static {
4237
- /**
4238
- * Shell metacharacters that could enable command injection
4239
- */
4240
- this.SHELL_METACHARACTERS = /[|;&$`><(){}[\]!#*?~'"\\]/;
4241
- }
4242
5212
  /**
4243
5213
  * Safely escape a value for shell interpolation
4244
5214
  * Uses single quotes which prevent all shell expansion except for single quotes themselves
@@ -4259,21 +5229,62 @@ Searching skills: "${query}"${action.category ? ` [${action.category}]` : ""}...
4259
5229
  if (value === void 0 || value === null) {
4260
5230
  throw new Error(`Missing required parameter "${paramName}" for meta-tool "${metaTool.name}"`);
4261
5231
  }
4262
- const stringValue = String(value);
4263
- let safeValue;
4264
- if (_ActionExecutor.SHELL_METACHARACTERS.test(stringValue)) {
4265
- safeValue = this.shellEscape(stringValue);
4266
- console.log(_chalk2.default.yellow(` \u26A0 Parameter "${paramName}" contains shell metacharacters, escaped for safety`));
4267
- } else {
4268
- safeValue = stringValue;
4269
- }
5232
+ const safeValue = this.shellEscape(String(value));
5233
+ command = command.replace(new RegExp(`(["'])\\{\\{${paramName}\\}\\}\\1`, "g"), safeValue);
4270
5234
  command = command.replace(new RegExp(`\\{\\{${paramName}\\}\\}`, "g"), safeValue);
4271
5235
  }
4272
5236
  console.log(_chalk2.default.cyan(`
4273
5237
  \u{1F527} Running meta-tool: ${metaTool.name}`));
4274
5238
  console.log(_chalk2.default.gray(` $ ${command}`));
4275
- const result = await runCommand(command, [], this.runtime.workspaceRoot, { shell: true });
4276
- return [`$ ${command}`, result.stdout, result.stderr].filter(Boolean).join("\n");
5239
+ const permissionContext = {
5240
+ tool: "run_command",
5241
+ command,
5242
+ description: `Meta-tool ${metaTool.name}: ${metaTool.description}`
5243
+ };
5244
+ const decision = this.permissionManager.checkPermission(permissionContext);
5245
+ if (decision.reason === "blacklisted" || decision.reason === "mode_restricted" || decision.reason === "pattern_denied" || decision.reason === "not_in_available" || decision.reason === "excluded" || decision.reason === "deny_list" || decision.reason === "session_deny_list" || decision.reason === "project_deny_list" || decision.reason === "user_deny_list") {
5246
+ return `Blocked: Cannot run meta-tool ${metaTool.name} (${decision.reason})`;
5247
+ }
5248
+ if (!decision.allowed) {
5249
+ const hookResult = await this.checkPermissionHook({
5250
+ tool: "run_command",
5251
+ command,
5252
+ args
5253
+ });
5254
+ if (hookResult.blocked) {
5255
+ return `Blocked: ${hookResult.reason}`;
5256
+ }
5257
+ if (hookResult.allowed !== void 0) {
5258
+ await this.permissionManager.recordDecision(permissionContext, hookResult.allowed);
5259
+ if (!hookResult.allowed) {
5260
+ return `Denied: ${_nullishCoalesce(hookResult.reason, () => ( `meta-tool ${metaTool.name}`))}`;
5261
+ }
5262
+ } else {
5263
+ const confirmed = await this.confirmDangerousAction(
5264
+ `Run meta-tool ${metaTool.name}?`,
5265
+ { tool: "run_command", command }
5266
+ );
5267
+ await this.permissionManager.recordDecision(permissionContext, confirmed);
5268
+ if (!confirmed) {
5269
+ return `Skipped running meta-tool ${metaTool.name}`;
5270
+ }
5271
+ }
5272
+ }
5273
+ const result = await _chunkWTB7AFL6cjs.runCommand.call(void 0, command, [], this.runtime.workspaceRoot, {
5274
+ shell: true,
5275
+ timeout: 12e4
5276
+ });
5277
+ const stdout = this.truncateMetaToolOutput(result.stdout);
5278
+ const stderr = this.truncateMetaToolOutput(result.stderr);
5279
+ return [`$ ${command}`, stdout, stderr].filter(Boolean).join("\n");
5280
+ }
5281
+ truncateMetaToolOutput(output) {
5282
+ const limit = 2e5;
5283
+ if (output.length <= limit) {
5284
+ return output;
5285
+ }
5286
+ return `${output.slice(0, limit)}
5287
+ [meta-tool output truncated at ${limit} characters]`;
4277
5288
  }
4278
5289
  applySearchReplaceBlocks(content, blocks) {
4279
5290
  let result = content;
@@ -4368,17 +5379,17 @@ Searching skills: "${query}"${action.category ? ` [${action.category}]` : ""}...
4368
5379
  score += 2;
4369
5380
  }
4370
5381
  if (score > 0 && (!bestMatch || score > bestMatch.score)) {
4371
- bestMatch = { line: line.trim(), score };
5382
+ bestMatch = { line: line.trim(), originalLine: line, score };
4372
5383
  }
4373
5384
  }
4374
- return bestMatch && bestMatch.score >= 2 ? bestMatch.line : null;
5385
+ return bestMatch && bestMatch.score >= 2 ? bestMatch.originalLine : null;
4375
5386
  }
4376
5387
  /**
4377
5388
  * Colorize raw git diff output with green for additions and red for removals
4378
5389
  */
4379
5390
  colorizeGitDiff(diffOutput) {
4380
- const useTheme = _chunkU55TWFJIcjs.isThemeInitialized.call(void 0, );
4381
- const theme = useTheme ? _chunkU55TWFJIcjs.getTheme.call(void 0, ) : null;
5391
+ const useTheme = _chunk2VHB43IXcjs.isThemeInitialized.call(void 0, );
5392
+ const theme = useTheme ? _chunk2VHB43IXcjs.getTheme.call(void 0, ) : null;
4382
5393
  if (!diffOutput || diffOutput === "No diff") {
4383
5394
  return theme ? theme.fg("muted", "No changes") : _chalk2.default.gray("No changes");
4384
5395
  }
@@ -4387,12 +5398,12 @@ Searching skills: "${query}"${action.category ? ` [${action.category}]` : ""}...
4387
5398
  const colorizedLines = [];
4388
5399
  let additions = 0;
4389
5400
  let deletions = 0;
4390
- const addedColor = _optionalChain([theme, 'optionalAccess', _70 => _70.getColor, 'call', _71 => _71("diffAdded")]) || "#4caf50";
4391
- const removedColor = _optionalChain([theme, 'optionalAccess', _72 => _72.getColor, 'call', _73 => _73("diffRemoved")]) || "#f44336";
4392
- const contextColor = _optionalChain([theme, 'optionalAccess', _74 => _74.getColor, 'call', _75 => _75("diffContext")]) || "#9e9e9e";
4393
- const accentColor = _optionalChain([theme, 'optionalAccess', _76 => _76.getColor, 'call', _77 => _77("accent")]) || "#00bcd4";
4394
- const addedRgb = _chunkU55TWFJIcjs.hexToRgb.call(void 0, addedColor);
4395
- const removedRgb = _chunkU55TWFJIcjs.hexToRgb.call(void 0, removedColor);
5401
+ const addedColor = _optionalChain([theme, 'optionalAccess', _110 => _110.getColor, 'call', _111 => _111("diffAdded")]) || "#4caf50";
5402
+ const removedColor = _optionalChain([theme, 'optionalAccess', _112 => _112.getColor, 'call', _113 => _113("diffRemoved")]) || "#f44336";
5403
+ const contextColor = _optionalChain([theme, 'optionalAccess', _114 => _114.getColor, 'call', _115 => _115("diffContext")]) || "#9e9e9e";
5404
+ const accentColor = _optionalChain([theme, 'optionalAccess', _116 => _116.getColor, 'call', _117 => _117("accent")]) || "#00bcd4";
5405
+ const addedRgb = _chunk2VHB43IXcjs.hexToRgb.call(void 0, addedColor);
5406
+ const removedRgb = _chunk2VHB43IXcjs.hexToRgb.call(void 0, removedColor);
4396
5407
  const addBgR = addedRgb ? Math.floor(addedRgb.r * 0.15) : 30;
4397
5408
  const addBgG = addedRgb ? Math.floor(addedRgb.g * 0.2) : 50;
4398
5409
  const addBgB = addedRgb ? Math.floor(addedRgb.b * 0.15) : 30;
@@ -4457,12 +5468,16 @@ Searching skills: "${query}"${action.category ? ` [${action.category}]` : ""}...
4457
5468
  }
4458
5469
  }
4459
5470
  showDiff(oldContent, newContent, filePath) {
5471
+ console.log(this.formatDiffPreview(oldContent, newContent, filePath));
5472
+ console.log();
5473
+ }
5474
+ formatDiffPreview(oldContent, newContent, filePath) {
4460
5475
  const diff = _diff.diffLines.call(void 0, oldContent, newContent);
4461
5476
  const contextLines = 3;
4462
5477
  const lang = filePath ? detectLanguage(filePath) : "text";
4463
5478
  const shouldHighlight = lang !== "text";
4464
- const useTheme = _chunkU55TWFJIcjs.isThemeInitialized.call(void 0, );
4465
- const theme = useTheme ? _chunkU55TWFJIcjs.getTheme.call(void 0, ) : null;
5479
+ const useTheme = _chunk2VHB43IXcjs.isThemeInitialized.call(void 0, );
5480
+ const theme = useTheme ? _chunk2VHB43IXcjs.getTheme.call(void 0, ) : null;
4466
5481
  let additions = 0;
4467
5482
  let deletions = 0;
4468
5483
  for (const part of diff) {
@@ -4473,10 +5488,11 @@ Searching skills: "${query}"${action.category ? ` [${action.category}]` : ""}...
4473
5488
  const termWidth = process.stdout.columns || 100;
4474
5489
  const addText = additions === 1 ? "1 line" : `${additions} lines`;
4475
5490
  const delText = deletions === 1 ? "1 line" : `${deletions} lines`;
5491
+ const outputLines = [];
4476
5492
  if (theme) {
4477
- console.log(theme.fg("muted", ` Added ${theme.fg("diffAdded", addText)}, removed ${theme.fg("diffRemoved", delText)}`));
5493
+ outputLines.push(theme.fg("muted", ` Added ${theme.fg("diffAdded", addText)}, removed ${theme.fg("diffRemoved", delText)}`));
4478
5494
  } else {
4479
- console.log(_chalk2.default.gray(` Added ${_chalk2.default.green(addText)}, removed ${_chalk2.default.red(delText)}`));
5495
+ outputLines.push(_chalk2.default.gray(` Added ${_chalk2.default.green(addText)}, removed ${_chalk2.default.red(delText)}`));
4480
5496
  }
4481
5497
  const hunks = [];
4482
5498
  let currentHunk = null;
@@ -4559,48 +5575,49 @@ Searching skills: "${query}"${action.category ? ` [${action.category}]` : ""}...
4559
5575
  const removedColor = theme.getColor("diffRemoved");
4560
5576
  const contextColor = theme.getColor("diffContext");
4561
5577
  if (change.type === "add") {
4562
- const addedRgb = _chunkU55TWFJIcjs.hexToRgb.call(void 0, addedColor);
5578
+ const addedRgb = _chunk2VHB43IXcjs.hexToRgb.call(void 0, addedColor);
4563
5579
  const bgR = addedRgb ? Math.floor(addedRgb.r * 0.15) : 30;
4564
5580
  const bgG = addedRgb ? Math.floor(addedRgb.g * 0.2) : 50;
4565
5581
  const bgB = addedRgb ? Math.floor(addedRgb.b * 0.15) : 30;
4566
5582
  const prefix = _chalk2.default.bgHex(addedColor).black(` ${lineNumStr} + `);
4567
5583
  const content = _chalk2.default.bgRgb(bgR, bgG, bgB)(` ${highlighted} `.padEnd(Math.max(termWidth - 10, change.line.length + 2)));
4568
- console.log(prefix + content);
5584
+ outputLines.push(prefix + content);
4569
5585
  } else if (change.type === "remove") {
4570
- const removedRgb = _chunkU55TWFJIcjs.hexToRgb.call(void 0, removedColor);
5586
+ const removedRgb = _chunk2VHB43IXcjs.hexToRgb.call(void 0, removedColor);
4571
5587
  const bgR = removedRgb ? Math.floor(removedRgb.r * 0.25) : 60;
4572
5588
  const bgG = removedRgb ? Math.floor(removedRgb.g * 0.15) : 30;
4573
5589
  const bgB = removedRgb ? Math.floor(removedRgb.b * 0.15) : 30;
4574
5590
  const prefix = _chalk2.default.bgHex(removedColor).white(` ${lineNumStr} - `);
4575
5591
  const content = _chalk2.default.bgRgb(bgR, bgG, bgB)(` ${highlighted} `.padEnd(Math.max(termWidth - 10, change.line.length + 2)));
4576
- console.log(prefix + content);
5592
+ outputLines.push(prefix + content);
4577
5593
  } else {
4578
- console.log(_chalk2.default.hex(contextColor)(` ${lineNumStr} `) + ` ${highlighted}`);
5594
+ outputLines.push(_chalk2.default.hex(contextColor)(` ${lineNumStr} `) + ` ${highlighted}`);
4579
5595
  }
4580
5596
  } else {
4581
5597
  if (change.type === "add") {
4582
5598
  const prefix = _chalk2.default.bgGreen.black(` ${lineNumStr} + `);
4583
5599
  const content = _chalk2.default.bgRgb(30, 50, 30)(` ${highlighted} `.padEnd(Math.max(termWidth - 10, change.line.length + 2)));
4584
- console.log(prefix + content);
5600
+ outputLines.push(prefix + content);
4585
5601
  } else if (change.type === "remove") {
4586
5602
  const prefix = _chalk2.default.bgRed.white(` ${lineNumStr} - `);
4587
5603
  const content = _chalk2.default.bgRgb(60, 30, 30)(` ${highlighted} `.padEnd(Math.max(termWidth - 10, change.line.length + 2)));
4588
- console.log(prefix + content);
5604
+ outputLines.push(prefix + content);
4589
5605
  } else {
4590
- console.log(_chalk2.default.gray(` ${lineNumStr} `) + ` ${highlighted}`);
5606
+ outputLines.push(_chalk2.default.gray(` ${lineNumStr} `) + ` ${highlighted}`);
4591
5607
  }
4592
5608
  }
4593
5609
  }
4594
5610
  }
4595
- console.log();
5611
+ return outputLines.join("\n");
4596
5612
  }
4597
- };
5613
+ }, _class3.__initStatic(), _class3);
5614
+
4598
5615
 
4599
5616
 
4600
5617
 
4601
5618
 
4602
5619
 
4603
- exports.getAutoCommitInfo = getAutoCommitInfo; exports.ToolsRegistry = ToolsRegistry; exports.ActionExecutor = ActionExecutor;
5620
+ exports.getAutoCommitInfo = getAutoCommitInfo; exports.WorktreeManager = WorktreeManager; exports.createToolsRegistry = createToolsRegistry; exports.ActionExecutor = ActionExecutor;
4604
5621
  /**
4605
5622
  * @license
4606
5623
  * Copyright 2025 Autohand AI LLC