@caspian2026/agent-sdk 0.0.24 → 0.0.26

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 +196 -47
  3. package/dist/sdk/query.cjs +2 -362
  4. package/dist/sdk/query.js +2 -367
  5. package/package.json +4 -6
  6. package/dist/chunk-05kvhzd7.js +0 -3561
  7. package/dist/chunk-07069jq1.js +0 -30
  8. package/dist/chunk-0731m51q.js +0 -8
  9. package/dist/chunk-08bspa4b.js +0 -673
  10. package/dist/chunk-0brkf8q8.js +0 -89
  11. package/dist/chunk-0n843xh7.js +0 -261
  12. package/dist/chunk-0nbp5jwx.js +0 -8583
  13. package/dist/chunk-0nj16az9.js +0 -169
  14. package/dist/chunk-0paqc2yw.js +0 -15
  15. package/dist/chunk-0q6b50ps.js +0 -111
  16. package/dist/chunk-0r5bb9j4.js +0 -477
  17. package/dist/chunk-0rpz1wgn.js +0 -1030
  18. package/dist/chunk-0t81d427.js +0 -41
  19. package/dist/chunk-0vaw02wq.js +0 -24
  20. package/dist/chunk-0vkfrmqm.js +0 -690
  21. package/dist/chunk-0vp3wfab.js +0 -12
  22. package/dist/chunk-0vr10742.js +0 -1809
  23. package/dist/chunk-0xjaqda8.js +0 -1124
  24. package/dist/chunk-13ehyphg.js +0 -223
  25. package/dist/chunk-15jsw9bb.js +0 -349
  26. package/dist/chunk-16m7eyyw.js +0 -1385
  27. package/dist/chunk-1ae3nt9j.js +0 -31
  28. package/dist/chunk-1gq4r3v1.js +0 -308
  29. package/dist/chunk-1gx78081.js +0 -66
  30. package/dist/chunk-1h2famwb.js +0 -49
  31. package/dist/chunk-1n546sfg.js +0 -200
  32. package/dist/chunk-1qg06d60.js +0 -494
  33. package/dist/chunk-1t0rqstn.js +0 -146
  34. package/dist/chunk-1z8p2eqd.js +0 -40
  35. package/dist/chunk-1zjh9cc5.js +0 -266
  36. package/dist/chunk-20ahkkrb.js +0 -132
  37. package/dist/chunk-21pbfch8.js +0 -105
  38. package/dist/chunk-26wtxbdc.js +0 -13870
  39. package/dist/chunk-2fwze72g.js +0 -24
  40. package/dist/chunk-2gcbr1c7.js +0 -107
  41. package/dist/chunk-2grc1yr8.js +0 -654
  42. package/dist/chunk-2gzv8nrw.js +0 -205
  43. package/dist/chunk-2r212cvt.js +0 -253
  44. package/dist/chunk-2s74bt6e.js +0 -317
  45. package/dist/chunk-2v385w7r.js +0 -7422
  46. package/dist/chunk-2wtkvpp2.js +0 -167
  47. package/dist/chunk-31rsspfr.js +0 -418
  48. package/dist/chunk-3c25bcsw.js +0 -17
  49. package/dist/chunk-3jm08aaw.js +0 -91
  50. package/dist/chunk-3mgywd32.js +0 -8
  51. package/dist/chunk-3nk79af8.js +0 -8
  52. package/dist/chunk-3v4sk2py.js +0 -101
  53. package/dist/chunk-3vwft0eh.js +0 -349
  54. package/dist/chunk-3vy1jt9p.js +0 -1010
  55. package/dist/chunk-3wvqzq9w.js +0 -92
  56. package/dist/chunk-3wvv2s8d.js +0 -336
  57. package/dist/chunk-4060b3s2.js +0 -108
  58. package/dist/chunk-434e0vh4.js +0 -275
  59. package/dist/chunk-46dm23zs.js +0 -344
  60. package/dist/chunk-4bh4qs70.js +0 -209
  61. package/dist/chunk-4cxzbqws.js +0 -94
  62. package/dist/chunk-4jm600zv.js +0 -13
  63. package/dist/chunk-4k9d7gxv.js +0 -118
  64. package/dist/chunk-4nc3t6ms.js +0 -396
  65. package/dist/chunk-4pbx3g7s.js +0 -26
  66. package/dist/chunk-4qhh8bpa.js +0 -54
  67. package/dist/chunk-4v63px9y.js +0 -133
  68. package/dist/chunk-4xnnzt3j.js +0 -74
  69. package/dist/chunk-4zchh01h.js +0 -201
  70. package/dist/chunk-5216fha8.js +0 -1163
  71. package/dist/chunk-55raexh7.js +0 -14358
  72. package/dist/chunk-5bffhf64.js +0 -81
  73. package/dist/chunk-5ccdsxgy.js +0 -74
  74. package/dist/chunk-5ddh2hyn.js +0 -91
  75. package/dist/chunk-5e6ncq5j.js +0 -61
  76. package/dist/chunk-5ekyhb1w.js +0 -422
  77. package/dist/chunk-5fy4r8rv.js +0 -52
  78. package/dist/chunk-5h5kx2jd.js +0 -34
  79. package/dist/chunk-5mbgdvyz.js +0 -847
  80. package/dist/chunk-5n1jc02d.js +0 -87
  81. package/dist/chunk-5pysjah8.js +0 -1543
  82. package/dist/chunk-5ssfz438.js +0 -323
  83. package/dist/chunk-5z28bqne.js +0 -6748
  84. package/dist/chunk-603y0mmg.js +0 -50
  85. package/dist/chunk-62v5kkff.js +0 -90
  86. package/dist/chunk-64c1avct.js +0 -13
  87. package/dist/chunk-64r16v22.js +0 -162
  88. package/dist/chunk-64smdx4a.js +0 -418
  89. package/dist/chunk-66zry909.js +0 -11
  90. package/dist/chunk-68ffk5qa.js +0 -14
  91. package/dist/chunk-69n11zng.js +0 -436
  92. package/dist/chunk-6dj5t602.js +0 -341
  93. package/dist/chunk-6dngjwkh.js +0 -63
  94. package/dist/chunk-6nsd9606.js +0 -790
  95. package/dist/chunk-6pkh8frk.js +0 -253
  96. package/dist/chunk-6qcmt5eb.js +0 -251
  97. package/dist/chunk-6ww7451s.js +0 -60
  98. package/dist/chunk-6xgb0kqz.js +0 -90
  99. package/dist/chunk-72ys9m07.js +0 -121
  100. package/dist/chunk-741sgvtx.js +0 -121
  101. package/dist/chunk-7aw745vx.js +0 -40175
  102. package/dist/chunk-7c8b8cfb.js +0 -219
  103. package/dist/chunk-7mwt4e1z.js +0 -234
  104. package/dist/chunk-7sgtxrsc.js +0 -1059
  105. package/dist/chunk-7wm5s02e.js +0 -216
  106. package/dist/chunk-7xyswgjh.js +0 -8
  107. package/dist/chunk-80a197ez.js +0 -1438
  108. package/dist/chunk-83hfzbx3.js +0 -10
  109. package/dist/chunk-8akrsgad.js +0 -55
  110. package/dist/chunk-8g5pe1gr.js +0 -37
  111. package/dist/chunk-8s07t4k7.js +0 -40
  112. package/dist/chunk-8yhf030a.js +0 -69
  113. package/dist/chunk-928tzaa8.js +0 -107
  114. package/dist/chunk-949pjzj9.js +0 -266
  115. package/dist/chunk-9aycd4z9.js +0 -490
  116. package/dist/chunk-9bzqvsz5.js +0 -211
  117. package/dist/chunk-9q3xfy27.js +0 -460
  118. package/dist/chunk-9vzg1360.js +0 -153
  119. package/dist/chunk-9wbh8n1y.js +0 -63
  120. package/dist/chunk-9x5zgy22.js +0 -12
  121. package/dist/chunk-9zdj4ypz.js +0 -206
  122. package/dist/chunk-a0bvcgyd.js +0 -127
  123. package/dist/chunk-a4m3yr2q.js +0 -117
  124. package/dist/chunk-a8jd4gee.js +0 -227
  125. package/dist/chunk-ase86y73.js +0 -15
  126. package/dist/chunk-atfzpm6r.js +0 -325
  127. package/dist/chunk-awqsddp2.js +0 -338
  128. package/dist/chunk-awrgzpk6.js +0 -29
  129. package/dist/chunk-b0kf00ff.js +0 -637
  130. package/dist/chunk-b1kcd3ss.js +0 -27
  131. package/dist/chunk-b4hy21c4.js +0 -140
  132. package/dist/chunk-b9mkm8mg.js +0 -111
  133. package/dist/chunk-bdjx14rd.js +0 -594
  134. package/dist/chunk-bfb41q9h.js +0 -295
  135. package/dist/chunk-bg4x9ex0.js +0 -21
  136. package/dist/chunk-bh5zqvyc.js +0 -36
  137. package/dist/chunk-bn0zv2y2.js +0 -1154
  138. package/dist/chunk-bn7t681c.js +0 -2669
  139. package/dist/chunk-br4wgffc.js +0 -393
  140. package/dist/chunk-brjd9zmk.js +0 -42
  141. package/dist/chunk-byfawrfx.js +0 -121
  142. package/dist/chunk-c6sjhj89.js +0 -1284
  143. package/dist/chunk-c7jwbe76.js +0 -29030
  144. package/dist/chunk-cdef9v7b.js +0 -27
  145. package/dist/chunk-cdz5yb0r.js +0 -57
  146. package/dist/chunk-cevq1787.js +0 -2718
  147. package/dist/chunk-cgfdkzhb.js +0 -12
  148. package/dist/chunk-cgqw4x5z.js +0 -155
  149. package/dist/chunk-cmmmc8e0.js +0 -212
  150. package/dist/chunk-cnsj3vq2.js +0 -35
  151. package/dist/chunk-cxrktb5g.js +0 -51
  152. package/dist/chunk-cyhrb0bk.js +0 -251
  153. package/dist/chunk-d23rmn8r.js +0 -62
  154. package/dist/chunk-d4mdda98.js +0 -94
  155. package/dist/chunk-dcwp94cj.js +0 -152
  156. package/dist/chunk-ddsjkqs4.js +0 -39
  157. package/dist/chunk-ddv56j39.js +0 -148
  158. package/dist/chunk-dfq6pbq7.js +0 -5822
  159. package/dist/chunk-dfzkwynj.js +0 -5368
  160. package/dist/chunk-dkgkd8b7.js +0 -516
  161. package/dist/chunk-dpnmf0pq.js +0 -312
  162. package/dist/chunk-dygx7vcc.js +0 -226
  163. package/dist/chunk-e0abab5b.js +0 -445
  164. package/dist/chunk-e5qhvhjy.js +0 -168
  165. package/dist/chunk-e60y6r1n.js +0 -20
  166. package/dist/chunk-e68kgvcq.js +0 -79
  167. package/dist/chunk-e9w9zc0g.js +0 -392
  168. package/dist/chunk-ecj9w6tm.js +0 -558
  169. package/dist/chunk-ehtwnxpg.js +0 -1591
  170. package/dist/chunk-eqp1rfft.js +0 -17
  171. package/dist/chunk-etdt1xz3.js +0 -19
  172. package/dist/chunk-ewadzrm8.js +0 -103
  173. package/dist/chunk-f03s83vj.js +0 -91
  174. package/dist/chunk-f3kk0p3s.js +0 -150
  175. package/dist/chunk-f3pjerx4.js +0 -4265
  176. package/dist/chunk-f6h5weh6.js +0 -61
  177. package/dist/chunk-fajg8x36.js +0 -8158
  178. package/dist/chunk-fbv4apne.js +0 -51
  179. package/dist/chunk-fcynwjpm.js +0 -1072
  180. package/dist/chunk-fdvaf6nn.js +0 -20
  181. package/dist/chunk-feyzykye.js +0 -10
  182. package/dist/chunk-ff85rwvc.js +0 -180
  183. package/dist/chunk-fqak69ft.js +0 -458
  184. package/dist/chunk-fxdkbabd.js +0 -195
  185. package/dist/chunk-fyc5fepv.js +0 -10
  186. package/dist/chunk-g78c6ztj.js +0 -89
  187. package/dist/chunk-g8ee7yza.js +0 -105
  188. package/dist/chunk-g9f19ttm.js +0 -15
  189. package/dist/chunk-gcktsbxb.js +0 -77
  190. package/dist/chunk-gdwdqewd.js +0 -19
  191. package/dist/chunk-gg55fns0.js +0 -6440
  192. package/dist/chunk-gnpt1t6q.js +0 -209364
  193. package/dist/chunk-gsbw2j2b.js +0 -276
  194. package/dist/chunk-gybt680f.js +0 -9114
  195. package/dist/chunk-gz1e8y1w.js +0 -33
  196. package/dist/chunk-gz7vn2gg.js +0 -114
  197. package/dist/chunk-h0d5eat0.js +0 -101
  198. package/dist/chunk-h27tjbp3.js +0 -33118
  199. package/dist/chunk-h2yy8k4c.js +0 -58
  200. package/dist/chunk-h5acpdqt.js +0 -103
  201. package/dist/chunk-h63r8vps.js +0 -2840
  202. package/dist/chunk-h64x5b04.js +0 -860
  203. package/dist/chunk-h92snc84.js +0 -420
  204. package/dist/chunk-h9n54swm.js +0 -27
  205. package/dist/chunk-hafcrnpc.js +0 -145
  206. package/dist/chunk-hakdhagh.js +0 -16606
  207. package/dist/chunk-hk4phsaw.js +0 -388
  208. package/dist/chunk-hph1bmqw.js +0 -65
  209. package/dist/chunk-hvnztnp3.js +0 -71
  210. package/dist/chunk-hwfknpxv.js +0 -39
  211. package/dist/chunk-j2xxd002.js +0 -1052
  212. package/dist/chunk-j3qbygme.js +0 -105
  213. package/dist/chunk-j5bth84e.js +0 -97
  214. package/dist/chunk-j64ga6ta.js +0 -8035
  215. package/dist/chunk-jbwgyskk.js +0 -385
  216. package/dist/chunk-jd32zbps.js +0 -15
  217. package/dist/chunk-jdhkh2bb.js +0 -618
  218. package/dist/chunk-jeqcwgt7.js +0 -177
  219. package/dist/chunk-jf75p9ap.js +0 -445
  220. package/dist/chunk-jgvk0za1.js +0 -260
  221. package/dist/chunk-jhpaevah.js +0 -565
  222. package/dist/chunk-jmjwrbwd.js +0 -635
  223. package/dist/chunk-jpdbfwvq.js +0 -100
  224. package/dist/chunk-jps4m6sz.js +0 -183
  225. package/dist/chunk-jwf0s51s.js +0 -867
  226. package/dist/chunk-jxge4dgh.js +0 -83
  227. package/dist/chunk-jz71gv95.js +0 -1161
  228. package/dist/chunk-jzthz1bx.js +0 -15
  229. package/dist/chunk-jzvd2ycp.js +0 -120
  230. package/dist/chunk-k0p9w03v.js +0 -4957
  231. package/dist/chunk-k4dcreh0.js +0 -442
  232. package/dist/chunk-k7akhwkn.js +0 -151
  233. package/dist/chunk-k8vp0atq.js +0 -2331
  234. package/dist/chunk-kgd7gfvk.js +0 -407
  235. package/dist/chunk-km5ycg1j.js +0 -87
  236. package/dist/chunk-kvyrxzj8.js +0 -26
  237. package/dist/chunk-kwekc97v.js +0 -18
  238. package/dist/chunk-ky1z78ve.js +0 -119
  239. package/dist/chunk-mcws22k3.js +0 -42
  240. package/dist/chunk-mjazvyd8.js +0 -528
  241. package/dist/chunk-mswx2nma.js +0 -103
  242. package/dist/chunk-mz6a0phh.js +0 -2962
  243. package/dist/chunk-n2tg12hg.js +0 -374
  244. package/dist/chunk-n3fv4ya7.js +0 -146
  245. package/dist/chunk-n4eabmqd.js +0 -93
  246. package/dist/chunk-n4tx7baq.js +0 -193
  247. package/dist/chunk-n6g4jbeh.js +0 -289
  248. package/dist/chunk-n6wzfxf1.js +0 -100
  249. package/dist/chunk-ndcmqfkv.js +0 -244
  250. package/dist/chunk-netzwgv1.js +0 -154
  251. package/dist/chunk-nhcg04jt.js +0 -120
  252. package/dist/chunk-nhsm3ntd.js +0 -439
  253. package/dist/chunk-njev89d1.js +0 -2335
  254. package/dist/chunk-nmgj86tt.js +0 -24
  255. package/dist/chunk-ns7x6xam.js +0 -22820
  256. package/dist/chunk-p7vkh4wx.js +0 -15
  257. package/dist/chunk-p8na2wwp.js +0 -14
  258. package/dist/chunk-p97fd5af.js +0 -684
  259. package/dist/chunk-pe3rkfp2.js +0 -74
  260. package/dist/chunk-pgtnj1mt.js +0 -705
  261. package/dist/chunk-phmnkw9y.js +0 -283
  262. package/dist/chunk-pnds7g1q.js +0 -130
  263. package/dist/chunk-ppwjyveh.js +0 -8
  264. package/dist/chunk-pqqxdk5f.js +0 -543
  265. package/dist/chunk-ps49ymvj.js +0 -43
  266. package/dist/chunk-pwwa7s62.js +0 -11
  267. package/dist/chunk-q3hfrat2.js +0 -313
  268. package/dist/chunk-qajrkk97.js +0 -298
  269. package/dist/chunk-qatfdxvd.js +0 -34
  270. package/dist/chunk-qb5qcctj.js +0 -206
  271. package/dist/chunk-qb6k2afy.js +0 -153
  272. package/dist/chunk-qgk93a75.js +0 -85
  273. package/dist/chunk-qkczt8cr.js +0 -24
  274. package/dist/chunk-qn1be1vf.js +0 -267
  275. package/dist/chunk-qnfx3qtx.js +0 -617
  276. package/dist/chunk-qnwne2m4.js +0 -87
  277. package/dist/chunk-qp2qdcda.js +0 -100
  278. package/dist/chunk-qpp3wwh5.js +0 -697
  279. package/dist/chunk-r0bx1gc7.js +0 -174
  280. package/dist/chunk-radnwk8x.js +0 -107
  281. package/dist/chunk-rkv5jq0y.js +0 -71
  282. package/dist/chunk-rmbbmd3s.js +0 -68
  283. package/dist/chunk-rmgbs5an.js +0 -640
  284. package/dist/chunk-rn0v1hk8.js +0 -34
  285. package/dist/chunk-rnxctq9p.js +0 -1646
  286. package/dist/chunk-rtd39n81.js +0 -95
  287. package/dist/chunk-s8gy4ky9.js +0 -122
  288. package/dist/chunk-s8kj6ajy.js +0 -32
  289. package/dist/chunk-sd36yzx8.js +0 -954
  290. package/dist/chunk-sdenh194.js +0 -121
  291. package/dist/chunk-sdtqp75c.js +0 -55
  292. package/dist/chunk-sedbc8ep.js +0 -212
  293. package/dist/chunk-sfrb15b2.js +0 -321
  294. package/dist/chunk-sgpmpn90.js +0 -35
  295. package/dist/chunk-sh02d2qn.js +0 -38
  296. package/dist/chunk-shd4yhsf.js +0 -32
  297. package/dist/chunk-shkycj1q.js +0 -178
  298. package/dist/chunk-sk7h93je.js +0 -153
  299. package/dist/chunk-sm8g6fsm.js +0 -122
  300. package/dist/chunk-snrjy66h.js +0 -671
  301. package/dist/chunk-sq4a0yjh.js +0 -116
  302. package/dist/chunk-sr3t4thh.js +0 -895
  303. package/dist/chunk-srj6qnf6.js +0 -107
  304. package/dist/chunk-sz62n77p.js +0 -155
  305. package/dist/chunk-szj5wvdy.js +0 -28
  306. package/dist/chunk-t29a6zb5.js +0 -45
  307. package/dist/chunk-t2ecddwj.js +0 -731
  308. package/dist/chunk-t33hmmmm.js +0 -113
  309. package/dist/chunk-t4khqff1.js +0 -16
  310. package/dist/chunk-t9p85zff.js +0 -24
  311. package/dist/chunk-ta3jyvxs.js +0 -984
  312. package/dist/chunk-tkx5eec8.js +0 -54
  313. package/dist/chunk-v1kzp02e.js +0 -785
  314. package/dist/chunk-v4t6dyyh.js +0 -9076
  315. package/dist/chunk-v78fj8by.js +0 -145
  316. package/dist/chunk-v8kjswxt.js +0 -61
  317. package/dist/chunk-v9smspw2.js +0 -4301
  318. package/dist/chunk-vf612n57.js +0 -472
  319. package/dist/chunk-vkhrrvfq.js +0 -44
  320. package/dist/chunk-vt5wm07k.js +0 -74
  321. package/dist/chunk-vvvrv61g.js +0 -875
  322. package/dist/chunk-vyjeh50y.js +0 -2149
  323. package/dist/chunk-w0kxcv73.js +0 -97
  324. package/dist/chunk-w6m6trzq.js +0 -58
  325. package/dist/chunk-wa8yn2p0.js +0 -2007
  326. package/dist/chunk-wb18cecv.js +0 -995
  327. package/dist/chunk-wgk9sxk7.js +0 -329
  328. package/dist/chunk-wh0ev1bw.js +0 -111
  329. package/dist/chunk-wka1647p.js +0 -98
  330. package/dist/chunk-wnwfwyj4.js +0 -90
  331. package/dist/chunk-wpdchyy2.js +0 -97
  332. package/dist/chunk-x3g44n7k.js +0 -114
  333. package/dist/chunk-x47h283a.js +0 -56
  334. package/dist/chunk-x6r4v44b.js +0 -8
  335. package/dist/chunk-x7fdwq3d.js +0 -33
  336. package/dist/chunk-x8d2ehd7.js +0 -19
  337. package/dist/chunk-xbeg2hej.js +0 -257
  338. package/dist/chunk-xeb6075z.js +0 -3435
  339. package/dist/chunk-xhfmdq1y.js +0 -147
  340. package/dist/chunk-xhscn33a.js +0 -138
  341. package/dist/chunk-xv3era3s.js +0 -8
  342. package/dist/chunk-xz5gbhc3.js +0 -93
  343. package/dist/chunk-y1784krc.js +0 -19
  344. package/dist/chunk-y1vyezct.js +0 -123
  345. package/dist/chunk-y45ecntg.js +0 -942
  346. package/dist/chunk-y4ca9kqz.js +0 -3830
  347. package/dist/chunk-y9bhjjdz.js +0 -145
  348. package/dist/chunk-yb3bxv3w.js +0 -30
  349. package/dist/chunk-ye2q9gqj.js +0 -332
  350. package/dist/chunk-yfg3adfq.js +0 -88
  351. package/dist/chunk-yst0wmgw.js +0 -269
  352. package/dist/chunk-ywe9dbnz.js +0 -460
  353. package/dist/chunk-yyex5gsf.js +0 -269
  354. package/dist/chunk-yz2kzqk5.js +0 -439
  355. package/dist/chunk-z263ehpg.js +0 -131
  356. package/dist/chunk-z2dp53wn.js +0 -17
  357. package/dist/chunk-zaq348h2.js +0 -281
  358. package/dist/chunk-zr0qx9q0.js +0 -642
  359. package/dist/chunk-zxh62ved.js +0 -31
  360. package/dist/chunk-zy5vn8sd.js +0 -329
  361. package/dist/chunk-zzm33q8x.js +0 -8
  362. package/dist/cli.js +0 -91
@@ -1,984 +0,0 @@
1
- // @bun
2
- import {
3
- SandboxManager,
4
- getProcessCommand,
5
- getRipgrepStatus,
6
- init_genericProcessUtils,
7
- init_ripgrep,
8
- init_sandbox_adapter
9
- } from "./chunk-gnpt1t6q.js";
10
- import {
11
- CUSTOMIZATION_SURFACES,
12
- formatAutoUpdaterDisabledReason,
13
- getAutoUpdaterDisabledReason,
14
- getFeatureValue_CACHED_MAY_BE_STALE,
15
- getGlobalConfig,
16
- getManagedFilePath,
17
- init_config,
18
- init_growthbook,
19
- init_managedPath,
20
- init_types
21
- } from "./chunk-dfq6pbq7.js";
22
- import {
23
- init_bundledMode,
24
- isInBundledMode
25
- } from "./chunk-5ekyhb1w.js";
26
- import {
27
- execFileNoThrow,
28
- init_execFileNoThrow
29
- } from "./chunk-64r16v22.js";
30
- import {
31
- getCwd,
32
- init_cwd
33
- } from "./chunk-s8kj6ajy.js";
34
- import {
35
- init_which,
36
- which
37
- } from "./chunk-8yhf030a.js";
38
- import {
39
- execa,
40
- init_execa
41
- } from "./chunk-5z28bqne.js";
42
- import {
43
- getFsImplementation,
44
- getPlatform,
45
- init_debug,
46
- init_errors,
47
- init_fsOperations,
48
- init_log,
49
- init_platform,
50
- init_slowOperations,
51
- isENOENT,
52
- isFsInaccessible,
53
- jsonParse,
54
- jsonStringify,
55
- logError,
56
- logForDebugging,
57
- toError,
58
- writeFileSync_DEPRECATED
59
- } from "./chunk-gg55fns0.js";
60
- import {
61
- getClaudeConfigHomeDir,
62
- init_envUtils,
63
- isEnvDefinedFalsy,
64
- isEnvTruthy
65
- } from "./chunk-5n1jc02d.js";
66
- import {
67
- init_memoize,
68
- memoize_default
69
- } from "./chunk-vf612n57.js";
70
- import {
71
- __esm
72
- } from "./chunk-qp2qdcda.js";
73
-
74
- // src/utils/localInstaller.ts
75
- import { access, chmod, writeFile } from "fs/promises";
76
- import { join } from "path";
77
- function getLocalInstallDir() {
78
- return join(getClaudeConfigHomeDir(), "local");
79
- }
80
- function getLocalClaudePath() {
81
- return join(getLocalInstallDir(), "claude");
82
- }
83
- function isRunningFromLocalInstallation() {
84
- const execPath = process.argv[1] || "";
85
- return execPath.includes("/.claude/local/node_modules/");
86
- }
87
- async function localInstallationExists() {
88
- try {
89
- await access(join(getLocalInstallDir(), "node_modules", ".bin", "claude"));
90
- return true;
91
- } catch {
92
- return false;
93
- }
94
- }
95
- function getShellType() {
96
- const shellPath = process.env.SHELL || "";
97
- if (shellPath.includes("zsh"))
98
- return "zsh";
99
- if (shellPath.includes("bash"))
100
- return "bash";
101
- if (shellPath.includes("fish"))
102
- return "fish";
103
- return "unknown";
104
- }
105
- var init_localInstaller = __esm(() => {
106
- init_config();
107
- init_envUtils();
108
- init_errors();
109
- init_execFileNoThrow();
110
- init_fsOperations();
111
- init_log();
112
- init_slowOperations();
113
- });
114
-
115
- // src/utils/nativeInstaller/packageManagers.ts
116
- import { readFile } from "fs/promises";
117
- function isDistroFamily(osRelease, families) {
118
- return families.includes(osRelease.id) || osRelease.idLike.some((like) => families.includes(like));
119
- }
120
- function detectMise() {
121
- const execPath = process.execPath || process.argv[0] || "";
122
- if (/[/\\]mise[/\\]installs[/\\]/i.test(execPath)) {
123
- logForDebugging(`Detected mise installation: ${execPath}`);
124
- return true;
125
- }
126
- return false;
127
- }
128
- function detectAsdf() {
129
- const execPath = process.execPath || process.argv[0] || "";
130
- if (/[/\\]\.?asdf[/\\]installs[/\\]/i.test(execPath)) {
131
- logForDebugging(`Detected asdf installation: ${execPath}`);
132
- return true;
133
- }
134
- return false;
135
- }
136
- function detectHomebrew() {
137
- const platform = getPlatform();
138
- if (platform !== "macos" && platform !== "linux" && platform !== "wsl") {
139
- return false;
140
- }
141
- const execPath = process.execPath || process.argv[0] || "";
142
- if (execPath.includes("/Caskroom/")) {
143
- logForDebugging(`Detected Homebrew cask installation: ${execPath}`);
144
- return true;
145
- }
146
- return false;
147
- }
148
- function detectWinget() {
149
- const platform = getPlatform();
150
- if (platform !== "windows") {
151
- return false;
152
- }
153
- const execPath = process.execPath || process.argv[0] || "";
154
- const wingetPatterns = [
155
- /Microsoft[/\\]WinGet[/\\]Packages/i,
156
- /Microsoft[/\\]WinGet[/\\]Links/i
157
- ];
158
- for (const pattern of wingetPatterns) {
159
- if (pattern.test(execPath)) {
160
- logForDebugging(`Detected winget installation: ${execPath}`);
161
- return true;
162
- }
163
- }
164
- return false;
165
- }
166
- var getOsRelease, detectPacman, detectDeb, detectRpm, detectApk, getPackageManager;
167
- var init_packageManagers = __esm(() => {
168
- init_memoize();
169
- init_debug();
170
- init_execFileNoThrow();
171
- init_platform();
172
- getOsRelease = memoize_default(async () => {
173
- try {
174
- const content = await readFile("/etc/os-release", "utf8");
175
- const idMatch = content.match(/^ID=["']?(\S+?)["']?\s*$/m);
176
- const idLikeMatch = content.match(/^ID_LIKE=["']?(.+?)["']?\s*$/m);
177
- return {
178
- id: idMatch?.[1] ?? "",
179
- idLike: idLikeMatch?.[1]?.split(" ") ?? []
180
- };
181
- } catch {
182
- return null;
183
- }
184
- });
185
- detectPacman = memoize_default(async () => {
186
- const platform = getPlatform();
187
- if (platform !== "linux") {
188
- return false;
189
- }
190
- const osRelease = await getOsRelease();
191
- if (osRelease && !isDistroFamily(osRelease, ["arch"])) {
192
- return false;
193
- }
194
- const execPath = process.execPath || process.argv[0] || "";
195
- const result = await execFileNoThrow("pacman", ["-Qo", execPath], {
196
- timeout: 5000,
197
- useCwd: false
198
- });
199
- if (result.code === 0 && result.stdout) {
200
- logForDebugging(`Detected pacman installation: ${result.stdout.trim()}`);
201
- return true;
202
- }
203
- return false;
204
- });
205
- detectDeb = memoize_default(async () => {
206
- const platform = getPlatform();
207
- if (platform !== "linux") {
208
- return false;
209
- }
210
- const osRelease = await getOsRelease();
211
- if (osRelease && !isDistroFamily(osRelease, ["debian"])) {
212
- return false;
213
- }
214
- const execPath = process.execPath || process.argv[0] || "";
215
- const result = await execFileNoThrow("dpkg", ["-S", execPath], {
216
- timeout: 5000,
217
- useCwd: false
218
- });
219
- if (result.code === 0 && result.stdout) {
220
- logForDebugging(`Detected deb installation: ${result.stdout.trim()}`);
221
- return true;
222
- }
223
- return false;
224
- });
225
- detectRpm = memoize_default(async () => {
226
- const platform = getPlatform();
227
- if (platform !== "linux") {
228
- return false;
229
- }
230
- const osRelease = await getOsRelease();
231
- if (osRelease && !isDistroFamily(osRelease, ["fedora", "rhel", "suse"])) {
232
- return false;
233
- }
234
- const execPath = process.execPath || process.argv[0] || "";
235
- const result = await execFileNoThrow("rpm", ["-qf", execPath], {
236
- timeout: 5000,
237
- useCwd: false
238
- });
239
- if (result.code === 0 && result.stdout) {
240
- logForDebugging(`Detected rpm installation: ${result.stdout.trim()}`);
241
- return true;
242
- }
243
- return false;
244
- });
245
- detectApk = memoize_default(async () => {
246
- const platform = getPlatform();
247
- if (platform !== "linux") {
248
- return false;
249
- }
250
- const osRelease = await getOsRelease();
251
- if (osRelease && !isDistroFamily(osRelease, ["alpine"])) {
252
- return false;
253
- }
254
- const execPath = process.execPath || process.argv[0] || "";
255
- const result = await execFileNoThrow("apk", ["info", "--who-owns", execPath], {
256
- timeout: 5000,
257
- useCwd: false
258
- });
259
- if (result.code === 0 && result.stdout) {
260
- logForDebugging(`Detected apk installation: ${result.stdout.trim()}`);
261
- return true;
262
- }
263
- return false;
264
- });
265
- getPackageManager = memoize_default(async () => {
266
- if (detectHomebrew()) {
267
- return "homebrew";
268
- }
269
- if (detectWinget()) {
270
- return "winget";
271
- }
272
- if (detectMise()) {
273
- return "mise";
274
- }
275
- if (detectAsdf()) {
276
- return "asdf";
277
- }
278
- if (await detectPacman()) {
279
- return "pacman";
280
- }
281
- if (await detectApk()) {
282
- return "apk";
283
- }
284
- if (await detectDeb()) {
285
- return "deb";
286
- }
287
- if (await detectRpm()) {
288
- return "rpm";
289
- }
290
- return "unknown";
291
- });
292
- });
293
-
294
- // src/utils/shellConfig.ts
295
- import { open, readFile as readFile2, stat } from "fs/promises";
296
- import { homedir as osHomedir } from "os";
297
- import { join as join2 } from "path";
298
- function getShellConfigPaths(options) {
299
- const home = options?.homedir ?? osHomedir();
300
- const env = options?.env ?? process.env;
301
- const zshConfigDir = env.ZDOTDIR || home;
302
- return {
303
- zsh: join2(zshConfigDir, ".zshrc"),
304
- bash: join2(home, ".bashrc"),
305
- fish: join2(home, ".config/fish/config.fish")
306
- };
307
- }
308
- function filterClaudeAliases(lines) {
309
- let hadAlias = false;
310
- const filtered = lines.filter((line) => {
311
- if (CLAUDE_ALIAS_REGEX.test(line)) {
312
- let match = line.match(/alias\s+claude\s*=\s*["']([^"']+)["']/);
313
- if (!match) {
314
- match = line.match(/alias\s+claude\s*=\s*([^#\n]+)/);
315
- }
316
- if (match && match[1]) {
317
- const target = match[1].trim();
318
- if (target === getLocalClaudePath()) {
319
- hadAlias = true;
320
- return false;
321
- }
322
- }
323
- }
324
- return true;
325
- });
326
- return { filtered, hadAlias };
327
- }
328
- async function readFileLines(filePath) {
329
- try {
330
- const content = await readFile2(filePath, { encoding: "utf8" });
331
- return content.split(`
332
- `);
333
- } catch (e) {
334
- if (isFsInaccessible(e))
335
- return null;
336
- throw e;
337
- }
338
- }
339
- async function writeFileLines(filePath, lines) {
340
- const fh = await open(filePath, "w");
341
- try {
342
- await fh.writeFile(lines.join(`
343
- `), { encoding: "utf8" });
344
- await fh.datasync();
345
- } finally {
346
- await fh.close();
347
- }
348
- }
349
- async function findClaudeAlias(options) {
350
- const configs = getShellConfigPaths(options);
351
- for (const configPath of Object.values(configs)) {
352
- const lines = await readFileLines(configPath);
353
- if (!lines)
354
- continue;
355
- for (const line of lines) {
356
- if (CLAUDE_ALIAS_REGEX.test(line)) {
357
- const match = line.match(/alias\s+claude=["']?([^"'\s]+)/);
358
- if (match && match[1]) {
359
- return match[1];
360
- }
361
- }
362
- }
363
- }
364
- return null;
365
- }
366
- async function findValidClaudeAlias(options) {
367
- const aliasTarget = await findClaudeAlias(options);
368
- if (!aliasTarget)
369
- return null;
370
- const home = options?.homedir ?? osHomedir();
371
- const expandedPath = aliasTarget.startsWith("~") ? aliasTarget.replace("~", home) : aliasTarget;
372
- try {
373
- const stats = await stat(expandedPath);
374
- if (stats.isFile() || stats.isSymbolicLink()) {
375
- return aliasTarget;
376
- }
377
- } catch {}
378
- return null;
379
- }
380
- var CLAUDE_ALIAS_REGEX;
381
- var init_shellConfig = __esm(() => {
382
- init_errors();
383
- init_localInstaller();
384
- CLAUDE_ALIAS_REGEX = /^\s*alias\s+claude\s*=/;
385
- });
386
-
387
- // src/utils/doctorDiagnostic.ts
388
- import { readFile as readFile3, realpath } from "fs/promises";
389
- import { homedir } from "os";
390
- import { delimiter, join as join3, posix, win32 } from "path";
391
- function getNormalizedPaths() {
392
- let invokedPath = process.argv[1] || "";
393
- let execPath = process.execPath || process.argv[0] || "";
394
- if (getPlatform() === "windows") {
395
- invokedPath = invokedPath.split(win32.sep).join(posix.sep);
396
- execPath = execPath.split(win32.sep).join(posix.sep);
397
- }
398
- return [invokedPath, execPath];
399
- }
400
- async function getCurrentInstallationType() {
401
- if (true) {
402
- return "development";
403
- }
404
- const [invokedPath] = getNormalizedPaths();
405
- if (isInBundledMode()) {
406
- if (detectHomebrew() || detectWinget() || detectMise() || detectAsdf() || await detectPacman() || await detectDeb() || await detectRpm() || await detectApk()) {
407
- return "package-manager";
408
- }
409
- return "native";
410
- }
411
- if (isRunningFromLocalInstallation()) {
412
- return "npm-local";
413
- }
414
- const npmGlobalPaths = [
415
- "/usr/local/lib/node_modules",
416
- "/usr/lib/node_modules",
417
- "/opt/homebrew/lib/node_modules",
418
- "/opt/homebrew/bin",
419
- "/usr/local/bin",
420
- "/.nvm/versions/node/"
421
- ];
422
- if (npmGlobalPaths.some((path) => invokedPath.includes(path))) {
423
- return "npm-global";
424
- }
425
- if (invokedPath.includes("/npm/") || invokedPath.includes("/nvm/")) {
426
- return "npm-global";
427
- }
428
- const npmConfigResult = await execa("npm config get prefix", {
429
- shell: true,
430
- reject: false
431
- });
432
- const globalPrefix = npmConfigResult.exitCode === 0 ? npmConfigResult.stdout.trim() : null;
433
- if (globalPrefix && invokedPath.startsWith(globalPrefix)) {
434
- return "npm-global";
435
- }
436
- return "unknown";
437
- }
438
- async function getInstallationPath() {
439
- if (true) {
440
- return getCwd();
441
- }
442
- if (isInBundledMode()) {
443
- try {
444
- return await realpath(process.execPath);
445
- } catch {}
446
- try {
447
- const path = await which("claude");
448
- if (path) {
449
- return path;
450
- }
451
- } catch {}
452
- try {
453
- await getFsImplementation().stat(join3(homedir(), ".local/bin/claude"));
454
- return join3(homedir(), ".local/bin/claude");
455
- } catch {}
456
- return "native";
457
- }
458
- try {
459
- return process.argv[0] || "unknown";
460
- } catch {
461
- return "unknown";
462
- }
463
- }
464
- function getInvokedBinary() {
465
- try {
466
- if (isInBundledMode()) {
467
- return process.execPath || "unknown";
468
- }
469
- return process.argv[1] || "unknown";
470
- } catch {
471
- return "unknown";
472
- }
473
- }
474
- async function detectMultipleInstallations() {
475
- const fs = getFsImplementation();
476
- const installations = [];
477
- const localPath = join3(homedir(), ".claude", "local");
478
- if (await localInstallationExists()) {
479
- installations.push({ type: "npm-local", path: localPath });
480
- }
481
- const packagesToCheck = ["@anthropic-ai/claude-code"];
482
- if ("") {}
483
- const npmResult = await execFileNoThrow("npm", [
484
- "-g",
485
- "config",
486
- "get",
487
- "prefix"
488
- ]);
489
- if (npmResult.code === 0 && npmResult.stdout) {
490
- const npmPrefix = npmResult.stdout.trim();
491
- const isWindows = getPlatform() === "windows";
492
- const globalBinPath = isWindows ? join3(npmPrefix, "claude") : join3(npmPrefix, "bin", "claude");
493
- let globalBinExists = false;
494
- try {
495
- await fs.stat(globalBinPath);
496
- globalBinExists = true;
497
- } catch {}
498
- if (globalBinExists) {
499
- let isCurrentHomebrewInstallation = false;
500
- try {
501
- const realPath = await realpath(globalBinPath);
502
- if (realPath.includes("/Caskroom/")) {
503
- isCurrentHomebrewInstallation = detectHomebrew();
504
- }
505
- } catch {}
506
- if (!isCurrentHomebrewInstallation) {
507
- installations.push({ type: "npm-global", path: globalBinPath });
508
- }
509
- } else {
510
- for (const packageName of packagesToCheck) {
511
- const globalPackagePath = isWindows ? join3(npmPrefix, "node_modules", packageName) : join3(npmPrefix, "lib", "node_modules", packageName);
512
- try {
513
- await fs.stat(globalPackagePath);
514
- installations.push({
515
- type: "npm-global-orphan",
516
- path: globalPackagePath
517
- });
518
- } catch {}
519
- }
520
- }
521
- }
522
- const nativeBinPath = join3(homedir(), ".local", "bin", "claude");
523
- try {
524
- await fs.stat(nativeBinPath);
525
- installations.push({ type: "native", path: nativeBinPath });
526
- } catch {}
527
- const config = getGlobalConfig();
528
- if (config.installMethod === "native") {
529
- const nativeDataPath = join3(homedir(), ".local", "share", "claude");
530
- try {
531
- await fs.stat(nativeDataPath);
532
- if (!installations.some((i) => i.type === "native")) {
533
- installations.push({ type: "native", path: nativeDataPath });
534
- }
535
- } catch {}
536
- }
537
- return installations;
538
- }
539
- async function detectConfigurationIssues(type) {
540
- const warnings = [];
541
- try {
542
- const raw = await readFile3(join3(getManagedFilePath(), "managed-settings.json"), "utf-8");
543
- const parsed = jsonParse(raw);
544
- const field = parsed && typeof parsed === "object" ? parsed.strictPluginOnlyCustomization : undefined;
545
- if (field !== undefined && typeof field !== "boolean") {
546
- if (!Array.isArray(field)) {
547
- warnings.push({
548
- issue: `managed-settings.json: strictPluginOnlyCustomization has an invalid value (expected true or an array, got ${typeof field})`,
549
- fix: `The field is silently ignored (schema .catch rescues it). Set it to true, or an array of: ${CUSTOMIZATION_SURFACES.join(", ")}.`
550
- });
551
- } else {
552
- const unknown = field.filter((x) => typeof x === "string" && !CUSTOMIZATION_SURFACES.includes(x));
553
- if (unknown.length > 0) {
554
- warnings.push({
555
- issue: `managed-settings.json: strictPluginOnlyCustomization has ${unknown.length} value(s) this client doesn't recognize: ${unknown.map(String).join(", ")}`,
556
- fix: `These are silently ignored (forwards-compat). Known surfaces for this version: ${CUSTOMIZATION_SURFACES.join(", ")}. Either remove them, or this client is older than the managed-settings intended.`
557
- });
558
- }
559
- }
560
- }
561
- } catch {}
562
- const config = getGlobalConfig();
563
- if (type === "development") {
564
- return warnings;
565
- }
566
- if (type === "native") {
567
- const path = process.env.PATH || "";
568
- const pathDirectories = path.split(delimiter);
569
- const homeDir = homedir();
570
- const localBinPath = join3(homeDir, ".local", "bin");
571
- let normalizedLocalBinPath = localBinPath;
572
- if (getPlatform() === "windows") {
573
- normalizedLocalBinPath = localBinPath.split(win32.sep).join(posix.sep);
574
- }
575
- const localBinInPath = pathDirectories.some((dir) => {
576
- let normalizedDir = dir;
577
- if (getPlatform() === "windows") {
578
- normalizedDir = dir.split(win32.sep).join(posix.sep);
579
- }
580
- const trimmedDir = normalizedDir.replace(/\/+$/, "");
581
- const trimmedRawDir = dir.replace(/[/\\]+$/, "");
582
- return trimmedDir === normalizedLocalBinPath || trimmedRawDir === "~/.local/bin" || trimmedRawDir === "$HOME/.local/bin";
583
- });
584
- if (!localBinInPath) {
585
- const isWindows = getPlatform() === "windows";
586
- if (isWindows) {
587
- const windowsLocalBinPath = localBinPath.split(posix.sep).join(win32.sep);
588
- warnings.push({
589
- issue: `Native installation exists but ${windowsLocalBinPath} is not in your PATH`,
590
- fix: `Add it by opening: System Properties \u2192 Environment Variables \u2192 Edit User PATH \u2192 New \u2192 Add the path above. Then restart your terminal.`
591
- });
592
- } else {
593
- const shellType = getShellType();
594
- const configPaths = getShellConfigPaths();
595
- const configFile = configPaths[shellType];
596
- const displayPath = configFile ? configFile.replace(homedir(), "~") : "your shell config file";
597
- warnings.push({
598
- issue: "Native installation exists but ~/.local/bin is not in your PATH",
599
- fix: `Run: echo 'export PATH="$HOME/.local/bin:$PATH"' >> ${displayPath} then open a new terminal or run: source ${displayPath}`
600
- });
601
- }
602
- }
603
- }
604
- if (!isEnvTruthy(process.env.DISABLE_INSTALLATION_CHECKS)) {
605
- if (type === "npm-local" && config.installMethod !== "local") {
606
- warnings.push({
607
- issue: `Running from local installation but config install method is '${config.installMethod}'`,
608
- fix: "Consider using native installation: claude install"
609
- });
610
- }
611
- if (type === "native" && config.installMethod !== "native") {
612
- warnings.push({
613
- issue: `Running native installation but config install method is '${config.installMethod}'`,
614
- fix: "Run claude install to update configuration"
615
- });
616
- }
617
- }
618
- if (type === "npm-global" && await localInstallationExists()) {
619
- warnings.push({
620
- issue: "Local installation exists but not being used",
621
- fix: "Consider using native installation: claude install"
622
- });
623
- }
624
- const existingAlias = await findClaudeAlias();
625
- const validAlias = await findValidClaudeAlias();
626
- if (type === "npm-local") {
627
- const whichResult = await which("claude");
628
- const claudeInPath = !!whichResult;
629
- if (!claudeInPath && !validAlias) {
630
- if (existingAlias) {
631
- warnings.push({
632
- issue: "Local installation not accessible",
633
- fix: `Alias exists but points to invalid target: ${existingAlias}. Update alias: alias claude="~/.claude/local/claude"`
634
- });
635
- } else {
636
- warnings.push({
637
- issue: "Local installation not accessible",
638
- fix: 'Create alias: alias claude="~/.claude/local/claude"'
639
- });
640
- }
641
- }
642
- }
643
- return warnings;
644
- }
645
- function detectLinuxGlobPatternWarnings() {
646
- if (getPlatform() !== "linux") {
647
- return [];
648
- }
649
- const warnings = [];
650
- const globPatterns = SandboxManager.getLinuxGlobPatternWarnings();
651
- if (globPatterns.length > 0) {
652
- const displayPatterns = globPatterns.slice(0, 3).join(", ");
653
- const remaining = globPatterns.length - 3;
654
- const patternList = remaining > 0 ? `${displayPatterns} (${remaining} more)` : displayPatterns;
655
- warnings.push({
656
- issue: `Glob patterns in sandbox permission rules are not fully supported on Linux`,
657
- fix: `Found ${globPatterns.length} pattern(s): ${patternList}. On Linux, glob patterns in Edit/Read rules will be ignored.`
658
- });
659
- }
660
- return warnings;
661
- }
662
- async function getDoctorDiagnostic() {
663
- const installationType = await getCurrentInstallationType();
664
- const version = typeof MACRO !== "undefined" ? "0.0.24" : "unknown";
665
- const installationPath = await getInstallationPath();
666
- const invokedBinary = getInvokedBinary();
667
- const multipleInstallations = await detectMultipleInstallations();
668
- const warnings = await detectConfigurationIssues(installationType);
669
- warnings.push(...detectLinuxGlobPatternWarnings());
670
- if (installationType === "native") {
671
- const npmInstalls = multipleInstallations.filter((i) => i.type === "npm-global" || i.type === "npm-global-orphan" || i.type === "npm-local");
672
- const isWindows = getPlatform() === "windows";
673
- for (const install of npmInstalls) {
674
- if (install.type === "npm-global") {
675
- let uninstallCmd = "npm -g uninstall @anthropic-ai/claude-code";
676
- if ("") {}
677
- warnings.push({
678
- issue: `Leftover npm global installation at ${install.path}`,
679
- fix: `Run: ${uninstallCmd}`
680
- });
681
- } else if (install.type === "npm-global-orphan") {
682
- warnings.push({
683
- issue: `Orphaned npm global package at ${install.path}`,
684
- fix: isWindows ? `Run: rmdir /s /q "${install.path}"` : `Run: rm -rf ${install.path}`
685
- });
686
- } else if (install.type === "npm-local") {
687
- warnings.push({
688
- issue: `Leftover npm local installation at ${install.path}`,
689
- fix: isWindows ? `Run: rmdir /s /q "${install.path}"` : `Run: rm -rf ${install.path}`
690
- });
691
- }
692
- }
693
- }
694
- const config = getGlobalConfig();
695
- const configInstallMethod = config.installMethod || "not set";
696
- let hasUpdatePermissions = null;
697
- if (installationType === "npm-global") {
698
- const permCheck = await checkGlobalInstallPermissions();
699
- hasUpdatePermissions = permCheck.hasPermissions;
700
- if (!hasUpdatePermissions && !getAutoUpdaterDisabledReason()) {
701
- warnings.push({
702
- issue: "Insufficient permissions for auto-updates",
703
- fix: "Do one of: (1) Re-install node without sudo, or (2) Use `claude install` for native installation"
704
- });
705
- }
706
- }
707
- const ripgrepStatusRaw = getRipgrepStatus();
708
- const ripgrepStatus = {
709
- working: ripgrepStatusRaw.working ?? true,
710
- mode: ripgrepStatusRaw.mode,
711
- systemPath: ripgrepStatusRaw.mode === "system" ? ripgrepStatusRaw.path : null
712
- };
713
- const packageManager = installationType === "package-manager" ? await getPackageManager() : undefined;
714
- const diagnostic = {
715
- installationType,
716
- version,
717
- installationPath,
718
- invokedBinary,
719
- configInstallMethod,
720
- autoUpdates: (() => {
721
- const reason = getAutoUpdaterDisabledReason();
722
- return reason ? `disabled (${formatAutoUpdaterDisabledReason(reason)})` : "enabled";
723
- })(),
724
- hasUpdatePermissions,
725
- multipleInstallations,
726
- warnings,
727
- packageManager,
728
- ripgrepStatus
729
- };
730
- return diagnostic;
731
- }
732
- var checkGlobalInstallPermissions = async () => ({ allowed: false, reason: "autoUpdater removed" });
733
- var init_doctorDiagnostic = __esm(() => {
734
- init_execa();
735
- init_bundledMode();
736
- init_config();
737
- init_cwd();
738
- init_envUtils();
739
- init_execFileNoThrow();
740
- init_fsOperations();
741
- init_localInstaller();
742
- init_packageManagers();
743
- init_platform();
744
- init_ripgrep();
745
- init_sandbox_adapter();
746
- init_managedPath();
747
- init_types();
748
- init_shellConfig();
749
- init_slowOperations();
750
- init_which();
751
- });
752
-
753
- // src/utils/nativeInstaller/pidLock.ts
754
- import { basename, join as join4 } from "path";
755
- function isPidBasedLockingEnabled() {
756
- const envVar = process.env.ENABLE_PID_BASED_VERSION_LOCKING;
757
- if (isEnvTruthy(envVar)) {
758
- return true;
759
- }
760
- if (isEnvDefinedFalsy(envVar)) {
761
- return false;
762
- }
763
- return getFeatureValue_CACHED_MAY_BE_STALE("tengu_pid_based_version_locking", false);
764
- }
765
- function isProcessRunning(pid) {
766
- if (pid <= 1) {
767
- return false;
768
- }
769
- try {
770
- process.kill(pid, 0);
771
- return true;
772
- } catch {
773
- return false;
774
- }
775
- }
776
- function isClaudeProcess(pid, expectedExecPath) {
777
- if (!isProcessRunning(pid)) {
778
- return false;
779
- }
780
- if (pid === process.pid) {
781
- return true;
782
- }
783
- try {
784
- const command = getProcessCommand(pid);
785
- if (!command) {
786
- return true;
787
- }
788
- const normalizedCommand = command.toLowerCase();
789
- const normalizedExecPath = expectedExecPath.toLowerCase();
790
- return normalizedCommand.includes("claude") || normalizedCommand.includes(normalizedExecPath);
791
- } catch {
792
- return true;
793
- }
794
- }
795
- function readLockContent(lockFilePath) {
796
- const fs = getFsImplementation();
797
- try {
798
- const content = fs.readFileSync(lockFilePath, { encoding: "utf8" });
799
- if (!content || content.trim() === "") {
800
- return null;
801
- }
802
- const parsed = jsonParse(content);
803
- if (typeof parsed.pid !== "number" || !parsed.version || !parsed.execPath) {
804
- return null;
805
- }
806
- return parsed;
807
- } catch {
808
- return null;
809
- }
810
- }
811
- function isLockActive(lockFilePath) {
812
- const content = readLockContent(lockFilePath);
813
- if (!content) {
814
- return false;
815
- }
816
- const { pid, execPath } = content;
817
- if (!isProcessRunning(pid)) {
818
- return false;
819
- }
820
- if (!isClaudeProcess(pid, execPath)) {
821
- logForDebugging(`Lock PID ${pid} is running but does not appear to be Claude - treating as stale`);
822
- return false;
823
- }
824
- const fs = getFsImplementation();
825
- try {
826
- const stats = fs.statSync(lockFilePath);
827
- const age = Date.now() - stats.mtimeMs;
828
- if (age > FALLBACK_STALE_MS) {
829
- if (!isProcessRunning(pid)) {
830
- return false;
831
- }
832
- }
833
- } catch {}
834
- return true;
835
- }
836
- function writeLockFile(lockFilePath, content) {
837
- const fs = getFsImplementation();
838
- const tempPath = `${lockFilePath}.tmp.${process.pid}.${Date.now()}`;
839
- try {
840
- writeFileSync_DEPRECATED(tempPath, jsonStringify(content, null, 2), {
841
- encoding: "utf8",
842
- flush: true
843
- });
844
- fs.renameSync(tempPath, lockFilePath);
845
- } catch (error) {
846
- try {
847
- fs.unlinkSync(tempPath);
848
- } catch {}
849
- throw error;
850
- }
851
- }
852
- async function tryAcquireLock(versionPath, lockFilePath) {
853
- const fs = getFsImplementation();
854
- const versionName = basename(versionPath);
855
- if (isLockActive(lockFilePath)) {
856
- const existingContent = readLockContent(lockFilePath);
857
- logForDebugging(`Cannot acquire lock for ${versionName} - held by PID ${existingContent?.pid}`);
858
- return null;
859
- }
860
- const lockContent = {
861
- pid: process.pid,
862
- version: versionName,
863
- execPath: process.execPath,
864
- acquiredAt: Date.now()
865
- };
866
- try {
867
- writeLockFile(lockFilePath, lockContent);
868
- const verifyContent = readLockContent(lockFilePath);
869
- if (verifyContent?.pid !== process.pid) {
870
- return null;
871
- }
872
- logForDebugging(`Acquired PID lock for ${versionName} (PID ${process.pid})`);
873
- return () => {
874
- try {
875
- const currentContent = readLockContent(lockFilePath);
876
- if (currentContent?.pid === process.pid) {
877
- fs.unlinkSync(lockFilePath);
878
- logForDebugging(`Released PID lock for ${versionName}`);
879
- }
880
- } catch (error) {
881
- logForDebugging(`Failed to release lock for ${versionName}: ${error}`);
882
- }
883
- };
884
- } catch (error) {
885
- logForDebugging(`Failed to acquire lock for ${versionName}: ${error}`);
886
- return null;
887
- }
888
- }
889
- async function acquireProcessLifetimeLock(versionPath, lockFilePath) {
890
- const release = await tryAcquireLock(versionPath, lockFilePath);
891
- if (!release) {
892
- return false;
893
- }
894
- const cleanup = () => {
895
- try {
896
- release();
897
- } catch {}
898
- };
899
- process.on("exit", cleanup);
900
- process.on("SIGINT", cleanup);
901
- process.on("SIGTERM", cleanup);
902
- return true;
903
- }
904
- async function withLock(versionPath, lockFilePath, callback) {
905
- const release = await tryAcquireLock(versionPath, lockFilePath);
906
- if (!release) {
907
- return false;
908
- }
909
- try {
910
- await callback();
911
- return true;
912
- } finally {
913
- release();
914
- }
915
- }
916
- function getAllLockInfo(locksDir) {
917
- const fs = getFsImplementation();
918
- const lockInfos = [];
919
- try {
920
- const lockFiles = fs.readdirStringSync(locksDir).filter((f) => f.endsWith(".lock"));
921
- for (const lockFile of lockFiles) {
922
- const lockFilePath = join4(locksDir, lockFile);
923
- const content = readLockContent(lockFilePath);
924
- if (content) {
925
- lockInfos.push({
926
- version: content.version,
927
- pid: content.pid,
928
- isProcessRunning: isProcessRunning(content.pid),
929
- execPath: content.execPath,
930
- acquiredAt: new Date(content.acquiredAt),
931
- lockFilePath
932
- });
933
- }
934
- }
935
- } catch (error) {
936
- if (isENOENT(error)) {
937
- return lockInfos;
938
- }
939
- logError(toError(error));
940
- }
941
- return lockInfos;
942
- }
943
- function cleanupStaleLocks(locksDir) {
944
- const fs = getFsImplementation();
945
- let cleanedCount = 0;
946
- try {
947
- const lockEntries = fs.readdirStringSync(locksDir).filter((f) => f.endsWith(".lock"));
948
- for (const lockEntry of lockEntries) {
949
- const lockFilePath = join4(locksDir, lockEntry);
950
- try {
951
- const stats = fs.lstatSync(lockFilePath);
952
- if (stats.isDirectory()) {
953
- fs.rmSync(lockFilePath, { recursive: true, force: true });
954
- cleanedCount++;
955
- logForDebugging(`Cleaned up legacy directory lock: ${lockEntry}`);
956
- } else if (!isLockActive(lockFilePath)) {
957
- fs.unlinkSync(lockFilePath);
958
- cleanedCount++;
959
- logForDebugging(`Cleaned up stale lock: ${lockEntry}`);
960
- }
961
- } catch {}
962
- }
963
- } catch (error) {
964
- if (isENOENT(error)) {
965
- return 0;
966
- }
967
- logError(toError(error));
968
- }
969
- return cleanedCount;
970
- }
971
- var FALLBACK_STALE_MS;
972
- var init_pidLock = __esm(() => {
973
- init_growthbook();
974
- init_debug();
975
- init_envUtils();
976
- init_errors();
977
- init_fsOperations();
978
- init_genericProcessUtils();
979
- init_log();
980
- init_slowOperations();
981
- FALLBACK_STALE_MS = 2 * 60 * 60 * 1000;
982
- });
983
-
984
- export { getShellType, init_localInstaller, getShellConfigPaths, filterClaudeAliases, readFileLines, writeFileLines, init_shellConfig, getCurrentInstallationType, getDoctorDiagnostic, init_doctorDiagnostic, isPidBasedLockingEnabled, readLockContent, isLockActive, acquireProcessLifetimeLock, withLock, getAllLockInfo, cleanupStaleLocks, init_pidLock };