@zubriq/code 0.19.8-2 → 0.19.9-2

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.
Files changed (245) hide show
  1. package/README.md +5 -1
  2. package/dist/README.md +5 -1
  3. package/dist/bundled/qc-helper/docs/features/channels/_meta.ts +1 -0
  4. package/dist/bundled/qc-helper/docs/features/channels/overview.md +23 -12
  5. package/dist/bundled/qc-helper/docs/features/channels/plugins.md +1 -0
  6. package/dist/bundled/qc-helper/docs/features/channels/wecom.md +111 -0
  7. package/dist/bundled/qc-helper/docs/features/hooks.md +36 -34
  8. package/dist/bundled/qc-helper/docs/features/memory.md +1 -1
  9. package/dist/bundled/qc-helper/docs/qwen-serve.md +17 -10
  10. package/dist/bundled/review/SKILL.md +6 -2
  11. package/dist/chunks/{MaxSizedBox-DTQF2MAY.js → MaxSizedBox-DAULPOB3.js} +13 -11
  12. package/dist/chunks/{StandaloneSessionPicker-XYO5V6IL.js → StandaloneSessionPicker-5Z7LVQ7F.js} +28 -23
  13. package/dist/chunks/{acpAgent-STMSDYGP.js → acpAgent-7JXXVE6B.js} +110 -80
  14. package/dist/chunks/{agent-C6YBZNSA.js → agent-S52M66XP.js} +8 -8
  15. package/dist/chunks/{agent-headless-65TQRHOY.js → agent-headless-47CB7RWZ.js} +8 -8
  16. package/dist/chunks/{anthropicContentGenerator-FZQAEMYK.js → anthropicContentGenerator-52G6ZA3D.js} +31 -4
  17. package/dist/chunks/{artifact-tool-H2TNPNP5.js → artifact-tool-D233YJFH.js} +25 -6
  18. package/dist/chunks/{bridge-GHGQNQRB.js → bridge-O6CZID6W.js} +17 -14
  19. package/dist/chunks/{ca-HCMB2I54.js → ca-MKD32FQL.js} +26 -1
  20. package/dist/chunks/{channel-worker-supervisor-B7MSMB5K.js → channel-worker-supervisor-NZQUOEFJ.js} +3 -3
  21. package/dist/chunks/{chunk-ZCMLUE4O.js → chunk-27A4SPWJ.js} +1 -1
  22. package/dist/chunks/{chunk-O3DVJ2JO.js → chunk-2DFYBHN4.js} +507 -64
  23. package/dist/chunks/{chunk-3SBUWSLI.js → chunk-2KQ42WGR.js} +2 -2
  24. package/dist/chunks/{chunk-PADAEB6D.js → chunk-2MZ4AYIT.js} +308 -81
  25. package/dist/chunks/chunk-332PWN27.js +19 -0
  26. package/dist/chunks/{chunk-FVMWEHWU.js → chunk-3B26UVCX.js} +114 -12
  27. package/dist/chunks/{chunk-W6RH6KHR.js → chunk-3GPVYALM.js} +4 -2
  28. package/dist/chunks/{chunk-SVK2TREP.js → chunk-3KV2TYC4.js} +1 -1
  29. package/dist/chunks/{chunk-G7ZG7CA6.js → chunk-3UP777ZS.js} +8 -7
  30. package/dist/chunks/{chunk-TYOF23VK.js → chunk-43W4YSO6.js} +1 -12
  31. package/dist/chunks/{chunk-3Y2SRVRF.js → chunk-4S7YIVL6.js} +3 -3
  32. package/dist/chunks/{chunk-VEB3NYSO.js → chunk-5MBO76SL.js} +5 -0
  33. package/dist/chunks/{chunk-6N76CE6T.js → chunk-65GWYZCU.js} +10 -5
  34. package/dist/chunks/{chunk-Z3VQSA4A.js → chunk-67JZ37FW.js} +1 -1
  35. package/dist/chunks/{chunk-FACTYQFS.js → chunk-72AW57IS.js} +5352 -4135
  36. package/dist/chunks/chunk-A2X3KLC3.js +3807 -0
  37. package/dist/chunks/chunk-A7JD2K4Z.js +28 -0
  38. package/dist/chunks/{chunk-3CRBBLJZ.js → chunk-BAC5H5F4.js} +9 -9
  39. package/dist/chunks/{chunk-46IFEQDM.js → chunk-BIO6D3EL.js} +1 -1
  40. package/dist/chunks/chunk-BLNH4ALH.js +283 -0
  41. package/dist/chunks/{chunk-GXQXFHYV.js → chunk-CBYHA7QC.js} +1 -1
  42. package/dist/chunks/{chunk-NCFY7PWS.js → chunk-CCGOFQV3.js} +51 -2
  43. package/dist/chunks/{chunk-66KNL43D.js → chunk-CD6USWHZ.js} +1 -1
  44. package/dist/chunks/{chunk-J6GMF2DO.js → chunk-CJGGW5FV.js} +66 -7
  45. package/dist/chunks/{chunk-LLVYPOQV.js → chunk-COUVVSMO.js} +2 -2
  46. package/dist/chunks/{chunk-A6XKBVOM.js → chunk-EHLC565U.js} +11 -11
  47. package/dist/chunks/{chunk-VKWGD42I.js → chunk-EKPIW37S.js} +10 -10
  48. package/dist/chunks/{chunk-DNV4FSN5.js → chunk-FBET5XZ2.js} +6 -4
  49. package/dist/chunks/{chunk-UMU5USBC.js → chunk-FNQ4NTFR.js} +14 -153
  50. package/dist/chunks/{chunk-2NL7ED5Q.js → chunk-FV7425LN.js} +22 -1
  51. package/dist/chunks/{chunk-6UBX2BIL.js → chunk-G2XMNE5I.js} +4 -4
  52. package/dist/chunks/{chunk-B34OV7K2.js → chunk-GGQQA4JW.js} +13 -0
  53. package/dist/chunks/chunk-GLE2YUPU.js +34 -0
  54. package/dist/chunks/{chunk-X265R5C6.js → chunk-GN3F6PIU.js} +1 -1
  55. package/dist/chunks/{chunk-TJS7CXNX.js → chunk-HY7JTIS2.js} +5 -5
  56. package/dist/chunks/{chunk-WSVZFWN4.js → chunk-IBY3Q3HG.js} +693 -104
  57. package/dist/chunks/{chunk-VEDR5V7H.js → chunk-ITIH3WEE.js} +8 -8
  58. package/dist/chunks/chunk-JGT7AZCW.js +168 -0
  59. package/dist/chunks/{chunk-PY6PG4BL.js → chunk-K6VOOZB4.js} +6 -5
  60. package/dist/chunks/chunk-LGFAYIKX.js +115 -0
  61. package/dist/chunks/chunk-LOJIM7ZB.js +487 -0
  62. package/dist/chunks/{chunk-FT5ASRN5.js → chunk-LRKOXGF6.js} +5 -5
  63. package/dist/chunks/{chunk-AXYGF5SX.js → chunk-LSB7QUTQ.js} +15 -9
  64. package/dist/chunks/{chunk-QUR23Z2Q.js → chunk-M6F3JCGI.js} +2 -2
  65. package/dist/chunks/{chunk-DH7XPKJV.js → chunk-MCAFUCA2.js} +5 -5
  66. package/dist/chunks/{chunk-SWHGVEH5.js → chunk-O2JNBKLL.js} +1 -1
  67. package/dist/chunks/{chunk-4RQIB5UZ.js → chunk-O2YT7VB4.js} +0 -34
  68. package/dist/chunks/{chunk-4KJ2BPIT.js → chunk-OACJLMLD.js} +2 -38
  69. package/dist/chunks/{chunk-VQZSRYKB.js → chunk-OFGYDQPN.js} +423 -61
  70. package/dist/chunks/{chunk-5XZ6FOTY.js → chunk-ONGYTDFO.js} +1 -1
  71. package/dist/chunks/{chunk-RTCBBRJK.js → chunk-PBLEEGVC.js} +20 -8
  72. package/dist/chunks/{chunk-4KMU5RWV.js → chunk-PJWMYPWC.js} +45 -9
  73. package/dist/chunks/{chunk-65A6UQDZ.js → chunk-QGNRRKJJ.js} +146 -54
  74. package/dist/chunks/{chunk-GSNACUDM.js → chunk-RBXWE376.js} +5 -13
  75. package/dist/chunks/{chunk-COPJASIO.js → chunk-RRI2ZIIA.js} +10 -10
  76. package/dist/chunks/{chunk-GKUVMLJH.js → chunk-RVBG4B2L.js} +3 -3
  77. package/dist/chunks/{chunk-KSPVDFE4.js → chunk-SAIILPQ3.js} +0 -3
  78. package/dist/chunks/{chunk-AKSRZ5BA.js → chunk-SBP3QB6S.js} +17 -111
  79. package/dist/chunks/{chunk-P42OA4GP.js → chunk-TBV35OBU.js} +14 -8
  80. package/dist/chunks/{chunk-HXVVCTID.js → chunk-TWKTKDO7.js} +1 -1
  81. package/dist/chunks/chunk-U3BZFGXZ.js +167 -0
  82. package/dist/chunks/chunk-UIDXQNMV.js +13 -0
  83. package/dist/chunks/{chunk-PIORL4OD.js → chunk-UKV3D7WB.js} +0 -44
  84. package/dist/chunks/{chunk-23TH7TAA.js → chunk-UNP2RK7B.js} +2 -2
  85. package/dist/chunks/{chunk-AGTU5PQ6.js → chunk-UWRIDCTO.js} +4 -4
  86. package/dist/chunks/chunk-V35MD7KN.js +13 -0
  87. package/dist/chunks/{chunk-OMO3UY57.js → chunk-VFGM47DK.js} +681 -1232
  88. package/dist/chunks/{chunk-PMMJS5AM.js → chunk-X4BBHJZ3.js} +4 -3
  89. package/dist/chunks/chunk-XMQOLL5Z.js +8223 -0
  90. package/dist/chunks/chunk-XNXVCNAT.js +88 -0
  91. package/dist/chunks/{chunk-TDGF35EN.js → chunk-XOHNA2S6.js} +1 -1
  92. package/dist/chunks/{chunk-PYWGOON5.js → chunk-XPS3UH2D.js} +1 -1
  93. package/dist/chunks/chunk-YBRZ3S2C.js +942 -0
  94. package/dist/chunks/{chunk-RFIL6REB.js → chunk-YKZIAK7C.js} +119 -29
  95. package/dist/chunks/{chunk-7SZJYZPR.js → chunk-YWRV5OJX.js} +92 -465
  96. package/dist/chunks/chunk-Z3I3QJK3.js +47 -0
  97. package/dist/chunks/{chunk-Z33V6JSK.js → chunk-ZF7UGIJ2.js} +1 -1
  98. package/dist/chunks/chunk-ZL5HN75Q.js +61 -0
  99. package/dist/chunks/{computer-use-BH6F7LI7.js → computer-use-AK2MPP4V.js} +8 -8
  100. package/dist/chunks/{contextCommand-URWDQXBJ.js → contextCommand-XXYJTFCX.js} +12 -11
  101. package/dist/chunks/{cron-create-DDYU4DIR.js → cron-create-JSXEIPVS.js} +1 -1
  102. package/dist/chunks/{cron-delete-DFKOUZWN.js → cron-delete-OIFVEPGU.js} +1 -1
  103. package/dist/chunks/{cron-list-ME5QGAR5.js → cron-list-D4ZX4IOE.js} +1 -1
  104. package/dist/chunks/{daemon-XWG2EGFX.js → daemon-WPAENEBW.js} +71 -3
  105. package/dist/chunks/{daemon-status-provider-CLNN2UY2.js → daemon-status-provider-DOBLLAUR.js} +20 -17
  106. package/dist/chunks/{de-PLLFDERI.js → de-ZFPPQVSF.js} +26 -1
  107. package/dist/chunks/{dist-LPVU3L2M.js → dist-BEXOZXLQ.js} +6 -3792
  108. package/dist/chunks/{dist-7GU63KI5.js → dist-E6UANPIM.js} +1 -1
  109. package/dist/chunks/{dist-VHBP2PIG.js → dist-H2AEJCZ5.js} +2 -2
  110. package/dist/chunks/{dist-3UDX5T4T.js → dist-O2IRTRPP.js} +1 -1
  111. package/dist/chunks/dist-SCFLLYMK.js +3217 -0
  112. package/dist/chunks/{dist-H4HHZYCI.js → dist-Z34QPAQW.js} +2 -2
  113. package/dist/chunks/{earlyInputCapture-SFINSVH2.js → earlyInputCapture-QX7FKEPY.js} +8 -8
  114. package/dist/chunks/{edit-5OJRPFGZ.js → edit-MNTA2GNC.js} +9 -9
  115. package/dist/chunks/{en-AXARKOWO.js → en-N4EPZAQI.js} +31 -2
  116. package/dist/chunks/{enter-worktree-HK54JBSR.js → enter-worktree-WAG3SZ2O.js} +8 -8
  117. package/dist/chunks/{enterPlanMode-5GXOH5PQ.js → enterPlanMode-THDBOOSG.js} +8 -8
  118. package/dist/chunks/environment-AE6MZDKE.js +90 -0
  119. package/dist/chunks/{errors-73SZF7O7.js → errors-ITLDJFFZ.js} +10 -10
  120. package/dist/chunks/{exit-worktree-CBX23VFX.js → exit-worktree-ENFBD2E5.js} +8 -8
  121. package/dist/chunks/{exitPlanMode-HADS7AAV.js → exitPlanMode-HOSNRC22.js} +8 -8
  122. package/dist/chunks/{fast-path-3QQW3W6W.js → fast-path-CDB4XPSL.js} +12 -3
  123. package/dist/chunks/{fast-path-settings-RCRXH2JG.js → fast-path-settings-7RIFI3PK.js} +3 -2
  124. package/dist/chunks/{fr-MBMNQSQ6.js → fr-5WWMY53B.js} +30 -1
  125. package/dist/chunks/{gemini-Q4KKJMFH.js → gemini-DR4ABGLP.js} +438 -265
  126. package/dist/chunks/{geminiContentGenerator-SBKWTYFU.js → geminiContentGenerator-GGRSUJG6.js} +1 -1
  127. package/dist/chunks/{glob-ORVXVDJJ.js → glob-S3ESYOFY.js} +8 -8
  128. package/dist/chunks/{grep-TMSN6VOF.js → grep-WVRBUHNE.js} +8 -8
  129. package/dist/chunks/handleAutoUpdate-K73DXUO2.js +65 -0
  130. package/dist/chunks/{initializer-NFO725XQ.js → initializer-O2E3RKOG.js} +17 -13
  131. package/dist/chunks/{ja-HFV5QCHR.js → ja-CUHZOLEJ.js} +30 -1
  132. package/dist/chunks/{list-NP6QTWKD.js → list-7HRANYR2.js} +17 -15
  133. package/dist/chunks/{loadedSettingsAdapter-5PXZC4ZO.js → loadedSettingsAdapter-DC3DUNGS.js} +15 -13
  134. package/dist/chunks/{loop-wakeup-ZW5P6VPY.js → loop-wakeup-OHWEMFP5.js} +2 -2
  135. package/dist/chunks/{ls-L654WOAT.js → ls-7MFU2QYW.js} +1 -1
  136. package/dist/chunks/{lsp-M35KE54Y.js → lsp-XHDTPTGV.js} +2 -4
  137. package/dist/chunks/{mcp-D3C75I47.js → mcp-T676RK3N.js} +15 -13
  138. package/dist/chunks/{monitor-YZFSN33Z.js → monitor-NDBNCHYZ.js} +16 -11
  139. package/dist/chunks/{nonInteractiveCli-U7ZDVLQD.js → nonInteractiveCli-TMB4TLML.js} +52 -44
  140. package/dist/chunks/{notebook-edit-LVCCTW65.js → notebook-edit-XNEWNIID.js} +9 -9
  141. package/dist/chunks/{openaiContentGenerator-G4JHCIGX.js → openaiContentGenerator-2GGVNH4J.js} +6 -6
  142. package/dist/chunks/{pidfile-O37JZBNN.js → pidfile-U6U3KDMU.js} +8 -8
  143. package/dist/chunks/{pt-2THT3YHA.js → pt-OLYN42DS.js} +26 -1
  144. package/dist/chunks/{qwenContentGenerator-SPHKYVJF.js → qwenContentGenerator-FZR3VYQW.js} +10 -10
  145. package/dist/chunks/{read-file-MBGSR77H.js → read-file-2P3MNXBM.js} +3 -3
  146. package/dist/chunks/{record-artifact-PP3LKHTS.js → record-artifact-SQ2OKRJW.js} +3 -3
  147. package/dist/chunks/{ripGrep-WMM4G6QB.js → ripGrep-W5DKLIC2.js} +8 -8
  148. package/dist/chunks/{ru-PER5I4OI.js → ru-MKM2HFDS.js} +26 -1
  149. package/dist/chunks/{run-qwen-serve-3BOGJBTS.js → run-qwen-serve-FGGLFPLG.js} +602 -143
  150. package/dist/chunks/{scheduler-KWPXUSJ4.js → scheduler-CTJIZOWI.js} +8 -8
  151. package/dist/chunks/{send-message-OA6MV4EU.js → send-message-76GT3JMC.js} +1 -1
  152. package/dist/chunks/{serve-6JXYVZRD.js → serve-2OBCBFXZ.js} +17 -14
  153. package/dist/chunks/{server-KOSHCREY.js → server-K5VEB225.js} +1394 -328
  154. package/dist/chunks/{session-5RI6JYZ6.js → session-7EVRNUXC.js} +53 -45
  155. package/dist/chunks/{settings-URS74H6Z.js → settings-7QGLUMUT.js} +24 -20
  156. package/dist/chunks/{shell-6VOD5NUH.js → shell-JSJCMSGS.js} +8 -8
  157. package/dist/chunks/{skill-MKIISOW7.js → skill-DSJPTMVO.js} +15 -5
  158. package/dist/chunks/{spawnChannel-GM7HIIDH.js → spawnChannel-ANPAH5LN.js} +10 -10
  159. package/dist/chunks/{src-X2S7YA5D.js → src-GMUN6GZG.js} +21 -9
  160. package/dist/chunks/{startInteractiveUI-REEHDN4Z.js → startInteractiveUI-ID2KOH7Z.js} +33759 -41620
  161. package/dist/chunks/{task-create-RPFZNB4B.js → task-create-WCHTB435.js} +2 -2
  162. package/dist/chunks/{task-update-5WUG5MVQ.js → task-update-XYWMHJGJ.js} +2 -2
  163. package/dist/chunks/{team-create-MQVOXIHZ.js → team-create-FNAI6F35.js} +8 -8
  164. package/dist/chunks/{team-plan-approval-H74NA3K2.js → team-plan-approval-GPAFPCI7.js} +8 -8
  165. package/dist/chunks/{theme-manager-YMC4EJQO.js → theme-manager-366AQFJU.js} +8 -8
  166. package/dist/chunks/{tool-search-VUJGWH7W.js → tool-search-GVSOY72G.js} +6 -23
  167. package/dist/chunks/total-session-admission-FUTVSIVT.js +72 -0
  168. package/dist/chunks/{trustedFolders-UMMVN4P2.js → trustedFolders-2J5VZVXS.js} +9 -9
  169. package/dist/chunks/updateCheck-BHMVBNNI.js +65 -0
  170. package/dist/chunks/{validateNonInterActiveAuth-ORA3KCZO.js → validateNonInterActiveAuth-6BNWQW3V.js} +49 -41
  171. package/dist/chunks/{version-II46VXNW.js → version-SI22TR43.js} +2 -1
  172. package/dist/chunks/{workflow-KYFPOWKK.js → workflow-EGCATP2M.js} +9 -9
  173. package/dist/chunks/{workspace-providers-status-QDQEYCHT.js → workspace-providers-status-NSB2VFSX.js} +18 -15
  174. package/dist/chunks/workspace-registry-B3YUZ2VM.js +74 -0
  175. package/dist/chunks/{workspace-service-YBVUOSP7.js → workspace-service-U23V3DKO.js} +21 -19
  176. package/dist/chunks/{workspace-skills-status-3ASS4VEE.js → workspace-skills-status-3OHN6C62.js} +16 -14
  177. package/dist/chunks/{write-file-7ZHZO4K5.js → write-file-YJHRI5NS.js} +9 -9
  178. package/dist/chunks/{zh-RS3HZHFH.js → zh-J4F6QWQV.js} +31 -2
  179. package/dist/chunks/{zh-TW-L5GRQ4S4.js → zh-TW-XVDWOLSW.js} +31 -2
  180. package/dist/cli.js +11 -11
  181. package/dist/locales/ca.js +30 -0
  182. package/dist/locales/de.js +30 -0
  183. package/dist/locales/en.js +38 -2
  184. package/dist/locales/fr.js +36 -0
  185. package/dist/locales/ja.js +36 -0
  186. package/dist/locales/pt.js +30 -0
  187. package/dist/locales/ru.js +30 -0
  188. package/dist/locales/zh-TW.js +38 -2
  189. package/dist/locales/zh.js +38 -2
  190. package/dist/package.json +3 -3
  191. package/dist/web-shell/assets/{arc-C6tzvtOa.js → arc-BWyoJpY2.js} +1 -1
  192. package/dist/web-shell/assets/{architectureDiagram-3BPJPVTR-DSYQFGn9.js → architectureDiagram-3BPJPVTR-BT0mGrz2.js} +1 -1
  193. package/dist/web-shell/assets/{blockDiagram-GPEHLZMM-CHjBdXAD.js → blockDiagram-GPEHLZMM-BLgUWvyf.js} +1 -1
  194. package/dist/web-shell/assets/{c4Diagram-AAUBKEIU-BQzK6Yyb.js → c4Diagram-AAUBKEIU-DYx9M7oU.js} +1 -1
  195. package/dist/web-shell/assets/channel-wmPUGHtg.js +1 -0
  196. package/dist/web-shell/assets/{chunk-2J33WTMH-hpP2p3Ij.js → chunk-2J33WTMH-CfMHWbuZ.js} +1 -1
  197. package/dist/web-shell/assets/{chunk-4BX2VUAB-B5KtK1JJ.js → chunk-4BX2VUAB-B1URoqEV.js} +1 -1
  198. package/dist/web-shell/assets/{chunk-55IACEB6-BDv6Mfr2.js → chunk-55IACEB6-DAIaM4QF.js} +1 -1
  199. package/dist/web-shell/assets/{chunk-727SXJPM-BevPWfrX.js → chunk-727SXJPM-B2X34knw.js} +1 -1
  200. package/dist/web-shell/assets/{chunk-AQP2D5EJ-ChDrz2ad.js → chunk-AQP2D5EJ-Cif-zLTQ.js} +1 -1
  201. package/dist/web-shell/assets/{chunk-FMBD7UC4-ClMdVSDs.js → chunk-FMBD7UC4-H18WCXdY.js} +1 -1
  202. package/dist/web-shell/assets/{chunk-ND2GUHAM-BceV8kZS.js → chunk-ND2GUHAM-YFtetHi0.js} +1 -1
  203. package/dist/web-shell/assets/{chunk-QZHKN3VN-DtyK2wwc.js → chunk-QZHKN3VN-By2hiH3r.js} +1 -1
  204. package/dist/web-shell/assets/classDiagram-4FO5ZUOK-BA2ljEjW.js +1 -0
  205. package/dist/web-shell/assets/classDiagram-v2-Q7XG4LA2-BA2ljEjW.js +1 -0
  206. package/dist/web-shell/assets/{cose-bilkent-S5V4N54A-BGMsqwmE.js → cose-bilkent-S5V4N54A-VrcnnLZu.js} +1 -1
  207. package/dist/web-shell/assets/{dagre-BM42HDAG-C-71clpF.js → dagre-BM42HDAG-CGo-IaVV.js} +1 -1
  208. package/dist/web-shell/assets/{diagram-2AECGRRQ-WIzzlkec.js → diagram-2AECGRRQ-Dl4QjzIB.js} +1 -1
  209. package/dist/web-shell/assets/{diagram-5GNKFQAL-CtnhZUP1.js → diagram-5GNKFQAL-qMLmsO0u.js} +1 -1
  210. package/dist/web-shell/assets/{diagram-KO2AKTUF-CS_IUezp.js → diagram-KO2AKTUF-CHlmuxPI.js} +1 -1
  211. package/dist/web-shell/assets/{diagram-LMA3HP47-BQnGRwN9.js → diagram-LMA3HP47-BUwU3GwT.js} +1 -1
  212. package/dist/web-shell/assets/{diagram-OG6HWLK6-By2VIocq.js → diagram-OG6HWLK6-HEhwPDUM.js} +1 -1
  213. package/dist/web-shell/assets/{erDiagram-TEJ5UH35-Dy8WeNkr.js → erDiagram-TEJ5UH35-1n0llBmM.js} +1 -1
  214. package/dist/web-shell/assets/{flowDiagram-I6XJVG4X-Diu_4y0w.js → flowDiagram-I6XJVG4X-BN74uMnt.js} +1 -1
  215. package/dist/web-shell/assets/{ganttDiagram-6RSMTGT7-CH8euujP.js → ganttDiagram-6RSMTGT7-BoOq78i3.js} +1 -1
  216. package/dist/web-shell/assets/{gitGraphDiagram-PVQCEYII-DHiObZq1.js → gitGraphDiagram-PVQCEYII-CN8b00c8.js} +1 -1
  217. package/dist/web-shell/assets/index-CNwoO1Cn.js +783 -0
  218. package/dist/web-shell/assets/index-CWQ0z6kZ.css +5 -0
  219. package/dist/web-shell/assets/{infoDiagram-5YYISTIA-CvC9A6fh.js → infoDiagram-5YYISTIA-CCurnIna.js} +1 -1
  220. package/dist/web-shell/assets/{ishikawaDiagram-YF4QCWOH-BK46kC4E.js → ishikawaDiagram-YF4QCWOH-AwuRqdUP.js} +1 -1
  221. package/dist/web-shell/assets/{journeyDiagram-JHISSGLW-B2TIiKq4.js → journeyDiagram-JHISSGLW-B7IICk-E.js} +1 -1
  222. package/dist/web-shell/assets/{kanban-definition-UN3LZRKU-Bh0WAulO.js → kanban-definition-UN3LZRKU-BYF0OKhx.js} +1 -1
  223. package/dist/web-shell/assets/{linear-Bxe9SHMk.js → linear-GWWguGfD.js} +1 -1
  224. package/dist/web-shell/assets/{mermaid.core-B1Pv6D5B.js → mermaid.core-JqtkxvCl.js} +5 -5
  225. package/dist/web-shell/assets/{mindmap-definition-RKZ34NQL-Bz0joLH8.js → mindmap-definition-RKZ34NQL-B0MmHsZ6.js} +1 -1
  226. package/dist/web-shell/assets/{pieDiagram-4H26LBE5-CnN4x-VS.js → pieDiagram-4H26LBE5-DhImUZLQ.js} +1 -1
  227. package/dist/web-shell/assets/{quadrantDiagram-W4KKPZXB-BYWD4xO4.js → quadrantDiagram-W4KKPZXB-DGeSC3DT.js} +1 -1
  228. package/dist/web-shell/assets/{requirementDiagram-4Y6WPE33-B4MEhI9h.js → requirementDiagram-4Y6WPE33-DkspY6Re.js} +1 -1
  229. package/dist/web-shell/assets/{sankeyDiagram-5OEKKPKP-Dk_FgKLp.js → sankeyDiagram-5OEKKPKP-CaOofS2x.js} +1 -1
  230. package/dist/web-shell/assets/{sequenceDiagram-3UESZ5HK-B4ksiBZQ.js → sequenceDiagram-3UESZ5HK-DFQ_kFnN.js} +1 -1
  231. package/dist/web-shell/assets/{stateDiagram-AJRCARHV-CYf0xSPl.js → stateDiagram-AJRCARHV-D3snw0Tz.js} +1 -1
  232. package/dist/web-shell/assets/stateDiagram-v2-BHNVJYJU-BbSm_9d0.js +1 -0
  233. package/dist/web-shell/assets/{timeline-definition-PNZ67QCA-0CXeWHNY.js → timeline-definition-PNZ67QCA-l4zH8nLM.js} +1 -1
  234. package/dist/web-shell/assets/{vennDiagram-CIIHVFJN-DHoYY9v2.js → vennDiagram-CIIHVFJN-BnRlA98M.js} +1 -1
  235. package/dist/web-shell/assets/{wardley-L42UT6IY-D_65qshr.js → wardley-L42UT6IY-BS0xUdmd.js} +1 -1
  236. package/dist/web-shell/assets/{wardleyDiagram-YWT4CUSO-Cv90x1sd.js → wardleyDiagram-YWT4CUSO-DKGBUWyQ.js} +1 -1
  237. package/dist/web-shell/assets/{xychartDiagram-2RQKCTM6-5FQCYJyh.js → xychartDiagram-2RQKCTM6-DVb2HuOB.js} +1 -1
  238. package/dist/web-shell/index.html +2 -2
  239. package/package.json +3 -2
  240. package/dist/web-shell/assets/channel-V-ZaJrA6.js +0 -1
  241. package/dist/web-shell/assets/classDiagram-4FO5ZUOK-s-H0snGT.js +0 -1
  242. package/dist/web-shell/assets/classDiagram-v2-Q7XG4LA2-s-H0snGT.js +0 -1
  243. package/dist/web-shell/assets/index-DW75jq0K.css +0 -5
  244. package/dist/web-shell/assets/index-tiCo0xbZ.js +0 -779
  245. 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-HY7JTIS2.js";
6
+ import {
7
+ ExtensionRefreshState,
4
8
  isValidSessionId,
5
9
  validateAuthMethod
6
- } from "./chunk-VQZSRYKB.js";
7
- import {
8
- contextCommand
9
- } from "./chunk-TJS7CXNX.js";
10
+ } from "./chunk-OFGYDQPN.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-DH7XPKJV.js";
22
- import {
23
- isTerminalGoalStatusKind
24
- } from "./chunk-KSPVDFE4.js";
22
+ } from "./chunk-MCAFUCA2.js";
25
23
  import {
26
24
  Text
27
- } from "./chunk-GSNACUDM.js";
25
+ } from "./chunk-RBXWE376.js";
26
+ import {
27
+ isKittyProtocolEnabled
28
+ } from "./chunk-JZSY4WP3.js";
29
+ import {
30
+ getInstallationInfo,
31
+ rollbackStandaloneUpdate
32
+ } from "./chunk-YBRZ3S2C.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-23TH7TAA.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-6N76CE6T.js";
53
- import {
54
- require_undici
55
- } from "./chunk-54YZOP7P.js";
54
+ } from "./chunk-65GWYZCU.js";
56
55
  import {
57
56
  stripUnsafeCharacters,
58
57
  toCodePoints
59
- } from "./chunk-AKSRZ5BA.js";
58
+ } from "./chunk-SBP3QB6S.js";
59
+ import {
60
+ getErrorMessage as getErrorMessage2
61
+ } from "./chunk-UNP2RK7B.js";
60
62
  import {
61
63
  getExtendedSystemInfo,
62
64
  getGitVersion,
63
65
  getNpmVersion
64
- } from "./chunk-GKUVMLJH.js";
66
+ } from "./chunk-RVBG4B2L.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-VEDR5V7H.js";
75
+ } from "./chunk-ITIH3WEE.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-SWHGVEH5.js";
83
+ } from "./chunk-O2JNBKLL.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-7SZJYZPR.js";
95
+ } from "./chunk-YWRV5OJX.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-COPJASIO.js";
103
+ } from "./chunk-RRI2ZIIA.js";
102
104
  import {
103
105
  isFolderTrustEnabled,
104
106
  loadTrustedFolders
105
- } from "./chunk-Z3VQSA4A.js";
107
+ } from "./chunk-67JZ37FW.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-FACTYQFS.js";
179
+ } from "./chunk-72AW57IS.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-VEB3NYSO.js";
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-O3DVJ2JO.js";
210
+ } from "./chunk-2DFYBHN4.js";
211
211
  import {
212
212
  getAutoMemoryRoot
213
- } from "./chunk-4KJ2BPIT.js";
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-GXQXFHYV.js";
237
+ } from "./chunk-CBYHA7QC.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((resolve5, reject) => {
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 resolve5();
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 config.getBackgroundTaskRegistry().hasUnfinalizedTasks() || config.getMonitorRegistry().getRunning().length > 0 || config.getBackgroundShellRegistry().hasRunningEntries() || // R7 (wenshao): the WorkflowRunRegistry is a 4th sibling that the
2651
- // earlier P4b commit forgot to wire here. Without this OR clause,
2652
- // /clear and session-resume happily ran while a workflow was
2653
- // mid-run, orphaning the dispatch loop.
2654
- config.getWorkflowRunRegistry().hasRunningEntries();
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
- if (context.executionMode !== "interactive") {
2689
- return {
2690
- type: "message",
2691
- messageType: "error",
2692
- content
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((resolve5) => setTimeout(resolve5, ms));
4413
+ return new Promise((resolve4) => setTimeout(resolve4, ms));
4359
4414
  }
4360
4415
  __name(defaultWait, "defaultWait");
4361
4416
  function normalizeSampleCount(sampleCount) {
@@ -4560,918 +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://get.zubriq.by/releases";
4602
- var GITHUB_BASE = "https://s3.artcloud.by/zubriq-get/releases";
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 `zubriq-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, "zq.cmd");
5020
- if (!fs5.existsSync(wrapperPath)) {
5021
- const content = `@echo off\r
5022
- call "${standaloneDir}\\bin\\zq.cmd" %*\r
5023
- `;
5024
- fs5.writeFileSync(wrapperPath, content);
5025
- }
5026
- } else {
5027
- assertSafeForShellEmbed(standaloneDir, "standaloneDir");
5028
- const wrapperPath = path5.join(binDir, "zq");
5029
- if (!fs5.existsSync(wrapperPath)) {
5030
- const content = `#!/bin/sh
5031
- exec "${standaloneDir}/bin/zq" "$@"
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, "zubriq-code");
5144
- if (!fs5.existsSync(path5.join(newInstallDir, "manifest.json"))) {
5145
- throw new Error(
5146
- "Extracted archive does not contain expected zubriq-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
- var debugLogger7 = createDebugLogger("INSTALLATION_INFO");
5274
- var STANDALONE_UNIX_INSTALLER = "https://code.zubriq.by/install.sh";
5275
- var STANDALONE_WINDOWS_INSTALLER = "https://code.zubriq.by/install.ps1";
5276
- function getInstallationInfo(projectRoot, isAutoUpdateEnabled) {
5277
- const cliPath = process.argv[1];
5278
- if (!cliPath) {
5279
- return { packageManager: "unknown" /* UNKNOWN */, isGlobal: false };
5280
- }
5281
- try {
5282
- const realPath = fs6.realpathSync(cliPath).replace(/\\/g, "/");
5283
- const normalizedProjectRoot = projectRoot?.replace(/\\/g, "/");
5284
- const isGit = isGitRepository(process.cwd());
5285
- if (isGit && normalizedProjectRoot && isSamePathOrInside(realPath, normalizedProjectRoot) && !realPath.includes("/node_modules/")) {
5286
- return {
5287
- packageManager: "unknown" /* UNKNOWN */,
5288
- // Not managed by a package manager in this sense
5289
- isGlobal: false,
5290
- updateMessage: 'Running from a local git clone. Please update with "git pull".'
5291
- };
5292
- }
5293
- if (realPath.includes("/.npm/_npx") || realPath.includes("/npm/_npx")) {
5294
- return {
5295
- packageManager: "npx" /* NPX */,
5296
- isGlobal: false,
5297
- updateMessage: "Running via npx, update not applicable."
5298
- };
5299
- }
5300
- if (realPath.includes("/.pnpm/_pnpx")) {
5301
- return {
5302
- packageManager: "pnpx" /* PNPX */,
5303
- isGlobal: false,
5304
- updateMessage: "Running via pnpx, update not applicable."
5305
- };
5306
- }
5307
- const standaloneInfo = getStandaloneInstallInfo(
5308
- realPath,
5309
- isAutoUpdateEnabled
5310
- );
5311
- if (standaloneInfo) {
5312
- return standaloneInfo;
5313
- }
5314
- if (process.platform === "darwin" && realPath.includes("/Cellar/zq/")) {
5315
- return {
5316
- packageManager: "homebrew" /* HOMEBREW */,
5317
- isGlobal: true,
5318
- updateMessage: 'Installed via Homebrew. Please update with "brew upgrade zq".'
5319
- };
5320
- }
5321
- if (realPath.includes("/.pnpm/global")) {
5322
- const updateCommand2 = "pnpm add -g @zubriq/code@latest";
5323
- return {
5324
- packageManager: "pnpm" /* PNPM */,
5325
- isGlobal: true,
5326
- updateCommand: updateCommand2,
5327
- updateMessage: isAutoUpdateEnabled ? "Installed with pnpm. Attempting to automatically update now..." : `Please run ${updateCommand2} to update`
5328
- };
5329
- }
5330
- if (realPath.includes("/.yarn/global")) {
5331
- const updateCommand2 = "yarn global add @zubriq/code@latest";
5332
- return {
5333
- packageManager: "yarn" /* YARN */,
5334
- isGlobal: true,
5335
- updateCommand: updateCommand2,
5336
- updateMessage: isAutoUpdateEnabled ? "Installed with yarn. Attempting to automatically update now..." : `Please run ${updateCommand2} to update`
5337
- };
5338
- }
5339
- if (realPath.includes("/.bun/install/cache")) {
5340
- return {
5341
- packageManager: "bunx" /* BUNX */,
5342
- isGlobal: false,
5343
- updateMessage: "Running via bunx, update not applicable."
5344
- };
5345
- }
5346
- if (realPath.includes("/.bun/bin")) {
5347
- const updateCommand2 = "bun add -g @zubriq/code@latest";
5348
- return {
5349
- packageManager: "bun" /* BUN */,
5350
- isGlobal: true,
5351
- updateCommand: updateCommand2,
5352
- updateMessage: isAutoUpdateEnabled ? "Installed with bun. Attempting to automatically update now..." : `Please run ${updateCommand2} to update`
5353
- };
5354
- }
5355
- if (normalizedProjectRoot && isSamePathOrInside(realPath, `${normalizedProjectRoot}/node_modules`)) {
5356
- let pm = "npm" /* NPM */;
5357
- if (fs6.existsSync(path6.join(projectRoot, "yarn.lock"))) {
5358
- pm = "yarn" /* YARN */;
5359
- } else if (fs6.existsSync(path6.join(projectRoot, "pnpm-lock.yaml"))) {
5360
- pm = "pnpm" /* PNPM */;
5361
- } else if (fs6.existsSync(path6.join(projectRoot, "bun.lockb"))) {
5362
- pm = "bun" /* BUN */;
5363
- }
5364
- return {
5365
- packageManager: pm,
5366
- isGlobal: false,
5367
- updateMessage: "Locally installed. Please update via your project's package.json."
5368
- };
5369
- }
5370
- const npmPackageDir = path6.dirname(path6.dirname(realPath));
5371
- let npmPrefixWritable = false;
5372
- try {
5373
- fs6.accessSync(npmPackageDir, fs6.constants.W_OK);
5374
- npmPrefixWritable = true;
5375
- } catch {
5376
- }
5377
- if (!npmPrefixWritable) {
5378
- return {
5379
- packageManager: "npm" /* NPM */,
5380
- isGlobal: true,
5381
- updateMessage: "Update requires sudo. Please run: sudo npm install -g @zubriq/code@latest"
5382
- };
5383
- }
5384
- const updateCommand = "npm install -g @zubriq/code@latest";
5385
- return {
5386
- packageManager: "npm" /* NPM */,
5387
- isGlobal: true,
5388
- updateCommand,
5389
- updateMessage: isAutoUpdateEnabled ? "Installed with npm. Attempting to automatically update now..." : `Please run ${updateCommand} to update`
5390
- };
5391
- } catch (error) {
5392
- debugLogger7.error("Failed to detect installation info:", error);
5393
- return { packageManager: "unknown" /* UNKNOWN */, isGlobal: false };
5394
- }
5395
- }
5396
- __name(getInstallationInfo, "getInstallationInfo");
5397
- function stripTrailingSlashes(value) {
5398
- return value.replace(/\/+$/, "") || "/";
5399
- }
5400
- __name(stripTrailingSlashes, "stripTrailingSlashes");
5401
- function isSamePathOrInside(candidate, parent) {
5402
- const normalizedCandidate = stripTrailingSlashes(candidate);
5403
- const normalizedParent = stripTrailingSlashes(parent);
5404
- if (normalizedParent === "/") {
5405
- return normalizedCandidate === "/" || normalizedCandidate.startsWith("/");
5406
- }
5407
- return normalizedCandidate === normalizedParent || normalizedCandidate.startsWith(`${normalizedParent}/`);
5408
- }
5409
- __name(isSamePathOrInside, "isSamePathOrInside");
5410
- function getStandaloneInstallInfo(realPath, isAutoUpdateEnabled) {
5411
- const installDir = standaloneInstallDirForCliPath(realPath);
5412
- if (!installDir || !isStandaloneInstallDir(installDir)) {
5413
- return null;
5414
- }
5415
- const updateCommand = process.platform === "win32" ? `powershell -ExecutionPolicy Bypass -c "irm ${STANDALONE_WINDOWS_INSTALLER} | iex"` : `curl -fsSL ${STANDALONE_UNIX_INSTALLER} | bash`;
5416
- return {
5417
- packageManager: "standalone" /* STANDALONE */,
5418
- isGlobal: true,
5419
- isStandalone: true,
5420
- standaloneDir: installDir,
5421
- updateMessage: isAutoUpdateEnabled ? "Standalone install detected. Attempting to automatically update now..." : `Standalone install detected. Please rerun the standalone installer to update: ${updateCommand}`
5422
- };
5423
- }
5424
- __name(getStandaloneInstallInfo, "getStandaloneInstallInfo");
5425
- function standaloneInstallDirForCliPath(realPath) {
5426
- const normalized = realPath.replace(/\\/g, "/");
5427
- const suffix = "/lib/cli.js";
5428
- if (!normalized.endsWith(suffix)) {
5429
- return null;
5430
- }
5431
- return realPath.slice(0, -suffix.length);
5432
- }
5433
- __name(standaloneInstallDirForCliPath, "standaloneInstallDirForCliPath");
5434
- function isStandaloneInstallDir(installDir) {
5435
- try {
5436
- const manifestPath = path6.join(installDir, "manifest.json");
5437
- if (!fs6.existsSync(manifestPath)) {
5438
- return false;
5439
- }
5440
- const manifest = JSON.parse(fs6.readFileSync(manifestPath, "utf8"));
5441
- if (manifest.name !== "@zubriq/code" || typeof manifest.target !== "string" || !isStandaloneTargetForCurrentPlatform(manifest.target)) {
5442
- return false;
5443
- }
5444
- const qwenBin = process.platform === "win32" ? path6.join(installDir, "bin", "zq.cmd") : path6.join(installDir, "bin", "zq");
5445
- const nodeBin = process.platform === "win32" ? path6.join(installDir, "node", "node.exe") : path6.join(installDir, "node", "bin", "node");
5446
- return fs6.existsSync(qwenBin) && fs6.existsSync(nodeBin) && isStandaloneRuntimeFile(qwenBin) && isStandaloneRuntimeFile(nodeBin);
5447
- } catch (err) {
5448
- debugLogger7.error("Standalone detection failed:", installDir, err);
5449
- return false;
5450
- }
5451
- }
5452
- __name(isStandaloneInstallDir, "isStandaloneInstallDir");
5453
- function isStandaloneTargetForCurrentPlatform(target) {
5454
- switch (process.platform) {
5455
- case "darwin":
5456
- return /^darwin-(arm64|x64)$/.test(target);
5457
- case "linux":
5458
- return /^linux-(arm64|x64)$/.test(target);
5459
- case "win32":
5460
- return /^win-(arm64|x64)$/.test(target);
5461
- default:
5462
- return false;
5463
- }
5464
- }
5465
- __name(isStandaloneTargetForCurrentPlatform, "isStandaloneTargetForCurrentPlatform");
5466
- function isStandaloneRuntimeFile(filePath) {
5467
- const stats = fs6.lstatSync(filePath);
5468
- if (!stats.isFile() || stats.isSymbolicLink()) {
5469
- return false;
5470
- }
5471
- return process.platform === "win32" || (stats.mode & 73) !== 0;
5472
- }
5473
- __name(isStandaloneRuntimeFile, "isStandaloneRuntimeFile");
5474
-
5475
4618
  // packages/cli/src/ui/commands/doctorCommand.ts
5476
4619
  var MEMORY_SUBCOMMAND = "memory";
5477
4620
  var CPU_PROFILE_SUBCOMMAND = "cpu-profile";
@@ -5914,14 +5057,14 @@ async function cpuProfileDoctorAction(context, args = "") {
5914
5057
  })
5915
5058
  });
5916
5059
  }
5917
- await new Promise((resolve5) => {
5918
- const timer = setTimeout(resolve5, durationSec * 1e3);
5060
+ await new Promise((resolve4) => {
5061
+ const timer = setTimeout(resolve4, durationSec * 1e3);
5919
5062
  if (abortSignal) {
5920
5063
  abortSignal.addEventListener(
5921
5064
  "abort",
5922
5065
  () => {
5923
5066
  clearTimeout(timer);
5924
- resolve5();
5067
+ resolve4();
5925
5068
  },
5926
5069
  { once: true }
5927
5070
  );
@@ -6121,10 +5264,10 @@ var effortCommand = {
6121
5264
 
6122
5265
  // packages/cli/src/ui/commands/exportCommand.ts
6123
5266
  init_esbuild_shims();
6124
- import * as fs7 from "node:fs/promises";
6125
- import path7 from "node:path";
5267
+ import * as fs5 from "node:fs/promises";
5268
+ import path5 from "node:path";
6126
5269
  var EXPORT_DIR_OUT_OF_CWD = "Export directory must be within the project working directory.";
6127
- var debugLogger8 = createDebugLogger("EXPORT_COMMAND");
5270
+ var debugLogger6 = createDebugLogger("EXPORT_COMMAND");
6128
5271
  function formatExportTargetContext(target) {
6129
5272
  return `target: "${target.outputDir}", cwd: "${target.resolvedCwd}"`;
6130
5273
  }
@@ -6136,16 +5279,16 @@ __name(formatMissingCwdError, "formatMissingCwdError");
6136
5279
  function resolveExportTarget(cwd, args, extension) {
6137
5280
  const filename = generateExportFilename(extension);
6138
5281
  const outputDirArg = args.trim();
6139
- const resolvedCwd = path7.resolve(cwd);
6140
- const outputDir = outputDirArg ? path7.resolve(resolvedCwd, outputDirArg) : resolvedCwd;
6141
- const filepath = path7.join(outputDir, filename);
5282
+ const resolvedCwd = path5.resolve(cwd);
5283
+ const outputDir = outputDirArg ? path5.resolve(resolvedCwd, outputDirArg) : resolvedCwd;
5284
+ const filepath = path5.join(outputDir, filename);
6142
5285
  const isDefaultOutputDir = outputDir === resolvedCwd;
6143
5286
  const isInsideCwd = isSubpath(resolvedCwd, outputDir);
6144
5287
  const outputDirKind = outputDirArg && !isDefaultOutputDir ? "custom" : "default";
6145
5288
  return {
6146
5289
  filepath,
6147
5290
  outputDir,
6148
- displayPath: isDefaultOutputDir ? filename : path7.join(outputDirArg, filename),
5291
+ displayPath: isDefaultOutputDir ? filename : path5.join(outputDirArg, filename),
6149
5292
  resolvedCwd,
6150
5293
  outputDirKind,
6151
5294
  isInsideCwd
@@ -6153,7 +5296,7 @@ function resolveExportTarget(cwd, args, extension) {
6153
5296
  }
6154
5297
  __name(resolveExportTarget, "resolveExportTarget");
6155
5298
  async function validateExportTargetWithinCwd(target) {
6156
- debugLogger8.debug(
5299
+ debugLogger6.debug(
6157
5300
  "Validating export target realpath:",
6158
5301
  formatExportTargetContext(target)
6159
5302
  );
@@ -6161,12 +5304,12 @@ async function validateExportTargetWithinCwd(target) {
6161
5304
  let realOutputDir;
6162
5305
  try {
6163
5306
  [realCwd, realOutputDir] = await Promise.all([
6164
- fs7.realpath(target.resolvedCwd),
6165
- fs7.realpath(target.outputDir)
5307
+ fs5.realpath(target.resolvedCwd),
5308
+ fs5.realpath(target.outputDir)
6166
5309
  ]);
6167
5310
  } catch (error) {
6168
5311
  if (error.code === "ENOENT") {
6169
- debugLogger8.debug(
5312
+ debugLogger6.debug(
6170
5313
  "Export target realpath validation failed: missing path",
6171
5314
  formatExportTargetContext(target)
6172
5315
  );
@@ -6181,7 +5324,7 @@ async function validateExportTargetWithinCwd(target) {
6181
5324
  throw error;
6182
5325
  }
6183
5326
  if (!isSubpath(realCwd, realOutputDir)) {
6184
- debugLogger8.debug("Export target realpath escaped cwd:", {
5327
+ debugLogger6.debug("Export target realpath escaped cwd:", {
6185
5328
  realCwd,
6186
5329
  realOutputDir,
6187
5330
  target
@@ -6199,24 +5342,24 @@ async function validateExportTargetWithinCwd(target) {
6199
5342
  __name(validateExportTargetWithinCwd, "validateExportTargetWithinCwd");
6200
5343
  async function realpathNearestExisting(outputDir, resolvedCwd) {
6201
5344
  let currentPath = outputDir;
6202
- debugLogger8.debug("Resolving nearest existing export parent:", {
5345
+ debugLogger6.debug("Resolving nearest existing export parent:", {
6203
5346
  outputDir,
6204
5347
  resolvedCwd
6205
5348
  });
6206
5349
  while (isSubpath(resolvedCwd, currentPath)) {
6207
5350
  try {
6208
- const realCurrentPath = await fs7.realpath(currentPath);
6209
- debugLogger8.debug("Resolved nearest existing export parent:", {
5351
+ const realCurrentPath = await fs5.realpath(currentPath);
5352
+ debugLogger6.debug("Resolved nearest existing export parent:", {
6210
5353
  currentPath,
6211
5354
  realCurrentPath
6212
5355
  });
6213
5356
  return realCurrentPath;
6214
5357
  } catch (error) {
6215
5358
  if (error.code !== "ENOENT") {
6216
- debugLogger8.debug("Failed to resolve existing export parent:", error);
5359
+ debugLogger6.debug("Failed to resolve existing export parent:", error);
6217
5360
  throw error;
6218
5361
  }
6219
- const parentPath = path7.dirname(currentPath);
5362
+ const parentPath = path5.dirname(currentPath);
6220
5363
  if (parentPath === currentPath) {
6221
5364
  break;
6222
5365
  }
@@ -6227,13 +5370,13 @@ async function realpathNearestExisting(outputDir, resolvedCwd) {
6227
5370
  }
6228
5371
  __name(realpathNearestExisting, "realpathNearestExisting");
6229
5372
  async function validateExistingExportParentWithinCwd(target) {
6230
- debugLogger8.debug(
5373
+ debugLogger6.debug(
6231
5374
  "Validating existing export parent realpath:",
6232
5375
  formatExportTargetContext(target)
6233
5376
  );
6234
5377
  let realCwd;
6235
5378
  try {
6236
- realCwd = await fs7.realpath(target.resolvedCwd);
5379
+ realCwd = await fs5.realpath(target.resolvedCwd);
6237
5380
  } catch (error) {
6238
5381
  if (error.code === "ENOENT") {
6239
5382
  throw new Error(formatMissingCwdError(target.resolvedCwd));
@@ -6245,7 +5388,7 @@ async function validateExistingExportParentWithinCwd(target) {
6245
5388
  target.resolvedCwd
6246
5389
  );
6247
5390
  if (!isSubpath(realCwd, realExistingParent)) {
6248
- debugLogger8.debug("Existing export parent escaped cwd:", {
5391
+ debugLogger6.debug("Existing export parent escaped cwd:", {
6249
5392
  realCwd,
6250
5393
  realExistingParent,
6251
5394
  target
@@ -6281,7 +5424,7 @@ async function exportSessionAction(context, args, exportFormat) {
6281
5424
  }
6282
5425
  const target = resolveExportTarget(cwd, args, exportFormat.extension);
6283
5426
  const targetFilepath = target.filepath;
6284
- debugLogger8.debug("Resolved export target:", {
5427
+ debugLogger6.debug("Resolved export target:", {
6285
5428
  format: exportFormat.displayName,
6286
5429
  cwd,
6287
5430
  outputDirArg: args.trim(),
@@ -6290,7 +5433,7 @@ async function exportSessionAction(context, args, exportFormat) {
6290
5433
  filepath: target.filepath
6291
5434
  });
6292
5435
  if (!target.isInsideCwd) {
6293
- debugLogger8.debug(
5436
+ debugLogger6.debug(
6294
5437
  "Export target rejected before realpath validation:",
6295
5438
  formatExportTargetContext(target)
6296
5439
  );
@@ -6307,17 +5450,17 @@ async function exportSessionAction(context, args, exportFormat) {
6307
5450
  if (initialValidationError) {
6308
5451
  return initialValidationError;
6309
5452
  }
6310
- debugLogger8.debug("Export target validation passed:", {
5453
+ debugLogger6.debug("Export target validation passed:", {
6311
5454
  format: exportFormat.displayName,
6312
5455
  outputDir: target.outputDir,
6313
5456
  outputDirKind: target.outputDirKind
6314
5457
  });
6315
5458
  const sessionService = new SessionService(cwd);
6316
5459
  const sessionId = config.getSessionId();
6317
- debugLogger8.debug("Loading session for export:", { sessionId, cwd });
5460
+ debugLogger6.debug("Loading session for export:", { sessionId, cwd });
6318
5461
  const sessionData = await sessionService.loadSession(sessionId);
6319
5462
  if (!sessionData) {
6320
- debugLogger8.debug("No active session found for export:", {
5463
+ debugLogger6.debug("No active session found for export:", {
6321
5464
  sessionId,
6322
5465
  cwd
6323
5466
  });
@@ -6337,12 +5480,12 @@ async function exportSessionAction(context, args, exportFormat) {
6337
5480
  const content = exportFormat.format(normalizedData);
6338
5481
  if (target.outputDirKind === "custom") {
6339
5482
  try {
6340
- debugLogger8.debug("Creating export directory:", {
5483
+ debugLogger6.debug("Creating export directory:", {
6341
5484
  outputDir: target.outputDir
6342
5485
  });
6343
- await fs7.mkdir(target.outputDir, { recursive: true, mode: 448 });
5486
+ await fs5.mkdir(target.outputDir, { recursive: true, mode: 448 });
6344
5487
  } catch (error) {
6345
- debugLogger8.debug("Failed to create export directory:", error);
5488
+ debugLogger6.debug("Failed to create export directory:", error);
6346
5489
  return {
6347
5490
  type: "message",
6348
5491
  messageType: "error",
@@ -6356,7 +5499,7 @@ async function exportSessionAction(context, args, exportFormat) {
6356
5499
  return writeValidationError;
6357
5500
  }
6358
5501
  } catch (error) {
6359
- debugLogger8.debug("Export path validation failed before write:", error);
5502
+ debugLogger6.debug("Export path validation failed before write:", error);
6360
5503
  return {
6361
5504
  type: "message",
6362
5505
  messageType: "error",
@@ -6364,26 +5507,26 @@ async function exportSessionAction(context, args, exportFormat) {
6364
5507
  };
6365
5508
  }
6366
5509
  try {
6367
- debugLogger8.debug("Writing export file:", {
5510
+ debugLogger6.debug("Writing export file:", {
6368
5511
  format: exportFormat.displayName,
6369
5512
  filepath: target.filepath
6370
5513
  });
6371
- await fs7.writeFile(target.filepath, content, {
5514
+ await fs5.writeFile(target.filepath, content, {
6372
5515
  encoding: "utf-8",
6373
5516
  mode: 384
6374
5517
  });
6375
- await fs7.chmod(target.filepath, 384).catch((error) => {
6376
- debugLogger8.debug("Failed to tighten export file permissions:", error);
5518
+ await fs5.chmod(target.filepath, 384).catch((error) => {
5519
+ debugLogger6.debug("Failed to tighten export file permissions:", error);
6377
5520
  });
6378
5521
  } catch (error) {
6379
- debugLogger8.debug("Failed to write export file:", error);
5522
+ debugLogger6.debug("Failed to write export file:", error);
6380
5523
  return {
6381
5524
  type: "message",
6382
5525
  messageType: "error",
6383
5526
  content: `Failed to export session: ${error instanceof Error ? error.message : String(error)} (${exportFormat.displayName} target: "${targetFilepath}")`
6384
5527
  };
6385
5528
  }
6386
- debugLogger8.debug("Session export completed:", {
5529
+ debugLogger6.debug("Session export completed:", {
6387
5530
  format: exportFormat.displayName,
6388
5531
  filepath: target.filepath
6389
5532
  });
@@ -6393,7 +5536,7 @@ async function exportSessionAction(context, args, exportFormat) {
6393
5536
  content: `Session exported to ${exportFormat.displayName}: ${target.displayPath}`
6394
5537
  };
6395
5538
  } catch (error) {
6396
- debugLogger8.debug("Session export failed:", {
5539
+ debugLogger6.debug("Session export failed:", {
6397
5540
  format: exportFormat.displayName,
6398
5541
  target,
6399
5542
  error
@@ -6489,7 +5632,7 @@ var exportCommand = {
6489
5632
 
6490
5633
  // packages/cli/src/ui/commands/forkCommand.ts
6491
5634
  init_esbuild_shims();
6492
- var debugLogger9 = createDebugLogger("FORK_COMMAND");
5635
+ var debugLogger7 = createDebugLogger("FORK_COMMAND");
6493
5636
  function deriveForkDescription(directive) {
6494
5637
  const oneLine = directive.replace(/\s+/g, " ").trim();
6495
5638
  return oneLine.length > 60 ? `${oneLine.slice(0, 57)}\u2026` : oneLine;
@@ -6545,7 +5688,7 @@ var forkCommand = {
6545
5688
  try {
6546
5689
  hasHistory = (config.getGeminiClient().getHistoryShallow() ?? []).length > 0;
6547
5690
  } catch (error) {
6548
- debugLogger9.debug("Failed to read history before /fork:", error);
5691
+ debugLogger7.debug("Failed to read history before /fork:", error);
6549
5692
  hasHistory = false;
6550
5693
  }
6551
5694
  if (!hasHistory) {
@@ -6605,7 +5748,7 @@ var forkCommand = {
6605
5748
  ]
6606
5749
  });
6607
5750
  } catch (error) {
6608
- debugLogger9.debug("Failed to record fork event in history:", error);
5751
+ debugLogger7.debug("Failed to record fork event in history:", error);
6609
5752
  }
6610
5753
  return {
6611
5754
  type: "message",
@@ -6619,7 +5762,7 @@ var forkCommand = {
6619
5762
 
6620
5763
  // packages/cli/src/ui/commands/extensionsCommand.ts
6621
5764
  init_esbuild_shims();
6622
- var debugLogger10 = createDebugLogger("EXTENSIONS_COMMAND");
5765
+ var debugLogger8 = createDebugLogger("EXTENSIONS_COMMAND");
6623
5766
  var EXTENSION_EXPLORE_URL = {
6624
5767
  Gemini: "https://geminicli.com/extensions/",
6625
5768
  ClaudeCode: "https://claudemarketplaces.com/"
@@ -6782,7 +5925,7 @@ async function installAction(context, args) {
6782
5925
  }
6783
5926
  const extensionManager = context.services.config?.getExtensionManager();
6784
5927
  if (!(extensionManager instanceof ExtensionManager)) {
6785
- debugLogger10.error(
5928
+ debugLogger8.error(
6786
5929
  `Cannot ${context.invocation?.name} extensions in this environment`
6787
5930
  );
6788
5931
  return;
@@ -7720,7 +6863,7 @@ var hooksCommand = {
7720
6863
 
7721
6864
  // packages/cli/src/ui/commands/ideCommand.ts
7722
6865
  init_esbuild_shims();
7723
- import path8 from "node:path";
6866
+ import path6 from "node:path";
7724
6867
  function getIdeStatusMessage(ideClient) {
7725
6868
  const connection = ideClient.getConnectionStatus();
7726
6869
  switch (connection.status) {
@@ -7750,13 +6893,13 @@ __name(getIdeStatusMessage, "getIdeStatusMessage");
7750
6893
  function formatFileList(openFiles) {
7751
6894
  const basenameCounts = /* @__PURE__ */ new Map();
7752
6895
  for (const file of openFiles) {
7753
- const basename3 = path8.basename(file.path);
6896
+ const basename3 = path6.basename(file.path);
7754
6897
  basenameCounts.set(basename3, (basenameCounts.get(basename3) || 0) + 1);
7755
6898
  }
7756
6899
  const fileList = openFiles.map((file) => {
7757
- const basename3 = path8.basename(file.path);
6900
+ const basename3 = path6.basename(file.path);
7758
6901
  const isDuplicate = (basenameCounts.get(basename3) || 0) > 1;
7759
- const parentDir = path8.basename(path8.dirname(file.path));
6902
+ const parentDir = path6.basename(path6.dirname(file.path));
7760
6903
  const displayName = isDuplicate ? `${basename3} (/${parentDir})` : basename3;
7761
6904
  return ` - ${displayName}${file.isActive ? " (active)" : ""}`;
7762
6905
  }).join("\n");
@@ -7918,7 +7061,7 @@ var ideCommand = /* @__PURE__ */ __name(async () => {
7918
7061
  if (ideClient.getConnectionStatus().status === "connected" /* Connected */) {
7919
7062
  break;
7920
7063
  }
7921
- await new Promise((resolve5) => setTimeout(resolve5, 500));
7064
+ await new Promise((resolve4) => setTimeout(resolve4, 500));
7922
7065
  }
7923
7066
  const { messageType, content } = getIdeStatusMessage(ideClient);
7924
7067
  if (messageType === "error") {
@@ -8008,9 +7151,9 @@ init_esbuild_shims();
8008
7151
 
8009
7152
  // packages/cli/src/config/claudeMcpImport.ts
8010
7153
  init_esbuild_shims();
8011
- import * as fs8 from "node:fs";
8012
- import * as os4 from "node:os";
8013
- import * as path9 from "node:path";
7154
+ import * as fs6 from "node:fs";
7155
+ import * as os3 from "node:os";
7156
+ import * as path7 from "node:path";
8014
7157
  var import_strip_json_comments = __toESM(require_strip_json_comments(), 1);
8015
7158
  function isRecord(value) {
8016
7159
  return !!value && typeof value === "object" && !Array.isArray(value);
@@ -8031,7 +7174,7 @@ __name(emptyServerRecord, "emptyServerRecord");
8031
7174
  function readJsonObject(filePath) {
8032
7175
  let raw;
8033
7176
  try {
8034
- raw = fs8.readFileSync(filePath, "utf-8");
7177
+ raw = fs6.readFileSync(filePath, "utf-8");
8035
7178
  } catch (error) {
8036
7179
  if (isReadableConfigError(error) && (error.code === "ENOENT" || error.code === "ENOTDIR")) {
8037
7180
  return { found: false };
@@ -8080,7 +7223,7 @@ function copyMcpServers(value, sourcePath, servers, errors) {
8080
7223
  }
8081
7224
  __name(copyMcpServers, "copyMcpServers");
8082
7225
  function normalizeProjectPath(projectPath) {
8083
- return path9.resolve(projectPath);
7226
+ return path7.resolve(projectPath);
8084
7227
  }
8085
7228
  __name(normalizeProjectPath, "normalizeProjectPath");
8086
7229
  function getClaudeProjectSettings(projects, cwd) {
@@ -8096,17 +7239,17 @@ function getClaudeProjectSettings(projects, cwd) {
8096
7239
  return void 0;
8097
7240
  }
8098
7241
  __name(getClaudeProjectSettings, "getClaudeProjectSettings");
8099
- function getClaudeCodeConfigPath(homeDir = os4.homedir()) {
8100
- return path9.join(homeDir, ".claude.json");
7242
+ function getClaudeCodeConfigPath(homeDir = os3.homedir()) {
7243
+ return path7.join(homeDir, ".claude.json");
8101
7244
  }
8102
7245
  __name(getClaudeCodeConfigPath, "getClaudeCodeConfigPath");
8103
- function getClaudeDesktopConfigPath(homeDir = os4.homedir(), platform3 = process.platform, env = process.env) {
8104
- if (platform3 === "win32") {
8105
- const appData = env["APPDATA"] ?? path9.win32.join(homeDir, "AppData", "Roaming");
8106
- return path9.win32.join(appData, "Claude", "claude_desktop_config.json");
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");
8107
7250
  }
8108
- if (platform3 === "darwin") {
8109
- return path9.join(
7251
+ if (platform2 === "darwin") {
7252
+ return path7.join(
8110
7253
  homeDir,
8111
7254
  "Library",
8112
7255
  "Application Support",
@@ -8114,7 +7257,7 @@ function getClaudeDesktopConfigPath(homeDir = os4.homedir(), platform3 = process
8114
7257
  "claude_desktop_config.json"
8115
7258
  );
8116
7259
  }
8117
- return path9.join(homeDir, ".config", "Claude", "claude_desktop_config.json");
7260
+ return path7.join(homeDir, ".config", "Claude", "claude_desktop_config.json");
8118
7261
  }
8119
7262
  __name(getClaudeDesktopConfigPath, "getClaudeDesktopConfigPath");
8120
7263
  function loadMcpServersFromSettingsFile(filePath, label, source) {
@@ -8206,7 +7349,7 @@ __name(loadClaudeCodeJsonMcpServers, "loadClaudeCodeJsonMcpServers");
8206
7349
  function loadClaudeCodeMcpSources(homeDir, cwd, scope) {
8207
7350
  const candidates = scope === "project" ? [
8208
7351
  loadMcpServersFromSettingsFile(
8209
- path9.join(cwd, ".claude", "settings.json"),
7352
+ path7.join(cwd, ".claude", "settings.json"),
8210
7353
  "Claude Code project settings",
8211
7354
  "claude-code"
8212
7355
  ),
@@ -8214,7 +7357,7 @@ function loadClaudeCodeMcpSources(homeDir, cwd, scope) {
8214
7357
  ] : [
8215
7358
  loadClaudeCodeJsonMcpServers(homeDir, cwd, scope),
8216
7359
  loadMcpServersFromSettingsFile(
8217
- path9.join(homeDir, ".claude", "settings.json"),
7360
+ path7.join(homeDir, ".claude", "settings.json"),
8218
7361
  "Claude Code global settings",
8219
7362
  "claude-code"
8220
7363
  )
@@ -8229,8 +7372,8 @@ function loadClaudeCodeMcpSources(homeDir, cwd, scope) {
8229
7372
  });
8230
7373
  }
8231
7374
  __name(loadClaudeCodeMcpSources, "loadClaudeCodeMcpSources");
8232
- function loadClaudeDesktopMcpServers(homeDir, platform3, env) {
8233
- const filePath = getClaudeDesktopConfigPath(homeDir, platform3, env);
7375
+ function loadClaudeDesktopMcpServers(homeDir, platform2, env) {
7376
+ const filePath = getClaudeDesktopConfigPath(homeDir, platform2, env);
8234
7377
  const errors = [];
8235
7378
  const servers = emptyServerRecord();
8236
7379
  const parsed = readJsonObject(filePath);
@@ -8266,14 +7409,14 @@ function loadClaudeDesktopMcpServers(homeDir, platform3, env) {
8266
7409
  }
8267
7410
  __name(loadClaudeDesktopMcpServers, "loadClaudeDesktopMcpServers");
8268
7411
  function loadClaudeMcpSources(options) {
8269
- const homeDir = options.homeDir ?? os4.homedir();
7412
+ const homeDir = options.homeDir ?? os3.homedir();
8270
7413
  const cwd = options.cwd ?? process.cwd();
8271
- const platform3 = options.platform ?? process.platform;
7414
+ const platform2 = options.platform ?? process.platform;
8272
7415
  const env = options.env ?? process.env;
8273
7416
  const scope = options.scope ?? "user";
8274
7417
  const sources = options.source === "all" ? ["claude-code", "claude-desktop"] : [options.source];
8275
7418
  return sources.flatMap(
8276
- (source) => source === "claude-code" ? loadClaudeCodeMcpSources(homeDir, cwd, scope) : [loadClaudeDesktopMcpServers(homeDir, platform3, env)]
7419
+ (source) => source === "claude-code" ? loadClaudeCodeMcpSources(homeDir, cwd, scope) : [loadClaudeDesktopMcpServers(homeDir, platform2, env)]
8277
7420
  );
8278
7421
  }
8279
7422
  __name(loadClaudeMcpSources, "loadClaudeMcpSources");
@@ -8626,8 +7769,8 @@ ${usage()}`
8626
7769
 
8627
7770
  // packages/cli/src/ui/commands/initCommand.ts
8628
7771
  init_esbuild_shims();
8629
- import * as fs9 from "node:fs";
8630
- import * as path10 from "node:path";
7772
+ import * as fs7 from "node:fs";
7773
+ import * as path8 from "node:path";
8631
7774
  var import_react2 = __toESM(require_react(), 1);
8632
7775
  var initCommand = {
8633
7776
  name: "init",
@@ -8646,11 +7789,11 @@ var initCommand = {
8646
7789
  }
8647
7790
  const targetDir = context.services.config.getTargetDir();
8648
7791
  const contextFileName = getCurrentGeminiMdFilename();
8649
- const contextFilePath = path10.join(targetDir, contextFileName);
7792
+ const contextFilePath = path8.join(targetDir, contextFileName);
8650
7793
  try {
8651
- if (fs9.existsSync(contextFilePath)) {
7794
+ if (fs7.existsSync(contextFilePath)) {
8652
7795
  try {
8653
- const existing = fs9.readFileSync(contextFilePath, "utf8");
7796
+ const existing = fs7.readFileSync(contextFilePath, "utf8");
8654
7797
  if (existing && existing.trim().length > 0) {
8655
7798
  if (!context.overwriteConfirmed) {
8656
7799
  return {
@@ -8672,7 +7815,7 @@ var initCommand = {
8672
7815
  }
8673
7816
  }
8674
7817
  try {
8675
- fs9.writeFileSync(contextFilePath, "", "utf8");
7818
+ fs7.writeFileSync(contextFilePath, "", "utf8");
8676
7819
  context.ui.addItem(
8677
7820
  {
8678
7821
  type: "info",
@@ -8737,7 +7880,7 @@ Write the complete content to the \`${contextFileName}\` file. The output must b
8737
7880
 
8738
7881
  // packages/cli/src/ui/commands/languageCommand.ts
8739
7882
  init_esbuild_shims();
8740
- var debugLogger11 = createDebugLogger("LANGUAGE_COMMAND");
7883
+ var debugLogger9 = createDebugLogger("LANGUAGE_COMMAND");
8741
7884
  function getCurrentOutputLanguage(context) {
8742
7885
  const settingValue = context?.services?.settings?.merged?.general?.outputLanguage || OUTPUT_LANGUAGE_AUTO;
8743
7886
  const resolved = resolveOutputLanguage(settingValue);
@@ -8768,7 +7911,7 @@ async function setUiLanguage(context, lang) {
8768
7911
  try {
8769
7912
  services.settings.setValue("User" /* User */, "general.language", lang);
8770
7913
  } catch (error) {
8771
- debugLogger11.warn("Failed to save language setting:", error);
7914
+ debugLogger9.warn("Failed to save language setting:", error);
8772
7915
  }
8773
7916
  }
8774
7917
  context.ui.reloadCommands();
@@ -8795,7 +7938,7 @@ async function setOutputLanguage(context, language) {
8795
7938
  settingValue
8796
7939
  );
8797
7940
  } catch (error) {
8798
- debugLogger11.warn("Failed to save output language setting:", error);
7941
+ debugLogger9.warn("Failed to save output language setting:", error);
8799
7942
  }
8800
7943
  }
8801
7944
  const config = context.services.config;
@@ -8804,7 +7947,7 @@ async function setOutputLanguage(context, language) {
8804
7947
  await config.refreshHierarchicalMemory();
8805
7948
  await config.getGeminiClient().refreshSystemInstruction();
8806
7949
  } catch (error) {
8807
- debugLogger11.warn(
7950
+ debugLogger9.warn(
8808
7951
  "Failed to apply output language to running session:",
8809
7952
  error
8810
7953
  );
@@ -9028,7 +8171,7 @@ var mcpCommand = {
9028
8171
 
9029
8172
  // packages/cli/src/ui/commands/dreamCommand.ts
9030
8173
  init_esbuild_shims();
9031
- import * as path11 from "node:path";
8174
+ import * as path9 from "node:path";
9032
8175
  var dreamCommand = {
9033
8176
  name: "dream",
9034
8177
  get description() {
@@ -9048,7 +8191,7 @@ var dreamCommand = {
9048
8191
  try {
9049
8192
  const projectRoot = config.getProjectRoot();
9050
8193
  const memoryRoot = getAutoMemoryRoot(projectRoot);
9051
- const transcriptDir = path11.join(
8194
+ const transcriptDir = path9.join(
9052
8195
  new Storage(projectRoot).getProjectDir(),
9053
8196
  "chats"
9054
8197
  );
@@ -9149,17 +8292,44 @@ init_esbuild_shims();
9149
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.";
9150
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.";
9151
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");
9152
8322
  function formatVisionModelSettingForDisplay(setting) {
9153
8323
  const parsed = parseVisionModelSetting(setting);
9154
8324
  if (!parsed) return setting.replace(/\0/g, "\\0");
9155
8325
  return parsed.baseUrl ? `${parsed.selector} (${parsed.baseUrl})` : parsed.selector;
9156
8326
  }
9157
8327
  __name(formatVisionModelSettingForDisplay, "formatVisionModelSettingForDisplay");
9158
- function persistSetting(settings, path20, value) {
9159
- settings.setValue(getPersistScopeForModelSelection(settings), path20, value);
8328
+ function persistSetting(settings, path18, value, scopeOverride) {
8329
+ settings.setValue(resolveScope(settings, scopeOverride), path18, value);
9160
8330
  }
9161
8331
  __name(persistSetting, "persistSetting");
9162
- async function switchMainModel(config, settings, currentAuthType, modelArg) {
8332
+ async function switchMainModel(config, settings, currentAuthType, modelArg, scopeOverride) {
9163
8333
  const parsed = parseAcpModelOption(modelArg);
9164
8334
  if (parsed.authType) {
9165
8335
  await config.switchModel(
@@ -9167,14 +8337,19 @@ async function switchMainModel(config, settings, currentAuthType, modelArg) {
9167
8337
  parsed.modelId,
9168
8338
  parsed.authType !== currentAuthType && parsed.authType === "qwen-oauth" /* QWEN_OAUTH */ ? { requireCachedCredentials: true } : void 0
9169
8339
  );
9170
- persistSetting(settings, "security.auth.selectedType", parsed.authType);
9171
- persistSetting(settings, "model.name", parsed.modelId);
9172
- persistSetting(settings, "model.baseUrl", "");
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);
9173
8348
  return parsed.modelId;
9174
8349
  }
9175
8350
  await config.switchModel(currentAuthType, modelArg, void 0);
9176
- persistSetting(settings, "model.name", modelArg);
9177
- persistSetting(settings, "model.baseUrl", "");
8351
+ persistSetting(settings, "model.name", modelArg, scopeOverride);
8352
+ persistSetting(settings, "model.baseUrl", "", scopeOverride);
9178
8353
  return modelArg;
9179
8354
  }
9180
8355
  __name(switchMainModel, "switchMainModel");
@@ -9280,10 +8455,10 @@ var modelCommand = {
9280
8455
  completionPriority: 100,
9281
8456
  get description() {
9282
8457
  return t(
9283
- "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)."
9284
8459
  );
9285
8460
  },
9286
- argumentHint: "[--fast|--voice|--vision] [<model-id>] | <model-id> <prompt>",
8461
+ argumentHint: "[--fast|--voice|--vision] [--project|--global] [<model-id>] | <model-id> <prompt>",
9287
8462
  kind: "built-in" /* BUILT_IN */,
9288
8463
  supportedModes: ["interactive", "non_interactive", "acp"],
9289
8464
  completion: /* @__PURE__ */ __name(async (context, partialArg) => {
@@ -9304,6 +8479,18 @@ var modelCommand = {
9304
8479
  description: t(
9305
8480
  "Set the image-capable model used to transcribe images for a text-only main model"
9306
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
+ )
9307
8494
  }
9308
8495
  ].filter((item) => item.value.startsWith(partialArg));
9309
8496
  if (flagCompletions.length > 0) {
@@ -9312,17 +8499,10 @@ var modelCommand = {
9312
8499
  const trimmed = partialArg.trim();
9313
8500
  if (trimmed) {
9314
8501
  let mode = "main";
9315
- let modelPrefix = trimmed;
9316
- if (trimmed.startsWith("--fast ")) {
9317
- mode = "fast";
9318
- modelPrefix = trimmed.slice("--fast ".length);
9319
- } else if (trimmed.startsWith("--voice ")) {
9320
- mode = "voice";
9321
- modelPrefix = trimmed.slice("--voice ".length);
9322
- } else if (trimmed.startsWith("--vision ")) {
9323
- mode = "vision";
9324
- modelPrefix = trimmed.slice("--vision ".length);
9325
- }
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";
9326
8506
  return getAvailableModelIds(context, mode).filter(
9327
8507
  (id) => id.startsWith(modelPrefix)
9328
8508
  );
@@ -9342,7 +8522,30 @@ var modelCommand = {
9342
8522
  content: t("Configuration not available.")
9343
8523
  };
9344
8524
  }
9345
- const args = context.invocation?.args?.trim() || actionArgs.trim();
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)") : "";
9346
8549
  const isVoiceModelCommand = args === "--voice" || args.startsWith("--voice ");
9347
8550
  if (isVoiceModelCommand) {
9348
8551
  const modelName2 = args.replace("--voice", "").trim();
@@ -9360,7 +8563,8 @@ var modelCommand = {
9360
8563
  }
9361
8564
  return {
9362
8565
  type: "dialog",
9363
- dialog: "voice-model"
8566
+ dialog: "voice-model",
8567
+ ...persistScopeSpread(scopeOverride)
9364
8568
  };
9365
8569
  }
9366
8570
  if (!settings) {
@@ -9399,11 +8603,11 @@ var modelCommand = {
9399
8603
  content: formatUnsupportedVoiceModelMessage(modelName2)
9400
8604
  };
9401
8605
  }
9402
- persistSetting(settings, "voiceModel", modelName2);
8606
+ persistSetting(settings, "voiceModel", modelName2, scopeOverride);
9403
8607
  return {
9404
8608
  type: "message",
9405
8609
  messageType: "info",
9406
- content: t("Voice Model") + ": " + modelName2
8610
+ content: t("Voice Model") + ": " + modelName2 + scopeSuffix
9407
8611
  };
9408
8612
  }
9409
8613
  const isFastModelCommand = args === "--fast" || args.startsWith("--fast ");
@@ -9421,7 +8625,8 @@ Use "/model --fast <model-id>" to set fast model.`
9421
8625
  }
9422
8626
  return {
9423
8627
  type: "dialog",
9424
- dialog: "fast-model"
8628
+ dialog: "fast-model",
8629
+ ...persistScopeSpread(scopeOverride)
9425
8630
  };
9426
8631
  }
9427
8632
  if (!settings) {
@@ -9467,12 +8672,12 @@ Use "/model --fast <model-id>" to set fast model.`
9467
8672
  ) : formatUnavailableFastModelMessage(modelName2, availableModels)
9468
8673
  };
9469
8674
  }
9470
- persistSetting(settings, "fastModel", modelName2);
8675
+ persistSetting(settings, "fastModel", modelName2, scopeOverride);
9471
8676
  config.setFastModel(modelName2);
9472
8677
  return {
9473
8678
  type: "message",
9474
8679
  messageType: "info",
9475
- content: t("Fast Model") + ": " + modelName2
8680
+ content: t("Fast Model") + ": " + modelName2 + scopeSuffix
9476
8681
  };
9477
8682
  }
9478
8683
  const isVisionModelCommand = args === "--vision" || args.startsWith("--vision ");
@@ -9494,7 +8699,8 @@ Use "/model --fast <model-id>" to set fast model.`
9494
8699
  }
9495
8700
  return {
9496
8701
  type: "dialog",
9497
- dialog: "vision-model"
8702
+ dialog: "vision-model",
8703
+ ...persistScopeSpread(scopeOverride)
9498
8704
  };
9499
8705
  }
9500
8706
  if (!settings) {
@@ -9554,14 +8760,14 @@ Use "/model --fast <model-id>" to set fast model.`
9554
8760
  }
9555
8761
  const qualifiedModelName = `${selector.authType ?? matched.authType}:${selector.modelId}`;
9556
8762
  const visionModel = matched.baseUrl ? `${qualifiedModelName}\0${matched.baseUrl}` : qualifiedModelName;
9557
- persistSetting(settings, "visionModel", visionModel);
8763
+ persistSetting(settings, "visionModel", visionModel, scopeOverride);
9558
8764
  config.setVisionModel(visionModel);
9559
8765
  const visionWarning = isImageCapable(matched) ? "" : `
9560
8766
  ${formatNonVisionModelWarning(modelName2)}`;
9561
8767
  return {
9562
8768
  type: "message",
9563
8769
  messageType: "info",
9564
- content: t("Vision Model") + ": " + modelName2 + visionWarning
8770
+ content: t("Vision Model") + ": " + modelName2 + scopeSuffix + visionWarning
9565
8771
  };
9566
8772
  }
9567
8773
  const contentGeneratorConfig = config.getContentGeneratorConfig();
@@ -9611,6 +8817,17 @@ ${formatNonVisionModelWarning(modelName2)}`;
9611
8817
  )
9612
8818
  };
9613
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
+ }
9614
8831
  const sameAuthType = targetAuthType === authType;
9615
8832
  if (!sameAuthType || !isInlineModelOverrideAllowed(config, parsed.modelId)) {
9616
8833
  return {
@@ -9639,12 +8856,13 @@ ${formatNonVisionModelWarning(modelName2)}`;
9639
8856
  config,
9640
8857
  settings,
9641
8858
  authType,
9642
- modelName
8859
+ modelName,
8860
+ scopeOverride
9643
8861
  );
9644
8862
  return {
9645
8863
  type: "message",
9646
8864
  messageType: "info",
9647
- content: t("Model") + ": " + effectiveModelName
8865
+ content: t("Model") + ": " + effectiveModelName + scopeSuffix
9648
8866
  };
9649
8867
  }
9650
8868
  if (context.executionMode !== "interactive") {
@@ -9652,13 +8870,16 @@ ${formatNonVisionModelWarning(modelName2)}`;
9652
8870
  return {
9653
8871
  type: "message",
9654
8872
  messageType: "info",
9655
- content: `Current model: ${currentModel}
9656
- Use "/model <model-id>" to switch models or "/model --fast <model-id>" to set the fast model.`
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
+ )
9657
8877
  };
9658
8878
  }
9659
8879
  return {
9660
8880
  type: "dialog",
9661
- dialog: "model"
8881
+ dialog: "model",
8882
+ ...persistScopeSpread(scopeOverride)
9662
8883
  };
9663
8884
  }, "action")
9664
8885
  };
@@ -9899,6 +9120,178 @@ var recapCommand = {
9899
9120
  }, "action")
9900
9121
  };
9901
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
+
9902
9295
  // packages/cli/src/ui/commands/renameCommand.ts
9903
9296
  init_esbuild_shims();
9904
9297
  var MAX_TITLE_LENGTH = SESSION_TITLE_MAX_LENGTH;
@@ -10090,8 +9483,8 @@ var renameCommand = {
10090
9483
 
10091
9484
  // packages/cli/src/ui/commands/restoreCommand.ts
10092
9485
  init_esbuild_shims();
10093
- import * as fs10 from "node:fs/promises";
10094
- import path12 from "node:path";
9486
+ import * as fs8 from "node:fs/promises";
9487
+ import path10 from "node:path";
10095
9488
  async function restoreAction(context, args) {
10096
9489
  const { services, ui } = context;
10097
9490
  const { config } = services;
@@ -10105,8 +9498,8 @@ async function restoreAction(context, args) {
10105
9498
  };
10106
9499
  }
10107
9500
  try {
10108
- await fs10.mkdir(checkpointDir, { recursive: true });
10109
- const files = await fs10.readdir(checkpointDir);
9501
+ await fs8.mkdir(checkpointDir, { recursive: true });
9502
+ const files = await fs8.readdir(checkpointDir);
10110
9503
  const jsonFiles = files.filter((file) => file.endsWith(".json"));
10111
9504
  if (!args) {
10112
9505
  if (jsonFiles.length === 0) {
@@ -10141,8 +9534,8 @@ ${fileList}`
10141
9534
  content: `File not found: ${selectedFile}`
10142
9535
  };
10143
9536
  }
10144
- const filePath = path12.join(checkpointDir, selectedFile);
10145
- const data = await fs10.readFile(filePath, "utf-8");
9537
+ const filePath = path10.join(checkpointDir, selectedFile);
9538
+ const data = await fs8.readFile(filePath, "utf-8");
10146
9539
  const toolCallData = JSON.parse(data);
10147
9540
  if (toolCallData.commitHash && !toolCallData.promptId) {
10148
9541
  return {
@@ -10228,7 +9621,7 @@ async function completion(context, _partialArg) {
10228
9621
  return [];
10229
9622
  }
10230
9623
  try {
10231
- const files = await fs10.readdir(checkpointDir);
9624
+ const files = await fs8.readdir(checkpointDir);
10232
9625
  return files.filter((file) => file.endsWith(".json")).map((file) => file.replace(".json", ""));
10233
9626
  } catch (_err) {
10234
9627
  return [];
@@ -10415,9 +9808,9 @@ ${lines.join("\n")}`
10415
9808
 
10416
9809
  // packages/cli/src/ui/commands/statsCommand.ts
10417
9810
  init_esbuild_shims();
10418
- import * as fs11 from "node:fs/promises";
9811
+ import * as fs9 from "node:fs/promises";
10419
9812
  import { randomUUID } from "node:crypto";
10420
- import path13 from "node:path";
9813
+ import path11 from "node:path";
10421
9814
  var VALID_EXPORT_FORMATS = /* @__PURE__ */ new Set(["csv", "json"]);
10422
9815
  var EMPTY_SKILL_METRICS = {
10423
9816
  totalCalls: 0,
@@ -10614,12 +10007,12 @@ async function realpathNearestExisting2(targetDirectory, cwd) {
10614
10007
  let currentDirectory = targetDirectory;
10615
10008
  while (isSubpath(cwd, currentDirectory)) {
10616
10009
  try {
10617
- return await fs11.realpath(currentDirectory);
10010
+ return await fs9.realpath(currentDirectory);
10618
10011
  } catch (error) {
10619
10012
  if (!isNotFoundError(error)) {
10620
10013
  throw error;
10621
10014
  }
10622
- const parentDirectory = path13.dirname(currentDirectory);
10015
+ const parentDirectory = path11.dirname(currentDirectory);
10623
10016
  if (parentDirectory === currentDirectory) {
10624
10017
  break;
10625
10018
  }
@@ -10633,7 +10026,7 @@ async function realpathNearestExisting2(targetDirectory, cwd) {
10633
10026
  __name(realpathNearestExisting2, "realpathNearestExisting");
10634
10027
  async function validateStatsExportExistingParent(cwd, outputDirectory) {
10635
10028
  const [realCwd, realExistingParent] = await Promise.all([
10636
- fs11.realpath(cwd),
10029
+ fs9.realpath(cwd),
10637
10030
  realpathNearestExisting2(outputDirectory, cwd)
10638
10031
  ]);
10639
10032
  if (!isSubpath(realCwd, realExistingParent)) {
@@ -10644,8 +10037,8 @@ async function validateStatsExportExistingParent(cwd, outputDirectory) {
10644
10037
  __name(validateStatsExportExistingParent, "validateStatsExportExistingParent");
10645
10038
  async function validateStatsExportDirectory(cwd, outputDirectory) {
10646
10039
  const [realCwd, realOutputDirectory] = await Promise.all([
10647
- fs11.realpath(cwd),
10648
- fs11.realpath(outputDirectory)
10040
+ fs9.realpath(cwd),
10041
+ fs9.realpath(outputDirectory)
10649
10042
  ]);
10650
10043
  if (!isSubpath(realCwd, realOutputDirectory)) {
10651
10044
  return statsExportPathError();
@@ -10654,7 +10047,7 @@ async function validateStatsExportDirectory(cwd, outputDirectory) {
10654
10047
  }
10655
10048
  __name(validateStatsExportDirectory, "validateStatsExportDirectory");
10656
10049
  function validateStatsExportPathShape(targetPath) {
10657
- if (process.platform === "win32" && path13.basename(targetPath).includes(":")) {
10050
+ if (process.platform === "win32" && path11.basename(targetPath).includes(":")) {
10658
10051
  return statsExportPathError();
10659
10052
  }
10660
10053
  return void 0;
@@ -10662,7 +10055,7 @@ function validateStatsExportPathShape(targetPath) {
10662
10055
  __name(validateStatsExportPathShape, "validateStatsExportPathShape");
10663
10056
  async function validateStatsExportFileTarget(targetPath) {
10664
10057
  try {
10665
- const stats = await fs11.lstat(targetPath);
10058
+ const stats = await fs9.lstat(targetPath);
10666
10059
  if (stats.isSymbolicLink() || !stats.isFile()) {
10667
10060
  return statsExportPathError();
10668
10061
  }
@@ -10678,7 +10071,7 @@ __name(validateStatsExportFileTarget, "validateStatsExportFileTarget");
10678
10071
  async function validateStatsExportFinalFile(cwd, targetPath) {
10679
10072
  let stats;
10680
10073
  try {
10681
- stats = await fs11.lstat(targetPath);
10074
+ stats = await fs9.lstat(targetPath);
10682
10075
  } catch (error) {
10683
10076
  if (isNotFoundError(error)) {
10684
10077
  return statsExportTargetMissingError(targetPath);
@@ -10689,8 +10082,8 @@ async function validateStatsExportFinalFile(cwd, targetPath) {
10689
10082
  return statsExportPathError();
10690
10083
  }
10691
10084
  const [realCwd, realTargetPath] = await Promise.all([
10692
- fs11.realpath(cwd),
10693
- fs11.realpath(targetPath)
10085
+ fs9.realpath(cwd),
10086
+ fs9.realpath(targetPath)
10694
10087
  ]);
10695
10088
  if (!isSubpath(realCwd, realTargetPath)) {
10696
10089
  return statsExportPathError();
@@ -10699,9 +10092,9 @@ async function validateStatsExportFinalFile(cwd, targetPath) {
10699
10092
  }
10700
10093
  __name(validateStatsExportFinalFile, "validateStatsExportFinalFile");
10701
10094
  function createTemporaryExportPath(outputDirectory, targetPath) {
10702
- return path13.join(
10095
+ return path11.join(
10703
10096
  outputDirectory,
10704
- `.${path13.basename(targetPath)}.${process.pid}.${Date.now()}.${randomUUID()}.tmp`
10097
+ `.${path11.basename(targetPath)}.${process.pid}.${Date.now()}.${randomUUID()}.tmp`
10705
10098
  );
10706
10099
  }
10707
10100
  __name(createTemporaryExportPath, "createTemporaryExportPath");
@@ -10711,8 +10104,8 @@ function isSamePath(leftPath, rightPath) {
10711
10104
  __name(isSamePath, "isSamePath");
10712
10105
  async function validateStatsExportDirectoryIdentity(cwd, outputDirectory, expectedRealOutputDirectory) {
10713
10106
  const [realCwd, realOutputDirectory] = await Promise.all([
10714
- fs11.realpath(cwd),
10715
- fs11.realpath(outputDirectory)
10107
+ fs9.realpath(cwd),
10108
+ fs9.realpath(outputDirectory)
10716
10109
  ]);
10717
10110
  if (!isSubpath(realCwd, realOutputDirectory) || !isSamePath(expectedRealOutputDirectory, realOutputDirectory)) {
10718
10111
  return statsExportPathError();
@@ -10729,12 +10122,12 @@ async function writeStatsExportFileAtomically(cwd, outputDirectory, targetPath,
10729
10122
  return initialDirectoryError;
10730
10123
  }
10731
10124
  const [realCwd, realOutputDirectory] = await Promise.all([
10732
- fs11.realpath(cwd),
10733
- fs11.realpath(outputDirectory)
10125
+ fs9.realpath(cwd),
10126
+ fs9.realpath(outputDirectory)
10734
10127
  ]);
10735
- const realTargetPath = path13.join(
10128
+ const realTargetPath = path11.join(
10736
10129
  realOutputDirectory,
10737
- path13.basename(targetPath)
10130
+ path11.basename(targetPath)
10738
10131
  );
10739
10132
  if (!isSubpath(realCwd, realTargetPath)) {
10740
10133
  return statsExportPathError();
@@ -10760,7 +10153,7 @@ async function writeStatsExportFileAtomically(cwd, outputDirectory, targetPath,
10760
10153
  if (preTempFileError) {
10761
10154
  return preTempFileError;
10762
10155
  }
10763
- const file = await fs11.open(tempPath, "wx", 384);
10156
+ const file = await fs9.open(tempPath, "wx", 384);
10764
10157
  try {
10765
10158
  await file.writeFile(content, { encoding: "utf-8" });
10766
10159
  } finally {
@@ -10782,7 +10175,7 @@ async function writeStatsExportFileAtomically(cwd, outputDirectory, targetPath,
10782
10175
  if (preRenameFileError) {
10783
10176
  return preRenameFileError;
10784
10177
  }
10785
- await fs11.rename(tempPath, realTargetPath);
10178
+ await fs9.rename(tempPath, realTargetPath);
10786
10179
  tempPath = void 0;
10787
10180
  return validateStatsExportFinalFile(cwd, realTargetPath);
10788
10181
  } catch (error) {
@@ -10792,7 +10185,7 @@ async function writeStatsExportFileAtomically(cwd, outputDirectory, targetPath,
10792
10185
  throw error;
10793
10186
  } finally {
10794
10187
  if (tempPath) {
10795
- await fs11.rm(tempPath, { force: true }).catch(() => void 0);
10188
+ await fs9.rm(tempPath, { force: true }).catch(() => void 0);
10796
10189
  }
10797
10190
  }
10798
10191
  }
@@ -10884,10 +10277,10 @@ async function writeStatsExport(context, args) {
10884
10277
  });
10885
10278
  const content = parsed.format === "json" ? formatTokenUsageSummaryAsJson(summary) : `${formatTokenUsageSummaryAsCsv(summary)}
10886
10279
  `;
10887
- const cwd = path13.resolve(getConfigCwd(context));
10280
+ const cwd = path11.resolve(getConfigCwd(context));
10888
10281
  const defaultFilename = `qwen-token-usage-${summary.period}-${summary.value}.${parsed.format}`;
10889
- const targetPath = path13.resolve(cwd, parsed.outputPath || defaultFilename);
10890
- const outputDirectory = path13.dirname(targetPath);
10282
+ const targetPath = path11.resolve(cwd, parsed.outputPath || defaultFilename);
10283
+ const outputDirectory = path11.dirname(targetPath);
10891
10284
  if (!isSubpath(cwd, targetPath) || !isSubpath(cwd, outputDirectory)) {
10892
10285
  return statsExportPathError();
10893
10286
  }
@@ -10902,7 +10295,7 @@ async function writeStatsExport(context, args) {
10902
10295
  if (parentError) {
10903
10296
  return parentError;
10904
10297
  }
10905
- await fs11.mkdir(outputDirectory, { recursive: true });
10298
+ await fs9.mkdir(outputDirectory, { recursive: true });
10906
10299
  const postMkdirError = await validateStatsExportDirectory(
10907
10300
  cwd,
10908
10301
  outputDirectory
@@ -10926,7 +10319,7 @@ async function writeStatsExport(context, args) {
10926
10319
  return asMessage(
10927
10320
  t("Token usage exported to {{format}}: {{path}}", {
10928
10321
  format: parsed.format.toUpperCase(),
10929
- path: path13.relative(cwd, targetPath)
10322
+ path: path11.relative(cwd, targetPath)
10930
10323
  })
10931
10324
  );
10932
10325
  } catch (error) {
@@ -11137,7 +10530,7 @@ var statsCommand = {
11137
10530
  // packages/cli/src/ui/commands/summaryCommand.ts
11138
10531
  init_esbuild_shims();
11139
10532
  import * as fsPromises from "fs/promises";
11140
- import path14 from "path";
10533
+ import path12 from "path";
11141
10534
  var summaryCommand = {
11142
10535
  name: "summary",
11143
10536
  get description() {
@@ -11230,12 +10623,12 @@ var summaryCommand = {
11230
10623
  }, "generateSummaryMarkdown");
11231
10624
  const saveSummaryToDisk = /* @__PURE__ */ __name(async (markdownSummary) => {
11232
10625
  const projectRoot = config.getProjectRoot();
11233
- const qwenDir = path14.join(projectRoot, ".qwen");
10626
+ const qwenDir = path12.join(projectRoot, ".qwen");
11234
10627
  try {
11235
10628
  await fsPromises.mkdir(qwenDir, { recursive: true });
11236
10629
  } catch (_err) {
11237
10630
  }
11238
- const summaryPath = path14.join(qwenDir, "PROJECT_SUMMARY.md");
10631
+ const summaryPath = path12.join(qwenDir, "PROJECT_SUMMARY.md");
11239
10632
  const summaryContent = `${markdownSummary}
11240
10633
 
11241
10634
  ---
@@ -11391,12 +10784,12 @@ init_esbuild_shims();
11391
10784
 
11392
10785
  // packages/cli/src/ui/utils/terminalSetup.ts
11393
10786
  init_esbuild_shims();
11394
- import { promises as fs12 } from "node:fs";
11395
- import * as os5 from "node:os";
11396
- import * as path15 from "node:path";
10787
+ import { promises as fs10 } from "node:fs";
10788
+ import * as os4 from "node:os";
10789
+ import * as path13 from "node:path";
11397
10790
  import { exec } from "node:child_process";
11398
10791
  import { promisify } from "node:util";
11399
- var debugLogger12 = createDebugLogger("TERMINAL_SETUP");
10792
+ var debugLogger11 = createDebugLogger("TERMINAL_SETUP");
11400
10793
  var execAsync = promisify(exec);
11401
10794
  function stripJsonComments2(content) {
11402
10795
  return content.replace(/^\s*\/\/.*$/gm, "");
@@ -11416,7 +10809,7 @@ async function detectTerminal() {
11416
10809
  if (termProgram === "vscode" || process.env["VSCODE_GIT_IPC_HANDLE"]) {
11417
10810
  return "vscode";
11418
10811
  }
11419
- if (os5.platform() !== "win32") {
10812
+ if (os4.platform() !== "win32") {
11420
10813
  try {
11421
10814
  const { stdout } = await execAsync("ps -o comm= -p $PPID");
11422
10815
  const parentName = stdout.trim();
@@ -11429,7 +10822,7 @@ async function detectTerminal() {
11429
10822
  if (parentName.includes("trae") || parentName.includes("Trae"))
11430
10823
  return "trae";
11431
10824
  } catch (error) {
11432
- debugLogger12.debug("Parent process detection failed:", error);
10825
+ debugLogger11.debug("Parent process detection failed:", error);
11433
10826
  }
11434
10827
  }
11435
10828
  return null;
@@ -11439,29 +10832,29 @@ async function backupFile(filePath) {
11439
10832
  try {
11440
10833
  const timestamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
11441
10834
  const backupPath = `${filePath}.backup.${timestamp}`;
11442
- await fs12.copyFile(filePath, backupPath);
10835
+ await fs10.copyFile(filePath, backupPath);
11443
10836
  } catch (error) {
11444
- debugLogger12.warn(`Failed to create backup of ${filePath}:`, error);
10837
+ debugLogger11.warn(`Failed to create backup of ${filePath}:`, error);
11445
10838
  }
11446
10839
  }
11447
10840
  __name(backupFile, "backupFile");
11448
10841
  function getVSCodeStyleConfigDir(appName) {
11449
- const platform3 = os5.platform();
11450
- if (platform3 === "darwin") {
11451
- return path15.join(
11452
- os5.homedir(),
10842
+ const platform2 = os4.platform();
10843
+ if (platform2 === "darwin") {
10844
+ return path13.join(
10845
+ os4.homedir(),
11453
10846
  "Library",
11454
10847
  "Application Support",
11455
10848
  appName,
11456
10849
  "User"
11457
10850
  );
11458
- } else if (platform3 === "win32") {
10851
+ } else if (platform2 === "win32") {
11459
10852
  if (!process.env["APPDATA"]) {
11460
10853
  return null;
11461
10854
  }
11462
- return path15.join(process.env["APPDATA"], appName, "User");
10855
+ return path13.join(process.env["APPDATA"], appName, "User");
11463
10856
  } else {
11464
- return path15.join(os5.homedir(), ".config", appName, "User");
10857
+ return path13.join(os4.homedir(), ".config", appName, "User");
11465
10858
  }
11466
10859
  }
11467
10860
  __name(getVSCodeStyleConfigDir, "getVSCodeStyleConfigDir");
@@ -11476,12 +10869,12 @@ async function configureVSCodeStyle(terminalName, appName) {
11476
10869
  )
11477
10870
  };
11478
10871
  }
11479
- const keybindingsFile = path15.join(configDir, "keybindings.json");
10872
+ const keybindingsFile = path13.join(configDir, "keybindings.json");
11480
10873
  try {
11481
- await fs12.mkdir(configDir, { recursive: true });
10874
+ await fs10.mkdir(configDir, { recursive: true });
11482
10875
  let keybindings = [];
11483
10876
  try {
11484
- const content = await fs12.readFile(keybindingsFile, "utf8");
10877
+ const content = await fs10.readFile(keybindingsFile, "utf8");
11485
10878
  await backupFile(keybindingsFile);
11486
10879
  try {
11487
10880
  const cleanContent = stripJsonComments2(content);
@@ -11555,7 +10948,7 @@ async function configureVSCodeStyle(terminalName, appName) {
11555
10948
  if (!hasOurShiftEnter || !hasOurCtrlEnter) {
11556
10949
  if (!hasOurShiftEnter) keybindings.unshift(shiftEnterBinding);
11557
10950
  if (!hasOurCtrlEnter) keybindings.unshift(ctrlEnterBinding);
11558
- await fs12.writeFile(keybindingsFile, JSON.stringify(keybindings, null, 4));
10951
+ await fs10.writeFile(keybindingsFile, JSON.stringify(keybindings, null, 4));
11559
10952
  return {
11560
10953
  success: true,
11561
10954
  message: t(
@@ -11750,7 +11143,7 @@ init_esbuild_shims();
11750
11143
 
11751
11144
  // packages/cli/src/ui/voice/voice-availability.ts
11752
11145
  init_esbuild_shims();
11753
- import { existsSync as existsSync4 } from "node:fs";
11146
+ import { existsSync as existsSync2 } from "node:fs";
11754
11147
  import process5 from "node:process";
11755
11148
  var SUPPORTED_PLATFORMS = [
11756
11149
  "darwin",
@@ -11765,14 +11158,14 @@ function getVoiceUnavailableReason(environment = {
11765
11158
  platform: process5.platform,
11766
11159
  env: process5.env
11767
11160
  }) {
11768
- const { platform: platform3, env } = environment;
11769
- const fileExists = environment.fileExists ?? existsSync4;
11770
- if (!SUPPORTED_PLATFORMS.includes(platform3)) {
11161
+ const { platform: platform2, env } = environment;
11162
+ const fileExists = environment.fileExists ?? existsSync2;
11163
+ if (!SUPPORTED_PLATFORMS.includes(platform2)) {
11771
11164
  return t("Voice dictation is not supported on {{platform}}.", {
11772
- platform: platform3
11165
+ platform: platform2
11773
11166
  });
11774
11167
  }
11775
- if (platform3 === "linux" && isWsl(env) && !env["PULSE_SERVER"] && !fileExists("/mnt/wslg/PulseServer")) {
11168
+ if (platform2 === "linux" && isWsl(env) && !env["PULSE_SERVER"] && !fileExists("/mnt/wslg/PulseServer")) {
11776
11169
  return t(
11777
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."
11778
11171
  );
@@ -11929,18 +11322,18 @@ var setupGithubCommand = {
11929
11322
 
11930
11323
  // packages/cli/src/ui/commands/insightCommand.ts
11931
11324
  init_esbuild_shims();
11932
- import { join as join9 } from "path";
11325
+ import { join as join7 } from "path";
11933
11326
  import { pathToFileURL } from "node:url";
11934
11327
 
11935
11328
  // packages/cli/src/services/insight/generators/StaticInsightGenerator.ts
11936
11329
  init_esbuild_shims();
11937
- import fs14 from "fs/promises";
11938
- import path17 from "path";
11330
+ import fs12 from "fs/promises";
11331
+ import path15 from "path";
11939
11332
 
11940
11333
  // packages/cli/src/services/insight/generators/DataProcessor.ts
11941
11334
  init_esbuild_shims();
11942
- import fs13 from "fs/promises";
11943
- import path16 from "path";
11335
+ import fs11 from "fs/promises";
11336
+ import path14 from "path";
11944
11337
 
11945
11338
  // packages/cli/node_modules/p-limit/index.js
11946
11339
  init_esbuild_shims();
@@ -12040,27 +11433,27 @@ function pLimit(concurrency) {
12040
11433
  activeCount--;
12041
11434
  resumeNext();
12042
11435
  }, "next");
12043
- const run = /* @__PURE__ */ __name(async (function_, resolve5, arguments_) => {
11436
+ const run = /* @__PURE__ */ __name(async (function_, resolve4, arguments_) => {
12044
11437
  const result = (async () => function_(...arguments_))();
12045
- resolve5(result);
11438
+ resolve4(result);
12046
11439
  try {
12047
11440
  await result;
12048
11441
  } catch {
12049
11442
  }
12050
11443
  next();
12051
11444
  }, "run");
12052
- const enqueue = /* @__PURE__ */ __name((function_, resolve5, reject, arguments_) => {
11445
+ const enqueue = /* @__PURE__ */ __name((function_, resolve4, reject, arguments_) => {
12053
11446
  const queueItem = { reject };
12054
11447
  new Promise((internalResolve) => {
12055
11448
  queueItem.run = internalResolve;
12056
11449
  queue.enqueue(queueItem);
12057
- }).then(run.bind(void 0, function_, resolve5, arguments_));
11450
+ }).then(run.bind(void 0, function_, resolve4, arguments_));
12058
11451
  if (activeCount < concurrency) {
12059
11452
  resumeNext();
12060
11453
  }
12061
11454
  }, "enqueue");
12062
- const generator = /* @__PURE__ */ __name((function_, ...arguments_) => new Promise((resolve5, reject) => {
12063
- enqueue(function_, resolve5, reject, arguments_);
11455
+ const generator = /* @__PURE__ */ __name((function_, ...arguments_) => new Promise((resolve4, reject) => {
11456
+ enqueue(function_, resolve4, reject, arguments_);
12064
11457
  }), "generator");
12065
11458
  Object.defineProperties(generator, {
12066
11459
  activeCount: {
@@ -12894,19 +12287,19 @@ None captured`;
12894
12287
  async scanChatFiles(baseDir) {
12895
12288
  const allChatFiles = [];
12896
12289
  try {
12897
- const projectDirs = await fs13.readdir(baseDir);
12290
+ const projectDirs = await fs11.readdir(baseDir);
12898
12291
  for (const projectDir of projectDirs) {
12899
- const projectPath = path16.join(baseDir, projectDir);
12900
- const stats = await fs13.stat(projectPath);
12292
+ const projectPath = path14.join(baseDir, projectDir);
12293
+ const stats = await fs11.stat(projectPath);
12901
12294
  if (stats.isDirectory()) {
12902
- const chatsDir = path16.join(projectPath, "chats");
12295
+ const chatsDir = path14.join(projectPath, "chats");
12903
12296
  try {
12904
- const files = await fs13.readdir(chatsDir);
12297
+ const files = await fs11.readdir(chatsDir);
12905
12298
  const chatFiles = files.filter((file) => file.endsWith(".jsonl"));
12906
12299
  for (const file of chatFiles) {
12907
- const filePath = path16.join(chatsDir, file);
12300
+ const filePath = path14.join(chatsDir, file);
12908
12301
  try {
12909
- const fileStats = await fs13.stat(filePath);
12302
+ const fileStats = await fs11.stat(filePath);
12910
12303
  allChatFiles.push({ path: filePath, mtime: fileStats.mtimeMs });
12911
12304
  } catch (e) {
12912
12305
  logger.error(`Failed to stat file ${filePath}:`, e);
@@ -13001,7 +12394,7 @@ None captured`;
13001
12394
  overallProgress
13002
12395
  );
13003
12396
  }
13004
- await new Promise((resolve5) => setTimeout(resolve5, 0));
12397
+ await new Promise((resolve4) => setTimeout(resolve4, 0));
13005
12398
  }
13006
12399
  const streakData = this.calculateStreaks(Object.keys(heatmap));
13007
12400
  let longestWorkDuration = 0;
@@ -13084,12 +12477,12 @@ None captured`;
13084
12477
  if (records.length > 0 && facetsOutputDir) {
13085
12478
  const sessionId = records[0].sessionId;
13086
12479
  if (sessionId) {
13087
- const existingFacetPath = path16.join(
12480
+ const existingFacetPath = path14.join(
13088
12481
  facetsOutputDir,
13089
12482
  `${sessionId}.json`
13090
12483
  );
13091
12484
  try {
13092
- const existingData = await fs13.readFile(
12485
+ const existingData = await fs11.readFile(
13093
12486
  existingFacetPath,
13094
12487
  "utf-8"
13095
12488
  );
@@ -13107,7 +12500,7 @@ None captured`;
13107
12500
  const normalizedData = JSON.stringify(normalizedFacet, null, 2);
13108
12501
  if (existingData !== normalizedData) {
13109
12502
  try {
13110
- await fs13.writeFile(
12503
+ await fs11.writeFile(
13111
12504
  existingFacetPath,
13112
12505
  normalizedData,
13113
12506
  "utf-8"
@@ -13142,11 +12535,11 @@ None captured`;
13142
12535
  const facet = await this.analyzeSession(records);
13143
12536
  if (facet && facetsOutputDir) {
13144
12537
  try {
13145
- const facetPath = path16.join(
12538
+ const facetPath = path14.join(
13146
12539
  facetsOutputDir,
13147
12540
  `${facet.session_id}.json`
13148
12541
  );
13149
- await fs13.writeFile(
12542
+ await fs11.writeFile(
13150
12543
  facetPath,
13151
12544
  JSON.stringify(facet, null, 2),
13152
12545
  "utf-8"
@@ -13244,8 +12637,8 @@ var StaticInsightGenerator = class {
13244
12637
  }
13245
12638
  // Ensure the output directory exists
13246
12639
  async ensureOutputDirectory() {
13247
- const outputDir = path17.join(Storage.getRuntimeBaseDir(), "insights");
13248
- await fs14.mkdir(outputDir, { recursive: true });
12640
+ const outputDir = path15.join(Storage.getRuntimeBaseDir(), "insights");
12641
+ await fs12.mkdir(outputDir, { recursive: true });
13249
12642
  return outputDir;
13250
12643
  }
13251
12644
  // Generate timestamped filename with collision detection
@@ -13253,23 +12646,23 @@ var StaticInsightGenerator = class {
13253
12646
  const now = /* @__PURE__ */ new Date();
13254
12647
  const date = now.toISOString().split("T")[0];
13255
12648
  const time = now.toTimeString().slice(0, 8).replace(/:/g, "");
13256
- let outputPath = path17.join(outputDir, `insight-${date}.html`);
12649
+ let outputPath = path15.join(outputDir, `insight-${date}.html`);
13257
12650
  try {
13258
- await fs14.access(outputPath);
13259
- outputPath = path17.join(outputDir, `insight-${date}-${time}.html`);
12651
+ await fs12.access(outputPath);
12652
+ outputPath = path15.join(outputDir, `insight-${date}-${time}.html`);
13260
12653
  } catch {
13261
12654
  }
13262
12655
  return outputPath;
13263
12656
  }
13264
12657
  async updateInsightSymlink(outputDir, targetPath) {
13265
- const latestPath = path17.join(outputDir, "insight.html");
12658
+ const latestPath = path15.join(outputDir, "insight.html");
13266
12659
  await updateSymlink(latestPath, targetPath);
13267
12660
  }
13268
12661
  // Generate the static insight HTML file
13269
12662
  async generateStaticInsight(baseDir, onProgress) {
13270
12663
  const outputDir = await this.ensureOutputDirectory();
13271
- const facetsDir = path17.join(outputDir, "facets");
13272
- await fs14.mkdir(facetsDir, { recursive: true });
12664
+ const facetsDir = path15.join(outputDir, "facets");
12665
+ await fs12.mkdir(facetsDir, { recursive: true });
13273
12666
  const insights = await this.dataProcessor.generateInsights(
13274
12667
  baseDir,
13275
12668
  facetsDir,
@@ -13277,7 +12670,7 @@ var StaticInsightGenerator = class {
13277
12670
  );
13278
12671
  const html = await this.templateRenderer.renderInsightHTML(insights);
13279
12672
  const outputPath = await this.generateOutputPath(outputDir);
13280
- await fs14.writeFile(outputPath, html, "utf-8");
12673
+ await fs12.writeFile(outputPath, html, "utf-8");
13281
12674
  await this.updateInsightSymlink(outputDir, outputPath);
13282
12675
  return outputPath;
13283
12676
  }
@@ -13297,7 +12690,7 @@ var insightCommand = {
13297
12690
  action: /* @__PURE__ */ __name(async (context) => {
13298
12691
  try {
13299
12692
  context.ui.setDebugMessage(t("Generating insights..."));
13300
- const projectsDir = join9(Storage.getRuntimeBaseDir(), "projects");
12693
+ const projectsDir = join7(Storage.getRuntimeBaseDir(), "projects");
13301
12694
  if (!context.services.config) {
13302
12695
  if (context.executionMode !== "interactive") {
13303
12696
  return {
@@ -13340,12 +12733,12 @@ var insightCommand = {
13340
12733
  let isComplete = false;
13341
12734
  let resume = null;
13342
12735
  const flushResume = /* @__PURE__ */ __name(() => {
13343
- const resolve5 = resume;
13344
- if (!resolve5) {
12736
+ const resolve4 = resume;
12737
+ if (!resolve4) {
13345
12738
  return;
13346
12739
  }
13347
12740
  resume = null;
13348
- resolve5();
12741
+ resolve4();
13349
12742
  }, "flushResume");
13350
12743
  const pushMessage = /* @__PURE__ */ __name((message) => {
13351
12744
  pendingMessages.push(message);
@@ -13354,8 +12747,8 @@ var insightCommand = {
13354
12747
  const streamMessages = /* @__PURE__ */ __name(async function* () {
13355
12748
  while (!isComplete || pendingMessages.length > 0) {
13356
12749
  if (pendingMessages.length === 0) {
13357
- await new Promise((resolve5) => {
13358
- resume = resolve5;
12750
+ await new Promise((resolve4) => {
12751
+ resume = resolve4;
13359
12752
  });
13360
12753
  }
13361
12754
  while (pendingMessages.length > 0) {
@@ -13683,6 +13076,7 @@ var BuiltinCommandLoader = class {
13683
13076
  ...this.config?.getFolderTrust() ? [trustCommand] : [],
13684
13077
  quitCommand,
13685
13078
  recapCommand,
13079
+ reloadPluginsCommand,
13686
13080
  renameCommand,
13687
13081
  restoreCommand(this.config),
13688
13082
  resumeCommand,
@@ -13713,8 +13107,8 @@ var BuiltinCommandLoader = class {
13713
13107
 
13714
13108
  // packages/cli/src/services/BundledSkillLoader.ts
13715
13109
  init_esbuild_shims();
13716
- import { dirname as dirname4 } from "node:path";
13717
- var debugLogger13 = createDebugLogger("BUNDLED_SKILL_LOADER");
13110
+ import { dirname as dirname2 } from "node:path";
13111
+ var debugLogger12 = createDebugLogger("BUNDLED_SKILL_LOADER");
13718
13112
  var BundledSkillLoader = class {
13719
13113
  constructor(config) {
13720
13114
  this.config = config;
@@ -13724,12 +13118,12 @@ var BundledSkillLoader = class {
13724
13118
  }
13725
13119
  async loadCommands(_signal) {
13726
13120
  if (this.config?.getBareMode?.()) {
13727
- debugLogger13.debug("Bare mode enabled, skipping bundled skills");
13121
+ debugLogger12.debug("Bare mode enabled, skipping bundled skills");
13728
13122
  return [];
13729
13123
  }
13730
13124
  const skillManager = this.config?.getSkillManager();
13731
13125
  if (!skillManager) {
13732
- debugLogger13.debug("SkillManager not available, skipping bundled skills");
13126
+ debugLogger12.debug("SkillManager not available, skipping bundled skills");
13733
13127
  return [];
13734
13128
  }
13735
13129
  try {
@@ -13737,7 +13131,7 @@ var BundledSkillLoader = class {
13737
13131
  const cronEnabled = this.config?.isCronEnabled() ?? false;
13738
13132
  const cronVisible = allSkills.filter((skill) => {
13739
13133
  if (!cronEnabled && skill.allowedTools?.some((t2) => t2.startsWith("cron_"))) {
13740
- debugLogger13.debug(
13134
+ debugLogger12.debug(
13741
13135
  `Hiding skill "${skill.name}" because cron is not enabled`
13742
13136
  );
13743
13137
  return false;
@@ -13748,7 +13142,7 @@ var BundledSkillLoader = class {
13748
13142
  const skills = cronVisible.filter(
13749
13143
  (skill) => !disabled.has(skill.name.toLowerCase())
13750
13144
  );
13751
- debugLogger13.debug(
13145
+ debugLogger12.debug(
13752
13146
  `Loaded ${skills.length} bundled skill(s) as slash commands; ${cronVisible.length - skills.length} hidden by skills.disabled`
13753
13147
  );
13754
13148
  return skills.map((skill) => ({
@@ -13785,7 +13179,7 @@ ${body}`;
13785
13179
  }
13786
13180
  }
13787
13181
  const skillPrompt = buildSkillLlmContent(
13788
- dirname4(skill.filePath),
13182
+ dirname2(skill.filePath),
13789
13183
  body
13790
13184
  );
13791
13185
  const content = context.invocation?.args ? appendToLastTextPart(
@@ -13799,7 +13193,7 @@ ${body}`;
13799
13193
  }, "action")
13800
13194
  }));
13801
13195
  } catch (error) {
13802
- debugLogger13.error("Failed to load bundled skills:", error);
13196
+ debugLogger12.error("Failed to load bundled skills:", error);
13803
13197
  return [];
13804
13198
  }
13805
13199
  }
@@ -13808,9 +13202,9 @@ ${body}`;
13808
13202
  // packages/cli/src/services/FileCommandLoader.ts
13809
13203
  init_esbuild_shims();
13810
13204
  var import_toml = __toESM(require_toml(), 1);
13811
- import { promises as fs15 } from "node:fs";
13205
+ import { promises as fs13 } from "node:fs";
13812
13206
  import * as fsSync from "node:fs";
13813
- import path19 from "node:path";
13207
+ import path17 from "node:path";
13814
13208
 
13815
13209
  // packages/cli/src/services/markdown-command-parser.ts
13816
13210
  init_esbuild_shims();
@@ -13855,7 +13249,7 @@ __name(parseMarkdownCommand, "parseMarkdownCommand");
13855
13249
 
13856
13250
  // packages/cli/src/services/command-factory.ts
13857
13251
  init_esbuild_shims();
13858
- import path18 from "node:path";
13252
+ import path16 from "node:path";
13859
13253
 
13860
13254
  // packages/cli/src/services/prompt-processors/argumentProcessor.ts
13861
13255
  init_esbuild_shims();
@@ -14079,7 +13473,7 @@ var ShellProcessor = class {
14079
13473
 
14080
13474
  // packages/cli/src/services/prompt-processors/atFileProcessor.ts
14081
13475
  init_esbuild_shims();
14082
- var debugLogger14 = createDebugLogger("AT_FILE_PROCESSOR");
13476
+ var debugLogger13 = createDebugLogger("AT_FILE_PROCESSOR");
14083
13477
  var AtFileProcessor = class {
14084
13478
  constructor(commandName) {
14085
13479
  this.commandName = commandName;
@@ -14125,7 +13519,7 @@ var AtFileProcessor = class {
14125
13519
  } catch (error) {
14126
13520
  const message = error instanceof Error ? error.message : String(error);
14127
13521
  const uiMessage = `Failed to inject content for '@{${pathStr}}': ${message}`;
14128
- debugLogger14.error(
13522
+ debugLogger13.error(
14129
13523
  `[AtFileProcessor] ${uiMessage}. Leaving placeholder in prompt.`
14130
13524
  );
14131
13525
  context.ui.addItem(
@@ -14150,15 +13544,15 @@ var AtFileProcessor = class {
14150
13544
  };
14151
13545
 
14152
13546
  // packages/cli/src/services/command-factory.ts
14153
- var debugLogger15 = createDebugLogger("COMMAND_FACTORY");
13547
+ var debugLogger14 = createDebugLogger("COMMAND_FACTORY");
14154
13548
  function createSlashCommandFromDefinition(filePath, baseDir, definition, extensionName, fileExtension) {
14155
- const relativePathWithExt = path18.relative(baseDir, filePath);
13549
+ const relativePathWithExt = path16.relative(baseDir, filePath);
14156
13550
  const relativePath = relativePathWithExt.substring(
14157
13551
  0,
14158
13552
  relativePathWithExt.length - fileExtension.length
14159
13553
  );
14160
- const baseCommandName = relativePath.split(path18.sep).map((segment) => segment.replaceAll(":", "_")).join(":");
14161
- const defaultDescription = `Custom command from ${path18.basename(filePath)}`;
13554
+ const baseCommandName = relativePath.split(path16.sep).map((segment) => segment.replaceAll(":", "_")).join(":");
13555
+ const defaultDescription = `Custom command from ${path16.basename(filePath)}`;
14162
13556
  let description = definition.description || defaultDescription;
14163
13557
  if (extensionName) {
14164
13558
  description = `[${extensionName}] ${description}`;
@@ -14194,7 +13588,7 @@ function createSlashCommandFromDefinition(filePath, baseDir, definition, extensi
14194
13588
  whenToUse: definition.whenToUse,
14195
13589
  action: /* @__PURE__ */ __name(async (context, _args) => {
14196
13590
  if (!context.invocation) {
14197
- debugLogger15.error(
13591
+ debugLogger14.error(
14198
13592
  `[FileCommandLoader] Critical error: Command '${baseCommandName}' was executed without invocation context.`
14199
13593
  );
14200
13594
  return {
@@ -14232,7 +13626,7 @@ function createSlashCommandFromDefinition(filePath, baseDir, definition, extensi
14232
13626
  __name(createSlashCommandFromDefinition, "createSlashCommandFromDefinition");
14233
13627
 
14234
13628
  // packages/cli/src/services/FileCommandLoader.ts
14235
- var debugLogger16 = createDebugLogger("FILE_COMMAND_LOADER");
13629
+ var debugLogger15 = createDebugLogger("FILE_COMMAND_LOADER");
14236
13630
  var TomlCommandDefSchema = external_exports.object({
14237
13631
  prompt: external_exports.string({
14238
13632
  required_error: "The 'prompt' field is required.",
@@ -14266,7 +13660,7 @@ var FileCommandLoader = class {
14266
13660
  */
14267
13661
  async loadCommands(signal) {
14268
13662
  if (this.config?.getBareMode?.()) {
14269
- debugLogger16.debug("Bare mode enabled, skipping auto-discovered commands");
13663
+ debugLogger15.debug("Bare mode enabled, skipping auto-discovered commands");
14270
13664
  return [];
14271
13665
  }
14272
13666
  const allCommands = [];
@@ -14292,14 +13686,14 @@ var FileCommandLoader = class {
14292
13686
  }
14293
13687
  const tomlCommandPromises = tomlFiles.map(
14294
13688
  (file) => this.parseAndAdaptTomlFile(
14295
- path19.join(dirInfo.path, file),
13689
+ path17.join(dirInfo.path, file),
14296
13690
  dirInfo.path,
14297
13691
  dirInfo.extensionName
14298
13692
  )
14299
13693
  );
14300
13694
  const mdCommandPromises = mdFiles.map(
14301
13695
  (file) => this.parseAndAdaptMarkdownFile(
14302
- path19.join(dirInfo.path, file),
13696
+ path17.join(dirInfo.path, file),
14303
13697
  dirInfo.path,
14304
13698
  dirInfo.extensionName
14305
13699
  )
@@ -14310,7 +13704,7 @@ var FileCommandLoader = class {
14310
13704
  const isEnoent = error.code === "ENOENT";
14311
13705
  const isAbortError = error instanceof Error && error.name === "AbortError";
14312
13706
  if (!isEnoent && !isAbortError) {
14313
- debugLogger16.error(
13707
+ debugLogger15.error(
14314
13708
  `[FileCommandLoader] Error loading commands from ${dirInfo.path}:`,
14315
13709
  error
14316
13710
  );
@@ -14349,14 +13743,14 @@ var FileCommandLoader = class {
14349
13743
  */
14350
13744
  getExtensionCommandsPaths(ext) {
14351
13745
  try {
14352
- const configPath = path19.join(ext.path, EXTENSIONS_CONFIG_FILENAME);
13746
+ const configPath = path17.join(ext.path, EXTENSIONS_CONFIG_FILENAME);
14353
13747
  if (fsSync.existsSync(configPath)) {
14354
13748
  const configContent = fsSync.readFileSync(configPath, "utf-8");
14355
13749
  const config = JSON.parse(configContent);
14356
13750
  if (config.commands) {
14357
13751
  const commandsArray = Array.isArray(config.commands) ? config.commands : [config.commands];
14358
13752
  return commandsArray.map(
14359
- (cmdPath) => path19.isAbsolute(cmdPath) ? cmdPath : path19.join(ext.path, cmdPath)
13753
+ (cmdPath) => path17.isAbsolute(cmdPath) ? cmdPath : path17.join(ext.path, cmdPath)
14360
13754
  ).filter((cmdPath) => {
14361
13755
  try {
14362
13756
  return fsSync.existsSync(cmdPath);
@@ -14367,12 +13761,12 @@ var FileCommandLoader = class {
14367
13761
  }
14368
13762
  }
14369
13763
  } catch (error) {
14370
- debugLogger16.warn(
13764
+ debugLogger15.warn(
14371
13765
  `Failed to read extension config for ${ext.name}:`,
14372
13766
  error
14373
13767
  );
14374
13768
  }
14375
- const defaultPath = path19.join(ext.path, "commands");
13769
+ const defaultPath = path17.join(ext.path, "commands");
14376
13770
  try {
14377
13771
  if (fsSync.existsSync(defaultPath)) {
14378
13772
  return [defaultPath];
@@ -14391,9 +13785,9 @@ var FileCommandLoader = class {
14391
13785
  async parseAndAdaptTomlFile(filePath, baseDir, extensionName) {
14392
13786
  let fileContent;
14393
13787
  try {
14394
- fileContent = await fs15.readFile(filePath, "utf-8");
13788
+ fileContent = await fs13.readFile(filePath, "utf-8");
14395
13789
  } catch (error) {
14396
- debugLogger16.error(
13790
+ debugLogger15.error(
14397
13791
  `[FileCommandLoader] Failed to read file ${filePath}:`,
14398
13792
  error instanceof Error ? error.message : String(error)
14399
13793
  );
@@ -14403,7 +13797,7 @@ var FileCommandLoader = class {
14403
13797
  try {
14404
13798
  parsed = import_toml.default.parse(fileContent);
14405
13799
  } catch (error) {
14406
- debugLogger16.error(
13800
+ debugLogger15.error(
14407
13801
  `[FileCommandLoader] Failed to parse TOML file ${filePath}:`,
14408
13802
  error instanceof Error ? error.message : String(error)
14409
13803
  );
@@ -14411,7 +13805,7 @@ var FileCommandLoader = class {
14411
13805
  }
14412
13806
  const validationResult = TomlCommandDefSchema.safeParse(parsed);
14413
13807
  if (!validationResult.success) {
14414
- debugLogger16.error(
13808
+ debugLogger15.error(
14415
13809
  `[FileCommandLoader] Skipping invalid command file: ${filePath}. Validation errors:`,
14416
13810
  validationResult.error.flatten()
14417
13811
  );
@@ -14436,9 +13830,9 @@ var FileCommandLoader = class {
14436
13830
  async parseAndAdaptMarkdownFile(filePath, baseDir, extensionName) {
14437
13831
  let fileContent;
14438
13832
  try {
14439
- fileContent = await fs15.readFile(filePath, "utf-8");
13833
+ fileContent = await fs13.readFile(filePath, "utf-8");
14440
13834
  } catch (error) {
14441
- debugLogger16.error(
13835
+ debugLogger15.error(
14442
13836
  `[FileCommandLoader] Failed to read file ${filePath}:`,
14443
13837
  error instanceof Error ? error.message : String(error)
14444
13838
  );
@@ -14448,7 +13842,7 @@ var FileCommandLoader = class {
14448
13842
  try {
14449
13843
  parsed = parseMarkdownCommand(fileContent);
14450
13844
  } catch (error) {
14451
- debugLogger16.error(
13845
+ debugLogger15.error(
14452
13846
  `[FileCommandLoader] Failed to parse Markdown file ${filePath}:`,
14453
13847
  error instanceof Error ? error.message : String(error)
14454
13848
  );
@@ -14456,7 +13850,7 @@ var FileCommandLoader = class {
14456
13850
  }
14457
13851
  const validationResult = MarkdownCommandDefSchema.safeParse(parsed);
14458
13852
  if (!validationResult.success) {
14459
- debugLogger16.error(
13853
+ debugLogger15.error(
14460
13854
  `[FileCommandLoader] Skipping invalid command file: ${filePath}. Validation errors:`,
14461
13855
  validationResult.error.flatten()
14462
13856
  );
@@ -14482,7 +13876,7 @@ var FileCommandLoader = class {
14482
13876
 
14483
13877
  // packages/cli/src/services/saved-workflow-loader.ts
14484
13878
  init_esbuild_shims();
14485
- var debugLogger17 = createDebugLogger("SavedWorkflowLoader");
13879
+ var debugLogger16 = createDebugLogger("SavedWorkflowLoader");
14486
13880
  var SavedWorkflowLoader = class {
14487
13881
  constructor(config) {
14488
13882
  this.config = config;
@@ -14501,7 +13895,7 @@ var SavedWorkflowLoader = class {
14501
13895
  try {
14502
13896
  entries = await listSavedWorkflows(this.config);
14503
13897
  } catch (e) {
14504
- debugLogger17.debug(`listSavedWorkflows failed: ${e}`);
13898
+ debugLogger16.debug(`listSavedWorkflows failed: ${e}`);
14505
13899
  return [];
14506
13900
  }
14507
13901
  if (signal.aborted) return [];
@@ -14798,8 +14192,8 @@ var McpPromptLoader = class {
14798
14192
 
14799
14193
  // packages/cli/src/services/SkillCommandLoader.ts
14800
14194
  init_esbuild_shims();
14801
- import { dirname as dirname5 } from "node:path";
14802
- var debugLogger18 = createDebugLogger("SKILL_COMMAND_LOADER");
14195
+ import { dirname as dirname3 } from "node:path";
14196
+ var debugLogger17 = createDebugLogger("SKILL_COMMAND_LOADER");
14803
14197
  var SkillCommandLoader = class {
14804
14198
  constructor(config) {
14805
14199
  this.config = config;
@@ -14809,12 +14203,12 @@ var SkillCommandLoader = class {
14809
14203
  }
14810
14204
  async loadCommands(_signal) {
14811
14205
  if (this.config?.getBareMode?.()) {
14812
- debugLogger18.debug("Bare mode enabled, skipping skill commands");
14206
+ debugLogger17.debug("Bare mode enabled, skipping skill commands");
14813
14207
  return [];
14814
14208
  }
14815
14209
  const skillManager = this.config?.getSkillManager();
14816
14210
  if (!skillManager) {
14817
- debugLogger18.debug("SkillManager not available, skipping skill commands");
14211
+ debugLogger17.debug("SkillManager not available, skipping skill commands");
14818
14212
  return [];
14819
14213
  }
14820
14214
  try {
@@ -14831,7 +14225,7 @@ var SkillCommandLoader = class {
14831
14225
  const nonUserInvocableCount = visibleSkills.filter(
14832
14226
  (skill) => skill.userInvocable === false
14833
14227
  ).length;
14834
- debugLogger18.debug(
14228
+ debugLogger17.debug(
14835
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`
14836
14230
  );
14837
14231
  return visibleSkills.map((skill) => {
@@ -14862,7 +14256,7 @@ var SkillCommandLoader = class {
14862
14256
  skill.allowedTools
14863
14257
  );
14864
14258
  const body = buildSkillLlmContent(
14865
- dirname5(skill.filePath),
14259
+ dirname3(skill.filePath),
14866
14260
  skill.body
14867
14261
  );
14868
14262
  const content = context.invocation?.args ? appendToLastTextPart([{ text: body }], context.invocation.raw) : [{ text: body }];
@@ -14874,7 +14268,7 @@ var SkillCommandLoader = class {
14874
14268
  };
14875
14269
  });
14876
14270
  } catch (error) {
14877
- debugLogger18.error("Failed to load skill commands:", error);
14271
+ debugLogger17.error("Failed to load skill commands:", error);
14878
14272
  return [];
14879
14273
  }
14880
14274
  }
@@ -14949,7 +14343,7 @@ function formatUserPromptExpansionBlockedMessage(reason) {
14949
14343
  __name(formatUserPromptExpansionBlockedMessage, "formatUserPromptExpansionBlockedMessage");
14950
14344
 
14951
14345
  // packages/cli/src/nonInteractiveCliCommands.ts
14952
- var debugLogger19 = createDebugLogger("NON_INTERACTIVE_COMMANDS");
14346
+ var debugLogger18 = createDebugLogger("NON_INTERACTIVE_COMMANDS");
14953
14347
  function getSkillCommandName(command) {
14954
14348
  return command.skillDetail?.name ?? command.name;
14955
14349
  }
@@ -15160,6 +14554,60 @@ var handleSlashCommand = /* @__PURE__ */ __name(async (rawQuery, abortController
15160
14554
  rawQuery,
15161
14555
  filteredCommands
15162
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
+ }
15163
14611
  if (!commandToExecute) {
15164
14612
  const { commandToExecute: knownCommand } = parseSlashCommand(
15165
14613
  rawQuery,
@@ -15298,14 +14746,14 @@ var getAvailableCommands = /* @__PURE__ */ __name(async (config, abortSignal, mo
15298
14746
  );
15299
14747
  return commandService.getCommandsForMode(mode);
15300
14748
  } catch (error) {
15301
- debugLogger19.error("Error loading available commands:", error);
14749
+ debugLogger18.error("Error loading available commands:", error);
15302
14750
  return [];
15303
14751
  }
15304
14752
  }, "getAvailableCommands");
15305
14753
 
15306
14754
  // packages/cli/src/utils/nonInteractiveHelpers.ts
15307
14755
  init_esbuild_shims();
15308
- var debugLogger20 = createDebugLogger("NON_INTERACTIVE");
14756
+ var debugLogger19 = createDebugLogger("NON_INTERACTIVE");
15309
14757
  function normalizePartList(parts) {
15310
14758
  if (!parts) {
15311
14759
  return [];
@@ -15403,7 +14851,7 @@ async function loadSlashCommandNames(config) {
15403
14851
  );
15404
14852
  return commands.map((cmd) => cmd.name).sort();
15405
14853
  } catch (error) {
15406
- debugLogger20.error(
14854
+ debugLogger19.error(
15407
14855
  "[buildSystemMessage] Failed to load slash commands:",
15408
14856
  error
15409
14857
  );
@@ -15428,7 +14876,7 @@ async function buildSystemMessage(config, sessionId, permissionMode) {
15428
14876
  const subagents = await subagentManager.listSubagents();
15429
14877
  agentNames = subagents.map((subagent) => subagent.name);
15430
14878
  } catch (error) {
15431
- debugLogger20.error("[buildSystemMessage] Failed to load subagents:", error);
14879
+ debugLogger19.error("[buildSystemMessage] Failed to load subagents:", error);
15432
14880
  }
15433
14881
  const systemMessage = {
15434
14882
  type: "system",
@@ -15589,7 +15037,9 @@ function functionResponsePartsToString(parts) {
15589
15037
  __name(functionResponsePartsToString, "functionResponsePartsToString");
15590
15038
 
15591
15039
  export {
15040
+ MAX_STACKED_SKILLS,
15592
15041
  parseSlashCommand,
15042
+ parseStackedSlashCommands,
15593
15043
  CommandService,
15594
15044
  useAutoAcceptIndicator,
15595
15045
  formatApprovalModeName,
@@ -15604,8 +15054,6 @@ export {
15604
15054
  findMidInputSlashCommand,
15605
15055
  getBestSlashCommandMatch,
15606
15056
  findSlashCommandTokens,
15607
- performStandaloneUpdate,
15608
- getInstallationInfo,
15609
15057
  recordGoalStatusItem,
15610
15058
  restoreGoalFromHistory,
15611
15059
  getTranslatedSourceDisplayMap,
@@ -15614,6 +15062,7 @@ export {
15614
15062
  createEmptyHookEventInfo,
15615
15063
  addConfigToMatcherGroup,
15616
15064
  getAllConfigs,
15065
+ refreshExtensionContentRuntime,
15617
15066
  BuiltinCommandLoader,
15618
15067
  BundledSkillLoader,
15619
15068
  FileCommandLoader,