@jdi-code/claude-code 1.0.3 → 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 (539) hide show
  1. package/README.md +104 -369
  2. package/dist/{chunk-4t7n5hfg.js → chunk-0318ehfm.js} +8 -8
  3. package/dist/chunk-050fe4m3.js +68 -0
  4. package/dist/chunk-06v69x0b.js +127 -0
  5. package/dist/chunk-07069jq1.js +30 -0
  6. package/dist/chunk-0c9xpqm8.js +106 -0
  7. package/dist/chunk-0hxxwcs1.js +107 -0
  8. package/dist/chunk-0nsb3kxz.js +440 -0
  9. package/dist/{chunk-1cbn5kxf.js → chunk-0rpb2bdp.js} +3 -2
  10. package/dist/{chunk-vykgfhrb.js → chunk-0svbkpfn.js} +5 -5
  11. package/dist/chunk-0vg07894.js +121 -0
  12. package/dist/{chunk-e4vsvf0r.js → chunk-0zefjhrg.js} +4 -4
  13. package/dist/chunk-0zfmj5y2.js +106 -0
  14. package/dist/{chunk-czkshaff.js → chunk-107p04a0.js} +13 -11
  15. package/dist/{chunk-z4dm354d.js → chunk-13f30tg0.js} +1 -1
  16. package/dist/{chunk-44fpr6jq.js → chunk-168xb8v1.js} +4 -2
  17. package/dist/{chunk-0w63x62y.js → chunk-181q7ysj.js} +79 -63
  18. package/dist/{chunk-6mapphaq.js → chunk-18jc5efa.js} +8 -8
  19. package/dist/chunk-19j7nkpy.js +133 -0
  20. package/dist/chunk-1c2qp0ks.js +33068 -0
  21. package/dist/{chunk-0e1xsncc.js → chunk-1cwdhk7a.js} +1 -1
  22. package/dist/{chunk-7m2nd8da.js → chunk-1erfksyp.js} +6 -9
  23. package/dist/{chunk-rs45skes.js → chunk-1h1tc4mw.js} +13 -10
  24. package/dist/{chunk-91rcbmch.js → chunk-1rngm3yy.js} +155 -184
  25. package/dist/{chunk-3gqdqmzb.js → chunk-1vthytca.js} +16 -12
  26. package/dist/{chunk-xe6z85xc.js → chunk-1xbs4yb6.js} +19 -16
  27. package/dist/chunk-1xj1yz5n.js +109 -0
  28. package/dist/chunk-21mfpnva.js +85 -0
  29. package/dist/chunk-2361j94t.js +1811 -0
  30. package/dist/chunk-238g70xa.js +1 -1
  31. package/dist/chunk-250f5ce1.js +108 -0
  32. package/dist/{chunk-8yx1trkj.js → chunk-29r4exv2.js} +105 -211
  33. package/dist/chunk-2a8yf5ct.js +72 -0
  34. package/dist/{chunk-h3fqb66h.js → chunk-2bnerkhs.js} +110 -135
  35. package/dist/{chunk-0nt9md2b.js → chunk-2cctz9ww.js} +101 -8
  36. package/dist/chunk-2fwze72g.js +24 -0
  37. package/dist/{chunk-h3qa8f5w.js → chunk-2jvpw0q1.js} +229 -363
  38. package/dist/{chunk-9wm5e9e9.js → chunk-2mj88mnr.js} +42 -31
  39. package/dist/chunk-2q0schcc.js +133 -0
  40. package/dist/{chunk-r66hz8j6.js → chunk-2qp2hc02.js} +14 -12
  41. package/dist/chunk-2t0xa4dt.js +145 -0
  42. package/dist/chunk-2tzxsnha.js +360 -0
  43. package/dist/chunk-2v8cya3p.js +54 -0
  44. package/dist/chunk-2w00z1ct.js +105 -0
  45. package/dist/{chunk-2md1yavs.js → chunk-2wpfdv2t.js} +43 -32
  46. package/dist/chunk-2xcr3eqt.js +65 -0
  47. package/dist/chunk-30bpz5m2.js +34 -0
  48. package/dist/{chunk-hrzerbfw.js → chunk-36b2q5fg.js} +14 -14
  49. package/dist/{chunk-edg1yhec.js → chunk-3aady5e2.js} +2 -2
  50. package/dist/chunk-3ewzhjyb.js +207 -0
  51. package/dist/{chunk-z47tm067.js → chunk-3kpptrnz.js} +54 -47
  52. package/dist/{chunk-yd3av9a3.js → chunk-3na967x3.js} +2 -2
  53. package/dist/chunk-3nk79af8.js +8 -0
  54. package/dist/{chunk-z0cm9r7f.js → chunk-3r66czp1.js} +10 -10
  55. package/dist/{chunk-rnjbczcy.js → chunk-3y3qasy6.js} +13 -11
  56. package/dist/{chunk-nxsh6de2.js → chunk-404qm8xt.js} +16 -12
  57. package/dist/{chunk-mhqthgdg.js → chunk-41grdp0q.js} +5 -5
  58. package/dist/chunk-4cp6193g.js +9076 -0
  59. package/dist/chunk-4g18phg9.js +2535 -0
  60. package/dist/{chunk-6n2qgm9v.js → chunk-4hv90qcz.js} +1 -1
  61. package/dist/chunk-4jkfzf6g.js +81 -0
  62. package/dist/{chunk-5frcqxsv.js → chunk-4m6k7588.js} +127117 -138842
  63. package/dist/chunk-4nspekjp.js +69 -0
  64. package/dist/chunk-4x29t96w.js +119 -0
  65. package/dist/{chunk-40b8p5em.js → chunk-585cb3h6.js} +14 -12
  66. package/dist/{chunk-5dbar61y.js → chunk-59qz55py.js} +77 -61
  67. package/dist/chunk-5bta6qne.js +1030 -0
  68. package/dist/chunk-5dmczs66.js +123 -0
  69. package/dist/{chunk-9e2kqv5g.js → chunk-5pevjsyw.js} +3 -10
  70. package/dist/{chunk-5ndexvh1.js → chunk-5py41v61.js} +10226 -16961
  71. package/dist/{chunk-d5e75scx.js → chunk-5q2gm8dt.js} +5 -5
  72. package/dist/{chunk-893mewv4.js → chunk-5rpyh7nn.js} +1 -1
  73. package/dist/{chunk-hx2tr4ep.js → chunk-5z28bqne.js} +34 -475
  74. package/dist/chunk-5zzwydag.js +1170 -0
  75. package/dist/{chunk-4tyxyfsv.js → chunk-61gm3j90.js} +2 -2
  76. package/dist/chunk-64c1avct.js +13 -0
  77. package/dist/chunk-64hks9ax.js +456 -0
  78. package/dist/{chunk-bw9a5v0b.js → chunk-64m7ax9d.js} +4 -4
  79. package/dist/{chunk-cha1tdry.js → chunk-66hjztcb.js} +1 -1
  80. package/dist/{chunk-q25bjaev.js → chunk-677as3nh.js} +2 -2
  81. package/dist/chunk-69v14ada.js +76 -0
  82. package/dist/chunk-6eahnbxj.js +101 -0
  83. package/dist/chunk-6eg4c33n.js +196 -0
  84. package/dist/chunk-6fjfwj7q.js +214 -0
  85. package/dist/{chunk-70qb5sds.js → chunk-6kwwke3r.js} +2 -2
  86. package/dist/chunk-6m0pc6py.js +311 -0
  87. package/dist/chunk-6mpw9h55.js +1071 -0
  88. package/dist/{chunk-v1mgv1et.js → chunk-6p4cyhb3.js} +4 -3
  89. package/dist/chunk-6r1dx518.js +111 -0
  90. package/dist/{chunk-1n1xqxv5.js → chunk-713bh4cd.js} +1072 -1736
  91. package/dist/{chunk-nstbdz07.js → chunk-7246q965.js} +85 -69
  92. package/dist/{chunk-w6q6a1qj.js → chunk-74mdk2e7.js} +564 -864
  93. package/dist/{chunk-77czbpcq.js → chunk-76pa90ge.js} +104 -90
  94. package/dist/chunk-77nkh0x1.js +82 -0
  95. package/dist/chunk-7bsbnzpm.js +65 -0
  96. package/dist/chunk-7r3v46aq.js +167 -0
  97. package/dist/chunk-7vf8s593.js +235 -0
  98. package/dist/chunk-7x6ng8fp.js +64 -0
  99. package/dist/chunk-7xy990yb.js +81 -0
  100. package/dist/chunk-7xyswgjh.js +8 -0
  101. package/dist/chunk-80p18mf8.js +228 -0
  102. package/dist/{chunk-dv1wfr85.js → chunk-8225arm6.js} +5 -4
  103. package/dist/{chunk-vdbes184.js → chunk-82rh5hpz.js} +70 -10
  104. package/dist/chunk-84nf3k34.js +73 -0
  105. package/dist/chunk-85v0yx5b.js +106 -0
  106. package/dist/{chunk-x5j50p5x.js → chunk-86f4vq6n.js} +5 -5
  107. package/dist/{chunk-e5ga3s0y.js → chunk-86vec0h6.js} +148 -421
  108. package/dist/chunk-8az1n4zt.js +110 -0
  109. package/dist/{chunk-ctw5jwcd.js → chunk-8bwqtasa.js} +10 -10
  110. package/dist/chunk-8c9jtmsm.js +100 -0
  111. package/dist/{chunk-fqc5mcw7.js → chunk-8ca80ew2.js} +9 -9
  112. package/dist/chunk-8g5pe1gr.js +37 -0
  113. package/dist/{chunk-g0j0t6qk.js → chunk-8g747a8x.js} +1 -1
  114. package/dist/{chunk-3vzs2gbq.js → chunk-8gxztyqd.js} +4 -4
  115. package/dist/{chunk-45kxdsp8.js → chunk-8h6sdj66.js} +13 -10
  116. package/dist/{chunk-s8amjdwf.js → chunk-8ht15c7w.js} +7 -7
  117. package/dist/{chunk-ywxd4qw4.js → chunk-8mm8b6dd.js} +2 -5
  118. package/dist/{chunk-sdj9b9wh.js → chunk-8pn8tvgg.js} +9 -154
  119. package/dist/{chunk-pxrffn0w.js → chunk-8vnxjgz9.js} +11 -5
  120. package/dist/chunk-9525p9tg.js +401 -0
  121. package/dist/{chunk-y47cg3kz.js → chunk-9a0rsdre.js} +17 -13
  122. package/dist/chunk-9a2pa53f.js +308 -0
  123. package/dist/chunk-9es2dav7.js +507 -0
  124. package/dist/chunk-9pq45ycx.js +217 -0
  125. package/dist/chunk-9qwkw406.js +121 -0
  126. package/dist/chunk-9rf1x0z9.js +109 -0
  127. package/dist/{chunk-ghmbr193.js → chunk-9rvqx05m.js} +9 -9
  128. package/dist/{chunk-dchkdhzs.js → chunk-9sd3tz3p.js} +91 -75
  129. package/dist/chunk-9x5zgy22.js +12 -0
  130. package/dist/{chunk-q6b51yc5.js → chunk-9z4vq44b.js} +3 -3
  131. package/dist/chunk-a136cvvz.js +27 -0
  132. package/dist/{chunk-8hq5kk3y.js → chunk-a4twdmhf.js} +3 -2
  133. package/dist/{chunk-d18z9pna.js → chunk-a7rhvq9b.js} +2 -2
  134. package/dist/{chunk-pmjqdasm.js → chunk-a8jbqb9f.js} +2313 -4199
  135. package/dist/chunk-a9xhsth1.js +1068 -0
  136. package/dist/{chunk-kd63fbhw.js → chunk-achjqrhd.js} +81 -65
  137. package/dist/{chunk-67kbbt9h.js → chunk-af2vfhm4.js} +42 -31
  138. package/dist/{chunk-js8rvgs1.js → chunk-ahn9tgz7.js} +3 -3
  139. package/dist/chunk-ajets2e9.js +103 -0
  140. package/dist/chunk-akxywws0.js +79 -0
  141. package/dist/{chunk-meefz2g4.js → chunk-aqvgkvsq.js} +7 -7
  142. package/dist/{chunk-r6b58y3x.js → chunk-ase86y73.js} +1 -3
  143. package/dist/{chunk-hjhc4cpt.js → chunk-awb4vc41.js} +2 -2
  144. package/dist/{chunk-1jrcb7cs.js → chunk-b0mt3wzx.js} +37 -82
  145. package/dist/chunk-b4zy6y92.js +105 -0
  146. package/dist/{chunk-ax83mpvw.js → chunk-b65yxs9e.js} +26 -26
  147. package/dist/{chunk-wzx6mmft.js → chunk-b7b39zx2.js} +120 -118
  148. package/dist/{chunk-8bedvdm1.js → chunk-b81hd3m6.js} +1 -1
  149. package/dist/chunk-bbr7mwpv.js +117 -0
  150. package/dist/{chunk-1a61g8t2.js → chunk-bdzqt6gy.js} +83 -64
  151. package/dist/chunk-bkm0zms8.js +110 -0
  152. package/dist/{chunk-0vvej174.js → chunk-bs8r4665.js} +5 -5
  153. package/dist/{chunk-xvc4gp3x.js → chunk-bszdmr4k.js} +24 -24
  154. package/dist/{chunk-8ngxagxq.js → chunk-bt64sq5y.js} +4 -3
  155. package/dist/chunk-bvcpr8qa.js +909 -0
  156. package/dist/chunk-bx811wk6.js +118 -0
  157. package/dist/{chunk-3be7ka25.js → chunk-bxcfz5gy.js} +1 -1
  158. package/dist/{chunk-77g09znh.js → chunk-byv2p9hn.js} +22 -16
  159. package/dist/{chunk-wbkahkdc.js → chunk-c03am3es.js} +8 -6
  160. package/dist/chunk-c1x69s30.js +116 -0
  161. package/dist/chunk-c5vkve4j.js +68 -0
  162. package/dist/chunk-c6sjhj89.js +1284 -0
  163. package/dist/chunk-cb0wxajw.js +142 -0
  164. package/dist/{chunk-vyc0rjyx.js → chunk-cbrt5vsb.js} +1 -1
  165. package/dist/{chunk-4kxr1pwz.js → chunk-cgmy7r62.js} +30 -17
  166. package/dist/chunk-chsyvavm.js +3435 -0
  167. package/dist/{chunk-z72st5c8.js → chunk-cmsknj6n.js} +4774 -3386
  168. package/dist/{chunk-cdz5yb0r.js → chunk-crmjpsqe.js} +13 -2
  169. package/dist/chunk-cs039fnj.js +123 -0
  170. package/dist/{chunk-e7393td6.js → chunk-cznf6k4g.js} +13 -9
  171. package/dist/{chunk-fw49pe3p.js → chunk-cztjpxq4.js} +6 -6
  172. package/dist/{chunk-n8sjmqba.js → chunk-d0n93ge4.js} +141 -100
  173. package/dist/{chunk-spde0bf5.js → chunk-d14ygn80.js} +3 -3
  174. package/dist/chunk-d4mdda98.js +94 -0
  175. package/dist/chunk-d5qggsbm.js +137 -0
  176. package/dist/{chunk-55wgxwa9.js → chunk-d7886r6a.js} +6928 -6935
  177. package/dist/{chunk-eh8h36nt.js → chunk-d9gxtzmz.js} +42 -31
  178. package/dist/{chunk-xk66xrkk.js → chunk-da312cj9.js} +54 -72
  179. package/dist/{chunk-j287ctwr.js → chunk-df19zqjj.js} +77 -61
  180. package/dist/chunk-dm3n2qgd.js +24 -0
  181. package/dist/{chunk-m21hvkn4.js → chunk-dncgrfdt.js} +2 -2
  182. package/dist/{chunk-0nz8sqg4.js → chunk-dq3rw4b5.js} +1294 -873
  183. package/dist/{chunk-ey03t39w.js → chunk-dw1f4b7e.js} +257 -194
  184. package/dist/chunk-dx1jrvdz.js +339 -0
  185. package/dist/{chunk-0ragr30c.js → chunk-dxeadbxq.js} +12 -12
  186. package/dist/{chunk-gdp8wgnd.js → chunk-e8b9gcwf.js} +88 -72
  187. package/dist/chunk-e9k5a3cy.js +409 -0
  188. package/dist/chunk-e9mer45h.js +64 -0
  189. package/dist/{chunk-5qbwrz8m.js → chunk-ea2f7wt3.js} +13 -13
  190. package/dist/chunk-eak7m65m.js +1182 -0
  191. package/dist/chunk-ebhgmeyk.js +245 -0
  192. package/dist/chunk-eg93k7ac.js +117 -0
  193. package/dist/{chunk-jgv78tv0.js → chunk-ej1yvp43.js} +8 -8
  194. package/dist/chunk-ekr8pwpv.js +1408 -0
  195. package/dist/{chunk-m4edbpcz.js → chunk-epg124e3.js} +117 -143
  196. package/dist/chunk-eyqnj23w.js +5368 -0
  197. package/dist/chunk-f2bvkxbw.js +267 -0
  198. package/dist/chunk-f537x96t.js +295 -0
  199. package/dist/chunk-f6wdmebb.js +108 -0
  200. package/dist/chunk-feyzykye.js +10 -0
  201. package/dist/{chunk-ep47dy22.js → chunk-fj3ywwqv.js} +7 -7
  202. package/dist/{chunk-9gttd1xq.js → chunk-fjv7p1kc.js} +4 -4
  203. package/dist/{chunk-1rnkpxy4.js → chunk-fpe5nywt.js} +10 -115
  204. package/dist/chunk-fvpgrg19.js +434 -0
  205. package/dist/{chunk-9xmsmn93.js → chunk-fvqrkmtn.js} +5 -5
  206. package/dist/{chunk-6g62sjpf.js → chunk-fz0ch109.js} +4 -3
  207. package/dist/{chunk-5xz7ts0k.js → chunk-g0vh71q6.js} +188 -339
  208. package/dist/chunk-g1gtvtv8.js +384 -0
  209. package/dist/chunk-g5g9wm20.js +66 -0
  210. package/dist/{chunk-v399mzxk.js → chunk-g63tgj4f.js} +2 -2
  211. package/dist/{chunk-kkkneeg1.js → chunk-gay98970.js} +21 -16
  212. package/dist/chunk-gey7mwcw.js +36 -0
  213. package/dist/{chunk-w5ctjgmx.js → chunk-gtyh1yd1.js} +2 -2
  214. package/dist/{chunk-tjaqa99q.js → chunk-gx8016vp.js} +3 -3
  215. package/dist/{chunk-f2mhrmww.js → chunk-h0rbjg6x.js} +1 -8
  216. package/dist/{chunk-7z8j9qfn.js → chunk-h1mr3371.js} +3 -3
  217. package/dist/chunk-h2yxyeq4.js +132 -0
  218. package/dist/{chunk-qqfa0dqg.js → chunk-h4b85amj.js} +20 -32
  219. package/dist/chunk-h707k8xq.js +64 -0
  220. package/dist/{chunk-3z6rf0m3.js → chunk-h7rcjx8d.js} +5 -5
  221. package/dist/chunk-hch5yeq8.js +121 -0
  222. package/dist/{chunk-4anyx5bv.js → chunk-hd4azb7x.js} +5 -5
  223. package/dist/chunk-hjnbg9qw.js +32 -0
  224. package/dist/{chunk-e2yv57c2.js → chunk-hk9mmkba.js} +8 -8
  225. package/dist/{chunk-f1rrxxcf.js → chunk-hs9w0p45.js} +7 -131
  226. package/dist/{chunk-9f7xza5r.js → chunk-htaan7k0.js} +11 -11
  227. package/dist/chunk-htg84hvs.js +300 -0
  228. package/dist/chunk-hvyr6p4r.js +433 -0
  229. package/dist/chunk-j0r5vkvw.js +267 -0
  230. package/dist/{chunk-9gbamk79.js → chunk-j5bth84e.js} +5 -1
  231. package/dist/{chunk-vratq94g.js → chunk-j9gxwbe3.js} +1 -1
  232. package/dist/{chunk-3r24h7t6.js → chunk-jaaxk89e.js} +1 -1
  233. package/dist/chunk-je7jake4.js +3584 -0
  234. package/dist/chunk-jeqhpyxr.js +126 -0
  235. package/dist/chunk-jngf0nar.js +135 -0
  236. package/dist/chunk-jqjbc5ef.js +795 -0
  237. package/dist/{chunk-xf4wsjdm.js → chunk-jwrmmv7j.js} +9 -7
  238. package/dist/{chunk-j9wpkwjj.js → chunk-jwyzy83k.js} +6 -6
  239. package/dist/chunk-jz8v9sn3.js +228 -0
  240. package/dist/{chunk-bqfnp99q.js → chunk-k3s4yk22.js} +1 -1
  241. package/dist/chunk-k5c09bzv.js +443 -0
  242. package/dist/chunk-kbktwsms.js +372 -0
  243. package/dist/chunk-ke0hn0xr.js +260 -0
  244. package/dist/chunk-kehe7a71.js +41 -0
  245. package/dist/{chunk-1xkekb9y.js → chunk-kfd89dsd.js} +5 -3
  246. package/dist/chunk-ktjjb0k9.js +104 -0
  247. package/dist/{chunk-b74ht3xj.js → chunk-kxgcshx1.js} +78 -62
  248. package/dist/chunk-kz2fpejx.js +651 -0
  249. package/dist/{chunk-zvbpaaa1.js → chunk-kz3ctzg3.js} +110 -115
  250. package/dist/{chunk-72p24c9k.js → chunk-m268mm4c.js} +127 -188
  251. package/dist/{chunk-jafes477.js → chunk-m2bcpk8j.js} +4 -3
  252. package/dist/{chunk-4qv4z794.js → chunk-m32mdkts.js} +42 -31
  253. package/dist/chunk-m74w3187.js +164 -0
  254. package/dist/chunk-m7s7j422.js +166 -0
  255. package/dist/chunk-majhpxx5.js +594 -0
  256. package/dist/{chunk-q6av622g.js → chunk-mdk3xgya.js} +17 -13
  257. package/dist/{chunk-8bw3ft0x.js → chunk-mfcbez9a.js} +4 -4
  258. package/dist/{chunk-df6bwb4a.js → chunk-mj6w3ttg.js} +2 -2
  259. package/dist/{chunk-drrw55jr.js → chunk-mk6kj3q2.js} +1336 -2840
  260. package/dist/{chunk-vqr58rfh.js → chunk-mky388t4.js} +27 -67
  261. package/dist/chunk-mn61mk4v.js +351 -0
  262. package/dist/chunk-mx28h61f.js +1147 -0
  263. package/dist/chunk-my57sgky.js +883 -0
  264. package/dist/{chunk-k48thqgp.js → chunk-myk8saf6.js} +95 -190
  265. package/dist/chunk-n2zdmx4g.js +66 -0
  266. package/dist/{chunk-720qpv6d.js → chunk-n833arxq.js} +79 -63
  267. package/dist/{chunk-w2z5pqd3.js → chunk-n9ktjngj.js} +6 -6
  268. package/dist/{chunk-2tw2ve8h.js → chunk-nb2ntesh.js} +14 -10
  269. package/dist/{chunk-y18mc4m4.js → chunk-nbqv8ref.js} +10 -10
  270. package/dist/{chunk-74v9z7z4.js → chunk-nd4rncgd.js} +3 -13
  271. package/dist/chunk-nda50ze4.js +341 -0
  272. package/dist/{chunk-gb2q3nvc.js → chunk-nea2sah6.js} +5 -5
  273. package/dist/{chunk-t36rb2a8.js → chunk-nefsxetf.js} +294 -500
  274. package/dist/chunk-netzwgv1.js +154 -0
  275. package/dist/chunk-nfk9e540.js +107 -0
  276. package/dist/{chunk-xszk7n10.js → chunk-nh3cd07f.js} +1 -1
  277. package/dist/chunk-njq2hmjy.js +270 -0
  278. package/dist/chunk-nn5j7h8a.js +156 -0
  279. package/dist/{chunk-6fjab2dp.js → chunk-nrvkwzmq.js} +2 -2
  280. package/dist/chunk-nsextsmp.js +360 -0
  281. package/dist/{chunk-amhzxqj4.js → chunk-nt90fta7.js} +5 -5
  282. package/dist/{chunk-qbx1rq4f.js → chunk-p6sqbnqb.js} +193 -327
  283. package/dist/chunk-p8c23zr7.js +61 -0
  284. package/dist/chunk-p8enbwjk.js +183 -0
  285. package/dist/chunk-p8yggvgf.js +436 -0
  286. package/dist/{chunk-96awg5tc.js → chunk-pcfhe19b.js} +80 -17
  287. package/dist/{chunk-sfq65q9w.js → chunk-pgv9sa3a.js} +10 -14
  288. package/dist/chunk-ppwjyveh.js +8 -0
  289. package/dist/chunk-ppxvfp6m.js +424 -0
  290. package/dist/{chunk-zsfxha74.js → chunk-pshjyzq4.js} +8 -7
  291. package/dist/{chunk-35x3tjnr.js → chunk-pwr83fyy.js} +14 -8
  292. package/dist/chunk-q1976kze.js +473 -0
  293. package/dist/chunk-q387p8pp.js +943 -0
  294. package/dist/{chunk-b6av9ny9.js → chunk-q3ffkhnp.js} +132 -20
  295. package/dist/{chunk-w7wgpqcp.js → chunk-q50q8mc5.js} +7 -7
  296. package/dist/{chunk-e5pntxye.js → chunk-q7tpyeb3.js} +6 -4
  297. package/dist/{chunk-7ymfj7m3.js → chunk-q82r31er.js} +1 -1
  298. package/dist/chunk-qajrkk97.js +298 -0
  299. package/dist/chunk-qdazcrd7.js +362 -0
  300. package/dist/chunk-qhwvhgty.js +61 -0
  301. package/dist/{chunk-455a8z6g.js → chunk-qqk0kvsw.js} +138 -98
  302. package/dist/chunk-qqya1xyt.js +513 -0
  303. package/dist/{chunk-mzdwvbb0.js → chunk-qs6wypj1.js} +2 -2
  304. package/dist/chunk-qtahf5s5.js +113 -0
  305. package/dist/{chunk-tj79kfmn.js → chunk-qv9phqbv.js} +7 -7
  306. package/dist/{chunk-r5k04v8g.js → chunk-qyygv221.js} +13 -9
  307. package/dist/{chunk-zfc67eqj.js → chunk-r34f6vwc.js} +4 -4
  308. package/dist/{chunk-nerv0jvx.js → chunk-r59rgjxq.js} +1 -1
  309. package/dist/{chunk-7sb5axvf.js → chunk-r7j395t6.js} +2 -2
  310. package/dist/chunk-rb31sqzm.js +106 -0
  311. package/dist/{chunk-twsxz9ph.js → chunk-rbwy1qmm.js} +42 -31
  312. package/dist/{chunk-99t8enmg.js → chunk-re3crc6t.js} +10 -7
  313. package/dist/chunk-rhw4ayb1.js +6851 -0
  314. package/dist/{chunk-h6wtwdk0.js → chunk-rm31ynek.js} +8 -8
  315. package/dist/{chunk-eqrh0yjm.js → chunk-rr4e4axp.js} +2 -2
  316. package/dist/{chunk-neh2frnn.js → chunk-rs8304k5.js} +6 -6
  317. package/dist/{chunk-gax0fcbx.js → chunk-s1s8qfdh.js} +5 -5
  318. package/dist/{chunk-src9fqj8.js → chunk-s2483y2h.js} +3 -3
  319. package/dist/chunk-s2nhzjmt.js +113 -0
  320. package/dist/{chunk-7jma9mhn.js → chunk-sfhws681.js} +77 -61
  321. package/dist/{chunk-e3g8q4cn.js → chunk-sg66v252.js} +10 -8
  322. package/dist/{chunk-vp25xhav.js → chunk-szyt0xvf.js} +69 -78
  323. package/dist/{chunk-v7455ztd.js → chunk-t7j91et3.js} +86 -67
  324. package/dist/{chunk-mt25echc.js → chunk-tezak8rx.js} +1 -1
  325. package/dist/chunk-tf1p9trz.js +190 -0
  326. package/dist/{chunk-05gxvwvf.js → chunk-tm82sqkr.js} +96 -79
  327. package/dist/chunk-tpjetyb0.js +106 -0
  328. package/dist/chunk-trxvrrac.js +149 -0
  329. package/dist/chunk-tv9pcdnz.js +51 -0
  330. package/dist/{chunk-e5tfw9f7.js → chunk-twh7pzm8.js} +248 -307
  331. package/dist/{chunk-1x2wb3tc.js → chunk-txfvkh0w.js} +8 -8
  332. package/dist/chunk-var1et7e.js +66 -0
  333. package/dist/{chunk-se7v9emp.js → chunk-vbhvx4ma.js} +12 -10
  334. package/dist/{chunk-hqmz36b3.js → chunk-vf612n57.js} +21 -101
  335. package/dist/{chunk-3sdp7ds7.js → chunk-vfcty2ga.js} +10 -10
  336. package/dist/chunk-vhhyv8z8.js +147 -0
  337. package/dist/{chunk-48z7dgy1.js → chunk-vjcxs86z.js} +3 -3
  338. package/dist/{chunk-k5bpc8d5.js → chunk-vmnf3h9c.js} +43 -32
  339. package/dist/{chunk-fpjeh2em.js → chunk-vr7wmmyn.js} +17 -13
  340. package/dist/{chunk-9ewmqkgb.js → chunk-vxp2mhqy.js} +8 -8
  341. package/dist/{chunk-d238zp4m.js → chunk-w4gwnrwa.js} +2 -2
  342. package/dist/{chunk-jhsywyw8.js → chunk-wahkzh83.js} +9 -9
  343. package/dist/chunk-wdd4en5q.js +117 -0
  344. package/dist/{chunk-gm2m2yba.js → chunk-wgfnd174.js} +43 -32
  345. package/dist/chunk-wk1jw4dm.js +139 -0
  346. package/dist/chunk-wnpjc8hg.js +1018 -0
  347. package/dist/chunk-wv1t041q.js +151 -0
  348. package/dist/chunk-wvtmrmaj.js +130 -0
  349. package/dist/chunk-wyavftcj.js +103 -0
  350. package/dist/{chunk-4589pec2.js → chunk-x2dp18yj.js} +18 -46
  351. package/dist/{chunk-fj4hkg6k.js → chunk-x474ybns.js} +79 -110
  352. package/dist/chunk-x67cvhb8.js +134 -0
  353. package/dist/chunk-x6r4v44b.js +8 -0
  354. package/dist/{chunk-s0xfxkys.js → chunk-xk9pxqqx.js} +6 -6
  355. package/dist/{chunk-m06q12hg.js → chunk-xkt36p6r.js} +1 -1
  356. package/dist/{chunk-g653q217.js → chunk-xnav6j8h.js} +62 -374
  357. package/dist/chunk-xrjb0zyc.js +146 -0
  358. package/dist/chunk-xv3era3s.js +8 -0
  359. package/dist/{chunk-p7g7pf3f.js → chunk-y3r7v9pq.js} +4 -4
  360. package/dist/{chunk-3sagmdbp.js → chunk-y4szkj7r.js} +80 -64
  361. package/dist/{chunk-7d2700y8.js → chunk-y8syxjw1.js} +24 -54
  362. package/dist/chunk-y98z50mm.js +158 -0
  363. package/dist/chunk-ycrfxq10.js +123 -0
  364. package/dist/{chunk-8440dz44.js → chunk-yfjzdc0q.js} +9 -9
  365. package/dist/{chunk-cejskpky.js → chunk-ygf7pmmr.js} +145 -153
  366. package/dist/chunk-yha3z3ab.js +259 -0
  367. package/dist/chunk-ym5r3jnk.js +2007 -0
  368. package/dist/{chunk-28r6z9br.js → chunk-ys2gtqb0.js} +1 -3
  369. package/dist/{chunk-rzgtgtaf.js → chunk-ytg2n0dd.js} +7 -7
  370. package/dist/{chunk-q5hb65kq.js → chunk-ytzw9kw1.js} +78 -62
  371. package/dist/chunk-yzx3mhfd.js +110 -0
  372. package/dist/chunk-z1bs6d7k.js +24 -0
  373. package/dist/{chunk-6h9zcxaa.js → chunk-z1mvcq39.js} +4 -4
  374. package/dist/{chunk-gbq6jz9a.js → chunk-z3qhctbk.js} +134 -170
  375. package/dist/chunk-z9jn3442.js +146 -0
  376. package/dist/{chunk-5q7c8vt9.js → chunk-zbsz51qa.js} +41 -32
  377. package/dist/{chunk-n1erf6kh.js → chunk-ze6zvkg6.js} +5 -5
  378. package/dist/{chunk-t0rgmccj.js → chunk-zejm280k.js} +1 -1
  379. package/dist/{chunk-gfkppe34.js → chunk-zf47p99b.js} +10 -10
  380. package/dist/{chunk-53nbpp47.js → chunk-zhtrjznv.js} +557 -1502
  381. package/dist/{chunk-das977za.js → chunk-zq6tz1zv.js} +61 -100
  382. package/dist/chunk-zrw9gm80.js +264 -0
  383. package/dist/chunk-zseb1639.js +37 -0
  384. package/dist/{chunk-spqaamnc.js → chunk-zsgha506.js} +2 -2
  385. package/dist/chunk-zst7b4sp.js +2840 -0
  386. package/dist/{chunk-0xn1zr3e.js → chunk-zxkzzpgd.js} +145 -121
  387. package/dist/{chunk-g3t0act8.js → chunk-zzm33q8x.js} +1 -1
  388. package/dist/cli.js +20 -117
  389. package/dist/download-ripgrep.js +24821 -0
  390. package/dist/vendor/audio-capture/arm64-darwin/audio-capture.node +0 -0
  391. package/dist/vendor/audio-capture/arm64-linux/audio-capture.node +0 -0
  392. package/dist/vendor/audio-capture/arm64-win32/audio-capture.node +0 -0
  393. package/dist/vendor/audio-capture/x64-darwin/audio-capture.node +0 -0
  394. package/dist/vendor/audio-capture/x64-linux/audio-capture.node +0 -0
  395. package/dist/vendor/audio-capture/x64-win32/audio-capture.node +0 -0
  396. package/package.json +22 -14
  397. package/scripts/download-ripgrep.ts +335 -0
  398. package/scripts/postinstall.cjs +319 -0
  399. package/dist/chunk-0gemty6d.js +0 -70
  400. package/dist/chunk-0pjw8y9z.js +0 -2833
  401. package/dist/chunk-1c8z1b5v.js +0 -16
  402. package/dist/chunk-1ebedmba.js +0 -90
  403. package/dist/chunk-1rvz0433.js +0 -722
  404. package/dist/chunk-1wfb8e3m.js +0 -107
  405. package/dist/chunk-2qjywwq4.js +0 -3445
  406. package/dist/chunk-2y659zbj.js +0 -103
  407. package/dist/chunk-41md7gny.js +0 -91
  408. package/dist/chunk-45m062tx.js +0 -2058
  409. package/dist/chunk-4br37gsw.js +0 -107
  410. package/dist/chunk-4nfrc6sq.js +0 -2431
  411. package/dist/chunk-4pdedeb4.js +0 -2644
  412. package/dist/chunk-4wzyhqbt.js +0 -444
  413. package/dist/chunk-4zsw4fhp.js +0 -67
  414. package/dist/chunk-52wv09zw.js +0 -102
  415. package/dist/chunk-55sfqnz4.js +0 -1921
  416. package/dist/chunk-5cd9cptq.js +0 -110
  417. package/dist/chunk-5dbk24zg.js +0 -890
  418. package/dist/chunk-5tfppbkq.js +0 -55
  419. package/dist/chunk-60xyrp86.js +0 -117
  420. package/dist/chunk-6deqb0mc.js +0 -376
  421. package/dist/chunk-6kpbgc5w.js +0 -23
  422. package/dist/chunk-6ndpfxcn.js +0 -222
  423. package/dist/chunk-7nvpa5ex.js +0 -123
  424. package/dist/chunk-7va8tw32.js +0 -128
  425. package/dist/chunk-7z3tkgec.js +0 -66
  426. package/dist/chunk-8e8set87.js +0 -281
  427. package/dist/chunk-8fg1egbv.js +0 -107
  428. package/dist/chunk-8thd6sgk.js +0 -106
  429. package/dist/chunk-8ytkb7k9.js +0 -84
  430. package/dist/chunk-9s5nkgsg.js +0 -699
  431. package/dist/chunk-9wce9hrc.js +0 -1015
  432. package/dist/chunk-9y91z69v.js +0 -44
  433. package/dist/chunk-ae76ded0.js +0 -30
  434. package/dist/chunk-b0eez8w0.js +0 -169
  435. package/dist/chunk-b57sb1dw.js +0 -642
  436. package/dist/chunk-bg3mt9bm.js +0 -28
  437. package/dist/chunk-bhdt6k7w.js +0 -15
  438. package/dist/chunk-bm1qb16p.js +0 -17
  439. package/dist/chunk-bsbmmfyt.js +0 -17
  440. package/dist/chunk-c7q12yes.js +0 -269
  441. package/dist/chunk-cv6y320h.js +0 -299
  442. package/dist/chunk-cvy3vntc.js +0 -65
  443. package/dist/chunk-cy2hswr1.js +0 -15
  444. package/dist/chunk-d5d398m4.js +0 -184
  445. package/dist/chunk-d7q4zp2z.js +0 -89
  446. package/dist/chunk-dnk519qv.js +0 -94
  447. package/dist/chunk-dqqde43e.js +0 -93
  448. package/dist/chunk-dy4ayw0p.js +0 -522
  449. package/dist/chunk-e4ak3jfc.js +0 -1154
  450. package/dist/chunk-e64spn53.js +0 -283
  451. package/dist/chunk-e8pk14j0.js +0 -527
  452. package/dist/chunk-eashsrsv.js +0 -88
  453. package/dist/chunk-eb90vwvr.js +0 -152
  454. package/dist/chunk-ese2g7hc.js +0 -92
  455. package/dist/chunk-et4jnyb5.js +0 -713
  456. package/dist/chunk-fdy0651p.js +0 -212
  457. package/dist/chunk-frsyts9j.js +0 -1170
  458. package/dist/chunk-ft2jssz4.js +0 -424
  459. package/dist/chunk-g41hzcy2.js +0 -101
  460. package/dist/chunk-g8dr8vvj.js +0 -111
  461. package/dist/chunk-gj71pd83.js +0 -5395
  462. package/dist/chunk-gjdwtdch.js +0 -154
  463. package/dist/chunk-gyj242zr.js +0 -20
  464. package/dist/chunk-hr719wjg.js +0 -144
  465. package/dist/chunk-hs8ph4p8.js +0 -8
  466. package/dist/chunk-j7gpr82p.js +0 -105
  467. package/dist/chunk-jczedp5x.js +0 -91
  468. package/dist/chunk-jd0t67a6.js +0 -259
  469. package/dist/chunk-jgyp3mzg.js +0 -1318
  470. package/dist/chunk-jq1kp9yy.js +0 -90
  471. package/dist/chunk-jskhn7bz.js +0 -71
  472. package/dist/chunk-k5aas9d3.js +0 -6108
  473. package/dist/chunk-k8jcy7mj.js +0 -48
  474. package/dist/chunk-ka22ccvm.js +0 -1581
  475. package/dist/chunk-ka6jav10.js +0 -91
  476. package/dist/chunk-kq6j096k.js +0 -538
  477. package/dist/chunk-kqd0e3xj.js +0 -463
  478. package/dist/chunk-kqjrsah4.js +0 -85
  479. package/dist/chunk-m390jta5.js +0 -114
  480. package/dist/chunk-m44a9yfj.js +0 -90
  481. package/dist/chunk-m5c8ng6v.js +0 -328
  482. package/dist/chunk-meag7bbe.js +0 -89
  483. package/dist/chunk-mnsrmwn8.js +0 -604
  484. package/dist/chunk-mzj4mtye.js +0 -115
  485. package/dist/chunk-mzy911jq.js +0 -128
  486. package/dist/chunk-n0fwapk6.js +0 -347
  487. package/dist/chunk-nt0mgsh6.js +0 -496
  488. package/dist/chunk-nwcfrws3.js +0 -273
  489. package/dist/chunk-pa2xksyb.js +0 -57
  490. package/dist/chunk-pnhs96g8.js +0 -140
  491. package/dist/chunk-ps4c75j7.js +0 -105
  492. package/dist/chunk-q0yg73za.js +0 -490
  493. package/dist/chunk-q5by3da6.js +0 -8
  494. package/dist/chunk-qbmhde47.js +0 -92
  495. package/dist/chunk-qp3dw7b4.js +0 -100
  496. package/dist/chunk-qt0b9x2w.js +0 -42
  497. package/dist/chunk-qxe98jgk.js +0 -584
  498. package/dist/chunk-r7n42k56.js +0 -756
  499. package/dist/chunk-radsjrmv.js +0 -55
  500. package/dist/chunk-rckj9gd1.js +0 -55
  501. package/dist/chunk-rn4kqfvd.js +0 -99
  502. package/dist/chunk-rngmdt2v.js +0 -97
  503. package/dist/chunk-rs5e0520.js +0 -87
  504. package/dist/chunk-s274nv8k.js +0 -8
  505. package/dist/chunk-s7t2e2tw.js +0 -1493
  506. package/dist/chunk-sbbt0ct3.js +0 -90
  507. package/dist/chunk-t0mnk0qp.js +0 -105
  508. package/dist/chunk-t1qmy36p.js +0 -94
  509. package/dist/chunk-tdy66rf9.js +0 -116
  510. package/dist/chunk-tf40vqky.js +0 -70
  511. package/dist/chunk-tmcxeatp.js +0 -116
  512. package/dist/chunk-v3gm2day.js +0 -8
  513. package/dist/chunk-v496te8v.js +0 -192
  514. package/dist/chunk-vd2hwk8d.js +0 -61
  515. package/dist/chunk-vdsmt7v0.js +0 -998
  516. package/dist/chunk-vf3qxte3.js +0 -93
  517. package/dist/chunk-vfqe1jqj.js +0 -643
  518. package/dist/chunk-vk3270s6.js +0 -119
  519. package/dist/chunk-vsr9mbnq.js +0 -195
  520. package/dist/chunk-w18zryr9.js +0 -348
  521. package/dist/chunk-wdxcgk6m.js +0 -196
  522. package/dist/chunk-wef07p3j.js +0 -131
  523. package/dist/chunk-wf4q1xj3.js +0 -62
  524. package/dist/chunk-wjq4zq3t.js +0 -162
  525. package/dist/chunk-wp4hc4n7.js +0 -133
  526. package/dist/chunk-x0rjttct.js +0 -420
  527. package/dist/chunk-xdw5dv00.js +0 -8
  528. package/dist/chunk-xm8fv5c9.js +0 -469
  529. package/dist/chunk-xq5ztz4g.js +0 -130
  530. package/dist/chunk-xvcdtezw.js +0 -401
  531. package/dist/chunk-y7njq3z3.js +0 -1866
  532. package/dist/chunk-ycxwftfh.js +0 -97
  533. package/dist/chunk-yn38f69a.js +0 -105
  534. package/dist/chunk-yp5kc8hq.js +0 -372
  535. package/dist/chunk-z09n2krq.js +0 -752
  536. package/dist/chunk-zerg8qwf.js +0 -96
  537. package/dist/{chunk-p452k1xp.js → chunk-57s5mr32.js} +9 -9
  538. package/dist/{chunk-27xc1csx.js → chunk-dggvswz1.js} +3 -3
  539. package/dist/{chunk-zxzwfa0b.js → chunk-pbyq1tm3.js} +3 -3
@@ -0,0 +1,3584 @@
1
+ // @bun
2
+ import {
3
+ AGENT_SOURCE_GROUPS,
4
+ compareAgentsByName,
5
+ getOverrideSourceLabel,
6
+ init_agentDisplay,
7
+ resolveAgentModelDisplay,
8
+ resolveAgentOverrides
9
+ } from "./chunk-nrvkwzmq.js";
10
+ import {
11
+ init_useMergedTools,
12
+ useMergedTools
13
+ } from "./chunk-mj6w3ttg.js";
14
+ import"./chunk-rr4e4axp.js";
15
+ import"./chunk-qs6wypj1.js";
16
+ import {
17
+ editFileInEditor,
18
+ editPromptInEditor,
19
+ init_promptEditor
20
+ } from "./chunk-yfjzdc0q.js";
21
+ import {
22
+ init_useMainLoopModel,
23
+ useMainLoopModel
24
+ } from "./chunk-hd4azb7x.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-4m6k7588.js";
110
+ import"./chunk-nea2sah6.js";
111
+ import"./chunk-rs8304k5.js";
112
+ import"./chunk-1c2qp0ks.js";
113
+ import"./chunk-9z4vq44b.js";
114
+ import"./chunk-zejm280k.js";
115
+ import"./chunk-4nspekjp.js";
116
+ import"./chunk-var1et7e.js";
117
+ import"./chunk-ehtwnxpg.js";
118
+ import"./chunk-akxywws0.js";
119
+ import"./chunk-zf47p99b.js";
120
+ import"./chunk-bxcfz5gy.js";
121
+ import"./chunk-1xbs4yb6.js";
122
+ import"./chunk-2gzv8nrw.js";
123
+ import"./chunk-8h6sdj66.js";
124
+ import"./chunk-cgfdkzhb.js";
125
+ import"./chunk-6eg4c33n.js";
126
+ import {
127
+ init_useExitOnCtrlCDWithKeybindings,
128
+ useExitOnCtrlCDWithKeybindings
129
+ } from "./chunk-2cctz9ww.js";
130
+ import"./chunk-j5bth84e.js";
131
+ import"./chunk-d0n93ge4.js";
132
+ import"./chunk-5pevjsyw.js";
133
+ import {
134
+ init_useKeybinding,
135
+ useKeybinding
136
+ } from "./chunk-xnav6j8h.js";
137
+ import"./chunk-ps49ymvj.js";
138
+ import {
139
+ TungstenTool,
140
+ init_TungstenTool
141
+ } from "./chunk-zk2wsm7d.js";
142
+ import"./chunk-2t0xa4dt.js";
143
+ import"./chunk-pwr83fyy.js";
144
+ import"./chunk-hjnbg9qw.js";
145
+ import"./chunk-zsgha506.js";
146
+ import"./chunk-4jm600zv.js";
147
+ import"./chunk-xkt36p6r.js";
148
+ import"./chunk-585cb3h6.js";
149
+ import"./chunk-xk9pxqqx.js";
150
+ import"./chunk-mx28h61f.js";
151
+ import"./chunk-bx811wk6.js";
152
+ import"./chunk-8vnxjgz9.js";
153
+ import"./chunk-2v8cya3p.js";
154
+ import"./chunk-eyqnj23w.js";
155
+ import"./chunk-chsyvavm.js";
156
+ import"./chunk-6mpw9h55.js";
157
+ import {
158
+ AGENT_TOOL_NAME,
159
+ capitalize,
160
+ getManagedFilePath,
161
+ getSettingSourceName,
162
+ init_constants,
163
+ init_constants1 as init_constants2,
164
+ init_managedPath,
165
+ init_mcpStringUtils,
166
+ init_paths,
167
+ init_stringUtils,
168
+ isAutoMemoryEnabled,
169
+ mcpInfoFromString,
170
+ plural
171
+ } from "./chunk-zhtrjznv.js";
172
+ import"./chunk-sg66v252.js";
173
+ import"./chunk-8bwqtasa.js";
174
+ import"./chunk-j9gxwbe3.js";
175
+ import"./chunk-cztjpxq4.js";
176
+ import {
177
+ count,
178
+ init_array
179
+ } from "./chunk-1cwdhk7a.js";
180
+ import"./chunk-64c1avct.js";
181
+ import"./chunk-8g5pe1gr.js";
182
+ import"./chunk-gx8016vp.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-r7j395t6.js";
189
+ import"./chunk-tv9pcdnz.js";
190
+ import"./chunk-3c25bcsw.js";
191
+ import"./chunk-n9ktjngj.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-64hks9ax.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
+ } from "./chunk-cmsknj6n.js";
212
+ import {
213
+ require_jsx_dev_runtime,
214
+ require_react
215
+ } from "./chunk-g338npwr.js";
216
+ import {
217
+ init_analytics,
218
+ logEvent
219
+ } from "./chunk-h0rbjg6x.js";
220
+ import"./chunk-0vkfrmqm.js";
221
+ import"./chunk-0xjaqda8.js";
222
+ import"./chunk-h1mr3371.js";
223
+ import"./chunk-36b2q5fg.js";
224
+ import"./chunk-a7rhvq9b.js";
225
+ import"./chunk-qnfx3qtx.js";
226
+ import"./chunk-m74w3187.js";
227
+ import {
228
+ getCwd,
229
+ init_cwd
230
+ } from "./chunk-b81hd3m6.js";
231
+ import {
232
+ init_log,
233
+ logError
234
+ } from "./chunk-y3r7v9pq.js";
235
+ import"./chunk-8tnsngw2.js";
236
+ import"./chunk-awb4vc41.js";
237
+ import"./chunk-cbrt5vsb.js";
238
+ import"./chunk-5z28bqne.js";
239
+ import {
240
+ figures_default,
241
+ init_figures
242
+ } from "./chunk-qajrkk97.js";
243
+ import {
244
+ getErrnoCode,
245
+ init_errors,
246
+ init_slowOperations,
247
+ jsonParse,
248
+ toError
249
+ } from "./chunk-404qm8xt.js";
250
+ import"./chunk-fbv4apne.js";
251
+ import {
252
+ getClaudeConfigHomeDir,
253
+ init_envUtils
254
+ } from "./chunk-jaaxk89e.js";
255
+ import"./chunk-h4b85amj.js";
256
+ import"./chunk-07069jq1.js";
257
+ import"./chunk-vf612n57.js";
258
+ import"./chunk-d4mdda98.js";
259
+ import"./chunk-7wm5s02e.js";
260
+ import {
261
+ init_sdk
262
+ } from "./chunk-4g3v8y12.js";
263
+ import {
264
+ APIUserAbortError
265
+ } from "./chunk-7739pg2c.js";
266
+ import"./chunk-nh3cd07f.js";
267
+ import"./chunk-8pn8tvgg.js";
268
+ import"./chunk-netzwgv1.js";
269
+ import {
270
+ __esm,
271
+ __toESM
272
+ } from "./chunk-qp2qdcda.js";
273
+
274
+ // src/components/agents/types.ts
275
+ var AGENT_PATHS;
276
+ var init_types = __esm(() => {
277
+ AGENT_PATHS = {
278
+ FOLDER_NAME: ".claude",
279
+ AGENTS_DIR: "agents"
280
+ };
281
+ });
282
+
283
+ // src/components/agents/agentFileUtils.ts
284
+ import { mkdir, open, unlink } from "fs/promises";
285
+ import { join } from "path";
286
+ function formatAgentAsMarkdown(agentType, whenToUse, tools, systemPrompt, color, model, memory, effort) {
287
+ const escapedWhenToUse = whenToUse.replace(/\\/g, "\\\\").replace(/"/g, "\\\"").replace(/\n/g, "\\\\n");
288
+ const isAllTools = tools === undefined || tools.length === 1 && tools[0] === "*";
289
+ const toolsLine = isAllTools ? "" : `
290
+ tools: ${tools.join(", ")}`;
291
+ const modelLine = model ? `
292
+ model: ${model}` : "";
293
+ const effortLine = effort !== undefined ? `
294
+ effort: ${effort}` : "";
295
+ const colorLine = color ? `
296
+ color: ${color}` : "";
297
+ const memoryLine = memory ? `
298
+ memory: ${memory}` : "";
299
+ return `---
300
+ name: ${agentType}
301
+ description: "${escapedWhenToUse}"${toolsLine}${modelLine}${effortLine}${colorLine}${memoryLine}
302
+ ---
303
+
304
+ ${systemPrompt}
305
+ `;
306
+ }
307
+ function getAgentDirectoryPath(location) {
308
+ switch (location) {
309
+ case "flagSettings":
310
+ throw new Error(`Cannot get directory path for ${location} agents`);
311
+ case "userSettings":
312
+ return join(getClaudeConfigHomeDir(), AGENT_PATHS.AGENTS_DIR);
313
+ case "projectSettings":
314
+ return join(getCwd(), AGENT_PATHS.FOLDER_NAME, AGENT_PATHS.AGENTS_DIR);
315
+ case "policySettings":
316
+ return join(getManagedFilePath(), AGENT_PATHS.FOLDER_NAME, AGENT_PATHS.AGENTS_DIR);
317
+ case "localSettings":
318
+ return join(getCwd(), AGENT_PATHS.FOLDER_NAME, AGENT_PATHS.AGENTS_DIR);
319
+ }
320
+ }
321
+ function getRelativeAgentDirectoryPath(location) {
322
+ switch (location) {
323
+ case "projectSettings":
324
+ return join(".", AGENT_PATHS.FOLDER_NAME, AGENT_PATHS.AGENTS_DIR);
325
+ default:
326
+ return getAgentDirectoryPath(location);
327
+ }
328
+ }
329
+ function getNewAgentFilePath(agent) {
330
+ const dirPath = getAgentDirectoryPath(agent.source);
331
+ return join(dirPath, `${agent.agentType}.md`);
332
+ }
333
+ function getActualAgentFilePath(agent) {
334
+ if (agent.source === "built-in") {
335
+ return "Built-in";
336
+ }
337
+ if (agent.source === "plugin") {
338
+ throw new Error("Cannot get file path for plugin agents");
339
+ }
340
+ const dirPath = getAgentDirectoryPath(agent.source);
341
+ const filename = agent.filename || agent.agentType;
342
+ return join(dirPath, `${filename}.md`);
343
+ }
344
+ function getNewRelativeAgentFilePath(agent) {
345
+ if (agent.source === "built-in") {
346
+ return "Built-in";
347
+ }
348
+ const dirPath = getRelativeAgentDirectoryPath(agent.source);
349
+ return join(dirPath, `${agent.agentType}.md`);
350
+ }
351
+ function getActualRelativeAgentFilePath(agent) {
352
+ if (isBuiltInAgent(agent)) {
353
+ return "Built-in";
354
+ }
355
+ if (isPluginAgent(agent)) {
356
+ return `Plugin: ${agent.plugin || "Unknown"}`;
357
+ }
358
+ if (agent.source === "flagSettings") {
359
+ return "CLI argument";
360
+ }
361
+ const dirPath = getRelativeAgentDirectoryPath(agent.source);
362
+ const filename = agent.filename || agent.agentType;
363
+ return join(dirPath, `${filename}.md`);
364
+ }
365
+ async function ensureAgentDirectoryExists(source) {
366
+ const dirPath = getAgentDirectoryPath(source);
367
+ await mkdir(dirPath, { recursive: true });
368
+ return dirPath;
369
+ }
370
+ async function saveAgentToFile(source, agentType, whenToUse, tools, systemPrompt, checkExists = true, color, model, memory, effort) {
371
+ if (source === "built-in") {
372
+ throw new Error("Cannot save built-in agents");
373
+ }
374
+ await ensureAgentDirectoryExists(source);
375
+ const filePath = getNewAgentFilePath({ source, agentType });
376
+ const content = formatAgentAsMarkdown(agentType, whenToUse, tools, systemPrompt, color, model, memory, effort);
377
+ try {
378
+ await writeFileAndFlush(filePath, content, checkExists ? "wx" : "w");
379
+ } catch (e) {
380
+ if (getErrnoCode(e) === "EEXIST") {
381
+ throw new Error(`Agent file already exists: ${filePath}`);
382
+ }
383
+ throw e;
384
+ }
385
+ }
386
+ async function updateAgentFile(agent, newWhenToUse, newTools, newSystemPrompt, newColor, newModel, newMemory, newEffort) {
387
+ if (agent.source === "built-in") {
388
+ throw new Error("Cannot update built-in agents");
389
+ }
390
+ const filePath = getActualAgentFilePath(agent);
391
+ const content = formatAgentAsMarkdown(agent.agentType, newWhenToUse, newTools, newSystemPrompt, newColor, newModel, newMemory, newEffort);
392
+ await writeFileAndFlush(filePath, content);
393
+ }
394
+ async function deleteAgentFromFile(agent) {
395
+ if (agent.source === "built-in") {
396
+ throw new Error("Cannot delete built-in agents");
397
+ }
398
+ const filePath = getActualAgentFilePath(agent);
399
+ try {
400
+ await unlink(filePath);
401
+ } catch (e) {
402
+ const code = getErrnoCode(e);
403
+ if (code !== "ENOENT") {
404
+ throw e;
405
+ }
406
+ }
407
+ }
408
+ async function writeFileAndFlush(filePath, content, flag = "w") {
409
+ const handle = await open(filePath, flag);
410
+ try {
411
+ await handle.writeFile(content, { encoding: "utf-8" });
412
+ await handle.datasync();
413
+ } finally {
414
+ await handle.close();
415
+ }
416
+ }
417
+ var init_agentFileUtils = __esm(() => {
418
+ init_managedPath();
419
+ init_loadAgentsDir();
420
+ init_cwd();
421
+ init_envUtils();
422
+ init_errors();
423
+ init_types();
424
+ });
425
+
426
+ // src/components/agents/AgentDetail.tsx
427
+ function AgentDetail({ agent, tools, onBack }) {
428
+ const resolvedTools = resolveAgentTools(agent, tools, false);
429
+ const filePath = getActualRelativeAgentFilePath(agent);
430
+ const backgroundColor = getAgentColor(agent.agentType);
431
+ useKeybinding("confirm:no", onBack, { context: "Confirmation" });
432
+ const handleKeyDown = (e) => {
433
+ if (e.key === "return") {
434
+ e.preventDefault();
435
+ onBack();
436
+ }
437
+ };
438
+ function renderToolsList() {
439
+ if (resolvedTools.hasWildcard) {
440
+ return /* @__PURE__ */ jsx_dev_runtime.jsxDEV(ThemedText, {
441
+ children: "All tools"
442
+ }, undefined, false, undefined, this);
443
+ }
444
+ if (!agent.tools || agent.tools.length === 0) {
445
+ return /* @__PURE__ */ jsx_dev_runtime.jsxDEV(ThemedText, {
446
+ children: "None"
447
+ }, undefined, false, undefined, this);
448
+ }
449
+ return /* @__PURE__ */ jsx_dev_runtime.jsxDEV(jsx_dev_runtime.Fragment, {
450
+ children: [
451
+ resolvedTools.validTools.length > 0 && /* @__PURE__ */ jsx_dev_runtime.jsxDEV(ThemedText, {
452
+ children: resolvedTools.validTools.join(", ")
453
+ }, undefined, false, undefined, this),
454
+ resolvedTools.invalidTools.length > 0 && /* @__PURE__ */ jsx_dev_runtime.jsxDEV(ThemedText, {
455
+ color: "warning",
456
+ children: [
457
+ figures_default.warning,
458
+ " Unrecognized:",
459
+ " ",
460
+ resolvedTools.invalidTools.join(", ")
461
+ ]
462
+ }, undefined, true, undefined, this)
463
+ ]
464
+ }, undefined, true, undefined, this);
465
+ }
466
+ return /* @__PURE__ */ jsx_dev_runtime.jsxDEV(ThemedBox_default, {
467
+ flexDirection: "column",
468
+ gap: 1,
469
+ tabIndex: 0,
470
+ autoFocus: true,
471
+ onKeyDown: handleKeyDown,
472
+ children: [
473
+ /* @__PURE__ */ jsx_dev_runtime.jsxDEV(ThemedText, {
474
+ dimColor: true,
475
+ children: filePath
476
+ }, undefined, false, undefined, this),
477
+ /* @__PURE__ */ jsx_dev_runtime.jsxDEV(ThemedBox_default, {
478
+ flexDirection: "column",
479
+ children: [
480
+ /* @__PURE__ */ jsx_dev_runtime.jsxDEV(ThemedText, {
481
+ children: [
482
+ /* @__PURE__ */ jsx_dev_runtime.jsxDEV(ThemedText, {
483
+ bold: true,
484
+ children: "Description"
485
+ }, undefined, false, undefined, this),
486
+ " (tells Claude when to use this agent):"
487
+ ]
488
+ }, undefined, true, undefined, this),
489
+ /* @__PURE__ */ jsx_dev_runtime.jsxDEV(ThemedBox_default, {
490
+ marginLeft: 2,
491
+ children: /* @__PURE__ */ jsx_dev_runtime.jsxDEV(ThemedText, {
492
+ children: agent.whenToUse
493
+ }, undefined, false, undefined, this)
494
+ }, undefined, false, undefined, this)
495
+ ]
496
+ }, undefined, true, undefined, this),
497
+ /* @__PURE__ */ jsx_dev_runtime.jsxDEV(ThemedBox_default, {
498
+ children: [
499
+ /* @__PURE__ */ jsx_dev_runtime.jsxDEV(ThemedText, {
500
+ children: [
501
+ /* @__PURE__ */ jsx_dev_runtime.jsxDEV(ThemedText, {
502
+ bold: true,
503
+ children: "Tools"
504
+ }, undefined, false, undefined, this),
505
+ ":",
506
+ " "
507
+ ]
508
+ }, undefined, true, undefined, this),
509
+ renderToolsList()
510
+ ]
511
+ }, undefined, true, undefined, this),
512
+ /* @__PURE__ */ jsx_dev_runtime.jsxDEV(ThemedText, {
513
+ children: [
514
+ /* @__PURE__ */ jsx_dev_runtime.jsxDEV(ThemedText, {
515
+ bold: true,
516
+ children: "Model"
517
+ }, undefined, false, undefined, this),
518
+ ": ",
519
+ getAgentModelDisplay(agent.model)
520
+ ]
521
+ }, undefined, true, undefined, this),
522
+ agent.permissionMode && /* @__PURE__ */ jsx_dev_runtime.jsxDEV(ThemedText, {
523
+ children: [
524
+ /* @__PURE__ */ jsx_dev_runtime.jsxDEV(ThemedText, {
525
+ bold: true,
526
+ children: "Permission mode"
527
+ }, undefined, false, undefined, this),
528
+ ": ",
529
+ agent.permissionMode
530
+ ]
531
+ }, undefined, true, undefined, this),
532
+ agent.memory && /* @__PURE__ */ jsx_dev_runtime.jsxDEV(ThemedText, {
533
+ children: [
534
+ /* @__PURE__ */ jsx_dev_runtime.jsxDEV(ThemedText, {
535
+ bold: true,
536
+ children: "Memory"
537
+ }, undefined, false, undefined, this),
538
+ ": ",
539
+ getMemoryScopeDisplay(agent.memory)
540
+ ]
541
+ }, undefined, true, undefined, this),
542
+ agent.hooks && Object.keys(agent.hooks).length > 0 && /* @__PURE__ */ jsx_dev_runtime.jsxDEV(ThemedText, {
543
+ children: [
544
+ /* @__PURE__ */ jsx_dev_runtime.jsxDEV(ThemedText, {
545
+ bold: true,
546
+ children: "Hooks"
547
+ }, undefined, false, undefined, this),
548
+ ": ",
549
+ Object.keys(agent.hooks).join(", ")
550
+ ]
551
+ }, undefined, true, undefined, this),
552
+ agent.skills && agent.skills.length > 0 && /* @__PURE__ */ jsx_dev_runtime.jsxDEV(ThemedText, {
553
+ children: [
554
+ /* @__PURE__ */ jsx_dev_runtime.jsxDEV(ThemedText, {
555
+ bold: true,
556
+ children: "Skills"
557
+ }, undefined, false, undefined, this),
558
+ ":",
559
+ " ",
560
+ agent.skills.length > 10 ? `${agent.skills.length} skills` : agent.skills.join(", ")
561
+ ]
562
+ }, undefined, true, undefined, this),
563
+ backgroundColor && /* @__PURE__ */ jsx_dev_runtime.jsxDEV(ThemedBox_default, {
564
+ children: /* @__PURE__ */ jsx_dev_runtime.jsxDEV(ThemedText, {
565
+ children: [
566
+ /* @__PURE__ */ jsx_dev_runtime.jsxDEV(ThemedText, {
567
+ bold: true,
568
+ children: "Color"
569
+ }, undefined, false, undefined, this),
570
+ ":",
571
+ " ",
572
+ /* @__PURE__ */ jsx_dev_runtime.jsxDEV(ThemedText, {
573
+ backgroundColor,
574
+ color: "inverseText",
575
+ children: [
576
+ " ",
577
+ agent.agentType,
578
+ " "
579
+ ]
580
+ }, undefined, true, undefined, this)
581
+ ]
582
+ }, undefined, true, undefined, this)
583
+ }, undefined, false, undefined, this),
584
+ !isBuiltInAgent(agent) && /* @__PURE__ */ jsx_dev_runtime.jsxDEV(jsx_dev_runtime.Fragment, {
585
+ children: [
586
+ /* @__PURE__ */ jsx_dev_runtime.jsxDEV(ThemedBox_default, {
587
+ children: /* @__PURE__ */ jsx_dev_runtime.jsxDEV(ThemedText, {
588
+ children: [
589
+ /* @__PURE__ */ jsx_dev_runtime.jsxDEV(ThemedText, {
590
+ bold: true,
591
+ children: "System prompt"
592
+ }, undefined, false, undefined, this),
593
+ ":"
594
+ ]
595
+ }, undefined, true, undefined, this)
596
+ }, undefined, false, undefined, this),
597
+ /* @__PURE__ */ jsx_dev_runtime.jsxDEV(ThemedBox_default, {
598
+ marginLeft: 2,
599
+ marginRight: 2,
600
+ children: /* @__PURE__ */ jsx_dev_runtime.jsxDEV(Markdown, {
601
+ children: agent.getSystemPrompt()
602
+ }, undefined, false, undefined, this)
603
+ }, undefined, false, undefined, this)
604
+ ]
605
+ }, undefined, true, undefined, this)
606
+ ]
607
+ }, undefined, true, undefined, this);
608
+ }
609
+ var jsx_dev_runtime;
610
+ var init_AgentDetail = __esm(() => {
611
+ init_figures();
612
+ init_src();
613
+ init_useKeybinding();
614
+ init_agentColorManager();
615
+ init_agentMemory();
616
+ init_agentToolUtils();
617
+ init_loadAgentsDir();
618
+ init_agent();
619
+ init_Markdown();
620
+ init_agentFileUtils();
621
+ jsx_dev_runtime = __toESM(require_jsx_dev_runtime(), 1);
622
+ });
623
+
624
+ // src/components/agents/ColorPicker.tsx
625
+ function ColorPicker({
626
+ agentName,
627
+ currentColor = "automatic",
628
+ onConfirm
629
+ }) {
630
+ const [selectedIndex, setSelectedIndex] = import_react.useState(Math.max(0, COLOR_OPTIONS.findIndex((opt) => opt === currentColor)));
631
+ const handleKeyDown = (e) => {
632
+ if (e.key === "up") {
633
+ e.preventDefault();
634
+ setSelectedIndex((prev) => prev > 0 ? prev - 1 : COLOR_OPTIONS.length - 1);
635
+ } else if (e.key === "down") {
636
+ e.preventDefault();
637
+ setSelectedIndex((prev) => prev < COLOR_OPTIONS.length - 1 ? prev + 1 : 0);
638
+ } else if (e.key === "return") {
639
+ e.preventDefault();
640
+ const selected = COLOR_OPTIONS[selectedIndex];
641
+ onConfirm(selected === "automatic" ? undefined : selected);
642
+ }
643
+ };
644
+ const selectedValue = COLOR_OPTIONS[selectedIndex];
645
+ return /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(ThemedBox_default, {
646
+ flexDirection: "column",
647
+ gap: 1,
648
+ tabIndex: 0,
649
+ autoFocus: true,
650
+ onKeyDown: handleKeyDown,
651
+ children: [
652
+ /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(ThemedBox_default, {
653
+ flexDirection: "column",
654
+ children: COLOR_OPTIONS.map((option, index) => {
655
+ const isSelected = index === selectedIndex;
656
+ return /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(ThemedBox_default, {
657
+ flexDirection: "row",
658
+ gap: 1,
659
+ children: [
660
+ /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(ThemedText, {
661
+ color: isSelected ? "suggestion" : undefined,
662
+ children: isSelected ? figures_default.pointer : " "
663
+ }, undefined, false, undefined, this),
664
+ option === "automatic" ? /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(ThemedText, {
665
+ bold: isSelected,
666
+ children: "Automatic color"
667
+ }, undefined, false, undefined, this) : /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(ThemedBox_default, {
668
+ gap: 1,
669
+ children: [
670
+ /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(ThemedText, {
671
+ backgroundColor: AGENT_COLOR_TO_THEME_COLOR[option],
672
+ color: "inverseText",
673
+ children: " "
674
+ }, undefined, false, undefined, this),
675
+ /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(ThemedText, {
676
+ bold: isSelected,
677
+ children: capitalize(option)
678
+ }, undefined, false, undefined, this)
679
+ ]
680
+ }, undefined, true, undefined, this)
681
+ ]
682
+ }, option, true, undefined, this);
683
+ })
684
+ }, undefined, false, undefined, this),
685
+ /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(ThemedBox_default, {
686
+ marginTop: 1,
687
+ children: [
688
+ /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(ThemedText, {
689
+ children: "Preview: "
690
+ }, undefined, false, undefined, this),
691
+ selectedValue === undefined || selectedValue === "automatic" ? /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(ThemedText, {
692
+ inverse: true,
693
+ bold: true,
694
+ children: [
695
+ " ",
696
+ "@",
697
+ agentName,
698
+ " "
699
+ ]
700
+ }, undefined, true, undefined, this) : /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(ThemedText, {
701
+ backgroundColor: AGENT_COLOR_TO_THEME_COLOR[selectedValue],
702
+ color: "inverseText",
703
+ bold: true,
704
+ children: [
705
+ " ",
706
+ "@",
707
+ agentName,
708
+ " "
709
+ ]
710
+ }, undefined, true, undefined, this)
711
+ ]
712
+ }, undefined, true, undefined, this)
713
+ ]
714
+ }, undefined, true, undefined, this);
715
+ }
716
+ var import_react, jsx_dev_runtime2, COLOR_OPTIONS;
717
+ var init_ColorPicker = __esm(() => {
718
+ init_figures();
719
+ init_src();
720
+ init_agentColorManager();
721
+ init_stringUtils();
722
+ import_react = __toESM(require_react(), 1);
723
+ jsx_dev_runtime2 = __toESM(require_jsx_dev_runtime(), 1);
724
+ COLOR_OPTIONS = ["automatic", ...AGENT_COLORS];
725
+ });
726
+
727
+ // src/components/agents/ModelSelector.tsx
728
+ function ModelSelector({
729
+ initialModel,
730
+ onComplete,
731
+ onCancel
732
+ }) {
733
+ const modelOptions = React2.useMemo(() => {
734
+ const base = getAgentModelOptions();
735
+ if (initialModel && !base.some((o) => o.value === initialModel)) {
736
+ return [
737
+ {
738
+ value: initialModel,
739
+ label: initialModel,
740
+ description: "Current model (custom ID)"
741
+ },
742
+ ...base
743
+ ];
744
+ }
745
+ return base;
746
+ }, [initialModel]);
747
+ const defaultModel = initialModel ?? "sonnet";
748
+ return /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedBox_default, {
749
+ flexDirection: "column",
750
+ children: [
751
+ /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedBox_default, {
752
+ marginBottom: 1,
753
+ children: /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedText, {
754
+ dimColor: true,
755
+ children: "Model determines the agent's reasoning capabilities and speed."
756
+ }, undefined, false, undefined, this)
757
+ }, undefined, false, undefined, this),
758
+ /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Select, {
759
+ options: modelOptions,
760
+ defaultValue: defaultModel,
761
+ onChange: onComplete,
762
+ onCancel: () => onCancel ? onCancel() : onComplete(undefined)
763
+ }, undefined, false, undefined, this)
764
+ ]
765
+ }, undefined, true, undefined, this);
766
+ }
767
+ var React2, jsx_dev_runtime3;
768
+ var init_ModelSelector = __esm(() => {
769
+ init_src();
770
+ init_agent();
771
+ init_select();
772
+ React2 = __toESM(require_react(), 1);
773
+ jsx_dev_runtime3 = __toESM(require_jsx_dev_runtime(), 1);
774
+ });
775
+
776
+ // src/components/agents/ToolSelector.tsx
777
+ function getToolBuckets() {
778
+ return {
779
+ READ_ONLY: {
780
+ name: "Read-only tools",
781
+ toolNames: new Set([
782
+ GlobTool.name,
783
+ GrepTool.name,
784
+ ExitPlanModeV2Tool.name,
785
+ FileReadTool.name,
786
+ WebFetchTool.name,
787
+ TodoWriteTool.name,
788
+ WebSearchTool.name,
789
+ TaskStopTool.name,
790
+ TaskOutputTool.name,
791
+ ListMcpResourcesTool.name,
792
+ ReadMcpResourceTool.name
793
+ ])
794
+ },
795
+ EDIT: {
796
+ name: "Edit tools",
797
+ toolNames: new Set([
798
+ FileEditTool.name,
799
+ FileWriteTool.name,
800
+ NotebookEditTool.name
801
+ ])
802
+ },
803
+ EXECUTION: {
804
+ name: "Execution tools",
805
+ toolNames: new Set([
806
+ BashTool.name,
807
+ process.env.USER_TYPE === "ant" ? TungstenTool.name : undefined
808
+ ].filter((n) => n !== undefined))
809
+ },
810
+ MCP: {
811
+ name: "MCP tools",
812
+ toolNames: new Set,
813
+ isMcp: true
814
+ },
815
+ OTHER: {
816
+ name: "Other tools",
817
+ toolNames: new Set
818
+ }
819
+ };
820
+ }
821
+ function getMcpServerBuckets(tools) {
822
+ const serverMap = new Map;
823
+ tools.forEach((tool) => {
824
+ if (isMcpTool(tool)) {
825
+ const mcpInfo = mcpInfoFromString(tool.name);
826
+ if (mcpInfo?.serverName) {
827
+ const existing = serverMap.get(mcpInfo.serverName) || [];
828
+ existing.push(tool);
829
+ serverMap.set(mcpInfo.serverName, existing);
830
+ }
831
+ }
832
+ });
833
+ return Array.from(serverMap.entries()).map(([serverName, tools2]) => ({ serverName, tools: tools2 })).sort((a, b) => a.serverName.localeCompare(b.serverName));
834
+ }
835
+ function ToolSelector({
836
+ tools,
837
+ initialTools,
838
+ onComplete,
839
+ onCancel
840
+ }) {
841
+ const customAgentTools = import_react2.useMemo(() => filterToolsForAgent({ tools, isBuiltIn: false, isAsync: false }), [tools]);
842
+ const expandedInitialTools = !initialTools || initialTools.includes("*") ? customAgentTools.map((t) => t.name) : initialTools;
843
+ const [selectedTools, setSelectedTools] = import_react2.useState(expandedInitialTools);
844
+ const [focusIndex, setFocusIndex] = import_react2.useState(0);
845
+ const [showIndividualTools, setShowIndividualTools] = import_react2.useState(false);
846
+ const validSelectedTools = import_react2.useMemo(() => {
847
+ const toolNames = new Set(customAgentTools.map((t) => t.name));
848
+ return selectedTools.filter((name) => toolNames.has(name));
849
+ }, [selectedTools, customAgentTools]);
850
+ const selectedSet = new Set(validSelectedTools);
851
+ const isAllSelected = validSelectedTools.length === customAgentTools.length && customAgentTools.length > 0;
852
+ const handleToggleTool = (toolName) => {
853
+ if (!toolName)
854
+ return;
855
+ setSelectedTools((current) => current.includes(toolName) ? current.filter((t) => t !== toolName) : [...current, toolName]);
856
+ };
857
+ const handleToggleTools = (toolNames, select) => {
858
+ setSelectedTools((current) => {
859
+ if (select) {
860
+ const toolsToAdd = toolNames.filter((t) => !current.includes(t));
861
+ return [...current, ...toolsToAdd];
862
+ } else {
863
+ return current.filter((t) => !toolNames.includes(t));
864
+ }
865
+ });
866
+ };
867
+ const handleConfirm = () => {
868
+ const allToolNames = customAgentTools.map((t) => t.name);
869
+ const areAllToolsSelected = validSelectedTools.length === allToolNames.length && allToolNames.every((name) => validSelectedTools.includes(name));
870
+ const finalTools = areAllToolsSelected ? undefined : validSelectedTools;
871
+ onComplete(finalTools);
872
+ };
873
+ const toolsByBucket = import_react2.useMemo(() => {
874
+ const toolBuckets2 = getToolBuckets();
875
+ const buckets = {
876
+ readOnly: [],
877
+ edit: [],
878
+ execution: [],
879
+ mcp: [],
880
+ other: []
881
+ };
882
+ customAgentTools.forEach((tool) => {
883
+ if (isMcpTool(tool)) {
884
+ buckets.mcp.push(tool);
885
+ } else if (toolBuckets2.READ_ONLY.toolNames.has(tool.name)) {
886
+ buckets.readOnly.push(tool);
887
+ } else if (toolBuckets2.EDIT.toolNames.has(tool.name)) {
888
+ buckets.edit.push(tool);
889
+ } else if (toolBuckets2.EXECUTION.toolNames.has(tool.name)) {
890
+ buckets.execution.push(tool);
891
+ } else if (tool.name !== AGENT_TOOL_NAME) {
892
+ buckets.other.push(tool);
893
+ }
894
+ });
895
+ return buckets;
896
+ }, [customAgentTools]);
897
+ const createBucketToggleAction = (bucketTools) => {
898
+ const selected = count(bucketTools, (t) => selectedSet.has(t.name));
899
+ const needsSelection = selected < bucketTools.length;
900
+ return () => {
901
+ const toolNames = bucketTools.map((t) => t.name);
902
+ handleToggleTools(toolNames, needsSelection);
903
+ };
904
+ };
905
+ const navigableItems = [];
906
+ navigableItems.push({
907
+ id: "continue",
908
+ label: "Continue",
909
+ action: handleConfirm,
910
+ isContinue: true
911
+ });
912
+ navigableItems.push({
913
+ id: "bucket-all",
914
+ label: `${isAllSelected ? figures_default.checkboxOn : figures_default.checkboxOff} All tools`,
915
+ action: () => {
916
+ const allToolNames = customAgentTools.map((t) => t.name);
917
+ handleToggleTools(allToolNames, !isAllSelected);
918
+ }
919
+ });
920
+ const toolBuckets = getToolBuckets();
921
+ const bucketConfigs = [
922
+ {
923
+ id: "bucket-readonly",
924
+ name: toolBuckets.READ_ONLY.name,
925
+ tools: toolsByBucket.readOnly
926
+ },
927
+ {
928
+ id: "bucket-edit",
929
+ name: toolBuckets.EDIT.name,
930
+ tools: toolsByBucket.edit
931
+ },
932
+ {
933
+ id: "bucket-execution",
934
+ name: toolBuckets.EXECUTION.name,
935
+ tools: toolsByBucket.execution
936
+ },
937
+ {
938
+ id: "bucket-mcp",
939
+ name: toolBuckets.MCP.name,
940
+ tools: toolsByBucket.mcp
941
+ },
942
+ {
943
+ id: "bucket-other",
944
+ name: toolBuckets.OTHER.name,
945
+ tools: toolsByBucket.other
946
+ }
947
+ ];
948
+ bucketConfigs.forEach(({ id, name, tools: bucketTools }) => {
949
+ if (bucketTools.length === 0)
950
+ return;
951
+ const selected = count(bucketTools, (t) => selectedSet.has(t.name));
952
+ const isFullySelected = selected === bucketTools.length;
953
+ navigableItems.push({
954
+ id,
955
+ label: `${isFullySelected ? figures_default.checkboxOn : figures_default.checkboxOff} ${name}`,
956
+ action: createBucketToggleAction(bucketTools)
957
+ });
958
+ });
959
+ const toggleButtonIndex = navigableItems.length;
960
+ navigableItems.push({
961
+ id: "toggle-individual",
962
+ label: showIndividualTools ? "Hide advanced options" : "Show advanced options",
963
+ action: () => {
964
+ setShowIndividualTools(!showIndividualTools);
965
+ if (showIndividualTools && focusIndex > toggleButtonIndex) {
966
+ setFocusIndex(toggleButtonIndex);
967
+ }
968
+ },
969
+ isToggle: true
970
+ });
971
+ const mcpServerBuckets = import_react2.useMemo(() => getMcpServerBuckets(customAgentTools), [customAgentTools]);
972
+ if (showIndividualTools) {
973
+ if (mcpServerBuckets.length > 0) {
974
+ navigableItems.push({
975
+ id: "mcp-servers-header",
976
+ label: "MCP Servers:",
977
+ action: () => {},
978
+ isHeader: true
979
+ });
980
+ mcpServerBuckets.forEach(({ serverName, tools: serverTools }) => {
981
+ const selected = count(serverTools, (t) => selectedSet.has(t.name));
982
+ const isFullySelected = selected === serverTools.length;
983
+ navigableItems.push({
984
+ id: `mcp-server-${serverName}`,
985
+ label: `${isFullySelected ? figures_default.checkboxOn : figures_default.checkboxOff} ${serverName} (${serverTools.length} ${plural(serverTools.length, "tool")})`,
986
+ action: () => {
987
+ const toolNames = serverTools.map((t) => t.name);
988
+ handleToggleTools(toolNames, !isFullySelected);
989
+ }
990
+ });
991
+ });
992
+ navigableItems.push({
993
+ id: "tools-header",
994
+ label: "Individual Tools:",
995
+ action: () => {},
996
+ isHeader: true
997
+ });
998
+ }
999
+ customAgentTools.forEach((tool) => {
1000
+ let displayName = tool.name;
1001
+ if (tool.name.startsWith("mcp__")) {
1002
+ const mcpInfo = mcpInfoFromString(tool.name);
1003
+ displayName = mcpInfo ? `${mcpInfo.toolName} (${mcpInfo.serverName})` : tool.name;
1004
+ }
1005
+ navigableItems.push({
1006
+ id: `tool-${tool.name}`,
1007
+ label: `${selectedSet.has(tool.name) ? figures_default.checkboxOn : figures_default.checkboxOff} ${displayName}`,
1008
+ action: () => handleToggleTool(tool.name)
1009
+ });
1010
+ });
1011
+ }
1012
+ const handleCancel = import_react2.useCallback(() => {
1013
+ if (onCancel) {
1014
+ onCancel();
1015
+ } else {
1016
+ onComplete(initialTools);
1017
+ }
1018
+ }, [onCancel, onComplete, initialTools]);
1019
+ useKeybinding("confirm:no", handleCancel, { context: "Confirmation" });
1020
+ const handleKeyDown = (e) => {
1021
+ if (e.key === "return") {
1022
+ e.preventDefault();
1023
+ const item = navigableItems[focusIndex];
1024
+ if (item && !item.isHeader) {
1025
+ item.action();
1026
+ }
1027
+ } else if (e.key === "up") {
1028
+ e.preventDefault();
1029
+ let newIndex = focusIndex - 1;
1030
+ while (newIndex > 0 && navigableItems[newIndex]?.isHeader) {
1031
+ newIndex--;
1032
+ }
1033
+ setFocusIndex(Math.max(0, newIndex));
1034
+ } else if (e.key === "down") {
1035
+ e.preventDefault();
1036
+ let newIndex = focusIndex + 1;
1037
+ while (newIndex < navigableItems.length - 1 && navigableItems[newIndex]?.isHeader) {
1038
+ newIndex++;
1039
+ }
1040
+ setFocusIndex(Math.min(navigableItems.length - 1, newIndex));
1041
+ }
1042
+ };
1043
+ return /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(ThemedBox_default, {
1044
+ flexDirection: "column",
1045
+ marginTop: 1,
1046
+ tabIndex: 0,
1047
+ autoFocus: true,
1048
+ onKeyDown: handleKeyDown,
1049
+ children: [
1050
+ /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(ThemedText, {
1051
+ color: focusIndex === 0 ? "suggestion" : undefined,
1052
+ bold: focusIndex === 0,
1053
+ children: [
1054
+ focusIndex === 0 ? `${figures_default.pointer} ` : " ",
1055
+ "[ Continue ]"
1056
+ ]
1057
+ }, undefined, true, undefined, this),
1058
+ /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Divider, {
1059
+ width: 40
1060
+ }, undefined, false, undefined, this),
1061
+ navigableItems.slice(1).map((item, index) => {
1062
+ const isCurrentlyFocused = index + 1 === focusIndex;
1063
+ const isToggleButton = item.isToggle;
1064
+ const isHeader = item.isHeader;
1065
+ return /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(import_react2.default.Fragment, {
1066
+ children: [
1067
+ isToggleButton && /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Divider, {
1068
+ width: 40
1069
+ }, undefined, false, undefined, this),
1070
+ isHeader && index > 0 && /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(ThemedBox_default, {
1071
+ marginTop: 1
1072
+ }, undefined, false, undefined, this),
1073
+ /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(ThemedText, {
1074
+ color: isHeader ? undefined : isCurrentlyFocused ? "suggestion" : undefined,
1075
+ dimColor: isHeader,
1076
+ bold: isToggleButton && isCurrentlyFocused,
1077
+ children: [
1078
+ isHeader ? "" : isCurrentlyFocused ? `${figures_default.pointer} ` : " ",
1079
+ isToggleButton ? `[ ${item.label} ]` : item.label
1080
+ ]
1081
+ }, undefined, true, undefined, this)
1082
+ ]
1083
+ }, item.id, true, undefined, this);
1084
+ }),
1085
+ /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(ThemedBox_default, {
1086
+ marginTop: 1,
1087
+ flexDirection: "column",
1088
+ children: /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(ThemedText, {
1089
+ dimColor: true,
1090
+ children: isAllSelected ? "All tools selected" : `${selectedSet.size} of ${customAgentTools.length} tools selected`
1091
+ }, undefined, false, undefined, this)
1092
+ }, undefined, false, undefined, this)
1093
+ ]
1094
+ }, undefined, true, undefined, this);
1095
+ }
1096
+ var import_react2, jsx_dev_runtime4;
1097
+ var init_ToolSelector = __esm(() => {
1098
+ init_figures();
1099
+ init_mcpStringUtils();
1100
+ init_utils();
1101
+ init_agentToolUtils();
1102
+ init_constants2();
1103
+ init_BashTool();
1104
+ init_ExitPlanModeV2Tool();
1105
+ init_FileEditTool();
1106
+ init_FileReadTool();
1107
+ init_FileWriteTool();
1108
+ init_GlobTool();
1109
+ init_GrepTool();
1110
+ init_ListMcpResourcesTool();
1111
+ init_NotebookEditTool();
1112
+ init_ReadMcpResourceTool();
1113
+ init_TaskOutputTool();
1114
+ init_TaskStopTool();
1115
+ init_TodoWriteTool();
1116
+ init_TungstenTool();
1117
+ init_WebFetchTool();
1118
+ init_WebSearchTool();
1119
+ init_src();
1120
+ init_useKeybinding();
1121
+ init_array();
1122
+ init_stringUtils();
1123
+ init_src();
1124
+ import_react2 = __toESM(require_react(), 1);
1125
+ jsx_dev_runtime4 = __toESM(require_jsx_dev_runtime(), 1);
1126
+ });
1127
+
1128
+ // src/components/agents/utils.ts
1129
+ function getAgentSourceDisplayName(source) {
1130
+ if (source === "all") {
1131
+ return "Agents";
1132
+ }
1133
+ if (source === "built-in") {
1134
+ return "Built-in agents";
1135
+ }
1136
+ if (source === "plugin") {
1137
+ return "Plugin agents";
1138
+ }
1139
+ return capitalize_default(getSettingSourceName(source));
1140
+ }
1141
+ var init_utils2 = __esm(() => {
1142
+ init_capitalize();
1143
+ init_constants();
1144
+ });
1145
+
1146
+ // src/components/agents/AgentEditor.tsx
1147
+ function AgentEditor({
1148
+ agent,
1149
+ tools,
1150
+ onSaved,
1151
+ onBack
1152
+ }) {
1153
+ const setAppState = useSetAppState();
1154
+ const [editMode, setEditMode] = import_react3.useState("menu");
1155
+ const [selectedMenuIndex, setSelectedMenuIndex] = import_react3.useState(0);
1156
+ const [error, setError] = import_react3.useState(null);
1157
+ const [selectedColor, setSelectedColor] = import_react3.useState(agent.color);
1158
+ const handleOpenInEditor = import_react3.useCallback(async () => {
1159
+ const filePath = getActualAgentFilePath(agent);
1160
+ const result = await editFileInEditor(filePath);
1161
+ if (result.error) {
1162
+ setError(result.error);
1163
+ } else {
1164
+ onSaved(`Opened ${agent.agentType} in editor. If you made edits, restart to load the latest version.`);
1165
+ }
1166
+ }, [agent, onSaved]);
1167
+ const handleSave = import_react3.useCallback(async (changes = {}) => {
1168
+ const { tools: newTools, color: newColor, model: newModel } = changes;
1169
+ const finalColor = newColor ?? selectedColor;
1170
+ const hasToolsChanged = newTools !== undefined;
1171
+ const hasModelChanged = newModel !== undefined;
1172
+ const hasColorChanged = finalColor !== agent.color;
1173
+ if (!hasToolsChanged && !hasModelChanged && !hasColorChanged) {
1174
+ return false;
1175
+ }
1176
+ try {
1177
+ if (!isCustomAgent(agent) && !isPluginAgent(agent)) {
1178
+ return false;
1179
+ }
1180
+ await updateAgentFile(agent, agent.whenToUse, newTools ?? agent.tools, agent.getSystemPrompt(), finalColor, newModel ?? agent.model);
1181
+ if (hasColorChanged && finalColor) {
1182
+ setAgentColor(agent.agentType, finalColor);
1183
+ }
1184
+ setAppState((state) => {
1185
+ const allAgents = state.agentDefinitions.allAgents.map((a) => a.agentType === agent.agentType ? {
1186
+ ...a,
1187
+ tools: newTools ?? a.tools,
1188
+ color: finalColor,
1189
+ model: newModel ?? a.model
1190
+ } : a);
1191
+ return {
1192
+ ...state,
1193
+ agentDefinitions: {
1194
+ ...state.agentDefinitions,
1195
+ activeAgents: getActiveAgentsFromList(allAgents),
1196
+ allAgents
1197
+ }
1198
+ };
1199
+ });
1200
+ onSaved(`Updated agent: ${source_default.bold(agent.agentType)}`);
1201
+ return true;
1202
+ } catch (err) {
1203
+ setError(err instanceof Error ? err.message : "Failed to save agent");
1204
+ return false;
1205
+ }
1206
+ }, [agent, selectedColor, onSaved, setAppState]);
1207
+ const menuItems = import_react3.useMemo(() => [
1208
+ { label: "Open in editor", action: handleOpenInEditor },
1209
+ { label: "Edit tools", action: () => setEditMode("edit-tools") },
1210
+ { label: "Edit model", action: () => setEditMode("edit-model") },
1211
+ { label: "Edit color", action: () => setEditMode("edit-color") }
1212
+ ], [handleOpenInEditor]);
1213
+ const handleEscape = import_react3.useCallback(() => {
1214
+ setError(null);
1215
+ if (editMode === "menu") {
1216
+ onBack();
1217
+ } else {
1218
+ setEditMode("menu");
1219
+ }
1220
+ }, [editMode, onBack]);
1221
+ const handleMenuKeyDown = import_react3.useCallback((e) => {
1222
+ if (e.key === "up") {
1223
+ e.preventDefault();
1224
+ setSelectedMenuIndex((index) => Math.max(0, index - 1));
1225
+ } else if (e.key === "down") {
1226
+ e.preventDefault();
1227
+ setSelectedMenuIndex((index) => Math.min(menuItems.length - 1, index + 1));
1228
+ } else if (e.key === "return") {
1229
+ e.preventDefault();
1230
+ const selectedItem = menuItems[selectedMenuIndex];
1231
+ if (selectedItem) {
1232
+ selectedItem.action();
1233
+ }
1234
+ }
1235
+ }, [menuItems, selectedMenuIndex]);
1236
+ useKeybinding("confirm:no", handleEscape, { context: "Confirmation" });
1237
+ const renderMenu = () => /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(ThemedBox_default, {
1238
+ flexDirection: "column",
1239
+ tabIndex: 0,
1240
+ autoFocus: true,
1241
+ onKeyDown: handleMenuKeyDown,
1242
+ children: [
1243
+ /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(ThemedText, {
1244
+ dimColor: true,
1245
+ children: [
1246
+ "Source: ",
1247
+ getAgentSourceDisplayName(agent.source)
1248
+ ]
1249
+ }, undefined, true, undefined, this),
1250
+ /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(ThemedBox_default, {
1251
+ marginTop: 1,
1252
+ flexDirection: "column",
1253
+ children: menuItems.map((item, index) => /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(ThemedText, {
1254
+ color: index === selectedMenuIndex ? "suggestion" : undefined,
1255
+ children: [
1256
+ index === selectedMenuIndex ? `${figures_default.pointer} ` : " ",
1257
+ item.label
1258
+ ]
1259
+ }, item.label, true, undefined, this))
1260
+ }, undefined, false, undefined, this),
1261
+ error && /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(ThemedBox_default, {
1262
+ marginTop: 1,
1263
+ children: /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(ThemedText, {
1264
+ color: "error",
1265
+ children: error
1266
+ }, undefined, false, undefined, this)
1267
+ }, undefined, false, undefined, this)
1268
+ ]
1269
+ }, undefined, true, undefined, this);
1270
+ switch (editMode) {
1271
+ case "menu":
1272
+ return renderMenu();
1273
+ case "edit-tools":
1274
+ return /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(ToolSelector, {
1275
+ tools,
1276
+ initialTools: agent.tools,
1277
+ onComplete: async (finalTools) => {
1278
+ setEditMode("menu");
1279
+ await handleSave({ tools: finalTools });
1280
+ }
1281
+ }, undefined, false, undefined, this);
1282
+ case "edit-color":
1283
+ return /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(ColorPicker, {
1284
+ agentName: agent.agentType,
1285
+ currentColor: selectedColor || agent.color || "automatic",
1286
+ onConfirm: async (color) => {
1287
+ setSelectedColor(color);
1288
+ setEditMode("menu");
1289
+ await handleSave({ color });
1290
+ }
1291
+ }, undefined, false, undefined, this);
1292
+ case "edit-model":
1293
+ return /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(ModelSelector, {
1294
+ initialModel: agent.model,
1295
+ onComplete: async (model) => {
1296
+ setEditMode("menu");
1297
+ await handleSave({ model });
1298
+ }
1299
+ }, undefined, false, undefined, this);
1300
+ default:
1301
+ return null;
1302
+ }
1303
+ }
1304
+ var import_react3, jsx_dev_runtime5;
1305
+ var init_AgentEditor = __esm(() => {
1306
+ init_source();
1307
+ init_figures();
1308
+ init_AppState();
1309
+ init_src();
1310
+ init_useKeybinding();
1311
+ init_agentColorManager();
1312
+ init_loadAgentsDir();
1313
+ init_promptEditor();
1314
+ init_agentFileUtils();
1315
+ init_ColorPicker();
1316
+ init_ModelSelector();
1317
+ init_ToolSelector();
1318
+ init_utils2();
1319
+ import_react3 = __toESM(require_react(), 1);
1320
+ jsx_dev_runtime5 = __toESM(require_jsx_dev_runtime(), 1);
1321
+ });
1322
+
1323
+ // src/components/agents/AgentNavigationFooter.tsx
1324
+ function AgentNavigationFooter({
1325
+ instructions = "Press \u2191\u2193 to navigate \xB7 Enter to select \xB7 Esc to go back"
1326
+ }) {
1327
+ const exitState = useExitOnCtrlCDWithKeybindings();
1328
+ return /* @__PURE__ */ jsx_dev_runtime6.jsxDEV(ThemedBox_default, {
1329
+ marginLeft: 2,
1330
+ children: /* @__PURE__ */ jsx_dev_runtime6.jsxDEV(ThemedText, {
1331
+ dimColor: true,
1332
+ children: exitState.pending ? `Press ${exitState.keyName} again to exit` : instructions
1333
+ }, undefined, false, undefined, this)
1334
+ }, undefined, false, undefined, this);
1335
+ }
1336
+ var jsx_dev_runtime6;
1337
+ var init_AgentNavigationFooter = __esm(() => {
1338
+ init_useExitOnCtrlCDWithKeybindings();
1339
+ init_src();
1340
+ jsx_dev_runtime6 = __toESM(require_jsx_dev_runtime(), 1);
1341
+ });
1342
+
1343
+ // src/components/agents/AgentsList.tsx
1344
+ function AgentsList({
1345
+ source,
1346
+ agents,
1347
+ onBack,
1348
+ onSelect,
1349
+ onCreateNew,
1350
+ changes
1351
+ }) {
1352
+ const [selectedAgent, setSelectedAgent] = React4.useState(null);
1353
+ const [isCreateNewSelected, setIsCreateNewSelected] = React4.useState(true);
1354
+ const sortedAgents = React4.useMemo(() => [...agents].sort(compareAgentsByName), [agents]);
1355
+ const getOverrideInfo = (agent) => {
1356
+ return {
1357
+ isOverridden: !!agent.overriddenBy,
1358
+ overriddenBy: agent.overriddenBy || null
1359
+ };
1360
+ };
1361
+ const renderCreateNewOption = () => {
1362
+ return /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedBox_default, {
1363
+ children: [
1364
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedText, {
1365
+ color: isCreateNewSelected ? "suggestion" : undefined,
1366
+ children: isCreateNewSelected ? `${figures_default.pointer} ` : " "
1367
+ }, undefined, false, undefined, this),
1368
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedText, {
1369
+ color: isCreateNewSelected ? "suggestion" : undefined,
1370
+ children: "Create new agent"
1371
+ }, undefined, false, undefined, this)
1372
+ ]
1373
+ }, undefined, true, undefined, this);
1374
+ };
1375
+ const renderAgent = (agent) => {
1376
+ const isBuiltIn = agent.source === "built-in";
1377
+ const isSelected = !isBuiltIn && !isCreateNewSelected && selectedAgent?.agentType === agent.agentType && selectedAgent?.source === agent.source;
1378
+ const { isOverridden, overriddenBy } = getOverrideInfo(agent);
1379
+ const dimmed = isBuiltIn || isOverridden;
1380
+ const textColor = !isBuiltIn && isSelected ? "suggestion" : undefined;
1381
+ const resolvedModel = resolveAgentModelDisplay(agent);
1382
+ return /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedBox_default, {
1383
+ children: [
1384
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedText, {
1385
+ dimColor: dimmed && !isSelected,
1386
+ color: textColor,
1387
+ children: isBuiltIn ? "" : isSelected ? `${figures_default.pointer} ` : " "
1388
+ }, undefined, false, undefined, this),
1389
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedText, {
1390
+ dimColor: dimmed && !isSelected,
1391
+ color: textColor,
1392
+ children: agent.agentType
1393
+ }, undefined, false, undefined, this),
1394
+ resolvedModel && /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedText, {
1395
+ dimColor: true,
1396
+ color: textColor,
1397
+ children: [
1398
+ " \xB7 ",
1399
+ resolvedModel
1400
+ ]
1401
+ }, undefined, true, undefined, this),
1402
+ agent.memory && /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedText, {
1403
+ dimColor: true,
1404
+ color: textColor,
1405
+ children: [
1406
+ " \xB7 ",
1407
+ agent.memory,
1408
+ " memory"
1409
+ ]
1410
+ }, undefined, true, undefined, this),
1411
+ overriddenBy && /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedText, {
1412
+ dimColor: !isSelected,
1413
+ color: isSelected ? "warning" : undefined,
1414
+ children: [
1415
+ " ",
1416
+ figures_default.warning,
1417
+ " shadowed by ",
1418
+ getOverrideSourceLabel(overriddenBy)
1419
+ ]
1420
+ }, undefined, true, undefined, this)
1421
+ ]
1422
+ }, `${agent.agentType}-${agent.source}`, true, undefined, this);
1423
+ };
1424
+ const selectableAgentsInOrder = React4.useMemo(() => {
1425
+ const nonBuiltIn = sortedAgents.filter((a) => a.source !== "built-in");
1426
+ if (source === "all") {
1427
+ return AGENT_SOURCE_GROUPS.filter((g) => g.source !== "built-in").flatMap(({ source: groupSource }) => nonBuiltIn.filter((a) => a.source === groupSource));
1428
+ }
1429
+ return nonBuiltIn;
1430
+ }, [sortedAgents, source]);
1431
+ React4.useEffect(() => {
1432
+ if (!selectedAgent && !isCreateNewSelected && selectableAgentsInOrder.length > 0) {
1433
+ if (onCreateNew) {
1434
+ setIsCreateNewSelected(true);
1435
+ } else {
1436
+ setSelectedAgent(selectableAgentsInOrder[0] || null);
1437
+ }
1438
+ }
1439
+ }, [selectableAgentsInOrder, selectedAgent, isCreateNewSelected, onCreateNew]);
1440
+ const handleKeyDown = (e) => {
1441
+ if (e.key === "return") {
1442
+ e.preventDefault();
1443
+ if (isCreateNewSelected && onCreateNew) {
1444
+ onCreateNew();
1445
+ } else if (selectedAgent) {
1446
+ onSelect(selectedAgent);
1447
+ }
1448
+ return;
1449
+ }
1450
+ if (e.key !== "up" && e.key !== "down")
1451
+ return;
1452
+ e.preventDefault();
1453
+ const hasCreateOption = !!onCreateNew;
1454
+ const totalItems = selectableAgentsInOrder.length + (hasCreateOption ? 1 : 0);
1455
+ if (totalItems === 0)
1456
+ return;
1457
+ let currentPosition = 0;
1458
+ if (!isCreateNewSelected && selectedAgent) {
1459
+ const agentIndex = selectableAgentsInOrder.findIndex((a) => a.agentType === selectedAgent.agentType && a.source === selectedAgent.source);
1460
+ if (agentIndex >= 0) {
1461
+ currentPosition = hasCreateOption ? agentIndex + 1 : agentIndex;
1462
+ }
1463
+ }
1464
+ const newPosition = e.key === "up" ? currentPosition === 0 ? totalItems - 1 : currentPosition - 1 : currentPosition === totalItems - 1 ? 0 : currentPosition + 1;
1465
+ if (hasCreateOption && newPosition === 0) {
1466
+ setIsCreateNewSelected(true);
1467
+ setSelectedAgent(null);
1468
+ } else {
1469
+ const agentIndex = hasCreateOption ? newPosition - 1 : newPosition;
1470
+ const newAgent = selectableAgentsInOrder[agentIndex];
1471
+ if (newAgent) {
1472
+ setIsCreateNewSelected(false);
1473
+ setSelectedAgent(newAgent);
1474
+ }
1475
+ }
1476
+ };
1477
+ const renderBuiltInAgentsSection = (title = "Built-in (always available):") => {
1478
+ const builtInAgents2 = sortedAgents.filter((a) => a.source === "built-in");
1479
+ return /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedBox_default, {
1480
+ flexDirection: "column",
1481
+ marginBottom: 1,
1482
+ paddingLeft: 2,
1483
+ children: [
1484
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedText, {
1485
+ bold: true,
1486
+ dimColor: true,
1487
+ children: title
1488
+ }, undefined, false, undefined, this),
1489
+ builtInAgents2.map(renderAgent)
1490
+ ]
1491
+ }, undefined, true, undefined, this);
1492
+ };
1493
+ const renderAgentGroup = (title, groupAgents) => {
1494
+ if (!groupAgents.length)
1495
+ return null;
1496
+ const folderPath = groupAgents[0]?.baseDir;
1497
+ return /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedBox_default, {
1498
+ flexDirection: "column",
1499
+ marginBottom: 1,
1500
+ children: [
1501
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedBox_default, {
1502
+ paddingLeft: 2,
1503
+ children: [
1504
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedText, {
1505
+ bold: true,
1506
+ dimColor: true,
1507
+ children: title
1508
+ }, undefined, false, undefined, this),
1509
+ folderPath && /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedText, {
1510
+ dimColor: true,
1511
+ children: [
1512
+ " (",
1513
+ folderPath,
1514
+ ")"
1515
+ ]
1516
+ }, undefined, true, undefined, this)
1517
+ ]
1518
+ }, undefined, true, undefined, this),
1519
+ groupAgents.map((agent) => renderAgent(agent))
1520
+ ]
1521
+ }, undefined, true, undefined, this);
1522
+ };
1523
+ const sourceTitle = getAgentSourceDisplayName(source);
1524
+ const builtInAgents = sortedAgents.filter((a) => a.source === "built-in");
1525
+ const hasNoAgents = !sortedAgents.length || source !== "built-in" && !sortedAgents.some((a) => a.source !== "built-in");
1526
+ if (hasNoAgents) {
1527
+ return /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(Dialog, {
1528
+ title: sourceTitle,
1529
+ subtitle: "No agents found",
1530
+ onCancel: onBack,
1531
+ hideInputGuide: true,
1532
+ children: /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedBox_default, {
1533
+ flexDirection: "column",
1534
+ gap: 1,
1535
+ tabIndex: 0,
1536
+ autoFocus: true,
1537
+ onKeyDown: handleKeyDown,
1538
+ children: [
1539
+ onCreateNew && /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedBox_default, {
1540
+ children: renderCreateNewOption()
1541
+ }, undefined, false, undefined, this),
1542
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedText, {
1543
+ dimColor: true,
1544
+ children: "No agents found. Create specialized subagents that Claude can delegate to."
1545
+ }, undefined, false, undefined, this),
1546
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedText, {
1547
+ dimColor: true,
1548
+ children: "Each subagent has its own context window, custom system prompt, and specific tools."
1549
+ }, undefined, false, undefined, this),
1550
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedText, {
1551
+ dimColor: true,
1552
+ children: "Try creating: Code Reviewer, Code Simplifier, Security Reviewer, Tech Lead, or UX Reviewer."
1553
+ }, undefined, false, undefined, this),
1554
+ source !== "built-in" && sortedAgents.some((a) => a.source === "built-in") && /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(jsx_dev_runtime7.Fragment, {
1555
+ children: [
1556
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(Divider, {}, undefined, false, undefined, this),
1557
+ renderBuiltInAgentsSection()
1558
+ ]
1559
+ }, undefined, true, undefined, this)
1560
+ ]
1561
+ }, undefined, true, undefined, this)
1562
+ }, undefined, false, undefined, this);
1563
+ }
1564
+ return /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(Dialog, {
1565
+ title: sourceTitle,
1566
+ subtitle: `${count(sortedAgents, (a) => !a.overriddenBy)} agents`,
1567
+ onCancel: onBack,
1568
+ hideInputGuide: true,
1569
+ children: [
1570
+ changes && changes.length > 0 && /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedBox_default, {
1571
+ marginTop: 1,
1572
+ children: /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedText, {
1573
+ dimColor: true,
1574
+ children: changes[changes.length - 1]
1575
+ }, undefined, false, undefined, this)
1576
+ }, undefined, false, undefined, this),
1577
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedBox_default, {
1578
+ flexDirection: "column",
1579
+ tabIndex: 0,
1580
+ autoFocus: true,
1581
+ onKeyDown: handleKeyDown,
1582
+ children: [
1583
+ onCreateNew && /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedBox_default, {
1584
+ marginBottom: 1,
1585
+ children: renderCreateNewOption()
1586
+ }, undefined, false, undefined, this),
1587
+ source === "all" ? /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(jsx_dev_runtime7.Fragment, {
1588
+ children: [
1589
+ AGENT_SOURCE_GROUPS.filter((g) => g.source !== "built-in").map(({ label, source: groupSource }) => /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(React4.Fragment, {
1590
+ children: renderAgentGroup(label, sortedAgents.filter((a) => a.source === groupSource))
1591
+ }, groupSource, false, undefined, this)),
1592
+ builtInAgents.length > 0 && /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedBox_default, {
1593
+ flexDirection: "column",
1594
+ marginBottom: 1,
1595
+ paddingLeft: 2,
1596
+ children: [
1597
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedText, {
1598
+ dimColor: true,
1599
+ children: [
1600
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedText, {
1601
+ bold: true,
1602
+ children: "Built-in agents"
1603
+ }, undefined, false, undefined, this),
1604
+ " (always available)"
1605
+ ]
1606
+ }, undefined, true, undefined, this),
1607
+ builtInAgents.map(renderAgent)
1608
+ ]
1609
+ }, undefined, true, undefined, this)
1610
+ ]
1611
+ }, undefined, true, undefined, this) : source === "built-in" ? /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(jsx_dev_runtime7.Fragment, {
1612
+ children: [
1613
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedText, {
1614
+ dimColor: true,
1615
+ italic: true,
1616
+ children: "Built-in agents are provided by default and cannot be modified."
1617
+ }, undefined, false, undefined, this),
1618
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedBox_default, {
1619
+ marginTop: 1,
1620
+ flexDirection: "column",
1621
+ children: sortedAgents.map((agent) => renderAgent(agent))
1622
+ }, undefined, false, undefined, this)
1623
+ ]
1624
+ }, undefined, true, undefined, this) : /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(jsx_dev_runtime7.Fragment, {
1625
+ children: [
1626
+ sortedAgents.filter((a) => a.source !== "built-in").map((agent) => renderAgent(agent)),
1627
+ sortedAgents.some((a) => a.source === "built-in") && /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(jsx_dev_runtime7.Fragment, {
1628
+ children: [
1629
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(Divider, {}, undefined, false, undefined, this),
1630
+ renderBuiltInAgentsSection()
1631
+ ]
1632
+ }, undefined, true, undefined, this)
1633
+ ]
1634
+ }, undefined, true, undefined, this)
1635
+ ]
1636
+ }, undefined, true, undefined, this)
1637
+ ]
1638
+ }, undefined, true, undefined, this);
1639
+ }
1640
+ var React4, jsx_dev_runtime7;
1641
+ var init_AgentsList = __esm(() => {
1642
+ init_figures();
1643
+ init_src();
1644
+ init_agentDisplay();
1645
+ init_array();
1646
+ init_src();
1647
+ init_utils2();
1648
+ React4 = __toESM(require_react(), 1);
1649
+ jsx_dev_runtime7 = __toESM(require_jsx_dev_runtime(), 1);
1650
+ });
1651
+
1652
+ // src/components/wizard/WizardProvider.tsx
1653
+ function WizardProvider({
1654
+ steps,
1655
+ initialData = {},
1656
+ onComplete,
1657
+ onCancel,
1658
+ children,
1659
+ title,
1660
+ showStepCounter = true
1661
+ }) {
1662
+ const [currentStepIndex, setCurrentStepIndex] = import_react4.useState(0);
1663
+ const [wizardData, setWizardData] = import_react4.useState(initialData);
1664
+ const [isCompleted, setIsCompleted] = import_react4.useState(false);
1665
+ const [navigationHistory, setNavigationHistory] = import_react4.useState([]);
1666
+ useExitOnCtrlCDWithKeybindings();
1667
+ import_react4.useEffect(() => {
1668
+ if (isCompleted) {
1669
+ setNavigationHistory([]);
1670
+ onComplete(wizardData);
1671
+ }
1672
+ }, [isCompleted, wizardData, onComplete]);
1673
+ const goNext = import_react4.useCallback(() => {
1674
+ if (currentStepIndex < steps.length - 1) {
1675
+ if (navigationHistory.length > 0) {
1676
+ setNavigationHistory((prev) => [...prev, currentStepIndex]);
1677
+ }
1678
+ setCurrentStepIndex((prev) => prev + 1);
1679
+ } else {
1680
+ setIsCompleted(true);
1681
+ }
1682
+ }, [currentStepIndex, steps.length, navigationHistory]);
1683
+ const goBack = import_react4.useCallback(() => {
1684
+ if (navigationHistory.length > 0) {
1685
+ const previousStep = navigationHistory[navigationHistory.length - 1];
1686
+ if (previousStep !== undefined) {
1687
+ setNavigationHistory((prev) => prev.slice(0, -1));
1688
+ setCurrentStepIndex(previousStep);
1689
+ }
1690
+ } else if (currentStepIndex > 0) {
1691
+ setCurrentStepIndex((prev) => prev - 1);
1692
+ } else if (onCancel) {
1693
+ onCancel();
1694
+ }
1695
+ }, [currentStepIndex, navigationHistory, onCancel]);
1696
+ const goToStep = import_react4.useCallback((index) => {
1697
+ if (index >= 0 && index < steps.length) {
1698
+ setNavigationHistory((prev) => [...prev, currentStepIndex]);
1699
+ setCurrentStepIndex(index);
1700
+ }
1701
+ }, [currentStepIndex, steps.length]);
1702
+ const cancel = import_react4.useCallback(() => {
1703
+ setNavigationHistory([]);
1704
+ if (onCancel) {
1705
+ onCancel();
1706
+ }
1707
+ }, [onCancel]);
1708
+ const updateWizardData = import_react4.useCallback((updates) => {
1709
+ setWizardData((prev) => ({ ...prev, ...updates }));
1710
+ }, []);
1711
+ const contextValue = import_react4.useMemo(() => ({
1712
+ currentStepIndex,
1713
+ totalSteps: steps.length,
1714
+ wizardData,
1715
+ setWizardData,
1716
+ updateWizardData,
1717
+ goNext,
1718
+ goBack,
1719
+ goToStep,
1720
+ cancel,
1721
+ title,
1722
+ showStepCounter
1723
+ }), [
1724
+ currentStepIndex,
1725
+ steps.length,
1726
+ wizardData,
1727
+ updateWizardData,
1728
+ goNext,
1729
+ goBack,
1730
+ goToStep,
1731
+ cancel,
1732
+ title,
1733
+ showStepCounter
1734
+ ]);
1735
+ const CurrentStepComponent = steps[currentStepIndex];
1736
+ if (!CurrentStepComponent || isCompleted) {
1737
+ return null;
1738
+ }
1739
+ return /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(WizardContext.Provider, {
1740
+ value: contextValue,
1741
+ children: children || /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(CurrentStepComponent, {}, undefined, false, undefined, this)
1742
+ }, undefined, false, undefined, this);
1743
+ }
1744
+ var import_react4, jsx_dev_runtime8, WizardContext;
1745
+ var init_WizardProvider = __esm(() => {
1746
+ init_useExitOnCtrlCDWithKeybindings();
1747
+ import_react4 = __toESM(require_react(), 1);
1748
+ jsx_dev_runtime8 = __toESM(require_jsx_dev_runtime(), 1);
1749
+ WizardContext = import_react4.createContext(null);
1750
+ });
1751
+
1752
+ // src/components/wizard/useWizard.ts
1753
+ function useWizard() {
1754
+ const context = import_react5.useContext(WizardContext);
1755
+ if (!context) {
1756
+ throw new Error("useWizard must be used within a WizardProvider");
1757
+ }
1758
+ return context;
1759
+ }
1760
+ var import_react5;
1761
+ var init_useWizard = __esm(() => {
1762
+ init_WizardProvider();
1763
+ import_react5 = __toESM(require_react(), 1);
1764
+ });
1765
+
1766
+ // src/components/wizard/WizardNavigationFooter.tsx
1767
+ function WizardNavigationFooter({
1768
+ instructions = /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(Byline, {
1769
+ children: [
1770
+ /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(KeyboardShortcutHint, {
1771
+ shortcut: "\u2191\u2193",
1772
+ action: "navigate"
1773
+ }, undefined, false, undefined, this),
1774
+ /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(KeyboardShortcutHint, {
1775
+ shortcut: "Enter",
1776
+ action: "select"
1777
+ }, undefined, false, undefined, this),
1778
+ /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(ConfigurableShortcutHint, {
1779
+ action: "confirm:no",
1780
+ context: "Confirmation",
1781
+ fallback: "Esc",
1782
+ description: "go back"
1783
+ }, undefined, false, undefined, this)
1784
+ ]
1785
+ }, undefined, true, undefined, this)
1786
+ }) {
1787
+ const exitState = useExitOnCtrlCDWithKeybindings();
1788
+ return /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(ThemedBox_default, {
1789
+ marginLeft: 3,
1790
+ marginTop: 1,
1791
+ children: /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(ThemedText, {
1792
+ dimColor: true,
1793
+ children: exitState.pending ? `Press ${exitState.keyName} again to exit` : instructions
1794
+ }, undefined, false, undefined, this)
1795
+ }, undefined, false, undefined, this);
1796
+ }
1797
+ var jsx_dev_runtime9;
1798
+ var init_WizardNavigationFooter = __esm(() => {
1799
+ init_useExitOnCtrlCDWithKeybindings();
1800
+ init_src();
1801
+ init_ConfigurableShortcutHint();
1802
+ init_src();
1803
+ jsx_dev_runtime9 = __toESM(require_jsx_dev_runtime(), 1);
1804
+ });
1805
+
1806
+ // src/components/wizard/WizardDialogLayout.tsx
1807
+ function WizardDialogLayout({
1808
+ title: titleOverride,
1809
+ color = "suggestion",
1810
+ children,
1811
+ subtitle,
1812
+ footerText
1813
+ }) {
1814
+ const {
1815
+ currentStepIndex,
1816
+ totalSteps,
1817
+ title: providerTitle,
1818
+ showStepCounter,
1819
+ goBack
1820
+ } = useWizard();
1821
+ const title = titleOverride || providerTitle || "Wizard";
1822
+ const stepSuffix = showStepCounter !== false ? ` (${currentStepIndex + 1}/${totalSteps})` : "";
1823
+ return /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(jsx_dev_runtime10.Fragment, {
1824
+ children: [
1825
+ /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(Dialog, {
1826
+ title: `${title}${stepSuffix}`,
1827
+ subtitle,
1828
+ onCancel: goBack,
1829
+ color,
1830
+ hideInputGuide: true,
1831
+ isCancelActive: false,
1832
+ children
1833
+ }, undefined, false, undefined, this),
1834
+ /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(WizardNavigationFooter, {
1835
+ instructions: footerText
1836
+ }, undefined, false, undefined, this)
1837
+ ]
1838
+ }, undefined, true, undefined, this);
1839
+ }
1840
+ var jsx_dev_runtime10;
1841
+ var init_WizardDialogLayout = __esm(() => {
1842
+ init_src();
1843
+ init_useWizard();
1844
+ init_WizardNavigationFooter();
1845
+ jsx_dev_runtime10 = __toESM(require_jsx_dev_runtime(), 1);
1846
+ });
1847
+
1848
+ // src/components/wizard/index.ts
1849
+ var init_wizard = __esm(() => {
1850
+ init_useWizard();
1851
+ init_WizardDialogLayout();
1852
+ init_WizardNavigationFooter();
1853
+ init_WizardProvider();
1854
+ });
1855
+
1856
+ // src/components/agents/new-agent-creation/wizard-steps/ColorStep.tsx
1857
+ function ColorStep() {
1858
+ const { goNext, goBack, updateWizardData, wizardData } = useWizard();
1859
+ useKeybinding("confirm:no", goBack, { context: "Confirmation" });
1860
+ const handleConfirm = (color) => {
1861
+ updateWizardData({
1862
+ selectedColor: color,
1863
+ finalAgent: {
1864
+ agentType: wizardData.agentType,
1865
+ whenToUse: wizardData.whenToUse,
1866
+ getSystemPrompt: () => wizardData.systemPrompt,
1867
+ tools: wizardData.selectedTools,
1868
+ ...wizardData.selectedModel ? { model: wizardData.selectedModel } : {},
1869
+ ...color ? { color } : {},
1870
+ source: wizardData.location
1871
+ }
1872
+ });
1873
+ goNext();
1874
+ };
1875
+ return /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(WizardDialogLayout, {
1876
+ subtitle: "Choose background color",
1877
+ footerText: /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(Byline, {
1878
+ children: [
1879
+ /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(KeyboardShortcutHint, {
1880
+ shortcut: "\u2191\u2193",
1881
+ action: "navigate"
1882
+ }, undefined, false, undefined, this),
1883
+ /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(KeyboardShortcutHint, {
1884
+ shortcut: "Enter",
1885
+ action: "select"
1886
+ }, undefined, false, undefined, this),
1887
+ /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(ConfigurableShortcutHint, {
1888
+ action: "confirm:no",
1889
+ context: "Confirmation",
1890
+ fallback: "Esc",
1891
+ description: "go back"
1892
+ }, undefined, false, undefined, this)
1893
+ ]
1894
+ }, undefined, true, undefined, this),
1895
+ children: /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(ThemedBox_default, {
1896
+ children: /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(ColorPicker, {
1897
+ agentName: wizardData.agentType || "agent",
1898
+ currentColor: "automatic",
1899
+ onConfirm: handleConfirm
1900
+ }, undefined, false, undefined, this)
1901
+ }, undefined, false, undefined, this)
1902
+ }, undefined, false, undefined, this);
1903
+ }
1904
+ var jsx_dev_runtime11;
1905
+ var init_ColorStep = __esm(() => {
1906
+ init_src();
1907
+ init_useKeybinding();
1908
+ init_ConfigurableShortcutHint();
1909
+ init_wizard();
1910
+ init_WizardDialogLayout();
1911
+ init_ColorPicker();
1912
+ jsx_dev_runtime11 = __toESM(require_jsx_dev_runtime(), 1);
1913
+ });
1914
+
1915
+ // src/components/agents/validateAgent.ts
1916
+ function validateAgentType(agentType) {
1917
+ if (!agentType) {
1918
+ return "Agent type is required";
1919
+ }
1920
+ if (!/^[a-zA-Z0-9][a-zA-Z0-9-]*[a-zA-Z0-9]$/.test(agentType)) {
1921
+ return "Agent type must start and end with alphanumeric characters and contain only letters, numbers, and hyphens";
1922
+ }
1923
+ if (agentType.length < 3) {
1924
+ return "Agent type must be at least 3 characters long";
1925
+ }
1926
+ if (agentType.length > 50) {
1927
+ return "Agent type must be less than 50 characters";
1928
+ }
1929
+ return null;
1930
+ }
1931
+ function validateAgent(agent, availableTools, existingAgents) {
1932
+ const errors = [];
1933
+ const warnings = [];
1934
+ if (!agent.agentType) {
1935
+ errors.push("Agent type is required");
1936
+ } else {
1937
+ const typeError = validateAgentType(agent.agentType);
1938
+ if (typeError) {
1939
+ errors.push(typeError);
1940
+ }
1941
+ const duplicate = existingAgents.find((a) => a.agentType === agent.agentType && a.source !== agent.source);
1942
+ if (duplicate) {
1943
+ errors.push(`Agent type "${agent.agentType}" already exists in ${getAgentSourceDisplayName(duplicate.source)}`);
1944
+ }
1945
+ }
1946
+ if (!agent.whenToUse) {
1947
+ errors.push("Description (description) is required");
1948
+ } else if (agent.whenToUse.length < 10) {
1949
+ warnings.push("Description should be more descriptive (at least 10 characters)");
1950
+ } else if (agent.whenToUse.length > 5000) {
1951
+ warnings.push("Description is very long (over 5000 characters)");
1952
+ }
1953
+ if (agent.tools !== undefined && !Array.isArray(agent.tools)) {
1954
+ errors.push("Tools must be an array");
1955
+ } else {
1956
+ if (agent.tools === undefined) {
1957
+ warnings.push("Agent has access to all tools");
1958
+ } else if (agent.tools.length === 0) {
1959
+ warnings.push("No tools selected - agent will have very limited capabilities");
1960
+ }
1961
+ const resolvedTools = resolveAgentTools(agent, availableTools, false);
1962
+ if (resolvedTools.invalidTools.length > 0) {
1963
+ errors.push(`Invalid tools: ${resolvedTools.invalidTools.join(", ")}`);
1964
+ }
1965
+ }
1966
+ const systemPrompt = agent.getSystemPrompt();
1967
+ if (!systemPrompt) {
1968
+ errors.push("System prompt is required");
1969
+ } else if (systemPrompt.length < 20) {
1970
+ errors.push("System prompt is too short (minimum 20 characters)");
1971
+ } else if (systemPrompt.length > 1e4) {
1972
+ warnings.push("System prompt is very long (over 10,000 characters)");
1973
+ }
1974
+ return {
1975
+ isValid: errors.length === 0,
1976
+ errors,
1977
+ warnings
1978
+ };
1979
+ }
1980
+ var init_validateAgent = __esm(() => {
1981
+ init_agentToolUtils();
1982
+ init_utils2();
1983
+ });
1984
+
1985
+ // src/components/agents/new-agent-creation/wizard-steps/ConfirmStep.tsx
1986
+ function ConfirmStep({
1987
+ tools,
1988
+ existingAgents,
1989
+ onSave,
1990
+ onSaveAndEdit,
1991
+ error
1992
+ }) {
1993
+ const { goBack, wizardData } = useWizard();
1994
+ useKeybinding("confirm:no", goBack, { context: "Confirmation" });
1995
+ const handleKeyDown = (e) => {
1996
+ if (e.key === "s" || e.key === "return") {
1997
+ e.preventDefault();
1998
+ onSave();
1999
+ } else if (e.key === "e") {
2000
+ e.preventDefault();
2001
+ onSaveAndEdit();
2002
+ }
2003
+ };
2004
+ const agent = wizardData.finalAgent;
2005
+ const validation = validateAgent(agent, tools, existingAgents);
2006
+ const systemPromptPreview = truncateToWidth(agent.getSystemPrompt(), 240);
2007
+ const whenToUsePreview = truncateToWidth(agent.whenToUse, 240);
2008
+ const getToolsDisplay = (toolNames) => {
2009
+ if (toolNames === undefined)
2010
+ return "All tools";
2011
+ if (toolNames.length === 0)
2012
+ return "None";
2013
+ if (toolNames.length === 1)
2014
+ return toolNames[0] || "None";
2015
+ if (toolNames.length === 2)
2016
+ return toolNames.join(" and ");
2017
+ return `${toolNames.slice(0, -1).join(", ")}, and ${toolNames[toolNames.length - 1]}`;
2018
+ };
2019
+ const memoryDisplayElement = isAutoMemoryEnabled() ? /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedText, {
2020
+ children: [
2021
+ /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedText, {
2022
+ bold: true,
2023
+ children: "Memory"
2024
+ }, undefined, false, undefined, this),
2025
+ ": ",
2026
+ getMemoryScopeDisplay(agent.memory)
2027
+ ]
2028
+ }, undefined, true, undefined, this) : null;
2029
+ return /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(WizardDialogLayout, {
2030
+ subtitle: "Confirm and save",
2031
+ footerText: /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(Byline, {
2032
+ children: [
2033
+ /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(KeyboardShortcutHint, {
2034
+ shortcut: "s/Enter",
2035
+ action: "save"
2036
+ }, undefined, false, undefined, this),
2037
+ /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(KeyboardShortcutHint, {
2038
+ shortcut: "e",
2039
+ action: "edit in your editor"
2040
+ }, undefined, false, undefined, this),
2041
+ /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ConfigurableShortcutHint, {
2042
+ action: "confirm:no",
2043
+ context: "Confirmation",
2044
+ fallback: "Esc",
2045
+ description: "cancel"
2046
+ }, undefined, false, undefined, this)
2047
+ ]
2048
+ }, undefined, true, undefined, this),
2049
+ children: /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedBox_default, {
2050
+ flexDirection: "column",
2051
+ tabIndex: 0,
2052
+ autoFocus: true,
2053
+ onKeyDown: handleKeyDown,
2054
+ children: [
2055
+ /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedText, {
2056
+ children: [
2057
+ /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedText, {
2058
+ bold: true,
2059
+ children: "Name"
2060
+ }, undefined, false, undefined, this),
2061
+ ": ",
2062
+ agent.agentType
2063
+ ]
2064
+ }, undefined, true, undefined, this),
2065
+ /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedText, {
2066
+ children: [
2067
+ /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedText, {
2068
+ bold: true,
2069
+ children: "Location"
2070
+ }, undefined, false, undefined, this),
2071
+ ":",
2072
+ " ",
2073
+ getNewRelativeAgentFilePath({
2074
+ source: wizardData.location,
2075
+ agentType: agent.agentType
2076
+ })
2077
+ ]
2078
+ }, undefined, true, undefined, this),
2079
+ /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedText, {
2080
+ children: [
2081
+ /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedText, {
2082
+ bold: true,
2083
+ children: "Tools"
2084
+ }, undefined, false, undefined, this),
2085
+ ": ",
2086
+ getToolsDisplay(agent.tools)
2087
+ ]
2088
+ }, undefined, true, undefined, this),
2089
+ /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedText, {
2090
+ children: [
2091
+ /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedText, {
2092
+ bold: true,
2093
+ children: "Model"
2094
+ }, undefined, false, undefined, this),
2095
+ ": ",
2096
+ getAgentModelDisplay(agent.model)
2097
+ ]
2098
+ }, undefined, true, undefined, this),
2099
+ memoryDisplayElement,
2100
+ /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedBox_default, {
2101
+ marginTop: 1,
2102
+ children: /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedText, {
2103
+ children: [
2104
+ /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedText, {
2105
+ bold: true,
2106
+ children: "Description"
2107
+ }, undefined, false, undefined, this),
2108
+ " (tells Claude when to use this agent):"
2109
+ ]
2110
+ }, undefined, true, undefined, this)
2111
+ }, undefined, false, undefined, this),
2112
+ /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedBox_default, {
2113
+ marginLeft: 2,
2114
+ marginTop: 1,
2115
+ children: /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedText, {
2116
+ children: whenToUsePreview
2117
+ }, undefined, false, undefined, this)
2118
+ }, undefined, false, undefined, this),
2119
+ /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedBox_default, {
2120
+ marginTop: 1,
2121
+ children: /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedText, {
2122
+ children: [
2123
+ /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedText, {
2124
+ bold: true,
2125
+ children: "System prompt"
2126
+ }, undefined, false, undefined, this),
2127
+ ":"
2128
+ ]
2129
+ }, undefined, true, undefined, this)
2130
+ }, undefined, false, undefined, this),
2131
+ /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedBox_default, {
2132
+ marginLeft: 2,
2133
+ marginTop: 1,
2134
+ children: /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedText, {
2135
+ children: systemPromptPreview
2136
+ }, undefined, false, undefined, this)
2137
+ }, undefined, false, undefined, this),
2138
+ validation.warnings.length > 0 && /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedBox_default, {
2139
+ marginTop: 1,
2140
+ flexDirection: "column",
2141
+ children: [
2142
+ /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedText, {
2143
+ color: "warning",
2144
+ children: "Warnings:"
2145
+ }, undefined, false, undefined, this),
2146
+ validation.warnings.map((warning, i) => /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedText, {
2147
+ dimColor: true,
2148
+ children: [
2149
+ " ",
2150
+ "\u2022 ",
2151
+ warning
2152
+ ]
2153
+ }, i, true, undefined, this))
2154
+ ]
2155
+ }, undefined, true, undefined, this),
2156
+ validation.errors.length > 0 && /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedBox_default, {
2157
+ marginTop: 1,
2158
+ flexDirection: "column",
2159
+ children: [
2160
+ /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedText, {
2161
+ color: "error",
2162
+ children: "Errors:"
2163
+ }, undefined, false, undefined, this),
2164
+ validation.errors.map((err, i) => /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedText, {
2165
+ color: "error",
2166
+ children: [
2167
+ " ",
2168
+ "\u2022 ",
2169
+ err
2170
+ ]
2171
+ }, i, true, undefined, this))
2172
+ ]
2173
+ }, undefined, true, undefined, this),
2174
+ error && /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedBox_default, {
2175
+ marginTop: 1,
2176
+ children: /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedText, {
2177
+ color: "error",
2178
+ children: error
2179
+ }, undefined, false, undefined, this)
2180
+ }, undefined, false, undefined, this),
2181
+ /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedBox_default, {
2182
+ marginTop: 2,
2183
+ children: /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedText, {
2184
+ color: "success",
2185
+ children: [
2186
+ "Press ",
2187
+ /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedText, {
2188
+ bold: true,
2189
+ children: "s"
2190
+ }, undefined, false, undefined, this),
2191
+ " or ",
2192
+ /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedText, {
2193
+ bold: true,
2194
+ children: "Enter"
2195
+ }, undefined, false, undefined, this),
2196
+ " to save,",
2197
+ " ",
2198
+ /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedText, {
2199
+ bold: true,
2200
+ children: "e"
2201
+ }, undefined, false, undefined, this),
2202
+ " to save and edit"
2203
+ ]
2204
+ }, undefined, true, undefined, this)
2205
+ }, undefined, false, undefined, this)
2206
+ ]
2207
+ }, undefined, true, undefined, this)
2208
+ }, undefined, false, undefined, this);
2209
+ }
2210
+ var jsx_dev_runtime12;
2211
+ var init_ConfirmStep = __esm(() => {
2212
+ init_src();
2213
+ init_useKeybinding();
2214
+ init_paths();
2215
+ init_agentMemory();
2216
+ init_format();
2217
+ init_agent();
2218
+ init_ConfigurableShortcutHint();
2219
+ init_wizard();
2220
+ init_WizardDialogLayout();
2221
+ init_agentFileUtils();
2222
+ init_validateAgent();
2223
+ jsx_dev_runtime12 = __toESM(require_jsx_dev_runtime(), 1);
2224
+ });
2225
+
2226
+ // src/components/agents/new-agent-creation/wizard-steps/ConfirmStepWrapper.tsx
2227
+ function ConfirmStepWrapper({
2228
+ tools,
2229
+ existingAgents,
2230
+ onComplete
2231
+ }) {
2232
+ const { wizardData } = useWizard();
2233
+ const [saveError, setSaveError] = import_react6.useState(null);
2234
+ const setAppState = useSetAppState();
2235
+ const saveAgent = import_react6.useCallback(async (openInEditor) => {
2236
+ if (!wizardData?.finalAgent)
2237
+ return;
2238
+ try {
2239
+ 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);
2240
+ setAppState((state) => {
2241
+ if (!wizardData.finalAgent)
2242
+ return state;
2243
+ const allAgents = state.agentDefinitions.allAgents.concat(wizardData.finalAgent);
2244
+ return {
2245
+ ...state,
2246
+ agentDefinitions: {
2247
+ ...state.agentDefinitions,
2248
+ activeAgents: getActiveAgentsFromList(allAgents),
2249
+ allAgents
2250
+ }
2251
+ };
2252
+ });
2253
+ if (openInEditor) {
2254
+ const filePath = getNewAgentFilePath({
2255
+ source: wizardData.location,
2256
+ agentType: wizardData.finalAgent.agentType
2257
+ });
2258
+ await editFileInEditor(filePath);
2259
+ }
2260
+ logEvent("tengu_agent_created", {
2261
+ agent_type: wizardData.finalAgent.agentType,
2262
+ generation_method: wizardData.wasGenerated ? "generated" : "manual",
2263
+ source: wizardData.location,
2264
+ tool_count: wizardData.finalAgent.tools?.length ?? "all",
2265
+ has_custom_model: !!wizardData.finalAgent.model,
2266
+ has_custom_color: !!wizardData.finalAgent.color,
2267
+ has_memory: !!wizardData.finalAgent.memory,
2268
+ memory_scope: wizardData.finalAgent.memory ?? "none",
2269
+ ...openInEditor ? { opened_in_editor: true } : {}
2270
+ });
2271
+ 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)}`;
2272
+ onComplete(message);
2273
+ } catch (err) {
2274
+ setSaveError(err instanceof Error ? err.message : "Failed to save agent");
2275
+ }
2276
+ }, [wizardData, onComplete, setAppState]);
2277
+ const handleSave = import_react6.useCallback(() => saveAgent(false), [saveAgent]);
2278
+ const handleSaveAndEdit = import_react6.useCallback(() => saveAgent(true), [saveAgent]);
2279
+ return /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(ConfirmStep, {
2280
+ tools,
2281
+ existingAgents,
2282
+ onSave: handleSave,
2283
+ onSaveAndEdit: handleSaveAndEdit,
2284
+ error: saveError
2285
+ }, undefined, false, undefined, this);
2286
+ }
2287
+ var import_react6, jsx_dev_runtime13;
2288
+ var init_ConfirmStepWrapper = __esm(() => {
2289
+ init_source();
2290
+ init_analytics();
2291
+ init_AppState();
2292
+ init_loadAgentsDir();
2293
+ init_promptEditor();
2294
+ init_wizard();
2295
+ init_agentFileUtils();
2296
+ init_ConfirmStep();
2297
+ import_react6 = __toESM(require_react(), 1);
2298
+ jsx_dev_runtime13 = __toESM(require_jsx_dev_runtime(), 1);
2299
+ });
2300
+
2301
+ // src/components/agents/new-agent-creation/wizard-steps/DescriptionStep.tsx
2302
+ function DescriptionStep() {
2303
+ const { goNext, goBack, updateWizardData, wizardData } = useWizard();
2304
+ const [whenToUse, setWhenToUse] = import_react7.useState(wizardData.whenToUse || "");
2305
+ const [cursorOffset, setCursorOffset] = import_react7.useState(whenToUse.length);
2306
+ const [error, setError] = import_react7.useState(null);
2307
+ useKeybinding("confirm:no", goBack, { context: "Settings" });
2308
+ const handleExternalEditor = import_react7.useCallback(async () => {
2309
+ const result = await editPromptInEditor(whenToUse);
2310
+ if (result.content !== null) {
2311
+ setWhenToUse(result.content);
2312
+ setCursorOffset(result.content.length);
2313
+ }
2314
+ }, [whenToUse]);
2315
+ useKeybinding("chat:externalEditor", handleExternalEditor, {
2316
+ context: "Chat"
2317
+ });
2318
+ const handleSubmit = (value) => {
2319
+ const trimmedValue = value.trim();
2320
+ if (!trimmedValue) {
2321
+ setError("Description is required");
2322
+ return;
2323
+ }
2324
+ setError(null);
2325
+ updateWizardData({ whenToUse: trimmedValue });
2326
+ goNext();
2327
+ };
2328
+ return /* @__PURE__ */ jsx_dev_runtime14.jsxDEV(WizardDialogLayout, {
2329
+ subtitle: "Description (tell Claude when to use this agent)",
2330
+ footerText: /* @__PURE__ */ jsx_dev_runtime14.jsxDEV(Byline, {
2331
+ children: [
2332
+ /* @__PURE__ */ jsx_dev_runtime14.jsxDEV(KeyboardShortcutHint, {
2333
+ shortcut: "Type",
2334
+ action: "enter text"
2335
+ }, undefined, false, undefined, this),
2336
+ /* @__PURE__ */ jsx_dev_runtime14.jsxDEV(KeyboardShortcutHint, {
2337
+ shortcut: "Enter",
2338
+ action: "continue"
2339
+ }, undefined, false, undefined, this),
2340
+ /* @__PURE__ */ jsx_dev_runtime14.jsxDEV(ConfigurableShortcutHint, {
2341
+ action: "chat:externalEditor",
2342
+ context: "Chat",
2343
+ fallback: "ctrl+g",
2344
+ description: "open in editor"
2345
+ }, undefined, false, undefined, this),
2346
+ /* @__PURE__ */ jsx_dev_runtime14.jsxDEV(ConfigurableShortcutHint, {
2347
+ action: "confirm:no",
2348
+ context: "Settings",
2349
+ fallback: "Esc",
2350
+ description: "go back"
2351
+ }, undefined, false, undefined, this)
2352
+ ]
2353
+ }, undefined, true, undefined, this),
2354
+ children: /* @__PURE__ */ jsx_dev_runtime14.jsxDEV(ThemedBox_default, {
2355
+ flexDirection: "column",
2356
+ children: [
2357
+ /* @__PURE__ */ jsx_dev_runtime14.jsxDEV(ThemedText, {
2358
+ children: "When should Claude use this agent?"
2359
+ }, undefined, false, undefined, this),
2360
+ /* @__PURE__ */ jsx_dev_runtime14.jsxDEV(ThemedBox_default, {
2361
+ marginTop: 1,
2362
+ children: /* @__PURE__ */ jsx_dev_runtime14.jsxDEV(TextInput, {
2363
+ value: whenToUse,
2364
+ onChange: setWhenToUse,
2365
+ onSubmit: handleSubmit,
2366
+ placeholder: "e.g., use this agent after you're done writing code...",
2367
+ columns: 80,
2368
+ cursorOffset,
2369
+ onChangeCursorOffset: setCursorOffset,
2370
+ focus: true,
2371
+ showCursor: true
2372
+ }, undefined, false, undefined, this)
2373
+ }, undefined, false, undefined, this),
2374
+ error && /* @__PURE__ */ jsx_dev_runtime14.jsxDEV(ThemedBox_default, {
2375
+ marginTop: 1,
2376
+ children: /* @__PURE__ */ jsx_dev_runtime14.jsxDEV(ThemedText, {
2377
+ color: "error",
2378
+ children: error
2379
+ }, undefined, false, undefined, this)
2380
+ }, undefined, false, undefined, this)
2381
+ ]
2382
+ }, undefined, true, undefined, this)
2383
+ }, undefined, false, undefined, this);
2384
+ }
2385
+ var import_react7, jsx_dev_runtime14;
2386
+ var init_DescriptionStep = __esm(() => {
2387
+ init_src();
2388
+ init_useKeybinding();
2389
+ init_promptEditor();
2390
+ init_ConfigurableShortcutHint();
2391
+ init_TextInput();
2392
+ init_wizard();
2393
+ init_WizardDialogLayout();
2394
+ import_react7 = __toESM(require_react(), 1);
2395
+ jsx_dev_runtime14 = __toESM(require_jsx_dev_runtime(), 1);
2396
+ });
2397
+
2398
+ // src/components/agents/generateAgent.ts
2399
+ async function generateAgent(userPrompt, model, existingIdentifiers, abortSignal) {
2400
+ const existingList = existingIdentifiers.length > 0 ? `
2401
+
2402
+ IMPORTANT: The following identifiers already exist and must NOT be used: ${existingIdentifiers.join(", ")}` : "";
2403
+ const prompt = `Create an agent configuration based on this request: "${userPrompt}".${existingList}
2404
+ Return ONLY the JSON object, no other text.`;
2405
+ const userMessage = createUserMessage({ content: prompt });
2406
+ const userContext = await getUserContext();
2407
+ const messagesWithContext = prependUserContext([userMessage], userContext);
2408
+ const systemPrompt = isAutoMemoryEnabled() ? AGENT_CREATION_SYSTEM_PROMPT + AGENT_MEMORY_INSTRUCTIONS : AGENT_CREATION_SYSTEM_PROMPT;
2409
+ const response = await queryModelWithoutStreaming({
2410
+ messages: normalizeMessagesForAPI(messagesWithContext),
2411
+ systemPrompt: asSystemPrompt([systemPrompt]),
2412
+ thinkingConfig: { type: "disabled" },
2413
+ tools: [],
2414
+ signal: abortSignal,
2415
+ options: {
2416
+ getToolPermissionContext: async () => getEmptyToolPermissionContext(),
2417
+ model,
2418
+ toolChoice: undefined,
2419
+ agents: [],
2420
+ isNonInteractiveSession: false,
2421
+ hasAppendSystemPrompt: false,
2422
+ querySource: "agent_creation",
2423
+ mcpTools: []
2424
+ }
2425
+ });
2426
+ const textBlocks = (Array.isArray(response.message.content) ? response.message.content : []).filter((block) => block.type === "text");
2427
+ const responseText = textBlocks.map((block) => block.text).join(`
2428
+ `);
2429
+ let parsed;
2430
+ try {
2431
+ parsed = jsonParse(responseText.trim());
2432
+ } catch {
2433
+ const jsonMatch = responseText.match(/\{[\s\S]*\}/);
2434
+ if (!jsonMatch) {
2435
+ throw new Error("No JSON object found in response");
2436
+ }
2437
+ parsed = jsonParse(jsonMatch[0]);
2438
+ }
2439
+ if (!parsed.identifier || !parsed.whenToUse || !parsed.systemPrompt) {
2440
+ throw new Error("Invalid agent configuration generated");
2441
+ }
2442
+ logEvent("tengu_agent_definition_generated", {
2443
+ agent_identifier: parsed.identifier
2444
+ });
2445
+ return {
2446
+ identifier: parsed.identifier,
2447
+ whenToUse: parsed.whenToUse,
2448
+ systemPrompt: parsed.systemPrompt
2449
+ };
2450
+ }
2451
+ var AGENT_CREATION_SYSTEM_PROMPT, AGENT_MEMORY_INSTRUCTIONS = `
2452
+
2453
+ 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.
2454
+
2455
+ Add a section like this to the systemPrompt, tailored to the agent's specific domain:
2456
+
2457
+ "**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.
2458
+
2459
+ Examples of what to record:
2460
+ - [domain-specific item 1]
2461
+ - [domain-specific item 2]
2462
+ - [domain-specific item 3]"
2463
+
2464
+ Examples of domain-specific memory instructions:
2465
+ - For a code-reviewer: "Update your agent memory as you discover code patterns, style conventions, common issues, and architectural decisions in this codebase."
2466
+ - For a test-runner: "Update your agent memory as you discover test patterns, common failure modes, flaky tests, and testing best practices."
2467
+ - For an architect: "Update your agent memory as you discover codepaths, library locations, key architectural decisions, and component relationships."
2468
+ - For a documentation writer: "Update your agent memory as you discover documentation patterns, API structures, and terminology conventions."
2469
+
2470
+ The memory instructions should be specific to what the agent would naturally learn while performing its core tasks.
2471
+ `;
2472
+ var init_generateAgent = __esm(() => {
2473
+ init_context();
2474
+ init_claude();
2475
+ init_Tool();
2476
+ init_constants2();
2477
+ init_api();
2478
+ init_messages();
2479
+ init_paths();
2480
+ init_analytics();
2481
+ init_slowOperations();
2482
+ init_systemPromptType();
2483
+ 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.
2484
+
2485
+ **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.
2486
+
2487
+ When a user describes what they want an agent to do, you will:
2488
+
2489
+ 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.
2490
+
2491
+ 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.
2492
+
2493
+ 3. **Architect Comprehensive Instructions**: Develop a system prompt that:
2494
+ - Establishes clear behavioral boundaries and operational parameters
2495
+ - Provides specific methodologies and best practices for task execution
2496
+ - Anticipates edge cases and provides guidance for handling them
2497
+ - Incorporates any specific requirements or preferences mentioned by the user
2498
+ - Defines output format expectations when relevant
2499
+ - Aligns with project-specific coding standards and patterns from CLAUDE.md
2500
+
2501
+ 4. **Optimize for Performance**: Include:
2502
+ - Decision-making frameworks appropriate to the domain
2503
+ - Quality control mechanisms and self-verification steps
2504
+ - Efficient workflow patterns
2505
+ - Clear escalation or fallback strategies
2506
+
2507
+ 5. **Create Identifier**: Design a concise, descriptive identifier that:
2508
+ - Uses lowercase letters, numbers, and hyphens only
2509
+ - Is typically 2-4 words joined by hyphens
2510
+ - Clearly indicates the agent's primary function
2511
+ - Is memorable and easy to type
2512
+ - Avoids generic terms like "helper" or "assistant"
2513
+
2514
+ 6 **Example agent descriptions**:
2515
+ - in the 'whenToUse' field of the JSON object, you should include examples of when this agent should be used.
2516
+ - examples should be of the form:
2517
+ - <example>
2518
+ Context: The user is creating a test-runner agent that should be called after a logical chunk of code is written.
2519
+ user: "Please write a function that checks if a number is prime"
2520
+ assistant: "Here is the relevant function: "
2521
+ <function call omitted for brevity only for this example>
2522
+ <commentary>
2523
+ Since a significant piece of code was written, use the ${AGENT_TOOL_NAME} tool to launch the test-runner agent to run the tests.
2524
+ </commentary>
2525
+ assistant: "Now let me use the test-runner agent to run the tests"
2526
+ </example>
2527
+ - <example>
2528
+ Context: User is creating an agent to respond to the word "hello" with a friendly jok.
2529
+ user: "Hello"
2530
+ assistant: "I'm going to use the ${AGENT_TOOL_NAME} tool to launch the greeting-responder agent to respond with a friendly joke"
2531
+ <commentary>
2532
+ Since the user is greeting, use the greeting-responder agent to respond with a friendly joke.
2533
+ </commentary>
2534
+ </example>
2535
+ - If the user mentioned or implied that the agent should be used proactively, you should include examples of this.
2536
+ - NOTE: Ensure that in the examples, you are making the assistant use the Agent tool and not simply respond directly to the task.
2537
+
2538
+ Your output must be a valid JSON object with exactly these fields:
2539
+ {
2540
+ "identifier": "A unique, descriptive identifier using lowercase letters, numbers, and hyphens (e.g., 'test-runner', 'api-docs-writer', 'code-formatter')",
2541
+ "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.",
2542
+ "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"
2543
+ }
2544
+
2545
+ Key principles for your system prompts:
2546
+ - Be specific rather than generic - avoid vague instructions
2547
+ - Include concrete examples when they would clarify behavior
2548
+ - Balance comprehensiveness with clarity - every instruction should add value
2549
+ - Ensure the agent has enough context to handle variations of the core task
2550
+ - Make the agent proactive in seeking clarification when needed
2551
+ - Build in quality assurance and self-correction mechanisms
2552
+
2553
+ 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.
2554
+ `;
2555
+ });
2556
+
2557
+ // src/components/agents/new-agent-creation/wizard-steps/GenerateStep.tsx
2558
+ function GenerateStep() {
2559
+ const { updateWizardData, goBack, goToStep, wizardData } = useWizard();
2560
+ const [prompt, setPrompt] = import_react8.useState(wizardData.generationPrompt || "");
2561
+ const [isGenerating, setIsGenerating] = import_react8.useState(false);
2562
+ const [error, setError] = import_react8.useState(null);
2563
+ const [cursorOffset, setCursorOffset] = import_react8.useState(prompt.length);
2564
+ const model = useMainLoopModel();
2565
+ const abortControllerRef = import_react8.useRef(null);
2566
+ const handleCancelGeneration = import_react8.useCallback(() => {
2567
+ if (abortControllerRef.current) {
2568
+ abortControllerRef.current.abort();
2569
+ abortControllerRef.current = null;
2570
+ setIsGenerating(false);
2571
+ setError("Generation cancelled");
2572
+ }
2573
+ }, []);
2574
+ useKeybinding("confirm:no", handleCancelGeneration, {
2575
+ context: "Settings",
2576
+ isActive: isGenerating
2577
+ });
2578
+ const handleExternalEditor = import_react8.useCallback(async () => {
2579
+ const result = await editPromptInEditor(prompt);
2580
+ if (result.content !== null) {
2581
+ setPrompt(result.content);
2582
+ setCursorOffset(result.content.length);
2583
+ }
2584
+ }, [prompt]);
2585
+ useKeybinding("chat:externalEditor", handleExternalEditor, {
2586
+ context: "Chat",
2587
+ isActive: !isGenerating
2588
+ });
2589
+ const handleGoBack = import_react8.useCallback(() => {
2590
+ updateWizardData({
2591
+ generationPrompt: "",
2592
+ agentType: "",
2593
+ systemPrompt: "",
2594
+ whenToUse: "",
2595
+ generatedAgent: undefined,
2596
+ wasGenerated: false
2597
+ });
2598
+ setPrompt("");
2599
+ setError(null);
2600
+ goBack();
2601
+ }, [updateWizardData, goBack]);
2602
+ useKeybinding("confirm:no", handleGoBack, {
2603
+ context: "Settings",
2604
+ isActive: !isGenerating
2605
+ });
2606
+ const handleGenerate = async () => {
2607
+ const trimmedPrompt = prompt.trim();
2608
+ if (!trimmedPrompt) {
2609
+ setError("Please describe what the agent should do");
2610
+ return;
2611
+ }
2612
+ setError(null);
2613
+ setIsGenerating(true);
2614
+ updateWizardData({
2615
+ generationPrompt: trimmedPrompt,
2616
+ isGenerating: true
2617
+ });
2618
+ const controller = createAbortController();
2619
+ abortControllerRef.current = controller;
2620
+ try {
2621
+ const generated = await generateAgent(trimmedPrompt, model, [], controller.signal);
2622
+ updateWizardData({
2623
+ agentType: generated.identifier,
2624
+ whenToUse: generated.whenToUse,
2625
+ systemPrompt: generated.systemPrompt,
2626
+ generatedAgent: generated,
2627
+ isGenerating: false,
2628
+ wasGenerated: true
2629
+ });
2630
+ goToStep(6);
2631
+ } catch (err) {
2632
+ if (err instanceof APIUserAbortError) {} else if (err instanceof Error && !err.message.includes("No assistant message found")) {
2633
+ setError(err.message || "Failed to generate agent");
2634
+ }
2635
+ updateWizardData({ isGenerating: false });
2636
+ } finally {
2637
+ setIsGenerating(false);
2638
+ abortControllerRef.current = null;
2639
+ }
2640
+ };
2641
+ const subtitle = "Describe what this agent should do and when it should be used (be comprehensive for best results)";
2642
+ if (isGenerating) {
2643
+ return /* @__PURE__ */ jsx_dev_runtime15.jsxDEV(WizardDialogLayout, {
2644
+ subtitle,
2645
+ footerText: /* @__PURE__ */ jsx_dev_runtime15.jsxDEV(ConfigurableShortcutHint, {
2646
+ action: "confirm:no",
2647
+ context: "Settings",
2648
+ fallback: "Esc",
2649
+ description: "cancel"
2650
+ }, undefined, false, undefined, this),
2651
+ children: /* @__PURE__ */ jsx_dev_runtime15.jsxDEV(ThemedBox_default, {
2652
+ flexDirection: "row",
2653
+ alignItems: "center",
2654
+ children: [
2655
+ /* @__PURE__ */ jsx_dev_runtime15.jsxDEV(Spinner, {}, undefined, false, undefined, this),
2656
+ /* @__PURE__ */ jsx_dev_runtime15.jsxDEV(ThemedText, {
2657
+ color: "suggestion",
2658
+ children: " Generating agent from description..."
2659
+ }, undefined, false, undefined, this)
2660
+ ]
2661
+ }, undefined, true, undefined, this)
2662
+ }, undefined, false, undefined, this);
2663
+ }
2664
+ return /* @__PURE__ */ jsx_dev_runtime15.jsxDEV(WizardDialogLayout, {
2665
+ subtitle,
2666
+ footerText: /* @__PURE__ */ jsx_dev_runtime15.jsxDEV(Byline, {
2667
+ children: [
2668
+ /* @__PURE__ */ jsx_dev_runtime15.jsxDEV(ConfigurableShortcutHint, {
2669
+ action: "confirm:yes",
2670
+ context: "Confirmation",
2671
+ fallback: "Enter",
2672
+ description: "submit"
2673
+ }, undefined, false, undefined, this),
2674
+ /* @__PURE__ */ jsx_dev_runtime15.jsxDEV(ConfigurableShortcutHint, {
2675
+ action: "chat:externalEditor",
2676
+ context: "Chat",
2677
+ fallback: "ctrl+g",
2678
+ description: "open in editor"
2679
+ }, undefined, false, undefined, this),
2680
+ /* @__PURE__ */ jsx_dev_runtime15.jsxDEV(ConfigurableShortcutHint, {
2681
+ action: "confirm:no",
2682
+ context: "Settings",
2683
+ fallback: "Esc",
2684
+ description: "go back"
2685
+ }, undefined, false, undefined, this)
2686
+ ]
2687
+ }, undefined, true, undefined, this),
2688
+ children: /* @__PURE__ */ jsx_dev_runtime15.jsxDEV(ThemedBox_default, {
2689
+ flexDirection: "column",
2690
+ children: [
2691
+ error && /* @__PURE__ */ jsx_dev_runtime15.jsxDEV(ThemedBox_default, {
2692
+ marginBottom: 1,
2693
+ children: /* @__PURE__ */ jsx_dev_runtime15.jsxDEV(ThemedText, {
2694
+ color: "error",
2695
+ children: error
2696
+ }, undefined, false, undefined, this)
2697
+ }, undefined, false, undefined, this),
2698
+ /* @__PURE__ */ jsx_dev_runtime15.jsxDEV(TextInput, {
2699
+ value: prompt,
2700
+ onChange: setPrompt,
2701
+ onSubmit: handleGenerate,
2702
+ placeholder: "e.g., Help me write unit tests for my code...",
2703
+ columns: 80,
2704
+ cursorOffset,
2705
+ onChangeCursorOffset: setCursorOffset,
2706
+ focus: true,
2707
+ showCursor: true
2708
+ }, undefined, false, undefined, this)
2709
+ ]
2710
+ }, undefined, true, undefined, this)
2711
+ }, undefined, false, undefined, this);
2712
+ }
2713
+ var import_react8, jsx_dev_runtime15;
2714
+ var init_GenerateStep = __esm(() => {
2715
+ init_sdk();
2716
+ init_useMainLoopModel();
2717
+ init_src();
2718
+ init_useKeybinding();
2719
+ init_abortController();
2720
+ init_promptEditor();
2721
+ init_ConfigurableShortcutHint();
2722
+ init_Spinner();
2723
+ init_TextInput();
2724
+ init_wizard();
2725
+ init_WizardDialogLayout();
2726
+ init_generateAgent();
2727
+ import_react8 = __toESM(require_react(), 1);
2728
+ jsx_dev_runtime15 = __toESM(require_jsx_dev_runtime(), 1);
2729
+ });
2730
+
2731
+ // src/components/agents/new-agent-creation/wizard-steps/LocationStep.tsx
2732
+ function LocationStep() {
2733
+ const { goNext, updateWizardData, cancel } = useWizard();
2734
+ const locationOptions = [
2735
+ {
2736
+ label: "Project (.claude/agents/)",
2737
+ value: "projectSettings"
2738
+ },
2739
+ {
2740
+ label: "Personal (~/.claude/agents/)",
2741
+ value: "userSettings"
2742
+ }
2743
+ ];
2744
+ return /* @__PURE__ */ jsx_dev_runtime16.jsxDEV(WizardDialogLayout, {
2745
+ subtitle: "Choose location",
2746
+ footerText: /* @__PURE__ */ jsx_dev_runtime16.jsxDEV(Byline, {
2747
+ children: [
2748
+ /* @__PURE__ */ jsx_dev_runtime16.jsxDEV(KeyboardShortcutHint, {
2749
+ shortcut: "\u2191\u2193",
2750
+ action: "navigate"
2751
+ }, undefined, false, undefined, this),
2752
+ /* @__PURE__ */ jsx_dev_runtime16.jsxDEV(KeyboardShortcutHint, {
2753
+ shortcut: "Enter",
2754
+ action: "select"
2755
+ }, undefined, false, undefined, this),
2756
+ /* @__PURE__ */ jsx_dev_runtime16.jsxDEV(ConfigurableShortcutHint, {
2757
+ action: "confirm:no",
2758
+ context: "Confirmation",
2759
+ fallback: "Esc",
2760
+ description: "cancel"
2761
+ }, undefined, false, undefined, this)
2762
+ ]
2763
+ }, undefined, true, undefined, this),
2764
+ children: /* @__PURE__ */ jsx_dev_runtime16.jsxDEV(ThemedBox_default, {
2765
+ children: /* @__PURE__ */ jsx_dev_runtime16.jsxDEV(Select, {
2766
+ options: locationOptions,
2767
+ onChange: (value) => {
2768
+ updateWizardData({ location: value });
2769
+ goNext();
2770
+ },
2771
+ onCancel: () => cancel()
2772
+ }, "location-select", false, undefined, this)
2773
+ }, undefined, false, undefined, this)
2774
+ }, undefined, false, undefined, this);
2775
+ }
2776
+ var jsx_dev_runtime16;
2777
+ var init_LocationStep = __esm(() => {
2778
+ init_src();
2779
+ init_ConfigurableShortcutHint();
2780
+ init_select();
2781
+ init_wizard();
2782
+ init_WizardDialogLayout();
2783
+ jsx_dev_runtime16 = __toESM(require_jsx_dev_runtime(), 1);
2784
+ });
2785
+
2786
+ // src/components/agents/new-agent-creation/wizard-steps/MemoryStep.tsx
2787
+ function MemoryStep() {
2788
+ const { goNext, goBack, updateWizardData, wizardData } = useWizard();
2789
+ useKeybinding("confirm:no", goBack, { context: "Confirmation" });
2790
+ const isUserScope = wizardData.location === "userSettings";
2791
+ const memoryOptions = isUserScope ? [
2792
+ {
2793
+ label: "User scope (~/.claude/agent-memory/) (Recommended)",
2794
+ value: "user"
2795
+ },
2796
+ { label: "None (no persistent memory)", value: "none" },
2797
+ { label: "Project scope (.claude/agent-memory/)", value: "project" },
2798
+ { label: "Local scope (.claude/agent-memory-local/)", value: "local" }
2799
+ ] : [
2800
+ {
2801
+ label: "Project scope (.claude/agent-memory/) (Recommended)",
2802
+ value: "project"
2803
+ },
2804
+ { label: "None (no persistent memory)", value: "none" },
2805
+ { label: "User scope (~/.claude/agent-memory/)", value: "user" },
2806
+ { label: "Local scope (.claude/agent-memory-local/)", value: "local" }
2807
+ ];
2808
+ const handleSelect = (value) => {
2809
+ const memory = value === "none" ? undefined : value;
2810
+ const agentType = wizardData.finalAgent?.agentType;
2811
+ updateWizardData({
2812
+ selectedMemory: memory,
2813
+ finalAgent: wizardData.finalAgent ? {
2814
+ ...wizardData.finalAgent,
2815
+ memory,
2816
+ getSystemPrompt: isAutoMemoryEnabled() && memory && agentType ? () => wizardData.systemPrompt + `
2817
+
2818
+ ` + loadAgentMemoryPrompt(agentType, memory) : () => wizardData.systemPrompt
2819
+ } : undefined
2820
+ });
2821
+ goNext();
2822
+ };
2823
+ return /* @__PURE__ */ jsx_dev_runtime17.jsxDEV(WizardDialogLayout, {
2824
+ subtitle: "Configure agent memory",
2825
+ footerText: /* @__PURE__ */ jsx_dev_runtime17.jsxDEV(Byline, {
2826
+ children: [
2827
+ /* @__PURE__ */ jsx_dev_runtime17.jsxDEV(KeyboardShortcutHint, {
2828
+ shortcut: "\u2191\u2193",
2829
+ action: "navigate"
2830
+ }, undefined, false, undefined, this),
2831
+ /* @__PURE__ */ jsx_dev_runtime17.jsxDEV(KeyboardShortcutHint, {
2832
+ shortcut: "Enter",
2833
+ action: "select"
2834
+ }, undefined, false, undefined, this),
2835
+ /* @__PURE__ */ jsx_dev_runtime17.jsxDEV(ConfigurableShortcutHint, {
2836
+ action: "confirm:no",
2837
+ context: "Confirmation",
2838
+ fallback: "Esc",
2839
+ description: "go back"
2840
+ }, undefined, false, undefined, this)
2841
+ ]
2842
+ }, undefined, true, undefined, this),
2843
+ children: /* @__PURE__ */ jsx_dev_runtime17.jsxDEV(ThemedBox_default, {
2844
+ children: /* @__PURE__ */ jsx_dev_runtime17.jsxDEV(Select, {
2845
+ options: memoryOptions,
2846
+ onChange: handleSelect,
2847
+ onCancel: goBack
2848
+ }, "memory-select", false, undefined, this)
2849
+ }, undefined, false, undefined, this)
2850
+ }, undefined, false, undefined, this);
2851
+ }
2852
+ var jsx_dev_runtime17;
2853
+ var init_MemoryStep = __esm(() => {
2854
+ init_src();
2855
+ init_useKeybinding();
2856
+ init_paths();
2857
+ init_agentMemory();
2858
+ init_ConfigurableShortcutHint();
2859
+ init_select();
2860
+ init_wizard();
2861
+ init_WizardDialogLayout();
2862
+ jsx_dev_runtime17 = __toESM(require_jsx_dev_runtime(), 1);
2863
+ });
2864
+
2865
+ // src/components/agents/new-agent-creation/wizard-steps/MethodStep.tsx
2866
+ function MethodStep() {
2867
+ const { goNext, goBack, updateWizardData, goToStep } = useWizard();
2868
+ const methodOptions = [
2869
+ {
2870
+ label: "Generate with Claude (recommended)",
2871
+ value: "generate"
2872
+ },
2873
+ {
2874
+ label: "Manual configuration",
2875
+ value: "manual"
2876
+ }
2877
+ ];
2878
+ return /* @__PURE__ */ jsx_dev_runtime18.jsxDEV(WizardDialogLayout, {
2879
+ subtitle: "Creation method",
2880
+ footerText: /* @__PURE__ */ jsx_dev_runtime18.jsxDEV(Byline, {
2881
+ children: [
2882
+ /* @__PURE__ */ jsx_dev_runtime18.jsxDEV(KeyboardShortcutHint, {
2883
+ shortcut: "\u2191\u2193",
2884
+ action: "navigate"
2885
+ }, undefined, false, undefined, this),
2886
+ /* @__PURE__ */ jsx_dev_runtime18.jsxDEV(KeyboardShortcutHint, {
2887
+ shortcut: "Enter",
2888
+ action: "select"
2889
+ }, undefined, false, undefined, this),
2890
+ /* @__PURE__ */ jsx_dev_runtime18.jsxDEV(ConfigurableShortcutHint, {
2891
+ action: "confirm:no",
2892
+ context: "Confirmation",
2893
+ fallback: "Esc",
2894
+ description: "go back"
2895
+ }, undefined, false, undefined, this)
2896
+ ]
2897
+ }, undefined, true, undefined, this),
2898
+ children: /* @__PURE__ */ jsx_dev_runtime18.jsxDEV(ThemedBox_default, {
2899
+ children: /* @__PURE__ */ jsx_dev_runtime18.jsxDEV(Select, {
2900
+ options: methodOptions,
2901
+ onChange: (value) => {
2902
+ const method = value;
2903
+ updateWizardData({
2904
+ method,
2905
+ wasGenerated: method === "generate"
2906
+ });
2907
+ if (method === "generate") {
2908
+ goNext();
2909
+ } else {
2910
+ goToStep(3);
2911
+ }
2912
+ },
2913
+ onCancel: () => goBack()
2914
+ }, "method-select", false, undefined, this)
2915
+ }, undefined, false, undefined, this)
2916
+ }, undefined, false, undefined, this);
2917
+ }
2918
+ var jsx_dev_runtime18;
2919
+ var init_MethodStep = __esm(() => {
2920
+ init_src();
2921
+ init_ConfigurableShortcutHint();
2922
+ init_select();
2923
+ init_wizard();
2924
+ init_WizardDialogLayout();
2925
+ jsx_dev_runtime18 = __toESM(require_jsx_dev_runtime(), 1);
2926
+ });
2927
+
2928
+ // src/components/agents/new-agent-creation/wizard-steps/ModelStep.tsx
2929
+ function ModelStep() {
2930
+ const { goNext, goBack, updateWizardData, wizardData } = useWizard();
2931
+ const handleComplete = (model) => {
2932
+ updateWizardData({ selectedModel: model });
2933
+ goNext();
2934
+ };
2935
+ return /* @__PURE__ */ jsx_dev_runtime19.jsxDEV(WizardDialogLayout, {
2936
+ subtitle: "Select model",
2937
+ footerText: /* @__PURE__ */ jsx_dev_runtime19.jsxDEV(Byline, {
2938
+ children: [
2939
+ /* @__PURE__ */ jsx_dev_runtime19.jsxDEV(KeyboardShortcutHint, {
2940
+ shortcut: "\u2191\u2193",
2941
+ action: "navigate"
2942
+ }, undefined, false, undefined, this),
2943
+ /* @__PURE__ */ jsx_dev_runtime19.jsxDEV(KeyboardShortcutHint, {
2944
+ shortcut: "Enter",
2945
+ action: "select"
2946
+ }, undefined, false, undefined, this),
2947
+ /* @__PURE__ */ jsx_dev_runtime19.jsxDEV(ConfigurableShortcutHint, {
2948
+ action: "confirm:no",
2949
+ context: "Confirmation",
2950
+ fallback: "Esc",
2951
+ description: "go back"
2952
+ }, undefined, false, undefined, this)
2953
+ ]
2954
+ }, undefined, true, undefined, this),
2955
+ children: /* @__PURE__ */ jsx_dev_runtime19.jsxDEV(ModelSelector, {
2956
+ initialModel: wizardData.selectedModel,
2957
+ onComplete: handleComplete,
2958
+ onCancel: goBack
2959
+ }, undefined, false, undefined, this)
2960
+ }, undefined, false, undefined, this);
2961
+ }
2962
+ var jsx_dev_runtime19;
2963
+ var init_ModelStep = __esm(() => {
2964
+ init_ConfigurableShortcutHint();
2965
+ init_src();
2966
+ init_wizard();
2967
+ init_WizardDialogLayout();
2968
+ init_ModelSelector();
2969
+ jsx_dev_runtime19 = __toESM(require_jsx_dev_runtime(), 1);
2970
+ });
2971
+
2972
+ // src/components/agents/new-agent-creation/wizard-steps/PromptStep.tsx
2973
+ function PromptStep() {
2974
+ const { goNext, goBack, updateWizardData, wizardData } = useWizard();
2975
+ const [systemPrompt, setSystemPrompt] = import_react9.useState(wizardData.systemPrompt || "");
2976
+ const [cursorOffset, setCursorOffset] = import_react9.useState(systemPrompt.length);
2977
+ const [error, setError] = import_react9.useState(null);
2978
+ useKeybinding("confirm:no", goBack, { context: "Settings" });
2979
+ const handleExternalEditor = import_react9.useCallback(async () => {
2980
+ const result = await editPromptInEditor(systemPrompt);
2981
+ if (result.content !== null) {
2982
+ setSystemPrompt(result.content);
2983
+ setCursorOffset(result.content.length);
2984
+ }
2985
+ }, [systemPrompt]);
2986
+ useKeybinding("chat:externalEditor", handleExternalEditor, {
2987
+ context: "Chat"
2988
+ });
2989
+ const handleSubmit = () => {
2990
+ const trimmedPrompt = systemPrompt.trim();
2991
+ if (!trimmedPrompt) {
2992
+ setError("System prompt is required");
2993
+ return;
2994
+ }
2995
+ setError(null);
2996
+ updateWizardData({ systemPrompt: trimmedPrompt });
2997
+ goNext();
2998
+ };
2999
+ return /* @__PURE__ */ jsx_dev_runtime20.jsxDEV(WizardDialogLayout, {
3000
+ subtitle: "System prompt",
3001
+ footerText: /* @__PURE__ */ jsx_dev_runtime20.jsxDEV(Byline, {
3002
+ children: [
3003
+ /* @__PURE__ */ jsx_dev_runtime20.jsxDEV(KeyboardShortcutHint, {
3004
+ shortcut: "Type",
3005
+ action: "enter text"
3006
+ }, undefined, false, undefined, this),
3007
+ /* @__PURE__ */ jsx_dev_runtime20.jsxDEV(KeyboardShortcutHint, {
3008
+ shortcut: "Enter",
3009
+ action: "continue"
3010
+ }, undefined, false, undefined, this),
3011
+ /* @__PURE__ */ jsx_dev_runtime20.jsxDEV(ConfigurableShortcutHint, {
3012
+ action: "chat:externalEditor",
3013
+ context: "Chat",
3014
+ fallback: "ctrl+g",
3015
+ description: "open in editor"
3016
+ }, undefined, false, undefined, this),
3017
+ /* @__PURE__ */ jsx_dev_runtime20.jsxDEV(ConfigurableShortcutHint, {
3018
+ action: "confirm:no",
3019
+ context: "Settings",
3020
+ fallback: "Esc",
3021
+ description: "go back"
3022
+ }, undefined, false, undefined, this)
3023
+ ]
3024
+ }, undefined, true, undefined, this),
3025
+ children: /* @__PURE__ */ jsx_dev_runtime20.jsxDEV(ThemedBox_default, {
3026
+ flexDirection: "column",
3027
+ children: [
3028
+ /* @__PURE__ */ jsx_dev_runtime20.jsxDEV(ThemedText, {
3029
+ children: "Enter the system prompt for your agent:"
3030
+ }, undefined, false, undefined, this),
3031
+ /* @__PURE__ */ jsx_dev_runtime20.jsxDEV(ThemedText, {
3032
+ dimColor: true,
3033
+ children: "Be comprehensive for best results"
3034
+ }, undefined, false, undefined, this),
3035
+ /* @__PURE__ */ jsx_dev_runtime20.jsxDEV(ThemedBox_default, {
3036
+ marginTop: 1,
3037
+ children: /* @__PURE__ */ jsx_dev_runtime20.jsxDEV(TextInput, {
3038
+ value: systemPrompt,
3039
+ onChange: setSystemPrompt,
3040
+ onSubmit: handleSubmit,
3041
+ placeholder: "You are a helpful code reviewer who...",
3042
+ columns: 80,
3043
+ cursorOffset,
3044
+ onChangeCursorOffset: setCursorOffset,
3045
+ focus: true,
3046
+ showCursor: true
3047
+ }, undefined, false, undefined, this)
3048
+ }, undefined, false, undefined, this),
3049
+ error && /* @__PURE__ */ jsx_dev_runtime20.jsxDEV(ThemedBox_default, {
3050
+ marginTop: 1,
3051
+ children: /* @__PURE__ */ jsx_dev_runtime20.jsxDEV(ThemedText, {
3052
+ color: "error",
3053
+ children: error
3054
+ }, undefined, false, undefined, this)
3055
+ }, undefined, false, undefined, this)
3056
+ ]
3057
+ }, undefined, true, undefined, this)
3058
+ }, undefined, false, undefined, this);
3059
+ }
3060
+ var import_react9, jsx_dev_runtime20;
3061
+ var init_PromptStep = __esm(() => {
3062
+ init_src();
3063
+ init_useKeybinding();
3064
+ init_promptEditor();
3065
+ init_ConfigurableShortcutHint();
3066
+ init_TextInput();
3067
+ init_wizard();
3068
+ init_WizardDialogLayout();
3069
+ import_react9 = __toESM(require_react(), 1);
3070
+ jsx_dev_runtime20 = __toESM(require_jsx_dev_runtime(), 1);
3071
+ });
3072
+
3073
+ // src/components/agents/new-agent-creation/wizard-steps/ToolsStep.tsx
3074
+ function ToolsStep({ tools }) {
3075
+ const { goNext, goBack, updateWizardData, wizardData } = useWizard();
3076
+ const handleComplete = (selectedTools) => {
3077
+ updateWizardData({ selectedTools });
3078
+ goNext();
3079
+ };
3080
+ const initialTools = wizardData.selectedTools;
3081
+ return /* @__PURE__ */ jsx_dev_runtime21.jsxDEV(WizardDialogLayout, {
3082
+ subtitle: "Select tools",
3083
+ footerText: /* @__PURE__ */ jsx_dev_runtime21.jsxDEV(Byline, {
3084
+ children: [
3085
+ /* @__PURE__ */ jsx_dev_runtime21.jsxDEV(KeyboardShortcutHint, {
3086
+ shortcut: "Enter",
3087
+ action: "toggle selection"
3088
+ }, undefined, false, undefined, this),
3089
+ /* @__PURE__ */ jsx_dev_runtime21.jsxDEV(KeyboardShortcutHint, {
3090
+ shortcut: "\u2191\u2193",
3091
+ action: "navigate"
3092
+ }, undefined, false, undefined, this),
3093
+ /* @__PURE__ */ jsx_dev_runtime21.jsxDEV(ConfigurableShortcutHint, {
3094
+ action: "confirm:no",
3095
+ context: "Confirmation",
3096
+ fallback: "Esc",
3097
+ description: "go back"
3098
+ }, undefined, false, undefined, this)
3099
+ ]
3100
+ }, undefined, true, undefined, this),
3101
+ children: /* @__PURE__ */ jsx_dev_runtime21.jsxDEV(ToolSelector, {
3102
+ tools,
3103
+ initialTools,
3104
+ onComplete: handleComplete,
3105
+ onCancel: goBack
3106
+ }, undefined, false, undefined, this)
3107
+ }, undefined, false, undefined, this);
3108
+ }
3109
+ var jsx_dev_runtime21;
3110
+ var init_ToolsStep = __esm(() => {
3111
+ init_src();
3112
+ init_ConfigurableShortcutHint();
3113
+ init_wizard();
3114
+ init_WizardDialogLayout();
3115
+ init_ToolSelector();
3116
+ jsx_dev_runtime21 = __toESM(require_jsx_dev_runtime(), 1);
3117
+ });
3118
+
3119
+ // src/components/agents/new-agent-creation/wizard-steps/TypeStep.tsx
3120
+ function TypeStep(_props) {
3121
+ const { goNext, goBack, updateWizardData, wizardData } = useWizard();
3122
+ const [agentType, setAgentType] = import_react10.useState(wizardData.agentType || "");
3123
+ const [error, setError] = import_react10.useState(null);
3124
+ const [cursorOffset, setCursorOffset] = import_react10.useState(agentType.length);
3125
+ useKeybinding("confirm:no", goBack, { context: "Settings" });
3126
+ const handleSubmit = (value) => {
3127
+ const trimmedValue = value.trim();
3128
+ const validationError = validateAgentType(trimmedValue);
3129
+ if (validationError) {
3130
+ setError(validationError);
3131
+ return;
3132
+ }
3133
+ setError(null);
3134
+ updateWizardData({ agentType: trimmedValue });
3135
+ goNext();
3136
+ };
3137
+ return /* @__PURE__ */ jsx_dev_runtime22.jsxDEV(WizardDialogLayout, {
3138
+ subtitle: "Agent type (identifier)",
3139
+ footerText: /* @__PURE__ */ jsx_dev_runtime22.jsxDEV(Byline, {
3140
+ children: [
3141
+ /* @__PURE__ */ jsx_dev_runtime22.jsxDEV(KeyboardShortcutHint, {
3142
+ shortcut: "Type",
3143
+ action: "enter text"
3144
+ }, undefined, false, undefined, this),
3145
+ /* @__PURE__ */ jsx_dev_runtime22.jsxDEV(KeyboardShortcutHint, {
3146
+ shortcut: "Enter",
3147
+ action: "continue"
3148
+ }, undefined, false, undefined, this),
3149
+ /* @__PURE__ */ jsx_dev_runtime22.jsxDEV(ConfigurableShortcutHint, {
3150
+ action: "confirm:no",
3151
+ context: "Settings",
3152
+ fallback: "Esc",
3153
+ description: "go back"
3154
+ }, undefined, false, undefined, this)
3155
+ ]
3156
+ }, undefined, true, undefined, this),
3157
+ children: /* @__PURE__ */ jsx_dev_runtime22.jsxDEV(ThemedBox_default, {
3158
+ flexDirection: "column",
3159
+ children: [
3160
+ /* @__PURE__ */ jsx_dev_runtime22.jsxDEV(ThemedText, {
3161
+ children: "Enter a unique identifier for your agent:"
3162
+ }, undefined, false, undefined, this),
3163
+ /* @__PURE__ */ jsx_dev_runtime22.jsxDEV(ThemedBox_default, {
3164
+ marginTop: 1,
3165
+ children: /* @__PURE__ */ jsx_dev_runtime22.jsxDEV(TextInput, {
3166
+ value: agentType,
3167
+ onChange: setAgentType,
3168
+ onSubmit: handleSubmit,
3169
+ placeholder: "e.g., test-runner, tech-lead, etc",
3170
+ columns: 60,
3171
+ cursorOffset,
3172
+ onChangeCursorOffset: setCursorOffset,
3173
+ focus: true,
3174
+ showCursor: true
3175
+ }, undefined, false, undefined, this)
3176
+ }, undefined, false, undefined, this),
3177
+ error && /* @__PURE__ */ jsx_dev_runtime22.jsxDEV(ThemedBox_default, {
3178
+ marginTop: 1,
3179
+ children: /* @__PURE__ */ jsx_dev_runtime22.jsxDEV(ThemedText, {
3180
+ color: "error",
3181
+ children: error
3182
+ }, undefined, false, undefined, this)
3183
+ }, undefined, false, undefined, this)
3184
+ ]
3185
+ }, undefined, true, undefined, this)
3186
+ }, undefined, false, undefined, this);
3187
+ }
3188
+ var import_react10, jsx_dev_runtime22;
3189
+ var init_TypeStep = __esm(() => {
3190
+ init_src();
3191
+ init_useKeybinding();
3192
+ init_ConfigurableShortcutHint();
3193
+ init_TextInput();
3194
+ init_wizard();
3195
+ init_WizardDialogLayout();
3196
+ init_validateAgent();
3197
+ import_react10 = __toESM(require_react(), 1);
3198
+ jsx_dev_runtime22 = __toESM(require_jsx_dev_runtime(), 1);
3199
+ });
3200
+
3201
+ // src/components/agents/new-agent-creation/CreateAgentWizard.tsx
3202
+ function CreateAgentWizard({
3203
+ tools,
3204
+ existingAgents,
3205
+ onComplete,
3206
+ onCancel
3207
+ }) {
3208
+ const steps = [
3209
+ LocationStep,
3210
+ MethodStep,
3211
+ GenerateStep,
3212
+ () => /* @__PURE__ */ jsx_dev_runtime23.jsxDEV(TypeStep, {
3213
+ existingAgents
3214
+ }, undefined, false, undefined, this),
3215
+ PromptStep,
3216
+ DescriptionStep,
3217
+ () => /* @__PURE__ */ jsx_dev_runtime23.jsxDEV(ToolsStep, {
3218
+ tools
3219
+ }, undefined, false, undefined, this),
3220
+ ModelStep,
3221
+ ColorStep,
3222
+ ...isAutoMemoryEnabled() ? [MemoryStep] : [],
3223
+ () => /* @__PURE__ */ jsx_dev_runtime23.jsxDEV(ConfirmStepWrapper, {
3224
+ tools,
3225
+ existingAgents,
3226
+ onComplete
3227
+ }, undefined, false, undefined, this)
3228
+ ];
3229
+ return /* @__PURE__ */ jsx_dev_runtime23.jsxDEV(WizardProvider, {
3230
+ steps,
3231
+ initialData: {},
3232
+ onComplete: () => {},
3233
+ onCancel,
3234
+ title: "Create new agent",
3235
+ showStepCounter: false
3236
+ }, undefined, false, undefined, this);
3237
+ }
3238
+ var jsx_dev_runtime23;
3239
+ var init_CreateAgentWizard = __esm(() => {
3240
+ init_paths();
3241
+ init_wizard();
3242
+ init_ColorStep();
3243
+ init_ConfirmStepWrapper();
3244
+ init_DescriptionStep();
3245
+ init_GenerateStep();
3246
+ init_LocationStep();
3247
+ init_MemoryStep();
3248
+ init_MethodStep();
3249
+ init_ModelStep();
3250
+ init_PromptStep();
3251
+ init_ToolsStep();
3252
+ init_TypeStep();
3253
+ jsx_dev_runtime23 = __toESM(require_jsx_dev_runtime(), 1);
3254
+ });
3255
+
3256
+ // src/components/agents/AgentsMenu.tsx
3257
+ function AgentsMenu({ tools, onExit }) {
3258
+ const [modeState, setModeState] = import_react11.useState({
3259
+ mode: "list-agents",
3260
+ source: "all"
3261
+ });
3262
+ const agentDefinitions = useAppState((s) => s.agentDefinitions);
3263
+ const mcpTools = useAppState((s) => s.mcp.tools);
3264
+ const toolPermissionContext = useAppState((s) => s.toolPermissionContext);
3265
+ const setAppState = useSetAppState();
3266
+ const { allAgents, activeAgents: agents } = agentDefinitions;
3267
+ const [changes, setChanges] = import_react11.useState([]);
3268
+ const mergedTools = useMergedTools(tools, mcpTools, toolPermissionContext);
3269
+ useExitOnCtrlCDWithKeybindings();
3270
+ const agentsBySource = import_react11.useMemo(() => ({
3271
+ "built-in": allAgents.filter((a) => a.source === "built-in"),
3272
+ userSettings: allAgents.filter((a) => a.source === "userSettings"),
3273
+ projectSettings: allAgents.filter((a) => a.source === "projectSettings"),
3274
+ policySettings: allAgents.filter((a) => a.source === "policySettings"),
3275
+ localSettings: allAgents.filter((a) => a.source === "localSettings"),
3276
+ flagSettings: allAgents.filter((a) => a.source === "flagSettings"),
3277
+ plugin: allAgents.filter((a) => a.source === "plugin"),
3278
+ all: allAgents
3279
+ }), [allAgents]);
3280
+ const handleAgentCreated = import_react11.useCallback((message) => {
3281
+ setChanges((prev) => [...prev, message]);
3282
+ setModeState({ mode: "list-agents", source: "all" });
3283
+ }, []);
3284
+ const handleAgentDeleted = import_react11.useCallback(async (agent) => {
3285
+ try {
3286
+ await deleteAgentFromFile(agent);
3287
+ setAppState((state) => {
3288
+ const allAgents2 = state.agentDefinitions.allAgents.filter((a) => !(a.agentType === agent.agentType && a.source === agent.source));
3289
+ return {
3290
+ ...state,
3291
+ agentDefinitions: {
3292
+ ...state.agentDefinitions,
3293
+ allAgents: allAgents2,
3294
+ activeAgents: getActiveAgentsFromList(allAgents2)
3295
+ }
3296
+ };
3297
+ });
3298
+ setChanges((prev) => [
3299
+ ...prev,
3300
+ `Deleted agent: ${source_default.bold(agent.agentType)}`
3301
+ ]);
3302
+ setModeState({ mode: "list-agents", source: "all" });
3303
+ } catch (error) {
3304
+ logError(toError(error));
3305
+ }
3306
+ }, [setAppState]);
3307
+ switch (modeState.mode) {
3308
+ case "list-agents": {
3309
+ const agentsToShow = modeState.source === "all" ? [
3310
+ ...agentsBySource["built-in"],
3311
+ ...agentsBySource["userSettings"],
3312
+ ...agentsBySource["projectSettings"],
3313
+ ...agentsBySource["localSettings"],
3314
+ ...agentsBySource["policySettings"],
3315
+ ...agentsBySource["flagSettings"],
3316
+ ...agentsBySource["plugin"]
3317
+ ] : agentsBySource[modeState.source];
3318
+ const allResolved = resolveAgentOverrides(agentsToShow, agents);
3319
+ const resolvedAgents = allResolved;
3320
+ return /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(jsx_dev_runtime24.Fragment, {
3321
+ children: [
3322
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(AgentsList, {
3323
+ source: modeState.source,
3324
+ agents: resolvedAgents,
3325
+ onBack: () => {
3326
+ const exitMessage = changes.length > 0 ? `Agent changes:
3327
+ ${changes.join(`
3328
+ `)}` : undefined;
3329
+ onExit(exitMessage ?? "Agents dialog dismissed", {
3330
+ display: changes.length === 0 ? "system" : undefined
3331
+ });
3332
+ },
3333
+ onSelect: (agent) => setModeState({
3334
+ mode: "agent-menu",
3335
+ agent,
3336
+ previousMode: modeState
3337
+ }),
3338
+ onCreateNew: () => setModeState({ mode: "create-agent" }),
3339
+ changes
3340
+ }, undefined, false, undefined, this),
3341
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(AgentNavigationFooter, {}, undefined, false, undefined, this)
3342
+ ]
3343
+ }, undefined, true, undefined, this);
3344
+ }
3345
+ case "create-agent":
3346
+ return /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(CreateAgentWizard, {
3347
+ tools: mergedTools,
3348
+ existingAgents: agents,
3349
+ onComplete: handleAgentCreated,
3350
+ onCancel: () => setModeState({ mode: "list-agents", source: "all" })
3351
+ }, undefined, false, undefined, this);
3352
+ case "agent-menu": {
3353
+ const freshAgent = allAgents.find((a) => a.agentType === modeState.agent.agentType && a.source === modeState.agent.source);
3354
+ const agentToUse = freshAgent || modeState.agent;
3355
+ const isEditable = agentToUse.source !== "built-in" && agentToUse.source !== "plugin" && agentToUse.source !== "flagSettings";
3356
+ const menuItems = [
3357
+ { label: "View agent", value: "view" },
3358
+ ...isEditable ? [
3359
+ { label: "Edit agent", value: "edit" },
3360
+ { label: "Delete agent", value: "delete" }
3361
+ ] : [],
3362
+ { label: "Back", value: "back" }
3363
+ ];
3364
+ const handleMenuSelect = (value) => {
3365
+ switch (value) {
3366
+ case "view":
3367
+ setModeState({
3368
+ mode: "view-agent",
3369
+ agent: agentToUse,
3370
+ previousMode: modeState.previousMode
3371
+ });
3372
+ break;
3373
+ case "edit":
3374
+ setModeState({
3375
+ mode: "edit-agent",
3376
+ agent: agentToUse,
3377
+ previousMode: modeState
3378
+ });
3379
+ break;
3380
+ case "delete":
3381
+ setModeState({
3382
+ mode: "delete-confirm",
3383
+ agent: agentToUse,
3384
+ previousMode: modeState
3385
+ });
3386
+ break;
3387
+ case "back":
3388
+ setModeState(modeState.previousMode);
3389
+ break;
3390
+ }
3391
+ };
3392
+ return /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(jsx_dev_runtime24.Fragment, {
3393
+ children: [
3394
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Dialog, {
3395
+ title: modeState.agent.agentType,
3396
+ onCancel: () => setModeState(modeState.previousMode),
3397
+ hideInputGuide: true,
3398
+ children: /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(ThemedBox_default, {
3399
+ flexDirection: "column",
3400
+ children: [
3401
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Select, {
3402
+ options: menuItems,
3403
+ onChange: handleMenuSelect,
3404
+ onCancel: () => setModeState(modeState.previousMode)
3405
+ }, undefined, false, undefined, this),
3406
+ changes.length > 0 && /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(ThemedBox_default, {
3407
+ marginTop: 1,
3408
+ children: /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(ThemedText, {
3409
+ dimColor: true,
3410
+ children: changes[changes.length - 1]
3411
+ }, undefined, false, undefined, this)
3412
+ }, undefined, false, undefined, this)
3413
+ ]
3414
+ }, undefined, true, undefined, this)
3415
+ }, undefined, false, undefined, this),
3416
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(AgentNavigationFooter, {}, undefined, false, undefined, this)
3417
+ ]
3418
+ }, undefined, true, undefined, this);
3419
+ }
3420
+ case "view-agent": {
3421
+ const freshAgent = allAgents.find((a) => a.agentType === modeState.agent.agentType && a.source === modeState.agent.source);
3422
+ const agentToDisplay = freshAgent || modeState.agent;
3423
+ return /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(jsx_dev_runtime24.Fragment, {
3424
+ children: [
3425
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Dialog, {
3426
+ title: agentToDisplay.agentType,
3427
+ onCancel: () => setModeState({
3428
+ mode: "agent-menu",
3429
+ agent: agentToDisplay,
3430
+ previousMode: modeState.previousMode
3431
+ }),
3432
+ hideInputGuide: true,
3433
+ children: /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(AgentDetail, {
3434
+ agent: agentToDisplay,
3435
+ tools: mergedTools,
3436
+ allAgents,
3437
+ onBack: () => setModeState({
3438
+ mode: "agent-menu",
3439
+ agent: agentToDisplay,
3440
+ previousMode: modeState.previousMode
3441
+ })
3442
+ }, undefined, false, undefined, this)
3443
+ }, undefined, false, undefined, this),
3444
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(AgentNavigationFooter, {
3445
+ instructions: "Press Enter or Esc to go back"
3446
+ }, undefined, false, undefined, this)
3447
+ ]
3448
+ }, undefined, true, undefined, this);
3449
+ }
3450
+ case "delete-confirm": {
3451
+ const deleteOptions = [
3452
+ { label: "Yes, delete", value: "yes" },
3453
+ { label: "No, cancel", value: "no" }
3454
+ ];
3455
+ return /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(jsx_dev_runtime24.Fragment, {
3456
+ children: [
3457
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Dialog, {
3458
+ title: "Delete agent",
3459
+ onCancel: () => {
3460
+ if ("previousMode" in modeState)
3461
+ setModeState(modeState.previousMode);
3462
+ },
3463
+ color: "error",
3464
+ children: [
3465
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(ThemedText, {
3466
+ children: [
3467
+ "Are you sure you want to delete the agent",
3468
+ " ",
3469
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(ThemedText, {
3470
+ bold: true,
3471
+ children: modeState.agent.agentType
3472
+ }, undefined, false, undefined, this),
3473
+ "?"
3474
+ ]
3475
+ }, undefined, true, undefined, this),
3476
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(ThemedBox_default, {
3477
+ marginTop: 1,
3478
+ children: /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(ThemedText, {
3479
+ dimColor: true,
3480
+ children: [
3481
+ "Source: ",
3482
+ modeState.agent.source
3483
+ ]
3484
+ }, undefined, true, undefined, this)
3485
+ }, undefined, false, undefined, this),
3486
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(ThemedBox_default, {
3487
+ marginTop: 1,
3488
+ children: /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Select, {
3489
+ options: deleteOptions,
3490
+ onChange: (value) => {
3491
+ if (value === "yes") {
3492
+ handleAgentDeleted(modeState.agent);
3493
+ } else {
3494
+ if ("previousMode" in modeState) {
3495
+ setModeState(modeState.previousMode);
3496
+ }
3497
+ }
3498
+ },
3499
+ onCancel: () => {
3500
+ if ("previousMode" in modeState) {
3501
+ setModeState(modeState.previousMode);
3502
+ }
3503
+ }
3504
+ }, undefined, false, undefined, this)
3505
+ }, undefined, false, undefined, this)
3506
+ ]
3507
+ }, undefined, true, undefined, this),
3508
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(AgentNavigationFooter, {
3509
+ instructions: "Press \u2191\u2193 to navigate, Enter to select, Esc to cancel"
3510
+ }, undefined, false, undefined, this)
3511
+ ]
3512
+ }, undefined, true, undefined, this);
3513
+ }
3514
+ case "edit-agent": {
3515
+ const freshAgent = allAgents.find((a) => a.agentType === modeState.agent.agentType && a.source === modeState.agent.source);
3516
+ const agentToEdit = freshAgent || modeState.agent;
3517
+ return /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(jsx_dev_runtime24.Fragment, {
3518
+ children: [
3519
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Dialog, {
3520
+ title: `Edit agent: ${agentToEdit.agentType}`,
3521
+ onCancel: () => setModeState(modeState.previousMode),
3522
+ hideInputGuide: true,
3523
+ children: /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(AgentEditor, {
3524
+ agent: agentToEdit,
3525
+ tools: mergedTools,
3526
+ onSaved: (message) => {
3527
+ handleAgentCreated(message);
3528
+ setModeState(modeState.previousMode);
3529
+ },
3530
+ onBack: () => setModeState(modeState.previousMode)
3531
+ }, undefined, false, undefined, this)
3532
+ }, undefined, false, undefined, this),
3533
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(AgentNavigationFooter, {}, undefined, false, undefined, this)
3534
+ ]
3535
+ }, undefined, true, undefined, this);
3536
+ }
3537
+ default:
3538
+ return null;
3539
+ }
3540
+ }
3541
+ var import_react11, jsx_dev_runtime24;
3542
+ var init_AgentsMenu = __esm(() => {
3543
+ init_source();
3544
+ init_useExitOnCtrlCDWithKeybindings();
3545
+ init_useMergedTools();
3546
+ init_src();
3547
+ init_AppState();
3548
+ init_agentDisplay();
3549
+ init_loadAgentsDir();
3550
+ init_errors();
3551
+ init_log();
3552
+ init_select();
3553
+ init_src();
3554
+ init_AgentDetail();
3555
+ init_AgentEditor();
3556
+ init_AgentNavigationFooter();
3557
+ init_AgentsList();
3558
+ init_agentFileUtils();
3559
+ init_CreateAgentWizard();
3560
+ import_react11 = __toESM(require_react(), 1);
3561
+ jsx_dev_runtime24 = __toESM(require_jsx_dev_runtime(), 1);
3562
+ });
3563
+
3564
+ // src/commands/agents/agents.tsx
3565
+ async function call(onDone, context) {
3566
+ const appState = context.getAppState();
3567
+ const permissionContext = appState.toolPermissionContext;
3568
+ const tools = getTools(permissionContext);
3569
+ return /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(AgentsMenu, {
3570
+ tools,
3571
+ onExit: onDone
3572
+ }, undefined, false, undefined, this);
3573
+ }
3574
+ var jsx_dev_runtime25;
3575
+ var init_agents = __esm(() => {
3576
+ init_AgentsMenu();
3577
+ init_tools();
3578
+ jsx_dev_runtime25 = __toESM(require_jsx_dev_runtime(), 1);
3579
+ });
3580
+ init_agents();
3581
+
3582
+ export {
3583
+ call
3584
+ };