autohand-cli 0.8.3 → 0.9.1

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 (546) hide show
  1. package/README.md +191 -74
  2. package/dist/{AgentRegistry-ODDXPAFR.js → AgentRegistry-GOV7FN2O.js} +2 -2
  3. package/dist/AgentRegistry-J2C6JBZ3.cjs +10 -0
  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-22BB3J6H.cjs +8 -0
  7. package/dist/{CommunitySkillsCache-QLE57BN5.js → CommunitySkillsCache-ZACDPD4J.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-2S6AHOC3.js} +1 -1
  11. package/dist/{HookManager-PFAFE3FK.cjs → HookManager-TVEQI5ZU.cjs} +2 -2
  12. package/dist/{ImportWizard-OHRKBANZ.js → ImportWizard-AEBMAKXE.js} +33 -9
  13. package/dist/{ImportWizard-CJRZPPHL.cjs → ImportWizard-AF2XL6DS.cjs} +37 -13
  14. package/dist/LearnAdvisor-KKEQ5QCV.js +9 -0
  15. package/dist/LearnAdvisor-Q7RAYLPF.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-PMNAEZMB.cjs +8 -0
  19. package/dist/{MemoryManager-2LAT7IHS.js → MemoryManager-QZRLTUB5.js} +2 -2
  20. package/dist/NVIDIAProvider-C3FWQOBZ.cjs +14 -0
  21. package/dist/NVIDIAProvider-SJPY3ONR.js +14 -0
  22. package/dist/{PermissionManager-7NQHRCHY.js → PermissionManager-MT7KBNNR.js} +3 -3
  23. package/dist/PermissionManager-URCNP5EC.cjs +11 -0
  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-56N3ECE4.cjs +12 -0
  27. package/dist/{ProviderFactory-2IYJ5OPW.js → ProviderFactory-RB4RVAF6.js} +4 -1
  28. package/dist/SessionManager-2IZGWASQ.cjs +10 -0
  29. package/dist/{SessionManager-4U4JFQ3C.js → SessionManager-554PHVPC.js} +2 -2
  30. package/dist/SkillsRegistry-GMRVONOQ.cjs +9 -0
  31. package/dist/{SkillsRegistry-RFEINXRT.js → SkillsRegistry-NHHMIUYJ.js} +2 -2
  32. package/dist/SubAgent-4GOR2FIJ.js +13 -0
  33. package/dist/SubAgent-ZJMDH4FI.cjs +13 -0
  34. package/dist/{SyncApiClient-B5RT2ECG.js → SyncApiClient-G3FM65IV.js} +1 -1
  35. package/dist/SyncApiClient-ODBDECOG.cjs +11 -0
  36. package/dist/about-3USFSGOH.js +15 -0
  37. package/dist/about-QR52U5DD.cjs +15 -0
  38. package/dist/acp-5Y2W6OZP.js +1556 -0
  39. package/dist/acp-GSYE75OB.cjs +1556 -0
  40. package/dist/actionExecutor-KHUU3Z3Q.cjs +28 -0
  41. package/dist/actionExecutor-PLQJZLZV.js +28 -0
  42. package/dist/add-dir-BTAD5OZS.cjs +11 -0
  43. package/dist/{add-dir-TUJM3PG5.js → add-dir-HCERJDBR.js} +3 -2
  44. package/dist/agent-B3EVT7NN.cjs +126 -0
  45. package/dist/agent-SATQ3WZ3.js +126 -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-44CRJGM7.cjs +18 -0
  53. package/dist/agents-NN4ZAJ7R.js +18 -0
  54. package/dist/agents-new-6D6G4QS6.cjs +17 -0
  55. package/dist/agents-new-7GAQ25EK.js +17 -0
  56. package/dist/{autoSkill-LQEVQFIH.js → autoSkill-66PKCYTW.js} +2 -2
  57. package/dist/autoSkill-VQLGBELN.cjs +20 -0
  58. package/dist/automode-45DWV4TN.cjs +10 -0
  59. package/dist/{automode-R6P3VHLS.js → automode-BUF3VGXU.js} +2 -2
  60. package/dist/browserToolBridge-BXRQB4B4.cjs +58 -0
  61. package/dist/browserToolBridge-F5N66PE7.js +58 -0
  62. package/dist/chrome-Q2U73HZB.cjs +50 -0
  63. package/dist/chrome-Q54OALOK.cjs +21 -0
  64. package/dist/chrome-Y3T7EIHG.js +50 -0
  65. package/dist/chrome-ZNJ46OYW.js +21 -0
  66. package/dist/chromeSkill-53TH55PM.js +105 -0
  67. package/dist/chromeSkill-THW7N4IY.cjs +105 -0
  68. package/dist/{chunk-HXGBSJL5.cjs → chunk-22SCR3EV.cjs} +2 -2
  69. package/dist/chunk-26G7YGOW.js +367 -0
  70. package/dist/{chunk-3L53OA4E.cjs → chunk-2ESQR35E.cjs} +10 -10
  71. package/dist/chunk-2H5O745H.js +63 -0
  72. package/dist/{chunk-ULDM2SNB.js → chunk-2IW5YFJ4.js} +48 -47
  73. package/dist/{chunk-U55TWFJI.cjs → chunk-2VHB43IX.cjs} +24 -6
  74. package/dist/chunk-3EDDDZS2.cjs +5 -0
  75. package/dist/{chunk-X5VSP65C.cjs → chunk-3ICORF7M.cjs} +4 -4
  76. package/dist/chunk-3OF56EMA.cjs +197 -0
  77. package/dist/chunk-3UC6DMFI.cjs +93 -0
  78. package/dist/{chunk-64H4FRM3.cjs → chunk-3UHRCHKB.cjs} +32 -34
  79. package/dist/{chunk-JCLYQ2JC.js → chunk-3ZOOH44N.js} +12 -6
  80. package/dist/{chunk-TUD3Z3BD.js → chunk-44ZWOBTI.js} +136 -55
  81. package/dist/chunk-4567QNRB.js +444 -0
  82. package/dist/chunk-45CHNQM6.cjs +517 -0
  83. package/dist/chunk-46MTALKD.js +44 -0
  84. package/dist/{chunk-WHE2SWHU.js → chunk-4E7SHPNQ.js} +2 -2
  85. package/dist/chunk-4LMUDS2K.js +124 -0
  86. package/dist/{chunk-W7RYQJLO.cjs → chunk-4XFHP2SN.cjs} +46 -15
  87. package/dist/chunk-4XVLNOFA.js +360 -0
  88. package/dist/{chunk-GBHDROGL.js → chunk-575PXZX7.js} +16 -4
  89. package/dist/chunk-5A7ZL64N.js +139 -0
  90. package/dist/chunk-5GCQ5UMV.cjs +85 -0
  91. package/dist/chunk-5JTTM5SC.js +59 -0
  92. package/dist/{chunk-IETRBBMP.cjs → chunk-5K3CDSWZ.cjs} +108 -31
  93. package/dist/{chunk-KLWJIPU2.cjs → chunk-5SFV2NCY.cjs} +20 -16
  94. package/dist/chunk-5ZNYX4VH.cjs +71 -0
  95. package/dist/{chunk-A4IJHHV7.cjs → chunk-63ANVAOJ.cjs} +52 -11
  96. package/dist/{chunk-MYISNQH4.js → chunk-65LRPW5W.js} +1 -1
  97. package/dist/chunk-6AYJCDTA.js +360 -0
  98. package/dist/{chunk-X2MSVKDV.js → chunk-6HF6XSCC.js} +2 -2
  99. package/dist/{chunk-AEJH23FO.cjs → chunk-6JWCGQJU.cjs} +6 -6
  100. package/dist/chunk-6OECOAK5.cjs +360 -0
  101. package/dist/chunk-6R25D2H5.js +121 -0
  102. package/dist/chunk-7DJJGKM6.js +77 -0
  103. package/dist/{chunk-VG34MG2U.js → chunk-7IRQ7JEH.js} +9 -6
  104. package/dist/chunk-7MY4JHER.js +27 -0
  105. package/dist/chunk-7PJKTSRN.js +152 -0
  106. package/dist/{chunk-SKYG33B2.cjs → chunk-7PT646AL.cjs} +3 -3
  107. package/dist/chunk-7WAUCLLQ.js +229 -0
  108. package/dist/{chunk-U46VYPLR.cjs → chunk-7XTUL7ZD.cjs} +9 -9
  109. package/dist/chunk-AE2ILW25.cjs +152 -0
  110. package/dist/{chunk-T2M64VHA.cjs → chunk-AOKXYGBQ.cjs} +61 -41
  111. package/dist/chunk-AQ5PVHOC.cjs +113 -0
  112. package/dist/{chunk-N2BLVUPM.cjs → chunk-AZ47LKD5.cjs} +3 -3
  113. package/dist/chunk-B4HSNOIH.cjs +354 -0
  114. package/dist/chunk-B76FJKEJ.cjs +184 -0
  115. package/dist/chunk-BP37FVBM.js +85 -0
  116. package/dist/chunk-BQU3HAE7.js +21 -0
  117. package/dist/chunk-BYE7RQFZ.cjs +121 -0
  118. package/dist/chunk-C46B72VK.js +1034 -0
  119. package/dist/{chunk-HIVRCQS2.js → chunk-C5QIQQ37.js} +56 -25
  120. package/dist/chunk-CCIDL4SA.js +19931 -0
  121. package/dist/{chunk-XVUHNWMX.js → chunk-CECH6QQP.js} +17 -19
  122. package/dist/chunk-CFAWTLSC.js +13 -0
  123. package/dist/{chunk-ZYQMLKOK.cjs → chunk-CK4HAHVY.cjs} +212 -70
  124. package/dist/chunk-CO2AADYU.cjs +360 -0
  125. package/dist/chunk-CRTCZ4WL.cjs +19931 -0
  126. package/dist/chunk-CSTUTDTH.js +75 -0
  127. package/dist/{chunk-K2C56QGS.cjs → chunk-D546G7DA.cjs} +1650 -479
  128. package/dist/{chunk-CNBKZEX5.cjs → chunk-DA7NBAJK.cjs} +49 -17
  129. package/dist/{chunk-G4CAKI3V.js → chunk-DGBPWODD.js} +7 -2
  130. package/dist/chunk-DHUQZ53B.cjs +29 -0
  131. package/dist/{chunk-RGR6ME5J.cjs → chunk-DI57A4BX.cjs} +25 -28
  132. package/dist/{chunk-5K6NGAVM.js → chunk-DNSD7DVJ.js} +67 -52
  133. package/dist/{chunk-RDF37HKB.cjs → chunk-DSSCERHI.cjs} +3 -2
  134. package/dist/{chunk-NAJ4IZKD.cjs → chunk-EA2MS25U.cjs} +8 -6
  135. package/dist/{chunk-SJAVBCOA.js → chunk-EEHWALXA.js} +94 -3
  136. package/dist/chunk-ES2HJQ4N.js +37 -0
  137. package/dist/{chunk-G27PQQFD.js → chunk-EYHKL4QC.js} +1 -1
  138. package/dist/{chunk-SV2WA57F.js → chunk-FBQJZKFX.js} +38 -15
  139. package/dist/chunk-FFBDRUO5.cjs +59 -0
  140. package/dist/{chunk-N7LI55V4.js → chunk-FFHSCM5M.js} +15 -8
  141. package/dist/{chunk-SAHBLB3E.js → chunk-FP46B4X3.js} +208 -3
  142. package/dist/chunk-FQVG6ZHF.js +197 -0
  143. package/dist/{chunk-J2GSFVUV.cjs → chunk-GAOPJ5S3.cjs} +74 -59
  144. package/dist/{chunk-S52YW5ZQ.js → chunk-GNBBIAMD.js} +16 -19
  145. package/dist/chunk-GSDV75A5.js +715 -0
  146. package/dist/chunk-GWY26SUD.cjs +63 -0
  147. package/dist/{chunk-TUAITHWL.js → chunk-H426KOGY.js} +2 -1
  148. package/dist/{chunk-EZMINVLU.js → chunk-H4D2Q2AL.js} +5 -2
  149. package/dist/chunk-HC2Q6A3E.cjs +4967 -0
  150. package/dist/{chunk-3WVJEL7K.cjs → chunk-HDK2EHVH.cjs} +3 -1
  151. package/dist/{chunk-5IXII4HX.cjs → chunk-HG3ZASBH.cjs} +23 -16
  152. package/dist/chunk-HK5A54AV.cjs +280 -0
  153. package/dist/{chunk-LQGVEP3E.js → chunk-HQUSEWT4.js} +45 -13
  154. package/dist/chunk-HSWWM6AM.js +2340 -0
  155. package/dist/chunk-HTU4W3GB.js +183 -0
  156. package/dist/{chunk-HLHTG5ZU.cjs → chunk-HVCIB4SW.cjs} +14 -12
  157. package/dist/chunk-HXHE2KAO.js +385 -0
  158. package/dist/{chunk-LJFUXC56.cjs → chunk-HXQREVTA.cjs} +9 -6
  159. package/dist/{chunk-SLQAYV3W.js → chunk-HZWU6IO3.js} +11 -2
  160. package/dist/chunk-I2ZK3AOD.js +866 -0
  161. package/dist/chunk-IEPLQ47J.js +719 -0
  162. package/dist/chunk-J5HE6CUM.cjs +124 -0
  163. package/dist/{chunk-LIEXWM2M.js → chunk-JAQO6XDB.js} +19 -1
  164. package/dist/chunk-JB3JCYBJ.js +113 -0
  165. package/dist/chunk-JCUHCH37.cjs +247 -0
  166. package/dist/{chunk-FPHU2ES6.cjs → chunk-JM3ZTQUK.cjs} +19 -9
  167. package/dist/{chunk-NDMIPTV4.js → chunk-JMJRFSNJ.js} +8 -3
  168. package/dist/{chunk-ZLSGXMGQ.js → chunk-JMN3GZU6.js} +2 -0
  169. package/dist/chunk-JPFRI4L4.js +4967 -0
  170. package/dist/{chunk-BVKXEQVG.cjs → chunk-JV5HVCHU.cjs} +22 -10
  171. package/dist/chunk-KA2U6MY2.js +388 -0
  172. package/dist/{chunk-SEKD5FH3.cjs → chunk-KASXKDF2.cjs} +8 -3
  173. package/dist/chunk-KJ26T7GM.cjs +367 -0
  174. package/dist/chunk-KM7R5YPS.cjs +385 -0
  175. package/dist/{chunk-MBBY4ZIK.js → chunk-KMP6Y3LJ.js} +4 -1
  176. package/dist/chunk-KWXGDSYT.js +184 -0
  177. package/dist/{chunk-C5IJIM2V.cjs → chunk-L46OUKW5.cjs} +68 -37
  178. package/dist/{chunk-6UJMCWRY.js → chunk-L6OH44HL.js} +19 -9
  179. package/dist/chunk-LANGD5CO.js +280 -0
  180. package/dist/{chunk-APIXPPMT.js → chunk-LEZEWKPA.js} +1004 -39
  181. package/dist/{chunk-ULQ6MDSJ.cjs → chunk-LFDPTJYF.cjs} +43 -35
  182. package/dist/chunk-LJD7KR3L.cjs +44 -0
  183. package/dist/{chunk-NCC6ETZS.js → chunk-LUMV3DB2.js} +41 -33
  184. package/dist/{chunk-QXH5RCFI.js → chunk-M5DK524Z.js} +2 -2
  185. package/dist/chunk-M7B7RRBK.cjs +1034 -0
  186. package/dist/chunk-MANJ67D3.js +3897 -0
  187. package/dist/{chunk-HPHJ73GU.cjs → chunk-MGNXABSU.cjs} +9 -9
  188. package/dist/{chunk-6ZCULLCA.js → chunk-MMKZSJUN.js} +1 -1
  189. package/dist/{chunk-DVUHHH3B.cjs → chunk-MQQH4XQH.cjs} +4 -4
  190. package/dist/chunk-MUNUUFU7.cjs +21 -0
  191. package/dist/{chunk-DVZOENQ7.cjs → chunk-MZN6JBRZ.cjs} +9 -4
  192. package/dist/{chunk-OOKY3HPZ.js → chunk-NB6M6ESM.js} +50 -9
  193. package/dist/{chunk-BYONM7UM.js → chunk-NBGOIFKP.js} +265 -18
  194. package/dist/chunk-NHWHEW7M.cjs +75 -0
  195. package/dist/chunk-NQZH5CR2.cjs +468 -0
  196. package/dist/{chunk-EGPXJERY.cjs → chunk-NV6LCD2I.cjs} +119 -28
  197. package/dist/chunk-NVATU4V6.cjs +44 -0
  198. package/dist/{chunk-YZXUDM5X.js → chunk-NZ3ZWLUW.js} +204 -62
  199. package/dist/chunk-NZ7GCK7Y.cjs +92 -0
  200. package/dist/{chunk-VEKDGU2Q.cjs → chunk-NZQFKXM3.cjs} +49 -25
  201. package/dist/chunk-O5GI6SR3.js +59 -0
  202. package/dist/{chunk-56SWIDEL.cjs → chunk-OCATAKXV.cjs} +57 -56
  203. package/dist/{chunk-SKV2F3NM.js → chunk-OIGYWOL6.js} +1 -1
  204. package/dist/{chunk-IFFXSTOM.cjs → chunk-ONVYXTUT.cjs} +3 -3
  205. package/dist/chunk-OR67YXQK.cjs +13 -0
  206. package/dist/chunk-OV3T5MUH.cjs +715 -0
  207. package/dist/{chunk-OHUZKDGX.js → chunk-P4FUTSVK.js} +3 -3
  208. package/dist/chunk-P6SLT2F4.cjs +139 -0
  209. package/dist/{chunk-TNZRZQ7Q.js → chunk-PB7W7R72.js} +3 -78
  210. package/dist/chunk-PCM3N3CL.cjs +37 -0
  211. package/dist/{chunk-2AA5MFES.js → chunk-PGFLPURU.js} +8 -5
  212. package/dist/{chunk-DJDE4DTT.cjs → chunk-PIXQ2AVM.cjs} +25 -19
  213. package/dist/chunk-PNIAIOMZ.cjs +229 -0
  214. package/dist/{chunk-HTLINWX6.cjs → chunk-PQBYFEBL.cjs} +16 -13
  215. package/dist/{chunk-22D2CNTP.cjs → chunk-PSAH4ZQB.cjs} +5 -2
  216. package/dist/{chunk-3VTAFAL2.js → chunk-PTTZI4QZ.js} +16 -12
  217. package/dist/{chunk-WPVWQSL7.cjs → chunk-PY73W5MQ.cjs} +16 -13
  218. package/dist/{chunk-EGMZDTSL.js → chunk-PZZMIYII.js} +10 -2
  219. package/dist/{chunk-HBZU3RBZ.js → chunk-Q3BS6FPM.js} +34 -10
  220. package/dist/chunk-QBYGMMDD.js +517 -0
  221. package/dist/chunk-QLZOMZO5.cjs +388 -0
  222. package/dist/{chunk-ADUFCS4Q.cjs → chunk-QQ64HEHP.cjs} +160 -79
  223. package/dist/{chunk-L3TWPROA.js → chunk-QRQF3556.js} +44 -24
  224. package/dist/{chunk-YHD6TUIR.cjs → chunk-QW2RW2GY.cjs} +2 -0
  225. package/dist/chunk-RAKO7UN7.js +114 -0
  226. package/dist/{chunk-7TQH3CL4.cjs → chunk-RBXBH6EB.cjs} +78 -35
  227. package/dist/chunk-RFUKZIJF.cjs +78 -0
  228. package/dist/chunk-RS2E32YB.js +71 -0
  229. package/dist/{chunk-OLSBBZW6.cjs → chunk-S5JNQIGL.cjs} +5 -5
  230. package/dist/{chunk-FTYY5JJD.js → chunk-S5QKRA2V.js} +2 -2
  231. package/dist/chunk-SD3NTC7D.cjs +77 -0
  232. package/dist/{chunk-KPELYZ6L.js → chunk-SDLY4X3G.js} +2 -2
  233. package/dist/{chunk-IDFF5J2E.js → chunk-SFFEKZGC.js} +38 -7
  234. package/dist/{chunk-EGFT4PGW.js → chunk-SHRLFX6F.js} +8 -3
  235. package/dist/{chunk-3WICOC33.js → chunk-SNDDZG5H.js} +124 -84
  236. package/dist/{chunk-CZXGCVTR.cjs → chunk-SOVR7S3T.cjs} +2 -2
  237. package/dist/chunk-SPQ7QIQ6.js +78 -0
  238. package/dist/{chunk-XRZEUWKF.js → chunk-SRMGWMQO.js} +1 -1
  239. package/dist/{chunk-R33VKSH5.cjs → chunk-SVVP4UUZ.cjs} +11 -11
  240. package/dist/{chunk-7BTSG4ME.cjs → chunk-SY2P3Z5W.cjs} +1004 -39
  241. package/dist/chunk-SZD45IDG.js +468 -0
  242. package/dist/{chunk-3O3MOK5C.cjs → chunk-TE4SYTWR.cjs} +1114 -142
  243. package/dist/chunk-TH26BQJG.js +101 -0
  244. package/dist/{chunk-QNGEW5TC.js → chunk-TR6NECEZ.js} +1 -1
  245. package/dist/{chunk-YGN4CQIP.js → chunk-TYBPTKFT.js} +1 -1
  246. package/dist/{chunk-GJH7XMSK.js → chunk-U2QUMKCB.js} +8 -6
  247. package/dist/{chunk-47CKWKEX.cjs → chunk-U6PLSPMD.cjs} +9 -4
  248. package/dist/chunk-UOQECODR.js +34 -0
  249. package/dist/chunk-UR27UDTB.js +354 -0
  250. package/dist/chunk-UWZ4G3SQ.js +93 -0
  251. package/dist/{chunk-Y72HH2TF.cjs → chunk-V3SZLWEQ.cjs} +33 -24
  252. package/dist/chunk-V4HGZSKQ.cjs +183 -0
  253. package/dist/{chunk-3PDTTAKJ.js → chunk-V5ELP2XE.js} +19 -12
  254. package/dist/{chunk-3K2ESU53.cjs → chunk-VKOXFT4L.cjs} +2 -2
  255. package/dist/{chunk-XTB6VJVQ.cjs → chunk-VLGGMQUN.cjs} +6 -6
  256. package/dist/chunk-VQHSYAPZ.cjs +3897 -0
  257. package/dist/chunk-VUGOOGHB.js +400 -0
  258. package/dist/chunk-W5QLA6WP.cjs +866 -0
  259. package/dist/chunk-WBU4Q4GS.cjs +400 -0
  260. package/dist/{chunk-KWXVKLQ5.cjs → chunk-WGNMOVMT.cjs} +7 -82
  261. package/dist/chunk-WJYFLQ7G.cjs +27 -0
  262. package/dist/{chunk-RKJTGGMU.cjs → chunk-WKRDBCP2.cjs} +221 -16
  263. package/dist/{chunk-ZSPXQYG2.js → chunk-WNJXIACY.js} +7 -5
  264. package/dist/{chunk-AYS2ASM7.js → chunk-WPE2XHVX.js} +1 -1
  265. package/dist/chunk-WTB7AFL6.cjs +101 -0
  266. package/dist/{chunk-JYTDYJVW.js → chunk-X3TI5TJJ.js} +1 -1
  267. package/dist/chunk-X5P6QQOB.cjs +719 -0
  268. package/dist/{chunk-245KJE5Y.cjs → chunk-X7XMITIL.cjs} +14 -6
  269. package/dist/chunk-XF2WIKHR.cjs +34 -0
  270. package/dist/{chunk-DV2ZHK7B.cjs → chunk-XNIMSVS6.cjs} +49 -26
  271. package/dist/chunk-XW3XCK4E.cjs +59 -0
  272. package/dist/{chunk-N23UAW4I.js → chunk-XZVDYC5U.js} +7 -2
  273. package/dist/chunk-Y5BDE24P.cjs +444 -0
  274. package/dist/{chunk-NAGQ2PDC.js → chunk-YC5OBZQU.js} +1604 -433
  275. package/dist/chunk-YISPVAXO.cjs +2340 -0
  276. package/dist/{chunk-KQGPTCQJ.js → chunk-YQDI753V.js} +68 -25
  277. package/dist/{chunk-UJ2JSM6H.js → chunk-YVQI26H4.js} +2 -0
  278. package/dist/{chunk-NNPAM4HC.cjs → chunk-YWH55BWK.cjs} +15 -6
  279. package/dist/{chunk-X2YOZQIP.cjs → chunk-YWTIXHU6.cjs} +266 -19
  280. package/dist/{chunk-XX2ZO7DS.js → chunk-YXM6SA7P.js} +25 -16
  281. package/dist/chunk-YZWE7XSM.js +5 -0
  282. package/dist/chunk-ZASDSY7P.cjs +114 -0
  283. package/dist/{chunk-2UC22DJU.js → chunk-ZNGRLCFQ.js} +30 -4
  284. package/dist/{chunk-KANW6OYC.cjs → chunk-ZNYZB7XY.cjs} +34 -8
  285. package/dist/{chunk-NA6WQDYW.js → chunk-ZPLCAXJW.js} +1088 -116
  286. package/dist/{chunk-7UOUW76C.js → chunk-ZQAT5VT5.js} +101 -24
  287. package/dist/chunk-ZUYYHKQA.js +44 -0
  288. package/dist/clear-QJXU25IF.cjs +12 -0
  289. package/dist/{clear-A3N4GK2S.js → clear-Y5TO3RZA.js} +3 -3
  290. package/dist/communityInstaller-LXMVKVAV.cjs +22 -0
  291. package/dist/{communityInstaller-LOP2EDH5.js → communityInstaller-RVL4STPS.js} +8 -5
  292. package/dist/completion-JX4T2ONW.cjs +17 -0
  293. package/dist/completion-SE3XYG74.js +17 -0
  294. package/dist/config-3224PRW4.cjs +21 -0
  295. package/dist/{config-HPJPKTO6.js → config-7KPHKFTP.js} +7 -4
  296. package/dist/{constants-LISJW3DD.js → constants-EJFAWJQI.js} +1 -1
  297. package/dist/constants-MCCGUU5F.cjs +21 -0
  298. package/dist/{defaultHooks-IHSJR2AX.cjs → defaultHooks-2V2CQL63.cjs} +25 -10
  299. package/dist/{defaultHooks-KUKHK3AG.js → defaultHooks-TMHDU3FS.js} +25 -10
  300. package/dist/export-BJVIDZC4.js +15 -0
  301. package/dist/export-KU4557HK.cjs +15 -0
  302. package/dist/feature-K3LG5IJP.cjs +14 -0
  303. package/dist/feature-V4JF5TNJ.js +14 -0
  304. package/dist/features-5OJTLKS7.js +23 -0
  305. package/dist/features-VCBJQXCX.cjs +23 -0
  306. package/dist/feedback-D4437VE4.js +18 -0
  307. package/dist/feedback-VZPEHGFY.cjs +18 -0
  308. package/dist/fffSearchProvider-2YCNKOYD.js +412 -0
  309. package/dist/fffSearchProvider-W6627E2V.cjs +412 -0
  310. package/dist/{filesystem-Z7BWAWMZ.js → filesystem-L6DQKGWK.js} +3 -2
  311. package/dist/filesystem-PGUPCMVK.cjs +11 -0
  312. package/dist/go-X4E6BCD6.js +12 -0
  313. package/dist/go-XREVFS5I.cjs +12 -0
  314. package/dist/goal-4M3J6JS2.cjs +16 -0
  315. package/dist/goal-EI66BV7W.js +16 -0
  316. package/dist/help-GGFS7WHY.cjs +12 -0
  317. package/dist/{help-GFQXNZOK.js → help-MLIROWKM.js} +2 -2
  318. package/dist/{history-E3N6BJP7.js → history-GQJ6RZD6.js} +2 -2
  319. package/dist/history-J4LUIOSI.cjs +14 -0
  320. package/dist/hooks-FSRIUS6A.cjs +18 -0
  321. package/dist/hooks-PPFHCF7T.js +18 -0
  322. package/dist/i18n-CI6VFXL5.cjs +33 -0
  323. package/dist/{i18n-SY7QRM22.js → i18n-Q7UZJRPL.js} +1 -1
  324. package/dist/ide-BUSVE54P.js +15 -0
  325. package/dist/ide-YR27BPGM.cjs +15 -0
  326. package/dist/immediateCommandRouter-MTEHZXQX.js +15 -0
  327. package/dist/immediateCommandRouter-ROXU3MWT.cjs +15 -0
  328. package/dist/{import-W7SVLSTC.js → import-3VBKI6BN.js} +3 -3
  329. package/dist/{import-ADI37ZUR.cjs → import-C7S6UJMW.cjs} +3 -3
  330. package/dist/import-DBK4OCDF.cjs +10 -0
  331. package/dist/{import-KGKKZ3B7.js → import-U47DXCA7.js} +2 -2
  332. package/dist/index.cjs +837 -23011
  333. package/dist/index.d.cts +95 -0
  334. package/dist/index.d.ts +95 -0
  335. package/dist/index.js +864 -23038
  336. package/dist/init-OXTYS72D.cjs +10 -0
  337. package/dist/{init-7MFK626E.js → init-Q2O4R42R.js} +2 -2
  338. package/dist/inkMode-VUE6ZDLD.cjs +7 -0
  339. package/dist/inkMode-WBNFOSAT.js +7 -0
  340. package/dist/inputPrompt-3CFZDUBH.js +90 -0
  341. package/dist/inputPrompt-JMACL4EB.cjs +90 -0
  342. package/dist/language-EK3M6UBV.cjs +22 -0
  343. package/dist/language-Q3RUGGOW.js +22 -0
  344. package/dist/learn-3DSX7DYG.cjs +23 -0
  345. package/dist/learn-OPOH5L43.js +23 -0
  346. package/dist/login-GST7MWXJ.cjs +27 -0
  347. package/dist/login-Q7DZKAX4.js +27 -0
  348. package/dist/logout-2G7OUK7I.cjs +24 -0
  349. package/dist/logout-FNBBL2UI.js +24 -0
  350. package/dist/mcp-AH3MMUBU.js +21 -0
  351. package/dist/mcp-DW7R63IB.cjs +21 -0
  352. package/dist/{mcp-install-2FEROZTL.js → mcp-install-222PCKSW.js} +18 -10
  353. package/dist/{mcp-install-WM6BQRI5.cjs → mcp-install-IA4ZS2SV.cjs} +22 -14
  354. package/dist/memory-6NX3DAIY.cjs +10 -0
  355. package/dist/{memory-J73WZH2I.js → memory-VB46T5H3.js} +2 -2
  356. package/dist/model-64NAELFS.cjs +10 -0
  357. package/dist/{model-AES267IN.js → model-SJJG64AM.js} +2 -2
  358. package/dist/new-DU5SOOOY.cjs +12 -0
  359. package/dist/{new-5CLF3MKH.js → new-ERZ5C6CN.js} +3 -3
  360. package/dist/onboarding-2U2BV2KE.cjs +36 -0
  361. package/dist/onboarding-ZQXMPSMJ.js +36 -0
  362. package/dist/permissions-7ACNFK7A.js +10 -0
  363. package/dist/permissions-GSNNV7RJ.cjs +10 -0
  364. package/dist/plan-XEJMOT55.cjs +13 -0
  365. package/dist/{plan-65HMS5HQ.js → plan-YYUAXPTL.js} +3 -1
  366. package/dist/pr-review-CW6J7P62.cjs +9 -0
  367. package/dist/pr-review-YZSBQVT2.js +9 -0
  368. package/dist/{quit-XDZYRSPU.js → quit-WY6T267G.js} +2 -2
  369. package/dist/quit-XIRE2KRE.cjs +10 -0
  370. package/dist/rawMode-6W5AXAKI.cjs +7 -0
  371. package/dist/rawMode-GFNLXQPU.js +7 -0
  372. package/dist/{registry-PTHWERKC.js → registry-4DXUDKJN.js} +29 -44
  373. package/dist/{registry-IVT4G2RT.cjs → registry-UEO3ETZ7.cjs} +65 -80
  374. package/dist/repeat-P4FAPE3Y.cjs +17 -0
  375. package/dist/{repeat-EVCWUL6Z.js → repeat-RALE6AUO.js} +7 -3
  376. package/dist/resume-RQZ3WXBP.cjs +17 -0
  377. package/dist/resume-XSXZMDMD.js +17 -0
  378. package/dist/review-QHP2KP4Q.js +9 -0
  379. package/dist/review-UWHWQHCB.cjs +9 -0
  380. package/dist/ripgrep-67SCU2BA.cjs +9 -0
  381. package/dist/ripgrep-VHJQQ55W.js +9 -0
  382. package/dist/rpc-XH7QLN4H.js +3874 -0
  383. package/dist/rpc-YF54T7JU.cjs +3874 -0
  384. package/dist/search-VXXFGZWU.cjs +21 -0
  385. package/dist/search-YAWGX7P7.js +21 -0
  386. package/dist/{sessions-6GWEBMKS.js → sessions-NJYHJOEL.js} +2 -2
  387. package/dist/sessions-OSG3UJEZ.cjs +10 -0
  388. package/dist/settings-SO2UIGWV.cjs +42 -0
  389. package/dist/settings-ZXUQH3DO.js +42 -0
  390. package/dist/setup-KG7EGKF5.js +30 -0
  391. package/dist/setup-RSOPCQ57.cjs +30 -0
  392. package/dist/share-WFAGZ5PY.js +17 -0
  393. package/dist/share-ZU3SGACF.cjs +17 -0
  394. package/dist/skills-KBVAQAD2.cjs +29 -0
  395. package/dist/skills-NBTNDVAY.js +29 -0
  396. package/dist/{skills-ZZCIAS7C.js → skills-OB6RDW7D.js} +10 -7
  397. package/dist/{skills-PG542VEB.cjs → skills-ZROBG3RZ.cjs} +13 -10
  398. package/dist/{skills-install-SRC3Z2MS.js → skills-install-BHTIEMKH.js} +21 -70
  399. package/dist/{skills-install-67DOBPJC.cjs → skills-install-ILX6QVEF.cjs} +34 -83
  400. package/dist/skills-new-B45VQ2PP.cjs +18 -0
  401. package/dist/skills-new-YMRP2HNO.js +18 -0
  402. package/dist/slashCommands-53VYIBJU.js +105 -0
  403. package/dist/slashCommands-BG2RGGZ6.cjs +105 -0
  404. package/dist/status-CQ2IUOVK.cjs +24 -0
  405. package/dist/status-E7IGNVPC.js +24 -0
  406. package/dist/summarizer-DGPHE5IQ.js +17 -0
  407. package/dist/summarizer-JNXLUAQG.cjs +17 -0
  408. package/dist/sync-7C25MOT2.js +22 -0
  409. package/dist/{sync-VU2NSJ4O.js → sync-OCJN4ZSO.js} +3 -3
  410. package/dist/sync-XRP46IVG.cjs +40 -0
  411. package/dist/sync-ZMFVE7T4.cjs +22 -0
  412. package/dist/{teammate-SXRVXNQV.cjs → teammate-D77B6QRT.cjs} +31 -9
  413. package/dist/{teammate-SD26GR37.js → teammate-EZCMHOIL.js} +30 -8
  414. package/dist/templates-ARG2VRWW.cjs +11 -0
  415. package/dist/templates-UGVZV3KJ.js +11 -0
  416. package/dist/theme-KKRDE6P7.cjs +22 -0
  417. package/dist/theme-XF7XIWBQ.js +22 -0
  418. package/dist/tools-3PPTTKFV.js +9 -0
  419. package/dist/tools-THIQA7WC.cjs +9 -0
  420. package/dist/ui/questionModal.cjs +8 -5
  421. package/dist/ui/questionModal.js +7 -4
  422. package/dist/{undo-OL2EDBRY.js → undo-GNUTFXCW.js} +2 -2
  423. package/dist/undo-U4KN7QQM.cjs +10 -0
  424. package/dist/usage-QSTNSDAO.js +24 -0
  425. package/dist/usage-YDEMQBNQ.cjs +24 -0
  426. package/dist/web-3BA2WV37.cjs +37 -0
  427. package/dist/web-6FYGBX5K.js +37 -0
  428. package/dist/workspaceSafety-MDJGHK6D.cjs +9 -0
  429. package/dist/workspaceSafety-XOUMUBVB.js +9 -0
  430. package/dist/yolo-GF2YD7ZI.js +9 -0
  431. package/dist/yolo-OGDA7HNC.cjs +9 -0
  432. package/dist/yoloMode-3DJDA75U.cjs +17 -0
  433. package/dist/yoloMode-4JOOSU26.js +17 -0
  434. package/package.json +51 -49
  435. package/dist/AgentRegistry-HRPN6ZOF.cjs +0 -10
  436. package/dist/CommunitySkillsCache-KE435RAR.cjs +0 -8
  437. package/dist/GitHubRegistryFetcher-I45SESIL.cjs +0 -7
  438. package/dist/LearnAdvisor-FLBA6FDD.js +0 -9
  439. package/dist/LearnAdvisor-GG3CXQF3.cjs +0 -9
  440. package/dist/MemoryManager-2LQPIYVE.cjs +0 -8
  441. package/dist/PermissionManager-X57BXHJ6.cjs +0 -11
  442. package/dist/ProviderFactory-KPJOGQWF.cjs +0 -9
  443. package/dist/SessionManager-YBJAZXNO.cjs +0 -10
  444. package/dist/SkillsRegistry-7O72A6TZ.cjs +0 -9
  445. package/dist/SubAgent-JT4HZHN7.js +0 -11
  446. package/dist/SubAgent-VPNYDWAU.cjs +0 -11
  447. package/dist/SyncApiClient-HQXJL5BT.cjs +0 -11
  448. package/dist/about-4DB5KTHW.js +0 -12
  449. package/dist/about-LXAOXZFT.cjs +0 -12
  450. package/dist/actionExecutor-23JB2WUC.js +0 -19
  451. package/dist/actionExecutor-X5UEZSKH.cjs +0 -19
  452. package/dist/add-dir-YC37DMSF.cjs +0 -10
  453. package/dist/agents-YF3BSUU5.js +0 -12
  454. package/dist/agents-ZOUHPMYR.cjs +0 -12
  455. package/dist/agents-new-HSH4GQPG.js +0 -14
  456. package/dist/agents-new-VYUDOCE7.cjs +0 -14
  457. package/dist/autoSkill-X5W52WOE.cjs +0 -20
  458. package/dist/automode-SJGM7VEI.cjs +0 -10
  459. package/dist/chunk-ALYU6VTM.js +0 -105
  460. package/dist/chunk-B53A2NM2.js +0 -2030
  461. package/dist/chunk-BJXSNT46.js +0 -100
  462. package/dist/chunk-CB4E2T5N.cjs +0 -312
  463. package/dist/chunk-DNUOXBHL.js +0 -539
  464. package/dist/chunk-EFX2QSZX.cjs +0 -33
  465. package/dist/chunk-GCXYXLRA.cjs +0 -111
  466. package/dist/chunk-H2ZRHQQV.js +0 -33
  467. package/dist/chunk-HNRPK5MY.cjs +0 -85
  468. package/dist/chunk-HVKOZ2VP.cjs +0 -115
  469. package/dist/chunk-JJLYWH5Y.cjs +0 -100
  470. package/dist/chunk-LWUJFGOZ.js +0 -115
  471. package/dist/chunk-MERYP6AM.cjs +0 -539
  472. package/dist/chunk-MZAPWNAC.cjs +0 -207
  473. package/dist/chunk-NTSDP2WB.js +0 -226
  474. package/dist/chunk-OUZQXMHL.cjs +0 -226
  475. package/dist/chunk-PGESAU2W.cjs +0 -2030
  476. package/dist/chunk-SYVYLZZF.cjs +0 -24
  477. package/dist/chunk-SZOLA6FR.js +0 -111
  478. package/dist/chunk-VWDHR4HV.js +0 -168
  479. package/dist/chunk-Y45G6ZO5.cjs +0 -168
  480. package/dist/chunk-YRLYSQEQ.cjs +0 -105
  481. package/dist/chunk-ZYVS43MU.js +0 -312
  482. package/dist/clear-GK4IEUUS.cjs +0 -12
  483. package/dist/communityInstaller-XXC7RLE4.cjs +0 -19
  484. package/dist/completion-HWABSAEL.js +0 -14
  485. package/dist/completion-IUUVQG4D.cjs +0 -14
  486. package/dist/config-HF7WOLZF.cjs +0 -18
  487. package/dist/constants-PEO3P2SJ.cjs +0 -21
  488. package/dist/export-QJAV2FCZ.js +0 -12
  489. package/dist/export-XSRFXGWU.cjs +0 -12
  490. package/dist/feedback-4TCIL3ML.cjs +0 -15
  491. package/dist/feedback-SJ6VVEY3.js +0 -15
  492. package/dist/filesystem-W56QZUJF.cjs +0 -10
  493. package/dist/help-ISBVQL3S.cjs +0 -12
  494. package/dist/history-XQ4GTSFU.cjs +0 -14
  495. package/dist/hooks-CJNKJ5PF.js +0 -13
  496. package/dist/hooks-UTMBTAXT.cjs +0 -13
  497. package/dist/i18n-N7QQ7A5M.cjs +0 -33
  498. package/dist/ide-RTA4UJV4.js +0 -12
  499. package/dist/ide-VWVOLIFF.cjs +0 -12
  500. package/dist/immediateCommandRouter-BW34JNXL.js +0 -9
  501. package/dist/immediateCommandRouter-SHOVNB5X.cjs +0 -9
  502. package/dist/import-ZLJVONXH.cjs +0 -10
  503. package/dist/init-TBKAB4LZ.cjs +0 -10
  504. package/dist/language-MDSHEXHB.cjs +0 -18
  505. package/dist/language-PXTQSHIG.js +0 -18
  506. package/dist/learn-623TW5EK.cjs +0 -20
  507. package/dist/learn-BCPV7GM2.js +0 -20
  508. package/dist/localProjectPermissions-BHQXEWZJ.cjs +0 -18
  509. package/dist/localProjectPermissions-GMOUYQM6.js +0 -18
  510. package/dist/login-QMVEETWJ.js +0 -20
  511. package/dist/login-QYMXAL3K.cjs +0 -20
  512. package/dist/logout-2CMTDAOJ.js +0 -18
  513. package/dist/logout-ZOHVZAUK.cjs +0 -18
  514. package/dist/mcp-IUVKK65S.js +0 -18
  515. package/dist/mcp-TXC7PYG3.cjs +0 -18
  516. package/dist/memory-WRIHDEPK.cjs +0 -10
  517. package/dist/model-RLP75SF5.cjs +0 -10
  518. package/dist/new-HLSFL6A4.cjs +0 -12
  519. package/dist/permissions-GP6FTGZ2.js +0 -13
  520. package/dist/permissions-O6EKKPOG.cjs +0 -13
  521. package/dist/plan-MCAXDIM2.cjs +0 -11
  522. package/dist/quit-TQX6GXA5.cjs +0 -10
  523. package/dist/repeat-BSPS5TWD.cjs +0 -13
  524. package/dist/resume-2GOPDLL4.cjs +0 -13
  525. package/dist/resume-37IUVDA6.js +0 -13
  526. package/dist/search-7KUSHIBL.cjs +0 -17
  527. package/dist/search-OJGDRIMA.js +0 -17
  528. package/dist/sessions-CYYCHSQG.cjs +0 -10
  529. package/dist/settings-2D7CAO66.cjs +0 -30
  530. package/dist/settings-BXR6SBJP.js +0 -30
  531. package/dist/share-BXQY5IQU.js +0 -14
  532. package/dist/share-OSFXZBGS.cjs +0 -14
  533. package/dist/skills-FL6O6AOM.cjs +0 -26
  534. package/dist/skills-PNKQZRNK.js +0 -26
  535. package/dist/skills-new-XFMEHHIF.cjs +0 -15
  536. package/dist/skills-new-ZNZPHUKS.js +0 -15
  537. package/dist/slashCommands-LLCNPK3X.js +0 -76
  538. package/dist/slashCommands-RXZZS6RE.cjs +0 -76
  539. package/dist/status-BCECUJXT.cjs +0 -11
  540. package/dist/status-EFO7MQU3.js +0 -11
  541. package/dist/sync-IJYJ6KKM.js +0 -18
  542. package/dist/sync-LFT6SBPF.cjs +0 -18
  543. package/dist/sync-U7SDPBNZ.cjs +0 -40
  544. package/dist/theme-AWBHSG7J.cjs +0 -18
  545. package/dist/theme-TQLBPJ2E.js +0 -18
  546. package/dist/undo-IBBGP7A2.cjs +0 -10
@@ -0,0 +1,1556 @@
1
+ import {
2
+ FileActionManager
3
+ } from "./chunk-ZQAT5VT5.js";
4
+ import {
5
+ AutohandAgent,
6
+ isLikelyFilePathSlashInput
7
+ } from "./chunk-CCIDL4SA.js";
8
+ import "./chunk-XAV24VYN.js";
9
+ import "./chunk-ZPLCAXJW.js";
10
+ import "./chunk-7IRQ7JEH.js";
11
+ import "./chunk-U2QUMKCB.js";
12
+ import "./chunk-GNBBIAMD.js";
13
+ import "./chunk-ZNGRLCFQ.js";
14
+ import "./chunk-SNDDZG5H.js";
15
+ import "./chunk-ES2HJQ4N.js";
16
+ import "./chunk-6R25D2H5.js";
17
+ import "./chunk-26G7YGOW.js";
18
+ import "./chunk-KWXGDSYT.js";
19
+ import "./chunk-S5QKRA2V.js";
20
+ import "./chunk-PGFLPURU.js";
21
+ import "./chunk-QEGOB6QV.js";
22
+ import "./chunk-M5DK524Z.js";
23
+ import "./chunk-JMN3GZU6.js";
24
+ import "./chunk-7PJKTSRN.js";
25
+ import "./chunk-5JTTM5SC.js";
26
+ import "./chunk-2H5O745H.js";
27
+ import "./chunk-BP37FVBM.js";
28
+ import "./chunk-FFHSCM5M.js";
29
+ import "./chunk-3ZOOH44N.js";
30
+ import "./chunk-WPE2XHVX.js";
31
+ import "./chunk-2IW5YFJ4.js";
32
+ import "./chunk-HBXAA3XB.js";
33
+ import "./chunk-3OEDGIFW.js";
34
+ import "./chunk-WNUVPKBW.js";
35
+ import "./chunk-RAKO7UN7.js";
36
+ import "./chunk-CECH6QQP.js";
37
+ import "./chunk-FBQJZKFX.js";
38
+ import "./chunk-NB6M6ESM.js";
39
+ import "./chunk-Q3BS6FPM.js";
40
+ import "./chunk-4XVLNOFA.js";
41
+ import "./chunk-DNSD7DVJ.js";
42
+ import "./chunk-SPQ7QIQ6.js";
43
+ import "./chunk-QBYGMMDD.js";
44
+ import "./chunk-O5GI6SR3.js";
45
+ import "./chunk-C5QIQQ37.js";
46
+ import "./chunk-44ZWOBTI.js";
47
+ import "./chunk-4E7SHPNQ.js";
48
+ import "./chunk-QHPFA6OE.js";
49
+ import "./chunk-H426KOGY.js";
50
+ import "./chunk-WNJXIACY.js";
51
+ import "./chunk-XZVDYC5U.js";
52
+ import "./chunk-DGBPWODD.js";
53
+ import {
54
+ ConversationManager
55
+ } from "./chunk-HQUSEWT4.js";
56
+ import "./chunk-TR6NECEZ.js";
57
+ import "./chunk-24QIWILL.js";
58
+ import "./chunk-2NUX2RAI.js";
59
+ import "./chunk-OIGYWOL6.js";
60
+ import "./chunk-SDLY4X3G.js";
61
+ import "./chunk-HXHE2KAO.js";
62
+ import "./chunk-65LRPW5W.js";
63
+ import "./chunk-YXM6SA7P.js";
64
+ import "./chunk-RS2E32YB.js";
65
+ import "./chunk-SRMGWMQO.js";
66
+ import "./chunk-SVLBJMYO.js";
67
+ import "./chunk-PZZMIYII.js";
68
+ import "./chunk-6HF6XSCC.js";
69
+ import "./chunk-EYHKL4QC.js";
70
+ import "./chunk-ZK6HOR62.js";
71
+ import "./chunk-P4FUTSVK.js";
72
+ import "./chunk-YC5OBZQU.js";
73
+ import "./chunk-H4D2Q2AL.js";
74
+ import "./chunk-SZD45IDG.js";
75
+ import "./chunk-W3X6PAC7.js";
76
+ import "./chunk-JMJRFSNJ.js";
77
+ import "./chunk-TSV4LVHK.js";
78
+ import "./chunk-SFFEKZGC.js";
79
+ import "./chunk-TYBPTKFT.js";
80
+ import "./chunk-UR27UDTB.js";
81
+ import "./chunk-CFAWTLSC.js";
82
+ import "./chunk-I2ZK3AOD.js";
83
+ import "./chunk-4LMUDS2K.js";
84
+ import "./chunk-HTU4W3GB.js";
85
+ import "./chunk-KMP6Y3LJ.js";
86
+ import "./chunk-YVQI26H4.js";
87
+ import "./chunk-HSWWM6AM.js";
88
+ import "./chunk-TH26BQJG.js";
89
+ import {
90
+ ProviderFactory
91
+ } from "./chunk-JPFRI4L4.js";
92
+ import "./chunk-MANJ67D3.js";
93
+ import "./chunk-VUGOOGHB.js";
94
+ import "./chunk-LUMV3DB2.js";
95
+ import "./chunk-BQU3HAE7.js";
96
+ import "./chunk-575PXZX7.js";
97
+ import {
98
+ isGoalFeatureEnabled
99
+ } from "./chunk-7MY4JHER.js";
100
+ import "./chunk-FP46B4X3.js";
101
+ import "./chunk-QRQF3556.js";
102
+ import "./chunk-V5ELP2XE.js";
103
+ import "./chunk-EEHWALXA.js";
104
+ import "./chunk-PTTZI4QZ.js";
105
+ import "./chunk-UWZ4G3SQ.js";
106
+ import "./chunk-ZUYYHKQA.js";
107
+ import "./chunk-46MTALKD.js";
108
+ import "./chunk-YQDI753V.js";
109
+ import "./chunk-MMKZSJUN.js";
110
+ import "./chunk-4567QNRB.js";
111
+ import {
112
+ installProcessErrorHandlers
113
+ } from "./chunk-7WAUCLLQ.js";
114
+ import {
115
+ validateWorkspacePath
116
+ } from "./chunk-KA2U6MY2.js";
117
+ import {
118
+ isSessionWorktreeEnabled,
119
+ prepareSessionWorktree
120
+ } from "./chunk-C46B72VK.js";
121
+ import "./chunk-WQ3VJXZB.js";
122
+ import "./chunk-GSDV75A5.js";
123
+ import "./chunk-6AYJCDTA.js";
124
+ import "./chunk-GLBAF54O.js";
125
+ import "./chunk-7DJJGKM6.js";
126
+ import {
127
+ package_default
128
+ } from "./chunk-JB3JCYBJ.js";
129
+ import {
130
+ ApiError,
131
+ classifyApiError
132
+ } from "./chunk-FQVG6ZHF.js";
133
+ import "./chunk-X3TI5TJJ.js";
134
+ import "./chunk-NZ3ZWLUW.js";
135
+ import "./chunk-HZWU6IO3.js";
136
+ import "./chunk-CSTUTDTH.js";
137
+ import {
138
+ loadConfig
139
+ } from "./chunk-IEPLQ47J.js";
140
+ import "./chunk-5A7ZL64N.js";
141
+ import "./chunk-YZWE7XSM.js";
142
+ import "./chunk-LANGD5CO.js";
143
+ import "./chunk-NBGOIFKP.js";
144
+ import "./chunk-JAQO6XDB.js";
145
+ import "./chunk-SHRLFX6F.js";
146
+ import "./chunk-UOQECODR.js";
147
+ import {
148
+ checkWorkspaceSafety
149
+ } from "./chunk-PB7W7R72.js";
150
+ import "./chunk-LEZEWKPA.js";
151
+ import "./chunk-L6OH44HL.js";
152
+ import "./chunk-QGM4M3NI.js";
153
+
154
+ // src/modes/acp/index.ts
155
+ import { Readable, Writable } from "stream";
156
+ import { AgentSideConnection, ndJsonStream } from "@agentclientprotocol/sdk";
157
+
158
+ // src/modes/acp/adapter.ts
159
+ import { PROTOCOL_VERSION, RequestError } from "@agentclientprotocol/sdk";
160
+
161
+ // src/modes/acp/types.ts
162
+ var ACP_HOOK_NOTIFICATIONS = {
163
+ HOOK_PRE_TOOL: "autohand.hook.preTool",
164
+ HOOK_POST_TOOL: "autohand.hook.postTool",
165
+ HOOK_FILE_MODIFIED: "autohand.hook.fileModified",
166
+ HOOK_PRE_PROMPT: "autohand.hook.prePrompt",
167
+ HOOK_POST_RESPONSE: "autohand.hook.postResponse",
168
+ HOOK_SESSION_ERROR: "autohand.hook.sessionError",
169
+ HOOK_STOP: "autohand.hook.stop",
170
+ HOOK_SESSION_START: "autohand.hook.sessionStart",
171
+ HOOK_SESSION_END: "autohand.hook.sessionEnd",
172
+ HOOK_SUBAGENT_STOP: "autohand.hook.subagentStop",
173
+ HOOK_PERMISSION_REQUEST: "autohand.hook.permissionRequest",
174
+ HOOK_NOTIFICATION: "autohand.hook.notification",
175
+ // Setup wizard notifications
176
+ SETUP_STARTED: "autohand.setup.started",
177
+ SETUP_STEP_START: "autohand.setup.stepStart",
178
+ SETUP_STEP_COMPLETE: "autohand.setup.stepComplete",
179
+ SETUP_CANCELLED: "autohand.setup.cancelled",
180
+ SETUP_ERROR: "autohand.setup.error",
181
+ SETUP_COMPLETE: "autohand.setup.complete"
182
+ };
183
+ var TOOL_KIND_MAP = {
184
+ // Read operations
185
+ read_file: "read",
186
+ list_tree: "read",
187
+ list_directory: "read",
188
+ file_stats: "read",
189
+ file_info: "read",
190
+ // Search operations
191
+ fff_grep: "search",
192
+ fff_find: "search",
193
+ find: "search",
194
+ web_search: "fetch",
195
+ web_repo: "fetch",
196
+ // Edit operations
197
+ write_file: "edit",
198
+ append_file: "edit",
199
+ apply_patch: "edit",
200
+ format_file: "edit",
201
+ replace_in_file: "edit",
202
+ search_replace: "edit",
203
+ create_directory: "edit",
204
+ copy_path: "edit",
205
+ // Move/delete operations
206
+ rename_path: "move",
207
+ delete_path: "delete",
208
+ // Execute operations
209
+ run_command: "execute",
210
+ custom_command: "execute",
211
+ git_status: "execute",
212
+ git_diff: "execute",
213
+ git_commit: "execute",
214
+ git_add: "execute",
215
+ git_init: "execute",
216
+ git_log: "execute",
217
+ git_list_untracked: "execute",
218
+ git_checkout: "execute",
219
+ git_branch: "execute",
220
+ // Dependencies
221
+ dependency_add: "execute",
222
+ dependency_remove: "execute",
223
+ dependency_update: "execute",
224
+ dependency_list: "read",
225
+ // Think/plan operations
226
+ todo_write: "think",
227
+ plan: "think",
228
+ smart_context_cropper: "think",
229
+ thinking: "think",
230
+ // Memory/other operations
231
+ save_memory: "other",
232
+ recall_memory: "other",
233
+ tools_registry: "other",
234
+ tool_search: "other",
235
+ get_goal: "think",
236
+ create_goal: "think",
237
+ create_goal_from_template: "think",
238
+ update_goal: "think",
239
+ clear_goal: "think",
240
+ list_goal_templates: "read",
241
+ enqueue_goal: "think",
242
+ list_goal_queue: "read",
243
+ start_queued_goal: "think",
244
+ dequeue_goal: "think",
245
+ remove_queued_goal: "think",
246
+ skill: "other",
247
+ sleep: "other",
248
+ project_info: "read",
249
+ workspace_info: "read"
250
+ // MCP tools (prefixed with mcp__)
251
+ // These are dynamically matched via resolveToolKind()
252
+ };
253
+ var TOOL_DISPLAY_NAMES = {
254
+ // Read operations
255
+ read_file: "Read",
256
+ list_tree: "List",
257
+ tool_search: "Search tools",
258
+ skill: "Skill",
259
+ sleep: "Wait",
260
+ list_directory: "List",
261
+ file_stats: "Stats",
262
+ file_info: "Info",
263
+ // Search operations
264
+ fff_grep: "Search",
265
+ fff_find: "Find files",
266
+ find: "Search",
267
+ search: "Search",
268
+ search_files: "Search",
269
+ search_with_context: "Search",
270
+ semantic_search: "Search",
271
+ web_search: "Web Search",
272
+ web_repo: "Web Repo",
273
+ // Edit operations
274
+ write_file: "Write",
275
+ append_file: "Append",
276
+ apply_patch: "Patch",
277
+ notebook_edit: "Notebook",
278
+ format_file: "Format",
279
+ replace_in_file: "Replace",
280
+ search_replace: "Replace",
281
+ create_directory: "Create",
282
+ copy_path: "Copy",
283
+ // Move/delete operations
284
+ rename_path: "Rename",
285
+ delete_path: "Delete",
286
+ // Execute operations
287
+ run_command: "Run",
288
+ custom_command: "Custom",
289
+ git_status: "Git Status",
290
+ git_diff: "Git Diff",
291
+ git_commit: "Git Commit",
292
+ git_add: "Git Add",
293
+ git_init: "Git Init",
294
+ git_log: "Git Log",
295
+ git_list_untracked: "Git Untracked",
296
+ git_checkout: "Git Checkout",
297
+ git_branch: "Git Branch",
298
+ // Dependencies
299
+ dependency_add: "Add Dep",
300
+ dependency_remove: "Remove Dep",
301
+ dependency_update: "Update Dep",
302
+ dependency_list: "List Deps",
303
+ // Think/plan operations
304
+ todo_write: "Todo",
305
+ plan: "Plan",
306
+ smart_context_cropper: "Thinking",
307
+ thinking: "Thinking",
308
+ // Memory/other
309
+ save_memory: "Save Memory",
310
+ recall_memory: "Recall Memory",
311
+ tools_registry: "Tools",
312
+ get_goal: "Get Goal",
313
+ create_goal: "Create Goal",
314
+ create_goal_from_template: "Goal Template",
315
+ update_goal: "Update Goal",
316
+ clear_goal: "Clear Goal",
317
+ list_goal_templates: "Goal Templates",
318
+ enqueue_goal: "Queue Goal",
319
+ list_goal_queue: "Goal Queue",
320
+ start_queued_goal: "Start Queued Goal",
321
+ dequeue_goal: "Dequeue Goal",
322
+ remove_queued_goal: "Remove Queued Goal",
323
+ project_info: "Project Info",
324
+ workspace_info: "Workspace Info"
325
+ };
326
+ function resolveToolKind(toolName) {
327
+ if (toolName in TOOL_KIND_MAP) {
328
+ return TOOL_KIND_MAP[toolName];
329
+ }
330
+ if (toolName.startsWith("mcp__")) {
331
+ return "execute";
332
+ }
333
+ return "other";
334
+ }
335
+ function resolveToolDisplayName(toolName) {
336
+ if (toolName in TOOL_DISPLAY_NAMES) {
337
+ return TOOL_DISPLAY_NAMES[toolName];
338
+ }
339
+ if (toolName.startsWith("mcp__")) {
340
+ const parts = toolName.split("__");
341
+ if (parts.length >= 3) {
342
+ return `MCP: ${parts[1]}/${parts.slice(2).join("/")}`;
343
+ }
344
+ }
345
+ return toolName.split("_").map((w) => w.charAt(0).toUpperCase() + w.slice(1)).join(" ");
346
+ }
347
+ var DEFAULT_ACP_COMMANDS = [
348
+ { name: "help", description: "Show available commands" },
349
+ { name: "new", description: "Start a new conversation" },
350
+ { name: "model", description: "Select or change the model" },
351
+ { name: "resume", description: "Resume a previous session" },
352
+ { name: "sessions", description: "List recent sessions" },
353
+ { name: "session", description: "Show current session info" },
354
+ { name: "status", description: "Show Autohand status" },
355
+ { name: "undo", description: "Undo the last file change" },
356
+ { name: "init", description: "Create AGENTS.md file" },
357
+ { name: "memory", description: "Manage conversation memory" },
358
+ { name: "skills", description: "List available skills" },
359
+ { name: "export", description: "Export conversation" },
360
+ { name: "permissions", description: "Manage tool permissions" },
361
+ { name: "feedback", description: "Send feedback to Autohand" },
362
+ { name: "agents", description: "List available agents" },
363
+ { name: "hooks", description: "Manage lifecycle hooks" },
364
+ { name: "automode", description: "Toggle autonomous agent loop" },
365
+ { name: "add-dir", description: "Add additional working directory" },
366
+ { name: "share", description: "Share session transcript" },
367
+ { name: "formatters", description: "Manage code formatters" },
368
+ { name: "lint", description: "Run code linting" },
369
+ { name: "mcp", description: "Manage MCP servers" },
370
+ {
371
+ name: "mcp install",
372
+ description: "Browse and install community MCP servers"
373
+ },
374
+ { name: "sync", description: "Sync settings with cloud" },
375
+ { name: "history", description: "Show conversation history" },
376
+ { name: "about", description: "Show Autohand version and links" },
377
+ { name: "plan", description: "Toggle plan mode" },
378
+ { name: "goal", description: "Manage persistent goals and queued goal work" },
379
+ { name: "ide", description: "IDE integration settings" },
380
+ { name: "search", description: "Configure web search" },
381
+ { name: "login", description: "Sign in to Autohand account" },
382
+ { name: "logout", description: "Sign out of Autohand account" },
383
+ { name: "learn", description: "Analyze project and recommend skills" },
384
+ { name: "skills search", description: "Search community skills" },
385
+ { name: "skills trending", description: "Show trending community skills" },
386
+ { name: "skills remove", description: "Remove an installed skill" }
387
+ ];
388
+ var DEFAULT_ACP_MODES = [
389
+ {
390
+ id: "interactive",
391
+ name: "Interactive",
392
+ description: "Default mode with approval prompts for risky actions"
393
+ },
394
+ {
395
+ id: "full-access",
396
+ name: "Full Access",
397
+ description: "Auto-approve all actions within the workspace"
398
+ },
399
+ {
400
+ id: "unrestricted",
401
+ name: "Unrestricted",
402
+ description: "Skip all approval prompts (use with caution)"
403
+ },
404
+ {
405
+ id: "auto-mode",
406
+ name: "Auto Mode",
407
+ description: "Autonomous multi-step execution loop"
408
+ },
409
+ {
410
+ id: "restricted",
411
+ name: "Restricted",
412
+ description: "Deny all dangerous operations automatically"
413
+ },
414
+ {
415
+ id: "dry-run",
416
+ name: "Dry Run",
417
+ description: "Preview actions without applying changes"
418
+ }
419
+ ];
420
+ function buildConfigOptions(_config) {
421
+ const options = [];
422
+ options.push({
423
+ type: "select",
424
+ id: "thinking_level",
425
+ name: "Thinking Level",
426
+ description: "Control the depth of LLM reasoning",
427
+ options: [
428
+ { value: "none", name: "None" },
429
+ { value: "normal", name: "Normal" },
430
+ { value: "extended", name: "Extended" }
431
+ ],
432
+ currentValue: "normal"
433
+ });
434
+ options.push({
435
+ type: "select",
436
+ id: "auto_commit",
437
+ name: "Auto Commit",
438
+ description: "Automatically commit changes with LLM-generated messages",
439
+ options: [
440
+ { value: "off", name: "Off" },
441
+ { value: "on", name: "On" }
442
+ ],
443
+ currentValue: "off"
444
+ });
445
+ const contextCompactEnabled = true;
446
+ options.push({
447
+ type: "select",
448
+ id: "context_compact",
449
+ name: "Context Compaction",
450
+ description: "Automatically compact context when sessions grow long",
451
+ options: [
452
+ { value: "on", name: "On" },
453
+ { value: "off", name: "Off" }
454
+ ],
455
+ currentValue: contextCompactEnabled ? "on" : "off"
456
+ });
457
+ return options;
458
+ }
459
+ function parseAvailableModels(config) {
460
+ const models = [];
461
+ const providerName = config.provider ?? "openrouter";
462
+ const providerConfig = config[providerName];
463
+ if (providerConfig?.model) {
464
+ models.push(providerConfig.model);
465
+ }
466
+ const popularModels = [
467
+ "openrouter/auto",
468
+ "anthropic/claude-sonnet-4-20250514",
469
+ "openai/gpt-4o",
470
+ "openai/gpt-5",
471
+ "google/gemini-3.0-pro",
472
+ "deepseek/deepseek-v4",
473
+ "anthropic/claude-5-sonnet",
474
+ "anthropic/claude-5-opus"
475
+ ];
476
+ for (const m of popularModels) {
477
+ if (!models.includes(m)) {
478
+ models.push(m);
479
+ }
480
+ }
481
+ return models;
482
+ }
483
+ function resolveDefaultMode(config) {
484
+ if (config?.permissions?.mode === "unrestricted") return "unrestricted";
485
+ if (config?.permissions?.mode === "restricted") return "restricted";
486
+ return "interactive";
487
+ }
488
+ function resolveDefaultModel(config) {
489
+ const providerName = config.provider ?? "openrouter";
490
+ const providerConfig = config[providerName];
491
+ return providerConfig?.model ?? "anthropic/claude-5-sonnet";
492
+ }
493
+
494
+ // src/modes/acp/permissions.ts
495
+ function createPermissionBridge(options) {
496
+ const { connection, sessionId } = options;
497
+ let { modeId } = options;
498
+ const setMode = (newModeId) => {
499
+ modeId = newModeId;
500
+ };
501
+ const confirmAction = async (message, context) => {
502
+ if (modeId === "unrestricted" || modeId === "full-access" || modeId === "auto-mode") {
503
+ return { decision: "allow_once" };
504
+ }
505
+ if (modeId === "restricted" || modeId === "dry-run") {
506
+ return { decision: "deny_once" };
507
+ }
508
+ const toolName = context?.tool ?? "action";
509
+ const kind = resolveToolKind(toolName);
510
+ const title = resolveToolDisplayName(toolName);
511
+ const toolCallId = `perm_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`;
512
+ const locations = [];
513
+ if (context?.path) {
514
+ locations.push({ path: context.path });
515
+ }
516
+ try {
517
+ const response = await connection.requestPermission({
518
+ sessionId,
519
+ toolCall: {
520
+ toolCallId,
521
+ title: `${title}: ${message}`,
522
+ kind,
523
+ status: "pending",
524
+ locations,
525
+ rawInput: {
526
+ tool: toolName,
527
+ description: message,
528
+ command: context?.command,
529
+ path: context?.path,
530
+ args: context?.args
531
+ }
532
+ },
533
+ options: [
534
+ { kind: "allow_once", name: "Yes", optionId: "allow_once" },
535
+ { kind: "reject_once", name: "No", optionId: "deny_once" },
536
+ { kind: "allow_once", name: "Allow Once", optionId: "allow_session" },
537
+ { kind: "reject_once", name: "Deny Once", optionId: "deny_session" },
538
+ { kind: "allow_always", name: "Allow Always (Project)", optionId: "allow_always_project" },
539
+ { kind: "allow_always", name: "Allow Always (User)", optionId: "allow_always_user" },
540
+ { kind: "reject_always", name: "Deny Always (Project)", optionId: "deny_always_project" },
541
+ { kind: "reject_always", name: "Deny Always (User)", optionId: "deny_always_user" },
542
+ { kind: "reject_once", name: "Enter alternative...", optionId: "alternative" }
543
+ ]
544
+ });
545
+ if (response.outcome.outcome === "selected") {
546
+ const optionId = response.outcome.optionId;
547
+ if (optionId === "alternative") {
548
+ const meta = response.outcome._meta;
549
+ const alternative = typeof meta?.alternative === "string" ? meta.alternative.trim() : "";
550
+ return alternative ? { decision: "alternative", alternative } : { decision: "deny_once" };
551
+ }
552
+ return { decision: optionId };
553
+ }
554
+ return { decision: "deny_once" };
555
+ } catch (error) {
556
+ process.stderr.write(
557
+ `[ACP] Permission request failed: ${error instanceof Error ? error.message : String(error)}
558
+ `
559
+ );
560
+ return { decision: "deny_once" };
561
+ }
562
+ };
563
+ return { confirmAction, setMode };
564
+ }
565
+
566
+ // src/modes/acp/adapter.ts
567
+ var AutohandAcpAdapter = class _AutohandAcpAdapter {
568
+ constructor(connection, cliOptions = {}) {
569
+ this.connection = connection;
570
+ this.cliOptions = cliOptions;
571
+ }
572
+ connection;
573
+ cliOptions;
574
+ sessions = /* @__PURE__ */ new Map();
575
+ agents = /* @__PURE__ */ new Map();
576
+ permissionBridges = /* @__PURE__ */ new Map();
577
+ sessionConfigOptions = /* @__PURE__ */ new Map();
578
+ cancelledSessions = /* @__PURE__ */ new Set();
579
+ config = null;
580
+ clientCapabilities;
581
+ toolStartTimes = /* @__PURE__ */ new Map();
582
+ static LIST_SESSIONS_PAGE_SIZE = 50;
583
+ async ensureConfig() {
584
+ if (!this.config) {
585
+ this.config = await loadConfig(void 0, process.cwd());
586
+ }
587
+ return this.config;
588
+ }
589
+ buildSessionModes(modeId) {
590
+ return {
591
+ availableModes: DEFAULT_ACP_MODES.map((m) => ({
592
+ id: m.id,
593
+ name: m.name,
594
+ description: m.description
595
+ })),
596
+ currentModeId: modeId
597
+ };
598
+ }
599
+ buildSessionModels(config, modelId) {
600
+ return {
601
+ availableModels: parseAvailableModels(config).map((m) => ({
602
+ modelId: m,
603
+ name: m.split("/").pop() ?? m
604
+ })),
605
+ currentModelId: modelId
606
+ };
607
+ }
608
+ getSessionCommands(config) {
609
+ if (isGoalFeatureEnabled(config)) return DEFAULT_ACP_COMMANDS;
610
+ return DEFAULT_ACP_COMMANDS.filter((cmd) => cmd.name !== "goal");
611
+ }
612
+ cloneConfigOptions(options) {
613
+ return structuredClone(options);
614
+ }
615
+ getSessionConfigOptions(sessionId) {
616
+ const options = this.sessionConfigOptions.get(sessionId) ?? [];
617
+ return this.cloneConfigOptions(options);
618
+ }
619
+ validateMode(modeId) {
620
+ if (!DEFAULT_ACP_MODES.some((mode) => mode.id === modeId)) {
621
+ throw RequestError.invalidParams({ message: `Unsupported mode: ${modeId}` });
622
+ }
623
+ }
624
+ validateModel(config, modelId) {
625
+ const models = parseAvailableModels(config);
626
+ if (!models.includes(modelId)) {
627
+ throw RequestError.invalidParams({ message: `Unsupported model: ${modelId}` });
628
+ }
629
+ }
630
+ convertAcpMcpServers(mcpServers) {
631
+ if (!mcpServers || mcpServers.length === 0) {
632
+ return [];
633
+ }
634
+ return mcpServers.map((server) => {
635
+ if ("command" in server) {
636
+ return {
637
+ name: server.name,
638
+ transport: "stdio",
639
+ command: server.command,
640
+ args: [...server.args],
641
+ env: Object.fromEntries(server.env.map((variable) => [variable.name, variable.value])),
642
+ autoConnect: true
643
+ };
644
+ }
645
+ return {
646
+ name: server.name,
647
+ transport: server.type,
648
+ url: server.url,
649
+ headers: Object.fromEntries(server.headers.map((header) => [header.name, header.value])),
650
+ autoConnect: true
651
+ };
652
+ });
653
+ }
654
+ async connectSessionMcpServers(agent, mcpServers) {
655
+ const converted = this.convertAcpMcpServers(mcpServers);
656
+ if (converted.length === 0) {
657
+ return;
658
+ }
659
+ await agent.connectAcpMcpServers(converted);
660
+ }
661
+ resolveWorkspaceRoot(sessionId, cwd) {
662
+ let workspaceRoot = cwd;
663
+ if (isSessionWorktreeEnabled(this.cliOptions.worktree)) {
664
+ const sessionWorktree = prepareSessionWorktree({
665
+ cwd,
666
+ worktree: this.cliOptions.worktree,
667
+ mode: "acp"
668
+ });
669
+ workspaceRoot = sessionWorktree.worktreePath;
670
+ process.stderr.write(
671
+ `[ACP] Session ${sessionId} using git worktree ${sessionWorktree.worktreePath} (${sessionWorktree.branchName})
672
+ `
673
+ );
674
+ }
675
+ return workspaceRoot;
676
+ }
677
+ async createManagedSession(sessionId, workspaceRoot) {
678
+ const config = await this.ensureConfig();
679
+ if (!config.ui) {
680
+ config.ui = {};
681
+ }
682
+ config.ui.useInkRenderer = false;
683
+ const modeId = resolveDefaultMode(config);
684
+ const modelId = resolveDefaultModel(config);
685
+ const runtime = {
686
+ config,
687
+ workspaceRoot,
688
+ options: {
689
+ yes: modeId === "unrestricted" || modeId === "full-access",
690
+ unrestricted: modeId === "unrestricted",
691
+ restricted: modeId === "restricted",
692
+ dryRun: modeId === "dry-run",
693
+ contextCompact: true
694
+ // Default enabled; ACP config can toggle via applyAcpConfigOption
695
+ },
696
+ isRpcMode: true
697
+ };
698
+ const provider = ProviderFactory.create(config);
699
+ const files = new FileActionManager(workspaceRoot);
700
+ const agent = new AutohandAgent(provider, files, runtime);
701
+ await agent.initializeForRPC();
702
+ const state = {
703
+ sessionId,
704
+ modeId,
705
+ modelId,
706
+ workspaceRoot,
707
+ createdAt: Date.now(),
708
+ abortController: new AbortController(),
709
+ promptCount: 0
710
+ };
711
+ this.sessions.set(sessionId, state);
712
+ this.agents.set(sessionId, agent);
713
+ this.sessionConfigOptions.set(sessionId, buildConfigOptions(config));
714
+ agent.setOutputListener((event) => {
715
+ this.handleAgentOutput(sessionId, event);
716
+ });
717
+ const permBridge = createPermissionBridge({
718
+ connection: this.connection,
719
+ sessionId,
720
+ modeId
721
+ });
722
+ agent.setConfirmationCallback(async (message, context) => {
723
+ return permBridge.confirmAction(message, context);
724
+ });
725
+ this.permissionBridges.set(sessionId, permBridge);
726
+ return { config, state, agent };
727
+ }
728
+ restoreConversation(messages) {
729
+ const conversation = ConversationManager.getInstance();
730
+ if (!conversation.isInitialized()) {
731
+ throw new Error("Conversation manager is not initialized");
732
+ }
733
+ for (const msg of messages) {
734
+ if (msg.role === "system") {
735
+ if (!msg.content.startsWith("You are Autohand")) {
736
+ conversation.addSystemNote(msg.content);
737
+ }
738
+ continue;
739
+ }
740
+ let convertedToolCalls;
741
+ if (msg.toolCalls && Array.isArray(msg.toolCalls)) {
742
+ convertedToolCalls = msg.toolCalls.map((tc) => ({
743
+ id: tc.id,
744
+ type: "function",
745
+ function: {
746
+ name: tc.tool || tc.function?.name || "unknown",
747
+ arguments: typeof tc.args === "string" ? tc.args : JSON.stringify(tc.args || {})
748
+ }
749
+ }));
750
+ }
751
+ conversation.addMessage({
752
+ role: msg.role,
753
+ content: msg.content,
754
+ name: msg.name,
755
+ tool_calls: convertedToolCalls,
756
+ tool_call_id: msg.tool_call_id
757
+ });
758
+ }
759
+ }
760
+ async replayConversation(sessionId, messages) {
761
+ for (const msg of messages) {
762
+ if (!msg.content?.trim()) {
763
+ continue;
764
+ }
765
+ if (msg.role === "user") {
766
+ await this.connection.sessionUpdate({
767
+ sessionId,
768
+ update: {
769
+ sessionUpdate: "user_message_chunk",
770
+ content: { type: "text", text: msg.content }
771
+ }
772
+ });
773
+ continue;
774
+ }
775
+ if (msg.role === "assistant") {
776
+ await this.connection.sessionUpdate({
777
+ sessionId,
778
+ update: {
779
+ sessionUpdate: "agent_message_chunk",
780
+ content: { type: "text", text: msg.content }
781
+ }
782
+ });
783
+ continue;
784
+ }
785
+ if (msg.role === "tool") {
786
+ await this.connection.sessionUpdate({
787
+ sessionId,
788
+ update: {
789
+ sessionUpdate: "agent_message_chunk",
790
+ content: { type: "text", text: `[tool] ${msg.content}` }
791
+ }
792
+ });
793
+ continue;
794
+ }
795
+ if (msg.role === "system" && !msg.content.startsWith("You are Autohand")) {
796
+ await this.connection.sessionUpdate({
797
+ sessionId,
798
+ update: {
799
+ sessionUpdate: "agent_message_chunk",
800
+ content: { type: "text", text: `[system] ${msg.content}` }
801
+ }
802
+ });
803
+ }
804
+ }
805
+ }
806
+ async restoreSession(sessionId, cwd, mcpServers) {
807
+ const workspaceRoot = this.resolveWorkspaceRoot(sessionId, cwd);
808
+ const { config, state, agent } = await this.createManagedSession(sessionId, workspaceRoot);
809
+ await this.connectSessionMcpServers(agent, mcpServers);
810
+ const sessionManager = agent.getSessionManager();
811
+ try {
812
+ const loadedSession = await sessionManager.loadSession(sessionId);
813
+ const messages = loadedSession.getMessages();
814
+ this.restoreConversation(messages);
815
+ if (loadedSession.metadata.model) {
816
+ state.modelId = loadedSession.metadata.model;
817
+ }
818
+ this.sessions.set(sessionId, state);
819
+ return { config, state, messages };
820
+ } catch (error) {
821
+ this.sessions.delete(sessionId);
822
+ this.agents.delete(sessionId);
823
+ this.permissionBridges.delete(sessionId);
824
+ this.sessionConfigOptions.delete(sessionId);
825
+ throw error;
826
+ }
827
+ }
828
+ // ==========================================================================
829
+ // ACP Agent Interface: initialize
830
+ // ==========================================================================
831
+ async initialize(params) {
832
+ this.clientCapabilities = params.clientCapabilities;
833
+ this.config = await loadConfig(void 0, process.cwd());
834
+ return {
835
+ protocolVersion: PROTOCOL_VERSION,
836
+ agentCapabilities: {
837
+ promptCapabilities: {
838
+ embeddedContext: true,
839
+ image: true
840
+ },
841
+ loadSession: true,
842
+ mcpCapabilities: {
843
+ http: true,
844
+ sse: true
845
+ },
846
+ sessionCapabilities: {
847
+ list: {},
848
+ resume: {},
849
+ fork: {}
850
+ }
851
+ },
852
+ agentInfo: {
853
+ name: "autohand-cli",
854
+ title: "Autohand Code",
855
+ version: package_default.version
856
+ }
857
+ };
858
+ }
859
+ // ==========================================================================
860
+ // ACP Agent Interface: authenticate
861
+ // ==========================================================================
862
+ async authenticate(_params) {
863
+ if (this.config?.auth?.token) {
864
+ return {};
865
+ }
866
+ const provider = this.config?.provider ?? "openrouter";
867
+ const providerConfig = this.config?.[provider];
868
+ if (providerConfig?.apiKey) {
869
+ return {};
870
+ }
871
+ throw RequestError.authRequired({
872
+ message: "Please run `autohand --setup` or `autohand login` in your terminal."
873
+ });
874
+ }
875
+ // ==========================================================================
876
+ // ACP Agent Interface: newSession
877
+ // ==========================================================================
878
+ async newSession(params) {
879
+ const sessionId = crypto.randomUUID();
880
+ const workspaceRoot = this.resolveWorkspaceRoot(sessionId, params.cwd);
881
+ const { config, state, agent } = await this.createManagedSession(sessionId, workspaceRoot);
882
+ await this.connectSessionMcpServers(agent, params.mcpServers);
883
+ this.emitHookSessionStart(sessionId, "startup");
884
+ const response = {
885
+ sessionId,
886
+ modes: this.buildSessionModes(state.modeId),
887
+ models: this.buildSessionModels(config, state.modelId),
888
+ configOptions: this.getSessionConfigOptions(sessionId),
889
+ _meta: {
890
+ commands: this.getSessionCommands(config).map((cmd) => ({
891
+ name: cmd.name,
892
+ description: cmd.description
893
+ }))
894
+ }
895
+ };
896
+ return response;
897
+ }
898
+ // ==========================================================================
899
+ // ACP Agent Interface: prompt
900
+ // ==========================================================================
901
+ async prompt(params) {
902
+ const session = this.sessions.get(params.sessionId);
903
+ const agent = this.agents.get(params.sessionId);
904
+ if (!session || !agent) {
905
+ throw RequestError.invalidParams({ message: "Session not found" });
906
+ }
907
+ session.abortController = new AbortController();
908
+ this.cancelledSessions.delete(params.sessionId);
909
+ let instruction = "";
910
+ if (params.prompt) {
911
+ for (const block of params.prompt) {
912
+ if (block.type === "text") {
913
+ instruction += block.text;
914
+ } else if (block.type === "resource") {
915
+ const resourceUri = block.resource?.uri ?? "";
916
+ instruction += `
917
+ [Resource: ${resourceUri}]`;
918
+ }
919
+ }
920
+ }
921
+ if (!instruction.trim()) {
922
+ return { stopReason: "end_turn" };
923
+ }
924
+ session.promptCount++;
925
+ if (session.promptCount === 1) {
926
+ const title = instruction.trim().slice(0, 120);
927
+ this.connection.sessionUpdate({
928
+ sessionId: params.sessionId,
929
+ update: {
930
+ sessionUpdate: "session_info_update",
931
+ title,
932
+ updatedAt: (/* @__PURE__ */ new Date()).toISOString()
933
+ }
934
+ });
935
+ } else {
936
+ this.connection.sessionUpdate({
937
+ sessionId: params.sessionId,
938
+ update: {
939
+ sessionUpdate: "session_info_update",
940
+ updatedAt: (/* @__PURE__ */ new Date()).toISOString()
941
+ }
942
+ });
943
+ }
944
+ const trimmed = instruction.trim();
945
+ if (trimmed.startsWith("/") && !isLikelyFilePathSlashInput(trimmed)) {
946
+ const { command, args } = agent.parseSlashCommand(trimmed);
947
+ if (agent.isSlashCommand(trimmed)) {
948
+ try {
949
+ if (agent.isSlashCommandSupported(command)) {
950
+ const result = await agent.handleSlashCommand(command, args);
951
+ if (result !== null) {
952
+ await this.connection.sessionUpdate({
953
+ sessionId: params.sessionId,
954
+ update: {
955
+ sessionUpdate: "agent_message_chunk",
956
+ content: { type: "text", text: result }
957
+ }
958
+ });
959
+ } else {
960
+ await this.connection.sessionUpdate({
961
+ sessionId: params.sessionId,
962
+ update: {
963
+ sessionUpdate: "agent_message_chunk",
964
+ content: { type: "text", text: `Command ${command} executed.` }
965
+ }
966
+ });
967
+ }
968
+ } else {
969
+ await this.connection.sessionUpdate({
970
+ sessionId: params.sessionId,
971
+ update: {
972
+ sessionUpdate: "agent_message_chunk",
973
+ content: { type: "text", text: `Unknown command: ${command}. Type /help for available commands.` }
974
+ }
975
+ });
976
+ }
977
+ } catch (err) {
978
+ const errMsg = err instanceof Error ? err.message : String(err);
979
+ await this.connection.sessionUpdate({
980
+ sessionId: params.sessionId,
981
+ update: {
982
+ sessionUpdate: "agent_message_chunk",
983
+ content: { type: "text", text: `Error: ${errMsg}` }
984
+ }
985
+ });
986
+ }
987
+ return { stopReason: "end_turn" };
988
+ }
989
+ }
990
+ const turnStart = Date.now();
991
+ this.emitHookPrePrompt(params.sessionId, instruction, []);
992
+ try {
993
+ const success = await agent.runInstruction(instruction);
994
+ const turnDuration = Date.now() - turnStart;
995
+ this.emitHookStop(params.sessionId, 0, 0, turnDuration);
996
+ if (!success && this.cancelledSessions.has(params.sessionId)) {
997
+ return { stopReason: "cancelled" };
998
+ }
999
+ return { stopReason: "end_turn" };
1000
+ } catch (err) {
1001
+ if (session.abortController.signal.aborted || this.cancelledSessions.has(params.sessionId)) {
1002
+ return { stopReason: "cancelled" };
1003
+ }
1004
+ const classified = this.classifyAndFormatError(err);
1005
+ process.stderr.write(`[ACP] Prompt error (${classified.code}): ${classified.message}
1006
+ `);
1007
+ this.emitHookSessionError(params.sessionId, classified.message, classified.code);
1008
+ await this.connection.sessionUpdate({
1009
+ sessionId: params.sessionId,
1010
+ update: {
1011
+ sessionUpdate: "agent_message_chunk",
1012
+ content: { type: "text", text: `Error (${classified.code}): ${classified.message}` }
1013
+ }
1014
+ });
1015
+ return { stopReason: "end_turn" };
1016
+ }
1017
+ }
1018
+ // ==========================================================================
1019
+ // ACP Agent Interface: cancel
1020
+ // ==========================================================================
1021
+ async cancel(params) {
1022
+ const session = this.sessions.get(params.sessionId);
1023
+ const agent = this.agents.get(params.sessionId);
1024
+ if (session) {
1025
+ session.abortController.abort();
1026
+ this.cancelledSessions.add(params.sessionId);
1027
+ }
1028
+ if (agent) {
1029
+ agent.cancelCurrentInstruction();
1030
+ }
1031
+ }
1032
+ // ==========================================================================
1033
+ // ACP Agent Interface: setSessionMode
1034
+ // ==========================================================================
1035
+ async setSessionMode(params) {
1036
+ const session = this.sessions.get(params.sessionId);
1037
+ const agent = this.agents.get(params.sessionId);
1038
+ if (!session) {
1039
+ throw RequestError.invalidParams({ message: "Session not found" });
1040
+ }
1041
+ if (!agent) {
1042
+ throw RequestError.invalidParams({ message: "Session agent not found" });
1043
+ }
1044
+ this.validateMode(params.modeId);
1045
+ session.modeId = params.modeId;
1046
+ this.permissionBridges.get(params.sessionId)?.setMode(params.modeId);
1047
+ agent.applyAcpMode(params.modeId);
1048
+ process.stderr.write(`[ACP] Session ${params.sessionId} mode set to: ${params.modeId}
1049
+ `);
1050
+ await this.connection.sessionUpdate({
1051
+ sessionId: params.sessionId,
1052
+ update: {
1053
+ sessionUpdate: "current_mode_update",
1054
+ currentModeId: params.modeId
1055
+ }
1056
+ });
1057
+ return {};
1058
+ }
1059
+ // ==========================================================================
1060
+ // ACP Agent Interface: unstable_setSessionModel
1061
+ // ==========================================================================
1062
+ async unstable_setSessionModel(params) {
1063
+ const session = this.sessions.get(params.sessionId);
1064
+ const agent = this.agents.get(params.sessionId);
1065
+ if (!session) {
1066
+ throw RequestError.invalidParams({ message: "Session not found" });
1067
+ }
1068
+ if (!agent) {
1069
+ throw RequestError.invalidParams({ message: "Session agent not found" });
1070
+ }
1071
+ const config = await this.ensureConfig();
1072
+ this.validateModel(config, params.modelId);
1073
+ session.modelId = params.modelId;
1074
+ agent.applyAcpModel(params.modelId);
1075
+ process.stderr.write(`[ACP] Session ${params.sessionId} model set to: ${params.modelId}
1076
+ `);
1077
+ return {};
1078
+ }
1079
+ async unstable_setSessionConfigOption(params) {
1080
+ const options = this.sessionConfigOptions.get(params.sessionId);
1081
+ const agent = this.agents.get(params.sessionId);
1082
+ if (!options || !agent) {
1083
+ throw RequestError.invalidParams({ message: "Session not found" });
1084
+ }
1085
+ const option = options.find((entry) => entry.id === params.configId);
1086
+ if (!option) {
1087
+ throw RequestError.invalidParams({ message: `Unknown config option: ${params.configId}` });
1088
+ }
1089
+ const validValues = [];
1090
+ if (option.type === "select" && "options" in option) {
1091
+ for (const entry of option.options) {
1092
+ if ("value" in entry) {
1093
+ validValues.push(entry.value);
1094
+ } else if ("options" in entry) {
1095
+ for (const subEntry of entry.options) {
1096
+ validValues.push(subEntry.value);
1097
+ }
1098
+ }
1099
+ }
1100
+ }
1101
+ if (typeof params.value === "string" && !validValues.includes(params.value)) {
1102
+ throw RequestError.invalidParams({
1103
+ message: `Invalid value "${params.value}" for config option "${params.configId}"`
1104
+ });
1105
+ }
1106
+ option.currentValue = params.value;
1107
+ agent.applyAcpConfigOption(params.configId, String(params.value));
1108
+ return {
1109
+ configOptions: this.cloneConfigOptions(options)
1110
+ };
1111
+ }
1112
+ // ==========================================================================
1113
+ // ACP Agent Interface: unstable_listSessions (optional)
1114
+ // ==========================================================================
1115
+ async unstable_listSessions(params) {
1116
+ try {
1117
+ const { SessionManager } = await import("./SessionManager-554PHVPC.js");
1118
+ const sessionManager = new SessionManager();
1119
+ await sessionManager.initialize();
1120
+ const sessions = await sessionManager.listSessions();
1121
+ const filtered = params.cwd ? sessions.filter((session) => session.projectPath === params.cwd) : sessions;
1122
+ const offset = params.cursor ? Number.parseInt(params.cursor, 10) : 0;
1123
+ if (Number.isNaN(offset) || offset < 0) {
1124
+ throw RequestError.invalidParams({ message: `Invalid cursor: ${params.cursor}` });
1125
+ }
1126
+ const paged = filtered.slice(offset, offset + _AutohandAcpAdapter.LIST_SESSIONS_PAGE_SIZE);
1127
+ const nextOffset = offset + paged.length;
1128
+ const nextCursor = nextOffset < filtered.length ? String(nextOffset) : void 0;
1129
+ return {
1130
+ sessions: paged.map((s) => ({
1131
+ sessionId: s.sessionId,
1132
+ cwd: s.projectPath ?? "",
1133
+ title: s.summary ?? s.projectName ?? `Session ${s.sessionId.slice(0, 8)}`,
1134
+ updatedAt: s.lastActiveAt ?? s.createdAt
1135
+ })),
1136
+ ...nextCursor ? { nextCursor } : {}
1137
+ };
1138
+ } catch (err) {
1139
+ process.stderr.write(`[ACP] Failed to list sessions: ${err instanceof Error ? err.message : String(err)}
1140
+ `);
1141
+ return { sessions: [] };
1142
+ }
1143
+ }
1144
+ // ==========================================================================
1145
+ // ACP Agent Interface: unstable_resumeSession (optional)
1146
+ // ==========================================================================
1147
+ async unstable_resumeSession(_params) {
1148
+ try {
1149
+ const params = _params;
1150
+ const { config, state } = await this.restoreSession(params.sessionId, params.cwd, params.mcpServers);
1151
+ this.emitHookSessionStart(params.sessionId, "resume");
1152
+ process.stderr.write(`[ACP] Resumed session ${params.sessionId}
1153
+ `);
1154
+ return {
1155
+ modes: this.buildSessionModes(state.modeId),
1156
+ models: this.buildSessionModels(config, state.modelId),
1157
+ configOptions: this.getSessionConfigOptions(params.sessionId)
1158
+ };
1159
+ } catch (error) {
1160
+ const message = error instanceof Error ? error.message : String(error);
1161
+ throw RequestError.invalidParams({ message: `Failed to resume session: ${message}` });
1162
+ }
1163
+ }
1164
+ // ==========================================================================
1165
+ // ACP Agent Interface: unstable_forkSession (optional)
1166
+ // ==========================================================================
1167
+ async unstable_forkSession(params) {
1168
+ const sourceSession = this.sessions.get(params.sessionId);
1169
+ if (!sourceSession) {
1170
+ throw RequestError.invalidParams({ message: "Source session not found" });
1171
+ }
1172
+ const sourceAgent = this.agents.get(params.sessionId);
1173
+ if (sourceAgent) {
1174
+ try {
1175
+ const conversation = ConversationManager.getInstance();
1176
+ const { extractAndSaveSessionMemories } = await import("./extractSessionMemories-A2JX5WJ2.js");
1177
+ await extractAndSaveSessionMemories({
1178
+ llm: sourceAgent.getLlmProvider(),
1179
+ memoryManager: sourceAgent.getMemoryManager(),
1180
+ conversationHistory: conversation.history(),
1181
+ workspaceRoot: sourceSession.workspaceRoot
1182
+ });
1183
+ } catch {
1184
+ }
1185
+ }
1186
+ const newSessionResponse = await this.newSession({
1187
+ cwd: sourceSession.workspaceRoot,
1188
+ mcpServers: []
1189
+ });
1190
+ return {
1191
+ sessionId: newSessionResponse.sessionId
1192
+ };
1193
+ }
1194
+ // ==========================================================================
1195
+ // ACP Agent Interface: loadSession (optional)
1196
+ // ==========================================================================
1197
+ async loadSession(params) {
1198
+ try {
1199
+ const { config, state, messages } = await this.restoreSession(params.sessionId, params.cwd, params.mcpServers);
1200
+ await this.replayConversation(params.sessionId, messages);
1201
+ this.emitHookSessionStart(params.sessionId, "resume");
1202
+ process.stderr.write(`[ACP] Loaded session ${params.sessionId} with ${messages.length} messages
1203
+ `);
1204
+ return {
1205
+ modes: this.buildSessionModes(state.modeId),
1206
+ models: this.buildSessionModels(config, state.modelId),
1207
+ configOptions: this.getSessionConfigOptions(params.sessionId)
1208
+ };
1209
+ } catch (error) {
1210
+ const message = error instanceof Error ? error.message : String(error);
1211
+ throw RequestError.invalidParams({ message: `Failed to load session: ${message}` });
1212
+ }
1213
+ }
1214
+ // ==========================================================================
1215
+ // Hook Lifecycle Notifications
1216
+ // ==========================================================================
1217
+ /**
1218
+ * Safely emit a hook notification via extNotification.
1219
+ * Hook notifications must never crash the agent — errors are logged and swallowed.
1220
+ */
1221
+ async emitHookSafe(method, params) {
1222
+ try {
1223
+ await this.connection.extNotification(method, params);
1224
+ } catch (err) {
1225
+ process.stderr.write(
1226
+ `[ACP] Failed to emit hook notification ${method}: ${err instanceof Error ? err.message : String(err)}
1227
+ `
1228
+ );
1229
+ }
1230
+ }
1231
+ emitHookPreTool(sessionId, toolId, toolName, args) {
1232
+ void this.emitHookSafe(ACP_HOOK_NOTIFICATIONS.HOOK_PRE_TOOL, {
1233
+ sessionId,
1234
+ toolId,
1235
+ toolName,
1236
+ args,
1237
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
1238
+ });
1239
+ }
1240
+ emitHookPostTool(sessionId, toolId, toolName, success, duration, output) {
1241
+ void this.emitHookSafe(ACP_HOOK_NOTIFICATIONS.HOOK_POST_TOOL, {
1242
+ sessionId,
1243
+ toolId,
1244
+ toolName,
1245
+ success,
1246
+ duration,
1247
+ output,
1248
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
1249
+ });
1250
+ }
1251
+ emitHookFileModified(sessionId, filePath, changeType, toolId) {
1252
+ void this.emitHookSafe(ACP_HOOK_NOTIFICATIONS.HOOK_FILE_MODIFIED, {
1253
+ sessionId,
1254
+ filePath,
1255
+ changeType,
1256
+ toolId,
1257
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
1258
+ });
1259
+ }
1260
+ emitHookPrePrompt(sessionId, instruction, mentionedFiles) {
1261
+ void this.emitHookSafe(ACP_HOOK_NOTIFICATIONS.HOOK_PRE_PROMPT, {
1262
+ sessionId,
1263
+ instruction,
1264
+ mentionedFiles,
1265
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
1266
+ });
1267
+ }
1268
+ emitHookPostResponse(sessionId, tokensUsed, toolCallsCount, duration) {
1269
+ void this.emitHookSafe(ACP_HOOK_NOTIFICATIONS.HOOK_POST_RESPONSE, {
1270
+ sessionId,
1271
+ tokensUsed,
1272
+ toolCallsCount,
1273
+ duration,
1274
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
1275
+ });
1276
+ }
1277
+ emitHookSessionError(sessionId, error, code, context) {
1278
+ void this.emitHookSafe(ACP_HOOK_NOTIFICATIONS.HOOK_SESSION_ERROR, {
1279
+ sessionId,
1280
+ error,
1281
+ code,
1282
+ context,
1283
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
1284
+ });
1285
+ }
1286
+ emitHookStop(sessionId, tokensUsed, toolCallsCount, duration) {
1287
+ void this.emitHookSafe(ACP_HOOK_NOTIFICATIONS.HOOK_STOP, {
1288
+ sessionId,
1289
+ tokensUsed,
1290
+ toolCallsCount,
1291
+ duration,
1292
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
1293
+ });
1294
+ }
1295
+ emitHookSessionStart(sessionId, sessionType) {
1296
+ void this.emitHookSafe(ACP_HOOK_NOTIFICATIONS.HOOK_SESSION_START, {
1297
+ sessionId,
1298
+ sessionType,
1299
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
1300
+ });
1301
+ }
1302
+ emitHookSessionEnd(sessionId, reason, duration) {
1303
+ void this.emitHookSafe(ACP_HOOK_NOTIFICATIONS.HOOK_SESSION_END, {
1304
+ sessionId,
1305
+ reason,
1306
+ duration,
1307
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
1308
+ });
1309
+ }
1310
+ emitHookSubagentStop(sessionId, subagentId, subagentName, subagentType, success, duration, error) {
1311
+ void this.emitHookSafe(ACP_HOOK_NOTIFICATIONS.HOOK_SUBAGENT_STOP, {
1312
+ sessionId,
1313
+ subagentId,
1314
+ subagentName,
1315
+ subagentType,
1316
+ success,
1317
+ duration,
1318
+ error,
1319
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
1320
+ });
1321
+ }
1322
+ emitHookPermissionRequest(sessionId, tool, path, command, args) {
1323
+ void this.emitHookSafe(ACP_HOOK_NOTIFICATIONS.HOOK_PERMISSION_REQUEST, {
1324
+ sessionId,
1325
+ tool,
1326
+ path,
1327
+ command,
1328
+ args,
1329
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
1330
+ });
1331
+ }
1332
+ emitHookNotification(sessionId, notificationType, message) {
1333
+ void this.emitHookSafe(ACP_HOOK_NOTIFICATIONS.HOOK_NOTIFICATION, {
1334
+ sessionId,
1335
+ notificationType,
1336
+ message,
1337
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
1338
+ });
1339
+ }
1340
+ // ==========================================================================
1341
+ // Agent Output → ACP Session Updates
1342
+ // ==========================================================================
1343
+ /**
1344
+ * Translates AutohandAgent output events into ACP session update notifications.
1345
+ * This is the core bridge between the agent's internal event system and the ACP protocol.
1346
+ */
1347
+ async handleAgentOutput(sessionId, event) {
1348
+ try {
1349
+ switch (event.type) {
1350
+ case "thinking":
1351
+ if (event.thought) {
1352
+ await this.connection.sessionUpdate({
1353
+ sessionId,
1354
+ update: {
1355
+ sessionUpdate: "agent_message_chunk",
1356
+ content: {
1357
+ type: "thinking",
1358
+ text: event.thought
1359
+ }
1360
+ }
1361
+ });
1362
+ }
1363
+ break;
1364
+ case "message":
1365
+ if (event.content) {
1366
+ await this.connection.sessionUpdate({
1367
+ sessionId,
1368
+ update: {
1369
+ sessionUpdate: "agent_message_chunk",
1370
+ content: {
1371
+ type: "text",
1372
+ text: event.content
1373
+ }
1374
+ }
1375
+ });
1376
+ }
1377
+ break;
1378
+ case "tool_start":
1379
+ if (event.toolName) {
1380
+ const toolCallId = event.toolId ?? `tool_${Date.now()}`;
1381
+ const kind = resolveToolKind(event.toolName);
1382
+ const title = resolveToolDisplayName(event.toolName);
1383
+ const locations = [];
1384
+ if (event.toolArgs?.path && typeof event.toolArgs.path === "string") {
1385
+ locations.push({ path: event.toolArgs.path });
1386
+ }
1387
+ if (event.toolArgs?.file && typeof event.toolArgs.file === "string") {
1388
+ locations.push({ path: event.toolArgs.file });
1389
+ }
1390
+ await this.connection.sessionUpdate({
1391
+ sessionId,
1392
+ update: {
1393
+ sessionUpdate: "tool_call",
1394
+ toolCallId,
1395
+ title,
1396
+ kind,
1397
+ status: "in_progress",
1398
+ locations,
1399
+ rawInput: event.toolArgs ?? {}
1400
+ }
1401
+ });
1402
+ this.toolStartTimes.set(toolCallId, Date.now());
1403
+ this.emitHookPreTool(sessionId, toolCallId, event.toolName, event.toolArgs ?? {});
1404
+ }
1405
+ break;
1406
+ case "tool_end":
1407
+ if (event.toolName) {
1408
+ const toolCallId = event.toolId ?? "unknown";
1409
+ const status = event.toolSuccess !== false ? "completed" : "failed";
1410
+ await this.connection.sessionUpdate({
1411
+ sessionId,
1412
+ update: {
1413
+ sessionUpdate: "tool_call_update",
1414
+ toolCallId,
1415
+ status,
1416
+ rawOutput: event.toolOutput ? { output: event.toolOutput } : void 0
1417
+ }
1418
+ });
1419
+ const startTime = this.toolStartTimes.get(toolCallId);
1420
+ const duration = startTime ? Date.now() - startTime : 0;
1421
+ this.toolStartTimes.delete(toolCallId);
1422
+ this.emitHookPostTool(
1423
+ sessionId,
1424
+ toolCallId,
1425
+ event.toolName,
1426
+ event.toolSuccess !== false,
1427
+ duration,
1428
+ event.toolOutput
1429
+ );
1430
+ }
1431
+ break;
1432
+ case "schedule_triggered":
1433
+ if (event.content) {
1434
+ await this.connection.sessionUpdate({
1435
+ sessionId,
1436
+ update: {
1437
+ sessionUpdate: "agent_message_chunk",
1438
+ content: { type: "text", text: `[Scheduled job triggered] ${event.content}` }
1439
+ }
1440
+ });
1441
+ }
1442
+ break;
1443
+ case "file_modified":
1444
+ if (event.filePath) {
1445
+ this.emitHookFileModified(
1446
+ sessionId,
1447
+ event.filePath,
1448
+ event.changeType ?? "modify",
1449
+ event.toolId ?? ""
1450
+ );
1451
+ }
1452
+ break;
1453
+ case "error":
1454
+ if (event.content) {
1455
+ const classified = this.classifyAndFormatError(event.content);
1456
+ await this.connection.sessionUpdate({
1457
+ sessionId,
1458
+ update: {
1459
+ sessionUpdate: "agent_message_chunk",
1460
+ content: {
1461
+ type: "text",
1462
+ text: `Error (${classified.code}): ${classified.message}`
1463
+ }
1464
+ }
1465
+ });
1466
+ this.emitHookSessionError(sessionId, classified.message, classified.code);
1467
+ }
1468
+ break;
1469
+ }
1470
+ } catch (err) {
1471
+ process.stderr.write(
1472
+ `[ACP] Failed to send session update: ${err instanceof Error ? err.message : String(err)}
1473
+ `
1474
+ );
1475
+ }
1476
+ }
1477
+ /**
1478
+ * Classify an error and return a structured result for ACP consumers.
1479
+ * Accepts either an Error instance (including ApiError), a string, or an unknown.
1480
+ */
1481
+ classifyAndFormatError(error) {
1482
+ if (error instanceof ApiError) {
1483
+ return {
1484
+ message: error.rawDetail || error.message,
1485
+ code: error.code,
1486
+ recoverable: error.retryable
1487
+ };
1488
+ }
1489
+ const message = error instanceof Error ? error.message : String(error);
1490
+ const classified = classifyApiError(0, message);
1491
+ return {
1492
+ message,
1493
+ code: classified.code,
1494
+ recoverable: classified.retryable
1495
+ };
1496
+ }
1497
+ };
1498
+
1499
+ // src/modes/acp/index.ts
1500
+ function redirectConsoleToStderr() {
1501
+ const stderrWrite = (...args) => {
1502
+ process.stderr.write(args.map(String).join(" ") + "\n");
1503
+ };
1504
+ console.log = stderrWrite;
1505
+ console.info = stderrWrite;
1506
+ console.warn = stderrWrite;
1507
+ console.debug = stderrWrite;
1508
+ }
1509
+ async function runAcpMode(options) {
1510
+ const workspacePath = options.path ?? process.cwd();
1511
+ const workspacePathValidation = await validateWorkspacePath(workspacePath);
1512
+ if (!workspacePathValidation.valid) {
1513
+ process.stderr.write(`[ACP] Error: ${workspacePathValidation.error}
1514
+ `);
1515
+ process.exit(1);
1516
+ }
1517
+ const safetyCheck = checkWorkspaceSafety(workspacePath);
1518
+ if (!safetyCheck.safe) {
1519
+ process.stderr.write(`[ACP] Error: Unsafe workspace \u2014 ${safetyCheck.reason}
1520
+ `);
1521
+ process.exit(1);
1522
+ }
1523
+ redirectConsoleToStderr();
1524
+ process.env.AUTOHAND_CLIENT_NAME = "acp";
1525
+ process.stderr.write("[ACP] Starting native ACP mode...\n");
1526
+ installProcessErrorHandlers();
1527
+ const input = Writable.toWeb(process.stdout);
1528
+ const output = Readable.toWeb(process.stdin);
1529
+ const stream = ndJsonStream(input, output);
1530
+ const _connection = new AgentSideConnection(
1531
+ (conn) => new AutohandAcpAdapter(conn, options),
1532
+ stream
1533
+ );
1534
+ process.stdin.resume();
1535
+ _connection.signal.addEventListener("abort", () => {
1536
+ process.stderr.write("[ACP] Connection closed.\n");
1537
+ process.exit(0);
1538
+ });
1539
+ process.stderr.write("[ACP] Native ACP mode ready. Waiting for client...\n");
1540
+ }
1541
+ export {
1542
+ ACP_HOOK_NOTIFICATIONS,
1543
+ AutohandAcpAdapter,
1544
+ DEFAULT_ACP_COMMANDS,
1545
+ DEFAULT_ACP_MODES,
1546
+ TOOL_DISPLAY_NAMES,
1547
+ TOOL_KIND_MAP,
1548
+ buildConfigOptions,
1549
+ createPermissionBridge,
1550
+ parseAvailableModels,
1551
+ resolveDefaultMode,
1552
+ resolveDefaultModel,
1553
+ resolveToolDisplayName,
1554
+ resolveToolKind,
1555
+ runAcpMode
1556
+ };