@qwen-code/qwen-code 0.16.0-preview.0 → 0.16.0

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 (88) hide show
  1. package/bundled/qc-helper/docs/configuration/settings.md +39 -37
  2. package/bundled/qc-helper/docs/features/_meta.ts +2 -0
  3. package/bundled/qc-helper/docs/features/approval-mode.md +119 -2
  4. package/bundled/qc-helper/docs/features/auto-mode.md +263 -0
  5. package/bundled/qc-helper/docs/features/commands.md +11 -10
  6. package/bundled/qc-helper/docs/features/skills.md +3 -0
  7. package/bundled/qc-helper/docs/features/structured-output.md +309 -0
  8. package/bundled/qc-helper/docs/features/sub-agents.md +47 -5
  9. package/bundled/qc-helper/docs/qwen-serve.md +119 -14
  10. package/bundled/review/SKILL.md +12 -3
  11. package/chunks/{agent-ZNQPH67I.js → agent-K6OWOMBN.js} +9 -11
  12. package/chunks/{anthropicContentGenerator-ICBDZ6R2.js → anthropicContentGenerator-RQJNXJIY.js} +6 -3
  13. package/chunks/{askUserQuestion-WQILGUSQ.js → askUserQuestion-PQPMPNM3.js} +1 -1
  14. package/chunks/{ca-S3XJMT6P.js → ca-UZ7BANMN.js} +3 -3
  15. package/chunks/{chunk-MNPZ2WO6.js → chunk-3T4ZT63H.js} +8685 -3846
  16. package/chunks/{chunk-XVHR7ATJ.js → chunk-4AOCVI6J.js} +1 -0
  17. package/chunks/{chunk-JHMX4QTD.js → chunk-4J63U5QO.js} +16 -348
  18. package/chunks/{chunk-AEJ2DKLP.js → chunk-C6WMLUNB.js} +1 -1
  19. package/chunks/{chunk-PPHYLJSS.js → chunk-CAVZVZX6.js} +2 -2
  20. package/chunks/{chunk-VTPOO6GV.js → chunk-CSWBPY3P.js} +1 -1
  21. package/chunks/{chunk-NAID3ZWF.js → chunk-DMIMF3CG.js} +1 -1
  22. package/chunks/{chunk-2B7UBDY5.js → chunk-GGNTZ2NH.js} +90 -19
  23. package/chunks/chunk-L34E6AGL.js +19126 -0
  24. package/chunks/{chunk-EDYSNFEM.js → chunk-L5E26RN6.js} +2 -2
  25. package/chunks/{chunk-CW44BRRA.js → chunk-MAY32HXD.js} +375 -0
  26. package/chunks/{chunk-7QXHXMC6.js → chunk-NOAHME6A.js} +96 -20
  27. package/chunks/{chunk-FZIUV27X.js → chunk-PVVL5Q3W.js} +31 -0
  28. package/chunks/{chunk-YHEAJFCI.js → chunk-USE2VQ5P.js} +3 -0
  29. package/chunks/chunk-VMOAQVBP.js +379 -0
  30. package/chunks/{chunk-C3LHPHN2.js → chunk-WCZWAKFG.js} +792 -139
  31. package/chunks/{chunk-JYQUJ5DS.js → chunk-YJLGXDQJ.js} +1 -1
  32. package/chunks/{contextCommand-IGBCEXI4.js → contextCommand-7CPNXBLO.js} +11 -13
  33. package/chunks/{cron-create-AVI3Q267.js → cron-create-IGYXQVG4.js} +27 -1
  34. package/chunks/{cron-delete-ZCEGDXXV.js → cron-delete-ETKIZCWT.js} +1 -1
  35. package/chunks/{cron-list-VN653OK5.js → cron-list-BVCUSWRU.js} +1 -1
  36. package/chunks/{de-MNR4SMAI.js → de-V4IE2OOZ.js} +3 -3
  37. package/chunks/{dist-RRYNPBOE.js → dist-4L54HRX2.js} +2 -2
  38. package/chunks/{dist-WP4AH3VK.js → dist-BXDUQ2QY.js} +1 -1
  39. package/chunks/{dist-M6GFCZ7S.js → dist-MN2PDDPR.js} +1 -1
  40. package/chunks/{edit-74Q4AFHQ.js → edit-CBM5NDVK.js} +22 -12
  41. package/chunks/{en-FIUWJSZR.js → en-HGJ2SPLM.js} +4 -3
  42. package/chunks/{enter-worktree-H72HXC7D.js → enter-worktree-XABKPLO6.js} +35 -11
  43. package/chunks/{exit-worktree-FGIQO3S3.js → exit-worktree-56MN2PCL.js} +35 -11
  44. package/chunks/{exitPlanMode-NBR2PK2D.js → exitPlanMode-YDNPCSCJ.js} +9 -11
  45. package/chunks/{fr-OFJFHLCR.js → fr-CJULI7ZX.js} +3 -3
  46. package/chunks/{geminiContentGenerator-33RP4WKD.js → geminiContentGenerator-ZGPNBFDS.js} +1 -1
  47. package/chunks/{glob-WEE3CJL6.js → glob-ZHA35VO5.js} +9 -11
  48. package/chunks/{grep-DZKSBFZK.js → grep-RV6V6T52.js} +9 -11
  49. package/chunks/{ja-V6OQ6VL7.js → ja-L7CHRQEW.js} +3 -3
  50. package/chunks/{ls-6F3VSP6S.js → ls-7HD6XG3V.js} +1 -1
  51. package/chunks/{lsp-67Y7DJN5.js → lsp-ZZSFCIWD.js} +1 -1
  52. package/chunks/{monitor-EDZWEZVS.js → monitor-5G2OBGE5.js} +21 -11
  53. package/chunks/notebook-edit-XUBTCT6L.js +756 -0
  54. package/chunks/{openaiContentGenerator-5NQG3W64.js → openaiContentGenerator-POYAZQ6I.js} +9 -8
  55. package/chunks/{pt-ZLE6SA4A.js → pt-M6JULLEQ.js} +3 -3
  56. package/chunks/{qwenContentGenerator-4DPUUS6R.js → qwenContentGenerator-2E4H56DK.js} +11 -13
  57. package/chunks/{qwenOAuth2-JE7H47TE.js → qwenOAuth2-EEJGROP7.js} +7 -1
  58. package/chunks/{read-file-CQOF7BQ2.js → read-file-3JIOOXFT.js} +4 -5
  59. package/chunks/{ripGrep-KR5LKGTI.js → ripGrep-LEI3L6PM.js} +9 -11
  60. package/chunks/{ru-A4OHIUNN.js → ru-QILM4HBC.js} +3 -3
  61. package/chunks/{send-message-GB4AQZNC.js → send-message-ULK4MQXJ.js} +22 -1
  62. package/chunks/{serve-GAD2PEST.js → serve-CFVRMD4W.js} +8368 -1746
  63. package/chunks/{shell-E2HMCBGR.js → shell-3B5DZ437.js} +9 -11
  64. package/chunks/{skill-KDZH6UZ6.js → skill-STSZUBXR.js} +19 -6
  65. package/chunks/{src-LY4RU5AI.js → src-ROFXAPEP.js} +203 -13
  66. package/chunks/{syntheticOutput-HFL3DE7R.js → syntheticOutput-IS2X5OZ2.js} +2 -2
  67. package/chunks/{task-stop-ZQF26RXS.js → task-stop-7QSJGSSP.js} +1 -1
  68. package/chunks/{todoWrite-U4SC643O.js → todoWrite-7CVACFUX.js} +2 -2
  69. package/chunks/{tool-search-U4XQVLFU.js → tool-search-ARWOD3GD.js} +4 -5
  70. package/chunks/{web-fetch-BRWZ4WSE.js → web-fetch-ENQ2I5JA.js} +5 -2
  71. package/chunks/{write-file-NBLRMNGB.js → write-file-6MRT7TEW.js} +19 -12
  72. package/chunks/{zh-V32QONGV.js → zh-PWL2NKY3.js} +4 -3
  73. package/chunks/{zh-TW-552S24LR.js → zh-TW-S3YGWICZ.js} +4 -3
  74. package/cli.js +13298 -31697
  75. package/locales/ca.js +4 -5
  76. package/locales/de.js +4 -5
  77. package/locales/en.js +6 -5
  78. package/locales/fr.js +4 -5
  79. package/locales/ja.js +4 -5
  80. package/locales/pt.js +4 -5
  81. package/locales/ru.js +4 -5
  82. package/locales/zh-TW.js +5 -4
  83. package/locales/zh.js +5 -4
  84. package/package.json +2 -2
  85. package/chunks/chunk-3MBY4GKN.js +0 -350
  86. package/chunks/chunk-5P5XGNYH.js +0 -93
  87. package/chunks/chunk-SYCJMSIJ.js +0 -82
  88. package/chunks/chunk-Y6Z2O3WR.js +0 -33
@@ -338,6 +338,7 @@ var PermissionMode = /* @__PURE__ */ ((PermissionMode2) => {
338
338
  PermissionMode2["Default"] = "default";
339
339
  PermissionMode2["Plan"] = "plan";
340
340
  PermissionMode2["AutoEdit"] = "auto_edit";
341
+ PermissionMode2["Auto"] = "auto";
341
342
  PermissionMode2["Yolo"] = "yolo";
342
343
  return PermissionMode2;
343
344
  })(PermissionMode || {});
@@ -1,34 +1,29 @@
1
1
  // Force strict mode and setup for ESM
2
2
  "use strict";
3
3
  import {
4
- writeStderrLine
5
- } from "./chunk-Y6Z2O3WR.js";
4
+ t
5
+ } from "./chunk-VMOAQVBP.js";
6
6
  import {
7
- getCoreSystemPrompt,
8
- resolveBundleDir
9
- } from "./chunk-MNPZ2WO6.js";
7
+ getCoreSystemPrompt
8
+ } from "./chunk-3T4ZT63H.js";
10
9
  import {
11
10
  buildSkillLlmContent
12
11
  } from "./chunk-G7YTSRES.js";
13
12
  import {
14
13
  DiscoveredMCPTool,
15
14
  uiTelemetryService
16
- } from "./chunk-C3LHPHN2.js";
15
+ } from "./chunk-WCZWAKFG.js";
17
16
  import {
18
17
  DEFAULT_TOKEN_LIMIT
19
- } from "./chunk-CW44BRRA.js";
18
+ } from "./chunk-MAY32HXD.js";
20
19
  import {
21
20
  ToolNames
22
- } from "./chunk-FZIUV27X.js";
23
- import {
24
- Storage
25
- } from "./chunk-XP27SJMH.js";
21
+ } from "./chunk-PVVL5Q3W.js";
26
22
  import {
27
23
  init_esbuild_shims
28
24
  } from "./chunk-A4BMJM77.js";
29
25
  import {
30
26
  __commonJS,
31
- __glob,
32
27
  __name,
33
28
  __toESM
34
29
  } from "./chunk-J2S4EL5Y.js";
@@ -1518,324 +1513,17 @@ init_esbuild_shims();
1518
1513
  // packages/cli/src/ui/types.ts
1519
1514
  init_esbuild_shims();
1520
1515
  var import_react = __toESM(require_react(), 1);
1521
-
1522
- // packages/cli/src/i18n/index.ts
1523
- init_esbuild_shims();
1524
- import * as fs from "node:fs";
1525
- import * as path from "node:path";
1526
- import { pathToFileURL } from "node:url";
1527
-
1528
- // packages/cli/src/i18n/languages.ts
1529
- init_esbuild_shims();
1530
- var SUPPORTED_LANGUAGES = [
1531
- {
1532
- code: "en",
1533
- id: "en-US",
1534
- fullName: "English",
1535
- nativeName: "English"
1536
- },
1537
- {
1538
- code: "zh-TW",
1539
- id: "zh-TW",
1540
- fullName: "Traditional Chinese",
1541
- nativeName: "\u7E41\u9AD4\u4E2D\u6587",
1542
- strictParity: true
1543
- },
1544
- {
1545
- code: "zh",
1546
- id: "zh-CN",
1547
- fullName: "Chinese",
1548
- nativeName: "\u4E2D\u6587",
1549
- strictParity: true
1550
- },
1551
- {
1552
- code: "ru",
1553
- id: "ru-RU",
1554
- fullName: "Russian",
1555
- nativeName: "\u0420\u0443\u0441\u0441\u043A\u0438\u0439"
1556
- },
1557
- {
1558
- code: "de",
1559
- id: "de-DE",
1560
- fullName: "German",
1561
- nativeName: "Deutsch"
1562
- },
1563
- {
1564
- code: "ja",
1565
- id: "ja-JP",
1566
- fullName: "Japanese",
1567
- nativeName: "\u65E5\u672C\u8A9E"
1568
- },
1569
- {
1570
- code: "pt",
1571
- id: "pt-BR",
1572
- fullName: "Portuguese",
1573
- nativeName: "Portugu\xEAs"
1574
- },
1575
- {
1576
- code: "fr",
1577
- id: "fr-FR",
1578
- fullName: "French",
1579
- nativeName: "Fran\xE7ais"
1580
- },
1581
- {
1582
- code: "ca",
1583
- id: "ca-ES",
1584
- fullName: "Catalan",
1585
- nativeName: "Catal\xE0"
1586
- }
1516
+ var TERMINAL_GOAL_STATUS_KINDS = [
1517
+ "achieved",
1518
+ "aborted",
1519
+ "failed"
1587
1520
  ];
1588
- function normalizeLanguageCandidate(input) {
1589
- return input.trim().replace(/_/g, "-").toLowerCase();
1590
- }
1591
- __name(normalizeLanguageCandidate, "normalizeLanguageCandidate");
1592
- function matchesLocaleToken(candidate, token) {
1593
- return candidate === token || candidate.startsWith(`${token}-`) || candidate.startsWith(`${token}.`) || candidate.startsWith(`${token}@`);
1594
- }
1595
- __name(matchesLocaleToken, "matchesLocaleToken");
1596
- function getMatchedLocaleTokenLength(candidate, language) {
1597
- const code = language.code.toLowerCase();
1598
- const id = language.id.toLowerCase();
1599
- if (matchesLocaleToken(candidate, id)) {
1600
- return id.length;
1601
- }
1602
- if (matchesLocaleToken(candidate, code)) {
1603
- return code.length;
1604
- }
1605
- return void 0;
1606
- }
1607
- __name(getMatchedLocaleTokenLength, "getMatchedLocaleTokenLength");
1608
- function resolveSupportedLanguage(input) {
1609
- const normalized = normalizeLanguageCandidate(input);
1610
- if (!normalized) {
1611
- return void 0;
1612
- }
1613
- let bestMatch;
1614
- for (const language of SUPPORTED_LANGUAGES) {
1615
- if (normalized === language.fullName.toLowerCase() || language.nativeName && normalized === language.nativeName.toLowerCase()) {
1616
- return language.code;
1617
- }
1618
- const tokenLength = getMatchedLocaleTokenLength(normalized, language);
1619
- if (tokenLength !== void 0 && (!bestMatch || tokenLength > bestMatch.tokenLength)) {
1620
- bestMatch = { code: language.code, tokenLength };
1621
- }
1622
- }
1623
- return bestMatch?.code;
1624
- }
1625
- __name(resolveSupportedLanguage, "resolveSupportedLanguage");
1626
- function getLanguageNameFromLocale(locale) {
1627
- const resolved = resolveSupportedLanguage(locale);
1628
- const lang = resolved ? SUPPORTED_LANGUAGES.find((language) => language.code === resolved) : void 0;
1629
- return lang?.fullName || "English";
1630
- }
1631
- __name(getLanguageNameFromLocale, "getLanguageNameFromLocale");
1632
- function getLanguageSettingsOptions() {
1633
- return [
1634
- { value: "auto", label: "Auto (detect from system)" },
1635
- ...SUPPORTED_LANGUAGES.map((l) => ({
1636
- value: l.code,
1637
- label: l.nativeName ? `${l.nativeName} (${l.fullName})` : `${l.fullName} (${l.id})`
1638
- }))
1639
- ];
1640
- }
1641
- __name(getLanguageSettingsOptions, "getLanguageSettingsOptions");
1642
- function getSupportedLanguageIds(separator = "|") {
1643
- return SUPPORTED_LANGUAGES.map((l) => l.id).join(separator);
1644
- }
1645
- __name(getSupportedLanguageIds, "getSupportedLanguageIds");
1646
-
1647
- // packages/cli/src/i18n/translationDict.ts
1648
- init_esbuild_shims();
1649
- function getTranslationModuleExport(module) {
1650
- return Object.prototype.hasOwnProperty.call(module, "default") ? module["default"] : module;
1651
- }
1652
- __name(getTranslationModuleExport, "getTranslationModuleExport");
1653
- function isTranslationDict(value) {
1654
- return value !== null && typeof value === "object" && !Array.isArray(value) && Object.keys(value).length > 0;
1655
- }
1656
- __name(isTranslationDict, "isTranslationDict");
1657
-
1658
- // packages/cli/src/i18n/mustTranslateKeys.ts
1659
- init_esbuild_shims();
1660
-
1661
- // import("./locales/**/*.js") in packages/cli/src/i18n/index.ts
1662
- var globImport_locales_js = __glob({
1663
- "./locales/ca.js": () => import("./ca-S3XJMT6P.js"),
1664
- "./locales/de.js": () => import("./de-MNR4SMAI.js"),
1665
- "./locales/en.js": () => import("./en-FIUWJSZR.js"),
1666
- "./locales/fr.js": () => import("./fr-OFJFHLCR.js"),
1667
- "./locales/ja.js": () => import("./ja-V6OQ6VL7.js"),
1668
- "./locales/pt.js": () => import("./pt-ZLE6SA4A.js"),
1669
- "./locales/ru.js": () => import("./ru-A4OHIUNN.js"),
1670
- "./locales/zh-TW.js": () => import("./zh-TW-552S24LR.js"),
1671
- "./locales/zh.js": () => import("./zh-V32QONGV.js")
1672
- });
1673
-
1674
- // packages/cli/src/i18n/index.ts
1675
- var currentLanguage = "en";
1676
- var translations = {};
1677
- var translationCache = {};
1678
- var loadingPromises = {};
1679
- var getBuiltinLocalesDir = /* @__PURE__ */ __name(() => path.join(resolveBundleDir(import.meta.url), "locales"), "getBuiltinLocalesDir");
1680
- var getUserLocalesDir = /* @__PURE__ */ __name(() => path.join(Storage.getGlobalQwenDir(), "locales"), "getUserLocalesDir");
1681
- var getLocalePath = /* @__PURE__ */ __name((lang, useUserDir = false) => {
1682
- const baseDir = useUserDir ? getUserLocalesDir() : getBuiltinLocalesDir();
1683
- return path.join(baseDir, `${lang}.js`);
1684
- }, "getLocalePath");
1685
- function detectSystemLanguage() {
1686
- const envLang = process.env["QWEN_CODE_LANG"] || process.env["LANG"];
1687
- if (envLang) {
1688
- const resolved = resolveSupportedLanguage(envLang);
1689
- if (resolved) {
1690
- return resolved;
1691
- }
1692
- }
1693
- try {
1694
- const locale = Intl.DateTimeFormat().resolvedOptions().locale;
1695
- const resolved = resolveSupportedLanguage(locale);
1696
- if (resolved) {
1697
- return resolved;
1698
- }
1699
- } catch {
1700
- }
1701
- return "en";
1702
- }
1703
- __name(detectSystemLanguage, "detectSystemLanguage");
1704
- async function tryImportTranslations(moduleSpecifier) {
1705
- try {
1706
- const module = await import(moduleSpecifier);
1707
- const result = getTranslationModuleExport(module);
1708
- if (isTranslationDict(result)) {
1709
- return { translations: result };
1710
- }
1711
- return {
1712
- error: new Error("Module loaded but result is empty or invalid")
1713
- };
1714
- } catch (error) {
1715
- return {
1716
- error: error instanceof Error ? error : new Error(String(error))
1717
- };
1718
- }
1719
- }
1720
- __name(tryImportTranslations, "tryImportTranslations");
1721
- async function tryImportBundledTranslations(lang) {
1722
- try {
1723
- const module = await globImport_locales_js(`./locales/${lang}.js`);
1724
- const result = getTranslationModuleExport(module);
1725
- if (isTranslationDict(result)) {
1726
- return { translations: result };
1727
- }
1728
- return {
1729
- error: new Error("Module loaded but result is empty or invalid")
1730
- };
1731
- } catch (error) {
1732
- return {
1733
- error: error instanceof Error ? error : new Error(String(error))
1734
- };
1735
- }
1736
- }
1737
- __name(tryImportBundledTranslations, "tryImportBundledTranslations");
1738
- async function loadTranslationsAsync(lang) {
1739
- if (translationCache[lang]) {
1740
- return translationCache[lang];
1741
- }
1742
- const existingPromise = loadingPromises[lang];
1743
- if (existingPromise) {
1744
- return existingPromise;
1745
- }
1746
- const loadPromise = (async () => {
1747
- const userJsPath = getLocalePath(lang, true);
1748
- if (fs.existsSync(getUserLocalesDir()) && fs.existsSync(userJsPath)) {
1749
- const userResult = await tryImportTranslations(
1750
- pathToFileURL(userJsPath).href
1751
- );
1752
- if (userResult.translations) {
1753
- translationCache[lang] = userResult.translations;
1754
- return userResult.translations;
1755
- }
1756
- writeStderrLine(
1757
- `Failed to load translations from user directory for ${lang}: ${userResult.error.message}`
1758
- );
1759
- }
1760
- const builtinJsPath = getLocalePath(lang, false);
1761
- const builtinModuleSpecifiers = [];
1762
- if (fs.existsSync(getBuiltinLocalesDir()) && fs.existsSync(builtinJsPath)) {
1763
- builtinModuleSpecifiers.push(pathToFileURL(builtinJsPath).href);
1764
- }
1765
- let lastBuiltinError;
1766
- for (const moduleSpecifier of builtinModuleSpecifiers) {
1767
- const builtinResult = await tryImportTranslations(moduleSpecifier);
1768
- if (builtinResult.translations) {
1769
- translationCache[lang] = builtinResult.translations;
1770
- return builtinResult.translations;
1771
- }
1772
- lastBuiltinError = builtinResult.error;
1773
- }
1774
- const bundledBuiltinResult = await tryImportBundledTranslations(lang);
1775
- if (bundledBuiltinResult.translations) {
1776
- translationCache[lang] = bundledBuiltinResult.translations;
1777
- return bundledBuiltinResult.translations;
1778
- }
1779
- lastBuiltinError = bundledBuiltinResult.error;
1780
- if (lastBuiltinError) {
1781
- writeStderrLine(
1782
- `Failed to load JS translations for ${lang}: ${lastBuiltinError.message}`
1783
- );
1784
- }
1785
- translationCache[lang] = {};
1786
- return {};
1787
- })();
1788
- loadingPromises[lang] = loadPromise;
1789
- loadPromise.finally(() => {
1790
- delete loadingPromises[lang];
1791
- });
1792
- return loadPromise;
1793
- }
1794
- __name(loadTranslationsAsync, "loadTranslationsAsync");
1795
- function interpolate(template, params) {
1796
- if (!params) return template;
1797
- return template.replace(
1798
- /\{\{(\w+)\}\}/g,
1799
- (match, key) => params[key] ?? match
1521
+ function isTerminalGoalStatusKind(kind) {
1522
+ return TERMINAL_GOAL_STATUS_KINDS.includes(
1523
+ kind
1800
1524
  );
1801
1525
  }
1802
- __name(interpolate, "interpolate");
1803
- function resolveLanguage(lang) {
1804
- if (lang === "auto") {
1805
- return detectSystemLanguage();
1806
- }
1807
- return resolveSupportedLanguage(lang) ?? lang;
1808
- }
1809
- __name(resolveLanguage, "resolveLanguage");
1810
- async function setLanguageAsync(lang) {
1811
- currentLanguage = resolveLanguage(lang);
1812
- translations = await loadTranslationsAsync(currentLanguage);
1813
- }
1814
- __name(setLanguageAsync, "setLanguageAsync");
1815
- function getCurrentLanguage() {
1816
- return currentLanguage;
1817
- }
1818
- __name(getCurrentLanguage, "getCurrentLanguage");
1819
- function t(key, params) {
1820
- const translation = translations[key] ?? key;
1821
- if (Array.isArray(translation)) {
1822
- return key;
1823
- }
1824
- return interpolate(translation, params);
1825
- }
1826
- __name(t, "t");
1827
- function ta(key) {
1828
- const translation = translations[key];
1829
- if (Array.isArray(translation)) {
1830
- return translation;
1831
- }
1832
- return [];
1833
- }
1834
- __name(ta, "ta");
1835
- async function initializeI18n(lang) {
1836
- await setLanguageAsync(lang ?? "auto");
1837
- }
1838
- __name(initializeI18n, "initializeI18n");
1526
+ __name(isTerminalGoalStatusKind, "isTerminalGoalStatusKind");
1839
1527
 
1840
1528
  // packages/cli/src/ui/commands/contextCommand.ts
1841
1529
  var DEFAULT_COMPRESSION_THRESHOLD = 0.7;
@@ -2245,17 +1933,7 @@ var contextCommand = {
2245
1933
 
2246
1934
  export {
2247
1935
  require_react,
2248
- SUPPORTED_LANGUAGES,
2249
- resolveSupportedLanguage,
2250
- getLanguageNameFromLocale,
2251
- getLanguageSettingsOptions,
2252
- getSupportedLanguageIds,
2253
- detectSystemLanguage,
2254
- setLanguageAsync,
2255
- getCurrentLanguage,
2256
- t,
2257
- ta,
2258
- initializeI18n,
1936
+ isTerminalGoalStatusKind,
2259
1937
  collectContextData,
2260
1938
  formatContextUsageText,
2261
1939
  contextCommand
@@ -2265,16 +1943,6 @@ export {
2265
1943
  * Copyright 2025 Google LLC
2266
1944
  * SPDX-License-Identifier: Apache-2.0
2267
1945
  */
2268
- /**
2269
- * @license
2270
- * Copyright 2025 Qwen team
2271
- * SPDX-License-Identifier: Apache-2.0
2272
- */
2273
- /**
2274
- * @license
2275
- * Copyright 2026 Qwen Team
2276
- * SPDX-License-Identifier: Apache-2.0
2277
- */
2278
1946
  /**
2279
1947
  * @license
2280
1948
  * Copyright 2025 Qwen
@@ -2,7 +2,7 @@
2
2
  "use strict";
3
3
  import {
4
4
  getGlobalQwenDir
5
- } from "./chunk-YHEAJFCI.js";
5
+ } from "./chunk-USE2VQ5P.js";
6
6
  import {
7
7
  init_esbuild_shims
8
8
  } from "./chunk-A4BMJM77.js";
@@ -5,7 +5,7 @@ import {
5
5
  } from "./chunk-OFEVLU4C.js";
6
6
  import {
7
7
  SchemaValidator
8
- } from "./chunk-FZIUV27X.js";
8
+ } from "./chunk-PVVL5Q3W.js";
9
9
  import {
10
10
  init_esbuild_shims
11
11
  } from "./chunk-A4BMJM77.js";
@@ -20,7 +20,7 @@ function buildDefaultPromptId(purpose) {
20
20
  }
21
21
  __name(buildDefaultPromptId, "buildDefaultPromptId");
22
22
  function resolveDefaultModel(config, override) {
23
- return override ?? config.getFastModelForSideQuery?.() ?? config.getFastModel?.() ?? config.getModel() ?? DEFAULT_QWEN_MODEL;
23
+ return override ?? config.getFastModel?.() ?? config.getModel() ?? DEFAULT_QWEN_MODEL;
24
24
  }
25
25
  __name(resolveDefaultModel, "resolveDefaultModel");
26
26
  function applyThinkingDefault(callerConfig) {
@@ -323,7 +323,7 @@ function buildFetchOptionsWithDispatcher(sdkType, proxyUrl) {
323
323
  }
324
324
  try {
325
325
  const dispatcher = getOrCreateSharedDispatcher(proxyUrl);
326
- return { fetchOptions: { dispatcher } };
326
+ return { fetchOptions: { dispatcher }, fetch: import_undici.fetch };
327
327
  } catch (error) {
328
328
  const hostname = extractHostnameFromProxyUrl(proxyUrl);
329
329
  const failureCount = recordProxyFailure(hostname);
@@ -3,7 +3,7 @@
3
3
  import {
4
4
  TextTokenizer,
5
5
  isSupportedImageMimeType
6
- } from "./chunk-VTPOO6GV.js";
6
+ } from "./chunk-CSWBPY3P.js";
7
7
  import {
8
8
  createDebugLogger
9
9
  } from "./chunk-XP27SJMH.js";
@@ -1202,6 +1202,23 @@ var CredentialsClearRequiredError = class extends Error {
1202
1202
  __name(this, "CredentialsClearRequiredError");
1203
1203
  }
1204
1204
  };
1205
+ var QwenOAuthPollError = class extends Error {
1206
+ static {
1207
+ __name(this, "QwenOAuthPollError");
1208
+ }
1209
+ status;
1210
+ oauthError;
1211
+ description;
1212
+ constructor(opts) {
1213
+ super(
1214
+ `Device token poll failed: ${opts.oauthError ?? "Unknown error"} - ${opts.description ?? "(no description)"}`
1215
+ );
1216
+ this.name = "QwenOAuthPollError";
1217
+ this.oauthError = opts.oauthError;
1218
+ this.description = opts.description;
1219
+ this.status = opts.status;
1220
+ }
1221
+ };
1205
1222
  function isDeviceAuthorizationSuccess(response) {
1206
1223
  return "device_code" in response;
1207
1224
  }
@@ -1245,7 +1262,7 @@ var QwenOAuth2Client = class {
1245
1262
  return { token: void 0 };
1246
1263
  }
1247
1264
  }
1248
- async requestDeviceAuthorization(options) {
1265
+ async requestDeviceAuthorization(options, fetchOpts) {
1249
1266
  const bodyData = {
1250
1267
  client_id: QWEN_OAUTH_CLIENT_ID,
1251
1268
  scope: options.scope,
@@ -1259,7 +1276,13 @@ var QwenOAuth2Client = class {
1259
1276
  Accept: "application/json",
1260
1277
  "x-request-id": randomUUID2()
1261
1278
  },
1262
- body: objectToUrlEncoded(bodyData)
1279
+ body: objectToUrlEncoded(bodyData),
1280
+ // PR #4255 — daemon device-flow registry passes its
1281
+ // `cancelController.signal` so dispose / cancel during a slow
1282
+ // device-authorization request actually aborts the in-flight
1283
+ // socket immediately. Pre-existing CLI callers omit it; the
1284
+ // optional shape preserves backward compatibility.
1285
+ ...fetchOpts?.signal ? { signal: fetchOpts.signal } : {}
1263
1286
  });
1264
1287
  if (!response.ok) {
1265
1288
  const errorData = await response.text();
@@ -1268,7 +1291,18 @@ var QwenOAuth2Client = class {
1268
1291
  );
1269
1292
  }
1270
1293
  const result = await response.json();
1271
- debugLogger2.debug("Device authorization result:", result);
1294
+ if (isDeviceAuthorizationSuccess(result)) {
1295
+ debugLogger2.debug("Device authorization result (sanitized):", {
1296
+ ok: true,
1297
+ expires_in: result.expires_in
1298
+ });
1299
+ } else {
1300
+ const errorData = result;
1301
+ debugLogger2.debug("Device authorization result (sanitized):", {
1302
+ ok: false,
1303
+ error: errorData?.error
1304
+ });
1305
+ }
1272
1306
  if (!isDeviceAuthorizationSuccess(result)) {
1273
1307
  const errorData = result;
1274
1308
  throw new Error(
@@ -1277,7 +1311,7 @@ var QwenOAuth2Client = class {
1277
1311
  }
1278
1312
  return result;
1279
1313
  }
1280
- async pollDeviceToken(options) {
1314
+ async pollDeviceToken(options, fetchOpts) {
1281
1315
  const bodyData = {
1282
1316
  grant_type: QWEN_OAUTH_GRANT_TYPE,
1283
1317
  client_id: QWEN_OAUTH_CLIENT_ID,
@@ -1290,7 +1324,12 @@ var QwenOAuth2Client = class {
1290
1324
  "Content-Type": "application/x-www-form-urlencoded",
1291
1325
  Accept: "application/json"
1292
1326
  },
1293
- body: objectToUrlEncoded(bodyData)
1327
+ body: objectToUrlEncoded(bodyData),
1328
+ // PR #4255 — daemon device-flow registry passes its per-entry
1329
+ // `cancelController.signal` so cancel() / dispose() during a
1330
+ // slow IdP response actually aborts the in-flight socket
1331
+ // instead of waiting for the upstream timeout.
1332
+ ...fetchOpts?.signal ? { signal: fetchOpts.signal } : {}
1294
1333
  });
1295
1334
  if (!response.ok) {
1296
1335
  const responseText = await response.text();
@@ -1298,11 +1337,11 @@ var QwenOAuth2Client = class {
1298
1337
  try {
1299
1338
  errorData = JSON.parse(responseText);
1300
1339
  } catch (_parseError) {
1301
- const error2 = new Error(
1340
+ const error = new Error(
1302
1341
  `Device token poll failed: ${response.status} ${response.statusText}. Response: ${responseText}`
1303
1342
  );
1304
- error2.status = response.status;
1305
- throw error2;
1343
+ error.status = response.status;
1344
+ throw error;
1306
1345
  }
1307
1346
  if (response.status === 400 && errorData.error === "authorization_pending") {
1308
1347
  return { status: "pending" };
@@ -1313,11 +1352,11 @@ var QwenOAuth2Client = class {
1313
1352
  slowDown: true
1314
1353
  };
1315
1354
  }
1316
- const error = new Error(
1317
- `Device token poll failed: ${errorData.error || "Unknown error"} - ${errorData.error_description}`
1318
- );
1319
- error.status = response.status;
1320
- throw error;
1355
+ throw new QwenOAuthPollError({
1356
+ oauthError: errorData.error,
1357
+ description: errorData.error_description,
1358
+ status: response.status
1359
+ });
1321
1360
  }
1322
1361
  return await response.json();
1323
1362
  }
@@ -1608,10 +1647,6 @@ async function authWithQwenDeviceFlow(client, config) {
1608
1647
  };
1609
1648
  client.setCredentials(credentials);
1610
1649
  await cacheQwenCredentials(credentials);
1611
- try {
1612
- SharedTokenManager.getInstance().clearCache();
1613
- } catch {
1614
- }
1615
1650
  emitAuthProgress(
1616
1651
  "success",
1617
1652
  "Authentication successful! Access token obtained."
@@ -1712,12 +1747,45 @@ Server requested to slow down, increasing poll interval to ${pollInterval}ms'`
1712
1747
  }
1713
1748
  }
1714
1749
  __name(authWithQwenDeviceFlow, "authWithQwenDeviceFlow");
1715
- async function cacheQwenCredentials(credentials) {
1750
+ var QWEN_CREDENTIAL_FILE_MODE = 384;
1751
+ async function cacheQwenCredentials(credentials, opts) {
1716
1752
  const filePath = getQwenCachedCredentialPath();
1717
1753
  try {
1718
1754
  await fs7.mkdir(path3.dirname(filePath), { recursive: true });
1719
1755
  const credString = JSON.stringify(credentials, null, 2);
1720
- await fs7.writeFile(filePath, credString);
1756
+ const tempPath = `${filePath}.tmp.${process.pid}.${randomUUID2()}`;
1757
+ try {
1758
+ await fs7.writeFile(tempPath, credString, {
1759
+ mode: QWEN_CREDENTIAL_FILE_MODE,
1760
+ ...opts?.signal ? { signal: opts.signal } : {}
1761
+ });
1762
+ try {
1763
+ await fs7.chmod(tempPath, QWEN_CREDENTIAL_FILE_MODE);
1764
+ } catch (chmodErr) {
1765
+ if (process.platform !== "win32") {
1766
+ throw new Error(
1767
+ `cacheQwenCredentials: refusing to publish credentials \u2014 chmod 0o${QWEN_CREDENTIAL_FILE_MODE.toString(8)} on temp file failed: ${chmodErr instanceof Error ? chmodErr.message : String(chmodErr)}`
1768
+ );
1769
+ }
1770
+ debugLogger2.warn(
1771
+ `cacheQwenCredentials: chmod 0o${QWEN_CREDENTIAL_FILE_MODE.toString(8)} on Windows temp file ${tempPath} failed; relying on NTFS ACL: ${chmodErr instanceof Error ? chmodErr.message : String(chmodErr)}`
1772
+ );
1773
+ }
1774
+ await fs7.rename(tempPath, filePath);
1775
+ } catch (writeErr) {
1776
+ try {
1777
+ await fs7.unlink(tempPath);
1778
+ } catch {
1779
+ }
1780
+ throw writeErr;
1781
+ }
1782
+ try {
1783
+ SharedTokenManager.getInstance().clearCache();
1784
+ } catch (clearErr) {
1785
+ debugLogger2.warn(
1786
+ `cacheQwenCredentials: SharedTokenManager.clearCache failed; in-process callers may serve stale credentials until the next mtime poll: ${clearErr instanceof Error ? clearErr.message : String(clearErr)}`
1787
+ );
1788
+ }
1721
1789
  } catch (error) {
1722
1790
  const errorMessage = error instanceof Error ? error.message : String(error);
1723
1791
  const errorCode = error instanceof Error && "code" in error ? error.code : void 0;
@@ -1766,6 +1834,7 @@ export {
1766
1834
  generateCodeChallenge,
1767
1835
  generatePKCEPair,
1768
1836
  CredentialsClearRequiredError,
1837
+ QwenOAuthPollError,
1769
1838
  isDeviceAuthorizationSuccess,
1770
1839
  isDeviceTokenSuccess,
1771
1840
  isDeviceTokenPending,
@@ -1774,6 +1843,8 @@ export {
1774
1843
  QwenOAuth2Event,
1775
1844
  qwenOAuth2Events,
1776
1845
  getQwenOAuthClient,
1846
+ QWEN_CREDENTIAL_FILE_MODE,
1847
+ cacheQwenCredentials,
1777
1848
  clearQwenCredentials,
1778
1849
  clearCachedCredentialFile
1779
1850
  };