@qwen-code/qwen-code 0.21.1 → 0.21.2-nightly.20260801.bc382c3ff
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.
- package/bundled/qc-helper/docs/configuration/settings.md +9 -7
- package/bundled/qc-helper/docs/features/channels/_meta.ts +1 -0
- package/bundled/qc-helper/docs/features/channels/github.md +49 -10
- package/bundled/qc-helper/docs/features/channels/gitlab.md +177 -0
- package/bundled/qc-helper/docs/features/code-review.md +20 -0
- package/bundled/qc-helper/docs/features/commands.md +1 -0
- package/bundled/qc-helper/docs/features/hooks.md +135 -18
- package/bundled/qc-helper/docs/features/memory.md +27 -0
- package/bundled/qc-helper/docs/features/skills.md +14 -0
- package/bundled/qc-helper/docs/features/sub-agents.md +55 -8
- package/bundled/qc-helper/docs/features/tool-use-summaries.md +7 -7
- package/bundled/qc-helper/docs/qwen-serve.md +28 -6
- package/bundled/qc-helper/docs/reference/keyboard-shortcuts.md +2 -2
- package/bundled/review/SKILL.md +1 -1
- package/chunks/{MaxSizedBox-VI3ROJJA.js → MaxSizedBox-CDHTDITS.js} +45 -40
- package/chunks/{StandaloneSessionPicker-LYXKD2EV.js → StandaloneSessionPicker-L63HUAHP.js} +65 -60
- package/chunks/{acp-startup-profiler-DFVPFQ6C.js → acp-startup-profiler-3RICG2YW.js} +2 -2
- package/chunks/{acpAgent-WN5SRDQO.js → acpAgent-6WVVT2P3.js} +962 -599
- package/chunks/{agent-K6ECSM64.js → agent-KDM4CBOU.js} +40 -35
- package/chunks/agent-headless-AS7K2K57.js +79 -0
- package/chunks/{anthropicContentGenerator-V2QOGVYD.js → anthropicContentGenerator-WCBYB6JG.js} +337 -27
- package/chunks/{artifact-tool-6K6U7XYJ.js → artifact-tool-ANV4CFCR.js} +2 -2
- package/chunks/{askUserQuestion-GD2IJJ7I.js → askUserQuestion-MALEB47H.js} +2 -2
- package/chunks/{bridge-3KJEWDNE.js → bridge-JNEW6FES.js} +46 -41
- package/chunks/{build-S6DO7LMM.js → build-GDBLPA24.js} +1 -1
- package/chunks/{ca-6W3SK7OQ.js → ca-4OJN75WT.js} +46 -5
- package/chunks/{channel-management-service-XR7GZSWF.js → channel-management-service-QOO7TD3T.js} +21 -6
- package/chunks/{channel-settings-store-HW4FXXUA.js → channel-settings-store-4CSMTR4L.js} +47 -42
- package/chunks/{channel-worker-group-XDPTDWTX.js → channel-worker-group-ERSUOPIR.js} +8 -8
- package/chunks/{channel-worker-manager-YYEHVRRE.js → channel-worker-manager-X247YDQ7.js} +8 -8
- package/chunks/{channel-worker-supervisor-74HTWA2G.js → channel-worker-supervisor-ORJIEEPP.js} +4 -4
- package/chunks/{chunk-VWOOBLTY.js → chunk-25QQVOCG.js} +5 -5
- package/chunks/{chunk-CAPPWD3X.js → chunk-2A6MHYIA.js} +3 -3
- package/chunks/{chunk-2XSLTRFZ.js → chunk-2CTKGIFR.js} +2 -2
- package/chunks/{chunk-DZLYR4U3.js → chunk-2DNKEBXY.js} +1 -1
- package/chunks/{chunk-UWMLWVCA.js → chunk-2IIJTXYF.js} +26 -10
- package/chunks/{chunk-JYBU6YUE.js → chunk-2M5N3DHY.js} +1 -1
- package/chunks/{chunk-AQIDMUGU.js → chunk-2PNQQ4UR.js} +2 -2
- package/chunks/{chunk-OKF7JF3R.js → chunk-2UISUFHQ.js} +3 -3
- package/chunks/{chunk-2LQTH543.js → chunk-33FNCQSY.js} +2 -2
- package/chunks/{chunk-M7OONWYU.js → chunk-3LGZEYOF.js} +4 -2
- package/chunks/{chunk-ZURDMIDR.js → chunk-3MHPWQ2M.js} +242 -76
- package/chunks/{chunk-UHUSJ6X7.js → chunk-3RXUYQJI.js} +25 -6
- package/chunks/{chunk-E5Z2AVNV.js → chunk-3SH53ANB.js} +0 -11
- package/chunks/{chunk-BNWB5CYE.js → chunk-3WXMXT7C.js} +22 -11
- package/chunks/{chunk-A2D5BAVP.js → chunk-42IKVPST.js} +1 -1
- package/chunks/{chunk-2DN4J57Y.js → chunk-432XCUHF.js} +1 -1
- package/chunks/{chunk-EVKE2FZL.js → chunk-433VD3HX.js} +4 -4
- package/chunks/{chunk-Q43KPN7X.js → chunk-434YCHSV.js} +6 -6
- package/chunks/{chunk-5TBMQLGG.js → chunk-4LKVQFHM.js} +2 -2
- package/chunks/{chunk-YDLJGZHL.js → chunk-4NFY2S7N.js} +0 -33
- package/chunks/{chunk-6PE7N3A4.js → chunk-5UJ6A3CH.js} +145 -10
- package/chunks/{chunk-GNR2RNMP.js → chunk-5UZITEHA.js} +3 -3
- package/chunks/chunk-6FMJLI5M.js +1591 -0
- package/chunks/{chunk-RPLGZJV2.js → chunk-6O5DVH27.js} +1 -1
- package/chunks/{chunk-2RFKHEXL.js → chunk-6PLDPT2C.js} +1 -1
- package/chunks/{chunk-7AEJDLRA.js → chunk-7IYLHTTM.js} +3 -3
- package/chunks/{chunk-65PQENQP.js → chunk-7K2WTPQO.js} +5 -5
- package/chunks/{chunk-P4WOAOJW.js → chunk-7MY2AR5A.js} +72 -26
- package/chunks/{chunk-GXIJHV66.js → chunk-A2A34TSB.js} +3 -3
- package/chunks/{chunk-XWWKIXVD.js → chunk-A5YZ3FA2.js} +2 -1
- package/chunks/{chunk-64LQLPL7.js → chunk-A6SX5TAH.js} +3 -3
- package/chunks/{chunk-SZ3KHTDR.js → chunk-AKA24BGO.js} +1 -1
- package/chunks/chunk-AQ37AY7B.js +93 -0
- package/chunks/{chunk-2N7CODY5.js → chunk-AQEWCKX4.js} +2 -2
- package/chunks/{chunk-KCO4FLFJ.js → chunk-AYB4HSBI.js} +3 -3
- package/chunks/{chunk-WZRWHXFE.js → chunk-BFHXDAR7.js} +1 -1
- package/chunks/{chunk-L55JWS76.js → chunk-BGXZBI5B.js} +1 -1
- package/chunks/{chunk-5MKRTI4T.js → chunk-BKUN5QHP.js} +7 -7
- package/chunks/{chunk-Y4IHBGBP.js → chunk-BV4QX43X.js} +1 -1
- package/chunks/{chunk-PB3MBFKG.js → chunk-C4L2MEIT.js} +4 -4
- package/chunks/{chunk-TCIFAA7K.js → chunk-CHCLO3M7.js} +14 -14
- package/chunks/{chunk-CVHIL5IG.js → chunk-CWEIMFFW.js} +13 -6
- package/chunks/{chunk-2FAK6PNM.js → chunk-DUIJ2IXG.js} +5 -13
- package/chunks/{chunk-T2QMKU3R.js → chunk-DVGTU5TC.js} +19 -7
- package/chunks/{chunk-LGAOC3ZS.js → chunk-DYA25Y7U.js} +1 -1
- package/chunks/{chunk-SGFT55XI.js → chunk-E4WHKETF.js} +32 -4
- package/chunks/{chunk-WBL3FJEU.js → chunk-FC4KQFCS.js} +1 -1
- package/chunks/{chunk-MHAIJPTD.js → chunk-FJHA23GM.js} +12 -12
- package/chunks/{chunk-S7W2GKIO.js → chunk-G7XXKQYS.js} +2 -0
- package/chunks/{chunk-MR5EAQ5M.js → chunk-GALUTA2C.js} +1 -1
- package/chunks/{chunk-7I5GTCT4.js → chunk-GB3AB7TR.js} +4008 -3648
- package/chunks/{chunk-QIZKCVM3.js → chunk-GHJM2C2T.js} +6 -8
- package/chunks/chunk-GOFAQQZA.js +132 -0
- package/chunks/{chunk-BCZFQXWK.js → chunk-GTM6IHBB.js} +2 -2
- package/chunks/{chunk-5ZF5XXTS.js → chunk-GVISB2OH.js} +2 -2
- package/chunks/{chunk-FNMZK765.js → chunk-H36SETQS.js} +1 -1
- package/chunks/{chunk-UBEPNVDI.js → chunk-H4346YW5.js} +28 -16
- package/chunks/{chunk-CQL64ESB.js → chunk-H4DSRWAS.js} +24 -13
- package/chunks/{chunk-YGF33UXG.js → chunk-H6MC6VQX.js} +222 -173
- package/chunks/{chunk-GZXCZHCT.js → chunk-I3G5JWBV.js} +1 -1
- package/chunks/{chunk-Y6AXW2OG.js → chunk-I5GNT6ZS.js} +7 -1
- package/chunks/{chunk-GEBV2JGB.js → chunk-I6FAHB4N.js} +1 -1
- package/chunks/{chunk-UPUG4GXM.js → chunk-I7JDGNG6.js} +3 -3
- package/chunks/{chunk-JHNRZMHI.js → chunk-II6WPWHY.js} +9 -9
- package/chunks/{chunk-B4AJNNOL.js → chunk-J26HHFI5.js} +1 -1
- package/chunks/{chunk-S3TWXGKA.js → chunk-JE7KQ2UP.js} +4 -2
- package/chunks/{chunk-ZHBO7WVX.js → chunk-JELIWHXD.js} +1 -1
- package/chunks/{chunk-3EFXSQCM.js → chunk-JRIDA5HF.js} +7 -7
- package/chunks/{chunk-TFRMVU6R.js → chunk-K4CGQN4Q.js} +1 -1
- package/chunks/{chunk-WUZ7H6DP.js → chunk-K5Q62CGR.js} +1 -1
- package/chunks/{chunk-JCW2R7WC.js → chunk-K623ENWT.js} +3 -79
- package/chunks/{chunk-T2NCM2ET.js → chunk-K6KS3LTN.js} +2 -749
- package/chunks/{chunk-TDL6LB4K.js → chunk-KG22G46Y.js} +22 -10
- package/chunks/{chunk-GATT5TKW.js → chunk-KKN2IE7Q.js} +1 -1
- package/chunks/{chunk-JMONIXMJ.js → chunk-KVUBYJDM.js} +2 -2
- package/chunks/{chunk-TBBV36Y4.js → chunk-KXSYDCP2.js} +4 -4
- package/chunks/{chunk-EIF3FXTB.js → chunk-LAPK3GLC.js} +121 -18
- package/chunks/chunk-LBOVL47Y.js +29 -0
- package/chunks/{chunk-U3E3UQAA.js → chunk-LBWNSLJK.js} +4 -4
- package/chunks/{chunk-S4WJVPZW.js → chunk-LL4U3BSH.js} +15 -7
- package/chunks/{chunk-657BH7VM.js → chunk-LRJWFR6L.js} +4 -4
- package/chunks/{chunk-PT722TDT.js → chunk-M2F5PLOW.js} +770 -125
- package/chunks/{chunk-3L2SPEBH.js → chunk-M744OFVE.js} +1 -1
- package/chunks/{chunk-VYOXCEPJ.js → chunk-MBKPUM5Y.js} +1 -1
- package/chunks/chunk-MISUEWB4.js +8749 -0
- package/chunks/{chunk-PONHVBRT.js → chunk-MOHAWIAW.js} +2 -2
- package/chunks/{chunk-HMRM2A3U.js → chunk-MSIVKDRC.js} +4 -4
- package/chunks/{record-artifact-XAMSFSW4.js → chunk-MYT7N6QH.js} +22 -7
- package/chunks/{chunk-X5WNMMIA.js → chunk-NGWYUZZO.js} +11510 -15137
- package/chunks/{chunk-PQNHRFJC.js → chunk-NYX53SV4.js} +0 -2
- package/chunks/{chunk-6RPMI2AB.js → chunk-NZB4NDJL.js} +10 -10
- package/chunks/{chunk-BGTQCTQW.js → chunk-O2ZYHG33.js} +6 -5
- package/chunks/chunk-O6GEWCJA.js +21 -0
- package/chunks/{chunk-JX27F6QS.js → chunk-OBAIHYFT.js} +1 -1
- package/chunks/{chunk-BPZKP57P.js → chunk-OCRM53TT.js} +3 -3
- package/chunks/{chunk-V7RNNPGC.js → chunk-P5Y23G2L.js} +18 -1
- package/chunks/{chunk-FTD6DP4T.js → chunk-PDDYAXL2.js} +5 -1
- package/chunks/{chunk-JSD33JG6.js → chunk-PGEGUNH5.js} +67 -10
- package/chunks/{chunk-A4COXFB3.js → chunk-PGP7Y3RQ.js} +5 -5
- package/chunks/{chunk-T3O2B4XO.js → chunk-PHODQP2V.js} +6 -6
- package/chunks/{chunk-BMFALVGQ.js → chunk-PXA5AWHY.js} +1 -1
- package/chunks/chunk-QL4TN4HS.js +59 -0
- package/chunks/{chunk-W4MIWP6M.js → chunk-QMBEW7EW.js} +2 -2
- package/chunks/{chunk-U4VTUMMK.js → chunk-QONSRAEV.js} +1 -1
- package/chunks/{chunk-LW3RFMG7.js → chunk-QYPT3QUD.js} +3 -3
- package/chunks/{chunk-TV64SXKD.js → chunk-RGJ4JWSU.js} +131 -48
- package/chunks/{chunk-75MIQ3LV.js → chunk-RPYYTL7E.js} +61 -13
- package/chunks/{chunk-52ZSWYEG.js → chunk-SK2UKB45.js} +1 -1
- package/chunks/{chunk-PLDQBIO6.js → chunk-SWEBEXPI.js} +1 -1
- package/chunks/chunk-T3CHYWJZ.js +758 -0
- package/chunks/{chunk-VCPIZRYH.js → chunk-TFFMATHX.js} +9 -7
- package/chunks/{chunk-J7OACQDE.js → chunk-TNVKFQXQ.js} +458 -97
- package/chunks/{chunk-A3NDJ5SB.js → chunk-TYERNYH4.js} +2 -2
- package/chunks/{chunk-GKX7E4CO.js → chunk-U25CMJYY.js} +1 -1
- package/chunks/{chunk-7XATOOE7.js → chunk-UH7Z7Y45.js} +1 -1
- package/chunks/{chunk-XFZYFU3I.js → chunk-UHQ3L6GC.js} +1 -1
- package/chunks/{chunk-GZ3RCT54.js → chunk-UHTJC7O3.js} +1 -1
- package/chunks/{chunk-XZC5VLBZ.js → chunk-UKZEXS6K.js} +6 -0
- package/chunks/{chunk-LO4ROVP4.js → chunk-UOFFZNXV.js} +111 -13
- package/chunks/{chunk-5YKDXHUY.js → chunk-URN76TKR.js} +2 -2
- package/chunks/{chunk-T4TXDL7G.js → chunk-UWLG4UCE.js} +132 -35
- package/chunks/{chunk-KAMYKP7E.js → chunk-UWSXFI6E.js} +1 -1
- package/chunks/{chunk-7BAU433D.js → chunk-VS3GXRNZ.js} +1198 -240
- package/chunks/{chunk-EJGJIBRS.js → chunk-VWF42XC6.js} +3 -3
- package/chunks/{chunk-RCUQIPTN.js → chunk-W7XZ3KP5.js} +1 -1
- package/chunks/{chunk-OCESJA77.js → chunk-WISQLM4Q.js} +1197 -1154
- package/chunks/{chunk-NOKIVHOL.js → chunk-WK4TJUEA.js} +1 -1
- package/chunks/{chunk-JFMA7Y5M.js → chunk-WP4HGHFG.js} +5 -5
- package/chunks/{chunk-4G2BISNC.js → chunk-XC2VAFVZ.js} +1 -1
- package/chunks/{chunk-2LKVPASC.js → chunk-XC656O42.js} +3 -3
- package/chunks/{chunk-5KTQXHPY.js → chunk-XCLLRKY5.js} +3 -3
- package/chunks/{chunk-HV26XH34.js → chunk-XFDPIC4P.js} +3 -3
- package/chunks/{chunk-JTV5K7NH.js → chunk-XSA5EKTJ.js} +1 -1
- package/chunks/{chunk-75GFAX4R.js → chunk-YAVY33G4.js} +1 -1
- package/chunks/{chunk-WBSMNTSV.js → chunk-YXEVDA66.js} +2 -2
- package/chunks/{chunk-7DXQIJID.js → chunk-ZRFJ75D7.js} +3 -3
- package/chunks/{chunk-XBYYDKAZ.js → chunk-ZTN6OA5J.js} +8 -7
- package/chunks/{computer-use-ZTIDHMMA.js → computer-use-Z4NCIIJN.js} +40 -35
- package/chunks/{config-utils-NYSXDMEQ.js → config-utils-64LM6OEQ.js} +4 -4
- package/chunks/{contextCommand-2PIEU37Z.js → contextCommand-HVM7XFCB.js} +43 -38
- package/chunks/{core-runtime-3XEYLQFK.js → core-runtime-NL3ZBHBU.js} +40 -35
- package/chunks/{create-sub-session-SBYUMSSS.js → create-sub-session-AM32K2HD.js} +2 -2
- package/chunks/{create-sub-session-R76FVXCI.js → create-sub-session-XHSCDYFU.js} +43 -38
- package/chunks/{cron-create-2QK6TCEC.js → cron-create-HPXYE6C5.js} +4 -4
- package/chunks/{cron-delete-FDCDFYMG.js → cron-delete-FPVNTKPK.js} +4 -4
- package/chunks/{cron-list-XN3WVBTP.js → cron-list-ZEI6PAAV.js} +4 -4
- package/chunks/{daemon-Q2AB5Z23.js → daemon-PCNCI5YU.js} +72 -3
- package/chunks/daemon-status-provider-XD23SNAM.js +94 -0
- package/chunks/{daemon-trust-policy-ILUDTLHD.js → daemon-trust-policy-NOHK7IW5.js} +46 -41
- package/chunks/{daemon-trust-policy-monitor-HS3PKKRO.js → daemon-trust-policy-monitor-ZBTSR333.js} +46 -41
- package/chunks/{de-SY6O76BF.js → de-A6TI4LBB.js} +46 -5
- package/chunks/{deferred-core-runtime-X4QV662U.js → deferred-core-runtime-JJBHKM2C.js} +40 -35
- package/chunks/{dist-HVRQ2CFL.js → dist-4LAMY2SK.js} +1180 -5
- package/chunks/{dist-DOLYHMXE.js → dist-4T4NCJFL.js} +2 -2
- package/chunks/dist-7KOL6OMD.js +13467 -0
- package/chunks/{dist-SSU66DM4.js → dist-BH76AT7N.js} +1 -1
- package/chunks/{dist-BSTVRPMT.js → dist-BXA3JXVQ.js} +541 -19
- package/chunks/{dist-SV7Q3AWJ.js → dist-OEEFI6UU.js} +12 -9
- package/chunks/{dist-YGBBMK3Z.js → dist-SMLVOWKV.js} +5 -4
- package/chunks/{dist-IXQEQWRG.js → dist-V2RK6S6Q.js} +1 -1
- package/chunks/{earlyInputCapture-XKLZT7ZD.js → earlyInputCapture-KLAZDAIP.js} +41 -36
- package/chunks/{edit-HHGIOTQ2.js → edit-YQZWCISX.js} +40 -35
- package/chunks/{en-NBK3JKCE.js → en-RESOFG55.js} +46 -5
- package/chunks/{enter-worktree-ZN7PUQ46.js → enter-worktree-WLVWI3FP.js} +40 -35
- package/chunks/{enterPlanMode-EIFIDSIV.js → enterPlanMode-6RYXFQUD.js} +40 -35
- package/chunks/{environment-XXQ75D2Q.js → environment-DXJTXSVT.js} +43 -38
- package/chunks/{errors-4GMVU7CK.js → errors-XGAGG2S2.js} +43 -38
- package/chunks/{exit-worktree-GXMI4ATY.js → exit-worktree-C4276VPP.js} +40 -35
- package/chunks/{exitPlanMode-34UVY7M6.js → exitPlanMode-MM5HIRUF.js} +40 -35
- package/chunks/{fast-path-VPIVA7L6.js → fast-path-PIXYOHCH.js} +6 -2
- package/chunks/{fr-4KG5V7UT.js → fr-QF7RI5ZE.js} +46 -5
- package/chunks/{gemini-4BWIK4WD.js → gemini-43RLVUNP.js} +158 -96
- package/chunks/{geminiContentGenerator-3XVV5MSS.js → geminiContentGenerator-PNQ4TSID.js} +6 -6
- package/chunks/{glob-TZ2ABCJG.js → glob-ZMBQKAU5.js} +40 -35
- package/chunks/goal-tools-Y767F7LZ.js +335 -0
- package/chunks/{grep-BEF463NA.js → grep-HSV37W2Q.js} +40 -35
- package/chunks/handleAutoUpdate-QDHZPBAY.js +85 -0
- package/chunks/{i18n-FMM5FDXR.js → i18n-ME22A6RN.js} +42 -37
- package/chunks/{image-gen-HHVLF7HS.js → image-gen-IFC7ZWSB.js} +9 -9
- package/chunks/{initializer-625TIAIO.js → initializer-J7H2CHVB.js} +47 -42
- package/chunks/{installationInfo-6AM4I2Y3.js → installationInfo-R7FXPQN5.js} +41 -36
- package/chunks/{ja-F3GSQXMF.js → ja-URQESVGW.js} +46 -5
- package/chunks/{keychain-token-storage-72IYCAZV.js → keychain-token-storage-7BT4TQ2A.js} +2 -2
- package/chunks/{kittyProtocolDetector-MBRTDRBK.js → kittyProtocolDetector-BFLAKYXH.js} +1 -1
- package/chunks/list-OYDIBA4N.js +93 -0
- package/chunks/{list-agents-R6KDXQR3.js → list-agents-GATIBBQQ.js} +2 -2
- package/chunks/{loadedSettingsAdapter-SPUTNKAV.js → loadedSettingsAdapter-OK6GK2GE.js} +46 -41
- package/chunks/{loggingContentGenerator-LKOF7XI7.js → loggingContentGenerator-U4ZEG4GL.js} +53 -38
- package/chunks/{loop-wakeup-3IQKCYAH.js → loop-wakeup-3DZMQQQQ.js} +13 -6
- package/chunks/{ls-DKZ37A7N.js → ls-7F4GHXIH.js} +4 -4
- package/chunks/{lsp-QNWN7KN3.js → lsp-6FEHVBWI.js} +2 -2
- package/chunks/{managed-npm-update-ACQGGIN5.js → managed-npm-update-PGKAJLLO.js} +43 -38
- package/chunks/mcp-S4DXJD2G.js +87 -0
- package/chunks/{monitor-DF52UVHI.js → monitor-E5ZFMT74.js} +40 -35
- package/chunks/nonInteractiveCli-HNOHKEPE.js +149 -0
- package/chunks/{notebook-edit-FCWS4XVN.js → notebook-edit-6QDN6VZJ.js} +40 -35
- package/chunks/{openaiContentGenerator-7LDK3DCJ.js → openaiContentGenerator-3NLB2C5O.js} +19 -19
- package/chunks/{pidfile-6ERW3DF4.js → pidfile-ZMOIUGG6.js} +41 -36
- package/chunks/{processUtils-COKZAMUP.js → processUtils-E4QGQVWW.js} +2 -2
- package/chunks/{pt-EQ33KWEN.js → pt-EEEQXRUI.js} +46 -5
- package/chunks/{qwenContentGenerator-TKWUMR7N.js → qwenContentGenerator-2LFRWJTM.js} +46 -41
- package/chunks/{qwenOAuth2-7HMU47SF.js → qwenOAuth2-N32BUQDC.js} +8 -8
- package/chunks/{read-file-X6DRC574.js → read-file-GLDCWZBG.js} +11 -11
- package/chunks/{read-mcp-resource-GFTWYXMK.js → read-mcp-resource-AFS3UKZO.js} +2 -2
- package/chunks/record-artifact-ECZSCEG5.js +21 -0
- package/chunks/{resumeHistoryUtils-PFPM2GWM.js → resumeHistoryUtils-F5BE5QDW.js} +48 -43
- package/chunks/ripGrep-T23Y4AGY.js +77 -0
- package/chunks/{ru-7OZAUKGG.js → ru-WGZDYQAB.js} +46 -5
- package/chunks/{run-qwen-serve-TSTCO4XE.js → run-qwen-serve-TI2HGLLU.js} +290 -75
- package/chunks/{runtime-DAUPSUKI.js → runtime-WCWM3DO7.js} +53 -46
- package/chunks/{scheduler-KMADMT26.js → scheduler-2QZO5AV5.js} +40 -35
- package/chunks/{sdk-exporters-http-WO556XNU.js → sdk-exporters-http-IKNWQJNV.js} +3 -3
- package/chunks/{sdk-impl-LPAVACSF.js → sdk-impl-7CUUMQDB.js} +3 -3
- package/chunks/{send-message-SAWK4DZX.js → send-message-X7G2JSII.js} +6 -11
- package/chunks/{serve-NNRWS6F4.js → serve-DZOMYUFU.js} +46 -41
- package/chunks/{server-WEH7DVCH.js → server-N4AJRKIQ.js} +2269 -1016
- package/chunks/{session-WXC56V2I.js → session-GS6AKMN7.js} +151 -86
- package/chunks/{settings-DJDXFDZ3.js → settings-CUN3SELH.js} +50 -45
- package/chunks/{shell-JN5VRQXD.js → shell-NGBFVXC5.js} +40 -35
- package/chunks/{skill-SGXPKJCS.js → skill-SC2BSO75.js} +30 -16
- package/chunks/{skill-settings-VJ5PDMZI.js → skill-settings-XVPCPW5K.js} +45 -40
- package/chunks/{spawnChannel-ETMJW7YX.js → spawnChannel-RILO4YY3.js} +42 -37
- package/chunks/{standalone-update-MK3Z7KBI.js → standalone-update-TMLT6LVJ.js} +43 -38
- package/chunks/{startInteractiveUI-ZCGIXPGT.js → startInteractiveUI-J45WOEOU.js} +883 -1112
- package/chunks/{syntheticOutput-355CB6CJ.js → syntheticOutput-FHRY3BPQ.js} +3 -3
- package/chunks/{task-create-INGWNUG4.js → task-create-LAQXBIHC.js} +11 -10
- package/chunks/{task-list-5XNNGTF4.js → task-list-V6K5DRDH.js} +6 -6
- package/chunks/{task-stop-4ROAOBXH.js → task-stop-LQXE52L6.js} +2 -2
- package/chunks/{task-update-CRK5VWWZ.js → task-update-NXRCXSPB.js} +11 -10
- package/chunks/{team-create-QQGAJG7P.js → team-create-W3EVWCTA.js} +40 -35
- package/chunks/{team-delete-S2RCXA4P.js → team-delete-Z4KGO7RC.js} +6 -6
- package/chunks/{team-plan-approval-RT7Q5R6O.js → team-plan-approval-URYVKJF4.js} +40 -35
- package/chunks/theme-manager-CUAMS2NI.js +81 -0
- package/chunks/{todoWrite-7WM3VDMY.js → todoWrite-OFIZDI7P.js} +32 -4
- package/chunks/{tool-search-Z3Z4AYKP.js → tool-search-DCICFL32.js} +15 -14
- package/chunks/total-session-admission-3ZTAXVUK.js +89 -0
- package/chunks/{trustedFolders-X2JEIO57.js → trustedFolders-EVCN36O5.js} +42 -37
- package/chunks/{update-relaunch-VWNPYDIP.js → update-relaunch-XLW46RHQ.js} +5 -5
- package/chunks/{updateCheck-KAQH67DV.js → updateCheck-ZHVXDAIH.js} +44 -39
- package/chunks/{useAutoAcceptIndicator-JH6BCF7S.js → useAutoAcceptIndicator-ZGD6BJSP.js} +50 -45
- package/chunks/{validateNonInterActiveAuth-GIUJ2UFS.js → validateNonInterActiveAuth-R3BAQFDY.js} +88 -83
- package/chunks/{version-BGLYIJUY.js → version-PMWREGCG.js} +1 -1
- package/chunks/{web-fetch-OTDU4VQF.js → web-fetch-PGN27SGF.js} +14 -14
- package/chunks/{web-search-FP6SIHPR.js → web-search-KW4UNMRE.js} +8 -8
- package/chunks/{workflow-YCIVBYSB.js → workflow-SN3TJBTJ.js} +363 -310
- package/chunks/workspace-providers-status-O3HUZGGR.js +90 -0
- package/chunks/{workspace-registration-store-OTMS3H4C.js → workspace-registration-store-M3FJ74RS.js} +2 -2
- package/chunks/{workspace-registry-O63R6IZ4.js → workspace-registry-U7ISW23N.js} +47 -42
- package/chunks/{workspace-service-M6LLHKJ5.js → workspace-service-VH6IWADT.js} +53 -48
- package/chunks/{workspace-skills-status-C2V7BAIS.js → workspace-skills-status-XANARSZS.js} +48 -43
- package/chunks/{workspace-trust-reconciler-IBUPOUJN.js → workspace-trust-reconciler-35EFR4GC.js} +53 -48
- package/chunks/write-file-NCRSGUDT.js +79 -0
- package/chunks/{zh-H3YDK5QW.js → zh-OHX23Q44.js} +43 -5
- package/chunks/{zh-TW-JYCP7XUA.js → zh-TW-4G7YKDAQ.js} +43 -5
- package/chunks/zoom-image-X7CIADYC.js +224 -0
- package/cli.js +55 -48
- package/locales/ca.js +60 -4
- package/locales/de.js +62 -4
- package/locales/en.js +59 -4
- package/locales/fr.js +64 -4
- package/locales/ja.js +61 -4
- package/locales/pt.js +60 -4
- package/locales/ru.js +63 -4
- package/locales/zh-TW.js +52 -4
- package/locales/zh.js +52 -4
- package/package.json +3 -3
- package/web-shell/assets/{arc-75-Wdeo3.js → arc-CaMTqKio.js} +1 -1
- package/web-shell/assets/{architectureDiagram-3BPJPVTR-FKeXQbyP.js → architectureDiagram-3BPJPVTR-Bjxztij2.js} +1 -1
- package/web-shell/assets/{blockDiagram-GPEHLZMM-CY0vc-A3.js → blockDiagram-GPEHLZMM-BYJzeHi9.js} +1 -1
- package/web-shell/assets/{c4Diagram-AAUBKEIU-CNP-A-8u.js → c4Diagram-AAUBKEIU-fYAa-Eil.js} +1 -1
- package/web-shell/assets/channel-LEZei0-5.js +1 -0
- package/web-shell/assets/{chunk-2J33WTMH-GybS4Gii.js → chunk-2J33WTMH-B1OTlTml.js} +1 -1
- package/web-shell/assets/{chunk-4BX2VUAB-02H91V8v.js → chunk-4BX2VUAB-DNj4uy6k.js} +1 -1
- package/web-shell/assets/{chunk-55IACEB6-D3M-2VT6.js → chunk-55IACEB6-DAqNmg3c.js} +1 -1
- package/web-shell/assets/{chunk-727SXJPM-CCu29u4H.js → chunk-727SXJPM-BwB4ddxE.js} +1 -1
- package/web-shell/assets/{chunk-AQP2D5EJ-CaFKWgrn.js → chunk-AQP2D5EJ-DmHR_UZs.js} +1 -1
- package/web-shell/assets/{chunk-FMBD7UC4-ZZpPqIwQ.js → chunk-FMBD7UC4-BlfOXumo.js} +1 -1
- package/web-shell/assets/{chunk-ND2GUHAM-D22DqGs8.js → chunk-ND2GUHAM-BKogiSy7.js} +1 -1
- package/web-shell/assets/{chunk-QZHKN3VN-Bu85S0fw.js → chunk-QZHKN3VN-DEclVrOF.js} +1 -1
- package/web-shell/assets/classDiagram-4FO5ZUOK-BiaRhfvf.js +1 -0
- package/web-shell/assets/classDiagram-v2-Q7XG4LA2-BiaRhfvf.js +1 -0
- package/web-shell/assets/{cose-bilkent-S5V4N54A-f1CK1Gwe.js → cose-bilkent-S5V4N54A-CwtS21WT.js} +1 -1
- package/web-shell/assets/{dagre-BM42HDAG-D0Ow8F_n.js → dagre-BM42HDAG-BAAIlB4p.js} +1 -1
- package/web-shell/assets/{diagram-2AECGRRQ-BPrmTWp8.js → diagram-2AECGRRQ-ChljtF_V.js} +1 -1
- package/web-shell/assets/{diagram-5GNKFQAL-HccuFAzy.js → diagram-5GNKFQAL-BIXVd31-.js} +1 -1
- package/web-shell/assets/{diagram-KO2AKTUF-BrS76mbA.js → diagram-KO2AKTUF-BEiBaS15.js} +1 -1
- package/web-shell/assets/{diagram-LMA3HP47-V7T9lU-5.js → diagram-LMA3HP47-C-g4tWKM.js} +1 -1
- package/web-shell/assets/{diagram-OG6HWLK6-DKidyJMR.js → diagram-OG6HWLK6-CNCCbNQG.js} +1 -1
- package/web-shell/assets/{erDiagram-TEJ5UH35-DBadZIkp.js → erDiagram-TEJ5UH35-v8ysnsdI.js} +1 -1
- package/web-shell/assets/{flowDiagram-I6XJVG4X-BymfqdNJ.js → flowDiagram-I6XJVG4X-LKVlLjwA.js} +1 -1
- package/web-shell/assets/{ganttDiagram-6RSMTGT7-DOw340jf.js → ganttDiagram-6RSMTGT7-DA5MrKYG.js} +1 -1
- package/web-shell/assets/{gitGraphDiagram-PVQCEYII-_8EiD8sl.js → gitGraphDiagram-PVQCEYII-Cyg5fe6d.js} +1 -1
- package/web-shell/assets/index-BgOcEaVt.js +1756 -0
- package/web-shell/assets/index-C2GE3DAF.js +74 -0
- package/web-shell/assets/{index-CKIadvET.js → index-CKdUkVVS.js} +1 -1
- package/web-shell/assets/index-DA5Lvscv.css +5 -0
- package/web-shell/assets/{infoDiagram-5YYISTIA-D61KYQBu.js → infoDiagram-5YYISTIA-SLsfu3Qd.js} +1 -1
- package/web-shell/assets/{ishikawaDiagram-YF4QCWOH-CsiXSpNx.js → ishikawaDiagram-YF4QCWOH-CmHOmTNx.js} +1 -1
- package/web-shell/assets/{journeyDiagram-JHISSGLW-Sdfionyh.js → journeyDiagram-JHISSGLW-C3gM_HFQ.js} +1 -1
- package/web-shell/assets/{kanban-definition-UN3LZRKU-C3WI3Cnl.js → kanban-definition-UN3LZRKU-BbHD7duM.js} +1 -1
- package/web-shell/assets/{linear-Dpigcc62.js → linear-CSBvm435.js} +1 -1
- package/web-shell/assets/{mermaid.core-Ct97pqgW.js → mermaid.core-CPMw15lU.js} +5 -5
- package/web-shell/assets/{mindmap-definition-RKZ34NQL-BzeaN0rB.js → mindmap-definition-RKZ34NQL-C_tNqXQW.js} +1 -1
- package/web-shell/assets/{pieDiagram-4H26LBE5-CvjgcbVD.js → pieDiagram-4H26LBE5-DH_N-8yY.js} +1 -1
- package/web-shell/assets/{quadrantDiagram-W4KKPZXB-BUzgTNdH.js → quadrantDiagram-W4KKPZXB-CRbS8UkN.js} +1 -1
- package/web-shell/assets/{requirementDiagram-4Y6WPE33-B7zKlgUQ.js → requirementDiagram-4Y6WPE33-DJgdZPZn.js} +1 -1
- package/web-shell/assets/{sankeyDiagram-5OEKKPKP-Bb9CQgrT.js → sankeyDiagram-5OEKKPKP-vhL1y5zx.js} +1 -1
- package/web-shell/assets/{sequenceDiagram-3UESZ5HK-DJ6V7itG.js → sequenceDiagram-3UESZ5HK-UQthhFwd.js} +1 -1
- package/web-shell/assets/{stateDiagram-AJRCARHV-IImflERY.js → stateDiagram-AJRCARHV-CAywEm20.js} +1 -1
- package/web-shell/assets/stateDiagram-v2-BHNVJYJU-lfJQHw-7.js +1 -0
- package/web-shell/assets/{timeline-definition-PNZ67QCA-6Q_uWHKh.js → timeline-definition-PNZ67QCA-CLO8b3FD.js} +1 -1
- package/web-shell/assets/{vennDiagram-CIIHVFJN-TmyKyjwv.js → vennDiagram-CIIHVFJN-BNAAh0Mu.js} +1 -1
- package/web-shell/assets/{wardley-L42UT6IY-CRh9uiPv.js → wardley-L42UT6IY-CUY7bLpN.js} +1 -1
- package/web-shell/assets/{wardleyDiagram-YWT4CUSO-59TKAW8w.js → wardleyDiagram-YWT4CUSO-CSg_ORdW.js} +1 -1
- package/web-shell/assets/{xychartDiagram-2RQKCTM6-GCSUIK2L.js → xychartDiagram-2RQKCTM6-BjffV208.js} +1 -1
- package/web-shell/index.html +2 -2
- package/chunks/agent-headless-NO4Y2HOE.js +0 -74
- package/chunks/chunk-6QIGFD5W.js +0 -82
- package/chunks/chunk-HGT6JR3U.js +0 -177
- package/chunks/daemon-status-provider-3XJI6CAL.js +0 -89
- package/chunks/handleAutoUpdate-L6ERF36Y.js +0 -80
- package/chunks/list-L2GA674Y.js +0 -88
- package/chunks/mcp-SZLHKFJW.js +0 -82
- package/chunks/nonInteractiveCli-5T7KYKLK.js +0 -144
- package/chunks/ripGrep-OWV2IVJC.js +0 -72
- package/chunks/theme-manager-EEWIQJ7J.js +0 -76
- package/chunks/total-session-admission-44JKRWQD.js +0 -84
- package/chunks/workspace-providers-status-S35YAIUS.js +0 -85
- package/chunks/write-file-3BZC3EAE.js +0 -72
- package/chunks/zoom-image-TZ6S2O57.js +0 -351
- package/web-shell/assets/channel-DPYMT76A.js +0 -1
- package/web-shell/assets/classDiagram-4FO5ZUOK--JstsIgL.js +0 -1
- package/web-shell/assets/classDiagram-v2-Q7XG4LA2--JstsIgL.js +0 -1
- package/web-shell/assets/index-D1eXNRHe.js +0 -1389
- package/web-shell/assets/index-DVLD4CQq.css +0 -5
- 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-
|
|
8
|
+
} from "./chunk-E4WHKETF.js";
|
|
9
9
|
import {
|
|
10
10
|
STRUCTURED_OUTPUT_REDACTED_ARGS
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-BV4QX43X.js";
|
|
12
12
|
import {
|
|
13
13
|
BaseDeclarativeTool,
|
|
14
14
|
BaseToolInvocation,
|
|
15
15
|
SchemaValidator,
|
|
16
16
|
ToolDisplayNames,
|
|
17
17
|
ToolNames
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-I5GNT6ZS.js";
|
|
19
19
|
import {
|
|
20
20
|
DEFAULT_QWEN_MODEL
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-TFFMATHX.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-
|
|
32
|
+
} from "./chunk-TYERNYH4.js";
|
|
33
33
|
import {
|
|
34
34
|
atomicWriteFile
|
|
35
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-UH7Z7Y45.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-
|
|
56
|
+
} from "./chunk-O2ZYHG33.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-
|
|
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-
|
|
116
|
+
} from "./chunk-3RXUYQJI.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
|
|
5817
|
+
const fs8 = (0, node_1.default)();
|
|
5817
5818
|
const handler = /* @__PURE__ */ __name((err, buffer) => {
|
|
5818
5819
|
if (fd) {
|
|
5819
|
-
|
|
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 =
|
|
5829
|
+
fd = fs8.openSync(filepath, "r");
|
|
5829
5830
|
const sample = Buffer.allocUnsafe(opts.sampleSize);
|
|
5830
|
-
|
|
5831
|
+
fs8.read(fd, sample, 0, opts.sampleSize, opts.offset, (err) => {
|
|
5831
5832
|
handler(err, sample);
|
|
5832
5833
|
});
|
|
5833
5834
|
return;
|
|
5834
5835
|
}
|
|
5835
|
-
|
|
5836
|
+
fs8.readFile(filepath, handler);
|
|
5836
5837
|
}), "detectFile");
|
|
5837
5838
|
exports.detectFile = detectFile;
|
|
5838
5839
|
var detectFileSync = /* @__PURE__ */ __name((filepath, opts = {}) => {
|
|
5839
|
-
const
|
|
5840
|
+
const fs8 = (0, node_1.default)();
|
|
5840
5841
|
if (opts && opts.sampleSize) {
|
|
5841
|
-
const fd =
|
|
5842
|
+
const fd = fs8.openSync(filepath, "r");
|
|
5842
5843
|
const sample = Buffer.allocUnsafe(opts.sampleSize);
|
|
5843
|
-
|
|
5844
|
-
|
|
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)(
|
|
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
|
|
7399
|
+
import fs7 from "node:fs/promises";
|
|
7399
7400
|
|
|
7400
7401
|
// packages/core/src/utils/fileUtils.ts
|
|
7401
7402
|
init_esbuild_shims();
|
|
7402
|
-
import
|
|
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
|
-
|
|
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(
|
|
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(
|
|
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
|
-
|
|
8951
|
-
|
|
8952
|
-
|
|
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
|
|
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")
|
|
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
|
-
|
|
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
|
|
9017
|
-
|
|
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
|
-
|
|
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
|
|
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
|
|
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,
|
|
@@ -9238,19 +9730,22 @@ async function readFileWithLineAndLimit(params) {
|
|
|
9238
9730
|
const endLine = Math.min(startLine + limit, originalLineCount);
|
|
9239
9731
|
const actualStartLine = Math.min(startLine, originalLineCount);
|
|
9240
9732
|
const selectedLines = lines.slice(actualStartLine, endLine);
|
|
9733
|
+
const joined = selectedLines.join("\n");
|
|
9241
9734
|
return {
|
|
9242
|
-
content:
|
|
9735
|
+
content: joined,
|
|
9243
9736
|
bom,
|
|
9244
9737
|
encoding,
|
|
9245
9738
|
originalLineCount,
|
|
9246
|
-
originalLineCountExact: true
|
|
9739
|
+
originalLineCountExact: true,
|
|
9740
|
+
truncatedByBytes: false,
|
|
9741
|
+
lineEnding: detectLineEndingFromContent(joined)
|
|
9247
9742
|
};
|
|
9248
9743
|
}
|
|
9249
9744
|
__name(readFileWithLineAndLimit, "readFileWithLineAndLimit");
|
|
9250
|
-
async function detectFileEncoding(
|
|
9251
|
-
let
|
|
9745
|
+
async function detectFileEncoding(source) {
|
|
9746
|
+
let opened = null;
|
|
9252
9747
|
try {
|
|
9253
|
-
fh = await
|
|
9748
|
+
const fh = typeof source === "string" ? opened = await fs3.promises.open(source, "r") : source;
|
|
9254
9749
|
const stats = await fh.stat();
|
|
9255
9750
|
if (stats.size === 0) return "utf-8";
|
|
9256
9751
|
const sampleSize = Math.min(8192, stats.size);
|
|
@@ -9259,22 +9754,7 @@ async function detectFileEncoding(filePath) {
|
|
|
9259
9754
|
if (bytesRead === 0) return "utf-8";
|
|
9260
9755
|
const sample = buf.subarray(0, bytesRead);
|
|
9261
9756
|
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
|
-
}
|
|
9757
|
+
if (bom) return bomEncodingToName(bom.encoding);
|
|
9278
9758
|
if (isValidUtf8(sample)) return "utf-8";
|
|
9279
9759
|
const detected = detectEncodingFromBuffer(sample);
|
|
9280
9760
|
if (detected && !isUtf8CompatibleEncoding(detected)) {
|
|
@@ -9284,9 +9764,9 @@ async function detectFileEncoding(filePath) {
|
|
|
9284
9764
|
} catch {
|
|
9285
9765
|
return "utf-8";
|
|
9286
9766
|
} finally {
|
|
9287
|
-
if (
|
|
9767
|
+
if (opened) {
|
|
9288
9768
|
try {
|
|
9289
|
-
await
|
|
9769
|
+
await opened.close();
|
|
9290
9770
|
} catch {
|
|
9291
9771
|
}
|
|
9292
9772
|
}
|
|
@@ -9308,7 +9788,7 @@ __name(isWithinRoot, "isWithinRoot");
|
|
|
9308
9788
|
async function isBinaryFile(filePath) {
|
|
9309
9789
|
let fh = null;
|
|
9310
9790
|
try {
|
|
9311
|
-
fh = await
|
|
9791
|
+
fh = await fs3.promises.open(filePath, "r");
|
|
9312
9792
|
const stats = await fh.stat();
|
|
9313
9793
|
const fileSize = stats.size;
|
|
9314
9794
|
if (fileSize === 0) return false;
|
|
@@ -9594,20 +10074,22 @@ async function processSingleFileContent(filePath, config, optionsOrOffset, legac
|
|
|
9594
10074
|
preserveUnsupportedImage = false,
|
|
9595
10075
|
preparePdfForVisionBridge = false,
|
|
9596
10076
|
signal,
|
|
9597
|
-
largePdfBehavior = "error"
|
|
10077
|
+
largePdfBehavior = "error",
|
|
10078
|
+
displayPath = filePath
|
|
9598
10079
|
} = options;
|
|
9599
10080
|
const rootDirectory = config.getTargetDir();
|
|
10081
|
+
const relativePathForDisplay = (path2.isAbsolute(displayPath) ? path2.relative(rootDirectory, displayPath) : displayPath).replace(/\\/g, "/");
|
|
9600
10082
|
try {
|
|
9601
10083
|
signal?.throwIfAborted();
|
|
9602
10084
|
let stats;
|
|
9603
10085
|
try {
|
|
9604
|
-
stats = await
|
|
10086
|
+
stats = options.textFileStats ?? await fs3.promises.stat(filePath);
|
|
9605
10087
|
} catch (error) {
|
|
9606
10088
|
if (isNodeError(error) && error.code === "ENOENT") {
|
|
9607
10089
|
return {
|
|
9608
10090
|
llmContent: "Could not read file because no file was found at the specified path.",
|
|
9609
10091
|
returnDisplay: "File not found.",
|
|
9610
|
-
error: `File not found: ${
|
|
10092
|
+
error: `File not found: ${displayPath}`,
|
|
9611
10093
|
errorType: "file_not_found" /* FILE_NOT_FOUND */
|
|
9612
10094
|
};
|
|
9613
10095
|
}
|
|
@@ -9617,7 +10099,7 @@ async function processSingleFileContent(filePath, config, optionsOrOffset, legac
|
|
|
9617
10099
|
return {
|
|
9618
10100
|
llmContent: "Could not read file because the provided path is a directory, not a file.",
|
|
9619
10101
|
returnDisplay: "Path is a directory.",
|
|
9620
|
-
error: `Path is a directory, not a file: ${
|
|
10102
|
+
error: `Path is a directory, not a file: ${displayPath}`,
|
|
9621
10103
|
errorType: "target_is_directory" /* TARGET_IS_DIRECTORY */
|
|
9622
10104
|
};
|
|
9623
10105
|
}
|
|
@@ -9625,13 +10107,14 @@ async function processSingleFileContent(filePath, config, optionsOrOffset, legac
|
|
|
9625
10107
|
return {
|
|
9626
10108
|
llmContent: `Cannot read file: ${path2.basename(filePath)} is not a regular file (e.g. device, socket, or pipe).`,
|
|
9627
10109
|
returnDisplay: "Not a regular file.",
|
|
9628
|
-
error: `Not a regular file: ${
|
|
10110
|
+
error: `Not a regular file: ${displayPath}`,
|
|
9629
10111
|
errorType: "read_content_failure" /* READ_CONTENT_FAILURE */
|
|
9630
10112
|
};
|
|
9631
10113
|
}
|
|
9632
|
-
const fileType = await detectFileType(filePath);
|
|
9633
|
-
const
|
|
9634
|
-
const
|
|
10114
|
+
const fileType = options.textFileHandle ? "text" : await detectFileType(filePath);
|
|
10115
|
+
const mediaMimeType = index_lite_default.getType(filePath) ?? MIME_LITE_MISSING_VIDEO_TYPES.get(path2.extname(filePath).toLowerCase()) ?? "application/octet-stream";
|
|
10116
|
+
const shouldRenderImageOverview = fileType === "image" && CANONICAL_IMAGE_MIME_TYPES.has(mediaMimeType);
|
|
10117
|
+
const displayName = path2.basename(displayPath);
|
|
9635
10118
|
const modalities = config.getContentGeneratorConfig?.()?.modalities ?? {};
|
|
9636
10119
|
const willRenderPdfImages = fileType === "pdf" && !!modalities.image && largePdfBehavior !== "reference";
|
|
9637
10120
|
const renderForBridge = fileType === "pdf" && !modalities.image && !modalities.pdf && (preserveUnsupportedImage || preparePdfForVisionBridge);
|
|
@@ -9670,7 +10153,7 @@ async function processSingleFileContent(filePath, config, optionsOrOffset, legac
|
|
|
9670
10153
|
return {
|
|
9671
10154
|
llmContent: `PDF file is too large for full text extraction: ${fileSizeInMB.toFixed(2)}MB exceeds the ${PDF_FULL_TEXT_EXTRACTION_MAX_MB}MB limit. Use the 'pages' parameter to read a narrower range, or split the document into smaller files before retrying.`,
|
|
9672
10155
|
returnDisplay: `PDF file too large (${fileSizeInMB.toFixed(2)}MB > ${PDF_FULL_TEXT_EXTRACTION_MAX_MB}MB).`,
|
|
9673
|
-
error: `PDF exceeds extraction size limit: ${
|
|
10156
|
+
error: `PDF exceeds extraction size limit: ${displayPath} (${fileSizeInMB.toFixed(2)}MB)`,
|
|
9674
10157
|
errorType: "file_too_large" /* FILE_TOO_LARGE */,
|
|
9675
10158
|
stats
|
|
9676
10159
|
};
|
|
@@ -9679,7 +10162,7 @@ async function processSingleFileContent(filePath, config, optionsOrOffset, legac
|
|
|
9679
10162
|
return {
|
|
9680
10163
|
llmContent: `PDF file is too large for page-range text extraction: ${fileSizeInMB.toFixed(2)}MB exceeds the ${PDF_PAGED_TEXT_EXTRACTION_MAX_MB}MB limit. Split the document into smaller files before retrying.`,
|
|
9681
10164
|
returnDisplay: `PDF file too large (${fileSizeInMB.toFixed(2)}MB > ${PDF_PAGED_TEXT_EXTRACTION_MAX_MB}MB).`,
|
|
9682
|
-
error: `PDF exceeds page-range extraction size limit: ${
|
|
10165
|
+
error: `PDF exceeds page-range extraction size limit: ${displayPath} (${fileSizeInMB.toFixed(2)}MB)`,
|
|
9683
10166
|
errorType: "file_too_large" /* FILE_TOO_LARGE */,
|
|
9684
10167
|
stats
|
|
9685
10168
|
};
|
|
@@ -9714,11 +10197,19 @@ async function processSingleFileContent(filePath, config, optionsOrOffset, legac
|
|
|
9714
10197
|
};
|
|
9715
10198
|
}
|
|
9716
10199
|
}
|
|
9717
|
-
if (
|
|
10200
|
+
if (shouldRenderImageOverview && stats.size > IMAGE_MAX_SOURCE_BYTES) {
|
|
10201
|
+
return {
|
|
10202
|
+
llmContent: "Image file exceeds the 100 MB source limit.",
|
|
10203
|
+
returnDisplay: "Image file exceeds the 100 MB source limit.",
|
|
10204
|
+
error: `Image file exceeds the 100 MB source limit: ${displayPath}`,
|
|
10205
|
+
errorType: "file_too_large" /* FILE_TOO_LARGE */
|
|
10206
|
+
};
|
|
10207
|
+
}
|
|
10208
|
+
if (fileSizeInMB > 9.9 && !willExtractPdfText && fileType !== "text" && !shouldRenderImageOverview) {
|
|
9718
10209
|
return {
|
|
9719
10210
|
llmContent: "File size exceeds the 10MB limit.",
|
|
9720
10211
|
returnDisplay: "File size exceeds the 10MB limit.",
|
|
9721
|
-
error: `File size exceeds the 10MB limit: ${
|
|
10212
|
+
error: `File size exceeds the 10MB limit: ${displayPath} (${fileSizeInMB.toFixed(2)}MB)`,
|
|
9722
10213
|
errorType: "file_too_large" /* FILE_TOO_LARGE */
|
|
9723
10214
|
};
|
|
9724
10215
|
}
|
|
@@ -9768,11 +10259,22 @@ async function processSingleFileContent(filePath, config, optionsOrOffset, legac
|
|
|
9768
10259
|
};
|
|
9769
10260
|
}
|
|
9770
10261
|
case "text": {
|
|
9771
|
-
const
|
|
10262
|
+
const fileSystemService = config.getFileSystemService();
|
|
10263
|
+
const maxOutputBytes = getRangeReadByteLimit(config);
|
|
10264
|
+
const readTextFileFromHandle = fileSystemService.readTextFileFromHandle;
|
|
10265
|
+
const { content, _meta } = options.textFileHandle ? await readTextFileFromHandle.call(fileSystemService, {
|
|
10266
|
+
fileHandle: options.textFileHandle,
|
|
10267
|
+
fileSize: stats.size,
|
|
10268
|
+
limit: limit ?? config.getTruncateToolOutputLines(),
|
|
10269
|
+
line: offset,
|
|
10270
|
+
maxOutputBytes,
|
|
10271
|
+
maxScanBytes: options.textFileMaxScanBytes ?? maxOutputBytes,
|
|
10272
|
+
...signal !== void 0 ? { signal } : {}
|
|
10273
|
+
}) : await fileSystemService.readTextFile({
|
|
9772
10274
|
path: filePath,
|
|
9773
10275
|
limit: limit ?? config.getTruncateToolOutputLines(),
|
|
9774
10276
|
line: offset,
|
|
9775
|
-
maxOutputBytes
|
|
10277
|
+
maxOutputBytes,
|
|
9776
10278
|
stats,
|
|
9777
10279
|
...signal !== void 0 ? { signal } : {}
|
|
9778
10280
|
});
|
|
@@ -9846,17 +10348,77 @@ async function processSingleFileContent(filePath, config, optionsOrOffset, legac
|
|
|
9846
10348
|
stats
|
|
9847
10349
|
};
|
|
9848
10350
|
}
|
|
9849
|
-
case "image":
|
|
10351
|
+
case "image": {
|
|
10352
|
+
if (shouldRenderImageOverview) {
|
|
10353
|
+
try {
|
|
10354
|
+
const view = await renderImageOverview(
|
|
10355
|
+
filePath,
|
|
10356
|
+
signal ?? new AbortController().signal
|
|
10357
|
+
);
|
|
10358
|
+
return {
|
|
10359
|
+
llmContent: [
|
|
10360
|
+
{
|
|
10361
|
+
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.`
|
|
10362
|
+
},
|
|
10363
|
+
{
|
|
10364
|
+
inlineData: {
|
|
10365
|
+
data: view.bytes.toString("base64"),
|
|
10366
|
+
mimeType: view.mimeType,
|
|
10367
|
+
displayName
|
|
10368
|
+
}
|
|
10369
|
+
}
|
|
10370
|
+
],
|
|
10371
|
+
returnDisplay: `Read image file: ${relativePathForDisplay}`
|
|
10372
|
+
};
|
|
10373
|
+
} catch (error) {
|
|
10374
|
+
signal?.throwIfAborted();
|
|
10375
|
+
if (error instanceof ImageViewError) {
|
|
10376
|
+
if (error.code === "source_too_large" || error.code === "output_too_large") {
|
|
10377
|
+
const userMessage = error.message.replace(`: ${filePath}`, "");
|
|
10378
|
+
return {
|
|
10379
|
+
llmContent: userMessage,
|
|
10380
|
+
returnDisplay: userMessage,
|
|
10381
|
+
error: error.message,
|
|
10382
|
+
errorType: "file_too_large" /* FILE_TOO_LARGE */
|
|
10383
|
+
};
|
|
10384
|
+
}
|
|
10385
|
+
} else {
|
|
10386
|
+
throw error;
|
|
10387
|
+
}
|
|
10388
|
+
}
|
|
10389
|
+
}
|
|
10390
|
+
const contentBuffer = await fs3.promises.readFile(filePath);
|
|
10391
|
+
const base64Data = contentBuffer.toString("base64");
|
|
10392
|
+
const base64SizeInMB = base64Data.length / (1024 * 1024);
|
|
10393
|
+
if (base64SizeInMB > 9.9) {
|
|
10394
|
+
return {
|
|
10395
|
+
llmContent: `File exceeds the 10MB data URI limit after base64 encoding (${base64SizeInMB.toFixed(2)}MB encoded).`,
|
|
10396
|
+
returnDisplay: `File exceeds the 10MB data URI limit after base64 encoding.`,
|
|
10397
|
+
error: `File exceeds the 10MB data URI limit after base64 encoding: ${displayPath} (${base64SizeInMB.toFixed(2)}MB encoded)`,
|
|
10398
|
+
errorType: "file_too_large" /* FILE_TOO_LARGE */
|
|
10399
|
+
};
|
|
10400
|
+
}
|
|
10401
|
+
return {
|
|
10402
|
+
llmContent: {
|
|
10403
|
+
inlineData: {
|
|
10404
|
+
data: base64Data,
|
|
10405
|
+
mimeType: mediaMimeType,
|
|
10406
|
+
displayName
|
|
10407
|
+
}
|
|
10408
|
+
},
|
|
10409
|
+
returnDisplay: `Read image file: ${relativePathForDisplay}`
|
|
10410
|
+
};
|
|
10411
|
+
}
|
|
9850
10412
|
case "audio":
|
|
9851
10413
|
case "video": {
|
|
9852
|
-
const contentBuffer = await
|
|
10414
|
+
const contentBuffer = await fs3.promises.readFile(filePath);
|
|
9853
10415
|
const base64Data = contentBuffer.toString("base64");
|
|
9854
10416
|
const base64SizeInMB = base64Data.length / (1024 * 1024);
|
|
9855
10417
|
if (base64SizeInMB > 9.9) {
|
|
9856
10418
|
return {
|
|
9857
10419
|
llmContent: `File exceeds the 10MB data URI limit after base64 encoding (${base64SizeInMB.toFixed(2)}MB encoded).`,
|
|
9858
10420
|
returnDisplay: `File exceeds the 10MB data URI limit after base64 encoding.`,
|
|
9859
|
-
error: `File exceeds the 10MB data URI limit after base64 encoding: ${
|
|
10421
|
+
error: `File exceeds the 10MB data URI limit after base64 encoding: ${displayPath} (${base64SizeInMB.toFixed(2)}MB encoded)`,
|
|
9860
10422
|
errorType: "file_too_large" /* FILE_TOO_LARGE */
|
|
9861
10423
|
};
|
|
9862
10424
|
}
|
|
@@ -9864,9 +10426,7 @@ async function processSingleFileContent(filePath, config, optionsOrOffset, legac
|
|
|
9864
10426
|
llmContent: {
|
|
9865
10427
|
inlineData: {
|
|
9866
10428
|
data: base64Data,
|
|
9867
|
-
mimeType:
|
|
9868
|
-
path2.extname(filePath).toLowerCase()
|
|
9869
|
-
) ?? "application/octet-stream",
|
|
10429
|
+
mimeType: mediaMimeType,
|
|
9870
10430
|
displayName
|
|
9871
10431
|
}
|
|
9872
10432
|
},
|
|
@@ -9875,14 +10435,14 @@ async function processSingleFileContent(filePath, config, optionsOrOffset, legac
|
|
|
9875
10435
|
}
|
|
9876
10436
|
case "pdf": {
|
|
9877
10437
|
if (!pageRange && modalities.pdf) {
|
|
9878
|
-
const contentBuffer = await
|
|
10438
|
+
const contentBuffer = await fs3.promises.readFile(filePath);
|
|
9879
10439
|
const base64Data = contentBuffer.toString("base64");
|
|
9880
10440
|
const base64SizeInMB = base64Data.length / (1024 * 1024);
|
|
9881
10441
|
if (base64SizeInMB > 9.9) {
|
|
9882
10442
|
return {
|
|
9883
10443
|
llmContent: `File exceeds the 10MB data URI limit after base64 encoding (${base64SizeInMB.toFixed(2)}MB encoded).`,
|
|
9884
10444
|
returnDisplay: `File exceeds the 10MB data URI limit after base64 encoding.`,
|
|
9885
|
-
error: `File exceeds the 10MB data URI limit after base64 encoding: ${
|
|
10445
|
+
error: `File exceeds the 10MB data URI limit after base64 encoding: ${displayPath} (${base64SizeInMB.toFixed(2)}MB encoded)`,
|
|
9886
10446
|
errorType: "file_too_large" /* FILE_TOO_LARGE */
|
|
9887
10447
|
};
|
|
9888
10448
|
}
|
|
@@ -10093,7 +10653,7 @@ async function processSingleFileContent(filePath, config, optionsOrOffset, legac
|
|
|
10093
10653
|
return {
|
|
10094
10654
|
llmContent: `Error parsing notebook ${relativePathForDisplay}: ${msg}`,
|
|
10095
10655
|
returnDisplay: `Error reading notebook: ${relativePathForDisplay}`,
|
|
10096
|
-
error: `Error parsing notebook ${
|
|
10656
|
+
error: `Error parsing notebook ${displayPath}: ${msg}`,
|
|
10097
10657
|
errorType: "read_content_failure" /* READ_CONTENT_FAILURE */
|
|
10098
10658
|
};
|
|
10099
10659
|
}
|
|
@@ -10103,7 +10663,7 @@ async function processSingleFileContent(filePath, config, optionsOrOffset, legac
|
|
|
10103
10663
|
return {
|
|
10104
10664
|
llmContent: `Unhandled file type: ${exhaustiveCheck}`,
|
|
10105
10665
|
returnDisplay: `Skipped unhandled file type: ${relativePathForDisplay}`,
|
|
10106
|
-
error: `Unhandled file type for ${
|
|
10666
|
+
error: `Unhandled file type for ${displayPath}`
|
|
10107
10667
|
};
|
|
10108
10668
|
}
|
|
10109
10669
|
}
|
|
@@ -10112,11 +10672,10 @@ async function processSingleFileContent(filePath, config, optionsOrOffset, legac
|
|
|
10112
10672
|
throw error;
|
|
10113
10673
|
}
|
|
10114
10674
|
const errorMessage = getErrorMessage(error);
|
|
10115
|
-
const displayPath = path2.relative(rootDirectory, filePath).replace(/\\/g, "/");
|
|
10116
10675
|
return {
|
|
10117
|
-
llmContent: `Error reading file ${
|
|
10118
|
-
returnDisplay: `Error reading file ${
|
|
10119
|
-
error: `Error reading file ${
|
|
10676
|
+
llmContent: `Error reading file ${relativePathForDisplay}: ${errorMessage}`,
|
|
10677
|
+
returnDisplay: `Error reading file ${relativePathForDisplay}: ${errorMessage}`,
|
|
10678
|
+
error: `Error reading file ${relativePathForDisplay}: ${errorMessage}`,
|
|
10120
10679
|
errorType: "read_content_failure" /* READ_CONTENT_FAILURE */
|
|
10121
10680
|
};
|
|
10122
10681
|
}
|
|
@@ -10125,7 +10684,7 @@ __name(processSingleFileContent, "processSingleFileContent");
|
|
|
10125
10684
|
function getRangeReadByteLimit(config) {
|
|
10126
10685
|
const charLimit = config.getTruncateToolOutputThreshold();
|
|
10127
10686
|
if (charLimit === Number.POSITIVE_INFINITY) {
|
|
10128
|
-
return Number.
|
|
10687
|
+
return Number.MAX_SAFE_INTEGER;
|
|
10129
10688
|
}
|
|
10130
10689
|
if (!Number.isFinite(charLimit)) {
|
|
10131
10690
|
return DEFAULT_RANGE_READ_BYTES;
|
|
@@ -10142,7 +10701,7 @@ function normalizeRangeReadByteLimit(maxOutputBytes) {
|
|
|
10142
10701
|
__name(normalizeRangeReadByteLimit, "normalizeRangeReadByteLimit");
|
|
10143
10702
|
async function fileExists(filePath) {
|
|
10144
10703
|
try {
|
|
10145
|
-
await fsPromises.access(filePath,
|
|
10704
|
+
await fsPromises.access(filePath, fs3.constants.F_OK);
|
|
10146
10705
|
return true;
|
|
10147
10706
|
} catch (_) {
|
|
10148
10707
|
return false;
|
|
@@ -10287,7 +10846,7 @@ var import_https_proxy_agent = __toESM(require_dist(), 1);
|
|
|
10287
10846
|
import { Buffer as Buffer2 } from "buffer";
|
|
10288
10847
|
import * as https from "https";
|
|
10289
10848
|
import * as os2 from "node:os";
|
|
10290
|
-
import
|
|
10849
|
+
import fs4 from "node:fs";
|
|
10291
10850
|
import path4 from "node:path";
|
|
10292
10851
|
|
|
10293
10852
|
// packages/core/src/telemetry/sanitize.ts
|
|
@@ -10492,8 +11051,8 @@ var QwenLogger = class _QwenLogger {
|
|
|
10492
11051
|
const legacyPath = path4.join(os2.homedir(), ".qwen", "source.json");
|
|
10493
11052
|
const candidates = path4.normalize(sourceJsonPath) !== path4.normalize(legacyPath) ? [sourceJsonPath, legacyPath] : [sourceJsonPath];
|
|
10494
11053
|
for (const candidate of candidates) {
|
|
10495
|
-
if (
|
|
10496
|
-
const sourceJsonContent =
|
|
11054
|
+
if (fs4.existsSync(candidate)) {
|
|
11055
|
+
const sourceJsonContent = fs4.readFileSync(candidate, "utf8");
|
|
10497
11056
|
const sourceData = JSON.parse(sourceJsonContent);
|
|
10498
11057
|
if (sourceData && typeof sourceData === "object" && sourceData.source && sourceData.source !== "unknown") {
|
|
10499
11058
|
return sourceData.source;
|
|
@@ -10669,6 +11228,8 @@ var QwenLogger = class _QwenLogger {
|
|
|
10669
11228
|
response_id: event.response_id,
|
|
10670
11229
|
tool_name: event.function_name,
|
|
10671
11230
|
permission: event.decision,
|
|
11231
|
+
status: event.status,
|
|
11232
|
+
tool_type: event.tool_type,
|
|
10672
11233
|
success: event.success ? 1 : 0,
|
|
10673
11234
|
duration_ms: event.duration_ms,
|
|
10674
11235
|
error_type: event.error_type,
|
|
@@ -10966,6 +11527,24 @@ var QwenLogger = class _QwenLogger {
|
|
|
10966
11527
|
this.enqueueLogEvent(rumEvent);
|
|
10967
11528
|
this.flushIfNeeded();
|
|
10968
11529
|
}
|
|
11530
|
+
logRipgrepRuntimeRecoveryEvent(event) {
|
|
11531
|
+
const rumEvent = this.createActionEvent(
|
|
11532
|
+
"misc",
|
|
11533
|
+
"ripgrep_runtime_recovery",
|
|
11534
|
+
{
|
|
11535
|
+
properties: {
|
|
11536
|
+
platform: process.platform,
|
|
11537
|
+
arch: process.arch,
|
|
11538
|
+
selection_mode: event.selection_mode,
|
|
11539
|
+
retry_triggered: event.retry_triggered,
|
|
11540
|
+
...event.retry_succeeded !== void 0 ? { retry_succeeded: event.retry_succeeded } : {},
|
|
11541
|
+
failure_kind: event.failure_kind
|
|
11542
|
+
}
|
|
11543
|
+
}
|
|
11544
|
+
);
|
|
11545
|
+
this.enqueueLogEvent(rumEvent);
|
|
11546
|
+
this.flushIfNeeded();
|
|
11547
|
+
}
|
|
10969
11548
|
logLoopDetectionDisabledEvent() {
|
|
10970
11549
|
const rumEvent = this.createActionEvent(
|
|
10971
11550
|
"misc",
|
|
@@ -11545,7 +12124,7 @@ import { randomUUID } from "node:crypto";
|
|
|
11545
12124
|
|
|
11546
12125
|
// packages/core/src/utils/jsonl-utils.ts
|
|
11547
12126
|
init_esbuild_shims();
|
|
11548
|
-
import
|
|
12127
|
+
import fs5 from "node:fs";
|
|
11549
12128
|
import path5 from "node:path";
|
|
11550
12129
|
import readline from "node:readline";
|
|
11551
12130
|
import { finished } from "node:stream/promises";
|
|
@@ -11637,7 +12216,7 @@ async function readLines(filePath, count) {
|
|
|
11637
12216
|
let fileStream;
|
|
11638
12217
|
let rl;
|
|
11639
12218
|
try {
|
|
11640
|
-
fileStream =
|
|
12219
|
+
fileStream = fs5.createReadStream(filePath);
|
|
11641
12220
|
rl = readline.createInterface({
|
|
11642
12221
|
input: fileStream,
|
|
11643
12222
|
crlfDelay: Infinity
|
|
@@ -11670,7 +12249,7 @@ async function read(filePath, options = {}) {
|
|
|
11670
12249
|
let fileStream;
|
|
11671
12250
|
let rl;
|
|
11672
12251
|
try {
|
|
11673
|
-
fileStream =
|
|
12252
|
+
fileStream = fs5.createReadStream(filePath);
|
|
11674
12253
|
rl = readline.createInterface({
|
|
11675
12254
|
input: fileStream,
|
|
11676
12255
|
crlfDelay: Infinity
|
|
@@ -11705,10 +12284,10 @@ async function writeLine(filePath, data) {
|
|
|
11705
12284
|
`;
|
|
11706
12285
|
const dir = path5.dirname(filePath);
|
|
11707
12286
|
if (!ensuredDirs.has(dir)) {
|
|
11708
|
-
await
|
|
12287
|
+
await fs5.promises.mkdir(dir, { recursive: true });
|
|
11709
12288
|
ensuredDirs.add(dir);
|
|
11710
12289
|
}
|
|
11711
|
-
await
|
|
12290
|
+
await fs5.promises.appendFile(filePath, Buffer.from(line, "utf8"), {
|
|
11712
12291
|
flush: true
|
|
11713
12292
|
});
|
|
11714
12293
|
});
|
|
@@ -11718,15 +12297,15 @@ function writeLineSync(filePath, data) {
|
|
|
11718
12297
|
const line = `${JSON.stringify(data)}
|
|
11719
12298
|
`;
|
|
11720
12299
|
const dir = path5.dirname(filePath);
|
|
11721
|
-
if (!
|
|
11722
|
-
|
|
12300
|
+
if (!fs5.existsSync(dir)) {
|
|
12301
|
+
fs5.mkdirSync(dir, { recursive: true });
|
|
11723
12302
|
}
|
|
11724
|
-
|
|
12303
|
+
fs5.appendFileSync(filePath, Buffer.from(line, "utf8"), { flush: true });
|
|
11725
12304
|
}
|
|
11726
12305
|
__name(writeLineSync, "writeLineSync");
|
|
11727
12306
|
function exists(filePath) {
|
|
11728
12307
|
try {
|
|
11729
|
-
const stats =
|
|
12308
|
+
const stats = fs5.statSync(filePath);
|
|
11730
12309
|
return stats.isFile() && stats.size > 0;
|
|
11731
12310
|
} catch {
|
|
11732
12311
|
return false;
|
|
@@ -12217,42 +12796,55 @@ function logUserRetry(config, event) {
|
|
|
12217
12796
|
logger.emit(logRecord);
|
|
12218
12797
|
}
|
|
12219
12798
|
__name(logUserRetry, "logUserRetry");
|
|
12799
|
+
function normalizeToolCallEvent(event) {
|
|
12800
|
+
const isError = event.status === "error";
|
|
12801
|
+
return {
|
|
12802
|
+
...event,
|
|
12803
|
+
function_name: event.function_name.trim().length > 0 ? event.function_name : "unknown_tool",
|
|
12804
|
+
success: event.status === "success",
|
|
12805
|
+
error: isError ? event.error : void 0,
|
|
12806
|
+
error_type: isError ? event.error_type?.trim() ? event.error_type : "unknown" /* UNKNOWN */ : void 0
|
|
12807
|
+
};
|
|
12808
|
+
}
|
|
12809
|
+
__name(normalizeToolCallEvent, "normalizeToolCallEvent");
|
|
12220
12810
|
function logToolCall(config, event) {
|
|
12811
|
+
const normalizedEvent = normalizeToolCallEvent(event);
|
|
12221
12812
|
const uiEvent = {
|
|
12222
|
-
...
|
|
12813
|
+
...normalizedEvent,
|
|
12223
12814
|
"event.name": EVENT_TOOL_CALL,
|
|
12224
12815
|
"event.timestamp": (/* @__PURE__ */ new Date()).toISOString()
|
|
12225
12816
|
};
|
|
12226
12817
|
uiTelemetryService.addEvent(uiEvent, config.getSessionId());
|
|
12227
|
-
if (!isInternalPromptId(
|
|
12818
|
+
if (!isInternalPromptId(normalizedEvent.prompt_id)) {
|
|
12228
12819
|
recordUiTelemetryEventToChat(config, uiEvent);
|
|
12229
12820
|
}
|
|
12230
|
-
QwenLogger.getInstance(config)?.logToolCallEvent(
|
|
12821
|
+
QwenLogger.getInstance(config)?.logToolCallEvent(normalizedEvent);
|
|
12231
12822
|
if (!isTelemetrySdkInitialized()) return;
|
|
12232
12823
|
const attributes = {
|
|
12233
12824
|
...getCommonAttributes(config),
|
|
12234
|
-
...
|
|
12825
|
+
...normalizedEvent,
|
|
12235
12826
|
"event.name": EVENT_TOOL_CALL,
|
|
12236
12827
|
"event.timestamp": (/* @__PURE__ */ new Date()).toISOString(),
|
|
12237
|
-
function_args: safeJsonStringify(
|
|
12828
|
+
function_args: safeJsonStringify(normalizedEvent.function_args, 2)
|
|
12238
12829
|
};
|
|
12239
|
-
if (
|
|
12240
|
-
attributes["error.message"] =
|
|
12241
|
-
|
|
12242
|
-
|
|
12243
|
-
|
|
12830
|
+
if (normalizedEvent.error) {
|
|
12831
|
+
attributes["error.message"] = normalizedEvent.error;
|
|
12832
|
+
}
|
|
12833
|
+
if (normalizedEvent.error_type) {
|
|
12834
|
+
attributes["error.type"] = normalizedEvent.error_type;
|
|
12244
12835
|
}
|
|
12245
12836
|
const logger = import_api_logs.logs.getLogger(SERVICE_NAME);
|
|
12246
12837
|
const logRecord = {
|
|
12247
|
-
body: `Tool call: ${
|
|
12838
|
+
body: `Tool call: ${normalizedEvent.function_name}${normalizedEvent.decision ? `. Decision: ${normalizedEvent.decision}` : ""}. Success: ${normalizedEvent.success}. Duration: ${normalizedEvent.duration_ms}ms.`,
|
|
12248
12839
|
attributes
|
|
12249
12840
|
};
|
|
12250
12841
|
logger.emit(logRecord);
|
|
12251
|
-
recordToolCallMetrics(config,
|
|
12252
|
-
function_name:
|
|
12253
|
-
|
|
12254
|
-
|
|
12255
|
-
|
|
12842
|
+
recordToolCallMetrics(config, normalizedEvent.duration_ms, {
|
|
12843
|
+
function_name: normalizedEvent.function_name,
|
|
12844
|
+
status: normalizedEvent.status,
|
|
12845
|
+
success: normalizedEvent.success,
|
|
12846
|
+
decision: normalizedEvent.decision,
|
|
12847
|
+
tool_type: normalizedEvent.tool_type
|
|
12256
12848
|
});
|
|
12257
12849
|
}
|
|
12258
12850
|
__name(logToolCall, "logToolCall");
|
|
@@ -12345,6 +12937,23 @@ function logRipgrepFallback(config, event) {
|
|
|
12345
12937
|
logger.emit(logRecord);
|
|
12346
12938
|
}
|
|
12347
12939
|
__name(logRipgrepFallback, "logRipgrepFallback");
|
|
12940
|
+
function logRipgrepRuntimeRecovery(config, event) {
|
|
12941
|
+
QwenLogger.getInstance(config)?.logRipgrepRuntimeRecoveryEvent(event);
|
|
12942
|
+
if (!isTelemetrySdkInitialized()) return;
|
|
12943
|
+
const attributes = {
|
|
12944
|
+
...getCommonAttributes(config),
|
|
12945
|
+
...event,
|
|
12946
|
+
"event.name": EVENT_RIPGREP_RUNTIME_RECOVERY,
|
|
12947
|
+
"event.timestamp": (/* @__PURE__ */ new Date()).toISOString()
|
|
12948
|
+
};
|
|
12949
|
+
const logger = import_api_logs.logs.getLogger(SERVICE_NAME);
|
|
12950
|
+
const logRecord = {
|
|
12951
|
+
body: `Ripgrep runtime recovery: ${event.failure_kind}.`,
|
|
12952
|
+
attributes
|
|
12953
|
+
};
|
|
12954
|
+
logger.emit(logRecord);
|
|
12955
|
+
}
|
|
12956
|
+
__name(logRipgrepRuntimeRecovery, "logRipgrepRuntimeRecovery");
|
|
12348
12957
|
function logApiError(config, event) {
|
|
12349
12958
|
const uiEvent = {
|
|
12350
12959
|
...event,
|
|
@@ -13137,7 +13746,7 @@ init_esbuild_shims();
|
|
|
13137
13746
|
|
|
13138
13747
|
// packages/core/src/utils/truncation.ts
|
|
13139
13748
|
init_esbuild_shims();
|
|
13140
|
-
import * as
|
|
13749
|
+
import * as fs6 from "node:fs/promises";
|
|
13141
13750
|
import * as path7 from "node:path";
|
|
13142
13751
|
import * as crypto from "node:crypto";
|
|
13143
13752
|
var debugLogger5 = createDebugLogger("TRUNCATION");
|
|
@@ -13220,8 +13829,8 @@ ${truncatedContent}`;
|
|
|
13220
13829
|
return { content };
|
|
13221
13830
|
}
|
|
13222
13831
|
try {
|
|
13223
|
-
await
|
|
13224
|
-
await
|
|
13832
|
+
await fs6.mkdir(projectTempDir, { recursive: true });
|
|
13833
|
+
await fs6.writeFile(outputFile, content, { mode: 384 });
|
|
13225
13834
|
return {
|
|
13226
13835
|
content: wrappedMessage,
|
|
13227
13836
|
outputFile
|
|
@@ -13371,7 +13980,7 @@ async function persistAndTruncateToolResult(callId, toolName, content, config) {
|
|
|
13371
13980
|
try {
|
|
13372
13981
|
const toolResultsDir = config.storage.getToolResultsDir();
|
|
13373
13982
|
const outputFile = path7.join(toolResultsDir, `${safeCallId}.txt`);
|
|
13374
|
-
await
|
|
13983
|
+
await fs6.mkdir(toolResultsDir, { recursive: true });
|
|
13375
13984
|
await atomicWriteFile(outputFile, content, {
|
|
13376
13985
|
mode: 384,
|
|
13377
13986
|
forceMode: true,
|
|
@@ -14520,6 +15129,27 @@ var RipgrepFallbackEvent = class {
|
|
|
14520
15129
|
this.error = error;
|
|
14521
15130
|
}
|
|
14522
15131
|
};
|
|
15132
|
+
var RipgrepRuntimeRecoveryEvent = class {
|
|
15133
|
+
static {
|
|
15134
|
+
__name(this, "RipgrepRuntimeRecoveryEvent");
|
|
15135
|
+
}
|
|
15136
|
+
"event.name";
|
|
15137
|
+
"event.timestamp";
|
|
15138
|
+
selection_mode;
|
|
15139
|
+
retry_triggered;
|
|
15140
|
+
retry_succeeded;
|
|
15141
|
+
failure_kind;
|
|
15142
|
+
constructor(params) {
|
|
15143
|
+
this["event.name"] = "ripgrep_runtime_recovery";
|
|
15144
|
+
this["event.timestamp"] = (/* @__PURE__ */ new Date()).toISOString();
|
|
15145
|
+
this.selection_mode = params.selection_mode;
|
|
15146
|
+
this.retry_triggered = params.retry_triggered;
|
|
15147
|
+
if (params.retry_succeeded !== void 0) {
|
|
15148
|
+
this.retry_succeeded = params.retry_succeeded;
|
|
15149
|
+
}
|
|
15150
|
+
this.failure_kind = params.failure_kind;
|
|
15151
|
+
}
|
|
15152
|
+
};
|
|
14523
15153
|
var LoopDetectedEvent = class {
|
|
14524
15154
|
static {
|
|
14525
15155
|
__name(this, "LoopDetectedEvent");
|
|
@@ -15926,7 +16556,7 @@ var ReadFileToolInvocation = class extends BaseToolInvocation {
|
|
|
15926
16556
|
const isFullRead = this.params.offset === void 0 && this.params.limit === void 0 && this.params.pages === void 0;
|
|
15927
16557
|
let stats;
|
|
15928
16558
|
try {
|
|
15929
|
-
stats = await
|
|
16559
|
+
stats = await fs7.stat(absPath);
|
|
15930
16560
|
} catch (err) {
|
|
15931
16561
|
debugLogger8.debug("stat-failed", {
|
|
15932
16562
|
path: absPath,
|
|
@@ -15992,7 +16622,7 @@ ${result.llmContent}`;
|
|
|
15992
16622
|
}
|
|
15993
16623
|
if (typeof llmContent === "string" && isAutoMem) {
|
|
15994
16624
|
try {
|
|
15995
|
-
const memStat = stats ?? await
|
|
16625
|
+
const memStat = stats ?? await fs7.stat(absPath);
|
|
15996
16626
|
const note = memoryFreshnessNote(memStat.mtimeMs);
|
|
15997
16627
|
if (note) {
|
|
15998
16628
|
llmContent = note + llmContent;
|
|
@@ -16305,6 +16935,7 @@ export {
|
|
|
16305
16935
|
logFileOperation,
|
|
16306
16936
|
logApiRequest,
|
|
16307
16937
|
logRipgrepFallback,
|
|
16938
|
+
logRipgrepRuntimeRecovery,
|
|
16308
16939
|
logApiError,
|
|
16309
16940
|
logApiCancel,
|
|
16310
16941
|
logApiResponse,
|
|
@@ -16367,10 +16998,18 @@ export {
|
|
|
16367
16998
|
inferInsertedCellSourceArrayStyle,
|
|
16368
16999
|
toNotebookSource,
|
|
16369
17000
|
normalizeEditedCell,
|
|
17001
|
+
CursorNotAtLineBoundaryError,
|
|
17002
|
+
LargeNonUtf8TextError,
|
|
17003
|
+
TextScanBudgetExceededError,
|
|
17004
|
+
readTextRangeFromHandle,
|
|
17005
|
+
readTextCursorWindowFromHandle,
|
|
17006
|
+
ImageViewError,
|
|
17007
|
+
renderNormalizedImageCrop,
|
|
16370
17008
|
decodeBufferWithEncodingInfoAsync,
|
|
16371
17009
|
readFileWithLineAndLimit,
|
|
16372
17010
|
getSpecificMimeType,
|
|
16373
17011
|
isWithinRoot,
|
|
17012
|
+
detectFileType,
|
|
16374
17013
|
isCacheableReadResult,
|
|
16375
17014
|
processSingleFileContent,
|
|
16376
17015
|
fileExists,
|
|
@@ -16408,6 +17047,7 @@ export {
|
|
|
16408
17047
|
ApiCancelEvent,
|
|
16409
17048
|
ApiResponseEvent,
|
|
16410
17049
|
RipgrepFallbackEvent,
|
|
17050
|
+
RipgrepRuntimeRecoveryEvent,
|
|
16411
17051
|
LoopDetectedEvent,
|
|
16412
17052
|
LoopDetectionDisabledEvent,
|
|
16413
17053
|
NextSpeakerCheckEvent,
|
|
@@ -16459,6 +17099,11 @@ export {
|
|
|
16459
17099
|
* Copyright 2025 Qwen Team
|
|
16460
17100
|
* SPDX-License-Identifier: Apache-2.0
|
|
16461
17101
|
*/
|
|
17102
|
+
/**
|
|
17103
|
+
* @license
|
|
17104
|
+
* Copyright 2026 Qwen
|
|
17105
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
17106
|
+
*/
|
|
16462
17107
|
/**
|
|
16463
17108
|
* @license
|
|
16464
17109
|
* Copyright 2025 Qwen Team
|