@qwen-code/qwen-code 0.19.6 → 0.19.7-nightly.20260708.394c1a289
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/model-providers.md +5 -1
- package/bundled/qc-helper/docs/configuration/settings.md +33 -1
- package/bundled/qc-helper/docs/features/channels/_meta.ts +1 -0
- package/bundled/qc-helper/docs/features/channels/overview.md +41 -31
- package/bundled/qc-helper/docs/features/channels/wecom.md +111 -0
- package/bundled/qc-helper/docs/features/code-review.md +16 -6
- package/bundled/qc-helper/docs/features/commands.md +1 -1
- package/bundled/qc-helper/docs/features/hooks.md +6 -0
- package/bundled/qc-helper/docs/features/skills.md +5 -3
- package/bundled/qc-helper/docs/integration-github-action.md +1 -1
- package/bundled/review/DESIGN.md +50 -18
- package/bundled/review/SKILL.md +102 -12
- package/chunks/{MaxSizedBox-SK7CUWZQ.js → MaxSizedBox-XS37LWTD.js} +31 -29
- package/chunks/{StandaloneSessionPicker-G44HGSAP.js → StandaloneSessionPicker-LPALJTKN.js} +44 -41
- package/chunks/{acpAgent-PKCTYWJV.js → acpAgent-4VE3FGJX.js} +769 -366
- package/chunks/{agent-IYMHUXWB.js → agent-CCHERW6L.js} +24 -24
- package/chunks/{agent-headless-L2DAW6I5.js → agent-headless-55N6UBUU.js} +24 -24
- package/chunks/{anthropicContentGenerator-H5ZOEENQ.js → anthropicContentGenerator-AKYPSZIV.js} +7 -7
- package/chunks/{artifact-tool-SLYPWG3C.js → artifact-tool-D233YJFH.js} +27 -8
- package/chunks/{askUserQuestion-OKPTECON.js → askUserQuestion-MKL5ZTMC.js} +2 -2
- package/chunks/{bridge-DF3IJQ5V.js → bridge-U6HXOHE7.js} +34 -32
- package/chunks/{channel-worker-supervisor-JUYQ5Z4R.js → channel-worker-supervisor-CRCVYQIE.js} +1 -1
- package/chunks/{chunk-AVQDCKNF.js → chunk-22MNNNXE.js} +4 -0
- package/chunks/chunk-2DYY5XUZ.js +8223 -0
- package/chunks/chunk-2FHWCKWA.js +262 -0
- package/chunks/{chunk-6BEOH4KK.js → chunk-2NPS2UDH.js} +767 -122
- package/chunks/{chunk-N2IJLN2L.js → chunk-2SWMCXVR.js} +13 -5
- package/chunks/{chunk-OBVBTAX5.js → chunk-2YELHTUE.js} +2 -2
- package/chunks/chunk-332PWN27.js +19 -0
- package/chunks/{chunk-CLQPBI4H.js → chunk-3B26UVCX.js} +132 -26
- package/chunks/{chunk-HCFSKO6K.js → chunk-3QDZDAJG.js} +1 -1
- package/chunks/{chunk-G7OQ3RFJ.js → chunk-42XGFRJS.js} +3 -3
- package/chunks/{chunk-SL2P3JUA.js → chunk-43W4YSO6.js} +1 -12
- package/chunks/{chunk-JA5KWZTJ.js → chunk-44NROQYV.js} +5 -3
- package/chunks/{chunk-BOAWGUY6.js → chunk-4AFOWB47.js} +121 -49
- package/chunks/{chunk-MOUXUCXQ.js → chunk-4KJ2BPIT.js} +1 -1
- package/chunks/{chunk-YTWX5TT2.js → chunk-5FL2K3ZB.js} +1 -1
- package/chunks/{chunk-UNXGEDX2.js → chunk-5OSSOBZC.js} +133 -25
- package/chunks/{chunk-JN2VJ33O.js → chunk-7I4MGFBN.js} +966 -121
- package/chunks/{chunk-T42ACHFI.js → chunk-7LTB54MK.js} +1 -1
- package/chunks/chunk-A2X3KLC3.js +3807 -0
- package/chunks/{chunk-EWALXUAD.js → chunk-AGHU5VRK.js} +8 -0
- package/chunks/{chunk-GLPV75ES.js → chunk-AHNJGLFV.js} +2 -2
- package/chunks/{chunk-IUSKVKH5.js → chunk-AXTPFMRS.js} +1 -1
- package/chunks/{chunk-T22H4V4R.js → chunk-B34OV7K2.js} +1 -1
- package/chunks/{chunk-FZ5NVRVK.js → chunk-B5FOCTEZ.js} +3 -3
- package/chunks/{chunk-3UC7ZC43.js → chunk-B6WUEODT.js} +7 -7
- package/chunks/{chunk-MJKEQSZI.js → chunk-BGL43SJ3.js} +1 -1
- package/chunks/{chunk-OAYOHSGP.js → chunk-BHRU4SDF.js} +4 -4
- package/chunks/{chunk-YPCPZSZB.js → chunk-CCGOFQV3.js} +56 -4
- package/chunks/{chunk-FDY3XOTM.js → chunk-CR5IU2RX.js} +4 -4
- package/chunks/{chunk-LWGLBVWA.js → chunk-CSOTA7KX.js} +1 -1
- package/chunks/{chunk-AGZF43UV.js → chunk-E7HM76PR.js} +7153 -4406
- package/chunks/{chunk-NIOPRZNN.js → chunk-E7KNELIZ.js} +1 -1
- package/chunks/{chunk-YSU33ACT.js → chunk-ELMPRVCB.js} +5 -13
- package/chunks/{chunk-SEZC2725.js → chunk-ER3BKOLB.js} +13 -0
- package/chunks/{chunk-3VJ7MT3N.js → chunk-EXPMGZZV.js} +14 -3
- package/chunks/{chunk-DBF3HTLT.js → chunk-FB2ULV4M.js} +4 -4
- package/chunks/{chunk-RZORUN6X.js → chunk-FEJ2FZ3U.js} +1 -1
- package/chunks/chunk-FK77ILF5.js +2477 -0
- package/chunks/{chunk-DMSNJDWG.js → chunk-FV7425LN.js} +38 -3
- package/chunks/{chunk-ALX6BUYW.js → chunk-G7ZG7CA6.js} +186 -27
- package/chunks/{chunk-2INJBYLJ.js → chunk-GIY6JTTC.js} +6 -6
- package/chunks/{chunk-D5KISTLW.js → chunk-H6EMK6QK.js} +1 -1
- package/chunks/{chunk-KYTQOCDE.js → chunk-HW4N45EE.js} +17 -46
- package/chunks/{chunk-VXGPYF7U.js → chunk-IFEWJXFS.js} +1 -1
- package/chunks/chunk-II73RK2S.js +158 -0
- package/chunks/{chunk-TENOUWY2.js → chunk-IJRL2S3D.js} +3 -3
- package/chunks/{chunk-GQBRGBLS.js → chunk-J43WPR6U.js} +9 -9
- package/chunks/{chunk-SRNPMG7J.js → chunk-JYOWO2F7.js} +16 -10
- package/chunks/{chunk-57NRQM3P.js → chunk-K34DD7FH.js} +2 -2
- package/chunks/{chunk-O2RJARYU.js → chunk-KKWO4IX2.js} +1409 -4088
- package/chunks/{chunk-SOT7OMGL.js → chunk-KT3SI3CQ.js} +2 -2
- package/chunks/{chunk-NUK2PFSU.js → chunk-L7IWK7JY.js} +1 -1
- package/chunks/{chunk-MHQKYQDS.js → chunk-LC4SMGYY.js} +158 -3
- package/chunks/chunk-LGFAYIKX.js +115 -0
- package/chunks/{chunk-MBWLP5OT.js → chunk-LKXDC3AW.js} +162 -40
- package/chunks/{chunk-7Z6UEJA4.js → chunk-ME344634.js} +5 -2
- package/chunks/{chunk-V6NH3CUC.js → chunk-MOQOAH7N.js} +3 -3
- package/chunks/{chunk-FPHA7WIZ.js → chunk-MYZWWRVW.js} +3 -3
- package/chunks/{chunk-YHTNWGRR.js → chunk-MZ7BABX3.js} +1 -1
- package/chunks/chunk-N74BA4VP.js +949 -0
- package/chunks/{chunk-B236XPGF.js → chunk-NQKLOAVJ.js} +29 -2
- package/chunks/{chunk-LXFCHX4X.js → chunk-OU6FPTJZ.js} +312 -25
- package/chunks/{chunk-HTWHAN44.js → chunk-PC4ZXHU2.js} +1 -1
- package/chunks/{chunk-3X76L4UF.js → chunk-PLGONYEL.js} +5 -5
- package/chunks/{chunk-WXUDZHOJ.js → chunk-PVXPDMGP.js} +10 -2
- package/chunks/{chunk-ZO5EA3XJ.js → chunk-QCSLZO6J.js} +1 -1
- package/chunks/{chunk-CEYA7K7C.js → chunk-QHT5USLK.js} +62 -12
- package/chunks/{chunk-NPQWQYU6.js → chunk-QYNNN7BK.js} +1 -1
- package/chunks/{chunk-N4YJQTRL.js → chunk-RFIL6REB.js} +71 -2
- package/chunks/{chunk-KSPVDFE4.js → chunk-SAIILPQ3.js} +0 -3
- package/chunks/{chunk-OIFSBXSP.js → chunk-SJHAUELE.js} +3 -3
- package/chunks/{chunk-BZHLWC6T.js → chunk-SUAKHHK7.js} +2 -2
- package/chunks/{chunk-QOKV6AO4.js → chunk-T2EJHSE3.js} +184 -147
- package/chunks/{chunk-ZI4MGBB5.js → chunk-TBAZMRW3.js} +1 -1
- package/chunks/{chunk-6QVRLKTZ.js → chunk-TBLJNMI7.js} +7 -7
- package/chunks/{chunk-J6ABRKAB.js → chunk-TDGF35EN.js} +2 -2
- package/chunks/chunk-TEYGKLIZ.js +167 -0
- package/chunks/{chunk-TOAUDIS7.js → chunk-TLWA7TPR.js} +6 -2
- package/chunks/chunk-UIDXQNMV.js +13 -0
- package/chunks/{chunk-MX7CTJHR.js → chunk-UZCT5OLN.js} +9 -9
- package/chunks/{chunk-LM3YCCZJ.js → chunk-VEB3NYSO.js} +1 -1
- package/chunks/{chunk-UTL7KABL.js → chunk-VQJ64BIQ.js} +7 -7
- package/chunks/{chunk-C2QKQZEQ.js → chunk-VTCPREC7.js} +3 -3
- package/chunks/{chunk-5ES5YPED.js → chunk-VZ7HY3YU.js} +1 -1
- package/chunks/{chunk-QOMAHFYI.js → chunk-W7EEOR7D.js} +3 -3
- package/chunks/{chunk-NVFJSIAX.js → chunk-WMPVYQ4P.js} +1 -1
- package/chunks/{chunk-V5VTULL5.js → chunk-X265R5C6.js} +3 -3
- package/chunks/{chunk-LKWAVAB5.js → chunk-X2XNQQJI.js} +2 -2
- package/chunks/{chunk-MJKMIQMK.js → chunk-X3YGAX7V.js} +1 -1
- package/chunks/{chunk-5WQF27GW.js → chunk-XQ2GVLNJ.js} +1 -1
- package/chunks/chunk-XUSONNJ4.js +28 -0
- package/chunks/{chunk-DXXNMPJH.js → chunk-YMWIKAEE.js} +460 -93
- package/chunks/{chunk-A34EPIUV.js → chunk-YYU6H66M.js} +18 -15
- package/chunks/{chunk-XH7H6YG4.js → chunk-ZK5EI6NR.js} +4 -107
- package/chunks/{computer-use-5S3NVXRA.js → computer-use-4CTF6WS3.js} +24 -24
- package/chunks/{contextCommand-DPBALZFK.js → contextCommand-Z3XWQCY6.js} +28 -27
- package/chunks/{cron-create-7JYUDTUY.js → cron-create-JSXEIPVS.js} +4 -4
- package/chunks/{cron-delete-YPULQQAK.js → cron-delete-OIFVEPGU.js} +4 -4
- package/chunks/{cron-list-HJIW5MHP.js → cron-list-D4ZX4IOE.js} +11 -7
- package/chunks/{daemon-7XYW4BC3.js → daemon-F3I2RXP6.js} +208 -63
- package/chunks/daemon-status-provider-6A4QCG6Q.js +74 -0
- package/chunks/dist-573HNSVO.js +3217 -0
- package/chunks/{dist-ABQ7VWRR.js → dist-FQ5WRJPL.js} +2 -2
- package/chunks/{dist-JPSVN367.js → dist-IMFFBMAT.js} +6 -3792
- package/chunks/{dist-BV56HW3W.js → dist-OT7G2WNM.js} +250 -1
- package/chunks/{dist-AW5ZYMUI.js → dist-PKFTNUHO.js} +10 -11
- package/chunks/{dist-AAO65DPC.js → dist-YTRKAVUB.js} +1 -1
- package/chunks/{earlyInputCapture-GGPV4IFT.js → earlyInputCapture-7O47HW62.js} +25 -25
- package/chunks/{edit-HJ7ISN4C.js → edit-E32KWLF2.js} +25 -25
- package/chunks/{en-XR3S5VWY.js → en-GA2RMXY5.js} +6 -1
- package/chunks/{enter-worktree-2BQT675D.js → enter-worktree-ZKFFMHUD.js} +24 -24
- package/chunks/{enterPlanMode-SJXHJ3WD.js → enterPlanMode-HLDC6NGX.js} +24 -24
- package/chunks/{errors-EVGER4AZ.js → errors-MTIDDXX7.js} +26 -26
- package/chunks/{exit-worktree-RPDDOSPM.js → exit-worktree-YHY72XA2.js} +24 -24
- package/chunks/{exitPlanMode-BQEROAJ7.js → exitPlanMode-JNXKBZ2C.js} +24 -24
- package/chunks/{fast-path-FX2ICJ2O.js → fast-path-DVAGBROV.js} +5 -2
- package/chunks/{fr-MBMNQSQ6.js → fr-GWNQG4XH.js} +4 -0
- package/chunks/{gemini-EHUXCOUI.js → gemini-2TMHJVRC.js} +444 -256
- package/chunks/{geminiContentGenerator-YDUUKAM2.js → geminiContentGenerator-WCH4GWD3.js} +4 -4
- package/chunks/{glob-3VIGV2DL.js → glob-I6Y4AGKO.js} +52 -28
- package/chunks/{grep-4D3S4NUC.js → grep-3P2J3LU5.js} +24 -24
- package/chunks/handleAutoUpdate-4IVRMRG4.js +65 -0
- package/chunks/{initializer-QZTZSSLW.js → initializer-DVNCPVTC.js} +31 -29
- package/chunks/{ja-HFV5QCHR.js → ja-2HOTA47X.js} +4 -0
- package/chunks/{keychain-token-storage-GPAKRDKQ.js → keychain-token-storage-UJV5XP4Z.js} +2 -2
- package/chunks/{list-WQ24EAMK.js → list-4D6QK2KZ.js} +30 -30
- package/chunks/{loadedSettingsAdapter-XV74KOSR.js → loadedSettingsAdapter-GNGELH6Q.js} +28 -28
- package/chunks/{loop-wakeup-34YK7T7O.js → loop-wakeup-OHWEMFP5.js} +5 -5
- package/chunks/{ls-MPD5OJUX.js → ls-L654WOAT.js} +4 -4
- package/chunks/{lsp-72PWTDW7.js → lsp-M35KE54Y.js} +2 -2
- package/chunks/{mcp-CO3MKM7N.js → mcp-2IL72YJP.js} +28 -28
- package/chunks/{monitor-GB56T65A.js → monitor-BLVCZAVX.js} +32 -27
- package/chunks/nonInteractiveCli-UD3V7UOO.js +116 -0
- package/chunks/{notebook-edit-VMXAAE3R.js → notebook-edit-5TVMWIWY.js} +25 -25
- package/chunks/{openaiContentGenerator-GM77FLII.js → openaiContentGenerator-5LJ5A7YY.js} +12 -12
- package/chunks/{pidfile-HFXSHR64.js → pidfile-AN5JQJ2T.js} +25 -25
- package/chunks/{qwenContentGenerator-QSCXQIKJ.js → qwenContentGenerator-E2JSB4FJ.js} +26 -26
- package/chunks/{qwenOAuth2-LWLA6MQG.js → qwenOAuth2-ZV7YLMND.js} +5 -5
- package/chunks/{read-file-SVH6CGQY.js → read-file-N5DEFUDU.js} +8 -8
- package/chunks/{read-mcp-resource-OWOBJY72.js → read-mcp-resource-CNQHBSJM.js} +2 -2
- package/chunks/{record-artifact-URK3YUDJ.js → record-artifact-PP3LKHTS.js} +2 -2
- package/chunks/{ripGrep-JD5O2FLX.js → ripGrep-BLJHTHKE.js} +24 -24
- package/chunks/{run-qwen-serve-FADLRJUN.js → run-qwen-serve-4JDO64RN.js} +785 -35
- package/chunks/{scheduler-Q65SB7DJ.js → scheduler-FQR4XA7J.js} +24 -24
- package/chunks/{send-message-L7OLQEKH.js → send-message-OA6MV4EU.js} +3 -3
- package/chunks/{serve-6ZXAMQ4M.js → serve-ZOCFC7YM.js} +29 -29
- package/chunks/{server-WKDQA6XR.js → server-GEOYEPYT.js} +2504 -439
- package/chunks/{session-STWOX7RA.js → session-NJCONHGX.js} +66 -61
- package/chunks/{settings-LC4CCWQQ.js → settings-QBGGXANI.js} +27 -27
- package/chunks/{shell-FEG3RLPW.js → shell-2DVPSEKT.js} +24 -24
- package/chunks/{skill-XTXAMDAP.js → skill-HIPXUHV7.js} +24 -12
- package/chunks/{spawnChannel-B6JJPBPV.js → spawnChannel-3JYXY52G.js} +27 -27
- package/chunks/{src-HITDGVRM.js → src-NLEX4CUC.js} +91 -36
- package/chunks/{startInteractiveUI-IT423PW4.js → startInteractiveUI-TYGZIU27.js} +6213 -14273
- package/chunks/{syntheticOutput-J3MLCQAR.js → syntheticOutput-F7LSDCAR.js} +3 -3
- package/chunks/{task-create-ELEBZ7H2.js → task-create-RPFZNB4B.js} +7 -7
- package/chunks/{task-list-IEUZLF3Y.js → task-list-TGGJX7EA.js} +5 -5
- package/chunks/{task-stop-QEZW3UDY.js → task-stop-W7NGTMYQ.js} +2 -2
- package/chunks/{task-update-DW36J5P5.js → task-update-5WUG5MVQ.js} +7 -7
- package/chunks/{team-create-DAG6SNHZ.js → team-create-MGX57SZJ.js} +24 -24
- package/chunks/{team-delete-SVITIMBO.js → team-delete-UHQQ2QQX.js} +5 -5
- package/chunks/{team-plan-approval-DRDY5OPC.js → team-plan-approval-BO2N7J3E.js} +24 -24
- package/chunks/{theme-manager-N67EZC6B.js → theme-manager-WU7LOA64.js} +25 -25
- package/chunks/{todoWrite-SFFQHZYY.js → todoWrite-C4ZAMSR3.js} +4 -4
- package/chunks/{tool-search-CMDJ5HGM.js → tool-search-CLBKVEVK.js} +11 -28
- package/chunks/{trustedFolders-JD4QX6UJ.js → trustedFolders-GAQM2GHB.js} +25 -25
- package/chunks/updateCheck-RIK2YIQE.js +65 -0
- package/chunks/{validateNonInterActiveAuth-ADDCGZ6A.js → validateNonInterActiveAuth-NS3GBIJZ.js} +61 -56
- package/chunks/{version-VAONYVE5.js → version-B3RSLP54.js} +2 -1
- package/chunks/{web-fetch-SXAXJHIO.js → web-fetch-UYGMOHW4.js} +5 -5
- package/chunks/{workflow-DG2BR42M.js → workflow-7APPIGND.js} +25 -25
- package/chunks/{workspace-providers-status-XGW5OZTD.js → workspace-providers-status-SC67GLMY.js} +30 -30
- package/chunks/{workspace-service-GX3GGZLU.js → workspace-service-ZJHF22WA.js} +35 -35
- package/chunks/{workspace-skills-status-LFK5WV2V.js → workspace-skills-status-NJEK6P6Y.js} +29 -29
- package/chunks/{write-file-UR7FXWOU.js → write-file-R6Z3VLRY.js} +25 -25
- package/chunks/{zh-FSVJTXA4.js → zh-7XVVRTDH.js} +6 -1
- package/chunks/{zh-TW-66MG4LWL.js → zh-TW-DPH554OG.js} +6 -1
- package/cli.js +19 -11
- package/locales/en.js +9 -2
- package/locales/fr.js +6 -0
- package/locales/ja.js +6 -0
- package/locales/zh-TW.js +9 -2
- package/locales/zh.js +9 -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-CUpe0ibu.js → arc-C7hjaa7g.js} +1 -1
- package/web-shell/assets/{architectureDiagram-3BPJPVTR-JvyrY_mK.js → architectureDiagram-3BPJPVTR-pm9KtMZY.js} +1 -1
- package/web-shell/assets/{blockDiagram-GPEHLZMM-CK3Y_vom.js → blockDiagram-GPEHLZMM-CApElKsU.js} +1 -1
- package/web-shell/assets/{c4Diagram-AAUBKEIU-DprSnyrf.js → c4Diagram-AAUBKEIU-BeDe0-9N.js} +1 -1
- package/web-shell/assets/channel-BNf1dW-j.js +1 -0
- package/web-shell/assets/{chunk-2J33WTMH-DJtRJPmu.js → chunk-2J33WTMH-DJEkmLdl.js} +1 -1
- package/web-shell/assets/{chunk-4BX2VUAB-ON6Q2-BG.js → chunk-4BX2VUAB-DXX8gdpe.js} +1 -1
- package/web-shell/assets/{chunk-55IACEB6-c60ou5HZ.js → chunk-55IACEB6-DORmk1kQ.js} +1 -1
- package/web-shell/assets/{chunk-727SXJPM-BamtPKxx.js → chunk-727SXJPM-DWmO4mCZ.js} +1 -1
- package/web-shell/assets/{chunk-AQP2D5EJ-CsVgpu-T.js → chunk-AQP2D5EJ-C7LRaYw2.js} +1 -1
- package/web-shell/assets/{chunk-FMBD7UC4-vZrpjAx4.js → chunk-FMBD7UC4-CCdXgyC5.js} +1 -1
- package/web-shell/assets/{chunk-ND2GUHAM-qxyNOd5t.js → chunk-ND2GUHAM-SyL_xvWc.js} +1 -1
- package/web-shell/assets/{chunk-QZHKN3VN-BvTJSM_S.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-1tXB4pju.js → cose-bilkent-S5V4N54A-BMPWyDKc.js} +1 -1
- package/web-shell/assets/{dagre-BM42HDAG-DglBzme8.js → dagre-BM42HDAG-B_GnPWik.js} +1 -1
- package/web-shell/assets/{diagram-2AECGRRQ-DEJpqsWz.js → diagram-2AECGRRQ-fJqMc3S_.js} +1 -1
- package/web-shell/assets/{diagram-5GNKFQAL-CsQ1NrMG.js → diagram-5GNKFQAL-ximV3O9D.js} +1 -1
- package/web-shell/assets/{diagram-KO2AKTUF-Z-3codAi.js → diagram-KO2AKTUF-2vVyjzqw.js} +1 -1
- package/web-shell/assets/{diagram-LMA3HP47-mBuPTA2i.js → diagram-LMA3HP47-Dckcx1sT.js} +1 -1
- package/web-shell/assets/{diagram-OG6HWLK6-tcA3K3s9.js → diagram-OG6HWLK6-BAVv47ga.js} +1 -1
- package/web-shell/assets/{erDiagram-TEJ5UH35-D9bXFRyZ.js → erDiagram-TEJ5UH35-Bn3nf5J0.js} +1 -1
- package/web-shell/assets/{flowDiagram-I6XJVG4X-Ck0Py04s.js → flowDiagram-I6XJVG4X-BIbGF9JT.js} +1 -1
- package/web-shell/assets/{ganttDiagram-6RSMTGT7-rOevCekE.js → ganttDiagram-6RSMTGT7-CDbhb3AH.js} +1 -1
- package/web-shell/assets/{gitGraphDiagram-PVQCEYII-CoPQaLj0.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-a77CUKoI.js → infoDiagram-5YYISTIA-DUFxTy8m.js} +1 -1
- package/web-shell/assets/{ishikawaDiagram-YF4QCWOH-DlLgUAO-.js → ishikawaDiagram-YF4QCWOH-D69hrBG8.js} +1 -1
- package/web-shell/assets/{journeyDiagram-JHISSGLW-BXR5kVAZ.js → journeyDiagram-JHISSGLW-DsvEw51Y.js} +1 -1
- package/web-shell/assets/{kanban-definition-UN3LZRKU-h5CoHZg7.js → kanban-definition-UN3LZRKU-lFFjZEYd.js} +1 -1
- package/web-shell/assets/{linear-BkaREbyD.js → linear-Bo5bWzvo.js} +1 -1
- package/web-shell/assets/{mermaid.core-Bkagz0ng.js → mermaid.core-C_HKMJx5.js} +5 -5
- package/web-shell/assets/{mindmap-definition-RKZ34NQL-D7EMKR_5.js → mindmap-definition-RKZ34NQL-DlV-NUTs.js} +1 -1
- package/web-shell/assets/{pieDiagram-4H26LBE5-DAmPOjsL.js → pieDiagram-4H26LBE5-B2e6FH2a.js} +1 -1
- package/web-shell/assets/{quadrantDiagram-W4KKPZXB-e4WFQkQu.js → quadrantDiagram-W4KKPZXB-D75kSk-b.js} +1 -1
- package/web-shell/assets/{requirementDiagram-4Y6WPE33-v1zo7OiV.js → requirementDiagram-4Y6WPE33-CQ6xakhM.js} +1 -1
- package/web-shell/assets/{sankeyDiagram-5OEKKPKP-Bstm4aW_.js → sankeyDiagram-5OEKKPKP-J_XTKrcY.js} +1 -1
- package/web-shell/assets/{sequenceDiagram-3UESZ5HK-DzcZy6xN.js → sequenceDiagram-3UESZ5HK-D7jTcBtf.js} +1 -1
- package/web-shell/assets/{stateDiagram-AJRCARHV-BEJH6YbH.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-TI1wH-Pm.js → timeline-definition-PNZ67QCA-5oZi76Ef.js} +1 -1
- package/web-shell/assets/{vennDiagram-CIIHVFJN-YaH8VDMS.js → vennDiagram-CIIHVFJN-DO5YptPK.js} +1 -1
- package/web-shell/assets/{wardley-L42UT6IY-B80co7OP.js → wardley-L42UT6IY-4t1eJDvM.js} +1 -1
- package/web-shell/assets/{wardleyDiagram-YWT4CUSO-4fHNDEMl.js → wardleyDiagram-YWT4CUSO-DKZc661S.js} +1 -1
- package/web-shell/assets/{xychartDiagram-2RQKCTM6-DT3q4Z3J.js → xychartDiagram-2RQKCTM6-su9hp08G.js} +1 -1
- package/web-shell/index.html +2 -2
- package/chunks/chunk-L7QPM2YD.js +0 -481
- package/chunks/daemon-status-provider-2EWTHT7Y.js +0 -73
- package/chunks/nonInteractiveCli-HNZRIM5I.js +0 -111
- package/web-shell/assets/channel-BAxQ2-aZ.js +0 -1
- package/web-shell/assets/classDiagram-4FO5ZUOK-Cvd_xhZI.js +0 -1
- package/web-shell/assets/classDiagram-v2-Q7XG4LA2-Cvd_xhZI.js +0 -1
- package/web-shell/assets/index-Cr7MYW6T.css +0 -5
- package/web-shell/assets/index-DCHPAUp3.js +0 -730
- package/web-shell/assets/stateDiagram-v2-BHNVJYJU-BopifCBI.js +0 -1
|
@@ -23,28 +23,29 @@ import {
|
|
|
23
23
|
} from "./chunk-OMX7CUOE.js";
|
|
24
24
|
import {
|
|
25
25
|
isAnyAutoMemPath
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-4KJ2BPIT.js";
|
|
27
27
|
import {
|
|
28
28
|
InstallationManager
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-SUAKHHK7.js";
|
|
30
30
|
import {
|
|
31
31
|
STRUCTURED_OUTPUT_REDACTED_ARGS
|
|
32
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-FEJ2FZ3U.js";
|
|
33
33
|
import {
|
|
34
34
|
BaseDeclarativeTool,
|
|
35
35
|
BaseToolInvocation,
|
|
36
36
|
ToolDisplayNames,
|
|
37
37
|
ToolNames
|
|
38
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-X3YGAX7V.js";
|
|
39
39
|
import {
|
|
40
40
|
atomicWriteFile,
|
|
41
41
|
atomicWriteFileSync
|
|
42
|
-
} from "./chunk-
|
|
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";
|
|
@@ -70,7 +71,7 @@ import {
|
|
|
70
71
|
setShellTracePropagation,
|
|
71
72
|
shortenPath,
|
|
72
73
|
unescapePath
|
|
73
|
-
} from "./chunk-
|
|
74
|
+
} from "./chunk-22MNNNXE.js";
|
|
74
75
|
import {
|
|
75
76
|
require_dist
|
|
76
77
|
} from "./chunk-ZERZSAZL.js";
|
|
@@ -11644,7 +11645,7 @@ var require_error = __commonJS({
|
|
|
11644
11645
|
init_esbuild_shims();
|
|
11645
11646
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11646
11647
|
exports.getErrorMessage = getErrorMessage2;
|
|
11647
|
-
exports.getErrorCode =
|
|
11648
|
+
exports.getErrorCode = getErrorCode2;
|
|
11648
11649
|
function getErrorMessage2(error) {
|
|
11649
11650
|
if (error instanceof Error) {
|
|
11650
11651
|
return error.message;
|
|
@@ -11653,14 +11654,14 @@ var require_error = __commonJS({
|
|
|
11653
11654
|
}
|
|
11654
11655
|
}
|
|
11655
11656
|
__name(getErrorMessage2, "getErrorMessage");
|
|
11656
|
-
function
|
|
11657
|
+
function getErrorCode2(error) {
|
|
11657
11658
|
if (typeof error === "object" && error !== null && "code" in error && typeof error.code === "number") {
|
|
11658
11659
|
return error.code;
|
|
11659
11660
|
} else {
|
|
11660
11661
|
return null;
|
|
11661
11662
|
}
|
|
11662
11663
|
}
|
|
11663
|
-
__name(
|
|
11664
|
+
__name(getErrorCode2, "getErrorCode");
|
|
11664
11665
|
}
|
|
11665
11666
|
});
|
|
11666
11667
|
|
|
@@ -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
|
}
|
|
@@ -55599,13 +55600,13 @@ var require_B3MultiPropagator = __commonJS({
|
|
|
55599
55600
|
return Array.isArray(header) ? header[0] : header;
|
|
55600
55601
|
}
|
|
55601
55602
|
__name(parseHeader, "parseHeader");
|
|
55602
|
-
function
|
|
55603
|
+
function getHeaderValue2(carrier, getter, key) {
|
|
55603
55604
|
const header = getter.get(carrier, key);
|
|
55604
55605
|
return parseHeader(header);
|
|
55605
55606
|
}
|
|
55606
|
-
__name(
|
|
55607
|
+
__name(getHeaderValue2, "getHeaderValue");
|
|
55607
55608
|
function getTraceId(carrier, getter) {
|
|
55608
|
-
const traceId =
|
|
55609
|
+
const traceId = getHeaderValue2(carrier, getter, constants_1.X_B3_TRACE_ID);
|
|
55609
55610
|
if (typeof traceId === "string") {
|
|
55610
55611
|
return traceId.padStart(32, "0");
|
|
55611
55612
|
}
|
|
@@ -55613,7 +55614,7 @@ var require_B3MultiPropagator = __commonJS({
|
|
|
55613
55614
|
}
|
|
55614
55615
|
__name(getTraceId, "getTraceId");
|
|
55615
55616
|
function getSpanId2(carrier, getter) {
|
|
55616
|
-
const spanId =
|
|
55617
|
+
const spanId = getHeaderValue2(carrier, getter, constants_1.X_B3_SPAN_ID);
|
|
55617
55618
|
if (typeof spanId === "string") {
|
|
55618
55619
|
return spanId;
|
|
55619
55620
|
}
|
|
@@ -55621,12 +55622,12 @@ var require_B3MultiPropagator = __commonJS({
|
|
|
55621
55622
|
}
|
|
55622
55623
|
__name(getSpanId2, "getSpanId");
|
|
55623
55624
|
function getDebug(carrier, getter) {
|
|
55624
|
-
const debug =
|
|
55625
|
+
const debug = getHeaderValue2(carrier, getter, constants_1.X_B3_FLAGS);
|
|
55625
55626
|
return debug === "1" ? "1" : void 0;
|
|
55626
55627
|
}
|
|
55627
55628
|
__name(getDebug, "getDebug");
|
|
55628
55629
|
function getTraceFlags(carrier, getter) {
|
|
55629
|
-
const traceFlags =
|
|
55630
|
+
const traceFlags = getHeaderValue2(carrier, getter, constants_1.X_B3_SAMPLED);
|
|
55630
55631
|
const debug = getDebug(carrier, getter);
|
|
55631
55632
|
if (debug === "1" || VALID_SAMPLED_VALUES.has(traceFlags)) {
|
|
55632
55633
|
return api_1.TraceFlags.SAMPLED;
|
|
@@ -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");
|
|
@@ -60124,6 +60427,10 @@ async function detectFileType(filePath) {
|
|
|
60124
60427
|
return "text";
|
|
60125
60428
|
}
|
|
60126
60429
|
__name(detectFileType, "detectFileType");
|
|
60430
|
+
function isCacheableReadResult(result) {
|
|
60431
|
+
return typeof result.llmContent === "string" && result.originalLineCount !== void 0;
|
|
60432
|
+
}
|
|
60433
|
+
__name(isCacheableReadResult, "isCacheableReadResult");
|
|
60127
60434
|
function mediaModalityKey(fileType) {
|
|
60128
60435
|
if (fileType === "image" || fileType === "pdf" || fileType === "audio" || fileType === "video") {
|
|
60129
60436
|
return fileType;
|
|
@@ -60142,9 +60449,17 @@ async function processSingleFileContent(filePath, config, optionsOrOffset, legac
|
|
|
60142
60449
|
limit: legacyLimit,
|
|
60143
60450
|
pages: legacyPages
|
|
60144
60451
|
};
|
|
60145
|
-
const {
|
|
60452
|
+
const {
|
|
60453
|
+
offset,
|
|
60454
|
+
limit,
|
|
60455
|
+
pages,
|
|
60456
|
+
preserveUnsupportedImage = false,
|
|
60457
|
+
signal,
|
|
60458
|
+
largePdfBehavior = "error"
|
|
60459
|
+
} = options;
|
|
60146
60460
|
const rootDirectory = config.getTargetDir();
|
|
60147
60461
|
try {
|
|
60462
|
+
signal?.throwIfAborted();
|
|
60148
60463
|
let stats;
|
|
60149
60464
|
try {
|
|
60150
60465
|
stats = await fs2.promises.stat(filePath);
|
|
@@ -60180,16 +60495,83 @@ async function processSingleFileContent(filePath, config, optionsOrOffset, legac
|
|
|
60180
60495
|
const displayName = path2.basename(filePath);
|
|
60181
60496
|
const modalities = config.getContentGeneratorConfig?.()?.modalities ?? {};
|
|
60182
60497
|
const fileSizeInMB = stats.size / (1024 * 1024);
|
|
60183
|
-
const
|
|
60184
|
-
|
|
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) {
|
|
60185
60528
|
return {
|
|
60186
|
-
llmContent: `PDF file is too large for text extraction: ${fileSizeInMB.toFixed(2)}MB exceeds the ${
|
|
60187
|
-
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).`,
|
|
60188
60531
|
error: `PDF exceeds extraction size limit: ${filePath} (${fileSizeInMB.toFixed(2)}MB)`,
|
|
60189
|
-
errorType: "file_too_large" /* FILE_TOO_LARGE
|
|
60532
|
+
errorType: "file_too_large" /* FILE_TOO_LARGE */,
|
|
60533
|
+
stats
|
|
60534
|
+
};
|
|
60535
|
+
}
|
|
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
|
|
60190
60543
|
};
|
|
60191
60544
|
}
|
|
60192
|
-
if (
|
|
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") {
|
|
60193
60575
|
return {
|
|
60194
60576
|
llmContent: "File size exceeds the 10MB limit.",
|
|
60195
60577
|
returnDisplay: "File size exceeds the 10MB limit.",
|
|
@@ -60246,11 +60628,17 @@ async function processSingleFileContent(filePath, config, optionsOrOffset, legac
|
|
|
60246
60628
|
const { content, _meta } = await config.getFileSystemService().readTextFile({
|
|
60247
60629
|
path: filePath,
|
|
60248
60630
|
limit: limit ?? config.getTruncateToolOutputLines(),
|
|
60249
|
-
line: offset
|
|
60631
|
+
line: offset,
|
|
60632
|
+
maxOutputBytes: getRangeReadByteLimit(config),
|
|
60633
|
+
stats,
|
|
60634
|
+
...signal !== void 0 ? { signal } : {}
|
|
60250
60635
|
});
|
|
60251
|
-
const originalLineCount = _meta?.originalLineCount ?? await countFileLines(filePath);
|
|
60252
60636
|
const selectedLines = content.split("\n").map((line) => line.trimEnd());
|
|
60253
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;
|
|
60254
60642
|
const configCharLimit = config.getTruncateToolOutputThreshold();
|
|
60255
60643
|
let llmContent = "";
|
|
60256
60644
|
let contentLengthTruncated = false;
|
|
@@ -60282,12 +60670,25 @@ async function processSingleFileContent(filePath, config, optionsOrOffset, legac
|
|
|
60282
60670
|
llmContent = selectedLines.join("\n");
|
|
60283
60671
|
linesIncluded = selectedLines.length;
|
|
60284
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
|
+
}
|
|
60285
60685
|
const actualEndLine = startLine + linesIncluded;
|
|
60286
|
-
const contentRangeTruncated = startLine > 0 || actualEndLine < originalLineCount;
|
|
60686
|
+
const contentRangeTruncated = startLine > 0 || !originalLineCountExact || actualEndLine < originalLineCount;
|
|
60287
60687
|
const isTruncated = contentRangeTruncated || contentLengthTruncated;
|
|
60688
|
+
const lineCountLabel = originalLineCountExact ? `${originalLineCount}` : `at least ${originalLineCount}`;
|
|
60288
60689
|
let returnDisplay = "";
|
|
60289
60690
|
if (isTruncated) {
|
|
60290
|
-
returnDisplay = `Read lines ${startLine + 1}-${actualEndLine} of ${
|
|
60691
|
+
returnDisplay = `Read lines ${startLine + 1}-${actualEndLine} of ${lineCountLabel} from ${relativePathForDisplay}`;
|
|
60291
60692
|
if (contentLengthTruncated) {
|
|
60292
60693
|
returnDisplay += " (truncated)";
|
|
60293
60694
|
}
|
|
@@ -60297,6 +60698,7 @@ async function processSingleFileContent(filePath, config, optionsOrOffset, legac
|
|
|
60297
60698
|
returnDisplay,
|
|
60298
60699
|
isTruncated,
|
|
60299
60700
|
originalLineCount,
|
|
60701
|
+
originalLineCountExact,
|
|
60300
60702
|
linesShown: [startLine + 1, actualEndLine],
|
|
60301
60703
|
stats
|
|
60302
60704
|
};
|
|
@@ -60327,7 +60729,7 @@ async function processSingleFileContent(filePath, config, optionsOrOffset, legac
|
|
|
60327
60729
|
};
|
|
60328
60730
|
}
|
|
60329
60731
|
case "pdf": {
|
|
60330
|
-
if (!
|
|
60732
|
+
if (!pageRange && modalities.pdf) {
|
|
60331
60733
|
const contentBuffer = await fs2.promises.readFile(filePath);
|
|
60332
60734
|
const base64Data = contentBuffer.toString("base64");
|
|
60333
60735
|
const base64SizeInMB = base64Data.length / (1024 * 1024);
|
|
@@ -60350,16 +60752,38 @@ async function processSingleFileContent(filePath, config, optionsOrOffset, legac
|
|
|
60350
60752
|
returnDisplay: `Read pdf file: ${relativePathForDisplay}`
|
|
60351
60753
|
};
|
|
60352
60754
|
}
|
|
60353
|
-
const
|
|
60354
|
-
const pdfResult = await extractPDFText(
|
|
60355
|
-
filePath,
|
|
60356
|
-
pageRange ?? void 0
|
|
60357
|
-
);
|
|
60755
|
+
const pdfResult = await extractPDFText(filePath, pageRange);
|
|
60358
60756
|
if (pdfResult.success) {
|
|
60359
|
-
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})` : "";
|
|
60360
60783
|
return {
|
|
60361
60784
|
llmContent: pdfResult.text,
|
|
60362
|
-
returnDisplay: `Read pdf as text${pagesLabel}: ${relativePathForDisplay}
|
|
60785
|
+
returnDisplay: `Read pdf as text${pagesLabel}: ${relativePathForDisplay}`,
|
|
60786
|
+
stats
|
|
60363
60787
|
};
|
|
60364
60788
|
}
|
|
60365
60789
|
return {
|
|
@@ -60398,6 +60822,9 @@ async function processSingleFileContent(filePath, config, optionsOrOffset, legac
|
|
|
60398
60822
|
}
|
|
60399
60823
|
}
|
|
60400
60824
|
} catch (error) {
|
|
60825
|
+
if (signal?.aborted || isAbortError(error)) {
|
|
60826
|
+
throw error;
|
|
60827
|
+
}
|
|
60401
60828
|
const errorMessage2 = getErrorMessage(error);
|
|
60402
60829
|
const displayPath = path2.relative(rootDirectory, filePath).replace(/\\/g, "/");
|
|
60403
60830
|
return {
|
|
@@ -60409,6 +60836,24 @@ async function processSingleFileContent(filePath, config, optionsOrOffset, legac
|
|
|
60409
60836
|
}
|
|
60410
60837
|
}
|
|
60411
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");
|
|
60412
60857
|
async function fileExists(filePath) {
|
|
60413
60858
|
try {
|
|
60414
60859
|
await fsPromises.access(filePath, fs2.constants.F_OK);
|
|
@@ -63395,6 +63840,66 @@ var subagentNameContext = new AsyncLocalStorage();
|
|
|
63395
63840
|
// packages/core/src/core/openaiContentGenerator/converter.ts
|
|
63396
63841
|
init_esbuild_shims();
|
|
63397
63842
|
|
|
63843
|
+
// packages/core/src/utils/thoughtUtils.ts
|
|
63844
|
+
init_esbuild_shims();
|
|
63845
|
+
var START_DELIMITER = "**";
|
|
63846
|
+
var END_DELIMITER = "**";
|
|
63847
|
+
var OPENAI_REASONING_THOUGHT_MARKER = Symbol("openaiReasoningThought");
|
|
63848
|
+
function createOpenAIReasoningThoughtPart(text) {
|
|
63849
|
+
const part = { text, thought: true };
|
|
63850
|
+
Object.defineProperty(part, OPENAI_REASONING_THOUGHT_MARKER, {
|
|
63851
|
+
value: true
|
|
63852
|
+
});
|
|
63853
|
+
return part;
|
|
63854
|
+
}
|
|
63855
|
+
__name(createOpenAIReasoningThoughtPart, "createOpenAIReasoningThoughtPart");
|
|
63856
|
+
function isOpenAIReasoningThoughtPart(part) {
|
|
63857
|
+
return Boolean(
|
|
63858
|
+
part[OPENAI_REASONING_THOUGHT_MARKER]
|
|
63859
|
+
);
|
|
63860
|
+
}
|
|
63861
|
+
__name(isOpenAIReasoningThoughtPart, "isOpenAIReasoningThoughtPart");
|
|
63862
|
+
function parseThought(rawText) {
|
|
63863
|
+
const startIndex = rawText.indexOf(START_DELIMITER);
|
|
63864
|
+
if (startIndex === -1) {
|
|
63865
|
+
return { subject: "", description: rawText };
|
|
63866
|
+
}
|
|
63867
|
+
const endIndex = rawText.indexOf(
|
|
63868
|
+
END_DELIMITER,
|
|
63869
|
+
startIndex + START_DELIMITER.length
|
|
63870
|
+
);
|
|
63871
|
+
if (endIndex === -1) {
|
|
63872
|
+
return { subject: "", description: rawText };
|
|
63873
|
+
}
|
|
63874
|
+
const subject = rawText.substring(startIndex + START_DELIMITER.length, endIndex).trim();
|
|
63875
|
+
const description = (rawText.substring(0, startIndex) + rawText.substring(endIndex + END_DELIMITER.length)).trim();
|
|
63876
|
+
return { subject, description };
|
|
63877
|
+
}
|
|
63878
|
+
__name(parseThought, "parseThought");
|
|
63879
|
+
function getThoughtSummary(response) {
|
|
63880
|
+
if (response.candidates && response.candidates.length > 0) {
|
|
63881
|
+
const candidate = response.candidates[0];
|
|
63882
|
+
if (candidate.content && candidate.content.parts && candidate.content.parts.length > 0) {
|
|
63883
|
+
const thoughtParts = candidate.content.parts.filter(
|
|
63884
|
+
(part) => part.thought
|
|
63885
|
+
);
|
|
63886
|
+
if (thoughtParts.length === 0) {
|
|
63887
|
+
return null;
|
|
63888
|
+
}
|
|
63889
|
+
const thoughtText = thoughtParts.map((part) => part.text ?? "").join("");
|
|
63890
|
+
if (!thoughtText) {
|
|
63891
|
+
return null;
|
|
63892
|
+
}
|
|
63893
|
+
if (thoughtParts.some(isOpenAIReasoningThoughtPart)) {
|
|
63894
|
+
return { subject: "", description: thoughtText };
|
|
63895
|
+
}
|
|
63896
|
+
return parseThought(thoughtText);
|
|
63897
|
+
}
|
|
63898
|
+
}
|
|
63899
|
+
return null;
|
|
63900
|
+
}
|
|
63901
|
+
__name(getThoughtSummary, "getThoughtSummary");
|
|
63902
|
+
|
|
63398
63903
|
// packages/core/src/core/openaiContentGenerator/taggedThinkingParser.ts
|
|
63399
63904
|
init_esbuild_shims();
|
|
63400
63905
|
var debugLogger5 = createDebugLogger("TAGGED_THINKING_PARSER");
|
|
@@ -63605,7 +64110,7 @@ async function convertGeminiToolsToOpenAI(geminiTools, schemaCompliance = "auto"
|
|
|
63605
64110
|
}
|
|
63606
64111
|
if (actualTool.functionDeclarations) {
|
|
63607
64112
|
for (const func of actualTool.functionDeclarations) {
|
|
63608
|
-
if (func.name
|
|
64113
|
+
if (func.name) {
|
|
63609
64114
|
let parameters;
|
|
63610
64115
|
if (func.parametersJsonSchema) {
|
|
63611
64116
|
const paramsCopy = {
|
|
@@ -63624,7 +64129,7 @@ async function convertGeminiToolsToOpenAI(geminiTools, schemaCompliance = "auto"
|
|
|
63624
64129
|
type: "function",
|
|
63625
64130
|
function: {
|
|
63626
64131
|
name: func.name,
|
|
63627
|
-
description: func.description,
|
|
64132
|
+
description: func.description ?? "",
|
|
63628
64133
|
parameters
|
|
63629
64134
|
}
|
|
63630
64135
|
});
|
|
@@ -64131,22 +64636,21 @@ function convertOpenAITextToParts(text, requestContext, final = true) {
|
|
|
64131
64636
|
return parseTaggedThinkingText(text);
|
|
64132
64637
|
}
|
|
64133
64638
|
__name(convertOpenAITextToParts, "convertOpenAITextToParts");
|
|
64639
|
+
function hasThoughtPart(parts) {
|
|
64640
|
+
return parts.some((part) => part.thought === true);
|
|
64641
|
+
}
|
|
64642
|
+
__name(hasThoughtPart, "hasThoughtPart");
|
|
64134
64643
|
function convertOpenAIResponseToGemini(openaiResponse, requestContext) {
|
|
64135
64644
|
const choice = openaiResponse.choices?.[0];
|
|
64136
64645
|
const response = new GenerateContentResponse();
|
|
64137
64646
|
if (choice) {
|
|
64138
64647
|
const parts = [];
|
|
64139
|
-
|
|
64140
|
-
|
|
64141
|
-
|
|
64142
|
-
|
|
64143
|
-
}
|
|
64144
|
-
}
|
|
64145
|
-
if (choice.message.content) {
|
|
64146
|
-
parts.push(
|
|
64147
|
-
...convertOpenAITextToParts(choice.message.content, requestContext)
|
|
64148
|
-
);
|
|
64648
|
+
const textParts = choice.message.content ? convertOpenAITextToParts(choice.message.content, requestContext) : [];
|
|
64649
|
+
const reasoningText = choice.message.reasoning_content ?? choice.message.reasoning;
|
|
64650
|
+
if (reasoningText && !hasThoughtPart(textParts)) {
|
|
64651
|
+
parts.push(createOpenAIReasoningThoughtPart(reasoningText));
|
|
64149
64652
|
}
|
|
64653
|
+
parts.push(...textParts);
|
|
64150
64654
|
if (choice.message.tool_calls) {
|
|
64151
64655
|
for (const toolCall of choice.message.tool_calls) {
|
|
64152
64656
|
if (toolCall.function) {
|
|
@@ -64220,22 +64724,8 @@ function convertOpenAIChunkToGemini(chunk, requestContext) {
|
|
|
64220
64724
|
}
|
|
64221
64725
|
if (choice) {
|
|
64222
64726
|
const parts = [];
|
|
64223
|
-
|
|
64224
|
-
|
|
64225
|
-
if (reasoningText) {
|
|
64226
|
-
const normalizedReasoningText = normalizeStreamingTextDelta(
|
|
64227
|
-
reasoningText,
|
|
64228
|
-
requestContext.reasoningDeltaState ??= {
|
|
64229
|
-
emittedText: "",
|
|
64230
|
-
emittedLength: 0,
|
|
64231
|
-
cumulativeMode: false
|
|
64232
|
-
}
|
|
64233
|
-
);
|
|
64234
|
-
if (normalizedReasoningText) {
|
|
64235
|
-
parts.push({ text: normalizedReasoningText, thought: true });
|
|
64236
|
-
}
|
|
64237
|
-
}
|
|
64238
|
-
}
|
|
64727
|
+
let contentParts = [];
|
|
64728
|
+
const reasoningText = choice.delta?.reasoning_content ?? choice.delta?.reasoning;
|
|
64239
64729
|
if (typeof choice.delta?.content === "string") {
|
|
64240
64730
|
const normalizedContent = normalizeStreamingTextDelta(
|
|
64241
64731
|
choice.delta.content,
|
|
@@ -64246,17 +64736,74 @@ function convertOpenAIChunkToGemini(chunk, requestContext) {
|
|
|
64246
64736
|
}
|
|
64247
64737
|
);
|
|
64248
64738
|
if (normalizedContent || choice.finish_reason) {
|
|
64249
|
-
|
|
64250
|
-
|
|
64251
|
-
|
|
64252
|
-
|
|
64253
|
-
Boolean(choice.finish_reason)
|
|
64254
|
-
)
|
|
64739
|
+
contentParts = convertOpenAITextToParts(
|
|
64740
|
+
normalizedContent,
|
|
64741
|
+
requestContext,
|
|
64742
|
+
Boolean(choice.finish_reason)
|
|
64255
64743
|
);
|
|
64256
64744
|
}
|
|
64257
64745
|
} else if (choice.finish_reason) {
|
|
64258
|
-
|
|
64746
|
+
contentParts = convertOpenAITextToParts("", requestContext, true);
|
|
64747
|
+
}
|
|
64748
|
+
if (hasThoughtPart(contentParts)) {
|
|
64749
|
+
requestContext.hasTaggedThinkingThought = true;
|
|
64750
|
+
requestContext.pendingReasoningText = void 0;
|
|
64751
|
+
debugLogger6.debug(
|
|
64752
|
+
"convertOpenAIChunkToGemini: tagged thinking content emitted a thought; dropping buffered reasoning"
|
|
64753
|
+
);
|
|
64754
|
+
if (requestContext.pendingContentParts?.length) {
|
|
64755
|
+
debugLogger6.debug(
|
|
64756
|
+
`convertOpenAIChunkToGemini: flushing ${requestContext.pendingContentParts.length} buffered content part(s) before tagged content`
|
|
64757
|
+
);
|
|
64758
|
+
parts.push(...requestContext.pendingContentParts);
|
|
64759
|
+
requestContext.pendingContentParts = void 0;
|
|
64760
|
+
}
|
|
64259
64761
|
}
|
|
64762
|
+
if (reasoningText && (!requestContext.responseParsingOptions?.taggedThinkingTags || !requestContext.hasTaggedThinkingThought)) {
|
|
64763
|
+
const normalizedReasoningText = normalizeStreamingTextDelta(
|
|
64764
|
+
reasoningText,
|
|
64765
|
+
requestContext.reasoningDeltaState ??= {
|
|
64766
|
+
emittedText: "",
|
|
64767
|
+
emittedLength: 0,
|
|
64768
|
+
cumulativeMode: false
|
|
64769
|
+
}
|
|
64770
|
+
);
|
|
64771
|
+
if (normalizedReasoningText && !requestContext.responseParsingOptions?.taggedThinkingTags) {
|
|
64772
|
+
parts.push(createOpenAIReasoningThoughtPart(normalizedReasoningText));
|
|
64773
|
+
} else if (normalizedReasoningText && !requestContext.hasTaggedThinkingThought) {
|
|
64774
|
+
requestContext.pendingReasoningText = (requestContext.pendingReasoningText ?? "") + normalizedReasoningText;
|
|
64775
|
+
debugLogger6.debug(
|
|
64776
|
+
`convertOpenAIChunkToGemini: buffered reasoning text (${requestContext.pendingReasoningText.length} chars) for tagged stream`
|
|
64777
|
+
);
|
|
64778
|
+
}
|
|
64779
|
+
}
|
|
64780
|
+
if (requestContext.responseParsingOptions?.taggedThinkingTags && !requestContext.hasTaggedThinkingThought && requestContext.pendingReasoningText && contentParts.length) {
|
|
64781
|
+
requestContext.pendingContentParts = [
|
|
64782
|
+
...requestContext.pendingContentParts ?? [],
|
|
64783
|
+
...contentParts
|
|
64784
|
+
];
|
|
64785
|
+
debugLogger6.debug(
|
|
64786
|
+
`convertOpenAIChunkToGemini: buffered ${contentParts.length} content part(s) behind pending reasoning`
|
|
64787
|
+
);
|
|
64788
|
+
contentParts = [];
|
|
64789
|
+
}
|
|
64790
|
+
if (choice.finish_reason && requestContext.responseParsingOptions?.taggedThinkingTags && !requestContext.hasTaggedThinkingThought && requestContext.pendingReasoningText) {
|
|
64791
|
+
debugLogger6.debug(
|
|
64792
|
+
"convertOpenAIChunkToGemini: flushing buffered reasoning for tagged stream with no tagged thought"
|
|
64793
|
+
);
|
|
64794
|
+
parts.push(
|
|
64795
|
+
createOpenAIReasoningThoughtPart(requestContext.pendingReasoningText)
|
|
64796
|
+
);
|
|
64797
|
+
requestContext.pendingReasoningText = void 0;
|
|
64798
|
+
}
|
|
64799
|
+
if (choice.finish_reason && requestContext.pendingContentParts?.length) {
|
|
64800
|
+
debugLogger6.debug(
|
|
64801
|
+
`convertOpenAIChunkToGemini: flushing ${requestContext.pendingContentParts.length} buffered content part(s) on stream finish`
|
|
64802
|
+
);
|
|
64803
|
+
parts.push(...requestContext.pendingContentParts);
|
|
64804
|
+
requestContext.pendingContentParts = void 0;
|
|
64805
|
+
}
|
|
64806
|
+
parts.push(...contentParts);
|
|
64260
64807
|
if (choice.delta?.tool_calls) {
|
|
64261
64808
|
for (const toolCall of choice.delta.tool_calls) {
|
|
64262
64809
|
const index = toolCall.index ?? 0;
|
|
@@ -64632,6 +65179,267 @@ var v4_default = v4;
|
|
|
64632
65179
|
|
|
64633
65180
|
// packages/core/src/utils/openaiLogger.ts
|
|
64634
65181
|
import * as os2 from "os";
|
|
65182
|
+
|
|
65183
|
+
// packages/core/src/utils/rateLimit.ts
|
|
65184
|
+
init_esbuild_shims();
|
|
65185
|
+
|
|
65186
|
+
// packages/core/src/utils/quotaErrorDetection.ts
|
|
65187
|
+
init_esbuild_shims();
|
|
65188
|
+
function isApiError(error) {
|
|
65189
|
+
return typeof error === "object" && error !== null && "error" in error && typeof error.error === "object" && error.error !== null && "message" in error.error;
|
|
65190
|
+
}
|
|
65191
|
+
__name(isApiError, "isApiError");
|
|
65192
|
+
function isStructuredError(error) {
|
|
65193
|
+
return typeof error === "object" && error !== null && "message" in error && typeof error.message === "string";
|
|
65194
|
+
}
|
|
65195
|
+
__name(isStructuredError, "isStructuredError");
|
|
65196
|
+
function isProQuotaExceededError(error) {
|
|
65197
|
+
const checkMessage = /* @__PURE__ */ __name((message) => message.includes("Quota exceeded for quota metric 'Gemini") && message.includes("Pro Requests'"), "checkMessage");
|
|
65198
|
+
if (typeof error === "string") {
|
|
65199
|
+
return checkMessage(error);
|
|
65200
|
+
}
|
|
65201
|
+
if (isStructuredError(error)) {
|
|
65202
|
+
return checkMessage(error.message);
|
|
65203
|
+
}
|
|
65204
|
+
if (isApiError(error)) {
|
|
65205
|
+
return checkMessage(error.error.message);
|
|
65206
|
+
}
|
|
65207
|
+
if (error && typeof error === "object" && "response" in error) {
|
|
65208
|
+
const gaxiosError = error;
|
|
65209
|
+
if (gaxiosError.response && gaxiosError.response.data) {
|
|
65210
|
+
if (typeof gaxiosError.response.data === "string") {
|
|
65211
|
+
return checkMessage(gaxiosError.response.data);
|
|
65212
|
+
}
|
|
65213
|
+
if (typeof gaxiosError.response.data === "object" && gaxiosError.response.data !== null && "error" in gaxiosError.response.data) {
|
|
65214
|
+
const errorData = gaxiosError.response.data;
|
|
65215
|
+
return checkMessage(errorData.error?.message || "");
|
|
65216
|
+
}
|
|
65217
|
+
}
|
|
65218
|
+
}
|
|
65219
|
+
return false;
|
|
65220
|
+
}
|
|
65221
|
+
__name(isProQuotaExceededError, "isProQuotaExceededError");
|
|
65222
|
+
function isGenericQuotaExceededError(error) {
|
|
65223
|
+
if (typeof error === "string") {
|
|
65224
|
+
return error.includes("Quota exceeded for quota metric");
|
|
65225
|
+
}
|
|
65226
|
+
if (isStructuredError(error)) {
|
|
65227
|
+
return error.message.includes("Quota exceeded for quota metric");
|
|
65228
|
+
}
|
|
65229
|
+
if (isApiError(error)) {
|
|
65230
|
+
return error.error.message.includes("Quota exceeded for quota metric");
|
|
65231
|
+
}
|
|
65232
|
+
return false;
|
|
65233
|
+
}
|
|
65234
|
+
__name(isGenericQuotaExceededError, "isGenericQuotaExceededError");
|
|
65235
|
+
function isQwenQuotaExceededError(error) {
|
|
65236
|
+
if (typeof error !== "object" || error === null) {
|
|
65237
|
+
return false;
|
|
65238
|
+
}
|
|
65239
|
+
const { status, code, message } = error;
|
|
65240
|
+
return status === 429 && code === "insufficient_quota" && typeof message === "string" && message.toLowerCase().includes("free allocated quota exceeded");
|
|
65241
|
+
}
|
|
65242
|
+
__name(isQwenQuotaExceededError, "isQwenQuotaExceededError");
|
|
65243
|
+
|
|
65244
|
+
// packages/core/src/utils/retryPolicy.ts
|
|
65245
|
+
init_esbuild_shims();
|
|
65246
|
+
var MAX_TIMEOUT_MS = 2147483647;
|
|
65247
|
+
function getRetryDelayMs(options) {
|
|
65248
|
+
const normalizedAttempt = Math.max(1, options.attempt);
|
|
65249
|
+
const delayCeilingMs = Math.min(options.maxDelayMs, MAX_TIMEOUT_MS);
|
|
65250
|
+
const exponent = Math.min(normalizedAttempt - 1, 31);
|
|
65251
|
+
const cappedExponentialDelayMs = Math.min(
|
|
65252
|
+
options.initialDelayMs * Math.pow(2, exponent),
|
|
65253
|
+
delayCeilingMs
|
|
65254
|
+
);
|
|
65255
|
+
const retryAfterMode = options.retryAfterMode ?? "ignore";
|
|
65256
|
+
const retryAfterMs = retryAfterMode === "ignore" ? null : getRetryAfterDelayMs(options.error);
|
|
65257
|
+
if (retryAfterMs !== null && retryAfterMs > 0) {
|
|
65258
|
+
const retryAfterCapMs = Math.min(
|
|
65259
|
+
options.retryAfterMaxDelayMs ?? options.maxDelayMs,
|
|
65260
|
+
MAX_TIMEOUT_MS
|
|
65261
|
+
);
|
|
65262
|
+
const cappedRetryAfterMs = Math.min(retryAfterMs, retryAfterCapMs);
|
|
65263
|
+
return Math.max(cappedExponentialDelayMs, cappedRetryAfterMs);
|
|
65264
|
+
}
|
|
65265
|
+
const jitterRatio = options.jitterRatio ?? 0;
|
|
65266
|
+
if (jitterRatio <= 0) return cappedExponentialDelayMs;
|
|
65267
|
+
const random = options.random ?? Math.random;
|
|
65268
|
+
const jitter = cappedExponentialDelayMs * jitterRatio * (random() * 2 - 1);
|
|
65269
|
+
return Math.min(
|
|
65270
|
+
Math.max(0, cappedExponentialDelayMs + jitter),
|
|
65271
|
+
delayCeilingMs
|
|
65272
|
+
);
|
|
65273
|
+
}
|
|
65274
|
+
__name(getRetryDelayMs, "getRetryDelayMs");
|
|
65275
|
+
function getRetryAfterDelayMs(error) {
|
|
65276
|
+
const value = getHeaderValue(error, "retry-after") ?? getResponseHeaderValue(error, "retry-after");
|
|
65277
|
+
if (value === null) return null;
|
|
65278
|
+
const trimmed = value.trim();
|
|
65279
|
+
if (/^\d+(\.\d+)?$/.test(trimmed)) {
|
|
65280
|
+
const seconds = Number(trimmed);
|
|
65281
|
+
if (Number.isFinite(seconds) && seconds >= 0) {
|
|
65282
|
+
return Math.min(seconds * 1e3, MAX_TIMEOUT_MS);
|
|
65283
|
+
}
|
|
65284
|
+
}
|
|
65285
|
+
const retryAtMs = Date.parse(trimmed);
|
|
65286
|
+
if (!Number.isFinite(retryAtMs)) return null;
|
|
65287
|
+
const delayMs = retryAtMs - Date.now();
|
|
65288
|
+
return delayMs > 0 ? Math.min(delayMs, MAX_TIMEOUT_MS) : 0;
|
|
65289
|
+
}
|
|
65290
|
+
__name(getRetryAfterDelayMs, "getRetryAfterDelayMs");
|
|
65291
|
+
function getHeaderValue(error, headerName) {
|
|
65292
|
+
if (!hasHeaders(error)) return null;
|
|
65293
|
+
const { headers } = error;
|
|
65294
|
+
if (typeof headers.get === "function") {
|
|
65295
|
+
const value = headers.get(headerName);
|
|
65296
|
+
return typeof value === "string" ? value : null;
|
|
65297
|
+
}
|
|
65298
|
+
if (typeof headers !== "object" || headers === null) return null;
|
|
65299
|
+
const lowerHeaderName = headerName.toLowerCase();
|
|
65300
|
+
for (const [key, value] of Object.entries(headers)) {
|
|
65301
|
+
if (key.toLowerCase() !== lowerHeaderName) continue;
|
|
65302
|
+
return typeof value === "string" ? value : null;
|
|
65303
|
+
}
|
|
65304
|
+
return null;
|
|
65305
|
+
}
|
|
65306
|
+
__name(getHeaderValue, "getHeaderValue");
|
|
65307
|
+
function getResponseHeaderValue(error, headerName) {
|
|
65308
|
+
if (!hasResponseHeaders(error)) return null;
|
|
65309
|
+
return getHeaderValue(error.response, headerName);
|
|
65310
|
+
}
|
|
65311
|
+
__name(getResponseHeaderValue, "getResponseHeaderValue");
|
|
65312
|
+
function hasHeaders(error) {
|
|
65313
|
+
return typeof error === "object" && error !== null && "headers" in error && error.headers != null;
|
|
65314
|
+
}
|
|
65315
|
+
__name(hasHeaders, "hasHeaders");
|
|
65316
|
+
function hasResponseHeaders(error) {
|
|
65317
|
+
return typeof error === "object" && error !== null && "response" in error && typeof error.response === "object" && error.response !== null && "headers" in error.response && error.response.headers != null;
|
|
65318
|
+
}
|
|
65319
|
+
__name(hasResponseHeaders, "hasResponseHeaders");
|
|
65320
|
+
|
|
65321
|
+
// packages/core/src/utils/rateLimit.ts
|
|
65322
|
+
var RATE_LIMIT_ERROR_CODES = /* @__PURE__ */ new Set([429, 503, 1302, 1305]);
|
|
65323
|
+
function isRateLimitError(error, extraCodes) {
|
|
65324
|
+
const code = getErrorCode(error);
|
|
65325
|
+
if (code === null) return false;
|
|
65326
|
+
if (RATE_LIMIT_ERROR_CODES.has(code)) return true;
|
|
65327
|
+
if (extraCodes && extraCodes.includes(code)) return true;
|
|
65328
|
+
return false;
|
|
65329
|
+
}
|
|
65330
|
+
__name(isRateLimitError, "isRateLimitError");
|
|
65331
|
+
function getRateLimitErrorDetails(error) {
|
|
65332
|
+
const statusCode = getErrorStatus(error);
|
|
65333
|
+
const payload = getProviderErrorPayload(error);
|
|
65334
|
+
const message = getRawErrorMessage(error);
|
|
65335
|
+
const transport = message?.includes("event:error") || message?.includes("HTTP_STATUS/") ? "sse" : statusCode !== void 0 ? "http" : "unknown";
|
|
65336
|
+
return {
|
|
65337
|
+
...statusCode !== void 0 ? { statusCode } : {},
|
|
65338
|
+
...payload?.code !== void 0 ? { providerCode: String(payload.code) } : {},
|
|
65339
|
+
...payload?.message !== void 0 ? { providerMessage: payload.message } : {},
|
|
65340
|
+
...payload?.requestId !== void 0 ? { requestId: payload.requestId } : {},
|
|
65341
|
+
transport
|
|
65342
|
+
};
|
|
65343
|
+
}
|
|
65344
|
+
__name(getRateLimitErrorDetails, "getRateLimitErrorDetails");
|
|
65345
|
+
function getRateLimitRetryDelayMs(attempt, options) {
|
|
65346
|
+
return getRetryDelayMs({
|
|
65347
|
+
attempt,
|
|
65348
|
+
initialDelayMs: options.initialDelayMs,
|
|
65349
|
+
maxDelayMs: options.maxDelayMs,
|
|
65350
|
+
retryAfterMode: "minimum",
|
|
65351
|
+
retryAfterMaxDelayMs: options.maxDelayMs,
|
|
65352
|
+
error: options.error
|
|
65353
|
+
});
|
|
65354
|
+
}
|
|
65355
|
+
__name(getRateLimitRetryDelayMs, "getRateLimitRetryDelayMs");
|
|
65356
|
+
function getErrorCode(error) {
|
|
65357
|
+
if (isApiError(error)) {
|
|
65358
|
+
const n = Number(error.error.code);
|
|
65359
|
+
if (Number.isFinite(n) && n > 0) return n;
|
|
65360
|
+
}
|
|
65361
|
+
const msg = error instanceof Error ? error.message : typeof error === "string" ? error : null;
|
|
65362
|
+
if (msg) {
|
|
65363
|
+
const i = msg.indexOf("{");
|
|
65364
|
+
if (i !== -1) {
|
|
65365
|
+
try {
|
|
65366
|
+
const p = JSON.parse(msg.substring(i));
|
|
65367
|
+
if (isApiError(p)) {
|
|
65368
|
+
const n = Number(p.error.code);
|
|
65369
|
+
if (Number.isFinite(n) && n > 0) return n;
|
|
65370
|
+
}
|
|
65371
|
+
} catch {
|
|
65372
|
+
}
|
|
65373
|
+
}
|
|
65374
|
+
}
|
|
65375
|
+
if (isStructuredError(error) && typeof error.status === "number") {
|
|
65376
|
+
return error.status;
|
|
65377
|
+
}
|
|
65378
|
+
if (error instanceof Error && "status" in error) {
|
|
65379
|
+
const s = error.status;
|
|
65380
|
+
if (typeof s === "number") return s;
|
|
65381
|
+
}
|
|
65382
|
+
return getErrorStatus(error) ?? null;
|
|
65383
|
+
}
|
|
65384
|
+
__name(getErrorCode, "getErrorCode");
|
|
65385
|
+
function getProviderErrorPayload(error) {
|
|
65386
|
+
for (const payload of getJsonPayloads(error)) {
|
|
65387
|
+
if (typeof payload !== "object" || payload === null) continue;
|
|
65388
|
+
const direct = payload;
|
|
65389
|
+
const nestedError = payload.error;
|
|
65390
|
+
const nested = typeof nestedError === "object" && nestedError !== null ? nestedError : void 0;
|
|
65391
|
+
const source = nested ?? direct;
|
|
65392
|
+
const code = typeof source.code === "string" || typeof source.code === "number" ? source.code : void 0;
|
|
65393
|
+
const message = typeof source.message === "string" ? source.message : void 0;
|
|
65394
|
+
const requestId = typeof source.request_id === "string" ? source.request_id : typeof source.requestId === "string" ? source.requestId : typeof direct.request_id === "string" ? direct.request_id : typeof direct.requestId === "string" ? direct.requestId : void 0;
|
|
65395
|
+
if (code !== void 0 || message !== void 0 || requestId !== void 0) {
|
|
65396
|
+
return { code, message, requestId };
|
|
65397
|
+
}
|
|
65398
|
+
}
|
|
65399
|
+
if (isApiError(error)) {
|
|
65400
|
+
return {
|
|
65401
|
+
code: error.error.code,
|
|
65402
|
+
message: error.error.message
|
|
65403
|
+
};
|
|
65404
|
+
}
|
|
65405
|
+
return null;
|
|
65406
|
+
}
|
|
65407
|
+
__name(getProviderErrorPayload, "getProviderErrorPayload");
|
|
65408
|
+
function getJsonPayloads(error) {
|
|
65409
|
+
const message = getRawErrorMessage(error);
|
|
65410
|
+
if (!message) return [];
|
|
65411
|
+
const payloads = [];
|
|
65412
|
+
for (const line of message.split(/\r?\n/)) {
|
|
65413
|
+
if (!line.startsWith("data:")) continue;
|
|
65414
|
+
const data = line.slice("data:".length).trim();
|
|
65415
|
+
if (!data || data === "[DONE]") continue;
|
|
65416
|
+
try {
|
|
65417
|
+
payloads.push(JSON.parse(data));
|
|
65418
|
+
} catch {
|
|
65419
|
+
}
|
|
65420
|
+
}
|
|
65421
|
+
if (payloads.length > 0) return payloads;
|
|
65422
|
+
const jsonStart = message.indexOf("{");
|
|
65423
|
+
const jsonEnd = message.lastIndexOf("}");
|
|
65424
|
+
if (jsonStart !== -1 && jsonEnd > jsonStart) {
|
|
65425
|
+
try {
|
|
65426
|
+
payloads.push(
|
|
65427
|
+
JSON.parse(message.slice(jsonStart, jsonEnd + 1))
|
|
65428
|
+
);
|
|
65429
|
+
} catch {
|
|
65430
|
+
}
|
|
65431
|
+
}
|
|
65432
|
+
return payloads;
|
|
65433
|
+
}
|
|
65434
|
+
__name(getJsonPayloads, "getJsonPayloads");
|
|
65435
|
+
function getRawErrorMessage(error) {
|
|
65436
|
+
if (error instanceof Error) return error.message;
|
|
65437
|
+
if (typeof error === "string") return error;
|
|
65438
|
+
return null;
|
|
65439
|
+
}
|
|
65440
|
+
__name(getRawErrorMessage, "getRawErrorMessage");
|
|
65441
|
+
|
|
65442
|
+
// packages/core/src/utils/openaiLogger.ts
|
|
64635
65443
|
var debugLogger7 = createDebugLogger("OPENAI_LOGGER");
|
|
64636
65444
|
var MAIN_SESSION_PROMPT_ID_DELIMITER = "########";
|
|
64637
65445
|
var UUID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
|
|
@@ -64703,6 +65511,24 @@ function contextForPromptId(promptId) {
|
|
|
64703
65511
|
};
|
|
64704
65512
|
}
|
|
64705
65513
|
__name(contextForPromptId, "contextForPromptId");
|
|
65514
|
+
function getString(value) {
|
|
65515
|
+
return typeof value === "string" && value ? value : void 0;
|
|
65516
|
+
}
|
|
65517
|
+
__name(getString, "getString");
|
|
65518
|
+
function getErrorRequestId(error) {
|
|
65519
|
+
const source = error;
|
|
65520
|
+
return getString(source.requestID) ?? getString(source.request_id) ?? getString(source.requestId) ?? getString(source.response_id) ?? getRateLimitErrorDetails(error).requestId;
|
|
65521
|
+
}
|
|
65522
|
+
__name(getErrorRequestId, "getErrorRequestId");
|
|
65523
|
+
function serializeError(error) {
|
|
65524
|
+
const requestId = getErrorRequestId(error);
|
|
65525
|
+
return {
|
|
65526
|
+
message: error.message,
|
|
65527
|
+
stack: error.stack,
|
|
65528
|
+
...requestId ? { requestId } : {}
|
|
65529
|
+
};
|
|
65530
|
+
}
|
|
65531
|
+
__name(serializeError, "serializeError");
|
|
64706
65532
|
var OpenAILogger = class {
|
|
64707
65533
|
static {
|
|
64708
65534
|
__name(this, "OpenAILogger");
|
|
@@ -64754,10 +65580,7 @@ var OpenAILogger = class {
|
|
|
64754
65580
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
64755
65581
|
request: request4,
|
|
64756
65582
|
response: response || null,
|
|
64757
|
-
error: error ?
|
|
64758
|
-
message: error.message,
|
|
64759
|
-
stack: error.stack
|
|
64760
|
-
} : null,
|
|
65583
|
+
error: error ? serializeError(error) : null,
|
|
64761
65584
|
context: contextForPromptId(promptId),
|
|
64762
65585
|
system: {
|
|
64763
65586
|
hostname: os2.hostname(),
|
|
@@ -69047,11 +69870,11 @@ async function createContentGenerator(generatorConfig, config, isInitialAuth) {
|
|
|
69047
69870
|
let baseGenerator;
|
|
69048
69871
|
try {
|
|
69049
69872
|
if (authType === "openai" /* USE_OPENAI */) {
|
|
69050
|
-
const { createOpenAIContentGenerator } = await import("./openaiContentGenerator-
|
|
69873
|
+
const { createOpenAIContentGenerator } = await import("./openaiContentGenerator-5LJ5A7YY.js");
|
|
69051
69874
|
baseGenerator = createOpenAIContentGenerator(generatorConfig, config);
|
|
69052
69875
|
} else if (authType === "qwen-oauth" /* QWEN_OAUTH */) {
|
|
69053
|
-
const { getQwenOAuthClient: getQwenOauthClient } = await import("./qwenOAuth2-
|
|
69054
|
-
const { QwenContentGenerator } = await import("./qwenContentGenerator-
|
|
69876
|
+
const { getQwenOAuthClient: getQwenOauthClient } = await import("./qwenOAuth2-ZV7YLMND.js");
|
|
69877
|
+
const { QwenContentGenerator } = await import("./qwenContentGenerator-E2JSB4FJ.js");
|
|
69055
69878
|
try {
|
|
69056
69879
|
const qwenClient = await getQwenOauthClient(
|
|
69057
69880
|
config,
|
|
@@ -69069,10 +69892,10 @@ async function createContentGenerator(generatorConfig, config, isInitialAuth) {
|
|
|
69069
69892
|
throw new Error(error instanceof Error ? error.message : String(error));
|
|
69070
69893
|
}
|
|
69071
69894
|
} else if (authType === "anthropic" /* USE_ANTHROPIC */) {
|
|
69072
|
-
const { createAnthropicContentGenerator } = await import("./anthropicContentGenerator-
|
|
69895
|
+
const { createAnthropicContentGenerator } = await import("./anthropicContentGenerator-AKYPSZIV.js");
|
|
69073
69896
|
baseGenerator = createAnthropicContentGenerator(generatorConfig, config);
|
|
69074
69897
|
} else if (authType === "gemini" /* USE_GEMINI */ || authType === "vertex-ai" /* USE_VERTEX_AI */) {
|
|
69075
|
-
const { createGeminiContentGenerator } = await import("./geminiContentGenerator-
|
|
69898
|
+
const { createGeminiContentGenerator } = await import("./geminiContentGenerator-WCH4GWD3.js");
|
|
69076
69899
|
baseGenerator = createGeminiContentGenerator(generatorConfig, config);
|
|
69077
69900
|
} else {
|
|
69078
69901
|
throw new Error(
|
|
@@ -71614,7 +72437,7 @@ var ReadFileToolInvocation = class extends BaseToolInvocation {
|
|
|
71614
72437
|
}
|
|
71615
72438
|
return "ask";
|
|
71616
72439
|
}
|
|
71617
|
-
async execute() {
|
|
72440
|
+
async execute(signal) {
|
|
71618
72441
|
const absPath = path10.resolve(this.params.file_path);
|
|
71619
72442
|
const projectRoot = this.config.getTargetDir();
|
|
71620
72443
|
const isAutoMem = isAnyAutoMemPath(absPath, projectRoot);
|
|
@@ -71647,7 +72470,8 @@ var ReadFileToolInvocation = class extends BaseToolInvocation {
|
|
|
71647
72470
|
{
|
|
71648
72471
|
offset: this.params.offset,
|
|
71649
72472
|
limit: this.params.limit,
|
|
71650
|
-
pages: this.params.pages
|
|
72473
|
+
pages: this.params.pages,
|
|
72474
|
+
signal
|
|
71651
72475
|
}
|
|
71652
72476
|
);
|
|
71653
72477
|
if (result.error) {
|
|
@@ -71661,7 +72485,7 @@ var ReadFileToolInvocation = class extends BaseToolInvocation {
|
|
|
71661
72485
|
};
|
|
71662
72486
|
}
|
|
71663
72487
|
if (cacheEnabled && (result.stats ?? stats)) {
|
|
71664
|
-
const cacheable =
|
|
72488
|
+
const cacheable = isCacheableReadResult(result);
|
|
71665
72489
|
const recordStats = result.stats ?? stats;
|
|
71666
72490
|
cache.recordRead(absPath, recordStats, {
|
|
71667
72491
|
full: isFullRead && !result.isTruncated,
|
|
@@ -71672,7 +72496,8 @@ var ReadFileToolInvocation = class extends BaseToolInvocation {
|
|
|
71672
72496
|
if (result.isTruncated && result.linesShown && result.originalLineCount !== void 0) {
|
|
71673
72497
|
const [start, end] = result.linesShown;
|
|
71674
72498
|
const total = result.originalLineCount;
|
|
71675
|
-
|
|
72499
|
+
const totalLabel = result.originalLineCountExact === false ? `at least ${total}` : total;
|
|
72500
|
+
llmContent = `Showing lines ${start}-${end} of ${totalLabel} total lines.
|
|
71676
72501
|
|
|
71677
72502
|
---
|
|
71678
72503
|
|
|
@@ -71749,7 +72574,7 @@ var ReadFileTool = class _ReadFileTool extends BaseDeclarativeTool {
|
|
|
71749
72574
|
super(
|
|
71750
72575
|
_ReadFileTool.Name,
|
|
71751
72576
|
ToolDisplayNames.READ_FILE,
|
|
71752
|
-
`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.`,
|
|
71753
72578
|
"read" /* Read */,
|
|
71754
72579
|
{
|
|
71755
72580
|
properties: {
|
|
@@ -71759,14 +72584,14 @@ var ReadFileTool = class _ReadFileTool extends BaseDeclarativeTool {
|
|
|
71759
72584
|
},
|
|
71760
72585
|
offset: {
|
|
71761
72586
|
description: "Optional: For text files, the 0-based line number to start reading from. Requires 'limit' to be set. Use for paginating through large files.",
|
|
71762
|
-
type: "
|
|
72587
|
+
type: "integer"
|
|
71763
72588
|
},
|
|
71764
72589
|
limit: {
|
|
71765
72590
|
description: "Optional: For text files, maximum number of lines to read. Use with 'offset' to paginate through large files. If omitted, reads the entire file (if feasible, up to a default limit).",
|
|
71766
|
-
type: "
|
|
72591
|
+
type: "integer"
|
|
71767
72592
|
},
|
|
71768
72593
|
pages: {
|
|
71769
|
-
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.`,
|
|
71770
72595
|
type: "string"
|
|
71771
72596
|
}
|
|
71772
72597
|
},
|
|
@@ -71796,11 +72621,11 @@ var ReadFileTool = class _ReadFileTool extends BaseDeclarativeTool {
|
|
|
71796
72621
|
if (!path10.isAbsolute(filePath)) {
|
|
71797
72622
|
return `File path must be absolute, but was relative: ${filePath}. You must provide an absolute path.`;
|
|
71798
72623
|
}
|
|
71799
|
-
if (params.offset !== void 0 && params.offset < 0) {
|
|
71800
|
-
return "Offset must be a non-negative
|
|
72624
|
+
if (params.offset !== void 0 && (!Number.isInteger(params.offset) || params.offset < 0)) {
|
|
72625
|
+
return "Offset must be a non-negative integer";
|
|
71801
72626
|
}
|
|
71802
|
-
if (params.limit !== void 0 && params.limit <= 0) {
|
|
71803
|
-
return "Limit must be a positive
|
|
72627
|
+
if (params.limit !== void 0 && (!Number.isInteger(params.limit) || params.limit <= 0)) {
|
|
72628
|
+
return "Limit must be a positive integer";
|
|
71804
72629
|
}
|
|
71805
72630
|
if (params.pages !== void 0) {
|
|
71806
72631
|
const pages = params.pages.trim();
|
|
@@ -71819,9 +72644,9 @@ var ReadFileTool = class _ReadFileTool extends BaseDeclarativeTool {
|
|
|
71819
72644
|
return `Invalid pages parameter: '${params.pages}'. Use formats like '5' or '1-10'.`;
|
|
71820
72645
|
}
|
|
71821
72646
|
if (parsed.lastPage === Infinity) {
|
|
71822
|
-
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').`;
|
|
71823
72648
|
}
|
|
71824
|
-
const maxPages =
|
|
72649
|
+
const maxPages = PDF_MAX_PAGES_PER_READ;
|
|
71825
72650
|
if (parsed.lastPage - parsed.firstPage + 1 > maxPages) {
|
|
71826
72651
|
return `Pages range exceeds maximum of ${maxPages} pages per request.`;
|
|
71827
72652
|
}
|
|
@@ -71899,6 +72724,7 @@ export {
|
|
|
71899
72724
|
isWithinRoot,
|
|
71900
72725
|
isBinaryFile,
|
|
71901
72726
|
detectFileType,
|
|
72727
|
+
isCacheableReadResult,
|
|
71902
72728
|
processSingleFileContent,
|
|
71903
72729
|
fileExists,
|
|
71904
72730
|
FileOperation,
|
|
@@ -72100,9 +72926,23 @@ export {
|
|
|
72100
72926
|
MemoryExtractEvent,
|
|
72101
72927
|
MemoryDreamEvent,
|
|
72102
72928
|
MemoryRecallEvent,
|
|
72929
|
+
createOpenAIReasoningThoughtPart,
|
|
72930
|
+
isOpenAIReasoningThoughtPart,
|
|
72931
|
+
parseThought,
|
|
72932
|
+
getThoughtSummary,
|
|
72103
72933
|
TaggedThinkingParser,
|
|
72104
72934
|
OpenAIContentConverter,
|
|
72105
72935
|
openaiRequestCaptureContext,
|
|
72936
|
+
isApiError,
|
|
72937
|
+
isStructuredError,
|
|
72938
|
+
isProQuotaExceededError,
|
|
72939
|
+
isGenericQuotaExceededError,
|
|
72940
|
+
isQwenQuotaExceededError,
|
|
72941
|
+
getRetryDelayMs,
|
|
72942
|
+
getRetryAfterDelayMs,
|
|
72943
|
+
isRateLimitError,
|
|
72944
|
+
getRateLimitErrorDetails,
|
|
72945
|
+
getRateLimitRetryDelayMs,
|
|
72106
72946
|
resolveOpenAILogDir,
|
|
72107
72947
|
OpenAILogger,
|
|
72108
72948
|
openaiLogger,
|
|
@@ -72163,6 +73003,11 @@ export {
|
|
|
72163
73003
|
* Copyright 2025 Qwen Team
|
|
72164
73004
|
* SPDX-License-Identifier: Apache-2.0
|
|
72165
73005
|
*/
|
|
73006
|
+
/**
|
|
73007
|
+
* @license
|
|
73008
|
+
* Copyright 2026 Qwen Team
|
|
73009
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
73010
|
+
*/
|
|
72166
73011
|
/**
|
|
72167
73012
|
* @license
|
|
72168
73013
|
* Copyright 2025 Qwen Team
|
|
@@ -72176,12 +73021,12 @@ export {
|
|
|
72176
73021
|
*/
|
|
72177
73022
|
/**
|
|
72178
73023
|
* @license
|
|
72179
|
-
* Copyright
|
|
73024
|
+
* Copyright 2025 Qwen
|
|
72180
73025
|
* SPDX-License-Identifier: Apache-2.0
|
|
72181
73026
|
*/
|
|
72182
73027
|
/**
|
|
72183
73028
|
* @license
|
|
72184
|
-
* Copyright
|
|
73029
|
+
* Copyright 2026 Google LLC
|
|
72185
73030
|
* SPDX-License-Identifier: Apache-2.0
|
|
72186
73031
|
*/
|
|
72187
73032
|
/*! Bundled license information:
|