@qwen-code/qwen-code 0.19.6-nightly.20260707.bcdb44c5d → 0.19.6-preview.0
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/features/channels/_meta.ts +1 -0
- package/bundled/qc-helper/docs/features/channels/overview.md +17 -9
- package/bundled/qc-helper/docs/features/channels/wecom.md +111 -0
- package/bundled/qc-helper/docs/features/code-review.md +0 -4
- package/bundled/review/DESIGN.md +0 -4
- package/bundled/review/SKILL.md +2 -29
- package/chunks/{MaxSizedBox-EFDCCPYQ.js → MaxSizedBox-2JOX4MMR.js} +11 -9
- package/chunks/{StandaloneSessionPicker-5TQG34MY.js → StandaloneSessionPicker-Z2G37ETA.js} +24 -21
- package/chunks/{acpAgent-KQT52XWB.js → acpAgent-MQJT2H4Y.js} +74 -49
- package/chunks/{agent-RL2YOM2V.js → agent-HEVJ76EO.js} +6 -6
- package/chunks/{agent-headless-SCVFLRZ3.js → agent-headless-UNB5SWYC.js} +6 -6
- package/chunks/{anthropicContentGenerator-PPPLABT5.js → anthropicContentGenerator-AKYPSZIV.js} +3 -3
- package/chunks/{artifact-tool-H2TNPNP5.js → artifact-tool-D233YJFH.js} +25 -6
- package/chunks/{bridge-G3LFYH2D.js → bridge-GX2LGQDS.js} +11 -9
- package/chunks/{channel-worker-supervisor-B7MSMB5K.js → channel-worker-supervisor-CRCVYQIE.js} +1 -1
- package/chunks/{chunk-XUYYEFCM.js → chunk-27QGW3BK.js} +5 -5
- package/chunks/{chunk-HLJMZYTD.js → chunk-2D5Q33PT.js} +3 -3
- package/chunks/{chunk-TNIZ2HCQ.js → chunk-2MDHTI6A.js} +2 -2
- package/chunks/{chunk-VCKMHAEZ.js → chunk-2MJAXDFK.js} +6 -6
- package/chunks/{chunk-WSVZFWN4.js → chunk-2NPS2UDH.js} +305 -97
- package/chunks/{chunk-WAVK7GV6.js → chunk-2X3ZVAAT.js} +2 -2
- package/chunks/chunk-332PWN27.js +19 -0
- package/chunks/{chunk-FVMWEHWU.js → chunk-3B26UVCX.js} +114 -12
- package/chunks/{chunk-XZ2LJL4O.js → chunk-43W4YSO6.js} +1 -12
- package/chunks/{chunk-DLHOIROF.js → chunk-44NROQYV.js} +4 -2
- package/chunks/{chunk-65P5ZXUE.js → chunk-4XV2MRNK.js} +1 -1
- package/chunks/{chunk-DS6NG7SB.js → chunk-5HMMLTUD.js} +11 -11
- package/chunks/{chunk-A2CS67WK.js → chunk-5IGNZP2J.js} +1 -1
- package/chunks/{chunk-N7BUPX4V.js → chunk-6GHEZDDX.js} +1 -1
- package/chunks/{chunk-QU6OLW25.js → chunk-7O6DD2ES.js} +1 -1
- package/chunks/{chunk-RXDYWLOG.js → chunk-7R62CLMI.js} +4 -4
- package/chunks/{chunk-2BJWUJCW.js → chunk-7SAH6M3Y.js} +3 -3
- package/chunks/{chunk-OGAC66WF.js → chunk-7VCI24VZ.js} +4 -107
- package/chunks/chunk-A2X3KLC3.js +3807 -0
- package/chunks/chunk-A3ZQMFO6.js +949 -0
- package/chunks/{chunk-AY7CP32Q.js → chunk-A7UKINBT.js} +7 -7
- package/chunks/{chunk-72DDO73Z.js → chunk-ADO6IDOZ.js} +8 -8
- package/chunks/{chunk-UOGOM4NJ.js → chunk-AJ3CEJRJ.js} +10 -5
- package/chunks/{chunk-NCFY7PWS.js → chunk-CCGOFQV3.js} +51 -2
- package/chunks/{chunk-YFE4YEDW.js → chunk-DB7CZERZ.js} +1 -1
- package/chunks/{chunk-UECJ7AG2.js → chunk-DF74IL3R.js} +4 -4
- package/chunks/{chunk-7YLLBKDB.js → chunk-FCEHOKYP.js} +5 -5
- package/chunks/{chunk-JO6RDLLE.js → chunk-FRR5I3SQ.js} +1 -1
- package/chunks/{chunk-2NL7ED5Q.js → chunk-FV7425LN.js} +22 -1
- package/chunks/{chunk-NCOLCOA6.js → chunk-GPLKAQUX.js} +8 -8
- package/chunks/{chunk-AKGA72ZM.js → chunk-GV2S4F6Q.js} +5 -3
- package/chunks/{chunk-V63Q7BVE.js → chunk-GW67O5SO.js} +1 -1
- package/chunks/{chunk-2A6XOMBQ.js → chunk-HW4N45EE.js} +0 -44
- package/chunks/{chunk-S6PM5JQZ.js → chunk-IFDJAMJW.js} +484 -1222
- package/chunks/{chunk-B2FUQ22Z.js → chunk-ILFQAFWH.js} +1 -1
- package/chunks/chunk-JYFZFWSL.js +167 -0
- package/chunks/{chunk-CA373SPN.js → chunk-K56RTEBN.js} +1 -1
- package/chunks/chunk-LGFAYIKX.js +115 -0
- package/chunks/{chunk-6JESGXWU.js → chunk-LLTFLVFK.js} +4 -4
- package/chunks/{chunk-3A4MUHRP.js → chunk-MZWODTEA.js} +5 -13
- package/chunks/{chunk-IPKM25FZ.js → chunk-N33JAGJ7.js} +505 -62
- package/chunks/{chunk-B2NCNYBK.js → chunk-NVQVIJMO.js} +112 -42
- package/chunks/{chunk-INNPK6XG.js → chunk-O6T7PBUM.js} +30 -6
- package/chunks/{chunk-RN36CE4M.js → chunk-P452E6XF.js} +2 -2
- package/chunks/chunk-PS2NG7KU.js +262 -0
- package/chunks/{chunk-FTEFJT6V.js → chunk-QM4FKX7H.js} +2 -2
- package/chunks/chunk-RODQXLGZ.js +28 -0
- package/chunks/{chunk-KSPVDFE4.js → chunk-SAIILPQ3.js} +0 -3
- package/chunks/{chunk-EKDTGEX4.js → chunk-SJ3QRPN2.js} +14 -8
- package/chunks/{chunk-R57UD732.js → chunk-SKO6VJHG.js} +16 -4
- package/chunks/{chunk-66KNL43D.js → chunk-TBAZMRW3.js} +1 -1
- package/chunks/{chunk-H2UZO2II.js → chunk-TPTG52XG.js} +1 -1
- package/chunks/chunk-UIDXQNMV.js +13 -0
- package/chunks/chunk-VP2FB7OC.js +8223 -0
- package/chunks/{chunk-32KIF557.js → chunk-WKBA74DD.js} +1 -1
- package/chunks/{chunk-IEFMDFCG.js → chunk-WKTLDGD6.js} +1 -1
- package/chunks/{chunk-HT553O4R.js → chunk-WRLMLPWI.js} +3 -3
- package/chunks/{chunk-CYXPEKVN.js → chunk-XXICIIS5.js} +5 -5
- package/chunks/{chunk-5GSUPP7K.js → chunk-Y3QQV7WE.js} +2 -2
- package/chunks/{chunk-CKBRK552.js → chunk-ZKX7IBXU.js} +4 -4
- package/chunks/{chunk-CCPKBMZ4.js → chunk-ZOSL7K3L.js} +203 -38
- package/chunks/{chunk-KD4KV6XW.js → chunk-ZWFS7YCB.js} +4505 -3850
- package/chunks/{computer-use-NKJX6RTG.js → computer-use-IQ46C3YP.js} +6 -6
- package/chunks/{contextCommand-BCABFW4A.js → contextCommand-TTT6AP2W.js} +10 -9
- package/chunks/{cron-create-DDYU4DIR.js → cron-create-JSXEIPVS.js} +1 -1
- package/chunks/{cron-delete-DFKOUZWN.js → cron-delete-OIFVEPGU.js} +1 -1
- package/chunks/{cron-list-ME5QGAR5.js → cron-list-D4ZX4IOE.js} +1 -1
- package/chunks/{daemon-XWG2EGFX.js → daemon-F3I2RXP6.js} +23 -3
- package/chunks/{daemon-status-provider-V7BMA4EH.js → daemon-status-provider-5GAWK65R.js} +13 -12
- package/chunks/dist-573HNSVO.js +3217 -0
- package/chunks/{dist-VHBP2PIG.js → dist-FQ5WRJPL.js} +2 -2
- package/chunks/{dist-LPVU3L2M.js → dist-IMFFBMAT.js} +6 -3792
- package/chunks/{dist-7GU63KI5.js → dist-OT7G2WNM.js} +1 -1
- package/chunks/{dist-H4HHZYCI.js → dist-PKFTNUHO.js} +2 -2
- package/chunks/{dist-3UDX5T4T.js → dist-YTRKAVUB.js} +1 -1
- package/chunks/{earlyInputCapture-TVECMHWI.js → earlyInputCapture-LAGZUGGV.js} +6 -6
- package/chunks/{edit-VKUCEX2N.js → edit-Q5BUQC2S.js} +6 -6
- package/chunks/{en-AXARKOWO.js → en-GA2RMXY5.js} +5 -1
- package/chunks/{enter-worktree-TF6N7GA7.js → enter-worktree-DC4FHMVF.js} +6 -6
- package/chunks/{enterPlanMode-XXQGZP5T.js → enterPlanMode-5BGJBWIY.js} +6 -6
- package/chunks/{errors-LLC2B5D6.js → errors-EGX5DECS.js} +8 -8
- package/chunks/{exit-worktree-YBOMMZLI.js → exit-worktree-2EOSZNZI.js} +6 -6
- package/chunks/{exitPlanMode-74D7EOBH.js → exitPlanMode-JAQ35ELJ.js} +6 -6
- package/chunks/{fast-path-OGY4P74O.js → fast-path-QEWDA6O6.js} +5 -2
- package/chunks/{fr-MBMNQSQ6.js → fr-GWNQG4XH.js} +4 -0
- package/chunks/{gemini-IL6H4VNW.js → gemini-TQ5XANRS.js} +64 -187
- package/chunks/{geminiContentGenerator-O7OCAUQU.js → geminiContentGenerator-DCM2XGDQ.js} +1 -1
- package/chunks/{glob-X5XFJTAC.js → glob-7JLTQ4IQ.js} +6 -6
- package/chunks/{grep-53GLRSNS.js → grep-CAUXEO7Q.js} +6 -6
- package/chunks/handleAutoUpdate-XKXULZQX.js +65 -0
- package/chunks/{initializer-YBUEYP6D.js → initializer-3NRWU5JV.js} +12 -10
- package/chunks/{ja-HFV5QCHR.js → ja-2HOTA47X.js} +4 -0
- package/chunks/{list-2F3FSN46.js → list-NWO6QBDQ.js} +12 -12
- package/chunks/{loadedSettingsAdapter-AJBE627U.js → loadedSettingsAdapter-PJ77LGFS.js} +10 -10
- package/chunks/{loop-wakeup-ZW5P6VPY.js → loop-wakeup-OHWEMFP5.js} +2 -2
- package/chunks/{mcp-SEE2Z7TA.js → mcp-VFEHVF5A.js} +10 -10
- package/chunks/{monitor-YQW2M3DL.js → monitor-FY2ITVSC.js} +14 -9
- package/chunks/{nonInteractiveCli-TGWJDY47.js → nonInteractiveCli-KPCXTVWY.js} +41 -36
- package/chunks/{notebook-edit-O5G3EBYN.js → notebook-edit-BSJMXIWX.js} +6 -6
- package/chunks/{openaiContentGenerator-WAO7PPR6.js → openaiContentGenerator-BA6NWY4S.js} +5 -5
- package/chunks/{pidfile-XMDB2SF7.js → pidfile-WXMRN6QF.js} +6 -6
- package/chunks/{qwenContentGenerator-5NZ5EHRA.js → qwenContentGenerator-U4ZSLGFN.js} +8 -8
- package/chunks/{read-file-KJTMBLFF.js → read-file-VMVHNOMA.js} +2 -2
- package/chunks/{ripGrep-BCDYVQQR.js → ripGrep-NC6MUWXN.js} +6 -6
- package/chunks/{run-qwen-serve-LIWM3CMV.js → run-qwen-serve-NQH6LQTH.js} +124 -31
- package/chunks/{scheduler-VETDW3HX.js → scheduler-35T3E2UQ.js} +6 -6
- package/chunks/{serve-XKFTUZET.js → serve-C36LOB5N.js} +10 -10
- package/chunks/{server-W64GXOEJ.js → server-TDFPIDC3.js} +858 -105
- package/chunks/{session-GXNRZGVF.js → session-STHNQGRJ.js} +42 -37
- package/chunks/{settings-TIQCDHBZ.js → settings-GIE22AYF.js} +9 -9
- package/chunks/{shell-3ZZLLA35.js → shell-JD52AIMU.js} +6 -6
- package/chunks/{skill-TOX5QGBX.js → skill-L4IFKRQ5.js} +14 -4
- package/chunks/{spawnChannel-JBLAIP7L.js → spawnChannel-HGMOEPM7.js} +8 -8
- package/chunks/{src-Q7BIRWUP.js → src-3SNF3G3V.js} +15 -7
- package/chunks/{startInteractiveUI-PP72WI64.js → startInteractiveUI-C7DCDHGF.js} +4981 -13173
- package/chunks/{team-create-S44Z3N62.js → team-create-NYL7KAMA.js} +6 -6
- package/chunks/{team-plan-approval-2YPLSLO5.js → team-plan-approval-LH65JBEH.js} +6 -6
- package/chunks/{theme-manager-4MJVYHPB.js → theme-manager-ANKQO5DR.js} +6 -6
- package/chunks/{tool-search-4LSRQ24Z.js → tool-search-WZEGJFO4.js} +4 -21
- package/chunks/{trustedFolders-XMKLRQDH.js → trustedFolders-HECAG3S3.js} +7 -7
- package/chunks/updateCheck-72BBAE5V.js +65 -0
- package/chunks/{validateNonInterActiveAuth-MMMRF6WS.js → validateNonInterActiveAuth-PDQCPSNA.js} +38 -33
- package/chunks/{version-6HMEMR4K.js → version-VSEUTPNM.js} +2 -1
- package/chunks/{workflow-VYBLLOLC.js → workflow-DPF2CL7U.js} +7 -7
- package/chunks/{workspace-providers-status-5LSCQPWQ.js → workspace-providers-status-TQ23DQ2D.js} +12 -12
- package/chunks/{workspace-service-HBMBWJ4K.js → workspace-service-D34UDMEY.js} +14 -14
- package/chunks/{workspace-skills-status-TLBAQWKQ.js → workspace-skills-status-4DR5UNNC.js} +11 -11
- package/chunks/{write-file-QMAWLWCT.js → write-file-VFNAKGYM.js} +6 -6
- package/chunks/{zh-RS3HZHFH.js → zh-7XVVRTDH.js} +5 -1
- package/chunks/{zh-TW-L5GRQ4S4.js → zh-TW-DPH554OG.js} +5 -1
- package/cli.js +11 -11
- package/locales/en.js +8 -2
- package/locales/fr.js +6 -0
- package/locales/ja.js +6 -0
- package/locales/zh-TW.js +8 -2
- package/locales/zh.js +8 -2
- package/node_modules/@qwen-code/audio-capture/package.json +1 -1
- package/node_modules/@qwen-code/audio-capture/prebuilds/darwin-arm64/@qwen-code+audio-capture.node +0 -0
- package/node_modules/@qwen-code/audio-capture/prebuilds/darwin-x64/@qwen-code+audio-capture.node +0 -0
- package/node_modules/@qwen-code/audio-capture/prebuilds/win32-x64/@qwen-code+audio-capture.node +0 -0
- package/package.json +3 -3
- package/web-shell/assets/{arc-CqwzD3ok.js → arc-C7hjaa7g.js} +1 -1
- package/web-shell/assets/{architectureDiagram-3BPJPVTR-BfA-P0-O.js → architectureDiagram-3BPJPVTR-pm9KtMZY.js} +1 -1
- package/web-shell/assets/{blockDiagram-GPEHLZMM-DNTzkXRp.js → blockDiagram-GPEHLZMM-CApElKsU.js} +1 -1
- package/web-shell/assets/{c4Diagram-AAUBKEIU-D5axQoXQ.js → c4Diagram-AAUBKEIU-BeDe0-9N.js} +1 -1
- package/web-shell/assets/channel-BNf1dW-j.js +1 -0
- package/web-shell/assets/{chunk-2J33WTMH-CV0P48eN.js → chunk-2J33WTMH-DJEkmLdl.js} +1 -1
- package/web-shell/assets/{chunk-4BX2VUAB-CghJNPCS.js → chunk-4BX2VUAB-DXX8gdpe.js} +1 -1
- package/web-shell/assets/{chunk-55IACEB6-BrD-776x.js → chunk-55IACEB6-DORmk1kQ.js} +1 -1
- package/web-shell/assets/{chunk-727SXJPM-DLKkI5Yu.js → chunk-727SXJPM-DWmO4mCZ.js} +1 -1
- package/web-shell/assets/{chunk-AQP2D5EJ-C0HWhZNK.js → chunk-AQP2D5EJ-C7LRaYw2.js} +1 -1
- package/web-shell/assets/{chunk-FMBD7UC4-Cg6PsiNL.js → chunk-FMBD7UC4-CCdXgyC5.js} +1 -1
- package/web-shell/assets/{chunk-ND2GUHAM-B1pCuSlf.js → chunk-ND2GUHAM-SyL_xvWc.js} +1 -1
- package/web-shell/assets/{chunk-QZHKN3VN-CkE8llI2.js → chunk-QZHKN3VN-BzOuCKxa.js} +1 -1
- package/web-shell/assets/classDiagram-4FO5ZUOK-uOIGlzgi.js +1 -0
- package/web-shell/assets/classDiagram-v2-Q7XG4LA2-uOIGlzgi.js +1 -0
- package/web-shell/assets/{cose-bilkent-S5V4N54A-Btr-W-vN.js → cose-bilkent-S5V4N54A-BMPWyDKc.js} +1 -1
- package/web-shell/assets/{dagre-BM42HDAG-CAhjVa5L.js → dagre-BM42HDAG-B_GnPWik.js} +1 -1
- package/web-shell/assets/{diagram-2AECGRRQ-eUQodUXw.js → diagram-2AECGRRQ-fJqMc3S_.js} +1 -1
- package/web-shell/assets/{diagram-5GNKFQAL-BiPKbH6E.js → diagram-5GNKFQAL-ximV3O9D.js} +1 -1
- package/web-shell/assets/{diagram-KO2AKTUF-DxuwR-Pu.js → diagram-KO2AKTUF-2vVyjzqw.js} +1 -1
- package/web-shell/assets/{diagram-LMA3HP47-nz9SQ3Az.js → diagram-LMA3HP47-Dckcx1sT.js} +1 -1
- package/web-shell/assets/{diagram-OG6HWLK6-UBbYk-Jq.js → diagram-OG6HWLK6-BAVv47ga.js} +1 -1
- package/web-shell/assets/{erDiagram-TEJ5UH35-BLpRQmgi.js → erDiagram-TEJ5UH35-Bn3nf5J0.js} +1 -1
- package/web-shell/assets/{flowDiagram-I6XJVG4X-C5Qqg1hx.js → flowDiagram-I6XJVG4X-BIbGF9JT.js} +1 -1
- package/web-shell/assets/{ganttDiagram-6RSMTGT7-BMdf3kjL.js → ganttDiagram-6RSMTGT7-CDbhb3AH.js} +1 -1
- package/web-shell/assets/{gitGraphDiagram-PVQCEYII-D9qG7BKD.js → gitGraphDiagram-PVQCEYII-CbKG1a_w.js} +1 -1
- package/web-shell/assets/index-CnE2ur2L.js +779 -0
- package/web-shell/assets/index-hSKXrlSE.css +5 -0
- package/web-shell/assets/{infoDiagram-5YYISTIA-CtDBPJM8.js → infoDiagram-5YYISTIA-DUFxTy8m.js} +1 -1
- package/web-shell/assets/{ishikawaDiagram-YF4QCWOH-BQaS7H3_.js → ishikawaDiagram-YF4QCWOH-D69hrBG8.js} +1 -1
- package/web-shell/assets/{journeyDiagram-JHISSGLW-CEEujCNX.js → journeyDiagram-JHISSGLW-DsvEw51Y.js} +1 -1
- package/web-shell/assets/{kanban-definition-UN3LZRKU-B3QqyyNi.js → kanban-definition-UN3LZRKU-lFFjZEYd.js} +1 -1
- package/web-shell/assets/{linear-DC2Azd_6.js → linear-Bo5bWzvo.js} +1 -1
- package/web-shell/assets/{mermaid.core-DL5PRmh-.js → mermaid.core-C_HKMJx5.js} +5 -5
- package/web-shell/assets/{mindmap-definition-RKZ34NQL-DGlkd_fb.js → mindmap-definition-RKZ34NQL-DlV-NUTs.js} +1 -1
- package/web-shell/assets/{pieDiagram-4H26LBE5-Dew4R8DT.js → pieDiagram-4H26LBE5-B2e6FH2a.js} +1 -1
- package/web-shell/assets/{quadrantDiagram-W4KKPZXB-Bk02Tejc.js → quadrantDiagram-W4KKPZXB-D75kSk-b.js} +1 -1
- package/web-shell/assets/{requirementDiagram-4Y6WPE33-BkWJE-6M.js → requirementDiagram-4Y6WPE33-CQ6xakhM.js} +1 -1
- package/web-shell/assets/{sankeyDiagram-5OEKKPKP-BM9bZAuM.js → sankeyDiagram-5OEKKPKP-J_XTKrcY.js} +1 -1
- package/web-shell/assets/{sequenceDiagram-3UESZ5HK-IaE2rOTu.js → sequenceDiagram-3UESZ5HK-D7jTcBtf.js} +1 -1
- package/web-shell/assets/{stateDiagram-AJRCARHV-CQH-ENFJ.js → stateDiagram-AJRCARHV-CrlM_OT3.js} +1 -1
- package/web-shell/assets/stateDiagram-v2-BHNVJYJU-Bs4TK_84.js +1 -0
- package/web-shell/assets/{timeline-definition-PNZ67QCA-DVH5FaeF.js → timeline-definition-PNZ67QCA-5oZi76Ef.js} +1 -1
- package/web-shell/assets/{vennDiagram-CIIHVFJN-ChT6J8JT.js → vennDiagram-CIIHVFJN-DO5YptPK.js} +1 -1
- package/web-shell/assets/{wardley-L42UT6IY-D9W5AEjE.js → wardley-L42UT6IY-4t1eJDvM.js} +1 -1
- package/web-shell/assets/{wardleyDiagram-YWT4CUSO-cNYKmuIA.js → wardleyDiagram-YWT4CUSO-DKZc661S.js} +1 -1
- package/web-shell/assets/{xychartDiagram-2RQKCTM6-BleLm4BJ.js → xychartDiagram-2RQKCTM6-su9hp08G.js} +1 -1
- package/web-shell/index.html +2 -2
- package/web-shell/assets/channel-EyH7BS8F.js +0 -1
- package/web-shell/assets/classDiagram-4FO5ZUOK-CPWvwYMM.js +0 -1
- package/web-shell/assets/classDiagram-v2-Q7XG4LA2-CPWvwYMM.js +0 -1
- package/web-shell/assets/index-CgttHpqB.js +0 -763
- package/web-shell/assets/index-sVELoa_9.css +0 -5
- package/web-shell/assets/stateDiagram-v2-BHNVJYJU-CFqBlFdE.js +0 -1
|
@@ -42,9 +42,10 @@ import {
|
|
|
42
42
|
} from "./chunk-7LTB54MK.js";
|
|
43
43
|
import {
|
|
44
44
|
convertSchema,
|
|
45
|
+
estimateTextTokens,
|
|
45
46
|
runtimeDiagnostics,
|
|
46
47
|
safeJsonParse
|
|
47
|
-
} from "./chunk-
|
|
48
|
+
} from "./chunk-CCGOFQV3.js";
|
|
48
49
|
import {
|
|
49
50
|
require_lib
|
|
50
51
|
} from "./chunk-IRJWHZWU.js";
|
|
@@ -52737,18 +52738,18 @@ var require_async = __commonJS({
|
|
|
52737
52738
|
];
|
|
52738
52739
|
}, "defaultPaths");
|
|
52739
52740
|
var defaultIsFile = /* @__PURE__ */ __name(function isFile(file, cb) {
|
|
52740
|
-
fs9.stat(file, function(err,
|
|
52741
|
+
fs9.stat(file, function(err, stat2) {
|
|
52741
52742
|
if (!err) {
|
|
52742
|
-
return cb(null,
|
|
52743
|
+
return cb(null, stat2.isFile() || stat2.isFIFO());
|
|
52743
52744
|
}
|
|
52744
52745
|
if (err.code === "ENOENT" || err.code === "ENOTDIR") return cb(null, false);
|
|
52745
52746
|
return cb(err);
|
|
52746
52747
|
});
|
|
52747
52748
|
}, "isFile");
|
|
52748
52749
|
var defaultIsDir = /* @__PURE__ */ __name(function isDirectory(dir, cb) {
|
|
52749
|
-
fs9.stat(dir, function(err,
|
|
52750
|
+
fs9.stat(dir, function(err, stat2) {
|
|
52750
52751
|
if (!err) {
|
|
52751
|
-
return cb(null,
|
|
52752
|
+
return cb(null, stat2.isDirectory());
|
|
52752
52753
|
}
|
|
52753
52754
|
if (err.code === "ENOENT" || err.code === "ENOTDIR") return cb(null, false);
|
|
52754
52755
|
return cb(err);
|
|
@@ -53244,21 +53245,21 @@ var require_sync = __commonJS({
|
|
|
53244
53245
|
}, "defaultPaths");
|
|
53245
53246
|
var defaultIsFile = /* @__PURE__ */ __name(function isFile(file) {
|
|
53246
53247
|
try {
|
|
53247
|
-
var
|
|
53248
|
+
var stat2 = fs9.statSync(file, { throwIfNoEntry: false });
|
|
53248
53249
|
} catch (e) {
|
|
53249
53250
|
if (e && (e.code === "ENOENT" || e.code === "ENOTDIR")) return false;
|
|
53250
53251
|
throw e;
|
|
53251
53252
|
}
|
|
53252
|
-
return !!
|
|
53253
|
+
return !!stat2 && (stat2.isFile() || stat2.isFIFO());
|
|
53253
53254
|
}, "isFile");
|
|
53254
53255
|
var defaultIsDir = /* @__PURE__ */ __name(function isDirectory(dir) {
|
|
53255
53256
|
try {
|
|
53256
|
-
var
|
|
53257
|
+
var stat2 = fs9.statSync(dir, { throwIfNoEntry: false });
|
|
53257
53258
|
} catch (e) {
|
|
53258
53259
|
if (e && (e.code === "ENOENT" || e.code === "ENOTDIR")) return false;
|
|
53259
53260
|
throw e;
|
|
53260
53261
|
}
|
|
53261
|
-
return !!
|
|
53262
|
+
return !!stat2 && stat2.isDirectory();
|
|
53262
53263
|
}, "isDirectory");
|
|
53263
53264
|
var defaultRealpathSync = /* @__PURE__ */ __name(function realpathSync(x) {
|
|
53264
53265
|
try {
|
|
@@ -53684,14 +53685,14 @@ var require_require_in_the_middle = __commonJS({
|
|
|
53684
53685
|
moduleName = parsedPath.name;
|
|
53685
53686
|
basedir = parsedPath.dir;
|
|
53686
53687
|
} else {
|
|
53687
|
-
const
|
|
53688
|
-
if (
|
|
53688
|
+
const stat2 = moduleDetailsFromPath(filename);
|
|
53689
|
+
if (stat2 === void 0) {
|
|
53689
53690
|
debug("could not parse filename: %s", filename);
|
|
53690
53691
|
return exports2;
|
|
53691
53692
|
}
|
|
53692
|
-
moduleName =
|
|
53693
|
-
basedir =
|
|
53694
|
-
const fullModuleName = resolveModuleName(
|
|
53693
|
+
moduleName = stat2.name;
|
|
53694
|
+
basedir = stat2.basedir;
|
|
53695
|
+
const fullModuleName = resolveModuleName(stat2);
|
|
53695
53696
|
debug("resolved filename to module: %s (id: %s, resolved: %s, basedir: %s)", moduleName, id, fullModuleName, basedir);
|
|
53696
53697
|
let matchFound = false;
|
|
53697
53698
|
if (hasWhitelist) {
|
|
@@ -53755,9 +53756,9 @@ var require_require_in_the_middle = __commonJS({
|
|
|
53755
53756
|
}
|
|
53756
53757
|
}
|
|
53757
53758
|
};
|
|
53758
|
-
function resolveModuleName(
|
|
53759
|
-
const normalizedPath = path11.sep !== "/" ?
|
|
53760
|
-
return path11.posix.join(
|
|
53759
|
+
function resolveModuleName(stat2) {
|
|
53760
|
+
const normalizedPath = path11.sep !== "/" ? stat2.path.split(path11.sep).join("/") : stat2.path;
|
|
53761
|
+
return path11.posix.join(stat2.name, normalizedPath).replace(normalize2, "");
|
|
53761
53762
|
}
|
|
53762
53763
|
__name(resolveModuleName, "resolveModuleName");
|
|
53763
53764
|
}
|
|
@@ -59215,7 +59216,53 @@ __name(detectEncodingFromBuffer, "detectEncodingFromBuffer");
|
|
|
59215
59216
|
init_esbuild_shims();
|
|
59216
59217
|
import { execFile } from "node:child_process";
|
|
59217
59218
|
var MAX_PDF_TEXT_OUTPUT_CHARS = 1e5;
|
|
59219
|
+
var PDF_FULL_TEXT_PAGE_LIMIT = 10;
|
|
59220
|
+
var PDF_MAX_PAGES_PER_READ = 20;
|
|
59221
|
+
var PDF_PAGE_COUNT_SIZE_HEURISTIC_BYTES = 100 * 1024;
|
|
59222
|
+
var PDF_TEXT_RESULT_MAX_TOKENS = 12e3;
|
|
59223
|
+
var PDF_TEXT_RESULT_WRAPPER_TOKEN_CHARS = 64;
|
|
59224
|
+
var PDF_TEXT_RESULT_CHARS_PER_TOKEN = 4;
|
|
59225
|
+
var PDF_TEXT_EXTRACTION_UNAVAILABLE_MESSAGE = "pdftotext is not installed. Install poppler-utils to enable PDF text extraction (e.g. `apt-get install poppler-utils` or `brew install poppler`).";
|
|
59218
59226
|
var MAX_PDF_PAGE_NUMBER = 1e6;
|
|
59227
|
+
function shouldRequirePDFPageRange(pageCount, sizeBytes) {
|
|
59228
|
+
const hadPdfInfo = pageCount !== null;
|
|
59229
|
+
const effectivePageCount = pageCount ?? Math.ceil(sizeBytes / PDF_PAGE_COUNT_SIZE_HEURISTIC_BYTES);
|
|
59230
|
+
return {
|
|
59231
|
+
required: effectivePageCount > PDF_FULL_TEXT_PAGE_LIMIT,
|
|
59232
|
+
effectivePageCount,
|
|
59233
|
+
hadPdfInfo
|
|
59234
|
+
};
|
|
59235
|
+
}
|
|
59236
|
+
__name(shouldRequirePDFPageRange, "shouldRequirePDFPageRange");
|
|
59237
|
+
function estimatePDFTextOutputTokens(text) {
|
|
59238
|
+
return Math.ceil(
|
|
59239
|
+
estimateTextTokens(text) + PDF_TEXT_RESULT_WRAPPER_TOKEN_CHARS / PDF_TEXT_RESULT_CHARS_PER_TOKEN
|
|
59240
|
+
);
|
|
59241
|
+
}
|
|
59242
|
+
__name(estimatePDFTextOutputTokens, "estimatePDFTextOutputTokens");
|
|
59243
|
+
function buildLargePDFGuidance(displayName, requirement) {
|
|
59244
|
+
const source = requirement.hadPdfInfo ? "has" : "appears to have about";
|
|
59245
|
+
return `PDF "${displayName}" ${source} ${requirement.effectivePageCount} pages, which is too many to read at once. Use the 'pages' parameter to read a specific page range such as '1-5'. Maximum ${PDF_MAX_PAGES_PER_READ} pages per request.`;
|
|
59246
|
+
}
|
|
59247
|
+
__name(buildLargePDFGuidance, "buildLargePDFGuidance");
|
|
59248
|
+
function buildPDFTextTooLargeGuidance(displayName, estimatedTokens, pagesUsed) {
|
|
59249
|
+
const pageRange = pagesUsed ? parsePDFPageRange(pagesUsed) : null;
|
|
59250
|
+
const prefix = `PDF text extracted from "${displayName}" is too large to return safely (${estimatedTokens} estimated tokens; limit ${PDF_TEXT_RESULT_MAX_TOKENS}).`;
|
|
59251
|
+
if (pageRange && pageRange.firstPage === pageRange.lastPage) {
|
|
59252
|
+
return `${prefix} The selected page exceeds the output limit. Use a native PDF-capable model, split the page content externally, or extract a smaller section with another tool.`;
|
|
59253
|
+
}
|
|
59254
|
+
if (pageRange) {
|
|
59255
|
+
const suggestedEnd = Math.floor(
|
|
59256
|
+
(pageRange.firstPage + pageRange.lastPage) / 2
|
|
59257
|
+
);
|
|
59258
|
+
if (suggestedEnd === pageRange.firstPage) {
|
|
59259
|
+
return `${prefix} Use the 'pages' parameter with a single page, for example '${pageRange.firstPage}'.`;
|
|
59260
|
+
}
|
|
59261
|
+
return `${prefix} Use the 'pages' parameter with fewer pages, for example '${pageRange.firstPage}-${suggestedEnd}' or a single page.`;
|
|
59262
|
+
}
|
|
59263
|
+
return `${prefix} Use the 'pages' parameter with a narrower range, for example '1-2' or a single page.`;
|
|
59264
|
+
}
|
|
59265
|
+
__name(buildPDFTextTooLargeGuidance, "buildPDFTextTooLargeGuidance");
|
|
59219
59266
|
function execCommand(command, args, options = {}) {
|
|
59220
59267
|
return new Promise((resolve2) => {
|
|
59221
59268
|
execFile(
|
|
@@ -59299,12 +59346,31 @@ async function isPdftotextAvailable() {
|
|
|
59299
59346
|
return pdftotextAvailablePromise;
|
|
59300
59347
|
}
|
|
59301
59348
|
__name(isPdftotextAvailable, "isPdftotextAvailable");
|
|
59349
|
+
async function getPDFPageCount(filePath) {
|
|
59350
|
+
try {
|
|
59351
|
+
const { stdout, code } = await execCommand("pdfinfo", ["--", filePath], {
|
|
59352
|
+
timeout: 1e4
|
|
59353
|
+
});
|
|
59354
|
+
if (code !== 0) {
|
|
59355
|
+
return null;
|
|
59356
|
+
}
|
|
59357
|
+
const match = /^Pages:\s+(\d+)/m.exec(stdout);
|
|
59358
|
+
if (!match) {
|
|
59359
|
+
return null;
|
|
59360
|
+
}
|
|
59361
|
+
const count = parseInt(match[1], 10);
|
|
59362
|
+
return isNaN(count) ? null : count;
|
|
59363
|
+
} catch {
|
|
59364
|
+
return null;
|
|
59365
|
+
}
|
|
59366
|
+
}
|
|
59367
|
+
__name(getPDFPageCount, "getPDFPageCount");
|
|
59302
59368
|
async function extractPDFText(filePath, options) {
|
|
59303
59369
|
const available = await isPdftotextAvailable();
|
|
59304
59370
|
if (!available) {
|
|
59305
59371
|
return {
|
|
59306
59372
|
success: false,
|
|
59307
|
-
error:
|
|
59373
|
+
error: PDF_TEXT_EXTRACTION_UNAVAILABLE_MESSAGE
|
|
59308
59374
|
};
|
|
59309
59375
|
}
|
|
59310
59376
|
const args = ["-layout"];
|
|
@@ -59329,12 +59395,15 @@ async function extractPDFText(filePath, options) {
|
|
|
59329
59395
|
error: `pdftotext timed out after 30s. The PDF may be unusually large or complex; try the 'pages' parameter to narrow the range.`
|
|
59330
59396
|
};
|
|
59331
59397
|
}
|
|
59332
|
-
if (maxBufferExceeded && stdout
|
|
59398
|
+
if (maxBufferExceeded && Buffer.byteLength(stdout, "utf8") >= MAX_PDF_TEXT_OUTPUT_CHARS) {
|
|
59399
|
+
const wasCharTruncated = stdout.length > MAX_PDF_TEXT_OUTPUT_CHARS;
|
|
59400
|
+
const text = wasCharTruncated ? stdout.substring(0, MAX_PDF_TEXT_OUTPUT_CHARS) : stdout;
|
|
59401
|
+
const truncationReason = wasCharTruncated ? `at ${MAX_PDF_TEXT_OUTPUT_CHARS} characters` : "after reaching the PDF text buffer limit";
|
|
59333
59402
|
return {
|
|
59334
59403
|
success: true,
|
|
59335
|
-
text:
|
|
59404
|
+
text: text + `
|
|
59336
59405
|
|
|
59337
|
-
... [text truncated
|
|
59406
|
+
... [text truncated ${truncationReason}. Use the 'pages' parameter to read specific page ranges.]`
|
|
59338
59407
|
};
|
|
59339
59408
|
}
|
|
59340
59409
|
if (code !== 0 || maxBufferExceeded) {
|
|
@@ -59646,10 +59715,224 @@ ${cellTexts.join("\n\n")}`,
|
|
|
59646
59715
|
}
|
|
59647
59716
|
__name(readNotebookWithMetadata, "readNotebookWithMetadata");
|
|
59648
59717
|
|
|
59718
|
+
// packages/core/src/utils/read-text-range.ts
|
|
59719
|
+
init_esbuild_shims();
|
|
59720
|
+
import { createReadStream } from "node:fs";
|
|
59721
|
+
import { stat } from "node:fs/promises";
|
|
59722
|
+
import { TextDecoder as TextDecoder2 } from "node:util";
|
|
59723
|
+
|
|
59724
|
+
// packages/core/src/utils/text-range-constants.ts
|
|
59725
|
+
init_esbuild_shims();
|
|
59726
|
+
var TEXT_RANGE_FAST_PATH_MAX_SIZE = 10 * 1024 * 1024;
|
|
59727
|
+
var DEFAULT_RANGE_READ_BYTES = 25e3;
|
|
59728
|
+
|
|
59729
|
+
// packages/core/src/utils/read-text-range.ts
|
|
59730
|
+
var LargeNonUtf8TextError = class extends Error {
|
|
59731
|
+
constructor(encoding, reason) {
|
|
59732
|
+
super(
|
|
59733
|
+
reason === "invalid-utf8" ? "Large text file contains invalid UTF-8 byte sequence beyond the initial encoding sample. Convert or extract a smaller UTF-8 slice and read that instead." : `Large non-UTF-8 text files are not supported for streaming reads (detected ${encoding}). Convert or extract a smaller UTF-8 slice and read that instead.`
|
|
59734
|
+
);
|
|
59735
|
+
this.encoding = encoding;
|
|
59736
|
+
this.reason = reason;
|
|
59737
|
+
this.name = "LargeNonUtf8TextError";
|
|
59738
|
+
}
|
|
59739
|
+
static {
|
|
59740
|
+
__name(this, "LargeNonUtf8TextError");
|
|
59741
|
+
}
|
|
59742
|
+
};
|
|
59743
|
+
async function readTextRange(request4) {
|
|
59744
|
+
request4.signal?.throwIfAborted();
|
|
59745
|
+
const stats = request4.stats ?? await stat(request4.path);
|
|
59746
|
+
const maxOutputBytes = normalizeMaxBytes(request4.maxOutputBytes);
|
|
59747
|
+
if (stats.size < TEXT_RANGE_FAST_PATH_MAX_SIZE) {
|
|
59748
|
+
const { content, encoding, bom } = await readFileWithEncodingInfo(
|
|
59749
|
+
request4.path,
|
|
59750
|
+
request4.signal
|
|
59751
|
+
);
|
|
59752
|
+
request4.signal?.throwIfAborted();
|
|
59753
|
+
const range = sliceDecodedContent(
|
|
59754
|
+
content,
|
|
59755
|
+
request4.offset,
|
|
59756
|
+
request4.limit,
|
|
59757
|
+
maxOutputBytes
|
|
59758
|
+
);
|
|
59759
|
+
return {
|
|
59760
|
+
...range,
|
|
59761
|
+
encoding,
|
|
59762
|
+
bom,
|
|
59763
|
+
lineEnding: detectLineEndingFromContent(content)
|
|
59764
|
+
};
|
|
59765
|
+
}
|
|
59766
|
+
return readLargeUtf8Range(request4, maxOutputBytes);
|
|
59767
|
+
}
|
|
59768
|
+
__name(readTextRange, "readTextRange");
|
|
59769
|
+
function normalizeMaxBytes(maxOutputBytes) {
|
|
59770
|
+
if (maxOutputBytes === Number.POSITIVE_INFINITY) {
|
|
59771
|
+
return Number.POSITIVE_INFINITY;
|
|
59772
|
+
}
|
|
59773
|
+
if (!Number.isFinite(maxOutputBytes)) {
|
|
59774
|
+
return DEFAULT_RANGE_READ_BYTES;
|
|
59775
|
+
}
|
|
59776
|
+
return Math.max(0, Math.floor(maxOutputBytes));
|
|
59777
|
+
}
|
|
59778
|
+
__name(normalizeMaxBytes, "normalizeMaxBytes");
|
|
59779
|
+
function sliceDecodedContent(content, offset, limit, maxOutputBytes) {
|
|
59780
|
+
const lines = content.split("\n");
|
|
59781
|
+
const originalLineCount = lines.length;
|
|
59782
|
+
const start = Math.min(Math.max(0, offset ?? 0), originalLineCount);
|
|
59783
|
+
const end = limit === void 0 ? originalLineCount : Math.min(start + Math.max(0, limit), originalLineCount);
|
|
59784
|
+
const selected = lines.slice(start, end).join("\n");
|
|
59785
|
+
const truncated = truncateUtf8(selected, maxOutputBytes);
|
|
59786
|
+
return {
|
|
59787
|
+
content: truncated.content,
|
|
59788
|
+
originalLineCount,
|
|
59789
|
+
originalLineCountExact: true,
|
|
59790
|
+
truncatedByBytes: truncated.truncated
|
|
59791
|
+
};
|
|
59792
|
+
}
|
|
59793
|
+
__name(sliceDecodedContent, "sliceDecodedContent");
|
|
59794
|
+
async function readLargeUtf8Range(request4, maxOutputBytes) {
|
|
59795
|
+
const encoding = await detectFileEncoding(request4.path);
|
|
59796
|
+
if (!isUtf8CompatibleEncoding(encoding)) {
|
|
59797
|
+
throw new LargeNonUtf8TextError(encoding);
|
|
59798
|
+
}
|
|
59799
|
+
const offset = Math.max(0, request4.offset ?? 0);
|
|
59800
|
+
const endLine = offset + Math.max(0, request4.limit ?? Number.POSITIVE_INFINITY);
|
|
59801
|
+
let currentLine = 0;
|
|
59802
|
+
let output = "";
|
|
59803
|
+
let outputBytes = 0;
|
|
59804
|
+
let truncatedByBytes = false;
|
|
59805
|
+
let bom = false;
|
|
59806
|
+
let firstChunk = true;
|
|
59807
|
+
let lineEnding = "lf";
|
|
59808
|
+
let previousChunkEndedWithCR = false;
|
|
59809
|
+
let originalLineCountExact = true;
|
|
59810
|
+
let stoppedEarly = false;
|
|
59811
|
+
const decoder = new TextDecoder2("utf-8", {
|
|
59812
|
+
fatal: true,
|
|
59813
|
+
ignoreBOM: true
|
|
59814
|
+
});
|
|
59815
|
+
const stream = createReadStream(request4.path, {
|
|
59816
|
+
highWaterMark: 512 * 1024,
|
|
59817
|
+
signal: request4.signal
|
|
59818
|
+
});
|
|
59819
|
+
function appendSelected(fragment) {
|
|
59820
|
+
if (fragment.length === 0 || truncatedByBytes) {
|
|
59821
|
+
return;
|
|
59822
|
+
}
|
|
59823
|
+
const available = maxOutputBytes - outputBytes;
|
|
59824
|
+
if (available <= 0) {
|
|
59825
|
+
truncatedByBytes = true;
|
|
59826
|
+
return;
|
|
59827
|
+
}
|
|
59828
|
+
const truncated = truncateUtf8(fragment, available);
|
|
59829
|
+
output += truncated.content;
|
|
59830
|
+
outputBytes += Buffer.byteLength(truncated.content, "utf8");
|
|
59831
|
+
if (truncated.truncated) {
|
|
59832
|
+
truncatedByBytes = true;
|
|
59833
|
+
}
|
|
59834
|
+
}
|
|
59835
|
+
__name(appendSelected, "appendSelected");
|
|
59836
|
+
function isSelectedLine() {
|
|
59837
|
+
return currentLine >= offset && currentLine < endLine;
|
|
59838
|
+
}
|
|
59839
|
+
__name(isSelectedLine, "isSelectedLine");
|
|
59840
|
+
function decodeUtf8Chunk(chunk, options) {
|
|
59841
|
+
try {
|
|
59842
|
+
return decoder.decode(chunk, options);
|
|
59843
|
+
} catch {
|
|
59844
|
+
throw new LargeNonUtf8TextError(encoding, "invalid-utf8");
|
|
59845
|
+
}
|
|
59846
|
+
}
|
|
59847
|
+
__name(decodeUtf8Chunk, "decodeUtf8Chunk");
|
|
59848
|
+
try {
|
|
59849
|
+
for await (const rawChunk of stream) {
|
|
59850
|
+
request4.signal?.throwIfAborted();
|
|
59851
|
+
let chunk = decodeUtf8Chunk(rawChunk, { stream: true });
|
|
59852
|
+
if (firstChunk) {
|
|
59853
|
+
firstChunk = false;
|
|
59854
|
+
if (chunk.charCodeAt(0) === 65279) {
|
|
59855
|
+
chunk = chunk.slice(1);
|
|
59856
|
+
bom = true;
|
|
59857
|
+
}
|
|
59858
|
+
}
|
|
59859
|
+
if (previousChunkEndedWithCR && chunk.startsWith("\n") || chunk.includes("\r\n")) {
|
|
59860
|
+
lineEnding = "crlf";
|
|
59861
|
+
}
|
|
59862
|
+
previousChunkEndedWithCR = chunk.endsWith("\r");
|
|
59863
|
+
let start = 0;
|
|
59864
|
+
let newline = chunk.indexOf("\n", start);
|
|
59865
|
+
while (newline !== -1) {
|
|
59866
|
+
if (isSelectedLine()) {
|
|
59867
|
+
appendSelected(chunk.slice(start, newline));
|
|
59868
|
+
if (currentLine + 1 < endLine) {
|
|
59869
|
+
appendSelected("\n");
|
|
59870
|
+
}
|
|
59871
|
+
}
|
|
59872
|
+
currentLine++;
|
|
59873
|
+
start = newline + 1;
|
|
59874
|
+
if (currentLine >= endLine || truncatedByBytes) {
|
|
59875
|
+
originalLineCountExact = false;
|
|
59876
|
+
stoppedEarly = true;
|
|
59877
|
+
break;
|
|
59878
|
+
}
|
|
59879
|
+
newline = chunk.indexOf("\n", start);
|
|
59880
|
+
}
|
|
59881
|
+
if (start < chunk.length && isSelectedLine()) {
|
|
59882
|
+
appendSelected(chunk.slice(start));
|
|
59883
|
+
}
|
|
59884
|
+
if (currentLine >= endLine || truncatedByBytes) {
|
|
59885
|
+
originalLineCountExact = false;
|
|
59886
|
+
stoppedEarly = true;
|
|
59887
|
+
break;
|
|
59888
|
+
}
|
|
59889
|
+
}
|
|
59890
|
+
} finally {
|
|
59891
|
+
stream.destroy();
|
|
59892
|
+
}
|
|
59893
|
+
if (!stoppedEarly) {
|
|
59894
|
+
decodeUtf8Chunk();
|
|
59895
|
+
}
|
|
59896
|
+
return {
|
|
59897
|
+
content: output,
|
|
59898
|
+
originalLineCount: currentLine + 1,
|
|
59899
|
+
encoding: "utf-8",
|
|
59900
|
+
bom,
|
|
59901
|
+
lineEnding,
|
|
59902
|
+
originalLineCountExact,
|
|
59903
|
+
truncatedByBytes
|
|
59904
|
+
};
|
|
59905
|
+
}
|
|
59906
|
+
__name(readLargeUtf8Range, "readLargeUtf8Range");
|
|
59907
|
+
function truncateUtf8(content, maxBytes) {
|
|
59908
|
+
const bytes = Buffer.byteLength(content, "utf8");
|
|
59909
|
+
if (bytes <= maxBytes) {
|
|
59910
|
+
return { content, truncated: false };
|
|
59911
|
+
}
|
|
59912
|
+
if (maxBytes <= 0) {
|
|
59913
|
+
return { content: "", truncated: true };
|
|
59914
|
+
}
|
|
59915
|
+
const buffer = Buffer.from(content, "utf8");
|
|
59916
|
+
let end = Math.min(maxBytes, buffer.length);
|
|
59917
|
+
while (end > 0 && (buffer[end] & 192) === 128) {
|
|
59918
|
+
end--;
|
|
59919
|
+
}
|
|
59920
|
+
return {
|
|
59921
|
+
content: buffer.subarray(0, end).toString("utf8"),
|
|
59922
|
+
truncated: true
|
|
59923
|
+
};
|
|
59924
|
+
}
|
|
59925
|
+
__name(truncateUtf8, "truncateUtf8");
|
|
59926
|
+
function detectLineEndingFromContent(content) {
|
|
59927
|
+
return content.includes("\r\n") ? "crlf" : "lf";
|
|
59928
|
+
}
|
|
59929
|
+
__name(detectLineEndingFromContent, "detectLineEndingFromContent");
|
|
59930
|
+
|
|
59649
59931
|
// packages/core/src/utils/fileUtils.ts
|
|
59650
59932
|
var debugLogger2 = createDebugLogger("FILE_UTILS");
|
|
59651
59933
|
var DEFAULT_ENCODING = "utf-8";
|
|
59652
|
-
var
|
|
59934
|
+
var PDF_FULL_TEXT_EXTRACTION_MAX_MB = 100;
|
|
59935
|
+
var PDF_PAGED_TEXT_EXTRACTION_MAX_MB = 512;
|
|
59653
59936
|
function detectBOM(buf) {
|
|
59654
59937
|
if (buf.length >= 4) {
|
|
59655
59938
|
if (buf[0] === 255 && buf[1] === 254 && buf[2] === 0 && buf[3] === 0) {
|
|
@@ -59777,8 +60060,11 @@ function bomEncodingToName(bomEncoding) {
|
|
|
59777
60060
|
}
|
|
59778
60061
|
}
|
|
59779
60062
|
__name(bomEncodingToName, "bomEncodingToName");
|
|
59780
|
-
async function readFileWithEncodingInfo(filePath) {
|
|
59781
|
-
const full = await fs2.promises.readFile(
|
|
60063
|
+
async function readFileWithEncodingInfo(filePath, signal) {
|
|
60064
|
+
const full = await fs2.promises.readFile(
|
|
60065
|
+
filePath,
|
|
60066
|
+
signal === void 0 ? void 0 : { signal }
|
|
60067
|
+
);
|
|
59782
60068
|
return decodeBufferWithEncodingInfo(full);
|
|
59783
60069
|
}
|
|
59784
60070
|
__name(readFileWithEncodingInfo, "readFileWithEncodingInfo");
|
|
@@ -59793,8 +60079,24 @@ async function countFileLines(filePath) {
|
|
|
59793
60079
|
}
|
|
59794
60080
|
__name(countFileLines, "countFileLines");
|
|
59795
60081
|
async function readFileWithLineAndLimit(params) {
|
|
59796
|
-
const { path: filePath, limit, line } = params;
|
|
59797
|
-
const
|
|
60082
|
+
const { path: filePath, limit, line, maxOutputBytes, signal } = params;
|
|
60083
|
+
const stats = params.stats ?? await fs2.promises.stat(filePath);
|
|
60084
|
+
if (line !== void 0 && line > 0 || Number.isFinite(limit) || maxOutputBytes !== void 0) {
|
|
60085
|
+
return readTextRange({
|
|
60086
|
+
path: filePath,
|
|
60087
|
+
offset: line || 0,
|
|
60088
|
+
limit,
|
|
60089
|
+
maxOutputBytes: normalizeRangeReadByteLimit(maxOutputBytes),
|
|
60090
|
+
stats,
|
|
60091
|
+
...signal !== void 0 ? { signal } : {}
|
|
60092
|
+
});
|
|
60093
|
+
}
|
|
60094
|
+
signal?.throwIfAborted();
|
|
60095
|
+
const { content, encoding, bom } = await readFileWithEncodingInfo(
|
|
60096
|
+
filePath,
|
|
60097
|
+
signal
|
|
60098
|
+
);
|
|
60099
|
+
signal?.throwIfAborted();
|
|
59798
60100
|
const lines = content.split("\n");
|
|
59799
60101
|
const originalLineCount = lines.length;
|
|
59800
60102
|
const startLine = line || 0;
|
|
@@ -59805,7 +60107,8 @@ async function readFileWithLineAndLimit(params) {
|
|
|
59805
60107
|
content: selectedLines.join("\n"),
|
|
59806
60108
|
bom,
|
|
59807
60109
|
encoding,
|
|
59808
|
-
originalLineCount
|
|
60110
|
+
originalLineCount,
|
|
60111
|
+
originalLineCountExact: true
|
|
59809
60112
|
};
|
|
59810
60113
|
}
|
|
59811
60114
|
__name(readFileWithLineAndLimit, "readFileWithLineAndLimit");
|
|
@@ -60146,9 +60449,17 @@ async function processSingleFileContent(filePath, config, optionsOrOffset, legac
|
|
|
60146
60449
|
limit: legacyLimit,
|
|
60147
60450
|
pages: legacyPages
|
|
60148
60451
|
};
|
|
60149
|
-
const {
|
|
60452
|
+
const {
|
|
60453
|
+
offset,
|
|
60454
|
+
limit,
|
|
60455
|
+
pages,
|
|
60456
|
+
preserveUnsupportedImage = false,
|
|
60457
|
+
signal,
|
|
60458
|
+
largePdfBehavior = "error"
|
|
60459
|
+
} = options;
|
|
60150
60460
|
const rootDirectory = config.getTargetDir();
|
|
60151
60461
|
try {
|
|
60462
|
+
signal?.throwIfAborted();
|
|
60152
60463
|
let stats;
|
|
60153
60464
|
try {
|
|
60154
60465
|
stats = await fs2.promises.stat(filePath);
|
|
@@ -60184,16 +60495,83 @@ async function processSingleFileContent(filePath, config, optionsOrOffset, legac
|
|
|
60184
60495
|
const displayName = path2.basename(filePath);
|
|
60185
60496
|
const modalities = config.getContentGeneratorConfig?.()?.modalities ?? {};
|
|
60186
60497
|
const fileSizeInMB = stats.size / (1024 * 1024);
|
|
60187
|
-
const
|
|
60188
|
-
|
|
60498
|
+
const normalizedPages = pages?.trim();
|
|
60499
|
+
let pageRange;
|
|
60500
|
+
if (fileType === "pdf" && normalizedPages !== void 0) {
|
|
60501
|
+
const invalidPagesDisplay = `Invalid PDF pages parameter: ${relativePathForDisplay}`;
|
|
60502
|
+
const invalidPagesResult = /* @__PURE__ */ __name((message) => ({
|
|
60503
|
+
llmContent: message,
|
|
60504
|
+
returnDisplay: invalidPagesDisplay,
|
|
60505
|
+
error: message,
|
|
60506
|
+
errorType: "invalid_tool_params" /* INVALID_TOOL_PARAMS */
|
|
60507
|
+
}), "invalidPagesResult");
|
|
60508
|
+
const parsedPageRange = parsePDFPageRange(normalizedPages);
|
|
60509
|
+
if (!parsedPageRange) {
|
|
60510
|
+
return invalidPagesResult(
|
|
60511
|
+
`Invalid pages parameter: '${normalizedPages}'. Use formats like '5' or '1-10'.`
|
|
60512
|
+
);
|
|
60513
|
+
}
|
|
60514
|
+
if (parsedPageRange.lastPage === Infinity) {
|
|
60515
|
+
return invalidPagesResult(
|
|
60516
|
+
`Open-ended page ranges (e.g. '3-') are not supported; specify an explicit end page within the ${PDF_MAX_PAGES_PER_READ}-page limit (e.g. '3-22').`
|
|
60517
|
+
);
|
|
60518
|
+
}
|
|
60519
|
+
if (parsedPageRange.lastPage - parsedPageRange.firstPage + 1 > PDF_MAX_PAGES_PER_READ) {
|
|
60520
|
+
return invalidPagesResult(
|
|
60521
|
+
`Pages range exceeds maximum of ${PDF_MAX_PAGES_PER_READ} pages per request.`
|
|
60522
|
+
);
|
|
60523
|
+
}
|
|
60524
|
+
pageRange = parsedPageRange;
|
|
60525
|
+
}
|
|
60526
|
+
const willExtractPdfText = fileType === "pdf" && (pageRange !== void 0 || !modalities.pdf);
|
|
60527
|
+
if (!pageRange && willExtractPdfText && fileSizeInMB > PDF_FULL_TEXT_EXTRACTION_MAX_MB) {
|
|
60189
60528
|
return {
|
|
60190
|
-
llmContent: `PDF file is too large for text extraction: ${fileSizeInMB.toFixed(2)}MB exceeds the ${
|
|
60191
|
-
returnDisplay: `PDF file too large (${fileSizeInMB.toFixed(2)}MB > ${
|
|
60529
|
+
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.`,
|
|
60530
|
+
returnDisplay: `PDF file too large (${fileSizeInMB.toFixed(2)}MB > ${PDF_FULL_TEXT_EXTRACTION_MAX_MB}MB).`,
|
|
60192
60531
|
error: `PDF exceeds extraction size limit: ${filePath} (${fileSizeInMB.toFixed(2)}MB)`,
|
|
60193
|
-
errorType: "file_too_large" /* FILE_TOO_LARGE
|
|
60532
|
+
errorType: "file_too_large" /* FILE_TOO_LARGE */,
|
|
60533
|
+
stats
|
|
60194
60534
|
};
|
|
60195
60535
|
}
|
|
60196
|
-
if (fileSizeInMB >
|
|
60536
|
+
if (pageRange && fileSizeInMB > PDF_PAGED_TEXT_EXTRACTION_MAX_MB) {
|
|
60537
|
+
return {
|
|
60538
|
+
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.`,
|
|
60539
|
+
returnDisplay: `PDF file too large (${fileSizeInMB.toFixed(2)}MB > ${PDF_PAGED_TEXT_EXTRACTION_MAX_MB}MB).`,
|
|
60540
|
+
error: `PDF exceeds page-range extraction size limit: ${filePath} (${fileSizeInMB.toFixed(2)}MB)`,
|
|
60541
|
+
errorType: "file_too_large" /* FILE_TOO_LARGE */,
|
|
60542
|
+
stats
|
|
60543
|
+
};
|
|
60544
|
+
}
|
|
60545
|
+
if (willExtractPdfText && !pageRange) {
|
|
60546
|
+
const pageCount = await getPDFPageCount(filePath);
|
|
60547
|
+
const requirement = shouldRequirePDFPageRange(pageCount, stats.size);
|
|
60548
|
+
debugLogger2.debug(
|
|
60549
|
+
`PDF full-text fallback gate: file=${relativePathForDisplay}, sizeMB=${fileSizeInMB.toFixed(2)}, pageCount=${pageCount ?? "unknown"}, required=${requirement.required}, effectivePageCount=${requirement.effectivePageCount}, hadPdfInfo=${requirement.hadPdfInfo}, behavior=${largePdfBehavior}`
|
|
60550
|
+
);
|
|
60551
|
+
if (requirement.required) {
|
|
60552
|
+
if (largePdfBehavior === "error" && !await isPdftotextAvailable()) {
|
|
60553
|
+
return {
|
|
60554
|
+
llmContent: `[Cannot extract text from PDF: "${displayName}". ${PDF_TEXT_EXTRACTION_UNAVAILABLE_MESSAGE}]`,
|
|
60555
|
+
returnDisplay: `Failed to read pdf: ${relativePathForDisplay}`,
|
|
60556
|
+
error: PDF_TEXT_EXTRACTION_UNAVAILABLE_MESSAGE,
|
|
60557
|
+
errorType: "read_content_failure" /* READ_CONTENT_FAILURE */,
|
|
60558
|
+
stats
|
|
60559
|
+
};
|
|
60560
|
+
}
|
|
60561
|
+
const guidance = buildLargePDFGuidance(displayName, requirement);
|
|
60562
|
+
const returnDisplay = largePdfBehavior === "reference" ? `Referenced large PDF: ${relativePathForDisplay}` : `PDF requires page range: ${relativePathForDisplay}`;
|
|
60563
|
+
return {
|
|
60564
|
+
llmContent: guidance,
|
|
60565
|
+
returnDisplay,
|
|
60566
|
+
...largePdfBehavior === "error" ? {
|
|
60567
|
+
error: guidance,
|
|
60568
|
+
errorType: "file_too_large" /* FILE_TOO_LARGE */
|
|
60569
|
+
} : {},
|
|
60570
|
+
stats
|
|
60571
|
+
};
|
|
60572
|
+
}
|
|
60573
|
+
}
|
|
60574
|
+
if (fileSizeInMB > 9.9 && !willExtractPdfText && fileType !== "text") {
|
|
60197
60575
|
return {
|
|
60198
60576
|
llmContent: "File size exceeds the 10MB limit.",
|
|
60199
60577
|
returnDisplay: "File size exceeds the 10MB limit.",
|
|
@@ -60250,11 +60628,17 @@ async function processSingleFileContent(filePath, config, optionsOrOffset, legac
|
|
|
60250
60628
|
const { content, _meta } = await config.getFileSystemService().readTextFile({
|
|
60251
60629
|
path: filePath,
|
|
60252
60630
|
limit: limit ?? config.getTruncateToolOutputLines(),
|
|
60253
|
-
line: offset
|
|
60631
|
+
line: offset,
|
|
60632
|
+
maxOutputBytes: getRangeReadByteLimit(config),
|
|
60633
|
+
stats,
|
|
60634
|
+
...signal !== void 0 ? { signal } : {}
|
|
60254
60635
|
});
|
|
60255
|
-
const originalLineCount = _meta?.originalLineCount ?? await countFileLines(filePath);
|
|
60256
60636
|
const selectedLines = content.split("\n").map((line) => line.trimEnd());
|
|
60257
60637
|
const startLine = offset || 0;
|
|
60638
|
+
const selectedLineCount = content.length === 0 ? 0 : selectedLines.length;
|
|
60639
|
+
const hasOriginalLineCount = _meta?.originalLineCount !== void 0;
|
|
60640
|
+
const originalLineCount = _meta?.originalLineCount ?? (stats.size >= TEXT_RANGE_FAST_PATH_MAX_SIZE ? startLine + selectedLineCount : await countFileLines(filePath));
|
|
60641
|
+
const originalLineCountExact = _meta?.originalLineCountExact === false ? false : hasOriginalLineCount || stats.size < TEXT_RANGE_FAST_PATH_MAX_SIZE;
|
|
60258
60642
|
const configCharLimit = config.getTruncateToolOutputThreshold();
|
|
60259
60643
|
let llmContent = "";
|
|
60260
60644
|
let contentLengthTruncated = false;
|
|
@@ -60286,12 +60670,25 @@ async function processSingleFileContent(filePath, config, optionsOrOffset, legac
|
|
|
60286
60670
|
llmContent = selectedLines.join("\n");
|
|
60287
60671
|
linesIncluded = selectedLines.length;
|
|
60288
60672
|
}
|
|
60673
|
+
if (_meta?.truncatedByBytes === true) {
|
|
60674
|
+
const marker = "... [truncated]";
|
|
60675
|
+
if (!llmContent.endsWith(marker)) {
|
|
60676
|
+
const prefix = Number.isFinite(configCharLimit) ? llmContent.slice(
|
|
60677
|
+
0,
|
|
60678
|
+
Math.max(configCharLimit - marker.length - 1, 0)
|
|
60679
|
+
) : llmContent;
|
|
60680
|
+
const separator = prefix.length === 0 || prefix.endsWith("\n") ? "" : "\n";
|
|
60681
|
+
llmContent = prefix + separator + marker;
|
|
60682
|
+
}
|
|
60683
|
+
contentLengthTruncated = true;
|
|
60684
|
+
}
|
|
60289
60685
|
const actualEndLine = startLine + linesIncluded;
|
|
60290
|
-
const contentRangeTruncated = startLine > 0 || actualEndLine < originalLineCount;
|
|
60686
|
+
const contentRangeTruncated = startLine > 0 || !originalLineCountExact || actualEndLine < originalLineCount;
|
|
60291
60687
|
const isTruncated = contentRangeTruncated || contentLengthTruncated;
|
|
60688
|
+
const lineCountLabel = originalLineCountExact ? `${originalLineCount}` : `at least ${originalLineCount}`;
|
|
60292
60689
|
let returnDisplay = "";
|
|
60293
60690
|
if (isTruncated) {
|
|
60294
|
-
returnDisplay = `Read lines ${startLine + 1}-${actualEndLine} of ${
|
|
60691
|
+
returnDisplay = `Read lines ${startLine + 1}-${actualEndLine} of ${lineCountLabel} from ${relativePathForDisplay}`;
|
|
60295
60692
|
if (contentLengthTruncated) {
|
|
60296
60693
|
returnDisplay += " (truncated)";
|
|
60297
60694
|
}
|
|
@@ -60301,6 +60698,7 @@ async function processSingleFileContent(filePath, config, optionsOrOffset, legac
|
|
|
60301
60698
|
returnDisplay,
|
|
60302
60699
|
isTruncated,
|
|
60303
60700
|
originalLineCount,
|
|
60701
|
+
originalLineCountExact,
|
|
60304
60702
|
linesShown: [startLine + 1, actualEndLine],
|
|
60305
60703
|
stats
|
|
60306
60704
|
};
|
|
@@ -60331,7 +60729,7 @@ async function processSingleFileContent(filePath, config, optionsOrOffset, legac
|
|
|
60331
60729
|
};
|
|
60332
60730
|
}
|
|
60333
60731
|
case "pdf": {
|
|
60334
|
-
if (!
|
|
60732
|
+
if (!pageRange && modalities.pdf) {
|
|
60335
60733
|
const contentBuffer = await fs2.promises.readFile(filePath);
|
|
60336
60734
|
const base64Data = contentBuffer.toString("base64");
|
|
60337
60735
|
const base64SizeInMB = base64Data.length / (1024 * 1024);
|
|
@@ -60354,16 +60752,38 @@ async function processSingleFileContent(filePath, config, optionsOrOffset, legac
|
|
|
60354
60752
|
returnDisplay: `Read pdf file: ${relativePathForDisplay}`
|
|
60355
60753
|
};
|
|
60356
60754
|
}
|
|
60357
|
-
const
|
|
60358
|
-
const pdfResult = await extractPDFText(
|
|
60359
|
-
filePath,
|
|
60360
|
-
pageRange ?? void 0
|
|
60361
|
-
);
|
|
60755
|
+
const pdfResult = await extractPDFText(filePath, pageRange);
|
|
60362
60756
|
if (pdfResult.success) {
|
|
60363
|
-
const
|
|
60757
|
+
const estimatedTokens = estimatePDFTextOutputTokens(pdfResult.text);
|
|
60758
|
+
if (estimatedTokens > PDF_TEXT_RESULT_MAX_TOKENS) {
|
|
60759
|
+
debugLogger2.debug(
|
|
60760
|
+
`PDF text extraction output exceeds token limit: file=${relativePathForDisplay}, pages=${normalizedPages ?? "all"}, estimatedTokens=${estimatedTokens}, limit=${PDF_TEXT_RESULT_MAX_TOKENS}`
|
|
60761
|
+
);
|
|
60762
|
+
const guidance = buildPDFTextTooLargeGuidance(
|
|
60763
|
+
displayName,
|
|
60764
|
+
estimatedTokens,
|
|
60765
|
+
normalizedPages
|
|
60766
|
+
);
|
|
60767
|
+
if (!pageRange && largePdfBehavior === "reference") {
|
|
60768
|
+
return {
|
|
60769
|
+
llmContent: guidance,
|
|
60770
|
+
returnDisplay: `Referenced large PDF: ${relativePathForDisplay}`,
|
|
60771
|
+
stats
|
|
60772
|
+
};
|
|
60773
|
+
}
|
|
60774
|
+
return {
|
|
60775
|
+
llmContent: guidance,
|
|
60776
|
+
returnDisplay: `PDF text too large: ${relativePathForDisplay}`,
|
|
60777
|
+
error: guidance,
|
|
60778
|
+
errorType: "file_too_large" /* FILE_TOO_LARGE */,
|
|
60779
|
+
stats
|
|
60780
|
+
};
|
|
60781
|
+
}
|
|
60782
|
+
const pagesLabel = normalizedPages ? ` (pages ${normalizedPages})` : "";
|
|
60364
60783
|
return {
|
|
60365
60784
|
llmContent: pdfResult.text,
|
|
60366
|
-
returnDisplay: `Read pdf as text${pagesLabel}: ${relativePathForDisplay}
|
|
60785
|
+
returnDisplay: `Read pdf as text${pagesLabel}: ${relativePathForDisplay}`,
|
|
60786
|
+
stats
|
|
60367
60787
|
};
|
|
60368
60788
|
}
|
|
60369
60789
|
return {
|
|
@@ -60402,6 +60822,9 @@ async function processSingleFileContent(filePath, config, optionsOrOffset, legac
|
|
|
60402
60822
|
}
|
|
60403
60823
|
}
|
|
60404
60824
|
} catch (error) {
|
|
60825
|
+
if (signal?.aborted || isAbortError(error)) {
|
|
60826
|
+
throw error;
|
|
60827
|
+
}
|
|
60405
60828
|
const errorMessage2 = getErrorMessage(error);
|
|
60406
60829
|
const displayPath = path2.relative(rootDirectory, filePath).replace(/\\/g, "/");
|
|
60407
60830
|
return {
|
|
@@ -60413,6 +60836,24 @@ async function processSingleFileContent(filePath, config, optionsOrOffset, legac
|
|
|
60413
60836
|
}
|
|
60414
60837
|
}
|
|
60415
60838
|
__name(processSingleFileContent, "processSingleFileContent");
|
|
60839
|
+
function getRangeReadByteLimit(config) {
|
|
60840
|
+
const charLimit = config.getTruncateToolOutputThreshold();
|
|
60841
|
+
if (charLimit === Number.POSITIVE_INFINITY) {
|
|
60842
|
+
return Number.POSITIVE_INFINITY;
|
|
60843
|
+
}
|
|
60844
|
+
if (!Number.isFinite(charLimit)) {
|
|
60845
|
+
return DEFAULT_RANGE_READ_BYTES;
|
|
60846
|
+
}
|
|
60847
|
+
return Math.max(DEFAULT_RANGE_READ_BYTES, Math.floor(charLimit) * 4);
|
|
60848
|
+
}
|
|
60849
|
+
__name(getRangeReadByteLimit, "getRangeReadByteLimit");
|
|
60850
|
+
function normalizeRangeReadByteLimit(maxOutputBytes) {
|
|
60851
|
+
if (maxOutputBytes === Number.POSITIVE_INFINITY) {
|
|
60852
|
+
return Number.POSITIVE_INFINITY;
|
|
60853
|
+
}
|
|
60854
|
+
return typeof maxOutputBytes === "number" && Number.isFinite(maxOutputBytes) ? maxOutputBytes : DEFAULT_RANGE_READ_BYTES;
|
|
60855
|
+
}
|
|
60856
|
+
__name(normalizeRangeReadByteLimit, "normalizeRangeReadByteLimit");
|
|
60416
60857
|
async function fileExists(filePath) {
|
|
60417
60858
|
try {
|
|
60418
60859
|
await fsPromises.access(filePath, fs2.constants.F_OK);
|
|
@@ -69429,11 +69870,11 @@ async function createContentGenerator(generatorConfig, config, isInitialAuth) {
|
|
|
69429
69870
|
let baseGenerator;
|
|
69430
69871
|
try {
|
|
69431
69872
|
if (authType === "openai" /* USE_OPENAI */) {
|
|
69432
|
-
const { createOpenAIContentGenerator } = await import("./openaiContentGenerator-
|
|
69873
|
+
const { createOpenAIContentGenerator } = await import("./openaiContentGenerator-BA6NWY4S.js");
|
|
69433
69874
|
baseGenerator = createOpenAIContentGenerator(generatorConfig, config);
|
|
69434
69875
|
} else if (authType === "qwen-oauth" /* QWEN_OAUTH */) {
|
|
69435
69876
|
const { getQwenOAuthClient: getQwenOauthClient } = await import("./qwenOAuth2-ZV7YLMND.js");
|
|
69436
|
-
const { QwenContentGenerator } = await import("./qwenContentGenerator-
|
|
69877
|
+
const { QwenContentGenerator } = await import("./qwenContentGenerator-U4ZSLGFN.js");
|
|
69437
69878
|
try {
|
|
69438
69879
|
const qwenClient = await getQwenOauthClient(
|
|
69439
69880
|
config,
|
|
@@ -69451,10 +69892,10 @@ async function createContentGenerator(generatorConfig, config, isInitialAuth) {
|
|
|
69451
69892
|
throw new Error(error instanceof Error ? error.message : String(error));
|
|
69452
69893
|
}
|
|
69453
69894
|
} else if (authType === "anthropic" /* USE_ANTHROPIC */) {
|
|
69454
|
-
const { createAnthropicContentGenerator } = await import("./anthropicContentGenerator-
|
|
69895
|
+
const { createAnthropicContentGenerator } = await import("./anthropicContentGenerator-AKYPSZIV.js");
|
|
69455
69896
|
baseGenerator = createAnthropicContentGenerator(generatorConfig, config);
|
|
69456
69897
|
} else if (authType === "gemini" /* USE_GEMINI */ || authType === "vertex-ai" /* USE_VERTEX_AI */) {
|
|
69457
|
-
const { createGeminiContentGenerator } = await import("./geminiContentGenerator-
|
|
69898
|
+
const { createGeminiContentGenerator } = await import("./geminiContentGenerator-DCM2XGDQ.js");
|
|
69458
69899
|
baseGenerator = createGeminiContentGenerator(generatorConfig, config);
|
|
69459
69900
|
} else {
|
|
69460
69901
|
throw new Error(
|
|
@@ -71996,7 +72437,7 @@ var ReadFileToolInvocation = class extends BaseToolInvocation {
|
|
|
71996
72437
|
}
|
|
71997
72438
|
return "ask";
|
|
71998
72439
|
}
|
|
71999
|
-
async execute() {
|
|
72440
|
+
async execute(signal) {
|
|
72000
72441
|
const absPath = path10.resolve(this.params.file_path);
|
|
72001
72442
|
const projectRoot = this.config.getTargetDir();
|
|
72002
72443
|
const isAutoMem = isAnyAutoMemPath(absPath, projectRoot);
|
|
@@ -72029,7 +72470,8 @@ var ReadFileToolInvocation = class extends BaseToolInvocation {
|
|
|
72029
72470
|
{
|
|
72030
72471
|
offset: this.params.offset,
|
|
72031
72472
|
limit: this.params.limit,
|
|
72032
|
-
pages: this.params.pages
|
|
72473
|
+
pages: this.params.pages,
|
|
72474
|
+
signal
|
|
72033
72475
|
}
|
|
72034
72476
|
);
|
|
72035
72477
|
if (result.error) {
|
|
@@ -72054,7 +72496,8 @@ var ReadFileToolInvocation = class extends BaseToolInvocation {
|
|
|
72054
72496
|
if (result.isTruncated && result.linesShown && result.originalLineCount !== void 0) {
|
|
72055
72497
|
const [start, end] = result.linesShown;
|
|
72056
72498
|
const total = result.originalLineCount;
|
|
72057
|
-
|
|
72499
|
+
const totalLabel = result.originalLineCountExact === false ? `at least ${total}` : total;
|
|
72500
|
+
llmContent = `Showing lines ${start}-${end} of ${totalLabel} total lines.
|
|
72058
72501
|
|
|
72059
72502
|
---
|
|
72060
72503
|
|
|
@@ -72131,7 +72574,7 @@ var ReadFileTool = class _ReadFileTool extends BaseDeclarativeTool {
|
|
|
72131
72574
|
super(
|
|
72132
72575
|
_ReadFileTool.Name,
|
|
72133
72576
|
ToolDisplayNames.READ_FILE,
|
|
72134
|
-
`Reads and returns the content of a specified file. The file_path argument MUST be an absolute path. Always construct it by combining the project root with the file's relative path (e.g. project root '/path/to/project/' + relative 'foo/bar.txt' = '/path/to/project/foo/bar.txt'). If the user provides a relative path, resolve it against the project root first. If the file is large, the content will be truncated. The tool's response will clearly indicate if truncation has occurred and will provide details on how to read more of the file using the 'offset' and 'limit' parameters. Handles text, images (PNG, JPG, GIF, WEBP, SVG, BMP), PDF files, and Jupyter notebooks (.ipynb). For text files, it can read specific line ranges. For PDF files, use the 'pages' parameter to extract specific page ranges as text (e.g. '1-5'). Max
|
|
72577
|
+
`Reads and returns the content of a specified file. The file_path argument MUST be an absolute path. Always construct it by combining the project root with the file's relative path (e.g. project root '/path/to/project/' + relative 'foo/bar.txt' = '/path/to/project/foo/bar.txt'). If the user provides a relative path, resolve it against the project root first. If the file is large, the content will be truncated. The tool's response will clearly indicate if truncation has occurred and will provide details on how to read more of the file using the 'offset' and 'limit' parameters. Handles text, images (PNG, JPG, GIF, WEBP, SVG, BMP), PDF files, and Jupyter notebooks (.ipynb). For text files, it can read specific line ranges. For PDF files, use the 'pages' parameter to extract specific page ranges as text (e.g. '1-5'). Max ${PDF_MAX_PAGES_PER_READ} pages per request. Large PDFs cannot be read all at once when the model does not support native PDF input; retry with narrower page ranges if the tool reports a PDF is too large. This tool can read Jupyter notebooks (.ipynb) and returns structured cell content with outputs.`,
|
|
72135
72578
|
"read" /* Read */,
|
|
72136
72579
|
{
|
|
72137
72580
|
properties: {
|
|
@@ -72148,7 +72591,7 @@ var ReadFileTool = class _ReadFileTool extends BaseDeclarativeTool {
|
|
|
72148
72591
|
type: "integer"
|
|
72149
72592
|
},
|
|
72150
72593
|
pages: {
|
|
72151
|
-
description:
|
|
72594
|
+
description: `Optional: For PDF files, the page range to extract as text (e.g., '1-5', '3', '10-20'). Pages are 1-indexed. Max ${PDF_MAX_PAGES_PER_READ} pages per request. Open-ended ranges like '3-' are not supported. Use this for large PDFs or when the model does not support native PDF input.`,
|
|
72152
72595
|
type: "string"
|
|
72153
72596
|
}
|
|
72154
72597
|
},
|
|
@@ -72201,9 +72644,9 @@ var ReadFileTool = class _ReadFileTool extends BaseDeclarativeTool {
|
|
|
72201
72644
|
return `Invalid pages parameter: '${params.pages}'. Use formats like '5' or '1-10'.`;
|
|
72202
72645
|
}
|
|
72203
72646
|
if (parsed.lastPage === Infinity) {
|
|
72204
|
-
return `Open-ended page ranges (e.g. '3-') are not supported; specify an explicit end page within the
|
|
72647
|
+
return `Open-ended page ranges (e.g. '3-') are not supported; specify an explicit end page within the ${PDF_MAX_PAGES_PER_READ}-page limit (e.g. '3-22').`;
|
|
72205
72648
|
}
|
|
72206
|
-
const maxPages =
|
|
72649
|
+
const maxPages = PDF_MAX_PAGES_PER_READ;
|
|
72207
72650
|
if (parsed.lastPage - parsed.firstPage + 1 > maxPages) {
|
|
72208
72651
|
return `Pages range exceeds maximum of ${maxPages} pages per request.`;
|
|
72209
72652
|
}
|
|
@@ -72560,6 +73003,11 @@ export {
|
|
|
72560
73003
|
* Copyright 2025 Qwen Team
|
|
72561
73004
|
* SPDX-License-Identifier: Apache-2.0
|
|
72562
73005
|
*/
|
|
73006
|
+
/**
|
|
73007
|
+
* @license
|
|
73008
|
+
* Copyright 2026 Qwen Team
|
|
73009
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
73010
|
+
*/
|
|
72563
73011
|
/**
|
|
72564
73012
|
* @license
|
|
72565
73013
|
* Copyright 2025 Qwen Team
|
|
@@ -72571,11 +73019,6 @@ export {
|
|
|
72571
73019
|
* (suggestion generation, forked queries) so that logging, recording,
|
|
72572
73020
|
* and UI layers can consistently recognise and filter them.
|
|
72573
73021
|
*/
|
|
72574
|
-
/**
|
|
72575
|
-
* @license
|
|
72576
|
-
* Copyright 2026 Qwen Team
|
|
72577
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
72578
|
-
*/
|
|
72579
73022
|
/**
|
|
72580
73023
|
* @license
|
|
72581
73024
|
* Copyright 2025 Qwen
|