autohand-cli 0.7.13 → 0.8.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 (394) hide show
  1. package/assets/icon.png +0 -0
  2. package/dist/AgentRegistry-7LDL5HJH.js +10 -0
  3. package/dist/AgentRegistry-NQCLWABO.cjs +10 -0
  4. package/dist/{AutomodeManager-NGRAO2MH.js → AutomodeManager-MWLKGPZK.js} +2 -0
  5. package/dist/{AutomodeManager-ZKQMBM4T.cjs → AutomodeManager-NYIZNODK.cjs} +3 -1
  6. package/dist/CommunitySkillsCache-6QPRMTJO.js +8 -0
  7. package/dist/CommunitySkillsCache-GTQMOCCO.cjs +8 -0
  8. package/dist/{GitHubRegistryFetcher-US2JJID4.js → GitHubRegistryFetcher-6JQ5JEDZ.js} +1 -0
  9. package/dist/{GitHubRegistryFetcher-K744NNAJ.cjs → GitHubRegistryFetcher-S7QFUEKV.cjs} +1 -0
  10. package/dist/HookManager-Q2KYMCP4.cjs +7 -0
  11. package/dist/HookManager-TTP4Y6DC.js +7 -0
  12. package/dist/ImportWizard-IWVPRKFF.cjs +466 -0
  13. package/dist/ImportWizard-KASGQPUY.js +466 -0
  14. package/dist/McpClientManager-7RM6YT35.js +8 -0
  15. package/dist/McpClientManager-RKD7C6OY.cjs +8 -0
  16. package/dist/MemoryManager-GUNLRP5S.js +8 -0
  17. package/dist/MemoryManager-TNSGKDKX.cjs +8 -0
  18. package/dist/PermissionManager-2GO5PQ6M.cjs +11 -0
  19. package/dist/{PermissionManager-U5OMGR3L.js → PermissionManager-K7UWSNB6.js} +4 -3
  20. package/dist/ProjectProfiler-UMJJSOCE.js +194 -0
  21. package/dist/ProjectProfiler-ZDWR2ODG.cjs +194 -0
  22. package/dist/ProviderFactory-EFFQBRQ6.cjs +9 -0
  23. package/dist/ProviderFactory-S3LWTQQC.js +9 -0
  24. package/dist/SessionManager-FEUAU3ZJ.cjs +10 -0
  25. package/dist/SessionManager-IKWAK2PI.js +10 -0
  26. package/dist/SkillsRegistry-GDEGFP6O.cjs +9 -0
  27. package/dist/SkillsRegistry-SI5RUHQ4.js +9 -0
  28. package/dist/SubAgent-I75HELJG.js +11 -0
  29. package/dist/SubAgent-K3QP6WHC.cjs +11 -0
  30. package/dist/{SyncApiClient-AYXYSOJM.js → SyncApiClient-LVIO4C2S.js} +1 -0
  31. package/dist/{SyncApiClient-ID3KXEMA.cjs → SyncApiClient-ZNYMT36M.cjs} +1 -0
  32. package/dist/about-B2AGTV6N.js +12 -0
  33. package/dist/about-V2HWEZZO.cjs +12 -0
  34. package/dist/actionExecutor-6XCVL2SJ.js +19 -0
  35. package/dist/actionExecutor-YRUJNB5G.cjs +19 -0
  36. package/dist/add-dir-7FBQ5IFV.js +10 -0
  37. package/dist/add-dir-ALBSYRV3.cjs +10 -0
  38. package/dist/agents/builtin/code-cleaner.md +14 -0
  39. package/dist/agents/builtin/docs-writer.md +14 -0
  40. package/dist/agents/builtin/researcher.md +14 -0
  41. package/dist/agents/builtin/reviewer.md +15 -0
  42. package/dist/agents/builtin/tester.md +15 -0
  43. package/dist/agents/builtin/todo-resolver.md +15 -0
  44. package/dist/agents-FCGEWTA3.cjs +12 -0
  45. package/dist/agents-FENGUSJD.js +12 -0
  46. package/dist/agents-new-FU3O55CO.js +14 -0
  47. package/dist/agents-new-SAFTJ7TK.cjs +14 -0
  48. package/dist/assets/icon.png +0 -0
  49. package/dist/automode-CYLGXQ4A.cjs +10 -0
  50. package/dist/automode-O7G3DUYN.js +10 -0
  51. package/dist/{cc-UTTLESTY.js → cc-7LEIJ3KF.js} +1 -0
  52. package/dist/{cc-2W6M7J45.cjs → cc-Q5MM4AWC.cjs} +1 -0
  53. package/dist/{chunk-N4ZSG6JJ.cjs → chunk-22D2CNTP.cjs} +2 -2
  54. package/dist/chunk-24QIWILL.js +51 -0
  55. package/dist/{chunk-MYNHJHDZ.js → chunk-2AA5MFES.js} +1 -1
  56. package/dist/{chunk-2JMWWYMZ.js → chunk-2ELK5DMH.js} +44 -10
  57. package/dist/chunk-2JYIR3EC.cjs +1176 -0
  58. package/dist/{chunk-RRZFJIIB.js → chunk-2RIAPTET.js} +90 -66
  59. package/dist/{chunk-TSY7JHIV.cjs → chunk-33A755XB.cjs} +2 -2
  60. package/dist/chunk-3OEDGIFW.js +42 -0
  61. package/dist/{chunk-P5VDZ6PV.js → chunk-3PDTTAKJ.js} +1 -1
  62. package/dist/{chunk-ULMPJUJW.cjs → chunk-3WCOFXQS.cjs} +23 -23
  63. package/dist/{chunk-ONAY5SD2.cjs → chunk-4HKTYHNL.cjs} +22 -16
  64. package/dist/{chunk-Z4J4W6YQ.cjs → chunk-4JNNTOGF.cjs} +2 -48
  65. package/dist/chunk-55B6SBHK.js +260 -0
  66. package/dist/chunk-5DDDUUBM.cjs +29 -0
  67. package/dist/{chunk-TQB222ZB.js → chunk-5EIEWVYX.js} +2 -2
  68. package/dist/{chunk-SMHY3Q7B.cjs → chunk-5GGX6WNY.cjs} +54 -22
  69. package/dist/{chunk-3S4DEIJP.cjs → chunk-5IXII4HX.cjs} +2 -2
  70. package/dist/{chunk-3KBBARKO.js → chunk-5OBNULPU.js} +85 -28
  71. package/dist/{chunk-VVBBEYTH.cjs → chunk-5YJG6H6P.cjs} +10 -10
  72. package/dist/{chunk-PKOAXQKW.cjs → chunk-63WXWFDI.cjs} +11 -11
  73. package/dist/{chunk-DSKVMFRM.cjs → chunk-643VRA5S.cjs} +12 -4
  74. package/dist/{chunk-L5ZFPWHY.js → chunk-6OYHF6MF.js} +12 -4
  75. package/dist/chunk-7GDVDSNI.js +1176 -0
  76. package/dist/chunk-7QEE6SW6.cjs +260 -0
  77. package/dist/chunk-7UOUW76C.js +603 -0
  78. package/dist/{chunk-SZP4ULM5.cjs → chunk-AFN7LH5N.cjs} +17 -17
  79. package/dist/chunk-AHD5JJ6F.cjs +78 -0
  80. package/dist/{chunk-WLTVF77A.js → chunk-ALYU6VTM.js} +1 -1
  81. package/dist/{chunk-BRXIEKJ3.cjs → chunk-AMT2UZBI.cjs} +5 -5
  82. package/dist/{chunk-SFNT5DYE.cjs → chunk-BT35E7NE.cjs} +4 -4
  83. package/dist/{chunk-NUHYCFHW.cjs → chunk-BVKXEQVG.cjs} +54 -65
  84. package/dist/chunk-CDMGQR4L.cjs +4470 -0
  85. package/dist/chunk-CNBKZEX5.cjs +109 -0
  86. package/dist/{chunk-GD4AFYJ3.js → chunk-CVVEYUFR.js} +1 -1
  87. package/dist/chunk-CWALFEGU.js +58 -0
  88. package/dist/{chunk-MTALRU7R.cjs → chunk-D3YCFT5O.cjs} +3 -3
  89. package/dist/{chunk-METF3I6W.cjs → chunk-D6VG7B5X.cjs} +10 -4
  90. package/dist/{chunk-TOTDRAWG.js → chunk-DH7DKCUL.js} +1 -1
  91. package/dist/{chunk-RFNCTE4V.cjs → chunk-DLG43ZJ7.cjs} +2 -2
  92. package/dist/chunk-DN573ME7.cjs +1675 -0
  93. package/dist/{chunk-63BXZQZW.js → chunk-E23CMMNJ.js} +20 -4
  94. package/dist/{chunk-4HA7IHLJ.cjs → chunk-EEGK5DYE.cjs} +32 -16
  95. package/dist/{chunk-DTFR3WD6.js → chunk-EF4LKUQY.js} +1 -1
  96. package/dist/{chunk-PWLLLJHU.js → chunk-EGFT4PGW.js} +3 -1
  97. package/dist/{chunk-S47TCZDL.js → chunk-EIU7K7CM.js} +7 -7
  98. package/dist/{chunk-BISFR6ZL.js → chunk-EPNYD4NV.js} +1 -1
  99. package/dist/chunk-EZMINVLU.js +123 -0
  100. package/dist/{chunk-LYMTYC67.js → chunk-F23EVNJU.js} +2 -2
  101. package/dist/chunk-FHK7UDOJ.cjs +42 -0
  102. package/dist/chunk-FMB3TSWP.cjs +218 -0
  103. package/dist/{chunk-XBUMKEFN.cjs → chunk-FPAE6ORV.cjs} +91 -34
  104. package/dist/{chunk-DEAEO7RI.js → chunk-FYZ67R4R.js} +1 -1
  105. package/dist/{chunk-6SHHB2VD.js → chunk-G7SZIOHF.js} +2 -2
  106. package/dist/{chunk-FB6JWNJS.js → chunk-GBHDROGL.js} +54 -65
  107. package/dist/chunk-GCHELXLO.js +131 -0
  108. package/dist/{chunk-7YX3OD4B.js → chunk-GHSBZ3YB.js} +2 -2
  109. package/dist/chunk-GLBAF54O.js +218 -0
  110. package/dist/chunk-GO3N7LRW.cjs +131 -0
  111. package/dist/{chunk-KW4SQWBU.cjs → chunk-H6ZGZEBG.cjs} +57 -23
  112. package/dist/{chunk-CTJILRNQ.cjs → chunk-HA7OAVOB.cjs} +15 -15
  113. package/dist/{chunk-NMWEDN4Z.js → chunk-HFMLWH7B.js} +108 -0
  114. package/dist/{chunk-D2XFTCRP.js → chunk-HQ7YZKXE.js} +1 -1
  115. package/dist/{chunk-L42HTMMR.cjs → chunk-HTLINWX6.cjs} +2 -2
  116. package/dist/chunk-IETRBBMP.cjs +603 -0
  117. package/dist/chunk-IQ5RXU6O.js +1675 -0
  118. package/dist/{chunk-B5HIJJ4B.js → chunk-ITB3FS72.js} +11 -5
  119. package/dist/{chunk-B6EBHCK2.cjs → chunk-IUMJYXBX.cjs} +6 -6
  120. package/dist/{chunk-ZBIBLOZL.js → chunk-IVM5F2AE.js} +500 -317
  121. package/dist/{chunk-GRSVQ5YZ.js → chunk-IWVQ2EW3.js} +44 -12
  122. package/dist/chunk-JJWCQLOU.cjs +59 -0
  123. package/dist/{chunk-KXAAEROY.js → chunk-JMFDD7IZ.js} +2 -2
  124. package/dist/chunk-JSBRDJBE.js +30 -0
  125. package/dist/chunk-LJFUXC56.cjs +123 -0
  126. package/dist/chunk-LL3PQ2U6.js +4470 -0
  127. package/dist/chunk-LQ4LQQG6.cjs +27 -0
  128. package/dist/chunk-LQGVEP3E.js +109 -0
  129. package/dist/{chunk-425MT6Y5.cjs → chunk-LVE6Z5SL.cjs} +9 -9
  130. package/dist/{chunk-XL77XYI2.cjs → chunk-LXDOQTXQ.cjs} +4 -4
  131. package/dist/{chunk-BG4OQUKP.js → chunk-MBBY4ZIK.js} +1 -1
  132. package/dist/{chunk-XQLWN4Y3.cjs → chunk-MGMXR67S.cjs} +9 -9
  133. package/dist/{chunk-FHUNAB2K.cjs → chunk-MHLE6AVN.cjs} +33 -6
  134. package/dist/chunk-MHSDHPC4.cjs +58 -0
  135. package/dist/chunk-MUBW5UDH.cjs +55 -0
  136. package/dist/{chunk-R3H25HQZ.cjs → chunk-MVWOQBCC.cjs} +11 -11
  137. package/dist/chunk-N254NRHT.cjs +30 -0
  138. package/dist/{chunk-SRLY7K6J.js → chunk-OBLIITWJ.js} +2 -2
  139. package/dist/{chunk-SIGWDEPS.cjs → chunk-OI7OIGNB.cjs} +10 -10
  140. package/dist/{chunk-V7YTCNMN.cjs → chunk-OPR34VHL.cjs} +5 -5
  141. package/dist/chunk-OUHQZFN4.js +78 -0
  142. package/dist/{chunk-HMRDNRTH.js → chunk-PEC45WYS.js} +2 -2
  143. package/dist/{chunk-OSUWEUZE.js → chunk-PUOE5BCN.js} +1 -1
  144. package/dist/chunk-Q2VYSHWU.js +59 -0
  145. package/dist/chunk-Q3MJ6CYS.cjs +193 -0
  146. package/dist/{chunk-B2K7JZRW.js → chunk-Q5RN7RXC.js} +2 -2
  147. package/dist/{chunk-43XS26AQ.cjs → chunk-Q5RX3XGB.cjs} +4 -4
  148. package/dist/chunk-QCLYBIMM.cjs +51 -0
  149. package/dist/chunk-QMAKTSZB.cjs +48 -0
  150. package/dist/chunk-QT2VZNFA.js +29 -0
  151. package/dist/{chunk-3AWZFG5G.js → chunk-QUFAULH7.js} +10 -4
  152. package/dist/{chunk-RJP3SZ7Q.cjs → chunk-RD5XAJR2.cjs} +492 -309
  153. package/dist/chunk-RGR6ME5J.cjs +844 -0
  154. package/dist/{chunk-EOGKE5GD.cjs → chunk-RKJTGGMU.cjs} +221 -126
  155. package/dist/{chunk-NMGF2KUN.js → chunk-RO46YAPI.js} +1 -1
  156. package/dist/{chunk-2U5HFVRO.cjs → chunk-RVUQKMXX.cjs} +108 -0
  157. package/dist/chunk-S52YW5ZQ.js +844 -0
  158. package/dist/{chunk-ZLOTP56B.cjs → chunk-S6BDWWUG.cjs} +5 -5
  159. package/dist/{chunk-6DWXHBAY.js → chunk-SAHBLB3E.js} +222 -127
  160. package/dist/chunk-SALLHB2I.js +27 -0
  161. package/dist/{chunk-GIZL57FE.cjs → chunk-SEKD5FH3.cjs} +3 -1
  162. package/dist/{chunk-DZHR34H6.cjs → chunk-SHFA46CS.cjs} +8 -8
  163. package/dist/{chunk-MILZEEUV.js → chunk-SIHRD34Z.js} +2 -2
  164. package/dist/{chunk-BPTBKO7D.js → chunk-SO3QQJAZ.js} +216 -36
  165. package/dist/{chunk-HSPWX4Z2.cjs → chunk-SRQW3B6J.cjs} +223 -43
  166. package/dist/{chunk-MY3TZER2.js → chunk-T63AMO6H.js} +1 -1
  167. package/dist/{chunk-X765A7J5.js → chunk-TERCG25S.js} +1 -1
  168. package/dist/{chunk-WOGJXDBU.cjs → chunk-TFSRRZWP.cjs} +3 -3
  169. package/dist/{chunk-RRZS5A53.js → chunk-TQHOVHRS.js} +1 -1
  170. package/dist/{chunk-JHOQABEF.js → chunk-TWEKBHUO.js} +5 -5
  171. package/dist/chunk-U3WDY42C.cjs +42 -0
  172. package/dist/{chunk-CKN2BLHK.cjs → chunk-UBS46QL3.cjs} +2 -2
  173. package/dist/{chunk-H3GBSPK5.js → chunk-UGTFKUW4.js} +14 -6
  174. package/dist/chunk-UJTCTTUF.cjs +271 -0
  175. package/dist/{chunk-RUZB43HU.cjs → chunk-UTI6ZQEY.cjs} +22 -14
  176. package/dist/{chunk-OLG7LZBD.js → chunk-VG34MG2U.js} +1 -1
  177. package/dist/{chunk-ZKZRFH37.cjs → chunk-VJYPP6PP.cjs} +6 -6
  178. package/dist/{chunk-YHGTBPEC.js → chunk-VNQ5GL34.js} +1 -1
  179. package/dist/{chunk-XDVG3NM4.js → chunk-W3X6PAC7.js} +2 -48
  180. package/dist/{chunk-FK2DVRPJ.js → chunk-WFUUXADU.js} +2 -2
  181. package/dist/{chunk-R5OO7MEB.cjs → chunk-WGTJOIB7.cjs} +22 -22
  182. package/dist/{chunk-VHBUKGRG.js → chunk-WJDPVW7T.js} +4 -4
  183. package/dist/chunk-WNUVPKBW.js +42 -0
  184. package/dist/{chunk-EV53SLSB.cjs → chunk-WPVWQSL7.cjs} +4 -4
  185. package/dist/chunk-WQ3VJXZB.js +118 -0
  186. package/dist/chunk-WTNBX2JO.js +271 -0
  187. package/dist/chunk-XAV24VYN.js +48 -0
  188. package/dist/chunk-XDLH4EDL.cjs +118 -0
  189. package/dist/{chunk-U7CZFKPL.cjs → chunk-XMNHZRUB.cjs} +2 -2
  190. package/dist/chunk-XUDSXGGV.cjs +1822 -0
  191. package/dist/{chunk-YESQ7XR3.js → chunk-XWASJ2QL.js} +4 -4
  192. package/dist/chunk-Y2SXUCNJ.js +55 -0
  193. package/dist/{chunk-AIH6GUGB.cjs → chunk-YDCDGTK6.cjs} +5 -5
  194. package/dist/chunk-YFXTE422.cjs +92 -0
  195. package/dist/chunk-YKS55CMT.js +1822 -0
  196. package/dist/{chunk-KC5FPUOF.cjs → chunk-YRLYSQEQ.cjs} +2 -2
  197. package/dist/{chunk-JWPI6O5Z.js → chunk-YS34SVY5.js} +31 -4
  198. package/dist/{chunk-FEVHH525.cjs → chunk-YYB42DCU.cjs} +4 -4
  199. package/dist/chunk-ZK6HOR62.js +92 -0
  200. package/dist/{chunk-BHV7CBNT.js → chunk-ZSE42BRE.js} +1 -1
  201. package/dist/clear-ES5WCZRF.cjs +12 -0
  202. package/dist/clear-J7XS6T5W.js +12 -0
  203. package/dist/completion-XQTDTJLK.cjs +14 -0
  204. package/dist/completion-XR6ZONJQ.js +14 -0
  205. package/dist/config-2TB3A55J.js +18 -0
  206. package/dist/config-RDMVIV26.cjs +18 -0
  207. package/dist/constants-6CPCJ3DY.cjs +21 -0
  208. package/dist/{constants-V6J54N3X.js → constants-UFM5B232.js} +2 -1
  209. package/dist/{defaultHooks-WLMRQUXG.cjs → defaultHooks-RCXPHF4M.cjs} +3 -1
  210. package/dist/{defaultHooks-R56VYG7I.js → defaultHooks-RDRMER3Z.js} +2 -0
  211. package/dist/export-EWAYH353.cjs +12 -0
  212. package/dist/export-ZWA6XGVS.js +12 -0
  213. package/dist/extractSessionMemories-SDW2MVBQ.cjs +7 -0
  214. package/dist/extractSessionMemories-V7K42ZHW.js +7 -0
  215. package/dist/feedback-5RV6ODW4.js +15 -0
  216. package/dist/feedback-ZPITHFJR.cjs +15 -0
  217. package/dist/filesystem-3SGCW2BF.js +10 -0
  218. package/dist/filesystem-MCFXJQ6R.cjs +10 -0
  219. package/dist/formatters-6K7QVWQL.cjs +10 -0
  220. package/dist/formatters-DQHO5I36.js +10 -0
  221. package/dist/{help-RU24K66K.js → help-I5GRCA3S.js} +3 -2
  222. package/dist/help-X52PZM24.cjs +12 -0
  223. package/dist/history-4WIOZ4TW.cjs +14 -0
  224. package/dist/{history-AV4XBFRK.js → history-OCHJBJW7.js} +3 -2
  225. package/dist/hooks-IAVTXUAI.cjs +13 -0
  226. package/dist/hooks-YF6HL23E.js +13 -0
  227. package/dist/{i18n-BSAPXM56.js → i18n-KHBXUALK.js} +2 -1
  228. package/dist/i18n-MVQIAZWS.cjs +33 -0
  229. package/dist/ide-4R3BEBIS.js +12 -0
  230. package/dist/ide-C7WSPQTR.cjs +12 -0
  231. package/dist/import-2ICSKDL7.cjs +10 -0
  232. package/dist/import-EAAX5HJR.js +170 -0
  233. package/dist/import-KRVVYJCZ.js +10 -0
  234. package/dist/import-PQJPNXA4.cjs +170 -0
  235. package/dist/index.cjs +8671 -12373
  236. package/dist/index.js +8739 -12441
  237. package/dist/init-6K3NRDOM.js +10 -0
  238. package/dist/init-AOUGGITS.cjs +10 -0
  239. package/dist/language-Q7YFDVSR.cjs +18 -0
  240. package/dist/language-Y6ZC7LET.js +18 -0
  241. package/dist/{lint-44UQJ673.cjs → lint-D5UOJWIK.cjs} +1 -0
  242. package/dist/{lint-TA2ZHVLM.js → lint-NJPZWVN2.js} +1 -0
  243. package/dist/{localProjectPermissions-WQYMGI42.js → localProjectPermissions-N77HA3XK.js} +3 -2
  244. package/dist/localProjectPermissions-UFSMNTBJ.cjs +18 -0
  245. package/dist/login-6OAH2NEH.cjs +20 -0
  246. package/dist/login-DL3377MD.js +20 -0
  247. package/dist/logout-ELQBUMTU.cjs +18 -0
  248. package/dist/logout-TLYA5W45.js +18 -0
  249. package/dist/mcp-BHOIBYUB.js +18 -0
  250. package/dist/mcp-TNUEXR5T.cjs +18 -0
  251. package/dist/{mcp-install-2KVKRAMQ.cjs → mcp-install-GROTZHAW.cjs} +26 -14
  252. package/dist/{mcp-install-77UXRN6R.js → mcp-install-KSADVDBE.js} +21 -9
  253. package/dist/memory-6DRFA43C.js +10 -0
  254. package/dist/memory-IORZE6WF.cjs +10 -0
  255. package/dist/message-JUBOK2VU.js +9 -0
  256. package/dist/message-ZJ5AYAMT.cjs +9 -0
  257. package/dist/model-CJPSPGIC.cjs +10 -0
  258. package/dist/model-MQXC56ES.js +10 -0
  259. package/dist/new-7D2B7IWM.cjs +12 -0
  260. package/dist/new-7VYM36RC.js +12 -0
  261. package/dist/{patch-BAAQIYSW.js → patch-5F6VBIT3.js} +2 -0
  262. package/dist/{patch-J32X2QQP.cjs → patch-MOD7QC3D.cjs} +3 -1
  263. package/dist/permissions-MM77OSFO.js +13 -0
  264. package/dist/permissions-W2F62DJ6.cjs +13 -0
  265. package/dist/{plan-JFGNRL2S.js → plan-G5CEKJI4.js} +1 -0
  266. package/dist/{plan-B3CW5DXJ.cjs → plan-QKOHE3LH.cjs} +1 -0
  267. package/dist/quit-7D2RDGTD.cjs +10 -0
  268. package/dist/quit-PKBSEJOL.js +10 -0
  269. package/dist/registry-A5XLMQVC.cjs +1828 -0
  270. package/dist/registry-WQLWHOLY.js +1828 -0
  271. package/dist/resume-FBKXSDOA.js +13 -0
  272. package/dist/resume-KLPDYPWQ.cjs +13 -0
  273. package/dist/search-7RNYTCNO.js +17 -0
  274. package/dist/search-UESMQZC3.cjs +17 -0
  275. package/dist/{session-T3TAZ5ZU.cjs → session-BSU2L5UI.cjs} +1 -0
  276. package/dist/{session-H5QWKE5E.js → session-SZMRN5KG.js} +1 -0
  277. package/dist/sessions-TSSUFWIJ.cjs +10 -0
  278. package/dist/sessions-WAXBUQTU.js +10 -0
  279. package/dist/settings-D6JXX5RG.js +30 -0
  280. package/dist/settings-RKYGXKDG.cjs +30 -0
  281. package/dist/share-GLX4YHS4.cjs +14 -0
  282. package/dist/share-U2M2KBFJ.js +14 -0
  283. package/dist/skills-63QLZMUO.cjs +14 -0
  284. package/dist/{skills-LJZA6PVJ.js → skills-BAMMXP3Q.js} +3 -2
  285. package/dist/{skills-install-MQINL3EC.js → skills-install-QNQWC2MV.js} +99 -28
  286. package/dist/{skills-install-IKJZN4G2.cjs → skills-install-UMK5H3SO.cjs} +107 -36
  287. package/dist/skills-new-NYKNHJHV.cjs +15 -0
  288. package/dist/skills-new-NZFGFKML.js +15 -0
  289. package/dist/slashCommands-EJ23C3Z4.cjs +69 -0
  290. package/dist/slashCommands-JQIL4EWX.js +69 -0
  291. package/dist/status-BKC7GBNQ.js +11 -0
  292. package/dist/status-FU3CPJWQ.cjs +11 -0
  293. package/dist/sync-3IEIHXIP.cjs +18 -0
  294. package/dist/sync-7JMZVEQD.cjs +40 -0
  295. package/dist/{sync-EXYX7HXW.js → sync-KWX67OUN.js} +3 -2
  296. package/dist/sync-YVPFT7SL.js +18 -0
  297. package/dist/tasks-5FPBIFLC.js +9 -0
  298. package/dist/tasks-TXGKGNH6.cjs +9 -0
  299. package/dist/team-GVK5L73L.cjs +9 -0
  300. package/dist/team-RWIKCLTG.js +9 -0
  301. package/dist/teammate-3C4MLRGH.js +139 -0
  302. package/dist/teammate-7C3UDQSH.cjs +139 -0
  303. package/dist/theme-A2CEHI7W.js +18 -0
  304. package/dist/theme-LNOQOVR4.cjs +18 -0
  305. package/dist/ui/questionModal.cjs +7 -25
  306. package/dist/ui/questionModal.js +6 -24
  307. package/dist/undo-F2IZJQUV.js +10 -0
  308. package/dist/undo-QEV42XLU.cjs +10 -0
  309. package/dist/update-TVAJMMBC.js +82 -0
  310. package/dist/update-Z6BIIQDC.cjs +82 -0
  311. package/package.json +10 -4
  312. package/dist/CommunitySkillsCache-ILWHWE5P.js +0 -7
  313. package/dist/CommunitySkillsCache-KHC6RUJW.cjs +0 -7
  314. package/dist/HookManager-X47HCM5G.cjs +0 -6
  315. package/dist/HookManager-ZXKHCD7U.js +0 -6
  316. package/dist/MemoryManager-6ZT7IDO5.cjs +0 -7
  317. package/dist/MemoryManager-AJGS5AKB.js +0 -7
  318. package/dist/PermissionManager-HG6W2DGU.cjs +0 -10
  319. package/dist/SessionManager-BJ2G6VV4.cjs +0 -9
  320. package/dist/SessionManager-ENPGYK5J.js +0 -9
  321. package/dist/SkillsRegistry-6ZFOCT25.cjs +0 -8
  322. package/dist/SkillsRegistry-C2SHOZ5D.js +0 -8
  323. package/dist/about-BIZH6I2U.cjs +0 -11
  324. package/dist/about-PPIVMAPA.js +0 -11
  325. package/dist/add-dir-7FD4DMDA.cjs +0 -9
  326. package/dist/add-dir-LOYJ4YB5.js +0 -9
  327. package/dist/agents-2Y6ASV7C.js +0 -10
  328. package/dist/agents-UOSPKLQL.cjs +0 -10
  329. package/dist/agents-new-23NSGAM5.js +0 -13
  330. package/dist/agents-new-WI2EL7IJ.cjs +0 -13
  331. package/dist/automode-LGWTY3UX.js +0 -9
  332. package/dist/automode-WLBQ7MN7.cjs +0 -9
  333. package/dist/chunk-5UBW2BGC.js +0 -33
  334. package/dist/chunk-AXP53LTU.cjs +0 -169
  335. package/dist/chunk-IZBCMJHJ.cjs +0 -33
  336. package/dist/completion-7WGMHKOR.cjs +0 -13
  337. package/dist/completion-KH33NSGP.js +0 -13
  338. package/dist/constants-RBQTR32A.cjs +0 -20
  339. package/dist/export-3QN3IH7A.js +0 -11
  340. package/dist/export-BI54X3MP.cjs +0 -11
  341. package/dist/feedback-TBF2CUJR.js +0 -14
  342. package/dist/feedback-XXHPSUUO.cjs +0 -14
  343. package/dist/formatters-N5IJKYZY.cjs +0 -8
  344. package/dist/formatters-UG6VZJJ5.js +0 -8
  345. package/dist/help-4VSLIMP4.cjs +0 -11
  346. package/dist/history-73VBEMSI.cjs +0 -13
  347. package/dist/hooks-62UDQBGH.cjs +0 -12
  348. package/dist/hooks-XORDJD5X.js +0 -12
  349. package/dist/i18n-X2IU2EZD.cjs +0 -32
  350. package/dist/ide-RPKZALQV.js +0 -11
  351. package/dist/ide-YMNXJB6A.cjs +0 -11
  352. package/dist/init-J5HR4R7U.js +0 -9
  353. package/dist/init-JCC7RVMC.cjs +0 -9
  354. package/dist/language-AZISJCEZ.js +0 -16
  355. package/dist/language-F65RA6FZ.cjs +0 -16
  356. package/dist/localProjectPermissions-2EATUDZM.cjs +0 -17
  357. package/dist/login-5HLPMECE.js +0 -18
  358. package/dist/login-ISWYYBXP.cjs +0 -18
  359. package/dist/logout-3EKZM5J3.cjs +0 -16
  360. package/dist/logout-GE7TSZ24.js +0 -16
  361. package/dist/mcp-EW64QRFA.cjs +0 -15
  362. package/dist/mcp-VHS7AMF2.js +0 -15
  363. package/dist/memory-2I473RU3.js +0 -9
  364. package/dist/memory-JZ6NPSP3.cjs +0 -9
  365. package/dist/model-GXZLARPT.js +0 -9
  366. package/dist/model-Y274DBDO.cjs +0 -9
  367. package/dist/new-BG5VIGZ7.cjs +0 -9
  368. package/dist/new-YXFDQOA7.js +0 -9
  369. package/dist/permissions-QILEAGBP.cjs +0 -12
  370. package/dist/permissions-WVEOVMWO.js +0 -12
  371. package/dist/quit-NC32OEJG.cjs +0 -9
  372. package/dist/quit-WRRIGU33.js +0 -9
  373. package/dist/resume-GJIKIDPR.cjs +0 -12
  374. package/dist/resume-RMJNCAOK.js +0 -12
  375. package/dist/search-UIWIXB73.js +0 -14
  376. package/dist/search-WQNXDA2E.cjs +0 -14
  377. package/dist/sessions-HPFX2GDD.js +0 -9
  378. package/dist/sessions-SAQU6MFA.cjs +0 -9
  379. package/dist/share-IE6UTPKF.cjs +0 -13
  380. package/dist/share-NQXIMFSQ.js +0 -13
  381. package/dist/skills-YTYGART7.cjs +0 -13
  382. package/dist/skills-new-3WCU3CWB.js +0 -14
  383. package/dist/skills-new-O5LFVFZU.cjs +0 -14
  384. package/dist/slashCommands-3FFAL4SL.js +0 -55
  385. package/dist/slashCommands-JASFW3E4.cjs +0 -55
  386. package/dist/status-4NDGXPIM.js +0 -10
  387. package/dist/status-RHJIBHP2.cjs +0 -10
  388. package/dist/sync-3GFSEIAZ.js +0 -16
  389. package/dist/sync-6M3WRKMH.cjs +0 -39
  390. package/dist/sync-CQNQDNTJ.cjs +0 -16
  391. package/dist/theme-EMJGULMI.cjs +0 -16
  392. package/dist/theme-FGDSXNU3.js +0 -16
  393. package/dist/undo-CTXQYE7C.cjs +0 -9
  394. package/dist/undo-HX2ZMECP.js +0 -9
@@ -0,0 +1,1822 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return 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; }
2
+
3
+ var _chunkBVKXEQVGcjs = require('./chunk-BVKXEQVG.cjs');
4
+
5
+
6
+ var _chunkCNBKZEX5cjs = require('./chunk-CNBKZEX5.cjs');
7
+
8
+
9
+ var _chunkULQ6MDSJcjs = require('./chunk-ULQ6MDSJ.cjs');
10
+
11
+ // src/core/agents/SubAgent.ts
12
+ var _chalk = require('chalk'); var _chalk2 = _interopRequireDefault(_chalk);
13
+
14
+ // src/core/toolFilter.ts
15
+ var TOOL_CATEGORIES = {
16
+ // Meta tools
17
+ tools_registry: "meta",
18
+ plan: "meta",
19
+ todo_write: "meta",
20
+ smart_context_cropper: "meta",
21
+ save_memory: "meta",
22
+ recall_memory: "meta",
23
+ create_meta_tool: "meta",
24
+ delegate_task: "meta",
25
+ delegate_parallel: "meta",
26
+ create_team: "meta",
27
+ add_teammate: "meta",
28
+ create_task: "meta",
29
+ team_status: "meta",
30
+ send_team_message: "meta",
31
+ ask_followup_question: "meta",
32
+ // Read operations
33
+ read_file: "read",
34
+ search: "read",
35
+ search_with_context: "read",
36
+ semantic_search: "read",
37
+ list_tree: "read",
38
+ file_stats: "read",
39
+ checksum: "read",
40
+ // Write operations
41
+ write_file: "write",
42
+ append_file: "write",
43
+ apply_patch: "write",
44
+ search_replace: "write",
45
+ format_file: "write",
46
+ multi_file_edit: "write",
47
+ // Create operations
48
+ create_directory: "create",
49
+ copy_path: "create",
50
+ rename_path: "create",
51
+ add_dependency: "create",
52
+ // Delete operations
53
+ delete_path: "delete",
54
+ remove_dependency: "delete",
55
+ // Git read operations
56
+ git_diff: "git_read",
57
+ git_status: "git_read",
58
+ git_list_untracked: "git_read",
59
+ git_diff_range: "git_read",
60
+ git_stash_list: "git_read",
61
+ git_branch: "git_read",
62
+ git_log: "git_read",
63
+ git_worktree_list: "git_read",
64
+ git_worktree_status_all: "git_read",
65
+ // Git write operations
66
+ git_checkout: "git_write",
67
+ git_apply_patch: "git_write",
68
+ git_worktree_add: "git_write",
69
+ git_worktree_remove: "git_write",
70
+ git_worktree_cleanup: "git_write",
71
+ git_worktree_run_parallel: "git_write",
72
+ git_worktree_sync: "git_write",
73
+ git_worktree_create_for_pr: "git_write",
74
+ git_worktree_create_from_template: "git_write",
75
+ git_stash: "git_write",
76
+ git_stash_pop: "git_write",
77
+ git_stash_apply: "git_write",
78
+ git_stash_drop: "git_write",
79
+ git_switch: "git_write",
80
+ git_cherry_pick: "git_write",
81
+ git_cherry_pick_abort: "git_write",
82
+ git_cherry_pick_continue: "git_write",
83
+ git_rebase: "git_write",
84
+ git_rebase_abort: "git_write",
85
+ git_rebase_continue: "git_write",
86
+ git_rebase_skip: "git_write",
87
+ git_merge: "git_write",
88
+ git_merge_abort: "git_write",
89
+ git_commit: "git_write",
90
+ git_add: "git_write",
91
+ git_reset: "git_write",
92
+ git_fetch: "git_write",
93
+ git_pull: "git_write",
94
+ git_push: "git_write",
95
+ // Shell operations
96
+ run_command: "shell",
97
+ custom_command: "shell"
98
+ };
99
+ var CONTEXT_POLICIES = {
100
+ // CLI: Full access to everything
101
+ cli: {
102
+ allowedCategories: ["read", "write", "create", "delete", "git_read", "git_write", "shell", "meta"]
103
+ },
104
+ // Slack: Chat-based, no file exploration or shell access
105
+ // Focuses on answering questions and simple operations
106
+ slack: {
107
+ allowedCategories: ["meta", "git_read"],
108
+ blockedTools: [
109
+ "list_tree",
110
+ // Don't expose directory structure
111
+ "search",
112
+ // Don't allow broad searches
113
+ "search_with_context",
114
+ // Don't allow broad searches
115
+ "semantic_search",
116
+ // Don't allow broad searches
117
+ "run_command",
118
+ // No shell access
119
+ "custom_command",
120
+ // No shell access
121
+ "file_stats",
122
+ // Don't expose file metadata
123
+ "checksum",
124
+ // Don't expose file checksums
125
+ "ask_followup_question"
126
+ // Requires interactive terminal
127
+ ]
128
+ },
129
+ // API: Programmatic access with sensible defaults
130
+ // Allows most operations except dangerous ones
131
+ api: {
132
+ allowedCategories: ["read", "write", "create", "git_read", "git_write", "meta"],
133
+ blockedTools: [
134
+ "delete_path",
135
+ // No deletions via API
136
+ "run_command",
137
+ // No shell access
138
+ "custom_command",
139
+ // No shell access
140
+ "git_push",
141
+ // No pushing via API
142
+ "git_reset",
143
+ // No resets via API
144
+ "ask_followup_question"
145
+ // Requires interactive terminal
146
+ ],
147
+ requireApprovalFor: [
148
+ "git_commit",
149
+ "git_merge",
150
+ "git_rebase"
151
+ ]
152
+ },
153
+ // Restricted: Read-only mode
154
+ restricted: {
155
+ allowedCategories: ["read", "git_read", "meta"],
156
+ blockedTools: [
157
+ "list_tree",
158
+ // Even in read mode, don't expose full structure
159
+ "ask_followup_question"
160
+ // Requires interactive terminal (may be running in restricted non-interactive mode)
161
+ ]
162
+ }
163
+ };
164
+ function getToolCategory(toolName) {
165
+ return _nullishCoalesce(TOOL_CATEGORIES[toolName], () => ( "meta"));
166
+ }
167
+ var ToolFilter = class {
168
+ constructor(context = "cli", customPolicy) {
169
+ this.context = context;
170
+ const basePolicy = CONTEXT_POLICIES[context];
171
+ this.policy = {
172
+ ...basePolicy,
173
+ ...customPolicy,
174
+ allowedCategories: _nullishCoalesce(_optionalChain([customPolicy, 'optionalAccess', _ => _.allowedCategories]), () => ( basePolicy.allowedCategories)),
175
+ blockedTools: [
176
+ ..._nullishCoalesce(basePolicy.blockedTools, () => ( [])),
177
+ ..._nullishCoalesce(_optionalChain([customPolicy, 'optionalAccess', _2 => _2.blockedTools]), () => ( []))
178
+ ],
179
+ allowedTools: _optionalChain([customPolicy, 'optionalAccess', _3 => _3.allowedTools]),
180
+ requireApprovalFor: [
181
+ ..._nullishCoalesce(basePolicy.requireApprovalFor, () => ( [])),
182
+ ..._nullishCoalesce(_optionalChain([customPolicy, 'optionalAccess', _4 => _4.requireApprovalFor]), () => ( []))
183
+ ]
184
+ };
185
+ }
186
+ /**
187
+ * Check if a tool is allowed in the current context
188
+ */
189
+ isAllowed(toolName) {
190
+ if (this.policy.allowedTools && this.policy.allowedTools.length > 0) {
191
+ return this.policy.allowedTools.includes(toolName);
192
+ }
193
+ if (_optionalChain([this, 'access', _5 => _5.policy, 'access', _6 => _6.blockedTools, 'optionalAccess', _7 => _7.includes, 'call', _8 => _8(toolName)])) {
194
+ return false;
195
+ }
196
+ const category = getToolCategory(toolName);
197
+ return this.policy.allowedCategories.includes(category);
198
+ }
199
+ /**
200
+ * Check if a tool requires approval (beyond its default setting)
201
+ */
202
+ requiresApproval(toolName, defaultRequiresApproval) {
203
+ if (_optionalChain([this, 'access', _9 => _9.policy, 'access', _10 => _10.requireApprovalFor, 'optionalAccess', _11 => _11.includes, 'call', _12 => _12(toolName)])) {
204
+ return true;
205
+ }
206
+ return _nullishCoalesce(defaultRequiresApproval, () => ( false));
207
+ }
208
+ /**
209
+ * Filter a list of tool definitions
210
+ */
211
+ filterDefinitions(definitions) {
212
+ return definitions.filter((def) => this.isAllowed(def.name)).map((def) => ({
213
+ ...def,
214
+ requiresApproval: this.requiresApproval(def.name, def.requiresApproval)
215
+ }));
216
+ }
217
+ /**
218
+ * Get the current context
219
+ */
220
+ getContext() {
221
+ return this.context;
222
+ }
223
+ /**
224
+ * Get a summary of what's allowed/blocked for logging
225
+ */
226
+ getSummary() {
227
+ const allTools = Object.keys(TOOL_CATEGORIES);
228
+ const allowed = allTools.filter((t) => this.isAllowed(t));
229
+ const blocked = allTools.filter((t) => !this.isAllowed(t));
230
+ return {
231
+ allowed,
232
+ blocked,
233
+ categories: this.policy.allowedCategories
234
+ };
235
+ }
236
+ };
237
+ var RELEVANCE_CATEGORIES = {
238
+ // Always include
239
+ read_file: "always",
240
+ write_file: "always",
241
+ search: "always",
242
+ list_tree: "always",
243
+ plan: "always",
244
+ run_command: "always",
245
+ todo_write: "always",
246
+ // Filesystem
247
+ append_file: "filesystem",
248
+ apply_patch: "filesystem",
249
+ create_directory: "filesystem",
250
+ delete_path: "filesystem",
251
+ rename_path: "filesystem",
252
+ copy_path: "filesystem",
253
+ search_replace: "filesystem",
254
+ format_file: "filesystem",
255
+ file_stats: "filesystem",
256
+ checksum: "filesystem",
257
+ multi_file_edit: "filesystem",
258
+ search_with_context: "search",
259
+ semantic_search: "search",
260
+ // Basic git
261
+ git_diff: "git_basic",
262
+ git_status: "git_basic",
263
+ git_list_untracked: "git_basic",
264
+ git_add: "git_basic",
265
+ git_commit: "git_basic",
266
+ git_log: "git_basic",
267
+ git_branch: "git_basic",
268
+ git_switch: "git_basic",
269
+ git_checkout: "git_basic",
270
+ git_diff_range: "git_basic",
271
+ git_apply_patch: "git_basic",
272
+ git_fetch: "git_basic",
273
+ git_pull: "git_basic",
274
+ git_push: "git_basic",
275
+ git_stash: "git_basic",
276
+ git_stash_list: "git_basic",
277
+ git_stash_pop: "git_basic",
278
+ git_stash_apply: "git_basic",
279
+ git_stash_drop: "git_basic",
280
+ // Advanced git
281
+ git_merge: "git_advanced",
282
+ git_merge_abort: "git_advanced",
283
+ git_rebase: "git_advanced",
284
+ git_rebase_abort: "git_advanced",
285
+ git_rebase_continue: "git_advanced",
286
+ git_rebase_skip: "git_advanced",
287
+ git_cherry_pick: "git_advanced",
288
+ git_cherry_pick_abort: "git_advanced",
289
+ git_cherry_pick_continue: "git_advanced",
290
+ git_reset: "git_advanced",
291
+ git_worktree_list: "git_advanced",
292
+ git_worktree_add: "git_advanced",
293
+ git_worktree_remove: "git_advanced",
294
+ git_worktree_status_all: "git_advanced",
295
+ git_worktree_cleanup: "git_advanced",
296
+ git_worktree_run_parallel: "git_advanced",
297
+ git_worktree_sync: "git_advanced",
298
+ git_worktree_create_for_pr: "git_advanced",
299
+ git_worktree_create_from_template: "git_advanced",
300
+ // Dependencies
301
+ add_dependency: "dependencies",
302
+ remove_dependency: "dependencies",
303
+ // Meta
304
+ tools_registry: "meta",
305
+ save_memory: "meta",
306
+ recall_memory: "meta",
307
+ smart_context_cropper: "meta",
308
+ create_meta_tool: "meta",
309
+ custom_command: "meta",
310
+ delegate_task: "meta",
311
+ delegate_parallel: "meta",
312
+ create_team: "meta",
313
+ add_teammate: "meta",
314
+ create_task: "meta",
315
+ team_status: "meta",
316
+ send_team_message: "meta",
317
+ ask_followup_question: "always"
318
+ // User interaction should always be available when in interactive mode
319
+ };
320
+ var CATEGORY_TRIGGERS = {
321
+ always: [],
322
+ filesystem: ["file", "directory", "folder", "create", "delete", "rename", "copy", "move", "format", "edit"],
323
+ git_basic: ["git", "commit", "branch", "diff", "status", "stash", "pull", "push"],
324
+ git_advanced: ["merge", "rebase", "cherry-pick", "worktree", "reset"],
325
+ search: ["search", "find", "grep", "look for", "locate", "where is"],
326
+ dependencies: ["dependency", "dependencies", "package", "npm", "install", "yarn", "bun add"],
327
+ meta: [
328
+ "tool",
329
+ "delegate",
330
+ "agent",
331
+ "remember",
332
+ "memory",
333
+ "recall",
334
+ "team",
335
+ "teammate",
336
+ "together",
337
+ "engineers",
338
+ "crew",
339
+ "collaborate"
340
+ ]
341
+ };
342
+ function detectRelevantCategories(messages) {
343
+ const categories = /* @__PURE__ */ new Set(["always"]);
344
+ const recentMessages = messages.slice(-8);
345
+ const recentText = recentMessages.map((m) => _nullishCoalesce(m.content, () => ( ""))).join(" ").toLowerCase();
346
+ for (const [category, triggers] of Object.entries(CATEGORY_TRIGGERS)) {
347
+ if (triggers.some((trigger) => recentText.includes(trigger))) {
348
+ categories.add(category);
349
+ }
350
+ }
351
+ for (const msg of recentMessages) {
352
+ if (msg.tool_calls) {
353
+ for (const call of msg.tool_calls) {
354
+ const category = RELEVANCE_CATEGORIES[call.function.name];
355
+ if (category) {
356
+ categories.add(category);
357
+ }
358
+ }
359
+ }
360
+ if (msg.role === "tool" && msg.name) {
361
+ const category = RELEVANCE_CATEGORIES[msg.name];
362
+ if (category) {
363
+ categories.add(category);
364
+ }
365
+ }
366
+ }
367
+ return categories;
368
+ }
369
+ function filterToolsByRelevance(tools, messages) {
370
+ const relevantCategories = detectRelevantCategories(messages);
371
+ return tools.filter((tool) => {
372
+ const category = RELEVANCE_CATEGORIES[tool.name];
373
+ return !category || relevantCategories.has(category);
374
+ });
375
+ }
376
+
377
+ // src/core/toolManager.ts
378
+ var DEFAULT_TOOL_DEFINITIONS = [
379
+ {
380
+ name: "tools_registry",
381
+ description: "List all available tools (built-in and meta)"
382
+ },
383
+ {
384
+ name: "plan",
385
+ description: 'Create a structured implementation plan with detailed numbered steps before executing a task. Always break the task into concrete, actionable steps (e.g. "1. Read existing auth code\\n2. Create JWT utility module\\n3. Add login endpoint"). Each step should be a single clear action. Aim for 3-10 steps depending on complexity.',
386
+ parameters: {
387
+ type: "object",
388
+ properties: {
389
+ notes: {
390
+ type: "string",
391
+ description: 'A numbered step-by-step plan. Each step on its own line starting with "N. " (e.g. "1. Read existing code\\n2. Create new module\\n3. Write tests"). Be specific and actionable - avoid single vague descriptions.'
392
+ }
393
+ }
394
+ }
395
+ },
396
+ {
397
+ name: "ask_followup_question",
398
+ description: "Ask the user a follow-up question to gather clarification or preferences. Use when you need specific information to proceed. Include suggested answers when possible to guide the response. Only available in interactive and plan mode.",
399
+ parameters: {
400
+ type: "object",
401
+ properties: {
402
+ question: { type: "string", description: "The specific question to ask the user" },
403
+ suggested_answers: {
404
+ type: "array",
405
+ description: "Optional list of 2-4 suggested answers to guide the user response",
406
+ items: { type: "string", description: "A suggested answer option" }
407
+ }
408
+ },
409
+ required: ["question"]
410
+ },
411
+ requiresApproval: false
412
+ // User interaction, not a mutation
413
+ },
414
+ {
415
+ name: "read_file",
416
+ description: "Read file contents. For large files (>2500 lines), use offset and limit to read in chunks.",
417
+ parameters: {
418
+ type: "object",
419
+ properties: {
420
+ path: { type: "string", description: "Relative path to the file to read" },
421
+ offset: { type: "number", description: "Line number to start reading from (0-indexed). Use for large files." },
422
+ limit: { type: "number", description: "Maximum number of lines to read. Use for large files." }
423
+ },
424
+ required: ["path"]
425
+ }
426
+ },
427
+ {
428
+ name: "write_file",
429
+ description: "Write full contents to a file",
430
+ parameters: {
431
+ type: "object",
432
+ properties: {
433
+ path: { type: "string", description: "Relative path to the file" },
434
+ contents: { type: "string", description: "Full file contents to write" }
435
+ },
436
+ required: ["path", "contents"]
437
+ }
438
+ },
439
+ {
440
+ name: "append_file",
441
+ description: "Append text to a file",
442
+ parameters: {
443
+ type: "object",
444
+ properties: {
445
+ path: { type: "string", description: "Relative path to the file" },
446
+ contents: { type: "string", description: "Text to append" }
447
+ },
448
+ required: ["path", "contents"]
449
+ }
450
+ },
451
+ {
452
+ name: "apply_patch",
453
+ description: "Apply a unified diff to a file",
454
+ parameters: {
455
+ type: "object",
456
+ properties: {
457
+ path: { type: "string", description: "Relative path to the file" },
458
+ patch: { type: "string", description: "Unified diff patch content" }
459
+ },
460
+ required: ["path", "patch"]
461
+ }
462
+ },
463
+ {
464
+ name: "search",
465
+ description: "Search workspace text",
466
+ parameters: {
467
+ type: "object",
468
+ properties: {
469
+ query: { type: "string", description: "Text to search for" },
470
+ path: { type: "string", description: "Optional relative path to search in" }
471
+ },
472
+ required: ["query"]
473
+ }
474
+ },
475
+ {
476
+ name: "search_with_context",
477
+ description: "Search workspace text with surrounding context",
478
+ parameters: {
479
+ type: "object",
480
+ properties: {
481
+ query: { type: "string", description: "Text to search for" },
482
+ path: { type: "string", description: "Optional relative path to search in" },
483
+ context: { type: "number", description: "Number of context lines (default 2)" },
484
+ limit: { type: "number", description: "Maximum results (default 10)" }
485
+ },
486
+ required: ["query"]
487
+ }
488
+ },
489
+ {
490
+ name: "semantic_search",
491
+ description: "Search workspace text semantically with gitignore awareness",
492
+ parameters: {
493
+ type: "object",
494
+ properties: {
495
+ query: { type: "string", description: "Text to search for" },
496
+ path: { type: "string", description: "Optional relative path to search in" },
497
+ limit: { type: "number", description: "Maximum results (default 5)" },
498
+ window: { type: "number", description: "Context window size (default 400)" }
499
+ },
500
+ required: ["query"]
501
+ }
502
+ },
503
+ {
504
+ name: "create_directory",
505
+ description: "Create a directory",
506
+ parameters: {
507
+ type: "object",
508
+ properties: {
509
+ path: { type: "string", description: "Relative path for new directory" }
510
+ },
511
+ required: ["path"]
512
+ }
513
+ },
514
+ {
515
+ name: "delete_path",
516
+ description: "Remove files or directories from the workspace",
517
+ parameters: {
518
+ type: "object",
519
+ properties: {
520
+ path: { type: "string", description: "Relative path to delete" }
521
+ },
522
+ required: ["path"]
523
+ },
524
+ requiresApproval: true
525
+ },
526
+ {
527
+ name: "rename_path",
528
+ description: "Rename a file or directory",
529
+ parameters: {
530
+ type: "object",
531
+ properties: {
532
+ from: { type: "string", description: "Current relative path" },
533
+ to: { type: "string", description: "New relative path" }
534
+ },
535
+ required: ["from", "to"]
536
+ }
537
+ },
538
+ {
539
+ name: "copy_path",
540
+ description: "Copy a file or directory",
541
+ parameters: {
542
+ type: "object",
543
+ properties: {
544
+ from: { type: "string", description: "Source relative path" },
545
+ to: { type: "string", description: "Destination relative path" }
546
+ },
547
+ required: ["from", "to"]
548
+ }
549
+ },
550
+ {
551
+ name: "search_replace",
552
+ description: "Apply precise text replacements using SEARCH/REPLACE blocks. SEARCH must match exactly. Multiple blocks applied in sequence.",
553
+ parameters: {
554
+ type: "object",
555
+ properties: {
556
+ path: { type: "string", description: "File path" },
557
+ blocks: { type: "string", description: "SEARCH/REPLACE block content" }
558
+ },
559
+ required: ["path", "blocks"]
560
+ }
561
+ },
562
+ {
563
+ name: "run_command",
564
+ description: "Execute shell commands with optional directory, background mode, and description. Prefer dedicated tools: read_file over cat, search over grep, search_replace over sed.",
565
+ parameters: {
566
+ type: "object",
567
+ properties: {
568
+ command: { type: "string", description: "Command to execute" },
569
+ args: { type: "array", description: "Command arguments", items: { type: "string", description: "Single argument" } },
570
+ directory: { type: "string", description: "Directory relative to workspace root to execute in" },
571
+ description: { type: "string", description: "Brief description of what this command does (shown to user)" },
572
+ background: { type: "boolean", description: "Run process in background (returns PID, useful for dev servers)" }
573
+ },
574
+ required: ["command"]
575
+ },
576
+ requiresApproval: true,
577
+ approvalMessage: "Allow the agent to run a shell command?"
578
+ },
579
+ {
580
+ name: "add_dependency",
581
+ description: "Add a package dependency (supports dev flag)",
582
+ parameters: {
583
+ type: "object",
584
+ properties: {
585
+ name: { type: "string", description: "Package name" },
586
+ version: { type: "string", description: "Version specifier" },
587
+ dev: { type: "boolean", description: "Install as dev dependency" }
588
+ },
589
+ required: ["name"]
590
+ }
591
+ },
592
+ {
593
+ name: "remove_dependency",
594
+ description: "Remove a package dependency (supports dev flag)",
595
+ parameters: {
596
+ type: "object",
597
+ properties: {
598
+ name: { type: "string", description: "Package name" },
599
+ dev: { type: "boolean", description: "Remove from dev dependencies" }
600
+ },
601
+ required: ["name"]
602
+ }
603
+ },
604
+ {
605
+ name: "format_file",
606
+ description: "Format a file with a named formatter",
607
+ parameters: {
608
+ type: "object",
609
+ properties: {
610
+ path: { type: "string", description: "Relative path to the file" },
611
+ formatter: { type: "string", description: "Formatter name (prettier, eslint, etc.)" }
612
+ },
613
+ required: ["path", "formatter"]
614
+ }
615
+ },
616
+ {
617
+ name: "list_tree",
618
+ description: "List a directory tree for the workspace",
619
+ parameters: {
620
+ type: "object",
621
+ properties: {
622
+ path: { type: "string", description: "Relative path (default: workspace root)" },
623
+ depth: { type: "number", description: "Maximum depth (default: 2)" }
624
+ }
625
+ }
626
+ },
627
+ {
628
+ name: "file_stats",
629
+ description: "Return file statistics and metadata",
630
+ parameters: {
631
+ type: "object",
632
+ properties: {
633
+ path: { type: "string", description: "Relative path to the file" }
634
+ },
635
+ required: ["path"]
636
+ }
637
+ },
638
+ {
639
+ name: "checksum",
640
+ description: "Compute a checksum for a file",
641
+ parameters: {
642
+ type: "object",
643
+ properties: {
644
+ path: { type: "string", description: "Relative path to the file" },
645
+ algorithm: { type: "string", description: "Hash algorithm (default: sha256)" }
646
+ },
647
+ required: ["path"]
648
+ }
649
+ },
650
+ {
651
+ name: "git_diff",
652
+ description: "Show git diff for a file",
653
+ parameters: {
654
+ type: "object",
655
+ properties: {
656
+ path: { type: "string", description: "Relative path to the file" }
657
+ },
658
+ required: ["path"]
659
+ }
660
+ },
661
+ {
662
+ name: "git_checkout",
663
+ description: "Restore a file from git",
664
+ parameters: {
665
+ type: "object",
666
+ properties: {
667
+ path: { type: "string", description: "Relative path to the file" }
668
+ },
669
+ required: ["path"]
670
+ }
671
+ },
672
+ {
673
+ name: "git_status",
674
+ description: "Show git status for the workspace"
675
+ },
676
+ {
677
+ name: "git_list_untracked",
678
+ description: "List untracked git files"
679
+ },
680
+ {
681
+ name: "git_diff_range",
682
+ description: "Show git diff for a range or staged files",
683
+ parameters: {
684
+ type: "object",
685
+ properties: {
686
+ range: { type: "string", description: "Commit range (e.g., HEAD~3..HEAD)" },
687
+ staged: { type: "boolean", description: "Show staged changes only" },
688
+ paths: { type: "array", description: "Specific paths to diff", items: { type: "string", description: "Path to diff" } }
689
+ }
690
+ }
691
+ },
692
+ {
693
+ name: "git_apply_patch",
694
+ description: "Apply a git patch to the working tree",
695
+ parameters: {
696
+ type: "object",
697
+ properties: {
698
+ patch: { type: "string", description: "Git patch content" }
699
+ },
700
+ required: ["patch"]
701
+ },
702
+ requiresApproval: true
703
+ },
704
+ {
705
+ name: "git_worktree_list",
706
+ description: "List git worktrees"
707
+ },
708
+ {
709
+ name: "git_worktree_add",
710
+ description: "Add a git worktree (may modify git state)",
711
+ parameters: {
712
+ type: "object",
713
+ properties: {
714
+ path: { type: "string", description: "Path for the new worktree" },
715
+ ref: { type: "string", description: "Branch or commit to checkout" }
716
+ },
717
+ required: ["path"]
718
+ },
719
+ requiresApproval: true
720
+ },
721
+ {
722
+ name: "git_worktree_remove",
723
+ description: "Remove a git worktree",
724
+ parameters: {
725
+ type: "object",
726
+ properties: {
727
+ path: { type: "string", description: "Path of the worktree to remove" },
728
+ force: { type: "boolean", description: "Force removal" }
729
+ },
730
+ required: ["path"]
731
+ },
732
+ requiresApproval: true
733
+ },
734
+ {
735
+ name: "git_worktree_status_all",
736
+ description: "Get comprehensive status of all worktrees (changes, commits, sync state)"
737
+ },
738
+ {
739
+ name: "git_worktree_cleanup",
740
+ description: "Find and clean up stale/merged worktrees",
741
+ parameters: {
742
+ type: "object",
743
+ properties: {
744
+ dry_run: { type: "boolean", description: "Preview without removing" },
745
+ remove_merged: { type: "boolean", description: "Remove merged branches" },
746
+ remove_stale: { type: "boolean", description: "Remove stale worktrees" }
747
+ }
748
+ },
749
+ requiresApproval: true
750
+ },
751
+ {
752
+ name: "git_worktree_run_parallel",
753
+ description: "Run a command in parallel across all worktrees",
754
+ parameters: {
755
+ type: "object",
756
+ properties: {
757
+ command: { type: "string", description: "Command to run" },
758
+ timeout: { type: "number", description: "Timeout in ms" },
759
+ max_concurrent: { type: "number", description: "Max parallel executions" }
760
+ },
761
+ required: ["command"]
762
+ },
763
+ requiresApproval: true
764
+ },
765
+ {
766
+ name: "git_worktree_sync",
767
+ description: "Sync changes from main branch to all worktrees (rebase or merge)",
768
+ parameters: {
769
+ type: "object",
770
+ properties: {
771
+ strategy: { type: "string", description: "Sync strategy: rebase or merge" },
772
+ main_branch: { type: "string", description: "Main branch name" },
773
+ dry_run: { type: "boolean", description: "Preview without syncing" }
774
+ }
775
+ },
776
+ requiresApproval: true
777
+ },
778
+ {
779
+ name: "git_worktree_create_for_pr",
780
+ description: "Create a worktree for reviewing a specific PR",
781
+ parameters: {
782
+ type: "object",
783
+ properties: {
784
+ pr_number: { type: "number", description: "PR number" },
785
+ remote: { type: "string", description: "Remote name (default: origin)" }
786
+ },
787
+ required: ["pr_number"]
788
+ },
789
+ requiresApproval: true
790
+ },
791
+ {
792
+ name: "git_worktree_create_from_template",
793
+ description: "Create a worktree using a template (feature, hotfix, release, review, experiment)",
794
+ parameters: {
795
+ type: "object",
796
+ properties: {
797
+ template: { type: "string", description: "Template name" },
798
+ branch: { type: "string", description: "Branch name for the worktree" },
799
+ base_branch: { type: "string", description: "Base branch to branch from" },
800
+ run_setup: { type: "boolean", description: "Run setup commands" }
801
+ },
802
+ required: ["template", "branch"]
803
+ },
804
+ requiresApproval: true
805
+ },
806
+ {
807
+ name: "git_stash",
808
+ description: "Stash current changes (supports message, include-untracked, keep-index)",
809
+ parameters: {
810
+ type: "object",
811
+ properties: {
812
+ message: { type: "string", description: "Stash message" },
813
+ include_untracked: { type: "boolean", description: "Include untracked files" },
814
+ keep_index: { type: "boolean", description: "Keep staged changes" }
815
+ }
816
+ }
817
+ },
818
+ {
819
+ name: "git_stash_list",
820
+ description: "List all stashed changes"
821
+ },
822
+ {
823
+ name: "git_stash_pop",
824
+ description: "Apply and remove the most recent stash (or specified stash)",
825
+ parameters: {
826
+ type: "object",
827
+ properties: {
828
+ stash_ref: { type: "string", description: "Stash reference (e.g., stash@{0})" }
829
+ }
830
+ },
831
+ requiresApproval: true
832
+ },
833
+ {
834
+ name: "git_stash_apply",
835
+ description: "Apply a stash without removing it",
836
+ parameters: {
837
+ type: "object",
838
+ properties: {
839
+ stash_ref: { type: "string", description: "Stash reference (e.g., stash@{0})" }
840
+ }
841
+ }
842
+ },
843
+ {
844
+ name: "git_stash_drop",
845
+ description: "Drop a stash entry",
846
+ parameters: {
847
+ type: "object",
848
+ properties: {
849
+ stash_ref: { type: "string", description: "Stash reference (e.g., stash@{0})" }
850
+ }
851
+ },
852
+ requiresApproval: true
853
+ },
854
+ {
855
+ name: "git_branch",
856
+ description: "List or create/delete branches",
857
+ parameters: {
858
+ type: "object",
859
+ properties: {
860
+ branch_name: { type: "string", description: "Branch name (omit to list)" },
861
+ delete: { type: "boolean", description: "Delete the branch" },
862
+ force: { type: "boolean", description: "Force delete" }
863
+ }
864
+ }
865
+ },
866
+ {
867
+ name: "git_switch",
868
+ description: "Switch to a branch (can create with -c flag)",
869
+ parameters: {
870
+ type: "object",
871
+ properties: {
872
+ branch_name: { type: "string", description: "Branch to switch to" },
873
+ create: { type: "boolean", description: "Create new branch" }
874
+ },
875
+ required: ["branch_name"]
876
+ }
877
+ },
878
+ {
879
+ name: "git_cherry_pick",
880
+ description: "Cherry-pick commits onto current branch",
881
+ parameters: {
882
+ type: "object",
883
+ properties: {
884
+ commits: { type: "array", description: "Commit SHAs to cherry-pick", items: { type: "string", description: "Commit SHA" } },
885
+ no_commit: { type: "boolean", description: "Apply without committing" },
886
+ mainline: { type: "number", description: "Parent number for merge commits" }
887
+ },
888
+ required: ["commits"]
889
+ },
890
+ requiresApproval: true
891
+ },
892
+ {
893
+ name: "git_cherry_pick_abort",
894
+ description: "Abort an in-progress cherry-pick"
895
+ },
896
+ {
897
+ name: "git_cherry_pick_continue",
898
+ description: "Continue an in-progress cherry-pick after resolving conflicts"
899
+ },
900
+ {
901
+ name: "git_rebase",
902
+ description: "Rebase current branch onto another (non-interactive)",
903
+ parameters: {
904
+ type: "object",
905
+ properties: {
906
+ upstream: { type: "string", description: "Upstream branch to rebase onto" },
907
+ onto: { type: "string", description: "New base commit" },
908
+ autosquash: { type: "boolean", description: "Auto-squash fixup commits" }
909
+ },
910
+ required: ["upstream"]
911
+ },
912
+ requiresApproval: true
913
+ },
914
+ {
915
+ name: "git_rebase_abort",
916
+ description: "Abort an in-progress rebase"
917
+ },
918
+ {
919
+ name: "git_rebase_continue",
920
+ description: "Continue an in-progress rebase after resolving conflicts"
921
+ },
922
+ {
923
+ name: "git_rebase_skip",
924
+ description: "Skip the current commit during a rebase"
925
+ },
926
+ {
927
+ name: "git_merge",
928
+ description: "Merge a branch into current branch",
929
+ parameters: {
930
+ type: "object",
931
+ properties: {
932
+ branch: { type: "string", description: "Branch to merge" },
933
+ no_commit: { type: "boolean", description: "Merge without committing" },
934
+ no_ff: { type: "boolean", description: "No fast-forward" },
935
+ squash: { type: "boolean", description: "Squash commits" },
936
+ message: { type: "string", description: "Merge commit message" }
937
+ },
938
+ required: ["branch"]
939
+ },
940
+ requiresApproval: true
941
+ },
942
+ {
943
+ name: "git_merge_abort",
944
+ description: "Abort an in-progress merge"
945
+ },
946
+ {
947
+ name: "git_commit",
948
+ description: "Create a commit with the staged changes",
949
+ parameters: {
950
+ type: "object",
951
+ properties: {
952
+ message: { type: "string", description: "Commit message" },
953
+ amend: { type: "boolean", description: "Amend previous commit" },
954
+ allow_empty: { type: "boolean", description: "Allow empty commit" }
955
+ },
956
+ required: ["message"]
957
+ },
958
+ requiresApproval: true
959
+ },
960
+ {
961
+ name: "git_add",
962
+ description: "Stage files for commit",
963
+ parameters: {
964
+ type: "object",
965
+ properties: {
966
+ paths: { type: "array", description: "Paths to stage (default: all)", items: { type: "string", description: "Path to stage" } }
967
+ }
968
+ }
969
+ },
970
+ {
971
+ name: "git_reset",
972
+ description: "Reset HEAD and/or working tree (soft/mixed/hard)",
973
+ parameters: {
974
+ type: "object",
975
+ properties: {
976
+ mode: { type: "string", description: "Reset mode: soft, mixed, or hard", enum: ["soft", "mixed", "hard"] },
977
+ ref: { type: "string", description: "Commit reference to reset to" }
978
+ }
979
+ },
980
+ requiresApproval: true
981
+ },
982
+ {
983
+ name: "auto_commit",
984
+ description: "Automatically stage all changes and create a commit. Auto-generates a commit message which the user can accept, edit, or reject.",
985
+ parameters: {
986
+ type: "object",
987
+ properties: {
988
+ message: { type: "string", description: "Optional commit message (auto-generated if not provided)" },
989
+ stage_all: { type: "boolean", description: "Stage all changes before committing (default: true)" }
990
+ }
991
+ },
992
+ requiresApproval: false
993
+ // The tool has its own y/n/e confirmation
994
+ },
995
+ {
996
+ name: "git_log",
997
+ description: "Show commit history",
998
+ parameters: {
999
+ type: "object",
1000
+ properties: {
1001
+ max_count: { type: "number", description: "Maximum commits to show" },
1002
+ oneline: { type: "boolean", description: "One line per commit" },
1003
+ graph: { type: "boolean", description: "Show branch graph" },
1004
+ all: { type: "boolean", description: "Show all branches" }
1005
+ }
1006
+ }
1007
+ },
1008
+ {
1009
+ name: "git_fetch",
1010
+ description: "Fetch from remote repository",
1011
+ parameters: {
1012
+ type: "object",
1013
+ properties: {
1014
+ remote: { type: "string", description: "Remote name (default: origin)" },
1015
+ branch: { type: "string", description: "Branch to fetch" }
1016
+ }
1017
+ }
1018
+ },
1019
+ {
1020
+ name: "git_pull",
1021
+ description: "Pull changes from remote",
1022
+ parameters: {
1023
+ type: "object",
1024
+ properties: {
1025
+ remote: { type: "string", description: "Remote name (default: origin)" },
1026
+ branch: { type: "string", description: "Branch to pull" }
1027
+ }
1028
+ },
1029
+ requiresApproval: true
1030
+ },
1031
+ {
1032
+ name: "git_push",
1033
+ description: "Push changes to remote",
1034
+ parameters: {
1035
+ type: "object",
1036
+ properties: {
1037
+ remote: { type: "string", description: "Remote name (default: origin)" },
1038
+ branch: { type: "string", description: "Branch to push" },
1039
+ force: { type: "boolean", description: "Force push" },
1040
+ set_upstream: { type: "boolean", description: "Set upstream tracking" }
1041
+ }
1042
+ },
1043
+ requiresApproval: true
1044
+ },
1045
+ {
1046
+ name: "custom_command",
1047
+ description: "Define and execute a one-off command (saved for reuse)",
1048
+ parameters: {
1049
+ type: "object",
1050
+ properties: {
1051
+ name: { type: "string", description: "Command name for reuse" },
1052
+ command: { type: "string", description: "Shell command" },
1053
+ args: { type: "array", description: "Command arguments", items: { type: "string", description: "Single argument" } },
1054
+ description: { type: "string", description: "Command description" },
1055
+ dangerous: { type: "boolean", description: "Mark as dangerous" }
1056
+ },
1057
+ required: ["name", "command"]
1058
+ }
1059
+ },
1060
+ {
1061
+ name: "multi_file_edit",
1062
+ description: "Apply multiple edits to a file",
1063
+ parameters: {
1064
+ type: "object",
1065
+ properties: {
1066
+ file_path: { type: "string", description: "Relative path to the file" },
1067
+ edits: {
1068
+ type: "array",
1069
+ description: "Array of {old_string, new_string, replace_all?}",
1070
+ items: {
1071
+ type: "object",
1072
+ properties: {
1073
+ old_string: { type: "string", description: "Text to replace" },
1074
+ new_string: { type: "string", description: "Replacement text" },
1075
+ replace_all: { type: "boolean", description: "Replace all occurrences (default: false)" }
1076
+ },
1077
+ required: ["old_string", "new_string"]
1078
+ }
1079
+ }
1080
+ },
1081
+ required: ["file_path", "edits"]
1082
+ },
1083
+ requiresApproval: true
1084
+ },
1085
+ {
1086
+ name: "todo_write",
1087
+ description: "Persist and update the todo list. Send the COMPLETE updated todo list each time (not incremental changes).",
1088
+ parameters: {
1089
+ type: "object",
1090
+ properties: {
1091
+ tasks: {
1092
+ type: "array",
1093
+ description: "The complete updated todo list with all tasks and their current statuses",
1094
+ items: {
1095
+ type: "object",
1096
+ properties: {
1097
+ content: { type: "string", description: "Task description (what needs to be done)" },
1098
+ status: { type: "string", enum: ["pending", "in_progress", "completed"], description: "Current task status" },
1099
+ activeForm: { type: "string", description: 'Present continuous form shown during execution (e.g., "Running tests")' }
1100
+ },
1101
+ required: ["content", "status", "activeForm"]
1102
+ }
1103
+ }
1104
+ },
1105
+ required: ["tasks"]
1106
+ }
1107
+ },
1108
+ {
1109
+ name: "smart_context_cropper",
1110
+ description: "Trim conversation history when context is full",
1111
+ parameters: {
1112
+ type: "object",
1113
+ properties: {
1114
+ crop_direction: { type: "string", description: "Direction: top or bottom", enum: ["top", "bottom"] },
1115
+ crop_amount: { type: "number", description: "Number of messages to crop" },
1116
+ need_user_approve: { type: "boolean", description: "Ask user for approval" },
1117
+ deleted_messages_summary: { type: "string", description: "Summary of cropped content" }
1118
+ },
1119
+ required: ["crop_direction", "crop_amount"]
1120
+ }
1121
+ },
1122
+ {
1123
+ name: "save_memory",
1124
+ description: "Save a fact or preference to memory for recall in future sessions. Use for important user preferences, project conventions, or key information worth remembering.",
1125
+ parameters: {
1126
+ type: "object",
1127
+ properties: {
1128
+ fact: { type: "string", description: "The fact or preference to remember. Should be a clear, self-contained statement." },
1129
+ level: { type: "string", description: 'Storage level: "user" (global across projects) or "project" (specific to current workspace)', enum: ["user", "project"] }
1130
+ },
1131
+ required: ["fact"]
1132
+ }
1133
+ },
1134
+ {
1135
+ name: "recall_memory",
1136
+ description: "Recall stored memories and preferences. Use to check what preferences are already saved or to find specific information.",
1137
+ parameters: {
1138
+ type: "object",
1139
+ properties: {
1140
+ query: { type: "string", description: "Optional search query to filter memories. If omitted, returns all memories." },
1141
+ level: { type: "string", description: 'Filter by level: "user" (global) or "project" (workspace-specific). If omitted, returns both.', enum: ["user", "project"] }
1142
+ },
1143
+ required: []
1144
+ }
1145
+ },
1146
+ {
1147
+ name: "create_meta_tool",
1148
+ description: "Create a new reusable tool that persists across sessions. Use for automating repetitive shell commands or extending capabilities.",
1149
+ parameters: {
1150
+ type: "object",
1151
+ properties: {
1152
+ name: { type: "string", description: "Tool name in snake_case (e.g., analyze_imports, count_lines)" },
1153
+ description: { type: "string", description: "Clear description of what the tool does" },
1154
+ parameters: { type: "object", description: "JSON Schema defining tool parameters" },
1155
+ handler: { type: "string", description: 'Shell command template with {{param}} placeholders (e.g., "grep -E {{pattern}} {{path}}")' }
1156
+ },
1157
+ required: ["name", "description", "parameters", "handler"]
1158
+ }
1159
+ },
1160
+ // Web Search Operations
1161
+ {
1162
+ name: "web_search",
1163
+ description: "Search the web for up-to-date information about packages, libraries, frameworks, documentation, changelogs, and more. Use this when you need current information that may have changed after your training data.",
1164
+ parameters: {
1165
+ type: "object",
1166
+ properties: {
1167
+ query: { type: "string", description: 'Search query (e.g., "react 19 new features", "zod changelog latest")' },
1168
+ max_results: { type: "number", description: "Maximum results to return (default: 5)" },
1169
+ search_type: { type: "string", description: "Type of search: general, packages, docs, changelog", enum: ["general", "packages", "docs", "changelog"] }
1170
+ },
1171
+ required: ["query"]
1172
+ }
1173
+ },
1174
+ {
1175
+ name: "fetch_url",
1176
+ description: "Fetch and extract text content from a URL. Useful for reading documentation, changelogs, release notes, or any web page.",
1177
+ parameters: {
1178
+ type: "object",
1179
+ properties: {
1180
+ url: { type: "string", description: "URL to fetch" },
1181
+ max_length: { type: "number", description: "Maximum characters to return (default: 30000)" }
1182
+ },
1183
+ required: ["url"]
1184
+ }
1185
+ },
1186
+ {
1187
+ name: "package_info",
1188
+ description: "Get detailed information about a package from npm, PyPI (Python), crates.io (Rust), Go modules, or RubyGems. Auto-detects registry or specify explicitly.",
1189
+ parameters: {
1190
+ type: "object",
1191
+ properties: {
1192
+ package_name: { type: "string", description: 'Package name (e.g., "react", "requests", "serde", "github.com/gin-gonic/gin")' },
1193
+ registry: { type: "string", description: "Package registry: npm, pypi, crates, go, rubygems (auto-detected if not specified)", enum: ["npm", "pypi", "crates", "go", "rubygems"] },
1194
+ version: { type: "string", description: "Specific version to get info for (default: latest)" }
1195
+ },
1196
+ required: ["package_name"]
1197
+ }
1198
+ },
1199
+ {
1200
+ name: "web_repo",
1201
+ description: `Browse GitHub and GitLab repositories. Supports three operations:
1202
+
1203
+ - 'info': Get repo metadata (description, stars, language, license, default branch)
1204
+ - 'list': List directory contents (files and folders at a path)
1205
+ - 'fetch': Get raw file content (defaults to README.md)
1206
+
1207
+ Repo formats: Full URL (https://github.com/owner/repo), or shorthand (github:owner/repo, gitlab:group/project).
1208
+
1209
+ Examples:
1210
+ { repo: "github:openai/codex", operation: "info" }
1211
+ { repo: "gitlab:inkscape/inkscape", operation: "list", path: "src" }
1212
+ { repo: "github:openai/codex", operation: "fetch", path: "codex-cli/src/utils.ts" }`,
1213
+ parameters: {
1214
+ type: "object",
1215
+ properties: {
1216
+ repo: { type: "string", description: "Repository URL or shorthand (github:owner/repo, gitlab:group/project)" },
1217
+ operation: { type: "string", description: "Operation to perform", enum: ["info", "list", "fetch"] },
1218
+ path: { type: "string", description: "File/directory path (default: root for list, README.md for fetch)" },
1219
+ branch: { type: "string", description: "Branch name (default: repo default branch)" }
1220
+ },
1221
+ required: ["repo", "operation"]
1222
+ }
1223
+ }
1224
+ ];
1225
+ var ToolManager = class _ToolManager {
1226
+ constructor(options) {
1227
+ this.definitions = /* @__PURE__ */ new Map();
1228
+ this.executor = options.executor;
1229
+ this.confirmApproval = options.confirmApproval;
1230
+ this.toolFilter = new ToolFilter(_nullishCoalesce(options.clientContext, () => ( "cli")), options.customPolicy);
1231
+ const defs = _nullishCoalesce(options.definitions, () => ( DEFAULT_TOOL_DEFINITIONS));
1232
+ for (const def of defs) {
1233
+ this.register(def);
1234
+ }
1235
+ }
1236
+ register(definition) {
1237
+ this.definitions.set(definition.name, definition);
1238
+ }
1239
+ /**
1240
+ * Register meta-tools from ToolsRegistry dynamically
1241
+ * Called during session initialization to load persisted tools
1242
+ */
1243
+ registerMetaTools(toolDefinitions) {
1244
+ for (const def of toolDefinitions) {
1245
+ if (DEFAULT_TOOL_DEFINITIONS.some((d) => d.name === def.name)) {
1246
+ continue;
1247
+ }
1248
+ this.definitions.set(def.name, def);
1249
+ }
1250
+ }
1251
+ /**
1252
+ * Replace all MCP tools (mcp__*) with a fresh set.
1253
+ * Keeps built-ins and non-MCP meta-tools intact.
1254
+ */
1255
+ replaceMcpTools(toolDefinitions) {
1256
+ for (const name of Array.from(this.definitions.keys())) {
1257
+ if (name.startsWith("mcp__")) {
1258
+ this.definitions.delete(name);
1259
+ }
1260
+ }
1261
+ this.registerMetaTools(toolDefinitions);
1262
+ }
1263
+ /**
1264
+ * Check if a tool name conflicts with built-in definitions
1265
+ */
1266
+ isBuiltInTool(name) {
1267
+ return DEFAULT_TOOL_DEFINITIONS.some((d) => d.name === name);
1268
+ }
1269
+ listToolNames() {
1270
+ return Array.from(this.definitions.keys()).filter((name) => this.toolFilter.isAllowed(name));
1271
+ }
1272
+ /**
1273
+ * List all tool definitions (unfiltered)
1274
+ */
1275
+ listAllDefinitions() {
1276
+ return Array.from(this.definitions.values());
1277
+ }
1278
+ /**
1279
+ * List tool definitions filtered by client context
1280
+ */
1281
+ listDefinitions() {
1282
+ return this.toolFilter.filterDefinitions(Array.from(this.definitions.values()));
1283
+ }
1284
+ /**
1285
+ * Get the current tool filter
1286
+ */
1287
+ getFilter() {
1288
+ return this.toolFilter;
1289
+ }
1290
+ /**
1291
+ * Check if a specific tool is allowed in the current context
1292
+ */
1293
+ isToolAllowed(toolName) {
1294
+ return this.toolFilter.isAllowed(toolName);
1295
+ }
1296
+ /**
1297
+ * Convert tool definitions to FunctionDefinition format for LLM function calling
1298
+ * This is used when passing tools to the LLM API
1299
+ */
1300
+ toFunctionDefinitions() {
1301
+ return this.listDefinitions().map((def) => _ToolManager.toFunctionDefinition(def));
1302
+ }
1303
+ /**
1304
+ * Convert a single tool definition to FunctionDefinition format
1305
+ */
1306
+ static toFunctionDefinition(def) {
1307
+ return {
1308
+ name: def.name,
1309
+ description: def.description,
1310
+ parameters: def.parameters ? {
1311
+ type: "object",
1312
+ properties: Object.fromEntries(
1313
+ Object.entries(def.parameters.properties).map(([key, param]) => [
1314
+ key,
1315
+ {
1316
+ type: param.type,
1317
+ description: param.description,
1318
+ enum: param.enum,
1319
+ items: param.type === "array" ? _ToolManager.normalizeItemsStatic(param.items) : void 0,
1320
+ properties: param.type === "object" ? _ToolManager.normalizeObjectPropertiesStatic(
1321
+ param.properties
1322
+ ) : void 0,
1323
+ required: param.type === "object" && Array.isArray(param.required) ? param.required : void 0,
1324
+ additionalProperties: param.type === "object" ? true : void 0
1325
+ }
1326
+ ])
1327
+ ),
1328
+ required: def.parameters.required
1329
+ } : void 0
1330
+ };
1331
+ }
1332
+ static normalizeItemsStatic(items) {
1333
+ if (!items) return { type: "string" };
1334
+ if (items.type !== "object") {
1335
+ return { type: items.type, description: items.description, enum: items.enum };
1336
+ }
1337
+ const objItems = items;
1338
+ return {
1339
+ type: "object",
1340
+ description: items.description,
1341
+ properties: _ToolManager.normalizeObjectPropertiesStatic(objItems.properties),
1342
+ required: objItems.required,
1343
+ additionalProperties: true
1344
+ };
1345
+ }
1346
+ static normalizeObjectPropertiesStatic(props) {
1347
+ const safeProps = _nullishCoalesce(props, () => ( {}));
1348
+ return Object.fromEntries(
1349
+ Object.entries(safeProps).map(([k, v]) => [
1350
+ k,
1351
+ {
1352
+ type: v.type,
1353
+ description: v.description,
1354
+ enum: v.enum,
1355
+ items: v.type === "array" ? _ToolManager.normalizeItemsStatic(v.items) : void 0,
1356
+ properties: v.type === "object" ? _ToolManager.normalizeObjectPropertiesStatic(v.properties) : void 0,
1357
+ required: v.type === "object" && Array.isArray(v.required) ? v.required : void 0,
1358
+ additionalProperties: v.type === "object" ? true : void 0
1359
+ }
1360
+ ])
1361
+ );
1362
+ }
1363
+ async execute(toolCalls) {
1364
+ const results = [];
1365
+ const planModeManager = _chunkULQ6MDSJcjs.getPlanModeManager.call(void 0, );
1366
+ const isInPlanningPhase = planModeManager.isEnabled() && planModeManager.getPhase() === "planning";
1367
+ const readOnlyTools = isInPlanningPhase ? new Set(planModeManager.getReadOnlyTools()) : null;
1368
+ for (const call of toolCalls) {
1369
+ if (!this.toolFilter.isAllowed(call.tool)) {
1370
+ results.push({
1371
+ tool: call.tool,
1372
+ success: false,
1373
+ error: `Tool '${call.tool}' is not available in the current context (${this.toolFilter.getContext()})`
1374
+ });
1375
+ continue;
1376
+ }
1377
+ if (readOnlyTools && !readOnlyTools.has(call.tool)) {
1378
+ results.push({
1379
+ tool: call.tool,
1380
+ success: false,
1381
+ error: `Tool '${call.tool}' is not available in plan mode. Only read-only tools are allowed during planning. Use 'plan' tool to create a plan, then accept it to execute write operations.`
1382
+ });
1383
+ continue;
1384
+ }
1385
+ const definition = this.definitions.get(call.tool);
1386
+ const requiresApproval = this.toolFilter.requiresApproval(call.tool, _optionalChain([definition, 'optionalAccess', _13 => _13.requiresApproval]));
1387
+ if (requiresApproval) {
1388
+ let message = _nullishCoalesce(_optionalChain([definition, 'optionalAccess', _14 => _14.approvalMessage]), () => ( `Allow tool ${call.tool}?`));
1389
+ const permContext = { tool: call.tool };
1390
+ if (call.tool === "run_command" && call.args) {
1391
+ const cmd = String(call.args.command || "");
1392
+ const args = Array.isArray(call.args.args) ? call.args.args.join(" ") : "";
1393
+ const fullCommand = args ? `${cmd} ${args}` : cmd;
1394
+ const dir = call.args.directory ? ` (in ${call.args.directory})` : "";
1395
+ message = `Run this command${dir}?
1396
+ $ ${fullCommand}`;
1397
+ permContext.command = fullCommand;
1398
+ } else if (call.tool === "delete_path" && _optionalChain([call, 'access', _15 => _15.args, 'optionalAccess', _16 => _16.path])) {
1399
+ message = `Delete this path?
1400
+ ${call.args.path}`;
1401
+ permContext.path = String(call.args.path);
1402
+ } else if (call.tool === "write_file" && _optionalChain([call, 'access', _17 => _17.args, 'optionalAccess', _18 => _18.path])) {
1403
+ message = `Write to this file?
1404
+ ${call.args.path}`;
1405
+ permContext.path = String(call.args.path);
1406
+ } else if (call.tool === "multi_file_edit" && _optionalChain([call, 'access', _19 => _19.args, 'optionalAccess', _20 => _20.file_path])) {
1407
+ const editCount = Array.isArray(call.args.edits) ? call.args.edits.length : 0;
1408
+ message = `Edit this file (${editCount} change${editCount === 1 ? "" : "s"})?
1409
+ ${call.args.file_path}`;
1410
+ permContext.path = String(call.args.file_path);
1411
+ }
1412
+ const confirmed = await this.confirmApproval(message, permContext);
1413
+ if (!confirmed) {
1414
+ results.push({
1415
+ tool: call.tool,
1416
+ success: false,
1417
+ output: "Tool execution skipped by user."
1418
+ });
1419
+ continue;
1420
+ }
1421
+ }
1422
+ try {
1423
+ const action = this.toAction(call);
1424
+ const output = await this.executor(action, { toolCallId: call.id, tool: call.tool });
1425
+ results.push({
1426
+ tool: call.tool,
1427
+ success: true,
1428
+ output
1429
+ });
1430
+ } catch (error) {
1431
+ results.push({
1432
+ tool: call.tool,
1433
+ success: false,
1434
+ error: error instanceof Error ? error.message : String(error)
1435
+ });
1436
+ }
1437
+ }
1438
+ return results;
1439
+ }
1440
+ toAction(call) {
1441
+ return {
1442
+ type: call.tool,
1443
+ ..._nullishCoalesce(call.args, () => ( {}))
1444
+ };
1445
+ }
1446
+ };
1447
+
1448
+ // src/core/agents/AgentDelegator.ts
1449
+
1450
+ var DEFAULT_MAX_DEPTH = 3;
1451
+ var AgentDelegator = class {
1452
+ constructor(llm, actionExecutor, options = {}) {
1453
+ this.llm = llm;
1454
+ this.actionExecutor = actionExecutor;
1455
+ this.subagentCounter = 0;
1456
+ this.registry = _chunkBVKXEQVGcjs.AgentRegistry.getInstance();
1457
+ this.clientContext = _nullishCoalesce(options.clientContext, () => ( "cli"));
1458
+ this.currentDepth = _nullishCoalesce(options.currentDepth, () => ( 0));
1459
+ this.maxDepth = _nullishCoalesce(options.maxDepth, () => ( DEFAULT_MAX_DEPTH));
1460
+ this.onSubagentStop = options.onSubagentStop;
1461
+ }
1462
+ generateSubagentId() {
1463
+ return `subagent-${Date.now()}-${++this.subagentCounter}`;
1464
+ }
1465
+ async delegateTask(agentName, task) {
1466
+ if (this.currentDepth >= this.maxDepth) {
1467
+ return `Error: Maximum delegation depth (${this.maxDepth}) reached. Cannot delegate to '${agentName}'.`;
1468
+ }
1469
+ await this.registry.loadAgents();
1470
+ const agentConfig = this.registry.getAgent(agentName);
1471
+ if (!agentConfig) {
1472
+ return `Error: Agent '${agentName}' not found. Use /agents to list available agents.`;
1473
+ }
1474
+ const subAgentOptions = {
1475
+ clientContext: this.clientContext,
1476
+ depth: this.currentDepth + 1,
1477
+ maxDepth: this.maxDepth
1478
+ };
1479
+ const subagentId = this.generateSubagentId();
1480
+ const startTime = Date.now();
1481
+ const agent = new SubAgent(agentConfig, this.llm, this.actionExecutor, subAgentOptions);
1482
+ try {
1483
+ const result = await agent.run(task);
1484
+ if (this.onSubagentStop) {
1485
+ await this.onSubagentStop({
1486
+ subagentId,
1487
+ subagentName: agentName,
1488
+ subagentType: _nullishCoalesce(agentConfig.source, () => ( "user")),
1489
+ success: true,
1490
+ duration: Date.now() - startTime
1491
+ });
1492
+ }
1493
+ return result;
1494
+ } catch (error) {
1495
+ const errorMessage = error.message;
1496
+ if (this.onSubagentStop) {
1497
+ await this.onSubagentStop({
1498
+ subagentId,
1499
+ subagentName: agentName,
1500
+ subagentType: _nullishCoalesce(agentConfig.source, () => ( "user")),
1501
+ success: false,
1502
+ error: errorMessage,
1503
+ duration: Date.now() - startTime
1504
+ });
1505
+ }
1506
+ return `Error running agent '${agentName}': ${errorMessage}`;
1507
+ }
1508
+ }
1509
+ async delegateParallel(tasks) {
1510
+ if (this.currentDepth >= this.maxDepth) {
1511
+ return `Error: Maximum delegation depth (${this.maxDepth}) reached. Cannot delegate parallel tasks.`;
1512
+ }
1513
+ if (tasks.length > 5) {
1514
+ return `Error: Maximum 5 parallel agents allowed. You requested ${tasks.length}.`;
1515
+ }
1516
+ await this.registry.loadAgents();
1517
+ const subAgentOptions = {
1518
+ clientContext: this.clientContext,
1519
+ depth: this.currentDepth + 1,
1520
+ maxDepth: this.maxDepth
1521
+ };
1522
+ const promises = tasks.map(async ({ agent_name, task }) => {
1523
+ const agentConfig = this.registry.getAgent(agent_name);
1524
+ if (!agentConfig) {
1525
+ return `[${agent_name}] Error: Agent not found.`;
1526
+ }
1527
+ const subagentId = this.generateSubagentId();
1528
+ const startTime = Date.now();
1529
+ const agent = new SubAgent(agentConfig, this.llm, this.actionExecutor, subAgentOptions);
1530
+ try {
1531
+ const result = await agent.run(task);
1532
+ if (this.onSubagentStop) {
1533
+ await this.onSubagentStop({
1534
+ subagentId,
1535
+ subagentName: agent_name,
1536
+ subagentType: _nullishCoalesce(agentConfig.source, () => ( "user")),
1537
+ success: true,
1538
+ duration: Date.now() - startTime
1539
+ });
1540
+ }
1541
+ return `[${agent_name}] Result:
1542
+ ${result}`;
1543
+ } catch (error) {
1544
+ const errorMessage = error.message;
1545
+ if (this.onSubagentStop) {
1546
+ await this.onSubagentStop({
1547
+ subagentId,
1548
+ subagentName: agent_name,
1549
+ subagentType: _nullishCoalesce(agentConfig.source, () => ( "user")),
1550
+ success: false,
1551
+ error: errorMessage,
1552
+ duration: Date.now() - startTime
1553
+ });
1554
+ }
1555
+ return `[${agent_name}] Failed: ${errorMessage}`;
1556
+ }
1557
+ });
1558
+ const results = await Promise.all(promises);
1559
+ return results.join("\n\n" + _chalk2.default.gray("\u2500".repeat(40)) + "\n\n");
1560
+ }
1561
+ /**
1562
+ * Get the current delegation depth
1563
+ */
1564
+ getDepth() {
1565
+ return this.currentDepth;
1566
+ }
1567
+ /**
1568
+ * Check if further delegation is allowed
1569
+ */
1570
+ canDelegate() {
1571
+ return this.currentDepth < this.maxDepth;
1572
+ }
1573
+ };
1574
+
1575
+ // src/core/agents/SubAgent.ts
1576
+ var DELEGATION_TOOL_DEFINITIONS = [
1577
+ {
1578
+ name: "delegate_task",
1579
+ description: "Delegate a task to another specialized sub-agent",
1580
+ parameters: {
1581
+ type: "object",
1582
+ properties: {
1583
+ agent_name: { type: "string", description: "Name of the agent to delegate to" },
1584
+ task: { type: "string", description: "Task description for the sub-agent" }
1585
+ },
1586
+ required: ["agent_name", "task"]
1587
+ }
1588
+ },
1589
+ {
1590
+ name: "delegate_parallel",
1591
+ description: "Run multiple sub-agents in parallel (max 5)",
1592
+ parameters: {
1593
+ type: "object",
1594
+ properties: {
1595
+ tasks: { type: "array", description: "Array of {agent_name, task} objects" }
1596
+ },
1597
+ required: ["tasks"]
1598
+ }
1599
+ }
1600
+ ];
1601
+ var SubAgent = class {
1602
+ constructor(config, llm, actionExecutor, options) {
1603
+ this.config = config;
1604
+ this.llm = llm;
1605
+ this.actionExecutor = actionExecutor;
1606
+ this.delegator = null;
1607
+ this.name = config.name;
1608
+ this.options = options;
1609
+ const canDelegate = options.depth < options.maxDepth;
1610
+ const allowedTools = new Set(config.tools);
1611
+ let definitions = DEFAULT_TOOL_DEFINITIONS.filter((def) => allowedTools.has(def.name));
1612
+ if (canDelegate) {
1613
+ definitions = [...definitions, ...DELEGATION_TOOL_DEFINITIONS];
1614
+ }
1615
+ const toolFilter = new ToolFilter(options.clientContext);
1616
+ definitions = toolFilter.filterDefinitions(definitions);
1617
+ if (canDelegate) {
1618
+ this.delegator = new AgentDelegator(llm, actionExecutor, {
1619
+ clientContext: options.clientContext,
1620
+ currentDepth: options.depth,
1621
+ maxDepth: options.maxDepth
1622
+ });
1623
+ }
1624
+ this.toolManager = new ToolManager({
1625
+ executor: async (action, context) => {
1626
+ if (action.type === "delegate_task" && this.delegator) {
1627
+ return this.delegator.delegateTask(
1628
+ action.agent_name,
1629
+ action.task
1630
+ );
1631
+ }
1632
+ if (action.type === "delegate_parallel" && this.delegator) {
1633
+ return this.delegator.delegateParallel(action.tasks);
1634
+ }
1635
+ return this.actionExecutor.execute(action, context);
1636
+ },
1637
+ confirmApproval: async () => true,
1638
+ // Sub-agents auto-approve (inherit from main agent in future)
1639
+ definitions,
1640
+ clientContext: options.clientContext
1641
+ });
1642
+ const enhancedSystemPrompt = this.buildSystemPrompt(config.systemPrompt, definitions);
1643
+ this.conversation = new (0, _chunkCNBKZEX5cjs.ConversationManager)();
1644
+ this.conversation.reset(enhancedSystemPrompt);
1645
+ }
1646
+ /**
1647
+ * Build system prompt with tool signatures for the LLM
1648
+ */
1649
+ buildSystemPrompt(basePrompt, tools) {
1650
+ const toolSignatures = tools.map((def) => this.formatToolSignature(def)).join("\n");
1651
+ return [
1652
+ basePrompt,
1653
+ "",
1654
+ "## Available Tools",
1655
+ "You have access to the following tools. Use them when needed:",
1656
+ "",
1657
+ toolSignatures,
1658
+ "",
1659
+ "## Response Format",
1660
+ "Always respond with structured JSON:",
1661
+ "```json",
1662
+ "{",
1663
+ ' "thought": "Your reasoning about what to do next",',
1664
+ ' "toolCalls": [{"tool": "tool_name", "args": {...}}],',
1665
+ ' "finalResponse": "Your final answer when done (omit toolCalls if providing this)"',
1666
+ "}",
1667
+ "```",
1668
+ "",
1669
+ `Depth: ${this.options.depth}/${this.options.maxDepth} ${this.delegator ? "(can delegate further)" : "(max depth reached)"}`
1670
+ ].join("\n");
1671
+ }
1672
+ /**
1673
+ * Format a tool definition as a signature string
1674
+ */
1675
+ formatToolSignature(def) {
1676
+ const params = _optionalChain([def, 'access', _21 => _21.parameters, 'optionalAccess', _22 => _22.properties]) ? Object.entries(def.parameters.properties).map(([name, prop]) => {
1677
+ const required = _optionalChain([def, 'access', _23 => _23.parameters, 'optionalAccess', _24 => _24.required, 'optionalAccess', _25 => _25.includes, 'call', _26 => _26(name)]) ? "" : "?";
1678
+ return `${name}${required}: ${prop.type}`;
1679
+ }).join(", ") : "";
1680
+ return `- ${def.name}(${params}): ${def.description}`;
1681
+ }
1682
+ async run(task) {
1683
+ console.log(_chalk2.default.cyan(`
1684
+ \u{1F916} Sub-agent '${this.name}' starting task... (depth ${this.options.depth}/${this.options.maxDepth})`));
1685
+ this.conversation.addMessage({ role: "user", content: task });
1686
+ const tools = this.toolManager.toFunctionDefinitions();
1687
+ const maxIterations = 10;
1688
+ for (let i = 0; i < maxIterations; i++) {
1689
+ const completion = await this.llm.complete({
1690
+ messages: this.conversation.history(),
1691
+ model: this.config.model,
1692
+ temperature: 0.2,
1693
+ tools: tools.length > 0 ? tools : void 0,
1694
+ toolChoice: tools.length > 0 ? "auto" : void 0
1695
+ });
1696
+ const payload = this.parseResponse(completion);
1697
+ if (_optionalChain([completion, 'access', _27 => _27.toolCalls, 'optionalAccess', _28 => _28.length])) {
1698
+ this.conversation.addMessage({
1699
+ role: "assistant",
1700
+ content: completion.content || ""
1701
+ });
1702
+ } else {
1703
+ this.conversation.addMessage({ role: "assistant", content: completion.content });
1704
+ }
1705
+ if (payload.thought) {
1706
+ console.log(_chalk2.default.gray(`[${this.name}] ${payload.thought}`));
1707
+ }
1708
+ if (payload.toolCalls && payload.toolCalls.length > 0) {
1709
+ const results = await this.toolManager.execute(payload.toolCalls);
1710
+ for (let j = 0; j < results.length; j++) {
1711
+ const result = results[j];
1712
+ const toolCall = _optionalChain([completion, 'access', _29 => _29.toolCalls, 'optionalAccess', _30 => _30[j]]);
1713
+ const content = result.success ? _nullishCoalesce(result.output, () => ( "(no output)")) : _nullishCoalesce(result.error, () => ( "Tool failed"));
1714
+ this.conversation.addMessage({
1715
+ role: "tool",
1716
+ name: result.tool,
1717
+ content,
1718
+ tool_call_id: _optionalChain([toolCall, 'optionalAccess', _31 => _31.id])
1719
+ });
1720
+ if (!result.success) {
1721
+ console.log(_chalk2.default.red(`[${this.name}] Tool ${result.tool} failed: ${content}`));
1722
+ }
1723
+ }
1724
+ continue;
1725
+ }
1726
+ const response = _nullishCoalesce(_nullishCoalesce(payload.finalResponse, () => ( payload.response)), () => ( completion.content));
1727
+ console.log(_chalk2.default.cyan(`[${this.name}] Finished.`));
1728
+ return response;
1729
+ }
1730
+ return `[${this.name}] Failed to complete task within ${maxIterations} iterations.`;
1731
+ }
1732
+ /**
1733
+ * Parse LLM response, preferring native tool calls over JSON parsing
1734
+ */
1735
+ parseResponse(completion) {
1736
+ if (completion.toolCalls && completion.toolCalls.length > 0) {
1737
+ return {
1738
+ thought: completion.content || void 0,
1739
+ toolCalls: completion.toolCalls.map((tc) => ({
1740
+ tool: tc.function.name,
1741
+ args: this.safeParseJson(tc.function.arguments)
1742
+ }))
1743
+ };
1744
+ }
1745
+ return this.parsePayload(completion.content);
1746
+ }
1747
+ /**
1748
+ * Safely parse JSON, returning empty object on failure
1749
+ */
1750
+ safeParseJson(json) {
1751
+ try {
1752
+ return JSON.parse(json);
1753
+ } catch (e) {
1754
+ return {};
1755
+ }
1756
+ }
1757
+ parsePayload(raw) {
1758
+ const jsonMatch = raw.match(/\{[\s\S]*\}/);
1759
+ if (!jsonMatch) {
1760
+ return { finalResponse: raw.trim() };
1761
+ }
1762
+ try {
1763
+ const parsed = JSON.parse(jsonMatch[0]);
1764
+ const hasExpectedFields = "thought" in parsed || "toolCalls" in parsed || "finalResponse" in parsed || "response" in parsed;
1765
+ if (hasExpectedFields) {
1766
+ return {
1767
+ thought: typeof parsed.thought === "string" ? parsed.thought : void 0,
1768
+ toolCalls: Array.isArray(parsed.toolCalls) ? parsed.toolCalls : void 0,
1769
+ finalResponse: _nullishCoalesce((typeof parsed.finalResponse === "string" ? parsed.finalResponse : void 0), () => ( (typeof parsed.response === "string" ? parsed.response : void 0))),
1770
+ response: typeof parsed.response === "string" ? parsed.response : void 0
1771
+ };
1772
+ }
1773
+ const contentValue = this.extractContentFromJson(parsed);
1774
+ if (contentValue) {
1775
+ return { finalResponse: contentValue };
1776
+ }
1777
+ return { finalResponse: raw.trim() };
1778
+ } catch (e2) {
1779
+ return { finalResponse: raw.trim() };
1780
+ }
1781
+ }
1782
+ /**
1783
+ * Extracts content from non-standard JSON response formats.
1784
+ */
1785
+ extractContentFromJson(parsed) {
1786
+ const contentFields = ["content", "text", "message", "answer", "output", "result", "reply"];
1787
+ for (const field of contentFields) {
1788
+ const value = parsed[field];
1789
+ if (typeof value === "string" && value.trim()) {
1790
+ return value.trim();
1791
+ }
1792
+ }
1793
+ if (parsed.message && typeof parsed.message === "object") {
1794
+ const msg = parsed.message;
1795
+ if (typeof msg.content === "string" && msg.content.trim()) {
1796
+ return msg.content.trim();
1797
+ }
1798
+ }
1799
+ return void 0;
1800
+ }
1801
+ };
1802
+
1803
+
1804
+
1805
+
1806
+
1807
+
1808
+
1809
+ exports.filterToolsByRelevance = filterToolsByRelevance; exports.DEFAULT_TOOL_DEFINITIONS = DEFAULT_TOOL_DEFINITIONS; exports.ToolManager = ToolManager; exports.SubAgent = SubAgent; exports.AgentDelegator = AgentDelegator;
1810
+ /**
1811
+ * @license
1812
+ * Copyright 2025 Autohand AI LLC
1813
+ * SPDX-License-Identifier: Apache-2.0
1814
+ *
1815
+ * Tool filtering based on client context and risk categories
1816
+ * Inspired by Claude Code's permission model
1817
+ */
1818
+ /**
1819
+ * @license
1820
+ * Copyright 2025 Autohand AI LLC
1821
+ * SPDX-License-Identifier: Apache-2.0
1822
+ */