@qwen-code/qwen-code 0.21.1-simplify-system-prompt.0 → 0.21.2

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 (422) hide show
  1. package/bundled/qc-helper/docs/configuration/model-providers.md +2 -0
  2. package/bundled/qc-helper/docs/configuration/settings.md +39 -28
  3. package/bundled/qc-helper/docs/features/channels/_meta.ts +2 -0
  4. package/bundled/qc-helper/docs/features/channels/github.md +139 -0
  5. package/bundled/qc-helper/docs/features/channels/gitlab.md +171 -0
  6. package/bundled/qc-helper/docs/features/channels/overview.md +61 -6
  7. package/bundled/qc-helper/docs/features/code-review.md +21 -1
  8. package/bundled/qc-helper/docs/features/hooks.md +72 -15
  9. package/bundled/qc-helper/docs/features/mcp.md +9 -1
  10. package/bundled/qc-helper/docs/features/scheduled-tasks.md +3 -1
  11. package/bundled/qc-helper/docs/features/sub-agents.md +42 -8
  12. package/bundled/qc-helper/docs/qwen-serve.md +11 -7
  13. package/bundled/qc-helper/docs/reference/keyboard-shortcuts.md +2 -2
  14. package/bundled/qc-helper/docs/support/troubleshooting.md +2 -1
  15. package/bundled/review/DESIGN.md +19 -0
  16. package/bundled/review/SKILL.md +120 -61
  17. package/chunks/MaxSizedBox-TQBQ247P.js +88 -0
  18. package/chunks/{StandaloneSessionPicker-O6RKBPU4.js → StandaloneSessionPicker-2HPTKCLX.js} +71 -69
  19. package/chunks/{acp-startup-profiler-RV3IV562.js → acp-startup-profiler-2C4A5ZTJ.js} +2 -2
  20. package/chunks/{acpAgent-HYFVXVDR.js → acpAgent-PS6EDGH3.js} +1628 -590
  21. package/chunks/agent-VDOUB35F.js +84 -0
  22. package/chunks/agent-headless-EO53EFS2.js +78 -0
  23. package/chunks/{anthropicContentGenerator-LXUXMOE7.js → anthropicContentGenerator-OFHSZJBF.js} +61 -20
  24. package/chunks/{artifact-tool-Y5T7GG7F.js → artifact-tool-RDN2W7ND.js} +4 -4
  25. package/chunks/{askUserQuestion-2H6747FR.js → askUserQuestion-OZERWH5R.js} +4 -4
  26. package/chunks/bridge-W7AZSRZQ.js +94 -0
  27. package/chunks/{build-RV63TIRH.js → build-GDBLPA24.js} +1 -1
  28. package/chunks/{ca-25EDXPFZ.js → ca-6W3SK7OQ.js} +6 -1
  29. package/chunks/{channel-management-service-G74LFADV.js → channel-management-service-5S7YCWX5.js} +20 -5
  30. package/chunks/channel-settings-store-JFVRSNER.js +91 -0
  31. package/chunks/{channel-worker-group-PTJIJSKC.js → channel-worker-group-OVWGYMZS.js} +9 -5
  32. package/chunks/{channel-worker-manager-WIMGM2FD.js → channel-worker-manager-H55GKOQA.js} +9 -5
  33. package/chunks/{channel-worker-supervisor-KUFTR6P5.js → channel-worker-supervisor-CABBXYHK.js} +5 -4
  34. package/chunks/{chunk-6GMVPFB2.js → chunk-2IIJTXYF.js} +45 -16
  35. package/chunks/{chunk-BPJSQIJX.js → chunk-2J3OJGTL.js} +0 -2
  36. package/chunks/{chunk-I7XZ3RY5.js → chunk-2KKCCLPT.js} +1 -1
  37. package/chunks/{chunk-MSLKI6C2.js → chunk-2LEOZTBT.js} +49 -26
  38. package/chunks/{chunk-3QMGYBFN.js → chunk-3APUUXRF.js} +1 -80
  39. package/chunks/{chunk-VV6XU5L7.js → chunk-3F2WDAV6.js} +16 -11
  40. package/chunks/{chunk-MUP3T3AD.js → chunk-3I6DUGQD.js} +1 -35
  41. package/chunks/{chunk-66RMLJHC.js → chunk-44F4LBWZ.js} +577 -208
  42. package/chunks/{chunk-VAK25FTU.js → chunk-45IOTAUS.js} +1 -1
  43. package/chunks/{chunk-JZA3JUDJ.js → chunk-4KP2F2TE.js} +1 -1
  44. package/chunks/{chunk-DM4Q4JJH.js → chunk-54YCNSK5.js} +36562 -45062
  45. package/chunks/{chunk-2Q3OT4OV.js → chunk-56Z7QEAQ.js} +200 -77
  46. package/chunks/{chunk-ZOIFNCKL.js → chunk-5NNHICSA.js} +3 -23
  47. package/chunks/{chunk-A4UCTEB5.js → chunk-5WV5S2GT.js} +0 -1
  48. package/chunks/{chunk-RHLZR4E5.js → chunk-675H6PLP.js} +1 -1
  49. package/chunks/{chunk-YAF5VNU7.js → chunk-6CQWRWUC.js} +4 -5
  50. package/chunks/chunk-6FMJLI5M.js +1591 -0
  51. package/chunks/{chunk-HV3G62R6.js → chunk-6MPDY6ZG.js} +1 -1
  52. package/chunks/{chunk-32MVHM4T.js → chunk-6PQPKTXP.js} +1 -1
  53. package/chunks/{chunk-LG4GZIVV.js → chunk-6TAASXWL.js} +4 -4
  54. package/chunks/{chunk-OJGCZBB7.js → chunk-77V3VIKL.js} +41 -36
  55. package/chunks/{chunk-2OM7GEXO.js → chunk-7KAXXBER.js} +3 -3
  56. package/chunks/{chunk-2JM6GZ5D.js → chunk-7SJN2IWT.js} +8 -13
  57. package/chunks/{chunk-UUUTRMI2.js → chunk-7ULQIS27.js} +1 -1
  58. package/chunks/{chunk-2YZJCM5T.js → chunk-A7Y5H4TX.js} +4 -4
  59. package/chunks/{chunk-TOFQCPDC.js → chunk-AOHY3QJ3.js} +14 -8
  60. package/chunks/chunk-AQ37AY7B.js +93 -0
  61. package/chunks/{chunk-B6ZJ7SI6.js → chunk-AUOULH6Q.js} +383 -320
  62. package/chunks/{chunk-PJIZUQVC.js → chunk-AZQ3DT76.js} +2 -2
  63. package/chunks/{chunk-UH3WSE5L.js → chunk-B4AJNNOL.js} +1 -6
  64. package/chunks/{chunk-7FZEBPKS.js → chunk-BBIQAX4V.js} +23 -18
  65. package/chunks/{chunk-L26JL52R.js → chunk-CBBP4BMC.js} +64 -67
  66. package/chunks/{chunk-ZD6UTE4A.js → chunk-CNTR4GR6.js} +1 -1
  67. package/chunks/{chunk-4M377AZG.js → chunk-CO2U743O.js} +6 -6
  68. package/chunks/{chunk-3SJ43L4W.js → chunk-CPZAH673.js} +6 -0
  69. package/chunks/{chunk-VFSJ5VRH.js → chunk-CU47KXB5.js} +3 -3
  70. package/chunks/{chunk-EPDRMGT4.js → chunk-D4HTUMGX.js} +4 -28
  71. package/chunks/{chunk-XHRTVPG2.js → chunk-D6MDRSZ6.js} +7 -7
  72. package/chunks/{chunk-BYFNTGKI.js → chunk-DEEABGH2.js} +3111 -989
  73. package/chunks/{chunk-XVNQMZ2I.js → chunk-DGEIYUC3.js} +0 -1
  74. package/chunks/{chunk-BPZALHVR.js → chunk-DI35ZN7T.js} +1 -1
  75. package/chunks/{chunk-B4UMZKMU.js → chunk-DQ2O5QOJ.js} +1 -1
  76. package/chunks/{chunk-DLWL3Z7A.js → chunk-DSFHVTWD.js} +3 -3
  77. package/chunks/{chunk-RWS5VYWC.js → chunk-DUNI4EBW.js} +950 -446
  78. package/chunks/{chunk-NL7LTRLR.js → chunk-E2BHWIDT.js} +48 -72
  79. package/chunks/{chunk-3MSHSCSN.js → chunk-E2FN6SM7.js} +93 -3
  80. package/chunks/{chunk-USTWD7QV.js → chunk-E6CJ2SMM.js} +26 -16
  81. package/chunks/{chunk-TF2X2WCT.js → chunk-EQNUDTL6.js} +2 -2
  82. package/chunks/{chunk-PANH4R3B.js → chunk-EU5TBFJI.js} +18 -12
  83. package/chunks/{chunk-W4CQXHT6.js → chunk-FANRZEAJ.js} +1 -1
  84. package/chunks/{chunk-WBL3FJEU.js → chunk-FC4KQFCS.js} +1 -1
  85. package/chunks/{chunk-N3FAY5CM.js → chunk-FCYYAB4S.js} +157 -4
  86. package/chunks/{chunk-OKY7HXPG.js → chunk-FJ5WUMUQ.js} +2 -2
  87. package/chunks/{chunk-M4UKFCZ2.js → chunk-FNDXMN7I.js} +231 -171
  88. package/chunks/{chunk-FQK6JAFG.js → chunk-FS674JW4.js} +4 -4
  89. package/chunks/chunk-FYJ7W2PI.js +194 -0
  90. package/chunks/{chunk-INADJJGW.js → chunk-G7XXKQYS.js} +2 -2
  91. package/chunks/{chunk-LNARWLZQ.js → chunk-GJ2GBPBD.js} +2 -2
  92. package/chunks/{chunk-E5WH5O3C.js → chunk-GL4JOZXU.js} +4 -4
  93. package/chunks/{chunk-LS77BEZP.js → chunk-GLCZKT5V.js} +1 -5
  94. package/chunks/{chunk-KU5XMLDK.js → chunk-GURGAJTX.js} +4 -1
  95. package/chunks/{chunk-5THCYPLO.js → chunk-H6I4PGRV.js} +15 -8
  96. package/chunks/{chunk-A5L3JMUA.js → chunk-HC45LTEN.js} +18 -4
  97. package/chunks/{chunk-U7TXFVUN.js → chunk-HIVKI6O6.js} +118 -95
  98. package/chunks/{chunk-QY5MMZ6O.js → chunk-HX6RLYUO.js} +3 -3
  99. package/chunks/{chunk-GZXCZHCT.js → chunk-I3G5JWBV.js} +1 -1
  100. package/chunks/{chunk-ER5LWJR6.js → chunk-I5BT7ADR.js} +3 -3
  101. package/chunks/{chunk-L5UHQJTJ.js → chunk-IGTHU3T4.js} +1 -1
  102. package/chunks/{chunk-BIQWWWJN.js → chunk-IIUGIWWY.js} +1 -1
  103. package/chunks/{chunk-ML52PL6O.js → chunk-JCJ7LKNA.js} +5856 -5334
  104. package/chunks/{chunk-B7QDM6Z7.js → chunk-JE2CEOBO.js} +2 -2
  105. package/chunks/{chunk-S3TWXGKA.js → chunk-JE7KQ2UP.js} +4 -2
  106. package/chunks/{chunk-P5V4T7NK.js → chunk-JJPKFJBT.js} +11 -3
  107. package/chunks/{chunk-J6D3VXCC.js → chunk-JLZ3RBQG.js} +18 -5
  108. package/chunks/{chunk-PWTZEM3C.js → chunk-JXVC2PL3.js} +3 -37
  109. package/chunks/chunk-JYBU6YUE.js +378 -0
  110. package/chunks/{chunk-JCW2R7WC.js → chunk-K623ENWT.js} +3 -79
  111. package/chunks/{chunk-T2NCM2ET.js → chunk-K6KS3LTN.js} +2 -749
  112. package/chunks/{chunk-Z5BLYMZM.js → chunk-KR32NIAN.js} +6 -6
  113. package/chunks/{chunk-MK7VQDN3.js → chunk-KWHKHSIS.js} +8 -6
  114. package/chunks/{chunk-5U4IPFBR.js → chunk-KXDONCPU.js} +4 -4
  115. package/chunks/{chunk-DHHOYAPR.js → chunk-L2E5GFAG.js} +7 -7
  116. package/chunks/{chunk-V6VRAM7B.js → chunk-L32VV3ZJ.js} +12 -12
  117. package/chunks/{chunk-2W3OOD4W.js → chunk-L55JWS76.js} +6 -3
  118. package/chunks/{chunk-E5TUC6CA.js → chunk-LHKCY7DY.js} +3 -3
  119. package/chunks/{chunk-NH6KE4JX.js → chunk-LOY7RWQG.js} +3 -3
  120. package/chunks/{chunk-CC4N4M36.js → chunk-LYI2PZDK.js} +1 -1
  121. package/chunks/{chunk-3JAQDSXN.js → chunk-MB32MS4U.js} +80 -9
  122. package/chunks/{chunk-PR75REBZ.js → chunk-MM7TH7ZM.js} +12 -82
  123. package/chunks/{chunk-FODK6UMO.js → chunk-MPHPFVKK.js} +0 -2
  124. package/chunks/{chunk-M5JM7OSF.js → chunk-N4ACHWNH.js} +2 -3
  125. package/chunks/{chunk-JESCGQM3.js → chunk-NAVJD2PQ.js} +8 -7
  126. package/chunks/{chunk-J56UI34H.js → chunk-NBD76HUW.js} +4 -2
  127. package/chunks/{chunk-C3NS4F2Q.js → chunk-NHFEMWAZ.js} +1 -1
  128. package/chunks/{chunk-6PSLCFQ2.js → chunk-NTDH4IML.js} +18 -9
  129. package/chunks/{chunk-6OUGMXDC.js → chunk-NWNEANAT.js} +7 -7
  130. package/chunks/chunk-O6GEWCJA.js +21 -0
  131. package/chunks/chunk-OCPBI7J5.js +18 -0
  132. package/chunks/{chunk-ZE5WPL4I.js → chunk-OFZKFPYG.js} +3 -3
  133. package/chunks/{chunk-KIUFNBHR.js → chunk-P5VC5USY.js} +1 -1
  134. package/chunks/chunk-P755N4CS.js +2196 -0
  135. package/chunks/{chunk-BRRAJXPA.js → chunk-PCK4B6LR.js} +1 -1
  136. package/chunks/{chunk-TQCBGUHN.js → chunk-PJOHNFIY.js} +5 -5
  137. package/chunks/{chunk-G4WFQUYQ.js → chunk-PVNQRENX.js} +1 -1
  138. package/chunks/{chunk-DM22XS4K.js → chunk-PZEXDV3H.js} +357 -13
  139. package/chunks/{chunk-2JZBVYTU.js → chunk-Q3T5KA2V.js} +1 -8
  140. package/chunks/{chunk-SASBXAQL.js → chunk-Q5WZTTWE.js} +4 -4
  141. package/chunks/{chunk-SRZ6DXVG.js → chunk-QARJNL2V.js} +44 -136
  142. package/chunks/{chunk-YH6G52F2.js → chunk-QCXGC7QB.js} +4 -4
  143. package/chunks/{chunk-SQBYH7PX.js → chunk-QDK4F2N5.js} +1 -1
  144. package/chunks/{chunk-VDDGDZMA.js → chunk-QHWCP53L.js} +14 -7
  145. package/chunks/{chunk-H5FFA6TH.js → chunk-QTHQ6Z5X.js} +16 -3
  146. package/chunks/{chunk-5I2IWRSH.js → chunk-R2XWGR75.js} +2 -2
  147. package/chunks/{chunk-PHVR5UUY.js → chunk-RDJOB6S3.js} +1 -1
  148. package/chunks/{chunk-GDIPH4JY.js → chunk-RG64CDT2.js} +6 -6
  149. package/chunks/{chunk-3HBZKBMQ.js → chunk-RSVPYAGK.js} +5 -5
  150. package/chunks/{chunk-6AM5D4ME.js → chunk-S6LOFUVP.js} +0 -12
  151. package/chunks/{chunk-K4XWPEWB.js → chunk-SHN4KHDK.js} +4 -33
  152. package/chunks/{chunk-VYPFXUCB.js → chunk-SZ3KHTDR.js} +1 -1
  153. package/chunks/chunk-T26EAKDL.js +13 -0
  154. package/chunks/chunk-T3CHYWJZ.js +758 -0
  155. package/chunks/{chunk-FNQ6T3CV.js → chunk-TEGJSJDF.js} +10 -7
  156. package/chunks/{chunk-OHNBB4XR.js → chunk-THVU3RNH.js} +1 -1
  157. package/chunks/{record-artifact-RQKFYO5B.js → chunk-TIRRPCFS.js} +22 -7
  158. package/chunks/chunk-TTJZAIFP.js +319 -0
  159. package/chunks/{chunk-63P4EL5V.js → chunk-TZTAV5RH.js} +1 -1
  160. package/chunks/{chunk-52O2CIUL.js → chunk-UV6KF7T3.js} +130 -5
  161. package/chunks/{chunk-QPDRAXDJ.js → chunk-V25K5ID7.js} +1 -1
  162. package/chunks/{chunk-3IXOIAKE.js → chunk-V4XNUDPE.js} +18 -6
  163. package/chunks/{chunk-WDSWXQU3.js → chunk-VEMNQMHA.js} +2 -2
  164. package/chunks/{chunk-LNURQEMZ.js → chunk-VMX5RZQH.js} +12 -10
  165. package/chunks/{chunk-JALU3ZDU.js → chunk-W3UKBMSI.js} +154 -16
  166. package/chunks/{chunk-DN6ZX5AY.js → chunk-WWCMSZII.js} +61 -14
  167. package/chunks/{chunk-COH43MRJ.js → chunk-XCGIMOLN.js} +27 -1
  168. package/chunks/{chunk-FY3M44RD.js → chunk-XP4L6KS3.js} +3 -3
  169. package/chunks/{chunk-6FGBXPWM.js → chunk-XQK4XXTN.js} +38 -44
  170. package/chunks/{chunk-A6UO2C7C.js → chunk-XUGZYLDH.js} +167 -81
  171. package/chunks/{chunk-LZEMEFKY.js → chunk-YANIWTRZ.js} +1 -1
  172. package/chunks/{chunk-IPUUTYMV.js → chunk-YDLJGZHL.js} +1 -1
  173. package/chunks/{chunk-HIJQF5B5.js → chunk-YGE3IXJP.js} +1 -1
  174. package/chunks/{chunk-BJX6ZSUK.js → chunk-YUFIEIWC.js} +2 -2
  175. package/chunks/{chunk-BO4XCS7P.js → chunk-Z3S5EMOW.js} +20 -85
  176. package/chunks/chunk-Z4X5MTRT.js +133 -0
  177. package/chunks/{chunk-UW5EOVUN.js → chunk-ZBVS26BY.js} +4 -4
  178. package/chunks/{chunk-PSWQZHEA.js → chunk-ZMOJ7ISP.js} +1 -1
  179. package/chunks/{chunk-HTO4JFDZ.js → chunk-ZPJWUGCS.js} +0 -1
  180. package/chunks/{chunk-MVS3NS2N.js → chunk-ZPZ7ZJEE.js} +28 -5
  181. package/chunks/{computer-use-DOFAHZAB.js → computer-use-5QWCFNKD.js} +52 -50
  182. package/chunks/{config-utils-VFQXVGNR.js → config-utils-WADIDWGG.js} +4 -4
  183. package/chunks/contextCommand-4Z7T7TUM.js +83 -0
  184. package/chunks/core-runtime-6N4EFC2Q.js +137 -0
  185. package/chunks/{create-sub-session-IWW2IZ2T.js → create-sub-session-62YZWVAY.js} +3 -3
  186. package/chunks/{create-sub-session-7543K2QA.js → create-sub-session-AEREHZBQ.js} +49 -47
  187. package/chunks/{cron-create-YIID5XAW.js → cron-create-6E7GIQTG.js} +6 -6
  188. package/chunks/{cron-delete-ZVHYCEP2.js → cron-delete-JD26XY3W.js} +5 -5
  189. package/chunks/{cron-list-XEGS463Q.js → cron-list-CUWFB44G.js} +6 -6
  190. package/chunks/{daemon-VOMQW7KZ.js → daemon-PCNCI5YU.js} +239 -18
  191. package/chunks/daemon-status-provider-DDF7C5M7.js +93 -0
  192. package/chunks/daemon-trust-policy-Q4KSOJTR.js +88 -0
  193. package/chunks/daemon-trust-policy-monitor-V6FTE3IY.js +175 -0
  194. package/chunks/{de-HGRCYDEJ.js → de-SY6O76BF.js} +6 -1
  195. package/chunks/deferred-core-runtime-GHJ5GQHK.js +92 -0
  196. package/chunks/dist-26BIMQT6.js +4487 -0
  197. package/chunks/{dist-KTYYJ2C5.js → dist-2PERFI23.js} +12 -9
  198. package/chunks/{dist-NNVBBOGU.js → dist-OAOC5OV4.js} +2 -2
  199. package/chunks/{dist-K6Y4E7FX.js → dist-PVEAFLHY.js} +5 -4
  200. package/chunks/{dist-RTJFMNEZ.js → dist-SL2LUMML.js} +1449 -14
  201. package/chunks/dist-ULIG4M5H.js +13415 -0
  202. package/chunks/{dist-ANLAT3GS.js → dist-WGMNT3JQ.js} +2 -1
  203. package/chunks/{dist-BRB6EXK4.js → dist-ZHXOBXDN.js} +3 -3
  204. package/chunks/earlyInputCapture-TQXLLISD.js +85 -0
  205. package/chunks/{edit-RIEOJWKB.js → edit-FJEUV6KZ.js} +51 -49
  206. package/chunks/{en-MTWBNGDO.js → en-NBK3JKCE.js} +9 -1
  207. package/chunks/{enter-worktree-OGK5FQ3R.js → enter-worktree-7GE3TZ4P.js} +51 -49
  208. package/chunks/{enterPlanMode-IWZYALIB.js → enterPlanMode-KR5TMPCJ.js} +51 -49
  209. package/chunks/environment-SWL3CMB3.js +105 -0
  210. package/chunks/errors-XQE7BGZV.js +91 -0
  211. package/chunks/esm-K5FARBNI.js +5548 -0
  212. package/chunks/{exit-worktree-4TEYVIVP.js → exit-worktree-CHKTYNCV.js} +51 -49
  213. package/chunks/exitPlanMode-QYAG6LWX.js +76 -0
  214. package/chunks/{fast-path-HYE7IFEV.js → fast-path-Z2K7W6DC.js} +13 -3
  215. package/chunks/{fr-45RLL55O.js → fr-4KG5V7UT.js} +6 -1
  216. package/chunks/{gemini-NGRQX3YJ.js → gemini-YU4XKEDG.js} +107 -103
  217. package/chunks/{geminiContentGenerator-FQHPFZSR.js → geminiContentGenerator-ZZX6NBO4.js} +7 -7
  218. package/chunks/{getMachineId-bsd-V7W3GODC.js → getMachineId-bsd-FG7IUY6U.js} +1 -1
  219. package/chunks/{getMachineId-darwin-TDO75DQP.js → getMachineId-darwin-GLCJI2RA.js} +1 -1
  220. package/chunks/{getMachineId-linux-TF43WQT2.js → getMachineId-linux-O6OPPAKO.js} +1 -1
  221. package/chunks/{getMachineId-unsupported-ZGUO3TXT.js → getMachineId-unsupported-S6CKYVGC.js} +1 -1
  222. package/chunks/{getMachineId-win-ECFYZZFQ.js → getMachineId-win-X5SRNEH7.js} +1 -1
  223. package/chunks/{glob-FRTM3X2E.js → glob-VYF5CXSX.js} +51 -49
  224. package/chunks/goal-tools-HGO6VXPB.js +335 -0
  225. package/chunks/{grep-RKWVROCW.js → grep-5DP5ZUTW.js} +53 -50
  226. package/chunks/handleAutoUpdate-UVBJ56DL.js +84 -0
  227. package/chunks/i18n-UQNYHEUD.js +100 -0
  228. package/chunks/{image-gen-WIEM7KZA.js → image-gen-WHPIZNWF.js} +12 -12
  229. package/chunks/initializer-GMIICF4W.js +89 -0
  230. package/chunks/installationInfo-4MGG4WVI.js +83 -0
  231. package/chunks/{ja-B7DF7DFG.js → ja-F3GSQXMF.js} +6 -1
  232. package/chunks/{keychain-token-storage-MDTG3WRM.js → keychain-token-storage-IKO4G53C.js} +3 -3
  233. package/chunks/lib-RUF3WZA6.js +9 -0
  234. package/chunks/list-CPN2W334.js +92 -0
  235. package/chunks/{list-agents-5KJJHR6I.js → list-agents-PXJ7ZUFB.js} +3 -3
  236. package/chunks/loadedSettingsAdapter-ZQAV5NDO.js +86 -0
  237. package/chunks/{loggingContentGenerator-WGM27QAW.js → loggingContentGenerator-5E7W4IEP.js} +31 -30
  238. package/chunks/{loop-wakeup-FXKNNYSY.js → loop-wakeup-Y26NQZ5I.js} +15 -8
  239. package/chunks/{ls-NTK6VOQJ.js → ls-ONQTTMQR.js} +5 -5
  240. package/chunks/{lsp-2JI24STP.js → lsp-YGHHRGMD.js} +3 -3
  241. package/chunks/{managed-npm-update-JQ2CG3RH.js → managed-npm-update-MKKAXYXA.js} +50 -48
  242. package/chunks/mcp-V5NTJF6X.js +86 -0
  243. package/chunks/{monitor-7FEWXX5F.js → monitor-CO3ASY6E.js} +51 -49
  244. package/chunks/nonInteractiveCli-ZJYEOO7U.js +148 -0
  245. package/chunks/{notebook-edit-JGJV2K6J.js → notebook-edit-Z7AEE6FM.js} +51 -49
  246. package/chunks/{openaiContentGenerator-JPVXDTAO.js → openaiContentGenerator-CA3MQOP3.js} +25 -27
  247. package/chunks/pidfile-NL7MKDRU.js +89 -0
  248. package/chunks/process-registry-2CHQBXH5.js +157 -0
  249. package/chunks/{processUtils-V2LCK6T6.js → processUtils-PB5K2DYH.js} +2 -2
  250. package/chunks/{pt-22Q3FP73.js → pt-EQ33KWEN.js} +6 -1
  251. package/chunks/{qwenContentGenerator-TICV2W2Z.js → qwenContentGenerator-JYFNDCOS.js} +55 -53
  252. package/chunks/{qwenOAuth2-XGFI5XJG.js → qwenOAuth2-W2ALKQDD.js} +10 -10
  253. package/chunks/read-file-IEOR5H5W.js +29 -0
  254. package/chunks/{read-mcp-resource-4DKQWGHD.js → read-mcp-resource-U2IJN5HM.js} +4 -4
  255. package/chunks/record-artifact-MGPJ7EG4.js +21 -0
  256. package/chunks/resumeHistoryUtils-BNBTP5AS.js +94 -0
  257. package/chunks/ripGrep-UMQODKEB.js +76 -0
  258. package/chunks/{ru-FZCNZHDC.js → ru-7OZAUKGG.js} +6 -1
  259. package/chunks/{run-qwen-serve-3VCV4I7E.js → run-qwen-serve-RN2R6QQW.js} +982 -263
  260. package/chunks/runtime-QFJ2MJF5.js +122 -0
  261. package/chunks/{scheduler-RS2I6RU5.js → scheduler-AMYUFOZI.js} +49 -47
  262. package/chunks/{sdk-exporters-grpc-AK3LGHNO.js → sdk-exporters-grpc-54L4LS5L.js} +4 -4
  263. package/chunks/{sdk-exporters-http-FS6ZV7MF.js → sdk-exporters-http-4BQANSJ6.js} +7 -7
  264. package/chunks/{sdk-impl-7FZSCSXB.js → sdk-impl-Z4VXWVFX.js} +10 -10
  265. package/chunks/{send-message-Q6OOR6BR.js → send-message-PMP4ATVM.js} +8 -13
  266. package/chunks/serve-EIIYJVX3.js +92 -0
  267. package/chunks/{server-HRZ23U7M.js → server-EP2LLAPD.js} +4816 -1298
  268. package/chunks/{session-7XHZKTVV.js → session-GMPZBLOW.js} +101 -97
  269. package/chunks/{settings-7ZGZDXAS.js → settings-LN7RNKBS.js} +53 -51
  270. package/chunks/shell-EM2OWU5X.js +86 -0
  271. package/chunks/{skill-LIWXNLDW.js → skill-T5VPSK73.js} +22 -23
  272. package/chunks/skill-settings-GMR3GMNY.js +94 -0
  273. package/chunks/spawnChannel-YPCU62DI.js +85 -0
  274. package/chunks/standalone-update-JAKIM2NF.js +95 -0
  275. package/chunks/{startInteractiveUI-IW3CSKHA.js → startInteractiveUI-YETQWGYF.js} +1240 -903
  276. package/chunks/{syntheticOutput-I3757IWH.js → syntheticOutput-D7E6ZFKR.js} +4 -4
  277. package/chunks/task-create-NFCYD43L.js +26 -0
  278. package/chunks/{task-list-FOPULZEP.js → task-list-TAVMGEVD.js} +7 -7
  279. package/chunks/{task-stop-H6RHXFVQ.js → task-stop-ZDF2UJRM.js} +3 -3
  280. package/chunks/{task-update-M57TFZJT.js → task-update-6L7LHGEX.js} +12 -11
  281. package/chunks/{team-create-O2FROQ4R.js → team-create-LFJ6HGNY.js} +53 -51
  282. package/chunks/{team-delete-QE2UXJL7.js → team-delete-DPGGRQBU.js} +7 -7
  283. package/chunks/{team-plan-approval-Q6WDBXTQ.js → team-plan-approval-C2KLSDGO.js} +51 -49
  284. package/chunks/theme-manager-JQ3ZGBP5.js +80 -0
  285. package/chunks/{todoWrite-VQ7FKOHL.js → todoWrite-2UO5G6G6.js} +34 -6
  286. package/chunks/{tool-search-APECNQ3Z.js → tool-search-FAZBFRJZ.js} +21 -22
  287. package/chunks/total-session-admission-5CALIVYO.js +88 -0
  288. package/chunks/{tree-sitter-FS4VPMZA.js → tree-sitter-4D7QS7F6.js} +1 -1
  289. package/chunks/{tree-sitter-bash-6B46JJCV.js → tree-sitter-bash-VEJGF5XF.js} +1 -1
  290. package/chunks/trustedFolders-KOPSP44S.js +98 -0
  291. package/chunks/{update-relaunch-ON5MDJQG.js → update-relaunch-6QL2TICS.js} +5 -5
  292. package/chunks/updateCheck-4Q6RIKFW.js +95 -0
  293. package/chunks/useAutoAcceptIndicator-Q5BMKZV3.js +96 -0
  294. package/chunks/{validateNonInterActiveAuth-JBLKBKRD.js → validateNonInterActiveAuth-GKOC5F6Z.js} +95 -91
  295. package/chunks/{version-LTNUBQJY.js → version-VSATY2LD.js} +1 -1
  296. package/chunks/{web-fetch-L5UTI53V.js → web-fetch-JCLKL6NL.js} +19 -21
  297. package/chunks/{web-search-KM33JOS3.js → web-search-DSQTFUBX.js} +13 -13
  298. package/chunks/{workflow-K7FAWV77.js → workflow-M6QAVKVJ.js} +52 -50
  299. package/chunks/workspace-providers-status-YKLTLMJA.js +89 -0
  300. package/chunks/{workspace-registration-store-6TGVDJV5.js → workspace-registration-store-5DMGKU64.js} +1 -1
  301. package/chunks/workspace-registry-PTYUSYXX.js +96 -0
  302. package/chunks/workspace-service-25ML3T47.js +103 -0
  303. package/chunks/workspace-skills-status-YKZWOYRX.js +89 -0
  304. package/chunks/workspace-trust-reconciler-5FI2S3OS.js +349 -0
  305. package/chunks/write-file-AY7VLP5X.js +78 -0
  306. package/chunks/xterm-headless-NTYVIBT3.js +3475 -0
  307. package/chunks/{zh-LUIGBD55.js → zh-H3YDK5QW.js} +9 -1
  308. package/chunks/{zh-TW-F5KG2IYD.js → zh-TW-JYCP7XUA.js} +9 -1
  309. package/chunks/zoom-image-S4LJZMD5.js +224 -0
  310. package/cli.js +50 -16
  311. package/locales/ca.js +7 -2
  312. package/locales/de.js +7 -2
  313. package/locales/en.js +10 -2
  314. package/locales/fr.js +7 -2
  315. package/locales/ja.js +7 -2
  316. package/locales/pt.js +7 -2
  317. package/locales/ru.js +7 -2
  318. package/locales/zh-TW.js +10 -2
  319. package/locales/zh.js +10 -2
  320. package/package.json +5 -4
  321. package/web-shell/assets/{arc-BbHijhiN.js → arc-xjArKHU2.js} +1 -1
  322. package/web-shell/assets/{architectureDiagram-3BPJPVTR-Cb4B_JD0.js → architectureDiagram-3BPJPVTR-BgrQDNYG.js} +1 -1
  323. package/web-shell/assets/{blockDiagram-GPEHLZMM-Dsjlh3H-.js → blockDiagram-GPEHLZMM-CXxWC-1_.js} +1 -1
  324. package/web-shell/assets/{c4Diagram-AAUBKEIU-Cp5AeR4U.js → c4Diagram-AAUBKEIU-Dx1tLm3v.js} +1 -1
  325. package/web-shell/assets/channel-B1cyk94G.js +1 -0
  326. package/web-shell/assets/{chunk-2J33WTMH-CLcY7W2e.js → chunk-2J33WTMH-CBxjogVR.js} +1 -1
  327. package/web-shell/assets/{chunk-4BX2VUAB-BUhvY2LR.js → chunk-4BX2VUAB-izb-rY5W.js} +1 -1
  328. package/web-shell/assets/{chunk-55IACEB6-kDIFC_71.js → chunk-55IACEB6-NzLyvSb8.js} +1 -1
  329. package/web-shell/assets/{chunk-727SXJPM-CIBO15f2.js → chunk-727SXJPM-DVyKb0dl.js} +1 -1
  330. package/web-shell/assets/{chunk-AQP2D5EJ-BJ_T_slV.js → chunk-AQP2D5EJ-BtqL7NzB.js} +1 -1
  331. package/web-shell/assets/{chunk-FMBD7UC4-BEkW35J8.js → chunk-FMBD7UC4-iNpdKIO0.js} +1 -1
  332. package/web-shell/assets/{chunk-ND2GUHAM-GGPxofay.js → chunk-ND2GUHAM-DI7cbFmX.js} +1 -1
  333. package/web-shell/assets/{chunk-QZHKN3VN-Bifllrb6.js → chunk-QZHKN3VN-3Y_-xFYs.js} +1 -1
  334. package/web-shell/assets/classDiagram-4FO5ZUOK-BpBYZoRE.js +1 -0
  335. package/web-shell/assets/classDiagram-v2-Q7XG4LA2-BpBYZoRE.js +1 -0
  336. package/web-shell/assets/{cose-bilkent-S5V4N54A-C-Add_Dp.js → cose-bilkent-S5V4N54A--raRatZn.js} +1 -1
  337. package/web-shell/assets/{dagre-BM42HDAG-B7MfwNq2.js → dagre-BM42HDAG-B8SU70mO.js} +1 -1
  338. package/web-shell/assets/{diagram-2AECGRRQ-CY_0zuDz.js → diagram-2AECGRRQ-ewgoakXo.js} +1 -1
  339. package/web-shell/assets/{diagram-5GNKFQAL-VyYSbCgA.js → diagram-5GNKFQAL-Bm_JLTnS.js} +1 -1
  340. package/web-shell/assets/{diagram-KO2AKTUF-CBiIZ2PL.js → diagram-KO2AKTUF-DEIUjUy9.js} +1 -1
  341. package/web-shell/assets/{diagram-LMA3HP47-BL3CrVOx.js → diagram-LMA3HP47-C2Wmrpj-.js} +1 -1
  342. package/web-shell/assets/{diagram-OG6HWLK6-CZUPx96P.js → diagram-OG6HWLK6-CtYe6bFx.js} +1 -1
  343. package/web-shell/assets/{erDiagram-TEJ5UH35-B81xHr1-.js → erDiagram-TEJ5UH35-DfpHcWLV.js} +1 -1
  344. package/web-shell/assets/{flowDiagram-I6XJVG4X-EZWhir-J.js → flowDiagram-I6XJVG4X-CAiUhio5.js} +1 -1
  345. package/web-shell/assets/{ganttDiagram-6RSMTGT7-CVFSuIAg.js → ganttDiagram-6RSMTGT7-CYc7ezr4.js} +1 -1
  346. package/web-shell/assets/{gitGraphDiagram-PVQCEYII-C1H2uQDv.js → gitGraphDiagram-PVQCEYII-70lbkcRS.js} +1 -1
  347. package/web-shell/assets/index-C1k3PDuU.css +5 -0
  348. package/web-shell/assets/index-C2GE3DAF.js +74 -0
  349. package/web-shell/assets/index-DZLIXILO.js +1750 -0
  350. package/web-shell/assets/{index-BYo99NBH.js → index-Ww86nT9f.js} +1 -1
  351. package/web-shell/assets/{infoDiagram-5YYISTIA-BwyFMlF8.js → infoDiagram-5YYISTIA-C7e8DWPa.js} +1 -1
  352. package/web-shell/assets/{ishikawaDiagram-YF4QCWOH-CQ7Yhn2Y.js → ishikawaDiagram-YF4QCWOH-BYLr2op-.js} +1 -1
  353. package/web-shell/assets/{journeyDiagram-JHISSGLW-CJn2sf0l.js → journeyDiagram-JHISSGLW-hEibAHKX.js} +1 -1
  354. package/web-shell/assets/{kanban-definition-UN3LZRKU-DaNRqwVN.js → kanban-definition-UN3LZRKU-F2rt8Uhp.js} +1 -1
  355. package/web-shell/assets/{linear-DCKODZe2.js → linear-DPhyNezd.js} +1 -1
  356. package/web-shell/assets/{mermaid.core-CTGJOk27.js → mermaid.core-ZUtnug0n.js} +5 -5
  357. package/web-shell/assets/{mindmap-definition-RKZ34NQL-BKU3_3rg.js → mindmap-definition-RKZ34NQL-DDWcMoi8.js} +1 -1
  358. package/web-shell/assets/{pieDiagram-4H26LBE5-COcwBJ82.js → pieDiagram-4H26LBE5-CTRKzw1_.js} +1 -1
  359. package/web-shell/assets/{quadrantDiagram-W4KKPZXB-CQnQ443x.js → quadrantDiagram-W4KKPZXB-CAEwYG_z.js} +1 -1
  360. package/web-shell/assets/{requirementDiagram-4Y6WPE33-CZ2oj5cD.js → requirementDiagram-4Y6WPE33-CRjnH9D9.js} +1 -1
  361. package/web-shell/assets/{sankeyDiagram-5OEKKPKP-BxAv5mNu.js → sankeyDiagram-5OEKKPKP-LPQT_sOd.js} +1 -1
  362. package/web-shell/assets/{sequenceDiagram-3UESZ5HK-CztaySPs.js → sequenceDiagram-3UESZ5HK-Ht2Iqvb0.js} +1 -1
  363. package/web-shell/assets/{stateDiagram-AJRCARHV-CTQT1oGD.js → stateDiagram-AJRCARHV-CIUdqOXu.js} +1 -1
  364. package/web-shell/assets/stateDiagram-v2-BHNVJYJU-BmqqQZ6w.js +1 -0
  365. package/web-shell/assets/{timeline-definition-PNZ67QCA-K9Mkex5A.js → timeline-definition-PNZ67QCA-BcilneZF.js} +1 -1
  366. package/web-shell/assets/{vennDiagram-CIIHVFJN-B2rVIw76.js → vennDiagram-CIIHVFJN-BljwiiH1.js} +1 -1
  367. package/web-shell/assets/{wardley-L42UT6IY-Z1w2JR4M.js → wardley-L42UT6IY-DeKjkYjq.js} +1 -1
  368. package/web-shell/assets/{wardleyDiagram-YWT4CUSO-CIX9aKXf.js → wardleyDiagram-YWT4CUSO-L3U1H7KG.js} +1 -1
  369. package/web-shell/assets/{xychartDiagram-2RQKCTM6-CI9DLIKB.js → xychartDiagram-2RQKCTM6-IJnWsgMT.js} +1 -1
  370. package/web-shell/index.html +2 -2
  371. package/chunks/MaxSizedBox-INHRH72H.js +0 -86
  372. package/chunks/agent-VXDAN5JK.js +0 -82
  373. package/chunks/agent-headless-K4ZMMNBD.js +0 -76
  374. package/chunks/bridge-LGPZCFHO.js +0 -91
  375. package/chunks/channel-settings-store-CHCDRTPY.js +0 -89
  376. package/chunks/chunk-SZRN75WQ.js +0 -29
  377. package/chunks/chunk-UGYMA4EI.js +0 -219
  378. package/chunks/chunk-VCBZUOSI.js +0 -8575
  379. package/chunks/contextCommand-QIZYHDR5.js +0 -81
  380. package/chunks/daemon-status-provider-OS5UWBHV.js +0 -90
  381. package/chunks/earlyInputCapture-WQT24RWD.js +0 -83
  382. package/chunks/environment-VZ7BRI4Q.js +0 -103
  383. package/chunks/errors-PCX25DVP.js +0 -89
  384. package/chunks/exitPlanMode-GHPUHBZJ.js +0 -423
  385. package/chunks/handleAutoUpdate-2CZQRJ66.js +0 -82
  386. package/chunks/i18n-XEQVMRKN.js +0 -98
  387. package/chunks/initializer-OVGZ4FLY.js +0 -87
  388. package/chunks/installationInfo-5UUQJI6Y.js +0 -81
  389. package/chunks/list-HODU6RXD.js +0 -90
  390. package/chunks/loadedSettingsAdapter-TYNLBALY.js +0 -84
  391. package/chunks/mcp-J3DFWX4A.js +0 -84
  392. package/chunks/nonInteractiveCli-F4GYSMHT.js +0 -144
  393. package/chunks/pidfile-4VNAR3EP.js +0 -87
  394. package/chunks/read-file-LZXUR4TO.js +0 -31
  395. package/chunks/resumeHistoryUtils-65OX3SGJ.js +0 -92
  396. package/chunks/ripGrep-2U2FRGMV.js +0 -74
  397. package/chunks/runtime-AXJWIEDU.js +0 -120
  398. package/chunks/serve-W2GC47CM.js +0 -90
  399. package/chunks/shell-45IPBDP5.js +0 -84
  400. package/chunks/spawnChannel-PVXQ5AGV.js +0 -83
  401. package/chunks/src-AY65BYR7.js +0 -3166
  402. package/chunks/standalone-update-ZMFNKAEY.js +0 -93
  403. package/chunks/task-create-N7WQSGYA.js +0 -25
  404. package/chunks/theme-manager-YYPZFBAH.js +0 -78
  405. package/chunks/total-session-admission-JXES723M.js +0 -85
  406. package/chunks/trustedFolders-HVI7IXUH.js +0 -94
  407. package/chunks/updateCheck-WUJGHWZZ.js +0 -93
  408. package/chunks/useAutoAcceptIndicator-CHSTZLZD.js +0 -94
  409. package/chunks/workspace-providers-status-GAKSF4LL.js +0 -87
  410. package/chunks/workspace-registry-A7NQUONG.js +0 -89
  411. package/chunks/workspace-service-STGVSO4N.js +0 -99
  412. package/chunks/workspace-skills-status-66AK3DUA.js +0 -86
  413. package/chunks/write-file-HUUCEG4P.js +0 -74
  414. package/web-shell/assets/channel-Bzdx6E8P.js +0 -1
  415. package/web-shell/assets/classDiagram-4FO5ZUOK-Cd6wbiuK.js +0 -1
  416. package/web-shell/assets/classDiagram-v2-Q7XG4LA2-Cd6wbiuK.js +0 -1
  417. package/web-shell/assets/index-B2bXx96W.js +0 -1249
  418. package/web-shell/assets/index-_8mKjx8q.css +0 -5
  419. package/web-shell/assets/stateDiagram-v2-BHNVJYJU-BjMdT6E_.js +0 -1
  420. package/chunks/{chunk-TARRHLLG.js → chunk-QUGAUQGJ.js} +25 -25
  421. package/chunks/{chunk-U7ZFW55U.js → chunk-VOQXFAY5.js} +977 -977
  422. /package/chunks/{chunk-LXXMOYPL.js → chunk-VXZBKKQR.js} +0 -0
@@ -5,28 +5,34 @@ import {
5
5
  } from "./chunk-VGC4I5JJ.js";
6
6
  import {
7
7
  isAnyAutoMemPath
8
- } from "./chunk-MUP3T3AD.js";
8
+ } from "./chunk-3I6DUGQD.js";
9
+ import {
10
+ STRUCTURED_OUTPUT_REDACTED_ARGS
11
+ } from "./chunk-7ULQIS27.js";
12
+ import {
13
+ BaseDeclarativeTool,
14
+ BaseToolInvocation,
15
+ SchemaValidator,
16
+ ToolDisplayNames,
17
+ ToolNames
18
+ } from "./chunk-MM7TH7ZM.js";
9
19
  import {
10
20
  DEFAULT_QWEN_MODEL
11
- } from "./chunk-U7TXFVUN.js";
21
+ } from "./chunk-HIVKI6O6.js";
12
22
  import {
13
23
  estimateTextTokens,
14
24
  generateLegacyMcpToolName,
15
25
  normalizeToolNameForProvider
16
26
  } from "./chunk-46UV252V.js";
17
- import {
18
- require_lib
19
- } from "./chunk-A4UCTEB5.js";
20
27
  import {
21
28
  normalize
22
- } from "./chunk-UW5EOVUN.js";
29
+ } from "./chunk-ZBVS26BY.js";
23
30
  import {
24
31
  InstallationManager
25
- } from "./chunk-5I2IWRSH.js";
32
+ } from "./chunk-R2XWGR75.js";
26
33
  import {
27
- atomicWriteFile,
28
- atomicWriteFileSync
29
- } from "./chunk-A5L3JMUA.js";
34
+ atomicWriteFile
35
+ } from "./chunk-HC45LTEN.js";
30
36
  import {
31
37
  isTelemetrySdkInitialized,
32
38
  recordApiErrorMetrics,
@@ -47,7 +53,7 @@ import {
47
53
  recordSubagentExecutionMetrics,
48
54
  recordTokenUsageMetrics,
49
55
  recordToolCallMetrics
50
- } from "./chunk-SRZ6DXVG.js";
56
+ } from "./chunk-QARJNL2V.js";
51
57
  import {
52
58
  require_src,
53
59
  safeJsonStringify
@@ -73,7 +79,6 @@ import {
73
79
  EVENT_EXTENSION_UNINSTALL,
74
80
  EVENT_EXTENSION_UPDATE,
75
81
  EVENT_FILE_OPERATION,
76
- EVENT_FLASH_FALLBACK,
77
82
  EVENT_IDE_CONNECTION,
78
83
  EVENT_MEMORY_DREAM,
79
84
  EVENT_MEMORY_EXTRACT,
@@ -84,6 +89,7 @@ import {
84
89
  EVENT_PROMPT_SUGGESTION,
85
90
  EVENT_PROTOCOL_TAG_SANITIZED,
86
91
  EVENT_RIPGREP_FALLBACK,
92
+ EVENT_RIPGREP_RUNTIME_RECOVERY,
87
93
  EVENT_SKILL_LAUNCH,
88
94
  EVENT_SLASH_COMMAND,
89
95
  EVENT_SPECULATION,
@@ -96,21 +102,7 @@ import {
96
102
  EVENT_WORKFLOW_KEYWORD,
97
103
  EVENT_WORKFLOW_RUN,
98
104
  SERVICE_NAME
99
- } from "./chunk-INADJJGW.js";
100
- import {
101
- SemanticAttributes,
102
- init_esm
103
- } from "./chunk-U7ZFW55U.js";
104
- import {
105
- STRUCTURED_OUTPUT_REDACTED_ARGS
106
- } from "./chunk-UUUTRMI2.js";
107
- import {
108
- BaseDeclarativeTool,
109
- BaseToolInvocation,
110
- SchemaValidator,
111
- ToolDisplayNames,
112
- ToolNames
113
- } from "./chunk-PR75REBZ.js";
105
+ } from "./chunk-G7XXKQYS.js";
114
106
  import {
115
107
  Storage,
116
108
  createDebugLogger,
@@ -121,7 +113,11 @@ import {
121
113
  makeRelative,
122
114
  shortenPath,
123
115
  unescapePath
124
- } from "./chunk-NL7LTRLR.js";
116
+ } from "./chunk-E2BHWIDT.js";
117
+ import {
118
+ SemanticAttributes,
119
+ init_esm
120
+ } from "./chunk-VOQXFAY5.js";
125
121
  import {
126
122
  require_dist
127
123
  } from "./chunk-75DOP5OR.js";
@@ -5697,7 +5693,7 @@ var require_utils = __commonJS({
5697
5693
  });
5698
5694
 
5699
5695
  // node_modules/chardet/lib/index.js
5700
- var require_lib2 = __commonJS({
5696
+ var require_lib = __commonJS({
5701
5697
  "node_modules/chardet/lib/index.js"(exports) {
5702
5698
  "use strict";
5703
5699
  init_esbuild_shims();
@@ -5818,10 +5814,10 @@ var require_lib2 = __commonJS({
5818
5814
  exports.analyse = analyse;
5819
5815
  var detectFile = /* @__PURE__ */ __name((filepath, opts = {}) => new Promise((resolve, reject) => {
5820
5816
  let fd;
5821
- const fs7 = (0, node_1.default)();
5817
+ const fs8 = (0, node_1.default)();
5822
5818
  const handler = /* @__PURE__ */ __name((err, buffer) => {
5823
5819
  if (fd) {
5824
- fs7.closeSync(fd);
5820
+ fs8.closeSync(fd);
5825
5821
  }
5826
5822
  if (err) {
5827
5823
  reject(err);
@@ -5830,26 +5826,26 @@ var require_lib2 = __commonJS({
5830
5826
  }
5831
5827
  }, "handler");
5832
5828
  if (opts && opts.sampleSize) {
5833
- fd = fs7.openSync(filepath, "r");
5829
+ fd = fs8.openSync(filepath, "r");
5834
5830
  const sample = Buffer.allocUnsafe(opts.sampleSize);
5835
- fs7.read(fd, sample, 0, opts.sampleSize, opts.offset, (err) => {
5831
+ fs8.read(fd, sample, 0, opts.sampleSize, opts.offset, (err) => {
5836
5832
  handler(err, sample);
5837
5833
  });
5838
5834
  return;
5839
5835
  }
5840
- fs7.readFile(filepath, handler);
5836
+ fs8.readFile(filepath, handler);
5841
5837
  }), "detectFile");
5842
5838
  exports.detectFile = detectFile;
5843
5839
  var detectFileSync = /* @__PURE__ */ __name((filepath, opts = {}) => {
5844
- const fs7 = (0, node_1.default)();
5840
+ const fs8 = (0, node_1.default)();
5845
5841
  if (opts && opts.sampleSize) {
5846
- const fd = fs7.openSync(filepath, "r");
5842
+ const fd = fs8.openSync(filepath, "r");
5847
5843
  const sample = Buffer.allocUnsafe(opts.sampleSize);
5848
- fs7.readSync(fd, sample, 0, opts.sampleSize, opts.offset);
5849
- fs7.closeSync(fd);
5844
+ fs8.readSync(fd, sample, 0, opts.sampleSize, opts.offset);
5845
+ fs8.closeSync(fd);
5850
5846
  return (0, exports.detect)(sample);
5851
5847
  }
5852
- return (0, exports.detect)(fs7.readFileSync(filepath));
5848
+ return (0, exports.detect)(fs8.readFileSync(filepath));
5853
5849
  }, "detectFileSync");
5854
5850
  exports.detectFileSync = detectFileSync;
5855
5851
  exports.default = {
@@ -7399,12 +7395,12 @@ var require_lru_cache = __commonJS({
7399
7395
 
7400
7396
  // packages/core/src/tools/read-file.ts
7401
7397
  init_esbuild_shims();
7402
- import path8 from "node:path";
7403
- import fs6 from "node:fs/promises";
7398
+ import path9 from "node:path";
7399
+ import fs7 from "node:fs/promises";
7404
7400
 
7405
7401
  // packages/core/src/utils/fileUtils.ts
7406
7402
  init_esbuild_shims();
7407
- import fs2 from "node:fs";
7403
+ import fs3 from "node:fs";
7408
7404
  import fsPromises from "node:fs/promises";
7409
7405
  import path2 from "node:path";
7410
7406
 
@@ -7830,12 +7826,12 @@ var Mime = class {
7830
7826
  }
7831
7827
  return this;
7832
7828
  }
7833
- getType(path9) {
7834
- if (typeof path9 !== "string")
7829
+ getType(path10) {
7830
+ if (typeof path10 !== "string")
7835
7831
  return null;
7836
- const last = path9.replace(/^.*[/\\]/s, "").toLowerCase();
7832
+ const last = path10.replace(/^.*[/\\]/s, "").toLowerCase();
7837
7833
  const ext = last.replace(/^.*\./s, "").toLowerCase();
7838
- const hasPath = last.length < path9.length;
7834
+ const hasPath = last.length < path10.length;
7839
7835
  const hasDot = ext.length < last.length - 1;
7840
7836
  if (!hasDot && hasPath)
7841
7837
  return null;
@@ -7875,28 +7871,34 @@ var Mime_default = Mime;
7875
7871
  // packages/core/node_modules/mime/dist/src/index_lite.js
7876
7872
  var index_lite_default = new Mime_default(standard_default)._freeze();
7877
7873
 
7878
- // packages/core/src/utils/iconvHelper.ts
7874
+ // packages/core/src/utils/encoding.ts
7879
7875
  init_esbuild_shims();
7880
- var import_iconv_lite = __toESM(require_lib(), 1);
7881
- var iconvLite = import_iconv_lite.default;
7882
- function iconvDecode(buffer, encoding) {
7883
- return iconvLite.decode(buffer, encoding);
7884
- }
7885
- __name(iconvDecode, "iconvDecode");
7886
- function iconvEncode(content, encoding) {
7887
- return iconvLite.encode(content, encoding);
7888
- }
7889
- __name(iconvEncode, "iconvEncode");
7890
- function iconvEncodingExists(encoding) {
7891
- return iconvLite.encodingExists(encoding);
7892
- }
7893
- __name(iconvEncodingExists, "iconvEncodingExists");
7894
7876
  function isUtf8CompatibleEncoding(encoding) {
7895
7877
  const lower = encoding.toLowerCase().replace(/[^a-z0-9]/g, "");
7896
7878
  return lower === "utf8" || lower === "ascii" || lower === "usascii";
7897
7879
  }
7898
7880
  __name(isUtf8CompatibleEncoding, "isUtf8CompatibleEncoding");
7899
7881
 
7882
+ // packages/core/src/utils/load-iconv-lite.ts
7883
+ init_esbuild_shims();
7884
+ var iconvLiteModulePromise;
7885
+ function isIconvLite(candidate) {
7886
+ return "decode" in candidate && typeof candidate.decode === "function" && "encode" in candidate && typeof candidate.encode === "function" && "encodingExists" in candidate && typeof candidate.encodingExists === "function";
7887
+ }
7888
+ __name(isIconvLite, "isIconvLite");
7889
+ function loadIconvLite() {
7890
+ iconvLiteModulePromise ??= import("./lib-RUF3WZA6.js").then((module) => {
7891
+ const imported = module;
7892
+ const candidate = "default" in imported && imported.default ? imported.default : imported;
7893
+ if (!isIconvLite(candidate)) {
7894
+ throw new Error("iconv-lite module does not match the expected API");
7895
+ }
7896
+ return candidate;
7897
+ });
7898
+ return iconvLiteModulePromise;
7899
+ }
7900
+ __name(loadIconvLite, "loadIconvLite");
7901
+
7900
7902
  // packages/core/src/utils/ignorePatterns.ts
7901
7903
  init_esbuild_shims();
7902
7904
  import path from "node:path";
@@ -8106,16 +8108,12 @@ var BINARY_EXTENSIONS = [
8106
8108
 
8107
8109
  // packages/core/src/utils/systemEncoding.ts
8108
8110
  init_esbuild_shims();
8109
- var import_chardet = __toESM(require_lib2(), 1);
8111
+ var import_chardet = __toESM(require_lib(), 1);
8110
8112
  import { isUtf8 } from "node:buffer";
8111
8113
  import { execSync } from "node:child_process";
8112
8114
  import os from "node:os";
8113
8115
  var debugLogger = createDebugLogger("ENCODING");
8114
8116
  var cachedSystemEncoding = void 0;
8115
- function resetEncodingCache() {
8116
- cachedSystemEncoding = void 0;
8117
- }
8118
- __name(resetEncodingCache, "resetEncodingCache");
8119
8117
  function getCachedEncodingForBuffer(buffer) {
8120
8118
  if (isUtf8(buffer)) {
8121
8119
  return "utf-8";
@@ -8865,6 +8863,19 @@ var TEXT_RANGE_FAST_PATH_MAX_SIZE = 10 * 1024 * 1024;
8865
8863
  var DEFAULT_RANGE_READ_BYTES = 25e3;
8866
8864
 
8867
8865
  // packages/core/src/utils/read-text-range.ts
8866
+ var CursorNotAtLineBoundaryError = class extends Error {
8867
+ constructor(startOffset, maxSnapBytes) {
8868
+ super(
8869
+ `Byte offset ${startOffset} is not the start of a line, and no line break was found within ${maxSnapBytes} bytes after it. Resume from a cursor this reader returned.`
8870
+ );
8871
+ this.startOffset = startOffset;
8872
+ this.maxSnapBytes = maxSnapBytes;
8873
+ this.name = "CursorNotAtLineBoundaryError";
8874
+ }
8875
+ static {
8876
+ __name(this, "CursorNotAtLineBoundaryError");
8877
+ }
8878
+ };
8868
8879
  var LargeNonUtf8TextError = class extends Error {
8869
8880
  constructor(encoding, reason) {
8870
8881
  super(
@@ -8878,11 +8889,25 @@ var LargeNonUtf8TextError = class extends Error {
8878
8889
  __name(this, "LargeNonUtf8TextError");
8879
8890
  }
8880
8891
  };
8892
+ var TextScanBudgetExceededError = class extends Error {
8893
+ constructor(scannedBytes, maxScanBytes) {
8894
+ super(
8895
+ `Locating the requested line window would read more than ${maxScanBytes} bytes (line offsets are resolved by scanning from the start of the file). Use a byte-offset read to reach this part of the file.`
8896
+ );
8897
+ this.scannedBytes = scannedBytes;
8898
+ this.maxScanBytes = maxScanBytes;
8899
+ this.name = "TextScanBudgetExceededError";
8900
+ }
8901
+ static {
8902
+ __name(this, "TextScanBudgetExceededError");
8903
+ }
8904
+ };
8881
8905
  async function readTextRange(request2) {
8882
8906
  request2.signal?.throwIfAborted();
8883
8907
  const stats = request2.stats ?? await stat(request2.path);
8884
8908
  const maxOutputBytes = normalizeMaxBytes(request2.maxOutputBytes);
8885
- if (stats.size < TEXT_RANGE_FAST_PATH_MAX_SIZE) {
8909
+ const maxScanBytes = request2.maxScanBytes ?? Number.POSITIVE_INFINITY;
8910
+ if (stats.size < TEXT_RANGE_FAST_PATH_MAX_SIZE && stats.size <= maxScanBytes) {
8886
8911
  const { content, encoding, bom } = await readFileWithEncodingInfo(
8887
8912
  request2.path,
8888
8913
  request2.signal
@@ -8901,9 +8926,193 @@ async function readTextRange(request2) {
8901
8926
  lineEnding: detectLineEndingFromContent(content)
8902
8927
  };
8903
8928
  }
8904
- return readLargeUtf8Range(request2, maxOutputBytes);
8929
+ return readLargeUtf8Range(
8930
+ request2.path,
8931
+ request2,
8932
+ maxOutputBytes,
8933
+ maxScanBytes,
8934
+ stats.size
8935
+ );
8905
8936
  }
8906
8937
  __name(readTextRange, "readTextRange");
8938
+ async function readTextRangeFromHandle(fileHandle, request2) {
8939
+ request2.signal?.throwIfAborted();
8940
+ return readLargeUtf8Range(
8941
+ fileHandle,
8942
+ request2,
8943
+ normalizeMaxBytes(request2.maxOutputBytes),
8944
+ request2.maxScanBytes,
8945
+ request2.fileSize
8946
+ );
8947
+ }
8948
+ __name(readTextRangeFromHandle, "readTextRangeFromHandle");
8949
+ async function readTextCursorWindowFromHandle(fileHandle, request2) {
8950
+ request2.signal?.throwIfAborted();
8951
+ const encoding = await detectFileEncoding(fileHandle);
8952
+ request2.signal?.throwIfAborted();
8953
+ if (!isUtf8CompatibleEncoding(encoding)) {
8954
+ throw new LargeNonUtf8TextError(encoding);
8955
+ }
8956
+ const bom = await hasUtf8Bom(fileHandle, request2.fileSize);
8957
+ const maxOutputBytes = normalizeMaxBytes(request2.maxOutputBytes);
8958
+ const startOffset = await snapToLineStart(fileHandle, request2);
8959
+ if (startOffset >= request2.fileSize) {
8960
+ return {
8961
+ content: "",
8962
+ startOffset,
8963
+ encoding: "utf-8",
8964
+ bom,
8965
+ lineEnding: "lf",
8966
+ truncatedByBytes: false
8967
+ };
8968
+ }
8969
+ const decoder = new TextDecoder2("utf-8", { fatal: true, ignoreBOM: true });
8970
+ const decode = /* @__PURE__ */ __name((chunk, options) => {
8971
+ try {
8972
+ return decoder.decode(chunk, options);
8973
+ } catch {
8974
+ throw new LargeNonUtf8TextError(encoding, "invalid-utf8");
8975
+ }
8976
+ }, "decode");
8977
+ const lines = [];
8978
+ let contentBytes = 0;
8979
+ let consumedBytes = 0;
8980
+ let truncatedByBytes = false;
8981
+ let stop = false;
8982
+ let skipRestOfLine = false;
8983
+ let sawCrlf = false;
8984
+ const emit = /* @__PURE__ */ __name((line, hadNewline) => {
8985
+ const separator = lines.length > 0 ? 1 : 0;
8986
+ const lineBytes = Buffer.byteLength(line, "utf8");
8987
+ if (contentBytes + separator + lineBytes > maxOutputBytes) {
8988
+ if (lines.length > 0) {
8989
+ stop = true;
8990
+ return;
8991
+ }
8992
+ const cut = truncateUtf8(line, maxOutputBytes);
8993
+ lines.push(cut.content);
8994
+ if (hadNewline && line.endsWith("\r")) sawCrlf = true;
8995
+ contentBytes = Buffer.byteLength(cut.content, "utf8");
8996
+ consumedBytes += contentBytes;
8997
+ truncatedByBytes = true;
8998
+ skipRestOfLine = true;
8999
+ stop = true;
9000
+ return;
9001
+ }
9002
+ lines.push(line);
9003
+ if (hadNewline && line.endsWith("\r")) sawCrlf = true;
9004
+ contentBytes += separator + lineBytes;
9005
+ consumedBytes += lineBytes + (hadNewline ? 1 : 0);
9006
+ if (request2.limit !== void 0 && lines.length >= request2.limit) {
9007
+ stop = true;
9008
+ }
9009
+ }, "emit");
9010
+ let pending = "";
9011
+ let firstChunk = true;
9012
+ let reachedEof = true;
9013
+ for await (const raw of chunksFromHandle(
9014
+ fileHandle,
9015
+ startOffset,
9016
+ request2.fileSize,
9017
+ request2.signal
9018
+ )) {
9019
+ request2.signal?.throwIfAborted();
9020
+ let text = decode(raw, { stream: true });
9021
+ if (firstChunk) {
9022
+ firstChunk = false;
9023
+ if (startOffset === 0 && text.charCodeAt(0) === 65279) {
9024
+ text = text.slice(1);
9025
+ consumedBytes += UTF8_BOM_BYTES;
9026
+ }
9027
+ }
9028
+ pending += text;
9029
+ let newline = pending.indexOf("\n");
9030
+ const pendingLine = newline === -1 ? pending : pending.slice(0, newline);
9031
+ const pendingSeparator = lines.length > 0 ? 1 : 0;
9032
+ if (contentBytes + pendingSeparator + Buffer.byteLength(pendingLine, "utf8") > maxOutputBytes) {
9033
+ if (lines.length === 0) {
9034
+ emit(pendingLine, newline !== -1);
9035
+ } else {
9036
+ stop = true;
9037
+ }
9038
+ reachedEof = false;
9039
+ break;
9040
+ }
9041
+ while (newline !== -1) {
9042
+ emit(pending.slice(0, newline), true);
9043
+ pending = pending.slice(newline + 1);
9044
+ if (stop) break;
9045
+ newline = pending.indexOf("\n");
9046
+ }
9047
+ if (stop) {
9048
+ reachedEof = false;
9049
+ break;
9050
+ }
9051
+ }
9052
+ if (reachedEof) {
9053
+ decode();
9054
+ if (!stop) emit(pending, false);
9055
+ }
9056
+ if (skipRestOfLine) {
9057
+ const resumeAt = await snapToLineStart(
9058
+ fileHandle,
9059
+ {
9060
+ ...request2,
9061
+ startOffset: startOffset + Math.max(consumedBytes, 1),
9062
+ // This offset was produced internally after returning a truncated prefix,
9063
+ // so it must advance past the rest of that line. `maxSnapBytes` protects
9064
+ // only client-supplied offsets.
9065
+ maxSnapBytes: request2.fileSize
9066
+ },
9067
+ true
9068
+ );
9069
+ consumedBytes = resumeAt - startOffset;
9070
+ }
9071
+ const content = lines.join("\n");
9072
+ const nextOffset = startOffset + consumedBytes;
9073
+ return {
9074
+ content,
9075
+ startOffset,
9076
+ ...nextOffset < request2.fileSize ? { nextOffset } : {},
9077
+ encoding: "utf-8",
9078
+ bom,
9079
+ lineEnding: sawCrlf ? "crlf" : "lf",
9080
+ truncatedByBytes
9081
+ };
9082
+ }
9083
+ __name(readTextCursorWindowFromHandle, "readTextCursorWindowFromHandle");
9084
+ var UTF8_BOM_BYTES = 3;
9085
+ var LINE_FEED = 10;
9086
+ async function hasUtf8Bom(fileHandle, fileSize) {
9087
+ if (fileSize < UTF8_BOM_BYTES) return false;
9088
+ const probe = Buffer.alloc(UTF8_BOM_BYTES);
9089
+ const { bytesRead } = await fileHandle.read(probe, 0, UTF8_BOM_BYTES, 0);
9090
+ return bytesRead === UTF8_BOM_BYTES && probe[0] === 239 && probe[1] === 187 && probe[2] === 191;
9091
+ }
9092
+ __name(hasUtf8Bom, "hasUtf8Bom");
9093
+ async function snapToLineStart(fileHandle, request2, allowEof = false) {
9094
+ const { startOffset, fileSize, maxSnapBytes, signal } = request2;
9095
+ if (startOffset <= 0) return 0;
9096
+ if (startOffset >= fileSize) return startOffset;
9097
+ const previous = Buffer.alloc(1);
9098
+ const { bytesRead } = await fileHandle.read(previous, 0, 1, startOffset - 1);
9099
+ if (bytesRead === 1 && previous[0] === LINE_FEED) return startOffset;
9100
+ let scanned = 0;
9101
+ const snapEnd = Math.min(fileSize, startOffset + maxSnapBytes);
9102
+ for await (const chunk of chunksFromHandle(
9103
+ fileHandle,
9104
+ startOffset,
9105
+ snapEnd,
9106
+ signal
9107
+ )) {
9108
+ const index = chunk.indexOf(LINE_FEED);
9109
+ if (index !== -1) return startOffset + scanned + index + 1;
9110
+ scanned += chunk.length;
9111
+ }
9112
+ if (allowEof) return fileSize;
9113
+ throw new CursorNotAtLineBoundaryError(startOffset, maxSnapBytes);
9114
+ }
9115
+ __name(snapToLineStart, "snapToLineStart");
8907
9116
  function normalizeMaxBytes(maxOutputBytes) {
8908
9117
  if (maxOutputBytes === Number.POSITIVE_INFINITY) {
8909
9118
  return Number.POSITIVE_INFINITY;
@@ -8929,8 +9138,9 @@ function sliceDecodedContent(content, offset, limit, maxOutputBytes) {
8929
9138
  };
8930
9139
  }
8931
9140
  __name(sliceDecodedContent, "sliceDecodedContent");
8932
- async function readLargeUtf8Range(request2, maxOutputBytes) {
8933
- const encoding = await detectFileEncoding(request2.path);
9141
+ async function readLargeUtf8Range(source, request2, maxOutputBytes, maxScanBytes, sourceSize) {
9142
+ const encoding = await detectFileEncoding(source);
9143
+ request2.signal?.throwIfAborted();
8934
9144
  if (!isUtf8CompatibleEncoding(encoding)) {
8935
9145
  throw new LargeNonUtf8TextError(encoding);
8936
9146
  }
@@ -8946,14 +9156,31 @@ async function readLargeUtf8Range(request2, maxOutputBytes) {
8946
9156
  let previousChunkEndedWithCR = false;
8947
9157
  let originalLineCountExact = true;
8948
9158
  let stoppedEarly = false;
9159
+ let scannedBytes = 0;
9160
+ let consumedBytes = 0;
8949
9161
  const decoder = new TextDecoder2("utf-8", {
8950
9162
  fatal: true,
8951
9163
  ignoreBOM: true
8952
9164
  });
8953
- const stream = createReadStream(request2.path, {
8954
- highWaterMark: 512 * 1024,
8955
- signal: request2.signal
8956
- });
9165
+ let pathStream;
9166
+ let chunks;
9167
+ const sourceEnd = Math.min(
9168
+ sourceSize ?? Number.POSITIVE_INFINITY,
9169
+ maxScanBytes
9170
+ );
9171
+ if (sourceEnd <= 0 && (sourceSize ?? 0) > 0) {
9172
+ throw new TextScanBudgetExceededError(0, maxScanBytes);
9173
+ }
9174
+ if (typeof source === "string") {
9175
+ pathStream = createReadStream(source, {
9176
+ highWaterMark: 512 * 1024,
9177
+ signal: request2.signal,
9178
+ ...Number.isFinite(sourceEnd) ? { end: Math.max(0, sourceEnd - 1) } : {}
9179
+ });
9180
+ chunks = pathStream;
9181
+ } else {
9182
+ chunks = chunksFromHandle(source, 0, sourceEnd, request2.signal);
9183
+ }
8957
9184
  function appendSelected(fragment) {
8958
9185
  if (fragment.length === 0 || truncatedByBytes) {
8959
9186
  return;
@@ -8984,17 +9211,19 @@ async function readLargeUtf8Range(request2, maxOutputBytes) {
8984
9211
  }
8985
9212
  __name(decodeUtf8Chunk, "decodeUtf8Chunk");
8986
9213
  try {
8987
- for await (const rawChunk of stream) {
9214
+ for await (const rawChunk of chunks) {
8988
9215
  request2.signal?.throwIfAborted();
9216
+ scannedBytes += rawChunk.length;
8989
9217
  let chunk = decodeUtf8Chunk(rawChunk, { stream: true });
8990
9218
  if (firstChunk) {
8991
9219
  firstChunk = false;
8992
9220
  if (chunk.charCodeAt(0) === 65279) {
8993
9221
  chunk = chunk.slice(1);
8994
9222
  bom = true;
9223
+ consumedBytes += 3;
8995
9224
  }
8996
9225
  }
8997
- if (previousChunkEndedWithCR && chunk.startsWith("\n") || chunk.includes("\r\n")) {
9226
+ if (isSelectedLine() && previousChunkEndedWithCR && chunk.startsWith("\n")) {
8998
9227
  lineEnding = "crlf";
8999
9228
  }
9000
9229
  previousChunkEndedWithCR = chunk.endsWith("\r");
@@ -9002,11 +9231,14 @@ async function readLargeUtf8Range(request2, maxOutputBytes) {
9002
9231
  let newline = chunk.indexOf("\n", start);
9003
9232
  while (newline !== -1) {
9004
9233
  if (isSelectedLine()) {
9005
- appendSelected(chunk.slice(start, newline));
9234
+ const fragment = chunk.slice(start, newline);
9235
+ if (fragment.endsWith("\r")) lineEnding = "crlf";
9236
+ appendSelected(fragment);
9006
9237
  if (currentLine + 1 < endLine) {
9007
9238
  appendSelected("\n");
9008
9239
  }
9009
9240
  }
9241
+ consumedBytes += Buffer.byteLength(chunk.slice(start, newline), "utf8") + 1;
9010
9242
  currentLine++;
9011
9243
  start = newline + 1;
9012
9244
  if (currentLine >= endLine || truncatedByBytes) {
@@ -9016,8 +9248,12 @@ async function readLargeUtf8Range(request2, maxOutputBytes) {
9016
9248
  }
9017
9249
  newline = chunk.indexOf("\n", start);
9018
9250
  }
9019
- if (start < chunk.length && isSelectedLine()) {
9020
- appendSelected(chunk.slice(start));
9251
+ if (!stoppedEarly && start < chunk.length) {
9252
+ const tail = chunk.slice(start);
9253
+ if (isSelectedLine()) {
9254
+ appendSelected(tail);
9255
+ }
9256
+ consumedBytes += Buffer.byteLength(tail, "utf8");
9021
9257
  }
9022
9258
  if (currentLine >= endLine || truncatedByBytes) {
9023
9259
  originalLineCountExact = false;
@@ -9026,7 +9262,13 @@ async function readLargeUtf8Range(request2, maxOutputBytes) {
9026
9262
  }
9027
9263
  }
9028
9264
  } finally {
9029
- stream.destroy();
9265
+ if (pathStream !== void 0 && !pathStream.destroyed) {
9266
+ pathStream.destroy();
9267
+ }
9268
+ }
9269
+ const budgetExhausted = !stoppedEarly && sourceSize !== void 0 && sourceSize > maxScanBytes && scannedBytes >= maxScanBytes;
9270
+ if (budgetExhausted) {
9271
+ throw new TextScanBudgetExceededError(scannedBytes, maxScanBytes);
9030
9272
  }
9031
9273
  if (!stoppedEarly) {
9032
9274
  decodeUtf8Chunk();
@@ -9034,6 +9276,7 @@ async function readLargeUtf8Range(request2, maxOutputBytes) {
9034
9276
  return {
9035
9277
  content: output,
9036
9278
  originalLineCount: currentLine + 1,
9279
+ ...stoppedEarly && !truncatedByBytes && consumedBytes < (sourceSize ?? Number.POSITIVE_INFINITY) ? { nextByteOffset: consumedBytes } : {},
9037
9280
  encoding: "utf-8",
9038
9281
  bom,
9039
9282
  lineEnding,
@@ -9042,6 +9285,26 @@ async function readLargeUtf8Range(request2, maxOutputBytes) {
9042
9285
  };
9043
9286
  }
9044
9287
  __name(readLargeUtf8Range, "readLargeUtf8Range");
9288
+ async function* chunksFromHandle(fileHandle, from = 0, toExclusive = Number.POSITIVE_INFINITY, signal) {
9289
+ const highWaterMark = 512 * 1024;
9290
+ const buffer = Buffer.allocUnsafe(highWaterMark);
9291
+ let position = from;
9292
+ while (position < toExclusive) {
9293
+ signal?.throwIfAborted();
9294
+ const bytesToRead = Math.min(highWaterMark, toExclusive - position);
9295
+ const { bytesRead } = await fileHandle.read(
9296
+ buffer,
9297
+ 0,
9298
+ bytesToRead,
9299
+ position
9300
+ );
9301
+ signal?.throwIfAborted();
9302
+ if (bytesRead === 0) return;
9303
+ position += bytesRead;
9304
+ yield buffer.subarray(0, bytesRead);
9305
+ }
9306
+ }
9307
+ __name(chunksFromHandle, "chunksFromHandle");
9045
9308
  function truncateUtf8(content, maxBytes) {
9046
9309
  const bytes = Buffer.byteLength(content, "utf8");
9047
9310
  if (bytes <= maxBytes) {
@@ -9066,9 +9329,234 @@ function detectLineEndingFromContent(content) {
9066
9329
  }
9067
9330
  __name(detectLineEndingFromContent, "detectLineEndingFromContent");
9068
9331
 
9332
+ // packages/core/src/utils/image-view.ts
9333
+ init_esbuild_shims();
9334
+ import fs2 from "node:fs/promises";
9335
+ var IMAGE_VIEW_MAX_EDGE = 1568;
9336
+ var IMAGE_VIEW_MAX_PATCHES = 1568;
9337
+ var IMAGE_PATCH_SIZE = 28;
9338
+ var IMAGE_MAX_UPSCALE = 8;
9339
+ var IMAGE_JPEG_QUALITY = 92;
9340
+ var IMAGE_MAX_SOURCE_BYTES = 100 * 1024 * 1024;
9341
+ var IMAGE_MAX_OUTPUT_BYTES = 9 * 1024 * 1024;
9342
+ var SUPPORTED_IMAGE_FORMATS = /* @__PURE__ */ new Set(["jpeg", "png", "webp"]);
9343
+ var ImageViewError = class extends Error {
9344
+ constructor(code, message) {
9345
+ super(message);
9346
+ this.code = code;
9347
+ }
9348
+ static {
9349
+ __name(this, "ImageViewError");
9350
+ }
9351
+ };
9352
+ function fitsVisualBudget({ width, height }) {
9353
+ return width <= IMAGE_VIEW_MAX_EDGE && height <= IMAGE_VIEW_MAX_EDGE && Math.ceil(width / IMAGE_PATCH_SIZE) * Math.ceil(height / IMAGE_PATCH_SIZE) <= IMAGE_VIEW_MAX_PATCHES;
9354
+ }
9355
+ __name(fitsVisualBudget, "fitsVisualBudget");
9356
+ function boundedSize(width, height, maxUpscale) {
9357
+ const widthIsLongEdge = width >= height;
9358
+ const maxLongEdge = Math.min(
9359
+ IMAGE_VIEW_MAX_EDGE,
9360
+ Math.max(width, height) * maxUpscale
9361
+ );
9362
+ let low = 1;
9363
+ let high = maxLongEdge;
9364
+ let best = { width: 1, height: 1 };
9365
+ while (low <= high) {
9366
+ const longEdge = Math.floor((low + high) / 2);
9367
+ const candidate = widthIsLongEdge ? {
9368
+ width: longEdge,
9369
+ height: Math.max(1, Math.round(height / width * longEdge))
9370
+ } : {
9371
+ width: Math.max(1, Math.round(width / height * longEdge)),
9372
+ height: longEdge
9373
+ };
9374
+ if (fitsVisualBudget(candidate)) {
9375
+ best = candidate;
9376
+ low = longEdge + 1;
9377
+ } else {
9378
+ high = longEdge - 1;
9379
+ }
9380
+ }
9381
+ return best;
9382
+ }
9383
+ __name(boundedSize, "boundedSize");
9384
+ async function prepareImage(filePath, signal) {
9385
+ signal.throwIfAborted();
9386
+ let sharp;
9387
+ try {
9388
+ sharp = (await import("sharp")).default;
9389
+ } catch {
9390
+ throw new ImageViewError(
9391
+ "renderer_unavailable",
9392
+ 'Image rendering is unavailable because the "sharp" image module could not be loaded.'
9393
+ );
9394
+ }
9395
+ let stats;
9396
+ try {
9397
+ stats = await fs2.stat(filePath);
9398
+ } catch (error) {
9399
+ if (error.code === "ENOENT") {
9400
+ throw new ImageViewError(
9401
+ "file_not_found",
9402
+ `Image file not found: ${filePath}`
9403
+ );
9404
+ }
9405
+ throw error;
9406
+ }
9407
+ if (stats.isDirectory()) {
9408
+ throw new ImageViewError(
9409
+ "target_is_directory",
9410
+ `Image path is a directory: ${filePath}`
9411
+ );
9412
+ }
9413
+ if (!stats.isFile()) {
9414
+ throw new ImageViewError(
9415
+ "target_not_regular_file",
9416
+ `Image path is not a regular file: ${filePath}`
9417
+ );
9418
+ }
9419
+ if (stats.size > IMAGE_MAX_SOURCE_BYTES) {
9420
+ throw new ImageViewError(
9421
+ "source_too_large",
9422
+ `Image file exceeds the 100 MB source limit: ${filePath}`
9423
+ );
9424
+ }
9425
+ const bytes = await fs2.readFile(filePath, { signal });
9426
+ if (bytes.length > IMAGE_MAX_SOURCE_BYTES) {
9427
+ throw new ImageViewError(
9428
+ "source_too_large",
9429
+ `Image file exceeds the 100 MB source limit: ${filePath}`
9430
+ );
9431
+ }
9432
+ let metadata;
9433
+ try {
9434
+ metadata = await sharp(bytes, {
9435
+ failOn: "error",
9436
+ limitInputPixels: true
9437
+ }).metadata();
9438
+ } catch {
9439
+ signal.throwIfAborted();
9440
+ throw new ImageViewError(
9441
+ "decode_failed",
9442
+ `Failed to decode image (file may be corrupt or not a static PNG, JPEG, or WebP): ${filePath}`
9443
+ );
9444
+ }
9445
+ signal.throwIfAborted();
9446
+ if (!SUPPORTED_IMAGE_FORMATS.has(metadata.format)) {
9447
+ throw new ImageViewError(
9448
+ "unsupported_image",
9449
+ `Unsupported image. Expected a static PNG, JPEG, or WebP file: ${filePath}`
9450
+ );
9451
+ }
9452
+ if ((metadata.pages ?? 1) > 1) {
9453
+ throw new ImageViewError(
9454
+ "animated_image",
9455
+ `Only static images are supported: ${filePath}`
9456
+ );
9457
+ }
9458
+ return { bytes, metadata, sharp };
9459
+ }
9460
+ __name(prepareImage, "prepareImage");
9461
+ async function renderImageView(filePath, prepared, selection, outputSize, signal) {
9462
+ const { bytes, metadata, sharp } = prepared;
9463
+ let output;
9464
+ try {
9465
+ output = await sharp(bytes, {
9466
+ autoOrient: true,
9467
+ failOn: "error",
9468
+ limitInputPixels: true
9469
+ }).extract(selection).resize(outputSize.width, outputSize.height, {
9470
+ fit: "fill",
9471
+ kernel: sharp.kernel.lanczos3
9472
+ }).flatten({ background: "#ffffff" }).jpeg({
9473
+ quality: IMAGE_JPEG_QUALITY,
9474
+ chromaSubsampling: "4:4:4"
9475
+ }).toBuffer();
9476
+ } catch {
9477
+ signal.throwIfAborted();
9478
+ throw new ImageViewError(
9479
+ "decode_failed",
9480
+ `Failed to render image overview: ${filePath}`
9481
+ );
9482
+ }
9483
+ signal.throwIfAborted();
9484
+ if (output.length > IMAGE_MAX_OUTPUT_BYTES) {
9485
+ throw new ImageViewError(
9486
+ "output_too_large",
9487
+ `Rendered image exceeds the 9 MB output limit: ${filePath}`
9488
+ );
9489
+ }
9490
+ return {
9491
+ bytes: output,
9492
+ mimeType: "image/jpeg",
9493
+ sourceWidth: metadata.autoOrient.width,
9494
+ sourceHeight: metadata.autoOrient.height,
9495
+ selectedWidth: selection.width,
9496
+ selectedHeight: selection.height,
9497
+ outputWidth: outputSize.width,
9498
+ outputHeight: outputSize.height
9499
+ };
9500
+ }
9501
+ __name(renderImageView, "renderImageView");
9502
+ async function renderImageOverview(filePath, signal) {
9503
+ const prepared = await prepareImage(filePath, signal);
9504
+ const sourceWidth = prepared.metadata.autoOrient.width;
9505
+ const sourceHeight = prepared.metadata.autoOrient.height;
9506
+ const outputSize = boundedSize(sourceWidth, sourceHeight, 1);
9507
+ return renderImageView(
9508
+ filePath,
9509
+ prepared,
9510
+ { left: 0, top: 0, width: sourceWidth, height: sourceHeight },
9511
+ outputSize,
9512
+ signal
9513
+ );
9514
+ }
9515
+ __name(renderImageOverview, "renderImageOverview");
9516
+ async function renderNormalizedImageCrop(filePath, region, signal) {
9517
+ const prepared = await prepareImage(filePath, signal);
9518
+ const sourceWidth = prepared.metadata.autoOrient.width;
9519
+ const sourceHeight = prepared.metadata.autoOrient.height;
9520
+ const left = Math.min(
9521
+ sourceWidth - 1,
9522
+ Math.max(0, Math.floor(region.x1 / 1e3 * sourceWidth))
9523
+ );
9524
+ const top = Math.min(
9525
+ sourceHeight - 1,
9526
+ Math.max(0, Math.floor(region.y1 / 1e3 * sourceHeight))
9527
+ );
9528
+ const right = Math.min(
9529
+ sourceWidth,
9530
+ Math.max(left + 1, Math.ceil(region.x2 / 1e3 * sourceWidth))
9531
+ );
9532
+ const bottom = Math.min(
9533
+ sourceHeight,
9534
+ Math.max(top + 1, Math.ceil(region.y2 / 1e3 * sourceHeight))
9535
+ );
9536
+ const selectedWidth = right - left;
9537
+ const selectedHeight = bottom - top;
9538
+ const outputSize = boundedSize(
9539
+ selectedWidth,
9540
+ selectedHeight,
9541
+ IMAGE_MAX_UPSCALE
9542
+ );
9543
+ return renderImageView(
9544
+ filePath,
9545
+ prepared,
9546
+ { left, top, width: selectedWidth, height: selectedHeight },
9547
+ outputSize,
9548
+ signal
9549
+ );
9550
+ }
9551
+ __name(renderNormalizedImageCrop, "renderNormalizedImageCrop");
9552
+
9069
9553
  // packages/core/src/utils/fileUtils.ts
9070
9554
  var debugLogger2 = createDebugLogger("FILE_UTILS");
9071
- var DEFAULT_ENCODING = "utf-8";
9555
+ var CANONICAL_IMAGE_MIME_TYPES = /* @__PURE__ */ new Set([
9556
+ "image/jpeg",
9557
+ "image/png",
9558
+ "image/webp"
9559
+ ]);
9072
9560
  var PDF_FULL_TEXT_EXTRACTION_MAX_MB = 100;
9073
9561
  var PDF_PAGED_TEXT_EXTRACTION_MAX_MB = 512;
9074
9562
  function detectBOM(buf) {
@@ -9127,7 +9615,7 @@ function isValidUtf8(buffer) {
9127
9615
  }
9128
9616
  }
9129
9617
  __name(isValidUtf8, "isValidUtf8");
9130
- function decodeBufferWithEncodingInfo(full) {
9618
+ async function decodeBufferWithEncodingInfoAsync(full) {
9131
9619
  if (full.length === 0) {
9132
9620
  return { content: "", encoding: "utf-8", bom: false };
9133
9621
  }
@@ -9147,9 +9635,10 @@ function decodeBufferWithEncodingInfo(full) {
9147
9635
  const detected = detectEncodingFromBuffer(full);
9148
9636
  if (detected && !isUtf8CompatibleEncoding(detected)) {
9149
9637
  try {
9150
- if (iconvEncodingExists(detected)) {
9638
+ const iconvLite = await loadIconvLite();
9639
+ if (iconvLite.encodingExists(detected)) {
9151
9640
  return {
9152
- content: iconvDecode(full, detected),
9641
+ content: iconvLite.decode(full, detected),
9153
9642
  encoding: detected,
9154
9643
  bom: false
9155
9644
  };
@@ -9162,7 +9651,7 @@ function decodeBufferWithEncodingInfo(full) {
9162
9651
  }
9163
9652
  return { content: full.toString("utf8"), encoding: "utf-8", bom: false };
9164
9653
  }
9165
- __name(decodeBufferWithEncodingInfo, "decodeBufferWithEncodingInfo");
9654
+ __name(decodeBufferWithEncodingInfoAsync, "decodeBufferWithEncodingInfoAsync");
9166
9655
  function decodeBOMBuffer(buf, bomInfo) {
9167
9656
  const content = buf.subarray(bomInfo.bomLength);
9168
9657
  switch (bomInfo.encoding) {
@@ -9199,11 +9688,11 @@ function bomEncodingToName(bomEncoding) {
9199
9688
  }
9200
9689
  __name(bomEncodingToName, "bomEncodingToName");
9201
9690
  async function readFileWithEncodingInfo(filePath, signal) {
9202
- const full = await fs2.promises.readFile(
9691
+ const full = await fs3.promises.readFile(
9203
9692
  filePath,
9204
9693
  signal === void 0 ? void 0 : { signal }
9205
9694
  );
9206
- return decodeBufferWithEncodingInfo(full);
9695
+ return await decodeBufferWithEncodingInfoAsync(full);
9207
9696
  }
9208
9697
  __name(readFileWithEncodingInfo, "readFileWithEncodingInfo");
9209
9698
  async function readFileWithEncoding(filePath) {
@@ -9218,7 +9707,7 @@ async function countFileLines(filePath) {
9218
9707
  __name(countFileLines, "countFileLines");
9219
9708
  async function readFileWithLineAndLimit(params) {
9220
9709
  const { path: filePath, limit, line, maxOutputBytes, signal } = params;
9221
- const stats = params.stats ?? await fs2.promises.stat(filePath);
9710
+ const stats = params.stats ?? await fs3.promises.stat(filePath);
9222
9711
  if (line !== void 0 && line > 0 || Number.isFinite(limit) || maxOutputBytes !== void 0) {
9223
9712
  return readTextRange({
9224
9713
  path: filePath,
@@ -9250,10 +9739,10 @@ async function readFileWithLineAndLimit(params) {
9250
9739
  };
9251
9740
  }
9252
9741
  __name(readFileWithLineAndLimit, "readFileWithLineAndLimit");
9253
- async function detectFileEncoding(filePath) {
9254
- let fh = null;
9742
+ async function detectFileEncoding(source) {
9743
+ let opened = null;
9255
9744
  try {
9256
- fh = await fs2.promises.open(filePath, "r");
9745
+ const fh = typeof source === "string" ? opened = await fs3.promises.open(source, "r") : source;
9257
9746
  const stats = await fh.stat();
9258
9747
  if (stats.size === 0) return "utf-8";
9259
9748
  const sampleSize = Math.min(8192, stats.size);
@@ -9262,22 +9751,7 @@ async function detectFileEncoding(filePath) {
9262
9751
  if (bytesRead === 0) return "utf-8";
9263
9752
  const sample = buf.subarray(0, bytesRead);
9264
9753
  const bom = detectBOM(sample);
9265
- if (bom) {
9266
- switch (bom.encoding) {
9267
- case "utf8":
9268
- return "utf-8";
9269
- case "utf16le":
9270
- return "utf-16le";
9271
- case "utf16be":
9272
- return "utf-16be";
9273
- case "utf32le":
9274
- return "utf-32le";
9275
- case "utf32be":
9276
- return "utf-32be";
9277
- default:
9278
- return "utf-8";
9279
- }
9280
- }
9754
+ if (bom) return bomEncodingToName(bom.encoding);
9281
9755
  if (isValidUtf8(sample)) return "utf-8";
9282
9756
  const detected = detectEncodingFromBuffer(sample);
9283
9757
  if (detected && !isUtf8CompatibleEncoding(detected)) {
@@ -9287,9 +9761,9 @@ async function detectFileEncoding(filePath) {
9287
9761
  } catch {
9288
9762
  return "utf-8";
9289
9763
  } finally {
9290
- if (fh) {
9764
+ if (opened) {
9291
9765
  try {
9292
- await fh.close();
9766
+ await opened.close();
9293
9767
  } catch {
9294
9768
  }
9295
9769
  }
@@ -9311,7 +9785,7 @@ __name(isWithinRoot, "isWithinRoot");
9311
9785
  async function isBinaryFile(filePath) {
9312
9786
  let fh = null;
9313
9787
  try {
9314
- fh = await fs2.promises.open(filePath, "r");
9788
+ fh = await fs3.promises.open(filePath, "r");
9315
9789
  const stats = await fh.stat();
9316
9790
  const fileSize = stats.size;
9317
9791
  if (fileSize === 0) return false;
@@ -9604,7 +10078,7 @@ async function processSingleFileContent(filePath, config, optionsOrOffset, legac
9604
10078
  signal?.throwIfAborted();
9605
10079
  let stats;
9606
10080
  try {
9607
- stats = await fs2.promises.stat(filePath);
10081
+ stats = await fs3.promises.stat(filePath);
9608
10082
  } catch (error) {
9609
10083
  if (isNodeError(error) && error.code === "ENOENT") {
9610
10084
  return {
@@ -9633,6 +10107,8 @@ async function processSingleFileContent(filePath, config, optionsOrOffset, legac
9633
10107
  };
9634
10108
  }
9635
10109
  const fileType = await detectFileType(filePath);
10110
+ const mediaMimeType = index_lite_default.getType(filePath) ?? MIME_LITE_MISSING_VIDEO_TYPES.get(path2.extname(filePath).toLowerCase()) ?? "application/octet-stream";
10111
+ const shouldRenderImageOverview = fileType === "image" && CANONICAL_IMAGE_MIME_TYPES.has(mediaMimeType);
9636
10112
  const relativePathForDisplay = path2.relative(rootDirectory, filePath).replace(/\\/g, "/");
9637
10113
  const displayName = path2.basename(filePath);
9638
10114
  const modalities = config.getContentGeneratorConfig?.()?.modalities ?? {};
@@ -9717,7 +10193,15 @@ async function processSingleFileContent(filePath, config, optionsOrOffset, legac
9717
10193
  };
9718
10194
  }
9719
10195
  }
9720
- if (fileSizeInMB > 9.9 && !willExtractPdfText && fileType !== "text") {
10196
+ if (shouldRenderImageOverview && stats.size > IMAGE_MAX_SOURCE_BYTES) {
10197
+ return {
10198
+ llmContent: "Image file exceeds the 100 MB source limit.",
10199
+ returnDisplay: "Image file exceeds the 100 MB source limit.",
10200
+ error: `Image file exceeds the 100 MB source limit: ${filePath}`,
10201
+ errorType: "file_too_large" /* FILE_TOO_LARGE */
10202
+ };
10203
+ }
10204
+ if (fileSizeInMB > 9.9 && !willExtractPdfText && fileType !== "text" && !shouldRenderImageOverview) {
9721
10205
  return {
9722
10206
  llmContent: "File size exceeds the 10MB limit.",
9723
10207
  returnDisplay: "File size exceeds the 10MB limit.",
@@ -9849,10 +10333,70 @@ async function processSingleFileContent(filePath, config, optionsOrOffset, legac
9849
10333
  stats
9850
10334
  };
9851
10335
  }
9852
- case "image":
10336
+ case "image": {
10337
+ if (shouldRenderImageOverview) {
10338
+ try {
10339
+ const view = await renderImageOverview(
10340
+ filePath,
10341
+ signal ?? new AbortController().signal
10342
+ );
10343
+ return {
10344
+ llmContent: [
10345
+ {
10346
+ text: `Image overview: ${view.outputWidth}x${view.outputHeight}; oriented source: ${view.sourceWidth}x${view.sourceHeight}. If details are too small, use tool_search for "zoom image", then call zoom_image with coordinates normalized from 0 to 1000.`
10347
+ },
10348
+ {
10349
+ inlineData: {
10350
+ data: view.bytes.toString("base64"),
10351
+ mimeType: view.mimeType,
10352
+ displayName
10353
+ }
10354
+ }
10355
+ ],
10356
+ returnDisplay: `Read image file: ${relativePathForDisplay}`
10357
+ };
10358
+ } catch (error) {
10359
+ signal?.throwIfAborted();
10360
+ if (error instanceof ImageViewError) {
10361
+ if (error.code === "source_too_large" || error.code === "output_too_large") {
10362
+ const userMessage = error.message.replace(`: ${filePath}`, "");
10363
+ return {
10364
+ llmContent: userMessage,
10365
+ returnDisplay: userMessage,
10366
+ error: error.message,
10367
+ errorType: "file_too_large" /* FILE_TOO_LARGE */
10368
+ };
10369
+ }
10370
+ } else {
10371
+ throw error;
10372
+ }
10373
+ }
10374
+ }
10375
+ const contentBuffer = await fs3.promises.readFile(filePath);
10376
+ const base64Data = contentBuffer.toString("base64");
10377
+ const base64SizeInMB = base64Data.length / (1024 * 1024);
10378
+ if (base64SizeInMB > 9.9) {
10379
+ return {
10380
+ llmContent: `File exceeds the 10MB data URI limit after base64 encoding (${base64SizeInMB.toFixed(2)}MB encoded).`,
10381
+ returnDisplay: `File exceeds the 10MB data URI limit after base64 encoding.`,
10382
+ error: `File exceeds the 10MB data URI limit after base64 encoding: ${filePath} (${base64SizeInMB.toFixed(2)}MB encoded)`,
10383
+ errorType: "file_too_large" /* FILE_TOO_LARGE */
10384
+ };
10385
+ }
10386
+ return {
10387
+ llmContent: {
10388
+ inlineData: {
10389
+ data: base64Data,
10390
+ mimeType: mediaMimeType,
10391
+ displayName
10392
+ }
10393
+ },
10394
+ returnDisplay: `Read image file: ${relativePathForDisplay}`
10395
+ };
10396
+ }
9853
10397
  case "audio":
9854
10398
  case "video": {
9855
- const contentBuffer = await fs2.promises.readFile(filePath);
10399
+ const contentBuffer = await fs3.promises.readFile(filePath);
9856
10400
  const base64Data = contentBuffer.toString("base64");
9857
10401
  const base64SizeInMB = base64Data.length / (1024 * 1024);
9858
10402
  if (base64SizeInMB > 9.9) {
@@ -9867,9 +10411,7 @@ async function processSingleFileContent(filePath, config, optionsOrOffset, legac
9867
10411
  llmContent: {
9868
10412
  inlineData: {
9869
10413
  data: base64Data,
9870
- mimeType: index_lite_default.getType(filePath) ?? MIME_LITE_MISSING_VIDEO_TYPES.get(
9871
- path2.extname(filePath).toLowerCase()
9872
- ) ?? "application/octet-stream",
10414
+ mimeType: mediaMimeType,
9873
10415
  displayName
9874
10416
  }
9875
10417
  },
@@ -9878,7 +10420,7 @@ async function processSingleFileContent(filePath, config, optionsOrOffset, legac
9878
10420
  }
9879
10421
  case "pdf": {
9880
10422
  if (!pageRange && modalities.pdf) {
9881
- const contentBuffer = await fs2.promises.readFile(filePath);
10423
+ const contentBuffer = await fs3.promises.readFile(filePath);
9882
10424
  const base64Data = contentBuffer.toString("base64");
9883
10425
  const base64SizeInMB = base64Data.length / (1024 * 1024);
9884
10426
  if (base64SizeInMB > 9.9) {
@@ -10145,7 +10687,7 @@ function normalizeRangeReadByteLimit(maxOutputBytes) {
10145
10687
  __name(normalizeRangeReadByteLimit, "normalizeRangeReadByteLimit");
10146
10688
  async function fileExists(filePath) {
10147
10689
  try {
10148
- await fsPromises.access(filePath, fs2.constants.F_OK);
10690
+ await fsPromises.access(filePath, fs3.constants.F_OK);
10149
10691
  return true;
10150
10692
  } catch (_) {
10151
10693
  return false;
@@ -10290,7 +10832,7 @@ var import_https_proxy_agent = __toESM(require_dist(), 1);
10290
10832
  import { Buffer as Buffer2 } from "buffer";
10291
10833
  import * as https from "https";
10292
10834
  import * as os2 from "node:os";
10293
- import fs3 from "node:fs";
10835
+ import fs4 from "node:fs";
10294
10836
  import path4 from "node:path";
10295
10837
 
10296
10838
  // packages/core/src/telemetry/sanitize.ts
@@ -10495,8 +11037,8 @@ var QwenLogger = class _QwenLogger {
10495
11037
  const legacyPath = path4.join(os2.homedir(), ".qwen", "source.json");
10496
11038
  const candidates = path4.normalize(sourceJsonPath) !== path4.normalize(legacyPath) ? [sourceJsonPath, legacyPath] : [sourceJsonPath];
10497
11039
  for (const candidate of candidates) {
10498
- if (fs3.existsSync(candidate)) {
10499
- const sourceJsonContent = fs3.readFileSync(candidate, "utf8");
11040
+ if (fs4.existsSync(candidate)) {
11041
+ const sourceJsonContent = fs4.readFileSync(candidate, "utf8");
10500
11042
  const sourceData = JSON.parse(sourceJsonContent);
10501
11043
  if (sourceData && typeof sourceData === "object" && sourceData.source && sourceData.source !== "unknown") {
10502
11044
  return sourceData.source;
@@ -10969,6 +11511,24 @@ var QwenLogger = class _QwenLogger {
10969
11511
  this.enqueueLogEvent(rumEvent);
10970
11512
  this.flushIfNeeded();
10971
11513
  }
11514
+ logRipgrepRuntimeRecoveryEvent(event) {
11515
+ const rumEvent = this.createActionEvent(
11516
+ "misc",
11517
+ "ripgrep_runtime_recovery",
11518
+ {
11519
+ properties: {
11520
+ platform: process.platform,
11521
+ arch: process.arch,
11522
+ selection_mode: event.selection_mode,
11523
+ retry_triggered: event.retry_triggered,
11524
+ ...event.retry_succeeded !== void 0 ? { retry_succeeded: event.retry_succeeded } : {},
11525
+ failure_kind: event.failure_kind
11526
+ }
11527
+ }
11528
+ );
11529
+ this.enqueueLogEvent(rumEvent);
11530
+ this.flushIfNeeded();
11531
+ }
10972
11532
  logLoopDetectionDisabledEvent() {
10973
11533
  const rumEvent = this.createActionEvent(
10974
11534
  "misc",
@@ -11232,6 +11792,12 @@ var createInitialSkillMetrics = /* @__PURE__ */ __name(() => ({
11232
11792
  totalFail: 0,
11233
11793
  byName: {}
11234
11794
  }), "createInitialSkillMetrics");
11795
+ var createInitialGenerationMetrics = /* @__PURE__ */ __name(() => ({
11796
+ timedRequests: 0,
11797
+ totalTtftMs: 0,
11798
+ totalGenerationDurationMs: 0,
11799
+ totalThroughputOutputTokens: 0
11800
+ }), "createInitialGenerationMetrics");
11235
11801
  var createInitialMetrics = /* @__PURE__ */ __name(() => ({
11236
11802
  models: {},
11237
11803
  tools: {
@@ -11376,6 +11942,23 @@ var UiTelemetryService = class _UiTelemetryService extends EventEmitter {
11376
11942
  bucket.tokens.cached += event.cached_content_token_count;
11377
11943
  bucket.tokens.thoughts += event.thoughts_token_count;
11378
11944
  }
11945
+ if (event.ttft_ms === void 0 || !Number.isFinite(event.ttft_ms) || event.ttft_ms < 0 || isInternalPromptId(event.prompt_id)) {
11946
+ return;
11947
+ }
11948
+ const generation = metrics.generation ?? (metrics.generation = createInitialGenerationMetrics());
11949
+ const generationDurationMs = Math.max(0, event.duration_ms - event.ttft_ms);
11950
+ generation.timedRequests++;
11951
+ generation.totalTtftMs += event.ttft_ms;
11952
+ if (generationDurationMs > 0) {
11953
+ generation.totalGenerationDurationMs += generationDurationMs;
11954
+ generation.totalThroughputOutputTokens += event.output_token_count;
11955
+ }
11956
+ generation.last = {
11957
+ model: event.model,
11958
+ ttftMs: event.ttft_ms,
11959
+ generationDurationMs,
11960
+ outputTokens: event.output_token_count
11961
+ };
11379
11962
  }
11380
11963
  #accumulateApiError(metrics, event) {
11381
11964
  const modelMetrics = this.#getOrCreateModelMetrics(metrics, event.model);
@@ -11525,7 +12108,7 @@ import { randomUUID } from "node:crypto";
11525
12108
 
11526
12109
  // packages/core/src/utils/jsonl-utils.ts
11527
12110
  init_esbuild_shims();
11528
- import fs4 from "node:fs";
12111
+ import fs5 from "node:fs";
11529
12112
  import path5 from "node:path";
11530
12113
  import readline from "node:readline";
11531
12114
  import { finished } from "node:stream/promises";
@@ -11617,7 +12200,7 @@ async function readLines(filePath, count) {
11617
12200
  let fileStream;
11618
12201
  let rl;
11619
12202
  try {
11620
- fileStream = fs4.createReadStream(filePath);
12203
+ fileStream = fs5.createReadStream(filePath);
11621
12204
  rl = readline.createInterface({
11622
12205
  input: fileStream,
11623
12206
  crlfDelay: Infinity
@@ -11650,7 +12233,7 @@ async function read(filePath, options = {}) {
11650
12233
  let fileStream;
11651
12234
  let rl;
11652
12235
  try {
11653
- fileStream = fs4.createReadStream(filePath);
12236
+ fileStream = fs5.createReadStream(filePath);
11654
12237
  rl = readline.createInterface({
11655
12238
  input: fileStream,
11656
12239
  crlfDelay: Infinity
@@ -11678,10 +12261,6 @@ async function read(filePath, options = {}) {
11678
12261
  }
11679
12262
  __name(read, "read");
11680
12263
  var ensuredDirs = /* @__PURE__ */ new Set();
11681
- function _resetEnsuredDirsCacheForTest() {
11682
- ensuredDirs.clear();
11683
- }
11684
- __name(_resetEnsuredDirsCacheForTest, "_resetEnsuredDirsCacheForTest");
11685
12264
  async function writeLine(filePath, data) {
11686
12265
  const lock = getFileLock(filePath);
11687
12266
  await lock.runExclusive(async () => {
@@ -11689,10 +12268,10 @@ async function writeLine(filePath, data) {
11689
12268
  `;
11690
12269
  const dir = path5.dirname(filePath);
11691
12270
  if (!ensuredDirs.has(dir)) {
11692
- await fs4.promises.mkdir(dir, { recursive: true });
12271
+ await fs5.promises.mkdir(dir, { recursive: true });
11693
12272
  ensuredDirs.add(dir);
11694
12273
  }
11695
- await fs4.promises.appendFile(filePath, Buffer.from(line, "utf8"), {
12274
+ await fs5.promises.appendFile(filePath, Buffer.from(line, "utf8"), {
11696
12275
  flush: true
11697
12276
  });
11698
12277
  });
@@ -11702,51 +12281,15 @@ function writeLineSync(filePath, data) {
11702
12281
  const line = `${JSON.stringify(data)}
11703
12282
  `;
11704
12283
  const dir = path5.dirname(filePath);
11705
- if (!fs4.existsSync(dir)) {
11706
- fs4.mkdirSync(dir, { recursive: true });
12284
+ if (!fs5.existsSync(dir)) {
12285
+ fs5.mkdirSync(dir, { recursive: true });
11707
12286
  }
11708
- fs4.appendFileSync(filePath, Buffer.from(line, "utf8"), { flush: true });
12287
+ fs5.appendFileSync(filePath, Buffer.from(line, "utf8"), { flush: true });
11709
12288
  }
11710
12289
  __name(writeLineSync, "writeLineSync");
11711
- function write(filePath, data) {
11712
- const lines = data.map((item) => `${JSON.stringify(item)}
11713
- `).join("");
11714
- const dir = path5.dirname(filePath);
11715
- if (!fs4.existsSync(dir)) {
11716
- fs4.mkdirSync(dir, { recursive: true });
11717
- }
11718
- atomicWriteFileSync(filePath, lines, { encoding: "utf8" });
11719
- }
11720
- __name(write, "write");
11721
- async function countLines(filePath) {
11722
- let fileStream;
11723
- let rl;
11724
- try {
11725
- fileStream = fs4.createReadStream(filePath);
11726
- rl = readline.createInterface({
11727
- input: fileStream,
11728
- crlfDelay: Infinity
11729
- });
11730
- let count = 0;
11731
- for await (const line of rl) {
11732
- if (line.trim().length > 0) {
11733
- count++;
11734
- }
11735
- }
11736
- return count;
11737
- } catch (error) {
11738
- if (error.code !== "ENOENT") {
11739
- debugLogger3.error(`Error counting lines in ${filePath}:`, error);
11740
- }
11741
- return 0;
11742
- } finally {
11743
- await closeLineReader(rl, fileStream);
11744
- }
11745
- }
11746
- __name(countLines, "countLines");
11747
12290
  function exists(filePath) {
11748
12291
  try {
11749
- const stats = fs4.statSync(filePath);
12292
+ const stats = fs5.statSync(filePath);
11750
12293
  return stats.isFile() && stats.size > 0;
11751
12294
  } catch {
11752
12295
  return false;
@@ -11997,11 +12540,6 @@ function summarizeRecords(period, value, records) {
11997
12540
  };
11998
12541
  }
11999
12542
  __name(summarizeRecords, "summarizeRecords");
12000
- async function recordTokenUsageFromApiResponse(config, event) {
12001
- const record = apiResponseEventToTokenUsageRecord(config, event);
12002
- await writeLine(getTokenUsageFilePath(record.localMonth), record);
12003
- }
12004
- __name(recordTokenUsageFromApiResponse, "recordTokenUsageFromApiResponse");
12005
12543
  var lastLoggedTimeByCode = /* @__PURE__ */ new Map();
12006
12544
  var suppressedCountByCode = /* @__PURE__ */ new Map();
12007
12545
  var TOKEN_USAGE_FAILURE_LOG_COOLDOWN_MS = 6e4;
@@ -12137,12 +12675,6 @@ function formatTokenUsageSummaryAsJson(summary) {
12137
12675
  `;
12138
12676
  }
12139
12677
  __name(formatTokenUsageSummaryAsJson, "formatTokenUsageSummaryAsJson");
12140
- async function exportTokenUsageSummary(options) {
12141
- const summary = await queryTokenUsage(options);
12142
- return options.format === "json" ? formatTokenUsageSummaryAsJson(summary) : `${formatTokenUsageSummaryAsCsv(summary)}
12143
- `;
12144
- }
12145
- __name(exportTokenUsageSummary, "exportTokenUsageSummary");
12146
12678
 
12147
12679
  // packages/core/src/utils/chat-recording-suppression-context.ts
12148
12680
  init_esbuild_shims();
@@ -12359,40 +12891,40 @@ function logApiRequest(config, event) {
12359
12891
  logger.emit(logRecord);
12360
12892
  }
12361
12893
  __name(logApiRequest, "logApiRequest");
12362
- function logFlashFallback(config, event) {
12363
- QwenLogger.getInstance(config)?.logFlashFallbackEvent(event);
12894
+ function logRipgrepFallback(config, event) {
12895
+ QwenLogger.getInstance(config)?.logRipgrepFallbackEvent(event);
12364
12896
  if (!isTelemetrySdkInitialized()) return;
12365
12897
  const attributes = {
12366
12898
  ...getCommonAttributes(config),
12367
12899
  ...event,
12368
- "event.name": EVENT_FLASH_FALLBACK,
12900
+ "event.name": EVENT_RIPGREP_FALLBACK,
12369
12901
  "event.timestamp": (/* @__PURE__ */ new Date()).toISOString()
12370
12902
  };
12371
12903
  const logger = import_api_logs.logs.getLogger(SERVICE_NAME);
12372
12904
  const logRecord = {
12373
- body: `Switching to flash as Fallback.`,
12905
+ body: `Switching to grep as fallback.`,
12374
12906
  attributes
12375
12907
  };
12376
12908
  logger.emit(logRecord);
12377
12909
  }
12378
- __name(logFlashFallback, "logFlashFallback");
12379
- function logRipgrepFallback(config, event) {
12380
- QwenLogger.getInstance(config)?.logRipgrepFallbackEvent(event);
12910
+ __name(logRipgrepFallback, "logRipgrepFallback");
12911
+ function logRipgrepRuntimeRecovery(config, event) {
12912
+ QwenLogger.getInstance(config)?.logRipgrepRuntimeRecoveryEvent(event);
12381
12913
  if (!isTelemetrySdkInitialized()) return;
12382
12914
  const attributes = {
12383
12915
  ...getCommonAttributes(config),
12384
12916
  ...event,
12385
- "event.name": EVENT_RIPGREP_FALLBACK,
12917
+ "event.name": EVENT_RIPGREP_RUNTIME_RECOVERY,
12386
12918
  "event.timestamp": (/* @__PURE__ */ new Date()).toISOString()
12387
12919
  };
12388
12920
  const logger = import_api_logs.logs.getLogger(SERVICE_NAME);
12389
12921
  const logRecord = {
12390
- body: `Switching to grep as fallback.`,
12922
+ body: `Ripgrep runtime recovery: ${event.failure_kind}.`,
12391
12923
  attributes
12392
12924
  };
12393
12925
  logger.emit(logRecord);
12394
12926
  }
12395
- __name(logRipgrepFallback, "logRipgrepFallback");
12927
+ __name(logRipgrepRuntimeRecovery, "logRipgrepRuntimeRecovery");
12396
12928
  function logApiError(config, event) {
12397
12929
  const uiEvent = {
12398
12930
  ...event,
@@ -13185,7 +13717,7 @@ init_esbuild_shims();
13185
13717
 
13186
13718
  // packages/core/src/utils/truncation.ts
13187
13719
  init_esbuild_shims();
13188
- import * as fs5 from "node:fs/promises";
13720
+ import * as fs6 from "node:fs/promises";
13189
13721
  import * as path7 from "node:path";
13190
13722
  import * as crypto from "node:crypto";
13191
13723
  var debugLogger5 = createDebugLogger("TRUNCATION");
@@ -13217,22 +13749,26 @@ async function truncateAndSaveToFile(content, fileName, projectTempDir, threshol
13217
13749
  const separator = "\n\n---\n... [CONTENT TRUNCATED] ...\n---\n\n";
13218
13750
  const ellipsis = "...";
13219
13751
  const previewBudget = Math.max(0, previewChars);
13220
- const headBudget = keep === "head" ? previewBudget : keep === "tail" ? 0 : Math.floor(previewBudget / 5);
13752
+ const sep = previewBudget > separator.length ? separator : "";
13753
+ const contentBudget = previewBudget - sep.length;
13754
+ const headBudget = keep === "head" ? contentBudget : keep === "tail" ? 0 : Math.floor(contentBudget / 5);
13221
13755
  const beginning = [];
13222
13756
  let headChars = 0;
13223
13757
  for (let i = 0; i < Math.min(headCount, lines.length); i++) {
13224
13758
  const remaining = headBudget - headChars;
13225
13759
  if (remaining <= 0) break;
13226
13760
  if (lines[i].length + 1 > remaining) {
13227
- const sliceLen = Math.max(remaining - ellipsis.length, 0);
13228
- beginning.push(lines[i].slice(0, sliceLen) + ellipsis);
13761
+ if (remaining >= ellipsis.length) {
13762
+ const sliceLen = remaining - ellipsis.length;
13763
+ beginning.push(lines[i].slice(0, sliceLen) + ellipsis);
13764
+ }
13229
13765
  headChars = headBudget;
13230
13766
  break;
13231
13767
  }
13232
13768
  beginning.push(lines[i]);
13233
13769
  headChars += lines[i].length + 1;
13234
13770
  }
13235
- const tailBudget = keep === "head" ? 0 : Math.max(previewBudget - headChars - separator.length, 0);
13771
+ const tailBudget = keep === "head" ? 0 : Math.max(contentBudget - headChars, 0);
13236
13772
  const end = [];
13237
13773
  let tailChars = 0;
13238
13774
  const tailStart = Math.max(lines.length - tailCount, beginning.length);
@@ -13240,15 +13776,17 @@ async function truncateAndSaveToFile(content, fileName, projectTempDir, threshol
13240
13776
  const remaining = tailBudget - tailChars;
13241
13777
  if (remaining <= 0) break;
13242
13778
  if (lines[i].length + 1 > remaining) {
13243
- const sliceLen = Math.max(remaining - ellipsis.length, 0);
13244
- end.unshift(ellipsis + (sliceLen > 0 ? lines[i].slice(-sliceLen) : ""));
13779
+ if (remaining >= ellipsis.length) {
13780
+ const sliceLen = remaining - ellipsis.length;
13781
+ end.unshift(ellipsis + (sliceLen > 0 ? lines[i].slice(-sliceLen) : ""));
13782
+ }
13245
13783
  tailChars = tailBudget;
13246
13784
  break;
13247
13785
  }
13248
13786
  end.unshift(lines[i]);
13249
13787
  tailChars += lines[i].length + 1;
13250
13788
  }
13251
- const truncatedContent = keep === "head" ? beginning.join("\n") + separator : keep === "tail" ? separator + end.join("\n") : beginning.join("\n") + separator + end.join("\n");
13789
+ const truncatedContent = keep === "head" ? beginning.join("\n") + sep : keep === "tail" ? sep + end.join("\n") : beginning.join("\n") + sep + end.join("\n");
13252
13790
  const safeFileName = `${path7.basename(fileName)}.output`;
13253
13791
  const outputFile = path7.join(projectTempDir, safeFileName);
13254
13792
  const wrappedMessage = `${TOOL_OUTPUT_TRUNCATED_PREFIX}.
@@ -13262,8 +13800,8 @@ ${truncatedContent}`;
13262
13800
  return { content };
13263
13801
  }
13264
13802
  try {
13265
- await fs5.mkdir(projectTempDir, { recursive: true });
13266
- await fs5.writeFile(outputFile, content, { mode: 384 });
13803
+ await fs6.mkdir(projectTempDir, { recursive: true });
13804
+ await fs6.writeFile(outputFile, content, { mode: 384 });
13267
13805
  return {
13268
13806
  content: wrappedMessage,
13269
13807
  outputFile
@@ -13413,7 +13951,7 @@ async function persistAndTruncateToolResult(callId, toolName, content, config) {
13413
13951
  try {
13414
13952
  const toolResultsDir = config.storage.getToolResultsDir();
13415
13953
  const outputFile = path7.join(toolResultsDir, `${safeCallId}.txt`);
13416
- await fs5.mkdir(toolResultsDir, { recursive: true });
13954
+ await fs6.mkdir(toolResultsDir, { recursive: true });
13417
13955
  await atomicWriteFile(outputFile, content, {
13418
13956
  mode: 384,
13419
13957
  forceMode: true,
@@ -13478,12 +14016,6 @@ __name(buildStub, "buildStub");
13478
14016
 
13479
14017
  // packages/core/src/tools/mcp-status.ts
13480
14018
  init_esbuild_shims();
13481
- var MCPServerStatus = /* @__PURE__ */ ((MCPServerStatus2) => {
13482
- MCPServerStatus2["DISCONNECTED"] = "disconnected";
13483
- MCPServerStatus2["CONNECTING"] = "connecting";
13484
- MCPServerStatus2["CONNECTED"] = "connected";
13485
- return MCPServerStatus2;
13486
- })(MCPServerStatus || {});
13487
14019
  var serverStatuses = /* @__PURE__ */ new Map();
13488
14020
  var statusChangeListeners = [];
13489
14021
  function addMCPStatusChangeListener(listener) {
@@ -13575,6 +14107,75 @@ function getInvocationContext() {
13575
14107
  }
13576
14108
  __name(getInvocationContext, "getInvocationContext");
13577
14109
 
14110
+ // packages/core/src/services/visionBridge/image-part-utils.ts
14111
+ init_esbuild_shims();
14112
+ function normalizeParts(input) {
14113
+ if (typeof input === "string") {
14114
+ return [{ text: input }];
14115
+ }
14116
+ if (Array.isArray(input)) {
14117
+ return input.map(
14118
+ (part) => typeof part === "string" ? { text: part } : part
14119
+ );
14120
+ }
14121
+ return [input];
14122
+ }
14123
+ __name(normalizeParts, "normalizeParts");
14124
+ function isImagePart(part) {
14125
+ const mimeType = part.inlineData?.mimeType;
14126
+ const data = part.inlineData?.data;
14127
+ return typeof mimeType === "string" && mimeType.startsWith("image/") && typeof data === "string" && data.length > 0;
14128
+ }
14129
+ __name(isImagePart, "isImagePart");
14130
+ function hasImageParts(input) {
14131
+ return normalizeParts(input).some(isImagePart);
14132
+ }
14133
+ __name(hasImageParts, "hasImageParts");
14134
+ function splitImageParts(input) {
14135
+ const imageParts = [];
14136
+ const nonImageParts = [];
14137
+ for (const part of normalizeParts(input)) {
14138
+ if (isImagePart(part)) {
14139
+ imageParts.push(part);
14140
+ } else {
14141
+ nonImageParts.push(part);
14142
+ }
14143
+ }
14144
+ return { imageParts, nonImageParts };
14145
+ }
14146
+ __name(splitImageParts, "splitImageParts");
14147
+ function replaceImagesWithText(input, text) {
14148
+ const result = [];
14149
+ let replaced = false;
14150
+ for (const part of normalizeParts(input)) {
14151
+ if (isImagePart(part)) {
14152
+ if (!replaced) {
14153
+ result.push({ text });
14154
+ replaced = true;
14155
+ }
14156
+ continue;
14157
+ }
14158
+ result.push(part);
14159
+ }
14160
+ if (!replaced) {
14161
+ result.push({ text });
14162
+ }
14163
+ return result;
14164
+ }
14165
+ __name(replaceImagesWithText, "replaceImagesWithText");
14166
+ function isUsableImagePart(part) {
14167
+ const data = part.inlineData?.data;
14168
+ if (typeof data !== "string" || data.length === 0) {
14169
+ return false;
14170
+ }
14171
+ return data.length <= VISION_BRIDGE_MAX_IMAGE_BASE64_BYTES;
14172
+ }
14173
+ __name(isUsableImagePart, "isUsableImagePart");
14174
+ function collectText(parts) {
14175
+ return parts.map((part) => typeof part.text === "string" ? part.text : "").filter((text) => text.length > 0).join("\n").trim();
14176
+ }
14177
+ __name(collectText, "collectText");
14178
+
13578
14179
  // packages/core/src/tools/mcp-tool.ts
13579
14180
  var debugLogger6 = createDebugLogger("MCP_TOOL");
13580
14181
  var MCP_CONNECTION_ERROR_PATTERNS = [
@@ -13796,18 +14397,10 @@ var DiscoveredMCPToolInvocation = class _DiscoveredMCPToolInvocation extends Bas
13796
14397
  callToolResult
13797
14398
  );
13798
14399
  if (this.isMCPToolError(rawResponseParts)) {
13799
- const errorMessage = `MCP tool '${this.serverToolName}' reported tool error for function call: ${safeJsonStringify({
14400
+ return await this.buildMcpToolError(rawResponseParts, {
13800
14401
  name: this.serverToolName,
13801
14402
  args: this.params
13802
- })} with response: ${safeJsonStringify(rawResponseParts)}`;
13803
- return {
13804
- llmContent: errorMessage,
13805
- returnDisplay: `Error: MCP tool '${this.serverToolName}' reported an error.`,
13806
- error: {
13807
- message: errorMessage,
13808
- type: "mcp_tool_error" /* MCP_TOOL_ERROR */
13809
- }
13810
- };
14403
+ });
13811
14404
  }
13812
14405
  const transformedParts = transformMcpContentToParts(rawResponseParts);
13813
14406
  const truncated = await this.truncateTextParts(transformedParts);
@@ -13865,17 +14458,7 @@ var DiscoveredMCPToolInvocation = class _DiscoveredMCPToolInvocation extends Bas
13865
14458
  });
13866
14459
  });
13867
14460
  if (this.isMCPToolError(rawResponseParts)) {
13868
- const errorMessage = `MCP tool '${this.serverToolName}' reported tool error for function call: ${safeJsonStringify(
13869
- functionCalls[0]
13870
- )} with response: ${safeJsonStringify(rawResponseParts)}`;
13871
- return {
13872
- llmContent: errorMessage,
13873
- returnDisplay: `Error: MCP tool '${this.serverToolName}' reported an error.`,
13874
- error: {
13875
- message: errorMessage,
13876
- type: "mcp_tool_error" /* MCP_TOOL_ERROR */
13877
- }
13878
- };
14461
+ return await this.buildMcpToolError(rawResponseParts, functionCalls[0]);
13879
14462
  }
13880
14463
  const transformedParts = transformMcpContentToParts(rawResponseParts);
13881
14464
  const truncated = await this.truncateTextParts(transformedParts);
@@ -13891,6 +14474,34 @@ var DiscoveredMCPToolInvocation = class _DiscoveredMCPToolInvocation extends Bas
13891
14474
  return this.handleReconnectOnError(error, signal);
13892
14475
  }
13893
14476
  }
14477
+ async buildMcpToolError(rawResponseParts, functionCall) {
14478
+ const imageContent = getMcpErrorImageContent(rawResponseParts);
14479
+ let llmContent;
14480
+ let errorMessage;
14481
+ let persistedOutputFiles;
14482
+ if (imageContent) {
14483
+ const truncatedContent = await this.truncateTextParts(imageContent);
14484
+ llmContent = truncatedContent.parts;
14485
+ persistedOutputFiles = truncatedContent.persistedOutputFiles;
14486
+ errorMessage = `MCP tool '${this.serverToolName}' reported tool error for function call: ${safeJsonStringify(
14487
+ functionCall
14488
+ )} with response: ${getDisplayFromParts(truncatedContent.parts)}`;
14489
+ } else {
14490
+ errorMessage = `MCP tool '${this.serverToolName}' reported tool error for function call: ${safeJsonStringify(
14491
+ functionCall
14492
+ )} with response: ${safeJsonStringify(rawResponseParts)}`;
14493
+ llmContent = errorMessage;
14494
+ }
14495
+ return {
14496
+ llmContent,
14497
+ returnDisplay: `Error: MCP tool '${this.serverToolName}' reported an error.`,
14498
+ error: {
14499
+ message: errorMessage,
14500
+ type: "mcp_tool_error" /* MCP_TOOL_ERROR */
14501
+ },
14502
+ ...persistedOutputFiles !== void 0 ? { persistedOutputFiles } : {}
14503
+ };
14504
+ }
13894
14505
  /**
13895
14506
  * Truncates text parts in the transformed result if they exceed the
13896
14507
  * configured threshold. Non-text parts (images, audio, etc.) are preserved.
@@ -14145,6 +14756,11 @@ function transformMcpContentToParts(sdkResponse) {
14145
14756
  return transformed.filter((part) => part !== null);
14146
14757
  }
14147
14758
  __name(transformMcpContentToParts, "transformMcpContentToParts");
14759
+ function getMcpErrorImageContent(rawResponseParts) {
14760
+ const transformedParts = transformMcpContentToParts(rawResponseParts);
14761
+ return transformedParts.some(isImagePart) ? transformedParts : void 0;
14762
+ }
14763
+ __name(getMcpErrorImageContent, "getMcpErrorImageContent");
14148
14764
  function getDisplayFromParts(parts) {
14149
14765
  if (parts.length === 0) {
14150
14766
  return "";
@@ -14245,19 +14861,6 @@ var StartSessionEvent = class {
14245
14861
  }
14246
14862
  }
14247
14863
  };
14248
- var EndSessionEvent = class {
14249
- static {
14250
- __name(this, "EndSessionEvent");
14251
- }
14252
- "event.name";
14253
- "event.timestamp";
14254
- session_id;
14255
- constructor(config) {
14256
- this["event.name"] = "end_session";
14257
- this["event.timestamp"] = (/* @__PURE__ */ new Date()).toISOString();
14258
- this.session_id = config?.getSessionId();
14259
- }
14260
- };
14261
14864
  var UserPromptEvent = class {
14262
14865
  static {
14263
14866
  __name(this, "UserPromptEvent");
@@ -14454,12 +15057,14 @@ var ApiResponseEvent = class {
14454
15057
  response_text;
14455
15058
  prompt_id;
14456
15059
  auth_type;
15060
+ /** Time from stream dispatch to first user-visible content. */
15061
+ ttft_ms;
14457
15062
  /**
14458
15063
  * Name of the subagent that issued this request, or undefined when the
14459
15064
  * request originates from the main conversation.
14460
15065
  */
14461
15066
  subagent_name;
14462
- constructor(response_id, model, duration_ms, prompt_id, auth_type, usage_data, response_text, subagent_name) {
15067
+ constructor(response_id, model, duration_ms, prompt_id, auth_type, usage_data, response_text, subagent_name, ttft_ms) {
14463
15068
  this["event.name"] = "api_response";
14464
15069
  this["event.timestamp"] = (/* @__PURE__ */ new Date()).toISOString();
14465
15070
  this.response_id = response_id;
@@ -14475,19 +15080,7 @@ var ApiResponseEvent = class {
14475
15080
  this.prompt_id = prompt_id;
14476
15081
  this.auth_type = auth_type;
14477
15082
  this.subagent_name = subagent_name;
14478
- }
14479
- };
14480
- var FlashFallbackEvent = class {
14481
- static {
14482
- __name(this, "FlashFallbackEvent");
14483
- }
14484
- "event.name";
14485
- "event.timestamp";
14486
- auth_type;
14487
- constructor(auth_type) {
14488
- this["event.name"] = "flash_fallback";
14489
- this["event.timestamp"] = (/* @__PURE__ */ new Date()).toISOString();
14490
- this.auth_type = auth_type;
15083
+ this.ttft_ms = ttft_ms;
14491
15084
  }
14492
15085
  };
14493
15086
  var RipgrepFallbackEvent = class {
@@ -14507,19 +15100,27 @@ var RipgrepFallbackEvent = class {
14507
15100
  this.error = error;
14508
15101
  }
14509
15102
  };
14510
- var LoopType = /* @__PURE__ */ ((LoopType2) => {
14511
- LoopType2["CONSECUTIVE_IDENTICAL_TOOL_CALLS"] = "consecutive_identical_tool_calls";
14512
- LoopType2["CHANTING_IDENTICAL_SENTENCES"] = "chanting_identical_sentences";
14513
- LoopType2["REPETITIVE_THOUGHTS"] = "repetitive_thoughts";
14514
- LoopType2["READ_FILE_LOOP"] = "read_file_loop";
14515
- LoopType2["ACTION_STAGNATION"] = "action_stagnation";
14516
- LoopType2["SHELL_COMMAND_STAGNATION"] = "shell_command_stagnation";
14517
- LoopType2["GLOBAL_TOOL_CALL_DUPLICATE"] = "global_tool_call_duplicate";
14518
- LoopType2["ALTERNATING_TOOL_CALL_PATTERN"] = "alternating_tool_call_pattern";
14519
- LoopType2["TURN_TOOL_CALL_CAP"] = "turn_tool_call_cap";
14520
- LoopType2["INVALID_TOOL_PARAMS_STAGNATION"] = "invalid_tool_params_stagnation";
14521
- return LoopType2;
14522
- })(LoopType || {});
15103
+ var RipgrepRuntimeRecoveryEvent = class {
15104
+ static {
15105
+ __name(this, "RipgrepRuntimeRecoveryEvent");
15106
+ }
15107
+ "event.name";
15108
+ "event.timestamp";
15109
+ selection_mode;
15110
+ retry_triggered;
15111
+ retry_succeeded;
15112
+ failure_kind;
15113
+ constructor(params) {
15114
+ this["event.name"] = "ripgrep_runtime_recovery";
15115
+ this["event.timestamp"] = (/* @__PURE__ */ new Date()).toISOString();
15116
+ this.selection_mode = params.selection_mode;
15117
+ this.retry_triggered = params.retry_triggered;
15118
+ if (params.retry_succeeded !== void 0) {
15119
+ this.retry_succeeded = params.retry_succeeded;
15120
+ }
15121
+ this.failure_kind = params.failure_kind;
15122
+ }
15123
+ };
14523
15124
  var LoopDetectedEvent = class {
14524
15125
  static {
14525
15126
  __name(this, "LoopDetectedEvent");
@@ -14579,11 +15180,6 @@ function makeSlashCommandEvent({
14579
15180
  };
14580
15181
  }
14581
15182
  __name(makeSlashCommandEvent, "makeSlashCommandEvent");
14582
- var SlashCommandStatus = /* @__PURE__ */ ((SlashCommandStatus2) => {
14583
- SlashCommandStatus2["SUCCESS"] = "success";
14584
- SlashCommandStatus2["ERROR"] = "error";
14585
- return SlashCommandStatus2;
14586
- })(SlashCommandStatus || {});
14587
15183
  function makeChatCompressionEvent({
14588
15184
  tokens_before,
14589
15185
  tokens_after,
@@ -14600,11 +15196,6 @@ function makeChatCompressionEvent({
14600
15196
  };
14601
15197
  }
14602
15198
  __name(makeChatCompressionEvent, "makeChatCompressionEvent");
14603
- var IdeConnectionType = /* @__PURE__ */ ((IdeConnectionType2) => {
14604
- IdeConnectionType2["START"] = "start";
14605
- IdeConnectionType2["SESSION"] = "session";
14606
- return IdeConnectionType2;
14607
- })(IdeConnectionType || {});
14608
15199
  var IdeConnectionEvent = class {
14609
15200
  static {
14610
15201
  __name(this, "IdeConnectionEvent");
@@ -14976,12 +15567,6 @@ var SkillLaunchEvent = class {
14976
15567
  this.prompt_id = prompt_id;
14977
15568
  }
14978
15569
  };
14979
- var UserFeedbackRating = /* @__PURE__ */ ((UserFeedbackRating2) => {
14980
- UserFeedbackRating2[UserFeedbackRating2["BAD"] = 1] = "BAD";
14981
- UserFeedbackRating2[UserFeedbackRating2["FINE"] = 2] = "FINE";
14982
- UserFeedbackRating2[UserFeedbackRating2["GOOD"] = 3] = "GOOD";
14983
- return UserFeedbackRating2;
14984
- })(UserFeedbackRating || {});
14985
15570
  var UserFeedbackEvent = class {
14986
15571
  static {
14987
15572
  __name(this, "UserFeedbackEvent");
@@ -15302,6 +15887,38 @@ function memoryFreshnessNote(mtimeMs) {
15302
15887
  }
15303
15888
  __name(memoryFreshnessNote, "memoryFreshnessNote");
15304
15889
 
15890
+ // packages/core/src/tools/file-read-permission.ts
15891
+ init_esbuild_shims();
15892
+ import path8 from "node:path";
15893
+ function getFileReadDefaultPermission(config, requestedPath) {
15894
+ const filePath = path8.resolve(requestedPath);
15895
+ const workspaceContext = config.getWorkspaceContext();
15896
+ const allowedRoots = [
15897
+ config.storage.getProjectTempDir(),
15898
+ // Background subagent transcripts live under <projectDir>/subagents/ and
15899
+ // are advertised to the model as polling targets via read_file.
15900
+ path8.join(config.storage.getProjectDir(), "subagents"),
15901
+ Storage.getGlobalTempDir(),
15902
+ ...config.storage.getUserSkillsDirs(),
15903
+ Storage.getUserExtensionsDir(),
15904
+ // Approved plans are persisted here (default ~/.qwen/plans, outside
15905
+ // the workspace) and after approval nothing re-injects the plan text,
15906
+ // so the saved file is the model's only recovery route — reading it
15907
+ // back must not stall on a confirmation prompt. The dir holds only
15908
+ // session plan files, never credentials or settings.
15909
+ config.getPlansDir()
15910
+ ];
15911
+ if (workspaceContext.isPathWithinWorkspace(filePath) || isSubpaths(allowedRoots, filePath) || // isAnyAutoMemPath narrows to the managed auto-memory roots
15912
+ // (per-project + user-level under ~/.qwen/memories/) — never the
15913
+ // broad getMemoryBaseDir() — to avoid exposing sensitive ~/.qwen
15914
+ // files such as settings.json or OAuth credentials.
15915
+ isAnyAutoMemPath(filePath, config.getTargetDir())) {
15916
+ return "allow";
15917
+ }
15918
+ return "ask";
15919
+ }
15920
+ __name(getFileReadDefaultPermission, "getFileReadDefaultPermission");
15921
+
15305
15922
  // packages/core/src/services/visionBridge/vision-bridge-service.ts
15306
15923
  init_esbuild_shims();
15307
15924
 
@@ -15503,77 +16120,9 @@ async function runSideQuery(config, options) {
15503
16120
  }
15504
16121
  __name(runSideQuery, "runSideQuery");
15505
16122
 
15506
- // packages/core/src/services/visionBridge/image-part-utils.ts
15507
- init_esbuild_shims();
15508
- function normalizeParts(input) {
15509
- if (typeof input === "string") {
15510
- return [{ text: input }];
15511
- }
15512
- if (Array.isArray(input)) {
15513
- return input.map(
15514
- (part) => typeof part === "string" ? { text: part } : part
15515
- );
15516
- }
15517
- return [input];
15518
- }
15519
- __name(normalizeParts, "normalizeParts");
15520
- function isImagePart(part) {
15521
- const mimeType = part.inlineData?.mimeType;
15522
- const data = part.inlineData?.data;
15523
- return typeof mimeType === "string" && mimeType.startsWith("image/") && typeof data === "string" && data.length > 0;
15524
- }
15525
- __name(isImagePart, "isImagePart");
15526
- function hasImageParts(input) {
15527
- return normalizeParts(input).some(isImagePart);
15528
- }
15529
- __name(hasImageParts, "hasImageParts");
15530
- function splitImageParts(input) {
15531
- const imageParts = [];
15532
- const nonImageParts = [];
15533
- for (const part of normalizeParts(input)) {
15534
- if (isImagePart(part)) {
15535
- imageParts.push(part);
15536
- } else {
15537
- nonImageParts.push(part);
15538
- }
15539
- }
15540
- return { imageParts, nonImageParts };
15541
- }
15542
- __name(splitImageParts, "splitImageParts");
15543
- function replaceImagesWithText(input, text) {
15544
- const result = [];
15545
- let replaced = false;
15546
- for (const part of normalizeParts(input)) {
15547
- if (isImagePart(part)) {
15548
- if (!replaced) {
15549
- result.push({ text });
15550
- replaced = true;
15551
- }
15552
- continue;
15553
- }
15554
- result.push(part);
15555
- }
15556
- if (!replaced) {
15557
- result.push({ text });
15558
- }
15559
- return result;
15560
- }
15561
- __name(replaceImagesWithText, "replaceImagesWithText");
15562
- function isUsableImagePart(part) {
15563
- const data = part.inlineData?.data;
15564
- if (typeof data !== "string" || data.length === 0) {
15565
- return false;
15566
- }
15567
- return data.length <= VISION_BRIDGE_MAX_IMAGE_BASE64_BYTES;
15568
- }
15569
- __name(isUsableImagePart, "isUsableImagePart");
15570
- function collectText(parts) {
15571
- return parts.map((part) => typeof part.text === "string" ? part.text : "").filter((text) => text.length > 0).join("\n").trim();
15572
- }
15573
- __name(collectText, "collectText");
15574
-
15575
16123
  // packages/core/src/services/visionBridge/vision-bridge-service.ts
15576
16124
  var debugLogger7 = createDebugLogger("VISION_BRIDGE");
16125
+ var turnImageCounts = /* @__PURE__ */ new WeakMap();
15577
16126
  var BRIDGE_MAX_OUTPUT_TOKENS = 2048;
15578
16127
  var VISION_BRIDGE_TIMEOUT_MS = 3e4;
15579
16128
  var VISION_BRIDGE_MAX_ATTEMPTS = 2;
@@ -15730,8 +16279,10 @@ function formatFullTurnVisionNotice(selection) {
15730
16279
  return `Routing this image turn to ${target}; retries and tool continuations will stay on that model until the turn ends.`;
15731
16280
  }
15732
16281
  __name(formatFullTurnVisionNotice, "formatFullTurnVisionNotice");
15733
- function buildIntentPart(intentText, sourceContext) {
15734
- const sourceHint = sourceContext ? `The images are consecutive pages ${sourceContext.renderedRange.firstPage}-${sourceContext.renderedRange.lastPage} from PDF ${JSON.stringify(sourceContext.displayName)}. Transcribe each page separately and label each section with its original PDF page number.` : "";
16282
+ function buildIntentPart(intentText, sourceContext, imageParts = []) {
16283
+ const sourceHint = sourceContext ? `The images are consecutive pages ${sourceContext.renderedRange.firstPage}-${sourceContext.renderedRange.lastPage} from PDF ${JSON.stringify(sourceContext.displayName)}. Transcribe each page separately and label each section with its original PDF page number.` : imageParts.length > 0 ? `Describe each image separately under these ordered labels: ${imageParts.map(
16284
+ (part, index) => `${index + 1}. ${JSON.stringify(part.inlineData?.displayName?.trim() || `image ${index + 1}`)}`
16285
+ ).join("; ")}.` : "";
15735
16286
  const focusHint = intentText.length > 0 ? `Focus hint \u2014 do NOT answer this, use it only to decide which details to transcribe thoroughly: ${intentText}` : "Describe the image(s) and transcribe any visible text, code, and errors.";
15736
16287
  return sourceHint ? `${sourceHint}
15737
16288
  ${focusHint}` : focusHint;
@@ -15779,7 +16330,7 @@ function failure(reason, parts, omittedCount, extra = {}) {
15779
16330
  }
15780
16331
  __name(failure, "failure");
15781
16332
  async function runVisionBridge(params) {
15782
- const { config, parts, signal, sourceContext } = params;
16333
+ const { config, parts, signal, sourceContext, intentText } = params;
15783
16334
  const { imageParts, nonImageParts } = splitImageParts(parts);
15784
16335
  if (imageParts.length === 0) {
15785
16336
  return {
@@ -15790,9 +16341,14 @@ async function runVisionBridge(params) {
15790
16341
  };
15791
16342
  }
15792
16343
  const validImages = imageParts.filter(isUsableImagePart);
15793
- const toConvert = validImages.slice(0, VISION_BRIDGE_MAX_IMAGES);
16344
+ const usedImages = turnImageCounts.get(signal) ?? 0;
16345
+ const remainingImages = Math.max(0, VISION_BRIDGE_MAX_IMAGES - usedImages);
16346
+ const toConvert = validImages.slice(0, remainingImages);
15794
16347
  const omittedCount = imageParts.length - toConvert.length;
15795
- const intent = collectText(nonImageParts).slice(0, BRIDGE_INTENT_MAX_CHARS);
16348
+ const intent = (intentText ?? collectText(nonImageParts)).slice(
16349
+ 0,
16350
+ BRIDGE_INTENT_MAX_CHARS
16351
+ );
15796
16352
  const resolvedSourceContext = sourceContext ?? inferPdfSourceContext(toConvert);
15797
16353
  const selection = config.getDefaultVisionBridgeModel?.();
15798
16354
  const modelId = selection?.id;
@@ -15814,13 +16370,14 @@ async function runVisionBridge(params) {
15814
16370
  { modelId, ...modelEndpoint && { modelEndpoint } }
15815
16371
  );
15816
16372
  }
16373
+ turnImageCounts.set(signal, usedImages + toConvert.length);
15817
16374
  const timeoutMs = config.getVisionBridgeTimeoutMs?.() ?? VISION_BRIDGE_TIMEOUT_MS;
15818
16375
  const requestContents = [
15819
16376
  {
15820
16377
  role: "user",
15821
16378
  parts: [
15822
16379
  ...toConvert,
15823
- { text: buildIntentPart(intent, resolvedSourceContext) }
16380
+ { text: buildIntentPart(intent, resolvedSourceContext, toConvert) }
15824
16381
  ]
15825
16382
  }
15826
16383
  ];
@@ -15955,35 +16512,13 @@ var ReadFileToolInvocation = class extends BaseToolInvocation {
15955
16512
  * Returns 'ask' for paths outside the workspace/temp/userSkills directories,
15956
16513
  * so that external file reads require user confirmation.
15957
16514
  */
15958
- async getDefaultPermission() {
15959
- const filePath = path8.resolve(this.params.file_path);
15960
- const workspaceContext = this.config.getWorkspaceContext();
15961
- const allowedRoots = [
15962
- this.config.storage.getProjectTempDir(),
15963
- // Background subagent transcripts live under <projectDir>/subagents/ and
15964
- // are advertised to the model as polling targets via read_file.
15965
- path8.join(this.config.storage.getProjectDir(), "subagents"),
15966
- Storage.getGlobalTempDir(),
15967
- ...this.config.storage.getUserSkillsDirs(),
15968
- Storage.getUserExtensionsDir(),
15969
- // Approved plans are persisted here (default ~/.qwen/plans, outside
15970
- // the workspace) and after approval nothing re-injects the plan text,
15971
- // so the saved file is the model's only recovery route — reading it
15972
- // back must not stall on a confirmation prompt. The dir holds only
15973
- // session plan files, never credentials or settings.
15974
- this.config.getPlansDir()
15975
- ];
15976
- if (workspaceContext.isPathWithinWorkspace(filePath) || isSubpaths(allowedRoots, filePath) || // isAnyAutoMemPath narrows to the managed auto-memory roots
15977
- // (per-project + user-level under ~/.qwen/memories/) — never the
15978
- // broad getMemoryBaseDir() — to avoid exposing sensitive ~/.qwen
15979
- // files such as settings.json or OAuth credentials.
15980
- isAnyAutoMemPath(filePath, this.config.getTargetDir())) {
15981
- return "allow";
15982
- }
15983
- return "ask";
16515
+ getDefaultPermission() {
16516
+ return Promise.resolve(
16517
+ getFileReadDefaultPermission(this.config, this.params.file_path)
16518
+ );
15984
16519
  }
15985
16520
  async execute(signal) {
15986
- const absPath = path8.resolve(this.params.file_path);
16521
+ const absPath = path9.resolve(this.params.file_path);
15987
16522
  const projectRoot = this.config.getTargetDir();
15988
16523
  const isAutoMem = isAnyAutoMemPath(absPath, projectRoot);
15989
16524
  const cacheEnabled = !this.config.getFileReadCacheDisabled();
@@ -15992,7 +16527,7 @@ var ReadFileToolInvocation = class extends BaseToolInvocation {
15992
16527
  const isFullRead = this.params.offset === void 0 && this.params.limit === void 0 && this.params.pages === void 0;
15993
16528
  let stats;
15994
16529
  try {
15995
- stats = await fs6.stat(absPath);
16530
+ stats = await fs7.stat(absPath);
15996
16531
  } catch (err) {
15997
16532
  debugLogger8.debug("stat-failed", {
15998
16533
  path: absPath,
@@ -16009,7 +16544,7 @@ var ReadFileToolInvocation = class extends BaseToolInvocation {
16009
16544
  }
16010
16545
  debugLogger8.debug("miss", { path: absPath, state: status.state });
16011
16546
  }
16012
- const preparePdfForVisionBridge = shouldRunVisionBridge(this.config);
16547
+ const prepareForVisionBridge = shouldRunVisionBridge(this.config);
16013
16548
  let result = await processSingleFileContent(
16014
16549
  this.params.file_path,
16015
16550
  this.config,
@@ -16017,7 +16552,8 @@ var ReadFileToolInvocation = class extends BaseToolInvocation {
16017
16552
  offset: this.params.offset,
16018
16553
  limit: this.params.limit,
16019
16554
  pages: this.params.pages,
16020
- preparePdfForVisionBridge,
16555
+ preserveUnsupportedImage: prepareForVisionBridge,
16556
+ preparePdfForVisionBridge: prepareForVisionBridge,
16021
16557
  signal
16022
16558
  }
16023
16559
  );
@@ -16057,7 +16593,7 @@ ${result.llmContent}`;
16057
16593
  }
16058
16594
  if (typeof llmContent === "string" && isAutoMem) {
16059
16595
  try {
16060
- const memStat = stats ?? await fs6.stat(absPath);
16596
+ const memStat = stats ?? await fs7.stat(absPath);
16061
16597
  const note = memoryFreshnessNote(memStat.mtimeMs);
16062
16598
  if (note) {
16063
16599
  llmContent = note + llmContent;
@@ -16077,7 +16613,7 @@ ${result.llmContent}`;
16077
16613
  "read" /* READ */,
16078
16614
  lines,
16079
16615
  mimetype,
16080
- path8.extname(this.params.file_path),
16616
+ path9.extname(this.params.file_path),
16081
16617
  programming_language
16082
16618
  )
16083
16619
  );
@@ -16280,7 +16816,7 @@ var ReadFileTool = class _ReadFileTool extends BaseDeclarativeTool {
16280
16816
  if (!filePath) {
16281
16817
  return "The 'file_path' parameter must be non-empty.";
16282
16818
  }
16283
- if (!path8.isAbsolute(filePath)) {
16819
+ if (!path9.isAbsolute(filePath)) {
16284
16820
  return `File path must be absolute, but was relative: ${filePath}. You must provide an absolute path.`;
16285
16821
  }
16286
16822
  if (params.offset !== void 0 && (!Number.isInteger(params.offset) || params.offset < 0)) {
@@ -16293,7 +16829,7 @@ var ReadFileTool = class _ReadFileTool extends BaseDeclarativeTool {
16293
16829
  const pages = params.pages.trim();
16294
16830
  params.pages = pages.length > 0 ? pages : void 0;
16295
16831
  }
16296
- const ext = path8.extname(filePath).toLowerCase();
16832
+ const ext = path9.extname(filePath).toLowerCase();
16297
16833
  if ((params.offset !== void 0 || params.limit !== void 0) && ext === ".ipynb") {
16298
16834
  return "offset and limit are not supported for Jupyter notebook (.ipynb) files. Notebooks are always read in full with structured cell output.";
16299
16835
  }
@@ -16333,13 +16869,10 @@ export {
16333
16869
  isImagePart,
16334
16870
  hasImageParts,
16335
16871
  splitImageParts,
16336
- replaceImagesWithText,
16337
- isUsableImagePart,
16338
16872
  collectText,
16339
16873
  isImageCapable,
16340
16874
  isFullTurnVisionCapable,
16341
16875
  getQualifiedVisionModelId,
16342
- getVisionModelSelector,
16343
16876
  getFullTurnVisionModelSelector,
16344
16877
  selectVisionBridgeModel,
16345
16878
  shouldRunVisionBridge,
@@ -16350,41 +16883,30 @@ export {
16350
16883
  runVisionBridge,
16351
16884
  MAIN_SOURCE,
16352
16885
  subagentNameContext,
16886
+ isInternalPromptId,
16353
16887
  UiTelemetryService,
16354
16888
  uiTelemetryService,
16355
- isInternalPromptId,
16356
- sanitizeHookName,
16357
16889
  import_lru_cache,
16358
- QwenLogger,
16359
16890
  apiActivityTracker,
16360
16891
  _recoverObjectsFromLine,
16361
16892
  parseLineTolerant,
16362
16893
  readLines,
16363
16894
  read,
16364
- _resetEnsuredDirsCacheForTest,
16365
16895
  writeLine,
16366
16896
  writeLineSync,
16367
- write,
16368
- countLines,
16369
16897
  exists,
16370
- getTokenUsageFilePath,
16371
- apiResponseEventToTokenUsageRecord,
16372
- recordTokenUsageFromApiResponse,
16373
- recordTokenUsageFromApiResponseBestEffort,
16374
16898
  queryTokenUsage,
16375
16899
  formatTokenUsageSummaryAsCsv,
16376
16900
  formatTokenUsageSummaryAsJson,
16377
- exportTokenUsageSummary,
16378
16901
  runWithChatRecordingSuppressed,
16379
16902
  logStartSession,
16380
16903
  logUserPrompt,
16381
16904
  logUserRetry,
16382
16905
  logToolCall,
16383
- logToolOutputTruncated,
16384
16906
  logFileOperation,
16385
16907
  logApiRequest,
16386
- logFlashFallback,
16387
16908
  logRipgrepFallback,
16909
+ logRipgrepRuntimeRecovery,
16388
16910
  logApiError,
16389
16911
  logApiCancel,
16390
16912
  logApiResponse,
@@ -16423,31 +16945,16 @@ export {
16423
16945
  logMemoryDream,
16424
16946
  logMemoryRecall,
16425
16947
  logMemoryRecallDelivery,
16426
- iconvEncode,
16427
- iconvEncodingExists,
16428
16948
  isUtf8CompatibleEncoding,
16429
- DEFAULT_CONTEXT_FILENAME,
16430
- AGENT_CONTEXT_FILENAME,
16949
+ loadIconvLite,
16431
16950
  LOCAL_CONTEXT_FILENAME,
16432
16951
  MEMORY_SECTION_HEADER,
16433
16952
  setGeminiMdFilename,
16434
16953
  getCurrentGeminiMdFilename,
16435
16954
  getAllGeminiMdFilenames,
16436
- COMMON_IGNORE_PATTERNS,
16437
- BINARY_FILE_PATTERNS,
16438
- MEDIA_FILE_PATTERNS,
16439
- COMMON_DIRECTORY_EXCLUDES,
16440
- PYTHON_EXCLUDES,
16441
- SYSTEM_FILE_EXCLUDES,
16442
- DEFAULT_FILE_EXCLUDES,
16443
16955
  FileExclusions,
16444
- extractExtensionsFromPatterns,
16445
- BINARY_EXTENSIONS,
16446
- resetEncodingCache,
16447
16956
  getCachedEncodingForBuffer,
16448
16957
  getSystemEncoding,
16449
- windowsCodePageToEncoding,
16450
- detectEncodingFromBuffer,
16451
16958
  extractPDFText,
16452
16959
  normalizeSource,
16453
16960
  parseNotebook,
@@ -16462,24 +16969,24 @@ export {
16462
16969
  inferInsertedCellSourceArrayStyle,
16463
16970
  toNotebookSource,
16464
16971
  normalizeEditedCell,
16465
- DEFAULT_ENCODING,
16466
- detectBOM,
16467
- decodeBufferWithEncodingInfo,
16468
- readFileWithEncodingInfo,
16469
- readFileWithEncoding,
16470
- countFileLines,
16972
+ CursorNotAtLineBoundaryError,
16973
+ LargeNonUtf8TextError,
16974
+ TextScanBudgetExceededError,
16975
+ readTextRangeFromHandle,
16976
+ readTextCursorWindowFromHandle,
16977
+ ImageViewError,
16978
+ renderNormalizedImageCrop,
16979
+ decodeBufferWithEncodingInfoAsync,
16471
16980
  readFileWithLineAndLimit,
16472
- detectFileEncoding,
16473
16981
  getSpecificMimeType,
16474
16982
  isWithinRoot,
16475
- isBinaryFile,
16476
- detectFileType,
16477
16983
  isCacheableReadResult,
16478
16984
  processSingleFileContent,
16479
16985
  fileExists,
16480
16986
  getLanguageFromFilePath,
16481
16987
  memoryAge,
16482
16988
  memoryFreshnessText,
16989
+ getFileReadDefaultPermission,
16483
16990
  ReadFileTool,
16484
16991
  MAX_SESSION_BYTES,
16485
16992
  TOOL_OUTPUT_TRUNCATED_PREFIX,
@@ -16488,7 +16995,6 @@ export {
16488
16995
  isAlreadyTruncated,
16489
16996
  normalizeToolResultCallId,
16490
16997
  persistAndTruncateToolResult,
16491
- MCPServerStatus,
16492
16998
  addMCPStatusChangeListener,
16493
16999
  removeMCPStatusChangeListener,
16494
17000
  updateMCPServerStatus,
@@ -16502,9 +17008,7 @@ export {
16502
17008
  runWithInvocationContext,
16503
17009
  getInvocationContext,
16504
17010
  DiscoveredMCPTool,
16505
- generateValidName,
16506
17011
  StartSessionEvent,
16507
- EndSessionEvent,
16508
17012
  UserPromptEvent,
16509
17013
  UserRetryEvent,
16510
17014
  ToolCallEvent,
@@ -16512,16 +17016,13 @@ export {
16512
17016
  ApiErrorEvent,
16513
17017
  ApiCancelEvent,
16514
17018
  ApiResponseEvent,
16515
- FlashFallbackEvent,
16516
17019
  RipgrepFallbackEvent,
16517
- LoopType,
17020
+ RipgrepRuntimeRecoveryEvent,
16518
17021
  LoopDetectedEvent,
16519
17022
  LoopDetectionDisabledEvent,
16520
17023
  NextSpeakerCheckEvent,
16521
17024
  makeSlashCommandEvent,
16522
- SlashCommandStatus,
16523
17025
  makeChatCompressionEvent,
16524
- IdeConnectionType,
16525
17026
  IdeConnectionEvent,
16526
17027
  ConversationFinishedEvent,
16527
17028
  KittySequenceOverflowEvent,
@@ -16531,7 +17032,6 @@ export {
16531
17032
  ApiRetryEvent,
16532
17033
  ContentRetryFailureEvent,
16533
17034
  ExtensionInstallEvent,
16534
- ToolOutputTruncatedEvent,
16535
17035
  ExtensionUninstallEvent,
16536
17036
  ExtensionUpdateEvent,
16537
17037
  ExtensionEnableEvent,
@@ -16540,7 +17040,6 @@ export {
16540
17040
  AuthEvent,
16541
17041
  HookCallEvent,
16542
17042
  SkillLaunchEvent,
16543
- UserFeedbackRating,
16544
17043
  UserFeedbackEvent,
16545
17044
  makeArenaSessionStartedEvent,
16546
17045
  makeArenaAgentCompletedEvent,
@@ -16555,6 +17054,11 @@ export {
16555
17054
  MemoryRecallEvent,
16556
17055
  MemoryRecallDeliveryEvent
16557
17056
  };
17057
+ /**
17058
+ * @license
17059
+ * Copyright 2026 Qwen Team
17060
+ * SPDX-License-Identifier: Apache-2.0
17061
+ */
16558
17062
  /**
16559
17063
  * @license
16560
17064
  * Copyright 2025 Google LLC
@@ -16567,7 +17071,7 @@ export {
16567
17071
  */
16568
17072
  /**
16569
17073
  * @license
16570
- * Copyright 2026 Qwen Team
17074
+ * Copyright 2026 Qwen
16571
17075
  * SPDX-License-Identifier: Apache-2.0
16572
17076
  */
16573
17077
  /**