claude-code-best 1.1.0 → 1.2.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 (514) hide show
  1. package/README.md +66 -75
  2. package/dist/{chunk-q5b91nhh.js → chunk-01qzvbp3.js} +8 -2
  3. package/dist/{chunk-f9b4wb89.js → chunk-053bj0m0.js} +79 -73
  4. package/dist/chunk-05tt9tt1.js +653 -0
  5. package/dist/chunk-06sq1vz3.js +403 -0
  6. package/dist/chunk-07069jq1.js +30 -0
  7. package/dist/chunk-0dac8msw.js +135 -0
  8. package/dist/{chunk-m5eb5pt2.js → chunk-0ja0y3at.js} +6 -6
  9. package/dist/chunk-0jzdwbdc.js +14 -0
  10. package/dist/chunk-0nrq46nf.js +313 -0
  11. package/dist/chunk-0qz705wz.js +192 -0
  12. package/dist/{chunk-m94pnhfa.js → chunk-0rn4v8sg.js} +38 -28
  13. package/dist/{chunk-1cbn5kxf.js → chunk-0rpb2bdp.js} +3 -2
  14. package/dist/{chunk-zz21rvr7.js → chunk-127cmycn.js} +8 -5
  15. package/dist/chunk-12vk6z7z.js +109 -0
  16. package/dist/{chunk-vybkxr18.js → chunk-15y014gg.js} +41 -31
  17. package/dist/{chunk-44fpr6jq.js → chunk-168xb8v1.js} +4 -2
  18. package/dist/{chunk-8hsyagr8.js → chunk-16bnxyz0.js} +1 -1
  19. package/dist/{chunk-wsqhnjj3.js → chunk-1atfzck5.js} +24 -24
  20. package/dist/chunk-1cbhkqxg.js +310 -0
  21. package/dist/chunk-1csq8bf1.js +295 -0
  22. package/dist/{chunk-0e1xsncc.js → chunk-1cwdhk7a.js} +1 -1
  23. package/dist/{chunk-c8jv6rtj.js → chunk-1ebqpwhn.js} +74 -68
  24. package/dist/{chunk-vyd8jzde.js → chunk-1mh5vt6v.js} +91 -83
  25. package/dist/chunk-1qf125vg.js +123 -0
  26. package/dist/{chunk-ryj80g9p.js → chunk-1sp6713v.js} +131 -176
  27. package/dist/{chunk-d18z9pna.js → chunk-1thgdca1.js} +2 -2
  28. package/dist/chunk-1z1gfx2c.js +443 -0
  29. package/dist/{chunk-wc6wwwyb.js → chunk-21z7acxh.js} +3 -3
  30. package/dist/chunk-229pcf6p.js +509 -0
  31. package/dist/chunk-238g70xa.js +1 -1
  32. package/dist/{chunk-vpb723tx.js → chunk-23ad5t92.js} +5 -5
  33. package/dist/chunk-28043j1k.js +68 -0
  34. package/dist/chunk-299r6d9v.js +141 -0
  35. package/dist/{chunk-a6s8wnhe.js → chunk-2bw5nqsw.js} +4 -4
  36. package/dist/chunk-2mxstrx5.js +445 -0
  37. package/dist/{chunk-9g827w4j.js → chunk-2q39ej51.js} +6 -6
  38. package/dist/chunk-2qwgfjcj.js +5370 -0
  39. package/dist/chunk-2ss23j0q.js +3587 -0
  40. package/dist/{chunk-hy3g1nv8.js → chunk-2wvxddsg.js} +9 -7
  41. package/dist/chunk-2x2aznpc.js +134 -0
  42. package/dist/{chunk-bqq4zamw.js → chunk-2ys5wcxk.js} +3 -3
  43. package/dist/{chunk-x51h62jq.js → chunk-3cvcwgsr.js} +74 -68
  44. package/dist/{chunk-mecs0gpc.js → chunk-3xv7rjsy.js} +14 -11
  45. package/dist/chunk-42x5tjk2.js +42 -0
  46. package/dist/{chunk-q6rax9kh.js → chunk-436r0x2n.js} +5 -5
  47. package/dist/{chunk-zgrg0wk3.js → chunk-44q4jkwa.js} +27 -67
  48. package/dist/{chunk-zq9xa1xe.js → chunk-44w22kyx.js} +104 -139
  49. package/dist/{chunk-yhd82045.js → chunk-46fcr28b.js} +30 -9
  50. package/dist/{chunk-wm2f2f1z.js → chunk-474y75ga.js} +2 -2
  51. package/dist/{chunk-6fkwz9yk.js → chunk-478rpnqm.js} +8 -8
  52. package/dist/{chunk-rj86xm6z.js → chunk-48w0df8a.js} +1 -1
  53. package/dist/{chunk-v4t6dyyh.js → chunk-4cp6193g.js} +2 -2
  54. package/dist/chunk-4d0de73v.js +436 -0
  55. package/dist/chunk-4eecm90d.js +1030 -0
  56. package/dist/{chunk-q7tvkc86.js → chunk-4f4ccg1h.js} +10 -115
  57. package/dist/chunk-4h102wt5.js +65 -0
  58. package/dist/{chunk-3mgywd32.js → chunk-4hv90qcz.js} +1 -1
  59. package/dist/{chunk-bcrxtdcy.js → chunk-4jcqmf9w.js} +39 -29
  60. package/dist/{chunk-v8xem37v.js → chunk-4kk7vxed.js} +8 -6
  61. package/dist/chunk-4nspekjp.js +69 -0
  62. package/dist/chunk-4xmb7bvy.js +125 -0
  63. package/dist/{chunk-427m88ms.js → chunk-4xy0c1dz.js} +8 -8
  64. package/dist/{chunk-41mpwc8h.js → chunk-53c9gb9c.js} +19 -15
  65. package/dist/{chunk-bpts9jbq.js → chunk-53zsn91p.js} +39 -31
  66. package/dist/{chunk-t7cbhqd2.js → chunk-548g1d6z.js} +104 -119
  67. package/dist/chunk-559yvwh1.js +63 -0
  68. package/dist/chunk-5a6ahhvy.js +594 -0
  69. package/dist/{chunk-5tx8dsy0.js → chunk-5c6man70.js} +9531 -18004
  70. package/dist/chunk-5hb5ev7b.js +74 -0
  71. package/dist/{chunk-ggqx30m9.js → chunk-5z28bqne.js} +23 -311
  72. package/dist/{chunk-p7g7pf3f.js → chunk-61ahbn23.js} +8 -6
  73. package/dist/{chunk-0sb5scxx.js → chunk-652wnf1z.js} +5 -5
  74. package/dist/{chunk-7tqhx6dr.js → chunk-66jkaz3q.js} +109 -213
  75. package/dist/{chunk-q25bjaev.js → chunk-677as3nh.js} +2 -2
  76. package/dist/chunk-68ksfahx.js +386 -0
  77. package/dist/{chunk-xs0hwvpa.js → chunk-68pfxvxt.js} +14 -9
  78. package/dist/{chunk-epmheefa.js → chunk-69hys77v.js} +8 -8
  79. package/dist/{chunk-9g2ncq68.js → chunk-6ayqcq3h.js} +120 -127
  80. package/dist/chunk-6kpbgc5w.js +23 -0
  81. package/dist/chunk-6mpsxxsf.js +362 -0
  82. package/dist/chunk-6nze0g86.js +119 -0
  83. package/dist/{chunk-v1mgv1et.js → chunk-6p4cyhb3.js} +4 -3
  84. package/dist/{chunk-2w8633e3.js → chunk-6t62dbnb.js} +61 -100
  85. package/dist/chunk-6t87a3q6.js +2842 -0
  86. package/dist/{chunk-6mz58s8p.js → chunk-6xana182.js} +18 -14
  87. package/dist/{chunk-fpf4cgbt.js → chunk-7bfach0x.js} +9 -9
  88. package/dist/{chunk-n7158r58.js → chunk-7f1ggjr2.js} +75 -69
  89. package/dist/chunk-7fxjmmfw.js +1172 -0
  90. package/dist/{chunk-ckcagq32.js → chunk-7gqf9wej.js} +5 -5
  91. package/dist/{chunk-b1xt9jqg.js → chunk-7j3dkjqq.js} +15 -5
  92. package/dist/chunk-7ns74x0q.js +475 -0
  93. package/dist/{chunk-ghr4s9g6.js → chunk-7qmknpkq.js} +75 -69
  94. package/dist/chunk-7rzepn9c.js +83 -0
  95. package/dist/chunk-7tdcwje9.js +68 -0
  96. package/dist/{chunk-b4mnbry0.js → chunk-8201tnhf.js} +4 -4
  97. package/dist/{chunk-dv1wfr85.js → chunk-8225arm6.js} +5 -4
  98. package/dist/chunk-822wfv88.js +70 -0
  99. package/dist/chunk-837tm8ht.js +183 -0
  100. package/dist/chunk-8a2ajt5d.js +878 -0
  101. package/dist/{chunk-bj0rvnjw.js → chunk-8bymxfn4.js} +39 -29
  102. package/dist/chunk-8cwbzk7h.js +118 -0
  103. package/dist/chunk-8d0ev0m2.js +111 -0
  104. package/dist/{chunk-4pbx3g7s.js → chunk-8g747a8x.js} +1 -1
  105. package/dist/chunk-8kfwb79z.js +436 -0
  106. package/dist/{chunk-xyqr1cww.js → chunk-8me0yq6v.js} +12 -12
  107. package/dist/{chunk-k5gdea6r.js → chunk-8n8285ax.js} +78 -72
  108. package/dist/{chunk-sdj9b9wh.js → chunk-8pn8tvgg.js} +9 -154
  109. package/dist/{chunk-d7mx1phm.js → chunk-8qhr4n77.js} +61 -103
  110. package/dist/{chunk-7ejt5gqq.js → chunk-8s9bbk3r.js} +58 -45
  111. package/dist/{chunk-bmvb57qb.js → chunk-905d2hee.js} +5 -5
  112. package/dist/{chunk-fk06pejm.js → chunk-91xq5y4a.js} +9 -9
  113. package/dist/{chunk-ahjgghpe.js → chunk-93xsyzsp.js} +1 -1
  114. package/dist/chunk-99pmbfqp.js +230 -0
  115. package/dist/{chunk-cgn27dqf.js → chunk-9f14bkn9.js} +3 -3
  116. package/dist/{chunk-sa7nc0vv.js → chunk-9m78gjpd.js} +1 -1
  117. package/dist/{chunk-kq098bkj.js → chunk-9pm2d2gv.js} +245 -316
  118. package/dist/chunk-a136cvvz.js +27 -0
  119. package/dist/{chunk-n5t9m8h9.js → chunk-a1bjde7d.js} +7 -7
  120. package/dist/chunk-a2evk7n1.js +168 -0
  121. package/dist/{chunk-khdjg2v9.js → chunk-a3k4w4cm.js} +38 -28
  122. package/dist/chunk-a3mcc1sb.js +1403 -0
  123. package/dist/{chunk-8hq5kk3y.js → chunk-a4twdmhf.js} +3 -2
  124. package/dist/chunk-a8eaey19.js +66 -0
  125. package/dist/chunk-abkb5pw6.js +426 -0
  126. package/dist/chunk-ae76ded0.js +30 -0
  127. package/dist/{chunk-660kcy7p.js → chunk-agx5w9ce.js} +14 -8
  128. package/dist/chunk-ah46h8rp.js +70 -0
  129. package/dist/chunk-aj3azy6z.js +409 -0
  130. package/dist/chunk-an6z4rzv.js +158 -0
  131. package/dist/{chunk-r6b58y3x.js → chunk-ase86y73.js} +1 -3
  132. package/dist/{chunk-v0wa5ref.js → chunk-avfjb6pd.js} +13 -555
  133. package/dist/{chunk-5mrhhmas.js → chunk-az5x70pn.js} +8 -5
  134. package/dist/{chunk-49k5ktrj.js → chunk-b6rg3egp.js} +30 -15
  135. package/dist/chunk-b73r6ngr.js +125 -0
  136. package/dist/{chunk-8bedvdm1.js → chunk-b81hd3m6.js} +1 -1
  137. package/dist/{chunk-z7pr85qw.js → chunk-b9mhpc0v.js} +3 -3
  138. package/dist/chunk-b9ndqcdv.js +139 -0
  139. package/dist/{chunk-n5516f5q.js → chunk-bd8zk9tn.js} +4 -4
  140. package/dist/chunk-bdy6n17s.js +343 -0
  141. package/dist/{chunk-r55r29js.js → chunk-bf1j3azq.js} +131 -111
  142. package/dist/{chunk-83z0wrnz.js → chunk-bfcet2mw.js} +2 -2
  143. package/dist/{chunk-jy35mvy3.js → chunk-bmjmrk76.js} +7 -7
  144. package/dist/{chunk-2j0j79p0.js → chunk-bsj8e2mb.js} +8 -8
  145. package/dist/{chunk-snvypj85.js → chunk-bt64sq5y.js} +3 -2
  146. package/dist/{chunk-vyc0rjyx.js → chunk-bwg7582d.js} +1 -1
  147. package/dist/{chunk-3be7ka25.js → chunk-bxcfz5gy.js} +1 -1
  148. package/dist/{chunk-mvss16tj.js → chunk-c1k9tg7h.js} +289 -624
  149. package/dist/{chunk-crr52hf4.js → chunk-c5pxerks.js} +13 -11
  150. package/dist/chunk-c6sjhj89.js +1284 -0
  151. package/dist/{chunk-q6dpqj3z.js → chunk-c9q0phsg.js} +9 -6
  152. package/dist/chunk-caj0ab74.js +129 -0
  153. package/dist/{chunk-f64npa3b.js → chunk-chsyvavm.js} +704 -4
  154. package/dist/{chunk-dqh7e4mt.js → chunk-cjpt035a.js} +51 -41
  155. package/dist/{chunk-z8nbjar4.js → chunk-cmcbatgz.js} +7 -5
  156. package/dist/chunk-cnsj3vq2.js +35 -0
  157. package/dist/chunk-cqjmxeqv.js +269 -0
  158. package/dist/{chunk-bt9krt49.js → chunk-cvb1v08x.js} +38 -32
  159. package/dist/{chunk-j3215c49.js → chunk-cxhvyf7c.js} +227 -370
  160. package/dist/{chunk-24x87knx.js → chunk-cxx0e4nv.js} +1326 -2881
  161. package/dist/chunk-cy2hswr1.js +15 -0
  162. package/dist/{chunk-mwp7sj0q.js → chunk-cy6ezb6j.js} +115140 -121540
  163. package/dist/{chunk-ks0m9njy.js → chunk-d2jekryq.js} +8 -8
  164. package/dist/chunk-d4mdda98.js +94 -0
  165. package/dist/{chunk-33khw5gy.js → chunk-d6ve5pze.js} +7 -7
  166. package/dist/{chunk-26wtxbdc.js → chunk-d7886r6a.js} +6928 -6928
  167. package/dist/{chunk-9t1x831d.js → chunk-d83tmb5h.js} +82 -73
  168. package/dist/{chunk-g5sg6y9q.js → chunk-d8meetqc.js} +78 -71
  169. package/dist/{chunk-ra8fbt9p.js → chunk-d8r0q4ps.js} +537 -871
  170. package/dist/chunk-d95k8xkm.js +84 -0
  171. package/dist/chunk-dd4m7t1v.js +112 -0
  172. package/dist/{chunk-er9vzjac.js → chunk-dekbr08w.js} +16 -14
  173. package/dist/{chunk-cvge4pvp.js → chunk-dk8287aa.js} +1 -1
  174. package/dist/{chunk-9mfbqw9k.js → chunk-dm3n2qgd.js} +4 -4
  175. package/dist/{chunk-n6fbyke9.js → chunk-dmxte86x.js} +3 -3
  176. package/dist/{chunk-t24ytdcw.js → chunk-dqvwn28p.js} +12 -10
  177. package/dist/chunk-drkm8yx2.js +34 -0
  178. package/dist/{chunk-ptwn7qw7.js → chunk-dsbewdgm.js} +38 -10
  179. package/dist/{chunk-w7h2yphx.js → chunk-dwekpr47.js} +2 -2
  180. package/dist/{chunk-ks0dm6t3.js → chunk-e3299veq.js} +16 -70
  181. package/dist/{chunk-4x5ym4h2.js → chunk-e5hcyxae.js} +129 -15
  182. package/dist/chunk-e7h0nd5w.js +106 -0
  183. package/dist/{chunk-s2dmn3yg.js → chunk-eaemyebz.js} +5 -5
  184. package/dist/{chunk-cmdsbsb6.js → chunk-edzkkadh.js} +2 -2
  185. package/dist/chunk-em99fnet.js +128 -0
  186. package/dist/{chunk-hfzj1m07.js → chunk-epyaq1z0.js} +13 -4
  187. package/dist/{chunk-v9y80148.js → chunk-eqmkajs4.js} +96 -189
  188. package/dist/{chunk-cs6y2pc9.js → chunk-ergam9ft.js} +5 -5
  189. package/dist/chunk-es2fdse0.js +63 -0
  190. package/dist/{chunk-cenpqc2t.js → chunk-esn3tgm2.js} +8 -6
  191. package/dist/{chunk-qf2v384j.js → chunk-et8ybmt2.js} +9 -7
  192. package/dist/{chunk-aqa7w38f.js → chunk-ew9rp41b.js} +5 -5
  193. package/dist/{chunk-1yabrspp.js → chunk-ewx6xfzb.js} +2 -2
  194. package/dist/chunk-eyjtbtt0.js +137 -0
  195. package/dist/{chunk-rmbp2das.js → chunk-f0jd2p9n.js} +20 -18
  196. package/dist/{chunk-vzqrbsd1.js → chunk-f69rgsm2.js} +5 -5
  197. package/dist/{chunk-f3bapa1x.js → chunk-f6rbj3gz.js} +12 -7
  198. package/dist/chunk-fbhyqxdg.js +1182 -0
  199. package/dist/chunk-feyzykye.js +10 -0
  200. package/dist/chunk-ffhejx56.js +107 -0
  201. package/dist/{chunk-vbbf707n.js → chunk-fhx6nt2a.js} +38 -28
  202. package/dist/chunk-fkkysfev.js +158 -0
  203. package/dist/chunk-fn510gqw.js +216 -0
  204. package/dist/chunk-ftsg8bjm.js +117 -0
  205. package/dist/{chunk-t3bf8hcf.js → chunk-fyts9grb.js} +2 -2
  206. package/dist/{chunk-kd97kxjn.js → chunk-fz0ch109.js} +3 -2
  207. package/dist/{chunk-ye18m1zb.js → chunk-g1jarkx9.js} +38 -8
  208. package/dist/chunk-g9f19ttm.js +15 -0
  209. package/dist/chunk-g9qte35t.js +341 -0
  210. package/dist/chunk-gaav53dc.js +105 -0
  211. package/dist/chunk-gfx3cwrk.js +75 -0
  212. package/dist/{chunk-z9tgzh90.js → chunk-gk2d1x2a.js} +44 -33
  213. package/dist/chunk-gkbat1p9.js +121 -0
  214. package/dist/{chunk-5b7119h5.js → chunk-gmnyk2t8.js} +8 -6
  215. package/dist/{chunk-qvd0k5dn.js → chunk-gnmdprq3.js} +184 -345
  216. package/dist/{chunk-bq6x1ehp.js → chunk-gpz0ddyz.js} +8 -8
  217. package/dist/{chunk-684kdqez.js → chunk-gv1csnc3.js} +198 -302
  218. package/dist/{chunk-x51mdzqq.js → chunk-gv37c8ax.js} +3 -3
  219. package/dist/{chunk-t6h4wf3k.js → chunk-gzr2601k.js} +9 -9
  220. package/dist/{chunk-45e9mkyr.js → chunk-h3pda469.js} +37 -82
  221. package/dist/{chunk-qqfa0dqg.js → chunk-h4b85amj.js} +20 -32
  222. package/dist/{chunk-j4c8s7tn.js → chunk-h5zv78zq.js} +9 -6
  223. package/dist/{chunk-2wcbcdky.js → chunk-h7edytkc.js} +5 -5
  224. package/dist/{chunk-402jrnj6.js → chunk-ha0wbzc3.js} +8 -8
  225. package/dist/{chunk-nxsh6de2.js → chunk-hcgkak1j.js} +20 -125
  226. package/dist/{chunk-tjaqa99q.js → chunk-hezj20qy.js} +3 -3
  227. package/dist/{chunk-kyer92r4.js → chunk-hf85ht0m.js} +2 -2
  228. package/dist/{chunk-m17y8b22.js → chunk-ht1nfygk.js} +38 -28
  229. package/dist/chunk-j316jjby.js +108 -0
  230. package/dist/chunk-j3fge71v.js +115 -0
  231. package/dist/{chunk-b51jjfh5.js → chunk-j4x0t6k2.js} +42 -31
  232. package/dist/{chunk-9gbamk79.js → chunk-j5bth84e.js} +5 -1
  233. package/dist/chunk-j783d5af.js +134 -0
  234. package/dist/chunk-j7pbwf9x.js +108 -0
  235. package/dist/{chunk-0cpnzx7t.js → chunk-j8rnrm5n.js} +114 -150
  236. package/dist/{chunk-vratq94g.js → chunk-j9gxwbe3.js} +1 -1
  237. package/dist/{chunk-3r24h7t6.js → chunk-jaaxk89e.js} +1 -1
  238. package/dist/{chunk-f4jcw0ea.js → chunk-jaew3662.js} +18 -14
  239. package/dist/{chunk-qpm1tmzz.js → chunk-jbbj16w2.js} +120 -191
  240. package/dist/chunk-jerew25v.js +148 -0
  241. package/dist/{chunk-v399mzxk.js → chunk-jf0p00fz.js} +2 -2
  242. package/dist/{chunk-91r0z5qq.js → chunk-jfsah2w3.js} +1059 -1756
  243. package/dist/{chunk-av73dywf.js → chunk-jna2tcvj.js} +8 -8
  244. package/dist/{chunk-jy35z4n0.js → chunk-jng0mb4r.js} +8 -8
  245. package/dist/chunk-jrrmwfp4.js +66 -0
  246. package/dist/{chunk-3m7ge6tj.js → chunk-jt6fa514.js} +14 -12
  247. package/dist/chunk-jvkyx1b7.js +911 -0
  248. package/dist/{chunk-41xeh3t9.js → chunk-jy6c07wa.js} +4 -4
  249. package/dist/chunk-k1fvb16y.js +269 -0
  250. package/dist/{chunk-bqfnp99q.js → chunk-k3s4yk22.js} +1 -1
  251. package/dist/{chunk-4ycz58wj.js → chunk-k46gxg21.js} +68 -8
  252. package/dist/chunk-k8wwyz2t.js +110 -0
  253. package/dist/{chunk-68qevppc.js → chunk-ka3fdfyb.js} +78 -71
  254. package/dist/{chunk-vaebptnz.js → chunk-ka4x7mhn.js} +38 -28
  255. package/dist/chunk-kb99zpps.js +216 -0
  256. package/dist/{chunk-1dyeexvn.js → chunk-kd3mmsd2.js} +4 -4
  257. package/dist/{chunk-1xkekb9y.js → chunk-kfd89dsd.js} +5 -3
  258. package/dist/{chunk-ecsw41df.js → chunk-km1wcchx.js} +81 -76
  259. package/dist/{chunk-dh6c8y1j.js → chunk-kmhwx18d.js} +3 -3
  260. package/dist/{chunk-224x480q.js → chunk-kq91dwkq.js} +8 -6
  261. package/dist/chunk-m17m84b7.js +111 -0
  262. package/dist/chunk-m1a0s9fd.js +1070 -0
  263. package/dist/{chunk-jafes477.js → chunk-m2bcpk8j.js} +4 -3
  264. package/dist/{chunk-veb0gkcf.js → chunk-m7jtn7dk.js} +74 -68
  265. package/dist/chunk-mq2mgyt9.js +103 -0
  266. package/dist/chunk-msv3w4qp.js +1811 -0
  267. package/dist/{chunk-ch53fgm5.js → chunk-mxe1f4jg.js} +13 -11
  268. package/dist/{chunk-hzttn8j7.js → chunk-mzwjvfr2.js} +124 -126
  269. package/dist/{chunk-2de1vaxf.js → chunk-n2n0sq7r.js} +67 -77
  270. package/dist/{chunk-me2ef6g4.js → chunk-n8mpqdje.js} +1 -1
  271. package/dist/chunk-n9e984ba.js +132 -0
  272. package/dist/chunk-netzwgv1.js +154 -0
  273. package/dist/{chunk-xszk7n10.js → chunk-nh3cd07f.js} +1 -1
  274. package/dist/chunk-njrz6mbe.js +66 -0
  275. package/dist/{chunk-e1ge9n4d.js → chunk-nv7pfr7k.js} +2 -2
  276. package/dist/{chunk-vygf94dw.js → chunk-nwd8pb55.js} +74 -68
  277. package/dist/{chunk-5hva0tsg.js → chunk-p2yv7m0g.js} +6 -6
  278. package/dist/chunk-p5t2vy90.js +259 -0
  279. package/dist/{chunk-zk2wsm7d.js → chunk-p7vkh4wx.js} +2 -2
  280. package/dist/{chunk-da4ve9t5.js → chunk-p8crqj70.js} +10 -10
  281. package/dist/{chunk-n2874aq5.js → chunk-pcngtzr8.js} +12 -6
  282. package/dist/{chunk-6td4c2eq.js → chunk-pdjem6h1.js} +53 -71
  283. package/dist/{chunk-zpc0kwkb.js → chunk-pmxdzjq0.js} +6 -6
  284. package/dist/{chunk-pa7saazk.js → chunk-pnkcecq2.js} +27 -55
  285. package/dist/{chunk-zsfxha74.js → chunk-pshjyzq4.js} +8 -7
  286. package/dist/chunk-pt1yj9zf.js +107 -0
  287. package/dist/{chunk-n9x557ea.js → chunk-py6b9d5b.js} +2312 -4200
  288. package/dist/chunk-q7n8d91g.js +67 -0
  289. package/dist/{chunk-e5pntxye.js → chunk-q7tpyeb3.js} +6 -4
  290. package/dist/{chunk-7ymfj7m3.js → chunk-q82r31er.js} +1 -1
  291. package/dist/chunk-qajrkk97.js +298 -0
  292. package/dist/chunk-qbrh24cn.js +119 -0
  293. package/dist/chunk-qd9ntz7c.js +230 -0
  294. package/dist/chunk-qfr5tcd5.js +2537 -0
  295. package/dist/chunk-qpzfmkct.js +456 -0
  296. package/dist/{chunk-35y0r56v.js → chunk-qtfc6wdh.js} +1 -4
  297. package/dist/chunk-r032587e.js +83 -0
  298. package/dist/{chunk-rryx19hp.js → chunk-r2k2jy0y.js} +2 -2
  299. package/dist/{chunk-pgnnrm2v.js → chunk-r4dnnggx.js} +21 -17
  300. package/dist/{chunk-k9a8jemz.js → chunk-r5n8fvw0.js} +7 -7
  301. package/dist/{chunk-jt0pha6y.js → chunk-r7kh03er.js} +222 -196
  302. package/dist/{chunk-n0k8xrey.js → chunk-rfs0mfg8.js} +140 -158
  303. package/dist/{chunk-dr4qq42x.js → chunk-rgbbtszq.js} +9 -9
  304. package/dist/{chunk-fdwa7gem.js → chunk-rkak3kjw.js} +7 -7
  305. package/dist/chunk-rp568bfw.js +111 -0
  306. package/dist/chunk-rtv718sv.js +146 -0
  307. package/dist/{chunk-rw466wqn.js → chunk-rvkvehat.js} +5284 -3093
  308. package/dist/chunk-s1baskk7.js +14 -0
  309. package/dist/{chunk-2cgdr2n7.js → chunk-s1eb67v3.js} +74 -68
  310. package/dist/{chunk-1szr63w0.js → chunk-s59kx26r.js} +81 -72
  311. package/dist/chunk-s6yk6m3b.js +109 -0
  312. package/dist/{chunk-80qg1pzv.js → chunk-sca71yv8.js} +11 -9
  313. package/dist/chunk-sfrwm87k.js +151 -0
  314. package/dist/chunk-sgaknx21.js +123 -0
  315. package/dist/{chunk-myzwt5yw.js → chunk-snyaz093.js} +9 -15
  316. package/dist/{chunk-rwexx5ns.js → chunk-sq8wkk3z.js} +1 -3
  317. package/dist/{chunk-faycqscv.js → chunk-sxqj7s2h.js} +2 -2
  318. package/dist/chunk-t2m6cjp1.js +264 -0
  319. package/dist/chunk-t6hmvb6k.js +1021 -0
  320. package/dist/chunk-t72x960a.js +125 -0
  321. package/dist/chunk-t9kashay.js +440 -0
  322. package/dist/chunk-t9wzf009.js +151 -0
  323. package/dist/chunk-ta1dgyj1.js +154 -0
  324. package/dist/{chunk-5deqy8r0.js → chunk-tavxhayf.js} +77 -71
  325. package/dist/{chunk-35b0ek0j.js → chunk-tcdv4gp8.js} +13 -9
  326. package/dist/chunk-td3b74vm.js +362 -0
  327. package/dist/{chunk-mt25echc.js → chunk-tezak8rx.js} +1 -1
  328. package/dist/chunk-tgcw0rzx.js +262 -0
  329. package/dist/{chunk-9rcbyag3.js → chunk-tmdbrszg.js} +2 -2
  330. package/dist/{chunk-jknt3rxg.js → chunk-v17qee2y.js} +7 -9
  331. package/dist/{chunk-frbv3xqa.js → chunk-v1jd31dw.js} +2 -2
  332. package/dist/chunk-var1et7e.js +66 -0
  333. package/dist/{chunk-cettj572.js → chunk-ve9wswz4.js} +7 -131
  334. package/dist/{chunk-hqmz36b3.js → chunk-vf612n57.js} +21 -101
  335. package/dist/chunk-vfhabc5j.js +109 -0
  336. package/dist/{chunk-s7qj2hg5.js → chunk-vgy0w6tt.js} +2 -2
  337. package/dist/chunk-vh02fvz1.js +375 -0
  338. package/dist/{chunk-ctmt7xh1.js → chunk-vm935era.js} +619 -887
  339. package/dist/{chunk-dxc7begm.js → chunk-vtb8z6as.js} +14 -10
  340. package/dist/chunk-w2kf9sxn.js +115 -0
  341. package/dist/chunk-w7trx259.js +132 -0
  342. package/dist/{chunk-8z039kef.js → chunk-w92b262y.js} +53 -54
  343. package/dist/chunk-w9zqjhvm.js +103 -0
  344. package/dist/{chunk-9cc60ae5.js → chunk-wb2fvy1k.js} +74 -68
  345. package/dist/chunk-ws2d81aj.js +123 -0
  346. package/dist/{chunk-5zh1fbrj.js → chunk-wssgdcck.js} +2 -2
  347. package/dist/{chunk-t9z6njcr.js → chunk-wtycm8km.js} +9 -9
  348. package/dist/chunk-wz0d8mna.js +108 -0
  349. package/dist/chunk-x01wtn3p.js +144 -0
  350. package/dist/{chunk-dnyeb288.js → chunk-x2sp7rcv.js} +73 -105
  351. package/dist/{chunk-zrse3zpz.js → chunk-xbprynsc.js} +18 -46
  352. package/dist/{chunk-yxnwsp4f.js → chunk-xext3y2y.js} +8 -6
  353. package/dist/{chunk-fzxg8v1y.js → chunk-xycy3c8q.js} +15 -12
  354. package/dist/{chunk-cpma9zs5.js → chunk-y01ys1vm.js} +20 -71
  355. package/dist/{chunk-d7vv2ydf.js → chunk-y78t50v0.js} +2 -2
  356. package/dist/{chunk-xkr7as9h.js → chunk-y9bgt2k1.js} +13 -9
  357. package/dist/{chunk-s2gm9vfk.js → chunk-ydm0nfsv.js} +5 -5
  358. package/dist/{chunk-gjyc3293.js → chunk-yetebjek.js} +282 -495
  359. package/dist/{chunk-hkn7tzgv.js → chunk-ym5r3jnk.js} +1 -1
  360. package/dist/chunk-ysks0ewj.js +237 -0
  361. package/dist/chunk-yv3evkgg.js +68 -0
  362. package/dist/{chunk-athjeyrt.js → chunk-yw79dz62.js} +4 -4
  363. package/dist/{chunk-s84smrx4.js → chunk-yy59gvs4.js} +151 -189
  364. package/dist/{chunk-12pv5fez.js → chunk-yyax4hdg.js} +10 -8
  365. package/dist/chunk-z0q85m5f.js +108 -0
  366. package/dist/chunk-z1bs6d7k.js +24 -0
  367. package/dist/chunk-z6e5jp2w.js +119 -0
  368. package/dist/{chunk-rjz6btwk.js → chunk-z7ssqvt6.js} +4972 -4638
  369. package/dist/chunk-z95yxwyb.js +61 -0
  370. package/dist/{chunk-0nqrscrr.js → chunk-z9aqj026.js} +5 -5
  371. package/dist/chunk-zc6dxhk9.js +169 -0
  372. package/dist/{chunk-ve60fbtd.js → chunk-ze6zvkg6.js} +2 -2
  373. package/dist/{chunk-t0rgmccj.js → chunk-zejm280k.js} +1 -1
  374. package/dist/{chunk-krstc7m7.js → chunk-zfapazzd.js} +15 -11
  375. package/dist/chunk-zj4fqmnc.js +219 -0
  376. package/dist/chunk-zkrpbswn.js +1608 -0
  377. package/dist/chunk-zktbb38m.js +112 -0
  378. package/dist/{chunk-vjc1svpc.js → chunk-zptcqa7t.js} +82 -75
  379. package/dist/{chunk-gbcqdr0x.js → chunk-zvnsjbt8.js} +1 -1
  380. package/dist/chunk-zwaanw8y.js +110 -0
  381. package/dist/{chunk-g3t0act8.js → chunk-zzm33q8x.js} +1 -1
  382. package/dist/{chunk-s8fzxy94.js → chunk-zzzc1ead.js} +17 -13
  383. package/dist/cli.js +34 -10
  384. package/dist/vendor/audio-capture/arm64-darwin/audio-capture.node +0 -0
  385. package/dist/vendor/audio-capture/arm64-linux/audio-capture.node +0 -0
  386. package/dist/vendor/audio-capture/arm64-win32/audio-capture.node +0 -0
  387. package/dist/vendor/audio-capture/x64-darwin/audio-capture.node +0 -0
  388. package/dist/vendor/audio-capture/x64-linux/audio-capture.node +0 -0
  389. package/dist/vendor/audio-capture/x64-win32/audio-capture.node +0 -0
  390. package/package.json +8 -5
  391. package/scripts/postinstall.cjs +319 -0
  392. package/dist/chunk-0291smg3.js +0 -42
  393. package/dist/chunk-04g2ty3v.js +0 -104
  394. package/dist/chunk-069x95ne.js +0 -764
  395. package/dist/chunk-06x02eab.js +0 -655
  396. package/dist/chunk-09pjmga5.js +0 -713
  397. package/dist/chunk-0g90je6r.js +0 -145
  398. package/dist/chunk-0rddv9vb.js +0 -328
  399. package/dist/chunk-162w6yv3.js +0 -756
  400. package/dist/chunk-1gjbaa3n.js +0 -128
  401. package/dist/chunk-23wg4mnt.js +0 -404
  402. package/dist/chunk-2gbjtg7c.js +0 -102
  403. package/dist/chunk-2v1q0ezq.js +0 -102
  404. package/dist/chunk-37n7jkxe.js +0 -436
  405. package/dist/chunk-38svjnh4.js +0 -158
  406. package/dist/chunk-3bg1089y.js +0 -616
  407. package/dist/chunk-3d8ck5ne.js +0 -112
  408. package/dist/chunk-3g6rf9sz.js +0 -106
  409. package/dist/chunk-3x3rr2n5.js +0 -57
  410. package/dist/chunk-4f6q3d38.js +0 -117
  411. package/dist/chunk-4h57km3m.js +0 -74
  412. package/dist/chunk-4kyh2618.js +0 -99
  413. package/dist/chunk-4w9vc9vc.js +0 -119
  414. package/dist/chunk-53hqpp5z.js +0 -208
  415. package/dist/chunk-5m2rmc2k.js +0 -128
  416. package/dist/chunk-5wp9pkpt.js +0 -539
  417. package/dist/chunk-5ym9f6w3.js +0 -263
  418. package/dist/chunk-6f938733.js +0 -1027
  419. package/dist/chunk-6nenxecd.js +0 -115
  420. package/dist/chunk-6rja0h86.js +0 -1593
  421. package/dist/chunk-70q6dp4d.js +0 -96
  422. package/dist/chunk-7bn0wzs3.js +0 -1493
  423. package/dist/chunk-7e2e0bfm.js +0 -65
  424. package/dist/chunk-7ywadnax.js +0 -490
  425. package/dist/chunk-7z33j54s.js +0 -142
  426. package/dist/chunk-8yvfkzyh.js +0 -58
  427. package/dist/chunk-9abpx1kv.js +0 -2833
  428. package/dist/chunk-9ks2nswb.js +0 -114
  429. package/dist/chunk-9wrds5tr.js +0 -109
  430. package/dist/chunk-ab2twken.js +0 -102
  431. package/dist/chunk-abncjeag.js +0 -97
  432. package/dist/chunk-am6w4x6y.js +0 -103
  433. package/dist/chunk-b73bd7db.js +0 -496
  434. package/dist/chunk-bc7nvynh.js +0 -195
  435. package/dist/chunk-br17dhef.js +0 -103
  436. package/dist/chunk-c3k0sdey.js +0 -281
  437. package/dist/chunk-c909bmyv.js +0 -103
  438. package/dist/chunk-cftsv9w4.js +0 -129
  439. package/dist/chunk-cj1a7npk.js +0 -99
  440. package/dist/chunk-cyscs4k5.js +0 -1330
  441. package/dist/chunk-czr7y063.js +0 -348
  442. package/dist/chunk-d93sndem.js +0 -372
  443. package/dist/chunk-ddz8xbpd.js +0 -481
  444. package/dist/chunk-dkhqx4hk.js +0 -84
  445. package/dist/chunk-dsrharmv.js +0 -359
  446. package/dist/chunk-eqmy5d05.js +0 -56
  447. package/dist/chunk-f2crxw2c.js +0 -5400
  448. package/dist/chunk-f8zga40p.js +0 -234
  449. package/dist/chunk-fbgm2ym6.js +0 -990
  450. package/dist/chunk-fcbbsswe.js +0 -119
  451. package/dist/chunk-fda654nt.js +0 -6121
  452. package/dist/chunk-ffmv9ezj.js +0 -104
  453. package/dist/chunk-fmjte7md.js +0 -38
  454. package/dist/chunk-fqtwqxxc.js +0 -293
  455. package/dist/chunk-g8k85nkd.js +0 -802
  456. package/dist/chunk-ge4ak7dj.js +0 -127
  457. package/dist/chunk-gpqemecy.js +0 -126
  458. package/dist/chunk-h19p6s3b.js +0 -131
  459. package/dist/chunk-j0sk1rct.js +0 -998
  460. package/dist/chunk-j1wfpa1a.js +0 -70
  461. package/dist/chunk-j829fx31.js +0 -3458
  462. package/dist/chunk-jqctzrvd.js +0 -722
  463. package/dist/chunk-jx817w05.js +0 -11
  464. package/dist/chunk-ka6sab33.js +0 -174
  465. package/dist/chunk-krjsvmwp.js +0 -101
  466. package/dist/chunk-kvpe50pm.js +0 -311
  467. package/dist/chunk-mez504fj.js +0 -113
  468. package/dist/chunk-mj6wbrae.js +0 -105
  469. package/dist/chunk-n0pg2kpe.js +0 -122
  470. package/dist/chunk-n4qtqkp0.js +0 -295
  471. package/dist/chunk-n9meha2m.js +0 -73
  472. package/dist/chunk-ndk7q5n3.js +0 -169
  473. package/dist/chunk-ng6n9t4h.js +0 -56
  474. package/dist/chunk-p3pz13x2.js +0 -1933
  475. package/dist/chunk-p9ez6zgq.js +0 -2656
  476. package/dist/chunk-ph750kx1.js +0 -550
  477. package/dist/chunk-pxb99zqs.js +0 -117
  478. package/dist/chunk-q1yqc5n3.js +0 -100
  479. package/dist/chunk-qtfqk0jr.js +0 -131
  480. package/dist/chunk-qzfmdh1t.js +0 -388
  481. package/dist/chunk-r3cv0j9n.js +0 -456
  482. package/dist/chunk-rx0pbgym.js +0 -97
  483. package/dist/chunk-s624rd5j.js +0 -531
  484. package/dist/chunk-satndwqj.js +0 -285
  485. package/dist/chunk-ssrxnkd1.js +0 -109
  486. package/dist/chunk-t2pgctqx.js +0 -106
  487. package/dist/chunk-t7sgwf31.js +0 -644
  488. package/dist/chunk-tth904tj.js +0 -53
  489. package/dist/chunk-typpbjhy.js +0 -128
  490. package/dist/chunk-vp6nrhdq.js +0 -102
  491. package/dist/chunk-vtjm53nt.js +0 -432
  492. package/dist/chunk-w412n7tq.js +0 -469
  493. package/dist/chunk-w4153rky.js +0 -1885
  494. package/dist/chunk-wdgv15as.js +0 -212
  495. package/dist/chunk-wgn9kydv.js +0 -58
  496. package/dist/chunk-whknbrk0.js +0 -184
  497. package/dist/chunk-x1k8e1xc.js +0 -56
  498. package/dist/chunk-x45xx6sc.js +0 -105
  499. package/dist/chunk-x4xvqbe5.js +0 -1166
  500. package/dist/chunk-x8b7vft8.js +0 -132
  501. package/dist/chunk-xaycc8qe.js +0 -44
  502. package/dist/chunk-xd4785ks.js +0 -73
  503. package/dist/chunk-xjxgmxhq.js +0 -463
  504. package/dist/chunk-xx2x3tz9.js +0 -166
  505. package/dist/chunk-y2j23eem.js +0 -101
  506. package/dist/chunk-y83j09wv.js +0 -123
  507. package/dist/chunk-yh8460pb.js +0 -119
  508. package/dist/chunk-z6nhchdb.js +0 -60
  509. package/dist/chunk-zbt73sj7.js +0 -192
  510. package/dist/chunk-zmwaatmq.js +0 -118
  511. package/dist/chunk-zvdg9tex.js +0 -135
  512. package/dist/chunk-zwa780cx.js +0 -584
  513. package/dist/{chunk-whvdag1y.js → chunk-3bfs3x0h.js} +9 -9
  514. package/dist/{chunk-27xc1csx.js → chunk-dggvswz1.js} +3 -3
@@ -0,0 +1,3587 @@
1
+ // @bun
2
+ import {
3
+ AGENT_SOURCE_GROUPS,
4
+ compareAgentsByName,
5
+ getOverrideSourceLabel,
6
+ init_agentDisplay,
7
+ resolveAgentModelDisplay,
8
+ resolveAgentOverrides
9
+ } from "./chunk-vgy0w6tt.js";
10
+ import {
11
+ init_useMergedTools,
12
+ useMergedTools
13
+ } from "./chunk-ewx6xfzb.js";
14
+ import"./chunk-nv7pfr7k.js";
15
+ import"./chunk-v1jd31dw.js";
16
+ import {
17
+ editFileInEditor,
18
+ editPromptInEditor,
19
+ init_promptEditor
20
+ } from "./chunk-91xq5y4a.js";
21
+ import {
22
+ init_useMainLoopModel,
23
+ useMainLoopModel
24
+ } from "./chunk-z9aqj026.js";
25
+ import {
26
+ AGENT_COLORS,
27
+ AGENT_COLOR_TO_THEME_COLOR,
28
+ BashTool,
29
+ ConfigurableShortcutHint,
30
+ ExitPlanModeV2Tool,
31
+ FileEditTool,
32
+ FileReadTool,
33
+ FileWriteTool,
34
+ GlobTool,
35
+ GrepTool,
36
+ ListMcpResourcesTool,
37
+ Markdown,
38
+ NotebookEditTool,
39
+ ReadMcpResourceTool,
40
+ Select,
41
+ Spinner,
42
+ TaskOutputTool,
43
+ TaskStopTool,
44
+ TextInput,
45
+ TodoWriteTool,
46
+ WebFetchTool,
47
+ WebSearchTool,
48
+ asSystemPrompt,
49
+ capitalize_default,
50
+ createAbortController,
51
+ createUserMessage,
52
+ filterToolsForAgent,
53
+ getActiveAgentsFromList,
54
+ getAgentColor,
55
+ getAgentModelDisplay,
56
+ getAgentModelOptions,
57
+ getEmptyToolPermissionContext,
58
+ getMemoryScopeDisplay,
59
+ getTools,
60
+ getUserContext,
61
+ init_AppState,
62
+ init_BashTool,
63
+ init_ConfigurableShortcutHint,
64
+ init_ExitPlanModeV2Tool,
65
+ init_FileEditTool,
66
+ init_FileReadTool,
67
+ init_FileWriteTool,
68
+ init_GlobTool,
69
+ init_GrepTool,
70
+ init_ListMcpResourcesTool,
71
+ init_Markdown,
72
+ init_NotebookEditTool,
73
+ init_ReadMcpResourceTool,
74
+ init_Spinner,
75
+ init_TaskOutputTool,
76
+ init_TaskStopTool,
77
+ init_TextInput,
78
+ init_TodoWriteTool,
79
+ init_Tool,
80
+ init_WebFetchTool,
81
+ init_WebSearchTool,
82
+ init_abortController,
83
+ init_agent,
84
+ init_agentColorManager,
85
+ init_agentMemory,
86
+ init_agentToolUtils,
87
+ init_api,
88
+ init_capitalize,
89
+ init_claude,
90
+ init_context,
91
+ init_loadAgentsDir,
92
+ init_messages1 as init_messages,
93
+ init_select,
94
+ init_systemPromptType,
95
+ init_tools1 as init_tools,
96
+ init_utils,
97
+ isBuiltInAgent,
98
+ isCustomAgent,
99
+ isMcpTool,
100
+ isPluginAgent,
101
+ loadAgentMemoryPrompt,
102
+ normalizeMessagesForAPI,
103
+ prependUserContext,
104
+ queryModelWithoutStreaming,
105
+ resolveAgentTools,
106
+ setAgentColor,
107
+ useAppState,
108
+ useSetAppState
109
+ } from "./chunk-cy6ezb6j.js";
110
+ import"./chunk-zejm280k.js";
111
+ import"./chunk-g1jarkx9.js";
112
+ import"./chunk-yyax4hdg.js";
113
+ import"./chunk-4nspekjp.js";
114
+ import"./chunk-kmhwx18d.js";
115
+ import"./chunk-var1et7e.js";
116
+ import"./chunk-2gzv8nrw.js";
117
+ import"./chunk-ehtwnxpg.js";
118
+ import"./chunk-dmxte86x.js";
119
+ import"./chunk-d6ve5pze.js";
120
+ import"./chunk-bxcfz5gy.js";
121
+ import"./chunk-dekbr08w.js";
122
+ import"./chunk-f6rbj3gz.js";
123
+ import"./chunk-9f14bkn9.js";
124
+ import"./chunk-cgfdkzhb.js";
125
+ import {
126
+ init_useExitOnCtrlCDWithKeybindings,
127
+ useExitOnCtrlCDWithKeybindings
128
+ } from "./chunk-k46gxg21.js";
129
+ import"./chunk-j5bth84e.js";
130
+ import"./chunk-8qhr4n77.js";
131
+ import"./chunk-az5x70pn.js";
132
+ import"./chunk-epyaq1z0.js";
133
+ import {
134
+ init_useKeybinding
135
+ } from "./chunk-0jzdwbdc.js";
136
+ import"./chunk-ps49ymvj.js";
137
+ import {
138
+ TungstenTool,
139
+ init_TungstenTool
140
+ } from "./chunk-p7vkh4wx.js";
141
+ import"./chunk-cmcbatgz.js";
142
+ import"./chunk-agx5w9ce.js";
143
+ import"./chunk-48w0df8a.js";
144
+ import"./chunk-y78t50v0.js";
145
+ import"./chunk-4jm600zv.js";
146
+ import"./chunk-n8mpqdje.js";
147
+ import"./chunk-dqvwn28p.js";
148
+ import"./chunk-esn3tgm2.js";
149
+ import"./chunk-mx28h61f.js";
150
+ import"./chunk-dsbewdgm.js";
151
+ import"./chunk-sxqj7s2h.js";
152
+ import"./chunk-8201tnhf.js";
153
+ import"./chunk-2qwgfjcj.js";
154
+ import"./chunk-chsyvavm.js";
155
+ import"./chunk-w92b262y.js";
156
+ import {
157
+ AGENT_TOOL_NAME,
158
+ capitalize,
159
+ getManagedFilePath,
160
+ getSettingSourceName,
161
+ init_constants,
162
+ init_constants1 as init_constants2,
163
+ init_managedPath,
164
+ init_mcpStringUtils,
165
+ init_paths,
166
+ init_stringUtils,
167
+ isAutoMemoryEnabled,
168
+ mcpInfoFromString,
169
+ plural
170
+ } from "./chunk-c1k9tg7h.js";
171
+ import"./chunk-905d2hee.js";
172
+ import"./chunk-rkak3kjw.js";
173
+ import"./chunk-p2yv7m0g.js";
174
+ import {
175
+ count,
176
+ init_array
177
+ } from "./chunk-1cwdhk7a.js";
178
+ import"./chunk-j9gxwbe3.js";
179
+ import"./chunk-64c1avct.js";
180
+ import"./chunk-6kpbgc5w.js";
181
+ import"./chunk-8g5pe1gr.js";
182
+ import"./chunk-hezj20qy.js";
183
+ import"./chunk-4cp6193g.js";
184
+ import"./chunk-8g747a8x.js";
185
+ import"./chunk-d7886r6a.js";
186
+ import"./chunk-f5ma3nh5.js";
187
+ import"./chunk-qz2x630m.js";
188
+ import"./chunk-dk8287aa.js";
189
+ import"./chunk-r2k2jy0y.js";
190
+ import"./chunk-3c25bcsw.js";
191
+ import"./chunk-2q39ej51.js";
192
+ import"./chunk-q82r31er.js";
193
+ import"./chunk-p2816w9z.js";
194
+ import"./chunk-v9smspw2.js";
195
+ import"./chunk-v1kzp02e.js";
196
+ import {
197
+ init_format,
198
+ truncateToWidth
199
+ } from "./chunk-qpzfmkct.js";
200
+ import"./chunk-crmjpsqe.js";
201
+ import {
202
+ Byline,
203
+ Dialog,
204
+ Divider,
205
+ KeyboardShortcutHint,
206
+ ThemedBox_default,
207
+ ThemedText,
208
+ init_source,
209
+ init_src,
210
+ source_default,
211
+ useKeybinding
212
+ } from "./chunk-rvkvehat.js";
213
+ import {
214
+ require_jsx_dev_runtime,
215
+ require_react
216
+ } from "./chunk-g338npwr.js";
217
+ import {
218
+ init_analytics,
219
+ logEvent
220
+ } from "./chunk-h0rbjg6x.js";
221
+ import"./chunk-0vkfrmqm.js";
222
+ import"./chunk-0xjaqda8.js";
223
+ import"./chunk-21z7acxh.js";
224
+ import"./chunk-rgbbtszq.js";
225
+ import"./chunk-1thgdca1.js";
226
+ import"./chunk-qnfx3qtx.js";
227
+ import"./chunk-yw79dz62.js";
228
+ import {
229
+ getCwd,
230
+ init_cwd
231
+ } from "./chunk-b81hd3m6.js";
232
+ import {
233
+ init_log,
234
+ logError
235
+ } from "./chunk-61ahbn23.js";
236
+ import"./chunk-8tnsngw2.js";
237
+ import"./chunk-edzkkadh.js";
238
+ import"./chunk-bwg7582d.js";
239
+ import"./chunk-5z28bqne.js";
240
+ import {
241
+ figures_default,
242
+ init_figures
243
+ } from "./chunk-qajrkk97.js";
244
+ import {
245
+ init_slowOperations,
246
+ jsonParse
247
+ } from "./chunk-hcgkak1j.js";
248
+ import"./chunk-fbv4apne.js";
249
+ import {
250
+ getErrnoCode,
251
+ init_errors,
252
+ toError
253
+ } from "./chunk-z6e5jp2w.js";
254
+ import {
255
+ getClaudeConfigHomeDir,
256
+ init_envUtils
257
+ } from "./chunk-jaaxk89e.js";
258
+ import"./chunk-h4b85amj.js";
259
+ import"./chunk-07069jq1.js";
260
+ import"./chunk-vf612n57.js";
261
+ import"./chunk-d4mdda98.js";
262
+ import"./chunk-7wm5s02e.js";
263
+ import {
264
+ init_sdk
265
+ } from "./chunk-4g3v8y12.js";
266
+ import {
267
+ APIUserAbortError
268
+ } from "./chunk-7739pg2c.js";
269
+ import"./chunk-nh3cd07f.js";
270
+ import"./chunk-8pn8tvgg.js";
271
+ import"./chunk-netzwgv1.js";
272
+ import {
273
+ __esm,
274
+ __toESM
275
+ } from "./chunk-qp2qdcda.js";
276
+
277
+ // src/components/agents/types.ts
278
+ var AGENT_PATHS;
279
+ var init_types = __esm(() => {
280
+ AGENT_PATHS = {
281
+ FOLDER_NAME: ".claude",
282
+ AGENTS_DIR: "agents"
283
+ };
284
+ });
285
+
286
+ // src/components/agents/agentFileUtils.ts
287
+ import { mkdir, open, unlink } from "fs/promises";
288
+ import { join } from "path";
289
+ function formatAgentAsMarkdown(agentType, whenToUse, tools, systemPrompt, color, model, memory, effort) {
290
+ const escapedWhenToUse = whenToUse.replace(/\\/g, "\\\\").replace(/"/g, "\\\"").replace(/\n/g, "\\\\n");
291
+ const isAllTools = tools === undefined || tools.length === 1 && tools[0] === "*";
292
+ const toolsLine = isAllTools ? "" : `
293
+ tools: ${tools.join(", ")}`;
294
+ const modelLine = model ? `
295
+ model: ${model}` : "";
296
+ const effortLine = effort !== undefined ? `
297
+ effort: ${effort}` : "";
298
+ const colorLine = color ? `
299
+ color: ${color}` : "";
300
+ const memoryLine = memory ? `
301
+ memory: ${memory}` : "";
302
+ return `---
303
+ name: ${agentType}
304
+ description: "${escapedWhenToUse}"${toolsLine}${modelLine}${effortLine}${colorLine}${memoryLine}
305
+ ---
306
+
307
+ ${systemPrompt}
308
+ `;
309
+ }
310
+ function getAgentDirectoryPath(location) {
311
+ switch (location) {
312
+ case "flagSettings":
313
+ throw new Error(`Cannot get directory path for ${location} agents`);
314
+ case "userSettings":
315
+ return join(getClaudeConfigHomeDir(), AGENT_PATHS.AGENTS_DIR);
316
+ case "projectSettings":
317
+ return join(getCwd(), AGENT_PATHS.FOLDER_NAME, AGENT_PATHS.AGENTS_DIR);
318
+ case "policySettings":
319
+ return join(getManagedFilePath(), AGENT_PATHS.FOLDER_NAME, AGENT_PATHS.AGENTS_DIR);
320
+ case "localSettings":
321
+ return join(getCwd(), AGENT_PATHS.FOLDER_NAME, AGENT_PATHS.AGENTS_DIR);
322
+ }
323
+ }
324
+ function getRelativeAgentDirectoryPath(location) {
325
+ switch (location) {
326
+ case "projectSettings":
327
+ return join(".", AGENT_PATHS.FOLDER_NAME, AGENT_PATHS.AGENTS_DIR);
328
+ default:
329
+ return getAgentDirectoryPath(location);
330
+ }
331
+ }
332
+ function getNewAgentFilePath(agent) {
333
+ const dirPath = getAgentDirectoryPath(agent.source);
334
+ return join(dirPath, `${agent.agentType}.md`);
335
+ }
336
+ function getActualAgentFilePath(agent) {
337
+ if (agent.source === "built-in") {
338
+ return "Built-in";
339
+ }
340
+ if (agent.source === "plugin") {
341
+ throw new Error("Cannot get file path for plugin agents");
342
+ }
343
+ const dirPath = getAgentDirectoryPath(agent.source);
344
+ const filename = agent.filename || agent.agentType;
345
+ return join(dirPath, `${filename}.md`);
346
+ }
347
+ function getNewRelativeAgentFilePath(agent) {
348
+ if (agent.source === "built-in") {
349
+ return "Built-in";
350
+ }
351
+ const dirPath = getRelativeAgentDirectoryPath(agent.source);
352
+ return join(dirPath, `${agent.agentType}.md`);
353
+ }
354
+ function getActualRelativeAgentFilePath(agent) {
355
+ if (isBuiltInAgent(agent)) {
356
+ return "Built-in";
357
+ }
358
+ if (isPluginAgent(agent)) {
359
+ return `Plugin: ${agent.plugin || "Unknown"}`;
360
+ }
361
+ if (agent.source === "flagSettings") {
362
+ return "CLI argument";
363
+ }
364
+ const dirPath = getRelativeAgentDirectoryPath(agent.source);
365
+ const filename = agent.filename || agent.agentType;
366
+ return join(dirPath, `${filename}.md`);
367
+ }
368
+ async function ensureAgentDirectoryExists(source) {
369
+ const dirPath = getAgentDirectoryPath(source);
370
+ await mkdir(dirPath, { recursive: true });
371
+ return dirPath;
372
+ }
373
+ async function saveAgentToFile(source, agentType, whenToUse, tools, systemPrompt, checkExists = true, color, model, memory, effort) {
374
+ if (source === "built-in") {
375
+ throw new Error("Cannot save built-in agents");
376
+ }
377
+ await ensureAgentDirectoryExists(source);
378
+ const filePath = getNewAgentFilePath({ source, agentType });
379
+ const content = formatAgentAsMarkdown(agentType, whenToUse, tools, systemPrompt, color, model, memory, effort);
380
+ try {
381
+ await writeFileAndFlush(filePath, content, checkExists ? "wx" : "w");
382
+ } catch (e) {
383
+ if (getErrnoCode(e) === "EEXIST") {
384
+ throw new Error(`Agent file already exists: ${filePath}`);
385
+ }
386
+ throw e;
387
+ }
388
+ }
389
+ async function updateAgentFile(agent, newWhenToUse, newTools, newSystemPrompt, newColor, newModel, newMemory, newEffort) {
390
+ if (agent.source === "built-in") {
391
+ throw new Error("Cannot update built-in agents");
392
+ }
393
+ const filePath = getActualAgentFilePath(agent);
394
+ const content = formatAgentAsMarkdown(agent.agentType, newWhenToUse, newTools, newSystemPrompt, newColor, newModel, newMemory, newEffort);
395
+ await writeFileAndFlush(filePath, content);
396
+ }
397
+ async function deleteAgentFromFile(agent) {
398
+ if (agent.source === "built-in") {
399
+ throw new Error("Cannot delete built-in agents");
400
+ }
401
+ const filePath = getActualAgentFilePath(agent);
402
+ try {
403
+ await unlink(filePath);
404
+ } catch (e) {
405
+ const code = getErrnoCode(e);
406
+ if (code !== "ENOENT") {
407
+ throw e;
408
+ }
409
+ }
410
+ }
411
+ async function writeFileAndFlush(filePath, content, flag = "w") {
412
+ const handle = await open(filePath, flag);
413
+ try {
414
+ await handle.writeFile(content, { encoding: "utf-8" });
415
+ await handle.datasync();
416
+ } finally {
417
+ await handle.close();
418
+ }
419
+ }
420
+ var init_agentFileUtils = __esm(() => {
421
+ init_managedPath();
422
+ init_loadAgentsDir();
423
+ init_cwd();
424
+ init_envUtils();
425
+ init_errors();
426
+ init_types();
427
+ });
428
+
429
+ // src/components/agents/AgentDetail.tsx
430
+ function AgentDetail({ agent, tools, onBack }) {
431
+ const resolvedTools = resolveAgentTools(agent, tools, false);
432
+ const filePath = getActualRelativeAgentFilePath(agent);
433
+ const backgroundColor = getAgentColor(agent.agentType);
434
+ useKeybinding("confirm:no", onBack, { context: "Confirmation" });
435
+ const handleKeyDown = (e) => {
436
+ if (e.key === "return") {
437
+ e.preventDefault();
438
+ onBack();
439
+ }
440
+ };
441
+ function renderToolsList() {
442
+ if (resolvedTools.hasWildcard) {
443
+ return /* @__PURE__ */ jsx_dev_runtime.jsxDEV(ThemedText, {
444
+ children: "All tools"
445
+ }, undefined, false, undefined, this);
446
+ }
447
+ if (!agent.tools || agent.tools.length === 0) {
448
+ return /* @__PURE__ */ jsx_dev_runtime.jsxDEV(ThemedText, {
449
+ children: "None"
450
+ }, undefined, false, undefined, this);
451
+ }
452
+ return /* @__PURE__ */ jsx_dev_runtime.jsxDEV(jsx_dev_runtime.Fragment, {
453
+ children: [
454
+ resolvedTools.validTools.length > 0 && /* @__PURE__ */ jsx_dev_runtime.jsxDEV(ThemedText, {
455
+ children: resolvedTools.validTools.join(", ")
456
+ }, undefined, false, undefined, this),
457
+ resolvedTools.invalidTools.length > 0 && /* @__PURE__ */ jsx_dev_runtime.jsxDEV(ThemedText, {
458
+ color: "warning",
459
+ children: [
460
+ figures_default.warning,
461
+ " Unrecognized:",
462
+ " ",
463
+ resolvedTools.invalidTools.join(", ")
464
+ ]
465
+ }, undefined, true, undefined, this)
466
+ ]
467
+ }, undefined, true, undefined, this);
468
+ }
469
+ return /* @__PURE__ */ jsx_dev_runtime.jsxDEV(ThemedBox_default, {
470
+ flexDirection: "column",
471
+ gap: 1,
472
+ tabIndex: 0,
473
+ autoFocus: true,
474
+ onKeyDown: handleKeyDown,
475
+ children: [
476
+ /* @__PURE__ */ jsx_dev_runtime.jsxDEV(ThemedText, {
477
+ dimColor: true,
478
+ children: filePath
479
+ }, undefined, false, undefined, this),
480
+ /* @__PURE__ */ jsx_dev_runtime.jsxDEV(ThemedBox_default, {
481
+ flexDirection: "column",
482
+ children: [
483
+ /* @__PURE__ */ jsx_dev_runtime.jsxDEV(ThemedText, {
484
+ children: [
485
+ /* @__PURE__ */ jsx_dev_runtime.jsxDEV(ThemedText, {
486
+ bold: true,
487
+ children: "Description"
488
+ }, undefined, false, undefined, this),
489
+ " (tells Claude when to use this agent):"
490
+ ]
491
+ }, undefined, true, undefined, this),
492
+ /* @__PURE__ */ jsx_dev_runtime.jsxDEV(ThemedBox_default, {
493
+ marginLeft: 2,
494
+ children: /* @__PURE__ */ jsx_dev_runtime.jsxDEV(ThemedText, {
495
+ children: agent.whenToUse
496
+ }, undefined, false, undefined, this)
497
+ }, undefined, false, undefined, this)
498
+ ]
499
+ }, undefined, true, undefined, this),
500
+ /* @__PURE__ */ jsx_dev_runtime.jsxDEV(ThemedBox_default, {
501
+ children: [
502
+ /* @__PURE__ */ jsx_dev_runtime.jsxDEV(ThemedText, {
503
+ children: [
504
+ /* @__PURE__ */ jsx_dev_runtime.jsxDEV(ThemedText, {
505
+ bold: true,
506
+ children: "Tools"
507
+ }, undefined, false, undefined, this),
508
+ ":",
509
+ " "
510
+ ]
511
+ }, undefined, true, undefined, this),
512
+ renderToolsList()
513
+ ]
514
+ }, undefined, true, undefined, this),
515
+ /* @__PURE__ */ jsx_dev_runtime.jsxDEV(ThemedText, {
516
+ children: [
517
+ /* @__PURE__ */ jsx_dev_runtime.jsxDEV(ThemedText, {
518
+ bold: true,
519
+ children: "Model"
520
+ }, undefined, false, undefined, this),
521
+ ": ",
522
+ getAgentModelDisplay(agent.model)
523
+ ]
524
+ }, undefined, true, undefined, this),
525
+ agent.permissionMode && /* @__PURE__ */ jsx_dev_runtime.jsxDEV(ThemedText, {
526
+ children: [
527
+ /* @__PURE__ */ jsx_dev_runtime.jsxDEV(ThemedText, {
528
+ bold: true,
529
+ children: "Permission mode"
530
+ }, undefined, false, undefined, this),
531
+ ": ",
532
+ agent.permissionMode
533
+ ]
534
+ }, undefined, true, undefined, this),
535
+ agent.memory && /* @__PURE__ */ jsx_dev_runtime.jsxDEV(ThemedText, {
536
+ children: [
537
+ /* @__PURE__ */ jsx_dev_runtime.jsxDEV(ThemedText, {
538
+ bold: true,
539
+ children: "Memory"
540
+ }, undefined, false, undefined, this),
541
+ ": ",
542
+ getMemoryScopeDisplay(agent.memory)
543
+ ]
544
+ }, undefined, true, undefined, this),
545
+ agent.hooks && Object.keys(agent.hooks).length > 0 && /* @__PURE__ */ jsx_dev_runtime.jsxDEV(ThemedText, {
546
+ children: [
547
+ /* @__PURE__ */ jsx_dev_runtime.jsxDEV(ThemedText, {
548
+ bold: true,
549
+ children: "Hooks"
550
+ }, undefined, false, undefined, this),
551
+ ": ",
552
+ Object.keys(agent.hooks).join(", ")
553
+ ]
554
+ }, undefined, true, undefined, this),
555
+ agent.skills && agent.skills.length > 0 && /* @__PURE__ */ jsx_dev_runtime.jsxDEV(ThemedText, {
556
+ children: [
557
+ /* @__PURE__ */ jsx_dev_runtime.jsxDEV(ThemedText, {
558
+ bold: true,
559
+ children: "Skills"
560
+ }, undefined, false, undefined, this),
561
+ ":",
562
+ " ",
563
+ agent.skills.length > 10 ? `${agent.skills.length} skills` : agent.skills.join(", ")
564
+ ]
565
+ }, undefined, true, undefined, this),
566
+ backgroundColor && /* @__PURE__ */ jsx_dev_runtime.jsxDEV(ThemedBox_default, {
567
+ children: /* @__PURE__ */ jsx_dev_runtime.jsxDEV(ThemedText, {
568
+ children: [
569
+ /* @__PURE__ */ jsx_dev_runtime.jsxDEV(ThemedText, {
570
+ bold: true,
571
+ children: "Color"
572
+ }, undefined, false, undefined, this),
573
+ ":",
574
+ " ",
575
+ /* @__PURE__ */ jsx_dev_runtime.jsxDEV(ThemedText, {
576
+ backgroundColor,
577
+ color: "inverseText",
578
+ children: [
579
+ " ",
580
+ agent.agentType,
581
+ " "
582
+ ]
583
+ }, undefined, true, undefined, this)
584
+ ]
585
+ }, undefined, true, undefined, this)
586
+ }, undefined, false, undefined, this),
587
+ !isBuiltInAgent(agent) && /* @__PURE__ */ jsx_dev_runtime.jsxDEV(jsx_dev_runtime.Fragment, {
588
+ children: [
589
+ /* @__PURE__ */ jsx_dev_runtime.jsxDEV(ThemedBox_default, {
590
+ children: /* @__PURE__ */ jsx_dev_runtime.jsxDEV(ThemedText, {
591
+ children: [
592
+ /* @__PURE__ */ jsx_dev_runtime.jsxDEV(ThemedText, {
593
+ bold: true,
594
+ children: "System prompt"
595
+ }, undefined, false, undefined, this),
596
+ ":"
597
+ ]
598
+ }, undefined, true, undefined, this)
599
+ }, undefined, false, undefined, this),
600
+ /* @__PURE__ */ jsx_dev_runtime.jsxDEV(ThemedBox_default, {
601
+ marginLeft: 2,
602
+ marginRight: 2,
603
+ children: /* @__PURE__ */ jsx_dev_runtime.jsxDEV(Markdown, {
604
+ children: agent.getSystemPrompt()
605
+ }, undefined, false, undefined, this)
606
+ }, undefined, false, undefined, this)
607
+ ]
608
+ }, undefined, true, undefined, this)
609
+ ]
610
+ }, undefined, true, undefined, this);
611
+ }
612
+ var jsx_dev_runtime;
613
+ var init_AgentDetail = __esm(() => {
614
+ init_figures();
615
+ init_src();
616
+ init_useKeybinding();
617
+ init_agentColorManager();
618
+ init_agentMemory();
619
+ init_agentToolUtils();
620
+ init_loadAgentsDir();
621
+ init_agent();
622
+ init_Markdown();
623
+ init_agentFileUtils();
624
+ jsx_dev_runtime = __toESM(require_jsx_dev_runtime(), 1);
625
+ });
626
+
627
+ // src/components/agents/ColorPicker.tsx
628
+ function ColorPicker({
629
+ agentName,
630
+ currentColor = "automatic",
631
+ onConfirm
632
+ }) {
633
+ const [selectedIndex, setSelectedIndex] = import_react.useState(Math.max(0, COLOR_OPTIONS.findIndex((opt) => opt === currentColor)));
634
+ const handleKeyDown = (e) => {
635
+ if (e.key === "up") {
636
+ e.preventDefault();
637
+ setSelectedIndex((prev) => prev > 0 ? prev - 1 : COLOR_OPTIONS.length - 1);
638
+ } else if (e.key === "down") {
639
+ e.preventDefault();
640
+ setSelectedIndex((prev) => prev < COLOR_OPTIONS.length - 1 ? prev + 1 : 0);
641
+ } else if (e.key === "return") {
642
+ e.preventDefault();
643
+ const selected = COLOR_OPTIONS[selectedIndex];
644
+ onConfirm(selected === "automatic" ? undefined : selected);
645
+ }
646
+ };
647
+ const selectedValue = COLOR_OPTIONS[selectedIndex];
648
+ return /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(ThemedBox_default, {
649
+ flexDirection: "column",
650
+ gap: 1,
651
+ tabIndex: 0,
652
+ autoFocus: true,
653
+ onKeyDown: handleKeyDown,
654
+ children: [
655
+ /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(ThemedBox_default, {
656
+ flexDirection: "column",
657
+ children: COLOR_OPTIONS.map((option, index) => {
658
+ const isSelected = index === selectedIndex;
659
+ return /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(ThemedBox_default, {
660
+ flexDirection: "row",
661
+ gap: 1,
662
+ children: [
663
+ /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(ThemedText, {
664
+ color: isSelected ? "suggestion" : undefined,
665
+ children: isSelected ? figures_default.pointer : " "
666
+ }, undefined, false, undefined, this),
667
+ option === "automatic" ? /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(ThemedText, {
668
+ bold: isSelected,
669
+ children: "Automatic color"
670
+ }, undefined, false, undefined, this) : /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(ThemedBox_default, {
671
+ gap: 1,
672
+ children: [
673
+ /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(ThemedText, {
674
+ backgroundColor: AGENT_COLOR_TO_THEME_COLOR[option],
675
+ color: "inverseText",
676
+ children: " "
677
+ }, undefined, false, undefined, this),
678
+ /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(ThemedText, {
679
+ bold: isSelected,
680
+ children: capitalize(option)
681
+ }, undefined, false, undefined, this)
682
+ ]
683
+ }, undefined, true, undefined, this)
684
+ ]
685
+ }, option, true, undefined, this);
686
+ })
687
+ }, undefined, false, undefined, this),
688
+ /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(ThemedBox_default, {
689
+ marginTop: 1,
690
+ children: [
691
+ /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(ThemedText, {
692
+ children: "Preview: "
693
+ }, undefined, false, undefined, this),
694
+ selectedValue === undefined || selectedValue === "automatic" ? /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(ThemedText, {
695
+ inverse: true,
696
+ bold: true,
697
+ children: [
698
+ " ",
699
+ "@",
700
+ agentName,
701
+ " "
702
+ ]
703
+ }, undefined, true, undefined, this) : /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(ThemedText, {
704
+ backgroundColor: AGENT_COLOR_TO_THEME_COLOR[selectedValue],
705
+ color: "inverseText",
706
+ bold: true,
707
+ children: [
708
+ " ",
709
+ "@",
710
+ agentName,
711
+ " "
712
+ ]
713
+ }, undefined, true, undefined, this)
714
+ ]
715
+ }, undefined, true, undefined, this)
716
+ ]
717
+ }, undefined, true, undefined, this);
718
+ }
719
+ var import_react, jsx_dev_runtime2, COLOR_OPTIONS;
720
+ var init_ColorPicker = __esm(() => {
721
+ init_figures();
722
+ init_src();
723
+ init_agentColorManager();
724
+ init_stringUtils();
725
+ import_react = __toESM(require_react(), 1);
726
+ jsx_dev_runtime2 = __toESM(require_jsx_dev_runtime(), 1);
727
+ COLOR_OPTIONS = ["automatic", ...AGENT_COLORS];
728
+ });
729
+
730
+ // src/components/agents/ModelSelector.tsx
731
+ function ModelSelector({
732
+ initialModel,
733
+ onComplete,
734
+ onCancel
735
+ }) {
736
+ const modelOptions = React2.useMemo(() => {
737
+ const base = getAgentModelOptions();
738
+ if (initialModel && !base.some((o) => o.value === initialModel)) {
739
+ return [
740
+ {
741
+ value: initialModel,
742
+ label: initialModel,
743
+ description: "Current model (custom ID)"
744
+ },
745
+ ...base
746
+ ];
747
+ }
748
+ return base;
749
+ }, [initialModel]);
750
+ const defaultModel = initialModel ?? "sonnet";
751
+ return /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedBox_default, {
752
+ flexDirection: "column",
753
+ children: [
754
+ /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedBox_default, {
755
+ marginBottom: 1,
756
+ children: /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedText, {
757
+ dimColor: true,
758
+ children: "Model determines the agent's reasoning capabilities and speed."
759
+ }, undefined, false, undefined, this)
760
+ }, undefined, false, undefined, this),
761
+ /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Select, {
762
+ options: modelOptions,
763
+ defaultValue: defaultModel,
764
+ onChange: onComplete,
765
+ onCancel: () => onCancel ? onCancel() : onComplete(undefined)
766
+ }, undefined, false, undefined, this)
767
+ ]
768
+ }, undefined, true, undefined, this);
769
+ }
770
+ var React2, jsx_dev_runtime3;
771
+ var init_ModelSelector = __esm(() => {
772
+ init_src();
773
+ init_agent();
774
+ init_select();
775
+ React2 = __toESM(require_react(), 1);
776
+ jsx_dev_runtime3 = __toESM(require_jsx_dev_runtime(), 1);
777
+ });
778
+
779
+ // src/components/agents/ToolSelector.tsx
780
+ function getToolBuckets() {
781
+ return {
782
+ READ_ONLY: {
783
+ name: "Read-only tools",
784
+ toolNames: new Set([
785
+ GlobTool.name,
786
+ GrepTool.name,
787
+ ExitPlanModeV2Tool.name,
788
+ FileReadTool.name,
789
+ WebFetchTool.name,
790
+ TodoWriteTool.name,
791
+ WebSearchTool.name,
792
+ TaskStopTool.name,
793
+ TaskOutputTool.name,
794
+ ListMcpResourcesTool.name,
795
+ ReadMcpResourceTool.name
796
+ ])
797
+ },
798
+ EDIT: {
799
+ name: "Edit tools",
800
+ toolNames: new Set([
801
+ FileEditTool.name,
802
+ FileWriteTool.name,
803
+ NotebookEditTool.name
804
+ ])
805
+ },
806
+ EXECUTION: {
807
+ name: "Execution tools",
808
+ toolNames: new Set([
809
+ BashTool.name,
810
+ process.env.USER_TYPE === "ant" ? TungstenTool.name : undefined
811
+ ].filter((n) => n !== undefined))
812
+ },
813
+ MCP: {
814
+ name: "MCP tools",
815
+ toolNames: new Set,
816
+ isMcp: true
817
+ },
818
+ OTHER: {
819
+ name: "Other tools",
820
+ toolNames: new Set
821
+ }
822
+ };
823
+ }
824
+ function getMcpServerBuckets(tools) {
825
+ const serverMap = new Map;
826
+ tools.forEach((tool) => {
827
+ if (isMcpTool(tool)) {
828
+ const mcpInfo = mcpInfoFromString(tool.name);
829
+ if (mcpInfo?.serverName) {
830
+ const existing = serverMap.get(mcpInfo.serverName) || [];
831
+ existing.push(tool);
832
+ serverMap.set(mcpInfo.serverName, existing);
833
+ }
834
+ }
835
+ });
836
+ return Array.from(serverMap.entries()).map(([serverName, tools2]) => ({ serverName, tools: tools2 })).sort((a, b) => a.serverName.localeCompare(b.serverName));
837
+ }
838
+ function ToolSelector({
839
+ tools,
840
+ initialTools,
841
+ onComplete,
842
+ onCancel
843
+ }) {
844
+ const customAgentTools = import_react2.useMemo(() => filterToolsForAgent({ tools, isBuiltIn: false, isAsync: false }), [tools]);
845
+ const expandedInitialTools = !initialTools || initialTools.includes("*") ? customAgentTools.map((t) => t.name) : initialTools;
846
+ const [selectedTools, setSelectedTools] = import_react2.useState(expandedInitialTools);
847
+ const [focusIndex, setFocusIndex] = import_react2.useState(0);
848
+ const [showIndividualTools, setShowIndividualTools] = import_react2.useState(false);
849
+ const validSelectedTools = import_react2.useMemo(() => {
850
+ const toolNames = new Set(customAgentTools.map((t) => t.name));
851
+ return selectedTools.filter((name) => toolNames.has(name));
852
+ }, [selectedTools, customAgentTools]);
853
+ const selectedSet = new Set(validSelectedTools);
854
+ const isAllSelected = validSelectedTools.length === customAgentTools.length && customAgentTools.length > 0;
855
+ const handleToggleTool = (toolName) => {
856
+ if (!toolName)
857
+ return;
858
+ setSelectedTools((current) => current.includes(toolName) ? current.filter((t) => t !== toolName) : [...current, toolName]);
859
+ };
860
+ const handleToggleTools = (toolNames, select) => {
861
+ setSelectedTools((current) => {
862
+ if (select) {
863
+ const toolsToAdd = toolNames.filter((t) => !current.includes(t));
864
+ return [...current, ...toolsToAdd];
865
+ } else {
866
+ return current.filter((t) => !toolNames.includes(t));
867
+ }
868
+ });
869
+ };
870
+ const handleConfirm = () => {
871
+ const allToolNames = customAgentTools.map((t) => t.name);
872
+ const areAllToolsSelected = validSelectedTools.length === allToolNames.length && allToolNames.every((name) => validSelectedTools.includes(name));
873
+ const finalTools = areAllToolsSelected ? undefined : validSelectedTools;
874
+ onComplete(finalTools);
875
+ };
876
+ const toolsByBucket = import_react2.useMemo(() => {
877
+ const toolBuckets2 = getToolBuckets();
878
+ const buckets = {
879
+ readOnly: [],
880
+ edit: [],
881
+ execution: [],
882
+ mcp: [],
883
+ other: []
884
+ };
885
+ customAgentTools.forEach((tool) => {
886
+ if (isMcpTool(tool)) {
887
+ buckets.mcp.push(tool);
888
+ } else if (toolBuckets2.READ_ONLY.toolNames.has(tool.name)) {
889
+ buckets.readOnly.push(tool);
890
+ } else if (toolBuckets2.EDIT.toolNames.has(tool.name)) {
891
+ buckets.edit.push(tool);
892
+ } else if (toolBuckets2.EXECUTION.toolNames.has(tool.name)) {
893
+ buckets.execution.push(tool);
894
+ } else if (tool.name !== AGENT_TOOL_NAME) {
895
+ buckets.other.push(tool);
896
+ }
897
+ });
898
+ return buckets;
899
+ }, [customAgentTools]);
900
+ const createBucketToggleAction = (bucketTools) => {
901
+ const selected = count(bucketTools, (t) => selectedSet.has(t.name));
902
+ const needsSelection = selected < bucketTools.length;
903
+ return () => {
904
+ const toolNames = bucketTools.map((t) => t.name);
905
+ handleToggleTools(toolNames, needsSelection);
906
+ };
907
+ };
908
+ const navigableItems = [];
909
+ navigableItems.push({
910
+ id: "continue",
911
+ label: "Continue",
912
+ action: handleConfirm,
913
+ isContinue: true
914
+ });
915
+ navigableItems.push({
916
+ id: "bucket-all",
917
+ label: `${isAllSelected ? figures_default.checkboxOn : figures_default.checkboxOff} All tools`,
918
+ action: () => {
919
+ const allToolNames = customAgentTools.map((t) => t.name);
920
+ handleToggleTools(allToolNames, !isAllSelected);
921
+ }
922
+ });
923
+ const toolBuckets = getToolBuckets();
924
+ const bucketConfigs = [
925
+ {
926
+ id: "bucket-readonly",
927
+ name: toolBuckets.READ_ONLY.name,
928
+ tools: toolsByBucket.readOnly
929
+ },
930
+ {
931
+ id: "bucket-edit",
932
+ name: toolBuckets.EDIT.name,
933
+ tools: toolsByBucket.edit
934
+ },
935
+ {
936
+ id: "bucket-execution",
937
+ name: toolBuckets.EXECUTION.name,
938
+ tools: toolsByBucket.execution
939
+ },
940
+ {
941
+ id: "bucket-mcp",
942
+ name: toolBuckets.MCP.name,
943
+ tools: toolsByBucket.mcp
944
+ },
945
+ {
946
+ id: "bucket-other",
947
+ name: toolBuckets.OTHER.name,
948
+ tools: toolsByBucket.other
949
+ }
950
+ ];
951
+ bucketConfigs.forEach(({ id, name, tools: bucketTools }) => {
952
+ if (bucketTools.length === 0)
953
+ return;
954
+ const selected = count(bucketTools, (t) => selectedSet.has(t.name));
955
+ const isFullySelected = selected === bucketTools.length;
956
+ navigableItems.push({
957
+ id,
958
+ label: `${isFullySelected ? figures_default.checkboxOn : figures_default.checkboxOff} ${name}`,
959
+ action: createBucketToggleAction(bucketTools)
960
+ });
961
+ });
962
+ const toggleButtonIndex = navigableItems.length;
963
+ navigableItems.push({
964
+ id: "toggle-individual",
965
+ label: showIndividualTools ? "Hide advanced options" : "Show advanced options",
966
+ action: () => {
967
+ setShowIndividualTools(!showIndividualTools);
968
+ if (showIndividualTools && focusIndex > toggleButtonIndex) {
969
+ setFocusIndex(toggleButtonIndex);
970
+ }
971
+ },
972
+ isToggle: true
973
+ });
974
+ const mcpServerBuckets = import_react2.useMemo(() => getMcpServerBuckets(customAgentTools), [customAgentTools]);
975
+ if (showIndividualTools) {
976
+ if (mcpServerBuckets.length > 0) {
977
+ navigableItems.push({
978
+ id: "mcp-servers-header",
979
+ label: "MCP Servers:",
980
+ action: () => {},
981
+ isHeader: true
982
+ });
983
+ mcpServerBuckets.forEach(({ serverName, tools: serverTools }) => {
984
+ const selected = count(serverTools, (t) => selectedSet.has(t.name));
985
+ const isFullySelected = selected === serverTools.length;
986
+ navigableItems.push({
987
+ id: `mcp-server-${serverName}`,
988
+ label: `${isFullySelected ? figures_default.checkboxOn : figures_default.checkboxOff} ${serverName} (${serverTools.length} ${plural(serverTools.length, "tool")})`,
989
+ action: () => {
990
+ const toolNames = serverTools.map((t) => t.name);
991
+ handleToggleTools(toolNames, !isFullySelected);
992
+ }
993
+ });
994
+ });
995
+ navigableItems.push({
996
+ id: "tools-header",
997
+ label: "Individual Tools:",
998
+ action: () => {},
999
+ isHeader: true
1000
+ });
1001
+ }
1002
+ customAgentTools.forEach((tool) => {
1003
+ let displayName = tool.name;
1004
+ if (tool.name.startsWith("mcp__")) {
1005
+ const mcpInfo = mcpInfoFromString(tool.name);
1006
+ displayName = mcpInfo ? `${mcpInfo.toolName} (${mcpInfo.serverName})` : tool.name;
1007
+ }
1008
+ navigableItems.push({
1009
+ id: `tool-${tool.name}`,
1010
+ label: `${selectedSet.has(tool.name) ? figures_default.checkboxOn : figures_default.checkboxOff} ${displayName}`,
1011
+ action: () => handleToggleTool(tool.name)
1012
+ });
1013
+ });
1014
+ }
1015
+ const handleCancel = import_react2.useCallback(() => {
1016
+ if (onCancel) {
1017
+ onCancel();
1018
+ } else {
1019
+ onComplete(initialTools);
1020
+ }
1021
+ }, [onCancel, onComplete, initialTools]);
1022
+ useKeybinding("confirm:no", handleCancel, { context: "Confirmation" });
1023
+ const handleKeyDown = (e) => {
1024
+ if (e.key === "return") {
1025
+ e.preventDefault();
1026
+ const item = navigableItems[focusIndex];
1027
+ if (item && !item.isHeader) {
1028
+ item.action();
1029
+ }
1030
+ } else if (e.key === "up") {
1031
+ e.preventDefault();
1032
+ let newIndex = focusIndex - 1;
1033
+ while (newIndex > 0 && navigableItems[newIndex]?.isHeader) {
1034
+ newIndex--;
1035
+ }
1036
+ setFocusIndex(Math.max(0, newIndex));
1037
+ } else if (e.key === "down") {
1038
+ e.preventDefault();
1039
+ let newIndex = focusIndex + 1;
1040
+ while (newIndex < navigableItems.length - 1 && navigableItems[newIndex]?.isHeader) {
1041
+ newIndex++;
1042
+ }
1043
+ setFocusIndex(Math.min(navigableItems.length - 1, newIndex));
1044
+ }
1045
+ };
1046
+ return /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(ThemedBox_default, {
1047
+ flexDirection: "column",
1048
+ marginTop: 1,
1049
+ tabIndex: 0,
1050
+ autoFocus: true,
1051
+ onKeyDown: handleKeyDown,
1052
+ children: [
1053
+ /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(ThemedText, {
1054
+ color: focusIndex === 0 ? "suggestion" : undefined,
1055
+ bold: focusIndex === 0,
1056
+ children: [
1057
+ focusIndex === 0 ? `${figures_default.pointer} ` : " ",
1058
+ "[ Continue ]"
1059
+ ]
1060
+ }, undefined, true, undefined, this),
1061
+ /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Divider, {
1062
+ width: 40
1063
+ }, undefined, false, undefined, this),
1064
+ navigableItems.slice(1).map((item, index) => {
1065
+ const isCurrentlyFocused = index + 1 === focusIndex;
1066
+ const isToggleButton = item.isToggle;
1067
+ const isHeader = item.isHeader;
1068
+ return /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(import_react2.default.Fragment, {
1069
+ children: [
1070
+ isToggleButton && /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Divider, {
1071
+ width: 40
1072
+ }, undefined, false, undefined, this),
1073
+ isHeader && index > 0 && /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(ThemedBox_default, {
1074
+ marginTop: 1
1075
+ }, undefined, false, undefined, this),
1076
+ /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(ThemedText, {
1077
+ color: isHeader ? undefined : isCurrentlyFocused ? "suggestion" : undefined,
1078
+ dimColor: isHeader,
1079
+ bold: isToggleButton && isCurrentlyFocused,
1080
+ children: [
1081
+ isHeader ? "" : isCurrentlyFocused ? `${figures_default.pointer} ` : " ",
1082
+ isToggleButton ? `[ ${item.label} ]` : item.label
1083
+ ]
1084
+ }, undefined, true, undefined, this)
1085
+ ]
1086
+ }, item.id, true, undefined, this);
1087
+ }),
1088
+ /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(ThemedBox_default, {
1089
+ marginTop: 1,
1090
+ flexDirection: "column",
1091
+ children: /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(ThemedText, {
1092
+ dimColor: true,
1093
+ children: isAllSelected ? "All tools selected" : `${selectedSet.size} of ${customAgentTools.length} tools selected`
1094
+ }, undefined, false, undefined, this)
1095
+ }, undefined, false, undefined, this)
1096
+ ]
1097
+ }, undefined, true, undefined, this);
1098
+ }
1099
+ var import_react2, jsx_dev_runtime4;
1100
+ var init_ToolSelector = __esm(() => {
1101
+ init_figures();
1102
+ init_mcpStringUtils();
1103
+ init_utils();
1104
+ init_agentToolUtils();
1105
+ init_constants2();
1106
+ init_BashTool();
1107
+ init_ExitPlanModeV2Tool();
1108
+ init_FileEditTool();
1109
+ init_FileReadTool();
1110
+ init_FileWriteTool();
1111
+ init_GlobTool();
1112
+ init_GrepTool();
1113
+ init_ListMcpResourcesTool();
1114
+ init_NotebookEditTool();
1115
+ init_ReadMcpResourceTool();
1116
+ init_TaskOutputTool();
1117
+ init_TaskStopTool();
1118
+ init_TodoWriteTool();
1119
+ init_TungstenTool();
1120
+ init_WebFetchTool();
1121
+ init_WebSearchTool();
1122
+ init_src();
1123
+ init_useKeybinding();
1124
+ init_array();
1125
+ init_stringUtils();
1126
+ init_src();
1127
+ import_react2 = __toESM(require_react(), 1);
1128
+ jsx_dev_runtime4 = __toESM(require_jsx_dev_runtime(), 1);
1129
+ });
1130
+
1131
+ // src/components/agents/utils.ts
1132
+ function getAgentSourceDisplayName(source) {
1133
+ if (source === "all") {
1134
+ return "Agents";
1135
+ }
1136
+ if (source === "built-in") {
1137
+ return "Built-in agents";
1138
+ }
1139
+ if (source === "plugin") {
1140
+ return "Plugin agents";
1141
+ }
1142
+ return capitalize_default(getSettingSourceName(source));
1143
+ }
1144
+ var init_utils2 = __esm(() => {
1145
+ init_capitalize();
1146
+ init_constants();
1147
+ });
1148
+
1149
+ // src/components/agents/AgentEditor.tsx
1150
+ function AgentEditor({
1151
+ agent,
1152
+ tools,
1153
+ onSaved,
1154
+ onBack
1155
+ }) {
1156
+ const setAppState = useSetAppState();
1157
+ const [editMode, setEditMode] = import_react3.useState("menu");
1158
+ const [selectedMenuIndex, setSelectedMenuIndex] = import_react3.useState(0);
1159
+ const [error, setError] = import_react3.useState(null);
1160
+ const [selectedColor, setSelectedColor] = import_react3.useState(agent.color);
1161
+ const handleOpenInEditor = import_react3.useCallback(async () => {
1162
+ const filePath = getActualAgentFilePath(agent);
1163
+ const result = await editFileInEditor(filePath);
1164
+ if (result.error) {
1165
+ setError(result.error);
1166
+ } else {
1167
+ onSaved(`Opened ${agent.agentType} in editor. If you made edits, restart to load the latest version.`);
1168
+ }
1169
+ }, [agent, onSaved]);
1170
+ const handleSave = import_react3.useCallback(async (changes = {}) => {
1171
+ const { tools: newTools, color: newColor, model: newModel } = changes;
1172
+ const finalColor = newColor ?? selectedColor;
1173
+ const hasToolsChanged = newTools !== undefined;
1174
+ const hasModelChanged = newModel !== undefined;
1175
+ const hasColorChanged = finalColor !== agent.color;
1176
+ if (!hasToolsChanged && !hasModelChanged && !hasColorChanged) {
1177
+ return false;
1178
+ }
1179
+ try {
1180
+ if (!isCustomAgent(agent) && !isPluginAgent(agent)) {
1181
+ return false;
1182
+ }
1183
+ await updateAgentFile(agent, agent.whenToUse, newTools ?? agent.tools, agent.getSystemPrompt(), finalColor, newModel ?? agent.model);
1184
+ if (hasColorChanged && finalColor) {
1185
+ setAgentColor(agent.agentType, finalColor);
1186
+ }
1187
+ setAppState((state) => {
1188
+ const allAgents = state.agentDefinitions.allAgents.map((a) => a.agentType === agent.agentType ? {
1189
+ ...a,
1190
+ tools: newTools ?? a.tools,
1191
+ color: finalColor,
1192
+ model: newModel ?? a.model
1193
+ } : a);
1194
+ return {
1195
+ ...state,
1196
+ agentDefinitions: {
1197
+ ...state.agentDefinitions,
1198
+ activeAgents: getActiveAgentsFromList(allAgents),
1199
+ allAgents
1200
+ }
1201
+ };
1202
+ });
1203
+ onSaved(`Updated agent: ${source_default.bold(agent.agentType)}`);
1204
+ return true;
1205
+ } catch (err) {
1206
+ setError(err instanceof Error ? err.message : "Failed to save agent");
1207
+ return false;
1208
+ }
1209
+ }, [agent, selectedColor, onSaved, setAppState]);
1210
+ const menuItems = import_react3.useMemo(() => [
1211
+ { label: "Open in editor", action: handleOpenInEditor },
1212
+ { label: "Edit tools", action: () => setEditMode("edit-tools") },
1213
+ { label: "Edit model", action: () => setEditMode("edit-model") },
1214
+ { label: "Edit color", action: () => setEditMode("edit-color") }
1215
+ ], [handleOpenInEditor]);
1216
+ const handleEscape = import_react3.useCallback(() => {
1217
+ setError(null);
1218
+ if (editMode === "menu") {
1219
+ onBack();
1220
+ } else {
1221
+ setEditMode("menu");
1222
+ }
1223
+ }, [editMode, onBack]);
1224
+ const handleMenuKeyDown = import_react3.useCallback((e) => {
1225
+ if (e.key === "up") {
1226
+ e.preventDefault();
1227
+ setSelectedMenuIndex((index) => Math.max(0, index - 1));
1228
+ } else if (e.key === "down") {
1229
+ e.preventDefault();
1230
+ setSelectedMenuIndex((index) => Math.min(menuItems.length - 1, index + 1));
1231
+ } else if (e.key === "return") {
1232
+ e.preventDefault();
1233
+ const selectedItem = menuItems[selectedMenuIndex];
1234
+ if (selectedItem) {
1235
+ selectedItem.action();
1236
+ }
1237
+ }
1238
+ }, [menuItems, selectedMenuIndex]);
1239
+ useKeybinding("confirm:no", handleEscape, { context: "Confirmation" });
1240
+ const renderMenu = () => /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(ThemedBox_default, {
1241
+ flexDirection: "column",
1242
+ tabIndex: 0,
1243
+ autoFocus: true,
1244
+ onKeyDown: handleMenuKeyDown,
1245
+ children: [
1246
+ /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(ThemedText, {
1247
+ dimColor: true,
1248
+ children: [
1249
+ "Source: ",
1250
+ getAgentSourceDisplayName(agent.source)
1251
+ ]
1252
+ }, undefined, true, undefined, this),
1253
+ /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(ThemedBox_default, {
1254
+ marginTop: 1,
1255
+ flexDirection: "column",
1256
+ children: menuItems.map((item, index) => /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(ThemedText, {
1257
+ color: index === selectedMenuIndex ? "suggestion" : undefined,
1258
+ children: [
1259
+ index === selectedMenuIndex ? `${figures_default.pointer} ` : " ",
1260
+ item.label
1261
+ ]
1262
+ }, item.label, true, undefined, this))
1263
+ }, undefined, false, undefined, this),
1264
+ error && /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(ThemedBox_default, {
1265
+ marginTop: 1,
1266
+ children: /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(ThemedText, {
1267
+ color: "error",
1268
+ children: error
1269
+ }, undefined, false, undefined, this)
1270
+ }, undefined, false, undefined, this)
1271
+ ]
1272
+ }, undefined, true, undefined, this);
1273
+ switch (editMode) {
1274
+ case "menu":
1275
+ return renderMenu();
1276
+ case "edit-tools":
1277
+ return /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(ToolSelector, {
1278
+ tools,
1279
+ initialTools: agent.tools,
1280
+ onComplete: async (finalTools) => {
1281
+ setEditMode("menu");
1282
+ await handleSave({ tools: finalTools });
1283
+ }
1284
+ }, undefined, false, undefined, this);
1285
+ case "edit-color":
1286
+ return /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(ColorPicker, {
1287
+ agentName: agent.agentType,
1288
+ currentColor: selectedColor || agent.color || "automatic",
1289
+ onConfirm: async (color) => {
1290
+ setSelectedColor(color);
1291
+ setEditMode("menu");
1292
+ await handleSave({ color });
1293
+ }
1294
+ }, undefined, false, undefined, this);
1295
+ case "edit-model":
1296
+ return /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(ModelSelector, {
1297
+ initialModel: agent.model,
1298
+ onComplete: async (model) => {
1299
+ setEditMode("menu");
1300
+ await handleSave({ model });
1301
+ }
1302
+ }, undefined, false, undefined, this);
1303
+ default:
1304
+ return null;
1305
+ }
1306
+ }
1307
+ var import_react3, jsx_dev_runtime5;
1308
+ var init_AgentEditor = __esm(() => {
1309
+ init_source();
1310
+ init_figures();
1311
+ init_AppState();
1312
+ init_src();
1313
+ init_useKeybinding();
1314
+ init_agentColorManager();
1315
+ init_loadAgentsDir();
1316
+ init_promptEditor();
1317
+ init_agentFileUtils();
1318
+ init_ColorPicker();
1319
+ init_ModelSelector();
1320
+ init_ToolSelector();
1321
+ init_utils2();
1322
+ import_react3 = __toESM(require_react(), 1);
1323
+ jsx_dev_runtime5 = __toESM(require_jsx_dev_runtime(), 1);
1324
+ });
1325
+
1326
+ // src/components/agents/AgentNavigationFooter.tsx
1327
+ function AgentNavigationFooter({
1328
+ instructions = "Press \u2191\u2193 to navigate \xB7 Enter to select \xB7 Esc to go back"
1329
+ }) {
1330
+ const exitState = useExitOnCtrlCDWithKeybindings();
1331
+ return /* @__PURE__ */ jsx_dev_runtime6.jsxDEV(ThemedBox_default, {
1332
+ marginLeft: 2,
1333
+ children: /* @__PURE__ */ jsx_dev_runtime6.jsxDEV(ThemedText, {
1334
+ dimColor: true,
1335
+ children: exitState.pending ? `Press ${exitState.keyName} again to exit` : instructions
1336
+ }, undefined, false, undefined, this)
1337
+ }, undefined, false, undefined, this);
1338
+ }
1339
+ var jsx_dev_runtime6;
1340
+ var init_AgentNavigationFooter = __esm(() => {
1341
+ init_useExitOnCtrlCDWithKeybindings();
1342
+ init_src();
1343
+ jsx_dev_runtime6 = __toESM(require_jsx_dev_runtime(), 1);
1344
+ });
1345
+
1346
+ // src/components/agents/AgentsList.tsx
1347
+ function AgentsList({
1348
+ source,
1349
+ agents,
1350
+ onBack,
1351
+ onSelect,
1352
+ onCreateNew,
1353
+ changes
1354
+ }) {
1355
+ const [selectedAgent, setSelectedAgent] = React4.useState(null);
1356
+ const [isCreateNewSelected, setIsCreateNewSelected] = React4.useState(true);
1357
+ const sortedAgents = React4.useMemo(() => [...agents].sort(compareAgentsByName), [agents]);
1358
+ const getOverrideInfo = (agent) => {
1359
+ return {
1360
+ isOverridden: !!agent.overriddenBy,
1361
+ overriddenBy: agent.overriddenBy || null
1362
+ };
1363
+ };
1364
+ const renderCreateNewOption = () => {
1365
+ return /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedBox_default, {
1366
+ children: [
1367
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedText, {
1368
+ color: isCreateNewSelected ? "suggestion" : undefined,
1369
+ children: isCreateNewSelected ? `${figures_default.pointer} ` : " "
1370
+ }, undefined, false, undefined, this),
1371
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedText, {
1372
+ color: isCreateNewSelected ? "suggestion" : undefined,
1373
+ children: "Create new agent"
1374
+ }, undefined, false, undefined, this)
1375
+ ]
1376
+ }, undefined, true, undefined, this);
1377
+ };
1378
+ const renderAgent = (agent) => {
1379
+ const isBuiltIn = agent.source === "built-in";
1380
+ const isSelected = !isBuiltIn && !isCreateNewSelected && selectedAgent?.agentType === agent.agentType && selectedAgent?.source === agent.source;
1381
+ const { isOverridden, overriddenBy } = getOverrideInfo(agent);
1382
+ const dimmed = isBuiltIn || isOverridden;
1383
+ const textColor = !isBuiltIn && isSelected ? "suggestion" : undefined;
1384
+ const resolvedModel = resolveAgentModelDisplay(agent);
1385
+ return /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedBox_default, {
1386
+ children: [
1387
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedText, {
1388
+ dimColor: dimmed && !isSelected,
1389
+ color: textColor,
1390
+ children: isBuiltIn ? "" : isSelected ? `${figures_default.pointer} ` : " "
1391
+ }, undefined, false, undefined, this),
1392
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedText, {
1393
+ dimColor: dimmed && !isSelected,
1394
+ color: textColor,
1395
+ children: agent.agentType
1396
+ }, undefined, false, undefined, this),
1397
+ resolvedModel && /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedText, {
1398
+ dimColor: true,
1399
+ color: textColor,
1400
+ children: [
1401
+ " \xB7 ",
1402
+ resolvedModel
1403
+ ]
1404
+ }, undefined, true, undefined, this),
1405
+ agent.memory && /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedText, {
1406
+ dimColor: true,
1407
+ color: textColor,
1408
+ children: [
1409
+ " \xB7 ",
1410
+ agent.memory,
1411
+ " memory"
1412
+ ]
1413
+ }, undefined, true, undefined, this),
1414
+ overriddenBy && /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedText, {
1415
+ dimColor: !isSelected,
1416
+ color: isSelected ? "warning" : undefined,
1417
+ children: [
1418
+ " ",
1419
+ figures_default.warning,
1420
+ " shadowed by ",
1421
+ getOverrideSourceLabel(overriddenBy)
1422
+ ]
1423
+ }, undefined, true, undefined, this)
1424
+ ]
1425
+ }, `${agent.agentType}-${agent.source}`, true, undefined, this);
1426
+ };
1427
+ const selectableAgentsInOrder = React4.useMemo(() => {
1428
+ const nonBuiltIn = sortedAgents.filter((a) => a.source !== "built-in");
1429
+ if (source === "all") {
1430
+ return AGENT_SOURCE_GROUPS.filter((g) => g.source !== "built-in").flatMap(({ source: groupSource }) => nonBuiltIn.filter((a) => a.source === groupSource));
1431
+ }
1432
+ return nonBuiltIn;
1433
+ }, [sortedAgents, source]);
1434
+ React4.useEffect(() => {
1435
+ if (!selectedAgent && !isCreateNewSelected && selectableAgentsInOrder.length > 0) {
1436
+ if (onCreateNew) {
1437
+ setIsCreateNewSelected(true);
1438
+ } else {
1439
+ setSelectedAgent(selectableAgentsInOrder[0] || null);
1440
+ }
1441
+ }
1442
+ }, [selectableAgentsInOrder, selectedAgent, isCreateNewSelected, onCreateNew]);
1443
+ const handleKeyDown = (e) => {
1444
+ if (e.key === "return") {
1445
+ e.preventDefault();
1446
+ if (isCreateNewSelected && onCreateNew) {
1447
+ onCreateNew();
1448
+ } else if (selectedAgent) {
1449
+ onSelect(selectedAgent);
1450
+ }
1451
+ return;
1452
+ }
1453
+ if (e.key !== "up" && e.key !== "down")
1454
+ return;
1455
+ e.preventDefault();
1456
+ const hasCreateOption = !!onCreateNew;
1457
+ const totalItems = selectableAgentsInOrder.length + (hasCreateOption ? 1 : 0);
1458
+ if (totalItems === 0)
1459
+ return;
1460
+ let currentPosition = 0;
1461
+ if (!isCreateNewSelected && selectedAgent) {
1462
+ const agentIndex = selectableAgentsInOrder.findIndex((a) => a.agentType === selectedAgent.agentType && a.source === selectedAgent.source);
1463
+ if (agentIndex >= 0) {
1464
+ currentPosition = hasCreateOption ? agentIndex + 1 : agentIndex;
1465
+ }
1466
+ }
1467
+ const newPosition = e.key === "up" ? currentPosition === 0 ? totalItems - 1 : currentPosition - 1 : currentPosition === totalItems - 1 ? 0 : currentPosition + 1;
1468
+ if (hasCreateOption && newPosition === 0) {
1469
+ setIsCreateNewSelected(true);
1470
+ setSelectedAgent(null);
1471
+ } else {
1472
+ const agentIndex = hasCreateOption ? newPosition - 1 : newPosition;
1473
+ const newAgent = selectableAgentsInOrder[agentIndex];
1474
+ if (newAgent) {
1475
+ setIsCreateNewSelected(false);
1476
+ setSelectedAgent(newAgent);
1477
+ }
1478
+ }
1479
+ };
1480
+ const renderBuiltInAgentsSection = (title = "Built-in (always available):") => {
1481
+ const builtInAgents2 = sortedAgents.filter((a) => a.source === "built-in");
1482
+ return /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedBox_default, {
1483
+ flexDirection: "column",
1484
+ marginBottom: 1,
1485
+ paddingLeft: 2,
1486
+ children: [
1487
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedText, {
1488
+ bold: true,
1489
+ dimColor: true,
1490
+ children: title
1491
+ }, undefined, false, undefined, this),
1492
+ builtInAgents2.map(renderAgent)
1493
+ ]
1494
+ }, undefined, true, undefined, this);
1495
+ };
1496
+ const renderAgentGroup = (title, groupAgents) => {
1497
+ if (!groupAgents.length)
1498
+ return null;
1499
+ const folderPath = groupAgents[0]?.baseDir;
1500
+ return /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedBox_default, {
1501
+ flexDirection: "column",
1502
+ marginBottom: 1,
1503
+ children: [
1504
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedBox_default, {
1505
+ paddingLeft: 2,
1506
+ children: [
1507
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedText, {
1508
+ bold: true,
1509
+ dimColor: true,
1510
+ children: title
1511
+ }, undefined, false, undefined, this),
1512
+ folderPath && /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedText, {
1513
+ dimColor: true,
1514
+ children: [
1515
+ " (",
1516
+ folderPath,
1517
+ ")"
1518
+ ]
1519
+ }, undefined, true, undefined, this)
1520
+ ]
1521
+ }, undefined, true, undefined, this),
1522
+ groupAgents.map((agent) => renderAgent(agent))
1523
+ ]
1524
+ }, undefined, true, undefined, this);
1525
+ };
1526
+ const sourceTitle = getAgentSourceDisplayName(source);
1527
+ const builtInAgents = sortedAgents.filter((a) => a.source === "built-in");
1528
+ const hasNoAgents = !sortedAgents.length || source !== "built-in" && !sortedAgents.some((a) => a.source !== "built-in");
1529
+ if (hasNoAgents) {
1530
+ return /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(Dialog, {
1531
+ title: sourceTitle,
1532
+ subtitle: "No agents found",
1533
+ onCancel: onBack,
1534
+ hideInputGuide: true,
1535
+ children: /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedBox_default, {
1536
+ flexDirection: "column",
1537
+ gap: 1,
1538
+ tabIndex: 0,
1539
+ autoFocus: true,
1540
+ onKeyDown: handleKeyDown,
1541
+ children: [
1542
+ onCreateNew && /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedBox_default, {
1543
+ children: renderCreateNewOption()
1544
+ }, undefined, false, undefined, this),
1545
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedText, {
1546
+ dimColor: true,
1547
+ children: "No agents found. Create specialized subagents that Claude can delegate to."
1548
+ }, undefined, false, undefined, this),
1549
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedText, {
1550
+ dimColor: true,
1551
+ children: "Each subagent has its own context window, custom system prompt, and specific tools."
1552
+ }, undefined, false, undefined, this),
1553
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedText, {
1554
+ dimColor: true,
1555
+ children: "Try creating: Code Reviewer, Code Simplifier, Security Reviewer, Tech Lead, or UX Reviewer."
1556
+ }, undefined, false, undefined, this),
1557
+ source !== "built-in" && sortedAgents.some((a) => a.source === "built-in") && /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(jsx_dev_runtime7.Fragment, {
1558
+ children: [
1559
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(Divider, {}, undefined, false, undefined, this),
1560
+ renderBuiltInAgentsSection()
1561
+ ]
1562
+ }, undefined, true, undefined, this)
1563
+ ]
1564
+ }, undefined, true, undefined, this)
1565
+ }, undefined, false, undefined, this);
1566
+ }
1567
+ return /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(Dialog, {
1568
+ title: sourceTitle,
1569
+ subtitle: `${count(sortedAgents, (a) => !a.overriddenBy)} agents`,
1570
+ onCancel: onBack,
1571
+ hideInputGuide: true,
1572
+ children: [
1573
+ changes && changes.length > 0 && /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedBox_default, {
1574
+ marginTop: 1,
1575
+ children: /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedText, {
1576
+ dimColor: true,
1577
+ children: changes[changes.length - 1]
1578
+ }, undefined, false, undefined, this)
1579
+ }, undefined, false, undefined, this),
1580
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedBox_default, {
1581
+ flexDirection: "column",
1582
+ tabIndex: 0,
1583
+ autoFocus: true,
1584
+ onKeyDown: handleKeyDown,
1585
+ children: [
1586
+ onCreateNew && /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedBox_default, {
1587
+ marginBottom: 1,
1588
+ children: renderCreateNewOption()
1589
+ }, undefined, false, undefined, this),
1590
+ source === "all" ? /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(jsx_dev_runtime7.Fragment, {
1591
+ children: [
1592
+ AGENT_SOURCE_GROUPS.filter((g) => g.source !== "built-in").map(({ label, source: groupSource }) => /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(React4.Fragment, {
1593
+ children: renderAgentGroup(label, sortedAgents.filter((a) => a.source === groupSource))
1594
+ }, groupSource, false, undefined, this)),
1595
+ builtInAgents.length > 0 && /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedBox_default, {
1596
+ flexDirection: "column",
1597
+ marginBottom: 1,
1598
+ paddingLeft: 2,
1599
+ children: [
1600
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedText, {
1601
+ dimColor: true,
1602
+ children: [
1603
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedText, {
1604
+ bold: true,
1605
+ children: "Built-in agents"
1606
+ }, undefined, false, undefined, this),
1607
+ " (always available)"
1608
+ ]
1609
+ }, undefined, true, undefined, this),
1610
+ builtInAgents.map(renderAgent)
1611
+ ]
1612
+ }, undefined, true, undefined, this)
1613
+ ]
1614
+ }, undefined, true, undefined, this) : source === "built-in" ? /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(jsx_dev_runtime7.Fragment, {
1615
+ children: [
1616
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedText, {
1617
+ dimColor: true,
1618
+ italic: true,
1619
+ children: "Built-in agents are provided by default and cannot be modified."
1620
+ }, undefined, false, undefined, this),
1621
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedBox_default, {
1622
+ marginTop: 1,
1623
+ flexDirection: "column",
1624
+ children: sortedAgents.map((agent) => renderAgent(agent))
1625
+ }, undefined, false, undefined, this)
1626
+ ]
1627
+ }, undefined, true, undefined, this) : /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(jsx_dev_runtime7.Fragment, {
1628
+ children: [
1629
+ sortedAgents.filter((a) => a.source !== "built-in").map((agent) => renderAgent(agent)),
1630
+ sortedAgents.some((a) => a.source === "built-in") && /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(jsx_dev_runtime7.Fragment, {
1631
+ children: [
1632
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(Divider, {}, undefined, false, undefined, this),
1633
+ renderBuiltInAgentsSection()
1634
+ ]
1635
+ }, undefined, true, undefined, this)
1636
+ ]
1637
+ }, undefined, true, undefined, this)
1638
+ ]
1639
+ }, undefined, true, undefined, this)
1640
+ ]
1641
+ }, undefined, true, undefined, this);
1642
+ }
1643
+ var React4, jsx_dev_runtime7;
1644
+ var init_AgentsList = __esm(() => {
1645
+ init_figures();
1646
+ init_src();
1647
+ init_agentDisplay();
1648
+ init_array();
1649
+ init_src();
1650
+ init_utils2();
1651
+ React4 = __toESM(require_react(), 1);
1652
+ jsx_dev_runtime7 = __toESM(require_jsx_dev_runtime(), 1);
1653
+ });
1654
+
1655
+ // src/components/wizard/WizardProvider.tsx
1656
+ function WizardProvider({
1657
+ steps,
1658
+ initialData = {},
1659
+ onComplete,
1660
+ onCancel,
1661
+ children,
1662
+ title,
1663
+ showStepCounter = true
1664
+ }) {
1665
+ const [currentStepIndex, setCurrentStepIndex] = import_react4.useState(0);
1666
+ const [wizardData, setWizardData] = import_react4.useState(initialData);
1667
+ const [isCompleted, setIsCompleted] = import_react4.useState(false);
1668
+ const [navigationHistory, setNavigationHistory] = import_react4.useState([]);
1669
+ useExitOnCtrlCDWithKeybindings();
1670
+ import_react4.useEffect(() => {
1671
+ if (isCompleted) {
1672
+ setNavigationHistory([]);
1673
+ onComplete(wizardData);
1674
+ }
1675
+ }, [isCompleted, wizardData, onComplete]);
1676
+ const goNext = import_react4.useCallback(() => {
1677
+ if (currentStepIndex < steps.length - 1) {
1678
+ if (navigationHistory.length > 0) {
1679
+ setNavigationHistory((prev) => [...prev, currentStepIndex]);
1680
+ }
1681
+ setCurrentStepIndex((prev) => prev + 1);
1682
+ } else {
1683
+ setIsCompleted(true);
1684
+ }
1685
+ }, [currentStepIndex, steps.length, navigationHistory]);
1686
+ const goBack = import_react4.useCallback(() => {
1687
+ if (navigationHistory.length > 0) {
1688
+ const previousStep = navigationHistory[navigationHistory.length - 1];
1689
+ if (previousStep !== undefined) {
1690
+ setNavigationHistory((prev) => prev.slice(0, -1));
1691
+ setCurrentStepIndex(previousStep);
1692
+ }
1693
+ } else if (currentStepIndex > 0) {
1694
+ setCurrentStepIndex((prev) => prev - 1);
1695
+ } else if (onCancel) {
1696
+ onCancel();
1697
+ }
1698
+ }, [currentStepIndex, navigationHistory, onCancel]);
1699
+ const goToStep = import_react4.useCallback((index) => {
1700
+ if (index >= 0 && index < steps.length) {
1701
+ setNavigationHistory((prev) => [...prev, currentStepIndex]);
1702
+ setCurrentStepIndex(index);
1703
+ }
1704
+ }, [currentStepIndex, steps.length]);
1705
+ const cancel = import_react4.useCallback(() => {
1706
+ setNavigationHistory([]);
1707
+ if (onCancel) {
1708
+ onCancel();
1709
+ }
1710
+ }, [onCancel]);
1711
+ const updateWizardData = import_react4.useCallback((updates) => {
1712
+ setWizardData((prev) => ({ ...prev, ...updates }));
1713
+ }, []);
1714
+ const contextValue = import_react4.useMemo(() => ({
1715
+ currentStepIndex,
1716
+ totalSteps: steps.length,
1717
+ wizardData,
1718
+ setWizardData,
1719
+ updateWizardData,
1720
+ goNext,
1721
+ goBack,
1722
+ goToStep,
1723
+ cancel,
1724
+ title,
1725
+ showStepCounter
1726
+ }), [
1727
+ currentStepIndex,
1728
+ steps.length,
1729
+ wizardData,
1730
+ updateWizardData,
1731
+ goNext,
1732
+ goBack,
1733
+ goToStep,
1734
+ cancel,
1735
+ title,
1736
+ showStepCounter
1737
+ ]);
1738
+ const CurrentStepComponent = steps[currentStepIndex];
1739
+ if (!CurrentStepComponent || isCompleted) {
1740
+ return null;
1741
+ }
1742
+ return /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(WizardContext.Provider, {
1743
+ value: contextValue,
1744
+ children: children || /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(CurrentStepComponent, {}, undefined, false, undefined, this)
1745
+ }, undefined, false, undefined, this);
1746
+ }
1747
+ var import_react4, jsx_dev_runtime8, WizardContext;
1748
+ var init_WizardProvider = __esm(() => {
1749
+ init_useExitOnCtrlCDWithKeybindings();
1750
+ import_react4 = __toESM(require_react(), 1);
1751
+ jsx_dev_runtime8 = __toESM(require_jsx_dev_runtime(), 1);
1752
+ WizardContext = import_react4.createContext(null);
1753
+ });
1754
+
1755
+ // src/components/wizard/useWizard.ts
1756
+ function useWizard() {
1757
+ const context = import_react5.useContext(WizardContext);
1758
+ if (!context) {
1759
+ throw new Error("useWizard must be used within a WizardProvider");
1760
+ }
1761
+ return context;
1762
+ }
1763
+ var import_react5;
1764
+ var init_useWizard = __esm(() => {
1765
+ init_WizardProvider();
1766
+ import_react5 = __toESM(require_react(), 1);
1767
+ });
1768
+
1769
+ // src/components/wizard/WizardNavigationFooter.tsx
1770
+ function WizardNavigationFooter({
1771
+ instructions = /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(Byline, {
1772
+ children: [
1773
+ /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(KeyboardShortcutHint, {
1774
+ shortcut: "\u2191\u2193",
1775
+ action: "navigate"
1776
+ }, undefined, false, undefined, this),
1777
+ /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(KeyboardShortcutHint, {
1778
+ shortcut: "Enter",
1779
+ action: "select"
1780
+ }, undefined, false, undefined, this),
1781
+ /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(ConfigurableShortcutHint, {
1782
+ action: "confirm:no",
1783
+ context: "Confirmation",
1784
+ fallback: "Esc",
1785
+ description: "go back"
1786
+ }, undefined, false, undefined, this)
1787
+ ]
1788
+ }, undefined, true, undefined, this)
1789
+ }) {
1790
+ const exitState = useExitOnCtrlCDWithKeybindings();
1791
+ return /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(ThemedBox_default, {
1792
+ marginLeft: 3,
1793
+ marginTop: 1,
1794
+ children: /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(ThemedText, {
1795
+ dimColor: true,
1796
+ children: exitState.pending ? `Press ${exitState.keyName} again to exit` : instructions
1797
+ }, undefined, false, undefined, this)
1798
+ }, undefined, false, undefined, this);
1799
+ }
1800
+ var jsx_dev_runtime9;
1801
+ var init_WizardNavigationFooter = __esm(() => {
1802
+ init_useExitOnCtrlCDWithKeybindings();
1803
+ init_src();
1804
+ init_ConfigurableShortcutHint();
1805
+ init_src();
1806
+ jsx_dev_runtime9 = __toESM(require_jsx_dev_runtime(), 1);
1807
+ });
1808
+
1809
+ // src/components/wizard/WizardDialogLayout.tsx
1810
+ function WizardDialogLayout({
1811
+ title: titleOverride,
1812
+ color = "suggestion",
1813
+ children,
1814
+ subtitle,
1815
+ footerText
1816
+ }) {
1817
+ const {
1818
+ currentStepIndex,
1819
+ totalSteps,
1820
+ title: providerTitle,
1821
+ showStepCounter,
1822
+ goBack
1823
+ } = useWizard();
1824
+ const title = titleOverride || providerTitle || "Wizard";
1825
+ const stepSuffix = showStepCounter !== false ? ` (${currentStepIndex + 1}/${totalSteps})` : "";
1826
+ return /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(jsx_dev_runtime10.Fragment, {
1827
+ children: [
1828
+ /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(Dialog, {
1829
+ title: `${title}${stepSuffix}`,
1830
+ subtitle,
1831
+ onCancel: goBack,
1832
+ color,
1833
+ hideInputGuide: true,
1834
+ isCancelActive: false,
1835
+ children
1836
+ }, undefined, false, undefined, this),
1837
+ /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(WizardNavigationFooter, {
1838
+ instructions: footerText
1839
+ }, undefined, false, undefined, this)
1840
+ ]
1841
+ }, undefined, true, undefined, this);
1842
+ }
1843
+ var jsx_dev_runtime10;
1844
+ var init_WizardDialogLayout = __esm(() => {
1845
+ init_src();
1846
+ init_useWizard();
1847
+ init_WizardNavigationFooter();
1848
+ jsx_dev_runtime10 = __toESM(require_jsx_dev_runtime(), 1);
1849
+ });
1850
+
1851
+ // src/components/wizard/index.ts
1852
+ var init_wizard = __esm(() => {
1853
+ init_useWizard();
1854
+ init_WizardDialogLayout();
1855
+ init_WizardNavigationFooter();
1856
+ init_WizardProvider();
1857
+ });
1858
+
1859
+ // src/components/agents/new-agent-creation/wizard-steps/ColorStep.tsx
1860
+ function ColorStep() {
1861
+ const { goNext, goBack, updateWizardData, wizardData } = useWizard();
1862
+ useKeybinding("confirm:no", goBack, { context: "Confirmation" });
1863
+ const handleConfirm = (color) => {
1864
+ updateWizardData({
1865
+ selectedColor: color,
1866
+ finalAgent: {
1867
+ agentType: wizardData.agentType,
1868
+ whenToUse: wizardData.whenToUse,
1869
+ getSystemPrompt: () => wizardData.systemPrompt,
1870
+ tools: wizardData.selectedTools,
1871
+ ...wizardData.selectedModel ? { model: wizardData.selectedModel } : {},
1872
+ ...color ? { color } : {},
1873
+ source: wizardData.location
1874
+ }
1875
+ });
1876
+ goNext();
1877
+ };
1878
+ return /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(WizardDialogLayout, {
1879
+ subtitle: "Choose background color",
1880
+ footerText: /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(Byline, {
1881
+ children: [
1882
+ /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(KeyboardShortcutHint, {
1883
+ shortcut: "\u2191\u2193",
1884
+ action: "navigate"
1885
+ }, undefined, false, undefined, this),
1886
+ /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(KeyboardShortcutHint, {
1887
+ shortcut: "Enter",
1888
+ action: "select"
1889
+ }, undefined, false, undefined, this),
1890
+ /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(ConfigurableShortcutHint, {
1891
+ action: "confirm:no",
1892
+ context: "Confirmation",
1893
+ fallback: "Esc",
1894
+ description: "go back"
1895
+ }, undefined, false, undefined, this)
1896
+ ]
1897
+ }, undefined, true, undefined, this),
1898
+ children: /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(ThemedBox_default, {
1899
+ children: /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(ColorPicker, {
1900
+ agentName: wizardData.agentType || "agent",
1901
+ currentColor: "automatic",
1902
+ onConfirm: handleConfirm
1903
+ }, undefined, false, undefined, this)
1904
+ }, undefined, false, undefined, this)
1905
+ }, undefined, false, undefined, this);
1906
+ }
1907
+ var jsx_dev_runtime11;
1908
+ var init_ColorStep = __esm(() => {
1909
+ init_src();
1910
+ init_useKeybinding();
1911
+ init_ConfigurableShortcutHint();
1912
+ init_wizard();
1913
+ init_WizardDialogLayout();
1914
+ init_ColorPicker();
1915
+ jsx_dev_runtime11 = __toESM(require_jsx_dev_runtime(), 1);
1916
+ });
1917
+
1918
+ // src/components/agents/validateAgent.ts
1919
+ function validateAgentType(agentType) {
1920
+ if (!agentType) {
1921
+ return "Agent type is required";
1922
+ }
1923
+ if (!/^[a-zA-Z0-9][a-zA-Z0-9-]*[a-zA-Z0-9]$/.test(agentType)) {
1924
+ return "Agent type must start and end with alphanumeric characters and contain only letters, numbers, and hyphens";
1925
+ }
1926
+ if (agentType.length < 3) {
1927
+ return "Agent type must be at least 3 characters long";
1928
+ }
1929
+ if (agentType.length > 50) {
1930
+ return "Agent type must be less than 50 characters";
1931
+ }
1932
+ return null;
1933
+ }
1934
+ function validateAgent(agent, availableTools, existingAgents) {
1935
+ const errors = [];
1936
+ const warnings = [];
1937
+ if (!agent.agentType) {
1938
+ errors.push("Agent type is required");
1939
+ } else {
1940
+ const typeError = validateAgentType(agent.agentType);
1941
+ if (typeError) {
1942
+ errors.push(typeError);
1943
+ }
1944
+ const duplicate = existingAgents.find((a) => a.agentType === agent.agentType && a.source !== agent.source);
1945
+ if (duplicate) {
1946
+ errors.push(`Agent type "${agent.agentType}" already exists in ${getAgentSourceDisplayName(duplicate.source)}`);
1947
+ }
1948
+ }
1949
+ if (!agent.whenToUse) {
1950
+ errors.push("Description (description) is required");
1951
+ } else if (agent.whenToUse.length < 10) {
1952
+ warnings.push("Description should be more descriptive (at least 10 characters)");
1953
+ } else if (agent.whenToUse.length > 5000) {
1954
+ warnings.push("Description is very long (over 5000 characters)");
1955
+ }
1956
+ if (agent.tools !== undefined && !Array.isArray(agent.tools)) {
1957
+ errors.push("Tools must be an array");
1958
+ } else {
1959
+ if (agent.tools === undefined) {
1960
+ warnings.push("Agent has access to all tools");
1961
+ } else if (agent.tools.length === 0) {
1962
+ warnings.push("No tools selected - agent will have very limited capabilities");
1963
+ }
1964
+ const resolvedTools = resolveAgentTools(agent, availableTools, false);
1965
+ if (resolvedTools.invalidTools.length > 0) {
1966
+ errors.push(`Invalid tools: ${resolvedTools.invalidTools.join(", ")}`);
1967
+ }
1968
+ }
1969
+ const systemPrompt = agent.getSystemPrompt();
1970
+ if (!systemPrompt) {
1971
+ errors.push("System prompt is required");
1972
+ } else if (systemPrompt.length < 20) {
1973
+ errors.push("System prompt is too short (minimum 20 characters)");
1974
+ } else if (systemPrompt.length > 1e4) {
1975
+ warnings.push("System prompt is very long (over 10,000 characters)");
1976
+ }
1977
+ return {
1978
+ isValid: errors.length === 0,
1979
+ errors,
1980
+ warnings
1981
+ };
1982
+ }
1983
+ var init_validateAgent = __esm(() => {
1984
+ init_agentToolUtils();
1985
+ init_utils2();
1986
+ });
1987
+
1988
+ // src/components/agents/new-agent-creation/wizard-steps/ConfirmStep.tsx
1989
+ function ConfirmStep({
1990
+ tools,
1991
+ existingAgents,
1992
+ onSave,
1993
+ onSaveAndEdit,
1994
+ error
1995
+ }) {
1996
+ const { goBack, wizardData } = useWizard();
1997
+ useKeybinding("confirm:no", goBack, { context: "Confirmation" });
1998
+ const handleKeyDown = (e) => {
1999
+ if (e.key === "s" || e.key === "return") {
2000
+ e.preventDefault();
2001
+ onSave();
2002
+ } else if (e.key === "e") {
2003
+ e.preventDefault();
2004
+ onSaveAndEdit();
2005
+ }
2006
+ };
2007
+ const agent = wizardData.finalAgent;
2008
+ const validation = validateAgent(agent, tools, existingAgents);
2009
+ const systemPromptPreview = truncateToWidth(agent.getSystemPrompt(), 240);
2010
+ const whenToUsePreview = truncateToWidth(agent.whenToUse, 240);
2011
+ const getToolsDisplay = (toolNames) => {
2012
+ if (toolNames === undefined)
2013
+ return "All tools";
2014
+ if (toolNames.length === 0)
2015
+ return "None";
2016
+ if (toolNames.length === 1)
2017
+ return toolNames[0] || "None";
2018
+ if (toolNames.length === 2)
2019
+ return toolNames.join(" and ");
2020
+ return `${toolNames.slice(0, -1).join(", ")}, and ${toolNames[toolNames.length - 1]}`;
2021
+ };
2022
+ const memoryDisplayElement = isAutoMemoryEnabled() ? /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedText, {
2023
+ children: [
2024
+ /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedText, {
2025
+ bold: true,
2026
+ children: "Memory"
2027
+ }, undefined, false, undefined, this),
2028
+ ": ",
2029
+ getMemoryScopeDisplay(agent.memory)
2030
+ ]
2031
+ }, undefined, true, undefined, this) : null;
2032
+ return /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(WizardDialogLayout, {
2033
+ subtitle: "Confirm and save",
2034
+ footerText: /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(Byline, {
2035
+ children: [
2036
+ /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(KeyboardShortcutHint, {
2037
+ shortcut: "s/Enter",
2038
+ action: "save"
2039
+ }, undefined, false, undefined, this),
2040
+ /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(KeyboardShortcutHint, {
2041
+ shortcut: "e",
2042
+ action: "edit in your editor"
2043
+ }, undefined, false, undefined, this),
2044
+ /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ConfigurableShortcutHint, {
2045
+ action: "confirm:no",
2046
+ context: "Confirmation",
2047
+ fallback: "Esc",
2048
+ description: "cancel"
2049
+ }, undefined, false, undefined, this)
2050
+ ]
2051
+ }, undefined, true, undefined, this),
2052
+ children: /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedBox_default, {
2053
+ flexDirection: "column",
2054
+ tabIndex: 0,
2055
+ autoFocus: true,
2056
+ onKeyDown: handleKeyDown,
2057
+ children: [
2058
+ /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedText, {
2059
+ children: [
2060
+ /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedText, {
2061
+ bold: true,
2062
+ children: "Name"
2063
+ }, undefined, false, undefined, this),
2064
+ ": ",
2065
+ agent.agentType
2066
+ ]
2067
+ }, undefined, true, undefined, this),
2068
+ /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedText, {
2069
+ children: [
2070
+ /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedText, {
2071
+ bold: true,
2072
+ children: "Location"
2073
+ }, undefined, false, undefined, this),
2074
+ ":",
2075
+ " ",
2076
+ getNewRelativeAgentFilePath({
2077
+ source: wizardData.location,
2078
+ agentType: agent.agentType
2079
+ })
2080
+ ]
2081
+ }, undefined, true, undefined, this),
2082
+ /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedText, {
2083
+ children: [
2084
+ /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedText, {
2085
+ bold: true,
2086
+ children: "Tools"
2087
+ }, undefined, false, undefined, this),
2088
+ ": ",
2089
+ getToolsDisplay(agent.tools)
2090
+ ]
2091
+ }, undefined, true, undefined, this),
2092
+ /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedText, {
2093
+ children: [
2094
+ /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedText, {
2095
+ bold: true,
2096
+ children: "Model"
2097
+ }, undefined, false, undefined, this),
2098
+ ": ",
2099
+ getAgentModelDisplay(agent.model)
2100
+ ]
2101
+ }, undefined, true, undefined, this),
2102
+ memoryDisplayElement,
2103
+ /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedBox_default, {
2104
+ marginTop: 1,
2105
+ children: /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedText, {
2106
+ children: [
2107
+ /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedText, {
2108
+ bold: true,
2109
+ children: "Description"
2110
+ }, undefined, false, undefined, this),
2111
+ " (tells Claude when to use this agent):"
2112
+ ]
2113
+ }, undefined, true, undefined, this)
2114
+ }, undefined, false, undefined, this),
2115
+ /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedBox_default, {
2116
+ marginLeft: 2,
2117
+ marginTop: 1,
2118
+ children: /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedText, {
2119
+ children: whenToUsePreview
2120
+ }, undefined, false, undefined, this)
2121
+ }, undefined, false, undefined, this),
2122
+ /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedBox_default, {
2123
+ marginTop: 1,
2124
+ children: /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedText, {
2125
+ children: [
2126
+ /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedText, {
2127
+ bold: true,
2128
+ children: "System prompt"
2129
+ }, undefined, false, undefined, this),
2130
+ ":"
2131
+ ]
2132
+ }, undefined, true, undefined, this)
2133
+ }, undefined, false, undefined, this),
2134
+ /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedBox_default, {
2135
+ marginLeft: 2,
2136
+ marginTop: 1,
2137
+ children: /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedText, {
2138
+ children: systemPromptPreview
2139
+ }, undefined, false, undefined, this)
2140
+ }, undefined, false, undefined, this),
2141
+ validation.warnings.length > 0 && /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedBox_default, {
2142
+ marginTop: 1,
2143
+ flexDirection: "column",
2144
+ children: [
2145
+ /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedText, {
2146
+ color: "warning",
2147
+ children: "Warnings:"
2148
+ }, undefined, false, undefined, this),
2149
+ validation.warnings.map((warning, i) => /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedText, {
2150
+ dimColor: true,
2151
+ children: [
2152
+ " ",
2153
+ "\u2022 ",
2154
+ warning
2155
+ ]
2156
+ }, i, true, undefined, this))
2157
+ ]
2158
+ }, undefined, true, undefined, this),
2159
+ validation.errors.length > 0 && /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedBox_default, {
2160
+ marginTop: 1,
2161
+ flexDirection: "column",
2162
+ children: [
2163
+ /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedText, {
2164
+ color: "error",
2165
+ children: "Errors:"
2166
+ }, undefined, false, undefined, this),
2167
+ validation.errors.map((err, i) => /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedText, {
2168
+ color: "error",
2169
+ children: [
2170
+ " ",
2171
+ "\u2022 ",
2172
+ err
2173
+ ]
2174
+ }, i, true, undefined, this))
2175
+ ]
2176
+ }, undefined, true, undefined, this),
2177
+ error && /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedBox_default, {
2178
+ marginTop: 1,
2179
+ children: /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedText, {
2180
+ color: "error",
2181
+ children: error
2182
+ }, undefined, false, undefined, this)
2183
+ }, undefined, false, undefined, this),
2184
+ /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedBox_default, {
2185
+ marginTop: 2,
2186
+ children: /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedText, {
2187
+ color: "success",
2188
+ children: [
2189
+ "Press ",
2190
+ /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedText, {
2191
+ bold: true,
2192
+ children: "s"
2193
+ }, undefined, false, undefined, this),
2194
+ " or ",
2195
+ /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedText, {
2196
+ bold: true,
2197
+ children: "Enter"
2198
+ }, undefined, false, undefined, this),
2199
+ " to save,",
2200
+ " ",
2201
+ /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedText, {
2202
+ bold: true,
2203
+ children: "e"
2204
+ }, undefined, false, undefined, this),
2205
+ " to save and edit"
2206
+ ]
2207
+ }, undefined, true, undefined, this)
2208
+ }, undefined, false, undefined, this)
2209
+ ]
2210
+ }, undefined, true, undefined, this)
2211
+ }, undefined, false, undefined, this);
2212
+ }
2213
+ var jsx_dev_runtime12;
2214
+ var init_ConfirmStep = __esm(() => {
2215
+ init_src();
2216
+ init_useKeybinding();
2217
+ init_paths();
2218
+ init_agentMemory();
2219
+ init_format();
2220
+ init_agent();
2221
+ init_ConfigurableShortcutHint();
2222
+ init_wizard();
2223
+ init_WizardDialogLayout();
2224
+ init_agentFileUtils();
2225
+ init_validateAgent();
2226
+ jsx_dev_runtime12 = __toESM(require_jsx_dev_runtime(), 1);
2227
+ });
2228
+
2229
+ // src/components/agents/new-agent-creation/wizard-steps/ConfirmStepWrapper.tsx
2230
+ function ConfirmStepWrapper({
2231
+ tools,
2232
+ existingAgents,
2233
+ onComplete
2234
+ }) {
2235
+ const { wizardData } = useWizard();
2236
+ const [saveError, setSaveError] = import_react6.useState(null);
2237
+ const setAppState = useSetAppState();
2238
+ const saveAgent = import_react6.useCallback(async (openInEditor) => {
2239
+ if (!wizardData?.finalAgent)
2240
+ return;
2241
+ try {
2242
+ await saveAgentToFile(wizardData.location, wizardData.finalAgent.agentType, wizardData.finalAgent.whenToUse, wizardData.finalAgent.tools, wizardData.finalAgent.getSystemPrompt(), true, wizardData.finalAgent.color, wizardData.finalAgent.model, wizardData.finalAgent.memory);
2243
+ setAppState((state) => {
2244
+ if (!wizardData.finalAgent)
2245
+ return state;
2246
+ const allAgents = state.agentDefinitions.allAgents.concat(wizardData.finalAgent);
2247
+ return {
2248
+ ...state,
2249
+ agentDefinitions: {
2250
+ ...state.agentDefinitions,
2251
+ activeAgents: getActiveAgentsFromList(allAgents),
2252
+ allAgents
2253
+ }
2254
+ };
2255
+ });
2256
+ if (openInEditor) {
2257
+ const filePath = getNewAgentFilePath({
2258
+ source: wizardData.location,
2259
+ agentType: wizardData.finalAgent.agentType
2260
+ });
2261
+ await editFileInEditor(filePath);
2262
+ }
2263
+ logEvent("tengu_agent_created", {
2264
+ agent_type: wizardData.finalAgent.agentType,
2265
+ generation_method: wizardData.wasGenerated ? "generated" : "manual",
2266
+ source: wizardData.location,
2267
+ tool_count: wizardData.finalAgent.tools?.length ?? "all",
2268
+ has_custom_model: !!wizardData.finalAgent.model,
2269
+ has_custom_color: !!wizardData.finalAgent.color,
2270
+ has_memory: !!wizardData.finalAgent.memory,
2271
+ memory_scope: wizardData.finalAgent.memory ?? "none",
2272
+ ...openInEditor ? { opened_in_editor: true } : {}
2273
+ });
2274
+ const message = openInEditor ? `Created agent: ${source_default.bold(wizardData.finalAgent.agentType)} and opened in editor. ` + `If you made edits, restart to load the latest version.` : `Created agent: ${source_default.bold(wizardData.finalAgent.agentType)}`;
2275
+ onComplete(message);
2276
+ } catch (err) {
2277
+ setSaveError(err instanceof Error ? err.message : "Failed to save agent");
2278
+ }
2279
+ }, [wizardData, onComplete, setAppState]);
2280
+ const handleSave = import_react6.useCallback(() => saveAgent(false), [saveAgent]);
2281
+ const handleSaveAndEdit = import_react6.useCallback(() => saveAgent(true), [saveAgent]);
2282
+ return /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(ConfirmStep, {
2283
+ tools,
2284
+ existingAgents,
2285
+ onSave: handleSave,
2286
+ onSaveAndEdit: handleSaveAndEdit,
2287
+ error: saveError
2288
+ }, undefined, false, undefined, this);
2289
+ }
2290
+ var import_react6, jsx_dev_runtime13;
2291
+ var init_ConfirmStepWrapper = __esm(() => {
2292
+ init_source();
2293
+ init_analytics();
2294
+ init_AppState();
2295
+ init_loadAgentsDir();
2296
+ init_promptEditor();
2297
+ init_wizard();
2298
+ init_agentFileUtils();
2299
+ init_ConfirmStep();
2300
+ import_react6 = __toESM(require_react(), 1);
2301
+ jsx_dev_runtime13 = __toESM(require_jsx_dev_runtime(), 1);
2302
+ });
2303
+
2304
+ // src/components/agents/new-agent-creation/wizard-steps/DescriptionStep.tsx
2305
+ function DescriptionStep() {
2306
+ const { goNext, goBack, updateWizardData, wizardData } = useWizard();
2307
+ const [whenToUse, setWhenToUse] = import_react7.useState(wizardData.whenToUse || "");
2308
+ const [cursorOffset, setCursorOffset] = import_react7.useState(whenToUse.length);
2309
+ const [error, setError] = import_react7.useState(null);
2310
+ useKeybinding("confirm:no", goBack, { context: "Settings" });
2311
+ const handleExternalEditor = import_react7.useCallback(async () => {
2312
+ const result = await editPromptInEditor(whenToUse);
2313
+ if (result.content !== null) {
2314
+ setWhenToUse(result.content);
2315
+ setCursorOffset(result.content.length);
2316
+ }
2317
+ }, [whenToUse]);
2318
+ useKeybinding("chat:externalEditor", handleExternalEditor, {
2319
+ context: "Chat"
2320
+ });
2321
+ const handleSubmit = (value) => {
2322
+ const trimmedValue = value.trim();
2323
+ if (!trimmedValue) {
2324
+ setError("Description is required");
2325
+ return;
2326
+ }
2327
+ setError(null);
2328
+ updateWizardData({ whenToUse: trimmedValue });
2329
+ goNext();
2330
+ };
2331
+ return /* @__PURE__ */ jsx_dev_runtime14.jsxDEV(WizardDialogLayout, {
2332
+ subtitle: "Description (tell Claude when to use this agent)",
2333
+ footerText: /* @__PURE__ */ jsx_dev_runtime14.jsxDEV(Byline, {
2334
+ children: [
2335
+ /* @__PURE__ */ jsx_dev_runtime14.jsxDEV(KeyboardShortcutHint, {
2336
+ shortcut: "Type",
2337
+ action: "enter text"
2338
+ }, undefined, false, undefined, this),
2339
+ /* @__PURE__ */ jsx_dev_runtime14.jsxDEV(KeyboardShortcutHint, {
2340
+ shortcut: "Enter",
2341
+ action: "continue"
2342
+ }, undefined, false, undefined, this),
2343
+ /* @__PURE__ */ jsx_dev_runtime14.jsxDEV(ConfigurableShortcutHint, {
2344
+ action: "chat:externalEditor",
2345
+ context: "Chat",
2346
+ fallback: "ctrl+g",
2347
+ description: "open in editor"
2348
+ }, undefined, false, undefined, this),
2349
+ /* @__PURE__ */ jsx_dev_runtime14.jsxDEV(ConfigurableShortcutHint, {
2350
+ action: "confirm:no",
2351
+ context: "Settings",
2352
+ fallback: "Esc",
2353
+ description: "go back"
2354
+ }, undefined, false, undefined, this)
2355
+ ]
2356
+ }, undefined, true, undefined, this),
2357
+ children: /* @__PURE__ */ jsx_dev_runtime14.jsxDEV(ThemedBox_default, {
2358
+ flexDirection: "column",
2359
+ children: [
2360
+ /* @__PURE__ */ jsx_dev_runtime14.jsxDEV(ThemedText, {
2361
+ children: "When should Claude use this agent?"
2362
+ }, undefined, false, undefined, this),
2363
+ /* @__PURE__ */ jsx_dev_runtime14.jsxDEV(ThemedBox_default, {
2364
+ marginTop: 1,
2365
+ children: /* @__PURE__ */ jsx_dev_runtime14.jsxDEV(TextInput, {
2366
+ value: whenToUse,
2367
+ onChange: setWhenToUse,
2368
+ onSubmit: handleSubmit,
2369
+ placeholder: "e.g., use this agent after you're done writing code...",
2370
+ columns: 80,
2371
+ cursorOffset,
2372
+ onChangeCursorOffset: setCursorOffset,
2373
+ focus: true,
2374
+ showCursor: true
2375
+ }, undefined, false, undefined, this)
2376
+ }, undefined, false, undefined, this),
2377
+ error && /* @__PURE__ */ jsx_dev_runtime14.jsxDEV(ThemedBox_default, {
2378
+ marginTop: 1,
2379
+ children: /* @__PURE__ */ jsx_dev_runtime14.jsxDEV(ThemedText, {
2380
+ color: "error",
2381
+ children: error
2382
+ }, undefined, false, undefined, this)
2383
+ }, undefined, false, undefined, this)
2384
+ ]
2385
+ }, undefined, true, undefined, this)
2386
+ }, undefined, false, undefined, this);
2387
+ }
2388
+ var import_react7, jsx_dev_runtime14;
2389
+ var init_DescriptionStep = __esm(() => {
2390
+ init_src();
2391
+ init_useKeybinding();
2392
+ init_promptEditor();
2393
+ init_ConfigurableShortcutHint();
2394
+ init_TextInput();
2395
+ init_wizard();
2396
+ init_WizardDialogLayout();
2397
+ import_react7 = __toESM(require_react(), 1);
2398
+ jsx_dev_runtime14 = __toESM(require_jsx_dev_runtime(), 1);
2399
+ });
2400
+
2401
+ // src/components/agents/generateAgent.ts
2402
+ async function generateAgent(userPrompt, model, existingIdentifiers, abortSignal) {
2403
+ const existingList = existingIdentifiers.length > 0 ? `
2404
+
2405
+ IMPORTANT: The following identifiers already exist and must NOT be used: ${existingIdentifiers.join(", ")}` : "";
2406
+ const prompt = `Create an agent configuration based on this request: "${userPrompt}".${existingList}
2407
+ Return ONLY the JSON object, no other text.`;
2408
+ const userMessage = createUserMessage({ content: prompt });
2409
+ const userContext = await getUserContext();
2410
+ const messagesWithContext = prependUserContext([userMessage], userContext);
2411
+ const systemPrompt = isAutoMemoryEnabled() ? AGENT_CREATION_SYSTEM_PROMPT + AGENT_MEMORY_INSTRUCTIONS : AGENT_CREATION_SYSTEM_PROMPT;
2412
+ const response = await queryModelWithoutStreaming({
2413
+ messages: normalizeMessagesForAPI(messagesWithContext),
2414
+ systemPrompt: asSystemPrompt([systemPrompt]),
2415
+ thinkingConfig: { type: "disabled" },
2416
+ tools: [],
2417
+ signal: abortSignal,
2418
+ options: {
2419
+ getToolPermissionContext: async () => getEmptyToolPermissionContext(),
2420
+ model,
2421
+ toolChoice: undefined,
2422
+ agents: [],
2423
+ isNonInteractiveSession: false,
2424
+ hasAppendSystemPrompt: false,
2425
+ querySource: "agent_creation",
2426
+ mcpTools: []
2427
+ }
2428
+ });
2429
+ const textBlocks = (Array.isArray(response.message.content) ? response.message.content : []).filter((block) => block.type === "text");
2430
+ const responseText = textBlocks.map((block) => block.text).join(`
2431
+ `);
2432
+ let parsed;
2433
+ try {
2434
+ parsed = jsonParse(responseText.trim());
2435
+ } catch {
2436
+ const jsonMatch = responseText.match(/\{[\s\S]*\}/);
2437
+ if (!jsonMatch) {
2438
+ throw new Error("No JSON object found in response");
2439
+ }
2440
+ parsed = jsonParse(jsonMatch[0]);
2441
+ }
2442
+ if (!parsed.identifier || !parsed.whenToUse || !parsed.systemPrompt) {
2443
+ throw new Error("Invalid agent configuration generated");
2444
+ }
2445
+ logEvent("tengu_agent_definition_generated", {
2446
+ agent_identifier: parsed.identifier
2447
+ });
2448
+ return {
2449
+ identifier: parsed.identifier,
2450
+ whenToUse: parsed.whenToUse,
2451
+ systemPrompt: parsed.systemPrompt
2452
+ };
2453
+ }
2454
+ var AGENT_CREATION_SYSTEM_PROMPT, AGENT_MEMORY_INSTRUCTIONS = `
2455
+
2456
+ 7. **Agent Memory Instructions**: If the user mentions "memory", "remember", "learn", "persist", or similar concepts, OR if the agent would benefit from building up knowledge across conversations (e.g., code reviewers learning patterns, architects learning codebase structure, etc.), include domain-specific memory update instructions in the systemPrompt.
2457
+
2458
+ Add a section like this to the systemPrompt, tailored to the agent's specific domain:
2459
+
2460
+ "**Update your agent memory** as you discover [domain-specific items]. This builds up institutional knowledge across conversations. Write concise notes about what you found and where.
2461
+
2462
+ Examples of what to record:
2463
+ - [domain-specific item 1]
2464
+ - [domain-specific item 2]
2465
+ - [domain-specific item 3]"
2466
+
2467
+ Examples of domain-specific memory instructions:
2468
+ - For a code-reviewer: "Update your agent memory as you discover code patterns, style conventions, common issues, and architectural decisions in this codebase."
2469
+ - For a test-runner: "Update your agent memory as you discover test patterns, common failure modes, flaky tests, and testing best practices."
2470
+ - For an architect: "Update your agent memory as you discover codepaths, library locations, key architectural decisions, and component relationships."
2471
+ - For a documentation writer: "Update your agent memory as you discover documentation patterns, API structures, and terminology conventions."
2472
+
2473
+ The memory instructions should be specific to what the agent would naturally learn while performing its core tasks.
2474
+ `;
2475
+ var init_generateAgent = __esm(() => {
2476
+ init_context();
2477
+ init_claude();
2478
+ init_Tool();
2479
+ init_constants2();
2480
+ init_api();
2481
+ init_messages();
2482
+ init_paths();
2483
+ init_analytics();
2484
+ init_slowOperations();
2485
+ init_systemPromptType();
2486
+ AGENT_CREATION_SYSTEM_PROMPT = `You are an elite AI agent architect specializing in crafting high-performance agent configurations. Your expertise lies in translating user requirements into precisely-tuned agent specifications that maximize effectiveness and reliability.
2487
+
2488
+ **Important Context**: You may have access to project-specific instructions from CLAUDE.md files and other context that may include coding standards, project structure, and custom requirements. Consider this context when creating agents to ensure they align with the project's established patterns and practices.
2489
+
2490
+ When a user describes what they want an agent to do, you will:
2491
+
2492
+ 1. **Extract Core Intent**: Identify the fundamental purpose, key responsibilities, and success criteria for the agent. Look for both explicit requirements and implicit needs. Consider any project-specific context from CLAUDE.md files. For agents that are meant to review code, you should assume that the user is asking to review recently written code and not the whole codebase, unless the user has explicitly instructed you otherwise.
2493
+
2494
+ 2. **Design Expert Persona**: Create a compelling expert identity that embodies deep domain knowledge relevant to the task. The persona should inspire confidence and guide the agent's decision-making approach.
2495
+
2496
+ 3. **Architect Comprehensive Instructions**: Develop a system prompt that:
2497
+ - Establishes clear behavioral boundaries and operational parameters
2498
+ - Provides specific methodologies and best practices for task execution
2499
+ - Anticipates edge cases and provides guidance for handling them
2500
+ - Incorporates any specific requirements or preferences mentioned by the user
2501
+ - Defines output format expectations when relevant
2502
+ - Aligns with project-specific coding standards and patterns from CLAUDE.md
2503
+
2504
+ 4. **Optimize for Performance**: Include:
2505
+ - Decision-making frameworks appropriate to the domain
2506
+ - Quality control mechanisms and self-verification steps
2507
+ - Efficient workflow patterns
2508
+ - Clear escalation or fallback strategies
2509
+
2510
+ 5. **Create Identifier**: Design a concise, descriptive identifier that:
2511
+ - Uses lowercase letters, numbers, and hyphens only
2512
+ - Is typically 2-4 words joined by hyphens
2513
+ - Clearly indicates the agent's primary function
2514
+ - Is memorable and easy to type
2515
+ - Avoids generic terms like "helper" or "assistant"
2516
+
2517
+ 6 **Example agent descriptions**:
2518
+ - in the 'whenToUse' field of the JSON object, you should include examples of when this agent should be used.
2519
+ - examples should be of the form:
2520
+ - <example>
2521
+ Context: The user is creating a test-runner agent that should be called after a logical chunk of code is written.
2522
+ user: "Please write a function that checks if a number is prime"
2523
+ assistant: "Here is the relevant function: "
2524
+ <function call omitted for brevity only for this example>
2525
+ <commentary>
2526
+ Since a significant piece of code was written, use the ${AGENT_TOOL_NAME} tool to launch the test-runner agent to run the tests.
2527
+ </commentary>
2528
+ assistant: "Now let me use the test-runner agent to run the tests"
2529
+ </example>
2530
+ - <example>
2531
+ Context: User is creating an agent to respond to the word "hello" with a friendly jok.
2532
+ user: "Hello"
2533
+ assistant: "I'm going to use the ${AGENT_TOOL_NAME} tool to launch the greeting-responder agent to respond with a friendly joke"
2534
+ <commentary>
2535
+ Since the user is greeting, use the greeting-responder agent to respond with a friendly joke.
2536
+ </commentary>
2537
+ </example>
2538
+ - If the user mentioned or implied that the agent should be used proactively, you should include examples of this.
2539
+ - NOTE: Ensure that in the examples, you are making the assistant use the Agent tool and not simply respond directly to the task.
2540
+
2541
+ Your output must be a valid JSON object with exactly these fields:
2542
+ {
2543
+ "identifier": "A unique, descriptive identifier using lowercase letters, numbers, and hyphens (e.g., 'test-runner', 'api-docs-writer', 'code-formatter')",
2544
+ "whenToUse": "A precise, actionable description starting with 'Use this agent when...' that clearly defines the triggering conditions and use cases. Ensure you include examples as described above.",
2545
+ "systemPrompt": "The complete system prompt that will govern the agent's behavior, written in second person ('You are...', 'You will...') and structured for maximum clarity and effectiveness"
2546
+ }
2547
+
2548
+ Key principles for your system prompts:
2549
+ - Be specific rather than generic - avoid vague instructions
2550
+ - Include concrete examples when they would clarify behavior
2551
+ - Balance comprehensiveness with clarity - every instruction should add value
2552
+ - Ensure the agent has enough context to handle variations of the core task
2553
+ - Make the agent proactive in seeking clarification when needed
2554
+ - Build in quality assurance and self-correction mechanisms
2555
+
2556
+ Remember: The agents you create should be autonomous experts capable of handling their designated tasks with minimal additional guidance. Your system prompts are their complete operational manual.
2557
+ `;
2558
+ });
2559
+
2560
+ // src/components/agents/new-agent-creation/wizard-steps/GenerateStep.tsx
2561
+ function GenerateStep() {
2562
+ const { updateWizardData, goBack, goToStep, wizardData } = useWizard();
2563
+ const [prompt, setPrompt] = import_react8.useState(wizardData.generationPrompt || "");
2564
+ const [isGenerating, setIsGenerating] = import_react8.useState(false);
2565
+ const [error, setError] = import_react8.useState(null);
2566
+ const [cursorOffset, setCursorOffset] = import_react8.useState(prompt.length);
2567
+ const model = useMainLoopModel();
2568
+ const abortControllerRef = import_react8.useRef(null);
2569
+ const handleCancelGeneration = import_react8.useCallback(() => {
2570
+ if (abortControllerRef.current) {
2571
+ abortControllerRef.current.abort();
2572
+ abortControllerRef.current = null;
2573
+ setIsGenerating(false);
2574
+ setError("Generation cancelled");
2575
+ }
2576
+ }, []);
2577
+ useKeybinding("confirm:no", handleCancelGeneration, {
2578
+ context: "Settings",
2579
+ isActive: isGenerating
2580
+ });
2581
+ const handleExternalEditor = import_react8.useCallback(async () => {
2582
+ const result = await editPromptInEditor(prompt);
2583
+ if (result.content !== null) {
2584
+ setPrompt(result.content);
2585
+ setCursorOffset(result.content.length);
2586
+ }
2587
+ }, [prompt]);
2588
+ useKeybinding("chat:externalEditor", handleExternalEditor, {
2589
+ context: "Chat",
2590
+ isActive: !isGenerating
2591
+ });
2592
+ const handleGoBack = import_react8.useCallback(() => {
2593
+ updateWizardData({
2594
+ generationPrompt: "",
2595
+ agentType: "",
2596
+ systemPrompt: "",
2597
+ whenToUse: "",
2598
+ generatedAgent: undefined,
2599
+ wasGenerated: false
2600
+ });
2601
+ setPrompt("");
2602
+ setError(null);
2603
+ goBack();
2604
+ }, [updateWizardData, goBack]);
2605
+ useKeybinding("confirm:no", handleGoBack, {
2606
+ context: "Settings",
2607
+ isActive: !isGenerating
2608
+ });
2609
+ const handleGenerate = async () => {
2610
+ const trimmedPrompt = prompt.trim();
2611
+ if (!trimmedPrompt) {
2612
+ setError("Please describe what the agent should do");
2613
+ return;
2614
+ }
2615
+ setError(null);
2616
+ setIsGenerating(true);
2617
+ updateWizardData({
2618
+ generationPrompt: trimmedPrompt,
2619
+ isGenerating: true
2620
+ });
2621
+ const controller = createAbortController();
2622
+ abortControllerRef.current = controller;
2623
+ try {
2624
+ const generated = await generateAgent(trimmedPrompt, model, [], controller.signal);
2625
+ updateWizardData({
2626
+ agentType: generated.identifier,
2627
+ whenToUse: generated.whenToUse,
2628
+ systemPrompt: generated.systemPrompt,
2629
+ generatedAgent: generated,
2630
+ isGenerating: false,
2631
+ wasGenerated: true
2632
+ });
2633
+ goToStep(6);
2634
+ } catch (err) {
2635
+ if (err instanceof APIUserAbortError) {} else if (err instanceof Error && !err.message.includes("No assistant message found")) {
2636
+ setError(err.message || "Failed to generate agent");
2637
+ }
2638
+ updateWizardData({ isGenerating: false });
2639
+ } finally {
2640
+ setIsGenerating(false);
2641
+ abortControllerRef.current = null;
2642
+ }
2643
+ };
2644
+ const subtitle = "Describe what this agent should do and when it should be used (be comprehensive for best results)";
2645
+ if (isGenerating) {
2646
+ return /* @__PURE__ */ jsx_dev_runtime15.jsxDEV(WizardDialogLayout, {
2647
+ subtitle,
2648
+ footerText: /* @__PURE__ */ jsx_dev_runtime15.jsxDEV(ConfigurableShortcutHint, {
2649
+ action: "confirm:no",
2650
+ context: "Settings",
2651
+ fallback: "Esc",
2652
+ description: "cancel"
2653
+ }, undefined, false, undefined, this),
2654
+ children: /* @__PURE__ */ jsx_dev_runtime15.jsxDEV(ThemedBox_default, {
2655
+ flexDirection: "row",
2656
+ alignItems: "center",
2657
+ children: [
2658
+ /* @__PURE__ */ jsx_dev_runtime15.jsxDEV(Spinner, {}, undefined, false, undefined, this),
2659
+ /* @__PURE__ */ jsx_dev_runtime15.jsxDEV(ThemedText, {
2660
+ color: "suggestion",
2661
+ children: " Generating agent from description..."
2662
+ }, undefined, false, undefined, this)
2663
+ ]
2664
+ }, undefined, true, undefined, this)
2665
+ }, undefined, false, undefined, this);
2666
+ }
2667
+ return /* @__PURE__ */ jsx_dev_runtime15.jsxDEV(WizardDialogLayout, {
2668
+ subtitle,
2669
+ footerText: /* @__PURE__ */ jsx_dev_runtime15.jsxDEV(Byline, {
2670
+ children: [
2671
+ /* @__PURE__ */ jsx_dev_runtime15.jsxDEV(ConfigurableShortcutHint, {
2672
+ action: "confirm:yes",
2673
+ context: "Confirmation",
2674
+ fallback: "Enter",
2675
+ description: "submit"
2676
+ }, undefined, false, undefined, this),
2677
+ /* @__PURE__ */ jsx_dev_runtime15.jsxDEV(ConfigurableShortcutHint, {
2678
+ action: "chat:externalEditor",
2679
+ context: "Chat",
2680
+ fallback: "ctrl+g",
2681
+ description: "open in editor"
2682
+ }, undefined, false, undefined, this),
2683
+ /* @__PURE__ */ jsx_dev_runtime15.jsxDEV(ConfigurableShortcutHint, {
2684
+ action: "confirm:no",
2685
+ context: "Settings",
2686
+ fallback: "Esc",
2687
+ description: "go back"
2688
+ }, undefined, false, undefined, this)
2689
+ ]
2690
+ }, undefined, true, undefined, this),
2691
+ children: /* @__PURE__ */ jsx_dev_runtime15.jsxDEV(ThemedBox_default, {
2692
+ flexDirection: "column",
2693
+ children: [
2694
+ error && /* @__PURE__ */ jsx_dev_runtime15.jsxDEV(ThemedBox_default, {
2695
+ marginBottom: 1,
2696
+ children: /* @__PURE__ */ jsx_dev_runtime15.jsxDEV(ThemedText, {
2697
+ color: "error",
2698
+ children: error
2699
+ }, undefined, false, undefined, this)
2700
+ }, undefined, false, undefined, this),
2701
+ /* @__PURE__ */ jsx_dev_runtime15.jsxDEV(TextInput, {
2702
+ value: prompt,
2703
+ onChange: setPrompt,
2704
+ onSubmit: handleGenerate,
2705
+ placeholder: "e.g., Help me write unit tests for my code...",
2706
+ columns: 80,
2707
+ cursorOffset,
2708
+ onChangeCursorOffset: setCursorOffset,
2709
+ focus: true,
2710
+ showCursor: true
2711
+ }, undefined, false, undefined, this)
2712
+ ]
2713
+ }, undefined, true, undefined, this)
2714
+ }, undefined, false, undefined, this);
2715
+ }
2716
+ var import_react8, jsx_dev_runtime15;
2717
+ var init_GenerateStep = __esm(() => {
2718
+ init_sdk();
2719
+ init_useMainLoopModel();
2720
+ init_src();
2721
+ init_useKeybinding();
2722
+ init_abortController();
2723
+ init_promptEditor();
2724
+ init_ConfigurableShortcutHint();
2725
+ init_Spinner();
2726
+ init_TextInput();
2727
+ init_wizard();
2728
+ init_WizardDialogLayout();
2729
+ init_generateAgent();
2730
+ import_react8 = __toESM(require_react(), 1);
2731
+ jsx_dev_runtime15 = __toESM(require_jsx_dev_runtime(), 1);
2732
+ });
2733
+
2734
+ // src/components/agents/new-agent-creation/wizard-steps/LocationStep.tsx
2735
+ function LocationStep() {
2736
+ const { goNext, updateWizardData, cancel } = useWizard();
2737
+ const locationOptions = [
2738
+ {
2739
+ label: "Project (.claude/agents/)",
2740
+ value: "projectSettings"
2741
+ },
2742
+ {
2743
+ label: "Personal (~/.claude/agents/)",
2744
+ value: "userSettings"
2745
+ }
2746
+ ];
2747
+ return /* @__PURE__ */ jsx_dev_runtime16.jsxDEV(WizardDialogLayout, {
2748
+ subtitle: "Choose location",
2749
+ footerText: /* @__PURE__ */ jsx_dev_runtime16.jsxDEV(Byline, {
2750
+ children: [
2751
+ /* @__PURE__ */ jsx_dev_runtime16.jsxDEV(KeyboardShortcutHint, {
2752
+ shortcut: "\u2191\u2193",
2753
+ action: "navigate"
2754
+ }, undefined, false, undefined, this),
2755
+ /* @__PURE__ */ jsx_dev_runtime16.jsxDEV(KeyboardShortcutHint, {
2756
+ shortcut: "Enter",
2757
+ action: "select"
2758
+ }, undefined, false, undefined, this),
2759
+ /* @__PURE__ */ jsx_dev_runtime16.jsxDEV(ConfigurableShortcutHint, {
2760
+ action: "confirm:no",
2761
+ context: "Confirmation",
2762
+ fallback: "Esc",
2763
+ description: "cancel"
2764
+ }, undefined, false, undefined, this)
2765
+ ]
2766
+ }, undefined, true, undefined, this),
2767
+ children: /* @__PURE__ */ jsx_dev_runtime16.jsxDEV(ThemedBox_default, {
2768
+ children: /* @__PURE__ */ jsx_dev_runtime16.jsxDEV(Select, {
2769
+ options: locationOptions,
2770
+ onChange: (value) => {
2771
+ updateWizardData({ location: value });
2772
+ goNext();
2773
+ },
2774
+ onCancel: () => cancel()
2775
+ }, "location-select", false, undefined, this)
2776
+ }, undefined, false, undefined, this)
2777
+ }, undefined, false, undefined, this);
2778
+ }
2779
+ var jsx_dev_runtime16;
2780
+ var init_LocationStep = __esm(() => {
2781
+ init_src();
2782
+ init_ConfigurableShortcutHint();
2783
+ init_select();
2784
+ init_wizard();
2785
+ init_WizardDialogLayout();
2786
+ jsx_dev_runtime16 = __toESM(require_jsx_dev_runtime(), 1);
2787
+ });
2788
+
2789
+ // src/components/agents/new-agent-creation/wizard-steps/MemoryStep.tsx
2790
+ function MemoryStep() {
2791
+ const { goNext, goBack, updateWizardData, wizardData } = useWizard();
2792
+ useKeybinding("confirm:no", goBack, { context: "Confirmation" });
2793
+ const isUserScope = wizardData.location === "userSettings";
2794
+ const memoryOptions = isUserScope ? [
2795
+ {
2796
+ label: "User scope (~/.claude/agent-memory/) (Recommended)",
2797
+ value: "user"
2798
+ },
2799
+ { label: "None (no persistent memory)", value: "none" },
2800
+ { label: "Project scope (.claude/agent-memory/)", value: "project" },
2801
+ { label: "Local scope (.claude/agent-memory-local/)", value: "local" }
2802
+ ] : [
2803
+ {
2804
+ label: "Project scope (.claude/agent-memory/) (Recommended)",
2805
+ value: "project"
2806
+ },
2807
+ { label: "None (no persistent memory)", value: "none" },
2808
+ { label: "User scope (~/.claude/agent-memory/)", value: "user" },
2809
+ { label: "Local scope (.claude/agent-memory-local/)", value: "local" }
2810
+ ];
2811
+ const handleSelect = (value) => {
2812
+ const memory = value === "none" ? undefined : value;
2813
+ const agentType = wizardData.finalAgent?.agentType;
2814
+ updateWizardData({
2815
+ selectedMemory: memory,
2816
+ finalAgent: wizardData.finalAgent ? {
2817
+ ...wizardData.finalAgent,
2818
+ memory,
2819
+ getSystemPrompt: isAutoMemoryEnabled() && memory && agentType ? () => wizardData.systemPrompt + `
2820
+
2821
+ ` + loadAgentMemoryPrompt(agentType, memory) : () => wizardData.systemPrompt
2822
+ } : undefined
2823
+ });
2824
+ goNext();
2825
+ };
2826
+ return /* @__PURE__ */ jsx_dev_runtime17.jsxDEV(WizardDialogLayout, {
2827
+ subtitle: "Configure agent memory",
2828
+ footerText: /* @__PURE__ */ jsx_dev_runtime17.jsxDEV(Byline, {
2829
+ children: [
2830
+ /* @__PURE__ */ jsx_dev_runtime17.jsxDEV(KeyboardShortcutHint, {
2831
+ shortcut: "\u2191\u2193",
2832
+ action: "navigate"
2833
+ }, undefined, false, undefined, this),
2834
+ /* @__PURE__ */ jsx_dev_runtime17.jsxDEV(KeyboardShortcutHint, {
2835
+ shortcut: "Enter",
2836
+ action: "select"
2837
+ }, undefined, false, undefined, this),
2838
+ /* @__PURE__ */ jsx_dev_runtime17.jsxDEV(ConfigurableShortcutHint, {
2839
+ action: "confirm:no",
2840
+ context: "Confirmation",
2841
+ fallback: "Esc",
2842
+ description: "go back"
2843
+ }, undefined, false, undefined, this)
2844
+ ]
2845
+ }, undefined, true, undefined, this),
2846
+ children: /* @__PURE__ */ jsx_dev_runtime17.jsxDEV(ThemedBox_default, {
2847
+ children: /* @__PURE__ */ jsx_dev_runtime17.jsxDEV(Select, {
2848
+ options: memoryOptions,
2849
+ onChange: handleSelect,
2850
+ onCancel: goBack
2851
+ }, "memory-select", false, undefined, this)
2852
+ }, undefined, false, undefined, this)
2853
+ }, undefined, false, undefined, this);
2854
+ }
2855
+ var jsx_dev_runtime17;
2856
+ var init_MemoryStep = __esm(() => {
2857
+ init_src();
2858
+ init_useKeybinding();
2859
+ init_paths();
2860
+ init_agentMemory();
2861
+ init_ConfigurableShortcutHint();
2862
+ init_select();
2863
+ init_wizard();
2864
+ init_WizardDialogLayout();
2865
+ jsx_dev_runtime17 = __toESM(require_jsx_dev_runtime(), 1);
2866
+ });
2867
+
2868
+ // src/components/agents/new-agent-creation/wizard-steps/MethodStep.tsx
2869
+ function MethodStep() {
2870
+ const { goNext, goBack, updateWizardData, goToStep } = useWizard();
2871
+ const methodOptions = [
2872
+ {
2873
+ label: "Generate with Claude (recommended)",
2874
+ value: "generate"
2875
+ },
2876
+ {
2877
+ label: "Manual configuration",
2878
+ value: "manual"
2879
+ }
2880
+ ];
2881
+ return /* @__PURE__ */ jsx_dev_runtime18.jsxDEV(WizardDialogLayout, {
2882
+ subtitle: "Creation method",
2883
+ footerText: /* @__PURE__ */ jsx_dev_runtime18.jsxDEV(Byline, {
2884
+ children: [
2885
+ /* @__PURE__ */ jsx_dev_runtime18.jsxDEV(KeyboardShortcutHint, {
2886
+ shortcut: "\u2191\u2193",
2887
+ action: "navigate"
2888
+ }, undefined, false, undefined, this),
2889
+ /* @__PURE__ */ jsx_dev_runtime18.jsxDEV(KeyboardShortcutHint, {
2890
+ shortcut: "Enter",
2891
+ action: "select"
2892
+ }, undefined, false, undefined, this),
2893
+ /* @__PURE__ */ jsx_dev_runtime18.jsxDEV(ConfigurableShortcutHint, {
2894
+ action: "confirm:no",
2895
+ context: "Confirmation",
2896
+ fallback: "Esc",
2897
+ description: "go back"
2898
+ }, undefined, false, undefined, this)
2899
+ ]
2900
+ }, undefined, true, undefined, this),
2901
+ children: /* @__PURE__ */ jsx_dev_runtime18.jsxDEV(ThemedBox_default, {
2902
+ children: /* @__PURE__ */ jsx_dev_runtime18.jsxDEV(Select, {
2903
+ options: methodOptions,
2904
+ onChange: (value) => {
2905
+ const method = value;
2906
+ updateWizardData({
2907
+ method,
2908
+ wasGenerated: method === "generate"
2909
+ });
2910
+ if (method === "generate") {
2911
+ goNext();
2912
+ } else {
2913
+ goToStep(3);
2914
+ }
2915
+ },
2916
+ onCancel: () => goBack()
2917
+ }, "method-select", false, undefined, this)
2918
+ }, undefined, false, undefined, this)
2919
+ }, undefined, false, undefined, this);
2920
+ }
2921
+ var jsx_dev_runtime18;
2922
+ var init_MethodStep = __esm(() => {
2923
+ init_src();
2924
+ init_ConfigurableShortcutHint();
2925
+ init_select();
2926
+ init_wizard();
2927
+ init_WizardDialogLayout();
2928
+ jsx_dev_runtime18 = __toESM(require_jsx_dev_runtime(), 1);
2929
+ });
2930
+
2931
+ // src/components/agents/new-agent-creation/wizard-steps/ModelStep.tsx
2932
+ function ModelStep() {
2933
+ const { goNext, goBack, updateWizardData, wizardData } = useWizard();
2934
+ const handleComplete = (model) => {
2935
+ updateWizardData({ selectedModel: model });
2936
+ goNext();
2937
+ };
2938
+ return /* @__PURE__ */ jsx_dev_runtime19.jsxDEV(WizardDialogLayout, {
2939
+ subtitle: "Select model",
2940
+ footerText: /* @__PURE__ */ jsx_dev_runtime19.jsxDEV(Byline, {
2941
+ children: [
2942
+ /* @__PURE__ */ jsx_dev_runtime19.jsxDEV(KeyboardShortcutHint, {
2943
+ shortcut: "\u2191\u2193",
2944
+ action: "navigate"
2945
+ }, undefined, false, undefined, this),
2946
+ /* @__PURE__ */ jsx_dev_runtime19.jsxDEV(KeyboardShortcutHint, {
2947
+ shortcut: "Enter",
2948
+ action: "select"
2949
+ }, undefined, false, undefined, this),
2950
+ /* @__PURE__ */ jsx_dev_runtime19.jsxDEV(ConfigurableShortcutHint, {
2951
+ action: "confirm:no",
2952
+ context: "Confirmation",
2953
+ fallback: "Esc",
2954
+ description: "go back"
2955
+ }, undefined, false, undefined, this)
2956
+ ]
2957
+ }, undefined, true, undefined, this),
2958
+ children: /* @__PURE__ */ jsx_dev_runtime19.jsxDEV(ModelSelector, {
2959
+ initialModel: wizardData.selectedModel,
2960
+ onComplete: handleComplete,
2961
+ onCancel: goBack
2962
+ }, undefined, false, undefined, this)
2963
+ }, undefined, false, undefined, this);
2964
+ }
2965
+ var jsx_dev_runtime19;
2966
+ var init_ModelStep = __esm(() => {
2967
+ init_ConfigurableShortcutHint();
2968
+ init_src();
2969
+ init_wizard();
2970
+ init_WizardDialogLayout();
2971
+ init_ModelSelector();
2972
+ jsx_dev_runtime19 = __toESM(require_jsx_dev_runtime(), 1);
2973
+ });
2974
+
2975
+ // src/components/agents/new-agent-creation/wizard-steps/PromptStep.tsx
2976
+ function PromptStep() {
2977
+ const { goNext, goBack, updateWizardData, wizardData } = useWizard();
2978
+ const [systemPrompt, setSystemPrompt] = import_react9.useState(wizardData.systemPrompt || "");
2979
+ const [cursorOffset, setCursorOffset] = import_react9.useState(systemPrompt.length);
2980
+ const [error, setError] = import_react9.useState(null);
2981
+ useKeybinding("confirm:no", goBack, { context: "Settings" });
2982
+ const handleExternalEditor = import_react9.useCallback(async () => {
2983
+ const result = await editPromptInEditor(systemPrompt);
2984
+ if (result.content !== null) {
2985
+ setSystemPrompt(result.content);
2986
+ setCursorOffset(result.content.length);
2987
+ }
2988
+ }, [systemPrompt]);
2989
+ useKeybinding("chat:externalEditor", handleExternalEditor, {
2990
+ context: "Chat"
2991
+ });
2992
+ const handleSubmit = () => {
2993
+ const trimmedPrompt = systemPrompt.trim();
2994
+ if (!trimmedPrompt) {
2995
+ setError("System prompt is required");
2996
+ return;
2997
+ }
2998
+ setError(null);
2999
+ updateWizardData({ systemPrompt: trimmedPrompt });
3000
+ goNext();
3001
+ };
3002
+ return /* @__PURE__ */ jsx_dev_runtime20.jsxDEV(WizardDialogLayout, {
3003
+ subtitle: "System prompt",
3004
+ footerText: /* @__PURE__ */ jsx_dev_runtime20.jsxDEV(Byline, {
3005
+ children: [
3006
+ /* @__PURE__ */ jsx_dev_runtime20.jsxDEV(KeyboardShortcutHint, {
3007
+ shortcut: "Type",
3008
+ action: "enter text"
3009
+ }, undefined, false, undefined, this),
3010
+ /* @__PURE__ */ jsx_dev_runtime20.jsxDEV(KeyboardShortcutHint, {
3011
+ shortcut: "Enter",
3012
+ action: "continue"
3013
+ }, undefined, false, undefined, this),
3014
+ /* @__PURE__ */ jsx_dev_runtime20.jsxDEV(ConfigurableShortcutHint, {
3015
+ action: "chat:externalEditor",
3016
+ context: "Chat",
3017
+ fallback: "ctrl+g",
3018
+ description: "open in editor"
3019
+ }, undefined, false, undefined, this),
3020
+ /* @__PURE__ */ jsx_dev_runtime20.jsxDEV(ConfigurableShortcutHint, {
3021
+ action: "confirm:no",
3022
+ context: "Settings",
3023
+ fallback: "Esc",
3024
+ description: "go back"
3025
+ }, undefined, false, undefined, this)
3026
+ ]
3027
+ }, undefined, true, undefined, this),
3028
+ children: /* @__PURE__ */ jsx_dev_runtime20.jsxDEV(ThemedBox_default, {
3029
+ flexDirection: "column",
3030
+ children: [
3031
+ /* @__PURE__ */ jsx_dev_runtime20.jsxDEV(ThemedText, {
3032
+ children: "Enter the system prompt for your agent:"
3033
+ }, undefined, false, undefined, this),
3034
+ /* @__PURE__ */ jsx_dev_runtime20.jsxDEV(ThemedText, {
3035
+ dimColor: true,
3036
+ children: "Be comprehensive for best results"
3037
+ }, undefined, false, undefined, this),
3038
+ /* @__PURE__ */ jsx_dev_runtime20.jsxDEV(ThemedBox_default, {
3039
+ marginTop: 1,
3040
+ children: /* @__PURE__ */ jsx_dev_runtime20.jsxDEV(TextInput, {
3041
+ value: systemPrompt,
3042
+ onChange: setSystemPrompt,
3043
+ onSubmit: handleSubmit,
3044
+ placeholder: "You are a helpful code reviewer who...",
3045
+ columns: 80,
3046
+ cursorOffset,
3047
+ onChangeCursorOffset: setCursorOffset,
3048
+ focus: true,
3049
+ showCursor: true
3050
+ }, undefined, false, undefined, this)
3051
+ }, undefined, false, undefined, this),
3052
+ error && /* @__PURE__ */ jsx_dev_runtime20.jsxDEV(ThemedBox_default, {
3053
+ marginTop: 1,
3054
+ children: /* @__PURE__ */ jsx_dev_runtime20.jsxDEV(ThemedText, {
3055
+ color: "error",
3056
+ children: error
3057
+ }, undefined, false, undefined, this)
3058
+ }, undefined, false, undefined, this)
3059
+ ]
3060
+ }, undefined, true, undefined, this)
3061
+ }, undefined, false, undefined, this);
3062
+ }
3063
+ var import_react9, jsx_dev_runtime20;
3064
+ var init_PromptStep = __esm(() => {
3065
+ init_src();
3066
+ init_useKeybinding();
3067
+ init_promptEditor();
3068
+ init_ConfigurableShortcutHint();
3069
+ init_TextInput();
3070
+ init_wizard();
3071
+ init_WizardDialogLayout();
3072
+ import_react9 = __toESM(require_react(), 1);
3073
+ jsx_dev_runtime20 = __toESM(require_jsx_dev_runtime(), 1);
3074
+ });
3075
+
3076
+ // src/components/agents/new-agent-creation/wizard-steps/ToolsStep.tsx
3077
+ function ToolsStep({ tools }) {
3078
+ const { goNext, goBack, updateWizardData, wizardData } = useWizard();
3079
+ const handleComplete = (selectedTools) => {
3080
+ updateWizardData({ selectedTools });
3081
+ goNext();
3082
+ };
3083
+ const initialTools = wizardData.selectedTools;
3084
+ return /* @__PURE__ */ jsx_dev_runtime21.jsxDEV(WizardDialogLayout, {
3085
+ subtitle: "Select tools",
3086
+ footerText: /* @__PURE__ */ jsx_dev_runtime21.jsxDEV(Byline, {
3087
+ children: [
3088
+ /* @__PURE__ */ jsx_dev_runtime21.jsxDEV(KeyboardShortcutHint, {
3089
+ shortcut: "Enter",
3090
+ action: "toggle selection"
3091
+ }, undefined, false, undefined, this),
3092
+ /* @__PURE__ */ jsx_dev_runtime21.jsxDEV(KeyboardShortcutHint, {
3093
+ shortcut: "\u2191\u2193",
3094
+ action: "navigate"
3095
+ }, undefined, false, undefined, this),
3096
+ /* @__PURE__ */ jsx_dev_runtime21.jsxDEV(ConfigurableShortcutHint, {
3097
+ action: "confirm:no",
3098
+ context: "Confirmation",
3099
+ fallback: "Esc",
3100
+ description: "go back"
3101
+ }, undefined, false, undefined, this)
3102
+ ]
3103
+ }, undefined, true, undefined, this),
3104
+ children: /* @__PURE__ */ jsx_dev_runtime21.jsxDEV(ToolSelector, {
3105
+ tools,
3106
+ initialTools,
3107
+ onComplete: handleComplete,
3108
+ onCancel: goBack
3109
+ }, undefined, false, undefined, this)
3110
+ }, undefined, false, undefined, this);
3111
+ }
3112
+ var jsx_dev_runtime21;
3113
+ var init_ToolsStep = __esm(() => {
3114
+ init_src();
3115
+ init_ConfigurableShortcutHint();
3116
+ init_wizard();
3117
+ init_WizardDialogLayout();
3118
+ init_ToolSelector();
3119
+ jsx_dev_runtime21 = __toESM(require_jsx_dev_runtime(), 1);
3120
+ });
3121
+
3122
+ // src/components/agents/new-agent-creation/wizard-steps/TypeStep.tsx
3123
+ function TypeStep(_props) {
3124
+ const { goNext, goBack, updateWizardData, wizardData } = useWizard();
3125
+ const [agentType, setAgentType] = import_react10.useState(wizardData.agentType || "");
3126
+ const [error, setError] = import_react10.useState(null);
3127
+ const [cursorOffset, setCursorOffset] = import_react10.useState(agentType.length);
3128
+ useKeybinding("confirm:no", goBack, { context: "Settings" });
3129
+ const handleSubmit = (value) => {
3130
+ const trimmedValue = value.trim();
3131
+ const validationError = validateAgentType(trimmedValue);
3132
+ if (validationError) {
3133
+ setError(validationError);
3134
+ return;
3135
+ }
3136
+ setError(null);
3137
+ updateWizardData({ agentType: trimmedValue });
3138
+ goNext();
3139
+ };
3140
+ return /* @__PURE__ */ jsx_dev_runtime22.jsxDEV(WizardDialogLayout, {
3141
+ subtitle: "Agent type (identifier)",
3142
+ footerText: /* @__PURE__ */ jsx_dev_runtime22.jsxDEV(Byline, {
3143
+ children: [
3144
+ /* @__PURE__ */ jsx_dev_runtime22.jsxDEV(KeyboardShortcutHint, {
3145
+ shortcut: "Type",
3146
+ action: "enter text"
3147
+ }, undefined, false, undefined, this),
3148
+ /* @__PURE__ */ jsx_dev_runtime22.jsxDEV(KeyboardShortcutHint, {
3149
+ shortcut: "Enter",
3150
+ action: "continue"
3151
+ }, undefined, false, undefined, this),
3152
+ /* @__PURE__ */ jsx_dev_runtime22.jsxDEV(ConfigurableShortcutHint, {
3153
+ action: "confirm:no",
3154
+ context: "Settings",
3155
+ fallback: "Esc",
3156
+ description: "go back"
3157
+ }, undefined, false, undefined, this)
3158
+ ]
3159
+ }, undefined, true, undefined, this),
3160
+ children: /* @__PURE__ */ jsx_dev_runtime22.jsxDEV(ThemedBox_default, {
3161
+ flexDirection: "column",
3162
+ children: [
3163
+ /* @__PURE__ */ jsx_dev_runtime22.jsxDEV(ThemedText, {
3164
+ children: "Enter a unique identifier for your agent:"
3165
+ }, undefined, false, undefined, this),
3166
+ /* @__PURE__ */ jsx_dev_runtime22.jsxDEV(ThemedBox_default, {
3167
+ marginTop: 1,
3168
+ children: /* @__PURE__ */ jsx_dev_runtime22.jsxDEV(TextInput, {
3169
+ value: agentType,
3170
+ onChange: setAgentType,
3171
+ onSubmit: handleSubmit,
3172
+ placeholder: "e.g., test-runner, tech-lead, etc",
3173
+ columns: 60,
3174
+ cursorOffset,
3175
+ onChangeCursorOffset: setCursorOffset,
3176
+ focus: true,
3177
+ showCursor: true
3178
+ }, undefined, false, undefined, this)
3179
+ }, undefined, false, undefined, this),
3180
+ error && /* @__PURE__ */ jsx_dev_runtime22.jsxDEV(ThemedBox_default, {
3181
+ marginTop: 1,
3182
+ children: /* @__PURE__ */ jsx_dev_runtime22.jsxDEV(ThemedText, {
3183
+ color: "error",
3184
+ children: error
3185
+ }, undefined, false, undefined, this)
3186
+ }, undefined, false, undefined, this)
3187
+ ]
3188
+ }, undefined, true, undefined, this)
3189
+ }, undefined, false, undefined, this);
3190
+ }
3191
+ var import_react10, jsx_dev_runtime22;
3192
+ var init_TypeStep = __esm(() => {
3193
+ init_src();
3194
+ init_useKeybinding();
3195
+ init_ConfigurableShortcutHint();
3196
+ init_TextInput();
3197
+ init_wizard();
3198
+ init_WizardDialogLayout();
3199
+ init_validateAgent();
3200
+ import_react10 = __toESM(require_react(), 1);
3201
+ jsx_dev_runtime22 = __toESM(require_jsx_dev_runtime(), 1);
3202
+ });
3203
+
3204
+ // src/components/agents/new-agent-creation/CreateAgentWizard.tsx
3205
+ function CreateAgentWizard({
3206
+ tools,
3207
+ existingAgents,
3208
+ onComplete,
3209
+ onCancel
3210
+ }) {
3211
+ const steps = [
3212
+ LocationStep,
3213
+ MethodStep,
3214
+ GenerateStep,
3215
+ () => /* @__PURE__ */ jsx_dev_runtime23.jsxDEV(TypeStep, {
3216
+ existingAgents
3217
+ }, undefined, false, undefined, this),
3218
+ PromptStep,
3219
+ DescriptionStep,
3220
+ () => /* @__PURE__ */ jsx_dev_runtime23.jsxDEV(ToolsStep, {
3221
+ tools
3222
+ }, undefined, false, undefined, this),
3223
+ ModelStep,
3224
+ ColorStep,
3225
+ ...isAutoMemoryEnabled() ? [MemoryStep] : [],
3226
+ () => /* @__PURE__ */ jsx_dev_runtime23.jsxDEV(ConfirmStepWrapper, {
3227
+ tools,
3228
+ existingAgents,
3229
+ onComplete
3230
+ }, undefined, false, undefined, this)
3231
+ ];
3232
+ return /* @__PURE__ */ jsx_dev_runtime23.jsxDEV(WizardProvider, {
3233
+ steps,
3234
+ initialData: {},
3235
+ onComplete: () => {},
3236
+ onCancel,
3237
+ title: "Create new agent",
3238
+ showStepCounter: false
3239
+ }, undefined, false, undefined, this);
3240
+ }
3241
+ var jsx_dev_runtime23;
3242
+ var init_CreateAgentWizard = __esm(() => {
3243
+ init_paths();
3244
+ init_wizard();
3245
+ init_ColorStep();
3246
+ init_ConfirmStepWrapper();
3247
+ init_DescriptionStep();
3248
+ init_GenerateStep();
3249
+ init_LocationStep();
3250
+ init_MemoryStep();
3251
+ init_MethodStep();
3252
+ init_ModelStep();
3253
+ init_PromptStep();
3254
+ init_ToolsStep();
3255
+ init_TypeStep();
3256
+ jsx_dev_runtime23 = __toESM(require_jsx_dev_runtime(), 1);
3257
+ });
3258
+
3259
+ // src/components/agents/AgentsMenu.tsx
3260
+ function AgentsMenu({ tools, onExit }) {
3261
+ const [modeState, setModeState] = import_react11.useState({
3262
+ mode: "list-agents",
3263
+ source: "all"
3264
+ });
3265
+ const agentDefinitions = useAppState((s) => s.agentDefinitions);
3266
+ const mcpTools = useAppState((s) => s.mcp.tools);
3267
+ const toolPermissionContext = useAppState((s) => s.toolPermissionContext);
3268
+ const setAppState = useSetAppState();
3269
+ const { allAgents, activeAgents: agents } = agentDefinitions;
3270
+ const [changes, setChanges] = import_react11.useState([]);
3271
+ const mergedTools = useMergedTools(tools, mcpTools, toolPermissionContext);
3272
+ useExitOnCtrlCDWithKeybindings();
3273
+ const agentsBySource = import_react11.useMemo(() => ({
3274
+ "built-in": allAgents.filter((a) => a.source === "built-in"),
3275
+ userSettings: allAgents.filter((a) => a.source === "userSettings"),
3276
+ projectSettings: allAgents.filter((a) => a.source === "projectSettings"),
3277
+ policySettings: allAgents.filter((a) => a.source === "policySettings"),
3278
+ localSettings: allAgents.filter((a) => a.source === "localSettings"),
3279
+ flagSettings: allAgents.filter((a) => a.source === "flagSettings"),
3280
+ plugin: allAgents.filter((a) => a.source === "plugin"),
3281
+ all: allAgents
3282
+ }), [allAgents]);
3283
+ const handleAgentCreated = import_react11.useCallback((message) => {
3284
+ setChanges((prev) => [...prev, message]);
3285
+ setModeState({ mode: "list-agents", source: "all" });
3286
+ }, []);
3287
+ const handleAgentDeleted = import_react11.useCallback(async (agent) => {
3288
+ try {
3289
+ await deleteAgentFromFile(agent);
3290
+ setAppState((state) => {
3291
+ const allAgents2 = state.agentDefinitions.allAgents.filter((a) => !(a.agentType === agent.agentType && a.source === agent.source));
3292
+ return {
3293
+ ...state,
3294
+ agentDefinitions: {
3295
+ ...state.agentDefinitions,
3296
+ allAgents: allAgents2,
3297
+ activeAgents: getActiveAgentsFromList(allAgents2)
3298
+ }
3299
+ };
3300
+ });
3301
+ setChanges((prev) => [
3302
+ ...prev,
3303
+ `Deleted agent: ${source_default.bold(agent.agentType)}`
3304
+ ]);
3305
+ setModeState({ mode: "list-agents", source: "all" });
3306
+ } catch (error) {
3307
+ logError(toError(error));
3308
+ }
3309
+ }, [setAppState]);
3310
+ switch (modeState.mode) {
3311
+ case "list-agents": {
3312
+ const agentsToShow = modeState.source === "all" ? [
3313
+ ...agentsBySource["built-in"],
3314
+ ...agentsBySource["userSettings"],
3315
+ ...agentsBySource["projectSettings"],
3316
+ ...agentsBySource["localSettings"],
3317
+ ...agentsBySource["policySettings"],
3318
+ ...agentsBySource["flagSettings"],
3319
+ ...agentsBySource["plugin"]
3320
+ ] : agentsBySource[modeState.source];
3321
+ const allResolved = resolveAgentOverrides(agentsToShow, agents);
3322
+ const resolvedAgents = allResolved;
3323
+ return /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(jsx_dev_runtime24.Fragment, {
3324
+ children: [
3325
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(AgentsList, {
3326
+ source: modeState.source,
3327
+ agents: resolvedAgents,
3328
+ onBack: () => {
3329
+ const exitMessage = changes.length > 0 ? `Agent changes:
3330
+ ${changes.join(`
3331
+ `)}` : undefined;
3332
+ onExit(exitMessage ?? "Agents dialog dismissed", {
3333
+ display: changes.length === 0 ? "system" : undefined
3334
+ });
3335
+ },
3336
+ onSelect: (agent) => setModeState({
3337
+ mode: "agent-menu",
3338
+ agent,
3339
+ previousMode: modeState
3340
+ }),
3341
+ onCreateNew: () => setModeState({ mode: "create-agent" }),
3342
+ changes
3343
+ }, undefined, false, undefined, this),
3344
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(AgentNavigationFooter, {}, undefined, false, undefined, this)
3345
+ ]
3346
+ }, undefined, true, undefined, this);
3347
+ }
3348
+ case "create-agent":
3349
+ return /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(CreateAgentWizard, {
3350
+ tools: mergedTools,
3351
+ existingAgents: agents,
3352
+ onComplete: handleAgentCreated,
3353
+ onCancel: () => setModeState({ mode: "list-agents", source: "all" })
3354
+ }, undefined, false, undefined, this);
3355
+ case "agent-menu": {
3356
+ const freshAgent = allAgents.find((a) => a.agentType === modeState.agent.agentType && a.source === modeState.agent.source);
3357
+ const agentToUse = freshAgent || modeState.agent;
3358
+ const isEditable = agentToUse.source !== "built-in" && agentToUse.source !== "plugin" && agentToUse.source !== "flagSettings";
3359
+ const menuItems = [
3360
+ { label: "View agent", value: "view" },
3361
+ ...isEditable ? [
3362
+ { label: "Edit agent", value: "edit" },
3363
+ { label: "Delete agent", value: "delete" }
3364
+ ] : [],
3365
+ { label: "Back", value: "back" }
3366
+ ];
3367
+ const handleMenuSelect = (value) => {
3368
+ switch (value) {
3369
+ case "view":
3370
+ setModeState({
3371
+ mode: "view-agent",
3372
+ agent: agentToUse,
3373
+ previousMode: modeState.previousMode
3374
+ });
3375
+ break;
3376
+ case "edit":
3377
+ setModeState({
3378
+ mode: "edit-agent",
3379
+ agent: agentToUse,
3380
+ previousMode: modeState
3381
+ });
3382
+ break;
3383
+ case "delete":
3384
+ setModeState({
3385
+ mode: "delete-confirm",
3386
+ agent: agentToUse,
3387
+ previousMode: modeState
3388
+ });
3389
+ break;
3390
+ case "back":
3391
+ setModeState(modeState.previousMode);
3392
+ break;
3393
+ }
3394
+ };
3395
+ return /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(jsx_dev_runtime24.Fragment, {
3396
+ children: [
3397
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Dialog, {
3398
+ title: modeState.agent.agentType,
3399
+ onCancel: () => setModeState(modeState.previousMode),
3400
+ hideInputGuide: true,
3401
+ children: /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(ThemedBox_default, {
3402
+ flexDirection: "column",
3403
+ children: [
3404
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Select, {
3405
+ options: menuItems,
3406
+ onChange: handleMenuSelect,
3407
+ onCancel: () => setModeState(modeState.previousMode)
3408
+ }, undefined, false, undefined, this),
3409
+ changes.length > 0 && /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(ThemedBox_default, {
3410
+ marginTop: 1,
3411
+ children: /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(ThemedText, {
3412
+ dimColor: true,
3413
+ children: changes[changes.length - 1]
3414
+ }, undefined, false, undefined, this)
3415
+ }, undefined, false, undefined, this)
3416
+ ]
3417
+ }, undefined, true, undefined, this)
3418
+ }, undefined, false, undefined, this),
3419
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(AgentNavigationFooter, {}, undefined, false, undefined, this)
3420
+ ]
3421
+ }, undefined, true, undefined, this);
3422
+ }
3423
+ case "view-agent": {
3424
+ const freshAgent = allAgents.find((a) => a.agentType === modeState.agent.agentType && a.source === modeState.agent.source);
3425
+ const agentToDisplay = freshAgent || modeState.agent;
3426
+ return /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(jsx_dev_runtime24.Fragment, {
3427
+ children: [
3428
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Dialog, {
3429
+ title: agentToDisplay.agentType,
3430
+ onCancel: () => setModeState({
3431
+ mode: "agent-menu",
3432
+ agent: agentToDisplay,
3433
+ previousMode: modeState.previousMode
3434
+ }),
3435
+ hideInputGuide: true,
3436
+ children: /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(AgentDetail, {
3437
+ agent: agentToDisplay,
3438
+ tools: mergedTools,
3439
+ allAgents,
3440
+ onBack: () => setModeState({
3441
+ mode: "agent-menu",
3442
+ agent: agentToDisplay,
3443
+ previousMode: modeState.previousMode
3444
+ })
3445
+ }, undefined, false, undefined, this)
3446
+ }, undefined, false, undefined, this),
3447
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(AgentNavigationFooter, {
3448
+ instructions: "Press Enter or Esc to go back"
3449
+ }, undefined, false, undefined, this)
3450
+ ]
3451
+ }, undefined, true, undefined, this);
3452
+ }
3453
+ case "delete-confirm": {
3454
+ const deleteOptions = [
3455
+ { label: "Yes, delete", value: "yes" },
3456
+ { label: "No, cancel", value: "no" }
3457
+ ];
3458
+ return /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(jsx_dev_runtime24.Fragment, {
3459
+ children: [
3460
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Dialog, {
3461
+ title: "Delete agent",
3462
+ onCancel: () => {
3463
+ if ("previousMode" in modeState)
3464
+ setModeState(modeState.previousMode);
3465
+ },
3466
+ color: "error",
3467
+ children: [
3468
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(ThemedText, {
3469
+ children: [
3470
+ "Are you sure you want to delete the agent",
3471
+ " ",
3472
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(ThemedText, {
3473
+ bold: true,
3474
+ children: modeState.agent.agentType
3475
+ }, undefined, false, undefined, this),
3476
+ "?"
3477
+ ]
3478
+ }, undefined, true, undefined, this),
3479
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(ThemedBox_default, {
3480
+ marginTop: 1,
3481
+ children: /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(ThemedText, {
3482
+ dimColor: true,
3483
+ children: [
3484
+ "Source: ",
3485
+ modeState.agent.source
3486
+ ]
3487
+ }, undefined, true, undefined, this)
3488
+ }, undefined, false, undefined, this),
3489
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(ThemedBox_default, {
3490
+ marginTop: 1,
3491
+ children: /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Select, {
3492
+ options: deleteOptions,
3493
+ onChange: (value) => {
3494
+ if (value === "yes") {
3495
+ handleAgentDeleted(modeState.agent);
3496
+ } else {
3497
+ if ("previousMode" in modeState) {
3498
+ setModeState(modeState.previousMode);
3499
+ }
3500
+ }
3501
+ },
3502
+ onCancel: () => {
3503
+ if ("previousMode" in modeState) {
3504
+ setModeState(modeState.previousMode);
3505
+ }
3506
+ }
3507
+ }, undefined, false, undefined, this)
3508
+ }, undefined, false, undefined, this)
3509
+ ]
3510
+ }, undefined, true, undefined, this),
3511
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(AgentNavigationFooter, {
3512
+ instructions: "Press \u2191\u2193 to navigate, Enter to select, Esc to cancel"
3513
+ }, undefined, false, undefined, this)
3514
+ ]
3515
+ }, undefined, true, undefined, this);
3516
+ }
3517
+ case "edit-agent": {
3518
+ const freshAgent = allAgents.find((a) => a.agentType === modeState.agent.agentType && a.source === modeState.agent.source);
3519
+ const agentToEdit = freshAgent || modeState.agent;
3520
+ return /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(jsx_dev_runtime24.Fragment, {
3521
+ children: [
3522
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Dialog, {
3523
+ title: `Edit agent: ${agentToEdit.agentType}`,
3524
+ onCancel: () => setModeState(modeState.previousMode),
3525
+ hideInputGuide: true,
3526
+ children: /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(AgentEditor, {
3527
+ agent: agentToEdit,
3528
+ tools: mergedTools,
3529
+ onSaved: (message) => {
3530
+ handleAgentCreated(message);
3531
+ setModeState(modeState.previousMode);
3532
+ },
3533
+ onBack: () => setModeState(modeState.previousMode)
3534
+ }, undefined, false, undefined, this)
3535
+ }, undefined, false, undefined, this),
3536
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(AgentNavigationFooter, {}, undefined, false, undefined, this)
3537
+ ]
3538
+ }, undefined, true, undefined, this);
3539
+ }
3540
+ default:
3541
+ return null;
3542
+ }
3543
+ }
3544
+ var import_react11, jsx_dev_runtime24;
3545
+ var init_AgentsMenu = __esm(() => {
3546
+ init_source();
3547
+ init_useExitOnCtrlCDWithKeybindings();
3548
+ init_useMergedTools();
3549
+ init_src();
3550
+ init_AppState();
3551
+ init_agentDisplay();
3552
+ init_loadAgentsDir();
3553
+ init_errors();
3554
+ init_log();
3555
+ init_select();
3556
+ init_src();
3557
+ init_AgentDetail();
3558
+ init_AgentEditor();
3559
+ init_AgentNavigationFooter();
3560
+ init_AgentsList();
3561
+ init_agentFileUtils();
3562
+ init_CreateAgentWizard();
3563
+ import_react11 = __toESM(require_react(), 1);
3564
+ jsx_dev_runtime24 = __toESM(require_jsx_dev_runtime(), 1);
3565
+ });
3566
+
3567
+ // src/commands/agents/agents.tsx
3568
+ async function call(onDone, context) {
3569
+ const appState = context.getAppState();
3570
+ const permissionContext = appState.toolPermissionContext;
3571
+ const tools = getTools(permissionContext);
3572
+ return /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(AgentsMenu, {
3573
+ tools,
3574
+ onExit: onDone
3575
+ }, undefined, false, undefined, this);
3576
+ }
3577
+ var jsx_dev_runtime25;
3578
+ var init_agents = __esm(() => {
3579
+ init_AgentsMenu();
3580
+ init_tools();
3581
+ jsx_dev_runtime25 = __toESM(require_jsx_dev_runtime(), 1);
3582
+ });
3583
+ init_agents();
3584
+
3585
+ export {
3586
+ call
3587
+ };