@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
@@ -1,43 +1,8 @@
1
1
  // Force strict mode and setup for ESM
2
2
  "use strict";
3
3
  import {
4
- DEFAULT_DARK_THEME_NAME,
5
- DEFAULT_LIGHT_THEME_NAME
6
- } from "./chunk-RKUWKYED.js";
7
- import {
8
- CONSOLIDATED_DISABLE_KEYS,
9
- V1_INDICATOR_KEYS,
10
- V1_TO_V2_MIGRATION_MAP,
11
- V1_TO_V2_PRESERVE_DISABLE_MAP,
12
- V2_CONTAINER_KEYS,
13
- resolveEnvVarsInObject
14
- } from "./chunk-GOXKNSDZ.js";
15
- import {
16
- getSystemDefaultsPath,
17
- getSystemSettingsPath
18
- } from "./chunk-IDS7MSUP.js";
19
- import {
20
- SUPPORTED_LANGUAGES,
21
- getLanguageNameFromLocale,
22
- getLanguageSettingsOptions,
23
- t
24
- } from "./chunk-PG62DFWD.js";
25
- import {
26
- getHomeEnvFallbackVars,
27
- loadEnvironment,
28
- preResolveHomeEnvOverrides
29
- } from "./chunk-B52AWKBB.js";
30
- import {
31
- ENV_CORRUPTED_PATH,
32
- ENV_WAS_RECOVERED
33
- } from "./chunk-UA5H3DS2.js";
34
- import {
35
- isWorkspaceTrusted,
36
- updateSettingsFilePreservingFormat
37
- } from "./chunk-HA3SAB64.js";
38
- import {
39
- require_strip_json_comments
40
- } from "./chunk-NPQ5ZKRP.js";
4
+ getLanguageSettingsOptions
5
+ } from "./chunk-5EJZE3FP.js";
41
6
  import {
42
7
  DEFAULT_MAX_SUBAGENT_DEPTH,
43
8
  DEFAULT_MAX_TOOL_CALLS_PER_TURN,
@@ -46,78 +11,24 @@ import {
46
11
  DEFAULT_TOOL_RESULTS_TOTAL_CHARS_THRESHOLD,
47
12
  DEFAULT_TRUNCATE_TOOL_OUTPUT_LINES,
48
13
  DEFAULT_TRUNCATE_TOOL_OUTPUT_THRESHOLD
49
- } from "./chunk-GXSNGY5M.js";
50
- import {
51
- stripRuntimeSnapshotPrefix
52
- } from "./chunk-VXZ5HAOV.js";
14
+ } from "./chunk-XX7QFP34.js";
53
15
  import {
54
16
  DEFAULT_QWEN_CUSTOM_IGNORE_FILE_NAMES
55
17
  } from "./chunk-EQL65XGA.js";
56
18
  import {
57
19
  DEFAULT_SENSITIVE_SPAN_ATTRIBUTE_MAX_LENGTH,
58
20
  SENSITIVE_SPAN_ATTRIBUTE_MAX_LENGTH_LIMIT
59
- } from "./chunk-LKRMNRSN.js";
60
- import {
61
- FatalConfigError,
62
- Storage,
63
- createDebugLogger,
64
- getErrorMessage
65
- } from "./chunk-OIVKILPI.js";
21
+ } from "./chunk-PDPFQ2FO.js";
66
22
  import {
67
23
  init_esbuild_shims
68
24
  } from "./chunk-5O2XNYP6.js";
69
25
  import {
70
- __name,
71
- __toESM
26
+ __name
72
27
  } from "./chunk-J2S4EL5Y.js";
73
28
 
74
- // packages/cli/src/config/settings.ts
75
- init_esbuild_shims();
76
- import * as fs3 from "node:fs";
77
- import * as path2 from "node:path";
78
- import { homedir } from "node:os";
79
- import process from "node:process";
80
- var import_strip_json_comments = __toESM(require_strip_json_comments(), 1);
81
-
82
- // packages/cli/src/config/modelProvidersScope.ts
83
- init_esbuild_shims();
84
- function hasOwnModelProviders(settingsObj) {
85
- if (!settingsObj || typeof settingsObj !== "object") {
86
- return false;
87
- }
88
- const obj = settingsObj;
89
- return Object.prototype.hasOwnProperty.call(obj, "modelProviders");
90
- }
91
- __name(hasOwnModelProviders, "hasOwnModelProviders");
92
- function getModelProvidersOwnerScope(settings) {
93
- if (settings.isTrusted && hasOwnModelProviders(settings.workspace.settings)) {
94
- return "Workspace" /* Workspace */;
95
- }
96
- if (hasOwnModelProviders(settings.user.settings)) {
97
- return "User" /* User */;
98
- }
99
- return void 0;
100
- }
101
- __name(getModelProvidersOwnerScope, "getModelProvidersOwnerScope");
102
- function getPersistScopeForModelSelection(settings) {
103
- return getModelProvidersOwnerScope(settings) ?? "User" /* User */;
104
- }
105
- __name(getPersistScopeForModelSelection, "getPersistScopeForModelSelection");
106
- function getWritableScopes(settings) {
107
- return settings.isTrusted ? ["Workspace" /* Workspace */, "User" /* User */] : ["User" /* User */];
108
- }
109
- __name(getWritableScopes, "getWritableScopes");
110
- function getOwnKeyScope(settings, key) {
111
- for (const scope of getWritableScopes(settings)) {
112
- const obj = settings.forScope(scope).settings;
113
- if (Object.prototype.hasOwnProperty.call(obj, key)) return scope;
114
- }
115
- return void 0;
116
- }
117
- __name(getOwnKeyScope, "getOwnKeyScope");
118
-
119
29
  // packages/cli/src/config/settingsSchema.ts
120
30
  init_esbuild_shims();
31
+ var DEFAULT_OPENAI_LOG_RETENTION_DAYS = 7;
121
32
  var TOGGLE_TYPES = /* @__PURE__ */ new Set([
122
33
  "boolean",
123
34
  "enum"
@@ -1391,6 +1302,18 @@ var SETTINGS_SCHEMA = {
1391
1302
  description: "Custom directory path for OpenAI API logs. If not specified, defaults to logs/openai in the current working directory.",
1392
1303
  showInDialog: false
1393
1304
  },
1305
+ openAILogRetentionDays: {
1306
+ type: "number",
1307
+ label: "OpenAI Log Retention (days)",
1308
+ category: "Model",
1309
+ // LoadedSettings._merged is cached without verified setValue→recompute
1310
+ // paths in all UI flows (same rationale as general.cleanupPeriodDays).
1311
+ requiresRestart: true,
1312
+ default: DEFAULT_OPENAI_LOG_RETENTION_DAYS,
1313
+ minimum: 0,
1314
+ description: "Number of days to retain OpenAI API log files written when enableOpenAILogging is on. Log files older than this are removed by an interactive-session background housekeeping pass that runs at most once per day. Set to 0 for minimum retention (~1 hour). For a custom openAILoggingDir, configure this at user or system scope; workspace-scoped retention is skipped because one directory can be shared by multiple workspaces.",
1315
+ showInDialog: false
1316
+ },
1394
1317
  generationConfig: {
1395
1318
  type: "object",
1396
1319
  label: "Generation Configuration",
@@ -3415,1893 +3338,13 @@ function getSettingsSchema() {
3415
3338
  }
3416
3339
  __name(getSettingsSchema, "getSettingsSchema");
3417
3340
 
3418
- // packages/cli/src/utils/settingsUtils.ts
3419
- init_esbuild_shims();
3420
- import * as fs2 from "node:fs";
3421
-
3422
- // packages/cli/src/utils/languageUtils.ts
3423
- init_esbuild_shims();
3424
- import * as fs from "node:fs";
3425
- import * as path from "node:path";
3426
- var LLM_OUTPUT_LANGUAGE_RULE_FILENAME = "output-language.md";
3427
- var LLM_OUTPUT_LANGUAGE_MARKER_PREFIX = "qwen-code:llm-output-language:";
3428
- var OUTPUT_LANGUAGE_AUTO = "auto";
3429
- function isAutoLanguage(value) {
3430
- return !value || value.toLowerCase() === OUTPUT_LANGUAGE_AUTO;
3431
- }
3432
- __name(isAutoLanguage, "isAutoLanguage");
3433
- function normalizeOutputLanguage(language) {
3434
- const normalized = language.trim().replace(/_/g, "-").toLowerCase();
3435
- const knownLanguageName = SUPPORTED_LANGUAGES.find(
3436
- (supportedLanguage) => supportedLanguage.fullName.toLowerCase() === normalized
3437
- );
3438
- if (knownLanguageName) {
3439
- return knownLanguageName.fullName;
3440
- }
3441
- const knownLocaleCode = SUPPORTED_LANGUAGES.some((supportedLanguage) => {
3442
- const code = supportedLanguage.code.toLowerCase();
3443
- const id = supportedLanguage.id.toLowerCase();
3444
- return normalized === code || normalized === id || normalized.startsWith(`${code}-`) || normalized.startsWith(`${id}-`) || normalized.startsWith(`${code}.`) || normalized.startsWith(`${id}.`) || normalized.startsWith(`${code}@`) || normalized.startsWith(`${id}@`);
3445
- });
3446
- if (!knownLocaleCode) {
3447
- return language;
3448
- }
3449
- return getLanguageNameFromLocale(normalized);
3450
- }
3451
- __name(normalizeOutputLanguage, "normalizeOutputLanguage");
3452
- function resolveOutputLanguage(value) {
3453
- if (isAutoLanguage(value)) {
3454
- throw new Error(
3455
- "resolveOutputLanguage does not accept auto; use resolveOutputLanguageOrPreserveAuto instead."
3456
- );
3457
- }
3458
- return normalizeOutputLanguage(value);
3459
- }
3460
- __name(resolveOutputLanguage, "resolveOutputLanguage");
3461
- function resolveOutputLanguageOrPreserveAuto(value) {
3462
- return isAutoLanguage(value) ? OUTPUT_LANGUAGE_AUTO : resolveOutputLanguage(value);
3463
- }
3464
- __name(resolveOutputLanguageOrPreserveAuto, "resolveOutputLanguageOrPreserveAuto");
3465
- function getOutputLanguageFilePath() {
3466
- return path.join(
3467
- Storage.getGlobalQwenDir(),
3468
- LLM_OUTPUT_LANGUAGE_RULE_FILENAME
3469
- );
3470
- }
3471
- __name(getOutputLanguageFilePath, "getOutputLanguageFilePath");
3472
- function sanitizeForMarker(language) {
3473
- return language.replace(/[\r\n]/g, " ").replace(/--!?>/g, "").replace(/--/g, "");
3474
- }
3475
- __name(sanitizeForMarker, "sanitizeForMarker");
3476
- function generateOutputLanguageFileContent(language) {
3477
- const safeLanguage = sanitizeForMarker(language);
3478
- if (isAutoLanguage(language)) {
3479
- return `# Output language preference: ${OUTPUT_LANGUAGE_AUTO}
3480
- <!-- ${LLM_OUTPUT_LANGUAGE_MARKER_PREFIX} ${OUTPUT_LANGUAGE_AUTO} -->
3481
-
3482
- ## Rule
3483
- Respond in the same language as the user's input.
3484
-
3485
- ## Exception
3486
- 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.
3487
-
3488
- ## Mixed-language input
3489
- If the user mixes languages, use the language that best matches the user's main request.
3490
-
3491
- ## Keep technical artifacts unchanged
3492
- Do **not** translate or rewrite:
3493
- - Code blocks, CLI commands, file paths, stack traces, logs, JSON keys, identifiers
3494
- - Exact quoted text from the user (keep quotes verbatim)
3495
-
3496
- ## Tool / system outputs
3497
- 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.
3498
- `;
3499
- }
3500
- return `# Output language preference: ${language}
3501
- <!-- ${LLM_OUTPUT_LANGUAGE_MARKER_PREFIX} ${safeLanguage} -->
3502
-
3503
- ## Rule
3504
- You MUST always respond in **${language}** regardless of the user's input language.
3505
- This is a mandatory requirement, not a preference.
3506
-
3507
- ## Exception
3508
- 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.
3509
-
3510
- ## Keep technical artifacts unchanged
3511
- Do **not** translate or rewrite:
3512
- - Code blocks, CLI commands, file paths, stack traces, logs, JSON keys, identifiers
3513
- - Exact quoted text from the user (keep quotes verbatim)
3514
-
3515
- ## Tool / system outputs
3516
- Raw tool/system outputs may contain fixed-format English. Preserve them verbatim, and if needed, add a short **${language}** explanation below.
3517
- `;
3518
- }
3519
- __name(generateOutputLanguageFileContent, "generateOutputLanguageFileContent");
3520
- function parseOutputLanguageFromContent(content) {
3521
- const markerRegex = new RegExp(
3522
- String.raw`<!--\s*${LLM_OUTPUT_LANGUAGE_MARKER_PREFIX}\s*(.*?)\s*-->`,
3523
- "i"
3524
- );
3525
- const markerMatch = content.match(markerRegex);
3526
- if (markerMatch?.[1]?.trim()) {
3527
- return markerMatch[1].trim();
3528
- }
3529
- const headingMatch = content.match(
3530
- /^#.*?CRITICAL:\s*(.*?)\s+Output Language Rule\b/im
3531
- );
3532
- if (headingMatch?.[1]?.trim()) {
3533
- return headingMatch[1].trim();
3534
- }
3535
- return null;
3536
- }
3537
- __name(parseOutputLanguageFromContent, "parseOutputLanguageFromContent");
3538
- function readOutputLanguageFileContent() {
3539
- const filePath = getOutputLanguageFilePath();
3540
- if (!fs.existsSync(filePath)) {
3541
- return null;
3542
- }
3543
- try {
3544
- return fs.readFileSync(filePath, "utf-8");
3545
- } catch {
3546
- return null;
3547
- }
3548
- }
3549
- __name(readOutputLanguageFileContent, "readOutputLanguageFileContent");
3550
- function isGeneratedFixedOutputLanguageFileContent(content, language) {
3551
- const normalizedContent = content.replace(/\r\n/g, "\n");
3552
- const headings = normalizedContent.match(/^#{1,2}\s+.+$/gm) ?? [];
3553
- return normalizedContent.includes(
3554
- `<!-- ${LLM_OUTPUT_LANGUAGE_MARKER_PREFIX} ${sanitizeForMarker(language)} -->`
3555
- ) && 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");
3556
- }
3557
- __name(isGeneratedFixedOutputLanguageFileContent, "isGeneratedFixedOutputLanguageFileContent");
3558
- function writeOutputLanguageFile(language, targetPath) {
3559
- const filePath = targetPath ?? getOutputLanguageFilePath();
3560
- const content = generateOutputLanguageFileContent(language);
3561
- const dir = path.dirname(filePath);
3562
- fs.mkdirSync(dir, { recursive: true });
3563
- fs.writeFileSync(filePath, content, "utf-8");
3564
- }
3565
- __name(writeOutputLanguageFile, "writeOutputLanguageFile");
3566
- function updateOutputLanguageFile(settingValue, targetPath) {
3567
- const resolved = resolveOutputLanguageOrPreserveAuto(settingValue);
3568
- writeOutputLanguageFile(resolved, targetPath);
3569
- }
3570
- __name(updateOutputLanguageFile, "updateOutputLanguageFile");
3571
- function writeOutputLanguageAndRegisterPath(settingValue, config) {
3572
- const targetPath = config?.getOutputLanguageFilePath();
3573
- updateOutputLanguageFile(settingValue, targetPath);
3574
- if (!targetPath) {
3575
- config?.setOutputLanguageFilePath(getOutputLanguageFilePath());
3576
- }
3577
- }
3578
- __name(writeOutputLanguageAndRegisterPath, "writeOutputLanguageAndRegisterPath");
3579
- function initializeLlmOutputLanguage(outputLanguage) {
3580
- const currentFileContent = readOutputLanguageFileContent();
3581
- const currentFileLanguage = currentFileContent === null ? null : parseOutputLanguageFromContent(currentFileContent);
3582
- const shouldMigrateFixedFileToAuto = isAutoLanguage(outputLanguage) && currentFileLanguage !== null && !isAutoLanguage(currentFileLanguage) && currentFileContent !== null && isGeneratedFixedOutputLanguageFileContent(
3583
- currentFileContent,
3584
- currentFileLanguage
3585
- );
3586
- if (currentFileLanguage) {
3587
- if (shouldMigrateFixedFileToAuto) {
3588
- try {
3589
- const resolved2 = resolveOutputLanguageOrPreserveAuto(outputLanguage);
3590
- writeOutputLanguageFile(resolved2);
3591
- } catch {
3592
- }
3593
- }
3594
- return;
3595
- }
3596
- const resolved = resolveOutputLanguageOrPreserveAuto(outputLanguage);
3597
- writeOutputLanguageFile(resolved);
3598
- }
3599
- __name(initializeLlmOutputLanguage, "initializeLlmOutputLanguage");
3600
-
3601
- // packages/cli/src/utils/settingsUtils.ts
3602
- function flattenSchema(schema, prefix = "") {
3603
- let result = {};
3604
- for (const key in schema) {
3605
- const newKey = prefix ? `${prefix}.${key}` : key;
3606
- const definition = schema[key];
3607
- result[newKey] = { ...definition, key: newKey };
3608
- if (definition.properties) {
3609
- result = { ...result, ...flattenSchema(definition.properties, newKey) };
3610
- }
3611
- }
3612
- return result;
3613
- }
3614
- __name(flattenSchema, "flattenSchema");
3615
- var _FLATTENED_SCHEMA;
3616
- function getFlattenedSchema() {
3617
- return _FLATTENED_SCHEMA ?? (_FLATTENED_SCHEMA = flattenSchema(getSettingsSchema()));
3618
- }
3619
- __name(getFlattenedSchema, "getFlattenedSchema");
3620
- function getSettingDefinition(key) {
3621
- return getFlattenedSchema()[key];
3622
- }
3623
- __name(getSettingDefinition, "getSettingDefinition");
3624
- function requiresRestart(key) {
3625
- return getFlattenedSchema()[key]?.requiresRestart ?? false;
3626
- }
3627
- __name(requiresRestart, "requiresRestart");
3628
- function getDefaultValue(key) {
3629
- return getFlattenedSchema()[key]?.default;
3630
- }
3631
- __name(getDefaultValue, "getDefaultValue");
3632
- function getNestedValue(obj, path3) {
3633
- const [first, ...rest] = path3;
3634
- if (!first || !(first in obj)) {
3635
- return void 0;
3636
- }
3637
- const value = obj[first];
3638
- if (rest.length === 0) {
3639
- return value;
3640
- }
3641
- if (value && typeof value === "object" && value !== null) {
3642
- return getNestedValue(value, rest);
3643
- }
3644
- return void 0;
3645
- }
3646
- __name(getNestedValue, "getNestedValue");
3647
- function getNestedProperty(obj, path3) {
3648
- return getNestedValue(obj, path3.split("."));
3649
- }
3650
- __name(getNestedProperty, "getNestedProperty");
3651
- function getEffectiveValue(key, settings, mergedSettings) {
3652
- const definition = getSettingDefinition(key);
3653
- if (!definition) {
3654
- return void 0;
3655
- }
3656
- const path3 = key.split(".");
3657
- let value = getNestedValue(settings, path3);
3658
- if (value !== void 0) {
3659
- return value;
3660
- }
3661
- value = getNestedValue(mergedSettings, path3);
3662
- if (value !== void 0) {
3663
- return value;
3664
- }
3665
- return definition.default;
3666
- }
3667
- __name(getEffectiveValue, "getEffectiveValue");
3668
- function getAllSettingKeys() {
3669
- return Object.keys(getFlattenedSchema());
3670
- }
3671
- __name(getAllSettingKeys, "getAllSettingKeys");
3672
- var SETTINGS_DIALOG_ORDER = [
3673
- // Workflow Control - most impactful setting
3674
- "tools.approvalMode",
3675
- // Localization - users often set this first
3676
- "general.language",
3677
- "general.outputLanguage",
3678
- // Theme
3679
- "ui.theme",
3680
- // Editor/Shell Experience
3681
- "general.vimMode",
3682
- "tools.shell.enableInteractiveShell",
3683
- // Display Preferences
3684
- "general.preferredEditor",
3685
- "ide.enabled",
3686
- "ui.showLineNumbers",
3687
- "ui.hideTips",
3688
- "general.terminalBell",
3689
- "ui.enableWelcomeBack",
3690
- // Git Behavior
3691
- "general.gitCoAuthor.commit",
3692
- "general.gitCoAuthor.pr",
3693
- // File Filtering
3694
- "context.fileFiltering.respectGitIgnore",
3695
- "context.fileFiltering.respectQwenIgnore",
3696
- // System Settings - rarely changed
3697
- "general.disableAutoUpdate",
3698
- // Privacy
3699
- "privacy.usageStatisticsEnabled"
3700
- ];
3701
- var MAX_SETTING_STRING_VALUE_LENGTH = 1024;
3702
- function validateSettingValue(def, value) {
3703
- switch (def.type) {
3704
- case "boolean":
3705
- if (typeof value !== "boolean") return "Value must be a boolean";
3706
- break;
3707
- case "number":
3708
- if (typeof value !== "number" || !Number.isFinite(value))
3709
- return "Value must be a finite number";
3710
- if (def.minimum !== void 0 && value < def.minimum)
3711
- return `Value must be >= ${def.minimum}`;
3712
- if (def.maximum !== void 0 && value > def.maximum)
3713
- return `Value must be <= ${def.maximum}`;
3714
- break;
3715
- case "integer":
3716
- if (typeof value !== "number" || !Number.isFinite(value))
3717
- return "Value must be a finite integer";
3718
- if (!Number.isInteger(value)) return "Value must be an integer";
3719
- if (def.minimum !== void 0 && value < def.minimum)
3720
- return `Value must be >= ${def.minimum}`;
3721
- if (def.maximum !== void 0 && value > def.maximum)
3722
- return `Value must be <= ${def.maximum}`;
3723
- break;
3724
- case "string":
3725
- if (typeof value !== "string") return "Value must be a string";
3726
- if (value.length > MAX_SETTING_STRING_VALUE_LENGTH)
3727
- return `Value exceeds ${MAX_SETTING_STRING_VALUE_LENGTH}-character limit`;
3728
- break;
3729
- case "enum":
3730
- if (!def.options?.some((opt) => opt.value === value)) {
3731
- const allowed = def.options?.map((o) => o.value).join(", ") ?? "";
3732
- return `Value must be one of: ${allowed}`;
3733
- }
3734
- break;
3735
- case "object":
3736
- if (!value || typeof value !== "object" || Array.isArray(value)) {
3737
- return "Value must be an object";
3738
- }
3739
- break;
3740
- default:
3741
- return `Settings of type '${def.type}' cannot be modified via this API`;
3742
- }
3743
- return void 0;
3744
- }
3745
- __name(validateSettingValue, "validateSettingValue");
3746
- function getDialogSettingKeys() {
3747
- const dialogSettings = Object.values(getFlattenedSchema()).filter((definition) => definition.showInDialog === true).map((definition) => definition.key);
3748
- return dialogSettings.sort((a, b) => {
3749
- const indexA = SETTINGS_DIALOG_ORDER.indexOf(a);
3750
- const indexB = SETTINGS_DIALOG_ORDER.indexOf(b);
3751
- if (indexA !== -1 && indexB !== -1) {
3752
- return indexA - indexB;
3753
- }
3754
- if (indexA !== -1) return -1;
3755
- if (indexB !== -1) return 1;
3756
- return 0;
3757
- });
3758
- }
3759
- __name(getDialogSettingKeys, "getDialogSettingKeys");
3760
- function settingExistsInScope(key, scopeSettings) {
3761
- const path3 = key.split(".");
3762
- const value = getNestedValue(scopeSettings, path3);
3763
- return value !== void 0;
3764
- }
3765
- __name(settingExistsInScope, "settingExistsInScope");
3766
- function pathHasUnsafeSegment(keys) {
3767
- for (const key of keys) {
3768
- if (key === "__proto__" || key === "constructor" || key === "prototype") {
3769
- return true;
3770
- }
3771
- }
3772
- return false;
3773
- }
3774
- __name(pathHasUnsafeSegment, "pathHasUnsafeSegment");
3775
- function setNestedPropertyForce(obj, path3, value) {
3776
- const keys = path3.split(".");
3777
- if (pathHasUnsafeSegment(keys)) return;
3778
- const lastKey = keys.pop();
3779
- if (!lastKey) return;
3780
- let current = obj;
3781
- for (const key of keys) {
3782
- if (!current[key] || typeof current[key] !== "object") {
3783
- current[key] = {};
3784
- }
3785
- current = current[key];
3786
- }
3787
- current[lastKey] = value;
3788
- }
3789
- __name(setNestedPropertyForce, "setNestedPropertyForce");
3790
- function setNestedPropertySafe(obj, path3, value) {
3791
- const keys = path3.split(".");
3792
- if (pathHasUnsafeSegment(keys)) return;
3793
- const lastKey = keys.pop();
3794
- if (!lastKey) return;
3795
- let current = obj;
3796
- for (const key of keys) {
3797
- if (current[key] === void 0) {
3798
- current[key] = {};
3799
- }
3800
- const next = current[key];
3801
- if (typeof next === "object" && next !== null) {
3802
- current = next;
3803
- } else {
3804
- return;
3805
- }
3806
- }
3807
- current[lastKey] = value;
3808
- }
3809
- __name(setNestedPropertySafe, "setNestedPropertySafe");
3810
- function deleteNestedPropertySafe(obj, path3) {
3811
- const keys = path3.split(".");
3812
- const lastKey = keys.pop();
3813
- if (!lastKey) return;
3814
- let current = obj;
3815
- for (const key of keys) {
3816
- const next = current[key];
3817
- if (typeof next !== "object" || next === null) {
3818
- return;
3819
- }
3820
- current = next;
3821
- }
3822
- delete current[lastKey];
3823
- }
3824
- __name(deleteNestedPropertySafe, "deleteNestedPropertySafe");
3825
- function setPendingSettingValue(key, value, pendingSettings) {
3826
- const newSettings = JSON.parse(JSON.stringify(pendingSettings));
3827
- setNestedPropertyForce(newSettings, key, value);
3828
- return newSettings;
3829
- }
3830
- __name(setPendingSettingValue, "setPendingSettingValue");
3831
- function setPendingSettingValueAny(key, value, pendingSettings) {
3832
- const newSettings = structuredClone(pendingSettings);
3833
- setNestedPropertyForce(newSettings, key, value);
3834
- return newSettings;
3835
- }
3836
- __name(setPendingSettingValueAny, "setPendingSettingValueAny");
3837
- function getRestartRequiredFromModified(modifiedSettings) {
3838
- return Array.from(modifiedSettings).filter((key) => requiresRestart(key));
3839
- }
3840
- __name(getRestartRequiredFromModified, "getRestartRequiredFromModified");
3841
- function saveModifiedSettings(modifiedSettings, pendingSettings, loadedSettings, scope) {
3842
- modifiedSettings.forEach((settingKey) => {
3843
- const path3 = settingKey.split(".");
3844
- const value = getNestedValue(
3845
- pendingSettings,
3846
- path3
3847
- );
3848
- const existsInOriginalFile = settingExistsInScope(
3849
- settingKey,
3850
- loadedSettings.forScope(scope).settings
3851
- );
3852
- if (value === void 0) {
3853
- if (existsInOriginalFile) {
3854
- loadedSettings.setValue(scope, settingKey, void 0);
3855
- }
3856
- return;
3857
- }
3858
- const isDefaultValue2 = value === getDefaultValue(settingKey);
3859
- if (existsInOriginalFile || !isDefaultValue2) {
3860
- loadedSettings.setValue(scope, settingKey, value);
3861
- }
3862
- });
3863
- }
3864
- __name(saveModifiedSettings, "saveModifiedSettings");
3865
- function getDisplayValue(key, settings, _mergedSettings, modifiedSettings, pendingSettings) {
3866
- const definition = getSettingDefinition(key);
3867
- let value;
3868
- if (pendingSettings && settingExistsInScope(key, pendingSettings)) {
3869
- value = getEffectiveValue(key, pendingSettings, {});
3870
- } else if (settingExistsInScope(key, settings)) {
3871
- value = getEffectiveValue(key, settings, {});
3872
- } else {
3873
- value = getDefaultValue(key);
3874
- }
3875
- let valueString = String(value);
3876
- if (key === "general.outputLanguage" && isAutoLanguage(value)) {
3877
- valueString = t("Auto (follow user input)");
3878
- } else if (definition?.type === "enum" && definition.options) {
3879
- const option = definition.options?.find((option2) => option2.value === value);
3880
- if (option?.label) {
3881
- valueString = t(option.label) || option.label;
3882
- } else {
3883
- valueString = `${value}`;
3884
- }
3885
- }
3886
- const defaultValue = getDefaultValue(key);
3887
- const isChangedFromDefault = value !== defaultValue;
3888
- const isInModifiedSettings = modifiedSettings.has(key);
3889
- if (settingExistsInScope(key, settings) || isInModifiedSettings) {
3890
- return `${valueString}*`;
3891
- }
3892
- if (isChangedFromDefault || isInModifiedSettings) {
3893
- return `${valueString}*`;
3894
- }
3895
- return valueString;
3896
- }
3897
- __name(getDisplayValue, "getDisplayValue");
3898
- function isDefaultValue(key, settings) {
3899
- return !settingExistsInScope(key, settings);
3900
- }
3901
- __name(isDefaultValue, "isDefaultValue");
3902
- function backupSettingsFile(filePath) {
3903
- try {
3904
- if (fs2.existsSync(filePath)) {
3905
- const backupPath = `${filePath}.orig`;
3906
- fs2.copyFileSync(filePath, backupPath);
3907
- return true;
3908
- }
3909
- } catch (_e) {
3910
- }
3911
- return false;
3912
- }
3913
- __name(backupSettingsFile, "backupSettingsFile");
3914
- function restoreSettingsFromBackup(filePath) {
3915
- try {
3916
- const backupPath = `${filePath}.orig`;
3917
- if (fs2.existsSync(backupPath)) {
3918
- fs2.copyFileSync(backupPath, filePath);
3919
- fs2.unlinkSync(backupPath);
3920
- return true;
3921
- }
3922
- } catch (err) {
3923
- console.error(
3924
- `[settingsUtils] restoreSettingsFromBackup(${filePath}) failed:`,
3925
- err
3926
- );
3927
- }
3928
- return false;
3929
- }
3930
- __name(restoreSettingsFromBackup, "restoreSettingsFromBackup");
3931
- function cleanupSettingsBackup(filePath) {
3932
- try {
3933
- const backupPath = `${filePath}.orig`;
3934
- if (fs2.existsSync(backupPath)) {
3935
- fs2.unlinkSync(backupPath);
3936
- }
3937
- } catch (_e) {
3938
- }
3939
- }
3940
- __name(cleanupSettingsBackup, "cleanupSettingsBackup");
3941
-
3942
- // packages/cli/src/utils/deepMerge.ts
3943
- init_esbuild_shims();
3944
- function isPlainObject(item) {
3945
- return !!item && typeof item === "object" && !Array.isArray(item);
3946
- }
3947
- __name(isPlainObject, "isPlainObject");
3948
- function mergeRecursively(target, source, getMergeStrategyForPath2, path3 = []) {
3949
- for (const key of Object.keys(source)) {
3950
- if (key === "__proto__" || key === "constructor" || key === "prototype") {
3951
- continue;
3952
- }
3953
- const newPath = [...path3, key];
3954
- const srcValue = source[key];
3955
- const objValue = target[key];
3956
- const mergeStrategy = getMergeStrategyForPath2(newPath);
3957
- if (mergeStrategy === "shallow_merge" /* SHALLOW_MERGE */ && objValue && srcValue) {
3958
- const obj1 = typeof objValue === "object" && objValue !== null ? objValue : {};
3959
- const obj2 = typeof srcValue === "object" && srcValue !== null ? srcValue : {};
3960
- target[key] = { ...obj1, ...obj2 };
3961
- continue;
3962
- }
3963
- if (Array.isArray(objValue)) {
3964
- const srcArray = Array.isArray(srcValue) ? srcValue : [srcValue];
3965
- if (mergeStrategy === "concat" /* CONCAT */) {
3966
- target[key] = objValue.concat(srcArray);
3967
- continue;
3968
- }
3969
- if (mergeStrategy === "union" /* UNION */) {
3970
- target[key] = [...new Set(objValue.concat(srcArray))];
3971
- continue;
3972
- }
3973
- }
3974
- if (isPlainObject(objValue) && isPlainObject(srcValue)) {
3975
- mergeRecursively(objValue, srcValue, getMergeStrategyForPath2, newPath);
3976
- } else if (isPlainObject(srcValue)) {
3977
- target[key] = {};
3978
- mergeRecursively(
3979
- target[key],
3980
- srcValue,
3981
- getMergeStrategyForPath2,
3982
- newPath
3983
- );
3984
- } else {
3985
- target[key] = srcValue;
3986
- }
3987
- }
3988
- return target;
3989
- }
3990
- __name(mergeRecursively, "mergeRecursively");
3991
- function customDeepMerge(getMergeStrategyForPath2, ...sources) {
3992
- const result = {};
3993
- for (const source of sources) {
3994
- if (source) {
3995
- mergeRecursively(result, source, getMergeStrategyForPath2);
3996
- }
3997
- }
3998
- return result;
3999
- }
4000
- __name(customDeepMerge, "customDeepMerge");
4001
-
4002
- // packages/cli/src/config/migration/index.ts
4003
- init_esbuild_shims();
4004
-
4005
- // packages/cli/src/config/migration/scheduler.ts
4006
- init_esbuild_shims();
4007
- var debugLogger = createDebugLogger("SETTINGS_MIGRATION");
4008
- function formatScope(scope) {
4009
- if (scope === "SystemDefaults") {
4010
- return "system default";
4011
- }
4012
- return scope.toLowerCase();
4013
- }
4014
- __name(formatScope, "formatScope");
4015
- var MigrationScheduler = class {
4016
- /**
4017
- * Creates a new MigrationScheduler with the given migrations.
4018
- *
4019
- * @param migrations - Array of migrations in execution order (typically ascending version)
4020
- * @param scope - The scope of settings being migrated
4021
- */
4022
- constructor(migrations, scope) {
4023
- this.migrations = migrations;
4024
- this.scope = scope;
4025
- }
4026
- static {
4027
- __name(this, "MigrationScheduler");
4028
- }
4029
- /**
4030
- * Executes the migration chain on the given settings.
4031
- *
4032
- * Iterates through all registered migrations in order. For each migration:
4033
- * 1. Calls `shouldMigrate` with the current settings
4034
- * 2. If true, calls `migrate` to transform the settings
4035
- * 3. Records the execution
4036
- *
4037
- * The scheduler itself has no version awareness - all version detection
4038
- * is delegated to the individual migrations.
4039
- *
4040
- * @param settings - The settings object to migrate
4041
- * @returns MigrationResult containing the final settings, version, and execution log
4042
- */
4043
- migrate(settings) {
4044
- debugLogger.debug("MigrationScheduler: Starting migration chain");
4045
- let current = settings;
4046
- const executed = [];
4047
- const allWarnings = [];
4048
- for (const migration of this.migrations) {
4049
- try {
4050
- if (migration.shouldMigrate(current)) {
4051
- debugLogger.debug(
4052
- `MigrationScheduler: Executing migration ${migration.fromVersion} \u2192 ${migration.toVersion}`
4053
- );
4054
- const formattedScope = formatScope(this.scope);
4055
- const result = migration.migrate(current, formattedScope);
4056
- current = result.settings;
4057
- allWarnings.push(...result.warnings);
4058
- executed.push({
4059
- fromVersion: migration.fromVersion,
4060
- toVersion: migration.toVersion
4061
- });
4062
- debugLogger.debug(
4063
- `MigrationScheduler: Migration ${migration.fromVersion} \u2192 ${migration.toVersion} completed successfully`
4064
- );
4065
- }
4066
- } catch (error) {
4067
- debugLogger.error(
4068
- `MigrationScheduler: Migration ${migration.fromVersion} \u2192 ${migration.toVersion} failed:`,
4069
- error
4070
- );
4071
- throw error;
4072
- }
4073
- }
4074
- const finalVersion = current["$version"] ?? 1;
4075
- debugLogger.debug(
4076
- `MigrationScheduler: Migration chain complete. Final version: ${finalVersion}, Executed: ${executed.length} migrations`
4077
- );
4078
- return {
4079
- settings: current,
4080
- finalVersion,
4081
- executedMigrations: executed,
4082
- warnings: allWarnings
4083
- };
4084
- }
4085
- };
4086
-
4087
- // packages/cli/src/config/migration/versions/v1-to-v2.ts
4088
- init_esbuild_shims();
4089
- var V1ToV2Migration = class {
4090
- static {
4091
- __name(this, "V1ToV2Migration");
4092
- }
4093
- fromVersion = 1;
4094
- toVersion = 2;
4095
- /**
4096
- * Determines whether this migration should execute.
4097
- *
4098
- * Decision strategy:
4099
- * - Hard-stop when `$version` is a number >= 2 (already V2+).
4100
- * - Otherwise, scan indicator keys and trigger only when at least one indicator is
4101
- * still in legacy top-level shape (primitive/array/null).
4102
- *
4103
- * Mixed-shape tolerance:
4104
- * - Files that are partially migrated are supported; V2-like object-valued indicators
4105
- * are ignored while legacy-shaped indicators can still trigger migration.
4106
- */
4107
- shouldMigrate(settings) {
4108
- if (typeof settings !== "object" || settings === null) {
4109
- return false;
4110
- }
4111
- const s = settings;
4112
- const version = s["$version"];
4113
- if (typeof version === "number" && version >= 2) {
4114
- return false;
4115
- }
4116
- return V1_INDICATOR_KEYS.some((key) => {
4117
- if (!(key in s)) {
4118
- return false;
4119
- }
4120
- const value = s[key];
4121
- if (typeof value === "object" && value !== null && !Array.isArray(value)) {
4122
- return false;
4123
- }
4124
- return true;
4125
- });
4126
- }
4127
- /**
4128
- * Performs non-destructive V1 -> V2 transformation.
4129
- *
4130
- * Detailed strategy:
4131
- * 1) Relocate known V1 keys using `V1_TO_V2_MIGRATION_MAP`.
4132
- * - If a source value is already an object and maps to a child path of itself
4133
- * (partial V2 shape), merge child properties into target path.
4134
- * 2) Relocate disable* keys into V2 disable* locations.
4135
- * - Consolidated keys (`disableAutoUpdate`, `disableUpdateNag`): normalize to
4136
- * boolean with stable-compatible presence semantics (`value === true`).
4137
- * - Other disable* keys: migrate only boolean values.
4138
- * 3) Preserve `mcpServers` top-level placement.
4139
- * 4) Carry over remaining keys:
4140
- * - If a key is parent of migrated nested paths, merge unprocessed object children.
4141
- * - If parent value is non-object, preserve that scalar/array/null as-is.
4142
- * - Otherwise copy untouched key/value.
4143
- * 5) Stamp `$version = 2`.
4144
- *
4145
- * The method is pure with respect to input mutation.
4146
- */
4147
- migrate(settings, _scope) {
4148
- if (typeof settings !== "object" || settings === null) {
4149
- throw new Error("Settings must be an object");
4150
- }
4151
- const source = settings;
4152
- const result = {};
4153
- const processedKeys = /* @__PURE__ */ new Set();
4154
- const warnings = [];
4155
- for (const [v1Key, v2Path] of Object.entries(V1_TO_V2_MIGRATION_MAP)) {
4156
- if (v1Key in source) {
4157
- const value = source[v1Key];
4158
- if (V2_CONTAINER_KEYS.has(v1Key) && typeof value === "object" && value !== null && !Array.isArray(value)) {
4159
- result[v1Key] = value;
4160
- processedKeys.add(v1Key);
4161
- continue;
4162
- }
4163
- if (typeof value === "object" && value !== null && !Array.isArray(value) && v2Path.startsWith(v1Key + ".")) {
4164
- for (const [nestedKey, nestedValue] of Object.entries(value)) {
4165
- setNestedPropertySafe(
4166
- result,
4167
- `${v2Path}.${nestedKey}`,
4168
- nestedValue
4169
- );
4170
- }
4171
- } else {
4172
- setNestedPropertySafe(result, v2Path, value);
4173
- }
4174
- processedKeys.add(v1Key);
4175
- }
4176
- }
4177
- for (const [v1Key, v2Path] of Object.entries(
4178
- V1_TO_V2_PRESERVE_DISABLE_MAP
4179
- )) {
4180
- if (v1Key in source) {
4181
- const value = source[v1Key];
4182
- if (CONSOLIDATED_DISABLE_KEYS.has(v1Key)) {
4183
- setNestedPropertySafe(result, v2Path, value === true);
4184
- } else if (typeof value === "boolean") {
4185
- setNestedPropertySafe(result, v2Path, value);
4186
- }
4187
- processedKeys.add(v1Key);
4188
- }
4189
- }
4190
- if ("mcpServers" in source) {
4191
- result["mcpServers"] = source["mcpServers"];
4192
- processedKeys.add("mcpServers");
4193
- }
4194
- for (const key of Object.keys(source)) {
4195
- if (!processedKeys.has(key)) {
4196
- const isParentOfMigratedPath = Array.from(processedKeys).some(
4197
- (processedKey) => {
4198
- const v2Path = V1_TO_V2_MIGRATION_MAP[processedKey] || V1_TO_V2_PRESERVE_DISABLE_MAP[processedKey];
4199
- if (!v2Path) return false;
4200
- return v2Path.startsWith(key + ".");
4201
- }
4202
- );
4203
- if (isParentOfMigratedPath) {
4204
- const existingValue = source[key];
4205
- if (typeof existingValue === "object" && existingValue !== null && !Array.isArray(existingValue)) {
4206
- for (const [nestedKey, nestedValue] of Object.entries(
4207
- existingValue
4208
- )) {
4209
- const fullNestedPath = `${key}.${nestedKey}`;
4210
- const wasProcessed = Array.from(processedKeys).some(
4211
- (processedKey) => {
4212
- const v2Path = V1_TO_V2_MIGRATION_MAP[processedKey] || V1_TO_V2_PRESERVE_DISABLE_MAP[processedKey];
4213
- return v2Path === fullNestedPath;
4214
- }
4215
- );
4216
- if (!wasProcessed) {
4217
- setNestedPropertySafe(result, fullNestedPath, nestedValue);
4218
- }
4219
- }
4220
- } else {
4221
- result[key] = source[key];
4222
- }
4223
- } else {
4224
- result[key] = source[key];
4225
- }
4226
- }
4227
- }
4228
- result["$version"] = 2;
4229
- return { settings: result, warnings };
4230
- }
4231
- };
4232
- var v1ToV2Migration = new V1ToV2Migration();
4233
-
4234
- // packages/cli/src/config/migration/versions/v2-to-v3.ts
4235
- init_esbuild_shims();
4236
- var V2_TO_V3_BOOLEAN_MAP = {
4237
- "general.disableAutoUpdate": "general.enableAutoUpdate",
4238
- "general.disableUpdateNag": "general.enableAutoUpdate",
4239
- "ui.accessibility.disableLoadingPhrases": "ui.accessibility.enableLoadingPhrases",
4240
- "context.fileFiltering.disableFuzzySearch": "context.fileFiltering.enableFuzzySearch",
4241
- "model.generationConfig.disableCacheControl": "model.generationConfig.enableCacheControl"
4242
- };
4243
- var CONSOLIDATED_V2_PATHS = {
4244
- "general.enableAutoUpdate": [
4245
- "general.disableAutoUpdate",
4246
- "general.disableUpdateNag"
4247
- ]
4248
- };
4249
- function normalizeDisableValue(value) {
4250
- if (value === void 0) {
4251
- return { isPresent: false, isValid: false };
4252
- }
4253
- if (typeof value === "boolean") {
4254
- return { isPresent: true, isValid: true, booleanValue: value };
4255
- }
4256
- if (typeof value === "string") {
4257
- const normalized = value.trim().toLowerCase();
4258
- if (normalized === "true") {
4259
- return { isPresent: true, isValid: true, booleanValue: true };
4260
- }
4261
- if (normalized === "false") {
4262
- return { isPresent: true, isValid: true, booleanValue: false };
4263
- }
4264
- }
4265
- return { isPresent: true, isValid: false };
4266
- }
4267
- __name(normalizeDisableValue, "normalizeDisableValue");
4268
- var V2ToV3Migration = class {
4269
- static {
4270
- __name(this, "V2ToV3Migration");
4271
- }
4272
- fromVersion = 2;
4273
- toVersion = 3;
4274
- /**
4275
- * Migration trigger rule.
4276
- *
4277
- * Execute only when `$version === 2`.
4278
- * This includes V2 files with no migratable disable* booleans so that version
4279
- * metadata still advances to 3.
4280
- */
4281
- shouldMigrate(settings) {
4282
- if (typeof settings !== "object" || settings === null) {
4283
- return false;
4284
- }
4285
- const s = settings;
4286
- return s["$version"] === 2;
4287
- }
4288
- /**
4289
- * Applies V2 -> V3 transformation with deterministic deprecated-key cleanup.
4290
- *
4291
- * Detailed strategy:
4292
- * 1) Clone input.
4293
- * 2) Process consolidated paths first:
4294
- * - Inspect each source path.
4295
- * - Normalize each present value (boolean / coercible string / invalid).
4296
- * - Always delete present deprecated source key.
4297
- * - Valid normalized values contribute to aggregate.
4298
- * - Invalid values emit warnings.
4299
- * - Emit consolidated target when at least one valid source was consumed.
4300
- * 3) Process remaining one-to-one mappings:
4301
- * - For each unmapped source, normalize value.
4302
- * - If valid -> delete old key and write inverted target.
4303
- * - If invalid -> delete old key and emit warning.
4304
- * 4) Set `$version = 3`.
4305
- *
4306
- * Guarantees:
4307
- * - Input object is not mutated.
4308
- * - Valid migration and invalid cleanup are deterministic.
4309
- * - Deprecated disable* keys are not retained after migration.
4310
- */
4311
- migrate(settings, scope) {
4312
- if (typeof settings !== "object" || settings === null) {
4313
- throw new Error("Settings must be an object");
4314
- }
4315
- const result = structuredClone(settings);
4316
- const processedPaths = /* @__PURE__ */ new Set();
4317
- const warnings = [];
4318
- for (const [newPath, oldPaths] of Object.entries(CONSOLIDATED_V2_PATHS)) {
4319
- let hasAnyDisable = false;
4320
- let hasAnyBooleanValue = false;
4321
- for (const oldPath of oldPaths) {
4322
- const oldValue = getNestedProperty(result, oldPath);
4323
- const normalized = normalizeDisableValue(oldValue);
4324
- if (!normalized.isPresent) {
4325
- continue;
4326
- }
4327
- deleteNestedPropertySafe(result, oldPath);
4328
- processedPaths.add(oldPath);
4329
- if (normalized.isValid) {
4330
- hasAnyBooleanValue = true;
4331
- if (normalized.booleanValue === true) {
4332
- hasAnyDisable = true;
4333
- }
4334
- } else {
4335
- warnings.push(
4336
- `Removed deprecated setting '${oldPath}' from ${scope} settings because the value is invalid. Expected boolean.`
4337
- );
4338
- }
4339
- }
4340
- if (hasAnyBooleanValue) {
4341
- setNestedPropertySafe(result, newPath, !hasAnyDisable);
4342
- }
4343
- }
4344
- for (const [oldPath, newPath] of Object.entries(V2_TO_V3_BOOLEAN_MAP)) {
4345
- if (processedPaths.has(oldPath)) {
4346
- continue;
4347
- }
4348
- const oldValue = getNestedProperty(result, oldPath);
4349
- const normalized = normalizeDisableValue(oldValue);
4350
- if (!normalized.isPresent) {
4351
- continue;
4352
- }
4353
- deleteNestedPropertySafe(result, oldPath);
4354
- if (normalized.isValid) {
4355
- setNestedPropertySafe(result, newPath, !normalized.booleanValue);
4356
- } else {
4357
- warnings.push(
4358
- `Removed deprecated setting '${oldPath}' from ${scope} settings because the value is invalid. Expected boolean or string "true"/"false".`
4359
- );
4360
- }
4361
- }
4362
- result["$version"] = 3;
4363
- return { settings: result, warnings };
4364
- }
4365
- };
4366
- var v2ToV3Migration = new V2ToV3Migration();
4367
-
4368
- // packages/cli/src/config/migration/versions/v3-to-v4.ts
4369
- init_esbuild_shims();
4370
- var GIT_CO_AUTHOR_PATH = "general.gitCoAuthor";
4371
- var V3ToV4Migration = class {
4372
- static {
4373
- __name(this, "V3ToV4Migration");
4374
- }
4375
- fromVersion = 3;
4376
- toVersion = 4;
4377
- shouldMigrate(settings) {
4378
- if (typeof settings !== "object" || settings === null) {
4379
- return false;
4380
- }
4381
- const s = settings;
4382
- if (s["$version"] === 3) {
4383
- return true;
4384
- }
4385
- if (s["$version"] === void 0) {
4386
- const value = getNestedProperty(s, GIT_CO_AUTHOR_PATH);
4387
- if (value === void 0) return false;
4388
- if (typeof value === "object" && value !== null && !Array.isArray(value)) {
4389
- return false;
4390
- }
4391
- return true;
4392
- }
4393
- return false;
4394
- }
4395
- migrate(settings, scope) {
4396
- if (typeof settings !== "object" || settings === null) {
4397
- throw new Error("Settings must be an object");
4398
- }
4399
- const result = structuredClone(settings);
4400
- const warnings = [];
4401
- const value = getNestedProperty(result, GIT_CO_AUTHOR_PATH);
4402
- if (typeof value === "boolean") {
4403
- setNestedPropertySafe(result, GIT_CO_AUTHOR_PATH, {
4404
- commit: value,
4405
- pr: value
4406
- });
4407
- } else if (typeof value === "string") {
4408
- const lowered = value.trim().toLowerCase();
4409
- const disableIntent = ["false", "no", "off", "0", "disabled", ""];
4410
- const enableIntent = ["true", "yes", "on", "1", "enabled"];
4411
- if (enableIntent.includes(lowered)) {
4412
- setNestedPropertySafe(result, GIT_CO_AUTHOR_PATH, {
4413
- commit: true,
4414
- pr: true
4415
- });
4416
- } else if (disableIntent.includes(lowered)) {
4417
- setNestedPropertySafe(result, GIT_CO_AUTHOR_PATH, {
4418
- commit: false,
4419
- pr: false
4420
- });
4421
- } else {
4422
- setNestedPropertySafe(result, GIT_CO_AUTHOR_PATH, {
4423
- commit: false,
4424
- pr: false
4425
- });
4426
- warnings.push(
4427
- `Reset '${GIT_CO_AUTHOR_PATH}' in ${scope} settings to {commit: false, pr: false} because the stored string '${value}' was not a recognized boolean form.`
4428
- );
4429
- }
4430
- } else if (value !== void 0 && (typeof value !== "object" || value === null || Array.isArray(value))) {
4431
- setNestedPropertySafe(result, GIT_CO_AUTHOR_PATH, {
4432
- commit: false,
4433
- pr: false
4434
- });
4435
- warnings.push(
4436
- `Reset '${GIT_CO_AUTHOR_PATH}' in ${scope} settings to {commit: false, pr: false} because the stored value was not a boolean or object.`
4437
- );
4438
- }
4439
- result["$version"] = 4;
4440
- return { settings: result, warnings };
4441
- }
4442
- };
4443
- var v3ToV4Migration = new V3ToV4Migration();
4444
-
4445
- // packages/cli/src/config/migration/versions/v5-to-v4.ts
4446
- init_esbuild_shims();
4447
- var PROVIDER_KEY_TO_PROTOCOL = {
4448
- openai: "openai",
4449
- "qwen-oauth": "qwen-oauth",
4450
- gemini: "gemini",
4451
- "vertex-ai": "gemini",
4452
- anthropic: "anthropic"
4453
- };
4454
- function isWrappedProviderConfig(value) {
4455
- return typeof value === "object" && value !== null && !Array.isArray(value);
4456
- }
4457
- __name(isWrappedProviderConfig, "isWrappedProviderConfig");
4458
- var V5ToV4Migration = class {
4459
- static {
4460
- __name(this, "V5ToV4Migration");
4461
- }
4462
- fromVersion = 5;
4463
- toVersion = 4;
4464
- shouldMigrate(settings) {
4465
- if (typeof settings !== "object" || settings === null) {
4466
- return false;
4467
- }
4468
- const s = settings;
4469
- if (s["$version"] === 5) {
4470
- return true;
4471
- }
4472
- if (s["$version"] !== void 0) {
4473
- return false;
4474
- }
4475
- const modelProviders = s["modelProviders"];
4476
- if (typeof modelProviders !== "object" || modelProviders === null) {
4477
- return false;
4478
- }
4479
- return Object.values(modelProviders).some(
4480
- (v) => isWrappedProviderConfig(v)
4481
- );
4482
- }
4483
- migrate(settings, _scope) {
4484
- if (typeof settings !== "object" || settings === null) {
4485
- throw new Error("Settings must be an object");
4486
- }
4487
- const result = structuredClone(settings);
4488
- const warnings = [];
4489
- const modelProviders = result["modelProviders"];
4490
- if (typeof modelProviders === "object" && modelProviders !== null) {
4491
- const providers = modelProviders;
4492
- for (const [key, value] of Object.entries(providers)) {
4493
- if (Array.isArray(value)) {
4494
- continue;
4495
- }
4496
- if (!isWrappedProviderConfig(value)) {
4497
- continue;
4498
- }
4499
- const derivedProtocol = Object.hasOwn(PROVIDER_KEY_TO_PROTOCOL, key) ? PROVIDER_KEY_TO_PROTOCOL[key] : void 0;
4500
- if (typeof value.protocol === "string" && derivedProtocol !== void 0 && value.protocol !== derivedProtocol) {
4501
- warnings.push(
4502
- `Provider "${key}" declared protocol "${value.protocol}", but V4 derives protocol "${derivedProtocol}" from the provider key. The explicit protocol has been dropped.`
4503
- );
4504
- }
4505
- providers[key] = Array.isArray(value.models) ? value.models : [];
4506
- }
4507
- }
4508
- result["$version"] = 4;
4509
- return { settings: result, warnings };
4510
- }
4511
- };
4512
- var v5ToV4Migration = new V5ToV4Migration();
4513
-
4514
- // packages/cli/src/config/migration/index.ts
4515
- var ALL_MIGRATIONS = [
4516
- v1ToV2Migration,
4517
- v2ToV3Migration,
4518
- v3ToV4Migration
4519
- ];
4520
- var DOWNGRADE_MIGRATIONS = [v5ToV4Migration];
4521
- var CONVERGENCE_MIGRATIONS = [
4522
- ...ALL_MIGRATIONS,
4523
- ...DOWNGRADE_MIGRATIONS
4524
- ];
4525
- function runMigrations(settings, scope) {
4526
- const scheduler = new MigrationScheduler([...CONVERGENCE_MIGRATIONS], scope);
4527
- return scheduler.migrate(settings);
4528
- }
4529
- __name(runMigrations, "runMigrations");
4530
- function needsMigration(settings) {
4531
- if (typeof settings !== "object" || settings === null) {
4532
- return false;
4533
- }
4534
- const s = settings;
4535
- const version = s["$version"];
4536
- const hasApplicableMigration = CONVERGENCE_MIGRATIONS.some(
4537
- (migration) => migration.shouldMigrate(settings)
4538
- );
4539
- if (typeof version === "number") {
4540
- if (version === SETTINGS_VERSION) {
4541
- return false;
4542
- }
4543
- return hasApplicableMigration;
4544
- }
4545
- return hasApplicableMigration;
4546
- }
4547
- __name(needsMigration, "needsMigration");
4548
-
4549
- // packages/cli/src/config/settings.ts
4550
- var debugLogger2 = createDebugLogger("SETTINGS");
4551
- function getMergeStrategyForPath(path3) {
4552
- let current = void 0;
4553
- let currentSchema = getSettingsSchema();
4554
- for (const key of path3) {
4555
- if (!currentSchema || !currentSchema[key]) {
4556
- return void 0;
4557
- }
4558
- current = currentSchema[key];
4559
- currentSchema = current.properties;
4560
- }
4561
- return current?.mergeStrategy;
4562
- }
4563
- __name(getMergeStrategyForPath, "getMergeStrategyForPath");
4564
- function getUserSettingsPath() {
4565
- return Storage.getGlobalSettingsPath();
4566
- }
4567
- __name(getUserSettingsPath, "getUserSettingsPath");
4568
- function getUserSettingsDir() {
4569
- return path2.dirname(getUserSettingsPath());
4570
- }
4571
- __name(getUserSettingsDir, "getUserSettingsDir");
4572
- var SETTINGS_VERSION = 4;
4573
- var SETTINGS_VERSION_KEY = "$version";
4574
- function migrateLegacyPermissions(settings) {
4575
- const tools = settings["tools"];
4576
- if (!tools) return null;
4577
- const hasLegacy = Array.isArray(tools["core"]) || Array.isArray(tools["allowed"]) || Array.isArray(tools["exclude"]);
4578
- if (!hasLegacy) return null;
4579
- const result = structuredClone(settings);
4580
- const resultTools = result["tools"];
4581
- const permissions = result["permissions"] ?? {};
4582
- result["permissions"] = permissions;
4583
- const mergeInto = /* @__PURE__ */ __name((key, items) => {
4584
- const existing = Array.isArray(permissions[key]) ? permissions[key] : [];
4585
- const merged = Array.from(/* @__PURE__ */ new Set([...existing, ...items]));
4586
- permissions[key] = merged;
4587
- }, "mergeInto");
4588
- if (Array.isArray(resultTools["allowed"])) {
4589
- mergeInto("allow", resultTools["allowed"]);
4590
- delete resultTools["allowed"];
4591
- }
4592
- if (Array.isArray(resultTools["exclude"])) {
4593
- mergeInto("deny", resultTools["exclude"]);
4594
- delete resultTools["exclude"];
4595
- }
4596
- if (Array.isArray(resultTools["core"])) {
4597
- mergeInto("allow", resultTools["core"]);
4598
- delete resultTools["core"];
4599
- }
4600
- return result;
4601
- }
4602
- __name(migrateLegacyPermissions, "migrateLegacyPermissions");
4603
- var SettingScope = /* @__PURE__ */ ((SettingScope2) => {
4604
- SettingScope2["User"] = "User";
4605
- SettingScope2["Workspace"] = "Workspace";
4606
- SettingScope2["System"] = "System";
4607
- SettingScope2["SystemDefaults"] = "SystemDefaults";
4608
- return SettingScope2;
4609
- })(SettingScope || {});
4610
- function getSettingsFileKeyWarnings(settings, settingsFilePath) {
4611
- const version = settings[SETTINGS_VERSION_KEY];
4612
- if (typeof version !== "number" || version < SETTINGS_VERSION) {
4613
- return [];
4614
- }
4615
- const warnings = [];
4616
- const ignoredLegacyKeys = /* @__PURE__ */ new Set();
4617
- for (const [oldKey, newPath] of Object.entries(V1_TO_V2_MIGRATION_MAP)) {
4618
- if (oldKey === newPath) {
4619
- continue;
4620
- }
4621
- if (!(oldKey in settings)) {
4622
- continue;
4623
- }
4624
- const oldValue = settings[oldKey];
4625
- if (V2_CONTAINER_KEYS.has(oldKey) && typeof oldValue === "object" && oldValue !== null && !Array.isArray(oldValue)) {
4626
- continue;
4627
- }
4628
- ignoredLegacyKeys.add(oldKey);
4629
- warnings.push(
4630
- `Warning: Legacy setting '${oldKey}' will be ignored in ${settingsFilePath}. Please use '${newPath}' instead.`
4631
- );
4632
- }
4633
- const schemaKeys = new Set(Object.keys(getSettingsSchema()));
4634
- for (const key of Object.keys(settings)) {
4635
- if (key === SETTINGS_VERSION_KEY) {
4636
- continue;
4637
- }
4638
- if (ignoredLegacyKeys.has(key)) {
4639
- continue;
4640
- }
4641
- if (schemaKeys.has(key)) {
4642
- continue;
4643
- }
4644
- debugLogger2.warn(
4645
- `Unknown setting '${key}' will be ignored in ${settingsFilePath}.`
4646
- );
4647
- }
4648
- return warnings;
4649
- }
4650
- __name(getSettingsFileKeyWarnings, "getSettingsFileKeyWarnings");
4651
- function isPlainObject2(value) {
4652
- return typeof value === "object" && value !== null && !Array.isArray(value);
4653
- }
4654
- __name(isPlainObject2, "isPlainObject");
4655
- function hasAnyProviderEntries(modelProviders) {
4656
- if (!isPlainObject2(modelProviders)) {
4657
- return false;
4658
- }
4659
- return Object.values(modelProviders).some(
4660
- (providerModels) => Array.isArray(providerModels) && providerModels.length > 0
4661
- );
4662
- }
4663
- __name(hasAnyProviderEntries, "hasAnyProviderEntries");
4664
- function getModelProvidersOverrideWarnings(loadedSettings) {
4665
- if (!loadedSettings.isTrusted) {
4666
- return [];
4667
- }
4668
- const userOriginal = loadedSettings.user.originalSettings;
4669
- const workspaceOriginal = loadedSettings.workspace.originalSettings;
4670
- if (!hasOwnModelProviders(userOriginal) || !hasOwnModelProviders(workspaceOriginal)) {
4671
- return [];
4672
- }
4673
- const userModelProviders = userOriginal["modelProviders"];
4674
- const workspaceModelProviders = workspaceOriginal["modelProviders"];
4675
- const workspaceIsEmptyModelProviders = isPlainObject2(workspaceModelProviders) && Object.keys(workspaceModelProviders).length === 0;
4676
- if (!workspaceIsEmptyModelProviders || !hasAnyProviderEntries(userModelProviders)) {
4677
- return [];
4678
- }
4679
- return [
4680
- `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}'.`
4681
- ];
4682
- }
4683
- __name(getModelProvidersOverrideWarnings, "getModelProvidersOverrideWarnings");
4684
- function getSettingsWarnings(loadedSettings) {
4685
- const warningSet = /* @__PURE__ */ new Set();
4686
- for (const warning of loadedSettings.migrationWarnings) {
4687
- warningSet.add(`Warning: ${warning}`);
4688
- }
4689
- for (const scope of ["User" /* User */, "Workspace" /* Workspace */]) {
4690
- const settingsFile = loadedSettings.forScope(scope);
4691
- if (settingsFile.rawJson === void 0) {
4692
- continue;
4693
- }
4694
- const settingsObject = settingsFile.originalSettings;
4695
- for (const warning of getSettingsFileKeyWarnings(
4696
- settingsObject,
4697
- settingsFile.path
4698
- )) {
4699
- warningSet.add(warning);
4700
- }
4701
- }
4702
- for (const warning of getModelProvidersOverrideWarnings(loadedSettings)) {
4703
- warningSet.add(warning);
4704
- }
4705
- const workspaceFile = loadedSettings.forScope("Workspace" /* Workspace */);
4706
- if (workspaceFile.rawJson !== void 0 && workspaceFile.originalSettings.security?.allowPrivateNetworkHooks !== void 0) {
4707
- warningSet.add(
4708
- `Warning: security.allowPrivateNetworkHooks in workspace settings (${workspaceFile.path}) is ignored. This setting is only honored from User, System, or SystemDefaults scope settings.`
4709
- );
4710
- }
4711
- if (workspaceFile.rawJson !== void 0 && workspaceFile.originalSettings.security?.allowedInsecureVoiceBaseUrls !== void 0) {
4712
- warningSet.add(
4713
- `Warning: security.allowedInsecureVoiceBaseUrls in workspace settings (${workspaceFile.path}) is ignored. This setting is only honored from User, System, or SystemDefaults scope settings.`
4714
- );
4715
- }
4716
- return [...warningSet];
4717
- }
4718
- __name(getSettingsWarnings, "getSettingsWarnings");
4719
- function tagMcpServerScope(settings, scope) {
4720
- const servers = settings.mcpServers;
4721
- if (!servers || Object.keys(servers).length === 0) {
4722
- return settings;
4723
- }
4724
- const tagged = {};
4725
- for (const [name, config] of Object.entries(servers)) {
4726
- tagged[name] = { ...config, scope };
4727
- }
4728
- return { ...settings, mcpServers: tagged };
4729
- }
4730
- __name(tagMcpServerScope, "tagMcpServerScope");
4731
- function stripWorkspaceSecurityBypasses(settings) {
4732
- if (settings.security?.allowPrivateNetworkHooks === void 0 && settings.security?.allowedInsecureVoiceBaseUrls === void 0) {
4733
- return settings;
4734
- }
4735
- const {
4736
- allowPrivateNetworkHooks: _privateHooks,
4737
- allowedInsecureVoiceBaseUrls: _insecureVoice,
4738
- ...restSecurity
4739
- } = settings.security;
4740
- return { ...settings, security: restSecurity };
4741
- }
4742
- __name(stripWorkspaceSecurityBypasses, "stripWorkspaceSecurityBypasses");
4743
- function mergeSettings(system, systemDefaults, user, workspace, isTrusted) {
4744
- const safeWorkspace = isTrusted ? tagMcpServerScope(stripWorkspaceSecurityBypasses(workspace), "workspace") : {};
4745
- return customDeepMerge(
4746
- getMergeStrategyForPath,
4747
- {},
4748
- // Start with an empty object
4749
- systemDefaults,
4750
- user,
4751
- safeWorkspace,
4752
- tagMcpServerScope(system, "system")
4753
- );
4754
- }
4755
- __name(mergeSettings, "mergeSettings");
4756
- var LoadedSettings = class {
4757
- static {
4758
- __name(this, "LoadedSettings");
4759
- }
4760
- constructor(system, systemDefaults, user, workspace, isTrusted, migratedInMemoryScopes, migrationWarnings = [], corruptedPath = void 0, wasRecovered = false, workspaceSettingsActive = true) {
4761
- this.system = system;
4762
- this.systemDefaults = systemDefaults;
4763
- this.user = user;
4764
- this.workspace = workspace;
4765
- this.isTrusted = isTrusted;
4766
- this.migratedInMemoryScopes = migratedInMemoryScopes;
4767
- this.migrationWarnings = migrationWarnings;
4768
- this.corruptedPath = corruptedPath;
4769
- this.wasRecovered = wasRecovered;
4770
- this.workspaceSettingsActive = workspaceSettingsActive;
4771
- this._merged = this.computeMergedSettings();
4772
- }
4773
- system;
4774
- systemDefaults;
4775
- user;
4776
- workspace;
4777
- isTrusted;
4778
- migratedInMemoryScopes;
4779
- migrationWarnings;
4780
- corruptedPath;
4781
- wasRecovered;
4782
- workspaceSettingsActive;
4783
- corruptionDialogDismissed = false;
4784
- _merged;
4785
- get merged() {
4786
- return this._merged;
4787
- }
4788
- computeMergedSettings() {
4789
- return mergeSettings(
4790
- this.system.settings,
4791
- this.systemDefaults.settings,
4792
- this.user.settings,
4793
- this.workspace.settings,
4794
- this.isTrusted
4795
- );
4796
- }
4797
- forScope(scope) {
4798
- switch (scope) {
4799
- case "User" /* User */:
4800
- return this.user;
4801
- case "Workspace" /* Workspace */:
4802
- return this.workspace;
4803
- case "System" /* System */:
4804
- return this.system;
4805
- case "SystemDefaults" /* SystemDefaults */:
4806
- return this.systemDefaults;
4807
- default:
4808
- throw new Error(`Invalid scope: ${scope}`);
4809
- }
4810
- }
4811
- setValue(scope, key, value, assertCanCommit, opts = {}) {
4812
- if (key === "model.name" && typeof value === "string") {
4813
- value = stripRuntimeSnapshotPrefix(value);
4814
- }
4815
- assertCanCommit?.();
4816
- const settingsFile = this.forScope(scope);
4817
- const replacePath = key === "mcpServers" ? key.split(".") : [];
4818
- if (opts.throwOnWriteFailure) {
4819
- saveSettings(
4820
- settingsFile,
4821
- createSettingsUpdate(key, value),
4822
- replacePath,
4823
- {
4824
- throwOnWriteFailure: true
4825
- }
4826
- );
4827
- }
4828
- setNestedPropertySafe(settingsFile.settings, key, value);
4829
- setNestedPropertySafe(settingsFile.originalSettings, key, value);
4830
- this._merged = this.computeMergedSettings();
4831
- if (!opts.throwOnWriteFailure) {
4832
- saveSettings(settingsFile, createSettingsUpdate(key, value), replacePath);
4833
- }
4834
- }
4835
- setValues(writes, onScopeCommitted, assertCanCommit) {
4836
- const scopes = /* @__PURE__ */ new Set();
4837
- for (const write of writes) {
4838
- const value = write.key === "model.name" && typeof write.value === "string" ? stripRuntimeSnapshotPrefix(write.value) : write.value;
4839
- const settingsFile = this.forScope(write.scope);
4840
- setNestedPropertySafe(settingsFile.settings, write.key, value);
4841
- setNestedPropertySafe(settingsFile.originalSettings, write.key, value);
4842
- scopes.add(write.scope);
4843
- }
4844
- this._merged = this.computeMergedSettings();
4845
- const scopeList = Array.from(scopes);
4846
- for (let i = 0; i < scopeList.length; i++) {
4847
- const scope = scopeList[i];
4848
- try {
4849
- assertCanCommit?.();
4850
- saveSettings(this.forScope(scope), void 0, void 0, {
4851
- throwOnWriteFailure: true
4852
- });
4853
- } catch (err) {
4854
- for (const uncommittedScope of scopeList.slice(i)) {
4855
- this.reloadScopeFromDisk(uncommittedScope);
4856
- }
4857
- throw err;
4858
- }
4859
- onScopeCommitted?.(scope);
4860
- }
4861
- }
4862
- recomputeMerged() {
4863
- this._merged = this.computeMergedSettings();
4864
- }
4865
- reloadScopeFromDisk(scope) {
4866
- const file = this.forScope(scope);
4867
- try {
4868
- if (!fs3.existsSync(file.path)) {
4869
- file.settings = {};
4870
- file.originalSettings = {};
4871
- file.rawJson = void 0;
4872
- this._merged = this.computeMergedSettings();
4873
- return;
4874
- }
4875
- const content = fs3.readFileSync(file.path, "utf-8");
4876
- const parsed = JSON.parse((0, import_strip_json_comments.default)(content));
4877
- if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
4878
- const resolved = resolveEnvVarsInObject(
4879
- parsed,
4880
- getHomeEnvFallbackVars((message) => debugLogger2.warn(message))
4881
- );
4882
- file.settings = resolved;
4883
- file.originalSettings = structuredClone(parsed);
4884
- file.rawJson = content;
4885
- }
4886
- } catch (err) {
4887
- debugLogger2.warn(
4888
- `reloadScopeFromDisk(${scope}): ${getErrorMessage(err)}`
4889
- );
4890
- }
4891
- this._merged = this.computeMergedSettings();
4892
- }
4893
- /**
4894
- * Get user-level hooks from user settings (not merged with workspace).
4895
- * These hooks should always be loaded regardless of folder trust.
4896
- */
4897
- getUserHooks() {
4898
- return this.user.settings.hooks;
4899
- }
4900
- /**
4901
- * Get project-level hooks from workspace settings (not merged).
4902
- * Returns undefined if workspace is not trusted (hooks filtered out).
4903
- */
4904
- getProjectHooks() {
4905
- if (!this.isTrusted) {
4906
- return void 0;
4907
- }
4908
- return this.workspace.settings.hooks;
4909
- }
4910
- };
4911
- function createMinimalSettings() {
4912
- const emptySettingsFile = {
4913
- path: "",
4914
- settings: {},
4915
- originalSettings: {},
4916
- rawJson: "{}"
4917
- };
4918
- return new LoadedSettings(
4919
- emptySettingsFile,
4920
- emptySettingsFile,
4921
- emptySettingsFile,
4922
- emptySettingsFile,
4923
- false,
4924
- /* @__PURE__ */ new Set(),
4925
- [],
4926
- void 0,
4927
- false
4928
- );
4929
- }
4930
- __name(createMinimalSettings, "createMinimalSettings");
4931
- function detectQwenHomeRedirectWithoutMigration(activeUserSettingsPath) {
4932
- if (!process.env["QWEN_HOME"]) {
4933
- return null;
4934
- }
4935
- const activeQwenDir = Storage.getGlobalQwenDir();
4936
- const savedQwenHome = process.env["QWEN_HOME"];
4937
- delete process.env["QWEN_HOME"];
4938
- let legacyQwenDir;
4939
- try {
4940
- legacyQwenDir = Storage.getGlobalQwenDir();
4941
- } finally {
4942
- process.env["QWEN_HOME"] = savedQwenHome;
4943
- }
4944
- if (path2.resolve(activeQwenDir) === path2.resolve(legacyQwenDir)) {
4945
- return null;
4946
- }
4947
- if (fs3.existsSync(activeUserSettingsPath)) {
4948
- return null;
4949
- }
4950
- const legacyUserSettings = path2.join(legacyQwenDir, "settings.json");
4951
- if (!fs3.existsSync(legacyUserSettings)) {
4952
- return null;
4953
- }
4954
- 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.`;
4955
- }
4956
- __name(detectQwenHomeRedirectWithoutMigration, "detectQwenHomeRedirectWithoutMigration");
4957
- var CORRUPTED_SUFFIX = ".corrupted";
4958
- function loadSettings(workspaceDir = process.cwd(), consumeCorruptionEnvVars = true) {
4959
- const opts = typeof consumeCorruptionEnvVars === "object" ? consumeCorruptionEnvVars : { consumeCorruptionEnvVars };
4960
- preResolveHomeEnvOverrides();
4961
- const userSettingsPath = getUserSettingsPath();
4962
- const qwenHomeRedirectWarning = detectQwenHomeRedirectWithoutMigration(userSettingsPath);
4963
- let systemSettings = {};
4964
- let systemDefaultSettings = {};
4965
- let userSettings = {};
4966
- let workspaceSettings = {};
4967
- const settingsErrors = [];
4968
- const systemSettingsPath = getSystemSettingsPath();
4969
- const systemDefaultsPath = getSystemDefaultsPath();
4970
- const migratedInMemoryScopes = /* @__PURE__ */ new Set();
4971
- const resolvedWorkspaceDir = path2.resolve(workspaceDir);
4972
- const resolvedHomeDir = path2.resolve(homedir());
4973
- let realWorkspaceDir = resolvedWorkspaceDir;
4974
- try {
4975
- realWorkspaceDir = fs3.realpathSync(resolvedWorkspaceDir);
4976
- } catch (_e) {
4977
- }
4978
- const realHomeDir = fs3.realpathSync(resolvedHomeDir);
4979
- const workspaceSettingsPath = new Storage(
4980
- workspaceDir
4981
- ).getWorkspaceSettingsPath();
4982
- const loadAndMigrate = /* @__PURE__ */ __name((filePath, scope) => {
4983
- try {
4984
- if (fs3.existsSync(filePath)) {
4985
- const content = fs3.readFileSync(filePath, "utf-8");
4986
- let rawSettings;
4987
- const corruptedPath = `${filePath}${CORRUPTED_SUFFIX}`;
4988
- let corruptedSaved = false;
4989
- let recoveredFromEnvVar = null;
4990
- try {
4991
- rawSettings = JSON.parse((0, import_strip_json_comments.default)(content));
4992
- } catch (parseError) {
4993
- debugLogger2.warn(
4994
- `Settings file ${filePath} has invalid JSON (${getErrorMessage(parseError)}). Resetting to empty settings.`
4995
- );
4996
- try {
4997
- fs3.copyFileSync(filePath, corruptedPath);
4998
- corruptedSaved = true;
4999
- } catch (copyError) {
5000
- debugLogger2.warn(
5001
- `Failed to copy corrupted file: ${getErrorMessage(copyError)}`
5002
- );
5003
- }
5004
- if (!rawSettings) {
5005
- const warningMsg = `Settings file ${filePath} has invalid JSON. Your settings have been reset.`;
5006
- debugLogger2.warn(warningMsg);
5007
- if (corruptedSaved) {
5008
- try {
5009
- fs3.writeFileSync(filePath, "{}", "utf-8");
5010
- } catch {
5011
- }
5012
- }
5013
- return {
5014
- settings: {},
5015
- migrationWarnings: [],
5016
- corruptedPath: corruptedSaved ? corruptedPath : void 0,
5017
- wasRecovered: false
5018
- };
5019
- }
5020
- }
5021
- const envCorruptedPath = process.env[ENV_CORRUPTED_PATH];
5022
- if ((opts.consumeCorruptionEnvVars ?? true) && envCorruptedPath && envCorruptedPath === corruptedPath && scope === "User" /* User */) {
5023
- corruptedSaved = true;
5024
- recoveredFromEnvVar = process.env[ENV_WAS_RECOVERED] === "1";
5025
- delete process.env[ENV_CORRUPTED_PATH];
5026
- delete process.env[ENV_WAS_RECOVERED];
5027
- }
5028
- if (typeof rawSettings !== "object" || rawSettings === null || Array.isArray(rawSettings)) {
5029
- settingsErrors.push({
5030
- message: "Settings file is not a valid JSON object.",
5031
- path: filePath
5032
- });
5033
- return { settings: {} };
5034
- }
5035
- let settingsObject = rawSettings;
5036
- const hasVersionKey = SETTINGS_VERSION_KEY in settingsObject;
5037
- const versionValue = settingsObject[SETTINGS_VERSION_KEY];
5038
- const hasInvalidVersion = hasVersionKey && typeof versionValue !== "number";
5039
- const hasLegacyNumericVersion = typeof versionValue === "number" && versionValue < SETTINGS_VERSION;
5040
- let migrationWarnings;
5041
- const persistSettingsObject = /* @__PURE__ */ __name((warningPrefix) => {
5042
- try {
5043
- const written = updateSettingsFilePreservingFormat(
5044
- filePath,
5045
- settingsObject,
5046
- true
5047
- );
5048
- if (!written) {
5049
- debugLogger2.error(
5050
- `${warningPrefix}: updateSettingsFilePreservingFormat returned false for ${filePath}`
5051
- );
5052
- }
5053
- } catch (e) {
5054
- debugLogger2.error(`${warningPrefix}: ${getErrorMessage(e)}`);
5055
- }
5056
- }, "persistSettingsObject");
5057
- if (needsMigration(settingsObject)) {
5058
- const migrationResult = runMigrations(settingsObject, scope);
5059
- if (migrationResult.executedMigrations.length > 0) {
5060
- settingsObject = migrationResult.settings;
5061
- migrationWarnings = migrationResult.warnings;
5062
- persistSettingsObject("Error migrating settings file on disk");
5063
- } else if ((hasLegacyNumericVersion || hasInvalidVersion) && !corruptedSaved) {
5064
- settingsObject[SETTINGS_VERSION_KEY] = SETTINGS_VERSION;
5065
- debugLogger2.warn(
5066
- `Settings version metadata in ${filePath} could not be migrated by any registered migration. Normalizing ${SETTINGS_VERSION_KEY} to ${SETTINGS_VERSION}.`
5067
- );
5068
- persistSettingsObject("Error normalizing settings version on disk");
5069
- }
5070
- } else if ((!hasVersionKey || hasInvalidVersion || hasLegacyNumericVersion) && !corruptedSaved) {
5071
- settingsObject[SETTINGS_VERSION_KEY] = SETTINGS_VERSION;
5072
- persistSettingsObject("Error normalizing settings version on disk");
5073
- }
5074
- const result = {
5075
- settings: settingsObject,
5076
- rawJson: content,
5077
- migrationWarnings: migrationWarnings ?? []
5078
- };
5079
- if (corruptedSaved) {
5080
- result.corruptedPath = corruptedPath;
5081
- result.wasRecovered = recoveredFromEnvVar ?? false;
5082
- }
5083
- return result;
5084
- }
5085
- } catch (error) {
5086
- settingsErrors.push({
5087
- message: getErrorMessage(error),
5088
- path: filePath
5089
- });
5090
- }
5091
- return { settings: {} };
5092
- }, "loadAndMigrate");
5093
- const systemResult = loadAndMigrate(systemSettingsPath, "System" /* System */);
5094
- const systemDefaultsResult = loadAndMigrate(
5095
- systemDefaultsPath,
5096
- "SystemDefaults" /* SystemDefaults */
5097
- );
5098
- const userResult = loadAndMigrate(userSettingsPath, "User" /* User */);
5099
- let workspaceResult = {
5100
- settings: {},
5101
- rawJson: void 0
5102
- };
5103
- const workspaceSettingsActive = !opts.skipWorkspaceSettings && realWorkspaceDir !== realHomeDir;
5104
- if (workspaceSettingsActive) {
5105
- workspaceResult = loadAndMigrate(
5106
- workspaceSettingsPath,
5107
- "Workspace" /* Workspace */
5108
- );
5109
- }
5110
- const systemOriginalSettings = structuredClone(systemResult.settings);
5111
- const systemDefaultsOriginalSettings = structuredClone(
5112
- systemDefaultsResult.settings
5113
- );
5114
- const userOriginalSettings = structuredClone(userResult.settings);
5115
- const workspaceOriginalSettings = structuredClone(workspaceResult.settings);
5116
- const homeEnvFallback = getHomeEnvFallbackVars(
5117
- (message) => debugLogger2.warn(message)
5118
- );
5119
- systemSettings = resolveEnvVarsInObject(
5120
- systemResult.settings,
5121
- homeEnvFallback
5122
- );
5123
- systemDefaultSettings = resolveEnvVarsInObject(
5124
- systemDefaultsResult.settings,
5125
- homeEnvFallback
5126
- );
5127
- userSettings = resolveEnvVarsInObject(userResult.settings, homeEnvFallback);
5128
- workspaceSettings = resolveEnvVarsInObject(
5129
- workspaceResult.settings,
5130
- homeEnvFallback
5131
- );
5132
- if (userSettings.ui?.theme === "VS") {
5133
- userSettings.ui.theme = DEFAULT_LIGHT_THEME_NAME;
5134
- } else if (userSettings.ui?.theme === "VS2015") {
5135
- userSettings.ui.theme = DEFAULT_DARK_THEME_NAME;
5136
- }
5137
- if (workspaceSettings.ui?.theme === "VS") {
5138
- workspaceSettings.ui.theme = DEFAULT_LIGHT_THEME_NAME;
5139
- } else if (workspaceSettings.ui?.theme === "VS2015") {
5140
- workspaceSettings.ui.theme = DEFAULT_DARK_THEME_NAME;
5141
- }
5142
- const initialTrustCheckSettings = customDeepMerge(
5143
- getMergeStrategyForPath,
5144
- {},
5145
- systemSettings,
5146
- userSettings
5147
- );
5148
- const isTrusted = opts.workspaceTrusted ?? isWorkspaceTrusted(
5149
- initialTrustCheckSettings,
5150
- void 0,
5151
- realWorkspaceDir
5152
- ).isTrusted ?? true;
5153
- const tempMergedSettings = mergeSettings(
5154
- systemSettings,
5155
- systemDefaultSettings,
5156
- userSettings,
5157
- workspaceSettings,
5158
- isTrusted
5159
- );
5160
- if (!opts.skipLoadEnvironment) {
5161
- loadEnvironment(tempMergedSettings, workspaceDir);
5162
- }
5163
- if (settingsErrors.length > 0) {
5164
- const errorMessages = settingsErrors.map(
5165
- (error) => `Error in ${error.path}: ${error.message}`
5166
- );
5167
- throw new FatalConfigError(
5168
- `${errorMessages.join("\n")}
5169
- Please fix the configuration file(s) and try again.`
5170
- );
5171
- }
5172
- const allMigrationWarnings = [
5173
- ...qwenHomeRedirectWarning ? [qwenHomeRedirectWarning] : [],
5174
- ...systemResult.migrationWarnings ?? [],
5175
- ...systemDefaultsResult.migrationWarnings ?? [],
5176
- ...userResult.migrationWarnings ?? [],
5177
- ...workspaceResult.migrationWarnings ?? []
5178
- ];
5179
- return new LoadedSettings(
5180
- {
5181
- path: systemSettingsPath,
5182
- settings: systemSettings,
5183
- originalSettings: systemOriginalSettings,
5184
- rawJson: systemResult.rawJson
5185
- },
5186
- {
5187
- path: systemDefaultsPath,
5188
- settings: systemDefaultSettings,
5189
- originalSettings: systemDefaultsOriginalSettings,
5190
- rawJson: systemDefaultsResult.rawJson
5191
- },
5192
- {
5193
- path: userSettingsPath,
5194
- settings: userSettings,
5195
- originalSettings: userOriginalSettings,
5196
- rawJson: userResult.rawJson
5197
- },
5198
- {
5199
- path: workspaceSettingsPath,
5200
- settings: workspaceSettings,
5201
- originalSettings: workspaceOriginalSettings,
5202
- rawJson: workspaceResult.rawJson
5203
- },
5204
- isTrusted,
5205
- migratedInMemoryScopes,
5206
- allMigrationWarnings,
5207
- userResult.corruptedPath,
5208
- userResult.wasRecovered ?? false,
5209
- workspaceSettingsActive
5210
- );
5211
- }
5212
- __name(loadSettings, "loadSettings");
5213
- function createSettingsUpdate(key, value) {
5214
- const root = {};
5215
- setNestedPropertySafe(root, key, value);
5216
- return root;
5217
- }
5218
- __name(createSettingsUpdate, "createSettingsUpdate");
5219
- function saveSettings(settingsFile, updates = settingsFile.originalSettings, replacePath = [], opts = {}) {
5220
- try {
5221
- const dirPath = path2.dirname(settingsFile.path);
5222
- if (!fs3.existsSync(dirPath)) {
5223
- fs3.mkdirSync(dirPath, { recursive: true });
5224
- }
5225
- const written = updateSettingsFilePreservingFormat(
5226
- settingsFile.path,
5227
- updates,
5228
- false,
5229
- replacePath
5230
- );
5231
- if (!written) {
5232
- const message = `saveSettings: updateSettingsFilePreservingFormat returned false for ${settingsFile.path}`;
5233
- if (opts.throwOnWriteFailure) {
5234
- throw new Error(message);
5235
- }
5236
- debugLogger2.error(message);
5237
- }
5238
- } catch (error) {
5239
- debugLogger2.error("Error saving user settings file.");
5240
- debugLogger2.error(error instanceof Error ? error.message : String(error));
5241
- throw error;
5242
- }
5243
- }
5244
- __name(saveSettings, "saveSettings");
5245
-
5246
3341
  export {
5247
- getModelProvidersOwnerScope,
5248
- getPersistScopeForModelSelection,
5249
- getWritableScopes,
5250
- getOwnKeyScope,
3342
+ DEFAULT_OPENAI_LOG_RETENTION_DAYS,
5251
3343
  TOGGLE_TYPES,
5252
- OUTPUT_LANGUAGE_AUTO,
5253
- isAutoLanguage,
5254
- resolveOutputLanguageOrPreserveAuto,
5255
- getOutputLanguageFilePath,
5256
- updateOutputLanguageFile,
5257
- writeOutputLanguageAndRegisterPath,
5258
- initializeLlmOutputLanguage,
5259
- getFlattenedSchema,
5260
- getSettingDefinition,
5261
- requiresRestart,
5262
- getDefaultValue,
5263
- getNestedValue,
5264
- getNestedProperty,
5265
- getEffectiveValue,
5266
- getAllSettingKeys,
5267
- validateSettingValue,
5268
- getDialogSettingKeys,
5269
- settingExistsInScope,
5270
- setPendingSettingValue,
5271
- setPendingSettingValueAny,
5272
- getRestartRequiredFromModified,
5273
- saveModifiedSettings,
5274
- getDisplayValue,
5275
- isDefaultValue,
5276
- backupSettingsFile,
5277
- restoreSettingsFromBackup,
5278
- cleanupSettingsBackup,
5279
- v1ToV2Migration,
5280
- getUserSettingsPath,
5281
- getUserSettingsDir,
5282
- SETTINGS_VERSION,
5283
- SETTINGS_VERSION_KEY,
5284
- migrateLegacyPermissions,
5285
- SettingScope,
5286
- getSettingsWarnings,
5287
- LoadedSettings,
5288
- createMinimalSettings,
5289
- CORRUPTED_SUFFIX,
5290
- loadSettings,
5291
- saveSettings
3344
+ getSettingsSchema
5292
3345
  };
5293
- /**
5294
- * @license
5295
- * Copyright 2025 Qwen Team
5296
- * SPDX-License-Identifier: Apache-2.0
5297
- */
5298
3346
  /**
5299
3347
  * @license
5300
3348
  * Copyright 2025 Google LLC
5301
3349
  * SPDX-License-Identifier: Apache-2.0
5302
3350
  */
5303
- /**
5304
- * @license
5305
- * Copyright 2025 Qwen team
5306
- * SPDX-License-Identifier: Apache-2.0
5307
- */