@qwen-code/qwen-code 0.18.0 → 0.18.1

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 (111) hide show
  1. package/bundled/loop/SKILL.md +2 -1
  2. package/bundled/qc-helper/docs/configuration/auth.md +1 -1
  3. package/bundled/qc-helper/docs/configuration/model-providers.md +12 -5
  4. package/bundled/qc-helper/docs/configuration/settings.md +30 -27
  5. package/bundled/qc-helper/docs/features/dual-output.md +37 -3
  6. package/bundled/qc-helper/docs/features/skills.md +29 -3
  7. package/bundled/qc-helper/docs/features/sub-agents.md +2 -1
  8. package/bundled/qc-helper/docs/qwen-serve.md +26 -18
  9. package/chunks/{agent-LOTJK6AH.js → agent-XT7NHZ5H.js} +21 -20
  10. package/chunks/{agent-headless-TU3EPMYU.js → agent-headless-LNRE63ZL.js} +21 -20
  11. package/chunks/{anthropicContentGenerator-2HBRNQ3B.js → anthropicContentGenerator-DCI26OQF.js} +4 -4
  12. package/chunks/{askUserQuestion-OGCMIBQM.js → askUserQuestion-ITYUTWLR.js} +2 -2
  13. package/chunks/{ca-BARBRL6N.js → ca-RK4QPLIX.js} +18 -1
  14. package/chunks/{chunk-ZTZ4DDQE.js → chunk-3NRO6NHX.js} +2 -2
  15. package/chunks/{chunk-IWAYOW5Q.js → chunk-6T7Y7USE.js} +6566 -4195
  16. package/chunks/{chunk-MFBBBTNY.js → chunk-7KPZFE5A.js} +1 -1
  17. package/chunks/{chunk-XV4HCEVI.js → chunk-A2ZIEEGJ.js} +9 -22
  18. package/chunks/{chunk-A7B4ISQP.js → chunk-B4ZF2KSI.js} +1 -1
  19. package/chunks/chunk-BJ5HQ23U.js +178 -0
  20. package/chunks/{chunk-LBP46COL.js → chunk-BXYRCW2C.js} +83 -15
  21. package/chunks/{chunk-OHEGWO4L.js → chunk-CPVI5J2L.js} +1 -1
  22. package/chunks/{chunk-R7ODSGTK.js → chunk-DHZREJTG.js} +2 -2
  23. package/chunks/{chunk-SEGYWKIH.js → chunk-FIQECJTQ.js} +1 -1
  24. package/chunks/{chunk-HR7SV7AY.js → chunk-HA2UEYZP.js} +6 -2
  25. package/chunks/{chunk-JTQAQBTV.js → chunk-HED55F43.js} +5 -1
  26. package/chunks/{chunk-HLPLOD42.js → chunk-HQUWWSSP.js} +1 -1
  27. package/chunks/{chunk-2Y5SYSD3.js → chunk-IDYDPBBN.js} +3 -3
  28. package/chunks/{chunk-3HTIVKZE.js → chunk-IQHSD7K5.js} +1 -1
  29. package/chunks/{chunk-LEJ42GNY.js → chunk-IS7UA4W3.js} +6 -6
  30. package/chunks/{chunk-B7HXHOHU.js → chunk-LXYWINWF.js} +1 -1
  31. package/chunks/{chunk-IDX6COTE.js → chunk-LYRSMKLS.js} +2 -2
  32. package/chunks/{chunk-M6VTDSVR.js → chunk-LYSND7KR.js} +9 -4
  33. package/chunks/{chunk-EYENRK4D.js → chunk-NNIYWQIS.js} +1 -1
  34. package/chunks/chunk-OMX7CUOE.js +356 -0
  35. package/chunks/{chunk-BIVG75CP.js → chunk-QILTEBWS.js} +1 -1
  36. package/chunks/{chunk-6YIUGZTC.js → chunk-RON7LFNH.js} +281 -132
  37. package/chunks/{chunk-3DHXZ6EV.js → chunk-SFRV6BGY.js} +6 -4
  38. package/chunks/{chunk-7BCMOPIM.js → chunk-WJ3SND6W.js} +31 -12
  39. package/chunks/{chunk-J5MDQKJL.js → chunk-WPTCDQN6.js} +2 -347
  40. package/chunks/{chunk-PL3MVCWD.js → chunk-XZTNBSMW.js} +11 -11
  41. package/chunks/{chunk-72LDN5PP.js → chunk-Y7KMDUEP.js} +1 -1
  42. package/chunks/{chunk-SNGELLWX.js → chunk-ZMIBJS45.js} +1 -1
  43. package/chunks/{chunk-XBY7E2FX.js → chunk-ZOFNJQNJ.js} +6 -4
  44. package/chunks/computer-use-4YX3JGBV.js +2052 -0
  45. package/chunks/{contextCommand-K347QT6O.js → contextCommand-KS2H7MW5.js} +23 -22
  46. package/chunks/cron-create-CAPUKK7I.js +184 -0
  47. package/chunks/{cron-delete-WKWSJZQA.js → cron-delete-G3KAR26Q.js} +27 -4
  48. package/chunks/{cron-list-B52XEXAZ.js → cron-list-ZA4ZIUS5.js} +39 -6
  49. package/chunks/{de-YGKK2BC4.js → de-FGPM4KW5.js} +18 -1
  50. package/chunks/{dist-KAZ3SEBX.js → dist-7YWFWOCJ.js} +1 -1
  51. package/chunks/{dist-4LXD6L6X.js → dist-VEGFONCF.js} +2 -2
  52. package/chunks/{dist-H6ONXVLG.js → dist-X4EXN7W6.js} +1 -1
  53. package/chunks/{dist-PK7DFCAW.js → dist-YLS6NI7H.js} +1 -1
  54. package/chunks/{edit-KU4PJGEX.js → edit-2ARPEO4B.js} +22 -21
  55. package/chunks/{en-DHGYHIHX.js → en-VP6XPGEC.js} +5 -2
  56. package/chunks/{enter-worktree-PPYIDCWI.js → enter-worktree-IXNXNAW5.js} +21 -20
  57. package/chunks/{enterPlanMode-5CZDMCB4.js → enterPlanMode-TAKAGAYP.js} +21 -20
  58. package/chunks/{exit-worktree-UY3CGHKC.js → exit-worktree-LHTRV7ML.js} +21 -20
  59. package/chunks/{exitPlanMode-3DN4QNSG.js → exitPlanMode-MK5UAITL.js} +71 -31
  60. package/chunks/{fr-JXBKPJKQ.js → fr-ATYBVCLT.js} +18 -1
  61. package/chunks/{geminiContentGenerator-7A6I2RWB.js → geminiContentGenerator-HFJIGO77.js} +4 -4
  62. package/chunks/{glob-OFNQSS52.js → glob-I2USLUSC.js} +21 -20
  63. package/chunks/{grep-6J2MSUM5.js → grep-WBIF7THR.js} +30 -26
  64. package/chunks/{ja-TGPZSP2B.js → ja-W2QEA2OI.js} +18 -1
  65. package/chunks/{keychain-token-storage-6IU6ORQN.js → keychain-token-storage-QSTRHKKL.js} +2 -2
  66. package/chunks/{ls-V3O6A5PT.js → ls-2R5RHLX5.js} +3 -3
  67. package/chunks/{lsp-G2OCIFUA.js → lsp-XKH6ZIAN.js} +2 -2
  68. package/chunks/{monitor-FKLHV423.js → monitor-WU7UFATU.js} +21 -20
  69. package/chunks/{notebook-edit-KTBYFKWG.js → notebook-edit-KUHYPXEM.js} +22 -21
  70. package/chunks/{openaiContentGenerator-L5KSWQY7.js → openaiContentGenerator-5PLHYJQL.js} +11 -11
  71. package/chunks/{pt-TIBG6BIO.js → pt-ZKEWJFBW.js} +18 -1
  72. package/chunks/{qwenContentGenerator-PYOXLMBW.js → qwenContentGenerator-TSKW73KY.js} +23 -22
  73. package/chunks/{qwenOAuth2-2KCKWDCF.js → qwenOAuth2-KK433U33.js} +4 -4
  74. package/chunks/{read-file-JQVRK4NU.js → read-file-VIPF2PS6.js} +8 -8
  75. package/chunks/{ripGrep-2L4LPNAJ.js → ripGrep-XLIZTYE7.js} +21 -20
  76. package/chunks/{ru-JBCHCK4L.js → ru-VEKTPJ74.js} +18 -1
  77. package/chunks/{scheduler-FGNXY4JQ.js → scheduler-O66SLJGU.js} +21 -20
  78. package/chunks/{send-message-SZFWNOCL.js → send-message-CTME7DXD.js} +2 -2
  79. package/chunks/{serve-N2IBLA3G.js → serve-BWOLYT62.js} +998 -278
  80. package/chunks/{shell-PTEG6UX4.js → shell-XE7UYKOO.js} +21 -20
  81. package/chunks/{skill-X4NTK4NH.js → skill-RZWM6XMC.js} +10 -10
  82. package/chunks/{src-GLLQ3R5W.js → src-L5P7K4MH.js} +42 -26
  83. package/chunks/{syntheticOutput-IKAY5F6X.js → syntheticOutput-ZJGSU7OQ.js} +3 -3
  84. package/chunks/{task-create-MQICOJFV.js → task-create-EE6JEM7G.js} +7 -6
  85. package/chunks/{task-list-RIHJCH32.js → task-list-EESYAC65.js} +6 -5
  86. package/chunks/{task-stop-FWZRFANS.js → task-stop-XZVCFFYY.js} +2 -2
  87. package/chunks/{task-update-2LHPXOYM.js → task-update-EIO4HNE3.js} +7 -6
  88. package/chunks/{team-create-2E4PF4KN.js → team-create-R2H7Y3SG.js} +21 -20
  89. package/chunks/{team-delete-DAUDQS4J.js → team-delete-A7LXPGV7.js} +6 -5
  90. package/chunks/{todoWrite-HTUACZES.js → todoWrite-VRKSGAWM.js} +4 -4
  91. package/chunks/{tool-search-KTVULRES.js → tool-search-USSQMTMS.js} +8 -8
  92. package/chunks/{web-fetch-CZ7LLKPE.js → web-fetch-GHAZUA54.js} +4 -4
  93. package/chunks/{workflow-L2ZUUDT2.js → workflow-5LNNLNUR.js} +503 -49
  94. package/chunks/{write-file-ZEB2JDYH.js → write-file-2I7HP24C.js} +22 -21
  95. package/chunks/{zh-7H5OQC4I.js → zh-OIXDDQHB.js} +5 -2
  96. package/chunks/{zh-TW-P4IDHD3M.js → zh-TW-6YFNCKTA.js} +5 -2
  97. package/cli-entry.js +19 -0
  98. package/cli.js +6547 -4938
  99. package/locales/ca.js +20 -2
  100. package/locales/de.js +21 -2
  101. package/locales/en.js +7 -4
  102. package/locales/fr.js +22 -2
  103. package/locales/ja.js +22 -2
  104. package/locales/pt.js +21 -2
  105. package/locales/ru.js +20 -2
  106. package/locales/zh-TW.js +6 -4
  107. package/locales/zh.js +6 -4
  108. package/package.json +4 -3
  109. package/chunks/chunk-SKBPNJEW.js +0 -45
  110. package/chunks/computer-use-3RH2DOM6.js +0 -825
  111. package/chunks/cron-create-YJL3KFWI.js +0 -140
@@ -1,17 +1,19 @@
1
1
  // Force strict mode and setup for ESM
2
2
  "use strict";
3
3
  import {
4
- Mutex,
5
4
  getInboxesDir,
6
5
  require_proper_lockfile
7
- } from "./chunk-J5MDQKJL.js";
6
+ } from "./chunk-WPTCDQN6.js";
7
+ import {
8
+ Mutex
9
+ } from "./chunk-OMX7CUOE.js";
8
10
  import {
9
11
  atomicWriteJSON
10
- } from "./chunk-B7HXHOHU.js";
12
+ } from "./chunk-LXYWINWF.js";
11
13
  import {
12
14
  createDebugLogger,
13
15
  isNodeError
14
- } from "./chunk-HR7SV7AY.js";
16
+ } from "./chunk-HA2UEYZP.js";
15
17
  import {
16
18
  init_esbuild_shims
17
19
  } from "./chunk-A4BMJM77.js";
@@ -2,19 +2,19 @@
2
2
  "use strict";
3
3
  import {
4
4
  RequestTokenizer
5
- } from "./chunk-ZTZ4DDQE.js";
5
+ } from "./chunk-3NRO6NHX.js";
6
6
  import {
7
7
  OpenAIContentConverter,
8
8
  TaggedThinkingParser,
9
9
  openaiRequestCaptureContext
10
- } from "./chunk-6YIUGZTC.js";
10
+ } from "./chunk-RON7LFNH.js";
11
11
  import {
12
12
  createChildAbortController
13
13
  } from "./chunk-64WXLC72.js";
14
14
  import {
15
15
  buildRuntimeFetchOptions,
16
16
  redactProxyError
17
- } from "./chunk-EYENRK4D.js";
17
+ } from "./chunk-NNIYWQIS.js";
18
18
  import {
19
19
  CAPPED_DEFAULT_MAX_TOKENS,
20
20
  DASHSCOPE_PROXY_BASE_URL,
@@ -25,14 +25,14 @@ import {
25
25
  runtimeDiagnostics,
26
26
  safeJsonParse,
27
27
  tokenLimit
28
- } from "./chunk-M6VTDSVR.js";
28
+ } from "./chunk-LYSND7KR.js";
29
29
  import {
30
30
  GenerateContentResponse
31
31
  } from "./chunk-55ZMG67I.js";
32
32
  import {
33
33
  createDebugLogger,
34
34
  isAbortError
35
- } from "./chunk-HR7SV7AY.js";
35
+ } from "./chunk-HA2UEYZP.js";
36
36
  import {
37
37
  init_esbuild_shims
38
38
  } from "./chunk-A4BMJM77.js";
@@ -7608,6 +7608,7 @@ init_esbuild_shims();
7608
7608
 
7609
7609
  // packages/core/src/core/openaiContentGenerator/streamingToolCallParser.ts
7610
7610
  init_esbuild_shims();
7611
+ var debugLogger2 = createDebugLogger("STREAMING_TOOL_CALL_PARSER");
7611
7612
  var StreamingToolCallParser = class {
7612
7613
  static {
7613
7614
  __name(this, "StreamingToolCallParser");
@@ -7644,6 +7645,7 @@ var StreamingToolCallParser = class {
7644
7645
  */
7645
7646
  addChunk(index, chunk, id, name) {
7646
7647
  let actualIndex = index;
7648
+ const isKnownId = Boolean(id && this.idToIndexMap.has(id));
7647
7649
  if (id) {
7648
7650
  if (this.idToIndexMap.has(id)) {
7649
7651
  actualIndex = this.idToIndexMap.get(id);
@@ -7685,11 +7687,21 @@ var StreamingToolCallParser = class {
7685
7687
  this.escapes.set(actualIndex, false);
7686
7688
  this.toolCallMeta.set(actualIndex, {});
7687
7689
  }
7690
+ const currentBuffer = this.buffers.get(actualIndex);
7691
+ const currentDepth = this.depths.get(actualIndex);
7692
+ if (isKnownId && currentBuffer.trim() && currentDepth === 0) {
7693
+ try {
7694
+ JSON.parse(currentBuffer);
7695
+ debugLogger2.debug(
7696
+ `Ignoring replay chunk for completed toolCall id=${id}`
7697
+ );
7698
+ return { complete: false };
7699
+ } catch {
7700
+ }
7701
+ }
7688
7702
  const meta = this.toolCallMeta.get(actualIndex);
7689
7703
  if (id) meta.id = id;
7690
7704
  if (name) meta.name = name;
7691
- const currentBuffer = this.buffers.get(actualIndex);
7692
- const currentDepth = this.depths.get(actualIndex);
7693
7705
  const currentInString = this.inStrings.get(actualIndex);
7694
7706
  const currentEscape = this.escapes.get(actualIndex);
7695
7707
  const newBuffer = currentBuffer + chunk;
@@ -7758,9 +7770,16 @@ var StreamingToolCallParser = class {
7758
7770
  */
7759
7771
  getCompletedToolCalls() {
7760
7772
  const completed = [];
7773
+ const emittedIds = /* @__PURE__ */ new Set();
7761
7774
  for (const [index, buffer] of this.buffers.entries()) {
7762
7775
  const meta = this.toolCallMeta.get(index);
7763
7776
  if (meta?.name && buffer.trim()) {
7777
+ if (meta.id) {
7778
+ if (emittedIds.has(meta.id)) {
7779
+ continue;
7780
+ }
7781
+ emittedIds.add(meta.id);
7782
+ }
7764
7783
  let args = {};
7765
7784
  try {
7766
7785
  args = JSON.parse(buffer);
@@ -8269,7 +8288,7 @@ var ContentGenerationPipeline = class {
8269
8288
 
8270
8289
  // packages/core/src/core/openaiContentGenerator/errorHandler.ts
8271
8290
  init_esbuild_shims();
8272
- var debugLogger2 = createDebugLogger("OPENAI_ERROR");
8291
+ var debugLogger3 = createDebugLogger("OPENAI_ERROR");
8273
8292
  var EnhancedErrorHandler = class {
8274
8293
  constructor(shouldSuppressLogging = () => false) {
8275
8294
  this.shouldSuppressLogging = shouldSuppressLogging;
@@ -8286,7 +8305,7 @@ var EnhancedErrorHandler = class {
8286
8305
  isTimeoutError
8287
8306
  );
8288
8307
  if (!this.shouldSuppressErrorLogging(redactedError, request)) {
8289
- debugLogger2.error("OpenAI API Error:", errorMessage);
8308
+ debugLogger3.error("OpenAI API Error:", errorMessage);
8290
8309
  }
8291
8310
  if (isTimeoutError) {
8292
8311
  throw new Error(
@@ -8326,7 +8345,7 @@ ${tips.join("\n")}`;
8326
8345
  };
8327
8346
 
8328
8347
  // packages/core/src/core/openaiContentGenerator/openaiContentGenerator.ts
8329
- var debugLogger3 = createDebugLogger("OPENAI");
8348
+ var debugLogger4 = createDebugLogger("OPENAI");
8330
8349
  var OpenAIContentGenerator = class {
8331
8350
  static {
8332
8351
  __name(this, "OpenAIContentGenerator");
@@ -8369,7 +8388,7 @@ var OpenAIContentGenerator = class {
8369
8388
  totalTokens: result.totalTokens
8370
8389
  };
8371
8390
  } catch (error) {
8372
- debugLogger3.warn(
8391
+ debugLogger4.warn(
8373
8392
  "Failed to calculate tokens with new tokenizer, falling back to simple method:",
8374
8393
  error
8375
8394
  );
@@ -8416,7 +8435,7 @@ var OpenAIContentGenerator = class {
8416
8435
  };
8417
8436
  } catch (error) {
8418
8437
  const redactedError = redactProxyError(error);
8419
- debugLogger3.error("OpenAI API Embedding Error:", redactedError);
8438
+ debugLogger4.error("OpenAI API Embedding Error:", redactedError);
8420
8439
  throw new Error(
8421
8440
  `OpenAI API error: ${redactedError instanceof Error ? redactedError.message : String(redactedError)}`
8422
8441
  );
@@ -10,11 +10,11 @@ import {
10
10
  } from "./chunk-LD2XBG6Z.js";
11
11
  import {
12
12
  atomicWriteJSON
13
- } from "./chunk-B7HXHOHU.js";
13
+ } from "./chunk-LXYWINWF.js";
14
14
  import {
15
15
  Storage,
16
16
  isNodeError
17
- } from "./chunk-HR7SV7AY.js";
17
+ } from "./chunk-HA2UEYZP.js";
18
18
  import {
19
19
  init_esbuild_shims
20
20
  } from "./chunk-A4BMJM77.js";
@@ -1854,352 +1854,7 @@ async function listTeamNames() {
1854
1854
  }
1855
1855
  __name(listTeamNames, "listTeamNames");
1856
1856
 
1857
- // node_modules/async-mutex/index.mjs
1858
- init_esbuild_shims();
1859
- var E_TIMEOUT = new Error("timeout while waiting for mutex to become available");
1860
- var E_ALREADY_LOCKED = new Error("mutex already locked");
1861
- var E_CANCELED = new Error("request for lock canceled");
1862
- var __awaiter$2 = function(thisArg, _arguments, P, generator) {
1863
- function adopt(value) {
1864
- return value instanceof P ? value : new P(function(resolve) {
1865
- resolve(value);
1866
- });
1867
- }
1868
- __name(adopt, "adopt");
1869
- return new (P || (P = Promise))(function(resolve, reject) {
1870
- function fulfilled(value) {
1871
- try {
1872
- step(generator.next(value));
1873
- } catch (e) {
1874
- reject(e);
1875
- }
1876
- }
1877
- __name(fulfilled, "fulfilled");
1878
- function rejected(value) {
1879
- try {
1880
- step(generator["throw"](value));
1881
- } catch (e) {
1882
- reject(e);
1883
- }
1884
- }
1885
- __name(rejected, "rejected");
1886
- function step(result) {
1887
- result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
1888
- }
1889
- __name(step, "step");
1890
- step((generator = generator.apply(thisArg, _arguments || [])).next());
1891
- });
1892
- };
1893
- var Semaphore = class {
1894
- static {
1895
- __name(this, "Semaphore");
1896
- }
1897
- constructor(_value, _cancelError = E_CANCELED) {
1898
- this._value = _value;
1899
- this._cancelError = _cancelError;
1900
- this._queue = [];
1901
- this._weightedWaiters = [];
1902
- }
1903
- acquire(weight = 1, priority = 0) {
1904
- if (weight <= 0)
1905
- throw new Error(`invalid weight ${weight}: must be positive`);
1906
- return new Promise((resolve, reject) => {
1907
- const task = { resolve, reject, weight, priority };
1908
- const i = findIndexFromEnd(this._queue, (other) => priority <= other.priority);
1909
- if (i === -1 && weight <= this._value) {
1910
- this._dispatchItem(task);
1911
- } else {
1912
- this._queue.splice(i + 1, 0, task);
1913
- }
1914
- });
1915
- }
1916
- runExclusive(callback_1) {
1917
- return __awaiter$2(this, arguments, void 0, function* (callback, weight = 1, priority = 0) {
1918
- const [value, release] = yield this.acquire(weight, priority);
1919
- try {
1920
- return yield callback(value);
1921
- } finally {
1922
- release();
1923
- }
1924
- });
1925
- }
1926
- waitForUnlock(weight = 1, priority = 0) {
1927
- if (weight <= 0)
1928
- throw new Error(`invalid weight ${weight}: must be positive`);
1929
- if (this._couldLockImmediately(weight, priority)) {
1930
- return Promise.resolve();
1931
- } else {
1932
- return new Promise((resolve) => {
1933
- if (!this._weightedWaiters[weight - 1])
1934
- this._weightedWaiters[weight - 1] = [];
1935
- insertSorted(this._weightedWaiters[weight - 1], { resolve, priority });
1936
- });
1937
- }
1938
- }
1939
- isLocked() {
1940
- return this._value <= 0;
1941
- }
1942
- getValue() {
1943
- return this._value;
1944
- }
1945
- setValue(value) {
1946
- this._value = value;
1947
- this._dispatchQueue();
1948
- }
1949
- release(weight = 1) {
1950
- if (weight <= 0)
1951
- throw new Error(`invalid weight ${weight}: must be positive`);
1952
- this._value += weight;
1953
- this._dispatchQueue();
1954
- }
1955
- cancel() {
1956
- this._queue.forEach((entry) => entry.reject(this._cancelError));
1957
- this._queue = [];
1958
- }
1959
- _dispatchQueue() {
1960
- this._drainUnlockWaiters();
1961
- while (this._queue.length > 0 && this._queue[0].weight <= this._value) {
1962
- this._dispatchItem(this._queue.shift());
1963
- this._drainUnlockWaiters();
1964
- }
1965
- }
1966
- _dispatchItem(item) {
1967
- const previousValue = this._value;
1968
- this._value -= item.weight;
1969
- item.resolve([previousValue, this._newReleaser(item.weight)]);
1970
- }
1971
- _newReleaser(weight) {
1972
- let called = false;
1973
- return () => {
1974
- if (called)
1975
- return;
1976
- called = true;
1977
- this.release(weight);
1978
- };
1979
- }
1980
- _drainUnlockWaiters() {
1981
- if (this._queue.length === 0) {
1982
- for (let weight = this._value; weight > 0; weight--) {
1983
- const waiters = this._weightedWaiters[weight - 1];
1984
- if (!waiters)
1985
- continue;
1986
- waiters.forEach((waiter) => waiter.resolve());
1987
- this._weightedWaiters[weight - 1] = [];
1988
- }
1989
- } else {
1990
- const queuedPriority = this._queue[0].priority;
1991
- for (let weight = this._value; weight > 0; weight--) {
1992
- const waiters = this._weightedWaiters[weight - 1];
1993
- if (!waiters)
1994
- continue;
1995
- const i = waiters.findIndex((waiter) => waiter.priority <= queuedPriority);
1996
- (i === -1 ? waiters : waiters.splice(0, i)).forEach((waiter) => waiter.resolve());
1997
- }
1998
- }
1999
- }
2000
- _couldLockImmediately(weight, priority) {
2001
- return (this._queue.length === 0 || this._queue[0].priority < priority) && weight <= this._value;
2002
- }
2003
- };
2004
- function insertSorted(a, v) {
2005
- const i = findIndexFromEnd(a, (other) => v.priority <= other.priority);
2006
- a.splice(i + 1, 0, v);
2007
- }
2008
- __name(insertSorted, "insertSorted");
2009
- function findIndexFromEnd(a, predicate) {
2010
- for (let i = a.length - 1; i >= 0; i--) {
2011
- if (predicate(a[i])) {
2012
- return i;
2013
- }
2014
- }
2015
- return -1;
2016
- }
2017
- __name(findIndexFromEnd, "findIndexFromEnd");
2018
- var __awaiter$1 = function(thisArg, _arguments, P, generator) {
2019
- function adopt(value) {
2020
- return value instanceof P ? value : new P(function(resolve) {
2021
- resolve(value);
2022
- });
2023
- }
2024
- __name(adopt, "adopt");
2025
- return new (P || (P = Promise))(function(resolve, reject) {
2026
- function fulfilled(value) {
2027
- try {
2028
- step(generator.next(value));
2029
- } catch (e) {
2030
- reject(e);
2031
- }
2032
- }
2033
- __name(fulfilled, "fulfilled");
2034
- function rejected(value) {
2035
- try {
2036
- step(generator["throw"](value));
2037
- } catch (e) {
2038
- reject(e);
2039
- }
2040
- }
2041
- __name(rejected, "rejected");
2042
- function step(result) {
2043
- result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
2044
- }
2045
- __name(step, "step");
2046
- step((generator = generator.apply(thisArg, _arguments || [])).next());
2047
- });
2048
- };
2049
- var Mutex = class {
2050
- static {
2051
- __name(this, "Mutex");
2052
- }
2053
- constructor(cancelError) {
2054
- this._semaphore = new Semaphore(1, cancelError);
2055
- }
2056
- acquire() {
2057
- return __awaiter$1(this, arguments, void 0, function* (priority = 0) {
2058
- const [, releaser] = yield this._semaphore.acquire(1, priority);
2059
- return releaser;
2060
- });
2061
- }
2062
- runExclusive(callback, priority = 0) {
2063
- return this._semaphore.runExclusive(() => callback(), 1, priority);
2064
- }
2065
- isLocked() {
2066
- return this._semaphore.isLocked();
2067
- }
2068
- waitForUnlock(priority = 0) {
2069
- return this._semaphore.waitForUnlock(1, priority);
2070
- }
2071
- release() {
2072
- if (this._semaphore.isLocked())
2073
- this._semaphore.release();
2074
- }
2075
- cancel() {
2076
- return this._semaphore.cancel();
2077
- }
2078
- };
2079
- var __awaiter = function(thisArg, _arguments, P, generator) {
2080
- function adopt(value) {
2081
- return value instanceof P ? value : new P(function(resolve) {
2082
- resolve(value);
2083
- });
2084
- }
2085
- __name(adopt, "adopt");
2086
- return new (P || (P = Promise))(function(resolve, reject) {
2087
- function fulfilled(value) {
2088
- try {
2089
- step(generator.next(value));
2090
- } catch (e) {
2091
- reject(e);
2092
- }
2093
- }
2094
- __name(fulfilled, "fulfilled");
2095
- function rejected(value) {
2096
- try {
2097
- step(generator["throw"](value));
2098
- } catch (e) {
2099
- reject(e);
2100
- }
2101
- }
2102
- __name(rejected, "rejected");
2103
- function step(result) {
2104
- result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
2105
- }
2106
- __name(step, "step");
2107
- step((generator = generator.apply(thisArg, _arguments || [])).next());
2108
- });
2109
- };
2110
- function withTimeout(sync, timeout, timeoutError = E_TIMEOUT) {
2111
- return {
2112
- acquire: /* @__PURE__ */ __name((weightOrPriority, priority) => {
2113
- let weight;
2114
- if (isSemaphore(sync)) {
2115
- weight = weightOrPriority;
2116
- } else {
2117
- weight = void 0;
2118
- priority = weightOrPriority;
2119
- }
2120
- if (weight !== void 0 && weight <= 0) {
2121
- throw new Error(`invalid weight ${weight}: must be positive`);
2122
- }
2123
- return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2124
- let isTimeout = false;
2125
- const handle = setTimeout(() => {
2126
- isTimeout = true;
2127
- reject(timeoutError);
2128
- }, timeout);
2129
- try {
2130
- const ticket = yield isSemaphore(sync) ? sync.acquire(weight, priority) : sync.acquire(priority);
2131
- if (isTimeout) {
2132
- const release = Array.isArray(ticket) ? ticket[1] : ticket;
2133
- release();
2134
- } else {
2135
- clearTimeout(handle);
2136
- resolve(ticket);
2137
- }
2138
- } catch (e) {
2139
- if (!isTimeout) {
2140
- clearTimeout(handle);
2141
- reject(e);
2142
- }
2143
- }
2144
- }));
2145
- }, "acquire"),
2146
- runExclusive(callback, weight, priority) {
2147
- return __awaiter(this, void 0, void 0, function* () {
2148
- let release = /* @__PURE__ */ __name(() => void 0, "release");
2149
- try {
2150
- const ticket = yield this.acquire(weight, priority);
2151
- if (Array.isArray(ticket)) {
2152
- release = ticket[1];
2153
- return yield callback(ticket[0]);
2154
- } else {
2155
- release = ticket;
2156
- return yield callback();
2157
- }
2158
- } finally {
2159
- release();
2160
- }
2161
- });
2162
- },
2163
- release(weight) {
2164
- sync.release(weight);
2165
- },
2166
- cancel() {
2167
- return sync.cancel();
2168
- },
2169
- waitForUnlock: /* @__PURE__ */ __name((weightOrPriority, priority) => {
2170
- let weight;
2171
- if (isSemaphore(sync)) {
2172
- weight = weightOrPriority;
2173
- } else {
2174
- weight = void 0;
2175
- priority = weightOrPriority;
2176
- }
2177
- if (weight !== void 0 && weight <= 0) {
2178
- throw new Error(`invalid weight ${weight}: must be positive`);
2179
- }
2180
- return new Promise((resolve, reject) => {
2181
- const handle = setTimeout(() => reject(timeoutError), timeout);
2182
- (isSemaphore(sync) ? sync.waitForUnlock(weight, priority) : sync.waitForUnlock(priority)).then(() => {
2183
- clearTimeout(handle);
2184
- resolve();
2185
- });
2186
- });
2187
- }, "waitForUnlock"),
2188
- isLocked: /* @__PURE__ */ __name(() => sync.isLocked(), "isLocked"),
2189
- getValue: /* @__PURE__ */ __name(() => sync.getValue(), "getValue"),
2190
- setValue: /* @__PURE__ */ __name((value) => sync.setValue(value), "setValue")
2191
- };
2192
- }
2193
- __name(withTimeout, "withTimeout");
2194
- function isSemaphore(sync) {
2195
- return sync.getValue !== void 0;
2196
- }
2197
- __name(isSemaphore, "isSemaphore");
2198
-
2199
1857
  export {
2200
- E_TIMEOUT,
2201
- Mutex,
2202
- withTimeout,
2203
1858
  getTeamsRootDir,
2204
1859
  getTeamDir,
2205
1860
  getTeamFilePath,
@@ -2,10 +2,10 @@
2
2
  "use strict";
3
3
  import {
4
4
  resolveBundleDir
5
- } from "./chunk-IWAYOW5Q.js";
5
+ } from "./chunk-6T7Y7USE.js";
6
6
  import {
7
7
  Storage
8
- } from "./chunk-HR7SV7AY.js";
8
+ } from "./chunk-HA2UEYZP.js";
9
9
  import {
10
10
  init_esbuild_shims
11
11
  } from "./chunk-A4BMJM77.js";
@@ -169,15 +169,15 @@ init_esbuild_shims();
169
169
 
170
170
  // import("./locales/**/*.js") in packages/cli/src/i18n/index.ts
171
171
  var globImport_locales_js = __glob({
172
- "./locales/ca.js": () => import("./ca-BARBRL6N.js"),
173
- "./locales/de.js": () => import("./de-YGKK2BC4.js"),
174
- "./locales/en.js": () => import("./en-DHGYHIHX.js"),
175
- "./locales/fr.js": () => import("./fr-JXBKPJKQ.js"),
176
- "./locales/ja.js": () => import("./ja-TGPZSP2B.js"),
177
- "./locales/pt.js": () => import("./pt-TIBG6BIO.js"),
178
- "./locales/ru.js": () => import("./ru-JBCHCK4L.js"),
179
- "./locales/zh-TW.js": () => import("./zh-TW-P4IDHD3M.js"),
180
- "./locales/zh.js": () => import("./zh-7H5OQC4I.js")
172
+ "./locales/ca.js": () => import("./ca-RK4QPLIX.js"),
173
+ "./locales/de.js": () => import("./de-FGPM4KW5.js"),
174
+ "./locales/en.js": () => import("./en-VP6XPGEC.js"),
175
+ "./locales/fr.js": () => import("./fr-ATYBVCLT.js"),
176
+ "./locales/ja.js": () => import("./ja-W2QEA2OI.js"),
177
+ "./locales/pt.js": () => import("./pt-ZKEWJFBW.js"),
178
+ "./locales/ru.js": () => import("./ru-VEKTPJ74.js"),
179
+ "./locales/zh-TW.js": () => import("./zh-TW-6YFNCKTA.js"),
180
+ "./locales/zh.js": () => import("./zh-OIXDDQHB.js")
181
181
  });
182
182
 
183
183
  // packages/cli/src/i18n/index.ts
@@ -2,7 +2,7 @@
2
2
  "use strict";
3
3
  import {
4
4
  getGlobalQwenDir
5
- } from "./chunk-JTQAQBTV.js";
5
+ } from "./chunk-HED55F43.js";
6
6
  import {
7
7
  init_esbuild_shims
8
8
  } from "./chunk-A4BMJM77.js";
@@ -2,7 +2,7 @@
2
2
  "use strict";
3
3
  import {
4
4
  createDebugLogger
5
- } from "./chunk-HR7SV7AY.js";
5
+ } from "./chunk-HA2UEYZP.js";
6
6
  import {
7
7
  init_esbuild_shims
8
8
  } from "./chunk-A4BMJM77.js";
@@ -1,17 +1,19 @@
1
1
  // Force strict mode and setup for ESM
2
2
  "use strict";
3
3
  import {
4
- Mutex,
5
4
  getTasksDir,
6
5
  require_proper_lockfile
7
- } from "./chunk-J5MDQKJL.js";
6
+ } from "./chunk-WPTCDQN6.js";
7
+ import {
8
+ Mutex
9
+ } from "./chunk-OMX7CUOE.js";
8
10
  import {
9
11
  atomicWriteJSON
10
- } from "./chunk-B7HXHOHU.js";
12
+ } from "./chunk-LXYWINWF.js";
11
13
  import {
12
14
  createDebugLogger,
13
15
  isNodeError
14
- } from "./chunk-HR7SV7AY.js";
16
+ } from "./chunk-HA2UEYZP.js";
15
17
  import {
16
18
  init_esbuild_shims
17
19
  } from "./chunk-A4BMJM77.js";