@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,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-e0ragz46.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-2b0e32an.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.25" : "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 };