@costrict/csc 4.0.1

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