@caspian2026/agent-sdk 0.0.2

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 (371) hide show
  1. package/dist/chunk-018smjq7.js +26 -0
  2. package/dist/chunk-055q0a2m.js +146 -0
  3. package/dist/chunk-07069jq1.js +30 -0
  4. package/dist/chunk-0731m51q.js +8 -0
  5. package/dist/chunk-0awwmrwr.js +46 -0
  6. package/dist/chunk-0htx82k2.js +64 -0
  7. package/dist/chunk-0jmt5sx1.js +104 -0
  8. package/dist/chunk-0kj8bq80.js +252 -0
  9. package/dist/chunk-0kxcq8h9.js +86 -0
  10. package/dist/chunk-0paqc2yw.js +15 -0
  11. package/dist/chunk-0vkfrmqm.js +690 -0
  12. package/dist/chunk-0xjaqda8.js +1124 -0
  13. package/dist/chunk-10qhq6f8.js +458 -0
  14. package/dist/chunk-15m49c67.js +121 -0
  15. package/dist/chunk-15sfg4bs.js +65 -0
  16. package/dist/chunk-162ewhvy.js +869 -0
  17. package/dist/chunk-177s15bv.js +120 -0
  18. package/dist/chunk-19e603rv.js +284 -0
  19. package/dist/chunk-1ax1znzj.js +537 -0
  20. package/dist/chunk-1c4j7qn2.js +319 -0
  21. package/dist/chunk-1gx78081.js +66 -0
  22. package/dist/chunk-1h2famwb.js +49 -0
  23. package/dist/chunk-1nk93fqz.js +357 -0
  24. package/dist/chunk-1xct96nd.js +2520 -0
  25. package/dist/chunk-1xvcvdef.js +90 -0
  26. package/dist/chunk-1yrcnrs7.js +261 -0
  27. package/dist/chunk-21bcvwr7.js +660 -0
  28. package/dist/chunk-2352ts05.js +667 -0
  29. package/dist/chunk-23jzrwsw.js +43 -0
  30. package/dist/chunk-26hg7303.js +62 -0
  31. package/dist/chunk-2f21meep.js +122 -0
  32. package/dist/chunk-2fwze72g.js +24 -0
  33. package/dist/chunk-2gzv8nrw.js +205 -0
  34. package/dist/chunk-2h05vtpv.js +83 -0
  35. package/dist/chunk-2h0y6m16.js +465 -0
  36. package/dist/chunk-2n7bbxm6.js +168 -0
  37. package/dist/chunk-2nv3d0he.js +108 -0
  38. package/dist/chunk-2vqrdwx9.js +1811 -0
  39. package/dist/chunk-3389cj3w.js +120 -0
  40. package/dist/chunk-35sgv3er.js +231 -0
  41. package/dist/chunk-3c25bcsw.js +17 -0
  42. package/dist/chunk-3e20cj49.js +443 -0
  43. package/dist/chunk-3mr5ryx4.js +122 -0
  44. package/dist/chunk-3nk79af8.js +8 -0
  45. package/dist/chunk-3qbdzsvm.js +120 -0
  46. package/dist/chunk-3yprydpw.js +213 -0
  47. package/dist/chunk-430yrtmk.js +492 -0
  48. package/dist/chunk-46hd1gyd.js +140 -0
  49. package/dist/chunk-46hdszda.js +63 -0
  50. package/dist/chunk-46n7byh8.js +102 -0
  51. package/dist/chunk-4cp6193g.js +9076 -0
  52. package/dist/chunk-4dn3n459.js +409 -0
  53. package/dist/chunk-4hv90qcz.js +8 -0
  54. package/dist/chunk-4jm600zv.js +13 -0
  55. package/dist/chunk-4nspekjp.js +69 -0
  56. package/dist/chunk-505mxxa9.js +19 -0
  57. package/dist/chunk-50bay5qy.js +224 -0
  58. package/dist/chunk-537qfvn5.js +345 -0
  59. package/dist/chunk-55raexh7.js +14358 -0
  60. package/dist/chunk-572vjq78.js +56 -0
  61. package/dist/chunk-5apfzkpy.js +87 -0
  62. package/dist/chunk-5ccdsxgy.js +74 -0
  63. package/dist/chunk-5dmhsqap.js +32 -0
  64. package/dist/chunk-5fs6nkjr.js +98 -0
  65. package/dist/chunk-5nchekqe.js +87 -0
  66. package/dist/chunk-5pp28k2r.js +120 -0
  67. package/dist/chunk-5rt4b8q9.js +116 -0
  68. package/dist/chunk-5rv9c8yd.js +1072 -0
  69. package/dist/chunk-5z28bqne.js +6748 -0
  70. package/dist/chunk-64c1avct.js +13 -0
  71. package/dist/chunk-66zry909.js +11 -0
  72. package/dist/chunk-682qgta2.js +102 -0
  73. package/dist/chunk-68ffk5qa.js +14 -0
  74. package/dist/chunk-68w91pzt.js +79 -0
  75. package/dist/chunk-69fgaak0.js +654 -0
  76. package/dist/chunk-69n11zng.js +436 -0
  77. package/dist/chunk-6dj5t602.js +341 -0
  78. package/dist/chunk-6gh20s05.js +146 -0
  79. package/dist/chunk-6maej1hh.js +502 -0
  80. package/dist/chunk-6nsd9606.js +790 -0
  81. package/dist/chunk-6p4cyhb3.js +16 -0
  82. package/dist/chunk-6t4a9cgj.js +877 -0
  83. package/dist/chunk-6t8yqfks.js +227 -0
  84. package/dist/chunk-6vthy0fj.js +213 -0
  85. package/dist/chunk-70cw4cg9.js +1026 -0
  86. package/dist/chunk-70eey1nh.js +164 -0
  87. package/dist/chunk-76j2e9vy.js +68 -0
  88. package/dist/chunk-7acgdm7x.js +93 -0
  89. package/dist/chunk-7aw745vx.js +40175 -0
  90. package/dist/chunk-7gvwg1v9.js +122 -0
  91. package/dist/chunk-7h2ybnf3.js +636 -0
  92. package/dist/chunk-7kcm5hn2.js +155 -0
  93. package/dist/chunk-7m2hp89m.js +73 -0
  94. package/dist/chunk-7mqab3z7.js +31 -0
  95. package/dist/chunk-7sgtxrsc.js +1059 -0
  96. package/dist/chunk-7wm5s02e.js +216 -0
  97. package/dist/chunk-7xyswgjh.js +8 -0
  98. package/dist/chunk-7yxvpj5j.js +1452 -0
  99. package/dist/chunk-80a8vabn.js +93 -0
  100. package/dist/chunk-83e71kz6.js +180 -0
  101. package/dist/chunk-83hfzbx3.js +10 -0
  102. package/dist/chunk-8g5pe1gr.js +37 -0
  103. package/dist/chunk-8g747a8x.js +26 -0
  104. package/dist/chunk-8hj8ms5q.js +111 -0
  105. package/dist/chunk-8mkwsdk1.js +61 -0
  106. package/dist/chunk-8n42zyfx.js +40 -0
  107. package/dist/chunk-8qhxyqj9.js +1155 -0
  108. package/dist/chunk-8y30k9pz.js +38 -0
  109. package/dist/chunk-960ze3jj.js +124 -0
  110. package/dist/chunk-97wgdsab.js +35 -0
  111. package/dist/chunk-9grztvcg.js +93 -0
  112. package/dist/chunk-9x5zgy22.js +12 -0
  113. package/dist/chunk-a8792r1c.js +620 -0
  114. package/dist/chunk-ahr1r7c6.js +4275 -0
  115. package/dist/chunk-ase86y73.js +15 -0
  116. package/dist/chunk-b0kf00ff.js +637 -0
  117. package/dist/chunk-b0qptb1k.js +640 -0
  118. package/dist/chunk-b1kcd3ss.js +27 -0
  119. package/dist/chunk-b2fd462a.js +54 -0
  120. package/dist/chunk-bdrjvs5k.js +157 -0
  121. package/dist/chunk-beg7bdyz.js +90 -0
  122. package/dist/chunk-bg4x9ex0.js +21 -0
  123. package/dist/chunk-bktfq0ns.js +95 -0
  124. package/dist/chunk-bmbq6nt1.js +145 -0
  125. package/dist/chunk-bvf2z3g6.js +1003 -0
  126. package/dist/chunk-bxcfz5gy.js +56 -0
  127. package/dist/chunk-c11swzas.js +5368 -0
  128. package/dist/chunk-c37j5zxe.js +57 -0
  129. package/dist/chunk-c5mz5vw2.js +117 -0
  130. package/dist/chunk-c6sjhj89.js +1284 -0
  131. package/dist/chunk-c7jwbe76.js +29030 -0
  132. package/dist/chunk-cc2tg4q8.js +311 -0
  133. package/dist/chunk-cdhmrbj4.js +6353 -0
  134. package/dist/chunk-cdz5yb0r.js +57 -0
  135. package/dist/chunk-cfv996bs.js +22 -0
  136. package/dist/chunk-cgfdkzhb.js +12 -0
  137. package/dist/chunk-chakj069.js +310 -0
  138. package/dist/chunk-chsyvavm.js +3435 -0
  139. package/dist/chunk-cnsj3vq2.js +35 -0
  140. package/dist/chunk-ctdg0qxh.js +1386 -0
  141. package/dist/chunk-cxq7gc42.js +386 -0
  142. package/dist/chunk-d1pyf9as.js +8586 -0
  143. package/dist/chunk-d4kwjqjy.js +308 -0
  144. package/dist/chunk-d4mdda98.js +94 -0
  145. package/dist/chunk-d7886r6a.js +13870 -0
  146. package/dist/chunk-d7f1pzkq.js +95 -0
  147. package/dist/chunk-ddsjkqs4.js +39 -0
  148. package/dist/chunk-dm3n2qgd.js +24 -0
  149. package/dist/chunk-e2mv8ts8.js +115 -0
  150. package/dist/chunk-e4bhfc6d.js +2720 -0
  151. package/dist/chunk-e4p1jbs4.js +58 -0
  152. package/dist/chunk-e7h4qxgw.js +21 -0
  153. package/dist/chunk-e8p3fy6v.js +202 -0
  154. package/dist/chunk-e97mp86b.js +111 -0
  155. package/dist/chunk-ebqwkhyf.js +145 -0
  156. package/dist/chunk-eenq3avg.js +69 -0
  157. package/dist/chunk-efgjfast.js +61 -0
  158. package/dist/chunk-ehtwnxpg.js +1591 -0
  159. package/dist/chunk-en8wkxh7.js +173 -0
  160. package/dist/chunk-enkdxqas.js +33 -0
  161. package/dist/chunk-eqp1rfft.js +17 -0
  162. package/dist/chunk-ercvcek8.js +266 -0
  163. package/dist/chunk-etgh9xvt.js +369 -0
  164. package/dist/chunk-ev3qkf76.js +106 -0
  165. package/dist/chunk-evp5pb9x.js +3567 -0
  166. package/dist/chunk-ewadzrm8.js +103 -0
  167. package/dist/chunk-exah13mz.js +94 -0
  168. package/dist/chunk-f0rzvqmq.js +87 -0
  169. package/dist/chunk-f1m9pect.js +258 -0
  170. package/dist/chunk-fajg8x36.js +8158 -0
  171. package/dist/chunk-fbv4apne.js +51 -0
  172. package/dist/chunk-fbvw6wq9.js +116 -0
  173. package/dist/chunk-feyzykye.js +10 -0
  174. package/dist/chunk-fn1vvj8k.js +894 -0
  175. package/dist/chunk-fshfxw2q.js +183 -0
  176. package/dist/chunk-fyc5fepv.js +10 -0
  177. package/dist/chunk-g9f19ttm.js +15 -0
  178. package/dist/chunk-gcpfxk0c.js +644 -0
  179. package/dist/chunk-gdg6411p.js +106 -0
  180. package/dist/chunk-gkyzz8er.js +849 -0
  181. package/dist/chunk-gxahdggv.js +71 -0
  182. package/dist/chunk-h6fsks9j.js +220 -0
  183. package/dist/chunk-h9n54swm.js +27 -0
  184. package/dist/chunk-hakdhagh.js +16606 -0
  185. package/dist/chunk-hchy0hq6.js +159 -0
  186. package/dist/chunk-hh3k5s1s.js +180 -0
  187. package/dist/chunk-hqqkj5pg.js +202 -0
  188. package/dist/chunk-htpehq9t.js +251 -0
  189. package/dist/chunk-hwfknpxv.js +39 -0
  190. package/dist/chunk-hwn8vetn.js +394 -0
  191. package/dist/chunk-hx3j6n92.js +178 -0
  192. package/dist/chunk-hyb749hd.js +194 -0
  193. package/dist/chunk-hzgnejb1.js +90 -0
  194. package/dist/chunk-hzknr99c.js +477 -0
  195. package/dist/chunk-j3zhb8vv.js +152 -0
  196. package/dist/chunk-j5bth84e.js +97 -0
  197. package/dist/chunk-j64ga6ta.js +8035 -0
  198. package/dist/chunk-jaaxk89e.js +113 -0
  199. package/dist/chunk-jd32zbps.js +15 -0
  200. package/dist/chunk-jfja8q7w.js +91 -0
  201. package/dist/chunk-jgjqa49s.js +27 -0
  202. package/dist/chunk-jgpmpgx6.js +19 -0
  203. package/dist/chunk-jgwd85hp.js +91 -0
  204. package/dist/chunk-jk69qtzx.js +277 -0
  205. package/dist/chunk-jr1xm1dd.js +147 -0
  206. package/dist/chunk-jss0azv7.js +2337 -0
  207. package/dist/chunk-jxpmkae9.js +108 -0
  208. package/dist/chunk-jy9rxxqe.js +102 -0
  209. package/dist/chunk-jyw3np47.js +264 -0
  210. package/dist/chunk-jzthz1bx.js +15 -0
  211. package/dist/chunk-k0p9w03v.js +4957 -0
  212. package/dist/chunk-k2rybwww.js +92 -0
  213. package/dist/chunk-k3939ggz.js +168 -0
  214. package/dist/chunk-k591cwbg.js +345 -0
  215. package/dist/chunk-k5ez1h65.js +108 -0
  216. package/dist/chunk-k8vp0atq.js +2331 -0
  217. package/dist/chunk-kajf3jgq.js +694 -0
  218. package/dist/chunk-kbm69rtz.js +276 -0
  219. package/dist/chunk-kjh11txh.js +419 -0
  220. package/dist/chunk-kqggbte3.js +326 -0
  221. package/dist/chunk-kr6qfwq0.js +95 -0
  222. package/dist/chunk-kvfg8eeg.js +150 -0
  223. package/dist/chunk-kwekc97v.js +18 -0
  224. package/dist/chunk-m1cehfta.js +861 -0
  225. package/dist/chunk-m87bhhqv.js +61 -0
  226. package/dist/chunk-mg7pbk0r.js +151 -0
  227. package/dist/chunk-mpbfkp8j.js +418 -0
  228. package/dist/chunk-mpk1sjyk.js +117 -0
  229. package/dist/chunk-msecaxyj.js +74 -0
  230. package/dist/chunk-mswx2nma.js +103 -0
  231. package/dist/chunk-mw1kpeg9.js +6895 -0
  232. package/dist/chunk-mxr2s6d1.js +89 -0
  233. package/dist/chunk-my40g5hp.js +560 -0
  234. package/dist/chunk-n0kmh4ra.js +338 -0
  235. package/dist/chunk-n18q5yqs.js +397 -0
  236. package/dist/chunk-n7pnyq43.js +131 -0
  237. package/dist/chunk-naybw0p0.js +32 -0
  238. package/dist/chunk-nb6abcch.js +83 -0
  239. package/dist/chunk-ne5r3k03.js +350 -0
  240. package/dist/chunk-nebezy1d.js +997 -0
  241. package/dist/chunk-netzwgv1.js +154 -0
  242. package/dist/chunk-nhapyawz.js +32994 -0
  243. package/dist/chunk-npnvheft.js +156 -0
  244. package/dist/chunk-nrtksr2p.js +51 -0
  245. package/dist/chunk-nw9t5pq9.js +132 -0
  246. package/dist/chunk-nxgsnh2y.js +735 -0
  247. package/dist/chunk-p11xp4xp.js +266 -0
  248. package/dist/chunk-p1hwrf72.js +74 -0
  249. package/dist/chunk-p1zj9mg9.js +567 -0
  250. package/dist/chunk-p39a677r.js +115 -0
  251. package/dist/chunk-p7vkh4wx.js +15 -0
  252. package/dist/chunk-p8na2wwp.js +14 -0
  253. package/dist/chunk-pcb7fbyg.js +259 -0
  254. package/dist/chunk-pckwmrzd.js +409 -0
  255. package/dist/chunk-ped973jn.js +111 -0
  256. package/dist/chunk-phd1qfpc.js +5971 -0
  257. package/dist/chunk-pkkngdv0.js +524 -0
  258. package/dist/chunk-ppwjyveh.js +8 -0
  259. package/dist/chunk-pqvr8jq7.js +324 -0
  260. package/dist/chunk-prcah3ys.js +106 -0
  261. package/dist/chunk-ps49ymvj.js +43 -0
  262. package/dist/chunk-pwwa7s62.js +11 -0
  263. package/dist/chunk-pxdzy0jh.js +134 -0
  264. package/dist/chunk-q3jr5t07.js +62 -0
  265. package/dist/chunk-q6cfkntd.js +675 -0
  266. package/dist/chunk-q6m26rc8.js +88 -0
  267. package/dist/chunk-q6xs51jj.js +332 -0
  268. package/dist/chunk-q7jnesv8.js +74 -0
  269. package/dist/chunk-q7zpf4r2.js +440 -0
  270. package/dist/chunk-q8c88vjm.js +24 -0
  271. package/dist/chunk-qajrkk97.js +298 -0
  272. package/dist/chunk-qatfdxvd.js +34 -0
  273. package/dist/chunk-qb6k2afy.js +153 -0
  274. package/dist/chunk-qfk94vcn.js +329 -0
  275. package/dist/chunk-qj2e1apf.js +471 -0
  276. package/dist/chunk-qj2mk79w.js +111 -0
  277. package/dist/chunk-qk7dfae6.js +267 -0
  278. package/dist/chunk-qnfx3qtx.js +617 -0
  279. package/dist/chunk-qp2qdcda.js +100 -0
  280. package/dist/chunk-qq0phwn8.js +458 -0
  281. package/dist/chunk-qwqjesx7.js +258 -0
  282. package/dist/chunk-qygmcg7w.js +60 -0
  283. package/dist/chunk-qz2x630m.js +49145 -0
  284. package/dist/chunk-qzj4e8fn.js +357 -0
  285. package/dist/chunk-ratvcbmn.js +255 -0
  286. package/dist/chunk-rkg741k3.js +37 -0
  287. package/dist/chunk-rn0v1hk8.js +34 -0
  288. package/dist/chunk-rsq0h0rz.js +91 -0
  289. package/dist/chunk-rvnb2gn6.js +1053 -0
  290. package/dist/chunk-rx278zpa.js +75 -0
  291. package/dist/chunk-s3hsqf80.js +473 -0
  292. package/dist/chunk-s4cb0bcb.js +655 -0
  293. package/dist/chunk-s8kj6ajy.js +32 -0
  294. package/dist/chunk-sd36yzx8.js +954 -0
  295. package/dist/chunk-sfcpjh4r.js +98 -0
  296. package/dist/chunk-spybh2dy.js +175 -0
  297. package/dist/chunk-sw9ax3ym.js +92 -0
  298. package/dist/chunk-szj5wvdy.js +28 -0
  299. package/dist/chunk-t29a6zb5.js +45 -0
  300. package/dist/chunk-t9p85zff.js +24 -0
  301. package/dist/chunk-tc1aazk4.js +131 -0
  302. package/dist/chunk-tdbz9gbm.js +1030 -0
  303. package/dist/chunk-tjcfpk38.js +208 -0
  304. package/dist/chunk-tp2jxmcx.js +8427 -0
  305. package/dist/chunk-tqmtkm0k.js +92 -0
  306. package/dist/chunk-tvgvt220.js +22820 -0
  307. package/dist/chunk-v0qraze5.js +291 -0
  308. package/dist/chunk-v1kzp02e.js +785 -0
  309. package/dist/chunk-v78fj8by.js +145 -0
  310. package/dist/chunk-v8g3kad0.js +101 -0
  311. package/dist/chunk-v9smspw2.js +4301 -0
  312. package/dist/chunk-vawgyev5.js +157 -0
  313. package/dist/chunk-vb3x3cxe.js +375 -0
  314. package/dist/chunk-vf612n57.js +472 -0
  315. package/dist/chunk-vjn8mbcw.js +198 -0
  316. package/dist/chunk-vmbfv1y5.js +295 -0
  317. package/dist/chunk-vrf54kmt.js +321 -0
  318. package/dist/chunk-vyjeh50y.js +2149 -0
  319. package/dist/chunk-vzgkedm9.js +159745 -0
  320. package/dist/chunk-w004kfw0.js +245 -0
  321. package/dist/chunk-w0yhbmxn.js +132 -0
  322. package/dist/chunk-w4yn8cq7.js +123 -0
  323. package/dist/chunk-waqwgprq.js +1164 -0
  324. package/dist/chunk-wayfjcwt.js +447 -0
  325. package/dist/chunk-wby6yd4m.js +91 -0
  326. package/dist/chunk-wha6v7za.js +705 -0
  327. package/dist/chunk-wjcq2vkf.js +641 -0
  328. package/dist/chunk-wtjt9qyk.js +2670 -0
  329. package/dist/chunk-x2pvw7xw.js +42 -0
  330. package/dist/chunk-x6r4v44b.js +8 -0
  331. package/dist/chunk-x8d2ehd7.js +19 -0
  332. package/dist/chunk-xd6kmmb1.js +95 -0
  333. package/dist/chunk-xp61y5ba.js +125 -0
  334. package/dist/chunk-xv3era3s.js +8 -0
  335. package/dist/chunk-xxw9a0bq.js +58 -0
  336. package/dist/chunk-xzhaa7gd.js +112 -0
  337. package/dist/chunk-y1784krc.js +19 -0
  338. package/dist/chunk-y4ca9kqz.js +3830 -0
  339. package/dist/chunk-yff68ex1.js +113 -0
  340. package/dist/chunk-yg4vgpxs.js +436 -0
  341. package/dist/chunk-yk62vxj2.js +2964 -0
  342. package/dist/chunk-ym5r3jnk.js +2007 -0
  343. package/dist/chunk-ysanv95x.js +225 -0
  344. package/dist/chunk-yvtzznds.js +63 -0
  345. package/dist/chunk-yyex5gsf.js +269 -0
  346. package/dist/chunk-yyf72f78.js +456 -0
  347. package/dist/chunk-z19sd3bt.js +1648 -0
  348. package/dist/chunk-z2dp53wn.js +17 -0
  349. package/dist/chunk-z9n0183s.js +39 -0
  350. package/dist/chunk-zb8f6h5g.js +9174 -0
  351. package/dist/chunk-zctfbr1v.js +594 -0
  352. package/dist/chunk-zesnmkg3.js +2840 -0
  353. package/dist/chunk-zf47r1b7.js +94 -0
  354. package/dist/chunk-zghtdbat.js +253 -0
  355. package/dist/chunk-zpmwvd09.js +275 -0
  356. package/dist/chunk-zqncgyf6.js +127 -0
  357. package/dist/chunk-zr6mz36s.js +281 -0
  358. package/dist/chunk-zshzdw1n.js +141 -0
  359. package/dist/chunk-zx5kw7z4.js +40 -0
  360. package/dist/chunk-zzm33q8x.js +8 -0
  361. package/dist/cli.js +91 -0
  362. package/dist/download-ripgrep.js +24821 -0
  363. package/dist/vendor/audio-capture/arm64-darwin/audio-capture.node +0 -0
  364. package/dist/vendor/audio-capture/arm64-linux/audio-capture.node +0 -0
  365. package/dist/vendor/audio-capture/arm64-win32/audio-capture.node +0 -0
  366. package/dist/vendor/audio-capture/x64-darwin/audio-capture.node +0 -0
  367. package/dist/vendor/audio-capture/x64-linux/audio-capture.node +0 -0
  368. package/dist/vendor/audio-capture/x64-win32/audio-capture.node +0 -0
  369. package/dist/vendor/ripgrep/x64-win32/rg.exe +0 -0
  370. package/package.json +122 -0
  371. package/scripts/postinstall.cjs +319 -0
@@ -0,0 +1,1386 @@
1
+ // @bun
2
+ import {
3
+ getAutoModeDenials,
4
+ init_autoModeDenials
5
+ } from "./chunk-0paqc2yw.js";
6
+ import {
7
+ init_SearchBox
8
+ } from "./chunk-p8na2wwp.js";
9
+ import {
10
+ init_useSearchInput,
11
+ useSearchInput
12
+ } from "./chunk-d4kwjqjy.js";
13
+ import {
14
+ detectUnreachableRules,
15
+ init_shadowedRuleDetection
16
+ } from "./chunk-kr6qfwq0.js";
17
+ import {
18
+ AddWorkspaceDirectory,
19
+ init_AddWorkspaceDirectory
20
+ } from "./chunk-vmbfv1y5.js";
21
+ import"./chunk-vawgyev5.js";
22
+ import"./chunk-mg7pbk0r.js";
23
+ import {
24
+ BashTool,
25
+ SandboxManager,
26
+ Select,
27
+ TextInput,
28
+ WebFetchTool,
29
+ applyPermissionUpdate,
30
+ createPermissionRetryMessage,
31
+ deletePermissionRule,
32
+ getAllowRules,
33
+ getAskRules,
34
+ getDenyRules,
35
+ init_AppState,
36
+ init_BashTool,
37
+ init_PermissionUpdate,
38
+ init_TextInput,
39
+ init_WebFetchTool,
40
+ init_messages1 as init_messages,
41
+ init_permissions,
42
+ init_sandbox_adapter,
43
+ init_select,
44
+ init_useTerminalSize,
45
+ permissionRuleSourceDisplayString,
46
+ persistPermissionUpdate,
47
+ useAppState,
48
+ useSetAppState
49
+ } from "./chunk-vzgkedm9.js";
50
+ import"./chunk-46hdszda.js";
51
+ import"./chunk-hwfknpxv.js";
52
+ import"./chunk-4nspekjp.js";
53
+ import"./chunk-jzthz1bx.js";
54
+ import"./chunk-1gx78081.js";
55
+ import"./chunk-2gzv8nrw.js";
56
+ import"./chunk-ehtwnxpg.js";
57
+ import"./chunk-68w91pzt.js";
58
+ import"./chunk-s4cb0bcb.js";
59
+ import"./chunk-cgfdkzhb.js";
60
+ import"./chunk-bxcfz5gy.js";
61
+ import"./chunk-nebezy1d.js";
62
+ import"./chunk-wayfjcwt.js";
63
+ import {
64
+ init_useExitOnCtrlCDWithKeybindings,
65
+ useExitOnCtrlCDWithKeybindings
66
+ } from "./chunk-kbm69rtz.js";
67
+ import"./chunk-j5bth84e.js";
68
+ import"./chunk-nxgsnh2y.js";
69
+ import {
70
+ init_useKeybinding
71
+ } from "./chunk-68ffk5qa.js";
72
+ import"./chunk-ps49ymvj.js";
73
+ import"./chunk-bmbq6nt1.js";
74
+ import"./chunk-15sfg4bs.js";
75
+ import"./chunk-p7vkh4wx.js";
76
+ import"./chunk-b0qptb1k.js";
77
+ import"./chunk-m87bhhqv.js";
78
+ import"./chunk-j3zhb8vv.js";
79
+ import"./chunk-b2fd462a.js";
80
+ import"./chunk-c11swzas.js";
81
+ import"./chunk-chsyvavm.js";
82
+ import"./chunk-5rv9c8yd.js";
83
+ import {
84
+ SOURCES,
85
+ getRelativeSettingsFilePathForSource,
86
+ init_constants,
87
+ init_permissionRuleParser,
88
+ init_settings1 as init_settings,
89
+ init_stringUtils,
90
+ permissionRuleValueFromString,
91
+ permissionRuleValueToString,
92
+ plural
93
+ } from "./chunk-tp2jxmcx.js";
94
+ import"./chunk-z19sd3bt.js";
95
+ import"./chunk-1ax1znzj.js";
96
+ import"./chunk-wha6v7za.js";
97
+ import"./chunk-6nsd9606.js";
98
+ import"./chunk-xp61y5ba.js";
99
+ import"./chunk-64c1avct.js";
100
+ import"./chunk-8g5pe1gr.js";
101
+ import"./chunk-4cp6193g.js";
102
+ import"./chunk-8g747a8x.js";
103
+ import"./chunk-d7886r6a.js";
104
+ import"./chunk-yvtzznds.js";
105
+ import"./chunk-4jm600zv.js";
106
+ import"./chunk-qz2x630m.js";
107
+ import"./chunk-2f21meep.js";
108
+ import"./chunk-nrtksr2p.js";
109
+ import"./chunk-3c25bcsw.js";
110
+ import"./chunk-s3hsqf80.js";
111
+ import"./chunk-yyf72f78.js";
112
+ import"./chunk-cdz5yb0r.js";
113
+ import {
114
+ Dialog,
115
+ Newline,
116
+ Pane,
117
+ SearchBox,
118
+ StatusIcon,
119
+ Tab,
120
+ Tabs,
121
+ ThemedBox_default,
122
+ ThemedText,
123
+ init_source,
124
+ init_src,
125
+ source_default,
126
+ useKeybinding,
127
+ useTabHeaderFocus as useTabHeaderFocus2,
128
+ useTabsWidth,
129
+ useTerminalFocus,
130
+ useTerminalSize,
131
+ use_input_default
132
+ } from "./chunk-c7jwbe76.js";
133
+ import"./chunk-0vkfrmqm.js";
134
+ import {
135
+ require_jsx_dev_runtime,
136
+ require_react
137
+ } from "./chunk-7sgtxrsc.js";
138
+ import"./chunk-0xjaqda8.js";
139
+ import"./chunk-x8d2ehd7.js";
140
+ import"./chunk-15m49c67.js";
141
+ import"./chunk-tdbz9gbm.js";
142
+ import"./chunk-0awwmrwr.js";
143
+ import"./chunk-qnfx3qtx.js";
144
+ import"./chunk-70eey1nh.js";
145
+ import"./chunk-1nk93fqz.js";
146
+ import"./chunk-s8kj6ajy.js";
147
+ import"./chunk-eenq3avg.js";
148
+ import"./chunk-7mqab3z7.js";
149
+ import"./chunk-5z28bqne.js";
150
+ import {
151
+ figures_default,
152
+ init_figures
153
+ } from "./chunk-qajrkk97.js";
154
+ import {
155
+ init_slowOperations,
156
+ jsonStringify
157
+ } from "./chunk-phd1qfpc.js";
158
+ import"./chunk-fbv4apne.js";
159
+ import"./chunk-jaaxk89e.js";
160
+ import {
161
+ getOriginalCwd,
162
+ init_state
163
+ } from "./chunk-k8vp0atq.js";
164
+ import"./chunk-vf612n57.js";
165
+ import"./chunk-07069jq1.js";
166
+ import"./chunk-d4mdda98.js";
167
+ import"./chunk-55raexh7.js";
168
+ import"./chunk-v9smspw2.js";
169
+ import"./chunk-v1kzp02e.js";
170
+ import"./chunk-7wm5s02e.js";
171
+ import"./chunk-b0kf00ff.js";
172
+ import"./chunk-netzwgv1.js";
173
+ import {
174
+ __esm,
175
+ __toESM
176
+ } from "./chunk-qp2qdcda.js";
177
+
178
+ // src/components/permissions/rules/PermissionRuleDescription.tsx
179
+ function PermissionRuleDescription({
180
+ ruleValue
181
+ }) {
182
+ switch (ruleValue.toolName) {
183
+ case BashTool.name: {
184
+ if (ruleValue.ruleContent) {
185
+ if (ruleValue.ruleContent.endsWith(":*")) {
186
+ return /* @__PURE__ */ jsx_dev_runtime.jsxDEV(ThemedText, {
187
+ dimColor: true,
188
+ children: [
189
+ "Any Bash command starting with",
190
+ " ",
191
+ /* @__PURE__ */ jsx_dev_runtime.jsxDEV(ThemedText, {
192
+ bold: true,
193
+ children: ruleValue.ruleContent.slice(0, -2)
194
+ }, undefined, false, undefined, this)
195
+ ]
196
+ }, undefined, true, undefined, this);
197
+ } else {
198
+ return /* @__PURE__ */ jsx_dev_runtime.jsxDEV(ThemedText, {
199
+ dimColor: true,
200
+ children: [
201
+ "The Bash command ",
202
+ /* @__PURE__ */ jsx_dev_runtime.jsxDEV(ThemedText, {
203
+ bold: true,
204
+ children: ruleValue.ruleContent
205
+ }, undefined, false, undefined, this)
206
+ ]
207
+ }, undefined, true, undefined, this);
208
+ }
209
+ } else {
210
+ return /* @__PURE__ */ jsx_dev_runtime.jsxDEV(ThemedText, {
211
+ dimColor: true,
212
+ children: "Any Bash command"
213
+ }, undefined, false, undefined, this);
214
+ }
215
+ }
216
+ default: {
217
+ if (!ruleValue.ruleContent) {
218
+ return /* @__PURE__ */ jsx_dev_runtime.jsxDEV(ThemedText, {
219
+ dimColor: true,
220
+ children: [
221
+ "Any use of the ",
222
+ /* @__PURE__ */ jsx_dev_runtime.jsxDEV(ThemedText, {
223
+ bold: true,
224
+ children: ruleValue.toolName
225
+ }, undefined, false, undefined, this),
226
+ " tool"
227
+ ]
228
+ }, undefined, true, undefined, this);
229
+ } else {
230
+ return null;
231
+ }
232
+ }
233
+ }
234
+ }
235
+ var jsx_dev_runtime;
236
+ var init_PermissionRuleDescription = __esm(() => {
237
+ init_src();
238
+ init_BashTool();
239
+ jsx_dev_runtime = __toESM(require_jsx_dev_runtime(), 1);
240
+ });
241
+
242
+ // src/components/permissions/rules/AddPermissionRules.tsx
243
+ function optionForPermissionSaveDestination(saveDestination) {
244
+ switch (saveDestination) {
245
+ case "localSettings":
246
+ return {
247
+ label: "Project settings (local)",
248
+ description: `Saved in ${getRelativeSettingsFilePathForSource("localSettings")}`,
249
+ value: saveDestination
250
+ };
251
+ case "projectSettings":
252
+ return {
253
+ label: "Project settings",
254
+ description: `Checked in at ${getRelativeSettingsFilePathForSource("projectSettings")}`,
255
+ value: saveDestination
256
+ };
257
+ case "userSettings":
258
+ return {
259
+ label: "User settings",
260
+ description: `Saved in at ~/.claude/settings.json`,
261
+ value: saveDestination
262
+ };
263
+ }
264
+ }
265
+ function AddPermissionRules({
266
+ onAddRules,
267
+ onCancel,
268
+ ruleValues,
269
+ ruleBehavior,
270
+ initialContext,
271
+ setToolPermissionContext
272
+ }) {
273
+ const allOptions = SOURCES.map(optionForPermissionSaveDestination);
274
+ const onSelect = import_react.useCallback((selectedValue) => {
275
+ if (selectedValue === "cancel") {
276
+ onCancel();
277
+ return;
278
+ } else if (SOURCES.includes(selectedValue)) {
279
+ const destination = selectedValue;
280
+ const updatedContext = applyPermissionUpdate(initialContext, {
281
+ type: "addRules",
282
+ rules: ruleValues,
283
+ behavior: ruleBehavior,
284
+ destination
285
+ });
286
+ persistPermissionUpdate({
287
+ type: "addRules",
288
+ rules: ruleValues,
289
+ behavior: ruleBehavior,
290
+ destination
291
+ });
292
+ setToolPermissionContext(updatedContext);
293
+ const rules = ruleValues.map((ruleValue) => ({
294
+ ruleValue,
295
+ ruleBehavior,
296
+ source: destination
297
+ }));
298
+ const sandboxAutoAllowEnabled = SandboxManager.isSandboxingEnabled() && SandboxManager.isAutoAllowBashIfSandboxedEnabled();
299
+ const allUnreachable = detectUnreachableRules(updatedContext, {
300
+ sandboxAutoAllowEnabled
301
+ });
302
+ const newUnreachable = allUnreachable.filter((u) => ruleValues.some((rv) => rv.toolName === u.rule.ruleValue.toolName && rv.ruleContent === u.rule.ruleValue.ruleContent));
303
+ onAddRules(rules, newUnreachable.length > 0 ? newUnreachable : undefined);
304
+ }
305
+ }, [
306
+ onAddRules,
307
+ onCancel,
308
+ ruleValues,
309
+ ruleBehavior,
310
+ initialContext,
311
+ setToolPermissionContext
312
+ ]);
313
+ const title = `Add ${ruleBehavior} permission ${plural(ruleValues.length, "rule")}`;
314
+ return /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Dialog, {
315
+ title,
316
+ onCancel,
317
+ color: "permission",
318
+ children: [
319
+ /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(ThemedBox_default, {
320
+ flexDirection: "column",
321
+ paddingX: 2,
322
+ children: ruleValues.map((ruleValue) => /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(ThemedBox_default, {
323
+ flexDirection: "column",
324
+ children: [
325
+ /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(ThemedText, {
326
+ bold: true,
327
+ children: permissionRuleValueToString(ruleValue)
328
+ }, undefined, false, undefined, this),
329
+ /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(PermissionRuleDescription, {
330
+ ruleValue
331
+ }, undefined, false, undefined, this)
332
+ ]
333
+ }, permissionRuleValueToString(ruleValue), true, undefined, this))
334
+ }, undefined, false, undefined, this),
335
+ /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(ThemedBox_default, {
336
+ flexDirection: "column",
337
+ marginY: 1,
338
+ children: [
339
+ /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(ThemedText, {
340
+ children: ruleValues.length === 1 ? "Where should this rule be saved?" : "Where should these rules be saved?"
341
+ }, undefined, false, undefined, this),
342
+ /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Select, {
343
+ options: allOptions,
344
+ onChange: onSelect
345
+ }, undefined, false, undefined, this)
346
+ ]
347
+ }, undefined, true, undefined, this)
348
+ ]
349
+ }, undefined, true, undefined, this);
350
+ }
351
+ var import_react, jsx_dev_runtime2;
352
+ var init_AddPermissionRules = __esm(() => {
353
+ init_select();
354
+ init_src();
355
+ init_PermissionUpdate();
356
+ init_permissionRuleParser();
357
+ init_shadowedRuleDetection();
358
+ init_sandbox_adapter();
359
+ init_constants();
360
+ init_settings();
361
+ init_stringUtils();
362
+ init_PermissionRuleDescription();
363
+ import_react = __toESM(require_react(), 1);
364
+ jsx_dev_runtime2 = __toESM(require_jsx_dev_runtime(), 1);
365
+ });
366
+
367
+ // src/components/permissions/rules/PermissionRuleInput.tsx
368
+ function PermissionRuleInput({
369
+ onCancel,
370
+ onSubmit,
371
+ ruleBehavior
372
+ }) {
373
+ const [inputValue, setInputValue] = import_react2.useState("");
374
+ const [cursorOffset, setCursorOffset] = import_react2.useState(0);
375
+ const exitState = useExitOnCtrlCDWithKeybindings();
376
+ useKeybinding("confirm:no", onCancel, { context: "Settings" });
377
+ const { columns } = useTerminalSize();
378
+ const textInputColumns = columns - 6;
379
+ const handleSubmit = (value) => {
380
+ const trimmedValue = value.trim();
381
+ if (trimmedValue.length === 0) {
382
+ return;
383
+ }
384
+ const ruleValue = permissionRuleValueFromString(trimmedValue);
385
+ onSubmit(ruleValue, ruleBehavior);
386
+ };
387
+ return /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(jsx_dev_runtime3.Fragment, {
388
+ children: [
389
+ /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedBox_default, {
390
+ flexDirection: "column",
391
+ gap: 1,
392
+ borderStyle: "round",
393
+ paddingLeft: 1,
394
+ paddingRight: 1,
395
+ borderColor: "permission",
396
+ children: [
397
+ /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedText, {
398
+ bold: true,
399
+ color: "permission",
400
+ children: [
401
+ "Add ",
402
+ ruleBehavior,
403
+ " permission rule"
404
+ ]
405
+ }, undefined, true, undefined, this),
406
+ /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedBox_default, {
407
+ flexDirection: "column",
408
+ children: [
409
+ /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedText, {
410
+ children: [
411
+ "Permission rules are a tool name, optionally followed by a specifier in parentheses.",
412
+ /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Newline, {}, undefined, false, undefined, this),
413
+ "e.g.,",
414
+ " ",
415
+ /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedText, {
416
+ bold: true,
417
+ children: permissionRuleValueToString({ toolName: WebFetchTool.name })
418
+ }, undefined, false, undefined, this),
419
+ /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedText, {
420
+ bold: false,
421
+ children: " or "
422
+ }, undefined, false, undefined, this),
423
+ /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedText, {
424
+ bold: true,
425
+ children: permissionRuleValueToString({
426
+ toolName: BashTool.name,
427
+ ruleContent: "ls:*"
428
+ })
429
+ }, undefined, false, undefined, this)
430
+ ]
431
+ }, undefined, true, undefined, this),
432
+ /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedBox_default, {
433
+ borderDimColor: true,
434
+ borderStyle: "round",
435
+ marginY: 1,
436
+ paddingLeft: 1,
437
+ children: /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(TextInput, {
438
+ showCursor: true,
439
+ value: inputValue,
440
+ onChange: setInputValue,
441
+ onSubmit: handleSubmit,
442
+ placeholder: `Enter permission rule${figures_default.ellipsis}`,
443
+ columns: textInputColumns,
444
+ cursorOffset,
445
+ onChangeCursorOffset: setCursorOffset
446
+ }, undefined, false, undefined, this)
447
+ }, undefined, false, undefined, this)
448
+ ]
449
+ }, undefined, true, undefined, this)
450
+ ]
451
+ }, undefined, true, undefined, this),
452
+ /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedBox_default, {
453
+ marginLeft: 3,
454
+ children: exitState.pending ? /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedText, {
455
+ dimColor: true,
456
+ children: [
457
+ "Press ",
458
+ exitState.keyName,
459
+ " again to exit"
460
+ ]
461
+ }, undefined, true, undefined, this) : /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedText, {
462
+ dimColor: true,
463
+ children: "Enter to submit \xB7 Esc to cancel"
464
+ }, undefined, false, undefined, this)
465
+ }, undefined, false, undefined, this)
466
+ ]
467
+ }, undefined, true, undefined, this);
468
+ }
469
+ var import_react2, jsx_dev_runtime3;
470
+ var init_PermissionRuleInput = __esm(() => {
471
+ init_figures();
472
+ init_TextInput();
473
+ init_useExitOnCtrlCDWithKeybindings();
474
+ init_useTerminalSize();
475
+ init_src();
476
+ init_useKeybinding();
477
+ init_BashTool();
478
+ init_WebFetchTool();
479
+ init_permissionRuleParser();
480
+ import_react2 = __toESM(require_react(), 1);
481
+ jsx_dev_runtime3 = __toESM(require_jsx_dev_runtime(), 1);
482
+ });
483
+
484
+ // src/components/permissions/rules/RecentDenialsTab.tsx
485
+ function RecentDenialsTab({
486
+ onHeaderFocusChange,
487
+ onStateChange
488
+ }) {
489
+ const { headerFocused, focusHeader } = useTabHeaderFocus();
490
+ import_react3.useEffect(() => {
491
+ onHeaderFocusChange?.(headerFocused);
492
+ }, [headerFocused, onHeaderFocusChange]);
493
+ const [denials] = import_react3.useState(() => getAutoModeDenials());
494
+ const [approved, setApproved] = import_react3.useState(() => new Set);
495
+ const [retry, setRetry] = import_react3.useState(() => new Set);
496
+ const [focusedIdx, setFocusedIdx] = import_react3.useState(0);
497
+ import_react3.useEffect(() => {
498
+ onStateChange({ approved, retry, denials });
499
+ }, [approved, retry, denials, onStateChange]);
500
+ const handleSelect = import_react3.useCallback((value) => {
501
+ const idx = Number(value);
502
+ setApproved((prev) => {
503
+ const next = new Set(prev);
504
+ if (next.has(idx))
505
+ next.delete(idx);
506
+ else
507
+ next.add(idx);
508
+ return next;
509
+ });
510
+ }, []);
511
+ const handleFocus = import_react3.useCallback((value) => {
512
+ setFocusedIdx(Number(value));
513
+ }, []);
514
+ use_input_default((input, _key) => {
515
+ if (input === "r") {
516
+ setRetry((prev) => {
517
+ const next = new Set(prev);
518
+ if (next.has(focusedIdx))
519
+ next.delete(focusedIdx);
520
+ else
521
+ next.add(focusedIdx);
522
+ return next;
523
+ });
524
+ setApproved((prev) => {
525
+ if (prev.has(focusedIdx))
526
+ return prev;
527
+ const next = new Set(prev);
528
+ next.add(focusedIdx);
529
+ return next;
530
+ });
531
+ }
532
+ }, { isActive: denials.length > 0 });
533
+ if (denials.length === 0) {
534
+ return /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(ThemedText, {
535
+ dimColor: true,
536
+ children: "No recent denials. Commands denied by the auto mode classifier will appear here."
537
+ }, undefined, false, undefined, this);
538
+ }
539
+ const options = denials.map((d, idx) => {
540
+ const isApproved = approved.has(idx);
541
+ const suffix = retry.has(idx) ? " (retry)" : "";
542
+ return {
543
+ label: /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(ThemedText, {
544
+ children: [
545
+ /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(StatusIcon, {
546
+ status: isApproved ? "success" : "error",
547
+ withSpace: true
548
+ }, undefined, false, undefined, this),
549
+ d.display,
550
+ /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(ThemedText, {
551
+ dimColor: true,
552
+ children: suffix
553
+ }, undefined, false, undefined, this)
554
+ ]
555
+ }, undefined, true, undefined, this),
556
+ value: String(idx)
557
+ };
558
+ });
559
+ return /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(ThemedBox_default, {
560
+ flexDirection: "column",
561
+ children: [
562
+ /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(ThemedText, {
563
+ children: "Commands recently denied by the auto mode classifier."
564
+ }, undefined, false, undefined, this),
565
+ /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(ThemedBox_default, {
566
+ marginTop: 1,
567
+ children: /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Select, {
568
+ options,
569
+ onChange: handleSelect,
570
+ onFocus: handleFocus,
571
+ visibleOptionCount: Math.min(10, options.length),
572
+ isDisabled: headerFocused,
573
+ onUpFromFirstItem: focusHeader
574
+ }, undefined, false, undefined, this)
575
+ }, undefined, false, undefined, this)
576
+ ]
577
+ }, undefined, true, undefined, this);
578
+ }
579
+ var import_react3, jsx_dev_runtime4;
580
+ var init_RecentDenialsTab = __esm(() => {
581
+ init_src();
582
+ init_autoModeDenials();
583
+ init_select();
584
+ init_src();
585
+ import_react3 = __toESM(require_react(), 1);
586
+ jsx_dev_runtime4 = __toESM(require_jsx_dev_runtime(), 1);
587
+ });
588
+
589
+ // src/components/permissions/rules/RemoveWorkspaceDirectory.tsx
590
+ function RemoveWorkspaceDirectory({
591
+ directoryPath,
592
+ onRemove,
593
+ onCancel,
594
+ permissionContext,
595
+ setPermissionContext
596
+ }) {
597
+ const handleRemove = import_react4.useCallback(() => {
598
+ const updatedContext = applyPermissionUpdate(permissionContext, {
599
+ type: "removeDirectories",
600
+ directories: [directoryPath],
601
+ destination: "session"
602
+ });
603
+ setPermissionContext(updatedContext);
604
+ onRemove();
605
+ }, [directoryPath, permissionContext, setPermissionContext, onRemove]);
606
+ const handleSelect = import_react4.useCallback((value) => {
607
+ if (value === "yes") {
608
+ handleRemove();
609
+ } else {
610
+ onCancel();
611
+ }
612
+ }, [handleRemove, onCancel]);
613
+ return /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Dialog, {
614
+ title: "Remove directory from workspace?",
615
+ onCancel,
616
+ color: "error",
617
+ children: [
618
+ /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(ThemedBox_default, {
619
+ marginX: 2,
620
+ flexDirection: "column",
621
+ children: /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(ThemedText, {
622
+ bold: true,
623
+ children: directoryPath
624
+ }, undefined, false, undefined, this)
625
+ }, undefined, false, undefined, this),
626
+ /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(ThemedText, {
627
+ children: "Claude Code will no longer have access to files in this directory."
628
+ }, undefined, false, undefined, this),
629
+ /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Select, {
630
+ onChange: handleSelect,
631
+ onCancel,
632
+ options: [
633
+ { label: "Yes", value: "yes" },
634
+ { label: "No", value: "no" }
635
+ ]
636
+ }, undefined, false, undefined, this)
637
+ ]
638
+ }, undefined, true, undefined, this);
639
+ }
640
+ var import_react4, jsx_dev_runtime5;
641
+ var init_RemoveWorkspaceDirectory = __esm(() => {
642
+ init_select();
643
+ init_src();
644
+ init_PermissionUpdate();
645
+ init_src();
646
+ import_react4 = __toESM(require_react(), 1);
647
+ jsx_dev_runtime5 = __toESM(require_jsx_dev_runtime(), 1);
648
+ });
649
+
650
+ // src/components/permissions/rules/WorkspaceTab.tsx
651
+ function WorkspaceTab({
652
+ onExit,
653
+ toolPermissionContext,
654
+ onRequestAddDirectory,
655
+ onRequestRemoveDirectory,
656
+ onHeaderFocusChange
657
+ }) {
658
+ const { headerFocused, focusHeader } = useTabHeaderFocus();
659
+ import_react5.useEffect(() => {
660
+ onHeaderFocusChange?.(headerFocused);
661
+ }, [headerFocused, onHeaderFocusChange]);
662
+ const additionalDirectories = React.useMemo(() => {
663
+ return Array.from(toolPermissionContext.additionalWorkingDirectories.keys()).map((path) => ({
664
+ path,
665
+ isCurrent: false,
666
+ isDeletable: true
667
+ }));
668
+ }, [toolPermissionContext.additionalWorkingDirectories]);
669
+ const handleDirectorySelect = import_react5.useCallback((selectedValue) => {
670
+ if (selectedValue === "add-directory") {
671
+ onRequestAddDirectory();
672
+ return;
673
+ }
674
+ const directory = additionalDirectories.find((d) => d.path === selectedValue);
675
+ if (directory && directory.isDeletable) {
676
+ onRequestRemoveDirectory(directory.path);
677
+ }
678
+ }, [additionalDirectories, onRequestAddDirectory, onRequestRemoveDirectory]);
679
+ const handleCancel = import_react5.useCallback(() => onExit("Workspace dialog dismissed", { display: "system" }), [onExit]);
680
+ const options = React.useMemo(() => {
681
+ const opts = additionalDirectories.map((dir) => ({
682
+ label: dir.path,
683
+ value: dir.path
684
+ }));
685
+ opts.push({
686
+ label: `Add directory${figures_default.ellipsis}`,
687
+ value: "add-directory"
688
+ });
689
+ return opts;
690
+ }, [additionalDirectories]);
691
+ return /* @__PURE__ */ jsx_dev_runtime6.jsxDEV(ThemedBox_default, {
692
+ flexDirection: "column",
693
+ marginBottom: 1,
694
+ children: [
695
+ /* @__PURE__ */ jsx_dev_runtime6.jsxDEV(ThemedBox_default, {
696
+ flexDirection: "row",
697
+ marginTop: 1,
698
+ marginLeft: 2,
699
+ gap: 1,
700
+ children: [
701
+ /* @__PURE__ */ jsx_dev_runtime6.jsxDEV(ThemedText, {
702
+ children: `- ${getOriginalCwd()}`
703
+ }, undefined, false, undefined, this),
704
+ /* @__PURE__ */ jsx_dev_runtime6.jsxDEV(ThemedText, {
705
+ dimColor: true,
706
+ children: "(Original working directory)"
707
+ }, undefined, false, undefined, this)
708
+ ]
709
+ }, undefined, true, undefined, this),
710
+ /* @__PURE__ */ jsx_dev_runtime6.jsxDEV(Select, {
711
+ options,
712
+ onChange: handleDirectorySelect,
713
+ onCancel: handleCancel,
714
+ visibleOptionCount: Math.min(10, options.length),
715
+ onUpFromFirstItem: focusHeader,
716
+ isDisabled: headerFocused
717
+ }, undefined, false, undefined, this)
718
+ ]
719
+ }, undefined, true, undefined, this);
720
+ }
721
+ var React, import_react5, jsx_dev_runtime6;
722
+ var init_WorkspaceTab = __esm(() => {
723
+ init_figures();
724
+ init_state();
725
+ init_select();
726
+ init_src();
727
+ React = __toESM(require_react(), 1);
728
+ import_react5 = __toESM(require_react(), 1);
729
+ jsx_dev_runtime6 = __toESM(require_jsx_dev_runtime(), 1);
730
+ });
731
+
732
+ // src/components/permissions/rules/PermissionRuleList.tsx
733
+ function RuleSourceText({ rule }) {
734
+ return /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedText, {
735
+ dimColor: true,
736
+ children: `From ${permissionRuleSourceDisplayString(rule.source)}`
737
+ }, undefined, false, undefined, this);
738
+ }
739
+ function getRuleBehaviorLabel(ruleBehavior) {
740
+ switch (ruleBehavior) {
741
+ case "allow":
742
+ return "allowed";
743
+ case "deny":
744
+ return "denied";
745
+ case "ask":
746
+ return "ask";
747
+ }
748
+ }
749
+ function RuleDetails({
750
+ rule,
751
+ onDelete,
752
+ onCancel
753
+ }) {
754
+ const exitState = useExitOnCtrlCDWithKeybindings();
755
+ useKeybinding("confirm:no", onCancel, { context: "Confirmation" });
756
+ const ruleDescription = /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedBox_default, {
757
+ flexDirection: "column",
758
+ marginX: 2,
759
+ children: [
760
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedText, {
761
+ bold: true,
762
+ children: permissionRuleValueToString(rule.ruleValue)
763
+ }, undefined, false, undefined, this),
764
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(PermissionRuleDescription, {
765
+ ruleValue: rule.ruleValue
766
+ }, undefined, false, undefined, this),
767
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(RuleSourceText, {
768
+ rule
769
+ }, undefined, false, undefined, this)
770
+ ]
771
+ }, undefined, true, undefined, this);
772
+ const footer = /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedBox_default, {
773
+ marginLeft: 3,
774
+ children: exitState.pending ? /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedText, {
775
+ dimColor: true,
776
+ children: [
777
+ "Press ",
778
+ exitState.keyName,
779
+ " again to exit"
780
+ ]
781
+ }, undefined, true, undefined, this) : /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedText, {
782
+ dimColor: true,
783
+ children: "Esc to cancel"
784
+ }, undefined, false, undefined, this)
785
+ }, undefined, false, undefined, this);
786
+ if (rule.source === "policySettings") {
787
+ return /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(jsx_dev_runtime7.Fragment, {
788
+ children: [
789
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedBox_default, {
790
+ flexDirection: "column",
791
+ gap: 1,
792
+ borderStyle: "round",
793
+ paddingLeft: 1,
794
+ paddingRight: 1,
795
+ borderColor: "permission",
796
+ children: [
797
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedText, {
798
+ bold: true,
799
+ color: "permission",
800
+ children: "Rule details"
801
+ }, undefined, false, undefined, this),
802
+ ruleDescription,
803
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedText, {
804
+ italic: true,
805
+ children: [
806
+ "This rule is configured by managed settings and cannot be modified.",
807
+ `
808
+ `,
809
+ "Contact your system administrator for more information."
810
+ ]
811
+ }, undefined, true, undefined, this)
812
+ ]
813
+ }, undefined, true, undefined, this),
814
+ footer
815
+ ]
816
+ }, undefined, true, undefined, this);
817
+ }
818
+ return /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(jsx_dev_runtime7.Fragment, {
819
+ children: [
820
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedBox_default, {
821
+ flexDirection: "column",
822
+ gap: 1,
823
+ borderStyle: "round",
824
+ paddingLeft: 1,
825
+ paddingRight: 1,
826
+ borderColor: "error",
827
+ children: [
828
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedText, {
829
+ bold: true,
830
+ color: "error",
831
+ children: [
832
+ "Delete ",
833
+ getRuleBehaviorLabel(rule.ruleBehavior),
834
+ " tool?"
835
+ ]
836
+ }, undefined, true, undefined, this),
837
+ ruleDescription,
838
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedText, {
839
+ children: "Are you sure you want to delete this permission rule?"
840
+ }, undefined, false, undefined, this),
841
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(Select, {
842
+ onChange: (_) => _ === "yes" ? onDelete() : onCancel(),
843
+ onCancel,
844
+ options: [
845
+ { label: "Yes", value: "yes" },
846
+ { label: "No", value: "no" }
847
+ ]
848
+ }, undefined, false, undefined, this)
849
+ ]
850
+ }, undefined, true, undefined, this),
851
+ footer
852
+ ]
853
+ }, undefined, true, undefined, this);
854
+ }
855
+ function RulesTabContent(props) {
856
+ const {
857
+ options,
858
+ searchQuery,
859
+ isSearchMode,
860
+ isFocused,
861
+ onSelect,
862
+ onCancel,
863
+ lastFocusedRuleKey,
864
+ cursorOffset,
865
+ onHeaderFocusChange
866
+ } = props;
867
+ const tabWidth = useTabsWidth();
868
+ const { headerFocused, focusHeader, blurHeader } = useTabHeaderFocus2();
869
+ import_react6.useEffect(() => {
870
+ if (isSearchMode && headerFocused)
871
+ blurHeader();
872
+ }, [isSearchMode, headerFocused, blurHeader]);
873
+ import_react6.useEffect(() => {
874
+ onHeaderFocusChange?.(headerFocused);
875
+ }, [headerFocused, onHeaderFocusChange]);
876
+ return /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedBox_default, {
877
+ flexDirection: "column",
878
+ children: [
879
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedBox_default, {
880
+ marginBottom: 1,
881
+ flexDirection: "column",
882
+ children: /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(SearchBox, {
883
+ query: searchQuery,
884
+ isFocused: isSearchMode && !headerFocused,
885
+ isTerminalFocused: isFocused,
886
+ width: tabWidth,
887
+ cursorOffset
888
+ }, undefined, false, undefined, this)
889
+ }, undefined, false, undefined, this),
890
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(Select, {
891
+ options,
892
+ onChange: onSelect,
893
+ onCancel,
894
+ visibleOptionCount: Math.min(10, options.length),
895
+ isDisabled: isSearchMode || headerFocused,
896
+ defaultFocusValue: lastFocusedRuleKey,
897
+ onUpFromFirstItem: focusHeader
898
+ }, undefined, false, undefined, this)
899
+ ]
900
+ }, undefined, true, undefined, this);
901
+ }
902
+ function PermissionRulesTab({
903
+ tab,
904
+ getRulesOptions,
905
+ handleToolSelect,
906
+ ...rulesProps
907
+ }) {
908
+ return /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedBox_default, {
909
+ flexDirection: "column",
910
+ flexShrink: tab === "allow" ? 0 : undefined,
911
+ children: [
912
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedText, {
913
+ children: {
914
+ allow: "Claude Code won't ask before using allowed tools.",
915
+ ask: "Claude Code will always ask for confirmation before using these tools.",
916
+ deny: "Claude Code will always reject requests to use denied tools."
917
+ }[tab]
918
+ }, undefined, false, undefined, this),
919
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(RulesTabContent, {
920
+ options: getRulesOptions(tab, rulesProps.searchQuery).options,
921
+ onSelect: (v) => handleToolSelect(v, tab),
922
+ ...rulesProps
923
+ }, undefined, false, undefined, this)
924
+ ]
925
+ }, undefined, true, undefined, this);
926
+ }
927
+ function PermissionRuleList({
928
+ onExit,
929
+ initialTab,
930
+ onRetryDenials
931
+ }) {
932
+ const hasDenials = getAutoModeDenials().length > 0;
933
+ const defaultTab = initialTab ?? (hasDenials ? "recent" : "allow");
934
+ const [changes, setChanges] = import_react6.useState([]);
935
+ const toolPermissionContext = useAppState((s) => s.toolPermissionContext);
936
+ const setAppState = useSetAppState();
937
+ const isTerminalFocused = useTerminalFocus();
938
+ const denialStateRef = import_react6.useRef({ approved: new Set, retry: new Set, denials: [] });
939
+ const handleDenialStateChange = import_react6.useCallback((s) => {
940
+ denialStateRef.current = s;
941
+ }, []);
942
+ const [selectedRule, setSelectedRule] = import_react6.useState();
943
+ const [lastFocusedRuleKey, setLastFocusedRuleKey] = import_react6.useState();
944
+ const [addingRuleToTab, setAddingRuleToTab] = import_react6.useState(null);
945
+ const [validatedRule, setValidatedRule] = import_react6.useState(null);
946
+ const [isAddingWorkspaceDirectory, setIsAddingWorkspaceDirectory] = import_react6.useState(false);
947
+ const [removingDirectory, setRemovingDirectory] = import_react6.useState(null);
948
+ const [isSearchMode, setIsSearchMode] = import_react6.useState(false);
949
+ const [headerFocused, setHeaderFocused] = import_react6.useState(true);
950
+ const handleHeaderFocusChange = import_react6.useCallback((focused) => {
951
+ setHeaderFocused(focused);
952
+ }, []);
953
+ const allowRulesByKey = import_react6.useMemo(() => {
954
+ const map = new Map;
955
+ getAllowRules(toolPermissionContext).forEach((rule) => {
956
+ map.set(jsonStringify(rule), rule);
957
+ });
958
+ return map;
959
+ }, [toolPermissionContext]);
960
+ const denyRulesByKey = import_react6.useMemo(() => {
961
+ const map = new Map;
962
+ getDenyRules(toolPermissionContext).forEach((rule) => {
963
+ map.set(jsonStringify(rule), rule);
964
+ });
965
+ return map;
966
+ }, [toolPermissionContext]);
967
+ const askRulesByKey = import_react6.useMemo(() => {
968
+ const map = new Map;
969
+ getAskRules(toolPermissionContext).forEach((rule) => {
970
+ map.set(jsonStringify(rule), rule);
971
+ });
972
+ return map;
973
+ }, [toolPermissionContext]);
974
+ const getRulesOptions = import_react6.useCallback((tab, query = "") => {
975
+ const rulesByKey = (() => {
976
+ switch (tab) {
977
+ case "allow":
978
+ return allowRulesByKey;
979
+ case "deny":
980
+ return denyRulesByKey;
981
+ case "ask":
982
+ return askRulesByKey;
983
+ case "workspace":
984
+ case "recent":
985
+ return new Map;
986
+ }
987
+ })();
988
+ const options = [];
989
+ if (tab !== "workspace" && tab !== "recent" && !query) {
990
+ options.push({
991
+ label: `Add a new rule${figures_default.ellipsis}`,
992
+ value: "add-new-rule"
993
+ });
994
+ }
995
+ const sortedRuleKeys = Array.from(rulesByKey.keys()).sort((a, b) => {
996
+ const ruleA = rulesByKey.get(a);
997
+ const ruleB = rulesByKey.get(b);
998
+ if (ruleA && ruleB) {
999
+ const ruleAString = permissionRuleValueToString(ruleA.ruleValue).toLowerCase();
1000
+ const ruleBString = permissionRuleValueToString(ruleB.ruleValue).toLowerCase();
1001
+ return ruleAString.localeCompare(ruleBString);
1002
+ }
1003
+ return 0;
1004
+ });
1005
+ const lowerQuery = query.toLowerCase();
1006
+ for (const ruleKey of sortedRuleKeys) {
1007
+ const rule = rulesByKey.get(ruleKey);
1008
+ if (rule) {
1009
+ const ruleString = permissionRuleValueToString(rule.ruleValue);
1010
+ if (query && !ruleString.toLowerCase().includes(lowerQuery)) {
1011
+ continue;
1012
+ }
1013
+ options.push({
1014
+ label: ruleString,
1015
+ value: ruleKey
1016
+ });
1017
+ }
1018
+ }
1019
+ return { options, rulesByKey };
1020
+ }, [allowRulesByKey, denyRulesByKey, askRulesByKey]);
1021
+ const exitState = useExitOnCtrlCDWithKeybindings();
1022
+ const isSearchModeActive = !selectedRule && !addingRuleToTab && !validatedRule && !isAddingWorkspaceDirectory && !removingDirectory;
1023
+ const {
1024
+ query: searchQuery,
1025
+ setQuery: setSearchQuery,
1026
+ cursorOffset: searchCursorOffset
1027
+ } = useSearchInput({
1028
+ isActive: isSearchModeActive && isSearchMode,
1029
+ onExit: () => {
1030
+ setIsSearchMode(false);
1031
+ }
1032
+ });
1033
+ const handleKeyDown = import_react6.useCallback((e) => {
1034
+ if (!isSearchModeActive)
1035
+ return;
1036
+ if (isSearchMode)
1037
+ return;
1038
+ if (e.ctrl || e.meta)
1039
+ return;
1040
+ if (e.key === "/") {
1041
+ e.preventDefault();
1042
+ setIsSearchMode(true);
1043
+ setSearchQuery("");
1044
+ } else if (e.key.length === 1 && e.key !== "j" && e.key !== "k" && e.key !== "m" && e.key !== "i" && e.key !== "r" && e.key !== " ") {
1045
+ e.preventDefault();
1046
+ setIsSearchMode(true);
1047
+ setSearchQuery(e.key);
1048
+ }
1049
+ }, [isSearchModeActive, isSearchMode, setSearchQuery]);
1050
+ const handleToolSelect = import_react6.useCallback((selectedValue, tab) => {
1051
+ const { rulesByKey } = getRulesOptions(tab);
1052
+ if (selectedValue === "add-new-rule") {
1053
+ setAddingRuleToTab(tab);
1054
+ return;
1055
+ } else {
1056
+ setSelectedRule(rulesByKey.get(selectedValue));
1057
+ return;
1058
+ }
1059
+ }, [getRulesOptions]);
1060
+ const handleRuleInputCancel = import_react6.useCallback(() => {
1061
+ setAddingRuleToTab(null);
1062
+ }, []);
1063
+ const handleRuleInputSubmit = import_react6.useCallback((ruleValue, ruleBehavior) => {
1064
+ setValidatedRule({ ruleValue, ruleBehavior });
1065
+ setAddingRuleToTab(null);
1066
+ }, []);
1067
+ const handleAddRulesSuccess = import_react6.useCallback((rules, unreachable) => {
1068
+ setValidatedRule(null);
1069
+ for (const rule of rules) {
1070
+ setChanges((prev) => [
1071
+ ...prev,
1072
+ `Added ${rule.ruleBehavior} rule ${source_default.bold(permissionRuleValueToString(rule.ruleValue))}`
1073
+ ]);
1074
+ }
1075
+ if (unreachable && unreachable.length > 0) {
1076
+ for (const u of unreachable) {
1077
+ const severity = u.shadowType === "deny" ? "blocked" : "shadowed";
1078
+ setChanges((prev) => [
1079
+ ...prev,
1080
+ source_default.yellow(`${figures_default.warning} Warning: ${permissionRuleValueToString(u.rule.ruleValue)} is ${severity}`),
1081
+ source_default.dim(` ${u.reason}`),
1082
+ source_default.dim(` Fix: ${u.fix}`)
1083
+ ]);
1084
+ }
1085
+ }
1086
+ }, []);
1087
+ const handleAddRuleCancel = import_react6.useCallback(() => {
1088
+ setValidatedRule(null);
1089
+ }, []);
1090
+ const handleRequestAddDirectory = import_react6.useCallback(() => setIsAddingWorkspaceDirectory(true), []);
1091
+ const handleRequestRemoveDirectory = import_react6.useCallback((path) => setRemovingDirectory(path), []);
1092
+ const handleRulesCancel = import_react6.useCallback(() => {
1093
+ const s = denialStateRef.current;
1094
+ const denialsFor = (set) => Array.from(set).map((idx) => s.denials[idx]).filter((d) => d !== undefined);
1095
+ const retryDenials = denialsFor(s.retry);
1096
+ if (retryDenials.length > 0) {
1097
+ const commands = retryDenials.map((d) => d.display);
1098
+ onRetryDenials?.(commands);
1099
+ onExit(undefined, {
1100
+ shouldQuery: true,
1101
+ metaMessages: [
1102
+ `Permission granted for: ${commands.join(", ")}. You may now retry ${commands.length === 1 ? "this command" : "these commands"} if you would like.`
1103
+ ]
1104
+ });
1105
+ return;
1106
+ }
1107
+ const approvedDenials = denialsFor(s.approved);
1108
+ if (approvedDenials.length > 0 || changes.length > 0) {
1109
+ const approvedMsg = approvedDenials.length > 0 ? [
1110
+ `Approved ${approvedDenials.map((d) => source_default.bold(d.display)).join(", ")}`
1111
+ ] : [];
1112
+ onExit([...approvedMsg, ...changes].join(`
1113
+ `));
1114
+ } else {
1115
+ onExit("Permissions dialog dismissed", {
1116
+ display: "system"
1117
+ });
1118
+ }
1119
+ }, [changes, onExit, onRetryDenials]);
1120
+ useKeybinding("confirm:no", handleRulesCancel, {
1121
+ context: "Settings",
1122
+ isActive: isSearchModeActive && !isSearchMode
1123
+ });
1124
+ const handleDeleteRule = () => {
1125
+ if (!selectedRule)
1126
+ return;
1127
+ const { options } = getRulesOptions(selectedRule.ruleBehavior);
1128
+ const selectedKey = jsonStringify(selectedRule);
1129
+ const ruleKeys = options.filter((opt) => opt.value !== "add-new-rule").map((opt) => opt.value);
1130
+ const currentIndex = ruleKeys.indexOf(selectedKey);
1131
+ let nextFocusKey;
1132
+ if (currentIndex !== -1) {
1133
+ if (currentIndex < ruleKeys.length - 1) {
1134
+ nextFocusKey = ruleKeys[currentIndex + 1];
1135
+ } else if (currentIndex > 0) {
1136
+ nextFocusKey = ruleKeys[currentIndex - 1];
1137
+ }
1138
+ }
1139
+ setLastFocusedRuleKey(nextFocusKey);
1140
+ deletePermissionRule({
1141
+ rule: selectedRule,
1142
+ initialContext: toolPermissionContext,
1143
+ setToolPermissionContext(toolPermissionContext2) {
1144
+ setAppState((prev) => ({
1145
+ ...prev,
1146
+ toolPermissionContext: toolPermissionContext2
1147
+ }));
1148
+ }
1149
+ });
1150
+ setChanges((prev) => [
1151
+ ...prev,
1152
+ `Deleted ${selectedRule.ruleBehavior} rule ${source_default.bold(permissionRuleValueToString(selectedRule.ruleValue))}`
1153
+ ]);
1154
+ setSelectedRule(undefined);
1155
+ };
1156
+ if (selectedRule) {
1157
+ return /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(RuleDetails, {
1158
+ rule: selectedRule,
1159
+ onDelete: handleDeleteRule,
1160
+ onCancel: () => setSelectedRule(undefined)
1161
+ }, undefined, false, undefined, this);
1162
+ }
1163
+ if (addingRuleToTab && addingRuleToTab !== "workspace" && addingRuleToTab !== "recent") {
1164
+ return /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(PermissionRuleInput, {
1165
+ onCancel: handleRuleInputCancel,
1166
+ onSubmit: handleRuleInputSubmit,
1167
+ ruleBehavior: addingRuleToTab
1168
+ }, undefined, false, undefined, this);
1169
+ }
1170
+ if (validatedRule) {
1171
+ return /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(AddPermissionRules, {
1172
+ onAddRules: handleAddRulesSuccess,
1173
+ onCancel: handleAddRuleCancel,
1174
+ ruleValues: [validatedRule.ruleValue],
1175
+ ruleBehavior: validatedRule.ruleBehavior,
1176
+ initialContext: toolPermissionContext,
1177
+ setToolPermissionContext: (toolPermissionContext2) => {
1178
+ setAppState((prev) => ({
1179
+ ...prev,
1180
+ toolPermissionContext: toolPermissionContext2
1181
+ }));
1182
+ }
1183
+ }, undefined, false, undefined, this);
1184
+ }
1185
+ if (isAddingWorkspaceDirectory) {
1186
+ return /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(AddWorkspaceDirectory, {
1187
+ onAddDirectory: (path, remember) => {
1188
+ const destination = remember ? "localSettings" : "session";
1189
+ const permissionUpdate = {
1190
+ type: "addDirectories",
1191
+ directories: [path],
1192
+ destination
1193
+ };
1194
+ const updatedContext = applyPermissionUpdate(toolPermissionContext, permissionUpdate);
1195
+ setAppState((prev) => ({
1196
+ ...prev,
1197
+ toolPermissionContext: updatedContext
1198
+ }));
1199
+ if (remember) {
1200
+ persistPermissionUpdate(permissionUpdate);
1201
+ }
1202
+ setChanges((prev) => [
1203
+ ...prev,
1204
+ `Added directory ${source_default.bold(path)} to workspace${remember ? " and saved to local settings" : " for this session"}`
1205
+ ]);
1206
+ setIsAddingWorkspaceDirectory(false);
1207
+ },
1208
+ onCancel: () => setIsAddingWorkspaceDirectory(false),
1209
+ permissionContext: toolPermissionContext
1210
+ }, undefined, false, undefined, this);
1211
+ }
1212
+ if (removingDirectory) {
1213
+ return /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(RemoveWorkspaceDirectory, {
1214
+ directoryPath: removingDirectory,
1215
+ onRemove: () => {
1216
+ setChanges((prev) => [
1217
+ ...prev,
1218
+ `Removed directory ${source_default.bold(removingDirectory)} from workspace`
1219
+ ]);
1220
+ setRemovingDirectory(null);
1221
+ },
1222
+ onCancel: () => setRemovingDirectory(null),
1223
+ permissionContext: toolPermissionContext,
1224
+ setPermissionContext: (toolPermissionContext2) => {
1225
+ setAppState((prev) => ({
1226
+ ...prev,
1227
+ toolPermissionContext: toolPermissionContext2
1228
+ }));
1229
+ }
1230
+ }, undefined, false, undefined, this);
1231
+ }
1232
+ const sharedRulesProps = {
1233
+ searchQuery,
1234
+ isSearchMode,
1235
+ isFocused: isTerminalFocused,
1236
+ onCancel: handleRulesCancel,
1237
+ lastFocusedRuleKey,
1238
+ cursorOffset: searchCursorOffset,
1239
+ getRulesOptions,
1240
+ handleToolSelect,
1241
+ onHeaderFocusChange: handleHeaderFocusChange
1242
+ };
1243
+ const isHidden = !!selectedRule || !!addingRuleToTab || !!validatedRule || isAddingWorkspaceDirectory || !!removingDirectory;
1244
+ return /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedBox_default, {
1245
+ flexDirection: "column",
1246
+ onKeyDown: handleKeyDown,
1247
+ children: /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(Pane, {
1248
+ color: "permission",
1249
+ children: [
1250
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(Tabs, {
1251
+ title: "Permissions:",
1252
+ color: "permission",
1253
+ defaultTab,
1254
+ hidden: isHidden,
1255
+ initialHeaderFocused: !hasDenials,
1256
+ navFromContent: !isSearchMode,
1257
+ children: [
1258
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(Tab, {
1259
+ id: "recent",
1260
+ title: "Recently denied",
1261
+ children: /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(RecentDenialsTab, {
1262
+ onHeaderFocusChange: handleHeaderFocusChange,
1263
+ onStateChange: handleDenialStateChange
1264
+ }, undefined, false, undefined, this)
1265
+ }, undefined, false, undefined, this),
1266
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(Tab, {
1267
+ id: "allow",
1268
+ title: "Allow",
1269
+ children: /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(PermissionRulesTab, {
1270
+ tab: "allow",
1271
+ ...sharedRulesProps
1272
+ }, undefined, false, undefined, this)
1273
+ }, undefined, false, undefined, this),
1274
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(Tab, {
1275
+ id: "ask",
1276
+ title: "Ask",
1277
+ children: /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(PermissionRulesTab, {
1278
+ tab: "ask",
1279
+ ...sharedRulesProps
1280
+ }, undefined, false, undefined, this)
1281
+ }, undefined, false, undefined, this),
1282
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(Tab, {
1283
+ id: "deny",
1284
+ title: "Deny",
1285
+ children: /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(PermissionRulesTab, {
1286
+ tab: "deny",
1287
+ ...sharedRulesProps
1288
+ }, undefined, false, undefined, this)
1289
+ }, undefined, false, undefined, this),
1290
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(Tab, {
1291
+ id: "workspace",
1292
+ title: "Workspace",
1293
+ children: /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedBox_default, {
1294
+ flexDirection: "column",
1295
+ children: [
1296
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedText, {
1297
+ children: "Claude Code can read files in the workspace, and make edits when auto-accept edits is on."
1298
+ }, undefined, false, undefined, this),
1299
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(WorkspaceTab, {
1300
+ onExit,
1301
+ toolPermissionContext,
1302
+ onRequestAddDirectory: handleRequestAddDirectory,
1303
+ onRequestRemoveDirectory: handleRequestRemoveDirectory,
1304
+ onHeaderFocusChange: handleHeaderFocusChange
1305
+ }, undefined, false, undefined, this)
1306
+ ]
1307
+ }, undefined, true, undefined, this)
1308
+ }, undefined, false, undefined, this)
1309
+ ]
1310
+ }, undefined, true, undefined, this),
1311
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedBox_default, {
1312
+ marginTop: 1,
1313
+ paddingLeft: 1,
1314
+ children: /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedText, {
1315
+ dimColor: true,
1316
+ children: exitState.pending ? /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(jsx_dev_runtime7.Fragment, {
1317
+ children: [
1318
+ "Press ",
1319
+ exitState.keyName,
1320
+ " again to exit"
1321
+ ]
1322
+ }, undefined, true, undefined, this) : headerFocused ? /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(jsx_dev_runtime7.Fragment, {
1323
+ children: "\u2190/\u2192 tab switch \xB7 \u2193 return \xB7 Esc cancel"
1324
+ }, undefined, false, undefined, this) : isSearchMode ? /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(jsx_dev_runtime7.Fragment, {
1325
+ children: "Type to filter \xB7 Enter/\u2193 select \xB7 \u2191 tabs \xB7 Esc clear"
1326
+ }, undefined, false, undefined, this) : hasDenials && defaultTab === "recent" ? /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(jsx_dev_runtime7.Fragment, {
1327
+ children: "Enter approve \xB7 r retry \xB7 \u2191\u2193 navigate \xB7 \u2190/\u2192 switch \xB7 Esc cancel"
1328
+ }, undefined, false, undefined, this) : /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(jsx_dev_runtime7.Fragment, {
1329
+ children: "\u2191\u2193 navigate \xB7 Enter select \xB7 Type to search \xB7 \u2190/\u2192 switch \xB7 Esc cancel"
1330
+ }, undefined, false, undefined, this)
1331
+ }, undefined, false, undefined, this)
1332
+ }, undefined, false, undefined, this)
1333
+ ]
1334
+ }, undefined, true, undefined, this)
1335
+ }, undefined, false, undefined, this);
1336
+ }
1337
+ var import_react6, jsx_dev_runtime7;
1338
+ var init_PermissionRuleList = __esm(() => {
1339
+ init_source();
1340
+ init_figures();
1341
+ init_AppState();
1342
+ init_PermissionUpdate();
1343
+ init_select();
1344
+ init_useExitOnCtrlCDWithKeybindings();
1345
+ init_useSearchInput();
1346
+ init_src();
1347
+ init_useKeybinding();
1348
+ init_autoModeDenials();
1349
+ init_permissionRuleParser();
1350
+ init_permissions();
1351
+ init_slowOperations();
1352
+ init_src();
1353
+ init_SearchBox();
1354
+ init_AddPermissionRules();
1355
+ init_AddWorkspaceDirectory();
1356
+ init_PermissionRuleDescription();
1357
+ init_PermissionRuleInput();
1358
+ init_RecentDenialsTab();
1359
+ init_RemoveWorkspaceDirectory();
1360
+ init_WorkspaceTab();
1361
+ import_react6 = __toESM(require_react(), 1);
1362
+ jsx_dev_runtime7 = __toESM(require_jsx_dev_runtime(), 1);
1363
+ });
1364
+
1365
+ // src/commands/permissions/permissions.tsx
1366
+ var jsx_dev_runtime8, call = async (onDone, context) => {
1367
+ return /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(PermissionRuleList, {
1368
+ onExit: onDone,
1369
+ onRetryDenials: (commands) => {
1370
+ context.setMessages((prev) => [
1371
+ ...prev,
1372
+ createPermissionRetryMessage(commands)
1373
+ ]);
1374
+ }
1375
+ }, undefined, false, undefined, this);
1376
+ };
1377
+ var init_permissions2 = __esm(() => {
1378
+ init_PermissionRuleList();
1379
+ init_messages();
1380
+ jsx_dev_runtime8 = __toESM(require_jsx_dev_runtime(), 1);
1381
+ });
1382
+ init_permissions2();
1383
+
1384
+ export {
1385
+ call
1386
+ };