@qwen-code/qwen-code 0.21.0 → 0.21.1-nightly.20260731.702932cc7

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 (423) hide show
  1. package/bundled/qc-helper/docs/configuration/model-providers.md +2 -0
  2. package/bundled/qc-helper/docs/configuration/settings.md +39 -28
  3. package/bundled/qc-helper/docs/features/channels/_meta.ts +2 -0
  4. package/bundled/qc-helper/docs/features/channels/github.md +139 -0
  5. package/bundled/qc-helper/docs/features/channels/gitlab.md +171 -0
  6. package/bundled/qc-helper/docs/features/channels/overview.md +61 -6
  7. package/bundled/qc-helper/docs/features/code-review.md +21 -1
  8. package/bundled/qc-helper/docs/features/hooks.md +72 -15
  9. package/bundled/qc-helper/docs/features/mcp.md +9 -1
  10. package/bundled/qc-helper/docs/features/scheduled-tasks.md +3 -1
  11. package/bundled/qc-helper/docs/features/sub-agents.md +42 -8
  12. package/bundled/qc-helper/docs/qwen-serve.md +11 -7
  13. package/bundled/qc-helper/docs/reference/keyboard-shortcuts.md +2 -2
  14. package/bundled/qc-helper/docs/support/troubleshooting.md +2 -1
  15. package/bundled/review/DESIGN.md +19 -0
  16. package/bundled/review/SKILL.md +120 -61
  17. package/chunks/MaxSizedBox-LAFHK4VO.js +88 -0
  18. package/chunks/{StandaloneSessionPicker-BIRMPLRD.js → StandaloneSessionPicker-EMNOBN3S.js} +71 -68
  19. package/chunks/{acp-startup-profiler-RV3IV562.js → acp-startup-profiler-2C4A5ZTJ.js} +2 -2
  20. package/chunks/{acpAgent-6J2U72PQ.js → acpAgent-ERFA6HWV.js} +1674 -591
  21. package/chunks/agent-PLKF6JK4.js +84 -0
  22. package/chunks/agent-headless-JAORDQ63.js +78 -0
  23. package/chunks/{anthropicContentGenerator-75BKLTSP.js → anthropicContentGenerator-OFHSZJBF.js} +79 -27
  24. package/chunks/{artifact-tool-Y5T7GG7F.js → artifact-tool-RDN2W7ND.js} +4 -4
  25. package/chunks/{askUserQuestion-2H6747FR.js → askUserQuestion-OZERWH5R.js} +4 -4
  26. package/chunks/bridge-NYOBVRIT.js +94 -0
  27. package/chunks/{build-RV63TIRH.js → build-GDBLPA24.js} +1 -1
  28. package/chunks/{ca-25EDXPFZ.js → ca-6W3SK7OQ.js} +6 -1
  29. package/chunks/channel-management-service-5S7YCWX5.js +418 -0
  30. package/chunks/channel-settings-store-NLOKYO23.js +91 -0
  31. package/chunks/{channel-worker-group-2ZD7TVAT.js → channel-worker-group-OVWGYMZS.js} +11 -6
  32. package/chunks/{channel-worker-manager-4OA4BCGB.js → channel-worker-manager-H55GKOQA.js} +11 -6
  33. package/chunks/{channel-worker-supervisor-V7KCFJTS.js → channel-worker-supervisor-CABBXYHK.js} +7 -5
  34. package/chunks/{chunk-RIBKPMRP.js → chunk-23F4XGWO.js} +19 -6
  35. package/chunks/{chunk-ACY3A37B.js → chunk-25VHI5T7.js} +23 -18
  36. package/chunks/{chunk-MZAXJAUM.js → chunk-26JK4RPD.js} +1 -1
  37. package/chunks/{chunk-6GMVPFB2.js → chunk-2IIJTXYF.js} +45 -16
  38. package/chunks/{chunk-BPJSQIJX.js → chunk-2J3OJGTL.js} +0 -2
  39. package/chunks/{chunk-2X55UKQE.js → chunk-2JZR3B4A.js} +3 -3
  40. package/chunks/{chunk-7JURR4JT.js → chunk-2OQUICDM.js} +167 -81
  41. package/chunks/{chunk-ZJHVAS7M.js → chunk-2YCYFWYZ.js} +4 -5
  42. package/chunks/{chunk-3QMGYBFN.js → chunk-3APUUXRF.js} +1 -80
  43. package/chunks/{chunk-MUP3T3AD.js → chunk-3I6DUGQD.js} +1 -35
  44. package/chunks/{chunk-JVPM2ULZ.js → chunk-3XZ5SSNR.js} +6 -6
  45. package/chunks/chunk-42VPM33K.js +319 -0
  46. package/chunks/{chunk-VAK25FTU.js → chunk-45IOTAUS.js} +1 -1
  47. package/chunks/chunk-45UYUCJ6.js +363 -0
  48. package/chunks/{chunk-JZA3JUDJ.js → chunk-4KP2F2TE.js} +1 -1
  49. package/chunks/{chunk-IO3IX5Q4.js → chunk-4YJQD2IO.js} +1 -1
  50. package/chunks/{chunk-JXJFVC6E.js → chunk-5G6XUGXO.js} +61 -14
  51. package/chunks/{chunk-ZOIFNCKL.js → chunk-5NNHICSA.js} +3 -23
  52. package/chunks/{chunk-A4UCTEB5.js → chunk-5WV5S2GT.js} +0 -1
  53. package/chunks/{chunk-RHLZR4E5.js → chunk-675H6PLP.js} +1 -1
  54. package/chunks/chunk-6FMJLI5M.js +1591 -0
  55. package/chunks/chunk-6MPDY6ZG.js +76 -0
  56. package/chunks/{chunk-PSOO6YXD.js → chunk-6NUWQ3R7.js} +9 -7
  57. package/chunks/{chunk-7MVVZO4N.js → chunk-6ZRWX46I.js} +4 -4
  58. package/chunks/{chunk-TPRQ7RZH.js → chunk-76E5Y3UZ.js} +3117 -993
  59. package/chunks/{chunk-UUUTRMI2.js → chunk-7ULQIS27.js} +1 -1
  60. package/chunks/{chunk-BKHWX6I2.js → chunk-A5BZ722X.js} +11 -3
  61. package/chunks/{chunk-TEHGS6UP.js → chunk-A5T5W7PR.js} +154 -16
  62. package/chunks/{chunk-VIA5XA4U.js → chunk-A5UODYG3.js} +4 -1
  63. package/chunks/{chunk-JLU636DO.js → chunk-ALMR3E6Q.js} +1 -0
  64. package/chunks/{chunk-EBJQ6AXW.js → chunk-ANDVK2JN.js} +358 -14
  65. package/chunks/{chunk-TOFQCPDC.js → chunk-AOHY3QJ3.js} +14 -8
  66. package/chunks/chunk-AQ37AY7B.js +93 -0
  67. package/chunks/{chunk-PJIZUQVC.js → chunk-AZQ3DT76.js} +2 -2
  68. package/chunks/{chunk-LKEJ26GS.js → chunk-B3TA3IF5.js} +16 -11
  69. package/chunks/{chunk-Q4M4MDQ4.js → chunk-B43QHWY6.js} +1 -1
  70. package/chunks/{chunk-UH3WSE5L.js → chunk-B4AJNNOL.js} +1 -6
  71. package/chunks/{chunk-K36B6G2O.js → chunk-B6FOGNGH.js} +5 -5
  72. package/chunks/{chunk-PWVFN2LF.js → chunk-BP2H5K25.js} +1 -1
  73. package/chunks/{chunk-LB6DUZ26.js → chunk-BTWSGZCT.js} +264 -185
  74. package/chunks/{chunk-ZNAUOR2I.js → chunk-BZBPT52P.js} +2 -2
  75. package/chunks/{chunk-L26JL52R.js → chunk-CBBP4BMC.js} +64 -67
  76. package/chunks/{chunk-ZD6UTE4A.js → chunk-CNTR4GR6.js} +1 -1
  77. package/chunks/{chunk-3SJ43L4W.js → chunk-CPZAH673.js} +6 -0
  78. package/chunks/{chunk-EPDRMGT4.js → chunk-D4HTUMGX.js} +4 -28
  79. package/chunks/{chunk-QAF7NMK7.js → chunk-D7CQTWRS.js} +1 -1
  80. package/chunks/{chunk-XVNQMZ2I.js → chunk-DGEIYUC3.js} +0 -1
  81. package/chunks/{chunk-BPZALHVR.js → chunk-DI35ZN7T.js} +1 -1
  82. package/chunks/{chunk-IKCX4CCL.js → chunk-DKPJUF5F.js} +118 -95
  83. package/chunks/{chunk-DLWL3Z7A.js → chunk-DSFHVTWD.js} +3 -3
  84. package/chunks/{chunk-FSITMZJH.js → chunk-DYRYLJ3O.js} +18 -9
  85. package/chunks/{chunk-NL7LTRLR.js → chunk-E2BHWIDT.js} +48 -72
  86. package/chunks/{chunk-UDX5OBWR.js → chunk-E2FN6SM7.js} +94 -4
  87. package/chunks/{chunk-USTWD7QV.js → chunk-E6CJ2SMM.js} +26 -16
  88. package/chunks/{chunk-KMQ33DO4.js → chunk-EDB7A72S.js} +4 -4
  89. package/chunks/{chunk-7ZCNENPP.js → chunk-FANRZEAJ.js} +1 -1
  90. package/chunks/{chunk-WBL3FJEU.js → chunk-FC4KQFCS.js} +1 -1
  91. package/chunks/{chunk-5NBDS5S6.js → chunk-FCYYAB4S.js} +162 -7
  92. package/chunks/{chunk-OKY7HXPG.js → chunk-FJ5WUMUQ.js} +2 -2
  93. package/chunks/{chunk-PHOF65IG.js → chunk-FRXG4ARO.js} +36273 -44436
  94. package/chunks/{chunk-FQK6JAFG.js → chunk-FS674JW4.js} +4 -4
  95. package/chunks/chunk-FYJ7W2PI.js +194 -0
  96. package/chunks/{chunk-BULDBTYC.js → chunk-G7XXKQYS.js} +3 -28
  97. package/chunks/{chunk-LS77BEZP.js → chunk-GLCZKT5V.js} +1 -5
  98. package/chunks/{chunk-VRYUBFMC.js → chunk-GRUAVQQR.js} +1 -1
  99. package/chunks/{chunk-MVSUYZDT.js → chunk-GWV7DI3S.js} +4 -4
  100. package/chunks/{chunk-A5L3JMUA.js → chunk-HC45LTEN.js} +18 -4
  101. package/chunks/{chunk-PC6JANNU.js → chunk-HKRVXYDN.js} +4 -4
  102. package/chunks/{chunk-GZXCZHCT.js → chunk-I3G5JWBV.js} +1 -1
  103. package/chunks/{chunk-4WIZGAH3.js → chunk-I5BT7ADR.js} +6 -58
  104. package/chunks/{chunk-GSN55ZRI.js → chunk-ID3O7PRB.js} +19 -7
  105. package/chunks/{chunk-L5UHQJTJ.js → chunk-IGTHU3T4.js} +1 -1
  106. package/chunks/{chunk-BIQWWWJN.js → chunk-IIUGIWWY.js} +1 -1
  107. package/chunks/{chunk-RWTEFFPU.js → chunk-JCJ7LKNA.js} +6140 -5616
  108. package/chunks/{chunk-S3TWXGKA.js → chunk-JE7KQ2UP.js} +4 -2
  109. package/chunks/{chunk-PWTZEM3C.js → chunk-JXVC2PL3.js} +3 -37
  110. package/chunks/chunk-JYBU6YUE.js +378 -0
  111. package/chunks/{chunk-RF3EXIHJ.js → chunk-K3PFMM5U.js} +49 -26
  112. package/chunks/{chunk-JCW2R7WC.js → chunk-K623ENWT.js} +3 -79
  113. package/chunks/{chunk-T2NCM2ET.js → chunk-K6KS3LTN.js} +2 -749
  114. package/chunks/chunk-KWHKHSIS.js +81 -0
  115. package/chunks/{chunk-DHHOYAPR.js → chunk-L2E5GFAG.js} +7 -7
  116. package/chunks/{chunk-2W3OOD4W.js → chunk-L55JWS76.js} +6 -3
  117. package/chunks/{chunk-E5TUC6CA.js → chunk-LHKCY7DY.js} +3 -3
  118. package/chunks/{chunk-NH6KE4JX.js → chunk-LOY7RWQG.js} +3 -3
  119. package/chunks/{chunk-U7M2DMGW.js → chunk-M4MSAE7U.js} +130 -5
  120. package/chunks/{chunk-IJTOWOD7.js → chunk-MB32MS4U.js} +92 -9
  121. package/chunks/{chunk-PR75REBZ.js → chunk-MM7TH7ZM.js} +12 -82
  122. package/chunks/{chunk-FODK6UMO.js → chunk-MPHPFVKK.js} +0 -2
  123. package/chunks/{chunk-M5JM7OSF.js → chunk-N4ACHWNH.js} +2 -3
  124. package/chunks/{chunk-JESCGQM3.js → chunk-NAVJD2PQ.js} +8 -7
  125. package/chunks/{chunk-J56UI34H.js → chunk-NBD76HUW.js} +4 -2
  126. package/chunks/{chunk-2SCDWPXI.js → chunk-NC4U4I3Y.js} +5 -5
  127. package/chunks/{chunk-H4SBPHSA.js → chunk-NNL7WPPK.js} +3 -3
  128. package/chunks/{chunk-YBL3QUDD.js → chunk-NQCXWP5D.js} +1 -1
  129. package/chunks/{chunk-CIKQ7KKO.js → chunk-NVFSGPIF.js} +954 -444
  130. package/chunks/{chunk-6OUGMXDC.js → chunk-NWNEANAT.js} +7 -7
  131. package/chunks/chunk-O6GEWCJA.js +21 -0
  132. package/chunks/chunk-OCPBI7J5.js +18 -0
  133. package/chunks/{chunk-KIM5GUMA.js → chunk-OE6F6ZWQ.js} +589 -220
  134. package/chunks/{chunk-SQCQ4KO2.js → chunk-P5DEY3NF.js} +380 -317
  135. package/chunks/{chunk-2JZBVYTU.js → chunk-Q3T5KA2V.js} +1 -8
  136. package/chunks/{chunk-MB4MZHMJ.js → chunk-QARJNL2V.js} +211 -522
  137. package/chunks/{chunk-YH6G52F2.js → chunk-QCXGC7QB.js} +4 -4
  138. package/chunks/chunk-QDK4F2N5.js +1252 -0
  139. package/chunks/{chunk-VDDGDZMA.js → chunk-QHWCP53L.js} +14 -7
  140. package/chunks/{chunk-VULLI6WQ.js → chunk-QIERF2GQ.js} +6 -6
  141. package/chunks/{chunk-TGILQ3YH.js → chunk-QQTJK5GB.js} +200 -77
  142. package/chunks/{chunk-H5FFA6TH.js → chunk-QTHQ6Z5X.js} +16 -3
  143. package/chunks/{chunk-5I2IWRSH.js → chunk-R2XWGR75.js} +2 -2
  144. package/chunks/{chunk-YPE6A4GC.js → chunk-RT7FNC2O.js} +2 -2
  145. package/chunks/{chunk-OFDOK3VM.js → chunk-RX7NJOPE.js} +8 -13
  146. package/chunks/{chunk-6AM5D4ME.js → chunk-S6LOFUVP.js} +0 -12
  147. package/chunks/{chunk-K4XWPEWB.js → chunk-SHN4KHDK.js} +4 -33
  148. package/chunks/{chunk-VYPFXUCB.js → chunk-SZ3KHTDR.js} +1 -1
  149. package/chunks/chunk-T26EAKDL.js +13 -0
  150. package/chunks/chunk-T3CHYWJZ.js +758 -0
  151. package/chunks/{chunk-FNQ6T3CV.js → chunk-TEGJSJDF.js} +10 -7
  152. package/chunks/{chunk-RZIX2G32.js → chunk-THPORXSI.js} +1 -1
  153. package/chunks/{chunk-OHNBB4XR.js → chunk-THVU3RNH.js} +1 -1
  154. package/chunks/{record-artifact-RQKFYO5B.js → chunk-TIRRPCFS.js} +22 -7
  155. package/chunks/{chunk-ETSW4KLJ.js → chunk-TUCOXPHJ.js} +2 -2
  156. package/chunks/{chunk-63P4EL5V.js → chunk-TZTAV5RH.js} +1 -1
  157. package/chunks/{chunk-LK7CHLVP.js → chunk-U4VTUMMK.js} +0 -60
  158. package/chunks/{chunk-3RN6GBKS.js → chunk-U5CODIJW.js} +1 -1
  159. package/chunks/chunk-UU2B5YG6.js +2196 -0
  160. package/chunks/{chunk-R5AFZNQW.js → chunk-VAVHTGU4.js} +15 -8
  161. package/chunks/{chunk-2NH6DYI4.js → chunk-VHPFWR2O.js} +12 -12
  162. package/chunks/{chunk-IKYJHJNF.js → chunk-VOMQ2P6B.js} +3 -3
  163. package/chunks/{chunk-ZFDTEDCF.js → chunk-VX22DUW2.js} +6 -6
  164. package/chunks/{chunk-HTR4WV6U.js → chunk-W4RQUHY3.js} +31 -1
  165. package/chunks/{chunk-M4FMGVY4.js → chunk-WQP7BKWA.js} +3 -3
  166. package/chunks/{chunk-LH2BYDQ5.js → chunk-X2E5TFJ5.js} +18 -12
  167. package/chunks/{chunk-COH43MRJ.js → chunk-XCGIMOLN.js} +27 -1
  168. package/chunks/{chunk-YX324OPW.js → chunk-XDS22O52.js} +1 -1
  169. package/chunks/chunk-XP4L6KS3.js +463 -0
  170. package/chunks/{chunk-6FGBXPWM.js → chunk-XQK4XXTN.js} +38 -44
  171. package/chunks/{chunk-55DJUCI2.js → chunk-XWYPFDB5.js} +53 -43
  172. package/chunks/{chunk-Y34KJKDC.js → chunk-Y7BVNVVW.js} +1 -1
  173. package/chunks/{chunk-IPUUTYMV.js → chunk-YDLJGZHL.js} +1 -1
  174. package/chunks/{chunk-HIJQF5B5.js → chunk-YGE3IXJP.js} +1 -1
  175. package/chunks/{chunk-LQIW3YFY.js → chunk-YJFPRUWX.js} +9 -7
  176. package/chunks/{chunk-J24WCGIN.js → chunk-YQIIG4NA.js} +4 -4
  177. package/chunks/{chunk-BJX6ZSUK.js → chunk-YUFIEIWC.js} +2 -2
  178. package/chunks/{chunk-NIBLUX3Y.js → chunk-Z3S5EMOW.js} +148 -21
  179. package/chunks/{chunk-WCXCRJYB.js → chunk-Z3YLHKB7.js} +1 -1
  180. package/chunks/chunk-Z4X5MTRT.js +133 -0
  181. package/chunks/{chunk-UW5EOVUN.js → chunk-ZBVS26BY.js} +4 -4
  182. package/chunks/{chunk-HTO4JFDZ.js → chunk-ZPJWUGCS.js} +0 -1
  183. package/chunks/{chunk-X5XDDSSH.js → chunk-ZPZ7ZJEE.js} +28 -5
  184. package/chunks/{computer-use-SOQ4E3VX.js → computer-use-GOM42LNK.js} +53 -50
  185. package/chunks/{config-utils-7V7GGIW6.js → config-utils-WADIDWGG.js} +4 -3
  186. package/chunks/contextCommand-6LVPTIWD.js +83 -0
  187. package/chunks/core-runtime-253XV2DB.js +137 -0
  188. package/chunks/{create-sub-session-QRJLW5BV.js → create-sub-session-45POYEVP.js} +50 -47
  189. package/chunks/{create-sub-session-IWW2IZ2T.js → create-sub-session-62YZWVAY.js} +3 -3
  190. package/chunks/{cron-create-YIID5XAW.js → cron-create-6E7GIQTG.js} +6 -6
  191. package/chunks/{cron-delete-ZVHYCEP2.js → cron-delete-JD26XY3W.js} +5 -5
  192. package/chunks/{cron-list-XEGS463Q.js → cron-list-CUWFB44G.js} +6 -6
  193. package/chunks/{daemon-YO6433NF.js → daemon-PCNCI5YU.js} +428 -18
  194. package/chunks/daemon-status-provider-AKALDYJJ.js +93 -0
  195. package/chunks/daemon-trust-policy-XB7ZSQFQ.js +88 -0
  196. package/chunks/daemon-trust-policy-monitor-FUTKP42Q.js +175 -0
  197. package/chunks/{de-HGRCYDEJ.js → de-SY6O76BF.js} +6 -1
  198. package/chunks/deferred-core-runtime-RKLCO7V5.js +92 -0
  199. package/chunks/dist-26BIMQT6.js +4487 -0
  200. package/chunks/{dist-F6IBUDR4.js → dist-2PERFI23.js} +12 -9
  201. package/chunks/{dist-46NQKLTW.js → dist-OAOC5OV4.js} +2 -2
  202. package/chunks/{dist-YFNEUWSE.js → dist-PVEAFLHY.js} +5 -4
  203. package/chunks/{dist-AIKFMUKK.js → dist-SL2LUMML.js} +1449 -14
  204. package/chunks/dist-ULIG4M5H.js +13415 -0
  205. package/chunks/{dist-WEAHOXDM.js → dist-WGMNT3JQ.js} +2 -1
  206. package/chunks/{dist-BBLXMS3N.js → dist-ZHXOBXDN.js} +3 -3
  207. package/chunks/earlyInputCapture-FCWU47OB.js +85 -0
  208. package/chunks/{edit-OBDSQURM.js → edit-TTACM3LN.js} +51 -48
  209. package/chunks/{en-MTWBNGDO.js → en-NBK3JKCE.js} +9 -1
  210. package/chunks/{enter-worktree-U6MRPQ2P.js → enter-worktree-R34GFDX6.js} +51 -48
  211. package/chunks/{enterPlanMode-BC5QUZZ2.js → enterPlanMode-KJPBB6G5.js} +51 -48
  212. package/chunks/environment-IJG3N2PR.js +105 -0
  213. package/chunks/errors-MRON5OJD.js +91 -0
  214. package/chunks/esm-K5FARBNI.js +5548 -0
  215. package/chunks/{exit-worktree-DGNYMECB.js → exit-worktree-UBA66Y4I.js} +51 -48
  216. package/chunks/exitPlanMode-SMSPGNSK.js +76 -0
  217. package/chunks/{fast-path-JJZFJANL.js → fast-path-ZBAMZDCP.js} +16 -6
  218. package/chunks/{fr-45RLL55O.js → fr-4KG5V7UT.js} +6 -1
  219. package/chunks/{gemini-QS36EBZV.js → gemini-XFT7HRNL.js} +106 -99
  220. package/chunks/{geminiContentGenerator-AG4KB6CV.js → geminiContentGenerator-XD3MLYQX.js} +40 -11
  221. package/chunks/{getMachineId-bsd-V7W3GODC.js → getMachineId-bsd-FG7IUY6U.js} +1 -1
  222. package/chunks/{getMachineId-darwin-TDO75DQP.js → getMachineId-darwin-GLCJI2RA.js} +1 -1
  223. package/chunks/{getMachineId-linux-TF43WQT2.js → getMachineId-linux-O6OPPAKO.js} +1 -1
  224. package/chunks/{getMachineId-unsupported-ZGUO3TXT.js → getMachineId-unsupported-S6CKYVGC.js} +1 -1
  225. package/chunks/{getMachineId-win-ECFYZZFQ.js → getMachineId-win-X5SRNEH7.js} +1 -1
  226. package/chunks/{glob-V7R3PSK3.js → glob-HFKY7HXZ.js} +51 -48
  227. package/chunks/goal-tools-HGO6VXPB.js +335 -0
  228. package/chunks/{grep-QYPSK7OP.js → grep-EO5Z3PFV.js} +53 -49
  229. package/chunks/handleAutoUpdate-WRENFE6C.js +84 -0
  230. package/chunks/i18n-ZG5OTVSV.js +100 -0
  231. package/chunks/{image-gen-Z3VPGKRC.js → image-gen-CKWZ4MJI.js} +12 -12
  232. package/chunks/initializer-FYPLLRC7.js +89 -0
  233. package/chunks/installationInfo-5RV4HRMC.js +83 -0
  234. package/chunks/{ja-B7DF7DFG.js → ja-F3GSQXMF.js} +6 -1
  235. package/chunks/{keychain-token-storage-MDTG3WRM.js → keychain-token-storage-IKO4G53C.js} +3 -3
  236. package/chunks/lib-RUF3WZA6.js +9 -0
  237. package/chunks/list-ZNWVL3AT.js +92 -0
  238. package/chunks/{list-agents-5KJJHR6I.js → list-agents-PXJ7ZUFB.js} +3 -3
  239. package/chunks/loadedSettingsAdapter-GQGNHP5I.js +86 -0
  240. package/chunks/{loggingContentGenerator-HS3S5H3Q.js → loggingContentGenerator-MS5DFAWH.js} +78 -113
  241. package/chunks/{loop-wakeup-FXKNNYSY.js → loop-wakeup-Y26NQZ5I.js} +15 -8
  242. package/chunks/{ls-NTK6VOQJ.js → ls-ONQTTMQR.js} +5 -5
  243. package/chunks/{lsp-2JI24STP.js → lsp-YGHHRGMD.js} +3 -3
  244. package/chunks/{managed-npm-update-JYEMMXA3.js → managed-npm-update-67AK4GTL.js} +51 -48
  245. package/chunks/mcp-FVQ4VTLM.js +86 -0
  246. package/chunks/{monitor-R3ODH5U6.js → monitor-BXB33EOZ.js} +51 -48
  247. package/chunks/nonInteractiveCli-CN2GYSN3.js +148 -0
  248. package/chunks/{notebook-edit-BNOK452R.js → notebook-edit-FKYRBV4L.js} +51 -48
  249. package/chunks/{openaiContentGenerator-WMCU3O2H.js → openaiContentGenerator-UUXV5DGU.js} +26 -27
  250. package/chunks/pidfile-MV347TTZ.js +89 -0
  251. package/chunks/process-registry-2CHQBXH5.js +157 -0
  252. package/chunks/{processUtils-RT7UNCC2.js → processUtils-LKFG52RV.js} +2 -2
  253. package/chunks/{pt-22Q3FP73.js → pt-EQ33KWEN.js} +6 -1
  254. package/chunks/{qwenContentGenerator-HHCRK4SX.js → qwenContentGenerator-3WYI2HRW.js} +56 -53
  255. package/chunks/{qwenOAuth2-OWLB5AKH.js → qwenOAuth2-B46MW45O.js} +10 -10
  256. package/chunks/read-file-ACSHVWP3.js +29 -0
  257. package/chunks/{read-mcp-resource-4DKQWGHD.js → read-mcp-resource-U2IJN5HM.js} +4 -4
  258. package/chunks/record-artifact-MGPJ7EG4.js +21 -0
  259. package/chunks/resumeHistoryUtils-AMS4767B.js +94 -0
  260. package/chunks/ripGrep-BAPM2UKC.js +76 -0
  261. package/chunks/{ru-FZCNZHDC.js → ru-7OZAUKGG.js} +6 -1
  262. package/chunks/{run-qwen-serve-FU6HEM4J.js → run-qwen-serve-JEN6FO2A.js} +1018 -263
  263. package/chunks/runtime-WVP22ISH.js +122 -0
  264. package/chunks/{scheduler-G2ZS2Z7E.js → scheduler-HTX5ACVR.js} +50 -47
  265. package/chunks/{sdk-exporters-grpc-AK3LGHNO.js → sdk-exporters-grpc-54L4LS5L.js} +4 -4
  266. package/chunks/{sdk-exporters-http-FYBSUCPD.js → sdk-exporters-http-4BQANSJ6.js} +7 -7
  267. package/chunks/{sdk-impl-GMVPB7NB.js → sdk-impl-Z4VXWVFX.js} +14 -14
  268. package/chunks/{send-message-Q6OOR6BR.js → send-message-PMP4ATVM.js} +8 -13
  269. package/chunks/serve-ELQIVNWN.js +92 -0
  270. package/chunks/{server-4UMH7OIZ.js → server-JNW2NOSQ.js} +5288 -1364
  271. package/chunks/{session-K3O3Q2SV.js → session-NC356XNS.js} +102 -95
  272. package/chunks/{settings-CR2EWTBA.js → settings-73RMIOJ6.js} +54 -51
  273. package/chunks/shell-NMHF5TFG.js +86 -0
  274. package/chunks/{skill-I3SDA4MB.js → skill-XPGXHEKO.js} +22 -22
  275. package/chunks/skill-settings-5IGIJDGA.js +94 -0
  276. package/chunks/spawnChannel-T5THBHFN.js +85 -0
  277. package/chunks/standalone-update-ODXEPDLP.js +95 -0
  278. package/chunks/{startInteractiveUI-SLZGHRPH.js → startInteractiveUI-S27DXVAE.js} +1241 -905
  279. package/chunks/{syntheticOutput-I3757IWH.js → syntheticOutput-D7E6ZFKR.js} +4 -4
  280. package/chunks/task-create-NFCYD43L.js +26 -0
  281. package/chunks/{task-list-FOPULZEP.js → task-list-TAVMGEVD.js} +7 -7
  282. package/chunks/{task-stop-H6RHXFVQ.js → task-stop-ZDF2UJRM.js} +3 -3
  283. package/chunks/{task-update-M57TFZJT.js → task-update-6L7LHGEX.js} +12 -11
  284. package/chunks/{team-create-YJALH5D2.js → team-create-CTLQWTJ2.js} +53 -50
  285. package/chunks/{team-delete-QE2UXJL7.js → team-delete-DPGGRQBU.js} +7 -7
  286. package/chunks/{team-plan-approval-34QFYKGN.js → team-plan-approval-WKRUAPJ4.js} +51 -48
  287. package/chunks/theme-manager-XQHXQQX6.js +80 -0
  288. package/chunks/{todoWrite-VQ7FKOHL.js → todoWrite-2UO5G6G6.js} +34 -6
  289. package/chunks/{tool-search-NF7GB6LE.js → tool-search-45YINAJA.js} +21 -22
  290. package/chunks/total-session-admission-QPUKGHKO.js +88 -0
  291. package/chunks/trustedFolders-YMUTRHEQ.js +98 -0
  292. package/chunks/{update-relaunch-WBUZJC5O.js → update-relaunch-PZUXTVHC.js} +5 -5
  293. package/chunks/updateCheck-IZAN4XTB.js +95 -0
  294. package/chunks/useAutoAcceptIndicator-CGL2MAYE.js +96 -0
  295. package/chunks/{validateNonInterActiveAuth-3R223G3R.js → validateNonInterActiveAuth-GBGNJ65K.js} +97 -90
  296. package/chunks/{version-HS7YSFHV.js → version-Z7EX24NZ.js} +1 -1
  297. package/chunks/{web-fetch-NKCSG7ZE.js → web-fetch-ETTT2H3V.js} +19 -21
  298. package/chunks/{web-search-S62WAP4S.js → web-search-Y3ZSVRJ6.js} +13 -13
  299. package/chunks/{workflow-QAGU5RU4.js → workflow-ATRJSAO7.js} +52 -49
  300. package/chunks/workspace-providers-status-YM3WLW3N.js +89 -0
  301. package/chunks/{workspace-registration-store-24JMHDGF.js → workspace-registration-store-4EGNCIPG.js} +1 -1
  302. package/chunks/workspace-registry-NGZOZKQP.js +96 -0
  303. package/chunks/workspace-service-SVWOXX2B.js +103 -0
  304. package/chunks/workspace-skills-status-YZHZ3PT5.js +89 -0
  305. package/chunks/workspace-trust-reconciler-GGBQV2U5.js +349 -0
  306. package/chunks/write-file-HLGCEB72.js +78 -0
  307. package/chunks/xterm-headless-NTYVIBT3.js +3475 -0
  308. package/chunks/{zh-LUIGBD55.js → zh-H3YDK5QW.js} +9 -1
  309. package/chunks/{zh-TW-F5KG2IYD.js → zh-TW-JYCP7XUA.js} +9 -1
  310. package/chunks/zoom-image-LDECT475.js +224 -0
  311. package/cli.js +50 -16
  312. package/locales/ca.js +7 -2
  313. package/locales/de.js +7 -2
  314. package/locales/en.js +10 -2
  315. package/locales/fr.js +7 -2
  316. package/locales/ja.js +7 -2
  317. package/locales/pt.js +7 -2
  318. package/locales/ru.js +7 -2
  319. package/locales/zh-TW.js +10 -2
  320. package/locales/zh.js +10 -2
  321. package/package.json +5 -4
  322. package/web-shell/assets/{arc-DcbWnB9T.js → arc-Dpy_U6Bb.js} +1 -1
  323. package/web-shell/assets/{architectureDiagram-3BPJPVTR-kMMF5sud.js → architectureDiagram-3BPJPVTR-DgDOg-c5.js} +1 -1
  324. package/web-shell/assets/{blockDiagram-GPEHLZMM-Htl9vTJS.js → blockDiagram-GPEHLZMM-tADd9Ja3.js} +1 -1
  325. package/web-shell/assets/{c4Diagram-AAUBKEIU-BnZnm0mQ.js → c4Diagram-AAUBKEIU-68wj9MCU.js} +1 -1
  326. package/web-shell/assets/channel-Do7fFnFl.js +1 -0
  327. package/web-shell/assets/{chunk-2J33WTMH-DziB7kDG.js → chunk-2J33WTMH-DjJLOeVU.js} +1 -1
  328. package/web-shell/assets/{chunk-4BX2VUAB-CmkD8daw.js → chunk-4BX2VUAB-CMbzGeVC.js} +1 -1
  329. package/web-shell/assets/{chunk-55IACEB6-CHAd9A_U.js → chunk-55IACEB6-SlKgejv9.js} +1 -1
  330. package/web-shell/assets/{chunk-727SXJPM-Dqaam3fE.js → chunk-727SXJPM-CijXssHZ.js} +1 -1
  331. package/web-shell/assets/{chunk-AQP2D5EJ-D_-saBYM.js → chunk-AQP2D5EJ-D8w25nvR.js} +1 -1
  332. package/web-shell/assets/{chunk-FMBD7UC4-B9r_veWD.js → chunk-FMBD7UC4-Bv9dcx_e.js} +1 -1
  333. package/web-shell/assets/{chunk-ND2GUHAM-B3EaCSpL.js → chunk-ND2GUHAM-Bzf6sAOd.js} +1 -1
  334. package/web-shell/assets/{chunk-QZHKN3VN-CYq8x9mn.js → chunk-QZHKN3VN-whNoNeW5.js} +1 -1
  335. package/web-shell/assets/classDiagram-4FO5ZUOK-By_XOP3X.js +1 -0
  336. package/web-shell/assets/classDiagram-v2-Q7XG4LA2-By_XOP3X.js +1 -0
  337. package/web-shell/assets/{cose-bilkent-S5V4N54A-D0ng4uiB.js → cose-bilkent-S5V4N54A-rpQS44Lz.js} +1 -1
  338. package/web-shell/assets/{dagre-BM42HDAG-DCZollQv.js → dagre-BM42HDAG-Ck7VE6nT.js} +1 -1
  339. package/web-shell/assets/{diagram-2AECGRRQ-Dfk2pWS0.js → diagram-2AECGRRQ-CgRrsodR.js} +1 -1
  340. package/web-shell/assets/{diagram-5GNKFQAL-kX38ltWR.js → diagram-5GNKFQAL-CsTZtE5A.js} +1 -1
  341. package/web-shell/assets/{diagram-KO2AKTUF-CJz2vsXh.js → diagram-KO2AKTUF-D5EAdVq4.js} +1 -1
  342. package/web-shell/assets/{diagram-LMA3HP47-BvMLZm_7.js → diagram-LMA3HP47-DNrjHC7Z.js} +1 -1
  343. package/web-shell/assets/{diagram-OG6HWLK6-l7kfStkO.js → diagram-OG6HWLK6-ClJSJGgC.js} +1 -1
  344. package/web-shell/assets/{erDiagram-TEJ5UH35-BSVa8GGT.js → erDiagram-TEJ5UH35-DuVnos_y.js} +1 -1
  345. package/web-shell/assets/{flowDiagram-I6XJVG4X-CoawKIXH.js → flowDiagram-I6XJVG4X-DEpIVl1s.js} +1 -1
  346. package/web-shell/assets/{ganttDiagram-6RSMTGT7-DFUDH0zF.js → ganttDiagram-6RSMTGT7-COnQM2-C.js} +1 -1
  347. package/web-shell/assets/{gitGraphDiagram-PVQCEYII-Y2pvpT4e.js → gitGraphDiagram-PVQCEYII-C-lX5H3_.js} +1 -1
  348. package/web-shell/assets/index-C2GE3DAF.js +74 -0
  349. package/web-shell/assets/{index-D0GX0zZf.js → index-DfcyS2E7.js} +1 -1
  350. package/web-shell/assets/index-Qxt6kN7i.js +1700 -0
  351. package/web-shell/assets/index-bo0Z8hfu.css +5 -0
  352. package/web-shell/assets/{infoDiagram-5YYISTIA-CU8_zLiX.js → infoDiagram-5YYISTIA-D0WP-wmU.js} +1 -1
  353. package/web-shell/assets/{ishikawaDiagram-YF4QCWOH-AVQiV0DU.js → ishikawaDiagram-YF4QCWOH-DgsI3Clu.js} +1 -1
  354. package/web-shell/assets/{journeyDiagram-JHISSGLW-DQ0VSKa3.js → journeyDiagram-JHISSGLW-4yCoMZO6.js} +1 -1
  355. package/web-shell/assets/{kanban-definition-UN3LZRKU-BqnWqsE_.js → kanban-definition-UN3LZRKU-D_05au1N.js} +1 -1
  356. package/web-shell/assets/{linear-BkoihsaA.js → linear-B38fDz0Q.js} +1 -1
  357. package/web-shell/assets/{mermaid.core-5RJs-31j.js → mermaid.core-aGNwTaHi.js} +5 -5
  358. package/web-shell/assets/{mindmap-definition-RKZ34NQL-D33Bxnpd.js → mindmap-definition-RKZ34NQL-C2yf_5WM.js} +1 -1
  359. package/web-shell/assets/{pieDiagram-4H26LBE5-BuEAw3BH.js → pieDiagram-4H26LBE5-DiHABBT-.js} +1 -1
  360. package/web-shell/assets/{quadrantDiagram-W4KKPZXB-Kox_usEq.js → quadrantDiagram-W4KKPZXB-W9xkeAGe.js} +1 -1
  361. package/web-shell/assets/{requirementDiagram-4Y6WPE33-CNjeUif0.js → requirementDiagram-4Y6WPE33-BGmRXl9k.js} +1 -1
  362. package/web-shell/assets/{sankeyDiagram-5OEKKPKP-BCd2OL_U.js → sankeyDiagram-5OEKKPKP-CvOmT43_.js} +1 -1
  363. package/web-shell/assets/{sequenceDiagram-3UESZ5HK-CF2ZTsz0.js → sequenceDiagram-3UESZ5HK-C8pdd0Z-.js} +1 -1
  364. package/web-shell/assets/{stateDiagram-AJRCARHV-qenSzHtm.js → stateDiagram-AJRCARHV-C-CYdFx2.js} +1 -1
  365. package/web-shell/assets/stateDiagram-v2-BHNVJYJU-BieEHeN9.js +1 -0
  366. package/web-shell/assets/{timeline-definition-PNZ67QCA-B5DyWdgs.js → timeline-definition-PNZ67QCA-w2KQn1cI.js} +1 -1
  367. package/web-shell/assets/{vennDiagram-CIIHVFJN-DqP4I_o_.js → vennDiagram-CIIHVFJN-DuorhRku.js} +1 -1
  368. package/web-shell/assets/{wardley-L42UT6IY-CJe2e4mg.js → wardley-L42UT6IY-BAXm2cWy.js} +1 -1
  369. package/web-shell/assets/{wardleyDiagram-YWT4CUSO-BMDSw-Rr.js → wardleyDiagram-YWT4CUSO-8PHaOXn5.js} +1 -1
  370. package/web-shell/assets/{xychartDiagram-2RQKCTM6-BTVZYkxD.js → xychartDiagram-2RQKCTM6-Do84JFSc.js} +1 -1
  371. package/web-shell/index.html +2 -2
  372. package/chunks/MaxSizedBox-5DPPWPGT.js +0 -85
  373. package/chunks/agent-6ODUANDO.js +0 -81
  374. package/chunks/agent-headless-7BYQTMHW.js +0 -75
  375. package/chunks/bridge-ZUB64FAE.js +0 -90
  376. package/chunks/chunk-LEH5C7FV.js +0 -232
  377. package/chunks/chunk-SZRN75WQ.js +0 -29
  378. package/chunks/chunk-UGYMA4EI.js +0 -219
  379. package/chunks/chunk-Z2BC6UJ5.js +0 -8575
  380. package/chunks/contextCommand-JLHYA34Z.js +0 -80
  381. package/chunks/daemon-status-provider-2233Q37D.js +0 -89
  382. package/chunks/earlyInputCapture-A7NDU3PF.js +0 -82
  383. package/chunks/environment-W5UFC2CH.js +0 -102
  384. package/chunks/errors-M7CLORXH.js +0 -88
  385. package/chunks/exitPlanMode-GXTBWQAR.js +0 -403
  386. package/chunks/handleAutoUpdate-6DBEZYPV.js +0 -81
  387. package/chunks/i18n-VUJJZIMU.js +0 -97
  388. package/chunks/initializer-UWAK5U5O.js +0 -86
  389. package/chunks/installationInfo-6O2YAA52.js +0 -80
  390. package/chunks/list-GB4ESM3T.js +0 -89
  391. package/chunks/loadedSettingsAdapter-OT6JVQ7U.js +0 -83
  392. package/chunks/mcp-6DBDJPFU.js +0 -83
  393. package/chunks/nonInteractiveCli-MOYCYBBU.js +0 -141
  394. package/chunks/pidfile-TFRZZZIO.js +0 -86
  395. package/chunks/read-file-APMO3PSX.js +0 -31
  396. package/chunks/resumeHistoryUtils-6KRYEAWZ.js +0 -91
  397. package/chunks/ripGrep-BEJDEDXW.js +0 -73
  398. package/chunks/runtime-XXRRTNP6.js +0 -118
  399. package/chunks/serve-7BSTXJ4T.js +0 -89
  400. package/chunks/shell-HH3PF3A2.js +0 -83
  401. package/chunks/spawnChannel-RWNDBXGA.js +0 -82
  402. package/chunks/src-GE4TTTML.js +0 -3147
  403. package/chunks/standalone-update-Q6WFRZZQ.js +0 -92
  404. package/chunks/task-create-N7WQSGYA.js +0 -25
  405. package/chunks/theme-manager-SWRILQHI.js +0 -77
  406. package/chunks/total-session-admission-DLHHHLD3.js +0 -84
  407. package/chunks/trustedFolders-KHXHY6PY.js +0 -93
  408. package/chunks/updateCheck-RKL6M5XN.js +0 -92
  409. package/chunks/useAutoAcceptIndicator-CFQ5BUJL.js +0 -93
  410. package/chunks/workspace-providers-status-QSVZUETE.js +0 -86
  411. package/chunks/workspace-registry-UT4RBNBM.js +0 -88
  412. package/chunks/workspace-service-JFWRUS4V.js +0 -98
  413. package/chunks/workspace-skills-status-ZBBKJOI2.js +0 -85
  414. package/chunks/write-file-VHIXW5M7.js +0 -73
  415. package/web-shell/assets/channel-Cq7YKtfC.js +0 -1
  416. package/web-shell/assets/classDiagram-4FO5ZUOK-CQ9aC1Tg.js +0 -1
  417. package/web-shell/assets/classDiagram-v2-Q7XG4LA2-CQ9aC1Tg.js +0 -1
  418. package/web-shell/assets/index-D9haPt0X.css +0 -5
  419. package/web-shell/assets/index-ckX9Pq5k.js +0 -1230
  420. package/web-shell/assets/stateDiagram-v2-BHNVJYJU-B7W4zlCr.js +0 -1
  421. package/chunks/{chunk-TARRHLLG.js → chunk-QUGAUQGJ.js} +25 -25
  422. package/chunks/{chunk-U7ZFW55U.js → chunk-VOQXFAY5.js} +977 -977
  423. /package/chunks/{chunk-LXXMOYPL.js → chunk-VXZBKKQR.js} +0 -0
@@ -1,8 +1,5 @@
1
1
  // Force strict mode and setup for ESM
2
2
  "use strict";
3
- import {
4
- useAutoAcceptIndicator
5
- } from "./chunk-2X55UKQE.js";
6
3
  import {
7
4
  classifyApiError
8
5
  } from "./chunk-V7RNNPGC.js";
@@ -12,7 +9,7 @@ import {
12
9
  import {
13
10
  TUI_CHAT_RECORDING_FAILURE_MESSAGE,
14
11
  reportChatRecordingFailureToAdapter
15
- } from "./chunk-YPE6A4GC.js";
12
+ } from "./chunk-RT7FNC2O.js";
16
13
  import {
17
14
  MAX_SUGGESTIONS_TO_SHOW,
18
15
  SESSION_MENTION_PREFIX,
@@ -24,10 +21,10 @@ import {
24
21
  matchMcpServerPrefix,
25
22
  resolveAtCommandQuery,
26
23
  sanitizeDisplayText
27
- } from "./chunk-VULLI6WQ.js";
24
+ } from "./chunk-QIERF2GQ.js";
28
25
  import {
29
26
  StreamJsonOutputAdapter
30
- } from "./chunk-BKHWX6I2.js";
27
+ } from "./chunk-A5BZ722X.js";
31
28
  import {
32
29
  BuiltinCommandLoader,
33
30
  BundledSkillLoader,
@@ -42,6 +39,7 @@ import {
42
39
  appendUserPromptExpansionAdditionalContext,
43
40
  copyToClipboard,
44
41
  createEmptyHookEventInfo,
42
+ dayKey,
45
43
  findMidInputSlashCommand,
46
44
  findSlashCommandTokens,
47
45
  formatApprovalModeDescription,
@@ -56,25 +54,28 @@ import {
56
54
  isBtwCommand,
57
55
  isMidInputCompletableCommand,
58
56
  isSlashCommand,
57
+ isStackedSkillCompletableCommand,
58
+ isValidStackedSkillPrefix,
59
59
  normalizePartList,
60
+ parseDayKey,
60
61
  parseSlashCommand,
61
62
  parseStackedSlashCommands,
62
63
  refreshExtensionContentRuntime,
63
64
  resetBackgroundStateForSessionSwitch,
64
65
  serializeUserPromptExpansionPrompt,
65
66
  supportsMatchers
66
- } from "./chunk-LB6DUZ26.js";
67
- import "./chunk-R5AFZNQW.js";
67
+ } from "./chunk-BTWSGZCT.js";
68
+ import "./chunk-VAVHTGU4.js";
68
69
  import {
69
70
  startPostRenderPrefetches
70
- } from "./chunk-2NH6DYI4.js";
71
+ } from "./chunk-VHPFWR2O.js";
71
72
  import {
72
73
  EXTENSION_RELOAD_FAILED_REASON,
73
74
  ExtensionRefreshState,
74
75
  appEvents,
75
76
  cleanupReviewWorktreeLeases,
76
77
  loadHierarchicalGeminiMemory
77
- } from "./chunk-TPRQ7RZH.js";
78
+ } from "./chunk-76E5Y3UZ.js";
78
79
  import {
79
80
  AboutBox,
80
81
  BaseSelectionList,
@@ -106,6 +107,7 @@ import {
106
107
  UIStateContext,
107
108
  USER_AGREEMENT_RATE_HIGH,
108
109
  USER_AGREEMENT_RATE_MEDIUM,
110
+ VirtualViewportContext,
109
111
  checkExhaustive,
110
112
  colorizeCode,
111
113
  countMarkdownSourceBlocks,
@@ -146,41 +148,23 @@ import {
146
148
  useTerminalSize,
147
149
  useTextBuffer,
148
150
  useUIActions,
149
- useUIState
150
- } from "./chunk-SQCQ4KO2.js";
151
- import {
152
- KeypressProvider,
153
- useFocus,
154
- useKeypress,
155
- useKeypressContext
156
- } from "./chunk-LQIW3YFY.js";
151
+ useUIState,
152
+ useVirtualViewport
153
+ } from "./chunk-P5DEY3NF.js";
157
154
  import {
158
155
  getCommandDisplayName,
159
156
  getCommandSourceBadge
160
- } from "./chunk-RZIX2G32.js";
157
+ } from "./chunk-THPORXSI.js";
161
158
  import {
162
159
  computeSessionStats,
163
160
  levelLabel
164
- } from "./chunk-U7M2DMGW.js";
165
- import {
166
- BEL,
167
- OSC_PREFIX,
168
- cleanupOldClipboardImages,
169
- clipboardHasImage,
170
- detectTerminal,
171
- generateKittyId,
172
- oscGhosttyNotify,
173
- oscITerm2Notify,
174
- oscKittyNotify,
175
- saveClipboardImage,
176
- writeOsc52
177
- } from "./chunk-J56UI34H.js";
161
+ } from "./chunk-M4MSAE7U.js";
178
162
  import "./chunk-4WGODMVR.js";
179
163
  import {
180
164
  MaxSizedBox,
181
165
  OverflowProvider,
182
166
  useOverflowState
183
- } from "./chunk-FQK6JAFG.js";
167
+ } from "./chunk-FS674JW4.js";
184
168
  import {
185
169
  GeminiRespondingSpinner,
186
170
  GeminiSpinner,
@@ -194,10 +178,41 @@ import {
194
178
  expandCollapsedHistory,
195
179
  isCollapsibleTool,
196
180
  useStreamingContext
197
- } from "./chunk-JXJFVC6E.js";
181
+ } from "./chunk-5G6XUGXO.js";
198
182
  import {
199
183
  theme
200
- } from "./chunk-VAK25FTU.js";
184
+ } from "./chunk-45IOTAUS.js";
185
+ import {
186
+ stopAndGetCapturedInput
187
+ } from "./chunk-TZTAV5RH.js";
188
+ import {
189
+ disableKittyProtocol,
190
+ isKittyProtocolEnabled,
191
+ isKittyProtocolSupported,
192
+ pushKittyProtocolFlags
193
+ } from "./chunk-PQNHRFJC.js";
194
+ import {
195
+ useAutoAcceptIndicator
196
+ } from "./chunk-2JZR3B4A.js";
197
+ import {
198
+ KeypressProvider,
199
+ useFocus,
200
+ useKeypress,
201
+ useKeypressContext
202
+ } from "./chunk-YJFPRUWX.js";
203
+ import {
204
+ BEL,
205
+ OSC_PREFIX,
206
+ cleanupOldClipboardImages,
207
+ clipboardHasImage,
208
+ detectTerminal,
209
+ generateKittyId,
210
+ oscGhosttyNotify,
211
+ oscITerm2Notify,
212
+ oscKittyNotify,
213
+ saveClipboardImage,
214
+ writeOsc52
215
+ } from "./chunk-NBD76HUW.js";
201
216
  import {
202
217
  require_jsx_runtime
203
218
  } from "./chunk-SV5PQVQE.js";
@@ -214,51 +229,40 @@ import {
214
229
  use_is_screen_reader_enabled_default,
215
230
  use_stdin_default,
216
231
  use_stdout_default
217
- } from "./chunk-6GMVPFB2.js";
218
- import {
219
- stopAndGetCapturedInput
220
- } from "./chunk-63P4EL5V.js";
221
- import {
222
- disableKittyProtocol,
223
- isKittyProtocolEnabled,
224
- isKittyProtocolSupported,
225
- pushKittyProtocolFlags
226
- } from "./chunk-PQNHRFJC.js";
232
+ } from "./chunk-2IIJTXYF.js";
227
233
  import {
228
234
  relaunchApp
229
- } from "./chunk-Y34KJKDC.js";
235
+ } from "./chunk-Y7BVNVVW.js";
230
236
  import {
231
237
  setUpdateHandler
232
- } from "./chunk-ZFDTEDCF.js";
233
- import "./chunk-M4FMGVY4.js";
234
- import "./chunk-K36B6G2O.js";
238
+ } from "./chunk-VX22DUW2.js";
239
+ import "./chunk-B6FOGNGH.js";
235
240
  import {
236
241
  AUTO_THEME_NAME,
237
242
  DEFAULT_THEME,
238
243
  themeManager
239
- } from "./chunk-L5UHQJTJ.js";
244
+ } from "./chunk-IGTHU3T4.js";
240
245
  import "./chunk-KW7NOTN6.js";
241
246
  import {
242
247
  require_react
243
248
  } from "./chunk-5QWWOFGG.js";
244
- import "./chunk-GSN55ZRI.js";
245
- import "./chunk-6H67XLET.js";
246
- import "./chunk-7MVVZO4N.js";
249
+ import "./chunk-6ZRWX46I.js";
247
250
  import {
248
251
  getErrorMessage as getErrorMessage2
249
- } from "./chunk-IKYJHJNF.js";
250
- import "./chunk-2SCDWPXI.js";
252
+ } from "./chunk-VOMQ2P6B.js";
253
+ import "./chunk-NC4U4I3Y.js";
254
+ import "./chunk-WQP7BKWA.js";
251
255
  import "./chunk-YAF2MQZ6.js";
252
256
  import {
253
257
  openQwenAsrRealtimeStream,
254
258
  openVoiceStream,
255
259
  openVoiceStreamWithRetry
256
- } from "./chunk-BJX6ZSUK.js";
260
+ } from "./chunk-YUFIEIWC.js";
257
261
  import {
258
262
  recordGoalStatusItem,
259
263
  restoreGoalFromHistory
260
- } from "./chunk-EBJQ6AXW.js";
261
- import "./chunk-RHLZR4E5.js";
264
+ } from "./chunk-ANDVK2JN.js";
265
+ import "./chunk-675H6PLP.js";
262
266
  import {
263
267
  cpLen,
264
268
  cpSlice,
@@ -270,8 +274,8 @@ import {
270
274
  sanitizeTerminalText,
271
275
  stripUnsafeCharacters,
272
276
  toCodePoints
273
- } from "./chunk-IPUUTYMV.js";
274
- import "./chunk-WCXCRJYB.js";
277
+ } from "./chunk-YDLJGZHL.js";
278
+ import "./chunk-Z3YLHKB7.js";
275
279
  import {
276
280
  stringWidth
277
281
  } from "./chunk-2MIN6GRR.js";
@@ -280,31 +284,27 @@ import {
280
284
  isHistoryItemVisibleAfterRestore
281
285
  } from "./chunk-QTERJVPZ.js";
282
286
  import "./chunk-3Z43GZUQ.js";
287
+ import "./chunk-RXFQM6FQ.js";
288
+ import "./chunk-ID3O7PRB.js";
289
+ import "./chunk-6H67XLET.js";
283
290
  import {
284
291
  assertVoiceBaseUrlNetworkAllowed,
285
292
  isKeytermEcho,
286
293
  isStreamingVoiceModel,
287
294
  resolveVoiceStreamConfig,
288
295
  transcribeVoiceAudio
289
- } from "./chunk-H4SBPHSA.js";
296
+ } from "./chunk-NNL7WPPK.js";
290
297
  import {
291
298
  formatUnsupportedVoiceModelMessage,
292
299
  isSelectableVoiceModel
293
- } from "./chunk-YBL3QUDD.js";
294
- import "./chunk-ZD6UTE4A.js";
295
- import "./chunk-RXFQM6FQ.js";
296
- import "./chunk-PSOO6YXD.js";
297
- import {
298
- requestConsentInteractive,
299
- requestConsentOrFail
300
- } from "./chunk-PC6JANNU.js";
301
- import "./chunk-57OAHC2Y.js";
300
+ } from "./chunk-NQCXWP5D.js";
301
+ import "./chunk-CNTR4GR6.js";
302
302
  import {
303
303
  createLoadedSettingsAdapter
304
- } from "./chunk-IO3IX5Q4.js";
304
+ } from "./chunk-4YJQD2IO.js";
305
305
  import {
306
306
  getExtendedSystemInfo
307
- } from "./chunk-MVSUYZDT.js";
307
+ } from "./chunk-GWV7DI3S.js";
308
308
  import {
309
309
  formatDuration,
310
310
  formatMemoryUsage,
@@ -312,27 +312,39 @@ import {
312
312
  formatTokenCount
313
313
  } from "./chunk-E5Z2AVNV.js";
314
314
  import "./chunk-GLWP3FDB.js";
315
- import "./chunk-COH43MRJ.js";
315
+ import "./chunk-XCGIMOLN.js";
316
316
  import {
317
317
  isInlineModelOverrideAllowed
318
- } from "./chunk-KMQ33DO4.js";
319
- import "./chunk-X5XDDSSH.js";
320
- import "./chunk-4WIZGAH3.js";
321
- import "./chunk-7ZCNENPP.js";
322
- import "./chunk-V6WHFGST.js";
318
+ } from "./chunk-EDB7A72S.js";
323
319
  import {
324
- loadMcpApprovals
325
- } from "./chunk-JVPM2ULZ.js";
326
- import "./chunk-DP3IHZGG.js";
327
- import "./chunk-ZNAUOR2I.js";
320
+ computeWorkspaceSkillListUpdates,
321
+ resolveSkillSettings,
322
+ skillSettingStrings
323
+ } from "./chunk-Z4X5MTRT.js";
324
+ import "./chunk-6NUWQ3R7.js";
325
+ import {
326
+ requestConsentInteractive,
327
+ requestConsentOrFail
328
+ } from "./chunk-HKRVXYDN.js";
329
+ import "./chunk-57OAHC2Y.js";
330
+ import "./chunk-I5BT7ADR.js";
331
+ import "./chunk-FANRZEAJ.js";
332
+ import "./chunk-KWHKHSIS.js";
333
+ import "./chunk-V6WHFGST.js";
328
334
  import "./chunk-2RFKHEXL.js";
329
- import "./chunk-LK7CHLVP.js";
330
- import "./chunk-JLU636DO.js";
335
+ import "./chunk-FYJ7W2PI.js";
336
+ import "./chunk-U4VTUMMK.js";
337
+ import "./chunk-6MPDY6ZG.js";
338
+ import "./chunk-ALMR3E6Q.js";
331
339
  import "./chunk-BK2UNYWD.js";
332
340
  import "./chunk-M5GB774H.js";
333
- import "./chunk-RWTEFFPU.js";
341
+ import "./chunk-IIUGIWWY.js";
342
+ import "./chunk-ZPZ7ZJEE.js";
343
+ import "./chunk-JCJ7LKNA.js";
334
344
  import "./chunk-UDXSXLER.js";
335
- import "./chunk-BIQWWWJN.js";
345
+ import {
346
+ loadMcpApprovals
347
+ } from "./chunk-3XZ5SSNR.js";
336
348
  import {
337
349
  CORRUPTED_SUFFIX,
338
350
  SettingScope,
@@ -355,7 +367,7 @@ import {
355
367
  settingExistsInScope,
356
368
  validateSettingValue,
357
369
  writeOutputLanguageAndRegisterPath
358
- } from "./chunk-TEHGS6UP.js";
370
+ } from "./chunk-A5T5W7PR.js";
359
371
  import "./chunk-RKUWKYED.js";
360
372
  import "./chunk-GOXKNSDZ.js";
361
373
  import "./chunk-IDS7MSUP.js";
@@ -364,27 +376,30 @@ import {
364
376
  localizeToolDisplayName,
365
377
  t,
366
378
  ta
367
- } from "./chunk-LKEJ26GS.js";
368
- import "./chunk-LH2BYDQ5.js";
379
+ } from "./chunk-B3TA3IF5.js";
380
+ import "./chunk-X2E5TFJ5.js";
369
381
  import "./chunk-6PEXNQTX.js";
370
- import "./chunk-URK542T4.js";
371
- import {
372
- getCliVersion
373
- } from "./chunk-YX324OPW.js";
374
- import "./chunk-VJNBRRZG.js";
382
+ import "./chunk-DP3IHZGG.js";
383
+ import "./chunk-BZBPT52P.js";
375
384
  import {
376
385
  isWorkspaceTrusted,
377
386
  loadTrustedFolders
378
- } from "./chunk-Z2BC6UJ5.js";
387
+ } from "./chunk-UU2B5YG6.js";
379
388
  import {
380
389
  require_strip_json_comments
381
390
  } from "./chunk-ALGGS7UH.js";
382
391
  import "./chunk-MR3PXB6E.js";
392
+ import "./chunk-XFSFZCM5.js";
393
+ import "./chunk-URK542T4.js";
394
+ import {
395
+ getCliVersion
396
+ } from "./chunk-XDS22O52.js";
397
+ import "./chunk-VJNBRRZG.js";
383
398
  import {
384
399
  clearScreen,
385
- writeStderrLine
400
+ writeStderrLine,
401
+ writeStderrLineSafe
386
402
  } from "./chunk-OWAK7LMW.js";
387
- import "./chunk-XFSFZCM5.js";
388
403
  import {
389
404
  ALIBABA_PROVIDERS,
390
405
  AsyncFzf,
@@ -472,7 +487,6 @@ import {
472
487
  parseInstallSource,
473
488
  parseRule,
474
489
  parseVisionModelSetting,
475
- promptIdContext,
476
490
  readWorktreeSession,
477
491
  readWorktreeSessionMarker,
478
492
  redactUrlCredentials,
@@ -491,67 +505,74 @@ import {
491
505
  validateWorkflowName,
492
506
  watchRepoBranch,
493
507
  writeRuntimeStatus
494
- } from "./chunk-PHOF65IG.js";
508
+ } from "./chunk-FRXG4ARO.js";
495
509
  import "./chunk-5M6IDOMF.js";
496
510
  import "./chunk-TWPJO254.js";
497
511
  import "./chunk-H6XPXXMH.js";
498
- import "./chunk-K4XWPEWB.js";
499
- import "./chunk-TOFQCPDC.js";
500
- import "./chunk-IRH27ZC2.js";
501
- import "./chunk-VDDGDZMA.js";
502
- import "./chunk-FNQ6T3CV.js";
503
- import "./chunk-ZOIFNCKL.js";
504
- import "./chunk-PWTZEM3C.js";
512
+ import "./chunk-AOHY3QJ3.js";
513
+ import "./chunk-5NNHICSA.js";
514
+ import "./chunk-SHN4KHDK.js";
515
+ import "./chunk-JXVC2PL3.js";
505
516
  import "./chunk-KRXPRVGL.js";
506
517
  import "./chunk-6PVPNMXU.js";
507
518
  import {
508
519
  resolveModelId
509
- } from "./chunk-MZAXJAUM.js";
510
- import "./chunk-SZRN75WQ.js";
511
- import "./chunk-HTO4JFDZ.js";
520
+ } from "./chunk-26JK4RPD.js";
521
+ import "./chunk-IRH27ZC2.js";
522
+ import "./chunk-QHWCP53L.js";
523
+ import "./chunk-TEGJSJDF.js";
524
+ import "./chunk-TIRRPCFS.js";
525
+ import {
526
+ promptIdContext
527
+ } from "./chunk-O6GEWCJA.js";
528
+ import "./chunk-T26EAKDL.js";
512
529
  import "./chunk-CPBF7KYF.js";
530
+ import "./chunk-4KP2F2TE.js";
531
+ import {
532
+ HOOKS_CONFIG_FIELDS
533
+ } from "./chunk-3APUUXRF.js";
534
+ import "./chunk-THVU3RNH.js";
535
+ import "./chunk-LHKCY7DY.js";
536
+ import "./chunk-6FMJLI5M.js";
513
537
  import {
514
538
  APPROVAL_MODES,
515
539
  getStartupContextLength,
516
540
  isSystemReminderContent,
517
541
  runOutsideAgentContext
518
- } from "./chunk-L26JL52R.js";
519
- import "./chunk-6AM5D4ME.js";
520
- import "./chunk-JZA3JUDJ.js";
521
- import {
522
- HOOKS_CONFIG_FIELDS
523
- } from "./chunk-3QMGYBFN.js";
524
- import "./chunk-JCW2R7WC.js";
542
+ } from "./chunk-CBBP4BMC.js";
543
+ import "./chunk-S6LOFUVP.js";
544
+ import "./chunk-K623ENWT.js";
545
+ import "./chunk-AQ37AY7B.js";
525
546
  import {
526
547
  isPathWithinRoot
527
- } from "./chunk-M5JM7OSF.js";
528
- import "./chunk-OHNBB4XR.js";
529
- import "./chunk-E5TUC6CA.js";
548
+ } from "./chunk-N4ACHWNH.js";
549
+ import "./chunk-ZPJWUGCS.js";
530
550
  import {
531
551
  osc8Hyperlink,
532
552
  qwenOAuth2Events,
533
553
  sanitizeForOsc,
534
554
  supportsHyperlinks,
535
555
  wrapForMultiplexer
536
- } from "./chunk-EPDRMGT4.js";
537
- import "./chunk-JESCGQM3.js";
538
- import "./chunk-NH6KE4JX.js";
539
- import "./chunk-USTWD7QV.js";
556
+ } from "./chunk-D4HTUMGX.js";
557
+ import "./chunk-NAVJD2PQ.js";
558
+ import "./chunk-LOY7RWQG.js";
559
+ import "./chunk-E6CJ2SMM.js";
540
560
  import {
541
561
  REASONING_EFFORT_TIERS
542
- } from "./chunk-XVNQMZ2I.js";
562
+ } from "./chunk-DGEIYUC3.js";
543
563
  import {
544
564
  getUnsupportedImageFormatWarning,
545
565
  isSupportedImageMimeType
546
- } from "./chunk-FODK6UMO.js";
566
+ } from "./chunk-MPHPFVKK.js";
547
567
  import "./chunk-GLNBDYUX.js";
548
568
  import "./chunk-DJ2GSRLV.js";
549
- import "./chunk-ZJHVAS7M.js";
550
- import "./chunk-NIBLUX3Y.js";
551
- import "./chunk-BPJSQIJX.js";
569
+ import "./chunk-2YCYFWYZ.js";
570
+ import "./chunk-Z3S5EMOW.js";
571
+ import "./chunk-2J3OJGTL.js";
552
572
  import "./chunk-P3QQPMQA.js";
553
- import "./chunk-6FGBXPWM.js";
554
- import "./chunk-LS77BEZP.js";
573
+ import "./chunk-XQK4XXTN.js";
574
+ import "./chunk-GLCZKT5V.js";
575
+ import "./chunk-QDK4F2N5.js";
555
576
  import {
556
577
  ApiCancelEvent,
557
578
  AuthEvent,
@@ -592,7 +613,7 @@ import {
592
613
  runVisionBridge,
593
614
  shouldRunVisionBridge,
594
615
  splitImageParts
595
- } from "./chunk-CIKQ7KKO.js";
616
+ } from "./chunk-NVFSGPIF.js";
596
617
  import "./chunk-VGC4I5JJ.js";
597
618
  import {
598
619
  AUTO_MEMORY_INDEX_FILENAME,
@@ -600,30 +621,27 @@ import {
600
621
  getAutoMemoryRoot,
601
622
  getUserAutoMemoryRoot,
602
623
  isAnyAutoMemPath
603
- } from "./chunk-MUP3T3AD.js";
624
+ } from "./chunk-3I6DUGQD.js";
625
+ import "./chunk-7ULQIS27.js";
626
+ import {
627
+ ToolNames,
628
+ isShellProgressData
629
+ } from "./chunk-MM7TH7ZM.js";
604
630
  import {
605
631
  MAINLINE_CODER_MODEL
606
- } from "./chunk-IKCX4CCL.js";
632
+ } from "./chunk-DKPJUF5F.js";
607
633
  import "./chunk-46UV252V.js";
608
- import "./chunk-A4UCTEB5.js";
609
- import "./chunk-XWRJCPHC.js";
610
634
  import {
611
635
  DEFAULT_TOKEN_LIMIT
612
- } from "./chunk-UW5EOVUN.js";
613
- import "./chunk-2JZBVYTU.js";
614
- import "./chunk-5I2IWRSH.js";
636
+ } from "./chunk-ZBVS26BY.js";
637
+ import "./chunk-Q3T5KA2V.js";
638
+ import "./chunk-R2XWGR75.js";
615
639
  import {
616
640
  atomicWriteFileSync
617
- } from "./chunk-A5L3JMUA.js";
618
- import "./chunk-MB4MZHMJ.js";
619
- import "./chunk-HTR4WV6U.js";
620
- import "./chunk-BULDBTYC.js";
621
- import "./chunk-U7ZFW55U.js";
622
- import "./chunk-UUUTRMI2.js";
623
- import {
624
- ToolNames,
625
- isShellProgressData
626
- } from "./chunk-PR75REBZ.js";
641
+ } from "./chunk-HC45LTEN.js";
642
+ import "./chunk-QARJNL2V.js";
643
+ import "./chunk-W4RQUHY3.js";
644
+ import "./chunk-G7XXKQYS.js";
627
645
  import {
628
646
  Storage,
629
647
  UnauthorizedError,
@@ -635,12 +653,13 @@ import {
635
653
  isNodeError,
636
654
  shortenPath,
637
655
  tildeifyPath
638
- } from "./chunk-NL7LTRLR.js";
639
- import "./chunk-QAF7NMK7.js";
656
+ } from "./chunk-E2BHWIDT.js";
657
+ import "./chunk-VOQXFAY5.js";
658
+ import "./chunk-D7CQTWRS.js";
640
659
  import {
641
660
  registerCleanup,
642
661
  runExitCleanup
643
- } from "./chunk-PWVFN2LF.js";
662
+ } from "./chunk-BP2H5K25.js";
644
663
  import {
645
664
  finalizeStartupProfile,
646
665
  profileCheckpoint
@@ -655,7 +674,7 @@ import {
655
674
  import "./chunk-TYAMGABM.js";
656
675
  import "./chunk-FCMNKVXT.js";
657
676
  import "./chunk-AMDSOFFV.js";
658
- import "./chunk-TARRHLLG.js";
677
+ import "./chunk-QUGAUQGJ.js";
659
678
  import {
660
679
  init_esbuild_shims
661
680
  } from "./chunk-5O2XNYP6.js";
@@ -667,7 +686,7 @@ import {
667
686
  // packages/cli/src/ui/startInteractiveUI.tsx
668
687
  init_esbuild_shims();
669
688
  import { basename as basename4 } from "node:path";
670
- var import_react167 = __toESM(require_react(), 1);
689
+ var import_react166 = __toESM(require_react(), 1);
671
690
 
672
691
  // packages/cli/src/dualOutput/DualOutputBridge.ts
673
692
  init_esbuild_shims();
@@ -1283,7 +1302,7 @@ var useRemoteInput = /* @__PURE__ */ __name(() => (0, import_react2.useContext)(
1283
1302
 
1284
1303
  // packages/cli/src/ui/AppContainer.tsx
1285
1304
  init_esbuild_shims();
1286
- var import_react165 = __toESM(require_react(), 1);
1305
+ var import_react164 = __toESM(require_react(), 1);
1287
1306
 
1288
1307
  // packages/cli/src/ui/App.tsx
1289
1308
  init_esbuild_shims();
@@ -5231,6 +5250,11 @@ var SessionTab = /* @__PURE__ */ __name(() => {
5231
5250
  totalCached += m.tokens.cached;
5232
5251
  }
5233
5252
  const cacheRate = totalInput > 0 ? totalCached / totalInput * 100 : 0;
5253
+ const generation = metrics.generation;
5254
+ const lastGeneration = generation?.last;
5255
+ const lastTps = lastGeneration && lastGeneration.generationDurationMs > 0 ? lastGeneration.outputTokens / (lastGeneration.generationDurationMs / 1e3) : void 0;
5256
+ const averageTtft = generation && generation.timedRequests > 0 ? generation.totalTtftMs / generation.timedRequests : void 0;
5257
+ const sessionTps = generation && generation.totalGenerationDurationMs > 0 ? generation.totalThroughputOutputTokens / (generation.totalGenerationDurationMs / 1e3) : void 0;
5234
5258
  const successColor = getStatusColor(computed.successRate, {
5235
5259
  green: TOOL_SUCCESS_RATE_HIGH,
5236
5260
  yellow: TOOL_SUCCESS_RATE_MEDIUM
@@ -5342,6 +5366,67 @@ var SessionTab = /* @__PURE__ */ __name(() => {
5342
5366
  ] })
5343
5367
  ] })
5344
5368
  ] }),
5369
+ lastGeneration && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(Box_default, { flexDirection: "column", marginTop: 1, children: [
5370
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(Text, { bold: true, color: theme.text.primary, children: [
5371
+ t("Generation Metrics"),
5372
+ " (",
5373
+ t("Latest Request"),
5374
+ ")"
5375
+ ] }),
5376
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(Box_default, { children: [
5377
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Box_default, { width: labelWidth, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(Text, { color: theme.text.secondary, children: [
5378
+ t("Model"),
5379
+ ":"
5380
+ ] }) }),
5381
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Text, { color: theme.text.primary, children: lastGeneration.model })
5382
+ ] }),
5383
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(Box_default, { children: [
5384
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Box_default, { width: labelWidth, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Text, { color: theme.text.secondary, children: "TTFT:" }) }),
5385
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Text, { color: theme.text.primary, children: formatDuration(lastGeneration.ttftMs) })
5386
+ ] }),
5387
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(Box_default, { children: [
5388
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Box_default, { width: labelWidth, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(Text, { color: theme.text.secondary, children: [
5389
+ t("Generation Time"),
5390
+ ":"
5391
+ ] }) }),
5392
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Text, { color: theme.text.primary, children: formatDuration(lastGeneration.generationDurationMs) })
5393
+ ] }),
5394
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(Box_default, { children: [
5395
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Box_default, { width: labelWidth, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(Text, { color: theme.text.secondary, children: [
5396
+ t("Output Tokens"),
5397
+ ":"
5398
+ ] }) }),
5399
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Text, { color: theme.text.primary, children: lastGeneration.outputTokens.toLocaleString() })
5400
+ ] }),
5401
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(Box_default, { children: [
5402
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Box_default, { width: labelWidth, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Text, { color: theme.text.secondary, children: "TPS:" }) }),
5403
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Text, { color: theme.text.primary, children: lastTps === void 0 ? "\u2014" : `${lastTps.toFixed(1)} tok/s` })
5404
+ ] }),
5405
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(Box_default, { paddingLeft: 2, children: [
5406
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Box_default, { width: 26, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(Text, { color: theme.text.secondary, children: [
5407
+ "\xBB ",
5408
+ t("Requests"),
5409
+ ":"
5410
+ ] }) }),
5411
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Text, { color: theme.text.primary, children: generation.timedRequests })
5412
+ ] }),
5413
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(Box_default, { paddingLeft: 2, children: [
5414
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Box_default, { width: 26, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(Text, { color: theme.text.secondary, children: [
5415
+ "\xBB ",
5416
+ t("Average TTFT"),
5417
+ ":"
5418
+ ] }) }),
5419
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Text, { color: theme.text.primary, children: averageTtft === void 0 ? "\u2014" : formatDuration(averageTtft) })
5420
+ ] }),
5421
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(Box_default, { paddingLeft: 2, children: [
5422
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Box_default, { width: 26, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(Text, { color: theme.text.secondary, children: [
5423
+ "\xBB ",
5424
+ t("Session TPS"),
5425
+ ":"
5426
+ ] }) }),
5427
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Text, { color: theme.text.primary, children: sessionTps === void 0 ? "\u2014" : `${sessionTps.toFixed(1)} tok/s` })
5428
+ ] })
5429
+ ] }),
5345
5430
  /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(Box_default, { flexDirection: "column", marginTop: 1, children: [
5346
5431
  /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Text, { bold: true, color: theme.text.primary, children: t("Tokens") }),
5347
5432
  /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(Box_default, { children: [
@@ -5437,21 +5522,13 @@ function computeThresholds2(data) {
5437
5522
  return [p(0.25), p(0.5), p(0.75), p(0.9)];
5438
5523
  }
5439
5524
  __name(computeThresholds2, "computeThresholds");
5440
- function formatDateKey(d) {
5441
- const y = d.getFullYear();
5442
- const m = String(d.getMonth() + 1).padStart(2, "0");
5443
- const day = String(d.getDate()).padStart(2, "0");
5444
- return `${y}-${m}-${day}`;
5445
- }
5446
- __name(formatDateKey, "formatDateKey");
5447
5525
  function buildHeatmapData(data, weeks = 52, monthOffset = 0) {
5448
5526
  const now = /* @__PURE__ */ new Date();
5449
5527
  now.setHours(0, 0, 0, 0);
5450
5528
  const dataKeys = Object.keys(data).filter((k) => data[k] > 0).sort();
5451
5529
  let endDate = new Date(now);
5452
5530
  if (dataKeys.length > 0) {
5453
- const latest = new Date(dataKeys[dataKeys.length - 1]);
5454
- latest.setHours(0, 0, 0, 0);
5531
+ const latest = parseDayKey(dataKeys[dataKeys.length - 1]);
5455
5532
  if (latest.getTime() > endDate.getTime()) endDate = latest;
5456
5533
  }
5457
5534
  if (monthOffset > 0) {
@@ -5474,12 +5551,12 @@ function buildHeatmapData(data, weeks = 52, monthOffset = 0) {
5474
5551
  }
5475
5552
  let col = 0;
5476
5553
  const colMondays = [];
5477
- const todayKey = formatDateKey(/* @__PURE__ */ new Date());
5554
+ const todayKey = dayKey(/* @__PURE__ */ new Date());
5478
5555
  const cursor = new Date(startDate);
5479
5556
  while (cursor <= endDate) {
5480
5557
  const dayOfWeek = cursor.getDay();
5481
5558
  const row = dayOfWeek === 0 ? 6 : dayOfWeek - 1;
5482
- const key = formatDateKey(cursor);
5559
+ const key = dayKey(cursor);
5483
5560
  const count = data[key] || 0;
5484
5561
  const level = intensityLevel(count, thresholds);
5485
5562
  const isToday = key === todayKey;
@@ -5543,8 +5620,8 @@ function buildHeatmapData(data, weeks = 52, monthOffset = 0) {
5543
5620
  return {
5544
5621
  colLabels,
5545
5622
  totalCols: maxCells,
5546
- startDate: formatDateKey(startDate),
5547
- endDate: formatDateKey(endDate),
5623
+ startDate: dayKey(startDate),
5624
+ endDate: dayKey(endDate),
5548
5625
  rows
5549
5626
  };
5550
5627
  }
@@ -9927,19 +10004,43 @@ var useTrustModify = /* @__PURE__ */ __name((onExit, addItem) => {
9927
10004
  setPendingTrustLevel(trustLevel);
9928
10005
  setNeedsRestart(true);
9929
10006
  } else {
10007
+ setPendingTrustLevel(void 0);
10008
+ setNeedsRestart(false);
9930
10009
  const folders = loadTrustedFolders();
9931
- folders.setValue(cwd3, trustLevel);
10010
+ try {
10011
+ folders.setValue(cwd3, trustLevel);
10012
+ } catch (error) {
10013
+ addItem(
10014
+ {
10015
+ type: "error" /* ERROR */,
10016
+ text: `Could not update workspace trust: ${error instanceof Error ? error.message : String(error)}`
10017
+ },
10018
+ Date.now()
10019
+ );
10020
+ return;
10021
+ }
9932
10022
  onExit();
9933
10023
  }
9934
10024
  },
9935
10025
  [cwd3, settings.merged, onExit, addItem]
9936
10026
  );
9937
10027
  const commitTrustLevelChange = (0, import_react32.useCallback)(() => {
9938
- if (pendingTrustLevel) {
9939
- const folders = loadTrustedFolders();
10028
+ if (!pendingTrustLevel) return false;
10029
+ const folders = loadTrustedFolders();
10030
+ try {
9940
10031
  folders.setValue(cwd3, pendingTrustLevel);
10032
+ return true;
10033
+ } catch (error) {
10034
+ addItem(
10035
+ {
10036
+ type: "error" /* ERROR */,
10037
+ text: `Could not update workspace trust: ${error instanceof Error ? error.message : String(error)}`
10038
+ },
10039
+ Date.now()
10040
+ );
10041
+ return false;
9941
10042
  }
9942
- }, [cwd3, pendingTrustLevel]);
10043
+ }, [addItem, cwd3, pendingTrustLevel]);
9943
10044
  return {
9944
10045
  cwd: cwd3,
9945
10046
  currentTrustLevel,
@@ -9990,9 +10091,10 @@ function TrustDialog({
9990
10091
  onExit();
9991
10092
  }
9992
10093
  if (needsRestart && key.name === "r") {
9993
- commitTrustLevelChange();
9994
- relaunchApp();
9995
- onExit();
10094
+ if (commitTrustLevelChange()) {
10095
+ relaunchApp();
10096
+ onExit();
10097
+ }
9996
10098
  }
9997
10099
  },
9998
10100
  { isActive: true }
@@ -14666,8 +14768,8 @@ function SkillsManagerDialog({
14666
14768
  const [loadError, setLoadError] = (0, import_react52.useState)(null);
14667
14769
  const [query, setQuery] = (0, import_react52.useState)("");
14668
14770
  const [activeValue, setActiveValue] = (0, import_react52.useState)(null);
14669
- const initialWorkspaceDisabled = (0, import_react52.useMemo)(
14670
- () => new Set(normalizeNames(namesFromScope(settings, "Workspace" /* Workspace */))),
14771
+ const initialResolved = (0, import_react52.useMemo)(
14772
+ () => resolveSkillSettings(settings),
14671
14773
  [settings]
14672
14774
  );
14673
14775
  const higher = (0, import_react52.useMemo)(() => buildHigherDisabled(settings), [settings]);
@@ -14704,12 +14806,19 @@ function SkillsManagerDialog({
14704
14806
  () => allSkills.filter((s) => !higher.set.has(lower(s.name))),
14705
14807
  [allSkills, higher.set]
14706
14808
  );
14809
+ const initialSelectedKeys = (0, import_react52.useMemo)(
14810
+ () => new Set(
14811
+ unlockedSkills.filter(
14812
+ (skill) => !initialResolved.disabledNames.has(lower(skill.name))
14813
+ ).map((skill) => skill.name)
14814
+ ),
14815
+ [initialResolved, unlockedSkills]
14816
+ );
14707
14817
  const [selectedKeys, setSelectedKeys] = (0, import_react52.useState)(null);
14708
14818
  (0, import_react52.useEffect)(() => {
14709
14819
  if (selectedKeys !== null || unlockedSkills.length === 0) return;
14710
- const initial = unlockedSkills.filter((s) => !initialWorkspaceDisabled.has(lower(s.name))).map((s) => s.name);
14711
- setSelectedKeys(initial);
14712
- }, [unlockedSkills, initialWorkspaceDisabled, selectedKeys]);
14820
+ setSelectedKeys([...initialSelectedKeys]);
14821
+ }, [unlockedSkills, initialSelectedKeys, selectedKeys]);
14713
14822
  const filteredUnlocked = (0, import_react52.useMemo)(() => {
14714
14823
  const normalizedQuery = query.trim().toLowerCase();
14715
14824
  if (!normalizedQuery) return unlockedSkills;
@@ -14764,33 +14873,40 @@ function SkillsManagerDialog({
14764
14873
  return "untrusted";
14765
14874
  }
14766
14875
  const selected = new Set(selectedKeys ?? []);
14767
- const previousWorkspace = namesFromScope(settings, "Workspace" /* Workspace */);
14768
- const previousStrings = previousWorkspace.filter(
14769
- (n) => typeof n === "string"
14876
+ const workspaceDisabled = namesFromScope(
14877
+ settings,
14878
+ "Workspace" /* Workspace */
14879
+ ).filter((name) => typeof name === "string");
14880
+ const lockedNames = new Set(lockedSkills.map((skill) => lower(skill.name)));
14881
+ const { disabled, enabled, disabledChanged, enabledChanged } = computeWorkspaceSkillListUpdates(
14882
+ workspaceDisabled,
14883
+ lockedNames,
14884
+ skillSettingStrings(settings, "Workspace" /* Workspace */, "enabled"),
14885
+ unlockedSkills.map((skill) => ({
14886
+ name: skill.name,
14887
+ wasEnabled: initialSelectedKeys.has(skill.name),
14888
+ isEnabled: selected.has(skill.name),
14889
+ defaultDisabled: initialResolved.defaultDisabledNames.has(lower(skill.name)) && !initialResolved.enabledNames.has(lower(skill.name))
14890
+ }))
14770
14891
  );
14771
- const previousMap = new Map(previousStrings.map((n) => [lower(n), n]));
14772
- const nextDisabled = [];
14773
- const allKnownLower = new Set(allSkills.map((s) => lower(s.name)));
14774
- for (const prev of previousStrings) {
14775
- if (!allKnownLower.has(lower(prev))) {
14776
- nextDisabled.push(prev);
14777
- }
14778
- }
14779
- for (const s of unlockedSkills) {
14780
- if (selected.has(s.name)) continue;
14781
- const existing = previousMap.get(lower(s.name));
14782
- nextDisabled.push(existing ?? s.name);
14783
- }
14784
- const prevNormalized = normalizeNames(previousWorkspace).sort();
14785
- const nextNormalized = normalizeNames(nextDisabled).sort();
14786
- const unchanged = prevNormalized.length === nextNormalized.length && prevNormalized.every((n, i) => n === nextNormalized[i]);
14787
- if (unchanged) return "ok";
14892
+ if (!disabledChanged && !enabledChanged) return "ok";
14788
14893
  try {
14789
- settings.setValue(
14790
- "Workspace" /* Workspace */,
14791
- "skills.disabled",
14792
- nextDisabled.length > 0 ? nextDisabled : void 0
14793
- );
14894
+ settings.setValues([
14895
+ ...disabledChanged ? [
14896
+ {
14897
+ scope: "Workspace" /* Workspace */,
14898
+ key: "skills.disabled",
14899
+ value: disabled.length > 0 ? disabled : void 0
14900
+ }
14901
+ ] : [],
14902
+ ...enabledChanged ? [
14903
+ {
14904
+ scope: "Workspace" /* Workspace */,
14905
+ key: "skills.enabled",
14906
+ value: enabled.length > 0 ? enabled : void 0
14907
+ }
14908
+ ] : []
14909
+ ]);
14794
14910
  } catch (e) {
14795
14911
  addItem(
14796
14912
  {
@@ -14825,7 +14941,9 @@ function SkillsManagerDialog({
14825
14941
  return "ok";
14826
14942
  }, [
14827
14943
  addItem,
14828
- allSkills,
14944
+ initialResolved,
14945
+ initialSelectedKeys,
14946
+ lockedSkills,
14829
14947
  reloadCommands,
14830
14948
  selectedKeys,
14831
14949
  settings,
@@ -26376,7 +26494,7 @@ function useCommandCompletion(buffer, cwd3, slashCommands, commandContext, rever
26376
26494
  query,
26377
26495
  completionStart,
26378
26496
  completionEnd,
26379
- isMidInputSlashCompletion
26497
+ slashCompletionContext
26380
26498
  } = (0, import_react88.useMemo)(() => {
26381
26499
  const currentLine = buffer.lines[cursorRow] || "";
26382
26500
  const codePoints = toCodePoints(currentLine);
@@ -26411,49 +26529,61 @@ function useCommandCompletion(buffer, cwd3, slashCommands, commandContext, rever
26411
26529
  query: partialPath,
26412
26530
  completionStart: pathStart,
26413
26531
  completionEnd: end,
26414
- isMidInputSlashCompletion: false
26532
+ slashCompletionContext: null
26415
26533
  };
26416
26534
  }
26417
26535
  }
26418
- if (cursorRow === 0 && isSlashCommand(currentLine.trim())) {
26419
- return {
26420
- completionMode: "SLASH" /* SLASH */,
26421
- query: currentLine,
26422
- completionStart: 0,
26423
- completionEnd: currentLine.length,
26424
- isMidInputSlashCompletion: false
26425
- };
26426
- }
26427
26536
  const cursorOffset = logicalPosToOffset(buffer.lines, cursorRow, cursorCol);
26428
26537
  const midCmd = findMidInputSlashCommand(buffer.text, cursorOffset);
26429
- if (midCmd && !isExactMidInputModelInvocableCommand(
26430
- midCmd.partialCommand,
26431
- slashCommands
26432
- )) {
26538
+ if (midCmd) {
26433
26539
  const lineStartOffset = logicalPosToOffset(buffer.lines, cursorRow, 0);
26434
26540
  const startOnLine = midCmd.startPos - lineStartOffset;
26435
- if (startOnLine >= 0) {
26541
+ const isInitialCommandOnFirstLine = cursorRow === 0 && isSlashCommand(currentLine.trim()) && startOnLine >= 0 && codePoints.slice(0, startOnLine).join("").trim().length === 0;
26542
+ const inputCodePoints = toCodePoints(buffer.text);
26543
+ const prefix = inputCodePoints.slice(0, midCmd.startPos).join("");
26544
+ const isStackedSkill = !isInitialCommandOnFirstLine && isValidStackedSkillPrefix(prefix, slashCommands);
26545
+ const isSlashLedInput = isSlashCommand(prefix.trimStart());
26546
+ const isRegularMidInput = !isInitialCommandOnFirstLine && !isSlashLedInput;
26547
+ if (startOnLine >= 0 && (isStackedSkill || isRegularMidInput && !isExactMidInputModelInvocableCommand(
26548
+ midCmd.partialCommand,
26549
+ slashCommands
26550
+ ))) {
26436
26551
  return {
26437
26552
  completionMode: "SLASH" /* SLASH */,
26438
26553
  query: midCmd.token,
26439
26554
  completionStart: startOnLine,
26440
26555
  completionEnd: startOnLine + midCmd.token.length,
26441
- isMidInputSlashCompletion: true
26556
+ slashCompletionContext: isStackedSkill ? "stacked-skill" /* STACKED_SKILL */ : "mid-input" /* MID_INPUT */
26442
26557
  };
26443
26558
  }
26444
26559
  }
26560
+ if (cursorRow === 0 && isSlashCommand(currentLine.trim())) {
26561
+ return {
26562
+ completionMode: "SLASH" /* SLASH */,
26563
+ query: currentLine,
26564
+ completionStart: 0,
26565
+ completionEnd: currentLine.length,
26566
+ slashCompletionContext: "line-start" /* LINE_START */
26567
+ };
26568
+ }
26445
26569
  return {
26446
26570
  completionMode: "IDLE" /* IDLE */,
26447
26571
  query: null,
26448
26572
  completionStart: -1,
26449
26573
  completionEnd: -1,
26450
- isMidInputSlashCompletion: false
26574
+ slashCompletionContext: null
26451
26575
  };
26452
26576
  }, [cursorRow, cursorCol, buffer.lines, buffer.text, slashCommands]);
26453
- const slashCommandsForCompletion = (0, import_react88.useMemo)(
26454
- () => isMidInputSlashCompletion ? slashCommands.filter(isMidInputCompletableCommand) : slashCommands,
26455
- [isMidInputSlashCompletion, slashCommands]
26456
- );
26577
+ const isMidInputSlashCompletion = slashCompletionContext === "mid-input" /* MID_INPUT */ || slashCompletionContext === "stacked-skill" /* STACKED_SKILL */;
26578
+ const slashCommandsForCompletion = (0, import_react88.useMemo)(() => {
26579
+ if (slashCompletionContext === "stacked-skill" /* STACKED_SKILL */) {
26580
+ return slashCommands.filter(isStackedSkillCompletableCommand);
26581
+ }
26582
+ if (slashCompletionContext === "mid-input" /* MID_INPUT */) {
26583
+ return slashCommands.filter(isMidInputCompletableCommand);
26584
+ }
26585
+ return slashCommands;
26586
+ }, [slashCompletionContext, slashCommands]);
26457
26587
  const {
26458
26588
  suggestions,
26459
26589
  activeSuggestionIndex,
@@ -26567,6 +26697,8 @@ function useCommandCompletion(buffer, cwd3, slashCommands, commandContext, rever
26567
26697
  const midCmd = findMidInputSlashCommand(buffer.text, cursorOffset);
26568
26698
  if (midCmd) {
26569
26699
  if (isMidInputSlashCompletion) return null;
26700
+ const prefix = toCodePoints(buffer.text).slice(0, midCmd.startPos).join("");
26701
+ if (isSlashCommand(prefix.trimStart())) return null;
26570
26702
  const match = getBestSlashCommandMatch(
26571
26703
  midCmd.partialCommand,
26572
26704
  slashCommands,
@@ -27740,10 +27872,7 @@ var BaseTextInput = /* @__PURE__ */ __name(({
27740
27872
  linesToRender,
27741
27873
  prefixWidth
27742
27874
  });
27743
- (0, import_react96.useInsertionEffect)(() => {
27744
- setCursorPosition(cursorPosition);
27745
- return () => setCursorPosition(void 0);
27746
- }, [setCursorPosition, cursorPosition]);
27875
+ setCursorPosition(cursorPosition);
27747
27876
  const resolvedBorderColor = borderColor ?? theme.border.focused;
27748
27877
  const resolvedPrefix = prefix ?? /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(Text, { color: theme.text.accent, children: "> " });
27749
27878
  const columns = process.stdout.columns || 80;
@@ -29029,7 +29158,9 @@ var InputPrompt = /* @__PURE__ */ __name(({
29029
29158
  const uiState = useUIState();
29030
29159
  const uiActions = useUIActions();
29031
29160
  const settings = useSettings();
29032
- const mouseInteractionsEnabled = !!settings.merged.ui?.useTerminalBuffer;
29161
+ const mouseInteractionsEnabled = useVirtualViewport(
29162
+ settings.merged.ui?.useTerminalBuffer
29163
+ );
29033
29164
  const { pasteWorkaround } = useKeypressContext();
29034
29165
  const { agents, agentTabBarFocused } = useAgentViewState();
29035
29166
  const { setAgentTabBarFocused } = useAgentViewActions();
@@ -29048,7 +29179,7 @@ var InputPrompt = /* @__PURE__ */ __name(({
29048
29179
  setPillFocused: setBgPillFocused
29049
29180
  } = useBackgroundTaskViewActions();
29050
29181
  const hasAgents = agents.size > 0;
29051
- const liveAgentPanelMaxRows = settings.merged.ui?.useTerminalBuffer ? getLiveAgentPanelVpMaxRows(uiState.terminalHeight) : LIVE_AGENT_PANEL_MAX_ROWS;
29182
+ const liveAgentPanelMaxRows = uiState.useTerminalBuffer ? getLiveAgentPanelVpMaxRows(uiState.terminalHeight) : LIVE_AGENT_PANEL_MAX_ROWS;
29052
29183
  const getVisibleBgAgents = (0, import_react98.useCallback)(
29053
29184
  () => panelDisplayOrder(
29054
29185
  bgEntries.filter((e) => isLiveAgentPanelVisibleEntry(e, Date.now()))
@@ -29286,6 +29417,7 @@ var InputPrompt = /* @__PURE__ */ __name(({
29286
29417
  const handleSubmitAndClear = (0, import_react98.useCallback)(
29287
29418
  (submittedValue, deferUntilIdle = false) => {
29288
29419
  exportCompletion.reset();
29420
+ const submittedPrompt = submittedValue;
29289
29421
  let finalValue = submittedValue;
29290
29422
  if (pendingPastes.size > 0) {
29291
29423
  finalValue = expandPendingPastePlaceholders(finalValue, pendingPastes);
@@ -29303,11 +29435,7 @@ ${finalValue.trim()}`;
29303
29435
  }
29304
29436
  buffer.setText("");
29305
29437
  clearPromptStash(targetDir);
29306
- if (deferUntilIdle) {
29307
- onSubmit(finalValue, { deferUntilIdle: true });
29308
- } else {
29309
- onSubmit(finalValue);
29310
- }
29438
+ onSubmit(finalValue, { deferUntilIdle, submittedPrompt });
29311
29439
  resetHistoryNavRef.current();
29312
29440
  followup.dismiss();
29313
29441
  onPromptSuggestionDismiss?.();
@@ -29336,10 +29464,11 @@ ${finalValue.trim()}`;
29336
29464
  voiceSubmitRef.current = (text) => handleSubmitAndClear(text);
29337
29465
  const customSetTextAndResetCompletionSignal = (0, import_react98.useCallback)(
29338
29466
  (newText) => {
29467
+ uiActions.invalidateSubmittedPromptProvenance();
29339
29468
  buffer.setText(newText);
29340
29469
  setHistoryRestoredText(newText);
29341
29470
  },
29342
- [buffer]
29471
+ [buffer, uiActions]
29343
29472
  );
29344
29473
  const inputHistory = useInputHistory({
29345
29474
  userMessages,
@@ -29770,6 +29899,7 @@ ${currentText}`);
29770
29899
  }
29771
29900
  }
29772
29901
  if (keyMatchers["acceptSuggestionReverseSearch" /* ACCEPT_SUGGESTION_REVERSE_SEARCH */](key)) {
29902
+ uiActions.invalidateSubmittedPromptProvenance();
29773
29903
  sc.handleAutocomplete(activeSuggestionIndex);
29774
29904
  resetState();
29775
29905
  setActive(false);
@@ -29778,6 +29908,9 @@ ${currentText}`);
29778
29908
  }
29779
29909
  if (keyMatchers["submitReverseSearch" /* SUBMIT_REVERSE_SEARCH */](key)) {
29780
29910
  const textToSubmit = showSuggestions && activeSuggestionIndex > -1 ? suggestions[activeSuggestionIndex].value : buffer.text;
29911
+ if (showSuggestions && activeSuggestionIndex > -1) {
29912
+ uiActions.invalidateSubmittedPromptProvenance();
29913
+ }
29781
29914
  handleSubmitAndClear(textToSubmit);
29782
29915
  resetState();
29783
29916
  setActive(false);
@@ -29973,12 +30106,18 @@ ${currentText}`);
29973
30106
  } else {
29974
30107
  if (keyMatchers["navigationUp" /* NAVIGATION_UP */](key)) {
29975
30108
  const prevCommand = shellHistory.getPreviousCommand();
29976
- if (prevCommand !== null) buffer.setText(prevCommand);
30109
+ if (prevCommand !== null) {
30110
+ uiActions.invalidateSubmittedPromptProvenance();
30111
+ buffer.setText(prevCommand);
30112
+ }
29977
30113
  return true;
29978
30114
  }
29979
30115
  if (keyMatchers["navigationDown" /* NAVIGATION_DOWN */](key)) {
29980
30116
  const nextCommand = shellHistory.getNextCommand();
29981
- if (nextCommand !== null) buffer.setText(nextCommand);
30117
+ if (nextCommand !== null) {
30118
+ uiActions.invalidateSubmittedPromptProvenance();
30119
+ buffer.setText(nextCommand);
30120
+ }
29982
30121
  return true;
29983
30122
  }
29984
30123
  }
@@ -30245,6 +30384,7 @@ ${currentText}`);
30245
30384
  if (commandSearchActive || reverseSearchActive) {
30246
30385
  const isCommandSearch = commandSearchActive;
30247
30386
  const sc = isCommandSearch ? commandSearchCompletion : reverseSearchCompletion;
30387
+ uiActions.invalidateSubmittedPromptProvenance();
30248
30388
  sc.handleAutocomplete(index);
30249
30389
  sc.resetCompletionState();
30250
30390
  (isCommandSearch ? setCommandSearchActive : setReverseSearchActive)(
@@ -30274,7 +30414,8 @@ ${currentText}`);
30274
30414
  handleSubmitAndClear,
30275
30415
  setExpandedSuggestionIndex,
30276
30416
  setCommandSearchActive,
30277
- setReverseSearchActive
30417
+ setReverseSearchActive,
30418
+ uiActions
30278
30419
  ]
30279
30420
  );
30280
30421
  const hasTabConsumer = shouldShowSuggestions || buffer.text.length === 0 && Boolean(availableSuggestion) || Boolean(completion.midInputGhostText?.acceptText);
@@ -31633,6 +31774,15 @@ function isRecentHistoryTodoSnapshot(snapshotItemIndex, historyLength) {
31633
31774
  return historyItemsAfterSnapshot < MIN_HISTORY_ITEMS_AFTER_TODO_BEFORE_STICKY;
31634
31775
  }
31635
31776
  __name(isRecentHistoryTodoSnapshot, "isRecentHistoryTodoSnapshot");
31777
+ function hasUserMessageAfter(items, afterIndex) {
31778
+ for (let i = afterIndex + 1; i < items.length; i++) {
31779
+ if (items[i].type === "user") {
31780
+ return true;
31781
+ }
31782
+ }
31783
+ return false;
31784
+ }
31785
+ __name(hasUserMessageAfter, "hasUserMessageAfter");
31636
31786
  function getStickyTodos(history, pendingHistoryItems) {
31637
31787
  const pendingSnapshot = findLatestTodoSnapshot(pendingHistoryItems);
31638
31788
  if (pendingSnapshot !== void 0) {
@@ -31645,6 +31795,9 @@ function getStickyTodos(history, pendingHistoryItems) {
31645
31795
  if (isRecentHistoryTodoSnapshot(historySnapshot.itemIndex, history.length)) {
31646
31796
  return null;
31647
31797
  }
31798
+ if (hasUserMessageAfter(history, historySnapshot.itemIndex)) {
31799
+ return null;
31800
+ }
31648
31801
  if (areAllTodosCompleted(historySnapshot.todos)) {
31649
31802
  return null;
31650
31803
  }
@@ -33016,7 +33169,7 @@ var App = /* @__PURE__ */ __name(() => {
33016
33169
  }, "App");
33017
33170
 
33018
33171
  // packages/cli/src/ui/AppContainer.tsx
33019
- import process16 from "node:process";
33172
+ import process17 from "node:process";
33020
33173
 
33021
33174
  // packages/cli/src/ui/hooks/useMemoryMonitor.ts
33022
33175
  init_esbuild_shims();
@@ -33091,34 +33244,15 @@ var useMemoryMonitor = /* @__PURE__ */ __name(({
33091
33244
  }, [addItem, compactOldItems]);
33092
33245
  }, "useMemoryMonitor");
33093
33246
 
33094
- // packages/cli/src/ui/hooks/useResizeSettleRepaint.ts
33095
- init_esbuild_shims();
33096
- var import_react117 = __toESM(require_react(), 1);
33097
- var RESIZE_REPAINT_SETTLE_MS = 200;
33098
- function useResizeSettleRepaint(terminalWidth, refreshStatic) {
33099
- const settledTerminalWidthRef = (0, import_react117.useRef)(terminalWidth);
33100
- (0, import_react117.useEffect)(() => {
33101
- if (settledTerminalWidthRef.current === terminalWidth) {
33102
- return;
33103
- }
33104
- const timer = setTimeout(() => {
33105
- settledTerminalWidthRef.current = terminalWidth;
33106
- refreshStatic();
33107
- }, RESIZE_REPAINT_SETTLE_MS);
33108
- return () => clearTimeout(timer);
33109
- }, [terminalWidth, refreshStatic]);
33110
- }
33111
- __name(useResizeSettleRepaint, "useResizeSettleRepaint");
33112
-
33113
33247
  // packages/cli/src/ui/hooks/use-wake-repaint.ts
33114
33248
  init_esbuild_shims();
33115
- var import_react118 = __toESM(require_react(), 1);
33249
+ var import_react117 = __toESM(require_react(), 1);
33116
33250
  var HEARTBEAT_INTERVAL_MS = 5e3;
33117
33251
  var WAKE_THRESHOLD_MS = HEARTBEAT_INTERVAL_MS * 2;
33118
33252
  function useWakeRepaint(repaint) {
33119
- const repaintRef = (0, import_react118.useRef)(repaint);
33253
+ const repaintRef = (0, import_react117.useRef)(repaint);
33120
33254
  repaintRef.current = repaint;
33121
- (0, import_react118.useEffect)(() => {
33255
+ (0, import_react117.useEffect)(() => {
33122
33256
  let lastTick = Date.now();
33123
33257
  const timer = setInterval(() => {
33124
33258
  const now = Date.now();
@@ -33144,12 +33278,12 @@ __name(useWakeRepaint, "useWakeRepaint");
33144
33278
 
33145
33279
  // packages/cli/src/ui/hooks/useThemeCommand.ts
33146
33280
  init_esbuild_shims();
33147
- var import_react119 = __toESM(require_react(), 1);
33281
+ var import_react118 = __toESM(require_react(), 1);
33148
33282
  import process13 from "node:process";
33149
33283
  var useThemeCommand = /* @__PURE__ */ __name((loadedSettings, setThemeError, addItem, initialThemeError) => {
33150
- const [isThemeDialogOpen, setIsThemeDialogOpen] = (0, import_react119.useState)(!!initialThemeError);
33151
- const [themeBeforeDialogOpen, setThemeBeforeDialogOpen] = (0, import_react119.useState)(themeManager.getActiveTheme().name);
33152
- const openThemeDialog = (0, import_react119.useCallback)(() => {
33284
+ const [isThemeDialogOpen, setIsThemeDialogOpen] = (0, import_react118.useState)(!!initialThemeError);
33285
+ const [themeBeforeDialogOpen, setThemeBeforeDialogOpen] = (0, import_react118.useState)(themeManager.getActiveTheme().name);
33286
+ const openThemeDialog = (0, import_react118.useCallback)(() => {
33153
33287
  if (process13.env["NO_COLOR"]) {
33154
33288
  addItem(
33155
33289
  {
@@ -33165,7 +33299,7 @@ var useThemeCommand = /* @__PURE__ */ __name((loadedSettings, setThemeError, add
33165
33299
  setThemeBeforeDialogOpen(themeManager.getActiveTheme().name);
33166
33300
  setIsThemeDialogOpen(true);
33167
33301
  }, [addItem]);
33168
- const applyTheme = (0, import_react119.useCallback)(
33302
+ const applyTheme = (0, import_react118.useCallback)(
33169
33303
  (themeName) => {
33170
33304
  if (!themeManager.setActiveTheme(themeName)) {
33171
33305
  setIsThemeDialogOpen(true);
@@ -33180,13 +33314,13 @@ var useThemeCommand = /* @__PURE__ */ __name((loadedSettings, setThemeError, add
33180
33314
  },
33181
33315
  [setThemeError]
33182
33316
  );
33183
- const handleThemeHighlight = (0, import_react119.useCallback)(
33317
+ const handleThemeHighlight = (0, import_react118.useCallback)(
33184
33318
  (themeName) => {
33185
33319
  applyTheme(themeName);
33186
33320
  },
33187
33321
  [applyTheme]
33188
33322
  );
33189
- const handleThemeSelect = (0, import_react119.useCallback)(
33323
+ const handleThemeSelect = (0, import_react118.useCallback)(
33190
33324
  (themeName, scope) => {
33191
33325
  if (themeName === void 0) {
33192
33326
  applyTheme(themeBeforeDialogOpen);
@@ -33233,7 +33367,7 @@ var useThemeCommand = /* @__PURE__ */ __name((loadedSettings, setThemeError, add
33233
33367
 
33234
33368
  // packages/cli/src/ui/hooks/useFeedbackDialog.ts
33235
33369
  init_esbuild_shims();
33236
- var import_react120 = __toESM(require_react(), 1);
33370
+ var import_react119 = __toESM(require_react(), 1);
33237
33371
  import * as fs15 from "node:fs";
33238
33372
  var import_strip_json_comments = __toESM(require_strip_json_comments(), 1);
33239
33373
  var FEEDBACK_SHOW_PROBABILITY = 0.25;
@@ -33279,20 +33413,20 @@ var useFeedbackDialog = /* @__PURE__ */ __name(({
33279
33413
  history,
33280
33414
  sessionStats
33281
33415
  }) => {
33282
- const [isFeedbackDialogOpen, setIsFeedbackDialogOpen] = (0, import_react120.useState)(false);
33283
- const [isFeedbackDismissedTemporarily, setIsFeedbackDismissedTemporarily] = (0, import_react120.useState)(false);
33284
- const openFeedbackDialog = (0, import_react120.useCallback)(() => {
33416
+ const [isFeedbackDialogOpen, setIsFeedbackDialogOpen] = (0, import_react119.useState)(false);
33417
+ const [isFeedbackDismissedTemporarily, setIsFeedbackDismissedTemporarily] = (0, import_react119.useState)(false);
33418
+ const openFeedbackDialog = (0, import_react119.useCallback)(() => {
33285
33419
  setIsFeedbackDialogOpen(true);
33286
33420
  }, []);
33287
- const closeFeedbackDialog = (0, import_react120.useCallback)(
33421
+ const closeFeedbackDialog = (0, import_react119.useCallback)(
33288
33422
  () => setIsFeedbackDialogOpen(false),
33289
33423
  []
33290
33424
  );
33291
- const temporaryCloseFeedbackDialog = (0, import_react120.useCallback)(() => {
33425
+ const temporaryCloseFeedbackDialog = (0, import_react119.useCallback)(() => {
33292
33426
  setIsFeedbackDialogOpen(false);
33293
33427
  setIsFeedbackDismissedTemporarily(true);
33294
33428
  }, []);
33295
- const submitFeedback = (0, import_react120.useCallback)(
33429
+ const submitFeedback = (0, import_react119.useCallback)(
33296
33430
  (rating) => {
33297
33431
  if (rating >= FEEDBACK_OPTIONS.GOOD && rating <= FEEDBACK_OPTIONS.FINE) {
33298
33432
  const feedbackEvent = new UserFeedbackEvent(
@@ -33312,7 +33446,7 @@ var useFeedbackDialog = /* @__PURE__ */ __name(({
33312
33446
  },
33313
33447
  [closeFeedbackDialog, sessionStats.sessionId, config, settings]
33314
33448
  );
33315
- (0, import_react120.useEffect)(() => {
33449
+ (0, import_react119.useEffect)(() => {
33316
33450
  const checkAndShowFeedback = /* @__PURE__ */ __name(() => {
33317
33451
  if (streamingState === "idle" /* Idle */ && history.length > 0) {
33318
33452
  if (!config.getUsageStatisticsEnabled() || settings.merged.ui?.enableUserFeedback === false || !lastMessageIsAIResponse(history) || Math.random() > FEEDBACK_SHOW_PROBABILITY || !meetsMinimumSessionRequirements(sessionStats) || isFeedbackDismissedTemporarily) {
@@ -33334,7 +33468,7 @@ var useFeedbackDialog = /* @__PURE__ */ __name(({
33334
33468
  settings.merged.ui?.enableUserFeedback,
33335
33469
  config
33336
33470
  ]);
33337
- (0, import_react120.useEffect)(() => {
33471
+ (0, import_react119.useEffect)(() => {
33338
33472
  if (streamingState === "responding" /* Responding */ && isFeedbackDismissedTemporarily) {
33339
33473
  setIsFeedbackDismissedTemporarily(false);
33340
33474
  }
@@ -33350,13 +33484,13 @@ var useFeedbackDialog = /* @__PURE__ */ __name(({
33350
33484
 
33351
33485
  // packages/cli/src/ui/hooks/useEditorSettings.ts
33352
33486
  init_esbuild_shims();
33353
- var import_react121 = __toESM(require_react(), 1);
33487
+ var import_react120 = __toESM(require_react(), 1);
33354
33488
  var useEditorSettings = /* @__PURE__ */ __name((loadedSettings, setEditorError, addItem) => {
33355
- const [isEditorDialogOpen, setIsEditorDialogOpen] = (0, import_react121.useState)(false);
33356
- const openEditorDialog = (0, import_react121.useCallback)(() => {
33489
+ const [isEditorDialogOpen, setIsEditorDialogOpen] = (0, import_react120.useState)(false);
33490
+ const openEditorDialog = (0, import_react120.useCallback)(() => {
33357
33491
  setIsEditorDialogOpen(true);
33358
33492
  }, []);
33359
- const handleEditorSelect = (0, import_react121.useCallback)(
33493
+ const handleEditorSelect = (0, import_react120.useCallback)(
33360
33494
  (editorType, scope) => {
33361
33495
  if (editorType && (!checkHasEditorType(editorType) || !allowEditorTypeInSandbox(editorType))) {
33362
33496
  return;
@@ -33378,7 +33512,7 @@ var useEditorSettings = /* @__PURE__ */ __name((loadedSettings, setEditorError,
33378
33512
  },
33379
33513
  [loadedSettings, setEditorError, addItem]
33380
33514
  );
33381
- const exitEditorDialog = (0, import_react121.useCallback)(() => {
33515
+ const exitEditorDialog = (0, import_react120.useCallback)(() => {
33382
33516
  setIsEditorDialogOpen(false);
33383
33517
  }, []);
33384
33518
  return {
@@ -33391,13 +33525,13 @@ var useEditorSettings = /* @__PURE__ */ __name((loadedSettings, setEditorError,
33391
33525
 
33392
33526
  // packages/cli/src/ui/hooks/useSettingsCommand.ts
33393
33527
  init_esbuild_shims();
33394
- var import_react122 = __toESM(require_react(), 1);
33528
+ var import_react121 = __toESM(require_react(), 1);
33395
33529
  function useSettingsCommand() {
33396
- const [isSettingsDialogOpen, setIsSettingsDialogOpen] = (0, import_react122.useState)(false);
33397
- const openSettingsDialog = (0, import_react122.useCallback)(() => {
33530
+ const [isSettingsDialogOpen, setIsSettingsDialogOpen] = (0, import_react121.useState)(false);
33531
+ const openSettingsDialog = (0, import_react121.useCallback)(() => {
33398
33532
  setIsSettingsDialogOpen(true);
33399
33533
  }, []);
33400
- const closeSettingsDialog = (0, import_react122.useCallback)(() => {
33534
+ const closeSettingsDialog = (0, import_react121.useCallback)(() => {
33401
33535
  setIsSettingsDialogOpen(false);
33402
33536
  }, []);
33403
33537
  return {
@@ -33408,17 +33542,44 @@ function useSettingsCommand() {
33408
33542
  }
33409
33543
  __name(useSettingsCommand, "useSettingsCommand");
33410
33544
 
33545
+ // packages/cli/src/ui/utils/terminal-buffer.ts
33546
+ init_esbuild_shims();
33547
+ import process14 from "node:process";
33548
+ function isCiEnvKey(key) {
33549
+ return key === "CI" || key === "CONTINUOUS_INTEGRATION" || key.startsWith("CI_");
33550
+ }
33551
+ __name(isCiEnvKey, "isCiEnvKey");
33552
+ function isActiveCiValue(value) {
33553
+ const normalizedValue = value?.toLowerCase();
33554
+ return value !== void 0 && value !== "" && normalizedValue !== "0" && normalizedValue !== "false";
33555
+ }
33556
+ __name(isActiveCiValue, "isActiveCiValue");
33557
+ function isCiEnvironment(env) {
33558
+ return Object.keys(env).some(
33559
+ (key) => isCiEnvKey(key) && isActiveCiValue(env[key])
33560
+ );
33561
+ }
33562
+ __name(isCiEnvironment, "isCiEnvironment");
33563
+ function isInteractiveTerminal(stdoutIsTTY = process14.stdout.isTTY, env = process14.env) {
33564
+ return Boolean(stdoutIsTTY) && !isCiEnvironment(env) && env["TERM"]?.toLowerCase() !== "dumb";
33565
+ }
33566
+ __name(isInteractiveTerminal, "isInteractiveTerminal");
33567
+ function shouldUseVirtualViewport(useTerminalBuffer, screenReader, terminalInteractive) {
33568
+ return terminalInteractive && (useTerminalBuffer ?? true) && !screenReader;
33569
+ }
33570
+ __name(shouldUseVirtualViewport, "shouldUseVirtualViewport");
33571
+
33411
33572
  // packages/cli/src/ui/hooks/useModelCommand.ts
33412
33573
  init_esbuild_shims();
33413
- var import_react123 = __toESM(require_react(), 1);
33574
+ var import_react122 = __toESM(require_react(), 1);
33414
33575
  var useModelCommand = /* @__PURE__ */ __name(() => {
33415
- const [isModelDialogOpen, setIsModelDialogOpen] = (0, import_react123.useState)(false);
33416
- const [isFastModelMode, setIsFastModelMode] = (0, import_react123.useState)(false);
33417
- const [isVoiceModelMode, setIsVoiceModelMode] = (0, import_react123.useState)(false);
33418
- const [isVisionModelMode, setIsVisionModelMode] = (0, import_react123.useState)(false);
33419
- const [isImageModelMode, setIsImageModelMode] = (0, import_react123.useState)(false);
33420
- const [modelDialogPersistScope, setModelDialogPersistScope] = (0, import_react123.useState)(void 0);
33421
- const openModelDialog = (0, import_react123.useCallback)(
33576
+ const [isModelDialogOpen, setIsModelDialogOpen] = (0, import_react122.useState)(false);
33577
+ const [isFastModelMode, setIsFastModelMode] = (0, import_react122.useState)(false);
33578
+ const [isVoiceModelMode, setIsVoiceModelMode] = (0, import_react122.useState)(false);
33579
+ const [isVisionModelMode, setIsVisionModelMode] = (0, import_react122.useState)(false);
33580
+ const [isImageModelMode, setIsImageModelMode] = (0, import_react122.useState)(false);
33581
+ const [modelDialogPersistScope, setModelDialogPersistScope] = (0, import_react122.useState)(void 0);
33582
+ const openModelDialog = (0, import_react122.useCallback)(
33422
33583
  (options) => {
33423
33584
  const voiceModelMode = options?.voiceModelMode ?? false;
33424
33585
  const visionModelMode = options?.visionModelMode ?? false;
@@ -33436,7 +33597,7 @@ var useModelCommand = /* @__PURE__ */ __name(() => {
33436
33597
  },
33437
33598
  []
33438
33599
  );
33439
- const closeModelDialog = (0, import_react123.useCallback)(() => {
33600
+ const closeModelDialog = (0, import_react122.useCallback)(() => {
33440
33601
  setIsModelDialogOpen(false);
33441
33602
  setIsFastModelMode(false);
33442
33603
  setIsVoiceModelMode(false);
@@ -33458,13 +33619,13 @@ var useModelCommand = /* @__PURE__ */ __name(() => {
33458
33619
 
33459
33620
  // packages/cli/src/ui/hooks/useApprovalModeCommand.ts
33460
33621
  init_esbuild_shims();
33461
- var import_react124 = __toESM(require_react(), 1);
33622
+ var import_react123 = __toESM(require_react(), 1);
33462
33623
  var useApprovalModeCommand = /* @__PURE__ */ __name((loadedSettings, config) => {
33463
- const [isApprovalModeDialogOpen, setIsApprovalModeDialogOpen] = (0, import_react124.useState)(false);
33464
- const openApprovalModeDialog = (0, import_react124.useCallback)(() => {
33624
+ const [isApprovalModeDialogOpen, setIsApprovalModeDialogOpen] = (0, import_react123.useState)(false);
33625
+ const openApprovalModeDialog = (0, import_react123.useCallback)(() => {
33465
33626
  setIsApprovalModeDialogOpen(true);
33466
33627
  }, []);
33467
- const handleApprovalModeSelect = (0, import_react124.useCallback)(
33628
+ const handleApprovalModeSelect = (0, import_react123.useCallback)(
33468
33629
  (mode, scope) => {
33469
33630
  try {
33470
33631
  if (!mode) {
@@ -33490,13 +33651,13 @@ var useApprovalModeCommand = /* @__PURE__ */ __name((loadedSettings, config) =>
33490
33651
 
33491
33652
  // packages/cli/src/ui/hooks/use-effort-command.ts
33492
33653
  init_esbuild_shims();
33493
- var import_react125 = __toESM(require_react(), 1);
33654
+ var import_react124 = __toESM(require_react(), 1);
33494
33655
  var useEffortCommand = /* @__PURE__ */ __name((loadedSettings, config, addItem) => {
33495
- const [isEffortDialogOpen, setIsEffortDialogOpen] = (0, import_react125.useState)(false);
33496
- const openEffortDialog = (0, import_react125.useCallback)(() => {
33656
+ const [isEffortDialogOpen, setIsEffortDialogOpen] = (0, import_react124.useState)(false);
33657
+ const openEffortDialog = (0, import_react124.useCallback)(() => {
33497
33658
  setIsEffortDialogOpen(true);
33498
33659
  }, []);
33499
- const handleEffortSelect = (0, import_react125.useCallback)(
33660
+ const handleEffortSelect = (0, import_react124.useCallback)(
33500
33661
  (effort) => {
33501
33662
  try {
33502
33663
  if (!effort) {
@@ -33548,7 +33709,7 @@ var useEffortCommand = /* @__PURE__ */ __name((loadedSettings, config, addItem)
33548
33709
 
33549
33710
  // packages/cli/src/ui/hooks/useBranchCommand.ts
33550
33711
  init_esbuild_shims();
33551
- var import_react126 = __toESM(require_react(), 1);
33712
+ var import_react125 = __toESM(require_react(), 1);
33552
33713
  import { randomUUID } from "node:crypto";
33553
33714
  var BACKGROUND_WORK_BRANCH_BLOCKED_MESSAGE = "Stop the current session's running background tasks before branching the conversation.";
33554
33715
  function deriveFirstPrompt(messages) {
@@ -33569,7 +33730,7 @@ function deriveFirstPrompt(messages) {
33569
33730
  __name(deriveFirstPrompt, "deriveFirstPrompt");
33570
33731
  function useBranchCommand(options) {
33571
33732
  const { config, historyManager, startNewSession, setSessionName, remount } = options;
33572
- const handleBranch = (0, import_react126.useCallback)(
33733
+ const handleBranch = (0, import_react125.useCallback)(
33573
33734
  async (name) => {
33574
33735
  if (!config) return;
33575
33736
  if (hasBlockingBackgroundWork(config)) {
@@ -33711,19 +33872,19 @@ __name(useBranchCommand, "useBranchCommand");
33711
33872
 
33712
33873
  // packages/cli/src/ui/hooks/useResumeCommand.ts
33713
33874
  init_esbuild_shims();
33714
- var import_react127 = __toESM(require_react(), 1);
33875
+ var import_react126 = __toESM(require_react(), 1);
33715
33876
  var BACKGROUND_WORK_SWITCH_BLOCKED_MESSAGE = "Stop the current session's running background tasks before resuming another session.";
33716
33877
  function useResumeCommand(options) {
33717
- const [isResumeDialogOpen, setIsResumeDialogOpen] = (0, import_react127.useState)(false);
33718
- const [resumeMatchedSessions, setResumeMatchedSessions] = (0, import_react127.useState)();
33719
- const openResumeDialog = (0, import_react127.useCallback)(
33878
+ const [isResumeDialogOpen, setIsResumeDialogOpen] = (0, import_react126.useState)(false);
33879
+ const [resumeMatchedSessions, setResumeMatchedSessions] = (0, import_react126.useState)();
33880
+ const openResumeDialog = (0, import_react126.useCallback)(
33720
33881
  (matchedSessions) => {
33721
33882
  setResumeMatchedSessions(matchedSessions);
33722
33883
  setIsResumeDialogOpen(true);
33723
33884
  },
33724
33885
  []
33725
33886
  );
33726
- const closeResumeDialog = (0, import_react127.useCallback)(() => {
33887
+ const closeResumeDialog = (0, import_react126.useCallback)(() => {
33727
33888
  setIsResumeDialogOpen(false);
33728
33889
  setResumeMatchedSessions(void 0);
33729
33890
  }, []);
@@ -33736,7 +33897,7 @@ function useResumeCommand(options) {
33736
33897
  remount
33737
33898
  } = options;
33738
33899
  const { addItem, clearItems, loadHistory } = historyManager;
33739
- const handleResume = (0, import_react127.useCallback)(
33900
+ const handleResume = (0, import_react126.useCallback)(
33740
33901
  async (sessionId) => {
33741
33902
  if (!config) {
33742
33903
  return;
@@ -33861,18 +34022,18 @@ __name(useResumeCommand, "useResumeCommand");
33861
34022
 
33862
34023
  // packages/cli/src/ui/hooks/useDeleteCommand.ts
33863
34024
  init_esbuild_shims();
33864
- var import_react128 = __toESM(require_react(), 1);
34025
+ var import_react127 = __toESM(require_react(), 1);
33865
34026
  function useDeleteCommand(options) {
33866
- const [isDeleteDialogOpen, setIsDeleteDialogOpen] = (0, import_react128.useState)(false);
33867
- const openDeleteDialog = (0, import_react128.useCallback)(() => {
34027
+ const [isDeleteDialogOpen, setIsDeleteDialogOpen] = (0, import_react127.useState)(false);
34028
+ const openDeleteDialog = (0, import_react127.useCallback)(() => {
33868
34029
  setIsDeleteDialogOpen(true);
33869
34030
  }, []);
33870
- const closeDeleteDialog = (0, import_react128.useCallback)(() => {
34031
+ const closeDeleteDialog = (0, import_react127.useCallback)(() => {
33871
34032
  setIsDeleteDialogOpen(false);
33872
34033
  }, []);
33873
34034
  const { config, addItem } = options ?? {};
33874
- const isDeletingManyRef = (0, import_react128.useRef)(false);
33875
- const handleDelete = (0, import_react128.useCallback)(
34035
+ const isDeletingManyRef = (0, import_react127.useRef)(false);
34036
+ const handleDelete = (0, import_react127.useCallback)(
33876
34037
  async (sessionId) => {
33877
34038
  if (!config) {
33878
34039
  return;
@@ -33931,7 +34092,7 @@ function useDeleteCommand(options) {
33931
34092
  },
33932
34093
  [closeDeleteDialog, config, addItem]
33933
34094
  );
33934
- const handleDeleteMany = (0, import_react128.useCallback)(
34095
+ const handleDeleteMany = (0, import_react127.useCallback)(
33935
34096
  async (sessionIds) => {
33936
34097
  if (!config) {
33937
34098
  return;
@@ -34063,7 +34224,7 @@ __name(useDeleteCommand, "useDeleteCommand");
34063
34224
 
34064
34225
  // packages/cli/src/ui/hooks/slashCommandProcessor.ts
34065
34226
  init_esbuild_shims();
34066
- var import_react129 = __toESM(require_react(), 1);
34227
+ var import_react128 = __toESM(require_react(), 1);
34067
34228
  var debugLogger33 = createDebugLogger("SLASH_COMMAND_PROCESSOR");
34068
34229
  function hasUserPromptExpansionHooks(config) {
34069
34230
  return !!config && !config.getDisableAllHooks?.() && (config.hasHooksForEvent?.("UserPromptExpansion") ?? false);
@@ -34095,33 +34256,33 @@ function getSkillCommandName(command) {
34095
34256
  }
34096
34257
  __name(getSkillCommandName, "getSkillCommandName");
34097
34258
  var useSlashCommandProcessor = /* @__PURE__ */ __name((config, settings, history, addItem, clearItems, loadHistory, refreshStatic, toggleVimEnabled, isProcessing, setIsProcessing, isIdleRef, setGeminiMdFileCount, actions, extensionsUpdateState, isConfigInitialized, logger, updateItem, setSessionName, extensionRefreshState) => {
34098
- const fallbackExtensionRefreshStateRef = (0, import_react129.useRef)(
34259
+ const fallbackExtensionRefreshStateRef = (0, import_react128.useRef)(
34099
34260
  null
34100
34261
  );
34101
34262
  if (!fallbackExtensionRefreshStateRef.current) {
34102
34263
  fallbackExtensionRefreshStateRef.current = new ExtensionRefreshState();
34103
34264
  }
34104
34265
  const activeExtensionRefreshState = extensionRefreshState ?? fallbackExtensionRefreshStateRef.current;
34105
- const historyRef = (0, import_react129.useRef)(history);
34106
- (0, import_react129.useLayoutEffect)(() => {
34266
+ const historyRef = (0, import_react128.useRef)(history);
34267
+ (0, import_react128.useLayoutEffect)(() => {
34107
34268
  historyRef.current = history;
34108
34269
  }, [history]);
34109
34270
  const { stats: sessionStats, startNewSession } = useSessionStats();
34110
- const [commands, setCommands] = (0, import_react129.useState)([]);
34111
- const [recentCommands, setRecentCommands] = (0, import_react129.useState)(/* @__PURE__ */ new Map());
34112
- const [reloadTrigger, setReloadTrigger] = (0, import_react129.useState)(0);
34113
- const commandReloadResolversRef = (0, import_react129.useRef)([]);
34114
- const extensionContentRefreshTimerRef = (0, import_react129.useRef)(null);
34115
- const extensionContentRefreshRunningRef = (0, import_react129.useRef)(false);
34116
- const extensionContentRefreshPendingRef = (0, import_react129.useRef)(false);
34117
- const mountedRef = (0, import_react129.useRef)(true);
34118
- (0, import_react129.useEffect)(() => {
34271
+ const [commands, setCommands] = (0, import_react128.useState)([]);
34272
+ const [recentCommands, setRecentCommands] = (0, import_react128.useState)(/* @__PURE__ */ new Map());
34273
+ const [reloadTrigger, setReloadTrigger] = (0, import_react128.useState)(0);
34274
+ const commandReloadResolversRef = (0, import_react128.useRef)([]);
34275
+ const extensionContentRefreshTimerRef = (0, import_react128.useRef)(null);
34276
+ const extensionContentRefreshRunningRef = (0, import_react128.useRef)(false);
34277
+ const extensionContentRefreshPendingRef = (0, import_react128.useRef)(false);
34278
+ const mountedRef = (0, import_react128.useRef)(true);
34279
+ (0, import_react128.useEffect)(() => {
34119
34280
  mountedRef.current = true;
34120
34281
  return () => {
34121
34282
  mountedRef.current = false;
34122
34283
  };
34123
34284
  }, []);
34124
- const resolveCommandReloads = (0, import_react129.useCallback)((completedTrigger) => {
34285
+ const resolveCommandReloads = (0, import_react128.useCallback)((completedTrigger) => {
34125
34286
  if (commandReloadResolversRef.current.length === 0) {
34126
34287
  return;
34127
34288
  }
@@ -34135,7 +34296,7 @@ var useSlashCommandProcessor = /* @__PURE__ */ __name((config, settings, history
34135
34296
  }
34136
34297
  commandReloadResolversRef.current = remaining;
34137
34298
  }, []);
34138
- const reloadCommands = (0, import_react129.useCallback)(() => {
34299
+ const reloadCommands = (0, import_react128.useCallback)(() => {
34139
34300
  if (!config) {
34140
34301
  return Promise.resolve();
34141
34302
  }
@@ -34150,14 +34311,14 @@ var useSlashCommandProcessor = /* @__PURE__ */ __name((config, settings, history
34150
34311
  });
34151
34312
  });
34152
34313
  }, [config]);
34153
- const clearPendingExtensionContentRefresh = (0, import_react129.useCallback)(() => {
34314
+ const clearPendingExtensionContentRefresh = (0, import_react128.useCallback)(() => {
34154
34315
  if (!extensionContentRefreshTimerRef.current) {
34155
34316
  return;
34156
34317
  }
34157
34318
  clearTimeout(extensionContentRefreshTimerRef.current);
34158
34319
  extensionContentRefreshTimerRef.current = null;
34159
34320
  }, []);
34160
- const showExtensionContentRefreshError = (0, import_react129.useCallback)(
34321
+ const showExtensionContentRefreshError = (0, import_react128.useCallback)(
34161
34322
  (error) => {
34162
34323
  if (!mountedRef.current) {
34163
34324
  return;
@@ -34177,7 +34338,7 @@ var useSlashCommandProcessor = /* @__PURE__ */ __name((config, settings, history
34177
34338
  },
34178
34339
  [addItem]
34179
34340
  );
34180
- const runExtensionContentRefresh = (0, import_react129.useCallback)(async () => {
34341
+ const runExtensionContentRefresh = (0, import_react128.useCallback)(async () => {
34181
34342
  if (!config) {
34182
34343
  return;
34183
34344
  }
@@ -34221,23 +34382,23 @@ var useSlashCommandProcessor = /* @__PURE__ */ __name((config, settings, history
34221
34382
  reloadCommands,
34222
34383
  showExtensionContentRefreshError
34223
34384
  ]);
34224
- const [shellConfirmationRequest, setShellConfirmationRequest] = (0, import_react129.useState)(null);
34225
- const [confirmationRequest, setConfirmationRequest] = (0, import_react129.useState)(null);
34226
- const [sessionShellAllowlist, setSessionShellAllowlist] = (0, import_react129.useState)(
34385
+ const [shellConfirmationRequest, setShellConfirmationRequest] = (0, import_react128.useState)(null);
34386
+ const [confirmationRequest, setConfirmationRequest] = (0, import_react128.useState)(null);
34387
+ const [sessionShellAllowlist, setSessionShellAllowlist] = (0, import_react128.useState)(
34227
34388
  /* @__PURE__ */ new Set()
34228
34389
  );
34229
- const [pendingItem, setPendingItem] = (0, import_react129.useState)(
34390
+ const [pendingItem, setPendingItem] = (0, import_react128.useState)(
34230
34391
  null
34231
34392
  );
34232
- const [btwItem, setBtwItem] = (0, import_react129.useState)(null);
34233
- const btwAbortControllerRef = (0, import_react129.useRef)(null);
34234
- const cancelBtw = (0, import_react129.useCallback)(() => {
34393
+ const [btwItem, setBtwItem] = (0, import_react128.useState)(null);
34394
+ const btwAbortControllerRef = (0, import_react128.useRef)(null);
34395
+ const cancelBtw = (0, import_react128.useCallback)(() => {
34235
34396
  btwAbortControllerRef.current?.abort();
34236
34397
  btwAbortControllerRef.current = null;
34237
34398
  setBtwItem(null);
34238
34399
  }, []);
34239
- const abortControllerRef = (0, import_react129.useRef)(null);
34240
- const cancelSlashCommand = (0, import_react129.useCallback)(() => {
34400
+ const abortControllerRef = (0, import_react128.useRef)(null);
34401
+ const cancelSlashCommand = (0, import_react128.useCallback)(() => {
34241
34402
  cancelBtw();
34242
34403
  if (!abortControllerRef.current) {
34243
34404
  return;
@@ -34261,14 +34422,14 @@ var useSlashCommandProcessor = /* @__PURE__ */ __name((config, settings, history
34261
34422
  },
34262
34423
  { isActive: isProcessing }
34263
34424
  );
34264
- const pendingHistoryItems = (0, import_react129.useMemo)(() => {
34425
+ const pendingHistoryItems = (0, import_react128.useMemo)(() => {
34265
34426
  const items = [];
34266
34427
  if (pendingItem != null) {
34267
34428
  items.push(pendingItem);
34268
34429
  }
34269
34430
  return items;
34270
34431
  }, [pendingItem]);
34271
- const addMessage = (0, import_react129.useCallback)(
34432
+ const addMessage = (0, import_react128.useCallback)(
34272
34433
  (message) => {
34273
34434
  let historyItemContent;
34274
34435
  if (message.type === "about" /* ABOUT */) {
@@ -34328,7 +34489,7 @@ var useSlashCommandProcessor = /* @__PURE__ */ __name((config, settings, history
34328
34489
  },
34329
34490
  [addItem]
34330
34491
  );
34331
- const commandContext = (0, import_react129.useMemo)(
34492
+ const commandContext = (0, import_react128.useMemo)(
34332
34493
  () => ({
34333
34494
  services: {
34334
34495
  config,
@@ -34400,7 +34561,7 @@ var useSlashCommandProcessor = /* @__PURE__ */ __name((config, settings, history
34400
34561
  activeExtensionRefreshState
34401
34562
  ]
34402
34563
  );
34403
- (0, import_react129.useEffect)(() => {
34564
+ (0, import_react128.useEffect)(() => {
34404
34565
  if (!config) {
34405
34566
  return;
34406
34567
  }
@@ -34418,7 +34579,7 @@ var useSlashCommandProcessor = /* @__PURE__ */ __name((config, settings, history
34418
34579
  })();
34419
34580
  };
34420
34581
  }, [config, reloadCommands]);
34421
- (0, import_react129.useEffect)(() => {
34582
+ (0, import_react128.useEffect)(() => {
34422
34583
  if (!config) {
34423
34584
  return;
34424
34585
  }
@@ -34443,7 +34604,7 @@ var useSlashCommandProcessor = /* @__PURE__ */ __name((config, settings, history
34443
34604
  }
34444
34605
  };
34445
34606
  }, [config, reloadCommands]);
34446
- (0, import_react129.useEffect)(() => {
34607
+ (0, import_react128.useEffect)(() => {
34447
34608
  if (!isConfigInitialized) {
34448
34609
  return;
34449
34610
  }
@@ -34458,7 +34619,7 @@ var useSlashCommandProcessor = /* @__PURE__ */ __name((config, settings, history
34458
34619
  reloadCommands();
34459
34620
  });
34460
34621
  }, [config, isConfigInitialized, reloadCommands]);
34461
- (0, import_react129.useEffect)(() => {
34622
+ (0, import_react128.useEffect)(() => {
34462
34623
  const listener = /* @__PURE__ */ __name((reason) => {
34463
34624
  clearPendingExtensionContentRefresh();
34464
34625
  addItem(
@@ -34485,7 +34646,7 @@ var useSlashCommandProcessor = /* @__PURE__ */ __name((config, settings, history
34485
34646
  addItem,
34486
34647
  clearPendingExtensionContentRefresh
34487
34648
  ]);
34488
- (0, import_react129.useEffect)(() => {
34649
+ (0, import_react128.useEffect)(() => {
34489
34650
  activeExtensionRefreshState.on(
34490
34651
  "extensions-reload-started" /* ExtensionsReloadStarted */,
34491
34652
  clearPendingExtensionContentRefresh
@@ -34505,7 +34666,7 @@ var useSlashCommandProcessor = /* @__PURE__ */ __name((config, settings, history
34505
34666
  );
34506
34667
  };
34507
34668
  }, [activeExtensionRefreshState, clearPendingExtensionContentRefresh]);
34508
- (0, import_react129.useEffect)(() => {
34669
+ (0, import_react128.useEffect)(() => {
34509
34670
  if (!config) {
34510
34671
  return;
34511
34672
  }
@@ -34531,7 +34692,7 @@ var useSlashCommandProcessor = /* @__PURE__ */ __name((config, settings, history
34531
34692
  activeExtensionRefreshState,
34532
34693
  runExtensionContentRefresh
34533
34694
  ]);
34534
- (0, import_react129.useEffect)(() => {
34695
+ (0, import_react128.useEffect)(() => {
34535
34696
  const controller = new AbortController();
34536
34697
  const load = /* @__PURE__ */ __name(async () => {
34537
34698
  try {
@@ -34628,7 +34789,7 @@ var useSlashCommandProcessor = /* @__PURE__ */ __name((config, settings, history
34628
34789
  settings,
34629
34790
  resolveCommandReloads
34630
34791
  ]);
34631
- const handleSlashCommand = (0, import_react129.useCallback)(
34792
+ const handleSlashCommand = (0, import_react128.useCallback)(
34632
34793
  async (rawQuery, oneTimeShellAllowlist, overwriteConfirmed, existingInvocationItemId) => {
34633
34794
  if (typeof rawQuery !== "string") {
34634
34795
  return false;
@@ -35190,11 +35351,11 @@ ${commandToExecute.subCommands.map((sc) => ` - ${sc.name}: ${sc.description ||
35190
35351
 
35191
35352
  // packages/cli/src/ui/hooks/useDoublePress.ts
35192
35353
  init_esbuild_shims();
35193
- var import_react130 = __toESM(require_react(), 1);
35354
+ var import_react129 = __toESM(require_react(), 1);
35194
35355
  var DOUBLE_PRESS_TIMEOUT_MS = 800;
35195
35356
  function useDoublePress(onDoublePress, onPending) {
35196
- const timeoutRef = (0, import_react130.useRef)(null);
35197
- (0, import_react130.useEffect)(
35357
+ const timeoutRef = (0, import_react129.useRef)(null);
35358
+ (0, import_react129.useEffect)(
35198
35359
  () => () => {
35199
35360
  if (timeoutRef.current !== null) {
35200
35361
  clearTimeout(timeoutRef.current);
@@ -35203,7 +35364,7 @@ function useDoublePress(onDoublePress, onPending) {
35203
35364
  },
35204
35365
  []
35205
35366
  );
35206
- return (0, import_react130.useCallback)(() => {
35367
+ return (0, import_react129.useCallback)(() => {
35207
35368
  if (timeoutRef.current !== null) {
35208
35369
  clearTimeout(timeoutRef.current);
35209
35370
  timeoutRef.current = null;
@@ -35267,10 +35428,10 @@ __name(formatSessionWindowTitle, "formatSessionWindowTitle");
35267
35428
 
35268
35429
  // packages/cli/src/ui/hooks/useLogger.ts
35269
35430
  init_esbuild_shims();
35270
- var import_react131 = __toESM(require_react(), 1);
35431
+ var import_react130 = __toESM(require_react(), 1);
35271
35432
  var useLogger = /* @__PURE__ */ __name((storage, sessionId) => {
35272
- const [logger, setLogger] = (0, import_react131.useState)(null);
35273
- (0, import_react131.useEffect)(() => {
35433
+ const [logger, setLogger] = (0, import_react130.useState)(null);
35434
+ (0, import_react130.useEffect)(() => {
35274
35435
  if (!sessionId) {
35275
35436
  return;
35276
35437
  }
@@ -35291,11 +35452,11 @@ var useLogger = /* @__PURE__ */ __name((storage, sessionId) => {
35291
35452
 
35292
35453
  // packages/cli/src/ui/hooks/useGeminiStream.ts
35293
35454
  init_esbuild_shims();
35294
- var import_react136 = __toESM(require_react(), 1);
35455
+ var import_react135 = __toESM(require_react(), 1);
35295
35456
 
35296
35457
  // packages/cli/src/ui/hooks/shellCommandProcessor.ts
35297
35458
  init_esbuild_shims();
35298
- var import_react132 = __toESM(require_react(), 1);
35459
+ var import_react131 = __toESM(require_react(), 1);
35299
35460
  import crypto2 from "node:crypto";
35300
35461
  import path10 from "node:path";
35301
35462
  import os5 from "node:os";
@@ -35328,8 +35489,8 @@ ${modelContent}
35328
35489
  }
35329
35490
  __name(addShellCommandToGeminiHistory, "addShellCommandToGeminiHistory");
35330
35491
  var useShellCommandProcessor = /* @__PURE__ */ __name((addItemToHistory, setPendingHistoryItem, onExec, onDebugMessage, config, geminiClient, setShellInputFocused, terminalWidth, terminalHeight) => {
35331
- const [activeShellPtyId, setActiveShellPtyId] = (0, import_react132.useState)(null);
35332
- const handleShellCommand = (0, import_react132.useCallback)(
35492
+ const [activeShellPtyId, setActiveShellPtyId] = (0, import_react131.useState)(null);
35493
+ const handleShellCommand = (0, import_react131.useCallback)(
35333
35494
  (rawQuery, abortSignal) => {
35334
35495
  if (typeof rawQuery !== "string" || rawQuery.trim() === "") {
35335
35496
  return false;
@@ -35583,11 +35744,11 @@ ${finalOutput}`;
35583
35744
 
35584
35745
  // packages/cli/src/ui/hooks/useStateAndRef.ts
35585
35746
  init_esbuild_shims();
35586
- var import_react133 = __toESM(require_react(), 1);
35747
+ var import_react132 = __toESM(require_react(), 1);
35587
35748
  var useStateAndRef = /* @__PURE__ */ __name((initialValue) => {
35588
- const [state, setState] = import_react133.default.useState(initialValue);
35589
- const ref = import_react133.default.useRef(initialValue);
35590
- const setStateInternal = import_react133.default.useCallback(
35749
+ const [state, setState] = import_react132.default.useState(initialValue);
35750
+ const ref = import_react132.default.useRef(initialValue);
35751
+ const setStateInternal = import_react132.default.useCallback(
35591
35752
  (newStateOrCallback) => {
35592
35753
  let newValue;
35593
35754
  if (typeof newStateOrCallback === "function") {
@@ -35605,12 +35766,12 @@ var useStateAndRef = /* @__PURE__ */ __name((initialValue) => {
35605
35766
 
35606
35767
  // packages/cli/src/ui/hooks/useReactToolScheduler.ts
35607
35768
  init_esbuild_shims();
35608
- var import_react134 = __toESM(require_react(), 1);
35769
+ var import_react133 = __toESM(require_react(), 1);
35609
35770
  import * as path11 from "node:path";
35610
35771
  var debugLogger35 = createDebugLogger("REACT_TOOL_SCHEDULER");
35611
- function useReactToolScheduler(onComplete, config, getPreferredEditor, onEditorClose) {
35612
- const [toolCallsForDisplay, setToolCallsForDisplay] = (0, import_react134.useState)([]);
35613
- const outputUpdateHandler = (0, import_react134.useCallback)(
35772
+ function useReactToolScheduler(onComplete, config, getPreferredEditor, onEditorClose, onToolResultFullTurnModel) {
35773
+ const [toolCallsForDisplay, setToolCallsForDisplay] = (0, import_react133.useState)([]);
35774
+ const outputUpdateHandler = (0, import_react133.useCallback)(
35614
35775
  (toolCallId, outputChunk) => {
35615
35776
  if (isShellProgressData(outputChunk)) {
35616
35777
  return;
@@ -35628,13 +35789,13 @@ function useReactToolScheduler(onComplete, config, getPreferredEditor, onEditorC
35628
35789
  },
35629
35790
  []
35630
35791
  );
35631
- const allToolCallsCompleteHandler = (0, import_react134.useCallback)(
35792
+ const allToolCallsCompleteHandler = (0, import_react133.useCallback)(
35632
35793
  async (completedToolCalls) => {
35633
35794
  await onComplete(completedToolCalls);
35634
35795
  },
35635
35796
  [onComplete]
35636
35797
  );
35637
- const toolCallsUpdateHandler = (0, import_react134.useCallback)(
35798
+ const toolCallsUpdateHandler = (0, import_react133.useCallback)(
35638
35799
  (updatedCoreToolCalls) => {
35639
35800
  setToolCallsForDisplay(
35640
35801
  (prevTrackedCalls) => updatedCoreToolCalls.map((coreTc) => {
@@ -35661,14 +35822,15 @@ function useReactToolScheduler(onComplete, config, getPreferredEditor, onEditorC
35661
35822
  },
35662
35823
  [setToolCallsForDisplay]
35663
35824
  );
35664
- const scheduler = (0, import_react134.useMemo)(
35825
+ const scheduler = (0, import_react133.useMemo)(
35665
35826
  () => new CoreToolScheduler({
35666
35827
  config,
35667
35828
  outputUpdateHandler,
35668
35829
  onAllToolCallsComplete: allToolCallsCompleteHandler,
35669
35830
  onToolCallsUpdate: toolCallsUpdateHandler,
35670
35831
  getPreferredEditor,
35671
- onEditorClose
35832
+ onEditorClose,
35833
+ onToolResultFullTurnModel
35672
35834
  }),
35673
35835
  [
35674
35836
  config,
@@ -35676,10 +35838,11 @@ function useReactToolScheduler(onComplete, config, getPreferredEditor, onEditorC
35676
35838
  allToolCallsCompleteHandler,
35677
35839
  toolCallsUpdateHandler,
35678
35840
  getPreferredEditor,
35679
- onEditorClose
35841
+ onEditorClose,
35842
+ onToolResultFullTurnModel
35680
35843
  ]
35681
35844
  );
35682
- const schedule = (0, import_react134.useCallback)(
35845
+ const schedule = (0, import_react133.useCallback)(
35683
35846
  (request, signal, modelOverride) => {
35684
35847
  if (!modelOverride?.endsWith("\0")) {
35685
35848
  void scheduler.schedule(request, signal);
@@ -35728,7 +35891,7 @@ function useReactToolScheduler(onComplete, config, getPreferredEditor, onEditorC
35728
35891
  },
35729
35892
  [allToolCallsCompleteHandler, config, scheduler]
35730
35893
  );
35731
- const markToolsAsSubmitted = (0, import_react134.useCallback)(
35894
+ const markToolsAsSubmitted = (0, import_react133.useCallback)(
35732
35895
  (callIdsToMark) => {
35733
35896
  setToolCallsForDisplay(
35734
35897
  (prevCalls) => prevCalls.map(
@@ -35811,6 +35974,9 @@ function mapToDisplay(toolOrTools, projectRoot) {
35811
35974
  resultDisplay: compactToolResultDisplayForHistory(
35812
35975
  trackedCall.response.resultDisplay
35813
35976
  ),
35977
+ ...trackedCall.response.visionBridgeNotice !== void 0 ? {
35978
+ visionBridgeNotice: trackedCall.response.visionBridgeNotice
35979
+ } : {},
35814
35980
  // Full detail for the Ctrl+O transcript (§4.9): derived from the
35815
35981
  // already-persisted functionResponse parts; NOT char-capped (the
35816
35982
  // bound is whatever core already applied). Consumed ONLY by the
@@ -35830,6 +35996,9 @@ function mapToDisplay(toolOrTools, projectRoot) {
35830
35996
  resultDisplay: compactToolResultDisplayForHistory(
35831
35997
  trackedCall.response.resultDisplay
35832
35998
  ),
35999
+ ...trackedCall.response.visionBridgeNotice !== void 0 ? {
36000
+ visionBridgeNotice: trackedCall.response.visionBridgeNotice
36001
+ } : {},
35833
36002
  confirmationDetails: void 0
35834
36003
  };
35835
36004
  case "cancelled":
@@ -35839,6 +36008,9 @@ function mapToDisplay(toolOrTools, projectRoot) {
35839
36008
  resultDisplay: compactToolResultDisplayForHistory(
35840
36009
  trackedCall.response.resultDisplay
35841
36010
  ),
36011
+ ...trackedCall.response.visionBridgeNotice !== void 0 ? {
36012
+ visionBridgeNotice: trackedCall.response.visionBridgeNotice
36013
+ } : {},
35842
36014
  confirmationDetails: void 0
35843
36015
  };
35844
36016
  case "awaiting_approval":
@@ -35893,74 +36065,90 @@ __name(mapToDisplay, "mapToDisplay");
35893
36065
  // packages/cli/src/ui/hooks/useGeminiStream.ts
35894
36066
  import { promises as fs17 } from "node:fs";
35895
36067
  import path12 from "node:path";
35896
- import process14 from "node:process";
36068
+ import process15 from "node:process";
35897
36069
 
35898
36070
  // packages/cli/src/ui/hooks/useMessageQueue.ts
35899
36071
  init_esbuild_shims();
35900
- var import_react135 = __toESM(require_react(), 1);
36072
+ var import_react134 = __toESM(require_react(), 1);
35901
36073
  var GOAL_COMMAND_RE = /^\/goal(?:\s|$)/;
36074
+ function aggregateMessages(messages) {
36075
+ const modelText = messages.map((message) => message.modelText).join("\n\n");
36076
+ const submittedPrompts = messages.map((message) => message.submittedPrompt);
36077
+ return submittedPrompts.every(
36078
+ (submittedPrompt) => submittedPrompt !== void 0
36079
+ ) ? { modelText, submittedPrompt: submittedPrompts.join("\n\n") } : { modelText };
36080
+ }
36081
+ __name(aggregateMessages, "aggregateMessages");
35902
36082
  function useMessageQueue() {
35903
- const [queuedMessages, setQueuedMessages] = (0, import_react135.useState)([]);
35904
- const queueRef = (0, import_react135.useRef)([]);
35905
- const addMessage = (0, import_react135.useCallback)((message, deferUntilIdle = false) => {
35906
- const trimmedMessage = message.trim();
35907
- if (trimmedMessage.length > 0) {
35908
- queueRef.current = [
35909
- ...queueRef.current,
35910
- { text: trimmedMessage, deferUntilIdle }
35911
- ];
35912
- setQueuedMessages(queueRef.current);
35913
- }
35914
- }, []);
35915
- const clearQueue = (0, import_react135.useCallback)(() => {
36083
+ const [queuedMessages, setQueuedMessages] = (0, import_react134.useState)([]);
36084
+ const queueRef = (0, import_react134.useRef)([]);
36085
+ const addMessage = (0, import_react134.useCallback)(
36086
+ (message, deferUntilIdle = false, submittedPrompt) => {
36087
+ const modelText = message.trim();
36088
+ if (modelText.length > 0) {
36089
+ queueRef.current = [
36090
+ ...queueRef.current,
36091
+ { modelText, deferUntilIdle, submittedPrompt }
36092
+ ];
36093
+ setQueuedMessages(queueRef.current);
36094
+ }
36095
+ },
36096
+ []
36097
+ );
36098
+ const clearQueue = (0, import_react134.useCallback)(() => {
35916
36099
  queueRef.current = [];
35917
36100
  setQueuedMessages([]);
35918
36101
  }, []);
35919
- const getQueuedMessagesText = (0, import_react135.useCallback)(() => {
36102
+ const getQueuedMessagesText = (0, import_react134.useCallback)(() => {
35920
36103
  if (queuedMessages.length === 0) return "";
35921
- return queuedMessages.map(({ text }) => text).join("\n\n");
36104
+ return queuedMessages.map(({ modelText }) => modelText).join("\n\n");
35922
36105
  }, [queuedMessages]);
35923
- const popAllMessages = (0, import_react135.useCallback)(() => {
36106
+ const popAllMessages = (0, import_react134.useCallback)(() => {
35924
36107
  const current = queueRef.current;
35925
36108
  if (current.length === 0) return null;
35926
36109
  queueRef.current = [];
35927
36110
  setQueuedMessages([]);
35928
- return current.map(({ text }) => text).join("\n\n");
36111
+ return aggregateMessages(current);
35929
36112
  }, []);
35930
- const restoreMessages = (0, import_react135.useCallback)((messages) => {
35931
- const restored = messages.map((text) => text.trim()).filter(Boolean).map((text) => ({ text, deferUntilIdle: false }));
36113
+ const restoreMessages = (0, import_react134.useCallback)((messages) => {
36114
+ const restored = messages.map((text) => text.trim()).filter(Boolean).map((modelText) => ({ modelText, deferUntilIdle: false }));
35932
36115
  if (restored.length === 0) return;
35933
36116
  queueRef.current = [...restored, ...queueRef.current];
35934
36117
  setQueuedMessages(queueRef.current);
35935
36118
  }, []);
35936
- const drainQueue = (0, import_react135.useCallback)((includeDeferred = false) => {
36119
+ const drainQueue = (0, import_react134.useCallback)((includeDeferred = false) => {
35937
36120
  const current = queueRef.current;
35938
36121
  if (current.length === 0) return [];
35939
- const shouldDrain = /* @__PURE__ */ __name((message) => (!isSlashCommand(message.text) || !includeDeferred && GOAL_COMMAND_RE.test(message.text)) && (includeDeferred || !message.deferUntilIdle), "shouldDrain");
36122
+ const shouldDrain = /* @__PURE__ */ __name((message) => (!isSlashCommand(message.modelText) || !includeDeferred && GOAL_COMMAND_RE.test(message.modelText)) && (includeDeferred || !message.deferUntilIdle), "shouldDrain");
35940
36123
  const drained = current.filter(shouldDrain);
35941
36124
  if (drained.length === 0) return [];
35942
36125
  const rest = current.filter((message) => !shouldDrain(message));
35943
36126
  queueRef.current = rest;
35944
36127
  setQueuedMessages(rest);
35945
- return drained.map(({ text }) => text);
36128
+ return drained.map(({ modelText }) => modelText);
35946
36129
  }, []);
35947
- const popNextSegment = (0, import_react135.useCallback)(() => {
36130
+ const popNextTurn = (0, import_react134.useCallback)(() => {
35948
36131
  const current = queueRef.current;
35949
36132
  if (current.length === 0) return null;
35950
- const [head, ...rest] = current;
36133
+ const plainMessages = current.filter(
36134
+ (message) => !isSlashCommand(message.modelText)
36135
+ );
36136
+ const messages = plainMessages.length > 0 ? plainMessages : [current[0]];
36137
+ const selected = new Set(messages);
36138
+ const rest = current.filter((message) => !selected.has(message));
35951
36139
  queueRef.current = rest;
35952
36140
  setQueuedMessages(rest);
35953
- return head.text;
36141
+ return aggregateMessages(messages);
35954
36142
  }, []);
35955
36143
  return {
35956
- messageQueue: queuedMessages.map(({ text }) => text),
36144
+ messageQueue: queuedMessages.map(({ modelText }) => modelText),
35957
36145
  addMessage,
35958
36146
  clearQueue,
35959
36147
  getQueuedMessagesText,
35960
36148
  popAllMessages,
35961
36149
  restoreMessages,
35962
36150
  drainQueue,
35963
- popNextSegment
36151
+ popNextTurn
35964
36152
  };
35965
36153
  }
35966
36154
  __name(useMessageQueue, "useMessageQueue");
@@ -36108,16 +36296,17 @@ function charIndexAfterLine(text, keptLines) {
36108
36296
  }
36109
36297
  __name(charIndexAfterLine, "charIndexAfterLine");
36110
36298
  var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, config, isConfigInitialized, settings, onDebugMessage, handleSlashCommand, shellModeActive, getPreferredEditor, onAuthError, performMemoryRefresh, modelSwitchedFromQuotaError, setModelSwitchedFromQuotaError, onEditorClose, onCancelSubmit, setShellInputFocused, terminalWidth, terminalHeight, midTurnDrainRef, logger, availableTerminalHeightRef, terminalWidthRef, midTurnRestoreRef) => {
36111
- const [initError, setInitError] = (0, import_react136.useState)(null);
36112
- const abortControllerRef = (0, import_react136.useRef)(null);
36113
- const flushBufferedStreamEventsRef = (0, import_react136.useRef)(/* @__PURE__ */ new Set());
36114
- const turnCancelledRef = (0, import_react136.useRef)(false);
36115
- const isSubmittingQueryRef = (0, import_react136.useRef)(false);
36116
- const lastPromptRef = (0, import_react136.useRef)(null);
36117
- const lastTurnUserItemRef = (0, import_react136.useRef)(null);
36118
- const turnSawContentEventRef = (0, import_react136.useRef)(false);
36119
- const lastPromptErroredRef = (0, import_react136.useRef)(false);
36120
- const commitItem = (0, import_react136.useCallback)(
36299
+ const [initError, setInitError] = (0, import_react135.useState)(null);
36300
+ const abortControllerRef = (0, import_react135.useRef)(null);
36301
+ const flushBufferedStreamEventsRef = (0, import_react135.useRef)(/* @__PURE__ */ new Set());
36302
+ const turnCancelledRef = (0, import_react135.useRef)(false);
36303
+ const isSubmittingQueryRef = (0, import_react135.useRef)(false);
36304
+ const lastPromptRef = (0, import_react135.useRef)(null);
36305
+ const lastTurnUserItemRef = (0, import_react135.useRef)(null);
36306
+ const canUndoLastLoggedUserMessageRef = (0, import_react135.useRef)(false);
36307
+ const turnSawContentEventRef = (0, import_react135.useRef)(false);
36308
+ const lastPromptErroredRef = (0, import_react135.useRef)(false);
36309
+ const commitItem = (0, import_react135.useCallback)(
36121
36310
  (item, userMessageTimestamp) => {
36122
36311
  if (item.type === "gemini" && !item.timestamp) {
36123
36312
  item.timestamp = Date.now();
@@ -36127,17 +36316,17 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
36127
36316
  [addItem]
36128
36317
  );
36129
36318
  const dualOutput = useDualOutput();
36130
- const [isResponding, setIsResponding] = (0, import_react136.useState)(false);
36131
- const activeModelStreamsRef = (0, import_react136.useRef)(0);
36132
- const [thought, setThought] = (0, import_react136.useState)(null);
36133
- const historyRef = (0, import_react136.useRef)(history);
36134
- (0, import_react136.useLayoutEffect)(() => {
36319
+ const [isResponding, setIsResponding] = (0, import_react135.useState)(false);
36320
+ const activeModelStreamsRef = (0, import_react135.useRef)(0);
36321
+ const [thought, setThought] = (0, import_react135.useState)(null);
36322
+ const historyRef = (0, import_react135.useRef)(history);
36323
+ (0, import_react135.useLayoutEffect)(() => {
36135
36324
  historyRef.current = history;
36136
36325
  }, [history]);
36137
- const auxiliaryAbortRefsRef = (0, import_react136.useRef)(/* @__PURE__ */ new Set());
36326
+ const auxiliaryAbortRefsRef = (0, import_react135.useRef)(/* @__PURE__ */ new Set());
36138
36327
  const [pendingHistoryItem, pendingHistoryItemRef, setPendingHistoryItem] = useStateAndRef(null);
36139
36328
  const [pendingThoughtItem, pendingThoughtItemRef, setPendingThoughtItem] = useStateAndRef(null);
36140
- const thoughtStartTimeRef = (0, import_react136.useRef)(null);
36329
+ const thoughtStartTimeRef = (0, import_react135.useRef)(null);
36141
36330
  const [
36142
36331
  pendingRetryErrorItem,
36143
36332
  pendingRetryErrorItemRef,
@@ -36148,21 +36337,25 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
36148
36337
  pendingRetryCountdownItemRef,
36149
36338
  setPendingRetryCountdownItem
36150
36339
  ] = useStateAndRef(null);
36151
- const retryCountdownTimerRef = (0, import_react136.useRef)(
36340
+ const retryCountdownTimerRef = (0, import_react135.useRef)(
36152
36341
  null
36153
36342
  );
36154
- const processedMemoryToolsRef = (0, import_react136.useRef)(/* @__PURE__ */ new Set());
36155
- const submitPromptOnCompleteRef = (0, import_react136.useRef)(null);
36156
- const modelOverrideRef = (0, import_react136.useRef)(void 0);
36157
- const inlineModelOverrideActiveRef = (0, import_react136.useRef)(false);
36158
- const handledProviderToolCallIdsRef = (0, import_react136.useRef)(/* @__PURE__ */ new Set());
36159
- const duplicateProviderToolCallResponseIdsRef = (0, import_react136.useRef)(
36343
+ const processedMemoryToolsRef = (0, import_react135.useRef)(/* @__PURE__ */ new Set());
36344
+ const submitPromptOnCompleteRef = (0, import_react135.useRef)(null);
36345
+ const modelOverrideRef = (0, import_react135.useRef)(void 0);
36346
+ const inlineModelOverrideActiveRef = (0, import_react135.useRef)(false);
36347
+ const canUseToolResultFullTurnModel = (0, import_react135.useCallback)((model) => {
36348
+ const current = modelOverrideRef.current;
36349
+ return !inlineModelOverrideActiveRef.current && (!current?.endsWith("\0") || current === model);
36350
+ }, []);
36351
+ const handledProviderToolCallIdsRef = (0, import_react135.useRef)(/* @__PURE__ */ new Set());
36352
+ const duplicateProviderToolCallResponseIdsRef = (0, import_react135.useRef)(
36160
36353
  /* @__PURE__ */ new Set()
36161
36354
  );
36162
- const pendingDuplicateToolResponsesRef = (0, import_react136.useRef)([]);
36163
- const immediateDuplicateToolResponsesRef = (0, import_react136.useRef)(null);
36164
- const streamingResponseLengthRef = (0, import_react136.useRef)(0);
36165
- const [isReceivingContent, setIsReceivingContent] = (0, import_react136.useState)(false);
36355
+ const pendingDuplicateToolResponsesRef = (0, import_react135.useRef)([]);
36356
+ const immediateDuplicateToolResponsesRef = (0, import_react135.useRef)(null);
36357
+ const streamingResponseLengthRef = (0, import_react135.useRef)(0);
36358
+ const [isReceivingContent, setIsReceivingContent] = (0, import_react135.useState)(false);
36166
36359
  const {
36167
36360
  startNewPrompt,
36168
36361
  getPromptCount,
@@ -36185,13 +36378,14 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
36185
36378
  },
36186
36379
  config,
36187
36380
  getPreferredEditor,
36188
- onEditorClose
36381
+ onEditorClose,
36382
+ canUseToolResultFullTurnModel
36189
36383
  );
36190
- const pendingToolCallGroupDisplay = (0, import_react136.useMemo)(
36384
+ const pendingToolCallGroupDisplay = (0, import_react135.useMemo)(
36191
36385
  () => toolCalls.length ? mapToDisplay(toolCalls, config.getProjectRoot()) : void 0,
36192
36386
  [toolCalls, config]
36193
36387
  );
36194
- const activeToolPtyId = (0, import_react136.useMemo)(() => {
36388
+ const activeToolPtyId = (0, import_react135.useMemo)(() => {
36195
36389
  const executingShellTool = toolCalls?.find(
36196
36390
  (tc) => tc.status === "executing" && tc.request.name === "run_shell_command"
36197
36391
  );
@@ -36200,18 +36394,18 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
36200
36394
  }
36201
36395
  return void 0;
36202
36396
  }, [toolCalls]);
36203
- const loopDetectedRef = (0, import_react136.useRef)(false);
36397
+ const loopDetectedRef = (0, import_react135.useRef)(false);
36204
36398
  const [
36205
36399
  loopDetectionConfirmationRequest,
36206
36400
  setLoopDetectionConfirmationRequest
36207
- ] = (0, import_react136.useState)(null);
36208
- const stopRetryCountdownTimer = (0, import_react136.useCallback)(() => {
36401
+ ] = (0, import_react135.useState)(null);
36402
+ const stopRetryCountdownTimer = (0, import_react135.useCallback)(() => {
36209
36403
  if (retryCountdownTimerRef.current) {
36210
36404
  clearInterval(retryCountdownTimerRef.current);
36211
36405
  retryCountdownTimerRef.current = null;
36212
36406
  }
36213
36407
  }, []);
36214
- const clearRetryCountdown = (0, import_react136.useCallback)(() => {
36408
+ const clearRetryCountdown = (0, import_react135.useCallback)(() => {
36215
36409
  stopRetryCountdownTimer();
36216
36410
  skipRetryDelayRef.current = null;
36217
36411
  setPendingRetryErrorItem(null);
@@ -36221,8 +36415,8 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
36221
36415
  setPendingRetryCountdownItem,
36222
36416
  stopRetryCountdownTimer
36223
36417
  ]);
36224
- const skipRetryDelayRef = (0, import_react136.useRef)(null);
36225
- const startRetryCountdown = (0, import_react136.useCallback)(
36418
+ const skipRetryDelayRef = (0, import_react135.useRef)(null);
36419
+ const startRetryCountdown = (0, import_react135.useCallback)(
36226
36420
  (retryInfo) => {
36227
36421
  stopRetryCountdownTimer();
36228
36422
  skipRetryDelayRef.current = retryInfo.skipDelay;
@@ -36263,8 +36457,8 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
36263
36457
  stopRetryCountdownTimer
36264
36458
  ]
36265
36459
  );
36266
- (0, import_react136.useEffect)(() => () => stopRetryCountdownTimer(), [stopRetryCountdownTimer]);
36267
- const onExec = (0, import_react136.useCallback)(async (done) => {
36460
+ (0, import_react135.useEffect)(() => () => stopRetryCountdownTimer(), [stopRetryCountdownTimer]);
36461
+ const onExec = (0, import_react135.useCallback)(async (done) => {
36268
36462
  setIsResponding(true);
36269
36463
  await done;
36270
36464
  setIsResponding(false);
@@ -36281,12 +36475,12 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
36281
36475
  terminalHeight
36282
36476
  );
36283
36477
  const activePtyId = activeShellPtyId || activeToolPtyId;
36284
- (0, import_react136.useEffect)(() => {
36478
+ (0, import_react135.useEffect)(() => {
36285
36479
  if (!activePtyId) {
36286
36480
  setShellInputFocused(false);
36287
36481
  }
36288
36482
  }, [activePtyId, setShellInputFocused]);
36289
- const streamingState = (0, import_react136.useMemo)(() => {
36483
+ const streamingState = (0, import_react135.useMemo)(() => {
36290
36484
  if (toolCalls.some((tc) => tc.status === "awaiting_approval")) {
36291
36485
  return "waiting_for_confirmation" /* WaitingForConfirmation */;
36292
36486
  }
@@ -36304,7 +36498,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
36304
36498
  }
36305
36499
  return "idle" /* Idle */;
36306
36500
  }, [isResponding, toolCalls]);
36307
- (0, import_react136.useEffect)(() => {
36501
+ (0, import_react135.useEffect)(() => {
36308
36502
  if (config.getApprovalMode() === "yolo" /* YOLO */ && streamingState === "idle" /* Idle */) {
36309
36503
  const lastUserMessageIndex = findLastUserItemIndex(history);
36310
36504
  const turnCount = lastUserMessageIndex === -1 ? 0 : history.length - lastUserMessageIndex;
@@ -36316,7 +36510,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
36316
36510
  }
36317
36511
  }
36318
36512
  }, [streamingState, config, history]);
36319
- const cancelOngoingRequest = (0, import_react136.useCallback)(() => {
36513
+ const cancelOngoingRequest = (0, import_react135.useCallback)(() => {
36320
36514
  if (streamingState !== "responding" /* Responding */) {
36321
36515
  return;
36322
36516
  }
@@ -36369,6 +36563,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
36369
36563
  onCancelSubmit({
36370
36564
  pendingItem: pendingItemAtCancel,
36371
36565
  lastTurnUserItem: lastTurnUserItemRef.current,
36566
+ canUndoLastLoggedUserMessage: canUndoLastLoggedUserMessageRef.current,
36372
36567
  turnProducedMeaningfulContent: turnSawContentEventRef.current
36373
36568
  });
36374
36569
  } finally {
@@ -36387,7 +36582,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
36387
36582
  config,
36388
36583
  getPromptCount
36389
36584
  ]);
36390
- const applyVisionBridgeIfNeeded = (0, import_react136.useCallback)(
36585
+ const applyVisionBridgeIfNeeded = (0, import_react135.useCallback)(
36391
36586
  async (parts, timestamp, signal) => {
36392
36587
  if (parts === null || !hasImageParts(parts)) {
36393
36588
  return { parts, shouldProceed: true };
@@ -36452,15 +36647,17 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
36452
36647
  },
36453
36648
  [addItem, config]
36454
36649
  );
36455
- const prepareQueryForGemini = (0, import_react136.useCallback)(
36456
- async (query, userMessageTimestamp, abortSignal, prompt_id, submitType) => {
36650
+ const prepareQueryForGemini = (0, import_react135.useCallback)(
36651
+ async (query, userMessageTimestamp, abortSignal, prompt_id, submitType, submittedPrompt, preserveTurnOwnership) => {
36457
36652
  if (turnCancelledRef.current) {
36458
36653
  return { queryToSend: null, shouldProceed: false };
36459
36654
  }
36460
36655
  if (typeof query === "string" && query.trim().length === 0) {
36461
36656
  return { queryToSend: null, shouldProceed: false };
36462
36657
  }
36463
- lastTurnUserItemRef.current = null;
36658
+ if (!preserveTurnOwnership) {
36659
+ lastTurnUserItemRef.current = null;
36660
+ }
36464
36661
  let localQueryToSendToGemini = null;
36465
36662
  if (typeof query === "string") {
36466
36663
  const trimmedQuery = query.trim();
@@ -36478,6 +36675,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
36478
36675
  }
36479
36676
  onDebugMessage(`Received user query (${trimmedQuery.length} chars)`);
36480
36677
  await logger?.logMessage("user" /* USER */, trimmedQuery);
36678
+ canUndoLastLoggedUserMessageRef.current = !preserveTurnOwnership && logger != null;
36481
36679
  const slashCommandResult = isSlashCommand(trimmedQuery) ? await handleSlashCommand(trimmedQuery) : false;
36482
36680
  if (slashCommandResult) {
36483
36681
  switch (slashCommandResult.type) {
@@ -36551,10 +36749,13 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
36551
36749
  },
36552
36750
  userMessageTimestamp
36553
36751
  );
36554
- lastTurnUserItemRef.current = {
36555
- id: insertedId,
36556
- text: trimmedQuery
36557
- };
36752
+ if (!preserveTurnOwnership) {
36753
+ lastTurnUserItemRef.current = {
36754
+ id: insertedId,
36755
+ text: trimmedQuery,
36756
+ ...submittedPrompt === void 0 ? {} : { submittedPrompt }
36757
+ };
36758
+ }
36558
36759
  await new Promise((r) => setImmediate(r));
36559
36760
  }
36560
36761
  if (isAtCommand(trimmedQuery)) {
@@ -36603,7 +36804,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
36603
36804
  applyVisionBridgeIfNeeded
36604
36805
  ]
36605
36806
  );
36606
- const handleContentEvent = (0, import_react136.useCallback)(
36807
+ const handleContentEvent = (0, import_react135.useCallback)(
36607
36808
  (eventValue, currentGeminiMessageBuffer, userMessageTimestamp) => {
36608
36809
  if (turnCancelledRef.current) {
36609
36810
  return "";
@@ -36728,7 +36929,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
36728
36929
  terminalWidthRef
36729
36930
  ]
36730
36931
  );
36731
- const mergeThought = (0, import_react136.useCallback)(
36932
+ const mergeThought = (0, import_react135.useCallback)(
36732
36933
  (incoming) => {
36733
36934
  setThought((prev) => {
36734
36935
  const incomingDescription = incoming.description ? clampLoadingThoughtDescription(incoming.description) : incoming.description;
@@ -36757,7 +36958,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
36757
36958
  },
36758
36959
  [setThought]
36759
36960
  );
36760
- const handleThoughtEvent = (0, import_react136.useCallback)(
36961
+ const handleThoughtEvent = (0, import_react135.useCallback)(
36761
36962
  (eventValue, currentThoughtBuffer, userMessageTimestamp) => {
36762
36963
  if (turnCancelledRef.current) {
36763
36964
  return "";
@@ -36819,7 +37020,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
36819
37020
  },
36820
37021
  [addItem, mergeThought, pendingThoughtItemRef, setPendingThoughtItem]
36821
37022
  );
36822
- const commitPendingThought = (0, import_react136.useCallback)(
37023
+ const commitPendingThought = (0, import_react135.useCallback)(
36823
37024
  (userMessageTimestamp) => {
36824
37025
  if (pendingThoughtItemRef.current) {
36825
37026
  const item = { ...pendingThoughtItemRef.current };
@@ -36833,7 +37034,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
36833
37034
  },
36834
37035
  [addItem, pendingThoughtItemRef, setPendingThoughtItem]
36835
37036
  );
36836
- const handleUserCancelledEvent = (0, import_react136.useCallback)(
37037
+ const handleUserCancelledEvent = (0, import_react135.useCallback)(
36837
37038
  (userMessageTimestamp) => {
36838
37039
  if (turnCancelledRef.current) {
36839
37040
  return;
@@ -36873,7 +37074,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
36873
37074
  clearRetryCountdown
36874
37075
  ]
36875
37076
  );
36876
- const handleErrorEvent = (0, import_react136.useCallback)(
37077
+ const handleErrorEvent = (0, import_react135.useCallback)(
36877
37078
  (eventValue, userMessageTimestamp) => {
36878
37079
  lastPromptErroredRef.current = true;
36879
37080
  commitPendingThought(userMessageTimestamp);
@@ -36916,7 +37117,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
36916
37117
  clearRetryCountdown
36917
37118
  ]
36918
37119
  );
36919
- const handleCitationEvent = (0, import_react136.useCallback)(
37120
+ const handleCitationEvent = (0, import_react135.useCallback)(
36920
37121
  (text, userMessageTimestamp) => {
36921
37122
  if (!showCitations(settings)) {
36922
37123
  return;
@@ -36935,7 +37136,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
36935
37136
  settings
36936
37137
  ]
36937
37138
  );
36938
- const handleFinishedEvent = (0, import_react136.useCallback)(
37139
+ const handleFinishedEvent = (0, import_react135.useCallback)(
36939
37140
  (event, userMessageTimestamp) => {
36940
37141
  const finishReason = event.value.reason;
36941
37142
  if (!finishReason) {
@@ -36976,8 +37177,8 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
36976
37177
  },
36977
37178
  [addItem, clearRetryCountdown]
36978
37179
  );
36979
- const autonomousLoopTickResolverRef = (0, import_react136.useRef)(null);
36980
- const handleChatCompressionEvent = (0, import_react136.useCallback)(
37180
+ const autonomousLoopTickResolverRef = (0, import_react135.useRef)(null);
37181
+ const handleChatCompressionEvent = (0, import_react135.useCallback)(
36981
37182
  (eventValue, userMessageTimestamp) => {
36982
37183
  autonomousLoopTickResolverRef.current?.resetCache();
36983
37184
  if (pendingHistoryItemRef.current) {
@@ -36996,7 +37197,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
36996
37197
  },
36997
37198
  [addItem, commitItem, config, pendingHistoryItemRef, setPendingHistoryItem]
36998
37199
  );
36999
- const handleMaxSessionTurnsEvent = (0, import_react136.useCallback)(
37200
+ const handleMaxSessionTurnsEvent = (0, import_react135.useCallback)(
37000
37201
  () => addItem(
37001
37202
  {
37002
37203
  type: "info",
@@ -37006,7 +37207,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
37006
37207
  ),
37007
37208
  [addItem, config]
37008
37209
  );
37009
- const handleSessionTokenLimitExceededEvent = (0, import_react136.useCallback)(
37210
+ const handleSessionTokenLimitExceededEvent = (0, import_react135.useCallback)(
37010
37211
  (value) => addItem(
37011
37212
  {
37012
37213
  type: "error",
@@ -37021,7 +37222,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
37021
37222
  ),
37022
37223
  [addItem]
37023
37224
  );
37024
- const handleLoopDetectionConfirmation = (0, import_react136.useCallback)(
37225
+ const handleLoopDetectionConfirmation = (0, import_react135.useCallback)(
37025
37226
  (result) => {
37026
37227
  setLoopDetectionConfirmationRequest(null);
37027
37228
  if (result.userSelection === "disable") {
@@ -37045,12 +37246,12 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
37045
37246
  },
37046
37247
  [config, addItem]
37047
37248
  );
37048
- const handleLoopDetectedEvent = (0, import_react136.useCallback)(() => {
37249
+ const handleLoopDetectedEvent = (0, import_react135.useCallback)(() => {
37049
37250
  setLoopDetectionConfirmationRequest({
37050
37251
  onComplete: handleLoopDetectionConfirmation
37051
37252
  });
37052
37253
  }, [handleLoopDetectionConfirmation]);
37053
- const handleUserPromptSubmitBlockedEvent = (0, import_react136.useCallback)(
37254
+ const handleUserPromptSubmitBlockedEvent = (0, import_react135.useCallback)(
37054
37255
  (value, userMessageTimestamp) => {
37055
37256
  if (pendingHistoryItemRef.current) {
37056
37257
  commitItem(pendingHistoryItemRef.current, userMessageTimestamp);
@@ -37067,7 +37268,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
37067
37268
  },
37068
37269
  [addItem, commitItem, pendingHistoryItemRef, setPendingHistoryItem]
37069
37270
  );
37070
- const handleStopHookLoopEvent = (0, import_react136.useCallback)(
37271
+ const handleStopHookLoopEvent = (0, import_react135.useCallback)(
37071
37272
  (value, userMessageTimestamp) => {
37072
37273
  if (pendingHistoryItemRef.current) {
37073
37274
  commitItem(pendingHistoryItemRef.current, userMessageTimestamp);
@@ -37101,7 +37302,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
37101
37302
  },
37102
37303
  [addItem, commitItem, config, pendingHistoryItemRef, setPendingHistoryItem]
37103
37304
  );
37104
- const handleActiveGoalEvent = (0, import_react136.useCallback)(
37305
+ const handleActiveGoalEvent = (0, import_react135.useCallback)(
37105
37306
  (activeGoal) => {
37106
37307
  const sessionId = config.getSessionId();
37107
37308
  const currentActiveGoal = getActiveGoal(sessionId);
@@ -37119,7 +37320,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
37119
37320
  },
37120
37321
  [config]
37121
37322
  );
37122
- const processGeminiStreamEvents = (0, import_react136.useCallback)(
37323
+ const processGeminiStreamEvents = (0, import_react135.useCallback)(
37123
37324
  async (stream, userMessageTimestamp, signal) => {
37124
37325
  let geminiMessageBuffer = "";
37125
37326
  let thoughtBuffer = "";
@@ -37347,6 +37548,8 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
37347
37548
  case "active_goal" /* ActiveGoal */:
37348
37549
  handleActiveGoalEvent(event.value);
37349
37550
  break;
37551
+ case "goal_state" /* GoalState */:
37552
+ break;
37350
37553
  default: {
37351
37554
  const unreachable = event;
37352
37555
  return unreachable;
@@ -37459,7 +37662,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
37459
37662
  dualOutput
37460
37663
  ]
37461
37664
  );
37462
- const resolveSteeredMessages = (0, import_react136.useCallback)(
37665
+ const resolveSteeredMessages = (0, import_react135.useCallback)(
37463
37666
  async (messages, signal) => {
37464
37667
  const resolvedSegments = [];
37465
37668
  const resolvedForRecording = [];
@@ -37628,7 +37831,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
37628
37831
  onDebugMessage
37629
37832
  ]
37630
37833
  );
37631
- const resolveDrainedSteerMessages = (0, import_react136.useCallback)(
37834
+ const resolveDrainedSteerMessages = (0, import_react135.useCallback)(
37632
37835
  async (messages, signal) => {
37633
37836
  try {
37634
37837
  const resolved = await resolveSteeredMessages(messages, signal);
@@ -37665,7 +37868,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
37665
37868
  },
37666
37869
  [midTurnRestoreRef, onDebugMessage, resolveSteeredMessages]
37667
37870
  );
37668
- const drainSteerAtBoundary = (0, import_react136.useCallback)(
37871
+ const drainSteerAtBoundary = (0, import_react135.useCallback)(
37669
37872
  async (signal) => {
37670
37873
  const messages = midTurnDrainRef?.current?.() ?? [];
37671
37874
  if (messages.length === 0) return void 0;
@@ -37673,10 +37876,11 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
37673
37876
  },
37674
37877
  [midTurnDrainRef, resolveDrainedSteerMessages]
37675
37878
  );
37676
- const submitQuery = (0, import_react136.useCallback)(
37879
+ const submitQuery = (0, import_react135.useCallback)(
37677
37880
  async (query, submitType = "userQuery" /* UserQuery */, prompt_id, metadata) => {
37678
37881
  const allowConcurrentBtwDuringResponse = submitType === "userQuery" /* UserQuery */ && streamingState === "responding" /* Responding */ && typeof query === "string" && isBtwCommand(query);
37679
37882
  const isTurnContinuation = submitType === "toolResult" /* ToolResult */ || submitType === "steer" /* Steer */;
37883
+ const submittedPrompt = submitType === "userQuery" /* UserQuery */ ? metadata?.submittedPrompt : void 0;
37680
37884
  if (isSubmittingQueryRef.current && !isTurnContinuation && !allowConcurrentBtwDuringResponse) {
37681
37885
  metadata?.onDeliveryFailed?.();
37682
37886
  return;
@@ -37689,6 +37893,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
37689
37893
  loopDetectedRef.current = false;
37690
37894
  if (!isTurnContinuation && !allowConcurrentBtwDuringResponse) {
37691
37895
  lastTurnUserItemRef.current = null;
37896
+ canUndoLastLoggedUserMessageRef.current = false;
37692
37897
  turnSawContentEventRef.current = false;
37693
37898
  handledProviderToolCallIdsRef.current.clear();
37694
37899
  duplicateProviderToolCallResponseIdsRef.current.clear();
@@ -37735,7 +37940,9 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
37735
37940
  userMessageTimestamp,
37736
37941
  abortSignal,
37737
37942
  prompt_id,
37738
- submitType
37943
+ submitType,
37944
+ submittedPrompt,
37945
+ allowConcurrentBtwDuringResponse
37739
37946
  );
37740
37947
  if (!shouldProceed || queryToSend === null) {
37741
37948
  isSubmittingQueryRef.current = false;
@@ -37793,17 +38000,20 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
37793
38000
  );
37794
38001
  dualOutput.emitUserMessage(userParts);
37795
38002
  }
38003
+ const sendOptions = {
38004
+ type: submitType,
38005
+ notificationDisplayText: metadata?.notificationDisplayText,
38006
+ todoWorkChainId: metadata?.todoWorkChainId,
38007
+ modelOverride: modelOverrideRef.current,
38008
+ steerInput: metadata?.steerInput,
38009
+ ...submittedPrompt !== void 0 ? { submittedPrompt } : {},
38010
+ ...!allowConcurrentBtwDuringResponse && midTurnDrainRef ? { getSteerInput: drainSteerAtBoundary } : {}
38011
+ };
37796
38012
  const stream = geminiClient.sendMessageStream(
37797
38013
  finalQueryToSend,
37798
38014
  abortSignal,
37799
38015
  prompt_id,
37800
- {
37801
- type: submitType,
37802
- notificationDisplayText: metadata?.notificationDisplayText,
37803
- modelOverride: modelOverrideRef.current,
37804
- steerInput: metadata?.steerInput,
37805
- ...!allowConcurrentBtwDuringResponse && midTurnDrainRef ? { getSteerInput: drainSteerAtBoundary } : {}
37806
- }
38016
+ sendOptions
37807
38017
  );
37808
38018
  const processingStatus = await processGeminiStreamEvents(
37809
38019
  stream,
@@ -37857,6 +38067,8 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
37857
38067
  }
37858
38068
  if (retryCountdownTimerRef.current) {
37859
38069
  clearRetryCountdown();
38070
+ } else if (pendingRetryErrorItemRef.current && !lastPromptErroredRef.current) {
38071
+ clearRetryCountdown();
37860
38072
  }
37861
38073
  const loopDetected = loopDetectedRef.current;
37862
38074
  if (loopDetected) {
@@ -37956,7 +38168,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
37956
38168
  midTurnDrainRef
37957
38169
  ]
37958
38170
  );
37959
- const retryLastPrompt = (0, import_react136.useCallback)(async () => {
38171
+ const retryLastPrompt = (0, import_react135.useCallback)(async () => {
37960
38172
  if (skipRetryDelayRef.current) {
37961
38173
  skipRetryDelayRef.current();
37962
38174
  skipRetryDelayRef.current = null;
@@ -37980,7 +38192,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
37980
38192
  clearRetryCountdown();
37981
38193
  await submitQuery(lastPrompt, "retry" /* Retry */);
37982
38194
  }, [streamingState, addItem, clearRetryCountdown, submitQuery]);
37983
- const handleApprovalModeChange = (0, import_react136.useCallback)(
38195
+ const handleApprovalModeChange = (0, import_react135.useCallback)(
37984
38196
  async (newApprovalMode) => {
37985
38197
  if (newApprovalMode === "yolo" /* YOLO */ || newApprovalMode === "auto-edit" /* AUTO_EDIT */) {
37986
38198
  let awaitingApprovalCalls = toolCalls.filter(
@@ -38015,7 +38227,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
38015
38227
  },
38016
38228
  [toolCalls]
38017
38229
  );
38018
- const handleCompletedTools = (0, import_react136.useCallback)(
38230
+ const handleCompletedTools = (0, import_react135.useCallback)(
38019
38231
  async (completedToolCallsFromScheduler) => {
38020
38232
  const completedAndReadyToSubmitTools = completedToolCallsFromScheduler.filter(
38021
38233
  (tc) => {
@@ -38326,7 +38538,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
38326
38538
  resolveDrainedSteerMessages
38327
38539
  ]
38328
38540
  );
38329
- const pendingHistoryItems = (0, import_react136.useMemo)(
38541
+ const pendingHistoryItems = (0, import_react135.useMemo)(
38330
38542
  () => [
38331
38543
  // Reasoning renders above the streaming answer.
38332
38544
  pendingThoughtItem,
@@ -38343,7 +38555,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
38343
38555
  pendingToolCallGroupDisplay
38344
38556
  ]
38345
38557
  );
38346
- (0, import_react136.useEffect)(() => {
38558
+ (0, import_react135.useEffect)(() => {
38347
38559
  const saveRestorableToolCalls = /* @__PURE__ */ __name(async () => {
38348
38560
  if (!config.getFileCheckpointingEnabled()) {
38349
38561
  return;
@@ -38414,14 +38626,14 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
38414
38626
  }, "saveRestorableToolCalls");
38415
38627
  saveRestorableToolCalls();
38416
38628
  }, [toolCalls, config, onDebugMessage, history, geminiClient, storage]);
38417
- const notificationQueueRef = (0, import_react136.useRef)([]);
38418
- const [notificationTrigger, setNotificationTrigger] = (0, import_react136.useState)(0);
38419
- const getAutonomousLoopTickResolver = (0, import_react136.useCallback)(() => {
38629
+ const notificationQueueRef = (0, import_react135.useRef)([]);
38630
+ const [notificationTrigger, setNotificationTrigger] = (0, import_react135.useState)(0);
38631
+ const getAutonomousLoopTickResolver = (0, import_react135.useCallback)(() => {
38420
38632
  autonomousLoopTickResolverRef.current ??= new AutonomousLoopTickResolver();
38421
38633
  return autonomousLoopTickResolverRef.current;
38422
38634
  }, []);
38423
- const notificationQueueSessionIdRef = (0, import_react136.useRef)(sessionStates.sessionId);
38424
- (0, import_react136.useEffect)(() => {
38635
+ const notificationQueueSessionIdRef = (0, import_react135.useRef)(sessionStates.sessionId);
38636
+ (0, import_react135.useEffect)(() => {
38425
38637
  if (notificationQueueSessionIdRef.current === sessionStates.sessionId) {
38426
38638
  return;
38427
38639
  }
@@ -38429,9 +38641,9 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
38429
38641
  notificationQueueRef.current = [];
38430
38642
  autonomousLoopTickResolverRef.current?.resetCache();
38431
38643
  }, [sessionStates.sessionId]);
38432
- const cronSessionIdRef = (0, import_react136.useRef)(sessionStates.sessionId);
38644
+ const cronSessionIdRef = (0, import_react135.useRef)(sessionStates.sessionId);
38433
38645
  cronSessionIdRef.current = sessionStates.sessionId;
38434
- (0, import_react136.useEffect)(() => {
38646
+ (0, import_react135.useEffect)(() => {
38435
38647
  if (!isConfigInitialized) return;
38436
38648
  if (!config.isCronEnabled()) return;
38437
38649
  const scheduler = config.getCronScheduler();
@@ -38461,6 +38673,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
38461
38673
  displayText: `${job.missed ? "Missed" : source}: ${label}`,
38462
38674
  modelText,
38463
38675
  sendMessageType: "cron" /* Cron */,
38676
+ todoWorkChainId: job.todoWorkChainId,
38464
38677
  onDelivered: /* @__PURE__ */ __name(() => resolver.markDelivered(), "onDelivered")
38465
38678
  });
38466
38679
  setNotificationTrigger((n) => n + 1);
@@ -38469,7 +38682,8 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
38469
38682
  notificationQueueRef.current.push({
38470
38683
  displayText: `${job.missed ? "Missed" : source}: ${label}`,
38471
38684
  modelText,
38472
- sendMessageType: "cron" /* Cron */
38685
+ sendMessageType: "cron" /* Cron */,
38686
+ todoWorkChainId: job.todoWorkChainId
38473
38687
  });
38474
38688
  setNotificationTrigger((n) => n + 1);
38475
38689
  }
@@ -38480,17 +38694,18 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
38480
38694
  const summary = scheduler.getExitSummary();
38481
38695
  scheduler.stop();
38482
38696
  if (summary) {
38483
- process14.stderr.write(summary + "\n");
38697
+ process15.stderr.write(summary + "\n");
38484
38698
  }
38485
38699
  };
38486
38700
  }, [config, getAutonomousLoopTickResolver, isConfigInitialized]);
38487
- (0, import_react136.useEffect)(() => {
38701
+ (0, import_react135.useEffect)(() => {
38488
38702
  const registry = config.getBackgroundTaskRegistry();
38489
- registry.setNotificationCallback((displayText, modelText) => {
38703
+ registry.setNotificationCallback((displayText, modelText, meta) => {
38490
38704
  notificationQueueRef.current.push({
38491
38705
  displayText,
38492
38706
  modelText,
38493
- sendMessageType: "notification" /* Notification */
38707
+ sendMessageType: "notification" /* Notification */,
38708
+ todoWorkChainId: meta?.todoWorkChainId
38494
38709
  });
38495
38710
  setNotificationTrigger((n) => n + 1);
38496
38711
  });
@@ -38498,13 +38713,14 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
38498
38713
  registry.setNotificationCallback(void 0);
38499
38714
  };
38500
38715
  }, [config]);
38501
- (0, import_react136.useEffect)(() => {
38716
+ (0, import_react135.useEffect)(() => {
38502
38717
  const registry = config.getBackgroundShellRegistry();
38503
- registry.setNotificationCallback((displayText, modelText) => {
38718
+ registry.setNotificationCallback((displayText, modelText, meta) => {
38504
38719
  notificationQueueRef.current.push({
38505
38720
  displayText,
38506
38721
  modelText,
38507
- sendMessageType: "notification" /* Notification */
38722
+ sendMessageType: "notification" /* Notification */,
38723
+ todoWorkChainId: meta?.todoWorkChainId
38508
38724
  });
38509
38725
  setNotificationTrigger((n) => n + 1);
38510
38726
  });
@@ -38512,7 +38728,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
38512
38728
  registry.setNotificationCallback(void 0);
38513
38729
  };
38514
38730
  }, [config]);
38515
- (0, import_react136.useEffect)(() => {
38731
+ (0, import_react135.useEffect)(() => {
38516
38732
  const registry = config.getMonitorRegistry();
38517
38733
  registry.setNotificationCallback((displayText, modelText, meta) => {
38518
38734
  if (meta.status === "running" && typeof registry.get === "function") {
@@ -38523,7 +38739,8 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
38523
38739
  displayText,
38524
38740
  modelText,
38525
38741
  sendMessageType: "notification" /* Notification */,
38526
- monitor: { id: meta.monitorId, status: meta.status }
38742
+ monitor: { id: meta.monitorId, status: meta.status },
38743
+ todoWorkChainId: meta.todoWorkChainId
38527
38744
  });
38528
38745
  setNotificationTrigger((n) => n + 1);
38529
38746
  });
@@ -38531,7 +38748,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
38531
38748
  registry.setNotificationCallback(void 0);
38532
38749
  };
38533
38750
  }, [config]);
38534
- (0, import_react136.useEffect)(() => {
38751
+ (0, import_react135.useEffect)(() => {
38535
38752
  if (streamingState === "idle" /* Idle */ && !isSubmittingQueryRef.current && notificationQueueRef.current.length > 0) {
38536
38753
  runOutsideAgentContext(() => {
38537
38754
  const queue = notificationQueueRef.current;
@@ -38554,13 +38771,14 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
38554
38771
  );
38555
38772
  submitQuery(item.modelText, item.sendMessageType, void 0, {
38556
38773
  notificationDisplayText: item.displayText,
38774
+ todoWorkChainId: item.todoWorkChainId,
38557
38775
  onDelivered: item.onDelivered,
38558
38776
  onDeliveryFailed: item.onDeliveryFailed
38559
38777
  });
38560
38778
  return;
38561
38779
  }
38562
38780
  let splitIdx = 0;
38563
- while (splitIdx < queue.length && queue[splitIdx].sendMessageType === targetType) {
38781
+ while (splitIdx < queue.length && queue[splitIdx].sendMessageType === targetType && queue[splitIdx].todoWorkChainId === queue[0].todoWorkChainId) {
38564
38782
  splitIdx++;
38565
38783
  }
38566
38784
  const batch = queue.splice(0, splitIdx);
@@ -38574,14 +38792,15 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
38574
38792
  const combinedModelText = batch.map((e) => e.modelText).join("\n\n");
38575
38793
  const combinedDisplayText = batch.map((e) => e.displayText).join("; ");
38576
38794
  submitQuery(combinedModelText, targetType, void 0, {
38577
- notificationDisplayText: combinedDisplayText
38795
+ notificationDisplayText: combinedDisplayText,
38796
+ todoWorkChainId: batch[0]?.todoWorkChainId
38578
38797
  });
38579
38798
  });
38580
38799
  }
38581
38800
  }, [streamingState, submitQuery, notificationTrigger, addItem, config]);
38582
- const teammateQueueRef = (0, import_react136.useRef)([]);
38583
- const [teammateTrigger, setTeammateTrigger] = (0, import_react136.useState)(0);
38584
- (0, import_react136.useEffect)(() => {
38801
+ const teammateQueueRef = (0, import_react135.useRef)([]);
38802
+ const [teammateTrigger, setTeammateTrigger] = (0, import_react135.useState)(0);
38803
+ (0, import_react135.useEffect)(() => {
38585
38804
  let boundManager = null;
38586
38805
  const handleManagerChange = /* @__PURE__ */ __name((manager) => {
38587
38806
  if (boundManager && boundManager !== manager) {
@@ -38611,7 +38830,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
38611
38830
  }
38612
38831
  };
38613
38832
  }, [config]);
38614
- (0, import_react136.useEffect)(() => {
38833
+ (0, import_react135.useEffect)(() => {
38615
38834
  if (streamingState === "idle" /* Idle */ && !isSubmittingQueryRef.current && teammateQueueRef.current.length > 0) {
38616
38835
  runOutsideAgentContext(() => {
38617
38836
  const batch = teammateQueueRef.current.splice(0);
@@ -38648,7 +38867,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
38648
38867
 
38649
38868
  // packages/cli/src/ui/hooks/vim.ts
38650
38869
  init_esbuild_shims();
38651
- var import_react137 = __toESM(require_react(), 1);
38870
+ var import_react136 = __toESM(require_react(), 1);
38652
38871
  import { execFile as execFile7, execFileSync as execFileSync2 } from "child_process";
38653
38872
  var DIGIT_MULTIPLIER = 10;
38654
38873
  var DEFAULT_COUNT = 1;
@@ -38884,26 +39103,26 @@ __name(findCharInLineReverse, "findCharInLineReverse");
38884
39103
  function useVim(buffer, onSubmit) {
38885
39104
  const { vimEnabled, vimMode } = useVimModeState();
38886
39105
  const { setVimMode } = useVimModeActions();
38887
- const [state, dispatch] = (0, import_react137.useReducer)(vimReducer, initialVimState);
38888
- const bufferRef = (0, import_react137.useRef)(buffer);
38889
- const stateRef = (0, import_react137.useRef)(state);
39106
+ const [state, dispatch] = (0, import_react136.useReducer)(vimReducer, initialVimState);
39107
+ const bufferRef = (0, import_react136.useRef)(buffer);
39108
+ const stateRef = (0, import_react136.useRef)(state);
38890
39109
  bufferRef.current = buffer;
38891
39110
  stateRef.current = state;
38892
- (0, import_react137.useEffect)(() => {
39111
+ (0, import_react136.useEffect)(() => {
38893
39112
  dispatch({ type: "SET_MODE", mode: vimMode });
38894
39113
  }, [vimMode]);
38895
- const updateMode = (0, import_react137.useCallback)(
39114
+ const updateMode = (0, import_react136.useCallback)(
38896
39115
  (mode) => {
38897
39116
  setVimMode(mode);
38898
39117
  dispatch({ type: "SET_MODE", mode });
38899
39118
  },
38900
39119
  [setVimMode]
38901
39120
  );
38902
- const getCurrentCount = (0, import_react137.useCallback)(
39121
+ const getCurrentCount = (0, import_react136.useCallback)(
38903
39122
  () => stateRef.current.count || DEFAULT_COUNT,
38904
39123
  []
38905
39124
  );
38906
- const yankRange = (0, import_react137.useCallback)(
39125
+ const yankRange = (0, import_react136.useCallback)(
38907
39126
  (startRow, startCol, endRow, endCol, linewise) => {
38908
39127
  const lines = bufferRef.current.lines;
38909
39128
  let text = "";
@@ -38918,7 +39137,7 @@ function useVim(buffer, onSubmit) {
38918
39137
  },
38919
39138
  []
38920
39139
  );
38921
- const executeCommand = (0, import_react137.useCallback)(
39140
+ const executeCommand = (0, import_react136.useCallback)(
38922
39141
  (cmdType, count) => {
38923
39142
  switch (cmdType) {
38924
39143
  case CMD_TYPES.DELETE_WORD_FORWARD:
@@ -39319,7 +39538,7 @@ function useVim(buffer, onSubmit) {
39319
39538
  return { text, linewise: movement === "j" || movement === "k" };
39320
39539
  }
39321
39540
  __name(extractMovementText, "extractMovementText");
39322
- const executeFind = (0, import_react137.useCallback)(
39541
+ const executeFind = (0, import_react136.useCallback)(
39323
39542
  (findType, char, count = 1) => {
39324
39543
  const [startRow, startCol] = buffer.cursor;
39325
39544
  const line = buffer.lines[startRow] ?? "";
@@ -39355,7 +39574,7 @@ function useVim(buffer, onSubmit) {
39355
39574
  },
39356
39575
  [buffer, dispatch]
39357
39576
  );
39358
- const handleCharRead = (0, import_react137.useCallback)(
39577
+ const handleCharRead = (0, import_react136.useCallback)(
39359
39578
  (char) => {
39360
39579
  const readType = state.pendingCharRead;
39361
39580
  if (!readType) return false;
@@ -39398,7 +39617,7 @@ function useVim(buffer, onSubmit) {
39398
39617
  },
39399
39618
  [state.pendingCharRead, buffer, dispatch, executeFind]
39400
39619
  );
39401
- const handleInsertModeInput = (0, import_react137.useCallback)(
39620
+ const handleInsertModeInput = (0, import_react136.useCallback)(
39402
39621
  (normalizedKey) => {
39403
39622
  if (normalizedKey.name === "escape") {
39404
39623
  buffer.vimEscapeInsertMode();
@@ -39429,7 +39648,7 @@ function useVim(buffer, onSubmit) {
39429
39648
  },
39430
39649
  [buffer, dispatch, updateMode, onSubmit]
39431
39650
  );
39432
- const normalizeKey = (0, import_react137.useCallback)(
39651
+ const normalizeKey = (0, import_react136.useCallback)(
39433
39652
  (key) => ({
39434
39653
  name: key.name || "",
39435
39654
  sequence: key.sequence || "",
@@ -39440,7 +39659,7 @@ function useVim(buffer, onSubmit) {
39440
39659
  }),
39441
39660
  []
39442
39661
  );
39443
- const handleChangeMovement = (0, import_react137.useCallback)(
39662
+ const handleChangeMovement = (0, import_react136.useCallback)(
39444
39663
  (movement) => {
39445
39664
  const count = getCurrentCount();
39446
39665
  dispatch({ type: "CLEAR_COUNT" });
@@ -39461,7 +39680,7 @@ function useVim(buffer, onSubmit) {
39461
39680
  },
39462
39681
  [getCurrentCount, dispatch, buffer, updateMode]
39463
39682
  );
39464
- const handleDeleteMovement = (0, import_react137.useCallback)(
39683
+ const handleDeleteMovement = (0, import_react136.useCallback)(
39465
39684
  (movement) => {
39466
39685
  const count = getCurrentCount();
39467
39686
  const [row, col] = bufferRef.current.cursor;
@@ -39496,7 +39715,7 @@ function useVim(buffer, onSubmit) {
39496
39715
  },
39497
39716
  [getCurrentCount, dispatch, buffer]
39498
39717
  );
39499
- const handleYankMovement = (0, import_react137.useCallback)(
39718
+ const handleYankMovement = (0, import_react136.useCallback)(
39500
39719
  (movement) => {
39501
39720
  const count = getCurrentCount();
39502
39721
  const [row, col] = bufferRef.current.cursor;
@@ -39530,7 +39749,7 @@ function useVim(buffer, onSubmit) {
39530
39749
  },
39531
39750
  [getCurrentCount, dispatch]
39532
39751
  );
39533
- const handleOperatorMotion = (0, import_react137.useCallback)(
39752
+ const handleOperatorMotion = (0, import_react136.useCallback)(
39534
39753
  (operator, motion) => {
39535
39754
  const count = getCurrentCount();
39536
39755
  const commandMap = {
@@ -39562,7 +39781,7 @@ function useVim(buffer, onSubmit) {
39562
39781
  },
39563
39782
  [getCurrentCount, executeCommand, dispatch]
39564
39783
  );
39565
- const handleInput = (0, import_react137.useCallback)(
39784
+ const handleInput = (0, import_react136.useCallback)(
39566
39785
  (key) => {
39567
39786
  if (!vimEnabled) {
39568
39787
  return false;
@@ -40284,7 +40503,7 @@ __name(buildWorkflowSteeringNotice, "buildWorkflowSteeringNotice");
40284
40503
 
40285
40504
  // packages/cli/src/ui/hooks/useAwaySummary.ts
40286
40505
  init_esbuild_shims();
40287
- var import_react138 = __toESM(require_react(), 1);
40506
+ var import_react137 = __toESM(require_react(), 1);
40288
40507
  var DEFAULT_AWAY_THRESHOLD_MINUTES = 5;
40289
40508
  var MIN_USER_MESSAGES_TO_FIRE = 3;
40290
40509
  var MIN_USER_MESSAGES_SINCE_LAST_RECAP = 2;
@@ -40316,15 +40535,15 @@ function useAwaySummary(options) {
40316
40535
  history,
40317
40536
  awayThresholdMinutes
40318
40537
  } = options;
40319
- const blurredAtRef = (0, import_react138.useRef)(null);
40320
- const recapPendingRef = (0, import_react138.useRef)(false);
40321
- const inFlightRef = (0, import_react138.useRef)(null);
40322
- const isIdleRef = (0, import_react138.useRef)(isIdle);
40538
+ const blurredAtRef = (0, import_react137.useRef)(null);
40539
+ const recapPendingRef = (0, import_react137.useRef)(false);
40540
+ const inFlightRef = (0, import_react137.useRef)(null);
40541
+ const isIdleRef = (0, import_react137.useRef)(isIdle);
40323
40542
  isIdleRef.current = isIdle;
40324
- const historyRef = (0, import_react138.useRef)(history);
40543
+ const historyRef = (0, import_react137.useRef)(history);
40325
40544
  historyRef.current = history;
40326
40545
  const thresholdMs = (awayThresholdMinutes && awayThresholdMinutes > 0 ? awayThresholdMinutes : DEFAULT_AWAY_THRESHOLD_MINUTES) * 60 * 1e3;
40327
- (0, import_react138.useEffect)(() => {
40546
+ (0, import_react137.useEffect)(() => {
40328
40547
  if (!enabled || !config) {
40329
40548
  inFlightRef.current?.abort();
40330
40549
  inFlightRef.current = null;
@@ -40376,7 +40595,7 @@ function useAwaySummary(options) {
40376
40595
  recapPendingRef.current = false;
40377
40596
  });
40378
40597
  }, [enabled, config, isFocused, isIdle, addItem, thresholdMs]);
40379
- (0, import_react138.useEffect)(
40598
+ (0, import_react137.useEffect)(
40380
40599
  () => () => {
40381
40600
  inFlightRef.current?.abort();
40382
40601
  },
@@ -40387,14 +40606,14 @@ __name(useAwaySummary, "useAwaySummary");
40387
40606
 
40388
40607
  // packages/cli/src/ui/hooks/useBracketedPaste.ts
40389
40608
  init_esbuild_shims();
40390
- var import_react139 = __toESM(require_react(), 1);
40609
+ var import_react138 = __toESM(require_react(), 1);
40391
40610
  var ENABLE_BRACKETED_PASTE = "\x1B[?2004h";
40392
40611
  var DISABLE_BRACKETED_PASTE = "\x1B[?2004l";
40393
40612
  var useBracketedPaste = /* @__PURE__ */ __name(() => {
40394
40613
  const cleanup = /* @__PURE__ */ __name(() => {
40395
40614
  process.stdout.write(DISABLE_BRACKETED_PASTE);
40396
40615
  }, "cleanup");
40397
- (0, import_react139.useEffect)(() => {
40616
+ (0, import_react138.useEffect)(() => {
40398
40617
  process.stdout.write(ENABLE_BRACKETED_PASTE);
40399
40618
  process.on("exit", cleanup);
40400
40619
  process.on("SIGINT", cleanup);
@@ -40413,23 +40632,23 @@ init_esbuild_shims();
40413
40632
 
40414
40633
  // packages/cli/src/ui/hooks/usePhraseCycler.ts
40415
40634
  init_esbuild_shims();
40416
- var import_react140 = __toESM(require_react(), 1);
40635
+ var import_react139 = __toESM(require_react(), 1);
40417
40636
  var WITTY_LOADING_PHRASES = ["I'm Feeling Lucky"];
40418
40637
  var PHRASE_CHANGE_INTERVAL_MS = 15e3;
40419
40638
  var usePhraseCycler = /* @__PURE__ */ __name((isActive, isWaiting, customPhrases) => {
40420
40639
  const currentLanguage = getCurrentLanguage();
40421
- const loadingPhrases = (0, import_react140.useMemo)(() => {
40640
+ const loadingPhrases = (0, import_react139.useMemo)(() => {
40422
40641
  if (customPhrases && customPhrases.length > 0) {
40423
40642
  return customPhrases;
40424
40643
  }
40425
40644
  const translatedPhrases = ta("WITTY_LOADING_PHRASES");
40426
40645
  return translatedPhrases.length > 0 ? translatedPhrases : WITTY_LOADING_PHRASES;
40427
40646
  }, [customPhrases, currentLanguage]);
40428
- const [currentLoadingPhrase, setCurrentLoadingPhrase] = (0, import_react140.useState)(
40647
+ const [currentLoadingPhrase, setCurrentLoadingPhrase] = (0, import_react139.useState)(
40429
40648
  loadingPhrases[0]
40430
40649
  );
40431
- const phraseIntervalRef = (0, import_react140.useRef)(null);
40432
- (0, import_react140.useEffect)(() => {
40650
+ const phraseIntervalRef = (0, import_react139.useRef)(null);
40651
+ (0, import_react139.useEffect)(() => {
40433
40652
  if (isWaiting) {
40434
40653
  setCurrentLoadingPhrase(t("Waiting for user confirmation..."));
40435
40654
  if (phraseIntervalRef.current) {
@@ -40466,9 +40685,9 @@ var usePhraseCycler = /* @__PURE__ */ __name((isActive, isWaiting, customPhrases
40466
40685
  }, "usePhraseCycler");
40467
40686
 
40468
40687
  // packages/cli/src/ui/hooks/useLoadingIndicator.ts
40469
- var import_react141 = __toESM(require_react(), 1);
40688
+ var import_react140 = __toESM(require_react(), 1);
40470
40689
  var useLoadingIndicator = /* @__PURE__ */ __name((streamingState, customWittyPhrases, currentCandidatesTokens, currentStreamingChars, isToolExecuting2 = false) => {
40471
- const [timerResetKey, setTimerResetKey] = (0, import_react141.useState)(0);
40690
+ const [timerResetKey, setTimerResetKey] = (0, import_react140.useState)(0);
40472
40691
  const isTimerActive = streamingState === "responding" /* Responding */;
40473
40692
  const elapsedTimeFromTimer = useTimer(
40474
40693
  isTimerActive,
@@ -40482,17 +40701,17 @@ var useLoadingIndicator = /* @__PURE__ */ __name((streamingState, customWittyPhr
40482
40701
  isWaiting,
40483
40702
  customWittyPhrases
40484
40703
  );
40485
- const [retainedElapsedTime, setRetainedElapsedTime] = (0, import_react141.useState)(0);
40486
- const [taskStartTokens, setTaskStartTokensState] = (0, import_react141.useState)(0);
40487
- const [taskStartStreamingChars, setTaskStartStreamingCharsState] = (0, import_react141.useState)(0);
40488
- const taskStartTokensRef = (0, import_react141.useRef)(0);
40489
- const taskStartStreamingCharsRef = (0, import_react141.useRef)(0);
40490
- const pauseStartTokensRef = (0, import_react141.useRef)(null);
40491
- const pauseStartStreamingCharsRef = (0, import_react141.useRef)(null);
40492
- const pauseBaseTaskStartTokensRef = (0, import_react141.useRef)(0);
40493
- const pauseBaseTaskStartStreamingCharsRef = (0, import_react141.useRef)(0);
40494
- const prevStreamingStateRef = (0, import_react141.useRef)(null);
40495
- (0, import_react141.useEffect)(() => {
40704
+ const [retainedElapsedTime, setRetainedElapsedTime] = (0, import_react140.useState)(0);
40705
+ const [taskStartTokens, setTaskStartTokensState] = (0, import_react140.useState)(0);
40706
+ const [taskStartStreamingChars, setTaskStartStreamingCharsState] = (0, import_react140.useState)(0);
40707
+ const taskStartTokensRef = (0, import_react140.useRef)(0);
40708
+ const taskStartStreamingCharsRef = (0, import_react140.useRef)(0);
40709
+ const pauseStartTokensRef = (0, import_react140.useRef)(null);
40710
+ const pauseStartStreamingCharsRef = (0, import_react140.useRef)(null);
40711
+ const pauseBaseTaskStartTokensRef = (0, import_react140.useRef)(0);
40712
+ const pauseBaseTaskStartStreamingCharsRef = (0, import_react140.useRef)(0);
40713
+ const prevStreamingStateRef = (0, import_react140.useRef)(null);
40714
+ (0, import_react140.useEffect)(() => {
40496
40715
  const currentTokens = currentCandidatesTokens ?? 0;
40497
40716
  const currentChars = currentStreamingChars ?? 0;
40498
40717
  const setTaskStartTokens = /* @__PURE__ */ __name((tokens) => {
@@ -40563,7 +40782,7 @@ var useLoadingIndicator = /* @__PURE__ */ __name((streamingState, customWittyPhr
40563
40782
 
40564
40783
  // packages/cli/src/ui/hooks/useTerminalProgress.ts
40565
40784
  init_esbuild_shims();
40566
- var import_react142 = __toESM(require_react(), 1);
40785
+ var import_react141 = __toESM(require_react(), 1);
40567
40786
  var PROGRESS_CLEAR = wrapForMultiplexer(`${OSC_PREFIX}9;4;0;${BEL}`);
40568
40787
  var PROGRESS_INDETERMINATE = wrapForMultiplexer(`${OSC_PREFIX}9;4;3;;${BEL}`);
40569
40788
  function isProgressBarSupported() {
@@ -40578,13 +40797,13 @@ function isProgressBarSupported() {
40578
40797
  __name(isProgressBarSupported, "isProgressBarSupported");
40579
40798
  function useTerminalProgress(streamingState, hasToolExecuting) {
40580
40799
  const { stdout } = use_stdout_default();
40581
- const writeProgress = (0, import_react142.useCallback)(
40800
+ const writeProgress = (0, import_react141.useCallback)(
40582
40801
  (seq) => {
40583
40802
  stdout?.write(seq);
40584
40803
  },
40585
40804
  [stdout]
40586
40805
  );
40587
- (0, import_react142.useEffect)(() => {
40806
+ (0, import_react141.useEffect)(() => {
40588
40807
  if (!isProgressBarSupported()) return;
40589
40808
  if (streamingState === "responding" /* Responding */ && hasToolExecuting) {
40590
40809
  writeProgress(PROGRESS_INDETERMINATE);
@@ -40595,7 +40814,7 @@ function useTerminalProgress(streamingState, hasToolExecuting) {
40595
40814
  writeProgress(PROGRESS_CLEAR);
40596
40815
  };
40597
40816
  }, [streamingState, hasToolExecuting, writeProgress]);
40598
- (0, import_react142.useEffect)(() => {
40817
+ (0, import_react141.useEffect)(() => {
40599
40818
  if (!isProgressBarSupported()) return;
40600
40819
  const clearOnExit = /* @__PURE__ */ __name(() => {
40601
40820
  stdout?.write(PROGRESS_CLEAR);
@@ -40610,23 +40829,23 @@ __name(useTerminalProgress, "useTerminalProgress");
40610
40829
 
40611
40830
  // packages/cli/src/ui/hooks/useFolderTrust.ts
40612
40831
  init_esbuild_shims();
40613
- var import_react143 = __toESM(require_react(), 1);
40614
- import * as process15 from "node:process";
40832
+ var import_react142 = __toESM(require_react(), 1);
40833
+ import * as process16 from "node:process";
40615
40834
  var useFolderTrust = /* @__PURE__ */ __name((settings, onTrustChange) => {
40616
- const [isTrusted, setIsTrusted] = (0, import_react143.useState)(void 0);
40617
- const [isFolderTrustDialogOpen, setIsFolderTrustDialogOpen] = (0, import_react143.useState)(false);
40618
- const [isRestarting, setIsRestarting] = (0, import_react143.useState)(false);
40835
+ const [isTrusted, setIsTrusted] = (0, import_react142.useState)(void 0);
40836
+ const [isFolderTrustDialogOpen, setIsFolderTrustDialogOpen] = (0, import_react142.useState)(false);
40837
+ const [isRestarting, setIsRestarting] = (0, import_react142.useState)(false);
40619
40838
  const folderTrust = settings.merged.security?.folderTrust?.enabled;
40620
- (0, import_react143.useEffect)(() => {
40839
+ (0, import_react142.useEffect)(() => {
40621
40840
  const { isTrusted: trusted } = isWorkspaceTrusted(settings.merged);
40622
40841
  setIsTrusted(trusted);
40623
40842
  setIsFolderTrustDialogOpen(trusted === void 0);
40624
40843
  onTrustChange(trusted);
40625
40844
  }, [folderTrust, onTrustChange, settings.merged]);
40626
- const handleFolderTrustSelect = (0, import_react143.useCallback)(
40845
+ const handleFolderTrustSelect = (0, import_react142.useCallback)(
40627
40846
  (choice) => {
40628
40847
  const trustedFolders = loadTrustedFolders();
40629
- const cwd3 = process15.cwd();
40848
+ const cwd3 = process16.cwd();
40630
40849
  let trustLevel;
40631
40850
  const wasTrusted = isTrusted ?? true;
40632
40851
  switch (choice) {
@@ -40642,7 +40861,15 @@ var useFolderTrust = /* @__PURE__ */ __name((settings, onTrustChange) => {
40642
40861
  default:
40643
40862
  return;
40644
40863
  }
40645
- trustedFolders.setValue(cwd3, trustLevel);
40864
+ try {
40865
+ trustedFolders.setValue(cwd3, trustLevel);
40866
+ } catch (error) {
40867
+ writeStderrLineSafe("Error saving trusted folders file.");
40868
+ writeStderrLineSafe(
40869
+ error instanceof Error ? error.message : String(error)
40870
+ );
40871
+ return;
40872
+ }
40646
40873
  const currentIsTrusted = trustLevel === "TRUST_FOLDER" /* TRUST_FOLDER */ || trustLevel === "TRUST_PARENT" /* TRUST_PARENT */;
40647
40874
  setIsTrusted(currentIsTrusted);
40648
40875
  onTrustChange(currentIsTrusted);
@@ -40666,7 +40893,7 @@ var useFolderTrust = /* @__PURE__ */ __name((settings, onTrustChange) => {
40666
40893
 
40667
40894
  // packages/cli/src/ui/hooks/useMcpApproval.ts
40668
40895
  init_esbuild_shims();
40669
- var import_react144 = __toESM(require_react(), 1);
40896
+ var import_react143 = __toESM(require_react(), 1);
40670
40897
  function sourceLabel(scope) {
40671
40898
  switch (scope) {
40672
40899
  case "workspace":
@@ -40702,8 +40929,8 @@ function summarize(config) {
40702
40929
  }
40703
40930
  __name(summarize, "summarize");
40704
40931
  var useMcpApproval = /* @__PURE__ */ __name((config) => {
40705
- const [queue, setQueue] = (0, import_react144.useState)([]);
40706
- const computePending = (0, import_react144.useCallback)(() => {
40932
+ const [queue, setQueue] = (0, import_react143.useState)([]);
40933
+ const computePending = (0, import_react143.useCallback)(() => {
40707
40934
  if (config.getApprovalMode() === "yolo" /* YOLO */) return [];
40708
40935
  const servers = config.getMcpServers() ?? {};
40709
40936
  const approvals = loadMcpApprovals();
@@ -40715,10 +40942,10 @@ var useMcpApproval = /* @__PURE__ */ __name((config) => {
40715
40942
  source: sourceLabel(c.scope)
40716
40943
  }));
40717
40944
  }, [config]);
40718
- (0, import_react144.useEffect)(() => {
40945
+ (0, import_react143.useEffect)(() => {
40719
40946
  setQueue(computePending());
40720
40947
  }, [computePending]);
40721
- (0, import_react144.useEffect)(() => {
40948
+ (0, import_react143.useEffect)(() => {
40722
40949
  const onPendingChanged = /* @__PURE__ */ __name(() => {
40723
40950
  setQueue(computePending());
40724
40951
  }, "onPendingChanged");
@@ -40727,7 +40954,7 @@ var useMcpApproval = /* @__PURE__ */ __name((config) => {
40727
40954
  appEvents.off("mcp-pending-approval-changed" /* McpPendingApprovalChanged */, onPendingChanged);
40728
40955
  };
40729
40956
  }, [computePending]);
40730
- const reconnect = (0, import_react144.useCallback)(
40957
+ const reconnect = (0, import_react143.useCallback)(
40731
40958
  (name) => {
40732
40959
  config.approveMcpServerForSession(name);
40733
40960
  const registry = config.getToolRegistry();
@@ -40739,7 +40966,7 @@ var useMcpApproval = /* @__PURE__ */ __name((config) => {
40739
40966
  },
40740
40967
  [config]
40741
40968
  );
40742
- const handleMcpApprovalSelect = (0, import_react144.useCallback)(
40969
+ const handleMcpApprovalSelect = (0, import_react143.useCallback)(
40743
40970
  async (choice) => {
40744
40971
  const approvals = loadMcpApprovals();
40745
40972
  const root = config.getWorkingDir();
@@ -40791,7 +41018,7 @@ var useMcpApproval = /* @__PURE__ */ __name((config) => {
40791
41018
 
40792
41019
  // packages/cli/src/ui/hooks/useCommandMigration.ts
40793
41020
  init_esbuild_shims();
40794
- var import_react145 = __toESM(require_react(), 1);
41021
+ var import_react144 = __toESM(require_react(), 1);
40795
41022
 
40796
41023
  // packages/cli/src/services/command-migration-tool.ts
40797
41024
  init_esbuild_shims();
@@ -40862,9 +41089,9 @@ __name(migrateTomlCommands, "migrateTomlCommands");
40862
41089
 
40863
41090
  // packages/cli/src/ui/hooks/useCommandMigration.ts
40864
41091
  function useCommandMigration(settings, storage) {
40865
- const [showMigrationNudge, setShowMigrationNudge] = (0, import_react145.useState)(false);
40866
- const [tomlFiles, setTomlFiles] = (0, import_react145.useState)([]);
40867
- (0, import_react145.useEffect)(() => {
41092
+ const [showMigrationNudge, setShowMigrationNudge] = (0, import_react144.useState)(false);
41093
+ const [tomlFiles, setTomlFiles] = (0, import_react144.useState)([]);
41094
+ (0, import_react144.useEffect)(() => {
40868
41095
  let cancelled = false;
40869
41096
  const checkTomlCommands = /* @__PURE__ */ __name(async () => {
40870
41097
  const allFiles = [];
@@ -40932,15 +41159,23 @@ __name(sendNotification, "sendNotification");
40932
41159
 
40933
41160
  // packages/cli/src/ui/hooks/useGitBranchName.ts
40934
41161
  init_esbuild_shims();
40935
- var import_react146 = __toESM(require_react(), 1);
41162
+ var import_react145 = __toESM(require_react(), 1);
41163
+ var BRANCH_POLL_INTERVAL_MS = 5e3;
40936
41164
  function useGitBranchName(cwd3) {
40937
- const [branchName, setBranchName] = (0, import_react146.useState)(void 0);
40938
- (0, import_react146.useEffect)(() => {
41165
+ const [branchName, setBranchName] = (0, import_react145.useState)(void 0);
41166
+ const branchNameRef = (0, import_react145.useRef)(branchName);
41167
+ branchNameRef.current = branchName;
41168
+ (0, import_react145.useEffect)(() => {
40939
41169
  let cancelled = false;
40940
41170
  let dispose;
41171
+ let pollTimer;
41172
+ let refreshGeneration = 0;
40941
41173
  const refresh = /* @__PURE__ */ __name(async () => {
41174
+ const generation = ++refreshGeneration;
40942
41175
  const name = await resolveBranchName(cwd3);
40943
- if (!cancelled) setBranchName(name);
41176
+ if (!cancelled && generation === refreshGeneration && name !== branchNameRef.current) {
41177
+ setBranchName(name);
41178
+ }
40944
41179
  }, "refresh");
40945
41180
  const init = /* @__PURE__ */ __name(async () => {
40946
41181
  await refresh();
@@ -40954,12 +41189,20 @@ function useGitBranchName(cwd3) {
40954
41189
  } else {
40955
41190
  dispose = disposer;
40956
41191
  }
41192
+ if (!cancelled) {
41193
+ pollTimer = setInterval(() => {
41194
+ void refresh().catch(() => {
41195
+ });
41196
+ }, BRANCH_POLL_INTERVAL_MS);
41197
+ pollTimer.unref?.();
41198
+ }
40957
41199
  }, "init");
40958
41200
  void init().catch(() => {
40959
41201
  });
40960
41202
  return () => {
40961
41203
  cancelled = true;
40962
41204
  dispose?.();
41205
+ if (pollTimer) clearInterval(pollTimer);
40963
41206
  };
40964
41207
  }, [cwd3]);
40965
41208
  return branchName;
@@ -40968,13 +41211,13 @@ __name(useGitBranchName, "useGitBranchName");
40968
41211
 
40969
41212
  // packages/cli/src/ui/hooks/useWorktreeSession.ts
40970
41213
  init_esbuild_shims();
40971
- var import_react147 = __toESM(require_react(), 1);
41214
+ var import_react146 = __toESM(require_react(), 1);
40972
41215
  import fs19 from "node:fs";
40973
41216
  import fsPromises from "node:fs/promises";
40974
41217
  import path14 from "node:path";
40975
41218
  function useWorktreeSession(config) {
40976
- const [session, setSession] = (0, import_react147.useState)(null);
40977
- (0, import_react147.useEffect)(() => {
41219
+ const [session, setSession] = (0, import_react146.useState)(null);
41220
+ (0, import_react146.useEffect)(() => {
40978
41221
  let cancelled = false;
40979
41222
  const safeLoad = /* @__PURE__ */ __name(async () => {
40980
41223
  try {
@@ -41014,7 +41257,7 @@ __name(useWorktreeSession, "useWorktreeSession");
41014
41257
 
41015
41258
  // packages/cli/src/ui/hooks/useExtensionUpdates.ts
41016
41259
  init_esbuild_shims();
41017
- var import_react148 = __toESM(require_react(), 1);
41260
+ var import_react147 = __toESM(require_react(), 1);
41018
41261
  function confirmationRequestsReducer(state, action) {
41019
41262
  switch (action.type) {
41020
41263
  case "add":
@@ -41031,8 +41274,8 @@ var useConfirmUpdateRequests = /* @__PURE__ */ __name(() => {
41031
41274
  const [
41032
41275
  confirmUpdateExtensionRequests,
41033
41276
  dispatchConfirmUpdateExtensionRequests
41034
- ] = (0, import_react148.useReducer)(confirmationRequestsReducer, []);
41035
- const addConfirmUpdateExtensionRequest = (0, import_react148.useCallback)(
41277
+ ] = (0, import_react147.useReducer)(confirmationRequestsReducer, []);
41278
+ const addConfirmUpdateExtensionRequest = (0, import_react147.useCallback)(
41036
41279
  (original) => {
41037
41280
  const wrappedRequest = {
41038
41281
  prompt: original.prompt,
@@ -41070,11 +41313,11 @@ function settingInputRequestsReducer(state, action) {
41070
41313
  }
41071
41314
  __name(settingInputRequestsReducer, "settingInputRequestsReducer");
41072
41315
  var useSettingInputRequests = /* @__PURE__ */ __name(() => {
41073
- const [settingInputRequests, dispatchSettingInputRequests] = (0, import_react148.useReducer)(
41316
+ const [settingInputRequests, dispatchSettingInputRequests] = (0, import_react147.useReducer)(
41074
41317
  settingInputRequestsReducer,
41075
41318
  []
41076
41319
  );
41077
- const addSettingInputRequest = (0, import_react148.useCallback)(
41320
+ const addSettingInputRequest = (0, import_react147.useCallback)(
41078
41321
  (original) => {
41079
41322
  const wrappedRequest = {
41080
41323
  settingName: original.settingName,
@@ -41121,11 +41364,11 @@ function pluginChoiceRequestsReducer(state, action) {
41121
41364
  }
41122
41365
  __name(pluginChoiceRequestsReducer, "pluginChoiceRequestsReducer");
41123
41366
  var usePluginChoiceRequests = /* @__PURE__ */ __name(() => {
41124
- const [pluginChoiceRequests, dispatchPluginChoiceRequests] = (0, import_react148.useReducer)(
41367
+ const [pluginChoiceRequests, dispatchPluginChoiceRequests] = (0, import_react147.useReducer)(
41125
41368
  pluginChoiceRequestsReducer,
41126
41369
  []
41127
41370
  );
41128
- const addPluginChoiceRequest = (0, import_react148.useCallback)(
41371
+ const addPluginChoiceRequest = (0, import_react147.useCallback)(
41129
41372
  (original) => {
41130
41373
  const wrappedRequest = {
41131
41374
  marketplaceName: original.marketplaceName,
@@ -41159,12 +41402,12 @@ var usePluginChoiceRequests = /* @__PURE__ */ __name(() => {
41159
41402
  };
41160
41403
  }, "usePluginChoiceRequests");
41161
41404
  var useExtensionUpdates = /* @__PURE__ */ __name((extensionManager, addItem, cwd3) => {
41162
- const [extensionsUpdateState, dispatchExtensionStateUpdate] = (0, import_react148.useReducer)(
41405
+ const [extensionsUpdateState, dispatchExtensionStateUpdate] = (0, import_react147.useReducer)(
41163
41406
  extensionUpdatesReducer,
41164
41407
  initialExtensionUpdatesState
41165
41408
  );
41166
41409
  const extensions = extensionManager.getLoadedExtensions();
41167
- (0, import_react148.useEffect)(() => {
41410
+ (0, import_react147.useEffect)(() => {
41168
41411
  (async () => {
41169
41412
  const extensionsToCheck = extensions.filter((extension) => {
41170
41413
  const currentStatus = extensionsUpdateState.extensionStatuses.get(
@@ -41192,7 +41435,7 @@ var useExtensionUpdates = /* @__PURE__ */ __name((extensionManager, addItem, cwd
41192
41435
  extensionsUpdateState.extensionStatuses,
41193
41436
  dispatchExtensionStateUpdate
41194
41437
  ]);
41195
- (0, import_react148.useEffect)(() => {
41438
+ (0, import_react147.useEffect)(() => {
41196
41439
  if (extensionsUpdateState.batchChecksInProgress > 0) {
41197
41440
  return;
41198
41441
  }
@@ -41261,7 +41504,7 @@ var useExtensionUpdates = /* @__PURE__ */ __name((extensionManager, addItem, cwd
41261
41504
  );
41262
41505
  }
41263
41506
  }, [extensions, extensionManager, extensionsUpdateState, addItem, cwd3]);
41264
- const extensionsUpdateStateComputed = (0, import_react148.useMemo)(() => {
41507
+ const extensionsUpdateStateComputed = (0, import_react147.useMemo)(() => {
41265
41508
  const result = /* @__PURE__ */ new Map();
41266
41509
  for (const [
41267
41510
  key,
@@ -41280,11 +41523,11 @@ var useExtensionUpdates = /* @__PURE__ */ __name((extensionManager, addItem, cwd
41280
41523
 
41281
41524
  // packages/cli/src/ui/components/TranscriptView.tsx
41282
41525
  init_esbuild_shims();
41283
- var import_react151 = __toESM(require_react(), 1);
41526
+ var import_react150 = __toESM(require_react(), 1);
41284
41527
 
41285
41528
  // packages/cli/src/ui/components/AlternateScreen.tsx
41286
41529
  init_esbuild_shims();
41287
- var import_react149 = __toESM(require_react(), 1);
41530
+ var import_react148 = __toESM(require_react(), 1);
41288
41531
  var import_jsx_runtime132 = __toESM(require_jsx_runtime(), 1);
41289
41532
  var ENTER_ALT_SCREEN = "\x1B[?1049h";
41290
41533
  var EXIT_ALT_SCREEN = "\x1B[?1049l";
@@ -41297,7 +41540,7 @@ var AlternateScreen = /* @__PURE__ */ __name(({
41297
41540
  }) => {
41298
41541
  const writeRaw = useTerminalOutput();
41299
41542
  const { rows } = useTerminalSize();
41300
- (0, import_react149.useEffect)(() => {
41543
+ (0, import_react148.useEffect)(() => {
41301
41544
  if (disabled || !process.stdout.isTTY) return;
41302
41545
  const safeWrite = /* @__PURE__ */ __name((data) => {
41303
41546
  try {
@@ -41318,7 +41561,7 @@ var AlternateScreen = /* @__PURE__ */ __name(({
41318
41561
 
41319
41562
  // packages/cli/src/ui/components/shared/ErrorBoundary.tsx
41320
41563
  init_esbuild_shims();
41321
- var import_react150 = __toESM(require_react(), 1);
41564
+ var import_react149 = __toESM(require_react(), 1);
41322
41565
  var import_jsx_runtime133 = __toESM(require_jsx_runtime(), 1);
41323
41566
  function normalizeError(error) {
41324
41567
  if (error instanceof Error) {
@@ -41327,7 +41570,7 @@ function normalizeError(error) {
41327
41570
  return new Error(String(error));
41328
41571
  }
41329
41572
  __name(normalizeError, "normalizeError");
41330
- var ErrorBoundary = class extends import_react150.Component {
41573
+ var ErrorBoundary = class extends import_react149.Component {
41331
41574
  static {
41332
41575
  __name(this, "ErrorBoundary");
41333
41576
  }
@@ -41386,11 +41629,11 @@ var TranscriptViewImpl = /* @__PURE__ */ __name(({
41386
41629
  const headerHeight = 1;
41387
41630
  const footerHeight = 1;
41388
41631
  const contentHeight = Math.max(rows - headerHeight - footerHeight, 1);
41389
- const estimatedItemHeight = (0, import_react151.useCallback)(
41632
+ const estimatedItemHeight = (0, import_react150.useCallback)(
41390
41633
  (index) => estimateTranscriptItemHeight(items[index]),
41391
41634
  [items]
41392
41635
  );
41393
- const renderItem = (0, import_react151.useCallback)(
41636
+ const renderItem = (0, import_react150.useCallback)(
41394
41637
  ({ item }) => /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(
41395
41638
  HistoryItemDisplay,
41396
41639
  {
@@ -41403,7 +41646,7 @@ var TranscriptViewImpl = /* @__PURE__ */ __name(({
41403
41646
  [columns]
41404
41647
  );
41405
41648
  const title = t("Transcript");
41406
- const content = (0, import_react151.useMemo)(
41649
+ const content = (0, import_react150.useMemo)(
41407
41650
  () => /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(OverflowProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(
41408
41651
  ScrollableListWithForwardRef,
41409
41652
  {
@@ -41418,7 +41661,7 @@ var TranscriptViewImpl = /* @__PURE__ */ __name(({
41418
41661
  ) }),
41419
41662
  [items, renderItem, estimatedItemHeight, contentHeight]
41420
41663
  );
41421
- const errorFallback = (0, import_react151.useCallback)(
41664
+ const errorFallback = (0, import_react150.useCallback)(
41422
41665
  (error) => /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)(Box_default, { flexDirection: "column", paddingX: 1, children: [
41423
41666
  /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(Text, { color: theme.status.error, bold: true, children: t("Failed to render transcript.") }),
41424
41667
  /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(Text, { color: theme.text.secondary, children: sanitizeTerminalText(error.message) }),
@@ -41429,7 +41672,7 @@ var TranscriptViewImpl = /* @__PURE__ */ __name(({
41429
41672
  ] }),
41430
41673
  []
41431
41674
  );
41432
- const onRenderError = (0, import_react151.useCallback)((error, info) => {
41675
+ const onRenderError = (0, import_react150.useCallback)((error, info) => {
41433
41676
  debugLogger39.error(
41434
41677
  `render error: ${error.message}`,
41435
41678
  info.componentStack ?? ""
@@ -41453,19 +41696,19 @@ var TranscriptViewImpl = /* @__PURE__ */ __name(({
41453
41696
  ] }) })
41454
41697
  ] }) });
41455
41698
  }, "TranscriptViewImpl");
41456
- var TranscriptView = (0, import_react151.memo)(TranscriptViewImpl);
41699
+ var TranscriptView = (0, import_react150.memo)(TranscriptViewImpl);
41457
41700
  TranscriptView.displayName = "TranscriptView";
41458
41701
 
41459
41702
  // packages/cli/src/ui/hooks/useWelcomeBack.ts
41460
41703
  init_esbuild_shims();
41461
- var import_react152 = __toESM(require_react(), 1);
41704
+ var import_react151 = __toESM(require_react(), 1);
41462
41705
  function useWelcomeBack(config, submitQuery, buffer, settings) {
41463
- const [welcomeBackInfo, setWelcomeBackInfo] = (0, import_react152.useState)(null);
41464
- const [showWelcomeBackDialog, setShowWelcomeBackDialog] = (0, import_react152.useState)(false);
41465
- const [welcomeBackChoice, setWelcomeBackChoice] = (0, import_react152.useState)(null);
41466
- const [shouldFillInput, setShouldFillInput] = (0, import_react152.useState)(false);
41467
- const [inputFillText, setInputFillText] = (0, import_react152.useState)(null);
41468
- const checkWelcomeBack = (0, import_react152.useCallback)(async () => {
41706
+ const [welcomeBackInfo, setWelcomeBackInfo] = (0, import_react151.useState)(null);
41707
+ const [showWelcomeBackDialog, setShowWelcomeBackDialog] = (0, import_react151.useState)(false);
41708
+ const [welcomeBackChoice, setWelcomeBackChoice] = (0, import_react151.useState)(null);
41709
+ const [shouldFillInput, setShouldFillInput] = (0, import_react151.useState)(false);
41710
+ const [inputFillText, setInputFillText] = (0, import_react151.useState)(null);
41711
+ const checkWelcomeBack = (0, import_react151.useCallback)(async () => {
41469
41712
  if (settings.ui?.enableWelcomeBack === false) {
41470
41713
  return;
41471
41714
  }
@@ -41484,7 +41727,7 @@ function useWelcomeBack(config, submitQuery, buffer, settings) {
41484
41727
  config.getDebugLogger().debug("Welcome back check failed:", error);
41485
41728
  }
41486
41729
  }, [config, settings.ui?.enableWelcomeBack]);
41487
- const handleWelcomeBackSelection = (0, import_react152.useCallback)(
41730
+ const handleWelcomeBackSelection = (0, import_react151.useCallback)(
41488
41731
  (choice) => {
41489
41732
  setWelcomeBackChoice(choice);
41490
41733
  setShowWelcomeBackDialog(false);
@@ -41508,21 +41751,21 @@ function useWelcomeBack(config, submitQuery, buffer, settings) {
41508
41751
  },
41509
41752
  [config, welcomeBackInfo]
41510
41753
  );
41511
- const handleWelcomeBackClose = (0, import_react152.useCallback)(() => {
41754
+ const handleWelcomeBackClose = (0, import_react151.useCallback)(() => {
41512
41755
  setWelcomeBackChoice("restart");
41513
41756
  setShowWelcomeBackDialog(false);
41514
41757
  }, []);
41515
- const clearInputFill = (0, import_react152.useCallback)(() => {
41758
+ const clearInputFill = (0, import_react151.useCallback)(() => {
41516
41759
  setShouldFillInput(false);
41517
41760
  setInputFillText(null);
41518
41761
  }, []);
41519
- (0, import_react152.useEffect)(() => {
41762
+ (0, import_react151.useEffect)(() => {
41520
41763
  if (shouldFillInput && inputFillText) {
41521
41764
  buffer.setText(inputFillText);
41522
41765
  clearInputFill();
41523
41766
  }
41524
41767
  }, [shouldFillInput, inputFillText, buffer, clearInputFill]);
41525
- (0, import_react152.useEffect)(() => {
41768
+ (0, import_react151.useEffect)(() => {
41526
41769
  checkWelcomeBack();
41527
41770
  }, [checkWelcomeBack]);
41528
41771
  return {
@@ -41543,9 +41786,9 @@ __name(useWelcomeBack, "useWelcomeBack");
41543
41786
 
41544
41787
  // packages/cli/src/ui/hooks/useDialogClose.ts
41545
41788
  init_esbuild_shims();
41546
- var import_react153 = __toESM(require_react(), 1);
41789
+ var import_react152 = __toESM(require_react(), 1);
41547
41790
  function useDialogClose(options) {
41548
- const closeAnyOpenDialog = (0, import_react153.useCallback)(() => {
41791
+ const closeAnyOpenDialog = (0, import_react152.useCallback)(() => {
41549
41792
  if (options.isThemeDialogOpen) {
41550
41793
  options.handleThemeSelect(void 0, "User" /* User */);
41551
41794
  return true;
@@ -41617,14 +41860,14 @@ __name(useDialogClose, "useDialogClose");
41617
41860
 
41618
41861
  // packages/cli/src/ui/hooks/useInitializationAuthError.ts
41619
41862
  init_esbuild_shims();
41620
- var import_react154 = __toESM(require_react(), 1);
41863
+ var import_react153 = __toESM(require_react(), 1);
41621
41864
  var useInitializationAuthError = /* @__PURE__ */ __name((authError, onAuthError) => {
41622
- const hasHandled = (0, import_react154.useRef)(false);
41623
- const authErrorRef = (0, import_react154.useRef)(authError);
41624
- const onAuthErrorRef = (0, import_react154.useRef)(onAuthError);
41865
+ const hasHandled = (0, import_react153.useRef)(false);
41866
+ const authErrorRef = (0, import_react153.useRef)(authError);
41867
+ const onAuthErrorRef = (0, import_react153.useRef)(onAuthError);
41625
41868
  authErrorRef.current = authError;
41626
41869
  onAuthErrorRef.current = onAuthError;
41627
- (0, import_react154.useEffect)(() => {
41870
+ (0, import_react153.useEffect)(() => {
41628
41871
  if (hasHandled.current) {
41629
41872
  return;
41630
41873
  }
@@ -41637,13 +41880,13 @@ var useInitializationAuthError = /* @__PURE__ */ __name((authError, onAuthError)
41637
41880
 
41638
41881
  // packages/cli/src/ui/hooks/useSubagentCreateDialog.ts
41639
41882
  init_esbuild_shims();
41640
- var import_react155 = __toESM(require_react(), 1);
41883
+ var import_react154 = __toESM(require_react(), 1);
41641
41884
  function useSubagentCreateDialog() {
41642
- const [isSubagentCreateDialogOpen, setIsSubagentCreateDialogOpen] = (0, import_react155.useState)(false);
41643
- const openSubagentCreateDialog = (0, import_react155.useCallback)(() => {
41885
+ const [isSubagentCreateDialogOpen, setIsSubagentCreateDialogOpen] = (0, import_react154.useState)(false);
41886
+ const openSubagentCreateDialog = (0, import_react154.useCallback)(() => {
41644
41887
  setIsSubagentCreateDialogOpen(true);
41645
41888
  }, []);
41646
- const closeSubagentCreateDialog = (0, import_react155.useCallback)(() => {
41889
+ const closeSubagentCreateDialog = (0, import_react154.useCallback)(() => {
41647
41890
  setIsSubagentCreateDialogOpen(false);
41648
41891
  }, []);
41649
41892
  return {
@@ -41656,13 +41899,13 @@ __name(useSubagentCreateDialog, "useSubagentCreateDialog");
41656
41899
 
41657
41900
  // packages/cli/src/ui/hooks/useAgentsManagerDialog.ts
41658
41901
  init_esbuild_shims();
41659
- var import_react156 = __toESM(require_react(), 1);
41902
+ var import_react155 = __toESM(require_react(), 1);
41660
41903
  var useAgentsManagerDialog = /* @__PURE__ */ __name(() => {
41661
- const [isAgentsManagerDialogOpen, setIsAgentsManagerDialogOpen] = (0, import_react156.useState)(false);
41662
- const openAgentsManagerDialog = (0, import_react156.useCallback)(() => {
41904
+ const [isAgentsManagerDialogOpen, setIsAgentsManagerDialogOpen] = (0, import_react155.useState)(false);
41905
+ const openAgentsManagerDialog = (0, import_react155.useCallback)(() => {
41663
41906
  setIsAgentsManagerDialogOpen(true);
41664
41907
  }, []);
41665
- const closeAgentsManagerDialog = (0, import_react156.useCallback)(() => {
41908
+ const closeAgentsManagerDialog = (0, import_react155.useCallback)(() => {
41666
41909
  setIsAgentsManagerDialogOpen(false);
41667
41910
  }, []);
41668
41911
  return {
@@ -41674,13 +41917,13 @@ var useAgentsManagerDialog = /* @__PURE__ */ __name(() => {
41674
41917
 
41675
41918
  // packages/cli/src/ui/hooks/useSkillsManagerDialog.ts
41676
41919
  init_esbuild_shims();
41677
- var import_react157 = __toESM(require_react(), 1);
41920
+ var import_react156 = __toESM(require_react(), 1);
41678
41921
  var useSkillsManagerDialog = /* @__PURE__ */ __name(() => {
41679
- const [isSkillsManagerDialogOpen, setIsSkillsManagerDialogOpen] = (0, import_react157.useState)(false);
41680
- const openSkillsManagerDialog = (0, import_react157.useCallback)(() => {
41922
+ const [isSkillsManagerDialogOpen, setIsSkillsManagerDialogOpen] = (0, import_react156.useState)(false);
41923
+ const openSkillsManagerDialog = (0, import_react156.useCallback)(() => {
41681
41924
  setIsSkillsManagerDialogOpen(true);
41682
41925
  }, []);
41683
- const closeSkillsManagerDialog = (0, import_react157.useCallback)(() => {
41926
+ const closeSkillsManagerDialog = (0, import_react156.useCallback)(() => {
41684
41927
  setIsSkillsManagerDialogOpen(false);
41685
41928
  }, []);
41686
41929
  return {
@@ -41692,13 +41935,13 @@ var useSkillsManagerDialog = /* @__PURE__ */ __name(() => {
41692
41935
 
41693
41936
  // packages/cli/src/ui/hooks/useExtensionsManagerDialog.ts
41694
41937
  init_esbuild_shims();
41695
- var import_react158 = __toESM(require_react(), 1);
41938
+ var import_react157 = __toESM(require_react(), 1);
41696
41939
  var useExtensionsManagerDialog = /* @__PURE__ */ __name(() => {
41697
- const [isExtensionsManagerDialogOpen, setIsExtensionsManagerDialogOpen] = (0, import_react158.useState)(false);
41698
- const openExtensionsManagerDialog = (0, import_react158.useCallback)(() => {
41940
+ const [isExtensionsManagerDialogOpen, setIsExtensionsManagerDialogOpen] = (0, import_react157.useState)(false);
41941
+ const openExtensionsManagerDialog = (0, import_react157.useCallback)(() => {
41699
41942
  setIsExtensionsManagerDialogOpen(true);
41700
41943
  }, []);
41701
- const closeExtensionsManagerDialog = (0, import_react158.useCallback)(() => {
41944
+ const closeExtensionsManagerDialog = (0, import_react157.useCallback)(() => {
41702
41945
  setIsExtensionsManagerDialogOpen(false);
41703
41946
  }, []);
41704
41947
  return {
@@ -41710,13 +41953,13 @@ var useExtensionsManagerDialog = /* @__PURE__ */ __name(() => {
41710
41953
 
41711
41954
  // packages/cli/src/ui/hooks/useMcpDialog.ts
41712
41955
  init_esbuild_shims();
41713
- var import_react159 = __toESM(require_react(), 1);
41956
+ var import_react158 = __toESM(require_react(), 1);
41714
41957
  var useMcpDialog = /* @__PURE__ */ __name(() => {
41715
- const [isMcpDialogOpen, setIsMcpDialogOpen] = (0, import_react159.useState)(false);
41716
- const openMcpDialog = (0, import_react159.useCallback)(() => {
41958
+ const [isMcpDialogOpen, setIsMcpDialogOpen] = (0, import_react158.useState)(false);
41959
+ const openMcpDialog = (0, import_react158.useCallback)(() => {
41717
41960
  setIsMcpDialogOpen(true);
41718
41961
  }, []);
41719
- const closeMcpDialog = (0, import_react159.useCallback)(() => {
41962
+ const closeMcpDialog = (0, import_react158.useCallback)(() => {
41720
41963
  setIsMcpDialogOpen(false);
41721
41964
  }, []);
41722
41965
  return {
@@ -41728,13 +41971,13 @@ var useMcpDialog = /* @__PURE__ */ __name(() => {
41728
41971
 
41729
41972
  // packages/cli/src/ui/hooks/useHooksDialog.ts
41730
41973
  init_esbuild_shims();
41731
- var import_react160 = __toESM(require_react(), 1);
41974
+ var import_react159 = __toESM(require_react(), 1);
41732
41975
  var useHooksDialog = /* @__PURE__ */ __name(() => {
41733
- const [isHooksDialogOpen, setIsHooksDialogOpen] = (0, import_react160.useState)(false);
41734
- const openHooksDialog = (0, import_react160.useCallback)(() => {
41976
+ const [isHooksDialogOpen, setIsHooksDialogOpen] = (0, import_react159.useState)(false);
41977
+ const openHooksDialog = (0, import_react159.useCallback)(() => {
41735
41978
  setIsHooksDialogOpen(true);
41736
41979
  }, []);
41737
- const closeHooksDialog = (0, import_react160.useCallback)(() => {
41980
+ const closeHooksDialog = (0, import_react159.useCallback)(() => {
41738
41981
  setIsHooksDialogOpen(false);
41739
41982
  }, []);
41740
41983
  return {
@@ -41746,23 +41989,23 @@ var useHooksDialog = /* @__PURE__ */ __name(() => {
41746
41989
 
41747
41990
  // packages/cli/src/ui/hooks/useStatsDialog.ts
41748
41991
  init_esbuild_shims();
41749
- var import_react161 = __toESM(require_react(), 1);
41992
+ var import_react160 = __toESM(require_react(), 1);
41750
41993
  var useStatsDialog = /* @__PURE__ */ __name(() => {
41751
- const [isStatsDialogOpen, setIsStatsDialogOpen] = (0, import_react161.useState)(false);
41752
- const openStatsDialog = (0, import_react161.useCallback)(() => setIsStatsDialogOpen(true), []);
41753
- const closeStatsDialog = (0, import_react161.useCallback)(() => setIsStatsDialogOpen(false), []);
41994
+ const [isStatsDialogOpen, setIsStatsDialogOpen] = (0, import_react160.useState)(false);
41995
+ const openStatsDialog = (0, import_react160.useCallback)(() => setIsStatsDialogOpen(true), []);
41996
+ const closeStatsDialog = (0, import_react160.useCallback)(() => setIsStatsDialogOpen(false), []);
41754
41997
  return { isStatsDialogOpen, openStatsDialog, closeStatsDialog };
41755
41998
  }, "useStatsDialog");
41756
41999
 
41757
42000
  // packages/cli/src/ui/hooks/useMemoryDialog.ts
41758
42001
  init_esbuild_shims();
41759
- var import_react162 = __toESM(require_react(), 1);
42002
+ var import_react161 = __toESM(require_react(), 1);
41760
42003
  var useMemoryDialog = /* @__PURE__ */ __name(() => {
41761
- const [isMemoryDialogOpen, setIsMemoryDialogOpen] = (0, import_react162.useState)(false);
41762
- const openMemoryDialog = (0, import_react162.useCallback)(() => {
42004
+ const [isMemoryDialogOpen, setIsMemoryDialogOpen] = (0, import_react161.useState)(false);
42005
+ const openMemoryDialog = (0, import_react161.useCallback)(() => {
41763
42006
  setIsMemoryDialogOpen(true);
41764
42007
  }, []);
41765
- const closeMemoryDialog = (0, import_react162.useCallback)(() => {
42008
+ const closeMemoryDialog = (0, import_react161.useCallback)(() => {
41766
42009
  setIsMemoryDialogOpen(false);
41767
42010
  }, []);
41768
42011
  return {
@@ -41774,7 +42017,7 @@ var useMemoryDialog = /* @__PURE__ */ __name(() => {
41774
42017
 
41775
42018
  // packages/cli/src/ui/hooks/useAttentionNotifications.ts
41776
42019
  init_esbuild_shims();
41777
- var import_react163 = __toESM(require_react(), 1);
42020
+ var import_react162 = __toESM(require_react(), 1);
41778
42021
  var LONG_TASK_NOTIFICATION_THRESHOLD_SECONDS = 20;
41779
42022
  var NOTIFICATION_TITLE = "Qwen Code";
41780
42023
  var useAttentionNotifications = /* @__PURE__ */ __name(({
@@ -41789,16 +42032,16 @@ var useAttentionNotifications = /* @__PURE__ */ __name(({
41789
42032
  const terminalBellEnabled = settings?.merged?.general?.terminalBell ?? true;
41790
42033
  const notificationMode = settings?.merged?.general?.notificationMode === "task-complete" ? "task-complete" : "all";
41791
42034
  const approvalNotificationsEnabled = notificationMode === "all";
41792
- const awaitingNotificationSentRef = (0, import_react163.useRef)(false);
41793
- const respondingElapsedRef = (0, import_react163.useRef)(0);
41794
- const idleNotificationSentRef = (0, import_react163.useRef)(false);
41795
- const awaitingToolName = (0, import_react163.useMemo)(() => {
42035
+ const awaitingNotificationSentRef = (0, import_react162.useRef)(false);
42036
+ const respondingElapsedRef = (0, import_react162.useRef)(0);
42037
+ const idleNotificationSentRef = (0, import_react162.useRef)(false);
42038
+ const awaitingToolName = (0, import_react162.useMemo)(() => {
41796
42039
  const awaitingTool = pendingToolCalls?.find(
41797
42040
  (tc) => tc.status === "awaiting_approval"
41798
42041
  );
41799
42042
  return awaitingTool?.request.name;
41800
42043
  }, [pendingToolCalls]);
41801
- (0, import_react163.useEffect)(() => {
42044
+ (0, import_react162.useEffect)(() => {
41802
42045
  if (streamingState === "waiting_for_confirmation" /* WaitingForConfirmation */ && !isFocused && !awaitingNotificationSentRef.current && terminalBellEnabled && approvalNotificationsEnabled) {
41803
42046
  const message = awaitingToolName ? `Qwen Code needs your permission to use ${awaitingToolName}` : "Qwen Code is waiting for your input";
41804
42047
  sendNotification(
@@ -41819,7 +42062,7 @@ var useAttentionNotifications = /* @__PURE__ */ __name(({
41819
42062
  terminal,
41820
42063
  awaitingToolName
41821
42064
  ]);
41822
- (0, import_react163.useEffect)(() => {
42065
+ (0, import_react162.useEffect)(() => {
41823
42066
  if (streamingState === "responding" /* Responding */) {
41824
42067
  respondingElapsedRef.current = elapsedTime;
41825
42068
  idleNotificationSentRef.current = false;
@@ -41972,7 +42215,7 @@ __name(buildTerminalNotification, "buildTerminalNotification");
41972
42215
 
41973
42216
  // packages/cli/src/ui/hooks/useContextualTips.ts
41974
42217
  init_esbuild_shims();
41975
- var import_react164 = __toESM(require_react(), 1);
42218
+ var import_react163 = __toESM(require_react(), 1);
41976
42219
  function useContextualTips({
41977
42220
  streamingState,
41978
42221
  lastPromptTokenCount,
@@ -41982,9 +42225,9 @@ function useContextualTips({
41982
42225
  addItem,
41983
42226
  hideTips
41984
42227
  }) {
41985
- const prevStreamingState = (0, import_react164.useRef)("idle" /* Idle */);
41986
- const hadResponsePhase = (0, import_react164.useRef)(false);
41987
- (0, import_react164.useEffect)(() => {
42228
+ const prevStreamingState = (0, import_react163.useRef)("idle" /* Idle */);
42229
+ const hadResponsePhase = (0, import_react163.useRef)(false);
42230
+ (0, import_react163.useEffect)(() => {
41988
42231
  if (streamingState === "responding" /* Responding */ || prevStreamingState.current === "responding" /* Responding */ && streamingState === "waiting_for_confirmation" /* WaitingForConfirmation */) {
41989
42232
  hadResponsePhase.current = true;
41990
42233
  }
@@ -42120,7 +42363,7 @@ function getResponseCandidateTokens(pendingGeminiHistoryItems) {
42120
42363
  __name(getResponseCandidateTokens, "getResponseCandidateTokens");
42121
42364
  function useStableStickyTodos(todos) {
42122
42365
  const renderKey = getStickyTodosRenderKey(todos);
42123
- const stableTodosRef = (0, import_react165.useRef)(null);
42366
+ const stableTodosRef = (0, import_react164.useRef)(null);
42124
42367
  if (stableTodosRef.current?.renderKey !== renderKey) {
42125
42368
  stableTodosRef.current = { renderKey, todos };
42126
42369
  }
@@ -42150,30 +42393,30 @@ __name(shouldAutoOpenSkillReview, "shouldAutoOpenSkillReview");
42150
42393
  var SHELL_WIDTH_FRACTION = 0.89;
42151
42394
  var SHELL_HEIGHT_PADDING = 10;
42152
42395
  var AppContainer = /* @__PURE__ */ __name((props) => {
42153
- const { settings, config, initializationResult } = props;
42154
- const extensionRefreshState = (0, import_react165.useMemo)(
42396
+ const { settings, config, initializationResult, initialUseVirtualViewport } = props;
42397
+ const extensionRefreshState = (0, import_react164.useMemo)(
42155
42398
  () => props.extensionRefreshState ?? new ExtensionRefreshState(),
42156
42399
  [props.extensionRefreshState]
42157
42400
  );
42158
42401
  const historyManager = useHistory();
42159
- const historyRef = (0, import_react165.useRef)(historyManager.history);
42402
+ const historyRef = (0, import_react164.useRef)(historyManager.history);
42160
42403
  historyRef.current = historyManager.history;
42161
42404
  useMemoryMonitor(historyManager);
42162
- const [debugMessage, setDebugMessage] = (0, import_react165.useState)("");
42163
- const [quittingMessages, setQuittingMessages] = (0, import_react165.useState)(null);
42164
- const [themeError, setThemeError] = (0, import_react165.useState)(
42405
+ const [debugMessage, setDebugMessage] = (0, import_react164.useState)("");
42406
+ const [quittingMessages, setQuittingMessages] = (0, import_react164.useState)(null);
42407
+ const [themeError, setThemeError] = (0, import_react164.useState)(
42165
42408
  initializationResult.themeError
42166
42409
  );
42167
- const [isProcessing, setIsProcessing] = (0, import_react165.useState)(false);
42168
- const [embeddedShellFocused, setEmbeddedShellFocused] = (0, import_react165.useState)(false);
42169
- const [geminiMdFileCount, setGeminiMdFileCount] = (0, import_react165.useState)(
42410
+ const [isProcessing, setIsProcessing] = (0, import_react164.useState)(false);
42411
+ const [embeddedShellFocused, setEmbeddedShellFocused] = (0, import_react164.useState)(false);
42412
+ const [geminiMdFileCount, setGeminiMdFileCount] = (0, import_react164.useState)(
42170
42413
  initializationResult.geminiMdFileCount
42171
42414
  );
42172
- const [shellModeActive, setShellModeActive] = (0, import_react165.useState)(false);
42173
- const [modelSwitchedFromQuotaError, setModelSwitchedFromQuotaError] = (0, import_react165.useState)(false);
42174
- const [historyRemountKey, setHistoryRemountKey] = (0, import_react165.useState)(0);
42175
- const [updateInfo, setUpdateInfo] = (0, import_react165.useState)(null);
42176
- const [isTrustedFolder, setIsTrustedFolder] = (0, import_react165.useState)(
42415
+ const [shellModeActive, setShellModeActive] = (0, import_react164.useState)(false);
42416
+ const [modelSwitchedFromQuotaError, setModelSwitchedFromQuotaError] = (0, import_react164.useState)(false);
42417
+ const [historyRemountKey, setHistoryRemountKey] = (0, import_react164.useState)(0);
42418
+ const [updateInfo, setUpdateInfo] = (0, import_react164.useState)(null);
42419
+ const [isTrustedFolder, setIsTrustedFolder] = (0, import_react164.useState)(
42177
42420
  config.isTrustedFolder()
42178
42421
  );
42179
42422
  const extensionManager = config.getExtensionManager();
@@ -42232,31 +42475,31 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
42232
42475
  config,
42233
42476
  historyManager.addItem
42234
42477
  );
42235
- const [isTrustDialogOpen, setTrustDialogOpen] = (0, import_react165.useState)(false);
42236
- const openTrustDialog = (0, import_react165.useCallback)(() => setTrustDialogOpen(true), []);
42237
- const closeTrustDialog = (0, import_react165.useCallback)(() => setTrustDialogOpen(false), []);
42238
- const [isPermissionsDialogOpen, setPermissionsDialogOpen] = (0, import_react165.useState)(false);
42239
- const openPermissionsDialog = (0, import_react165.useCallback)(
42478
+ const [isTrustDialogOpen, setTrustDialogOpen] = (0, import_react164.useState)(false);
42479
+ const openTrustDialog = (0, import_react164.useCallback)(() => setTrustDialogOpen(true), []);
42480
+ const closeTrustDialog = (0, import_react164.useCallback)(() => setTrustDialogOpen(false), []);
42481
+ const [isPermissionsDialogOpen, setPermissionsDialogOpen] = (0, import_react164.useState)(false);
42482
+ const openPermissionsDialog = (0, import_react164.useCallback)(
42240
42483
  () => setPermissionsDialogOpen(true),
42241
42484
  []
42242
42485
  );
42243
- const closePermissionsDialog = (0, import_react165.useCallback)(
42486
+ const closePermissionsDialog = (0, import_react164.useCallback)(
42244
42487
  () => setPermissionsDialogOpen(false),
42245
42488
  []
42246
42489
  );
42247
- const [currentModel, setCurrentModel] = (0, import_react165.useState)(() => config.getModel());
42248
- const [isConfigInitialized, setConfigInitialized] = (0, import_react165.useState)(false);
42249
- const [userMessages, setUserMessages] = (0, import_react165.useState)([]);
42250
- const [transcriptFreeze, setTranscriptFreeze] = (0, import_react165.useState)(null);
42490
+ const [currentModel, setCurrentModel] = (0, import_react164.useState)(() => config.getModel());
42491
+ const [isConfigInitialized, setConfigInitialized] = (0, import_react164.useState)(false);
42492
+ const [userMessages, setUserMessages] = (0, import_react164.useState)([]);
42493
+ const [transcriptFreeze, setTranscriptFreeze] = (0, import_react164.useState)(null);
42251
42494
  const isTranscriptOpen = transcriptFreeze != null;
42252
- const isTranscriptOpenRef = (0, import_react165.useRef)(isTranscriptOpen);
42495
+ const isTranscriptOpenRef = (0, import_react164.useRef)(isTranscriptOpen);
42253
42496
  isTranscriptOpenRef.current = isTranscriptOpen;
42254
- const closeTranscript = (0, import_react165.useCallback)(() => {
42497
+ const closeTranscript = (0, import_react164.useCallback)(() => {
42255
42498
  setTranscriptFreeze(null);
42256
42499
  }, []);
42257
- const [thoughtExpanded, setThoughtExpanded] = (0, import_react165.useState)(false);
42258
- const [expandedThoughtHeadIds, setExpandedThoughtHeadIds] = (0, import_react165.useState)(() => /* @__PURE__ */ new Set());
42259
- const toggleThoughtExpanded = (0, import_react165.useCallback)((headId) => {
42500
+ const [thoughtExpanded, setThoughtExpanded] = (0, import_react164.useState)(false);
42501
+ const [expandedThoughtHeadIds, setExpandedThoughtHeadIds] = (0, import_react164.useState)(() => /* @__PURE__ */ new Set());
42502
+ const toggleThoughtExpanded = (0, import_react164.useCallback)((headId) => {
42260
42503
  setExpandedThoughtHeadIds((prev) => {
42261
42504
  const next = new Set(prev);
42262
42505
  if (next.has(headId)) {
@@ -42270,10 +42513,10 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
42270
42513
  const { columns: terminalWidth, rows: terminalHeight } = useTerminalSize();
42271
42514
  const { stdin, setRawMode } = use_stdin_default();
42272
42515
  const { stdout } = use_stdout_default();
42273
- const writeRaw = (0, import_react165.useCallback)((data) => {
42274
- process16.stdout.write(data);
42516
+ const writeRaw = (0, import_react164.useCallback)((data) => {
42517
+ process17.stdout.write(data);
42275
42518
  }, []);
42276
- const terminal = (0, import_react165.useMemo)(
42519
+ const terminal = (0, import_react164.useMemo)(
42277
42520
  () => buildTerminalNotification(writeRaw),
42278
42521
  [writeRaw]
42279
42522
  );
@@ -42287,10 +42530,10 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
42287
42530
  const branchName = useGitBranchName(
42288
42531
  worktreeSession?.worktreePath ?? config.getTargetDir()
42289
42532
  );
42290
- const [showWorktreeExitDialog, setShowWorktreeExitDialog] = (0, import_react165.useState)(false);
42291
- const [workflowKeywordActive, setWorkflowKeywordActive] = (0, import_react165.useState)(false);
42292
- const pendingWorktreeNoticeRef = (0, import_react165.useRef)(null);
42293
- const activeWorktree = (0, import_react165.useMemo)(
42533
+ const [showWorktreeExitDialog, setShowWorktreeExitDialog] = (0, import_react164.useState)(false);
42534
+ const [workflowKeywordActive, setWorkflowKeywordActive] = (0, import_react164.useState)(false);
42535
+ const pendingWorktreeNoticeRef = (0, import_react164.useRef)(null);
42536
+ const activeWorktree = (0, import_react164.useMemo)(
42294
42537
  () => worktreeSession ? {
42295
42538
  slug: worktreeSession.slug,
42296
42539
  branch: worktreeSession.worktreeBranch,
@@ -42301,20 +42544,20 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
42301
42544
  } : null,
42302
42545
  [worktreeSession]
42303
42546
  );
42304
- const mainControlsRef = (0, import_react165.useRef)(null);
42305
- const lastTitleRef = (0, import_react165.useRef)(null);
42306
- const [startupWarnings, setStartupWarnings] = (0, import_react165.useState)(
42547
+ const mainControlsRef = (0, import_react164.useRef)(null);
42548
+ const lastTitleRef = (0, import_react164.useRef)(null);
42549
+ const [startupWarnings, setStartupWarnings] = (0, import_react164.useState)(
42307
42550
  () => props.startupWarnings || []
42308
42551
  );
42309
42552
  const staticExtraHeight = 3;
42310
- (0, import_react165.useEffect)(() => {
42553
+ (0, import_react164.useEffect)(() => {
42311
42554
  void loadLowlight().catch((err) => {
42312
42555
  debugLogger40.warn(
42313
42556
  `Failed to load lowlight chunk; code blocks will render as plain text: ${err instanceof Error ? err.message : String(err)}`
42314
42557
  );
42315
42558
  });
42316
42559
  }, []);
42317
- (0, import_react165.useEffect)(() => {
42560
+ (0, import_react164.useEffect)(() => {
42318
42561
  (async () => {
42319
42562
  profileCheckpoint("config_initialize_start");
42320
42563
  await config.initialize();
@@ -42404,7 +42647,7 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
42404
42647
  await ideClient.disconnect();
42405
42648
  });
42406
42649
  }, [config]);
42407
- (0, import_react165.useEffect)(() => {
42650
+ (0, import_react164.useEffect)(() => {
42408
42651
  if (!isConfigInitialized) return void 0;
42409
42652
  const geminiClient2 = config.getGeminiClient();
42410
42653
  if (!geminiClient2) return void 0;
@@ -42468,11 +42711,11 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
42468
42711
  clearTimeout(finalizeCap);
42469
42712
  };
42470
42713
  }, [isConfigInitialized, config]);
42471
- const isIdleRef = (0, import_react165.useRef)(true);
42472
- const availableTerminalHeightRef = (0, import_react165.useRef)(0);
42473
- const terminalWidthRef = (0, import_react165.useRef)(0);
42474
- const updateHandlerRef = (0, import_react165.useRef)(null);
42475
- (0, import_react165.useEffect)(() => {
42714
+ const isIdleRef = (0, import_react164.useRef)(true);
42715
+ const availableTerminalHeightRef = (0, import_react164.useRef)(0);
42716
+ const terminalWidthRef = (0, import_react164.useRef)(0);
42717
+ const updateHandlerRef = (0, import_react164.useRef)(null);
42718
+ (0, import_react164.useEffect)(() => {
42476
42719
  const handler = setUpdateHandler(
42477
42720
  historyManager.addItem,
42478
42721
  setUpdateInfo,
@@ -42481,13 +42724,13 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
42481
42724
  updateHandlerRef.current = handler;
42482
42725
  return () => handler?.cleanup();
42483
42726
  }, [historyManager.addItem]);
42484
- const { inputWidth, suggestionsWidth } = (0, import_react165.useMemo)(() => {
42727
+ const { inputWidth, suggestionsWidth } = (0, import_react164.useMemo)(() => {
42485
42728
  const { inputWidth: inputWidth2, suggestionsWidth: suggestionsWidth2 } = calculatePromptWidths(terminalWidth);
42486
42729
  return { inputWidth: inputWidth2, suggestionsWidth: suggestionsWidth2 };
42487
42730
  }, [terminalWidth]);
42488
42731
  const mainAreaWidth = Math.min(terminalWidth - 4, 100);
42489
42732
  const staticAreaMaxItemHeight = Math.max(terminalHeight * 4, 100);
42490
- const isValidPath = (0, import_react165.useCallback)((filePath) => {
42733
+ const isValidPath = (0, import_react164.useCallback)((filePath) => {
42491
42734
  try {
42492
42735
  return fs20.existsSync(filePath) && fs20.statSync(filePath).isFile();
42493
42736
  } catch (_e) {
@@ -42495,6 +42738,27 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
42495
42738
  }
42496
42739
  }, []);
42497
42740
  const preferredEditor = usePreferredEditor();
42741
+ const restoredSubmissionRef = (0, import_react164.useRef)(null);
42742
+ const submittedPromptProvenanceUnavailableRef = (0, import_react164.useRef)(false);
42743
+ const setBufferTextRef = (0, import_react164.useRef)(null);
42744
+ const invalidateSubmittedPromptProvenance = (0, import_react164.useCallback)(() => {
42745
+ restoredSubmissionRef.current = null;
42746
+ submittedPromptProvenanceUnavailableRef.current = true;
42747
+ }, []);
42748
+ const handleBufferChange = (0, import_react164.useCallback)((text) => {
42749
+ if (text.length === 0) {
42750
+ if (restoredSubmissionRef.current !== null || submittedPromptProvenanceUnavailableRef.current) {
42751
+ setBufferTextRef.current?.("", { clearUndoHistory: true });
42752
+ }
42753
+ restoredSubmissionRef.current = null;
42754
+ submittedPromptProvenanceUnavailableRef.current = false;
42755
+ return;
42756
+ }
42757
+ if (restoredSubmissionRef.current !== null && restoredSubmissionRef.current.modelText !== text) {
42758
+ restoredSubmissionRef.current = null;
42759
+ submittedPromptProvenanceUnavailableRef.current = true;
42760
+ }
42761
+ }, []);
42498
42762
  const buffer = useTextBuffer({
42499
42763
  initialText: "",
42500
42764
  viewport: { height: 10, width: inputWidth },
@@ -42502,22 +42766,25 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
42502
42766
  setRawMode,
42503
42767
  isValidPath,
42504
42768
  shellModeActive,
42505
- preferredEditor
42769
+ preferredEditor,
42770
+ onChange: handleBufferChange
42506
42771
  });
42507
- const restoredPromptStashTargetsRef = (0, import_react165.useRef)(/* @__PURE__ */ new Set());
42772
+ const setBufferText = buffer.setText;
42773
+ setBufferTextRef.current = setBufferText;
42774
+ const restoredPromptStashTargetsRef = (0, import_react164.useRef)(/* @__PURE__ */ new Set());
42508
42775
  const promptStashTargetDir = config.getTargetDir();
42509
- (0, import_react165.useEffect)(() => {
42776
+ (0, import_react164.useEffect)(() => {
42510
42777
  if (restoredPromptStashTargetsRef.current.has(promptStashTargetDir)) {
42511
42778
  return;
42512
42779
  }
42513
42780
  restoredPromptStashTargetsRef.current.add(promptStashTargetDir);
42514
- restorePromptStash(
42515
- promptStashTargetDir,
42516
- buffer.text,
42517
- (text) => buffer.setText(text)
42518
- );
42781
+ restorePromptStash(promptStashTargetDir, buffer.text, (text) => {
42782
+ restoredSubmissionRef.current = null;
42783
+ submittedPromptProvenanceUnavailableRef.current = true;
42784
+ buffer.setText(text);
42785
+ });
42519
42786
  }, [buffer, promptStashTargetDir]);
42520
- (0, import_react165.useEffect)(() => {
42787
+ (0, import_react164.useEffect)(() => {
42521
42788
  const fetchUserMessages = /* @__PURE__ */ __name(async () => {
42522
42789
  const pastMessagesRaw = await logger?.getPreviousUserMessages() || [];
42523
42790
  const currentSessionUserMessages = realUserPromptTexts(
@@ -42531,12 +42798,18 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
42531
42798
  }, "fetchUserMessages");
42532
42799
  fetchUserMessages();
42533
42800
  }, [historyManager.history, logger]);
42534
- const remountStaticHistory = (0, import_react165.useCallback)(() => {
42801
+ const remountStaticHistory = (0, import_react164.useCallback)(() => {
42535
42802
  setHistoryRemountKey((prev) => prev + 1);
42536
42803
  }, []);
42537
- const useTerminalBuffer = settings.merged.ui?.useTerminalBuffer ?? false;
42804
+ const [useTerminalBuffer] = (0, import_react164.useState)(
42805
+ () => initialUseVirtualViewport ?? shouldUseVirtualViewport(
42806
+ settings.merged.ui?.useTerminalBuffer,
42807
+ config.getScreenReader(),
42808
+ isInteractiveTerminal()
42809
+ )
42810
+ );
42538
42811
  const showScrollbar = settings.merged.ui?.showScrollbar ?? true;
42539
- const refreshStatic = (0, import_react165.useCallback)(() => {
42812
+ const refreshStatic = (0, import_react164.useCallback)(() => {
42540
42813
  if (isTranscriptOpenRef.current) {
42541
42814
  return;
42542
42815
  }
@@ -42545,15 +42818,15 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
42545
42818
  }
42546
42819
  remountStaticHistory();
42547
42820
  }, [useTerminalBuffer, remountStaticHistory, stdout]);
42548
- const prevTranscriptOpenRef = (0, import_react165.useRef)(isTranscriptOpen);
42821
+ const prevTranscriptOpenRef = (0, import_react164.useRef)(isTranscriptOpen);
42549
42822
  const wasOpenPrevRender = prevTranscriptOpenRef.current;
42550
42823
  prevTranscriptOpenRef.current = isTranscriptOpen;
42551
- const transcriptCloseCountRef = (0, import_react165.useRef)(0);
42824
+ const transcriptCloseCountRef = (0, import_react164.useRef)(0);
42552
42825
  if (wasOpenPrevRender && !isTranscriptOpen) {
42553
42826
  transcriptCloseCountRef.current += 1;
42554
42827
  }
42555
42828
  const transcriptCloseCount = transcriptCloseCountRef.current;
42556
- (0, import_react165.useEffect)(() => {
42829
+ (0, import_react164.useEffect)(() => {
42557
42830
  if (transcriptCloseCount === 0 || useTerminalBuffer) {
42558
42831
  return void 0;
42559
42832
  }
@@ -42566,8 +42839,8 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
42566
42839
  }, 0);
42567
42840
  return () => clearTimeout(id);
42568
42841
  }, [transcriptCloseCount, useTerminalBuffer, stdout, remountStaticHistory]);
42569
- const lastNotifiedModelRef = (0, import_react165.useRef)(currentModel);
42570
- (0, import_react165.useEffect)(() => {
42842
+ const lastNotifiedModelRef = (0, import_react164.useRef)(currentModel);
42843
+ (0, import_react164.useEffect)(() => {
42571
42844
  const unsubscribe = config.onModelChange((model) => {
42572
42845
  if (lastNotifiedModelRef.current === model) {
42573
42846
  return;
@@ -42605,7 +42878,7 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
42605
42878
  const { onAuthError, openAuthDialog, closeAuthDialog } = authActions;
42606
42879
  const { isAuthDialogOpen, isAuthenticating, pendingAuthType } = authState;
42607
42880
  useInitializationAuthError(initializationResult.authError, onAuthError);
42608
- (0, import_react165.useEffect)(() => {
42881
+ (0, import_react164.useEffect)(() => {
42609
42882
  const currentAuthType = config.getModelsConfig().getCurrentAuthType();
42610
42883
  if (settings.merged.security?.auth?.enforcedType && currentAuthType && settings.merged.security?.auth.enforcedType !== currentAuthType) {
42611
42884
  onAuthError(
@@ -42619,7 +42892,7 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
42619
42892
  );
42620
42893
  }
42621
42894
  }, [settings.merged.security?.auth?.enforcedType, config, onAuthError]);
42622
- const [editorError, setEditorError] = (0, import_react165.useState)(null);
42895
+ const [editorError, setEditorError] = (0, import_react164.useState)(null);
42623
42896
  const {
42624
42897
  isEditorDialogOpen,
42625
42898
  openEditorDialog,
@@ -42627,18 +42900,18 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
42627
42900
  exitEditorDialog
42628
42901
  } = useEditorSettings(settings, setEditorError, historyManager.addItem);
42629
42902
  const { isSettingsDialogOpen, openSettingsDialog, closeSettingsDialog } = useSettingsCommand();
42630
- const [isStatusLineDialogOpen, setStatusLineDialogOpen] = (0, import_react165.useState)(false);
42631
- const openStatusLineDialog = (0, import_react165.useCallback)(
42903
+ const [isStatusLineDialogOpen, setStatusLineDialogOpen] = (0, import_react164.useState)(false);
42904
+ const openStatusLineDialog = (0, import_react164.useCallback)(
42632
42905
  () => setStatusLineDialogOpen(true),
42633
42906
  []
42634
42907
  );
42635
- const closeStatusLineDialog = (0, import_react165.useCallback)(
42908
+ const closeStatusLineDialog = (0, import_react164.useCallback)(
42636
42909
  () => setStatusLineDialogOpen(false),
42637
42910
  []
42638
42911
  );
42639
- const [statusLineSettingsVersion, setStatusLineSettingsVersion] = (0, import_react165.useState)(0);
42640
- const [statusLineConfigOverride, setStatusLineConfigOverride] = (0, import_react165.useState)(void 0);
42641
- const notifyStatusLineSettingsChanged = (0, import_react165.useCallback)(
42912
+ const [statusLineSettingsVersion, setStatusLineSettingsVersion] = (0, import_react164.useState)(0);
42913
+ const [statusLineConfigOverride, setStatusLineConfigOverride] = (0, import_react164.useState)(void 0);
42914
+ const notifyStatusLineSettingsChanged = (0, import_react164.useCallback)(
42642
42915
  (newConfig) => {
42643
42916
  setStatusLineConfigOverride(newConfig);
42644
42917
  setStatusLineSettingsVersion((version) => version + 1);
@@ -42657,8 +42930,8 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
42657
42930
  closeModelDialog
42658
42931
  } = useModelCommand();
42659
42932
  const { activeArenaDialog, openArenaDialog, closeArenaDialog } = useArenaCommand();
42660
- const [sessionName, setSessionName] = (0, import_react165.useState)(null);
42661
- (0, import_react165.useEffect)(() => {
42933
+ const [sessionName, setSessionName] = (0, import_react164.useState)(null);
42934
+ (0, import_react164.useEffect)(() => {
42662
42935
  const chatRecordingService = config.getChatRecordingService();
42663
42936
  if (!chatRecordingService?.setTitleRecordedCallback) return;
42664
42937
  const existingCallback = chatRecordingService.getTitleRecordedCallback();
@@ -42675,7 +42948,7 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
42675
42948
  };
42676
42949
  }, [config]);
42677
42950
  const addHistoryItem = historyManager.addItem;
42678
- (0, import_react165.useEffect)(() => {
42951
+ (0, import_react164.useEffect)(() => {
42679
42952
  if (typeof config.onChatRecordingFailure !== "function") return;
42680
42953
  return config.onChatRecordingFailure(() => {
42681
42954
  addHistoryItem(
@@ -42719,12 +42992,17 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
42719
42992
  config,
42720
42993
  addItem: historyManager.addItem
42721
42994
  });
42722
- const [isHelpDialogOpen, setHelpDialogOpen] = (0, import_react165.useState)(false);
42723
- const [activeHelpTab, setHelpTab] = (0, import_react165.useState)("general");
42724
- const openHelpDialog = (0, import_react165.useCallback)(() => setHelpDialogOpen(true), []);
42725
- const closeHelpDialog = (0, import_react165.useCallback)(() => setHelpDialogOpen(false), []);
42995
+ const [isHelpDialogOpen, setHelpDialogOpen] = (0, import_react164.useState)(false);
42996
+ const [activeHelpTab, setHelpTab] = (0, import_react164.useState)("general");
42997
+ const openHelpDialog = (0, import_react164.useCallback)(() => setHelpDialogOpen(true), []);
42998
+ const closeHelpDialog = (0, import_react164.useCallback)(() => setHelpDialogOpen(false), []);
42726
42999
  const { vimEnabled, vimMode } = useVimModeState();
42727
43000
  const { toggleVimEnabled } = useVimModeActions();
43001
+ (0, import_react164.useLayoutEffect)(() => {
43002
+ if (vimEnabled && buffer.text.length > 0) {
43003
+ invalidateSubmittedPromptProvenance();
43004
+ }
43005
+ }, [buffer.text, invalidateSubmittedPromptProvenance, vimEnabled]);
42728
43006
  const {
42729
43007
  isSubagentCreateDialogOpen,
42730
43008
  openSubagentCreateDialog,
@@ -42748,31 +43026,31 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
42748
43026
  const { isMcpDialogOpen, openMcpDialog, closeMcpDialog } = useMcpDialog();
42749
43027
  const { isHooksDialogOpen, openHooksDialog, closeHooksDialog } = useHooksDialog();
42750
43028
  const { isStatsDialogOpen, openStatsDialog, closeStatsDialog } = useStatsDialog();
42751
- const openRewindSelectorRef = (0, import_react165.useRef)(() => {
43029
+ const openRewindSelectorRef = (0, import_react164.useRef)(() => {
42752
43030
  });
42753
- const cancelOngoingRequestRef = (0, import_react165.useRef)(() => {
43031
+ const cancelOngoingRequestRef = (0, import_react164.useRef)(() => {
42754
43032
  });
42755
- const [isDiffDialogOpen, setIsDiffDialogOpen] = (0, import_react165.useState)(false);
42756
- const openDiffDialog = (0, import_react165.useCallback)(() => {
43033
+ const [isDiffDialogOpen, setIsDiffDialogOpen] = (0, import_react164.useState)(false);
43034
+ const openDiffDialog = (0, import_react164.useCallback)(() => {
42757
43035
  setIsDiffDialogOpen(true);
42758
43036
  }, []);
42759
- const closeDiffDialog = (0, import_react165.useCallback)(() => {
43037
+ const closeDiffDialog = (0, import_react164.useCallback)(() => {
42760
43038
  setIsDiffDialogOpen(false);
42761
43039
  }, []);
42762
- const [isSkillReviewDialogOpen, setIsSkillReviewDialogOpen] = (0, import_react165.useState)(false);
42763
- const [skillReviewPending, setSkillReviewPending] = (0, import_react165.useState)(null);
42764
- const skillReviewDismissedTaskIdsRef = (0, import_react165.useRef)(/* @__PURE__ */ new Set());
42765
- const dismissSkillReviewDialog = (0, import_react165.useCallback)(() => {
43040
+ const [isSkillReviewDialogOpen, setIsSkillReviewDialogOpen] = (0, import_react164.useState)(false);
43041
+ const [skillReviewPending, setSkillReviewPending] = (0, import_react164.useState)(null);
43042
+ const skillReviewDismissedTaskIdsRef = (0, import_react164.useRef)(/* @__PURE__ */ new Set());
43043
+ const dismissSkillReviewDialog = (0, import_react164.useCallback)(() => {
42766
43044
  if (skillReviewPending) {
42767
43045
  skillReviewDismissedTaskIdsRef.current.add(skillReviewPending.taskId);
42768
43046
  }
42769
43047
  setIsSkillReviewDialogOpen(false);
42770
43048
  }, [skillReviewPending]);
42771
- const closeSkillReviewDialog = (0, import_react165.useCallback)(
43049
+ const closeSkillReviewDialog = (0, import_react164.useCallback)(
42772
43050
  () => setIsSkillReviewDialogOpen(false),
42773
43051
  []
42774
43052
  );
42775
- const acceptPendingSkill = (0, import_react165.useCallback)(
43053
+ const acceptPendingSkill = (0, import_react164.useCallback)(
42776
43054
  (skillName) => {
42777
43055
  if (!skillReviewPending) return;
42778
43056
  void config.getMemoryManager().acceptPendingSkillFromTask(skillReviewPending.taskId, skillName).catch(() => {
@@ -42780,7 +43058,7 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
42780
43058
  },
42781
43059
  [config, skillReviewPending]
42782
43060
  );
42783
- const rejectPendingSkill = (0, import_react165.useCallback)(
43061
+ const rejectPendingSkill = (0, import_react164.useCallback)(
42784
43062
  (skillName) => {
42785
43063
  if (!skillReviewPending) return;
42786
43064
  void config.getMemoryManager().rejectPendingSkillFromTask(skillReviewPending.taskId, skillName).catch(() => {
@@ -42788,7 +43066,7 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
42788
43066
  },
42789
43067
  [config, skillReviewPending]
42790
43068
  );
42791
- (0, import_react165.useEffect)(() => {
43069
+ (0, import_react164.useEffect)(() => {
42792
43070
  const mgr = config.getMemoryManager();
42793
43071
  const projectRoot = config.getProjectRoot();
42794
43072
  let lastSig = "";
@@ -42822,7 +43100,7 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
42822
43100
  refresh();
42823
43101
  return unsub;
42824
43102
  }, [config]);
42825
- const slashCommandActions = (0, import_react165.useMemo)(
43103
+ const slashCommandActions = (0, import_react164.useMemo)(
42826
43104
  () => ({
42827
43105
  openAuthDialog,
42828
43106
  openThemeDialog,
@@ -42846,7 +43124,7 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
42846
43124
  config.getGeminiClient()?.requestShutdown();
42847
43125
  setTimeout(async () => {
42848
43126
  await runExitCleanup();
42849
- process16.exit(0);
43127
+ process17.exit(0);
42850
43128
  }, 100);
42851
43129
  }, "quit"),
42852
43130
  setDebugMessage,
@@ -42932,13 +43210,13 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
42932
43210
  setSessionName,
42933
43211
  extensionRefreshState
42934
43212
  );
42935
- const onDebugMessage = (0, import_react165.useCallback)(
43213
+ const onDebugMessage = (0, import_react164.useCallback)(
42936
43214
  (message) => {
42937
43215
  config.getDebugLogger().debug(message);
42938
43216
  },
42939
43217
  [config]
42940
43218
  );
42941
- const handleWorktreeExit = (0, import_react165.useCallback)(
43219
+ const handleWorktreeExit = (0, import_react164.useCallback)(
42942
43220
  async (choice) => {
42943
43221
  if (choice === "cancel") {
42944
43222
  setShowWorktreeExitDialog(false);
@@ -43003,7 +43281,7 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
43003
43281
  },
43004
43282
  [activeWorktree, config, handleSlashCommand, historyManager]
43005
43283
  );
43006
- const performMemoryRefresh = (0, import_react165.useCallback)(async () => {
43284
+ const performMemoryRefresh = (0, import_react164.useCallback)(async () => {
43007
43285
  if (config.isSafeMode()) {
43008
43286
  config.setUserMemory("");
43009
43287
  config.setGeminiMdFileCount(0);
@@ -43029,7 +43307,7 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
43029
43307
  );
43030
43308
  try {
43031
43309
  const { memoryContent, fileCount, conditionalRules, projectRoot } = await loadHierarchicalGeminiMemory(
43032
- process16.cwd(),
43310
+ process17.cwd(),
43033
43311
  settings.merged.context?.loadFromIncludeDirectories ? config.getWorkspaceContext().getDirectories() : [],
43034
43312
  config.getFileService(),
43035
43313
  config.getExtensionContextFilePaths(),
@@ -43075,10 +43353,10 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
43075
43353
  debugLogger40.error("Error refreshing memory:", error);
43076
43354
  }
43077
43355
  }, [config, historyManager, settings.merged]);
43078
- const cancelHandlerRef = (0, import_react165.useRef)(() => {
43356
+ const cancelHandlerRef = (0, import_react164.useRef)(() => {
43079
43357
  });
43080
- const midTurnDrainRef = (0, import_react165.useRef)(null);
43081
- const midTurnRestoreRef = (0, import_react165.useRef)(null);
43358
+ const midTurnDrainRef = (0, import_react164.useRef)(null);
43359
+ const midTurnRestoreRef = (0, import_react164.useRef)(null);
43082
43360
  const {
43083
43361
  streamingState,
43084
43362
  submitQuery,
@@ -43121,13 +43399,13 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
43121
43399
  );
43122
43400
  cancelOngoingRequestRef.current = cancelOngoingRequest;
43123
43401
  isIdleRef.current = streamingState === "idle" /* Idle */;
43124
- (0, import_react165.useEffect)(() => {
43402
+ (0, import_react164.useEffect)(() => {
43125
43403
  if (streamingState === "idle" /* Idle */) {
43126
43404
  updateHandlerRef.current?.flush();
43127
43405
  setWorkflowKeywordActive(false);
43128
43406
  }
43129
43407
  }, [streamingState]);
43130
- (0, import_react165.useEffect)(() => {
43408
+ (0, import_react164.useEffect)(() => {
43131
43409
  if (shouldAutoOpenSkillReview({
43132
43410
  pending: skillReviewPending,
43133
43411
  streamingState,
@@ -43139,7 +43417,7 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
43139
43417
  }
43140
43418
  }, [skillReviewPending, streamingState, isMemoryDialogOpen, config]);
43141
43419
  const tipsDisabled = !!(settings.merged.ui?.hideTips || config.getScreenReader());
43142
- const tipHistory = (0, import_react165.useMemo)(
43420
+ const tipHistory = (0, import_react164.useMemo)(
43143
43421
  () => tipsDisabled ? null : getTipHistory(),
43144
43422
  [tipsDisabled]
43145
43423
  );
@@ -43152,7 +43430,7 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
43152
43430
  addItem: historyManager.addItem,
43153
43431
  hideTips: tipsDisabled
43154
43432
  });
43155
- const [hasTabConsumer, setHasTabConsumer] = (0, import_react165.useState)(false);
43433
+ const [hasTabConsumer, setHasTabConsumer] = (0, import_react164.useState)(false);
43156
43434
  const agentViewState = useAgentViewState();
43157
43435
  const {
43158
43436
  dialogOpen: bgTasksDialogOpen,
@@ -43160,11 +43438,11 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
43160
43438
  livePanelFocused: bgLivePanelFocused
43161
43439
  } = useBackgroundTaskViewState();
43162
43440
  const { closeDialog: closeBgTasksDialog } = useBackgroundTaskViewActions();
43163
- const [promptSuggestion, setPromptSuggestion] = (0, import_react165.useState)(null);
43164
- const prevStreamingStateRef = (0, import_react165.useRef)("idle" /* Idle */);
43165
- const speculationRef = (0, import_react165.useRef)(IDLE_SPECULATION);
43166
- const suggestionAbortRef = (0, import_react165.useRef)(null);
43167
- const abortPromptSuggestion = (0, import_react165.useCallback)(() => {
43441
+ const [promptSuggestion, setPromptSuggestion] = (0, import_react164.useState)(null);
43442
+ const prevStreamingStateRef = (0, import_react164.useRef)("idle" /* Idle */);
43443
+ const speculationRef = (0, import_react164.useRef)(IDLE_SPECULATION);
43444
+ const suggestionAbortRef = (0, import_react164.useRef)(null);
43445
+ const abortPromptSuggestion = (0, import_react164.useCallback)(() => {
43168
43446
  suggestionAbortRef.current?.abort();
43169
43447
  suggestionAbortRef.current = null;
43170
43448
  if (speculationRef.current.status !== "idle") {
@@ -43188,26 +43466,42 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
43188
43466
  popAllMessages,
43189
43467
  restoreMessages,
43190
43468
  drainQueue,
43191
- popNextSegment
43469
+ popNextTurn
43192
43470
  } = useMessageQueue();
43471
+ const submitUserQuery = (0, import_react164.useCallback)(
43472
+ (submission) => submitQuery(
43473
+ submission.modelText,
43474
+ "userQuery" /* UserQuery */,
43475
+ void 0,
43476
+ submission.submittedPrompt === void 0 ? void 0 : { submittedPrompt: submission.submittedPrompt }
43477
+ ),
43478
+ [submitQuery]
43479
+ );
43480
+ const popAllQueuedMessages = (0, import_react164.useCallback)(() => {
43481
+ const submission = popAllMessages();
43482
+ if (submission === null) return null;
43483
+ restoredSubmissionRef.current = submission;
43484
+ submittedPromptProvenanceUnavailableRef.current = false;
43485
+ return submission.modelText;
43486
+ }, [popAllMessages]);
43193
43487
  midTurnDrainRef.current = drainQueue;
43194
43488
  midTurnRestoreRef.current = restoreMessages;
43195
43489
  const remoteInput = useRemoteInput();
43196
- (0, import_react165.useEffect)(() => {
43490
+ (0, import_react164.useEffect)(() => {
43197
43491
  if (!remoteInput) return;
43198
43492
  remoteInput.setSubmitFn((text) => submitQuery(text));
43199
43493
  }, [remoteInput, submitQuery]);
43200
- (0, import_react165.useEffect)(() => {
43494
+ (0, import_react164.useEffect)(() => {
43201
43495
  if (!remoteInput) return;
43202
43496
  if (streamingState === "idle" /* Idle */) {
43203
43497
  remoteInput.notifyIdle();
43204
43498
  }
43205
43499
  }, [remoteInput, streamingState]);
43206
43500
  const dualOutput = useDualOutput();
43207
- const confirmRequestMap = (0, import_react165.useRef)(/* @__PURE__ */ new Map());
43208
- const confirmCallIdMap = (0, import_react165.useRef)(/* @__PURE__ */ new Map());
43209
- const confirmEmitted = (0, import_react165.useRef)(/* @__PURE__ */ new Set());
43210
- (0, import_react165.useEffect)(() => {
43501
+ const confirmRequestMap = (0, import_react164.useRef)(/* @__PURE__ */ new Map());
43502
+ const confirmCallIdMap = (0, import_react164.useRef)(/* @__PURE__ */ new Map());
43503
+ const confirmEmitted = (0, import_react164.useRef)(/* @__PURE__ */ new Set());
43504
+ (0, import_react164.useEffect)(() => {
43211
43505
  if (!dualOutput || !dualOutput.isConnected) return;
43212
43506
  for (const tc of pendingToolCalls) {
43213
43507
  if (tc.status === "awaiting_approval" && !confirmEmitted.current.has(tc.request.callId)) {
@@ -43236,11 +43530,11 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
43236
43530
  }
43237
43531
  }
43238
43532
  }, [dualOutput, pendingToolCalls]);
43239
- const pendingToolCallsRef = (0, import_react165.useRef)(pendingToolCalls);
43533
+ const pendingToolCallsRef = (0, import_react164.useRef)(pendingToolCalls);
43240
43534
  pendingToolCallsRef.current = pendingToolCalls;
43241
- const dualOutputRef = (0, import_react165.useRef)(dualOutput);
43535
+ const dualOutputRef = (0, import_react164.useRef)(dualOutput);
43242
43536
  dualOutputRef.current = dualOutput;
43243
- (0, import_react165.useEffect)(() => {
43537
+ (0, import_react164.useEffect)(() => {
43244
43538
  if (!remoteInput) return;
43245
43539
  remoteInput.setConfirmationHandler(
43246
43540
  (requestId, allowed) => {
@@ -43280,8 +43574,22 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
43280
43574
  });
43281
43575
  };
43282
43576
  }, [remoteInput]);
43283
- const handleFinalSubmit = (0, import_react165.useCallback)(
43577
+ const handleFinalSubmit = (0, import_react164.useCallback)(
43284
43578
  (submittedValue, options) => {
43579
+ const consumesComposerState = options !== void 0;
43580
+ const restoredSubmission = consumesComposerState ? restoredSubmissionRef.current : null;
43581
+ const submittedPromptProvenanceUnavailable = consumesComposerState && submittedPromptProvenanceUnavailableRef.current;
43582
+ if (consumesComposerState) {
43583
+ restoredSubmissionRef.current = null;
43584
+ submittedPromptProvenanceUnavailableRef.current = false;
43585
+ }
43586
+ const submittedPromptCandidate = options?.submittedPrompt;
43587
+ const provenanceEnabled = !vimEnabled && submittedPromptCandidate !== void 0;
43588
+ const trimmedSubmittedPrompt = submittedPromptCandidate?.trim();
43589
+ const submittedPrompt = submittedPromptProvenanceUnavailable || !provenanceEnabled ? void 0 : restoredSubmission === null ? trimmedSubmittedPrompt || void 0 : restoredSubmission.modelText === submittedValue ? restoredSubmission.submittedPrompt : void 0;
43590
+ if (restoredSubmission !== null || submittedPromptProvenanceUnavailable) {
43591
+ setBufferText("", { clearUndoHistory: true });
43592
+ }
43285
43593
  if (agentViewState.activeView !== "main") {
43286
43594
  const agent = agentViewState.agents.get(agentViewState.activeView);
43287
43595
  if (agent) {
@@ -43327,11 +43635,14 @@ ${buildWorkflowSteeringNotice()}
43327
43635
  ` + submittedValue;
43328
43636
  }
43329
43637
  if (options?.deferUntilIdle) {
43330
- addMessage(submittedValue, true);
43638
+ addMessage(submittedValue, true, submittedPrompt);
43331
43639
  return;
43332
43640
  }
43333
43641
  if (streamingState === "responding" /* Responding */ && isBtwCommand(submittedValue)) {
43334
- void submitQuery(submittedValue);
43642
+ void submitUserQuery({
43643
+ modelText: submittedValue,
43644
+ submittedPrompt
43645
+ });
43335
43646
  return;
43336
43647
  }
43337
43648
  const spec = speculationRef.current;
@@ -43405,7 +43716,7 @@ ${buildWorkflowSteeringNotice()}
43405
43716
  setPromptSuggestion(result.nextSuggestion);
43406
43717
  }
43407
43718
  }).catch(() => {
43408
- addMessage(submittedValue);
43719
+ addMessage(submittedValue, false, submittedPrompt);
43409
43720
  });
43410
43721
  speculationRef.current = IDLE_SPECULATION;
43411
43722
  return;
@@ -43416,25 +43727,30 @@ ${buildWorkflowSteeringNotice()}
43416
43727
  speculationRef.current = IDLE_SPECULATION;
43417
43728
  }
43418
43729
  if (streamingState === "idle" /* Idle */ && !isProcessing && isSlashCommand(submittedValue)) {
43419
- void submitQuery(submittedValue);
43730
+ void submitUserQuery({
43731
+ modelText: submittedValue,
43732
+ submittedPrompt
43733
+ });
43420
43734
  return;
43421
43735
  }
43422
- addMessage(submittedValue);
43736
+ addMessage(submittedValue, false, submittedPrompt);
43423
43737
  },
43424
43738
  [
43425
43739
  addMessage,
43426
43740
  agentViewState,
43427
43741
  streamingState,
43428
43742
  isProcessing,
43429
- submitQuery,
43743
+ submitUserQuery,
43430
43744
  handleSlashCommand,
43431
43745
  config,
43432
43746
  geminiClient,
43433
43747
  historyManager,
43434
- settings.merged.ui?.disableWorkflowKeywordTrigger
43748
+ settings.merged.ui?.disableWorkflowKeywordTrigger,
43749
+ setBufferText,
43750
+ vimEnabled
43435
43751
  ]
43436
43752
  );
43437
- const handleArenaModelsSelected = (0, import_react165.useCallback)(
43753
+ const handleArenaModelsSelected = (0, import_react164.useCallback)(
43438
43754
  (models) => {
43439
43755
  const value = models.join(",");
43440
43756
  buffer.setText(`/arena start --models ${value} `);
@@ -43449,15 +43765,15 @@ ${buildWorkflowSteeringNotice()}
43449
43765
  handleWelcomeBackSelection,
43450
43766
  handleWelcomeBackClose
43451
43767
  } = useWelcomeBack(config, handleFinalSubmit, buffer, settings.merged);
43452
- const pendingHistoryItems = (0, import_react165.useMemo)(
43768
+ const pendingHistoryItems = (0, import_react164.useMemo)(
43453
43769
  () => [...pendingSlashCommandHistoryItems, ...pendingGeminiHistoryItems],
43454
43770
  [pendingSlashCommandHistoryItems, pendingGeminiHistoryItems]
43455
43771
  );
43456
- const historyForTranscriptRef = (0, import_react165.useRef)(historyManager.history);
43772
+ const historyForTranscriptRef = (0, import_react164.useRef)(historyManager.history);
43457
43773
  historyForTranscriptRef.current = historyManager.history;
43458
- const pendingForTranscriptRef = (0, import_react165.useRef)(pendingHistoryItems);
43774
+ const pendingForTranscriptRef = (0, import_react164.useRef)(pendingHistoryItems);
43459
43775
  pendingForTranscriptRef.current = pendingHistoryItems;
43460
- const openTranscript = (0, import_react165.useCallback)(() => {
43776
+ const openTranscript = (0, import_react164.useCallback)(() => {
43461
43777
  setTranscriptFreeze({
43462
43778
  // Share MainContent's visibility predicate so the transcript shows exactly
43463
43779
  // what the main view shows. Items collapsed on session resume
@@ -43469,7 +43785,7 @@ ${buildWorkflowSteeringNotice()}
43469
43785
  pendingItems: [...pendingForTranscriptRef.current]
43470
43786
  });
43471
43787
  }, []);
43472
- const transcriptItems = (0, import_react165.useMemo)(() => {
43788
+ const transcriptItems = (0, import_react164.useMemo)(() => {
43473
43789
  if (!transcriptFreeze) return EMPTY_HISTORY_ITEMS;
43474
43790
  return [
43475
43791
  ...transcriptFreeze.committedItems,
@@ -43481,7 +43797,7 @@ ${buildWorkflowSteeringNotice()}
43481
43797
  }))
43482
43798
  ];
43483
43799
  }, [transcriptFreeze]);
43484
- const rawStickyTodos = (0, import_react165.useMemo)(
43800
+ const rawStickyTodos = (0, import_react164.useMemo)(
43485
43801
  () => getStickyTodos(historyManager.history, pendingHistoryItems),
43486
43802
  [historyManager.history, pendingHistoryItems]
43487
43803
  );
@@ -43489,7 +43805,7 @@ ${buildWorkflowSteeringNotice()}
43489
43805
  const hasExecutingTool = isToolExecuting(pendingHistoryItems);
43490
43806
  const hasPendingCompression = isCompressionPending(pendingHistoryItems);
43491
43807
  useTerminalProgress(streamingState, hasExecutingTool);
43492
- cancelHandlerRef.current = (0, import_react165.useCallback)(
43808
+ cancelHandlerRef.current = (0, import_react164.useCallback)(
43493
43809
  (info) => {
43494
43810
  const pendingHistoryItems2 = [
43495
43811
  ...pendingSlashCommandHistoryItems,
@@ -43501,9 +43817,13 @@ ${buildWorkflowSteeringNotice()}
43501
43817
  const draftWasEmpty = buffer.text.length === 0;
43502
43818
  const popped = popAllMessages();
43503
43819
  if (popped) {
43820
+ restoredSubmissionRef.current = popped;
43821
+ submittedPromptProvenanceUnavailableRef.current = false;
43504
43822
  const currentText = buffer.text;
43505
- buffer.setText(currentText ? `${popped}
43506
- ${currentText}` : popped);
43823
+ buffer.setText(
43824
+ currentText ? `${popped.modelText}
43825
+ ${currentText}` : popped.modelText
43826
+ );
43507
43827
  }
43508
43828
  if (!draftWasEmpty) {
43509
43829
  debugLogger40.debug("auto-restore bail: buffer was non-empty");
@@ -43522,6 +43842,14 @@ ${currentText}` : popped);
43522
43842
  );
43523
43843
  return;
43524
43844
  }
43845
+ const restoreCancelledPrompt = /* @__PURE__ */ __name(() => {
43846
+ restoredSubmissionRef.current = {
43847
+ modelText: cancelledTurnUserItem.text,
43848
+ ...cancelledTurnUserItem.submittedPrompt === void 0 ? {} : { submittedPrompt: cancelledTurnUserItem.submittedPrompt }
43849
+ };
43850
+ submittedPromptProvenanceUnavailableRef.current = false;
43851
+ buffer.setText(cancelledTurnUserItem.text);
43852
+ }, "restoreCancelledPrompt");
43525
43853
  if (pendingHistoryItems2.some((item) => item.type === "tool_group")) {
43526
43854
  debugLogger40.debug(
43527
43855
  "auto-restore bail: tool execution is pending or committed"
@@ -43532,7 +43860,7 @@ ${currentText}` : popped);
43532
43860
  debugLogger40.debug(
43533
43861
  "auto-restore: preserving streamed output and restoring prompt text"
43534
43862
  );
43535
- buffer.setText(cancelledTurnUserItem.text);
43863
+ restoreCancelledPrompt();
43536
43864
  return;
43537
43865
  }
43538
43866
  if (pendingHistoryItems2.some((item) => !isSyntheticHistoryItem(item))) {
@@ -43551,7 +43879,7 @@ ${currentText}` : popped);
43551
43879
  debugLogger40.debug(
43552
43880
  "auto-restore: preserving committed output and restoring prompt text"
43553
43881
  );
43554
- buffer.setText(cancelledTurnUserItem.text);
43882
+ restoreCancelledPrompt();
43555
43883
  return;
43556
43884
  }
43557
43885
  const lastUserItem = history[lastUserIdx];
@@ -43572,11 +43900,13 @@ ${currentText}` : popped);
43572
43900
  );
43573
43901
  historyManager.truncateToItem(lastUserItem.id);
43574
43902
  refreshStatic();
43575
- buffer.setText(lastUserItem.text);
43903
+ restoreCancelledPrompt();
43576
43904
  geminiClient?.stripOrphanedUserEntriesFromHistory?.();
43577
- void logger?.removeLastUserMessage().catch((err) => {
43578
- debugLogger40.debug("Failed to undo cancelled prompt from log:", err);
43579
- });
43905
+ if (info?.canUndoLastLoggedUserMessage) {
43906
+ void logger?.removeLastUserMessage().catch((err) => {
43907
+ debugLogger40.debug("Failed to undo cancelled prompt from log:", err);
43908
+ });
43909
+ }
43580
43910
  },
43581
43911
  [
43582
43912
  buffer,
@@ -43589,7 +43919,7 @@ ${currentText}` : popped);
43589
43919
  pendingGeminiHistoryItems
43590
43920
  ]
43591
43921
  );
43592
- const handleClearScreen = (0, import_react165.useCallback)(() => {
43922
+ const handleClearScreen = (0, import_react164.useCallback)(() => {
43593
43923
  historyManager.clearItems();
43594
43924
  clearScreen();
43595
43925
  remountStaticHistory();
@@ -43612,13 +43942,13 @@ ${currentText}` : popped);
43612
43942
  history: historyManager.history,
43613
43943
  awayThresholdMinutes: settings.merged.general?.sessionRecapAwayThresholdMinutes
43614
43944
  });
43615
- const contextFileNames = (0, import_react165.useMemo)(() => {
43945
+ const contextFileNames = (0, import_react164.useMemo)(() => {
43616
43946
  const fromSettings = settings.merged.context?.fileName;
43617
43947
  return fromSettings ? Array.isArray(fromSettings) ? fromSettings : [fromSettings] : getAllGeminiMdFilenames();
43618
43948
  }, [settings.merged.context?.fileName]);
43619
- const initialPrompt = (0, import_react165.useMemo)(() => config.getQuestion(), [config]);
43620
- const initialPromptSubmitted = (0, import_react165.useRef)(false);
43621
- (0, import_react165.useEffect)(() => {
43949
+ const initialPrompt = (0, import_react164.useMemo)(() => config.getQuestion(), [config]);
43950
+ const initialPromptSubmitted = (0, import_react164.useRef)(false);
43951
+ (0, import_react164.useEffect)(() => {
43622
43952
  if (initialPrompt && isConfigInitialized && !initialPromptSubmitted.current && !isAuthenticating && !isAuthDialogOpen && !isThemeDialogOpen && !isEditorDialogOpen && !showWelcomeBackDialog && welcomeBackChoice !== "restart" && geminiClient?.isInitialized?.()) {
43623
43953
  handleFinalSubmit(initialPrompt);
43624
43954
  initialPromptSubmitted.current = true;
@@ -43636,7 +43966,7 @@ ${currentText}` : popped);
43636
43966
  geminiClient
43637
43967
  ]);
43638
43968
  const followupSuggestionsEnabled = settings.merged.ui?.enableFollowupSuggestions !== false;
43639
- (0, import_react165.useEffect)(() => {
43969
+ (0, import_react164.useEffect)(() => {
43640
43970
  if (!followupSuggestionsEnabled) {
43641
43971
  suggestionAbortRef.current?.abort();
43642
43972
  setPromptSuggestion(null);
@@ -43705,17 +44035,17 @@ ${currentText}` : popped);
43705
44035
  isPermissionsDialogOpen,
43706
44036
  settingInputRequests
43707
44037
  ]);
43708
- (0, import_react165.useEffect)(() => {
44038
+ (0, import_react164.useEffect)(() => {
43709
44039
  if (!promptSuggestion && speculationRef.current.status !== "idle") {
43710
44040
  abortSpeculation(speculationRef.current).catch(() => {
43711
44041
  });
43712
44042
  speculationRef.current = IDLE_SPECULATION;
43713
44043
  }
43714
44044
  }, [promptSuggestion]);
43715
- const [idePromptAnswered, setIdePromptAnswered] = (0, import_react165.useState)(false);
43716
- const [currentIDE, setCurrentIDE] = (0, import_react165.useState)(null);
43717
- const [startupIdeConnectionStatus, setStartupIdeConnectionStatus] = (0, import_react165.useState)({ state: "idle" });
43718
- (0, import_react165.useEffect)(() => {
44045
+ const [idePromptAnswered, setIdePromptAnswered] = (0, import_react164.useState)(false);
44046
+ const [currentIDE, setCurrentIDE] = (0, import_react164.useState)(null);
44047
+ const [startupIdeConnectionStatus, setStartupIdeConnectionStatus] = (0, import_react164.useState)({ state: "idle" });
44048
+ (0, import_react164.useEffect)(() => {
43719
44049
  const getIde = /* @__PURE__ */ __name(async () => {
43720
44050
  const ideClient = await IdeClient.getInstance();
43721
44051
  const currentIde = ideClient.getCurrentIde();
@@ -43731,40 +44061,40 @@ ${currentText}` : popped);
43731
44061
  tomlFiles: commandMigrationTomlFiles,
43732
44062
  setShowMigrationNudge: setShowCommandMigrationNudge
43733
44063
  } = useCommandMigration(settings, config.storage);
43734
- const [showToolDescriptions, setShowToolDescriptions] = (0, import_react165.useState)(false);
44064
+ const [showToolDescriptions, setShowToolDescriptions] = (0, import_react164.useState)(false);
43735
44065
  const configuredRenderMode = settings.merged.ui?.renderMode;
43736
- const [renderMode, setRenderMode] = (0, import_react165.useState)(
44066
+ const [renderMode, setRenderMode] = (0, import_react164.useState)(
43737
44067
  configuredRenderMode === "raw" ? "raw" : "render"
43738
44068
  );
43739
- const renderModeConfigMountedRef = (0, import_react165.useRef)(false);
43740
- (0, import_react165.useEffect)(() => {
44069
+ const renderModeConfigMountedRef = (0, import_react164.useRef)(false);
44070
+ (0, import_react164.useEffect)(() => {
43741
44071
  if (!renderModeConfigMountedRef.current) {
43742
44072
  renderModeConfigMountedRef.current = true;
43743
44073
  return;
43744
44074
  }
43745
44075
  setRenderMode(configuredRenderMode === "raw" ? "raw" : "render");
43746
44076
  }, [configuredRenderMode]);
43747
- const renderModeMountedRef = (0, import_react165.useRef)(false);
43748
- (0, import_react165.useEffect)(() => {
44077
+ const renderModeMountedRef = (0, import_react164.useRef)(false);
44078
+ (0, import_react164.useEffect)(() => {
43749
44079
  if (!renderModeMountedRef.current) {
43750
44080
  renderModeMountedRef.current = true;
43751
44081
  return;
43752
44082
  }
43753
44083
  refreshStatic();
43754
44084
  }, [renderMode, refreshStatic]);
43755
- const [ctrlCPressedOnce, setCtrlCPressedOnce] = (0, import_react165.useState)(false);
43756
- const ctrlCTimerRef = (0, import_react165.useRef)(null);
43757
- const [ctrlDPressedOnce, setCtrlDPressedOnce] = (0, import_react165.useState)(false);
43758
- const ctrlDTimerRef = (0, import_react165.useRef)(null);
43759
- const [escapePressedOnce, setEscapePressedOnce] = (0, import_react165.useState)(false);
43760
- const escapeTimerRef = (0, import_react165.useRef)(null);
43761
- const dialogsVisibleRef = (0, import_react165.useRef)(false);
43762
- const [isRewindSelectorOpen, setIsRewindSelectorOpen] = (0, import_react165.useState)(false);
43763
- const [rewindEscPending, setRewindEscPending] = (0, import_react165.useState)(false);
43764
- const [constrainHeight, setConstrainHeight] = (0, import_react165.useState)(true);
43765
- const [ideContextState, setIdeContextState] = (0, import_react165.useState)();
43766
- const [showEscapePrompt, setShowEscapePrompt] = (0, import_react165.useState)(false);
43767
- const [showIdeRestartPrompt, setShowIdeRestartPrompt] = (0, import_react165.useState)(false);
44085
+ const [ctrlCPressedOnce, setCtrlCPressedOnce] = (0, import_react164.useState)(false);
44086
+ const ctrlCTimerRef = (0, import_react164.useRef)(null);
44087
+ const [ctrlDPressedOnce, setCtrlDPressedOnce] = (0, import_react164.useState)(false);
44088
+ const ctrlDTimerRef = (0, import_react164.useRef)(null);
44089
+ const [escapePressedOnce, setEscapePressedOnce] = (0, import_react164.useState)(false);
44090
+ const escapeTimerRef = (0, import_react164.useRef)(null);
44091
+ const dialogsVisibleRef = (0, import_react164.useRef)(false);
44092
+ const [isRewindSelectorOpen, setIsRewindSelectorOpen] = (0, import_react164.useState)(false);
44093
+ const [rewindEscPending, setRewindEscPending] = (0, import_react164.useState)(false);
44094
+ const [constrainHeight, setConstrainHeight] = (0, import_react164.useState)(true);
44095
+ const [ideContextState, setIdeContextState] = (0, import_react164.useState)();
44096
+ const [showEscapePrompt, setShowEscapePrompt] = (0, import_react164.useState)(false);
44097
+ const [showIdeRestartPrompt, setShowIdeRestartPrompt] = (0, import_react164.useState)(false);
43768
44098
  const { isFolderTrustDialogOpen, handleFolderTrustSelect, isRestarting } = useFolderTrust(settings, setIsTrustedFolder);
43769
44099
  const {
43770
44100
  isMcpApprovalDialogOpen,
@@ -43793,7 +44123,7 @@ ${currentText}` : popped);
43793
44123
  const dialogsVisible = showWelcomeBackDialog || shouldShowIdePrompt || shouldShowCommandMigrationNudge || isFolderTrustDialogOpen || isMcpApprovalDialogOpen || !!shellConfirmationRequest || !!confirmationRequest || confirmUpdateExtensionRequests.length > 0 || !!providerUpdateRequest || settingInputRequests.length > 0 || pluginChoiceRequests.length > 0 || !!loopDetectionConfirmationRequest || isThemeDialogOpen || isSettingsDialogOpen || isStatusLineDialogOpen || isMemoryDialogOpen || isModelDialogOpen || isTrustDialogOpen || activeArenaDialog !== null || isPermissionsDialogOpen || isAuthDialogOpen || isAuthenticating || isEditorDialogOpen || showIdeRestartPrompt || isSubagentCreateDialogOpen || isAgentsManagerDialogOpen || isSkillsManagerDialogOpen || isMcpDialogOpen || isHooksDialogOpen || isStatsDialogOpen || isApprovalModeDialogOpen || isEffortDialogOpen || isResumeDialogOpen || isDeleteDialogOpen || isHelpDialogOpen || isExtensionsManagerDialogOpen || isRewindSelectorOpen || isDiffDialogOpen || isSkillReviewDialogOpen || bgTasksDialogOpen || showWorktreeExitDialog || !!(settings.corruptedPath && !settings.corruptionDialogDismissed);
43794
44124
  dialogsVisibleRef.current = dialogsVisible;
43795
44125
  const needsBlockingInput = dialogsVisible || streamingState === "waiting_for_confirmation" /* WaitingForConfirmation */;
43796
- (0, import_react165.useEffect)(() => {
44126
+ (0, import_react164.useEffect)(() => {
43797
44127
  if (needsBlockingInput && isTranscriptOpen) {
43798
44128
  closeTranscript();
43799
44129
  }
@@ -43809,12 +44139,12 @@ ${currentText}` : popped);
43809
44139
  stickyTodoWidth,
43810
44140
  stickyTodoMaxVisibleItems
43811
44141
  ) : "hidden";
43812
- const [controlsHeight, setControlsHeight] = (0, import_react165.useState)(0);
44142
+ const [controlsHeight, setControlsHeight] = (0, import_react164.useState)(0);
43813
44143
  const liveAgentPanelLayoutKey = getLiveAgentPanelLayoutKey(
43814
44144
  bgTaskEntries,
43815
44145
  bgLivePanelFocused
43816
44146
  );
43817
- (0, import_react165.useLayoutEffect)(() => {
44147
+ (0, import_react164.useLayoutEffect)(() => {
43818
44148
  if (!mainControlsRef.current) {
43819
44149
  setControlsHeight(
43820
44150
  (previousHeight) => previousHeight === 0 ? previousHeight : 0
@@ -43861,7 +44191,7 @@ ${currentText}` : popped);
43861
44191
  pager: settings.merged.tools?.shell?.pager,
43862
44192
  showColor: settings.merged.tools?.shell?.showColor
43863
44193
  });
43864
- (0, import_react165.useEffect)(() => {
44194
+ (0, import_react164.useEffect)(() => {
43865
44195
  if (activePtyId) {
43866
44196
  ShellExecutionService.resizePty(
43867
44197
  activePtyId,
@@ -43870,19 +44200,18 @@ ${currentText}` : popped);
43870
44200
  );
43871
44201
  }
43872
44202
  }, [terminalWidth, availableTerminalHeight, activePtyId]);
43873
- useResizeSettleRepaint(terminalWidth, refreshStatic);
43874
44203
  useWakeRepaint(refreshStatic);
43875
- (0, import_react165.useEffect)(() => {
44204
+ (0, import_react164.useEffect)(() => {
43876
44205
  if (ideNeedsRestart) {
43877
44206
  setShowIdeRestartPrompt(true);
43878
44207
  }
43879
44208
  }, [ideNeedsRestart]);
43880
- (0, import_react165.useEffect)(() => {
44209
+ (0, import_react164.useEffect)(() => {
43881
44210
  const unsubscribe = ideContextStore.subscribe(setIdeContextState);
43882
44211
  setIdeContextState(ideContextStore.get());
43883
44212
  return unsubscribe;
43884
44213
  }, []);
43885
- (0, import_react165.useEffect)(() => {
44214
+ (0, import_react164.useEffect)(() => {
43886
44215
  const listener = /* @__PURE__ */ __name((status) => {
43887
44216
  setStartupIdeConnectionStatus(status);
43888
44217
  }, "listener");
@@ -43891,10 +44220,10 @@ ${currentText}` : popped);
43891
44220
  appEvents.off("startup-ide-connection-status-changed" /* StartupIdeConnectionStatusChanged */, listener);
43892
44221
  };
43893
44222
  }, []);
43894
- const handleEscapePromptChange = (0, import_react165.useCallback)((showPrompt) => {
44223
+ const handleEscapePromptChange = (0, import_react164.useCallback)((showPrompt) => {
43895
44224
  setShowEscapePrompt(showPrompt);
43896
44225
  }, []);
43897
- const openRewindSelector = (0, import_react165.useCallback)(() => {
44226
+ const openRewindSelector = (0, import_react164.useCallback)(() => {
43898
44227
  if (streamingState !== "idle" /* Idle */) return;
43899
44228
  if (dialogsVisibleRef.current) return;
43900
44229
  if (config.getIdeMode()) {
@@ -43912,10 +44241,10 @@ ${currentText}` : popped);
43912
44241
  setIsRewindSelectorOpen(true);
43913
44242
  }, [streamingState, config, historyManager]);
43914
44243
  openRewindSelectorRef.current = openRewindSelector;
43915
- const closeRewindSelector = (0, import_react165.useCallback)(() => {
44244
+ const closeRewindSelector = (0, import_react164.useCallback)(() => {
43916
44245
  setIsRewindSelectorOpen(false);
43917
44246
  }, []);
43918
- const handleRewindConfirm = (0, import_react165.useCallback)(
44247
+ const handleRewindConfirm = (0, import_react164.useCallback)(
43919
44248
  async (userItem, option) => {
43920
44249
  try {
43921
44250
  const needsConversation = option === "conversation" || option === "both";
@@ -44017,6 +44346,8 @@ ${currentText}` : popped);
44017
44346
  historyManager.loadHistory(truncatedUi);
44018
44347
  refreshStatic();
44019
44348
  if (userItem.type === "user" && userItem.text) {
44349
+ restoredSubmissionRef.current = null;
44350
+ submittedPromptProvenanceUnavailableRef.current = true;
44020
44351
  buffer.setText(userItem.text);
44021
44352
  }
44022
44353
  historyManager.addItem(
@@ -44077,7 +44408,7 @@ ${currentText}` : popped);
44077
44408
  openRewindSelector,
44078
44409
  (pending) => setRewindEscPending(pending)
44079
44410
  );
44080
- const handleIdePromptComplete = (0, import_react165.useCallback)(
44411
+ const handleIdePromptComplete = (0, import_react164.useCallback)(
44081
44412
  (result) => {
44082
44413
  if (result.userSelection === "yes") {
44083
44414
  if (result.isExtensionPreInstalled) {
@@ -44093,7 +44424,7 @@ ${currentText}` : popped);
44093
44424
  },
44094
44425
  [handleSlashCommand, settings]
44095
44426
  );
44096
- const handleCommandMigrationComplete = (0, import_react165.useCallback)(
44427
+ const handleCommandMigrationComplete = (0, import_react164.useCallback)(
44097
44428
  async (result) => {
44098
44429
  setShowCommandMigrationNudge(false);
44099
44430
  if (result.userSelection === "yes") {
@@ -44185,7 +44516,7 @@ ${migrationResult.failedFiles.map((f) => ` \u2022 ${f.file}: ${f.error}`).join(
44185
44516
  pendingToolCalls
44186
44517
  });
44187
44518
  const workflowBellEnabled = settings.merged.general?.terminalBell ?? true;
44188
- (0, import_react165.useEffect)(() => {
44519
+ (0, import_react164.useEffect)(() => {
44189
44520
  const registry = config.getWorkflowRunRegistry?.();
44190
44521
  if (!registry?.setNotificationCallback) return;
44191
44522
  registry.setNotificationCallback((entry) => {
@@ -44235,7 +44566,7 @@ ${migrationResult.failedFiles.map((f) => ` \u2022 ${f.file}: ${f.error}`).join(
44235
44566
  showWorktreeExitDialog,
44236
44567
  closeWorktreeExitDialog: /* @__PURE__ */ __name(() => setShowWorktreeExitDialog(false), "closeWorktreeExitDialog")
44237
44568
  });
44238
- const handleExit = (0, import_react165.useCallback)(
44569
+ const handleExit = (0, import_react164.useCallback)(
44239
44570
  (pressedOnce, setPressedOnce, timerRef) => {
44240
44571
  if (pressedOnce) {
44241
44572
  if (timerRef.current) {
@@ -44288,7 +44619,7 @@ ${migrationResult.failedFiles.map((f) => ` \u2022 ${f.file}: ${f.error}`).join(
44288
44619
  activeWorktree
44289
44620
  ]
44290
44621
  );
44291
- const handleGlobalKeypress = (0, import_react165.useCallback)(
44622
+ const handleGlobalKeypress = (0, import_react164.useCallback)(
44292
44623
  (key) => {
44293
44624
  if (settings.merged.general?.debugKeystrokeLogging) {
44294
44625
  debugLogger40.debug("[DEBUG] Keystroke:", JSON.stringify(key));
@@ -44478,7 +44809,7 @@ ${migrationResult.failedFiles.map((f) => ` \u2022 ${f.file}: ${f.error}`).join(
44478
44809
  ]
44479
44810
  );
44480
44811
  useKeypress(handleGlobalKeypress, { isActive: true });
44481
- (0, import_react165.useEffect)(() => {
44812
+ (0, import_react164.useEffect)(() => {
44482
44813
  if (settings.merged.ui?.hideWindowTitle) {
44483
44814
  return;
44484
44815
  }
@@ -44487,7 +44818,7 @@ ${migrationResult.failedFiles.map((f) => ` \u2022 ${f.file}: ${f.error}`).join(
44487
44818
  lastTitleRef.current = null;
44488
44819
  const folderName2 = basename3(config.getTargetDir());
44489
44820
  writeTerminalTitle(
44490
- (value) => process16.stdout.write(value),
44821
+ (value) => process17.stdout.write(value),
44491
44822
  formatSessionWindowTitle(null, folderName2)
44492
44823
  );
44493
44824
  }
@@ -44497,7 +44828,7 @@ ${migrationResult.failedFiles.map((f) => ` \u2022 ${f.file}: ${f.error}`).join(
44497
44828
  const title = formatSessionWindowTitle(sessionName, folderName);
44498
44829
  if (lastTitleRef.current !== title) {
44499
44830
  lastTitleRef.current = title;
44500
- writeTerminalTitle((value) => process16.stdout.write(value), title);
44831
+ writeTerminalTitle((value) => process17.stdout.write(value), title);
44501
44832
  }
44502
44833
  }, [
44503
44834
  sessionName,
@@ -44505,9 +44836,9 @@ ${migrationResult.failedFiles.map((f) => ` \u2022 ${f.file}: ${f.error}`).join(
44505
44836
  settings.merged.ui?.showStatusInTitle,
44506
44837
  config
44507
44838
  ]);
44508
- const queueDrainingRef = (0, import_react165.useRef)(false);
44509
- const [queueDrainNonce, setQueueDrainNonce] = (0, import_react165.useState)(0);
44510
- (0, import_react165.useEffect)(() => {
44839
+ const queueDrainingRef = (0, import_react164.useRef)(false);
44840
+ const [queueDrainNonce, setQueueDrainNonce] = (0, import_react164.useState)(0);
44841
+ (0, import_react164.useEffect)(() => {
44511
44842
  if (queueDrainingRef.current) return;
44512
44843
  if (!shouldDrainMessageQueue({
44513
44844
  isConfigInitialized,
@@ -44519,11 +44850,10 @@ ${migrationResult.failedFiles.map((f) => ` \u2022 ${f.file}: ${f.error}`).join(
44519
44850
  return;
44520
44851
  }
44521
44852
  if (isTranscriptOpenRef.current) return;
44522
- const plainPrompts = drainQueue(true);
44523
- const submission = plainPrompts.length > 0 ? plainPrompts.join("\n\n") : popNextSegment();
44853
+ const submission = popNextTurn();
44524
44854
  if (submission === null) return;
44525
44855
  queueDrainingRef.current = true;
44526
- Promise.resolve(submitQuery(submission)).finally(() => {
44856
+ Promise.resolve(submitUserQuery(submission)).finally(() => {
44527
44857
  queueDrainingRef.current = false;
44528
44858
  setQueueDrainNonce((n) => n + 1);
44529
44859
  });
@@ -44535,13 +44865,12 @@ ${migrationResult.failedFiles.map((f) => ` \u2022 ${f.file}: ${f.error}`).join(
44535
44865
  // Re-run the drain when the transcript closes so queued messages resume.
44536
44866
  isTranscriptOpen,
44537
44867
  messageQueue,
44538
- drainQueue,
44539
- popNextSegment,
44540
- submitQuery,
44868
+ popNextTurn,
44869
+ submitUserQuery,
44541
44870
  queueDrainNonce
44542
44871
  ]);
44543
44872
  const nightly = props.version.includes("nightly");
44544
- const uiState = (0, import_react165.useMemo)(
44873
+ const uiState = (0, import_react164.useMemo)(
44545
44874
  () => ({
44546
44875
  history: historyManager.history,
44547
44876
  historyManager,
@@ -44834,7 +45163,7 @@ ${migrationResult.failedFiles.map((f) => ` \u2022 ${f.file}: ${f.error}`).join(
44834
45163
  isDiffDialogOpen
44835
45164
  ]
44836
45165
  );
44837
- const uiActions = (0, import_react165.useMemo)(
45166
+ const uiActions = (0, import_react164.useMemo)(
44838
45167
  () => ({
44839
45168
  openThemeDialog,
44840
45169
  openEditorDialog,
@@ -44875,7 +45204,8 @@ ${migrationResult.failedFiles.map((f) => ` \u2022 ${f.file}: ${f.error}`).join(
44875
45204
  handleFinalSubmit,
44876
45205
  handleRetryLastPrompt: retryLastPrompt,
44877
45206
  handleClearScreen,
44878
- popAllQueuedMessages: popAllMessages,
45207
+ popAllQueuedMessages,
45208
+ invalidateSubmittedPromptProvenance,
44879
45209
  // Welcome back dialog
44880
45210
  handleWelcomeBackSelection,
44881
45211
  handleWelcomeBackClose,
@@ -44965,7 +45295,8 @@ ${migrationResult.failedFiles.map((f) => ` \u2022 ${f.file}: ${f.error}`).join(
44965
45295
  handleFinalSubmit,
44966
45296
  retryLastPrompt,
44967
45297
  handleClearScreen,
44968
- popAllMessages,
45298
+ popAllQueuedMessages,
45299
+ invalidateSubmittedPromptProvenance,
44969
45300
  handleWelcomeBackSelection,
44970
45301
  handleWelcomeBackClose,
44971
45302
  handleWorktreeExit,
@@ -45015,11 +45346,11 @@ ${migrationResult.failedFiles.map((f) => ` \u2022 ${f.file}: ${f.error}`).join(
45015
45346
  closeDiffDialog
45016
45347
  ]
45017
45348
  );
45018
- const renderModeValue = (0, import_react165.useMemo)(
45349
+ const renderModeValue = (0, import_react164.useMemo)(
45019
45350
  () => ({ renderMode, setRenderMode }),
45020
45351
  [renderMode, setRenderMode]
45021
45352
  );
45022
- const thoughtExpandedValue = (0, import_react165.useMemo)(
45353
+ const thoughtExpandedValue = (0, import_react164.useMemo)(
45023
45354
  () => ({
45024
45355
  allExpanded: thoughtExpanded,
45025
45356
  expandedHeadIds: expandedThoughtHeadIds,
@@ -45027,7 +45358,7 @@ ${migrationResult.failedFiles.map((f) => ` \u2022 ${f.file}: ${f.error}`).join(
45027
45358
  }),
45028
45359
  [thoughtExpanded, expandedThoughtHeadIds, toggleThoughtExpanded]
45029
45360
  );
45030
- return /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(UIStateContext.Provider, { value: uiState, children: /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(UIActionsContext.Provider, { value: uiActions, children: /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(ConfigContext.Provider, { value: config, children: /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
45361
+ return /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(VirtualViewportContext.Provider, { value: useTerminalBuffer, children: /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(UIStateContext.Provider, { value: uiState, children: /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(UIActionsContext.Provider, { value: uiActions, children: /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(ConfigContext.Provider, { value: config, children: /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
45031
45362
  AppContext.Provider,
45032
45363
  {
45033
45364
  value: {
@@ -45051,14 +45382,14 @@ ${migrationResult.failedFiles.map((f) => ` \u2022 ${f.file}: ${f.error}`).join(
45051
45382
  ) })
45052
45383
  ) : /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(App, {}) }) }) }) })
45053
45384
  }
45054
- ) }) }) });
45385
+ ) }) }) }) });
45055
45386
  }, "AppContainer");
45056
45387
 
45057
45388
  // packages/cli/src/ui/hooks/useKittyKeyboardProtocol.ts
45058
45389
  init_esbuild_shims();
45059
- var import_react166 = __toESM(require_react(), 1);
45390
+ var import_react165 = __toESM(require_react(), 1);
45060
45391
  function useKittyKeyboardProtocol() {
45061
- const [status] = (0, import_react166.useState)({
45392
+ const [status] = (0, import_react165.useState)({
45062
45393
  supported: isKittyProtocolSupported(),
45063
45394
  enabled: isKittyProtocolEnabled(),
45064
45395
  checking: false
@@ -45312,6 +45643,11 @@ async function startInteractiveUI(config, settings, startupWarnings, workspaceRo
45312
45643
  }
45313
45644
  }
45314
45645
  const initialCapturedInput = stopAndGetCapturedInput();
45646
+ const useVP = shouldUseVirtualViewport(
45647
+ settings.merged.ui?.useTerminalBuffer,
45648
+ config.getScreenReader(),
45649
+ isInteractiveTerminal()
45650
+ );
45315
45651
  const AppWrapper = /* @__PURE__ */ __name(() => {
45316
45652
  const kittyProtocolStatus = useKittyKeyboardProtocol();
45317
45653
  const nodeMajorVersion = parseInt(process.versions.node.split(".")[0], 10);
@@ -45331,13 +45667,13 @@ async function startInteractiveUI(config, settings, startupWarnings, workspaceRo
45331
45667
  startupWarnings,
45332
45668
  version,
45333
45669
  initializationResult,
45670
+ initialUseVirtualViewport: useVP,
45334
45671
  extensionRefreshState: options.extensionRefreshState
45335
45672
  }
45336
45673
  ) }) }) }) })
45337
45674
  }
45338
45675
  ) }) }) });
45339
45676
  }, "AppWrapper");
45340
- const useVP = settings.merged.ui?.useTerminalBuffer ?? false;
45341
45677
  const stdoutMaxListeners = process.stdout.getMaxListeners();
45342
45678
  if (useVP) {
45343
45679
  process.stdout.setMaxListeners(0);
@@ -45359,7 +45695,7 @@ ${error.stack ?? ""}`
45359
45695
  }
45360
45696
  );
45361
45697
  const instance = render_default(
45362
- process.env["DEBUG"] ? /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(import_react167.default.StrictMode, { children: appTree }) : appTree,
45698
+ process.env["DEBUG"] ? /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(import_react166.default.StrictMode, { children: appTree }) : appTree,
45363
45699
  {
45364
45700
  exitOnCtrlC: false,
45365
45701
  isScreenReaderEnabled: config.getScreenReader(),