@caspian2026/agent-sdk 0.0.25 → 0.0.27

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 (362) hide show
  1. package/dist/gateway/index.js +98 -22
  2. package/dist/gateway/worker.js +1005 -982
  3. package/dist/sdk/query.cjs +2 -362
  4. package/dist/sdk/query.js +2 -367
  5. package/package.json +126 -128
  6. package/dist/chunk-04n4fe72.js +0 -107
  7. package/dist/chunk-04ys66ej.js +0 -344
  8. package/dist/chunk-07069jq1.js +0 -30
  9. package/dist/chunk-0731m51q.js +0 -8
  10. package/dist/chunk-086x4ct4.js +0 -26
  11. package/dist/chunk-0btqb97n.js +0 -295
  12. package/dist/chunk-0paqc2yw.js +0 -15
  13. package/dist/chunk-0r1rjydx.js +0 -145
  14. package/dist/chunk-0r5bb9j4.js +0 -477
  15. package/dist/chunk-0t81d427.js +0 -41
  16. package/dist/chunk-0teq2mz0.js +0 -420
  17. package/dist/chunk-0vkfrmqm.js +0 -690
  18. package/dist/chunk-0vp3wfab.js +0 -12
  19. package/dist/chunk-0warp8dx.js +0 -253
  20. package/dist/chunk-0xjaqda8.js +0 -1124
  21. package/dist/chunk-10gzv316.js +0 -62
  22. package/dist/chunk-11pq9n08.js +0 -168
  23. package/dist/chunk-1ae3nt9j.js +0 -31
  24. package/dist/chunk-1fmb0njn.js +0 -396
  25. package/dist/chunk-1gx78081.js +0 -66
  26. package/dist/chunk-1h2famwb.js +0 -49
  27. package/dist/chunk-1ng8xwxz.js +0 -276
  28. package/dist/chunk-1v7jp29h.js +0 -206
  29. package/dist/chunk-1xxy5zhb.js +0 -673
  30. package/dist/chunk-20b73w7w.js +0 -117
  31. package/dist/chunk-20qxd83a.js +0 -1161
  32. package/dist/chunk-2239ny9q.js +0 -90
  33. package/dist/chunk-22d4rnef.js +0 -226
  34. package/dist/chunk-26wtxbdc.js +0 -13870
  35. package/dist/chunk-27225bjh.js +0 -618
  36. package/dist/chunk-2b0e32an.js +0 -5822
  37. package/dist/chunk-2bfa9w1y.js +0 -323
  38. package/dist/chunk-2epq04w1.js +0 -63
  39. package/dist/chunk-2fwze72g.js +0 -24
  40. package/dist/chunk-2gzv8nrw.js +0 -205
  41. package/dist/chunk-2mexte1r.js +0 -349
  42. package/dist/chunk-2mzaqh5g.js +0 -338
  43. package/dist/chunk-2tb6mzfc.js +0 -81
  44. package/dist/chunk-2xq0g43w.js +0 -558
  45. package/dist/chunk-334aeqg9.js +0 -90
  46. package/dist/chunk-34jx4rjd.js +0 -995
  47. package/dist/chunk-35w5nhex.js +0 -132
  48. package/dist/chunk-3c25bcsw.js +0 -17
  49. package/dist/chunk-3eaxj8dg.js +0 -151
  50. package/dist/chunk-3fdgrwd2.js +0 -111
  51. package/dist/chunk-3jw0r58d.js +0 -121
  52. package/dist/chunk-3mgywd32.js +0 -8
  53. package/dist/chunk-3nk79af8.js +0 -8
  54. package/dist/chunk-3vy1jt9p.js +0 -1010
  55. package/dist/chunk-3x78pd4j.js +0 -153
  56. package/dist/chunk-47x3dsmn.js +0 -95
  57. package/dist/chunk-49pqt48n.js +0 -108
  58. package/dist/chunk-4f7m9fjw.js +0 -317
  59. package/dist/chunk-4jm600zv.js +0 -13
  60. package/dist/chunk-4k9d7gxv.js +0 -118
  61. package/dist/chunk-4net8san.js +0 -155
  62. package/dist/chunk-4pbx3g7s.js +0 -26
  63. package/dist/chunk-4v125j4z.js +0 -58
  64. package/dist/chunk-4vxkv5vz.js +0 -1438
  65. package/dist/chunk-51fqpjy3.js +0 -121
  66. package/dist/chunk-52e64f2h.js +0 -439
  67. package/dist/chunk-52e9mdjv.js +0 -684
  68. package/dist/chunk-55raexh7.js +0 -14358
  69. package/dist/chunk-59pq5122.js +0 -269
  70. package/dist/chunk-5bsj67v1.js +0 -349
  71. package/dist/chunk-5ccdsxgy.js +0 -74
  72. package/dist/chunk-5ekyhb1w.js +0 -422
  73. package/dist/chunk-5gcqdn8x.js +0 -867
  74. package/dist/chunk-5h5kx2jd.js +0 -34
  75. package/dist/chunk-5hf3werb.js +0 -193
  76. package/dist/chunk-5n1jc02d.js +0 -87
  77. package/dist/chunk-5wfxvxm8.js +0 -127
  78. package/dist/chunk-5wjebwmn.js +0 -89
  79. package/dist/chunk-5z28bqne.js +0 -6748
  80. package/dist/chunk-5zwsxpjn.js +0 -671
  81. package/dist/chunk-60phw466.js +0 -29
  82. package/dist/chunk-64c1avct.js +0 -13
  83. package/dist/chunk-64r16v22.js +0 -162
  84. package/dist/chunk-65t1r7zs.js +0 -418
  85. package/dist/chunk-66zry909.js +0 -11
  86. package/dist/chunk-67hxjjgc.js +0 -731
  87. package/dist/chunk-68ffk5qa.js +0 -14
  88. package/dist/chunk-69dr6rrd.js +0 -177
  89. package/dist/chunk-69n11zng.js +0 -436
  90. package/dist/chunk-6dj5t602.js +0 -341
  91. package/dist/chunk-6dngjwkh.js +0 -63
  92. package/dist/chunk-6dp8sz55.js +0 -3561
  93. package/dist/chunk-6hqgg0sv.js +0 -103
  94. package/dist/chunk-6nsd9606.js +0 -790
  95. package/dist/chunk-6p0hbwz3.js +0 -65
  96. package/dist/chunk-6ywdv5vg.js +0 -97
  97. package/dist/chunk-6zc758qw.js +0 -640
  98. package/dist/chunk-7aw745vx.js +0 -40175
  99. package/dist/chunk-7fxaphbq.js +0 -116
  100. package/dist/chunk-7sgtxrsc.js +0 -1059
  101. package/dist/chunk-7wm5s02e.js +0 -216
  102. package/dist/chunk-7xdk4109.js +0 -442
  103. package/dist/chunk-7xyswgjh.js +0 -8
  104. package/dist/chunk-83hfzbx3.js +0 -10
  105. package/dist/chunk-87m69h0v.js +0 -219
  106. package/dist/chunk-8g5pe1gr.js +0 -37
  107. package/dist/chunk-8jbw0fnf.js +0 -167
  108. package/dist/chunk-8jf9se66.js +0 -321
  109. package/dist/chunk-8p65embj.js +0 -875
  110. package/dist/chunk-8qrmaff1.js +0 -2669
  111. package/dist/chunk-8r975mwc.js +0 -93
  112. package/dist/chunk-8yhf030a.js +0 -69
  113. package/dist/chunk-93emz367.js +0 -107
  114. package/dist/chunk-948mn975.js +0 -460
  115. package/dist/chunk-99chkt7r.js +0 -54
  116. package/dist/chunk-9f7c1hzz.js +0 -50
  117. package/dist/chunk-9fk9ps1g.js +0 -178
  118. package/dist/chunk-9rh0k0aq.js +0 -90
  119. package/dist/chunk-9x5zgy22.js +0 -12
  120. package/dist/chunk-a0k2vj5b.js +0 -460
  121. package/dist/chunk-a0m57ssq.js +0 -325
  122. package/dist/chunk-a0nsmmz1.js +0 -133
  123. package/dist/chunk-a25jh1v4.js +0 -105
  124. package/dist/chunk-a4j5ekv0.js +0 -83
  125. package/dist/chunk-a8k3zf58.js +0 -313
  126. package/dist/chunk-ah0zarbq.js +0 -260
  127. package/dist/chunk-ase86y73.js +0 -15
  128. package/dist/chunk-b0kf00ff.js +0 -637
  129. package/dist/chunk-b1kcd3ss.js +0 -27
  130. package/dist/chunk-b8kcqqds.js +0 -93
  131. package/dist/chunk-bg4x9ex0.js +0 -21
  132. package/dist/chunk-bh5zqvyc.js +0 -36
  133. package/dist/chunk-bqrkfekw.js +0 -267
  134. package/dist/chunk-brjd9zmk.js +0 -42
  135. package/dist/chunk-byfawrfx.js +0 -121
  136. package/dist/chunk-c6sjhj89.js +0 -1284
  137. package/dist/chunk-c7e5yv0q.js +0 -212
  138. package/dist/chunk-c7jwbe76.js +0 -29030
  139. package/dist/chunk-cb5v8w7k.js +0 -289
  140. package/dist/chunk-cdef9v7b.js +0 -27
  141. package/dist/chunk-cdz5yb0r.js +0 -57
  142. package/dist/chunk-cgfdkzhb.js +0 -12
  143. package/dist/chunk-cgqw4x5z.js +0 -155
  144. package/dist/chunk-cnsj3vq2.js +0 -35
  145. package/dist/chunk-cqxm7ggc.js +0 -123
  146. package/dist/chunk-cxrktb5g.js +0 -51
  147. package/dist/chunk-d089t7dk.js +0 -312
  148. package/dist/chunk-d1z934cp.js +0 -71
  149. package/dist/chunk-d4mdda98.js +0 -94
  150. package/dist/chunk-d7xw8v91.js +0 -332
  151. package/dist/chunk-dc06c3rw.js +0 -1154
  152. package/dist/chunk-ddsjkqs4.js +0 -39
  153. package/dist/chunk-dfzkwynj.js +0 -5368
  154. package/dist/chunk-dnmp7s85.js +0 -20
  155. package/dist/chunk-dqqwjkv3.js +0 -8583
  156. package/dist/chunk-dt2mr4vf.js +0 -2962
  157. package/dist/chunk-dztm97gg.js +0 -150
  158. package/dist/chunk-e0abab5b.js +0 -445
  159. package/dist/chunk-e0ragz46.js +0 -209386
  160. package/dist/chunk-e9w9zc0g.js +0 -392
  161. package/dist/chunk-ebwskmsr.js +0 -107
  162. package/dist/chunk-efztk52j.js +0 -114
  163. package/dist/chunk-ehd8wacx.js +0 -40
  164. package/dist/chunk-ehtwnxpg.js +0 -1591
  165. package/dist/chunk-eqp1rfft.js +0 -17
  166. package/dist/chunk-etdt1xz3.js +0 -19
  167. package/dist/chunk-eva785x8.js +0 -88
  168. package/dist/chunk-ewadzrm8.js +0 -103
  169. package/dist/chunk-f2ajmcav.js +0 -92
  170. package/dist/chunk-fajg8x36.js +0 -8158
  171. package/dist/chunk-fbv4apne.js +0 -51
  172. package/dist/chunk-fcynwjpm.js +0 -1072
  173. package/dist/chunk-fev86f95.js +0 -1052
  174. package/dist/chunk-feyzykye.js +0 -10
  175. package/dist/chunk-ff85rwvc.js +0 -180
  176. package/dist/chunk-fk6ktvg2.js +0 -275
  177. package/dist/chunk-fqak69ft.js +0 -458
  178. package/dist/chunk-fqwas4jk.js +0 -281
  179. package/dist/chunk-fs35fdpj.js +0 -439
  180. package/dist/chunk-fvr3f9s3.js +0 -55
  181. package/dist/chunk-fyc5fepv.js +0 -10
  182. package/dist/chunk-g2g9cwt9.js +0 -54
  183. package/dist/chunk-g4znz46v.js +0 -2335
  184. package/dist/chunk-g5ts4e6k.js +0 -697
  185. package/dist/chunk-g6een9wr.js +0 -654
  186. package/dist/chunk-g7cmtx8r.js +0 -77
  187. package/dist/chunk-g9f19ttm.js +0 -15
  188. package/dist/chunk-gc7ap41t.js +0 -516
  189. package/dist/chunk-gdwdqewd.js +0 -19
  190. package/dist/chunk-gg14h3n4.js +0 -131
  191. package/dist/chunk-gg55fns0.js +0 -6440
  192. package/dist/chunk-gq7zab4e.js +0 -418
  193. package/dist/chunk-gydw3qy3.js +0 -169
  194. package/dist/chunk-gz1e8y1w.js +0 -33
  195. package/dist/chunk-h19r628d.js +0 -91
  196. package/dist/chunk-h2k8mt3z.js +0 -329
  197. package/dist/chunk-h9n54swm.js +0 -27
  198. package/dist/chunk-hakdhagh.js +0 -16606
  199. package/dist/chunk-hc2chp3g.js +0 -308
  200. package/dist/chunk-hemcv9t7.js +0 -153
  201. package/dist/chunk-hm62ntv3.js +0 -20
  202. package/dist/chunk-hmq09ytj.js +0 -100
  203. package/dist/chunk-hmv4hhqt.js +0 -2718
  204. package/dist/chunk-hwfknpxv.js +0 -39
  205. package/dist/chunk-j5bth84e.js +0 -97
  206. package/dist/chunk-j64ga6ta.js +0 -8035
  207. package/dist/chunk-j6v3w4yf.js +0 -244
  208. package/dist/chunk-jc29d2nm.js +0 -130
  209. package/dist/chunk-jd32zbps.js +0 -15
  210. package/dist/chunk-jd4sx4wh.js +0 -594
  211. package/dist/chunk-jha8n8b9.js +0 -33118
  212. package/dist/chunk-jj71qx7m.js +0 -122
  213. package/dist/chunk-jka9vpak.js +0 -114
  214. package/dist/chunk-jkf6ayv0.js +0 -32
  215. package/dist/chunk-jpz6t2tt.js +0 -61
  216. package/dist/chunk-jqt3sw12.js +0 -9114
  217. package/dist/chunk-jswd1q63.js +0 -101
  218. package/dist/chunk-jtc4aa2y.js +0 -1543
  219. package/dist/chunk-jyx3h86z.js +0 -635
  220. package/dist/chunk-jzthz1bx.js +0 -15
  221. package/dist/chunk-k0p9w03v.js +0 -4957
  222. package/dist/chunk-k6x3s7x5.js +0 -211
  223. package/dist/chunk-k7kmvnnx.js +0 -942
  224. package/dist/chunk-k8vp0atq.js +0 -2331
  225. package/dist/chunk-k9vm6x6z.js +0 -257
  226. package/dist/chunk-kb1edvhs.js +0 -120
  227. package/dist/chunk-kbhbe33q.js +0 -113
  228. package/dist/chunk-kgcgpp7z.js +0 -140
  229. package/dist/chunk-kvywbvqs.js +0 -261
  230. package/dist/chunk-kwekc97v.js +0 -18
  231. package/dist/chunk-kwyk9zp1.js +0 -74
  232. package/dist/chunk-ky1z78ve.js +0 -119
  233. package/dist/chunk-mcws22k3.js +0 -42
  234. package/dist/chunk-mr2z79r3.js +0 -1385
  235. package/dist/chunk-mst9nmns.js +0 -642
  236. package/dist/chunk-mswx2nma.js +0 -103
  237. package/dist/chunk-n1e3fjpz.js +0 -266
  238. package/dist/chunk-n6vjp9yg.js +0 -138
  239. package/dist/chunk-n84tqtvv.js +0 -120
  240. package/dist/chunk-n8ssddbw.js +0 -105
  241. package/dist/chunk-na35whkd.js +0 -227
  242. package/dist/chunk-netzwgv1.js +0 -154
  243. package/dist/chunk-ng7j0yy1.js +0 -100
  244. package/dist/chunk-nmgj86tt.js +0 -24
  245. package/dist/chunk-ns7x6xam.js +0 -22820
  246. package/dist/chunk-p7vkh4wx.js +0 -15
  247. package/dist/chunk-p8na2wwp.js +0 -14
  248. package/dist/chunk-pe3rkfp2.js +0 -74
  249. package/dist/chunk-pf0152j3.js +0 -40
  250. package/dist/chunk-pgtnj1mt.js +0 -705
  251. package/dist/chunk-ppwjyveh.js +0 -8
  252. package/dist/chunk-pq5qp2y4.js +0 -388
  253. package/dist/chunk-pqqxdk5f.js +0 -543
  254. package/dist/chunk-ps49ymvj.js +0 -43
  255. package/dist/chunk-pws8gq7m.js +0 -7422
  256. package/dist/chunk-pwwa7s62.js +0 -11
  257. package/dist/chunk-pyq0fabn.js +0 -860
  258. package/dist/chunk-q0p1m40t.js +0 -79
  259. package/dist/chunk-q0vhv550.js +0 -393
  260. package/dist/chunk-q7r0kt08.js +0 -1809
  261. package/dist/chunk-qajrkk97.js +0 -298
  262. package/dist/chunk-qatfdxvd.js +0 -34
  263. package/dist/chunk-qb6k2afy.js +0 -153
  264. package/dist/chunk-qg2qgx8h.js +0 -266
  265. package/dist/chunk-qkczt8cr.js +0 -24
  266. package/dist/chunk-qnfx3qtx.js +0 -617
  267. package/dist/chunk-qp2qdcda.js +0 -100
  268. package/dist/chunk-qtwgzej9.js +0 -85
  269. package/dist/chunk-r1dh0ymt.js +0 -91
  270. package/dist/chunk-r36xvgvv.js +0 -407
  271. package/dist/chunk-r48he8g3.js +0 -251
  272. package/dist/chunk-r63tqmtk.js +0 -146
  273. package/dist/chunk-rbdd3q5k.js +0 -101
  274. package/dist/chunk-rmbbmd3s.js +0 -68
  275. package/dist/chunk-rn0v1hk8.js +0 -34
  276. package/dist/chunk-rnxctq9p.js +0 -1646
  277. package/dist/chunk-rrs2mchs.js +0 -183
  278. package/dist/chunk-rtrybvnp.js +0 -209
  279. package/dist/chunk-rw2wkn45.js +0 -494
  280. package/dist/chunk-s4kzkdhd.js +0 -847
  281. package/dist/chunk-s7a0zn7b.js +0 -55
  282. package/dist/chunk-s8gy4ky9.js +0 -122
  283. package/dist/chunk-s8kj6ajy.js +0 -32
  284. package/dist/chunk-sag785ad.js +0 -283
  285. package/dist/chunk-scqjyben.js +0 -174
  286. package/dist/chunk-sd36yzx8.js +0 -954
  287. package/dist/chunk-sdtqm0nm.js +0 -374
  288. package/dist/chunk-sg60xg0x.js +0 -52
  289. package/dist/chunk-sgpmpn90.js +0 -35
  290. package/dist/chunk-sh02d2qn.js +0 -38
  291. package/dist/chunk-sz9y6z13.js +0 -61
  292. package/dist/chunk-szj5wvdy.js +0 -28
  293. package/dist/chunk-t29a6zb5.js +0 -45
  294. package/dist/chunk-t2b49hcf.js +0 -87
  295. package/dist/chunk-t2wqdppz.js +0 -445
  296. package/dist/chunk-t4khqff1.js +0 -16
  297. package/dist/chunk-t70t2gne.js +0 -121
  298. package/dist/chunk-t9p85zff.js +0 -24
  299. package/dist/chunk-tkrstmwz.js +0 -94
  300. package/dist/chunk-tnyb4exc.js +0 -74
  301. package/dist/chunk-tpn8jsvw.js +0 -71
  302. package/dist/chunk-tt7x5j1q.js +0 -111
  303. package/dist/chunk-tw1p628z.js +0 -984
  304. package/dist/chunk-twvdafcz.js +0 -528
  305. package/dist/chunk-tzwjafgn.js +0 -24
  306. package/dist/chunk-v140t8ay.js +0 -152
  307. package/dist/chunk-v1kzp02e.js +0 -785
  308. package/dist/chunk-v4t6dyyh.js +0 -9076
  309. package/dist/chunk-v78fj8by.js +0 -145
  310. package/dist/chunk-v8kjswxt.js +0 -61
  311. package/dist/chunk-v9smspw2.js +0 -4301
  312. package/dist/chunk-vcfbjkk9.js +0 -201
  313. package/dist/chunk-ve167rcs.js +0 -148
  314. package/dist/chunk-vf612n57.js +0 -472
  315. package/dist/chunk-vhffyae8.js +0 -895
  316. package/dist/chunk-vkhrrvfq.js +0 -44
  317. package/dist/chunk-vybkmfhf.js +0 -91
  318. package/dist/chunk-vyjeh50y.js +0 -2149
  319. package/dist/chunk-w6m6trzq.js +0 -58
  320. package/dist/chunk-w9b6kngq.js +0 -234
  321. package/dist/chunk-wa8yn2p0.js +0 -2007
  322. package/dist/chunk-wanceff6.js +0 -2840
  323. package/dist/chunk-wcze2nea.js +0 -336
  324. package/dist/chunk-wgk9sxk7.js +0 -329
  325. package/dist/chunk-wnxcgfsd.js +0 -253
  326. package/dist/chunk-wyjerrr6.js +0 -565
  327. package/dist/chunk-wz9brkq5.js +0 -60
  328. package/dist/chunk-x47h283a.js +0 -56
  329. package/dist/chunk-x59j3x9c.js +0 -98
  330. package/dist/chunk-x6r4v44b.js +0 -8
  331. package/dist/chunk-x7fdwq3d.js +0 -33
  332. package/dist/chunk-x8d2ehd7.js +0 -19
  333. package/dist/chunk-xeb6075z.js +0 -3435
  334. package/dist/chunk-xfw2pxwd.js +0 -223
  335. package/dist/chunk-xh06jc72.js +0 -200
  336. package/dist/chunk-xhfmdq1y.js +0 -147
  337. package/dist/chunk-xkwyg1d2.js +0 -195
  338. package/dist/chunk-xv3era3s.js +0 -8
  339. package/dist/chunk-xyapc58m.js +0 -87
  340. package/dist/chunk-xzgnc76g.js +0 -107
  341. package/dist/chunk-y1784krc.js +0 -19
  342. package/dist/chunk-y4ca9kqz.js +0 -3830
  343. package/dist/chunk-y9bhjjdz.js +0 -145
  344. package/dist/chunk-yb3bxv3w.js +0 -30
  345. package/dist/chunk-yddek6xk.js +0 -146
  346. package/dist/chunk-ypaq3d12.js +0 -4265
  347. package/dist/chunk-yq8z040g.js +0 -111
  348. package/dist/chunk-yqs481qq.js +0 -1163
  349. package/dist/chunk-ys9a9c9h.js +0 -105
  350. package/dist/chunk-yyex5gsf.js +0 -269
  351. package/dist/chunk-yzn396hn.js +0 -89
  352. package/dist/chunk-z2dp53wn.js +0 -17
  353. package/dist/chunk-zay4xp4n.js +0 -251
  354. package/dist/chunk-zc8bwy57.js +0 -212
  355. package/dist/chunk-zhx88cfx.js +0 -97
  356. package/dist/chunk-zkh6f4ct.js +0 -385
  357. package/dist/chunk-zq56gcca.js +0 -206
  358. package/dist/chunk-zrkefd22.js +0 -490
  359. package/dist/chunk-zs5p0yq1.js +0 -1030
  360. package/dist/chunk-zxh62ved.js +0 -31
  361. package/dist/chunk-zzm33q8x.js +0 -8
  362. package/dist/cli.js +0 -220
@@ -1,1385 +0,0 @@
1
- // @bun
2
- import {
3
- getAutoModeDenials,
4
- init_autoModeDenials
5
- } from "./chunk-0paqc2yw.js";
6
- import {
7
- detectUnreachableRules,
8
- init_shadowedRuleDetection
9
- } from "./chunk-47x3dsmn.js";
10
- import {
11
- init_SearchBox
12
- } from "./chunk-p8na2wwp.js";
13
- import {
14
- init_useSearchInput,
15
- useSearchInput
16
- } from "./chunk-hc2chp3g.js";
17
- import {
18
- AddWorkspaceDirectory,
19
- init_AddWorkspaceDirectory
20
- } from "./chunk-0btqb97n.js";
21
- import"./chunk-cgqw4x5z.js";
22
- import"./chunk-3eaxj8dg.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-e0ragz46.js";
50
- import"./chunk-mcws22k3.js";
51
- import"./chunk-jzthz1bx.js";
52
- import"./chunk-jpz6t2tt.js";
53
- import"./chunk-hwfknpxv.js";
54
- import"./chunk-1gx78081.js";
55
- import"./chunk-ehtwnxpg.js";
56
- import"./chunk-q0p1m40t.js";
57
- import"./chunk-52e9mdjv.js";
58
- import"./chunk-x47h283a.js";
59
- import"./chunk-34jx4rjd.js";
60
- import"./chunk-2gzv8nrw.js";
61
- import"./chunk-e0abab5b.js";
62
- import"./chunk-cgfdkzhb.js";
63
- import {
64
- init_useExitOnCtrlCDWithKeybindings,
65
- useExitOnCtrlCDWithKeybindings
66
- } from "./chunk-4k9d7gxv.js";
67
- import"./chunk-j5bth84e.js";
68
- import"./chunk-67hxjjgc.js";
69
- import {
70
- init_useKeybinding
71
- } from "./chunk-68ffk5qa.js";
72
- import"./chunk-ps49ymvj.js";
73
- import"./chunk-gc7ap41t.js";
74
- import"./chunk-jtc4aa2y.js";
75
- import"./chunk-pgtnj1mt.js";
76
- import"./chunk-6p0hbwz3.js";
77
- import"./chunk-p7vkh4wx.js";
78
- import"./chunk-y9bhjjdz.js";
79
- import"./chunk-v140t8ay.js";
80
- import"./chunk-99chkt7r.js";
81
- import"./chunk-dfzkwynj.js";
82
- import"./chunk-xeb6075z.js";
83
- import"./chunk-fcynwjpm.js";
84
- import"./chunk-v4t6dyyh.js";
85
- import"./chunk-h2k8mt3z.js";
86
- import"./chunk-v8kjswxt.js";
87
- import {
88
- SOURCES,
89
- getRelativeSettingsFilePathForSource,
90
- init_constants,
91
- init_permissionRuleParser,
92
- init_settings1 as init_settings,
93
- init_stringUtils,
94
- permissionRuleValueFromString,
95
- permissionRuleValueToString,
96
- plural
97
- } from "./chunk-2b0e32an.js";
98
- import"./chunk-rnxctq9p.js";
99
- import"./chunk-pqqxdk5f.js";
100
- import"./chunk-6nsd9606.js";
101
- import"./chunk-64c1avct.js";
102
- import"./chunk-8g5pe1gr.js";
103
- import"./chunk-4pbx3g7s.js";
104
- import"./chunk-26wtxbdc.js";
105
- import"./chunk-6dngjwkh.js";
106
- import"./chunk-4jm600zv.js";
107
- import"./chunk-s8gy4ky9.js";
108
- import"./chunk-cxrktb5g.js";
109
- import"./chunk-3c25bcsw.js";
110
- import"./chunk-5ekyhb1w.js";
111
- import"./chunk-fqak69ft.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-byfawrfx.js";
141
- import"./chunk-3vy1jt9p.js";
142
- import"./chunk-vkhrrvfq.js";
143
- import"./chunk-qnfx3qtx.js";
144
- import"./chunk-64r16v22.js";
145
- import"./chunk-s8kj6ajy.js";
146
- import"./chunk-8yhf030a.js";
147
- import"./chunk-zxh62ved.js";
148
- import"./chunk-5z28bqne.js";
149
- import {
150
- figures_default,
151
- init_figures
152
- } from "./chunk-qajrkk97.js";
153
- import {
154
- init_slowOperations,
155
- jsonStringify
156
- } from "./chunk-gg55fns0.js";
157
- import"./chunk-5n1jc02d.js";
158
- import"./chunk-fbv4apne.js";
159
- import {
160
- getOriginalCwd,
161
- init_state
162
- } from "./chunk-k8vp0atq.js";
163
- import"./chunk-vf612n57.js";
164
- import"./chunk-07069jq1.js";
165
- import"./chunk-d4mdda98.js";
166
- import"./chunk-55raexh7.js";
167
- import"./chunk-v9smspw2.js";
168
- import"./chunk-v1kzp02e.js";
169
- import"./chunk-7wm5s02e.js";
170
- import"./chunk-b0kf00ff.js";
171
- import"./chunk-netzwgv1.js";
172
- import {
173
- __esm,
174
- __toESM
175
- } from "./chunk-qp2qdcda.js";
176
-
177
- // src/components/permissions/rules/PermissionRuleDescription.tsx
178
- function PermissionRuleDescription({
179
- ruleValue
180
- }) {
181
- switch (ruleValue.toolName) {
182
- case BashTool.name: {
183
- if (ruleValue.ruleContent) {
184
- if (ruleValue.ruleContent.endsWith(":*")) {
185
- return /* @__PURE__ */ jsx_dev_runtime.jsxDEV(ThemedText, {
186
- dimColor: true,
187
- children: [
188
- "Any Bash command starting with",
189
- " ",
190
- /* @__PURE__ */ jsx_dev_runtime.jsxDEV(ThemedText, {
191
- bold: true,
192
- children: ruleValue.ruleContent.slice(0, -2)
193
- }, undefined, false, undefined, this)
194
- ]
195
- }, undefined, true, undefined, this);
196
- } else {
197
- return /* @__PURE__ */ jsx_dev_runtime.jsxDEV(ThemedText, {
198
- dimColor: true,
199
- children: [
200
- "The Bash command ",
201
- /* @__PURE__ */ jsx_dev_runtime.jsxDEV(ThemedText, {
202
- bold: true,
203
- children: ruleValue.ruleContent
204
- }, undefined, false, undefined, this)
205
- ]
206
- }, undefined, true, undefined, this);
207
- }
208
- } else {
209
- return /* @__PURE__ */ jsx_dev_runtime.jsxDEV(ThemedText, {
210
- dimColor: true,
211
- children: "Any Bash command"
212
- }, undefined, false, undefined, this);
213
- }
214
- }
215
- default: {
216
- if (!ruleValue.ruleContent) {
217
- return /* @__PURE__ */ jsx_dev_runtime.jsxDEV(ThemedText, {
218
- dimColor: true,
219
- children: [
220
- "Any use of the ",
221
- /* @__PURE__ */ jsx_dev_runtime.jsxDEV(ThemedText, {
222
- bold: true,
223
- children: ruleValue.toolName
224
- }, undefined, false, undefined, this),
225
- " tool"
226
- ]
227
- }, undefined, true, undefined, this);
228
- } else {
229
- return null;
230
- }
231
- }
232
- }
233
- }
234
- var jsx_dev_runtime;
235
- var init_PermissionRuleDescription = __esm(() => {
236
- init_src();
237
- init_BashTool();
238
- jsx_dev_runtime = __toESM(require_jsx_dev_runtime(), 1);
239
- });
240
-
241
- // src/components/permissions/rules/AddPermissionRules.tsx
242
- function optionForPermissionSaveDestination(saveDestination) {
243
- switch (saveDestination) {
244
- case "localSettings":
245
- return {
246
- label: "Project settings (local)",
247
- description: `Saved in ${getRelativeSettingsFilePathForSource("localSettings")}`,
248
- value: saveDestination
249
- };
250
- case "projectSettings":
251
- return {
252
- label: "Project settings",
253
- description: `Checked in at ${getRelativeSettingsFilePathForSource("projectSettings")}`,
254
- value: saveDestination
255
- };
256
- case "userSettings":
257
- return {
258
- label: "User settings",
259
- description: `Saved in at ~/.claude/settings.json`,
260
- value: saveDestination
261
- };
262
- }
263
- }
264
- function AddPermissionRules({
265
- onAddRules,
266
- onCancel,
267
- ruleValues,
268
- ruleBehavior,
269
- initialContext,
270
- setToolPermissionContext
271
- }) {
272
- const allOptions = SOURCES.map(optionForPermissionSaveDestination);
273
- const onSelect = import_react.useCallback((selectedValue) => {
274
- if (selectedValue === "cancel") {
275
- onCancel();
276
- return;
277
- } else if (SOURCES.includes(selectedValue)) {
278
- const destination = selectedValue;
279
- const updatedContext = applyPermissionUpdate(initialContext, {
280
- type: "addRules",
281
- rules: ruleValues,
282
- behavior: ruleBehavior,
283
- destination
284
- });
285
- persistPermissionUpdate({
286
- type: "addRules",
287
- rules: ruleValues,
288
- behavior: ruleBehavior,
289
- destination
290
- });
291
- setToolPermissionContext(updatedContext);
292
- const rules = ruleValues.map((ruleValue) => ({
293
- ruleValue,
294
- ruleBehavior,
295
- source: destination
296
- }));
297
- const sandboxAutoAllowEnabled = SandboxManager.isSandboxingEnabled() && SandboxManager.isAutoAllowBashIfSandboxedEnabled();
298
- const allUnreachable = detectUnreachableRules(updatedContext, {
299
- sandboxAutoAllowEnabled
300
- });
301
- const newUnreachable = allUnreachable.filter((u) => ruleValues.some((rv) => rv.toolName === u.rule.ruleValue.toolName && rv.ruleContent === u.rule.ruleValue.ruleContent));
302
- onAddRules(rules, newUnreachable.length > 0 ? newUnreachable : undefined);
303
- }
304
- }, [
305
- onAddRules,
306
- onCancel,
307
- ruleValues,
308
- ruleBehavior,
309
- initialContext,
310
- setToolPermissionContext
311
- ]);
312
- const title = `Add ${ruleBehavior} permission ${plural(ruleValues.length, "rule")}`;
313
- return /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Dialog, {
314
- title,
315
- onCancel,
316
- color: "permission",
317
- children: [
318
- /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(ThemedBox_default, {
319
- flexDirection: "column",
320
- paddingX: 2,
321
- children: ruleValues.map((ruleValue) => /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(ThemedBox_default, {
322
- flexDirection: "column",
323
- children: [
324
- /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(ThemedText, {
325
- bold: true,
326
- children: permissionRuleValueToString(ruleValue)
327
- }, undefined, false, undefined, this),
328
- /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(PermissionRuleDescription, {
329
- ruleValue
330
- }, undefined, false, undefined, this)
331
- ]
332
- }, permissionRuleValueToString(ruleValue), true, undefined, this))
333
- }, undefined, false, undefined, this),
334
- /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(ThemedBox_default, {
335
- flexDirection: "column",
336
- marginY: 1,
337
- children: [
338
- /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(ThemedText, {
339
- children: ruleValues.length === 1 ? "Where should this rule be saved?" : "Where should these rules be saved?"
340
- }, undefined, false, undefined, this),
341
- /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Select, {
342
- options: allOptions,
343
- onChange: onSelect
344
- }, undefined, false, undefined, this)
345
- ]
346
- }, undefined, true, undefined, this)
347
- ]
348
- }, undefined, true, undefined, this);
349
- }
350
- var import_react, jsx_dev_runtime2;
351
- var init_AddPermissionRules = __esm(() => {
352
- init_select();
353
- init_src();
354
- init_PermissionUpdate();
355
- init_permissionRuleParser();
356
- init_shadowedRuleDetection();
357
- init_sandbox_adapter();
358
- init_constants();
359
- init_settings();
360
- init_stringUtils();
361
- init_PermissionRuleDescription();
362
- import_react = __toESM(require_react(), 1);
363
- jsx_dev_runtime2 = __toESM(require_jsx_dev_runtime(), 1);
364
- });
365
-
366
- // src/components/permissions/rules/PermissionRuleInput.tsx
367
- function PermissionRuleInput({
368
- onCancel,
369
- onSubmit,
370
- ruleBehavior
371
- }) {
372
- const [inputValue, setInputValue] = import_react2.useState("");
373
- const [cursorOffset, setCursorOffset] = import_react2.useState(0);
374
- const exitState = useExitOnCtrlCDWithKeybindings();
375
- useKeybinding("confirm:no", onCancel, { context: "Settings" });
376
- const { columns } = useTerminalSize();
377
- const textInputColumns = columns - 6;
378
- const handleSubmit = (value) => {
379
- const trimmedValue = value.trim();
380
- if (trimmedValue.length === 0) {
381
- return;
382
- }
383
- const ruleValue = permissionRuleValueFromString(trimmedValue);
384
- onSubmit(ruleValue, ruleBehavior);
385
- };
386
- return /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(jsx_dev_runtime3.Fragment, {
387
- children: [
388
- /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedBox_default, {
389
- flexDirection: "column",
390
- gap: 1,
391
- borderStyle: "round",
392
- paddingLeft: 1,
393
- paddingRight: 1,
394
- borderColor: "permission",
395
- children: [
396
- /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedText, {
397
- bold: true,
398
- color: "permission",
399
- children: [
400
- "Add ",
401
- ruleBehavior,
402
- " permission rule"
403
- ]
404
- }, undefined, true, undefined, this),
405
- /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedBox_default, {
406
- flexDirection: "column",
407
- children: [
408
- /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedText, {
409
- children: [
410
- "Permission rules are a tool name, optionally followed by a specifier in parentheses.",
411
- /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Newline, {}, undefined, false, undefined, this),
412
- "e.g.,",
413
- " ",
414
- /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedText, {
415
- bold: true,
416
- children: permissionRuleValueToString({ toolName: WebFetchTool.name })
417
- }, undefined, false, undefined, this),
418
- /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedText, {
419
- bold: false,
420
- children: " or "
421
- }, undefined, false, undefined, this),
422
- /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedText, {
423
- bold: true,
424
- children: permissionRuleValueToString({
425
- toolName: BashTool.name,
426
- ruleContent: "ls:*"
427
- })
428
- }, undefined, false, undefined, this)
429
- ]
430
- }, undefined, true, undefined, this),
431
- /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedBox_default, {
432
- borderDimColor: true,
433
- borderStyle: "round",
434
- marginY: 1,
435
- paddingLeft: 1,
436
- children: /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(TextInput, {
437
- showCursor: true,
438
- value: inputValue,
439
- onChange: setInputValue,
440
- onSubmit: handleSubmit,
441
- placeholder: `Enter permission rule${figures_default.ellipsis}`,
442
- columns: textInputColumns,
443
- cursorOffset,
444
- onChangeCursorOffset: setCursorOffset
445
- }, undefined, false, undefined, this)
446
- }, undefined, false, undefined, this)
447
- ]
448
- }, undefined, true, undefined, this)
449
- ]
450
- }, undefined, true, undefined, this),
451
- /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedBox_default, {
452
- marginLeft: 3,
453
- children: exitState.pending ? /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedText, {
454
- dimColor: true,
455
- children: [
456
- "Press ",
457
- exitState.keyName,
458
- " again to exit"
459
- ]
460
- }, undefined, true, undefined, this) : /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedText, {
461
- dimColor: true,
462
- children: "Enter to submit \xB7 Esc to cancel"
463
- }, undefined, false, undefined, this)
464
- }, undefined, false, undefined, this)
465
- ]
466
- }, undefined, true, undefined, this);
467
- }
468
- var import_react2, jsx_dev_runtime3;
469
- var init_PermissionRuleInput = __esm(() => {
470
- init_figures();
471
- init_TextInput();
472
- init_useExitOnCtrlCDWithKeybindings();
473
- init_useTerminalSize();
474
- init_src();
475
- init_useKeybinding();
476
- init_BashTool();
477
- init_WebFetchTool();
478
- init_permissionRuleParser();
479
- import_react2 = __toESM(require_react(), 1);
480
- jsx_dev_runtime3 = __toESM(require_jsx_dev_runtime(), 1);
481
- });
482
-
483
- // src/components/permissions/rules/RecentDenialsTab.tsx
484
- function RecentDenialsTab({
485
- onHeaderFocusChange,
486
- onStateChange
487
- }) {
488
- const { headerFocused, focusHeader } = useTabHeaderFocus();
489
- import_react3.useEffect(() => {
490
- onHeaderFocusChange?.(headerFocused);
491
- }, [headerFocused, onHeaderFocusChange]);
492
- const [denials] = import_react3.useState(() => getAutoModeDenials());
493
- const [approved, setApproved] = import_react3.useState(() => new Set);
494
- const [retry, setRetry] = import_react3.useState(() => new Set);
495
- const [focusedIdx, setFocusedIdx] = import_react3.useState(0);
496
- import_react3.useEffect(() => {
497
- onStateChange({ approved, retry, denials });
498
- }, [approved, retry, denials, onStateChange]);
499
- const handleSelect = import_react3.useCallback((value) => {
500
- const idx = Number(value);
501
- setApproved((prev) => {
502
- const next = new Set(prev);
503
- if (next.has(idx))
504
- next.delete(idx);
505
- else
506
- next.add(idx);
507
- return next;
508
- });
509
- }, []);
510
- const handleFocus = import_react3.useCallback((value) => {
511
- setFocusedIdx(Number(value));
512
- }, []);
513
- use_input_default((input, _key) => {
514
- if (input === "r") {
515
- setRetry((prev) => {
516
- const next = new Set(prev);
517
- if (next.has(focusedIdx))
518
- next.delete(focusedIdx);
519
- else
520
- next.add(focusedIdx);
521
- return next;
522
- });
523
- setApproved((prev) => {
524
- if (prev.has(focusedIdx))
525
- return prev;
526
- const next = new Set(prev);
527
- next.add(focusedIdx);
528
- return next;
529
- });
530
- }
531
- }, { isActive: denials.length > 0 });
532
- if (denials.length === 0) {
533
- return /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(ThemedText, {
534
- dimColor: true,
535
- children: "No recent denials. Commands denied by the auto mode classifier will appear here."
536
- }, undefined, false, undefined, this);
537
- }
538
- const options = denials.map((d, idx) => {
539
- const isApproved = approved.has(idx);
540
- const suffix = retry.has(idx) ? " (retry)" : "";
541
- return {
542
- label: /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(ThemedText, {
543
- children: [
544
- /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(StatusIcon, {
545
- status: isApproved ? "success" : "error",
546
- withSpace: true
547
- }, undefined, false, undefined, this),
548
- d.display,
549
- /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(ThemedText, {
550
- dimColor: true,
551
- children: suffix
552
- }, undefined, false, undefined, this)
553
- ]
554
- }, undefined, true, undefined, this),
555
- value: String(idx)
556
- };
557
- });
558
- return /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(ThemedBox_default, {
559
- flexDirection: "column",
560
- children: [
561
- /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(ThemedText, {
562
- children: "Commands recently denied by the auto mode classifier."
563
- }, undefined, false, undefined, this),
564
- /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(ThemedBox_default, {
565
- marginTop: 1,
566
- children: /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Select, {
567
- options,
568
- onChange: handleSelect,
569
- onFocus: handleFocus,
570
- visibleOptionCount: Math.min(10, options.length),
571
- isDisabled: headerFocused,
572
- onUpFromFirstItem: focusHeader
573
- }, undefined, false, undefined, this)
574
- }, undefined, false, undefined, this)
575
- ]
576
- }, undefined, true, undefined, this);
577
- }
578
- var import_react3, jsx_dev_runtime4;
579
- var init_RecentDenialsTab = __esm(() => {
580
- init_src();
581
- init_autoModeDenials();
582
- init_select();
583
- init_src();
584
- import_react3 = __toESM(require_react(), 1);
585
- jsx_dev_runtime4 = __toESM(require_jsx_dev_runtime(), 1);
586
- });
587
-
588
- // src/components/permissions/rules/RemoveWorkspaceDirectory.tsx
589
- function RemoveWorkspaceDirectory({
590
- directoryPath,
591
- onRemove,
592
- onCancel,
593
- permissionContext,
594
- setPermissionContext
595
- }) {
596
- const handleRemove = import_react4.useCallback(() => {
597
- const updatedContext = applyPermissionUpdate(permissionContext, {
598
- type: "removeDirectories",
599
- directories: [directoryPath],
600
- destination: "session"
601
- });
602
- setPermissionContext(updatedContext);
603
- onRemove();
604
- }, [directoryPath, permissionContext, setPermissionContext, onRemove]);
605
- const handleSelect = import_react4.useCallback((value) => {
606
- if (value === "yes") {
607
- handleRemove();
608
- } else {
609
- onCancel();
610
- }
611
- }, [handleRemove, onCancel]);
612
- return /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Dialog, {
613
- title: "Remove directory from workspace?",
614
- onCancel,
615
- color: "error",
616
- children: [
617
- /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(ThemedBox_default, {
618
- marginX: 2,
619
- flexDirection: "column",
620
- children: /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(ThemedText, {
621
- bold: true,
622
- children: directoryPath
623
- }, undefined, false, undefined, this)
624
- }, undefined, false, undefined, this),
625
- /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(ThemedText, {
626
- children: "Claude Code will no longer have access to files in this directory."
627
- }, undefined, false, undefined, this),
628
- /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Select, {
629
- onChange: handleSelect,
630
- onCancel,
631
- options: [
632
- { label: "Yes", value: "yes" },
633
- { label: "No", value: "no" }
634
- ]
635
- }, undefined, false, undefined, this)
636
- ]
637
- }, undefined, true, undefined, this);
638
- }
639
- var import_react4, jsx_dev_runtime5;
640
- var init_RemoveWorkspaceDirectory = __esm(() => {
641
- init_select();
642
- init_src();
643
- init_PermissionUpdate();
644
- init_src();
645
- import_react4 = __toESM(require_react(), 1);
646
- jsx_dev_runtime5 = __toESM(require_jsx_dev_runtime(), 1);
647
- });
648
-
649
- // src/components/permissions/rules/WorkspaceTab.tsx
650
- function WorkspaceTab({
651
- onExit,
652
- toolPermissionContext,
653
- onRequestAddDirectory,
654
- onRequestRemoveDirectory,
655
- onHeaderFocusChange
656
- }) {
657
- const { headerFocused, focusHeader } = useTabHeaderFocus();
658
- import_react5.useEffect(() => {
659
- onHeaderFocusChange?.(headerFocused);
660
- }, [headerFocused, onHeaderFocusChange]);
661
- const additionalDirectories = React.useMemo(() => {
662
- return Array.from(toolPermissionContext.additionalWorkingDirectories.keys()).map((path) => ({
663
- path,
664
- isCurrent: false,
665
- isDeletable: true
666
- }));
667
- }, [toolPermissionContext.additionalWorkingDirectories]);
668
- const handleDirectorySelect = import_react5.useCallback((selectedValue) => {
669
- if (selectedValue === "add-directory") {
670
- onRequestAddDirectory();
671
- return;
672
- }
673
- const directory = additionalDirectories.find((d) => d.path === selectedValue);
674
- if (directory && directory.isDeletable) {
675
- onRequestRemoveDirectory(directory.path);
676
- }
677
- }, [additionalDirectories, onRequestAddDirectory, onRequestRemoveDirectory]);
678
- const handleCancel = import_react5.useCallback(() => onExit("Workspace dialog dismissed", { display: "system" }), [onExit]);
679
- const options = React.useMemo(() => {
680
- const opts = additionalDirectories.map((dir) => ({
681
- label: dir.path,
682
- value: dir.path
683
- }));
684
- opts.push({
685
- label: `Add directory${figures_default.ellipsis}`,
686
- value: "add-directory"
687
- });
688
- return opts;
689
- }, [additionalDirectories]);
690
- return /* @__PURE__ */ jsx_dev_runtime6.jsxDEV(ThemedBox_default, {
691
- flexDirection: "column",
692
- marginBottom: 1,
693
- children: [
694
- /* @__PURE__ */ jsx_dev_runtime6.jsxDEV(ThemedBox_default, {
695
- flexDirection: "row",
696
- marginTop: 1,
697
- marginLeft: 2,
698
- gap: 1,
699
- children: [
700
- /* @__PURE__ */ jsx_dev_runtime6.jsxDEV(ThemedText, {
701
- children: `- ${getOriginalCwd()}`
702
- }, undefined, false, undefined, this),
703
- /* @__PURE__ */ jsx_dev_runtime6.jsxDEV(ThemedText, {
704
- dimColor: true,
705
- children: "(Original working directory)"
706
- }, undefined, false, undefined, this)
707
- ]
708
- }, undefined, true, undefined, this),
709
- /* @__PURE__ */ jsx_dev_runtime6.jsxDEV(Select, {
710
- options,
711
- onChange: handleDirectorySelect,
712
- onCancel: handleCancel,
713
- visibleOptionCount: Math.min(10, options.length),
714
- onUpFromFirstItem: focusHeader,
715
- isDisabled: headerFocused
716
- }, undefined, false, undefined, this)
717
- ]
718
- }, undefined, true, undefined, this);
719
- }
720
- var React, import_react5, jsx_dev_runtime6;
721
- var init_WorkspaceTab = __esm(() => {
722
- init_figures();
723
- init_state();
724
- init_select();
725
- init_src();
726
- React = __toESM(require_react(), 1);
727
- import_react5 = __toESM(require_react(), 1);
728
- jsx_dev_runtime6 = __toESM(require_jsx_dev_runtime(), 1);
729
- });
730
-
731
- // src/components/permissions/rules/PermissionRuleList.tsx
732
- function RuleSourceText({ rule }) {
733
- return /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedText, {
734
- dimColor: true,
735
- children: `From ${permissionRuleSourceDisplayString(rule.source)}`
736
- }, undefined, false, undefined, this);
737
- }
738
- function getRuleBehaviorLabel(ruleBehavior) {
739
- switch (ruleBehavior) {
740
- case "allow":
741
- return "allowed";
742
- case "deny":
743
- return "denied";
744
- case "ask":
745
- return "ask";
746
- }
747
- }
748
- function RuleDetails({
749
- rule,
750
- onDelete,
751
- onCancel
752
- }) {
753
- const exitState = useExitOnCtrlCDWithKeybindings();
754
- useKeybinding("confirm:no", onCancel, { context: "Confirmation" });
755
- const ruleDescription = /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedBox_default, {
756
- flexDirection: "column",
757
- marginX: 2,
758
- children: [
759
- /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedText, {
760
- bold: true,
761
- children: permissionRuleValueToString(rule.ruleValue)
762
- }, undefined, false, undefined, this),
763
- /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(PermissionRuleDescription, {
764
- ruleValue: rule.ruleValue
765
- }, undefined, false, undefined, this),
766
- /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(RuleSourceText, {
767
- rule
768
- }, undefined, false, undefined, this)
769
- ]
770
- }, undefined, true, undefined, this);
771
- const footer = /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedBox_default, {
772
- marginLeft: 3,
773
- children: exitState.pending ? /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedText, {
774
- dimColor: true,
775
- children: [
776
- "Press ",
777
- exitState.keyName,
778
- " again to exit"
779
- ]
780
- }, undefined, true, undefined, this) : /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedText, {
781
- dimColor: true,
782
- children: "Esc to cancel"
783
- }, undefined, false, undefined, this)
784
- }, undefined, false, undefined, this);
785
- if (rule.source === "policySettings") {
786
- return /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(jsx_dev_runtime7.Fragment, {
787
- children: [
788
- /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedBox_default, {
789
- flexDirection: "column",
790
- gap: 1,
791
- borderStyle: "round",
792
- paddingLeft: 1,
793
- paddingRight: 1,
794
- borderColor: "permission",
795
- children: [
796
- /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedText, {
797
- bold: true,
798
- color: "permission",
799
- children: "Rule details"
800
- }, undefined, false, undefined, this),
801
- ruleDescription,
802
- /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedText, {
803
- italic: true,
804
- children: [
805
- "This rule is configured by managed settings and cannot be modified.",
806
- `
807
- `,
808
- "Contact your system administrator for more information."
809
- ]
810
- }, undefined, true, undefined, this)
811
- ]
812
- }, undefined, true, undefined, this),
813
- footer
814
- ]
815
- }, undefined, true, undefined, this);
816
- }
817
- return /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(jsx_dev_runtime7.Fragment, {
818
- children: [
819
- /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedBox_default, {
820
- flexDirection: "column",
821
- gap: 1,
822
- borderStyle: "round",
823
- paddingLeft: 1,
824
- paddingRight: 1,
825
- borderColor: "error",
826
- children: [
827
- /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedText, {
828
- bold: true,
829
- color: "error",
830
- children: [
831
- "Delete ",
832
- getRuleBehaviorLabel(rule.ruleBehavior),
833
- " tool?"
834
- ]
835
- }, undefined, true, undefined, this),
836
- ruleDescription,
837
- /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedText, {
838
- children: "Are you sure you want to delete this permission rule?"
839
- }, undefined, false, undefined, this),
840
- /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(Select, {
841
- onChange: (_) => _ === "yes" ? onDelete() : onCancel(),
842
- onCancel,
843
- options: [
844
- { label: "Yes", value: "yes" },
845
- { label: "No", value: "no" }
846
- ]
847
- }, undefined, false, undefined, this)
848
- ]
849
- }, undefined, true, undefined, this),
850
- footer
851
- ]
852
- }, undefined, true, undefined, this);
853
- }
854
- function RulesTabContent(props) {
855
- const {
856
- options,
857
- searchQuery,
858
- isSearchMode,
859
- isFocused,
860
- onSelect,
861
- onCancel,
862
- lastFocusedRuleKey,
863
- cursorOffset,
864
- onHeaderFocusChange
865
- } = props;
866
- const tabWidth = useTabsWidth();
867
- const { headerFocused, focusHeader, blurHeader } = useTabHeaderFocus2();
868
- import_react6.useEffect(() => {
869
- if (isSearchMode && headerFocused)
870
- blurHeader();
871
- }, [isSearchMode, headerFocused, blurHeader]);
872
- import_react6.useEffect(() => {
873
- onHeaderFocusChange?.(headerFocused);
874
- }, [headerFocused, onHeaderFocusChange]);
875
- return /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedBox_default, {
876
- flexDirection: "column",
877
- children: [
878
- /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedBox_default, {
879
- marginBottom: 1,
880
- flexDirection: "column",
881
- children: /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(SearchBox, {
882
- query: searchQuery,
883
- isFocused: isSearchMode && !headerFocused,
884
- isTerminalFocused: isFocused,
885
- width: tabWidth,
886
- cursorOffset
887
- }, undefined, false, undefined, this)
888
- }, undefined, false, undefined, this),
889
- /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(Select, {
890
- options,
891
- onChange: onSelect,
892
- onCancel,
893
- visibleOptionCount: Math.min(10, options.length),
894
- isDisabled: isSearchMode || headerFocused,
895
- defaultFocusValue: lastFocusedRuleKey,
896
- onUpFromFirstItem: focusHeader
897
- }, undefined, false, undefined, this)
898
- ]
899
- }, undefined, true, undefined, this);
900
- }
901
- function PermissionRulesTab({
902
- tab,
903
- getRulesOptions,
904
- handleToolSelect,
905
- ...rulesProps
906
- }) {
907
- return /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedBox_default, {
908
- flexDirection: "column",
909
- flexShrink: tab === "allow" ? 0 : undefined,
910
- children: [
911
- /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedText, {
912
- children: {
913
- allow: "Claude Code won't ask before using allowed tools.",
914
- ask: "Claude Code will always ask for confirmation before using these tools.",
915
- deny: "Claude Code will always reject requests to use denied tools."
916
- }[tab]
917
- }, undefined, false, undefined, this),
918
- /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(RulesTabContent, {
919
- options: getRulesOptions(tab, rulesProps.searchQuery).options,
920
- onSelect: (v) => handleToolSelect(v, tab),
921
- ...rulesProps
922
- }, undefined, false, undefined, this)
923
- ]
924
- }, undefined, true, undefined, this);
925
- }
926
- function PermissionRuleList({
927
- onExit,
928
- initialTab,
929
- onRetryDenials
930
- }) {
931
- const hasDenials = getAutoModeDenials().length > 0;
932
- const defaultTab = initialTab ?? (hasDenials ? "recent" : "allow");
933
- const [changes, setChanges] = import_react6.useState([]);
934
- const toolPermissionContext = useAppState((s) => s.toolPermissionContext);
935
- const setAppState = useSetAppState();
936
- const isTerminalFocused = useTerminalFocus();
937
- const denialStateRef = import_react6.useRef({ approved: new Set, retry: new Set, denials: [] });
938
- const handleDenialStateChange = import_react6.useCallback((s) => {
939
- denialStateRef.current = s;
940
- }, []);
941
- const [selectedRule, setSelectedRule] = import_react6.useState();
942
- const [lastFocusedRuleKey, setLastFocusedRuleKey] = import_react6.useState();
943
- const [addingRuleToTab, setAddingRuleToTab] = import_react6.useState(null);
944
- const [validatedRule, setValidatedRule] = import_react6.useState(null);
945
- const [isAddingWorkspaceDirectory, setIsAddingWorkspaceDirectory] = import_react6.useState(false);
946
- const [removingDirectory, setRemovingDirectory] = import_react6.useState(null);
947
- const [isSearchMode, setIsSearchMode] = import_react6.useState(false);
948
- const [headerFocused, setHeaderFocused] = import_react6.useState(true);
949
- const handleHeaderFocusChange = import_react6.useCallback((focused) => {
950
- setHeaderFocused(focused);
951
- }, []);
952
- const allowRulesByKey = import_react6.useMemo(() => {
953
- const map = new Map;
954
- getAllowRules(toolPermissionContext).forEach((rule) => {
955
- map.set(jsonStringify(rule), rule);
956
- });
957
- return map;
958
- }, [toolPermissionContext]);
959
- const denyRulesByKey = import_react6.useMemo(() => {
960
- const map = new Map;
961
- getDenyRules(toolPermissionContext).forEach((rule) => {
962
- map.set(jsonStringify(rule), rule);
963
- });
964
- return map;
965
- }, [toolPermissionContext]);
966
- const askRulesByKey = import_react6.useMemo(() => {
967
- const map = new Map;
968
- getAskRules(toolPermissionContext).forEach((rule) => {
969
- map.set(jsonStringify(rule), rule);
970
- });
971
- return map;
972
- }, [toolPermissionContext]);
973
- const getRulesOptions = import_react6.useCallback((tab, query = "") => {
974
- const rulesByKey = (() => {
975
- switch (tab) {
976
- case "allow":
977
- return allowRulesByKey;
978
- case "deny":
979
- return denyRulesByKey;
980
- case "ask":
981
- return askRulesByKey;
982
- case "workspace":
983
- case "recent":
984
- return new Map;
985
- }
986
- })();
987
- const options = [];
988
- if (tab !== "workspace" && tab !== "recent" && !query) {
989
- options.push({
990
- label: `Add a new rule${figures_default.ellipsis}`,
991
- value: "add-new-rule"
992
- });
993
- }
994
- const sortedRuleKeys = Array.from(rulesByKey.keys()).sort((a, b) => {
995
- const ruleA = rulesByKey.get(a);
996
- const ruleB = rulesByKey.get(b);
997
- if (ruleA && ruleB) {
998
- const ruleAString = permissionRuleValueToString(ruleA.ruleValue).toLowerCase();
999
- const ruleBString = permissionRuleValueToString(ruleB.ruleValue).toLowerCase();
1000
- return ruleAString.localeCompare(ruleBString);
1001
- }
1002
- return 0;
1003
- });
1004
- const lowerQuery = query.toLowerCase();
1005
- for (const ruleKey of sortedRuleKeys) {
1006
- const rule = rulesByKey.get(ruleKey);
1007
- if (rule) {
1008
- const ruleString = permissionRuleValueToString(rule.ruleValue);
1009
- if (query && !ruleString.toLowerCase().includes(lowerQuery)) {
1010
- continue;
1011
- }
1012
- options.push({
1013
- label: ruleString,
1014
- value: ruleKey
1015
- });
1016
- }
1017
- }
1018
- return { options, rulesByKey };
1019
- }, [allowRulesByKey, denyRulesByKey, askRulesByKey]);
1020
- const exitState = useExitOnCtrlCDWithKeybindings();
1021
- const isSearchModeActive = !selectedRule && !addingRuleToTab && !validatedRule && !isAddingWorkspaceDirectory && !removingDirectory;
1022
- const {
1023
- query: searchQuery,
1024
- setQuery: setSearchQuery,
1025
- cursorOffset: searchCursorOffset
1026
- } = useSearchInput({
1027
- isActive: isSearchModeActive && isSearchMode,
1028
- onExit: () => {
1029
- setIsSearchMode(false);
1030
- }
1031
- });
1032
- const handleKeyDown = import_react6.useCallback((e) => {
1033
- if (!isSearchModeActive)
1034
- return;
1035
- if (isSearchMode)
1036
- return;
1037
- if (e.ctrl || e.meta)
1038
- return;
1039
- if (e.key === "/") {
1040
- e.preventDefault();
1041
- setIsSearchMode(true);
1042
- setSearchQuery("");
1043
- } else if (e.key.length === 1 && e.key !== "j" && e.key !== "k" && e.key !== "m" && e.key !== "i" && e.key !== "r" && e.key !== " ") {
1044
- e.preventDefault();
1045
- setIsSearchMode(true);
1046
- setSearchQuery(e.key);
1047
- }
1048
- }, [isSearchModeActive, isSearchMode, setSearchQuery]);
1049
- const handleToolSelect = import_react6.useCallback((selectedValue, tab) => {
1050
- const { rulesByKey } = getRulesOptions(tab);
1051
- if (selectedValue === "add-new-rule") {
1052
- setAddingRuleToTab(tab);
1053
- return;
1054
- } else {
1055
- setSelectedRule(rulesByKey.get(selectedValue));
1056
- return;
1057
- }
1058
- }, [getRulesOptions]);
1059
- const handleRuleInputCancel = import_react6.useCallback(() => {
1060
- setAddingRuleToTab(null);
1061
- }, []);
1062
- const handleRuleInputSubmit = import_react6.useCallback((ruleValue, ruleBehavior) => {
1063
- setValidatedRule({ ruleValue, ruleBehavior });
1064
- setAddingRuleToTab(null);
1065
- }, []);
1066
- const handleAddRulesSuccess = import_react6.useCallback((rules, unreachable) => {
1067
- setValidatedRule(null);
1068
- for (const rule of rules) {
1069
- setChanges((prev) => [
1070
- ...prev,
1071
- `Added ${rule.ruleBehavior} rule ${source_default.bold(permissionRuleValueToString(rule.ruleValue))}`
1072
- ]);
1073
- }
1074
- if (unreachable && unreachable.length > 0) {
1075
- for (const u of unreachable) {
1076
- const severity = u.shadowType === "deny" ? "blocked" : "shadowed";
1077
- setChanges((prev) => [
1078
- ...prev,
1079
- source_default.yellow(`${figures_default.warning} Warning: ${permissionRuleValueToString(u.rule.ruleValue)} is ${severity}`),
1080
- source_default.dim(` ${u.reason}`),
1081
- source_default.dim(` Fix: ${u.fix}`)
1082
- ]);
1083
- }
1084
- }
1085
- }, []);
1086
- const handleAddRuleCancel = import_react6.useCallback(() => {
1087
- setValidatedRule(null);
1088
- }, []);
1089
- const handleRequestAddDirectory = import_react6.useCallback(() => setIsAddingWorkspaceDirectory(true), []);
1090
- const handleRequestRemoveDirectory = import_react6.useCallback((path) => setRemovingDirectory(path), []);
1091
- const handleRulesCancel = import_react6.useCallback(() => {
1092
- const s = denialStateRef.current;
1093
- const denialsFor = (set) => Array.from(set).map((idx) => s.denials[idx]).filter((d) => d !== undefined);
1094
- const retryDenials = denialsFor(s.retry);
1095
- if (retryDenials.length > 0) {
1096
- const commands = retryDenials.map((d) => d.display);
1097
- onRetryDenials?.(commands);
1098
- onExit(undefined, {
1099
- shouldQuery: true,
1100
- metaMessages: [
1101
- `Permission granted for: ${commands.join(", ")}. You may now retry ${commands.length === 1 ? "this command" : "these commands"} if you would like.`
1102
- ]
1103
- });
1104
- return;
1105
- }
1106
- const approvedDenials = denialsFor(s.approved);
1107
- if (approvedDenials.length > 0 || changes.length > 0) {
1108
- const approvedMsg = approvedDenials.length > 0 ? [
1109
- `Approved ${approvedDenials.map((d) => source_default.bold(d.display)).join(", ")}`
1110
- ] : [];
1111
- onExit([...approvedMsg, ...changes].join(`
1112
- `));
1113
- } else {
1114
- onExit("Permissions dialog dismissed", {
1115
- display: "system"
1116
- });
1117
- }
1118
- }, [changes, onExit, onRetryDenials]);
1119
- useKeybinding("confirm:no", handleRulesCancel, {
1120
- context: "Settings",
1121
- isActive: isSearchModeActive && !isSearchMode
1122
- });
1123
- const handleDeleteRule = () => {
1124
- if (!selectedRule)
1125
- return;
1126
- const { options } = getRulesOptions(selectedRule.ruleBehavior);
1127
- const selectedKey = jsonStringify(selectedRule);
1128
- const ruleKeys = options.filter((opt) => opt.value !== "add-new-rule").map((opt) => opt.value);
1129
- const currentIndex = ruleKeys.indexOf(selectedKey);
1130
- let nextFocusKey;
1131
- if (currentIndex !== -1) {
1132
- if (currentIndex < ruleKeys.length - 1) {
1133
- nextFocusKey = ruleKeys[currentIndex + 1];
1134
- } else if (currentIndex > 0) {
1135
- nextFocusKey = ruleKeys[currentIndex - 1];
1136
- }
1137
- }
1138
- setLastFocusedRuleKey(nextFocusKey);
1139
- deletePermissionRule({
1140
- rule: selectedRule,
1141
- initialContext: toolPermissionContext,
1142
- setToolPermissionContext(toolPermissionContext2) {
1143
- setAppState((prev) => ({
1144
- ...prev,
1145
- toolPermissionContext: toolPermissionContext2
1146
- }));
1147
- }
1148
- });
1149
- setChanges((prev) => [
1150
- ...prev,
1151
- `Deleted ${selectedRule.ruleBehavior} rule ${source_default.bold(permissionRuleValueToString(selectedRule.ruleValue))}`
1152
- ]);
1153
- setSelectedRule(undefined);
1154
- };
1155
- if (selectedRule) {
1156
- return /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(RuleDetails, {
1157
- rule: selectedRule,
1158
- onDelete: handleDeleteRule,
1159
- onCancel: () => setSelectedRule(undefined)
1160
- }, undefined, false, undefined, this);
1161
- }
1162
- if (addingRuleToTab && addingRuleToTab !== "workspace" && addingRuleToTab !== "recent") {
1163
- return /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(PermissionRuleInput, {
1164
- onCancel: handleRuleInputCancel,
1165
- onSubmit: handleRuleInputSubmit,
1166
- ruleBehavior: addingRuleToTab
1167
- }, undefined, false, undefined, this);
1168
- }
1169
- if (validatedRule) {
1170
- return /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(AddPermissionRules, {
1171
- onAddRules: handleAddRulesSuccess,
1172
- onCancel: handleAddRuleCancel,
1173
- ruleValues: [validatedRule.ruleValue],
1174
- ruleBehavior: validatedRule.ruleBehavior,
1175
- initialContext: toolPermissionContext,
1176
- setToolPermissionContext: (toolPermissionContext2) => {
1177
- setAppState((prev) => ({
1178
- ...prev,
1179
- toolPermissionContext: toolPermissionContext2
1180
- }));
1181
- }
1182
- }, undefined, false, undefined, this);
1183
- }
1184
- if (isAddingWorkspaceDirectory) {
1185
- return /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(AddWorkspaceDirectory, {
1186
- onAddDirectory: (path, remember) => {
1187
- const destination = remember ? "localSettings" : "session";
1188
- const permissionUpdate = {
1189
- type: "addDirectories",
1190
- directories: [path],
1191
- destination
1192
- };
1193
- const updatedContext = applyPermissionUpdate(toolPermissionContext, permissionUpdate);
1194
- setAppState((prev) => ({
1195
- ...prev,
1196
- toolPermissionContext: updatedContext
1197
- }));
1198
- if (remember) {
1199
- persistPermissionUpdate(permissionUpdate);
1200
- }
1201
- setChanges((prev) => [
1202
- ...prev,
1203
- `Added directory ${source_default.bold(path)} to workspace${remember ? " and saved to local settings" : " for this session"}`
1204
- ]);
1205
- setIsAddingWorkspaceDirectory(false);
1206
- },
1207
- onCancel: () => setIsAddingWorkspaceDirectory(false),
1208
- permissionContext: toolPermissionContext
1209
- }, undefined, false, undefined, this);
1210
- }
1211
- if (removingDirectory) {
1212
- return /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(RemoveWorkspaceDirectory, {
1213
- directoryPath: removingDirectory,
1214
- onRemove: () => {
1215
- setChanges((prev) => [
1216
- ...prev,
1217
- `Removed directory ${source_default.bold(removingDirectory)} from workspace`
1218
- ]);
1219
- setRemovingDirectory(null);
1220
- },
1221
- onCancel: () => setRemovingDirectory(null),
1222
- permissionContext: toolPermissionContext,
1223
- setPermissionContext: (toolPermissionContext2) => {
1224
- setAppState((prev) => ({
1225
- ...prev,
1226
- toolPermissionContext: toolPermissionContext2
1227
- }));
1228
- }
1229
- }, undefined, false, undefined, this);
1230
- }
1231
- const sharedRulesProps = {
1232
- searchQuery,
1233
- isSearchMode,
1234
- isFocused: isTerminalFocused,
1235
- onCancel: handleRulesCancel,
1236
- lastFocusedRuleKey,
1237
- cursorOffset: searchCursorOffset,
1238
- getRulesOptions,
1239
- handleToolSelect,
1240
- onHeaderFocusChange: handleHeaderFocusChange
1241
- };
1242
- const isHidden = !!selectedRule || !!addingRuleToTab || !!validatedRule || isAddingWorkspaceDirectory || !!removingDirectory;
1243
- return /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedBox_default, {
1244
- flexDirection: "column",
1245
- onKeyDown: handleKeyDown,
1246
- children: /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(Pane, {
1247
- color: "permission",
1248
- children: [
1249
- /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(Tabs, {
1250
- title: "Permissions:",
1251
- color: "permission",
1252
- defaultTab,
1253
- hidden: isHidden,
1254
- initialHeaderFocused: !hasDenials,
1255
- navFromContent: !isSearchMode,
1256
- children: [
1257
- /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(Tab, {
1258
- id: "recent",
1259
- title: "Recently denied",
1260
- children: /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(RecentDenialsTab, {
1261
- onHeaderFocusChange: handleHeaderFocusChange,
1262
- onStateChange: handleDenialStateChange
1263
- }, undefined, false, undefined, this)
1264
- }, undefined, false, undefined, this),
1265
- /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(Tab, {
1266
- id: "allow",
1267
- title: "Allow",
1268
- children: /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(PermissionRulesTab, {
1269
- tab: "allow",
1270
- ...sharedRulesProps
1271
- }, undefined, false, undefined, this)
1272
- }, undefined, false, undefined, this),
1273
- /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(Tab, {
1274
- id: "ask",
1275
- title: "Ask",
1276
- children: /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(PermissionRulesTab, {
1277
- tab: "ask",
1278
- ...sharedRulesProps
1279
- }, undefined, false, undefined, this)
1280
- }, undefined, false, undefined, this),
1281
- /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(Tab, {
1282
- id: "deny",
1283
- title: "Deny",
1284
- children: /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(PermissionRulesTab, {
1285
- tab: "deny",
1286
- ...sharedRulesProps
1287
- }, undefined, false, undefined, this)
1288
- }, undefined, false, undefined, this),
1289
- /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(Tab, {
1290
- id: "workspace",
1291
- title: "Workspace",
1292
- children: /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedBox_default, {
1293
- flexDirection: "column",
1294
- children: [
1295
- /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedText, {
1296
- children: "Claude Code can read files in the workspace, and make edits when auto-accept edits is on."
1297
- }, undefined, false, undefined, this),
1298
- /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(WorkspaceTab, {
1299
- onExit,
1300
- toolPermissionContext,
1301
- onRequestAddDirectory: handleRequestAddDirectory,
1302
- onRequestRemoveDirectory: handleRequestRemoveDirectory,
1303
- onHeaderFocusChange: handleHeaderFocusChange
1304
- }, undefined, false, undefined, this)
1305
- ]
1306
- }, undefined, true, undefined, this)
1307
- }, undefined, false, undefined, this)
1308
- ]
1309
- }, undefined, true, undefined, this),
1310
- /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedBox_default, {
1311
- marginTop: 1,
1312
- paddingLeft: 1,
1313
- children: /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedText, {
1314
- dimColor: true,
1315
- children: exitState.pending ? /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(jsx_dev_runtime7.Fragment, {
1316
- children: [
1317
- "Press ",
1318
- exitState.keyName,
1319
- " again to exit"
1320
- ]
1321
- }, undefined, true, undefined, this) : headerFocused ? /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(jsx_dev_runtime7.Fragment, {
1322
- children: "\u2190/\u2192 tab switch \xB7 \u2193 return \xB7 Esc cancel"
1323
- }, undefined, false, undefined, this) : isSearchMode ? /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(jsx_dev_runtime7.Fragment, {
1324
- children: "Type to filter \xB7 Enter/\u2193 select \xB7 \u2191 tabs \xB7 Esc clear"
1325
- }, undefined, false, undefined, this) : hasDenials && defaultTab === "recent" ? /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(jsx_dev_runtime7.Fragment, {
1326
- children: "Enter approve \xB7 r retry \xB7 \u2191\u2193 navigate \xB7 \u2190/\u2192 switch \xB7 Esc cancel"
1327
- }, undefined, false, undefined, this) : /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(jsx_dev_runtime7.Fragment, {
1328
- children: "\u2191\u2193 navigate \xB7 Enter select \xB7 Type to search \xB7 \u2190/\u2192 switch \xB7 Esc cancel"
1329
- }, undefined, false, undefined, this)
1330
- }, undefined, false, undefined, this)
1331
- }, undefined, false, undefined, this)
1332
- ]
1333
- }, undefined, true, undefined, this)
1334
- }, undefined, false, undefined, this);
1335
- }
1336
- var import_react6, jsx_dev_runtime7;
1337
- var init_PermissionRuleList = __esm(() => {
1338
- init_source();
1339
- init_figures();
1340
- init_AppState();
1341
- init_PermissionUpdate();
1342
- init_select();
1343
- init_useExitOnCtrlCDWithKeybindings();
1344
- init_useSearchInput();
1345
- init_src();
1346
- init_useKeybinding();
1347
- init_autoModeDenials();
1348
- init_permissionRuleParser();
1349
- init_permissions();
1350
- init_slowOperations();
1351
- init_src();
1352
- init_SearchBox();
1353
- init_AddPermissionRules();
1354
- init_AddWorkspaceDirectory();
1355
- init_PermissionRuleDescription();
1356
- init_PermissionRuleInput();
1357
- init_RecentDenialsTab();
1358
- init_RemoveWorkspaceDirectory();
1359
- init_WorkspaceTab();
1360
- import_react6 = __toESM(require_react(), 1);
1361
- jsx_dev_runtime7 = __toESM(require_jsx_dev_runtime(), 1);
1362
- });
1363
-
1364
- // src/commands/permissions/permissions.tsx
1365
- var jsx_dev_runtime8, call = async (onDone, context) => {
1366
- return /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(PermissionRuleList, {
1367
- onExit: onDone,
1368
- onRetryDenials: (commands) => {
1369
- context.setMessages((prev) => [
1370
- ...prev,
1371
- createPermissionRetryMessage(commands)
1372
- ]);
1373
- }
1374
- }, undefined, false, undefined, this);
1375
- };
1376
- var init_permissions2 = __esm(() => {
1377
- init_PermissionRuleList();
1378
- init_messages();
1379
- jsx_dev_runtime8 = __toESM(require_jsx_dev_runtime(), 1);
1380
- });
1381
- init_permissions2();
1382
-
1383
- export {
1384
- call
1385
- };