@zubriq/code 0.19.8-1 → 0.19.9-1
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/dist/bundled/qc-helper/docs/features/channels/_meta.ts +1 -0
- package/dist/bundled/qc-helper/docs/features/channels/overview.md +23 -12
- package/dist/bundled/qc-helper/docs/features/channels/plugins.md +1 -0
- package/dist/bundled/qc-helper/docs/features/channels/wecom.md +111 -0
- package/dist/bundled/qc-helper/docs/features/hooks.md +36 -34
- package/dist/bundled/qc-helper/docs/features/memory.md +1 -1
- package/dist/bundled/qc-helper/docs/qwen-serve.md +17 -10
- package/dist/bundled/review/SKILL.md +6 -2
- package/dist/chunks/{MaxSizedBox-OWTCJQNO.js → MaxSizedBox-W6SAJMJC.js} +13 -11
- package/dist/chunks/{StandaloneSessionPicker-6NGEQFBH.js → StandaloneSessionPicker-YBKZZKIA.js} +28 -23
- package/dist/chunks/{acpAgent-XPRWSNOW.js → acpAgent-SQJQBOTS.js} +110 -80
- package/dist/chunks/{agent-TB6S4VXU.js → agent-QU7Q2RZN.js} +8 -8
- package/dist/chunks/{agent-headless-R3XYK5TT.js → agent-headless-PBHLWHND.js} +8 -8
- package/dist/chunks/{anthropicContentGenerator-FZQAEMYK.js → anthropicContentGenerator-52G6ZA3D.js} +31 -4
- package/dist/chunks/{artifact-tool-H2TNPNP5.js → artifact-tool-D233YJFH.js} +25 -6
- package/dist/chunks/{bridge-HVRG6SMU.js → bridge-LJLLDUMW.js} +17 -14
- package/dist/chunks/{ca-HCMB2I54.js → ca-MKD32FQL.js} +26 -1
- package/dist/chunks/{channel-worker-supervisor-B7MSMB5K.js → channel-worker-supervisor-NZQUOEFJ.js} +3 -3
- package/dist/chunks/{chunk-YRM6BC6H.js → chunk-27AYMAL6.js} +506 -63
- package/dist/chunks/{chunk-536GZ6UF.js → chunk-2MDC5WDB.js} +17 -111
- package/dist/chunks/{chunk-H3D6XAOL.js → chunk-2PRSBVPI.js} +3 -3
- package/dist/chunks/chunk-332PWN27.js +19 -0
- package/dist/chunks/{chunk-FVMWEHWU.js → chunk-3B26UVCX.js} +114 -12
- package/dist/chunks/{chunk-ZM5BPDXV.js → chunk-3F22JT4E.js} +1 -1
- package/dist/chunks/{chunk-W6RH6KHR.js → chunk-3GPVYALM.js} +4 -2
- package/dist/chunks/{chunk-G7ZG7CA6.js → chunk-3UP777ZS.js} +8 -7
- package/dist/chunks/{chunk-PA7QS4X5.js → chunk-43W4YSO6.js} +1 -12
- package/dist/chunks/{chunk-5EB2HK3X.js → chunk-4IK56VLC.js} +1 -1
- package/dist/chunks/{chunk-UE5TCZE6.js → chunk-5FAUIGXH.js} +5 -13
- package/dist/chunks/{chunk-VEB3NYSO.js → chunk-5MBO76SL.js} +5 -0
- package/dist/chunks/{chunk-PDITONOB.js → chunk-5MRUKUOG.js} +5347 -4132
- package/dist/chunks/{chunk-4UC3U66K.js → chunk-6EUMFVPJ.js} +5 -5
- package/dist/chunks/{chunk-YOGGIAGF.js → chunk-6JL5OVLX.js} +1 -1
- package/dist/chunks/{chunk-QG4ZO2EB.js → chunk-74E6VVF6.js} +11 -11
- package/dist/chunks/chunk-A2X3KLC3.js +3807 -0
- package/dist/chunks/{chunk-BA4HLTG2.js → chunk-B6B2MUUF.js} +5 -5
- package/dist/chunks/{chunk-XKYOIERV.js → chunk-BN5VYAOZ.js} +681 -1239
- package/dist/chunks/{chunk-IO76BGJ3.js → chunk-BYUA6YYS.js} +15 -9
- package/dist/chunks/{chunk-NCFY7PWS.js → chunk-CCGOFQV3.js} +51 -2
- package/dist/chunks/{chunk-66KNL43D.js → chunk-CD6USWHZ.js} +1 -1
- package/dist/chunks/{chunk-ZWSTIPSW.js → chunk-CEITMQ62.js} +2 -2
- package/dist/chunks/{chunk-7AQTBTVY.js → chunk-EJP6Z7NU.js} +4 -3
- package/dist/chunks/{chunk-RTW5ZXHO.js → chunk-EZTNYRHH.js} +6 -5
- package/dist/chunks/{chunk-MJQFA66Z.js → chunk-FAATDXYS.js} +308 -81
- package/dist/chunks/{chunk-DNV4FSN5.js → chunk-FBET5XZ2.js} +6 -4
- package/dist/chunks/{chunk-HTC4R67V.js → chunk-FES4YXJ3.js} +9 -9
- package/dist/chunks/{chunk-NBKE6QRZ.js → chunk-FHTUTVIQ.js} +10 -5
- package/dist/chunks/chunk-FII3C4E7.js +168 -0
- package/dist/chunks/{chunk-2NL7ED5Q.js → chunk-FV7425LN.js} +22 -1
- package/dist/chunks/{chunk-J6OET6C3.js → chunk-GAI76CFX.js} +4 -4
- package/dist/chunks/{chunk-B34OV7K2.js → chunk-GGQQA4JW.js} +13 -0
- package/dist/chunks/chunk-GLE2YUPU.js +34 -0
- package/dist/chunks/{chunk-X265R5C6.js → chunk-GN3F6PIU.js} +1 -1
- package/dist/chunks/{chunk-SM624MOZ.js → chunk-GWUN54UD.js} +1 -1
- package/dist/chunks/chunk-H3TELH3H.js +942 -0
- package/dist/chunks/{chunk-XZULYFIX.js → chunk-HD4DZI2L.js} +2 -2
- package/dist/chunks/{chunk-KLLLWQM2.js → chunk-HPQIVXSP.js} +1 -1
- package/dist/chunks/{chunk-WSVZFWN4.js → chunk-IBY3Q3HG.js} +693 -104
- package/dist/chunks/{chunk-JSEOX4CM.js → chunk-JGR6W4IX.js} +14 -8
- package/dist/chunks/chunk-K652V4NH.js +283 -0
- package/dist/chunks/{chunk-OCBJKHF2.js → chunk-KH2CZZDD.js} +2 -2
- package/dist/chunks/chunk-LGFAYIKX.js +115 -0
- package/dist/chunks/{chunk-QG5KDB6X.js → chunk-LZDW5TDV.js} +5 -5
- package/dist/chunks/{chunk-ENKWIF75.js → chunk-MA4AZNP7.js} +10 -10
- package/dist/chunks/{chunk-4RQIB5UZ.js → chunk-O2YT7VB4.js} +0 -34
- package/dist/chunks/{chunk-4KJ2BPIT.js → chunk-OACJLMLD.js} +2 -38
- package/dist/chunks/{chunk-ML2ZWH2K.js → chunk-PCWYMX57.js} +14 -153
- package/dist/chunks/{chunk-NHFBLJOI.js → chunk-Q3PQ5VGJ.js} +1 -1
- package/dist/chunks/{chunk-LGXBB2R2.js → chunk-QK3I36QG.js} +1 -1
- package/dist/chunks/chunk-RA7TR75G.js +8223 -0
- package/dist/chunks/{chunk-KSPVDFE4.js → chunk-SAIILPQ3.js} +0 -3
- package/dist/chunks/{chunk-DHKDK57Q.js → chunk-SNZPA74J.js} +146 -54
- package/dist/chunks/{chunk-PWR5MVM3.js → chunk-SSP3UT5C.js} +4 -4
- package/dist/chunks/{chunk-4LETJLG2.js → chunk-SUCRVT5L.js} +1 -1
- package/dist/chunks/{chunk-5YLZHETW.js → chunk-TRR5KGDN.js} +1 -1
- package/dist/chunks/chunk-UIDXQNMV.js +13 -0
- package/dist/chunks/{chunk-PIORL4OD.js → chunk-UKV3D7WB.js} +0 -44
- package/dist/chunks/chunk-UYNUIGUR.js +167 -0
- package/dist/chunks/chunk-V2TYBEWU.js +28 -0
- package/dist/chunks/chunk-V35MD7KN.js +13 -0
- package/dist/chunks/{chunk-N4HTVZDZ.js → chunk-VR3KCBHH.js} +1 -1
- package/dist/chunks/{chunk-APYUOROB.js → chunk-W4CTWW7M.js} +423 -61
- package/dist/chunks/{chunk-ABANKQYY.js → chunk-WJAW2O5H.js} +92 -465
- package/dist/chunks/{chunk-6RSBRKF5.js → chunk-WN4YJJGH.js} +2 -2
- package/dist/chunks/chunk-XNXVCNAT.js +88 -0
- package/dist/chunks/{chunk-TDGF35EN.js → chunk-XOHNA2S6.js} +1 -1
- package/dist/chunks/chunk-XQPMKWSV.js +487 -0
- package/dist/chunks/{chunk-4FQL7KUS.js → chunk-XWDHZP7P.js} +8 -8
- package/dist/chunks/{chunk-REPRY4F7.js → chunk-YCKKP4QA.js} +10 -10
- package/dist/chunks/{chunk-YNWQ3PUQ.js → chunk-YJWMOGGZ.js} +3 -3
- package/dist/chunks/{chunk-RFIL6REB.js → chunk-YKZIAK7C.js} +119 -29
- package/dist/chunks/{chunk-45YCXM2H.js → chunk-YZDBUH6S.js} +45 -9
- package/dist/chunks/chunk-Z3I3QJK3.js +47 -0
- package/dist/chunks/{chunk-G23FFNLT.js → chunk-ZDGPPCTW.js} +20 -8
- package/dist/chunks/chunk-ZL5HN75Q.js +61 -0
- package/dist/chunks/{chunk-IQX5S2RS.js → chunk-ZL7JCYWM.js} +66 -7
- package/dist/chunks/{computer-use-A72BECH4.js → computer-use-4B45EG2F.js} +8 -8
- package/dist/chunks/{contextCommand-RREXA4B7.js → contextCommand-GIVRWNTS.js} +12 -11
- package/dist/chunks/{cron-create-DDYU4DIR.js → cron-create-JSXEIPVS.js} +1 -1
- package/dist/chunks/{cron-delete-DFKOUZWN.js → cron-delete-OIFVEPGU.js} +1 -1
- package/dist/chunks/{cron-list-ME5QGAR5.js → cron-list-D4ZX4IOE.js} +1 -1
- package/dist/chunks/{daemon-XWG2EGFX.js → daemon-WPAENEBW.js} +71 -3
- package/dist/chunks/{daemon-status-provider-Y6AFXTET.js → daemon-status-provider-WBOAMCHE.js} +20 -17
- package/dist/chunks/{de-PLLFDERI.js → de-ZFPPQVSF.js} +26 -1
- package/dist/chunks/{dist-LPVU3L2M.js → dist-BEXOZXLQ.js} +6 -3792
- package/dist/chunks/{dist-7GU63KI5.js → dist-E6UANPIM.js} +1 -1
- package/dist/chunks/{dist-VHBP2PIG.js → dist-H2AEJCZ5.js} +2 -2
- package/dist/chunks/{dist-3UDX5T4T.js → dist-O2IRTRPP.js} +1 -1
- package/dist/chunks/dist-SCFLLYMK.js +3217 -0
- package/dist/chunks/{dist-H4HHZYCI.js → dist-Z34QPAQW.js} +2 -2
- package/dist/chunks/{earlyInputCapture-OAHBOGOO.js → earlyInputCapture-JWMCAJZR.js} +8 -8
- package/dist/chunks/{edit-SFYW3FOV.js → edit-O5FUVHBE.js} +9 -9
- package/dist/chunks/{en-AXARKOWO.js → en-N4EPZAQI.js} +31 -2
- package/dist/chunks/{enter-worktree-LUPPQ2NH.js → enter-worktree-LOJFRC3D.js} +8 -8
- package/dist/chunks/{enterPlanMode-44GEN5U6.js → enterPlanMode-VS3FAUPX.js} +8 -8
- package/dist/chunks/environment-WKW5TLSH.js +90 -0
- package/dist/chunks/{errors-H3Q3W3DL.js → errors-LEZXHJMR.js} +10 -10
- package/dist/chunks/{exit-worktree-34CVVWT4.js → exit-worktree-RN2NXRMP.js} +8 -8
- package/dist/chunks/{exitPlanMode-5G5BHNUP.js → exitPlanMode-EPC424I4.js} +8 -8
- package/dist/chunks/{fast-path-7PKGFBRM.js → fast-path-UUPAFOSQ.js} +12 -3
- package/dist/chunks/{fast-path-settings-RCRXH2JG.js → fast-path-settings-7RIFI3PK.js} +3 -2
- package/dist/chunks/{fr-MBMNQSQ6.js → fr-5WWMY53B.js} +30 -1
- package/dist/chunks/{gemini-2II6JH4H.js → gemini-QCKK4XNU.js} +438 -265
- package/dist/chunks/{geminiContentGenerator-SWEJVOC4.js → geminiContentGenerator-DX4SRXJA.js} +1 -1
- package/dist/chunks/{glob-5DFC7DXW.js → glob-4URMJWRX.js} +8 -8
- package/dist/chunks/{grep-QYVXGRRJ.js → grep-AEQB5KED.js} +8 -8
- package/dist/chunks/handleAutoUpdate-Y4YNG34Y.js +65 -0
- package/dist/chunks/{initializer-XX3UGUHE.js → initializer-NDEBMSOG.js} +17 -13
- package/dist/chunks/{ja-HFV5QCHR.js → ja-CUHZOLEJ.js} +30 -1
- package/dist/chunks/{list-AX5FWBVC.js → list-VSCBNOWT.js} +17 -15
- package/dist/chunks/{loadedSettingsAdapter-ISOM6GJ7.js → loadedSettingsAdapter-FDO752BA.js} +15 -13
- package/dist/chunks/{loop-wakeup-ZW5P6VPY.js → loop-wakeup-OHWEMFP5.js} +2 -2
- package/dist/chunks/{ls-L654WOAT.js → ls-7MFU2QYW.js} +1 -1
- package/dist/chunks/{lsp-M35KE54Y.js → lsp-XHDTPTGV.js} +2 -4
- package/dist/chunks/{mcp-74F6725E.js → mcp-MLPWTHUV.js} +15 -13
- package/dist/chunks/{monitor-W4WRSC2C.js → monitor-WCVHIJUJ.js} +16 -11
- package/dist/chunks/{nonInteractiveCli-4QMV6C4J.js → nonInteractiveCli-32HZK274.js} +52 -44
- package/dist/chunks/{notebook-edit-XBZEIP42.js → notebook-edit-NPOMPKS4.js} +9 -9
- package/dist/chunks/{openaiContentGenerator-RTUJDESE.js → openaiContentGenerator-6AIBSRQK.js} +6 -6
- package/dist/chunks/{pidfile-YWSGNTPK.js → pidfile-7Y3QEDSZ.js} +8 -8
- package/dist/chunks/{pt-2THT3YHA.js → pt-OLYN42DS.js} +26 -1
- package/dist/chunks/{qwenContentGenerator-4ZFYAZLY.js → qwenContentGenerator-OUYOAYT4.js} +10 -10
- package/dist/chunks/{read-file-D7DKDIAC.js → read-file-EESFA24L.js} +3 -3
- package/dist/chunks/{record-artifact-PP3LKHTS.js → record-artifact-SQ2OKRJW.js} +3 -3
- package/dist/chunks/{ripGrep-KG7JYNER.js → ripGrep-DLYV7ZZG.js} +8 -8
- package/dist/chunks/{ru-PER5I4OI.js → ru-MKM2HFDS.js} +26 -1
- package/dist/chunks/{run-qwen-serve-XGJSNF6S.js → run-qwen-serve-WUEHQROF.js} +602 -143
- package/dist/chunks/{scheduler-MOLWOE4G.js → scheduler-SK4Y66V4.js} +8 -8
- package/dist/chunks/{send-message-OA6MV4EU.js → send-message-76GT3JMC.js} +1 -1
- package/dist/chunks/{serve-4ZNVPYND.js → serve-UCDGVZFI.js} +17 -14
- package/dist/chunks/{server-ACWDFHIF.js → server-FVGFFVZ4.js} +1394 -328
- package/dist/chunks/{session-VYO2GRO2.js → session-RIGKDMGR.js} +53 -45
- package/dist/chunks/{settings-4J2O3K22.js → settings-LVFFGXGE.js} +24 -20
- package/dist/chunks/{shell-RKERJYXR.js → shell-PAWNAFYN.js} +8 -8
- package/dist/chunks/{skill-JYACZJ5V.js → skill-5YIN3Z6Y.js} +15 -5
- package/dist/chunks/{spawnChannel-BA3U3RGX.js → spawnChannel-KIMZHWNR.js} +10 -10
- package/dist/chunks/{src-3P337V4P.js → src-BIWCD3VX.js} +21 -9
- package/dist/chunks/{startInteractiveUI-SUSZ6FWB.js → startInteractiveUI-AFXLGUFI.js} +33759 -41620
- package/dist/chunks/{task-create-RPFZNB4B.js → task-create-WCHTB435.js} +2 -2
- package/dist/chunks/{task-update-5WUG5MVQ.js → task-update-XYWMHJGJ.js} +2 -2
- package/dist/chunks/{team-create-YVWGRZEA.js → team-create-26WOMISV.js} +8 -8
- package/dist/chunks/{team-plan-approval-VRF54TTI.js → team-plan-approval-B5XB6UQC.js} +8 -8
- package/dist/chunks/{theme-manager-JW2KOACL.js → theme-manager-4TJ5TEFD.js} +8 -8
- package/dist/chunks/{tool-search-KUSMAZBN.js → tool-search-FFU63E6M.js} +6 -23
- package/dist/chunks/total-session-admission-JOD7SMPJ.js +72 -0
- package/dist/chunks/{trustedFolders-ERGSUCDK.js → trustedFolders-IJ2QHXSC.js} +9 -9
- package/dist/chunks/updateCheck-5Z25DCBP.js +65 -0
- package/dist/chunks/{validateNonInterActiveAuth-DDI62H5X.js → validateNonInterActiveAuth-G5EY47DE.js} +49 -41
- package/dist/chunks/{version-VB3AHVUF.js → version-LGO3GOKQ.js} +2 -1
- package/dist/chunks/{workflow-WINKRCI4.js → workflow-ZTK3WT3D.js} +9 -9
- package/dist/chunks/{workspace-providers-status-ZVZPXKSO.js → workspace-providers-status-YMPTRKW2.js} +18 -15
- package/dist/chunks/workspace-registry-NBUL6LBH.js +74 -0
- package/dist/chunks/{workspace-service-GAS2LV2P.js → workspace-service-V6G2RCD4.js} +21 -19
- package/dist/chunks/{workspace-skills-status-4WGKYJVA.js → workspace-skills-status-ZCW44BCH.js} +16 -14
- package/dist/chunks/{write-file-UTLKVZNN.js → write-file-4FUTAEW6.js} +9 -9
- package/dist/chunks/{zh-RS3HZHFH.js → zh-J4F6QWQV.js} +31 -2
- package/dist/chunks/{zh-TW-L5GRQ4S4.js → zh-TW-XVDWOLSW.js} +31 -2
- package/dist/cli.js +11 -11
- package/dist/locales/ca.js +30 -0
- package/dist/locales/de.js +30 -0
- package/dist/locales/en.js +38 -2
- package/dist/locales/fr.js +36 -0
- package/dist/locales/ja.js +36 -0
- package/dist/locales/pt.js +30 -0
- package/dist/locales/ru.js +30 -0
- package/dist/locales/zh-TW.js +38 -2
- package/dist/locales/zh.js +38 -2
- package/dist/package.json +3 -3
- package/dist/web-shell/assets/{arc-C6tzvtOa.js → arc-BWyoJpY2.js} +1 -1
- package/dist/web-shell/assets/{architectureDiagram-3BPJPVTR-DSYQFGn9.js → architectureDiagram-3BPJPVTR-BT0mGrz2.js} +1 -1
- package/dist/web-shell/assets/{blockDiagram-GPEHLZMM-CHjBdXAD.js → blockDiagram-GPEHLZMM-BLgUWvyf.js} +1 -1
- package/dist/web-shell/assets/{c4Diagram-AAUBKEIU-BQzK6Yyb.js → c4Diagram-AAUBKEIU-DYx9M7oU.js} +1 -1
- package/dist/web-shell/assets/channel-wmPUGHtg.js +1 -0
- package/dist/web-shell/assets/{chunk-2J33WTMH-hpP2p3Ij.js → chunk-2J33WTMH-CfMHWbuZ.js} +1 -1
- package/dist/web-shell/assets/{chunk-4BX2VUAB-B5KtK1JJ.js → chunk-4BX2VUAB-B1URoqEV.js} +1 -1
- package/dist/web-shell/assets/{chunk-55IACEB6-BDv6Mfr2.js → chunk-55IACEB6-DAIaM4QF.js} +1 -1
- package/dist/web-shell/assets/{chunk-727SXJPM-BevPWfrX.js → chunk-727SXJPM-B2X34knw.js} +1 -1
- package/dist/web-shell/assets/{chunk-AQP2D5EJ-ChDrz2ad.js → chunk-AQP2D5EJ-Cif-zLTQ.js} +1 -1
- package/dist/web-shell/assets/{chunk-FMBD7UC4-ClMdVSDs.js → chunk-FMBD7UC4-H18WCXdY.js} +1 -1
- package/dist/web-shell/assets/{chunk-ND2GUHAM-BceV8kZS.js → chunk-ND2GUHAM-YFtetHi0.js} +1 -1
- package/dist/web-shell/assets/{chunk-QZHKN3VN-DtyK2wwc.js → chunk-QZHKN3VN-By2hiH3r.js} +1 -1
- package/dist/web-shell/assets/classDiagram-4FO5ZUOK-BA2ljEjW.js +1 -0
- package/dist/web-shell/assets/classDiagram-v2-Q7XG4LA2-BA2ljEjW.js +1 -0
- package/dist/web-shell/assets/{cose-bilkent-S5V4N54A-BGMsqwmE.js → cose-bilkent-S5V4N54A-VrcnnLZu.js} +1 -1
- package/dist/web-shell/assets/{dagre-BM42HDAG-C-71clpF.js → dagre-BM42HDAG-CGo-IaVV.js} +1 -1
- package/dist/web-shell/assets/{diagram-2AECGRRQ-WIzzlkec.js → diagram-2AECGRRQ-Dl4QjzIB.js} +1 -1
- package/dist/web-shell/assets/{diagram-5GNKFQAL-CtnhZUP1.js → diagram-5GNKFQAL-qMLmsO0u.js} +1 -1
- package/dist/web-shell/assets/{diagram-KO2AKTUF-CS_IUezp.js → diagram-KO2AKTUF-CHlmuxPI.js} +1 -1
- package/dist/web-shell/assets/{diagram-LMA3HP47-BQnGRwN9.js → diagram-LMA3HP47-BUwU3GwT.js} +1 -1
- package/dist/web-shell/assets/{diagram-OG6HWLK6-By2VIocq.js → diagram-OG6HWLK6-HEhwPDUM.js} +1 -1
- package/dist/web-shell/assets/{erDiagram-TEJ5UH35-Dy8WeNkr.js → erDiagram-TEJ5UH35-1n0llBmM.js} +1 -1
- package/dist/web-shell/assets/{flowDiagram-I6XJVG4X-Diu_4y0w.js → flowDiagram-I6XJVG4X-BN74uMnt.js} +1 -1
- package/dist/web-shell/assets/{ganttDiagram-6RSMTGT7-CH8euujP.js → ganttDiagram-6RSMTGT7-BoOq78i3.js} +1 -1
- package/dist/web-shell/assets/{gitGraphDiagram-PVQCEYII-DHiObZq1.js → gitGraphDiagram-PVQCEYII-CN8b00c8.js} +1 -1
- package/dist/web-shell/assets/index-CNwoO1Cn.js +783 -0
- package/dist/web-shell/assets/index-CWQ0z6kZ.css +5 -0
- package/dist/web-shell/assets/{infoDiagram-5YYISTIA-CvC9A6fh.js → infoDiagram-5YYISTIA-CCurnIna.js} +1 -1
- package/dist/web-shell/assets/{ishikawaDiagram-YF4QCWOH-BK46kC4E.js → ishikawaDiagram-YF4QCWOH-AwuRqdUP.js} +1 -1
- package/dist/web-shell/assets/{journeyDiagram-JHISSGLW-B2TIiKq4.js → journeyDiagram-JHISSGLW-B7IICk-E.js} +1 -1
- package/dist/web-shell/assets/{kanban-definition-UN3LZRKU-Bh0WAulO.js → kanban-definition-UN3LZRKU-BYF0OKhx.js} +1 -1
- package/dist/web-shell/assets/{linear-Bxe9SHMk.js → linear-GWWguGfD.js} +1 -1
- package/dist/web-shell/assets/{mermaid.core-B1Pv6D5B.js → mermaid.core-JqtkxvCl.js} +5 -5
- package/dist/web-shell/assets/{mindmap-definition-RKZ34NQL-Bz0joLH8.js → mindmap-definition-RKZ34NQL-B0MmHsZ6.js} +1 -1
- package/dist/web-shell/assets/{pieDiagram-4H26LBE5-CnN4x-VS.js → pieDiagram-4H26LBE5-DhImUZLQ.js} +1 -1
- package/dist/web-shell/assets/{quadrantDiagram-W4KKPZXB-BYWD4xO4.js → quadrantDiagram-W4KKPZXB-DGeSC3DT.js} +1 -1
- package/dist/web-shell/assets/{requirementDiagram-4Y6WPE33-B4MEhI9h.js → requirementDiagram-4Y6WPE33-DkspY6Re.js} +1 -1
- package/dist/web-shell/assets/{sankeyDiagram-5OEKKPKP-Dk_FgKLp.js → sankeyDiagram-5OEKKPKP-CaOofS2x.js} +1 -1
- package/dist/web-shell/assets/{sequenceDiagram-3UESZ5HK-B4ksiBZQ.js → sequenceDiagram-3UESZ5HK-DFQ_kFnN.js} +1 -1
- package/dist/web-shell/assets/{stateDiagram-AJRCARHV-CYf0xSPl.js → stateDiagram-AJRCARHV-D3snw0Tz.js} +1 -1
- package/dist/web-shell/assets/stateDiagram-v2-BHNVJYJU-BbSm_9d0.js +1 -0
- package/dist/web-shell/assets/{timeline-definition-PNZ67QCA-0CXeWHNY.js → timeline-definition-PNZ67QCA-l4zH8nLM.js} +1 -1
- package/dist/web-shell/assets/{vennDiagram-CIIHVFJN-DHoYY9v2.js → vennDiagram-CIIHVFJN-BnRlA98M.js} +1 -1
- package/dist/web-shell/assets/{wardley-L42UT6IY-D_65qshr.js → wardley-L42UT6IY-BS0xUdmd.js} +1 -1
- package/dist/web-shell/assets/{wardleyDiagram-YWT4CUSO-Cv90x1sd.js → wardleyDiagram-YWT4CUSO-DKGBUWyQ.js} +1 -1
- package/dist/web-shell/assets/{xychartDiagram-2RQKCTM6-5FQCYJyh.js → xychartDiagram-2RQKCTM6-DVb2HuOB.js} +1 -1
- package/dist/web-shell/index.html +2 -2
- package/package.json +3 -2
- package/dist/web-shell/assets/channel-V-ZaJrA6.js +0 -1
- package/dist/web-shell/assets/classDiagram-4FO5ZUOK-s-H0snGT.js +0 -1
- package/dist/web-shell/assets/classDiagram-v2-Q7XG4LA2-s-H0snGT.js +0 -1
- package/dist/web-shell/assets/index-DW75jq0K.css +0 -5
- package/dist/web-shell/assets/index-tiCo0xbZ.js +0 -779
- package/dist/web-shell/assets/stateDiagram-v2-BHNVJYJU-CMtrFRUb.js +0 -1
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
// Force strict mode and setup for ESM
|
|
2
2
|
"use strict";
|
|
3
3
|
import {
|
|
4
|
+
contextCommand
|
|
5
|
+
} from "./chunk-B6B2MUUF.js";
|
|
6
|
+
import {
|
|
7
|
+
ExtensionRefreshState,
|
|
4
8
|
isValidSessionId,
|
|
5
9
|
validateAuthMethod
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import {
|
|
8
|
-
contextCommand
|
|
9
|
-
} from "./chunk-BA4HLTG2.js";
|
|
10
|
+
} from "./chunk-W4CTWW7M.js";
|
|
10
11
|
import {
|
|
11
12
|
VSCODE_SHIFT_ENTER_SEQUENCE,
|
|
12
13
|
calculateCost,
|
|
@@ -18,25 +19,26 @@ import {
|
|
|
18
19
|
levelLabel,
|
|
19
20
|
useKeypress,
|
|
20
21
|
writeOsc52
|
|
21
|
-
} from "./chunk-
|
|
22
|
-
import {
|
|
23
|
-
isTerminalGoalStatusKind
|
|
24
|
-
} from "./chunk-KSPVDFE4.js";
|
|
22
|
+
} from "./chunk-6EUMFVPJ.js";
|
|
25
23
|
import {
|
|
26
24
|
Text
|
|
27
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-5FAUIGXH.js";
|
|
26
|
+
import {
|
|
27
|
+
isKittyProtocolEnabled
|
|
28
|
+
} from "./chunk-JZSY4WP3.js";
|
|
29
|
+
import {
|
|
30
|
+
getInstallationInfo,
|
|
31
|
+
rollbackStandaloneUpdate
|
|
32
|
+
} from "./chunk-H3TELH3H.js";
|
|
33
|
+
import {
|
|
34
|
+
isTerminalGoalStatusKind
|
|
35
|
+
} from "./chunk-SAIILPQ3.js";
|
|
28
36
|
import {
|
|
29
37
|
require_react
|
|
30
38
|
} from "./chunk-KYMBIKIW.js";
|
|
31
39
|
import {
|
|
32
40
|
themeManager
|
|
33
41
|
} from "./chunk-PC4ZXHU2.js";
|
|
34
|
-
import {
|
|
35
|
-
isKittyProtocolEnabled
|
|
36
|
-
} from "./chunk-JZSY4WP3.js";
|
|
37
|
-
import {
|
|
38
|
-
getErrorMessage as getErrorMessage2
|
|
39
|
-
} from "./chunk-6RSBRKF5.js";
|
|
40
42
|
import {
|
|
41
43
|
GITHUB_WORKFLOW_PATHS,
|
|
42
44
|
INSIGHT_CSS,
|
|
@@ -49,19 +51,19 @@ import {
|
|
|
49
51
|
toJson,
|
|
50
52
|
toJsonl,
|
|
51
53
|
toMarkdown
|
|
52
|
-
} from "./chunk-
|
|
53
|
-
import {
|
|
54
|
-
require_undici
|
|
55
|
-
} from "./chunk-54YZOP7P.js";
|
|
54
|
+
} from "./chunk-FHTUTVIQ.js";
|
|
56
55
|
import {
|
|
57
56
|
stripUnsafeCharacters,
|
|
58
57
|
toCodePoints
|
|
59
|
-
} from "./chunk-
|
|
58
|
+
} from "./chunk-2MDC5WDB.js";
|
|
59
|
+
import {
|
|
60
|
+
getErrorMessage as getErrorMessage2
|
|
61
|
+
} from "./chunk-WN4YJJGH.js";
|
|
60
62
|
import {
|
|
61
63
|
getExtendedSystemInfo,
|
|
62
64
|
getGitVersion,
|
|
63
65
|
getNpmVersion
|
|
64
|
-
} from "./chunk-
|
|
66
|
+
} from "./chunk-2PRSBVPI.js";
|
|
65
67
|
import {
|
|
66
68
|
formatDuration,
|
|
67
69
|
formatMemoryUsage,
|
|
@@ -70,7 +72,7 @@ import {
|
|
|
70
72
|
import {
|
|
71
73
|
isInlineModelOverrideAllowed,
|
|
72
74
|
parseAcpModelOption
|
|
73
|
-
} from "./chunk-
|
|
75
|
+
} from "./chunk-XWDHZP7P.js";
|
|
74
76
|
import {
|
|
75
77
|
formatUnsupportedVoiceModelMessage,
|
|
76
78
|
getVoiceSettingsScope,
|
|
@@ -78,7 +80,7 @@ import {
|
|
|
78
80
|
isVoiceEnabled,
|
|
79
81
|
readVoiceMode,
|
|
80
82
|
readVoiceModel
|
|
81
|
-
} from "./chunk-
|
|
83
|
+
} from "./chunk-SUCRVT5L.js";
|
|
82
84
|
import {
|
|
83
85
|
OUTPUT_LANGUAGE_AUTO,
|
|
84
86
|
getAllSettingKeys,
|
|
@@ -90,7 +92,7 @@ import {
|
|
|
90
92
|
resolveOutputLanguage,
|
|
91
93
|
validateSettingValue,
|
|
92
94
|
writeOutputLanguageAndRegisterPath
|
|
93
|
-
} from "./chunk-
|
|
95
|
+
} from "./chunk-WJAW2O5H.js";
|
|
94
96
|
import {
|
|
95
97
|
SUPPORTED_LANGUAGES,
|
|
96
98
|
getCurrentLanguage,
|
|
@@ -98,11 +100,11 @@ import {
|
|
|
98
100
|
resolveSupportedLanguage,
|
|
99
101
|
setLanguageAsync,
|
|
100
102
|
t
|
|
101
|
-
} from "./chunk-
|
|
103
|
+
} from "./chunk-MA4AZNP7.js";
|
|
102
104
|
import {
|
|
103
105
|
isFolderTrustEnabled,
|
|
104
106
|
loadTrustedFolders
|
|
105
|
-
} from "./chunk-
|
|
107
|
+
} from "./chunk-VR3KCBHH.js";
|
|
106
108
|
import {
|
|
107
109
|
require_strip_json_comments
|
|
108
110
|
} from "./chunk-QYUE6W3T.js";
|
|
@@ -118,7 +120,6 @@ import {
|
|
|
118
120
|
SESSION_TITLE_MAX_LENGTH,
|
|
119
121
|
SessionService,
|
|
120
122
|
ShellExecutionService,
|
|
121
|
-
So,
|
|
122
123
|
appendToLastTextPart,
|
|
123
124
|
buildBackgroundEntryLabel,
|
|
124
125
|
buildBareRememberPrompt,
|
|
@@ -150,7 +151,6 @@ import {
|
|
|
150
151
|
glob,
|
|
151
152
|
hookEventSupportsMatcher,
|
|
152
153
|
ideContextStore,
|
|
153
|
-
isGitRepository,
|
|
154
154
|
isImageCapable,
|
|
155
155
|
isSuccessStatus,
|
|
156
156
|
isTerminalStatus,
|
|
@@ -176,7 +176,7 @@ import {
|
|
|
176
176
|
stripStartupContext,
|
|
177
177
|
tryGenerateSessionTitle,
|
|
178
178
|
unregisterGoalHook
|
|
179
|
-
} from "./chunk-
|
|
179
|
+
} from "./chunk-5MRUKUOG.js";
|
|
180
180
|
import {
|
|
181
181
|
external_exports
|
|
182
182
|
} from "./chunk-K5PGHDBN.js";
|
|
@@ -186,7 +186,7 @@ import {
|
|
|
186
186
|
import {
|
|
187
187
|
APPROVAL_MODES,
|
|
188
188
|
FORK_SUBAGENT_TYPE
|
|
189
|
-
} from "./chunk-
|
|
189
|
+
} from "./chunk-5MBO76SL.js";
|
|
190
190
|
import {
|
|
191
191
|
applySkillAllowedTools,
|
|
192
192
|
buildSkillLlmContent
|
|
@@ -207,10 +207,10 @@ import {
|
|
|
207
207
|
recordSkillInvocation,
|
|
208
208
|
resolveOpenAILogDir,
|
|
209
209
|
uiTelemetryService
|
|
210
|
-
} from "./chunk-
|
|
210
|
+
} from "./chunk-27AYMAL6.js";
|
|
211
211
|
import {
|
|
212
212
|
getAutoMemoryRoot
|
|
213
|
-
} from "./chunk-
|
|
213
|
+
} from "./chunk-OACJLMLD.js";
|
|
214
214
|
import {
|
|
215
215
|
ToolNames
|
|
216
216
|
} from "./chunk-X3YGAX7V.js";
|
|
@@ -234,7 +234,7 @@ import {
|
|
|
234
234
|
isCpuProfileRecording,
|
|
235
235
|
startCpuProfile,
|
|
236
236
|
stopCpuProfile
|
|
237
|
-
} from "./chunk-
|
|
237
|
+
} from "./chunk-QK3I36QG.js";
|
|
238
238
|
import {
|
|
239
239
|
init_esbuild_shims
|
|
240
240
|
} from "./chunk-A4BMJM77.js";
|
|
@@ -281,7 +281,7 @@ var isBtwCommand = /* @__PURE__ */ __name((query) => {
|
|
|
281
281
|
}, "isBtwCommand");
|
|
282
282
|
var debugLogger = createDebugLogger("COMMAND_UTILS");
|
|
283
283
|
var copyToClipboard = /* @__PURE__ */ __name(async (text) => {
|
|
284
|
-
const run = /* @__PURE__ */ __name((cmd, args, options) => new Promise((
|
|
284
|
+
const run = /* @__PURE__ */ __name((cmd, args, options) => new Promise((resolve4, reject) => {
|
|
285
285
|
const child = options ? spawn(cmd, args, options) : spawn(cmd, args);
|
|
286
286
|
let stderr = "";
|
|
287
287
|
if (child.stderr) {
|
|
@@ -289,7 +289,7 @@ var copyToClipboard = /* @__PURE__ */ __name(async (text) => {
|
|
|
289
289
|
}
|
|
290
290
|
child.on("error", reject);
|
|
291
291
|
child.on("close", (code) => {
|
|
292
|
-
if (code === 0) return
|
|
292
|
+
if (code === 0) return resolve4();
|
|
293
293
|
const errorMsg = stderr.trim();
|
|
294
294
|
reject(
|
|
295
295
|
new Error(
|
|
@@ -455,6 +455,7 @@ init_esbuild_shims();
|
|
|
455
455
|
|
|
456
456
|
// packages/cli/src/utils/commands.ts
|
|
457
457
|
init_esbuild_shims();
|
|
458
|
+
var MAX_STACKED_SKILLS = 5;
|
|
458
459
|
var parseSlashCommand = /* @__PURE__ */ __name((query, commands) => {
|
|
459
460
|
const trimmed = query.trim();
|
|
460
461
|
const commandText = trimmed.substring(1).trim();
|
|
@@ -490,6 +491,55 @@ var parseSlashCommand = /* @__PURE__ */ __name((query, commands) => {
|
|
|
490
491
|
const args = commandToExecute ? commandText.slice(argsStart).trim() : parts.slice(pathIndex).join(" ");
|
|
491
492
|
return { commandToExecute, args, canonicalPath };
|
|
492
493
|
}, "parseSlashCommand");
|
|
494
|
+
var parseStackedSlashCommands = /* @__PURE__ */ __name((query, commands) => {
|
|
495
|
+
const trimmed = query.trim();
|
|
496
|
+
if (!trimmed.startsWith("/")) {
|
|
497
|
+
return { skills: [], remainingText: trimmed, exceededMax: false };
|
|
498
|
+
}
|
|
499
|
+
const commandText = trimmed.substring(1);
|
|
500
|
+
const skills = [];
|
|
501
|
+
let pos = 0;
|
|
502
|
+
let restPos = 0;
|
|
503
|
+
let exceededMax = false;
|
|
504
|
+
while (pos < commandText.length) {
|
|
505
|
+
while (pos < commandText.length && /\s/.test(commandText[pos])) pos++;
|
|
506
|
+
if (pos >= commandText.length) {
|
|
507
|
+
restPos = pos;
|
|
508
|
+
break;
|
|
509
|
+
}
|
|
510
|
+
const tokenStart = pos;
|
|
511
|
+
while (pos < commandText.length && !/\s/.test(commandText[pos])) pos++;
|
|
512
|
+
const token = commandText.slice(tokenStart, pos);
|
|
513
|
+
if (skills.length === 0) {
|
|
514
|
+
if (token.startsWith("/")) break;
|
|
515
|
+
const cmd2 = findCommandByName(token, commands);
|
|
516
|
+
if (!cmd2 || cmd2.kind !== "skill" /* SKILL */) break;
|
|
517
|
+
skills.push(cmd2);
|
|
518
|
+
restPos = pos;
|
|
519
|
+
continue;
|
|
520
|
+
}
|
|
521
|
+
if (!token.startsWith("/")) break;
|
|
522
|
+
const name = token.substring(1);
|
|
523
|
+
if (!name) break;
|
|
524
|
+
const cmd = findCommandByName(name, commands);
|
|
525
|
+
if (!cmd || cmd.kind !== "skill" /* SKILL */) break;
|
|
526
|
+
if (skills.length >= MAX_STACKED_SKILLS) {
|
|
527
|
+
exceededMax = true;
|
|
528
|
+
break;
|
|
529
|
+
}
|
|
530
|
+
skills.push(cmd);
|
|
531
|
+
restPos = pos;
|
|
532
|
+
}
|
|
533
|
+
if (skills.length < 2) {
|
|
534
|
+
return { skills: [], remainingText: trimmed, exceededMax: false };
|
|
535
|
+
}
|
|
536
|
+
const afterSkills = commandText.slice(restPos).trim();
|
|
537
|
+
return { skills, remainingText: afterSkills, exceededMax };
|
|
538
|
+
}, "parseStackedSlashCommands");
|
|
539
|
+
function findCommandByName(name, commands) {
|
|
540
|
+
return commands.find((cmd) => cmd.name === name) ?? commands.find((cmd) => cmd.altNames?.includes(name));
|
|
541
|
+
}
|
|
542
|
+
__name(findCommandByName, "findCommandByName");
|
|
493
543
|
|
|
494
544
|
// packages/cli/src/services/CommandService.ts
|
|
495
545
|
init_esbuild_shims();
|
|
@@ -2647,11 +2697,19 @@ init_esbuild_shims();
|
|
|
2647
2697
|
// packages/cli/src/ui/utils/backgroundWorkUtils.ts
|
|
2648
2698
|
init_esbuild_shims();
|
|
2649
2699
|
function hasBlockingBackgroundWork(config) {
|
|
2650
|
-
return
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2700
|
+
return (
|
|
2701
|
+
// hasRunningTasks, not hasUnfinalizedTasks: a cancelled task whose
|
|
2702
|
+
// finalize callback hasn't fired yet must not block /clear or
|
|
2703
|
+
// session resume — both abort-and-reset the registry right after
|
|
2704
|
+
// this gate, suppressing the pending notification anyway. Gating on
|
|
2705
|
+
// the unfinalized set made /new silently no-op when typed in the
|
|
2706
|
+
// window between cancel and finalize (issue #5949).
|
|
2707
|
+
config.getBackgroundTaskRegistry().hasRunningTasks() || config.getMonitorRegistry().getRunning().length > 0 || config.getBackgroundShellRegistry().hasRunningEntries() || // R7 (wenshao): the WorkflowRunRegistry is a 4th sibling that the
|
|
2708
|
+
// earlier P4b commit forgot to wire here. Without this OR clause,
|
|
2709
|
+
// /clear and session-resume happily ran while a workflow was
|
|
2710
|
+
// mid-run, orphaning the dispatch loop.
|
|
2711
|
+
config.getWorkflowRunRegistry().hasRunningEntries()
|
|
2712
|
+
);
|
|
2655
2713
|
}
|
|
2656
2714
|
__name(hasBlockingBackgroundWork, "hasBlockingBackgroundWork");
|
|
2657
2715
|
function resetBackgroundStateForSessionSwitch(config) {
|
|
@@ -2685,14 +2743,11 @@ var clearCommand = {
|
|
|
2685
2743
|
if (hasBlockingBackgroundWork(config)) {
|
|
2686
2744
|
const content = "Stop the current session's running background tasks before starting a new session.";
|
|
2687
2745
|
context.ui.setDebugMessage(content);
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
};
|
|
2694
|
-
}
|
|
2695
|
-
return;
|
|
2746
|
+
return {
|
|
2747
|
+
type: "message",
|
|
2748
|
+
messageType: "error",
|
|
2749
|
+
content
|
|
2750
|
+
};
|
|
2696
2751
|
}
|
|
2697
2752
|
config.getHookSystem()?.fireSessionEndEvent("clear" /* Clear */).catch((err) => {
|
|
2698
2753
|
config.getDebugLogger().warn(`SessionEnd hook failed: ${err}`);
|
|
@@ -4355,7 +4410,7 @@ function writeMemoryHeapSnapshot({
|
|
|
4355
4410
|
}
|
|
4356
4411
|
__name(writeMemoryHeapSnapshot, "writeMemoryHeapSnapshot");
|
|
4357
4412
|
function defaultWait(ms) {
|
|
4358
|
-
return new Promise((
|
|
4413
|
+
return new Promise((resolve4) => setTimeout(resolve4, ms));
|
|
4359
4414
|
}
|
|
4360
4415
|
__name(defaultWait, "defaultWait");
|
|
4361
4416
|
function normalizeSampleCount(sampleCount) {
|
|
@@ -4560,925 +4615,6 @@ function formatMemoryDiagnostics(diagnostics) {
|
|
|
4560
4615
|
}
|
|
4561
4616
|
__name(formatMemoryDiagnostics, "formatMemoryDiagnostics");
|
|
4562
4617
|
|
|
4563
|
-
// packages/cli/src/utils/standalone-update.ts
|
|
4564
|
-
init_esbuild_shims();
|
|
4565
|
-
var import_undici = __toESM(require_undici(), 1);
|
|
4566
|
-
import { createHash } from "node:crypto";
|
|
4567
|
-
import * as fs5 from "node:fs";
|
|
4568
|
-
import * as os3 from "node:os";
|
|
4569
|
-
import * as path5 from "node:path";
|
|
4570
|
-
import { Readable, Transform } from "node:stream";
|
|
4571
|
-
import { spawn as spawn2, execFile } from "node:child_process";
|
|
4572
|
-
import { pipeline } from "node:stream/promises";
|
|
4573
|
-
|
|
4574
|
-
// packages/cli/src/utils/standalone-update-verify.ts
|
|
4575
|
-
init_esbuild_shims();
|
|
4576
|
-
import { createPublicKey, verify } from "node:crypto";
|
|
4577
|
-
var RELEASE_PUBLIC_KEY_DER_B64 = "MCowBQYDK2VwAyEAr9WRFLDauibZQKCe1oKfuFZn6zRMaEkD5+KVqN6mKM4=";
|
|
4578
|
-
function verifySignature(sha256sumsContent, signatureBase64) {
|
|
4579
|
-
const key = createPublicKey({
|
|
4580
|
-
key: Buffer.from(RELEASE_PUBLIC_KEY_DER_B64, "base64"),
|
|
4581
|
-
format: "der",
|
|
4582
|
-
type: "spki"
|
|
4583
|
-
});
|
|
4584
|
-
const signature = Buffer.from(signatureBase64, "base64");
|
|
4585
|
-
if (signature.length !== 64) {
|
|
4586
|
-
throw new Error(
|
|
4587
|
-
`Invalid signature length: expected 64 bytes, got ${signature.length}`
|
|
4588
|
-
);
|
|
4589
|
-
}
|
|
4590
|
-
const valid = verify(null, Buffer.from(sha256sumsContent), key, signature);
|
|
4591
|
-
if (!valid) {
|
|
4592
|
-
throw new Error(
|
|
4593
|
-
"SHA256SUMS signature verification failed \u2014 possible tampering detected"
|
|
4594
|
-
);
|
|
4595
|
-
}
|
|
4596
|
-
}
|
|
4597
|
-
__name(verifySignature, "verifySignature");
|
|
4598
|
-
|
|
4599
|
-
// packages/cli/src/utils/standalone-update.ts
|
|
4600
|
-
var debugLogger6 = createDebugLogger("STANDALONE_UPDATE");
|
|
4601
|
-
var OSS_BASE = "https://qwen-code-assets.oss-cn-hangzhou.aliyuncs.com/releases/qwen-code";
|
|
4602
|
-
var GITHUB_BASE = "https://github.com/QwenLM/qwen-code/releases/download";
|
|
4603
|
-
var FETCH_TIMEOUT_MS = 3e4;
|
|
4604
|
-
var ARCHIVE_TIMEOUT_MS = 3e5;
|
|
4605
|
-
var VALID_TARGETS = /* @__PURE__ */ new Set([
|
|
4606
|
-
"darwin-arm64",
|
|
4607
|
-
"darwin-x64",
|
|
4608
|
-
"linux-arm64",
|
|
4609
|
-
"linux-x64",
|
|
4610
|
-
"win-x64"
|
|
4611
|
-
]);
|
|
4612
|
-
var SEMVER_RE = /^v?\d+\.\d+\.\d+(-[\w.]+)?$/;
|
|
4613
|
-
function normalizeVersion(version) {
|
|
4614
|
-
if (!SEMVER_RE.test(version)) {
|
|
4615
|
-
throw new Error(`Invalid version format: ${version}`);
|
|
4616
|
-
}
|
|
4617
|
-
return version.startsWith("v") ? version : `v${version}`;
|
|
4618
|
-
}
|
|
4619
|
-
__name(normalizeVersion, "normalizeVersion");
|
|
4620
|
-
function validateTarget(target) {
|
|
4621
|
-
if (!VALID_TARGETS.has(target)) {
|
|
4622
|
-
throw new Error(`Unknown target: ${target}`);
|
|
4623
|
-
}
|
|
4624
|
-
}
|
|
4625
|
-
__name(validateTarget, "validateTarget");
|
|
4626
|
-
function archiveFilename(target) {
|
|
4627
|
-
const ext = target.startsWith("win") ? "zip" : "tar.gz";
|
|
4628
|
-
return `qwen-code-${target}.${ext}`;
|
|
4629
|
-
}
|
|
4630
|
-
__name(archiveFilename, "archiveFilename");
|
|
4631
|
-
function escapePS(s) {
|
|
4632
|
-
return s.replace(/'/g, "''");
|
|
4633
|
-
}
|
|
4634
|
-
__name(escapePS, "escapePS");
|
|
4635
|
-
async function tryFetch(url, timeoutMs = FETCH_TIMEOUT_MS) {
|
|
4636
|
-
try {
|
|
4637
|
-
const res = await (0, import_undici.fetch)(url, {
|
|
4638
|
-
signal: AbortSignal.timeout(timeoutMs)
|
|
4639
|
-
});
|
|
4640
|
-
if (res.ok) return { response: res };
|
|
4641
|
-
await res.body?.cancel().catch(() => {
|
|
4642
|
-
});
|
|
4643
|
-
return { error: new Error(`HTTP ${res.status} ${res.statusText}`) };
|
|
4644
|
-
} catch (err) {
|
|
4645
|
-
const error = err instanceof Error ? err : new Error(String(err));
|
|
4646
|
-
debugLogger6.debug(`Fetch failed for ${url}: ${error.message}`);
|
|
4647
|
-
return { error };
|
|
4648
|
-
}
|
|
4649
|
-
}
|
|
4650
|
-
__name(tryFetch, "tryFetch");
|
|
4651
|
-
async function downloadWithFallback(versionPath, filename, timeoutMs = FETCH_TIMEOUT_MS) {
|
|
4652
|
-
const ossUrl = `${OSS_BASE}/${versionPath}/${filename}`;
|
|
4653
|
-
const ossResult = await tryFetch(ossUrl, timeoutMs);
|
|
4654
|
-
if (ossResult.response) return ossResult.response;
|
|
4655
|
-
const ghUrl = `${GITHUB_BASE}/${versionPath}/${filename}`;
|
|
4656
|
-
const ghResult = await tryFetch(ghUrl, timeoutMs);
|
|
4657
|
-
if (ghResult.response) return ghResult.response;
|
|
4658
|
-
throw new Error(
|
|
4659
|
-
`Failed to download ${filename}: OSS (${ossResult.error?.message ?? "unknown"}), GitHub (${ghResult.error?.message ?? "unknown"})`
|
|
4660
|
-
);
|
|
4661
|
-
}
|
|
4662
|
-
__name(downloadWithFallback, "downloadWithFallback");
|
|
4663
|
-
async function verifyChecksum(actualHash, filename, versionPath) {
|
|
4664
|
-
const response = await downloadWithFallback(versionPath, "SHA256SUMS");
|
|
4665
|
-
const text = await response.text();
|
|
4666
|
-
const requireSig = process.env["QWEN_REQUIRE_SIGNATURE"] === "1";
|
|
4667
|
-
let sigResponse;
|
|
4668
|
-
try {
|
|
4669
|
-
sigResponse = await downloadWithFallback(versionPath, "SHA256SUMS.sig");
|
|
4670
|
-
} catch (err) {
|
|
4671
|
-
debugLogger6.debug("SHA256SUMS.sig not available:", err);
|
|
4672
|
-
}
|
|
4673
|
-
if (sigResponse) {
|
|
4674
|
-
const sigContent = await sigResponse.text();
|
|
4675
|
-
verifySignature(text, sigContent.trim());
|
|
4676
|
-
debugLogger6.info("SHA256SUMS signature verified.");
|
|
4677
|
-
} else if (requireSig) {
|
|
4678
|
-
throw new Error(
|
|
4679
|
-
"SHA256SUMS.sig not found and QWEN_REQUIRE_SIGNATURE=1 is set"
|
|
4680
|
-
);
|
|
4681
|
-
} else {
|
|
4682
|
-
debugLogger6.warn(
|
|
4683
|
-
"SHA256SUMS.sig not available \u2014 update integrity relies on SHA256 checksum only. Set QWEN_REQUIRE_SIGNATURE=1 to enforce signature verification."
|
|
4684
|
-
);
|
|
4685
|
-
}
|
|
4686
|
-
const expectedLine = text.split("\n").find((line) => {
|
|
4687
|
-
const parts = line.trim().split(/\s+/);
|
|
4688
|
-
if (parts.length < 2) return false;
|
|
4689
|
-
const name = parts[parts.length - 1].replace(/^\*/, "");
|
|
4690
|
-
return name === filename;
|
|
4691
|
-
});
|
|
4692
|
-
if (!expectedLine) {
|
|
4693
|
-
throw new Error(`No checksum found for ${filename} in SHA256SUMS`);
|
|
4694
|
-
}
|
|
4695
|
-
const expectedHash = expectedLine.trim().split(/\s+/)[0];
|
|
4696
|
-
if (actualHash !== expectedHash) {
|
|
4697
|
-
throw new Error(
|
|
4698
|
-
`Checksum mismatch: expected ${expectedHash}, got ${actualHash}`
|
|
4699
|
-
);
|
|
4700
|
-
}
|
|
4701
|
-
}
|
|
4702
|
-
__name(verifyChecksum, "verifyChecksum");
|
|
4703
|
-
var MAX_DOWNLOAD_BYTES = 512 * 1024 * 1024;
|
|
4704
|
-
async function downloadToFile(versionPath, filename, destPath) {
|
|
4705
|
-
const response = await downloadWithFallback(
|
|
4706
|
-
versionPath,
|
|
4707
|
-
filename,
|
|
4708
|
-
ARCHIVE_TIMEOUT_MS
|
|
4709
|
-
);
|
|
4710
|
-
const body = response.body;
|
|
4711
|
-
if (!body) throw new Error("Empty response body");
|
|
4712
|
-
const contentLength = response.headers.get("content-length");
|
|
4713
|
-
if (contentLength && parseInt(contentLength, 10) > MAX_DOWNLOAD_BYTES) {
|
|
4714
|
-
await body.cancel().catch(() => {
|
|
4715
|
-
});
|
|
4716
|
-
throw new Error(
|
|
4717
|
-
`Download too large: ${contentLength} bytes exceeds ${MAX_DOWNLOAD_BYTES} limit`
|
|
4718
|
-
);
|
|
4719
|
-
}
|
|
4720
|
-
const hash = createHash("sha256");
|
|
4721
|
-
let bytesWritten = 0;
|
|
4722
|
-
const dest = fs5.createWriteStream(destPath);
|
|
4723
|
-
const sizeGuard = new Transform({
|
|
4724
|
-
transform(chunk, _encoding, callback) {
|
|
4725
|
-
bytesWritten += chunk.length;
|
|
4726
|
-
if (bytesWritten > MAX_DOWNLOAD_BYTES) {
|
|
4727
|
-
callback(
|
|
4728
|
-
new Error(`Download exceeded ${MAX_DOWNLOAD_BYTES} byte limit`)
|
|
4729
|
-
);
|
|
4730
|
-
} else {
|
|
4731
|
-
hash.update(chunk);
|
|
4732
|
-
callback(null, chunk);
|
|
4733
|
-
}
|
|
4734
|
-
}
|
|
4735
|
-
});
|
|
4736
|
-
await pipeline(Readable.fromWeb(body), sizeGuard, dest);
|
|
4737
|
-
return hash.digest("hex");
|
|
4738
|
-
}
|
|
4739
|
-
__name(downloadToFile, "downloadToFile");
|
|
4740
|
-
function validateExtractedPaths(resolvedDest) {
|
|
4741
|
-
const entries = fs5.readdirSync(resolvedDest, {
|
|
4742
|
-
recursive: true,
|
|
4743
|
-
withFileTypes: true
|
|
4744
|
-
});
|
|
4745
|
-
for (const entry of entries) {
|
|
4746
|
-
const fullPath = path5.join(
|
|
4747
|
-
String(entry.parentPath || entry.path),
|
|
4748
|
-
entry.name
|
|
4749
|
-
);
|
|
4750
|
-
const resolved = fs5.realpathSync(fullPath);
|
|
4751
|
-
if (!resolved.startsWith(resolvedDest + path5.sep) && resolved !== resolvedDest) {
|
|
4752
|
-
fs5.rmSync(resolvedDest, { recursive: true, force: true });
|
|
4753
|
-
throw new Error(
|
|
4754
|
-
`Path traversal detected in archive: ${entry.name} resolves to ${resolved}`
|
|
4755
|
-
);
|
|
4756
|
-
}
|
|
4757
|
-
}
|
|
4758
|
-
}
|
|
4759
|
-
__name(validateExtractedPaths, "validateExtractedPaths");
|
|
4760
|
-
function isSafeTarEntryPath(entryPath) {
|
|
4761
|
-
if (entryPath.length === 0) return false;
|
|
4762
|
-
if (path5.posix.isAbsolute(entryPath) || path5.win32.isAbsolute(entryPath)) {
|
|
4763
|
-
return false;
|
|
4764
|
-
}
|
|
4765
|
-
return !entryPath.split(/[\\/]+/).includes("..");
|
|
4766
|
-
}
|
|
4767
|
-
__name(isSafeTarEntryPath, "isSafeTarEntryPath");
|
|
4768
|
-
async function extractArchive(archivePath, destDir, target) {
|
|
4769
|
-
fs5.mkdirSync(destDir, { recursive: true });
|
|
4770
|
-
if (target.startsWith("win")) {
|
|
4771
|
-
await new Promise((resolve5, reject) => {
|
|
4772
|
-
const ps = spawn2(
|
|
4773
|
-
"powershell.exe",
|
|
4774
|
-
[
|
|
4775
|
-
"-NoProfile",
|
|
4776
|
-
"-Command",
|
|
4777
|
-
`Expand-Archive -Path '${escapePS(archivePath)}' -DestinationPath '${escapePS(destDir)}' -Force`
|
|
4778
|
-
],
|
|
4779
|
-
{ stdio: "ignore" }
|
|
4780
|
-
);
|
|
4781
|
-
ps.on(
|
|
4782
|
-
"close",
|
|
4783
|
-
(code) => code === 0 ? resolve5() : reject(new Error(`Expand-Archive exited with code ${code}`))
|
|
4784
|
-
);
|
|
4785
|
-
ps.on("error", reject);
|
|
4786
|
-
});
|
|
4787
|
-
const resolvedDest = fs5.realpathSync(destDir);
|
|
4788
|
-
validateExtractedPaths(resolvedDest);
|
|
4789
|
-
} else {
|
|
4790
|
-
const resolvedDest = path5.resolve(destDir);
|
|
4791
|
-
await So({
|
|
4792
|
-
file: archivePath,
|
|
4793
|
-
cwd: destDir,
|
|
4794
|
-
preservePaths: false,
|
|
4795
|
-
filter: /* @__PURE__ */ __name((p, entry) => {
|
|
4796
|
-
if (!isSafeTarEntryPath(p)) return false;
|
|
4797
|
-
if ("type" in entry && entry.type === "SymbolicLink" && "linkpath" in entry) {
|
|
4798
|
-
const linkTarget = path5.resolve(
|
|
4799
|
-
resolvedDest,
|
|
4800
|
-
path5.dirname(p),
|
|
4801
|
-
String(entry.linkpath)
|
|
4802
|
-
);
|
|
4803
|
-
if (!linkTarget.startsWith(resolvedDest + path5.sep) && linkTarget !== resolvedDest) {
|
|
4804
|
-
return false;
|
|
4805
|
-
}
|
|
4806
|
-
}
|
|
4807
|
-
return true;
|
|
4808
|
-
}, "filter")
|
|
4809
|
-
});
|
|
4810
|
-
validateExtractedPaths(fs5.realpathSync(destDir));
|
|
4811
|
-
}
|
|
4812
|
-
}
|
|
4813
|
-
__name(extractArchive, "extractArchive");
|
|
4814
|
-
function spawnAndCapture(command, args, timeoutMs) {
|
|
4815
|
-
return new Promise((resolve5, reject) => {
|
|
4816
|
-
let settled = false;
|
|
4817
|
-
const child = execFile(
|
|
4818
|
-
command,
|
|
4819
|
-
args,
|
|
4820
|
-
{ timeout: timeoutMs },
|
|
4821
|
-
(err, out, stderr) => {
|
|
4822
|
-
if (settled) return;
|
|
4823
|
-
settled = true;
|
|
4824
|
-
if (err && ("killed" in err && err.killed || "signal" in err && err.signal)) {
|
|
4825
|
-
reject(new Error("Smoke test timed out"));
|
|
4826
|
-
return;
|
|
4827
|
-
}
|
|
4828
|
-
if (err) {
|
|
4829
|
-
const exitCode = "code" in err && typeof err.code === "number" ? err.code : 1;
|
|
4830
|
-
resolve5({ exitCode, stdout: out || "", stderr: stderr || "" });
|
|
4831
|
-
return;
|
|
4832
|
-
}
|
|
4833
|
-
resolve5({ exitCode: 0, stdout: out || "", stderr: stderr || "" });
|
|
4834
|
-
}
|
|
4835
|
-
);
|
|
4836
|
-
child.on("error", (e) => {
|
|
4837
|
-
if (settled) return;
|
|
4838
|
-
settled = true;
|
|
4839
|
-
reject(e);
|
|
4840
|
-
});
|
|
4841
|
-
});
|
|
4842
|
-
}
|
|
4843
|
-
__name(spawnAndCapture, "spawnAndCapture");
|
|
4844
|
-
async function smokeTest(newInstallDir, target) {
|
|
4845
|
-
const resolvedInstallDir = path5.resolve(newInstallDir);
|
|
4846
|
-
const nodeBin = target.startsWith("win") ? path5.join(resolvedInstallDir, "node", "node.exe") : path5.join(resolvedInstallDir, "node", "bin", "node");
|
|
4847
|
-
const cliBin = path5.join(resolvedInstallDir, "lib", "cli.js");
|
|
4848
|
-
if (!fs5.existsSync(nodeBin)) {
|
|
4849
|
-
throw new Error(`Smoke test failed: node binary not found at ${nodeBin}`);
|
|
4850
|
-
}
|
|
4851
|
-
if (!fs5.existsSync(cliBin)) {
|
|
4852
|
-
throw new Error(`Smoke test failed: cli.js not found at ${cliBin}`);
|
|
4853
|
-
}
|
|
4854
|
-
const { exitCode, stdout, stderr } = await spawnAndCapture(
|
|
4855
|
-
nodeBin,
|
|
4856
|
-
[cliBin, "--version"],
|
|
4857
|
-
1e4
|
|
4858
|
-
);
|
|
4859
|
-
if (exitCode !== 0) {
|
|
4860
|
-
const detail = stderr.trim() ? `: ${stderr.trim()}` : "";
|
|
4861
|
-
throw new Error(
|
|
4862
|
-
`Smoke test failed: new binary exited with code ${exitCode}${detail}`
|
|
4863
|
-
);
|
|
4864
|
-
}
|
|
4865
|
-
const version = stdout.trim();
|
|
4866
|
-
if (!SEMVER_RE.test(version)) {
|
|
4867
|
-
throw new Error(
|
|
4868
|
-
`Smoke test failed: unexpected version output "${version}"`
|
|
4869
|
-
);
|
|
4870
|
-
}
|
|
4871
|
-
debugLogger6.info(`Smoke test passed: ${version}`);
|
|
4872
|
-
}
|
|
4873
|
-
__name(smokeTest, "smokeTest");
|
|
4874
|
-
function acquireLock(lockPath) {
|
|
4875
|
-
try {
|
|
4876
|
-
fs5.writeFileSync(lockPath, String(process.pid), { flag: "wx" });
|
|
4877
|
-
return true;
|
|
4878
|
-
} catch {
|
|
4879
|
-
try {
|
|
4880
|
-
const pidStr = fs5.readFileSync(lockPath, "utf-8").trim();
|
|
4881
|
-
const pid = parseInt(pidStr, 10);
|
|
4882
|
-
if (Number.isNaN(pid) || !isProcessAlive(pid)) {
|
|
4883
|
-
fs5.unlinkSync(lockPath);
|
|
4884
|
-
try {
|
|
4885
|
-
fs5.writeFileSync(lockPath, String(process.pid), { flag: "wx" });
|
|
4886
|
-
return true;
|
|
4887
|
-
} catch {
|
|
4888
|
-
return false;
|
|
4889
|
-
}
|
|
4890
|
-
}
|
|
4891
|
-
} catch {
|
|
4892
|
-
}
|
|
4893
|
-
return false;
|
|
4894
|
-
}
|
|
4895
|
-
}
|
|
4896
|
-
__name(acquireLock, "acquireLock");
|
|
4897
|
-
function releaseLock(lockPath) {
|
|
4898
|
-
try {
|
|
4899
|
-
fs5.unlinkSync(lockPath);
|
|
4900
|
-
} catch {
|
|
4901
|
-
}
|
|
4902
|
-
}
|
|
4903
|
-
__name(releaseLock, "releaseLock");
|
|
4904
|
-
function cleanupEmptyStandaloneDir(standaloneDir) {
|
|
4905
|
-
const manifestPath = path5.join(standaloneDir, "manifest.json");
|
|
4906
|
-
if (fs5.existsSync(standaloneDir) && !fs5.existsSync(manifestPath)) {
|
|
4907
|
-
fs5.rmSync(standaloneDir, { recursive: true, force: true });
|
|
4908
|
-
}
|
|
4909
|
-
}
|
|
4910
|
-
__name(cleanupEmptyStandaloneDir, "cleanupEmptyStandaloneDir");
|
|
4911
|
-
var UNSAFE_SHELL_CHARS = /["`$\\;\n\r]/;
|
|
4912
|
-
var UNSAFE_CMD_CHARS = /[&|<>^%!"`\n\r]/;
|
|
4913
|
-
function assertSafeForShellEmbed(p, context) {
|
|
4914
|
-
if (UNSAFE_SHELL_CHARS.test(p)) {
|
|
4915
|
-
throw new Error(
|
|
4916
|
-
`${context} contains characters unsafe for shell embedding: ${p}`
|
|
4917
|
-
);
|
|
4918
|
-
}
|
|
4919
|
-
}
|
|
4920
|
-
__name(assertSafeForShellEmbed, "assertSafeForShellEmbed");
|
|
4921
|
-
function isProcessAlive(pid) {
|
|
4922
|
-
try {
|
|
4923
|
-
process.kill(pid, 0);
|
|
4924
|
-
return true;
|
|
4925
|
-
} catch {
|
|
4926
|
-
return false;
|
|
4927
|
-
}
|
|
4928
|
-
}
|
|
4929
|
-
__name(isProcessAlive, "isProcessAlive");
|
|
4930
|
-
function atomicReplace(standaloneDir, newDir, lockPath) {
|
|
4931
|
-
const oldDir = `${standaloneDir}.old`;
|
|
4932
|
-
const pendingDir = `${standaloneDir}.new`;
|
|
4933
|
-
if (fs5.existsSync(oldDir)) {
|
|
4934
|
-
fs5.rmSync(oldDir, { recursive: true, force: true });
|
|
4935
|
-
}
|
|
4936
|
-
if (os3.platform() === "win32") {
|
|
4937
|
-
if (UNSAFE_CMD_CHARS.test(standaloneDir) || UNSAFE_CMD_CHARS.test(oldDir) || UNSAFE_CMD_CHARS.test(pendingDir)) {
|
|
4938
|
-
throw new Error(
|
|
4939
|
-
"Installation path contains characters unsafe for deferred update script"
|
|
4940
|
-
);
|
|
4941
|
-
}
|
|
4942
|
-
if (fs5.existsSync(pendingDir)) {
|
|
4943
|
-
fs5.rmSync(pendingDir, { recursive: true, force: true });
|
|
4944
|
-
}
|
|
4945
|
-
fs5.renameSync(newDir, pendingDir);
|
|
4946
|
-
const lockFile = lockPath;
|
|
4947
|
-
const logFile = path5.join(path5.dirname(standaloneDir), "qwen-update.log");
|
|
4948
|
-
const script = [
|
|
4949
|
-
"@echo off",
|
|
4950
|
-
"set /a TRIES=0",
|
|
4951
|
-
":wait",
|
|
4952
|
-
"set /a TRIES+=1",
|
|
4953
|
-
"if %TRIES% GTR 30 goto proceed",
|
|
4954
|
-
`tasklist /FI "PID eq ${process.pid}" 2>nul | find "${process.pid}" >nul && (timeout /t 1 >nul & goto wait)`,
|
|
4955
|
-
":proceed",
|
|
4956
|
-
`echo [%DATE% %TIME%] starting swap >> "${logFile}"`,
|
|
4957
|
-
`move /Y "${standaloneDir}" "${oldDir}"`,
|
|
4958
|
-
"if errorlevel 1 goto move1_failed",
|
|
4959
|
-
`move /Y "${pendingDir}" "${standaloneDir}"`,
|
|
4960
|
-
"if errorlevel 1 goto move2_failed",
|
|
4961
|
-
`echo [%DATE% %TIME%] swap completed >> "${logFile}"`,
|
|
4962
|
-
"goto cleanup",
|
|
4963
|
-
":move1_failed",
|
|
4964
|
-
`echo [%DATE% %TIME%] ERROR: failed to rename install to .old (errorlevel %errorlevel%) >> "${logFile}"`,
|
|
4965
|
-
"goto cleanup",
|
|
4966
|
-
":move2_failed",
|
|
4967
|
-
`echo [%DATE% %TIME%] ERROR: failed to promote .new; rolling back >> "${logFile}"`,
|
|
4968
|
-
`move /Y "${oldDir}" "${standaloneDir}"`,
|
|
4969
|
-
"if errorlevel 1 (",
|
|
4970
|
-
` echo [%DATE% %TIME%] CRITICAL: rollback also failed; manual recovery: move "${oldDir}" "${standaloneDir}" >> "${logFile}"`,
|
|
4971
|
-
") else (",
|
|
4972
|
-
` echo [%DATE% %TIME%] rollback succeeded >> "${logFile}"`,
|
|
4973
|
-
")",
|
|
4974
|
-
":cleanup",
|
|
4975
|
-
`del /F /Q "${lockFile}" 2>nul`,
|
|
4976
|
-
`del "%~f0"`
|
|
4977
|
-
].join("\r\n");
|
|
4978
|
-
const scriptPath = path5.join(
|
|
4979
|
-
path5.dirname(standaloneDir),
|
|
4980
|
-
"qwen-update.bat"
|
|
4981
|
-
);
|
|
4982
|
-
fs5.writeFileSync(scriptPath, script);
|
|
4983
|
-
spawn2("cmd.exe", ["/c", scriptPath], {
|
|
4984
|
-
detached: true,
|
|
4985
|
-
stdio: "ignore",
|
|
4986
|
-
windowsHide: true
|
|
4987
|
-
}).unref();
|
|
4988
|
-
return "deferred";
|
|
4989
|
-
} else {
|
|
4990
|
-
fs5.renameSync(standaloneDir, oldDir);
|
|
4991
|
-
try {
|
|
4992
|
-
fs5.renameSync(newDir, standaloneDir);
|
|
4993
|
-
} catch (promoteErr) {
|
|
4994
|
-
try {
|
|
4995
|
-
fs5.renameSync(oldDir, standaloneDir);
|
|
4996
|
-
} catch (rollbackErr) {
|
|
4997
|
-
const detail = `Standalone update failed AND rollback failed.
|
|
4998
|
-
Original error: ${promoteErr.message}
|
|
4999
|
-
Rollback error: ${rollbackErr.message}
|
|
5000
|
-
Manual recovery: mv "${oldDir}" "${standaloneDir}"`;
|
|
5001
|
-
throw new Error(detail);
|
|
5002
|
-
}
|
|
5003
|
-
throw promoteErr;
|
|
5004
|
-
}
|
|
5005
|
-
return "done";
|
|
5006
|
-
}
|
|
5007
|
-
}
|
|
5008
|
-
__name(atomicReplace, "atomicReplace");
|
|
5009
|
-
function ensureBinWrapper(standaloneDir, target) {
|
|
5010
|
-
const binDir = path5.join(path5.dirname(standaloneDir), "..", "bin");
|
|
5011
|
-
try {
|
|
5012
|
-
fs5.mkdirSync(binDir, { recursive: true });
|
|
5013
|
-
if (target.startsWith("win")) {
|
|
5014
|
-
if (UNSAFE_CMD_CHARS.test(standaloneDir)) {
|
|
5015
|
-
throw new Error(
|
|
5016
|
-
"standaloneDir contains characters unsafe for cmd.exe wrapper"
|
|
5017
|
-
);
|
|
5018
|
-
}
|
|
5019
|
-
const wrapperPath = path5.join(binDir, "qwen.cmd");
|
|
5020
|
-
if (!fs5.existsSync(wrapperPath)) {
|
|
5021
|
-
const content = `@echo off\r
|
|
5022
|
-
call "${standaloneDir}\\bin\\qwen.cmd" %*\r
|
|
5023
|
-
`;
|
|
5024
|
-
fs5.writeFileSync(wrapperPath, content);
|
|
5025
|
-
}
|
|
5026
|
-
} else {
|
|
5027
|
-
assertSafeForShellEmbed(standaloneDir, "standaloneDir");
|
|
5028
|
-
const wrapperPath = path5.join(binDir, "qwen");
|
|
5029
|
-
if (!fs5.existsSync(wrapperPath)) {
|
|
5030
|
-
const content = `#!/bin/sh
|
|
5031
|
-
exec "${standaloneDir}/bin/qwen" "$@"
|
|
5032
|
-
`;
|
|
5033
|
-
fs5.writeFileSync(wrapperPath, content, { mode: 493 });
|
|
5034
|
-
}
|
|
5035
|
-
ensurePathInShellRc(binDir);
|
|
5036
|
-
}
|
|
5037
|
-
} catch (err) {
|
|
5038
|
-
debugLogger6.warn("Failed to create bin wrapper:", err);
|
|
5039
|
-
}
|
|
5040
|
-
}
|
|
5041
|
-
__name(ensureBinWrapper, "ensureBinWrapper");
|
|
5042
|
-
function ensurePathInShellRc(binDir) {
|
|
5043
|
-
assertSafeForShellEmbed(binDir, "binDir");
|
|
5044
|
-
const shell = process.env["SHELL"] || "";
|
|
5045
|
-
let rcFile = null;
|
|
5046
|
-
const home = process.env["HOME"] || os3.homedir();
|
|
5047
|
-
if (shell.endsWith("/zsh")) {
|
|
5048
|
-
rcFile = path5.join(home, ".zshrc");
|
|
5049
|
-
} else if (shell.endsWith("/bash")) {
|
|
5050
|
-
const bashrc = path5.join(home, ".bashrc");
|
|
5051
|
-
const profile = path5.join(home, ".bash_profile");
|
|
5052
|
-
if (os3.platform() === "darwin") {
|
|
5053
|
-
rcFile = fs5.existsSync(profile) ? profile : bashrc;
|
|
5054
|
-
} else {
|
|
5055
|
-
rcFile = bashrc;
|
|
5056
|
-
}
|
|
5057
|
-
} else if (shell.endsWith("/fish")) {
|
|
5058
|
-
rcFile = path5.join(home, ".config", "fish", "config.fish");
|
|
5059
|
-
}
|
|
5060
|
-
if (!rcFile) return;
|
|
5061
|
-
try {
|
|
5062
|
-
const content = fs5.existsSync(rcFile) ? fs5.readFileSync(rcFile, "utf-8") : "";
|
|
5063
|
-
const marker = "# Added by Qwen Code standalone installer";
|
|
5064
|
-
if (content.includes(marker)) return;
|
|
5065
|
-
const exportLine = shell.endsWith("/fish") ? `
|
|
5066
|
-
${marker}
|
|
5067
|
-
fish_add_path "${binDir}"
|
|
5068
|
-
` : `
|
|
5069
|
-
${marker}
|
|
5070
|
-
export PATH="${binDir}:$PATH"
|
|
5071
|
-
`;
|
|
5072
|
-
fs5.appendFileSync(rcFile, exportLine);
|
|
5073
|
-
debugLogger6.info(`Added ${binDir} to ${rcFile}`);
|
|
5074
|
-
} catch (err) {
|
|
5075
|
-
debugLogger6.debug("Failed to update shell rc:", err);
|
|
5076
|
-
}
|
|
5077
|
-
}
|
|
5078
|
-
__name(ensurePathInShellRc, "ensurePathInShellRc");
|
|
5079
|
-
function detectTarget() {
|
|
5080
|
-
const platform3 = os3.platform();
|
|
5081
|
-
const arch2 = os3.arch();
|
|
5082
|
-
if (platform3 === "darwin") {
|
|
5083
|
-
return arch2 === "arm64" ? "darwin-arm64" : "darwin-x64";
|
|
5084
|
-
}
|
|
5085
|
-
if (platform3 === "win32") return "win-x64";
|
|
5086
|
-
if (platform3 === "linux") {
|
|
5087
|
-
if (arch2 === "arm64") return "linux-arm64";
|
|
5088
|
-
if (arch2 === "x64") return "linux-x64";
|
|
5089
|
-
}
|
|
5090
|
-
throw new Error(`Unsupported platform: ${platform3}-${arch2}`);
|
|
5091
|
-
}
|
|
5092
|
-
__name(detectTarget, "detectTarget");
|
|
5093
|
-
async function performStandaloneUpdate(standaloneDir, newVersion) {
|
|
5094
|
-
const versionPath = normalizeVersion(newVersion);
|
|
5095
|
-
let target;
|
|
5096
|
-
let isFirstTimeMigration = false;
|
|
5097
|
-
const manifestPath = path5.join(standaloneDir, "manifest.json");
|
|
5098
|
-
if (fs5.existsSync(manifestPath)) {
|
|
5099
|
-
const manifestRaw = fs5.readFileSync(manifestPath, "utf-8");
|
|
5100
|
-
const manifest = JSON.parse(manifestRaw);
|
|
5101
|
-
target = manifest.target ?? detectTarget();
|
|
5102
|
-
} else if (fs5.existsSync(standaloneDir)) {
|
|
5103
|
-
throw new Error(
|
|
5104
|
-
`${standaloneDir} exists but is not a Qwen Code standalone install. Remove it manually to proceed.`
|
|
5105
|
-
);
|
|
5106
|
-
} else {
|
|
5107
|
-
target = detectTarget();
|
|
5108
|
-
isFirstTimeMigration = true;
|
|
5109
|
-
}
|
|
5110
|
-
validateTarget(target);
|
|
5111
|
-
const filename = archiveFilename(target);
|
|
5112
|
-
const parentDir = path5.dirname(standaloneDir);
|
|
5113
|
-
fs5.mkdirSync(parentDir, { recursive: true });
|
|
5114
|
-
const lockPath = path5.join(parentDir, ".qwen-update.lock");
|
|
5115
|
-
if (!acquireLock(lockPath)) {
|
|
5116
|
-
throw new Error("Another update is already in progress");
|
|
5117
|
-
}
|
|
5118
|
-
if (isFirstTimeMigration) {
|
|
5119
|
-
fs5.mkdirSync(standaloneDir, { recursive: true });
|
|
5120
|
-
}
|
|
5121
|
-
const tempDir = fs5.mkdtempSync(path5.join(os3.tmpdir(), "qwen-code-update-"));
|
|
5122
|
-
let extractDir;
|
|
5123
|
-
let updateResult;
|
|
5124
|
-
try {
|
|
5125
|
-
extractDir = fs5.mkdtempSync(path5.join(parentDir, ".qwen-code-update-"));
|
|
5126
|
-
} catch (err) {
|
|
5127
|
-
fs5.rmSync(tempDir, { recursive: true, force: true });
|
|
5128
|
-
releaseLock(lockPath);
|
|
5129
|
-
throw err;
|
|
5130
|
-
}
|
|
5131
|
-
try {
|
|
5132
|
-
const archivePath = path5.join(tempDir, filename);
|
|
5133
|
-
debugLogger6.info(`Downloading ${filename} (${versionPath})...`);
|
|
5134
|
-
const archiveHash = await downloadToFile(
|
|
5135
|
-
versionPath,
|
|
5136
|
-
filename,
|
|
5137
|
-
archivePath
|
|
5138
|
-
);
|
|
5139
|
-
debugLogger6.info("Verifying checksum...");
|
|
5140
|
-
await verifyChecksum(archiveHash, filename, versionPath);
|
|
5141
|
-
debugLogger6.info("Extracting archive...");
|
|
5142
|
-
await extractArchive(archivePath, extractDir, target);
|
|
5143
|
-
const newInstallDir = path5.join(extractDir, "qwen-code");
|
|
5144
|
-
if (!fs5.existsSync(path5.join(newInstallDir, "manifest.json"))) {
|
|
5145
|
-
throw new Error(
|
|
5146
|
-
"Extracted archive does not contain expected qwen-code directory"
|
|
5147
|
-
);
|
|
5148
|
-
}
|
|
5149
|
-
debugLogger6.info("Running smoke test...");
|
|
5150
|
-
await smokeTest(newInstallDir, target);
|
|
5151
|
-
debugLogger6.info("Replacing installation...");
|
|
5152
|
-
updateResult = atomicReplace(standaloneDir, newInstallDir, lockPath);
|
|
5153
|
-
const oldDir = `${standaloneDir}.old`;
|
|
5154
|
-
if (fs5.existsSync(oldDir)) {
|
|
5155
|
-
if (isFirstTimeMigration) {
|
|
5156
|
-
fs5.rmSync(oldDir, { recursive: true, force: true });
|
|
5157
|
-
} else {
|
|
5158
|
-
try {
|
|
5159
|
-
const oldManifestPath = path5.join(oldDir, "manifest.json");
|
|
5160
|
-
let oldVersion = "unknown";
|
|
5161
|
-
if (fs5.existsSync(oldManifestPath)) {
|
|
5162
|
-
const oldManifest = JSON.parse(
|
|
5163
|
-
fs5.readFileSync(oldManifestPath, "utf-8")
|
|
5164
|
-
);
|
|
5165
|
-
oldVersion = oldManifest.version || "unknown";
|
|
5166
|
-
}
|
|
5167
|
-
const rollbackInfo = {
|
|
5168
|
-
preservedVersion: oldVersion,
|
|
5169
|
-
updatedTo: versionPath,
|
|
5170
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
5171
|
-
reason: "auto-update"
|
|
5172
|
-
};
|
|
5173
|
-
fs5.writeFileSync(
|
|
5174
|
-
path5.join(oldDir, ".qwen-rollback-info.json"),
|
|
5175
|
-
JSON.stringify(rollbackInfo, null, 2)
|
|
5176
|
-
);
|
|
5177
|
-
} catch {
|
|
5178
|
-
}
|
|
5179
|
-
}
|
|
5180
|
-
}
|
|
5181
|
-
ensureBinWrapper(standaloneDir, target);
|
|
5182
|
-
debugLogger6.info("Standalone update complete.");
|
|
5183
|
-
return updateResult;
|
|
5184
|
-
} catch (err) {
|
|
5185
|
-
const pendingDir = `${standaloneDir}.new`;
|
|
5186
|
-
if (fs5.existsSync(pendingDir)) {
|
|
5187
|
-
fs5.rmSync(pendingDir, { recursive: true, force: true });
|
|
5188
|
-
}
|
|
5189
|
-
cleanupEmptyStandaloneDir(standaloneDir);
|
|
5190
|
-
throw err;
|
|
5191
|
-
} finally {
|
|
5192
|
-
if (updateResult !== "deferred") {
|
|
5193
|
-
releaseLock(lockPath);
|
|
5194
|
-
}
|
|
5195
|
-
try {
|
|
5196
|
-
fs5.rmSync(tempDir, { recursive: true, force: true });
|
|
5197
|
-
} catch {
|
|
5198
|
-
}
|
|
5199
|
-
try {
|
|
5200
|
-
fs5.rmSync(extractDir, { recursive: true, force: true });
|
|
5201
|
-
} catch {
|
|
5202
|
-
}
|
|
5203
|
-
}
|
|
5204
|
-
}
|
|
5205
|
-
__name(performStandaloneUpdate, "performStandaloneUpdate");
|
|
5206
|
-
function rollbackStandaloneUpdate(standaloneDir) {
|
|
5207
|
-
const lockPath = path5.join(path5.dirname(standaloneDir), ".qwen-update.lock");
|
|
5208
|
-
try {
|
|
5209
|
-
const pidStr = fs5.readFileSync(lockPath, "utf-8").trim();
|
|
5210
|
-
const pid = parseInt(pidStr, 10);
|
|
5211
|
-
if (!Number.isNaN(pid) && isProcessAlive(pid)) {
|
|
5212
|
-
return {
|
|
5213
|
-
ok: false,
|
|
5214
|
-
reason: "rename-failed",
|
|
5215
|
-
detail: "An auto-update is currently in progress. Wait for it to finish before rolling back."
|
|
5216
|
-
};
|
|
5217
|
-
}
|
|
5218
|
-
} catch {
|
|
5219
|
-
}
|
|
5220
|
-
const oldDir = `${standaloneDir}.old`;
|
|
5221
|
-
if (!fs5.existsSync(oldDir)) {
|
|
5222
|
-
return { ok: false, reason: "no-old", detail: `${oldDir} does not exist` };
|
|
5223
|
-
}
|
|
5224
|
-
const oldManifest = path5.join(oldDir, "manifest.json");
|
|
5225
|
-
if (!fs5.existsSync(oldManifest)) {
|
|
5226
|
-
debugLogger6.error("Rollback failed: .old directory has no manifest.json");
|
|
5227
|
-
return {
|
|
5228
|
-
ok: false,
|
|
5229
|
-
reason: "no-manifest",
|
|
5230
|
-
detail: `${oldDir}/manifest.json missing \u2014 .old may be corrupt`
|
|
5231
|
-
};
|
|
5232
|
-
}
|
|
5233
|
-
const failedDir = `${standaloneDir}.failed`;
|
|
5234
|
-
try {
|
|
5235
|
-
if (fs5.existsSync(failedDir)) {
|
|
5236
|
-
fs5.rmSync(failedDir, { recursive: true, force: true });
|
|
5237
|
-
}
|
|
5238
|
-
fs5.renameSync(standaloneDir, failedDir);
|
|
5239
|
-
fs5.renameSync(oldDir, standaloneDir);
|
|
5240
|
-
debugLogger6.info("Rollback successful.");
|
|
5241
|
-
try {
|
|
5242
|
-
fs5.rmSync(failedDir, { recursive: true, force: true });
|
|
5243
|
-
} catch {
|
|
5244
|
-
debugLogger6.debug(`Leftover .failed dir at ${failedDir}, safe to delete`);
|
|
5245
|
-
}
|
|
5246
|
-
return { ok: true };
|
|
5247
|
-
} catch (err) {
|
|
5248
|
-
debugLogger6.error("Rollback failed:", err);
|
|
5249
|
-
if (!fs5.existsSync(standaloneDir) && fs5.existsSync(failedDir)) {
|
|
5250
|
-
try {
|
|
5251
|
-
fs5.renameSync(failedDir, standaloneDir);
|
|
5252
|
-
return {
|
|
5253
|
-
ok: false,
|
|
5254
|
-
reason: "rename-failed",
|
|
5255
|
-
detail: `Filesystem error: ${err.message}. Current installation was restored automatically.`
|
|
5256
|
-
};
|
|
5257
|
-
} catch {
|
|
5258
|
-
}
|
|
5259
|
-
}
|
|
5260
|
-
return {
|
|
5261
|
-
ok: false,
|
|
5262
|
-
reason: "rename-failed",
|
|
5263
|
-
detail: `Filesystem error: ${err.message}. Manual recovery: mv "${oldDir}" "${standaloneDir}"`
|
|
5264
|
-
};
|
|
5265
|
-
}
|
|
5266
|
-
}
|
|
5267
|
-
__name(rollbackStandaloneUpdate, "rollbackStandaloneUpdate");
|
|
5268
|
-
|
|
5269
|
-
// packages/cli/src/utils/installationInfo.ts
|
|
5270
|
-
init_esbuild_shims();
|
|
5271
|
-
import * as fs6 from "node:fs";
|
|
5272
|
-
import * as path6 from "node:path";
|
|
5273
|
-
import * as childProcess from "node:child_process";
|
|
5274
|
-
var debugLogger7 = createDebugLogger("INSTALLATION_INFO");
|
|
5275
|
-
var STANDALONE_UNIX_INSTALLER = "https://qwen-code-assets.oss-cn-hangzhou.aliyuncs.com/installation/install-qwen-standalone.sh";
|
|
5276
|
-
var STANDALONE_WINDOWS_INSTALLER = "https://qwen-code-assets.oss-cn-hangzhou.aliyuncs.com/installation/install-qwen-standalone.ps1";
|
|
5277
|
-
function getInstallationInfo(projectRoot, isAutoUpdateEnabled) {
|
|
5278
|
-
const cliPath = process.argv[1];
|
|
5279
|
-
if (!cliPath) {
|
|
5280
|
-
return { packageManager: "unknown" /* UNKNOWN */, isGlobal: false };
|
|
5281
|
-
}
|
|
5282
|
-
try {
|
|
5283
|
-
const realPath = fs6.realpathSync(cliPath).replace(/\\/g, "/");
|
|
5284
|
-
const normalizedProjectRoot = projectRoot?.replace(/\\/g, "/");
|
|
5285
|
-
const isGit = isGitRepository(process.cwd());
|
|
5286
|
-
if (isGit && normalizedProjectRoot && isSamePathOrInside(realPath, normalizedProjectRoot) && !realPath.includes("/node_modules/")) {
|
|
5287
|
-
return {
|
|
5288
|
-
packageManager: "unknown" /* UNKNOWN */,
|
|
5289
|
-
// Not managed by a package manager in this sense
|
|
5290
|
-
isGlobal: false,
|
|
5291
|
-
updateMessage: 'Running from a local git clone. Please update with "git pull".'
|
|
5292
|
-
};
|
|
5293
|
-
}
|
|
5294
|
-
if (realPath.includes("/.npm/_npx") || realPath.includes("/npm/_npx")) {
|
|
5295
|
-
return {
|
|
5296
|
-
packageManager: "npx" /* NPX */,
|
|
5297
|
-
isGlobal: false,
|
|
5298
|
-
updateMessage: "Running via npx, update not applicable."
|
|
5299
|
-
};
|
|
5300
|
-
}
|
|
5301
|
-
if (realPath.includes("/.pnpm/_pnpx")) {
|
|
5302
|
-
return {
|
|
5303
|
-
packageManager: "pnpx" /* PNPX */,
|
|
5304
|
-
isGlobal: false,
|
|
5305
|
-
updateMessage: "Running via pnpx, update not applicable."
|
|
5306
|
-
};
|
|
5307
|
-
}
|
|
5308
|
-
const standaloneInfo = getStandaloneInstallInfo(
|
|
5309
|
-
realPath,
|
|
5310
|
-
isAutoUpdateEnabled
|
|
5311
|
-
);
|
|
5312
|
-
if (standaloneInfo) {
|
|
5313
|
-
return standaloneInfo;
|
|
5314
|
-
}
|
|
5315
|
-
if (process.platform === "darwin") {
|
|
5316
|
-
try {
|
|
5317
|
-
childProcess.execSync('brew list -1 | grep -q "^qwen-code$"', {
|
|
5318
|
-
stdio: "ignore"
|
|
5319
|
-
});
|
|
5320
|
-
return {
|
|
5321
|
-
packageManager: "homebrew" /* HOMEBREW */,
|
|
5322
|
-
isGlobal: true,
|
|
5323
|
-
updateMessage: 'Installed via Homebrew. Please update with "brew upgrade".'
|
|
5324
|
-
};
|
|
5325
|
-
} catch (_error) {
|
|
5326
|
-
}
|
|
5327
|
-
}
|
|
5328
|
-
if (realPath.includes("/.pnpm/global")) {
|
|
5329
|
-
const updateCommand2 = "pnpm add -g @qwen-code/qwen-code@latest";
|
|
5330
|
-
return {
|
|
5331
|
-
packageManager: "pnpm" /* PNPM */,
|
|
5332
|
-
isGlobal: true,
|
|
5333
|
-
updateCommand: updateCommand2,
|
|
5334
|
-
updateMessage: isAutoUpdateEnabled ? "Installed with pnpm. Attempting to automatically update now..." : `Please run ${updateCommand2} to update`
|
|
5335
|
-
};
|
|
5336
|
-
}
|
|
5337
|
-
if (realPath.includes("/.yarn/global")) {
|
|
5338
|
-
const updateCommand2 = "yarn global add @qwen-code/qwen-code@latest";
|
|
5339
|
-
return {
|
|
5340
|
-
packageManager: "yarn" /* YARN */,
|
|
5341
|
-
isGlobal: true,
|
|
5342
|
-
updateCommand: updateCommand2,
|
|
5343
|
-
updateMessage: isAutoUpdateEnabled ? "Installed with yarn. Attempting to automatically update now..." : `Please run ${updateCommand2} to update`
|
|
5344
|
-
};
|
|
5345
|
-
}
|
|
5346
|
-
if (realPath.includes("/.bun/install/cache")) {
|
|
5347
|
-
return {
|
|
5348
|
-
packageManager: "bunx" /* BUNX */,
|
|
5349
|
-
isGlobal: false,
|
|
5350
|
-
updateMessage: "Running via bunx, update not applicable."
|
|
5351
|
-
};
|
|
5352
|
-
}
|
|
5353
|
-
if (realPath.includes("/.bun/bin")) {
|
|
5354
|
-
const updateCommand2 = "bun add -g @qwen-code/qwen-code@latest";
|
|
5355
|
-
return {
|
|
5356
|
-
packageManager: "bun" /* BUN */,
|
|
5357
|
-
isGlobal: true,
|
|
5358
|
-
updateCommand: updateCommand2,
|
|
5359
|
-
updateMessage: isAutoUpdateEnabled ? "Installed with bun. Attempting to automatically update now..." : `Please run ${updateCommand2} to update`
|
|
5360
|
-
};
|
|
5361
|
-
}
|
|
5362
|
-
if (normalizedProjectRoot && isSamePathOrInside(realPath, `${normalizedProjectRoot}/node_modules`)) {
|
|
5363
|
-
let pm = "npm" /* NPM */;
|
|
5364
|
-
if (fs6.existsSync(path6.join(projectRoot, "yarn.lock"))) {
|
|
5365
|
-
pm = "yarn" /* YARN */;
|
|
5366
|
-
} else if (fs6.existsSync(path6.join(projectRoot, "pnpm-lock.yaml"))) {
|
|
5367
|
-
pm = "pnpm" /* PNPM */;
|
|
5368
|
-
} else if (fs6.existsSync(path6.join(projectRoot, "bun.lockb"))) {
|
|
5369
|
-
pm = "bun" /* BUN */;
|
|
5370
|
-
}
|
|
5371
|
-
return {
|
|
5372
|
-
packageManager: pm,
|
|
5373
|
-
isGlobal: false,
|
|
5374
|
-
updateMessage: "Locally installed. Please update via your project's package.json."
|
|
5375
|
-
};
|
|
5376
|
-
}
|
|
5377
|
-
const npmPackageDir = path6.dirname(path6.dirname(realPath));
|
|
5378
|
-
let npmPrefixWritable = false;
|
|
5379
|
-
try {
|
|
5380
|
-
fs6.accessSync(npmPackageDir, fs6.constants.W_OK);
|
|
5381
|
-
npmPrefixWritable = true;
|
|
5382
|
-
} catch {
|
|
5383
|
-
}
|
|
5384
|
-
if (!npmPrefixWritable) {
|
|
5385
|
-
return {
|
|
5386
|
-
packageManager: "npm" /* NPM */,
|
|
5387
|
-
isGlobal: true,
|
|
5388
|
-
updateMessage: "Update requires sudo. Please run: sudo npm install -g @qwen-code/qwen-code@latest"
|
|
5389
|
-
};
|
|
5390
|
-
}
|
|
5391
|
-
const updateCommand = "npm install -g @qwen-code/qwen-code@latest";
|
|
5392
|
-
return {
|
|
5393
|
-
packageManager: "npm" /* NPM */,
|
|
5394
|
-
isGlobal: true,
|
|
5395
|
-
updateCommand,
|
|
5396
|
-
updateMessage: isAutoUpdateEnabled ? "Installed with npm. Attempting to automatically update now..." : `Please run ${updateCommand} to update`
|
|
5397
|
-
};
|
|
5398
|
-
} catch (error) {
|
|
5399
|
-
debugLogger7.error("Failed to detect installation info:", error);
|
|
5400
|
-
return { packageManager: "unknown" /* UNKNOWN */, isGlobal: false };
|
|
5401
|
-
}
|
|
5402
|
-
}
|
|
5403
|
-
__name(getInstallationInfo, "getInstallationInfo");
|
|
5404
|
-
function stripTrailingSlashes(value) {
|
|
5405
|
-
return value.replace(/\/+$/, "") || "/";
|
|
5406
|
-
}
|
|
5407
|
-
__name(stripTrailingSlashes, "stripTrailingSlashes");
|
|
5408
|
-
function isSamePathOrInside(candidate, parent) {
|
|
5409
|
-
const normalizedCandidate = stripTrailingSlashes(candidate);
|
|
5410
|
-
const normalizedParent = stripTrailingSlashes(parent);
|
|
5411
|
-
if (normalizedParent === "/") {
|
|
5412
|
-
return normalizedCandidate === "/" || normalizedCandidate.startsWith("/");
|
|
5413
|
-
}
|
|
5414
|
-
return normalizedCandidate === normalizedParent || normalizedCandidate.startsWith(`${normalizedParent}/`);
|
|
5415
|
-
}
|
|
5416
|
-
__name(isSamePathOrInside, "isSamePathOrInside");
|
|
5417
|
-
function getStandaloneInstallInfo(realPath, isAutoUpdateEnabled) {
|
|
5418
|
-
const installDir = standaloneInstallDirForCliPath(realPath);
|
|
5419
|
-
if (!installDir || !isStandaloneInstallDir(installDir)) {
|
|
5420
|
-
return null;
|
|
5421
|
-
}
|
|
5422
|
-
const updateCommand = process.platform === "win32" ? `powershell -ExecutionPolicy Bypass -c "irm ${STANDALONE_WINDOWS_INSTALLER} | iex"` : `curl -fsSL ${STANDALONE_UNIX_INSTALLER} | bash`;
|
|
5423
|
-
return {
|
|
5424
|
-
packageManager: "standalone" /* STANDALONE */,
|
|
5425
|
-
isGlobal: true,
|
|
5426
|
-
isStandalone: true,
|
|
5427
|
-
standaloneDir: installDir,
|
|
5428
|
-
updateMessage: isAutoUpdateEnabled ? "Standalone install detected. Attempting to automatically update now..." : `Standalone install detected. Please rerun the standalone installer to update: ${updateCommand}`
|
|
5429
|
-
};
|
|
5430
|
-
}
|
|
5431
|
-
__name(getStandaloneInstallInfo, "getStandaloneInstallInfo");
|
|
5432
|
-
function standaloneInstallDirForCliPath(realPath) {
|
|
5433
|
-
const normalized = realPath.replace(/\\/g, "/");
|
|
5434
|
-
const suffix = "/lib/cli.js";
|
|
5435
|
-
if (!normalized.endsWith(suffix)) {
|
|
5436
|
-
return null;
|
|
5437
|
-
}
|
|
5438
|
-
return realPath.slice(0, -suffix.length);
|
|
5439
|
-
}
|
|
5440
|
-
__name(standaloneInstallDirForCliPath, "standaloneInstallDirForCliPath");
|
|
5441
|
-
function isStandaloneInstallDir(installDir) {
|
|
5442
|
-
try {
|
|
5443
|
-
const manifestPath = path6.join(installDir, "manifest.json");
|
|
5444
|
-
if (!fs6.existsSync(manifestPath)) {
|
|
5445
|
-
return false;
|
|
5446
|
-
}
|
|
5447
|
-
const manifest = JSON.parse(fs6.readFileSync(manifestPath, "utf8"));
|
|
5448
|
-
if (manifest.name !== "@qwen-code/qwen-code" || typeof manifest.target !== "string" || !isStandaloneTargetForCurrentPlatform(manifest.target)) {
|
|
5449
|
-
return false;
|
|
5450
|
-
}
|
|
5451
|
-
const qwenBin = process.platform === "win32" ? path6.join(installDir, "bin", "qwen.cmd") : path6.join(installDir, "bin", "qwen");
|
|
5452
|
-
const nodeBin = process.platform === "win32" ? path6.join(installDir, "node", "node.exe") : path6.join(installDir, "node", "bin", "node");
|
|
5453
|
-
return fs6.existsSync(qwenBin) && fs6.existsSync(nodeBin) && isStandaloneRuntimeFile(qwenBin) && isStandaloneRuntimeFile(nodeBin);
|
|
5454
|
-
} catch (err) {
|
|
5455
|
-
debugLogger7.error("Standalone detection failed:", installDir, err);
|
|
5456
|
-
return false;
|
|
5457
|
-
}
|
|
5458
|
-
}
|
|
5459
|
-
__name(isStandaloneInstallDir, "isStandaloneInstallDir");
|
|
5460
|
-
function isStandaloneTargetForCurrentPlatform(target) {
|
|
5461
|
-
switch (process.platform) {
|
|
5462
|
-
case "darwin":
|
|
5463
|
-
return /^darwin-(arm64|x64)$/.test(target);
|
|
5464
|
-
case "linux":
|
|
5465
|
-
return /^linux-(arm64|x64)$/.test(target);
|
|
5466
|
-
case "win32":
|
|
5467
|
-
return /^win-(arm64|x64)$/.test(target);
|
|
5468
|
-
default:
|
|
5469
|
-
return false;
|
|
5470
|
-
}
|
|
5471
|
-
}
|
|
5472
|
-
__name(isStandaloneTargetForCurrentPlatform, "isStandaloneTargetForCurrentPlatform");
|
|
5473
|
-
function isStandaloneRuntimeFile(filePath) {
|
|
5474
|
-
const stats = fs6.lstatSync(filePath);
|
|
5475
|
-
if (!stats.isFile() || stats.isSymbolicLink()) {
|
|
5476
|
-
return false;
|
|
5477
|
-
}
|
|
5478
|
-
return process.platform === "win32" || (stats.mode & 73) !== 0;
|
|
5479
|
-
}
|
|
5480
|
-
__name(isStandaloneRuntimeFile, "isStandaloneRuntimeFile");
|
|
5481
|
-
|
|
5482
4618
|
// packages/cli/src/ui/commands/doctorCommand.ts
|
|
5483
4619
|
var MEMORY_SUBCOMMAND = "memory";
|
|
5484
4620
|
var CPU_PROFILE_SUBCOMMAND = "cpu-profile";
|
|
@@ -5921,14 +5057,14 @@ async function cpuProfileDoctorAction(context, args = "") {
|
|
|
5921
5057
|
})
|
|
5922
5058
|
});
|
|
5923
5059
|
}
|
|
5924
|
-
await new Promise((
|
|
5925
|
-
const timer = setTimeout(
|
|
5060
|
+
await new Promise((resolve4) => {
|
|
5061
|
+
const timer = setTimeout(resolve4, durationSec * 1e3);
|
|
5926
5062
|
if (abortSignal) {
|
|
5927
5063
|
abortSignal.addEventListener(
|
|
5928
5064
|
"abort",
|
|
5929
5065
|
() => {
|
|
5930
5066
|
clearTimeout(timer);
|
|
5931
|
-
|
|
5067
|
+
resolve4();
|
|
5932
5068
|
},
|
|
5933
5069
|
{ once: true }
|
|
5934
5070
|
);
|
|
@@ -6128,10 +5264,10 @@ var effortCommand = {
|
|
|
6128
5264
|
|
|
6129
5265
|
// packages/cli/src/ui/commands/exportCommand.ts
|
|
6130
5266
|
init_esbuild_shims();
|
|
6131
|
-
import * as
|
|
6132
|
-
import
|
|
5267
|
+
import * as fs5 from "node:fs/promises";
|
|
5268
|
+
import path5 from "node:path";
|
|
6133
5269
|
var EXPORT_DIR_OUT_OF_CWD = "Export directory must be within the project working directory.";
|
|
6134
|
-
var
|
|
5270
|
+
var debugLogger6 = createDebugLogger("EXPORT_COMMAND");
|
|
6135
5271
|
function formatExportTargetContext(target) {
|
|
6136
5272
|
return `target: "${target.outputDir}", cwd: "${target.resolvedCwd}"`;
|
|
6137
5273
|
}
|
|
@@ -6143,16 +5279,16 @@ __name(formatMissingCwdError, "formatMissingCwdError");
|
|
|
6143
5279
|
function resolveExportTarget(cwd, args, extension) {
|
|
6144
5280
|
const filename = generateExportFilename(extension);
|
|
6145
5281
|
const outputDirArg = args.trim();
|
|
6146
|
-
const resolvedCwd =
|
|
6147
|
-
const outputDir = outputDirArg ?
|
|
6148
|
-
const filepath =
|
|
5282
|
+
const resolvedCwd = path5.resolve(cwd);
|
|
5283
|
+
const outputDir = outputDirArg ? path5.resolve(resolvedCwd, outputDirArg) : resolvedCwd;
|
|
5284
|
+
const filepath = path5.join(outputDir, filename);
|
|
6149
5285
|
const isDefaultOutputDir = outputDir === resolvedCwd;
|
|
6150
5286
|
const isInsideCwd = isSubpath(resolvedCwd, outputDir);
|
|
6151
5287
|
const outputDirKind = outputDirArg && !isDefaultOutputDir ? "custom" : "default";
|
|
6152
5288
|
return {
|
|
6153
5289
|
filepath,
|
|
6154
5290
|
outputDir,
|
|
6155
|
-
displayPath: isDefaultOutputDir ? filename :
|
|
5291
|
+
displayPath: isDefaultOutputDir ? filename : path5.join(outputDirArg, filename),
|
|
6156
5292
|
resolvedCwd,
|
|
6157
5293
|
outputDirKind,
|
|
6158
5294
|
isInsideCwd
|
|
@@ -6160,7 +5296,7 @@ function resolveExportTarget(cwd, args, extension) {
|
|
|
6160
5296
|
}
|
|
6161
5297
|
__name(resolveExportTarget, "resolveExportTarget");
|
|
6162
5298
|
async function validateExportTargetWithinCwd(target) {
|
|
6163
|
-
|
|
5299
|
+
debugLogger6.debug(
|
|
6164
5300
|
"Validating export target realpath:",
|
|
6165
5301
|
formatExportTargetContext(target)
|
|
6166
5302
|
);
|
|
@@ -6168,12 +5304,12 @@ async function validateExportTargetWithinCwd(target) {
|
|
|
6168
5304
|
let realOutputDir;
|
|
6169
5305
|
try {
|
|
6170
5306
|
[realCwd, realOutputDir] = await Promise.all([
|
|
6171
|
-
|
|
6172
|
-
|
|
5307
|
+
fs5.realpath(target.resolvedCwd),
|
|
5308
|
+
fs5.realpath(target.outputDir)
|
|
6173
5309
|
]);
|
|
6174
5310
|
} catch (error) {
|
|
6175
5311
|
if (error.code === "ENOENT") {
|
|
6176
|
-
|
|
5312
|
+
debugLogger6.debug(
|
|
6177
5313
|
"Export target realpath validation failed: missing path",
|
|
6178
5314
|
formatExportTargetContext(target)
|
|
6179
5315
|
);
|
|
@@ -6188,7 +5324,7 @@ async function validateExportTargetWithinCwd(target) {
|
|
|
6188
5324
|
throw error;
|
|
6189
5325
|
}
|
|
6190
5326
|
if (!isSubpath(realCwd, realOutputDir)) {
|
|
6191
|
-
|
|
5327
|
+
debugLogger6.debug("Export target realpath escaped cwd:", {
|
|
6192
5328
|
realCwd,
|
|
6193
5329
|
realOutputDir,
|
|
6194
5330
|
target
|
|
@@ -6206,24 +5342,24 @@ async function validateExportTargetWithinCwd(target) {
|
|
|
6206
5342
|
__name(validateExportTargetWithinCwd, "validateExportTargetWithinCwd");
|
|
6207
5343
|
async function realpathNearestExisting(outputDir, resolvedCwd) {
|
|
6208
5344
|
let currentPath = outputDir;
|
|
6209
|
-
|
|
5345
|
+
debugLogger6.debug("Resolving nearest existing export parent:", {
|
|
6210
5346
|
outputDir,
|
|
6211
5347
|
resolvedCwd
|
|
6212
5348
|
});
|
|
6213
5349
|
while (isSubpath(resolvedCwd, currentPath)) {
|
|
6214
5350
|
try {
|
|
6215
|
-
const realCurrentPath = await
|
|
6216
|
-
|
|
5351
|
+
const realCurrentPath = await fs5.realpath(currentPath);
|
|
5352
|
+
debugLogger6.debug("Resolved nearest existing export parent:", {
|
|
6217
5353
|
currentPath,
|
|
6218
5354
|
realCurrentPath
|
|
6219
5355
|
});
|
|
6220
5356
|
return realCurrentPath;
|
|
6221
5357
|
} catch (error) {
|
|
6222
5358
|
if (error.code !== "ENOENT") {
|
|
6223
|
-
|
|
5359
|
+
debugLogger6.debug("Failed to resolve existing export parent:", error);
|
|
6224
5360
|
throw error;
|
|
6225
5361
|
}
|
|
6226
|
-
const parentPath =
|
|
5362
|
+
const parentPath = path5.dirname(currentPath);
|
|
6227
5363
|
if (parentPath === currentPath) {
|
|
6228
5364
|
break;
|
|
6229
5365
|
}
|
|
@@ -6234,13 +5370,13 @@ async function realpathNearestExisting(outputDir, resolvedCwd) {
|
|
|
6234
5370
|
}
|
|
6235
5371
|
__name(realpathNearestExisting, "realpathNearestExisting");
|
|
6236
5372
|
async function validateExistingExportParentWithinCwd(target) {
|
|
6237
|
-
|
|
5373
|
+
debugLogger6.debug(
|
|
6238
5374
|
"Validating existing export parent realpath:",
|
|
6239
5375
|
formatExportTargetContext(target)
|
|
6240
5376
|
);
|
|
6241
5377
|
let realCwd;
|
|
6242
5378
|
try {
|
|
6243
|
-
realCwd = await
|
|
5379
|
+
realCwd = await fs5.realpath(target.resolvedCwd);
|
|
6244
5380
|
} catch (error) {
|
|
6245
5381
|
if (error.code === "ENOENT") {
|
|
6246
5382
|
throw new Error(formatMissingCwdError(target.resolvedCwd));
|
|
@@ -6252,7 +5388,7 @@ async function validateExistingExportParentWithinCwd(target) {
|
|
|
6252
5388
|
target.resolvedCwd
|
|
6253
5389
|
);
|
|
6254
5390
|
if (!isSubpath(realCwd, realExistingParent)) {
|
|
6255
|
-
|
|
5391
|
+
debugLogger6.debug("Existing export parent escaped cwd:", {
|
|
6256
5392
|
realCwd,
|
|
6257
5393
|
realExistingParent,
|
|
6258
5394
|
target
|
|
@@ -6288,7 +5424,7 @@ async function exportSessionAction(context, args, exportFormat) {
|
|
|
6288
5424
|
}
|
|
6289
5425
|
const target = resolveExportTarget(cwd, args, exportFormat.extension);
|
|
6290
5426
|
const targetFilepath = target.filepath;
|
|
6291
|
-
|
|
5427
|
+
debugLogger6.debug("Resolved export target:", {
|
|
6292
5428
|
format: exportFormat.displayName,
|
|
6293
5429
|
cwd,
|
|
6294
5430
|
outputDirArg: args.trim(),
|
|
@@ -6297,7 +5433,7 @@ async function exportSessionAction(context, args, exportFormat) {
|
|
|
6297
5433
|
filepath: target.filepath
|
|
6298
5434
|
});
|
|
6299
5435
|
if (!target.isInsideCwd) {
|
|
6300
|
-
|
|
5436
|
+
debugLogger6.debug(
|
|
6301
5437
|
"Export target rejected before realpath validation:",
|
|
6302
5438
|
formatExportTargetContext(target)
|
|
6303
5439
|
);
|
|
@@ -6314,17 +5450,17 @@ async function exportSessionAction(context, args, exportFormat) {
|
|
|
6314
5450
|
if (initialValidationError) {
|
|
6315
5451
|
return initialValidationError;
|
|
6316
5452
|
}
|
|
6317
|
-
|
|
5453
|
+
debugLogger6.debug("Export target validation passed:", {
|
|
6318
5454
|
format: exportFormat.displayName,
|
|
6319
5455
|
outputDir: target.outputDir,
|
|
6320
5456
|
outputDirKind: target.outputDirKind
|
|
6321
5457
|
});
|
|
6322
5458
|
const sessionService = new SessionService(cwd);
|
|
6323
5459
|
const sessionId = config.getSessionId();
|
|
6324
|
-
|
|
5460
|
+
debugLogger6.debug("Loading session for export:", { sessionId, cwd });
|
|
6325
5461
|
const sessionData = await sessionService.loadSession(sessionId);
|
|
6326
5462
|
if (!sessionData) {
|
|
6327
|
-
|
|
5463
|
+
debugLogger6.debug("No active session found for export:", {
|
|
6328
5464
|
sessionId,
|
|
6329
5465
|
cwd
|
|
6330
5466
|
});
|
|
@@ -6344,12 +5480,12 @@ async function exportSessionAction(context, args, exportFormat) {
|
|
|
6344
5480
|
const content = exportFormat.format(normalizedData);
|
|
6345
5481
|
if (target.outputDirKind === "custom") {
|
|
6346
5482
|
try {
|
|
6347
|
-
|
|
5483
|
+
debugLogger6.debug("Creating export directory:", {
|
|
6348
5484
|
outputDir: target.outputDir
|
|
6349
5485
|
});
|
|
6350
|
-
await
|
|
5486
|
+
await fs5.mkdir(target.outputDir, { recursive: true, mode: 448 });
|
|
6351
5487
|
} catch (error) {
|
|
6352
|
-
|
|
5488
|
+
debugLogger6.debug("Failed to create export directory:", error);
|
|
6353
5489
|
return {
|
|
6354
5490
|
type: "message",
|
|
6355
5491
|
messageType: "error",
|
|
@@ -6363,7 +5499,7 @@ async function exportSessionAction(context, args, exportFormat) {
|
|
|
6363
5499
|
return writeValidationError;
|
|
6364
5500
|
}
|
|
6365
5501
|
} catch (error) {
|
|
6366
|
-
|
|
5502
|
+
debugLogger6.debug("Export path validation failed before write:", error);
|
|
6367
5503
|
return {
|
|
6368
5504
|
type: "message",
|
|
6369
5505
|
messageType: "error",
|
|
@@ -6371,26 +5507,26 @@ async function exportSessionAction(context, args, exportFormat) {
|
|
|
6371
5507
|
};
|
|
6372
5508
|
}
|
|
6373
5509
|
try {
|
|
6374
|
-
|
|
5510
|
+
debugLogger6.debug("Writing export file:", {
|
|
6375
5511
|
format: exportFormat.displayName,
|
|
6376
5512
|
filepath: target.filepath
|
|
6377
5513
|
});
|
|
6378
|
-
await
|
|
5514
|
+
await fs5.writeFile(target.filepath, content, {
|
|
6379
5515
|
encoding: "utf-8",
|
|
6380
5516
|
mode: 384
|
|
6381
5517
|
});
|
|
6382
|
-
await
|
|
6383
|
-
|
|
5518
|
+
await fs5.chmod(target.filepath, 384).catch((error) => {
|
|
5519
|
+
debugLogger6.debug("Failed to tighten export file permissions:", error);
|
|
6384
5520
|
});
|
|
6385
5521
|
} catch (error) {
|
|
6386
|
-
|
|
5522
|
+
debugLogger6.debug("Failed to write export file:", error);
|
|
6387
5523
|
return {
|
|
6388
5524
|
type: "message",
|
|
6389
5525
|
messageType: "error",
|
|
6390
5526
|
content: `Failed to export session: ${error instanceof Error ? error.message : String(error)} (${exportFormat.displayName} target: "${targetFilepath}")`
|
|
6391
5527
|
};
|
|
6392
5528
|
}
|
|
6393
|
-
|
|
5529
|
+
debugLogger6.debug("Session export completed:", {
|
|
6394
5530
|
format: exportFormat.displayName,
|
|
6395
5531
|
filepath: target.filepath
|
|
6396
5532
|
});
|
|
@@ -6400,7 +5536,7 @@ async function exportSessionAction(context, args, exportFormat) {
|
|
|
6400
5536
|
content: `Session exported to ${exportFormat.displayName}: ${target.displayPath}`
|
|
6401
5537
|
};
|
|
6402
5538
|
} catch (error) {
|
|
6403
|
-
|
|
5539
|
+
debugLogger6.debug("Session export failed:", {
|
|
6404
5540
|
format: exportFormat.displayName,
|
|
6405
5541
|
target,
|
|
6406
5542
|
error
|
|
@@ -6496,7 +5632,7 @@ var exportCommand = {
|
|
|
6496
5632
|
|
|
6497
5633
|
// packages/cli/src/ui/commands/forkCommand.ts
|
|
6498
5634
|
init_esbuild_shims();
|
|
6499
|
-
var
|
|
5635
|
+
var debugLogger7 = createDebugLogger("FORK_COMMAND");
|
|
6500
5636
|
function deriveForkDescription(directive) {
|
|
6501
5637
|
const oneLine = directive.replace(/\s+/g, " ").trim();
|
|
6502
5638
|
return oneLine.length > 60 ? `${oneLine.slice(0, 57)}\u2026` : oneLine;
|
|
@@ -6552,7 +5688,7 @@ var forkCommand = {
|
|
|
6552
5688
|
try {
|
|
6553
5689
|
hasHistory = (config.getGeminiClient().getHistoryShallow() ?? []).length > 0;
|
|
6554
5690
|
} catch (error) {
|
|
6555
|
-
|
|
5691
|
+
debugLogger7.debug("Failed to read history before /fork:", error);
|
|
6556
5692
|
hasHistory = false;
|
|
6557
5693
|
}
|
|
6558
5694
|
if (!hasHistory) {
|
|
@@ -6612,7 +5748,7 @@ var forkCommand = {
|
|
|
6612
5748
|
]
|
|
6613
5749
|
});
|
|
6614
5750
|
} catch (error) {
|
|
6615
|
-
|
|
5751
|
+
debugLogger7.debug("Failed to record fork event in history:", error);
|
|
6616
5752
|
}
|
|
6617
5753
|
return {
|
|
6618
5754
|
type: "message",
|
|
@@ -6626,7 +5762,7 @@ var forkCommand = {
|
|
|
6626
5762
|
|
|
6627
5763
|
// packages/cli/src/ui/commands/extensionsCommand.ts
|
|
6628
5764
|
init_esbuild_shims();
|
|
6629
|
-
var
|
|
5765
|
+
var debugLogger8 = createDebugLogger("EXTENSIONS_COMMAND");
|
|
6630
5766
|
var EXTENSION_EXPLORE_URL = {
|
|
6631
5767
|
Gemini: "https://geminicli.com/extensions/",
|
|
6632
5768
|
ClaudeCode: "https://claudemarketplaces.com/"
|
|
@@ -6789,7 +5925,7 @@ async function installAction(context, args) {
|
|
|
6789
5925
|
}
|
|
6790
5926
|
const extensionManager = context.services.config?.getExtensionManager();
|
|
6791
5927
|
if (!(extensionManager instanceof ExtensionManager)) {
|
|
6792
|
-
|
|
5928
|
+
debugLogger8.error(
|
|
6793
5929
|
`Cannot ${context.invocation?.name} extensions in this environment`
|
|
6794
5930
|
);
|
|
6795
5931
|
return;
|
|
@@ -7727,7 +6863,7 @@ var hooksCommand = {
|
|
|
7727
6863
|
|
|
7728
6864
|
// packages/cli/src/ui/commands/ideCommand.ts
|
|
7729
6865
|
init_esbuild_shims();
|
|
7730
|
-
import
|
|
6866
|
+
import path6 from "node:path";
|
|
7731
6867
|
function getIdeStatusMessage(ideClient) {
|
|
7732
6868
|
const connection = ideClient.getConnectionStatus();
|
|
7733
6869
|
switch (connection.status) {
|
|
@@ -7757,13 +6893,13 @@ __name(getIdeStatusMessage, "getIdeStatusMessage");
|
|
|
7757
6893
|
function formatFileList(openFiles) {
|
|
7758
6894
|
const basenameCounts = /* @__PURE__ */ new Map();
|
|
7759
6895
|
for (const file of openFiles) {
|
|
7760
|
-
const basename3 =
|
|
6896
|
+
const basename3 = path6.basename(file.path);
|
|
7761
6897
|
basenameCounts.set(basename3, (basenameCounts.get(basename3) || 0) + 1);
|
|
7762
6898
|
}
|
|
7763
6899
|
const fileList = openFiles.map((file) => {
|
|
7764
|
-
const basename3 =
|
|
6900
|
+
const basename3 = path6.basename(file.path);
|
|
7765
6901
|
const isDuplicate = (basenameCounts.get(basename3) || 0) > 1;
|
|
7766
|
-
const parentDir =
|
|
6902
|
+
const parentDir = path6.basename(path6.dirname(file.path));
|
|
7767
6903
|
const displayName = isDuplicate ? `${basename3} (/${parentDir})` : basename3;
|
|
7768
6904
|
return ` - ${displayName}${file.isActive ? " (active)" : ""}`;
|
|
7769
6905
|
}).join("\n");
|
|
@@ -7925,7 +7061,7 @@ var ideCommand = /* @__PURE__ */ __name(async () => {
|
|
|
7925
7061
|
if (ideClient.getConnectionStatus().status === "connected" /* Connected */) {
|
|
7926
7062
|
break;
|
|
7927
7063
|
}
|
|
7928
|
-
await new Promise((
|
|
7064
|
+
await new Promise((resolve4) => setTimeout(resolve4, 500));
|
|
7929
7065
|
}
|
|
7930
7066
|
const { messageType, content } = getIdeStatusMessage(ideClient);
|
|
7931
7067
|
if (messageType === "error") {
|
|
@@ -8015,9 +7151,9 @@ init_esbuild_shims();
|
|
|
8015
7151
|
|
|
8016
7152
|
// packages/cli/src/config/claudeMcpImport.ts
|
|
8017
7153
|
init_esbuild_shims();
|
|
8018
|
-
import * as
|
|
8019
|
-
import * as
|
|
8020
|
-
import * as
|
|
7154
|
+
import * as fs6 from "node:fs";
|
|
7155
|
+
import * as os3 from "node:os";
|
|
7156
|
+
import * as path7 from "node:path";
|
|
8021
7157
|
var import_strip_json_comments = __toESM(require_strip_json_comments(), 1);
|
|
8022
7158
|
function isRecord(value) {
|
|
8023
7159
|
return !!value && typeof value === "object" && !Array.isArray(value);
|
|
@@ -8038,7 +7174,7 @@ __name(emptyServerRecord, "emptyServerRecord");
|
|
|
8038
7174
|
function readJsonObject(filePath) {
|
|
8039
7175
|
let raw;
|
|
8040
7176
|
try {
|
|
8041
|
-
raw =
|
|
7177
|
+
raw = fs6.readFileSync(filePath, "utf-8");
|
|
8042
7178
|
} catch (error) {
|
|
8043
7179
|
if (isReadableConfigError(error) && (error.code === "ENOENT" || error.code === "ENOTDIR")) {
|
|
8044
7180
|
return { found: false };
|
|
@@ -8087,7 +7223,7 @@ function copyMcpServers(value, sourcePath, servers, errors) {
|
|
|
8087
7223
|
}
|
|
8088
7224
|
__name(copyMcpServers, "copyMcpServers");
|
|
8089
7225
|
function normalizeProjectPath(projectPath) {
|
|
8090
|
-
return
|
|
7226
|
+
return path7.resolve(projectPath);
|
|
8091
7227
|
}
|
|
8092
7228
|
__name(normalizeProjectPath, "normalizeProjectPath");
|
|
8093
7229
|
function getClaudeProjectSettings(projects, cwd) {
|
|
@@ -8103,17 +7239,17 @@ function getClaudeProjectSettings(projects, cwd) {
|
|
|
8103
7239
|
return void 0;
|
|
8104
7240
|
}
|
|
8105
7241
|
__name(getClaudeProjectSettings, "getClaudeProjectSettings");
|
|
8106
|
-
function getClaudeCodeConfigPath(homeDir =
|
|
8107
|
-
return
|
|
7242
|
+
function getClaudeCodeConfigPath(homeDir = os3.homedir()) {
|
|
7243
|
+
return path7.join(homeDir, ".claude.json");
|
|
8108
7244
|
}
|
|
8109
7245
|
__name(getClaudeCodeConfigPath, "getClaudeCodeConfigPath");
|
|
8110
|
-
function getClaudeDesktopConfigPath(homeDir =
|
|
8111
|
-
if (
|
|
8112
|
-
const appData = env["APPDATA"] ??
|
|
8113
|
-
return
|
|
7246
|
+
function getClaudeDesktopConfigPath(homeDir = os3.homedir(), platform2 = process.platform, env = process.env) {
|
|
7247
|
+
if (platform2 === "win32") {
|
|
7248
|
+
const appData = env["APPDATA"] ?? path7.win32.join(homeDir, "AppData", "Roaming");
|
|
7249
|
+
return path7.win32.join(appData, "Claude", "claude_desktop_config.json");
|
|
8114
7250
|
}
|
|
8115
|
-
if (
|
|
8116
|
-
return
|
|
7251
|
+
if (platform2 === "darwin") {
|
|
7252
|
+
return path7.join(
|
|
8117
7253
|
homeDir,
|
|
8118
7254
|
"Library",
|
|
8119
7255
|
"Application Support",
|
|
@@ -8121,7 +7257,7 @@ function getClaudeDesktopConfigPath(homeDir = os4.homedir(), platform3 = process
|
|
|
8121
7257
|
"claude_desktop_config.json"
|
|
8122
7258
|
);
|
|
8123
7259
|
}
|
|
8124
|
-
return
|
|
7260
|
+
return path7.join(homeDir, ".config", "Claude", "claude_desktop_config.json");
|
|
8125
7261
|
}
|
|
8126
7262
|
__name(getClaudeDesktopConfigPath, "getClaudeDesktopConfigPath");
|
|
8127
7263
|
function loadMcpServersFromSettingsFile(filePath, label, source) {
|
|
@@ -8213,7 +7349,7 @@ __name(loadClaudeCodeJsonMcpServers, "loadClaudeCodeJsonMcpServers");
|
|
|
8213
7349
|
function loadClaudeCodeMcpSources(homeDir, cwd, scope) {
|
|
8214
7350
|
const candidates = scope === "project" ? [
|
|
8215
7351
|
loadMcpServersFromSettingsFile(
|
|
8216
|
-
|
|
7352
|
+
path7.join(cwd, ".claude", "settings.json"),
|
|
8217
7353
|
"Claude Code project settings",
|
|
8218
7354
|
"claude-code"
|
|
8219
7355
|
),
|
|
@@ -8221,7 +7357,7 @@ function loadClaudeCodeMcpSources(homeDir, cwd, scope) {
|
|
|
8221
7357
|
] : [
|
|
8222
7358
|
loadClaudeCodeJsonMcpServers(homeDir, cwd, scope),
|
|
8223
7359
|
loadMcpServersFromSettingsFile(
|
|
8224
|
-
|
|
7360
|
+
path7.join(homeDir, ".claude", "settings.json"),
|
|
8225
7361
|
"Claude Code global settings",
|
|
8226
7362
|
"claude-code"
|
|
8227
7363
|
)
|
|
@@ -8236,8 +7372,8 @@ function loadClaudeCodeMcpSources(homeDir, cwd, scope) {
|
|
|
8236
7372
|
});
|
|
8237
7373
|
}
|
|
8238
7374
|
__name(loadClaudeCodeMcpSources, "loadClaudeCodeMcpSources");
|
|
8239
|
-
function loadClaudeDesktopMcpServers(homeDir,
|
|
8240
|
-
const filePath = getClaudeDesktopConfigPath(homeDir,
|
|
7375
|
+
function loadClaudeDesktopMcpServers(homeDir, platform2, env) {
|
|
7376
|
+
const filePath = getClaudeDesktopConfigPath(homeDir, platform2, env);
|
|
8241
7377
|
const errors = [];
|
|
8242
7378
|
const servers = emptyServerRecord();
|
|
8243
7379
|
const parsed = readJsonObject(filePath);
|
|
@@ -8273,14 +7409,14 @@ function loadClaudeDesktopMcpServers(homeDir, platform3, env) {
|
|
|
8273
7409
|
}
|
|
8274
7410
|
__name(loadClaudeDesktopMcpServers, "loadClaudeDesktopMcpServers");
|
|
8275
7411
|
function loadClaudeMcpSources(options) {
|
|
8276
|
-
const homeDir = options.homeDir ??
|
|
7412
|
+
const homeDir = options.homeDir ?? os3.homedir();
|
|
8277
7413
|
const cwd = options.cwd ?? process.cwd();
|
|
8278
|
-
const
|
|
7414
|
+
const platform2 = options.platform ?? process.platform;
|
|
8279
7415
|
const env = options.env ?? process.env;
|
|
8280
7416
|
const scope = options.scope ?? "user";
|
|
8281
7417
|
const sources = options.source === "all" ? ["claude-code", "claude-desktop"] : [options.source];
|
|
8282
7418
|
return sources.flatMap(
|
|
8283
|
-
(source) => source === "claude-code" ? loadClaudeCodeMcpSources(homeDir, cwd, scope) : [loadClaudeDesktopMcpServers(homeDir,
|
|
7419
|
+
(source) => source === "claude-code" ? loadClaudeCodeMcpSources(homeDir, cwd, scope) : [loadClaudeDesktopMcpServers(homeDir, platform2, env)]
|
|
8284
7420
|
);
|
|
8285
7421
|
}
|
|
8286
7422
|
__name(loadClaudeMcpSources, "loadClaudeMcpSources");
|
|
@@ -8633,8 +7769,8 @@ ${usage()}`
|
|
|
8633
7769
|
|
|
8634
7770
|
// packages/cli/src/ui/commands/initCommand.ts
|
|
8635
7771
|
init_esbuild_shims();
|
|
8636
|
-
import * as
|
|
8637
|
-
import * as
|
|
7772
|
+
import * as fs7 from "node:fs";
|
|
7773
|
+
import * as path8 from "node:path";
|
|
8638
7774
|
var import_react2 = __toESM(require_react(), 1);
|
|
8639
7775
|
var initCommand = {
|
|
8640
7776
|
name: "init",
|
|
@@ -8653,11 +7789,11 @@ var initCommand = {
|
|
|
8653
7789
|
}
|
|
8654
7790
|
const targetDir = context.services.config.getTargetDir();
|
|
8655
7791
|
const contextFileName = getCurrentGeminiMdFilename();
|
|
8656
|
-
const contextFilePath =
|
|
7792
|
+
const contextFilePath = path8.join(targetDir, contextFileName);
|
|
8657
7793
|
try {
|
|
8658
|
-
if (
|
|
7794
|
+
if (fs7.existsSync(contextFilePath)) {
|
|
8659
7795
|
try {
|
|
8660
|
-
const existing =
|
|
7796
|
+
const existing = fs7.readFileSync(contextFilePath, "utf8");
|
|
8661
7797
|
if (existing && existing.trim().length > 0) {
|
|
8662
7798
|
if (!context.overwriteConfirmed) {
|
|
8663
7799
|
return {
|
|
@@ -8679,7 +7815,7 @@ var initCommand = {
|
|
|
8679
7815
|
}
|
|
8680
7816
|
}
|
|
8681
7817
|
try {
|
|
8682
|
-
|
|
7818
|
+
fs7.writeFileSync(contextFilePath, "", "utf8");
|
|
8683
7819
|
context.ui.addItem(
|
|
8684
7820
|
{
|
|
8685
7821
|
type: "info",
|
|
@@ -8744,7 +7880,7 @@ Write the complete content to the \`${contextFileName}\` file. The output must b
|
|
|
8744
7880
|
|
|
8745
7881
|
// packages/cli/src/ui/commands/languageCommand.ts
|
|
8746
7882
|
init_esbuild_shims();
|
|
8747
|
-
var
|
|
7883
|
+
var debugLogger9 = createDebugLogger("LANGUAGE_COMMAND");
|
|
8748
7884
|
function getCurrentOutputLanguage(context) {
|
|
8749
7885
|
const settingValue = context?.services?.settings?.merged?.general?.outputLanguage || OUTPUT_LANGUAGE_AUTO;
|
|
8750
7886
|
const resolved = resolveOutputLanguage(settingValue);
|
|
@@ -8775,7 +7911,7 @@ async function setUiLanguage(context, lang) {
|
|
|
8775
7911
|
try {
|
|
8776
7912
|
services.settings.setValue("User" /* User */, "general.language", lang);
|
|
8777
7913
|
} catch (error) {
|
|
8778
|
-
|
|
7914
|
+
debugLogger9.warn("Failed to save language setting:", error);
|
|
8779
7915
|
}
|
|
8780
7916
|
}
|
|
8781
7917
|
context.ui.reloadCommands();
|
|
@@ -8802,7 +7938,7 @@ async function setOutputLanguage(context, language) {
|
|
|
8802
7938
|
settingValue
|
|
8803
7939
|
);
|
|
8804
7940
|
} catch (error) {
|
|
8805
|
-
|
|
7941
|
+
debugLogger9.warn("Failed to save output language setting:", error);
|
|
8806
7942
|
}
|
|
8807
7943
|
}
|
|
8808
7944
|
const config = context.services.config;
|
|
@@ -8811,7 +7947,7 @@ async function setOutputLanguage(context, language) {
|
|
|
8811
7947
|
await config.refreshHierarchicalMemory();
|
|
8812
7948
|
await config.getGeminiClient().refreshSystemInstruction();
|
|
8813
7949
|
} catch (error) {
|
|
8814
|
-
|
|
7950
|
+
debugLogger9.warn(
|
|
8815
7951
|
"Failed to apply output language to running session:",
|
|
8816
7952
|
error
|
|
8817
7953
|
);
|
|
@@ -9035,7 +8171,7 @@ var mcpCommand = {
|
|
|
9035
8171
|
|
|
9036
8172
|
// packages/cli/src/ui/commands/dreamCommand.ts
|
|
9037
8173
|
init_esbuild_shims();
|
|
9038
|
-
import * as
|
|
8174
|
+
import * as path9 from "node:path";
|
|
9039
8175
|
var dreamCommand = {
|
|
9040
8176
|
name: "dream",
|
|
9041
8177
|
get description() {
|
|
@@ -9055,7 +8191,7 @@ var dreamCommand = {
|
|
|
9055
8191
|
try {
|
|
9056
8192
|
const projectRoot = config.getProjectRoot();
|
|
9057
8193
|
const memoryRoot = getAutoMemoryRoot(projectRoot);
|
|
9058
|
-
const transcriptDir =
|
|
8194
|
+
const transcriptDir = path9.join(
|
|
9059
8195
|
new Storage(projectRoot).getProjectDir(),
|
|
9060
8196
|
"chats"
|
|
9061
8197
|
);
|
|
@@ -9156,17 +8292,44 @@ init_esbuild_shims();
|
|
|
9156
8292
|
var MAIN_MODEL_CONFIGURATION_HINT = "Configure models in settings.modelProviders and ensure the required environment variables are set. In interactive mode, run /auth to configure or switch providers, or run /model without arguments to choose from configured models.";
|
|
9157
8293
|
var FAST_MODEL_CONFIGURATION_HINT = "Configure models in settings.modelProviders and ensure the required environment variables are set. In interactive mode, run /auth to configure or switch providers, or run /model --fast without a model to choose from configured models.";
|
|
9158
8294
|
var VISION_MODEL_CONFIGURATION_HINT = "Configure an image-capable model in settings.modelProviders and ensure the required environment variables are set. Run /model --vision <model-id> to set it, or leave it unset to auto-pick a same-provider vision model.";
|
|
8295
|
+
function parseScopeFlags(args) {
|
|
8296
|
+
let scopeOverride;
|
|
8297
|
+
let remaining = args;
|
|
8298
|
+
const hasProject = /(?:^|\s)--project(?:\s|$)/.test(remaining);
|
|
8299
|
+
const hasGlobal = /(?:^|\s)--global(?:\s|$)/.test(remaining);
|
|
8300
|
+
if (hasProject) {
|
|
8301
|
+
scopeOverride = "Workspace" /* Workspace */;
|
|
8302
|
+
remaining = remaining.replace(/(?:^|\s)--project(?:\s|$)/, " ").trim();
|
|
8303
|
+
} else if (hasGlobal) {
|
|
8304
|
+
scopeOverride = "User" /* User */;
|
|
8305
|
+
remaining = remaining.replace(/(?:^|\s)--global(?:\s|$)/, " ").trim();
|
|
8306
|
+
}
|
|
8307
|
+
return { scopeOverride, remaining, hasProject, hasGlobal };
|
|
8308
|
+
}
|
|
8309
|
+
__name(parseScopeFlags, "parseScopeFlags");
|
|
8310
|
+
function resolveScope(settings, scopeOverride) {
|
|
8311
|
+
return scopeOverride ?? getPersistScopeForModelSelection(settings);
|
|
8312
|
+
}
|
|
8313
|
+
__name(resolveScope, "resolveScope");
|
|
8314
|
+
function persistScopeSpread(scopeOverride) {
|
|
8315
|
+
if (scopeOverride === "Workspace" /* Workspace */)
|
|
8316
|
+
return { persistScope: "workspace" };
|
|
8317
|
+
if (scopeOverride === "User" /* User */)
|
|
8318
|
+
return { persistScope: "user" };
|
|
8319
|
+
return {};
|
|
8320
|
+
}
|
|
8321
|
+
__name(persistScopeSpread, "persistScopeSpread");
|
|
9159
8322
|
function formatVisionModelSettingForDisplay(setting) {
|
|
9160
8323
|
const parsed = parseVisionModelSetting(setting);
|
|
9161
8324
|
if (!parsed) return setting.replace(/\0/g, "\\0");
|
|
9162
8325
|
return parsed.baseUrl ? `${parsed.selector} (${parsed.baseUrl})` : parsed.selector;
|
|
9163
8326
|
}
|
|
9164
8327
|
__name(formatVisionModelSettingForDisplay, "formatVisionModelSettingForDisplay");
|
|
9165
|
-
function persistSetting(settings,
|
|
9166
|
-
settings.setValue(
|
|
8328
|
+
function persistSetting(settings, path18, value, scopeOverride) {
|
|
8329
|
+
settings.setValue(resolveScope(settings, scopeOverride), path18, value);
|
|
9167
8330
|
}
|
|
9168
8331
|
__name(persistSetting, "persistSetting");
|
|
9169
|
-
async function switchMainModel(config, settings, currentAuthType, modelArg) {
|
|
8332
|
+
async function switchMainModel(config, settings, currentAuthType, modelArg, scopeOverride) {
|
|
9170
8333
|
const parsed = parseAcpModelOption(modelArg);
|
|
9171
8334
|
if (parsed.authType) {
|
|
9172
8335
|
await config.switchModel(
|
|
@@ -9174,14 +8337,19 @@ async function switchMainModel(config, settings, currentAuthType, modelArg) {
|
|
|
9174
8337
|
parsed.modelId,
|
|
9175
8338
|
parsed.authType !== currentAuthType && parsed.authType === "qwen-oauth" /* QWEN_OAUTH */ ? { requireCachedCredentials: true } : void 0
|
|
9176
8339
|
);
|
|
9177
|
-
persistSetting(
|
|
9178
|
-
|
|
9179
|
-
|
|
8340
|
+
persistSetting(
|
|
8341
|
+
settings,
|
|
8342
|
+
"security.auth.selectedType",
|
|
8343
|
+
parsed.authType,
|
|
8344
|
+
scopeOverride
|
|
8345
|
+
);
|
|
8346
|
+
persistSetting(settings, "model.name", parsed.modelId, scopeOverride);
|
|
8347
|
+
persistSetting(settings, "model.baseUrl", "", scopeOverride);
|
|
9180
8348
|
return parsed.modelId;
|
|
9181
8349
|
}
|
|
9182
8350
|
await config.switchModel(currentAuthType, modelArg, void 0);
|
|
9183
|
-
persistSetting(settings, "model.name", modelArg);
|
|
9184
|
-
persistSetting(settings, "model.baseUrl", "");
|
|
8351
|
+
persistSetting(settings, "model.name", modelArg, scopeOverride);
|
|
8352
|
+
persistSetting(settings, "model.baseUrl", "", scopeOverride);
|
|
9185
8353
|
return modelArg;
|
|
9186
8354
|
}
|
|
9187
8355
|
__name(switchMainModel, "switchMainModel");
|
|
@@ -9287,10 +8455,10 @@ var modelCommand = {
|
|
|
9287
8455
|
completionPriority: 100,
|
|
9288
8456
|
get description() {
|
|
9289
8457
|
return t(
|
|
9290
|
-
"Switch the model for this session (--fast for suggestion model, --voice for voice transcription model, --vision for the vision bridge model, [model-id] to switch immediately, or [model-id] [prompt] to run a one-off prompt on another model; the inline prompt is sent verbatim without @file expansion)."
|
|
8458
|
+
"Switch the model for this session (--fast for suggestion model, --voice for voice transcription model, --vision for the vision bridge model, --project to persist to project settings, --global to persist to user settings, [model-id] to switch immediately, or [model-id] [prompt] to run a one-off prompt on another model; the inline prompt is sent verbatim without @file expansion)."
|
|
9291
8459
|
);
|
|
9292
8460
|
},
|
|
9293
|
-
argumentHint: "[--fast|--voice|--vision] [<model-id>] | <model-id> <prompt>",
|
|
8461
|
+
argumentHint: "[--fast|--voice|--vision] [--project|--global] [<model-id>] | <model-id> <prompt>",
|
|
9294
8462
|
kind: "built-in" /* BUILT_IN */,
|
|
9295
8463
|
supportedModes: ["interactive", "non_interactive", "acp"],
|
|
9296
8464
|
completion: /* @__PURE__ */ __name(async (context, partialArg) => {
|
|
@@ -9311,6 +8479,18 @@ var modelCommand = {
|
|
|
9311
8479
|
description: t(
|
|
9312
8480
|
"Set the image-capable model used to transcribe images for a text-only main model"
|
|
9313
8481
|
)
|
|
8482
|
+
},
|
|
8483
|
+
{
|
|
8484
|
+
value: "--project",
|
|
8485
|
+
description: t(
|
|
8486
|
+
"Persist the model selection to the project settings (workspace scope)"
|
|
8487
|
+
)
|
|
8488
|
+
},
|
|
8489
|
+
{
|
|
8490
|
+
value: "--global",
|
|
8491
|
+
description: t(
|
|
8492
|
+
"Persist the model selection to the user settings (global scope)"
|
|
8493
|
+
)
|
|
9314
8494
|
}
|
|
9315
8495
|
].filter((item) => item.value.startsWith(partialArg));
|
|
9316
8496
|
if (flagCompletions.length > 0) {
|
|
@@ -9319,17 +8499,10 @@ var modelCommand = {
|
|
|
9319
8499
|
const trimmed = partialArg.trim();
|
|
9320
8500
|
if (trimmed) {
|
|
9321
8501
|
let mode = "main";
|
|
9322
|
-
|
|
9323
|
-
if (
|
|
9324
|
-
|
|
9325
|
-
|
|
9326
|
-
} else if (trimmed.startsWith("--voice ")) {
|
|
9327
|
-
mode = "voice";
|
|
9328
|
-
modelPrefix = trimmed.slice("--voice ".length);
|
|
9329
|
-
} else if (trimmed.startsWith("--vision ")) {
|
|
9330
|
-
mode = "vision";
|
|
9331
|
-
modelPrefix = trimmed.slice("--vision ".length);
|
|
9332
|
-
}
|
|
8502
|
+
const modelPrefix = trimmed.replace(/(?:^|\s)--fast(?:\s|$)/, " ").replace(/(?:^|\s)--voice(?:\s|$)/, " ").replace(/(?:^|\s)--vision(?:\s|$)/, " ").replace(/(?:^|\s)--project(?:\s|$)/, " ").replace(/(?:^|\s)--global(?:\s|$)/, " ").trim();
|
|
8503
|
+
if (/(?:^|\s)--fast(?:\s|$)/.test(trimmed)) mode = "fast";
|
|
8504
|
+
else if (/(?:^|\s)--voice(?:\s|$)/.test(trimmed)) mode = "voice";
|
|
8505
|
+
else if (/(?:^|\s)--vision(?:\s|$)/.test(trimmed)) mode = "vision";
|
|
9333
8506
|
return getAvailableModelIds(context, mode).filter(
|
|
9334
8507
|
(id) => id.startsWith(modelPrefix)
|
|
9335
8508
|
);
|
|
@@ -9349,7 +8522,30 @@ var modelCommand = {
|
|
|
9349
8522
|
content: t("Configuration not available.")
|
|
9350
8523
|
};
|
|
9351
8524
|
}
|
|
9352
|
-
const
|
|
8525
|
+
const rawArgs = context.invocation?.args?.trim() || actionArgs.trim();
|
|
8526
|
+
const {
|
|
8527
|
+
scopeOverride,
|
|
8528
|
+
remaining: args,
|
|
8529
|
+
hasProject,
|
|
8530
|
+
hasGlobal
|
|
8531
|
+
} = parseScopeFlags(rawArgs);
|
|
8532
|
+
if (hasProject && hasGlobal) {
|
|
8533
|
+
return {
|
|
8534
|
+
type: "message",
|
|
8535
|
+
messageType: "error",
|
|
8536
|
+
content: t(
|
|
8537
|
+
"Cannot use both --project and --global. Choose one scope flag."
|
|
8538
|
+
)
|
|
8539
|
+
};
|
|
8540
|
+
}
|
|
8541
|
+
if (scopeOverride === "Workspace" /* Workspace */ && settings && !settings.isTrusted) {
|
|
8542
|
+
return {
|
|
8543
|
+
type: "message",
|
|
8544
|
+
messageType: "error",
|
|
8545
|
+
content: t("Workspace is untrusted; run /trust first or use --global.")
|
|
8546
|
+
};
|
|
8547
|
+
}
|
|
8548
|
+
const scopeSuffix = scopeOverride === "Workspace" /* Workspace */ ? t(" (this project)") : scopeOverride === "User" /* User */ ? t(" (global)") : "";
|
|
9353
8549
|
const isVoiceModelCommand = args === "--voice" || args.startsWith("--voice ");
|
|
9354
8550
|
if (isVoiceModelCommand) {
|
|
9355
8551
|
const modelName2 = args.replace("--voice", "").trim();
|
|
@@ -9367,7 +8563,8 @@ var modelCommand = {
|
|
|
9367
8563
|
}
|
|
9368
8564
|
return {
|
|
9369
8565
|
type: "dialog",
|
|
9370
|
-
dialog: "voice-model"
|
|
8566
|
+
dialog: "voice-model",
|
|
8567
|
+
...persistScopeSpread(scopeOverride)
|
|
9371
8568
|
};
|
|
9372
8569
|
}
|
|
9373
8570
|
if (!settings) {
|
|
@@ -9406,11 +8603,11 @@ var modelCommand = {
|
|
|
9406
8603
|
content: formatUnsupportedVoiceModelMessage(modelName2)
|
|
9407
8604
|
};
|
|
9408
8605
|
}
|
|
9409
|
-
persistSetting(settings, "voiceModel", modelName2);
|
|
8606
|
+
persistSetting(settings, "voiceModel", modelName2, scopeOverride);
|
|
9410
8607
|
return {
|
|
9411
8608
|
type: "message",
|
|
9412
8609
|
messageType: "info",
|
|
9413
|
-
content: t("Voice Model") + ": " + modelName2
|
|
8610
|
+
content: t("Voice Model") + ": " + modelName2 + scopeSuffix
|
|
9414
8611
|
};
|
|
9415
8612
|
}
|
|
9416
8613
|
const isFastModelCommand = args === "--fast" || args.startsWith("--fast ");
|
|
@@ -9428,7 +8625,8 @@ Use "/model --fast <model-id>" to set fast model.`
|
|
|
9428
8625
|
}
|
|
9429
8626
|
return {
|
|
9430
8627
|
type: "dialog",
|
|
9431
|
-
dialog: "fast-model"
|
|
8628
|
+
dialog: "fast-model",
|
|
8629
|
+
...persistScopeSpread(scopeOverride)
|
|
9432
8630
|
};
|
|
9433
8631
|
}
|
|
9434
8632
|
if (!settings) {
|
|
@@ -9474,12 +8672,12 @@ Use "/model --fast <model-id>" to set fast model.`
|
|
|
9474
8672
|
) : formatUnavailableFastModelMessage(modelName2, availableModels)
|
|
9475
8673
|
};
|
|
9476
8674
|
}
|
|
9477
|
-
persistSetting(settings, "fastModel", modelName2);
|
|
8675
|
+
persistSetting(settings, "fastModel", modelName2, scopeOverride);
|
|
9478
8676
|
config.setFastModel(modelName2);
|
|
9479
8677
|
return {
|
|
9480
8678
|
type: "message",
|
|
9481
8679
|
messageType: "info",
|
|
9482
|
-
content: t("Fast Model") + ": " + modelName2
|
|
8680
|
+
content: t("Fast Model") + ": " + modelName2 + scopeSuffix
|
|
9483
8681
|
};
|
|
9484
8682
|
}
|
|
9485
8683
|
const isVisionModelCommand = args === "--vision" || args.startsWith("--vision ");
|
|
@@ -9501,7 +8699,8 @@ Use "/model --fast <model-id>" to set fast model.`
|
|
|
9501
8699
|
}
|
|
9502
8700
|
return {
|
|
9503
8701
|
type: "dialog",
|
|
9504
|
-
dialog: "vision-model"
|
|
8702
|
+
dialog: "vision-model",
|
|
8703
|
+
...persistScopeSpread(scopeOverride)
|
|
9505
8704
|
};
|
|
9506
8705
|
}
|
|
9507
8706
|
if (!settings) {
|
|
@@ -9561,14 +8760,14 @@ Use "/model --fast <model-id>" to set fast model.`
|
|
|
9561
8760
|
}
|
|
9562
8761
|
const qualifiedModelName = `${selector.authType ?? matched.authType}:${selector.modelId}`;
|
|
9563
8762
|
const visionModel = matched.baseUrl ? `${qualifiedModelName}\0${matched.baseUrl}` : qualifiedModelName;
|
|
9564
|
-
persistSetting(settings, "visionModel", visionModel);
|
|
8763
|
+
persistSetting(settings, "visionModel", visionModel, scopeOverride);
|
|
9565
8764
|
config.setVisionModel(visionModel);
|
|
9566
8765
|
const visionWarning = isImageCapable(matched) ? "" : `
|
|
9567
8766
|
${formatNonVisionModelWarning(modelName2)}`;
|
|
9568
8767
|
return {
|
|
9569
8768
|
type: "message",
|
|
9570
8769
|
messageType: "info",
|
|
9571
|
-
content: t("Vision Model") + ": " + modelName2 + visionWarning
|
|
8770
|
+
content: t("Vision Model") + ": " + modelName2 + scopeSuffix + visionWarning
|
|
9572
8771
|
};
|
|
9573
8772
|
}
|
|
9574
8773
|
const contentGeneratorConfig = config.getContentGeneratorConfig();
|
|
@@ -9618,6 +8817,17 @@ ${formatNonVisionModelWarning(modelName2)}`;
|
|
|
9618
8817
|
)
|
|
9619
8818
|
};
|
|
9620
8819
|
}
|
|
8820
|
+
if (scopeOverride) {
|
|
8821
|
+
const scopeFlag = hasProject ? "--project" : hasGlobal ? "--global" : "";
|
|
8822
|
+
return {
|
|
8823
|
+
type: "message",
|
|
8824
|
+
messageType: "error",
|
|
8825
|
+
content: t(
|
|
8826
|
+
"Cannot combine {{flag}} with an inline prompt. Run '/model {{flag}} {{model}}' first, then send your prompt.",
|
|
8827
|
+
{ flag: scopeFlag }
|
|
8828
|
+
)
|
|
8829
|
+
};
|
|
8830
|
+
}
|
|
9621
8831
|
const sameAuthType = targetAuthType === authType;
|
|
9622
8832
|
if (!sameAuthType || !isInlineModelOverrideAllowed(config, parsed.modelId)) {
|
|
9623
8833
|
return {
|
|
@@ -9646,12 +8856,13 @@ ${formatNonVisionModelWarning(modelName2)}`;
|
|
|
9646
8856
|
config,
|
|
9647
8857
|
settings,
|
|
9648
8858
|
authType,
|
|
9649
|
-
modelName
|
|
8859
|
+
modelName,
|
|
8860
|
+
scopeOverride
|
|
9650
8861
|
);
|
|
9651
8862
|
return {
|
|
9652
8863
|
type: "message",
|
|
9653
8864
|
messageType: "info",
|
|
9654
|
-
content: t("Model") + ": " + effectiveModelName
|
|
8865
|
+
content: t("Model") + ": " + effectiveModelName + scopeSuffix
|
|
9655
8866
|
};
|
|
9656
8867
|
}
|
|
9657
8868
|
if (context.executionMode !== "interactive") {
|
|
@@ -9659,13 +8870,16 @@ ${formatNonVisionModelWarning(modelName2)}`;
|
|
|
9659
8870
|
return {
|
|
9660
8871
|
type: "message",
|
|
9661
8872
|
messageType: "info",
|
|
9662
|
-
content:
|
|
9663
|
-
|
|
8873
|
+
content: t(
|
|
8874
|
+
'Current model: {{model}}\nUse "/model <model-id>" to switch models, "/model --fast <model-id>" to set the fast model, "/model --project <model-id>" to persist to project settings, or "/model --global <model-id>" to persist to user settings.',
|
|
8875
|
+
{ model: currentModel }
|
|
8876
|
+
)
|
|
9664
8877
|
};
|
|
9665
8878
|
}
|
|
9666
8879
|
return {
|
|
9667
8880
|
type: "dialog",
|
|
9668
|
-
dialog: "model"
|
|
8881
|
+
dialog: "model",
|
|
8882
|
+
...persistScopeSpread(scopeOverride)
|
|
9669
8883
|
};
|
|
9670
8884
|
}, "action")
|
|
9671
8885
|
};
|
|
@@ -9906,6 +9120,178 @@ var recapCommand = {
|
|
|
9906
9120
|
}, "action")
|
|
9907
9121
|
};
|
|
9908
9122
|
|
|
9123
|
+
// packages/cli/src/ui/commands/reload-plugins-command.ts
|
|
9124
|
+
init_esbuild_shims();
|
|
9125
|
+
|
|
9126
|
+
// packages/cli/src/config/extension-runtime-reload.ts
|
|
9127
|
+
init_esbuild_shims();
|
|
9128
|
+
var debugLogger10 = createDebugLogger("EXTENSION_RUNTIME_RELOAD");
|
|
9129
|
+
async function reloadPluginsRuntime(options) {
|
|
9130
|
+
if (options.config.isSafeMode()) {
|
|
9131
|
+
throw new Error("Extension reload is disabled in safe mode.");
|
|
9132
|
+
}
|
|
9133
|
+
const manager = options.config.getExtensionManager();
|
|
9134
|
+
await manager.refreshCache();
|
|
9135
|
+
await manager.refreshTools();
|
|
9136
|
+
await options.reloadCommands?.();
|
|
9137
|
+
return summarizeExtensions(options.config.getActiveExtensions());
|
|
9138
|
+
}
|
|
9139
|
+
__name(reloadPluginsRuntime, "reloadPluginsRuntime");
|
|
9140
|
+
async function refreshExtensionContentRuntime(options) {
|
|
9141
|
+
if (options.config.isSafeMode()) return;
|
|
9142
|
+
const manager = options.config.getExtensionManager();
|
|
9143
|
+
const errors = [];
|
|
9144
|
+
try {
|
|
9145
|
+
await manager.refreshCache();
|
|
9146
|
+
} catch (error) {
|
|
9147
|
+
errors.push(error);
|
|
9148
|
+
debugLogger10.warn(
|
|
9149
|
+
"refreshExtensionContentRuntime: refreshCache failed:",
|
|
9150
|
+
error
|
|
9151
|
+
);
|
|
9152
|
+
}
|
|
9153
|
+
const settled = await Promise.allSettled([
|
|
9154
|
+
options.config.getSkillManager()?.refreshCache(),
|
|
9155
|
+
options.config.getSubagentManager()?.refreshCache(),
|
|
9156
|
+
options.reloadCommands?.()
|
|
9157
|
+
]);
|
|
9158
|
+
for (const result of settled) {
|
|
9159
|
+
if (result.status === "rejected") {
|
|
9160
|
+
errors.push(result.reason);
|
|
9161
|
+
debugLogger10.warn(
|
|
9162
|
+
"refreshExtensionContentRuntime: a refresh leg failed:",
|
|
9163
|
+
result.reason
|
|
9164
|
+
);
|
|
9165
|
+
}
|
|
9166
|
+
}
|
|
9167
|
+
if (errors.length > 0) {
|
|
9168
|
+
throw new Error(
|
|
9169
|
+
errors.map(
|
|
9170
|
+
(error) => error instanceof Error ? error.message : String(error)
|
|
9171
|
+
).join("; ")
|
|
9172
|
+
);
|
|
9173
|
+
}
|
|
9174
|
+
}
|
|
9175
|
+
__name(refreshExtensionContentRuntime, "refreshExtensionContentRuntime");
|
|
9176
|
+
function summarizeExtensions(extensions) {
|
|
9177
|
+
return extensions.reduce(
|
|
9178
|
+
(summary, extension) => {
|
|
9179
|
+
summary.extensionCount++;
|
|
9180
|
+
summary.commandCount += extension.commands?.length ?? 0;
|
|
9181
|
+
summary.skillCount += extension.skills?.length ?? 0;
|
|
9182
|
+
summary.agentCount += extension.agents?.length ?? 0;
|
|
9183
|
+
summary.hookCount += countHooks(extension);
|
|
9184
|
+
summary.mcpServerCount += Object.keys(extension.mcpServers ?? {}).length;
|
|
9185
|
+
summary.lspServerCount += countLspServers(extension);
|
|
9186
|
+
return summary;
|
|
9187
|
+
},
|
|
9188
|
+
{
|
|
9189
|
+
extensionCount: 0,
|
|
9190
|
+
commandCount: 0,
|
|
9191
|
+
skillCount: 0,
|
|
9192
|
+
agentCount: 0,
|
|
9193
|
+
hookCount: 0,
|
|
9194
|
+
mcpServerCount: 0,
|
|
9195
|
+
lspServerCount: 0
|
|
9196
|
+
}
|
|
9197
|
+
);
|
|
9198
|
+
}
|
|
9199
|
+
__name(summarizeExtensions, "summarizeExtensions");
|
|
9200
|
+
function countHooks(extension) {
|
|
9201
|
+
return Object.values(extension.hooks ?? {}).reduce(
|
|
9202
|
+
(sum, definitions) => sum + (definitions ?? []).reduce(
|
|
9203
|
+
(innerSum, definition) => innerSum + (definition.hooks?.length ?? 0),
|
|
9204
|
+
0
|
|
9205
|
+
),
|
|
9206
|
+
0
|
|
9207
|
+
);
|
|
9208
|
+
}
|
|
9209
|
+
__name(countHooks, "countHooks");
|
|
9210
|
+
function countLspServers(extension) {
|
|
9211
|
+
const lspServers = extension.config.lspServers;
|
|
9212
|
+
if (!lspServers) return 0;
|
|
9213
|
+
if (typeof lspServers === "string") return 1;
|
|
9214
|
+
return Object.keys(lspServers).length;
|
|
9215
|
+
}
|
|
9216
|
+
__name(countLspServers, "countLspServers");
|
|
9217
|
+
|
|
9218
|
+
// packages/cli/src/ui/commands/reload-plugins-command.ts
|
|
9219
|
+
function summaryCountTerm(count, singularKey, pluralKey) {
|
|
9220
|
+
return t(count === 1 ? singularKey : pluralKey, {
|
|
9221
|
+
count: String(count)
|
|
9222
|
+
});
|
|
9223
|
+
}
|
|
9224
|
+
__name(summaryCountTerm, "summaryCountTerm");
|
|
9225
|
+
function formatReloadPluginsSummary(summary) {
|
|
9226
|
+
return [
|
|
9227
|
+
summaryCountTerm(
|
|
9228
|
+
summary.extensionCount,
|
|
9229
|
+
"{{count}} extension",
|
|
9230
|
+
"{{count}} extensions"
|
|
9231
|
+
),
|
|
9232
|
+
summaryCountTerm(
|
|
9233
|
+
summary.commandCount,
|
|
9234
|
+
"{{count}} command",
|
|
9235
|
+
"{{count}} commands"
|
|
9236
|
+
),
|
|
9237
|
+
summaryCountTerm(summary.skillCount, "{{count}} skill", "{{count}} skills"),
|
|
9238
|
+
summaryCountTerm(summary.agentCount, "{{count}} agent", "{{count}} agents"),
|
|
9239
|
+
summaryCountTerm(summary.hookCount, "{{count}} hook", "{{count}} hooks"),
|
|
9240
|
+
summaryCountTerm(
|
|
9241
|
+
summary.mcpServerCount,
|
|
9242
|
+
"{{count}} extension MCP server",
|
|
9243
|
+
"{{count}} extension MCP servers"
|
|
9244
|
+
),
|
|
9245
|
+
summaryCountTerm(
|
|
9246
|
+
summary.lspServerCount,
|
|
9247
|
+
"{{count}} extension LSP server",
|
|
9248
|
+
"{{count}} extension LSP servers"
|
|
9249
|
+
)
|
|
9250
|
+
].join(" \xB7 ");
|
|
9251
|
+
}
|
|
9252
|
+
__name(formatReloadPluginsSummary, "formatReloadPluginsSummary");
|
|
9253
|
+
var reloadPluginsCommand = {
|
|
9254
|
+
name: "reload-plugins",
|
|
9255
|
+
get description() {
|
|
9256
|
+
return t("Reload extension changes from disk");
|
|
9257
|
+
},
|
|
9258
|
+
kind: "built-in" /* BUILT_IN */,
|
|
9259
|
+
supportedModes: ["interactive"],
|
|
9260
|
+
action: /* @__PURE__ */ __name(async (context) => {
|
|
9261
|
+
const config = context.services.config;
|
|
9262
|
+
if (!config) {
|
|
9263
|
+
return {
|
|
9264
|
+
type: "message",
|
|
9265
|
+
messageType: "error",
|
|
9266
|
+
content: t("Config not loaded.")
|
|
9267
|
+
};
|
|
9268
|
+
}
|
|
9269
|
+
const extensionRefreshState = context.services.extensionRefreshState ?? new ExtensionRefreshState();
|
|
9270
|
+
try {
|
|
9271
|
+
extensionRefreshState.notifyExtensionsReloadStarted();
|
|
9272
|
+
const summary = await reloadPluginsRuntime({
|
|
9273
|
+
config,
|
|
9274
|
+
reloadCommands: context.ui.reloadCommands
|
|
9275
|
+
});
|
|
9276
|
+
extensionRefreshState.clearExtensionsChanged();
|
|
9277
|
+
return {
|
|
9278
|
+
type: "message",
|
|
9279
|
+
messageType: "info",
|
|
9280
|
+
content: t("Reloaded extensions: {{summary}}", {
|
|
9281
|
+
summary: formatReloadPluginsSummary(summary)
|
|
9282
|
+
})
|
|
9283
|
+
};
|
|
9284
|
+
} catch (error) {
|
|
9285
|
+
extensionRefreshState.markExtensionsReloadFailed();
|
|
9286
|
+
return {
|
|
9287
|
+
type: "message",
|
|
9288
|
+
messageType: "error",
|
|
9289
|
+
content: error instanceof Error ? t("Reload failed: {{message}}", { message: error.message }) : t("Reload failed.")
|
|
9290
|
+
};
|
|
9291
|
+
}
|
|
9292
|
+
}, "action")
|
|
9293
|
+
};
|
|
9294
|
+
|
|
9909
9295
|
// packages/cli/src/ui/commands/renameCommand.ts
|
|
9910
9296
|
init_esbuild_shims();
|
|
9911
9297
|
var MAX_TITLE_LENGTH = SESSION_TITLE_MAX_LENGTH;
|
|
@@ -10097,8 +9483,8 @@ var renameCommand = {
|
|
|
10097
9483
|
|
|
10098
9484
|
// packages/cli/src/ui/commands/restoreCommand.ts
|
|
10099
9485
|
init_esbuild_shims();
|
|
10100
|
-
import * as
|
|
10101
|
-
import
|
|
9486
|
+
import * as fs8 from "node:fs/promises";
|
|
9487
|
+
import path10 from "node:path";
|
|
10102
9488
|
async function restoreAction(context, args) {
|
|
10103
9489
|
const { services, ui } = context;
|
|
10104
9490
|
const { config } = services;
|
|
@@ -10112,8 +9498,8 @@ async function restoreAction(context, args) {
|
|
|
10112
9498
|
};
|
|
10113
9499
|
}
|
|
10114
9500
|
try {
|
|
10115
|
-
await
|
|
10116
|
-
const files = await
|
|
9501
|
+
await fs8.mkdir(checkpointDir, { recursive: true });
|
|
9502
|
+
const files = await fs8.readdir(checkpointDir);
|
|
10117
9503
|
const jsonFiles = files.filter((file) => file.endsWith(".json"));
|
|
10118
9504
|
if (!args) {
|
|
10119
9505
|
if (jsonFiles.length === 0) {
|
|
@@ -10148,8 +9534,8 @@ ${fileList}`
|
|
|
10148
9534
|
content: `File not found: ${selectedFile}`
|
|
10149
9535
|
};
|
|
10150
9536
|
}
|
|
10151
|
-
const filePath =
|
|
10152
|
-
const data = await
|
|
9537
|
+
const filePath = path10.join(checkpointDir, selectedFile);
|
|
9538
|
+
const data = await fs8.readFile(filePath, "utf-8");
|
|
10153
9539
|
const toolCallData = JSON.parse(data);
|
|
10154
9540
|
if (toolCallData.commitHash && !toolCallData.promptId) {
|
|
10155
9541
|
return {
|
|
@@ -10235,7 +9621,7 @@ async function completion(context, _partialArg) {
|
|
|
10235
9621
|
return [];
|
|
10236
9622
|
}
|
|
10237
9623
|
try {
|
|
10238
|
-
const files = await
|
|
9624
|
+
const files = await fs8.readdir(checkpointDir);
|
|
10239
9625
|
return files.filter((file) => file.endsWith(".json")).map((file) => file.replace(".json", ""));
|
|
10240
9626
|
} catch (_err) {
|
|
10241
9627
|
return [];
|
|
@@ -10422,9 +9808,9 @@ ${lines.join("\n")}`
|
|
|
10422
9808
|
|
|
10423
9809
|
// packages/cli/src/ui/commands/statsCommand.ts
|
|
10424
9810
|
init_esbuild_shims();
|
|
10425
|
-
import * as
|
|
9811
|
+
import * as fs9 from "node:fs/promises";
|
|
10426
9812
|
import { randomUUID } from "node:crypto";
|
|
10427
|
-
import
|
|
9813
|
+
import path11 from "node:path";
|
|
10428
9814
|
var VALID_EXPORT_FORMATS = /* @__PURE__ */ new Set(["csv", "json"]);
|
|
10429
9815
|
var EMPTY_SKILL_METRICS = {
|
|
10430
9816
|
totalCalls: 0,
|
|
@@ -10621,12 +10007,12 @@ async function realpathNearestExisting2(targetDirectory, cwd) {
|
|
|
10621
10007
|
let currentDirectory = targetDirectory;
|
|
10622
10008
|
while (isSubpath(cwd, currentDirectory)) {
|
|
10623
10009
|
try {
|
|
10624
|
-
return await
|
|
10010
|
+
return await fs9.realpath(currentDirectory);
|
|
10625
10011
|
} catch (error) {
|
|
10626
10012
|
if (!isNotFoundError(error)) {
|
|
10627
10013
|
throw error;
|
|
10628
10014
|
}
|
|
10629
|
-
const parentDirectory =
|
|
10015
|
+
const parentDirectory = path11.dirname(currentDirectory);
|
|
10630
10016
|
if (parentDirectory === currentDirectory) {
|
|
10631
10017
|
break;
|
|
10632
10018
|
}
|
|
@@ -10640,7 +10026,7 @@ async function realpathNearestExisting2(targetDirectory, cwd) {
|
|
|
10640
10026
|
__name(realpathNearestExisting2, "realpathNearestExisting");
|
|
10641
10027
|
async function validateStatsExportExistingParent(cwd, outputDirectory) {
|
|
10642
10028
|
const [realCwd, realExistingParent] = await Promise.all([
|
|
10643
|
-
|
|
10029
|
+
fs9.realpath(cwd),
|
|
10644
10030
|
realpathNearestExisting2(outputDirectory, cwd)
|
|
10645
10031
|
]);
|
|
10646
10032
|
if (!isSubpath(realCwd, realExistingParent)) {
|
|
@@ -10651,8 +10037,8 @@ async function validateStatsExportExistingParent(cwd, outputDirectory) {
|
|
|
10651
10037
|
__name(validateStatsExportExistingParent, "validateStatsExportExistingParent");
|
|
10652
10038
|
async function validateStatsExportDirectory(cwd, outputDirectory) {
|
|
10653
10039
|
const [realCwd, realOutputDirectory] = await Promise.all([
|
|
10654
|
-
|
|
10655
|
-
|
|
10040
|
+
fs9.realpath(cwd),
|
|
10041
|
+
fs9.realpath(outputDirectory)
|
|
10656
10042
|
]);
|
|
10657
10043
|
if (!isSubpath(realCwd, realOutputDirectory)) {
|
|
10658
10044
|
return statsExportPathError();
|
|
@@ -10661,7 +10047,7 @@ async function validateStatsExportDirectory(cwd, outputDirectory) {
|
|
|
10661
10047
|
}
|
|
10662
10048
|
__name(validateStatsExportDirectory, "validateStatsExportDirectory");
|
|
10663
10049
|
function validateStatsExportPathShape(targetPath) {
|
|
10664
|
-
if (process.platform === "win32" &&
|
|
10050
|
+
if (process.platform === "win32" && path11.basename(targetPath).includes(":")) {
|
|
10665
10051
|
return statsExportPathError();
|
|
10666
10052
|
}
|
|
10667
10053
|
return void 0;
|
|
@@ -10669,7 +10055,7 @@ function validateStatsExportPathShape(targetPath) {
|
|
|
10669
10055
|
__name(validateStatsExportPathShape, "validateStatsExportPathShape");
|
|
10670
10056
|
async function validateStatsExportFileTarget(targetPath) {
|
|
10671
10057
|
try {
|
|
10672
|
-
const stats = await
|
|
10058
|
+
const stats = await fs9.lstat(targetPath);
|
|
10673
10059
|
if (stats.isSymbolicLink() || !stats.isFile()) {
|
|
10674
10060
|
return statsExportPathError();
|
|
10675
10061
|
}
|
|
@@ -10685,7 +10071,7 @@ __name(validateStatsExportFileTarget, "validateStatsExportFileTarget");
|
|
|
10685
10071
|
async function validateStatsExportFinalFile(cwd, targetPath) {
|
|
10686
10072
|
let stats;
|
|
10687
10073
|
try {
|
|
10688
|
-
stats = await
|
|
10074
|
+
stats = await fs9.lstat(targetPath);
|
|
10689
10075
|
} catch (error) {
|
|
10690
10076
|
if (isNotFoundError(error)) {
|
|
10691
10077
|
return statsExportTargetMissingError(targetPath);
|
|
@@ -10696,8 +10082,8 @@ async function validateStatsExportFinalFile(cwd, targetPath) {
|
|
|
10696
10082
|
return statsExportPathError();
|
|
10697
10083
|
}
|
|
10698
10084
|
const [realCwd, realTargetPath] = await Promise.all([
|
|
10699
|
-
|
|
10700
|
-
|
|
10085
|
+
fs9.realpath(cwd),
|
|
10086
|
+
fs9.realpath(targetPath)
|
|
10701
10087
|
]);
|
|
10702
10088
|
if (!isSubpath(realCwd, realTargetPath)) {
|
|
10703
10089
|
return statsExportPathError();
|
|
@@ -10706,9 +10092,9 @@ async function validateStatsExportFinalFile(cwd, targetPath) {
|
|
|
10706
10092
|
}
|
|
10707
10093
|
__name(validateStatsExportFinalFile, "validateStatsExportFinalFile");
|
|
10708
10094
|
function createTemporaryExportPath(outputDirectory, targetPath) {
|
|
10709
|
-
return
|
|
10095
|
+
return path11.join(
|
|
10710
10096
|
outputDirectory,
|
|
10711
|
-
`.${
|
|
10097
|
+
`.${path11.basename(targetPath)}.${process.pid}.${Date.now()}.${randomUUID()}.tmp`
|
|
10712
10098
|
);
|
|
10713
10099
|
}
|
|
10714
10100
|
__name(createTemporaryExportPath, "createTemporaryExportPath");
|
|
@@ -10718,8 +10104,8 @@ function isSamePath(leftPath, rightPath) {
|
|
|
10718
10104
|
__name(isSamePath, "isSamePath");
|
|
10719
10105
|
async function validateStatsExportDirectoryIdentity(cwd, outputDirectory, expectedRealOutputDirectory) {
|
|
10720
10106
|
const [realCwd, realOutputDirectory] = await Promise.all([
|
|
10721
|
-
|
|
10722
|
-
|
|
10107
|
+
fs9.realpath(cwd),
|
|
10108
|
+
fs9.realpath(outputDirectory)
|
|
10723
10109
|
]);
|
|
10724
10110
|
if (!isSubpath(realCwd, realOutputDirectory) || !isSamePath(expectedRealOutputDirectory, realOutputDirectory)) {
|
|
10725
10111
|
return statsExportPathError();
|
|
@@ -10736,12 +10122,12 @@ async function writeStatsExportFileAtomically(cwd, outputDirectory, targetPath,
|
|
|
10736
10122
|
return initialDirectoryError;
|
|
10737
10123
|
}
|
|
10738
10124
|
const [realCwd, realOutputDirectory] = await Promise.all([
|
|
10739
|
-
|
|
10740
|
-
|
|
10125
|
+
fs9.realpath(cwd),
|
|
10126
|
+
fs9.realpath(outputDirectory)
|
|
10741
10127
|
]);
|
|
10742
|
-
const realTargetPath =
|
|
10128
|
+
const realTargetPath = path11.join(
|
|
10743
10129
|
realOutputDirectory,
|
|
10744
|
-
|
|
10130
|
+
path11.basename(targetPath)
|
|
10745
10131
|
);
|
|
10746
10132
|
if (!isSubpath(realCwd, realTargetPath)) {
|
|
10747
10133
|
return statsExportPathError();
|
|
@@ -10767,7 +10153,7 @@ async function writeStatsExportFileAtomically(cwd, outputDirectory, targetPath,
|
|
|
10767
10153
|
if (preTempFileError) {
|
|
10768
10154
|
return preTempFileError;
|
|
10769
10155
|
}
|
|
10770
|
-
const file = await
|
|
10156
|
+
const file = await fs9.open(tempPath, "wx", 384);
|
|
10771
10157
|
try {
|
|
10772
10158
|
await file.writeFile(content, { encoding: "utf-8" });
|
|
10773
10159
|
} finally {
|
|
@@ -10789,7 +10175,7 @@ async function writeStatsExportFileAtomically(cwd, outputDirectory, targetPath,
|
|
|
10789
10175
|
if (preRenameFileError) {
|
|
10790
10176
|
return preRenameFileError;
|
|
10791
10177
|
}
|
|
10792
|
-
await
|
|
10178
|
+
await fs9.rename(tempPath, realTargetPath);
|
|
10793
10179
|
tempPath = void 0;
|
|
10794
10180
|
return validateStatsExportFinalFile(cwd, realTargetPath);
|
|
10795
10181
|
} catch (error) {
|
|
@@ -10799,7 +10185,7 @@ async function writeStatsExportFileAtomically(cwd, outputDirectory, targetPath,
|
|
|
10799
10185
|
throw error;
|
|
10800
10186
|
} finally {
|
|
10801
10187
|
if (tempPath) {
|
|
10802
|
-
await
|
|
10188
|
+
await fs9.rm(tempPath, { force: true }).catch(() => void 0);
|
|
10803
10189
|
}
|
|
10804
10190
|
}
|
|
10805
10191
|
}
|
|
@@ -10891,10 +10277,10 @@ async function writeStatsExport(context, args) {
|
|
|
10891
10277
|
});
|
|
10892
10278
|
const content = parsed.format === "json" ? formatTokenUsageSummaryAsJson(summary) : `${formatTokenUsageSummaryAsCsv(summary)}
|
|
10893
10279
|
`;
|
|
10894
|
-
const cwd =
|
|
10280
|
+
const cwd = path11.resolve(getConfigCwd(context));
|
|
10895
10281
|
const defaultFilename = `qwen-token-usage-${summary.period}-${summary.value}.${parsed.format}`;
|
|
10896
|
-
const targetPath =
|
|
10897
|
-
const outputDirectory =
|
|
10282
|
+
const targetPath = path11.resolve(cwd, parsed.outputPath || defaultFilename);
|
|
10283
|
+
const outputDirectory = path11.dirname(targetPath);
|
|
10898
10284
|
if (!isSubpath(cwd, targetPath) || !isSubpath(cwd, outputDirectory)) {
|
|
10899
10285
|
return statsExportPathError();
|
|
10900
10286
|
}
|
|
@@ -10909,7 +10295,7 @@ async function writeStatsExport(context, args) {
|
|
|
10909
10295
|
if (parentError) {
|
|
10910
10296
|
return parentError;
|
|
10911
10297
|
}
|
|
10912
|
-
await
|
|
10298
|
+
await fs9.mkdir(outputDirectory, { recursive: true });
|
|
10913
10299
|
const postMkdirError = await validateStatsExportDirectory(
|
|
10914
10300
|
cwd,
|
|
10915
10301
|
outputDirectory
|
|
@@ -10933,7 +10319,7 @@ async function writeStatsExport(context, args) {
|
|
|
10933
10319
|
return asMessage(
|
|
10934
10320
|
t("Token usage exported to {{format}}: {{path}}", {
|
|
10935
10321
|
format: parsed.format.toUpperCase(),
|
|
10936
|
-
path:
|
|
10322
|
+
path: path11.relative(cwd, targetPath)
|
|
10937
10323
|
})
|
|
10938
10324
|
);
|
|
10939
10325
|
} catch (error) {
|
|
@@ -11144,7 +10530,7 @@ var statsCommand = {
|
|
|
11144
10530
|
// packages/cli/src/ui/commands/summaryCommand.ts
|
|
11145
10531
|
init_esbuild_shims();
|
|
11146
10532
|
import * as fsPromises from "fs/promises";
|
|
11147
|
-
import
|
|
10533
|
+
import path12 from "path";
|
|
11148
10534
|
var summaryCommand = {
|
|
11149
10535
|
name: "summary",
|
|
11150
10536
|
get description() {
|
|
@@ -11237,12 +10623,12 @@ var summaryCommand = {
|
|
|
11237
10623
|
}, "generateSummaryMarkdown");
|
|
11238
10624
|
const saveSummaryToDisk = /* @__PURE__ */ __name(async (markdownSummary) => {
|
|
11239
10625
|
const projectRoot = config.getProjectRoot();
|
|
11240
|
-
const qwenDir =
|
|
10626
|
+
const qwenDir = path12.join(projectRoot, ".qwen");
|
|
11241
10627
|
try {
|
|
11242
10628
|
await fsPromises.mkdir(qwenDir, { recursive: true });
|
|
11243
10629
|
} catch (_err) {
|
|
11244
10630
|
}
|
|
11245
|
-
const summaryPath =
|
|
10631
|
+
const summaryPath = path12.join(qwenDir, "PROJECT_SUMMARY.md");
|
|
11246
10632
|
const summaryContent = `${markdownSummary}
|
|
11247
10633
|
|
|
11248
10634
|
---
|
|
@@ -11398,12 +10784,12 @@ init_esbuild_shims();
|
|
|
11398
10784
|
|
|
11399
10785
|
// packages/cli/src/ui/utils/terminalSetup.ts
|
|
11400
10786
|
init_esbuild_shims();
|
|
11401
|
-
import { promises as
|
|
11402
|
-
import * as
|
|
11403
|
-
import * as
|
|
10787
|
+
import { promises as fs10 } from "node:fs";
|
|
10788
|
+
import * as os4 from "node:os";
|
|
10789
|
+
import * as path13 from "node:path";
|
|
11404
10790
|
import { exec } from "node:child_process";
|
|
11405
10791
|
import { promisify } from "node:util";
|
|
11406
|
-
var
|
|
10792
|
+
var debugLogger11 = createDebugLogger("TERMINAL_SETUP");
|
|
11407
10793
|
var execAsync = promisify(exec);
|
|
11408
10794
|
function stripJsonComments2(content) {
|
|
11409
10795
|
return content.replace(/^\s*\/\/.*$/gm, "");
|
|
@@ -11423,7 +10809,7 @@ async function detectTerminal() {
|
|
|
11423
10809
|
if (termProgram === "vscode" || process.env["VSCODE_GIT_IPC_HANDLE"]) {
|
|
11424
10810
|
return "vscode";
|
|
11425
10811
|
}
|
|
11426
|
-
if (
|
|
10812
|
+
if (os4.platform() !== "win32") {
|
|
11427
10813
|
try {
|
|
11428
10814
|
const { stdout } = await execAsync("ps -o comm= -p $PPID");
|
|
11429
10815
|
const parentName = stdout.trim();
|
|
@@ -11436,7 +10822,7 @@ async function detectTerminal() {
|
|
|
11436
10822
|
if (parentName.includes("trae") || parentName.includes("Trae"))
|
|
11437
10823
|
return "trae";
|
|
11438
10824
|
} catch (error) {
|
|
11439
|
-
|
|
10825
|
+
debugLogger11.debug("Parent process detection failed:", error);
|
|
11440
10826
|
}
|
|
11441
10827
|
}
|
|
11442
10828
|
return null;
|
|
@@ -11446,29 +10832,29 @@ async function backupFile(filePath) {
|
|
|
11446
10832
|
try {
|
|
11447
10833
|
const timestamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
11448
10834
|
const backupPath = `${filePath}.backup.${timestamp}`;
|
|
11449
|
-
await
|
|
10835
|
+
await fs10.copyFile(filePath, backupPath);
|
|
11450
10836
|
} catch (error) {
|
|
11451
|
-
|
|
10837
|
+
debugLogger11.warn(`Failed to create backup of ${filePath}:`, error);
|
|
11452
10838
|
}
|
|
11453
10839
|
}
|
|
11454
10840
|
__name(backupFile, "backupFile");
|
|
11455
10841
|
function getVSCodeStyleConfigDir(appName) {
|
|
11456
|
-
const
|
|
11457
|
-
if (
|
|
11458
|
-
return
|
|
11459
|
-
|
|
10842
|
+
const platform2 = os4.platform();
|
|
10843
|
+
if (platform2 === "darwin") {
|
|
10844
|
+
return path13.join(
|
|
10845
|
+
os4.homedir(),
|
|
11460
10846
|
"Library",
|
|
11461
10847
|
"Application Support",
|
|
11462
10848
|
appName,
|
|
11463
10849
|
"User"
|
|
11464
10850
|
);
|
|
11465
|
-
} else if (
|
|
10851
|
+
} else if (platform2 === "win32") {
|
|
11466
10852
|
if (!process.env["APPDATA"]) {
|
|
11467
10853
|
return null;
|
|
11468
10854
|
}
|
|
11469
|
-
return
|
|
10855
|
+
return path13.join(process.env["APPDATA"], appName, "User");
|
|
11470
10856
|
} else {
|
|
11471
|
-
return
|
|
10857
|
+
return path13.join(os4.homedir(), ".config", appName, "User");
|
|
11472
10858
|
}
|
|
11473
10859
|
}
|
|
11474
10860
|
__name(getVSCodeStyleConfigDir, "getVSCodeStyleConfigDir");
|
|
@@ -11483,12 +10869,12 @@ async function configureVSCodeStyle(terminalName, appName) {
|
|
|
11483
10869
|
)
|
|
11484
10870
|
};
|
|
11485
10871
|
}
|
|
11486
|
-
const keybindingsFile =
|
|
10872
|
+
const keybindingsFile = path13.join(configDir, "keybindings.json");
|
|
11487
10873
|
try {
|
|
11488
|
-
await
|
|
10874
|
+
await fs10.mkdir(configDir, { recursive: true });
|
|
11489
10875
|
let keybindings = [];
|
|
11490
10876
|
try {
|
|
11491
|
-
const content = await
|
|
10877
|
+
const content = await fs10.readFile(keybindingsFile, "utf8");
|
|
11492
10878
|
await backupFile(keybindingsFile);
|
|
11493
10879
|
try {
|
|
11494
10880
|
const cleanContent = stripJsonComments2(content);
|
|
@@ -11562,7 +10948,7 @@ async function configureVSCodeStyle(terminalName, appName) {
|
|
|
11562
10948
|
if (!hasOurShiftEnter || !hasOurCtrlEnter) {
|
|
11563
10949
|
if (!hasOurShiftEnter) keybindings.unshift(shiftEnterBinding);
|
|
11564
10950
|
if (!hasOurCtrlEnter) keybindings.unshift(ctrlEnterBinding);
|
|
11565
|
-
await
|
|
10951
|
+
await fs10.writeFile(keybindingsFile, JSON.stringify(keybindings, null, 4));
|
|
11566
10952
|
return {
|
|
11567
10953
|
success: true,
|
|
11568
10954
|
message: t(
|
|
@@ -11757,7 +11143,7 @@ init_esbuild_shims();
|
|
|
11757
11143
|
|
|
11758
11144
|
// packages/cli/src/ui/voice/voice-availability.ts
|
|
11759
11145
|
init_esbuild_shims();
|
|
11760
|
-
import { existsSync as
|
|
11146
|
+
import { existsSync as existsSync2 } from "node:fs";
|
|
11761
11147
|
import process5 from "node:process";
|
|
11762
11148
|
var SUPPORTED_PLATFORMS = [
|
|
11763
11149
|
"darwin",
|
|
@@ -11772,14 +11158,14 @@ function getVoiceUnavailableReason(environment = {
|
|
|
11772
11158
|
platform: process5.platform,
|
|
11773
11159
|
env: process5.env
|
|
11774
11160
|
}) {
|
|
11775
|
-
const { platform:
|
|
11776
|
-
const fileExists = environment.fileExists ??
|
|
11777
|
-
if (!SUPPORTED_PLATFORMS.includes(
|
|
11161
|
+
const { platform: platform2, env } = environment;
|
|
11162
|
+
const fileExists = environment.fileExists ?? existsSync2;
|
|
11163
|
+
if (!SUPPORTED_PLATFORMS.includes(platform2)) {
|
|
11778
11164
|
return t("Voice dictation is not supported on {{platform}}.", {
|
|
11779
|
-
platform:
|
|
11165
|
+
platform: platform2
|
|
11780
11166
|
});
|
|
11781
11167
|
}
|
|
11782
|
-
if (
|
|
11168
|
+
if (platform2 === "linux" && isWsl(env) && !env["PULSE_SERVER"] && !fileExists("/mnt/wslg/PulseServer")) {
|
|
11783
11169
|
return t(
|
|
11784
11170
|
"Voice dictation needs microphone access, which is unavailable in this WSL session. Use WSLg/PulseAudio, or run Qwen Code on a host with a microphone."
|
|
11785
11171
|
);
|
|
@@ -11936,18 +11322,18 @@ var setupGithubCommand = {
|
|
|
11936
11322
|
|
|
11937
11323
|
// packages/cli/src/ui/commands/insightCommand.ts
|
|
11938
11324
|
init_esbuild_shims();
|
|
11939
|
-
import { join as
|
|
11325
|
+
import { join as join7 } from "path";
|
|
11940
11326
|
import { pathToFileURL } from "node:url";
|
|
11941
11327
|
|
|
11942
11328
|
// packages/cli/src/services/insight/generators/StaticInsightGenerator.ts
|
|
11943
11329
|
init_esbuild_shims();
|
|
11944
|
-
import
|
|
11945
|
-
import
|
|
11330
|
+
import fs12 from "fs/promises";
|
|
11331
|
+
import path15 from "path";
|
|
11946
11332
|
|
|
11947
11333
|
// packages/cli/src/services/insight/generators/DataProcessor.ts
|
|
11948
11334
|
init_esbuild_shims();
|
|
11949
|
-
import
|
|
11950
|
-
import
|
|
11335
|
+
import fs11 from "fs/promises";
|
|
11336
|
+
import path14 from "path";
|
|
11951
11337
|
|
|
11952
11338
|
// packages/cli/node_modules/p-limit/index.js
|
|
11953
11339
|
init_esbuild_shims();
|
|
@@ -12047,27 +11433,27 @@ function pLimit(concurrency) {
|
|
|
12047
11433
|
activeCount--;
|
|
12048
11434
|
resumeNext();
|
|
12049
11435
|
}, "next");
|
|
12050
|
-
const run = /* @__PURE__ */ __name(async (function_,
|
|
11436
|
+
const run = /* @__PURE__ */ __name(async (function_, resolve4, arguments_) => {
|
|
12051
11437
|
const result = (async () => function_(...arguments_))();
|
|
12052
|
-
|
|
11438
|
+
resolve4(result);
|
|
12053
11439
|
try {
|
|
12054
11440
|
await result;
|
|
12055
11441
|
} catch {
|
|
12056
11442
|
}
|
|
12057
11443
|
next();
|
|
12058
11444
|
}, "run");
|
|
12059
|
-
const enqueue = /* @__PURE__ */ __name((function_,
|
|
11445
|
+
const enqueue = /* @__PURE__ */ __name((function_, resolve4, reject, arguments_) => {
|
|
12060
11446
|
const queueItem = { reject };
|
|
12061
11447
|
new Promise((internalResolve) => {
|
|
12062
11448
|
queueItem.run = internalResolve;
|
|
12063
11449
|
queue.enqueue(queueItem);
|
|
12064
|
-
}).then(run.bind(void 0, function_,
|
|
11450
|
+
}).then(run.bind(void 0, function_, resolve4, arguments_));
|
|
12065
11451
|
if (activeCount < concurrency) {
|
|
12066
11452
|
resumeNext();
|
|
12067
11453
|
}
|
|
12068
11454
|
}, "enqueue");
|
|
12069
|
-
const generator = /* @__PURE__ */ __name((function_, ...arguments_) => new Promise((
|
|
12070
|
-
enqueue(function_,
|
|
11455
|
+
const generator = /* @__PURE__ */ __name((function_, ...arguments_) => new Promise((resolve4, reject) => {
|
|
11456
|
+
enqueue(function_, resolve4, reject, arguments_);
|
|
12071
11457
|
}), "generator");
|
|
12072
11458
|
Object.defineProperties(generator, {
|
|
12073
11459
|
activeCount: {
|
|
@@ -12901,19 +12287,19 @@ None captured`;
|
|
|
12901
12287
|
async scanChatFiles(baseDir) {
|
|
12902
12288
|
const allChatFiles = [];
|
|
12903
12289
|
try {
|
|
12904
|
-
const projectDirs = await
|
|
12290
|
+
const projectDirs = await fs11.readdir(baseDir);
|
|
12905
12291
|
for (const projectDir of projectDirs) {
|
|
12906
|
-
const projectPath =
|
|
12907
|
-
const stats = await
|
|
12292
|
+
const projectPath = path14.join(baseDir, projectDir);
|
|
12293
|
+
const stats = await fs11.stat(projectPath);
|
|
12908
12294
|
if (stats.isDirectory()) {
|
|
12909
|
-
const chatsDir =
|
|
12295
|
+
const chatsDir = path14.join(projectPath, "chats");
|
|
12910
12296
|
try {
|
|
12911
|
-
const files = await
|
|
12297
|
+
const files = await fs11.readdir(chatsDir);
|
|
12912
12298
|
const chatFiles = files.filter((file) => file.endsWith(".jsonl"));
|
|
12913
12299
|
for (const file of chatFiles) {
|
|
12914
|
-
const filePath =
|
|
12300
|
+
const filePath = path14.join(chatsDir, file);
|
|
12915
12301
|
try {
|
|
12916
|
-
const fileStats = await
|
|
12302
|
+
const fileStats = await fs11.stat(filePath);
|
|
12917
12303
|
allChatFiles.push({ path: filePath, mtime: fileStats.mtimeMs });
|
|
12918
12304
|
} catch (e) {
|
|
12919
12305
|
logger.error(`Failed to stat file ${filePath}:`, e);
|
|
@@ -13008,7 +12394,7 @@ None captured`;
|
|
|
13008
12394
|
overallProgress
|
|
13009
12395
|
);
|
|
13010
12396
|
}
|
|
13011
|
-
await new Promise((
|
|
12397
|
+
await new Promise((resolve4) => setTimeout(resolve4, 0));
|
|
13012
12398
|
}
|
|
13013
12399
|
const streakData = this.calculateStreaks(Object.keys(heatmap));
|
|
13014
12400
|
let longestWorkDuration = 0;
|
|
@@ -13091,12 +12477,12 @@ None captured`;
|
|
|
13091
12477
|
if (records.length > 0 && facetsOutputDir) {
|
|
13092
12478
|
const sessionId = records[0].sessionId;
|
|
13093
12479
|
if (sessionId) {
|
|
13094
|
-
const existingFacetPath =
|
|
12480
|
+
const existingFacetPath = path14.join(
|
|
13095
12481
|
facetsOutputDir,
|
|
13096
12482
|
`${sessionId}.json`
|
|
13097
12483
|
);
|
|
13098
12484
|
try {
|
|
13099
|
-
const existingData = await
|
|
12485
|
+
const existingData = await fs11.readFile(
|
|
13100
12486
|
existingFacetPath,
|
|
13101
12487
|
"utf-8"
|
|
13102
12488
|
);
|
|
@@ -13114,7 +12500,7 @@ None captured`;
|
|
|
13114
12500
|
const normalizedData = JSON.stringify(normalizedFacet, null, 2);
|
|
13115
12501
|
if (existingData !== normalizedData) {
|
|
13116
12502
|
try {
|
|
13117
|
-
await
|
|
12503
|
+
await fs11.writeFile(
|
|
13118
12504
|
existingFacetPath,
|
|
13119
12505
|
normalizedData,
|
|
13120
12506
|
"utf-8"
|
|
@@ -13149,11 +12535,11 @@ None captured`;
|
|
|
13149
12535
|
const facet = await this.analyzeSession(records);
|
|
13150
12536
|
if (facet && facetsOutputDir) {
|
|
13151
12537
|
try {
|
|
13152
|
-
const facetPath =
|
|
12538
|
+
const facetPath = path14.join(
|
|
13153
12539
|
facetsOutputDir,
|
|
13154
12540
|
`${facet.session_id}.json`
|
|
13155
12541
|
);
|
|
13156
|
-
await
|
|
12542
|
+
await fs11.writeFile(
|
|
13157
12543
|
facetPath,
|
|
13158
12544
|
JSON.stringify(facet, null, 2),
|
|
13159
12545
|
"utf-8"
|
|
@@ -13251,8 +12637,8 @@ var StaticInsightGenerator = class {
|
|
|
13251
12637
|
}
|
|
13252
12638
|
// Ensure the output directory exists
|
|
13253
12639
|
async ensureOutputDirectory() {
|
|
13254
|
-
const outputDir =
|
|
13255
|
-
await
|
|
12640
|
+
const outputDir = path15.join(Storage.getRuntimeBaseDir(), "insights");
|
|
12641
|
+
await fs12.mkdir(outputDir, { recursive: true });
|
|
13256
12642
|
return outputDir;
|
|
13257
12643
|
}
|
|
13258
12644
|
// Generate timestamped filename with collision detection
|
|
@@ -13260,23 +12646,23 @@ var StaticInsightGenerator = class {
|
|
|
13260
12646
|
const now = /* @__PURE__ */ new Date();
|
|
13261
12647
|
const date = now.toISOString().split("T")[0];
|
|
13262
12648
|
const time = now.toTimeString().slice(0, 8).replace(/:/g, "");
|
|
13263
|
-
let outputPath =
|
|
12649
|
+
let outputPath = path15.join(outputDir, `insight-${date}.html`);
|
|
13264
12650
|
try {
|
|
13265
|
-
await
|
|
13266
|
-
outputPath =
|
|
12651
|
+
await fs12.access(outputPath);
|
|
12652
|
+
outputPath = path15.join(outputDir, `insight-${date}-${time}.html`);
|
|
13267
12653
|
} catch {
|
|
13268
12654
|
}
|
|
13269
12655
|
return outputPath;
|
|
13270
12656
|
}
|
|
13271
12657
|
async updateInsightSymlink(outputDir, targetPath) {
|
|
13272
|
-
const latestPath =
|
|
12658
|
+
const latestPath = path15.join(outputDir, "insight.html");
|
|
13273
12659
|
await updateSymlink(latestPath, targetPath);
|
|
13274
12660
|
}
|
|
13275
12661
|
// Generate the static insight HTML file
|
|
13276
12662
|
async generateStaticInsight(baseDir, onProgress) {
|
|
13277
12663
|
const outputDir = await this.ensureOutputDirectory();
|
|
13278
|
-
const facetsDir =
|
|
13279
|
-
await
|
|
12664
|
+
const facetsDir = path15.join(outputDir, "facets");
|
|
12665
|
+
await fs12.mkdir(facetsDir, { recursive: true });
|
|
13280
12666
|
const insights = await this.dataProcessor.generateInsights(
|
|
13281
12667
|
baseDir,
|
|
13282
12668
|
facetsDir,
|
|
@@ -13284,7 +12670,7 @@ var StaticInsightGenerator = class {
|
|
|
13284
12670
|
);
|
|
13285
12671
|
const html = await this.templateRenderer.renderInsightHTML(insights);
|
|
13286
12672
|
const outputPath = await this.generateOutputPath(outputDir);
|
|
13287
|
-
await
|
|
12673
|
+
await fs12.writeFile(outputPath, html, "utf-8");
|
|
13288
12674
|
await this.updateInsightSymlink(outputDir, outputPath);
|
|
13289
12675
|
return outputPath;
|
|
13290
12676
|
}
|
|
@@ -13304,7 +12690,7 @@ var insightCommand = {
|
|
|
13304
12690
|
action: /* @__PURE__ */ __name(async (context) => {
|
|
13305
12691
|
try {
|
|
13306
12692
|
context.ui.setDebugMessage(t("Generating insights..."));
|
|
13307
|
-
const projectsDir =
|
|
12693
|
+
const projectsDir = join7(Storage.getRuntimeBaseDir(), "projects");
|
|
13308
12694
|
if (!context.services.config) {
|
|
13309
12695
|
if (context.executionMode !== "interactive") {
|
|
13310
12696
|
return {
|
|
@@ -13347,12 +12733,12 @@ var insightCommand = {
|
|
|
13347
12733
|
let isComplete = false;
|
|
13348
12734
|
let resume = null;
|
|
13349
12735
|
const flushResume = /* @__PURE__ */ __name(() => {
|
|
13350
|
-
const
|
|
13351
|
-
if (!
|
|
12736
|
+
const resolve4 = resume;
|
|
12737
|
+
if (!resolve4) {
|
|
13352
12738
|
return;
|
|
13353
12739
|
}
|
|
13354
12740
|
resume = null;
|
|
13355
|
-
|
|
12741
|
+
resolve4();
|
|
13356
12742
|
}, "flushResume");
|
|
13357
12743
|
const pushMessage = /* @__PURE__ */ __name((message) => {
|
|
13358
12744
|
pendingMessages.push(message);
|
|
@@ -13361,8 +12747,8 @@ var insightCommand = {
|
|
|
13361
12747
|
const streamMessages = /* @__PURE__ */ __name(async function* () {
|
|
13362
12748
|
while (!isComplete || pendingMessages.length > 0) {
|
|
13363
12749
|
if (pendingMessages.length === 0) {
|
|
13364
|
-
await new Promise((
|
|
13365
|
-
resume =
|
|
12750
|
+
await new Promise((resolve4) => {
|
|
12751
|
+
resume = resolve4;
|
|
13366
12752
|
});
|
|
13367
12753
|
}
|
|
13368
12754
|
while (pendingMessages.length > 0) {
|
|
@@ -13690,6 +13076,7 @@ var BuiltinCommandLoader = class {
|
|
|
13690
13076
|
...this.config?.getFolderTrust() ? [trustCommand] : [],
|
|
13691
13077
|
quitCommand,
|
|
13692
13078
|
recapCommand,
|
|
13079
|
+
reloadPluginsCommand,
|
|
13693
13080
|
renameCommand,
|
|
13694
13081
|
restoreCommand(this.config),
|
|
13695
13082
|
resumeCommand,
|
|
@@ -13720,8 +13107,8 @@ var BuiltinCommandLoader = class {
|
|
|
13720
13107
|
|
|
13721
13108
|
// packages/cli/src/services/BundledSkillLoader.ts
|
|
13722
13109
|
init_esbuild_shims();
|
|
13723
|
-
import { dirname as
|
|
13724
|
-
var
|
|
13110
|
+
import { dirname as dirname2 } from "node:path";
|
|
13111
|
+
var debugLogger12 = createDebugLogger("BUNDLED_SKILL_LOADER");
|
|
13725
13112
|
var BundledSkillLoader = class {
|
|
13726
13113
|
constructor(config) {
|
|
13727
13114
|
this.config = config;
|
|
@@ -13731,12 +13118,12 @@ var BundledSkillLoader = class {
|
|
|
13731
13118
|
}
|
|
13732
13119
|
async loadCommands(_signal) {
|
|
13733
13120
|
if (this.config?.getBareMode?.()) {
|
|
13734
|
-
|
|
13121
|
+
debugLogger12.debug("Bare mode enabled, skipping bundled skills");
|
|
13735
13122
|
return [];
|
|
13736
13123
|
}
|
|
13737
13124
|
const skillManager = this.config?.getSkillManager();
|
|
13738
13125
|
if (!skillManager) {
|
|
13739
|
-
|
|
13126
|
+
debugLogger12.debug("SkillManager not available, skipping bundled skills");
|
|
13740
13127
|
return [];
|
|
13741
13128
|
}
|
|
13742
13129
|
try {
|
|
@@ -13744,7 +13131,7 @@ var BundledSkillLoader = class {
|
|
|
13744
13131
|
const cronEnabled = this.config?.isCronEnabled() ?? false;
|
|
13745
13132
|
const cronVisible = allSkills.filter((skill) => {
|
|
13746
13133
|
if (!cronEnabled && skill.allowedTools?.some((t2) => t2.startsWith("cron_"))) {
|
|
13747
|
-
|
|
13134
|
+
debugLogger12.debug(
|
|
13748
13135
|
`Hiding skill "${skill.name}" because cron is not enabled`
|
|
13749
13136
|
);
|
|
13750
13137
|
return false;
|
|
@@ -13755,7 +13142,7 @@ var BundledSkillLoader = class {
|
|
|
13755
13142
|
const skills = cronVisible.filter(
|
|
13756
13143
|
(skill) => !disabled.has(skill.name.toLowerCase())
|
|
13757
13144
|
);
|
|
13758
|
-
|
|
13145
|
+
debugLogger12.debug(
|
|
13759
13146
|
`Loaded ${skills.length} bundled skill(s) as slash commands; ${cronVisible.length - skills.length} hidden by skills.disabled`
|
|
13760
13147
|
);
|
|
13761
13148
|
return skills.map((skill) => ({
|
|
@@ -13792,7 +13179,7 @@ ${body}`;
|
|
|
13792
13179
|
}
|
|
13793
13180
|
}
|
|
13794
13181
|
const skillPrompt = buildSkillLlmContent(
|
|
13795
|
-
|
|
13182
|
+
dirname2(skill.filePath),
|
|
13796
13183
|
body
|
|
13797
13184
|
);
|
|
13798
13185
|
const content = context.invocation?.args ? appendToLastTextPart(
|
|
@@ -13806,7 +13193,7 @@ ${body}`;
|
|
|
13806
13193
|
}, "action")
|
|
13807
13194
|
}));
|
|
13808
13195
|
} catch (error) {
|
|
13809
|
-
|
|
13196
|
+
debugLogger12.error("Failed to load bundled skills:", error);
|
|
13810
13197
|
return [];
|
|
13811
13198
|
}
|
|
13812
13199
|
}
|
|
@@ -13815,9 +13202,9 @@ ${body}`;
|
|
|
13815
13202
|
// packages/cli/src/services/FileCommandLoader.ts
|
|
13816
13203
|
init_esbuild_shims();
|
|
13817
13204
|
var import_toml = __toESM(require_toml(), 1);
|
|
13818
|
-
import { promises as
|
|
13205
|
+
import { promises as fs13 } from "node:fs";
|
|
13819
13206
|
import * as fsSync from "node:fs";
|
|
13820
|
-
import
|
|
13207
|
+
import path17 from "node:path";
|
|
13821
13208
|
|
|
13822
13209
|
// packages/cli/src/services/markdown-command-parser.ts
|
|
13823
13210
|
init_esbuild_shims();
|
|
@@ -13862,7 +13249,7 @@ __name(parseMarkdownCommand, "parseMarkdownCommand");
|
|
|
13862
13249
|
|
|
13863
13250
|
// packages/cli/src/services/command-factory.ts
|
|
13864
13251
|
init_esbuild_shims();
|
|
13865
|
-
import
|
|
13252
|
+
import path16 from "node:path";
|
|
13866
13253
|
|
|
13867
13254
|
// packages/cli/src/services/prompt-processors/argumentProcessor.ts
|
|
13868
13255
|
init_esbuild_shims();
|
|
@@ -14086,7 +13473,7 @@ var ShellProcessor = class {
|
|
|
14086
13473
|
|
|
14087
13474
|
// packages/cli/src/services/prompt-processors/atFileProcessor.ts
|
|
14088
13475
|
init_esbuild_shims();
|
|
14089
|
-
var
|
|
13476
|
+
var debugLogger13 = createDebugLogger("AT_FILE_PROCESSOR");
|
|
14090
13477
|
var AtFileProcessor = class {
|
|
14091
13478
|
constructor(commandName) {
|
|
14092
13479
|
this.commandName = commandName;
|
|
@@ -14132,7 +13519,7 @@ var AtFileProcessor = class {
|
|
|
14132
13519
|
} catch (error) {
|
|
14133
13520
|
const message = error instanceof Error ? error.message : String(error);
|
|
14134
13521
|
const uiMessage = `Failed to inject content for '@{${pathStr}}': ${message}`;
|
|
14135
|
-
|
|
13522
|
+
debugLogger13.error(
|
|
14136
13523
|
`[AtFileProcessor] ${uiMessage}. Leaving placeholder in prompt.`
|
|
14137
13524
|
);
|
|
14138
13525
|
context.ui.addItem(
|
|
@@ -14157,15 +13544,15 @@ var AtFileProcessor = class {
|
|
|
14157
13544
|
};
|
|
14158
13545
|
|
|
14159
13546
|
// packages/cli/src/services/command-factory.ts
|
|
14160
|
-
var
|
|
13547
|
+
var debugLogger14 = createDebugLogger("COMMAND_FACTORY");
|
|
14161
13548
|
function createSlashCommandFromDefinition(filePath, baseDir, definition, extensionName, fileExtension) {
|
|
14162
|
-
const relativePathWithExt =
|
|
13549
|
+
const relativePathWithExt = path16.relative(baseDir, filePath);
|
|
14163
13550
|
const relativePath = relativePathWithExt.substring(
|
|
14164
13551
|
0,
|
|
14165
13552
|
relativePathWithExt.length - fileExtension.length
|
|
14166
13553
|
);
|
|
14167
|
-
const baseCommandName = relativePath.split(
|
|
14168
|
-
const defaultDescription = `Custom command from ${
|
|
13554
|
+
const baseCommandName = relativePath.split(path16.sep).map((segment) => segment.replaceAll(":", "_")).join(":");
|
|
13555
|
+
const defaultDescription = `Custom command from ${path16.basename(filePath)}`;
|
|
14169
13556
|
let description = definition.description || defaultDescription;
|
|
14170
13557
|
if (extensionName) {
|
|
14171
13558
|
description = `[${extensionName}] ${description}`;
|
|
@@ -14201,7 +13588,7 @@ function createSlashCommandFromDefinition(filePath, baseDir, definition, extensi
|
|
|
14201
13588
|
whenToUse: definition.whenToUse,
|
|
14202
13589
|
action: /* @__PURE__ */ __name(async (context, _args) => {
|
|
14203
13590
|
if (!context.invocation) {
|
|
14204
|
-
|
|
13591
|
+
debugLogger14.error(
|
|
14205
13592
|
`[FileCommandLoader] Critical error: Command '${baseCommandName}' was executed without invocation context.`
|
|
14206
13593
|
);
|
|
14207
13594
|
return {
|
|
@@ -14239,7 +13626,7 @@ function createSlashCommandFromDefinition(filePath, baseDir, definition, extensi
|
|
|
14239
13626
|
__name(createSlashCommandFromDefinition, "createSlashCommandFromDefinition");
|
|
14240
13627
|
|
|
14241
13628
|
// packages/cli/src/services/FileCommandLoader.ts
|
|
14242
|
-
var
|
|
13629
|
+
var debugLogger15 = createDebugLogger("FILE_COMMAND_LOADER");
|
|
14243
13630
|
var TomlCommandDefSchema = external_exports.object({
|
|
14244
13631
|
prompt: external_exports.string({
|
|
14245
13632
|
required_error: "The 'prompt' field is required.",
|
|
@@ -14273,7 +13660,7 @@ var FileCommandLoader = class {
|
|
|
14273
13660
|
*/
|
|
14274
13661
|
async loadCommands(signal) {
|
|
14275
13662
|
if (this.config?.getBareMode?.()) {
|
|
14276
|
-
|
|
13663
|
+
debugLogger15.debug("Bare mode enabled, skipping auto-discovered commands");
|
|
14277
13664
|
return [];
|
|
14278
13665
|
}
|
|
14279
13666
|
const allCommands = [];
|
|
@@ -14299,14 +13686,14 @@ var FileCommandLoader = class {
|
|
|
14299
13686
|
}
|
|
14300
13687
|
const tomlCommandPromises = tomlFiles.map(
|
|
14301
13688
|
(file) => this.parseAndAdaptTomlFile(
|
|
14302
|
-
|
|
13689
|
+
path17.join(dirInfo.path, file),
|
|
14303
13690
|
dirInfo.path,
|
|
14304
13691
|
dirInfo.extensionName
|
|
14305
13692
|
)
|
|
14306
13693
|
);
|
|
14307
13694
|
const mdCommandPromises = mdFiles.map(
|
|
14308
13695
|
(file) => this.parseAndAdaptMarkdownFile(
|
|
14309
|
-
|
|
13696
|
+
path17.join(dirInfo.path, file),
|
|
14310
13697
|
dirInfo.path,
|
|
14311
13698
|
dirInfo.extensionName
|
|
14312
13699
|
)
|
|
@@ -14317,7 +13704,7 @@ var FileCommandLoader = class {
|
|
|
14317
13704
|
const isEnoent = error.code === "ENOENT";
|
|
14318
13705
|
const isAbortError = error instanceof Error && error.name === "AbortError";
|
|
14319
13706
|
if (!isEnoent && !isAbortError) {
|
|
14320
|
-
|
|
13707
|
+
debugLogger15.error(
|
|
14321
13708
|
`[FileCommandLoader] Error loading commands from ${dirInfo.path}:`,
|
|
14322
13709
|
error
|
|
14323
13710
|
);
|
|
@@ -14356,14 +13743,14 @@ var FileCommandLoader = class {
|
|
|
14356
13743
|
*/
|
|
14357
13744
|
getExtensionCommandsPaths(ext) {
|
|
14358
13745
|
try {
|
|
14359
|
-
const configPath =
|
|
13746
|
+
const configPath = path17.join(ext.path, EXTENSIONS_CONFIG_FILENAME);
|
|
14360
13747
|
if (fsSync.existsSync(configPath)) {
|
|
14361
13748
|
const configContent = fsSync.readFileSync(configPath, "utf-8");
|
|
14362
13749
|
const config = JSON.parse(configContent);
|
|
14363
13750
|
if (config.commands) {
|
|
14364
13751
|
const commandsArray = Array.isArray(config.commands) ? config.commands : [config.commands];
|
|
14365
13752
|
return commandsArray.map(
|
|
14366
|
-
(cmdPath) =>
|
|
13753
|
+
(cmdPath) => path17.isAbsolute(cmdPath) ? cmdPath : path17.join(ext.path, cmdPath)
|
|
14367
13754
|
).filter((cmdPath) => {
|
|
14368
13755
|
try {
|
|
14369
13756
|
return fsSync.existsSync(cmdPath);
|
|
@@ -14374,12 +13761,12 @@ var FileCommandLoader = class {
|
|
|
14374
13761
|
}
|
|
14375
13762
|
}
|
|
14376
13763
|
} catch (error) {
|
|
14377
|
-
|
|
13764
|
+
debugLogger15.warn(
|
|
14378
13765
|
`Failed to read extension config for ${ext.name}:`,
|
|
14379
13766
|
error
|
|
14380
13767
|
);
|
|
14381
13768
|
}
|
|
14382
|
-
const defaultPath =
|
|
13769
|
+
const defaultPath = path17.join(ext.path, "commands");
|
|
14383
13770
|
try {
|
|
14384
13771
|
if (fsSync.existsSync(defaultPath)) {
|
|
14385
13772
|
return [defaultPath];
|
|
@@ -14398,9 +13785,9 @@ var FileCommandLoader = class {
|
|
|
14398
13785
|
async parseAndAdaptTomlFile(filePath, baseDir, extensionName) {
|
|
14399
13786
|
let fileContent;
|
|
14400
13787
|
try {
|
|
14401
|
-
fileContent = await
|
|
13788
|
+
fileContent = await fs13.readFile(filePath, "utf-8");
|
|
14402
13789
|
} catch (error) {
|
|
14403
|
-
|
|
13790
|
+
debugLogger15.error(
|
|
14404
13791
|
`[FileCommandLoader] Failed to read file ${filePath}:`,
|
|
14405
13792
|
error instanceof Error ? error.message : String(error)
|
|
14406
13793
|
);
|
|
@@ -14410,7 +13797,7 @@ var FileCommandLoader = class {
|
|
|
14410
13797
|
try {
|
|
14411
13798
|
parsed = import_toml.default.parse(fileContent);
|
|
14412
13799
|
} catch (error) {
|
|
14413
|
-
|
|
13800
|
+
debugLogger15.error(
|
|
14414
13801
|
`[FileCommandLoader] Failed to parse TOML file ${filePath}:`,
|
|
14415
13802
|
error instanceof Error ? error.message : String(error)
|
|
14416
13803
|
);
|
|
@@ -14418,7 +13805,7 @@ var FileCommandLoader = class {
|
|
|
14418
13805
|
}
|
|
14419
13806
|
const validationResult = TomlCommandDefSchema.safeParse(parsed);
|
|
14420
13807
|
if (!validationResult.success) {
|
|
14421
|
-
|
|
13808
|
+
debugLogger15.error(
|
|
14422
13809
|
`[FileCommandLoader] Skipping invalid command file: ${filePath}. Validation errors:`,
|
|
14423
13810
|
validationResult.error.flatten()
|
|
14424
13811
|
);
|
|
@@ -14443,9 +13830,9 @@ var FileCommandLoader = class {
|
|
|
14443
13830
|
async parseAndAdaptMarkdownFile(filePath, baseDir, extensionName) {
|
|
14444
13831
|
let fileContent;
|
|
14445
13832
|
try {
|
|
14446
|
-
fileContent = await
|
|
13833
|
+
fileContent = await fs13.readFile(filePath, "utf-8");
|
|
14447
13834
|
} catch (error) {
|
|
14448
|
-
|
|
13835
|
+
debugLogger15.error(
|
|
14449
13836
|
`[FileCommandLoader] Failed to read file ${filePath}:`,
|
|
14450
13837
|
error instanceof Error ? error.message : String(error)
|
|
14451
13838
|
);
|
|
@@ -14455,7 +13842,7 @@ var FileCommandLoader = class {
|
|
|
14455
13842
|
try {
|
|
14456
13843
|
parsed = parseMarkdownCommand(fileContent);
|
|
14457
13844
|
} catch (error) {
|
|
14458
|
-
|
|
13845
|
+
debugLogger15.error(
|
|
14459
13846
|
`[FileCommandLoader] Failed to parse Markdown file ${filePath}:`,
|
|
14460
13847
|
error instanceof Error ? error.message : String(error)
|
|
14461
13848
|
);
|
|
@@ -14463,7 +13850,7 @@ var FileCommandLoader = class {
|
|
|
14463
13850
|
}
|
|
14464
13851
|
const validationResult = MarkdownCommandDefSchema.safeParse(parsed);
|
|
14465
13852
|
if (!validationResult.success) {
|
|
14466
|
-
|
|
13853
|
+
debugLogger15.error(
|
|
14467
13854
|
`[FileCommandLoader] Skipping invalid command file: ${filePath}. Validation errors:`,
|
|
14468
13855
|
validationResult.error.flatten()
|
|
14469
13856
|
);
|
|
@@ -14489,7 +13876,7 @@ var FileCommandLoader = class {
|
|
|
14489
13876
|
|
|
14490
13877
|
// packages/cli/src/services/saved-workflow-loader.ts
|
|
14491
13878
|
init_esbuild_shims();
|
|
14492
|
-
var
|
|
13879
|
+
var debugLogger16 = createDebugLogger("SavedWorkflowLoader");
|
|
14493
13880
|
var SavedWorkflowLoader = class {
|
|
14494
13881
|
constructor(config) {
|
|
14495
13882
|
this.config = config;
|
|
@@ -14508,7 +13895,7 @@ var SavedWorkflowLoader = class {
|
|
|
14508
13895
|
try {
|
|
14509
13896
|
entries = await listSavedWorkflows(this.config);
|
|
14510
13897
|
} catch (e) {
|
|
14511
|
-
|
|
13898
|
+
debugLogger16.debug(`listSavedWorkflows failed: ${e}`);
|
|
14512
13899
|
return [];
|
|
14513
13900
|
}
|
|
14514
13901
|
if (signal.aborted) return [];
|
|
@@ -14805,8 +14192,8 @@ var McpPromptLoader = class {
|
|
|
14805
14192
|
|
|
14806
14193
|
// packages/cli/src/services/SkillCommandLoader.ts
|
|
14807
14194
|
init_esbuild_shims();
|
|
14808
|
-
import { dirname as
|
|
14809
|
-
var
|
|
14195
|
+
import { dirname as dirname3 } from "node:path";
|
|
14196
|
+
var debugLogger17 = createDebugLogger("SKILL_COMMAND_LOADER");
|
|
14810
14197
|
var SkillCommandLoader = class {
|
|
14811
14198
|
constructor(config) {
|
|
14812
14199
|
this.config = config;
|
|
@@ -14816,12 +14203,12 @@ var SkillCommandLoader = class {
|
|
|
14816
14203
|
}
|
|
14817
14204
|
async loadCommands(_signal) {
|
|
14818
14205
|
if (this.config?.getBareMode?.()) {
|
|
14819
|
-
|
|
14206
|
+
debugLogger17.debug("Bare mode enabled, skipping skill commands");
|
|
14820
14207
|
return [];
|
|
14821
14208
|
}
|
|
14822
14209
|
const skillManager = this.config?.getSkillManager();
|
|
14823
14210
|
if (!skillManager) {
|
|
14824
|
-
|
|
14211
|
+
debugLogger17.debug("SkillManager not available, skipping skill commands");
|
|
14825
14212
|
return [];
|
|
14826
14213
|
}
|
|
14827
14214
|
try {
|
|
@@ -14838,7 +14225,7 @@ var SkillCommandLoader = class {
|
|
|
14838
14225
|
const nonUserInvocableCount = visibleSkills.filter(
|
|
14839
14226
|
(skill) => skill.userInvocable === false
|
|
14840
14227
|
).length;
|
|
14841
|
-
|
|
14228
|
+
debugLogger17.debug(
|
|
14842
14229
|
`Loaded ${userSkills.length} user + ${projectSkills.length} project + ${extensionSkills.length} extension skill(s) as slash commands; ${allSkills.length - visibleSkills.length} hidden by skills.disabled; ${nonUserInvocableCount} marked non-user-invocable`
|
|
14843
14230
|
);
|
|
14844
14231
|
return visibleSkills.map((skill) => {
|
|
@@ -14869,7 +14256,7 @@ var SkillCommandLoader = class {
|
|
|
14869
14256
|
skill.allowedTools
|
|
14870
14257
|
);
|
|
14871
14258
|
const body = buildSkillLlmContent(
|
|
14872
|
-
|
|
14259
|
+
dirname3(skill.filePath),
|
|
14873
14260
|
skill.body
|
|
14874
14261
|
);
|
|
14875
14262
|
const content = context.invocation?.args ? appendToLastTextPart([{ text: body }], context.invocation.raw) : [{ text: body }];
|
|
@@ -14881,7 +14268,7 @@ var SkillCommandLoader = class {
|
|
|
14881
14268
|
};
|
|
14882
14269
|
});
|
|
14883
14270
|
} catch (error) {
|
|
14884
|
-
|
|
14271
|
+
debugLogger17.error("Failed to load skill commands:", error);
|
|
14885
14272
|
return [];
|
|
14886
14273
|
}
|
|
14887
14274
|
}
|
|
@@ -14956,7 +14343,7 @@ function formatUserPromptExpansionBlockedMessage(reason) {
|
|
|
14956
14343
|
__name(formatUserPromptExpansionBlockedMessage, "formatUserPromptExpansionBlockedMessage");
|
|
14957
14344
|
|
|
14958
14345
|
// packages/cli/src/nonInteractiveCliCommands.ts
|
|
14959
|
-
var
|
|
14346
|
+
var debugLogger18 = createDebugLogger("NON_INTERACTIVE_COMMANDS");
|
|
14960
14347
|
function getSkillCommandName(command) {
|
|
14961
14348
|
return command.skillDetail?.name ?? command.name;
|
|
14962
14349
|
}
|
|
@@ -15167,6 +14554,60 @@ var handleSlashCommand = /* @__PURE__ */ __name(async (rawQuery, abortController
|
|
|
15167
14554
|
rawQuery,
|
|
15168
14555
|
filteredCommands
|
|
15169
14556
|
);
|
|
14557
|
+
const stackedResult = parseStackedSlashCommands(rawQuery, filteredCommands);
|
|
14558
|
+
if (stackedResult.skills.length >= 2) {
|
|
14559
|
+
const combinedContent = [];
|
|
14560
|
+
let firstModelOverride;
|
|
14561
|
+
const onCompleteCallbacks = [];
|
|
14562
|
+
for (const skill of stackedResult.skills) {
|
|
14563
|
+
if (!skill.action) continue;
|
|
14564
|
+
const skillContext = {
|
|
14565
|
+
executionMode,
|
|
14566
|
+
invocation: {
|
|
14567
|
+
raw: `/${skill.name}`,
|
|
14568
|
+
name: skill.name,
|
|
14569
|
+
args: ""
|
|
14570
|
+
},
|
|
14571
|
+
services: { config, settings, logger: null }
|
|
14572
|
+
};
|
|
14573
|
+
const skillResult = await skill.action(skillContext, "");
|
|
14574
|
+
if (skillResult?.type === "submit_prompt") {
|
|
14575
|
+
combinedContent.push(skillResult.content);
|
|
14576
|
+
firstModelOverride ??= skillResult.modelOverride;
|
|
14577
|
+
if (skillResult.onComplete) {
|
|
14578
|
+
onCompleteCallbacks.push(skillResult.onComplete);
|
|
14579
|
+
}
|
|
14580
|
+
}
|
|
14581
|
+
recordSkillInvocation(config, {
|
|
14582
|
+
skillName: getSkillCommandName(skill),
|
|
14583
|
+
success: skillResult?.type === "submit_prompt"
|
|
14584
|
+
});
|
|
14585
|
+
}
|
|
14586
|
+
if (stackedResult.remainingText) {
|
|
14587
|
+
combinedContent.push([{ text: stackedResult.remainingText }]);
|
|
14588
|
+
}
|
|
14589
|
+
const mergedContent = combinedContent.flat();
|
|
14590
|
+
const hookResult = await fireUserPromptExpansionHook(
|
|
14591
|
+
config,
|
|
14592
|
+
stackedResult.skills.map((s) => s.name).join(" "),
|
|
14593
|
+
stackedResult.remainingText,
|
|
14594
|
+
mergedContent,
|
|
14595
|
+
abortController.signal
|
|
14596
|
+
);
|
|
14597
|
+
if (hookResult.blockedResult) {
|
|
14598
|
+
return hookResult.blockedResult;
|
|
14599
|
+
}
|
|
14600
|
+
return {
|
|
14601
|
+
type: "submit_prompt",
|
|
14602
|
+
content: hookResult.content,
|
|
14603
|
+
...firstModelOverride ? { modelOverride: firstModelOverride } : {},
|
|
14604
|
+
...onCompleteCallbacks.length ? {
|
|
14605
|
+
onComplete: /* @__PURE__ */ __name(async () => {
|
|
14606
|
+
for (const cb of onCompleteCallbacks) await cb();
|
|
14607
|
+
}, "onComplete")
|
|
14608
|
+
} : {}
|
|
14609
|
+
};
|
|
14610
|
+
}
|
|
15170
14611
|
if (!commandToExecute) {
|
|
15171
14612
|
const { commandToExecute: knownCommand } = parseSlashCommand(
|
|
15172
14613
|
rawQuery,
|
|
@@ -15305,14 +14746,14 @@ var getAvailableCommands = /* @__PURE__ */ __name(async (config, abortSignal, mo
|
|
|
15305
14746
|
);
|
|
15306
14747
|
return commandService.getCommandsForMode(mode);
|
|
15307
14748
|
} catch (error) {
|
|
15308
|
-
|
|
14749
|
+
debugLogger18.error("Error loading available commands:", error);
|
|
15309
14750
|
return [];
|
|
15310
14751
|
}
|
|
15311
14752
|
}, "getAvailableCommands");
|
|
15312
14753
|
|
|
15313
14754
|
// packages/cli/src/utils/nonInteractiveHelpers.ts
|
|
15314
14755
|
init_esbuild_shims();
|
|
15315
|
-
var
|
|
14756
|
+
var debugLogger19 = createDebugLogger("NON_INTERACTIVE");
|
|
15316
14757
|
function normalizePartList(parts) {
|
|
15317
14758
|
if (!parts) {
|
|
15318
14759
|
return [];
|
|
@@ -15410,7 +14851,7 @@ async function loadSlashCommandNames(config) {
|
|
|
15410
14851
|
);
|
|
15411
14852
|
return commands.map((cmd) => cmd.name).sort();
|
|
15412
14853
|
} catch (error) {
|
|
15413
|
-
|
|
14854
|
+
debugLogger19.error(
|
|
15414
14855
|
"[buildSystemMessage] Failed to load slash commands:",
|
|
15415
14856
|
error
|
|
15416
14857
|
);
|
|
@@ -15435,7 +14876,7 @@ async function buildSystemMessage(config, sessionId, permissionMode) {
|
|
|
15435
14876
|
const subagents = await subagentManager.listSubagents();
|
|
15436
14877
|
agentNames = subagents.map((subagent) => subagent.name);
|
|
15437
14878
|
} catch (error) {
|
|
15438
|
-
|
|
14879
|
+
debugLogger19.error("[buildSystemMessage] Failed to load subagents:", error);
|
|
15439
14880
|
}
|
|
15440
14881
|
const systemMessage = {
|
|
15441
14882
|
type: "system",
|
|
@@ -15596,7 +15037,9 @@ function functionResponsePartsToString(parts) {
|
|
|
15596
15037
|
__name(functionResponsePartsToString, "functionResponsePartsToString");
|
|
15597
15038
|
|
|
15598
15039
|
export {
|
|
15040
|
+
MAX_STACKED_SKILLS,
|
|
15599
15041
|
parseSlashCommand,
|
|
15042
|
+
parseStackedSlashCommands,
|
|
15600
15043
|
CommandService,
|
|
15601
15044
|
useAutoAcceptIndicator,
|
|
15602
15045
|
formatApprovalModeName,
|
|
@@ -15611,8 +15054,6 @@ export {
|
|
|
15611
15054
|
findMidInputSlashCommand,
|
|
15612
15055
|
getBestSlashCommandMatch,
|
|
15613
15056
|
findSlashCommandTokens,
|
|
15614
|
-
performStandaloneUpdate,
|
|
15615
|
-
getInstallationInfo,
|
|
15616
15057
|
recordGoalStatusItem,
|
|
15617
15058
|
restoreGoalFromHistory,
|
|
15618
15059
|
getTranslatedSourceDisplayMap,
|
|
@@ -15621,6 +15062,7 @@ export {
|
|
|
15621
15062
|
createEmptyHookEventInfo,
|
|
15622
15063
|
addConfigToMatcherGroup,
|
|
15623
15064
|
getAllConfigs,
|
|
15065
|
+
refreshExtensionContentRuntime,
|
|
15624
15066
|
BuiltinCommandLoader,
|
|
15625
15067
|
BundledSkillLoader,
|
|
15626
15068
|
FileCommandLoader,
|