@qwen-code/qwen-code 0.20.0 → 0.20.1-nightly.20260724.7d17c44a3

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 (388) hide show
  1. package/bundled/qc-helper/docs/configuration/settings.md +1 -1
  2. package/bundled/qc-helper/docs/features/auto-mode.md +19 -16
  3. package/bundled/qc-helper/docs/features/commands.md +54 -0
  4. package/bundled/qc-helper/docs/features/sub-agents.md +16 -7
  5. package/bundled/qc-helper/docs/integration-github-action.md +1 -1
  6. package/bundled/qc-helper/docs/qwen-serve.md +2 -1
  7. package/bundled/review/DESIGN.md +2 -2
  8. package/bundled/review/SKILL.md +7 -5
  9. package/chunks/MaxSizedBox-LGRTXB47.js +84 -0
  10. package/chunks/{StandaloneSessionPicker-CEGO2AZX.js → StandaloneSessionPicker-H3TBU3C3.js} +68 -56
  11. package/chunks/{acp-startup-profiler-N3RHHXJ3.js → acp-startup-profiler-RV3IV562.js} +2 -2
  12. package/chunks/{acpAgent-YUR43TLG.js → acpAgent-5D7P4BB5.js} +2061 -556
  13. package/chunks/agent-W7UAHCCI.js +80 -0
  14. package/chunks/agent-headless-KTBMPRSC.js +74 -0
  15. package/chunks/{anthropicContentGenerator-HVKLXOOU.js → anthropicContentGenerator-ZLQ3X2HI.js} +112 -45
  16. package/chunks/{artifact-tool-WBCAMD3O.js → artifact-tool-OKMWONT6.js} +3 -3
  17. package/chunks/{askUserQuestion-6DZC4UV5.js → askUserQuestion-V6FUS23G.js} +3 -3
  18. package/chunks/bridge-FFC4C6VD.js +89 -0
  19. package/chunks/{build-SSCNEHZZ.js → build-RV63TIRH.js} +2 -3
  20. package/chunks/{ca-2SL2BXTK.js → ca-GKRQZ7AM.js} +612 -201
  21. package/chunks/{channel-worker-group-53CMOPFT.js → channel-worker-group-MA3WXWYX.js} +7 -6
  22. package/chunks/{channel-worker-manager-UTXILKC2.js → channel-worker-manager-TIYYYBCT.js} +189 -29
  23. package/chunks/{channel-worker-supervisor-ZGO2W2MD.js → channel-worker-supervisor-CXRCDA4Y.js} +6 -5
  24. package/chunks/{chunk-TYQMGACW.js → chunk-22C7BQ6D.js} +508 -10967
  25. package/chunks/{chunk-4EP2PYYL.js → chunk-2G6QIHYL.js} +5 -5
  26. package/chunks/{chunk-H2XVO6NE.js → chunk-2MIN6GRR.js} +1 -1
  27. package/chunks/chunk-2RFKHEXL.js +74 -0
  28. package/chunks/{chunk-7SXZC7ID.js → chunk-2WTVWAKT.js} +7 -6
  29. package/chunks/{chunk-TIH2ZTOC.js → chunk-32A4PI3E.js} +2 -2
  30. package/chunks/chunk-36HSVBBU.js +469 -0
  31. package/chunks/{chunk-IR46U7RB.js → chunk-3FB2Y2OE.js} +3 -3
  32. package/chunks/{chunk-QR6U5QPP.js → chunk-3SJ43L4W.js} +4 -0
  33. package/chunks/chunk-3Z43GZUQ.js +32 -0
  34. package/chunks/chunk-43T5WDQ7.js +127 -0
  35. package/chunks/chunk-46UV252V.js +128 -0
  36. package/chunks/{chunk-JD3MKVKL.js → chunk-4K56OJFJ.js} +1 -1
  37. package/chunks/{chunk-KTUQMDEP.js → chunk-4K7VDKAD.js} +1 -1
  38. package/chunks/{chunk-QKYTTBYW.js → chunk-4LVZNIDO.js} +1 -1
  39. package/chunks/{chunk-OWCALFEG.js → chunk-54R2CV2G.js} +1 -1
  40. package/chunks/{chunk-ZEOZL37W.js → chunk-57FIIFJN.js} +1 -1
  41. package/chunks/chunk-5BS3KLRP.js +6194 -0
  42. package/chunks/{chunk-NEEB7UEN.js → chunk-6GMVPFB2.js} +153 -72
  43. package/chunks/{chunk-GMGDLUC7.js → chunk-6IL7KRLE.js} +1 -1
  44. package/chunks/chunk-6PVPNMXU.js +29 -0
  45. package/chunks/chunk-6QHAUJUE.js +293 -0
  46. package/chunks/chunk-6VK3IRTX.js +10017 -0
  47. package/chunks/{chunk-BDBMYST4.js → chunk-6X4GWOPW.js} +1 -1
  48. package/chunks/{chunk-AYCDXHZB.js → chunk-7Z6JQEL6.js} +1 -1
  49. package/chunks/{chunk-FSL5W5TI.js → chunk-AFFGGOF6.js} +4 -4
  50. package/chunks/chunk-AMDSOFFV.js +10860 -0
  51. package/chunks/chunk-AXUW635Q.js +934 -0
  52. package/chunks/{chunk-A5LYNIW7.js → chunk-BJBUDCM3.js} +8 -8
  53. package/chunks/chunk-BK2UNYWD.js +29 -0
  54. package/chunks/{chunk-6RLROE6G.js → chunk-BLFVGB7D.js} +30 -4
  55. package/chunks/chunk-BPJSQIJX.js +100 -0
  56. package/chunks/{chunk-FLSVD6BS.js → chunk-BRTR7S7O.js} +3 -3
  57. package/chunks/{chunk-KG3XV6FH.js → chunk-BSNWBC33.js} +32 -2
  58. package/chunks/chunk-BULDBTYC.js +153 -0
  59. package/chunks/{chunk-PBWEWI4N.js → chunk-BW5Z5NOG.js} +83 -74
  60. package/chunks/{chunk-EIAK6Q2B.js → chunk-C3VHAXP2.js} +20 -3
  61. package/chunks/{chunk-6AFUCL3D.js → chunk-CEZB3XFD.js} +1 -1
  62. package/chunks/chunk-CHMENNJV.js +1832 -0
  63. package/chunks/{chunk-TMQ6XQCX.js → chunk-CK3IEEHR.js} +416 -291
  64. package/chunks/{chunk-OYZWQNWG.js → chunk-CK6UABV2.js} +2 -2
  65. package/chunks/{chunk-VZQUV7VK.js → chunk-CKTMY3EP.js} +1 -1
  66. package/chunks/{chunk-VDWBQ5AW.js → chunk-CUPAVLRY.js} +5 -2
  67. package/chunks/{chunk-I2PYAYFM.js → chunk-CXUFILV3.js} +3 -3
  68. package/chunks/chunk-DP3IHZGG.js +1498 -0
  69. package/chunks/{chunk-BMWMT5Y2.js → chunk-DP5GT2MW.js} +7 -375
  70. package/chunks/{chunk-D22SX43D.js → chunk-DWNZ6PVQ.js} +1 -1
  71. package/chunks/{chunk-5SCI6E3E.js → chunk-E4IMU4Y5.js} +1 -1
  72. package/chunks/{chunk-DP5GXXNZ.js → chunk-EL2IQ2S5.js} +5 -1
  73. package/chunks/{chunk-EZVDJFZ7.js → chunk-ERLGR7GI.js} +1 -1
  74. package/chunks/{chunk-IVPSS6EL.js → chunk-F5MBYZSU.js} +4 -4
  75. package/chunks/{chunk-AQIEINAY.js → chunk-F6IYL66A.js} +28 -1766
  76. package/chunks/{chunk-FEOZBUMT.js → chunk-FODK6UMO.js} +0 -27
  77. package/chunks/{chunk-PGEPSDJI.js → chunk-FWNZ7CVN.js} +24 -20
  78. package/chunks/{chunk-5JBR5XIK.js → chunk-G7EFBBVF.js} +220 -141
  79. package/chunks/chunk-GLNBDYUX.js +38 -0
  80. package/chunks/{chunk-ANPINBOF.js → chunk-H4YKEV2X.js} +5 -5
  81. package/chunks/{chunk-TDKQP3M6.js → chunk-HIJQF5B5.js} +1 -1
  82. package/chunks/{chunk-FQD7GFSV.js → chunk-HJJDKFL5.js} +3 -3
  83. package/chunks/{chunk-4N3KMAIL.js → chunk-HPWHDJID.js} +152 -35
  84. package/chunks/{chunk-KQNM4EO7.js → chunk-HQCSRJ3P.js} +138 -6
  85. package/chunks/chunk-HTR4WV6U.js +327 -0
  86. package/chunks/{chunk-YWEW33JY.js → chunk-HVO55LUD.js} +7 -7
  87. package/chunks/{chunk-MJ6S23WZ.js → chunk-HZEWYOVI.js} +5 -5
  88. package/chunks/chunk-IFG6TYJ2.js +16577 -0
  89. package/chunks/{chunk-B3KGZCQN.js → chunk-IJTOWOD7.js} +322 -202
  90. package/chunks/{chunk-RS7MT2QG.js → chunk-IPUUTYMV.js} +2 -4
  91. package/chunks/{chunk-4ILMYHEI.js → chunk-IRDZJSCL.js} +3 -3
  92. package/chunks/{chunk-XU457J4V.js → chunk-IRH27ZC2.js} +2 -2
  93. package/chunks/{chunk-33XUAINQ.js → chunk-J5UKQEFG.js} +69 -9
  94. package/chunks/{chunk-G45X5TRN.js → chunk-JCW2R7WC.js} +1 -72
  95. package/chunks/{chunk-S2XVRHDN.js → chunk-JDFBBGRD.js} +1 -1
  96. package/chunks/{chunk-4XNLIGVA.js → chunk-JKCALGYN.js} +1023 -383
  97. package/chunks/{chunk-TJTKSVIV.js → chunk-JLU636DO.js} +5 -1
  98. package/chunks/{chunk-VEXFOTEO.js → chunk-JYUSL2V4.js} +3 -3
  99. package/chunks/{chunk-S2PD3EZD.js → chunk-KJEMJWNH.js} +1 -1
  100. package/chunks/{chunk-E2UVIFI2.js → chunk-KRXPRVGL.js} +0 -1
  101. package/chunks/{chunk-CZF3E5GF.js → chunk-LA5H3LM5.js} +1 -1
  102. package/chunks/{chunk-NDMQLV4Y.js → chunk-LBAO2XRA.js} +4 -4
  103. package/chunks/{chunk-7RMOXZTC.js → chunk-LDPP5VTZ.js} +4 -4
  104. package/chunks/{chunk-KDC6GNQR.js → chunk-LEEWLFHW.js} +4 -4
  105. package/chunks/{chunk-KX6UK4VJ.js → chunk-LI4I37W4.js} +22152 -18007
  106. package/chunks/{chunk-OOCI5VVU.js → chunk-LIZRAKPB.js} +1 -1
  107. package/chunks/{chunk-AJSJ5TTU.js → chunk-LP2E4MQG.js} +1 -1
  108. package/chunks/chunk-LS77BEZP.js +405 -0
  109. package/chunks/{chunk-BRRF37CO.js → chunk-LYTBLSSW.js} +5 -5
  110. package/chunks/{chunk-DBE4QFZS.js → chunk-MB7ENXPR.js} +39 -37
  111. package/chunks/{chunk-GKY2OJ7R.js → chunk-MOHAWVLH.js} +4 -4
  112. package/chunks/chunk-NABLFI57.js +82 -0
  113. package/chunks/chunk-NBQDBANR.js +411 -0
  114. package/chunks/{chunk-EAUYY7SS.js → chunk-NOAAFNTJ.js} +43 -10
  115. package/chunks/chunk-NXS53EA7.js +1462 -0
  116. package/chunks/{chunk-C27BYUX6.js → chunk-OQB4EXO4.js} +14 -11
  117. package/chunks/{chunk-NHDKSOEY.js → chunk-P3QQPMQA.js} +5 -5
  118. package/chunks/{chunk-OP4MOGXF.js → chunk-P5RRUHL7.js} +23 -1
  119. package/chunks/{chunk-KOR3XKCA.js → chunk-PBII2NFX.js} +12 -6
  120. package/chunks/{chunk-O3OCNYY5.js → chunk-PDYB7HG2.js} +2 -2
  121. package/chunks/{chunk-2HOVDT7W.js → chunk-PFSUKTZH.js} +1 -1
  122. package/chunks/chunk-PKL3HGNZ.js +2299 -0
  123. package/chunks/{chunk-5DTTYNB7.js → chunk-PQNHRFJC.js} +16 -3
  124. package/chunks/{chunk-OLMETXLX.js → chunk-PXHK5ONM.js} +41 -9
  125. package/chunks/{chunk-PF4CHQOJ.js → chunk-Q6GU6TKM.js} +11 -10
  126. package/chunks/{chunk-4ODB7WIB.js → chunk-QAFKR7WR.js} +1 -1
  127. package/chunks/{chunk-PBATSWUQ.js → chunk-QBUDF33N.js} +1 -1
  128. package/chunks/{chunk-BVLROR2T.js → chunk-QLJUC7TG.js} +1 -1
  129. package/chunks/{chunk-UEY4AYUL.js → chunk-QNLNLENL.js} +2 -2
  130. package/chunks/{chunk-333CXMNJ.js → chunk-QXZTZJLX.js} +5 -5
  131. package/chunks/chunk-R6D2CTQR.js +289 -0
  132. package/chunks/{chunk-7PZ2ATFZ.js → chunk-R6SKHK3T.js} +54 -29
  133. package/chunks/{chunk-OONJNQ42.js → chunk-RGG6M2WF.js} +4 -4
  134. package/chunks/{chunk-RFIAR4YL.js → chunk-RV4C2ZFG.js} +1 -1
  135. package/chunks/{chunk-O3Z73NBP.js → chunk-RW2NEXYJ.js} +15 -11
  136. package/chunks/{chunk-HZPN55E5.js → chunk-SJEDL7DI.js} +1 -1
  137. package/chunks/{chunk-AKX4WPPP.js → chunk-SWBJRDYC.js} +866 -183
  138. package/chunks/{chunk-NBMIC7DR.js → chunk-SX4PK3FC.js} +145 -5
  139. package/chunks/chunk-T3452DP5.js +246 -0
  140. package/chunks/{chunk-TB6UDU4T.js → chunk-THJNPLI4.js} +16 -16
  141. package/chunks/{chunk-T4TZQJ7W.js → chunk-TWPJO254.js} +5 -16
  142. package/chunks/chunk-U7ZFW55U.js +2098 -0
  143. package/chunks/{chunk-JNWZQ27S.js → chunk-UCOJC6EB.js} +72 -23
  144. package/chunks/{chunk-W7H223ZZ.js → chunk-UGYMA4EI.js} +1 -1
  145. package/chunks/{chunk-X6YQWCIJ.js → chunk-UH3WSE5L.js} +13 -1
  146. package/chunks/{chunk-2LL7TXB4.js → chunk-UH7242DI.js} +3 -3
  147. package/chunks/{chunk-CB2HFGRV.js → chunk-UJV643E2.js} +31 -6
  148. package/chunks/chunk-UO7DCGEV.js +121 -0
  149. package/chunks/{chunk-Y2ENGUD6.js → chunk-UPF7PTBI.js} +79 -2
  150. package/chunks/chunk-UW5EOVUN.js +249 -0
  151. package/chunks/{chunk-SJMV7ZBK.js → chunk-VLVO52KC.js} +8 -8
  152. package/chunks/{chunk-R3VWUU2E.js → chunk-VYPFXUCB.js} +1 -1
  153. package/chunks/{chunk-S2W2LVDU.js → chunk-WHFK6G6U.js} +8 -9
  154. package/chunks/chunk-WI3KCKZ5.js +391 -0
  155. package/chunks/{chunk-NGFEPAE6.js → chunk-WLEFWSSC.js} +8 -6
  156. package/chunks/{chunk-XVVH63JG.js → chunk-WUJXJ34P.js} +3 -3
  157. package/chunks/{chunk-MAQQGNQ5.js → chunk-WYLPWQHJ.js} +56 -717
  158. package/chunks/{chunk-D2VIDMVM.js → chunk-X6N25LXS.js} +2 -2
  159. package/chunks/chunk-XAWJ2526.js +1049 -0
  160. package/chunks/{chunk-CV63PP6U.js → chunk-YCIM6O3I.js} +1 -1
  161. package/chunks/{chunk-OEO2ERWK.js → chunk-Z44CVEUF.js} +54 -33
  162. package/chunks/{chunk-TKLLK6XQ.js → chunk-ZT4POVWC.js} +11 -11
  163. package/chunks/{chunk-NIJEXGV6.js → chunk-ZXYUQXY5.js} +148 -10
  164. package/chunks/{computer-use-NIWQNUZF.js → computer-use-UJ5T34TE.js} +50 -37
  165. package/chunks/{config-utils-AHQ6YZ66.js → config-utils-XQRXHAN3.js} +3 -3
  166. package/chunks/contextCommand-CSCB4E5M.js +79 -0
  167. package/chunks/{create-sub-session-MGNX52P3.js → create-sub-session-55F3GOLK.js} +46 -33
  168. package/chunks/{create-sub-session-P26FE5GG.js → create-sub-session-JPCSYZAJ.js} +3 -3
  169. package/chunks/{cron-create-JWFHBDRQ.js → cron-create-CUMELMPL.js} +6 -6
  170. package/chunks/{cron-delete-GDX4E26G.js → cron-delete-QZFV6U3P.js} +5 -5
  171. package/chunks/{cron-list-USMAIWPT.js → cron-list-IDKO7ZO2.js} +5 -5
  172. package/chunks/{daemon-RG2MAI6T.js → daemon-7LP7R6IU.js} +500 -133
  173. package/chunks/daemon-status-provider-6YNZ3UAE.js +88 -0
  174. package/chunks/{de-I7ZIYXZC.js → de-4IBXM7CN.js} +5 -1
  175. package/chunks/{dist-WGTQO7F2.js → dist-376652EZ.js} +114 -28
  176. package/chunks/{dist-53PZYC5B.js → dist-3YCTE6HD.js} +2 -2
  177. package/chunks/{dist-2BHAYBKP.js → dist-D7Z3HOO7.js} +14 -2
  178. package/chunks/{dist-FUTEXY6A.js → dist-MEGJFGAI.js} +40 -9
  179. package/chunks/{dist-2MIU4UUH.js → dist-NQ436QEX.js} +1 -1
  180. package/chunks/{dist-AU7NQQRP.js → dist-NQNTOIEN.js} +26 -2
  181. package/chunks/earlyInputCapture-HPUVJ2KH.js +81 -0
  182. package/chunks/{edit-3QV3JZJL.js → edit-7CMAN3F4.js} +50 -39
  183. package/chunks/{en-XE34GKAA.js → en-SALLIJS7.js} +6 -1
  184. package/chunks/{enter-worktree-4GMMF7EG.js → enter-worktree-3PH4YTY2.js} +49 -36
  185. package/chunks/{enterPlanMode-L5UWBAUC.js → enterPlanMode-MSXLSWLI.js} +55 -37
  186. package/chunks/{environment-3OV7UQOT.js → environment-KS36ZHBE.js} +48 -35
  187. package/chunks/errors-LCPFS62A.js +87 -0
  188. package/chunks/{exit-worktree-DDP57JLV.js → exit-worktree-ARA4C3CK.js} +49 -36
  189. package/chunks/{exitPlanMode-CJBLGPIP.js → exitPlanMode-GCDIQPB7.js} +49 -36
  190. package/chunks/{fast-path-M6RP2ING.js → fast-path-IDHBVIT6.js} +3 -2
  191. package/chunks/{fr-X7KDVZIY.js → fr-WVHEBDDB.js} +5 -1
  192. package/chunks/{gemini-H4PHBJTL.js → gemini-2AFQJMX5.js} +141 -105
  193. package/chunks/{geminiContentGenerator-VURJYPWP.js → geminiContentGenerator-UDIH3YI6.js} +9 -8
  194. package/chunks/{getMachineId-bsd-EXV7SWPA.js → getMachineId-bsd-QFVLPUPT.js} +1 -1
  195. package/chunks/{getMachineId-darwin-IUOMFXU3.js → getMachineId-darwin-DGMQQE2E.js} +1 -1
  196. package/chunks/{getMachineId-linux-K7XJYFHL.js → getMachineId-linux-R4Z6CSWC.js} +1 -1
  197. package/chunks/{getMachineId-unsupported-EA5FDRJ6.js → getMachineId-unsupported-Z3SBVBUV.js} +1 -1
  198. package/chunks/{getMachineId-win-KBA6RAI5.js → getMachineId-win-SCK5UFDT.js} +1 -1
  199. package/chunks/{glob-2KUSRAVQ.js → glob-HCL7HZ67.js} +49 -36
  200. package/chunks/{grep-B5RXVESV.js → grep-CJLBSCTV.js} +49 -36
  201. package/chunks/handleAutoUpdate-Q572P3FL.js +80 -0
  202. package/chunks/i18n-OBB4R7SR.js +96 -0
  203. package/chunks/initializer-LXEY6V3C.js +85 -0
  204. package/chunks/installationInfo-XUAOVMEE.js +79 -0
  205. package/chunks/{ja-2ICT3KXF.js → ja-KY4ROZTE.js} +5 -1
  206. package/chunks/{keychain-token-storage-DWRJMNH3.js → keychain-token-storage-6ACJDYIB.js} +3 -3
  207. package/chunks/{kittyProtocolDetector-HCNNKJTI.js → kittyProtocolDetector-MBRTDRBK.js} +5 -3
  208. package/chunks/list-WAXY7QOU.js +88 -0
  209. package/chunks/list-agents-AH3P5NB7.js +80 -0
  210. package/chunks/loadedSettingsAdapter-OZFNBRHE.js +82 -0
  211. package/chunks/loggingContentGenerator-7WDTTE6G.js +1068 -0
  212. package/chunks/{loop-wakeup-5GLTUBHA.js → loop-wakeup-IHRW6TNB.js} +7 -7
  213. package/chunks/{ls-FHBY3Y7I.js → ls-ZAXZ2G2W.js} +5 -5
  214. package/chunks/{lsp-B6VMEW6Y.js → lsp-R4ZG3UGQ.js} +3 -3
  215. package/chunks/managed-npm-update-N42DO5QW.js +339 -0
  216. package/chunks/mcp-6SOORKTY.js +82 -0
  217. package/chunks/{monitor-GLJZDNPS.js → monitor-4PSVNVU4.js} +51 -37
  218. package/chunks/node-UUDY34IG.js +305 -0
  219. package/chunks/nonInteractiveCli-FBR5S7IZ.js +140 -0
  220. package/chunks/{notebook-edit-AVCIWS4F.js → notebook-edit-QK26632S.js} +50 -39
  221. package/chunks/{openaiContentGenerator-B7W24G3D.js → openaiContentGenerator-IXJS6C2U.js} +33 -20
  222. package/chunks/pidfile-UCFCJOAP.js +85 -0
  223. package/chunks/{processUtils-XZPY2PBB.js → processUtils-YL2LXON2.js} +2 -2
  224. package/chunks/{pt-JJ4XPIBP.js → pt-OK455PLH.js} +5 -1
  225. package/chunks/{qwenContentGenerator-6GUTWJIC.js → qwenContentGenerator-H6WZPJKC.js} +56 -36
  226. package/chunks/{qwenOAuth2-GASEEWGU.js → qwenOAuth2-HTROHKXO.js} +10 -23
  227. package/chunks/read-file-FOYTMUNL.js +31 -0
  228. package/chunks/{read-mcp-resource-AKCL7I43.js → read-mcp-resource-65BWNF3F.js} +3 -3
  229. package/chunks/{record-artifact-PEUB7727.js → record-artifact-2RLSOP6U.js} +3 -3
  230. package/chunks/resumeHistoryUtils-ZNHTWBXS.js +90 -0
  231. package/chunks/ripGrep-K4K4QLNJ.js +72 -0
  232. package/chunks/{ru-STR4KTW7.js → ru-7SPDGMGD.js} +5 -1
  233. package/chunks/{run-qwen-serve-OZGR3FQA.js → run-qwen-serve-XI4MCAFV.js} +343 -88
  234. package/chunks/runtime-4CTBU5WX.js +115 -0
  235. package/chunks/{scheduler-Z7QLMUWA.js → scheduler-TTEITHBF.js} +46 -33
  236. package/chunks/sdk-exporters-grpc-N3OLDF63.js +23214 -0
  237. package/chunks/sdk-exporters-http-AOHAEOMC.js +563 -0
  238. package/chunks/sdk-impl-TLQOC7P4.js +9193 -0
  239. package/chunks/{send-message-3RHE7HSM.js → send-message-GEY4CNPS.js} +47 -8
  240. package/chunks/serve-W7UKJTQT.js +88 -0
  241. package/chunks/{server-SO64U3X5.js → server-JD5PIE7A.js} +3069 -517
  242. package/chunks/{session-2KL2WQAH.js → session-R4BDHLYR.js} +112 -177
  243. package/chunks/{settings-KITVOUSV.js → settings-BXZHA6TZ.js} +50 -37
  244. package/chunks/shell-XYMFCGN5.js +82 -0
  245. package/chunks/{skill-SOQHY455.js → skill-YKXYEPOF.js} +25 -20
  246. package/chunks/spawnChannel-IO4HQLFS.js +81 -0
  247. package/chunks/{src-43LM7JLB.js → src-LKKTJ4NG.js} +382 -235
  248. package/chunks/standalone-update-76JG7DVN.js +91 -0
  249. package/chunks/{startInteractiveUI-3RGTGEX5.js → startInteractiveUI-BXWQUXAS.js} +1314 -958
  250. package/chunks/{syntheticOutput-FG5PQKIR.js → syntheticOutput-2WNMXEU5.js} +4 -4
  251. package/chunks/task-create-R5H74Y76.js +25 -0
  252. package/chunks/{task-list-QWSY4ZIU.js → task-list-WXAFDSRY.js} +7 -7
  253. package/chunks/{task-stop-GWC6UWAL.js → task-stop-CHFZP23W.js} +4 -4
  254. package/chunks/{task-update-NCTAB73Q.js → task-update-Z44A4GAR.js} +11 -9
  255. package/chunks/{team-create-FXN3PEBP.js → team-create-5Y3MCAIM.js} +49 -36
  256. package/chunks/{team-delete-KK37HTOG.js → team-delete-YDCMRSI4.js} +7 -7
  257. package/chunks/{team-plan-approval-GEIZ356Q.js → team-plan-approval-HYJJZ76T.js} +49 -36
  258. package/chunks/theme-manager-3YF2SUZL.js +76 -0
  259. package/chunks/{todoWrite-ERCAMLFS.js → todoWrite-ED2IVZJL.js} +5 -5
  260. package/chunks/{tool-search-XKK7DNOK.js → tool-search-3ZO2XMEP.js} +21 -17
  261. package/chunks/total-session-admission-NDF7EVG7.js +83 -0
  262. package/chunks/trustedFolders-Q7RALK4T.js +92 -0
  263. package/chunks/{chunk-6EFTQYW7.js → undici-3FJYTMOF.js} +24 -399
  264. package/chunks/{chunk-L573Z2QZ.js → undici-PYHBDDPN.js} +1 -5
  265. package/chunks/{update-relaunch-FMVZK6XF.js → update-relaunch-BTW5XGVT.js} +17 -17
  266. package/chunks/updateCheck-MXIU6DWQ.js +91 -0
  267. package/chunks/useAutoAcceptIndicator-BJXHJW77.js +92 -0
  268. package/chunks/{validateNonInterActiveAuth-PRVEB6GG.js → validateNonInterActiveAuth-FLEPF3QQ.js} +90 -76
  269. package/chunks/{version-AZMG6KWL.js → version-75VRONIL.js} +1 -1
  270. package/chunks/{web-fetch-EPGJ5OQQ.js → web-fetch-5X27LYHB.js} +101 -41
  271. package/chunks/web-search-IDMTBJUP.js +718 -0
  272. package/chunks/{workflow-UTNVPW22.js → workflow-JOD2OPFQ.js} +54 -40
  273. package/chunks/workspace-providers-status-WDLBDLPG.js +85 -0
  274. package/chunks/{workspace-registration-store-F3ZX3YHT.js → workspace-registration-store-26Z6J6P5.js} +9 -3
  275. package/chunks/workspace-registry-IABDATX3.js +87 -0
  276. package/chunks/workspace-service-BI4KDYPD.js +97 -0
  277. package/chunks/workspace-skills-status-OVB4LPHA.js +84 -0
  278. package/chunks/write-file-276AJ7KE.js +72 -0
  279. package/chunks/{zh-6ANG2HTL.js → zh-Q54GA5SV.js} +6 -1
  280. package/chunks/{zh-TW-4RR3YHNN.js → zh-TW-VOBNFOPU.js} +6 -1
  281. package/cli-entry.js +164 -12
  282. package/cli.js +19 -12
  283. package/locales/ca.js +773 -203
  284. package/locales/de.js +8 -2
  285. package/locales/en.js +9 -2
  286. package/locales/fr.js +8 -2
  287. package/locales/ja.js +8 -2
  288. package/locales/pt.js +8 -2
  289. package/locales/ru.js +8 -2
  290. package/locales/zh-TW.js +9 -2
  291. package/locales/zh.js +9 -2
  292. package/package.json +3 -3
  293. package/web-shell/assets/{arc-Buk1besA.js → arc-CMb7lr2P.js} +1 -1
  294. package/web-shell/assets/{architectureDiagram-3BPJPVTR-B1aUKYDC.js → architectureDiagram-3BPJPVTR-D6KQ5Kwm.js} +1 -1
  295. package/web-shell/assets/{blockDiagram-GPEHLZMM-CRTdg3Zx.js → blockDiagram-GPEHLZMM-Ce7YYSf8.js} +1 -1
  296. package/web-shell/assets/{c4Diagram-AAUBKEIU-DFdRMp5g.js → c4Diagram-AAUBKEIU-DaStHfor.js} +1 -1
  297. package/web-shell/assets/channel-Dg4f-Kry.js +1 -0
  298. package/web-shell/assets/{chunk-2J33WTMH-4rYQdkEI.js → chunk-2J33WTMH-CPaqadg9.js} +1 -1
  299. package/web-shell/assets/{chunk-4BX2VUAB-Coi-pQJy.js → chunk-4BX2VUAB-Veh9ZGKg.js} +1 -1
  300. package/web-shell/assets/{chunk-55IACEB6-BtBjz02t.js → chunk-55IACEB6-BPTX5n4q.js} +1 -1
  301. package/web-shell/assets/{chunk-727SXJPM-CGYOWorl.js → chunk-727SXJPM-CtXsE_ca.js} +1 -1
  302. package/web-shell/assets/{chunk-AQP2D5EJ-CH5AKhqx.js → chunk-AQP2D5EJ-D8DDCJ8h.js} +1 -1
  303. package/web-shell/assets/{chunk-FMBD7UC4-Cd50-w85.js → chunk-FMBD7UC4-cjMDGzHz.js} +1 -1
  304. package/web-shell/assets/{chunk-ND2GUHAM-C2wF3KCK.js → chunk-ND2GUHAM-BaZ1hNhV.js} +1 -1
  305. package/web-shell/assets/{chunk-QZHKN3VN-pCeRTaWi.js → chunk-QZHKN3VN-C7w-9w5-.js} +1 -1
  306. package/web-shell/assets/classDiagram-4FO5ZUOK-CT7Fo2aW.js +1 -0
  307. package/web-shell/assets/classDiagram-v2-Q7XG4LA2-CT7Fo2aW.js +1 -0
  308. package/web-shell/assets/{cose-bilkent-S5V4N54A-B-_fAB6D.js → cose-bilkent-S5V4N54A-DqvBEEIe.js} +1 -1
  309. package/web-shell/assets/{dagre-BM42HDAG-ChSPNHpL.js → dagre-BM42HDAG-RkPyoMAk.js} +1 -1
  310. package/web-shell/assets/{diagram-2AECGRRQ-BX7cFOF3.js → diagram-2AECGRRQ-D9b6nNyg.js} +1 -1
  311. package/web-shell/assets/{diagram-5GNKFQAL-BQUTW92n.js → diagram-5GNKFQAL-CiiNKUIy.js} +1 -1
  312. package/web-shell/assets/{diagram-KO2AKTUF-BkYPh3e4.js → diagram-KO2AKTUF-CP1qizXd.js} +1 -1
  313. package/web-shell/assets/{diagram-LMA3HP47-Cl6jsNyx.js → diagram-LMA3HP47-BGe30TWx.js} +1 -1
  314. package/web-shell/assets/{diagram-OG6HWLK6-DRWoHz8n.js → diagram-OG6HWLK6-CvoEPARH.js} +1 -1
  315. package/web-shell/assets/{erDiagram-TEJ5UH35-CGvFcZco.js → erDiagram-TEJ5UH35-DWfLzVkV.js} +1 -1
  316. package/web-shell/assets/{flowDiagram-I6XJVG4X-vms6oVdv.js → flowDiagram-I6XJVG4X-D-dTQmo6.js} +1 -1
  317. package/web-shell/assets/{ganttDiagram-6RSMTGT7-ukT_sfmi.js → ganttDiagram-6RSMTGT7-CYPHKaGY.js} +1 -1
  318. package/web-shell/assets/{gitGraphDiagram-PVQCEYII-Bn2ZE2Ut.js → gitGraphDiagram-PVQCEYII-DA7_aQYD.js} +1 -1
  319. package/web-shell/assets/index-B0i-TOYM.css +5 -0
  320. package/web-shell/assets/index-CgCHD46L.js +1225 -0
  321. package/web-shell/assets/{index-wFXp7W68.js → index-DqHNAB8C.js} +1 -1
  322. package/web-shell/assets/{infoDiagram-5YYISTIA-DHJdSi7x.js → infoDiagram-5YYISTIA-B87ljDPa.js} +1 -1
  323. package/web-shell/assets/{ishikawaDiagram-YF4QCWOH-DOvd2Wph.js → ishikawaDiagram-YF4QCWOH-CYSpyjaN.js} +1 -1
  324. package/web-shell/assets/{journeyDiagram-JHISSGLW-CH_urMCT.js → journeyDiagram-JHISSGLW-DAL6Js6f.js} +1 -1
  325. package/web-shell/assets/{kanban-definition-UN3LZRKU-FKiBdgbH.js → kanban-definition-UN3LZRKU-_zufKGJv.js} +1 -1
  326. package/web-shell/assets/{linear-0ZVQFVKf.js → linear-DidhMgku.js} +1 -1
  327. package/web-shell/assets/{mermaid.core-DJ05ZZIK.js → mermaid.core-DAkX3h3a.js} +5 -5
  328. package/web-shell/assets/{mindmap-definition-RKZ34NQL-BPuUhkUm.js → mindmap-definition-RKZ34NQL-DbZxUBEH.js} +1 -1
  329. package/web-shell/assets/{pieDiagram-4H26LBE5-yLFKcXyG.js → pieDiagram-4H26LBE5-Du9uoqrf.js} +1 -1
  330. package/web-shell/assets/{quadrantDiagram-W4KKPZXB-irWqc1pE.js → quadrantDiagram-W4KKPZXB-DwjELuKm.js} +1 -1
  331. package/web-shell/assets/{requirementDiagram-4Y6WPE33-B_4uMoIV.js → requirementDiagram-4Y6WPE33-BAqfVtBL.js} +1 -1
  332. package/web-shell/assets/{sankeyDiagram-5OEKKPKP-ciA4GPwk.js → sankeyDiagram-5OEKKPKP--hm2VpmK.js} +1 -1
  333. package/web-shell/assets/{sequenceDiagram-3UESZ5HK-CRdZvy0U.js → sequenceDiagram-3UESZ5HK-R5MUQaIt.js} +1 -1
  334. package/web-shell/assets/{stateDiagram-AJRCARHV-DaYIkCCn.js → stateDiagram-AJRCARHV-VsX032xQ.js} +1 -1
  335. package/web-shell/assets/stateDiagram-v2-BHNVJYJU-uPWLcSfy.js +1 -0
  336. package/web-shell/assets/{timeline-definition-PNZ67QCA-oBUKv6iH.js → timeline-definition-PNZ67QCA-BqjVRXzg.js} +1 -1
  337. package/web-shell/assets/{vennDiagram-CIIHVFJN-CGW9Sdmb.js → vennDiagram-CIIHVFJN-i2tkvlkg.js} +1 -1
  338. package/web-shell/assets/{wardley-L42UT6IY-CvwKJOCm.js → wardley-L42UT6IY-Ch8G49EM.js} +1 -1
  339. package/web-shell/assets/{wardleyDiagram-YWT4CUSO-Ipc260sN.js → wardleyDiagram-YWT4CUSO-bYpWeQNy.js} +1 -1
  340. package/web-shell/assets/{xychartDiagram-2RQKCTM6-D6-CM7pK.js → xychartDiagram-2RQKCTM6-C9NhuBqB.js} +1 -1
  341. package/web-shell/index.html +17 -13
  342. package/chunks/MaxSizedBox-B5YGZSYE.js +0 -72
  343. package/chunks/agent-H4JIDL7S.js +0 -67
  344. package/chunks/agent-headless-TTBEREQV.js +0 -61
  345. package/chunks/bridge-VL7ITBU5.js +0 -75
  346. package/chunks/chunk-542SK7KV.js +0 -8293
  347. package/chunks/chunk-CPCVCKKF.js +0 -358
  348. package/chunks/chunk-SEKHYHMS.js +0 -45
  349. package/chunks/chunk-W7FJ3N32.js +0 -49
  350. package/chunks/chunk-ZFKNWQGQ.js +0 -74639
  351. package/chunks/contextCommand-L2COEUHS.js +0 -66
  352. package/chunks/daemon-status-provider-NL4IAG7B.js +0 -74
  353. package/chunks/earlyInputCapture-L6I2A22T.js +0 -68
  354. package/chunks/errors-LEOF5QG4.js +0 -74
  355. package/chunks/handleAutoUpdate-QQVIWXKT.js +0 -67
  356. package/chunks/i18n-N6OBDORT.js +0 -83
  357. package/chunks/initializer-6WCFNDLL.js +0 -72
  358. package/chunks/installationInfo-6J3WPXNS.js +0 -64
  359. package/chunks/list-HOWQSWP6.js +0 -75
  360. package/chunks/loadedSettingsAdapter-AO4YBRXZ.js +0 -69
  361. package/chunks/mcp-QH7QNXOH.js +0 -69
  362. package/chunks/nonInteractiveCli-TI7EMPXD.js +0 -126
  363. package/chunks/pidfile-UEHAT6DH.js +0 -72
  364. package/chunks/read-file-SQJONF6A.js +0 -29
  365. package/chunks/resumeHistoryUtils-PFQ2A23X.js +0 -78
  366. package/chunks/ripGrep-QCK22GDU.js +0 -59
  367. package/chunks/runtime-SNVAP6EH.js +0 -100
  368. package/chunks/serve-BT7KS6SC.js +0 -75
  369. package/chunks/shell-BITUVH2R.js +0 -69
  370. package/chunks/spawnChannel-2BU3AULL.js +0 -68
  371. package/chunks/standalone-update-YG5JUYCM.js +0 -78
  372. package/chunks/task-create-HX32YXO7.js +0 -23
  373. package/chunks/theme-manager-IAETOI25.js +0 -63
  374. package/chunks/total-session-admission-BJLDHKJN.js +0 -69
  375. package/chunks/trustedFolders-5XCVNEUU.js +0 -79
  376. package/chunks/updateCheck-YZZB7YBU.js +0 -70
  377. package/chunks/useAutoAcceptIndicator-ZSQX4I2H.js +0 -80
  378. package/chunks/workspace-providers-status-EADV364W.js +0 -72
  379. package/chunks/workspace-registry-W6VMFYZU.js +0 -73
  380. package/chunks/workspace-service-F3KIN2UN.js +0 -84
  381. package/chunks/workspace-skills-status-YVICUR5Y.js +0 -71
  382. package/chunks/write-file-CVGF2OKV.js +0 -596
  383. package/web-shell/assets/channel-04R0vLbG.js +0 -1
  384. package/web-shell/assets/classDiagram-4FO5ZUOK-Bw9SOwAV.js +0 -1
  385. package/web-shell/assets/classDiagram-v2-Q7XG4LA2-Bw9SOwAV.js +0 -1
  386. package/web-shell/assets/index-DgkKrjw3.js +0 -1187
  387. package/web-shell/assets/index-Rv6mOAN9.css +0 -5
  388. package/web-shell/assets/stateDiagram-v2-BHNVJYJU-DWBoO4UY.js +0 -1
@@ -1,15 +1,75 @@
1
1
  // Force strict mode and setup for ESM
2
2
  "use strict";
3
+ import {
4
+ classifyApiError
5
+ } from "./chunk-V7RNNPGC.js";
6
+ import {
7
+ buildPermissionSuggestions
8
+ } from "./chunk-43T5WDQ7.js";
3
9
  import {
4
10
  TUI_CHAT_RECORDING_FAILURE_MESSAGE,
5
11
  reportChatRecordingFailureToAdapter
6
- } from "./chunk-O3OCNYY5.js";
12
+ } from "./chunk-PDYB7HG2.js";
13
+ import {
14
+ MAX_SUGGESTIONS_TO_SHOW,
15
+ buildMcpResourceRef,
16
+ buildMcpServerRef,
17
+ getExtensionSuggestions,
18
+ handleAtCommand,
19
+ matchMcpServerPrefix,
20
+ resolveAtCommandQuery,
21
+ sanitizeDisplayText
22
+ } from "./chunk-F5MBYZSU.js";
7
23
  import {
8
24
  StreamJsonOutputAdapter
9
- } from "./chunk-4EP2PYYL.js";
25
+ } from "./chunk-2G6QIHYL.js";
26
+ import {
27
+ BuiltinCommandLoader,
28
+ BundledSkillLoader,
29
+ CommandService,
30
+ DISPLAY_HOOK_EVENTS,
31
+ FileCommandLoader,
32
+ MAX_STACKED_SKILLS,
33
+ McpPromptLoader,
34
+ SavedWorkflowLoader,
35
+ SkillCommandLoader,
36
+ addConfigToMatcherGroup,
37
+ appendUserPromptExpansionAdditionalContext,
38
+ copyToClipboard,
39
+ createEmptyHookEventInfo,
40
+ findMidInputSlashCommand,
41
+ findSlashCommandTokens,
42
+ formatApprovalModeDescription,
43
+ formatApprovalModeName,
44
+ formatUserPromptExpansionBlockedMessage,
45
+ getAllConfigs,
46
+ getBestSlashCommandMatch,
47
+ getTranslatedSourceDisplayMap,
48
+ hasBlockingBackgroundWork,
49
+ hasSlashCommandPathSeparator,
50
+ isAtCommand,
51
+ isBtwCommand,
52
+ isMidInputCompletableCommand,
53
+ isSlashCommand,
54
+ normalizePartList,
55
+ parseSlashCommand,
56
+ parseStackedSlashCommands,
57
+ refreshExtensionContentRuntime,
58
+ resetBackgroundStateForSessionSwitch,
59
+ serializeUserPromptExpansionPrompt,
60
+ supportsMatchers
61
+ } from "./chunk-BW5Z5NOG.js";
62
+ import "./chunk-BJBUDCM3.js";
10
63
  import {
11
64
  startPostRenderPrefetches
12
- } from "./chunk-DBE4QFZS.js";
65
+ } from "./chunk-MB7ENXPR.js";
66
+ import {
67
+ EXTENSION_RELOAD_FAILED_REASON,
68
+ ExtensionRefreshState,
69
+ appEvents,
70
+ cleanupReviewWorktreeLeases,
71
+ loadHierarchicalGeminiMemory
72
+ } from "./chunk-JKCALGYN.js";
13
73
  import {
14
74
  AboutBox,
15
75
  BaseSelectionList,
@@ -85,7 +145,21 @@ import {
85
145
  useTextBuffer,
86
146
  useUIActions,
87
147
  useUIState
88
- } from "./chunk-TMQ6XQCX.js";
148
+ } from "./chunk-CK3IEEHR.js";
149
+ import {
150
+ getCommandDisplayName,
151
+ getCommandSourceBadge
152
+ } from "./chunk-SJEDL7DI.js";
153
+ import {
154
+ computeSessionStats,
155
+ levelLabel
156
+ } from "./chunk-UH7242DI.js";
157
+ import "./chunk-4WGODMVR.js";
158
+ import {
159
+ MaxSizedBox,
160
+ OverflowProvider,
161
+ useOverflowState
162
+ } from "./chunk-UCOJC6EB.js";
89
163
  import {
90
164
  GeminiRespondingSpinner,
91
165
  GeminiSpinner,
@@ -98,87 +172,28 @@ import {
98
172
  expandCollapsedHistory,
99
173
  isCollapsibleTool,
100
174
  useStreamingContext
101
- } from "./chunk-PF4CHQOJ.js";
175
+ } from "./chunk-Q6GU6TKM.js";
176
+ import {
177
+ theme
178
+ } from "./chunk-6IL7KRLE.js";
102
179
  import {
103
180
  stopAndGetCapturedInput
104
- } from "./chunk-5SCI6E3E.js";
181
+ } from "./chunk-E4IMU4Y5.js";
182
+ import {
183
+ disableKittyProtocol,
184
+ isKittyProtocolEnabled,
185
+ isKittyProtocolSupported,
186
+ pushKittyProtocolFlags
187
+ } from "./chunk-PQNHRFJC.js";
105
188
  import {
106
189
  useAutoAcceptIndicator
107
- } from "./chunk-FQD7GFSV.js";
190
+ } from "./chunk-HJJDKFL5.js";
108
191
  import {
109
192
  KeypressProvider,
110
193
  useFocus,
111
194
  useKeypress,
112
195
  useKeypressContext
113
- } from "./chunk-O3Z73NBP.js";
114
- import {
115
- classifyApiError
116
- } from "./chunk-V7RNNPGC.js";
117
- import {
118
- MAX_SUGGESTIONS_TO_SHOW,
119
- buildMcpResourceRef,
120
- buildMcpServerRef,
121
- getExtensionSuggestions,
122
- handleAtCommand,
123
- matchMcpServerPrefix,
124
- resolveAtCommandQuery,
125
- sanitizeDisplayText
126
- } from "./chunk-IVPSS6EL.js";
127
- import {
128
- BuiltinCommandLoader,
129
- BundledSkillLoader,
130
- CommandService,
131
- DISPLAY_HOOK_EVENTS,
132
- FileCommandLoader,
133
- MAX_STACKED_SKILLS,
134
- McpPromptLoader,
135
- SavedWorkflowLoader,
136
- SkillCommandLoader,
137
- addConfigToMatcherGroup,
138
- appendUserPromptExpansionAdditionalContext,
139
- copyToClipboard,
140
- createEmptyHookEventInfo,
141
- findMidInputSlashCommand,
142
- findSlashCommandTokens,
143
- formatApprovalModeDescription,
144
- formatApprovalModeName,
145
- formatUserPromptExpansionBlockedMessage,
146
- getAllConfigs,
147
- getBestSlashCommandMatch,
148
- getTranslatedSourceDisplayMap,
149
- hasBlockingBackgroundWork,
150
- hasSlashCommandPathSeparator,
151
- isAtCommand,
152
- isBtwCommand,
153
- isMidInputCompletableCommand,
154
- isSlashCommand,
155
- normalizePartList,
156
- parseSlashCommand,
157
- parseStackedSlashCommands,
158
- refreshExtensionContentRuntime,
159
- resetBackgroundStateForSessionSwitch,
160
- serializeUserPromptExpansionPrompt,
161
- supportsMatchers
162
- } from "./chunk-PBWEWI4N.js";
163
- import {
164
- EXTENSION_RELOAD_FAILED_REASON,
165
- ExtensionRefreshState,
166
- appEvents,
167
- loadHierarchicalGeminiMemory
168
- } from "./chunk-4XNLIGVA.js";
169
- import {
170
- getCommandDisplayName,
171
- getCommandSourceBadge
172
- } from "./chunk-HZPN55E5.js";
173
- import {
174
- computeSessionStats,
175
- levelLabel
176
- } from "./chunk-2LL7TXB4.js";
177
- import {
178
- disableKittyProtocol,
179
- isKittyProtocolEnabled,
180
- isKittyProtocolSupported
181
- } from "./chunk-5DTTYNB7.js";
196
+ } from "./chunk-RW2NEXYJ.js";
182
197
  import {
183
198
  BEL,
184
199
  OSC_PREFIX,
@@ -192,27 +207,10 @@ import {
192
207
  saveClipboardImage,
193
208
  wrapForMultiplexer,
194
209
  writeOsc52
195
- } from "./chunk-QKYTTBYW.js";
196
- import "./chunk-A5LYNIW7.js";
197
- import "./chunk-4WGODMVR.js";
198
- import "./chunk-ANPINBOF.js";
199
- import "./chunk-KW7NOTN6.js";
200
- import {
201
- MaxSizedBox,
202
- OverflowProvider,
203
- useOverflowState
204
- } from "./chunk-JNWZQ27S.js";
205
- import {
206
- theme
207
- } from "./chunk-GMGDLUC7.js";
210
+ } from "./chunk-4LVZNIDO.js";
208
211
  import {
209
212
  require_jsx_runtime
210
213
  } from "./chunk-SV5PQVQE.js";
211
- import {
212
- AUTO_THEME_NAME,
213
- DEFAULT_THEME,
214
- themeManager
215
- } from "./chunk-AYCDXHZB.js";
216
214
  import {
217
215
  Box_default,
218
216
  Static,
@@ -226,33 +224,40 @@ import {
226
224
  use_is_screen_reader_enabled_default,
227
225
  use_stdin_default,
228
226
  use_stdout_default
229
- } from "./chunk-NEEB7UEN.js";
230
- import {
231
- require_react
232
- } from "./chunk-5QWWOFGG.js";
233
- import "./chunk-KDC6GNQR.js";
234
- import "./chunk-542SK7KV.js";
235
- import "./chunk-NHDKSOEY.js";
227
+ } from "./chunk-6GMVPFB2.js";
236
228
  import {
237
229
  relaunchApp
238
- } from "./chunk-AJSJ5TTU.js";
230
+ } from "./chunk-LP2E4MQG.js";
239
231
  import {
240
232
  setUpdateHandler
241
- } from "./chunk-OEO2ERWK.js";
242
- import "./chunk-KG3XV6FH.js";
243
- import "./chunk-S2W2LVDU.js";
233
+ } from "./chunk-Z44CVEUF.js";
234
+ import "./chunk-H4YKEV2X.js";
235
+ import {
236
+ AUTO_THEME_NAME,
237
+ DEFAULT_THEME,
238
+ themeManager
239
+ } from "./chunk-7Z6JQEL6.js";
240
+ import "./chunk-KW7NOTN6.js";
241
+ import {
242
+ require_react
243
+ } from "./chunk-5QWWOFGG.js";
244
+ import "./chunk-LEEWLFHW.js";
245
+ import {
246
+ getErrorMessage as getErrorMessage2
247
+ } from "./chunk-JYUSL2V4.js";
248
+ import "./chunk-T3452DP5.js";
249
+ import "./chunk-WHFK6G6U.js";
244
250
  import "./chunk-YAF2MQZ6.js";
245
251
  import {
246
252
  openQwenAsrRealtimeStream,
247
253
  openVoiceStream,
248
254
  openVoiceStreamWithRetry
249
- } from "./chunk-GKY2OJ7R.js";
255
+ } from "./chunk-MOHAWVLH.js";
250
256
  import {
251
257
  recordGoalStatusItem,
252
258
  restoreGoalFromHistory
253
- } from "./chunk-PGEPSDJI.js";
254
- import "./chunk-KTUQMDEP.js";
255
- import "./chunk-D22SX43D.js";
259
+ } from "./chunk-FWNZ7CVN.js";
260
+ import "./chunk-4K7VDKAD.js";
256
261
  import {
257
262
  cpLen,
258
263
  cpSlice,
@@ -264,70 +269,71 @@ import {
264
269
  sanitizeTerminalText,
265
270
  stripUnsafeCharacters,
266
271
  toCodePoints
267
- } from "./chunk-RS7MT2QG.js";
272
+ } from "./chunk-IPUUTYMV.js";
273
+ import "./chunk-DWNZ6PVQ.js";
268
274
  import {
269
275
  stringWidth
270
- } from "./chunk-H2XVO6NE.js";
276
+ } from "./chunk-2MIN6GRR.js";
271
277
  import "./chunk-QHTIBUWB.js";
272
278
  import {
273
279
  isHistoryItemVisibleAfterRestore
274
280
  } from "./chunk-QTERJVPZ.js";
275
- import "./chunk-L573Z2QZ.js";
281
+ import "./chunk-3Z43GZUQ.js";
282
+ import {
283
+ assertVoiceBaseUrlNetworkAllowed,
284
+ isKeytermEcho,
285
+ isStreamingVoiceModel,
286
+ resolveVoiceStreamConfig,
287
+ transcribeVoiceAudio
288
+ } from "./chunk-3FB2Y2OE.js";
289
+ import {
290
+ formatUnsupportedVoiceModelMessage,
291
+ isSelectableVoiceModel
292
+ } from "./chunk-KJEMJWNH.js";
293
+ import "./chunk-QLJUC7TG.js";
276
294
  import "./chunk-RXFQM6FQ.js";
277
- import "./chunk-KOR3XKCA.js";
295
+ import "./chunk-PBII2NFX.js";
278
296
  import "./chunk-6H67XLET.js";
279
297
  import {
280
- getErrorMessage as getErrorMessage2
281
- } from "./chunk-VEXFOTEO.js";
298
+ createLoadedSettingsAdapter
299
+ } from "./chunk-LA5H3LM5.js";
282
300
  import {
283
301
  getExtendedSystemInfo
284
- } from "./chunk-NDMQLV4Y.js";
302
+ } from "./chunk-LBAO2XRA.js";
285
303
  import {
286
304
  formatDuration,
287
305
  formatMemoryUsage,
288
306
  formatRelativeTime,
289
307
  formatTokenCount
290
308
  } from "./chunk-E5Z2AVNV.js";
309
+ import "./chunk-BLFVGB7D.js";
310
+ import "./chunk-COH43MRJ.js";
291
311
  import {
292
312
  isInlineModelOverrideAllowed
293
- } from "./chunk-NGFEPAE6.js";
294
- import {
295
- assertVoiceBaseUrlNetworkAllowed,
296
- isKeytermEcho,
297
- isStreamingVoiceModel,
298
- resolveVoiceStreamConfig,
299
- transcribeVoiceAudio
300
- } from "./chunk-IR46U7RB.js";
301
- import {
302
- formatUnsupportedVoiceModelMessage,
303
- isSelectableVoiceModel
304
- } from "./chunk-S2PD3EZD.js";
305
- import "./chunk-BVLROR2T.js";
306
- import "./chunk-6RLROE6G.js";
307
- import "./chunk-COH43MRJ.js";
308
- import "./chunk-CB2HFGRV.js";
313
+ } from "./chunk-WLEFWSSC.js";
314
+ import "./chunk-PFSUKTZH.js";
315
+ import "./chunk-UJV643E2.js";
309
316
  import {
310
317
  requestConsentInteractive,
311
318
  requestConsentOrFail
312
- } from "./chunk-MJ6S23WZ.js";
319
+ } from "./chunk-HZEWYOVI.js";
313
320
  import "./chunk-57OAHC2Y.js";
314
- import "./chunk-YWEW33JY.js";
315
- import "./chunk-4ODB7WIB.js";
321
+ import "./chunk-HVO55LUD.js";
322
+ import "./chunk-QAFKR7WR.js";
316
323
  import "./chunk-V6WHFGST.js";
317
- import {
318
- createLoadedSettingsAdapter
319
- } from "./chunk-CZF3E5GF.js";
320
- import "./chunk-W7FJ3N32.js";
321
- import "./chunk-Y2ENGUD6.js";
322
- import "./chunk-TJTKSVIV.js";
324
+ import "./chunk-DP3IHZGG.js";
325
+ import "./chunk-BSNWBC33.js";
326
+ import "./chunk-2RFKHEXL.js";
327
+ import "./chunk-UPF7PTBI.js";
328
+ import "./chunk-JLU636DO.js";
329
+ import "./chunk-BK2UNYWD.js";
323
330
  import "./chunk-M5GB774H.js";
324
- import "./chunk-RFIAR4YL.js";
325
- import "./chunk-2HOVDT7W.js";
326
- import "./chunk-NIJEXGV6.js";
331
+ import "./chunk-RV4C2ZFG.js";
332
+ import "./chunk-ZXYUQXY5.js";
327
333
  import "./chunk-UDXSXLER.js";
328
334
  import {
329
335
  loadMcpApprovals
330
- } from "./chunk-7SXZC7ID.js";
336
+ } from "./chunk-2WTVWAKT.js";
331
337
  import {
332
338
  CORRUPTED_SUFFIX,
333
339
  SettingScope,
@@ -350,7 +356,7 @@ import {
350
356
  settingExistsInScope,
351
357
  validateSettingValue,
352
358
  writeOutputLanguageAndRegisterPath
353
- } from "./chunk-33XUAINQ.js";
359
+ } from "./chunk-J5UKQEFG.js";
354
360
  import "./chunk-RKUWKYED.js";
355
361
  import "./chunk-GOXKNSDZ.js";
356
362
  import "./chunk-IDS7MSUP.js";
@@ -359,17 +365,17 @@ import {
359
365
  localizeToolDisplayName,
360
366
  t,
361
367
  ta
362
- } from "./chunk-TKLLK6XQ.js";
363
- import "./chunk-TIH2ZTOC.js";
368
+ } from "./chunk-ZT4POVWC.js";
369
+ import "./chunk-32A4PI3E.js";
364
370
  import "./chunk-QRUIS3DN.js";
365
371
  import {
366
372
  getCliVersion
367
- } from "./chunk-OWCALFEG.js";
373
+ } from "./chunk-54R2CV2G.js";
368
374
  import "./chunk-VJNBRRZG.js";
369
375
  import {
370
376
  isWorkspaceTrusted,
371
377
  loadTrustedFolders
372
- } from "./chunk-I2PYAYFM.js";
378
+ } from "./chunk-CXUFILV3.js";
373
379
  import {
374
380
  require_strip_json_comments
375
381
  } from "./chunk-ALGGS7UH.js";
@@ -430,6 +436,7 @@ import {
430
436
  detectAutonomousSentinel,
431
437
  fetchGitDiff,
432
438
  fetchGitDiffHunks,
439
+ finalizeToolResponses,
433
440
  findExistingProviderModels,
434
441
  findProviderByCredentials,
435
442
  findProviderById,
@@ -444,7 +451,6 @@ import {
444
451
  getExtensionDisplayName,
445
452
  getGitBranch,
446
453
  getProjectSummaryInfo,
447
- getStartupContextLength,
448
454
  getTimeRangeBounds,
449
455
  getToolResponseDisplayText,
450
456
  getWelcomeBackState,
@@ -457,7 +463,6 @@ import {
457
463
  isSessionRuntimeActive,
458
464
  isSettledStatus,
459
465
  isSuccessStatus,
460
- isSystemReminderContent,
461
466
  isTerminalStatus,
462
467
  loadUsageHistory,
463
468
  markDuplicateProviderToolCallResponseSent,
@@ -476,7 +481,6 @@ import {
476
481
  resolveBaseUrl,
477
482
  resolveBranchName,
478
483
  resolveMetadataKey,
479
- resolveModelId,
480
484
  restoreWorktreeContext,
481
485
  saveWelcomeBackRestartChoice,
482
486
  saveWorkflowScript,
@@ -488,44 +492,67 @@ import {
488
492
  validateWorkflowName,
489
493
  watchRepoBranch,
490
494
  writeRuntimeStatus
491
- } from "./chunk-KX6UK4VJ.js";
495
+ } from "./chunk-LI4I37W4.js";
492
496
  import "./chunk-5M6IDOMF.js";
493
- import "./chunk-T4TZQJ7W.js";
497
+ import "./chunk-TWPJO254.js";
494
498
  import "./chunk-H6XPXXMH.js";
495
- import "./chunk-EAUYY7SS.js";
496
- import "./chunk-FSL5W5TI.js";
497
- import "./chunk-OONJNQ42.js";
498
- import "./chunk-D2VIDMVM.js";
499
- import "./chunk-E2UVIFI2.js";
500
- import "./chunk-XU457J4V.js";
499
+ import "./chunk-NOAAFNTJ.js";
500
+ import "./chunk-AFFGGOF6.js";
501
+ import "./chunk-RGG6M2WF.js";
502
+ import "./chunk-X6N25LXS.js";
503
+ import "./chunk-KRXPRVGL.js";
504
+ import "./chunk-6PVPNMXU.js";
505
+ import {
506
+ resolveModelId
507
+ } from "./chunk-UO7DCGEV.js";
508
+ import "./chunk-IRH27ZC2.js";
501
509
  import "./chunk-VDDGDZMA.js";
502
- import "./chunk-EIAK6Q2B.js";
510
+ import "./chunk-C3VHAXP2.js";
503
511
  import "./chunk-SZRN75WQ.js";
504
512
  import "./chunk-HTO4JFDZ.js";
505
513
  import "./chunk-CPBF7KYF.js";
506
514
  import {
507
- APPROVAL_MODES
508
- } from "./chunk-CPCVCKKF.js";
515
+ APPROVAL_MODES,
516
+ getStartupContextLength,
517
+ isSystemReminderContent,
518
+ runOutsideAgentContext
519
+ } from "./chunk-XAWJ2526.js";
509
520
  import "./chunk-6AM5D4ME.js";
510
- import "./chunk-G45X5TRN.js";
521
+ import "./chunk-NABLFI57.js";
511
522
  import {
512
523
  HOOKS_CONFIG_FIELDS
513
- } from "./chunk-PBATSWUQ.js";
524
+ } from "./chunk-QBUDF33N.js";
525
+ import "./chunk-JCW2R7WC.js";
514
526
  import {
515
527
  isPathWithinRoot
516
- } from "./chunk-ZEOZL37W.js";
517
- import "./chunk-OOCI5VVU.js";
528
+ } from "./chunk-57FIIFJN.js";
529
+ import "./chunk-LIZRAKPB.js";
518
530
  import {
519
531
  qwenOAuth2Events
520
- } from "./chunk-BRRF37CO.js";
521
- import "./chunk-BMWMT5Y2.js";
532
+ } from "./chunk-LYTBLSSW.js";
533
+ import "./chunk-WI3KCKZ5.js";
534
+ import "./chunk-DP5GT2MW.js";
522
535
  import "./chunk-JESCGQM3.js";
536
+ import {
537
+ REASONING_EFFORT_TIERS
538
+ } from "./chunk-XVNQMZ2I.js";
539
+ import {
540
+ getUnsupportedImageFormatWarning,
541
+ isSupportedImageMimeType
542
+ } from "./chunk-FODK6UMO.js";
543
+ import "./chunk-GLNBDYUX.js";
544
+ import "./chunk-DJ2GSRLV.js";
545
+ import "./chunk-R6D2CTQR.js";
546
+ import "./chunk-AXUW635Q.js";
547
+ import "./chunk-BPJSQIJX.js";
548
+ import "./chunk-P3QQPMQA.js";
549
+ import "./chunk-6QHAUJUE.js";
550
+ import "./chunk-LS77BEZP.js";
523
551
  import {
524
552
  ApiCancelEvent,
525
553
  AuthEvent,
526
554
  ConversationFinishedEvent,
527
555
  DiscoveredMCPTool,
528
- MAINLINE_CODER_MODEL,
529
556
  ModelSlashCommandEvent,
530
557
  PromptSuggestionEvent,
531
558
  SpeculationEvent,
@@ -561,9 +588,7 @@ import {
561
588
  runVisionBridge,
562
589
  shouldRunVisionBridge,
563
590
  splitImageParts
564
- } from "./chunk-ZFKNWQGQ.js";
565
- import "./chunk-4WKAA4KS.js";
566
- import "./chunk-CR3C7WXL.js";
591
+ } from "./chunk-IFG6TYJ2.js";
567
592
  import "./chunk-VGC4I5JJ.js";
568
593
  import {
569
594
  AUTO_MEMORY_INDEX_FILENAME,
@@ -571,35 +596,30 @@ import {
571
596
  getAutoMemoryRoot,
572
597
  getUserAutoMemoryRoot,
573
598
  isAnyAutoMemPath
574
- } from "./chunk-JD3MKVKL.js";
575
- import "./chunk-UEY4AYUL.js";
599
+ } from "./chunk-4K56OJFJ.js";
600
+ import {
601
+ MAINLINE_CODER_MODEL
602
+ } from "./chunk-36HSVBBU.js";
603
+ import "./chunk-46UV252V.js";
604
+ import "./chunk-A4UCTEB5.js";
605
+ import "./chunk-XWRJCPHC.js";
606
+ import {
607
+ DEFAULT_TOKEN_LIMIT
608
+ } from "./chunk-UW5EOVUN.js";
609
+ import "./chunk-NBQDBANR.js";
610
+ import "./chunk-QNLNLENL.js";
576
611
  import {
577
612
  atomicWriteFileSync
578
- } from "./chunk-BDBMYST4.js";
579
- import "./chunk-EZVDJFZ7.js";
613
+ } from "./chunk-6X4GWOPW.js";
614
+ import "./chunk-PKL3HGNZ.js";
615
+ import "./chunk-HTR4WV6U.js";
616
+ import "./chunk-BULDBTYC.js";
617
+ import "./chunk-U7ZFW55U.js";
618
+ import "./chunk-ERLGR7GI.js";
580
619
  import {
581
620
  ToolNames,
582
621
  isShellProgressData
583
- } from "./chunk-OP4MOGXF.js";
584
- import {
585
- REASONING_EFFORT_TIERS
586
- } from "./chunk-XVNQMZ2I.js";
587
- import {
588
- getUnsupportedImageFormatWarning,
589
- isSupportedImageMimeType
590
- } from "./chunk-FEOZBUMT.js";
591
- import "./chunk-DJ2GSRLV.js";
592
- import "./chunk-6EFTQYW7.js";
593
- import {
594
- DEFAULT_TOKEN_LIMIT
595
- } from "./chunk-MAQQGNQ5.js";
596
- import "./chunk-A4UCTEB5.js";
597
- import "./chunk-XWRJCPHC.js";
598
- import {
599
- FinishReason
600
- } from "./chunk-TYQMGACW.js";
601
- import "./chunk-TYAMGABM.js";
602
- import "./chunk-FCMNKVXT.js";
622
+ } from "./chunk-P5RRUHL7.js";
603
623
  import {
604
624
  Storage,
605
625
  UnauthorizedError,
@@ -611,21 +631,27 @@ import {
611
631
  isNodeError,
612
632
  shortenPath,
613
633
  tildeifyPath
614
- } from "./chunk-C27BYUX6.js";
615
- import "./chunk-VZQUV7VK.js";
634
+ } from "./chunk-OQB4EXO4.js";
635
+ import "./chunk-CKTMY3EP.js";
636
+ import {
637
+ registerCleanup,
638
+ runExitCleanup
639
+ } from "./chunk-EL2IQ2S5.js";
616
640
  import {
617
641
  finalizeStartupProfile,
618
642
  profileCheckpoint
619
643
  } from "./chunk-QSWDGAIC.js";
620
644
  import "./chunk-Q7YDKOGY.js";
621
- import {
622
- registerCleanup,
623
- runExitCleanup
624
- } from "./chunk-DP5GXXNZ.js";
625
645
  import "./chunk-75DOP5OR.js";
626
646
  import "./chunk-DMTGGOSA.js";
627
647
  import "./chunk-YQ3U5MUC.js";
628
- import "./chunk-TB6UDU4T.js";
648
+ import {
649
+ FinishReason
650
+ } from "./chunk-22C7BQ6D.js";
651
+ import "./chunk-TYAMGABM.js";
652
+ import "./chunk-FCMNKVXT.js";
653
+ import "./chunk-AMDSOFFV.js";
654
+ import "./chunk-THJNPLI4.js";
629
655
  import {
630
656
  init_esbuild_shims
631
657
  } from "./chunk-5O2XNYP6.js";
@@ -637,7 +663,7 @@ import {
637
663
  // packages/cli/src/ui/startInteractiveUI.tsx
638
664
  init_esbuild_shims();
639
665
  import { basename as basename4 } from "node:path";
640
- var import_react166 = __toESM(require_react(), 1);
666
+ var import_react167 = __toESM(require_react(), 1);
641
667
 
642
668
  // packages/cli/src/dualOutput/DualOutputBridge.ts
643
669
  init_esbuild_shims();
@@ -830,7 +856,7 @@ var DualOutputBridge = class {
830
856
  * Emits a `can_use_tool` permission request so an external consumer can
831
857
  * approve or deny the tool call. Pairs with {@link emitControlResponse}.
832
858
  */
833
- emitPermissionRequest(requestId, toolName, toolUseId, input, blockedPath = null) {
859
+ emitPermissionRequest(requestId, toolName, toolUseId, input, blockedPath = null, permissionSuggestions = null) {
834
860
  if (!this.active) return;
835
861
  this.disableIfBufferOverflowed();
836
862
  if (!this.active) return;
@@ -840,7 +866,8 @@ var DualOutputBridge = class {
840
866
  toolName,
841
867
  toolUseId,
842
868
  input,
843
- blockedPath
869
+ blockedPath,
870
+ permissionSuggestions
844
871
  );
845
872
  } catch (err) {
846
873
  debugLogger.error("DualOutput emitPermissionRequest error:", err);
@@ -1252,7 +1279,7 @@ var useRemoteInput = /* @__PURE__ */ __name(() => (0, import_react2.useContext)(
1252
1279
 
1253
1280
  // packages/cli/src/ui/AppContainer.tsx
1254
1281
  init_esbuild_shims();
1255
- var import_react164 = __toESM(require_react(), 1);
1282
+ var import_react165 = __toESM(require_react(), 1);
1256
1283
 
1257
1284
  // packages/cli/src/ui/App.tsx
1258
1285
  init_esbuild_shims();
@@ -1382,30 +1409,15 @@ var useAppContext = /* @__PURE__ */ __name(() => {
1382
1409
  return context;
1383
1410
  }, "useAppContext");
1384
1411
 
1385
- // packages/cli/src/ui/components/UpdateNotification.tsx
1386
- init_esbuild_shims();
1387
- var import_jsx_runtime3 = __toESM(require_jsx_runtime(), 1);
1388
- var UpdateNotification = /* @__PURE__ */ __name(({ message }) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1389
- Box_default,
1390
- {
1391
- borderStyle: "round",
1392
- borderColor: theme.status.warning,
1393
- paddingX: 1,
1394
- marginY: 1,
1395
- children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text, { color: theme.status.warning, children: message })
1396
- }
1397
- ), "UpdateNotification");
1398
-
1399
1412
  // packages/cli/src/ui/components/Notifications.tsx
1400
- var import_jsx_runtime4 = __toESM(require_jsx_runtime(), 1);
1413
+ var import_jsx_runtime3 = __toESM(require_jsx_runtime(), 1);
1401
1414
  var Notifications = /* @__PURE__ */ __name(() => {
1402
1415
  const { startupWarnings } = useAppContext();
1403
- const { initError, streamingState, updateInfo } = useUIState();
1416
+ const { initError, streamingState } = useUIState();
1404
1417
  const showStartupWarnings = startupWarnings.length > 0;
1405
1418
  const showInitError = initError && streamingState !== "responding" /* Responding */;
1406
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
1407
- updateInfo && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(UpdateNotification, { message: updateInfo.message }),
1408
- showStartupWarnings && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1419
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
1420
+ showStartupWarnings && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1409
1421
  Box_default,
1410
1422
  {
1411
1423
  borderStyle: "round",
@@ -1413,10 +1425,10 @@ var Notifications = /* @__PURE__ */ __name(() => {
1413
1425
  paddingX: 1,
1414
1426
  marginY: 1,
1415
1427
  flexDirection: "column",
1416
- children: startupWarnings.map((warning, index) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text, { color: theme.status.warning, children: warning }, index))
1428
+ children: startupWarnings.map((warning, index) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text, { color: theme.status.warning, children: warning }, index))
1417
1429
  }
1418
1430
  ),
1419
- showInitError && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
1431
+ showInitError && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
1420
1432
  Box_default,
1421
1433
  {
1422
1434
  borderStyle: "round",
@@ -1424,11 +1436,11 @@ var Notifications = /* @__PURE__ */ __name(() => {
1424
1436
  paddingX: 1,
1425
1437
  marginBottom: 1,
1426
1438
  children: [
1427
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Text, { color: theme.status.error, children: [
1439
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text, { color: theme.status.error, children: [
1428
1440
  "Initialization Error: ",
1429
1441
  initError
1430
1442
  ] }),
1431
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Text, { color: theme.status.error, children: [
1443
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text, { color: theme.status.error, children: [
1432
1444
  " ",
1433
1445
  "Please check API key and configuration."
1434
1446
  ] })
@@ -1438,6 +1450,20 @@ var Notifications = /* @__PURE__ */ __name(() => {
1438
1450
  ] });
1439
1451
  }, "Notifications");
1440
1452
 
1453
+ // packages/cli/src/ui/components/UpdateNotification.tsx
1454
+ init_esbuild_shims();
1455
+ var import_jsx_runtime4 = __toESM(require_jsx_runtime(), 1);
1456
+ var UpdateNotification = /* @__PURE__ */ __name(({ message }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1457
+ Box_default,
1458
+ {
1459
+ borderStyle: "round",
1460
+ borderColor: theme.status.warning,
1461
+ paddingX: 1,
1462
+ marginY: 1,
1463
+ children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text, { color: theme.status.warning, children: message })
1464
+ }
1465
+ ), "UpdateNotification");
1466
+
1441
1467
  // packages/cli/src/ui/components/MainContent.tsx
1442
1468
  init_esbuild_shims();
1443
1469
  var import_react14 = __toESM(require_react(), 1);
@@ -2268,10 +2294,15 @@ function isSyntheticHistoryItem(item) {
2268
2294
  case "stop_hook_loop":
2269
2295
  case "stop_hook_system_message":
2270
2296
  return true;
2297
+ // Steer messages (mid-turn user injections) are typed 'user' but
2298
+ // carry sentToModel === false; treat them as synthetic so the
2299
+ // cancel handler can still do a full rewind when only a steer
2300
+ // follows the real prompt.
2301
+ case "user":
2302
+ return item.sentToModel === false;
2271
2303
  // Meaningful: user input, model text, tool runs, slash-command
2272
2304
  // results the user explicitly asked for. Auto-restore must bail
2273
2305
  // when any of these appear after the candidate user prompt.
2274
- case "user":
2275
2306
  case "user_shell":
2276
2307
  case "gemini":
2277
2308
  case "gemini_content":
@@ -2315,11 +2346,18 @@ function itemsAfterAreOnlySynthetic(history, fromIndex) {
2315
2346
  __name(itemsAfterAreOnlySynthetic, "itemsAfterAreOnlySynthetic");
2316
2347
  function findLastUserItemIndex(history) {
2317
2348
  for (let i = history.length - 1; i >= 0; i--) {
2318
- if (history[i].type === "user") return i;
2349
+ const item = history[i];
2350
+ if (item.type === "user" && item.sentToModel !== false) return i;
2319
2351
  }
2320
2352
  return -1;
2321
2353
  }
2322
2354
  __name(findLastUserItemIndex, "findLastUserItemIndex");
2355
+ function realUserPromptTexts(history) {
2356
+ return history.filter(
2357
+ (item) => item.type === "user" && item.sentToModel !== false && typeof item.text === "string" && item.text.trim() !== ""
2358
+ ).map((item) => item.text);
2359
+ }
2360
+ __name(realUserPromptTexts, "realUserPromptTexts");
2323
2361
  function buildThoughtHeadIdMap(items) {
2324
2362
  const map = /* @__PURE__ */ new Map();
2325
2363
  for (let i = 0; i < items.length; i++) {
@@ -2975,9 +3013,9 @@ function VirtualizedList(props, ref) {
2975
3013
  return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Box_default, { width: 1, flexDirection: "column", flexShrink: 0, children: Array.from({ length: trackLen }, (_, i) => {
2976
3014
  const inThumb = i >= thumbTop && i < thumbTop + thumbLen;
2977
3015
  if (!scrollbarThumbActive) {
2978
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { children: " " }, i);
3016
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { selectable: false, children: " " }, i);
2979
3017
  }
2980
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { dimColor: !inThumb, children: inThumb ? "\u2588" : "\u2502" }, i);
3018
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { dimColor: !inThumb, selectable: false, children: inThumb ? "\u2588" : "\u2502" }, i);
2981
3019
  }) });
2982
3020
  }, [
2983
3021
  showScrollbar,
@@ -3275,24 +3313,79 @@ function getSelectedText(frame, selection) {
3275
3313
  return "";
3276
3314
  }
3277
3315
  const { sx, sy, ex, ey } = selection;
3278
- const lines = [];
3316
+ let text = "";
3279
3317
  for (let y = sy; y <= ey; y++) {
3280
3318
  const row = frame.cells[y];
3281
3319
  if (!row) {
3282
- lines.push("");
3320
+ if (y < ey) {
3321
+ text += "\n";
3322
+ }
3283
3323
  continue;
3284
3324
  }
3285
3325
  const startX = y === sy ? sx : 0;
3286
3326
  const endX = y === ey ? ex : row.length - 1;
3287
- let text = "";
3288
3327
  for (let x = Math.max(0, startX); x <= endX && x < row.length; x++) {
3289
- text += row[x].value;
3328
+ if (row[x].selectable) {
3329
+ text += row[x].value;
3330
+ }
3331
+ }
3332
+ if (y < ey) {
3333
+ text += boundaryJoiner(frame, selection, y);
3290
3334
  }
3291
- lines.push(text.replace(/\s+$/u, ""));
3292
3335
  }
3293
- return lines.join("\n");
3336
+ return text;
3294
3337
  }
3295
3338
  __name(getSelectedText, "getSelectedText");
3339
+ function selectedFlows(frame, selection, y) {
3340
+ const row = frame.cells[y] ?? [];
3341
+ const startX = y === selection.sy ? selection.sx : 0;
3342
+ const endX = y === selection.ey ? selection.ex : row.length - 1;
3343
+ const flows = /* @__PURE__ */ new Set();
3344
+ for (let x = Math.max(0, startX); x <= endX && x < row.length; x++) {
3345
+ const cell = row[x];
3346
+ if (cell.selectable && cell.flowId !== null) {
3347
+ flows.add(cell.flowId);
3348
+ }
3349
+ }
3350
+ if (flows.size > 0) {
3351
+ return flows;
3352
+ }
3353
+ for (const boundaryY of [y - 1, y]) {
3354
+ const boundaryRow = frame.boundaries[boundaryY] ?? [];
3355
+ for (let x = Math.max(0, startX); x <= endX && x < boundaryRow.length; x++) {
3356
+ const claim = boundaryRow[x];
3357
+ if (claim?.selectable) {
3358
+ flows.add(claim.flowId);
3359
+ }
3360
+ }
3361
+ }
3362
+ return flows;
3363
+ }
3364
+ __name(selectedFlows, "selectedFlows");
3365
+ function boundaryJoiner(frame, selection, y) {
3366
+ const currentFlows = selectedFlows(frame, selection, y);
3367
+ const nextFlows = selectedFlows(frame, selection, y + 1);
3368
+ const [currentFlow] = currentFlows;
3369
+ const [nextFlow] = nextFlows;
3370
+ if (currentFlows.size !== 1 || nextFlows.size !== 1 || currentFlow !== nextFlow) {
3371
+ return "\n";
3372
+ }
3373
+ const flowId = currentFlow;
3374
+ const claims = (frame.boundaries[y] ?? []).filter(
3375
+ (claim) => claim !== null && claim.selectable && claim.flowId === flowId
3376
+ );
3377
+ if (claims.length === 0) {
3378
+ return "\n";
3379
+ }
3380
+ const first = claims[0];
3381
+ if (claims.some(
3382
+ (claim) => claim.kind !== first.kind || claim.joiner !== first.joiner
3383
+ )) {
3384
+ return "\n";
3385
+ }
3386
+ return first.kind === "soft" ? first.joiner : "\n";
3387
+ }
3388
+ __name(boundaryJoiner, "boundaryJoiner");
3296
3389
 
3297
3390
  // packages/cli/src/ui/selection/selection-span.ts
3298
3391
  init_esbuild_shims();
@@ -3633,7 +3726,7 @@ var MainContent = /* @__PURE__ */ __name(() => {
3633
3726
  addSourceBlockCounts(runningOffsets, item.text);
3634
3727
  return { item, sourceCopyIndexOffsets: offsets };
3635
3728
  }
3636
- if (item.type === "user") {
3729
+ if (item.type === "user" && item.sentToModel !== false) {
3637
3730
  runningOffsets = createEmptySourceCopyOffsets();
3638
3731
  }
3639
3732
  return { item, sourceCopyIndexOffsets: void 0 };
@@ -3657,7 +3750,7 @@ var MainContent = /* @__PURE__ */ __name(() => {
3657
3750
  addSourceBlockCounts(runningOffsets, item.text);
3658
3751
  return { item, sourceCopyIndexOffsets: offsets };
3659
3752
  }
3660
- if (item.type === "user") {
3753
+ if (item.type === "user" && item.sentToModel !== false) {
3661
3754
  runningOffsets = createEmptySourceCopyOffsets();
3662
3755
  }
3663
3756
  return { item, sourceCopyIndexOffsets: void 0 };
@@ -30876,7 +30969,13 @@ var Footer = /* @__PURE__ */ __name(() => {
30876
30969
  t("IDE connecting... context may be unavailable")
30877
30970
  ] }) : uiState.startupIdeConnectionStatus.state === "failed" ? /* @__PURE__ */ (0, import_jsx_runtime116.jsx)(Text, { color: theme.status.warning, children: t("IDE connection unavailable: {{message}}", {
30878
30971
  message: uiState.startupIdeConnectionStatus.message
30879
- }) }) : uiState.streamingState === "responding" /* Responding */ ? /* @__PURE__ */ (0, import_jsx_runtime116.jsx)(Text, { color: theme.text.secondary, children: t("Enter to steer \xB7 Ctrl+Q to queue") }) : showAutoAcceptIndicator !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime116.jsx)(AutoAcceptIndicator, { approvalMode: showAutoAcceptIndicator }) : suppressHint ? null : /* @__PURE__ */ (0, import_jsx_runtime116.jsx)(Text, { color: theme.text.secondary, children: t("? for shortcuts") });
30972
+ }) }) : uiState.streamingState === "responding" /* Responding */ ? /* @__PURE__ */ (0, import_jsx_runtime116.jsxs)(Text, { color: theme.text.secondary, children: [
30973
+ t("Enter to steer \xB7 Ctrl+Q to queue"),
30974
+ showAutoAcceptIndicator !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime116.jsxs)(import_jsx_runtime116.Fragment, { children: [
30975
+ " \xB7 ",
30976
+ /* @__PURE__ */ (0, import_jsx_runtime116.jsx)(AutoAcceptIndicator, { approvalMode: showAutoAcceptIndicator })
30977
+ ] })
30978
+ ] }) : showAutoAcceptIndicator !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime116.jsx)(AutoAcceptIndicator, { approvalMode: showAutoAcceptIndicator }) : suppressHint ? null : /* @__PURE__ */ (0, import_jsx_runtime116.jsx)(Text, { color: theme.text.secondary, children: t("? for shortcuts") });
30880
30979
  const rightItems = [];
30881
30980
  if (sandboxInfo) {
30882
30981
  rightItems.push({
@@ -31456,6 +31555,7 @@ var ScreenReaderAppLayout = /* @__PURE__ */ __name(() => {
31456
31555
  const dialogHeight = uiState.constrainHeight ? dialogMaxHeight : void 0;
31457
31556
  const shouldShowStickyTodos = uiState.stickyTodos !== null && !uiState.dialogsVisible && !uiState.isFeedbackDialogOpen && uiState.streamingState === "responding" /* Responding */;
31458
31557
  return /* @__PURE__ */ (0, import_jsx_runtime122.jsxs)(Box_default, { flexDirection: "column", width: "90%", height: "100%", children: [
31558
+ !uiState.dialogsVisible && uiState.updateInfo && /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(UpdateNotification, { message: uiState.updateInfo.message }),
31459
31559
  /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(Notifications, {}),
31460
31560
  /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(Footer, {}),
31461
31561
  /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(Box_default, { flexGrow: 1, overflow: "hidden", children: /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(MainContent, {}) }),
@@ -32537,12 +32637,14 @@ var DefaultAppLayout = /* @__PURE__ */ __name(() => {
32537
32637
  isAgentTab ? /* @__PURE__ */ (0, import_jsx_runtime130.jsxs)(import_jsx_runtime130.Fragment, { children: [
32538
32638
  /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(AgentChatView, { agentId: activeView }),
32539
32639
  /* @__PURE__ */ (0, import_jsx_runtime130.jsxs)(Box_default, { flexDirection: "column", ref: uiState.mainControlsRef, children: [
32640
+ !uiState.dialogsVisible && uiState.updateInfo && /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(UpdateNotification, { message: uiState.updateInfo.message }),
32540
32641
  /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(AgentComposer, { agentId: activeView }, activeView),
32541
32642
  /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(ExitWarning, {})
32542
32643
  ] })
32543
32644
  ] }) : /* @__PURE__ */ (0, import_jsx_runtime130.jsxs)(import_jsx_runtime130.Fragment, { children: [
32544
32645
  /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(MainContent, {}),
32545
32646
  /* @__PURE__ */ (0, import_jsx_runtime130.jsxs)(Box_default, { flexDirection: "column", ref: uiState.mainControlsRef, children: [
32647
+ !uiState.dialogsVisible && uiState.updateInfo && /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(UpdateNotification, { message: uiState.updateInfo.message }),
32546
32648
  uiState.dialogsVisible ? /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(
32547
32649
  Box_default,
32548
32650
  {
@@ -32747,14 +32849,46 @@ function useResizeSettleRepaint(terminalWidth, refreshStatic) {
32747
32849
  }
32748
32850
  __name(useResizeSettleRepaint, "useResizeSettleRepaint");
32749
32851
 
32750
- // packages/cli/src/ui/hooks/useThemeCommand.ts
32852
+ // packages/cli/src/ui/hooks/use-wake-repaint.ts
32751
32853
  init_esbuild_shims();
32752
32854
  var import_react118 = __toESM(require_react(), 1);
32855
+ var HEARTBEAT_INTERVAL_MS = 5e3;
32856
+ var WAKE_THRESHOLD_MS = HEARTBEAT_INTERVAL_MS * 2;
32857
+ function useWakeRepaint(repaint) {
32858
+ const repaintRef = (0, import_react118.useRef)(repaint);
32859
+ repaintRef.current = repaint;
32860
+ (0, import_react118.useEffect)(() => {
32861
+ let lastTick = Date.now();
32862
+ const timer = setInterval(() => {
32863
+ const now = Date.now();
32864
+ const elapsed = now - lastTick;
32865
+ lastTick = now;
32866
+ if (elapsed > WAKE_THRESHOLD_MS) {
32867
+ repaintRef.current();
32868
+ }
32869
+ }, HEARTBEAT_INTERVAL_MS);
32870
+ timer.unref?.();
32871
+ const onSigcont = /* @__PURE__ */ __name(() => {
32872
+ lastTick = Date.now();
32873
+ repaintRef.current();
32874
+ }, "onSigcont");
32875
+ process.on("SIGCONT", onSigcont);
32876
+ return () => {
32877
+ clearInterval(timer);
32878
+ process.removeListener("SIGCONT", onSigcont);
32879
+ };
32880
+ }, []);
32881
+ }
32882
+ __name(useWakeRepaint, "useWakeRepaint");
32883
+
32884
+ // packages/cli/src/ui/hooks/useThemeCommand.ts
32885
+ init_esbuild_shims();
32886
+ var import_react119 = __toESM(require_react(), 1);
32753
32887
  import process13 from "node:process";
32754
32888
  var useThemeCommand = /* @__PURE__ */ __name((loadedSettings, setThemeError, addItem, initialThemeError) => {
32755
- const [isThemeDialogOpen, setIsThemeDialogOpen] = (0, import_react118.useState)(!!initialThemeError);
32756
- const [themeBeforeDialogOpen, setThemeBeforeDialogOpen] = (0, import_react118.useState)(themeManager.getActiveTheme().name);
32757
- const openThemeDialog = (0, import_react118.useCallback)(() => {
32889
+ const [isThemeDialogOpen, setIsThemeDialogOpen] = (0, import_react119.useState)(!!initialThemeError);
32890
+ const [themeBeforeDialogOpen, setThemeBeforeDialogOpen] = (0, import_react119.useState)(themeManager.getActiveTheme().name);
32891
+ const openThemeDialog = (0, import_react119.useCallback)(() => {
32758
32892
  if (process13.env["NO_COLOR"]) {
32759
32893
  addItem(
32760
32894
  {
@@ -32770,7 +32904,7 @@ var useThemeCommand = /* @__PURE__ */ __name((loadedSettings, setThemeError, add
32770
32904
  setThemeBeforeDialogOpen(themeManager.getActiveTheme().name);
32771
32905
  setIsThemeDialogOpen(true);
32772
32906
  }, [addItem]);
32773
- const applyTheme = (0, import_react118.useCallback)(
32907
+ const applyTheme = (0, import_react119.useCallback)(
32774
32908
  (themeName) => {
32775
32909
  if (!themeManager.setActiveTheme(themeName)) {
32776
32910
  setIsThemeDialogOpen(true);
@@ -32785,13 +32919,13 @@ var useThemeCommand = /* @__PURE__ */ __name((loadedSettings, setThemeError, add
32785
32919
  },
32786
32920
  [setThemeError]
32787
32921
  );
32788
- const handleThemeHighlight = (0, import_react118.useCallback)(
32922
+ const handleThemeHighlight = (0, import_react119.useCallback)(
32789
32923
  (themeName) => {
32790
32924
  applyTheme(themeName);
32791
32925
  },
32792
32926
  [applyTheme]
32793
32927
  );
32794
- const handleThemeSelect = (0, import_react118.useCallback)(
32928
+ const handleThemeSelect = (0, import_react119.useCallback)(
32795
32929
  (themeName, scope) => {
32796
32930
  if (themeName === void 0) {
32797
32931
  applyTheme(themeBeforeDialogOpen);
@@ -32838,7 +32972,7 @@ var useThemeCommand = /* @__PURE__ */ __name((loadedSettings, setThemeError, add
32838
32972
 
32839
32973
  // packages/cli/src/ui/hooks/useFeedbackDialog.ts
32840
32974
  init_esbuild_shims();
32841
- var import_react119 = __toESM(require_react(), 1);
32975
+ var import_react120 = __toESM(require_react(), 1);
32842
32976
  import * as fs15 from "node:fs";
32843
32977
  var import_strip_json_comments = __toESM(require_strip_json_comments(), 1);
32844
32978
  var FEEDBACK_SHOW_PROBABILITY = 0.25;
@@ -32884,20 +33018,20 @@ var useFeedbackDialog = /* @__PURE__ */ __name(({
32884
33018
  history,
32885
33019
  sessionStats
32886
33020
  }) => {
32887
- const [isFeedbackDialogOpen, setIsFeedbackDialogOpen] = (0, import_react119.useState)(false);
32888
- const [isFeedbackDismissedTemporarily, setIsFeedbackDismissedTemporarily] = (0, import_react119.useState)(false);
32889
- const openFeedbackDialog = (0, import_react119.useCallback)(() => {
33021
+ const [isFeedbackDialogOpen, setIsFeedbackDialogOpen] = (0, import_react120.useState)(false);
33022
+ const [isFeedbackDismissedTemporarily, setIsFeedbackDismissedTemporarily] = (0, import_react120.useState)(false);
33023
+ const openFeedbackDialog = (0, import_react120.useCallback)(() => {
32890
33024
  setIsFeedbackDialogOpen(true);
32891
33025
  }, []);
32892
- const closeFeedbackDialog = (0, import_react119.useCallback)(
33026
+ const closeFeedbackDialog = (0, import_react120.useCallback)(
32893
33027
  () => setIsFeedbackDialogOpen(false),
32894
33028
  []
32895
33029
  );
32896
- const temporaryCloseFeedbackDialog = (0, import_react119.useCallback)(() => {
33030
+ const temporaryCloseFeedbackDialog = (0, import_react120.useCallback)(() => {
32897
33031
  setIsFeedbackDialogOpen(false);
32898
33032
  setIsFeedbackDismissedTemporarily(true);
32899
33033
  }, []);
32900
- const submitFeedback = (0, import_react119.useCallback)(
33034
+ const submitFeedback = (0, import_react120.useCallback)(
32901
33035
  (rating) => {
32902
33036
  if (rating >= FEEDBACK_OPTIONS.GOOD && rating <= FEEDBACK_OPTIONS.FINE) {
32903
33037
  const feedbackEvent = new UserFeedbackEvent(
@@ -32917,7 +33051,7 @@ var useFeedbackDialog = /* @__PURE__ */ __name(({
32917
33051
  },
32918
33052
  [closeFeedbackDialog, sessionStats.sessionId, config, settings]
32919
33053
  );
32920
- (0, import_react119.useEffect)(() => {
33054
+ (0, import_react120.useEffect)(() => {
32921
33055
  const checkAndShowFeedback = /* @__PURE__ */ __name(() => {
32922
33056
  if (streamingState === "idle" /* Idle */ && history.length > 0) {
32923
33057
  if (!config.getUsageStatisticsEnabled() || settings.merged.ui?.enableUserFeedback === false || !lastMessageIsAIResponse(history) || Math.random() > FEEDBACK_SHOW_PROBABILITY || !meetsMinimumSessionRequirements(sessionStats) || isFeedbackDismissedTemporarily) {
@@ -32939,7 +33073,7 @@ var useFeedbackDialog = /* @__PURE__ */ __name(({
32939
33073
  settings.merged.ui?.enableUserFeedback,
32940
33074
  config
32941
33075
  ]);
32942
- (0, import_react119.useEffect)(() => {
33076
+ (0, import_react120.useEffect)(() => {
32943
33077
  if (streamingState === "responding" /* Responding */ && isFeedbackDismissedTemporarily) {
32944
33078
  setIsFeedbackDismissedTemporarily(false);
32945
33079
  }
@@ -32955,13 +33089,13 @@ var useFeedbackDialog = /* @__PURE__ */ __name(({
32955
33089
 
32956
33090
  // packages/cli/src/ui/hooks/useEditorSettings.ts
32957
33091
  init_esbuild_shims();
32958
- var import_react120 = __toESM(require_react(), 1);
33092
+ var import_react121 = __toESM(require_react(), 1);
32959
33093
  var useEditorSettings = /* @__PURE__ */ __name((loadedSettings, setEditorError, addItem) => {
32960
- const [isEditorDialogOpen, setIsEditorDialogOpen] = (0, import_react120.useState)(false);
32961
- const openEditorDialog = (0, import_react120.useCallback)(() => {
33094
+ const [isEditorDialogOpen, setIsEditorDialogOpen] = (0, import_react121.useState)(false);
33095
+ const openEditorDialog = (0, import_react121.useCallback)(() => {
32962
33096
  setIsEditorDialogOpen(true);
32963
33097
  }, []);
32964
- const handleEditorSelect = (0, import_react120.useCallback)(
33098
+ const handleEditorSelect = (0, import_react121.useCallback)(
32965
33099
  (editorType, scope) => {
32966
33100
  if (editorType && (!checkHasEditorType(editorType) || !allowEditorTypeInSandbox(editorType))) {
32967
33101
  return;
@@ -32983,7 +33117,7 @@ var useEditorSettings = /* @__PURE__ */ __name((loadedSettings, setEditorError,
32983
33117
  },
32984
33118
  [loadedSettings, setEditorError, addItem]
32985
33119
  );
32986
- const exitEditorDialog = (0, import_react120.useCallback)(() => {
33120
+ const exitEditorDialog = (0, import_react121.useCallback)(() => {
32987
33121
  setIsEditorDialogOpen(false);
32988
33122
  }, []);
32989
33123
  return {
@@ -32996,13 +33130,13 @@ var useEditorSettings = /* @__PURE__ */ __name((loadedSettings, setEditorError,
32996
33130
 
32997
33131
  // packages/cli/src/ui/hooks/useSettingsCommand.ts
32998
33132
  init_esbuild_shims();
32999
- var import_react121 = __toESM(require_react(), 1);
33133
+ var import_react122 = __toESM(require_react(), 1);
33000
33134
  function useSettingsCommand() {
33001
- const [isSettingsDialogOpen, setIsSettingsDialogOpen] = (0, import_react121.useState)(false);
33002
- const openSettingsDialog = (0, import_react121.useCallback)(() => {
33135
+ const [isSettingsDialogOpen, setIsSettingsDialogOpen] = (0, import_react122.useState)(false);
33136
+ const openSettingsDialog = (0, import_react122.useCallback)(() => {
33003
33137
  setIsSettingsDialogOpen(true);
33004
33138
  }, []);
33005
- const closeSettingsDialog = (0, import_react121.useCallback)(() => {
33139
+ const closeSettingsDialog = (0, import_react122.useCallback)(() => {
33006
33140
  setIsSettingsDialogOpen(false);
33007
33141
  }, []);
33008
33142
  return {
@@ -33015,14 +33149,14 @@ __name(useSettingsCommand, "useSettingsCommand");
33015
33149
 
33016
33150
  // packages/cli/src/ui/hooks/useModelCommand.ts
33017
33151
  init_esbuild_shims();
33018
- var import_react122 = __toESM(require_react(), 1);
33152
+ var import_react123 = __toESM(require_react(), 1);
33019
33153
  var useModelCommand = /* @__PURE__ */ __name(() => {
33020
- const [isModelDialogOpen, setIsModelDialogOpen] = (0, import_react122.useState)(false);
33021
- const [isFastModelMode, setIsFastModelMode] = (0, import_react122.useState)(false);
33022
- const [isVoiceModelMode, setIsVoiceModelMode] = (0, import_react122.useState)(false);
33023
- const [isVisionModelMode, setIsVisionModelMode] = (0, import_react122.useState)(false);
33024
- const [modelDialogPersistScope, setModelDialogPersistScope] = (0, import_react122.useState)(void 0);
33025
- const openModelDialog = (0, import_react122.useCallback)(
33154
+ const [isModelDialogOpen, setIsModelDialogOpen] = (0, import_react123.useState)(false);
33155
+ const [isFastModelMode, setIsFastModelMode] = (0, import_react123.useState)(false);
33156
+ const [isVoiceModelMode, setIsVoiceModelMode] = (0, import_react123.useState)(false);
33157
+ const [isVisionModelMode, setIsVisionModelMode] = (0, import_react123.useState)(false);
33158
+ const [modelDialogPersistScope, setModelDialogPersistScope] = (0, import_react123.useState)(void 0);
33159
+ const openModelDialog = (0, import_react123.useCallback)(
33026
33160
  (options) => {
33027
33161
  const voiceModelMode = options?.voiceModelMode ?? false;
33028
33162
  const visionModelMode = options?.visionModelMode ?? false;
@@ -33036,7 +33170,7 @@ var useModelCommand = /* @__PURE__ */ __name(() => {
33036
33170
  },
33037
33171
  []
33038
33172
  );
33039
- const closeModelDialog = (0, import_react122.useCallback)(() => {
33173
+ const closeModelDialog = (0, import_react123.useCallback)(() => {
33040
33174
  setIsModelDialogOpen(false);
33041
33175
  setIsFastModelMode(false);
33042
33176
  setIsVoiceModelMode(false);
@@ -33056,13 +33190,13 @@ var useModelCommand = /* @__PURE__ */ __name(() => {
33056
33190
 
33057
33191
  // packages/cli/src/ui/hooks/useApprovalModeCommand.ts
33058
33192
  init_esbuild_shims();
33059
- var import_react123 = __toESM(require_react(), 1);
33193
+ var import_react124 = __toESM(require_react(), 1);
33060
33194
  var useApprovalModeCommand = /* @__PURE__ */ __name((loadedSettings, config) => {
33061
- const [isApprovalModeDialogOpen, setIsApprovalModeDialogOpen] = (0, import_react123.useState)(false);
33062
- const openApprovalModeDialog = (0, import_react123.useCallback)(() => {
33195
+ const [isApprovalModeDialogOpen, setIsApprovalModeDialogOpen] = (0, import_react124.useState)(false);
33196
+ const openApprovalModeDialog = (0, import_react124.useCallback)(() => {
33063
33197
  setIsApprovalModeDialogOpen(true);
33064
33198
  }, []);
33065
- const handleApprovalModeSelect = (0, import_react123.useCallback)(
33199
+ const handleApprovalModeSelect = (0, import_react124.useCallback)(
33066
33200
  (mode, scope) => {
33067
33201
  try {
33068
33202
  if (!mode) {
@@ -33088,13 +33222,13 @@ var useApprovalModeCommand = /* @__PURE__ */ __name((loadedSettings, config) =>
33088
33222
 
33089
33223
  // packages/cli/src/ui/hooks/use-effort-command.ts
33090
33224
  init_esbuild_shims();
33091
- var import_react124 = __toESM(require_react(), 1);
33225
+ var import_react125 = __toESM(require_react(), 1);
33092
33226
  var useEffortCommand = /* @__PURE__ */ __name((loadedSettings, config, addItem) => {
33093
- const [isEffortDialogOpen, setIsEffortDialogOpen] = (0, import_react124.useState)(false);
33094
- const openEffortDialog = (0, import_react124.useCallback)(() => {
33227
+ const [isEffortDialogOpen, setIsEffortDialogOpen] = (0, import_react125.useState)(false);
33228
+ const openEffortDialog = (0, import_react125.useCallback)(() => {
33095
33229
  setIsEffortDialogOpen(true);
33096
33230
  }, []);
33097
- const handleEffortSelect = (0, import_react124.useCallback)(
33231
+ const handleEffortSelect = (0, import_react125.useCallback)(
33098
33232
  (effort) => {
33099
33233
  try {
33100
33234
  if (!effort) {
@@ -33146,8 +33280,9 @@ var useEffortCommand = /* @__PURE__ */ __name((loadedSettings, config, addItem)
33146
33280
 
33147
33281
  // packages/cli/src/ui/hooks/useBranchCommand.ts
33148
33282
  init_esbuild_shims();
33149
- var import_react125 = __toESM(require_react(), 1);
33283
+ var import_react126 = __toESM(require_react(), 1);
33150
33284
  import { randomUUID } from "node:crypto";
33285
+ var BACKGROUND_WORK_BRANCH_BLOCKED_MESSAGE = "Stop the current session's running background tasks before branching the conversation.";
33151
33286
  function deriveFirstPrompt(messages) {
33152
33287
  for (const record of messages) {
33153
33288
  if (record.type !== "user") continue;
@@ -33166,9 +33301,19 @@ function deriveFirstPrompt(messages) {
33166
33301
  __name(deriveFirstPrompt, "deriveFirstPrompt");
33167
33302
  function useBranchCommand(options) {
33168
33303
  const { config, historyManager, startNewSession, setSessionName, remount } = options;
33169
- const handleBranch = (0, import_react125.useCallback)(
33304
+ const handleBranch = (0, import_react126.useCallback)(
33170
33305
  async (name) => {
33171
33306
  if (!config) return;
33307
+ if (hasBlockingBackgroundWork(config)) {
33308
+ historyManager.addItem(
33309
+ {
33310
+ type: "error",
33311
+ text: t(BACKGROUND_WORK_BRANCH_BLOCKED_MESSAGE)
33312
+ },
33313
+ Date.now()
33314
+ );
33315
+ return;
33316
+ }
33172
33317
  const oldSessionId = config.getSessionId();
33173
33318
  const newSessionId = randomUUID();
33174
33319
  const sessionService = config.getSessionService();
@@ -33222,6 +33367,7 @@ function useBranchCommand(options) {
33222
33367
  historyManager.clearItems();
33223
33368
  historyManager.loadHistory(uiHistoryItems);
33224
33369
  uiSwapped = true;
33370
+ resetBackgroundStateForSessionSwitch(config);
33225
33371
  try {
33226
33372
  restoreGoalFromHistory(
33227
33373
  uiHistoryItems,
@@ -33297,19 +33443,19 @@ __name(useBranchCommand, "useBranchCommand");
33297
33443
 
33298
33444
  // packages/cli/src/ui/hooks/useResumeCommand.ts
33299
33445
  init_esbuild_shims();
33300
- var import_react126 = __toESM(require_react(), 1);
33446
+ var import_react127 = __toESM(require_react(), 1);
33301
33447
  var BACKGROUND_WORK_SWITCH_BLOCKED_MESSAGE = "Stop the current session's running background tasks before resuming another session.";
33302
33448
  function useResumeCommand(options) {
33303
- const [isResumeDialogOpen, setIsResumeDialogOpen] = (0, import_react126.useState)(false);
33304
- const [resumeMatchedSessions, setResumeMatchedSessions] = (0, import_react126.useState)();
33305
- const openResumeDialog = (0, import_react126.useCallback)(
33449
+ const [isResumeDialogOpen, setIsResumeDialogOpen] = (0, import_react127.useState)(false);
33450
+ const [resumeMatchedSessions, setResumeMatchedSessions] = (0, import_react127.useState)();
33451
+ const openResumeDialog = (0, import_react127.useCallback)(
33306
33452
  (matchedSessions) => {
33307
33453
  setResumeMatchedSessions(matchedSessions);
33308
33454
  setIsResumeDialogOpen(true);
33309
33455
  },
33310
33456
  []
33311
33457
  );
33312
- const closeResumeDialog = (0, import_react126.useCallback)(() => {
33458
+ const closeResumeDialog = (0, import_react127.useCallback)(() => {
33313
33459
  setIsResumeDialogOpen(false);
33314
33460
  setResumeMatchedSessions(void 0);
33315
33461
  }, []);
@@ -33322,7 +33468,7 @@ function useResumeCommand(options) {
33322
33468
  remount
33323
33469
  } = options;
33324
33470
  const { addItem, clearItems, loadHistory } = historyManager;
33325
- const handleResume = (0, import_react126.useCallback)(
33471
+ const handleResume = (0, import_react127.useCallback)(
33326
33472
  async (sessionId) => {
33327
33473
  if (!config) {
33328
33474
  return;
@@ -33340,6 +33486,7 @@ function useResumeCommand(options) {
33340
33486
  const oldSessionId = config.getSessionId();
33341
33487
  let coreSwapped = false;
33342
33488
  let uiSwapped = false;
33489
+ let recoveredBackgroundAgentsNotice = null;
33343
33490
  try {
33344
33491
  const cwd3 = config.getTargetDir();
33345
33492
  const sessionService = new SessionService(cwd3);
@@ -33380,22 +33527,30 @@ function useResumeCommand(options) {
33380
33527
  await config.getGeminiClient()?.initialize?.();
33381
33528
  const recovered = await config.loadPausedBackgroundAgents(sessionId);
33382
33529
  if (recovered.length > 0) {
33383
- const recoveredMessage = {
33384
- type: "info" /* INFO */,
33385
- text: config.getBackgroundAgentResumeService().buildRecoveredBackgroundAgentsNotice(recovered.length)
33386
- };
33387
- addItem(recoveredMessage, Date.now());
33530
+ recoveredBackgroundAgentsNotice = config.getBackgroundAgentResumeService().buildRecoveredBackgroundAgentsNotice(recovered.length);
33388
33531
  }
33389
33532
  startNewSession(sessionId);
33390
33533
  setSessionName?.(customTitle ?? null);
33391
33534
  clearItems();
33392
33535
  loadHistory(uiHistoryItems);
33536
+ if (recoveredBackgroundAgentsNotice) {
33537
+ addItem(
33538
+ {
33539
+ type: "info" /* INFO */,
33540
+ text: recoveredBackgroundAgentsNotice
33541
+ },
33542
+ Date.now()
33543
+ );
33544
+ }
33393
33545
  uiSwapped = true;
33394
33546
  remount?.();
33395
33547
  } catch (error) {
33396
33548
  if (coreSwapped && !uiSwapped) {
33397
33549
  try {
33550
+ resetBackgroundStateForSessionSwitch(config);
33398
33551
  config.startNewSession(oldSessionId, void 0);
33552
+ await config.loadPausedBackgroundAgents(oldSessionId).catch(() => {
33553
+ });
33399
33554
  } catch (rollbackErr) {
33400
33555
  config.getDebugLogger().warn(
33401
33556
  `Rollback after failed /resume init failed: ${rollbackErr}`
@@ -33438,18 +33593,18 @@ __name(useResumeCommand, "useResumeCommand");
33438
33593
 
33439
33594
  // packages/cli/src/ui/hooks/useDeleteCommand.ts
33440
33595
  init_esbuild_shims();
33441
- var import_react127 = __toESM(require_react(), 1);
33596
+ var import_react128 = __toESM(require_react(), 1);
33442
33597
  function useDeleteCommand(options) {
33443
- const [isDeleteDialogOpen, setIsDeleteDialogOpen] = (0, import_react127.useState)(false);
33444
- const openDeleteDialog = (0, import_react127.useCallback)(() => {
33598
+ const [isDeleteDialogOpen, setIsDeleteDialogOpen] = (0, import_react128.useState)(false);
33599
+ const openDeleteDialog = (0, import_react128.useCallback)(() => {
33445
33600
  setIsDeleteDialogOpen(true);
33446
33601
  }, []);
33447
- const closeDeleteDialog = (0, import_react127.useCallback)(() => {
33602
+ const closeDeleteDialog = (0, import_react128.useCallback)(() => {
33448
33603
  setIsDeleteDialogOpen(false);
33449
33604
  }, []);
33450
33605
  const { config, addItem } = options ?? {};
33451
- const isDeletingManyRef = (0, import_react127.useRef)(false);
33452
- const handleDelete = (0, import_react127.useCallback)(
33606
+ const isDeletingManyRef = (0, import_react128.useRef)(false);
33607
+ const handleDelete = (0, import_react128.useCallback)(
33453
33608
  async (sessionId) => {
33454
33609
  if (!config) {
33455
33610
  return;
@@ -33508,7 +33663,7 @@ function useDeleteCommand(options) {
33508
33663
  },
33509
33664
  [closeDeleteDialog, config, addItem]
33510
33665
  );
33511
- const handleDeleteMany = (0, import_react127.useCallback)(
33666
+ const handleDeleteMany = (0, import_react128.useCallback)(
33512
33667
  async (sessionIds) => {
33513
33668
  if (!config) {
33514
33669
  return;
@@ -33640,7 +33795,7 @@ __name(useDeleteCommand, "useDeleteCommand");
33640
33795
 
33641
33796
  // packages/cli/src/ui/hooks/slashCommandProcessor.ts
33642
33797
  init_esbuild_shims();
33643
- var import_react128 = __toESM(require_react(), 1);
33798
+ var import_react129 = __toESM(require_react(), 1);
33644
33799
  var debugLogger33 = createDebugLogger("SLASH_COMMAND_PROCESSOR");
33645
33800
  function hasUserPromptExpansionHooks(config) {
33646
33801
  return !!config && !config.getDisableAllHooks?.() && (config.hasHooksForEvent?.("UserPromptExpansion") ?? false);
@@ -33672,33 +33827,33 @@ function getSkillCommandName(command) {
33672
33827
  }
33673
33828
  __name(getSkillCommandName, "getSkillCommandName");
33674
33829
  var useSlashCommandProcessor = /* @__PURE__ */ __name((config, settings, history, addItem, clearItems, loadHistory, refreshStatic, toggleVimEnabled, isProcessing, setIsProcessing, isIdleRef, setGeminiMdFileCount, actions, extensionsUpdateState, isConfigInitialized, logger, updateItem, setSessionName, extensionRefreshState) => {
33675
- const fallbackExtensionRefreshStateRef = (0, import_react128.useRef)(
33830
+ const fallbackExtensionRefreshStateRef = (0, import_react129.useRef)(
33676
33831
  null
33677
33832
  );
33678
33833
  if (!fallbackExtensionRefreshStateRef.current) {
33679
33834
  fallbackExtensionRefreshStateRef.current = new ExtensionRefreshState();
33680
33835
  }
33681
33836
  const activeExtensionRefreshState = extensionRefreshState ?? fallbackExtensionRefreshStateRef.current;
33682
- const historyRef = (0, import_react128.useRef)(history);
33683
- (0, import_react128.useLayoutEffect)(() => {
33837
+ const historyRef = (0, import_react129.useRef)(history);
33838
+ (0, import_react129.useLayoutEffect)(() => {
33684
33839
  historyRef.current = history;
33685
33840
  }, [history]);
33686
33841
  const { stats: sessionStats, startNewSession } = useSessionStats();
33687
- const [commands, setCommands] = (0, import_react128.useState)([]);
33688
- const [recentCommands, setRecentCommands] = (0, import_react128.useState)(/* @__PURE__ */ new Map());
33689
- const [reloadTrigger, setReloadTrigger] = (0, import_react128.useState)(0);
33690
- const commandReloadResolversRef = (0, import_react128.useRef)([]);
33691
- const extensionContentRefreshTimerRef = (0, import_react128.useRef)(null);
33692
- const extensionContentRefreshRunningRef = (0, import_react128.useRef)(false);
33693
- const extensionContentRefreshPendingRef = (0, import_react128.useRef)(false);
33694
- const mountedRef = (0, import_react128.useRef)(true);
33695
- (0, import_react128.useEffect)(() => {
33842
+ const [commands, setCommands] = (0, import_react129.useState)([]);
33843
+ const [recentCommands, setRecentCommands] = (0, import_react129.useState)(/* @__PURE__ */ new Map());
33844
+ const [reloadTrigger, setReloadTrigger] = (0, import_react129.useState)(0);
33845
+ const commandReloadResolversRef = (0, import_react129.useRef)([]);
33846
+ const extensionContentRefreshTimerRef = (0, import_react129.useRef)(null);
33847
+ const extensionContentRefreshRunningRef = (0, import_react129.useRef)(false);
33848
+ const extensionContentRefreshPendingRef = (0, import_react129.useRef)(false);
33849
+ const mountedRef = (0, import_react129.useRef)(true);
33850
+ (0, import_react129.useEffect)(() => {
33696
33851
  mountedRef.current = true;
33697
33852
  return () => {
33698
33853
  mountedRef.current = false;
33699
33854
  };
33700
33855
  }, []);
33701
- const resolveCommandReloads = (0, import_react128.useCallback)((completedTrigger) => {
33856
+ const resolveCommandReloads = (0, import_react129.useCallback)((completedTrigger) => {
33702
33857
  if (commandReloadResolversRef.current.length === 0) {
33703
33858
  return;
33704
33859
  }
@@ -33712,7 +33867,7 @@ var useSlashCommandProcessor = /* @__PURE__ */ __name((config, settings, history
33712
33867
  }
33713
33868
  commandReloadResolversRef.current = remaining;
33714
33869
  }, []);
33715
- const reloadCommands = (0, import_react128.useCallback)(() => {
33870
+ const reloadCommands = (0, import_react129.useCallback)(() => {
33716
33871
  if (!config) {
33717
33872
  return Promise.resolve();
33718
33873
  }
@@ -33727,14 +33882,14 @@ var useSlashCommandProcessor = /* @__PURE__ */ __name((config, settings, history
33727
33882
  });
33728
33883
  });
33729
33884
  }, [config]);
33730
- const clearPendingExtensionContentRefresh = (0, import_react128.useCallback)(() => {
33885
+ const clearPendingExtensionContentRefresh = (0, import_react129.useCallback)(() => {
33731
33886
  if (!extensionContentRefreshTimerRef.current) {
33732
33887
  return;
33733
33888
  }
33734
33889
  clearTimeout(extensionContentRefreshTimerRef.current);
33735
33890
  extensionContentRefreshTimerRef.current = null;
33736
33891
  }, []);
33737
- const showExtensionContentRefreshError = (0, import_react128.useCallback)(
33892
+ const showExtensionContentRefreshError = (0, import_react129.useCallback)(
33738
33893
  (error) => {
33739
33894
  if (!mountedRef.current) {
33740
33895
  return;
@@ -33754,7 +33909,7 @@ var useSlashCommandProcessor = /* @__PURE__ */ __name((config, settings, history
33754
33909
  },
33755
33910
  [addItem]
33756
33911
  );
33757
- const runExtensionContentRefresh = (0, import_react128.useCallback)(async () => {
33912
+ const runExtensionContentRefresh = (0, import_react129.useCallback)(async () => {
33758
33913
  if (!config) {
33759
33914
  return;
33760
33915
  }
@@ -33798,23 +33953,23 @@ var useSlashCommandProcessor = /* @__PURE__ */ __name((config, settings, history
33798
33953
  reloadCommands,
33799
33954
  showExtensionContentRefreshError
33800
33955
  ]);
33801
- const [shellConfirmationRequest, setShellConfirmationRequest] = (0, import_react128.useState)(null);
33802
- const [confirmationRequest, setConfirmationRequest] = (0, import_react128.useState)(null);
33803
- const [sessionShellAllowlist, setSessionShellAllowlist] = (0, import_react128.useState)(
33956
+ const [shellConfirmationRequest, setShellConfirmationRequest] = (0, import_react129.useState)(null);
33957
+ const [confirmationRequest, setConfirmationRequest] = (0, import_react129.useState)(null);
33958
+ const [sessionShellAllowlist, setSessionShellAllowlist] = (0, import_react129.useState)(
33804
33959
  /* @__PURE__ */ new Set()
33805
33960
  );
33806
- const [pendingItem, setPendingItem] = (0, import_react128.useState)(
33961
+ const [pendingItem, setPendingItem] = (0, import_react129.useState)(
33807
33962
  null
33808
33963
  );
33809
- const [btwItem, setBtwItem] = (0, import_react128.useState)(null);
33810
- const btwAbortControllerRef = (0, import_react128.useRef)(null);
33811
- const cancelBtw = (0, import_react128.useCallback)(() => {
33964
+ const [btwItem, setBtwItem] = (0, import_react129.useState)(null);
33965
+ const btwAbortControllerRef = (0, import_react129.useRef)(null);
33966
+ const cancelBtw = (0, import_react129.useCallback)(() => {
33812
33967
  btwAbortControllerRef.current?.abort();
33813
33968
  btwAbortControllerRef.current = null;
33814
33969
  setBtwItem(null);
33815
33970
  }, []);
33816
- const abortControllerRef = (0, import_react128.useRef)(null);
33817
- const cancelSlashCommand = (0, import_react128.useCallback)(() => {
33971
+ const abortControllerRef = (0, import_react129.useRef)(null);
33972
+ const cancelSlashCommand = (0, import_react129.useCallback)(() => {
33818
33973
  cancelBtw();
33819
33974
  if (!abortControllerRef.current) {
33820
33975
  return;
@@ -33838,14 +33993,14 @@ var useSlashCommandProcessor = /* @__PURE__ */ __name((config, settings, history
33838
33993
  },
33839
33994
  { isActive: isProcessing }
33840
33995
  );
33841
- const pendingHistoryItems = (0, import_react128.useMemo)(() => {
33996
+ const pendingHistoryItems = (0, import_react129.useMemo)(() => {
33842
33997
  const items = [];
33843
33998
  if (pendingItem != null) {
33844
33999
  items.push(pendingItem);
33845
34000
  }
33846
34001
  return items;
33847
34002
  }, [pendingItem]);
33848
- const addMessage = (0, import_react128.useCallback)(
34003
+ const addMessage = (0, import_react129.useCallback)(
33849
34004
  (message) => {
33850
34005
  let historyItemContent;
33851
34006
  if (message.type === "about" /* ABOUT */) {
@@ -33905,7 +34060,7 @@ var useSlashCommandProcessor = /* @__PURE__ */ __name((config, settings, history
33905
34060
  },
33906
34061
  [addItem]
33907
34062
  );
33908
- const commandContext = (0, import_react128.useMemo)(
34063
+ const commandContext = (0, import_react129.useMemo)(
33909
34064
  () => ({
33910
34065
  services: {
33911
34066
  config,
@@ -33977,7 +34132,7 @@ var useSlashCommandProcessor = /* @__PURE__ */ __name((config, settings, history
33977
34132
  activeExtensionRefreshState
33978
34133
  ]
33979
34134
  );
33980
- (0, import_react128.useEffect)(() => {
34135
+ (0, import_react129.useEffect)(() => {
33981
34136
  if (!config) {
33982
34137
  return;
33983
34138
  }
@@ -33995,7 +34150,7 @@ var useSlashCommandProcessor = /* @__PURE__ */ __name((config, settings, history
33995
34150
  })();
33996
34151
  };
33997
34152
  }, [config, reloadCommands]);
33998
- (0, import_react128.useEffect)(() => {
34153
+ (0, import_react129.useEffect)(() => {
33999
34154
  if (!config) {
34000
34155
  return;
34001
34156
  }
@@ -34020,7 +34175,7 @@ var useSlashCommandProcessor = /* @__PURE__ */ __name((config, settings, history
34020
34175
  }
34021
34176
  };
34022
34177
  }, [config, reloadCommands]);
34023
- (0, import_react128.useEffect)(() => {
34178
+ (0, import_react129.useEffect)(() => {
34024
34179
  if (!isConfigInitialized) {
34025
34180
  return;
34026
34181
  }
@@ -34035,7 +34190,7 @@ var useSlashCommandProcessor = /* @__PURE__ */ __name((config, settings, history
34035
34190
  reloadCommands();
34036
34191
  });
34037
34192
  }, [config, isConfigInitialized, reloadCommands]);
34038
- (0, import_react128.useEffect)(() => {
34193
+ (0, import_react129.useEffect)(() => {
34039
34194
  const listener = /* @__PURE__ */ __name((reason) => {
34040
34195
  clearPendingExtensionContentRefresh();
34041
34196
  addItem(
@@ -34062,7 +34217,7 @@ var useSlashCommandProcessor = /* @__PURE__ */ __name((config, settings, history
34062
34217
  addItem,
34063
34218
  clearPendingExtensionContentRefresh
34064
34219
  ]);
34065
- (0, import_react128.useEffect)(() => {
34220
+ (0, import_react129.useEffect)(() => {
34066
34221
  activeExtensionRefreshState.on(
34067
34222
  "extensions-reload-started" /* ExtensionsReloadStarted */,
34068
34223
  clearPendingExtensionContentRefresh
@@ -34082,7 +34237,7 @@ var useSlashCommandProcessor = /* @__PURE__ */ __name((config, settings, history
34082
34237
  );
34083
34238
  };
34084
34239
  }, [activeExtensionRefreshState, clearPendingExtensionContentRefresh]);
34085
- (0, import_react128.useEffect)(() => {
34240
+ (0, import_react129.useEffect)(() => {
34086
34241
  if (!config) {
34087
34242
  return;
34088
34243
  }
@@ -34108,7 +34263,7 @@ var useSlashCommandProcessor = /* @__PURE__ */ __name((config, settings, history
34108
34263
  activeExtensionRefreshState,
34109
34264
  runExtensionContentRefresh
34110
34265
  ]);
34111
- (0, import_react128.useEffect)(() => {
34266
+ (0, import_react129.useEffect)(() => {
34112
34267
  const controller = new AbortController();
34113
34268
  const load = /* @__PURE__ */ __name(async () => {
34114
34269
  try {
@@ -34205,7 +34360,7 @@ var useSlashCommandProcessor = /* @__PURE__ */ __name((config, settings, history
34205
34360
  settings,
34206
34361
  resolveCommandReloads
34207
34362
  ]);
34208
- const handleSlashCommand = (0, import_react128.useCallback)(
34363
+ const handleSlashCommand = (0, import_react129.useCallback)(
34209
34364
  async (rawQuery, oneTimeShellAllowlist, overwriteConfirmed, existingInvocationItemId) => {
34210
34365
  if (typeof rawQuery !== "string") {
34211
34366
  return false;
@@ -34761,11 +34916,11 @@ ${commandToExecute.subCommands.map((sc) => ` - ${sc.name}: ${sc.description ||
34761
34916
 
34762
34917
  // packages/cli/src/ui/hooks/useDoublePress.ts
34763
34918
  init_esbuild_shims();
34764
- var import_react129 = __toESM(require_react(), 1);
34919
+ var import_react130 = __toESM(require_react(), 1);
34765
34920
  var DOUBLE_PRESS_TIMEOUT_MS = 800;
34766
34921
  function useDoublePress(onDoublePress, onPending) {
34767
- const timeoutRef = (0, import_react129.useRef)(null);
34768
- (0, import_react129.useEffect)(
34922
+ const timeoutRef = (0, import_react130.useRef)(null);
34923
+ (0, import_react130.useEffect)(
34769
34924
  () => () => {
34770
34925
  if (timeoutRef.current !== null) {
34771
34926
  clearTimeout(timeoutRef.current);
@@ -34774,7 +34929,7 @@ function useDoublePress(onDoublePress, onPending) {
34774
34929
  },
34775
34930
  []
34776
34931
  );
34777
- return (0, import_react129.useCallback)(() => {
34932
+ return (0, import_react130.useCallback)(() => {
34778
34933
  if (timeoutRef.current !== null) {
34779
34934
  clearTimeout(timeoutRef.current);
34780
34935
  timeoutRef.current = null;
@@ -34838,10 +34993,10 @@ __name(formatSessionWindowTitle, "formatSessionWindowTitle");
34838
34993
 
34839
34994
  // packages/cli/src/ui/hooks/useLogger.ts
34840
34995
  init_esbuild_shims();
34841
- var import_react130 = __toESM(require_react(), 1);
34996
+ var import_react131 = __toESM(require_react(), 1);
34842
34997
  var useLogger = /* @__PURE__ */ __name((storage, sessionId) => {
34843
- const [logger, setLogger] = (0, import_react130.useState)(null);
34844
- (0, import_react130.useEffect)(() => {
34998
+ const [logger, setLogger] = (0, import_react131.useState)(null);
34999
+ (0, import_react131.useEffect)(() => {
34845
35000
  if (!sessionId) {
34846
35001
  return;
34847
35002
  }
@@ -34862,11 +35017,11 @@ var useLogger = /* @__PURE__ */ __name((storage, sessionId) => {
34862
35017
 
34863
35018
  // packages/cli/src/ui/hooks/useGeminiStream.ts
34864
35019
  init_esbuild_shims();
34865
- var import_react134 = __toESM(require_react(), 1);
35020
+ var import_react136 = __toESM(require_react(), 1);
34866
35021
 
34867
35022
  // packages/cli/src/ui/hooks/shellCommandProcessor.ts
34868
35023
  init_esbuild_shims();
34869
- var import_react131 = __toESM(require_react(), 1);
35024
+ var import_react132 = __toESM(require_react(), 1);
34870
35025
  import crypto2 from "node:crypto";
34871
35026
  import path10 from "node:path";
34872
35027
  import os5 from "node:os";
@@ -34899,8 +35054,8 @@ ${modelContent}
34899
35054
  }
34900
35055
  __name(addShellCommandToGeminiHistory, "addShellCommandToGeminiHistory");
34901
35056
  var useShellCommandProcessor = /* @__PURE__ */ __name((addItemToHistory, setPendingHistoryItem, onExec, onDebugMessage, config, geminiClient, setShellInputFocused, terminalWidth, terminalHeight) => {
34902
- const [activeShellPtyId, setActiveShellPtyId] = (0, import_react131.useState)(null);
34903
- const handleShellCommand = (0, import_react131.useCallback)(
35057
+ const [activeShellPtyId, setActiveShellPtyId] = (0, import_react132.useState)(null);
35058
+ const handleShellCommand = (0, import_react132.useCallback)(
34904
35059
  (rawQuery, abortSignal) => {
34905
35060
  if (typeof rawQuery !== "string" || rawQuery.trim() === "") {
34906
35061
  return false;
@@ -35154,11 +35309,11 @@ ${finalOutput}`;
35154
35309
 
35155
35310
  // packages/cli/src/ui/hooks/useStateAndRef.ts
35156
35311
  init_esbuild_shims();
35157
- var import_react132 = __toESM(require_react(), 1);
35312
+ var import_react133 = __toESM(require_react(), 1);
35158
35313
  var useStateAndRef = /* @__PURE__ */ __name((initialValue) => {
35159
- const [state, setState] = import_react132.default.useState(initialValue);
35160
- const ref = import_react132.default.useRef(initialValue);
35161
- const setStateInternal = import_react132.default.useCallback(
35314
+ const [state, setState] = import_react133.default.useState(initialValue);
35315
+ const ref = import_react133.default.useRef(initialValue);
35316
+ const setStateInternal = import_react133.default.useCallback(
35162
35317
  (newStateOrCallback) => {
35163
35318
  let newValue;
35164
35319
  if (typeof newStateOrCallback === "function") {
@@ -35176,12 +35331,12 @@ var useStateAndRef = /* @__PURE__ */ __name((initialValue) => {
35176
35331
 
35177
35332
  // packages/cli/src/ui/hooks/useReactToolScheduler.ts
35178
35333
  init_esbuild_shims();
35179
- var import_react133 = __toESM(require_react(), 1);
35334
+ var import_react134 = __toESM(require_react(), 1);
35180
35335
  import * as path11 from "node:path";
35181
35336
  var debugLogger35 = createDebugLogger("REACT_TOOL_SCHEDULER");
35182
35337
  function useReactToolScheduler(onComplete, config, getPreferredEditor, onEditorClose) {
35183
- const [toolCallsForDisplay, setToolCallsForDisplay] = (0, import_react133.useState)([]);
35184
- const outputUpdateHandler = (0, import_react133.useCallback)(
35338
+ const [toolCallsForDisplay, setToolCallsForDisplay] = (0, import_react134.useState)([]);
35339
+ const outputUpdateHandler = (0, import_react134.useCallback)(
35185
35340
  (toolCallId, outputChunk) => {
35186
35341
  if (isShellProgressData(outputChunk)) {
35187
35342
  return;
@@ -35199,13 +35354,13 @@ function useReactToolScheduler(onComplete, config, getPreferredEditor, onEditorC
35199
35354
  },
35200
35355
  []
35201
35356
  );
35202
- const allToolCallsCompleteHandler = (0, import_react133.useCallback)(
35357
+ const allToolCallsCompleteHandler = (0, import_react134.useCallback)(
35203
35358
  async (completedToolCalls) => {
35204
35359
  await onComplete(completedToolCalls);
35205
35360
  },
35206
35361
  [onComplete]
35207
35362
  );
35208
- const toolCallsUpdateHandler = (0, import_react133.useCallback)(
35363
+ const toolCallsUpdateHandler = (0, import_react134.useCallback)(
35209
35364
  (updatedCoreToolCalls) => {
35210
35365
  setToolCallsForDisplay(
35211
35366
  (prevTrackedCalls) => updatedCoreToolCalls.map((coreTc) => {
@@ -35232,10 +35387,9 @@ function useReactToolScheduler(onComplete, config, getPreferredEditor, onEditorC
35232
35387
  },
35233
35388
  [setToolCallsForDisplay]
35234
35389
  );
35235
- const scheduler = (0, import_react133.useMemo)(
35390
+ const scheduler = (0, import_react134.useMemo)(
35236
35391
  () => new CoreToolScheduler({
35237
35392
  config,
35238
- chatRecordingService: config.getChatRecordingService(),
35239
35393
  outputUpdateHandler,
35240
35394
  onAllToolCallsComplete: allToolCallsCompleteHandler,
35241
35395
  onToolCallsUpdate: toolCallsUpdateHandler,
@@ -35251,7 +35405,7 @@ function useReactToolScheduler(onComplete, config, getPreferredEditor, onEditorC
35251
35405
  onEditorClose
35252
35406
  ]
35253
35407
  );
35254
- const schedule = (0, import_react133.useCallback)(
35408
+ const schedule = (0, import_react134.useCallback)(
35255
35409
  (request, signal, modelOverride) => {
35256
35410
  if (!modelOverride?.endsWith("\0")) {
35257
35411
  void scheduler.schedule(request, signal);
@@ -35278,13 +35432,6 @@ function useReactToolScheduler(onComplete, config, getPreferredEditor, onEditorC
35278
35432
  message,
35279
35433
  message
35280
35434
  );
35281
- config.getChatRecordingService()?.recordToolResult(responseParts, {
35282
- callId: toolRequest.callId,
35283
- status: "error",
35284
- resultDisplay: message,
35285
- error: toolError,
35286
- errorType: "unhandled_exception" /* UNHANDLED_EXCEPTION */
35287
- });
35288
35435
  return {
35289
35436
  status: "error",
35290
35437
  request: toolRequest,
@@ -35307,7 +35454,7 @@ function useReactToolScheduler(onComplete, config, getPreferredEditor, onEditorC
35307
35454
  },
35308
35455
  [allToolCallsCompleteHandler, config, scheduler]
35309
35456
  );
35310
- const markToolsAsSubmitted = (0, import_react133.useCallback)(
35457
+ const markToolsAsSubmitted = (0, import_react134.useCallback)(
35311
35458
  (callIdsToMark) => {
35312
35459
  setToolCallsForDisplay(
35313
35460
  (prevCalls) => prevCalls.map(
@@ -35473,6 +35620,78 @@ __name(mapToDisplay, "mapToDisplay");
35473
35620
  import { promises as fs17 } from "node:fs";
35474
35621
  import path12 from "node:path";
35475
35622
  import process14 from "node:process";
35623
+
35624
+ // packages/cli/src/ui/hooks/useMessageQueue.ts
35625
+ init_esbuild_shims();
35626
+ var import_react135 = __toESM(require_react(), 1);
35627
+ var GOAL_COMMAND_RE = /^\/goal(?:\s|$)/;
35628
+ function useMessageQueue() {
35629
+ const [queuedMessages, setQueuedMessages] = (0, import_react135.useState)([]);
35630
+ const queueRef = (0, import_react135.useRef)([]);
35631
+ const addMessage = (0, import_react135.useCallback)((message, deferUntilIdle = false) => {
35632
+ const trimmedMessage = message.trim();
35633
+ if (trimmedMessage.length > 0) {
35634
+ queueRef.current = [
35635
+ ...queueRef.current,
35636
+ { text: trimmedMessage, deferUntilIdle }
35637
+ ];
35638
+ setQueuedMessages(queueRef.current);
35639
+ }
35640
+ }, []);
35641
+ const clearQueue = (0, import_react135.useCallback)(() => {
35642
+ queueRef.current = [];
35643
+ setQueuedMessages([]);
35644
+ }, []);
35645
+ const getQueuedMessagesText = (0, import_react135.useCallback)(() => {
35646
+ if (queuedMessages.length === 0) return "";
35647
+ return queuedMessages.map(({ text }) => text).join("\n\n");
35648
+ }, [queuedMessages]);
35649
+ const popAllMessages = (0, import_react135.useCallback)(() => {
35650
+ const current = queueRef.current;
35651
+ if (current.length === 0) return null;
35652
+ queueRef.current = [];
35653
+ setQueuedMessages([]);
35654
+ return current.map(({ text }) => text).join("\n\n");
35655
+ }, []);
35656
+ const restoreMessages = (0, import_react135.useCallback)((messages) => {
35657
+ const restored = messages.map((text) => text.trim()).filter(Boolean).map((text) => ({ text, deferUntilIdle: false }));
35658
+ if (restored.length === 0) return;
35659
+ queueRef.current = [...restored, ...queueRef.current];
35660
+ setQueuedMessages(queueRef.current);
35661
+ }, []);
35662
+ const drainQueue = (0, import_react135.useCallback)((includeDeferred = false) => {
35663
+ const current = queueRef.current;
35664
+ if (current.length === 0) return [];
35665
+ const shouldDrain = /* @__PURE__ */ __name((message) => (!isSlashCommand(message.text) || !includeDeferred && GOAL_COMMAND_RE.test(message.text)) && (includeDeferred || !message.deferUntilIdle), "shouldDrain");
35666
+ const drained = current.filter(shouldDrain);
35667
+ if (drained.length === 0) return [];
35668
+ const rest = current.filter((message) => !shouldDrain(message));
35669
+ queueRef.current = rest;
35670
+ setQueuedMessages(rest);
35671
+ return drained.map(({ text }) => text);
35672
+ }, []);
35673
+ const popNextSegment = (0, import_react135.useCallback)(() => {
35674
+ const current = queueRef.current;
35675
+ if (current.length === 0) return null;
35676
+ const [head, ...rest] = current;
35677
+ queueRef.current = rest;
35678
+ setQueuedMessages(rest);
35679
+ return head.text;
35680
+ }, []);
35681
+ return {
35682
+ messageQueue: queuedMessages.map(({ text }) => text),
35683
+ addMessage,
35684
+ clearQueue,
35685
+ getQueuedMessagesText,
35686
+ popAllMessages,
35687
+ restoreMessages,
35688
+ drainQueue,
35689
+ popNextSegment
35690
+ };
35691
+ }
35692
+ __name(useMessageQueue, "useMessageQueue");
35693
+
35694
+ // packages/cli/src/ui/hooks/useGeminiStream.ts
35476
35695
  var debugLogger36 = createDebugLogger("GEMINI_STREAM");
35477
35696
  function applyModelOverride(modelOverrideRef, inlineActiveRef, value, isInline) {
35478
35697
  modelOverrideRef.current = value;
@@ -35615,16 +35834,16 @@ function charIndexAfterLine(text, keptLines) {
35615
35834
  }
35616
35835
  __name(charIndexAfterLine, "charIndexAfterLine");
35617
35836
  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) => {
35618
- const [initError, setInitError] = (0, import_react134.useState)(null);
35619
- const abortControllerRef = (0, import_react134.useRef)(null);
35620
- const flushBufferedStreamEventsRef = (0, import_react134.useRef)(/* @__PURE__ */ new Set());
35621
- const turnCancelledRef = (0, import_react134.useRef)(false);
35622
- const isSubmittingQueryRef = (0, import_react134.useRef)(false);
35623
- const lastPromptRef = (0, import_react134.useRef)(null);
35624
- const lastTurnUserItemRef = (0, import_react134.useRef)(null);
35625
- const turnSawContentEventRef = (0, import_react134.useRef)(false);
35626
- const lastPromptErroredRef = (0, import_react134.useRef)(false);
35627
- const commitItem = (0, import_react134.useCallback)(
35837
+ const [initError, setInitError] = (0, import_react136.useState)(null);
35838
+ const abortControllerRef = (0, import_react136.useRef)(null);
35839
+ const flushBufferedStreamEventsRef = (0, import_react136.useRef)(/* @__PURE__ */ new Set());
35840
+ const turnCancelledRef = (0, import_react136.useRef)(false);
35841
+ const isSubmittingQueryRef = (0, import_react136.useRef)(false);
35842
+ const lastPromptRef = (0, import_react136.useRef)(null);
35843
+ const lastTurnUserItemRef = (0, import_react136.useRef)(null);
35844
+ const turnSawContentEventRef = (0, import_react136.useRef)(false);
35845
+ const lastPromptErroredRef = (0, import_react136.useRef)(false);
35846
+ const commitItem = (0, import_react136.useCallback)(
35628
35847
  (item, userMessageTimestamp) => {
35629
35848
  if (item.type === "gemini" && !item.timestamp) {
35630
35849
  item.timestamp = Date.now();
@@ -35634,17 +35853,17 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
35634
35853
  [addItem]
35635
35854
  );
35636
35855
  const dualOutput = useDualOutput();
35637
- const [isResponding, setIsResponding] = (0, import_react134.useState)(false);
35638
- const activeModelStreamsRef = (0, import_react134.useRef)(0);
35639
- const [thought, setThought] = (0, import_react134.useState)(null);
35640
- const historyRef = (0, import_react134.useRef)(history);
35641
- (0, import_react134.useLayoutEffect)(() => {
35856
+ const [isResponding, setIsResponding] = (0, import_react136.useState)(false);
35857
+ const activeModelStreamsRef = (0, import_react136.useRef)(0);
35858
+ const [thought, setThought] = (0, import_react136.useState)(null);
35859
+ const historyRef = (0, import_react136.useRef)(history);
35860
+ (0, import_react136.useLayoutEffect)(() => {
35642
35861
  historyRef.current = history;
35643
35862
  }, [history]);
35644
- const auxiliaryAbortRefsRef = (0, import_react134.useRef)(/* @__PURE__ */ new Set());
35863
+ const auxiliaryAbortRefsRef = (0, import_react136.useRef)(/* @__PURE__ */ new Set());
35645
35864
  const [pendingHistoryItem, pendingHistoryItemRef, setPendingHistoryItem] = useStateAndRef(null);
35646
35865
  const [pendingThoughtItem, pendingThoughtItemRef, setPendingThoughtItem] = useStateAndRef(null);
35647
- const thoughtStartTimeRef = (0, import_react134.useRef)(null);
35866
+ const thoughtStartTimeRef = (0, import_react136.useRef)(null);
35648
35867
  const [
35649
35868
  pendingRetryErrorItem,
35650
35869
  pendingRetryErrorItemRef,
@@ -35655,21 +35874,21 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
35655
35874
  pendingRetryCountdownItemRef,
35656
35875
  setPendingRetryCountdownItem
35657
35876
  ] = useStateAndRef(null);
35658
- const retryCountdownTimerRef = (0, import_react134.useRef)(
35877
+ const retryCountdownTimerRef = (0, import_react136.useRef)(
35659
35878
  null
35660
35879
  );
35661
- const processedMemoryToolsRef = (0, import_react134.useRef)(/* @__PURE__ */ new Set());
35662
- const submitPromptOnCompleteRef = (0, import_react134.useRef)(null);
35663
- const modelOverrideRef = (0, import_react134.useRef)(void 0);
35664
- const inlineModelOverrideActiveRef = (0, import_react134.useRef)(false);
35665
- const handledProviderToolCallIdsRef = (0, import_react134.useRef)(/* @__PURE__ */ new Set());
35666
- const duplicateProviderToolCallResponseIdsRef = (0, import_react134.useRef)(
35880
+ const processedMemoryToolsRef = (0, import_react136.useRef)(/* @__PURE__ */ new Set());
35881
+ const submitPromptOnCompleteRef = (0, import_react136.useRef)(null);
35882
+ const modelOverrideRef = (0, import_react136.useRef)(void 0);
35883
+ const inlineModelOverrideActiveRef = (0, import_react136.useRef)(false);
35884
+ const handledProviderToolCallIdsRef = (0, import_react136.useRef)(/* @__PURE__ */ new Set());
35885
+ const duplicateProviderToolCallResponseIdsRef = (0, import_react136.useRef)(
35667
35886
  /* @__PURE__ */ new Set()
35668
35887
  );
35669
- const pendingDuplicateToolResponsesRef = (0, import_react134.useRef)([]);
35670
- const immediateDuplicateToolResponsesRef = (0, import_react134.useRef)(null);
35671
- const streamingResponseLengthRef = (0, import_react134.useRef)(0);
35672
- const [isReceivingContent, setIsReceivingContent] = (0, import_react134.useState)(false);
35888
+ const pendingDuplicateToolResponsesRef = (0, import_react136.useRef)([]);
35889
+ const immediateDuplicateToolResponsesRef = (0, import_react136.useRef)(null);
35890
+ const streamingResponseLengthRef = (0, import_react136.useRef)(0);
35891
+ const [isReceivingContent, setIsReceivingContent] = (0, import_react136.useState)(false);
35673
35892
  const {
35674
35893
  startNewPrompt,
35675
35894
  getPromptCount,
@@ -35694,11 +35913,11 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
35694
35913
  getPreferredEditor,
35695
35914
  onEditorClose
35696
35915
  );
35697
- const pendingToolCallGroupDisplay = (0, import_react134.useMemo)(
35916
+ const pendingToolCallGroupDisplay = (0, import_react136.useMemo)(
35698
35917
  () => toolCalls.length ? mapToDisplay(toolCalls, config.getProjectRoot()) : void 0,
35699
35918
  [toolCalls, config]
35700
35919
  );
35701
- const activeToolPtyId = (0, import_react134.useMemo)(() => {
35920
+ const activeToolPtyId = (0, import_react136.useMemo)(() => {
35702
35921
  const executingShellTool = toolCalls?.find(
35703
35922
  (tc) => tc.status === "executing" && tc.request.name === "run_shell_command"
35704
35923
  );
@@ -35707,18 +35926,18 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
35707
35926
  }
35708
35927
  return void 0;
35709
35928
  }, [toolCalls]);
35710
- const loopDetectedRef = (0, import_react134.useRef)(false);
35929
+ const loopDetectedRef = (0, import_react136.useRef)(false);
35711
35930
  const [
35712
35931
  loopDetectionConfirmationRequest,
35713
35932
  setLoopDetectionConfirmationRequest
35714
- ] = (0, import_react134.useState)(null);
35715
- const stopRetryCountdownTimer = (0, import_react134.useCallback)(() => {
35933
+ ] = (0, import_react136.useState)(null);
35934
+ const stopRetryCountdownTimer = (0, import_react136.useCallback)(() => {
35716
35935
  if (retryCountdownTimerRef.current) {
35717
35936
  clearInterval(retryCountdownTimerRef.current);
35718
35937
  retryCountdownTimerRef.current = null;
35719
35938
  }
35720
35939
  }, []);
35721
- const clearRetryCountdown = (0, import_react134.useCallback)(() => {
35940
+ const clearRetryCountdown = (0, import_react136.useCallback)(() => {
35722
35941
  stopRetryCountdownTimer();
35723
35942
  skipRetryDelayRef.current = null;
35724
35943
  setPendingRetryErrorItem(null);
@@ -35728,8 +35947,8 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
35728
35947
  setPendingRetryCountdownItem,
35729
35948
  stopRetryCountdownTimer
35730
35949
  ]);
35731
- const skipRetryDelayRef = (0, import_react134.useRef)(null);
35732
- const startRetryCountdown = (0, import_react134.useCallback)(
35950
+ const skipRetryDelayRef = (0, import_react136.useRef)(null);
35951
+ const startRetryCountdown = (0, import_react136.useCallback)(
35733
35952
  (retryInfo) => {
35734
35953
  stopRetryCountdownTimer();
35735
35954
  skipRetryDelayRef.current = retryInfo.skipDelay;
@@ -35770,8 +35989,8 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
35770
35989
  stopRetryCountdownTimer
35771
35990
  ]
35772
35991
  );
35773
- (0, import_react134.useEffect)(() => () => stopRetryCountdownTimer(), [stopRetryCountdownTimer]);
35774
- const onExec = (0, import_react134.useCallback)(async (done) => {
35992
+ (0, import_react136.useEffect)(() => () => stopRetryCountdownTimer(), [stopRetryCountdownTimer]);
35993
+ const onExec = (0, import_react136.useCallback)(async (done) => {
35775
35994
  setIsResponding(true);
35776
35995
  await done;
35777
35996
  setIsResponding(false);
@@ -35788,12 +36007,12 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
35788
36007
  terminalHeight
35789
36008
  );
35790
36009
  const activePtyId = activeShellPtyId || activeToolPtyId;
35791
- (0, import_react134.useEffect)(() => {
36010
+ (0, import_react136.useEffect)(() => {
35792
36011
  if (!activePtyId) {
35793
36012
  setShellInputFocused(false);
35794
36013
  }
35795
36014
  }, [activePtyId, setShellInputFocused]);
35796
- const streamingState = (0, import_react134.useMemo)(() => {
36015
+ const streamingState = (0, import_react136.useMemo)(() => {
35797
36016
  if (toolCalls.some((tc) => tc.status === "awaiting_approval")) {
35798
36017
  return "waiting_for_confirmation" /* WaitingForConfirmation */;
35799
36018
  }
@@ -35811,11 +36030,9 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
35811
36030
  }
35812
36031
  return "idle" /* Idle */;
35813
36032
  }, [isResponding, toolCalls]);
35814
- (0, import_react134.useEffect)(() => {
36033
+ (0, import_react136.useEffect)(() => {
35815
36034
  if (config.getApprovalMode() === "yolo" /* YOLO */ && streamingState === "idle" /* Idle */) {
35816
- const lastUserMessageIndex = history.findLastIndex(
35817
- (item) => item.type === "user" /* USER */
35818
- );
36035
+ const lastUserMessageIndex = findLastUserItemIndex(history);
35819
36036
  const turnCount = lastUserMessageIndex === -1 ? 0 : history.length - lastUserMessageIndex;
35820
36037
  if (turnCount > 0) {
35821
36038
  logConversationFinishedEvent(
@@ -35825,7 +36042,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
35825
36042
  }
35826
36043
  }
35827
36044
  }, [streamingState, config, history]);
35828
- const cancelOngoingRequest = (0, import_react134.useCallback)(() => {
36045
+ const cancelOngoingRequest = (0, import_react136.useCallback)(() => {
35829
36046
  if (streamingState !== "responding" /* Responding */) {
35830
36047
  return;
35831
36048
  }
@@ -35896,7 +36113,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
35896
36113
  config,
35897
36114
  getPromptCount
35898
36115
  ]);
35899
- const applyVisionBridgeIfNeeded = (0, import_react134.useCallback)(
36116
+ const applyVisionBridgeIfNeeded = (0, import_react136.useCallback)(
35900
36117
  async (parts, timestamp, signal) => {
35901
36118
  if (parts === null || !hasImageParts(parts)) {
35902
36119
  return { parts, shouldProceed: true };
@@ -35961,7 +36178,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
35961
36178
  },
35962
36179
  [addItem, config]
35963
36180
  );
35964
- const prepareQueryForGemini = (0, import_react134.useCallback)(
36181
+ const prepareQueryForGemini = (0, import_react136.useCallback)(
35965
36182
  async (query, userMessageTimestamp, abortSignal, prompt_id, submitType) => {
35966
36183
  if (turnCancelledRef.current) {
35967
36184
  return { queryToSend: null, shouldProceed: false };
@@ -36112,7 +36329,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
36112
36329
  applyVisionBridgeIfNeeded
36113
36330
  ]
36114
36331
  );
36115
- const handleContentEvent = (0, import_react134.useCallback)(
36332
+ const handleContentEvent = (0, import_react136.useCallback)(
36116
36333
  (eventValue, currentGeminiMessageBuffer, userMessageTimestamp) => {
36117
36334
  if (turnCancelledRef.current) {
36118
36335
  return "";
@@ -36237,7 +36454,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
36237
36454
  terminalWidthRef
36238
36455
  ]
36239
36456
  );
36240
- const mergeThought = (0, import_react134.useCallback)(
36457
+ const mergeThought = (0, import_react136.useCallback)(
36241
36458
  (incoming) => {
36242
36459
  setThought((prev) => {
36243
36460
  const incomingDescription = incoming.description ? clampLoadingThoughtDescription(incoming.description) : incoming.description;
@@ -36266,7 +36483,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
36266
36483
  },
36267
36484
  [setThought]
36268
36485
  );
36269
- const handleThoughtEvent = (0, import_react134.useCallback)(
36486
+ const handleThoughtEvent = (0, import_react136.useCallback)(
36270
36487
  (eventValue, currentThoughtBuffer, userMessageTimestamp) => {
36271
36488
  if (turnCancelledRef.current) {
36272
36489
  return "";
@@ -36328,7 +36545,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
36328
36545
  },
36329
36546
  [addItem, mergeThought, pendingThoughtItemRef, setPendingThoughtItem]
36330
36547
  );
36331
- const commitPendingThought = (0, import_react134.useCallback)(
36548
+ const commitPendingThought = (0, import_react136.useCallback)(
36332
36549
  (userMessageTimestamp) => {
36333
36550
  if (pendingThoughtItemRef.current) {
36334
36551
  const item = { ...pendingThoughtItemRef.current };
@@ -36342,7 +36559,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
36342
36559
  },
36343
36560
  [addItem, pendingThoughtItemRef, setPendingThoughtItem]
36344
36561
  );
36345
- const handleUserCancelledEvent = (0, import_react134.useCallback)(
36562
+ const handleUserCancelledEvent = (0, import_react136.useCallback)(
36346
36563
  (userMessageTimestamp) => {
36347
36564
  if (turnCancelledRef.current) {
36348
36565
  return;
@@ -36382,7 +36599,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
36382
36599
  clearRetryCountdown
36383
36600
  ]
36384
36601
  );
36385
- const handleErrorEvent = (0, import_react134.useCallback)(
36602
+ const handleErrorEvent = (0, import_react136.useCallback)(
36386
36603
  (eventValue, userMessageTimestamp) => {
36387
36604
  lastPromptErroredRef.current = true;
36388
36605
  commitPendingThought(userMessageTimestamp);
@@ -36425,7 +36642,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
36425
36642
  clearRetryCountdown
36426
36643
  ]
36427
36644
  );
36428
- const handleCitationEvent = (0, import_react134.useCallback)(
36645
+ const handleCitationEvent = (0, import_react136.useCallback)(
36429
36646
  (text, userMessageTimestamp) => {
36430
36647
  if (!showCitations(settings)) {
36431
36648
  return;
@@ -36444,7 +36661,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
36444
36661
  settings
36445
36662
  ]
36446
36663
  );
36447
- const handleFinishedEvent = (0, import_react134.useCallback)(
36664
+ const handleFinishedEvent = (0, import_react136.useCallback)(
36448
36665
  (event, userMessageTimestamp) => {
36449
36666
  const finishReason = event.value.reason;
36450
36667
  if (!finishReason) {
@@ -36485,8 +36702,8 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
36485
36702
  },
36486
36703
  [addItem, clearRetryCountdown]
36487
36704
  );
36488
- const autonomousLoopTickResolverRef = (0, import_react134.useRef)(null);
36489
- const handleChatCompressionEvent = (0, import_react134.useCallback)(
36705
+ const autonomousLoopTickResolverRef = (0, import_react136.useRef)(null);
36706
+ const handleChatCompressionEvent = (0, import_react136.useCallback)(
36490
36707
  (eventValue, userMessageTimestamp) => {
36491
36708
  autonomousLoopTickResolverRef.current?.resetCache();
36492
36709
  if (pendingHistoryItemRef.current) {
@@ -36505,7 +36722,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
36505
36722
  },
36506
36723
  [addItem, commitItem, config, pendingHistoryItemRef, setPendingHistoryItem]
36507
36724
  );
36508
- const handleMaxSessionTurnsEvent = (0, import_react134.useCallback)(
36725
+ const handleMaxSessionTurnsEvent = (0, import_react136.useCallback)(
36509
36726
  () => addItem(
36510
36727
  {
36511
36728
  type: "info",
@@ -36515,7 +36732,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
36515
36732
  ),
36516
36733
  [addItem, config]
36517
36734
  );
36518
- const handleSessionTokenLimitExceededEvent = (0, import_react134.useCallback)(
36735
+ const handleSessionTokenLimitExceededEvent = (0, import_react136.useCallback)(
36519
36736
  (value) => addItem(
36520
36737
  {
36521
36738
  type: "error",
@@ -36530,7 +36747,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
36530
36747
  ),
36531
36748
  [addItem]
36532
36749
  );
36533
- const handleLoopDetectionConfirmation = (0, import_react134.useCallback)(
36750
+ const handleLoopDetectionConfirmation = (0, import_react136.useCallback)(
36534
36751
  (result) => {
36535
36752
  setLoopDetectionConfirmationRequest(null);
36536
36753
  if (result.userSelection === "disable") {
@@ -36554,12 +36771,12 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
36554
36771
  },
36555
36772
  [config, addItem]
36556
36773
  );
36557
- const handleLoopDetectedEvent = (0, import_react134.useCallback)(() => {
36774
+ const handleLoopDetectedEvent = (0, import_react136.useCallback)(() => {
36558
36775
  setLoopDetectionConfirmationRequest({
36559
36776
  onComplete: handleLoopDetectionConfirmation
36560
36777
  });
36561
36778
  }, [handleLoopDetectionConfirmation]);
36562
- const handleUserPromptSubmitBlockedEvent = (0, import_react134.useCallback)(
36779
+ const handleUserPromptSubmitBlockedEvent = (0, import_react136.useCallback)(
36563
36780
  (value, userMessageTimestamp) => {
36564
36781
  if (pendingHistoryItemRef.current) {
36565
36782
  commitItem(pendingHistoryItemRef.current, userMessageTimestamp);
@@ -36576,7 +36793,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
36576
36793
  },
36577
36794
  [addItem, commitItem, pendingHistoryItemRef, setPendingHistoryItem]
36578
36795
  );
36579
- const handleStopHookLoopEvent = (0, import_react134.useCallback)(
36796
+ const handleStopHookLoopEvent = (0, import_react136.useCallback)(
36580
36797
  (value, userMessageTimestamp) => {
36581
36798
  if (pendingHistoryItemRef.current) {
36582
36799
  commitItem(pendingHistoryItemRef.current, userMessageTimestamp);
@@ -36610,7 +36827,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
36610
36827
  },
36611
36828
  [addItem, commitItem, config, pendingHistoryItemRef, setPendingHistoryItem]
36612
36829
  );
36613
- const handleActiveGoalEvent = (0, import_react134.useCallback)(
36830
+ const handleActiveGoalEvent = (0, import_react136.useCallback)(
36614
36831
  (activeGoal) => {
36615
36832
  const sessionId = config.getSessionId();
36616
36833
  const currentActiveGoal = getActiveGoal(sessionId);
@@ -36628,7 +36845,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
36628
36845
  },
36629
36846
  [config]
36630
36847
  );
36631
- const processGeminiStreamEvents = (0, import_react134.useCallback)(
36848
+ const processGeminiStreamEvents = (0, import_react136.useCallback)(
36632
36849
  async (stream, userMessageTimestamp, signal) => {
36633
36850
  let geminiMessageBuffer = "";
36634
36851
  let thoughtBuffer = "";
@@ -36742,7 +36959,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
36742
36959
  flushBufferedStreamEvents();
36743
36960
  toolCallRequests.length = 0;
36744
36961
  handleUserCancelledEvent(userMessageTimestamp);
36745
- break;
36962
+ return 1 /* UserCancelled */;
36746
36963
  case "error" /* Error */:
36747
36964
  flushBufferedStreamEvents();
36748
36965
  handleErrorEvent(event.value, userMessageTimestamp);
@@ -36867,11 +37084,11 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
36867
37084
  commitPendingThought(userMessageTimestamp);
36868
37085
  discardBufferedStreamEvents();
36869
37086
  flushBufferedStreamEventsRef.current.delete(flushBufferedStreamEvents);
37087
+ dualOutput?.finalizeAssistantMessage();
36870
37088
  }
36871
- dualOutput?.finalizeAssistantMessage();
36872
37089
  if (toolCallRequests.length > 0 && !signal.aborted && !loopDetectedRef.current) {
36873
37090
  const executableToolCallRequests = [];
36874
- const duplicateResponseParts = [];
37091
+ const duplicateResponses = [];
36875
37092
  let duplicatePromptId;
36876
37093
  const historyCallIdsWithResponse = geminiClient ? geminiClient.getHistoryFunctionResponseIds() : /* @__PURE__ */ new Set();
36877
37094
  const handledProviderIds = /* @__PURE__ */ new Set([
@@ -36907,26 +37124,27 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
36907
37124
  `[processGeminiStreamEvents] Suppressing duplicate provider tool-call id: ${providerCallId} (tool: ${request.name})`
36908
37125
  );
36909
37126
  dualOutput?.emitToolResult(request, response);
36910
- duplicateResponseParts.push(...response.responseParts);
37127
+ duplicateResponses.push({ request, response });
36911
37128
  duplicatePromptId ??= request.prompt_id;
36912
37129
  continue;
36913
37130
  }
36914
37131
  handledProviderToolCallIdsRef.current.add(providerCallId);
36915
37132
  executableToolCallRequests.push(request);
36916
37133
  }
36917
- if (duplicateResponseParts.length > 0) {
37134
+ if (duplicateResponses.length > 0) {
36918
37135
  if (executableToolCallRequests.length > 0) {
36919
37136
  pendingDuplicateToolResponsesRef.current.push({
36920
37137
  executableCallIds: new Set(
36921
37138
  executableToolCallRequests.map((request) => request.callId)
36922
37139
  ),
36923
37140
  promptId: duplicatePromptId ?? executableToolCallRequests[0]?.prompt_id,
36924
- responseParts: duplicateResponseParts
37141
+ callOrder: toolCallRequests.map((request) => request.callId),
37142
+ duplicateResponses
36925
37143
  });
36926
37144
  } else {
36927
37145
  immediateDuplicateToolResponsesRef.current = {
36928
37146
  promptId: duplicatePromptId,
36929
- responseParts: duplicateResponseParts
37147
+ responses: duplicateResponses
36930
37148
  };
36931
37149
  }
36932
37150
  }
@@ -36967,14 +37185,38 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
36967
37185
  dualOutput
36968
37186
  ]
36969
37187
  );
36970
- const resolveSteeredMessages = (0, import_react134.useCallback)(
37188
+ const resolveSteeredMessages = (0, import_react136.useCallback)(
36971
37189
  async (messages, signal) => {
36972
- const resolvedMessages = [];
37190
+ const resolvedSegments = [];
36973
37191
  const resolvedForRecording = [];
37192
+ const restoreMessages = [];
37193
+ let pendingGoalSegmentIndex;
36974
37194
  const timestamp = Date.now();
36975
37195
  for (let index = 0; index < messages.length; index += 1) {
36976
- if (signal.aborted) break;
37196
+ if (signal.aborted) {
37197
+ restoreMessages.push(...messages.slice(index));
37198
+ break;
37199
+ }
36977
37200
  const message = messages[index];
37201
+ if (GOAL_COMMAND_RE.test(message)) {
37202
+ const activeGoalBeforeCommand = getActiveGoal(config.getSessionId());
37203
+ const result = await handleSlashCommand(message);
37204
+ const activeGoalAfterCommand = getActiveGoal(config.getSessionId());
37205
+ if (result && result.type === "submit_prompt") {
37206
+ if (pendingGoalSegmentIndex !== void 0) {
37207
+ resolvedSegments[pendingGoalSegmentIndex] = [];
37208
+ }
37209
+ pendingGoalSegmentIndex = resolvedSegments.length;
37210
+ resolvedSegments.push(normalizePartList(result.content));
37211
+ } else if (activeGoalBeforeCommand?.hookId !== activeGoalAfterCommand?.hookId) {
37212
+ if (pendingGoalSegmentIndex !== void 0) {
37213
+ resolvedSegments[pendingGoalSegmentIndex] = [];
37214
+ pendingGoalSegmentIndex = void 0;
37215
+ }
37216
+ }
37217
+ continue;
37218
+ }
37219
+ restoreMessages.push(message);
36978
37220
  const sideEffects = [];
36979
37221
  let resolvedQuery = [{ text: message }];
36980
37222
  if (isAtCommand(message)) {
@@ -37037,7 +37279,10 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
37037
37279
  } finally {
37038
37280
  clearTimeout(timeoutId);
37039
37281
  }
37040
- if (signal.aborted) break;
37282
+ if (signal.aborted) {
37283
+ restoreMessages.push(...messages.slice(index + 1));
37284
+ break;
37285
+ }
37041
37286
  }
37042
37287
  const bridgeResult = await applyVisionBridgeIfNeeded(
37043
37288
  resolvedQuery,
@@ -37045,7 +37290,10 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
37045
37290
  signal
37046
37291
  );
37047
37292
  if (!bridgeResult.shouldProceed) {
37048
- if (signal.aborted) break;
37293
+ if (signal.aborted) {
37294
+ restoreMessages.push(...messages.slice(index + 1));
37295
+ break;
37296
+ }
37049
37297
  continue;
37050
37298
  }
37051
37299
  const messageParts = normalizePartList(
@@ -37063,42 +37311,60 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
37063
37311
  )
37064
37312
  );
37065
37313
  }
37066
- if (resolvedMessages.length > 0 && messageParts.length > 0) {
37067
- resolvedMessages.push({ text: "\n\n" });
37068
- }
37069
- resolvedMessages.push(...messageParts);
37314
+ resolvedSegments.push(messageParts);
37070
37315
  resolvedForRecording.push({
37071
37316
  message,
37072
37317
  parts: messageParts,
37073
37318
  sideEffects
37074
37319
  });
37075
37320
  }
37076
- if (signal.aborted) return void 0;
37321
+ const resolvedMessages = [];
37322
+ for (const segment of resolvedSegments) {
37323
+ if (segment.length === 0) continue;
37324
+ if (resolvedMessages.length > 0) {
37325
+ resolvedMessages.push({ text: "\n\n" });
37326
+ }
37327
+ resolvedMessages.push(...segment);
37328
+ }
37077
37329
  return {
37078
37330
  parts: resolvedMessages,
37331
+ restoreMessages,
37079
37332
  accept: /* @__PURE__ */ __name(() => {
37080
37333
  for (const { message, parts, sideEffects } of resolvedForRecording) {
37081
37334
  for (const sideEffect of sideEffects) sideEffect();
37082
37335
  config.getChatRecordingService?.()?.recordMidTurnUserMessage(parts, message);
37083
37336
  addItem(
37084
- { type: "notification" /* NOTIFICATION */, text: message },
37337
+ {
37338
+ type: "user" /* USER */,
37339
+ text: message,
37340
+ // Intentionally false: preserves isRealUserTurn/rewind semantics (steer is not a standalone user turn).
37341
+ sentToModel: false
37342
+ },
37085
37343
  Date.now()
37086
37344
  );
37087
37345
  }
37088
37346
  }, "accept")
37089
37347
  };
37090
37348
  },
37091
- [addItem, applyVisionBridgeIfNeeded, config, onDebugMessage]
37349
+ [
37350
+ addItem,
37351
+ applyVisionBridgeIfNeeded,
37352
+ config,
37353
+ handleSlashCommand,
37354
+ onDebugMessage
37355
+ ]
37092
37356
  );
37093
- const resolveDrainedSteerMessages = (0, import_react134.useCallback)(
37357
+ const resolveDrainedSteerMessages = (0, import_react136.useCallback)(
37094
37358
  async (messages, signal) => {
37095
37359
  try {
37096
37360
  const resolved = await resolveSteeredMessages(messages, signal);
37097
37361
  if (signal.aborted) {
37098
- midTurnRestoreRef?.current?.(messages);
37362
+ if (resolved.restoreMessages.length > 0) {
37363
+ midTurnRestoreRef?.current?.(resolved.restoreMessages);
37364
+ }
37099
37365
  return void 0;
37100
37366
  }
37101
- if (!resolved || resolved.parts.length === 0) return void 0;
37367
+ if (resolved.parts.length === 0) return void 0;
37102
37368
  let settled = false;
37103
37369
  return {
37104
37370
  parts: resolved.parts,
@@ -37110,7 +37376,9 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
37110
37376
  restore: /* @__PURE__ */ __name(() => {
37111
37377
  if (settled) return;
37112
37378
  settled = true;
37113
- midTurnRestoreRef?.current?.(messages);
37379
+ if (resolved.restoreMessages.length > 0) {
37380
+ midTurnRestoreRef?.current?.(resolved.restoreMessages);
37381
+ }
37114
37382
  }, "restore")
37115
37383
  };
37116
37384
  } catch (error) {
@@ -37123,7 +37391,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
37123
37391
  },
37124
37392
  [midTurnRestoreRef, onDebugMessage, resolveSteeredMessages]
37125
37393
  );
37126
- const drainSteerAtBoundary = (0, import_react134.useCallback)(
37394
+ const drainSteerAtBoundary = (0, import_react136.useCallback)(
37127
37395
  async (signal) => {
37128
37396
  const messages = midTurnDrainRef?.current?.() ?? [];
37129
37397
  if (messages.length === 0) return void 0;
@@ -37131,7 +37399,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
37131
37399
  },
37132
37400
  [midTurnDrainRef, resolveDrainedSteerMessages]
37133
37401
  );
37134
- const submitQuery = (0, import_react134.useCallback)(
37402
+ const submitQuery = (0, import_react136.useCallback)(
37135
37403
  async (query, submitType = "userQuery" /* UserQuery */, prompt_id, metadata) => {
37136
37404
  const allowConcurrentBtwDuringResponse = submitType === "userQuery" /* UserQuery */ && streamingState === "responding" /* Responding */ && typeof query === "string" && isBtwCommand(query);
37137
37405
  const isTurnContinuation = submitType === "toolResult" /* ToolResult */ || submitType === "steer" /* Steer */;
@@ -37242,6 +37510,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
37242
37510
  if (!isTurnContinuation) {
37243
37511
  streamingResponseLengthRef.current = 0;
37244
37512
  }
37513
+ let cleanupReviewLease = false;
37245
37514
  try {
37246
37515
  if (dualOutput && submitType !== "toolResult" /* ToolResult */) {
37247
37516
  const rawParts = typeof finalQueryToSend === "string" ? [finalQueryToSend] : Array.isArray(finalQueryToSend) ? finalQueryToSend : [finalQueryToSend];
@@ -37268,6 +37537,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
37268
37537
  abortSignal
37269
37538
  );
37270
37539
  if (processingStatus === 1 /* UserCancelled */) {
37540
+ cleanupReviewLease = true;
37271
37541
  submitPromptOnCompleteRef.current = null;
37272
37542
  isSubmittingQueryRef.current = false;
37273
37543
  metadata?.onDeliveryFailed?.();
@@ -37280,8 +37550,33 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
37280
37550
  const immediateDuplicateToolResponses = immediateDuplicateToolResponsesRef.current;
37281
37551
  if (immediateDuplicateToolResponses) {
37282
37552
  immediateDuplicateToolResponsesRef.current = null;
37553
+ const finalized = await finalizeToolResponses(
37554
+ config,
37555
+ immediateDuplicateToolResponses.responses.map(
37556
+ ({ request, response }) => ({
37557
+ callId: request.callId,
37558
+ toolName: request.name,
37559
+ responseParts: response.responseParts,
37560
+ persistedOutputFiles: response.persistedOutputFiles
37561
+ })
37562
+ )
37563
+ );
37564
+ const responseParts = finalized.flatMap(
37565
+ (entry) => entry.responseParts
37566
+ );
37567
+ immediateDuplicateToolResponses.responses.forEach(
37568
+ ({ request, response }, index) => {
37569
+ config.getChatRecordingService?.()?.recordToolResult?.(finalized[index].responseParts, {
37570
+ callId: request.callId,
37571
+ status: response.error ? "error" : "success",
37572
+ resultDisplay: response.resultDisplay,
37573
+ error: response.error,
37574
+ errorType: response.errorType
37575
+ });
37576
+ }
37577
+ );
37283
37578
  await submitQuery(
37284
- immediateDuplicateToolResponses.responseParts,
37579
+ responseParts,
37285
37580
  "toolResult" /* ToolResult */,
37286
37581
  immediateDuplicateToolResponses.promptId
37287
37582
  );
@@ -37291,6 +37586,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
37291
37586
  }
37292
37587
  const loopDetected = loopDetectedRef.current;
37293
37588
  if (loopDetected) {
37589
+ cleanupReviewLease = true;
37294
37590
  loopDetectedRef.current = false;
37295
37591
  handleLoopDetectedEvent();
37296
37592
  }
@@ -37324,6 +37620,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
37324
37620
  }
37325
37621
  }
37326
37622
  } catch (error) {
37623
+ cleanupReviewLease = true;
37327
37624
  metadata?.onDeliveryFailed?.();
37328
37625
  if (error instanceof UnauthorizedError) {
37329
37626
  onAuthError("Session expired or is unauthorized.");
@@ -37340,6 +37637,13 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
37340
37637
  });
37341
37638
  }
37342
37639
  } finally {
37640
+ if (cleanupReviewLease) {
37641
+ cleanupReviewWorktreeLeases({
37642
+ sessionId: config.getSessionId(),
37643
+ promptId: prompt_id,
37644
+ repositoryRoot: config.getProjectRoot()
37645
+ });
37646
+ }
37343
37647
  submitPromptOnCompleteRef.current = null;
37344
37648
  activeModelStreamsRef.current = Math.max(
37345
37649
  0,
@@ -37378,7 +37682,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
37378
37682
  midTurnDrainRef
37379
37683
  ]
37380
37684
  );
37381
- const retryLastPrompt = (0, import_react134.useCallback)(async () => {
37685
+ const retryLastPrompt = (0, import_react136.useCallback)(async () => {
37382
37686
  if (skipRetryDelayRef.current) {
37383
37687
  skipRetryDelayRef.current();
37384
37688
  skipRetryDelayRef.current = null;
@@ -37402,7 +37706,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
37402
37706
  clearRetryCountdown();
37403
37707
  await submitQuery(lastPrompt, "retry" /* Retry */);
37404
37708
  }, [streamingState, addItem, clearRetryCountdown, submitQuery]);
37405
- const handleApprovalModeChange = (0, import_react134.useCallback)(
37709
+ const handleApprovalModeChange = (0, import_react136.useCallback)(
37406
37710
  async (newApprovalMode) => {
37407
37711
  if (newApprovalMode === "yolo" /* YOLO */ || newApprovalMode === "auto-edit" /* AUTO_EDIT */) {
37408
37712
  let awaitingApprovalCalls = toolCalls.filter(
@@ -37437,7 +37741,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
37437
37741
  },
37438
37742
  [toolCalls]
37439
37743
  );
37440
- const handleCompletedTools = (0, import_react134.useCallback)(
37744
+ const handleCompletedTools = (0, import_react136.useCallback)(
37441
37745
  async (completedToolCallsFromScheduler) => {
37442
37746
  const completedAndReadyToSubmitTools = completedToolCallsFromScheduler.filter(
37443
37747
  (tc) => {
@@ -37517,8 +37821,8 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
37517
37821
  }
37518
37822
  return !isReady;
37519
37823
  });
37520
- const pendingDuplicateResponseParts = readyDuplicateBatches.flatMap(
37521
- (batch) => batch.responseParts
37824
+ const pendingDuplicateResponses = readyDuplicateBatches.flatMap(
37825
+ (batch) => batch.duplicateResponses
37522
37826
  );
37523
37827
  const pendingDuplicatePromptId = readyDuplicateBatches[0]?.promptId;
37524
37828
  for (const toolCall of geminiTools) {
@@ -37527,9 +37831,67 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
37527
37831
  toolCall.request.args
37528
37832
  );
37529
37833
  }
37530
- if (geminiTools.length === 0 && pendingDuplicateResponseParts.length === 0) {
37834
+ if (geminiTools.length === 0 && pendingDuplicateResponses.length === 0) {
37531
37835
  return;
37532
37836
  }
37837
+ const executableQueues = /* @__PURE__ */ new Map();
37838
+ for (const toolCall of geminiTools) {
37839
+ const queue = executableQueues.get(toolCall.request.callId) ?? [];
37840
+ queue.push({
37841
+ request: toolCall.request,
37842
+ response: toolCall.response,
37843
+ status: toolCall.status
37844
+ });
37845
+ executableQueues.set(toolCall.request.callId, queue);
37846
+ }
37847
+ const duplicateQueues = /* @__PURE__ */ new Map();
37848
+ for (const duplicate of pendingDuplicateResponses) {
37849
+ const queue = duplicateQueues.get(duplicate.request.callId) ?? [];
37850
+ queue.push({
37851
+ ...duplicate,
37852
+ status: duplicate.response.error ? "error" : "success"
37853
+ });
37854
+ duplicateQueues.set(duplicate.request.callId, queue);
37855
+ }
37856
+ const orderedResponses = [];
37857
+ for (const batch of readyDuplicateBatches) {
37858
+ for (const callId of batch.callOrder) {
37859
+ const executable = executableQueues.get(callId)?.shift();
37860
+ if (executable) {
37861
+ orderedResponses.push(executable);
37862
+ continue;
37863
+ }
37864
+ const duplicate = duplicateQueues.get(callId)?.shift();
37865
+ if (duplicate) orderedResponses.push(duplicate);
37866
+ }
37867
+ }
37868
+ for (const queue of executableQueues.values()) {
37869
+ orderedResponses.push(...queue);
37870
+ }
37871
+ for (const queue of duplicateQueues.values()) {
37872
+ orderedResponses.push(...queue);
37873
+ }
37874
+ const finalizedResponses = await finalizeToolResponses(
37875
+ config,
37876
+ orderedResponses.map(({ request, response }) => ({
37877
+ callId: request.callId,
37878
+ toolName: request.name,
37879
+ responseParts: response.responseParts,
37880
+ persistedOutputFiles: response.persistedOutputFiles
37881
+ }))
37882
+ );
37883
+ const responsesToSend = finalizedResponses.flatMap(
37884
+ (entry) => entry.responseParts
37885
+ );
37886
+ orderedResponses.forEach(({ request, response, status }, index) => {
37887
+ config.getChatRecordingService?.()?.recordToolResult?.(finalizedResponses[index].responseParts, {
37888
+ callId: request.callId,
37889
+ status,
37890
+ resultDisplay: response.resultDisplay,
37891
+ error: response.error,
37892
+ errorType: response.errorType
37893
+ });
37894
+ });
37533
37895
  if (turnCancelledRef.current || abortControllerRef.current?.signal.aborted) {
37534
37896
  markToolsAsSubmitted(
37535
37897
  geminiTools.map((toolCall) => toolCall.request.callId)
@@ -37539,14 +37901,11 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
37539
37901
  const allToolsCancelled = geminiTools.every(
37540
37902
  (tc) => tc.status === "cancelled"
37541
37903
  );
37542
- if (allToolsCancelled && pendingDuplicateResponseParts.length === 0) {
37904
+ if (allToolsCancelled && pendingDuplicateResponses.length === 0) {
37543
37905
  if (geminiClient) {
37544
- const combinedParts = geminiTools.flatMap(
37545
- (toolCall) => toolCall.response.responseParts
37546
- );
37547
37906
  geminiClient.addHistory({
37548
37907
  role: "user",
37549
- parts: combinedParts
37908
+ parts: responsesToSend
37550
37909
  });
37551
37910
  config.getArenaAgentClient()?.reportCancelled();
37552
37911
  }
@@ -37556,10 +37915,6 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
37556
37915
  markToolsAsSubmitted(callIdsToMarkAsSubmitted2);
37557
37916
  return;
37558
37917
  }
37559
- const responsesToSend = geminiTools.flatMap(
37560
- (toolCall) => toolCall.response.responseParts
37561
- );
37562
- responsesToSend.push(...pendingDuplicateResponseParts);
37563
37918
  const callIdsToMarkAsSubmitted = geminiTools.map(
37564
37919
  (toolCall) => toolCall.request.callId
37565
37920
  );
@@ -37642,6 +37997,15 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
37642
37997
  if (modelSwitchedFromQuotaError) {
37643
37998
  return;
37644
37999
  }
38000
+ const backgroundTaskRegistry = config.getBackgroundTaskRegistry();
38001
+ const backgroundLaunchExhaustedCapacity = backgroundTaskRegistry.getMaxConcurrentBackgroundAgents() === 1 && !backgroundTaskRegistry.canStartBackgroundAgent() && geminiTools.some((toolCall) => {
38002
+ const display = toolCall.response.resultDisplay;
38003
+ return toolCall.request.name === ToolNames.AGENT && typeof display === "object" && display !== null && "type" in display && "status" in display && display.type === "task_execution" && display.status === "background";
38004
+ });
38005
+ if (backgroundLaunchExhaustedCapacity) {
38006
+ geminiClient?.addHistory({ role: "user", parts: responsesToSend });
38007
+ return;
38008
+ }
37645
38009
  const drained = turnCancelledRef.current || abortControllerRef.current?.signal.aborted ? [] : midTurnDrainRef?.current?.() ?? [];
37646
38010
  let drainedSteer;
37647
38011
  if (drained.length > 0) {
@@ -37688,7 +38052,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
37688
38052
  resolveDrainedSteerMessages
37689
38053
  ]
37690
38054
  );
37691
- const pendingHistoryItems = (0, import_react134.useMemo)(
38055
+ const pendingHistoryItems = (0, import_react136.useMemo)(
37692
38056
  () => [
37693
38057
  // Reasoning renders above the streaming answer.
37694
38058
  pendingThoughtItem,
@@ -37705,7 +38069,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
37705
38069
  pendingToolCallGroupDisplay
37706
38070
  ]
37707
38071
  );
37708
- (0, import_react134.useEffect)(() => {
38072
+ (0, import_react136.useEffect)(() => {
37709
38073
  const saveRestorableToolCalls = /* @__PURE__ */ __name(async () => {
37710
38074
  if (!config.getFileCheckpointingEnabled()) {
37711
38075
  return;
@@ -37776,14 +38140,14 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
37776
38140
  }, "saveRestorableToolCalls");
37777
38141
  saveRestorableToolCalls();
37778
38142
  }, [toolCalls, config, onDebugMessage, history, geminiClient, storage]);
37779
- const notificationQueueRef = (0, import_react134.useRef)([]);
37780
- const [notificationTrigger, setNotificationTrigger] = (0, import_react134.useState)(0);
37781
- const getAutonomousLoopTickResolver = (0, import_react134.useCallback)(() => {
38143
+ const notificationQueueRef = (0, import_react136.useRef)([]);
38144
+ const [notificationTrigger, setNotificationTrigger] = (0, import_react136.useState)(0);
38145
+ const getAutonomousLoopTickResolver = (0, import_react136.useCallback)(() => {
37782
38146
  autonomousLoopTickResolverRef.current ??= new AutonomousLoopTickResolver();
37783
38147
  return autonomousLoopTickResolverRef.current;
37784
38148
  }, []);
37785
- const notificationQueueSessionIdRef = (0, import_react134.useRef)(sessionStates.sessionId);
37786
- (0, import_react134.useEffect)(() => {
38149
+ const notificationQueueSessionIdRef = (0, import_react136.useRef)(sessionStates.sessionId);
38150
+ (0, import_react136.useEffect)(() => {
37787
38151
  if (notificationQueueSessionIdRef.current === sessionStates.sessionId) {
37788
38152
  return;
37789
38153
  }
@@ -37791,9 +38155,9 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
37791
38155
  notificationQueueRef.current = [];
37792
38156
  autonomousLoopTickResolverRef.current?.resetCache();
37793
38157
  }, [sessionStates.sessionId]);
37794
- const cronSessionIdRef = (0, import_react134.useRef)(sessionStates.sessionId);
38158
+ const cronSessionIdRef = (0, import_react136.useRef)(sessionStates.sessionId);
37795
38159
  cronSessionIdRef.current = sessionStates.sessionId;
37796
- (0, import_react134.useEffect)(() => {
38160
+ (0, import_react136.useEffect)(() => {
37797
38161
  if (!isConfigInitialized) return;
37798
38162
  if (!config.isCronEnabled()) return;
37799
38163
  const scheduler = config.getCronScheduler();
@@ -37846,7 +38210,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
37846
38210
  }
37847
38211
  };
37848
38212
  }, [config, getAutonomousLoopTickResolver, isConfigInitialized]);
37849
- (0, import_react134.useEffect)(() => {
38213
+ (0, import_react136.useEffect)(() => {
37850
38214
  const registry = config.getBackgroundTaskRegistry();
37851
38215
  registry.setNotificationCallback((displayText, modelText) => {
37852
38216
  notificationQueueRef.current.push({
@@ -37860,7 +38224,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
37860
38224
  registry.setNotificationCallback(void 0);
37861
38225
  };
37862
38226
  }, [config]);
37863
- (0, import_react134.useEffect)(() => {
38227
+ (0, import_react136.useEffect)(() => {
37864
38228
  const registry = config.getBackgroundShellRegistry();
37865
38229
  registry.setNotificationCallback((displayText, modelText) => {
37866
38230
  notificationQueueRef.current.push({
@@ -37874,7 +38238,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
37874
38238
  registry.setNotificationCallback(void 0);
37875
38239
  };
37876
38240
  }, [config]);
37877
- (0, import_react134.useEffect)(() => {
38241
+ (0, import_react136.useEffect)(() => {
37878
38242
  const registry = config.getMonitorRegistry();
37879
38243
  registry.setNotificationCallback((displayText, modelText, meta) => {
37880
38244
  if (meta.status === "running" && typeof registry.get === "function") {
@@ -37884,7 +38248,8 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
37884
38248
  notificationQueueRef.current.push({
37885
38249
  displayText,
37886
38250
  modelText,
37887
- sendMessageType: "notification" /* Notification */
38251
+ sendMessageType: "notification" /* Notification */,
38252
+ monitor: { id: meta.monitorId, status: meta.status }
37888
38253
  });
37889
38254
  setNotificationTrigger((n) => n + 1);
37890
38255
  });
@@ -37892,42 +38257,57 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
37892
38257
  registry.setNotificationCallback(void 0);
37893
38258
  };
37894
38259
  }, [config]);
37895
- (0, import_react134.useEffect)(() => {
38260
+ (0, import_react136.useEffect)(() => {
37896
38261
  if (streamingState === "idle" /* Idle */ && !isSubmittingQueryRef.current && notificationQueueRef.current.length > 0) {
37897
- const queue = notificationQueueRef.current;
37898
- const targetType = queue[0].sendMessageType;
37899
- if (targetType === "cron" /* Cron */) {
37900
- const item = queue.shift();
37901
- addItem(
37902
- { type: "notification", text: item.displayText },
37903
- Date.now()
37904
- );
37905
- submitQuery(item.modelText, item.sendMessageType, void 0, {
37906
- notificationDisplayText: item.displayText,
37907
- onDelivered: item.onDelivered,
37908
- onDeliveryFailed: item.onDeliveryFailed
38262
+ runOutsideAgentContext(() => {
38263
+ const queue = notificationQueueRef.current;
38264
+ const monitorRegistry = config.getMonitorRegistry();
38265
+ for (let i = queue.length - 1; i >= 0; i--) {
38266
+ const monitor = queue[i].monitor;
38267
+ if (monitor?.status === "running" && monitorRegistry.get(monitor.id)?.status === "cancelled") {
38268
+ queue.splice(i, 1);
38269
+ }
38270
+ }
38271
+ if (queue.length === 0) {
38272
+ return;
38273
+ }
38274
+ const targetType = queue[0].sendMessageType;
38275
+ if (targetType === "cron" /* Cron */) {
38276
+ const item = queue.shift();
38277
+ addItem(
38278
+ { type: "notification", text: item.displayText },
38279
+ Date.now()
38280
+ );
38281
+ submitQuery(item.modelText, item.sendMessageType, void 0, {
38282
+ notificationDisplayText: item.displayText,
38283
+ onDelivered: item.onDelivered,
38284
+ onDeliveryFailed: item.onDeliveryFailed
38285
+ });
38286
+ return;
38287
+ }
38288
+ let splitIdx = 0;
38289
+ while (splitIdx < queue.length && queue[splitIdx].sendMessageType === targetType) {
38290
+ splitIdx++;
38291
+ }
38292
+ const batch = queue.splice(0, splitIdx);
38293
+ const now = Date.now();
38294
+ for (const item of batch) {
38295
+ addItem(
38296
+ { type: "notification", text: item.displayText },
38297
+ now
38298
+ );
38299
+ }
38300
+ const combinedModelText = batch.map((e) => e.modelText).join("\n\n");
38301
+ const combinedDisplayText = batch.map((e) => e.displayText).join("; ");
38302
+ submitQuery(combinedModelText, targetType, void 0, {
38303
+ notificationDisplayText: combinedDisplayText
37909
38304
  });
37910
- return;
37911
- }
37912
- let splitIdx = 0;
37913
- while (splitIdx < queue.length && queue[splitIdx].sendMessageType === targetType) {
37914
- splitIdx++;
37915
- }
37916
- const batch = queue.splice(0, splitIdx);
37917
- const now = Date.now();
37918
- for (const item of batch) {
37919
- addItem({ type: "notification", text: item.displayText }, now);
37920
- }
37921
- const combinedModelText = batch.map((e) => e.modelText).join("\n\n");
37922
- const combinedDisplayText = batch.map((e) => e.displayText).join("; ");
37923
- submitQuery(combinedModelText, targetType, void 0, {
37924
- notificationDisplayText: combinedDisplayText
37925
38305
  });
37926
38306
  }
37927
- }, [streamingState, submitQuery, notificationTrigger, addItem]);
37928
- const teammateQueueRef = (0, import_react134.useRef)([]);
37929
- const [teammateTrigger, setTeammateTrigger] = (0, import_react134.useState)(0);
37930
- (0, import_react134.useEffect)(() => {
38307
+ }, [streamingState, submitQuery, notificationTrigger, addItem, config]);
38308
+ const teammateQueueRef = (0, import_react136.useRef)([]);
38309
+ const [teammateTrigger, setTeammateTrigger] = (0, import_react136.useState)(0);
38310
+ (0, import_react136.useEffect)(() => {
37931
38311
  let boundManager = null;
37932
38312
  const handleManagerChange = /* @__PURE__ */ __name((manager) => {
37933
38313
  if (boundManager && boundManager !== manager) {
@@ -37957,19 +38337,21 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
37957
38337
  }
37958
38338
  };
37959
38339
  }, [config]);
37960
- (0, import_react134.useEffect)(() => {
38340
+ (0, import_react136.useEffect)(() => {
37961
38341
  if (streamingState === "idle" /* Idle */ && !isSubmittingQueryRef.current && teammateQueueRef.current.length > 0) {
37962
- const batch = teammateQueueRef.current.splice(0);
37963
- for (const entry of batch) {
37964
- addItem(
37965
- { type: "notification", text: entry.display },
37966
- Date.now()
37967
- );
37968
- }
37969
- const modelText = batch.map((e) => e.modelText).join("\n\n");
37970
- const display = batch.map((e) => e.display).join("; ");
37971
- submitQuery(modelText, "teammate" /* Teammate */, void 0, {
37972
- notificationDisplayText: display
38342
+ runOutsideAgentContext(() => {
38343
+ const batch = teammateQueueRef.current.splice(0);
38344
+ for (const entry of batch) {
38345
+ addItem(
38346
+ { type: "notification", text: entry.display },
38347
+ Date.now()
38348
+ );
38349
+ }
38350
+ const modelText = batch.map((e) => e.modelText).join("\n\n");
38351
+ const display = batch.map((e) => e.display).join("; ");
38352
+ submitQuery(modelText, "teammate" /* Teammate */, void 0, {
38353
+ notificationDisplayText: display
38354
+ });
37973
38355
  });
37974
38356
  }
37975
38357
  }, [streamingState, submitQuery, teammateTrigger, addItem]);
@@ -37992,7 +38374,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
37992
38374
 
37993
38375
  // packages/cli/src/ui/hooks/vim.ts
37994
38376
  init_esbuild_shims();
37995
- var import_react135 = __toESM(require_react(), 1);
38377
+ var import_react137 = __toESM(require_react(), 1);
37996
38378
  import { execFile as execFile7, execFileSync as execFileSync2 } from "child_process";
37997
38379
  var DIGIT_MULTIPLIER = 10;
37998
38380
  var DEFAULT_COUNT = 1;
@@ -38228,26 +38610,26 @@ __name(findCharInLineReverse, "findCharInLineReverse");
38228
38610
  function useVim(buffer, onSubmit) {
38229
38611
  const { vimEnabled, vimMode } = useVimModeState();
38230
38612
  const { setVimMode } = useVimModeActions();
38231
- const [state, dispatch] = (0, import_react135.useReducer)(vimReducer, initialVimState);
38232
- const bufferRef = (0, import_react135.useRef)(buffer);
38233
- const stateRef = (0, import_react135.useRef)(state);
38613
+ const [state, dispatch] = (0, import_react137.useReducer)(vimReducer, initialVimState);
38614
+ const bufferRef = (0, import_react137.useRef)(buffer);
38615
+ const stateRef = (0, import_react137.useRef)(state);
38234
38616
  bufferRef.current = buffer;
38235
38617
  stateRef.current = state;
38236
- (0, import_react135.useEffect)(() => {
38618
+ (0, import_react137.useEffect)(() => {
38237
38619
  dispatch({ type: "SET_MODE", mode: vimMode });
38238
38620
  }, [vimMode]);
38239
- const updateMode = (0, import_react135.useCallback)(
38621
+ const updateMode = (0, import_react137.useCallback)(
38240
38622
  (mode) => {
38241
38623
  setVimMode(mode);
38242
38624
  dispatch({ type: "SET_MODE", mode });
38243
38625
  },
38244
38626
  [setVimMode]
38245
38627
  );
38246
- const getCurrentCount = (0, import_react135.useCallback)(
38628
+ const getCurrentCount = (0, import_react137.useCallback)(
38247
38629
  () => stateRef.current.count || DEFAULT_COUNT,
38248
38630
  []
38249
38631
  );
38250
- const yankRange = (0, import_react135.useCallback)(
38632
+ const yankRange = (0, import_react137.useCallback)(
38251
38633
  (startRow, startCol, endRow, endCol, linewise) => {
38252
38634
  const lines = bufferRef.current.lines;
38253
38635
  let text = "";
@@ -38262,7 +38644,7 @@ function useVim(buffer, onSubmit) {
38262
38644
  },
38263
38645
  []
38264
38646
  );
38265
- const executeCommand = (0, import_react135.useCallback)(
38647
+ const executeCommand = (0, import_react137.useCallback)(
38266
38648
  (cmdType, count) => {
38267
38649
  switch (cmdType) {
38268
38650
  case CMD_TYPES.DELETE_WORD_FORWARD:
@@ -38663,7 +39045,7 @@ function useVim(buffer, onSubmit) {
38663
39045
  return { text, linewise: movement === "j" || movement === "k" };
38664
39046
  }
38665
39047
  __name(extractMovementText, "extractMovementText");
38666
- const executeFind = (0, import_react135.useCallback)(
39048
+ const executeFind = (0, import_react137.useCallback)(
38667
39049
  (findType, char, count = 1) => {
38668
39050
  const [startRow, startCol] = buffer.cursor;
38669
39051
  const line = buffer.lines[startRow] ?? "";
@@ -38699,7 +39081,7 @@ function useVim(buffer, onSubmit) {
38699
39081
  },
38700
39082
  [buffer, dispatch]
38701
39083
  );
38702
- const handleCharRead = (0, import_react135.useCallback)(
39084
+ const handleCharRead = (0, import_react137.useCallback)(
38703
39085
  (char) => {
38704
39086
  const readType = state.pendingCharRead;
38705
39087
  if (!readType) return false;
@@ -38742,7 +39124,7 @@ function useVim(buffer, onSubmit) {
38742
39124
  },
38743
39125
  [state.pendingCharRead, buffer, dispatch, executeFind]
38744
39126
  );
38745
- const handleInsertModeInput = (0, import_react135.useCallback)(
39127
+ const handleInsertModeInput = (0, import_react137.useCallback)(
38746
39128
  (normalizedKey) => {
38747
39129
  if (normalizedKey.name === "escape") {
38748
39130
  buffer.vimEscapeInsertMode();
@@ -38773,7 +39155,7 @@ function useVim(buffer, onSubmit) {
38773
39155
  },
38774
39156
  [buffer, dispatch, updateMode, onSubmit]
38775
39157
  );
38776
- const normalizeKey = (0, import_react135.useCallback)(
39158
+ const normalizeKey = (0, import_react137.useCallback)(
38777
39159
  (key) => ({
38778
39160
  name: key.name || "",
38779
39161
  sequence: key.sequence || "",
@@ -38784,7 +39166,7 @@ function useVim(buffer, onSubmit) {
38784
39166
  }),
38785
39167
  []
38786
39168
  );
38787
- const handleChangeMovement = (0, import_react135.useCallback)(
39169
+ const handleChangeMovement = (0, import_react137.useCallback)(
38788
39170
  (movement) => {
38789
39171
  const count = getCurrentCount();
38790
39172
  dispatch({ type: "CLEAR_COUNT" });
@@ -38805,7 +39187,7 @@ function useVim(buffer, onSubmit) {
38805
39187
  },
38806
39188
  [getCurrentCount, dispatch, buffer, updateMode]
38807
39189
  );
38808
- const handleDeleteMovement = (0, import_react135.useCallback)(
39190
+ const handleDeleteMovement = (0, import_react137.useCallback)(
38809
39191
  (movement) => {
38810
39192
  const count = getCurrentCount();
38811
39193
  const [row, col] = bufferRef.current.cursor;
@@ -38840,7 +39222,7 @@ function useVim(buffer, onSubmit) {
38840
39222
  },
38841
39223
  [getCurrentCount, dispatch, buffer]
38842
39224
  );
38843
- const handleYankMovement = (0, import_react135.useCallback)(
39225
+ const handleYankMovement = (0, import_react137.useCallback)(
38844
39226
  (movement) => {
38845
39227
  const count = getCurrentCount();
38846
39228
  const [row, col] = bufferRef.current.cursor;
@@ -38874,7 +39256,7 @@ function useVim(buffer, onSubmit) {
38874
39256
  },
38875
39257
  [getCurrentCount, dispatch]
38876
39258
  );
38877
- const handleOperatorMotion = (0, import_react135.useCallback)(
39259
+ const handleOperatorMotion = (0, import_react137.useCallback)(
38878
39260
  (operator, motion) => {
38879
39261
  const count = getCurrentCount();
38880
39262
  const commandMap = {
@@ -38906,7 +39288,7 @@ function useVim(buffer, onSubmit) {
38906
39288
  },
38907
39289
  [getCurrentCount, executeCommand, dispatch]
38908
39290
  );
38909
- const handleInput = (0, import_react135.useCallback)(
39291
+ const handleInput = (0, import_react137.useCallback)(
38910
39292
  (key) => {
38911
39293
  if (!vimEnabled) {
38912
39294
  return false;
@@ -39628,7 +40010,7 @@ __name(buildWorkflowSteeringNotice, "buildWorkflowSteeringNotice");
39628
40010
 
39629
40011
  // packages/cli/src/ui/hooks/useAwaySummary.ts
39630
40012
  init_esbuild_shims();
39631
- var import_react136 = __toESM(require_react(), 1);
40013
+ var import_react138 = __toESM(require_react(), 1);
39632
40014
  var DEFAULT_AWAY_THRESHOLD_MINUTES = 5;
39633
40015
  var MIN_USER_MESSAGES_TO_FIRE = 3;
39634
40016
  var MIN_USER_MESSAGES_SINCE_LAST_RECAP = 2;
@@ -39637,14 +40019,15 @@ function shouldFireRecap(history) {
39637
40019
  let lastRecapIndex = -1;
39638
40020
  for (let i = 0; i < history.length; i++) {
39639
40021
  const item = history[i];
39640
- if (item.type === "user") userMessageCount++;
40022
+ if (item.type === "user" && item.sentToModel !== false) userMessageCount++;
39641
40023
  if (item.type === "away_recap") lastRecapIndex = i;
39642
40024
  }
39643
40025
  if (userMessageCount < MIN_USER_MESSAGES_TO_FIRE) return false;
39644
40026
  if (lastRecapIndex === -1) return true;
39645
40027
  let userSinceLast = 0;
39646
40028
  for (let i = lastRecapIndex + 1; i < history.length; i++) {
39647
- if (history[i].type === "user") userSinceLast++;
40029
+ const item = history[i];
40030
+ if (item.type === "user" && item.sentToModel !== false) userSinceLast++;
39648
40031
  }
39649
40032
  return userSinceLast >= MIN_USER_MESSAGES_SINCE_LAST_RECAP;
39650
40033
  }
@@ -39659,15 +40042,15 @@ function useAwaySummary(options) {
39659
40042
  history,
39660
40043
  awayThresholdMinutes
39661
40044
  } = options;
39662
- const blurredAtRef = (0, import_react136.useRef)(null);
39663
- const recapPendingRef = (0, import_react136.useRef)(false);
39664
- const inFlightRef = (0, import_react136.useRef)(null);
39665
- const isIdleRef = (0, import_react136.useRef)(isIdle);
40045
+ const blurredAtRef = (0, import_react138.useRef)(null);
40046
+ const recapPendingRef = (0, import_react138.useRef)(false);
40047
+ const inFlightRef = (0, import_react138.useRef)(null);
40048
+ const isIdleRef = (0, import_react138.useRef)(isIdle);
39666
40049
  isIdleRef.current = isIdle;
39667
- const historyRef = (0, import_react136.useRef)(history);
40050
+ const historyRef = (0, import_react138.useRef)(history);
39668
40051
  historyRef.current = history;
39669
40052
  const thresholdMs = (awayThresholdMinutes && awayThresholdMinutes > 0 ? awayThresholdMinutes : DEFAULT_AWAY_THRESHOLD_MINUTES) * 60 * 1e3;
39670
- (0, import_react136.useEffect)(() => {
40053
+ (0, import_react138.useEffect)(() => {
39671
40054
  if (!enabled || !config) {
39672
40055
  inFlightRef.current?.abort();
39673
40056
  inFlightRef.current = null;
@@ -39719,7 +40102,7 @@ function useAwaySummary(options) {
39719
40102
  recapPendingRef.current = false;
39720
40103
  });
39721
40104
  }, [enabled, config, isFocused, isIdle, addItem, thresholdMs]);
39722
- (0, import_react136.useEffect)(
40105
+ (0, import_react138.useEffect)(
39723
40106
  () => () => {
39724
40107
  inFlightRef.current?.abort();
39725
40108
  },
@@ -39730,14 +40113,14 @@ __name(useAwaySummary, "useAwaySummary");
39730
40113
 
39731
40114
  // packages/cli/src/ui/hooks/useBracketedPaste.ts
39732
40115
  init_esbuild_shims();
39733
- var import_react137 = __toESM(require_react(), 1);
40116
+ var import_react139 = __toESM(require_react(), 1);
39734
40117
  var ENABLE_BRACKETED_PASTE = "\x1B[?2004h";
39735
40118
  var DISABLE_BRACKETED_PASTE = "\x1B[?2004l";
39736
40119
  var useBracketedPaste = /* @__PURE__ */ __name(() => {
39737
40120
  const cleanup = /* @__PURE__ */ __name(() => {
39738
40121
  process.stdout.write(DISABLE_BRACKETED_PASTE);
39739
40122
  }, "cleanup");
39740
- (0, import_react137.useEffect)(() => {
40123
+ (0, import_react139.useEffect)(() => {
39741
40124
  process.stdout.write(ENABLE_BRACKETED_PASTE);
39742
40125
  process.on("exit", cleanup);
39743
40126
  process.on("SIGINT", cleanup);
@@ -39756,23 +40139,23 @@ init_esbuild_shims();
39756
40139
 
39757
40140
  // packages/cli/src/ui/hooks/usePhraseCycler.ts
39758
40141
  init_esbuild_shims();
39759
- var import_react138 = __toESM(require_react(), 1);
40142
+ var import_react140 = __toESM(require_react(), 1);
39760
40143
  var WITTY_LOADING_PHRASES = ["I'm Feeling Lucky"];
39761
40144
  var PHRASE_CHANGE_INTERVAL_MS = 15e3;
39762
40145
  var usePhraseCycler = /* @__PURE__ */ __name((isActive, isWaiting, customPhrases) => {
39763
40146
  const currentLanguage = getCurrentLanguage();
39764
- const loadingPhrases = (0, import_react138.useMemo)(() => {
40147
+ const loadingPhrases = (0, import_react140.useMemo)(() => {
39765
40148
  if (customPhrases && customPhrases.length > 0) {
39766
40149
  return customPhrases;
39767
40150
  }
39768
40151
  const translatedPhrases = ta("WITTY_LOADING_PHRASES");
39769
40152
  return translatedPhrases.length > 0 ? translatedPhrases : WITTY_LOADING_PHRASES;
39770
40153
  }, [customPhrases, currentLanguage]);
39771
- const [currentLoadingPhrase, setCurrentLoadingPhrase] = (0, import_react138.useState)(
40154
+ const [currentLoadingPhrase, setCurrentLoadingPhrase] = (0, import_react140.useState)(
39772
40155
  loadingPhrases[0]
39773
40156
  );
39774
- const phraseIntervalRef = (0, import_react138.useRef)(null);
39775
- (0, import_react138.useEffect)(() => {
40157
+ const phraseIntervalRef = (0, import_react140.useRef)(null);
40158
+ (0, import_react140.useEffect)(() => {
39776
40159
  if (isWaiting) {
39777
40160
  setCurrentLoadingPhrase(t("Waiting for user confirmation..."));
39778
40161
  if (phraseIntervalRef.current) {
@@ -39809,9 +40192,9 @@ var usePhraseCycler = /* @__PURE__ */ __name((isActive, isWaiting, customPhrases
39809
40192
  }, "usePhraseCycler");
39810
40193
 
39811
40194
  // packages/cli/src/ui/hooks/useLoadingIndicator.ts
39812
- var import_react139 = __toESM(require_react(), 1);
40195
+ var import_react141 = __toESM(require_react(), 1);
39813
40196
  var useLoadingIndicator = /* @__PURE__ */ __name((streamingState, customWittyPhrases, currentCandidatesTokens, currentStreamingChars, isToolExecuting2 = false) => {
39814
- const [timerResetKey, setTimerResetKey] = (0, import_react139.useState)(0);
40197
+ const [timerResetKey, setTimerResetKey] = (0, import_react141.useState)(0);
39815
40198
  const isTimerActive = streamingState === "responding" /* Responding */;
39816
40199
  const elapsedTimeFromTimer = useTimer(
39817
40200
  isTimerActive,
@@ -39825,17 +40208,17 @@ var useLoadingIndicator = /* @__PURE__ */ __name((streamingState, customWittyPhr
39825
40208
  isWaiting,
39826
40209
  customWittyPhrases
39827
40210
  );
39828
- const [retainedElapsedTime, setRetainedElapsedTime] = (0, import_react139.useState)(0);
39829
- const [taskStartTokens, setTaskStartTokensState] = (0, import_react139.useState)(0);
39830
- const [taskStartStreamingChars, setTaskStartStreamingCharsState] = (0, import_react139.useState)(0);
39831
- const taskStartTokensRef = (0, import_react139.useRef)(0);
39832
- const taskStartStreamingCharsRef = (0, import_react139.useRef)(0);
39833
- const pauseStartTokensRef = (0, import_react139.useRef)(null);
39834
- const pauseStartStreamingCharsRef = (0, import_react139.useRef)(null);
39835
- const pauseBaseTaskStartTokensRef = (0, import_react139.useRef)(0);
39836
- const pauseBaseTaskStartStreamingCharsRef = (0, import_react139.useRef)(0);
39837
- const prevStreamingStateRef = (0, import_react139.useRef)(null);
39838
- (0, import_react139.useEffect)(() => {
40211
+ const [retainedElapsedTime, setRetainedElapsedTime] = (0, import_react141.useState)(0);
40212
+ const [taskStartTokens, setTaskStartTokensState] = (0, import_react141.useState)(0);
40213
+ const [taskStartStreamingChars, setTaskStartStreamingCharsState] = (0, import_react141.useState)(0);
40214
+ const taskStartTokensRef = (0, import_react141.useRef)(0);
40215
+ const taskStartStreamingCharsRef = (0, import_react141.useRef)(0);
40216
+ const pauseStartTokensRef = (0, import_react141.useRef)(null);
40217
+ const pauseStartStreamingCharsRef = (0, import_react141.useRef)(null);
40218
+ const pauseBaseTaskStartTokensRef = (0, import_react141.useRef)(0);
40219
+ const pauseBaseTaskStartStreamingCharsRef = (0, import_react141.useRef)(0);
40220
+ const prevStreamingStateRef = (0, import_react141.useRef)(null);
40221
+ (0, import_react141.useEffect)(() => {
39839
40222
  const currentTokens = currentCandidatesTokens ?? 0;
39840
40223
  const currentChars = currentStreamingChars ?? 0;
39841
40224
  const setTaskStartTokens = /* @__PURE__ */ __name((tokens) => {
@@ -39906,7 +40289,7 @@ var useLoadingIndicator = /* @__PURE__ */ __name((streamingState, customWittyPhr
39906
40289
 
39907
40290
  // packages/cli/src/ui/hooks/useTerminalProgress.ts
39908
40291
  init_esbuild_shims();
39909
- var import_react140 = __toESM(require_react(), 1);
40292
+ var import_react142 = __toESM(require_react(), 1);
39910
40293
  var PROGRESS_CLEAR = wrapForMultiplexer(`${OSC_PREFIX}9;4;0;${BEL}`);
39911
40294
  var PROGRESS_INDETERMINATE = wrapForMultiplexer(`${OSC_PREFIX}9;4;3;;${BEL}`);
39912
40295
  function isProgressBarSupported() {
@@ -39921,13 +40304,13 @@ function isProgressBarSupported() {
39921
40304
  __name(isProgressBarSupported, "isProgressBarSupported");
39922
40305
  function useTerminalProgress(streamingState, hasToolExecuting) {
39923
40306
  const { stdout } = use_stdout_default();
39924
- const writeProgress = (0, import_react140.useCallback)(
40307
+ const writeProgress = (0, import_react142.useCallback)(
39925
40308
  (seq) => {
39926
40309
  stdout?.write(seq);
39927
40310
  },
39928
40311
  [stdout]
39929
40312
  );
39930
- (0, import_react140.useEffect)(() => {
40313
+ (0, import_react142.useEffect)(() => {
39931
40314
  if (!isProgressBarSupported()) return;
39932
40315
  if (streamingState === "responding" /* Responding */ && hasToolExecuting) {
39933
40316
  writeProgress(PROGRESS_INDETERMINATE);
@@ -39938,7 +40321,7 @@ function useTerminalProgress(streamingState, hasToolExecuting) {
39938
40321
  writeProgress(PROGRESS_CLEAR);
39939
40322
  };
39940
40323
  }, [streamingState, hasToolExecuting, writeProgress]);
39941
- (0, import_react140.useEffect)(() => {
40324
+ (0, import_react142.useEffect)(() => {
39942
40325
  if (!isProgressBarSupported()) return;
39943
40326
  const clearOnExit = /* @__PURE__ */ __name(() => {
39944
40327
  stdout?.write(PROGRESS_CLEAR);
@@ -39953,20 +40336,20 @@ __name(useTerminalProgress, "useTerminalProgress");
39953
40336
 
39954
40337
  // packages/cli/src/ui/hooks/useFolderTrust.ts
39955
40338
  init_esbuild_shims();
39956
- var import_react141 = __toESM(require_react(), 1);
40339
+ var import_react143 = __toESM(require_react(), 1);
39957
40340
  import * as process15 from "node:process";
39958
40341
  var useFolderTrust = /* @__PURE__ */ __name((settings, onTrustChange) => {
39959
- const [isTrusted, setIsTrusted] = (0, import_react141.useState)(void 0);
39960
- const [isFolderTrustDialogOpen, setIsFolderTrustDialogOpen] = (0, import_react141.useState)(false);
39961
- const [isRestarting, setIsRestarting] = (0, import_react141.useState)(false);
40342
+ const [isTrusted, setIsTrusted] = (0, import_react143.useState)(void 0);
40343
+ const [isFolderTrustDialogOpen, setIsFolderTrustDialogOpen] = (0, import_react143.useState)(false);
40344
+ const [isRestarting, setIsRestarting] = (0, import_react143.useState)(false);
39962
40345
  const folderTrust = settings.merged.security?.folderTrust?.enabled;
39963
- (0, import_react141.useEffect)(() => {
40346
+ (0, import_react143.useEffect)(() => {
39964
40347
  const { isTrusted: trusted } = isWorkspaceTrusted(settings.merged);
39965
40348
  setIsTrusted(trusted);
39966
40349
  setIsFolderTrustDialogOpen(trusted === void 0);
39967
40350
  onTrustChange(trusted);
39968
40351
  }, [folderTrust, onTrustChange, settings.merged]);
39969
- const handleFolderTrustSelect = (0, import_react141.useCallback)(
40352
+ const handleFolderTrustSelect = (0, import_react143.useCallback)(
39970
40353
  (choice) => {
39971
40354
  const trustedFolders = loadTrustedFolders();
39972
40355
  const cwd3 = process15.cwd();
@@ -40009,7 +40392,7 @@ var useFolderTrust = /* @__PURE__ */ __name((settings, onTrustChange) => {
40009
40392
 
40010
40393
  // packages/cli/src/ui/hooks/useMcpApproval.ts
40011
40394
  init_esbuild_shims();
40012
- var import_react142 = __toESM(require_react(), 1);
40395
+ var import_react144 = __toESM(require_react(), 1);
40013
40396
  function sourceLabel(scope) {
40014
40397
  switch (scope) {
40015
40398
  case "workspace":
@@ -40045,8 +40428,8 @@ function summarize(config) {
40045
40428
  }
40046
40429
  __name(summarize, "summarize");
40047
40430
  var useMcpApproval = /* @__PURE__ */ __name((config) => {
40048
- const [queue, setQueue] = (0, import_react142.useState)([]);
40049
- const computePending = (0, import_react142.useCallback)(() => {
40431
+ const [queue, setQueue] = (0, import_react144.useState)([]);
40432
+ const computePending = (0, import_react144.useCallback)(() => {
40050
40433
  if (config.getApprovalMode() === "yolo" /* YOLO */) return [];
40051
40434
  const servers = config.getMcpServers() ?? {};
40052
40435
  const approvals = loadMcpApprovals();
@@ -40058,10 +40441,10 @@ var useMcpApproval = /* @__PURE__ */ __name((config) => {
40058
40441
  source: sourceLabel(c.scope)
40059
40442
  }));
40060
40443
  }, [config]);
40061
- (0, import_react142.useEffect)(() => {
40444
+ (0, import_react144.useEffect)(() => {
40062
40445
  setQueue(computePending());
40063
40446
  }, [computePending]);
40064
- (0, import_react142.useEffect)(() => {
40447
+ (0, import_react144.useEffect)(() => {
40065
40448
  const onPendingChanged = /* @__PURE__ */ __name(() => {
40066
40449
  setQueue(computePending());
40067
40450
  }, "onPendingChanged");
@@ -40070,7 +40453,7 @@ var useMcpApproval = /* @__PURE__ */ __name((config) => {
40070
40453
  appEvents.off("mcp-pending-approval-changed" /* McpPendingApprovalChanged */, onPendingChanged);
40071
40454
  };
40072
40455
  }, [computePending]);
40073
- const reconnect = (0, import_react142.useCallback)(
40456
+ const reconnect = (0, import_react144.useCallback)(
40074
40457
  (name) => {
40075
40458
  config.approveMcpServerForSession(name);
40076
40459
  const registry = config.getToolRegistry();
@@ -40082,7 +40465,7 @@ var useMcpApproval = /* @__PURE__ */ __name((config) => {
40082
40465
  },
40083
40466
  [config]
40084
40467
  );
40085
- const handleMcpApprovalSelect = (0, import_react142.useCallback)(
40468
+ const handleMcpApprovalSelect = (0, import_react144.useCallback)(
40086
40469
  async (choice) => {
40087
40470
  const approvals = loadMcpApprovals();
40088
40471
  const root = config.getWorkingDir();
@@ -40134,7 +40517,7 @@ var useMcpApproval = /* @__PURE__ */ __name((config) => {
40134
40517
 
40135
40518
  // packages/cli/src/ui/hooks/useCommandMigration.ts
40136
40519
  init_esbuild_shims();
40137
- var import_react143 = __toESM(require_react(), 1);
40520
+ var import_react145 = __toESM(require_react(), 1);
40138
40521
 
40139
40522
  // packages/cli/src/services/command-migration-tool.ts
40140
40523
  init_esbuild_shims();
@@ -40205,9 +40588,9 @@ __name(migrateTomlCommands, "migrateTomlCommands");
40205
40588
 
40206
40589
  // packages/cli/src/ui/hooks/useCommandMigration.ts
40207
40590
  function useCommandMigration(settings, storage) {
40208
- const [showMigrationNudge, setShowMigrationNudge] = (0, import_react143.useState)(false);
40209
- const [tomlFiles, setTomlFiles] = (0, import_react143.useState)([]);
40210
- (0, import_react143.useEffect)(() => {
40591
+ const [showMigrationNudge, setShowMigrationNudge] = (0, import_react145.useState)(false);
40592
+ const [tomlFiles, setTomlFiles] = (0, import_react145.useState)([]);
40593
+ (0, import_react145.useEffect)(() => {
40211
40594
  let cancelled = false;
40212
40595
  const checkTomlCommands = /* @__PURE__ */ __name(async () => {
40213
40596
  const allFiles = [];
@@ -40273,81 +40656,12 @@ function sendNotification(opts, terminal, enabled) {
40273
40656
  }
40274
40657
  __name(sendNotification, "sendNotification");
40275
40658
 
40276
- // packages/cli/src/ui/hooks/useMessageQueue.ts
40277
- init_esbuild_shims();
40278
- var import_react144 = __toESM(require_react(), 1);
40279
- function useMessageQueue() {
40280
- const [queuedMessages, setQueuedMessages] = (0, import_react144.useState)([]);
40281
- const queueRef = (0, import_react144.useRef)([]);
40282
- const addMessage = (0, import_react144.useCallback)((message, deferUntilIdle = false) => {
40283
- const trimmedMessage = message.trim();
40284
- if (trimmedMessage.length > 0) {
40285
- queueRef.current = [
40286
- ...queueRef.current,
40287
- { text: trimmedMessage, deferUntilIdle }
40288
- ];
40289
- setQueuedMessages(queueRef.current);
40290
- }
40291
- }, []);
40292
- const clearQueue = (0, import_react144.useCallback)(() => {
40293
- queueRef.current = [];
40294
- setQueuedMessages([]);
40295
- }, []);
40296
- const getQueuedMessagesText = (0, import_react144.useCallback)(() => {
40297
- if (queuedMessages.length === 0) return "";
40298
- return queuedMessages.map(({ text }) => text).join("\n\n");
40299
- }, [queuedMessages]);
40300
- const popAllMessages = (0, import_react144.useCallback)(() => {
40301
- const current = queueRef.current;
40302
- if (current.length === 0) return null;
40303
- queueRef.current = [];
40304
- setQueuedMessages([]);
40305
- return current.map(({ text }) => text).join("\n\n");
40306
- }, []);
40307
- const restoreMessages = (0, import_react144.useCallback)((messages) => {
40308
- const restored = messages.map((text) => text.trim()).filter(Boolean).map((text) => ({ text, deferUntilIdle: false }));
40309
- if (restored.length === 0) return;
40310
- queueRef.current = [...restored, ...queueRef.current];
40311
- setQueuedMessages(queueRef.current);
40312
- }, []);
40313
- const drainQueue = (0, import_react144.useCallback)((includeDeferred = false) => {
40314
- const current = queueRef.current;
40315
- if (current.length === 0) return [];
40316
- const shouldDrain = /* @__PURE__ */ __name((message) => !isSlashCommand(message.text) && (includeDeferred || !message.deferUntilIdle), "shouldDrain");
40317
- const drained = current.filter(shouldDrain);
40318
- if (drained.length === 0) return [];
40319
- const rest = current.filter((message) => !shouldDrain(message));
40320
- queueRef.current = rest;
40321
- setQueuedMessages(rest);
40322
- return drained.map(({ text }) => text);
40323
- }, []);
40324
- const popNextSegment = (0, import_react144.useCallback)(() => {
40325
- const current = queueRef.current;
40326
- if (current.length === 0) return null;
40327
- const [head, ...rest] = current;
40328
- queueRef.current = rest;
40329
- setQueuedMessages(rest);
40330
- return head.text;
40331
- }, []);
40332
- return {
40333
- messageQueue: queuedMessages.map(({ text }) => text),
40334
- addMessage,
40335
- clearQueue,
40336
- getQueuedMessagesText,
40337
- popAllMessages,
40338
- restoreMessages,
40339
- drainQueue,
40340
- popNextSegment
40341
- };
40342
- }
40343
- __name(useMessageQueue, "useMessageQueue");
40344
-
40345
40659
  // packages/cli/src/ui/hooks/useGitBranchName.ts
40346
40660
  init_esbuild_shims();
40347
- var import_react145 = __toESM(require_react(), 1);
40661
+ var import_react146 = __toESM(require_react(), 1);
40348
40662
  function useGitBranchName(cwd3) {
40349
- const [branchName, setBranchName] = (0, import_react145.useState)(void 0);
40350
- (0, import_react145.useEffect)(() => {
40663
+ const [branchName, setBranchName] = (0, import_react146.useState)(void 0);
40664
+ (0, import_react146.useEffect)(() => {
40351
40665
  let cancelled = false;
40352
40666
  let dispose;
40353
40667
  const refresh = /* @__PURE__ */ __name(async () => {
@@ -40380,13 +40694,13 @@ __name(useGitBranchName, "useGitBranchName");
40380
40694
 
40381
40695
  // packages/cli/src/ui/hooks/useWorktreeSession.ts
40382
40696
  init_esbuild_shims();
40383
- var import_react146 = __toESM(require_react(), 1);
40697
+ var import_react147 = __toESM(require_react(), 1);
40384
40698
  import fs19 from "node:fs";
40385
40699
  import fsPromises from "node:fs/promises";
40386
40700
  import path14 from "node:path";
40387
40701
  function useWorktreeSession(config) {
40388
- const [session, setSession] = (0, import_react146.useState)(null);
40389
- (0, import_react146.useEffect)(() => {
40702
+ const [session, setSession] = (0, import_react147.useState)(null);
40703
+ (0, import_react147.useEffect)(() => {
40390
40704
  let cancelled = false;
40391
40705
  const safeLoad = /* @__PURE__ */ __name(async () => {
40392
40706
  try {
@@ -40426,7 +40740,7 @@ __name(useWorktreeSession, "useWorktreeSession");
40426
40740
 
40427
40741
  // packages/cli/src/ui/hooks/useExtensionUpdates.ts
40428
40742
  init_esbuild_shims();
40429
- var import_react147 = __toESM(require_react(), 1);
40743
+ var import_react148 = __toESM(require_react(), 1);
40430
40744
  function confirmationRequestsReducer(state, action) {
40431
40745
  switch (action.type) {
40432
40746
  case "add":
@@ -40443,8 +40757,8 @@ var useConfirmUpdateRequests = /* @__PURE__ */ __name(() => {
40443
40757
  const [
40444
40758
  confirmUpdateExtensionRequests,
40445
40759
  dispatchConfirmUpdateExtensionRequests
40446
- ] = (0, import_react147.useReducer)(confirmationRequestsReducer, []);
40447
- const addConfirmUpdateExtensionRequest = (0, import_react147.useCallback)(
40760
+ ] = (0, import_react148.useReducer)(confirmationRequestsReducer, []);
40761
+ const addConfirmUpdateExtensionRequest = (0, import_react148.useCallback)(
40448
40762
  (original) => {
40449
40763
  const wrappedRequest = {
40450
40764
  prompt: original.prompt,
@@ -40482,11 +40796,11 @@ function settingInputRequestsReducer(state, action) {
40482
40796
  }
40483
40797
  __name(settingInputRequestsReducer, "settingInputRequestsReducer");
40484
40798
  var useSettingInputRequests = /* @__PURE__ */ __name(() => {
40485
- const [settingInputRequests, dispatchSettingInputRequests] = (0, import_react147.useReducer)(
40799
+ const [settingInputRequests, dispatchSettingInputRequests] = (0, import_react148.useReducer)(
40486
40800
  settingInputRequestsReducer,
40487
40801
  []
40488
40802
  );
40489
- const addSettingInputRequest = (0, import_react147.useCallback)(
40803
+ const addSettingInputRequest = (0, import_react148.useCallback)(
40490
40804
  (original) => {
40491
40805
  const wrappedRequest = {
40492
40806
  settingName: original.settingName,
@@ -40533,11 +40847,11 @@ function pluginChoiceRequestsReducer(state, action) {
40533
40847
  }
40534
40848
  __name(pluginChoiceRequestsReducer, "pluginChoiceRequestsReducer");
40535
40849
  var usePluginChoiceRequests = /* @__PURE__ */ __name(() => {
40536
- const [pluginChoiceRequests, dispatchPluginChoiceRequests] = (0, import_react147.useReducer)(
40850
+ const [pluginChoiceRequests, dispatchPluginChoiceRequests] = (0, import_react148.useReducer)(
40537
40851
  pluginChoiceRequestsReducer,
40538
40852
  []
40539
40853
  );
40540
- const addPluginChoiceRequest = (0, import_react147.useCallback)(
40854
+ const addPluginChoiceRequest = (0, import_react148.useCallback)(
40541
40855
  (original) => {
40542
40856
  const wrappedRequest = {
40543
40857
  marketplaceName: original.marketplaceName,
@@ -40571,12 +40885,12 @@ var usePluginChoiceRequests = /* @__PURE__ */ __name(() => {
40571
40885
  };
40572
40886
  }, "usePluginChoiceRequests");
40573
40887
  var useExtensionUpdates = /* @__PURE__ */ __name((extensionManager, addItem, cwd3) => {
40574
- const [extensionsUpdateState, dispatchExtensionStateUpdate] = (0, import_react147.useReducer)(
40888
+ const [extensionsUpdateState, dispatchExtensionStateUpdate] = (0, import_react148.useReducer)(
40575
40889
  extensionUpdatesReducer,
40576
40890
  initialExtensionUpdatesState
40577
40891
  );
40578
40892
  const extensions = extensionManager.getLoadedExtensions();
40579
- (0, import_react147.useEffect)(() => {
40893
+ (0, import_react148.useEffect)(() => {
40580
40894
  (async () => {
40581
40895
  const extensionsToCheck = extensions.filter((extension) => {
40582
40896
  const currentStatus = extensionsUpdateState.extensionStatuses.get(
@@ -40604,7 +40918,7 @@ var useExtensionUpdates = /* @__PURE__ */ __name((extensionManager, addItem, cwd
40604
40918
  extensionsUpdateState.extensionStatuses,
40605
40919
  dispatchExtensionStateUpdate
40606
40920
  ]);
40607
- (0, import_react147.useEffect)(() => {
40921
+ (0, import_react148.useEffect)(() => {
40608
40922
  if (extensionsUpdateState.batchChecksInProgress > 0) {
40609
40923
  return;
40610
40924
  }
@@ -40673,7 +40987,7 @@ var useExtensionUpdates = /* @__PURE__ */ __name((extensionManager, addItem, cwd
40673
40987
  );
40674
40988
  }
40675
40989
  }, [extensions, extensionManager, extensionsUpdateState, addItem, cwd3]);
40676
- const extensionsUpdateStateComputed = (0, import_react147.useMemo)(() => {
40990
+ const extensionsUpdateStateComputed = (0, import_react148.useMemo)(() => {
40677
40991
  const result = /* @__PURE__ */ new Map();
40678
40992
  for (const [
40679
40993
  key,
@@ -40692,11 +41006,11 @@ var useExtensionUpdates = /* @__PURE__ */ __name((extensionManager, addItem, cwd
40692
41006
 
40693
41007
  // packages/cli/src/ui/components/TranscriptView.tsx
40694
41008
  init_esbuild_shims();
40695
- var import_react150 = __toESM(require_react(), 1);
41009
+ var import_react151 = __toESM(require_react(), 1);
40696
41010
 
40697
41011
  // packages/cli/src/ui/components/AlternateScreen.tsx
40698
41012
  init_esbuild_shims();
40699
- var import_react148 = __toESM(require_react(), 1);
41013
+ var import_react149 = __toESM(require_react(), 1);
40700
41014
  var import_jsx_runtime132 = __toESM(require_jsx_runtime(), 1);
40701
41015
  var ENTER_ALT_SCREEN = "\x1B[?1049h";
40702
41016
  var EXIT_ALT_SCREEN = "\x1B[?1049l";
@@ -40709,7 +41023,7 @@ var AlternateScreen = /* @__PURE__ */ __name(({
40709
41023
  }) => {
40710
41024
  const writeRaw = useTerminalOutput();
40711
41025
  const { rows } = useTerminalSize();
40712
- (0, import_react148.useEffect)(() => {
41026
+ (0, import_react149.useEffect)(() => {
40713
41027
  if (disabled || !process.stdout.isTTY) return;
40714
41028
  const safeWrite = /* @__PURE__ */ __name((data) => {
40715
41029
  try {
@@ -40730,18 +41044,25 @@ var AlternateScreen = /* @__PURE__ */ __name(({
40730
41044
 
40731
41045
  // packages/cli/src/ui/components/shared/ErrorBoundary.tsx
40732
41046
  init_esbuild_shims();
40733
- var import_react149 = __toESM(require_react(), 1);
41047
+ var import_react150 = __toESM(require_react(), 1);
40734
41048
  var import_jsx_runtime133 = __toESM(require_jsx_runtime(), 1);
40735
- var ErrorBoundary = class extends import_react149.Component {
41049
+ function normalizeError(error) {
41050
+ if (error instanceof Error) {
41051
+ return error;
41052
+ }
41053
+ return new Error(String(error));
41054
+ }
41055
+ __name(normalizeError, "normalizeError");
41056
+ var ErrorBoundary = class extends import_react150.Component {
40736
41057
  static {
40737
41058
  __name(this, "ErrorBoundary");
40738
41059
  }
40739
41060
  state = { error: null };
40740
41061
  static getDerivedStateFromError(error) {
40741
- return { error };
41062
+ return { error: normalizeError(error) };
40742
41063
  }
40743
41064
  componentDidCatch(error, info) {
40744
- this.props.onError?.(error, info);
41065
+ this.props.onError?.(normalizeError(error), info);
40745
41066
  }
40746
41067
  reset = /* @__PURE__ */ __name(() => {
40747
41068
  this.setState({ error: null });
@@ -40791,11 +41112,11 @@ var TranscriptViewImpl = /* @__PURE__ */ __name(({
40791
41112
  const headerHeight = 1;
40792
41113
  const footerHeight = 1;
40793
41114
  const contentHeight = Math.max(rows - headerHeight - footerHeight, 1);
40794
- const estimatedItemHeight = (0, import_react150.useCallback)(
41115
+ const estimatedItemHeight = (0, import_react151.useCallback)(
40795
41116
  (index) => estimateTranscriptItemHeight(items[index]),
40796
41117
  [items]
40797
41118
  );
40798
- const renderItem = (0, import_react150.useCallback)(
41119
+ const renderItem = (0, import_react151.useCallback)(
40799
41120
  ({ item }) => /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(
40800
41121
  HistoryItemDisplay,
40801
41122
  {
@@ -40808,7 +41129,7 @@ var TranscriptViewImpl = /* @__PURE__ */ __name(({
40808
41129
  [columns]
40809
41130
  );
40810
41131
  const title = t("Transcript");
40811
- const content = (0, import_react150.useMemo)(
41132
+ const content = (0, import_react151.useMemo)(
40812
41133
  () => /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(OverflowProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(
40813
41134
  ScrollableListWithForwardRef,
40814
41135
  {
@@ -40823,7 +41144,7 @@ var TranscriptViewImpl = /* @__PURE__ */ __name(({
40823
41144
  ) }),
40824
41145
  [items, renderItem, estimatedItemHeight, contentHeight]
40825
41146
  );
40826
- const errorFallback = (0, import_react150.useCallback)(
41147
+ const errorFallback = (0, import_react151.useCallback)(
40827
41148
  (error) => /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)(Box_default, { flexDirection: "column", paddingX: 1, children: [
40828
41149
  /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(Text, { color: theme.status.error, bold: true, children: t("Failed to render transcript.") }),
40829
41150
  /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(Text, { color: theme.text.secondary, children: sanitizeTerminalText(error.message) }),
@@ -40834,7 +41155,7 @@ var TranscriptViewImpl = /* @__PURE__ */ __name(({
40834
41155
  ] }),
40835
41156
  []
40836
41157
  );
40837
- const onRenderError = (0, import_react150.useCallback)((error, info) => {
41158
+ const onRenderError = (0, import_react151.useCallback)((error, info) => {
40838
41159
  debugLogger39.error(
40839
41160
  `render error: ${error.message}`,
40840
41161
  info.componentStack ?? ""
@@ -40858,19 +41179,19 @@ var TranscriptViewImpl = /* @__PURE__ */ __name(({
40858
41179
  ] }) })
40859
41180
  ] }) });
40860
41181
  }, "TranscriptViewImpl");
40861
- var TranscriptView = (0, import_react150.memo)(TranscriptViewImpl);
41182
+ var TranscriptView = (0, import_react151.memo)(TranscriptViewImpl);
40862
41183
  TranscriptView.displayName = "TranscriptView";
40863
41184
 
40864
41185
  // packages/cli/src/ui/hooks/useWelcomeBack.ts
40865
41186
  init_esbuild_shims();
40866
- var import_react151 = __toESM(require_react(), 1);
41187
+ var import_react152 = __toESM(require_react(), 1);
40867
41188
  function useWelcomeBack(config, submitQuery, buffer, settings) {
40868
- const [welcomeBackInfo, setWelcomeBackInfo] = (0, import_react151.useState)(null);
40869
- const [showWelcomeBackDialog, setShowWelcomeBackDialog] = (0, import_react151.useState)(false);
40870
- const [welcomeBackChoice, setWelcomeBackChoice] = (0, import_react151.useState)(null);
40871
- const [shouldFillInput, setShouldFillInput] = (0, import_react151.useState)(false);
40872
- const [inputFillText, setInputFillText] = (0, import_react151.useState)(null);
40873
- const checkWelcomeBack = (0, import_react151.useCallback)(async () => {
41189
+ const [welcomeBackInfo, setWelcomeBackInfo] = (0, import_react152.useState)(null);
41190
+ const [showWelcomeBackDialog, setShowWelcomeBackDialog] = (0, import_react152.useState)(false);
41191
+ const [welcomeBackChoice, setWelcomeBackChoice] = (0, import_react152.useState)(null);
41192
+ const [shouldFillInput, setShouldFillInput] = (0, import_react152.useState)(false);
41193
+ const [inputFillText, setInputFillText] = (0, import_react152.useState)(null);
41194
+ const checkWelcomeBack = (0, import_react152.useCallback)(async () => {
40874
41195
  if (settings.ui?.enableWelcomeBack === false) {
40875
41196
  return;
40876
41197
  }
@@ -40889,7 +41210,7 @@ function useWelcomeBack(config, submitQuery, buffer, settings) {
40889
41210
  config.getDebugLogger().debug("Welcome back check failed:", error);
40890
41211
  }
40891
41212
  }, [config, settings.ui?.enableWelcomeBack]);
40892
- const handleWelcomeBackSelection = (0, import_react151.useCallback)(
41213
+ const handleWelcomeBackSelection = (0, import_react152.useCallback)(
40893
41214
  (choice) => {
40894
41215
  setWelcomeBackChoice(choice);
40895
41216
  setShowWelcomeBackDialog(false);
@@ -40913,21 +41234,21 @@ function useWelcomeBack(config, submitQuery, buffer, settings) {
40913
41234
  },
40914
41235
  [config, welcomeBackInfo]
40915
41236
  );
40916
- const handleWelcomeBackClose = (0, import_react151.useCallback)(() => {
41237
+ const handleWelcomeBackClose = (0, import_react152.useCallback)(() => {
40917
41238
  setWelcomeBackChoice("restart");
40918
41239
  setShowWelcomeBackDialog(false);
40919
41240
  }, []);
40920
- const clearInputFill = (0, import_react151.useCallback)(() => {
41241
+ const clearInputFill = (0, import_react152.useCallback)(() => {
40921
41242
  setShouldFillInput(false);
40922
41243
  setInputFillText(null);
40923
41244
  }, []);
40924
- (0, import_react151.useEffect)(() => {
41245
+ (0, import_react152.useEffect)(() => {
40925
41246
  if (shouldFillInput && inputFillText) {
40926
41247
  buffer.setText(inputFillText);
40927
41248
  clearInputFill();
40928
41249
  }
40929
41250
  }, [shouldFillInput, inputFillText, buffer, clearInputFill]);
40930
- (0, import_react151.useEffect)(() => {
41251
+ (0, import_react152.useEffect)(() => {
40931
41252
  checkWelcomeBack();
40932
41253
  }, [checkWelcomeBack]);
40933
41254
  return {
@@ -40948,9 +41269,9 @@ __name(useWelcomeBack, "useWelcomeBack");
40948
41269
 
40949
41270
  // packages/cli/src/ui/hooks/useDialogClose.ts
40950
41271
  init_esbuild_shims();
40951
- var import_react152 = __toESM(require_react(), 1);
41272
+ var import_react153 = __toESM(require_react(), 1);
40952
41273
  function useDialogClose(options) {
40953
- const closeAnyOpenDialog = (0, import_react152.useCallback)(() => {
41274
+ const closeAnyOpenDialog = (0, import_react153.useCallback)(() => {
40954
41275
  if (options.isThemeDialogOpen) {
40955
41276
  options.handleThemeSelect(void 0, "User" /* User */);
40956
41277
  return true;
@@ -41022,14 +41343,14 @@ __name(useDialogClose, "useDialogClose");
41022
41343
 
41023
41344
  // packages/cli/src/ui/hooks/useInitializationAuthError.ts
41024
41345
  init_esbuild_shims();
41025
- var import_react153 = __toESM(require_react(), 1);
41346
+ var import_react154 = __toESM(require_react(), 1);
41026
41347
  var useInitializationAuthError = /* @__PURE__ */ __name((authError, onAuthError) => {
41027
- const hasHandled = (0, import_react153.useRef)(false);
41028
- const authErrorRef = (0, import_react153.useRef)(authError);
41029
- const onAuthErrorRef = (0, import_react153.useRef)(onAuthError);
41348
+ const hasHandled = (0, import_react154.useRef)(false);
41349
+ const authErrorRef = (0, import_react154.useRef)(authError);
41350
+ const onAuthErrorRef = (0, import_react154.useRef)(onAuthError);
41030
41351
  authErrorRef.current = authError;
41031
41352
  onAuthErrorRef.current = onAuthError;
41032
- (0, import_react153.useEffect)(() => {
41353
+ (0, import_react154.useEffect)(() => {
41033
41354
  if (hasHandled.current) {
41034
41355
  return;
41035
41356
  }
@@ -41042,13 +41363,13 @@ var useInitializationAuthError = /* @__PURE__ */ __name((authError, onAuthError)
41042
41363
 
41043
41364
  // packages/cli/src/ui/hooks/useSubagentCreateDialog.ts
41044
41365
  init_esbuild_shims();
41045
- var import_react154 = __toESM(require_react(), 1);
41366
+ var import_react155 = __toESM(require_react(), 1);
41046
41367
  function useSubagentCreateDialog() {
41047
- const [isSubagentCreateDialogOpen, setIsSubagentCreateDialogOpen] = (0, import_react154.useState)(false);
41048
- const openSubagentCreateDialog = (0, import_react154.useCallback)(() => {
41368
+ const [isSubagentCreateDialogOpen, setIsSubagentCreateDialogOpen] = (0, import_react155.useState)(false);
41369
+ const openSubagentCreateDialog = (0, import_react155.useCallback)(() => {
41049
41370
  setIsSubagentCreateDialogOpen(true);
41050
41371
  }, []);
41051
- const closeSubagentCreateDialog = (0, import_react154.useCallback)(() => {
41372
+ const closeSubagentCreateDialog = (0, import_react155.useCallback)(() => {
41052
41373
  setIsSubagentCreateDialogOpen(false);
41053
41374
  }, []);
41054
41375
  return {
@@ -41061,13 +41382,13 @@ __name(useSubagentCreateDialog, "useSubagentCreateDialog");
41061
41382
 
41062
41383
  // packages/cli/src/ui/hooks/useAgentsManagerDialog.ts
41063
41384
  init_esbuild_shims();
41064
- var import_react155 = __toESM(require_react(), 1);
41385
+ var import_react156 = __toESM(require_react(), 1);
41065
41386
  var useAgentsManagerDialog = /* @__PURE__ */ __name(() => {
41066
- const [isAgentsManagerDialogOpen, setIsAgentsManagerDialogOpen] = (0, import_react155.useState)(false);
41067
- const openAgentsManagerDialog = (0, import_react155.useCallback)(() => {
41387
+ const [isAgentsManagerDialogOpen, setIsAgentsManagerDialogOpen] = (0, import_react156.useState)(false);
41388
+ const openAgentsManagerDialog = (0, import_react156.useCallback)(() => {
41068
41389
  setIsAgentsManagerDialogOpen(true);
41069
41390
  }, []);
41070
- const closeAgentsManagerDialog = (0, import_react155.useCallback)(() => {
41391
+ const closeAgentsManagerDialog = (0, import_react156.useCallback)(() => {
41071
41392
  setIsAgentsManagerDialogOpen(false);
41072
41393
  }, []);
41073
41394
  return {
@@ -41079,13 +41400,13 @@ var useAgentsManagerDialog = /* @__PURE__ */ __name(() => {
41079
41400
 
41080
41401
  // packages/cli/src/ui/hooks/useSkillsManagerDialog.ts
41081
41402
  init_esbuild_shims();
41082
- var import_react156 = __toESM(require_react(), 1);
41403
+ var import_react157 = __toESM(require_react(), 1);
41083
41404
  var useSkillsManagerDialog = /* @__PURE__ */ __name(() => {
41084
- const [isSkillsManagerDialogOpen, setIsSkillsManagerDialogOpen] = (0, import_react156.useState)(false);
41085
- const openSkillsManagerDialog = (0, import_react156.useCallback)(() => {
41405
+ const [isSkillsManagerDialogOpen, setIsSkillsManagerDialogOpen] = (0, import_react157.useState)(false);
41406
+ const openSkillsManagerDialog = (0, import_react157.useCallback)(() => {
41086
41407
  setIsSkillsManagerDialogOpen(true);
41087
41408
  }, []);
41088
- const closeSkillsManagerDialog = (0, import_react156.useCallback)(() => {
41409
+ const closeSkillsManagerDialog = (0, import_react157.useCallback)(() => {
41089
41410
  setIsSkillsManagerDialogOpen(false);
41090
41411
  }, []);
41091
41412
  return {
@@ -41097,13 +41418,13 @@ var useSkillsManagerDialog = /* @__PURE__ */ __name(() => {
41097
41418
 
41098
41419
  // packages/cli/src/ui/hooks/useExtensionsManagerDialog.ts
41099
41420
  init_esbuild_shims();
41100
- var import_react157 = __toESM(require_react(), 1);
41421
+ var import_react158 = __toESM(require_react(), 1);
41101
41422
  var useExtensionsManagerDialog = /* @__PURE__ */ __name(() => {
41102
- const [isExtensionsManagerDialogOpen, setIsExtensionsManagerDialogOpen] = (0, import_react157.useState)(false);
41103
- const openExtensionsManagerDialog = (0, import_react157.useCallback)(() => {
41423
+ const [isExtensionsManagerDialogOpen, setIsExtensionsManagerDialogOpen] = (0, import_react158.useState)(false);
41424
+ const openExtensionsManagerDialog = (0, import_react158.useCallback)(() => {
41104
41425
  setIsExtensionsManagerDialogOpen(true);
41105
41426
  }, []);
41106
- const closeExtensionsManagerDialog = (0, import_react157.useCallback)(() => {
41427
+ const closeExtensionsManagerDialog = (0, import_react158.useCallback)(() => {
41107
41428
  setIsExtensionsManagerDialogOpen(false);
41108
41429
  }, []);
41109
41430
  return {
@@ -41115,13 +41436,13 @@ var useExtensionsManagerDialog = /* @__PURE__ */ __name(() => {
41115
41436
 
41116
41437
  // packages/cli/src/ui/hooks/useMcpDialog.ts
41117
41438
  init_esbuild_shims();
41118
- var import_react158 = __toESM(require_react(), 1);
41439
+ var import_react159 = __toESM(require_react(), 1);
41119
41440
  var useMcpDialog = /* @__PURE__ */ __name(() => {
41120
- const [isMcpDialogOpen, setIsMcpDialogOpen] = (0, import_react158.useState)(false);
41121
- const openMcpDialog = (0, import_react158.useCallback)(() => {
41441
+ const [isMcpDialogOpen, setIsMcpDialogOpen] = (0, import_react159.useState)(false);
41442
+ const openMcpDialog = (0, import_react159.useCallback)(() => {
41122
41443
  setIsMcpDialogOpen(true);
41123
41444
  }, []);
41124
- const closeMcpDialog = (0, import_react158.useCallback)(() => {
41445
+ const closeMcpDialog = (0, import_react159.useCallback)(() => {
41125
41446
  setIsMcpDialogOpen(false);
41126
41447
  }, []);
41127
41448
  return {
@@ -41133,13 +41454,13 @@ var useMcpDialog = /* @__PURE__ */ __name(() => {
41133
41454
 
41134
41455
  // packages/cli/src/ui/hooks/useHooksDialog.ts
41135
41456
  init_esbuild_shims();
41136
- var import_react159 = __toESM(require_react(), 1);
41457
+ var import_react160 = __toESM(require_react(), 1);
41137
41458
  var useHooksDialog = /* @__PURE__ */ __name(() => {
41138
- const [isHooksDialogOpen, setIsHooksDialogOpen] = (0, import_react159.useState)(false);
41139
- const openHooksDialog = (0, import_react159.useCallback)(() => {
41459
+ const [isHooksDialogOpen, setIsHooksDialogOpen] = (0, import_react160.useState)(false);
41460
+ const openHooksDialog = (0, import_react160.useCallback)(() => {
41140
41461
  setIsHooksDialogOpen(true);
41141
41462
  }, []);
41142
- const closeHooksDialog = (0, import_react159.useCallback)(() => {
41463
+ const closeHooksDialog = (0, import_react160.useCallback)(() => {
41143
41464
  setIsHooksDialogOpen(false);
41144
41465
  }, []);
41145
41466
  return {
@@ -41151,23 +41472,23 @@ var useHooksDialog = /* @__PURE__ */ __name(() => {
41151
41472
 
41152
41473
  // packages/cli/src/ui/hooks/useStatsDialog.ts
41153
41474
  init_esbuild_shims();
41154
- var import_react160 = __toESM(require_react(), 1);
41475
+ var import_react161 = __toESM(require_react(), 1);
41155
41476
  var useStatsDialog = /* @__PURE__ */ __name(() => {
41156
- const [isStatsDialogOpen, setIsStatsDialogOpen] = (0, import_react160.useState)(false);
41157
- const openStatsDialog = (0, import_react160.useCallback)(() => setIsStatsDialogOpen(true), []);
41158
- const closeStatsDialog = (0, import_react160.useCallback)(() => setIsStatsDialogOpen(false), []);
41477
+ const [isStatsDialogOpen, setIsStatsDialogOpen] = (0, import_react161.useState)(false);
41478
+ const openStatsDialog = (0, import_react161.useCallback)(() => setIsStatsDialogOpen(true), []);
41479
+ const closeStatsDialog = (0, import_react161.useCallback)(() => setIsStatsDialogOpen(false), []);
41159
41480
  return { isStatsDialogOpen, openStatsDialog, closeStatsDialog };
41160
41481
  }, "useStatsDialog");
41161
41482
 
41162
41483
  // packages/cli/src/ui/hooks/useMemoryDialog.ts
41163
41484
  init_esbuild_shims();
41164
- var import_react161 = __toESM(require_react(), 1);
41485
+ var import_react162 = __toESM(require_react(), 1);
41165
41486
  var useMemoryDialog = /* @__PURE__ */ __name(() => {
41166
- const [isMemoryDialogOpen, setIsMemoryDialogOpen] = (0, import_react161.useState)(false);
41167
- const openMemoryDialog = (0, import_react161.useCallback)(() => {
41487
+ const [isMemoryDialogOpen, setIsMemoryDialogOpen] = (0, import_react162.useState)(false);
41488
+ const openMemoryDialog = (0, import_react162.useCallback)(() => {
41168
41489
  setIsMemoryDialogOpen(true);
41169
41490
  }, []);
41170
- const closeMemoryDialog = (0, import_react161.useCallback)(() => {
41491
+ const closeMemoryDialog = (0, import_react162.useCallback)(() => {
41171
41492
  setIsMemoryDialogOpen(false);
41172
41493
  }, []);
41173
41494
  return {
@@ -41179,7 +41500,7 @@ var useMemoryDialog = /* @__PURE__ */ __name(() => {
41179
41500
 
41180
41501
  // packages/cli/src/ui/hooks/useAttentionNotifications.ts
41181
41502
  init_esbuild_shims();
41182
- var import_react162 = __toESM(require_react(), 1);
41503
+ var import_react163 = __toESM(require_react(), 1);
41183
41504
  var LONG_TASK_NOTIFICATION_THRESHOLD_SECONDS = 20;
41184
41505
  var NOTIFICATION_TITLE = "Qwen Code";
41185
41506
  var useAttentionNotifications = /* @__PURE__ */ __name(({
@@ -41194,16 +41515,16 @@ var useAttentionNotifications = /* @__PURE__ */ __name(({
41194
41515
  const terminalBellEnabled = settings?.merged?.general?.terminalBell ?? true;
41195
41516
  const notificationMode = settings?.merged?.general?.notificationMode === "task-complete" ? "task-complete" : "all";
41196
41517
  const approvalNotificationsEnabled = notificationMode === "all";
41197
- const awaitingNotificationSentRef = (0, import_react162.useRef)(false);
41198
- const respondingElapsedRef = (0, import_react162.useRef)(0);
41199
- const idleNotificationSentRef = (0, import_react162.useRef)(false);
41200
- const awaitingToolName = (0, import_react162.useMemo)(() => {
41518
+ const awaitingNotificationSentRef = (0, import_react163.useRef)(false);
41519
+ const respondingElapsedRef = (0, import_react163.useRef)(0);
41520
+ const idleNotificationSentRef = (0, import_react163.useRef)(false);
41521
+ const awaitingToolName = (0, import_react163.useMemo)(() => {
41201
41522
  const awaitingTool = pendingToolCalls?.find(
41202
41523
  (tc) => tc.status === "awaiting_approval"
41203
41524
  );
41204
41525
  return awaitingTool?.request.name;
41205
41526
  }, [pendingToolCalls]);
41206
- (0, import_react162.useEffect)(() => {
41527
+ (0, import_react163.useEffect)(() => {
41207
41528
  if (streamingState === "waiting_for_confirmation" /* WaitingForConfirmation */ && !isFocused && !awaitingNotificationSentRef.current && terminalBellEnabled && approvalNotificationsEnabled) {
41208
41529
  const message = awaitingToolName ? `Qwen Code needs your permission to use ${awaitingToolName}` : "Qwen Code is waiting for your input";
41209
41530
  sendNotification(
@@ -41224,7 +41545,7 @@ var useAttentionNotifications = /* @__PURE__ */ __name(({
41224
41545
  terminal,
41225
41546
  awaitingToolName
41226
41547
  ]);
41227
- (0, import_react162.useEffect)(() => {
41548
+ (0, import_react163.useEffect)(() => {
41228
41549
  if (streamingState === "responding" /* Responding */) {
41229
41550
  respondingElapsedRef.current = elapsedTime;
41230
41551
  idleNotificationSentRef.current = false;
@@ -41377,7 +41698,7 @@ __name(buildTerminalNotification, "buildTerminalNotification");
41377
41698
 
41378
41699
  // packages/cli/src/ui/hooks/useContextualTips.ts
41379
41700
  init_esbuild_shims();
41380
- var import_react163 = __toESM(require_react(), 1);
41701
+ var import_react164 = __toESM(require_react(), 1);
41381
41702
  function useContextualTips({
41382
41703
  streamingState,
41383
41704
  lastPromptTokenCount,
@@ -41387,9 +41708,9 @@ function useContextualTips({
41387
41708
  addItem,
41388
41709
  hideTips
41389
41710
  }) {
41390
- const prevStreamingState = (0, import_react163.useRef)("idle" /* Idle */);
41391
- const hadResponsePhase = (0, import_react163.useRef)(false);
41392
- (0, import_react163.useEffect)(() => {
41711
+ const prevStreamingState = (0, import_react164.useRef)("idle" /* Idle */);
41712
+ const hadResponsePhase = (0, import_react164.useRef)(false);
41713
+ (0, import_react164.useEffect)(() => {
41393
41714
  if (streamingState === "responding" /* Responding */ || prevStreamingState.current === "responding" /* Responding */ && streamingState === "waiting_for_confirmation" /* WaitingForConfirmation */) {
41394
41715
  hadResponsePhase.current = true;
41395
41716
  }
@@ -41525,7 +41846,7 @@ function getResponseCandidateTokens(pendingGeminiHistoryItems) {
41525
41846
  __name(getResponseCandidateTokens, "getResponseCandidateTokens");
41526
41847
  function useStableStickyTodos(todos) {
41527
41848
  const renderKey = getStickyTodosRenderKey(todos);
41528
- const stableTodosRef = (0, import_react164.useRef)(null);
41849
+ const stableTodosRef = (0, import_react165.useRef)(null);
41529
41850
  if (stableTodosRef.current?.renderKey !== renderKey) {
41530
41851
  stableTodosRef.current = { renderKey, todos };
41531
41852
  }
@@ -41556,29 +41877,29 @@ var SHELL_WIDTH_FRACTION = 0.89;
41556
41877
  var SHELL_HEIGHT_PADDING = 10;
41557
41878
  var AppContainer = /* @__PURE__ */ __name((props) => {
41558
41879
  const { settings, config, initializationResult } = props;
41559
- const extensionRefreshState = (0, import_react164.useMemo)(
41880
+ const extensionRefreshState = (0, import_react165.useMemo)(
41560
41881
  () => props.extensionRefreshState ?? new ExtensionRefreshState(),
41561
41882
  [props.extensionRefreshState]
41562
41883
  );
41563
41884
  const historyManager = useHistory();
41564
- const historyRef = (0, import_react164.useRef)(historyManager.history);
41885
+ const historyRef = (0, import_react165.useRef)(historyManager.history);
41565
41886
  historyRef.current = historyManager.history;
41566
41887
  useMemoryMonitor(historyManager);
41567
- const [debugMessage, setDebugMessage] = (0, import_react164.useState)("");
41568
- const [quittingMessages, setQuittingMessages] = (0, import_react164.useState)(null);
41569
- const [themeError, setThemeError] = (0, import_react164.useState)(
41888
+ const [debugMessage, setDebugMessage] = (0, import_react165.useState)("");
41889
+ const [quittingMessages, setQuittingMessages] = (0, import_react165.useState)(null);
41890
+ const [themeError, setThemeError] = (0, import_react165.useState)(
41570
41891
  initializationResult.themeError
41571
41892
  );
41572
- const [isProcessing, setIsProcessing] = (0, import_react164.useState)(false);
41573
- const [embeddedShellFocused, setEmbeddedShellFocused] = (0, import_react164.useState)(false);
41574
- const [geminiMdFileCount, setGeminiMdFileCount] = (0, import_react164.useState)(
41893
+ const [isProcessing, setIsProcessing] = (0, import_react165.useState)(false);
41894
+ const [embeddedShellFocused, setEmbeddedShellFocused] = (0, import_react165.useState)(false);
41895
+ const [geminiMdFileCount, setGeminiMdFileCount] = (0, import_react165.useState)(
41575
41896
  initializationResult.geminiMdFileCount
41576
41897
  );
41577
- const [shellModeActive, setShellModeActive] = (0, import_react164.useState)(false);
41578
- const [modelSwitchedFromQuotaError, setModelSwitchedFromQuotaError] = (0, import_react164.useState)(false);
41579
- const [historyRemountKey, setHistoryRemountKey] = (0, import_react164.useState)(0);
41580
- const [updateInfo, setUpdateInfo] = (0, import_react164.useState)(null);
41581
- const [isTrustedFolder, setIsTrustedFolder] = (0, import_react164.useState)(
41898
+ const [shellModeActive, setShellModeActive] = (0, import_react165.useState)(false);
41899
+ const [modelSwitchedFromQuotaError, setModelSwitchedFromQuotaError] = (0, import_react165.useState)(false);
41900
+ const [historyRemountKey, setHistoryRemountKey] = (0, import_react165.useState)(0);
41901
+ const [updateInfo, setUpdateInfo] = (0, import_react165.useState)(null);
41902
+ const [isTrustedFolder, setIsTrustedFolder] = (0, import_react165.useState)(
41582
41903
  config.isTrustedFolder()
41583
41904
  );
41584
41905
  const extensionManager = config.getExtensionManager();
@@ -41637,31 +41958,31 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
41637
41958
  config,
41638
41959
  historyManager.addItem
41639
41960
  );
41640
- const [isTrustDialogOpen, setTrustDialogOpen] = (0, import_react164.useState)(false);
41641
- const openTrustDialog = (0, import_react164.useCallback)(() => setTrustDialogOpen(true), []);
41642
- const closeTrustDialog = (0, import_react164.useCallback)(() => setTrustDialogOpen(false), []);
41643
- const [isPermissionsDialogOpen, setPermissionsDialogOpen] = (0, import_react164.useState)(false);
41644
- const openPermissionsDialog = (0, import_react164.useCallback)(
41961
+ const [isTrustDialogOpen, setTrustDialogOpen] = (0, import_react165.useState)(false);
41962
+ const openTrustDialog = (0, import_react165.useCallback)(() => setTrustDialogOpen(true), []);
41963
+ const closeTrustDialog = (0, import_react165.useCallback)(() => setTrustDialogOpen(false), []);
41964
+ const [isPermissionsDialogOpen, setPermissionsDialogOpen] = (0, import_react165.useState)(false);
41965
+ const openPermissionsDialog = (0, import_react165.useCallback)(
41645
41966
  () => setPermissionsDialogOpen(true),
41646
41967
  []
41647
41968
  );
41648
- const closePermissionsDialog = (0, import_react164.useCallback)(
41969
+ const closePermissionsDialog = (0, import_react165.useCallback)(
41649
41970
  () => setPermissionsDialogOpen(false),
41650
41971
  []
41651
41972
  );
41652
- const [currentModel, setCurrentModel] = (0, import_react164.useState)(() => config.getModel());
41653
- const [isConfigInitialized, setConfigInitialized] = (0, import_react164.useState)(false);
41654
- const [userMessages, setUserMessages] = (0, import_react164.useState)([]);
41655
- const [transcriptFreeze, setTranscriptFreeze] = (0, import_react164.useState)(null);
41973
+ const [currentModel, setCurrentModel] = (0, import_react165.useState)(() => config.getModel());
41974
+ const [isConfigInitialized, setConfigInitialized] = (0, import_react165.useState)(false);
41975
+ const [userMessages, setUserMessages] = (0, import_react165.useState)([]);
41976
+ const [transcriptFreeze, setTranscriptFreeze] = (0, import_react165.useState)(null);
41656
41977
  const isTranscriptOpen = transcriptFreeze != null;
41657
- const isTranscriptOpenRef = (0, import_react164.useRef)(isTranscriptOpen);
41978
+ const isTranscriptOpenRef = (0, import_react165.useRef)(isTranscriptOpen);
41658
41979
  isTranscriptOpenRef.current = isTranscriptOpen;
41659
- const closeTranscript = (0, import_react164.useCallback)(() => {
41980
+ const closeTranscript = (0, import_react165.useCallback)(() => {
41660
41981
  setTranscriptFreeze(null);
41661
41982
  }, []);
41662
- const [thoughtExpanded, setThoughtExpanded] = (0, import_react164.useState)(false);
41663
- const [expandedThoughtHeadIds, setExpandedThoughtHeadIds] = (0, import_react164.useState)(() => /* @__PURE__ */ new Set());
41664
- const toggleThoughtExpanded = (0, import_react164.useCallback)((headId) => {
41983
+ const [thoughtExpanded, setThoughtExpanded] = (0, import_react165.useState)(false);
41984
+ const [expandedThoughtHeadIds, setExpandedThoughtHeadIds] = (0, import_react165.useState)(() => /* @__PURE__ */ new Set());
41985
+ const toggleThoughtExpanded = (0, import_react165.useCallback)((headId) => {
41665
41986
  setExpandedThoughtHeadIds((prev) => {
41666
41987
  const next = new Set(prev);
41667
41988
  if (next.has(headId)) {
@@ -41675,10 +41996,10 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
41675
41996
  const { columns: terminalWidth, rows: terminalHeight } = useTerminalSize();
41676
41997
  const { stdin, setRawMode } = use_stdin_default();
41677
41998
  const { stdout } = use_stdout_default();
41678
- const writeRaw = (0, import_react164.useCallback)((data) => {
41999
+ const writeRaw = (0, import_react165.useCallback)((data) => {
41679
42000
  process16.stdout.write(data);
41680
42001
  }, []);
41681
- const terminal = (0, import_react164.useMemo)(
42002
+ const terminal = (0, import_react165.useMemo)(
41682
42003
  () => buildTerminalNotification(writeRaw),
41683
42004
  [writeRaw]
41684
42005
  );
@@ -41688,12 +42009,14 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
41688
42009
  seedPromptCount
41689
42010
  } = useSessionStats();
41690
42011
  const logger = useLogger(config.storage, sessionStats.sessionId);
41691
- const branchName = useGitBranchName(config.getTargetDir());
41692
42012
  const worktreeSession = useWorktreeSession(config);
41693
- const [showWorktreeExitDialog, setShowWorktreeExitDialog] = (0, import_react164.useState)(false);
41694
- const [workflowKeywordActive, setWorkflowKeywordActive] = (0, import_react164.useState)(false);
41695
- const pendingWorktreeNoticeRef = (0, import_react164.useRef)(null);
41696
- const activeWorktree = (0, import_react164.useMemo)(
42013
+ const branchName = useGitBranchName(
42014
+ worktreeSession?.worktreePath ?? config.getTargetDir()
42015
+ );
42016
+ const [showWorktreeExitDialog, setShowWorktreeExitDialog] = (0, import_react165.useState)(false);
42017
+ const [workflowKeywordActive, setWorkflowKeywordActive] = (0, import_react165.useState)(false);
42018
+ const pendingWorktreeNoticeRef = (0, import_react165.useRef)(null);
42019
+ const activeWorktree = (0, import_react165.useMemo)(
41697
42020
  () => worktreeSession ? {
41698
42021
  slug: worktreeSession.slug,
41699
42022
  branch: worktreeSession.worktreeBranch,
@@ -41704,20 +42027,20 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
41704
42027
  } : null,
41705
42028
  [worktreeSession]
41706
42029
  );
41707
- const mainControlsRef = (0, import_react164.useRef)(null);
41708
- const lastTitleRef = (0, import_react164.useRef)(null);
41709
- const [startupWarnings, setStartupWarnings] = (0, import_react164.useState)(
42030
+ const mainControlsRef = (0, import_react165.useRef)(null);
42031
+ const lastTitleRef = (0, import_react165.useRef)(null);
42032
+ const [startupWarnings, setStartupWarnings] = (0, import_react165.useState)(
41710
42033
  () => props.startupWarnings || []
41711
42034
  );
41712
42035
  const staticExtraHeight = 3;
41713
- (0, import_react164.useEffect)(() => {
42036
+ (0, import_react165.useEffect)(() => {
41714
42037
  void loadLowlight().catch((err) => {
41715
42038
  debugLogger40.warn(
41716
42039
  `Failed to load lowlight chunk; code blocks will render as plain text: ${err instanceof Error ? err.message : String(err)}`
41717
42040
  );
41718
42041
  });
41719
42042
  }, []);
41720
- (0, import_react164.useEffect)(() => {
42043
+ (0, import_react165.useEffect)(() => {
41721
42044
  (async () => {
41722
42045
  profileCheckpoint("config_initialize_start");
41723
42046
  await config.initialize();
@@ -41807,7 +42130,7 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
41807
42130
  await ideClient.disconnect();
41808
42131
  });
41809
42132
  }, [config]);
41810
- (0, import_react164.useEffect)(() => {
42133
+ (0, import_react165.useEffect)(() => {
41811
42134
  if (!isConfigInitialized) return void 0;
41812
42135
  const geminiClient2 = config.getGeminiClient();
41813
42136
  if (!geminiClient2) return void 0;
@@ -41871,11 +42194,11 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
41871
42194
  clearTimeout(finalizeCap);
41872
42195
  };
41873
42196
  }, [isConfigInitialized, config]);
41874
- const isIdleRef = (0, import_react164.useRef)(true);
41875
- const availableTerminalHeightRef = (0, import_react164.useRef)(0);
41876
- const terminalWidthRef = (0, import_react164.useRef)(0);
41877
- const updateHandlerRef = (0, import_react164.useRef)(null);
41878
- (0, import_react164.useEffect)(() => {
42197
+ const isIdleRef = (0, import_react165.useRef)(true);
42198
+ const availableTerminalHeightRef = (0, import_react165.useRef)(0);
42199
+ const terminalWidthRef = (0, import_react165.useRef)(0);
42200
+ const updateHandlerRef = (0, import_react165.useRef)(null);
42201
+ (0, import_react165.useEffect)(() => {
41879
42202
  const handler = setUpdateHandler(
41880
42203
  historyManager.addItem,
41881
42204
  setUpdateInfo,
@@ -41884,13 +42207,13 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
41884
42207
  updateHandlerRef.current = handler;
41885
42208
  return () => handler?.cleanup();
41886
42209
  }, [historyManager.addItem]);
41887
- const { inputWidth, suggestionsWidth } = (0, import_react164.useMemo)(() => {
42210
+ const { inputWidth, suggestionsWidth } = (0, import_react165.useMemo)(() => {
41888
42211
  const { inputWidth: inputWidth2, suggestionsWidth: suggestionsWidth2 } = calculatePromptWidths(terminalWidth);
41889
42212
  return { inputWidth: inputWidth2, suggestionsWidth: suggestionsWidth2 };
41890
42213
  }, [terminalWidth]);
41891
42214
  const mainAreaWidth = Math.min(terminalWidth - 4, 100);
41892
42215
  const staticAreaMaxItemHeight = Math.max(terminalHeight * 4, 100);
41893
- const isValidPath = (0, import_react164.useCallback)((filePath) => {
42216
+ const isValidPath = (0, import_react165.useCallback)((filePath) => {
41894
42217
  try {
41895
42218
  return fs20.existsSync(filePath) && fs20.statSync(filePath).isFile();
41896
42219
  } catch (_e) {
@@ -41907,9 +42230,9 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
41907
42230
  shellModeActive,
41908
42231
  preferredEditor
41909
42232
  });
41910
- const restoredPromptStashTargetsRef = (0, import_react164.useRef)(/* @__PURE__ */ new Set());
42233
+ const restoredPromptStashTargetsRef = (0, import_react165.useRef)(/* @__PURE__ */ new Set());
41911
42234
  const promptStashTargetDir = config.getTargetDir();
41912
- (0, import_react164.useEffect)(() => {
42235
+ (0, import_react165.useEffect)(() => {
41913
42236
  if (restoredPromptStashTargetsRef.current.has(promptStashTargetDir)) {
41914
42237
  return;
41915
42238
  }
@@ -41920,12 +42243,12 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
41920
42243
  (text) => buffer.setText(text)
41921
42244
  );
41922
42245
  }, [buffer, promptStashTargetDir]);
41923
- (0, import_react164.useEffect)(() => {
42246
+ (0, import_react165.useEffect)(() => {
41924
42247
  const fetchUserMessages = /* @__PURE__ */ __name(async () => {
41925
42248
  const pastMessagesRaw = await logger?.getPreviousUserMessages() || [];
41926
- const currentSessionUserMessages = historyManager.history.filter(
41927
- (item) => item.type === "user" && typeof item.text === "string" && item.text.trim() !== ""
41928
- ).map((item) => item.text).reverse();
42249
+ const currentSessionUserMessages = realUserPromptTexts(
42250
+ historyManager.history
42251
+ ).reverse();
41929
42252
  const combinedMessages = [
41930
42253
  ...currentSessionUserMessages,
41931
42254
  ...pastMessagesRaw
@@ -41934,12 +42257,12 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
41934
42257
  }, "fetchUserMessages");
41935
42258
  fetchUserMessages();
41936
42259
  }, [historyManager.history, logger]);
41937
- const remountStaticHistory = (0, import_react164.useCallback)(() => {
42260
+ const remountStaticHistory = (0, import_react165.useCallback)(() => {
41938
42261
  setHistoryRemountKey((prev) => prev + 1);
41939
42262
  }, []);
41940
42263
  const useTerminalBuffer = settings.merged.ui?.useTerminalBuffer ?? false;
41941
42264
  const showScrollbar = settings.merged.ui?.showScrollbar ?? true;
41942
- const refreshStatic = (0, import_react164.useCallback)(() => {
42265
+ const refreshStatic = (0, import_react165.useCallback)(() => {
41943
42266
  if (isTranscriptOpenRef.current) {
41944
42267
  return;
41945
42268
  }
@@ -41948,15 +42271,15 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
41948
42271
  }
41949
42272
  remountStaticHistory();
41950
42273
  }, [useTerminalBuffer, remountStaticHistory, stdout]);
41951
- const prevTranscriptOpenRef = (0, import_react164.useRef)(isTranscriptOpen);
42274
+ const prevTranscriptOpenRef = (0, import_react165.useRef)(isTranscriptOpen);
41952
42275
  const wasOpenPrevRender = prevTranscriptOpenRef.current;
41953
42276
  prevTranscriptOpenRef.current = isTranscriptOpen;
41954
- const transcriptCloseCountRef = (0, import_react164.useRef)(0);
42277
+ const transcriptCloseCountRef = (0, import_react165.useRef)(0);
41955
42278
  if (wasOpenPrevRender && !isTranscriptOpen) {
41956
42279
  transcriptCloseCountRef.current += 1;
41957
42280
  }
41958
42281
  const transcriptCloseCount = transcriptCloseCountRef.current;
41959
- (0, import_react164.useEffect)(() => {
42282
+ (0, import_react165.useEffect)(() => {
41960
42283
  if (transcriptCloseCount === 0 || useTerminalBuffer) {
41961
42284
  return void 0;
41962
42285
  }
@@ -41969,8 +42292,8 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
41969
42292
  }, 0);
41970
42293
  return () => clearTimeout(id);
41971
42294
  }, [transcriptCloseCount, useTerminalBuffer, stdout, remountStaticHistory]);
41972
- const lastNotifiedModelRef = (0, import_react164.useRef)(currentModel);
41973
- (0, import_react164.useEffect)(() => {
42295
+ const lastNotifiedModelRef = (0, import_react165.useRef)(currentModel);
42296
+ (0, import_react165.useEffect)(() => {
41974
42297
  const unsubscribe = config.onModelChange((model) => {
41975
42298
  if (lastNotifiedModelRef.current === model) {
41976
42299
  return;
@@ -42008,7 +42331,7 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
42008
42331
  const { onAuthError, openAuthDialog, closeAuthDialog } = authActions;
42009
42332
  const { isAuthDialogOpen, isAuthenticating, pendingAuthType } = authState;
42010
42333
  useInitializationAuthError(initializationResult.authError, onAuthError);
42011
- (0, import_react164.useEffect)(() => {
42334
+ (0, import_react165.useEffect)(() => {
42012
42335
  const currentAuthType = config.getModelsConfig().getCurrentAuthType();
42013
42336
  if (settings.merged.security?.auth?.enforcedType && currentAuthType && settings.merged.security?.auth.enforcedType !== currentAuthType) {
42014
42337
  onAuthError(
@@ -42022,7 +42345,7 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
42022
42345
  );
42023
42346
  }
42024
42347
  }, [settings.merged.security?.auth?.enforcedType, config, onAuthError]);
42025
- const [editorError, setEditorError] = (0, import_react164.useState)(null);
42348
+ const [editorError, setEditorError] = (0, import_react165.useState)(null);
42026
42349
  const {
42027
42350
  isEditorDialogOpen,
42028
42351
  openEditorDialog,
@@ -42030,18 +42353,18 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
42030
42353
  exitEditorDialog
42031
42354
  } = useEditorSettings(settings, setEditorError, historyManager.addItem);
42032
42355
  const { isSettingsDialogOpen, openSettingsDialog, closeSettingsDialog } = useSettingsCommand();
42033
- const [isStatusLineDialogOpen, setStatusLineDialogOpen] = (0, import_react164.useState)(false);
42034
- const openStatusLineDialog = (0, import_react164.useCallback)(
42356
+ const [isStatusLineDialogOpen, setStatusLineDialogOpen] = (0, import_react165.useState)(false);
42357
+ const openStatusLineDialog = (0, import_react165.useCallback)(
42035
42358
  () => setStatusLineDialogOpen(true),
42036
42359
  []
42037
42360
  );
42038
- const closeStatusLineDialog = (0, import_react164.useCallback)(
42361
+ const closeStatusLineDialog = (0, import_react165.useCallback)(
42039
42362
  () => setStatusLineDialogOpen(false),
42040
42363
  []
42041
42364
  );
42042
- const [statusLineSettingsVersion, setStatusLineSettingsVersion] = (0, import_react164.useState)(0);
42043
- const [statusLineConfigOverride, setStatusLineConfigOverride] = (0, import_react164.useState)(void 0);
42044
- const notifyStatusLineSettingsChanged = (0, import_react164.useCallback)(
42365
+ const [statusLineSettingsVersion, setStatusLineSettingsVersion] = (0, import_react165.useState)(0);
42366
+ const [statusLineConfigOverride, setStatusLineConfigOverride] = (0, import_react165.useState)(void 0);
42367
+ const notifyStatusLineSettingsChanged = (0, import_react165.useCallback)(
42045
42368
  (newConfig) => {
42046
42369
  setStatusLineConfigOverride(newConfig);
42047
42370
  setStatusLineSettingsVersion((version) => version + 1);
@@ -42059,8 +42382,8 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
42059
42382
  closeModelDialog
42060
42383
  } = useModelCommand();
42061
42384
  const { activeArenaDialog, openArenaDialog, closeArenaDialog } = useArenaCommand();
42062
- const [sessionName, setSessionName] = (0, import_react164.useState)(null);
42063
- (0, import_react164.useEffect)(() => {
42385
+ const [sessionName, setSessionName] = (0, import_react165.useState)(null);
42386
+ (0, import_react165.useEffect)(() => {
42064
42387
  const chatRecordingService = config.getChatRecordingService();
42065
42388
  if (!chatRecordingService?.setTitleRecordedCallback) return;
42066
42389
  const existingCallback = chatRecordingService.getTitleRecordedCallback();
@@ -42077,7 +42400,7 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
42077
42400
  };
42078
42401
  }, [config]);
42079
42402
  const addHistoryItem = historyManager.addItem;
42080
- (0, import_react164.useEffect)(() => {
42403
+ (0, import_react165.useEffect)(() => {
42081
42404
  if (typeof config.onChatRecordingFailure !== "function") return;
42082
42405
  return config.onChatRecordingFailure(() => {
42083
42406
  addHistoryItem(
@@ -42121,10 +42444,10 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
42121
42444
  config,
42122
42445
  addItem: historyManager.addItem
42123
42446
  });
42124
- const [isHelpDialogOpen, setHelpDialogOpen] = (0, import_react164.useState)(false);
42125
- const [activeHelpTab, setHelpTab] = (0, import_react164.useState)("general");
42126
- const openHelpDialog = (0, import_react164.useCallback)(() => setHelpDialogOpen(true), []);
42127
- const closeHelpDialog = (0, import_react164.useCallback)(() => setHelpDialogOpen(false), []);
42447
+ const [isHelpDialogOpen, setHelpDialogOpen] = (0, import_react165.useState)(false);
42448
+ const [activeHelpTab, setHelpTab] = (0, import_react165.useState)("general");
42449
+ const openHelpDialog = (0, import_react165.useCallback)(() => setHelpDialogOpen(true), []);
42450
+ const closeHelpDialog = (0, import_react165.useCallback)(() => setHelpDialogOpen(false), []);
42128
42451
  const { vimEnabled, vimMode } = useVimModeState();
42129
42452
  const { toggleVimEnabled } = useVimModeActions();
42130
42453
  const {
@@ -42150,31 +42473,31 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
42150
42473
  const { isMcpDialogOpen, openMcpDialog, closeMcpDialog } = useMcpDialog();
42151
42474
  const { isHooksDialogOpen, openHooksDialog, closeHooksDialog } = useHooksDialog();
42152
42475
  const { isStatsDialogOpen, openStatsDialog, closeStatsDialog } = useStatsDialog();
42153
- const openRewindSelectorRef = (0, import_react164.useRef)(() => {
42476
+ const openRewindSelectorRef = (0, import_react165.useRef)(() => {
42154
42477
  });
42155
- const cancelOngoingRequestRef = (0, import_react164.useRef)(() => {
42478
+ const cancelOngoingRequestRef = (0, import_react165.useRef)(() => {
42156
42479
  });
42157
- const [isDiffDialogOpen, setIsDiffDialogOpen] = (0, import_react164.useState)(false);
42158
- const openDiffDialog = (0, import_react164.useCallback)(() => {
42480
+ const [isDiffDialogOpen, setIsDiffDialogOpen] = (0, import_react165.useState)(false);
42481
+ const openDiffDialog = (0, import_react165.useCallback)(() => {
42159
42482
  setIsDiffDialogOpen(true);
42160
42483
  }, []);
42161
- const closeDiffDialog = (0, import_react164.useCallback)(() => {
42484
+ const closeDiffDialog = (0, import_react165.useCallback)(() => {
42162
42485
  setIsDiffDialogOpen(false);
42163
42486
  }, []);
42164
- const [isSkillReviewDialogOpen, setIsSkillReviewDialogOpen] = (0, import_react164.useState)(false);
42165
- const [skillReviewPending, setSkillReviewPending] = (0, import_react164.useState)(null);
42166
- const skillReviewDismissedTaskIdsRef = (0, import_react164.useRef)(/* @__PURE__ */ new Set());
42167
- const dismissSkillReviewDialog = (0, import_react164.useCallback)(() => {
42487
+ const [isSkillReviewDialogOpen, setIsSkillReviewDialogOpen] = (0, import_react165.useState)(false);
42488
+ const [skillReviewPending, setSkillReviewPending] = (0, import_react165.useState)(null);
42489
+ const skillReviewDismissedTaskIdsRef = (0, import_react165.useRef)(/* @__PURE__ */ new Set());
42490
+ const dismissSkillReviewDialog = (0, import_react165.useCallback)(() => {
42168
42491
  if (skillReviewPending) {
42169
42492
  skillReviewDismissedTaskIdsRef.current.add(skillReviewPending.taskId);
42170
42493
  }
42171
42494
  setIsSkillReviewDialogOpen(false);
42172
42495
  }, [skillReviewPending]);
42173
- const closeSkillReviewDialog = (0, import_react164.useCallback)(
42496
+ const closeSkillReviewDialog = (0, import_react165.useCallback)(
42174
42497
  () => setIsSkillReviewDialogOpen(false),
42175
42498
  []
42176
42499
  );
42177
- const acceptPendingSkill = (0, import_react164.useCallback)(
42500
+ const acceptPendingSkill = (0, import_react165.useCallback)(
42178
42501
  (skillName) => {
42179
42502
  if (!skillReviewPending) return;
42180
42503
  void config.getMemoryManager().acceptPendingSkillFromTask(skillReviewPending.taskId, skillName).catch(() => {
@@ -42182,7 +42505,7 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
42182
42505
  },
42183
42506
  [config, skillReviewPending]
42184
42507
  );
42185
- const rejectPendingSkill = (0, import_react164.useCallback)(
42508
+ const rejectPendingSkill = (0, import_react165.useCallback)(
42186
42509
  (skillName) => {
42187
42510
  if (!skillReviewPending) return;
42188
42511
  void config.getMemoryManager().rejectPendingSkillFromTask(skillReviewPending.taskId, skillName).catch(() => {
@@ -42190,7 +42513,7 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
42190
42513
  },
42191
42514
  [config, skillReviewPending]
42192
42515
  );
42193
- (0, import_react164.useEffect)(() => {
42516
+ (0, import_react165.useEffect)(() => {
42194
42517
  const mgr = config.getMemoryManager();
42195
42518
  const projectRoot = config.getProjectRoot();
42196
42519
  let lastSig = "";
@@ -42224,7 +42547,7 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
42224
42547
  refresh();
42225
42548
  return unsub;
42226
42549
  }, [config]);
42227
- const slashCommandActions = (0, import_react164.useMemo)(
42550
+ const slashCommandActions = (0, import_react165.useMemo)(
42228
42551
  () => ({
42229
42552
  openAuthDialog,
42230
42553
  openThemeDialog,
@@ -42334,13 +42657,13 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
42334
42657
  setSessionName,
42335
42658
  extensionRefreshState
42336
42659
  );
42337
- const onDebugMessage = (0, import_react164.useCallback)(
42660
+ const onDebugMessage = (0, import_react165.useCallback)(
42338
42661
  (message) => {
42339
42662
  config.getDebugLogger().debug(message);
42340
42663
  },
42341
42664
  [config]
42342
42665
  );
42343
- const handleWorktreeExit = (0, import_react164.useCallback)(
42666
+ const handleWorktreeExit = (0, import_react165.useCallback)(
42344
42667
  async (choice) => {
42345
42668
  if (choice === "cancel") {
42346
42669
  setShowWorktreeExitDialog(false);
@@ -42405,7 +42728,7 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
42405
42728
  },
42406
42729
  [activeWorktree, config, handleSlashCommand, historyManager]
42407
42730
  );
42408
- const performMemoryRefresh = (0, import_react164.useCallback)(async () => {
42731
+ const performMemoryRefresh = (0, import_react165.useCallback)(async () => {
42409
42732
  if (config.isSafeMode()) {
42410
42733
  config.setUserMemory("");
42411
42734
  config.setGeminiMdFileCount(0);
@@ -42477,10 +42800,10 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
42477
42800
  debugLogger40.error("Error refreshing memory:", error);
42478
42801
  }
42479
42802
  }, [config, historyManager, settings.merged]);
42480
- const cancelHandlerRef = (0, import_react164.useRef)(() => {
42803
+ const cancelHandlerRef = (0, import_react165.useRef)(() => {
42481
42804
  });
42482
- const midTurnDrainRef = (0, import_react164.useRef)(null);
42483
- const midTurnRestoreRef = (0, import_react164.useRef)(null);
42805
+ const midTurnDrainRef = (0, import_react165.useRef)(null);
42806
+ const midTurnRestoreRef = (0, import_react165.useRef)(null);
42484
42807
  const {
42485
42808
  streamingState,
42486
42809
  submitQuery,
@@ -42523,13 +42846,13 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
42523
42846
  );
42524
42847
  cancelOngoingRequestRef.current = cancelOngoingRequest;
42525
42848
  isIdleRef.current = streamingState === "idle" /* Idle */;
42526
- (0, import_react164.useEffect)(() => {
42849
+ (0, import_react165.useEffect)(() => {
42527
42850
  if (streamingState === "idle" /* Idle */) {
42528
42851
  updateHandlerRef.current?.flush();
42529
42852
  setWorkflowKeywordActive(false);
42530
42853
  }
42531
42854
  }, [streamingState]);
42532
- (0, import_react164.useEffect)(() => {
42855
+ (0, import_react165.useEffect)(() => {
42533
42856
  if (shouldAutoOpenSkillReview({
42534
42857
  pending: skillReviewPending,
42535
42858
  streamingState,
@@ -42541,7 +42864,7 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
42541
42864
  }
42542
42865
  }, [skillReviewPending, streamingState, isMemoryDialogOpen, config]);
42543
42866
  const tipsDisabled = !!(settings.merged.ui?.hideTips || config.getScreenReader());
42544
- const tipHistory = (0, import_react164.useMemo)(
42867
+ const tipHistory = (0, import_react165.useMemo)(
42545
42868
  () => tipsDisabled ? null : getTipHistory(),
42546
42869
  [tipsDisabled]
42547
42870
  );
@@ -42554,7 +42877,7 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
42554
42877
  addItem: historyManager.addItem,
42555
42878
  hideTips: tipsDisabled
42556
42879
  });
42557
- const [hasTabConsumer, setHasTabConsumer] = (0, import_react164.useState)(false);
42880
+ const [hasTabConsumer, setHasTabConsumer] = (0, import_react165.useState)(false);
42558
42881
  const agentViewState = useAgentViewState();
42559
42882
  const {
42560
42883
  dialogOpen: bgTasksDialogOpen,
@@ -42562,11 +42885,11 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
42562
42885
  livePanelFocused: bgLivePanelFocused
42563
42886
  } = useBackgroundTaskViewState();
42564
42887
  const { closeDialog: closeBgTasksDialog } = useBackgroundTaskViewActions();
42565
- const [promptSuggestion, setPromptSuggestion] = (0, import_react164.useState)(null);
42566
- const prevStreamingStateRef = (0, import_react164.useRef)("idle" /* Idle */);
42567
- const speculationRef = (0, import_react164.useRef)(IDLE_SPECULATION);
42568
- const suggestionAbortRef = (0, import_react164.useRef)(null);
42569
- const abortPromptSuggestion = (0, import_react164.useCallback)(() => {
42888
+ const [promptSuggestion, setPromptSuggestion] = (0, import_react165.useState)(null);
42889
+ const prevStreamingStateRef = (0, import_react165.useRef)("idle" /* Idle */);
42890
+ const speculationRef = (0, import_react165.useRef)(IDLE_SPECULATION);
42891
+ const suggestionAbortRef = (0, import_react165.useRef)(null);
42892
+ const abortPromptSuggestion = (0, import_react165.useCallback)(() => {
42570
42893
  suggestionAbortRef.current?.abort();
42571
42894
  suggestionAbortRef.current = null;
42572
42895
  if (speculationRef.current.status !== "idle") {
@@ -42595,21 +42918,21 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
42595
42918
  midTurnDrainRef.current = drainQueue;
42596
42919
  midTurnRestoreRef.current = restoreMessages;
42597
42920
  const remoteInput = useRemoteInput();
42598
- (0, import_react164.useEffect)(() => {
42921
+ (0, import_react165.useEffect)(() => {
42599
42922
  if (!remoteInput) return;
42600
42923
  remoteInput.setSubmitFn((text) => submitQuery(text));
42601
42924
  }, [remoteInput, submitQuery]);
42602
- (0, import_react164.useEffect)(() => {
42925
+ (0, import_react165.useEffect)(() => {
42603
42926
  if (!remoteInput) return;
42604
42927
  if (streamingState === "idle" /* Idle */) {
42605
42928
  remoteInput.notifyIdle();
42606
42929
  }
42607
42930
  }, [remoteInput, streamingState]);
42608
42931
  const dualOutput = useDualOutput();
42609
- const confirmRequestMap = (0, import_react164.useRef)(/* @__PURE__ */ new Map());
42610
- const confirmCallIdMap = (0, import_react164.useRef)(/* @__PURE__ */ new Map());
42611
- const confirmEmitted = (0, import_react164.useRef)(/* @__PURE__ */ new Set());
42612
- (0, import_react164.useEffect)(() => {
42932
+ const confirmRequestMap = (0, import_react165.useRef)(/* @__PURE__ */ new Map());
42933
+ const confirmCallIdMap = (0, import_react165.useRef)(/* @__PURE__ */ new Map());
42934
+ const confirmEmitted = (0, import_react165.useRef)(/* @__PURE__ */ new Set());
42935
+ (0, import_react165.useEffect)(() => {
42613
42936
  if (!dualOutput || !dualOutput.isConnected) return;
42614
42937
  for (const tc of pendingToolCalls) {
42615
42938
  if (tc.status === "awaiting_approval" && !confirmEmitted.current.has(tc.request.callId)) {
@@ -42621,7 +42944,9 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
42621
42944
  requestId,
42622
42945
  tc.request.name,
42623
42946
  tc.request.callId,
42624
- tc.request.args
42947
+ tc.request.args,
42948
+ null,
42949
+ buildPermissionSuggestions(tc.confirmationDetails)
42625
42950
  );
42626
42951
  }
42627
42952
  }
@@ -42636,11 +42961,11 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
42636
42961
  }
42637
42962
  }
42638
42963
  }, [dualOutput, pendingToolCalls]);
42639
- const pendingToolCallsRef = (0, import_react164.useRef)(pendingToolCalls);
42964
+ const pendingToolCallsRef = (0, import_react165.useRef)(pendingToolCalls);
42640
42965
  pendingToolCallsRef.current = pendingToolCalls;
42641
- const dualOutputRef = (0, import_react164.useRef)(dualOutput);
42966
+ const dualOutputRef = (0, import_react165.useRef)(dualOutput);
42642
42967
  dualOutputRef.current = dualOutput;
42643
- (0, import_react164.useEffect)(() => {
42968
+ (0, import_react165.useEffect)(() => {
42644
42969
  if (!remoteInput) return;
42645
42970
  remoteInput.setConfirmationHandler(
42646
42971
  (requestId, allowed) => {
@@ -42680,7 +43005,7 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
42680
43005
  });
42681
43006
  };
42682
43007
  }, [remoteInput]);
42683
- const handleFinalSubmit = (0, import_react164.useCallback)(
43008
+ const handleFinalSubmit = (0, import_react165.useCallback)(
42684
43009
  (submittedValue, options) => {
42685
43010
  if (agentViewState.activeView !== "main") {
42686
43011
  const agent = agentViewState.agents.get(agentViewState.activeView);
@@ -42690,6 +43015,20 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
42690
43015
  }
42691
43016
  }
42692
43017
  const userPromptText = submittedValue;
43018
+ if (["/quit", "/exit", "exit", "quit", ":q", ":q!", ":wq", ":wq!"].includes(
43019
+ userPromptText.trim()
43020
+ )) {
43021
+ void handleSlashCommand("/quit");
43022
+ return;
43023
+ }
43024
+ const recoveredAgentsNotice = !isSlashCommand(userPromptText) && !isBtwCommand(userPromptText) ? config.consumePendingRecoveredAgentsNotice() : null;
43025
+ if (recoveredAgentsNotice) {
43026
+ submittedValue = `<system-reminder>
43027
+ ${recoveredAgentsNotice}
43028
+ </system-reminder>
43029
+
43030
+ ` + submittedValue;
43031
+ }
42693
43032
  const worktreeNotice = pendingWorktreeNoticeRef.current;
42694
43033
  if (worktreeNotice && !isSlashCommand(submittedValue)) {
42695
43034
  pendingWorktreeNoticeRef.current = null;
@@ -42720,12 +43059,6 @@ ${buildWorkflowSteeringNotice()}
42720
43059
  void submitQuery(submittedValue);
42721
43060
  return;
42722
43061
  }
42723
- if (["/quit", "/exit", "exit", "quit", ":q", ":q!", ":wq", ":wq!"].includes(
42724
- submittedValue.trim()
42725
- )) {
42726
- void handleSlashCommand("/quit");
42727
- return;
42728
- }
42729
43062
  const spec = speculationRef.current;
42730
43063
  if (spec.status !== "idle" && spec.suggestion === submittedValue && spec.status === "completed") {
42731
43064
  acceptSpeculation(spec, geminiClient).then((result) => {
@@ -42826,7 +43159,7 @@ ${buildWorkflowSteeringNotice()}
42826
43159
  settings.merged.ui?.disableWorkflowKeywordTrigger
42827
43160
  ]
42828
43161
  );
42829
- const handleArenaModelsSelected = (0, import_react164.useCallback)(
43162
+ const handleArenaModelsSelected = (0, import_react165.useCallback)(
42830
43163
  (models) => {
42831
43164
  const value = models.join(",");
42832
43165
  buffer.setText(`/arena start --models ${value} `);
@@ -42841,15 +43174,15 @@ ${buildWorkflowSteeringNotice()}
42841
43174
  handleWelcomeBackSelection,
42842
43175
  handleWelcomeBackClose
42843
43176
  } = useWelcomeBack(config, handleFinalSubmit, buffer, settings.merged);
42844
- const pendingHistoryItems = (0, import_react164.useMemo)(
43177
+ const pendingHistoryItems = (0, import_react165.useMemo)(
42845
43178
  () => [...pendingSlashCommandHistoryItems, ...pendingGeminiHistoryItems],
42846
43179
  [pendingSlashCommandHistoryItems, pendingGeminiHistoryItems]
42847
43180
  );
42848
- const historyForTranscriptRef = (0, import_react164.useRef)(historyManager.history);
43181
+ const historyForTranscriptRef = (0, import_react165.useRef)(historyManager.history);
42849
43182
  historyForTranscriptRef.current = historyManager.history;
42850
- const pendingForTranscriptRef = (0, import_react164.useRef)(pendingHistoryItems);
43183
+ const pendingForTranscriptRef = (0, import_react165.useRef)(pendingHistoryItems);
42851
43184
  pendingForTranscriptRef.current = pendingHistoryItems;
42852
- const openTranscript = (0, import_react164.useCallback)(() => {
43185
+ const openTranscript = (0, import_react165.useCallback)(() => {
42853
43186
  setTranscriptFreeze({
42854
43187
  // Share MainContent's visibility predicate so the transcript shows exactly
42855
43188
  // what the main view shows. Items collapsed on session resume
@@ -42861,7 +43194,7 @@ ${buildWorkflowSteeringNotice()}
42861
43194
  pendingItems: [...pendingForTranscriptRef.current]
42862
43195
  });
42863
43196
  }, []);
42864
- const transcriptItems = (0, import_react164.useMemo)(() => {
43197
+ const transcriptItems = (0, import_react165.useMemo)(() => {
42865
43198
  if (!transcriptFreeze) return EMPTY_HISTORY_ITEMS;
42866
43199
  return [
42867
43200
  ...transcriptFreeze.committedItems,
@@ -42873,7 +43206,7 @@ ${buildWorkflowSteeringNotice()}
42873
43206
  }))
42874
43207
  ];
42875
43208
  }, [transcriptFreeze]);
42876
- const rawStickyTodos = (0, import_react164.useMemo)(
43209
+ const rawStickyTodos = (0, import_react165.useMemo)(
42877
43210
  () => getStickyTodos(historyManager.history, pendingHistoryItems),
42878
43211
  [historyManager.history, pendingHistoryItems]
42879
43212
  );
@@ -42881,7 +43214,7 @@ ${buildWorkflowSteeringNotice()}
42881
43214
  const hasExecutingTool = isToolExecuting(pendingHistoryItems);
42882
43215
  const hasPendingCompression = isCompressionPending(pendingHistoryItems);
42883
43216
  useTerminalProgress(streamingState, hasExecutingTool);
42884
- cancelHandlerRef.current = (0, import_react164.useCallback)(
43217
+ cancelHandlerRef.current = (0, import_react165.useCallback)(
42885
43218
  (info) => {
42886
43219
  const pendingHistoryItems2 = [
42887
43220
  ...pendingSlashCommandHistoryItems,
@@ -42981,7 +43314,7 @@ ${currentText}` : popped);
42981
43314
  pendingGeminiHistoryItems
42982
43315
  ]
42983
43316
  );
42984
- const handleClearScreen = (0, import_react164.useCallback)(() => {
43317
+ const handleClearScreen = (0, import_react165.useCallback)(() => {
42985
43318
  historyManager.clearItems();
42986
43319
  clearScreen();
42987
43320
  remountStaticHistory();
@@ -43004,13 +43337,13 @@ ${currentText}` : popped);
43004
43337
  history: historyManager.history,
43005
43338
  awayThresholdMinutes: settings.merged.general?.sessionRecapAwayThresholdMinutes
43006
43339
  });
43007
- const contextFileNames = (0, import_react164.useMemo)(() => {
43340
+ const contextFileNames = (0, import_react165.useMemo)(() => {
43008
43341
  const fromSettings = settings.merged.context?.fileName;
43009
43342
  return fromSettings ? Array.isArray(fromSettings) ? fromSettings : [fromSettings] : getAllGeminiMdFilenames();
43010
43343
  }, [settings.merged.context?.fileName]);
43011
- const initialPrompt = (0, import_react164.useMemo)(() => config.getQuestion(), [config]);
43012
- const initialPromptSubmitted = (0, import_react164.useRef)(false);
43013
- (0, import_react164.useEffect)(() => {
43344
+ const initialPrompt = (0, import_react165.useMemo)(() => config.getQuestion(), [config]);
43345
+ const initialPromptSubmitted = (0, import_react165.useRef)(false);
43346
+ (0, import_react165.useEffect)(() => {
43014
43347
  if (initialPrompt && isConfigInitialized && !initialPromptSubmitted.current && !isAuthenticating && !isAuthDialogOpen && !isThemeDialogOpen && !isEditorDialogOpen && !showWelcomeBackDialog && welcomeBackChoice !== "restart" && geminiClient?.isInitialized?.()) {
43015
43348
  handleFinalSubmit(initialPrompt);
43016
43349
  initialPromptSubmitted.current = true;
@@ -43028,7 +43361,7 @@ ${currentText}` : popped);
43028
43361
  geminiClient
43029
43362
  ]);
43030
43363
  const followupSuggestionsEnabled = settings.merged.ui?.enableFollowupSuggestions !== false;
43031
- (0, import_react164.useEffect)(() => {
43364
+ (0, import_react165.useEffect)(() => {
43032
43365
  if (!followupSuggestionsEnabled) {
43033
43366
  suggestionAbortRef.current?.abort();
43034
43367
  setPromptSuggestion(null);
@@ -43097,17 +43430,17 @@ ${currentText}` : popped);
43097
43430
  isPermissionsDialogOpen,
43098
43431
  settingInputRequests
43099
43432
  ]);
43100
- (0, import_react164.useEffect)(() => {
43433
+ (0, import_react165.useEffect)(() => {
43101
43434
  if (!promptSuggestion && speculationRef.current.status !== "idle") {
43102
43435
  abortSpeculation(speculationRef.current).catch(() => {
43103
43436
  });
43104
43437
  speculationRef.current = IDLE_SPECULATION;
43105
43438
  }
43106
43439
  }, [promptSuggestion]);
43107
- const [idePromptAnswered, setIdePromptAnswered] = (0, import_react164.useState)(false);
43108
- const [currentIDE, setCurrentIDE] = (0, import_react164.useState)(null);
43109
- const [startupIdeConnectionStatus, setStartupIdeConnectionStatus] = (0, import_react164.useState)({ state: "idle" });
43110
- (0, import_react164.useEffect)(() => {
43440
+ const [idePromptAnswered, setIdePromptAnswered] = (0, import_react165.useState)(false);
43441
+ const [currentIDE, setCurrentIDE] = (0, import_react165.useState)(null);
43442
+ const [startupIdeConnectionStatus, setStartupIdeConnectionStatus] = (0, import_react165.useState)({ state: "idle" });
43443
+ (0, import_react165.useEffect)(() => {
43111
43444
  const getIde = /* @__PURE__ */ __name(async () => {
43112
43445
  const ideClient = await IdeClient.getInstance();
43113
43446
  const currentIde = ideClient.getCurrentIde();
@@ -43123,40 +43456,40 @@ ${currentText}` : popped);
43123
43456
  tomlFiles: commandMigrationTomlFiles,
43124
43457
  setShowMigrationNudge: setShowCommandMigrationNudge
43125
43458
  } = useCommandMigration(settings, config.storage);
43126
- const [showToolDescriptions, setShowToolDescriptions] = (0, import_react164.useState)(false);
43459
+ const [showToolDescriptions, setShowToolDescriptions] = (0, import_react165.useState)(false);
43127
43460
  const configuredRenderMode = settings.merged.ui?.renderMode;
43128
- const [renderMode, setRenderMode] = (0, import_react164.useState)(
43461
+ const [renderMode, setRenderMode] = (0, import_react165.useState)(
43129
43462
  configuredRenderMode === "raw" ? "raw" : "render"
43130
43463
  );
43131
- const renderModeConfigMountedRef = (0, import_react164.useRef)(false);
43132
- (0, import_react164.useEffect)(() => {
43464
+ const renderModeConfigMountedRef = (0, import_react165.useRef)(false);
43465
+ (0, import_react165.useEffect)(() => {
43133
43466
  if (!renderModeConfigMountedRef.current) {
43134
43467
  renderModeConfigMountedRef.current = true;
43135
43468
  return;
43136
43469
  }
43137
43470
  setRenderMode(configuredRenderMode === "raw" ? "raw" : "render");
43138
43471
  }, [configuredRenderMode]);
43139
- const renderModeMountedRef = (0, import_react164.useRef)(false);
43140
- (0, import_react164.useEffect)(() => {
43472
+ const renderModeMountedRef = (0, import_react165.useRef)(false);
43473
+ (0, import_react165.useEffect)(() => {
43141
43474
  if (!renderModeMountedRef.current) {
43142
43475
  renderModeMountedRef.current = true;
43143
43476
  return;
43144
43477
  }
43145
43478
  refreshStatic();
43146
43479
  }, [renderMode, refreshStatic]);
43147
- const [ctrlCPressedOnce, setCtrlCPressedOnce] = (0, import_react164.useState)(false);
43148
- const ctrlCTimerRef = (0, import_react164.useRef)(null);
43149
- const [ctrlDPressedOnce, setCtrlDPressedOnce] = (0, import_react164.useState)(false);
43150
- const ctrlDTimerRef = (0, import_react164.useRef)(null);
43151
- const [escapePressedOnce, setEscapePressedOnce] = (0, import_react164.useState)(false);
43152
- const escapeTimerRef = (0, import_react164.useRef)(null);
43153
- const dialogsVisibleRef = (0, import_react164.useRef)(false);
43154
- const [isRewindSelectorOpen, setIsRewindSelectorOpen] = (0, import_react164.useState)(false);
43155
- const [rewindEscPending, setRewindEscPending] = (0, import_react164.useState)(false);
43156
- const [constrainHeight, setConstrainHeight] = (0, import_react164.useState)(true);
43157
- const [ideContextState, setIdeContextState] = (0, import_react164.useState)();
43158
- const [showEscapePrompt, setShowEscapePrompt] = (0, import_react164.useState)(false);
43159
- const [showIdeRestartPrompt, setShowIdeRestartPrompt] = (0, import_react164.useState)(false);
43480
+ const [ctrlCPressedOnce, setCtrlCPressedOnce] = (0, import_react165.useState)(false);
43481
+ const ctrlCTimerRef = (0, import_react165.useRef)(null);
43482
+ const [ctrlDPressedOnce, setCtrlDPressedOnce] = (0, import_react165.useState)(false);
43483
+ const ctrlDTimerRef = (0, import_react165.useRef)(null);
43484
+ const [escapePressedOnce, setEscapePressedOnce] = (0, import_react165.useState)(false);
43485
+ const escapeTimerRef = (0, import_react165.useRef)(null);
43486
+ const dialogsVisibleRef = (0, import_react165.useRef)(false);
43487
+ const [isRewindSelectorOpen, setIsRewindSelectorOpen] = (0, import_react165.useState)(false);
43488
+ const [rewindEscPending, setRewindEscPending] = (0, import_react165.useState)(false);
43489
+ const [constrainHeight, setConstrainHeight] = (0, import_react165.useState)(true);
43490
+ const [ideContextState, setIdeContextState] = (0, import_react165.useState)();
43491
+ const [showEscapePrompt, setShowEscapePrompt] = (0, import_react165.useState)(false);
43492
+ const [showIdeRestartPrompt, setShowIdeRestartPrompt] = (0, import_react165.useState)(false);
43160
43493
  const { isFolderTrustDialogOpen, handleFolderTrustSelect, isRestarting } = useFolderTrust(settings, setIsTrustedFolder);
43161
43494
  const {
43162
43495
  isMcpApprovalDialogOpen,
@@ -43185,7 +43518,7 @@ ${currentText}` : popped);
43185
43518
  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);
43186
43519
  dialogsVisibleRef.current = dialogsVisible;
43187
43520
  const needsBlockingInput = dialogsVisible || streamingState === "waiting_for_confirmation" /* WaitingForConfirmation */;
43188
- (0, import_react164.useEffect)(() => {
43521
+ (0, import_react165.useEffect)(() => {
43189
43522
  if (needsBlockingInput && isTranscriptOpen) {
43190
43523
  closeTranscript();
43191
43524
  }
@@ -43201,12 +43534,12 @@ ${currentText}` : popped);
43201
43534
  stickyTodoWidth,
43202
43535
  stickyTodoMaxVisibleItems
43203
43536
  ) : "hidden";
43204
- const [controlsHeight, setControlsHeight] = (0, import_react164.useState)(0);
43537
+ const [controlsHeight, setControlsHeight] = (0, import_react165.useState)(0);
43205
43538
  const liveAgentPanelLayoutKey = getLiveAgentPanelLayoutKey(
43206
43539
  bgTaskEntries,
43207
43540
  bgLivePanelFocused
43208
43541
  );
43209
- (0, import_react164.useLayoutEffect)(() => {
43542
+ (0, import_react165.useLayoutEffect)(() => {
43210
43543
  if (!mainControlsRef.current) {
43211
43544
  setControlsHeight(
43212
43545
  (previousHeight) => previousHeight === 0 ? previousHeight : 0
@@ -43225,10 +43558,13 @@ ${currentText}` : popped);
43225
43558
  dialogsVisible,
43226
43559
  stickyTodosLayoutKey,
43227
43560
  liveAgentPanelLayoutKey,
43228
- // Composer height also shifts with these; without them the footer isn't
43229
- // re-measured during a streaming turn and the VP viewport bottom clips.
43561
+ // Composer and update notification height also shift with these; without
43562
+ // them the footer isn't re-measured during a streaming turn and the VP
43563
+ // viewport bottom clips.
43230
43564
  // (elapsedTime/currentLoadingPhrase excluded: they tick without changing rows.)
43231
43565
  streamingState,
43566
+ updateInfo,
43567
+ agentViewState.activeView,
43232
43568
  embeddedShellFocused,
43233
43569
  messageQueue.length,
43234
43570
  isInputActive
@@ -43250,7 +43586,7 @@ ${currentText}` : popped);
43250
43586
  pager: settings.merged.tools?.shell?.pager,
43251
43587
  showColor: settings.merged.tools?.shell?.showColor
43252
43588
  });
43253
- (0, import_react164.useEffect)(() => {
43589
+ (0, import_react165.useEffect)(() => {
43254
43590
  if (activePtyId) {
43255
43591
  ShellExecutionService.resizePty(
43256
43592
  activePtyId,
@@ -43260,17 +43596,18 @@ ${currentText}` : popped);
43260
43596
  }
43261
43597
  }, [terminalWidth, availableTerminalHeight, activePtyId]);
43262
43598
  useResizeSettleRepaint(terminalWidth, refreshStatic);
43263
- (0, import_react164.useEffect)(() => {
43599
+ useWakeRepaint(refreshStatic);
43600
+ (0, import_react165.useEffect)(() => {
43264
43601
  if (ideNeedsRestart) {
43265
43602
  setShowIdeRestartPrompt(true);
43266
43603
  }
43267
43604
  }, [ideNeedsRestart]);
43268
- (0, import_react164.useEffect)(() => {
43605
+ (0, import_react165.useEffect)(() => {
43269
43606
  const unsubscribe = ideContextStore.subscribe(setIdeContextState);
43270
43607
  setIdeContextState(ideContextStore.get());
43271
43608
  return unsubscribe;
43272
43609
  }, []);
43273
- (0, import_react164.useEffect)(() => {
43610
+ (0, import_react165.useEffect)(() => {
43274
43611
  const listener = /* @__PURE__ */ __name((status) => {
43275
43612
  setStartupIdeConnectionStatus(status);
43276
43613
  }, "listener");
@@ -43279,10 +43616,10 @@ ${currentText}` : popped);
43279
43616
  appEvents.off("startup-ide-connection-status-changed" /* StartupIdeConnectionStatusChanged */, listener);
43280
43617
  };
43281
43618
  }, []);
43282
- const handleEscapePromptChange = (0, import_react164.useCallback)((showPrompt) => {
43619
+ const handleEscapePromptChange = (0, import_react165.useCallback)((showPrompt) => {
43283
43620
  setShowEscapePrompt(showPrompt);
43284
43621
  }, []);
43285
- const openRewindSelector = (0, import_react164.useCallback)(() => {
43622
+ const openRewindSelector = (0, import_react165.useCallback)(() => {
43286
43623
  if (streamingState !== "idle" /* Idle */) return;
43287
43624
  if (dialogsVisibleRef.current) return;
43288
43625
  if (config.getIdeMode()) {
@@ -43300,10 +43637,10 @@ ${currentText}` : popped);
43300
43637
  setIsRewindSelectorOpen(true);
43301
43638
  }, [streamingState, config, historyManager]);
43302
43639
  openRewindSelectorRef.current = openRewindSelector;
43303
- const closeRewindSelector = (0, import_react164.useCallback)(() => {
43640
+ const closeRewindSelector = (0, import_react165.useCallback)(() => {
43304
43641
  setIsRewindSelectorOpen(false);
43305
43642
  }, []);
43306
- const handleRewindConfirm = (0, import_react164.useCallback)(
43643
+ const handleRewindConfirm = (0, import_react165.useCallback)(
43307
43644
  async (userItem, option) => {
43308
43645
  try {
43309
43646
  const needsConversation = option === "conversation" || option === "both";
@@ -43465,7 +43802,7 @@ ${currentText}` : popped);
43465
43802
  openRewindSelector,
43466
43803
  (pending) => setRewindEscPending(pending)
43467
43804
  );
43468
- const handleIdePromptComplete = (0, import_react164.useCallback)(
43805
+ const handleIdePromptComplete = (0, import_react165.useCallback)(
43469
43806
  (result) => {
43470
43807
  if (result.userSelection === "yes") {
43471
43808
  if (result.isExtensionPreInstalled) {
@@ -43481,7 +43818,7 @@ ${currentText}` : popped);
43481
43818
  },
43482
43819
  [handleSlashCommand, settings]
43483
43820
  );
43484
- const handleCommandMigrationComplete = (0, import_react164.useCallback)(
43821
+ const handleCommandMigrationComplete = (0, import_react165.useCallback)(
43485
43822
  async (result) => {
43486
43823
  setShowCommandMigrationNudge(false);
43487
43824
  if (result.userSelection === "yes") {
@@ -43573,7 +43910,7 @@ ${migrationResult.failedFiles.map((f) => ` \u2022 ${f.file}: ${f.error}`).join(
43573
43910
  pendingToolCalls
43574
43911
  });
43575
43912
  const workflowBellEnabled = settings.merged.general?.terminalBell ?? true;
43576
- (0, import_react164.useEffect)(() => {
43913
+ (0, import_react165.useEffect)(() => {
43577
43914
  const registry = config.getWorkflowRunRegistry?.();
43578
43915
  if (!registry?.setNotificationCallback) return;
43579
43916
  registry.setNotificationCallback((entry) => {
@@ -43623,7 +43960,7 @@ ${migrationResult.failedFiles.map((f) => ` \u2022 ${f.file}: ${f.error}`).join(
43623
43960
  showWorktreeExitDialog,
43624
43961
  closeWorktreeExitDialog: /* @__PURE__ */ __name(() => setShowWorktreeExitDialog(false), "closeWorktreeExitDialog")
43625
43962
  });
43626
- const handleExit = (0, import_react164.useCallback)(
43963
+ const handleExit = (0, import_react165.useCallback)(
43627
43964
  (pressedOnce, setPressedOnce, timerRef) => {
43628
43965
  if (pressedOnce) {
43629
43966
  if (timerRef.current) {
@@ -43676,7 +44013,7 @@ ${migrationResult.failedFiles.map((f) => ` \u2022 ${f.file}: ${f.error}`).join(
43676
44013
  activeWorktree
43677
44014
  ]
43678
44015
  );
43679
- const handleGlobalKeypress = (0, import_react164.useCallback)(
44016
+ const handleGlobalKeypress = (0, import_react165.useCallback)(
43680
44017
  (key) => {
43681
44018
  if (settings.merged.general?.debugKeystrokeLogging) {
43682
44019
  debugLogger40.debug("[DEBUG] Keystroke:", JSON.stringify(key));
@@ -43866,7 +44203,7 @@ ${migrationResult.failedFiles.map((f) => ` \u2022 ${f.file}: ${f.error}`).join(
43866
44203
  ]
43867
44204
  );
43868
44205
  useKeypress(handleGlobalKeypress, { isActive: true });
43869
- (0, import_react164.useEffect)(() => {
44206
+ (0, import_react165.useEffect)(() => {
43870
44207
  if (settings.merged.ui?.hideWindowTitle) {
43871
44208
  return;
43872
44209
  }
@@ -43893,9 +44230,9 @@ ${migrationResult.failedFiles.map((f) => ` \u2022 ${f.file}: ${f.error}`).join(
43893
44230
  settings.merged.ui?.showStatusInTitle,
43894
44231
  config
43895
44232
  ]);
43896
- const queueDrainingRef = (0, import_react164.useRef)(false);
43897
- const [queueDrainNonce, setQueueDrainNonce] = (0, import_react164.useState)(0);
43898
- (0, import_react164.useEffect)(() => {
44233
+ const queueDrainingRef = (0, import_react165.useRef)(false);
44234
+ const [queueDrainNonce, setQueueDrainNonce] = (0, import_react165.useState)(0);
44235
+ (0, import_react165.useEffect)(() => {
43899
44236
  if (queueDrainingRef.current) return;
43900
44237
  if (!shouldDrainMessageQueue({
43901
44238
  isConfigInitialized,
@@ -43929,7 +44266,7 @@ ${migrationResult.failedFiles.map((f) => ` \u2022 ${f.file}: ${f.error}`).join(
43929
44266
  queueDrainNonce
43930
44267
  ]);
43931
44268
  const nightly = props.version.includes("nightly");
43932
- const uiState = (0, import_react164.useMemo)(
44269
+ const uiState = (0, import_react165.useMemo)(
43933
44270
  () => ({
43934
44271
  history: historyManager.history,
43935
44272
  historyManager,
@@ -44220,7 +44557,7 @@ ${migrationResult.failedFiles.map((f) => ` \u2022 ${f.file}: ${f.error}`).join(
44220
44557
  isDiffDialogOpen
44221
44558
  ]
44222
44559
  );
44223
- const uiActions = (0, import_react164.useMemo)(
44560
+ const uiActions = (0, import_react165.useMemo)(
44224
44561
  () => ({
44225
44562
  openThemeDialog,
44226
44563
  openEditorDialog,
@@ -44401,11 +44738,11 @@ ${migrationResult.failedFiles.map((f) => ` \u2022 ${f.file}: ${f.error}`).join(
44401
44738
  closeDiffDialog
44402
44739
  ]
44403
44740
  );
44404
- const renderModeValue = (0, import_react164.useMemo)(
44741
+ const renderModeValue = (0, import_react165.useMemo)(
44405
44742
  () => ({ renderMode, setRenderMode }),
44406
44743
  [renderMode, setRenderMode]
44407
44744
  );
44408
- const thoughtExpandedValue = (0, import_react164.useMemo)(
44745
+ const thoughtExpandedValue = (0, import_react165.useMemo)(
44409
44746
  () => ({
44410
44747
  allExpanded: thoughtExpanded,
44411
44748
  expandedHeadIds: expandedThoughtHeadIds,
@@ -44442,9 +44779,9 @@ ${migrationResult.failedFiles.map((f) => ` \u2022 ${f.file}: ${f.error}`).join(
44442
44779
 
44443
44780
  // packages/cli/src/ui/hooks/useKittyKeyboardProtocol.ts
44444
44781
  init_esbuild_shims();
44445
- var import_react165 = __toESM(require_react(), 1);
44782
+ var import_react166 = __toESM(require_react(), 1);
44446
44783
  function useKittyKeyboardProtocol() {
44447
- const [status] = (0, import_react165.useState)({
44784
+ const [status] = (0, import_react166.useState)({
44448
44785
  supported: isKittyProtocolSupported(),
44449
44786
  enabled: isKittyProtocolEnabled(),
44450
44787
  checking: false
@@ -44728,14 +45065,33 @@ async function startInteractiveUI(config, settings, startupWarnings, workspaceRo
44728
45065
  if (useVP) {
44729
45066
  process.stdout.setMaxListeners(0);
44730
45067
  }
45068
+ const appTree = /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(
45069
+ ErrorBoundary,
45070
+ {
45071
+ onError: (error, info) => {
45072
+ debugLogger41.error(
45073
+ `[FATAL_RENDER_ERROR] ${error.message}
45074
+ ${info.componentStack ?? ""}
45075
+ ${error.stack ?? ""}`
45076
+ );
45077
+ setTimeout(() => {
45078
+ void runExitCleanup().then(() => process.exit(1));
45079
+ }, 5e3);
45080
+ },
45081
+ children: /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(AppWrapper, {})
45082
+ }
45083
+ );
44731
45084
  const instance = render_default(
44732
- process.env["DEBUG"] ? /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(import_react166.default.StrictMode, { children: /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(AppWrapper, {}) }) : /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(AppWrapper, {}),
45085
+ process.env["DEBUG"] ? /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(import_react167.default.StrictMode, { children: appTree }) : appTree,
44733
45086
  {
44734
45087
  exitOnCtrlC: false,
44735
45088
  isScreenReaderEnabled: config.getScreenReader(),
44736
45089
  alternateScreen: useVP
44737
45090
  }
44738
45091
  );
45092
+ if (useVP) {
45093
+ pushKittyProtocolFlags();
45094
+ }
44739
45095
  profileCheckpoint("first_paint");
44740
45096
  startPostRenderPrefetches(config, settings, {
44741
45097
  connectIde: options.postRenderConnectIde ?? false,