@qwen-code/qwen-code 0.15.12-preview.3 → 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 (94) hide show
  1. package/bundled/qc-helper/docs/configuration/settings.md +59 -61
  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 +134 -10
  10. package/bundled/review/SKILL.md +12 -3
  11. package/chunks/{agent-LIAWUWAO.js → agent-K6OWOMBN.js} +15 -17
  12. package/chunks/{anthropicContentGenerator-4QE6LTVV.js → anthropicContentGenerator-RQJNXJIY.js} +7 -4
  13. package/chunks/{askUserQuestion-QFSCBTUO.js → askUserQuestion-PQPMPNM3.js} +2 -2
  14. package/chunks/{ca-S3XJMT6P.js → ca-UZ7BANMN.js} +3 -3
  15. package/chunks/{chunk-AJSOD5IR.js → chunk-3T4ZT63H.js} +8833 -3600
  16. package/chunks/{chunk-B7ZL7HUA.js → chunk-4AOCVI6J.js} +2 -1
  17. package/chunks/{chunk-AOJ3BBY7.js → chunk-4J63U5QO.js} +17 -349
  18. package/chunks/{chunk-AEJ2DKLP.js → chunk-C6WMLUNB.js} +1 -1
  19. package/chunks/{chunk-JMZQICAL.js → chunk-CAVZVZX6.js} +2 -2
  20. package/chunks/{chunk-CAWKL3UC.js → chunk-CSWBPY3P.js} +2 -2
  21. package/chunks/{chunk-G27O2LD2.js → chunk-D5NTAHYL.js} +1 -1
  22. package/chunks/{chunk-BXNCPI75.js → chunk-DMIMF3CG.js} +2 -2
  23. package/chunks/{chunk-OCC4MZRS.js → chunk-F23NCRJ2.js} +1 -1
  24. package/chunks/{chunk-5QQ5FGTU.js → chunk-G7YTSRES.js} +1 -1
  25. package/chunks/{chunk-SQNQIOD5.js → chunk-GGNTZ2NH.js} +92 -21
  26. package/chunks/{chunk-FKVKVE6N.js → chunk-KXZ4TJB4.js} +1 -1
  27. package/chunks/chunk-L34E6AGL.js +19126 -0
  28. package/chunks/{chunk-CBVB66WY.js → chunk-L5E26RN6.js} +2 -2
  29. package/chunks/{chunk-UXW7MYAW.js → chunk-MAY32HXD.js} +376 -1
  30. package/chunks/{chunk-GC5RXNL2.js → chunk-NOAHME6A.js} +115 -23
  31. package/chunks/{chunk-CM2IESUE.js → chunk-PR4T27R7.js} +1 -1
  32. package/chunks/{chunk-FYMSCRHM.js → chunk-PVVL5Q3W.js} +32 -1
  33. package/chunks/{chunk-YHEAJFCI.js → chunk-USE2VQ5P.js} +3 -0
  34. package/chunks/chunk-VMOAQVBP.js +379 -0
  35. package/chunks/{chunk-XLQ4E5PS.js → chunk-WCZWAKFG.js} +795 -142
  36. package/chunks/{chunk-GJXIKCKL.js → chunk-XP27SJMH.js} +76 -5
  37. package/chunks/{chunk-TPGOGCWM.js → chunk-YJLGXDQJ.js} +1 -1
  38. package/chunks/{contextCommand-SVLAZMQL.js → contextCommand-7CPNXBLO.js} +17 -19
  39. package/chunks/{cron-create-WUTD5ZTH.js → cron-create-IGYXQVG4.js} +28 -2
  40. package/chunks/{cron-delete-N3UQYCRA.js → cron-delete-ETKIZCWT.js} +2 -2
  41. package/chunks/{cron-list-Z6RJJ4YH.js → cron-list-BVCUSWRU.js} +2 -2
  42. package/chunks/{de-MNR4SMAI.js → de-V4IE2OOZ.js} +3 -3
  43. package/chunks/{dist-RRYNPBOE.js → dist-4L54HRX2.js} +2 -2
  44. package/chunks/{dist-WP4AH3VK.js → dist-BXDUQ2QY.js} +1 -1
  45. package/chunks/{dist-M6GFCZ7S.js → dist-MN2PDDPR.js} +1 -1
  46. package/chunks/{edit-VNAZBIZR.js → edit-CBM5NDVK.js} +28 -18
  47. package/chunks/{en-NRN4QBAT.js → en-HGJ2SPLM.js} +5 -3
  48. package/chunks/{enter-worktree-FOF5YZIV.js → enter-worktree-XABKPLO6.js} +41 -17
  49. package/chunks/{exit-worktree-Y6QVAO3C.js → exit-worktree-56MN2PCL.js} +41 -17
  50. package/chunks/{exitPlanMode-QZKO7GH7.js → exitPlanMode-YDNPCSCJ.js} +15 -17
  51. package/chunks/{fr-OFJFHLCR.js → fr-CJULI7ZX.js} +3 -3
  52. package/chunks/{geminiContentGenerator-DYHZPKJX.js → geminiContentGenerator-ZGPNBFDS.js} +3 -3
  53. package/chunks/{glob-G7XATELV.js → glob-ZHA35VO5.js} +15 -17
  54. package/chunks/{grep-4SETMY47.js → grep-RV6V6T52.js} +15 -17
  55. package/chunks/{ja-V6OQ6VL7.js → ja-L7CHRQEW.js} +3 -3
  56. package/chunks/{keychain-token-storage-DMFP5IJM.js → keychain-token-storage-335UOLJ6.js} +2 -2
  57. package/chunks/{ls-SUILOZZB.js → ls-7HD6XG3V.js} +3 -3
  58. package/chunks/{lsp-6TQBWVMZ.js → lsp-ZZSFCIWD.js} +2 -2
  59. package/chunks/{monitor-JTLJBJ7H.js → monitor-5G2OBGE5.js} +27 -17
  60. package/chunks/notebook-edit-XUBTCT6L.js +756 -0
  61. package/chunks/{openaiContentGenerator-3H7XOZBW.js → openaiContentGenerator-POYAZQ6I.js} +12 -11
  62. package/chunks/{pt-ZLE6SA4A.js → pt-M6JULLEQ.js} +3 -3
  63. package/chunks/{qwenContentGenerator-FAU3QPYO.js → qwenContentGenerator-2E4H56DK.js} +17 -19
  64. package/chunks/{qwenOAuth2-JSQ7EPR3.js → qwenOAuth2-EEJGROP7.js} +9 -3
  65. package/chunks/{read-file-WWUQVNCZ.js → read-file-3JIOOXFT.js} +7 -8
  66. package/chunks/{ripGrep-WCOAIWL6.js → ripGrep-LEI3L6PM.js} +15 -17
  67. package/chunks/{ru-A4OHIUNN.js → ru-QILM4HBC.js} +3 -3
  68. package/chunks/{send-message-Q2JRAC3J.js → send-message-ULK4MQXJ.js} +23 -2
  69. package/chunks/{serve-VJEEEXA6.js → serve-CFVRMD4W.js} +8500 -1663
  70. package/chunks/{shell-IAOKGIJ6.js → shell-3B5DZ437.js} +15 -17
  71. package/chunks/{skill-NHW6222K.js → skill-STSZUBXR.js} +23 -10
  72. package/chunks/{src-OWV5HVQQ.js → src-ROFXAPEP.js} +211 -19
  73. package/chunks/{syntheticOutput-S4DRGMQM.js → syntheticOutput-IS2X5OZ2.js} +3 -3
  74. package/chunks/{task-stop-7THHVAQS.js → task-stop-7QSJGSSP.js} +2 -2
  75. package/chunks/{todoWrite-WKUGUTPX.js → todoWrite-7CVACFUX.js} +3 -3
  76. package/chunks/{tool-search-MSJ6SXLI.js → tool-search-ARWOD3GD.js} +7 -8
  77. package/chunks/{web-fetch-OZE6ZQUF.js → web-fetch-ENQ2I5JA.js} +7 -4
  78. package/chunks/{write-file-RKCENFZ5.js → write-file-6MRT7TEW.js} +25 -18
  79. package/chunks/{zh-RN3JULHO.js → zh-PWL2NKY3.js} +5 -3
  80. package/chunks/{zh-TW-XZEHEV5S.js → zh-TW-S3YGWICZ.js} +5 -3
  81. package/cli.js +58070 -75930
  82. package/locales/ca.js +4 -5
  83. package/locales/de.js +4 -5
  84. package/locales/en.js +8 -5
  85. package/locales/fr.js +4 -5
  86. package/locales/ja.js +4 -5
  87. package/locales/pt.js +4 -5
  88. package/locales/ru.js +4 -5
  89. package/locales/zh-TW.js +6 -4
  90. package/locales/zh.js +6 -4
  91. package/package.json +2 -2
  92. package/chunks/chunk-5P5XGNYH.js +0 -93
  93. package/chunks/chunk-SYCJMSIJ.js +0 -82
  94. package/chunks/chunk-Y6Z2O3WR.js +0 -33
@@ -2,11 +2,11 @@
2
2
  "use strict";
3
3
  import {
4
4
  formatFetchErrorForUser
5
- } from "./chunk-FKVKVE6N.js";
5
+ } from "./chunk-KXZ4TJB4.js";
6
6
  import {
7
7
  Storage,
8
8
  createDebugLogger
9
- } from "./chunk-GJXIKCKL.js";
9
+ } from "./chunk-XP27SJMH.js";
10
10
  import {
11
11
  init_esbuild_shims
12
12
  } from "./chunk-A4BMJM77.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
  };
@@ -3,7 +3,7 @@
3
3
  import {
4
4
  getErrorMessage,
5
5
  isNodeError
6
- } from "./chunk-GJXIKCKL.js";
6
+ } from "./chunk-XP27SJMH.js";
7
7
  import {
8
8
  init_esbuild_shims
9
9
  } from "./chunk-A4BMJM77.js";