@qwen-code/qwen-code 0.19.12 → 0.20.0-nightly.20260721.cda0e0348

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 (280) hide show
  1. package/bundled/qc-helper/docs/configuration/settings.md +1 -1
  2. package/bundled/qc-helper/docs/features/commands.md +54 -0
  3. package/bundled/qc-helper/docs/integration-github-action.md +1 -1
  4. package/bundled/qc-helper/docs/qwen-serve.md +44 -6
  5. package/bundled/review/DESIGN.md +2 -2
  6. package/bundled/review/SKILL.md +13 -9
  7. package/chunks/{MaxSizedBox-QOXLJGAF.js → MaxSizedBox-EE76OHAP.js} +30 -27
  8. package/chunks/{StandaloneSessionPicker-FLV6CGYJ.js → StandaloneSessionPicker-WZH4PC3K.js} +50 -45
  9. package/chunks/{acpAgent-OB2CTF3P.js → acpAgent-2ATF4LMP.js} +437 -156
  10. package/chunks/{agent-CKSI7BTR.js → agent-KTOOFWMV.js} +22 -22
  11. package/chunks/{agent-headless-U36LIYTU.js → agent-headless-WVJCQ27D.js} +22 -22
  12. package/chunks/{anthropicContentGenerator-ZZRGFEES.js → anthropicContentGenerator-W4JLNYWQ.js} +6 -5
  13. package/chunks/{artifact-tool-PHO5XEGZ.js → artifact-tool-WBCAMD3O.js} +2 -2
  14. package/chunks/{askUserQuestion-CEPBT47X.js → askUserQuestion-6DZC4UV5.js} +2 -2
  15. package/chunks/{bridge-AIKTINJG.js → bridge-T4TLAZSJ.js} +25 -25
  16. package/chunks/build-SSCNEHZZ.js +62 -0
  17. package/chunks/{ca-2SL2BXTK.js → ca-ISKASTR5.js} +606 -200
  18. package/chunks/{channel-worker-group-NEUVTPB2.js → channel-worker-group-QZV2SP5U.js} +4 -4
  19. package/chunks/{channel-worker-manager-7CQVOVWV.js → channel-worker-manager-3GMAU45H.js} +4 -4
  20. package/chunks/{channel-worker-supervisor-3BU2KNCZ.js → channel-worker-supervisor-QCXSXCRY.js} +3 -3
  21. package/chunks/{chunk-6ETOSWAO.js → chunk-246TW4IX.js} +3 -3
  22. package/chunks/{chunk-2CCDMJM7.js → chunk-25Y6JSH2.js} +3 -3
  23. package/chunks/{chunk-XSEWNUMZ.js → chunk-2CWOJ2FA.js} +8 -8
  24. package/chunks/{chunk-UZC5VPOJ.js → chunk-2GFRA3MN.js} +3 -3
  25. package/chunks/chunk-2GOPPEHK.js +442 -0
  26. package/chunks/{chunk-MRE77ST5.js → chunk-2ITGJJE2.js} +69 -2216
  27. package/chunks/{chunk-BABX5XRO.js → chunk-2LI23QA6.js} +1 -1
  28. package/chunks/{chunk-EFAXBOQO.js → chunk-32F7BZSK.js} +7 -7
  29. package/chunks/chunk-43T5WDQ7.js +127 -0
  30. package/chunks/{chunk-DJ4VHAFJ.js → chunk-4CWPMWCD.js} +7 -3
  31. package/chunks/{chunk-GMUPIMHF.js → chunk-4RA7PWIY.js} +3 -3
  32. package/chunks/{chunk-6IITZE7O.js → chunk-5JX5EWR5.js} +7 -7
  33. package/chunks/{chunk-OBSLEYCD.js → chunk-5PZ6R37W.js} +29 -2
  34. package/chunks/{chunk-HTHUX2T5.js → chunk-5QWWOFGG.js} +0 -1
  35. package/chunks/{chunk-3DJY4IFO.js → chunk-5SCI6E3E.js} +1 -1
  36. package/chunks/{chunk-GSPWDTYY.js → chunk-5WG2K5RH.js} +53 -16
  37. package/chunks/{chunk-NPMVLWYL.js → chunk-5YVZ2XLV.js} +6 -6
  38. package/chunks/{chunk-TKASNYDS.js → chunk-6DHWO5ZF.js} +3 -3
  39. package/chunks/{chunk-4CHDYDG3.js → chunk-6EFTQYW7.js} +1 -1
  40. package/chunks/{chunk-RKUMFUFM.js → chunk-6MC5ASQK.js} +4 -4
  41. package/chunks/{chunk-HZ4M2UQD.js → chunk-6RVJRVQR.js} +1 -1
  42. package/chunks/{chunk-W6CQPLWM.js → chunk-6ZBPS62S.js} +1 -1
  43. package/chunks/chunk-7KGXAXF7.js +114 -0
  44. package/chunks/{chunk-PK7COE5O.js → chunk-ABIL4ZQU.js} +1 -1
  45. package/chunks/{chunk-OEHCAWUA.js → chunk-ACW3VNUE.js} +2 -2
  46. package/chunks/{chunk-APOFULHK.js → chunk-AWVS63WA.js} +7 -6
  47. package/chunks/{chunk-KGWA7XYL.js → chunk-AY3CSB6F.js} +6 -226
  48. package/chunks/{chunk-XAAEDML2.js → chunk-AYCDXHZB.js} +1 -1
  49. package/chunks/{chunk-42VIHAYT.js → chunk-B452RETY.js} +1 -1
  50. package/chunks/{chunk-VAJS2E2D.js → chunk-BDBMYST4.js} +1 -1
  51. package/chunks/{chunk-5N7M4XYN.js → chunk-BUKOHGBE.js} +5 -5
  52. package/chunks/{chunk-F2RR4HO2.js → chunk-BVLROR2T.js} +1 -1
  53. package/chunks/{chunk-WIYV7CSF.js → chunk-BWK3FX3K.js} +3 -3
  54. package/chunks/{chunk-UE5TZ55T.js → chunk-C27BYUX6.js} +29 -2
  55. package/chunks/{chunk-KRMARA3A.js → chunk-CG2HPAVD.js} +29 -13
  56. package/chunks/{chunk-UOA2IHRI.js → chunk-CPCVCKKF.js} +1 -1
  57. package/chunks/{chunk-HD6EGS5K.js → chunk-CUJX3F4X.js} +31 -6
  58. package/chunks/{chunk-4RPARQ5D.js → chunk-D2VIDMVM.js} +2 -2
  59. package/chunks/{chunk-PUKUUASO.js → chunk-DMRO4GU2.js} +1 -1
  60. package/chunks/{chunk-64GC5EMF.js → chunk-DZZIOIVF.js} +1 -1
  61. package/chunks/{chunk-FUSMC3SZ.js → chunk-E5QFCC4X.js} +13 -8
  62. package/chunks/{chunk-LKR7QQ63.js → chunk-EAUYY7SS.js} +3 -3
  63. package/chunks/{chunk-NE6HHLL3.js → chunk-EDMGFJ3E.js} +2 -2
  64. package/chunks/{chunk-J2MKYJKZ.js → chunk-EIAK6Q2B.js} +2 -2
  65. package/chunks/{chunk-WEPXQKGP.js → chunk-EZVDJFZ7.js} +1 -1
  66. package/chunks/{chunk-NALRQ3SG.js → chunk-FCUUJKZF.js} +394 -128
  67. package/chunks/{chunk-4XCVGEEX.js → chunk-FSL5W5TI.js} +3 -3
  68. package/chunks/{chunk-CHPQFLW6.js → chunk-FYA3Y5JR.js} +5 -5
  69. package/chunks/{chunk-V4PCIS25.js → chunk-FZVSFBNW.js} +69 -7
  70. package/chunks/{chunk-4MPYGENG.js → chunk-G45NOBV7.js} +6 -6
  71. package/chunks/{chunk-OSSDHJDU.js → chunk-G45X5TRN.js} +1 -1
  72. package/chunks/{chunk-3B6PSWHE.js → chunk-GH7OEOYU.js} +4 -4
  73. package/chunks/{chunk-KANTXY7B.js → chunk-GKY2OJ7R.js} +2 -2
  74. package/chunks/chunk-GMGDLUC7.js +37 -0
  75. package/chunks/{chunk-2476XGOU.js → chunk-GPILFVPY.js} +1 -1
  76. package/chunks/{chunk-EISVEV45.js → chunk-H24SOJIQ.js} +2 -2
  77. package/chunks/{chunk-J6NT5YTN.js → chunk-H2XVO6NE.js} +1 -289
  78. package/chunks/{chunk-QIFTJDBY.js → chunk-IM2A6YO3.js} +1 -1
  79. package/chunks/{chunk-R3EDIMYZ.js → chunk-IYZENXFW.js} +1 -1
  80. package/chunks/{chunk-LPHGXXZX.js → chunk-JD3MKVKL.js} +1 -1
  81. package/chunks/{chunk-NUHSLBJZ.js → chunk-JNWZQ27S.js} +15 -9
  82. package/chunks/{chunk-ETN2G32U.js → chunk-JPRLCXAO.js} +4 -4
  83. package/chunks/{chunk-WHQNBBWW.js → chunk-JQMBPGOU.js} +2 -2
  84. package/chunks/{chunk-5QSVANRT.js → chunk-JR6UJ24K.js} +2 -2
  85. package/chunks/{chunk-VLHQMOZK.js → chunk-JRW46GQX.js} +3 -3
  86. package/chunks/{chunk-DUR7BZYK.js → chunk-KRI4VCHX.js} +53 -28
  87. package/chunks/{chunk-PR5XQ73G.js → chunk-KTNIZG2C.js} +2 -2
  88. package/chunks/{chunk-QSG4ZFG4.js → chunk-KTUQMDEP.js} +1 -1
  89. package/chunks/{chunk-HVGJWOR6.js → chunk-L4YSPHR4.js} +2 -2
  90. package/chunks/{chunk-BEZPRKD3.js → chunk-LC5CAVMS.js} +160 -2
  91. package/chunks/{chunk-67Q33DQY.js → chunk-LLDGOZMJ.js} +4 -4
  92. package/chunks/{chunk-UCTCDLDS.js → chunk-LWQ4IAOJ.js} +136 -4
  93. package/chunks/{chunk-GEHSF7MS.js → chunk-NEEB7UEN.js} +2545 -1974
  94. package/chunks/{chunk-GCY7QTCE.js → chunk-NO6XTCYT.js} +1822 -424
  95. package/chunks/{chunk-JCJPZMJV.js → chunk-OOCI5VVU.js} +1 -1
  96. package/chunks/{chunk-XSPFQQRE.js → chunk-OONJNQ42.js} +3 -3
  97. package/chunks/{chunk-ANRANWVE.js → chunk-OP4MOGXF.js} +1 -1
  98. package/chunks/{chunk-GW7BONBU.js → chunk-OV2KB55J.js} +5 -5
  99. package/chunks/{chunk-CPU6I5YV.js → chunk-P64HXIC5.js} +115 -32
  100. package/chunks/{chunk-SGPFJMRP.js → chunk-PBATSWUQ.js} +1 -1
  101. package/chunks/{chunk-GXFYV7MP.js → chunk-PFKNXN67.js} +1106 -592
  102. package/chunks/{chunk-KNGZ5EYL.js → chunk-PYNCSQSI.js} +198 -120
  103. package/chunks/{chunk-I7RRHHYG.js → chunk-QKTHJXCS.js} +1 -1
  104. package/chunks/chunk-QKYTTBYW.js +624 -0
  105. package/chunks/{chunk-76BFY7AF.js → chunk-QTERJVPZ.js} +1 -6
  106. package/chunks/{chunk-W4UN42YP.js → chunk-R3VZNHRX.js} +85 -21
  107. package/chunks/chunk-R5N7NF5D.js +1187 -0
  108. package/chunks/{chunk-ZSDFNE6Y.js → chunk-RF34V75B.js} +3 -3
  109. package/chunks/{chunk-HCCR43AY.js → chunk-RFIAR4YL.js} +1 -1
  110. package/chunks/chunk-RS7MT2QG.js +305 -0
  111. package/chunks/{chunk-BKNPMEN6.js → chunk-RVLZCXEE.js} +162 -17
  112. package/chunks/chunk-SV5PQVQE.js +71 -0
  113. package/chunks/{chunk-3ESL7JXA.js → chunk-U4VGYZN7.js} +3 -3
  114. package/chunks/{chunk-4CA4WUMS.js → chunk-UEY4AYUL.js} +2 -2
  115. package/chunks/{chunk-ZGT623SG.js → chunk-USTF7LPI.js} +12 -12
  116. package/chunks/chunk-V7RNNPGC.js +44 -0
  117. package/chunks/{chunk-VEFR4XJQ.js → chunk-W3BKN3LO.js} +1 -1
  118. package/chunks/{chunk-4SJJT466.js → chunk-WQQDJE2P.js} +94 -177
  119. package/chunks/{chunk-KMJOMWHE.js → chunk-WRRF6TEQ.js} +1 -1
  120. package/chunks/{chunk-GLH2NTPB.js → chunk-XCHUDLER.js} +1 -1
  121. package/chunks/{chunk-7SX6WZNO.js → chunk-XVVH63JG.js} +3 -3
  122. package/chunks/{chunk-N47VAEAJ.js → chunk-XZOBDSDG.js} +2379 -1291
  123. package/chunks/chunk-YGIUIIIF.js +125 -0
  124. package/chunks/{chunk-335ECZTA.js → chunk-ZEOZL37W.js} +1 -1
  125. package/chunks/{computer-use-4PUGCUQK.js → computer-use-M6MGRJF2.js} +22 -22
  126. package/chunks/{config-utils-6PJUXHLI.js → config-utils-MOGE4EVB.js} +3 -3
  127. package/chunks/{contextCommand-C57KTWFV.js → contextCommand-HTRJJYNE.js} +25 -26
  128. package/chunks/{create-sub-session-5Q42XR6I.js → create-sub-session-MB35IHCR.js} +22 -22
  129. package/chunks/{create-sub-session-DIJOV6HV.js → create-sub-session-P26FE5GG.js} +2 -2
  130. package/chunks/{cron-create-X462ERYA.js → cron-create-JWFHBDRQ.js} +4 -4
  131. package/chunks/{cron-delete-SL5UJUM3.js → cron-delete-GDX4E26G.js} +4 -4
  132. package/chunks/{cron-list-3MD6SVXI.js → cron-list-USMAIWPT.js} +4 -4
  133. package/chunks/{daemon-ZW6LHOXT.js → daemon-KLPTQIE4.js} +287 -143
  134. package/chunks/{daemon-status-provider-YPV3UXHT.js → daemon-status-provider-67EKK6S3.js} +29 -29
  135. package/chunks/{dist-NUXRQHC5.js → dist-OAV7LJGJ.js} +1 -1
  136. package/chunks/{dist-XLE6ODMB.js → dist-OMW6WDEO.js} +1 -1
  137. package/chunks/{dist-J2H4KTLB.js → dist-PJLG2XYX.js} +1 -1
  138. package/chunks/{dist-IEQSDXS7.js → dist-UIFWIFRO.js} +2 -2
  139. package/chunks/{dist-IGZMVS5R.js → dist-VGJTZL4E.js} +33 -22
  140. package/chunks/{dist-3DQNQJ6H.js → dist-XBJVSWS2.js} +1 -1
  141. package/chunks/{earlyInputCapture-5VDWSYAM.js → earlyInputCapture-7QJX25AC.js} +23 -23
  142. package/chunks/{edit-GORZTX2U.js → edit-BTPQWGAA.js} +23 -23
  143. package/chunks/{enter-worktree-LJB2AW4L.js → enter-worktree-N3SEYKOO.js} +22 -22
  144. package/chunks/{enterPlanMode-LIIPP37T.js → enterPlanMode-TN2JV5MY.js} +28 -23
  145. package/chunks/{environment-HQ2UHJ35.js → environment-HP6RK262.js} +24 -24
  146. package/chunks/{errors-6JD5VMVQ.js → errors-VHGRDDOQ.js} +24 -24
  147. package/chunks/{exit-worktree-IEP2WHOV.js → exit-worktree-FI3SQY3U.js} +22 -22
  148. package/chunks/{exitPlanMode-U5Z6XBLO.js → exitPlanMode-NZWRVIIY.js} +22 -22
  149. package/chunks/{fast-path-HFKNMP23.js → fast-path-EGP7AXNR.js} +3 -2
  150. package/chunks/{gemini-C2SCJH3N.js → gemini-AN5YMD5O.js} +70 -68
  151. package/chunks/{geminiContentGenerator-ADZTXEKV.js → geminiContentGenerator-ABTMU4FE.js} +4 -4
  152. package/chunks/{glob-GOAPGD6G.js → glob-5YABOPJB.js} +22 -22
  153. package/chunks/{grep-HZLSTX7D.js → grep-U67FKUJT.js} +22 -22
  154. package/chunks/{handleAutoUpdate-UF74WGFE.js → handleAutoUpdate-OOKBP5VD.js} +27 -28
  155. package/chunks/{i18n-FMXIYUOC.js → i18n-GMQV324P.js} +23 -23
  156. package/chunks/{initializer-ERDBM3DU.js → initializer-NWALZGQ5.js} +28 -28
  157. package/chunks/{installationInfo-LROMXYLX.js → installationInfo-Y3M433E7.js} +25 -23
  158. package/chunks/{keychain-token-storage-K23CFKGN.js → keychain-token-storage-DWRJMNH3.js} +2 -2
  159. package/chunks/{list-6JPJROU5.js → list-CQDDWHTS.js} +30 -30
  160. package/chunks/{loadedSettingsAdapter-QCWYUBBF.js → loadedSettingsAdapter-I5KG37EI.js} +27 -27
  161. package/chunks/{loop-wakeup-6H7OENTB.js → loop-wakeup-5GLTUBHA.js} +5 -5
  162. package/chunks/{ls-APTSOOS5.js → ls-FHBY3Y7I.js} +4 -4
  163. package/chunks/{lsp-HPACPJAN.js → lsp-B6VMEW6Y.js} +2 -2
  164. package/chunks/{mcp-3P3KWYWO.js → mcp-24HHCBSP.js} +27 -27
  165. package/chunks/{monitor-LMYKCF6R.js → monitor-Z7NZNNRC.js} +22 -22
  166. package/chunks/nonInteractiveCli-GVF2XDJT.js +126 -0
  167. package/chunks/{notebook-edit-IBEOVZ6A.js → notebook-edit-GFOYAQAZ.js} +23 -23
  168. package/chunks/{openaiContentGenerator-42PZKET5.js → openaiContentGenerator-XAAYV6WR.js} +11 -11
  169. package/chunks/{pidfile-VTBDIGOH.js → pidfile-ILI37KRQ.js} +23 -23
  170. package/chunks/{processUtils-L7ZKOGDG.js → processUtils-LIPJMLVZ.js} +2 -2
  171. package/chunks/{qwenContentGenerator-VR2CNFGI.js → qwenContentGenerator-DLJ3KKGZ.js} +24 -24
  172. package/chunks/{qwenOAuth2-6LS2T3Q6.js → qwenOAuth2-J47FU5PW.js} +11 -11
  173. package/chunks/react-SG7JAQSZ.js +8 -0
  174. package/chunks/{read-file-VSKOE22I.js → read-file-LCQ2KNNP.js} +8 -8
  175. package/chunks/{read-mcp-resource-C6NT52T6.js → read-mcp-resource-AKCL7I43.js} +2 -2
  176. package/chunks/{record-artifact-ENCU7QCL.js → record-artifact-PEUB7727.js} +2 -2
  177. package/chunks/resumeHistoryUtils-PSCSAKA6.js +78 -0
  178. package/chunks/{ripGrep-5V5FLW2A.js → ripGrep-Y2XW4EFC.js} +22 -22
  179. package/chunks/{run-qwen-serve-LSOPP4R2.js → run-qwen-serve-DQ5ZIR36.js} +1459 -148
  180. package/chunks/{runtime-LT7R4CS5.js → runtime-6MQFF2A6.js} +33 -31
  181. package/chunks/{scheduler-YOWQ7KZP.js → scheduler-K4S7NY3G.js} +22 -22
  182. package/chunks/{send-message-5GZ4FX2V.js → send-message-3RHE7HSM.js} +3 -3
  183. package/chunks/{serve-VWLBXKGK.js → serve-JFAAPC5J.js} +27 -27
  184. package/chunks/{server-3RW3FYOH.js → server-QB6CHRZN.js} +866 -271
  185. package/chunks/{session-ZONXFOBQ.js → session-FKPVXAAB.js} +79 -163
  186. package/chunks/{settings-JC3VC53L.js → settings-CADELKSU.js} +26 -26
  187. package/chunks/{shell-2NGEMAVM.js → shell-EON6WVVH.js} +22 -22
  188. package/chunks/{skill-3U2T6H3E.js → skill-FKSYXJ5U.js} +10 -10
  189. package/chunks/{spawnChannel-QEAUPARQ.js → spawnChannel-VM5IHLJO.js} +24 -24
  190. package/chunks/{src-75ZPXO7B.js → src-Q4XB6SVD.js} +66 -22
  191. package/chunks/{standalone-update-UUJWJWYY.js → standalone-update-KGZHPBMA.js} +24 -24
  192. package/chunks/{startInteractiveUI-V7XISPQ6.js → startInteractiveUI-EYDJIIIZ.js} +5484 -2045
  193. package/chunks/{syntheticOutput-ULOVVLY4.js → syntheticOutput-FG5PQKIR.js} +3 -3
  194. package/chunks/{task-create-DUE2PMNI.js → task-create-HX32YXO7.js} +7 -7
  195. package/chunks/{task-list-WVPNX7BZ.js → task-list-QWSY4ZIU.js} +5 -5
  196. package/chunks/{task-stop-CPEQWOT6.js → task-stop-GWC6UWAL.js} +2 -2
  197. package/chunks/{task-update-HY2LNFFB.js → task-update-NCTAB73Q.js} +7 -7
  198. package/chunks/{team-create-R6AXDYPG.js → team-create-CYP3YKYT.js} +22 -22
  199. package/chunks/{team-delete-JJV6IUOA.js → team-delete-KK37HTOG.js} +5 -5
  200. package/chunks/{team-plan-approval-O2ZPPT64.js → team-plan-approval-5LXIFKNV.js} +22 -22
  201. package/chunks/{theme-manager-YIX2IC2D.js → theme-manager-QOUMDWMP.js} +23 -23
  202. package/chunks/{todoWrite-JHHIDOIV.js → todoWrite-ERCAMLFS.js} +4 -4
  203. package/chunks/{tool-search-5IE2VO7X.js → tool-search-Q27QHQU3.js} +9 -9
  204. package/chunks/{total-session-admission-K6APQYEF.js → total-session-admission-HWVCZ2WR.js} +25 -25
  205. package/chunks/{trustedFolders-GPSSPVBF.js → trustedFolders-C6664IQC.js} +23 -23
  206. package/chunks/{update-relaunch-4BVAPX6Y.js → update-relaunch-QC3E4FZW.js} +9 -9
  207. package/chunks/{updateCheck-AHTHWLAM.js → updateCheck-MVUKJMBX.js} +33 -26
  208. package/chunks/useAutoAcceptIndicator-J234IFIS.js +80 -0
  209. package/chunks/{validateNonInterActiveAuth-UKAPCWDM.js → validateNonInterActiveAuth-YPPEKX4N.js} +61 -63
  210. package/chunks/{version-EXGWKKQE.js → version-5IXFQ4PT.js} +1 -1
  211. package/chunks/{web-fetch-ZDNE6FF2.js → web-fetch-L62NQVKN.js} +10 -10
  212. package/chunks/{workflow-G7U6OQWS.js → workflow-6MHBBFQU.js} +23 -23
  213. package/chunks/{workspace-providers-status-W6CEA6YM.js → workspace-providers-status-ZTW2B5QU.js} +30 -30
  214. package/chunks/{workspace-registration-store-OGBMWCLC.js → workspace-registration-store-P6QHCSMU.js} +7 -1
  215. package/chunks/{workspace-registry-ZUWQM44P.js → workspace-registry-R54M5O3W.js} +25 -25
  216. package/chunks/{workspace-service-UXX5P7GU.js → workspace-service-WYLRGM4A.js} +32 -32
  217. package/chunks/{workspace-skills-status-635B5R7N.js → workspace-skills-status-NN5QFU3A.js} +28 -28
  218. package/chunks/{write-file-DR3HN7IH.js → write-file-EAT3CHUK.js} +23 -23
  219. package/cli.js +11 -11
  220. package/locales/ca.js +763 -201
  221. package/package.json +3 -3
  222. package/web-shell/assets/{arc-_dVIKMdB.js → arc-B0iTWRo2.js} +1 -1
  223. package/web-shell/assets/{architectureDiagram-3BPJPVTR-MuN3nKpL.js → architectureDiagram-3BPJPVTR-DSQP4-9D.js} +1 -1
  224. package/web-shell/assets/{blockDiagram-GPEHLZMM-BtmvJjzx.js → blockDiagram-GPEHLZMM-BNPVXVT3.js} +1 -1
  225. package/web-shell/assets/{c4Diagram-AAUBKEIU-Dvi58_BU.js → c4Diagram-AAUBKEIU-DEHfJFiD.js} +1 -1
  226. package/web-shell/assets/channel-tVz-qNSq.js +1 -0
  227. package/web-shell/assets/{chunk-2J33WTMH-YqxOVhS1.js → chunk-2J33WTMH-VZ0uL1p9.js} +1 -1
  228. package/web-shell/assets/{chunk-4BX2VUAB-DoBgbC9z.js → chunk-4BX2VUAB-D5TKmvwG.js} +1 -1
  229. package/web-shell/assets/{chunk-55IACEB6-3NEQrBAr.js → chunk-55IACEB6-BDW1Lcq-.js} +1 -1
  230. package/web-shell/assets/{chunk-727SXJPM-DrCZQxp0.js → chunk-727SXJPM-Cj4h85iM.js} +1 -1
  231. package/web-shell/assets/{chunk-AQP2D5EJ-m_g3zjgv.js → chunk-AQP2D5EJ-5LeqiOhZ.js} +1 -1
  232. package/web-shell/assets/{chunk-FMBD7UC4-D1_crABJ.js → chunk-FMBD7UC4-BaTgsco7.js} +1 -1
  233. package/web-shell/assets/{chunk-ND2GUHAM-BdhgVtBx.js → chunk-ND2GUHAM-t3uGlIUk.js} +1 -1
  234. package/web-shell/assets/{chunk-QZHKN3VN-BlmThhm-.js → chunk-QZHKN3VN-rOnNXL2Q.js} +1 -1
  235. package/web-shell/assets/classDiagram-4FO5ZUOK-CWuaBxYV.js +1 -0
  236. package/web-shell/assets/classDiagram-v2-Q7XG4LA2-CWuaBxYV.js +1 -0
  237. package/web-shell/assets/{cose-bilkent-S5V4N54A-Cbjm_00Z.js → cose-bilkent-S5V4N54A-CcqXykgA.js} +1 -1
  238. package/web-shell/assets/{dagre-BM42HDAG-C39QNVgC.js → dagre-BM42HDAG-Dkjrchoy.js} +1 -1
  239. package/web-shell/assets/{diagram-2AECGRRQ-DNXSAixC.js → diagram-2AECGRRQ-B6lcra9M.js} +1 -1
  240. package/web-shell/assets/{diagram-5GNKFQAL-BCbGUPEA.js → diagram-5GNKFQAL-bAIzq3PT.js} +1 -1
  241. package/web-shell/assets/{diagram-KO2AKTUF-1eujKSDC.js → diagram-KO2AKTUF-G9MAZDNW.js} +1 -1
  242. package/web-shell/assets/{diagram-LMA3HP47-DUMKXgql.js → diagram-LMA3HP47-DVLF1uWZ.js} +1 -1
  243. package/web-shell/assets/{diagram-OG6HWLK6-BFktU3_u.js → diagram-OG6HWLK6-Cf7y20Tc.js} +1 -1
  244. package/web-shell/assets/{erDiagram-TEJ5UH35-BvJC7DLk.js → erDiagram-TEJ5UH35-C7ETZB3o.js} +1 -1
  245. package/web-shell/assets/{flowDiagram-I6XJVG4X-Cgu3PlOt.js → flowDiagram-I6XJVG4X-Cl2xgL6J.js} +1 -1
  246. package/web-shell/assets/{ganttDiagram-6RSMTGT7-DLNXN5Xh.js → ganttDiagram-6RSMTGT7-BgjbMs3q.js} +1 -1
  247. package/web-shell/assets/{gitGraphDiagram-PVQCEYII-BQFRDv6R.js → gitGraphDiagram-PVQCEYII-JVX34Omm.js} +1 -1
  248. package/web-shell/assets/index-48bIcdqF.js +1197 -0
  249. package/web-shell/assets/{index-CdC3pjP3.js → index-BG7Zc4f_.js} +1 -1
  250. package/web-shell/assets/index-BI-JAO07.css +5 -0
  251. package/web-shell/assets/{infoDiagram-5YYISTIA-DT2mOSvp.js → infoDiagram-5YYISTIA-3NYyMeZU.js} +1 -1
  252. package/web-shell/assets/{ishikawaDiagram-YF4QCWOH-9fy_K4bd.js → ishikawaDiagram-YF4QCWOH-C03VCu-U.js} +1 -1
  253. package/web-shell/assets/{journeyDiagram-JHISSGLW-CoGSEuhE.js → journeyDiagram-JHISSGLW-C9PuBRZW.js} +1 -1
  254. package/web-shell/assets/{kanban-definition-UN3LZRKU-BP9hHYIj.js → kanban-definition-UN3LZRKU-C3LvioWR.js} +1 -1
  255. package/web-shell/assets/{linear-uIroDsmp.js → linear-Du6Yw8N_.js} +1 -1
  256. package/web-shell/assets/{mermaid.core-BUwoStsA.js → mermaid.core-BXY5D2-X.js} +5 -5
  257. package/web-shell/assets/{mindmap-definition-RKZ34NQL-DZB-FWim.js → mindmap-definition-RKZ34NQL-2UrHLaDp.js} +1 -1
  258. package/web-shell/assets/{pieDiagram-4H26LBE5-YPptloKl.js → pieDiagram-4H26LBE5-dC03ml45.js} +1 -1
  259. package/web-shell/assets/{quadrantDiagram-W4KKPZXB-dgk3DSzm.js → quadrantDiagram-W4KKPZXB-CD6jARrp.js} +1 -1
  260. package/web-shell/assets/{requirementDiagram-4Y6WPE33-BH2En2i9.js → requirementDiagram-4Y6WPE33-BrK8aXfv.js} +1 -1
  261. package/web-shell/assets/{sankeyDiagram-5OEKKPKP-BB98feeI.js → sankeyDiagram-5OEKKPKP-B5Vitki_.js} +1 -1
  262. package/web-shell/assets/{sequenceDiagram-3UESZ5HK-CunAIGh8.js → sequenceDiagram-3UESZ5HK-CBy2t6Bo.js} +1 -1
  263. package/web-shell/assets/{stateDiagram-AJRCARHV-DTJs_-I2.js → stateDiagram-AJRCARHV-Enrka6T2.js} +1 -1
  264. package/web-shell/assets/stateDiagram-v2-BHNVJYJU-DUtYfXpW.js +1 -0
  265. package/web-shell/assets/{timeline-definition-PNZ67QCA-Cd4AN7O0.js → timeline-definition-PNZ67QCA-CwFq78ss.js} +1 -1
  266. package/web-shell/assets/{vennDiagram-CIIHVFJN-xIG-rUU9.js → vennDiagram-CIIHVFJN-BkOidM0g.js} +1 -1
  267. package/web-shell/assets/{wardley-L42UT6IY-D1UyjIcG.js → wardley-L42UT6IY-D_j13hQW.js} +1 -1
  268. package/web-shell/assets/{wardleyDiagram-YWT4CUSO-BVM0Mb99.js → wardleyDiagram-YWT4CUSO-7EveB1w6.js} +1 -1
  269. package/web-shell/assets/{xychartDiagram-2RQKCTM6-BX31JDSz.js → xychartDiagram-2RQKCTM6-DRkBhMXr.js} +1 -1
  270. package/web-shell/index.html +2 -2
  271. package/chunks/chunk-EDFD7VOX.js +0 -368
  272. package/chunks/chunk-GFYFLDEG.js +0 -709
  273. package/chunks/chunk-LUJQUNKY.js +0 -3288
  274. package/chunks/nonInteractiveCli-YURFHZV5.js +0 -129
  275. package/web-shell/assets/channel-Bi5TehaT.js +0 -1
  276. package/web-shell/assets/classDiagram-4FO5ZUOK-BKhhRdd1.js +0 -1
  277. package/web-shell/assets/classDiagram-v2-Q7XG4LA2-BKhhRdd1.js +0 -1
  278. package/web-shell/assets/index-C_ouplMQ.js +0 -1187
  279. package/web-shell/assets/index-XGDFJE-X.css +0 -5
  280. package/web-shell/assets/stateDiagram-v2-BHNVJYJU-DrfFMYta.js +0 -1
@@ -1,56 +1,44 @@
1
1
  // Force strict mode and setup for ESM
2
2
  "use strict";
3
3
  import {
4
- noteInteraction
5
- } from "./chunk-KW7NOTN6.js";
4
+ theme
5
+ } from "./chunk-GMGDLUC7.js";
6
+ import {
7
+ require_jsx_runtime
8
+ } from "./chunk-SV5PQVQE.js";
6
9
  import {
7
10
  Box_default,
8
11
  Text,
9
- require_jsx_runtime,
10
- theme,
11
- use_is_screen_reader_enabled_default,
12
- use_stdin_default,
13
- use_stdout_default
14
- } from "./chunk-GEHSF7MS.js";
12
+ use_is_screen_reader_enabled_default
13
+ } from "./chunk-NEEB7UEN.js";
14
+ import {
15
+ require_react
16
+ } from "./chunk-5QWWOFGG.js";
15
17
  import {
16
18
  formatHistoryGapNotice,
17
19
  indexGapsByChild
18
- } from "./chunk-HZ4M2UQD.js";
20
+ } from "./chunk-6RVJRVQR.js";
19
21
  import {
20
- sanitizeFilenameForDisplay,
21
22
  stringWidth
22
- } from "./chunk-J6NT5YTN.js";
23
+ } from "./chunk-H2XVO6NE.js";
23
24
  import {
24
25
  eastAsianWidth
25
26
  } from "./chunk-QHTIBUWB.js";
26
- import {
27
- require_react
28
- } from "./chunk-HTHUX2T5.js";
29
27
  import {
30
28
  formatDuration
31
29
  } from "./chunk-E5Z2AVNV.js";
32
30
  import {
33
31
  t
34
- } from "./chunk-TKASNYDS.js";
32
+ } from "./chunk-6DHWO5ZF.js";
35
33
  import {
36
- fetchGitDiff,
37
- findProviderByCredentials,
38
- getToolResponseDisplayText,
39
- resolveMetadataKey
40
- } from "./chunk-GCY7QTCE.js";
34
+ getToolResponseDisplayText
35
+ } from "./chunk-NO6XTCYT.js";
41
36
  import {
42
37
  stripAnsi
43
38
  } from "./chunk-T4TZQJ7W.js";
44
- import {
45
- KittySequenceOverflowEvent,
46
- logKittySequenceOverflow
47
- } from "./chunk-CPU6I5YV.js";
48
39
  import {
49
40
  ToolDisplayNames
50
- } from "./chunk-ANRANWVE.js";
51
- import {
52
- createDebugLogger
53
- } from "./chunk-UE5TZ55T.js";
41
+ } from "./chunk-OP4MOGXF.js";
54
42
  import {
55
43
  init_esbuild_shims
56
44
  } from "./chunk-5O2XNYP6.js";
@@ -1706,1804 +1694,9 @@ var require_cli_spinners = __commonJS({
1706
1694
  }
1707
1695
  });
1708
1696
 
1709
- // packages/cli/src/ui/contexts/KeypressContext.tsx
1710
- init_esbuild_shims();
1711
- var import_react3 = __toESM(require_react(), 1);
1712
- import readline from "node:readline";
1713
- import { PassThrough } from "node:stream";
1714
-
1715
- // packages/cli/src/ui/utils/mouse.ts
1716
- init_esbuild_shims();
1717
- var ESC = "\x1B";
1718
- var SGR_EVENT_PREFIX = `${ESC}[<`;
1719
- var X11_EVENT_PREFIX = `${ESC}[M`;
1720
- var MAX_SGR_MOUSE_SEQUENCE_LENGTH = 50;
1721
- var SGR_MOUSE_REGEX = /^\x1b\[<(\d+);(\d+);(\d+)([mM])/;
1722
- function getEventName(buttonCode, isRelease) {
1723
- const isMove = (buttonCode & 32) !== 0;
1724
- if (buttonCode === 66) return "scroll-left";
1725
- if (buttonCode === 67) return "scroll-right";
1726
- if ((buttonCode & 64) === 64) {
1727
- return (buttonCode & 1) === 0 ? "scroll-up" : "scroll-down";
1728
- }
1729
- if (isMove) return "move";
1730
- const button = buttonCode & 3;
1731
- const type = isRelease ? "release" : "press";
1732
- switch (button) {
1733
- case 0:
1734
- return `left-${type}`;
1735
- case 1:
1736
- return `middle-${type}`;
1737
- case 2:
1738
- return `right-${type}`;
1739
- default:
1740
- return null;
1741
- }
1742
- }
1743
- __name(getEventName, "getEventName");
1744
- function buttonFromCode(code) {
1745
- switch (code & 3) {
1746
- case 0:
1747
- return "left";
1748
- case 1:
1749
- return "middle";
1750
- case 2:
1751
- return "right";
1752
- default:
1753
- return "none";
1754
- }
1755
- }
1756
- __name(buttonFromCode, "buttonFromCode");
1757
- function parseSGRMouseEvent(buffer) {
1758
- const match = buffer.match(SGR_MOUSE_REGEX);
1759
- if (!match) return null;
1760
- const buttonCode = parseInt(match[1], 10);
1761
- const col = parseInt(match[2], 10);
1762
- const row = parseInt(match[3], 10);
1763
- const isRelease = match[4] === "m";
1764
- const name = getEventName(buttonCode, isRelease);
1765
- if (!name) return null;
1766
- return {
1767
- event: {
1768
- name,
1769
- col,
1770
- row,
1771
- shift: (buttonCode & 4) !== 0,
1772
- meta: (buttonCode & 8) !== 0,
1773
- ctrl: (buttonCode & 16) !== 0,
1774
- button: buttonFromCode(buttonCode)
1775
- },
1776
- length: match[0].length
1777
- };
1778
- }
1779
- __name(parseSGRMouseEvent, "parseSGRMouseEvent");
1780
- var ENABLE_SGR_MOUSE = {
1781
- button: "\x1B[?1002h\x1B[?1006h",
1782
- any: "\x1B[?1003h\x1B[?1006h"
1783
- };
1784
- var DISABLE_SGR_MOUSE = {
1785
- button: "\x1B[?1006l\x1B[?1002l",
1786
- any: "\x1B[?1006l\x1B[?1003l"
1787
- };
1788
- function enableMouseEvents(stdout, tracking = "button") {
1789
- stdout.write(ENABLE_SGR_MOUSE[tracking]);
1790
- }
1791
- __name(enableMouseEvents, "enableMouseEvents");
1792
- function disableMouseEvents(stdout, tracking = "button") {
1793
- stdout.write(DISABLE_SGR_MOUSE[tracking]);
1794
- }
1795
- __name(disableMouseEvents, "disableMouseEvents");
1796
-
1797
- // packages/cli/src/ui/utils/platformConstants.ts
1798
- init_esbuild_shims();
1799
- var KITTY_CTRL_C = "[99;5u";
1800
- var KITTY_KEYCODE_ENTER = 13;
1801
- var KITTY_KEYCODE_NUMPAD_ENTER = 57414;
1802
- var KITTY_KEYCODE_TAB = 9;
1803
- var KITTY_KEYCODE_BACKSPACE = 127;
1804
- var KITTY_MODIFIER_BASE = 1;
1805
- var KITTY_MODIFIER_EVENT_TYPES_OFFSET = 128;
1806
- var MODIFIER_SHIFT_BIT = 1;
1807
- var MODIFIER_ALT_BIT = 2;
1808
- var MODIFIER_CTRL_BIT = 4;
1809
- var VSCODE_SHIFT_ENTER_SEQUENCE = "\\\r\n";
1810
- var BACKSLASH_ENTER_DETECTION_WINDOW_MS = 5;
1811
- var MAX_KITTY_SEQUENCE_LENGTH = 32;
1812
- var CHAR_CODE_ESC = 27;
1813
-
1814
- // packages/cli/src/ui/utils/clipboardUtils.ts
1815
- init_esbuild_shims();
1816
- import * as fs from "node:fs/promises";
1817
- import { constants as fsConstants } from "node:fs";
1818
- import { execSync, spawn } from "node:child_process";
1819
- import * as path from "node:path";
1820
- import { randomUUID } from "node:crypto";
1821
-
1822
- // packages/cli/src/utils/osc.ts
1823
- init_esbuild_shims();
1824
- var ESC2 = "\x1B";
1825
- var BEL = "\x07";
1826
- var ST = ESC2 + "\\";
1827
- var OSC_PREFIX = ESC2 + "]";
1828
- var SEP = ";";
1829
- var OSC = {
1830
- /** iTerm2 notification / progress */
1831
- ITERM2: 9,
1832
- /** Kitty desktop notification protocol */
1833
- KITTY: 99,
1834
- /** Ghostty / cmux notification */
1835
- GHOSTTY: 777
1836
- };
1837
- function detectTerminal() {
1838
- const termProgram = process.env["TERM_PROGRAM"];
1839
- switch (termProgram) {
1840
- case "iTerm.app":
1841
- return "iTerm.app";
1842
- case "kitty":
1843
- return "kitty";
1844
- case "ghostty":
1845
- return "ghostty";
1846
- case "Apple_Terminal":
1847
- return "Apple_Terminal";
1848
- default:
1849
- break;
1850
- }
1851
- if (process.env["TERM"] === "xterm-ghostty") {
1852
- return "ghostty";
1853
- }
1854
- if (process.env["TERM"]?.includes("kitty")) {
1855
- return "kitty";
1856
- }
1857
- if (process.env["KITTY_WINDOW_ID"]) return "kitty";
1858
- return "unknown";
1859
- }
1860
- __name(detectTerminal, "detectTerminal");
1861
- function sanitizeOscPayload(text) {
1862
- return text.replace(/[\x00-\x08\x0b\x0c\x0e-\x1f\x7f\x80-\x9f]/g, "");
1863
- }
1864
- __name(sanitizeOscPayload, "sanitizeOscPayload");
1865
- function osc(...parts) {
1866
- const isKitty = detectTerminal() === "kitty";
1867
- const inScreen = !!process.env["STY"];
1868
- const terminator = isKitty && !inScreen ? ST : BEL;
1869
- const sanitized = parts.map(
1870
- (p) => typeof p === "string" ? sanitizeOscPayload(p) : p
1871
- );
1872
- return `${OSC_PREFIX}${sanitized.join(SEP)}${terminator}`;
1873
- }
1874
- __name(osc, "osc");
1875
- function wrapForMultiplexer(sequence) {
1876
- if (process.env["TMUX"]) {
1877
- const escaped = sequence.replaceAll("\x1B", "\x1B\x1B");
1878
- return `\x1BPtmux;${escaped}\x1B\\`;
1879
- }
1880
- if (process.env["STY"]) {
1881
- return `\x1BP${sequence}\x1B\\`;
1882
- }
1883
- return sequence;
1884
- }
1885
- __name(wrapForMultiplexer, "wrapForMultiplexer");
1886
- function encodeKittyPayload(text) {
1887
- return Buffer.from(text, "utf8").toString("base64");
1888
- }
1889
- __name(encodeKittyPayload, "encodeKittyPayload");
1890
- function oscITerm2Notify(title, message) {
1891
- const displayString = title ? `${title}:
1892
- ${message}` : message;
1893
- return osc(OSC.ITERM2, `
1894
-
1895
- ${displayString}`);
1896
- }
1897
- __name(oscITerm2Notify, "oscITerm2Notify");
1898
- function oscKittyNotify(title, message, id) {
1899
- return [
1900
- osc(OSC.KITTY, `i=${id}:d=0:p=title:e=1`, encodeKittyPayload(title)),
1901
- osc(OSC.KITTY, `i=${id}:p=body:e=1`, encodeKittyPayload(message)),
1902
- osc(OSC.KITTY, `i=${id}:d=1:a=focus`, "")
1903
- ];
1904
- }
1905
- __name(oscKittyNotify, "oscKittyNotify");
1906
- function oscGhosttyNotify(title, message) {
1907
- return osc(OSC.GHOSTTY, "notify", title, message);
1908
- }
1909
- __name(oscGhosttyNotify, "oscGhosttyNotify");
1910
- function generateKittyId() {
1911
- return Math.floor(Math.random() * 2 ** 31);
1912
- }
1913
- __name(generateKittyId, "generateKittyId");
1914
-
1915
- // packages/cli/src/ui/utils/clipboardUtils.ts
1916
- var debugLogger = createDebugLogger("CLIPBOARD_UTILS");
1917
- var PROCESS_TIMEOUT_MS = 5e3;
1918
- function writeOsc52(text) {
1919
- try {
1920
- const MAX_OSC52_BYTES = 75e3;
1921
- if (Buffer.byteLength(text, "utf-8") > MAX_OSC52_BYTES) {
1922
- debugLogger.warn(
1923
- `writeOsc52: text too large (${Buffer.byteLength(text, "utf-8")} bytes), skipping`
1924
- );
1925
- return false;
1926
- }
1927
- const base64 = Buffer.from(text, "utf-8").toString("base64");
1928
- const sequence = wrapForMultiplexer(`\x1B]52;c;${base64}\x07`);
1929
- const stream = process.stderr.isTTY ? process.stderr : process.stdout.isTTY ? process.stdout : null;
1930
- if (!stream) {
1931
- debugLogger.warn(
1932
- "OSC 52 clipboard requires a TTY; stdout/stderr not connected to terminal"
1933
- );
1934
- return false;
1935
- }
1936
- stream.write(sequence, (err) => {
1937
- if (err) debugLogger.warn("writeOsc52: async write failed:", err);
1938
- });
1939
- return true;
1940
- } catch (e) {
1941
- debugLogger.warn("writeOsc52 failed:", e);
1942
- return false;
1943
- }
1944
- }
1945
- __name(writeOsc52, "writeOsc52");
1946
- var linuxClipboardTool;
1947
- var cachedWlPasteImageTypes = null;
1948
- var clipboardModulePromise = null;
1949
- async function getClipboardModule() {
1950
- if (!clipboardModulePromise) {
1951
- const modName = "@teddyzhu/clipboard";
1952
- clipboardModulePromise = import(modName).catch(() => {
1953
- debugLogger.error(
1954
- "Failed to load @teddyzhu/clipboard native module. Clipboard image features will be unavailable."
1955
- );
1956
- return null;
1957
- });
1958
- }
1959
- return clipboardModulePromise;
1960
- }
1961
- __name(getClipboardModule, "getClipboardModule");
1962
- function getLinuxClipboardTool() {
1963
- if (linuxClipboardTool !== void 0) return linuxClipboardTool;
1964
- const sessionType = process.env["XDG_SESSION_TYPE"];
1965
- const waylandDisplay = process.env["WAYLAND_DISPLAY"];
1966
- const display = process.env["DISPLAY"];
1967
- let toolName = null;
1968
- if (sessionType === "wayland" || waylandDisplay) {
1969
- toolName = "wl-paste";
1970
- } else if (sessionType === "x11" || display) {
1971
- toolName = "xclip";
1972
- } else {
1973
- linuxClipboardTool = null;
1974
- return null;
1975
- }
1976
- try {
1977
- execSync("command -v " + toolName, { stdio: "ignore" });
1978
- linuxClipboardTool = toolName;
1979
- return toolName;
1980
- } catch {
1981
- debugLogger.warn(`${toolName} not found`);
1982
- linuxClipboardTool = null;
1983
- return null;
1984
- }
1985
- }
1986
- __name(getLinuxClipboardTool, "getLinuxClipboardTool");
1987
- async function saveFromCommand(command, args, destination) {
1988
- let fd;
1989
- try {
1990
- fd = await fs.open(
1991
- destination,
1992
- fsConstants.O_WRONLY | fsConstants.O_CREAT | fsConstants.O_EXCL
1993
- );
1994
- } catch {
1995
- return false;
1996
- }
1997
- return new Promise((resolve) => {
1998
- const child = spawn(command, args, {
1999
- stdio: ["ignore", "pipe", "pipe"]
2000
- });
2001
- const fileStream = fd.createWriteStream();
2002
- let stderr = "";
2003
- let resolved = false;
2004
- const safeResolve = /* @__PURE__ */ __name((value) => {
2005
- if (!resolved) {
2006
- resolved = true;
2007
- try {
2008
- if (!child.killed) child.kill();
2009
- } catch {
2010
- }
2011
- try {
2012
- fileStream.destroy();
2013
- } catch {
2014
- }
2015
- resolve(value);
2016
- }
2017
- }, "safeResolve");
2018
- const timer = setTimeout(() => {
2019
- debugLogger.debug(`${command} timed out after ${PROCESS_TIMEOUT_MS}ms`);
2020
- safeResolve(false);
2021
- }, PROCESS_TIMEOUT_MS);
2022
- child.stderr.on("data", (data) => {
2023
- stderr += data.toString();
2024
- });
2025
- child.stdout.pipe(fileStream);
2026
- child.stdout.on("error", (err) => {
2027
- debugLogger.debug(`stdout error for ${command}:`, err);
2028
- clearTimeout(timer);
2029
- safeResolve(false);
2030
- });
2031
- child.on("error", (err) => {
2032
- debugLogger.debug(`Failed to spawn ${command}:`, err);
2033
- clearTimeout(timer);
2034
- safeResolve(false);
2035
- });
2036
- fileStream.on("error", (err) => {
2037
- debugLogger.debug(`File stream error for ${destination}:`, err);
2038
- clearTimeout(timer);
2039
- safeResolve(false);
2040
- });
2041
- child.on("close", (code) => {
2042
- clearTimeout(timer);
2043
- if (resolved) return;
2044
- if (code !== 0) {
2045
- debugLogger.debug(
2046
- `${command} exited with code ${code}. Args: ${args.join(" ")}`
2047
- );
2048
- if (stderr) debugLogger.debug(`${command} stderr: ${stderr.trim()}`);
2049
- safeResolve(false);
2050
- return;
2051
- }
2052
- const checkFile = /* @__PURE__ */ __name(() => {
2053
- fs.stat(destination).then((stats) => {
2054
- safeResolve(stats.size > 0);
2055
- }).catch(() => {
2056
- safeResolve(false);
2057
- });
2058
- }, "checkFile");
2059
- if (fileStream.writableFinished) {
2060
- checkFile();
2061
- } else {
2062
- fileStream.on("finish", checkFile);
2063
- fileStream.on("close", () => {
2064
- if (!resolved) checkFile();
2065
- });
2066
- }
2067
- });
2068
- });
2069
- }
2070
- __name(saveFromCommand, "saveFromCommand");
2071
- async function checkClipboardForImage(command, args) {
2072
- if (command === "wl-paste" && args.length === 1 && args[0] === "--list-types") {
2073
- const types = await getWlPasteImageTypes();
2074
- return types.length > 0;
2075
- }
2076
- return new Promise((resolve) => {
2077
- try {
2078
- const child = spawn(command, args, {
2079
- stdio: ["ignore", "pipe", "ignore"]
2080
- });
2081
- let stdout = "";
2082
- const timer = setTimeout(() => {
2083
- try {
2084
- child.kill();
2085
- } catch {
2086
- }
2087
- resolve(false);
2088
- }, PROCESS_TIMEOUT_MS);
2089
- child.stdout.on("data", (data) => {
2090
- stdout += data.toString();
2091
- });
2092
- child.on("close", (code) => {
2093
- clearTimeout(timer);
2094
- resolve(
2095
- code === 0 && stdout.split("\n").some((line) => line === "image/png" || line === "image/bmp")
2096
- );
2097
- });
2098
- child.on("error", () => {
2099
- clearTimeout(timer);
2100
- resolve(false);
2101
- });
2102
- } catch {
2103
- resolve(false);
2104
- }
2105
- });
2106
- }
2107
- __name(checkClipboardForImage, "checkClipboardForImage");
2108
- async function clipboardHasImage(onUnavailable) {
2109
- cachedWlPasteImageTypes = null;
2110
- if (process.platform === "linux") {
2111
- try {
2112
- const tool = getLinuxClipboardTool();
2113
- if (tool === "wl-paste") {
2114
- return checkClipboardForImage("wl-paste", ["--list-types"]);
2115
- }
2116
- if (tool === "xclip") {
2117
- return checkClipboardForImage("xclip", [
2118
- "-selection",
2119
- "clipboard",
2120
- "-t",
2121
- "TARGETS",
2122
- "-o"
2123
- ]);
2124
- }
2125
- } catch (error) {
2126
- debugLogger.error("Error checking clipboard for image:", error);
2127
- }
2128
- return false;
2129
- }
2130
- try {
2131
- const mod = await getClipboardModule();
2132
- if (!mod) {
2133
- onUnavailable?.();
2134
- return false;
2135
- }
2136
- const clipboard = new mod.ClipboardManager();
2137
- return clipboard.hasFormat("image");
2138
- } catch (error) {
2139
- debugLogger.error("Error checking clipboard for image:", error);
2140
- return false;
2141
- }
2142
- }
2143
- __name(clipboardHasImage, "clipboardHasImage");
2144
- async function getWlPasteImageTypes() {
2145
- if (cachedWlPasteImageTypes !== null) {
2146
- return cachedWlPasteImageTypes;
2147
- }
2148
- return new Promise((resolve) => {
2149
- const child = spawn("wl-paste", ["--list-types"], {
2150
- stdio: ["ignore", "pipe", "ignore"]
2151
- });
2152
- let stdout = "";
2153
- const timer = setTimeout(() => {
2154
- try {
2155
- child.kill();
2156
- } catch {
2157
- }
2158
- resolve([]);
2159
- }, PROCESS_TIMEOUT_MS);
2160
- child.stdout.on("data", (data) => {
2161
- stdout += data.toString();
2162
- });
2163
- child.on("close", (code) => {
2164
- clearTimeout(timer);
2165
- if (code !== 0) {
2166
- resolve([]);
2167
- return;
2168
- }
2169
- const types = stdout.trim().split("\n").filter((t2) => t2 === "image/png" || t2 === "image/bmp");
2170
- cachedWlPasteImageTypes = types;
2171
- resolve(types);
2172
- });
2173
- child.on("error", () => {
2174
- clearTimeout(timer);
2175
- resolve([]);
2176
- });
2177
- });
2178
- }
2179
- __name(getWlPasteImageTypes, "getWlPasteImageTypes");
2180
- async function saveFileWithWlPaste(tempFilePath) {
2181
- const imageTypes = await getWlPasteImageTypes();
2182
- if (imageTypes.includes("image/png")) {
2183
- const success = await saveFromCommand(
2184
- "wl-paste",
2185
- ["--no-newline", "--type", "image/png"],
2186
- tempFilePath
2187
- );
2188
- if (success) return tempFilePath;
2189
- try {
2190
- await fs.unlink(tempFilePath);
2191
- } catch {
2192
- }
2193
- }
2194
- if (imageTypes.includes("image/bmp")) {
2195
- const bmpPath = tempFilePath.replace(/\.png$/, ".bmp");
2196
- const bmpSuccess = await saveFromCommand(
2197
- "wl-paste",
2198
- ["--no-newline", "--type", "image/bmp"],
2199
- bmpPath
2200
- );
2201
- if (bmpSuccess) {
2202
- try {
2203
- await new Promise((resolve, reject) => {
2204
- const child = spawn(
2205
- "python3",
2206
- [
2207
- "-c",
2208
- "import sys; from PIL import Image; Image.open(sys.argv[1]).save(sys.argv[2])",
2209
- bmpPath,
2210
- tempFilePath
2211
- ],
2212
- { stdio: ["ignore", "ignore", "pipe"] }
2213
- );
2214
- let stderr = "";
2215
- child.stderr.on("data", (d) => {
2216
- stderr += d.toString();
2217
- });
2218
- const timer = setTimeout(() => {
2219
- try {
2220
- child.kill();
2221
- } catch {
2222
- }
2223
- reject(new Error("python3 timed out"));
2224
- }, PROCESS_TIMEOUT_MS);
2225
- child.on("close", (code) => {
2226
- clearTimeout(timer);
2227
- if (code === 0) resolve();
2228
- else
2229
- reject(
2230
- new Error(
2231
- `python3 exited with code ${code}${stderr ? ": " + stderr.trim() : ""}`
2232
- )
2233
- );
2234
- });
2235
- child.on("error", (err) => {
2236
- clearTimeout(timer);
2237
- reject(err);
2238
- });
2239
- });
2240
- try {
2241
- await fs.unlink(bmpPath);
2242
- } catch {
2243
- }
2244
- return tempFilePath;
2245
- } catch (err) {
2246
- debugLogger.warn(
2247
- "BMP-to-PNG conversion failed (install python3-pil for BMP support):",
2248
- err
2249
- );
2250
- try {
2251
- await fs.unlink(bmpPath);
2252
- } catch {
2253
- }
2254
- try {
2255
- await fs.unlink(tempFilePath);
2256
- } catch {
2257
- }
2258
- return false;
2259
- }
2260
- }
2261
- try {
2262
- await fs.unlink(bmpPath);
2263
- } catch {
2264
- }
2265
- }
2266
- return false;
2267
- }
2268
- __name(saveFileWithWlPaste, "saveFileWithWlPaste");
2269
- async function saveFileWithXclip(tempFilePath) {
2270
- const success = await saveFromCommand(
2271
- "xclip",
2272
- ["-selection", "clipboard", "-t", "image/png", "-o"],
2273
- tempFilePath
2274
- );
2275
- if (success) return true;
2276
- try {
2277
- await fs.unlink(tempFilePath);
2278
- } catch {
2279
- }
2280
- return false;
2281
- }
2282
- __name(saveFileWithXclip, "saveFileWithXclip");
2283
- async function saveClipboardImage(targetDir) {
2284
- try {
2285
- const baseDir = targetDir || process.cwd();
2286
- const tempDir = path.join(baseDir, "clipboard");
2287
- await fs.mkdir(tempDir, { recursive: true });
2288
- const timestamp = (/* @__PURE__ */ new Date()).getTime();
2289
- if (process.platform === "linux") {
2290
- const pngPath = path.join(
2291
- tempDir,
2292
- `clipboard-${timestamp}-${randomUUID()}.png`
2293
- );
2294
- const tool = getLinuxClipboardTool();
2295
- if (tool === "wl-paste") {
2296
- const savedPath = await saveFileWithWlPaste(pngPath);
2297
- if (savedPath) {
2298
- try {
2299
- const stats = await fs.stat(savedPath);
2300
- if (stats.size > 0) return savedPath;
2301
- await fs.unlink(savedPath);
2302
- } catch {
2303
- }
2304
- }
2305
- return null;
2306
- }
2307
- if (tool === "xclip") {
2308
- if (await saveFileWithXclip(pngPath)) return pngPath;
2309
- return null;
2310
- }
2311
- return null;
2312
- }
2313
- const mod = await getClipboardModule();
2314
- if (!mod) return null;
2315
- const clipboard = new mod.ClipboardManager();
2316
- if (!clipboard.hasFormat("image")) {
2317
- return null;
2318
- }
2319
- const tempFilePath = path.join(
2320
- tempDir,
2321
- `clipboard-${timestamp}-${randomUUID()}.png`
2322
- );
2323
- const imageData = clipboard.getImageData();
2324
- const buffer = imageData.data;
2325
- if (!buffer) {
2326
- return null;
2327
- }
2328
- await fs.writeFile(tempFilePath, buffer);
2329
- return tempFilePath;
2330
- } catch (error) {
2331
- debugLogger.error("Error saving clipboard image:", error);
2332
- return null;
2333
- }
2334
- }
2335
- __name(saveClipboardImage, "saveClipboardImage");
2336
- async function cleanupOldClipboardImages(targetDir) {
2337
- try {
2338
- const baseDir = targetDir || process.cwd();
2339
- const tempDir = path.join(baseDir, "clipboard");
2340
- const files = await fs.readdir(tempDir);
2341
- const MAX_IMAGES = 100;
2342
- const CLEANUP_COUNT = 50;
2343
- const imageFiles = [];
2344
- for (const file of files) {
2345
- if (file.startsWith("clipboard-") && (file.endsWith(".png") || file.endsWith(".jpg") || file.endsWith(".webp") || file.endsWith(".heic") || file.endsWith(".heif") || file.endsWith(".tiff") || file.endsWith(".gif") || file.endsWith(".bmp"))) {
2346
- const filePath = path.join(tempDir, file);
2347
- const stats = await fs.stat(filePath);
2348
- imageFiles.push({
2349
- name: file,
2350
- path: filePath,
2351
- atime: stats.atimeMs
2352
- });
2353
- }
2354
- }
2355
- if (imageFiles.length > MAX_IMAGES) {
2356
- imageFiles.sort((a, b) => a.atime - b.atime);
2357
- const removeCount = Math.min(
2358
- CLEANUP_COUNT,
2359
- imageFiles.length - MAX_IMAGES + CLEANUP_COUNT
2360
- );
2361
- const filesToRemove = imageFiles.slice(0, removeCount);
2362
- for (const file of filesToRemove) {
2363
- await fs.unlink(file.path);
2364
- }
2365
- }
2366
- } catch {
2367
- }
2368
- }
2369
- __name(cleanupOldClipboardImages, "cleanupOldClipboardImages");
2370
-
2371
- // packages/cli/src/ui/hooks/useFocus.ts
2372
- init_esbuild_shims();
2373
- var import_react2 = __toESM(require_react(), 1);
2374
-
2375
- // packages/cli/src/ui/hooks/useKeypress.ts
2376
- init_esbuild_shims();
2377
- var import_react = __toESM(require_react(), 1);
2378
- function useKeypress(onKeypress, { isActive }) {
2379
- const { subscribe, unsubscribe } = useKeypressContext();
2380
- const onKeypressRef = (0, import_react.useRef)(onKeypress);
2381
- onKeypressRef.current = onKeypress;
2382
- const handleKeypress = (0, import_react.useCallback)((key) => {
2383
- onKeypressRef.current(key);
2384
- }, []);
2385
- (0, import_react.useEffect)(() => {
2386
- if (!isActive) {
2387
- return;
2388
- }
2389
- subscribe(handleKeypress);
2390
- return () => {
2391
- unsubscribe(handleKeypress);
2392
- };
2393
- }, [isActive, handleKeypress, subscribe, unsubscribe]);
2394
- }
2395
- __name(useKeypress, "useKeypress");
2396
-
2397
- // packages/cli/src/ui/hooks/useFocus.ts
2398
- var ENABLE_FOCUS_REPORTING = "\x1B[?1004h";
2399
- var DISABLE_FOCUS_REPORTING = "\x1B[?1004l";
2400
- var FOCUS_IN = "\x1B[I";
2401
- var FOCUS_OUT = "\x1B[O";
2402
- var useFocus = /* @__PURE__ */ __name(() => {
2403
- const { stdin } = use_stdin_default();
2404
- const { stdout } = use_stdout_default();
2405
- const [isFocused, setIsFocused] = (0, import_react2.useState)(true);
2406
- (0, import_react2.useEffect)(() => {
2407
- const handleData = /* @__PURE__ */ __name((data) => {
2408
- const sequence = data.toString();
2409
- const lastFocusIn = sequence.lastIndexOf(FOCUS_IN);
2410
- const lastFocusOut = sequence.lastIndexOf(FOCUS_OUT);
2411
- if (lastFocusIn > lastFocusOut) {
2412
- setIsFocused(true);
2413
- } else if (lastFocusOut > lastFocusIn) {
2414
- setIsFocused(false);
2415
- }
2416
- }, "handleData");
2417
- stdout?.write(ENABLE_FOCUS_REPORTING);
2418
- stdin?.on("data", handleData);
2419
- return () => {
2420
- stdout?.write(DISABLE_FOCUS_REPORTING);
2421
- stdin?.removeListener("data", handleData);
2422
- };
2423
- }, [stdin, stdout]);
2424
- useKeypress(
2425
- (_) => {
2426
- if (!isFocused) {
2427
- setIsFocused(true);
2428
- }
2429
- },
2430
- { isActive: true }
2431
- );
2432
- return isFocused;
2433
- }, "useFocus");
2434
-
2435
- // packages/cli/src/ui/contexts/KeypressContext.tsx
2436
- var import_jsx_runtime = __toESM(require_jsx_runtime(), 1);
2437
- var ESC3 = "\x1B";
2438
- var OPTION_T_COMPOSED_GLYPH = "\u2020";
2439
- var PASTE_MODE_PREFIX = `${ESC3}[200~`;
2440
- var PASTE_MODE_SUFFIX = `${ESC3}[201~`;
2441
- var KITTY_SEQUENCE_TIMEOUT_MS = 200;
2442
- var PASTE_IDLE_TIMEOUT_MS = 1e3;
2443
- var KITTY_KEYPAD_PRINTABLE_KEYCODE_TO_CHAR = {
2444
- 57399: "0",
2445
- 57400: "1",
2446
- 57401: "2",
2447
- 57402: "3",
2448
- 57403: "4",
2449
- 57404: "5",
2450
- 57405: "6",
2451
- 57406: "7",
2452
- 57407: "8",
2453
- 57408: "9",
2454
- 57409: ".",
2455
- 57410: "/",
2456
- 57411: "*",
2457
- 57412: "-",
2458
- 57413: "+",
2459
- // 57414 is keypad Enter - handled separately via CSI~ sequence
2460
- 57415: "=",
2461
- 57416: ","
2462
- };
2463
- var KITTY_KEYPAD_FUNCTIONAL_KEYCODE_TO_NAME = {
2464
- 57417: "left",
2465
- 57418: "right",
2466
- 57419: "up",
2467
- 57420: "down",
2468
- 57421: "pageup",
2469
- 57422: "pagedown",
2470
- 57423: "home",
2471
- 57424: "end",
2472
- 57425: "insert",
2473
- 57426: "delete"
2474
- };
2475
- var KeypressContext = (0, import_react3.createContext)(
2476
- void 0
2477
- );
2478
- var debugLogger2 = createDebugLogger("KEYPRESS");
2479
- function useKeypressContext() {
2480
- const context = (0, import_react3.useContext)(KeypressContext);
2481
- if (!context) {
2482
- throw new Error(
2483
- "useKeypressContext must be used within a KeypressProvider"
2484
- );
2485
- }
2486
- return context;
2487
- }
2488
- __name(useKeypressContext, "useKeypressContext");
2489
- function KeypressProvider({
2490
- children,
2491
- kittyProtocolEnabled,
2492
- pasteWorkaround = false,
2493
- config,
2494
- debugKeystrokeLogging,
2495
- initialCapturedInput
2496
- }) {
2497
- const { stdin, setRawMode } = use_stdin_default();
2498
- const subscribers = (0, import_react3.useRef)(/* @__PURE__ */ new Set()).current;
2499
- const mouseSubscribers = (0, import_react3.useRef)(/* @__PURE__ */ new Set()).current;
2500
- const subscribe = (0, import_react3.useCallback)(
2501
- (handler) => {
2502
- subscribers.add(handler);
2503
- },
2504
- [subscribers]
2505
- );
2506
- const unsubscribe = (0, import_react3.useCallback)(
2507
- (handler) => {
2508
- subscribers.delete(handler);
2509
- },
2510
- [subscribers]
2511
- );
2512
- const subscribeMouse = (0, import_react3.useCallback)(
2513
- (handler) => {
2514
- mouseSubscribers.add(handler);
2515
- },
2516
- [mouseSubscribers]
2517
- );
2518
- const unsubscribeMouse = (0, import_react3.useCallback)(
2519
- (handler) => {
2520
- mouseSubscribers.delete(handler);
2521
- },
2522
- [mouseSubscribers]
2523
- );
2524
- (0, import_react3.useEffect)(() => {
2525
- setRawMode(true);
2526
- const capturedInput = initialCapturedInput ?? Buffer.alloc(0);
2527
- const keypressStream = new PassThrough();
2528
- let usePassthrough = false;
2529
- if (pasteWorkaround) {
2530
- usePassthrough = true;
2531
- }
2532
- let isPaste = false;
2533
- let pasteBuffer = Buffer.alloc(0);
2534
- let pasteAlreadyFlushed = false;
2535
- let pasteIdleTimeout = null;
2536
- const kittySequenceBufferRef = { current: "" };
2537
- let kittySequenceTimeout = null;
2538
- let backslashTimeout = null;
2539
- let waitingForEnterAfterBackslash = false;
2540
- let rawDataBuffer = Buffer.alloc(0);
2541
- let rawFlushTimeout = null;
2542
- let swallowingSgrMouse = false;
2543
- let sgrMouseBuffer = "";
2544
- let sgrMouseTimeout = null;
2545
- const resetSgrMouse = /* @__PURE__ */ __name(() => {
2546
- swallowingSgrMouse = false;
2547
- sgrMouseBuffer = "";
2548
- if (sgrMouseTimeout) {
2549
- clearTimeout(sgrMouseTimeout);
2550
- sgrMouseTimeout = null;
2551
- }
2552
- }, "resetSgrMouse");
2553
- const updateKittyBuffer = /* @__PURE__ */ __name((value) => {
2554
- kittySequenceBufferRef.current = value;
2555
- }, "updateKittyBuffer");
2556
- const clearKittyTimeout = /* @__PURE__ */ __name(() => {
2557
- if (kittySequenceTimeout) {
2558
- clearTimeout(kittySequenceTimeout);
2559
- kittySequenceTimeout = null;
2560
- }
2561
- }, "clearKittyTimeout");
2562
- const startKittyTimeout = /* @__PURE__ */ __name(() => {
2563
- clearKittyTimeout();
2564
- kittySequenceTimeout = setTimeout(() => {
2565
- if (kittySequenceBufferRef.current) {
2566
- while (kittySequenceBufferRef.current) {
2567
- const parsed = parseKittyPrefix(kittySequenceBufferRef.current);
2568
- if (parsed) {
2569
- kittySequenceBufferRef.current = kittySequenceBufferRef.current.slice(parsed.length);
2570
- broadcast(parsed.key);
2571
- continue;
2572
- }
2573
- const plain = parsePlainTextPrefix(kittySequenceBufferRef.current);
2574
- if (plain) {
2575
- kittySequenceBufferRef.current = kittySequenceBufferRef.current.slice(plain.length);
2576
- broadcast(plain.key);
2577
- continue;
2578
- }
2579
- break;
2580
- }
2581
- if (kittySequenceBufferRef.current) {
2582
- if (debugKeystrokeLogging) {
2583
- debugLogger2.debug(
2584
- "[DEBUG] Kitty buffer timeout, clearing:",
2585
- kittySequenceBufferRef.current
2586
- );
2587
- }
2588
- kittySequenceBufferRef.current = "";
2589
- }
2590
- }
2591
- }, KITTY_SEQUENCE_TIMEOUT_MS);
2592
- }, "startKittyTimeout");
2593
- const clearKittyBufferAndTimeout = /* @__PURE__ */ __name(() => {
2594
- clearKittyTimeout();
2595
- kittySequenceBufferRef.current = "";
2596
- }, "clearKittyBufferAndTimeout");
2597
- const clearPasteIdleTimeout = /* @__PURE__ */ __name(() => {
2598
- if (pasteIdleTimeout) {
2599
- clearTimeout(pasteIdleTimeout);
2600
- pasteIdleTimeout = null;
2601
- }
2602
- }, "clearPasteIdleTimeout");
2603
- const forceFlushStuckPaste = /* @__PURE__ */ __name(() => {
2604
- clearPasteIdleTimeout();
2605
- if (!isPaste && pasteBuffer.length === 0) return;
2606
- const buffered = pasteBuffer.toString();
2607
- isPaste = false;
2608
- pasteBuffer = Buffer.alloc(0);
2609
- pasteAlreadyFlushed = true;
2610
- if (buffered.length > 0) {
2611
- broadcast({
2612
- name: "",
2613
- ctrl: false,
2614
- meta: false,
2615
- shift: false,
2616
- paste: true,
2617
- sequence: buffered
2618
- });
2619
- }
2620
- }, "forceFlushStuckPaste");
2621
- const startPasteIdleTimeout = /* @__PURE__ */ __name(() => {
2622
- clearPasteIdleTimeout();
2623
- pasteIdleTimeout = setTimeout(
2624
- forceFlushStuckPaste,
2625
- PASTE_IDLE_TIMEOUT_MS
2626
- );
2627
- }, "startPasteIdleTimeout");
2628
- const createPrintableKey = /* @__PURE__ */ __name((char) => {
2629
- const printableName = char === " " ? "space" : /^[A-Za-z]$/.test(char) ? char.toLowerCase() : char;
2630
- return {
2631
- name: printableName,
2632
- ctrl: false,
2633
- meta: false,
2634
- shift: false,
2635
- paste: false,
2636
- sequence: char,
2637
- kittyProtocol: true
2638
- };
2639
- }, "createPrintableKey");
2640
- const parseKittyPrefix = /* @__PURE__ */ __name((buffer) => {
2641
- const revTabLegacy = new RegExp(`^${ESC3}\\[Z`);
2642
- let m = buffer.match(revTabLegacy);
2643
- if (m) {
2644
- return {
2645
- key: {
2646
- name: "tab",
2647
- ctrl: false,
2648
- meta: false,
2649
- shift: true,
2650
- paste: false,
2651
- sequence: buffer.slice(0, m[0].length),
2652
- kittyProtocol: true
2653
- },
2654
- length: m[0].length
2655
- };
2656
- }
2657
- const revTabParam = new RegExp(`^${ESC3}\\[1;(\\d+)Z`);
2658
- m = buffer.match(revTabParam);
2659
- if (m) {
2660
- let mods = parseInt(m[1], 10);
2661
- if (mods >= KITTY_MODIFIER_EVENT_TYPES_OFFSET) {
2662
- mods -= KITTY_MODIFIER_EVENT_TYPES_OFFSET;
2663
- }
2664
- const bits = mods - KITTY_MODIFIER_BASE;
2665
- const alt = (bits & MODIFIER_ALT_BIT) === MODIFIER_ALT_BIT;
2666
- const ctrl = (bits & MODIFIER_CTRL_BIT) === MODIFIER_CTRL_BIT;
2667
- return {
2668
- key: {
2669
- name: "tab",
2670
- ctrl,
2671
- meta: alt,
2672
- // Reverse tab implies Shift behavior; force shift regardless of mods
2673
- shift: true,
2674
- paste: false,
2675
- sequence: buffer.slice(0, m[0].length),
2676
- kittyProtocol: true
2677
- },
2678
- length: m[0].length
2679
- };
2680
- }
2681
- const arrowPrefix = new RegExp(`^${ESC3}\\[1;(\\d+)([ABCDHFPQSR])`);
2682
- m = buffer.match(arrowPrefix);
2683
- if (m) {
2684
- let mods = parseInt(m[1], 10);
2685
- if (mods >= KITTY_MODIFIER_EVENT_TYPES_OFFSET) {
2686
- mods -= KITTY_MODIFIER_EVENT_TYPES_OFFSET;
2687
- }
2688
- const bits = mods - KITTY_MODIFIER_BASE;
2689
- const shift = (bits & MODIFIER_SHIFT_BIT) === MODIFIER_SHIFT_BIT;
2690
- const alt = (bits & MODIFIER_ALT_BIT) === MODIFIER_ALT_BIT;
2691
- const ctrl = (bits & MODIFIER_CTRL_BIT) === MODIFIER_CTRL_BIT;
2692
- const sym = m[2];
2693
- const symbolToName = {
2694
- A: "up",
2695
- B: "down",
2696
- C: "right",
2697
- D: "left",
2698
- H: "home",
2699
- F: "end",
2700
- P: "f1",
2701
- Q: "f2",
2702
- R: "f3",
2703
- S: "f4"
2704
- };
2705
- const name = symbolToName[sym] || "";
2706
- if (!name) return null;
2707
- return {
2708
- key: {
2709
- name,
2710
- ctrl,
2711
- meta: alt,
2712
- shift,
2713
- paste: false,
2714
- sequence: buffer.slice(0, m[0].length),
2715
- kittyProtocol: true
2716
- },
2717
- length: m[0].length
2718
- };
2719
- }
2720
- const csiUPrefix = new RegExp(
2721
- `^${ESC3}\\[(\\d+)(?::\\d+)*(?:;(\\d+)(?::\\d+)*)?(?:;\\d+)?([u~])`
2722
- );
2723
- m = buffer.match(csiUPrefix);
2724
- if (m) {
2725
- const keyCode = parseInt(m[1], 10);
2726
- let modifiers = m[2] ? parseInt(m[2], 10) : KITTY_MODIFIER_BASE;
2727
- if (modifiers >= KITTY_MODIFIER_EVENT_TYPES_OFFSET) {
2728
- modifiers -= KITTY_MODIFIER_EVENT_TYPES_OFFSET;
2729
- }
2730
- const modifierBits = modifiers - KITTY_MODIFIER_BASE;
2731
- const shift = (modifierBits & MODIFIER_SHIFT_BIT) === MODIFIER_SHIFT_BIT;
2732
- const alt = (modifierBits & MODIFIER_ALT_BIT) === MODIFIER_ALT_BIT;
2733
- const ctrl = (modifierBits & MODIFIER_CTRL_BIT) === MODIFIER_CTRL_BIT;
2734
- const terminator = m[3];
2735
- if (terminator === "~") {
2736
- let name2 = null;
2737
- switch (keyCode) {
2738
- case 1:
2739
- name2 = "home";
2740
- break;
2741
- case 2:
2742
- name2 = "insert";
2743
- break;
2744
- case 3:
2745
- name2 = "delete";
2746
- break;
2747
- case 4:
2748
- name2 = "end";
2749
- break;
2750
- case 5:
2751
- name2 = "pageup";
2752
- break;
2753
- case 6:
2754
- name2 = "pagedown";
2755
- break;
2756
- default:
2757
- break;
2758
- }
2759
- if (name2) {
2760
- return {
2761
- key: {
2762
- name: name2,
2763
- ctrl,
2764
- meta: alt,
2765
- shift,
2766
- paste: false,
2767
- sequence: buffer.slice(0, m[0].length),
2768
- kittyProtocol: true
2769
- },
2770
- length: m[0].length
2771
- };
2772
- }
2773
- }
2774
- const kittyKeyCodeToName = {
2775
- [CHAR_CODE_ESC]: "escape",
2776
- [KITTY_KEYCODE_TAB]: "tab",
2777
- [KITTY_KEYCODE_BACKSPACE]: "backspace",
2778
- [KITTY_KEYCODE_ENTER]: "return",
2779
- [KITTY_KEYCODE_NUMPAD_ENTER]: "return"
2780
- };
2781
- const name = kittyKeyCodeToName[keyCode];
2782
- if (name) {
2783
- return {
2784
- key: {
2785
- name,
2786
- ctrl,
2787
- meta: alt,
2788
- shift,
2789
- paste: false,
2790
- sequence: buffer.slice(0, m[0].length),
2791
- kittyProtocol: true
2792
- },
2793
- length: m[0].length
2794
- };
2795
- }
2796
- if (!ctrl) {
2797
- const keypadChar = KITTY_KEYPAD_PRINTABLE_KEYCODE_TO_CHAR[keyCode];
2798
- if (keypadChar) {
2799
- return {
2800
- key: {
2801
- name: keypadChar,
2802
- ctrl: false,
2803
- meta: alt,
2804
- shift,
2805
- paste: false,
2806
- sequence: keypadChar,
2807
- kittyProtocol: true
2808
- },
2809
- length: m[0].length
2810
- };
2811
- }
2812
- }
2813
- const keypadName = KITTY_KEYPAD_FUNCTIONAL_KEYCODE_TO_NAME[keyCode];
2814
- if (keypadName) {
2815
- return {
2816
- key: {
2817
- name: keypadName,
2818
- ctrl,
2819
- meta: alt,
2820
- shift,
2821
- paste: false,
2822
- sequence: buffer.slice(0, m[0].length),
2823
- kittyProtocol: true
2824
- },
2825
- length: m[0].length
2826
- };
2827
- }
2828
- if (terminator === "u" && !ctrl && keyCode >= 32 && keyCode !== 127 && keyCode <= 1114111 && !(keyCode >= 57344 && keyCode <= 63743)) {
2829
- return {
2830
- key: {
2831
- ...createPrintableKey(String.fromCodePoint(keyCode)),
2832
- meta: alt,
2833
- shift
2834
- },
2835
- length: m[0].length
2836
- };
2837
- }
2838
- if (ctrl && keyCode >= "a".charCodeAt(0) && keyCode <= "z".charCodeAt(0)) {
2839
- const letter = String.fromCharCode(keyCode);
2840
- return {
2841
- key: {
2842
- name: letter,
2843
- ctrl: true,
2844
- meta: alt,
2845
- shift,
2846
- paste: false,
2847
- sequence: buffer.slice(0, m[0].length),
2848
- kittyProtocol: true
2849
- },
2850
- length: m[0].length
2851
- };
2852
- }
2853
- }
2854
- const legacyFuncKey = new RegExp(`^${ESC3}\\[([ABCDHF])`);
2855
- m = buffer.match(legacyFuncKey);
2856
- if (m) {
2857
- const sym = m[1];
2858
- const nameMap = {
2859
- A: "up",
2860
- B: "down",
2861
- C: "right",
2862
- D: "left",
2863
- H: "home",
2864
- F: "end"
2865
- };
2866
- const name = nameMap[sym];
2867
- return {
2868
- key: {
2869
- name,
2870
- ctrl: false,
2871
- meta: false,
2872
- shift: false,
2873
- paste: false,
2874
- sequence: buffer.slice(0, m[0].length),
2875
- kittyProtocol: true
2876
- },
2877
- length: m[0].length
2878
- };
2879
- }
2880
- return null;
2881
- }, "parseKittyPrefix");
2882
- const getCompleteCsiSequenceLength = /* @__PURE__ */ __name((buffer) => {
2883
- if (!buffer.startsWith(`${ESC3}[`)) {
2884
- return null;
2885
- }
2886
- for (let i = 2; i < buffer.length; i++) {
2887
- const code = buffer.charCodeAt(i);
2888
- if (code >= 64 && code <= 126) {
2889
- return i + 1;
2890
- }
2891
- if (code < 32 || code > 63) {
2892
- return 0;
2893
- }
2894
- }
2895
- return null;
2896
- }, "getCompleteCsiSequenceLength");
2897
- const parsePlainTextPrefix = /* @__PURE__ */ __name((buffer) => {
2898
- if (!buffer || buffer.startsWith(ESC3)) {
2899
- return null;
2900
- }
2901
- const [char] = Array.from(buffer);
2902
- if (!char) {
2903
- return null;
2904
- }
2905
- return {
2906
- key: createPrintableKey(char),
2907
- length: char.length
2908
- };
2909
- }, "parsePlainTextPrefix");
2910
- const broadcast = /* @__PURE__ */ __name((key) => {
2911
- noteInteraction();
2912
- for (const handler of subscribers) {
2913
- handler(key);
2914
- }
2915
- }, "broadcast");
2916
- const TERMINAL_RESPONSE_RE = /^\x1b\[[?>][\d;]*[uc]$/;
2917
- const handleKeypress = /* @__PURE__ */ __name(async (_, key) => {
2918
- if (TERMINAL_RESPONSE_RE.test(key.sequence)) {
2919
- return;
2920
- }
2921
- if (key.sequence === FOCUS_IN || key.sequence === FOCUS_OUT) {
2922
- return;
2923
- }
2924
- if (isPaste) {
2925
- resetSgrMouse();
2926
- } else if (swallowingSgrMouse) {
2927
- if (key.ctrl && key.name === "c") {
2928
- resetSgrMouse();
2929
- } else if (key.name === "paste-start") {
2930
- resetSgrMouse();
2931
- } else {
2932
- sgrMouseBuffer += key.sequence;
2933
- if (key.name === "m" || key.sequence === "M") {
2934
- swallowingSgrMouse = false;
2935
- if (sgrMouseTimeout) {
2936
- clearTimeout(sgrMouseTimeout);
2937
- sgrMouseTimeout = null;
2938
- }
2939
- const parsed = parseSGRMouseEvent(sgrMouseBuffer);
2940
- if (parsed) {
2941
- for (const handler of mouseSubscribers) {
2942
- handler(parsed.event);
2943
- }
2944
- }
2945
- sgrMouseBuffer = "";
2946
- } else if (sgrMouseBuffer.length >= MAX_SGR_MOUSE_SEQUENCE_LENGTH) {
2947
- resetSgrMouse();
2948
- }
2949
- return;
2950
- }
2951
- }
2952
- if (!isPaste && key.sequence === `${ESC3}[<`) {
2953
- swallowingSgrMouse = true;
2954
- sgrMouseBuffer = `${ESC3}[<`;
2955
- if (sgrMouseTimeout) {
2956
- clearTimeout(sgrMouseTimeout);
2957
- }
2958
- sgrMouseTimeout = setTimeout(() => {
2959
- swallowingSgrMouse = false;
2960
- sgrMouseBuffer = "";
2961
- sgrMouseTimeout = null;
2962
- }, KITTY_SEQUENCE_TIMEOUT_MS);
2963
- return;
2964
- }
2965
- const isCtrlCKey = key.ctrl && key.name === "c" || key.sequence === `${ESC3}${KITTY_CTRL_C}`;
2966
- if (isCtrlCKey) {
2967
- if (isPaste || pasteBuffer.length > 0) {
2968
- isPaste = false;
2969
- pasteBuffer = Buffer.alloc(0);
2970
- pasteAlreadyFlushed = true;
2971
- clearPasteIdleTimeout();
2972
- }
2973
- if (kittySequenceBufferRef.current && debugKeystrokeLogging) {
2974
- debugLogger2.debug(
2975
- "[DEBUG] Kitty buffer cleared on Ctrl+C:",
2976
- kittySequenceBufferRef.current
2977
- );
2978
- }
2979
- clearKittyBufferAndTimeout();
2980
- if (key.sequence === `${ESC3}${KITTY_CTRL_C}`) {
2981
- broadcast({
2982
- name: "c",
2983
- ctrl: true,
2984
- meta: false,
2985
- shift: false,
2986
- paste: false,
2987
- sequence: key.sequence,
2988
- kittyProtocol: true
2989
- });
2990
- } else {
2991
- broadcast(key);
2992
- }
2993
- return;
2994
- }
2995
- if (key.name === "paste-start") {
2996
- isPaste = true;
2997
- pasteAlreadyFlushed = false;
2998
- startPasteIdleTimeout();
2999
- return;
3000
- }
3001
- if (key.name === "paste-end") {
3002
- clearPasteIdleTimeout();
3003
- if (pasteAlreadyFlushed) {
3004
- pasteAlreadyFlushed = false;
3005
- isPaste = false;
3006
- pasteBuffer = Buffer.alloc(0);
3007
- return;
3008
- }
3009
- isPaste = false;
3010
- if (pasteBuffer.toString().length > 0) {
3011
- broadcast({
3012
- name: "",
3013
- ctrl: false,
3014
- meta: false,
3015
- shift: false,
3016
- paste: true,
3017
- sequence: pasteBuffer.toString()
3018
- });
3019
- } else {
3020
- let clipboardImageUnavailable = false;
3021
- const hasImage = await clipboardHasImage(() => {
3022
- clipboardImageUnavailable = true;
3023
- });
3024
- broadcast({
3025
- name: "",
3026
- ctrl: false,
3027
- meta: false,
3028
- shift: false,
3029
- paste: true,
3030
- pasteImage: hasImage,
3031
- clipboardImageUnavailable,
3032
- sequence: pasteBuffer.toString()
3033
- });
3034
- }
3035
- pasteBuffer = Buffer.alloc(0);
3036
- return;
3037
- }
3038
- if (isPaste) {
3039
- pasteBuffer = Buffer.concat([pasteBuffer, Buffer.from(key.sequence)]);
3040
- startPasteIdleTimeout();
3041
- return;
3042
- }
3043
- if (key.name === "return" && waitingForEnterAfterBackslash) {
3044
- if (backslashTimeout) {
3045
- clearTimeout(backslashTimeout);
3046
- backslashTimeout = null;
3047
- }
3048
- waitingForEnterAfterBackslash = false;
3049
- broadcast({
3050
- ...key,
3051
- shift: true,
3052
- sequence: "\r"
3053
- // Corrected escaping for newline
3054
- });
3055
- return;
3056
- }
3057
- if (key.sequence === "\\" && !key.name) {
3058
- waitingForEnterAfterBackslash = true;
3059
- backslashTimeout = setTimeout(() => {
3060
- waitingForEnterAfterBackslash = false;
3061
- backslashTimeout = null;
3062
- broadcast(key);
3063
- }, BACKSLASH_ENTER_DETECTION_WINDOW_MS);
3064
- return;
3065
- }
3066
- if (waitingForEnterAfterBackslash && key.name !== "return") {
3067
- if (backslashTimeout) {
3068
- clearTimeout(backslashTimeout);
3069
- backslashTimeout = null;
3070
- }
3071
- waitingForEnterAfterBackslash = false;
3072
- broadcast({
3073
- name: "",
3074
- sequence: "\\",
3075
- ctrl: false,
3076
- meta: false,
3077
- shift: false,
3078
- paste: false
3079
- });
3080
- }
3081
- if (["up", "down", "left", "right"].includes(key.name)) {
3082
- broadcast(key);
3083
- return;
3084
- }
3085
- if (kittyProtocolEnabled) {
3086
- if (kittySequenceBufferRef.current || key.sequence.startsWith(`${ESC3}[`) && !key.sequence.startsWith(PASTE_MODE_PREFIX) && !key.sequence.startsWith(PASTE_MODE_SUFFIX) && !key.sequence.startsWith(FOCUS_IN) && !key.sequence.startsWith(FOCUS_OUT)) {
3087
- updateKittyBuffer(kittySequenceBufferRef.current + key.sequence);
3088
- startKittyTimeout();
3089
- if (debugKeystrokeLogging) {
3090
- debugLogger2.debug(
3091
- "[DEBUG] Kitty buffer accumulating:",
3092
- kittySequenceBufferRef.current
3093
- );
3094
- }
3095
- let bufferedInputHandled = false;
3096
- while (kittySequenceBufferRef.current) {
3097
- const parsed = parseKittyPrefix(kittySequenceBufferRef.current);
3098
- if (parsed) {
3099
- if (debugKeystrokeLogging) {
3100
- const parsedSequence = kittySequenceBufferRef.current.slice(
3101
- 0,
3102
- parsed.length
3103
- );
3104
- if (kittySequenceBufferRef.current.length > parsed.length) {
3105
- debugLogger2.debug(
3106
- "[DEBUG] Kitty sequence parsed successfully (prefix):",
3107
- parsedSequence
3108
- );
3109
- } else {
3110
- debugLogger2.debug(
3111
- "[DEBUG] Kitty sequence parsed successfully:",
3112
- parsedSequence
3113
- );
3114
- }
3115
- }
3116
- updateKittyBuffer(
3117
- kittySequenceBufferRef.current.slice(parsed.length)
3118
- );
3119
- if (!kittySequenceBufferRef.current) {
3120
- clearKittyTimeout();
3121
- }
3122
- broadcast(parsed.key);
3123
- bufferedInputHandled = true;
3124
- continue;
3125
- }
3126
- const completeUnsupportedCsiLength = getCompleteCsiSequenceLength(
3127
- kittySequenceBufferRef.current
3128
- );
3129
- if (completeUnsupportedCsiLength) {
3130
- if (debugKeystrokeLogging) {
3131
- debugLogger2.debug(
3132
- "[DEBUG] Dropping unsupported complete CSI sequence:",
3133
- kittySequenceBufferRef.current.slice(
3134
- 0,
3135
- completeUnsupportedCsiLength
3136
- )
3137
- );
3138
- }
3139
- updateKittyBuffer(
3140
- kittySequenceBufferRef.current.slice(
3141
- completeUnsupportedCsiLength
3142
- )
3143
- );
3144
- if (!kittySequenceBufferRef.current) {
3145
- clearKittyTimeout();
3146
- }
3147
- bufferedInputHandled = true;
3148
- continue;
3149
- }
3150
- const plainTextPrefix = parsePlainTextPrefix(
3151
- kittySequenceBufferRef.current
3152
- );
3153
- if (plainTextPrefix) {
3154
- if (debugKeystrokeLogging) {
3155
- debugLogger2.debug(
3156
- "[DEBUG] Recovered plain text after kitty sequence:",
3157
- plainTextPrefix.key.sequence
3158
- );
3159
- }
3160
- updateKittyBuffer(
3161
- kittySequenceBufferRef.current.slice(plainTextPrefix.length)
3162
- );
3163
- if (!kittySequenceBufferRef.current) {
3164
- clearKittyTimeout();
3165
- }
3166
- broadcast(plainTextPrefix.key);
3167
- bufferedInputHandled = true;
3168
- continue;
3169
- }
3170
- const nextStart = kittySequenceBufferRef.current.indexOf(
3171
- `${ESC3}[`,
3172
- 1
3173
- );
3174
- if (nextStart > 0) {
3175
- if (debugKeystrokeLogging) {
3176
- debugLogger2.debug(
3177
- "[DEBUG] Skipping incomplete/invalid CSI prefix:",
3178
- kittySequenceBufferRef.current.slice(0, nextStart)
3179
- );
3180
- }
3181
- updateKittyBuffer(
3182
- kittySequenceBufferRef.current.slice(nextStart)
3183
- );
3184
- if (!kittySequenceBufferRef.current) {
3185
- clearKittyTimeout();
3186
- }
3187
- bufferedInputHandled = true;
3188
- continue;
3189
- }
3190
- break;
3191
- }
3192
- if (bufferedInputHandled) return;
3193
- if (config?.getDebugMode() || debugKeystrokeLogging) {
3194
- const codes = Array.from(kittySequenceBufferRef.current).map(
3195
- (ch) => ch.charCodeAt(0)
3196
- );
3197
- debugLogger2.warn("Kitty sequence buffer has char codes:", codes);
3198
- }
3199
- if (kittySequenceBufferRef.current.length > MAX_KITTY_SEQUENCE_LENGTH) {
3200
- if (debugKeystrokeLogging) {
3201
- debugLogger2.debug(
3202
- "[DEBUG] Kitty buffer overflow, clearing:",
3203
- kittySequenceBufferRef.current
3204
- );
3205
- }
3206
- if (config) {
3207
- const event = new KittySequenceOverflowEvent(
3208
- kittySequenceBufferRef.current.length,
3209
- kittySequenceBufferRef.current
3210
- );
3211
- logKittySequenceOverflow(config, event);
3212
- }
3213
- clearKittyBufferAndTimeout();
3214
- } else {
3215
- return;
3216
- }
3217
- }
3218
- }
3219
- if (key.name === "return" && key.sequence === `${ESC3}\r`) {
3220
- key.meta = true;
3221
- }
3222
- if (process.platform === "darwin" && !isPaste && key.sequence === OPTION_T_COMPOSED_GLYPH) {
3223
- key.name = "t";
3224
- key.meta = true;
3225
- }
3226
- broadcast({ ...key, paste: isPaste });
3227
- }, "handleKeypress");
3228
- const clearRawFlushTimeout = /* @__PURE__ */ __name(() => {
3229
- if (rawFlushTimeout) {
3230
- clearTimeout(rawFlushTimeout);
3231
- rawFlushTimeout = null;
3232
- }
3233
- }, "clearRawFlushTimeout");
3234
- const createPasteKeyEvent = /* @__PURE__ */ __name((name = "", sequence = "") => ({
3235
- name,
3236
- ctrl: false,
3237
- meta: false,
3238
- shift: false,
3239
- paste: false,
3240
- sequence
3241
- }), "createPasteKeyEvent");
3242
- const shouldFlushRawDataAsPaste = /* @__PURE__ */ __name((data) => {
3243
- const hasReturn = data.includes(13);
3244
- const hasEmbeddedTab = data.length > 1 && data.includes(9);
3245
- const isSingleReturn = data.length <= 2 && hasReturn;
3246
- return !isSingleReturn && (hasReturn || hasEmbeddedTab);
3247
- }, "shouldFlushRawDataAsPaste");
3248
- const flushRawBuffer = /* @__PURE__ */ __name(() => {
3249
- if (!rawDataBuffer.length) {
3250
- return;
3251
- }
3252
- const pasteModePrefixBuffer = Buffer.from(PASTE_MODE_PREFIX);
3253
- const pasteModeSuffixBuffer = Buffer.from(PASTE_MODE_SUFFIX);
3254
- const data = rawDataBuffer;
3255
- let cursor = 0;
3256
- while (cursor < data.length) {
3257
- const prefixPos = data.indexOf(pasteModePrefixBuffer, cursor);
3258
- const suffixPos = data.indexOf(pasteModeSuffixBuffer, cursor);
3259
- const hasPrefix = prefixPos !== -1 && prefixPos + pasteModePrefixBuffer.length <= data.length;
3260
- const hasSuffix = suffixPos !== -1 && suffixPos + pasteModeSuffixBuffer.length <= data.length;
3261
- let markerPos = -1;
3262
- let markerLength = 0;
3263
- let markerType = null;
3264
- if (hasPrefix && (!hasSuffix || prefixPos < suffixPos)) {
3265
- markerPos = prefixPos;
3266
- markerLength = pasteModePrefixBuffer.length;
3267
- markerType = "prefix";
3268
- } else if (hasSuffix) {
3269
- markerPos = suffixPos;
3270
- markerLength = pasteModeSuffixBuffer.length;
3271
- markerType = "suffix";
3272
- }
3273
- if (markerPos === -1) {
3274
- break;
3275
- }
3276
- const nextData = data.slice(cursor, markerPos);
3277
- if (nextData.length > 0) {
3278
- keypressStream.write(nextData);
3279
- }
3280
- if (markerType === "prefix") {
3281
- handleKeypress(void 0, createPasteKeyEvent("paste-start"));
3282
- } else if (markerType === "suffix") {
3283
- handleKeypress(void 0, createPasteKeyEvent("paste-end"));
3284
- }
3285
- cursor = markerPos + markerLength;
3286
- }
3287
- rawDataBuffer = data.slice(cursor);
3288
- if (rawDataBuffer.length === 0) {
3289
- return;
3290
- }
3291
- if (isPaste || !shouldFlushRawDataAsPaste(rawDataBuffer)) {
3292
- keypressStream.write(rawDataBuffer);
3293
- } else {
3294
- handleKeypress(void 0, createPasteKeyEvent("paste-start"));
3295
- keypressStream.write(rawDataBuffer);
3296
- handleKeypress(void 0, createPasteKeyEvent("paste-end"));
3297
- }
3298
- rawDataBuffer = Buffer.alloc(0);
3299
- clearRawFlushTimeout();
3300
- }, "flushRawBuffer");
3301
- const handleRawKeypress = /* @__PURE__ */ __name((_data) => {
3302
- const data = Buffer.isBuffer(_data) ? _data : Buffer.from(_data, "utf8");
3303
- rawDataBuffer = Buffer.concat([rawDataBuffer, data]);
3304
- clearRawFlushTimeout();
3305
- const isReturnChar = rawDataBuffer.length <= 2 && rawDataBuffer.includes(13);
3306
- if (isReturnChar) {
3307
- rawFlushTimeout = setTimeout(flushRawBuffer, 100);
3308
- } else {
3309
- flushRawBuffer();
3310
- }
3311
- }, "handleRawKeypress");
3312
- let rl;
3313
- if (usePassthrough) {
3314
- rl = readline.createInterface({
3315
- input: keypressStream,
3316
- escapeCodeTimeout: 0
3317
- });
3318
- readline.emitKeypressEvents(keypressStream, rl);
3319
- keypressStream.on("keypress", handleKeypress);
3320
- stdin.on("data", handleRawKeypress);
3321
- } else {
3322
- rl = readline.createInterface({ input: stdin, escapeCodeTimeout: 0 });
3323
- readline.emitKeypressEvents(stdin, rl);
3324
- stdin.on("keypress", handleKeypress);
3325
- }
3326
- let replayPending = false;
3327
- if (capturedInput.length > 0) {
3328
- debugLogger2.debug(
3329
- `Replaying ${capturedInput.length} bytes of captured input`
3330
- );
3331
- replayPending = true;
3332
- setImmediate(() => {
3333
- if (!replayPending) return;
3334
- try {
3335
- stdin.emit("data", capturedInput);
3336
- } catch (err) {
3337
- debugLogger2.error("Failed to replay captured input:", err);
3338
- }
3339
- });
3340
- }
3341
- return () => {
3342
- replayPending = false;
3343
- if (usePassthrough) {
3344
- keypressStream.removeListener("keypress", handleKeypress);
3345
- stdin.removeListener("data", handleRawKeypress);
3346
- } else {
3347
- stdin.removeListener("keypress", handleKeypress);
3348
- }
3349
- rl.close();
3350
- setRawMode(false);
3351
- if (backslashTimeout) {
3352
- clearTimeout(backslashTimeout);
3353
- backslashTimeout = null;
3354
- }
3355
- clearKittyBufferAndTimeout();
3356
- clearPasteIdleTimeout();
3357
- resetSgrMouse();
3358
- if (rawFlushTimeout) {
3359
- clearTimeout(rawFlushTimeout);
3360
- rawFlushTimeout = null;
3361
- }
3362
- if (isPaste) {
3363
- broadcast({
3364
- name: "",
3365
- ctrl: false,
3366
- meta: false,
3367
- shift: false,
3368
- paste: true,
3369
- sequence: pasteBuffer.toString()
3370
- });
3371
- pasteBuffer = Buffer.alloc(0);
3372
- }
3373
- };
3374
- }, [
3375
- stdin,
3376
- setRawMode,
3377
- kittyProtocolEnabled,
3378
- debugKeystrokeLogging,
3379
- pasteWorkaround,
3380
- config,
3381
- subscribers,
3382
- mouseSubscribers,
3383
- initialCapturedInput
3384
- ]);
3385
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
3386
- KeypressContext.Provider,
3387
- {
3388
- value: {
3389
- subscribe,
3390
- unsubscribe,
3391
- subscribeMouse,
3392
- unsubscribeMouse,
3393
- pasteWorkaround
3394
- },
3395
- children
3396
- }
3397
- );
3398
- }
3399
- __name(KeypressProvider, "KeypressProvider");
3400
-
3401
- // packages/cli/src/ui/contexts/StreamingContext.tsx
3402
- init_esbuild_shims();
3403
- var import_react4 = __toESM(require_react(), 1);
3404
- var StreamingContext = (0, import_react4.createContext)(
3405
- void 0
3406
- );
3407
- var useStreamingContext = /* @__PURE__ */ __name(() => {
3408
- const context = import_react4.default.useContext(StreamingContext);
3409
- if (context === void 0) {
3410
- throw new Error(
3411
- "useStreamingContext must be used within a StreamingContextProvider"
3412
- );
3413
- }
3414
- return context;
3415
- }, "useStreamingContext");
3416
-
3417
- // packages/cli/src/ui/utils/computeStats.ts
3418
- init_esbuild_shims();
3419
- function calculateErrorRate(metrics) {
3420
- if (metrics.api.totalRequests === 0) {
3421
- return 0;
3422
- }
3423
- return metrics.api.totalErrors / metrics.api.totalRequests * 100;
3424
- }
3425
- __name(calculateErrorRate, "calculateErrorRate");
3426
- function calculateAverageLatency(metrics) {
3427
- if (metrics.api.totalRequests === 0) {
3428
- return 0;
3429
- }
3430
- return metrics.api.totalLatencyMs / metrics.api.totalRequests;
3431
- }
3432
- __name(calculateAverageLatency, "calculateAverageLatency");
3433
- function calculateCacheHitRate(metrics) {
3434
- if (metrics.tokens.prompt === 0) {
3435
- return 0;
3436
- }
3437
- return metrics.tokens.cached / metrics.tokens.prompt * 100;
3438
- }
3439
- __name(calculateCacheHitRate, "calculateCacheHitRate");
3440
- var computeSessionStats = /* @__PURE__ */ __name((metrics) => {
3441
- const { models, tools, files } = metrics;
3442
- const totalApiTime = Object.values(models).reduce(
3443
- (acc, model) => acc + model.api.totalLatencyMs,
3444
- 0
3445
- );
3446
- const totalToolTime = tools.totalDurationMs;
3447
- const agentActiveTime = totalApiTime + totalToolTime;
3448
- const apiTimePercent = agentActiveTime > 0 ? totalApiTime / agentActiveTime * 100 : 0;
3449
- const toolTimePercent = agentActiveTime > 0 ? totalToolTime / agentActiveTime * 100 : 0;
3450
- const totalCachedTokens = Object.values(models).reduce(
3451
- (acc, model) => acc + model.tokens.cached,
3452
- 0
3453
- );
3454
- const totalPromptTokens = Object.values(models).reduce(
3455
- (acc, model) => acc + model.tokens.prompt,
3456
- 0
3457
- );
3458
- const cacheEfficiency = totalPromptTokens > 0 ? totalCachedTokens / totalPromptTokens * 100 : 0;
3459
- const totalDecisions = tools.totalDecisions.accept + tools.totalDecisions.reject + tools.totalDecisions.modify;
3460
- const successRate = tools.totalCalls > 0 ? tools.totalSuccess / tools.totalCalls * 100 : 0;
3461
- const agreementRate = totalDecisions > 0 ? tools.totalDecisions.accept / totalDecisions * 100 : 0;
3462
- return {
3463
- totalApiTime,
3464
- totalToolTime,
3465
- agentActiveTime,
3466
- apiTimePercent,
3467
- toolTimePercent,
3468
- cacheEfficiency,
3469
- totalDecisions,
3470
- successRate,
3471
- agreementRate,
3472
- totalCachedTokens,
3473
- totalPromptTokens,
3474
- totalLinesAdded: files.totalLinesAdded,
3475
- totalLinesRemoved: files.totalLinesRemoved
3476
- };
3477
- }, "computeSessionStats");
3478
-
3479
- // packages/cli/src/services/commandUtils.ts
3480
- init_esbuild_shims();
3481
- function getEffectiveSupportedModes(cmd) {
3482
- if (cmd.supportedModes !== void 0) {
3483
- return cmd.supportedModes;
3484
- }
3485
- switch (cmd.kind) {
3486
- case "built-in" /* BUILT_IN */:
3487
- return ["interactive"];
3488
- case "file" /* FILE */:
3489
- case "skill" /* SKILL */:
3490
- case "mcp-prompt" /* MCP_PROMPT */:
3491
- return ["interactive", "non_interactive", "acp"];
3492
- default:
3493
- return ["interactive"];
3494
- }
3495
- }
3496
- __name(getEffectiveSupportedModes, "getEffectiveSupportedModes");
3497
- function filterCommandsForMode(commands, mode) {
3498
- return commands.filter(
3499
- (cmd) => getEffectiveSupportedModes(cmd).includes(mode)
3500
- );
3501
- }
3502
- __name(filterCommandsForMode, "filterCommandsForMode");
3503
-
3504
1697
  // packages/cli/src/ui/utils/resumeHistoryUtils.ts
3505
1698
  init_esbuild_shims();
3506
- import * as path2 from "node:path";
1699
+ import * as path from "node:path";
3507
1700
 
3508
1701
  // packages/cli/src/ui/components/messages/CompactToolGroupDisplay.tsx
3509
1702
  init_esbuild_shims();
@@ -4203,16 +2396,16 @@ init_esbuild_shims();
4203
2396
 
4204
2397
  // packages/cli/src/ui/components/GeminiRespondingSpinner.tsx
4205
2398
  init_esbuild_shims();
4206
- var import_react6 = __toESM(require_react(), 1);
2399
+ var import_react3 = __toESM(require_react(), 1);
4207
2400
 
4208
2401
  // node_modules/ink-spinner/build/index.js
4209
2402
  init_esbuild_shims();
4210
- var import_react5 = __toESM(require_react(), 1);
2403
+ var import_react = __toESM(require_react(), 1);
4211
2404
  var import_cli_spinners = __toESM(require_cli_spinners(), 1);
4212
2405
  function Spinner({ type = "dots" }) {
4213
- const [frame, setFrame] = (0, import_react5.useState)(0);
2406
+ const [frame, setFrame] = (0, import_react.useState)(0);
4214
2407
  const spinner = import_cli_spinners.default[type];
4215
- (0, import_react5.useEffect)(() => {
2408
+ (0, import_react.useEffect)(() => {
4216
2409
  const timer = setInterval(() => {
4217
2410
  setFrame((previousFrame) => {
4218
2411
  const isLastFrame = previousFrame === spinner.frames.length - 1;
@@ -4223,11 +2416,27 @@ function Spinner({ type = "dots" }) {
4223
2416
  clearInterval(timer);
4224
2417
  };
4225
2418
  }, [spinner]);
4226
- return import_react5.default.createElement(Text, null, spinner.frames[frame]);
2419
+ return import_react.default.createElement(Text, null, spinner.frames[frame]);
4227
2420
  }
4228
2421
  __name(Spinner, "Spinner");
4229
2422
  var build_default = Spinner;
4230
2423
 
2424
+ // packages/cli/src/ui/contexts/StreamingContext.tsx
2425
+ init_esbuild_shims();
2426
+ var import_react2 = __toESM(require_react(), 1);
2427
+ var StreamingContext = (0, import_react2.createContext)(
2428
+ void 0
2429
+ );
2430
+ var useStreamingContext = /* @__PURE__ */ __name(() => {
2431
+ const context = import_react2.default.useContext(StreamingContext);
2432
+ if (context === void 0) {
2433
+ throw new Error(
2434
+ "useStreamingContext must be used within a StreamingContextProvider"
2435
+ );
2436
+ }
2437
+ return context;
2438
+ }, "useStreamingContext");
2439
+
4231
2440
  // packages/cli/src/ui/textConstants.ts
4232
2441
  init_esbuild_shims();
4233
2442
  var SCREEN_READER_USER_PREFIX = "User: ";
@@ -4236,14 +2445,14 @@ var SCREEN_READER_LOADING = "loading";
4236
2445
  var SCREEN_READER_RESPONDING = "responding";
4237
2446
 
4238
2447
  // packages/cli/src/ui/components/GeminiRespondingSpinner.tsx
4239
- var import_jsx_runtime2 = __toESM(require_jsx_runtime(), 1);
2448
+ var import_jsx_runtime = __toESM(require_jsx_runtime(), 1);
4240
2449
  var TMUX_SPINNER_INTERVAL_MS = 750;
4241
2450
  var TMUX_SPINNER_FRAMES = [". ", ".. ", "..."];
4242
2451
  var GeminiRespondingSpinner = /* @__PURE__ */ __name(({ nonRespondingDisplay, spinnerType = "dots" }) => {
4243
2452
  const streamingState = useStreamingContext();
4244
2453
  const isScreenReaderEnabled = use_is_screen_reader_enabled_default();
4245
2454
  if (streamingState === "responding" /* Responding */) {
4246
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2455
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
4247
2456
  GeminiSpinner,
4248
2457
  {
4249
2458
  spinnerType,
@@ -4251,7 +2460,7 @@ var GeminiRespondingSpinner = /* @__PURE__ */ __name(({ nonRespondingDisplay, sp
4251
2460
  }
4252
2461
  );
4253
2462
  } else if (nonRespondingDisplay) {
4254
- return isScreenReaderEnabled ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { children: SCREEN_READER_LOADING }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { color: theme.text.primary, children: nonRespondingDisplay });
2463
+ return isScreenReaderEnabled ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { children: SCREEN_READER_LOADING }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { color: theme.text.primary, children: nonRespondingDisplay });
4255
2464
  }
4256
2465
  return null;
4257
2466
  }, "GeminiRespondingSpinner");
@@ -4261,8 +2470,8 @@ var GeminiSpinner = /* @__PURE__ */ __name(({
4261
2470
  }) => {
4262
2471
  const isScreenReaderEnabled = use_is_screen_reader_enabled_default();
4263
2472
  const isTmux = Boolean(process.env["TMUX"]);
4264
- const [tmuxFrameIndex, setTmuxFrameIndex] = (0, import_react6.useState)(0);
4265
- (0, import_react6.useEffect)(() => {
2473
+ const [tmuxFrameIndex, setTmuxFrameIndex] = (0, import_react3.useState)(0);
2474
+ (0, import_react3.useEffect)(() => {
4266
2475
  if (isScreenReaderEnabled || !isTmux) {
4267
2476
  return;
4268
2477
  }
@@ -4272,16 +2481,16 @@ var GeminiSpinner = /* @__PURE__ */ __name(({
4272
2481
  return () => clearInterval(interval);
4273
2482
  }, [isScreenReaderEnabled, isTmux]);
4274
2483
  if (isScreenReaderEnabled) {
4275
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { children: altText });
2484
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { children: altText });
4276
2485
  }
4277
2486
  if (isTmux) {
4278
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { color: theme.text.primary, children: TMUX_SPINNER_FRAMES[tmuxFrameIndex] });
2487
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { color: theme.text.primary, children: TMUX_SPINNER_FRAMES[tmuxFrameIndex] });
4279
2488
  }
4280
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { color: theme.text.primary, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(build_default, { type: spinnerType }) });
2489
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { color: theme.text.primary, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(build_default, { type: spinnerType }) });
4281
2490
  }, "GeminiSpinner");
4282
2491
 
4283
2492
  // packages/cli/src/ui/components/shared/ToolStatusIndicator.tsx
4284
- var import_jsx_runtime3 = __toESM(require_jsx_runtime(), 1);
2493
+ var import_jsx_runtime2 = __toESM(require_jsx_runtime(), 1);
4285
2494
  var STATUS_INDICATOR_WIDTH = 3;
4286
2495
  var ToolStatusIndicator = /* @__PURE__ */ __name(({
4287
2496
  status,
@@ -4289,33 +2498,33 @@ var ToolStatusIndicator = /* @__PURE__ */ __name(({
4289
2498
  }) => {
4290
2499
  const isShell = name === SHELL_COMMAND_NAME || name === SHELL_NAME;
4291
2500
  const statusColor = isShell ? theme.ui.symbol : theme.status.warning;
4292
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box_default, { minWidth: STATUS_INDICATOR_WIDTH, flexShrink: 0, children: [
4293
- status === "Pending" /* Pending */ && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text, { color: theme.status.success, children: TOOL_STATUS.PENDING }),
4294
- status === "Executing" /* Executing */ && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
2501
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Box_default, { minWidth: STATUS_INDICATOR_WIDTH, flexShrink: 0, children: [
2502
+ status === "Pending" /* Pending */ && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { color: theme.status.success, children: TOOL_STATUS.PENDING }),
2503
+ status === "Executing" /* Executing */ && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
4295
2504
  GeminiRespondingSpinner,
4296
2505
  {
4297
2506
  spinnerType: "toggle",
4298
2507
  nonRespondingDisplay: TOOL_STATUS.EXECUTING
4299
2508
  }
4300
2509
  ),
4301
- status === "Success" /* Success */ && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text, { color: theme.status.success, "aria-label": "Success:", children: TOOL_STATUS.SUCCESS }),
4302
- status === "Confirming" /* Confirming */ && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text, { color: statusColor, "aria-label": "Confirming:", children: TOOL_STATUS.CONFIRMING }),
4303
- status === "Canceled" /* Canceled */ && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text, { color: statusColor, "aria-label": "Canceled:", bold: true, children: TOOL_STATUS.CANCELED }),
4304
- status === "Error" /* Error */ && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text, { color: theme.status.error, "aria-label": "Error:", bold: true, children: TOOL_STATUS.ERROR })
2510
+ status === "Success" /* Success */ && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { color: theme.status.success, "aria-label": "Success:", children: TOOL_STATUS.SUCCESS }),
2511
+ status === "Confirming" /* Confirming */ && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { color: statusColor, "aria-label": "Confirming:", children: TOOL_STATUS.CONFIRMING }),
2512
+ status === "Canceled" /* Canceled */ && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { color: statusColor, "aria-label": "Canceled:", bold: true, children: TOOL_STATUS.CANCELED }),
2513
+ status === "Error" /* Error */ && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { color: theme.status.error, "aria-label": "Error:", bold: true, children: TOOL_STATUS.ERROR })
4305
2514
  ] });
4306
2515
  }, "ToolStatusIndicator");
4307
2516
 
4308
2517
  // packages/cli/src/ui/components/shared/ToolElapsedTime.tsx
4309
2518
  init_esbuild_shims();
4310
- var import_react7 = __toESM(require_react(), 1);
4311
- var import_jsx_runtime4 = __toESM(require_jsx_runtime(), 1);
2519
+ var import_react4 = __toESM(require_react(), 1);
2520
+ var import_jsx_runtime3 = __toESM(require_jsx_runtime(), 1);
4312
2521
  var ToolElapsedTime = /* @__PURE__ */ __name(({
4313
2522
  status,
4314
2523
  executionStartTime,
4315
2524
  timeoutMs
4316
2525
  }) => {
4317
- const [elapsedSeconds, setElapsedSeconds] = (0, import_react7.useState)(0);
4318
- (0, import_react7.useEffect)(() => {
2526
+ const [elapsedSeconds, setElapsedSeconds] = (0, import_react4.useState)(0);
2527
+ (0, import_react4.useEffect)(() => {
4319
2528
  if (status !== "Executing" /* Executing */ || !executionStartTime) {
4320
2529
  setElapsedSeconds(0);
4321
2530
  return;
@@ -4333,11 +2542,11 @@ var ToolElapsedTime = /* @__PURE__ */ __name(({
4333
2542
  hideTrailingZeros: true
4334
2543
  });
4335
2544
  const label = hasTimeout ? `(${elapsedStr} \xB7 timeout ${formatDuration(timeoutMs, { hideTrailingZeros: true })})` : elapsedStr;
4336
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Box_default, { flexShrink: 0, marginLeft: 1, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text, { color: theme.text.secondary, children: label }) });
2545
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Box_default, { flexShrink: 0, marginLeft: 1, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text, { color: theme.text.secondary, children: label }) });
4337
2546
  }, "ToolElapsedTime");
4338
2547
 
4339
2548
  // packages/cli/src/ui/components/messages/CompactToolGroupDisplay.tsx
4340
- var import_jsx_runtime5 = __toESM(require_jsx_runtime(), 1);
2549
+ var import_jsx_runtime4 = __toESM(require_jsx_runtime(), 1);
4341
2550
  var COMPACT_GROUP_HORIZONTAL_PADDING = 2;
4342
2551
  var ELAPSED_TIME_MARGIN_LEFT = 1;
4343
2552
  var EXECUTING_ELAPSED_TIME_RESERVED_LABEL = "99h 59m 59s";
@@ -4598,14 +2807,14 @@ var CompactToolGroupDisplay = /* @__PURE__ */ __name(({ toolCalls, contentWidth
4598
2807
  const activeTool = getActiveTool(toolCalls);
4599
2808
  const isActive = isToolGroupActive(overallStatus);
4600
2809
  const hint = getActiveToolHint(toolCalls);
4601
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Box_default, { flexDirection: "column", width: contentWidth, paddingX: 1, gap: 0, children: [
4602
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Box_default, { flexDirection: "row", children: [
4603
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ToolStatusIndicator, { status: overallStatus, name: activeTool.name }),
4604
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Box_default, { flexGrow: 1, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { wrap: "wrap", bold: true, children: [
2810
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Box_default, { flexDirection: "column", width: contentWidth, paddingX: 1, gap: 0, children: [
2811
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Box_default, { flexDirection: "row", children: [
2812
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ToolStatusIndicator, { status: overallStatus, name: activeTool.name }),
2813
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Box_default, { flexGrow: 1, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Text, { wrap: "wrap", bold: true, children: [
4605
2814
  buildToolSummary(toolCalls, isActive),
4606
- isActive && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { children: "\u2026" }, "ellipsis")
2815
+ isActive && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text, { children: "\u2026" }, "ellipsis")
4607
2816
  ] }) }),
4608
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
2817
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
4609
2818
  ToolElapsedTime,
4610
2819
  {
4611
2820
  status: overallStatus,
@@ -4614,7 +2823,7 @@ var CompactToolGroupDisplay = /* @__PURE__ */ __name(({ toolCalls, contentWidth
4614
2823
  }
4615
2824
  )
4616
2825
  ] }),
4617
- hint && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Box_default, { paddingLeft: STATUS_INDICATOR_WIDTH, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { dimColor: true, wrap: "truncate-end", children: [
2826
+ hint && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Box_default, { paddingLeft: STATUS_INDICATOR_WIDTH, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Text, { dimColor: true, wrap: "truncate-end", children: [
4618
2827
  "\u23BF ",
4619
2828
  hint
4620
2829
  ] }) })
@@ -4745,7 +2954,7 @@ function convertToHistoryItems(conversation, config, historyGaps) {
4745
2954
  return {
4746
2955
  callId: `at-command-${atCommandCounter}`,
4747
2956
  name: isDir ? "Read Directory" : "Read File",
4748
- description: isDir ? `Read directory ${path2.basename(filePath)}` : `Read file ${path2.basename(filePath)}`,
2957
+ description: isDir ? `Read directory ${path.basename(filePath)}` : `Read file ${path.basename(filePath)}`,
4749
2958
  status: "Success" /* Success */,
4750
2959
  resultDisplay: void 0,
4751
2960
  confirmationDetails: void 0
@@ -5034,338 +3243,7 @@ function applyCollapsePolicyAndSummary(rawItems, collapseOnResume, collapsePrevi
5034
3243
  }
5035
3244
  __name(applyCollapsePolicyAndSummary, "applyCollapsePolicyAndSummary");
5036
3245
 
5037
- // packages/cli/src/ui/commands/diffCommand.ts
5038
- init_esbuild_shims();
5039
- async function diffAction(context) {
5040
- const { config } = context.services;
5041
- if (!config) {
5042
- return {
5043
- type: "message",
5044
- messageType: "error",
5045
- content: t("Configuration not available.")
5046
- };
5047
- }
5048
- if (context.executionMode === "interactive") {
5049
- return { type: "dialog", dialog: "diff" };
5050
- }
5051
- const cwd = config.getWorkingDir() || config.getProjectRoot();
5052
- if (!cwd) {
5053
- return {
5054
- type: "message",
5055
- messageType: "error",
5056
- content: t("Could not determine current working directory.")
5057
- };
5058
- }
5059
- let result;
5060
- try {
5061
- result = await fetchGitDiff(cwd);
5062
- } catch (error) {
5063
- return {
5064
- type: "message",
5065
- messageType: "error",
5066
- content: `${t("Failed to compute git diff stats")}: ${error instanceof Error ? error.message : String(error)}`
5067
- };
5068
- }
5069
- if (!result) {
5070
- return {
5071
- type: "message",
5072
- messageType: "info",
5073
- content: t(
5074
- "No diff available. Either this is not a git repository, HEAD is missing, or a merge/rebase/cherry-pick/revert is in progress."
5075
- )
5076
- };
5077
- }
5078
- if (result.stats.filesCount === 0) {
5079
- return {
5080
- type: "message",
5081
- messageType: "info",
5082
- content: t("Clean working tree \u2014 no changes against HEAD.")
5083
- };
5084
- }
5085
- const model = buildDiffRenderModel(result);
5086
- return {
5087
- type: "message",
5088
- messageType: "info",
5089
- content: renderDiffModelText(model)
5090
- };
5091
- }
5092
- __name(diffAction, "diffAction");
5093
- function buildDiffRenderModel(result) {
5094
- const rows = [];
5095
- for (const [filename, s] of result.perFileStats) {
5096
- rows.push(toRow(filename, s));
5097
- }
5098
- const hiddenCount = Math.max(0, result.stats.filesCount - rows.length);
5099
- return {
5100
- filesCount: result.stats.filesCount,
5101
- linesAdded: result.stats.linesAdded,
5102
- linesRemoved: result.stats.linesRemoved,
5103
- rows,
5104
- hiddenCount
5105
- };
5106
- }
5107
- __name(buildDiffRenderModel, "buildDiffRenderModel");
5108
- function toRow(filename, s) {
5109
- if (s.isBinary) {
5110
- return {
5111
- filename,
5112
- oldPath: s.oldPath,
5113
- isBinary: true,
5114
- isUntracked: Boolean(s.isUntracked),
5115
- isDeleted: Boolean(s.isDeleted),
5116
- truncated: false
5117
- };
5118
- }
5119
- return {
5120
- filename,
5121
- oldPath: s.oldPath,
5122
- added: s.added,
5123
- removed: s.isUntracked ? 0 : s.removed,
5124
- isBinary: false,
5125
- isUntracked: Boolean(s.isUntracked),
5126
- isDeleted: Boolean(s.isDeleted),
5127
- truncated: Boolean(s.truncated)
5128
- };
5129
- }
5130
- __name(toRow, "toRow");
5131
- function computeDiffColumnWidths(rows) {
5132
- let maxAdded = 0;
5133
- let maxRemoved = 0;
5134
- for (const r of rows) {
5135
- if (r.isBinary) continue;
5136
- if ((r.added ?? 0) > maxAdded) maxAdded = r.added ?? 0;
5137
- if ((r.removed ?? 0) > maxRemoved) maxRemoved = r.removed ?? 0;
5138
- }
5139
- const addWidth = String(maxAdded).length;
5140
- const remWidth = String(maxRemoved).length;
5141
- const statColumnWidth = 1 + addWidth + 1 + 1 + remWidth;
5142
- return { addWidth, remWidth, statColumnWidth };
5143
- }
5144
- __name(computeDiffColumnWidths, "computeDiffColumnWidths");
5145
- function renderDiffModelText(model) {
5146
- const { filesCount, linesAdded, linesRemoved, rows, hiddenCount } = model;
5147
- const header = filesCount === 1 ? t("{{count}} file changed, +{{added}} / -{{removed}}", {
5148
- count: String(filesCount),
5149
- added: String(linesAdded),
5150
- removed: String(linesRemoved)
5151
- }) : t("{{count}} files changed, +{{added}} / -{{removed}}", {
5152
- count: String(filesCount),
5153
- added: String(linesAdded),
5154
- removed: String(linesRemoved)
5155
- });
5156
- const lines = formatRowsText(rows);
5157
- const capNote = hiddenCount > 0 && rows.length > 0 ? `
5158
- ${t("\u2026and {{hidden}} more (showing first {{shown}})", {
5159
- hidden: String(hiddenCount),
5160
- shown: String(rows.length)
5161
- })}` : "";
5162
- return lines.length > 0 ? `${header}
5163
- ${lines.join("\n")}${capNote}` : header;
5164
- }
5165
- __name(renderDiffModelText, "renderDiffModelText");
5166
- function formatRowsText(rows) {
5167
- if (rows.length === 0) return [];
5168
- const { addWidth, remWidth, statColumnWidth } = computeDiffColumnWidths(rows);
5169
- const out = [];
5170
- for (const r of rows) {
5171
- const safeName = sanitizeFilenameForDisplay(r.filename);
5172
- const displayName = r.oldPath ? `${sanitizeFilenameForDisplay(r.oldPath)} \u2192 ${safeName}` : safeName;
5173
- if (r.isBinary) {
5174
- const suffix2 = r.isUntracked ? ` ${t("(binary, new)")}` : r.isDeleted ? ` ${t("(binary, deleted)")}` : ` ${t("(binary)")}`;
5175
- out.push(` ${padMarker("~", statColumnWidth)} ${displayName}${suffix2}`);
5176
- continue;
5177
- }
5178
- const added = `+${String(r.added ?? 0).padStart(addWidth)}`;
5179
- const removed = `-${String(r.removed ?? 0).padStart(remWidth)}`;
5180
- let suffix = "";
5181
- if (r.isUntracked) {
5182
- suffix = r.truncated ? ` ${t("(new, partial)")}` : ` ${t("(new)")}`;
5183
- } else if (r.isDeleted) {
5184
- suffix = ` ${t("(deleted)")}`;
5185
- }
5186
- out.push(` ${added} ${removed} ${displayName}${suffix}`);
5187
- }
5188
- return out;
5189
- }
5190
- __name(formatRowsText, "formatRowsText");
5191
- function padMarker(marker, width) {
5192
- if (marker.length >= width) return marker;
5193
- return `${marker}${" ".repeat(width - marker.length)}`;
5194
- }
5195
- __name(padMarker, "padMarker");
5196
- var diffCommand = {
5197
- name: "diff",
5198
- get description() {
5199
- return t("Show working-tree change stats versus HEAD");
5200
- },
5201
- kind: "built-in" /* BUILT_IN */,
5202
- supportedModes: ["interactive", "non_interactive", "acp"],
5203
- action: diffAction
5204
- };
5205
-
5206
- // packages/cli/src/utils/systemInfoFields.ts
5207
- init_esbuild_shims();
5208
- function getSystemInfoFields(info) {
5209
- const fields = [];
5210
- addField(fields, t("Qwen Code"), formatCliVersion(info));
5211
- addField(fields, t("Runtime"), formatRuntime(info));
5212
- addField(fields, t("IDE Client"), info.ideClient);
5213
- addField(fields, "LSP", info.lspStatus ?? "");
5214
- addField(fields, t("OS"), formatOs(info));
5215
- addField(fields, t("Auth"), formatAuth(info));
5216
- addField(fields, t("Base URL"), formatBaseUrl(info));
5217
- addField(fields, t("Model"), info.modelVersion);
5218
- addField(fields, t("Fast Model"), info.fastModel || info.modelVersion);
5219
- addField(fields, t("Session ID"), info.sessionId);
5220
- addField(fields, t("Sandbox"), info.sandboxEnv);
5221
- addField(fields, t("Proxy"), formatProxy(info.proxy));
5222
- addField(fields, t("Memory Usage"), info.memoryUsage);
5223
- return fields;
5224
- }
5225
- __name(getSystemInfoFields, "getSystemInfoFields");
5226
- function addField(fields, label, value) {
5227
- if (value) {
5228
- fields.push({ label, value });
5229
- }
5230
- }
5231
- __name(addField, "addField");
5232
- function formatCliVersion(info) {
5233
- if (!info.cliVersion) {
5234
- return "";
5235
- }
5236
- if (!info.gitCommit) {
5237
- return info.cliVersion;
5238
- }
5239
- return `${info.cliVersion} (${info.gitCommit})`;
5240
- }
5241
- __name(formatCliVersion, "formatCliVersion");
5242
- function formatRuntime(info) {
5243
- if (!info.nodeVersion && !info.npmVersion) {
5244
- return "";
5245
- }
5246
- const node = info.nodeVersion ? `Node.js ${info.nodeVersion}` : "";
5247
- const npm = info.npmVersion ? `npm ${info.npmVersion}` : "";
5248
- return joinParts([node, npm], " / ");
5249
- }
5250
- __name(formatRuntime, "formatRuntime");
5251
- function formatOs(info) {
5252
- return joinParts(
5253
- [info.osPlatform, info.osArch, formatOsRelease(info.osRelease)],
5254
- " "
5255
- ).trim();
5256
- }
5257
- __name(formatOs, "formatOs");
5258
- function formatOsRelease(release) {
5259
- if (!release) {
5260
- return "";
5261
- }
5262
- return `(${release})`;
5263
- }
5264
- __name(formatOsRelease, "formatOsRelease");
5265
- function formatAuth(info) {
5266
- if (!info.selectedAuthType) {
5267
- return "";
5268
- }
5269
- const managedProvider = findProviderByCredentials(
5270
- info.baseUrl,
5271
- info.apiKeyEnvKey
5272
- );
5273
- if (managedProvider && resolveMetadataKey(managedProvider)) {
5274
- return t(managedProvider.label);
5275
- }
5276
- if (info.selectedAuthType.startsWith("oauth") || info.selectedAuthType === "qwen-oauth") {
5277
- return "Qwen OAuth";
5278
- }
5279
- return `API Key - ${info.selectedAuthType}`;
5280
- }
5281
- __name(formatAuth, "formatAuth");
5282
- function formatBaseUrl(info) {
5283
- if (!info.selectedAuthType || !info.baseUrl) {
5284
- return "";
5285
- }
5286
- if (info.selectedAuthType.startsWith("oauth") || info.selectedAuthType === "qwen-oauth") {
5287
- return "";
5288
- }
5289
- return info.baseUrl;
5290
- }
5291
- __name(formatBaseUrl, "formatBaseUrl");
5292
- function formatProxy(proxy) {
5293
- if (!proxy) {
5294
- return "no proxy";
5295
- }
5296
- return redactProxy(proxy);
5297
- }
5298
- __name(formatProxy, "formatProxy");
5299
- function redactProxy(proxy) {
5300
- try {
5301
- const url = new URL(proxy);
5302
- if (url.username || url.password) {
5303
- url.username = url.username ? "***" : "";
5304
- url.password = url.password ? "***" : "";
5305
- }
5306
- return url.toString();
5307
- } catch {
5308
- return proxy.replace(/\/\/[^/]*@/, "//***@");
5309
- }
5310
- }
5311
- __name(redactProxy, "redactProxy");
5312
- function joinParts(parts, separator) {
5313
- return parts.filter((part) => part).join(separator);
5314
- }
5315
- __name(joinParts, "joinParts");
5316
-
5317
- // packages/cli/src/utils/costCalculator.ts
5318
- init_esbuild_shims();
5319
- function calculateCost(args) {
5320
- const { inputTokens, outputTokens, pricing } = args;
5321
- if (!pricing) return null;
5322
- const inputCost = pricing.inputPerMillionTokens != null ? inputTokens / 1e6 * pricing.inputPerMillionTokens : 0;
5323
- const outputCost = pricing.outputPerMillionTokens != null ? outputTokens / 1e6 * pricing.outputPerMillionTokens : 0;
5324
- const total = inputCost + outputCost;
5325
- return total > 0 ? total : null;
5326
- }
5327
- __name(calculateCost, "calculateCost");
5328
-
5329
- // packages/cli/src/ui/utils/skill-level-label.ts
5330
- init_esbuild_shims();
5331
- function levelLabel(level) {
5332
- switch (level) {
5333
- case "project":
5334
- return t("Project");
5335
- case "user":
5336
- return t("User");
5337
- case "extension":
5338
- return t("Extension");
5339
- case "bundled":
5340
- return t("Bundled");
5341
- default: {
5342
- const _exhaustive = level;
5343
- return _exhaustive;
5344
- }
5345
- }
5346
- }
5347
- __name(levelLabel, "levelLabel");
5348
-
5349
3246
  export {
5350
- enableMouseEvents,
5351
- disableMouseEvents,
5352
- VSCODE_SHIFT_ENTER_SEQUENCE,
5353
- BEL,
5354
- OSC_PREFIX,
5355
- detectTerminal,
5356
- wrapForMultiplexer,
5357
- oscITerm2Notify,
5358
- oscKittyNotify,
5359
- oscGhosttyNotify,
5360
- generateKittyId,
5361
- writeOsc52,
5362
- clipboardHasImage,
5363
- saveClipboardImage,
5364
- cleanupOldClipboardImages,
5365
- useKeypress,
5366
- useFocus,
5367
- useKeypressContext,
5368
- KeypressProvider,
5369
3247
  wrapAnsi,
5370
3248
  SCREEN_READER_USER_PREFIX,
5371
3249
  SCREEN_READER_MODEL_PREFIX,
@@ -5382,41 +3260,16 @@ export {
5382
3260
  isCollapsibleTool,
5383
3261
  estimateCompactToolGroupHeight,
5384
3262
  CompactToolGroupDisplay,
5385
- getSystemInfoFields,
5386
- calculateErrorRate,
5387
- calculateAverageLatency,
5388
- calculateCacheHitRate,
5389
- computeSessionStats,
5390
- calculateCost,
5391
- getEffectiveSupportedModes,
5392
- filterCommandsForMode,
5393
- levelLabel,
5394
- computeDiffColumnWidths,
5395
- diffCommand,
5396
3263
  buildResumedHistoryItems,
3264
+ stripSuppressOnRestore,
5397
3265
  expandCollapsedHistory,
5398
3266
  applyCollapsePolicyAndSummary
5399
3267
  };
5400
- /**
5401
- * @license
5402
- * Copyright 2025 Qwen
5403
- * SPDX-License-Identifier: Apache-2.0
5404
- *
5405
- * Adapted from gemini-cli (Google LLC, Apache-2.0):
5406
- * packages/cli/src/ui/utils/mouse.ts + utils/input.ts. Trimmed to the
5407
- * subset the virtual-viewport scroll path needs (SGR + X11 parsing,
5408
- * incomplete-sequence detection, enable/disable helpers).
5409
- */
5410
3268
  /**
5411
3269
  * @license
5412
3270
  * Copyright 2025 Google LLC
5413
3271
  * SPDX-License-Identifier: Apache-2.0
5414
3272
  */
5415
- /**
5416
- * @license
5417
- * Copyright 2026 Qwen Team
5418
- * SPDX-License-Identifier: Apache-2.0
5419
- */
5420
3273
  /**
5421
3274
  * @license
5422
3275
  * Copyright 2025 Qwen