@qwen-code/qwen-code 0.23.3 → 0.23.4-dev.codemode-responses.20260914.87437db784
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/computer-use/SKILL.md +46 -198
- package/bundled/computer-use/references/macos.md +208 -0
- package/bundled/computer-use/references/windows-linux.md +247 -0
- package/bundled/goal-draft/SKILL.md +10 -10
- package/bundled/qc-helper/docs/configuration/settings.md +81 -71
- package/bundled/qc-helper/docs/extension/getting-started-extensions.md +2 -0
- package/bundled/qc-helper/docs/extension/introduction.md +9 -3
- package/bundled/qc-helper/docs/features/_meta.ts +1 -0
- package/bundled/qc-helper/docs/features/agent-board.md +89 -0
- package/bundled/qc-helper/docs/features/channels/dingtalk.md +3 -21
- package/bundled/qc-helper/docs/features/channels/dws.md +5 -1
- package/bundled/qc-helper/docs/features/channels/overview.md +5 -6
- package/bundled/qc-helper/docs/features/code-review.md +18 -4
- package/bundled/qc-helper/docs/features/commands.md +9 -0
- package/bundled/qc-helper/docs/features/computer-use.md +26 -8
- package/bundled/qc-helper/docs/features/cross-session-protocol.md +23 -5
- package/bundled/qc-helper/docs/features/followup-suggestions.md +17 -5
- package/bundled/qc-helper/docs/features/goals.md +22 -18
- package/bundled/qc-helper/docs/features/hooks.md +48 -37
- package/bundled/qc-helper/docs/features/skills.md +33 -3
- package/bundled/qc-helper/docs/features/status-line.md +2 -0
- package/bundled/qc-helper/docs/features/sub-agents.md +27 -0
- package/bundled/qc-helper/docs/qwen-serve.md +7 -3
- package/bundled/review/SKILL.md +20 -10
- package/bundled/review/references/persistence.md +2 -0
- package/bundled/workflow-authoring/SKILL.md +442 -0
- package/bundled/workflow-creator/SKILL.md +1 -1
- package/chunks/{MaxSizedBox-D4LW7RZZ.js → MaxSizedBox-CSMC6NNQ.js} +59 -55
- package/chunks/{StandaloneSessionPicker-ALTTRWUP.js → StandaloneSessionPicker-5G46NROB.js} +83 -79
- package/chunks/{acp-startup-profiler-KEU6VAYR.js → acp-startup-profiler-RUQNTNU5.js} +2 -2
- package/chunks/acp-subagent-executor-4JLSF7SA.js +141 -0
- package/chunks/{acpAgent-BBSW7XZG.js → acpAgent-WJ45JV2S.js} +1026 -355
- package/chunks/{agent-SQ6OY3QD.js → agent-KWNOVXAD.js} +43 -39
- package/chunks/{agent-headless-RI2THRQ7.js → agent-headless-TU5N3GFF.js} +43 -39
- package/chunks/{anthropicContentGenerator-JSKMKS6V.js → anthropicContentGenerator-H5YPXIDE.js} +37 -15
- package/chunks/{artifact-tool-PMYZCYNH.js → artifact-tool-MFGORTWZ.js} +59 -109
- package/chunks/{askUserQuestion-4M4YYIB4.js → askUserQuestion-WS4GUT7C.js} +3 -3
- package/chunks/{bridge-DAFMI72L.js → bridge-PF7UX6MH.js} +63 -58
- package/chunks/{build-63BIOYWK.js → build-5KWQBWEQ.js} +1 -1
- package/chunks/{ca-KC2AISNS.js → ca-GZ4FDJU2.js} +3 -3
- package/chunks/{channel-management-service-OWDXVL7R.js → channel-management-service-AFVIT4VH.js} +8 -8
- package/chunks/{channel-settings-store-4I6JONT7.js → channel-settings-store-3OVAGIC2.js} +68 -64
- package/chunks/{channel-worker-group-F2ZZMLNS.js → channel-worker-group-JR6JOELM.js} +8 -8
- package/chunks/{channel-worker-manager-2SZLJJSJ.js → channel-worker-manager-AVKJEZFL.js} +8 -8
- package/chunks/{channel-worker-supervisor-ZFNWMG6D.js → channel-worker-supervisor-OOYY7BAQ.js} +5 -5
- package/chunks/{chunk-6JACAGYH.js → chunk-2S2WIGCM.js} +1 -1
- package/chunks/{chunk-NRXWJXJ4.js → chunk-2YGR3VN6.js} +15 -15
- package/chunks/{chunk-IUVIBDKU.js → chunk-2YMRRI2C.js} +9 -10
- package/chunks/{chunk-3BTSSIJO.js → chunk-3DOAKZYD.js} +99 -14
- package/chunks/{chunk-F53KKZUD.js → chunk-3LMDSCLU.js} +158 -10
- package/chunks/{chunk-2ZN3O5FT.js → chunk-457DR2MC.js} +6 -6
- package/chunks/{chunk-WG7BL3FY.js → chunk-473RJLIH.js} +1 -1
- package/chunks/{chunk-W5ZQMAEM.js → chunk-4Y2I3CI3.js} +1 -1
- package/chunks/{chunk-HGEUHUEV.js → chunk-54B2LTKP.js} +1 -1
- package/chunks/{chunk-IRH27ZC2.js → chunk-5EZRLTLQ.js} +4 -4
- package/chunks/{chunk-DLH7YIX6.js → chunk-5FK4MSHB.js} +3 -3
- package/chunks/{chunk-CUEXOHQH.js → chunk-5ODRE7E5.js} +9 -15
- package/chunks/{chunk-532WHF4F.js → chunk-5VQR2DD7.js} +2 -2
- package/chunks/{chunk-3KQBQ6FM.js → chunk-63WKMKVD.js} +190 -28
- package/chunks/{chunk-YBUMTY7B.js → chunk-66N6C4EH.js} +1 -1
- package/chunks/{chunk-MLQNSPRZ.js → chunk-6MLDTOHU.js} +15 -5
- package/chunks/{chunk-SBRX4BDI.js → chunk-6NKDU7YL.js} +2 -2
- package/chunks/{chunk-3UXUOFO6.js → chunk-6TMXX4Z4.js} +9 -10
- package/chunks/{chunk-Y2MYW47X.js → chunk-6WXVEDT2.js} +9 -2
- package/chunks/{chunk-ZHKTKHMO.js → chunk-7MIBD3LG.js} +1 -1
- package/chunks/{chunk-EVTNACMT.js → chunk-A6QMKS5S.js} +12 -12
- package/chunks/{chunk-NOAG7N22.js → chunk-A6YU6R5N.js} +2 -2
- package/chunks/{chunk-76RGWKLS.js → chunk-ABNX6E6K.js} +1 -1
- package/chunks/chunk-ACHCT36C.js +28 -0
- package/chunks/{chunk-NE624IVP.js → chunk-ADQUK6WA.js} +1 -1
- package/chunks/{chunk-PLLIWEM3.js → chunk-AEWCOE64.js} +2 -2
- package/chunks/{chunk-3FPYT6QC.js → chunk-ARDHE6MM.js} +23 -0
- package/chunks/{chunk-LILGKQ4B.js → chunk-AXZMWAJV.js} +156 -26
- package/chunks/{chunk-SYLECP23.js → chunk-B776VKDA.js} +4 -4
- package/chunks/{chunk-AC6KDLH3.js → chunk-BNYQHLPR.js} +1 -1
- package/chunks/{chunk-BZM5U74J.js → chunk-BS7ON54G.js} +724 -468
- package/chunks/{chunk-TPKQIA7G.js → chunk-BSIOCNDK.js} +1 -1
- package/chunks/{chunk-U7O65WKL.js → chunk-BW2SMO6L.js} +1 -1
- package/chunks/{chunk-POC3YMHG.js → chunk-BY6CE34S.js} +4 -4
- package/chunks/{chunk-RLLRJJDR.js → chunk-C3VNHDWJ.js} +2 -2
- package/chunks/{chunk-WBCPROWX.js → chunk-C4HBZQNH.js} +1 -1
- package/chunks/{chunk-MSNHNAQZ.js → chunk-C5ABXOC2.js} +3 -3
- package/chunks/{chunk-NOO4QFXM.js → chunk-C75BXMPM.js} +1 -3
- package/chunks/chunk-CCWWPFZJ.js +191 -0
- package/chunks/chunk-CFMZLE3L.js +75 -0
- package/chunks/{chunk-N7VWZDWW.js → chunk-CFSBWJBB.js} +4462 -3840
- package/chunks/{chunk-KOKPXIAN.js → chunk-CL7JONZN.js} +3 -3
- package/chunks/{chunk-AXTFYDXT.js → chunk-CXXAZ2LZ.js} +1 -1
- package/chunks/{chunk-JYKWOREU.js → chunk-DBUOMHLZ.js} +13 -3
- package/chunks/{chunk-R4Q2PEFV.js → chunk-DLJBYORJ.js} +1 -1
- package/chunks/{chunk-DT75RKNH.js → chunk-DNVA2MQ2.js} +3 -3
- package/chunks/{chunk-J3TJH52D.js → chunk-DOTF2PF2.js} +1 -1
- package/chunks/{chunk-HGAELO7B.js → chunk-DQMBQCTY.js} +2 -2
- package/chunks/{chunk-2ALXPGB4.js → chunk-E6IR653O.js} +1 -1
- package/chunks/{chunk-ZKYR7QS4.js → chunk-EDB556X7.js} +2 -2
- package/chunks/chunk-EKJXDLDD.js +32 -0
- package/chunks/{chunk-NUQVB25K.js → chunk-EKMJR7M3.js} +2 -2
- package/chunks/{chunk-7QYWGTHB.js → chunk-EPVEPTI3.js} +44 -151
- package/chunks/{chunk-GCDXVPFK.js → chunk-EZSSJSKR.js} +31 -7
- package/chunks/{chunk-S6Q6Q4P2.js → chunk-FBDHP23D.js} +1 -1
- package/chunks/{chunk-UKZ45TJL.js → chunk-FFBP5POK.js} +420 -219
- package/chunks/{chunk-3I7W2POO.js → chunk-FGROOEKM.js} +5 -40
- package/chunks/{chunk-HNLMYDQE.js → chunk-FMLBBXHB.js} +13 -9
- package/chunks/{chunk-SSGAAWLY.js → chunk-GCV4NOHV.js} +95 -73
- package/chunks/{chunk-ALMR3E6Q.js → chunk-GDWE23OR.js} +3 -3
- package/chunks/{chunk-XBZTAGB7.js → chunk-GMN73IMT.js} +1 -1
- package/chunks/{chunk-IAEXTMED.js → chunk-GNV2SFO7.js} +173 -7
- package/chunks/{chunk-CXTPVBFA.js → chunk-GSS4SZNG.js} +100 -17
- package/chunks/chunk-GXN7DWZZ.js +154 -0
- package/chunks/{chunk-SODMFNAR.js → chunk-H23UWPF7.js} +5 -5
- package/chunks/{chunk-6HUXPLB5.js → chunk-HEOH7JZY.js} +5 -5
- package/chunks/{chunk-DTNV6UZY.js → chunk-HFJSQ4GL.js} +10 -24
- package/chunks/{chunk-GOXQL4YH.js → chunk-HWRXJQ6B.js} +2 -2
- package/chunks/{chunk-VZUCTJ2P.js → chunk-I6YJZGHS.js} +10 -10
- package/chunks/{chunk-RZHU3K6M.js → chunk-IAS753HG.js} +2 -20
- package/chunks/{chunk-EDMXGXAK.js → chunk-IBRQG2MP.js} +10 -13
- package/chunks/chunk-INGBUYL6.js +230 -0
- package/chunks/{chunk-7BXXIQG4.js → chunk-J73WJIMT.js} +36 -72
- package/chunks/{chunk-XGYHNWL3.js → chunk-J7LBAKDH.js} +3 -3
- package/chunks/{chunk-Z3GF56ME.js → chunk-JAYWZWZF.js} +3 -3
- package/chunks/{chunk-DYFOSJHU.js → chunk-JBFC2644.js} +2756 -1153
- package/chunks/{chunk-Q5BD56BW.js → chunk-JPCYCFYG.js} +7 -7
- package/chunks/{chunk-LG5Y4OWO.js → chunk-JRHKM3YQ.js} +2 -2
- package/chunks/{chunk-NHCZJQE4.js → chunk-JZKBMADP.js} +6 -6
- package/chunks/{chunk-MF6E7FSA.js → chunk-K7CQWBLT.js} +8 -201
- package/chunks/{chunk-K2OJUPOE.js → chunk-KP2FHIFR.js} +12 -0
- package/chunks/{chunk-ZU47FBOC.js → chunk-KSIOXYVX.js} +126 -12
- package/chunks/{chunk-IV7GDNKC.js → chunk-KZCK5JUN.js} +4 -4
- package/chunks/{chunk-3XLK2QMY.js → chunk-L3S2Y2FF.js} +59 -16
- package/chunks/{chunk-ZW2EUO2A.js → chunk-L6DIANLD.js} +1 -1
- package/chunks/{chunk-6W4HBUA2.js → chunk-LATAUG2M.js} +1 -1
- package/chunks/{chunk-RWVD5RRY.js → chunk-LBDASOPR.js} +3 -3
- package/chunks/{chunk-OX7IZ2G5.js → chunk-LF5AD7PY.js} +4 -4
- package/chunks/{chunk-NMRCXKQ5.js → chunk-LKCNETDW.js} +3 -3
- package/chunks/chunk-LMJSPC55.js +260 -0
- package/chunks/{chunk-X6K77VHC.js → chunk-LWWRJRCD.js} +1 -1
- package/chunks/{chunk-UXEO7E3V.js → chunk-LYD3T3H7.js} +1 -0
- package/chunks/{chunk-KFZYGSJN.js → chunk-M3YNPR56.js} +3 -3
- package/chunks/{chunk-HBQ2NXOU.js → chunk-MDG6GKSE.js} +2 -2
- package/chunks/{chunk-E4UEO3XM.js → chunk-ME4JBHSB.js} +324 -2
- package/chunks/{chunk-BV6Q5HMY.js → chunk-MJHLKWGJ.js} +8 -7
- package/chunks/{chunk-NFYEQRLG.js → chunk-MQRLLBMQ.js} +1 -1
- package/chunks/{chunk-O4KNCAX4.js → chunk-NCPFOLM2.js} +11 -0
- package/chunks/{chunk-2SZH22YO.js → chunk-NJ2OFVUX.js} +115 -97
- package/chunks/{chunk-DAWWT2ID.js → chunk-NN4EC2WO.js} +1374 -2164
- package/chunks/{chunk-6MBXY6WM.js → chunk-NRQI3PGS.js} +1 -1
- package/chunks/{chunk-HBU7EKY4.js → chunk-NRUKL236.js} +45 -15
- package/chunks/{chunk-53GWJOLP.js → chunk-NTCFKGQF.js} +3 -1
- package/chunks/{chunk-3CZ2BQV6.js → chunk-NXUZFW3G.js} +49 -19
- package/chunks/{chunk-X7UJKOHZ.js → chunk-OMDXAHCT.js} +4 -6
- package/chunks/{chunk-5GLDOLNQ.js → chunk-OWUAZXXN.js} +4 -3
- package/chunks/{chunk-2UWQX4FP.js → chunk-OZEV3R3S.js} +1 -1
- package/chunks/{acp-subagent-executor-LEUN3N7N.js → chunk-PAPBT3WP.js} +11 -110
- package/chunks/{chunk-7ICHPMBQ.js → chunk-PHSQVB6D.js} +4 -4
- package/chunks/{chunk-FCQJLMA2.js → chunk-Q3TFRP5G.js} +178 -8
- package/chunks/{chunk-YQHLFCPU.js → chunk-Q5CCYZD3.js} +32 -24
- package/chunks/chunk-QQL5BFOL.js +1416 -0
- package/chunks/{chunk-ZKZHSB5W.js → chunk-QR4Q425T.js} +9 -9
- package/chunks/{chunk-J6MB5ZHZ.js → chunk-QZW6WRB7.js} +2 -1
- package/chunks/{chunk-TP6FYVQT.js → chunk-RSWBT7AZ.js} +33 -1
- package/chunks/{chunk-2PJRI3EH.js → chunk-RVOD66ID.js} +218 -43
- package/chunks/{chunk-W5FIP7FC.js → chunk-S3PU3CNW.js} +5 -5
- package/chunks/chunk-S7UQ3V2H.js +87 -0
- package/chunks/{chunk-N6VQ37ZZ.js → chunk-SFL6U7U7.js} +1 -1
- package/chunks/{chunk-MOS5OAOG.js → chunk-SROLVJFY.js} +6 -6
- package/chunks/{chunk-HUXPEUFL.js → chunk-SYROIHU7.js} +1 -1
- package/chunks/{chunk-E7LB57MB.js → chunk-T3LUMYFP.js} +6 -6
- package/chunks/{chunk-PSPAM24S.js → chunk-TBSCTWKF.js} +6 -0
- package/chunks/{chunk-5KI7ZDTB.js → chunk-TV5WDW7R.js} +24 -12
- package/chunks/{chunk-NMCDMLHL.js → chunk-TXUJOKVR.js} +50 -35
- package/chunks/{chunk-NHJKAR6E.js → chunk-TYWLBEL2.js} +972 -18
- package/chunks/chunk-U6H3XTFA.js +95 -0
- package/chunks/{chunk-GSILBZLN.js → chunk-U7RWQBGZ.js} +2 -2
- package/chunks/{chunk-7APZIRH3.js → chunk-V3CMBOQ6.js} +5 -5
- package/chunks/{chunk-JXNIF2O5.js → chunk-V545KI73.js} +1 -1
- package/chunks/chunk-VGY2RGXL.js +100 -0
- package/chunks/{chunk-TBEXLLAO.js → chunk-VRQZESKP.js} +1 -1
- package/chunks/{chunk-FN3JNDRU.js → chunk-VVI7MK3V.js} +3 -3
- package/chunks/{chunk-EUURTIV6.js → chunk-WBSJ6VPZ.js} +10 -2
- package/chunks/{chunk-NLNQNBZ2.js → chunk-WD6YQI5M.js} +1 -1
- package/chunks/chunk-WFNEY5G7.js +347 -0
- package/chunks/{chunk-XKBFYTCD.js → chunk-WK6DEH3Q.js} +46 -0
- package/chunks/{chunk-36HCNKDS.js → chunk-WKVZES7O.js} +65 -14
- package/chunks/{chunk-BWAMMKIS.js → chunk-WLLRNQVT.js} +135 -6
- package/chunks/{chunk-MHAADZOZ.js → chunk-WMSP3XZK.js} +3 -3
- package/chunks/{chunk-IL5M5NYD.js → chunk-WUTXSXPP.js} +11 -9
- package/chunks/{chunk-NJQTG2G3.js → chunk-XE5ZFBVD.js} +11 -11
- package/chunks/{chunk-OLTN767L.js → chunk-XO3Z27IL.js} +2 -2
- package/chunks/{chunk-VX63RJXE.js → chunk-XX5HQLCZ.js} +7 -0
- package/chunks/{chunk-2Z3T52OC.js → chunk-Y5TM7SBV.js} +7 -2
- package/chunks/{chunk-V2P3DOQR.js → chunk-YDFOHRS5.js} +1 -1
- package/chunks/{chunk-QMUYLYT5.js → chunk-YGFJ6BRT.js} +1 -1
- package/chunks/{chunk-LK2WUCDQ.js → chunk-YM6KUQ2S.js} +1 -1
- package/chunks/{chunk-F42YYSCK.js → chunk-YVF4PKCV.js} +8 -8
- package/chunks/{chunk-LDVNJZGH.js → chunk-Z2H5HQS3.js} +17 -8
- package/chunks/chunk-Z72PLR74.js +36 -0
- package/chunks/{chunk-BWQLXU37.js → chunk-ZDHXRKRG.js} +381 -86
- package/chunks/{chunk-BHTYRHJF.js → chunk-ZJ7JQUGY.js} +4 -1
- package/chunks/{chunk-4ALNJDHL.js → chunk-ZKIAGIGH.js} +87 -4
- package/chunks/{chunk-VG3Q2NC4.js → chunk-ZNI3YJHS.js} +32 -12
- package/chunks/chunk-ZRZZLM37.js +2780 -0
- package/chunks/{chunk-Q2LVVIKF.js → chunk-ZZUXUBEB.js} +29 -12
- package/chunks/codex-subagent-executor-SM3TUSBA.js +586 -0
- package/chunks/{config-utils-L6KLDYIV.js → config-utils-JHKHFOG6.js} +60 -56
- package/chunks/{contextCommand-UYEH7NIU.js → contextCommand-XE4NDYQW.js} +58 -54
- package/chunks/{core-runtime-NVHT3Z3V.js → core-runtime-PNCWH3RE.js} +58 -55
- package/chunks/{create-sub-session-TIGCFGCS.js → create-sub-session-MSGNIM37.js} +5 -2
- package/chunks/{create-sub-session-YWASE5VH.js → create-sub-session-P7E5Y3HY.js} +169 -89
- package/chunks/{cron-create-AKWX67FO.js → cron-create-U2JJ5CCF.js} +3 -3
- package/chunks/{cron-delete-XPB6IYZJ.js → cron-delete-7DM4LJWD.js} +2 -2
- package/chunks/{cron-list-XBKO4WU5.js → cron-list-VCUSZK2Y.js} +2 -2
- package/chunks/{daemon-G5TYKZD6.js → daemon-NJB4PWZ7.js} +3 -1
- package/chunks/{daemon-git-worktree-guard-FOW4RQSK.js → daemon-git-worktree-guard-JFD5VZRN.js} +58 -54
- package/chunks/{daemon-status-provider-O5KQZYMP.js → daemon-status-provider-A3VFVFWW.js} +68 -63
- package/chunks/{daemon-trust-policy-3ATXEON7.js → daemon-trust-policy-NPZ47MZH.js} +64 -60
- package/chunks/{daemon-trust-policy-monitor-7MCNDNEC.js → daemon-trust-policy-monitor-XG2CHL3Z.js} +64 -60
- package/chunks/{de-UU2YTO37.js → de-VGY3VNBU.js} +3 -3
- package/chunks/{deferred-core-runtime-JK5IXL5K.js → deferred-core-runtime-V42EMU27.js} +56 -52
- package/chunks/{discovery-XP4RMDUM.js → discovery-5KUEPR65.js} +2 -2
- package/chunks/{display-image-NAH3AZ63.js → display-image-QTHALY6N.js} +3 -3
- package/chunks/{dist-KLZ7XGEQ.js → dist-2QYIVNS6.js} +1 -4
- package/chunks/{dist-AHJYPSJL.js → dist-GUB7QRYA.js} +2 -5
- package/chunks/{dist-ZXTZTE54.js → dist-MPUZZOG5.js} +4 -17
- package/chunks/{dist-F2DVGTL3.js → dist-NIOJXMGY.js} +111 -101
- package/chunks/{dist-KJGRVIGJ.js → dist-PA7WPFVE.js} +5 -36
- package/chunks/{dist-AIKC5E5P.js → dist-SE4J6Z4O.js} +43 -669
- package/chunks/{dist-H6G3K26N.js → dist-T6DDPDLQ.js} +14 -34
- package/chunks/{dist-GWNQVPZT.js → dist-TFGETXFN.js} +10 -33
- package/chunks/{dist-ZA52JXAS.js → dist-VDLSBCLM.js} +1 -5
- package/chunks/{edit-SY35KYIE.js → edit-E2ZGJDBJ.js} +46 -42
- package/chunks/{en-CAJHTIQT.js → en-E5ZO5TZW.js} +5 -3
- package/chunks/{enter-worktree-54L5QJ3N.js → enter-worktree-CAARFWBI.js} +6 -5
- package/chunks/{enterPlanMode-HXX6KQJR.js → enterPlanMode-442YAAZB.js} +43 -39
- package/chunks/{environment-DKXHG4HB.js → environment-DCJ5FVHM.js} +59 -55
- package/chunks/{errors-ADY7LQJJ.js → errors-ZWTDW2NJ.js} +58 -54
- package/chunks/exec-RPKEY6HP.js +505 -0
- package/chunks/{exit-worktree-EORJDKDS.js → exit-worktree-JXGGUOBP.js} +6 -5
- package/chunks/{exitPlanMode-HSK2CQI6.js → exitPlanMode-4PLQOFOO.js} +43 -39
- package/chunks/{fast-path-U636VWN2.js → fast-path-DBSGDGB3.js} +10 -10
- package/chunks/{fast-path-settings-V7MI7EZJ.js → fast-path-settings-XDYX7X5Z.js} +2 -2
- package/chunks/{fr-HKNWVXRJ.js → fr-UAZJJH5N.js} +3 -3
- package/chunks/{glob-GUGGTH5L.js → glob-VWOE4W7K.js} +43 -39
- package/chunks/{goal-tools-PXYRSQGX.js → goal-tools-K6SIBXMB.js} +49 -41
- package/chunks/{grep-3PKFKLCA.js → grep-H2I33VAO.js} +8 -3
- package/chunks/{handleAutoUpdate-5KHS4HIN.js → handleAutoUpdate-NCC3XELY.js} +61 -57
- package/chunks/{i18n-KSGKMUPT.js → i18n-GO7JI4PT.js} +57 -53
- package/chunks/{image-gen-OCCR2WWU.js → image-gen-5G2TQ3DY.js} +6 -5
- package/chunks/{initializer-YYT5XEZF.js → initializer-BXKAW5A6.js} +64 -60
- package/chunks/{installationInfo-UNSBPYW2.js → installationInfo-5JONIX62.js} +57 -53
- package/chunks/{ja-GJS5RZGU.js → ja-2RITCMAJ.js} +3 -3
- package/chunks/list-QW74LCLS.js +133 -0
- package/chunks/{list-agents-QLDXS5OD.js → list-agents-EWDCEPIW.js} +3 -3
- package/chunks/{llm-XGGLBGPH.js → llm-FJHSMJTM.js} +161 -125
- package/chunks/{llm-content-generator-ZHQQT5W7.js → llm-content-generator-3VLLPQS4.js} +14 -7
- package/chunks/{loadedSettingsAdapter-3DXLASK7.js → loadedSettingsAdapter-OLMQSKVC.js} +64 -60
- package/chunks/{loggingContentGenerator-V72OCCJO.js → loggingContentGenerator-IMLIJULY.js} +47 -43
- package/chunks/{loop-wakeup-HHMYIC7Z.js → loop-wakeup-VG6CGBQA.js} +4 -4
- package/chunks/{ls-N7ABR6HI.js → ls-6ZB3BEIR.js} +1 -1
- package/chunks/{lsp-LTOFWG5P.js → lsp-M54FQARP.js} +5 -1
- package/chunks/{managed-npm-update-HV5LPZH2.js → managed-npm-update-LXLBWCNA.js} +57 -53
- package/chunks/mcp-FOXA3372.js +127 -0
- package/chunks/model-configuration-SCOI2KPF.js +140 -0
- package/chunks/modelConfigUtils-EA44S64C.js +119 -0
- package/chunks/{monitor-TLBNM4MV.js → monitor-TJAHYCCY.js} +43 -39
- package/chunks/{nonInteractiveCli-LSJSQ2W4.js → nonInteractiveCli-QH2HABWC.js} +112 -107
- package/chunks/{notebook-edit-OSPOLZP6.js → notebook-edit-WEMSBUBS.js} +45 -41
- package/chunks/{openaiContentGenerator-BE4S5TRD.js → openaiContentGenerator-WD5DWYOA.js} +24 -19
- package/chunks/{openaiResponsesContentGenerator-RTCAJ5V5.js → openaiResponsesContentGenerator-AWRYZLJU.js} +110 -19
- package/chunks/{pidfile-H32FEPWA.js → pidfile-TQL2LCEG.js} +56 -52
- package/chunks/{processUtils-SSLIPDEA.js → processUtils-6ZU56DCI.js} +2 -2
- package/chunks/{prompt-terminal-ledger-I5SLL6UF.js → prompt-terminal-ledger-3HAKHXFV.js} +57 -53
- package/chunks/{pt-FXMYXEUV.js → pt-5ZF7ZQUV.js} +3 -3
- package/chunks/{qwenContentGenerator-TMQC623Z.js → qwenContentGenerator-3OIZQZLC.js} +47 -43
- package/chunks/{qwenOAuth2-3ZRQHHTC.js → qwenOAuth2-WIEUEFEY.js} +5 -4
- package/chunks/{read-file-T2QAIZE2.js → read-file-2PWWL6J2.js} +9 -8
- package/chunks/{read-mcp-resource-B37WANAQ.js → read-mcp-resource-LPSWXVOD.js} +1 -1
- package/chunks/{record-artifact-OAXWXZ5D.js → record-artifact-PXMNP7GZ.js} +3 -3
- package/chunks/{record-source-D7R7X3GT.js → record-source-2GSY5JD5.js} +6 -6
- package/chunks/{report-findings-AR3VC6EQ.js → report-findings-W6GR7SYZ.js} +4 -4
- package/chunks/{request-shutdown-IKNWTX5M.js → request-shutdown-53SNYGVR.js} +5 -5
- package/chunks/{resumeHistoryUtils-QLKDH5GY.js → resumeHistoryUtils-S4TEUTKE.js} +63 -59
- package/chunks/{ripGrep-YGWL7KCV.js → ripGrep-5NMGLMLX.js} +13 -11
- package/chunks/{ru-RMHURE5U.js → ru-7BNZFQKG.js} +3 -3
- package/chunks/{run-qwen-serve-26KZDECC.js → run-qwen-serve-6MGYRK4V.js} +314 -127
- package/chunks/{runtime-BMEIVDDG.js → runtime-ZJYUQCPP.js} +69 -65
- package/chunks/{scheduled-tasks-NCFPP6VQ.js → scheduled-tasks-5MKF4EV3.js} +66 -60
- package/chunks/{scheduler-47TVMUVN.js → scheduler-72DZWRH5.js} +58 -54
- package/chunks/{sdk-exporters-http-VWTF4W6K.js → sdk-exporters-http-3R2TRQHE.js} +2 -1
- package/chunks/{sdk-impl-G6FVTBQZ.js → sdk-impl-4WF3VZ2F.js} +3 -3
- package/chunks/{send-message-TWOGWCBG.js → send-message-UMJKN27Q.js} +7 -7
- package/chunks/{serve-KL3G6LQQ.js → serve-7ZDMMA7I.js} +66 -62
- package/chunks/{server-LBPYXZ5G.js → server-ONK5RTEV.js} +783 -350
- package/chunks/{session-YG6742LO.js → session-XQW2LM4S.js} +117 -112
- package/chunks/{session-attachments-root-OUBQDYC4.js → session-attachments-root-Q5IUCMQV.js} +56 -52
- package/chunks/{session-pr-refresh-EKGMYNAW.js → session-pr-refresh-MVECWT3W.js} +66 -60
- package/chunks/{settings-DDNHJX2L.js → settings-DL6K2HQ3.js} +67 -63
- package/chunks/{shell-KUCXWITU.js → shell-BLP25QJU.js} +43 -39
- package/chunks/{skill-JQLKPNWZ.js → skill-7KURUNLD.js} +128 -23
- package/chunks/{skill-settings-XERQCUXZ.js → skill-settings-MY76LM46.js} +72 -60
- package/chunks/{spawnChannel-GQ45QFGB.js → spawnChannel-IJLH3Z74.js} +60 -55
- package/chunks/{standalone-update-PRF3ILGZ.js → standalone-update-YQKN7VNO.js} +58 -54
- package/chunks/{start-opentui-ui-JDSOZE3N.js → start-opentui-ui-ORNGKZTG.js} +2693 -2160
- package/chunks/{startInteractiveUI-RRW3JVHN.js → startInteractiveUI-PRLIKB4U.js} +1610 -1773
- package/chunks/{syntheticOutput-F6F27JMK.js → syntheticOutput-EX5L5GYI.js} +2 -2
- package/chunks/{task-create-Y623TBHB.js → task-create-75HVPEAH.js} +7 -7
- package/chunks/{task-list-FCPEEGWL.js → task-list-ZLJSMRFA.js} +2 -2
- package/chunks/{task-stop-QTKZXLPH.js → task-stop-MD7P6QGK.js} +1 -1
- package/chunks/{task-update-YLSXF25N.js → task-update-RI7QNVDP.js} +20 -13
- package/chunks/{team-create-5DRLOLOE.js → team-create-ANLKOQ44.js} +43 -39
- package/chunks/{team-delete-S7TLHZCF.js → team-delete-RIDINW6I.js} +1 -1
- package/chunks/{team-plan-approval-MWSGAL5T.js → team-plan-approval-EFUENI6Y.js} +43 -39
- package/chunks/{terminal-image-renderer-H7PD4FQW.js → terminal-image-renderer-CXMFIWKC.js} +58 -54
- package/chunks/{theme-manager-7AV73D6R.js → theme-manager-JUFYQDQQ.js} +56 -52
- package/chunks/{todoWrite-5QI2H2FW.js → todoWrite-XSTG2VT5.js} +6 -3
- package/chunks/{tool-search-UGYTBLUV.js → tool-search-SNCEA4VA.js} +17 -12
- package/chunks/{total-session-admission-JIHSTJ5S.js → total-session-admission-UHYNUO3L.js} +63 -58
- package/chunks/{tree-sitter-4D7QS7F6.js → tree-sitter-NZ3QACD7.js} +1 -1
- package/chunks/{tree-sitter-bash-VEJGF5XF.js → tree-sitter-bash-WXHLMORC.js} +1 -1
- package/chunks/{trustedFolders-5VCBXFOP.js → trustedFolders-YBR5URPG.js} +57 -53
- package/chunks/{update-relaunch-4LF3APCV.js → update-relaunch-L6MTSN76.js} +5 -5
- package/chunks/{updateCheck-4T3WUE5F.js → updateCheck-Z3SPZXHC.js} +60 -56
- package/chunks/{useAutoAcceptIndicator-UMGB64Z6.js → useAutoAcceptIndicator-PR5XGMO6.js} +68 -64
- package/chunks/{validateNonInterActiveAuth-GFJ72U2C.js → validateNonInterActiveAuth-KFLTWEYW.js} +109 -104
- package/chunks/{version-EAAZN4T2.js → version-NGAKFVUF.js} +1 -1
- package/chunks/{web-fetch-VRU3A2NI.js → web-fetch-WPGTHGU5.js} +15 -13
- package/chunks/web-search-JT63IJJV.js +39 -0
- package/chunks/{web-shell-static-CCN4JZEE.js → web-shell-static-T7UGLVE4.js} +2 -7
- package/chunks/{workflow-UHPFALVZ.js → workflow-EB63BAL4.js} +179 -79
- package/chunks/workspace-providers-status-NEPR67D2.js +133 -0
- package/chunks/{workspace-registration-store-A7RGKW62.js → workspace-registration-store-CFWXOMGH.js} +2 -2
- package/chunks/{workspace-registry-C2NGE6SD.js → workspace-registry-6KRZXOGB.js} +63 -58
- package/chunks/{workspace-runtime-coordinator-QKMZ24YF.js → workspace-runtime-coordinator-SP4X3UVH.js} +66 -59
- package/chunks/{workspace-service-RQTTAGGC.js → workspace-service-PRMYJTTV.js} +70 -65
- package/chunks/workspace-skills-status-VYTZJ5MB.js +130 -0
- package/chunks/{workspace-trust-reconciler-KFWATZUU.js → workspace-trust-reconciler-B4QMGDMI.js} +73 -68
- package/chunks/{write-file-DPVB2SBQ.js → write-file-EGBMW7TS.js} +45 -41
- package/chunks/{zh-TW-2K2WRFPY.js → zh-TW-7PRVUGLW.js} +5 -3
- package/chunks/{zh-S5V3Z5CR.js → zh-V2EYTYJP.js} +5 -3
- package/chunks/{zoom-image-S7AWLAPC.js → zoom-image-UR6K2LDR.js} +11 -10
- package/cli.js +18 -17
- package/codeModeHost.js +4425 -0
- package/export-transcript-document.css +1 -1
- package/export-transcript-document.js +151 -151
- package/locales/ca.js +5 -6
- package/locales/de.js +5 -6
- package/locales/en.js +7 -6
- package/locales/fr.js +6 -6
- package/locales/ja.js +5 -6
- package/locales/pt.js +5 -6
- package/locales/ru.js +6 -6
- package/locales/zh-TW.js +7 -6
- package/locales/zh.js +7 -6
- package/package.json +4 -3
- package/web-shell/assets/{abnfDiagram-VCTEODGH-nU24rpIE.js → abnfDiagram-VCTEODGH-S_JCiANq.js} +1 -1
- package/web-shell/assets/{arc-D1hTu8QI.js → arc-DP-839Xn.js} +1 -1
- package/web-shell/assets/architectureDiagram-5GKGNRK7-C8rCd2KK.js +36 -0
- package/web-shell/assets/blockDiagram-NRAW4CY4-DQR82jwr.js +129 -0
- package/web-shell/assets/{c4Diagram-UCG6FXSJ-kEFoC1ei.js → c4Diagram-UCG6FXSJ-D21PNMRP.js} +4 -4
- package/web-shell/assets/channel-BgGrpX_z.js +1 -0
- package/web-shell/assets/{chunk-2Q5K7J3B-DbT9wS7j.js → chunk-2Q5K7J3B-KdDInGLi.js} +1 -1
- package/web-shell/assets/{chunk-5VM5RSS4-CNbULt6O.js → chunk-5VM5RSS4-ltb7zRmH.js} +1 -1
- package/web-shell/assets/{chunk-F27PBJKO-CbQRy4Tb.js → chunk-F27PBJKO-DcpQA0Ng.js} +1 -1
- package/web-shell/assets/chunk-G27WJ6UU-C8NDZxcy.js +231 -0
- package/web-shell/assets/chunk-JWPE2WC7-hXhhHTs1.js +1 -0
- package/web-shell/assets/chunk-LCL6LL3I-CLaOR-Hl.js +206 -0
- package/web-shell/assets/chunk-POPQ4Y6H-Y5_qlB1N.js +1 -0
- package/web-shell/assets/{chunk-SVP7TREG-DyBb2Axj.js → chunk-SVP7TREG-BWX2Voh7.js} +4 -4
- package/web-shell/assets/{chunk-XXDRQBXY-BIA0eb5B.js → chunk-XXDRQBXY-1wmj_kXI.js} +1 -1
- package/web-shell/assets/classDiagram-DTDB5LWJ-jUH7ADYs.js +1 -0
- package/web-shell/assets/classDiagram-v2-JRS7N3AN-jUH7ADYs.js +1 -0
- package/web-shell/assets/cose-bilkent-JH36ORCC-DpLc-cdd.js +1 -0
- package/web-shell/assets/cynefin-OW5HDTMX-DhxGiPZW.js +178 -0
- package/web-shell/assets/{cynefinDiagram-5FMLGOSQ-LENf_IUy.js → cynefinDiagram-5FMLGOSQ-Dl3jfBry.js} +1 -1
- package/web-shell/assets/{cytoscape.esm-CUqq0XTU.js → cytoscape.esm-DJK6lGiH.js} +3 -3
- package/web-shell/assets/dagre-3AP2YEHR-C8FA8vJk.js +4 -0
- package/web-shell/assets/diagram-S7CK7UJ4-D-quIUtW.js +30 -0
- package/web-shell/assets/diagram-UQ7AKVKN-Bjo09Uts.js +41 -0
- package/web-shell/assets/diagram-VSXAHHWV-IoI3ttq4.js +3 -0
- package/web-shell/assets/diagram-VX7I27RA-BKyOZ5SO.js +24 -0
- package/web-shell/assets/diagram-Z3DM3KII-Cu_OHEhw.js +24 -0
- package/web-shell/assets/{ebnfDiagram-PWID7BFC-BGpiquRm.js → ebnfDiagram-PWID7BFC-UVB-bbPg.js} +1 -1
- package/web-shell/assets/{erDiagram-SSCWMZ5O-D0besu_U.js → erDiagram-SSCWMZ5O-l8drddto.js} +13 -13
- package/web-shell/assets/flowDiagram-A5DVABFB-DU1I_VAI.js +168 -0
- package/web-shell/assets/{ganttDiagram-EL5Y4UJY-CNlsAeNr.js → ganttDiagram-EL5Y4UJY-BLRH05uB.js} +1 -1
- package/web-shell/assets/gitGraphDiagram-WWUBYQGX-Czg_BkRE.js +106 -0
- package/web-shell/assets/index-CmMV8Jla.js +3 -0
- package/web-shell/assets/{index-CGT341lL.js → index-DohPy72Z.js} +1 -1
- package/web-shell/assets/index-DyMtNYuu.js +2207 -0
- package/web-shell/assets/index-n6N-2a3v.css +36 -0
- package/web-shell/assets/{infoDiagram-RXCK75RN-Bpai64Ll.js → infoDiagram-RXCK75RN-BpBvjkro.js} +1 -1
- package/web-shell/assets/ishikawaDiagram-5VMMS53U-phy1l3jm.js +70 -0
- package/web-shell/assets/{journeyDiagram-EYS64GPL-iz_DKgFX.js → journeyDiagram-EYS64GPL-oY-9LgVS.js} +1 -1
- package/web-shell/assets/kanban-definition-3QL26DDD-slZoy-sc.js +89 -0
- package/web-shell/assets/{layout-qEvKgnvU.js → layout-0hnn_P9l.js} +1 -1
- package/web-shell/assets/{linear-C6lklGdq.js → linear-7Wqe8DRy.js} +1 -1
- package/web-shell/assets/mermaid.core-BaK8n0bq.js +312 -0
- package/web-shell/assets/mindmap-definition-FBJOCRG2-BedUdy_E.js +96 -0
- package/web-shell/assets/{pegDiagram-XKGWAZYB-BhD0q0i6.js → pegDiagram-XKGWAZYB-DQLRdmxq.js} +1 -1
- package/web-shell/assets/pieDiagram-E7YTZNPT-UC20w9-5.js +39 -0
- package/web-shell/assets/quadrantDiagram-AXDQQJYC-CQx2Hmk3.js +7 -0
- package/web-shell/assets/qwen-code-notification-BRVagufF.png +0 -0
- package/web-shell/assets/{railroadDiagram-O6MQD6OU-E1g2KIFK.js → railroadDiagram-O6MQD6OU-2UEJe_y-.js} +1 -1
- package/web-shell/assets/{requirementDiagram-EFPCY7ZU-CuerYJOe.js → requirementDiagram-EFPCY7ZU-DOAJggB4.js} +13 -13
- package/web-shell/assets/{sankeyDiagram-P5KCCOFB-CqWyCZGA.js → sankeyDiagram-P5KCCOFB-DnQ_qJo7.js} +7 -7
- package/web-shell/assets/{sequenceDiagram-WJ2MYXX4-B-YWb8x4.js → sequenceDiagram-WJ2MYXX4-DZrZUoCo.js} +16 -16
- package/web-shell/assets/sizeCapture-X5ZJPWSS-B5G4GDQB.js +1 -0
- package/web-shell/assets/{stateDiagram-HBIQ2CUA-C8LDpNHS.js → stateDiagram-HBIQ2CUA-Bn1cT0qF.js} +1 -1
- package/web-shell/assets/stateDiagram-v2-4QOOHH4V-BF3xtNvJ.js +1 -0
- package/web-shell/assets/swimlanes-XN3QIQJK-Bzhcdn87.js +1 -0
- package/web-shell/assets/swimlanesDiagram-VK2B7HYN-B753mA3E.js +8 -0
- package/web-shell/assets/timeline-definition-24CTP7MA-BqZ_3D10.js +120 -0
- package/web-shell/assets/vennDiagram-4TSXK5OY-z9kw1kmm.js +34 -0
- package/web-shell/assets/wardleyDiagram-VM6X3IG4-Cydp1zJW.js +78 -0
- package/web-shell/assets/{xychartDiagram-S5SC5T6Z-ruD2Wjhg.js → xychartDiagram-S5SC5T6Z-j4X1lQKo.js} +1 -1
- package/web-shell/index.html +2 -2
- package/chunks/chunk-7Q2AXRDJ.js +0 -114
- package/chunks/chunk-AEY27Z35.js +0 -1411
- package/chunks/chunk-CFKIH3D3.js +0 -50
- package/chunks/chunk-HWVUSYSN.js +0 -126
- package/chunks/chunk-QHMLYMMS.js +0 -32
- package/chunks/chunk-SAH4BD2J.js +0 -92
- package/chunks/chunk-TWUKBNWM.js +0 -86
- package/chunks/chunk-ZTTC7T4X.js +0 -126
- package/chunks/list-YL6LDQKQ.js +0 -129
- package/chunks/mcp-IYVSIW6O.js +0 -123
- package/chunks/web-search-NEGYQNDJ.js +0 -912
- package/chunks/workspace-providers-status-AEYISSU2.js +0 -127
- package/chunks/workspace-skills-status-5HWZU3HX.js +0 -126
- package/web-shell/assets/architectureDiagram-5GKGNRK7-B_fgkKe7.js +0 -36
- package/web-shell/assets/blockDiagram-NRAW4CY4-C3pddUNg.js +0 -129
- package/web-shell/assets/channel-Blod4z1X.js +0 -1
- package/web-shell/assets/chunk-G27WJ6UU-CVbXTxYk.js +0 -231
- package/web-shell/assets/chunk-JWPE2WC7-D89c_BXy.js +0 -1
- package/web-shell/assets/chunk-LCL6LL3I-B7-I_9KB.js +0 -206
- package/web-shell/assets/chunk-POPQ4Y6H-DcLQFzS4.js +0 -1
- package/web-shell/assets/classDiagram-DTDB5LWJ-D6hFDMqb.js +0 -1
- package/web-shell/assets/classDiagram-v2-JRS7N3AN-D6hFDMqb.js +0 -1
- package/web-shell/assets/cose-bilkent-JH36ORCC-Db2FYN85.js +0 -1
- package/web-shell/assets/cynefin-OW5HDTMX-i4GwmBVy.js +0 -178
- package/web-shell/assets/dagre-3AP2YEHR-CF9XVrD9.js +0 -4
- package/web-shell/assets/diagram-S7CK7UJ4-DD5PJfSm.js +0 -30
- package/web-shell/assets/diagram-UQ7AKVKN-CjD_sBMj.js +0 -41
- package/web-shell/assets/diagram-VSXAHHWV-U5WwMqyA.js +0 -3
- package/web-shell/assets/diagram-VX7I27RA-BujpHJJf.js +0 -24
- package/web-shell/assets/diagram-Z3DM3KII-3ZLtKEXo.js +0 -24
- package/web-shell/assets/flowDiagram-A5DVABFB-9DwDuIyr.js +0 -168
- package/web-shell/assets/gitGraphDiagram-WWUBYQGX-C_pPFiTR.js +0 -106
- package/web-shell/assets/index-BYWs4JWq.js +0 -3
- package/web-shell/assets/index-D3YS6KuJ.js +0 -2173
- package/web-shell/assets/index-eBxK3rs2.css +0 -36
- package/web-shell/assets/ishikawaDiagram-5VMMS53U-ktpJFq4r.js +0 -70
- package/web-shell/assets/kanban-definition-3QL26DDD-m_gG00Yt.js +0 -89
- package/web-shell/assets/mermaid.core-DSCYB_2P.js +0 -312
- package/web-shell/assets/mindmap-definition-FBJOCRG2-DRQbT8w-.js +0 -96
- package/web-shell/assets/pieDiagram-E7YTZNPT-BvIGQCSd.js +0 -39
- package/web-shell/assets/quadrantDiagram-AXDQQJYC-BDQtfpU-.js +0 -7
- package/web-shell/assets/sizeCapture-X5ZJPWSS-BB7YY4Tl.js +0 -1
- package/web-shell/assets/stateDiagram-v2-4QOOHH4V-C4CbdvGa.js +0 -1
- package/web-shell/assets/swimlanes-XN3QIQJK-D94vOoxZ.js +0 -1
- package/web-shell/assets/swimlanesDiagram-VK2B7HYN--QNSIOC8.js +0 -8
- package/web-shell/assets/timeline-definition-24CTP7MA-C9C8uEYm.js +0 -120
- package/web-shell/assets/vennDiagram-4TSXK5OY-CYzMHbVW.js +0 -34
- package/web-shell/assets/wardleyDiagram-VM6X3IG4-G9nhtLES.js +0 -78
- package/chunks/{open-with-auth-6MVIHMXB.js → open-with-auth-XFCCJOO6.js} +3 -3
|
@@ -0,0 +1,1416 @@
|
|
|
1
|
+
// Force strict mode and setup for ESM
|
|
2
|
+
"use strict";
|
|
3
|
+
import {
|
|
4
|
+
DEFAULT_OPENAI_BASE_URL
|
|
5
|
+
} from "./chunk-JL6APGBX.js";
|
|
6
|
+
import {
|
|
7
|
+
defaultModalities
|
|
8
|
+
} from "./chunk-7MIBD3LG.js";
|
|
9
|
+
import {
|
|
10
|
+
tokenLimit
|
|
11
|
+
} from "./chunk-FPGTNKCP.js";
|
|
12
|
+
import {
|
|
13
|
+
DEFAULT_QWEN_MODEL,
|
|
14
|
+
MODEL_GENERATION_CONFIG_FIELDS,
|
|
15
|
+
PROVIDER_SOURCED_FIELDS,
|
|
16
|
+
QWEN_OAUTH_MODELS
|
|
17
|
+
} from "./chunk-6TMXX4Z4.js";
|
|
18
|
+
import {
|
|
19
|
+
AuthType
|
|
20
|
+
} from "./chunk-ERU3SDXT.js";
|
|
21
|
+
import {
|
|
22
|
+
createDebugLogger
|
|
23
|
+
} from "./chunk-ZAFYHRVY.js";
|
|
24
|
+
import {
|
|
25
|
+
init_esbuild_shims
|
|
26
|
+
} from "./chunk-5O2XNYP6.js";
|
|
27
|
+
import {
|
|
28
|
+
__name
|
|
29
|
+
} from "./chunk-J2S4EL5Y.js";
|
|
30
|
+
|
|
31
|
+
// packages/core/src/utils/runtimeModelPrefix.ts
|
|
32
|
+
init_esbuild_shims();
|
|
33
|
+
var RUNTIME_SNAPSHOT_PREFIX = "$runtime|";
|
|
34
|
+
function buildRuntimeSnapshotId(authType, modelId) {
|
|
35
|
+
return `${RUNTIME_SNAPSHOT_PREFIX}${authType}|${modelId}`;
|
|
36
|
+
}
|
|
37
|
+
__name(buildRuntimeSnapshotId, "buildRuntimeSnapshotId");
|
|
38
|
+
function stripRuntimeSnapshotPrefix(modelId) {
|
|
39
|
+
let id = modelId;
|
|
40
|
+
while (id.startsWith(RUNTIME_SNAPSHOT_PREFIX)) {
|
|
41
|
+
const stripped = id.split("|").slice(2).join("|");
|
|
42
|
+
if (!stripped) break;
|
|
43
|
+
id = stripped;
|
|
44
|
+
}
|
|
45
|
+
return id;
|
|
46
|
+
}
|
|
47
|
+
__name(stripRuntimeSnapshotPrefix, "stripRuntimeSnapshotPrefix");
|
|
48
|
+
|
|
49
|
+
// packages/core/src/utils/modelId.ts
|
|
50
|
+
init_esbuild_shims();
|
|
51
|
+
var AUTH_TYPES = new Set(Object.values(AuthType));
|
|
52
|
+
function resolveModelId(model, context = {}) {
|
|
53
|
+
return resolveModelIdSelector(parseModelIdSelector(model), context);
|
|
54
|
+
}
|
|
55
|
+
__name(resolveModelId, "resolveModelId");
|
|
56
|
+
function buildModelIdContext(config) {
|
|
57
|
+
return {
|
|
58
|
+
currentModel: config.getModel?.(),
|
|
59
|
+
currentAuthType: config.getContentGeneratorConfig?.()?.authType,
|
|
60
|
+
fastModel: config.getFastModel?.(),
|
|
61
|
+
getAvailableModels: /* @__PURE__ */ __name((authTypes) => config.getAllConfiguredModels?.(authTypes) ?? [], "getAvailableModels")
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
__name(buildModelIdContext, "buildModelIdContext");
|
|
65
|
+
function parseModelIdSelector(model) {
|
|
66
|
+
const trimmed = model?.trim();
|
|
67
|
+
if (!trimmed || trimmed === "inherit") {
|
|
68
|
+
return { kind: "inherit" };
|
|
69
|
+
}
|
|
70
|
+
if (trimmed === "fast") {
|
|
71
|
+
return { kind: "fast" };
|
|
72
|
+
}
|
|
73
|
+
const colonIndex = trimmed.indexOf(":");
|
|
74
|
+
if (colonIndex === -1) {
|
|
75
|
+
return { kind: "model", modelId: trimmed };
|
|
76
|
+
}
|
|
77
|
+
const maybeAuthType = trimmed.slice(0, colonIndex).trim();
|
|
78
|
+
const modelId = trimmed.slice(colonIndex + 1).trim();
|
|
79
|
+
if (!AUTH_TYPES.has(maybeAuthType)) {
|
|
80
|
+
return { kind: "model", modelId: trimmed };
|
|
81
|
+
}
|
|
82
|
+
if (!modelId) {
|
|
83
|
+
throw new Error(
|
|
84
|
+
"Model selector must include a model ID after the authType"
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
return {
|
|
88
|
+
kind: "model",
|
|
89
|
+
authType: maybeAuthType,
|
|
90
|
+
modelId
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
__name(parseModelIdSelector, "parseModelIdSelector");
|
|
94
|
+
function resolveAuthTypeForBareModel(modelId, context) {
|
|
95
|
+
if (context.currentAuthType && context.getAvailableModels) {
|
|
96
|
+
const currentModels = context.getAvailableModels([context.currentAuthType]);
|
|
97
|
+
if (currentModels.some((model) => model.id === modelId)) {
|
|
98
|
+
return context.currentAuthType;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
const configuredModel = context.getAvailableModels ? context.getAvailableModels().find((model) => model.id === modelId) : void 0;
|
|
102
|
+
return configuredModel?.authType ?? context.currentAuthType;
|
|
103
|
+
}
|
|
104
|
+
__name(resolveAuthTypeForBareModel, "resolveAuthTypeForBareModel");
|
|
105
|
+
function resolveModelIdSelector(selector, context) {
|
|
106
|
+
if (selector.kind === "model") {
|
|
107
|
+
const authType = selector.authType ?? resolveAuthTypeForBareModel(selector.modelId, context);
|
|
108
|
+
return {
|
|
109
|
+
...authType ? { authType } : {},
|
|
110
|
+
modelId: selector.modelId
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
if (selector.kind === "inherit") {
|
|
114
|
+
return context.currentModel ? {
|
|
115
|
+
...context.currentAuthType ? { authType: context.currentAuthType } : {},
|
|
116
|
+
modelId: context.currentModel
|
|
117
|
+
} : void 0;
|
|
118
|
+
}
|
|
119
|
+
if (!context.fastModel) {
|
|
120
|
+
return void 0;
|
|
121
|
+
}
|
|
122
|
+
const fastSelector = parseModelIdSelector(context.fastModel);
|
|
123
|
+
if (fastSelector.kind === "fast") {
|
|
124
|
+
return void 0;
|
|
125
|
+
}
|
|
126
|
+
return resolveModelIdSelector(fastSelector, {
|
|
127
|
+
...context,
|
|
128
|
+
fastModel: void 0
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
__name(resolveModelIdSelector, "resolveModelIdSelector");
|
|
132
|
+
|
|
133
|
+
// packages/core/src/models/image-generation-capability.ts
|
|
134
|
+
init_esbuild_shims();
|
|
135
|
+
function isImageGenerationCapable(model) {
|
|
136
|
+
return model.supportsImageGeneration === true || model.imageOnly === true;
|
|
137
|
+
}
|
|
138
|
+
__name(isImageGenerationCapable, "isImageGenerationCapable");
|
|
139
|
+
|
|
140
|
+
// packages/core/src/models/modelRegistry.ts
|
|
141
|
+
init_esbuild_shims();
|
|
142
|
+
|
|
143
|
+
// packages/core/src/models/types.ts
|
|
144
|
+
init_esbuild_shims();
|
|
145
|
+
|
|
146
|
+
// packages/core/src/models/modelRegistry.ts
|
|
147
|
+
var debugLogger = createDebugLogger("MODEL_REGISTRY");
|
|
148
|
+
function validateAuthTypeKey(key) {
|
|
149
|
+
if (Object.values(AuthType).includes(key)) {
|
|
150
|
+
return key;
|
|
151
|
+
}
|
|
152
|
+
return void 0;
|
|
153
|
+
}
|
|
154
|
+
__name(validateAuthTypeKey, "validateAuthTypeKey");
|
|
155
|
+
function resolveProviderProtocol(providerId, providerProtocol) {
|
|
156
|
+
const explicit = providerProtocol && Object.hasOwn(providerProtocol, providerId) ? providerProtocol[providerId] : void 0;
|
|
157
|
+
if (explicit !== void 0) {
|
|
158
|
+
return validateAuthTypeKey(explicit);
|
|
159
|
+
}
|
|
160
|
+
return validateAuthTypeKey(providerId);
|
|
161
|
+
}
|
|
162
|
+
__name(resolveProviderProtocol, "resolveProviderProtocol");
|
|
163
|
+
function shouldUseCanonicalModalities(modelId) {
|
|
164
|
+
return /^minimax-m3/i.test(modelId.trim().toLowerCase());
|
|
165
|
+
}
|
|
166
|
+
__name(shouldUseCanonicalModalities, "shouldUseCanonicalModalities");
|
|
167
|
+
function modelRegistryKey(id, baseUrl) {
|
|
168
|
+
return baseUrl ? `${id}\0${baseUrl}` : id;
|
|
169
|
+
}
|
|
170
|
+
__name(modelRegistryKey, "modelRegistryKey");
|
|
171
|
+
var ModelRegistry = class _ModelRegistry {
|
|
172
|
+
static {
|
|
173
|
+
__name(this, "ModelRegistry");
|
|
174
|
+
}
|
|
175
|
+
modelsByAuthType;
|
|
176
|
+
/** providerId -> SDK protocol mapping; persists across reloads. */
|
|
177
|
+
providerProtocolConfig;
|
|
178
|
+
/** Raw providers config this registry was last built from. */
|
|
179
|
+
modelProvidersConfig;
|
|
180
|
+
getDefaultBaseUrl(authType) {
|
|
181
|
+
switch (authType) {
|
|
182
|
+
case "qwen-oauth" /* QWEN_OAUTH */:
|
|
183
|
+
return "DYNAMIC_QWEN_OAUTH_BASE_URL";
|
|
184
|
+
case "openai" /* USE_OPENAI */:
|
|
185
|
+
return DEFAULT_OPENAI_BASE_URL;
|
|
186
|
+
default:
|
|
187
|
+
return "";
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
constructor(modelProvidersConfig, providerProtocolConfig) {
|
|
191
|
+
this.modelsByAuthType = /* @__PURE__ */ new Map();
|
|
192
|
+
this.providerProtocolConfig = providerProtocolConfig ?? {};
|
|
193
|
+
this.modelProvidersConfig = modelProvidersConfig;
|
|
194
|
+
this.registerAuthTypeModels("qwen-oauth" /* QWEN_OAUTH */, QWEN_OAUTH_MODELS);
|
|
195
|
+
this.registerProvidersConfig(modelProvidersConfig);
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Register every user-configured provider under its resolved SDK protocol.
|
|
199
|
+
* A provider id maps to a protocol via {@link resolveProviderProtocol}
|
|
200
|
+
* (explicit `providerProtocol` entry, or the id itself when it is a built-in
|
|
201
|
+
* protocol). Unmapped unknown ids are skipped with a warning.
|
|
202
|
+
*/
|
|
203
|
+
registerProvidersConfig(modelProvidersConfig) {
|
|
204
|
+
if (!modelProvidersConfig) return;
|
|
205
|
+
for (const [providerId, models] of Object.entries(modelProvidersConfig)) {
|
|
206
|
+
const protocol = resolveProviderProtocol(
|
|
207
|
+
providerId,
|
|
208
|
+
this.providerProtocolConfig
|
|
209
|
+
);
|
|
210
|
+
if (!protocol) {
|
|
211
|
+
const knownProtocols = Object.values(AuthType).join(", ");
|
|
212
|
+
const mapped = Object.hasOwn(this.providerProtocolConfig, providerId) ? this.providerProtocolConfig[providerId] : void 0;
|
|
213
|
+
const message = mapped !== void 0 ? `Provider "${providerId}" maps to "${mapped}" via providerProtocol, which is not a known protocol (${knownProtocols}); skipping.` : `Provider "${providerId}" in modelProviders is not a built-in protocol (${knownProtocols}) and has no providerProtocol mapping; skipping. Add providerProtocol["${providerId}"] to route it to an SDK protocol.`;
|
|
214
|
+
debugLogger.warn(message);
|
|
215
|
+
continue;
|
|
216
|
+
}
|
|
217
|
+
if (protocol === "qwen-oauth" /* QWEN_OAUTH */) {
|
|
218
|
+
continue;
|
|
219
|
+
}
|
|
220
|
+
this.registerAuthTypeModels(protocol, models, providerId);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Register models for an authType.
|
|
225
|
+
* Uniqueness is determined by the composite key (id + baseUrl).
|
|
226
|
+
* Two models with the same id but different baseUrls are treated as distinct.
|
|
227
|
+
* If multiple models share both id and baseUrl, the first one takes precedence.
|
|
228
|
+
*/
|
|
229
|
+
registerAuthTypeModels(authType, models, providerId) {
|
|
230
|
+
if (!Array.isArray(models)) {
|
|
231
|
+
debugLogger.warn(
|
|
232
|
+
`modelProviders for provider "${providerId ?? authType}" is not an array; skipping. Expected ModelConfig[]; legacy { protocol, models } entries are normally rewritten by the v5->v4 settings migration.`
|
|
233
|
+
);
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
236
|
+
const modelMap = this.modelsByAuthType.get(authType) ?? /* @__PURE__ */ new Map();
|
|
237
|
+
const providerLabel = providerId && providerId !== authType ? ` (provider "${providerId}")` : "";
|
|
238
|
+
for (const config of models) {
|
|
239
|
+
const key = modelRegistryKey(config.id, config.baseUrl);
|
|
240
|
+
if (modelMap.has(key)) {
|
|
241
|
+
debugLogger.warn(
|
|
242
|
+
`Duplicate model id "${config.id}"${config.baseUrl ? ` with baseUrl "${config.baseUrl}"` : ""} for protocol "${authType}"${providerLabel}. Using the first registered config.`
|
|
243
|
+
);
|
|
244
|
+
continue;
|
|
245
|
+
}
|
|
246
|
+
const resolved = this.resolveModelConfig(config, authType);
|
|
247
|
+
modelMap.set(key, resolved);
|
|
248
|
+
}
|
|
249
|
+
this.modelsByAuthType.set(authType, modelMap);
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* Get all models for a specific authType.
|
|
253
|
+
* This is used by /model command to show only relevant models.
|
|
254
|
+
*/
|
|
255
|
+
getModelsForAuthType(authType) {
|
|
256
|
+
const models = this.modelsByAuthType.get(authType);
|
|
257
|
+
if (!models) return [];
|
|
258
|
+
return Array.from(models.values()).map((model) => ({
|
|
259
|
+
id: model.id,
|
|
260
|
+
label: model.name,
|
|
261
|
+
description: model.description,
|
|
262
|
+
capabilities: model.capabilities,
|
|
263
|
+
authType: model.authType,
|
|
264
|
+
isVision: model.capabilities?.vision ?? false,
|
|
265
|
+
contextWindowSize: model.generationConfig.contextWindowSize ?? tokenLimit(model.id),
|
|
266
|
+
// `modalities` is auto-filled in `resolveModelConfig`, so it is
|
|
267
|
+
// always defined on `ResolvedModelConfig` — no fallback needed here.
|
|
268
|
+
modalities: model.generationConfig.modalities,
|
|
269
|
+
baseUrl: model.baseUrl,
|
|
270
|
+
...model.registryBaseUrl !== void 0 ? { registryBaseUrl: model.registryBaseUrl } : {},
|
|
271
|
+
envKey: model.envKey,
|
|
272
|
+
fastOnly: model.fastOnly,
|
|
273
|
+
voiceOnly: model.voiceOnly,
|
|
274
|
+
visionOnly: model.visionOnly,
|
|
275
|
+
supportsImageGeneration: model.supportsImageGeneration,
|
|
276
|
+
imageOnly: model.imageOnly
|
|
277
|
+
}));
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* Get model configuration by authType and modelId.
|
|
281
|
+
* When baseUrl is provided, looks up the exact composite key, then a plain
|
|
282
|
+
* entry whose resolved default baseUrl matches.
|
|
283
|
+
* When baseUrl is omitted, tries the plain id first (backward compatible),
|
|
284
|
+
* then scans all entries for the first match by model id.
|
|
285
|
+
*/
|
|
286
|
+
getModel(authType, modelId, baseUrl) {
|
|
287
|
+
const models = this.modelsByAuthType.get(authType);
|
|
288
|
+
if (!models) return void 0;
|
|
289
|
+
if (baseUrl !== void 0) {
|
|
290
|
+
const exact = models.get(modelRegistryKey(modelId, baseUrl ?? void 0));
|
|
291
|
+
if (exact) return exact;
|
|
292
|
+
if (baseUrl === null) return void 0;
|
|
293
|
+
const plain2 = models.get(modelId);
|
|
294
|
+
return plain2?.baseUrl === baseUrl ? plain2 : void 0;
|
|
295
|
+
}
|
|
296
|
+
const plain = models.get(modelId);
|
|
297
|
+
if (plain) return plain;
|
|
298
|
+
for (const model of models.values()) {
|
|
299
|
+
if (model.id === modelId) return model;
|
|
300
|
+
}
|
|
301
|
+
return void 0;
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* Check if model exists for given authType.
|
|
305
|
+
* When baseUrl is provided, checks the exact endpoint or matching default.
|
|
306
|
+
* When baseUrl is omitted, checks plain id and scans by model id.
|
|
307
|
+
*/
|
|
308
|
+
hasModel(authType, modelId, baseUrl) {
|
|
309
|
+
return this.getModel(authType, modelId, baseUrl) !== void 0;
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* Get default model for an authType.
|
|
313
|
+
* For qwen-oauth, returns the coder model.
|
|
314
|
+
* For others, returns the first configured primary-capable model.
|
|
315
|
+
*/
|
|
316
|
+
getDefaultModelForAuthType(authType) {
|
|
317
|
+
if (authType === "qwen-oauth" /* QWEN_OAUTH */) {
|
|
318
|
+
return this.getModel(authType, DEFAULT_QWEN_MODEL);
|
|
319
|
+
}
|
|
320
|
+
const models = this.modelsByAuthType.get(authType);
|
|
321
|
+
if (!models || models.size === 0) return void 0;
|
|
322
|
+
return Array.from(models.values()).find(
|
|
323
|
+
(model) => !model.imageOnly && !model.voiceOnly
|
|
324
|
+
);
|
|
325
|
+
}
|
|
326
|
+
/**
|
|
327
|
+
* Resolve model config by applying defaults
|
|
328
|
+
*/
|
|
329
|
+
resolveModelConfig(config, authType) {
|
|
330
|
+
this.validateModelConfig(config, authType);
|
|
331
|
+
const generationConfig = { ...config.generationConfig ?? {} };
|
|
332
|
+
if (generationConfig.modalities === void 0 || shouldUseCanonicalModalities(config.id)) {
|
|
333
|
+
generationConfig.modalities = defaultModalities(config.id);
|
|
334
|
+
}
|
|
335
|
+
return {
|
|
336
|
+
...config,
|
|
337
|
+
authType,
|
|
338
|
+
name: config.name || config.id,
|
|
339
|
+
baseUrl: config.baseUrl || this.getDefaultBaseUrl(authType),
|
|
340
|
+
...config.baseUrl ? { registryBaseUrl: config.baseUrl } : {},
|
|
341
|
+
generationConfig,
|
|
342
|
+
capabilities: config.capabilities || {}
|
|
343
|
+
};
|
|
344
|
+
}
|
|
345
|
+
/**
|
|
346
|
+
* Validate model configuration
|
|
347
|
+
*/
|
|
348
|
+
validateModelConfig(config, authType) {
|
|
349
|
+
if (!config.id) {
|
|
350
|
+
throw new Error(
|
|
351
|
+
`Model config in authType '${authType}' missing required field: id`
|
|
352
|
+
);
|
|
353
|
+
}
|
|
354
|
+
const selectorOnlyCount = [
|
|
355
|
+
config.fastOnly,
|
|
356
|
+
config.voiceOnly,
|
|
357
|
+
config.visionOnly,
|
|
358
|
+
config.imageOnly
|
|
359
|
+
].filter(Boolean).length;
|
|
360
|
+
if (selectorOnlyCount > 1) {
|
|
361
|
+
debugLogger.warn(
|
|
362
|
+
`Model "${config.id}" in authType "${authType}" has multiple selector-only flags. It will be unreachable in at least one model selector.`
|
|
363
|
+
);
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
/**
|
|
367
|
+
* Reload models from updated configuration.
|
|
368
|
+
* Clears existing user-configured models and re-registers from new config.
|
|
369
|
+
* Preserves hard-coded qwen-oauth models.
|
|
370
|
+
*
|
|
371
|
+
* @param providerProtocolConfig - Updated provider->protocol map. `undefined`
|
|
372
|
+
* PRESERVES the existing map (so a reload carrying only modelProviders does
|
|
373
|
+
* not lose the mapping); any object value REPLACES it, so passing `{}`
|
|
374
|
+
* clears the mapping. Callers that want to preserve must omit the argument,
|
|
375
|
+
* not pass `settings.providerProtocol ?? {}`.
|
|
376
|
+
*/
|
|
377
|
+
reloadModels(modelProvidersConfig, providerProtocolConfig) {
|
|
378
|
+
const reloaded = new _ModelRegistry(
|
|
379
|
+
modelProvidersConfig,
|
|
380
|
+
providerProtocolConfig ?? this.providerProtocolConfig
|
|
381
|
+
);
|
|
382
|
+
this.modelsByAuthType = reloaded.modelsByAuthType;
|
|
383
|
+
this.providerProtocolConfig = reloaded.providerProtocolConfig;
|
|
384
|
+
this.modelProvidersConfig = reloaded.modelProvidersConfig;
|
|
385
|
+
}
|
|
386
|
+
/** The raw providers config this registry was last built from. */
|
|
387
|
+
getModelProvidersConfig() {
|
|
388
|
+
return this.modelProvidersConfig;
|
|
389
|
+
}
|
|
390
|
+
getProviderProtocolConfig() {
|
|
391
|
+
return this.providerProtocolConfig;
|
|
392
|
+
}
|
|
393
|
+
};
|
|
394
|
+
|
|
395
|
+
// packages/core/src/models/modelsConfig.ts
|
|
396
|
+
init_esbuild_shims();
|
|
397
|
+
import process from "node:process";
|
|
398
|
+
var debugLogger2 = createDebugLogger("ModelsConfig");
|
|
399
|
+
var ModelsConfig = class _ModelsConfig {
|
|
400
|
+
static {
|
|
401
|
+
__name(this, "ModelsConfig");
|
|
402
|
+
}
|
|
403
|
+
modelRegistry;
|
|
404
|
+
// Current selection state
|
|
405
|
+
currentAuthType;
|
|
406
|
+
currentRegistryBaseUrl;
|
|
407
|
+
// Generation config state
|
|
408
|
+
_generationConfig;
|
|
409
|
+
generationConfigSources;
|
|
410
|
+
// Flag for strict model provider selection
|
|
411
|
+
strictModelProviderSelection = false;
|
|
412
|
+
// One-shot flag for qwen-oauth credential caching
|
|
413
|
+
requireCachedQwenCredentialsOnce = false;
|
|
414
|
+
// One-shot flag indicating credentials were manually set via updateCredentials()
|
|
415
|
+
// When true, syncAfterAuthRefresh should NOT override these credentials with
|
|
416
|
+
// modelProviders defaults (even if the model ID matches a registry entry).
|
|
417
|
+
//
|
|
418
|
+
// This must be persistent across auth refreshes, because refreshAuth() can be
|
|
419
|
+
// triggered multiple times after a credential prompt flow. We only clear this
|
|
420
|
+
// flag when we explicitly apply modelProvider defaults (i.e. when the user
|
|
421
|
+
// switches to a registry model via switchModel).
|
|
422
|
+
hasManualCredentials = false;
|
|
423
|
+
// Callback for notifying Config of model changes
|
|
424
|
+
onModelChange;
|
|
425
|
+
// Flag indicating whether authType was explicitly provided (not defaulted)
|
|
426
|
+
authTypeWasExplicitlyProvided;
|
|
427
|
+
/**
|
|
428
|
+
* Runtime model snapshot storage.
|
|
429
|
+
*
|
|
430
|
+
* These snapshots store runtime-resolved model configurations that are NOT from
|
|
431
|
+
* modelProviders registry (e.g., models with manually set credentials).
|
|
432
|
+
*
|
|
433
|
+
* Key: snapshotId (format: `$runtime|${authType}|${modelId}`)
|
|
434
|
+
* Uses `$runtime|` prefix since `$` and `|` are unlikely to appear in real model IDs.
|
|
435
|
+
* This prevents conflicts with model IDs containing `-` or `:` characters.
|
|
436
|
+
* Value: RuntimeModelSnapshot containing the model's configuration
|
|
437
|
+
*
|
|
438
|
+
* Note: This is different from state snapshots used for rollback during model switching.
|
|
439
|
+
* RuntimeModelSnapshot stores persistent model configurations, while state snapshots
|
|
440
|
+
* are temporary and used only for error recovery.
|
|
441
|
+
*/
|
|
442
|
+
runtimeModelSnapshots = /* @__PURE__ */ new Map();
|
|
443
|
+
/**
|
|
444
|
+
* Currently active RuntimeModelSnapshot ID.
|
|
445
|
+
*
|
|
446
|
+
* When set, indicates that the current model is a runtime model (not from registry).
|
|
447
|
+
* This ID is included in state snapshots for rollback purposes.
|
|
448
|
+
*/
|
|
449
|
+
activeRuntimeModelSnapshotId;
|
|
450
|
+
static deepClone(value) {
|
|
451
|
+
if (value === null || typeof value !== "object") {
|
|
452
|
+
return value;
|
|
453
|
+
}
|
|
454
|
+
if (Array.isArray(value)) {
|
|
455
|
+
return value.map((v) => _ModelsConfig.deepClone(v));
|
|
456
|
+
}
|
|
457
|
+
const out = {};
|
|
458
|
+
for (const key of Object.keys(value)) {
|
|
459
|
+
out[key] = _ModelsConfig.deepClone(
|
|
460
|
+
value[key]
|
|
461
|
+
);
|
|
462
|
+
}
|
|
463
|
+
return out;
|
|
464
|
+
}
|
|
465
|
+
constructor(options = {}) {
|
|
466
|
+
this.modelRegistry = new ModelRegistry(
|
|
467
|
+
options.modelProvidersConfig,
|
|
468
|
+
options.providerProtocolConfig
|
|
469
|
+
);
|
|
470
|
+
this.onModelChange = options.onModelChange;
|
|
471
|
+
this._generationConfig = {
|
|
472
|
+
...options.generationConfig || {}
|
|
473
|
+
};
|
|
474
|
+
this.generationConfigSources = options.generationConfigSources || {};
|
|
475
|
+
this.authTypeWasExplicitlyProvided = options.initialAuthType !== void 0;
|
|
476
|
+
this.currentAuthType = options.initialAuthType;
|
|
477
|
+
const initialModelId = this._generationConfig.model;
|
|
478
|
+
if (this.currentAuthType && initialModelId) {
|
|
479
|
+
const initialModel = this.modelRegistry.getModel(
|
|
480
|
+
this.currentAuthType,
|
|
481
|
+
initialModelId,
|
|
482
|
+
options.initialRegistryBaseUrl
|
|
483
|
+
);
|
|
484
|
+
if (initialModel) {
|
|
485
|
+
this.currentRegistryBaseUrl = initialModel.registryBaseUrl ?? null;
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
/**
|
|
490
|
+
* Create a snapshot of the current ModelsConfig state for rollback purposes.
|
|
491
|
+
* Used before model switching operations to enable recovery on errors.
|
|
492
|
+
*
|
|
493
|
+
* Note: This is different from RuntimeModelSnapshot which stores runtime model configs.
|
|
494
|
+
*/
|
|
495
|
+
createStateSnapshotForRollback() {
|
|
496
|
+
return {
|
|
497
|
+
currentAuthType: this.currentAuthType,
|
|
498
|
+
generationConfig: _ModelsConfig.deepClone(this._generationConfig),
|
|
499
|
+
generationConfigSources: _ModelsConfig.deepClone(
|
|
500
|
+
this.generationConfigSources
|
|
501
|
+
),
|
|
502
|
+
strictModelProviderSelection: this.strictModelProviderSelection,
|
|
503
|
+
requireCachedQwenCredentialsOnce: this.requireCachedQwenCredentialsOnce,
|
|
504
|
+
hasManualCredentials: this.hasManualCredentials,
|
|
505
|
+
activeRuntimeModelSnapshotId: this.activeRuntimeModelSnapshotId,
|
|
506
|
+
currentRegistryBaseUrl: this.currentRegistryBaseUrl
|
|
507
|
+
};
|
|
508
|
+
}
|
|
509
|
+
/**
|
|
510
|
+
* Restore ModelsConfig state from a previously created state snapshot.
|
|
511
|
+
* Used for rollback when model switching operations fail.
|
|
512
|
+
*
|
|
513
|
+
* @param snapshot - The state snapshot to restore
|
|
514
|
+
*/
|
|
515
|
+
rollbackToStateSnapshot(snapshot) {
|
|
516
|
+
this.currentAuthType = snapshot.currentAuthType;
|
|
517
|
+
this._generationConfig = snapshot.generationConfig;
|
|
518
|
+
this.generationConfigSources = snapshot.generationConfigSources;
|
|
519
|
+
this.strictModelProviderSelection = snapshot.strictModelProviderSelection;
|
|
520
|
+
this.requireCachedQwenCredentialsOnce = snapshot.requireCachedQwenCredentialsOnce;
|
|
521
|
+
this.hasManualCredentials = snapshot.hasManualCredentials;
|
|
522
|
+
this.activeRuntimeModelSnapshotId = snapshot.activeRuntimeModelSnapshotId;
|
|
523
|
+
this.currentRegistryBaseUrl = snapshot.currentRegistryBaseUrl;
|
|
524
|
+
}
|
|
525
|
+
/**
|
|
526
|
+
* Get current model ID
|
|
527
|
+
*/
|
|
528
|
+
getModel() {
|
|
529
|
+
return this._generationConfig.model || DEFAULT_QWEN_MODEL;
|
|
530
|
+
}
|
|
531
|
+
/**
|
|
532
|
+
* Get current authType
|
|
533
|
+
*/
|
|
534
|
+
getCurrentAuthType() {
|
|
535
|
+
return this.currentAuthType;
|
|
536
|
+
}
|
|
537
|
+
getCurrentRegistryBaseUrl() {
|
|
538
|
+
return this.currentRegistryBaseUrl;
|
|
539
|
+
}
|
|
540
|
+
/**
|
|
541
|
+
* Check if authType was explicitly provided (via CLI or settings).
|
|
542
|
+
* If false, no authType was provided yet (fresh user).
|
|
543
|
+
*/
|
|
544
|
+
wasAuthTypeExplicitlyProvided() {
|
|
545
|
+
return this.authTypeWasExplicitlyProvided;
|
|
546
|
+
}
|
|
547
|
+
/**
|
|
548
|
+
* Get available models for current authType
|
|
549
|
+
*/
|
|
550
|
+
getAvailableModels() {
|
|
551
|
+
return this.currentAuthType ? this.modelRegistry.getModelsForAuthType(this.currentAuthType) : [];
|
|
552
|
+
}
|
|
553
|
+
/**
|
|
554
|
+
* Get available models for a specific authType
|
|
555
|
+
*/
|
|
556
|
+
getAvailableModelsForAuthType(authType) {
|
|
557
|
+
return this.modelRegistry.getModelsForAuthType(authType);
|
|
558
|
+
}
|
|
559
|
+
/**
|
|
560
|
+
* Get all configured models across authTypes.
|
|
561
|
+
*
|
|
562
|
+
* Notes:
|
|
563
|
+
* - By default, returns models across all authTypes.
|
|
564
|
+
* - qwen-oauth models are always ordered first.
|
|
565
|
+
* - Runtime model option (if active) is included before registry models of the same authType.
|
|
566
|
+
*/
|
|
567
|
+
getAllConfiguredModels(authTypes) {
|
|
568
|
+
const inputAuthTypes = authTypes && authTypes.length > 0 ? authTypes : Object.values(AuthType);
|
|
569
|
+
const seen = /* @__PURE__ */ new Set();
|
|
570
|
+
const uniqueAuthTypes = [];
|
|
571
|
+
for (const authType of inputAuthTypes) {
|
|
572
|
+
if (!seen.has(authType)) {
|
|
573
|
+
seen.add(authType);
|
|
574
|
+
uniqueAuthTypes.push(authType);
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
const orderedAuthTypes = [];
|
|
578
|
+
if (uniqueAuthTypes.includes("qwen-oauth" /* QWEN_OAUTH */)) {
|
|
579
|
+
orderedAuthTypes.push("qwen-oauth" /* QWEN_OAUTH */);
|
|
580
|
+
}
|
|
581
|
+
for (const authType of uniqueAuthTypes) {
|
|
582
|
+
if (authType !== "qwen-oauth" /* QWEN_OAUTH */) {
|
|
583
|
+
orderedAuthTypes.push(authType);
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
const runtimeOption = this.getRuntimeModelOption();
|
|
587
|
+
const allModels = [];
|
|
588
|
+
for (const authType of orderedAuthTypes) {
|
|
589
|
+
if (runtimeOption && runtimeOption.authType === authType) {
|
|
590
|
+
allModels.push(runtimeOption);
|
|
591
|
+
}
|
|
592
|
+
allModels.push(...this.modelRegistry.getModelsForAuthType(authType));
|
|
593
|
+
}
|
|
594
|
+
return allModels;
|
|
595
|
+
}
|
|
596
|
+
/**
|
|
597
|
+
* Check if a model exists for the given authType
|
|
598
|
+
*/
|
|
599
|
+
hasModel(authType, modelId) {
|
|
600
|
+
return this.modelRegistry.hasModel(authType, modelId);
|
|
601
|
+
}
|
|
602
|
+
/**
|
|
603
|
+
* Get a fully resolved provider model config for the given authType/modelId.
|
|
604
|
+
* Returns undefined for raw runtime models that are not present in the registry.
|
|
605
|
+
*/
|
|
606
|
+
getResolvedModel(authType, modelId, baseUrl) {
|
|
607
|
+
return this.modelRegistry.getModel(authType, modelId, baseUrl);
|
|
608
|
+
}
|
|
609
|
+
/**
|
|
610
|
+
* Get the display name for a model by its id.
|
|
611
|
+
* Looks up the model in the registry using the current authType and returns
|
|
612
|
+
* its resolved name. Falls back to the raw model id when the model is not
|
|
613
|
+
* found in the registry (e.g. runtime models or unknown models).
|
|
614
|
+
*/
|
|
615
|
+
getModelDisplayName(modelId) {
|
|
616
|
+
if (!this.currentAuthType) return modelId;
|
|
617
|
+
const resolved = (this.currentRegistryBaseUrl !== void 0 ? this.modelRegistry.getModel(
|
|
618
|
+
this.currentAuthType,
|
|
619
|
+
modelId,
|
|
620
|
+
this.currentRegistryBaseUrl
|
|
621
|
+
) : void 0) ?? this.modelRegistry.getModel(this.currentAuthType, modelId);
|
|
622
|
+
return resolved?.name ?? modelId;
|
|
623
|
+
}
|
|
624
|
+
/**
|
|
625
|
+
* Set model programmatically (e.g., VLM auto-switch, fallback).
|
|
626
|
+
* Supports both registry models and raw model IDs.
|
|
627
|
+
*/
|
|
628
|
+
async setModel(newModel, metadata) {
|
|
629
|
+
if (this.currentAuthType === "qwen-oauth" /* QWEN_OAUTH */ && newModel === DEFAULT_QWEN_MODEL) {
|
|
630
|
+
this.strictModelProviderSelection = false;
|
|
631
|
+
this.currentRegistryBaseUrl = void 0;
|
|
632
|
+
this._generationConfig.model = newModel;
|
|
633
|
+
this.generationConfigSources["model"] = {
|
|
634
|
+
kind: "programmatic",
|
|
635
|
+
detail: metadata?.reason || "setModel"
|
|
636
|
+
};
|
|
637
|
+
this.applyRawModelDerivedDefaults(newModel);
|
|
638
|
+
if (this.onModelChange) {
|
|
639
|
+
await this.onModelChange("qwen-oauth" /* QWEN_OAUTH */, false);
|
|
640
|
+
}
|
|
641
|
+
return;
|
|
642
|
+
}
|
|
643
|
+
if (this.currentAuthType && this.modelRegistry.hasModel(this.currentAuthType, newModel)) {
|
|
644
|
+
await this.switchModel(this.currentAuthType, newModel);
|
|
645
|
+
return;
|
|
646
|
+
}
|
|
647
|
+
const rollbackSnapshot = this.createStateSnapshotForRollback();
|
|
648
|
+
try {
|
|
649
|
+
this.strictModelProviderSelection = false;
|
|
650
|
+
this.currentRegistryBaseUrl = void 0;
|
|
651
|
+
this._generationConfig.model = newModel;
|
|
652
|
+
this.generationConfigSources["model"] = {
|
|
653
|
+
kind: "programmatic",
|
|
654
|
+
detail: metadata?.reason || "setModel"
|
|
655
|
+
};
|
|
656
|
+
this.applyRawModelDerivedDefaults(newModel);
|
|
657
|
+
if (this.onModelChange && this.currentAuthType) {
|
|
658
|
+
await this.onModelChange(this.currentAuthType, true);
|
|
659
|
+
}
|
|
660
|
+
} catch (error) {
|
|
661
|
+
this.rollbackToStateSnapshot(rollbackSnapshot);
|
|
662
|
+
throw error;
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
/**
|
|
666
|
+
* Raw model switches keep the current credentials, but model-derived
|
|
667
|
+
* generation defaults must follow the new model. Otherwise a switch from a
|
|
668
|
+
* multimodal registry model to a text-only raw model can keep stale image
|
|
669
|
+
* support and send unsupported inline media.
|
|
670
|
+
*/
|
|
671
|
+
applyRawModelDerivedDefaults(modelId) {
|
|
672
|
+
if (this.shouldUpdateModelDerivedDefault("modalities")) {
|
|
673
|
+
this._generationConfig.modalities = defaultModalities(modelId);
|
|
674
|
+
this.generationConfigSources["modalities"] = {
|
|
675
|
+
kind: "computed",
|
|
676
|
+
detail: "auto-detected from model"
|
|
677
|
+
};
|
|
678
|
+
}
|
|
679
|
+
if (this.shouldUpdateModelDerivedDefault("contextWindowSize")) {
|
|
680
|
+
this._generationConfig.contextWindowSize = tokenLimit(modelId, "input");
|
|
681
|
+
this.generationConfigSources["contextWindowSize"] = {
|
|
682
|
+
kind: "computed",
|
|
683
|
+
detail: "auto-detected from model"
|
|
684
|
+
};
|
|
685
|
+
}
|
|
686
|
+
}
|
|
687
|
+
shouldUpdateModelDerivedDefault(field) {
|
|
688
|
+
const source = this.generationConfigSources[field];
|
|
689
|
+
return source === void 0 || source.kind === "computed" || source.kind === "default" || source.kind === "modelProviders" || source.kind === "programmatic" || source.kind === "unknown";
|
|
690
|
+
}
|
|
691
|
+
/**
|
|
692
|
+
* Switch model (and optionally authType).
|
|
693
|
+
* Supports both registry-backed models and RuntimeModelSnapshots.
|
|
694
|
+
*
|
|
695
|
+
* For runtime models, the modelId can be:
|
|
696
|
+
* - A RuntimeModelSnapshot ID (format: `$runtime|${authType}|${modelId}`)
|
|
697
|
+
* - With explicit `$runtime|` prefix (format: `$runtime|${authType}|${modelId}`)
|
|
698
|
+
*
|
|
699
|
+
* When called from ACP integration, the modelId has already been parsed
|
|
700
|
+
* by parseAcpModelOption, which strips any (${authType}) suffix.
|
|
701
|
+
*/
|
|
702
|
+
async switchModel(authType, modelId, options) {
|
|
703
|
+
const runtimeModelSnapshotId = this.extractRuntimeModelSnapshotId(modelId);
|
|
704
|
+
if (runtimeModelSnapshotId) {
|
|
705
|
+
await this.switchToRuntimeModel(runtimeModelSnapshotId);
|
|
706
|
+
return;
|
|
707
|
+
}
|
|
708
|
+
const rollbackSnapshot = this.createStateSnapshotForRollback();
|
|
709
|
+
if (authType === "qwen-oauth" /* QWEN_OAUTH */ && options?.requireCachedCredentials) {
|
|
710
|
+
this.requireCachedQwenCredentialsOnce = true;
|
|
711
|
+
}
|
|
712
|
+
try {
|
|
713
|
+
const isAuthTypeChange = authType !== this.currentAuthType;
|
|
714
|
+
this.currentAuthType = authType;
|
|
715
|
+
const model = this.modelRegistry.getModel(
|
|
716
|
+
authType,
|
|
717
|
+
modelId,
|
|
718
|
+
options?.baseUrl
|
|
719
|
+
);
|
|
720
|
+
if (!model) {
|
|
721
|
+
throw new Error(
|
|
722
|
+
`Model '${modelId}' not found for authType '${authType}'`
|
|
723
|
+
);
|
|
724
|
+
}
|
|
725
|
+
if (model.imageOnly || model.voiceOnly) {
|
|
726
|
+
throw new Error(
|
|
727
|
+
`${model.imageOnly ? "Image" : "Voice"}-only model '${modelId}' cannot be used as the primary model`
|
|
728
|
+
);
|
|
729
|
+
}
|
|
730
|
+
const previousModelId = rollbackSnapshot.generationConfig.model || "";
|
|
731
|
+
const previousModel = !isAuthTypeChange && previousModelId ? this.modelRegistry.getModel(
|
|
732
|
+
authType,
|
|
733
|
+
previousModelId,
|
|
734
|
+
rollbackSnapshot.currentRegistryBaseUrl
|
|
735
|
+
) ?? this.modelRegistry.getModel(authType, previousModelId) : void 0;
|
|
736
|
+
const canReusePreviousApiKey = authType !== "qwen-oauth" /* QWEN_OAUTH */ && !isAuthTypeChange && !!rollbackSnapshot.generationConfig.apiKey && !!model.envKey && previousModel?.envKey === model.envKey && previousModel.baseUrl === model.baseUrl;
|
|
737
|
+
const previousApiKey = canReusePreviousApiKey ? rollbackSnapshot.generationConfig.apiKey : void 0;
|
|
738
|
+
const previousApiKeySource = canReusePreviousApiKey ? rollbackSnapshot.generationConfigSources["apiKey"] : void 0;
|
|
739
|
+
this.applyResolvedModelDefaults(model);
|
|
740
|
+
if (!this._generationConfig.apiKey && previousApiKey) {
|
|
741
|
+
this._generationConfig.apiKey = previousApiKey;
|
|
742
|
+
if (previousApiKeySource) {
|
|
743
|
+
this.generationConfigSources["apiKey"] = _ModelsConfig.deepClone(previousApiKeySource);
|
|
744
|
+
}
|
|
745
|
+
}
|
|
746
|
+
this.activeRuntimeModelSnapshotId = void 0;
|
|
747
|
+
const requiresRefresh = isAuthTypeChange ? true : this.checkRequiresRefresh(previousModelId);
|
|
748
|
+
if (this.onModelChange) {
|
|
749
|
+
await this.onModelChange(authType, requiresRefresh);
|
|
750
|
+
}
|
|
751
|
+
} catch (error) {
|
|
752
|
+
this.rollbackToStateSnapshot(rollbackSnapshot);
|
|
753
|
+
throw error;
|
|
754
|
+
}
|
|
755
|
+
}
|
|
756
|
+
/**
|
|
757
|
+
* Build a RuntimeModelSnapshot ID from authType and modelId.
|
|
758
|
+
* The format is: `$runtime|${authType}|${modelId}`
|
|
759
|
+
*
|
|
760
|
+
* This is the canonical way to construct snapshot IDs, ensuring
|
|
761
|
+
* consistency across creation and lookup.
|
|
762
|
+
*
|
|
763
|
+
* @param authType - The authentication type
|
|
764
|
+
* @param modelId - The model ID
|
|
765
|
+
* @returns The snapshot ID in format `$runtime|${authType}|${modelId}`
|
|
766
|
+
*/
|
|
767
|
+
buildRuntimeModelSnapshotId(authType, modelId) {
|
|
768
|
+
return buildRuntimeSnapshotId(authType, modelId);
|
|
769
|
+
}
|
|
770
|
+
/**
|
|
771
|
+
* Extract RuntimeModelSnapshot ID from modelId if it's a runtime model reference.
|
|
772
|
+
*
|
|
773
|
+
* Supports the following formats:
|
|
774
|
+
* - Direct snapshot ID: `$runtime|${authType}|${modelId}` → returns as-is if exists in Map
|
|
775
|
+
* - Direct snapshot ID match: returns if exists in Map
|
|
776
|
+
*
|
|
777
|
+
* Note: When called from ACP integration via setModel, the modelId has already
|
|
778
|
+
* been parsed by parseAcpModelOption which strips any (${authType}) suffix.
|
|
779
|
+
* So we don't need to handle ACP format here - the ACP layer handles that.
|
|
780
|
+
*
|
|
781
|
+
* @param modelId - The model ID to parse
|
|
782
|
+
* @returns The RuntimeModelSnapshot ID if found, undefined otherwise
|
|
783
|
+
*/
|
|
784
|
+
extractRuntimeModelSnapshotId(modelId) {
|
|
785
|
+
if (modelId.startsWith(RUNTIME_SNAPSHOT_PREFIX)) {
|
|
786
|
+
if (this.runtimeModelSnapshots.has(modelId)) {
|
|
787
|
+
return modelId;
|
|
788
|
+
}
|
|
789
|
+
return void 0;
|
|
790
|
+
}
|
|
791
|
+
if (this.runtimeModelSnapshots.has(modelId)) {
|
|
792
|
+
return modelId;
|
|
793
|
+
}
|
|
794
|
+
return void 0;
|
|
795
|
+
}
|
|
796
|
+
/**
|
|
797
|
+
* Get generation config for ContentGenerator creation
|
|
798
|
+
*/
|
|
799
|
+
getGenerationConfig() {
|
|
800
|
+
return this._generationConfig;
|
|
801
|
+
}
|
|
802
|
+
/**
|
|
803
|
+
* Get generation config sources for debugging/UI
|
|
804
|
+
*/
|
|
805
|
+
getGenerationConfigSources() {
|
|
806
|
+
return this.generationConfigSources;
|
|
807
|
+
}
|
|
808
|
+
/**
|
|
809
|
+
* Merge settings generation config, preserving existing values.
|
|
810
|
+
* Used when provider-sourced config is cleared but settings should still apply.
|
|
811
|
+
*/
|
|
812
|
+
mergeSettingsGenerationConfig(settingsGenerationConfig) {
|
|
813
|
+
if (!settingsGenerationConfig) {
|
|
814
|
+
return;
|
|
815
|
+
}
|
|
816
|
+
for (const field of MODEL_GENERATION_CONFIG_FIELDS) {
|
|
817
|
+
if (!(field in this._generationConfig) && field in settingsGenerationConfig) {
|
|
818
|
+
this._generationConfig[field] = settingsGenerationConfig[field];
|
|
819
|
+
this.generationConfigSources[field] = {
|
|
820
|
+
kind: "settings",
|
|
821
|
+
detail: `model.generationConfig.${field}`
|
|
822
|
+
};
|
|
823
|
+
}
|
|
824
|
+
}
|
|
825
|
+
}
|
|
826
|
+
/**
|
|
827
|
+
* Update credentials in generation config.
|
|
828
|
+
* Sets a flag to prevent syncAfterAuthRefresh from overriding these credentials.
|
|
829
|
+
*
|
|
830
|
+
* When credentials are manually set, we clear all provider-sourced configuration
|
|
831
|
+
* to maintain provider atomicity (either fully applied or not at all).
|
|
832
|
+
* Other layers (CLI, env, settings, defaults) will participate in resolve.
|
|
833
|
+
*
|
|
834
|
+
* Also updates or creates a RuntimeModelSnapshot when credentials form a complete config
|
|
835
|
+
* for a model not in the registry. This allows the runtime model to be reused later.
|
|
836
|
+
*
|
|
837
|
+
* @param settingsGenerationConfig Optional generation config from settings.json
|
|
838
|
+
* to merge after clearing provider-sourced config.
|
|
839
|
+
* This ensures settings.model.generationConfig fields
|
|
840
|
+
* (e.g., samplingParams, timeout) are preserved.
|
|
841
|
+
*/
|
|
842
|
+
updateCredentials(credentials, settingsGenerationConfig) {
|
|
843
|
+
if (credentials.apiKey || credentials.baseUrl || credentials.model) {
|
|
844
|
+
this.hasManualCredentials = true;
|
|
845
|
+
this.currentRegistryBaseUrl = void 0;
|
|
846
|
+
this.clearProviderSourcedConfig();
|
|
847
|
+
}
|
|
848
|
+
if (credentials.apiKey) {
|
|
849
|
+
this._generationConfig.apiKey = credentials.apiKey;
|
|
850
|
+
this.generationConfigSources["apiKey"] = {
|
|
851
|
+
kind: "programmatic",
|
|
852
|
+
detail: "updateCredentials"
|
|
853
|
+
};
|
|
854
|
+
}
|
|
855
|
+
if (credentials.baseUrl) {
|
|
856
|
+
this._generationConfig.baseUrl = credentials.baseUrl;
|
|
857
|
+
this.generationConfigSources["baseUrl"] = {
|
|
858
|
+
kind: "programmatic",
|
|
859
|
+
detail: "updateCredentials"
|
|
860
|
+
};
|
|
861
|
+
}
|
|
862
|
+
if (credentials.model) {
|
|
863
|
+
this._generationConfig.model = credentials.model;
|
|
864
|
+
this.generationConfigSources["model"] = {
|
|
865
|
+
kind: "programmatic",
|
|
866
|
+
detail: "updateCredentials"
|
|
867
|
+
};
|
|
868
|
+
}
|
|
869
|
+
this.strictModelProviderSelection = false;
|
|
870
|
+
this._generationConfig.apiKeyEnvKey = void 0;
|
|
871
|
+
if (settingsGenerationConfig) {
|
|
872
|
+
this.mergeSettingsGenerationConfig(settingsGenerationConfig);
|
|
873
|
+
}
|
|
874
|
+
this.syncRuntimeModelSnapshotWithCredentials();
|
|
875
|
+
}
|
|
876
|
+
/**
|
|
877
|
+
* Sync RuntimeModelSnapshot with current credentials.
|
|
878
|
+
*
|
|
879
|
+
* Creates or updates a RuntimeModelSnapshot when current credentials form a complete
|
|
880
|
+
* configuration for a model not in the registry. This enables:
|
|
881
|
+
* - Reusing the runtime model configuration later
|
|
882
|
+
* - Showing the runtime model as an available option in model lists
|
|
883
|
+
*
|
|
884
|
+
* Only creates snapshots for models NOT in the registry (to avoid duplication).
|
|
885
|
+
*/
|
|
886
|
+
syncRuntimeModelSnapshotWithCredentials() {
|
|
887
|
+
const currentAuthType = this.currentAuthType;
|
|
888
|
+
const { model, apiKey, baseUrl } = this._generationConfig;
|
|
889
|
+
if (!model || !currentAuthType || !apiKey || !baseUrl) {
|
|
890
|
+
return;
|
|
891
|
+
}
|
|
892
|
+
if (this.modelRegistry.hasModel(currentAuthType, model, baseUrl)) {
|
|
893
|
+
return;
|
|
894
|
+
}
|
|
895
|
+
if (this.activeRuntimeModelSnapshotId && this.runtimeModelSnapshots.has(this.activeRuntimeModelSnapshotId)) {
|
|
896
|
+
const snapshot = this.runtimeModelSnapshots.get(
|
|
897
|
+
this.activeRuntimeModelSnapshotId
|
|
898
|
+
);
|
|
899
|
+
snapshot.apiKey = apiKey;
|
|
900
|
+
snapshot.baseUrl = baseUrl;
|
|
901
|
+
snapshot.modelId = model;
|
|
902
|
+
const newSnapshotId = this.buildRuntimeModelSnapshotId(
|
|
903
|
+
snapshot.authType,
|
|
904
|
+
snapshot.modelId
|
|
905
|
+
);
|
|
906
|
+
if (newSnapshotId !== snapshot.id) {
|
|
907
|
+
this.runtimeModelSnapshots.delete(snapshot.id);
|
|
908
|
+
snapshot.id = newSnapshotId;
|
|
909
|
+
this.runtimeModelSnapshots.set(newSnapshotId, snapshot);
|
|
910
|
+
this.activeRuntimeModelSnapshotId = newSnapshotId;
|
|
911
|
+
}
|
|
912
|
+
snapshot.createdAt = Date.now();
|
|
913
|
+
} else {
|
|
914
|
+
this.detectAndCaptureRuntimeModel();
|
|
915
|
+
}
|
|
916
|
+
}
|
|
917
|
+
/**
|
|
918
|
+
* Clear configuration fields that were sourced from modelProviders.
|
|
919
|
+
* This ensures provider config atomicity when user manually sets credentials.
|
|
920
|
+
* Other layers (CLI, env, settings, defaults) will participate in resolve.
|
|
921
|
+
*/
|
|
922
|
+
clearProviderSourcedConfig() {
|
|
923
|
+
for (const field of PROVIDER_SOURCED_FIELDS) {
|
|
924
|
+
const source = this.generationConfigSources[field];
|
|
925
|
+
if (source?.kind === "modelProviders") {
|
|
926
|
+
delete this._generationConfig[field];
|
|
927
|
+
delete this.generationConfigSources[field];
|
|
928
|
+
}
|
|
929
|
+
}
|
|
930
|
+
}
|
|
931
|
+
/**
|
|
932
|
+
* Get whether strict model provider selection is enabled
|
|
933
|
+
*/
|
|
934
|
+
isStrictModelProviderSelection() {
|
|
935
|
+
return this.strictModelProviderSelection;
|
|
936
|
+
}
|
|
937
|
+
/**
|
|
938
|
+
* Reset strict model provider selection flag
|
|
939
|
+
*/
|
|
940
|
+
resetStrictModelProviderSelection() {
|
|
941
|
+
this.strictModelProviderSelection = false;
|
|
942
|
+
}
|
|
943
|
+
/**
|
|
944
|
+
* Check and consume the one-shot cached credentials flag
|
|
945
|
+
*/
|
|
946
|
+
consumeRequireCachedCredentialsFlag() {
|
|
947
|
+
const value = this.requireCachedQwenCredentialsOnce;
|
|
948
|
+
this.requireCachedQwenCredentialsOnce = false;
|
|
949
|
+
return value;
|
|
950
|
+
}
|
|
951
|
+
/**
|
|
952
|
+
* Apply resolved model config to generation config
|
|
953
|
+
*/
|
|
954
|
+
applyResolvedModelDefaults(model) {
|
|
955
|
+
this.strictModelProviderSelection = true;
|
|
956
|
+
this.currentRegistryBaseUrl = model.registryBaseUrl ?? null;
|
|
957
|
+
this.hasManualCredentials = false;
|
|
958
|
+
this._generationConfig.model = model.id;
|
|
959
|
+
this.generationConfigSources["model"] = {
|
|
960
|
+
kind: "modelProviders",
|
|
961
|
+
authType: model.authType,
|
|
962
|
+
modelId: model.id,
|
|
963
|
+
detail: "model.id"
|
|
964
|
+
};
|
|
965
|
+
if (this.currentAuthType === "qwen-oauth" /* QWEN_OAUTH */) {
|
|
966
|
+
this._generationConfig.apiKey = "QWEN_OAUTH_DYNAMIC_TOKEN";
|
|
967
|
+
this.generationConfigSources["apiKey"] = {
|
|
968
|
+
kind: "computed",
|
|
969
|
+
detail: "Qwen OAuth placeholder token"
|
|
970
|
+
};
|
|
971
|
+
this._generationConfig.apiKeyEnvKey = void 0;
|
|
972
|
+
delete this.generationConfigSources["apiKeyEnvKey"];
|
|
973
|
+
} else {
|
|
974
|
+
this._generationConfig.apiKey = void 0;
|
|
975
|
+
this._generationConfig.apiKeyEnvKey = void 0;
|
|
976
|
+
}
|
|
977
|
+
if (model.envKey !== void 0) {
|
|
978
|
+
const apiKey = process.env[model.envKey];
|
|
979
|
+
if (apiKey) {
|
|
980
|
+
this._generationConfig.apiKey = apiKey;
|
|
981
|
+
this.generationConfigSources["apiKey"] = {
|
|
982
|
+
kind: "env",
|
|
983
|
+
envKey: model.envKey,
|
|
984
|
+
via: {
|
|
985
|
+
kind: "modelProviders",
|
|
986
|
+
authType: model.authType,
|
|
987
|
+
modelId: model.id,
|
|
988
|
+
detail: "envKey"
|
|
989
|
+
}
|
|
990
|
+
};
|
|
991
|
+
} else {
|
|
992
|
+
debugLogger2.debug(
|
|
993
|
+
`No API key found for model "${model.id}": process.env["${model.envKey}"] is ${apiKey === "" ? "empty string" : "not set"}. Run /auth or set ${model.envKey} in your environment.`
|
|
994
|
+
);
|
|
995
|
+
}
|
|
996
|
+
this._generationConfig.apiKeyEnvKey = model.envKey;
|
|
997
|
+
this.generationConfigSources["apiKeyEnvKey"] = {
|
|
998
|
+
kind: "modelProviders",
|
|
999
|
+
authType: model.authType,
|
|
1000
|
+
modelId: model.id,
|
|
1001
|
+
detail: "envKey"
|
|
1002
|
+
};
|
|
1003
|
+
}
|
|
1004
|
+
this._generationConfig.baseUrl = model.baseUrl;
|
|
1005
|
+
this.generationConfigSources["baseUrl"] = {
|
|
1006
|
+
kind: "modelProviders",
|
|
1007
|
+
authType: model.authType,
|
|
1008
|
+
modelId: model.id,
|
|
1009
|
+
detail: "baseUrl"
|
|
1010
|
+
};
|
|
1011
|
+
const gc = model.generationConfig;
|
|
1012
|
+
for (const field of MODEL_GENERATION_CONFIG_FIELDS) {
|
|
1013
|
+
this._generationConfig[field] = gc[field];
|
|
1014
|
+
this.generationConfigSources[field] = {
|
|
1015
|
+
kind: "modelProviders",
|
|
1016
|
+
authType: model.authType,
|
|
1017
|
+
modelId: model.id,
|
|
1018
|
+
detail: `generationConfig.${field}`
|
|
1019
|
+
};
|
|
1020
|
+
}
|
|
1021
|
+
if (gc.contextWindowSize === void 0) {
|
|
1022
|
+
this._generationConfig.contextWindowSize = tokenLimit(model.id, "input");
|
|
1023
|
+
this.generationConfigSources["contextWindowSize"] = {
|
|
1024
|
+
kind: "computed",
|
|
1025
|
+
detail: "auto-detected from model"
|
|
1026
|
+
};
|
|
1027
|
+
}
|
|
1028
|
+
if (gc.modalities === void 0) {
|
|
1029
|
+
this._generationConfig.modalities = defaultModalities(model.id);
|
|
1030
|
+
this.generationConfigSources["modalities"] = {
|
|
1031
|
+
kind: "computed",
|
|
1032
|
+
detail: "auto-detected from model"
|
|
1033
|
+
};
|
|
1034
|
+
}
|
|
1035
|
+
}
|
|
1036
|
+
/**
|
|
1037
|
+
* Check if model switch requires ContentGenerator refresh.
|
|
1038
|
+
*
|
|
1039
|
+
* Note: This method is ONLY called by switchModel() for same-authType model switches.
|
|
1040
|
+
* Cross-authType switches use switchModel(authType, modelId), which always requires full refresh.
|
|
1041
|
+
*
|
|
1042
|
+
* When this method is called:
|
|
1043
|
+
* - this.currentAuthType is already the target authType
|
|
1044
|
+
* - We're checking if switching between two models within the SAME authType needs refresh
|
|
1045
|
+
*
|
|
1046
|
+
* Examples:
|
|
1047
|
+
* - Qwen OAuth: coder-model switches (same authType, hot-update safe)
|
|
1048
|
+
* - OpenAI: model-a -> model-b with same envKey (same authType, hot-update safe)
|
|
1049
|
+
* - OpenAI: gpt-4 -> deepseek-chat with different envKey (same authType, needs refresh)
|
|
1050
|
+
*
|
|
1051
|
+
* Cross-authType scenarios:
|
|
1052
|
+
* - OpenAI -> Qwen OAuth: handled by switchModel(authType, modelId), always refreshes
|
|
1053
|
+
* - Qwen OAuth -> OpenAI: handled by switchModel(authType, modelId), always refreshes
|
|
1054
|
+
*/
|
|
1055
|
+
checkRequiresRefresh(previousModelId) {
|
|
1056
|
+
const authType = this.currentAuthType;
|
|
1057
|
+
if (!authType) {
|
|
1058
|
+
return true;
|
|
1059
|
+
}
|
|
1060
|
+
if (authType === "qwen-oauth" /* QWEN_OAUTH */) {
|
|
1061
|
+
return false;
|
|
1062
|
+
}
|
|
1063
|
+
const currentModel = this.modelRegistry.getModel(
|
|
1064
|
+
authType,
|
|
1065
|
+
this._generationConfig.model || "",
|
|
1066
|
+
this._generationConfig.baseUrl || void 0
|
|
1067
|
+
);
|
|
1068
|
+
const previousModel = this.modelRegistry.getModel(
|
|
1069
|
+
authType,
|
|
1070
|
+
previousModelId
|
|
1071
|
+
);
|
|
1072
|
+
if (!previousModel || !currentModel) {
|
|
1073
|
+
return true;
|
|
1074
|
+
}
|
|
1075
|
+
const criticalFieldsChanged = previousModel.envKey !== currentModel.envKey || previousModel.baseUrl !== currentModel.baseUrl;
|
|
1076
|
+
if (criticalFieldsChanged) {
|
|
1077
|
+
return true;
|
|
1078
|
+
}
|
|
1079
|
+
return false;
|
|
1080
|
+
}
|
|
1081
|
+
/**
|
|
1082
|
+
* Sync state after auth refresh with fallback strategy:
|
|
1083
|
+
* 1. If modelId can be found in modelRegistry, use the config from modelRegistry.
|
|
1084
|
+
* 2. Otherwise, if existing credentials exist in resolved generationConfig from other sources
|
|
1085
|
+
* (not modelProviders), preserve them and update authType/modelId only.
|
|
1086
|
+
* 3. Otherwise, fall back to default model for the authType.
|
|
1087
|
+
* 4. If no default is available, leave the generationConfig incomplete and let
|
|
1088
|
+
* resolveContentGeneratorConfigWithSources throw exceptions as expected.
|
|
1089
|
+
*/
|
|
1090
|
+
syncAfterAuthRefresh(authType, modelId, providerBaseUrlOverride) {
|
|
1091
|
+
const previousAuthType = this.currentAuthType;
|
|
1092
|
+
const providerBaseUrl = providerBaseUrlOverride ?? (previousAuthType === authType && this.currentRegistryBaseUrl !== void 0 ? this.currentRegistryBaseUrl : this.generationConfigSources["baseUrl"]?.kind === "modelProviders" ? this._generationConfig.baseUrl : void 0);
|
|
1093
|
+
const resolved = modelId ? this.modelRegistry.getModel(authType, modelId, providerBaseUrl) ?? this.modelRegistry.getModel(authType, modelId) : void 0;
|
|
1094
|
+
if (resolved?.imageOnly || resolved?.voiceOnly) {
|
|
1095
|
+
throw new Error(
|
|
1096
|
+
`${resolved.imageOnly ? "Image" : "Voice"}-only model '${modelId}' cannot be used as the primary model`
|
|
1097
|
+
);
|
|
1098
|
+
}
|
|
1099
|
+
this.strictModelProviderSelection = false;
|
|
1100
|
+
this.currentAuthType = authType;
|
|
1101
|
+
if (resolved) {
|
|
1102
|
+
const hasBeenApplied = this.generationConfigSources["baseUrl"]?.kind === "modelProviders";
|
|
1103
|
+
const isProviderChanged = hasBeenApplied && (this._generationConfig.apiKeyEnvKey !== resolved.envKey || this._generationConfig.baseUrl !== resolved.baseUrl);
|
|
1104
|
+
const isUnchanged = previousAuthType === authType && this._generationConfig.model === modelId && !isProviderChanged;
|
|
1105
|
+
const savedApiKey = isUnchanged ? this._generationConfig.apiKey : void 0;
|
|
1106
|
+
const savedApiKeySource = isUnchanged ? this.generationConfigSources["apiKey"] ? { ...this.generationConfigSources["apiKey"] } : void 0 : void 0;
|
|
1107
|
+
const baseUrlSource2 = this.generationConfigSources["baseUrl"];
|
|
1108
|
+
const shouldPreserveResolvedBaseUrl = isUnchanged && !!this._generationConfig.baseUrl && (baseUrlSource2?.kind === "cli" || baseUrlSource2?.kind === "env" || baseUrlSource2?.kind === "settings");
|
|
1109
|
+
const savedBaseUrl = shouldPreserveResolvedBaseUrl ? this._generationConfig.baseUrl : void 0;
|
|
1110
|
+
const savedBaseUrlSource = shouldPreserveResolvedBaseUrl ? baseUrlSource2 ? { ...baseUrlSource2 } : void 0 : void 0;
|
|
1111
|
+
this.applyResolvedModelDefaults(resolved);
|
|
1112
|
+
if (isUnchanged && !this._generationConfig.apiKey && savedApiKey) {
|
|
1113
|
+
this._generationConfig.apiKey = savedApiKey;
|
|
1114
|
+
if (savedApiKeySource) {
|
|
1115
|
+
this.generationConfigSources["apiKey"] = savedApiKeySource;
|
|
1116
|
+
}
|
|
1117
|
+
}
|
|
1118
|
+
if (savedBaseUrl) {
|
|
1119
|
+
this._generationConfig.baseUrl = savedBaseUrl;
|
|
1120
|
+
if (savedBaseUrlSource) {
|
|
1121
|
+
this.generationConfigSources["baseUrl"] = savedBaseUrlSource;
|
|
1122
|
+
}
|
|
1123
|
+
}
|
|
1124
|
+
this.strictModelProviderSelection = true;
|
|
1125
|
+
this.activeRuntimeModelSnapshotId = void 0;
|
|
1126
|
+
return;
|
|
1127
|
+
}
|
|
1128
|
+
const apiKeySource = this.generationConfigSources["apiKey"];
|
|
1129
|
+
const baseUrlSource = this.generationConfigSources["baseUrl"];
|
|
1130
|
+
const hasExistingCredentials = this._generationConfig.apiKey && apiKeySource?.kind !== "modelProviders" || this._generationConfig.baseUrl && baseUrlSource?.kind !== "modelProviders";
|
|
1131
|
+
const isAuthTypeChange = previousAuthType !== authType;
|
|
1132
|
+
const shouldPreserveCredentials = !isAuthTypeChange && (modelId === void 0 || !this.modelRegistry.hasModel(authType, modelId)) && (this.hasManualCredentials || hasExistingCredentials);
|
|
1133
|
+
if (shouldPreserveCredentials) {
|
|
1134
|
+
this.currentRegistryBaseUrl = void 0;
|
|
1135
|
+
if (modelId) {
|
|
1136
|
+
this._generationConfig.model = modelId;
|
|
1137
|
+
if (!this.generationConfigSources["model"]) {
|
|
1138
|
+
this.generationConfigSources["model"] = {
|
|
1139
|
+
kind: "programmatic",
|
|
1140
|
+
detail: "auth refresh (preserved credentials)"
|
|
1141
|
+
};
|
|
1142
|
+
}
|
|
1143
|
+
}
|
|
1144
|
+
return;
|
|
1145
|
+
}
|
|
1146
|
+
const defaultModel = this.modelRegistry.getDefaultModelForAuthType(authType);
|
|
1147
|
+
if (defaultModel) {
|
|
1148
|
+
this.applyResolvedModelDefaults(defaultModel);
|
|
1149
|
+
this.activeRuntimeModelSnapshotId = void 0;
|
|
1150
|
+
return;
|
|
1151
|
+
}
|
|
1152
|
+
if (modelId) {
|
|
1153
|
+
this.currentRegistryBaseUrl = void 0;
|
|
1154
|
+
this._generationConfig.model = modelId;
|
|
1155
|
+
if (!this.generationConfigSources["model"]) {
|
|
1156
|
+
this.generationConfigSources["model"] = {
|
|
1157
|
+
kind: "programmatic",
|
|
1158
|
+
detail: "auth refresh (no default model)"
|
|
1159
|
+
};
|
|
1160
|
+
}
|
|
1161
|
+
}
|
|
1162
|
+
}
|
|
1163
|
+
/**
|
|
1164
|
+
* Update callback for model changes
|
|
1165
|
+
*/
|
|
1166
|
+
setOnModelChange(callback) {
|
|
1167
|
+
this.onModelChange = callback;
|
|
1168
|
+
}
|
|
1169
|
+
/**
|
|
1170
|
+
* Detect and capture RuntimeModelSnapshot during initialization.
|
|
1171
|
+
*
|
|
1172
|
+
* Checks if the current configuration represents a runtime model (not from
|
|
1173
|
+
* modelProviders registry) and captures it as a RuntimeModelSnapshot.
|
|
1174
|
+
*
|
|
1175
|
+
* This enables runtime models to persist across sessions and appear in model lists.
|
|
1176
|
+
*
|
|
1177
|
+
* @returns Created snapshot ID, or undefined if current config is a registry model
|
|
1178
|
+
*/
|
|
1179
|
+
detectAndCaptureRuntimeModel() {
|
|
1180
|
+
const {
|
|
1181
|
+
model: currentModel,
|
|
1182
|
+
apiKey,
|
|
1183
|
+
baseUrl,
|
|
1184
|
+
apiKeyEnvKey,
|
|
1185
|
+
...generationConfig
|
|
1186
|
+
} = this._generationConfig;
|
|
1187
|
+
const currentAuthType = this.currentAuthType;
|
|
1188
|
+
if (!currentModel || !currentAuthType) {
|
|
1189
|
+
return void 0;
|
|
1190
|
+
}
|
|
1191
|
+
if (this.modelRegistry.hasModel(currentAuthType, currentModel, baseUrl)) {
|
|
1192
|
+
this.clearRuntimeModelSnapshotForAuthType(currentAuthType);
|
|
1193
|
+
return void 0;
|
|
1194
|
+
}
|
|
1195
|
+
const hasValidCredentials = this._generationConfig.apiKey && this._generationConfig.baseUrl;
|
|
1196
|
+
if (!hasValidCredentials) {
|
|
1197
|
+
return void 0;
|
|
1198
|
+
}
|
|
1199
|
+
const snapshotId = this.buildRuntimeModelSnapshotId(
|
|
1200
|
+
currentAuthType,
|
|
1201
|
+
currentModel
|
|
1202
|
+
);
|
|
1203
|
+
const snapshot = {
|
|
1204
|
+
id: snapshotId,
|
|
1205
|
+
authType: currentAuthType,
|
|
1206
|
+
modelId: currentModel,
|
|
1207
|
+
apiKey,
|
|
1208
|
+
baseUrl,
|
|
1209
|
+
apiKeyEnvKey,
|
|
1210
|
+
generationConfig,
|
|
1211
|
+
sources: { ...this.generationConfigSources },
|
|
1212
|
+
createdAt: Date.now()
|
|
1213
|
+
};
|
|
1214
|
+
this.runtimeModelSnapshots.set(snapshotId, snapshot);
|
|
1215
|
+
this.activeRuntimeModelSnapshotId = snapshotId;
|
|
1216
|
+
this.currentRegistryBaseUrl = void 0;
|
|
1217
|
+
this.cleanupOldRuntimeModelSnapshots();
|
|
1218
|
+
return snapshotId;
|
|
1219
|
+
}
|
|
1220
|
+
/**
|
|
1221
|
+
* Get the currently active RuntimeModelSnapshot.
|
|
1222
|
+
*
|
|
1223
|
+
* @returns The active RuntimeModelSnapshot, or undefined if no runtime model is active
|
|
1224
|
+
*/
|
|
1225
|
+
getActiveRuntimeModelSnapshot() {
|
|
1226
|
+
if (!this.activeRuntimeModelSnapshotId) {
|
|
1227
|
+
return void 0;
|
|
1228
|
+
}
|
|
1229
|
+
return this.runtimeModelSnapshots.get(this.activeRuntimeModelSnapshotId);
|
|
1230
|
+
}
|
|
1231
|
+
/**
|
|
1232
|
+
* Get the ID of the currently active RuntimeModelSnapshot.
|
|
1233
|
+
*
|
|
1234
|
+
* @returns The active snapshot ID, or undefined if no runtime model is active
|
|
1235
|
+
*/
|
|
1236
|
+
getActiveRuntimeModelSnapshotId() {
|
|
1237
|
+
return this.activeRuntimeModelSnapshotId;
|
|
1238
|
+
}
|
|
1239
|
+
/**
|
|
1240
|
+
* Switch to a RuntimeModelSnapshot.
|
|
1241
|
+
*
|
|
1242
|
+
* Applies the configuration from a previously captured RuntimeModelSnapshot.
|
|
1243
|
+
* Uses state rollback pattern: creates a state snapshot before switching and
|
|
1244
|
+
* restores it on error.
|
|
1245
|
+
*
|
|
1246
|
+
* @param snapshotId - The ID of the RuntimeModelSnapshot to switch to
|
|
1247
|
+
*/
|
|
1248
|
+
async switchToRuntimeModel(snapshotId) {
|
|
1249
|
+
const runtimeModelSnapshot = this.runtimeModelSnapshots.get(snapshotId);
|
|
1250
|
+
if (!runtimeModelSnapshot) {
|
|
1251
|
+
throw new Error(`Runtime model snapshot '${snapshotId}' not found`);
|
|
1252
|
+
}
|
|
1253
|
+
const rollbackSnapshot = this.createStateSnapshotForRollback();
|
|
1254
|
+
try {
|
|
1255
|
+
const isAuthTypeChange = runtimeModelSnapshot.authType !== this.currentAuthType;
|
|
1256
|
+
this.currentAuthType = runtimeModelSnapshot.authType;
|
|
1257
|
+
this.activeRuntimeModelSnapshotId = snapshotId;
|
|
1258
|
+
this.currentRegistryBaseUrl = void 0;
|
|
1259
|
+
this.strictModelProviderSelection = false;
|
|
1260
|
+
this.hasManualCredentials = true;
|
|
1261
|
+
this._generationConfig.model = runtimeModelSnapshot.modelId;
|
|
1262
|
+
this.generationConfigSources["model"] = {
|
|
1263
|
+
kind: "programmatic",
|
|
1264
|
+
detail: "runtimeModelSwitch"
|
|
1265
|
+
};
|
|
1266
|
+
if (runtimeModelSnapshot.apiKey) {
|
|
1267
|
+
this._generationConfig.apiKey = runtimeModelSnapshot.apiKey;
|
|
1268
|
+
this.generationConfigSources["apiKey"] = runtimeModelSnapshot.sources["apiKey"] || {
|
|
1269
|
+
kind: "programmatic",
|
|
1270
|
+
detail: "runtimeModelSwitch"
|
|
1271
|
+
};
|
|
1272
|
+
}
|
|
1273
|
+
if (runtimeModelSnapshot.baseUrl) {
|
|
1274
|
+
this._generationConfig.baseUrl = runtimeModelSnapshot.baseUrl;
|
|
1275
|
+
this.generationConfigSources["baseUrl"] = runtimeModelSnapshot.sources["baseUrl"] || {
|
|
1276
|
+
kind: "programmatic",
|
|
1277
|
+
detail: "runtimeModelSwitch"
|
|
1278
|
+
};
|
|
1279
|
+
}
|
|
1280
|
+
if (runtimeModelSnapshot.apiKeyEnvKey) {
|
|
1281
|
+
this._generationConfig.apiKeyEnvKey = runtimeModelSnapshot.apiKeyEnvKey;
|
|
1282
|
+
}
|
|
1283
|
+
if (runtimeModelSnapshot.generationConfig) {
|
|
1284
|
+
Object.assign(
|
|
1285
|
+
this._generationConfig,
|
|
1286
|
+
runtimeModelSnapshot.generationConfig
|
|
1287
|
+
);
|
|
1288
|
+
}
|
|
1289
|
+
const requiresRefresh = isAuthTypeChange;
|
|
1290
|
+
if (this.onModelChange) {
|
|
1291
|
+
await this.onModelChange(
|
|
1292
|
+
runtimeModelSnapshot.authType,
|
|
1293
|
+
requiresRefresh
|
|
1294
|
+
);
|
|
1295
|
+
}
|
|
1296
|
+
} catch (error) {
|
|
1297
|
+
this.rollbackToStateSnapshot(rollbackSnapshot);
|
|
1298
|
+
throw error;
|
|
1299
|
+
}
|
|
1300
|
+
}
|
|
1301
|
+
/**
|
|
1302
|
+
* Get the active RuntimeModelSnapshot as an AvailableModel option.
|
|
1303
|
+
*
|
|
1304
|
+
* Converts the active RuntimeModelSnapshot to an AvailableModel format for display
|
|
1305
|
+
* in model lists. Returns undefined if no runtime model is active.
|
|
1306
|
+
*
|
|
1307
|
+
* @returns The runtime model as an AvailableModel option, or undefined
|
|
1308
|
+
*/
|
|
1309
|
+
getRuntimeModelOption() {
|
|
1310
|
+
const snapshot = this.getActiveRuntimeModelSnapshot();
|
|
1311
|
+
if (!snapshot) {
|
|
1312
|
+
return void 0;
|
|
1313
|
+
}
|
|
1314
|
+
return {
|
|
1315
|
+
id: snapshot.modelId,
|
|
1316
|
+
label: snapshot.modelId,
|
|
1317
|
+
authType: snapshot.authType,
|
|
1318
|
+
/**
|
|
1319
|
+
* `isVision` is for automatic switching of qwen-oauth vision model.
|
|
1320
|
+
* Runtime models are basically specified via CLI arguments, env variables,
|
|
1321
|
+
* or settings for other auth types.
|
|
1322
|
+
*/
|
|
1323
|
+
isVision: false,
|
|
1324
|
+
contextWindowSize: snapshot.generationConfig?.contextWindowSize,
|
|
1325
|
+
isRuntimeModel: true,
|
|
1326
|
+
runtimeSnapshotId: snapshot.id
|
|
1327
|
+
};
|
|
1328
|
+
}
|
|
1329
|
+
/**
|
|
1330
|
+
* Clear all RuntimeModelSnapshots for a specific authType.
|
|
1331
|
+
*
|
|
1332
|
+
* Removes all RuntimeModelSnapshots associated with the given authType.
|
|
1333
|
+
* Called when switching to a registry model to avoid stale RuntimeModelSnapshots.
|
|
1334
|
+
*
|
|
1335
|
+
* @param authType - The authType whose snapshots should be cleared
|
|
1336
|
+
*/
|
|
1337
|
+
clearRuntimeModelSnapshotForAuthType(authType) {
|
|
1338
|
+
for (const [id, snapshot] of this.runtimeModelSnapshots.entries()) {
|
|
1339
|
+
if (snapshot.authType === authType) {
|
|
1340
|
+
this.runtimeModelSnapshots.delete(id);
|
|
1341
|
+
if (this.activeRuntimeModelSnapshotId === id) {
|
|
1342
|
+
this.activeRuntimeModelSnapshotId = void 0;
|
|
1343
|
+
}
|
|
1344
|
+
}
|
|
1345
|
+
}
|
|
1346
|
+
}
|
|
1347
|
+
/**
|
|
1348
|
+
* Cleanup old RuntimeModelSnapshots to enforce per-authType limit.
|
|
1349
|
+
*
|
|
1350
|
+
* Keeps only the latest RuntimeModelSnapshot for each authType.
|
|
1351
|
+
* Older snapshots are removed to prevent unbounded growth.
|
|
1352
|
+
*/
|
|
1353
|
+
cleanupOldRuntimeModelSnapshots() {
|
|
1354
|
+
const snapshotsByAuthType = /* @__PURE__ */ new Map();
|
|
1355
|
+
for (const snapshot of this.runtimeModelSnapshots.values()) {
|
|
1356
|
+
const existing = snapshotsByAuthType.get(snapshot.authType);
|
|
1357
|
+
if (!existing || snapshot.createdAt > existing.createdAt) {
|
|
1358
|
+
snapshotsByAuthType.set(snapshot.authType, snapshot);
|
|
1359
|
+
}
|
|
1360
|
+
}
|
|
1361
|
+
this.runtimeModelSnapshots.clear();
|
|
1362
|
+
for (const snapshot of snapshotsByAuthType.values()) {
|
|
1363
|
+
this.runtimeModelSnapshots.set(snapshot.id, snapshot);
|
|
1364
|
+
}
|
|
1365
|
+
if (this.activeRuntimeModelSnapshotId && !this.runtimeModelSnapshots.has(this.activeRuntimeModelSnapshotId)) {
|
|
1366
|
+
this.activeRuntimeModelSnapshotId = void 0;
|
|
1367
|
+
}
|
|
1368
|
+
}
|
|
1369
|
+
/**
|
|
1370
|
+
* Reload model providers configuration at runtime.
|
|
1371
|
+
* This enables hot-reloading of modelProviders settings without restarting the CLI.
|
|
1372
|
+
*
|
|
1373
|
+
* @param modelProvidersConfig - The updated model providers configuration
|
|
1374
|
+
* @param providerProtocolConfig - Updated provider->protocol map; `undefined`
|
|
1375
|
+
* preserves the existing map (see {@link ModelRegistry.reloadModels}).
|
|
1376
|
+
*/
|
|
1377
|
+
reloadModelProvidersConfig(modelProvidersConfig, providerProtocolConfig) {
|
|
1378
|
+
this.modelRegistry.reloadModels(
|
|
1379
|
+
modelProvidersConfig,
|
|
1380
|
+
providerProtocolConfig
|
|
1381
|
+
);
|
|
1382
|
+
}
|
|
1383
|
+
/** The raw providers config the registry was last built from. */
|
|
1384
|
+
getModelProvidersConfig() {
|
|
1385
|
+
return this.modelRegistry.getModelProvidersConfig();
|
|
1386
|
+
}
|
|
1387
|
+
getProviderProtocolConfig() {
|
|
1388
|
+
return this.modelRegistry.getProviderProtocolConfig();
|
|
1389
|
+
}
|
|
1390
|
+
};
|
|
1391
|
+
|
|
1392
|
+
export {
|
|
1393
|
+
RUNTIME_SNAPSHOT_PREFIX,
|
|
1394
|
+
buildRuntimeSnapshotId,
|
|
1395
|
+
stripRuntimeSnapshotPrefix,
|
|
1396
|
+
resolveModelId,
|
|
1397
|
+
buildModelIdContext,
|
|
1398
|
+
isImageGenerationCapable,
|
|
1399
|
+
resolveProviderProtocol,
|
|
1400
|
+
ModelsConfig
|
|
1401
|
+
};
|
|
1402
|
+
/**
|
|
1403
|
+
* @license
|
|
1404
|
+
* Copyright 2025 Qwen
|
|
1405
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
1406
|
+
*/
|
|
1407
|
+
/**
|
|
1408
|
+
* @license
|
|
1409
|
+
* Copyright 2026 Qwen Team
|
|
1410
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
1411
|
+
*/
|
|
1412
|
+
/**
|
|
1413
|
+
* @license
|
|
1414
|
+
* Copyright 2025 Qwen Team
|
|
1415
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
1416
|
+
*/
|