@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,4265 +0,0 @@
1
- // @bun
2
- import {
3
- calculateLayoutDimensions,
4
- calculateOptimalLeftWidth,
5
- formatModelAndBilling,
6
- formatWelcomeMessage,
7
- getLayoutMode,
8
- getLogoDisplayData,
9
- getRecentActivitySync,
10
- getRecentReleaseNotesSync,
11
- init_logoV2Utils,
12
- truncatePath
13
- } from "./chunk-a8jd4gee.js";
14
- import {
15
- init_useMainLoopModel,
16
- useMainLoopModel
17
- } from "./chunk-1z8p2eqd.js";
18
- import {
19
- init_systemTheme,
20
- resolveThemeSetting
21
- } from "./chunk-cnsj3vq2.js";
22
- import {
23
- checkForReleaseNotesSync,
24
- init_releaseNotes
25
- } from "./chunk-13ehyphg.js";
26
- import {
27
- AGENT_DESCRIPTIONS_THRESHOLD,
28
- getAgentDescriptionsTotalTokens,
29
- init_statusNoticeHelpers
30
- } from "./chunk-0vaw02wq.js";
31
- import {
32
- OverageCreditUpsell,
33
- createOverageCreditFeed,
34
- incrementOverageCreditUpsellSeenCount,
35
- init_OverageCreditUpsell,
36
- useShowOverageCreditUpsell
37
- } from "./chunk-n3fv4ya7.js";
38
- import {
39
- PromptInputFooterSuggestions_default,
40
- init_PromptInputFooterSuggestions
41
- } from "./chunk-k7akhwkn.js";
42
- import {
43
- ModalContext,
44
- init_modalContext
45
- } from "./chunk-t9p85zff.js";
46
- import {
47
- AssistantThinkingMessage,
48
- BACKGROUND_BASH_SUMMARY_PREFIX,
49
- EMPTY_STRING_SET,
50
- INTERRUPT_MESSAGE,
51
- INTERRUPT_MESSAGE_FOR_TOOL_USE,
52
- InVirtualListContext,
53
- MAX_MEMORY_CHARACTER_COUNT,
54
- Message,
55
- MessageActionsSelectedContext,
56
- OffscreenFreeze,
57
- SandboxManager,
58
- StreamingMarkdown,
59
- buildMessageLookups,
60
- collapseReadSearchGroups,
61
- createAssistantMessage,
62
- deriveUUID,
63
- extractTag,
64
- findToolByName,
65
- getDisplayMessageFromCollapsed,
66
- getDumpPromptsPath,
67
- getEffortSuffix,
68
- getLargeMemoryFiles,
69
- getMemoryFiles,
70
- getMessagesAfterCompactBoundary,
71
- getProgressMessagesFromLookup,
72
- getSiblingToolUseIDsFromLookup,
73
- getTerminalIdeType,
74
- getToolSearchOrReadInfo,
75
- getToolUseID,
76
- getToolUseIDs,
77
- getToolUseIdsFromCollapsedGroup,
78
- hasAnyToolInProgress,
79
- hasThinkingContent,
80
- hasUnresolvedHooksFromLookup,
81
- hueToRgb,
82
- init_AppState,
83
- init_AssistantThinkingMessage,
84
- init_LocalShellTask,
85
- init_Markdown,
86
- init_Message,
87
- init_OffscreenFreeze,
88
- init_ThemedText,
89
- init_Tool,
90
- init_claudemd,
91
- init_collapseReadSearch,
92
- init_dumpPrompts,
93
- init_effort,
94
- init_fullscreen,
95
- init_ide,
96
- init_jetbrains,
97
- init_messageActions,
98
- init_messages1 as init_messages,
99
- init_sandbox_adapter,
100
- init_useShortcutDisplay,
101
- init_useTerminalSize,
102
- init_utils1 as init_utils,
103
- isFullscreenEnvEnabled,
104
- isJetBrainsPluginInstalledCachedSync,
105
- isNavigableMessage,
106
- isNotEmptyMessage,
107
- isSupportedJetBrainsTerminal,
108
- normalizeMessages,
109
- reorderMessagesInUI,
110
- shouldShowUserMessage,
111
- stripSystemReminders,
112
- toIDEDisplayName,
113
- toRGBColor,
114
- toolCallOf,
115
- useAppState,
116
- useShortcutDisplay
117
- } from "./chunk-gnpt1t6q.js";
118
- import {
119
- checkCachedPassesEligibility,
120
- formatCreditAmount,
121
- getCachedReferrerReward,
122
- getCachedRemainingPasses,
123
- init_referral
124
- } from "./chunk-4k9d7gxv.js";
125
- import {
126
- getSteps,
127
- incrementProjectOnboardingSeenCount,
128
- init_projectOnboardingState,
129
- shouldShowProjectOnboarding
130
- } from "./chunk-t2ecddwj.js";
131
- import {
132
- init_advisor,
133
- isAdvisorBlock
134
- } from "./chunk-dkgkd8b7.js";
135
- import {
136
- init_model,
137
- isOpus1mMergeEnabled,
138
- renderModelSetting
139
- } from "./chunk-5pysjah8.js";
140
- import {
141
- init_browser,
142
- openBrowser,
143
- openPath
144
- } from "./chunk-v8kjswxt.js";
145
- import {
146
- BLACK_CIRCLE,
147
- TEARDROP_ASTERISK,
148
- UP_ARROW,
149
- exports_prompt,
150
- getAnthropicApiKeyWithSource,
151
- getApiKeyFromConfigOrMacOSKeychain,
152
- getAuthTokenSource,
153
- getDisplayPath,
154
- getDynamicConfig_CACHED_MAY_BE_STALE,
155
- getGlobalConfig,
156
- getInitialSettings,
157
- init_auth,
158
- init_config,
159
- init_figures as init_figures2,
160
- init_file,
161
- init_growthbook,
162
- init_prompt1 as init_prompt,
163
- init_settings1 as init_settings,
164
- init_stringUtils,
165
- plural,
166
- saveGlobalConfig
167
- } from "./chunk-dfq6pbq7.js";
168
- import {
169
- init_sleep,
170
- sleep
171
- } from "./chunk-8g5pe1gr.js";
172
- import {
173
- env,
174
- init_env
175
- } from "./chunk-5ekyhb1w.js";
176
- import {
177
- formatNumber,
178
- formatRelativeTimeAgo,
179
- getStartupPerfLogPath,
180
- init_format,
181
- init_startupProfiler,
182
- isDetailedProfilingEnabled,
183
- truncate
184
- } from "./chunk-fqak69ft.js";
185
- import {
186
- Divider,
187
- ScrollBox_default,
188
- TextHoverColorContext,
189
- ThemedBox_default,
190
- ThemedText,
191
- color,
192
- init_source,
193
- init_src,
194
- instances_default,
195
- source_default,
196
- stringWidth,
197
- useAnimationFrame,
198
- useTerminalNotification,
199
- useTerminalSize
200
- } from "./chunk-c7jwbe76.js";
201
- import {
202
- require_jsx_dev_runtime,
203
- require_react
204
- } from "./chunk-7sgtxrsc.js";
205
- import {
206
- init_analytics,
207
- logEvent
208
- } from "./chunk-x8d2ehd7.js";
209
- import {
210
- getCwd,
211
- init_cwd
212
- } from "./chunk-s8kj6ajy.js";
213
- import {
214
- figures_default,
215
- init_figures
216
- } from "./chunk-qajrkk97.js";
217
- import {
218
- STATUS_TAG,
219
- SUMMARY_TAG,
220
- TASK_NOTIFICATION_TAG,
221
- getDebugLogPath,
222
- init_debug,
223
- init_xml,
224
- isDebugMode,
225
- isDebugToStdErr,
226
- logForDebugging
227
- } from "./chunk-gg55fns0.js";
228
- import {
229
- init_envUtils,
230
- isEnvTruthy
231
- } from "./chunk-5n1jc02d.js";
232
- import {
233
- getIsRemoteMode,
234
- init_state
235
- } from "./chunk-k8vp0atq.js";
236
- import {
237
- __esm,
238
- __toCommonJS,
239
- __toESM
240
- } from "./chunk-qp2qdcda.js";
241
-
242
- // src/context/promptOverlayContext.tsx
243
- function PromptOverlayProvider({
244
- children
245
- }) {
246
- const [data, setData] = import_react.useState(null);
247
- const [dialog, setDialog] = import_react.useState(null);
248
- return /* @__PURE__ */ jsx_dev_runtime.jsxDEV(SetContext.Provider, {
249
- value: setData,
250
- children: /* @__PURE__ */ jsx_dev_runtime.jsxDEV(SetDialogContext.Provider, {
251
- value: setDialog,
252
- children: /* @__PURE__ */ jsx_dev_runtime.jsxDEV(DataContext.Provider, {
253
- value: data,
254
- children: /* @__PURE__ */ jsx_dev_runtime.jsxDEV(DialogContext.Provider, {
255
- value: dialog,
256
- children
257
- }, undefined, false, undefined, this)
258
- }, undefined, false, undefined, this)
259
- }, undefined, false, undefined, this)
260
- }, undefined, false, undefined, this);
261
- }
262
- function usePromptOverlay() {
263
- return import_react.useContext(DataContext);
264
- }
265
- function usePromptOverlayDialog() {
266
- return import_react.useContext(DialogContext);
267
- }
268
- function useSetPromptOverlay(data) {
269
- const set = import_react.useContext(SetContext);
270
- import_react.useEffect(() => {
271
- if (!set)
272
- return;
273
- set(data);
274
- return () => set(null);
275
- }, [set, data]);
276
- }
277
- function useSetPromptOverlayDialog(node) {
278
- const set = import_react.useContext(SetDialogContext);
279
- import_react.useEffect(() => {
280
- if (!set)
281
- return;
282
- set(node);
283
- return () => set(null);
284
- }, [set, node]);
285
- }
286
- var import_react, jsx_dev_runtime, DataContext, SetContext, DialogContext, SetDialogContext;
287
- var init_promptOverlayContext = __esm(() => {
288
- import_react = __toESM(require_react(), 1);
289
- jsx_dev_runtime = __toESM(require_jsx_dev_runtime(), 1);
290
- DataContext = import_react.createContext(null);
291
- SetContext = import_react.createContext(null);
292
- DialogContext = import_react.createContext(null);
293
- SetDialogContext = import_react.createContext(null);
294
- });
295
-
296
- // src/components/messages/nullRenderingAttachments.ts
297
- function isNullRenderingAttachment(msg) {
298
- return msg.type === "attachment" && NULL_RENDERING_ATTACHMENT_TYPES.has(msg.attachment.type);
299
- }
300
- var NULL_RENDERING_TYPES, NULL_RENDERING_ATTACHMENT_TYPES;
301
- var init_nullRenderingAttachments = __esm(() => {
302
- NULL_RENDERING_TYPES = [
303
- "hook_success",
304
- "hook_additional_context",
305
- "hook_cancelled",
306
- "command_permissions",
307
- "agent_mention",
308
- "budget_usd",
309
- "critical_system_reminder",
310
- "edited_image_file",
311
- "edited_text_file",
312
- "opened_file_in_ide",
313
- "output_style",
314
- "plan_mode",
315
- "plan_mode_exit",
316
- "plan_mode_reentry",
317
- "structured_output",
318
- "team_context",
319
- "todo_reminder",
320
- "context_efficiency",
321
- "deferred_tools_delta",
322
- "mcp_instructions_delta",
323
- "companion_intro",
324
- "token_usage",
325
- "ultrathink_effort",
326
- "max_turns_reached",
327
- "task_reminder",
328
- "auto_mode",
329
- "auto_mode_exit",
330
- "output_token_usage",
331
- "verify_plan_reminder",
332
- "current_session_memory",
333
- "compaction_reminder",
334
- "date_change"
335
- ];
336
- NULL_RENDERING_ATTACHMENT_TYPES = new Set(NULL_RENDERING_TYPES);
337
- });
338
-
339
- // src/components/FullscreenLayout.tsx
340
- import { fileURLToPath } from "url";
341
- function useUnseenDivider(messageCount) {
342
- const [dividerIndex, setDividerIndex] = import_react2.useState(null);
343
- const countRef = import_react2.useRef(messageCount);
344
- countRef.current = messageCount;
345
- const dividerYRef = import_react2.useRef(null);
346
- const onRepin = import_react2.useCallback(() => {
347
- setDividerIndex(null);
348
- }, []);
349
- const onScrollAway = import_react2.useCallback((handle) => {
350
- const max = Math.max(0, handle.getScrollHeight() - handle.getViewportHeight());
351
- if (handle.getScrollTop() + handle.getPendingDelta() >= max)
352
- return;
353
- if (dividerYRef.current === null) {
354
- dividerYRef.current = handle.getScrollHeight();
355
- setDividerIndex(countRef.current);
356
- }
357
- }, []);
358
- const jumpToNew = import_react2.useCallback((handle) => {
359
- if (!handle)
360
- return;
361
- handle.scrollToBottom();
362
- }, []);
363
- import_react2.useEffect(() => {
364
- if (dividerIndex === null) {
365
- dividerYRef.current = null;
366
- } else if (messageCount < dividerIndex) {
367
- dividerYRef.current = null;
368
- setDividerIndex(null);
369
- }
370
- }, [messageCount, dividerIndex]);
371
- const shiftDivider = import_react2.useCallback((indexDelta, heightDelta) => {
372
- setDividerIndex((idx) => idx === null ? null : idx + indexDelta);
373
- if (dividerYRef.current !== null) {
374
- dividerYRef.current += heightDelta;
375
- }
376
- }, []);
377
- return {
378
- dividerIndex,
379
- dividerYRef,
380
- onScrollAway,
381
- onRepin,
382
- jumpToNew,
383
- shiftDivider
384
- };
385
- }
386
- function countUnseenAssistantTurns(messages, dividerIndex) {
387
- let count = 0;
388
- let prevWasAssistant = false;
389
- for (let i = dividerIndex;i < messages.length; i++) {
390
- const m = messages[i];
391
- if (m.type === "progress")
392
- continue;
393
- if (m.type === "assistant" && !assistantHasVisibleText(m))
394
- continue;
395
- const isAssistant = m.type === "assistant";
396
- if (isAssistant && !prevWasAssistant)
397
- count++;
398
- prevWasAssistant = isAssistant;
399
- }
400
- return count;
401
- }
402
- function assistantHasVisibleText(m) {
403
- if (m.type !== "assistant")
404
- return false;
405
- if (!Array.isArray(m.message.content))
406
- return false;
407
- for (const b of m.message.content) {
408
- if (typeof b !== "string" && b.type === "text" && b.text.trim() !== "")
409
- return true;
410
- }
411
- return false;
412
- }
413
- function computeUnseenDivider(messages, dividerIndex) {
414
- if (dividerIndex === null)
415
- return;
416
- let anchorIdx = dividerIndex;
417
- while (anchorIdx < messages.length && (messages[anchorIdx]?.type === "progress" || isNullRenderingAttachment(messages[anchorIdx]))) {
418
- anchorIdx++;
419
- }
420
- const uuid = messages[anchorIdx]?.uuid;
421
- if (!uuid)
422
- return;
423
- const count = countUnseenAssistantTurns(messages, dividerIndex);
424
- return { firstUnseenUuid: uuid, count: Math.max(1, count) };
425
- }
426
- function FullscreenLayout({
427
- scrollable,
428
- bottom,
429
- overlay,
430
- bottomFloat,
431
- modal,
432
- modalScrollRef,
433
- scrollRef,
434
- dividerYRef,
435
- hidePill = false,
436
- hideSticky = false,
437
- newMessageCount = 0,
438
- onPillClick
439
- }) {
440
- const { rows: terminalRows, columns } = useTerminalSize();
441
- const [stickyPrompt, setStickyPrompt] = import_react2.useState(null);
442
- const chromeCtx = import_react2.useMemo(() => ({ setStickyPrompt }), []);
443
- const subscribe = import_react2.useCallback((listener) => scrollRef?.current?.subscribe(listener) ?? (() => {}), [scrollRef]);
444
- const pillVisible = import_react2.useSyncExternalStore(subscribe, () => {
445
- const s = scrollRef?.current;
446
- const dividerY = dividerYRef?.current;
447
- if (!s || dividerY == null)
448
- return false;
449
- return s.getScrollTop() + s.getPendingDelta() + s.getViewportHeight() < dividerY;
450
- });
451
- import_react2.useLayoutEffect(() => {
452
- if (!isFullscreenEnvEnabled())
453
- return;
454
- const ink = instances_default.get(process.stdout);
455
- if (!ink)
456
- return;
457
- ink.onHyperlinkClick = (url) => {
458
- if (url.startsWith("file:")) {
459
- try {
460
- openPath(fileURLToPath(url));
461
- } catch {}
462
- } else {
463
- openBrowser(url);
464
- }
465
- };
466
- return () => {
467
- ink.onHyperlinkClick = undefined;
468
- };
469
- }, []);
470
- if (isFullscreenEnvEnabled()) {
471
- const sticky = hideSticky ? null : stickyPrompt;
472
- const headerPrompt = sticky != null && sticky !== "clicked" && overlay == null ? sticky : null;
473
- const padCollapsed = sticky != null && overlay == null;
474
- return /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(PromptOverlayProvider, {
475
- children: [
476
- /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(ThemedBox_default, {
477
- flexGrow: 1,
478
- flexDirection: "column",
479
- overflow: "hidden",
480
- children: [
481
- headerPrompt && /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(StickyPromptHeader, {
482
- text: headerPrompt.text,
483
- onClick: headerPrompt.scrollTo
484
- }, undefined, false, undefined, this),
485
- /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(ScrollBox_default, {
486
- ref: scrollRef,
487
- flexGrow: 1,
488
- flexDirection: "column",
489
- paddingTop: padCollapsed ? 0 : 1,
490
- stickyScroll: true,
491
- children: [
492
- /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(ScrollChromeContext, {
493
- value: chromeCtx,
494
- children: scrollable
495
- }, undefined, false, undefined, this),
496
- overlay
497
- ]
498
- }, undefined, true, undefined, this),
499
- !hidePill && pillVisible && overlay == null && /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(NewMessagesPill, {
500
- count: newMessageCount,
501
- onClick: onPillClick
502
- }, undefined, false, undefined, this),
503
- bottomFloat != null && /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(ThemedBox_default, {
504
- position: "absolute",
505
- bottom: 0,
506
- right: 0,
507
- opaque: true,
508
- children: bottomFloat
509
- }, undefined, false, undefined, this)
510
- ]
511
- }, undefined, true, undefined, this),
512
- /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(ThemedBox_default, {
513
- flexDirection: "column",
514
- flexShrink: 0,
515
- width: "100%",
516
- maxHeight: "50%",
517
- children: [
518
- /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(SuggestionsOverlay, {}, undefined, false, undefined, this),
519
- /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(DialogOverlay, {}, undefined, false, undefined, this),
520
- /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(ThemedBox_default, {
521
- flexDirection: "column",
522
- width: "100%",
523
- flexGrow: 1,
524
- overflowY: "hidden",
525
- children: bottom
526
- }, undefined, false, undefined, this)
527
- ]
528
- }, undefined, true, undefined, this),
529
- modal != null && /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(ModalContext, {
530
- value: {
531
- rows: terminalRows - MODAL_TRANSCRIPT_PEEK - 1,
532
- columns: columns - 4,
533
- scrollRef: modalScrollRef ?? null
534
- },
535
- children: /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(ThemedBox_default, {
536
- position: "absolute",
537
- bottom: 0,
538
- left: 0,
539
- right: 0,
540
- maxHeight: terminalRows - MODAL_TRANSCRIPT_PEEK,
541
- flexDirection: "column",
542
- overflow: "hidden",
543
- opaque: true,
544
- children: [
545
- /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(ThemedBox_default, {
546
- flexShrink: 0,
547
- children: /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(ThemedText, {
548
- color: "permission",
549
- children: "\u2594".repeat(columns)
550
- }, undefined, false, undefined, this)
551
- }, undefined, false, undefined, this),
552
- /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(ThemedBox_default, {
553
- flexDirection: "column",
554
- paddingX: 2,
555
- flexShrink: 0,
556
- overflow: "hidden",
557
- children: modal
558
- }, undefined, false, undefined, this)
559
- ]
560
- }, undefined, true, undefined, this)
561
- }, undefined, false, undefined, this)
562
- ]
563
- }, undefined, true, undefined, this);
564
- }
565
- return /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(jsx_dev_runtime2.Fragment, {
566
- children: [
567
- scrollable,
568
- bottom,
569
- overlay,
570
- modal
571
- ]
572
- }, undefined, true, undefined, this);
573
- }
574
- function NewMessagesPill({
575
- count,
576
- onClick
577
- }) {
578
- const [hover, setHover] = import_react2.useState(false);
579
- return /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(ThemedBox_default, {
580
- position: "absolute",
581
- bottom: 0,
582
- left: 0,
583
- right: 0,
584
- justifyContent: "center",
585
- children: /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(ThemedBox_default, {
586
- onClick,
587
- onMouseEnter: () => setHover(true),
588
- onMouseLeave: () => setHover(false),
589
- children: /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(ThemedText, {
590
- backgroundColor: hover ? "userMessageBackgroundHover" : "userMessageBackground",
591
- dimColor: true,
592
- children: [
593
- " ",
594
- count > 0 ? `${count} new ${plural(count, "message")}` : "Jump to bottom",
595
- " ",
596
- figures_default.arrowDown,
597
- " "
598
- ]
599
- }, undefined, true, undefined, this)
600
- }, undefined, false, undefined, this)
601
- }, undefined, false, undefined, this);
602
- }
603
- function StickyPromptHeader({
604
- text,
605
- onClick
606
- }) {
607
- const [hover, setHover] = import_react2.useState(false);
608
- return /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(ThemedBox_default, {
609
- flexShrink: 0,
610
- width: "100%",
611
- height: 1,
612
- paddingRight: 1,
613
- backgroundColor: hover ? "userMessageBackgroundHover" : "userMessageBackground",
614
- onClick,
615
- onMouseEnter: () => setHover(true),
616
- onMouseLeave: () => setHover(false),
617
- children: /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(ThemedText, {
618
- color: "subtle",
619
- wrap: "truncate-end",
620
- children: [
621
- figures_default.pointer,
622
- " ",
623
- text
624
- ]
625
- }, undefined, true, undefined, this)
626
- }, undefined, false, undefined, this);
627
- }
628
- function SuggestionsOverlay() {
629
- const data = usePromptOverlay();
630
- if (!data || data.suggestions.length === 0)
631
- return null;
632
- return /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(ThemedBox_default, {
633
- position: "absolute",
634
- bottom: "100%",
635
- left: 0,
636
- right: 0,
637
- paddingX: 2,
638
- paddingTop: 1,
639
- flexDirection: "column",
640
- opaque: true,
641
- children: /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(PromptInputFooterSuggestions_default, {
642
- suggestions: data.suggestions,
643
- selectedSuggestion: data.selectedSuggestion,
644
- maxColumnWidth: data.maxColumnWidth,
645
- overlay: true
646
- }, undefined, false, undefined, this)
647
- }, undefined, false, undefined, this);
648
- }
649
- function DialogOverlay() {
650
- const node = usePromptOverlayDialog();
651
- if (!node)
652
- return null;
653
- return /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(ThemedBox_default, {
654
- position: "absolute",
655
- bottom: "100%",
656
- left: 0,
657
- right: 0,
658
- opaque: true,
659
- children: node
660
- }, undefined, false, undefined, this);
661
- }
662
- var import_react2, jsx_dev_runtime2, MODAL_TRANSCRIPT_PEEK = 2, ScrollChromeContext;
663
- var init_FullscreenLayout = __esm(() => {
664
- init_figures();
665
- init_modalContext();
666
- init_promptOverlayContext();
667
- init_useTerminalSize();
668
- init_src();
669
- init_browser();
670
- init_fullscreen();
671
- init_stringUtils();
672
- init_nullRenderingAttachments();
673
- init_PromptInputFooterSuggestions();
674
- import_react2 = __toESM(require_react(), 1);
675
- jsx_dev_runtime2 = __toESM(require_jsx_dev_runtime(), 1);
676
- ScrollChromeContext = import_react2.createContext({ setStickyPrompt: () => {} });
677
- });
678
-
679
- // src/utils/set.ts
680
- function every(a, b) {
681
- for (const item of a) {
682
- if (!b.has(item)) {
683
- return false;
684
- }
685
- }
686
- return true;
687
- }
688
- var init_set = () => {};
689
-
690
- // src/utils/collapseBackgroundBashNotifications.ts
691
- function isCompletedBackgroundBash(msg) {
692
- if (msg.type !== "user")
693
- return false;
694
- const content0 = Array.isArray(msg.message.content) ? msg.message.content[0] : undefined;
695
- if (!content0 || typeof content0 === "string" || content0?.type !== "text")
696
- return false;
697
- if (!content0.text.includes(`<${TASK_NOTIFICATION_TAG}`))
698
- return false;
699
- if (extractTag(content0.text, STATUS_TAG) !== "completed")
700
- return false;
701
- return extractTag(content0.text, SUMMARY_TAG)?.startsWith(BACKGROUND_BASH_SUMMARY_PREFIX) ?? false;
702
- }
703
- function collapseBackgroundBashNotifications(messages, verbose) {
704
- if (!isFullscreenEnvEnabled())
705
- return messages;
706
- if (verbose)
707
- return messages;
708
- const result = [];
709
- let i = 0;
710
- while (i < messages.length) {
711
- const msg = messages[i];
712
- if (isCompletedBackgroundBash(msg)) {
713
- let count = 0;
714
- while (i < messages.length && isCompletedBackgroundBash(messages[i])) {
715
- count++;
716
- i++;
717
- }
718
- if (count === 1) {
719
- result.push(msg);
720
- } else {
721
- result.push({
722
- ...msg,
723
- message: {
724
- role: "user",
725
- content: [
726
- {
727
- type: "text",
728
- text: `<${TASK_NOTIFICATION_TAG}><${STATUS_TAG}>completed</${STATUS_TAG}><${SUMMARY_TAG}>${count} background commands completed</${SUMMARY_TAG}></${TASK_NOTIFICATION_TAG}>`
729
- }
730
- ]
731
- }
732
- });
733
- }
734
- } else {
735
- result.push(msg);
736
- i++;
737
- }
738
- }
739
- return result;
740
- }
741
- var init_collapseBackgroundBashNotifications = __esm(() => {
742
- init_xml();
743
- init_LocalShellTask();
744
- init_fullscreen();
745
- init_messages();
746
- });
747
-
748
- // src/utils/collapseHookSummaries.ts
749
- function isLabeledHookSummary(msg) {
750
- return msg.type === "system" && msg.subtype === "stop_hook_summary" && msg.hookLabel !== undefined;
751
- }
752
- function collapseHookSummaries(messages) {
753
- const result = [];
754
- let i = 0;
755
- while (i < messages.length) {
756
- const msg = messages[i];
757
- if (isLabeledHookSummary(msg)) {
758
- const label = msg.hookLabel;
759
- const group = [];
760
- while (i < messages.length) {
761
- const next = messages[i];
762
- if (!isLabeledHookSummary(next) || next.hookLabel !== label)
763
- break;
764
- group.push(next);
765
- i++;
766
- }
767
- if (group.length === 1) {
768
- result.push(msg);
769
- } else {
770
- result.push({
771
- ...msg,
772
- hookCount: group.reduce((sum, m) => sum + m.hookCount, 0),
773
- hookInfos: group.flatMap((m) => m.hookInfos),
774
- hookErrors: group.flatMap((m) => m.hookErrors),
775
- preventedContinuation: group.some((m) => m.preventedContinuation),
776
- hasOutput: group.some((m) => m.hasOutput),
777
- totalDurationMs: Math.max(...group.map((m) => m.totalDurationMs ?? 0))
778
- });
779
- }
780
- } else {
781
- result.push(msg);
782
- i++;
783
- }
784
- }
785
- return result;
786
- }
787
- var init_collapseHookSummaries = () => {};
788
-
789
- // src/utils/collapseTeammateShutdowns.ts
790
- function isTeammateShutdownAttachment(msg) {
791
- return msg.type === "attachment" && msg.attachment.type === "task_status" && msg.attachment.taskType === "in_process_teammate" && msg.attachment.status === "completed";
792
- }
793
- function collapseTeammateShutdowns(messages) {
794
- const result = [];
795
- let i = 0;
796
- while (i < messages.length) {
797
- const msg = messages[i];
798
- if (isTeammateShutdownAttachment(msg)) {
799
- let count = 0;
800
- while (i < messages.length && isTeammateShutdownAttachment(messages[i])) {
801
- count++;
802
- i++;
803
- }
804
- if (count === 1) {
805
- result.push(msg);
806
- } else {
807
- result.push({
808
- type: "attachment",
809
- uuid: msg.uuid,
810
- timestamp: msg.timestamp,
811
- attachment: {
812
- type: "teammate_shutdown_batch",
813
- count
814
- }
815
- });
816
- }
817
- } else {
818
- result.push(msg);
819
- i++;
820
- }
821
- }
822
- return result;
823
- }
824
- var init_collapseTeammateShutdowns = () => {};
825
-
826
- // src/utils/groupToolUses.ts
827
- function getToolsWithGrouping(tools) {
828
- let cached = GROUPING_CACHE.get(tools);
829
- if (!cached) {
830
- cached = new Set(tools.filter((t) => t.renderGroupedToolUse).map((t) => t.name));
831
- GROUPING_CACHE.set(tools, cached);
832
- }
833
- return cached;
834
- }
835
- function getToolUseInfo(msg) {
836
- if (msg.type === "assistant" && msg.message?.content && Array.isArray(msg.message.content) && msg.message.content[0]?.type === "tool_use") {
837
- const content = msg.message.content[0];
838
- return {
839
- messageId: msg.message.id,
840
- toolUseId: content.id,
841
- toolName: content.name
842
- };
843
- }
844
- return null;
845
- }
846
- function applyGrouping(messages, tools, verbose = false) {
847
- if (verbose) {
848
- return {
849
- messages
850
- };
851
- }
852
- const toolsWithGrouping = getToolsWithGrouping(tools);
853
- const groups = new Map;
854
- for (const msg of messages) {
855
- const info = getToolUseInfo(msg);
856
- if (info && toolsWithGrouping.has(info.toolName)) {
857
- const key = `${info.messageId}:${info.toolName}`;
858
- const group = groups.get(key) ?? [];
859
- group.push(msg);
860
- groups.set(key, group);
861
- }
862
- }
863
- const validGroups = new Map;
864
- const groupedToolUseIds = new Set;
865
- for (const [key, group] of groups) {
866
- if (group.length >= 2) {
867
- validGroups.set(key, group);
868
- for (const msg of group) {
869
- const info = getToolUseInfo(msg);
870
- if (info) {
871
- groupedToolUseIds.add(info.toolUseId);
872
- }
873
- }
874
- }
875
- }
876
- const resultsByToolUseId = new Map;
877
- for (const msg of messages) {
878
- if (msg.type === "user" && msg.message?.content && Array.isArray(msg.message.content)) {
879
- for (const content of msg.message.content) {
880
- if (content.type === "tool_result" && groupedToolUseIds.has(content.tool_use_id)) {
881
- resultsByToolUseId.set(content.tool_use_id, msg);
882
- }
883
- }
884
- }
885
- }
886
- const result = [];
887
- const emittedGroups = new Set;
888
- for (const msg of messages) {
889
- const info = getToolUseInfo(msg);
890
- if (info) {
891
- const key = `${info.messageId}:${info.toolName}`;
892
- const group = validGroups.get(key);
893
- if (group) {
894
- if (!emittedGroups.has(key)) {
895
- emittedGroups.add(key);
896
- const firstMsg = group[0];
897
- const results = [];
898
- for (const assistantMsg of group) {
899
- const toolUseId = assistantMsg.message.content[0].id;
900
- const resultMsg = resultsByToolUseId.get(toolUseId);
901
- if (resultMsg) {
902
- results.push(resultMsg);
903
- }
904
- }
905
- const groupedMessage = {
906
- type: "grouped_tool_use",
907
- toolName: info.toolName,
908
- messages: group,
909
- results,
910
- displayMessage: firstMsg,
911
- uuid: `grouped-${firstMsg.uuid}`,
912
- timestamp: firstMsg.timestamp,
913
- messageId: info.messageId
914
- };
915
- result.push(groupedMessage);
916
- }
917
- continue;
918
- }
919
- }
920
- if (msg.type === "user" && msg.message?.content && Array.isArray(msg.message.content)) {
921
- const toolResults = msg.message.content.filter((c) => c.type === "tool_result");
922
- if (toolResults.length > 0) {
923
- const allGrouped = toolResults.every((tr) => groupedToolUseIds.has(tr.tool_use_id));
924
- if (allGrouped) {
925
- continue;
926
- }
927
- }
928
- }
929
- result.push(msg);
930
- }
931
- return { messages: result };
932
- }
933
- var GROUPING_CACHE;
934
- var init_groupToolUses = __esm(() => {
935
- GROUPING_CACHE = new WeakMap;
936
- });
937
-
938
- // src/utils/transcriptSearch.ts
939
- function renderableSearchText(msg) {
940
- const cached = searchTextCache.get(msg);
941
- if (cached !== undefined)
942
- return cached;
943
- const result = computeSearchText(msg).toLowerCase();
944
- searchTextCache.set(msg, result);
945
- return result;
946
- }
947
- function computeSearchText(msg) {
948
- let raw = "";
949
- switch (msg.type) {
950
- case "user": {
951
- const c = msg.message.content;
952
- if (typeof c === "string") {
953
- raw = RENDERED_AS_SENTINEL.has(c) ? "" : c;
954
- } else {
955
- const parts = [];
956
- for (const b of c) {
957
- if (b.type === "text") {
958
- if (!RENDERED_AS_SENTINEL.has(b.text))
959
- parts.push(b.text);
960
- } else if (b.type === "tool_result") {
961
- parts.push(toolResultSearchText(msg.toolUseResult));
962
- }
963
- }
964
- raw = parts.join(`
965
- `);
966
- }
967
- break;
968
- }
969
- case "assistant": {
970
- const c = msg.message.content;
971
- if (Array.isArray(c)) {
972
- raw = c.flatMap((b) => {
973
- if (b.type === "text")
974
- return [b.text];
975
- if (b.type === "tool_use")
976
- return [toolUseSearchText(b.input)];
977
- return [];
978
- }).join(`
979
- `);
980
- }
981
- break;
982
- }
983
- case "attachment": {
984
- if (msg.attachment.type === "relevant_memories") {
985
- raw = msg.attachment.memories.map((m) => m.content).join(`
986
- `);
987
- } else if (msg.attachment.type === "queued_command" && msg.attachment.commandMode !== "task-notification" && !msg.attachment.isMeta) {
988
- const p = msg.attachment.prompt;
989
- raw = typeof p === "string" ? p : p.flatMap((b) => b.type === "text" ? [b.text] : []).join(`
990
- `);
991
- }
992
- break;
993
- }
994
- case "collapsed_read_search": {
995
- if (msg.relevantMemories) {
996
- raw = msg.relevantMemories.map((m) => m.content).join(`
997
- `);
998
- }
999
- break;
1000
- }
1001
- default:
1002
- break;
1003
- }
1004
- let t = raw;
1005
- let open = t.indexOf("<system-reminder>");
1006
- while (open >= 0) {
1007
- const close = t.indexOf(SYSTEM_REMINDER_CLOSE, open);
1008
- if (close < 0)
1009
- break;
1010
- t = t.slice(0, open) + t.slice(close + SYSTEM_REMINDER_CLOSE.length);
1011
- open = t.indexOf("<system-reminder>");
1012
- }
1013
- return t;
1014
- }
1015
- function toolUseSearchText(input) {
1016
- if (!input || typeof input !== "object")
1017
- return "";
1018
- const o = input;
1019
- const parts = [];
1020
- for (const k of [
1021
- "command",
1022
- "pattern",
1023
- "file_path",
1024
- "path",
1025
- "prompt",
1026
- "description",
1027
- "query",
1028
- "url",
1029
- "skill"
1030
- ]) {
1031
- const v = o[k];
1032
- if (typeof v === "string")
1033
- parts.push(v);
1034
- }
1035
- for (const k of ["args", "files"]) {
1036
- const v = o[k];
1037
- if (Array.isArray(v) && v.every((x) => typeof x === "string")) {
1038
- parts.push(v.join(" "));
1039
- }
1040
- }
1041
- return parts.join(`
1042
- `);
1043
- }
1044
- function toolResultSearchText(r) {
1045
- if (!r || typeof r !== "object")
1046
- return typeof r === "string" ? r : "";
1047
- const o = r;
1048
- if (typeof o.stdout === "string") {
1049
- const err = typeof o.stderr === "string" ? o.stderr : "";
1050
- return o.stdout + (err ? `
1051
- ` + err : "");
1052
- }
1053
- if (o.file && typeof o.file === "object" && typeof o.file.content === "string") {
1054
- return o.file.content;
1055
- }
1056
- const parts = [];
1057
- for (const k of ["content", "output", "result", "text", "message"]) {
1058
- const v = o[k];
1059
- if (typeof v === "string")
1060
- parts.push(v);
1061
- }
1062
- for (const k of ["filenames", "lines", "results"]) {
1063
- const v = o[k];
1064
- if (Array.isArray(v) && v.every((x) => typeof x === "string")) {
1065
- parts.push(v.join(`
1066
- `));
1067
- }
1068
- }
1069
- return parts.join(`
1070
- `);
1071
- }
1072
- var SYSTEM_REMINDER_CLOSE = "</system-reminder>", RENDERED_AS_SENTINEL, searchTextCache;
1073
- var init_transcriptSearch = __esm(() => {
1074
- init_messages();
1075
- RENDERED_AS_SENTINEL = new Set([
1076
- INTERRUPT_MESSAGE,
1077
- INTERRUPT_MESSAGE_FOR_TOOL_USE
1078
- ]);
1079
- searchTextCache = new WeakMap;
1080
- });
1081
-
1082
- // src/components/LogoV2/Clawd.tsx
1083
- function Clawd({ pose = "default" } = {}) {
1084
- if (env.terminal === "Apple_Terminal") {
1085
- return /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(AppleTerminalClawd, {
1086
- pose
1087
- }, undefined, false, undefined, this);
1088
- }
1089
- const p = POSES[pose];
1090
- return /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedBox_default, {
1091
- flexDirection: "column",
1092
- children: [
1093
- /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedText, {
1094
- children: [
1095
- /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedText, {
1096
- color: "clawd_body",
1097
- children: p.r1L
1098
- }, undefined, false, undefined, this),
1099
- /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedText, {
1100
- color: "clawd_body",
1101
- backgroundColor: "clawd_background",
1102
- children: p.r1E
1103
- }, undefined, false, undefined, this),
1104
- /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedText, {
1105
- color: "clawd_body",
1106
- children: p.r1R
1107
- }, undefined, false, undefined, this)
1108
- ]
1109
- }, undefined, true, undefined, this),
1110
- /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedText, {
1111
- children: [
1112
- /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedText, {
1113
- color: "clawd_body",
1114
- children: p.r2L
1115
- }, undefined, false, undefined, this),
1116
- /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedText, {
1117
- color: "clawd_body",
1118
- backgroundColor: "clawd_background",
1119
- children: "\u2588\u2588\u2588\u2588\u2588"
1120
- }, undefined, false, undefined, this),
1121
- /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedText, {
1122
- color: "clawd_body",
1123
- children: p.r2R
1124
- }, undefined, false, undefined, this)
1125
- ]
1126
- }, undefined, true, undefined, this),
1127
- /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedText, {
1128
- color: "clawd_body",
1129
- children: [
1130
- " ",
1131
- "\u2598\u2598 \u259D\u259D",
1132
- " "
1133
- ]
1134
- }, undefined, true, undefined, this)
1135
- ]
1136
- }, undefined, true, undefined, this);
1137
- }
1138
- function AppleTerminalClawd({ pose }) {
1139
- return /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedBox_default, {
1140
- flexDirection: "column",
1141
- alignItems: "center",
1142
- children: [
1143
- /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedText, {
1144
- children: [
1145
- /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedText, {
1146
- color: "clawd_body",
1147
- children: "\u2597"
1148
- }, undefined, false, undefined, this),
1149
- /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedText, {
1150
- color: "clawd_background",
1151
- backgroundColor: "clawd_body",
1152
- children: APPLE_EYES[pose]
1153
- }, undefined, false, undefined, this),
1154
- /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedText, {
1155
- color: "clawd_body",
1156
- children: "\u2596"
1157
- }, undefined, false, undefined, this)
1158
- ]
1159
- }, undefined, true, undefined, this),
1160
- /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedText, {
1161
- backgroundColor: "clawd_body",
1162
- children: " ".repeat(7)
1163
- }, undefined, false, undefined, this),
1164
- /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedText, {
1165
- color: "clawd_body",
1166
- children: "\u2598\u2598 \u259D\u259D"
1167
- }, undefined, false, undefined, this)
1168
- ]
1169
- }, undefined, true, undefined, this);
1170
- }
1171
- var jsx_dev_runtime3, POSES, APPLE_EYES;
1172
- var init_Clawd = __esm(() => {
1173
- init_src();
1174
- init_env();
1175
- jsx_dev_runtime3 = __toESM(require_jsx_dev_runtime(), 1);
1176
- POSES = {
1177
- default: { r1L: " \u2590", r1E: "\u259B\u2588\u2588\u2588\u259C", r1R: "\u258C", r2L: "\u259D\u259C", r2R: "\u259B\u2598" },
1178
- "look-left": { r1L: " \u2590", r1E: "\u259F\u2588\u2588\u2588\u259F", r1R: "\u258C", r2L: "\u259D\u259C", r2R: "\u259B\u2598" },
1179
- "look-right": { r1L: " \u2590", r1E: "\u2599\u2588\u2588\u2588\u2599", r1R: "\u258C", r2L: "\u259D\u259C", r2R: "\u259B\u2598" },
1180
- "arms-up": { r1L: "\u2597\u259F", r1E: "\u259B\u2588\u2588\u2588\u259C", r1R: "\u2599\u2596", r2L: " \u259C", r2R: "\u259B " }
1181
- };
1182
- APPLE_EYES = {
1183
- default: " \u2597 \u2596 ",
1184
- "look-left": " \u2598 \u2598 ",
1185
- "look-right": " \u259D \u259D ",
1186
- "arms-up": " \u2597 \u2596 "
1187
- };
1188
- });
1189
-
1190
- // src/components/LogoV2/Feed.tsx
1191
- function calculateFeedWidth(config) {
1192
- const { title, lines, footer, emptyMessage, customContent } = config;
1193
- let maxWidth = stringWidth(title);
1194
- if (customContent !== undefined) {
1195
- maxWidth = Math.max(maxWidth, customContent.width);
1196
- } else if (lines.length === 0 && emptyMessage) {
1197
- maxWidth = Math.max(maxWidth, stringWidth(emptyMessage));
1198
- } else {
1199
- const gap = " ";
1200
- const maxTimestampWidth = Math.max(0, ...lines.map((line) => line.timestamp ? stringWidth(line.timestamp) : 0));
1201
- for (const line of lines) {
1202
- const timestampWidth = maxTimestampWidth > 0 ? maxTimestampWidth : 0;
1203
- const lineWidth = stringWidth(line.text) + (timestampWidth > 0 ? timestampWidth + gap.length : 0);
1204
- maxWidth = Math.max(maxWidth, lineWidth);
1205
- }
1206
- }
1207
- if (footer) {
1208
- maxWidth = Math.max(maxWidth, stringWidth(footer));
1209
- }
1210
- return maxWidth;
1211
- }
1212
- function Feed({ config, actualWidth }) {
1213
- const { title, lines, footer, emptyMessage, customContent } = config;
1214
- const gap = " ";
1215
- const maxTimestampWidth = Math.max(0, ...lines.map((line) => line.timestamp ? stringWidth(line.timestamp) : 0));
1216
- return /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(ThemedBox_default, {
1217
- flexDirection: "column",
1218
- width: actualWidth,
1219
- children: [
1220
- /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(ThemedText, {
1221
- bold: true,
1222
- color: "claude",
1223
- children: title
1224
- }, undefined, false, undefined, this),
1225
- customContent ? /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(jsx_dev_runtime4.Fragment, {
1226
- children: [
1227
- customContent.content,
1228
- footer && /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(ThemedText, {
1229
- dimColor: true,
1230
- italic: true,
1231
- children: truncate(footer, actualWidth)
1232
- }, undefined, false, undefined, this)
1233
- ]
1234
- }, undefined, true, undefined, this) : lines.length === 0 && emptyMessage ? /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(ThemedText, {
1235
- dimColor: true,
1236
- children: truncate(emptyMessage, actualWidth)
1237
- }, undefined, false, undefined, this) : /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(jsx_dev_runtime4.Fragment, {
1238
- children: [
1239
- lines.map((line, index) => {
1240
- const textWidth = Math.max(10, actualWidth - (maxTimestampWidth > 0 ? maxTimestampWidth + gap.length : 0));
1241
- return /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(ThemedText, {
1242
- children: [
1243
- maxTimestampWidth > 0 && /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(jsx_dev_runtime4.Fragment, {
1244
- children: [
1245
- /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(ThemedText, {
1246
- dimColor: true,
1247
- children: (line.timestamp || "").padEnd(maxTimestampWidth)
1248
- }, undefined, false, undefined, this),
1249
- gap
1250
- ]
1251
- }, undefined, true, undefined, this),
1252
- /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(ThemedText, {
1253
- children: truncate(line.text, textWidth)
1254
- }, undefined, false, undefined, this)
1255
- ]
1256
- }, index, true, undefined, this);
1257
- }),
1258
- footer && /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(ThemedText, {
1259
- dimColor: true,
1260
- italic: true,
1261
- children: truncate(footer, actualWidth)
1262
- }, undefined, false, undefined, this)
1263
- ]
1264
- }, undefined, true, undefined, this)
1265
- ]
1266
- }, undefined, true, undefined, this);
1267
- }
1268
- var jsx_dev_runtime4;
1269
- var init_Feed = __esm(() => {
1270
- init_src();
1271
- init_format();
1272
- jsx_dev_runtime4 = __toESM(require_jsx_dev_runtime(), 1);
1273
- });
1274
-
1275
- // src/components/LogoV2/FeedColumn.tsx
1276
- function FeedColumn({
1277
- feeds,
1278
- maxWidth
1279
- }) {
1280
- const feedWidths = feeds.map((feed) => calculateFeedWidth(feed));
1281
- const maxOfAllFeeds = Math.max(...feedWidths);
1282
- const actualWidth = Math.min(maxOfAllFeeds, maxWidth);
1283
- return /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(ThemedBox_default, {
1284
- flexDirection: "column",
1285
- children: feeds.map((feed, index) => /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(React3.Fragment, {
1286
- children: [
1287
- /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Feed, {
1288
- config: feed,
1289
- actualWidth
1290
- }, undefined, false, undefined, this),
1291
- index < feeds.length - 1 && /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Divider, {
1292
- color: "claude",
1293
- width: actualWidth
1294
- }, undefined, false, undefined, this)
1295
- ]
1296
- }, index, true, undefined, this))
1297
- }, undefined, false, undefined, this);
1298
- }
1299
- var React3, jsx_dev_runtime5;
1300
- var init_FeedColumn = __esm(() => {
1301
- init_src();
1302
- init_src();
1303
- init_Feed();
1304
- React3 = __toESM(require_react(), 1);
1305
- jsx_dev_runtime5 = __toESM(require_jsx_dev_runtime(), 1);
1306
- });
1307
-
1308
- // src/components/LogoV2/feedConfigs.tsx
1309
- import { homedir } from "os";
1310
- function createRecentActivityFeed(activities) {
1311
- const lines = activities.map((log) => {
1312
- const time = formatRelativeTimeAgo(log.modified);
1313
- const description = log.summary && log.summary !== "No prompt" ? log.summary : log.firstPrompt;
1314
- return {
1315
- text: description || "",
1316
- timestamp: time
1317
- };
1318
- });
1319
- return {
1320
- title: "Recent activity",
1321
- lines,
1322
- footer: lines.length > 0 ? "/resume for more" : undefined,
1323
- emptyMessage: "No recent activity"
1324
- };
1325
- }
1326
- function createWhatsNewFeed(releaseNotes) {
1327
- const lines = releaseNotes.map((note) => {
1328
- if (process.env.USER_TYPE === "ant") {
1329
- const match = note.match(/^(\d+\s+\w+\s+ago)\s+(.+)$/);
1330
- if (match) {
1331
- return {
1332
- timestamp: match[1],
1333
- text: match[2] || ""
1334
- };
1335
- }
1336
- }
1337
- return {
1338
- text: note
1339
- };
1340
- });
1341
- const emptyMessage = process.env.USER_TYPE === "ant" ? "Unable to fetch latest claude-cli-internal commits" : "Check the Claude Code changelog for updates";
1342
- return {
1343
- title: process.env.USER_TYPE === "ant" ? "What's new [ANT-ONLY: Latest CC commits]" : "What's new",
1344
- lines,
1345
- footer: lines.length > 0 ? "/release-notes for more" : undefined,
1346
- emptyMessage
1347
- };
1348
- }
1349
- function createProjectOnboardingFeed(steps) {
1350
- const enabledSteps = steps.filter(({ isEnabled }) => isEnabled).sort((a, b) => Number(a.isComplete) - Number(b.isComplete));
1351
- const lines = enabledSteps.map(({ text, isComplete }) => {
1352
- const checkmark = isComplete ? `${figures_default.tick} ` : "";
1353
- return {
1354
- text: `${checkmark}${text}`
1355
- };
1356
- });
1357
- const warningText = getCwd() === homedir() ? "Note: You have launched claude in your home directory. For the best experience, launch it in a project directory instead." : undefined;
1358
- if (warningText) {
1359
- lines.push({
1360
- text: warningText
1361
- });
1362
- }
1363
- return {
1364
- title: "Tips for getting started",
1365
- lines
1366
- };
1367
- }
1368
- function createGuestPassesFeed() {
1369
- const reward = getCachedReferrerReward();
1370
- const subtitle = reward ? `Share Claude Code and earn ${formatCreditAmount(reward)} of extra usage` : "Share Claude Code with friends";
1371
- return {
1372
- title: "3 guest passes",
1373
- lines: [],
1374
- customContent: {
1375
- content: /* @__PURE__ */ jsx_dev_runtime6.jsxDEV(jsx_dev_runtime6.Fragment, {
1376
- children: [
1377
- /* @__PURE__ */ jsx_dev_runtime6.jsxDEV(ThemedBox_default, {
1378
- marginY: 1,
1379
- children: /* @__PURE__ */ jsx_dev_runtime6.jsxDEV(ThemedText, {
1380
- color: "claude",
1381
- children: "[\u273B] [\u273B] [\u273B]"
1382
- }, undefined, false, undefined, this)
1383
- }, undefined, false, undefined, this),
1384
- /* @__PURE__ */ jsx_dev_runtime6.jsxDEV(ThemedText, {
1385
- dimColor: true,
1386
- children: subtitle
1387
- }, undefined, false, undefined, this)
1388
- ]
1389
- }, undefined, true, undefined, this),
1390
- width: 48
1391
- },
1392
- footer: "/passes"
1393
- };
1394
- }
1395
- var jsx_dev_runtime6;
1396
- var init_feedConfigs = __esm(() => {
1397
- init_figures();
1398
- init_src();
1399
- init_referral();
1400
- init_cwd();
1401
- init_format();
1402
- jsx_dev_runtime6 = __toESM(require_jsx_dev_runtime(), 1);
1403
- });
1404
-
1405
- // src/components/LogoV2/AnimatedClawd.tsx
1406
- function hold(pose, offset, frames) {
1407
- return Array.from({ length: frames }, () => ({ pose, offset }));
1408
- }
1409
- function AnimatedClawd() {
1410
- const { pose, bounceOffset, onClick } = useClawdAnimation();
1411
- return /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedBox_default, {
1412
- height: CLAWD_HEIGHT,
1413
- flexDirection: "column",
1414
- onClick,
1415
- children: /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedBox_default, {
1416
- marginTop: bounceOffset,
1417
- flexShrink: 0,
1418
- children: /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(Clawd, {
1419
- pose
1420
- }, undefined, false, undefined, this)
1421
- }, undefined, false, undefined, this)
1422
- }, undefined, false, undefined, this);
1423
- }
1424
- function useClawdAnimation() {
1425
- const [reducedMotion] = import_react3.useState(() => getInitialSettings().prefersReducedMotion ?? false);
1426
- const [frameIndex, setFrameIndex] = import_react3.useState(-1);
1427
- const sequenceRef = import_react3.useRef(JUMP_WAVE);
1428
- const onClick = () => {
1429
- if (reducedMotion || frameIndex !== -1)
1430
- return;
1431
- sequenceRef.current = CLICK_ANIMATIONS[Math.floor(Math.random() * CLICK_ANIMATIONS.length)];
1432
- setFrameIndex(0);
1433
- };
1434
- import_react3.useEffect(() => {
1435
- if (frameIndex === -1)
1436
- return;
1437
- if (frameIndex >= sequenceRef.current.length) {
1438
- setFrameIndex(-1);
1439
- return;
1440
- }
1441
- const timer = setTimeout(setFrameIndex, FRAME_MS, incrementFrame);
1442
- return () => clearTimeout(timer);
1443
- }, [frameIndex]);
1444
- const seq = sequenceRef.current;
1445
- const current = frameIndex >= 0 && frameIndex < seq.length ? seq[frameIndex] : IDLE;
1446
- return { pose: current.pose, bounceOffset: current.offset, onClick };
1447
- }
1448
- var import_react3, jsx_dev_runtime7, JUMP_WAVE, LOOK_AROUND, CLICK_ANIMATIONS, IDLE, FRAME_MS = 60, incrementFrame = (i) => i + 1, CLAWD_HEIGHT = 3;
1449
- var init_AnimatedClawd = __esm(() => {
1450
- init_src();
1451
- init_settings();
1452
- init_Clawd();
1453
- import_react3 = __toESM(require_react(), 1);
1454
- jsx_dev_runtime7 = __toESM(require_jsx_dev_runtime(), 1);
1455
- JUMP_WAVE = [
1456
- ...hold("default", 1, 2),
1457
- ...hold("arms-up", 0, 3),
1458
- ...hold("default", 0, 1),
1459
- ...hold("default", 1, 2),
1460
- ...hold("arms-up", 0, 3),
1461
- ...hold("default", 0, 1)
1462
- ];
1463
- LOOK_AROUND = [
1464
- ...hold("look-right", 0, 5),
1465
- ...hold("look-left", 0, 5),
1466
- ...hold("default", 0, 1)
1467
- ];
1468
- CLICK_ANIMATIONS = [JUMP_WAVE, LOOK_AROUND];
1469
- IDLE = { pose: "default", offset: 0 };
1470
- });
1471
-
1472
- // src/components/LogoV2/GuestPassesUpsell.tsx
1473
- function resetIfPassesRefreshed() {
1474
- const remaining = getCachedRemainingPasses();
1475
- if (remaining == null || remaining <= 0)
1476
- return;
1477
- const config = getGlobalConfig();
1478
- const lastSeen = config.passesLastSeenRemaining ?? 0;
1479
- if (remaining > lastSeen) {
1480
- saveGlobalConfig((prev) => ({
1481
- ...prev,
1482
- passesUpsellSeenCount: 0,
1483
- hasVisitedPasses: false,
1484
- passesLastSeenRemaining: remaining
1485
- }));
1486
- }
1487
- }
1488
- function shouldShowGuestPassesUpsell() {
1489
- const { eligible, hasCache } = checkCachedPassesEligibility();
1490
- if (!eligible || !hasCache)
1491
- return false;
1492
- resetIfPassesRefreshed();
1493
- const config = getGlobalConfig();
1494
- if ((config.passesUpsellSeenCount ?? 0) >= 3)
1495
- return false;
1496
- if (config.hasVisitedPasses)
1497
- return false;
1498
- return true;
1499
- }
1500
- function useShowGuestPassesUpsell() {
1501
- const [show] = import_react4.useState(() => shouldShowGuestPassesUpsell());
1502
- return show;
1503
- }
1504
- function incrementGuestPassesSeenCount() {
1505
- let newCount = 0;
1506
- saveGlobalConfig((prev) => {
1507
- newCount = (prev.passesUpsellSeenCount ?? 0) + 1;
1508
- return {
1509
- ...prev,
1510
- passesUpsellSeenCount: newCount
1511
- };
1512
- });
1513
- logEvent("tengu_guest_passes_upsell_shown", {
1514
- seen_count: newCount
1515
- });
1516
- }
1517
- function GuestPassesUpsell() {
1518
- const reward = getCachedReferrerReward();
1519
- return /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(ThemedText, {
1520
- dimColor: true,
1521
- children: [
1522
- /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(ThemedText, {
1523
- color: "claude",
1524
- children: "[\u273B]"
1525
- }, undefined, false, undefined, this),
1526
- " ",
1527
- /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(ThemedText, {
1528
- color: "claude",
1529
- children: "[\u273B]"
1530
- }, undefined, false, undefined, this),
1531
- " ",
1532
- /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(ThemedText, {
1533
- color: "claude",
1534
- children: "[\u273B]"
1535
- }, undefined, false, undefined, this),
1536
- " \xB7",
1537
- " ",
1538
- reward ? `Share Claude Code and earn ${formatCreditAmount(reward)} of extra usage \xB7 /passes` : "3 guest passes at /passes"
1539
- ]
1540
- }, undefined, true, undefined, this);
1541
- }
1542
- var import_react4, jsx_dev_runtime8;
1543
- var init_GuestPassesUpsell = __esm(() => {
1544
- init_src();
1545
- init_analytics();
1546
- init_referral();
1547
- init_config();
1548
- import_react4 = __toESM(require_react(), 1);
1549
- jsx_dev_runtime8 = __toESM(require_jsx_dev_runtime(), 1);
1550
- });
1551
-
1552
- // src/components/LogoV2/CondensedLogo.tsx
1553
- function CondensedLogo() {
1554
- const { columns } = useTerminalSize();
1555
- const agent = useAppState((s) => s.agent);
1556
- const effortValue = useAppState((s) => s.effortValue);
1557
- const model = useMainLoopModel();
1558
- const modelDisplayName = renderModelSetting(model);
1559
- const { version, cwd, billingType, agentName: agentNameFromSettings } = getLogoDisplayData();
1560
- const agentName = agent ?? agentNameFromSettings;
1561
- const showGuestPassesUpsell = useShowGuestPassesUpsell();
1562
- const showOverageCreditUpsell = useShowOverageCreditUpsell();
1563
- import_react5.useEffect(() => {
1564
- if (showGuestPassesUpsell) {
1565
- incrementGuestPassesSeenCount();
1566
- }
1567
- }, [showGuestPassesUpsell]);
1568
- import_react5.useEffect(() => {
1569
- if (showOverageCreditUpsell && !showGuestPassesUpsell) {
1570
- incrementOverageCreditUpsellSeenCount();
1571
- }
1572
- }, [showOverageCreditUpsell, showGuestPassesUpsell]);
1573
- const textWidth = Math.max(columns - 15, 20);
1574
- const versionPrefix = "Claude Code v";
1575
- const truncatedVersion = truncate(version, Math.max(textWidth - versionPrefix.length, 6));
1576
- const effortSuffix = getEffortSuffix(model, effortValue);
1577
- const { shouldSplit, truncatedModel, truncatedBilling } = formatModelAndBilling(modelDisplayName + effortSuffix, billingType, textWidth);
1578
- const separator = " \xB7 ";
1579
- const atPrefix = "@";
1580
- const cwdAvailableWidth = agentName ? textWidth - atPrefix.length - stringWidth(agentName) - separator.length : textWidth;
1581
- const truncatedCwd = truncatePath(cwd, Math.max(cwdAvailableWidth, 10));
1582
- return /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(OffscreenFreeze, {
1583
- children: /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(ThemedBox_default, {
1584
- flexDirection: "row",
1585
- gap: 2,
1586
- alignItems: "center",
1587
- children: [
1588
- isFullscreenEnvEnabled() ? /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(AnimatedClawd, {}, undefined, false, undefined, this) : /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(Clawd, {}, undefined, false, undefined, this),
1589
- /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(ThemedBox_default, {
1590
- flexDirection: "column",
1591
- children: [
1592
- /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(ThemedText, {
1593
- children: [
1594
- /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(ThemedText, {
1595
- bold: true,
1596
- children: "Claude Code"
1597
- }, undefined, false, undefined, this),
1598
- " ",
1599
- /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(ThemedText, {
1600
- dimColor: true,
1601
- children: [
1602
- "v",
1603
- truncatedVersion
1604
- ]
1605
- }, undefined, true, undefined, this)
1606
- ]
1607
- }, undefined, true, undefined, this),
1608
- shouldSplit ? /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(jsx_dev_runtime9.Fragment, {
1609
- children: [
1610
- /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(ThemedText, {
1611
- dimColor: true,
1612
- children: truncatedModel
1613
- }, undefined, false, undefined, this),
1614
- /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(ThemedText, {
1615
- dimColor: true,
1616
- children: truncatedBilling
1617
- }, undefined, false, undefined, this)
1618
- ]
1619
- }, undefined, true, undefined, this) : /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(ThemedText, {
1620
- dimColor: true,
1621
- children: [
1622
- truncatedModel,
1623
- " \xB7 ",
1624
- truncatedBilling
1625
- ]
1626
- }, undefined, true, undefined, this),
1627
- /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(ThemedText, {
1628
- dimColor: true,
1629
- children: agentName ? `@${agentName} \xB7 ${truncatedCwd}` : truncatedCwd
1630
- }, undefined, false, undefined, this),
1631
- showGuestPassesUpsell && /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(GuestPassesUpsell, {}, undefined, false, undefined, this),
1632
- !showGuestPassesUpsell && showOverageCreditUpsell && /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(OverageCreditUpsell, {
1633
- maxWidth: textWidth,
1634
- twoLine: true
1635
- }, undefined, false, undefined, this)
1636
- ]
1637
- }, undefined, true, undefined, this)
1638
- ]
1639
- }, undefined, true, undefined, this)
1640
- }, undefined, false, undefined, this);
1641
- }
1642
- var import_react5, jsx_dev_runtime9;
1643
- var init_CondensedLogo = __esm(() => {
1644
- init_useMainLoopModel();
1645
- init_useTerminalSize();
1646
- init_src();
1647
- init_AppState();
1648
- init_effort();
1649
- init_format();
1650
- init_fullscreen();
1651
- init_logoV2Utils();
1652
- init_model();
1653
- init_OffscreenFreeze();
1654
- init_AnimatedClawd();
1655
- init_Clawd();
1656
- init_GuestPassesUpsell();
1657
- init_OverageCreditUpsell();
1658
- import_react5 = __toESM(require_react(), 1);
1659
- jsx_dev_runtime9 = __toESM(require_jsx_dev_runtime(), 1);
1660
- });
1661
-
1662
- // src/components/LogoV2/EmergencyTip.tsx
1663
- function EmergencyTip() {
1664
- const tip = import_react6.useMemo(getTipOfFeed, []);
1665
- const lastShownTip = import_react6.useMemo(() => getGlobalConfig().lastShownEmergencyTip, []);
1666
- const shouldShow = tip.tip && tip.tip !== lastShownTip;
1667
- import_react6.useEffect(() => {
1668
- if (shouldShow) {
1669
- saveGlobalConfig((current) => {
1670
- if (current.lastShownEmergencyTip === tip.tip)
1671
- return current;
1672
- return { ...current, lastShownEmergencyTip: tip.tip };
1673
- });
1674
- }
1675
- }, [shouldShow, tip.tip]);
1676
- if (!shouldShow) {
1677
- return null;
1678
- }
1679
- return /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(ThemedBox_default, {
1680
- paddingLeft: 2,
1681
- flexDirection: "column",
1682
- children: /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(ThemedText, {
1683
- ...tip.color === "warning" ? { color: "warning" } : tip.color === "error" ? { color: "error" } : { dimColor: true },
1684
- children: tip.tip
1685
- }, undefined, false, undefined, this)
1686
- }, undefined, false, undefined, this);
1687
- }
1688
- function getTipOfFeed() {
1689
- return getDynamicConfig_CACHED_MAY_BE_STALE(CONFIG_NAME, DEFAULT_TIP);
1690
- }
1691
- var import_react6, jsx_dev_runtime10, CONFIG_NAME = "tengu-top-of-feed-tip", DEFAULT_TIP;
1692
- var init_EmergencyTip = __esm(() => {
1693
- init_src();
1694
- init_growthbook();
1695
- init_config();
1696
- import_react6 = __toESM(require_react(), 1);
1697
- jsx_dev_runtime10 = __toESM(require_jsx_dev_runtime(), 1);
1698
- DEFAULT_TIP = { tip: "", color: "dim" };
1699
- });
1700
-
1701
- // src/components/LogoV2/AnimatedAsterisk.tsx
1702
- function AnimatedAsterisk({
1703
- char = TEARDROP_ASTERISK
1704
- }) {
1705
- const [reducedMotion] = import_react7.useState(() => getInitialSettings().prefersReducedMotion ?? false);
1706
- const [done, setDone] = import_react7.useState(reducedMotion);
1707
- const startTimeRef = import_react7.useRef(null);
1708
- const [ref, time] = useAnimationFrame(done ? null : 50);
1709
- import_react7.useEffect(() => {
1710
- if (done)
1711
- return;
1712
- const t = setTimeout(setDone, TOTAL_ANIMATION_MS, true);
1713
- return () => clearTimeout(t);
1714
- }, [done]);
1715
- if (done) {
1716
- return /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(ThemedBox_default, {
1717
- ref,
1718
- children: /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(ThemedText, {
1719
- color: SETTLED_GREY,
1720
- children: char
1721
- }, undefined, false, undefined, this)
1722
- }, undefined, false, undefined, this);
1723
- }
1724
- if (startTimeRef.current === null) {
1725
- startTimeRef.current = time;
1726
- }
1727
- const elapsed = time - startTimeRef.current;
1728
- const hue = elapsed / SWEEP_DURATION_MS * 360 % 360;
1729
- return /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(ThemedBox_default, {
1730
- ref,
1731
- children: /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(ThemedText, {
1732
- color: toRGBColor(hueToRgb(hue)),
1733
- children: char
1734
- }, undefined, false, undefined, this)
1735
- }, undefined, false, undefined, this);
1736
- }
1737
- var import_react7, jsx_dev_runtime11, SWEEP_DURATION_MS = 1500, SWEEP_COUNT = 2, TOTAL_ANIMATION_MS, SETTLED_GREY;
1738
- var init_AnimatedAsterisk = __esm(() => {
1739
- init_figures2();
1740
- init_src();
1741
- init_settings();
1742
- init_utils();
1743
- import_react7 = __toESM(require_react(), 1);
1744
- jsx_dev_runtime11 = __toESM(require_jsx_dev_runtime(), 1);
1745
- TOTAL_ANIMATION_MS = SWEEP_DURATION_MS * SWEEP_COUNT;
1746
- SETTLED_GREY = toRGBColor({ r: 153, g: 153, b: 153 });
1747
- });
1748
-
1749
- // src/components/LogoV2/Opus1mMergeNotice.tsx
1750
- function shouldShowOpus1mMergeNotice() {
1751
- return isOpus1mMergeEnabled() && (getGlobalConfig().opus1mMergeNoticeSeenCount ?? 0) < MAX_SHOW_COUNT;
1752
- }
1753
- function Opus1mMergeNotice() {
1754
- const [show] = import_react8.useState(shouldShowOpus1mMergeNotice);
1755
- import_react8.useEffect(() => {
1756
- if (!show)
1757
- return;
1758
- const newCount = (getGlobalConfig().opus1mMergeNoticeSeenCount ?? 0) + 1;
1759
- saveGlobalConfig((prev) => {
1760
- if ((prev.opus1mMergeNoticeSeenCount ?? 0) >= newCount)
1761
- return prev;
1762
- return { ...prev, opus1mMergeNoticeSeenCount: newCount };
1763
- });
1764
- }, [show]);
1765
- if (!show)
1766
- return null;
1767
- return /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedBox_default, {
1768
- paddingLeft: 2,
1769
- children: [
1770
- /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(AnimatedAsterisk, {
1771
- char: UP_ARROW
1772
- }, undefined, false, undefined, this),
1773
- /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedText, {
1774
- dimColor: true,
1775
- children: [
1776
- " ",
1777
- "Opus now defaults to 1M context \xB7 5x more room, same pricing"
1778
- ]
1779
- }, undefined, true, undefined, this)
1780
- ]
1781
- }, undefined, true, undefined, this);
1782
- }
1783
- var import_react8, jsx_dev_runtime12, MAX_SHOW_COUNT = 6;
1784
- var init_Opus1mMergeNotice = __esm(() => {
1785
- init_figures2();
1786
- init_src();
1787
- init_config();
1788
- init_model();
1789
- init_AnimatedAsterisk();
1790
- import_react8 = __toESM(require_react(), 1);
1791
- jsx_dev_runtime12 = __toESM(require_jsx_dev_runtime(), 1);
1792
- });
1793
-
1794
- // src/components/LogoV2/GateOverridesWarning.tsx
1795
- function GateOverridesWarning() {
1796
- return null;
1797
- }
1798
- var init_GateOverridesWarning = () => {};
1799
-
1800
- // src/components/LogoV2/ExperimentEnrollmentNotice.tsx
1801
- function ExperimentEnrollmentNotice() {
1802
- return null;
1803
- }
1804
- var init_ExperimentEnrollmentNotice = () => {};
1805
-
1806
- // src/components/LogoV2/LogoV2.tsx
1807
- function LogoV2() {
1808
- const activities = getRecentActivitySync();
1809
- const username = getGlobalConfig().oauthAccount?.displayName ?? "";
1810
- const { columns } = useTerminalSize();
1811
- const showOnboarding = shouldShowProjectOnboarding();
1812
- const showSandboxStatus = SandboxManager.isSandboxingEnabled();
1813
- const showGuestPassesUpsell = useShowGuestPassesUpsell();
1814
- const showOverageCreditUpsell = useShowOverageCreditUpsell();
1815
- const agent = useAppState((s) => s.agent);
1816
- const effortValue = useAppState((s) => s.effortValue);
1817
- const config = getGlobalConfig();
1818
- let changelog;
1819
- try {
1820
- changelog = getRecentReleaseNotesSync(3);
1821
- } catch {
1822
- changelog = [];
1823
- }
1824
- const [announcement] = import_react9.useState(() => {
1825
- const announcements = getInitialSettings().companyAnnouncements;
1826
- if (!announcements || announcements.length === 0)
1827
- return;
1828
- return config.numStartups === 1 ? announcements[0] : announcements[Math.floor(Math.random() * announcements.length)];
1829
- });
1830
- const { hasReleaseNotes } = checkForReleaseNotesSync(config.lastReleaseNotesSeen);
1831
- import_react9.useEffect(() => {
1832
- const currentConfig = getGlobalConfig();
1833
- if (currentConfig.lastReleaseNotesSeen === "0.0.24") {
1834
- return;
1835
- }
1836
- saveGlobalConfig((current) => {
1837
- if (current.lastReleaseNotesSeen === "0.0.24")
1838
- return current;
1839
- return { ...current, lastReleaseNotesSeen: "0.0.24" };
1840
- });
1841
- if (showOnboarding) {
1842
- incrementProjectOnboardingSeenCount();
1843
- }
1844
- }, [config, showOnboarding]);
1845
- const isCondensedMode = !hasReleaseNotes && !showOnboarding && !isEnvTruthy(process.env.CLAUDE_CODE_FORCE_FULL_LOGO);
1846
- import_react9.useEffect(() => {
1847
- if (showGuestPassesUpsell && !showOnboarding && !isCondensedMode) {
1848
- incrementGuestPassesSeenCount();
1849
- }
1850
- }, [showGuestPassesUpsell, showOnboarding, isCondensedMode]);
1851
- import_react9.useEffect(() => {
1852
- if (showOverageCreditUpsell && !showOnboarding && !showGuestPassesUpsell && !isCondensedMode) {
1853
- incrementOverageCreditUpsellSeenCount();
1854
- }
1855
- }, [
1856
- showOverageCreditUpsell,
1857
- showOnboarding,
1858
- showGuestPassesUpsell,
1859
- isCondensedMode
1860
- ]);
1861
- const model = useMainLoopModel();
1862
- const fullModelDisplayName = renderModelSetting(model);
1863
- const {
1864
- version,
1865
- cwd,
1866
- billingType,
1867
- agentName: agentNameFromSettings
1868
- } = getLogoDisplayData();
1869
- const agentName = agent ?? agentNameFromSettings;
1870
- const effortSuffix = getEffortSuffix(model, effortValue);
1871
- const modelDisplayName = truncate(fullModelDisplayName + effortSuffix, LEFT_PANEL_MAX_WIDTH - 20);
1872
- if (!hasReleaseNotes && !showOnboarding && !isEnvTruthy(process.env.CLAUDE_CODE_FORCE_FULL_LOGO)) {
1873
- return /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(jsx_dev_runtime13.Fragment, {
1874
- children: [
1875
- /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(CondensedLogo, {}, undefined, false, undefined, this),
1876
- /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(Opus1mMergeNotice, {}, undefined, false, undefined, this),
1877
- ChannelsNoticeModule && /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(ChannelsNoticeModule.ChannelsNotice, {}, undefined, false, undefined, this),
1878
- isDebugMode() && /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(ThemedBox_default, {
1879
- paddingLeft: 2,
1880
- flexDirection: "column",
1881
- children: [
1882
- /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(ThemedText, {
1883
- color: "warning",
1884
- children: "Debug mode enabled"
1885
- }, undefined, false, undefined, this),
1886
- /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(ThemedText, {
1887
- dimColor: true,
1888
- children: [
1889
- "Logging to: ",
1890
- isDebugToStdErr() ? "stderr" : getDebugLogPath()
1891
- ]
1892
- }, undefined, true, undefined, this)
1893
- ]
1894
- }, undefined, true, undefined, this),
1895
- /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(EmergencyTip, {}, undefined, false, undefined, this),
1896
- process.env.CLAUDE_CODE_TMUX_SESSION && /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(ThemedBox_default, {
1897
- paddingLeft: 2,
1898
- flexDirection: "column",
1899
- children: [
1900
- /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(ThemedText, {
1901
- dimColor: true,
1902
- children: [
1903
- "tmux session: ",
1904
- process.env.CLAUDE_CODE_TMUX_SESSION
1905
- ]
1906
- }, undefined, true, undefined, this),
1907
- /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(ThemedText, {
1908
- dimColor: true,
1909
- children: process.env.CLAUDE_CODE_TMUX_PREFIX_CONFLICTS ? `Detach: ${process.env.CLAUDE_CODE_TMUX_PREFIX} ${process.env.CLAUDE_CODE_TMUX_PREFIX} d (press prefix twice - Claude uses ${process.env.CLAUDE_CODE_TMUX_PREFIX})` : `Detach: ${process.env.CLAUDE_CODE_TMUX_PREFIX} d`
1910
- }, undefined, false, undefined, this)
1911
- ]
1912
- }, undefined, true, undefined, this),
1913
- announcement && /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(ThemedBox_default, {
1914
- paddingLeft: 2,
1915
- flexDirection: "column",
1916
- children: [
1917
- !process.env.IS_DEMO && config.oauthAccount?.organizationName && /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(ThemedText, {
1918
- dimColor: true,
1919
- children: [
1920
- "Message from ",
1921
- config.oauthAccount.organizationName,
1922
- ":"
1923
- ]
1924
- }, undefined, true, undefined, this),
1925
- /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(ThemedText, {
1926
- children: announcement
1927
- }, undefined, false, undefined, this)
1928
- ]
1929
- }, undefined, true, undefined, this),
1930
- process.env.USER_TYPE === "ant" && !process.env.DEMO_VERSION && /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(ThemedBox_default, {
1931
- paddingLeft: 2,
1932
- flexDirection: "column",
1933
- children: /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(ThemedText, {
1934
- dimColor: true,
1935
- children: "Use /issue to report model behavior issues"
1936
- }, undefined, false, undefined, this)
1937
- }, undefined, false, undefined, this),
1938
- process.env.USER_TYPE === "ant" && !process.env.DEMO_VERSION && /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(ThemedBox_default, {
1939
- paddingLeft: 2,
1940
- flexDirection: "column",
1941
- children: [
1942
- /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(ThemedText, {
1943
- color: "warning",
1944
- children: "[ANT-ONLY] Logs:"
1945
- }, undefined, false, undefined, this),
1946
- /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(ThemedText, {
1947
- dimColor: true,
1948
- children: [
1949
- "API calls: ",
1950
- getDisplayPath(getDumpPromptsPath())
1951
- ]
1952
- }, undefined, true, undefined, this),
1953
- /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(ThemedText, {
1954
- dimColor: true,
1955
- children: [
1956
- "Debug logs: ",
1957
- getDisplayPath(getDebugLogPath())
1958
- ]
1959
- }, undefined, true, undefined, this),
1960
- isDetailedProfilingEnabled() && /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(ThemedText, {
1961
- dimColor: true,
1962
- children: [
1963
- "Startup Perf: ",
1964
- getDisplayPath(getStartupPerfLogPath())
1965
- ]
1966
- }, undefined, true, undefined, this)
1967
- ]
1968
- }, undefined, true, undefined, this),
1969
- process.env.USER_TYPE === "ant" && /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(GateOverridesWarning, {}, undefined, false, undefined, this),
1970
- process.env.USER_TYPE === "ant" && /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(ExperimentEnrollmentNotice, {}, undefined, false, undefined, this)
1971
- ]
1972
- }, undefined, true, undefined, this);
1973
- }
1974
- const layoutMode = getLayoutMode(columns);
1975
- const userTheme = resolveThemeSetting(getGlobalConfig().theme);
1976
- const borderTitle = ` ${color("claude", userTheme)("Claude Code")} ${color("inactive", userTheme)(`v${version}`)} `;
1977
- const compactBorderTitle = color("claude", userTheme)(" Claude Code ");
1978
- if (layoutMode === "compact") {
1979
- const layoutWidth = 4;
1980
- let welcomeMessage2 = formatWelcomeMessage(username);
1981
- if (stringWidth(welcomeMessage2) > columns - layoutWidth) {
1982
- welcomeMessage2 = formatWelcomeMessage(null);
1983
- }
1984
- const separator = " \xB7 ";
1985
- const atPrefix = "@";
1986
- const cwdAvailableWidth2 = agentName ? columns - layoutWidth - atPrefix.length - stringWidth(agentName) - separator.length : columns - layoutWidth;
1987
- const truncatedCwd2 = truncatePath(cwd, Math.max(cwdAvailableWidth2, 10));
1988
- return /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(jsx_dev_runtime13.Fragment, {
1989
- children: [
1990
- /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(OffscreenFreeze, {
1991
- children: /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(ThemedBox_default, {
1992
- flexDirection: "column",
1993
- borderStyle: "round",
1994
- borderColor: "claude",
1995
- borderText: {
1996
- content: compactBorderTitle,
1997
- position: "top",
1998
- align: "start",
1999
- offset: 1
2000
- },
2001
- paddingX: 1,
2002
- paddingY: 1,
2003
- alignItems: "center",
2004
- width: columns,
2005
- children: [
2006
- /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(ThemedText, {
2007
- bold: true,
2008
- children: welcomeMessage2
2009
- }, undefined, false, undefined, this),
2010
- /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(ThemedBox_default, {
2011
- marginY: 1,
2012
- children: /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(Clawd, {}, undefined, false, undefined, this)
2013
- }, undefined, false, undefined, this),
2014
- /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(ThemedText, {
2015
- dimColor: true,
2016
- children: modelDisplayName
2017
- }, undefined, false, undefined, this),
2018
- /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(ThemedText, {
2019
- dimColor: true,
2020
- children: billingType
2021
- }, undefined, false, undefined, this),
2022
- /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(ThemedText, {
2023
- dimColor: true,
2024
- children: agentName ? `@${agentName} \xB7 ${truncatedCwd2}` : truncatedCwd2
2025
- }, undefined, false, undefined, this)
2026
- ]
2027
- }, undefined, true, undefined, this)
2028
- }, undefined, false, undefined, this),
2029
- /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(Opus1mMergeNotice, {}, undefined, false, undefined, this),
2030
- ChannelsNoticeModule && /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(ChannelsNoticeModule.ChannelsNotice, {}, undefined, false, undefined, this),
2031
- showSandboxStatus && /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(ThemedBox_default, {
2032
- marginTop: 1,
2033
- flexDirection: "column",
2034
- children: /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(ThemedText, {
2035
- color: "warning",
2036
- children: "Your bash commands will be sandboxed. Disable with /sandbox."
2037
- }, undefined, false, undefined, this)
2038
- }, undefined, false, undefined, this),
2039
- process.env.USER_TYPE === "ant" && /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(GateOverridesWarning, {}, undefined, false, undefined, this),
2040
- process.env.USER_TYPE === "ant" && /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(ExperimentEnrollmentNotice, {}, undefined, false, undefined, this)
2041
- ]
2042
- }, undefined, true, undefined, this);
2043
- }
2044
- const welcomeMessage = formatWelcomeMessage(username);
2045
- const modelLine = !process.env.IS_DEMO && config.oauthAccount?.organizationName ? `${modelDisplayName} \xB7 ${billingType} \xB7 ${config.oauthAccount.organizationName}` : `${modelDisplayName} \xB7 ${billingType}`;
2046
- const cwdSeparator = " \xB7 ";
2047
- const cwdAtPrefix = "@";
2048
- const cwdAvailableWidth = agentName ? LEFT_PANEL_MAX_WIDTH - cwdAtPrefix.length - stringWidth(agentName) - cwdSeparator.length : LEFT_PANEL_MAX_WIDTH;
2049
- const truncatedCwd = truncatePath(cwd, Math.max(cwdAvailableWidth, 10));
2050
- const cwdLine = agentName ? `@${agentName} \xB7 ${truncatedCwd}` : truncatedCwd;
2051
- const optimalLeftWidth = calculateOptimalLeftWidth(welcomeMessage, cwdLine, modelLine);
2052
- const { leftWidth, rightWidth } = calculateLayoutDimensions(columns, layoutMode, optimalLeftWidth);
2053
- return /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(jsx_dev_runtime13.Fragment, {
2054
- children: [
2055
- /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(OffscreenFreeze, {
2056
- children: /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(ThemedBox_default, {
2057
- flexDirection: "column",
2058
- borderStyle: "round",
2059
- borderColor: "claude",
2060
- borderText: {
2061
- content: borderTitle,
2062
- position: "top",
2063
- align: "start",
2064
- offset: 3
2065
- },
2066
- children: /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(ThemedBox_default, {
2067
- flexDirection: layoutMode === "horizontal" ? "row" : "column",
2068
- paddingX: 1,
2069
- gap: 1,
2070
- children: [
2071
- /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(ThemedBox_default, {
2072
- flexDirection: "column",
2073
- width: leftWidth,
2074
- justifyContent: "space-between",
2075
- alignItems: "center",
2076
- minHeight: 9,
2077
- children: [
2078
- /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(ThemedBox_default, {
2079
- marginTop: 1,
2080
- children: /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(ThemedText, {
2081
- bold: true,
2082
- children: welcomeMessage
2083
- }, undefined, false, undefined, this)
2084
- }, undefined, false, undefined, this),
2085
- /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(Clawd, {}, undefined, false, undefined, this),
2086
- /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(ThemedBox_default, {
2087
- flexDirection: "column",
2088
- alignItems: "center",
2089
- children: [
2090
- /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(ThemedText, {
2091
- dimColor: true,
2092
- children: modelLine
2093
- }, undefined, false, undefined, this),
2094
- /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(ThemedText, {
2095
- dimColor: true,
2096
- children: cwdLine
2097
- }, undefined, false, undefined, this)
2098
- ]
2099
- }, undefined, true, undefined, this)
2100
- ]
2101
- }, undefined, true, undefined, this),
2102
- layoutMode === "horizontal" && /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(ThemedBox_default, {
2103
- height: "100%",
2104
- borderStyle: "single",
2105
- borderColor: "claude",
2106
- borderDimColor: true,
2107
- borderTop: false,
2108
- borderBottom: false,
2109
- borderLeft: false
2110
- }, undefined, false, undefined, this),
2111
- layoutMode === "horizontal" && /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(FeedColumn, {
2112
- feeds: showOnboarding ? [
2113
- createProjectOnboardingFeed(getSteps()),
2114
- createRecentActivityFeed(activities)
2115
- ] : showGuestPassesUpsell ? [
2116
- createRecentActivityFeed(activities),
2117
- createGuestPassesFeed()
2118
- ] : showOverageCreditUpsell ? [
2119
- createRecentActivityFeed(activities),
2120
- createOverageCreditFeed()
2121
- ] : [
2122
- createRecentActivityFeed(activities),
2123
- createWhatsNewFeed(changelog)
2124
- ],
2125
- maxWidth: rightWidth
2126
- }, undefined, false, undefined, this)
2127
- ]
2128
- }, undefined, true, undefined, this)
2129
- }, undefined, false, undefined, this)
2130
- }, undefined, false, undefined, this),
2131
- /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(Opus1mMergeNotice, {}, undefined, false, undefined, this),
2132
- ChannelsNoticeModule && /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(ChannelsNoticeModule.ChannelsNotice, {}, undefined, false, undefined, this),
2133
- isDebugMode() && /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(ThemedBox_default, {
2134
- paddingLeft: 2,
2135
- flexDirection: "column",
2136
- children: [
2137
- /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(ThemedText, {
2138
- color: "warning",
2139
- children: "Debug mode enabled"
2140
- }, undefined, false, undefined, this),
2141
- /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(ThemedText, {
2142
- dimColor: true,
2143
- children: [
2144
- "Logging to: ",
2145
- isDebugToStdErr() ? "stderr" : getDebugLogPath()
2146
- ]
2147
- }, undefined, true, undefined, this)
2148
- ]
2149
- }, undefined, true, undefined, this),
2150
- /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(EmergencyTip, {}, undefined, false, undefined, this),
2151
- process.env.CLAUDE_CODE_TMUX_SESSION && /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(ThemedBox_default, {
2152
- paddingLeft: 2,
2153
- flexDirection: "column",
2154
- children: [
2155
- /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(ThemedText, {
2156
- dimColor: true,
2157
- children: [
2158
- "tmux session: ",
2159
- process.env.CLAUDE_CODE_TMUX_SESSION
2160
- ]
2161
- }, undefined, true, undefined, this),
2162
- /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(ThemedText, {
2163
- dimColor: true,
2164
- children: process.env.CLAUDE_CODE_TMUX_PREFIX_CONFLICTS ? `Detach: ${process.env.CLAUDE_CODE_TMUX_PREFIX} ${process.env.CLAUDE_CODE_TMUX_PREFIX} d (press prefix twice - Claude uses ${process.env.CLAUDE_CODE_TMUX_PREFIX})` : `Detach: ${process.env.CLAUDE_CODE_TMUX_PREFIX} d`
2165
- }, undefined, false, undefined, this)
2166
- ]
2167
- }, undefined, true, undefined, this),
2168
- announcement && /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(ThemedBox_default, {
2169
- paddingLeft: 2,
2170
- flexDirection: "column",
2171
- children: [
2172
- !process.env.IS_DEMO && config.oauthAccount?.organizationName && /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(ThemedText, {
2173
- dimColor: true,
2174
- children: [
2175
- "Message from ",
2176
- config.oauthAccount.organizationName,
2177
- ":"
2178
- ]
2179
- }, undefined, true, undefined, this),
2180
- /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(ThemedText, {
2181
- children: announcement
2182
- }, undefined, false, undefined, this)
2183
- ]
2184
- }, undefined, true, undefined, this),
2185
- showSandboxStatus && /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(ThemedBox_default, {
2186
- paddingLeft: 2,
2187
- flexDirection: "column",
2188
- children: /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(ThemedText, {
2189
- color: "warning",
2190
- children: "Your bash commands will be sandboxed. Disable with /sandbox."
2191
- }, undefined, false, undefined, this)
2192
- }, undefined, false, undefined, this),
2193
- process.env.USER_TYPE === "ant" && !process.env.DEMO_VERSION && /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(ThemedBox_default, {
2194
- paddingLeft: 2,
2195
- flexDirection: "column",
2196
- children: /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(ThemedText, {
2197
- dimColor: true,
2198
- children: "Use /issue to report model behavior issues"
2199
- }, undefined, false, undefined, this)
2200
- }, undefined, false, undefined, this),
2201
- process.env.USER_TYPE === "ant" && !process.env.DEMO_VERSION && /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(ThemedBox_default, {
2202
- paddingLeft: 2,
2203
- flexDirection: "column",
2204
- children: [
2205
- /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(ThemedText, {
2206
- color: "warning",
2207
- children: "[ANT-ONLY] Logs:"
2208
- }, undefined, false, undefined, this),
2209
- /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(ThemedText, {
2210
- dimColor: true,
2211
- children: [
2212
- "API calls: ",
2213
- getDisplayPath(getDumpPromptsPath())
2214
- ]
2215
- }, undefined, true, undefined, this),
2216
- /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(ThemedText, {
2217
- dimColor: true,
2218
- children: [
2219
- "Debug logs: ",
2220
- getDisplayPath(getDebugLogPath())
2221
- ]
2222
- }, undefined, true, undefined, this),
2223
- isDetailedProfilingEnabled() && /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(ThemedText, {
2224
- dimColor: true,
2225
- children: [
2226
- "Startup Perf: ",
2227
- getDisplayPath(getStartupPerfLogPath())
2228
- ]
2229
- }, undefined, true, undefined, this)
2230
- ]
2231
- }, undefined, true, undefined, this),
2232
- process.env.USER_TYPE === "ant" && /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(GateOverridesWarning, {}, undefined, false, undefined, this),
2233
- process.env.USER_TYPE === "ant" && /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(ExperimentEnrollmentNotice, {}, undefined, false, undefined, this)
2234
- ]
2235
- }, undefined, true, undefined, this);
2236
- }
2237
- var import_react9, jsx_dev_runtime13, ChannelsNoticeModule = null, LEFT_PANEL_MAX_WIDTH = 50;
2238
- var init_LogoV2 = __esm(() => {
2239
- init_src();
2240
- init_useTerminalSize();
2241
- init_logoV2Utils();
2242
- init_format();
2243
- init_file();
2244
- init_Clawd();
2245
- init_FeedColumn();
2246
- init_feedConfigs();
2247
- init_config();
2248
- init_systemTheme();
2249
- init_settings();
2250
- init_debug();
2251
- init_projectOnboardingState();
2252
- init_CondensedLogo();
2253
- init_OffscreenFreeze();
2254
- init_releaseNotes();
2255
- init_dumpPrompts();
2256
- init_envUtils();
2257
- init_startupProfiler();
2258
- init_EmergencyTip();
2259
- init_Opus1mMergeNotice();
2260
- init_GateOverridesWarning();
2261
- init_ExperimentEnrollmentNotice();
2262
- init_sandbox_adapter();
2263
- init_GuestPassesUpsell();
2264
- init_OverageCreditUpsell();
2265
- init_AppState();
2266
- init_effort();
2267
- init_useMainLoopModel();
2268
- init_model();
2269
- import_react9 = __toESM(require_react(), 1);
2270
- jsx_dev_runtime13 = __toESM(require_jsx_dev_runtime(), 1);
2271
- });
2272
-
2273
- // src/components/MessageModel.tsx
2274
- function MessageModel({
2275
- message,
2276
- isTranscriptMode
2277
- }) {
2278
- const shouldShowModel = isTranscriptMode && message.type === "assistant" && message.message.model && message.message.content.some((c) => c.type === "text");
2279
- if (!shouldShowModel) {
2280
- return null;
2281
- }
2282
- return /* @__PURE__ */ jsx_dev_runtime14.jsxDEV(ThemedBox_default, {
2283
- minWidth: stringWidth(message.message.model) + 8,
2284
- children: /* @__PURE__ */ jsx_dev_runtime14.jsxDEV(ThemedText, {
2285
- dimColor: true,
2286
- children: message.message.model
2287
- }, undefined, false, undefined, this)
2288
- }, undefined, false, undefined, this);
2289
- }
2290
- var jsx_dev_runtime14;
2291
- var init_MessageModel = __esm(() => {
2292
- init_src();
2293
- jsx_dev_runtime14 = __toESM(require_jsx_dev_runtime(), 1);
2294
- });
2295
-
2296
- // src/components/MessageTimestamp.tsx
2297
- function MessageTimestamp({
2298
- message,
2299
- isTranscriptMode
2300
- }) {
2301
- const shouldShowTimestamp = isTranscriptMode && message.timestamp && message.type === "assistant" && message.message.content.some((c) => c.type === "text");
2302
- if (!shouldShowTimestamp) {
2303
- return null;
2304
- }
2305
- const formattedTimestamp = new Date(message.timestamp).toLocaleTimeString("en-US", {
2306
- hour: "2-digit",
2307
- minute: "2-digit",
2308
- hour12: true
2309
- });
2310
- return /* @__PURE__ */ jsx_dev_runtime15.jsxDEV(ThemedBox_default, {
2311
- minWidth: stringWidth(formattedTimestamp),
2312
- children: /* @__PURE__ */ jsx_dev_runtime15.jsxDEV(ThemedText, {
2313
- dimColor: true,
2314
- children: formattedTimestamp
2315
- }, undefined, false, undefined, this)
2316
- }, undefined, false, undefined, this);
2317
- }
2318
- var jsx_dev_runtime15;
2319
- var init_MessageTimestamp = __esm(() => {
2320
- init_src();
2321
- jsx_dev_runtime15 = __toESM(require_jsx_dev_runtime(), 1);
2322
- });
2323
-
2324
- // src/components/MessageRow.tsx
2325
- function hasContentAfterIndex(messages, index, tools, streamingToolUseIDs) {
2326
- for (let i = index + 1;i < messages.length; i++) {
2327
- const msg = messages[i];
2328
- if (msg?.type === "assistant") {
2329
- const content = msg.message.content[0];
2330
- if (content?.type === "thinking" || content?.type === "redacted_thinking") {
2331
- continue;
2332
- }
2333
- if (content?.type === "tool_use") {
2334
- if (getToolSearchOrReadInfo(content.name, content.input, tools).isCollapsible) {
2335
- continue;
2336
- }
2337
- if (streamingToolUseIDs.has(content.id)) {
2338
- continue;
2339
- }
2340
- }
2341
- return true;
2342
- }
2343
- if (msg?.type === "system" || msg?.type === "attachment") {
2344
- continue;
2345
- }
2346
- if (msg?.type === "user") {
2347
- const content = msg.message.content[0];
2348
- if (content?.type === "tool_result") {
2349
- continue;
2350
- }
2351
- }
2352
- if (msg?.type === "grouped_tool_use") {
2353
- const firstInput = msg.messages[0]?.message.content[0]?.input;
2354
- if (getToolSearchOrReadInfo(msg.toolName, firstInput, tools).isCollapsible) {
2355
- continue;
2356
- }
2357
- }
2358
- return true;
2359
- }
2360
- return false;
2361
- }
2362
- function MessageRowImpl({
2363
- message: msg,
2364
- isUserContinuation,
2365
- hasContentAfter,
2366
- tools,
2367
- commands,
2368
- verbose,
2369
- inProgressToolUseIDs,
2370
- streamingToolUseIDs,
2371
- screen,
2372
- canAnimate,
2373
- onOpenRateLimitOptions,
2374
- lastThinkingBlockId,
2375
- latestBashOutputUUID,
2376
- columns,
2377
- isLoading,
2378
- lookups
2379
- }) {
2380
- const isTranscriptMode = screen === "transcript";
2381
- const isGrouped = msg.type === "grouped_tool_use";
2382
- const isCollapsed = msg.type === "collapsed_read_search";
2383
- const isActiveCollapsedGroup = isCollapsed && (hasAnyToolInProgress(msg, inProgressToolUseIDs) || isLoading && !hasContentAfter);
2384
- const displayMsg = isGrouped ? msg.displayMessage : isCollapsed ? getDisplayMessageFromCollapsed(msg) : msg;
2385
- const progressMessagesForMessage = isGrouped || isCollapsed ? [] : getProgressMessagesFromLookup(msg, lookups);
2386
- const siblingToolUseIDs = isGrouped || isCollapsed ? EMPTY_STRING_SET : getSiblingToolUseIDsFromLookup(msg, lookups);
2387
- const isStatic = shouldRenderStatically(msg, streamingToolUseIDs, inProgressToolUseIDs, siblingToolUseIDs, screen, lookups);
2388
- let shouldAnimate = false;
2389
- if (canAnimate) {
2390
- if (isGrouped) {
2391
- shouldAnimate = msg.messages.some((m) => {
2392
- const content = m.message.content[0];
2393
- return content?.type === "tool_use" && inProgressToolUseIDs.has(content.id);
2394
- });
2395
- } else if (isCollapsed) {
2396
- shouldAnimate = hasAnyToolInProgress(msg, inProgressToolUseIDs);
2397
- } else {
2398
- const toolUseID = getToolUseID(msg);
2399
- shouldAnimate = !toolUseID || inProgressToolUseIDs.has(toolUseID);
2400
- }
2401
- }
2402
- const hasMetadata = isTranscriptMode && displayMsg.type === "assistant" && displayMsg.message.content.some((c) => c.type === "text") && (displayMsg.timestamp || displayMsg.message.model);
2403
- const messageEl = /* @__PURE__ */ jsx_dev_runtime16.jsxDEV(Message, {
2404
- message: msg,
2405
- lookups,
2406
- addMargin: !hasMetadata,
2407
- containerWidth: hasMetadata ? undefined : columns,
2408
- tools,
2409
- commands,
2410
- verbose,
2411
- inProgressToolUseIDs,
2412
- progressMessagesForMessage,
2413
- shouldAnimate,
2414
- shouldShowDot: true,
2415
- isTranscriptMode,
2416
- isStatic,
2417
- onOpenRateLimitOptions,
2418
- isActiveCollapsedGroup,
2419
- isUserContinuation,
2420
- lastThinkingBlockId,
2421
- latestBashOutputUUID
2422
- }, undefined, false, undefined, this);
2423
- if (!hasMetadata) {
2424
- return /* @__PURE__ */ jsx_dev_runtime16.jsxDEV(OffscreenFreeze, {
2425
- children: messageEl
2426
- }, undefined, false, undefined, this);
2427
- }
2428
- return /* @__PURE__ */ jsx_dev_runtime16.jsxDEV(OffscreenFreeze, {
2429
- children: /* @__PURE__ */ jsx_dev_runtime16.jsxDEV(ThemedBox_default, {
2430
- width: columns,
2431
- flexDirection: "column",
2432
- children: [
2433
- /* @__PURE__ */ jsx_dev_runtime16.jsxDEV(ThemedBox_default, {
2434
- flexDirection: "row",
2435
- justifyContent: "flex-end",
2436
- gap: 1,
2437
- marginTop: 1,
2438
- children: [
2439
- /* @__PURE__ */ jsx_dev_runtime16.jsxDEV(MessageTimestamp, {
2440
- message: displayMsg,
2441
- isTranscriptMode
2442
- }, undefined, false, undefined, this),
2443
- /* @__PURE__ */ jsx_dev_runtime16.jsxDEV(MessageModel, {
2444
- message: displayMsg,
2445
- isTranscriptMode
2446
- }, undefined, false, undefined, this)
2447
- ]
2448
- }, undefined, true, undefined, this),
2449
- messageEl
2450
- ]
2451
- }, undefined, true, undefined, this)
2452
- }, undefined, false, undefined, this);
2453
- }
2454
- function isMessageStreaming(msg, streamingToolUseIDs) {
2455
- if (msg.type === "grouped_tool_use") {
2456
- return msg.messages.some((m) => {
2457
- const content = m.message.content[0];
2458
- return content?.type === "tool_use" && streamingToolUseIDs.has(content.id);
2459
- });
2460
- }
2461
- if (msg.type === "collapsed_read_search") {
2462
- const toolIds = getToolUseIdsFromCollapsedGroup(msg);
2463
- return toolIds.some((id) => streamingToolUseIDs.has(id));
2464
- }
2465
- const toolUseID = getToolUseID(msg);
2466
- return !!toolUseID && streamingToolUseIDs.has(toolUseID);
2467
- }
2468
- function allToolsResolved(msg, resolvedToolUseIDs) {
2469
- if (msg.type === "grouped_tool_use") {
2470
- return msg.messages.every((m) => {
2471
- const content = m.message.content[0];
2472
- return content?.type === "tool_use" && resolvedToolUseIDs.has(content.id);
2473
- });
2474
- }
2475
- if (msg.type === "collapsed_read_search") {
2476
- const toolIds = getToolUseIdsFromCollapsedGroup(msg);
2477
- return toolIds.every((id) => resolvedToolUseIDs.has(id));
2478
- }
2479
- if (msg.type === "assistant") {
2480
- const block = msg.message.content[0];
2481
- if (block?.type === "server_tool_use") {
2482
- return resolvedToolUseIDs.has(block.id);
2483
- }
2484
- }
2485
- const toolUseID = getToolUseID(msg);
2486
- return !toolUseID || resolvedToolUseIDs.has(toolUseID);
2487
- }
2488
- function areMessageRowPropsEqual(prev, next) {
2489
- if (prev.message !== next.message)
2490
- return false;
2491
- if (prev.screen !== next.screen)
2492
- return false;
2493
- if (prev.verbose !== next.verbose)
2494
- return false;
2495
- if (prev.message.type === "collapsed_read_search" && next.screen !== "transcript") {
2496
- return false;
2497
- }
2498
- if (prev.columns !== next.columns)
2499
- return false;
2500
- const prevIsLatestBash = prev.latestBashOutputUUID === prev.message.uuid;
2501
- const nextIsLatestBash = next.latestBashOutputUUID === next.message.uuid;
2502
- if (prevIsLatestBash !== nextIsLatestBash)
2503
- return false;
2504
- if (prev.lastThinkingBlockId !== next.lastThinkingBlockId && hasThinkingContent(next.message)) {
2505
- return false;
2506
- }
2507
- const isStreaming = isMessageStreaming(prev.message, prev.streamingToolUseIDs);
2508
- const isResolved = allToolsResolved(prev.message, prev.lookups.resolvedToolUseIDs);
2509
- if (isStreaming || !isResolved)
2510
- return false;
2511
- return true;
2512
- }
2513
- var React4, jsx_dev_runtime16, MessageRow;
2514
- var init_MessageRow = __esm(() => {
2515
- init_src();
2516
- init_collapseReadSearch();
2517
- init_messages();
2518
- init_Message();
2519
- init_MessageModel();
2520
- init_Messages();
2521
- init_MessageTimestamp();
2522
- init_OffscreenFreeze();
2523
- React4 = __toESM(require_react(), 1);
2524
- jsx_dev_runtime16 = __toESM(require_jsx_dev_runtime(), 1);
2525
- MessageRow = React4.memo(MessageRowImpl, areMessageRowPropsEqual);
2526
- });
2527
-
2528
- // src/utils/statusNoticeDefinitions.tsx
2529
- import { relative } from "path";
2530
- function getActiveNotices(context) {
2531
- return statusNoticeDefinitions.filter((notice) => notice.isActive(context));
2532
- }
2533
- var jsx_dev_runtime17, largeMemoryFilesNotice, claudeAiSubscriberExternalTokenNotice, apiKeyConflictNotice, bothAuthMethodsNotice, largeAgentDescriptionsNotice, jetbrainsPluginNotice, statusNoticeDefinitions;
2534
- var init_statusNoticeDefinitions = __esm(() => {
2535
- init_src();
2536
- init_claudemd();
2537
- init_figures();
2538
- init_cwd();
2539
- init_format();
2540
- init_auth();
2541
- init_statusNoticeHelpers();
2542
- init_ide();
2543
- init_jetbrains();
2544
- jsx_dev_runtime17 = __toESM(require_jsx_dev_runtime(), 1);
2545
- largeMemoryFilesNotice = {
2546
- id: "large-memory-files",
2547
- type: "warning",
2548
- isActive: (ctx) => getLargeMemoryFiles(ctx.memoryFiles).length > 0,
2549
- render: (ctx) => {
2550
- const largeMemoryFiles = getLargeMemoryFiles(ctx.memoryFiles);
2551
- return /* @__PURE__ */ jsx_dev_runtime17.jsxDEV(jsx_dev_runtime17.Fragment, {
2552
- children: largeMemoryFiles.map((file) => {
2553
- const displayPath = file.path.startsWith(getCwd()) ? relative(getCwd(), file.path) : file.path;
2554
- return /* @__PURE__ */ jsx_dev_runtime17.jsxDEV(ThemedBox_default, {
2555
- flexDirection: "row",
2556
- children: [
2557
- /* @__PURE__ */ jsx_dev_runtime17.jsxDEV(ThemedText, {
2558
- color: "warning",
2559
- children: figures_default.warning
2560
- }, undefined, false, undefined, this),
2561
- /* @__PURE__ */ jsx_dev_runtime17.jsxDEV(ThemedText, {
2562
- color: "warning",
2563
- children: [
2564
- "Large ",
2565
- /* @__PURE__ */ jsx_dev_runtime17.jsxDEV(ThemedText, {
2566
- bold: true,
2567
- children: displayPath
2568
- }, undefined, false, undefined, this),
2569
- " will impact performance (",
2570
- formatNumber(file.content.length),
2571
- " chars >",
2572
- " ",
2573
- formatNumber(MAX_MEMORY_CHARACTER_COUNT),
2574
- ")",
2575
- /* @__PURE__ */ jsx_dev_runtime17.jsxDEV(ThemedText, {
2576
- dimColor: true,
2577
- children: " \xB7 /memory to edit"
2578
- }, undefined, false, undefined, this)
2579
- ]
2580
- }, undefined, true, undefined, this)
2581
- ]
2582
- }, file.path, true, undefined, this);
2583
- })
2584
- }, undefined, false, undefined, this);
2585
- }
2586
- };
2587
- claudeAiSubscriberExternalTokenNotice = {
2588
- id: "claude-ai-external-token",
2589
- type: "warning",
2590
- isActive: () => {
2591
- return false;
2592
- },
2593
- render: () => {
2594
- const authTokenInfo = getAuthTokenSource();
2595
- return /* @__PURE__ */ jsx_dev_runtime17.jsxDEV(ThemedBox_default, {
2596
- flexDirection: "row",
2597
- marginTop: 1,
2598
- children: [
2599
- /* @__PURE__ */ jsx_dev_runtime17.jsxDEV(ThemedText, {
2600
- color: "warning",
2601
- children: figures_default.warning
2602
- }, undefined, false, undefined, this),
2603
- /* @__PURE__ */ jsx_dev_runtime17.jsxDEV(ThemedText, {
2604
- color: "warning",
2605
- children: [
2606
- "Auth conflict: Using ",
2607
- authTokenInfo.source,
2608
- " instead of Claude account subscription token. Either unset ",
2609
- authTokenInfo.source,
2610
- ", or run `claude /logout`."
2611
- ]
2612
- }, undefined, true, undefined, this)
2613
- ]
2614
- }, undefined, true, undefined, this);
2615
- }
2616
- };
2617
- apiKeyConflictNotice = {
2618
- id: "api-key-conflict",
2619
- type: "warning",
2620
- isActive: () => {
2621
- const { source: apiKeySource } = getAnthropicApiKeyWithSource({
2622
- skipRetrievingKeyFromApiKeyHelper: true
2623
- });
2624
- return !!getApiKeyFromConfigOrMacOSKeychain() && (apiKeySource === "ANTHROPIC_API_KEY" || apiKeySource === "apiKeyHelper");
2625
- },
2626
- render: () => {
2627
- const { source: apiKeySource } = getAnthropicApiKeyWithSource({
2628
- skipRetrievingKeyFromApiKeyHelper: true
2629
- });
2630
- return /* @__PURE__ */ jsx_dev_runtime17.jsxDEV(ThemedBox_default, {
2631
- flexDirection: "row",
2632
- marginTop: 1,
2633
- children: [
2634
- /* @__PURE__ */ jsx_dev_runtime17.jsxDEV(ThemedText, {
2635
- color: "warning",
2636
- children: figures_default.warning
2637
- }, undefined, false, undefined, this),
2638
- /* @__PURE__ */ jsx_dev_runtime17.jsxDEV(ThemedText, {
2639
- color: "warning",
2640
- children: [
2641
- "Auth conflict: Using ",
2642
- apiKeySource,
2643
- " instead of Anthropic Console key. Either unset ",
2644
- apiKeySource,
2645
- ", or run `claude /logout`."
2646
- ]
2647
- }, undefined, true, undefined, this)
2648
- ]
2649
- }, undefined, true, undefined, this);
2650
- }
2651
- };
2652
- bothAuthMethodsNotice = {
2653
- id: "both-auth-methods",
2654
- type: "warning",
2655
- isActive: () => {
2656
- const { source: apiKeySource } = getAnthropicApiKeyWithSource({
2657
- skipRetrievingKeyFromApiKeyHelper: true
2658
- });
2659
- const authTokenInfo = getAuthTokenSource();
2660
- return apiKeySource !== "none" && authTokenInfo.source !== "none" && !(apiKeySource === "apiKeyHelper" && authTokenInfo.source === "apiKeyHelper");
2661
- },
2662
- render: () => {
2663
- const { source: apiKeySource } = getAnthropicApiKeyWithSource({
2664
- skipRetrievingKeyFromApiKeyHelper: true
2665
- });
2666
- const authTokenInfo = getAuthTokenSource();
2667
- return /* @__PURE__ */ jsx_dev_runtime17.jsxDEV(ThemedBox_default, {
2668
- flexDirection: "column",
2669
- marginTop: 1,
2670
- children: [
2671
- /* @__PURE__ */ jsx_dev_runtime17.jsxDEV(ThemedBox_default, {
2672
- flexDirection: "row",
2673
- children: [
2674
- /* @__PURE__ */ jsx_dev_runtime17.jsxDEV(ThemedText, {
2675
- color: "warning",
2676
- children: figures_default.warning
2677
- }, undefined, false, undefined, this),
2678
- /* @__PURE__ */ jsx_dev_runtime17.jsxDEV(ThemedText, {
2679
- color: "warning",
2680
- children: [
2681
- "Auth conflict: Both a token (",
2682
- authTokenInfo.source,
2683
- ") and an API key (",
2684
- apiKeySource,
2685
- ") are set. This may lead to unexpected behavior."
2686
- ]
2687
- }, undefined, true, undefined, this)
2688
- ]
2689
- }, undefined, true, undefined, this),
2690
- /* @__PURE__ */ jsx_dev_runtime17.jsxDEV(ThemedBox_default, {
2691
- flexDirection: "column",
2692
- marginLeft: 3,
2693
- children: [
2694
- /* @__PURE__ */ jsx_dev_runtime17.jsxDEV(ThemedText, {
2695
- color: "warning",
2696
- children: [
2697
- "\xB7 Trying to use",
2698
- " ",
2699
- authTokenInfo.source === "claude.ai" ? "claude.ai" : authTokenInfo.source,
2700
- "?",
2701
- " ",
2702
- apiKeySource === "ANTHROPIC_API_KEY" ? 'Unset the ANTHROPIC_API_KEY environment variable, or claude /logout then say "No" to the API key approval before login.' : apiKeySource === "apiKeyHelper" ? "Unset the apiKeyHelper setting." : "claude /logout"
2703
- ]
2704
- }, undefined, true, undefined, this),
2705
- /* @__PURE__ */ jsx_dev_runtime17.jsxDEV(ThemedText, {
2706
- color: "warning",
2707
- children: [
2708
- "\xB7 Trying to use ",
2709
- apiKeySource,
2710
- "?",
2711
- " ",
2712
- authTokenInfo.source === "claude.ai" ? "claude /logout to sign out of claude.ai." : `Unset the ${authTokenInfo.source} environment variable.`
2713
- ]
2714
- }, undefined, true, undefined, this)
2715
- ]
2716
- }, undefined, true, undefined, this)
2717
- ]
2718
- }, undefined, true, undefined, this);
2719
- }
2720
- };
2721
- largeAgentDescriptionsNotice = {
2722
- id: "large-agent-descriptions",
2723
- type: "warning",
2724
- isActive: (context) => {
2725
- const totalTokens = getAgentDescriptionsTotalTokens(context.agentDefinitions);
2726
- return totalTokens > AGENT_DESCRIPTIONS_THRESHOLD;
2727
- },
2728
- render: (context) => {
2729
- const totalTokens = getAgentDescriptionsTotalTokens(context.agentDefinitions);
2730
- return /* @__PURE__ */ jsx_dev_runtime17.jsxDEV(ThemedBox_default, {
2731
- flexDirection: "row",
2732
- children: [
2733
- /* @__PURE__ */ jsx_dev_runtime17.jsxDEV(ThemedText, {
2734
- color: "warning",
2735
- children: figures_default.warning
2736
- }, undefined, false, undefined, this),
2737
- /* @__PURE__ */ jsx_dev_runtime17.jsxDEV(ThemedText, {
2738
- color: "warning",
2739
- children: [
2740
- "Large cumulative agent descriptions will impact performance (~",
2741
- formatNumber(totalTokens),
2742
- " tokens >",
2743
- " ",
2744
- formatNumber(AGENT_DESCRIPTIONS_THRESHOLD),
2745
- ")",
2746
- /* @__PURE__ */ jsx_dev_runtime17.jsxDEV(ThemedText, {
2747
- dimColor: true,
2748
- children: " \xB7 /agents to manage"
2749
- }, undefined, false, undefined, this)
2750
- ]
2751
- }, undefined, true, undefined, this)
2752
- ]
2753
- }, undefined, true, undefined, this);
2754
- }
2755
- };
2756
- jetbrainsPluginNotice = {
2757
- id: "jetbrains-plugin-install",
2758
- type: "info",
2759
- isActive: (context) => {
2760
- if (!isSupportedJetBrainsTerminal()) {
2761
- return false;
2762
- }
2763
- const shouldAutoInstall = context.config.autoInstallIdeExtension ?? true;
2764
- if (!shouldAutoInstall) {
2765
- return false;
2766
- }
2767
- const ideType = getTerminalIdeType();
2768
- return ideType !== null && !isJetBrainsPluginInstalledCachedSync(ideType);
2769
- },
2770
- render: () => {
2771
- const ideType = getTerminalIdeType();
2772
- const ideName = toIDEDisplayName(ideType);
2773
- return /* @__PURE__ */ jsx_dev_runtime17.jsxDEV(ThemedBox_default, {
2774
- flexDirection: "row",
2775
- gap: 1,
2776
- marginLeft: 1,
2777
- children: [
2778
- /* @__PURE__ */ jsx_dev_runtime17.jsxDEV(ThemedText, {
2779
- color: "ide",
2780
- children: figures_default.arrowUp
2781
- }, undefined, false, undefined, this),
2782
- /* @__PURE__ */ jsx_dev_runtime17.jsxDEV(ThemedText, {
2783
- children: [
2784
- "Install the ",
2785
- /* @__PURE__ */ jsx_dev_runtime17.jsxDEV(ThemedText, {
2786
- color: "ide",
2787
- children: ideName
2788
- }, undefined, false, undefined, this),
2789
- " plugin from the JetBrains Marketplace:",
2790
- " ",
2791
- /* @__PURE__ */ jsx_dev_runtime17.jsxDEV(ThemedText, {
2792
- bold: true,
2793
- children: "https://docs.claude.com/s/claude-code-jetbrains"
2794
- }, undefined, false, undefined, this)
2795
- ]
2796
- }, undefined, true, undefined, this)
2797
- ]
2798
- }, undefined, true, undefined, this);
2799
- }
2800
- };
2801
- statusNoticeDefinitions = [
2802
- largeMemoryFilesNotice,
2803
- largeAgentDescriptionsNotice,
2804
- claudeAiSubscriberExternalTokenNotice,
2805
- apiKeyConflictNotice,
2806
- bothAuthMethodsNotice,
2807
- jetbrainsPluginNotice
2808
- ];
2809
- });
2810
-
2811
- // src/components/StatusNotices.tsx
2812
- function StatusNotices({
2813
- agentDefinitions
2814
- } = {}) {
2815
- const context = {
2816
- config: getGlobalConfig(),
2817
- agentDefinitions,
2818
- memoryFiles: import_react10.use(getMemoryFiles())
2819
- };
2820
- const activeNotices = getActiveNotices(context);
2821
- if (activeNotices.length === 0) {
2822
- return null;
2823
- }
2824
- return /* @__PURE__ */ jsx_dev_runtime18.jsxDEV(ThemedBox_default, {
2825
- flexDirection: "column",
2826
- paddingLeft: 1,
2827
- children: activeNotices.map((notice) => /* @__PURE__ */ jsx_dev_runtime18.jsxDEV(React5.Fragment, {
2828
- children: notice.render(context)
2829
- }, notice.id, false, undefined, this))
2830
- }, undefined, false, undefined, this);
2831
- }
2832
- var React5, import_react10, jsx_dev_runtime18;
2833
- var init_StatusNotices = __esm(() => {
2834
- init_src();
2835
- init_claudemd();
2836
- init_config();
2837
- init_statusNoticeDefinitions();
2838
- React5 = __toESM(require_react(), 1);
2839
- import_react10 = __toESM(require_react(), 1);
2840
- jsx_dev_runtime18 = __toESM(require_jsx_dev_runtime(), 1);
2841
- });
2842
-
2843
- // src/hooks/useVirtualScroll.ts
2844
- function useVirtualScroll(scrollRef, itemKeys, columns) {
2845
- const heightCache = import_react11.useRef(new Map);
2846
- const offsetVersionRef = import_react11.useRef(0);
2847
- const lastScrollTopRef = import_react11.useRef(0);
2848
- const offsetsRef = import_react11.useRef({
2849
- arr: new Float64Array(0),
2850
- version: -1,
2851
- n: -1
2852
- });
2853
- const itemRefs = import_react11.useRef(new Map);
2854
- const refCache = import_react11.useRef(new Map);
2855
- const prevColumns = import_react11.useRef(columns);
2856
- const skipMeasurementRef = import_react11.useRef(false);
2857
- const prevRangeRef = import_react11.useRef(null);
2858
- const freezeRendersRef = import_react11.useRef(0);
2859
- if (prevColumns.current !== columns) {
2860
- const ratio = prevColumns.current / columns;
2861
- prevColumns.current = columns;
2862
- for (const [k, h] of heightCache.current) {
2863
- heightCache.current.set(k, Math.max(1, Math.round(h * ratio)));
2864
- }
2865
- offsetVersionRef.current++;
2866
- skipMeasurementRef.current = true;
2867
- freezeRendersRef.current = 2;
2868
- }
2869
- const frozenRange = freezeRendersRef.current > 0 ? prevRangeRef.current : null;
2870
- const listOriginRef = import_react11.useRef(0);
2871
- const spacerRef = import_react11.useRef(null);
2872
- const subscribe = import_react11.useCallback((listener) => scrollRef.current?.subscribe(listener) ?? NOOP_UNSUB, [scrollRef]);
2873
- import_react11.useSyncExternalStore(subscribe, () => {
2874
- const s = scrollRef.current;
2875
- if (!s)
2876
- return NaN;
2877
- const target = s.getScrollTop() + s.getPendingDelta();
2878
- const bin = Math.floor(target / SCROLL_QUANTUM);
2879
- return s.isSticky() ? ~bin : bin;
2880
- });
2881
- const scrollTop = scrollRef.current?.getScrollTop() ?? -1;
2882
- const pendingDelta = scrollRef.current?.getPendingDelta() ?? 0;
2883
- const viewportH = scrollRef.current?.getViewportHeight() ?? 0;
2884
- const isSticky = scrollRef.current?.isSticky() ?? true;
2885
- import_react11.useMemo(() => {
2886
- const live = new Set(itemKeys);
2887
- let dirty = false;
2888
- for (const k of heightCache.current.keys()) {
2889
- if (!live.has(k)) {
2890
- heightCache.current.delete(k);
2891
- dirty = true;
2892
- }
2893
- }
2894
- for (const k of refCache.current.keys()) {
2895
- if (!live.has(k))
2896
- refCache.current.delete(k);
2897
- }
2898
- if (dirty)
2899
- offsetVersionRef.current++;
2900
- }, [itemKeys]);
2901
- const n = itemKeys.length;
2902
- if (offsetsRef.current.version !== offsetVersionRef.current || offsetsRef.current.n !== n) {
2903
- const arr = offsetsRef.current.arr.length >= n + 1 ? offsetsRef.current.arr : new Float64Array(n + 1);
2904
- arr[0] = 0;
2905
- for (let i = 0;i < n; i++) {
2906
- arr[i + 1] = arr[i] + (heightCache.current.get(itemKeys[i]) ?? DEFAULT_ESTIMATE);
2907
- }
2908
- offsetsRef.current = { arr, version: offsetVersionRef.current, n };
2909
- }
2910
- const offsets = offsetsRef.current.arr;
2911
- const totalHeight = offsets[n];
2912
- let start;
2913
- let end;
2914
- if (frozenRange) {
2915
- [start, end] = frozenRange;
2916
- start = Math.min(start, n);
2917
- end = Math.min(end, n);
2918
- } else if (viewportH === 0 || scrollTop < 0) {
2919
- start = Math.max(0, n - COLD_START_COUNT);
2920
- end = n;
2921
- } else {
2922
- if (isSticky) {
2923
- const budget = viewportH + OVERSCAN_ROWS;
2924
- start = n;
2925
- while (start > 0 && totalHeight - offsets[start - 1] < budget) {
2926
- start--;
2927
- }
2928
- end = n;
2929
- } else {
2930
- const listOrigin2 = listOriginRef.current;
2931
- const MAX_SPAN_ROWS = viewportH * 3;
2932
- const rawLo = Math.min(scrollTop, scrollTop + pendingDelta);
2933
- const rawHi = Math.max(scrollTop, scrollTop + pendingDelta);
2934
- const span = rawHi - rawLo;
2935
- const clampedLo = span > MAX_SPAN_ROWS ? pendingDelta < 0 ? rawHi - MAX_SPAN_ROWS : rawLo : rawLo;
2936
- const clampedHi = clampedLo + Math.min(span, MAX_SPAN_ROWS);
2937
- const effLo = Math.max(0, clampedLo - listOrigin2);
2938
- const effHi = clampedHi - listOrigin2;
2939
- const lo = effLo - OVERSCAN_ROWS;
2940
- {
2941
- let l = 0;
2942
- let r = n;
2943
- while (l < r) {
2944
- const m = l + r >> 1;
2945
- if (offsets[m + 1] <= lo)
2946
- l = m + 1;
2947
- else
2948
- r = m;
2949
- }
2950
- start = l;
2951
- }
2952
- {
2953
- const p = prevRangeRef.current;
2954
- if (p && p[0] < start) {
2955
- for (let i = p[0];i < Math.min(start, p[1]); i++) {
2956
- const k = itemKeys[i];
2957
- if (itemRefs.current.has(k) && !heightCache.current.has(k)) {
2958
- start = i;
2959
- break;
2960
- }
2961
- }
2962
- }
2963
- }
2964
- const needed2 = viewportH + 2 * OVERSCAN_ROWS;
2965
- const maxEnd = Math.min(n, start + MAX_MOUNTED_ITEMS);
2966
- let coverage2 = 0;
2967
- end = start;
2968
- while (end < maxEnd && (coverage2 < needed2 || offsets[end] < effHi + viewportH + OVERSCAN_ROWS)) {
2969
- coverage2 += heightCache.current.get(itemKeys[end]) ?? PESSIMISTIC_HEIGHT;
2970
- end++;
2971
- }
2972
- }
2973
- const needed = viewportH + 2 * OVERSCAN_ROWS;
2974
- const minStart = Math.max(0, end - MAX_MOUNTED_ITEMS);
2975
- let coverage = 0;
2976
- for (let i = start;i < end; i++) {
2977
- coverage += heightCache.current.get(itemKeys[i]) ?? PESSIMISTIC_HEIGHT;
2978
- }
2979
- while (start > minStart && coverage < needed) {
2980
- start--;
2981
- coverage += heightCache.current.get(itemKeys[start]) ?? PESSIMISTIC_HEIGHT;
2982
- }
2983
- const prev = prevRangeRef.current;
2984
- const scrollVelocity = Math.abs(scrollTop - lastScrollTopRef.current) + Math.abs(pendingDelta);
2985
- if (prev && scrollVelocity > viewportH * 2) {
2986
- const [pS, pE] = prev;
2987
- if (start < pS - SLIDE_STEP)
2988
- start = pS - SLIDE_STEP;
2989
- if (end > pE + SLIDE_STEP)
2990
- end = pE + SLIDE_STEP;
2991
- if (start > end)
2992
- end = Math.min(start + SLIDE_STEP, n);
2993
- }
2994
- lastScrollTopRef.current = scrollTop;
2995
- }
2996
- if (freezeRendersRef.current > 0) {
2997
- freezeRendersRef.current--;
2998
- } else {
2999
- prevRangeRef.current = [start, end];
3000
- }
3001
- const dStart = import_react11.useDeferredValue(start);
3002
- const dEnd = import_react11.useDeferredValue(end);
3003
- let effStart = start < dStart ? dStart : start;
3004
- let effEnd = end > dEnd ? dEnd : end;
3005
- if (effStart > effEnd || isSticky) {
3006
- effStart = start;
3007
- effEnd = end;
3008
- }
3009
- if (pendingDelta > 0) {
3010
- effEnd = end;
3011
- }
3012
- if (effEnd - effStart > MAX_MOUNTED_ITEMS) {
3013
- const mid = (offsets[effStart] + offsets[effEnd]) / 2;
3014
- if (scrollTop - listOriginRef.current < mid) {
3015
- effEnd = effStart + MAX_MOUNTED_ITEMS;
3016
- } else {
3017
- effStart = effEnd - MAX_MOUNTED_ITEMS;
3018
- }
3019
- }
3020
- const listOrigin = listOriginRef.current;
3021
- const effTopSpacer = offsets[effStart];
3022
- const clampMin = effStart === 0 ? 0 : effTopSpacer + listOrigin;
3023
- const clampMax = effEnd === n ? Infinity : Math.max(effTopSpacer, offsets[effEnd] - viewportH) + listOrigin;
3024
- import_react11.useLayoutEffect(() => {
3025
- if (isSticky) {
3026
- scrollRef.current?.setClampBounds(undefined, undefined);
3027
- } else {
3028
- scrollRef.current?.setClampBounds(clampMin, clampMax);
3029
- }
3030
- });
3031
- import_react11.useLayoutEffect(() => {
3032
- const spacerYoga = spacerRef.current?.yogaNode;
3033
- if (spacerYoga && spacerYoga.getComputedWidth() > 0) {
3034
- listOriginRef.current = spacerYoga.getComputedTop();
3035
- }
3036
- if (skipMeasurementRef.current) {
3037
- skipMeasurementRef.current = false;
3038
- return;
3039
- }
3040
- let anyChanged = false;
3041
- for (const [key, el] of itemRefs.current) {
3042
- const yoga = el.yogaNode;
3043
- if (!yoga)
3044
- continue;
3045
- const h = yoga.getComputedHeight();
3046
- const prev = heightCache.current.get(key);
3047
- if (h > 0) {
3048
- if (prev !== h) {
3049
- heightCache.current.set(key, h);
3050
- anyChanged = true;
3051
- }
3052
- } else if (yoga.getComputedWidth() > 0 && prev !== 0) {
3053
- heightCache.current.set(key, 0);
3054
- anyChanged = true;
3055
- }
3056
- }
3057
- if (anyChanged)
3058
- offsetVersionRef.current++;
3059
- });
3060
- const measureRef = import_react11.useCallback((key) => {
3061
- let fn = refCache.current.get(key);
3062
- if (!fn) {
3063
- fn = (el) => {
3064
- if (el) {
3065
- itemRefs.current.set(key, el);
3066
- } else {
3067
- const yoga = itemRefs.current.get(key)?.yogaNode;
3068
- if (yoga && !skipMeasurementRef.current) {
3069
- const h = yoga.getComputedHeight();
3070
- if ((h > 0 || yoga.getComputedWidth() > 0) && heightCache.current.get(key) !== h) {
3071
- heightCache.current.set(key, h);
3072
- offsetVersionRef.current++;
3073
- }
3074
- }
3075
- itemRefs.current.delete(key);
3076
- }
3077
- };
3078
- refCache.current.set(key, fn);
3079
- }
3080
- return fn;
3081
- }, []);
3082
- const getItemTop = import_react11.useCallback((index) => {
3083
- const yoga = itemRefs.current.get(itemKeys[index])?.yogaNode;
3084
- if (!yoga || yoga.getComputedWidth() === 0)
3085
- return -1;
3086
- return yoga.getComputedTop();
3087
- }, [itemKeys]);
3088
- const getItemElement = import_react11.useCallback((index) => itemRefs.current.get(itemKeys[index]) ?? null, [itemKeys]);
3089
- const getItemHeight = import_react11.useCallback((index) => heightCache.current.get(itemKeys[index]), [itemKeys]);
3090
- const scrollToIndex = import_react11.useCallback((i) => {
3091
- const o = offsetsRef.current;
3092
- if (i < 0 || i >= o.n)
3093
- return;
3094
- scrollRef.current?.scrollTo(o.arr[i] + listOriginRef.current);
3095
- }, [scrollRef]);
3096
- const effBottomSpacer = totalHeight - offsets[effEnd];
3097
- return {
3098
- range: [effStart, effEnd],
3099
- topSpacer: effTopSpacer,
3100
- bottomSpacer: effBottomSpacer,
3101
- measureRef,
3102
- spacerRef,
3103
- offsets,
3104
- getItemTop,
3105
- getItemElement,
3106
- getItemHeight,
3107
- scrollToIndex
3108
- };
3109
- }
3110
- var import_react11, DEFAULT_ESTIMATE = 3, OVERSCAN_ROWS = 80, COLD_START_COUNT = 30, SCROLL_QUANTUM, PESSIMISTIC_HEIGHT = 1, MAX_MOUNTED_ITEMS = 300, SLIDE_STEP = 25, NOOP_UNSUB = () => {};
3111
- var init_useVirtualScroll = __esm(() => {
3112
- import_react11 = __toESM(require_react(), 1);
3113
- SCROLL_QUANTUM = OVERSCAN_ROWS >> 1;
3114
- });
3115
-
3116
- // src/components/VirtualMessageList.tsx
3117
- function defaultExtractSearchText(msg) {
3118
- const cached = fallbackLowerCache.get(msg);
3119
- if (cached !== undefined)
3120
- return cached;
3121
- const lowered = renderableSearchText(msg);
3122
- fallbackLowerCache.set(msg, lowered);
3123
- return lowered;
3124
- }
3125
- function stickyPromptText(msg) {
3126
- const cached = promptTextCache.get(msg);
3127
- if (cached !== undefined)
3128
- return cached;
3129
- const result = computeStickyPromptText(msg);
3130
- promptTextCache.set(msg, result);
3131
- return result;
3132
- }
3133
- function computeStickyPromptText(msg) {
3134
- let raw = null;
3135
- if (msg.type === "user") {
3136
- if (msg.isMeta || msg.isVisibleInTranscriptOnly)
3137
- return null;
3138
- const block = msg.message.content[0];
3139
- if (block?.type !== "text")
3140
- return null;
3141
- raw = block.text;
3142
- } else if (msg.type === "attachment" && msg.attachment.type === "queued_command" && msg.attachment.commandMode !== "task-notification" && !msg.attachment.isMeta) {
3143
- const p = msg.attachment.prompt;
3144
- raw = typeof p === "string" ? p : p.flatMap((b) => b.type === "text" ? [b.text] : []).join(`
3145
- `);
3146
- }
3147
- if (raw === null)
3148
- return null;
3149
- const t = stripSystemReminders(raw);
3150
- if (t.startsWith("<") || t === "")
3151
- return null;
3152
- return t;
3153
- }
3154
- function VirtualItem({
3155
- itemKey: k,
3156
- msg,
3157
- idx,
3158
- measureRef,
3159
- expanded,
3160
- hovered,
3161
- clickable,
3162
- onClickK,
3163
- onEnterK,
3164
- onLeaveK,
3165
- renderItem
3166
- }) {
3167
- return /* @__PURE__ */ jsx_dev_runtime19.jsxDEV(ThemedBox_default, {
3168
- ref: measureRef(k),
3169
- flexDirection: "column",
3170
- backgroundColor: expanded ? "userMessageBackgroundHover" : undefined,
3171
- paddingBottom: expanded ? 1 : undefined,
3172
- onClick: clickable ? (e) => onClickK(msg, e.cellIsBlank) : undefined,
3173
- onMouseEnter: clickable ? () => onEnterK(k) : undefined,
3174
- onMouseLeave: clickable ? () => onLeaveK(k) : undefined,
3175
- children: /* @__PURE__ */ jsx_dev_runtime19.jsxDEV(TextHoverColorContext.Provider, {
3176
- value: hovered && !expanded ? "text" : undefined,
3177
- children: renderItem(msg, idx)
3178
- }, undefined, false, undefined, this)
3179
- }, undefined, false, undefined, this);
3180
- }
3181
- function VirtualMessageList({
3182
- messages,
3183
- scrollRef,
3184
- columns,
3185
- itemKey,
3186
- renderItem,
3187
- onItemClick,
3188
- isItemClickable,
3189
- isItemExpanded,
3190
- extractSearchText = defaultExtractSearchText,
3191
- trackStickyPrompt,
3192
- selectedIndex,
3193
- cursorNavRef,
3194
- setCursor,
3195
- jumpRef,
3196
- onSearchMatchesChange,
3197
- scanElement,
3198
- setPositions
3199
- }) {
3200
- const keysRef = import_react12.useRef([]);
3201
- const prevMessagesRef = import_react12.useRef(messages);
3202
- const prevItemKeyRef = import_react12.useRef(itemKey);
3203
- if (prevItemKeyRef.current !== itemKey || messages.length < keysRef.current.length || messages[0] !== prevMessagesRef.current[0]) {
3204
- keysRef.current = messages.map((m) => itemKey(m));
3205
- } else {
3206
- for (let i = keysRef.current.length;i < messages.length; i++) {
3207
- keysRef.current.push(itemKey(messages[i]));
3208
- }
3209
- }
3210
- prevMessagesRef.current = messages;
3211
- prevItemKeyRef.current = itemKey;
3212
- const keys = keysRef.current;
3213
- const {
3214
- range,
3215
- topSpacer,
3216
- bottomSpacer,
3217
- measureRef,
3218
- spacerRef,
3219
- offsets,
3220
- getItemTop,
3221
- getItemElement,
3222
- getItemHeight,
3223
- scrollToIndex
3224
- } = useVirtualScroll(scrollRef, keys, columns);
3225
- const [start, end] = range;
3226
- const isVisible = import_react12.useCallback((i) => {
3227
- const h = getItemHeight(i);
3228
- if (h === 0)
3229
- return false;
3230
- return isNavigableMessage(messages[i]);
3231
- }, [getItemHeight, messages]);
3232
- import_react12.useImperativeHandle(cursorNavRef, () => {
3233
- const select = (m) => setCursor?.({
3234
- uuid: m.uuid,
3235
- msgType: m.type,
3236
- expanded: false,
3237
- toolName: toolCallOf(m)?.name
3238
- });
3239
- const selIdx = selectedIndex ?? -1;
3240
- const scan = (from, dir, pred = isVisible) => {
3241
- for (let i = from;i >= 0 && i < messages.length; i += dir) {
3242
- if (pred(i)) {
3243
- select(messages[i]);
3244
- return true;
3245
- }
3246
- }
3247
- return false;
3248
- };
3249
- const isUser = (i) => isVisible(i) && messages[i].type === "user";
3250
- return {
3251
- enterCursor: () => scan(messages.length - 1, -1, isUser),
3252
- navigatePrev: () => scan(selIdx - 1, -1),
3253
- navigateNext: () => {
3254
- if (scan(selIdx + 1, 1))
3255
- return;
3256
- scrollRef.current?.scrollToBottom();
3257
- setCursor?.(null);
3258
- },
3259
- navigatePrevUser: () => scan(selIdx - 1, -1, isUser),
3260
- navigateNextUser: () => scan(selIdx + 1, 1, isUser),
3261
- navigateTop: () => scan(0, 1),
3262
- navigateBottom: () => scan(messages.length - 1, -1),
3263
- getSelected: () => selIdx >= 0 ? messages[selIdx] ?? null : null
3264
- };
3265
- }, [messages, selectedIndex, setCursor, isVisible]);
3266
- const jumpState = import_react12.useRef({
3267
- offsets,
3268
- start,
3269
- getItemElement,
3270
- getItemTop,
3271
- messages,
3272
- scrollToIndex
3273
- });
3274
- jumpState.current = {
3275
- offsets,
3276
- start,
3277
- getItemElement,
3278
- getItemTop,
3279
- messages,
3280
- scrollToIndex
3281
- };
3282
- import_react12.useEffect(() => {
3283
- if (selectedIndex === undefined)
3284
- return;
3285
- const s = jumpState.current;
3286
- const el = s.getItemElement(selectedIndex);
3287
- if (el) {
3288
- scrollRef.current?.scrollToElement(el, 1);
3289
- } else {
3290
- s.scrollToIndex(selectedIndex);
3291
- }
3292
- }, [selectedIndex, scrollRef]);
3293
- const scanRequestRef = import_react12.useRef(null);
3294
- const elementPositions = import_react12.useRef({ msgIdx: -1, positions: [] });
3295
- const startPtrRef = import_react12.useRef(-1);
3296
- const phantomBurstRef = import_react12.useRef(0);
3297
- const pendingStepRef = import_react12.useRef(0);
3298
- const stepRef = import_react12.useRef(() => {});
3299
- const highlightRef = import_react12.useRef(() => {});
3300
- const searchState = import_react12.useRef({
3301
- matches: [],
3302
- ptr: 0,
3303
- screenOrd: 0,
3304
- prefixSum: []
3305
- });
3306
- const searchAnchor = import_react12.useRef(-1);
3307
- const indexWarmed = import_react12.useRef(false);
3308
- function targetFor(i) {
3309
- const top = jumpState.current.getItemTop(i);
3310
- return Math.max(0, top - HEADROOM);
3311
- }
3312
- function highlight(ord) {
3313
- const s = scrollRef.current;
3314
- const { msgIdx, positions } = elementPositions.current;
3315
- if (!s || positions.length === 0 || msgIdx < 0) {
3316
- setPositions?.(null);
3317
- return;
3318
- }
3319
- const idx = Math.max(0, Math.min(ord, positions.length - 1));
3320
- const p = positions[idx];
3321
- const top = jumpState.current.getItemTop(msgIdx);
3322
- const vpTop = s.getViewportTop();
3323
- let lo = top - s.getScrollTop();
3324
- const vp = s.getViewportHeight();
3325
- let screenRow = vpTop + lo + p.row;
3326
- if (screenRow < vpTop || screenRow >= vpTop + vp) {
3327
- s.scrollTo(Math.max(0, top + p.row - HEADROOM));
3328
- lo = top - s.getScrollTop();
3329
- screenRow = vpTop + lo + p.row;
3330
- }
3331
- setPositions?.({ positions, rowOffset: vpTop + lo, currentIdx: idx });
3332
- const st = searchState.current;
3333
- const total = st.prefixSum.at(-1) ?? 0;
3334
- const current = (st.prefixSum[st.ptr] ?? 0) + idx + 1;
3335
- onSearchMatchesChange?.(total, current);
3336
- logForDebugging(`highlight(i=${msgIdx}, ord=${idx}/${positions.length}): ` + `pos={row:${p.row},col:${p.col}} lo=${lo} screenRow=${screenRow} ` + `badge=${current}/${total}`);
3337
- }
3338
- highlightRef.current = highlight;
3339
- const [seekGen, setSeekGen] = import_react12.useState(0);
3340
- const bumpSeek = import_react12.useCallback(() => setSeekGen((g) => g + 1), []);
3341
- import_react12.useEffect(() => {
3342
- const req = scanRequestRef.current;
3343
- if (!req)
3344
- return;
3345
- const { idx, wantLast, tries } = req;
3346
- const s = scrollRef.current;
3347
- if (!s)
3348
- return;
3349
- const { getItemElement: getItemElement2, getItemTop: getItemTop2, scrollToIndex: scrollToIndex2 } = jumpState.current;
3350
- const el = getItemElement2(idx);
3351
- const h = el?.yogaNode?.getComputedHeight() ?? 0;
3352
- if (!el || h === 0) {
3353
- if (tries > 1) {
3354
- scanRequestRef.current = null;
3355
- logForDebugging(`seek(i=${idx}): no mount after scrollToIndex, skip`);
3356
- stepRef.current(wantLast ? -1 : 1);
3357
- return;
3358
- }
3359
- scanRequestRef.current = { idx, wantLast, tries: tries + 1 };
3360
- scrollToIndex2(idx);
3361
- bumpSeek();
3362
- return;
3363
- }
3364
- scanRequestRef.current = null;
3365
- s.scrollTo(Math.max(0, getItemTop2(idx) - HEADROOM));
3366
- const positions = scanElement?.(el) ?? [];
3367
- elementPositions.current = { msgIdx: idx, positions };
3368
- logForDebugging(`seek(i=${idx} t=${tries}): ${positions.length} positions`);
3369
- if (positions.length === 0) {
3370
- if (++phantomBurstRef.current > 20) {
3371
- phantomBurstRef.current = 0;
3372
- return;
3373
- }
3374
- stepRef.current(wantLast ? -1 : 1);
3375
- return;
3376
- }
3377
- phantomBurstRef.current = 0;
3378
- const ord = wantLast ? positions.length - 1 : 0;
3379
- searchState.current.screenOrd = ord;
3380
- startPtrRef.current = -1;
3381
- highlightRef.current(ord);
3382
- const pending = pendingStepRef.current;
3383
- if (pending) {
3384
- pendingStepRef.current = 0;
3385
- stepRef.current(pending);
3386
- }
3387
- }, [seekGen]);
3388
- function jump(i, wantLast) {
3389
- const s = scrollRef.current;
3390
- if (!s)
3391
- return;
3392
- const js = jumpState.current;
3393
- const { getItemElement: getItemElement2, scrollToIndex: scrollToIndex2 } = js;
3394
- if (i < 0 || i >= js.messages.length)
3395
- return;
3396
- setPositions?.(null);
3397
- elementPositions.current = { msgIdx: -1, positions: [] };
3398
- scanRequestRef.current = { idx: i, wantLast, tries: 0 };
3399
- const el = getItemElement2(i);
3400
- const h = el?.yogaNode?.getComputedHeight() ?? 0;
3401
- if (el && h > 0) {
3402
- s.scrollTo(targetFor(i));
3403
- } else {
3404
- scrollToIndex2(i);
3405
- }
3406
- bumpSeek();
3407
- }
3408
- function step(delta) {
3409
- const st = searchState.current;
3410
- const { matches, prefixSum } = st;
3411
- const total = prefixSum.at(-1) ?? 0;
3412
- if (matches.length === 0)
3413
- return;
3414
- if (scanRequestRef.current) {
3415
- pendingStepRef.current = delta;
3416
- return;
3417
- }
3418
- if (startPtrRef.current < 0)
3419
- startPtrRef.current = st.ptr;
3420
- const { positions } = elementPositions.current;
3421
- const newOrd = st.screenOrd + delta;
3422
- if (newOrd >= 0 && newOrd < positions.length) {
3423
- st.screenOrd = newOrd;
3424
- highlight(newOrd);
3425
- startPtrRef.current = -1;
3426
- return;
3427
- }
3428
- const ptr = (st.ptr + delta + matches.length) % matches.length;
3429
- if (ptr === startPtrRef.current) {
3430
- setPositions?.(null);
3431
- startPtrRef.current = -1;
3432
- logForDebugging(`step: wraparound at ptr=${ptr}, all ${matches.length} msgs phantoms`);
3433
- return;
3434
- }
3435
- st.ptr = ptr;
3436
- st.screenOrd = 0;
3437
- jump(matches[ptr], delta < 0);
3438
- const placeholder = delta < 0 ? prefixSum[ptr + 1] ?? total : prefixSum[ptr] + 1;
3439
- onSearchMatchesChange?.(total, placeholder);
3440
- }
3441
- stepRef.current = step;
3442
- import_react12.useImperativeHandle(jumpRef, () => ({
3443
- jumpToIndex: (i) => {
3444
- const s = scrollRef.current;
3445
- if (s)
3446
- s.scrollTo(targetFor(i));
3447
- },
3448
- setSearchQuery: (q) => {
3449
- scanRequestRef.current = null;
3450
- elementPositions.current = { msgIdx: -1, positions: [] };
3451
- startPtrRef.current = -1;
3452
- setPositions?.(null);
3453
- const lq = q.toLowerCase();
3454
- const matches = [];
3455
- const prefixSum = [0];
3456
- if (lq) {
3457
- const msgs = jumpState.current.messages;
3458
- for (let i = 0;i < msgs.length; i++) {
3459
- const text = extractSearchText(msgs[i]);
3460
- let pos = text.indexOf(lq);
3461
- let cnt = 0;
3462
- while (pos >= 0) {
3463
- cnt++;
3464
- pos = text.indexOf(lq, pos + lq.length);
3465
- }
3466
- if (cnt > 0) {
3467
- matches.push(i);
3468
- prefixSum.push(prefixSum.at(-1) + cnt);
3469
- }
3470
- }
3471
- }
3472
- const total = prefixSum.at(-1);
3473
- let ptr = 0;
3474
- const s = scrollRef.current;
3475
- const { offsets: offsets2, start: start2, getItemTop: getItemTop2 } = jumpState.current;
3476
- const firstTop = getItemTop2(start2);
3477
- const origin = firstTop >= 0 ? firstTop - offsets2[start2] : 0;
3478
- if (matches.length > 0 && s) {
3479
- const curTop = searchAnchor.current >= 0 ? searchAnchor.current : s.getScrollTop();
3480
- let best = Infinity;
3481
- for (let k = 0;k < matches.length; k++) {
3482
- const d = Math.abs(origin + offsets2[matches[k]] - curTop);
3483
- if (d <= best) {
3484
- best = d;
3485
- ptr = k;
3486
- }
3487
- }
3488
- logForDebugging(`setSearchQuery('${q}'): ${matches.length} msgs \xB7 ptr=${ptr} ` + `msgIdx=${matches[ptr]} curTop=${curTop} origin=${origin}`);
3489
- }
3490
- searchState.current = { matches, ptr, screenOrd: 0, prefixSum };
3491
- if (matches.length > 0) {
3492
- jump(matches[ptr], true);
3493
- } else if (searchAnchor.current >= 0 && s) {
3494
- s.scrollTo(searchAnchor.current);
3495
- }
3496
- onSearchMatchesChange?.(total, matches.length > 0 ? prefixSum[ptr + 1] ?? total : 0);
3497
- },
3498
- nextMatch: () => step(1),
3499
- prevMatch: () => step(-1),
3500
- setAnchor: () => {
3501
- const s = scrollRef.current;
3502
- if (s)
3503
- searchAnchor.current = s.getScrollTop();
3504
- },
3505
- disarmSearch: () => {
3506
- setPositions?.(null);
3507
- scanRequestRef.current = null;
3508
- elementPositions.current = { msgIdx: -1, positions: [] };
3509
- startPtrRef.current = -1;
3510
- },
3511
- warmSearchIndex: async () => {
3512
- if (indexWarmed.current)
3513
- return 0;
3514
- const msgs = jumpState.current.messages;
3515
- const CHUNK = 500;
3516
- let workMs = 0;
3517
- const wallStart = performance.now();
3518
- for (let i = 0;i < msgs.length; i += CHUNK) {
3519
- await sleep(0);
3520
- const t0 = performance.now();
3521
- const end2 = Math.min(i + CHUNK, msgs.length);
3522
- for (let j = i;j < end2; j++) {
3523
- extractSearchText(msgs[j]);
3524
- }
3525
- workMs += performance.now() - t0;
3526
- }
3527
- const wallMs = Math.round(performance.now() - wallStart);
3528
- logForDebugging(`warmSearchIndex: ${msgs.length} msgs \xB7 work=${Math.round(workMs)}ms wall=${wallMs}ms chunks=${Math.ceil(msgs.length / CHUNK)}`);
3529
- indexWarmed.current = true;
3530
- return Math.round(workMs);
3531
- }
3532
- }), [scrollRef]);
3533
- const [hoveredKey, setHoveredKey] = import_react12.useState(null);
3534
- const handlersRef = import_react12.useRef({ onItemClick, setHoveredKey });
3535
- handlersRef.current = { onItemClick, setHoveredKey };
3536
- const onClickK = import_react12.useCallback((msg, cellIsBlank) => {
3537
- const h = handlersRef.current;
3538
- if (!cellIsBlank && h.onItemClick)
3539
- h.onItemClick(msg);
3540
- }, []);
3541
- const onEnterK = import_react12.useCallback((k) => {
3542
- handlersRef.current.setHoveredKey(k);
3543
- }, []);
3544
- const onLeaveK = import_react12.useCallback((k) => {
3545
- handlersRef.current.setHoveredKey((prev) => prev === k ? null : prev);
3546
- }, []);
3547
- return /* @__PURE__ */ jsx_dev_runtime19.jsxDEV(jsx_dev_runtime19.Fragment, {
3548
- children: [
3549
- /* @__PURE__ */ jsx_dev_runtime19.jsxDEV(ThemedBox_default, {
3550
- ref: spacerRef,
3551
- height: topSpacer,
3552
- flexShrink: 0
3553
- }, undefined, false, undefined, this),
3554
- messages.slice(start, end).map((msg, i) => {
3555
- const idx = start + i;
3556
- const k = keys[idx];
3557
- const clickable = !!onItemClick && (isItemClickable?.(msg) ?? true);
3558
- const hovered = clickable && hoveredKey === k;
3559
- const expanded = isItemExpanded?.(msg);
3560
- return /* @__PURE__ */ jsx_dev_runtime19.jsxDEV(VirtualItem, {
3561
- itemKey: k,
3562
- msg,
3563
- idx,
3564
- measureRef,
3565
- expanded,
3566
- hovered,
3567
- clickable,
3568
- onClickK,
3569
- onEnterK,
3570
- onLeaveK,
3571
- renderItem
3572
- }, k, false, undefined, this);
3573
- }),
3574
- bottomSpacer > 0 && /* @__PURE__ */ jsx_dev_runtime19.jsxDEV(ThemedBox_default, {
3575
- height: bottomSpacer,
3576
- flexShrink: 0
3577
- }, undefined, false, undefined, this),
3578
- trackStickyPrompt && /* @__PURE__ */ jsx_dev_runtime19.jsxDEV(StickyTracker, {
3579
- messages,
3580
- start,
3581
- end,
3582
- offsets,
3583
- getItemTop,
3584
- getItemElement,
3585
- scrollRef
3586
- }, undefined, false, undefined, this)
3587
- ]
3588
- }, undefined, true, undefined, this);
3589
- }
3590
- function StickyTracker({
3591
- messages,
3592
- start,
3593
- end,
3594
- offsets,
3595
- getItemTop,
3596
- getItemElement,
3597
- scrollRef
3598
- }) {
3599
- const { setStickyPrompt } = import_react12.useContext(ScrollChromeContext);
3600
- const subscribe = import_react12.useCallback((listener) => scrollRef.current?.subscribe(listener) ?? NOOP_UNSUB2, [scrollRef]);
3601
- import_react12.useSyncExternalStore(subscribe, () => {
3602
- const s = scrollRef.current;
3603
- if (!s)
3604
- return NaN;
3605
- const t = s.getScrollTop() + s.getPendingDelta();
3606
- return s.isSticky() ? -1 - t : t;
3607
- });
3608
- const isSticky = scrollRef.current?.isSticky() ?? true;
3609
- const target = Math.max(0, (scrollRef.current?.getScrollTop() ?? 0) + (scrollRef.current?.getPendingDelta() ?? 0));
3610
- let firstVisible = start;
3611
- let firstVisibleTop = -1;
3612
- for (let i = end - 1;i >= start; i--) {
3613
- const top = getItemTop(i);
3614
- if (top >= 0) {
3615
- if (top < target)
3616
- break;
3617
- firstVisibleTop = top;
3618
- }
3619
- firstVisible = i;
3620
- }
3621
- let idx = -1;
3622
- let text = null;
3623
- if (firstVisible > 0 && !isSticky) {
3624
- for (let i = firstVisible - 1;i >= 0; i--) {
3625
- const t = stickyPromptText(messages[i]);
3626
- if (t === null)
3627
- continue;
3628
- const top = getItemTop(i);
3629
- if (top >= 0 && top + 1 >= target)
3630
- continue;
3631
- idx = i;
3632
- text = t;
3633
- break;
3634
- }
3635
- }
3636
- const baseOffset = firstVisibleTop >= 0 ? firstVisibleTop - offsets[firstVisible] : 0;
3637
- const estimate = idx >= 0 ? Math.max(0, baseOffset + offsets[idx]) : -1;
3638
- const pending = import_react12.useRef({ idx: -1, tries: 0 });
3639
- const suppress = import_react12.useRef("none");
3640
- const lastIdx = import_react12.useRef(-1);
3641
- import_react12.useEffect(() => {
3642
- if (pending.current.idx >= 0)
3643
- return;
3644
- if (suppress.current === "armed") {
3645
- suppress.current = "force";
3646
- return;
3647
- }
3648
- const force = suppress.current === "force";
3649
- suppress.current = "none";
3650
- if (!force && lastIdx.current === idx)
3651
- return;
3652
- lastIdx.current = idx;
3653
- if (text === null) {
3654
- setStickyPrompt(null);
3655
- return;
3656
- }
3657
- const trimmed = text.trimStart();
3658
- const paraEnd = trimmed.search(/\n\s*\n/);
3659
- const collapsed = (paraEnd >= 0 ? trimmed.slice(0, paraEnd) : trimmed).slice(0, STICKY_TEXT_CAP).replace(/\s+/g, " ").trim();
3660
- if (collapsed === "") {
3661
- setStickyPrompt(null);
3662
- return;
3663
- }
3664
- const capturedIdx = idx;
3665
- const capturedEstimate = estimate;
3666
- setStickyPrompt({
3667
- text: collapsed,
3668
- scrollTo: () => {
3669
- setStickyPrompt("clicked");
3670
- suppress.current = "armed";
3671
- const el = getItemElement(capturedIdx);
3672
- if (el) {
3673
- scrollRef.current?.scrollToElement(el, 1);
3674
- } else {
3675
- scrollRef.current?.scrollTo(capturedEstimate);
3676
- pending.current = { idx: capturedIdx, tries: 0 };
3677
- }
3678
- }
3679
- });
3680
- });
3681
- import_react12.useEffect(() => {
3682
- if (pending.current.idx < 0)
3683
- return;
3684
- const el = getItemElement(pending.current.idx);
3685
- if (el) {
3686
- scrollRef.current?.scrollToElement(el, 1);
3687
- pending.current = { idx: -1, tries: 0 };
3688
- } else if (++pending.current.tries > 5) {
3689
- pending.current = { idx: -1, tries: 0 };
3690
- }
3691
- });
3692
- return null;
3693
- }
3694
- var import_react12, jsx_dev_runtime19, HEADROOM = 3, fallbackLowerCache, STICKY_TEXT_CAP = 500, promptTextCache, NOOP_UNSUB2 = () => {};
3695
- var init_VirtualMessageList = __esm(() => {
3696
- init_useVirtualScroll();
3697
- init_src();
3698
- init_ThemedText();
3699
- init_FullscreenLayout();
3700
- init_debug();
3701
- init_sleep();
3702
- init_transcriptSearch();
3703
- init_messageActions();
3704
- import_react12 = __toESM(require_react(), 1);
3705
- jsx_dev_runtime19 = __toESM(require_jsx_dev_runtime(), 1);
3706
- fallbackLowerCache = new WeakMap;
3707
- promptTextCache = new WeakMap;
3708
- });
3709
-
3710
- // src/components/Messages.tsx
3711
- function filterForBriefTool(messages, briefToolNames) {
3712
- const nameSet = new Set(briefToolNames);
3713
- const briefToolUseIDs = new Set;
3714
- return messages.filter((msg) => {
3715
- if (msg.type === "system")
3716
- return msg.subtype !== "api_metrics";
3717
- const block = msg.message?.content[0];
3718
- if (msg.type === "assistant") {
3719
- if (msg.isApiErrorMessage)
3720
- return true;
3721
- if (block?.type === "tool_use" && block.name && nameSet.has(block.name)) {
3722
- if ("id" in block) {
3723
- briefToolUseIDs.add(block.id);
3724
- }
3725
- return true;
3726
- }
3727
- return false;
3728
- }
3729
- if (msg.type === "user") {
3730
- if (block?.type === "tool_result") {
3731
- return block.tool_use_id !== undefined && briefToolUseIDs.has(block.tool_use_id);
3732
- }
3733
- return !msg.isMeta;
3734
- }
3735
- if (msg.type === "attachment") {
3736
- const att = msg.attachment;
3737
- return att?.type === "queued_command" && att.commandMode === "prompt" && !att.isMeta && att.origin === undefined;
3738
- }
3739
- return false;
3740
- });
3741
- }
3742
- function dropTextInBriefTurns(messages, briefToolNames) {
3743
- const nameSet = new Set(briefToolNames);
3744
- const turnsWithBrief = new Set;
3745
- const textIndexToTurn = [];
3746
- let turn = 0;
3747
- for (let i = 0;i < messages.length; i++) {
3748
- const msg = messages[i];
3749
- const block = msg.message?.content[0];
3750
- if (msg.type === "user" && block?.type !== "tool_result" && !msg.isMeta) {
3751
- turn++;
3752
- continue;
3753
- }
3754
- if (msg.type === "assistant") {
3755
- if (block?.type === "text") {
3756
- textIndexToTurn[i] = turn;
3757
- } else if (block?.type === "tool_use" && block.name && nameSet.has(block.name)) {
3758
- turnsWithBrief.add(turn);
3759
- }
3760
- }
3761
- }
3762
- if (turnsWithBrief.size === 0)
3763
- return messages;
3764
- return messages.filter((_, i) => {
3765
- const t = textIndexToTurn[i];
3766
- return t === undefined || !turnsWithBrief.has(t);
3767
- });
3768
- }
3769
- function computeSliceStart(collapsed, anchorRef, cap = MAX_MESSAGES_WITHOUT_VIRTUALIZATION, step = MESSAGE_CAP_STEP) {
3770
- const anchor = anchorRef.current;
3771
- const anchorIdx = anchor ? collapsed.findIndex((m) => m.uuid === anchor.uuid) : -1;
3772
- let start = anchorIdx >= 0 ? anchorIdx : anchor ? Math.min(anchor.idx, Math.max(0, collapsed.length - cap)) : 0;
3773
- if (collapsed.length - start > cap + step) {
3774
- start = collapsed.length - cap;
3775
- }
3776
- const msgAtStart = collapsed[start];
3777
- if (msgAtStart && (anchor?.uuid !== msgAtStart.uuid || anchor.idx !== start)) {
3778
- anchorRef.current = { uuid: msgAtStart.uuid, idx: start };
3779
- } else if (!msgAtStart && anchor) {
3780
- anchorRef.current = null;
3781
- }
3782
- return start;
3783
- }
3784
- function expandKey(msg) {
3785
- return (msg.type === "assistant" || msg.type === "user" ? getToolUseID(msg) : null) ?? msg.uuid;
3786
- }
3787
- function setsEqual(a, b) {
3788
- if (a.size !== b.size)
3789
- return false;
3790
- for (const item of a) {
3791
- if (!b.has(item))
3792
- return false;
3793
- }
3794
- return true;
3795
- }
3796
- function shouldRenderStatically(message, streamingToolUseIDs, inProgressToolUseIDs, siblingToolUseIDs, screen, lookups) {
3797
- if (screen === "transcript") {
3798
- return true;
3799
- }
3800
- switch (message.type) {
3801
- case "attachment":
3802
- case "user":
3803
- case "assistant": {
3804
- if (message.type === "assistant") {
3805
- const block = message.message.content[0];
3806
- if (block?.type === "server_tool_use") {
3807
- return lookups.resolvedToolUseIDs.has(block.id);
3808
- }
3809
- }
3810
- const toolUseID = getToolUseID(message);
3811
- if (!toolUseID) {
3812
- return true;
3813
- }
3814
- if (streamingToolUseIDs.has(toolUseID)) {
3815
- return false;
3816
- }
3817
- if (inProgressToolUseIDs.has(toolUseID)) {
3818
- return false;
3819
- }
3820
- if (hasUnresolvedHooksFromLookup(toolUseID, "PostToolUse", lookups)) {
3821
- return false;
3822
- }
3823
- return every(siblingToolUseIDs, lookups.resolvedToolUseIDs);
3824
- }
3825
- case "system": {
3826
- return message.subtype !== "api_error";
3827
- }
3828
- case "grouped_tool_use": {
3829
- const allResolved = message.messages.every((msg) => {
3830
- const content = msg.message.content[0];
3831
- return content?.type === "tool_use" && lookups.resolvedToolUseIDs.has(content.id);
3832
- });
3833
- return allResolved;
3834
- }
3835
- case "collapsed_read_search": {
3836
- return false;
3837
- }
3838
- }
3839
- }
3840
- var React6, import_react13, jsx_dev_runtime20, LogoHeader, proactiveModule = null, BRIEF_TOOL_NAME, SEND_USER_FILE_TOOL_NAME = null, MAX_MESSAGES_TO_SHOW_IN_TRANSCRIPT_MODE = 30, MAX_MESSAGES_WITHOUT_VIRTUALIZATION = 200, MESSAGE_CAP_STEP = 50, MessagesImpl = ({
3841
- messages,
3842
- tools,
3843
- commands,
3844
- verbose,
3845
- toolJSX,
3846
- toolUseConfirmQueue,
3847
- inProgressToolUseIDs,
3848
- isMessageSelectorVisible,
3849
- conversationId,
3850
- screen,
3851
- streamingToolUses,
3852
- showAllInTranscript = false,
3853
- agentDefinitions,
3854
- onOpenRateLimitOptions,
3855
- hideLogo = false,
3856
- isLoading,
3857
- hidePastThinking = false,
3858
- streamingThinking,
3859
- streamingText,
3860
- isBriefOnly = false,
3861
- unseenDivider,
3862
- scrollRef,
3863
- trackStickyPrompt,
3864
- jumpRef,
3865
- onSearchMatchesChange,
3866
- scanElement,
3867
- setPositions,
3868
- disableRenderCap = false,
3869
- cursor = null,
3870
- setCursor,
3871
- cursorNavRef,
3872
- renderRange
3873
- }) => {
3874
- const { columns } = useTerminalSize();
3875
- const toggleShowAllShortcut = useShortcutDisplay("transcript:toggleShowAll", "Transcript", "Ctrl+E");
3876
- const normalizedMessages = import_react13.useMemo(() => normalizeMessages(messages).filter(isNotEmptyMessage), [messages]);
3877
- const isStreamingThinkingVisible = import_react13.useMemo(() => {
3878
- if (!streamingThinking)
3879
- return false;
3880
- if (streamingThinking.isStreaming)
3881
- return true;
3882
- if (streamingThinking.streamingEndedAt) {
3883
- return Date.now() - streamingThinking.streamingEndedAt < 30000;
3884
- }
3885
- return false;
3886
- }, [streamingThinking]);
3887
- const lastThinkingBlockId = import_react13.useMemo(() => {
3888
- if (!hidePastThinking)
3889
- return null;
3890
- if (isStreamingThinkingVisible)
3891
- return "streaming";
3892
- for (let i = normalizedMessages.length - 1;i >= 0; i--) {
3893
- const msg = normalizedMessages[i];
3894
- if (msg?.type === "assistant") {
3895
- const content = msg.message.content;
3896
- for (let j = content.length - 1;j >= 0; j--) {
3897
- if (content[j]?.type === "thinking") {
3898
- return `${msg.uuid}:${j}`;
3899
- }
3900
- }
3901
- } else if (msg?.type === "user") {
3902
- const hasToolResult = msg.message.content.some((block) => block.type === "tool_result");
3903
- if (!hasToolResult) {
3904
- return "no-thinking";
3905
- }
3906
- }
3907
- }
3908
- return null;
3909
- }, [normalizedMessages, hidePastThinking, isStreamingThinkingVisible]);
3910
- const latestBashOutputUUID = import_react13.useMemo(() => {
3911
- for (let i = normalizedMessages.length - 1;i >= 0; i--) {
3912
- const msg = normalizedMessages[i];
3913
- if (msg?.type === "user") {
3914
- const content = msg.message.content;
3915
- for (const block of content) {
3916
- if (block.type === "text") {
3917
- const text = block.text;
3918
- if (text.startsWith("<bash-stdout") || text.startsWith("<bash-stderr")) {
3919
- return msg.uuid;
3920
- }
3921
- }
3922
- }
3923
- }
3924
- }
3925
- return null;
3926
- }, [normalizedMessages]);
3927
- const normalizedToolUseIDs = import_react13.useMemo(() => getToolUseIDs(normalizedMessages), [normalizedMessages]);
3928
- const streamingToolUsesWithoutInProgress = import_react13.useMemo(() => streamingToolUses.filter((stu) => !inProgressToolUseIDs.has(stu.contentBlock.id) && !normalizedToolUseIDs.has(stu.contentBlock.id)), [streamingToolUses, inProgressToolUseIDs, normalizedToolUseIDs]);
3929
- const syntheticStreamingToolUseMessages = import_react13.useMemo(() => streamingToolUsesWithoutInProgress.flatMap((streamingToolUse) => {
3930
- const msg = createAssistantMessage({
3931
- content: [streamingToolUse.contentBlock]
3932
- });
3933
- msg.uuid = deriveUUID(streamingToolUse.contentBlock.id, 0);
3934
- return normalizeMessages([msg]);
3935
- }), [streamingToolUsesWithoutInProgress]);
3936
- const isTranscriptMode = screen === "transcript";
3937
- const disableVirtualScroll = import_react13.useMemo(() => isEnvTruthy(process.env.CLAUDE_CODE_DISABLE_VIRTUAL_SCROLL), []);
3938
- const virtualScrollRuntimeGate = scrollRef != null && !disableVirtualScroll;
3939
- const shouldTruncate = isTranscriptMode && !showAllInTranscript && !virtualScrollRuntimeGate;
3940
- const sliceAnchorRef = import_react13.useRef(null);
3941
- const { collapsed, lookups, hasTruncatedMessages, hiddenMessageCount } = import_react13.useMemo(() => {
3942
- const compactAwareMessages = verbose || isFullscreenEnvEnabled() ? normalizedMessages : getMessagesAfterCompactBoundary(normalizedMessages, {
3943
- includeSnipped: true
3944
- });
3945
- const messagesToShowNotTruncated = reorderMessagesInUI(compactAwareMessages.filter((msg) => msg.type !== "progress").filter((msg) => !isNullRenderingAttachment(msg)).filter((_) => shouldShowUserMessage(_, isTranscriptMode)), syntheticStreamingToolUseMessages);
3946
- const briefToolNames = [BRIEF_TOOL_NAME, SEND_USER_FILE_TOOL_NAME].filter((n) => n !== null);
3947
- const dropTextToolNames = [BRIEF_TOOL_NAME].filter((n) => n !== null);
3948
- const briefFiltered = briefToolNames.length > 0 && !isTranscriptMode ? isBriefOnly ? filterForBriefTool(messagesToShowNotTruncated, briefToolNames) : dropTextToolNames.length > 0 ? dropTextInBriefTurns(messagesToShowNotTruncated, dropTextToolNames) : messagesToShowNotTruncated : messagesToShowNotTruncated;
3949
- const messagesToShow = shouldTruncate ? briefFiltered.slice(-MAX_MESSAGES_TO_SHOW_IN_TRANSCRIPT_MODE) : briefFiltered;
3950
- const hasTruncatedMessages2 = shouldTruncate && briefFiltered.length > MAX_MESSAGES_TO_SHOW_IN_TRANSCRIPT_MODE;
3951
- const { messages: groupedMessages } = applyGrouping(messagesToShow, tools, verbose);
3952
- const collapsed2 = collapseBackgroundBashNotifications(collapseHookSummaries(collapseTeammateShutdowns(collapseReadSearchGroups(groupedMessages, tools))), verbose);
3953
- const lookups2 = buildMessageLookups(normalizedMessages, messagesToShow);
3954
- const hiddenMessageCount2 = messagesToShowNotTruncated.length - MAX_MESSAGES_TO_SHOW_IN_TRANSCRIPT_MODE;
3955
- return {
3956
- collapsed: collapsed2,
3957
- lookups: lookups2,
3958
- hasTruncatedMessages: hasTruncatedMessages2,
3959
- hiddenMessageCount: hiddenMessageCount2
3960
- };
3961
- }, [
3962
- verbose,
3963
- normalizedMessages,
3964
- isTranscriptMode,
3965
- syntheticStreamingToolUseMessages,
3966
- shouldTruncate,
3967
- tools,
3968
- isBriefOnly
3969
- ]);
3970
- const renderableMessages = import_react13.useMemo(() => {
3971
- const capApplies = !virtualScrollRuntimeGate && !disableRenderCap;
3972
- const sliceStart = capApplies ? computeSliceStart(collapsed, sliceAnchorRef) : 0;
3973
- return renderRange ? collapsed.slice(renderRange[0], renderRange[1]) : sliceStart > 0 ? collapsed.slice(sliceStart) : collapsed;
3974
- }, [collapsed, renderRange, virtualScrollRuntimeGate, disableRenderCap]);
3975
- const streamingToolUseIDs = import_react13.useMemo(() => new Set(streamingToolUses.map((_) => _.contentBlock.id)), [streamingToolUses]);
3976
- const dividerBeforeIndex = import_react13.useMemo(() => {
3977
- if (!unseenDivider)
3978
- return -1;
3979
- const prefix = unseenDivider.firstUnseenUuid.slice(0, 24);
3980
- return renderableMessages.findIndex((m) => m.uuid.slice(0, 24) === prefix);
3981
- }, [unseenDivider, renderableMessages]);
3982
- const selectedIdx = import_react13.useMemo(() => {
3983
- if (!cursor)
3984
- return -1;
3985
- return renderableMessages.findIndex((m) => m.uuid === cursor.uuid);
3986
- }, [cursor, renderableMessages]);
3987
- const [expandedKeys, setExpandedKeys] = import_react13.useState(() => new Set);
3988
- const onItemClick = import_react13.useCallback((msg) => {
3989
- const k = expandKey(msg);
3990
- setExpandedKeys((prev) => {
3991
- const next = new Set(prev);
3992
- if (next.has(k))
3993
- next.delete(k);
3994
- else
3995
- next.add(k);
3996
- return next;
3997
- });
3998
- }, []);
3999
- const isItemExpanded = import_react13.useCallback((msg) => expandedKeys.size > 0 && expandedKeys.has(expandKey(msg)), [expandedKeys]);
4000
- const lookupsRef = import_react13.useRef(lookups);
4001
- lookupsRef.current = lookups;
4002
- const isItemClickable = import_react13.useCallback((msg) => {
4003
- if (msg.type === "collapsed_read_search")
4004
- return true;
4005
- if (msg.type === "assistant") {
4006
- const b2 = msg.message.content[0];
4007
- return b2 != null && isAdvisorBlock(b2) && b2.type === "advisor_tool_result" && b2.content.type === "advisor_result";
4008
- }
4009
- if (msg.type !== "user")
4010
- return false;
4011
- const b = msg.message.content[0];
4012
- if (b?.type !== "tool_result" || b.is_error || !msg.toolUseResult)
4013
- return false;
4014
- const name = lookupsRef.current.toolUseByToolUseID.get(b.tool_use_id)?.name;
4015
- const tool = name ? findToolByName(tools, name) : undefined;
4016
- return tool?.isResultTruncated?.(msg.toolUseResult) ?? false;
4017
- }, [tools]);
4018
- const canAnimate = (!toolJSX || !!toolJSX.shouldContinueAnimation) && !toolUseConfirmQueue.length && !isMessageSelectorVisible;
4019
- const hasToolsInProgress = inProgressToolUseIDs.size > 0;
4020
- const { progress } = useTerminalNotification();
4021
- const prevProgressState = import_react13.useRef(null);
4022
- const progressEnabled = getGlobalConfig().terminalProgressBarEnabled && !getIsRemoteMode() && !(proactiveModule?.isProactiveActive() ?? false);
4023
- import_react13.useEffect(() => {
4024
- const state = progressEnabled ? hasToolsInProgress ? "indeterminate" : "completed" : null;
4025
- if (prevProgressState.current === state)
4026
- return;
4027
- prevProgressState.current = state;
4028
- progress(state);
4029
- }, [progress, progressEnabled, hasToolsInProgress]);
4030
- import_react13.useEffect(() => {
4031
- return () => progress(null);
4032
- }, [progress]);
4033
- const messageKey = import_react13.useCallback((msg) => `${msg.uuid}-${conversationId}`, [conversationId]);
4034
- const renderMessageRow = (msg, index) => {
4035
- const prevType = index > 0 ? renderableMessages[index - 1]?.type : undefined;
4036
- const isUserContinuation = msg.type === "user" && prevType === "user";
4037
- const hasContentAfter = msg.type === "collapsed_read_search" && (!!streamingText || hasContentAfterIndex(renderableMessages, index, tools, streamingToolUseIDs));
4038
- const k = messageKey(msg);
4039
- const row = /* @__PURE__ */ jsx_dev_runtime20.jsxDEV(MessageRow, {
4040
- message: msg,
4041
- isUserContinuation,
4042
- hasContentAfter,
4043
- tools,
4044
- commands,
4045
- verbose: verbose || isItemExpanded(msg) || cursor?.expanded === true && index === selectedIdx,
4046
- inProgressToolUseIDs,
4047
- streamingToolUseIDs,
4048
- screen,
4049
- canAnimate,
4050
- onOpenRateLimitOptions,
4051
- lastThinkingBlockId,
4052
- latestBashOutputUUID,
4053
- columns,
4054
- isLoading,
4055
- lookups
4056
- }, k, false, undefined, this);
4057
- const wrapped = /* @__PURE__ */ jsx_dev_runtime20.jsxDEV(MessageActionsSelectedContext.Provider, {
4058
- value: index === selectedIdx,
4059
- children: row
4060
- }, k, false, undefined, this);
4061
- if (unseenDivider && index === dividerBeforeIndex) {
4062
- return [
4063
- /* @__PURE__ */ jsx_dev_runtime20.jsxDEV(ThemedBox_default, {
4064
- marginTop: 1,
4065
- children: /* @__PURE__ */ jsx_dev_runtime20.jsxDEV(Divider, {
4066
- title: `${unseenDivider.count} new ${plural(unseenDivider.count, "message")}`,
4067
- width: columns,
4068
- color: "inactive"
4069
- }, undefined, false, undefined, this)
4070
- }, "unseen-divider", false, undefined, this),
4071
- wrapped
4072
- ];
4073
- }
4074
- return wrapped;
4075
- };
4076
- const searchTextCache2 = import_react13.useRef(new WeakMap);
4077
- const extractSearchText = import_react13.useCallback((msg) => {
4078
- const cached = searchTextCache2.current.get(msg);
4079
- if (cached !== undefined)
4080
- return cached;
4081
- let text = renderableSearchText(msg);
4082
- if (msg.type === "user" && msg.toolUseResult && Array.isArray(msg.message.content)) {
4083
- const tr = msg.message.content.find((b) => b.type === "tool_result");
4084
- if (tr && "tool_use_id" in tr) {
4085
- const tu = lookups.toolUseByToolUseID.get(tr.tool_use_id);
4086
- const tool = tu && findToolByName(tools, tu.name);
4087
- const extracted = tool?.extractSearchText?.(msg.toolUseResult);
4088
- if (extracted !== undefined)
4089
- text = extracted;
4090
- }
4091
- }
4092
- const lowered = text.toLowerCase();
4093
- searchTextCache2.current.set(msg, lowered);
4094
- return lowered;
4095
- }, [tools, lookups]);
4096
- return /* @__PURE__ */ jsx_dev_runtime20.jsxDEV(jsx_dev_runtime20.Fragment, {
4097
- children: [
4098
- !hideLogo && !(renderRange && renderRange[0] > 0) && /* @__PURE__ */ jsx_dev_runtime20.jsxDEV(LogoHeader, {
4099
- agentDefinitions
4100
- }, undefined, false, undefined, this),
4101
- hasTruncatedMessages && /* @__PURE__ */ jsx_dev_runtime20.jsxDEV(Divider, {
4102
- title: `${toggleShowAllShortcut} to show ${source_default.bold(hiddenMessageCount)} previous messages`,
4103
- width: columns
4104
- }, undefined, false, undefined, this),
4105
- isTranscriptMode && showAllInTranscript && hiddenMessageCount > 0 && !disableRenderCap && /* @__PURE__ */ jsx_dev_runtime20.jsxDEV(Divider, {
4106
- title: `${toggleShowAllShortcut} to hide ${source_default.bold(hiddenMessageCount)} previous messages`,
4107
- width: columns
4108
- }, undefined, false, undefined, this),
4109
- virtualScrollRuntimeGate ? /* @__PURE__ */ jsx_dev_runtime20.jsxDEV(InVirtualListContext.Provider, {
4110
- value: true,
4111
- children: /* @__PURE__ */ jsx_dev_runtime20.jsxDEV(VirtualMessageList, {
4112
- messages: renderableMessages,
4113
- scrollRef,
4114
- columns,
4115
- itemKey: messageKey,
4116
- renderItem: renderMessageRow,
4117
- onItemClick,
4118
- isItemClickable,
4119
- isItemExpanded,
4120
- trackStickyPrompt,
4121
- selectedIndex: selectedIdx >= 0 ? selectedIdx : undefined,
4122
- cursorNavRef,
4123
- setCursor,
4124
- jumpRef,
4125
- onSearchMatchesChange,
4126
- scanElement,
4127
- setPositions,
4128
- extractSearchText
4129
- }, undefined, false, undefined, this)
4130
- }, undefined, false, undefined, this) : renderableMessages.flatMap(renderMessageRow),
4131
- streamingText && !isBriefOnly && /* @__PURE__ */ jsx_dev_runtime20.jsxDEV(ThemedBox_default, {
4132
- alignItems: "flex-start",
4133
- flexDirection: "row",
4134
- marginTop: 1,
4135
- width: "100%",
4136
- children: /* @__PURE__ */ jsx_dev_runtime20.jsxDEV(ThemedBox_default, {
4137
- flexDirection: "row",
4138
- children: [
4139
- /* @__PURE__ */ jsx_dev_runtime20.jsxDEV(ThemedBox_default, {
4140
- minWidth: 2,
4141
- children: /* @__PURE__ */ jsx_dev_runtime20.jsxDEV(ThemedText, {
4142
- color: "text",
4143
- children: BLACK_CIRCLE
4144
- }, undefined, false, undefined, this)
4145
- }, undefined, false, undefined, this),
4146
- /* @__PURE__ */ jsx_dev_runtime20.jsxDEV(ThemedBox_default, {
4147
- flexDirection: "column",
4148
- children: /* @__PURE__ */ jsx_dev_runtime20.jsxDEV(StreamingMarkdown, {
4149
- children: streamingText
4150
- }, undefined, false, undefined, this)
4151
- }, undefined, false, undefined, this)
4152
- ]
4153
- }, undefined, true, undefined, this)
4154
- }, undefined, false, undefined, this),
4155
- isStreamingThinkingVisible && streamingThinking && !isBriefOnly && /* @__PURE__ */ jsx_dev_runtime20.jsxDEV(ThemedBox_default, {
4156
- marginTop: 1,
4157
- children: /* @__PURE__ */ jsx_dev_runtime20.jsxDEV(AssistantThinkingMessage, {
4158
- param: {
4159
- type: "thinking",
4160
- thinking: streamingThinking.thinking
4161
- },
4162
- addMargin: false,
4163
- isTranscriptMode: true,
4164
- verbose,
4165
- hideInTranscript: false
4166
- }, undefined, false, undefined, this)
4167
- }, undefined, false, undefined, this)
4168
- ]
4169
- }, undefined, true, undefined, this);
4170
- }, Messages;
4171
- var init_Messages = __esm(() => {
4172
- init_source();
4173
- init_set();
4174
- init_state();
4175
- init_figures2();
4176
- init_useTerminalSize();
4177
- init_src();
4178
- init_src();
4179
- init_useShortcutDisplay();
4180
- init_Tool();
4181
- init_advisor();
4182
- init_collapseBackgroundBashNotifications();
4183
- init_collapseHookSummaries();
4184
- init_collapseReadSearch();
4185
- init_collapseTeammateShutdowns();
4186
- init_config();
4187
- init_envUtils();
4188
- init_fullscreen();
4189
- init_groupToolUses();
4190
- init_messages();
4191
- init_stringUtils();
4192
- init_transcriptSearch();
4193
- init_src();
4194
- init_LogoV2();
4195
- init_Markdown();
4196
- init_MessageRow();
4197
- init_messageActions();
4198
- init_AssistantThinkingMessage();
4199
- init_nullRenderingAttachments();
4200
- init_OffscreenFreeze();
4201
- init_StatusNotices();
4202
- init_VirtualMessageList();
4203
- React6 = __toESM(require_react(), 1);
4204
- import_react13 = __toESM(require_react(), 1);
4205
- jsx_dev_runtime20 = __toESM(require_jsx_dev_runtime(), 1);
4206
- LogoHeader = React6.memo(function LogoHeader2({
4207
- agentDefinitions
4208
- }) {
4209
- return /* @__PURE__ */ jsx_dev_runtime20.jsxDEV(OffscreenFreeze, {
4210
- children: /* @__PURE__ */ jsx_dev_runtime20.jsxDEV(ThemedBox_default, {
4211
- flexDirection: "column",
4212
- gap: 1,
4213
- children: [
4214
- /* @__PURE__ */ jsx_dev_runtime20.jsxDEV(LogoV2, {}, undefined, false, undefined, this),
4215
- /* @__PURE__ */ jsx_dev_runtime20.jsxDEV(React6.Suspense, {
4216
- fallback: null,
4217
- children: /* @__PURE__ */ jsx_dev_runtime20.jsxDEV(StatusNotices, {
4218
- agentDefinitions
4219
- }, undefined, false, undefined, this)
4220
- }, undefined, false, undefined, this)
4221
- ]
4222
- }, undefined, true, undefined, this)
4223
- }, undefined, false, undefined, this);
4224
- });
4225
- BRIEF_TOOL_NAME = (init_prompt(), __toCommonJS(exports_prompt)).BRIEF_TOOL_NAME;
4226
- Messages = React6.memo(MessagesImpl, (prev, next) => {
4227
- const keys = Object.keys(prev);
4228
- for (const key of keys) {
4229
- if (key === "onOpenRateLimitOptions" || key === "scrollRef" || key === "trackStickyPrompt" || key === "setCursor" || key === "cursorNavRef" || key === "jumpRef" || key === "onSearchMatchesChange" || key === "scanElement" || key === "setPositions")
4230
- continue;
4231
- if (prev[key] !== next[key]) {
4232
- if (key === "streamingToolUses") {
4233
- const p = prev.streamingToolUses;
4234
- const n = next.streamingToolUses;
4235
- if (p.length === n.length && p.every((item, i) => item.contentBlock === n[i]?.contentBlock)) {
4236
- continue;
4237
- }
4238
- }
4239
- if (key === "inProgressToolUseIDs") {
4240
- if (setsEqual(prev.inProgressToolUseIDs, next.inProgressToolUseIDs)) {
4241
- continue;
4242
- }
4243
- }
4244
- if (key === "unseenDivider") {
4245
- const p = prev.unseenDivider;
4246
- const n = next.unseenDivider;
4247
- if (p?.firstUnseenUuid === n?.firstUnseenUuid && p?.count === n?.count) {
4248
- continue;
4249
- }
4250
- }
4251
- if (key === "tools") {
4252
- const p = prev.tools;
4253
- const n = next.tools;
4254
- if (p.length === n.length && p.every((tool, i) => tool.name === n[i]?.name)) {
4255
- continue;
4256
- }
4257
- }
4258
- return false;
4259
- }
4260
- }
4261
- return true;
4262
- });
4263
- });
4264
-
4265
- export { useSetPromptOverlay, useSetPromptOverlayDialog, init_promptOverlayContext, useUnseenDivider, computeUnseenDivider, FullscreenLayout, init_FullscreenLayout, Messages, init_Messages };