@qwen-code/qwen-code 0.21.1 → 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 (321) hide show
  1. package/bundled/qc-helper/docs/configuration/settings.md +1 -0
  2. package/bundled/qc-helper/docs/features/channels/_meta.ts +1 -0
  3. package/bundled/qc-helper/docs/features/channels/github.md +42 -10
  4. package/bundled/qc-helper/docs/features/channels/gitlab.md +171 -0
  5. package/bundled/qc-helper/docs/features/code-review.md +20 -0
  6. package/bundled/qc-helper/docs/features/hooks.md +20 -0
  7. package/bundled/qc-helper/docs/features/sub-agents.md +22 -8
  8. package/bundled/qc-helper/docs/qwen-serve.md +7 -5
  9. package/bundled/review/SKILL.md +1 -1
  10. package/chunks/{MaxSizedBox-VI3ROJJA.js → MaxSizedBox-TQBQ247P.js} +42 -38
  11. package/chunks/{StandaloneSessionPicker-LYXKD2EV.js → StandaloneSessionPicker-2HPTKCLX.js} +58 -54
  12. package/chunks/{acp-startup-profiler-DFVPFQ6C.js → acp-startup-profiler-2C4A5ZTJ.js} +2 -2
  13. package/chunks/{acpAgent-WN5SRDQO.js → acpAgent-PS6EDGH3.js} +431 -168
  14. package/chunks/{agent-K6ECSM64.js → agent-VDOUB35F.js} +38 -34
  15. package/chunks/{agent-headless-NO4Y2HOE.js → agent-headless-EO53EFS2.js} +38 -34
  16. package/chunks/{anthropicContentGenerator-V2QOGVYD.js → anthropicContentGenerator-OFHSZJBF.js} +6 -6
  17. package/chunks/{artifact-tool-6K6U7XYJ.js → artifact-tool-RDN2W7ND.js} +2 -2
  18. package/chunks/{askUserQuestion-GD2IJJ7I.js → askUserQuestion-OZERWH5R.js} +2 -2
  19. package/chunks/{bridge-3KJEWDNE.js → bridge-W7AZSRZQ.js} +42 -38
  20. package/chunks/{build-S6DO7LMM.js → build-GDBLPA24.js} +1 -1
  21. package/chunks/{channel-management-service-XR7GZSWF.js → channel-management-service-5S7YCWX5.js} +20 -5
  22. package/chunks/{channel-settings-store-HW4FXXUA.js → channel-settings-store-JFVRSNER.js} +44 -40
  23. package/chunks/{channel-worker-group-XDPTDWTX.js → channel-worker-group-OVWGYMZS.js} +5 -5
  24. package/chunks/{channel-worker-manager-YYEHVRRE.js → channel-worker-manager-H55GKOQA.js} +5 -5
  25. package/chunks/{channel-worker-supervisor-74HTWA2G.js → channel-worker-supervisor-CABBXYHK.js} +3 -3
  26. package/chunks/{chunk-UWMLWVCA.js → chunk-2IIJTXYF.js} +26 -10
  27. package/chunks/{chunk-VYOXCEPJ.js → chunk-2KKCCLPT.js} +1 -1
  28. package/chunks/{chunk-T4TXDL7G.js → chunk-2LEOZTBT.js} +36 -24
  29. package/chunks/{chunk-XWWKIXVD.js → chunk-3APUUXRF.js} +1 -1
  30. package/chunks/{chunk-TCIFAA7K.js → chunk-3F2WDAV6.js} +2 -2
  31. package/chunks/{chunk-SGFT55XI.js → chunk-3I6DUGQD.js} +1 -1
  32. package/chunks/{chunk-ZURDMIDR.js → chunk-44F4LBWZ.js} +228 -71
  33. package/chunks/{chunk-GKX7E4CO.js → chunk-45IOTAUS.js} +1 -1
  34. package/chunks/{chunk-6QIGFD5W.js → chunk-4KP2F2TE.js} +1 -1
  35. package/chunks/{chunk-X5WNMMIA.js → chunk-54YCNSK5.js} +4241 -1636
  36. package/chunks/{chunk-P4WOAOJW.js → chunk-56Z7QEAQ.js} +67 -21
  37. package/chunks/{chunk-UPUG4GXM.js → chunk-5NNHICSA.js} +3 -3
  38. package/chunks/{chunk-LGAOC3ZS.js → chunk-675H6PLP.js} +1 -1
  39. package/chunks/{chunk-5KTQXHPY.js → chunk-6CQWRWUC.js} +3 -3
  40. package/chunks/chunk-6FMJLI5M.js +1591 -0
  41. package/chunks/{chunk-GZ3RCT54.js → chunk-6MPDY6ZG.js} +1 -1
  42. package/chunks/{chunk-RCUQIPTN.js → chunk-6PQPKTXP.js} +1 -1
  43. package/chunks/{chunk-KCO4FLFJ.js → chunk-6TAASXWL.js} +3 -3
  44. package/chunks/{chunk-JHNRZMHI.js → chunk-77V3VIKL.js} +9 -9
  45. package/chunks/{chunk-CAPPWD3X.js → chunk-7KAXXBER.js} +3 -3
  46. package/chunks/{chunk-A4COXFB3.js → chunk-7SJN2IWT.js} +5 -5
  47. package/chunks/{chunk-Y4IHBGBP.js → chunk-7ULQIS27.js} +1 -1
  48. package/chunks/{chunk-5MKRTI4T.js → chunk-A7Y5H4TX.js} +4 -4
  49. package/chunks/{chunk-CVHIL5IG.js → chunk-AOHY3QJ3.js} +13 -6
  50. package/chunks/chunk-AQ37AY7B.js +93 -0
  51. package/chunks/{chunk-OCESJA77.js → chunk-AUOULH6Q.js} +45 -45
  52. package/chunks/{chunk-UBEPNVDI.js → chunk-BBIQAX4V.js} +3 -3
  53. package/chunks/{chunk-JSD33JG6.js → chunk-CBBP4BMC.js} +23 -9
  54. package/chunks/{chunk-ZHBO7WVX.js → chunk-CNTR4GR6.js} +1 -1
  55. package/chunks/{chunk-PB3MBFKG.js → chunk-CO2U743O.js} +4 -4
  56. package/chunks/{chunk-XZC5VLBZ.js → chunk-CPZAH673.js} +4 -0
  57. package/chunks/{chunk-T3O2B4XO.js → chunk-CU47KXB5.js} +3 -3
  58. package/chunks/{chunk-2LKVPASC.js → chunk-D4HTUMGX.js} +3 -3
  59. package/chunks/{chunk-BNWB5CYE.js → chunk-D6MDRSZ6.js} +7 -7
  60. package/chunks/{chunk-7BAU433D.js → chunk-DEEABGH2.js} +867 -91
  61. package/chunks/{chunk-52ZSWYEG.js → chunk-DQ2O5QOJ.js} +1 -1
  62. package/chunks/{chunk-WBSMNTSV.js → chunk-DSFHVTWD.js} +2 -2
  63. package/chunks/{chunk-PT722TDT.js → chunk-DUNI4EBW.js} +701 -86
  64. package/chunks/{chunk-UHUSJ6X7.js → chunk-E2BHWIDT.js} +19 -4
  65. package/chunks/{chunk-T2QMKU3R.js → chunk-E2FN6SM7.js} +17 -5
  66. package/chunks/{chunk-W4MIWP6M.js → chunk-E6CJ2SMM.js} +2 -2
  67. package/chunks/{chunk-5ZF5XXTS.js → chunk-EQNUDTL6.js} +2 -2
  68. package/chunks/{chunk-2N7CODY5.js → chunk-EU5TBFJI.js} +2 -2
  69. package/chunks/{chunk-TFRMVU6R.js → chunk-FANRZEAJ.js} +1 -1
  70. package/chunks/{chunk-WBL3FJEU.js → chunk-FC4KQFCS.js} +1 -1
  71. package/chunks/{chunk-GNR2RNMP.js → chunk-FCYYAB4S.js} +2 -2
  72. package/chunks/{chunk-FNMZK765.js → chunk-FJ5WUMUQ.js} +1 -1
  73. package/chunks/{chunk-J7OACQDE.js → chunk-FNDXMN7I.js} +71 -49
  74. package/chunks/{chunk-U3E3UQAA.js → chunk-FS674JW4.js} +3 -3
  75. package/chunks/{chunk-S7W2GKIO.js → chunk-G7XXKQYS.js} +2 -0
  76. package/chunks/{chunk-VWOOBLTY.js → chunk-GJ2GBPBD.js} +2 -2
  77. package/chunks/{chunk-TBBV36Y4.js → chunk-GL4JOZXU.js} +4 -4
  78. package/chunks/{chunk-FTD6DP4T.js → chunk-GURGAJTX.js} +2 -1
  79. package/chunks/{chunk-65PQENQP.js → chunk-H6I4PGRV.js} +5 -5
  80. package/chunks/{chunk-7XATOOE7.js → chunk-HC45LTEN.js} +1 -1
  81. package/chunks/{chunk-VCPIZRYH.js → chunk-HIVKI6O6.js} +7 -7
  82. package/chunks/{chunk-HMRM2A3U.js → chunk-HX6RLYUO.js} +3 -3
  83. package/chunks/{chunk-GZXCZHCT.js → chunk-I3G5JWBV.js} +1 -1
  84. package/chunks/{chunk-2XSLTRFZ.js → chunk-I5BT7ADR.js} +2 -2
  85. package/chunks/{chunk-GATT5TKW.js → chunk-IGTHU3T4.js} +1 -1
  86. package/chunks/{chunk-4G2BISNC.js → chunk-IIUGIWWY.js} +1 -1
  87. package/chunks/{chunk-7I5GTCT4.js → chunk-JCJ7LKNA.js} +5104 -4817
  88. package/chunks/{chunk-657BH7VM.js → chunk-JE2CEOBO.js} +2 -2
  89. package/chunks/{chunk-S3TWXGKA.js → chunk-JE7KQ2UP.js} +4 -2
  90. package/chunks/{chunk-BPZKP57P.js → chunk-JJPKFJBT.js} +3 -3
  91. package/chunks/{chunk-6PE7N3A4.js → chunk-JLZ3RBQG.js} +7 -5
  92. package/chunks/{chunk-2LQTH543.js → chunk-JXVC2PL3.js} +2 -2
  93. package/chunks/{chunk-JCW2R7WC.js → chunk-K623ENWT.js} +3 -79
  94. package/chunks/{chunk-T2NCM2ET.js → chunk-K6KS3LTN.js} +2 -749
  95. package/chunks/{chunk-6RPMI2AB.js → chunk-KR32NIAN.js} +6 -6
  96. package/chunks/{chunk-XBYYDKAZ.js → chunk-KWHKHSIS.js} +8 -7
  97. package/chunks/{chunk-EVKE2FZL.js → chunk-KXDONCPU.js} +4 -4
  98. package/chunks/{chunk-5TBMQLGG.js → chunk-L2E5GFAG.js} +2 -2
  99. package/chunks/{chunk-MHAIJPTD.js → chunk-L32VV3ZJ.js} +12 -12
  100. package/chunks/{chunk-OKF7JF3R.js → chunk-LHKCY7DY.js} +3 -3
  101. package/chunks/{chunk-LW3RFMG7.js → chunk-LOY7RWQG.js} +3 -3
  102. package/chunks/{chunk-AQIDMUGU.js → chunk-LYI2PZDK.js} +1 -1
  103. package/chunks/{chunk-YGF33UXG.js → chunk-MB32MS4U.js} +12 -3
  104. package/chunks/{chunk-Y6AXW2OG.js → chunk-MM7TH7ZM.js} +1 -1
  105. package/chunks/{chunk-2DN4J57Y.js → chunk-N4ACHWNH.js} +1 -1
  106. package/chunks/{chunk-M7OONWYU.js → chunk-NBD76HUW.js} +4 -2
  107. package/chunks/{chunk-A2D5BAVP.js → chunk-NHFEMWAZ.js} +1 -1
  108. package/chunks/{chunk-3EFXSQCM.js → chunk-NTDH4IML.js} +7 -7
  109. package/chunks/chunk-O6GEWCJA.js +21 -0
  110. package/chunks/{chunk-7DXQIJID.js → chunk-OFZKFPYG.js} +3 -3
  111. package/chunks/{chunk-JTV5K7NH.js → chunk-P5VC5USY.js} +1 -1
  112. package/chunks/{chunk-Q43KPN7X.js → chunk-P755N4CS.js} +3 -3
  113. package/chunks/{chunk-XFZYFU3I.js → chunk-PCK4B6LR.js} +1 -1
  114. package/chunks/{chunk-EJGJIBRS.js → chunk-PJOHNFIY.js} +3 -3
  115. package/chunks/{chunk-WUZ7H6DP.js → chunk-PVNQRENX.js} +1 -1
  116. package/chunks/{chunk-LO4ROVP4.js → chunk-PZEXDV3H.js} +106 -8
  117. package/chunks/{chunk-WZRWHXFE.js → chunk-Q3T5KA2V.js} +1 -1
  118. package/chunks/{chunk-QIZKCVM3.js → chunk-Q5WZTTWE.js} +4 -4
  119. package/chunks/{chunk-BGTQCTQW.js → chunk-QARJNL2V.js} +3 -3
  120. package/chunks/{chunk-GXIJHV66.js → chunk-QCXGC7QB.js} +3 -3
  121. package/chunks/{chunk-DZLYR4U3.js → chunk-QDK4F2N5.js} +1 -1
  122. package/chunks/{chunk-NOKIVHOL.js → chunk-QTHQ6Z5X.js} +1 -1
  123. package/chunks/{chunk-A3NDJ5SB.js → chunk-R2XWGR75.js} +2 -2
  124. package/chunks/{chunk-JX27F6QS.js → chunk-RDJOB6S3.js} +1 -1
  125. package/chunks/{chunk-TV64SXKD.js → chunk-RG64CDT2.js} +4 -4
  126. package/chunks/{chunk-JFMA7Y5M.js → chunk-RSVPYAGK.js} +5 -5
  127. package/chunks/{chunk-64LQLPL7.js → chunk-SHN4KHDK.js} +3 -3
  128. package/chunks/chunk-T3CHYWJZ.js +758 -0
  129. package/chunks/{chunk-PONHVBRT.js → chunk-TEGJSJDF.js} +2 -2
  130. package/chunks/{chunk-75GFAX4R.js → chunk-THVU3RNH.js} +1 -1
  131. package/chunks/{record-artifact-XAMSFSW4.js → chunk-TIRRPCFS.js} +22 -7
  132. package/chunks/{chunk-HV26XH34.js → chunk-TTJZAIFP.js} +3 -3
  133. package/chunks/{chunk-JMONIXMJ.js → chunk-TZTAV5RH.js} +1 -1
  134. package/chunks/{chunk-7AEJDLRA.js → chunk-UV6KF7T3.js} +2 -2
  135. package/chunks/{chunk-PLDQBIO6.js → chunk-V25K5ID7.js} +1 -1
  136. package/chunks/{chunk-S4WJVPZW.js → chunk-V4XNUDPE.js} +3 -3
  137. package/chunks/{chunk-2FAK6PNM.js → chunk-VEMNQMHA.js} +2 -2
  138. package/chunks/{chunk-CQL64ESB.js → chunk-VMX5RZQH.js} +12 -10
  139. package/chunks/{chunk-EIF3FXTB.js → chunk-W3UKBMSI.js} +63 -18
  140. package/chunks/{chunk-TDL6LB4K.js → chunk-WWCMSZII.js} +21 -9
  141. package/chunks/{chunk-5YKDXHUY.js → chunk-XP4L6KS3.js} +2 -2
  142. package/chunks/{chunk-RPLGZJV2.js → chunk-XQK4XXTN.js} +1 -1
  143. package/chunks/{chunk-KAMYKP7E.js → chunk-XUGZYLDH.js} +1 -1
  144. package/chunks/{chunk-MR5EAQ5M.js → chunk-YANIWTRZ.js} +1 -1
  145. package/chunks/{chunk-3L2SPEBH.js → chunk-YGE3IXJP.js} +1 -1
  146. package/chunks/{chunk-BCZFQXWK.js → chunk-YUFIEIWC.js} +1 -1
  147. package/chunks/{chunk-75MIQ3LV.js → chunk-Z3S5EMOW.js} +4 -4
  148. package/chunks/{chunk-BMFALVGQ.js → chunk-ZMOJ7ISP.js} +1 -1
  149. package/chunks/{chunk-GEBV2JGB.js → chunk-ZPZ7ZJEE.js} +1 -1
  150. package/chunks/{computer-use-ZTIDHMMA.js → computer-use-5QWCFNKD.js} +38 -34
  151. package/chunks/{config-utils-NYSXDMEQ.js → config-utils-WADIDWGG.js} +4 -4
  152. package/chunks/{contextCommand-2PIEU37Z.js → contextCommand-4Z7T7TUM.js} +40 -36
  153. package/chunks/{core-runtime-3XEYLQFK.js → core-runtime-6N4EFC2Q.js} +38 -34
  154. package/chunks/{create-sub-session-SBYUMSSS.js → create-sub-session-62YZWVAY.js} +2 -2
  155. package/chunks/{create-sub-session-R76FVXCI.js → create-sub-session-AEREHZBQ.js} +38 -34
  156. package/chunks/{cron-create-2QK6TCEC.js → cron-create-6E7GIQTG.js} +4 -4
  157. package/chunks/{cron-delete-FDCDFYMG.js → cron-delete-JD26XY3W.js} +4 -4
  158. package/chunks/{cron-list-XN3WVBTP.js → cron-list-CUWFB44G.js} +4 -4
  159. package/chunks/{daemon-Q2AB5Z23.js → daemon-PCNCI5YU.js} +72 -3
  160. package/chunks/{daemon-status-provider-3XJI6CAL.js → daemon-status-provider-DDF7C5M7.js} +46 -42
  161. package/chunks/{daemon-trust-policy-ILUDTLHD.js → daemon-trust-policy-Q4KSOJTR.js} +43 -39
  162. package/chunks/{daemon-trust-policy-monitor-HS3PKKRO.js → daemon-trust-policy-monitor-V6FTE3IY.js} +43 -39
  163. package/chunks/{deferred-core-runtime-X4QV662U.js → deferred-core-runtime-GHJ5GQHK.js} +38 -34
  164. package/chunks/{dist-BSTVRPMT.js → dist-26BIMQT6.js} +276 -16
  165. package/chunks/{dist-SV7Q3AWJ.js → dist-2PERFI23.js} +12 -9
  166. package/chunks/{dist-DOLYHMXE.js → dist-OAOC5OV4.js} +2 -2
  167. package/chunks/{dist-YGBBMK3Z.js → dist-PVEAFLHY.js} +5 -4
  168. package/chunks/{dist-HVRQ2CFL.js → dist-SL2LUMML.js} +1180 -5
  169. package/chunks/dist-ULIG4M5H.js +13415 -0
  170. package/chunks/{dist-IXQEQWRG.js → dist-WGMNT3JQ.js} +1 -1
  171. package/chunks/{dist-SSU66DM4.js → dist-ZHXOBXDN.js} +1 -1
  172. package/chunks/{earlyInputCapture-XKLZT7ZD.js → earlyInputCapture-TQXLLISD.js} +39 -35
  173. package/chunks/{edit-HHGIOTQ2.js → edit-FJEUV6KZ.js} +38 -34
  174. package/chunks/{enter-worktree-ZN7PUQ46.js → enter-worktree-7GE3TZ4P.js} +38 -34
  175. package/chunks/{enterPlanMode-EIFIDSIV.js → enterPlanMode-KR5TMPCJ.js} +38 -34
  176. package/chunks/{environment-XXQ75D2Q.js → environment-SWL3CMB3.js} +40 -36
  177. package/chunks/{errors-4GMVU7CK.js → errors-XQE7BGZV.js} +40 -36
  178. package/chunks/{exit-worktree-GXMI4ATY.js → exit-worktree-CHKTYNCV.js} +38 -34
  179. package/chunks/{exitPlanMode-34UVY7M6.js → exitPlanMode-QYAG6LWX.js} +38 -34
  180. package/chunks/{fast-path-VPIVA7L6.js → fast-path-Z2K7W6DC.js} +2 -2
  181. package/chunks/{gemini-4BWIK4WD.js → gemini-YU4XKEDG.js} +91 -87
  182. package/chunks/{geminiContentGenerator-3XVV5MSS.js → geminiContentGenerator-ZZX6NBO4.js} +6 -6
  183. package/chunks/{glob-TZ2ABCJG.js → glob-VYF5CXSX.js} +38 -34
  184. package/chunks/goal-tools-HGO6VXPB.js +335 -0
  185. package/chunks/{grep-BEF463NA.js → grep-5DP5ZUTW.js} +38 -34
  186. package/chunks/{handleAutoUpdate-L6ERF36Y.js → handleAutoUpdate-UVBJ56DL.js} +42 -38
  187. package/chunks/{i18n-FMM5FDXR.js → i18n-UQNYHEUD.js} +39 -35
  188. package/chunks/{image-gen-HHVLF7HS.js → image-gen-WHPIZNWF.js} +9 -9
  189. package/chunks/{initializer-625TIAIO.js → initializer-GMIICF4W.js} +44 -40
  190. package/chunks/{installationInfo-6AM4I2Y3.js → installationInfo-4MGG4WVI.js} +39 -35
  191. package/chunks/{keychain-token-storage-72IYCAZV.js → keychain-token-storage-IKO4G53C.js} +2 -2
  192. package/chunks/list-CPN2W334.js +92 -0
  193. package/chunks/{list-agents-R6KDXQR3.js → list-agents-PXJ7ZUFB.js} +2 -2
  194. package/chunks/{loadedSettingsAdapter-SPUTNKAV.js → loadedSettingsAdapter-ZQAV5NDO.js} +43 -39
  195. package/chunks/{loggingContentGenerator-LKOF7XI7.js → loggingContentGenerator-5E7W4IEP.js} +18 -18
  196. package/chunks/{loop-wakeup-3IQKCYAH.js → loop-wakeup-Y26NQZ5I.js} +13 -6
  197. package/chunks/{ls-DKZ37A7N.js → ls-ONQTTMQR.js} +4 -4
  198. package/chunks/{lsp-QNWN7KN3.js → lsp-YGHHRGMD.js} +2 -2
  199. package/chunks/{managed-npm-update-ACQGGIN5.js → managed-npm-update-MKKAXYXA.js} +39 -35
  200. package/chunks/{mcp-SZLHKFJW.js → mcp-V5NTJF6X.js} +43 -39
  201. package/chunks/{monitor-DF52UVHI.js → monitor-CO3ASY6E.js} +38 -34
  202. package/chunks/nonInteractiveCli-ZJYEOO7U.js +148 -0
  203. package/chunks/{notebook-edit-FCWS4XVN.js → notebook-edit-Z7AEE6FM.js} +38 -34
  204. package/chunks/{openaiContentGenerator-7LDK3DCJ.js → openaiContentGenerator-CA3MQOP3.js} +19 -19
  205. package/chunks/{pidfile-6ERW3DF4.js → pidfile-NL7MKDRU.js} +39 -35
  206. package/chunks/{processUtils-COKZAMUP.js → processUtils-PB5K2DYH.js} +2 -2
  207. package/chunks/{qwenContentGenerator-TKWUMR7N.js → qwenContentGenerator-JYFNDCOS.js} +44 -40
  208. package/chunks/{qwenOAuth2-7HMU47SF.js → qwenOAuth2-W2ALKQDD.js} +8 -8
  209. package/chunks/{read-file-X6DRC574.js → read-file-IEOR5H5W.js} +11 -11
  210. package/chunks/{read-mcp-resource-GFTWYXMK.js → read-mcp-resource-U2IJN5HM.js} +2 -2
  211. package/chunks/record-artifact-MGPJ7EG4.js +21 -0
  212. package/chunks/{resumeHistoryUtils-PFPM2GWM.js → resumeHistoryUtils-BNBTP5AS.js} +44 -40
  213. package/chunks/{ripGrep-OWV2IVJC.js → ripGrep-UMQODKEB.js} +38 -34
  214. package/chunks/{run-qwen-serve-TSTCO4XE.js → run-qwen-serve-RN2R6QQW.js} +116 -65
  215. package/chunks/{runtime-DAUPSUKI.js → runtime-QFJ2MJF5.js} +48 -44
  216. package/chunks/{scheduler-KMADMT26.js → scheduler-AMYUFOZI.js} +38 -34
  217. package/chunks/{sdk-exporters-http-WO556XNU.js → sdk-exporters-http-4BQANSJ6.js} +3 -3
  218. package/chunks/{sdk-impl-LPAVACSF.js → sdk-impl-Z4VXWVFX.js} +3 -3
  219. package/chunks/{send-message-SAWK4DZX.js → send-message-PMP4ATVM.js} +6 -11
  220. package/chunks/{serve-NNRWS6F4.js → serve-EIIYJVX3.js} +43 -39
  221. package/chunks/{server-WEH7DVCH.js → server-EP2LLAPD.js} +1768 -712
  222. package/chunks/{session-WXC56V2I.js → session-GMPZBLOW.js} +83 -79
  223. package/chunks/{settings-DJDXFDZ3.js → settings-LN7RNKBS.js} +47 -43
  224. package/chunks/{shell-JN5VRQXD.js → shell-EM2OWU5X.js} +38 -34
  225. package/chunks/{skill-SGXPKJCS.js → skill-T5VPSK73.js} +17 -16
  226. package/chunks/{skill-settings-VJ5PDMZI.js → skill-settings-GMR3GMNY.js} +42 -38
  227. package/chunks/{spawnChannel-ETMJW7YX.js → spawnChannel-YPCU62DI.js} +40 -36
  228. package/chunks/{standalone-update-MK3Z7KBI.js → standalone-update-JAKIM2NF.js} +40 -36
  229. package/chunks/{startInteractiveUI-ZCGIXPGT.js → startInteractiveUI-YETQWGYF.js} +774 -779
  230. package/chunks/{syntheticOutput-355CB6CJ.js → syntheticOutput-D7E6ZFKR.js} +3 -3
  231. package/chunks/{task-create-INGWNUG4.js → task-create-NFCYD43L.js} +10 -9
  232. package/chunks/{task-list-5XNNGTF4.js → task-list-TAVMGEVD.js} +5 -5
  233. package/chunks/{task-stop-4ROAOBXH.js → task-stop-ZDF2UJRM.js} +2 -2
  234. package/chunks/{task-update-CRK5VWWZ.js → task-update-6L7LHGEX.js} +10 -9
  235. package/chunks/{team-create-QQGAJG7P.js → team-create-LFJ6HGNY.js} +38 -34
  236. package/chunks/{team-delete-S2RCXA4P.js → team-delete-DPGGRQBU.js} +5 -5
  237. package/chunks/{team-plan-approval-RT7Q5R6O.js → team-plan-approval-C2KLSDGO.js} +38 -34
  238. package/chunks/{theme-manager-EEWIQJ7J.js → theme-manager-JQ3ZGBP5.js} +39 -35
  239. package/chunks/{todoWrite-7WM3VDMY.js → todoWrite-2UO5G6G6.js} +32 -4
  240. package/chunks/{tool-search-Z3Z4AYKP.js → tool-search-FAZBFRJZ.js} +15 -14
  241. package/chunks/{total-session-admission-44JKRWQD.js → total-session-admission-5CALIVYO.js} +42 -38
  242. package/chunks/{trustedFolders-X2JEIO57.js → trustedFolders-KOPSP44S.js} +39 -35
  243. package/chunks/{update-relaunch-VWNPYDIP.js → update-relaunch-6QL2TICS.js} +5 -5
  244. package/chunks/{updateCheck-KAQH67DV.js → updateCheck-4Q6RIKFW.js} +41 -37
  245. package/chunks/{useAutoAcceptIndicator-JH6BCF7S.js → useAutoAcceptIndicator-Q5BMKZV3.js} +47 -43
  246. package/chunks/{validateNonInterActiveAuth-GIUJ2UFS.js → validateNonInterActiveAuth-GKOC5F6Z.js} +79 -75
  247. package/chunks/{version-BGLYIJUY.js → version-VSATY2LD.js} +1 -1
  248. package/chunks/{web-fetch-OTDU4VQF.js → web-fetch-JCLKL6NL.js} +14 -14
  249. package/chunks/{web-search-FP6SIHPR.js → web-search-DSQTFUBX.js} +8 -8
  250. package/chunks/{workflow-YCIVBYSB.js → workflow-M6QAVKVJ.js} +41 -37
  251. package/chunks/workspace-providers-status-YKLTLMJA.js +89 -0
  252. package/chunks/{workspace-registration-store-OTMS3H4C.js → workspace-registration-store-5DMGKU64.js} +1 -1
  253. package/chunks/{workspace-registry-O63R6IZ4.js → workspace-registry-PTYUSYXX.js} +42 -38
  254. package/chunks/{workspace-service-M6LLHKJ5.js → workspace-service-25ML3T47.js} +48 -44
  255. package/chunks/{workspace-skills-status-C2V7BAIS.js → workspace-skills-status-YKZWOYRX.js} +44 -40
  256. package/chunks/{workspace-trust-reconciler-IBUPOUJN.js → workspace-trust-reconciler-5FI2S3OS.js} +47 -43
  257. package/chunks/write-file-AY7VLP5X.js +78 -0
  258. package/chunks/zoom-image-S4LJZMD5.js +224 -0
  259. package/cli.js +50 -16
  260. package/package.json +3 -3
  261. package/web-shell/assets/{arc-75-Wdeo3.js → arc-xjArKHU2.js} +1 -1
  262. package/web-shell/assets/{architectureDiagram-3BPJPVTR-FKeXQbyP.js → architectureDiagram-3BPJPVTR-BgrQDNYG.js} +1 -1
  263. package/web-shell/assets/{blockDiagram-GPEHLZMM-CY0vc-A3.js → blockDiagram-GPEHLZMM-CXxWC-1_.js} +1 -1
  264. package/web-shell/assets/{c4Diagram-AAUBKEIU-CNP-A-8u.js → c4Diagram-AAUBKEIU-Dx1tLm3v.js} +1 -1
  265. package/web-shell/assets/channel-B1cyk94G.js +1 -0
  266. package/web-shell/assets/{chunk-2J33WTMH-GybS4Gii.js → chunk-2J33WTMH-CBxjogVR.js} +1 -1
  267. package/web-shell/assets/{chunk-4BX2VUAB-02H91V8v.js → chunk-4BX2VUAB-izb-rY5W.js} +1 -1
  268. package/web-shell/assets/{chunk-55IACEB6-D3M-2VT6.js → chunk-55IACEB6-NzLyvSb8.js} +1 -1
  269. package/web-shell/assets/{chunk-727SXJPM-CCu29u4H.js → chunk-727SXJPM-DVyKb0dl.js} +1 -1
  270. package/web-shell/assets/{chunk-AQP2D5EJ-CaFKWgrn.js → chunk-AQP2D5EJ-BtqL7NzB.js} +1 -1
  271. package/web-shell/assets/{chunk-FMBD7UC4-ZZpPqIwQ.js → chunk-FMBD7UC4-iNpdKIO0.js} +1 -1
  272. package/web-shell/assets/{chunk-ND2GUHAM-D22DqGs8.js → chunk-ND2GUHAM-DI7cbFmX.js} +1 -1
  273. package/web-shell/assets/{chunk-QZHKN3VN-Bu85S0fw.js → chunk-QZHKN3VN-3Y_-xFYs.js} +1 -1
  274. package/web-shell/assets/classDiagram-4FO5ZUOK-BpBYZoRE.js +1 -0
  275. package/web-shell/assets/classDiagram-v2-Q7XG4LA2-BpBYZoRE.js +1 -0
  276. package/web-shell/assets/{cose-bilkent-S5V4N54A-f1CK1Gwe.js → cose-bilkent-S5V4N54A--raRatZn.js} +1 -1
  277. package/web-shell/assets/{dagre-BM42HDAG-D0Ow8F_n.js → dagre-BM42HDAG-B8SU70mO.js} +1 -1
  278. package/web-shell/assets/{diagram-2AECGRRQ-BPrmTWp8.js → diagram-2AECGRRQ-ewgoakXo.js} +1 -1
  279. package/web-shell/assets/{diagram-5GNKFQAL-HccuFAzy.js → diagram-5GNKFQAL-Bm_JLTnS.js} +1 -1
  280. package/web-shell/assets/{diagram-KO2AKTUF-BrS76mbA.js → diagram-KO2AKTUF-DEIUjUy9.js} +1 -1
  281. package/web-shell/assets/{diagram-LMA3HP47-V7T9lU-5.js → diagram-LMA3HP47-C2Wmrpj-.js} +1 -1
  282. package/web-shell/assets/{diagram-OG6HWLK6-DKidyJMR.js → diagram-OG6HWLK6-CtYe6bFx.js} +1 -1
  283. package/web-shell/assets/{erDiagram-TEJ5UH35-DBadZIkp.js → erDiagram-TEJ5UH35-DfpHcWLV.js} +1 -1
  284. package/web-shell/assets/{flowDiagram-I6XJVG4X-BymfqdNJ.js → flowDiagram-I6XJVG4X-CAiUhio5.js} +1 -1
  285. package/web-shell/assets/{ganttDiagram-6RSMTGT7-DOw340jf.js → ganttDiagram-6RSMTGT7-CYc7ezr4.js} +1 -1
  286. package/web-shell/assets/{gitGraphDiagram-PVQCEYII-_8EiD8sl.js → gitGraphDiagram-PVQCEYII-70lbkcRS.js} +1 -1
  287. package/web-shell/assets/index-C1k3PDuU.css +5 -0
  288. package/web-shell/assets/index-C2GE3DAF.js +74 -0
  289. package/web-shell/assets/index-DZLIXILO.js +1750 -0
  290. package/web-shell/assets/{index-CKIadvET.js → index-Ww86nT9f.js} +1 -1
  291. package/web-shell/assets/{infoDiagram-5YYISTIA-D61KYQBu.js → infoDiagram-5YYISTIA-C7e8DWPa.js} +1 -1
  292. package/web-shell/assets/{ishikawaDiagram-YF4QCWOH-CsiXSpNx.js → ishikawaDiagram-YF4QCWOH-BYLr2op-.js} +1 -1
  293. package/web-shell/assets/{journeyDiagram-JHISSGLW-Sdfionyh.js → journeyDiagram-JHISSGLW-hEibAHKX.js} +1 -1
  294. package/web-shell/assets/{kanban-definition-UN3LZRKU-C3WI3Cnl.js → kanban-definition-UN3LZRKU-F2rt8Uhp.js} +1 -1
  295. package/web-shell/assets/{linear-Dpigcc62.js → linear-DPhyNezd.js} +1 -1
  296. package/web-shell/assets/{mermaid.core-Ct97pqgW.js → mermaid.core-ZUtnug0n.js} +5 -5
  297. package/web-shell/assets/{mindmap-definition-RKZ34NQL-BzeaN0rB.js → mindmap-definition-RKZ34NQL-DDWcMoi8.js} +1 -1
  298. package/web-shell/assets/{pieDiagram-4H26LBE5-CvjgcbVD.js → pieDiagram-4H26LBE5-CTRKzw1_.js} +1 -1
  299. package/web-shell/assets/{quadrantDiagram-W4KKPZXB-BUzgTNdH.js → quadrantDiagram-W4KKPZXB-CAEwYG_z.js} +1 -1
  300. package/web-shell/assets/{requirementDiagram-4Y6WPE33-B7zKlgUQ.js → requirementDiagram-4Y6WPE33-CRjnH9D9.js} +1 -1
  301. package/web-shell/assets/{sankeyDiagram-5OEKKPKP-Bb9CQgrT.js → sankeyDiagram-5OEKKPKP-LPQT_sOd.js} +1 -1
  302. package/web-shell/assets/{sequenceDiagram-3UESZ5HK-DJ6V7itG.js → sequenceDiagram-3UESZ5HK-Ht2Iqvb0.js} +1 -1
  303. package/web-shell/assets/{stateDiagram-AJRCARHV-IImflERY.js → stateDiagram-AJRCARHV-CIUdqOXu.js} +1 -1
  304. package/web-shell/assets/stateDiagram-v2-BHNVJYJU-BmqqQZ6w.js +1 -0
  305. package/web-shell/assets/{timeline-definition-PNZ67QCA-6Q_uWHKh.js → timeline-definition-PNZ67QCA-BcilneZF.js} +1 -1
  306. package/web-shell/assets/{vennDiagram-CIIHVFJN-TmyKyjwv.js → vennDiagram-CIIHVFJN-BljwiiH1.js} +1 -1
  307. package/web-shell/assets/{wardley-L42UT6IY-CRh9uiPv.js → wardley-L42UT6IY-DeKjkYjq.js} +1 -1
  308. package/web-shell/assets/{wardleyDiagram-YWT4CUSO-59TKAW8w.js → wardleyDiagram-YWT4CUSO-L3U1H7KG.js} +1 -1
  309. package/web-shell/assets/{xychartDiagram-2RQKCTM6-GCSUIK2L.js → xychartDiagram-2RQKCTM6-IJnWsgMT.js} +1 -1
  310. package/web-shell/index.html +2 -2
  311. package/chunks/list-L2GA674Y.js +0 -88
  312. package/chunks/nonInteractiveCli-5T7KYKLK.js +0 -144
  313. package/chunks/workspace-providers-status-S35YAIUS.js +0 -85
  314. package/chunks/write-file-3BZC3EAE.js +0 -72
  315. package/chunks/zoom-image-TZ6S2O57.js +0 -351
  316. package/web-shell/assets/channel-DPYMT76A.js +0 -1
  317. package/web-shell/assets/classDiagram-4FO5ZUOK--JstsIgL.js +0 -1
  318. package/web-shell/assets/classDiagram-v2-Q7XG4LA2--JstsIgL.js +0 -1
  319. package/web-shell/assets/index-D1eXNRHe.js +0 -1389
  320. package/web-shell/assets/index-DVLD4CQq.css +0 -5
  321. package/web-shell/assets/stateDiagram-v2-BHNVJYJU-CYI_YoNR.js +0 -1
@@ -5,20 +5,20 @@ import {
5
5
  } from "./chunk-VGC4I5JJ.js";
6
6
  import {
7
7
  isAnyAutoMemPath
8
- } from "./chunk-SGFT55XI.js";
8
+ } from "./chunk-3I6DUGQD.js";
9
9
  import {
10
10
  STRUCTURED_OUTPUT_REDACTED_ARGS
11
- } from "./chunk-Y4IHBGBP.js";
11
+ } from "./chunk-7ULQIS27.js";
12
12
  import {
13
13
  BaseDeclarativeTool,
14
14
  BaseToolInvocation,
15
15
  SchemaValidator,
16
16
  ToolDisplayNames,
17
17
  ToolNames
18
- } from "./chunk-Y6AXW2OG.js";
18
+ } from "./chunk-MM7TH7ZM.js";
19
19
  import {
20
20
  DEFAULT_QWEN_MODEL
21
- } from "./chunk-VCPIZRYH.js";
21
+ } from "./chunk-HIVKI6O6.js";
22
22
  import {
23
23
  estimateTextTokens,
24
24
  generateLegacyMcpToolName,
@@ -29,10 +29,10 @@ import {
29
29
  } from "./chunk-ZBVS26BY.js";
30
30
  import {
31
31
  InstallationManager
32
- } from "./chunk-A3NDJ5SB.js";
32
+ } from "./chunk-R2XWGR75.js";
33
33
  import {
34
34
  atomicWriteFile
35
- } from "./chunk-7XATOOE7.js";
35
+ } from "./chunk-HC45LTEN.js";
36
36
  import {
37
37
  isTelemetrySdkInitialized,
38
38
  recordApiErrorMetrics,
@@ -53,7 +53,7 @@ import {
53
53
  recordSubagentExecutionMetrics,
54
54
  recordTokenUsageMetrics,
55
55
  recordToolCallMetrics
56
- } from "./chunk-BGTQCTQW.js";
56
+ } from "./chunk-QARJNL2V.js";
57
57
  import {
58
58
  require_src,
59
59
  safeJsonStringify
@@ -89,6 +89,7 @@ import {
89
89
  EVENT_PROMPT_SUGGESTION,
90
90
  EVENT_PROTOCOL_TAG_SANITIZED,
91
91
  EVENT_RIPGREP_FALLBACK,
92
+ EVENT_RIPGREP_RUNTIME_RECOVERY,
92
93
  EVENT_SKILL_LAUNCH,
93
94
  EVENT_SLASH_COMMAND,
94
95
  EVENT_SPECULATION,
@@ -101,7 +102,7 @@ import {
101
102
  EVENT_WORKFLOW_KEYWORD,
102
103
  EVENT_WORKFLOW_RUN,
103
104
  SERVICE_NAME
104
- } from "./chunk-S7W2GKIO.js";
105
+ } from "./chunk-G7XXKQYS.js";
105
106
  import {
106
107
  Storage,
107
108
  createDebugLogger,
@@ -112,7 +113,7 @@ import {
112
113
  makeRelative,
113
114
  shortenPath,
114
115
  unescapePath
115
- } from "./chunk-UHUSJ6X7.js";
116
+ } from "./chunk-E2BHWIDT.js";
116
117
  import {
117
118
  SemanticAttributes,
118
119
  init_esm
@@ -5813,10 +5814,10 @@ var require_lib = __commonJS({
5813
5814
  exports.analyse = analyse;
5814
5815
  var detectFile = /* @__PURE__ */ __name((filepath, opts = {}) => new Promise((resolve, reject) => {
5815
5816
  let fd;
5816
- const fs7 = (0, node_1.default)();
5817
+ const fs8 = (0, node_1.default)();
5817
5818
  const handler = /* @__PURE__ */ __name((err, buffer) => {
5818
5819
  if (fd) {
5819
- fs7.closeSync(fd);
5820
+ fs8.closeSync(fd);
5820
5821
  }
5821
5822
  if (err) {
5822
5823
  reject(err);
@@ -5825,26 +5826,26 @@ var require_lib = __commonJS({
5825
5826
  }
5826
5827
  }, "handler");
5827
5828
  if (opts && opts.sampleSize) {
5828
- fd = fs7.openSync(filepath, "r");
5829
+ fd = fs8.openSync(filepath, "r");
5829
5830
  const sample = Buffer.allocUnsafe(opts.sampleSize);
5830
- fs7.read(fd, sample, 0, opts.sampleSize, opts.offset, (err) => {
5831
+ fs8.read(fd, sample, 0, opts.sampleSize, opts.offset, (err) => {
5831
5832
  handler(err, sample);
5832
5833
  });
5833
5834
  return;
5834
5835
  }
5835
- fs7.readFile(filepath, handler);
5836
+ fs8.readFile(filepath, handler);
5836
5837
  }), "detectFile");
5837
5838
  exports.detectFile = detectFile;
5838
5839
  var detectFileSync = /* @__PURE__ */ __name((filepath, opts = {}) => {
5839
- const fs7 = (0, node_1.default)();
5840
+ const fs8 = (0, node_1.default)();
5840
5841
  if (opts && opts.sampleSize) {
5841
- const fd = fs7.openSync(filepath, "r");
5842
+ const fd = fs8.openSync(filepath, "r");
5842
5843
  const sample = Buffer.allocUnsafe(opts.sampleSize);
5843
- fs7.readSync(fd, sample, 0, opts.sampleSize, opts.offset);
5844
- fs7.closeSync(fd);
5844
+ fs8.readSync(fd, sample, 0, opts.sampleSize, opts.offset);
5845
+ fs8.closeSync(fd);
5845
5846
  return (0, exports.detect)(sample);
5846
5847
  }
5847
- return (0, exports.detect)(fs7.readFileSync(filepath));
5848
+ return (0, exports.detect)(fs8.readFileSync(filepath));
5848
5849
  }, "detectFileSync");
5849
5850
  exports.detectFileSync = detectFileSync;
5850
5851
  exports.default = {
@@ -7395,11 +7396,11 @@ var require_lru_cache = __commonJS({
7395
7396
  // packages/core/src/tools/read-file.ts
7396
7397
  init_esbuild_shims();
7397
7398
  import path9 from "node:path";
7398
- import fs6 from "node:fs/promises";
7399
+ import fs7 from "node:fs/promises";
7399
7400
 
7400
7401
  // packages/core/src/utils/fileUtils.ts
7401
7402
  init_esbuild_shims();
7402
- import fs2 from "node:fs";
7403
+ import fs3 from "node:fs";
7403
7404
  import fsPromises from "node:fs/promises";
7404
7405
  import path2 from "node:path";
7405
7406
 
@@ -8862,6 +8863,19 @@ var TEXT_RANGE_FAST_PATH_MAX_SIZE = 10 * 1024 * 1024;
8862
8863
  var DEFAULT_RANGE_READ_BYTES = 25e3;
8863
8864
 
8864
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
+ };
8865
8879
  var LargeNonUtf8TextError = class extends Error {
8866
8880
  constructor(encoding, reason) {
8867
8881
  super(
@@ -8875,11 +8889,25 @@ var LargeNonUtf8TextError = class extends Error {
8875
8889
  __name(this, "LargeNonUtf8TextError");
8876
8890
  }
8877
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
+ };
8878
8905
  async function readTextRange(request2) {
8879
8906
  request2.signal?.throwIfAborted();
8880
8907
  const stats = request2.stats ?? await stat(request2.path);
8881
8908
  const maxOutputBytes = normalizeMaxBytes(request2.maxOutputBytes);
8882
- 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) {
8883
8911
  const { content, encoding, bom } = await readFileWithEncodingInfo(
8884
8912
  request2.path,
8885
8913
  request2.signal
@@ -8898,9 +8926,193 @@ async function readTextRange(request2) {
8898
8926
  lineEnding: detectLineEndingFromContent(content)
8899
8927
  };
8900
8928
  }
8901
- return readLargeUtf8Range(request2, maxOutputBytes);
8929
+ return readLargeUtf8Range(
8930
+ request2.path,
8931
+ request2,
8932
+ maxOutputBytes,
8933
+ maxScanBytes,
8934
+ stats.size
8935
+ );
8902
8936
  }
8903
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");
8904
9116
  function normalizeMaxBytes(maxOutputBytes) {
8905
9117
  if (maxOutputBytes === Number.POSITIVE_INFINITY) {
8906
9118
  return Number.POSITIVE_INFINITY;
@@ -8926,8 +9138,9 @@ function sliceDecodedContent(content, offset, limit, maxOutputBytes) {
8926
9138
  };
8927
9139
  }
8928
9140
  __name(sliceDecodedContent, "sliceDecodedContent");
8929
- async function readLargeUtf8Range(request2, maxOutputBytes) {
8930
- 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();
8931
9144
  if (!isUtf8CompatibleEncoding(encoding)) {
8932
9145
  throw new LargeNonUtf8TextError(encoding);
8933
9146
  }
@@ -8943,14 +9156,31 @@ async function readLargeUtf8Range(request2, maxOutputBytes) {
8943
9156
  let previousChunkEndedWithCR = false;
8944
9157
  let originalLineCountExact = true;
8945
9158
  let stoppedEarly = false;
9159
+ let scannedBytes = 0;
9160
+ let consumedBytes = 0;
8946
9161
  const decoder = new TextDecoder2("utf-8", {
8947
9162
  fatal: true,
8948
9163
  ignoreBOM: true
8949
9164
  });
8950
- const stream = createReadStream(request2.path, {
8951
- highWaterMark: 512 * 1024,
8952
- signal: request2.signal
8953
- });
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
+ }
8954
9184
  function appendSelected(fragment) {
8955
9185
  if (fragment.length === 0 || truncatedByBytes) {
8956
9186
  return;
@@ -8981,17 +9211,19 @@ async function readLargeUtf8Range(request2, maxOutputBytes) {
8981
9211
  }
8982
9212
  __name(decodeUtf8Chunk, "decodeUtf8Chunk");
8983
9213
  try {
8984
- for await (const rawChunk of stream) {
9214
+ for await (const rawChunk of chunks) {
8985
9215
  request2.signal?.throwIfAborted();
9216
+ scannedBytes += rawChunk.length;
8986
9217
  let chunk = decodeUtf8Chunk(rawChunk, { stream: true });
8987
9218
  if (firstChunk) {
8988
9219
  firstChunk = false;
8989
9220
  if (chunk.charCodeAt(0) === 65279) {
8990
9221
  chunk = chunk.slice(1);
8991
9222
  bom = true;
9223
+ consumedBytes += 3;
8992
9224
  }
8993
9225
  }
8994
- if (previousChunkEndedWithCR && chunk.startsWith("\n") || chunk.includes("\r\n")) {
9226
+ if (isSelectedLine() && previousChunkEndedWithCR && chunk.startsWith("\n")) {
8995
9227
  lineEnding = "crlf";
8996
9228
  }
8997
9229
  previousChunkEndedWithCR = chunk.endsWith("\r");
@@ -8999,11 +9231,14 @@ async function readLargeUtf8Range(request2, maxOutputBytes) {
8999
9231
  let newline = chunk.indexOf("\n", start);
9000
9232
  while (newline !== -1) {
9001
9233
  if (isSelectedLine()) {
9002
- appendSelected(chunk.slice(start, newline));
9234
+ const fragment = chunk.slice(start, newline);
9235
+ if (fragment.endsWith("\r")) lineEnding = "crlf";
9236
+ appendSelected(fragment);
9003
9237
  if (currentLine + 1 < endLine) {
9004
9238
  appendSelected("\n");
9005
9239
  }
9006
9240
  }
9241
+ consumedBytes += Buffer.byteLength(chunk.slice(start, newline), "utf8") + 1;
9007
9242
  currentLine++;
9008
9243
  start = newline + 1;
9009
9244
  if (currentLine >= endLine || truncatedByBytes) {
@@ -9013,8 +9248,12 @@ async function readLargeUtf8Range(request2, maxOutputBytes) {
9013
9248
  }
9014
9249
  newline = chunk.indexOf("\n", start);
9015
9250
  }
9016
- if (start < chunk.length && isSelectedLine()) {
9017
- 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");
9018
9257
  }
9019
9258
  if (currentLine >= endLine || truncatedByBytes) {
9020
9259
  originalLineCountExact = false;
@@ -9023,7 +9262,13 @@ async function readLargeUtf8Range(request2, maxOutputBytes) {
9023
9262
  }
9024
9263
  }
9025
9264
  } finally {
9026
- 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);
9027
9272
  }
9028
9273
  if (!stoppedEarly) {
9029
9274
  decodeUtf8Chunk();
@@ -9031,6 +9276,7 @@ async function readLargeUtf8Range(request2, maxOutputBytes) {
9031
9276
  return {
9032
9277
  content: output,
9033
9278
  originalLineCount: currentLine + 1,
9279
+ ...stoppedEarly && !truncatedByBytes && consumedBytes < (sourceSize ?? Number.POSITIVE_INFINITY) ? { nextByteOffset: consumedBytes } : {},
9034
9280
  encoding: "utf-8",
9035
9281
  bom,
9036
9282
  lineEnding,
@@ -9039,6 +9285,26 @@ async function readLargeUtf8Range(request2, maxOutputBytes) {
9039
9285
  };
9040
9286
  }
9041
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");
9042
9308
  function truncateUtf8(content, maxBytes) {
9043
9309
  const bytes = Buffer.byteLength(content, "utf8");
9044
9310
  if (bytes <= maxBytes) {
@@ -9063,8 +9329,234 @@ function detectLineEndingFromContent(content) {
9063
9329
  }
9064
9330
  __name(detectLineEndingFromContent, "detectLineEndingFromContent");
9065
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
+
9066
9553
  // packages/core/src/utils/fileUtils.ts
9067
9554
  var debugLogger2 = createDebugLogger("FILE_UTILS");
9555
+ var CANONICAL_IMAGE_MIME_TYPES = /* @__PURE__ */ new Set([
9556
+ "image/jpeg",
9557
+ "image/png",
9558
+ "image/webp"
9559
+ ]);
9068
9560
  var PDF_FULL_TEXT_EXTRACTION_MAX_MB = 100;
9069
9561
  var PDF_PAGED_TEXT_EXTRACTION_MAX_MB = 512;
9070
9562
  function detectBOM(buf) {
@@ -9196,7 +9688,7 @@ function bomEncodingToName(bomEncoding) {
9196
9688
  }
9197
9689
  __name(bomEncodingToName, "bomEncodingToName");
9198
9690
  async function readFileWithEncodingInfo(filePath, signal) {
9199
- const full = await fs2.promises.readFile(
9691
+ const full = await fs3.promises.readFile(
9200
9692
  filePath,
9201
9693
  signal === void 0 ? void 0 : { signal }
9202
9694
  );
@@ -9215,7 +9707,7 @@ async function countFileLines(filePath) {
9215
9707
  __name(countFileLines, "countFileLines");
9216
9708
  async function readFileWithLineAndLimit(params) {
9217
9709
  const { path: filePath, limit, line, maxOutputBytes, signal } = params;
9218
- const stats = params.stats ?? await fs2.promises.stat(filePath);
9710
+ const stats = params.stats ?? await fs3.promises.stat(filePath);
9219
9711
  if (line !== void 0 && line > 0 || Number.isFinite(limit) || maxOutputBytes !== void 0) {
9220
9712
  return readTextRange({
9221
9713
  path: filePath,
@@ -9247,10 +9739,10 @@ async function readFileWithLineAndLimit(params) {
9247
9739
  };
9248
9740
  }
9249
9741
  __name(readFileWithLineAndLimit, "readFileWithLineAndLimit");
9250
- async function detectFileEncoding(filePath) {
9251
- let fh = null;
9742
+ async function detectFileEncoding(source) {
9743
+ let opened = null;
9252
9744
  try {
9253
- fh = await fs2.promises.open(filePath, "r");
9745
+ const fh = typeof source === "string" ? opened = await fs3.promises.open(source, "r") : source;
9254
9746
  const stats = await fh.stat();
9255
9747
  if (stats.size === 0) return "utf-8";
9256
9748
  const sampleSize = Math.min(8192, stats.size);
@@ -9259,22 +9751,7 @@ async function detectFileEncoding(filePath) {
9259
9751
  if (bytesRead === 0) return "utf-8";
9260
9752
  const sample = buf.subarray(0, bytesRead);
9261
9753
  const bom = detectBOM(sample);
9262
- if (bom) {
9263
- switch (bom.encoding) {
9264
- case "utf8":
9265
- return "utf-8";
9266
- case "utf16le":
9267
- return "utf-16le";
9268
- case "utf16be":
9269
- return "utf-16be";
9270
- case "utf32le":
9271
- return "utf-32le";
9272
- case "utf32be":
9273
- return "utf-32be";
9274
- default:
9275
- return "utf-8";
9276
- }
9277
- }
9754
+ if (bom) return bomEncodingToName(bom.encoding);
9278
9755
  if (isValidUtf8(sample)) return "utf-8";
9279
9756
  const detected = detectEncodingFromBuffer(sample);
9280
9757
  if (detected && !isUtf8CompatibleEncoding(detected)) {
@@ -9284,9 +9761,9 @@ async function detectFileEncoding(filePath) {
9284
9761
  } catch {
9285
9762
  return "utf-8";
9286
9763
  } finally {
9287
- if (fh) {
9764
+ if (opened) {
9288
9765
  try {
9289
- await fh.close();
9766
+ await opened.close();
9290
9767
  } catch {
9291
9768
  }
9292
9769
  }
@@ -9308,7 +9785,7 @@ __name(isWithinRoot, "isWithinRoot");
9308
9785
  async function isBinaryFile(filePath) {
9309
9786
  let fh = null;
9310
9787
  try {
9311
- fh = await fs2.promises.open(filePath, "r");
9788
+ fh = await fs3.promises.open(filePath, "r");
9312
9789
  const stats = await fh.stat();
9313
9790
  const fileSize = stats.size;
9314
9791
  if (fileSize === 0) return false;
@@ -9601,7 +10078,7 @@ async function processSingleFileContent(filePath, config, optionsOrOffset, legac
9601
10078
  signal?.throwIfAborted();
9602
10079
  let stats;
9603
10080
  try {
9604
- stats = await fs2.promises.stat(filePath);
10081
+ stats = await fs3.promises.stat(filePath);
9605
10082
  } catch (error) {
9606
10083
  if (isNodeError(error) && error.code === "ENOENT") {
9607
10084
  return {
@@ -9630,6 +10107,8 @@ async function processSingleFileContent(filePath, config, optionsOrOffset, legac
9630
10107
  };
9631
10108
  }
9632
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);
9633
10112
  const relativePathForDisplay = path2.relative(rootDirectory, filePath).replace(/\\/g, "/");
9634
10113
  const displayName = path2.basename(filePath);
9635
10114
  const modalities = config.getContentGeneratorConfig?.()?.modalities ?? {};
@@ -9714,7 +10193,15 @@ async function processSingleFileContent(filePath, config, optionsOrOffset, legac
9714
10193
  };
9715
10194
  }
9716
10195
  }
9717
- 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) {
9718
10205
  return {
9719
10206
  llmContent: "File size exceeds the 10MB limit.",
9720
10207
  returnDisplay: "File size exceeds the 10MB limit.",
@@ -9846,10 +10333,70 @@ async function processSingleFileContent(filePath, config, optionsOrOffset, legac
9846
10333
  stats
9847
10334
  };
9848
10335
  }
9849
- 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
+ }
9850
10397
  case "audio":
9851
10398
  case "video": {
9852
- const contentBuffer = await fs2.promises.readFile(filePath);
10399
+ const contentBuffer = await fs3.promises.readFile(filePath);
9853
10400
  const base64Data = contentBuffer.toString("base64");
9854
10401
  const base64SizeInMB = base64Data.length / (1024 * 1024);
9855
10402
  if (base64SizeInMB > 9.9) {
@@ -9864,9 +10411,7 @@ async function processSingleFileContent(filePath, config, optionsOrOffset, legac
9864
10411
  llmContent: {
9865
10412
  inlineData: {
9866
10413
  data: base64Data,
9867
- mimeType: index_lite_default.getType(filePath) ?? MIME_LITE_MISSING_VIDEO_TYPES.get(
9868
- path2.extname(filePath).toLowerCase()
9869
- ) ?? "application/octet-stream",
10414
+ mimeType: mediaMimeType,
9870
10415
  displayName
9871
10416
  }
9872
10417
  },
@@ -9875,7 +10420,7 @@ async function processSingleFileContent(filePath, config, optionsOrOffset, legac
9875
10420
  }
9876
10421
  case "pdf": {
9877
10422
  if (!pageRange && modalities.pdf) {
9878
- const contentBuffer = await fs2.promises.readFile(filePath);
10423
+ const contentBuffer = await fs3.promises.readFile(filePath);
9879
10424
  const base64Data = contentBuffer.toString("base64");
9880
10425
  const base64SizeInMB = base64Data.length / (1024 * 1024);
9881
10426
  if (base64SizeInMB > 9.9) {
@@ -10142,7 +10687,7 @@ function normalizeRangeReadByteLimit(maxOutputBytes) {
10142
10687
  __name(normalizeRangeReadByteLimit, "normalizeRangeReadByteLimit");
10143
10688
  async function fileExists(filePath) {
10144
10689
  try {
10145
- await fsPromises.access(filePath, fs2.constants.F_OK);
10690
+ await fsPromises.access(filePath, fs3.constants.F_OK);
10146
10691
  return true;
10147
10692
  } catch (_) {
10148
10693
  return false;
@@ -10287,7 +10832,7 @@ var import_https_proxy_agent = __toESM(require_dist(), 1);
10287
10832
  import { Buffer as Buffer2 } from "buffer";
10288
10833
  import * as https from "https";
10289
10834
  import * as os2 from "node:os";
10290
- import fs3 from "node:fs";
10835
+ import fs4 from "node:fs";
10291
10836
  import path4 from "node:path";
10292
10837
 
10293
10838
  // packages/core/src/telemetry/sanitize.ts
@@ -10492,8 +11037,8 @@ var QwenLogger = class _QwenLogger {
10492
11037
  const legacyPath = path4.join(os2.homedir(), ".qwen", "source.json");
10493
11038
  const candidates = path4.normalize(sourceJsonPath) !== path4.normalize(legacyPath) ? [sourceJsonPath, legacyPath] : [sourceJsonPath];
10494
11039
  for (const candidate of candidates) {
10495
- if (fs3.existsSync(candidate)) {
10496
- const sourceJsonContent = fs3.readFileSync(candidate, "utf8");
11040
+ if (fs4.existsSync(candidate)) {
11041
+ const sourceJsonContent = fs4.readFileSync(candidate, "utf8");
10497
11042
  const sourceData = JSON.parse(sourceJsonContent);
10498
11043
  if (sourceData && typeof sourceData === "object" && sourceData.source && sourceData.source !== "unknown") {
10499
11044
  return sourceData.source;
@@ -10966,6 +11511,24 @@ var QwenLogger = class _QwenLogger {
10966
11511
  this.enqueueLogEvent(rumEvent);
10967
11512
  this.flushIfNeeded();
10968
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
+ }
10969
11532
  logLoopDetectionDisabledEvent() {
10970
11533
  const rumEvent = this.createActionEvent(
10971
11534
  "misc",
@@ -11545,7 +12108,7 @@ import { randomUUID } from "node:crypto";
11545
12108
 
11546
12109
  // packages/core/src/utils/jsonl-utils.ts
11547
12110
  init_esbuild_shims();
11548
- import fs4 from "node:fs";
12111
+ import fs5 from "node:fs";
11549
12112
  import path5 from "node:path";
11550
12113
  import readline from "node:readline";
11551
12114
  import { finished } from "node:stream/promises";
@@ -11637,7 +12200,7 @@ async function readLines(filePath, count) {
11637
12200
  let fileStream;
11638
12201
  let rl;
11639
12202
  try {
11640
- fileStream = fs4.createReadStream(filePath);
12203
+ fileStream = fs5.createReadStream(filePath);
11641
12204
  rl = readline.createInterface({
11642
12205
  input: fileStream,
11643
12206
  crlfDelay: Infinity
@@ -11670,7 +12233,7 @@ async function read(filePath, options = {}) {
11670
12233
  let fileStream;
11671
12234
  let rl;
11672
12235
  try {
11673
- fileStream = fs4.createReadStream(filePath);
12236
+ fileStream = fs5.createReadStream(filePath);
11674
12237
  rl = readline.createInterface({
11675
12238
  input: fileStream,
11676
12239
  crlfDelay: Infinity
@@ -11705,10 +12268,10 @@ async function writeLine(filePath, data) {
11705
12268
  `;
11706
12269
  const dir = path5.dirname(filePath);
11707
12270
  if (!ensuredDirs.has(dir)) {
11708
- await fs4.promises.mkdir(dir, { recursive: true });
12271
+ await fs5.promises.mkdir(dir, { recursive: true });
11709
12272
  ensuredDirs.add(dir);
11710
12273
  }
11711
- await fs4.promises.appendFile(filePath, Buffer.from(line, "utf8"), {
12274
+ await fs5.promises.appendFile(filePath, Buffer.from(line, "utf8"), {
11712
12275
  flush: true
11713
12276
  });
11714
12277
  });
@@ -11718,15 +12281,15 @@ function writeLineSync(filePath, data) {
11718
12281
  const line = `${JSON.stringify(data)}
11719
12282
  `;
11720
12283
  const dir = path5.dirname(filePath);
11721
- if (!fs4.existsSync(dir)) {
11722
- fs4.mkdirSync(dir, { recursive: true });
12284
+ if (!fs5.existsSync(dir)) {
12285
+ fs5.mkdirSync(dir, { recursive: true });
11723
12286
  }
11724
- fs4.appendFileSync(filePath, Buffer.from(line, "utf8"), { flush: true });
12287
+ fs5.appendFileSync(filePath, Buffer.from(line, "utf8"), { flush: true });
11725
12288
  }
11726
12289
  __name(writeLineSync, "writeLineSync");
11727
12290
  function exists(filePath) {
11728
12291
  try {
11729
- const stats = fs4.statSync(filePath);
12292
+ const stats = fs5.statSync(filePath);
11730
12293
  return stats.isFile() && stats.size > 0;
11731
12294
  } catch {
11732
12295
  return false;
@@ -12345,6 +12908,23 @@ function logRipgrepFallback(config, event) {
12345
12908
  logger.emit(logRecord);
12346
12909
  }
12347
12910
  __name(logRipgrepFallback, "logRipgrepFallback");
12911
+ function logRipgrepRuntimeRecovery(config, event) {
12912
+ QwenLogger.getInstance(config)?.logRipgrepRuntimeRecoveryEvent(event);
12913
+ if (!isTelemetrySdkInitialized()) return;
12914
+ const attributes = {
12915
+ ...getCommonAttributes(config),
12916
+ ...event,
12917
+ "event.name": EVENT_RIPGREP_RUNTIME_RECOVERY,
12918
+ "event.timestamp": (/* @__PURE__ */ new Date()).toISOString()
12919
+ };
12920
+ const logger = import_api_logs.logs.getLogger(SERVICE_NAME);
12921
+ const logRecord = {
12922
+ body: `Ripgrep runtime recovery: ${event.failure_kind}.`,
12923
+ attributes
12924
+ };
12925
+ logger.emit(logRecord);
12926
+ }
12927
+ __name(logRipgrepRuntimeRecovery, "logRipgrepRuntimeRecovery");
12348
12928
  function logApiError(config, event) {
12349
12929
  const uiEvent = {
12350
12930
  ...event,
@@ -13137,7 +13717,7 @@ init_esbuild_shims();
13137
13717
 
13138
13718
  // packages/core/src/utils/truncation.ts
13139
13719
  init_esbuild_shims();
13140
- import * as fs5 from "node:fs/promises";
13720
+ import * as fs6 from "node:fs/promises";
13141
13721
  import * as path7 from "node:path";
13142
13722
  import * as crypto from "node:crypto";
13143
13723
  var debugLogger5 = createDebugLogger("TRUNCATION");
@@ -13220,8 +13800,8 @@ ${truncatedContent}`;
13220
13800
  return { content };
13221
13801
  }
13222
13802
  try {
13223
- await fs5.mkdir(projectTempDir, { recursive: true });
13224
- await fs5.writeFile(outputFile, content, { mode: 384 });
13803
+ await fs6.mkdir(projectTempDir, { recursive: true });
13804
+ await fs6.writeFile(outputFile, content, { mode: 384 });
13225
13805
  return {
13226
13806
  content: wrappedMessage,
13227
13807
  outputFile
@@ -13371,7 +13951,7 @@ async function persistAndTruncateToolResult(callId, toolName, content, config) {
13371
13951
  try {
13372
13952
  const toolResultsDir = config.storage.getToolResultsDir();
13373
13953
  const outputFile = path7.join(toolResultsDir, `${safeCallId}.txt`);
13374
- await fs5.mkdir(toolResultsDir, { recursive: true });
13954
+ await fs6.mkdir(toolResultsDir, { recursive: true });
13375
13955
  await atomicWriteFile(outputFile, content, {
13376
13956
  mode: 384,
13377
13957
  forceMode: true,
@@ -14520,6 +15100,27 @@ var RipgrepFallbackEvent = class {
14520
15100
  this.error = error;
14521
15101
  }
14522
15102
  };
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");
@@ -15926,7 +16527,7 @@ var ReadFileToolInvocation = class extends BaseToolInvocation {
15926
16527
  const isFullRead = this.params.offset === void 0 && this.params.limit === void 0 && this.params.pages === void 0;
15927
16528
  let stats;
15928
16529
  try {
15929
- stats = await fs6.stat(absPath);
16530
+ stats = await fs7.stat(absPath);
15930
16531
  } catch (err) {
15931
16532
  debugLogger8.debug("stat-failed", {
15932
16533
  path: absPath,
@@ -15992,7 +16593,7 @@ ${result.llmContent}`;
15992
16593
  }
15993
16594
  if (typeof llmContent === "string" && isAutoMem) {
15994
16595
  try {
15995
- const memStat = stats ?? await fs6.stat(absPath);
16596
+ const memStat = stats ?? await fs7.stat(absPath);
15996
16597
  const note = memoryFreshnessNote(memStat.mtimeMs);
15997
16598
  if (note) {
15998
16599
  llmContent = note + llmContent;
@@ -16305,6 +16906,7 @@ export {
16305
16906
  logFileOperation,
16306
16907
  logApiRequest,
16307
16908
  logRipgrepFallback,
16909
+ logRipgrepRuntimeRecovery,
16308
16910
  logApiError,
16309
16911
  logApiCancel,
16310
16912
  logApiResponse,
@@ -16367,6 +16969,13 @@ export {
16367
16969
  inferInsertedCellSourceArrayStyle,
16368
16970
  toNotebookSource,
16369
16971
  normalizeEditedCell,
16972
+ CursorNotAtLineBoundaryError,
16973
+ LargeNonUtf8TextError,
16974
+ TextScanBudgetExceededError,
16975
+ readTextRangeFromHandle,
16976
+ readTextCursorWindowFromHandle,
16977
+ ImageViewError,
16978
+ renderNormalizedImageCrop,
16370
16979
  decodeBufferWithEncodingInfoAsync,
16371
16980
  readFileWithLineAndLimit,
16372
16981
  getSpecificMimeType,
@@ -16408,6 +17017,7 @@ export {
16408
17017
  ApiCancelEvent,
16409
17018
  ApiResponseEvent,
16410
17019
  RipgrepFallbackEvent,
17020
+ RipgrepRuntimeRecoveryEvent,
16411
17021
  LoopDetectedEvent,
16412
17022
  LoopDetectionDisabledEvent,
16413
17023
  NextSpeakerCheckEvent,
@@ -16459,6 +17069,11 @@ export {
16459
17069
  * Copyright 2025 Qwen Team
16460
17070
  * SPDX-License-Identifier: Apache-2.0
16461
17071
  */
17072
+ /**
17073
+ * @license
17074
+ * Copyright 2026 Qwen
17075
+ * SPDX-License-Identifier: Apache-2.0
17076
+ */
16462
17077
  /**
16463
17078
  * @license
16464
17079
  * Copyright 2025 Qwen Team