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