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