@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,697 +0,0 @@
1
- // @bun
2
- import {
3
- initSinks
4
- } from "./chunk-shkycj1q.js";
5
- import {
6
- getRecentActivity,
7
- init_logoV2Utils
8
- } from "./chunk-a8jd4gee.js";
9
- import {
10
- checkForReleaseNotes,
11
- init_releaseNotes
12
- } from "./chunk-13ehyphg.js";
13
- import {
14
- init_nativeInstaller,
15
- lockCurrentVersion
16
- } from "./chunk-jz71gv95.js";
17
- import"./chunk-ta3jyvxs.js";
18
- import"./chunk-x7fdwq3d.js";
19
- import"./chunk-66zry909.js";
20
- import {
21
- DEFAULT_SESSION_MEMORY_CONFIG,
22
- FILE_EDIT_TOOL_NAME,
23
- FileReadTool,
24
- asSessionId,
25
- buildSessionMemoryUpdatePrompt,
26
- captureHooksConfigSnapshot,
27
- clearMemoryFileCaches,
28
- createCacheSafeParams,
29
- createSubagentContext,
30
- createTmuxSessionForWorktree,
31
- createUserMessage,
32
- createWorktreeForSession,
33
- envDynamic,
34
- generateTmuxSessionName,
35
- getCommands,
36
- getPlanSlug,
37
- getSessionMemoryConfig,
38
- getSessionMemoryDir,
39
- getSessionMemoryPath,
40
- getTokenUsage,
41
- getToolCallsBetweenUpdates,
42
- hasMetInitializationThreshold,
43
- hasMetUpdateThreshold,
44
- hasToolCallsInLastAssistantTurn,
45
- hasWorktreeCreateHook,
46
- init_FileReadTool,
47
- init_Shell,
48
- init_agentSwarmsEnabled,
49
- init_autoCompact,
50
- init_claudemd,
51
- init_commands1 as init_commands,
52
- init_constants,
53
- init_context,
54
- init_envDynamic,
55
- init_fileChangedWatcher,
56
- init_filesystem,
57
- init_forkedAgent,
58
- init_hooks1 as init_hooks,
59
- init_hooksConfigSnapshot,
60
- init_ids,
61
- init_messages1 as init_messages,
62
- init_plans,
63
- init_postSamplingHooks,
64
- init_prompts,
65
- init_prompts1 as init_prompts2,
66
- init_sessionMemoryUtils,
67
- init_sessionStorage,
68
- init_systemPromptType,
69
- init_tokens,
70
- init_worktree,
71
- initializeFileChangedWatcher,
72
- isAgentSwarmsEnabled,
73
- isAutoCompactEnabled,
74
- isSessionMemoryInitialized,
75
- loadSessionMemoryTemplate,
76
- markExtractionCompleted,
77
- markExtractionStarted,
78
- markSessionMemoryInitialized,
79
- recordExtractionTokenCount,
80
- registerPostSamplingHook,
81
- runForkedAgent,
82
- saveWorktreeState,
83
- setCwd,
84
- setLastSummarizedMessageId,
85
- setSessionMemoryConfig,
86
- tokenCountWithEstimation,
87
- updateHooksConfigSnapshot,
88
- worktreeBranchName
89
- } from "./chunk-gnpt1t6q.js";
90
- import"./chunk-mcws22k3.js";
91
- import"./chunk-jzthz1bx.js";
92
- import"./chunk-f6h5weh6.js";
93
- import"./chunk-hwfknpxv.js";
94
- import"./chunk-1gx78081.js";
95
- import"./chunk-ehtwnxpg.js";
96
- import"./chunk-e68kgvcq.js";
97
- import {
98
- init_sequential,
99
- sequential
100
- } from "./chunk-p97fd5af.js";
101
- import"./chunk-x47h283a.js";
102
- import"./chunk-wb18cecv.js";
103
- import"./chunk-2gzv8nrw.js";
104
- import"./chunk-e0abab5b.js";
105
- import"./chunk-cgfdkzhb.js";
106
- import"./chunk-4k9d7gxv.js";
107
- import"./chunk-j5bth84e.js";
108
- import {
109
- checkAndRestoreTerminalBackup,
110
- init_appleTerminalBackup
111
- } from "./chunk-t2ecddwj.js";
112
- import"./chunk-68ffk5qa.js";
113
- import"./chunk-ps49ymvj.js";
114
- import"./chunk-dkgkd8b7.js";
115
- import"./chunk-5pysjah8.js";
116
- import"./chunk-pgtnj1mt.js";
117
- import"./chunk-hph1bmqw.js";
118
- import"./chunk-p7vkh4wx.js";
119
- import"./chunk-y9bhjjdz.js";
120
- import"./chunk-dcwp94cj.js";
121
- import"./chunk-tkx5eec8.js";
122
- import"./chunk-dfzkwynj.js";
123
- import"./chunk-xeb6075z.js";
124
- import"./chunk-fcynwjpm.js";
125
- import"./chunk-v4t6dyyh.js";
126
- import"./chunk-zy5vn8sd.js";
127
- import"./chunk-v8kjswxt.js";
128
- import {
129
- getCurrentProjectConfig,
130
- getDynamicConfig_CACHED_MAY_BE_STALE,
131
- getFeatureValue_CACHED_MAY_BE_STALE,
132
- getGlobalConfig,
133
- init_auth,
134
- init_config,
135
- init_growthbook,
136
- prefetchApiKeyFromApiKeyHelperIfSafe,
137
- saveGlobalConfig
138
- } from "./chunk-dfq6pbq7.js";
139
- import"./chunk-rnxctq9p.js";
140
- import"./chunk-pqqxdk5f.js";
141
- import {
142
- count,
143
- init_array
144
- } from "./chunk-6nsd9606.js";
145
- import"./chunk-64c1avct.js";
146
- import"./chunk-8g5pe1gr.js";
147
- import"./chunk-4pbx3g7s.js";
148
- import"./chunk-26wtxbdc.js";
149
- import"./chunk-6dngjwkh.js";
150
- import"./chunk-4jm600zv.js";
151
- import"./chunk-s8gy4ky9.js";
152
- import"./chunk-cxrktb5g.js";
153
- import"./chunk-3c25bcsw.js";
154
- import {
155
- env,
156
- init_env
157
- } from "./chunk-5ekyhb1w.js";
158
- import {
159
- init_startupProfiler,
160
- profileCheckpoint
161
- } from "./chunk-fqak69ft.js";
162
- import"./chunk-cdz5yb0r.js";
163
- import {
164
- init_source,
165
- source_default
166
- } from "./chunk-c7jwbe76.js";
167
- import"./chunk-0vkfrmqm.js";
168
- import"./chunk-7sgtxrsc.js";
169
- import"./chunk-0xjaqda8.js";
170
- import {
171
- init_analytics,
172
- logEvent
173
- } from "./chunk-x8d2ehd7.js";
174
- import"./chunk-byfawrfx.js";
175
- import {
176
- findCanonicalGitRoot,
177
- findGitRoot,
178
- getIsGit,
179
- init_diagLogs,
180
- init_git,
181
- logForDiagnosticsNoPII
182
- } from "./chunk-3vy1jt9p.js";
183
- import"./chunk-vkhrrvfq.js";
184
- import"./chunk-qnfx3qtx.js";
185
- import"./chunk-64r16v22.js";
186
- import {
187
- getCwd,
188
- init_cwd
189
- } from "./chunk-s8kj6ajy.js";
190
- import"./chunk-8yhf030a.js";
191
- import"./chunk-zxh62ved.js";
192
- import"./chunk-5z28bqne.js";
193
- import"./chunk-qajrkk97.js";
194
- import {
195
- errorMessage,
196
- getErrnoCode,
197
- getFsImplementation,
198
- init_errors,
199
- init_fsOperations,
200
- init_log,
201
- logError
202
- } from "./chunk-gg55fns0.js";
203
- import {
204
- init_envUtils,
205
- isBareMode,
206
- isEnvTruthy
207
- } from "./chunk-5n1jc02d.js";
208
- import"./chunk-fbv4apne.js";
209
- import {
210
- getIsNonInteractiveSession,
211
- getIsRemoteMode,
212
- getProjectRoot,
213
- getSessionId,
214
- init_state,
215
- setOriginalCwd,
216
- setProjectRoot,
217
- switchSession
218
- } from "./chunk-k8vp0atq.js";
219
- import {
220
- init_memoize,
221
- memoize_default
222
- } from "./chunk-vf612n57.js";
223
- import"./chunk-07069jq1.js";
224
- import"./chunk-d4mdda98.js";
225
- import"./chunk-55raexh7.js";
226
- import"./chunk-v9smspw2.js";
227
- import"./chunk-v1kzp02e.js";
228
- import"./chunk-7wm5s02e.js";
229
- import"./chunk-b0kf00ff.js";
230
- import"./chunk-netzwgv1.js";
231
- import {
232
- __require
233
- } from "./chunk-qp2qdcda.js";
234
-
235
- // src/setup.ts
236
- init_source();
237
- init_analytics();
238
- init_cwd();
239
- init_releaseNotes();
240
- init_Shell();
241
- init_state();
242
- init_commands();
243
-
244
- // src/services/SessionMemory/sessionMemory.ts
245
- init_memoize();
246
- init_state();
247
- init_prompts2();
248
- init_context();
249
- init_constants();
250
- init_FileReadTool();
251
- init_array();
252
- init_forkedAgent();
253
- init_fsOperations();
254
- init_postSamplingHooks();
255
- init_messages();
256
- init_filesystem();
257
- init_sequential();
258
- init_systemPromptType();
259
- init_tokens();
260
- init_analytics();
261
- init_autoCompact();
262
- init_prompts();
263
- init_sessionMemoryUtils();
264
- init_errors();
265
- init_growthbook();
266
- import { writeFile } from "fs/promises";
267
- function isSessionMemoryGateEnabled() {
268
- return getFeatureValue_CACHED_MAY_BE_STALE("tengu_session_memory", false);
269
- }
270
- function getSessionMemoryRemoteConfig() {
271
- return getDynamicConfig_CACHED_MAY_BE_STALE("tengu_sm_config", {});
272
- }
273
- var lastMemoryMessageUuid;
274
- function countToolCallsSince(messages, sinceUuid) {
275
- let toolCallCount = 0;
276
- let foundStart = sinceUuid === null || sinceUuid === undefined;
277
- for (const message of messages) {
278
- if (!foundStart) {
279
- if (message.uuid === sinceUuid) {
280
- foundStart = true;
281
- }
282
- continue;
283
- }
284
- if (message.type === "assistant") {
285
- const content = message.message.content;
286
- if (Array.isArray(content)) {
287
- toolCallCount += count(content, (block) => block.type === "tool_use");
288
- }
289
- }
290
- }
291
- return toolCallCount;
292
- }
293
- function shouldExtractMemory(messages) {
294
- const currentTokenCount = tokenCountWithEstimation(messages);
295
- if (!isSessionMemoryInitialized()) {
296
- if (!hasMetInitializationThreshold(currentTokenCount)) {
297
- return false;
298
- }
299
- markSessionMemoryInitialized();
300
- }
301
- const hasMetTokenThreshold = hasMetUpdateThreshold(currentTokenCount);
302
- const toolCallsSinceLastUpdate = countToolCallsSince(messages, lastMemoryMessageUuid);
303
- const hasMetToolCallThreshold = toolCallsSinceLastUpdate >= getToolCallsBetweenUpdates();
304
- const hasToolCallsInLastTurn = hasToolCallsInLastAssistantTurn(messages);
305
- const shouldExtract = hasMetTokenThreshold && hasMetToolCallThreshold || hasMetTokenThreshold && !hasToolCallsInLastTurn;
306
- if (shouldExtract) {
307
- const lastMessage = messages[messages.length - 1];
308
- if (lastMessage?.uuid) {
309
- lastMemoryMessageUuid = lastMessage.uuid;
310
- }
311
- return true;
312
- }
313
- return false;
314
- }
315
- async function setupSessionMemoryFile(toolUseContext) {
316
- const fs = getFsImplementation();
317
- const sessionMemoryDir = getSessionMemoryDir();
318
- await fs.mkdir(sessionMemoryDir, { mode: 448 });
319
- const memoryPath = getSessionMemoryPath();
320
- try {
321
- await writeFile(memoryPath, "", {
322
- encoding: "utf-8",
323
- mode: 384,
324
- flag: "wx"
325
- });
326
- const template = await loadSessionMemoryTemplate();
327
- await writeFile(memoryPath, template, {
328
- encoding: "utf-8",
329
- mode: 384
330
- });
331
- } catch (e) {
332
- const code = getErrnoCode(e);
333
- if (code !== "EEXIST") {
334
- throw e;
335
- }
336
- }
337
- toolUseContext.readFileState.delete(memoryPath);
338
- const result = await FileReadTool.call({ file_path: memoryPath }, toolUseContext);
339
- let currentMemory = "";
340
- const output = result.data;
341
- if (output.type === "text") {
342
- currentMemory = output.file.content;
343
- }
344
- logEvent("tengu_session_memory_file_read", {
345
- content_length: currentMemory.length
346
- });
347
- return { memoryPath, currentMemory };
348
- }
349
- var initSessionMemoryConfigIfNeeded = memoize_default(() => {
350
- const remoteConfig = getSessionMemoryRemoteConfig();
351
- const config = {
352
- minimumMessageTokensToInit: remoteConfig.minimumMessageTokensToInit && remoteConfig.minimumMessageTokensToInit > 0 ? remoteConfig.minimumMessageTokensToInit : DEFAULT_SESSION_MEMORY_CONFIG.minimumMessageTokensToInit,
353
- minimumTokensBetweenUpdate: remoteConfig.minimumTokensBetweenUpdate && remoteConfig.minimumTokensBetweenUpdate > 0 ? remoteConfig.minimumTokensBetweenUpdate : DEFAULT_SESSION_MEMORY_CONFIG.minimumTokensBetweenUpdate,
354
- toolCallsBetweenUpdates: remoteConfig.toolCallsBetweenUpdates && remoteConfig.toolCallsBetweenUpdates > 0 ? remoteConfig.toolCallsBetweenUpdates : DEFAULT_SESSION_MEMORY_CONFIG.toolCallsBetweenUpdates
355
- };
356
- setSessionMemoryConfig(config);
357
- });
358
- var hasLoggedGateFailure = false;
359
- var extractSessionMemory = sequential(async function(context) {
360
- const { messages, toolUseContext, querySource } = context;
361
- if (querySource !== "repl_main_thread") {
362
- return;
363
- }
364
- if (!isSessionMemoryGateEnabled()) {
365
- if (process.env.USER_TYPE === "ant" && !hasLoggedGateFailure) {
366
- hasLoggedGateFailure = true;
367
- logEvent("tengu_session_memory_gate_disabled", {});
368
- }
369
- return;
370
- }
371
- initSessionMemoryConfigIfNeeded();
372
- if (!shouldExtractMemory(messages)) {
373
- return;
374
- }
375
- markExtractionStarted();
376
- const setupContext = createSubagentContext(toolUseContext);
377
- const { memoryPath, currentMemory } = await setupSessionMemoryFile(setupContext);
378
- const userPrompt = await buildSessionMemoryUpdatePrompt(currentMemory, memoryPath);
379
- await runForkedAgent({
380
- promptMessages: [createUserMessage({ content: userPrompt })],
381
- cacheSafeParams: createCacheSafeParams(context),
382
- canUseTool: createMemoryFileCanUseTool(memoryPath),
383
- querySource: "session_memory",
384
- forkLabel: "session_memory",
385
- overrides: { readFileState: setupContext.readFileState }
386
- });
387
- const lastMessage = messages[messages.length - 1];
388
- const usage = lastMessage ? getTokenUsage(lastMessage) : undefined;
389
- const config = getSessionMemoryConfig();
390
- logEvent("tengu_session_memory_extraction", {
391
- input_tokens: usage?.input_tokens,
392
- output_tokens: usage?.output_tokens,
393
- cache_read_input_tokens: usage?.cache_read_input_tokens ?? undefined,
394
- cache_creation_input_tokens: usage?.cache_creation_input_tokens ?? undefined,
395
- config_min_message_tokens_to_init: config.minimumMessageTokensToInit,
396
- config_min_tokens_between_update: config.minimumTokensBetweenUpdate,
397
- config_tool_calls_between_updates: config.toolCallsBetweenUpdates
398
- });
399
- recordExtractionTokenCount(tokenCountWithEstimation(messages));
400
- updateLastSummarizedMessageIdIfSafe(messages);
401
- markExtractionCompleted();
402
- });
403
- function initSessionMemory() {
404
- if (getIsRemoteMode())
405
- return;
406
- const autoCompactEnabled = isAutoCompactEnabled();
407
- if (process.env.USER_TYPE === "ant") {
408
- logEvent("tengu_session_memory_init", {
409
- auto_compact_enabled: autoCompactEnabled
410
- });
411
- }
412
- if (!autoCompactEnabled) {
413
- return;
414
- }
415
- registerPostSamplingHook(extractSessionMemory);
416
- }
417
- function createMemoryFileCanUseTool(memoryPath) {
418
- return async (tool, input) => {
419
- if (tool.name === FILE_EDIT_TOOL_NAME && typeof input === "object" && input !== null && "file_path" in input) {
420
- const filePath = input.file_path;
421
- if (typeof filePath === "string" && filePath === memoryPath) {
422
- return { behavior: "allow", updatedInput: input };
423
- }
424
- }
425
- return {
426
- behavior: "deny",
427
- message: `only ${FILE_EDIT_TOOL_NAME} on ${memoryPath} is allowed`,
428
- decisionReason: {
429
- type: "other",
430
- reason: `only ${FILE_EDIT_TOOL_NAME} on ${memoryPath} is allowed`
431
- }
432
- };
433
- };
434
- }
435
- function updateLastSummarizedMessageIdIfSafe(messages) {
436
- if (!hasToolCallsInLastAssistantTurn(messages)) {
437
- const lastMessage = messages[messages.length - 1];
438
- if (lastMessage?.uuid) {
439
- setLastSummarizedMessageId(lastMessage.uuid);
440
- }
441
- }
442
- }
443
-
444
- // src/setup.ts
445
- init_ids();
446
- init_agentSwarmsEnabled();
447
- init_appleTerminalBackup();
448
- init_auth();
449
- init_claudemd();
450
- init_config();
451
- init_diagLogs();
452
- init_env();
453
- init_envDynamic();
454
- init_envUtils();
455
- init_errors();
456
- init_git();
457
- init_fileChangedWatcher();
458
- init_hooksConfigSnapshot();
459
- init_hooks();
460
-
461
- // src/utils/iTermBackup.ts
462
- init_config();
463
- init_log();
464
- import { copyFile, stat } from "fs/promises";
465
- import { homedir } from "os";
466
- import { join } from "path";
467
- function markITerm2SetupComplete() {
468
- saveGlobalConfig((current) => ({
469
- ...current,
470
- iterm2SetupInProgress: false
471
- }));
472
- }
473
- function getIterm2RecoveryInfo() {
474
- const config = getGlobalConfig();
475
- return {
476
- inProgress: config.iterm2SetupInProgress ?? false,
477
- backupPath: config.iterm2BackupPath || null
478
- };
479
- }
480
- function getITerm2PlistPath() {
481
- return join(homedir(), "Library", "Preferences", "com.googlecode.iterm2.plist");
482
- }
483
- async function checkAndRestoreITerm2Backup() {
484
- const { inProgress, backupPath } = getIterm2RecoveryInfo();
485
- if (!inProgress) {
486
- return { status: "no_backup" };
487
- }
488
- if (!backupPath) {
489
- markITerm2SetupComplete();
490
- return { status: "no_backup" };
491
- }
492
- try {
493
- await stat(backupPath);
494
- } catch {
495
- markITerm2SetupComplete();
496
- return { status: "no_backup" };
497
- }
498
- try {
499
- await copyFile(backupPath, getITerm2PlistPath());
500
- markITerm2SetupComplete();
501
- return { status: "restored" };
502
- } catch (restoreError) {
503
- logError(new Error(`Failed to restore iTerm2 settings with: ${restoreError}`));
504
- markITerm2SetupComplete();
505
- return { status: "failed", backupPath };
506
- }
507
- }
508
-
509
- // src/setup.ts
510
- init_log();
511
- init_logoV2Utils();
512
- init_nativeInstaller();
513
- init_plans();
514
- init_sessionStorage();
515
- init_startupProfiler();
516
- init_worktree();
517
- async function setup(cwd, permissionMode, allowDangerouslySkipPermissions, worktreeEnabled, worktreeName, tmuxEnabled, customSessionId, worktreePRNumber, messagingSocketPath) {
518
- logForDiagnosticsNoPII("info", "setup_started");
519
- const nodeVersion = process.version.match(/^v(\d+)\./)?.[1];
520
- if (!nodeVersion || parseInt(nodeVersion) < 18) {
521
- console.error(source_default.bold.red("Error: Claude Code requires Node.js version 18 or higher."));
522
- process.exit(1);
523
- }
524
- if (customSessionId) {
525
- switchSession(asSessionId(customSessionId));
526
- }
527
- if (!isBareMode() || messagingSocketPath !== undefined) {
528
- if (false) {}
529
- }
530
- if (!isBareMode() && isAgentSwarmsEnabled()) {
531
- const { captureTeammateModeSnapshot } = await import("./chunk-4qhh8bpa.js");
532
- captureTeammateModeSnapshot();
533
- }
534
- if (!getIsNonInteractiveSession()) {
535
- if (isAgentSwarmsEnabled()) {
536
- const restoredIterm2Backup = await checkAndRestoreITerm2Backup();
537
- if (restoredIterm2Backup.status === "restored") {
538
- console.log(source_default.yellow("Detected an interrupted iTerm2 setup. Your original settings have been restored. You may need to restart iTerm2 for the changes to take effect."));
539
- } else if (restoredIterm2Backup.status === "failed") {
540
- console.error(source_default.red(`Failed to restore iTerm2 settings. Please manually restore your original settings with: defaults import com.googlecode.iterm2 ${restoredIterm2Backup.backupPath}.`));
541
- }
542
- }
543
- try {
544
- const restoredTerminalBackup = await checkAndRestoreTerminalBackup();
545
- if (restoredTerminalBackup.status === "restored") {
546
- console.log(source_default.yellow("Detected an interrupted Terminal.app setup. Your original settings have been restored. You may need to restart Terminal.app for the changes to take effect."));
547
- } else if (restoredTerminalBackup.status === "failed") {
548
- console.error(source_default.red(`Failed to restore Terminal.app settings. Please manually restore your original settings with: defaults import com.apple.Terminal ${restoredTerminalBackup.backupPath}.`));
549
- }
550
- } catch (error) {
551
- logError(error);
552
- }
553
- }
554
- setCwd(cwd);
555
- const hooksStart = Date.now();
556
- captureHooksConfigSnapshot();
557
- logForDiagnosticsNoPII("info", "setup_hooks_captured", {
558
- duration_ms: Date.now() - hooksStart
559
- });
560
- initializeFileChangedWatcher(cwd);
561
- if (worktreeEnabled) {
562
- const hasHook = hasWorktreeCreateHook();
563
- const inGit = await getIsGit();
564
- if (!hasHook && !inGit) {
565
- process.stderr.write(source_default.red(`Error: Can only use --worktree in a git repository, but ${source_default.bold(cwd)} is not a git repository. Configure a WorktreeCreate hook in settings.json to use --worktree with other VCS systems.
566
- `));
567
- process.exit(1);
568
- }
569
- const slug = worktreePRNumber ? `pr-${worktreePRNumber}` : worktreeName ?? getPlanSlug();
570
- let tmuxSessionName;
571
- if (inGit) {
572
- const mainRepoRoot = findCanonicalGitRoot(getCwd());
573
- if (!mainRepoRoot) {
574
- process.stderr.write(source_default.red(`Error: Could not determine the main git repository root.
575
- `));
576
- process.exit(1);
577
- }
578
- if (mainRepoRoot !== (findGitRoot(getCwd()) ?? getCwd())) {
579
- logForDiagnosticsNoPII("info", "worktree_resolved_to_main_repo");
580
- process.chdir(mainRepoRoot);
581
- setCwd(mainRepoRoot);
582
- }
583
- tmuxSessionName = tmuxEnabled ? generateTmuxSessionName(mainRepoRoot, worktreeBranchName(slug)) : undefined;
584
- } else {
585
- tmuxSessionName = tmuxEnabled ? generateTmuxSessionName(getCwd(), worktreeBranchName(slug)) : undefined;
586
- }
587
- let worktreeSession;
588
- try {
589
- worktreeSession = await createWorktreeForSession(getSessionId(), slug, tmuxSessionName, worktreePRNumber ? { prNumber: worktreePRNumber } : undefined);
590
- } catch (error) {
591
- process.stderr.write(source_default.red(`Error creating worktree: ${errorMessage(error)}
592
- `));
593
- process.exit(1);
594
- }
595
- logEvent("tengu_worktree_created", { tmux_enabled: tmuxEnabled });
596
- if (tmuxEnabled && tmuxSessionName) {
597
- const tmuxResult = await createTmuxSessionForWorktree(tmuxSessionName, worktreeSession.worktreePath);
598
- if (tmuxResult.created) {
599
- console.log(source_default.green(`Created tmux session: ${source_default.bold(tmuxSessionName)}
600
- To attach: ${source_default.bold(`tmux attach -t ${tmuxSessionName}`)}`));
601
- } else {
602
- console.error(source_default.yellow(`Warning: Failed to create tmux session: ${tmuxResult.error}`));
603
- }
604
- }
605
- process.chdir(worktreeSession.worktreePath);
606
- setCwd(worktreeSession.worktreePath);
607
- setOriginalCwd(getCwd());
608
- setProjectRoot(getCwd());
609
- saveWorktreeState(worktreeSession);
610
- clearMemoryFileCaches();
611
- updateHooksConfigSnapshot();
612
- }
613
- logForDiagnosticsNoPII("info", "setup_background_jobs_starting");
614
- if (!isBareMode()) {
615
- initSessionMemory();
616
- if (false) {}
617
- }
618
- lockCurrentVersion();
619
- logForDiagnosticsNoPII("info", "setup_background_jobs_launched");
620
- profileCheckpoint("setup_before_prefetch");
621
- logForDiagnosticsNoPII("info", "setup_prefetch_starting");
622
- const skipPluginPrefetch = getIsNonInteractiveSession() && isEnvTruthy(process.env.CLAUDE_CODE_SYNC_PLUGIN_INSTALL) || isBareMode();
623
- if (!skipPluginPrefetch) {
624
- getCommands(getProjectRoot());
625
- }
626
- import("./chunk-w0kxcv73.js").then((m) => {
627
- if (!skipPluginPrefetch) {
628
- m.loadPluginHooks();
629
- m.setupPluginHookHotReload();
630
- }
631
- });
632
- if (!isBareMode()) {
633
- if (process.env.USER_TYPE === "ant") {
634
- import("./chunk-jpdbfwvq.js").then(async (m) => {
635
- if (await m.isInternalModelRepo()) {
636
- const { clearSystemPromptSections } = await import("./chunk-bg4x9ex0.js");
637
- clearSystemPromptSections();
638
- }
639
- });
640
- }
641
- if (false) {}
642
- import("./chunk-0brkf8q8.js").then((m) => m.registerSessionFileAccessHooks());
643
- if (false) {}
644
- }
645
- initSinks();
646
- logEvent("tengu_started", {});
647
- prefetchApiKeyFromApiKeyHelperIfSafe(getIsNonInteractiveSession());
648
- profileCheckpoint("setup_after_prefetch");
649
- if (!isBareMode()) {
650
- const { hasReleaseNotes } = await checkForReleaseNotes(getGlobalConfig().lastReleaseNotesSeen);
651
- if (hasReleaseNotes) {
652
- await getRecentActivity();
653
- }
654
- }
655
- if (permissionMode === "bypassPermissions" || allowDangerouslySkipPermissions) {
656
- if (process.platform !== "win32" && typeof process.getuid === "function" && process.getuid() === 0 && process.env.IS_SANDBOX !== "1" && !isEnvTruthy(process.env.CLAUDE_CODE_BUBBLEWRAP)) {
657
- console.error(`--dangerously-skip-permissions cannot be used with root/sudo privileges for security reasons`);
658
- process.exit(1);
659
- }
660
- if (process.env.USER_TYPE === "ant" && process.env.CLAUDE_CODE_ENTRYPOINT !== "local-agent" && process.env.CLAUDE_CODE_ENTRYPOINT !== "claude-desktop") {
661
- const [isDocker, hasInternet] = await Promise.all([
662
- envDynamic.getIsDocker(),
663
- env.hasInternetAccess()
664
- ]);
665
- const isBubblewrap = envDynamic.getIsBubblewrapSandbox();
666
- const isSandbox = process.env.IS_SANDBOX === "1";
667
- const isSandboxed = isDocker || isBubblewrap || isSandbox;
668
- if (!isSandboxed || hasInternet) {
669
- console.error(`--dangerously-skip-permissions can only be used in Docker/sandbox containers with no internet access but got Docker: ${isDocker}, Bubblewrap: ${isBubblewrap}, IS_SANDBOX: ${isSandbox}, hasInternet: ${hasInternet}`);
670
- process.exit(1);
671
- }
672
- }
673
- }
674
- if (false) {}
675
- const projectConfig = getCurrentProjectConfig();
676
- if (projectConfig.lastCost !== undefined && projectConfig.lastDuration !== undefined) {
677
- logEvent("tengu_exit", {
678
- last_session_cost: projectConfig.lastCost,
679
- last_session_api_duration: projectConfig.lastAPIDuration,
680
- last_session_tool_duration: projectConfig.lastToolDuration,
681
- last_session_duration: projectConfig.lastDuration,
682
- last_session_lines_added: projectConfig.lastLinesAdded,
683
- last_session_lines_removed: projectConfig.lastLinesRemoved,
684
- last_session_total_input_tokens: projectConfig.lastTotalInputTokens,
685
- last_session_total_output_tokens: projectConfig.lastTotalOutputTokens,
686
- last_session_total_cache_creation_input_tokens: projectConfig.lastTotalCacheCreationInputTokens,
687
- last_session_total_cache_read_input_tokens: projectConfig.lastTotalCacheReadInputTokens,
688
- last_session_fps_average: projectConfig.lastFpsAverage,
689
- last_session_fps_low_1_pct: projectConfig.lastFpsLow1Pct,
690
- last_session_id: projectConfig.lastSessionId,
691
- ...projectConfig.lastSessionMetrics
692
- });
693
- }
694
- }
695
- export {
696
- setup
697
- };