@qwen-code/qwen-code 0.18.0-preview.2 → 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 (143) hide show
  1. package/bundled/loop/SKILL.md +2 -1
  2. package/bundled/qc-helper/docs/_meta.ts +1 -0
  3. package/bundled/qc-helper/docs/configuration/auth.md +1 -1
  4. package/bundled/qc-helper/docs/configuration/model-providers.md +12 -5
  5. package/bundled/qc-helper/docs/configuration/settings.md +33 -32
  6. package/bundled/qc-helper/docs/features/approval-mode.md +10 -14
  7. package/bundled/qc-helper/docs/features/commands.md +33 -11
  8. package/bundled/qc-helper/docs/features/dual-output.md +37 -3
  9. package/bundled/qc-helper/docs/features/followup-suggestions.md +2 -2
  10. package/bundled/qc-helper/docs/features/skills.md +29 -3
  11. package/bundled/qc-helper/docs/features/sub-agents.md +34 -12
  12. package/bundled/qc-helper/docs/qwen-serve-deploy-local.md +221 -0
  13. package/bundled/qc-helper/docs/qwen-serve.md +246 -28
  14. package/chunks/{agent-QB7TZ4HW.js → agent-XT7NHZ5H.js} +25 -24
  15. package/chunks/agent-headless-LNRE63ZL.js +51 -0
  16. package/chunks/{anthropicContentGenerator-M45EVVRM.js → anthropicContentGenerator-DCI26OQF.js} +7 -7
  17. package/chunks/{askUserQuestion-WM2KHM3K.js → askUserQuestion-ITYUTWLR.js} +45 -3
  18. package/chunks/{ca-BARBRL6N.js → ca-RK4QPLIX.js} +18 -1
  19. package/chunks/{chunk-CWV3SJZS.js → chunk-3NRO6NHX.js} +2 -2
  20. package/chunks/{chunk-BNESGOSJ.js → chunk-55ZMG67I.js} +1 -1
  21. package/chunks/{chunk-QCG6KPNM.js → chunk-6T7Y7USE.js} +18017 -11621
  22. package/chunks/{chunk-CNHFPN7T.js → chunk-7KPZFE5A.js} +1 -1
  23. package/chunks/{chunk-2ZTWI7KH.js → chunk-A2ZIEEGJ.js} +30 -22
  24. package/chunks/{chunk-JUGRPQAB.js → chunk-B4ZF2KSI.js} +1 -1
  25. package/chunks/chunk-BJ5HQ23U.js +178 -0
  26. package/chunks/{chunk-HXJE7VOG.js → chunk-BXYRCW2C.js} +1074 -144
  27. package/chunks/{chunk-ICOI4E4S.js → chunk-CPVI5J2L.js} +101 -23
  28. package/chunks/{chunk-HV3ZZ7G4.js → chunk-DHZREJTG.js} +2 -2
  29. package/chunks/{chunk-GX7VH5JQ.js → chunk-FIQECJTQ.js} +1 -1
  30. package/chunks/{chunk-SZOEIL6S.js → chunk-H6BD2ELD.js} +1 -0
  31. package/chunks/{chunk-JXAZUMDW.js → chunk-HA2UEYZP.js} +7 -4
  32. package/chunks/{chunk-USE2VQ5P.js → chunk-HED55F43.js} +26 -1
  33. package/chunks/{chunk-PAEBHDIO.js → chunk-HQUWWSSP.js} +1 -1
  34. package/chunks/{chunk-MVIVIPCU.js → chunk-IDYDPBBN.js} +361 -583
  35. package/chunks/{chunk-JVQOQ3OU.js → chunk-IQHSD7K5.js} +1 -1
  36. package/chunks/{chunk-NW5QBUYO.js → chunk-IS7UA4W3.js} +14 -14
  37. package/chunks/{chunk-UAMOBVVW.js → chunk-LXYWINWF.js} +1 -1
  38. package/chunks/{chunk-P4J26VDS.js → chunk-LYRSMKLS.js} +2 -2
  39. package/chunks/{chunk-Y7R6H6FT.js → chunk-LYSND7KR.js} +9 -4
  40. package/chunks/{chunk-LR62TEET.js → chunk-NNIYWQIS.js} +1 -1
  41. package/chunks/chunk-OMX7CUOE.js +356 -0
  42. package/chunks/{chunk-CNSMKPK6.js → chunk-QILTEBWS.js} +1 -1
  43. package/chunks/chunk-QQDPRDVW.js +25 -0
  44. package/chunks/{chunk-ZK4AMNIU.js → chunk-RON7LFNH.js} +1294 -314
  45. package/chunks/chunk-SFRV6BGY.js +243 -0
  46. package/chunks/{chunk-AVW55ZCO.js → chunk-WJ3SND6W.js} +37 -16
  47. package/chunks/{chunk-HGJPQK33.js → chunk-WPTCDQN6.js} +188 -534
  48. package/chunks/{chunk-7YKXFA3D.js → chunk-XZTNBSMW.js} +11 -11
  49. package/chunks/{chunk-C6WMLUNB.js → chunk-Y7KMDUEP.js} +1 -1
  50. package/chunks/{chunk-WFVXF3OM.js → chunk-Z2Z3GUXZ.js} +1 -0
  51. package/chunks/{chunk-KC6ZMJ5X.js → chunk-ZMIBJS45.js} +1 -1
  52. package/chunks/chunk-ZOFNJQNJ.js +607 -0
  53. package/chunks/computer-use-4YX3JGBV.js +2052 -0
  54. package/chunks/contextCommand-KS2H7MW5.js +53 -0
  55. package/chunks/cron-create-CAPUKK7I.js +184 -0
  56. package/chunks/{cron-delete-ZGUXWBTG.js → cron-delete-G3KAR26Q.js} +28 -5
  57. package/chunks/{cron-list-QNNZGMN3.js → cron-list-ZA4ZIUS5.js} +40 -7
  58. package/chunks/{de-YGKK2BC4.js → de-FGPM4KW5.js} +18 -1
  59. package/chunks/{devtools-IXE4UP72.js → devtools-FM6GJPYG.js} +1 -1
  60. package/chunks/{dist-ZMQ4TXD5.js → dist-7YWFWOCJ.js} +2 -2
  61. package/chunks/{dist-R2SXPG74.js → dist-VEGFONCF.js} +2 -2
  62. package/chunks/{dist-TE5QKMGR.js → dist-X4EXN7W6.js} +1 -1
  63. package/chunks/{dist-BXDUQ2QY.js → dist-YLS6NI7H.js} +1 -1
  64. package/chunks/{edit-6UBTS2J5.js → edit-2ARPEO4B.js} +26 -25
  65. package/chunks/{en-HSQQNQUB.js → en-VP6XPGEC.js} +9 -2
  66. package/chunks/{enter-worktree-NN7LIXCM.js → enter-worktree-IXNXNAW5.js} +25 -24
  67. package/chunks/enterPlanMode-TAKAGAYP.js +159 -0
  68. package/chunks/{exit-worktree-GGSS5KIE.js → exit-worktree-LHTRV7ML.js} +25 -24
  69. package/chunks/exitPlanMode-MK5UAITL.js +743 -0
  70. package/chunks/{fr-JXBKPJKQ.js → fr-ATYBVCLT.js} +18 -1
  71. package/chunks/{geminiContentGenerator-I4H2NLJG.js → geminiContentGenerator-HFJIGO77.js} +7 -7
  72. package/chunks/{getMachineId-bsd-F7GNPTER.js → getMachineId-bsd-4CASPIU4.js} +1 -1
  73. package/chunks/{getMachineId-darwin-T73DJL27.js → getMachineId-darwin-HPQPEMZR.js} +1 -1
  74. package/chunks/{getMachineId-linux-MKQTFPQM.js → getMachineId-linux-AUARKYHL.js} +1 -1
  75. package/chunks/{getMachineId-unsupported-MUR5KOQE.js → getMachineId-unsupported-S32ZDA2T.js} +1 -1
  76. package/chunks/{getMachineId-win-CDYFC6ZM.js → getMachineId-win-4EFLHYIJ.js} +1 -1
  77. package/chunks/{glob-OLCX57MD.js → glob-I2USLUSC.js} +25 -24
  78. package/chunks/{grep-7HXIMDOW.js → grep-WBIF7THR.js} +37 -30
  79. package/chunks/{ja-TGPZSP2B.js → ja-W2QEA2OI.js} +18 -1
  80. package/chunks/{keychain-token-storage-LB46DAEK.js → keychain-token-storage-QSTRHKKL.js} +3 -3
  81. package/chunks/{ls-6PEZUK6O.js → ls-2R5RHLX5.js} +4 -4
  82. package/chunks/{lsp-JZSJOVT7.js → lsp-XKH6ZIAN.js} +3 -3
  83. package/chunks/{monitor-SQO7MVAV.js → monitor-WU7UFATU.js} +25 -24
  84. package/chunks/{notebook-edit-72L3EBAL.js → notebook-edit-KUHYPXEM.js} +26 -25
  85. package/chunks/{openaiContentGenerator-FTR7CDWF.js → openaiContentGenerator-5PLHYJQL.js} +15 -15
  86. package/chunks/{pt-TIBG6BIO.js → pt-ZKEWJFBW.js} +18 -1
  87. package/chunks/{qwenContentGenerator-U5UFQ566.js → qwenContentGenerator-TSKW73KY.js} +27 -26
  88. package/chunks/{qwenOAuth2-EFSECGHF.js → qwenOAuth2-KK433U33.js} +6 -5
  89. package/chunks/{read-file-UA64EEQC.js → read-file-VIPF2PS6.js} +11 -11
  90. package/chunks/ripGrep-XLIZTYE7.js +49 -0
  91. package/chunks/{ru-JBCHCK4L.js → ru-VEKTPJ74.js} +18 -1
  92. package/chunks/{scheduler-VBASHOCA.js → scheduler-O66SLJGU.js} +25 -24
  93. package/chunks/{send-message-OYJZ5TPG.js → send-message-CTME7DXD.js} +3 -3
  94. package/chunks/{serve-A7E2OJDR.js → serve-BWOLYT62.js} +13164 -3840
  95. package/chunks/{shell-3NFOT6F5.js → shell-XE7UYKOO.js} +25 -24
  96. package/chunks/{skill-RA5YUREY.js → skill-RZWM6XMC.js} +64 -113
  97. package/chunks/{src-NFCMARMT.js → src-L5P7K4MH.js} +176 -44
  98. package/chunks/{syntheticOutput-DETQ2YM6.js → syntheticOutput-ZJGSU7OQ.js} +4 -4
  99. package/chunks/{task-create-Y3ZKTJIG.js → task-create-EE6JEM7G.js} +8 -7
  100. package/chunks/{task-list-ONXJ3I3A.js → task-list-EESYAC65.js} +7 -6
  101. package/chunks/{task-stop-UHDC4N5B.js → task-stop-XZVCFFYY.js} +3 -3
  102. package/chunks/{task-update-TCNOU3P5.js → task-update-EIO4HNE3.js} +21 -9
  103. package/chunks/{team-create-6SR4OVRG.js → team-create-R2H7Y3SG.js} +28 -26
  104. package/chunks/{team-delete-EJ4U4DDP.js → team-delete-A7LXPGV7.js} +9 -6
  105. package/chunks/{todoWrite-TEYDRS5L.js → todoWrite-VRKSGAWM.js} +5 -5
  106. package/chunks/{tool-search-OD435A3X.js → tool-search-USSQMTMS.js} +11 -11
  107. package/chunks/{web-fetch-6W67H5PO.js → web-fetch-GHAZUA54.js} +5 -5
  108. package/chunks/workflow-5LNNLNUR.js +1414 -0
  109. package/chunks/{write-file-475L5OPP.js → write-file-2I7HP24C.js} +26 -25
  110. package/chunks/{zh-VCLWO26Y.js → zh-OIXDDQHB.js} +10 -3
  111. package/chunks/{zh-TW-G3HFHVVT.js → zh-TW-6YFNCKTA.js} +10 -3
  112. package/cli-entry.js +19 -0
  113. package/cli.js +11064 -6628
  114. package/examples/starter/QWEN.md +30 -0
  115. package/examples/starter/README.md +59 -0
  116. package/examples/starter/agents/diary.md +86 -0
  117. package/examples/starter/commands/writing/polish.md +13 -0
  118. package/examples/starter/example.ts +64 -0
  119. package/examples/starter/package.json +18 -0
  120. package/examples/starter/qwen-extension.json +12 -0
  121. package/examples/starter/skills/synonyms/SKILL.md +48 -0
  122. package/examples/starter/tsconfig.json +13 -0
  123. package/fzfWorker.js +1083 -0
  124. package/locales/ca.js +20 -2
  125. package/locales/de.js +21 -2
  126. package/locales/en.js +13 -4
  127. package/locales/fr.js +22 -2
  128. package/locales/ja.js +22 -2
  129. package/locales/pt.js +21 -2
  130. package/locales/ru.js +20 -2
  131. package/locales/zh-TW.js +11 -4
  132. package/locales/zh.js +11 -4
  133. package/package.json +5 -3
  134. package/chunks/agent-headless-APVHH7QM.js +0 -50
  135. package/chunks/chunk-AJIR24J2.js +0 -59
  136. package/chunks/chunk-SKBPNJEW.js +0 -45
  137. package/chunks/chunk-XBFVXFB2.js +0 -216
  138. package/chunks/computer-use-B7VIUI7F.js +0 -825
  139. package/chunks/contextCommand-63RZ3O5R.js +0 -52
  140. package/chunks/cron-create-FI5LJVUS.js +0 -140
  141. package/chunks/exitPlanMode-H323NHB2.js +0 -235
  142. package/chunks/ripGrep-WSYCWZVK.js +0 -48
  143. package/chunks/workflow-62DHH4EO.js +0 -708
@@ -5,7 +5,7 @@ import {
5
5
  Storage,
6
6
  resolvePath,
7
7
  sanitizeCwd
8
- } from "./chunk-JXAZUMDW.js";
8
+ } from "./chunk-HA2UEYZP.js";
9
9
  import {
10
10
  init_esbuild_shims
11
11
  } from "./chunk-A4BMJM77.js";
@@ -2,24 +2,24 @@
2
2
  "use strict";
3
3
  import {
4
4
  t
5
- } from "./chunk-7YKXFA3D.js";
5
+ } from "./chunk-XZTNBSMW.js";
6
6
  import {
7
7
  computeThresholds,
8
8
  getCoreSystemPrompt
9
- } from "./chunk-QCG6KPNM.js";
9
+ } from "./chunk-6T7Y7USE.js";
10
10
  import {
11
11
  buildSkillLlmContent
12
- } from "./chunk-ICOI4E4S.js";
12
+ } from "./chunk-CPVI5J2L.js";
13
13
  import {
14
14
  DiscoveredMCPTool,
15
15
  uiTelemetryService
16
- } from "./chunk-ZK4AMNIU.js";
16
+ } from "./chunk-RON7LFNH.js";
17
17
  import {
18
18
  ToolNames
19
- } from "./chunk-2ZTWI7KH.js";
19
+ } from "./chunk-A2ZIEEGJ.js";
20
20
  import {
21
21
  DEFAULT_TOKEN_LIMIT
22
- } from "./chunk-Y7R6H6FT.js";
22
+ } from "./chunk-LYSND7KR.js";
23
23
  import {
24
24
  init_esbuild_shims
25
25
  } from "./chunk-A4BMJM77.js";
@@ -752,7 +752,7 @@ function fmtTokens(tokens) {
752
752
  }
753
753
  __name(fmtTokens, "fmtTokens");
754
754
  function fmtCategoryRow(label, tokens, contextWindowSize, indent = " ") {
755
- const percentage = (tokens / contextWindowSize * 100).toFixed(1);
755
+ const percentage = contextWindowSize > 0 ? (tokens / contextWindowSize * 100).toFixed(1) : "0.0";
756
756
  const right = `${fmtTokens(tokens)} tokens (${percentage}%)`;
757
757
  const leftPart = `${indent}${label}`;
758
758
  const totalWidth = 56;
@@ -899,7 +899,8 @@ var contextCommand = {
899
899
  kind: "built-in" /* BUILT_IN */,
900
900
  supportedModes: ["interactive", "non_interactive", "acp"],
901
901
  action: /* @__PURE__ */ __name(async (context, args) => {
902
- const showDetails = args?.trim().toLowerCase() === "detail" || args?.trim().toLowerCase() === "-d";
902
+ const normalizedArgs = args?.trim().toLowerCase();
903
+ const showDetails = normalizedArgs === "detail" || normalizedArgs === "-d";
903
904
  const executionMode = context.executionMode ?? "interactive";
904
905
  const { config } = context.services;
905
906
  if (!config) {
@@ -923,13 +924,12 @@ var contextCommand = {
923
924
  if (executionMode === "interactive") {
924
925
  context.ui.addItem(contextUsageItem, Date.now());
925
926
  return;
926
- } else {
927
- return {
928
- type: "message",
929
- messageType: "info",
930
- content: formatContextUsageText(contextUsageItem)
931
- };
932
927
  }
928
+ return {
929
+ type: "message",
930
+ messageType: "info",
931
+ content: formatContextUsageText(contextUsageItem)
932
+ };
933
933
  }, "action"),
934
934
  subCommands: [
935
935
  {
@@ -3,7 +3,7 @@
3
3
  import {
4
4
  createDebugLogger,
5
5
  isNodeError
6
- } from "./chunk-JXAZUMDW.js";
6
+ } from "./chunk-HA2UEYZP.js";
7
7
  import {
8
8
  init_esbuild_shims
9
9
  } from "./chunk-A4BMJM77.js";
@@ -2,11 +2,11 @@
2
2
  "use strict";
3
3
  import {
4
4
  atomicWriteFileSync
5
- } from "./chunk-UAMOBVVW.js";
5
+ } from "./chunk-LXYWINWF.js";
6
6
  import {
7
7
  Storage,
8
8
  createDebugLogger
9
- } from "./chunk-JXAZUMDW.js";
9
+ } from "./chunk-HA2UEYZP.js";
10
10
  import {
11
11
  init_esbuild_shims
12
12
  } from "./chunk-A4BMJM77.js";
@@ -2,7 +2,7 @@
2
2
  "use strict";
3
3
  import {
4
4
  createDebugLogger
5
- } from "./chunk-JXAZUMDW.js";
5
+ } from "./chunk-HA2UEYZP.js";
6
6
  import {
7
7
  init_esbuild_shims
8
8
  } from "./chunk-A4BMJM77.js";
@@ -467,10 +467,15 @@ var PATTERNS = [
467
467
  // -------------------
468
468
  // Zhipu GLM
469
469
  // -------------------
470
- [/^glm-5/, 202752],
471
- // GLM-5: exact vendor limit
470
+ // 1M context is the forward default for new GLM releases (GLM-5.2+, GLM-6.x,
471
+ // and beyond) so they need no future code change. Confirmed 200K families
472
+ // (GLM-5 / 5.0 / 5.1, GLM-4.x and older) are pinned explicitly first.
473
+ [/^glm-5(\.[01])?(-|$)/, 202752],
474
+ // GLM-5 / 5.0 / 5.1: 200K
475
+ [/^glm-(?:[5-9]|\d{2,})/, LIMITS["1m"]],
476
+ // GLM-5.2+, 6.x..9.x, 10.x+: 1M
472
477
  [/^glm-/, 202752],
473
- // GLM fallback: 128K
478
+ // GLM <=4.x / non-numeric fallback: 200K
474
479
  // -------------------
475
480
  // MiniMax
476
481
  // -------------------
@@ -2,7 +2,7 @@
2
2
  "use strict";
3
3
  import {
4
4
  createDebugLogger
5
- } from "./chunk-JXAZUMDW.js";
5
+ } from "./chunk-HA2UEYZP.js";
6
6
  import {
7
7
  init_esbuild_shims
8
8
  } from "./chunk-A4BMJM77.js";
@@ -0,0 +1,356 @@
1
+ // Force strict mode and setup for ESM
2
+ "use strict";
3
+ import {
4
+ init_esbuild_shims
5
+ } from "./chunk-A4BMJM77.js";
6
+ import {
7
+ __name
8
+ } from "./chunk-J2S4EL5Y.js";
9
+
10
+ // node_modules/async-mutex/index.mjs
11
+ init_esbuild_shims();
12
+ var E_TIMEOUT = new Error("timeout while waiting for mutex to become available");
13
+ var E_ALREADY_LOCKED = new Error("mutex already locked");
14
+ var E_CANCELED = new Error("request for lock canceled");
15
+ var __awaiter$2 = function(thisArg, _arguments, P, generator) {
16
+ function adopt(value) {
17
+ return value instanceof P ? value : new P(function(resolve) {
18
+ resolve(value);
19
+ });
20
+ }
21
+ __name(adopt, "adopt");
22
+ return new (P || (P = Promise))(function(resolve, reject) {
23
+ function fulfilled(value) {
24
+ try {
25
+ step(generator.next(value));
26
+ } catch (e) {
27
+ reject(e);
28
+ }
29
+ }
30
+ __name(fulfilled, "fulfilled");
31
+ function rejected(value) {
32
+ try {
33
+ step(generator["throw"](value));
34
+ } catch (e) {
35
+ reject(e);
36
+ }
37
+ }
38
+ __name(rejected, "rejected");
39
+ function step(result) {
40
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
41
+ }
42
+ __name(step, "step");
43
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
44
+ });
45
+ };
46
+ var Semaphore = class {
47
+ static {
48
+ __name(this, "Semaphore");
49
+ }
50
+ constructor(_value, _cancelError = E_CANCELED) {
51
+ this._value = _value;
52
+ this._cancelError = _cancelError;
53
+ this._queue = [];
54
+ this._weightedWaiters = [];
55
+ }
56
+ acquire(weight = 1, priority = 0) {
57
+ if (weight <= 0)
58
+ throw new Error(`invalid weight ${weight}: must be positive`);
59
+ return new Promise((resolve, reject) => {
60
+ const task = { resolve, reject, weight, priority };
61
+ const i = findIndexFromEnd(this._queue, (other) => priority <= other.priority);
62
+ if (i === -1 && weight <= this._value) {
63
+ this._dispatchItem(task);
64
+ } else {
65
+ this._queue.splice(i + 1, 0, task);
66
+ }
67
+ });
68
+ }
69
+ runExclusive(callback_1) {
70
+ return __awaiter$2(this, arguments, void 0, function* (callback, weight = 1, priority = 0) {
71
+ const [value, release] = yield this.acquire(weight, priority);
72
+ try {
73
+ return yield callback(value);
74
+ } finally {
75
+ release();
76
+ }
77
+ });
78
+ }
79
+ waitForUnlock(weight = 1, priority = 0) {
80
+ if (weight <= 0)
81
+ throw new Error(`invalid weight ${weight}: must be positive`);
82
+ if (this._couldLockImmediately(weight, priority)) {
83
+ return Promise.resolve();
84
+ } else {
85
+ return new Promise((resolve) => {
86
+ if (!this._weightedWaiters[weight - 1])
87
+ this._weightedWaiters[weight - 1] = [];
88
+ insertSorted(this._weightedWaiters[weight - 1], { resolve, priority });
89
+ });
90
+ }
91
+ }
92
+ isLocked() {
93
+ return this._value <= 0;
94
+ }
95
+ getValue() {
96
+ return this._value;
97
+ }
98
+ setValue(value) {
99
+ this._value = value;
100
+ this._dispatchQueue();
101
+ }
102
+ release(weight = 1) {
103
+ if (weight <= 0)
104
+ throw new Error(`invalid weight ${weight}: must be positive`);
105
+ this._value += weight;
106
+ this._dispatchQueue();
107
+ }
108
+ cancel() {
109
+ this._queue.forEach((entry) => entry.reject(this._cancelError));
110
+ this._queue = [];
111
+ }
112
+ _dispatchQueue() {
113
+ this._drainUnlockWaiters();
114
+ while (this._queue.length > 0 && this._queue[0].weight <= this._value) {
115
+ this._dispatchItem(this._queue.shift());
116
+ this._drainUnlockWaiters();
117
+ }
118
+ }
119
+ _dispatchItem(item) {
120
+ const previousValue = this._value;
121
+ this._value -= item.weight;
122
+ item.resolve([previousValue, this._newReleaser(item.weight)]);
123
+ }
124
+ _newReleaser(weight) {
125
+ let called = false;
126
+ return () => {
127
+ if (called)
128
+ return;
129
+ called = true;
130
+ this.release(weight);
131
+ };
132
+ }
133
+ _drainUnlockWaiters() {
134
+ if (this._queue.length === 0) {
135
+ for (let weight = this._value; weight > 0; weight--) {
136
+ const waiters = this._weightedWaiters[weight - 1];
137
+ if (!waiters)
138
+ continue;
139
+ waiters.forEach((waiter) => waiter.resolve());
140
+ this._weightedWaiters[weight - 1] = [];
141
+ }
142
+ } else {
143
+ const queuedPriority = this._queue[0].priority;
144
+ for (let weight = this._value; weight > 0; weight--) {
145
+ const waiters = this._weightedWaiters[weight - 1];
146
+ if (!waiters)
147
+ continue;
148
+ const i = waiters.findIndex((waiter) => waiter.priority <= queuedPriority);
149
+ (i === -1 ? waiters : waiters.splice(0, i)).forEach((waiter) => waiter.resolve());
150
+ }
151
+ }
152
+ }
153
+ _couldLockImmediately(weight, priority) {
154
+ return (this._queue.length === 0 || this._queue[0].priority < priority) && weight <= this._value;
155
+ }
156
+ };
157
+ function insertSorted(a, v) {
158
+ const i = findIndexFromEnd(a, (other) => v.priority <= other.priority);
159
+ a.splice(i + 1, 0, v);
160
+ }
161
+ __name(insertSorted, "insertSorted");
162
+ function findIndexFromEnd(a, predicate) {
163
+ for (let i = a.length - 1; i >= 0; i--) {
164
+ if (predicate(a[i])) {
165
+ return i;
166
+ }
167
+ }
168
+ return -1;
169
+ }
170
+ __name(findIndexFromEnd, "findIndexFromEnd");
171
+ var __awaiter$1 = function(thisArg, _arguments, P, generator) {
172
+ function adopt(value) {
173
+ return value instanceof P ? value : new P(function(resolve) {
174
+ resolve(value);
175
+ });
176
+ }
177
+ __name(adopt, "adopt");
178
+ return new (P || (P = Promise))(function(resolve, reject) {
179
+ function fulfilled(value) {
180
+ try {
181
+ step(generator.next(value));
182
+ } catch (e) {
183
+ reject(e);
184
+ }
185
+ }
186
+ __name(fulfilled, "fulfilled");
187
+ function rejected(value) {
188
+ try {
189
+ step(generator["throw"](value));
190
+ } catch (e) {
191
+ reject(e);
192
+ }
193
+ }
194
+ __name(rejected, "rejected");
195
+ function step(result) {
196
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
197
+ }
198
+ __name(step, "step");
199
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
200
+ });
201
+ };
202
+ var Mutex = class {
203
+ static {
204
+ __name(this, "Mutex");
205
+ }
206
+ constructor(cancelError) {
207
+ this._semaphore = new Semaphore(1, cancelError);
208
+ }
209
+ acquire() {
210
+ return __awaiter$1(this, arguments, void 0, function* (priority = 0) {
211
+ const [, releaser] = yield this._semaphore.acquire(1, priority);
212
+ return releaser;
213
+ });
214
+ }
215
+ runExclusive(callback, priority = 0) {
216
+ return this._semaphore.runExclusive(() => callback(), 1, priority);
217
+ }
218
+ isLocked() {
219
+ return this._semaphore.isLocked();
220
+ }
221
+ waitForUnlock(priority = 0) {
222
+ return this._semaphore.waitForUnlock(1, priority);
223
+ }
224
+ release() {
225
+ if (this._semaphore.isLocked())
226
+ this._semaphore.release();
227
+ }
228
+ cancel() {
229
+ return this._semaphore.cancel();
230
+ }
231
+ };
232
+ var __awaiter = function(thisArg, _arguments, P, generator) {
233
+ function adopt(value) {
234
+ return value instanceof P ? value : new P(function(resolve) {
235
+ resolve(value);
236
+ });
237
+ }
238
+ __name(adopt, "adopt");
239
+ return new (P || (P = Promise))(function(resolve, reject) {
240
+ function fulfilled(value) {
241
+ try {
242
+ step(generator.next(value));
243
+ } catch (e) {
244
+ reject(e);
245
+ }
246
+ }
247
+ __name(fulfilled, "fulfilled");
248
+ function rejected(value) {
249
+ try {
250
+ step(generator["throw"](value));
251
+ } catch (e) {
252
+ reject(e);
253
+ }
254
+ }
255
+ __name(rejected, "rejected");
256
+ function step(result) {
257
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
258
+ }
259
+ __name(step, "step");
260
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
261
+ });
262
+ };
263
+ function withTimeout(sync, timeout, timeoutError = E_TIMEOUT) {
264
+ return {
265
+ acquire: /* @__PURE__ */ __name((weightOrPriority, priority) => {
266
+ let weight;
267
+ if (isSemaphore(sync)) {
268
+ weight = weightOrPriority;
269
+ } else {
270
+ weight = void 0;
271
+ priority = weightOrPriority;
272
+ }
273
+ if (weight !== void 0 && weight <= 0) {
274
+ throw new Error(`invalid weight ${weight}: must be positive`);
275
+ }
276
+ return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
277
+ let isTimeout = false;
278
+ const handle = setTimeout(() => {
279
+ isTimeout = true;
280
+ reject(timeoutError);
281
+ }, timeout);
282
+ try {
283
+ const ticket = yield isSemaphore(sync) ? sync.acquire(weight, priority) : sync.acquire(priority);
284
+ if (isTimeout) {
285
+ const release = Array.isArray(ticket) ? ticket[1] : ticket;
286
+ release();
287
+ } else {
288
+ clearTimeout(handle);
289
+ resolve(ticket);
290
+ }
291
+ } catch (e) {
292
+ if (!isTimeout) {
293
+ clearTimeout(handle);
294
+ reject(e);
295
+ }
296
+ }
297
+ }));
298
+ }, "acquire"),
299
+ runExclusive(callback, weight, priority) {
300
+ return __awaiter(this, void 0, void 0, function* () {
301
+ let release = /* @__PURE__ */ __name(() => void 0, "release");
302
+ try {
303
+ const ticket = yield this.acquire(weight, priority);
304
+ if (Array.isArray(ticket)) {
305
+ release = ticket[1];
306
+ return yield callback(ticket[0]);
307
+ } else {
308
+ release = ticket;
309
+ return yield callback();
310
+ }
311
+ } finally {
312
+ release();
313
+ }
314
+ });
315
+ },
316
+ release(weight) {
317
+ sync.release(weight);
318
+ },
319
+ cancel() {
320
+ return sync.cancel();
321
+ },
322
+ waitForUnlock: /* @__PURE__ */ __name((weightOrPriority, priority) => {
323
+ let weight;
324
+ if (isSemaphore(sync)) {
325
+ weight = weightOrPriority;
326
+ } else {
327
+ weight = void 0;
328
+ priority = weightOrPriority;
329
+ }
330
+ if (weight !== void 0 && weight <= 0) {
331
+ throw new Error(`invalid weight ${weight}: must be positive`);
332
+ }
333
+ return new Promise((resolve, reject) => {
334
+ const handle = setTimeout(() => reject(timeoutError), timeout);
335
+ (isSemaphore(sync) ? sync.waitForUnlock(weight, priority) : sync.waitForUnlock(priority)).then(() => {
336
+ clearTimeout(handle);
337
+ resolve();
338
+ });
339
+ });
340
+ }, "waitForUnlock"),
341
+ isLocked: /* @__PURE__ */ __name(() => sync.isLocked(), "isLocked"),
342
+ getValue: /* @__PURE__ */ __name(() => sync.getValue(), "getValue"),
343
+ setValue: /* @__PURE__ */ __name((value) => sync.setValue(value), "setValue")
344
+ };
345
+ }
346
+ __name(withTimeout, "withTimeout");
347
+ function isSemaphore(sync) {
348
+ return sync.getValue !== void 0;
349
+ }
350
+ __name(isSemaphore, "isSemaphore");
351
+
352
+ export {
353
+ E_TIMEOUT,
354
+ Mutex,
355
+ withTimeout
356
+ };
@@ -5,7 +5,7 @@ import {
5
5
  BaseToolInvocation,
6
6
  ToolDisplayNames,
7
7
  ToolNames
8
- } from "./chunk-2ZTWI7KH.js";
8
+ } from "./chunk-A2ZIEEGJ.js";
9
9
  import {
10
10
  init_esbuild_shims
11
11
  } from "./chunk-A4BMJM77.js";
@@ -0,0 +1,25 @@
1
+ // Force strict mode and setup for ESM
2
+ "use strict";
3
+ import {
4
+ init_esbuild_shims
5
+ } from "./chunk-A4BMJM77.js";
6
+
7
+ // packages/core/src/plan-gate/types.ts
8
+ init_esbuild_shims();
9
+ var CAPPED_REVIEW_LIMIT = 5;
10
+ var MAX_AGENT_RETRIES = 3;
11
+ var CAP_ESCALATION_LABELS = {
12
+ CONTINUE: "Continue editing plan",
13
+ APPROVE: "Approve execution"
14
+ };
15
+
16
+ export {
17
+ CAPPED_REVIEW_LIMIT,
18
+ MAX_AGENT_RETRIES,
19
+ CAP_ESCALATION_LABELS
20
+ };
21
+ /**
22
+ * @license
23
+ * Copyright 2025 Qwen
24
+ * SPDX-License-Identifier: Apache-2.0
25
+ */