@qwen-code/qwen-code 0.18.0-preview.2 → 0.18.1-nightly.20260616.a68b2e1e7

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 (145) 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/common-workflow.md +4 -4
  4. package/bundled/qc-helper/docs/configuration/auth.md +1 -1
  5. package/bundled/qc-helper/docs/configuration/model-providers.md +13 -6
  6. package/bundled/qc-helper/docs/configuration/settings.md +90 -89
  7. package/bundled/qc-helper/docs/features/approval-mode.md +10 -14
  8. package/bundled/qc-helper/docs/features/commands.md +33 -11
  9. package/bundled/qc-helper/docs/features/dual-output.md +37 -3
  10. package/bundled/qc-helper/docs/features/followup-suggestions.md +2 -2
  11. package/bundled/qc-helper/docs/features/skills.md +29 -3
  12. package/bundled/qc-helper/docs/features/sub-agents.md +34 -12
  13. package/bundled/qc-helper/docs/qwen-serve-deploy-local.md +221 -0
  14. package/bundled/qc-helper/docs/qwen-serve.md +250 -31
  15. package/bundled/qc-helper/docs/reference/keyboard-shortcuts.md +30 -30
  16. package/chunks/{agent-QB7TZ4HW.js → agent-PXMT2XR5.js} +25 -24
  17. package/chunks/agent-headless-SY7VJUHV.js +51 -0
  18. package/chunks/{anthropicContentGenerator-M45EVVRM.js → anthropicContentGenerator-DCI26OQF.js} +7 -7
  19. package/chunks/{askUserQuestion-WM2KHM3K.js → askUserQuestion-NDNFGC35.js} +45 -3
  20. package/chunks/{ca-BARBRL6N.js → ca-RK4QPLIX.js} +18 -1
  21. package/chunks/{chunk-CNSMKPK6.js → chunk-26QELEL2.js} +1 -1
  22. package/chunks/{chunk-CWV3SJZS.js → chunk-3NRO6NHX.js} +2 -2
  23. package/chunks/{chunk-BNESGOSJ.js → chunk-55ZMG67I.js} +1 -1
  24. package/chunks/{chunk-2ZTWI7KH.js → chunk-6WPY6ES3.js} +62 -22
  25. package/chunks/{chunk-ZK4AMNIU.js → chunk-A3OEZT2F.js} +1294 -314
  26. package/chunks/{chunk-HXJE7VOG.js → chunk-ABRZC6FA.js} +1074 -144
  27. package/chunks/{chunk-JUGRPQAB.js → chunk-B4ZF2KSI.js} +1 -1
  28. package/chunks/chunk-BJ5HQ23U.js +178 -0
  29. package/chunks/{chunk-ICOI4E4S.js → chunk-CPVI5J2L.js} +101 -23
  30. package/chunks/{chunk-GX7VH5JQ.js → chunk-FIQECJTQ.js} +1 -1
  31. package/chunks/{chunk-QCG6KPNM.js → chunk-H4ZDM3N6.js} +18039 -11622
  32. package/chunks/{chunk-SZOEIL6S.js → chunk-H6BD2ELD.js} +1 -0
  33. package/chunks/{chunk-JXAZUMDW.js → chunk-HA2UEYZP.js} +7 -4
  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-CNHFPN7T.js → chunk-JZFEL3RB.js} +1 -1
  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-AVW55ZCO.js → chunk-M5PJ5QAF.js} +37 -16
  41. package/chunks/{chunk-LR62TEET.js → chunk-NNIYWQIS.js} +1 -1
  42. package/chunks/chunk-OMX7CUOE.js +356 -0
  43. package/chunks/{chunk-HV3ZZ7G4.js → chunk-OT6JA3KQ.js} +2 -2
  44. package/chunks/{chunk-C6WMLUNB.js → chunk-QP4R5FTG.js} +1 -1
  45. package/chunks/chunk-QQDPRDVW.js +25 -0
  46. package/chunks/chunk-SFRV6BGY.js +243 -0
  47. package/chunks/{chunk-NW5QBUYO.js → chunk-TSBXGR73.js} +14 -14
  48. package/chunks/{chunk-7YKXFA3D.js → chunk-UOB6KPGG.js} +11 -11
  49. package/chunks/{chunk-USE2VQ5P.js → chunk-VU6A2OBJ.js} +41 -6
  50. package/chunks/{chunk-PAEBHDIO.js → chunk-VXHYMZXW.js} +1 -1
  51. package/chunks/{chunk-HGJPQK33.js → chunk-WPTCDQN6.js} +188 -534
  52. package/chunks/{chunk-WFVXF3OM.js → chunk-Z2Z3GUXZ.js} +1 -0
  53. package/chunks/{chunk-KC6ZMJ5X.js → chunk-ZMIBJS45.js} +1 -1
  54. package/chunks/chunk-ZOFNJQNJ.js +607 -0
  55. package/chunks/computer-use-7SEQDSHB.js +2052 -0
  56. package/chunks/contextCommand-KM5OWV65.js +53 -0
  57. package/chunks/cron-create-7CXEAJ2K.js +184 -0
  58. package/chunks/{cron-delete-ZGUXWBTG.js → cron-delete-2FQYYNQ6.js} +28 -5
  59. package/chunks/{cron-list-QNNZGMN3.js → cron-list-QCAJ73XE.js} +40 -7
  60. package/chunks/{de-YGKK2BC4.js → de-FGPM4KW5.js} +18 -1
  61. package/chunks/{devtools-IXE4UP72.js → devtools-FM6GJPYG.js} +1 -1
  62. package/chunks/{dist-R2SXPG74.js → dist-2UCAYOX7.js} +2 -2
  63. package/chunks/{dist-TE5QKMGR.js → dist-33LHH26D.js} +1 -1
  64. package/chunks/{dist-BXDUQ2QY.js → dist-KF43SZZV.js} +1 -1
  65. package/chunks/{dist-ZMQ4TXD5.js → dist-PF2IYSMD.js} +2 -2
  66. package/chunks/{edit-6UBTS2J5.js → edit-BMUKPLA7.js} +27 -28
  67. package/chunks/{en-HSQQNQUB.js → en-VP6XPGEC.js} +9 -2
  68. package/chunks/{enter-worktree-NN7LIXCM.js → enter-worktree-LXJ5WJ5A.js} +25 -24
  69. package/chunks/enterPlanMode-QWRZ54ZF.js +159 -0
  70. package/chunks/{exit-worktree-GGSS5KIE.js → exit-worktree-5HTQPNZO.js} +25 -24
  71. package/chunks/exitPlanMode-5WQAXNDA.js +743 -0
  72. package/chunks/{fr-JXBKPJKQ.js → fr-ATYBVCLT.js} +18 -1
  73. package/chunks/{geminiContentGenerator-I4H2NLJG.js → geminiContentGenerator-CAKHT5YE.js} +7 -7
  74. package/chunks/{getMachineId-bsd-F7GNPTER.js → getMachineId-bsd-4CASPIU4.js} +1 -1
  75. package/chunks/{getMachineId-darwin-T73DJL27.js → getMachineId-darwin-HPQPEMZR.js} +1 -1
  76. package/chunks/{getMachineId-linux-MKQTFPQM.js → getMachineId-linux-AUARKYHL.js} +1 -1
  77. package/chunks/{getMachineId-unsupported-MUR5KOQE.js → getMachineId-unsupported-S32ZDA2T.js} +1 -1
  78. package/chunks/{getMachineId-win-CDYFC6ZM.js → getMachineId-win-4EFLHYIJ.js} +1 -1
  79. package/chunks/{glob-OLCX57MD.js → glob-5DN6NSCD.js} +25 -24
  80. package/chunks/{grep-7HXIMDOW.js → grep-BJILOLCD.js} +37 -30
  81. package/chunks/{ja-TGPZSP2B.js → ja-W2QEA2OI.js} +18 -1
  82. package/chunks/{keychain-token-storage-LB46DAEK.js → keychain-token-storage-QSTRHKKL.js} +3 -3
  83. package/chunks/{ls-6PEZUK6O.js → ls-XVGXRYWD.js} +4 -4
  84. package/chunks/{lsp-JZSJOVT7.js → lsp-S6SHPULC.js} +3 -3
  85. package/chunks/{monitor-SQO7MVAV.js → monitor-SUEMSRN3.js} +25 -24
  86. package/chunks/{notebook-edit-72L3EBAL.js → notebook-edit-6F6Z5P6U.js} +26 -25
  87. package/chunks/{openaiContentGenerator-FTR7CDWF.js → openaiContentGenerator-DO27LL6O.js} +15 -15
  88. package/chunks/{pt-TIBG6BIO.js → pt-ZKEWJFBW.js} +18 -1
  89. package/chunks/{qwenContentGenerator-U5UFQ566.js → qwenContentGenerator-DQLGLQSH.js} +27 -26
  90. package/chunks/{qwenOAuth2-EFSECGHF.js → qwenOAuth2-KK433U33.js} +6 -5
  91. package/chunks/{read-file-UA64EEQC.js → read-file-3TBLYTOQ.js} +11 -11
  92. package/chunks/ripGrep-3INYT3QV.js +49 -0
  93. package/chunks/{ru-JBCHCK4L.js → ru-VEKTPJ74.js} +18 -1
  94. package/chunks/{scheduler-VBASHOCA.js → scheduler-23KQW6CX.js} +25 -24
  95. package/chunks/{send-message-OYJZ5TPG.js → send-message-SMNR5DBG.js} +3 -3
  96. package/chunks/{serve-A7E2OJDR.js → serve-Y5E4LKUI.js} +13164 -3840
  97. package/chunks/{shell-3NFOT6F5.js → shell-4H6XQXVY.js} +25 -24
  98. package/chunks/{skill-RA5YUREY.js → skill-SE6FECZR.js} +64 -113
  99. package/chunks/{src-NFCMARMT.js → src-76DUBH3A.js} +176 -44
  100. package/chunks/{syntheticOutput-DETQ2YM6.js → syntheticOutput-KMNF7YG6.js} +4 -4
  101. package/chunks/{task-create-Y3ZKTJIG.js → task-create-LIJHK75G.js} +8 -7
  102. package/chunks/{task-list-ONXJ3I3A.js → task-list-S4GNSILM.js} +7 -6
  103. package/chunks/{task-stop-UHDC4N5B.js → task-stop-3GBRYJHM.js} +3 -3
  104. package/chunks/{task-update-TCNOU3P5.js → task-update-F3UTVJMS.js} +21 -9
  105. package/chunks/{team-create-6SR4OVRG.js → team-create-Q5DTDDH4.js} +28 -26
  106. package/chunks/{team-delete-EJ4U4DDP.js → team-delete-54434EB7.js} +9 -6
  107. package/chunks/{todoWrite-TEYDRS5L.js → todoWrite-4ENGSBUX.js} +5 -5
  108. package/chunks/{tool-search-OD435A3X.js → tool-search-ABZMSDTU.js} +11 -11
  109. package/chunks/{web-fetch-6W67H5PO.js → web-fetch-RHZMF3MP.js} +5 -5
  110. package/chunks/workflow-NEMDQB75.js +1414 -0
  111. package/chunks/{write-file-475L5OPP.js → write-file-VAEHZPSL.js} +26 -25
  112. package/chunks/{zh-VCLWO26Y.js → zh-OIXDDQHB.js} +10 -3
  113. package/chunks/{zh-TW-G3HFHVVT.js → zh-TW-6YFNCKTA.js} +10 -3
  114. package/cli-entry.js +19 -0
  115. package/cli.js +11155 -6656
  116. package/examples/starter/QWEN.md +30 -0
  117. package/examples/starter/README.md +59 -0
  118. package/examples/starter/agents/diary.md +86 -0
  119. package/examples/starter/commands/writing/polish.md +13 -0
  120. package/examples/starter/example.ts +64 -0
  121. package/examples/starter/package.json +18 -0
  122. package/examples/starter/qwen-extension.json +12 -0
  123. package/examples/starter/skills/synonyms/SKILL.md +48 -0
  124. package/examples/starter/tsconfig.json +13 -0
  125. package/fzfWorker.js +1083 -0
  126. package/locales/ca.js +20 -2
  127. package/locales/de.js +21 -2
  128. package/locales/en.js +13 -4
  129. package/locales/fr.js +22 -2
  130. package/locales/ja.js +22 -2
  131. package/locales/pt.js +21 -2
  132. package/locales/ru.js +20 -2
  133. package/locales/zh-TW.js +11 -4
  134. package/locales/zh.js +11 -4
  135. package/package.json +5 -3
  136. package/chunks/agent-headless-APVHH7QM.js +0 -50
  137. package/chunks/chunk-AJIR24J2.js +0 -59
  138. package/chunks/chunk-SKBPNJEW.js +0 -45
  139. package/chunks/chunk-XBFVXFB2.js +0 -216
  140. package/chunks/computer-use-B7VIUI7F.js +0 -825
  141. package/chunks/contextCommand-63RZ3O5R.js +0 -52
  142. package/chunks/cron-create-FI5LJVUS.js +0 -140
  143. package/chunks/exitPlanMode-H323NHB2.js +0 -235
  144. package/chunks/ripGrep-WSYCWZVK.js +0 -48
  145. 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,7 +2,7 @@
2
2
  "use strict";
3
3
  import {
4
4
  ToolNames
5
- } from "./chunk-2ZTWI7KH.js";
5
+ } from "./chunk-6WPY6ES3.js";
6
6
  import {
7
7
  init_esbuild_shims
8
8
  } from "./chunk-A4BMJM77.js";
@@ -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,19 +2,19 @@
2
2
  "use strict";
3
3
  import {
4
4
  RequestTokenizer
5
- } from "./chunk-CWV3SJZS.js";
6
- import {
7
- createChildAbortController
8
- } from "./chunk-64WXLC72.js";
5
+ } from "./chunk-3NRO6NHX.js";
9
6
  import {
10
7
  OpenAIContentConverter,
11
8
  TaggedThinkingParser,
12
9
  openaiRequestCaptureContext
13
- } from "./chunk-ZK4AMNIU.js";
10
+ } from "./chunk-A3OEZT2F.js";
11
+ import {
12
+ createChildAbortController
13
+ } from "./chunk-64WXLC72.js";
14
14
  import {
15
15
  buildRuntimeFetchOptions,
16
16
  redactProxyError
17
- } from "./chunk-LR62TEET.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-Y7R6H6FT.js";
28
+ } from "./chunk-LYSND7KR.js";
29
29
  import {
30
30
  GenerateContentResponse
31
- } from "./chunk-BNESGOSJ.js";
31
+ } from "./chunk-55ZMG67I.js";
32
32
  import {
33
33
  createDebugLogger,
34
34
  isAbortError
35
- } from "./chunk-JXAZUMDW.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);
@@ -8127,6 +8146,8 @@ var ContentGenerationPipeline = class {
8127
8146
  if (isStreaming) {
8128
8147
  baseRequest.stream = true;
8129
8148
  baseRequest.stream_options = { include_usage: true };
8149
+ } else {
8150
+ baseRequest.stream = false;
8130
8151
  }
8131
8152
  if (request.config?.tools && request.config.tools.length > 0) {
8132
8153
  baseRequest.tools = await OpenAIContentConverter.convertGeminiToolsToOpenAI(
@@ -8267,7 +8288,7 @@ var ContentGenerationPipeline = class {
8267
8288
 
8268
8289
  // packages/core/src/core/openaiContentGenerator/errorHandler.ts
8269
8290
  init_esbuild_shims();
8270
- var debugLogger2 = createDebugLogger("OPENAI_ERROR");
8291
+ var debugLogger3 = createDebugLogger("OPENAI_ERROR");
8271
8292
  var EnhancedErrorHandler = class {
8272
8293
  constructor(shouldSuppressLogging = () => false) {
8273
8294
  this.shouldSuppressLogging = shouldSuppressLogging;
@@ -8284,7 +8305,7 @@ var EnhancedErrorHandler = class {
8284
8305
  isTimeoutError
8285
8306
  );
8286
8307
  if (!this.shouldSuppressErrorLogging(redactedError, request)) {
8287
- debugLogger2.error("OpenAI API Error:", errorMessage);
8308
+ debugLogger3.error("OpenAI API Error:", errorMessage);
8288
8309
  }
8289
8310
  if (isTimeoutError) {
8290
8311
  throw new Error(
@@ -8324,7 +8345,7 @@ ${tips.join("\n")}`;
8324
8345
  };
8325
8346
 
8326
8347
  // packages/core/src/core/openaiContentGenerator/openaiContentGenerator.ts
8327
- var debugLogger3 = createDebugLogger("OPENAI");
8348
+ var debugLogger4 = createDebugLogger("OPENAI");
8328
8349
  var OpenAIContentGenerator = class {
8329
8350
  static {
8330
8351
  __name(this, "OpenAIContentGenerator");
@@ -8367,7 +8388,7 @@ var OpenAIContentGenerator = class {
8367
8388
  totalTokens: result.totalTokens
8368
8389
  };
8369
8390
  } catch (error) {
8370
- debugLogger3.warn(
8391
+ debugLogger4.warn(
8371
8392
  "Failed to calculate tokens with new tokenizer, falling back to simple method:",
8372
8393
  error
8373
8394
  );
@@ -8414,7 +8435,7 @@ var OpenAIContentGenerator = class {
8414
8435
  };
8415
8436
  } catch (error) {
8416
8437
  const redactedError = redactProxyError(error);
8417
- debugLogger3.error("OpenAI API Embedding Error:", redactedError);
8438
+ debugLogger4.error("OpenAI API Embedding Error:", redactedError);
8418
8439
  throw new Error(
8419
8440
  `OpenAI API error: ${redactedError instanceof Error ? redactedError.message : String(redactedError)}`
8420
8441
  );
@@ -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
+ };
@@ -2,7 +2,7 @@
2
2
  "use strict";
3
3
  import {
4
4
  createTask
5
- } from "./chunk-HGJPQK33.js";
5
+ } from "./chunk-ZOFNJQNJ.js";
6
6
  import {
7
7
  resolveActiveTeamName
8
8
  } from "./chunk-LD2XBG6Z.js";
@@ -11,7 +11,7 @@ import {
11
11
  BaseToolInvocation,
12
12
  ToolDisplayNames,
13
13
  ToolNames
14
- } from "./chunk-2ZTWI7KH.js";
14
+ } from "./chunk-6WPY6ES3.js";
15
15
  import {
16
16
  init_esbuild_shims
17
17
  } from "./chunk-A4BMJM77.js";
@@ -2,7 +2,7 @@
2
2
  "use strict";
3
3
  import {
4
4
  getGlobalQwenDir
5
- } from "./chunk-USE2VQ5P.js";
5
+ } from "./chunk-VU6A2OBJ.js";
6
6
  import {
7
7
  init_esbuild_shims
8
8
  } 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
+ */