@qwen-code/qwen-code 0.19.10 → 0.19.11-nightly.20260718.767a32484
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 +11 -0
- package/bundled/qc-helper/docs/configuration/settings.md +15 -14
- package/bundled/qc-helper/docs/features/approval-mode.md +2 -2
- package/bundled/qc-helper/docs/features/channels/dingtalk.md +30 -0
- package/bundled/qc-helper/docs/features/channels/overview.md +66 -17
- package/bundled/qc-helper/docs/features/channels/wecom.md +8 -7
- package/bundled/qc-helper/docs/features/sandbox.md +2 -0
- package/bundled/qc-helper/docs/qwen-serve-deploy-local.md +42 -7
- package/bundled/qc-helper/docs/qwen-serve.md +77 -46
- package/bundled/qc-helper/docs/reference/keyboard-shortcuts.md +1 -1
- package/bundled/review/SKILL.md +163 -403
- package/chunks/{MaxSizedBox-67ODZ4SZ.js → MaxSizedBox-ZFHA4QEQ.js} +30 -30
- package/chunks/{StandaloneSessionPicker-SIPBQT5Z.js → StandaloneSessionPicker-YRWOQVQA.js} +44 -44
- package/chunks/{acpAgent-VPZJXLFX.js → acpAgent-U2P2IESZ.js} +1423 -487
- package/chunks/{agent-Z7NWL6XL.js → agent-GQXX6X5Y.js} +26 -26
- package/chunks/{agent-headless-73HZ6ROQ.js → agent-headless-3572NBCK.js} +26 -26
- package/chunks/{anthropicContentGenerator-56U3YCP2.js → anthropicContentGenerator-Y65DMM64.js} +103 -18
- package/chunks/{artifact-tool-BWZZJ42H.js → artifact-tool-WR7I2XON.js} +2 -2
- package/chunks/{askUserQuestion-WU3S5A5T.js → askUserQuestion-B4FUTPHD.js} +2 -44
- package/chunks/{bridge-XFKW6S7Q.js → bridge-N5RMGD7G.js} +31 -33
- package/chunks/{ca-C2JTT2N5.js → ca-M3GQQ26D.js} +7 -2
- package/chunks/channel-worker-group-HZVJKLGX.js +21 -0
- package/chunks/{channel-worker-manager-5RWKSGEU.js → channel-worker-manager-3WDK4HNS.js} +34 -10
- package/chunks/{channel-worker-supervisor-PCDAZN4D.js → channel-worker-supervisor-U2W6Q5F7.js} +6 -4
- package/chunks/{chunk-YYPXHMWO.js → chunk-2XRGFF5K.js} +6 -6
- package/chunks/{chunk-ZKMGAFYV.js → chunk-2YSZE74N.js} +2 -2
- package/chunks/{chunk-L5U3ELZX.js → chunk-335ECZTA.js} +1 -1
- package/chunks/{chunk-5EBKKSBX.js → chunk-336KPNNV.js} +2 -2
- package/chunks/{chunk-Q5GLXH5Q.js → chunk-3CL5SEDT.js} +6 -6
- package/chunks/{chunk-2FO5GFKZ.js → chunk-3DJY4IFO.js} +1 -1
- package/chunks/{chunk-CJFNEBYB.js → chunk-3NWYQ7FX.js} +2 -2
- package/chunks/{chunk-WIASPMLX.js → chunk-3X2CFOUM.js} +358 -298
- package/chunks/{chunk-K7CRWKOE.js → chunk-3YJZ6WNY.js} +5812 -4520
- package/chunks/{chunk-Y66VOBRP.js → chunk-4CA4WUMS.js} +2 -2
- package/chunks/{chunk-LQIDP6K5.js → chunk-4CHDYDG3.js} +1 -1
- package/chunks/{chunk-TISZXPAX.js → chunk-4HCYNDMG.js} +1 -1
- package/chunks/chunk-4JBTZBCW.js +140 -0
- package/chunks/{chunk-TV6K2FB4.js → chunk-4RPARQ5D.js} +2 -2
- package/chunks/{chunk-RCEEXIOO.js → chunk-4XCVGEEX.js} +3 -3
- package/chunks/{chunk-N6FXRR6P.js → chunk-57RWF6R7.js} +1 -1
- package/chunks/chunk-5O34IMY5.js +59 -0
- package/chunks/{chunk-5LROA5W4.js → chunk-5QRK2VZG.js} +8 -8
- package/chunks/{chunk-7L4XBYVW.js → chunk-632KROVU.js} +10 -3
- package/chunks/{chunk-65N2J6V2.js → chunk-64XGKNSI.js} +3 -3
- package/chunks/{chunk-P6LART6G.js → chunk-66IT3EY2.js} +1059 -129
- package/chunks/{chunk-FXMC7SL2.js → chunk-6ITLKEOZ.js} +3 -3
- package/chunks/{chunk-F7NXQH4Y.js → chunk-6YIRYY3P.js} +1 -1
- package/chunks/{chunk-GGJII3FM.js → chunk-6Z5NRZVU.js} +92 -3
- package/chunks/{chunk-DPFBNG72.js → chunk-AEKYFMYE.js} +1 -1
- package/chunks/{chunk-2UUAIFQO.js → chunk-ANRANWVE.js} +9 -1
- package/chunks/{chunk-SXU3KKNI.js → chunk-ATJ7H5AS.js} +419 -76
- package/chunks/{chunk-6GETGQWP.js → chunk-C5NSOSF4.js} +64 -18
- package/chunks/{chunk-TQBODCFD.js → chunk-CMVFTMRD.js} +251 -3
- package/chunks/{chunk-DK33QJ3V.js → chunk-CZSAIBUB.js} +733 -14
- package/chunks/{chunk-3MX7D6QN.js → chunk-DASWPKXR.js} +32 -4
- package/chunks/{chunk-JSJFKYWT.js → chunk-DPSHAB47.js} +2 -2
- package/chunks/{chunk-7MJAZMXK.js → chunk-ECZFTRTP.js} +29 -78
- package/chunks/{chunk-H3FQOPPS.js → chunk-EKG3BHQY.js} +4 -4
- package/chunks/{chunk-FSA7ERJ2.js → chunk-F2RR4HO2.js} +1 -1
- package/chunks/{chunk-EQY6POVO.js → chunk-F5XYN5VF.js} +2 -2
- package/chunks/chunk-FEOZBUMT.js +77 -0
- package/chunks/{chunk-L62SEJWY.js → chunk-FHUXCRAF.js} +4 -4
- package/chunks/{chunk-OFEVHGVU.js → chunk-FSJGBUQI.js} +818 -31
- package/chunks/{chunk-FBU7WRZI.js → chunk-FUTHTZVV.js} +1 -1
- package/chunks/{chunk-ZRKBI3DP.js → chunk-FZRES4GK.js} +1 -1
- package/chunks/{chunk-OKAIGAYW.js → chunk-G274ETR6.js} +3 -3
- package/chunks/{chunk-6GKMJPOC.js → chunk-GA3WUOO7.js} +5 -5
- package/chunks/{chunk-X362TMXZ.js → chunk-GAQOQMHY.js} +8 -6
- package/chunks/{chunk-WLXYAKV7.js → chunk-GG6RSNWS.js} +9 -4
- package/chunks/{chunk-CEW4HDPK.js → chunk-GUNTLALV.js} +2484 -362
- package/chunks/{chunk-LXLTBIDP.js → chunk-HCCR43AY.js} +1 -1
- package/chunks/{chunk-RDRVMDWV.js → chunk-HIMIG6PI.js} +11 -11
- package/chunks/{chunk-MO7O5722.js → chunk-HQXQCIT2.js} +45 -5
- package/chunks/{chunk-LTNI523B.js → chunk-HT7L5FCZ.js} +28 -5
- package/chunks/{chunk-7NAWTFVY.js → chunk-IENO2YAT.js} +3 -3
- package/chunks/{chunk-3XJFUTNM.js → chunk-IK5TYYVR.js} +59 -12
- package/chunks/{chunk-AAR5SGMD.js → chunk-IVKLDHU6.js} +7 -5
- package/chunks/{chunk-6W6DI34P.js → chunk-IX7O5WI3.js} +180 -8
- package/chunks/{chunk-SPJQO2CE.js → chunk-J2MKYJKZ.js} +2 -2
- package/chunks/{chunk-SPUYQB4T.js → chunk-JBAQ5BYX.js} +1 -1
- package/chunks/{chunk-TYLOFD2U.js → chunk-JCJPZMJV.js} +1 -1
- package/chunks/chunk-JDIUK2Y3.js +226 -0
- package/chunks/{chunk-L37RC7MQ.js → chunk-JUVTV4NF.js} +1 -1
- package/chunks/{chunk-WDWJ4OQJ.js → chunk-K2GBHL73.js} +4 -4
- package/chunks/{chunk-HHEFI4RP.js → chunk-KEVDWH3U.js} +857 -137
- package/chunks/{chunk-YU56QGXX.js → chunk-KTKETHMY.js} +1 -1
- package/chunks/{chunk-WDW64OW3.js → chunk-LGY7PG7Q.js} +5 -5
- package/chunks/{chunk-E67NFMF4.js → chunk-LKR7QQ63.js} +37 -3
- package/chunks/{chunk-4YWLED2A.js → chunk-LSFVUGXT.js} +9 -6
- package/chunks/{chunk-W34A5MJH.js → chunk-LTD3CHGS.js} +1 -1
- package/chunks/chunk-LXXMOYPL.js +22 -0
- package/chunks/{chunk-BBNVFRGD.js → chunk-MI2V6IWU.js} +1 -1
- package/chunks/{chunk-UFOKA4PR.js → chunk-O2K6BLPZ.js} +114 -4
- package/chunks/{chunk-B5I2IIWY.js → chunk-OBYAX5QZ.js} +6 -6
- package/chunks/{chunk-V7EQTZYR.js → chunk-OCQ2QTFJ.js} +203 -47
- package/chunks/{chunk-VBRRNQB7.js → chunk-OPVIKLKK.js} +112 -25
- package/chunks/{chunk-2Z5UX4KI.js → chunk-OSSDHJDU.js} +1 -1
- package/chunks/{chunk-TTUO4DNG.js → chunk-OXOEOOQU.js} +126 -734
- package/chunks/{chunk-4FMG7EDJ.js → chunk-PWYLF7SS.js} +79 -16
- package/chunks/chunk-QFEY6OXH.js +45 -0
- package/chunks/{chunk-YX4LLZ3D.js → chunk-QPRDXJIC.js} +115 -40
- package/chunks/{chunk-7R4DPSRA.js → chunk-R3VWUU2E.js} +1 -1
- package/chunks/{chunk-XLIRF7IK.js → chunk-S4N3G4BB.js} +1 -1
- package/chunks/{chunk-ARKANCNX.js → chunk-SGPFJMRP.js} +1 -1
- package/chunks/{chunk-WTSXKLG5.js → chunk-SUARMD4Q.js} +1 -1
- package/chunks/{chunk-PZL23GTM.js → chunk-T3W4SDRB.js} +2 -0
- package/chunks/chunk-T4TZQJ7W.js +48 -0
- package/chunks/{chunk-K4PZ5F5T.js → chunk-TVYM3Q3J.js} +101 -8
- package/chunks/{chunk-4LD5APFL.js → chunk-TYQMGACW.js} +1 -0
- package/chunks/{chunk-6OATMEYN.js → chunk-U2LNTX56.js} +12 -4
- package/chunks/{chunk-422XAKCK.js → chunk-U2XBPBO3.js} +4 -3
- package/chunks/{chunk-LNUXFLLJ.js → chunk-U4FJ26D2.js} +54 -6
- package/chunks/{chunk-ZQTZXVHP.js → chunk-U6OPT4H2.js} +4 -18
- package/chunks/{chunk-7NFB7LBQ.js → chunk-UE5TZ55T.js} +8 -0
- package/chunks/{chunk-CUUXANEQ.js → chunk-URP6O2PP.js} +6 -1
- package/chunks/{chunk-GDQQRV43.js → chunk-V2FRLYHN.js} +3 -3
- package/chunks/{chunk-WIEO4CWB.js → chunk-VAJS2E2D.js} +1 -1
- package/chunks/{chunk-TXY2C3D2.js → chunk-VNN3JNYT.js} +1 -1
- package/chunks/{chunk-YHN5SUIJ.js → chunk-W7H223ZZ.js} +1 -1
- package/chunks/{chunk-WX6SD4IQ.js → chunk-WEPXQKGP.js} +1 -1
- package/chunks/{chunk-KSO42X3Z.js → chunk-X6YQWCIJ.js} +21 -2
- package/chunks/{chunk-URU5UEK6.js → chunk-XA7OKDWM.js} +135 -68
- package/chunks/{chunk-Q6TUALBE.js → chunk-XAAEDML2.js} +1 -1
- package/chunks/{chunk-KKRTYONM.js → chunk-XSPFQQRE.js} +3 -3
- package/chunks/{chunk-OATTJGPJ.js → chunk-Y72B36CP.js} +7 -7
- package/chunks/{chunk-ZPAHLFZU.js → chunk-Z2LBNX3R.js} +2 -2
- package/chunks/{chunk-XXJKGHZV.js → chunk-ZTSDZQZO.js} +131 -4
- package/chunks/{computer-use-IYTX45WA.js → computer-use-UIFBH25Y.js} +26 -26
- package/chunks/{config-utils-CFT33LTP.js → config-utils-2LHI7JXU.js} +3 -3
- package/chunks/{contextCommand-272V77WU.js → contextCommand-VGZHKEH2.js} +28 -28
- package/chunks/{create-sub-session-WNX2OQVX.js → create-sub-session-DIJOV6HV.js} +2 -2
- package/chunks/{create-sub-session-CBJMQLYP.js → create-sub-session-OFVI4H6I.js} +26 -26
- package/chunks/{cron-create-36TIFKRT.js → cron-create-34GVLSW5.js} +4 -4
- package/chunks/{cron-delete-OQD3WULU.js → cron-delete-NMVKUL45.js} +4 -4
- package/chunks/{cron-list-4533T2FH.js → cron-list-277ZOR7L.js} +4 -4
- package/chunks/{daemon-RNGFPMAB.js → daemon-72MEV3TY.js} +361 -84
- package/chunks/daemon-status-provider-ZJJ6AOG2.js +75 -0
- package/chunks/{de-2VCDRDGU.js → de-56TMDIKS.js} +7 -2
- package/chunks/{dist-3V3ZV6ML.js → dist-4W3UGU2A.js} +1 -1
- package/chunks/{dist-HNN7DR2L.js → dist-G6QCGO2K.js} +58 -30
- package/chunks/{dist-ERCPDVA6.js → dist-ILVRL322.js} +4 -51
- package/chunks/{dist-PHEPJLXD.js → dist-KEZ5JWH4.js} +2 -2
- package/chunks/{dist-JZE7F6YR.js → dist-LQHDHBPP.js} +1 -1
- package/chunks/{dist-MOEC47TR.js → dist-SVHAGOLN.js} +1 -1
- package/chunks/{earlyInputCapture-EN4BRREQ.js → earlyInputCapture-NPF4PVUE.js} +27 -27
- package/chunks/{edit-OMAF2QDR.js → edit-F7CT6NZH.js} +27 -27
- package/chunks/{en-NJCA3TAA.js → en-AXS2N62H.js} +12 -3
- package/chunks/{enter-worktree-BBZX52HG.js → enter-worktree-Z4ET3MZL.js} +26 -26
- package/chunks/{enterPlanMode-5NNFMBUY.js → enterPlanMode-VYR7T5NX.js} +27 -29
- package/chunks/{environment-7TEWMJYN.js → environment-MBTXL57Q.js} +28 -28
- package/chunks/{errors-I4VKVX3F.js → errors-HN36J4FR.js} +28 -28
- package/chunks/{exit-worktree-FUWRJI33.js → exit-worktree-RU7JYFMF.js} +26 -26
- package/chunks/exitPlanMode-LUBAWMZQ.js +390 -0
- package/chunks/{fast-path-ZA57TOH4.js → fast-path-RFT3CDNZ.js} +2 -2
- package/chunks/{fr-5F3E7WKD.js → fr-ZJPE5OVN.js} +7 -2
- package/chunks/{gemini-UOAKVXBG.js → gemini-37NTNKZF.js} +215 -231
- package/chunks/{geminiContentGenerator-G6UCE6MW.js → geminiContentGenerator-76HNOYNQ.js} +5 -5
- package/chunks/{glob-4GJQ2UFF.js → glob-DWD7JCZE.js} +32 -27
- package/chunks/{grep-5QSYXF2E.js → grep-NJRXFV5C.js} +32 -27
- package/chunks/{handleAutoUpdate-ULHNWL6R.js → handleAutoUpdate-7GBDXW6U.js} +30 -30
- package/chunks/{i18n-CYDUTF6F.js → i18n-MYD5VGED.js} +27 -27
- package/chunks/{initializer-NRFKUGIO.js → initializer-4DHPNAZG.js} +32 -32
- package/chunks/{installationInfo-WELKRHHE.js → installationInfo-RWOW6BZO.js} +27 -27
- package/chunks/{ja-66J6B53L.js → ja-57GG4QSL.js} +7 -2
- package/chunks/{keychain-token-storage-AU22CQI6.js → keychain-token-storage-K23CFKGN.js} +2 -2
- package/chunks/{list-JVDXEG2E.js → list-MMCNNHE7.js} +34 -34
- package/chunks/{loadedSettingsAdapter-WAM4VUTG.js → loadedSettingsAdapter-UK4JWPYU.js} +31 -31
- package/chunks/{loop-wakeup-MVUKDVCP.js → loop-wakeup-KCLY4XQM.js} +5 -5
- package/chunks/{ls-RXNIAQDE.js → ls-UNI4LAJ3.js} +4 -4
- package/chunks/{lsp-HB5LM5IL.js → lsp-HPACPJAN.js} +2 -2
- package/chunks/{mcp-YHOZN3ZM.js → mcp-AFCVA4UV.js} +31 -31
- package/chunks/{monitor-R7XZPJHQ.js → monitor-RK637BNO.js} +28 -27
- package/chunks/nonInteractiveCli-OUGWLHNV.js +129 -0
- package/chunks/{notebook-edit-6RNKE2L2.js → notebook-edit-LY2X3CMF.js} +27 -27
- package/chunks/{openaiContentGenerator-XNS5S64I.js → openaiContentGenerator-MDYDW7IA.js} +14 -14
- package/chunks/{pidfile-XE4RRR2P.js → pidfile-2NUYRLKB.js} +27 -27
- package/chunks/processUtils-7QH3VBVN.js +29 -0
- package/chunks/{pt-TFZO5Y6T.js → pt-MCGZ3RZ4.js} +7 -2
- package/chunks/{qwenContentGenerator-APDPJ3VN.js → qwenContentGenerator-3HT4TVDL.js} +28 -28
- package/chunks/{qwenOAuth2-LEYOU7RU.js → qwenOAuth2-3A4TJVZT.js} +5 -5
- package/chunks/{read-file-XSUWXSR7.js → read-file-NE4FREFR.js} +10 -10
- package/chunks/{read-mcp-resource-6LRTZKXI.js → read-mcp-resource-C6NT52T6.js} +2 -2
- package/chunks/{record-artifact-PMDTY4OS.js → record-artifact-ENCU7QCL.js} +2 -2
- package/chunks/{ripGrep-APB3CDMU.js → ripGrep-DBLXWQCJ.js} +26 -26
- package/chunks/{ru-4L4LFHIT.js → ru-GA3NZW5Q.js} +7 -2
- package/chunks/{run-qwen-serve-NWTGPERT.js → run-qwen-serve-3NOCI6IL.js} +63 -39
- package/chunks/{runtime-EIO3NQKR.js → runtime-ZI7DSZSS.js} +35 -35
- package/chunks/{scheduler-JJDZBDRN.js → scheduler-SOVEP5K7.js} +26 -26
- package/chunks/{send-message-SR4WSXP2.js → send-message-5IFPZTPE.js} +3 -3
- package/chunks/{serve-WTIPB3EI.js → serve-DB6OCXIA.js} +31 -31
- package/chunks/{server-NJPHQHLH.js → server-LDY4YVU4.js} +2257 -648
- package/chunks/{session-O4AO7FTS.js → session-D6OG5SKX.js} +99 -72
- package/chunks/{settings-HQNDK7TG.js → settings-L52ZV5LO.js} +30 -30
- package/chunks/{shell-UIXM6PWG.js → shell-IU27OY3Q.js} +28 -26
- package/chunks/{skill-3XMB4ULV.js → skill-BSOJT7LE.js} +12 -12
- package/chunks/{spawnChannel-3R632QRM.js → spawnChannel-HQAM25DD.js} +28 -29
- package/chunks/{src-USZKPUOC.js → src-7ZBIMTJZ.js} +130 -51
- package/chunks/{standalone-update-L5XW3D7K.js → standalone-update-77457VVK.js} +28 -28
- package/chunks/{startInteractiveUI-CPZOL2WB.js → startInteractiveUI-S7WC6EZG.js} +2310 -1835
- package/chunks/{syntheticOutput-YKFNUQZD.js → syntheticOutput-ULOVVLY4.js} +3 -3
- package/chunks/{task-create-NUFOHU53.js → task-create-V2DCDSET.js} +7 -7
- package/chunks/{task-list-Z2IKQY3S.js → task-list-DPL5ZN55.js} +5 -5
- package/chunks/{task-stop-KQFIVQTJ.js → task-stop-CPEQWOT6.js} +2 -2
- package/chunks/{task-update-HKADXSTD.js → task-update-ZR45M5Q7.js} +7 -7
- package/chunks/{team-create-XXPRF3IQ.js → team-create-CO7HSUON.js} +26 -26
- package/chunks/{team-delete-SDNTGZLG.js → team-delete-HIWXCWJU.js} +5 -5
- package/chunks/{team-plan-approval-EOTTKHDW.js → team-plan-approval-QDZF5YZY.js} +26 -26
- package/chunks/{theme-manager-P6UITO2L.js → theme-manager-UTUT3I4P.js} +27 -27
- package/chunks/todoWrite-HK6B3RHJ.js +358 -0
- package/chunks/{tool-search-DDNGK2LR.js → tool-search-2UUORA35.js} +11 -11
- package/chunks/{total-session-admission-PL5N7DNY.js → total-session-admission-NTWG6G3F.js} +32 -34
- package/chunks/{trustedFolders-C5LMF3UR.js → trustedFolders-YF37ZCN5.js} +27 -27
- package/chunks/update-relaunch-QFNHPMZZ.js +87 -0
- package/chunks/{updateCheck-QTVVISH7.js → updateCheck-B6O42VMD.js} +30 -28
- package/chunks/{validateNonInterActiveAuth-RY4RKBQG.js → validateNonInterActiveAuth-SCIWJ4CX.js} +65 -65
- package/chunks/{version-U45RYOSD.js → version-7DA6LAI3.js} +1 -1
- package/chunks/{web-fetch-ZSPR3PRR.js → web-fetch-B62SJXM2.js} +5 -6
- package/chunks/{workflow-TCIAQYOA.js → workflow-Q5WG4THP.js} +27 -27
- package/chunks/{workspace-providers-status-I3G2HYLY.js → workspace-providers-status-WWLAGWQW.js} +34 -34
- package/chunks/{workspace-registration-store-IH5GLZ6Y.js → workspace-registration-store-BVYQVY2H.js} +1 -1
- package/chunks/{workspace-registry-QEKBELIX.js → workspace-registry-OD7ACADD.js} +32 -34
- package/chunks/{workspace-service-ORKHGLP3.js → workspace-service-4LYJWS63.js} +37 -38
- package/chunks/{workspace-skills-status-D7QCNDYY.js → workspace-skills-status-P2AQLZZS.js} +32 -32
- package/chunks/{write-file-JGRQR5VM.js → write-file-TEPGXNM3.js} +60 -27
- package/chunks/{zh-FSAH32JB.js → zh-E34DZ2S3.js} +12 -3
- package/chunks/{zh-TW-D2YIE2LO.js → zh-TW-PEI2ZWUR.js} +12 -3
- package/cli-entry.js +92 -8
- package/cli.js +11 -11
- package/locales/ca.js +12 -2
- package/locales/de.js +12 -2
- package/locales/en.js +20 -5
- package/locales/fr.js +12 -2
- package/locales/ja.js +12 -2
- package/locales/pt.js +12 -2
- package/locales/ru.js +12 -2
- package/locales/zh-TW.js +19 -3
- package/locales/zh.js +19 -3
- package/package.json +3 -3
- package/web-shell/assets/{arc-CUeDlxvE.js → arc-Dh-N5oEG.js} +1 -1
- package/web-shell/assets/{architectureDiagram-3BPJPVTR-PiUszkQA.js → architectureDiagram-3BPJPVTR-DBOQgtfF.js} +1 -1
- package/web-shell/assets/{blockDiagram-GPEHLZMM-s2wYSO7e.js → blockDiagram-GPEHLZMM-Dyxbuyju.js} +1 -1
- package/web-shell/assets/{c4Diagram-AAUBKEIU-DyLxZoz9.js → c4Diagram-AAUBKEIU-DCJR5HPT.js} +1 -1
- package/web-shell/assets/channel-DY0fkcKT.js +1 -0
- package/web-shell/assets/{chunk-2J33WTMH-Dsdai7Tk.js → chunk-2J33WTMH-BkMUcy3O.js} +1 -1
- package/web-shell/assets/{chunk-4BX2VUAB-DEosOjV7.js → chunk-4BX2VUAB-BSm4pLQk.js} +1 -1
- package/web-shell/assets/{chunk-55IACEB6-sNsRLTXf.js → chunk-55IACEB6-CuRr-XgW.js} +1 -1
- package/web-shell/assets/{chunk-727SXJPM-DkRNZzmh.js → chunk-727SXJPM-CLv7-w3t.js} +1 -1
- package/web-shell/assets/{chunk-AQP2D5EJ-BrsRNpzd.js → chunk-AQP2D5EJ-Cz_n3-JW.js} +1 -1
- package/web-shell/assets/{chunk-FMBD7UC4-CI039lpl.js → chunk-FMBD7UC4-CFT_62Hq.js} +1 -1
- package/web-shell/assets/{chunk-ND2GUHAM-M-pkeIfu.js → chunk-ND2GUHAM-DWz6DOZ6.js} +1 -1
- package/web-shell/assets/{chunk-QZHKN3VN-C4ckGNbH.js → chunk-QZHKN3VN-C-mRhUzw.js} +1 -1
- package/web-shell/assets/classDiagram-4FO5ZUOK-DBvJ6PZo.js +1 -0
- package/web-shell/assets/classDiagram-v2-Q7XG4LA2-DBvJ6PZo.js +1 -0
- package/web-shell/assets/{cose-bilkent-S5V4N54A-BciKUAFq.js → cose-bilkent-S5V4N54A-BqCZS3i1.js} +1 -1
- package/web-shell/assets/{dagre-BM42HDAG-C1nTSgU6.js → dagre-BM42HDAG-BGasdP8i.js} +1 -1
- package/web-shell/assets/{diagram-2AECGRRQ-BDPNWr1m.js → diagram-2AECGRRQ-BSyLDkMy.js} +1 -1
- package/web-shell/assets/{diagram-5GNKFQAL-CNFhTszL.js → diagram-5GNKFQAL-CM-ZJxWC.js} +1 -1
- package/web-shell/assets/{diagram-KO2AKTUF-CjPa4p5a.js → diagram-KO2AKTUF-wJdzt_C5.js} +1 -1
- package/web-shell/assets/{diagram-LMA3HP47-ZzPykSyG.js → diagram-LMA3HP47-DiH2fhpL.js} +1 -1
- package/web-shell/assets/{diagram-OG6HWLK6-0UVtZ9A4.js → diagram-OG6HWLK6-BZ9z1ZBl.js} +1 -1
- package/web-shell/assets/{erDiagram-TEJ5UH35-CajDZCat.js → erDiagram-TEJ5UH35-BsyWDziR.js} +1 -1
- package/web-shell/assets/{flowDiagram-I6XJVG4X-BRuFBIvL.js → flowDiagram-I6XJVG4X-CzdkxIrq.js} +1 -1
- package/web-shell/assets/{ganttDiagram-6RSMTGT7-BevGmJqG.js → ganttDiagram-6RSMTGT7-javIv2r2.js} +1 -1
- package/web-shell/assets/{gitGraphDiagram-PVQCEYII-DvPMpBMb.js → gitGraphDiagram-PVQCEYII-CjHstylC.js} +1 -1
- package/web-shell/assets/{index-DzHwQkQq.js → index-BnJGxpah.js} +1 -1
- package/web-shell/assets/index-DhXB9nTa.js +1161 -0
- package/web-shell/assets/index-vYHgZ7bL.css +5 -0
- package/web-shell/assets/{infoDiagram-5YYISTIA-Oixn7tA9.js → infoDiagram-5YYISTIA-yXuQsomo.js} +1 -1
- package/web-shell/assets/{ishikawaDiagram-YF4QCWOH-BgKpeg-j.js → ishikawaDiagram-YF4QCWOH-a85JhE6F.js} +1 -1
- package/web-shell/assets/{journeyDiagram-JHISSGLW-74mwxIaA.js → journeyDiagram-JHISSGLW-Dak_4BVj.js} +1 -1
- package/web-shell/assets/{kanban-definition-UN3LZRKU-D4D6cEqA.js → kanban-definition-UN3LZRKU-COA-LuCV.js} +1 -1
- package/web-shell/assets/{linear-atZRE_L2.js → linear-DNAAAQWq.js} +1 -1
- package/web-shell/assets/{mermaid.core-KKudX-JC.js → mermaid.core-7Ff3aIUD.js} +5 -5
- package/web-shell/assets/{mindmap-definition-RKZ34NQL-CMCej9yG.js → mindmap-definition-RKZ34NQL-_rCOIODU.js} +1 -1
- package/web-shell/assets/{pieDiagram-4H26LBE5-nhx40X7q.js → pieDiagram-4H26LBE5-C9QCQ8EW.js} +1 -1
- package/web-shell/assets/{quadrantDiagram-W4KKPZXB-CUmVcN3M.js → quadrantDiagram-W4KKPZXB-CsaE4FA8.js} +1 -1
- package/web-shell/assets/{requirementDiagram-4Y6WPE33-C_vyEwyy.js → requirementDiagram-4Y6WPE33-tV78naTg.js} +1 -1
- package/web-shell/assets/{sankeyDiagram-5OEKKPKP-DU6G4VWR.js → sankeyDiagram-5OEKKPKP-Dk3Rw7BZ.js} +1 -1
- package/web-shell/assets/{sequenceDiagram-3UESZ5HK-DdeRR_KJ.js → sequenceDiagram-3UESZ5HK-BGsAWcMX.js} +1 -1
- package/web-shell/assets/{stateDiagram-AJRCARHV-C6iCI8ps.js → stateDiagram-AJRCARHV-zSxdtdoB.js} +1 -1
- package/web-shell/assets/stateDiagram-v2-BHNVJYJU-vLEEtDpO.js +1 -0
- package/web-shell/assets/{timeline-definition-PNZ67QCA-B_Ea8Cb7.js → timeline-definition-PNZ67QCA-j0BQh9Go.js} +1 -1
- package/web-shell/assets/{vennDiagram-CIIHVFJN-BPUVZEJA.js → vennDiagram-CIIHVFJN-CRaUFFIu.js} +1 -1
- package/web-shell/assets/{wardley-L42UT6IY-BWEj0lKY.js → wardley-L42UT6IY-D7Py_ofm.js} +1 -1
- package/web-shell/assets/{wardleyDiagram-YWT4CUSO-BvDsdIQw.js → wardleyDiagram-YWT4CUSO-BrDIAZcp.js} +1 -1
- package/web-shell/assets/{xychartDiagram-2RQKCTM6-crz0QhF_.js → xychartDiagram-2RQKCTM6-Cecdw-w2.js} +1 -1
- package/web-shell/index.html +2 -2
- package/chunks/channel-worker-group-K7QKH6IG.js +0 -13
- package/chunks/chunk-2HRYPZT5.js +0 -25
- package/chunks/chunk-B7NUUEXC.js +0 -311
- package/chunks/chunk-CARU2RR2.js +0 -24
- package/chunks/chunk-GYTKQYDB.js +0 -23
- package/chunks/chunk-LQU7EVFA.js +0 -30
- package/chunks/chunk-OCPBI7J5.js +0 -18
- package/chunks/chunk-OJAMDVF5.js +0 -66
- package/chunks/chunk-QAW7PIHT.js +0 -168
- package/chunks/chunk-TEGEBB2I.js +0 -122
- package/chunks/daemon-status-provider-L4STG5VO.js +0 -76
- package/chunks/exitPlanMode-IHCJ5EEI.js +0 -909
- package/chunks/nonInteractiveCli-NSOB6D74.js +0 -129
- package/chunks/todoWrite-YNXB27GB.js +0 -531
- package/web-shell/assets/channel-DkuJJ0qd.js +0 -1
- package/web-shell/assets/classDiagram-4FO5ZUOK-CwqHc0TB.js +0 -1
- package/web-shell/assets/classDiagram-v2-Q7XG4LA2-CwqHc0TB.js +0 -1
- package/web-shell/assets/index-Cnvv4VcI.css +0 -5
- package/web-shell/assets/index-D1Uyklxa.js +0 -1088
- package/web-shell/assets/stateDiagram-v2-BHNVJYJU-C0_6nR6C.js +0 -1
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
// Force strict mode and setup for ESM
|
|
2
2
|
"use strict";
|
|
3
3
|
import {
|
|
4
|
-
classifyApiError
|
|
5
|
-
|
|
6
|
-
} from "./chunk-WIASPMLX.js";
|
|
4
|
+
classifyApiError
|
|
5
|
+
} from "./chunk-3X2CFOUM.js";
|
|
7
6
|
import {
|
|
8
7
|
EXTENSION_CONTEXT_BUDGET,
|
|
9
8
|
buildExtensionMentionContext,
|
|
@@ -12,83 +11,96 @@ import {
|
|
|
12
11
|
matchMcpServerByRef,
|
|
13
12
|
parseExtensionRef,
|
|
14
13
|
parseMcpServerRef
|
|
15
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-GAQOQMHY.js";
|
|
16
15
|
import {
|
|
17
16
|
getAvailableCommands,
|
|
18
17
|
handleSlashCommand,
|
|
19
18
|
insertAfterFunctionResponses,
|
|
20
19
|
isSlashCommand,
|
|
21
20
|
normalizePartList
|
|
22
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-QPRDXJIC.js";
|
|
22
|
+
import {
|
|
23
|
+
collectContextData,
|
|
24
|
+
formatContextUsageText
|
|
25
|
+
} from "./chunk-OBYAX5QZ.js";
|
|
26
|
+
import {
|
|
27
|
+
recomputeMcpGating
|
|
28
|
+
} from "./chunk-4JBTZBCW.js";
|
|
23
29
|
import {
|
|
24
30
|
appEvents,
|
|
25
31
|
buildDisabledSkillNamesProvider,
|
|
26
32
|
loadCliConfig,
|
|
27
33
|
normalizeDisabledToolList
|
|
28
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-GUNTLALV.js";
|
|
29
35
|
import {
|
|
30
36
|
getCommandSubcommandNames
|
|
31
|
-
} from "./chunk-
|
|
32
|
-
import "./chunk-
|
|
37
|
+
} from "./chunk-ZTSDZQZO.js";
|
|
38
|
+
import "./chunk-U2XBPBO3.js";
|
|
33
39
|
import {
|
|
34
40
|
getEffectiveSupportedModes
|
|
35
|
-
} from "./chunk-
|
|
36
|
-
import "./chunk-K4PZ5F5T.js";
|
|
37
|
-
import "./chunk-5DTTYNB7.js";
|
|
38
|
-
import {
|
|
39
|
-
collectContextData,
|
|
40
|
-
formatContextUsageText
|
|
41
|
-
} from "./chunk-B5I2IIWY.js";
|
|
41
|
+
} from "./chunk-CZSAIBUB.js";
|
|
42
42
|
import "./chunk-4WGODMVR.js";
|
|
43
|
+
import "./chunk-KW7NOTN6.js";
|
|
44
|
+
import "./chunk-TVYM3Q3J.js";
|
|
45
|
+
import "./chunk-5DTTYNB7.js";
|
|
43
46
|
import "./chunk-NHDKSOEY.js";
|
|
44
47
|
import {
|
|
45
48
|
isTerminalGoalStatusKind
|
|
46
49
|
} from "./chunk-7X7TEQNX.js";
|
|
47
50
|
import "./chunk-HTHUX2T5.js";
|
|
48
|
-
import "./chunk-
|
|
49
|
-
import "./chunk-
|
|
51
|
+
import "./chunk-F5XYN5VF.js";
|
|
52
|
+
import "./chunk-632KROVU.js";
|
|
50
53
|
import "./chunk-YAF2MQZ6.js";
|
|
51
|
-
import "./chunk-
|
|
52
|
-
import "./chunk-KW7NOTN6.js";
|
|
54
|
+
import "./chunk-XAAEDML2.js";
|
|
53
55
|
import {
|
|
56
|
+
GENERATION_MAX_PROMPT_BYTES,
|
|
57
|
+
GENERATION_TIMEOUT_MS,
|
|
54
58
|
MAX_REMEMBER_CONTENT_BYTES,
|
|
59
|
+
REDACTED_MCP_SECRET,
|
|
55
60
|
collectHistoryReplayUpdates,
|
|
56
61
|
copyCumulativeUsage,
|
|
57
62
|
createReplayCumulativeUsage,
|
|
58
63
|
createWorkspaceMemoryExtractionErrorLogger,
|
|
64
|
+
executeGeneration,
|
|
59
65
|
formatWorkspaceMemoryForgetSummary,
|
|
60
66
|
isValidServerName,
|
|
67
|
+
redactMcpServerSecrets,
|
|
61
68
|
replayTranscriptRecordPage,
|
|
69
|
+
restoreRedactedMcpSecrets,
|
|
62
70
|
shouldSuppressRememberErrorDetails,
|
|
63
71
|
workspaceMemoryFailureCode,
|
|
64
72
|
workspaceMemoryFailureDiagnostics
|
|
65
|
-
} from "./chunk-
|
|
73
|
+
} from "./chunk-IX7O5WI3.js";
|
|
66
74
|
import {
|
|
67
75
|
HistoryReplayer,
|
|
68
76
|
MessageEmitter,
|
|
69
77
|
PlanEmitter,
|
|
70
78
|
ToolCallEmitter
|
|
71
|
-
} from "./chunk-
|
|
72
|
-
import "./chunk-
|
|
73
|
-
import "./chunk-
|
|
79
|
+
} from "./chunk-PWYLF7SS.js";
|
|
80
|
+
import "./chunk-JBAQ5BYX.js";
|
|
81
|
+
import "./chunk-SUARMD4Q.js";
|
|
74
82
|
import "./chunk-QHTIBUWB.js";
|
|
75
83
|
import "./chunk-L573Z2QZ.js";
|
|
76
84
|
import {
|
|
77
85
|
computeCpuPercent
|
|
78
86
|
} from "./chunk-HGT6JR3U.js";
|
|
79
87
|
import "./chunk-RXFQM6FQ.js";
|
|
80
|
-
import "./chunk-
|
|
88
|
+
import "./chunk-LGY7PG7Q.js";
|
|
81
89
|
import "./chunk-6H67XLET.js";
|
|
82
|
-
import "./chunk-
|
|
83
|
-
import "./chunk-
|
|
84
|
-
import "./chunk-
|
|
90
|
+
import "./chunk-FHUXCRAF.js";
|
|
91
|
+
import "./chunk-64XGKNSI.js";
|
|
92
|
+
import "./chunk-LXXMOYPL.js";
|
|
93
|
+
import "./chunk-K2GBHL73.js";
|
|
85
94
|
import "./chunk-E5Z2AVNV.js";
|
|
86
95
|
import {
|
|
87
|
-
|
|
96
|
+
ACP_ROUTE_ID_PREFIX,
|
|
97
|
+
buildAcpModelOptions,
|
|
98
|
+
getCurrentAcpModelId,
|
|
88
99
|
parseAcpBaseModelId,
|
|
89
100
|
parseAcpModelOption,
|
|
101
|
+
resolveAcpModelOption,
|
|
90
102
|
sanitizeProviderBaseUrl
|
|
91
|
-
} from "./chunk-
|
|
103
|
+
} from "./chunk-6Z5NRZVU.js";
|
|
92
104
|
import {
|
|
93
105
|
mapSkillConfigToStatus
|
|
94
106
|
} from "./chunk-2W3OOD4W.js";
|
|
@@ -98,41 +110,45 @@ import {
|
|
|
98
110
|
buildPermissionSettings,
|
|
99
111
|
normalizePermissionRules,
|
|
100
112
|
readPermissionRuleSet
|
|
101
|
-
} from "./chunk-
|
|
113
|
+
} from "./chunk-57RWF6R7.js";
|
|
102
114
|
import {
|
|
103
115
|
MAX_AUDIO_BYTES,
|
|
104
116
|
sanitizeVoiceErrorMessage,
|
|
105
117
|
transcribeVoiceAudio
|
|
106
|
-
} from "./chunk-
|
|
118
|
+
} from "./chunk-6ITLKEOZ.js";
|
|
107
119
|
import {
|
|
108
120
|
readVoiceModel
|
|
109
|
-
} from "./chunk-
|
|
110
|
-
import "./chunk-
|
|
121
|
+
} from "./chunk-AEKYFMYE.js";
|
|
122
|
+
import "./chunk-F2RR4HO2.js";
|
|
123
|
+
import {
|
|
124
|
+
parseSessionSource
|
|
125
|
+
} from "./chunk-KEVDWH3U.js";
|
|
111
126
|
import {
|
|
112
127
|
CLIENT_MCP_OVER_WS_CONFIG_FLAG,
|
|
113
128
|
LOAD_REPLAY_BULK_MODE,
|
|
114
129
|
LOAD_REPLAY_META_KEY,
|
|
115
130
|
LOAD_REPLAY_MODE_META_KEY,
|
|
131
|
+
LOAD_REPLAY_PAGE_SIZE_META_KEY,
|
|
116
132
|
LOAD_REPLAY_VERSION,
|
|
117
133
|
MID_TURN_QUEUE_DRAIN_METHOD
|
|
118
|
-
} from "./chunk-
|
|
134
|
+
} from "./chunk-T3W4SDRB.js";
|
|
119
135
|
import "./chunk-6RLROE6G.js";
|
|
120
136
|
import "./chunk-COH43MRJ.js";
|
|
121
137
|
import {
|
|
122
138
|
NOT_CURRENTLY_GENERATING_CANCEL_MESSAGE
|
|
123
|
-
} from "./chunk-
|
|
124
|
-
import "./chunk-
|
|
125
|
-
import "./chunk-
|
|
139
|
+
} from "./chunk-X6YQWCIJ.js";
|
|
140
|
+
import "./chunk-3CL5SEDT.js";
|
|
141
|
+
import "./chunk-IVKLDHU6.js";
|
|
126
142
|
import "./chunk-57OAHC2Y.js";
|
|
127
|
-
import "./chunk-
|
|
128
|
-
import "./chunk-
|
|
143
|
+
import "./chunk-Y72B36CP.js";
|
|
144
|
+
import "./chunk-FZRES4GK.js";
|
|
129
145
|
import "./chunk-V6WHFGST.js";
|
|
130
146
|
import {
|
|
131
147
|
createLoadedSettingsAdapter
|
|
132
|
-
} from "./chunk-
|
|
148
|
+
} from "./chunk-LTD3CHGS.js";
|
|
133
149
|
import {
|
|
134
150
|
ndJsonStream
|
|
135
|
-
} from "./chunk-
|
|
151
|
+
} from "./chunk-O2K6BLPZ.js";
|
|
136
152
|
import {
|
|
137
153
|
ACP_PREFLIGHT_KINDS,
|
|
138
154
|
IDLE_HOOK_EVENTS,
|
|
@@ -140,21 +156,23 @@ import {
|
|
|
140
156
|
SERVE_STATUS_EXT_METHODS,
|
|
141
157
|
STATUS_SCHEMA_VERSION,
|
|
142
158
|
mapDomainErrorToErrorKind
|
|
143
|
-
} from "./chunk-
|
|
159
|
+
} from "./chunk-URP6O2PP.js";
|
|
144
160
|
import "./chunk-W7FJ3N32.js";
|
|
145
|
-
import "./chunk-
|
|
161
|
+
import "./chunk-JDIUK2Y3.js";
|
|
146
162
|
import "./chunk-TJTKSVIV.js";
|
|
147
163
|
import "./chunk-M5GB774H.js";
|
|
148
|
-
import "./chunk-
|
|
149
|
-
import "./chunk-
|
|
150
|
-
import "./chunk-
|
|
151
|
-
import "./chunk-SXU3KKNI.js";
|
|
164
|
+
import "./chunk-HCCR43AY.js";
|
|
165
|
+
import "./chunk-MI2V6IWU.js";
|
|
166
|
+
import "./chunk-ATJ7H5AS.js";
|
|
152
167
|
import {
|
|
153
168
|
AgentSideConnection,
|
|
154
169
|
PROTOCOL_VERSION,
|
|
155
170
|
RequestError
|
|
156
171
|
} from "./chunk-UDXSXLER.js";
|
|
157
|
-
import
|
|
172
|
+
import {
|
|
173
|
+
assembleMcpServers,
|
|
174
|
+
loadMcpApprovals
|
|
175
|
+
} from "./chunk-2XRGFF5K.js";
|
|
158
176
|
import {
|
|
159
177
|
OUTPUT_LANGUAGE_AUTO,
|
|
160
178
|
getOutputLanguageFilePath,
|
|
@@ -165,18 +183,18 @@ import {
|
|
|
165
183
|
resolveOutputLanguage,
|
|
166
184
|
updateOutputLanguageFile,
|
|
167
185
|
writeOutputLanguageAndRegisterPath
|
|
168
|
-
} from "./chunk-
|
|
186
|
+
} from "./chunk-C5NSOSF4.js";
|
|
169
187
|
import "./chunk-RKUWKYED.js";
|
|
170
188
|
import {
|
|
171
189
|
SUPPORTED_LANGUAGES,
|
|
172
190
|
getCurrentLanguage,
|
|
173
191
|
setLanguageAsync
|
|
174
|
-
} from "./chunk-
|
|
192
|
+
} from "./chunk-HIMIG6PI.js";
|
|
175
193
|
import {
|
|
176
194
|
findEnvFiles,
|
|
177
195
|
preResolveHomeEnvOverrides,
|
|
178
196
|
reloadEnvironment
|
|
179
|
-
} from "./chunk-
|
|
197
|
+
} from "./chunk-336KPNNV.js";
|
|
180
198
|
import "./chunk-GOXKNSDZ.js";
|
|
181
199
|
import {
|
|
182
200
|
getSystemDefaultsPath,
|
|
@@ -187,14 +205,14 @@ import {
|
|
|
187
205
|
isFolderTrustEnabled,
|
|
188
206
|
isWorkspaceTrusted,
|
|
189
207
|
loadTrustedFolders
|
|
190
|
-
} from "./chunk-
|
|
208
|
+
} from "./chunk-LSFVUGXT.js";
|
|
191
209
|
import "./chunk-ALGGS7UH.js";
|
|
192
210
|
import "./chunk-MR3PXB6E.js";
|
|
193
211
|
import {
|
|
194
212
|
writeStderrLine
|
|
195
213
|
} from "./chunk-YUZI3WAC.js";
|
|
196
214
|
import "./chunk-XFSFZCM5.js";
|
|
197
|
-
import "./chunk-
|
|
215
|
+
import "./chunk-KTKETHMY.js";
|
|
198
216
|
import "./chunk-VJNBRRZG.js";
|
|
199
217
|
import {
|
|
200
218
|
ALL_PROVIDERS,
|
|
@@ -218,7 +236,9 @@ import {
|
|
|
218
236
|
SESSION_ARTIFACT_PERSISTENCE_VERSION,
|
|
219
237
|
SESSION_TITLE_MAX_LENGTH,
|
|
220
238
|
SESSION_TRANSCRIPT_MAX_LIMIT,
|
|
239
|
+
SESSION_TRANSCRIPT_MAX_PAGE_BYTES,
|
|
221
240
|
SessionService,
|
|
241
|
+
SessionTranscriptPageTooLargeError,
|
|
222
242
|
SessionTranscriptReader,
|
|
223
243
|
SessionTranscriptSnapshotUnavailableError,
|
|
224
244
|
SessionTranscriptTooLargeError,
|
|
@@ -238,6 +258,7 @@ import {
|
|
|
238
258
|
clampInlineMediaPart,
|
|
239
259
|
clearGoalTerminalObserver,
|
|
240
260
|
computeUniqueBranchTitle,
|
|
261
|
+
convertToFunctionErrorResponse,
|
|
241
262
|
convertToFunctionResponse,
|
|
242
263
|
createDuplicateProviderToolCallResponse,
|
|
243
264
|
dedupeToolCallsById,
|
|
@@ -269,18 +290,18 @@ import {
|
|
|
269
290
|
getProviderToolCallId,
|
|
270
291
|
getScopedEnvContents,
|
|
271
292
|
getStartupContextLength,
|
|
272
|
-
hasImageParts,
|
|
273
293
|
ideContextStore,
|
|
274
294
|
injectPermissionRulesIfMissing,
|
|
275
295
|
isApproveOutcome,
|
|
276
296
|
isDenialFallbackReason,
|
|
297
|
+
isGatedMcpScope,
|
|
277
298
|
isPlanModeBlocked,
|
|
278
299
|
isSystemReminderContent,
|
|
279
300
|
markDuplicateProviderToolCallResponseSent,
|
|
280
301
|
matchesAnyServerPattern,
|
|
302
|
+
mcpServerRequiresOAuth,
|
|
281
303
|
needsConfirmation,
|
|
282
304
|
normalizeEventPayload,
|
|
283
|
-
normalizeParts,
|
|
284
305
|
normalizeSnapshotPayload,
|
|
285
306
|
parsePositiveIntegerEnv,
|
|
286
307
|
persistPermissionOutcome,
|
|
@@ -295,7 +316,6 @@ import {
|
|
|
295
316
|
runForkedAgent,
|
|
296
317
|
runManagedAutoMemoryDream,
|
|
297
318
|
runManagedRememberByAgent,
|
|
298
|
-
runVisionBridge,
|
|
299
319
|
sessionIdContext,
|
|
300
320
|
setGoalTerminalObserver,
|
|
301
321
|
shouldClassifyAllShellForAutoMode,
|
|
@@ -303,42 +323,39 @@ import {
|
|
|
303
323
|
shouldFirePermissionDeniedForAutoMode,
|
|
304
324
|
shouldForceAutoModeReviewForAllow,
|
|
305
325
|
shouldRunAutoModeForCall,
|
|
306
|
-
shouldRunVisionBridge,
|
|
307
|
-
splitImageParts,
|
|
308
326
|
subagentGenerator,
|
|
309
327
|
unregisterGoalHook,
|
|
310
328
|
updateSetting
|
|
311
|
-
} from "./chunk-
|
|
329
|
+
} from "./chunk-3YJZ6WNY.js";
|
|
330
|
+
import "./chunk-T4TZQJ7W.js";
|
|
312
331
|
import {
|
|
313
332
|
external_exports
|
|
314
333
|
} from "./chunk-H6XPXXMH.js";
|
|
315
334
|
import "./chunk-5M6IDOMF.js";
|
|
316
|
-
import "./chunk-
|
|
317
|
-
import "./chunk-
|
|
318
|
-
import "./chunk-
|
|
319
|
-
import "./chunk-
|
|
335
|
+
import "./chunk-LKR7QQ63.js";
|
|
336
|
+
import "./chunk-4XCVGEEX.js";
|
|
337
|
+
import "./chunk-XSPFQQRE.js";
|
|
338
|
+
import "./chunk-4RPARQ5D.js";
|
|
320
339
|
import "./chunk-E2UVIFI2.js";
|
|
321
|
-
import {
|
|
322
|
-
runSideQuery
|
|
323
|
-
} from "./chunk-6OATMEYN.js";
|
|
324
340
|
import "./chunk-XU457J4V.js";
|
|
325
341
|
import "./chunk-VDDGDZMA.js";
|
|
326
|
-
import "./chunk-
|
|
342
|
+
import "./chunk-J2MKYJKZ.js";
|
|
327
343
|
import "./chunk-SZRN75WQ.js";
|
|
328
344
|
import "./chunk-HTO4JFDZ.js";
|
|
329
345
|
import "./chunk-CPBF7KYF.js";
|
|
330
346
|
import {
|
|
331
347
|
APPROVAL_MODES,
|
|
332
|
-
FORK_SUBAGENT_TYPE
|
|
333
|
-
|
|
348
|
+
FORK_SUBAGENT_TYPE,
|
|
349
|
+
runWithRuntimeContentGenerator
|
|
350
|
+
} from "./chunk-VNN3JNYT.js";
|
|
334
351
|
import "./chunk-6AM5D4ME.js";
|
|
335
|
-
import "./chunk-
|
|
352
|
+
import "./chunk-OSSDHJDU.js";
|
|
336
353
|
import {
|
|
337
354
|
HookEventName,
|
|
338
355
|
createHookOutput
|
|
339
|
-
} from "./chunk-
|
|
340
|
-
import "./chunk-
|
|
341
|
-
import "./chunk-
|
|
356
|
+
} from "./chunk-SGPFJMRP.js";
|
|
357
|
+
import "./chunk-335ECZTA.js";
|
|
358
|
+
import "./chunk-JCJPZMJV.js";
|
|
342
359
|
import {
|
|
343
360
|
AuthType,
|
|
344
361
|
ConversationFinishedEvent,
|
|
@@ -349,66 +366,79 @@ import {
|
|
|
349
366
|
endToolExecutionSpan,
|
|
350
367
|
endToolSpan,
|
|
351
368
|
extractDaemonTraceContext,
|
|
369
|
+
formatFullTurnVisionNotice,
|
|
370
|
+
formatVisionBridgeNotice,
|
|
352
371
|
getAllGeminiMdFilenames,
|
|
372
|
+
getFullTurnVisionModelSelector,
|
|
353
373
|
getMCPServerStatus,
|
|
374
|
+
hasImageParts,
|
|
354
375
|
logConversationFinishedEvent,
|
|
355
376
|
logLoopDetected,
|
|
356
377
|
logPromptSuggestion,
|
|
357
378
|
logToolCall,
|
|
358
379
|
logUserPrompt,
|
|
380
|
+
normalizeParts,
|
|
359
381
|
registerAcpEventLoopLagGauge,
|
|
360
382
|
runInToolSpanContext,
|
|
383
|
+
runVisionBridge,
|
|
384
|
+
shouldRunVisionBridge,
|
|
385
|
+
splitImageParts,
|
|
361
386
|
startEventLoopLagMonitor,
|
|
362
387
|
startToolExecutionSpan,
|
|
363
388
|
startToolSpan,
|
|
364
389
|
uiTelemetryService,
|
|
390
|
+
withDaemonSpan,
|
|
365
391
|
withInteractionSpan
|
|
366
|
-
} from "./chunk-
|
|
392
|
+
} from "./chunk-66IT3EY2.js";
|
|
367
393
|
import "./chunk-4WKAA4KS.js";
|
|
368
394
|
import "./chunk-CR3C7WXL.js";
|
|
369
|
-
import
|
|
395
|
+
import {
|
|
396
|
+
runSideQuery
|
|
397
|
+
} from "./chunk-U2LNTX56.js";
|
|
370
398
|
import "./chunk-VGC4I5JJ.js";
|
|
371
399
|
import {
|
|
372
400
|
getAutoMemoryRoot,
|
|
373
401
|
getUserAutoMemoryRoot
|
|
374
|
-
} from "./chunk-
|
|
375
|
-
import "./chunk-
|
|
376
|
-
import "./chunk-
|
|
402
|
+
} from "./chunk-FUTHTZVV.js";
|
|
403
|
+
import "./chunk-4CA4WUMS.js";
|
|
404
|
+
import "./chunk-WEPXQKGP.js";
|
|
377
405
|
import {
|
|
378
406
|
ToolConfirmationOutcome,
|
|
379
|
-
ToolNames
|
|
380
|
-
|
|
407
|
+
ToolNames,
|
|
408
|
+
isShellProgressData
|
|
409
|
+
} from "./chunk-ANRANWVE.js";
|
|
381
410
|
import {
|
|
382
411
|
clearCachedCredentialFile,
|
|
383
412
|
qwenOAuth2Events
|
|
384
|
-
} from "./chunk-
|
|
385
|
-
import "./chunk-
|
|
413
|
+
} from "./chunk-G274ETR6.js";
|
|
414
|
+
import "./chunk-Z2LBNX3R.js";
|
|
386
415
|
import "./chunk-JESCGQM3.js";
|
|
387
|
-
import "./chunk-
|
|
416
|
+
import "./chunk-VAJS2E2D.js";
|
|
388
417
|
import "./chunk-XVNQMZ2I.js";
|
|
418
|
+
import "./chunk-FEOZBUMT.js";
|
|
389
419
|
import {
|
|
390
420
|
DEFAULT_TOKEN_LIMIT,
|
|
421
|
+
getToolCallPreparations,
|
|
391
422
|
tokenLimit
|
|
392
|
-
} from "./chunk-
|
|
393
|
-
import "./chunk-TQBODCFD.js";
|
|
423
|
+
} from "./chunk-CMVFTMRD.js";
|
|
394
424
|
import "./chunk-A4UCTEB5.js";
|
|
395
425
|
import "./chunk-XWRJCPHC.js";
|
|
396
|
-
import "./chunk-
|
|
426
|
+
import "./chunk-TYQMGACW.js";
|
|
397
427
|
import "./chunk-TYAMGABM.js";
|
|
398
428
|
import "./chunk-FCMNKVXT.js";
|
|
399
429
|
import "./chunk-DJ2GSRLV.js";
|
|
400
|
-
import "./chunk-
|
|
430
|
+
import "./chunk-4CHDYDG3.js";
|
|
401
431
|
import {
|
|
402
432
|
Storage,
|
|
403
433
|
createDebugLogger,
|
|
404
434
|
getErrorMessage,
|
|
405
435
|
getErrorStatus,
|
|
406
436
|
isSubpath
|
|
407
|
-
} from "./chunk-
|
|
408
|
-
import "./chunk-
|
|
437
|
+
} from "./chunk-UE5TZ55T.js";
|
|
438
|
+
import "./chunk-S4N3G4BB.js";
|
|
409
439
|
import {
|
|
410
440
|
runExitCleanup
|
|
411
|
-
} from "./chunk-
|
|
441
|
+
} from "./chunk-4HCYNDMG.js";
|
|
412
442
|
import "./chunk-75DOP5OR.js";
|
|
413
443
|
import "./chunk-DMTGGOSA.js";
|
|
414
444
|
import "./chunk-YQ3U5MUC.js";
|
|
@@ -423,6 +453,7 @@ import {
|
|
|
423
453
|
// packages/cli/src/acp-integration/acpAgent.ts
|
|
424
454
|
init_esbuild_shims();
|
|
425
455
|
import { randomUUID } from "node:crypto";
|
|
456
|
+
import { performance } from "node:perf_hooks";
|
|
426
457
|
|
|
427
458
|
// packages/cli/src/acp-integration/authMethods.ts
|
|
428
459
|
init_esbuild_shims();
|
|
@@ -802,6 +833,104 @@ import { Buffer as Buffer2 } from "node:buffer";
|
|
|
802
833
|
import * as os2 from "node:os";
|
|
803
834
|
import * as path3 from "node:path";
|
|
804
835
|
|
|
836
|
+
// packages/cli/src/utils/midTurnUserMessage.ts
|
|
837
|
+
init_esbuild_shims();
|
|
838
|
+
var MID_TURN_USER_MESSAGE_PREFIX = "\n[User message received during tool execution]: ";
|
|
839
|
+
function prefixMidTurnUserMessageParts(parts, displayText) {
|
|
840
|
+
const partArray = normalizePartList(parts);
|
|
841
|
+
if (partArray.length === 0) {
|
|
842
|
+
return [{ text: `${MID_TURN_USER_MESSAGE_PREFIX}${displayText}` }];
|
|
843
|
+
}
|
|
844
|
+
const [firstPart, ...rest] = partArray;
|
|
845
|
+
if ("text" in firstPart && typeof firstPart.text === "string") {
|
|
846
|
+
return [
|
|
847
|
+
{
|
|
848
|
+
...firstPart,
|
|
849
|
+
text: `${MID_TURN_USER_MESSAGE_PREFIX}${firstPart.text}`
|
|
850
|
+
},
|
|
851
|
+
...rest
|
|
852
|
+
];
|
|
853
|
+
}
|
|
854
|
+
return [
|
|
855
|
+
{ text: `${MID_TURN_USER_MESSAGE_PREFIX}${displayText}` },
|
|
856
|
+
...partArray
|
|
857
|
+
];
|
|
858
|
+
}
|
|
859
|
+
__name(prefixMidTurnUserMessageParts, "prefixMidTurnUserMessageParts");
|
|
860
|
+
|
|
861
|
+
// packages/cli/src/acp-integration/session/tool-call-preparation-tracker.ts
|
|
862
|
+
init_esbuild_shims();
|
|
863
|
+
var ToolCallPreparationTracker = class {
|
|
864
|
+
constructor(emitter) {
|
|
865
|
+
this.emitter = emitter;
|
|
866
|
+
}
|
|
867
|
+
static {
|
|
868
|
+
__name(this, "ToolCallPreparationTracker");
|
|
869
|
+
}
|
|
870
|
+
/** Contains only calls whose start frame was emitted successfully. */
|
|
871
|
+
pending = /* @__PURE__ */ new Map();
|
|
872
|
+
/** Contains calls whose start frame was intentionally suppressed. */
|
|
873
|
+
suppressed = /* @__PURE__ */ new Set();
|
|
874
|
+
/** Calls parsed completely but not yet handed to tool execution. */
|
|
875
|
+
resolved = /* @__PURE__ */ new Set();
|
|
876
|
+
/**
|
|
877
|
+
* Emits at most one preparing frame per call ID before the full call arrives.
|
|
878
|
+
*/
|
|
879
|
+
async observe(response) {
|
|
880
|
+
for (const preparation of getToolCallPreparations(response)) {
|
|
881
|
+
if (this.pending.has(preparation.callId) || this.suppressed.has(preparation.callId)) {
|
|
882
|
+
continue;
|
|
883
|
+
}
|
|
884
|
+
const emitted = await this.emitter.emitStart({
|
|
885
|
+
callId: preparation.callId,
|
|
886
|
+
toolName: preparation.toolName,
|
|
887
|
+
args: {},
|
|
888
|
+
status: "pending",
|
|
889
|
+
phase: "preparing"
|
|
890
|
+
});
|
|
891
|
+
if (emitted) {
|
|
892
|
+
this.pending.set(preparation.callId, preparation.toolName);
|
|
893
|
+
} else {
|
|
894
|
+
this.suppressed.add(preparation.callId);
|
|
895
|
+
}
|
|
896
|
+
}
|
|
897
|
+
}
|
|
898
|
+
/** Resolves preparations once their complete function calls arrive. */
|
|
899
|
+
resolve(functionCalls) {
|
|
900
|
+
for (const functionCall of functionCalls) {
|
|
901
|
+
if (functionCall.id && this.pending.has(functionCall.id)) {
|
|
902
|
+
this.resolved.add(functionCall.id);
|
|
903
|
+
}
|
|
904
|
+
}
|
|
905
|
+
}
|
|
906
|
+
/**
|
|
907
|
+
* Terminates unresolved preparations. The map is cleared first so repeated
|
|
908
|
+
* cleanup, including re-entry after an emission failure, cannot emit twice.
|
|
909
|
+
*/
|
|
910
|
+
async discard(includeResolved = false) {
|
|
911
|
+
const pending = [...this.pending.entries()];
|
|
912
|
+
this.pending.clear();
|
|
913
|
+
const resolved = new Set(this.resolved);
|
|
914
|
+
this.resolved.clear();
|
|
915
|
+
let firstError;
|
|
916
|
+
let hasError = false;
|
|
917
|
+
for (const [callId, toolName] of pending) {
|
|
918
|
+
if (!includeResolved && resolved.has(callId)) continue;
|
|
919
|
+
try {
|
|
920
|
+
await this.emitter.emitPreparationDiscarded(callId, toolName);
|
|
921
|
+
} catch (error) {
|
|
922
|
+
if (!hasError) {
|
|
923
|
+
firstError = error;
|
|
924
|
+
hasError = true;
|
|
925
|
+
}
|
|
926
|
+
}
|
|
927
|
+
}
|
|
928
|
+
if (hasError) {
|
|
929
|
+
throw firstError;
|
|
930
|
+
}
|
|
931
|
+
}
|
|
932
|
+
};
|
|
933
|
+
|
|
805
934
|
// packages/cli/src/acp-integration/session/SubAgentTracker.ts
|
|
806
935
|
init_esbuild_shims();
|
|
807
936
|
|
|
@@ -1512,6 +1641,17 @@ var debugLogger6 = createDebugLogger("SESSION");
|
|
|
1512
1641
|
var USER_CANCEL_ABORT_REASON = "qwen:user-cancel";
|
|
1513
1642
|
var DAEMON_RETRY_META_KEY = "qwen.daemon.retry";
|
|
1514
1643
|
var DAEMON_CONTINUE_META_KEY = "qwen.daemon.continueLastTurn";
|
|
1644
|
+
async function finalizeToolCallPreparations(tracker, includeResolved, streamName) {
|
|
1645
|
+
try {
|
|
1646
|
+
await tracker.discard(includeResolved);
|
|
1647
|
+
} catch (error) {
|
|
1648
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
1649
|
+
debugLogger6.warn(
|
|
1650
|
+
`Failed to discard tool preparations for ${streamName}; continuing stream: ${message}`
|
|
1651
|
+
);
|
|
1652
|
+
}
|
|
1653
|
+
}
|
|
1654
|
+
__name(finalizeToolCallPreparations, "finalizeToolCallPreparations");
|
|
1515
1655
|
function maskApiKeyForDisplay(apiKey) {
|
|
1516
1656
|
const trimmed = apiKey?.trim() ?? "";
|
|
1517
1657
|
if (trimmed.length === 0) return "(not set)";
|
|
@@ -2581,6 +2721,14 @@ var Session = class {
|
|
|
2581
2721
|
);
|
|
2582
2722
|
const inputText = firstTextBlock?.text || "";
|
|
2583
2723
|
let parts;
|
|
2724
|
+
let fullTurnModelOverride;
|
|
2725
|
+
const onFullTurnModel = /* @__PURE__ */ __name((model) => {
|
|
2726
|
+
if (fullTurnModelOverride) {
|
|
2727
|
+
return false;
|
|
2728
|
+
}
|
|
2729
|
+
fullTurnModelOverride = model;
|
|
2730
|
+
return true;
|
|
2731
|
+
}, "onFullTurnModel");
|
|
2584
2732
|
if (isContinue) {
|
|
2585
2733
|
parts = continuationParts;
|
|
2586
2734
|
} else if (isSlashCommand(inputText)) {
|
|
@@ -2592,7 +2740,9 @@ var Session = class {
|
|
|
2592
2740
|
);
|
|
2593
2741
|
parts = await this.#processSlashCommandResult(
|
|
2594
2742
|
slashCommandResult,
|
|
2595
|
-
params.prompt
|
|
2743
|
+
params.prompt,
|
|
2744
|
+
pendingSend.signal,
|
|
2745
|
+
onFullTurnModel
|
|
2596
2746
|
);
|
|
2597
2747
|
if (parts === null) {
|
|
2598
2748
|
return { stopReason: "end_turn" };
|
|
@@ -2601,7 +2751,7 @@ var Session = class {
|
|
|
2601
2751
|
parts = await this.#resolvePrompt(
|
|
2602
2752
|
params.prompt,
|
|
2603
2753
|
pendingSend.signal,
|
|
2604
|
-
{ promptLast: true }
|
|
2754
|
+
{ promptLast: true, onFullTurnModel }
|
|
2605
2755
|
);
|
|
2606
2756
|
}
|
|
2607
2757
|
const hooksEnabled = !this.config.getDisableAllHooks?.();
|
|
@@ -2676,6 +2826,9 @@ ${this.pendingWorktreeNotice}
|
|
|
2676
2826
|
return { stopReason: "cancelled" };
|
|
2677
2827
|
}
|
|
2678
2828
|
const functionCalls = [];
|
|
2829
|
+
const preparationTracker = new ToolCallPreparationTracker(
|
|
2830
|
+
this.toolCallEmitter
|
|
2831
|
+
);
|
|
2679
2832
|
let usageMetadata = null;
|
|
2680
2833
|
const streamStartTime = Date.now();
|
|
2681
2834
|
const messageDisplay = this.#createMessageDisplayDispatcher(
|
|
@@ -2685,7 +2838,8 @@ ${this.pendingWorktreeNotice}
|
|
|
2685
2838
|
const sendResult = await this.#sendMessageStreamWithAutoCompression(
|
|
2686
2839
|
promptId,
|
|
2687
2840
|
nextMessage?.parts ?? [],
|
|
2688
|
-
pendingSend.signal
|
|
2841
|
+
pendingSend.signal,
|
|
2842
|
+
{ modelOverride: fullTurnModelOverride }
|
|
2689
2843
|
);
|
|
2690
2844
|
if (!sendResult.responseStream) {
|
|
2691
2845
|
this.#preserveUnsentMessageHistory(
|
|
@@ -2696,35 +2850,56 @@ ${this.pendingWorktreeNotice}
|
|
|
2696
2850
|
}
|
|
2697
2851
|
const responseStream = sendResult.responseStream;
|
|
2698
2852
|
nextMessage = null;
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
|
|
2853
|
+
let streamFailed = false;
|
|
2854
|
+
try {
|
|
2855
|
+
for await (const resp of responseStream) {
|
|
2856
|
+
if (pendingSend.signal.aborted) {
|
|
2857
|
+
return { stopReason: "cancelled" };
|
|
2858
|
+
}
|
|
2859
|
+
if (resp.type === "chunk" /* CHUNK */ && resp.value.candidates && resp.value.candidates.length > 0) {
|
|
2860
|
+
const candidate = resp.value.candidates[0];
|
|
2861
|
+
for (const part of candidate.content?.parts ?? []) {
|
|
2862
|
+
if (!part.text) {
|
|
2863
|
+
continue;
|
|
2864
|
+
}
|
|
2865
|
+
this.messageEmitter.emitMessage(
|
|
2866
|
+
part.text,
|
|
2867
|
+
"assistant",
|
|
2868
|
+
part.thought
|
|
2869
|
+
);
|
|
2870
|
+
if (!part.thought) {
|
|
2871
|
+
messageDisplay?.addChunk(part.text);
|
|
2872
|
+
}
|
|
2708
2873
|
}
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2874
|
+
}
|
|
2875
|
+
if (resp.type === "chunk" /* CHUNK */ && resp.value.usageMetadata) {
|
|
2876
|
+
usageMetadata = resp.value.usageMetadata;
|
|
2877
|
+
}
|
|
2878
|
+
if (resp.type === "chunk" /* CHUNK */) {
|
|
2879
|
+
await preparationTracker.observe(resp.value);
|
|
2880
|
+
if (resp.value.functionCalls) {
|
|
2881
|
+
preparationTracker.resolve(resp.value.functionCalls);
|
|
2882
|
+
functionCalls.push(...resp.value.functionCalls);
|
|
2716
2883
|
}
|
|
2717
2884
|
}
|
|
2885
|
+
if (resp.type === "retry" /* RETRY */ || resp.type === "model_fallback" /* MODEL_FALLBACK */) {
|
|
2886
|
+
await finalizeToolCallPreparations(
|
|
2887
|
+
preparationTracker,
|
|
2888
|
+
true,
|
|
2889
|
+
`main prompt ${resp.type}`
|
|
2890
|
+
);
|
|
2891
|
+
functionCalls.length = 0;
|
|
2892
|
+
}
|
|
2718
2893
|
}
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
|
|
2894
|
+
} catch (error) {
|
|
2895
|
+
streamFailed = true;
|
|
2896
|
+
throw error;
|
|
2897
|
+
} finally {
|
|
2898
|
+
await finalizeToolCallPreparations(
|
|
2899
|
+
preparationTracker,
|
|
2900
|
+
streamFailed || pendingSend.signal.aborted,
|
|
2901
|
+
"main prompt"
|
|
2902
|
+
);
|
|
2728
2903
|
}
|
|
2729
2904
|
} catch (error) {
|
|
2730
2905
|
if (strippedOrphanEntries && (this.#getCurrentChat().getUserContentPushCount?.() ?? 0) <= orphanPushCountSnapshot) {
|
|
@@ -2772,11 +2947,14 @@ ${this.pendingWorktreeNotice}
|
|
|
2772
2947
|
);
|
|
2773
2948
|
}
|
|
2774
2949
|
if (functionCalls.length > 0) {
|
|
2775
|
-
const toolRun = await this
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
|
|
2950
|
+
const toolRun = await this.#runWithFullTurnModel(
|
|
2951
|
+
fullTurnModelOverride,
|
|
2952
|
+
() => this.runToolCalls(
|
|
2953
|
+
pendingSend.signal,
|
|
2954
|
+
promptId,
|
|
2955
|
+
functionCalls,
|
|
2956
|
+
toolLoopState
|
|
2957
|
+
)
|
|
2780
2958
|
);
|
|
2781
2959
|
if (toolRun.stopAfterPermissionCancel) {
|
|
2782
2960
|
await this.#preserveStoppedToolRun(
|
|
@@ -2787,7 +2965,8 @@ ${this.pendingWorktreeNotice}
|
|
|
2787
2965
|
}
|
|
2788
2966
|
nextMessage = await this.#buildNextMessageAfterToolRun(
|
|
2789
2967
|
toolRun,
|
|
2790
|
-
pendingSend.signal
|
|
2968
|
+
pendingSend.signal,
|
|
2969
|
+
onFullTurnModel
|
|
2791
2970
|
);
|
|
2792
2971
|
if (toolRun.loopDetected) {
|
|
2793
2972
|
await this.#preserveStoppedToolRun(
|
|
@@ -2805,7 +2984,8 @@ ${this.pendingWorktreeNotice}
|
|
|
2805
2984
|
pendingSend,
|
|
2806
2985
|
promptId,
|
|
2807
2986
|
hooksEnabled,
|
|
2808
|
-
messageBus
|
|
2987
|
+
messageBus,
|
|
2988
|
+
fullTurnModelOverride
|
|
2809
2989
|
);
|
|
2810
2990
|
} finally {
|
|
2811
2991
|
logConversationFinishedEvent(
|
|
@@ -2834,10 +3014,17 @@ ${this.pendingWorktreeNotice}
|
|
|
2834
3014
|
* @param messageBus - The MessageBus for hook communication (may be undefined)
|
|
2835
3015
|
* @returns The ACP stop reason for the prompt.
|
|
2836
3016
|
*/
|
|
2837
|
-
async #handleStopHookLoop(pendingSend, promptId, hooksEnabled, messageBus) {
|
|
3017
|
+
async #handleStopHookLoop(pendingSend, promptId, hooksEnabled, messageBus, modelOverride) {
|
|
2838
3018
|
const stopHookBlockingCap = this.config.getStopHookBlockingCap();
|
|
2839
3019
|
let stopHookIterationCount = 0;
|
|
2840
3020
|
let stopHookReasons = [];
|
|
3021
|
+
const onFullTurnModel = /* @__PURE__ */ __name((model) => {
|
|
3022
|
+
if (modelOverride) {
|
|
3023
|
+
return false;
|
|
3024
|
+
}
|
|
3025
|
+
modelOverride = model;
|
|
3026
|
+
return true;
|
|
3027
|
+
}, "onFullTurnModel");
|
|
2841
3028
|
while (stopHookIterationCount < stopHookBlockingCap) {
|
|
2842
3029
|
if (!hooksEnabled || !messageBus || pendingSend.signal.aborted || !this.config.hasHooksForEvent?.("Stop")) {
|
|
2843
3030
|
return { stopReason: "end_turn" };
|
|
@@ -2904,6 +3091,9 @@ ${this.pendingWorktreeNotice}
|
|
|
2904
3091
|
return { stopReason: "cancelled" };
|
|
2905
3092
|
}
|
|
2906
3093
|
const functionCalls = [];
|
|
3094
|
+
const preparationTracker = new ToolCallPreparationTracker(
|
|
3095
|
+
this.toolCallEmitter
|
|
3096
|
+
);
|
|
2907
3097
|
let usageMetadata = null;
|
|
2908
3098
|
const streamStartTime = Date.now();
|
|
2909
3099
|
const messageDisplay = this.#createMessageDisplayDispatcher(
|
|
@@ -2914,7 +3104,10 @@ ${this.pendingWorktreeNotice}
|
|
|
2914
3104
|
promptId + "_stop_hook_" + stopHookIterationCount,
|
|
2915
3105
|
nextMessage?.parts ?? [],
|
|
2916
3106
|
pendingSend.signal,
|
|
2917
|
-
{
|
|
3107
|
+
{
|
|
3108
|
+
skipCompression: stopHookIterationCount > 1,
|
|
3109
|
+
modelOverride
|
|
3110
|
+
}
|
|
2918
3111
|
);
|
|
2919
3112
|
if (!continueSendResult.responseStream) {
|
|
2920
3113
|
this.#preserveUnsentMessageHistory(
|
|
@@ -2925,33 +3118,54 @@ ${this.pendingWorktreeNotice}
|
|
|
2925
3118
|
}
|
|
2926
3119
|
const continueResponseStream = continueSendResult.responseStream;
|
|
2927
3120
|
nextMessage = null;
|
|
2928
|
-
|
|
2929
|
-
|
|
2930
|
-
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
|
|
2937
|
-
part.text
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
3121
|
+
let streamFailed = false;
|
|
3122
|
+
try {
|
|
3123
|
+
for await (const resp of continueResponseStream) {
|
|
3124
|
+
if (pendingSend.signal.aborted) {
|
|
3125
|
+
return { stopReason: "cancelled" };
|
|
3126
|
+
}
|
|
3127
|
+
if (resp.type === "chunk" /* CHUNK */ && resp.value.candidates && resp.value.candidates.length > 0) {
|
|
3128
|
+
const candidate = resp.value.candidates[0];
|
|
3129
|
+
for (const part of candidate.content?.parts ?? []) {
|
|
3130
|
+
if (!part.text) continue;
|
|
3131
|
+
this.messageEmitter.emitMessage(
|
|
3132
|
+
part.text,
|
|
3133
|
+
"assistant",
|
|
3134
|
+
part.thought
|
|
3135
|
+
);
|
|
3136
|
+
if (!part.thought) {
|
|
3137
|
+
messageDisplay?.addChunk(part.text);
|
|
3138
|
+
}
|
|
2943
3139
|
}
|
|
2944
3140
|
}
|
|
3141
|
+
if (resp.type === "chunk" /* CHUNK */ && resp.value.usageMetadata) {
|
|
3142
|
+
usageMetadata = resp.value.usageMetadata;
|
|
3143
|
+
}
|
|
3144
|
+
if (resp.type === "chunk" /* CHUNK */) {
|
|
3145
|
+
await preparationTracker.observe(resp.value);
|
|
3146
|
+
if (resp.value.functionCalls) {
|
|
3147
|
+
preparationTracker.resolve(resp.value.functionCalls);
|
|
3148
|
+
functionCalls.push(...resp.value.functionCalls);
|
|
3149
|
+
}
|
|
3150
|
+
}
|
|
3151
|
+
if (resp.type === "retry" /* RETRY */ || resp.type === "model_fallback" /* MODEL_FALLBACK */) {
|
|
3152
|
+
await finalizeToolCallPreparations(
|
|
3153
|
+
preparationTracker,
|
|
3154
|
+
true,
|
|
3155
|
+
`Stop Hook continuation ${resp.type}`
|
|
3156
|
+
);
|
|
3157
|
+
functionCalls.length = 0;
|
|
3158
|
+
}
|
|
2945
3159
|
}
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
|
|
2949
|
-
|
|
2950
|
-
|
|
2951
|
-
|
|
2952
|
-
|
|
2953
|
-
|
|
2954
|
-
|
|
3160
|
+
} catch (error) {
|
|
3161
|
+
streamFailed = true;
|
|
3162
|
+
throw error;
|
|
3163
|
+
} finally {
|
|
3164
|
+
await finalizeToolCallPreparations(
|
|
3165
|
+
preparationTracker,
|
|
3166
|
+
streamFailed || pendingSend.signal.aborted,
|
|
3167
|
+
"Stop Hook continuation"
|
|
3168
|
+
);
|
|
2955
3169
|
}
|
|
2956
3170
|
} catch (error) {
|
|
2957
3171
|
const errorStatus = getErrorStatus(error);
|
|
@@ -2987,11 +3201,14 @@ ${this.pendingWorktreeNotice}
|
|
|
2987
3201
|
);
|
|
2988
3202
|
}
|
|
2989
3203
|
if (functionCalls.length > 0) {
|
|
2990
|
-
const toolRun = await this
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
|
|
3204
|
+
const toolRun = await this.#runWithFullTurnModel(
|
|
3205
|
+
modelOverride,
|
|
3206
|
+
() => this.runToolCalls(
|
|
3207
|
+
pendingSend.signal,
|
|
3208
|
+
promptId,
|
|
3209
|
+
functionCalls,
|
|
3210
|
+
toolLoopState
|
|
3211
|
+
)
|
|
2995
3212
|
);
|
|
2996
3213
|
if (toolRun.stopAfterPermissionCancel) {
|
|
2997
3214
|
await this.#preserveStoppedToolRun(toolRun, pendingSend.signal);
|
|
@@ -2999,7 +3216,8 @@ ${this.pendingWorktreeNotice}
|
|
|
2999
3216
|
}
|
|
3000
3217
|
nextMessage = await this.#buildNextMessageAfterToolRun(
|
|
3001
3218
|
toolRun,
|
|
3002
|
-
pendingSend.signal
|
|
3219
|
+
pendingSend.signal,
|
|
3220
|
+
onFullTurnModel
|
|
3003
3221
|
);
|
|
3004
3222
|
if (toolRun.loopDetected) {
|
|
3005
3223
|
await this.#preserveStoppedToolRun(toolRun, pendingSend.signal);
|
|
@@ -3023,6 +3241,13 @@ ${this.pendingWorktreeNotice}
|
|
|
3023
3241
|
#getCurrentChat() {
|
|
3024
3242
|
return this.config.getGeminiClient().getChat();
|
|
3025
3243
|
}
|
|
3244
|
+
async #runWithFullTurnModel(modelOverride, fn) {
|
|
3245
|
+
if (!modelOverride?.endsWith("\0")) {
|
|
3246
|
+
return fn();
|
|
3247
|
+
}
|
|
3248
|
+
const runtimeView = await this.config.getBaseLlmClient().resolveForModel(modelOverride.slice(0, -1), { failClosed: true });
|
|
3249
|
+
return runWithRuntimeContentGenerator(runtimeView, fn);
|
|
3250
|
+
}
|
|
3026
3251
|
/**
|
|
3027
3252
|
* Mirrors the core send path for ACP model sends.
|
|
3028
3253
|
*
|
|
@@ -3057,7 +3282,7 @@ ${this.pendingWorktreeNotice}
|
|
|
3057
3282
|
const geminiClient = this.config.getGeminiClient();
|
|
3058
3283
|
let compressionDiagnostic = null;
|
|
3059
3284
|
let compressionInfo = null;
|
|
3060
|
-
if (!options.skipCompression) {
|
|
3285
|
+
if (!options.skipCompression && !options.modelOverride) {
|
|
3061
3286
|
try {
|
|
3062
3287
|
const compressed = await geminiClient.tryCompressChat(
|
|
3063
3288
|
promptId,
|
|
@@ -3115,7 +3340,7 @@ ${this.pendingWorktreeNotice}
|
|
|
3115
3340
|
return { responseStream: null, stopReason: "cancelled" };
|
|
3116
3341
|
}
|
|
3117
3342
|
const responseStream = await this.#getCurrentChat().sendMessageStream(
|
|
3118
|
-
this.config.getModel(),
|
|
3343
|
+
options.modelOverride ?? this.config.getModel(),
|
|
3119
3344
|
{
|
|
3120
3345
|
message,
|
|
3121
3346
|
config: {
|
|
@@ -3162,7 +3387,7 @@ ${this.pendingWorktreeNotice}
|
|
|
3162
3387
|
);
|
|
3163
3388
|
await this.messageRewriter?.waitForPendingRewrites();
|
|
3164
3389
|
}
|
|
3165
|
-
async #buildNextMessageAfterToolRun(toolRun, abortSignal) {
|
|
3390
|
+
async #buildNextMessageAfterToolRun(toolRun, abortSignal, onFullTurnModel) {
|
|
3166
3391
|
if (toolRun.loopDetected) {
|
|
3167
3392
|
debugLogger6.debug("Stopping ACP turn after daemon loop detection.");
|
|
3168
3393
|
return null;
|
|
@@ -3175,7 +3400,7 @@ ${this.pendingWorktreeNotice}
|
|
|
3175
3400
|
}
|
|
3176
3401
|
const parts = [
|
|
3177
3402
|
...toolRun.parts,
|
|
3178
|
-
...await this.#drainMidTurnUserMessages(abortSignal)
|
|
3403
|
+
...await this.#drainMidTurnUserMessages(abortSignal, onFullTurnModel)
|
|
3179
3404
|
];
|
|
3180
3405
|
return { role: "user", parts };
|
|
3181
3406
|
}
|
|
@@ -3255,10 +3480,10 @@ ${this.pendingWorktreeNotice}
|
|
|
3255
3480
|
content: { type: "text", text }
|
|
3256
3481
|
});
|
|
3257
3482
|
}
|
|
3258
|
-
async #drainMidTurnUserMessages(abortSignal) {
|
|
3483
|
+
async #drainMidTurnUserMessages(abortSignal, onFullTurnModel) {
|
|
3259
3484
|
const recovered = this.#takeRecoveredMidTurnMessages();
|
|
3260
3485
|
if (this.midTurnDrainUnavailable) {
|
|
3261
|
-
return this.#buildMidTurnParts(recovered, abortSignal);
|
|
3486
|
+
return this.#buildMidTurnParts(recovered, abortSignal, onFullTurnModel);
|
|
3262
3487
|
}
|
|
3263
3488
|
let drainPromise;
|
|
3264
3489
|
try {
|
|
@@ -3281,7 +3506,8 @@ ${this.pendingWorktreeNotice}
|
|
|
3281
3506
|
this.midTurnDrainTimeoutStrikes = 0;
|
|
3282
3507
|
return this.#buildMidTurnParts(
|
|
3283
3508
|
[...recovered, ...parseMidTurnDrainResponse(response)],
|
|
3284
|
-
abortSignal
|
|
3509
|
+
abortSignal,
|
|
3510
|
+
onFullTurnModel
|
|
3285
3511
|
);
|
|
3286
3512
|
} catch (error) {
|
|
3287
3513
|
const errorMessage = error instanceof Error ? error.message : error && typeof error === "object" && "message" in error ? String(error.message) : String(error);
|
|
@@ -3298,7 +3524,7 @@ ${this.pendingWorktreeNotice}
|
|
|
3298
3524
|
debugLogger6.warn(
|
|
3299
3525
|
`Mid-turn queue drain ${isPermanentError ? "permanently " : ""}unavailable [session ${this.sessionId}]: ${errorMessage}`
|
|
3300
3526
|
);
|
|
3301
|
-
return this.#buildMidTurnParts(recovered, abortSignal);
|
|
3527
|
+
return this.#buildMidTurnParts(recovered, abortSignal, onFullTurnModel);
|
|
3302
3528
|
}
|
|
3303
3529
|
}
|
|
3304
3530
|
/** Read and clear the buffer of messages recovered from a timed-out drain. */
|
|
@@ -3356,7 +3582,7 @@ ${this.pendingWorktreeNotice}
|
|
|
3356
3582
|
* happens on injection (here), so a message recovered from an earlier
|
|
3357
3583
|
* timed-out drain is still recorded exactly once.
|
|
3358
3584
|
*/
|
|
3359
|
-
async #buildMidTurnParts(messages, abortSignal) {
|
|
3585
|
+
async #buildMidTurnParts(messages, abortSignal, onFullTurnModel) {
|
|
3360
3586
|
const parts = [];
|
|
3361
3587
|
for (const message of messages) {
|
|
3362
3588
|
const displayText = message.kind === "text" ? message.message : message.displayText;
|
|
@@ -3365,7 +3591,9 @@ ${this.pendingWorktreeNotice}
|
|
|
3365
3591
|
rawParts = message.kind === "text" ? [{ text: message.message }] : await withTimeoutSignal(
|
|
3366
3592
|
abortSignal,
|
|
3367
3593
|
MID_TURN_QUEUE_RESOLVE_TIMEOUT_MS,
|
|
3368
|
-
(signal) => this.#resolvePrompt(message.content, signal
|
|
3594
|
+
(signal) => this.#resolvePrompt(message.content, signal, {
|
|
3595
|
+
onFullTurnModel
|
|
3596
|
+
})
|
|
3369
3597
|
);
|
|
3370
3598
|
} catch (messageError) {
|
|
3371
3599
|
if (abortSignal.aborted) return parts;
|
|
@@ -3557,6 +3785,9 @@ ${this.pendingWorktreeNotice}
|
|
|
3557
3785
|
turnCount++;
|
|
3558
3786
|
if (ac.signal.aborted) return;
|
|
3559
3787
|
const functionCalls = [];
|
|
3788
|
+
const preparationTracker = new ToolCallPreparationTracker(
|
|
3789
|
+
this.toolCallEmitter
|
|
3790
|
+
);
|
|
3560
3791
|
let usageMetadata = null;
|
|
3561
3792
|
const streamStartTime = Date.now();
|
|
3562
3793
|
const sendResult = await this.#sendMessageStreamWithAutoCompression(
|
|
@@ -3582,6 +3813,7 @@ ${this.pendingWorktreeNotice}
|
|
|
3582
3813
|
const messageDisplay = this.#createMessageDisplayDispatcher(
|
|
3583
3814
|
ac.signal
|
|
3584
3815
|
);
|
|
3816
|
+
let streamFailed = false;
|
|
3585
3817
|
try {
|
|
3586
3818
|
for await (const resp of responseStream) {
|
|
3587
3819
|
if (ac.signal.aborted) return;
|
|
@@ -3602,15 +3834,35 @@ ${this.pendingWorktreeNotice}
|
|
|
3602
3834
|
if (resp.type === "chunk" /* CHUNK */ && resp.value.usageMetadata) {
|
|
3603
3835
|
usageMetadata = resp.value.usageMetadata;
|
|
3604
3836
|
}
|
|
3605
|
-
if (resp.type === "chunk" /* CHUNK */
|
|
3606
|
-
|
|
3837
|
+
if (resp.type === "chunk" /* CHUNK */) {
|
|
3838
|
+
await preparationTracker.observe(resp.value);
|
|
3839
|
+
if (resp.value.functionCalls) {
|
|
3840
|
+
preparationTracker.resolve(resp.value.functionCalls);
|
|
3841
|
+
functionCalls.push(...resp.value.functionCalls);
|
|
3842
|
+
}
|
|
3607
3843
|
}
|
|
3608
|
-
if (resp.type === "model_fallback" /* MODEL_FALLBACK */) {
|
|
3844
|
+
if (resp.type === "retry" /* RETRY */ || resp.type === "model_fallback" /* MODEL_FALLBACK */) {
|
|
3845
|
+
await finalizeToolCallPreparations(
|
|
3846
|
+
preparationTracker,
|
|
3847
|
+
true,
|
|
3848
|
+
`cron/loop tick ${resp.type}`
|
|
3849
|
+
);
|
|
3609
3850
|
functionCalls.length = 0;
|
|
3610
3851
|
}
|
|
3611
3852
|
}
|
|
3853
|
+
} catch (error) {
|
|
3854
|
+
streamFailed = true;
|
|
3855
|
+
throw error;
|
|
3612
3856
|
} finally {
|
|
3613
|
-
|
|
3857
|
+
try {
|
|
3858
|
+
await finalizeToolCallPreparations(
|
|
3859
|
+
preparationTracker,
|
|
3860
|
+
streamFailed || ac.signal.aborted,
|
|
3861
|
+
"cron/loop tick"
|
|
3862
|
+
);
|
|
3863
|
+
} finally {
|
|
3864
|
+
await messageDisplay?.finish();
|
|
3865
|
+
}
|
|
3614
3866
|
}
|
|
3615
3867
|
if (usageMetadata) {
|
|
3616
3868
|
this.#recordPromptTokenCount(usageMetadata);
|
|
@@ -3808,6 +4060,9 @@ ${this.pendingWorktreeNotice}
|
|
|
3808
4060
|
return;
|
|
3809
4061
|
}
|
|
3810
4062
|
const functionCalls = [];
|
|
4063
|
+
const preparationTracker = new ToolCallPreparationTracker(
|
|
4064
|
+
this.toolCallEmitter
|
|
4065
|
+
);
|
|
3811
4066
|
let usageMetadata = null;
|
|
3812
4067
|
let responseText = "";
|
|
3813
4068
|
const streamStartTime = Date.now();
|
|
@@ -3831,6 +4086,7 @@ ${this.pendingWorktreeNotice}
|
|
|
3831
4086
|
const messageDisplay = this.#createMessageDisplayDispatcher(
|
|
3832
4087
|
ac.signal
|
|
3833
4088
|
);
|
|
4089
|
+
let streamFailed = false;
|
|
3834
4090
|
try {
|
|
3835
4091
|
for await (const resp of responseStream) {
|
|
3836
4092
|
if (ac.signal.aborted) {
|
|
@@ -3856,15 +4112,35 @@ ${this.pendingWorktreeNotice}
|
|
|
3856
4112
|
if (resp.type === "chunk" /* CHUNK */ && resp.value.usageMetadata) {
|
|
3857
4113
|
usageMetadata = resp.value.usageMetadata;
|
|
3858
4114
|
}
|
|
3859
|
-
if (resp.type === "chunk" /* CHUNK */
|
|
3860
|
-
|
|
4115
|
+
if (resp.type === "chunk" /* CHUNK */) {
|
|
4116
|
+
await preparationTracker.observe(resp.value);
|
|
4117
|
+
if (resp.value.functionCalls) {
|
|
4118
|
+
preparationTracker.resolve(resp.value.functionCalls);
|
|
4119
|
+
functionCalls.push(...resp.value.functionCalls);
|
|
4120
|
+
}
|
|
3861
4121
|
}
|
|
3862
|
-
if (resp.type === "model_fallback" /* MODEL_FALLBACK */) {
|
|
4122
|
+
if (resp.type === "retry" /* RETRY */ || resp.type === "model_fallback" /* MODEL_FALLBACK */) {
|
|
4123
|
+
await finalizeToolCallPreparations(
|
|
4124
|
+
preparationTracker,
|
|
4125
|
+
true,
|
|
4126
|
+
`background notification ${resp.type}`
|
|
4127
|
+
);
|
|
3863
4128
|
functionCalls.length = 0;
|
|
3864
4129
|
}
|
|
3865
4130
|
}
|
|
4131
|
+
} catch (error) {
|
|
4132
|
+
streamFailed = true;
|
|
4133
|
+
throw error;
|
|
3866
4134
|
} finally {
|
|
3867
|
-
|
|
4135
|
+
try {
|
|
4136
|
+
await finalizeToolCallPreparations(
|
|
4137
|
+
preparationTracker,
|
|
4138
|
+
streamFailed || ac.signal.aborted,
|
|
4139
|
+
"background notification"
|
|
4140
|
+
);
|
|
4141
|
+
} finally {
|
|
4142
|
+
await messageDisplay?.finish();
|
|
4143
|
+
}
|
|
3868
4144
|
}
|
|
3869
4145
|
if (responseText.length > 0) {
|
|
3870
4146
|
await this.#emitBackgroundNotificationResponse(
|
|
@@ -4083,7 +4359,17 @@ ${this.pendingWorktreeNotice}
|
|
|
4083
4359
|
if (!rawModelId) {
|
|
4084
4360
|
throw RequestError.invalidParams(void 0, "modelId cannot be empty");
|
|
4085
4361
|
}
|
|
4086
|
-
const
|
|
4362
|
+
const resolvedRoute = resolveAcpModelOption(
|
|
4363
|
+
rawModelId,
|
|
4364
|
+
this.config.getAllConfiguredModels()
|
|
4365
|
+
);
|
|
4366
|
+
if (!resolvedRoute && rawModelId.startsWith(ACP_ROUTE_ID_PREFIX)) {
|
|
4367
|
+
throw RequestError.invalidParams(
|
|
4368
|
+
void 0,
|
|
4369
|
+
`Unknown or stale model route: "${rawModelId}"`
|
|
4370
|
+
);
|
|
4371
|
+
}
|
|
4372
|
+
const parsed = resolvedRoute ?? parseAcpModelOption(rawModelId);
|
|
4087
4373
|
const previousAuthType = this.config.getAuthType?.();
|
|
4088
4374
|
const selectedAuthType = parsed.authType ?? previousAuthType;
|
|
4089
4375
|
if (!selectedAuthType) {
|
|
@@ -4092,29 +4378,49 @@ ${this.pendingWorktreeNotice}
|
|
|
4092
4378
|
`authType cannot be determined for modelId "${parsed.modelId}"`
|
|
4093
4379
|
);
|
|
4094
4380
|
}
|
|
4381
|
+
const requireCachedCredentials = selectedAuthType !== previousAuthType && selectedAuthType === "qwen-oauth" /* QWEN_OAUTH */;
|
|
4382
|
+
const switchOptions = resolvedRoute?.baseUrl !== void 0 || requireCachedCredentials ? {
|
|
4383
|
+
...resolvedRoute?.baseUrl !== void 0 ? { baseUrl: resolvedRoute.baseUrl } : {},
|
|
4384
|
+
...requireCachedCredentials ? { requireCachedCredentials: true } : {}
|
|
4385
|
+
} : void 0;
|
|
4095
4386
|
await this.config.switchModel(
|
|
4096
4387
|
selectedAuthType,
|
|
4097
4388
|
parsed.modelId,
|
|
4098
|
-
|
|
4389
|
+
switchOptions
|
|
4099
4390
|
);
|
|
4100
4391
|
const after = this.config.getContentGeneratorConfig?.();
|
|
4101
4392
|
const effectiveAuthType = after?.authType ?? selectedAuthType;
|
|
4102
4393
|
const effectiveModelId = after?.model ?? parsed.modelId;
|
|
4394
|
+
const activeRuntimeSnapshot = this.config.getActiveRuntimeModelSnapshot?.();
|
|
4395
|
+
const currentAcpModelId = getCurrentAcpModelId(
|
|
4396
|
+
buildAcpModelOptions(this.config.getAllConfiguredModels()),
|
|
4397
|
+
activeRuntimeSnapshot?.id ?? effectiveModelId,
|
|
4398
|
+
activeRuntimeSnapshot?.authType ?? effectiveAuthType,
|
|
4399
|
+
activeRuntimeSnapshot ? void 0 : resolvedRoute ? resolvedRoute.registryBaseUrl : this.config.getCurrentModelRegistryBaseUrl?.()
|
|
4400
|
+
);
|
|
4103
4401
|
void this.client.extNotification("qwen/notify/session/model-update", {
|
|
4104
4402
|
v: 1,
|
|
4105
4403
|
sessionId: this.sessionId,
|
|
4106
|
-
currentModelId:
|
|
4404
|
+
currentModelId: currentAcpModelId
|
|
4107
4405
|
}).catch((error) => {
|
|
4108
4406
|
debugLogger6.debug("model-update extNotification failed", error);
|
|
4109
4407
|
});
|
|
4110
4408
|
if (options.persistDefault ?? true) {
|
|
4111
4409
|
const persistScope = getPersistScopeForModelSelection(this.settings);
|
|
4112
|
-
this.settings.setValue(
|
|
4113
|
-
|
|
4410
|
+
this.settings.setValue(
|
|
4411
|
+
persistScope,
|
|
4412
|
+
"model.name",
|
|
4413
|
+
resolvedRoute?.isRuntime ? resolvedRoute.modelId : effectiveModelId
|
|
4414
|
+
);
|
|
4415
|
+
this.settings.setValue(
|
|
4416
|
+
persistScope,
|
|
4417
|
+
"model.baseUrl",
|
|
4418
|
+
resolvedRoute && !resolvedRoute.isRuntime ? resolvedRoute.baseUrl ?? "" : ""
|
|
4419
|
+
);
|
|
4114
4420
|
this.settings.setValue(
|
|
4115
4421
|
persistScope,
|
|
4116
4422
|
"security.auth.selectedType",
|
|
4117
|
-
|
|
4423
|
+
effectiveAuthType
|
|
4118
4424
|
);
|
|
4119
4425
|
}
|
|
4120
4426
|
return {
|
|
@@ -4124,7 +4430,7 @@ ${this.pendingWorktreeNotice}
|
|
|
4124
4430
|
modelId: effectiveModelId,
|
|
4125
4431
|
baseUrl: after?.baseUrl ?? "(default)",
|
|
4126
4432
|
apiKey: maskApiKeyForDisplay(after?.apiKey),
|
|
4127
|
-
isRuntime: rawModelId.startsWith("$runtime|")
|
|
4433
|
+
isRuntime: resolvedRoute?.isRuntime ?? rawModelId.startsWith("$runtime|")
|
|
4128
4434
|
}
|
|
4129
4435
|
}
|
|
4130
4436
|
};
|
|
@@ -4133,33 +4439,29 @@ ${this.pendingWorktreeNotice}
|
|
|
4133
4439
|
* Sends a current_mode_update notification to the client.
|
|
4134
4440
|
* Called after the agent switches modes (e.g., from exit_plan_mode tool).
|
|
4135
4441
|
*/
|
|
4136
|
-
async sendCurrentModeUpdateNotification(
|
|
4137
|
-
|
|
4138
|
-
switch (outcome) {
|
|
4139
|
-
case "proceed_always" /* ProceedAlways */:
|
|
4140
|
-
newModeId = "auto-edit";
|
|
4141
|
-
break;
|
|
4142
|
-
case "restore_previous" /* RestorePrevious */:
|
|
4143
|
-
newModeId = this.config.getApprovalMode();
|
|
4144
|
-
break;
|
|
4145
|
-
case "proceed_once" /* ProceedOnce */:
|
|
4146
|
-
default:
|
|
4147
|
-
newModeId = "default";
|
|
4148
|
-
break;
|
|
4149
|
-
}
|
|
4442
|
+
async sendCurrentModeUpdateNotification() {
|
|
4443
|
+
const newModeId = this.config.getApprovalMode();
|
|
4150
4444
|
const update = {
|
|
4151
4445
|
sessionUpdate: "current_mode_update",
|
|
4152
4446
|
currentModeId: newModeId
|
|
4153
4447
|
};
|
|
4154
|
-
|
|
4155
|
-
|
|
4156
|
-
|
|
4157
|
-
|
|
4158
|
-
|
|
4159
|
-
|
|
4160
|
-
}
|
|
4448
|
+
let legacyFrameSent = false;
|
|
4449
|
+
try {
|
|
4450
|
+
await this.sendUpdate(update);
|
|
4451
|
+
legacyFrameSent = true;
|
|
4452
|
+
} catch (error) {
|
|
4453
|
+
debugLogger6.debug("current_mode_update notification failed", error);
|
|
4454
|
+
}
|
|
4455
|
+
try {
|
|
4456
|
+
await this.client.extNotification("qwen/notify/session/mode-update", {
|
|
4457
|
+
v: 1,
|
|
4458
|
+
sessionId: this.sessionId,
|
|
4459
|
+
currentModeId: newModeId,
|
|
4460
|
+
legacyFrameSent
|
|
4461
|
+
});
|
|
4462
|
+
} catch (error) {
|
|
4161
4463
|
debugLogger6.debug("mode-update extNotification failed", error);
|
|
4162
|
-
}
|
|
4464
|
+
}
|
|
4163
4465
|
}
|
|
4164
4466
|
/**
|
|
4165
4467
|
* Execute a batch of model-returned tool calls, running Agent calls
|
|
@@ -4767,7 +5069,13 @@ ${this.pendingWorktreeNotice}
|
|
|
4767
5069
|
toolName,
|
|
4768
5070
|
toolParams
|
|
4769
5071
|
);
|
|
4770
|
-
const {
|
|
5072
|
+
const {
|
|
5073
|
+
finalPermission,
|
|
5074
|
+
pmForcedAsk,
|
|
5075
|
+
pmCtx,
|
|
5076
|
+
denyMessage,
|
|
5077
|
+
requiresUserInteraction
|
|
5078
|
+
} = flowResult;
|
|
4771
5079
|
const isPlanMode = approvalMode === "plan" /* PLAN */;
|
|
4772
5080
|
if (finalPermission === "deny") {
|
|
4773
5081
|
return earlyErrorResponse(
|
|
@@ -4792,7 +5100,7 @@ ${this.pendingWorktreeNotice}
|
|
|
4792
5100
|
);
|
|
4793
5101
|
}
|
|
4794
5102
|
let wasAutoModeDenialFallback = false;
|
|
4795
|
-
if (!autoModeAllowed && shouldRunAutoModeForCall(approvalMode, toolName)) {
|
|
5103
|
+
if (!autoModeAllowed && !requiresUserInteraction && shouldRunAutoModeForCall(approvalMode, toolName)) {
|
|
4796
5104
|
const denialState = this.config.getAutoModeDenialState();
|
|
4797
5105
|
const fallback = shouldFallback(denialState);
|
|
4798
5106
|
const messages = this.config.getGeminiClient?.()?.getHistoryTail(MAX_TRANSCRIPT_MESSAGES, false) ?? [];
|
|
@@ -4865,7 +5173,12 @@ ${this.pendingWorktreeNotice}
|
|
|
4865
5173
|
this.config.setAutoModeDenialState(after);
|
|
4866
5174
|
}
|
|
4867
5175
|
}, "recordAutoModeFallbackResolution");
|
|
4868
|
-
if (!autoModeAllowed && needsConfirmation(
|
|
5176
|
+
if (!autoModeAllowed && needsConfirmation(
|
|
5177
|
+
confirmationPermission,
|
|
5178
|
+
approvalMode,
|
|
5179
|
+
toolName,
|
|
5180
|
+
requiresUserInteraction
|
|
5181
|
+
)) {
|
|
4869
5182
|
confirmationDetails = await invocation.getConfirmationDetails(abortSignal);
|
|
4870
5183
|
injectPermissionRulesIfMissing(confirmationDetails, pmCtx);
|
|
4871
5184
|
if (isPlanModeBlocked(
|
|
@@ -4892,7 +5205,7 @@ ${this.pendingWorktreeNotice}
|
|
|
4892
5205
|
args,
|
|
4893
5206
|
String(approvalMode)
|
|
4894
5207
|
);
|
|
4895
|
-
if (hookResult.hasDecision) {
|
|
5208
|
+
if (hookResult.hasDecision && (!hookResult.shouldAllow || !requiresUserInteraction)) {
|
|
4896
5209
|
hookHandled = true;
|
|
4897
5210
|
if (hookResult.shouldAllow) {
|
|
4898
5211
|
if (hookResult.updatedInput) {
|
|
@@ -4915,7 +5228,7 @@ ${this.pendingWorktreeNotice}
|
|
|
4915
5228
|
}
|
|
4916
5229
|
}
|
|
4917
5230
|
}
|
|
4918
|
-
if (approvalMode === "auto-edit" /* AUTO_EDIT */ && (confirmationDetails.type === "edit" || confirmationDetails.type === "info")) {
|
|
5231
|
+
if (!requiresUserInteraction && approvalMode === "auto-edit" /* AUTO_EDIT */ && (confirmationDetails.type === "edit" || confirmationDetails.type === "info")) {
|
|
4919
5232
|
} else if (!hookHandled) {
|
|
4920
5233
|
didRequestPermission = true;
|
|
4921
5234
|
const content = buildPermissionRequestContent(confirmationDetails);
|
|
@@ -4983,12 +5296,11 @@ ${this.pendingWorktreeNotice}
|
|
|
4983
5296
|
);
|
|
4984
5297
|
}
|
|
4985
5298
|
onStopAfterPermissionCancel?.();
|
|
5299
|
+
const permissionFailureMessage = isExitPlanModeTool ? "The host could not present plan-exit approval. Plan mode remains active; use the host mode selector or /plan exit to leave plan mode." : `Permission request failed for "${toolName}": ${this.#formatError(
|
|
5300
|
+
error
|
|
5301
|
+
)}`;
|
|
4986
5302
|
return earlyErrorResponse(
|
|
4987
|
-
new Error(
|
|
4988
|
-
`Permission request failed for "${toolName}": ${this.#formatError(
|
|
4989
|
-
error
|
|
4990
|
-
)}`
|
|
4991
|
-
),
|
|
5303
|
+
new Error(permissionFailureMessage),
|
|
4992
5304
|
toolName,
|
|
4993
5305
|
{ stopAfterPermissionCancel: true }
|
|
4994
5306
|
);
|
|
@@ -5017,11 +5329,8 @@ ${this.pendingWorktreeNotice}
|
|
|
5017
5329
|
{ answers: output.answers }
|
|
5018
5330
|
);
|
|
5019
5331
|
}
|
|
5020
|
-
if (isExitPlanModeTool && outcome !== "cancel" /* Cancel */) {
|
|
5021
|
-
await this.sendCurrentModeUpdateNotification(outcome);
|
|
5022
|
-
}
|
|
5023
5332
|
if (confirmationDetails.type === "edit" && outcome === "proceed_always" /* ProceedAlways */) {
|
|
5024
|
-
await this.sendCurrentModeUpdateNotification(
|
|
5333
|
+
await this.sendCurrentModeUpdateNotification();
|
|
5025
5334
|
}
|
|
5026
5335
|
switch (outcome) {
|
|
5027
5336
|
case "cancel" /* Cancel */:
|
|
@@ -5079,43 +5388,81 @@ ${this.pendingWorktreeNotice}
|
|
|
5079
5388
|
}
|
|
5080
5389
|
const execSpan = startToolExecutionSpan();
|
|
5081
5390
|
let toolResult;
|
|
5391
|
+
let isExecutionTimeout = false;
|
|
5392
|
+
let aborted = false;
|
|
5393
|
+
let toolSettled = false;
|
|
5394
|
+
let heartbeatCount = 0;
|
|
5395
|
+
let lastHeartbeat;
|
|
5396
|
+
const onToolProgress = /* @__PURE__ */ __name((chunk) => {
|
|
5397
|
+
if (toolSettled || !isShellProgressData(chunk)) {
|
|
5398
|
+
return;
|
|
5399
|
+
}
|
|
5400
|
+
heartbeatCount++;
|
|
5401
|
+
lastHeartbeat = chunk;
|
|
5402
|
+
void this.sendUpdate({
|
|
5403
|
+
sessionUpdate: "tool_call_update",
|
|
5404
|
+
toolCallId: callId,
|
|
5405
|
+
status: "in_progress",
|
|
5406
|
+
_meta: { toolName, shellProgress: chunk }
|
|
5407
|
+
}).catch((err) => {
|
|
5408
|
+
debugLogger6.debug(
|
|
5409
|
+
`[Session.runTool] heartbeat update failed for ${callId}: ${err}`
|
|
5410
|
+
);
|
|
5411
|
+
});
|
|
5412
|
+
}, "onToolProgress");
|
|
5413
|
+
const heartbeatSpanAttributes = /* @__PURE__ */ __name(() => heartbeatCount > 0 ? {
|
|
5414
|
+
attributes: {
|
|
5415
|
+
"shell.heartbeat_count": heartbeatCount,
|
|
5416
|
+
...lastHeartbeat?.lastOutputAgeMs !== void 0 && {
|
|
5417
|
+
"shell.last_output_age_ms": lastHeartbeat.lastOutputAgeMs
|
|
5418
|
+
}
|
|
5419
|
+
}
|
|
5420
|
+
} : void 0, "heartbeatSpanAttributes");
|
|
5082
5421
|
try {
|
|
5083
5422
|
const sleepInhibitorHandle = acquireSleepInhibitor(
|
|
5084
5423
|
this.config,
|
|
5085
5424
|
`Qwen Code is executing tool ${toolName}`
|
|
5086
5425
|
);
|
|
5087
5426
|
try {
|
|
5088
|
-
toolResult = await invocation.execute(
|
|
5427
|
+
toolResult = await invocation.execute(
|
|
5428
|
+
activeToolAbortSignal,
|
|
5429
|
+
onToolProgress
|
|
5430
|
+
);
|
|
5089
5431
|
} finally {
|
|
5432
|
+
toolSettled = true;
|
|
5090
5433
|
sleepInhibitorHandle.release();
|
|
5091
5434
|
}
|
|
5092
|
-
|
|
5435
|
+
isExecutionTimeout = toolResult.error?.type === "execution_timeout" /* EXECUTION_TIMEOUT */;
|
|
5436
|
+
aborted = activeToolAbortSignal.aborted && !isExecutionTimeout;
|
|
5093
5437
|
endToolExecutionSpan(execSpan, {
|
|
5094
|
-
success: !toolResult.error && !
|
|
5095
|
-
error:
|
|
5096
|
-
cancelled:
|
|
5438
|
+
success: !toolResult.error && !aborted,
|
|
5439
|
+
error: aborted ? "tool_cancelled" : isExecutionTimeout ? "tool_timeout" : toolResult.error ? "tool_error" : void 0,
|
|
5440
|
+
cancelled: aborted,
|
|
5441
|
+
...heartbeatSpanAttributes()
|
|
5097
5442
|
});
|
|
5098
5443
|
} catch (execError) {
|
|
5099
5444
|
endToolExecutionSpan(execSpan, {
|
|
5100
5445
|
success: false,
|
|
5101
5446
|
error: activeToolAbortSignal.aborted ? "tool_cancelled" : "tool_exception",
|
|
5102
|
-
cancelled: activeToolAbortSignal.aborted
|
|
5447
|
+
cancelled: activeToolAbortSignal.aborted,
|
|
5448
|
+
...heartbeatSpanAttributes()
|
|
5103
5449
|
});
|
|
5104
5450
|
throw execError;
|
|
5105
5451
|
}
|
|
5106
5452
|
cleanupAgentToolResources();
|
|
5107
|
-
if ((isEnterPlanModeTool || isExitPlanModeTool) && !
|
|
5108
|
-
await this.
|
|
5109
|
-
sessionUpdate: "current_mode_update",
|
|
5110
|
-
currentModeId: this.config.getApprovalMode()
|
|
5111
|
-
});
|
|
5453
|
+
if ((isEnterPlanModeTool || isExitPlanModeTool) && !toolResult.error && this.config.getApprovalMode() !== approvalMode) {
|
|
5454
|
+
await this.sendCurrentModeUpdateNotification();
|
|
5112
5455
|
}
|
|
5113
|
-
const responseParts =
|
|
5456
|
+
const responseParts = toolResult.error ? convertToFunctionErrorResponse(
|
|
5457
|
+
toolName,
|
|
5458
|
+
callId,
|
|
5459
|
+
toolResult.llmContent,
|
|
5460
|
+
toolResult.error.message
|
|
5461
|
+
) : convertToFunctionResponse(
|
|
5114
5462
|
toolName,
|
|
5115
5463
|
callId,
|
|
5116
5464
|
toolResult.llmContent
|
|
5117
5465
|
);
|
|
5118
|
-
const aborted = activeToolAbortSignal.aborted;
|
|
5119
5466
|
const status = aborted ? "cancelled" : toolResult.error ? "error" : "success";
|
|
5120
5467
|
const succeeded = status === "success";
|
|
5121
5468
|
const responseError = toolResult.error ? new Error(toolResult.error.message) : aborted ? new Error("Tool execution was cancelled") : void 0;
|
|
@@ -5343,11 +5690,15 @@ ${this.pendingWorktreeNotice}
|
|
|
5343
5690
|
* @param originalPrompt The original prompt blocks
|
|
5344
5691
|
* @returns Parts to use for the prompt, or null if command was handled without needing model interaction
|
|
5345
5692
|
*/
|
|
5346
|
-
async #processSlashCommandResult(result, originalPrompt) {
|
|
5693
|
+
async #processSlashCommandResult(result, originalPrompt, abortSignal, onFullTurnModel) {
|
|
5347
5694
|
this.#emitGoalStatusItems(result);
|
|
5348
5695
|
switch (result.type) {
|
|
5349
5696
|
case "submit_prompt":
|
|
5350
|
-
return
|
|
5697
|
+
return this.#applyBridgeConversionsIfNeeded(
|
|
5698
|
+
normalizePartList(result.content),
|
|
5699
|
+
abortSignal,
|
|
5700
|
+
onFullTurnModel
|
|
5701
|
+
);
|
|
5351
5702
|
case "message": {
|
|
5352
5703
|
if (result.messageType === "error") {
|
|
5353
5704
|
throw new Error(result.content || "Slash command failed.");
|
|
@@ -5390,11 +5741,10 @@ ${this.pendingWorktreeNotice}
|
|
|
5390
5741
|
throw new Error(unsupportedError);
|
|
5391
5742
|
}
|
|
5392
5743
|
case "no_command":
|
|
5393
|
-
return this.#resolvePrompt(
|
|
5394
|
-
|
|
5395
|
-
|
|
5396
|
-
|
|
5397
|
-
);
|
|
5744
|
+
return this.#resolvePrompt(originalPrompt, abortSignal, {
|
|
5745
|
+
promptLast: true,
|
|
5746
|
+
onFullTurnModel
|
|
5747
|
+
});
|
|
5398
5748
|
default: {
|
|
5399
5749
|
const _exhaustive = result;
|
|
5400
5750
|
const unknownError = `Unknown slash command result type: ${_exhaustive.type}`;
|
|
@@ -5468,12 +5818,17 @@ ${this.pendingWorktreeNotice}
|
|
|
5468
5818
|
);
|
|
5469
5819
|
const mcpServerParts = this.#resolveMcpServerMentionParts(mcpServerMentions);
|
|
5470
5820
|
if (atPathCommandParts.length === 0 && embeddedContext.length === 0 && extensionParts.length === 0 && mcpServerParts.length === 0) {
|
|
5471
|
-
return this.#applyBridgeConversionsIfNeeded(
|
|
5821
|
+
return this.#applyBridgeConversionsIfNeeded(
|
|
5822
|
+
parts,
|
|
5823
|
+
abortSignal,
|
|
5824
|
+
options.onFullTurnModel
|
|
5825
|
+
);
|
|
5472
5826
|
}
|
|
5473
5827
|
if (atPathCommandParts.length === 0 && embeddedContext.length === 0) {
|
|
5474
5828
|
return this.#applyBridgeConversionsIfNeeded(
|
|
5475
5829
|
[...parts, ...extensionParts, ...mcpServerParts],
|
|
5476
|
-
abortSignal
|
|
5830
|
+
abortSignal,
|
|
5831
|
+
options.onFullTurnModel
|
|
5477
5832
|
);
|
|
5478
5833
|
}
|
|
5479
5834
|
const pathSpecsToRead = atPathCommandParts.map(
|
|
@@ -5534,10 +5889,11 @@ ${contextPart.text}`
|
|
|
5534
5889
|
const processedQueryParts = options.promptLast ? [...referenceParts, promptPart] : [promptPart, ...referenceParts];
|
|
5535
5890
|
return this.#applyBridgeConversionsIfNeeded(
|
|
5536
5891
|
processedQueryParts,
|
|
5537
|
-
abortSignal
|
|
5892
|
+
abortSignal,
|
|
5893
|
+
options.onFullTurnModel
|
|
5538
5894
|
);
|
|
5539
5895
|
}
|
|
5540
|
-
async #applyBridgeConversionsIfNeeded(originalParts, abortSignal) {
|
|
5896
|
+
async #applyBridgeConversionsIfNeeded(originalParts, abortSignal, onFullTurnModel) {
|
|
5541
5897
|
const parts = await this.#applyVoiceBridgeIfNeeded(
|
|
5542
5898
|
originalParts,
|
|
5543
5899
|
abortSignal
|
|
@@ -5545,6 +5901,28 @@ ${contextPart.text}`
|
|
|
5545
5901
|
if (!hasImageParts(parts) || !shouldRunVisionBridge(this.config)) {
|
|
5546
5902
|
return parts;
|
|
5547
5903
|
}
|
|
5904
|
+
const fullTurnModel = this.config.getDefaultVisionBridgeModel();
|
|
5905
|
+
if (onFullTurnModel && fullTurnModel?.agentCapable) {
|
|
5906
|
+
const fullTurnParts = parts.map((part) => clampInlineMediaPart(part));
|
|
5907
|
+
if (!hasImageParts(fullTurnParts)) {
|
|
5908
|
+
return fullTurnParts;
|
|
5909
|
+
}
|
|
5910
|
+
const selected = onFullTurnModel(
|
|
5911
|
+
getFullTurnVisionModelSelector(fullTurnModel)
|
|
5912
|
+
);
|
|
5913
|
+
if (selected) {
|
|
5914
|
+
try {
|
|
5915
|
+
await this.messageEmitter.emitAgentMessage(
|
|
5916
|
+
formatFullTurnVisionNotice(fullTurnModel)
|
|
5917
|
+
);
|
|
5918
|
+
} catch (error) {
|
|
5919
|
+
debugLogger6.debug(
|
|
5920
|
+
`full-turn vision: failed to emit notice; continuing error=${error instanceof Error ? error.message : String(error)}`
|
|
5921
|
+
);
|
|
5922
|
+
}
|
|
5923
|
+
}
|
|
5924
|
+
return fullTurnParts;
|
|
5925
|
+
}
|
|
5548
5926
|
let bridgeResult;
|
|
5549
5927
|
try {
|
|
5550
5928
|
debugLogger6.debug("vision bridge: gate matched, running conversion");
|
|
@@ -5565,7 +5943,7 @@ ${contextPart.text}`
|
|
|
5565
5943
|
if (bridgeResult.status !== "skipped" || bridgeResult.egressOccurred) {
|
|
5566
5944
|
try {
|
|
5567
5945
|
await this.messageEmitter.emitAgentMessage(
|
|
5568
|
-
|
|
5946
|
+
formatVisionBridgeNotice(bridgeResult)
|
|
5569
5947
|
);
|
|
5570
5948
|
} catch (error) {
|
|
5571
5949
|
debugLogger6.debug(
|
|
@@ -5674,20 +6052,6 @@ ${contextPart.text}`
|
|
|
5674
6052
|
#formatVoiceBridgeEgressNotice(modelId, audioCount) {
|
|
5675
6053
|
return `Sent ${audioCount} audio file(s) to ${modelId} for transcription, but no transcript was produced.`;
|
|
5676
6054
|
}
|
|
5677
|
-
#formatVisionBridgeNotice(result) {
|
|
5678
|
-
const modelName = result.modelId ?? "vision model";
|
|
5679
|
-
const target = result.modelEndpoint ? `${modelName} (${result.modelEndpoint})` : modelName;
|
|
5680
|
-
const egressNote = result.egressOccurred ? ` Your image and prompt/context were sent to ${target}.` : "";
|
|
5681
|
-
if (result.status === "failed") {
|
|
5682
|
-
const reason = result.egressOccurred ? "the vision model request failed" : "the vision bridge could not run";
|
|
5683
|
-
return `Vision bridge (${modelName}) failed: ${reason}.${egressNote} The image was not interpreted.`;
|
|
5684
|
-
}
|
|
5685
|
-
if (result.status === "skipped") {
|
|
5686
|
-
return `Vision bridge cancelled.${egressNote}`;
|
|
5687
|
-
}
|
|
5688
|
-
const omitted = result.omittedCount > 0 ? ` (${result.omittedCount} image(s) omitted)` : "";
|
|
5689
|
-
return `Converted ${result.convertedCount} image(s)${omitted} to text via ${target}. Your image and prompt/context were sent to that model.`;
|
|
5690
|
-
}
|
|
5691
6055
|
async #resolveExtensionMentionParts(extensionMentions, abortSignal) {
|
|
5692
6056
|
if (extensionMentions.size === 0) return [];
|
|
5693
6057
|
const activeExtensions = this.config.getActiveExtensions?.() ?? [];
|
|
@@ -5896,7 +6260,58 @@ var debugLogger7 = createDebugLogger("ACP_AGENT");
|
|
|
5896
6260
|
var QWEN_ACP_LOCAL_READ_ROOTS_ENV = "QWEN_ACP_LOCAL_READ_ROOTS";
|
|
5897
6261
|
var POSIX_TMP_LOCAL_READ_ROOT = "/tmp";
|
|
5898
6262
|
var BTW_CHILD_TIMEOUT_MS = 55e3;
|
|
6263
|
+
var MCP_OAUTH_START_TIMEOUT_MS = 3e4;
|
|
5899
6264
|
var WORKSPACE_MEMORY_REMEMBER_CHILD_TIMEOUT_MS = 295e3;
|
|
6265
|
+
function createAcpSessionStartProfiler(span) {
|
|
6266
|
+
let failedStage;
|
|
6267
|
+
const setAttribute = /* @__PURE__ */ __name((name, value) => {
|
|
6268
|
+
try {
|
|
6269
|
+
span?.setAttribute(name, value);
|
|
6270
|
+
} catch {
|
|
6271
|
+
}
|
|
6272
|
+
}, "setAttribute");
|
|
6273
|
+
const recordStage = /* @__PURE__ */ __name((stage, start) => {
|
|
6274
|
+
const durationMs = Math.round((performance.now() - start) * 100) / 100;
|
|
6275
|
+
if (Number.isFinite(durationMs) && durationMs >= 0) {
|
|
6276
|
+
setAttribute(`qwen-code.daemon.session_start.${stage}_ms`, durationMs);
|
|
6277
|
+
}
|
|
6278
|
+
}, "recordStage");
|
|
6279
|
+
const recordFailure = /* @__PURE__ */ __name((stage) => {
|
|
6280
|
+
if (failedStage !== void 0) return;
|
|
6281
|
+
failedStage = stage;
|
|
6282
|
+
setAttribute("qwen-code.daemon.session_start.failed_stage", stage);
|
|
6283
|
+
}, "recordFailure");
|
|
6284
|
+
return {
|
|
6285
|
+
async time(stage, fn) {
|
|
6286
|
+
if (!span) return await fn();
|
|
6287
|
+
const start = performance.now();
|
|
6288
|
+
try {
|
|
6289
|
+
return await fn();
|
|
6290
|
+
} catch (error) {
|
|
6291
|
+
recordFailure(stage);
|
|
6292
|
+
throw error;
|
|
6293
|
+
} finally {
|
|
6294
|
+
recordStage(stage, start);
|
|
6295
|
+
}
|
|
6296
|
+
},
|
|
6297
|
+
timeSync(stage, fn) {
|
|
6298
|
+
if (!span) return fn();
|
|
6299
|
+
const start = performance.now();
|
|
6300
|
+
try {
|
|
6301
|
+
return fn();
|
|
6302
|
+
} catch (error) {
|
|
6303
|
+
recordFailure(stage);
|
|
6304
|
+
throw error;
|
|
6305
|
+
} finally {
|
|
6306
|
+
recordStage(stage, start);
|
|
6307
|
+
}
|
|
6308
|
+
},
|
|
6309
|
+
setSessionId(sessionId) {
|
|
6310
|
+
setAttribute("session.id", sessionId);
|
|
6311
|
+
}
|
|
6312
|
+
};
|
|
6313
|
+
}
|
|
6314
|
+
__name(createAcpSessionStartProfiler, "createAcpSessionStartProfiler");
|
|
5900
6315
|
function workspaceMemoryErrorData(code, diagnostics) {
|
|
5901
6316
|
return {
|
|
5902
6317
|
errorKind: code,
|
|
@@ -5977,14 +6392,48 @@ function isBulkLoadReplayRequest(params) {
|
|
|
5977
6392
|
return meta?.[LOAD_REPLAY_MODE_META_KEY] === LOAD_REPLAY_BULK_MODE;
|
|
5978
6393
|
}
|
|
5979
6394
|
__name(isBulkLoadReplayRequest, "isBulkLoadReplayRequest");
|
|
5980
|
-
function
|
|
5981
|
-
|
|
5982
|
-
|
|
5983
|
-
|
|
5984
|
-
|
|
5985
|
-
|
|
5986
|
-
|
|
5987
|
-
|
|
6395
|
+
function getLoadReplayPageSize(params) {
|
|
6396
|
+
const meta = isObjectRecord(params._meta) ? params._meta : void 0;
|
|
6397
|
+
const value = meta?.[LOAD_REPLAY_PAGE_SIZE_META_KEY];
|
|
6398
|
+
if (value === void 0) return void 0;
|
|
6399
|
+
if (!Number.isSafeInteger(value) || value < 1 || value > SESSION_TRANSCRIPT_MAX_LIMIT) {
|
|
6400
|
+
throw RequestError.invalidParams(
|
|
6401
|
+
void 0,
|
|
6402
|
+
`Invalid load replay page size; expected 1..${SESSION_TRANSCRIPT_MAX_LIMIT}`
|
|
6403
|
+
);
|
|
6404
|
+
}
|
|
6405
|
+
return value;
|
|
6406
|
+
}
|
|
6407
|
+
__name(getLoadReplayPageSize, "getLoadReplayPageSize");
|
|
6408
|
+
function isHistoryTurnStart(record) {
|
|
6409
|
+
return record.type === "user" && record.subtype !== "mid_turn_user_message";
|
|
6410
|
+
}
|
|
6411
|
+
__name(isHistoryTurnStart, "isHistoryTurnStart");
|
|
6412
|
+
function selectRecentHistoryRecords(records, pageSize) {
|
|
6413
|
+
if (pageSize === void 0 || records.length <= pageSize) {
|
|
6414
|
+
return { records, hasMore: false };
|
|
6415
|
+
}
|
|
6416
|
+
let start = records.length - pageSize;
|
|
6417
|
+
for (let i = start; i < records.length; i++) {
|
|
6418
|
+
if (isHistoryTurnStart(records[i])) {
|
|
6419
|
+
start = i;
|
|
6420
|
+
break;
|
|
6421
|
+
}
|
|
6422
|
+
}
|
|
6423
|
+
while (start > 0 && !isHistoryTurnStart(records[start])) {
|
|
6424
|
+
start--;
|
|
6425
|
+
}
|
|
6426
|
+
return { records: records.slice(start), hasMore: start > 0 };
|
|
6427
|
+
}
|
|
6428
|
+
__name(selectRecentHistoryRecords, "selectRecentHistoryRecords");
|
|
6429
|
+
function createHiddenWorkspaceMemoryConfig(config) {
|
|
6430
|
+
return new Proxy(config, {
|
|
6431
|
+
get(target, prop) {
|
|
6432
|
+
if (prop === "getChatRecordingService") {
|
|
6433
|
+
return () => void 0;
|
|
6434
|
+
}
|
|
6435
|
+
if (prop === "getTranscriptPath") {
|
|
6436
|
+
return () => "";
|
|
5988
6437
|
}
|
|
5989
6438
|
const value = Reflect.get(target, prop, target);
|
|
5990
6439
|
return typeof value === "function" ? value.bind(target) : value;
|
|
@@ -6034,6 +6483,10 @@ var QWEN_CORE_SETTING_DEFINITIONS = {
|
|
|
6034
6483
|
"general.showSessionRecap": { type: "boolean" },
|
|
6035
6484
|
"general.sessionRecapAwayThresholdMinutes": { type: "number", min: 1 },
|
|
6036
6485
|
"general.terminalBell": { type: "boolean" },
|
|
6486
|
+
"general.notificationMode": {
|
|
6487
|
+
type: "enum",
|
|
6488
|
+
values: ["all", "task-complete"]
|
|
6489
|
+
},
|
|
6037
6490
|
"general.gitCoAuthor.commit": { type: "boolean" },
|
|
6038
6491
|
"general.gitCoAuthor.pr": { type: "boolean" },
|
|
6039
6492
|
"general.defaultFileEncoding": {
|
|
@@ -6058,7 +6511,7 @@ var QWEN_HOOK_EVENTS = Object.values(HookEventName);
|
|
|
6058
6511
|
var DEFAULT_QWEN_MEMORY_SETTINGS = {
|
|
6059
6512
|
enableManagedAutoMemory: true,
|
|
6060
6513
|
enableManagedAutoDream: true,
|
|
6061
|
-
enableAutoSkill:
|
|
6514
|
+
enableAutoSkill: false,
|
|
6062
6515
|
autoSkillConfirm: true,
|
|
6063
6516
|
enableTeamMemory: false,
|
|
6064
6517
|
enableTeamMemorySync: false
|
|
@@ -7137,42 +7590,6 @@ function toMcpServerConfig(value) {
|
|
|
7137
7590
|
return void 0;
|
|
7138
7591
|
}
|
|
7139
7592
|
__name(toMcpServerConfig, "toMcpServerConfig");
|
|
7140
|
-
var REDACTED_MCP_SECRET = "__redacted__";
|
|
7141
|
-
function redactMcpServerSecrets(server) {
|
|
7142
|
-
const redactValues = /* @__PURE__ */ __name((record) => record ? Object.fromEntries(
|
|
7143
|
-
Object.keys(record).map((key) => [key, REDACTED_MCP_SECRET])
|
|
7144
|
-
) : record, "redactValues");
|
|
7145
|
-
return {
|
|
7146
|
-
...server,
|
|
7147
|
-
env: redactValues(server.env),
|
|
7148
|
-
headers: redactValues(server.headers)
|
|
7149
|
-
};
|
|
7150
|
-
}
|
|
7151
|
-
__name(redactMcpServerSecrets, "redactMcpServerSecrets");
|
|
7152
|
-
function restoreRedactedMcpSecrets(server, existing) {
|
|
7153
|
-
const restore = /* @__PURE__ */ __name((incoming, prior) => {
|
|
7154
|
-
if (!incoming) return incoming;
|
|
7155
|
-
const priorRecord = toRecord(prior);
|
|
7156
|
-
const result = {};
|
|
7157
|
-
for (const [key, value] of Object.entries(incoming)) {
|
|
7158
|
-
if (value !== REDACTED_MCP_SECRET) {
|
|
7159
|
-
result[key] = value;
|
|
7160
|
-
continue;
|
|
7161
|
-
}
|
|
7162
|
-
const priorValue = priorRecord[key];
|
|
7163
|
-
if (typeof priorValue === "string") {
|
|
7164
|
-
result[key] = priorValue;
|
|
7165
|
-
}
|
|
7166
|
-
}
|
|
7167
|
-
return result;
|
|
7168
|
-
}, "restore");
|
|
7169
|
-
return {
|
|
7170
|
-
...server,
|
|
7171
|
-
env: restore(server.env, existing["env"]),
|
|
7172
|
-
headers: restore(server.headers, existing["headers"])
|
|
7173
|
-
};
|
|
7174
|
-
}
|
|
7175
|
-
__name(restoreRedactedMcpSecrets, "restoreRedactedMcpSecrets");
|
|
7176
7593
|
function redactSecretRecord(record) {
|
|
7177
7594
|
return record ? Object.fromEntries(
|
|
7178
7595
|
Object.keys(record).map((key) => [key, REDACTED_MCP_SECRET])
|
|
@@ -7664,6 +8081,12 @@ var QwenAgent = class {
|
|
|
7664
8081
|
__name(this, "QwenAgent");
|
|
7665
8082
|
}
|
|
7666
8083
|
sessions = /* @__PURE__ */ new Map();
|
|
8084
|
+
workspaceMcpDiscoveryConfig;
|
|
8085
|
+
workspaceMcpDiscoveryPromise;
|
|
8086
|
+
workspaceMcpDiscoveryError;
|
|
8087
|
+
pendingMcpAuthentications = /* @__PURE__ */ new Map();
|
|
8088
|
+
mcpAuthenticationResults = /* @__PURE__ */ new Map();
|
|
8089
|
+
generationControllers = /* @__PURE__ */ new Map();
|
|
7667
8090
|
transcriptReplayConfigCache = /* @__PURE__ */ new Map();
|
|
7668
8091
|
clientCapabilities;
|
|
7669
8092
|
// CPU-usage delta baseline for the daemon's `workspaceResource` extMethod
|
|
@@ -7697,6 +8120,178 @@ var QwenAgent = class {
|
|
|
7697
8120
|
getActiveSessions() {
|
|
7698
8121
|
return [...this.sessions.values()];
|
|
7699
8122
|
}
|
|
8123
|
+
getWorkspaceMcpConfig(serverName) {
|
|
8124
|
+
if (serverName && this.config.getRuntimeMcpServers?.()[serverName] !== void 0) {
|
|
8125
|
+
return this.config;
|
|
8126
|
+
}
|
|
8127
|
+
return this.workspaceMcpDiscoveryConfig ?? this.config;
|
|
8128
|
+
}
|
|
8129
|
+
getLiveMcpConfigs(serverName) {
|
|
8130
|
+
return [
|
|
8131
|
+
.../* @__PURE__ */ new Set([
|
|
8132
|
+
this.getWorkspaceMcpConfig(serverName),
|
|
8133
|
+
this.config,
|
|
8134
|
+
...this.getActiveSessions().map((session) => session.getConfig())
|
|
8135
|
+
])
|
|
8136
|
+
].filter((config) => Boolean(config.getMcpServers()?.[serverName]));
|
|
8137
|
+
}
|
|
8138
|
+
async reconcileMcpServerAcrossLiveConfigs(serverName, operation) {
|
|
8139
|
+
const errors = [];
|
|
8140
|
+
for (const config of this.getLiveMcpConfigs(serverName)) {
|
|
8141
|
+
try {
|
|
8142
|
+
const registry = config.getToolRegistry();
|
|
8143
|
+
if (operation === "discover") {
|
|
8144
|
+
await registry?.discoverToolsForServer(serverName);
|
|
8145
|
+
const geminiClient = config.getGeminiClient?.();
|
|
8146
|
+
if (geminiClient?.isInitialized?.()) {
|
|
8147
|
+
await geminiClient.setTools?.();
|
|
8148
|
+
}
|
|
8149
|
+
} else if (operation === "disable") {
|
|
8150
|
+
await registry?.disableMcpServer(serverName);
|
|
8151
|
+
} else {
|
|
8152
|
+
await registry?.disconnectServer(serverName);
|
|
8153
|
+
}
|
|
8154
|
+
} catch (error) {
|
|
8155
|
+
errors.push(error);
|
|
8156
|
+
}
|
|
8157
|
+
}
|
|
8158
|
+
if (errors.length > 0) {
|
|
8159
|
+
const details = errors.map(
|
|
8160
|
+
(error) => error instanceof Error ? error.message : String(error)
|
|
8161
|
+
).join("; ");
|
|
8162
|
+
throw new AggregateError(
|
|
8163
|
+
errors,
|
|
8164
|
+
`Failed to synchronize MCP server ${JSON.stringify(serverName)}: ${details}`
|
|
8165
|
+
);
|
|
8166
|
+
}
|
|
8167
|
+
}
|
|
8168
|
+
getMcpServerStatus(config, serverName) {
|
|
8169
|
+
const manager = config.getToolRegistry()?.getMcpClientManager();
|
|
8170
|
+
return manager?.getServerStatus?.(serverName) ?? getMCPServerStatus(serverName);
|
|
8171
|
+
}
|
|
8172
|
+
enqueueWorkspaceMcpDiscovery(label, run) {
|
|
8173
|
+
const previous = this.workspaceMcpDiscoveryPromise ?? Promise.resolve();
|
|
8174
|
+
const tracked = previous.then(async () => {
|
|
8175
|
+
this.workspaceMcpDiscoveryError = void 0;
|
|
8176
|
+
await run();
|
|
8177
|
+
}).catch((err) => {
|
|
8178
|
+
this.workspaceMcpDiscoveryError = err instanceof Error ? err.message : String(err);
|
|
8179
|
+
debugLogger7.error(
|
|
8180
|
+
`Workspace MCP ${label} failed: ${err instanceof Error ? err.message : String(err)}`
|
|
8181
|
+
);
|
|
8182
|
+
}).finally(() => {
|
|
8183
|
+
if (this.workspaceMcpDiscoveryPromise === tracked) {
|
|
8184
|
+
this.workspaceMcpDiscoveryPromise = void 0;
|
|
8185
|
+
}
|
|
8186
|
+
});
|
|
8187
|
+
this.workspaceMcpDiscoveryPromise = tracked;
|
|
8188
|
+
return { accepted: true };
|
|
8189
|
+
}
|
|
8190
|
+
async createWorkspaceMcpDiscoveryConfig(settings) {
|
|
8191
|
+
if (this.workspaceMcpDiscoveryConfig) return;
|
|
8192
|
+
const cwd = this.config.getTargetDir();
|
|
8193
|
+
const config = await loadCliConfig(
|
|
8194
|
+
settings.merged,
|
|
8195
|
+
{
|
|
8196
|
+
...this.argv,
|
|
8197
|
+
sessionId: "workspace-mcp-discovery",
|
|
8198
|
+
resume: void 0,
|
|
8199
|
+
continue: false
|
|
8200
|
+
},
|
|
8201
|
+
cwd,
|
|
8202
|
+
void 0,
|
|
8203
|
+
{
|
|
8204
|
+
userHooks: settings.getUserHooks(),
|
|
8205
|
+
projectHooks: settings.getProjectHooks()
|
|
8206
|
+
},
|
|
8207
|
+
buildDisabledSkillNamesProvider(settings)
|
|
8208
|
+
);
|
|
8209
|
+
config.setMcpTransportPool(this.mcpPool);
|
|
8210
|
+
try {
|
|
8211
|
+
await config.initialize({
|
|
8212
|
+
skipGeminiInitialization: true,
|
|
8213
|
+
skipFileCheckpointing: true,
|
|
8214
|
+
skipHooks: true,
|
|
8215
|
+
skipSkillManager: true,
|
|
8216
|
+
skipMcpDiscovery: true,
|
|
8217
|
+
lenientToolWarmup: true
|
|
8218
|
+
});
|
|
8219
|
+
const manager = config.getToolRegistry()?.getMcpClientManager();
|
|
8220
|
+
if (!manager) {
|
|
8221
|
+
throw new Error("MCP client manager is unavailable");
|
|
8222
|
+
}
|
|
8223
|
+
await manager.discoverAllMcpToolsIncremental(config);
|
|
8224
|
+
if (manager.getDiscoveryState() === "not_started" /* NOT_STARTED */) {
|
|
8225
|
+
throw new Error(
|
|
8226
|
+
"MCP discovery did not start. The workspace may not be trusted."
|
|
8227
|
+
);
|
|
8228
|
+
}
|
|
8229
|
+
this.workspaceMcpDiscoveryConfig = config;
|
|
8230
|
+
} catch (error) {
|
|
8231
|
+
try {
|
|
8232
|
+
await config.getToolRegistry()?.stop();
|
|
8233
|
+
} catch {
|
|
8234
|
+
}
|
|
8235
|
+
throw error;
|
|
8236
|
+
}
|
|
8237
|
+
}
|
|
8238
|
+
initializeWorkspaceMcpDiscovery() {
|
|
8239
|
+
if (this.workspaceMcpDiscoveryConfig || this.workspaceMcpDiscoveryPromise) {
|
|
8240
|
+
return { accepted: false };
|
|
8241
|
+
}
|
|
8242
|
+
return this.enqueueWorkspaceMcpDiscovery("initialization", async () => {
|
|
8243
|
+
const settings = loadSettings(this.config.getTargetDir());
|
|
8244
|
+
await this.createWorkspaceMcpDiscoveryConfig(settings);
|
|
8245
|
+
});
|
|
8246
|
+
}
|
|
8247
|
+
reloadWorkspaceMcpDiscovery() {
|
|
8248
|
+
return this.enqueueWorkspaceMcpDiscovery("reload", async () => {
|
|
8249
|
+
const settings = loadSettings(this.config.getTargetDir());
|
|
8250
|
+
const discoveryConfig = this.workspaceMcpDiscoveryConfig;
|
|
8251
|
+
const liveConfigs = /* @__PURE__ */ new Set([
|
|
8252
|
+
this.config,
|
|
8253
|
+
...this.getActiveSessions().map((session) => session.getConfig()),
|
|
8254
|
+
...discoveryConfig ? [discoveryConfig] : []
|
|
8255
|
+
]);
|
|
8256
|
+
const syncErrors = [];
|
|
8257
|
+
for (const config of liveConfigs) {
|
|
8258
|
+
try {
|
|
8259
|
+
const cwd = config.getTargetDir();
|
|
8260
|
+
const mcpServers = assembleMcpServers(
|
|
8261
|
+
settings.merged.mcpServers,
|
|
8262
|
+
cwd,
|
|
8263
|
+
config.getTopTierMcpServers()
|
|
8264
|
+
);
|
|
8265
|
+
const gating = recomputeMcpGating(
|
|
8266
|
+
settings,
|
|
8267
|
+
mcpServers,
|
|
8268
|
+
cwd,
|
|
8269
|
+
config.getCliAllowedMcpServerNames(),
|
|
8270
|
+
config.getApprovalMode() === "yolo" /* YOLO */
|
|
8271
|
+
);
|
|
8272
|
+
config.setExcludedMcpServers(gating.excluded ?? []);
|
|
8273
|
+
config.setAllowedMcpServers(gating.allowed);
|
|
8274
|
+
config.setPendingMcpServers(gating.pending);
|
|
8275
|
+
await config.reinitializeMcpServers(mcpServers);
|
|
8276
|
+
} catch (error) {
|
|
8277
|
+
syncErrors.push(error);
|
|
8278
|
+
}
|
|
8279
|
+
}
|
|
8280
|
+
if (!discoveryConfig) {
|
|
8281
|
+
try {
|
|
8282
|
+
await this.createWorkspaceMcpDiscoveryConfig(settings);
|
|
8283
|
+
} catch (error) {
|
|
8284
|
+
syncErrors.push(error);
|
|
8285
|
+
}
|
|
8286
|
+
}
|
|
8287
|
+
if (syncErrors.length > 0) {
|
|
8288
|
+
throw new AggregateError(
|
|
8289
|
+
syncErrors,
|
|
8290
|
+
"Failed to synchronize MCP settings with live sessions"
|
|
8291
|
+
);
|
|
8292
|
+
}
|
|
8293
|
+
});
|
|
8294
|
+
}
|
|
7700
8295
|
/**
|
|
7701
8296
|
* Drain the workspace MCP transport pool. Called on shutdown so all
|
|
7702
8297
|
* pool entries get a coordinated SIGTERM before process.exit. No-op
|
|
@@ -7718,6 +8313,11 @@ var QwenAgent = class {
|
|
|
7718
8313
|
}
|
|
7719
8314
|
}
|
|
7720
8315
|
async closeStoredSession(sessionId, opts) {
|
|
8316
|
+
for (const [requestId, generation] of this.generationControllers) {
|
|
8317
|
+
if (generation.sessionId !== sessionId) continue;
|
|
8318
|
+
generation.controller.abort();
|
|
8319
|
+
this.generationControllers.delete(requestId);
|
|
8320
|
+
}
|
|
7721
8321
|
const session = this.sessions.get(sessionId);
|
|
7722
8322
|
if (!session) {
|
|
7723
8323
|
this.mcpPool?.releaseSession(sessionId);
|
|
@@ -7796,6 +8396,10 @@ var QwenAgent = class {
|
|
|
7796
8396
|
this.sessions.delete(sessionId);
|
|
7797
8397
|
}
|
|
7798
8398
|
disposeSessions() {
|
|
8399
|
+
for (const generation of this.generationControllers.values()) {
|
|
8400
|
+
generation.controller.abort();
|
|
8401
|
+
}
|
|
8402
|
+
this.generationControllers.clear();
|
|
7799
8403
|
for (const session of this.sessions.values()) {
|
|
7800
8404
|
session.dispose();
|
|
7801
8405
|
}
|
|
@@ -7830,7 +8434,7 @@ var QwenAgent = class {
|
|
|
7830
8434
|
async initialize(args) {
|
|
7831
8435
|
this.clientCapabilities = args.clientCapabilities;
|
|
7832
8436
|
const authMethods = buildAuthMethods();
|
|
7833
|
-
const version = "0.19.
|
|
8437
|
+
const version = "0.19.11-nightly.20260718.767a32484";
|
|
7834
8438
|
return {
|
|
7835
8439
|
protocolVersion: PROTOCOL_VERSION,
|
|
7836
8440
|
agentInfo: {
|
|
@@ -7886,25 +8490,42 @@ var QwenAgent = class {
|
|
|
7886
8490
|
}
|
|
7887
8491
|
}
|
|
7888
8492
|
}
|
|
7889
|
-
async newSession({
|
|
7890
|
-
cwd,
|
|
7891
|
-
|
|
7892
|
-
|
|
7893
|
-
|
|
7894
|
-
|
|
7895
|
-
|
|
7896
|
-
|
|
7897
|
-
|
|
7898
|
-
|
|
7899
|
-
|
|
7900
|
-
|
|
7901
|
-
|
|
7902
|
-
|
|
7903
|
-
|
|
7904
|
-
|
|
7905
|
-
|
|
7906
|
-
|
|
7907
|
-
|
|
8493
|
+
async newSession(params) {
|
|
8494
|
+
const { cwd, mcpServers } = params;
|
|
8495
|
+
const parentContext = extractDaemonTraceContext(params);
|
|
8496
|
+
return await withDaemonSpan(
|
|
8497
|
+
"qwen-code.daemon.session_start",
|
|
8498
|
+
{ "qwen-code.daemon.operation": "acp_session_new" },
|
|
8499
|
+
async (span) => {
|
|
8500
|
+
const profiler = createAcpSessionStartProfiler(span);
|
|
8501
|
+
const settings = profiler.timeSync(
|
|
8502
|
+
"settings_load",
|
|
8503
|
+
() => loadSettingsCached(cwd)
|
|
8504
|
+
);
|
|
8505
|
+
this.settings = settings;
|
|
8506
|
+
const config = await profiler.time(
|
|
8507
|
+
"config_setup",
|
|
8508
|
+
() => this.newSessionConfig(cwd, mcpServers, settings)
|
|
8509
|
+
);
|
|
8510
|
+
await profiler.time("auth", () => this.ensureAuthenticated(config));
|
|
8511
|
+
profiler.timeSync(
|
|
8512
|
+
"file_system_setup",
|
|
8513
|
+
() => this.setupFileSystem(config)
|
|
8514
|
+
);
|
|
8515
|
+
const session = await profiler.time(
|
|
8516
|
+
"session_register",
|
|
8517
|
+
() => this.createAndStoreSession(config, settings)
|
|
8518
|
+
);
|
|
8519
|
+
profiler.setSessionId(session.getId());
|
|
8520
|
+
return profiler.timeSync("response_build", () => ({
|
|
8521
|
+
sessionId: session.getId(),
|
|
8522
|
+
models: this.buildAvailableModels(config),
|
|
8523
|
+
modes: this.buildModesData(config),
|
|
8524
|
+
configOptions: this.buildConfigOptions(config)
|
|
8525
|
+
}));
|
|
8526
|
+
},
|
|
8527
|
+
parentContext ? { parentContext } : {}
|
|
8528
|
+
);
|
|
7908
8529
|
}
|
|
7909
8530
|
async loadSession(params) {
|
|
7910
8531
|
const settings = loadSettingsCached(params.cwd);
|
|
@@ -7935,6 +8556,7 @@ var QwenAgent = class {
|
|
|
7935
8556
|
this.setupFileSystem(config);
|
|
7936
8557
|
const sessionData = config.getResumedSessionData();
|
|
7937
8558
|
const bulkReplay = isBulkLoadReplayRequest(params);
|
|
8559
|
+
const replayPageSize = bulkReplay ? getLoadReplayPageSize(params) : void 0;
|
|
7938
8560
|
const session = await this.createAndStoreSession(
|
|
7939
8561
|
config,
|
|
7940
8562
|
settings,
|
|
@@ -7948,11 +8570,15 @@ var QwenAgent = class {
|
|
|
7948
8570
|
let replayUpdates = [];
|
|
7949
8571
|
if (records) {
|
|
7950
8572
|
session.primeTurnFromHistory(records);
|
|
8573
|
+
const replayPage = selectRecentHistoryRecords(
|
|
8574
|
+
records,
|
|
8575
|
+
replayPageSize
|
|
8576
|
+
);
|
|
7951
8577
|
const replayUsage = createReplayCumulativeUsage();
|
|
7952
8578
|
const replay = await collectHistoryReplayUpdates({
|
|
7953
8579
|
sessionId: params.sessionId,
|
|
7954
8580
|
config,
|
|
7955
|
-
records,
|
|
8581
|
+
records: replayPage.records,
|
|
7956
8582
|
gaps: sessionData?.historyGaps,
|
|
7957
8583
|
cumulativeUsage: replayUsage,
|
|
7958
8584
|
logger: debugLogger7
|
|
@@ -7964,9 +8590,15 @@ var QwenAgent = class {
|
|
|
7964
8590
|
v: LOAD_REPLAY_VERSION,
|
|
7965
8591
|
updates: replayUpdates,
|
|
7966
8592
|
partial: true,
|
|
7967
|
-
replayError: replay.replayError
|
|
8593
|
+
replayError: replay.replayError,
|
|
8594
|
+
...replayPage.hasMore ? { hasMore: true } : {}
|
|
7968
8595
|
};
|
|
7969
8596
|
}
|
|
8597
|
+
replayEnvelope ??= {
|
|
8598
|
+
v: LOAD_REPLAY_VERSION,
|
|
8599
|
+
updates: replayUpdates,
|
|
8600
|
+
...replayPage.hasMore ? { hasMore: true } : {}
|
|
8601
|
+
};
|
|
7970
8602
|
}
|
|
7971
8603
|
replayEnvelope ??= {
|
|
7972
8604
|
v: LOAD_REPLAY_VERSION,
|
|
@@ -8351,8 +8983,15 @@ var QwenAgent = class {
|
|
|
8351
8983
|
return "error";
|
|
8352
8984
|
}
|
|
8353
8985
|
}
|
|
8354
|
-
discoveryState() {
|
|
8355
|
-
|
|
8986
|
+
discoveryState(config) {
|
|
8987
|
+
if (this.workspaceMcpDiscoveryPromise && (config === this.config || config === this.workspaceMcpDiscoveryConfig)) {
|
|
8988
|
+
return "in_progress";
|
|
8989
|
+
}
|
|
8990
|
+
let state = getMCPDiscoveryState();
|
|
8991
|
+
try {
|
|
8992
|
+
state = config?.getToolRegistry()?.getMcpClientManager().getDiscoveryState() ?? state;
|
|
8993
|
+
} catch {
|
|
8994
|
+
}
|
|
8356
8995
|
switch (state) {
|
|
8357
8996
|
case "in_progress" /* IN_PROGRESS */:
|
|
8358
8997
|
return "in_progress";
|
|
@@ -8367,10 +9006,10 @@ var QwenAgent = class {
|
|
|
8367
9006
|
try {
|
|
8368
9007
|
const workspaceCwd = this.workspaceCwd(config);
|
|
8369
9008
|
const settings = loadSettings(config.getTargetDir());
|
|
8370
|
-
const
|
|
8371
|
-
|
|
8372
|
-
).settings;
|
|
9009
|
+
const userServers = settings.user?.settings.mcpServers ?? {};
|
|
9010
|
+
const systemDefaultServers = settings.systemDefaults?.settings.mcpServers ?? {};
|
|
8373
9011
|
const servers = config.getMcpServers() ?? {};
|
|
9012
|
+
const approvals = loadMcpApprovals();
|
|
8374
9013
|
let poolByName = {};
|
|
8375
9014
|
try {
|
|
8376
9015
|
const snap = this.mcpPool?.getSnapshot();
|
|
@@ -8415,7 +9054,7 @@ var QwenAgent = class {
|
|
|
8415
9054
|
v: STATUS_SCHEMA_VERSION,
|
|
8416
9055
|
workspaceCwd,
|
|
8417
9056
|
initialized: true,
|
|
8418
|
-
discoveryState: this.discoveryState(),
|
|
9057
|
+
discoveryState: this.discoveryState(config),
|
|
8419
9058
|
servers: await Promise.all(
|
|
8420
9059
|
Object.entries(servers).map(async ([name, server]) => {
|
|
8421
9060
|
const disabled = config.isMcpServerDisabled(name);
|
|
@@ -8425,7 +9064,8 @@ var QwenAgent = class {
|
|
|
8425
9064
|
hasOAuthTokens = credentials !== null;
|
|
8426
9065
|
} catch {
|
|
8427
9066
|
}
|
|
8428
|
-
const rawStatus =
|
|
9067
|
+
const rawStatus = this.getMcpServerStatus(config, name);
|
|
9068
|
+
const requiresAuth = rawStatus !== "connected" /* CONNECTED */ && (mcpServerRequiresOAuth.get(name) === true || server.oauth?.enabled === true && !hasOAuthTokens);
|
|
8429
9069
|
const refusedByBudget = refusedSet.has(name);
|
|
8430
9070
|
const effectivelyRefused = refusedByBudget && !disabled;
|
|
8431
9071
|
const out = {
|
|
@@ -8439,8 +9079,34 @@ var QwenAgent = class {
|
|
|
8439
9079
|
mcpStatus: this.mcpStatus(rawStatus),
|
|
8440
9080
|
transport: this.mcpTransport(server),
|
|
8441
9081
|
disabled,
|
|
8442
|
-
hasOAuthTokens
|
|
9082
|
+
hasOAuthTokens,
|
|
9083
|
+
...requiresAuth ? { requiresAuth: true } : {}
|
|
8443
9084
|
};
|
|
9085
|
+
if (isGatedMcpScope(server.scope)) {
|
|
9086
|
+
const approvalState = approvals.getState(
|
|
9087
|
+
config.getWorkingDir(),
|
|
9088
|
+
name,
|
|
9089
|
+
server
|
|
9090
|
+
);
|
|
9091
|
+
if (approvalState !== "approved") {
|
|
9092
|
+
out.approvalState = approvalState;
|
|
9093
|
+
if (!disabled) {
|
|
9094
|
+
out.status = "warning";
|
|
9095
|
+
out.mcpStatus = "disconnected";
|
|
9096
|
+
}
|
|
9097
|
+
}
|
|
9098
|
+
}
|
|
9099
|
+
if (this.pendingMcpAuthentications.has(name)) {
|
|
9100
|
+
out.authenticationState = "pending";
|
|
9101
|
+
} else {
|
|
9102
|
+
const authentication = this.mcpAuthenticationResults.get(name);
|
|
9103
|
+
if (authentication) {
|
|
9104
|
+
out.authenticationState = authentication.state;
|
|
9105
|
+
if (authentication.error) {
|
|
9106
|
+
out.authenticationError = authentication.error;
|
|
9107
|
+
}
|
|
9108
|
+
}
|
|
9109
|
+
}
|
|
8444
9110
|
if (effectivelyRefused) {
|
|
8445
9111
|
out.errorKind = "budget_exhausted";
|
|
8446
9112
|
out.disabledReason = "budget";
|
|
@@ -8456,7 +9122,11 @@ var QwenAgent = class {
|
|
|
8456
9122
|
if (typeof extensionName === "string") {
|
|
8457
9123
|
out.extensionName = extensionName;
|
|
8458
9124
|
}
|
|
8459
|
-
|
|
9125
|
+
const transient = config.getTopTierMcpServers?.()?.[name] !== void 0 || config.getRuntimeMcpServers?.()[name] !== void 0;
|
|
9126
|
+
const configOrigin = out.extensionName ? "extension" : transient ? "runtime" : server.scope === "workspace" ? "workspace_settings" : server.scope === "project" ? "project_mcp_json" : server.scope === "system" ? "system_settings" : userServers[name] !== void 0 ? "user_settings" : systemDefaultServers[name] !== void 0 ? "system_settings" : "user_settings";
|
|
9127
|
+
out.configOrigin = configOrigin;
|
|
9128
|
+
out.source = out.extensionName ? "extension" : configOrigin === "workspace_settings" ? "project" : "user";
|
|
9129
|
+
out.removable = configOrigin === "user_settings" || configOrigin === "workspace_settings";
|
|
8460
9130
|
if (server && typeof server === "object") {
|
|
8461
9131
|
const candidate = server;
|
|
8462
9132
|
const serverConfig = {};
|
|
@@ -8521,6 +9191,14 @@ var QwenAgent = class {
|
|
|
8521
9191
|
).length,
|
|
8522
9192
|
budgetCellScope
|
|
8523
9193
|
)
|
|
9194
|
+
} : {},
|
|
9195
|
+
...this.workspaceMcpDiscoveryError ? {
|
|
9196
|
+
errors: [
|
|
9197
|
+
this.errorCell(
|
|
9198
|
+
"mcp",
|
|
9199
|
+
new Error(this.workspaceMcpDiscoveryError)
|
|
9200
|
+
)
|
|
9201
|
+
]
|
|
8524
9202
|
} : {}
|
|
8525
9203
|
};
|
|
8526
9204
|
} catch (error) {
|
|
@@ -8533,6 +9211,34 @@ var QwenAgent = class {
|
|
|
8533
9211
|
};
|
|
8534
9212
|
}
|
|
8535
9213
|
}
|
|
9214
|
+
async buildManagedWorkspaceMcpStatus() {
|
|
9215
|
+
const config = this.getWorkspaceMcpConfig();
|
|
9216
|
+
const status = await this.buildWorkspaceMcpStatus(config);
|
|
9217
|
+
if (config === this.config) return status;
|
|
9218
|
+
const runtimeNames = new Set(
|
|
9219
|
+
Object.keys(this.config.getRuntimeMcpServers?.() ?? {})
|
|
9220
|
+
);
|
|
9221
|
+
if (runtimeNames.size === 0) return status;
|
|
9222
|
+
const runtimeStatus = await this.buildWorkspaceMcpStatus(this.config);
|
|
9223
|
+
const errors = [
|
|
9224
|
+
...status.errors ?? [],
|
|
9225
|
+
...(runtimeStatus.errors ?? []).filter(
|
|
9226
|
+
(candidate) => !status.errors?.some(
|
|
9227
|
+
(existing) => existing.kind === candidate.kind && existing.status === candidate.status && existing.error === candidate.error
|
|
9228
|
+
)
|
|
9229
|
+
)
|
|
9230
|
+
];
|
|
9231
|
+
return {
|
|
9232
|
+
...status,
|
|
9233
|
+
servers: [
|
|
9234
|
+
...status.servers.filter((server) => !runtimeNames.has(server.name)),
|
|
9235
|
+
...runtimeStatus.servers.filter(
|
|
9236
|
+
(server) => runtimeNames.has(server.name)
|
|
9237
|
+
)
|
|
9238
|
+
],
|
|
9239
|
+
...errors.length > 0 ? { errors } : {}
|
|
9240
|
+
};
|
|
9241
|
+
}
|
|
8536
9242
|
buildWorkspaceMcpToolsStatus(config, serverName) {
|
|
8537
9243
|
const workspaceCwd = this.safeWorkspaceCwd(config);
|
|
8538
9244
|
try {
|
|
@@ -8840,9 +9546,18 @@ var QwenAgent = class {
|
|
|
8840
9546
|
const currentModelId = activeRuntimeSnapshot ? activeRuntimeSnapshot.id : (config.getModel() || "").trim();
|
|
8841
9547
|
const hasCurrentModel = currentModelId.length > 0;
|
|
8842
9548
|
const currentAuth = activeRuntimeSnapshot?.authType ?? currentAuthType;
|
|
8843
|
-
const
|
|
9549
|
+
const modelOptions = buildAcpModelOptions(
|
|
9550
|
+
config.getAllConfiguredModels()
|
|
9551
|
+
);
|
|
9552
|
+
const currentAcpModelId = hasCurrentModel ? getCurrentAcpModelId(
|
|
9553
|
+
modelOptions,
|
|
9554
|
+
currentModelId,
|
|
9555
|
+
currentAuth,
|
|
9556
|
+
activeRuntimeSnapshot ? void 0 : config.getCurrentModelRegistryBaseUrl?.()
|
|
9557
|
+
) : void 0;
|
|
8844
9558
|
const providers = /* @__PURE__ */ new Map();
|
|
8845
|
-
for (const
|
|
9559
|
+
for (const option of modelOptions) {
|
|
9560
|
+
const { model, effectiveModelId, modelId } = option;
|
|
8846
9561
|
const authType = String(model.authType);
|
|
8847
9562
|
let provider = providers.get(authType);
|
|
8848
9563
|
if (!provider) {
|
|
@@ -8855,9 +9570,7 @@ var QwenAgent = class {
|
|
|
8855
9570
|
};
|
|
8856
9571
|
providers.set(authType, provider);
|
|
8857
9572
|
}
|
|
8858
|
-
const
|
|
8859
|
-
const modelId = formatAcpModelId(effectiveModelId, model.authType);
|
|
8860
|
-
const isCurrent = currentAuth === model.authType && hasCurrentModel && (currentModelId === effectiveModelId || currentModelId === model.id || currentAcpModelId === modelId);
|
|
9573
|
+
const isCurrent = currentAuth === model.authType && currentAcpModelId === modelId;
|
|
8861
9574
|
const providerModel = {
|
|
8862
9575
|
modelId,
|
|
8863
9576
|
baseModelId: parseAcpBaseModelId(effectiveModelId),
|
|
@@ -8997,7 +9710,7 @@ var QwenAgent = class {
|
|
|
8997
9710
|
}
|
|
8998
9711
|
buildMcpDiscoveryPreflightCell(config) {
|
|
8999
9712
|
try {
|
|
9000
|
-
const discovery = this.discoveryState();
|
|
9713
|
+
const discovery = this.discoveryState(config);
|
|
9001
9714
|
const servers = config.getMcpServers() ?? {};
|
|
9002
9715
|
const total = Object.keys(servers).length;
|
|
9003
9716
|
const counts = {
|
|
@@ -9920,9 +10633,7 @@ var QwenAgent = class {
|
|
|
9920
10633
|
};
|
|
9921
10634
|
}
|
|
9922
10635
|
case SERVE_STATUS_EXT_METHODS.workspaceMcp:
|
|
9923
|
-
return await this.
|
|
9924
|
-
this.config
|
|
9925
|
-
);
|
|
10636
|
+
return await this.buildManagedWorkspaceMcpStatus();
|
|
9926
10637
|
case SERVE_STATUS_EXT_METHODS.workspaceMcpTools: {
|
|
9927
10638
|
const serverName = params["serverName"];
|
|
9928
10639
|
if (typeof serverName !== "string" || serverName.length === 0) {
|
|
@@ -9932,7 +10643,7 @@ var QwenAgent = class {
|
|
|
9932
10643
|
);
|
|
9933
10644
|
}
|
|
9934
10645
|
return this.buildWorkspaceMcpToolsStatus(
|
|
9935
|
-
this.
|
|
10646
|
+
this.getWorkspaceMcpConfig(serverName),
|
|
9936
10647
|
serverName
|
|
9937
10648
|
);
|
|
9938
10649
|
}
|
|
@@ -9945,7 +10656,7 @@ var QwenAgent = class {
|
|
|
9945
10656
|
);
|
|
9946
10657
|
}
|
|
9947
10658
|
return this.buildWorkspaceMcpResourcesStatus(
|
|
9948
|
-
this.
|
|
10659
|
+
this.getWorkspaceMcpConfig(serverName),
|
|
9949
10660
|
serverName
|
|
9950
10661
|
);
|
|
9951
10662
|
}
|
|
@@ -10060,6 +10771,19 @@ var QwenAgent = class {
|
|
|
10060
10771
|
"Invalid transcript cursor"
|
|
10061
10772
|
);
|
|
10062
10773
|
}
|
|
10774
|
+
const rawBeforeRecordId = params["beforeRecordId"];
|
|
10775
|
+
if (rawBeforeRecordId !== void 0 && (typeof rawBeforeRecordId !== "string" || rawBeforeRecordId.length === 0)) {
|
|
10776
|
+
throw RequestError.invalidParams(
|
|
10777
|
+
void 0,
|
|
10778
|
+
"Invalid transcript record boundary"
|
|
10779
|
+
);
|
|
10780
|
+
}
|
|
10781
|
+
if (rawCursor !== void 0 && rawBeforeRecordId !== void 0) {
|
|
10782
|
+
throw RequestError.invalidParams(
|
|
10783
|
+
void 0,
|
|
10784
|
+
"Transcript cursor and record boundary are mutually exclusive"
|
|
10785
|
+
);
|
|
10786
|
+
}
|
|
10063
10787
|
const rawLimit = params["limit"];
|
|
10064
10788
|
if (rawLimit !== void 0 && (!Number.isSafeInteger(rawLimit) || rawLimit < 1 || rawLimit > SESSION_TRANSCRIPT_MAX_LIMIT)) {
|
|
10065
10789
|
throw RequestError.invalidParams(
|
|
@@ -10073,7 +10797,9 @@ var QwenAgent = class {
|
|
|
10073
10797
|
const reader = new SessionTranscriptReader(cwd);
|
|
10074
10798
|
const page = await reader.readPage(sessionId, {
|
|
10075
10799
|
...typeof rawCursor === "string" ? { cursor: rawCursor } : {},
|
|
10076
|
-
...typeof
|
|
10800
|
+
...typeof rawBeforeRecordId === "string" ? { beforeRecordId: rawBeforeRecordId } : {},
|
|
10801
|
+
...typeof rawLimit === "number" ? { limit: rawLimit } : {},
|
|
10802
|
+
maxBytes: SESSION_TRANSCRIPT_MAX_PAGE_BYTES
|
|
10077
10803
|
});
|
|
10078
10804
|
const config = await this.getTranscriptReplayConfig(cwd, settings);
|
|
10079
10805
|
const replay = await replayTranscriptRecordPage({
|
|
@@ -10122,6 +10848,14 @@ var QwenAgent = class {
|
|
|
10122
10848
|
maxBytes: error.maxBytes
|
|
10123
10849
|
});
|
|
10124
10850
|
}
|
|
10851
|
+
if (error instanceof SessionTranscriptPageTooLargeError) {
|
|
10852
|
+
throw new RequestError(-32012, error.message, {
|
|
10853
|
+
errorKind: "transcript_page_too_large",
|
|
10854
|
+
sessionId,
|
|
10855
|
+
pageBytes: error.pageBytes,
|
|
10856
|
+
maxBytes: error.maxBytes
|
|
10857
|
+
});
|
|
10858
|
+
}
|
|
10125
10859
|
if (error.code === "ENOENT") {
|
|
10126
10860
|
if (typeof rawCursor === "string") {
|
|
10127
10861
|
throw new RequestError(
|
|
@@ -10469,6 +11203,7 @@ var QwenAgent = class {
|
|
|
10469
11203
|
"Invalid or missing serverName"
|
|
10470
11204
|
);
|
|
10471
11205
|
}
|
|
11206
|
+
const config = this.getWorkspaceMcpConfig(serverName);
|
|
10472
11207
|
let entryIndex;
|
|
10473
11208
|
const rawEntryIndex = params["entryIndex"];
|
|
10474
11209
|
if (rawEntryIndex !== void 0 && rawEntryIndex !== "*") {
|
|
@@ -10480,7 +11215,7 @@ var QwenAgent = class {
|
|
|
10480
11215
|
}
|
|
10481
11216
|
entryIndex = rawEntryIndex;
|
|
10482
11217
|
}
|
|
10483
|
-
const servers =
|
|
11218
|
+
const servers = config.getMcpServers() ?? {};
|
|
10484
11219
|
if (!Object.prototype.hasOwnProperty.call(servers, serverName)) {
|
|
10485
11220
|
throw new RequestError(
|
|
10486
11221
|
-32004,
|
|
@@ -10488,7 +11223,7 @@ var QwenAgent = class {
|
|
|
10488
11223
|
{ errorKind: "mcp_server_not_found", serverName }
|
|
10489
11224
|
);
|
|
10490
11225
|
}
|
|
10491
|
-
if (
|
|
11226
|
+
if (config.isMcpServerDisabled(serverName)) {
|
|
10492
11227
|
return {
|
|
10493
11228
|
serverName,
|
|
10494
11229
|
restarted: false,
|
|
@@ -10496,7 +11231,23 @@ var QwenAgent = class {
|
|
|
10496
11231
|
reason: "disabled"
|
|
10497
11232
|
};
|
|
10498
11233
|
}
|
|
10499
|
-
const
|
|
11234
|
+
const server = servers[serverName];
|
|
11235
|
+
let requiresAuth = mcpServerRequiresOAuth.get(serverName) === true;
|
|
11236
|
+
if (!requiresAuth && server.oauth?.enabled === true) {
|
|
11237
|
+
try {
|
|
11238
|
+
requiresAuth = await new MCPOAuthTokenStorage().getCredentials(serverName) === null;
|
|
11239
|
+
} catch {
|
|
11240
|
+
}
|
|
11241
|
+
}
|
|
11242
|
+
if (requiresAuth && this.getMcpServerStatus(config, serverName) !== "connected" /* CONNECTED */) {
|
|
11243
|
+
return {
|
|
11244
|
+
serverName,
|
|
11245
|
+
restarted: false,
|
|
11246
|
+
skipped: true,
|
|
11247
|
+
reason: "authentication_required"
|
|
11248
|
+
};
|
|
11249
|
+
}
|
|
11250
|
+
const manager = config.getToolRegistry()?.getMcpClientManager();
|
|
10500
11251
|
if (!manager) {
|
|
10501
11252
|
throw RequestError.internalError(
|
|
10502
11253
|
void 0,
|
|
@@ -10523,7 +11274,7 @@ var QwenAgent = class {
|
|
|
10523
11274
|
};
|
|
10524
11275
|
}
|
|
10525
11276
|
try {
|
|
10526
|
-
const fresh = loadSettings(
|
|
11277
|
+
const fresh = loadSettings(config.getTargetDir());
|
|
10527
11278
|
const mergedDisabled = fresh.merged.tools?.disabled;
|
|
10528
11279
|
if (mergedDisabled !== void 0 && !Array.isArray(mergedDisabled)) {
|
|
10529
11280
|
process.stderr.write(
|
|
@@ -10532,7 +11283,7 @@ var QwenAgent = class {
|
|
|
10532
11283
|
);
|
|
10533
11284
|
}
|
|
10534
11285
|
const disabledList = normalizeDisabledToolList(mergedDisabled);
|
|
10535
|
-
|
|
11286
|
+
config.setDisabledTools(new Set(disabledList));
|
|
10536
11287
|
} catch (err) {
|
|
10537
11288
|
process.stderr.write(
|
|
10538
11289
|
`qwen serve: MCP restart for ${JSON.stringify(serverName)} could not refresh disabledTools from merged settings (${err instanceof Error ? err.message : String(err)}); proceeding with the bootstrap snapshot \u2014 recently toggled tools may not take effect until daemon restart.
|
|
@@ -10545,6 +11296,14 @@ var QwenAgent = class {
|
|
|
10545
11296
|
const restartResults = await this.mcpPool.restartByName(serverName, {
|
|
10546
11297
|
...entryIndex !== void 0 ? { entryIndex } : {}
|
|
10547
11298
|
});
|
|
11299
|
+
await Promise.all(
|
|
11300
|
+
this.getLiveMcpConfigs(serverName).map(async (liveConfig) => {
|
|
11301
|
+
const geminiClient = liveConfig.getGeminiClient?.();
|
|
11302
|
+
if (geminiClient?.isInitialized?.()) {
|
|
11303
|
+
await geminiClient.setTools?.();
|
|
11304
|
+
}
|
|
11305
|
+
})
|
|
11306
|
+
);
|
|
10548
11307
|
return {
|
|
10549
11308
|
serverName,
|
|
10550
11309
|
entries: restartResults
|
|
@@ -10557,19 +11316,18 @@ var QwenAgent = class {
|
|
|
10557
11316
|
);
|
|
10558
11317
|
}
|
|
10559
11318
|
const start = Date.now();
|
|
10560
|
-
|
|
10561
|
-
|
|
10562
|
-
|
|
10563
|
-
|
|
10564
|
-
|
|
11319
|
+
await this.reconcileMcpServerAcrossLiveConfigs(serverName, "discover");
|
|
11320
|
+
const disconnectedRuntime = this.getLiveMcpConfigs(serverName).find(
|
|
11321
|
+
(liveConfig) => this.getMcpServerStatus(liveConfig, serverName) !== "connected" /* CONNECTED */
|
|
11322
|
+
);
|
|
11323
|
+
if (disconnectedRuntime) {
|
|
11324
|
+
const postStatus = this.getMcpServerStatus(
|
|
11325
|
+
disconnectedRuntime,
|
|
11326
|
+
serverName
|
|
10565
11327
|
);
|
|
10566
|
-
}
|
|
10567
|
-
await toolRegistry.discoverToolsForServer(serverName);
|
|
10568
|
-
const postStatus = getMCPServerStatus(serverName);
|
|
10569
|
-
if (postStatus !== "connected" /* CONNECTED */) {
|
|
10570
11328
|
throw new RequestError(
|
|
10571
11329
|
-32099,
|
|
10572
|
-
`MCP server ${JSON.stringify(serverName)} did not reach a connected state after restart (status: ${postStatus}).`,
|
|
11330
|
+
`MCP server ${JSON.stringify(serverName)} did not reach a connected state in every live runtime after restart (status: ${postStatus}).`,
|
|
10573
11331
|
{
|
|
10574
11332
|
errorKind: "mcp_restart_failed",
|
|
10575
11333
|
serverName,
|
|
@@ -10583,6 +11341,10 @@ var QwenAgent = class {
|
|
|
10583
11341
|
durationMs: Date.now() - start
|
|
10584
11342
|
};
|
|
10585
11343
|
}
|
|
11344
|
+
case SERVE_CONTROL_EXT_METHODS.workspaceMcpInitialize:
|
|
11345
|
+
return this.initializeWorkspaceMcpDiscovery();
|
|
11346
|
+
case SERVE_CONTROL_EXT_METHODS.workspaceMcpReload:
|
|
11347
|
+
return this.reloadWorkspaceMcpDiscovery();
|
|
10586
11348
|
case SERVE_CONTROL_EXT_METHODS.workspaceMcpManage: {
|
|
10587
11349
|
const serverName = params["serverName"];
|
|
10588
11350
|
const action = params["action"];
|
|
@@ -10592,13 +11354,14 @@ var QwenAgent = class {
|
|
|
10592
11354
|
"Invalid or missing serverName"
|
|
10593
11355
|
);
|
|
10594
11356
|
}
|
|
10595
|
-
if (action !== "enable" && action !== "disable" && action !== "authenticate" && action !== "clear-auth") {
|
|
11357
|
+
if (action !== "approve" && action !== "enable" && action !== "disable" && action !== "authenticate" && action !== "clear-auth") {
|
|
10596
11358
|
throw RequestError.invalidParams(
|
|
10597
11359
|
void 0,
|
|
10598
11360
|
"Invalid or missing MCP manage action"
|
|
10599
11361
|
);
|
|
10600
11362
|
}
|
|
10601
|
-
const
|
|
11363
|
+
const config = this.getWorkspaceMcpConfig(serverName);
|
|
11364
|
+
const servers = config.getMcpServers() ?? {};
|
|
10602
11365
|
const server = servers[serverName];
|
|
10603
11366
|
if (!server) {
|
|
10604
11367
|
throw new RequestError(
|
|
@@ -10607,37 +11370,65 @@ var QwenAgent = class {
|
|
|
10607
11370
|
{ errorKind: "mcp_server_not_found", serverName }
|
|
10608
11371
|
);
|
|
10609
11372
|
}
|
|
10610
|
-
const toolRegistry =
|
|
11373
|
+
const toolRegistry = config.getToolRegistry();
|
|
10611
11374
|
if (!toolRegistry) {
|
|
10612
11375
|
throw RequestError.internalError(
|
|
10613
11376
|
void 0,
|
|
10614
11377
|
"ToolRegistry unavailable on this Config"
|
|
10615
11378
|
);
|
|
10616
11379
|
}
|
|
11380
|
+
if (action === "approve") {
|
|
11381
|
+
if (!isGatedMcpScope(server.scope)) {
|
|
11382
|
+
throw RequestError.invalidParams(
|
|
11383
|
+
void 0,
|
|
11384
|
+
`MCP server is not approval-gated: ${serverName}`
|
|
11385
|
+
);
|
|
11386
|
+
}
|
|
11387
|
+
const approvals = loadMcpApprovals();
|
|
11388
|
+
await approvals.setState(
|
|
11389
|
+
config.getWorkingDir(),
|
|
11390
|
+
serverName,
|
|
11391
|
+
server,
|
|
11392
|
+
"approved"
|
|
11393
|
+
);
|
|
11394
|
+
for (const liveConfig of this.getLiveMcpConfigs(serverName)) {
|
|
11395
|
+
liveConfig.approveMcpServerForSession(serverName);
|
|
11396
|
+
}
|
|
11397
|
+
await this.reconcileMcpServerAcrossLiveConfigs(
|
|
11398
|
+
serverName,
|
|
11399
|
+
"discover"
|
|
11400
|
+
);
|
|
11401
|
+
return { serverName, action, ok: true, changed: true };
|
|
11402
|
+
}
|
|
10617
11403
|
if (action === "enable") {
|
|
10618
|
-
const settings = loadSettings(
|
|
11404
|
+
const settings = loadSettings(config.getTargetDir());
|
|
10619
11405
|
let settingsChanged = false;
|
|
10620
11406
|
for (const scope of ["User" /* User */, "Workspace" /* Workspace */]) {
|
|
10621
11407
|
const scopeSettings = settings.forScope(scope).settings;
|
|
10622
|
-
const
|
|
10623
|
-
const filtered =
|
|
11408
|
+
const currentExcluded = scopeSettings.mcp?.excluded || [];
|
|
11409
|
+
const filtered = currentExcluded.filter(
|
|
10624
11410
|
(pattern) => pattern !== serverName
|
|
10625
11411
|
);
|
|
10626
|
-
if (filtered.length !==
|
|
11412
|
+
if (filtered.length !== currentExcluded.length) {
|
|
10627
11413
|
settings.setValue(scope, "mcp.excluded", filtered);
|
|
10628
11414
|
settingsChanged = true;
|
|
10629
11415
|
}
|
|
10630
11416
|
}
|
|
10631
|
-
const currentExcluded = this.config.getExcludedMcpServers() || [];
|
|
10632
|
-
const runtimeFiltered = currentExcluded.filter(
|
|
10633
|
-
(pattern) => pattern !== serverName
|
|
10634
|
-
);
|
|
10635
11417
|
let runtimeChanged = false;
|
|
10636
|
-
|
|
10637
|
-
|
|
10638
|
-
|
|
11418
|
+
for (const liveConfig of this.getLiveMcpConfigs(serverName)) {
|
|
11419
|
+
const currentExcluded = liveConfig.getExcludedMcpServers() || [];
|
|
11420
|
+
const runtimeFiltered = currentExcluded.filter(
|
|
11421
|
+
(pattern) => pattern !== serverName
|
|
11422
|
+
);
|
|
11423
|
+
if (runtimeFiltered.length !== currentExcluded.length) {
|
|
11424
|
+
liveConfig.setExcludedMcpServers(runtimeFiltered);
|
|
11425
|
+
runtimeChanged = true;
|
|
11426
|
+
}
|
|
10639
11427
|
}
|
|
10640
|
-
await
|
|
11428
|
+
await this.reconcileMcpServerAcrossLiveConfigs(
|
|
11429
|
+
serverName,
|
|
11430
|
+
"discover"
|
|
11431
|
+
);
|
|
10641
11432
|
return {
|
|
10642
11433
|
serverName,
|
|
10643
11434
|
action,
|
|
@@ -10646,7 +11437,7 @@ var QwenAgent = class {
|
|
|
10646
11437
|
};
|
|
10647
11438
|
}
|
|
10648
11439
|
if (action === "disable") {
|
|
10649
|
-
const settings = loadSettings(
|
|
11440
|
+
const settings = loadSettings(config.getTargetDir());
|
|
10650
11441
|
const userSettings = settings.forScope("User" /* User */).settings;
|
|
10651
11442
|
const workspaceSettings = settings.forScope(
|
|
10652
11443
|
"Workspace" /* Workspace */
|
|
@@ -10658,7 +11449,7 @@ var QwenAgent = class {
|
|
|
10658
11449
|
`Cannot disable extension MCP server: ${serverName}`
|
|
10659
11450
|
);
|
|
10660
11451
|
}
|
|
10661
|
-
if (workspaceSettings.mcpServers?.[serverName]) {
|
|
11452
|
+
if (server.scope === "project" || server.scope === "workspace" || workspaceSettings.mcpServers?.[serverName]) {
|
|
10662
11453
|
targetScope = "Workspace" /* Workspace */;
|
|
10663
11454
|
} else if (userSettings.mcpServers?.[serverName]) {
|
|
10664
11455
|
targetScope = "User" /* User */;
|
|
@@ -10673,13 +11464,19 @@ var QwenAgent = class {
|
|
|
10673
11464
|
]);
|
|
10674
11465
|
settingsChanged = true;
|
|
10675
11466
|
}
|
|
10676
|
-
const runtimeExcluded = this.config.getExcludedMcpServers() || [];
|
|
10677
11467
|
let runtimeChanged = false;
|
|
10678
|
-
|
|
10679
|
-
|
|
10680
|
-
|
|
11468
|
+
const liveConfigs = this.getLiveMcpConfigs(serverName);
|
|
11469
|
+
for (const liveConfig of liveConfigs) {
|
|
11470
|
+
const runtimeExcluded = liveConfig.getExcludedMcpServers() || [];
|
|
11471
|
+
if (!matchesAnyServerPattern(serverName, runtimeExcluded)) {
|
|
11472
|
+
liveConfig.setExcludedMcpServers([
|
|
11473
|
+
...runtimeExcluded,
|
|
11474
|
+
serverName
|
|
11475
|
+
]);
|
|
11476
|
+
runtimeChanged = true;
|
|
11477
|
+
}
|
|
10681
11478
|
}
|
|
10682
|
-
await
|
|
11479
|
+
await this.reconcileMcpServerAcrossLiveConfigs(serverName, "disable");
|
|
10683
11480
|
return {
|
|
10684
11481
|
serverName,
|
|
10685
11482
|
action,
|
|
@@ -10690,61 +11487,114 @@ var QwenAgent = class {
|
|
|
10690
11487
|
if (action === "clear-auth") {
|
|
10691
11488
|
const tokenStorage = new MCPOAuthTokenStorage();
|
|
10692
11489
|
await tokenStorage.deleteCredentials(serverName);
|
|
10693
|
-
await
|
|
11490
|
+
await this.reconcileMcpServerAcrossLiveConfigs(
|
|
11491
|
+
serverName,
|
|
11492
|
+
"disconnect"
|
|
11493
|
+
);
|
|
10694
11494
|
return { serverName, action, ok: true, changed: true };
|
|
10695
11495
|
}
|
|
10696
|
-
|
|
10697
|
-
|
|
10698
|
-
|
|
10699
|
-
|
|
10700
|
-
|
|
10701
|
-
|
|
10702
|
-
|
|
10703
|
-
|
|
10704
|
-
|
|
11496
|
+
let pending = this.pendingMcpAuthentications.get(serverName);
|
|
11497
|
+
if (!pending) {
|
|
11498
|
+
this.mcpAuthenticationResults.delete(serverName);
|
|
11499
|
+
const messages2 = [];
|
|
11500
|
+
let resolveStarted;
|
|
11501
|
+
let rejectStarted;
|
|
11502
|
+
let startedTimer;
|
|
11503
|
+
const started = new Promise((resolve4, reject) => {
|
|
11504
|
+
resolveStarted = /* @__PURE__ */ __name((value) => {
|
|
11505
|
+
clearTimeout(startedTimer);
|
|
11506
|
+
resolve4(value);
|
|
11507
|
+
}, "resolveStarted");
|
|
11508
|
+
rejectStarted = /* @__PURE__ */ __name((reason) => {
|
|
11509
|
+
clearTimeout(startedTimer);
|
|
11510
|
+
reject(reason);
|
|
11511
|
+
}, "rejectStarted");
|
|
11512
|
+
startedTimer = setTimeout(
|
|
11513
|
+
() => rejectStarted(
|
|
11514
|
+
new Error(
|
|
11515
|
+
`MCP OAuth authentication did not provide a URL within ${MCP_OAUTH_START_TIMEOUT_MS / 1e3} seconds`
|
|
11516
|
+
)
|
|
11517
|
+
),
|
|
11518
|
+
MCP_OAUTH_START_TIMEOUT_MS
|
|
11519
|
+
);
|
|
11520
|
+
startedTimer.unref();
|
|
11521
|
+
});
|
|
11522
|
+
pending = { started };
|
|
11523
|
+
this.pendingMcpAuthentications.set(serverName, pending);
|
|
11524
|
+
const displayListener = /* @__PURE__ */ __name((message) => {
|
|
11525
|
+
if (typeof message === "string") {
|
|
11526
|
+
messages2.push(message);
|
|
11527
|
+
} else if (message && typeof message === "object") {
|
|
11528
|
+
const key = message.key;
|
|
11529
|
+
if (typeof key === "string") messages2.push(key);
|
|
10705
11530
|
}
|
|
10706
|
-
}
|
|
10707
|
-
|
|
10708
|
-
|
|
10709
|
-
|
|
10710
|
-
|
|
10711
|
-
}
|
|
10712
|
-
|
|
10713
|
-
|
|
10714
|
-
|
|
10715
|
-
|
|
10716
|
-
|
|
10717
|
-
|
|
10718
|
-
|
|
10719
|
-
|
|
10720
|
-
|
|
10721
|
-
|
|
10722
|
-
|
|
10723
|
-
|
|
10724
|
-
|
|
10725
|
-
|
|
10726
|
-
|
|
10727
|
-
|
|
10728
|
-
|
|
10729
|
-
|
|
10730
|
-
|
|
10731
|
-
|
|
10732
|
-
|
|
10733
|
-
|
|
10734
|
-
|
|
10735
|
-
|
|
10736
|
-
|
|
10737
|
-
|
|
10738
|
-
|
|
10739
|
-
|
|
10740
|
-
|
|
10741
|
-
|
|
10742
|
-
|
|
10743
|
-
|
|
10744
|
-
|
|
10745
|
-
|
|
10746
|
-
|
|
11531
|
+
}, "displayListener");
|
|
11532
|
+
const authUrlListener = /* @__PURE__ */ __name((url) => {
|
|
11533
|
+
if (typeof url === "string") {
|
|
11534
|
+
resolveStarted({ authUrl: url, messages: [...messages2] });
|
|
11535
|
+
}
|
|
11536
|
+
}, "authUrlListener");
|
|
11537
|
+
appEvents.on("oauth-display-message" /* OauthDisplayMessage */, displayListener);
|
|
11538
|
+
appEvents.on("oauth-auth-url" /* OauthAuthUrl */, authUrlListener);
|
|
11539
|
+
void (async () => {
|
|
11540
|
+
try {
|
|
11541
|
+
try {
|
|
11542
|
+
const oauthConfig = server.oauth ?? { enabled: false };
|
|
11543
|
+
const mcpServerUrl = server.httpUrl || server.url;
|
|
11544
|
+
const authProvider = new MCPOAuthProvider(
|
|
11545
|
+
new MCPOAuthTokenStorage()
|
|
11546
|
+
);
|
|
11547
|
+
await authProvider.authenticate(
|
|
11548
|
+
serverName,
|
|
11549
|
+
oauthConfig,
|
|
11550
|
+
mcpServerUrl,
|
|
11551
|
+
appEvents
|
|
11552
|
+
);
|
|
11553
|
+
this.mcpAuthenticationResults.set(serverName, {
|
|
11554
|
+
state: "succeeded"
|
|
11555
|
+
});
|
|
11556
|
+
} catch (error) {
|
|
11557
|
+
this.mcpAuthenticationResults.set(serverName, {
|
|
11558
|
+
state: "failed",
|
|
11559
|
+
error: error instanceof Error ? error.message : String(error)
|
|
11560
|
+
});
|
|
11561
|
+
rejectStarted(error);
|
|
11562
|
+
debugLogger7.warn(
|
|
11563
|
+
`MCP OAuth authentication failed for ${serverName}:`,
|
|
11564
|
+
error
|
|
11565
|
+
);
|
|
11566
|
+
return;
|
|
11567
|
+
}
|
|
11568
|
+
try {
|
|
11569
|
+
await this.reconcileMcpServerAcrossLiveConfigs(
|
|
11570
|
+
serverName,
|
|
11571
|
+
"discover"
|
|
11572
|
+
);
|
|
11573
|
+
} catch (error) {
|
|
11574
|
+
debugLogger7.warn(
|
|
11575
|
+
`MCP OAuth authenticated for ${serverName}, but tool synchronization failed:`,
|
|
11576
|
+
error
|
|
11577
|
+
);
|
|
11578
|
+
}
|
|
11579
|
+
} finally {
|
|
11580
|
+
appEvents.removeListener(
|
|
11581
|
+
"oauth-display-message" /* OauthDisplayMessage */,
|
|
11582
|
+
displayListener
|
|
11583
|
+
);
|
|
11584
|
+
appEvents.removeListener("oauth-auth-url" /* OauthAuthUrl */, authUrlListener);
|
|
11585
|
+
this.pendingMcpAuthentications.delete(serverName);
|
|
11586
|
+
}
|
|
11587
|
+
})();
|
|
10747
11588
|
}
|
|
11589
|
+
const { authUrl, messages } = await pending.started;
|
|
11590
|
+
return {
|
|
11591
|
+
serverName,
|
|
11592
|
+
action,
|
|
11593
|
+
ok: true,
|
|
11594
|
+
pending: true,
|
|
11595
|
+
messages,
|
|
11596
|
+
authUrl
|
|
11597
|
+
};
|
|
10748
11598
|
}
|
|
10749
11599
|
case SERVE_CONTROL_EXT_METHODS.workspaceAgentGenerate: {
|
|
10750
11600
|
const description = params["description"];
|
|
@@ -10855,6 +11705,39 @@ var QwenAgent = class {
|
|
|
10855
11705
|
}
|
|
10856
11706
|
return { sessionId, parentSessionId, persisted: ok };
|
|
10857
11707
|
}
|
|
11708
|
+
case SERVE_CONTROL_EXT_METHODS.sessionSource: {
|
|
11709
|
+
const sessionId = params["sessionId"];
|
|
11710
|
+
const sourceType = params["sourceType"];
|
|
11711
|
+
const sourceId = params["sourceId"];
|
|
11712
|
+
if (typeof sessionId !== "string" || sessionId.length === 0) {
|
|
11713
|
+
throw RequestError.invalidParams(
|
|
11714
|
+
void 0,
|
|
11715
|
+
"Invalid or missing sessionId"
|
|
11716
|
+
);
|
|
11717
|
+
}
|
|
11718
|
+
const source = parseSessionSource(sourceType, sourceId);
|
|
11719
|
+
if ("error" in source || source.sourceType === void 0) {
|
|
11720
|
+
throw RequestError.invalidParams(
|
|
11721
|
+
void 0,
|
|
11722
|
+
"error" in source ? source.error : "Invalid or missing sourceType"
|
|
11723
|
+
);
|
|
11724
|
+
}
|
|
11725
|
+
const session = this.sessionOrThrow(sessionId);
|
|
11726
|
+
const recording = session.getConfig().getChatRecordingService();
|
|
11727
|
+
let ok = false;
|
|
11728
|
+
if (recording) {
|
|
11729
|
+
ok = await recording.recordSessionSource(
|
|
11730
|
+
source.sourceType,
|
|
11731
|
+
source.sourceId
|
|
11732
|
+
);
|
|
11733
|
+
}
|
|
11734
|
+
return {
|
|
11735
|
+
sessionId,
|
|
11736
|
+
sourceType: source.sourceType,
|
|
11737
|
+
...source.sourceId !== void 0 ? { sourceId: source.sourceId } : {},
|
|
11738
|
+
persisted: ok
|
|
11739
|
+
};
|
|
11740
|
+
}
|
|
10858
11741
|
case SERVE_CONTROL_EXT_METHODS.sessionClose: {
|
|
10859
11742
|
const sessionId = params["sessionId"];
|
|
10860
11743
|
if (typeof sessionId !== "string" || sessionId.length === 0) {
|
|
@@ -11097,6 +11980,64 @@ var QwenAgent = class {
|
|
|
11097
11980
|
);
|
|
11098
11981
|
return { sessionId, recap };
|
|
11099
11982
|
}
|
|
11983
|
+
case SERVE_CONTROL_EXT_METHODS.sessionGenerationStart: {
|
|
11984
|
+
const sessionId = params["sessionId"];
|
|
11985
|
+
const requestId = params["requestId"];
|
|
11986
|
+
const prompt = params["prompt"];
|
|
11987
|
+
if (typeof sessionId !== "string" || typeof requestId !== "string" || typeof prompt !== "string" || prompt.trim().length === 0 || Buffer.byteLength(prompt, "utf8") > GENERATION_MAX_PROMPT_BYTES) {
|
|
11988
|
+
throw RequestError.invalidParams(
|
|
11989
|
+
void 0,
|
|
11990
|
+
"Invalid generation request"
|
|
11991
|
+
);
|
|
11992
|
+
}
|
|
11993
|
+
if (this.generationControllers.has(requestId)) {
|
|
11994
|
+
throw RequestError.invalidParams(
|
|
11995
|
+
void 0,
|
|
11996
|
+
"Duplicate generation requestId"
|
|
11997
|
+
);
|
|
11998
|
+
}
|
|
11999
|
+
const session = this.sessionOrThrow(sessionId);
|
|
12000
|
+
const controller = new AbortController();
|
|
12001
|
+
this.generationControllers.set(requestId, { sessionId, controller });
|
|
12002
|
+
const signal = AbortSignal.any([
|
|
12003
|
+
controller.signal,
|
|
12004
|
+
AbortSignal.timeout(GENERATION_TIMEOUT_MS)
|
|
12005
|
+
]);
|
|
12006
|
+
try {
|
|
12007
|
+
const result = await executeGeneration(
|
|
12008
|
+
session.getConfig(),
|
|
12009
|
+
requestId,
|
|
12010
|
+
prompt,
|
|
12011
|
+
signal,
|
|
12012
|
+
async (event) => {
|
|
12013
|
+
await this.connection.extNotification(
|
|
12014
|
+
"qwen/notify/session/generation/event",
|
|
12015
|
+
{ v: 1, sessionId, requestId, event }
|
|
12016
|
+
);
|
|
12017
|
+
}
|
|
12018
|
+
);
|
|
12019
|
+
return { sessionId, requestId, ...result };
|
|
12020
|
+
} finally {
|
|
12021
|
+
this.generationControllers.delete(requestId);
|
|
12022
|
+
}
|
|
12023
|
+
}
|
|
12024
|
+
case SERVE_CONTROL_EXT_METHODS.sessionGenerationCancel: {
|
|
12025
|
+
const sessionId = params["sessionId"];
|
|
12026
|
+
const requestId = params["requestId"];
|
|
12027
|
+
if (typeof sessionId !== "string" || typeof requestId !== "string") {
|
|
12028
|
+
throw RequestError.invalidParams(
|
|
12029
|
+
void 0,
|
|
12030
|
+
"Invalid generation cancellation request"
|
|
12031
|
+
);
|
|
12032
|
+
}
|
|
12033
|
+
const generation = this.generationControllers.get(requestId);
|
|
12034
|
+
const cancelled = generation?.sessionId === sessionId;
|
|
12035
|
+
if (cancelled) {
|
|
12036
|
+
generation.controller.abort();
|
|
12037
|
+
this.generationControllers.delete(requestId);
|
|
12038
|
+
}
|
|
12039
|
+
return { sessionId, requestId, cancelled };
|
|
12040
|
+
}
|
|
11100
12041
|
case SERVE_CONTROL_EXT_METHODS.sessionBtw: {
|
|
11101
12042
|
const sessionId = params["sessionId"];
|
|
11102
12043
|
if (typeof sessionId !== "string" || sessionId.length === 0) {
|
|
@@ -11394,12 +12335,7 @@ ${outputText}
|
|
|
11394
12335
|
"Invalid or missing config"
|
|
11395
12336
|
);
|
|
11396
12337
|
}
|
|
11397
|
-
|
|
11398
|
-
throw RequestError.invalidParams(
|
|
11399
|
-
void 0,
|
|
11400
|
-
"Invalid or missing originatorClientId"
|
|
11401
|
-
);
|
|
11402
|
-
}
|
|
12338
|
+
const runtimeClientId = typeof originatorClientId === "string" && originatorClientId.length > 0 ? originatorClientId : "daemon";
|
|
11403
12339
|
const manager = this.config.getToolRegistry()?.getMcpClientManager();
|
|
11404
12340
|
if (!manager) {
|
|
11405
12341
|
throw RequestError.internalError(
|
|
@@ -11430,7 +12366,7 @@ ${outputText}
|
|
|
11430
12366
|
const result = await manager.addRuntimeMcpServer(
|
|
11431
12367
|
name,
|
|
11432
12368
|
safeConfig,
|
|
11433
|
-
|
|
12369
|
+
runtimeClientId
|
|
11434
12370
|
);
|
|
11435
12371
|
await Promise.all(
|
|
11436
12372
|
this.getActiveSessions().map(async (session) => {
|
|
@@ -11440,7 +12376,7 @@ ${outputText}
|
|
|
11440
12376
|
await sessionManager.addRuntimeMcpServer(
|
|
11441
12377
|
name,
|
|
11442
12378
|
safeConfig,
|
|
11443
|
-
|
|
12379
|
+
runtimeClientId
|
|
11444
12380
|
);
|
|
11445
12381
|
} catch (sessionErr) {
|
|
11446
12382
|
debugLogger7.warn(
|
|
@@ -11489,12 +12425,7 @@ ${outputText}
|
|
|
11489
12425
|
"Server name must be \u2264256 chars, alphanumeric + underscore/hyphen, and not a reserved JS property name"
|
|
11490
12426
|
);
|
|
11491
12427
|
}
|
|
11492
|
-
|
|
11493
|
-
throw RequestError.invalidParams(
|
|
11494
|
-
void 0,
|
|
11495
|
-
"Invalid or missing originatorClientId"
|
|
11496
|
-
);
|
|
11497
|
-
}
|
|
12428
|
+
const runtimeClientId = typeof originatorClientId === "string" && originatorClientId.length > 0 ? originatorClientId : "daemon";
|
|
11498
12429
|
const manager = this.config.getToolRegistry()?.getMcpClientManager();
|
|
11499
12430
|
if (!manager) {
|
|
11500
12431
|
throw RequestError.internalError(
|
|
@@ -11504,7 +12435,7 @@ ${outputText}
|
|
|
11504
12435
|
}
|
|
11505
12436
|
const result = await manager.removeRuntimeMcpServer(
|
|
11506
12437
|
name,
|
|
11507
|
-
|
|
12438
|
+
runtimeClientId
|
|
11508
12439
|
);
|
|
11509
12440
|
await Promise.all(
|
|
11510
12441
|
this.getActiveSessions().map(async (session) => {
|
|
@@ -11513,7 +12444,7 @@ ${outputText}
|
|
|
11513
12444
|
try {
|
|
11514
12445
|
await sessionManager.removeRuntimeMcpServer(
|
|
11515
12446
|
name,
|
|
11516
|
-
|
|
12447
|
+
runtimeClientId
|
|
11517
12448
|
);
|
|
11518
12449
|
} catch (sessionErr) {
|
|
11519
12450
|
debugLogger7.warn(
|
|
@@ -11539,6 +12470,16 @@ ${outputText}
|
|
|
11539
12470
|
}, "runRefresh");
|
|
11540
12471
|
await runRefresh(async () => await extensionManager.refreshCache());
|
|
11541
12472
|
await runRefresh(async () => await extensionManager.refreshTools());
|
|
12473
|
+
const discoveryConfig = this.workspaceMcpDiscoveryConfig;
|
|
12474
|
+
if (discoveryConfig && discoveryConfig !== config) {
|
|
12475
|
+
const discoveryExtensionManager = discoveryConfig.getExtensionManager();
|
|
12476
|
+
await runRefresh(
|
|
12477
|
+
async () => await discoveryExtensionManager.refreshCache()
|
|
12478
|
+
);
|
|
12479
|
+
await runRefresh(
|
|
12480
|
+
async () => await discoveryExtensionManager.refreshTools()
|
|
12481
|
+
);
|
|
12482
|
+
}
|
|
11542
12483
|
await runRefresh(
|
|
11543
12484
|
async () => await config.getGeminiClient()?.refreshSystemInstruction()
|
|
11544
12485
|
);
|
|
@@ -12516,23 +13457,22 @@ ${outputText}
|
|
|
12516
13457
|
buildAvailableModels(config) {
|
|
12517
13458
|
const rawCurrentModelId = (config.getModel() || this.config.getModel() || "").trim();
|
|
12518
13459
|
const currentAuthType = config.getAuthType();
|
|
12519
|
-
const
|
|
13460
|
+
const modelOptions = buildAcpModelOptions(config.getAllConfiguredModels());
|
|
12520
13461
|
const activeRuntimeSnapshot = config.getActiveRuntimeModelSnapshot?.();
|
|
12521
|
-
const currentModelId =
|
|
12522
|
-
|
|
12523
|
-
activeRuntimeSnapshot
|
|
12524
|
-
|
|
12525
|
-
|
|
12526
|
-
|
|
12527
|
-
|
|
12528
|
-
|
|
12529
|
-
|
|
12530
|
-
|
|
12531
|
-
|
|
12532
|
-
|
|
12533
|
-
|
|
12534
|
-
|
|
12535
|
-
});
|
|
13462
|
+
const currentModelId = getCurrentAcpModelId(
|
|
13463
|
+
modelOptions,
|
|
13464
|
+
activeRuntimeSnapshot?.id ?? rawCurrentModelId,
|
|
13465
|
+
activeRuntimeSnapshot?.authType ?? currentAuthType,
|
|
13466
|
+
activeRuntimeSnapshot ? void 0 : config.getCurrentModelRegistryBaseUrl?.()
|
|
13467
|
+
);
|
|
13468
|
+
const mappedAvailableModels = modelOptions.map(({ model, modelId }) => ({
|
|
13469
|
+
modelId,
|
|
13470
|
+
name: model.label,
|
|
13471
|
+
description: model.description ?? null,
|
|
13472
|
+
_meta: {
|
|
13473
|
+
contextLimit: model.contextWindowSize ?? tokenLimit(model.id)
|
|
13474
|
+
}
|
|
13475
|
+
}));
|
|
12536
13476
|
return {
|
|
12537
13477
|
currentModelId,
|
|
12538
13478
|
availableModels: mappedAvailableModels
|
|
@@ -12552,14 +13492,16 @@ ${outputText}
|
|
|
12552
13492
|
}
|
|
12553
13493
|
buildConfigOptions(config) {
|
|
12554
13494
|
const currentApprovalMode = config.getApprovalMode();
|
|
12555
|
-
const
|
|
13495
|
+
const modelOptions = buildAcpModelOptions(config.getAllConfiguredModels());
|
|
12556
13496
|
const rawCurrentModelId = (config.getModel() || "").trim();
|
|
12557
13497
|
const currentAuthType = config.getAuthType?.();
|
|
12558
13498
|
const activeRuntimeSnapshot = config.getActiveRuntimeModelSnapshot?.();
|
|
12559
|
-
const currentModelId =
|
|
12560
|
-
|
|
12561
|
-
activeRuntimeSnapshot
|
|
12562
|
-
|
|
13499
|
+
const currentModelId = getCurrentAcpModelId(
|
|
13500
|
+
modelOptions,
|
|
13501
|
+
activeRuntimeSnapshot?.id ?? rawCurrentModelId,
|
|
13502
|
+
activeRuntimeSnapshot?.authType ?? currentAuthType,
|
|
13503
|
+
activeRuntimeSnapshot ? void 0 : config.getCurrentModelRegistryBaseUrl?.()
|
|
13504
|
+
);
|
|
12563
13505
|
const modeOptions = APPROVAL_MODES.map((mode) => ({
|
|
12564
13506
|
value: mode,
|
|
12565
13507
|
name: APPROVAL_MODE_INFO[mode].name,
|
|
@@ -12574,14 +13516,11 @@ ${outputText}
|
|
|
12574
13516
|
currentValue: currentApprovalMode,
|
|
12575
13517
|
options: modeOptions
|
|
12576
13518
|
};
|
|
12577
|
-
const
|
|
12578
|
-
|
|
12579
|
-
|
|
12580
|
-
|
|
12581
|
-
|
|
12582
|
-
description: model.description ?? ""
|
|
12583
|
-
};
|
|
12584
|
-
});
|
|
13519
|
+
const configModelOptions = modelOptions.map(({ model, modelId }) => ({
|
|
13520
|
+
value: modelId,
|
|
13521
|
+
name: model.label,
|
|
13522
|
+
description: model.description ?? ""
|
|
13523
|
+
}));
|
|
12585
13524
|
const modelConfigOption = {
|
|
12586
13525
|
id: "model",
|
|
12587
13526
|
name: "Model",
|
|
@@ -12589,19 +13528,11 @@ ${outputText}
|
|
|
12589
13528
|
category: "model",
|
|
12590
13529
|
type: "select",
|
|
12591
13530
|
currentValue: currentModelId,
|
|
12592
|
-
options:
|
|
13531
|
+
options: configModelOptions
|
|
12593
13532
|
};
|
|
12594
13533
|
return [modeConfigOption, modelConfigOption];
|
|
12595
13534
|
}
|
|
12596
|
-
formatCurrentModelId(baseModelId, authType) {
|
|
12597
|
-
if (!baseModelId) return baseModelId;
|
|
12598
|
-
return authType ? formatAcpModelId(baseModelId, authType) : baseModelId;
|
|
12599
|
-
}
|
|
12600
13535
|
};
|
|
12601
|
-
function isMainSelectableModel(model) {
|
|
12602
|
-
return model.fastOnly !== true && model.voiceOnly !== true;
|
|
12603
|
-
}
|
|
12604
|
-
__name(isMainSelectableModel, "isMainSelectableModel");
|
|
12605
13536
|
function diffSettingsKeys(oldMerged, newMerged) {
|
|
12606
13537
|
const changed = /* @__PURE__ */ new Set();
|
|
12607
13538
|
const allKeys = /* @__PURE__ */ new Set([
|
|
@@ -12634,6 +13565,11 @@ export {
|
|
|
12634
13565
|
* Copyright 2025 Qwen Team
|
|
12635
13566
|
* SPDX-License-Identifier: Apache-2.0
|
|
12636
13567
|
*/
|
|
13568
|
+
/**
|
|
13569
|
+
* @license
|
|
13570
|
+
* Copyright 2026 Qwen
|
|
13571
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
13572
|
+
*/
|
|
12637
13573
|
/**
|
|
12638
13574
|
* @license
|
|
12639
13575
|
* Copyright 2025 Qwen
|