@qwen-code/qwen-code 0.21.8 → 0.21.9

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 (258) hide show
  1. package/README.md +2 -1
  2. package/bundled/qc-helper/docs/configuration/settings.md +32 -30
  3. package/bundled/qc-helper/docs/extension/introduction.md +15 -1
  4. package/bundled/qc-helper/docs/features/code-review.md +2 -0
  5. package/bundled/qc-helper/docs/qwen-serve-deploy-local.md +1 -1
  6. package/bundled/qc-helper/docs/qwen-serve.md +42 -39
  7. package/bundled/review/SKILL.md +11 -7
  8. package/chunks/{MaxSizedBox-7PM6BGJ5.js → MaxSizedBox-6BZANW7X.js} +9 -9
  9. package/chunks/{StandaloneSessionPicker-3UQHM7GV.js → StandaloneSessionPicker-VDC5KE7T.js} +28 -25
  10. package/chunks/{acpAgent-5UWLFV6V.js → acpAgent-F2NSBCUF.js} +1433 -706
  11. package/chunks/{agent-624T2BLO.js → agent-VOHJOEBB.js} +8 -8
  12. package/chunks/{agent-headless-2EE5J2KX.js → agent-headless-J5NFOPHP.js} +8 -8
  13. package/chunks/{bridge-JENKGFFP.js → bridge-NQIZZLAS.js} +13 -13
  14. package/chunks/{channel-management-service-DDWUPHMU.js → channel-management-service-PHELKOW2.js} +4 -4
  15. package/chunks/{channel-settings-store-SA6JZSPH.js → channel-settings-store-VIY2OENO.js} +17 -15
  16. package/chunks/{channel-worker-group-E67EN3RV.js → channel-worker-group-MSHT6CWR.js} +6 -6
  17. package/chunks/{channel-worker-manager-SW4C45CF.js → channel-worker-manager-XXD3GDSK.js} +6 -6
  18. package/chunks/{channel-worker-supervisor-5SRD24FG.js → channel-worker-supervisor-IVSDIMI4.js} +4 -4
  19. package/chunks/{chunk-S3Y3GBFD.js → chunk-23VQTELM.js} +2 -2
  20. package/chunks/{chunk-XZKQT2B2.js → chunk-3WDYBTTI.js} +5 -5
  21. package/chunks/{chunk-YEF7XEO2.js → chunk-3XVDTHBJ.js} +3 -3
  22. package/chunks/{chunk-IBYULW65.js → chunk-46YJDYCU.js} +145 -10
  23. package/chunks/chunk-4JRM2BSM.js +48 -0
  24. package/chunks/{chunk-L4N6TIP7.js → chunk-4TRQPFDP.js} +4 -2
  25. package/chunks/{chunk-5ZGR6RKJ.js → chunk-4XQNB3KN.js} +3 -3
  26. package/chunks/chunk-5EJZE3FP.js +140 -0
  27. package/chunks/{chunk-XHD7CRP2.js → chunk-5RBDAGC6.js} +2 -2
  28. package/chunks/{chunk-KJZ26VBX.js → chunk-67EWJE77.js} +1 -1
  29. package/chunks/{chunk-TE3ZAJE7.js → chunk-6Q5ABMTU.js} +1 -1
  30. package/chunks/{chunk-U5SLIG7E.js → chunk-7AEPJGL4.js} +1 -1
  31. package/chunks/{chunk-OHKJVAKG.js → chunk-7GOYZQPR.js} +20 -1977
  32. package/chunks/{chunk-3SE7J4DR.js → chunk-7S4JBJLU.js} +3 -3
  33. package/chunks/{chunk-TKSZJ5BV.js → chunk-AKJQSWV4.js} +3 -3
  34. package/chunks/{chunk-E4ZBKMSF.js → chunk-ATMO54WE.js} +6 -6
  35. package/chunks/{chunk-KKDVZLGL.js → chunk-BAMN6XSD.js} +1 -1
  36. package/chunks/{chunk-IUQ52YJK.js → chunk-BIRWP6LU.js} +1 -1
  37. package/chunks/{chunk-AKA24BGO.js → chunk-BT6GQIEJ.js} +1 -1
  38. package/chunks/{chunk-ZCLLJARV.js → chunk-BZP4QPNK.js} +10 -10
  39. package/chunks/{chunk-2M5N3DHY.js → chunk-CMOBWHWW.js} +1 -1
  40. package/chunks/{chunk-WV5J6Q6N.js → chunk-D7BXVKSF.js} +1 -1
  41. package/chunks/{chunk-NLREQJFK.js → chunk-DA4HRSBW.js} +15 -0
  42. package/chunks/{chunk-GOEVOFQI.js → chunk-DH5YXSIF.js} +3 -3
  43. package/chunks/{chunk-DIWZNWZT.js → chunk-DX3RGJMS.js} +13 -2
  44. package/chunks/{chunk-PLFATELK.js → chunk-DZUO626D.js} +1 -1
  45. package/chunks/{chunk-NGYI5EF5.js → chunk-E2FPSSKP.js} +8 -8
  46. package/chunks/{chunk-ZPLALRXZ.js → chunk-FBMCDU63.js} +4 -137
  47. package/chunks/{chunk-2ILAOM2I.js → chunk-FCLHHEUK.js} +17 -16
  48. package/chunks/{chunk-SNRT2TJJ.js → chunk-G2TX5ZXC.js} +3 -3
  49. package/chunks/{chunk-C5VWPTGT.js → chunk-GAKGOXTC.js} +1 -1
  50. package/chunks/{chunk-QQWD7LZV.js → chunk-HADWBW5R.js} +4 -4
  51. package/chunks/{chunk-77QVBFCU.js → chunk-HZGBKOX3.js} +3 -3
  52. package/chunks/{chunk-RPWVIXDB.js → chunk-I5VM3SKY.js} +4 -4
  53. package/chunks/{chunk-7VUERJHS.js → chunk-II6G3EY6.js} +325 -104
  54. package/chunks/{chunk-FN6YXJOP.js → chunk-IOEZE2YT.js} +1 -1
  55. package/chunks/chunk-JUWS2Z5K.js +1995 -0
  56. package/chunks/{chunk-VXZ5HAOV.js → chunk-K4ADGWHU.js} +1 -1
  57. package/chunks/{chunk-YOM7DEGB.js → chunk-KSAFZ5TA.js} +2 -2
  58. package/chunks/{chunk-KAQCJO6Y.js → chunk-KTKYGS2P.js} +35 -9
  59. package/chunks/{chunk-GBDINRIL.js → chunk-KTQGGPGV.js} +3 -3
  60. package/chunks/{chunk-6M26GBKX.js → chunk-L2AFWWJE.js} +42 -3
  61. package/chunks/{chunk-QXVSWG66.js → chunk-LHEC5V6G.js} +2 -2
  62. package/chunks/{chunk-J26HHFI5.js → chunk-LP2QGNSP.js} +32 -2
  63. package/chunks/{chunk-HWX5HPUG.js → chunk-LZZLUCRS.js} +108 -11
  64. package/chunks/{chunk-KTJFU7RT.js → chunk-MFDYOYZZ.js} +2 -2
  65. package/chunks/{chunk-3WNQOYHQ.js → chunk-MHP476D3.js} +74 -31
  66. package/chunks/{chunk-Y4TETC74.js → chunk-MTCYGTWH.js} +4 -4
  67. package/chunks/{chunk-EN2TKTFH.js → chunk-NV3F44FL.js} +6 -2
  68. package/chunks/{chunk-BF52U4XJ.js → chunk-OGDIJKHK.js} +1 -1
  69. package/chunks/{chunk-7DVT4LVV.js → chunk-OGNFHGIG.js} +3 -3
  70. package/chunks/{chunk-IYES5WOT.js → chunk-P2FK2HBV.js} +2 -2
  71. package/chunks/{chunk-2M4K4KYS.js → chunk-P3RBMQ4P.js} +4 -4
  72. package/chunks/{chunk-FYAXKJK7.js → chunk-P4ZEZSJZ.js} +692 -106
  73. package/chunks/{chunk-UFALT4LK.js → chunk-PBRVUF5B.js} +1 -1
  74. package/chunks/{chunk-LKRMNRSN.js → chunk-PDPFQ2FO.js} +2 -0
  75. package/chunks/{chunk-6TR7CFXH.js → chunk-PNBBJOCP.js} +1 -1
  76. package/chunks/{chunk-M3STHEMM.js → chunk-PVOGHGSF.js} +5 -5
  77. package/chunks/{chunk-4WU6NY7F.js → chunk-QSNSL4R4.js} +2 -2
  78. package/chunks/{chunk-DQSDACD2.js → chunk-RBHQXGDK.js} +1 -1
  79. package/chunks/{chunk-ZHA242R4.js → chunk-RVSTTOJ4.js} +2 -2
  80. package/chunks/{chunk-EIVICVHM.js → chunk-SCAZZ3Q4.js} +4 -4
  81. package/chunks/{chunk-BF224XHL.js → chunk-T5RLUXWJ.js} +2 -2
  82. package/chunks/{chunk-B52AWKBB.js → chunk-T6HEQR2Q.js} +16 -5
  83. package/chunks/{chunk-FWBXMANW.js → chunk-THIKWITR.js} +3 -3
  84. package/chunks/{chunk-WG6542MA.js → chunk-TQCYNLNJ.js} +1 -1
  85. package/chunks/chunk-TQOF5KBL.js +71 -0
  86. package/chunks/{chunk-NPUXXRJI.js → chunk-TZ6KJ44L.js} +1 -1
  87. package/chunks/{chunk-YHJFF7KH.js → chunk-UJUM2SRN.js} +147 -47
  88. package/chunks/{chunk-4ALIARFY.js → chunk-UYAUA63Q.js} +1 -1
  89. package/chunks/chunk-VFMASYQA.js +389 -0
  90. package/chunks/chunk-VGHZT6JR.js +51 -0
  91. package/chunks/{chunk-ZWBUH5UP.js → chunk-VKJ4KTPJ.js} +1 -1
  92. package/chunks/{chunk-QGHSP65Z.js → chunk-VNNWAZSI.js} +2 -2
  93. package/chunks/{chunk-757GB46F.js → chunk-W3FSZSF2.js} +1 -1
  94. package/chunks/{chunk-GQCEQPYQ.js → chunk-WGK4TSB7.js} +3 -3
  95. package/chunks/{chunk-PG62DFWD.js → chunk-WP5VOXF7.js} +6 -127
  96. package/chunks/{chunk-NVRDQFCX.js → chunk-XTY5DN4Y.js} +1 -1
  97. package/chunks/{chunk-GXSNGY5M.js → chunk-XX7QFP34.js} +1677 -1307
  98. package/chunks/{chunk-3PY4LPJF.js → chunk-YGT2AUJ7.js} +84 -4
  99. package/chunks/{chunk-4DU3NCHG.js → chunk-YTFDX4PR.js} +8 -3
  100. package/chunks/{chunk-OA4JVLSA.js → chunk-Z7VOMGDC.js} +22 -1
  101. package/chunks/{chunk-DX5W5AON.js → chunk-ZBXGWQ4S.js} +3 -3
  102. package/chunks/chunk-ZLBIFIMV.js +1099 -0
  103. package/chunks/{chunk-HA3SAB64.js → chunk-ZOSTTOUJ.js} +1 -1
  104. package/chunks/{chunk-VWMUDKLC.js → chunk-ZTQSOV56.js} +4 -4
  105. package/chunks/{computer-use-ESQYJ3JY.js → computer-use-PMZ7ICGY.js} +8 -8
  106. package/chunks/{config-utils-XQHBJP7G.js → config-utils-ULCSRMWD.js} +4 -4
  107. package/chunks/{contextCommand-CX3YF4ZE.js → contextCommand-GEZU7YHE.js} +11 -10
  108. package/chunks/{core-runtime-DIAU7JMG.js → core-runtime-HRJI2MN6.js} +8 -8
  109. package/chunks/{create-sub-session-HDPD6HOA.js → create-sub-session-VBNVI4YU.js} +9 -9
  110. package/chunks/{daemon-VZBGJUNL.js → daemon-POSQPD3G.js} +115 -7
  111. package/chunks/{daemon-status-provider-H6O4UQ4F.js → daemon-status-provider-N4CRQKFI.js} +18 -18
  112. package/chunks/{daemon-trust-policy-BNUXG6MT.js → daemon-trust-policy-BHO3JUHM.js} +16 -14
  113. package/chunks/{daemon-trust-policy-monitor-E4EQ7GF4.js → daemon-trust-policy-monitor-YEKJ2726.js} +16 -14
  114. package/chunks/{deferred-core-runtime-CBMSHPAU.js → deferred-core-runtime-SH57E3J3.js} +8 -8
  115. package/chunks/{dist-KVISB2O2.js → dist-3NTTUAHT.js} +1 -1
  116. package/chunks/{dist-RCH3I7SS.js → dist-6BMOAE3Z.js} +2 -2
  117. package/chunks/{dist-IRL7WA5Z.js → dist-B2CGTW6T.js} +1 -1
  118. package/chunks/{dist-TUSWNE2I.js → dist-EWW3J4HQ.js} +1 -1
  119. package/chunks/{dist-HIACTZEK.js → dist-EZE3V3Q7.js} +1 -1
  120. package/chunks/{dist-EEEQGCZA.js → dist-J47AXBZC.js} +1 -1
  121. package/chunks/{dist-MKX5OSFF.js → dist-OTUO3AS2.js} +4 -1088
  122. package/chunks/{dist-MBF3I5MX.js → dist-Z3CS4OVP.js} +1 -1
  123. package/chunks/{earlyInputCapture-UIOP7OIN.js → earlyInputCapture-B2JJ2HME.js} +8 -8
  124. package/chunks/{edit-ITMZYFKA.js → edit-7FTXENAN.js} +10 -8
  125. package/chunks/{enter-worktree-S4PL5UV6.js → enter-worktree-JPHV2PBG.js} +8 -8
  126. package/chunks/{enterPlanMode-YV52NNJT.js → enterPlanMode-CGBJ3AHJ.js} +8 -8
  127. package/chunks/{environment-NGOWPRZV.js → environment-LXASZAHD.js} +11 -11
  128. package/chunks/{errors-BU26DTDX.js → errors-XIGVT2AD.js} +10 -10
  129. package/chunks/{exit-worktree-XRM6LH5F.js → exit-worktree-DKSGXW65.js} +8 -8
  130. package/chunks/{exitPlanMode-ZLI5F7KR.js → exitPlanMode-THFL2HYN.js} +8 -8
  131. package/chunks/{fast-path-UJWORIED.js → fast-path-4NXAT5UL.js} +4 -3
  132. package/chunks/{fast-path-settings-37WQD5B2.js → fast-path-settings-RPAVBD7P.js} +2 -2
  133. package/chunks/{gemini-ZSKNDUMU.js → gemini-B3N6FACU.js} +56 -60
  134. package/chunks/{geminiContentGenerator-YGEXOEKD.js → geminiContentGenerator-YYFE2HIE.js} +1 -1
  135. package/chunks/{glob-7KZG44BR.js → glob-BPHSCFJP.js} +8 -8
  136. package/chunks/{grep-6ZFC7RJ5.js → grep-ROZIRFLU.js} +8 -8
  137. package/chunks/{handleAutoUpdate-KSEL3TQS.js → handleAutoUpdate-WV6SPZQB.js} +13 -12
  138. package/chunks/{i18n-ZIUXBW5V.js → i18n-YWJWPQKD.js} +13 -11
  139. package/chunks/{image-gen-AUIZJJNK.js → image-gen-SISRZ6FS.js} +1 -1
  140. package/chunks/{initializer-7AHY3N6Q.js → initializer-66OAD6GO.js} +16 -14
  141. package/chunks/{installationInfo-VGBXMYLY.js → installationInfo-3YUGIP36.js} +9 -9
  142. package/chunks/{list-PSFKQHLB.js → list-VEYR66XB.js} +19 -17
  143. package/chunks/{loadedSettingsAdapter-FTMRCTOF.js → loadedSettingsAdapter-V2JCPCYD.js} +16 -14
  144. package/chunks/{loggingContentGenerator-MZAN52UV.js → loggingContentGenerator-RBLNDREC.js} +6 -6
  145. package/chunks/main-PXAUXNF2.js +8 -0
  146. package/chunks/{managed-npm-update-O4NHK45X.js → managed-npm-update-C5ID5R4R.js} +9 -9
  147. package/chunks/{mcp-6CFP2AYQ.js → mcp-OZ54NZJQ.js} +16 -14
  148. package/chunks/{monitor-DAKD6OU4.js → monitor-7Y4TVFTK.js} +18 -14
  149. package/chunks/{nonInteractiveCli-RC7VIUZL.js → nonInteractiveCli-QEK4LHAC.js} +51 -49
  150. package/chunks/{notebook-edit-474DPMRL.js → notebook-edit-OG35EBGY.js} +9 -8
  151. package/chunks/{openaiContentGenerator-2NFY2MWO.js → openaiContentGenerator-443BNRPJ.js} +5 -5
  152. package/chunks/{pidfile-KBFVDNQP.js → pidfile-ZK4OLRZA.js} +8 -8
  153. package/chunks/{processUtils-6GRYH4Y3.js → processUtils-4YGB4RUZ.js} +2 -2
  154. package/chunks/{qwenContentGenerator-KAHU6IZY.js → qwenContentGenerator-D5C2LCSZ.js} +9 -9
  155. package/chunks/{qwenOAuth2-RRQTCP4W.js → qwenOAuth2-Z4YQBMYN.js} +1 -1
  156. package/chunks/{read-file-3M6WXDXP.js → read-file-EXTJLWMU.js} +4 -4
  157. package/chunks/{resumeHistoryUtils-D6TAY3HX.js → resumeHistoryUtils-UPCGRJUL.js} +13 -12
  158. package/chunks/{ripGrep-PLPENT3E.js → ripGrep-QBVIRCU4.js} +8 -8
  159. package/chunks/{run-qwen-serve-ZAFIJKJC.js → run-qwen-serve-ZYGJNE3E.js} +169 -68
  160. package/chunks/{runtime-ZED7CYOZ.js → runtime-BZZ4LWCP.js} +21 -19
  161. package/chunks/{scheduler-MD3AL2W5.js → scheduler-YNQNOU2E.js} +135 -15
  162. package/chunks/{sdk-exporters-http-KHAB5JSD.js → sdk-exporters-http-XVTZQRCE.js} +2 -2
  163. package/chunks/{sdk-impl-KD7FSTC3.js → sdk-impl-7W7AKCS4.js} +7 -3
  164. package/chunks/{serve-E3VUDRZN.js → serve-LJHAXDCH.js} +18 -14
  165. package/chunks/{server-OWMEMAKR.js → server-ADMLELR6.js} +1229 -1098
  166. package/chunks/{session-HZ57QK7K.js → session-YKZXFFTM.js} +55 -53
  167. package/chunks/{settings-V7BR3RKP.js → settings-EQBUAQ7Y.js} +15 -13
  168. package/chunks/{shell-23OMNMW6.js → shell-3QZOJGTT.js} +8 -8
  169. package/chunks/{skill-6HBDYZRS.js → skill-UWSSMXE7.js} +5 -5
  170. package/chunks/{skill-settings-HWJLTU7M.js → skill-settings-T6MLB7NU.js} +15 -13
  171. package/chunks/{spawnChannel-N6KKUW5B.js → spawnChannel-VS7ZFUFP.js} +11 -11
  172. package/chunks/{standalone-update-QGIKHATD.js → standalone-update-2W26SRRO.js} +11 -10
  173. package/chunks/{startInteractiveUI-GX2CRL42.js → startInteractiveUI-CVS7K3D6.js} +86 -75
  174. package/chunks/{team-create-CFFKU7KL.js → team-create-4WFTNNUL.js} +8 -8
  175. package/chunks/{team-plan-approval-6EFOKR6A.js → team-plan-approval-DBYI33S3.js} +8 -8
  176. package/chunks/{terminal-image-renderer-TLDNACQY.js → terminal-image-renderer-S5WPPQKH.js} +8 -8
  177. package/chunks/{theme-manager-5LJ3H7VO.js → theme-manager-LI2RIOVR.js} +8 -8
  178. package/chunks/{tool-search-UJV3A24H.js → tool-search-4773EUQ4.js} +4 -4
  179. package/chunks/{total-session-admission-D63QYXGO.js → total-session-admission-PAY5CH2Z.js} +16 -15
  180. package/chunks/{trustedFolders-KZCOB53W.js → trustedFolders-FRSLE674.js} +9 -9
  181. package/chunks/{types-ML3TRJQ5.js → types-WYCFCEHR.js} +5 -3
  182. package/chunks/{update-relaunch-IFILM3SA.js → update-relaunch-ZSFQTU6M.js} +5 -5
  183. package/chunks/{updateCheck-YZ2CRCFC.js → updateCheck-AXWSO7KA.js} +12 -11
  184. package/chunks/{useAutoAcceptIndicator-AXEVNA3Q.js → useAutoAcceptIndicator-VHLXIA7U.js} +18 -16
  185. package/chunks/{validateNonInterActiveAuth-3WTOJFWA.js → validateNonInterActiveAuth-PDJECMFU.js} +48 -46
  186. package/chunks/{version-GXK7OHZY.js → version-RBN764QS.js} +1 -1
  187. package/chunks/{web-fetch-ILB4GAVR.js → web-fetch-7BJK42AF.js} +4 -4
  188. package/chunks/{web-search-HKRPGPZZ.js → web-search-L2CILQXV.js} +4 -3
  189. package/chunks/{workflow-FXIPRQQA.js → workflow-5VH2R74I.js} +170 -137
  190. package/chunks/{workspace-providers-status-NYHC7HSR.js → workspace-providers-status-OZTQ6JFH.js} +19 -17
  191. package/chunks/{workspace-registration-store-AKEB7OMW.js → workspace-registration-store-IX5RJQS5.js} +1 -1
  192. package/chunks/{workspace-registry-CDAS5TVZ.js → workspace-registry-73N4BGG4.js} +16 -15
  193. package/chunks/{workspace-service-PAMUKMAV.js → workspace-service-I5RUPSNV.js} +26 -22
  194. package/chunks/{workspace-skills-status-YQSHCCMS.js → workspace-skills-status-DMK6VYDO.js} +17 -15
  195. package/chunks/{workspace-trust-reconciler-RPTXOIY2.js → workspace-trust-reconciler-QX4RL3TC.js} +24 -21
  196. package/chunks/{write-file-CGS57TS4.js → write-file-UGDD5UTS.js} +8 -8
  197. package/chunks/{zoom-image-E7D72GYV.js → zoom-image-ZAHEO3YP.js} +4 -4
  198. package/cli.js +12 -12
  199. package/package.json +3 -3
  200. package/web-shell/assets/{arc-DybZaz32.js → arc-CHY4saMJ.js} +1 -1
  201. package/web-shell/assets/{architectureDiagram-3BPJPVTR-jN3qBd19.js → architectureDiagram-3BPJPVTR-Bu6CwvHj.js} +1 -1
  202. package/web-shell/assets/{blockDiagram-GPEHLZMM-Ct5DZPrj.js → blockDiagram-GPEHLZMM-XGt6iGf_.js} +1 -1
  203. package/web-shell/assets/{c4Diagram-AAUBKEIU-CUAFMlUG.js → c4Diagram-AAUBKEIU-CBbYl19W.js} +1 -1
  204. package/web-shell/assets/channel-B40srHOa.js +1 -0
  205. package/web-shell/assets/{chunk-2J33WTMH-CuV8n90B.js → chunk-2J33WTMH-BEhmVrdx.js} +1 -1
  206. package/web-shell/assets/{chunk-4BX2VUAB-BUzl_kls.js → chunk-4BX2VUAB-fQLyE0Bg.js} +1 -1
  207. package/web-shell/assets/{chunk-55IACEB6-BnDBLX6A.js → chunk-55IACEB6-yGdtyx4a.js} +1 -1
  208. package/web-shell/assets/{chunk-727SXJPM-B83uTOjm.js → chunk-727SXJPM-DYbX2GLo.js} +1 -1
  209. package/web-shell/assets/{chunk-AQP2D5EJ-DM3HLgpT.js → chunk-AQP2D5EJ-DyKTEsYn.js} +1 -1
  210. package/web-shell/assets/{chunk-FMBD7UC4-CSQ5hgyb.js → chunk-FMBD7UC4-D8Uy_GzX.js} +1 -1
  211. package/web-shell/assets/{chunk-ND2GUHAM-BWOF4SxX.js → chunk-ND2GUHAM-C8wNR2K7.js} +1 -1
  212. package/web-shell/assets/{chunk-QZHKN3VN-BsOH9LMi.js → chunk-QZHKN3VN-BnybNxnt.js} +1 -1
  213. package/web-shell/assets/classDiagram-4FO5ZUOK-qumcXQW_.js +1 -0
  214. package/web-shell/assets/classDiagram-v2-Q7XG4LA2-qumcXQW_.js +1 -0
  215. package/web-shell/assets/{cose-bilkent-S5V4N54A-IENqH2iJ.js → cose-bilkent-S5V4N54A-jq4uiFRp.js} +1 -1
  216. package/web-shell/assets/{dagre-BM42HDAG--dyzDTGo.js → dagre-BM42HDAG-Bs7oye1U.js} +1 -1
  217. package/web-shell/assets/{diagram-2AECGRRQ-BE7Dcqof.js → diagram-2AECGRRQ-BHGGJNyM.js} +1 -1
  218. package/web-shell/assets/{diagram-5GNKFQAL-Cr8-5OTj.js → diagram-5GNKFQAL-BJezVLGT.js} +1 -1
  219. package/web-shell/assets/{diagram-KO2AKTUF-Bzey3uAY.js → diagram-KO2AKTUF-5JzQN_rL.js} +1 -1
  220. package/web-shell/assets/{diagram-LMA3HP47-sErl28Xb.js → diagram-LMA3HP47-BlPYOgY9.js} +1 -1
  221. package/web-shell/assets/{diagram-OG6HWLK6-Dq30ATIo.js → diagram-OG6HWLK6-CtMHEaFK.js} +1 -1
  222. package/web-shell/assets/{erDiagram-TEJ5UH35-BkCoEfVW.js → erDiagram-TEJ5UH35-CRNdq2AB.js} +1 -1
  223. package/web-shell/assets/{flowDiagram-I6XJVG4X-DHwO0rrI.js → flowDiagram-I6XJVG4X-De1WwLzu.js} +1 -1
  224. package/web-shell/assets/{ganttDiagram-6RSMTGT7-s7vAPxWq.js → ganttDiagram-6RSMTGT7-YbWfL5Zn.js} +1 -1
  225. package/web-shell/assets/{gitGraphDiagram-PVQCEYII-CQxhwPOU.js → gitGraphDiagram-PVQCEYII-DzCN8bmd.js} +1 -1
  226. package/web-shell/assets/index-BDOGGGaN.css +5 -0
  227. package/web-shell/assets/{index-CF4wApWp.js → index-CocPvF9Q.js} +1 -1
  228. package/web-shell/assets/index-DSH2KrMc.js +1771 -0
  229. package/web-shell/assets/{infoDiagram-5YYISTIA-BnFrD0bq.js → infoDiagram-5YYISTIA-DLHoopnE.js} +1 -1
  230. package/web-shell/assets/{ishikawaDiagram-YF4QCWOH-Bf9zK5NK.js → ishikawaDiagram-YF4QCWOH-XnbU04SS.js} +1 -1
  231. package/web-shell/assets/{journeyDiagram-JHISSGLW-CyGAhsxi.js → journeyDiagram-JHISSGLW-CipPyEeJ.js} +1 -1
  232. package/web-shell/assets/{kanban-definition-UN3LZRKU-CbsK5akB.js → kanban-definition-UN3LZRKU-DrSeyE5d.js} +1 -1
  233. package/web-shell/assets/{linear-cQsF4P8D.js → linear-LrBKnAo_.js} +1 -1
  234. package/web-shell/assets/{mermaid.core-Z4HVqrKY.js → mermaid.core-C3U9UVmf.js} +5 -5
  235. package/web-shell/assets/{mindmap-definition-RKZ34NQL-CYnrBo_f.js → mindmap-definition-RKZ34NQL-DqRWgC9H.js} +1 -1
  236. package/web-shell/assets/{pieDiagram-4H26LBE5-CBzOfhrs.js → pieDiagram-4H26LBE5-BNXY5p6H.js} +1 -1
  237. package/web-shell/assets/{quadrantDiagram-W4KKPZXB-D4LK1Ebn.js → quadrantDiagram-W4KKPZXB-Ccj9QzE4.js} +1 -1
  238. package/web-shell/assets/{requirementDiagram-4Y6WPE33-Bzti2Lcj.js → requirementDiagram-4Y6WPE33-CjPM2_gx.js} +1 -1
  239. package/web-shell/assets/{sankeyDiagram-5OEKKPKP-yTBw5Z2s.js → sankeyDiagram-5OEKKPKP-C0RsvKbj.js} +1 -1
  240. package/web-shell/assets/{sequenceDiagram-3UESZ5HK-D07UVRiZ.js → sequenceDiagram-3UESZ5HK-ClN1P5z7.js} +1 -1
  241. package/web-shell/assets/{stateDiagram-AJRCARHV-UE_lHsTn.js → stateDiagram-AJRCARHV-By0eiB2Y.js} +1 -1
  242. package/web-shell/assets/stateDiagram-v2-BHNVJYJU-Ds0WlK3F.js +1 -0
  243. package/web-shell/assets/{timeline-definition-PNZ67QCA-DRvYdiTs.js → timeline-definition-PNZ67QCA-g_iaSQgv.js} +1 -1
  244. package/web-shell/assets/{vennDiagram-CIIHVFJN-CQLIXs0u.js → vennDiagram-CIIHVFJN-y9ZqJ-TD.js} +1 -1
  245. package/web-shell/assets/{wardley-L42UT6IY-JZz_Xqse.js → wardley-L42UT6IY-BVVfaxpF.js} +1 -1
  246. package/web-shell/assets/{wardleyDiagram-YWT4CUSO--i7BiJwB.js → wardleyDiagram-YWT4CUSO-D3ooZKZT.js} +1 -1
  247. package/web-shell/assets/{xychartDiagram-2RQKCTM6-Bkc-bW0S.js → xychartDiagram-2RQKCTM6-6GXrY6M1.js} +1 -1
  248. package/web-shell/index.html +2 -2
  249. package/chunks/chunk-RXFQM6FQ.js +0 -42
  250. package/chunks/chunk-UA5H3DS2.js +0 -203
  251. package/web-shell/assets/channel-BMwLrwLW.js +0 -1
  252. package/web-shell/assets/classDiagram-4FO5ZUOK-BGDv98jY.js +0 -1
  253. package/web-shell/assets/classDiagram-v2-Q7XG4LA2-BGDv98jY.js +0 -1
  254. package/web-shell/assets/index-Bckpjr-I.css +0 -5
  255. package/web-shell/assets/index-DwEr9HEW.js +0 -1768
  256. package/web-shell/assets/stateDiagram-v2-BHNVJYJU-DC6xgXjX.js +0 -1
  257. /package/chunks/{chunk-VXZBKKQR.js → chunk-NTTBXH7U.js} +0 -0
  258. /package/chunks/{chunk-GRC5HGPI.js → chunk-OIBUG24X.js} +0 -0
@@ -0,0 +1,1995 @@
1
+ // Force strict mode and setup for ESM
2
+ "use strict";
3
+ import {
4
+ getSettingsSchema
5
+ } from "./chunk-7GOYZQPR.js";
6
+ import {
7
+ DEFAULT_DARK_THEME_NAME,
8
+ DEFAULT_LIGHT_THEME_NAME
9
+ } from "./chunk-RKUWKYED.js";
10
+ import {
11
+ CONSOLIDATED_DISABLE_KEYS,
12
+ V1_INDICATOR_KEYS,
13
+ V1_TO_V2_MIGRATION_MAP,
14
+ V1_TO_V2_PRESERVE_DISABLE_MAP,
15
+ V2_CONTAINER_KEYS,
16
+ resolveEnvVarsInObject
17
+ } from "./chunk-GOXKNSDZ.js";
18
+ import {
19
+ getSystemDefaultsPath,
20
+ getSystemSettingsPath
21
+ } from "./chunk-IDS7MSUP.js";
22
+ import {
23
+ t
24
+ } from "./chunk-WP5VOXF7.js";
25
+ import {
26
+ SUPPORTED_LANGUAGES,
27
+ getLanguageNameFromLocale
28
+ } from "./chunk-5EJZE3FP.js";
29
+ import {
30
+ getHomeEnvFallbackVars,
31
+ loadEnvironment,
32
+ preResolveHomeEnvOverrides
33
+ } from "./chunk-T6HEQR2Q.js";
34
+ import {
35
+ ENV_CORRUPTED_PATH,
36
+ ENV_WAS_RECOVERED
37
+ } from "./chunk-VFMASYQA.js";
38
+ import {
39
+ isWorkspaceTrusted,
40
+ updateSettingsFilePreservingFormat
41
+ } from "./chunk-ZOSTTOUJ.js";
42
+ import {
43
+ require_strip_json_comments
44
+ } from "./chunk-NPQ5ZKRP.js";
45
+ import {
46
+ stripRuntimeSnapshotPrefix
47
+ } from "./chunk-K4ADGWHU.js";
48
+ import {
49
+ FatalConfigError,
50
+ Storage,
51
+ createDebugLogger,
52
+ getErrorMessage
53
+ } from "./chunk-OIVKILPI.js";
54
+ import {
55
+ init_esbuild_shims
56
+ } from "./chunk-5O2XNYP6.js";
57
+ import {
58
+ __name,
59
+ __toESM
60
+ } from "./chunk-J2S4EL5Y.js";
61
+
62
+ // packages/cli/src/config/settings.ts
63
+ init_esbuild_shims();
64
+ import * as fs3 from "node:fs";
65
+ import * as path2 from "node:path";
66
+ import { homedir } from "node:os";
67
+ import process from "node:process";
68
+ var import_strip_json_comments = __toESM(require_strip_json_comments(), 1);
69
+
70
+ // packages/cli/src/config/modelProvidersScope.ts
71
+ init_esbuild_shims();
72
+ function hasOwnModelProviders(settingsObj) {
73
+ if (!settingsObj || typeof settingsObj !== "object") {
74
+ return false;
75
+ }
76
+ const obj = settingsObj;
77
+ return Object.prototype.hasOwnProperty.call(obj, "modelProviders");
78
+ }
79
+ __name(hasOwnModelProviders, "hasOwnModelProviders");
80
+ function getModelProvidersOwnerScope(settings) {
81
+ if (settings.isTrusted && hasOwnModelProviders(settings.workspace.settings)) {
82
+ return "Workspace" /* Workspace */;
83
+ }
84
+ if (hasOwnModelProviders(settings.user.settings)) {
85
+ return "User" /* User */;
86
+ }
87
+ return void 0;
88
+ }
89
+ __name(getModelProvidersOwnerScope, "getModelProvidersOwnerScope");
90
+ function getPersistScopeForModelSelection(settings) {
91
+ return getModelProvidersOwnerScope(settings) ?? "User" /* User */;
92
+ }
93
+ __name(getPersistScopeForModelSelection, "getPersistScopeForModelSelection");
94
+ function getWritableScopes(settings) {
95
+ return settings.isTrusted ? ["Workspace" /* Workspace */, "User" /* User */] : ["User" /* User */];
96
+ }
97
+ __name(getWritableScopes, "getWritableScopes");
98
+ function getOwnKeyScope(settings, key) {
99
+ for (const scope of getWritableScopes(settings)) {
100
+ const obj = settings.forScope(scope).settings;
101
+ if (Object.prototype.hasOwnProperty.call(obj, key)) return scope;
102
+ }
103
+ return void 0;
104
+ }
105
+ __name(getOwnKeyScope, "getOwnKeyScope");
106
+
107
+ // packages/cli/src/utils/settingsUtils.ts
108
+ init_esbuild_shims();
109
+ import * as fs2 from "node:fs";
110
+
111
+ // packages/cli/src/utils/languageUtils.ts
112
+ init_esbuild_shims();
113
+ import * as fs from "node:fs";
114
+ import * as path from "node:path";
115
+ var LLM_OUTPUT_LANGUAGE_RULE_FILENAME = "output-language.md";
116
+ var LLM_OUTPUT_LANGUAGE_MARKER_PREFIX = "qwen-code:llm-output-language:";
117
+ var OUTPUT_LANGUAGE_AUTO = "auto";
118
+ function isAutoLanguage(value) {
119
+ return !value || value.toLowerCase() === OUTPUT_LANGUAGE_AUTO;
120
+ }
121
+ __name(isAutoLanguage, "isAutoLanguage");
122
+ function normalizeOutputLanguage(language) {
123
+ const normalized = language.trim().replace(/_/g, "-").toLowerCase();
124
+ const knownLanguageName = SUPPORTED_LANGUAGES.find(
125
+ (supportedLanguage) => supportedLanguage.fullName.toLowerCase() === normalized
126
+ );
127
+ if (knownLanguageName) {
128
+ return knownLanguageName.fullName;
129
+ }
130
+ const knownLocaleCode = SUPPORTED_LANGUAGES.some((supportedLanguage) => {
131
+ const code = supportedLanguage.code.toLowerCase();
132
+ const id = supportedLanguage.id.toLowerCase();
133
+ return normalized === code || normalized === id || normalized.startsWith(`${code}-`) || normalized.startsWith(`${id}-`) || normalized.startsWith(`${code}.`) || normalized.startsWith(`${id}.`) || normalized.startsWith(`${code}@`) || normalized.startsWith(`${id}@`);
134
+ });
135
+ if (!knownLocaleCode) {
136
+ return language;
137
+ }
138
+ return getLanguageNameFromLocale(normalized);
139
+ }
140
+ __name(normalizeOutputLanguage, "normalizeOutputLanguage");
141
+ function resolveOutputLanguage(value) {
142
+ if (isAutoLanguage(value)) {
143
+ throw new Error(
144
+ "resolveOutputLanguage does not accept auto; use resolveOutputLanguageOrPreserveAuto instead."
145
+ );
146
+ }
147
+ return normalizeOutputLanguage(value);
148
+ }
149
+ __name(resolveOutputLanguage, "resolveOutputLanguage");
150
+ function resolveOutputLanguageOrPreserveAuto(value) {
151
+ return isAutoLanguage(value) ? OUTPUT_LANGUAGE_AUTO : resolveOutputLanguage(value);
152
+ }
153
+ __name(resolveOutputLanguageOrPreserveAuto, "resolveOutputLanguageOrPreserveAuto");
154
+ function getOutputLanguageFilePath() {
155
+ return path.join(
156
+ Storage.getGlobalQwenDir(),
157
+ LLM_OUTPUT_LANGUAGE_RULE_FILENAME
158
+ );
159
+ }
160
+ __name(getOutputLanguageFilePath, "getOutputLanguageFilePath");
161
+ function sanitizeForMarker(language) {
162
+ return language.replace(/[\r\n]/g, " ").replace(/--!?>/g, "").replace(/--/g, "");
163
+ }
164
+ __name(sanitizeForMarker, "sanitizeForMarker");
165
+ function generateOutputLanguageFileContent(language) {
166
+ const safeLanguage = sanitizeForMarker(language);
167
+ if (isAutoLanguage(language)) {
168
+ return `# Output language preference: ${OUTPUT_LANGUAGE_AUTO}
169
+ <!-- ${LLM_OUTPUT_LANGUAGE_MARKER_PREFIX} ${OUTPUT_LANGUAGE_AUTO} -->
170
+
171
+ ## Rule
172
+ Respond in the same language as the user's input.
173
+
174
+ ## Exception
175
+ If the user **explicitly** requests a response in a specific language (e.g., "please reply in English"), switch to the user's requested language for the remainder of the conversation.
176
+
177
+ ## Mixed-language input
178
+ If the user mixes languages, use the language that best matches the user's main request.
179
+
180
+ ## Keep technical artifacts unchanged
181
+ Do **not** translate or rewrite:
182
+ - Code blocks, CLI commands, file paths, stack traces, logs, JSON keys, identifiers
183
+ - Exact quoted text from the user (keep quotes verbatim)
184
+
185
+ ## Tool / system outputs
186
+ Raw tool/system outputs may contain fixed-format English. Preserve them verbatim, and if needed, add a short explanation in the user's language below.
187
+ `;
188
+ }
189
+ return `# Output language preference: ${language}
190
+ <!-- ${LLM_OUTPUT_LANGUAGE_MARKER_PREFIX} ${safeLanguage} -->
191
+
192
+ ## Rule
193
+ You MUST always respond in **${language}** regardless of the user's input language.
194
+ This is a mandatory requirement, not a preference.
195
+
196
+ ## Exception
197
+ If the user **explicitly** requests a response in a specific language (e.g., "please reply in English", "\u7528\u4E2D\u6587\u56DE\u7B54"), switch to the user's requested language for the remainder of the conversation.
198
+
199
+ ## Keep technical artifacts unchanged
200
+ Do **not** translate or rewrite:
201
+ - Code blocks, CLI commands, file paths, stack traces, logs, JSON keys, identifiers
202
+ - Exact quoted text from the user (keep quotes verbatim)
203
+
204
+ ## Tool / system outputs
205
+ Raw tool/system outputs may contain fixed-format English. Preserve them verbatim, and if needed, add a short **${language}** explanation below.
206
+ `;
207
+ }
208
+ __name(generateOutputLanguageFileContent, "generateOutputLanguageFileContent");
209
+ function parseOutputLanguageFromContent(content) {
210
+ const markerRegex = new RegExp(
211
+ String.raw`<!--\s*${LLM_OUTPUT_LANGUAGE_MARKER_PREFIX}\s*(.*?)\s*-->`,
212
+ "i"
213
+ );
214
+ const markerMatch = content.match(markerRegex);
215
+ if (markerMatch?.[1]?.trim()) {
216
+ return markerMatch[1].trim();
217
+ }
218
+ const headingMatch = content.match(
219
+ /^#.*?CRITICAL:\s*(.*?)\s+Output Language Rule\b/im
220
+ );
221
+ if (headingMatch?.[1]?.trim()) {
222
+ return headingMatch[1].trim();
223
+ }
224
+ return null;
225
+ }
226
+ __name(parseOutputLanguageFromContent, "parseOutputLanguageFromContent");
227
+ function readOutputLanguageFileContent() {
228
+ const filePath = getOutputLanguageFilePath();
229
+ if (!fs.existsSync(filePath)) {
230
+ return null;
231
+ }
232
+ try {
233
+ return fs.readFileSync(filePath, "utf-8");
234
+ } catch {
235
+ return null;
236
+ }
237
+ }
238
+ __name(readOutputLanguageFileContent, "readOutputLanguageFileContent");
239
+ function isGeneratedFixedOutputLanguageFileContent(content, language) {
240
+ const normalizedContent = content.replace(/\r\n/g, "\n");
241
+ const headings = normalizedContent.match(/^#{1,2}\s+.+$/gm) ?? [];
242
+ return normalizedContent.includes(
243
+ `<!-- ${LLM_OUTPUT_LANGUAGE_MARKER_PREFIX} ${sanitizeForMarker(language)} -->`
244
+ ) && headings.length === 5 && headings[0] === `# Output language preference: ${language}` && headings.includes("## Rule") && headings.includes("## Exception") && headings.includes("## Keep technical artifacts unchanged") && headings.includes("## Tool / system outputs") && normalizedContent.includes(`**${language}**`) && normalizedContent.includes("You MUST always respond");
245
+ }
246
+ __name(isGeneratedFixedOutputLanguageFileContent, "isGeneratedFixedOutputLanguageFileContent");
247
+ function writeOutputLanguageFile(language, targetPath) {
248
+ const filePath = targetPath ?? getOutputLanguageFilePath();
249
+ const content = generateOutputLanguageFileContent(language);
250
+ const dir = path.dirname(filePath);
251
+ fs.mkdirSync(dir, { recursive: true });
252
+ fs.writeFileSync(filePath, content, "utf-8");
253
+ }
254
+ __name(writeOutputLanguageFile, "writeOutputLanguageFile");
255
+ function updateOutputLanguageFile(settingValue, targetPath) {
256
+ const resolved = resolveOutputLanguageOrPreserveAuto(settingValue);
257
+ writeOutputLanguageFile(resolved, targetPath);
258
+ }
259
+ __name(updateOutputLanguageFile, "updateOutputLanguageFile");
260
+ function writeOutputLanguageAndRegisterPath(settingValue, config) {
261
+ const targetPath = config?.getOutputLanguageFilePath();
262
+ updateOutputLanguageFile(settingValue, targetPath);
263
+ if (!targetPath) {
264
+ config?.setOutputLanguageFilePath(getOutputLanguageFilePath());
265
+ }
266
+ }
267
+ __name(writeOutputLanguageAndRegisterPath, "writeOutputLanguageAndRegisterPath");
268
+ function initializeLlmOutputLanguage(outputLanguage) {
269
+ const currentFileContent = readOutputLanguageFileContent();
270
+ const currentFileLanguage = currentFileContent === null ? null : parseOutputLanguageFromContent(currentFileContent);
271
+ const shouldMigrateFixedFileToAuto = isAutoLanguage(outputLanguage) && currentFileLanguage !== null && !isAutoLanguage(currentFileLanguage) && currentFileContent !== null && isGeneratedFixedOutputLanguageFileContent(
272
+ currentFileContent,
273
+ currentFileLanguage
274
+ );
275
+ if (currentFileLanguage) {
276
+ if (shouldMigrateFixedFileToAuto) {
277
+ try {
278
+ const resolved2 = resolveOutputLanguageOrPreserveAuto(outputLanguage);
279
+ writeOutputLanguageFile(resolved2);
280
+ } catch {
281
+ }
282
+ }
283
+ return;
284
+ }
285
+ const resolved = resolveOutputLanguageOrPreserveAuto(outputLanguage);
286
+ writeOutputLanguageFile(resolved);
287
+ }
288
+ __name(initializeLlmOutputLanguage, "initializeLlmOutputLanguage");
289
+
290
+ // packages/cli/src/utils/settingsUtils.ts
291
+ function flattenSchema(schema, prefix = "") {
292
+ let result = {};
293
+ for (const key in schema) {
294
+ const newKey = prefix ? `${prefix}.${key}` : key;
295
+ const definition = schema[key];
296
+ result[newKey] = { ...definition, key: newKey };
297
+ if (definition.properties) {
298
+ result = { ...result, ...flattenSchema(definition.properties, newKey) };
299
+ }
300
+ }
301
+ return result;
302
+ }
303
+ __name(flattenSchema, "flattenSchema");
304
+ var _FLATTENED_SCHEMA;
305
+ function getFlattenedSchema() {
306
+ return _FLATTENED_SCHEMA ?? (_FLATTENED_SCHEMA = flattenSchema(getSettingsSchema()));
307
+ }
308
+ __name(getFlattenedSchema, "getFlattenedSchema");
309
+ function getSettingDefinition(key) {
310
+ return getFlattenedSchema()[key];
311
+ }
312
+ __name(getSettingDefinition, "getSettingDefinition");
313
+ function requiresRestart(key) {
314
+ return getFlattenedSchema()[key]?.requiresRestart ?? false;
315
+ }
316
+ __name(requiresRestart, "requiresRestart");
317
+ function getDefaultValue(key) {
318
+ return getFlattenedSchema()[key]?.default;
319
+ }
320
+ __name(getDefaultValue, "getDefaultValue");
321
+ function getNestedValue(obj, path3) {
322
+ const [first, ...rest] = path3;
323
+ if (!first || !(first in obj)) {
324
+ return void 0;
325
+ }
326
+ const value = obj[first];
327
+ if (rest.length === 0) {
328
+ return value;
329
+ }
330
+ if (value && typeof value === "object" && value !== null) {
331
+ return getNestedValue(value, rest);
332
+ }
333
+ return void 0;
334
+ }
335
+ __name(getNestedValue, "getNestedValue");
336
+ function getNestedProperty(obj, path3) {
337
+ return getNestedValue(obj, path3.split("."));
338
+ }
339
+ __name(getNestedProperty, "getNestedProperty");
340
+ function getEffectiveValue(key, settings, mergedSettings) {
341
+ const definition = getSettingDefinition(key);
342
+ if (!definition) {
343
+ return void 0;
344
+ }
345
+ const path3 = key.split(".");
346
+ let value = getNestedValue(settings, path3);
347
+ if (value !== void 0) {
348
+ return value;
349
+ }
350
+ value = getNestedValue(mergedSettings, path3);
351
+ if (value !== void 0) {
352
+ return value;
353
+ }
354
+ return definition.default;
355
+ }
356
+ __name(getEffectiveValue, "getEffectiveValue");
357
+ function getAllSettingKeys() {
358
+ return Object.keys(getFlattenedSchema());
359
+ }
360
+ __name(getAllSettingKeys, "getAllSettingKeys");
361
+ var SETTINGS_DIALOG_ORDER = [
362
+ // Workflow Control - most impactful setting
363
+ "tools.approvalMode",
364
+ // Localization - users often set this first
365
+ "general.language",
366
+ "general.outputLanguage",
367
+ // Theme
368
+ "ui.theme",
369
+ // Editor/Shell Experience
370
+ "general.vimMode",
371
+ "tools.shell.enableInteractiveShell",
372
+ // Display Preferences
373
+ "general.preferredEditor",
374
+ "ide.enabled",
375
+ "ui.showLineNumbers",
376
+ "ui.hideTips",
377
+ "general.terminalBell",
378
+ "ui.enableWelcomeBack",
379
+ // Git Behavior
380
+ "general.gitCoAuthor.commit",
381
+ "general.gitCoAuthor.pr",
382
+ // File Filtering
383
+ "context.fileFiltering.respectGitIgnore",
384
+ "context.fileFiltering.respectQwenIgnore",
385
+ // System Settings - rarely changed
386
+ "general.disableAutoUpdate",
387
+ // Privacy
388
+ "privacy.usageStatisticsEnabled"
389
+ ];
390
+ var MAX_SETTING_STRING_VALUE_LENGTH = 1024;
391
+ function validateSettingValue(def, value) {
392
+ switch (def.type) {
393
+ case "boolean":
394
+ if (typeof value !== "boolean") return "Value must be a boolean";
395
+ break;
396
+ case "number":
397
+ if (typeof value !== "number" || !Number.isFinite(value))
398
+ return "Value must be a finite number";
399
+ if (def.minimum !== void 0 && value < def.minimum)
400
+ return `Value must be >= ${def.minimum}`;
401
+ if (def.maximum !== void 0 && value > def.maximum)
402
+ return `Value must be <= ${def.maximum}`;
403
+ break;
404
+ case "integer":
405
+ if (typeof value !== "number" || !Number.isFinite(value))
406
+ return "Value must be a finite integer";
407
+ if (!Number.isInteger(value)) return "Value must be an integer";
408
+ if (def.minimum !== void 0 && value < def.minimum)
409
+ return `Value must be >= ${def.minimum}`;
410
+ if (def.maximum !== void 0 && value > def.maximum)
411
+ return `Value must be <= ${def.maximum}`;
412
+ break;
413
+ case "string":
414
+ if (typeof value !== "string") return "Value must be a string";
415
+ if (value.length > MAX_SETTING_STRING_VALUE_LENGTH)
416
+ return `Value exceeds ${MAX_SETTING_STRING_VALUE_LENGTH}-character limit`;
417
+ break;
418
+ case "enum":
419
+ if (!def.options?.some((opt) => opt.value === value)) {
420
+ const allowed = def.options?.map((o) => o.value).join(", ") ?? "";
421
+ return `Value must be one of: ${allowed}`;
422
+ }
423
+ break;
424
+ case "object":
425
+ if (!value || typeof value !== "object" || Array.isArray(value)) {
426
+ return "Value must be an object";
427
+ }
428
+ break;
429
+ default:
430
+ return `Settings of type '${def.type}' cannot be modified via this API`;
431
+ }
432
+ return void 0;
433
+ }
434
+ __name(validateSettingValue, "validateSettingValue");
435
+ function getDialogSettingKeys() {
436
+ const dialogSettings = Object.values(getFlattenedSchema()).filter((definition) => definition.showInDialog === true).map((definition) => definition.key);
437
+ return dialogSettings.sort((a, b) => {
438
+ const indexA = SETTINGS_DIALOG_ORDER.indexOf(a);
439
+ const indexB = SETTINGS_DIALOG_ORDER.indexOf(b);
440
+ if (indexA !== -1 && indexB !== -1) {
441
+ return indexA - indexB;
442
+ }
443
+ if (indexA !== -1) return -1;
444
+ if (indexB !== -1) return 1;
445
+ return 0;
446
+ });
447
+ }
448
+ __name(getDialogSettingKeys, "getDialogSettingKeys");
449
+ function settingExistsInScope(key, scopeSettings) {
450
+ const path3 = key.split(".");
451
+ const value = getNestedValue(scopeSettings, path3);
452
+ return value !== void 0;
453
+ }
454
+ __name(settingExistsInScope, "settingExistsInScope");
455
+ function pathHasUnsafeSegment(keys) {
456
+ for (const key of keys) {
457
+ if (key === "__proto__" || key === "constructor" || key === "prototype") {
458
+ return true;
459
+ }
460
+ }
461
+ return false;
462
+ }
463
+ __name(pathHasUnsafeSegment, "pathHasUnsafeSegment");
464
+ function setNestedPropertyForce(obj, path3, value) {
465
+ const keys = path3.split(".");
466
+ if (pathHasUnsafeSegment(keys)) return;
467
+ const lastKey = keys.pop();
468
+ if (!lastKey) return;
469
+ let current = obj;
470
+ for (const key of keys) {
471
+ if (!current[key] || typeof current[key] !== "object") {
472
+ current[key] = {};
473
+ }
474
+ current = current[key];
475
+ }
476
+ current[lastKey] = value;
477
+ }
478
+ __name(setNestedPropertyForce, "setNestedPropertyForce");
479
+ function setNestedPropertySafe(obj, path3, value) {
480
+ const keys = path3.split(".");
481
+ if (pathHasUnsafeSegment(keys)) return;
482
+ const lastKey = keys.pop();
483
+ if (!lastKey) return;
484
+ let current = obj;
485
+ for (const key of keys) {
486
+ if (current[key] === void 0) {
487
+ current[key] = {};
488
+ }
489
+ const next = current[key];
490
+ if (typeof next === "object" && next !== null) {
491
+ current = next;
492
+ } else {
493
+ return;
494
+ }
495
+ }
496
+ current[lastKey] = value;
497
+ }
498
+ __name(setNestedPropertySafe, "setNestedPropertySafe");
499
+ function deleteNestedPropertySafe(obj, path3) {
500
+ const keys = path3.split(".");
501
+ const lastKey = keys.pop();
502
+ if (!lastKey) return;
503
+ let current = obj;
504
+ for (const key of keys) {
505
+ const next = current[key];
506
+ if (typeof next !== "object" || next === null) {
507
+ return;
508
+ }
509
+ current = next;
510
+ }
511
+ delete current[lastKey];
512
+ }
513
+ __name(deleteNestedPropertySafe, "deleteNestedPropertySafe");
514
+ function setPendingSettingValue(key, value, pendingSettings) {
515
+ const newSettings = JSON.parse(JSON.stringify(pendingSettings));
516
+ setNestedPropertyForce(newSettings, key, value);
517
+ return newSettings;
518
+ }
519
+ __name(setPendingSettingValue, "setPendingSettingValue");
520
+ function setPendingSettingValueAny(key, value, pendingSettings) {
521
+ const newSettings = structuredClone(pendingSettings);
522
+ setNestedPropertyForce(newSettings, key, value);
523
+ return newSettings;
524
+ }
525
+ __name(setPendingSettingValueAny, "setPendingSettingValueAny");
526
+ function getRestartRequiredFromModified(modifiedSettings) {
527
+ return Array.from(modifiedSettings).filter((key) => requiresRestart(key));
528
+ }
529
+ __name(getRestartRequiredFromModified, "getRestartRequiredFromModified");
530
+ function saveModifiedSettings(modifiedSettings, pendingSettings, loadedSettings, scope) {
531
+ modifiedSettings.forEach((settingKey) => {
532
+ const path3 = settingKey.split(".");
533
+ const value = getNestedValue(
534
+ pendingSettings,
535
+ path3
536
+ );
537
+ const existsInOriginalFile = settingExistsInScope(
538
+ settingKey,
539
+ loadedSettings.forScope(scope).settings
540
+ );
541
+ if (value === void 0) {
542
+ if (existsInOriginalFile) {
543
+ loadedSettings.setValue(scope, settingKey, void 0);
544
+ }
545
+ return;
546
+ }
547
+ const isDefaultValue2 = value === getDefaultValue(settingKey);
548
+ if (existsInOriginalFile || !isDefaultValue2) {
549
+ loadedSettings.setValue(scope, settingKey, value);
550
+ }
551
+ });
552
+ }
553
+ __name(saveModifiedSettings, "saveModifiedSettings");
554
+ function getDisplayValue(key, settings, _mergedSettings, modifiedSettings, pendingSettings) {
555
+ const definition = getSettingDefinition(key);
556
+ let value;
557
+ if (pendingSettings && settingExistsInScope(key, pendingSettings)) {
558
+ value = getEffectiveValue(key, pendingSettings, {});
559
+ } else if (settingExistsInScope(key, settings)) {
560
+ value = getEffectiveValue(key, settings, {});
561
+ } else {
562
+ value = getDefaultValue(key);
563
+ }
564
+ let valueString = String(value);
565
+ if (key === "general.outputLanguage" && isAutoLanguage(value)) {
566
+ valueString = t("Auto (follow user input)");
567
+ } else if (definition?.type === "enum" && definition.options) {
568
+ const option = definition.options?.find((option2) => option2.value === value);
569
+ if (option?.label) {
570
+ valueString = t(option.label) || option.label;
571
+ } else {
572
+ valueString = `${value}`;
573
+ }
574
+ }
575
+ const defaultValue = getDefaultValue(key);
576
+ const isChangedFromDefault = value !== defaultValue;
577
+ const isInModifiedSettings = modifiedSettings.has(key);
578
+ if (settingExistsInScope(key, settings) || isInModifiedSettings) {
579
+ return `${valueString}*`;
580
+ }
581
+ if (isChangedFromDefault || isInModifiedSettings) {
582
+ return `${valueString}*`;
583
+ }
584
+ return valueString;
585
+ }
586
+ __name(getDisplayValue, "getDisplayValue");
587
+ function isDefaultValue(key, settings) {
588
+ return !settingExistsInScope(key, settings);
589
+ }
590
+ __name(isDefaultValue, "isDefaultValue");
591
+ function backupSettingsFile(filePath) {
592
+ try {
593
+ if (fs2.existsSync(filePath)) {
594
+ const backupPath = `${filePath}.orig`;
595
+ fs2.copyFileSync(filePath, backupPath);
596
+ return true;
597
+ }
598
+ } catch (_e) {
599
+ }
600
+ return false;
601
+ }
602
+ __name(backupSettingsFile, "backupSettingsFile");
603
+ function restoreSettingsFromBackup(filePath) {
604
+ try {
605
+ const backupPath = `${filePath}.orig`;
606
+ if (fs2.existsSync(backupPath)) {
607
+ fs2.copyFileSync(backupPath, filePath);
608
+ fs2.unlinkSync(backupPath);
609
+ return true;
610
+ }
611
+ } catch (err) {
612
+ console.error(
613
+ `[settingsUtils] restoreSettingsFromBackup(${filePath}) failed:`,
614
+ err
615
+ );
616
+ }
617
+ return false;
618
+ }
619
+ __name(restoreSettingsFromBackup, "restoreSettingsFromBackup");
620
+ function cleanupSettingsBackup(filePath) {
621
+ try {
622
+ const backupPath = `${filePath}.orig`;
623
+ if (fs2.existsSync(backupPath)) {
624
+ fs2.unlinkSync(backupPath);
625
+ }
626
+ } catch (_e) {
627
+ }
628
+ }
629
+ __name(cleanupSettingsBackup, "cleanupSettingsBackup");
630
+
631
+ // packages/cli/src/utils/deepMerge.ts
632
+ init_esbuild_shims();
633
+ function isPlainObject(item) {
634
+ return !!item && typeof item === "object" && !Array.isArray(item);
635
+ }
636
+ __name(isPlainObject, "isPlainObject");
637
+ function mergeRecursively(target, source, getMergeStrategyForPath2, path3 = []) {
638
+ for (const key of Object.keys(source)) {
639
+ if (key === "__proto__" || key === "constructor" || key === "prototype") {
640
+ continue;
641
+ }
642
+ const newPath = [...path3, key];
643
+ const srcValue = source[key];
644
+ const objValue = target[key];
645
+ const mergeStrategy = getMergeStrategyForPath2(newPath);
646
+ if (mergeStrategy === "shallow_merge" /* SHALLOW_MERGE */ && objValue && srcValue) {
647
+ const obj1 = typeof objValue === "object" && objValue !== null ? objValue : {};
648
+ const obj2 = typeof srcValue === "object" && srcValue !== null ? srcValue : {};
649
+ target[key] = { ...obj1, ...obj2 };
650
+ continue;
651
+ }
652
+ if (Array.isArray(objValue)) {
653
+ const srcArray = Array.isArray(srcValue) ? srcValue : [srcValue];
654
+ if (mergeStrategy === "concat" /* CONCAT */) {
655
+ target[key] = objValue.concat(srcArray);
656
+ continue;
657
+ }
658
+ if (mergeStrategy === "union" /* UNION */) {
659
+ target[key] = [...new Set(objValue.concat(srcArray))];
660
+ continue;
661
+ }
662
+ }
663
+ if (isPlainObject(objValue) && isPlainObject(srcValue)) {
664
+ mergeRecursively(objValue, srcValue, getMergeStrategyForPath2, newPath);
665
+ } else if (isPlainObject(srcValue)) {
666
+ target[key] = {};
667
+ mergeRecursively(
668
+ target[key],
669
+ srcValue,
670
+ getMergeStrategyForPath2,
671
+ newPath
672
+ );
673
+ } else {
674
+ target[key] = srcValue;
675
+ }
676
+ }
677
+ return target;
678
+ }
679
+ __name(mergeRecursively, "mergeRecursively");
680
+ function customDeepMerge(getMergeStrategyForPath2, ...sources) {
681
+ const result = {};
682
+ for (const source of sources) {
683
+ if (source) {
684
+ mergeRecursively(result, source, getMergeStrategyForPath2);
685
+ }
686
+ }
687
+ return result;
688
+ }
689
+ __name(customDeepMerge, "customDeepMerge");
690
+
691
+ // packages/cli/src/config/migration/index.ts
692
+ init_esbuild_shims();
693
+
694
+ // packages/cli/src/config/migration/scheduler.ts
695
+ init_esbuild_shims();
696
+ var debugLogger = createDebugLogger("SETTINGS_MIGRATION");
697
+ function formatScope(scope) {
698
+ if (scope === "SystemDefaults") {
699
+ return "system default";
700
+ }
701
+ return scope.toLowerCase();
702
+ }
703
+ __name(formatScope, "formatScope");
704
+ var MigrationScheduler = class {
705
+ /**
706
+ * Creates a new MigrationScheduler with the given migrations.
707
+ *
708
+ * @param migrations - Array of migrations in execution order (typically ascending version)
709
+ * @param scope - The scope of settings being migrated
710
+ */
711
+ constructor(migrations, scope) {
712
+ this.migrations = migrations;
713
+ this.scope = scope;
714
+ }
715
+ static {
716
+ __name(this, "MigrationScheduler");
717
+ }
718
+ /**
719
+ * Executes the migration chain on the given settings.
720
+ *
721
+ * Iterates through all registered migrations in order. For each migration:
722
+ * 1. Calls `shouldMigrate` with the current settings
723
+ * 2. If true, calls `migrate` to transform the settings
724
+ * 3. Records the execution
725
+ *
726
+ * The scheduler itself has no version awareness - all version detection
727
+ * is delegated to the individual migrations.
728
+ *
729
+ * @param settings - The settings object to migrate
730
+ * @returns MigrationResult containing the final settings, version, and execution log
731
+ */
732
+ migrate(settings) {
733
+ debugLogger.debug("MigrationScheduler: Starting migration chain");
734
+ let current = settings;
735
+ const executed = [];
736
+ const allWarnings = [];
737
+ for (const migration of this.migrations) {
738
+ try {
739
+ if (migration.shouldMigrate(current)) {
740
+ debugLogger.debug(
741
+ `MigrationScheduler: Executing migration ${migration.fromVersion} \u2192 ${migration.toVersion}`
742
+ );
743
+ const formattedScope = formatScope(this.scope);
744
+ const result = migration.migrate(current, formattedScope);
745
+ current = result.settings;
746
+ allWarnings.push(...result.warnings);
747
+ executed.push({
748
+ fromVersion: migration.fromVersion,
749
+ toVersion: migration.toVersion
750
+ });
751
+ debugLogger.debug(
752
+ `MigrationScheduler: Migration ${migration.fromVersion} \u2192 ${migration.toVersion} completed successfully`
753
+ );
754
+ }
755
+ } catch (error) {
756
+ debugLogger.error(
757
+ `MigrationScheduler: Migration ${migration.fromVersion} \u2192 ${migration.toVersion} failed:`,
758
+ error
759
+ );
760
+ throw error;
761
+ }
762
+ }
763
+ const finalVersion = current["$version"] ?? 1;
764
+ debugLogger.debug(
765
+ `MigrationScheduler: Migration chain complete. Final version: ${finalVersion}, Executed: ${executed.length} migrations`
766
+ );
767
+ return {
768
+ settings: current,
769
+ finalVersion,
770
+ executedMigrations: executed,
771
+ warnings: allWarnings
772
+ };
773
+ }
774
+ };
775
+
776
+ // packages/cli/src/config/migration/versions/v1-to-v2.ts
777
+ init_esbuild_shims();
778
+ var V1ToV2Migration = class {
779
+ static {
780
+ __name(this, "V1ToV2Migration");
781
+ }
782
+ fromVersion = 1;
783
+ toVersion = 2;
784
+ /**
785
+ * Determines whether this migration should execute.
786
+ *
787
+ * Decision strategy:
788
+ * - Hard-stop when `$version` is a number >= 2 (already V2+).
789
+ * - Otherwise, scan indicator keys and trigger only when at least one indicator is
790
+ * still in legacy top-level shape (primitive/array/null).
791
+ *
792
+ * Mixed-shape tolerance:
793
+ * - Files that are partially migrated are supported; V2-like object-valued indicators
794
+ * are ignored while legacy-shaped indicators can still trigger migration.
795
+ */
796
+ shouldMigrate(settings) {
797
+ if (typeof settings !== "object" || settings === null) {
798
+ return false;
799
+ }
800
+ const s = settings;
801
+ const version = s["$version"];
802
+ if (typeof version === "number" && version >= 2) {
803
+ return false;
804
+ }
805
+ return V1_INDICATOR_KEYS.some((key) => {
806
+ if (!(key in s)) {
807
+ return false;
808
+ }
809
+ const value = s[key];
810
+ if (typeof value === "object" && value !== null && !Array.isArray(value)) {
811
+ return false;
812
+ }
813
+ return true;
814
+ });
815
+ }
816
+ /**
817
+ * Performs non-destructive V1 -> V2 transformation.
818
+ *
819
+ * Detailed strategy:
820
+ * 1) Relocate known V1 keys using `V1_TO_V2_MIGRATION_MAP`.
821
+ * - If a source value is already an object and maps to a child path of itself
822
+ * (partial V2 shape), merge child properties into target path.
823
+ * 2) Relocate disable* keys into V2 disable* locations.
824
+ * - Consolidated keys (`disableAutoUpdate`, `disableUpdateNag`): normalize to
825
+ * boolean with stable-compatible presence semantics (`value === true`).
826
+ * - Other disable* keys: migrate only boolean values.
827
+ * 3) Preserve `mcpServers` top-level placement.
828
+ * 4) Carry over remaining keys:
829
+ * - If a key is parent of migrated nested paths, merge unprocessed object children.
830
+ * - If parent value is non-object, preserve that scalar/array/null as-is.
831
+ * - Otherwise copy untouched key/value.
832
+ * 5) Stamp `$version = 2`.
833
+ *
834
+ * The method is pure with respect to input mutation.
835
+ */
836
+ migrate(settings, _scope) {
837
+ if (typeof settings !== "object" || settings === null) {
838
+ throw new Error("Settings must be an object");
839
+ }
840
+ const source = settings;
841
+ const result = {};
842
+ const processedKeys = /* @__PURE__ */ new Set();
843
+ const warnings = [];
844
+ for (const [v1Key, v2Path] of Object.entries(V1_TO_V2_MIGRATION_MAP)) {
845
+ if (v1Key in source) {
846
+ const value = source[v1Key];
847
+ if (V2_CONTAINER_KEYS.has(v1Key) && typeof value === "object" && value !== null && !Array.isArray(value)) {
848
+ result[v1Key] = value;
849
+ processedKeys.add(v1Key);
850
+ continue;
851
+ }
852
+ if (typeof value === "object" && value !== null && !Array.isArray(value) && v2Path.startsWith(v1Key + ".")) {
853
+ for (const [nestedKey, nestedValue] of Object.entries(value)) {
854
+ setNestedPropertySafe(
855
+ result,
856
+ `${v2Path}.${nestedKey}`,
857
+ nestedValue
858
+ );
859
+ }
860
+ } else {
861
+ setNestedPropertySafe(result, v2Path, value);
862
+ }
863
+ processedKeys.add(v1Key);
864
+ }
865
+ }
866
+ for (const [v1Key, v2Path] of Object.entries(
867
+ V1_TO_V2_PRESERVE_DISABLE_MAP
868
+ )) {
869
+ if (v1Key in source) {
870
+ const value = source[v1Key];
871
+ if (CONSOLIDATED_DISABLE_KEYS.has(v1Key)) {
872
+ setNestedPropertySafe(result, v2Path, value === true);
873
+ } else if (typeof value === "boolean") {
874
+ setNestedPropertySafe(result, v2Path, value);
875
+ }
876
+ processedKeys.add(v1Key);
877
+ }
878
+ }
879
+ if ("mcpServers" in source) {
880
+ result["mcpServers"] = source["mcpServers"];
881
+ processedKeys.add("mcpServers");
882
+ }
883
+ for (const key of Object.keys(source)) {
884
+ if (!processedKeys.has(key)) {
885
+ const isParentOfMigratedPath = Array.from(processedKeys).some(
886
+ (processedKey) => {
887
+ const v2Path = V1_TO_V2_MIGRATION_MAP[processedKey] || V1_TO_V2_PRESERVE_DISABLE_MAP[processedKey];
888
+ if (!v2Path) return false;
889
+ return v2Path.startsWith(key + ".");
890
+ }
891
+ );
892
+ if (isParentOfMigratedPath) {
893
+ const existingValue = source[key];
894
+ if (typeof existingValue === "object" && existingValue !== null && !Array.isArray(existingValue)) {
895
+ for (const [nestedKey, nestedValue] of Object.entries(
896
+ existingValue
897
+ )) {
898
+ const fullNestedPath = `${key}.${nestedKey}`;
899
+ const wasProcessed = Array.from(processedKeys).some(
900
+ (processedKey) => {
901
+ const v2Path = V1_TO_V2_MIGRATION_MAP[processedKey] || V1_TO_V2_PRESERVE_DISABLE_MAP[processedKey];
902
+ return v2Path === fullNestedPath;
903
+ }
904
+ );
905
+ if (!wasProcessed) {
906
+ setNestedPropertySafe(result, fullNestedPath, nestedValue);
907
+ }
908
+ }
909
+ } else {
910
+ result[key] = source[key];
911
+ }
912
+ } else {
913
+ result[key] = source[key];
914
+ }
915
+ }
916
+ }
917
+ result["$version"] = 2;
918
+ return { settings: result, warnings };
919
+ }
920
+ };
921
+ var v1ToV2Migration = new V1ToV2Migration();
922
+
923
+ // packages/cli/src/config/migration/versions/v2-to-v3.ts
924
+ init_esbuild_shims();
925
+ var V2_TO_V3_BOOLEAN_MAP = {
926
+ "general.disableAutoUpdate": "general.enableAutoUpdate",
927
+ "general.disableUpdateNag": "general.enableAutoUpdate",
928
+ "ui.accessibility.disableLoadingPhrases": "ui.accessibility.enableLoadingPhrases",
929
+ "context.fileFiltering.disableFuzzySearch": "context.fileFiltering.enableFuzzySearch",
930
+ "model.generationConfig.disableCacheControl": "model.generationConfig.enableCacheControl"
931
+ };
932
+ var CONSOLIDATED_V2_PATHS = {
933
+ "general.enableAutoUpdate": [
934
+ "general.disableAutoUpdate",
935
+ "general.disableUpdateNag"
936
+ ]
937
+ };
938
+ function normalizeDisableValue(value) {
939
+ if (value === void 0) {
940
+ return { isPresent: false, isValid: false };
941
+ }
942
+ if (typeof value === "boolean") {
943
+ return { isPresent: true, isValid: true, booleanValue: value };
944
+ }
945
+ if (typeof value === "string") {
946
+ const normalized = value.trim().toLowerCase();
947
+ if (normalized === "true") {
948
+ return { isPresent: true, isValid: true, booleanValue: true };
949
+ }
950
+ if (normalized === "false") {
951
+ return { isPresent: true, isValid: true, booleanValue: false };
952
+ }
953
+ }
954
+ return { isPresent: true, isValid: false };
955
+ }
956
+ __name(normalizeDisableValue, "normalizeDisableValue");
957
+ var V2ToV3Migration = class {
958
+ static {
959
+ __name(this, "V2ToV3Migration");
960
+ }
961
+ fromVersion = 2;
962
+ toVersion = 3;
963
+ /**
964
+ * Migration trigger rule.
965
+ *
966
+ * Execute only when `$version === 2`.
967
+ * This includes V2 files with no migratable disable* booleans so that version
968
+ * metadata still advances to 3.
969
+ */
970
+ shouldMigrate(settings) {
971
+ if (typeof settings !== "object" || settings === null) {
972
+ return false;
973
+ }
974
+ const s = settings;
975
+ return s["$version"] === 2;
976
+ }
977
+ /**
978
+ * Applies V2 -> V3 transformation with deterministic deprecated-key cleanup.
979
+ *
980
+ * Detailed strategy:
981
+ * 1) Clone input.
982
+ * 2) Process consolidated paths first:
983
+ * - Inspect each source path.
984
+ * - Normalize each present value (boolean / coercible string / invalid).
985
+ * - Always delete present deprecated source key.
986
+ * - Valid normalized values contribute to aggregate.
987
+ * - Invalid values emit warnings.
988
+ * - Emit consolidated target when at least one valid source was consumed.
989
+ * 3) Process remaining one-to-one mappings:
990
+ * - For each unmapped source, normalize value.
991
+ * - If valid -> delete old key and write inverted target.
992
+ * - If invalid -> delete old key and emit warning.
993
+ * 4) Set `$version = 3`.
994
+ *
995
+ * Guarantees:
996
+ * - Input object is not mutated.
997
+ * - Valid migration and invalid cleanup are deterministic.
998
+ * - Deprecated disable* keys are not retained after migration.
999
+ */
1000
+ migrate(settings, scope) {
1001
+ if (typeof settings !== "object" || settings === null) {
1002
+ throw new Error("Settings must be an object");
1003
+ }
1004
+ const result = structuredClone(settings);
1005
+ const processedPaths = /* @__PURE__ */ new Set();
1006
+ const warnings = [];
1007
+ for (const [newPath, oldPaths] of Object.entries(CONSOLIDATED_V2_PATHS)) {
1008
+ let hasAnyDisable = false;
1009
+ let hasAnyBooleanValue = false;
1010
+ for (const oldPath of oldPaths) {
1011
+ const oldValue = getNestedProperty(result, oldPath);
1012
+ const normalized = normalizeDisableValue(oldValue);
1013
+ if (!normalized.isPresent) {
1014
+ continue;
1015
+ }
1016
+ deleteNestedPropertySafe(result, oldPath);
1017
+ processedPaths.add(oldPath);
1018
+ if (normalized.isValid) {
1019
+ hasAnyBooleanValue = true;
1020
+ if (normalized.booleanValue === true) {
1021
+ hasAnyDisable = true;
1022
+ }
1023
+ } else {
1024
+ warnings.push(
1025
+ `Removed deprecated setting '${oldPath}' from ${scope} settings because the value is invalid. Expected boolean.`
1026
+ );
1027
+ }
1028
+ }
1029
+ if (hasAnyBooleanValue) {
1030
+ setNestedPropertySafe(result, newPath, !hasAnyDisable);
1031
+ }
1032
+ }
1033
+ for (const [oldPath, newPath] of Object.entries(V2_TO_V3_BOOLEAN_MAP)) {
1034
+ if (processedPaths.has(oldPath)) {
1035
+ continue;
1036
+ }
1037
+ const oldValue = getNestedProperty(result, oldPath);
1038
+ const normalized = normalizeDisableValue(oldValue);
1039
+ if (!normalized.isPresent) {
1040
+ continue;
1041
+ }
1042
+ deleteNestedPropertySafe(result, oldPath);
1043
+ if (normalized.isValid) {
1044
+ setNestedPropertySafe(result, newPath, !normalized.booleanValue);
1045
+ } else {
1046
+ warnings.push(
1047
+ `Removed deprecated setting '${oldPath}' from ${scope} settings because the value is invalid. Expected boolean or string "true"/"false".`
1048
+ );
1049
+ }
1050
+ }
1051
+ result["$version"] = 3;
1052
+ return { settings: result, warnings };
1053
+ }
1054
+ };
1055
+ var v2ToV3Migration = new V2ToV3Migration();
1056
+
1057
+ // packages/cli/src/config/migration/versions/v3-to-v4.ts
1058
+ init_esbuild_shims();
1059
+ var GIT_CO_AUTHOR_PATH = "general.gitCoAuthor";
1060
+ var V3ToV4Migration = class {
1061
+ static {
1062
+ __name(this, "V3ToV4Migration");
1063
+ }
1064
+ fromVersion = 3;
1065
+ toVersion = 4;
1066
+ shouldMigrate(settings) {
1067
+ if (typeof settings !== "object" || settings === null) {
1068
+ return false;
1069
+ }
1070
+ const s = settings;
1071
+ if (s["$version"] === 3) {
1072
+ return true;
1073
+ }
1074
+ if (s["$version"] === void 0) {
1075
+ const value = getNestedProperty(s, GIT_CO_AUTHOR_PATH);
1076
+ if (value === void 0) return false;
1077
+ if (typeof value === "object" && value !== null && !Array.isArray(value)) {
1078
+ return false;
1079
+ }
1080
+ return true;
1081
+ }
1082
+ return false;
1083
+ }
1084
+ migrate(settings, scope) {
1085
+ if (typeof settings !== "object" || settings === null) {
1086
+ throw new Error("Settings must be an object");
1087
+ }
1088
+ const result = structuredClone(settings);
1089
+ const warnings = [];
1090
+ const value = getNestedProperty(result, GIT_CO_AUTHOR_PATH);
1091
+ if (typeof value === "boolean") {
1092
+ setNestedPropertySafe(result, GIT_CO_AUTHOR_PATH, {
1093
+ commit: value,
1094
+ pr: value
1095
+ });
1096
+ } else if (typeof value === "string") {
1097
+ const lowered = value.trim().toLowerCase();
1098
+ const disableIntent = ["false", "no", "off", "0", "disabled", ""];
1099
+ const enableIntent = ["true", "yes", "on", "1", "enabled"];
1100
+ if (enableIntent.includes(lowered)) {
1101
+ setNestedPropertySafe(result, GIT_CO_AUTHOR_PATH, {
1102
+ commit: true,
1103
+ pr: true
1104
+ });
1105
+ } else if (disableIntent.includes(lowered)) {
1106
+ setNestedPropertySafe(result, GIT_CO_AUTHOR_PATH, {
1107
+ commit: false,
1108
+ pr: false
1109
+ });
1110
+ } else {
1111
+ setNestedPropertySafe(result, GIT_CO_AUTHOR_PATH, {
1112
+ commit: false,
1113
+ pr: false
1114
+ });
1115
+ warnings.push(
1116
+ `Reset '${GIT_CO_AUTHOR_PATH}' in ${scope} settings to {commit: false, pr: false} because the stored string '${value}' was not a recognized boolean form.`
1117
+ );
1118
+ }
1119
+ } else if (value !== void 0 && (typeof value !== "object" || value === null || Array.isArray(value))) {
1120
+ setNestedPropertySafe(result, GIT_CO_AUTHOR_PATH, {
1121
+ commit: false,
1122
+ pr: false
1123
+ });
1124
+ warnings.push(
1125
+ `Reset '${GIT_CO_AUTHOR_PATH}' in ${scope} settings to {commit: false, pr: false} because the stored value was not a boolean or object.`
1126
+ );
1127
+ }
1128
+ result["$version"] = 4;
1129
+ return { settings: result, warnings };
1130
+ }
1131
+ };
1132
+ var v3ToV4Migration = new V3ToV4Migration();
1133
+
1134
+ // packages/cli/src/config/migration/versions/v5-to-v4.ts
1135
+ init_esbuild_shims();
1136
+ var PROVIDER_KEY_TO_PROTOCOL = {
1137
+ openai: "openai",
1138
+ "qwen-oauth": "qwen-oauth",
1139
+ gemini: "gemini",
1140
+ "vertex-ai": "gemini",
1141
+ anthropic: "anthropic"
1142
+ };
1143
+ function isWrappedProviderConfig(value) {
1144
+ return typeof value === "object" && value !== null && !Array.isArray(value);
1145
+ }
1146
+ __name(isWrappedProviderConfig, "isWrappedProviderConfig");
1147
+ var V5ToV4Migration = class {
1148
+ static {
1149
+ __name(this, "V5ToV4Migration");
1150
+ }
1151
+ fromVersion = 5;
1152
+ toVersion = 4;
1153
+ shouldMigrate(settings) {
1154
+ if (typeof settings !== "object" || settings === null) {
1155
+ return false;
1156
+ }
1157
+ const s = settings;
1158
+ if (s["$version"] === 5) {
1159
+ return true;
1160
+ }
1161
+ if (s["$version"] !== void 0) {
1162
+ return false;
1163
+ }
1164
+ const modelProviders = s["modelProviders"];
1165
+ if (typeof modelProviders !== "object" || modelProviders === null) {
1166
+ return false;
1167
+ }
1168
+ return Object.values(modelProviders).some(
1169
+ (v) => isWrappedProviderConfig(v)
1170
+ );
1171
+ }
1172
+ migrate(settings, _scope) {
1173
+ if (typeof settings !== "object" || settings === null) {
1174
+ throw new Error("Settings must be an object");
1175
+ }
1176
+ const result = structuredClone(settings);
1177
+ const warnings = [];
1178
+ const modelProviders = result["modelProviders"];
1179
+ if (typeof modelProviders === "object" && modelProviders !== null) {
1180
+ const providers = modelProviders;
1181
+ for (const [key, value] of Object.entries(providers)) {
1182
+ if (Array.isArray(value)) {
1183
+ continue;
1184
+ }
1185
+ if (!isWrappedProviderConfig(value)) {
1186
+ continue;
1187
+ }
1188
+ const derivedProtocol = Object.hasOwn(PROVIDER_KEY_TO_PROTOCOL, key) ? PROVIDER_KEY_TO_PROTOCOL[key] : void 0;
1189
+ if (typeof value.protocol === "string" && derivedProtocol !== void 0 && value.protocol !== derivedProtocol) {
1190
+ warnings.push(
1191
+ `Provider "${key}" declared protocol "${value.protocol}", but V4 derives protocol "${derivedProtocol}" from the provider key. The explicit protocol has been dropped.`
1192
+ );
1193
+ }
1194
+ providers[key] = Array.isArray(value.models) ? value.models : [];
1195
+ }
1196
+ }
1197
+ result["$version"] = 4;
1198
+ return { settings: result, warnings };
1199
+ }
1200
+ };
1201
+ var v5ToV4Migration = new V5ToV4Migration();
1202
+
1203
+ // packages/cli/src/config/migration/index.ts
1204
+ var ALL_MIGRATIONS = [
1205
+ v1ToV2Migration,
1206
+ v2ToV3Migration,
1207
+ v3ToV4Migration
1208
+ ];
1209
+ var DOWNGRADE_MIGRATIONS = [v5ToV4Migration];
1210
+ var CONVERGENCE_MIGRATIONS = [
1211
+ ...ALL_MIGRATIONS,
1212
+ ...DOWNGRADE_MIGRATIONS
1213
+ ];
1214
+ function runMigrations(settings, scope) {
1215
+ const scheduler = new MigrationScheduler([...CONVERGENCE_MIGRATIONS], scope);
1216
+ return scheduler.migrate(settings);
1217
+ }
1218
+ __name(runMigrations, "runMigrations");
1219
+ function needsMigration(settings) {
1220
+ if (typeof settings !== "object" || settings === null) {
1221
+ return false;
1222
+ }
1223
+ const s = settings;
1224
+ const version = s["$version"];
1225
+ const hasApplicableMigration = CONVERGENCE_MIGRATIONS.some(
1226
+ (migration) => migration.shouldMigrate(settings)
1227
+ );
1228
+ if (typeof version === "number") {
1229
+ if (version === SETTINGS_VERSION) {
1230
+ return false;
1231
+ }
1232
+ return hasApplicableMigration;
1233
+ }
1234
+ return hasApplicableMigration;
1235
+ }
1236
+ __name(needsMigration, "needsMigration");
1237
+
1238
+ // packages/cli/src/config/settings.ts
1239
+ var debugLogger2 = createDebugLogger("SETTINGS");
1240
+ function getMergeStrategyForPath(path3) {
1241
+ let current = void 0;
1242
+ let currentSchema = getSettingsSchema();
1243
+ for (const key of path3) {
1244
+ if (!currentSchema || !currentSchema[key]) {
1245
+ return void 0;
1246
+ }
1247
+ current = currentSchema[key];
1248
+ currentSchema = current.properties;
1249
+ }
1250
+ return current?.mergeStrategy;
1251
+ }
1252
+ __name(getMergeStrategyForPath, "getMergeStrategyForPath");
1253
+ function getUserSettingsPath() {
1254
+ return Storage.getGlobalSettingsPath();
1255
+ }
1256
+ __name(getUserSettingsPath, "getUserSettingsPath");
1257
+ function getUserSettingsDir() {
1258
+ return path2.dirname(getUserSettingsPath());
1259
+ }
1260
+ __name(getUserSettingsDir, "getUserSettingsDir");
1261
+ var SETTINGS_VERSION = 4;
1262
+ var SETTINGS_VERSION_KEY = "$version";
1263
+ function migrateLegacyPermissions(settings) {
1264
+ const tools = settings["tools"];
1265
+ if (!tools) return null;
1266
+ const hasLegacy = Array.isArray(tools["core"]) || Array.isArray(tools["allowed"]) || Array.isArray(tools["exclude"]);
1267
+ if (!hasLegacy) return null;
1268
+ const result = structuredClone(settings);
1269
+ const resultTools = result["tools"];
1270
+ const permissions = result["permissions"] ?? {};
1271
+ result["permissions"] = permissions;
1272
+ const mergeInto = /* @__PURE__ */ __name((key, items) => {
1273
+ const existing = Array.isArray(permissions[key]) ? permissions[key] : [];
1274
+ const merged = Array.from(/* @__PURE__ */ new Set([...existing, ...items]));
1275
+ permissions[key] = merged;
1276
+ }, "mergeInto");
1277
+ if (Array.isArray(resultTools["allowed"])) {
1278
+ mergeInto("allow", resultTools["allowed"]);
1279
+ delete resultTools["allowed"];
1280
+ }
1281
+ if (Array.isArray(resultTools["exclude"])) {
1282
+ mergeInto("deny", resultTools["exclude"]);
1283
+ delete resultTools["exclude"];
1284
+ }
1285
+ if (Array.isArray(resultTools["core"])) {
1286
+ mergeInto("allow", resultTools["core"]);
1287
+ delete resultTools["core"];
1288
+ }
1289
+ return result;
1290
+ }
1291
+ __name(migrateLegacyPermissions, "migrateLegacyPermissions");
1292
+ var SettingScope = /* @__PURE__ */ ((SettingScope2) => {
1293
+ SettingScope2["User"] = "User";
1294
+ SettingScope2["Workspace"] = "Workspace";
1295
+ SettingScope2["System"] = "System";
1296
+ SettingScope2["SystemDefaults"] = "SystemDefaults";
1297
+ return SettingScope2;
1298
+ })(SettingScope || {});
1299
+ function getSettingsFileKeyWarnings(settings, settingsFilePath) {
1300
+ const version = settings[SETTINGS_VERSION_KEY];
1301
+ if (typeof version !== "number" || version < SETTINGS_VERSION) {
1302
+ return [];
1303
+ }
1304
+ const warnings = [];
1305
+ const ignoredLegacyKeys = /* @__PURE__ */ new Set();
1306
+ for (const [oldKey, newPath] of Object.entries(V1_TO_V2_MIGRATION_MAP)) {
1307
+ if (oldKey === newPath) {
1308
+ continue;
1309
+ }
1310
+ if (!(oldKey in settings)) {
1311
+ continue;
1312
+ }
1313
+ const oldValue = settings[oldKey];
1314
+ if (V2_CONTAINER_KEYS.has(oldKey) && typeof oldValue === "object" && oldValue !== null && !Array.isArray(oldValue)) {
1315
+ continue;
1316
+ }
1317
+ ignoredLegacyKeys.add(oldKey);
1318
+ warnings.push(
1319
+ `Warning: Legacy setting '${oldKey}' will be ignored in ${settingsFilePath}. Please use '${newPath}' instead.`
1320
+ );
1321
+ }
1322
+ const schemaKeys = new Set(Object.keys(getSettingsSchema()));
1323
+ for (const key of Object.keys(settings)) {
1324
+ if (key === SETTINGS_VERSION_KEY) {
1325
+ continue;
1326
+ }
1327
+ if (ignoredLegacyKeys.has(key)) {
1328
+ continue;
1329
+ }
1330
+ if (schemaKeys.has(key)) {
1331
+ continue;
1332
+ }
1333
+ debugLogger2.warn(
1334
+ `Unknown setting '${key}' will be ignored in ${settingsFilePath}.`
1335
+ );
1336
+ }
1337
+ return warnings;
1338
+ }
1339
+ __name(getSettingsFileKeyWarnings, "getSettingsFileKeyWarnings");
1340
+ function isPlainObject2(value) {
1341
+ return typeof value === "object" && value !== null && !Array.isArray(value);
1342
+ }
1343
+ __name(isPlainObject2, "isPlainObject");
1344
+ function hasAnyProviderEntries(modelProviders) {
1345
+ if (!isPlainObject2(modelProviders)) {
1346
+ return false;
1347
+ }
1348
+ return Object.values(modelProviders).some(
1349
+ (providerModels) => Array.isArray(providerModels) && providerModels.length > 0
1350
+ );
1351
+ }
1352
+ __name(hasAnyProviderEntries, "hasAnyProviderEntries");
1353
+ function getModelProvidersOverrideWarnings(loadedSettings) {
1354
+ if (!loadedSettings.isTrusted) {
1355
+ return [];
1356
+ }
1357
+ const userOriginal = loadedSettings.user.originalSettings;
1358
+ const workspaceOriginal = loadedSettings.workspace.originalSettings;
1359
+ if (!hasOwnModelProviders(userOriginal) || !hasOwnModelProviders(workspaceOriginal)) {
1360
+ return [];
1361
+ }
1362
+ const userModelProviders = userOriginal["modelProviders"];
1363
+ const workspaceModelProviders = workspaceOriginal["modelProviders"];
1364
+ const workspaceIsEmptyModelProviders = isPlainObject2(workspaceModelProviders) && Object.keys(workspaceModelProviders).length === 0;
1365
+ if (!workspaceIsEmptyModelProviders || !hasAnyProviderEntries(userModelProviders)) {
1366
+ return [];
1367
+ }
1368
+ return [
1369
+ `Warning: '${loadedSettings.workspace.path}' defines an empty 'modelProviders' object. This has no effect with current merge behavior, but may indicate a configuration error. If REPLACE semantics are introduced for 'modelProviders' in the future, this would override user-level model providers in '${loadedSettings.user.path}'.`
1370
+ ];
1371
+ }
1372
+ __name(getModelProvidersOverrideWarnings, "getModelProvidersOverrideWarnings");
1373
+ function getSettingsWarnings(loadedSettings) {
1374
+ const warningSet = /* @__PURE__ */ new Set();
1375
+ for (const warning of loadedSettings.migrationWarnings) {
1376
+ warningSet.add(`Warning: ${warning}`);
1377
+ }
1378
+ for (const scope of ["User" /* User */, "Workspace" /* Workspace */]) {
1379
+ const settingsFile = loadedSettings.forScope(scope);
1380
+ if (settingsFile.rawJson === void 0) {
1381
+ continue;
1382
+ }
1383
+ const settingsObject = settingsFile.originalSettings;
1384
+ for (const warning of getSettingsFileKeyWarnings(
1385
+ settingsObject,
1386
+ settingsFile.path
1387
+ )) {
1388
+ warningSet.add(warning);
1389
+ }
1390
+ }
1391
+ for (const warning of getModelProvidersOverrideWarnings(loadedSettings)) {
1392
+ warningSet.add(warning);
1393
+ }
1394
+ const workspaceFile = loadedSettings.forScope("Workspace" /* Workspace */);
1395
+ if (workspaceFile.rawJson !== void 0 && workspaceFile.originalSettings.security?.allowPrivateNetworkHooks !== void 0) {
1396
+ warningSet.add(
1397
+ `Warning: security.allowPrivateNetworkHooks in workspace settings (${workspaceFile.path}) is ignored. This setting is only honored from User, System, or SystemDefaults scope settings.`
1398
+ );
1399
+ }
1400
+ if (workspaceFile.rawJson !== void 0 && workspaceFile.originalSettings.security?.allowedInsecureVoiceBaseUrls !== void 0) {
1401
+ warningSet.add(
1402
+ `Warning: security.allowedInsecureVoiceBaseUrls in workspace settings (${workspaceFile.path}) is ignored. This setting is only honored from User, System, or SystemDefaults scope settings.`
1403
+ );
1404
+ }
1405
+ return [...warningSet];
1406
+ }
1407
+ __name(getSettingsWarnings, "getSettingsWarnings");
1408
+ function tagMcpServerScope(settings, scope) {
1409
+ const servers = settings.mcpServers;
1410
+ if (!servers || Object.keys(servers).length === 0) {
1411
+ return settings;
1412
+ }
1413
+ const tagged = {};
1414
+ for (const [name, config] of Object.entries(servers)) {
1415
+ tagged[name] = { ...config, scope };
1416
+ }
1417
+ return { ...settings, mcpServers: tagged };
1418
+ }
1419
+ __name(tagMcpServerScope, "tagMcpServerScope");
1420
+ function stripWorkspaceSecurityBypasses(settings) {
1421
+ if (settings.security?.allowPrivateNetworkHooks === void 0 && settings.security?.allowedInsecureVoiceBaseUrls === void 0) {
1422
+ return settings;
1423
+ }
1424
+ const {
1425
+ allowPrivateNetworkHooks: _privateHooks,
1426
+ allowedInsecureVoiceBaseUrls: _insecureVoice,
1427
+ ...restSecurity
1428
+ } = settings.security;
1429
+ return { ...settings, security: restSecurity };
1430
+ }
1431
+ __name(stripWorkspaceSecurityBypasses, "stripWorkspaceSecurityBypasses");
1432
+ function mergeSettings(system, systemDefaults, user, workspace, isTrusted) {
1433
+ const safeWorkspace = isTrusted ? tagMcpServerScope(stripWorkspaceSecurityBypasses(workspace), "workspace") : {};
1434
+ return customDeepMerge(
1435
+ getMergeStrategyForPath,
1436
+ {},
1437
+ // Start with an empty object
1438
+ systemDefaults,
1439
+ user,
1440
+ safeWorkspace,
1441
+ tagMcpServerScope(system, "system")
1442
+ );
1443
+ }
1444
+ __name(mergeSettings, "mergeSettings");
1445
+ var LoadedSettings = class {
1446
+ static {
1447
+ __name(this, "LoadedSettings");
1448
+ }
1449
+ constructor(system, systemDefaults, user, workspace, isTrusted, migratedInMemoryScopes, migrationWarnings = [], corruptedPath = void 0, wasRecovered = false, workspaceSettingsActive = true) {
1450
+ this.system = system;
1451
+ this.systemDefaults = systemDefaults;
1452
+ this.user = user;
1453
+ this.workspace = workspace;
1454
+ this.isTrusted = isTrusted;
1455
+ this.migratedInMemoryScopes = migratedInMemoryScopes;
1456
+ this.migrationWarnings = migrationWarnings;
1457
+ this.corruptedPath = corruptedPath;
1458
+ this.wasRecovered = wasRecovered;
1459
+ this.workspaceSettingsActive = workspaceSettingsActive;
1460
+ this._merged = this.computeMergedSettings();
1461
+ }
1462
+ system;
1463
+ systemDefaults;
1464
+ user;
1465
+ workspace;
1466
+ isTrusted;
1467
+ migratedInMemoryScopes;
1468
+ migrationWarnings;
1469
+ corruptedPath;
1470
+ wasRecovered;
1471
+ workspaceSettingsActive;
1472
+ corruptionDialogDismissed = false;
1473
+ _merged;
1474
+ get merged() {
1475
+ return this._merged;
1476
+ }
1477
+ computeMergedSettings() {
1478
+ return mergeSettings(
1479
+ this.system.settings,
1480
+ this.systemDefaults.settings,
1481
+ this.user.settings,
1482
+ this.workspace.settings,
1483
+ this.isTrusted
1484
+ );
1485
+ }
1486
+ forScope(scope) {
1487
+ switch (scope) {
1488
+ case "User" /* User */:
1489
+ return this.user;
1490
+ case "Workspace" /* Workspace */:
1491
+ return this.workspace;
1492
+ case "System" /* System */:
1493
+ return this.system;
1494
+ case "SystemDefaults" /* SystemDefaults */:
1495
+ return this.systemDefaults;
1496
+ default:
1497
+ throw new Error(`Invalid scope: ${scope}`);
1498
+ }
1499
+ }
1500
+ setValue(scope, key, value, assertCanCommit, opts = {}) {
1501
+ if (key === "model.name" && typeof value === "string") {
1502
+ value = stripRuntimeSnapshotPrefix(value);
1503
+ }
1504
+ assertCanCommit?.();
1505
+ const settingsFile = this.forScope(scope);
1506
+ const replacePath = key === "mcpServers" ? key.split(".") : [];
1507
+ if (opts.throwOnWriteFailure) {
1508
+ saveSettings(
1509
+ settingsFile,
1510
+ createSettingsUpdate(key, value),
1511
+ replacePath,
1512
+ {
1513
+ throwOnWriteFailure: true
1514
+ }
1515
+ );
1516
+ }
1517
+ setNestedPropertySafe(settingsFile.settings, key, value);
1518
+ setNestedPropertySafe(settingsFile.originalSettings, key, value);
1519
+ this._merged = this.computeMergedSettings();
1520
+ if (!opts.throwOnWriteFailure) {
1521
+ saveSettings(settingsFile, createSettingsUpdate(key, value), replacePath);
1522
+ }
1523
+ }
1524
+ setValues(writes, onScopeCommitted, assertCanCommit) {
1525
+ const scopes = /* @__PURE__ */ new Set();
1526
+ for (const write of writes) {
1527
+ const value = write.key === "model.name" && typeof write.value === "string" ? stripRuntimeSnapshotPrefix(write.value) : write.value;
1528
+ const settingsFile = this.forScope(write.scope);
1529
+ setNestedPropertySafe(settingsFile.settings, write.key, value);
1530
+ setNestedPropertySafe(settingsFile.originalSettings, write.key, value);
1531
+ scopes.add(write.scope);
1532
+ }
1533
+ this._merged = this.computeMergedSettings();
1534
+ const scopeList = Array.from(scopes);
1535
+ for (let i = 0; i < scopeList.length; i++) {
1536
+ const scope = scopeList[i];
1537
+ try {
1538
+ assertCanCommit?.();
1539
+ saveSettings(this.forScope(scope), void 0, void 0, {
1540
+ throwOnWriteFailure: true
1541
+ });
1542
+ } catch (err) {
1543
+ for (const uncommittedScope of scopeList.slice(i)) {
1544
+ this.reloadScopeFromDisk(uncommittedScope);
1545
+ }
1546
+ throw err;
1547
+ }
1548
+ onScopeCommitted?.(scope);
1549
+ }
1550
+ }
1551
+ recomputeMerged() {
1552
+ this._merged = this.computeMergedSettings();
1553
+ }
1554
+ reloadScopeFromDisk(scope) {
1555
+ const file = this.forScope(scope);
1556
+ try {
1557
+ if (!fs3.existsSync(file.path)) {
1558
+ file.settings = {};
1559
+ file.originalSettings = {};
1560
+ file.rawJson = void 0;
1561
+ this._merged = this.computeMergedSettings();
1562
+ return;
1563
+ }
1564
+ const content = fs3.readFileSync(file.path, "utf-8");
1565
+ const parsed = JSON.parse((0, import_strip_json_comments.default)(content));
1566
+ if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
1567
+ const resolved = resolveEnvVarsInObject(
1568
+ parsed,
1569
+ getHomeEnvFallbackVars((message) => debugLogger2.warn(message))
1570
+ );
1571
+ file.settings = resolved;
1572
+ file.originalSettings = structuredClone(parsed);
1573
+ file.rawJson = content;
1574
+ }
1575
+ } catch (err) {
1576
+ debugLogger2.warn(
1577
+ `reloadScopeFromDisk(${scope}): ${getErrorMessage(err)}`
1578
+ );
1579
+ }
1580
+ this._merged = this.computeMergedSettings();
1581
+ }
1582
+ /**
1583
+ * Get user-level hooks from user settings (not merged with workspace).
1584
+ * These hooks should always be loaded regardless of folder trust.
1585
+ */
1586
+ getUserHooks() {
1587
+ return this.user.settings.hooks;
1588
+ }
1589
+ /**
1590
+ * Get project-level hooks from workspace settings (not merged).
1591
+ * Returns undefined if workspace is not trusted (hooks filtered out).
1592
+ */
1593
+ getProjectHooks() {
1594
+ if (!this.isTrusted) {
1595
+ return void 0;
1596
+ }
1597
+ return this.workspace.settings.hooks;
1598
+ }
1599
+ };
1600
+ function createMinimalSettings() {
1601
+ const emptySettingsFile = {
1602
+ path: "",
1603
+ settings: {},
1604
+ originalSettings: {},
1605
+ rawJson: "{}"
1606
+ };
1607
+ return new LoadedSettings(
1608
+ emptySettingsFile,
1609
+ emptySettingsFile,
1610
+ emptySettingsFile,
1611
+ emptySettingsFile,
1612
+ false,
1613
+ /* @__PURE__ */ new Set(),
1614
+ [],
1615
+ void 0,
1616
+ false
1617
+ );
1618
+ }
1619
+ __name(createMinimalSettings, "createMinimalSettings");
1620
+ function detectQwenHomeRedirectWithoutMigration(activeUserSettingsPath) {
1621
+ if (!process.env["QWEN_HOME"]) {
1622
+ return null;
1623
+ }
1624
+ const activeQwenDir = Storage.getGlobalQwenDir();
1625
+ const savedQwenHome = process.env["QWEN_HOME"];
1626
+ delete process.env["QWEN_HOME"];
1627
+ let legacyQwenDir;
1628
+ try {
1629
+ legacyQwenDir = Storage.getGlobalQwenDir();
1630
+ } finally {
1631
+ process.env["QWEN_HOME"] = savedQwenHome;
1632
+ }
1633
+ if (path2.resolve(activeQwenDir) === path2.resolve(legacyQwenDir)) {
1634
+ return null;
1635
+ }
1636
+ if (fs3.existsSync(activeUserSettingsPath)) {
1637
+ return null;
1638
+ }
1639
+ const legacyUserSettings = path2.join(legacyQwenDir, "settings.json");
1640
+ if (!fs3.existsSync(legacyUserSettings)) {
1641
+ return null;
1642
+ }
1643
+ return `QWEN_HOME points to "${activeQwenDir}" but no settings.json was found there. Existing config remains at "${legacyQwenDir}" \u2014 OAuth tokens, settings, memory, extensions, and skills are not auto-migrated. Copy them manually if you want them to apply at the new location.`;
1644
+ }
1645
+ __name(detectQwenHomeRedirectWithoutMigration, "detectQwenHomeRedirectWithoutMigration");
1646
+ var CORRUPTED_SUFFIX = ".corrupted";
1647
+ function loadSettings(workspaceDir = process.cwd(), consumeCorruptionEnvVars = true) {
1648
+ const opts = typeof consumeCorruptionEnvVars === "object" ? consumeCorruptionEnvVars : { consumeCorruptionEnvVars };
1649
+ preResolveHomeEnvOverrides();
1650
+ const userSettingsPath = getUserSettingsPath();
1651
+ const qwenHomeRedirectWarning = detectQwenHomeRedirectWithoutMigration(userSettingsPath);
1652
+ let systemSettings = {};
1653
+ let systemDefaultSettings = {};
1654
+ let userSettings = {};
1655
+ let workspaceSettings = {};
1656
+ const settingsErrors = [];
1657
+ const systemSettingsPath = getSystemSettingsPath();
1658
+ const systemDefaultsPath = getSystemDefaultsPath();
1659
+ const migratedInMemoryScopes = /* @__PURE__ */ new Set();
1660
+ const resolvedWorkspaceDir = path2.resolve(workspaceDir);
1661
+ const resolvedHomeDir = path2.resolve(homedir());
1662
+ let realWorkspaceDir = resolvedWorkspaceDir;
1663
+ try {
1664
+ realWorkspaceDir = fs3.realpathSync(resolvedWorkspaceDir);
1665
+ } catch (_e) {
1666
+ }
1667
+ const realHomeDir = fs3.realpathSync(resolvedHomeDir);
1668
+ const workspaceSettingsPath = new Storage(
1669
+ workspaceDir
1670
+ ).getWorkspaceSettingsPath();
1671
+ const loadAndMigrate = /* @__PURE__ */ __name((filePath, scope) => {
1672
+ try {
1673
+ if (fs3.existsSync(filePath)) {
1674
+ const content = fs3.readFileSync(filePath, "utf-8");
1675
+ let rawSettings;
1676
+ const corruptedPath = `${filePath}${CORRUPTED_SUFFIX}`;
1677
+ let corruptedSaved = false;
1678
+ let recoveredFromEnvVar = null;
1679
+ try {
1680
+ rawSettings = JSON.parse((0, import_strip_json_comments.default)(content));
1681
+ } catch (parseError) {
1682
+ debugLogger2.warn(
1683
+ `Settings file ${filePath} has invalid JSON (${getErrorMessage(parseError)}). Resetting to empty settings.`
1684
+ );
1685
+ try {
1686
+ fs3.copyFileSync(filePath, corruptedPath);
1687
+ corruptedSaved = true;
1688
+ } catch (copyError) {
1689
+ debugLogger2.warn(
1690
+ `Failed to copy corrupted file: ${getErrorMessage(copyError)}`
1691
+ );
1692
+ }
1693
+ if (!rawSettings) {
1694
+ const warningMsg = `Settings file ${filePath} has invalid JSON. Your settings have been reset.`;
1695
+ debugLogger2.warn(warningMsg);
1696
+ if (corruptedSaved) {
1697
+ try {
1698
+ fs3.writeFileSync(filePath, "{}", "utf-8");
1699
+ } catch {
1700
+ }
1701
+ }
1702
+ return {
1703
+ settings: {},
1704
+ migrationWarnings: [],
1705
+ corruptedPath: corruptedSaved ? corruptedPath : void 0,
1706
+ wasRecovered: false
1707
+ };
1708
+ }
1709
+ }
1710
+ const envCorruptedPath = process.env[ENV_CORRUPTED_PATH];
1711
+ if ((opts.consumeCorruptionEnvVars ?? true) && envCorruptedPath && envCorruptedPath === corruptedPath && scope === "User" /* User */) {
1712
+ corruptedSaved = true;
1713
+ recoveredFromEnvVar = process.env[ENV_WAS_RECOVERED] === "1";
1714
+ delete process.env[ENV_CORRUPTED_PATH];
1715
+ delete process.env[ENV_WAS_RECOVERED];
1716
+ }
1717
+ if (typeof rawSettings !== "object" || rawSettings === null || Array.isArray(rawSettings)) {
1718
+ settingsErrors.push({
1719
+ message: "Settings file is not a valid JSON object.",
1720
+ path: filePath
1721
+ });
1722
+ return { settings: {} };
1723
+ }
1724
+ let settingsObject = rawSettings;
1725
+ const hasVersionKey = SETTINGS_VERSION_KEY in settingsObject;
1726
+ const versionValue = settingsObject[SETTINGS_VERSION_KEY];
1727
+ const hasInvalidVersion = hasVersionKey && typeof versionValue !== "number";
1728
+ const hasLegacyNumericVersion = typeof versionValue === "number" && versionValue < SETTINGS_VERSION;
1729
+ let migrationWarnings;
1730
+ const persistSettingsObject = /* @__PURE__ */ __name((warningPrefix) => {
1731
+ try {
1732
+ const written = updateSettingsFilePreservingFormat(
1733
+ filePath,
1734
+ settingsObject,
1735
+ true
1736
+ );
1737
+ if (!written) {
1738
+ debugLogger2.error(
1739
+ `${warningPrefix}: updateSettingsFilePreservingFormat returned false for ${filePath}`
1740
+ );
1741
+ }
1742
+ } catch (e) {
1743
+ debugLogger2.error(`${warningPrefix}: ${getErrorMessage(e)}`);
1744
+ }
1745
+ }, "persistSettingsObject");
1746
+ if (needsMigration(settingsObject)) {
1747
+ const migrationResult = runMigrations(settingsObject, scope);
1748
+ if (migrationResult.executedMigrations.length > 0) {
1749
+ settingsObject = migrationResult.settings;
1750
+ migrationWarnings = migrationResult.warnings;
1751
+ persistSettingsObject("Error migrating settings file on disk");
1752
+ } else if ((hasLegacyNumericVersion || hasInvalidVersion) && !corruptedSaved) {
1753
+ settingsObject[SETTINGS_VERSION_KEY] = SETTINGS_VERSION;
1754
+ debugLogger2.warn(
1755
+ `Settings version metadata in ${filePath} could not be migrated by any registered migration. Normalizing ${SETTINGS_VERSION_KEY} to ${SETTINGS_VERSION}.`
1756
+ );
1757
+ persistSettingsObject("Error normalizing settings version on disk");
1758
+ }
1759
+ } else if ((!hasVersionKey || hasInvalidVersion || hasLegacyNumericVersion) && !corruptedSaved) {
1760
+ settingsObject[SETTINGS_VERSION_KEY] = SETTINGS_VERSION;
1761
+ persistSettingsObject("Error normalizing settings version on disk");
1762
+ }
1763
+ const result = {
1764
+ settings: settingsObject,
1765
+ rawJson: content,
1766
+ migrationWarnings: migrationWarnings ?? []
1767
+ };
1768
+ if (corruptedSaved) {
1769
+ result.corruptedPath = corruptedPath;
1770
+ result.wasRecovered = recoveredFromEnvVar ?? false;
1771
+ }
1772
+ return result;
1773
+ }
1774
+ } catch (error) {
1775
+ settingsErrors.push({
1776
+ message: getErrorMessage(error),
1777
+ path: filePath
1778
+ });
1779
+ }
1780
+ return { settings: {} };
1781
+ }, "loadAndMigrate");
1782
+ const systemResult = loadAndMigrate(systemSettingsPath, "System" /* System */);
1783
+ const systemDefaultsResult = loadAndMigrate(
1784
+ systemDefaultsPath,
1785
+ "SystemDefaults" /* SystemDefaults */
1786
+ );
1787
+ const userResult = loadAndMigrate(userSettingsPath, "User" /* User */);
1788
+ let workspaceResult = {
1789
+ settings: {},
1790
+ rawJson: void 0
1791
+ };
1792
+ const workspaceSettingsActive = !opts.skipWorkspaceSettings && realWorkspaceDir !== realHomeDir;
1793
+ if (workspaceSettingsActive) {
1794
+ workspaceResult = loadAndMigrate(
1795
+ workspaceSettingsPath,
1796
+ "Workspace" /* Workspace */
1797
+ );
1798
+ }
1799
+ const systemOriginalSettings = structuredClone(systemResult.settings);
1800
+ const systemDefaultsOriginalSettings = structuredClone(
1801
+ systemDefaultsResult.settings
1802
+ );
1803
+ const userOriginalSettings = structuredClone(userResult.settings);
1804
+ const workspaceOriginalSettings = structuredClone(workspaceResult.settings);
1805
+ const homeEnvFallback = getHomeEnvFallbackVars(
1806
+ (message) => debugLogger2.warn(message)
1807
+ );
1808
+ systemSettings = resolveEnvVarsInObject(
1809
+ systemResult.settings,
1810
+ homeEnvFallback
1811
+ );
1812
+ systemDefaultSettings = resolveEnvVarsInObject(
1813
+ systemDefaultsResult.settings,
1814
+ homeEnvFallback
1815
+ );
1816
+ userSettings = resolveEnvVarsInObject(userResult.settings, homeEnvFallback);
1817
+ workspaceSettings = resolveEnvVarsInObject(
1818
+ workspaceResult.settings,
1819
+ homeEnvFallback
1820
+ );
1821
+ if (userSettings.ui?.theme === "VS") {
1822
+ userSettings.ui.theme = DEFAULT_LIGHT_THEME_NAME;
1823
+ } else if (userSettings.ui?.theme === "VS2015") {
1824
+ userSettings.ui.theme = DEFAULT_DARK_THEME_NAME;
1825
+ }
1826
+ if (workspaceSettings.ui?.theme === "VS") {
1827
+ workspaceSettings.ui.theme = DEFAULT_LIGHT_THEME_NAME;
1828
+ } else if (workspaceSettings.ui?.theme === "VS2015") {
1829
+ workspaceSettings.ui.theme = DEFAULT_DARK_THEME_NAME;
1830
+ }
1831
+ const initialTrustCheckSettings = customDeepMerge(
1832
+ getMergeStrategyForPath,
1833
+ {},
1834
+ systemSettings,
1835
+ userSettings
1836
+ );
1837
+ const isTrusted = opts.workspaceTrusted ?? isWorkspaceTrusted(
1838
+ initialTrustCheckSettings,
1839
+ void 0,
1840
+ realWorkspaceDir
1841
+ ).isTrusted ?? true;
1842
+ const tempMergedSettings = mergeSettings(
1843
+ systemSettings,
1844
+ systemDefaultSettings,
1845
+ userSettings,
1846
+ workspaceSettings,
1847
+ isTrusted
1848
+ );
1849
+ if (!opts.skipLoadEnvironment) {
1850
+ loadEnvironment(tempMergedSettings, workspaceDir);
1851
+ }
1852
+ if (settingsErrors.length > 0) {
1853
+ const errorMessages = settingsErrors.map(
1854
+ (error) => `Error in ${error.path}: ${error.message}`
1855
+ );
1856
+ throw new FatalConfigError(
1857
+ `${errorMessages.join("\n")}
1858
+ Please fix the configuration file(s) and try again.`
1859
+ );
1860
+ }
1861
+ const allMigrationWarnings = [
1862
+ ...qwenHomeRedirectWarning ? [qwenHomeRedirectWarning] : [],
1863
+ ...systemResult.migrationWarnings ?? [],
1864
+ ...systemDefaultsResult.migrationWarnings ?? [],
1865
+ ...userResult.migrationWarnings ?? [],
1866
+ ...workspaceResult.migrationWarnings ?? []
1867
+ ];
1868
+ return new LoadedSettings(
1869
+ {
1870
+ path: systemSettingsPath,
1871
+ settings: systemSettings,
1872
+ originalSettings: systemOriginalSettings,
1873
+ rawJson: systemResult.rawJson
1874
+ },
1875
+ {
1876
+ path: systemDefaultsPath,
1877
+ settings: systemDefaultSettings,
1878
+ originalSettings: systemDefaultsOriginalSettings,
1879
+ rawJson: systemDefaultsResult.rawJson
1880
+ },
1881
+ {
1882
+ path: userSettingsPath,
1883
+ settings: userSettings,
1884
+ originalSettings: userOriginalSettings,
1885
+ rawJson: userResult.rawJson
1886
+ },
1887
+ {
1888
+ path: workspaceSettingsPath,
1889
+ settings: workspaceSettings,
1890
+ originalSettings: workspaceOriginalSettings,
1891
+ rawJson: workspaceResult.rawJson
1892
+ },
1893
+ isTrusted,
1894
+ migratedInMemoryScopes,
1895
+ allMigrationWarnings,
1896
+ userResult.corruptedPath,
1897
+ userResult.wasRecovered ?? false,
1898
+ workspaceSettingsActive
1899
+ );
1900
+ }
1901
+ __name(loadSettings, "loadSettings");
1902
+ function createSettingsUpdate(key, value) {
1903
+ const root = {};
1904
+ setNestedPropertySafe(root, key, value);
1905
+ return root;
1906
+ }
1907
+ __name(createSettingsUpdate, "createSettingsUpdate");
1908
+ function saveSettings(settingsFile, updates = settingsFile.originalSettings, replacePath = [], opts = {}) {
1909
+ try {
1910
+ const dirPath = path2.dirname(settingsFile.path);
1911
+ if (!fs3.existsSync(dirPath)) {
1912
+ fs3.mkdirSync(dirPath, { recursive: true });
1913
+ }
1914
+ const written = updateSettingsFilePreservingFormat(
1915
+ settingsFile.path,
1916
+ updates,
1917
+ false,
1918
+ replacePath
1919
+ );
1920
+ if (!written) {
1921
+ const message = `saveSettings: updateSettingsFilePreservingFormat returned false for ${settingsFile.path}`;
1922
+ if (opts.throwOnWriteFailure) {
1923
+ throw new Error(message);
1924
+ }
1925
+ debugLogger2.error(message);
1926
+ }
1927
+ } catch (error) {
1928
+ debugLogger2.error("Error saving user settings file.");
1929
+ debugLogger2.error(error instanceof Error ? error.message : String(error));
1930
+ throw error;
1931
+ }
1932
+ }
1933
+ __name(saveSettings, "saveSettings");
1934
+
1935
+ export {
1936
+ getModelProvidersOwnerScope,
1937
+ getPersistScopeForModelSelection,
1938
+ getWritableScopes,
1939
+ getOwnKeyScope,
1940
+ OUTPUT_LANGUAGE_AUTO,
1941
+ isAutoLanguage,
1942
+ resolveOutputLanguageOrPreserveAuto,
1943
+ getOutputLanguageFilePath,
1944
+ updateOutputLanguageFile,
1945
+ writeOutputLanguageAndRegisterPath,
1946
+ initializeLlmOutputLanguage,
1947
+ getFlattenedSchema,
1948
+ getSettingDefinition,
1949
+ requiresRestart,
1950
+ getDefaultValue,
1951
+ getNestedValue,
1952
+ getNestedProperty,
1953
+ getEffectiveValue,
1954
+ getAllSettingKeys,
1955
+ validateSettingValue,
1956
+ getDialogSettingKeys,
1957
+ settingExistsInScope,
1958
+ setPendingSettingValue,
1959
+ setPendingSettingValueAny,
1960
+ getRestartRequiredFromModified,
1961
+ saveModifiedSettings,
1962
+ getDisplayValue,
1963
+ isDefaultValue,
1964
+ backupSettingsFile,
1965
+ restoreSettingsFromBackup,
1966
+ cleanupSettingsBackup,
1967
+ v1ToV2Migration,
1968
+ getUserSettingsPath,
1969
+ getUserSettingsDir,
1970
+ SETTINGS_VERSION,
1971
+ SETTINGS_VERSION_KEY,
1972
+ migrateLegacyPermissions,
1973
+ SettingScope,
1974
+ getSettingsWarnings,
1975
+ LoadedSettings,
1976
+ createMinimalSettings,
1977
+ CORRUPTED_SUFFIX,
1978
+ loadSettings,
1979
+ saveSettings
1980
+ };
1981
+ /**
1982
+ * @license
1983
+ * Copyright 2025 Qwen Team
1984
+ * SPDX-License-Identifier: Apache-2.0
1985
+ */
1986
+ /**
1987
+ * @license
1988
+ * Copyright 2025 Qwen team
1989
+ * SPDX-License-Identifier: Apache-2.0
1990
+ */
1991
+ /**
1992
+ * @license
1993
+ * Copyright 2025 Google LLC
1994
+ * SPDX-License-Identifier: Apache-2.0
1995
+ */