@mmmbuto/qwen-code-termux 0.16.1-termux → 0.18.0-termux

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 (185) hide show
  1. package/README.md +79 -109
  2. package/bundled/new-app/SKILL.md +22 -0
  3. package/bundled/qc-helper/SKILL.md +29 -24
  4. package/bundled/qc-helper/docs/_meta.ts +1 -0
  5. package/bundled/qc-helper/docs/configuration/_meta.ts +0 -3
  6. package/bundled/qc-helper/docs/configuration/settings.md +37 -31
  7. package/bundled/qc-helper/docs/configuration/themes.md +39 -0
  8. package/bundled/qc-helper/docs/features/_meta.ts +1 -3
  9. package/bundled/qc-helper/docs/features/approval-mode.md +35 -35
  10. package/bundled/qc-helper/docs/features/auto-mode.md +54 -9
  11. package/bundled/qc-helper/docs/features/channels/_meta.ts +1 -0
  12. package/bundled/qc-helper/docs/features/channels/feishu.md +170 -0
  13. package/bundled/qc-helper/docs/features/commands.md +115 -35
  14. package/bundled/qc-helper/docs/features/followup-suggestions.md +2 -2
  15. package/bundled/qc-helper/docs/features/headless.md +32 -0
  16. package/bundled/qc-helper/docs/features/markdown-rendering.md +21 -1
  17. package/bundled/qc-helper/docs/features/memory.md +22 -5
  18. package/bundled/qc-helper/docs/features/scheduled-tasks.md +1 -1
  19. package/bundled/qc-helper/docs/features/status-line.md +168 -32
  20. package/bundled/qc-helper/docs/features/sub-agents.md +60 -0
  21. package/bundled/qc-helper/docs/features/worktree.md +345 -0
  22. package/bundled/qc-helper/docs/overview.md +4 -4
  23. package/bundled/qc-helper/docs/quickstart.md +4 -4
  24. package/bundled/qc-helper/docs/qwen-serve-deploy-local.md +221 -0
  25. package/bundled/qc-helper/docs/qwen-serve.md +234 -24
  26. package/bundled/qc-helper/docs/reference/keyboard-shortcuts.md +16 -0
  27. package/bundled/qc-helper/docs/support/Uninstall.md +19 -1
  28. package/bundled/qc-helper/docs/support/troubleshooting.md +2 -1
  29. package/bundled/simplify/SKILL.md +123 -0
  30. package/chunks/agent-IDS4HMOX.js +56 -0
  31. package/chunks/agent-headless-5Q2EUSPS.js +50 -0
  32. package/chunks/{anthropicContentGenerator-SSGKR6DO.js → anthropicContentGenerator-2HBRNQ3B.js} +52 -9
  33. package/chunks/{askUserQuestion-PJWUUXKN.js → askUserQuestion-75TDJVK2.js} +45 -3
  34. package/chunks/{ca-UZ7BANMN.js → ca-BARBRL6N.js} +89 -5
  35. package/chunks/{chunk-GGNTZ2NH.js → chunk-2Y5SYSD3.js} +368 -597
  36. package/chunks/{chunk-2LA2TREA.js → chunk-3AA2DK35.js} +1448 -207
  37. package/chunks/{chunk-I2V5WXHJ.js → chunk-3AUHFMSK.js} +80 -38
  38. package/chunks/chunk-3DHXZ6EV.js +241 -0
  39. package/chunks/{chunk-PR4T27R7.js → chunk-3HTIVKZE.js} +42 -8
  40. package/chunks/chunk-3HX5LZ6R.js +1798 -0
  41. package/chunks/chunk-3PJXIDKI.js +2517 -0
  42. package/chunks/{chunk-MYAKAFEC.js → chunk-55ZMG67I.js} +7451 -3517
  43. package/chunks/{chunk-66CXYE4B.js → chunk-5IFG2VC4.js} +293 -242
  44. package/chunks/chunk-64WXLC72.js +98 -0
  45. package/chunks/{chunk-C6WMLUNB.js → chunk-72LDN5PP.js} +1 -1
  46. package/chunks/{chunk-F23NCRJ2.js → chunk-A7B4ISQP.js} +1 -1
  47. package/chunks/chunk-B7HXHOHU.js +393 -0
  48. package/chunks/{chunk-XEGHDASV.js → chunk-D3RHSPAS.js} +435 -540
  49. package/chunks/{chunk-XKS5KBFJ.js → chunk-EYENRK4D.js} +694 -384
  50. package/chunks/chunk-H6BD2ELD.js +36 -0
  51. package/chunks/{chunk-XP27SJMH.js → chunk-HR7SV7AY.js} +79 -48
  52. package/chunks/{chunk-D5NTAHYL.js → chunk-IDX6COTE.js} +7 -2
  53. package/chunks/{chunk-SHT4VJWU.js → chunk-IWKSG2AR.js} +2 -2
  54. package/chunks/chunk-J37FGIOA.js +1623 -0
  55. package/chunks/chunk-J5MDQKJL.js +2230 -0
  56. package/chunks/{chunk-USE2VQ5P.js → chunk-JTQAQBTV.js} +21 -0
  57. package/chunks/{chunk-NCTLV2NB.js → chunk-KQJMQJPI.js} +1 -1
  58. package/chunks/{chunk-5FBA5XC2.js → chunk-KRIHGKNA.js} +1 -1
  59. package/chunks/chunk-LD2XBG6Z.js +102 -0
  60. package/chunks/{chunk-MAY32HXD.js → chunk-M6VTDSVR.js} +3 -1
  61. package/chunks/chunk-MRO43B25.js +30 -0
  62. package/chunks/{chunk-N4WOREMD.js → chunk-NVFMZBX2.js} +43 -3
  63. package/chunks/chunk-OHEGWO4L.js +264 -0
  64. package/chunks/{chunk-K6O2NBMF.js → chunk-OQ7NJIY7.js} +4604 -6397
  65. package/chunks/chunk-QQDPRDVW.js +25 -0
  66. package/chunks/{chunk-KXZ4TJB4.js → chunk-SEGYWKIH.js} +1 -1
  67. package/chunks/chunk-SKBPNJEW.js +45 -0
  68. package/chunks/{chunk-4AOCVI6J.js → chunk-SNGELLWX.js} +52 -6
  69. package/chunks/{chunk-3OCRHZA3.js → chunk-TD4OPI4T.js} +56742 -44104
  70. package/chunks/{chunk-DQ4QTG7E.js → chunk-VV4F63BD.js} +11 -11
  71. package/chunks/chunk-XBY7E2FX.js +605 -0
  72. package/chunks/{chunk-JKMBWLFB.js → chunk-YILFYI5W.js} +48 -26
  73. package/chunks/chunk-YOGAOMYB.js +159 -0
  74. package/chunks/{chunk-QWSRH265.js → chunk-Z2Z3GUXZ.js} +777 -776
  75. package/chunks/{chunk-SDHRQFOS.js → chunk-ZTZ4DDQE.js} +2 -2
  76. package/chunks/computer-use-W2TYQNEE.js +825 -0
  77. package/chunks/contextCommand-6FGX3A7J.js +52 -0
  78. package/chunks/{cron-create-3ZBBN7WB.js → cron-create-APL5LU6I.js} +3 -3
  79. package/chunks/{cron-delete-NAGKKIIG.js → cron-delete-4SBJSCN4.js} +3 -3
  80. package/chunks/{cron-list-PAGRXNAI.js → cron-list-2AMGOMVO.js} +3 -3
  81. package/chunks/{de-V4IE2OOZ.js → de-YGKK2BC4.js} +89 -5
  82. package/chunks/{devtools-TWVXEJQB.js → devtools-FM6GJPYG.js} +2 -1
  83. package/chunks/{dist-4L54HRX2.js → dist-4LXD6L6X.js} +24 -5
  84. package/chunks/dist-H6ONXVLG.js +94146 -0
  85. package/chunks/{dist-XKWIWPWQ.js → dist-KAZ3SEBX.js} +1083 -3856
  86. package/chunks/{dist-BXDUQ2QY.js → dist-PK7DFCAW.js} +1 -1
  87. package/chunks/{edit-NVO3FOAK.js → edit-ZCEZC264.js} +30 -22
  88. package/chunks/{en-HGJ2SPLM.js → en-DHGYHIHX.js} +127 -6
  89. package/chunks/{enter-worktree-UEBG4WFC.js → enter-worktree-BBHCFCHG.js} +30 -20
  90. package/chunks/enterPlanMode-3M6KTD3B.js +158 -0
  91. package/chunks/{exit-worktree-UZ3MAQZN.js → exit-worktree-73YPIEQO.js} +27 -19
  92. package/chunks/exitPlanMode-TYZM6BAE.js +703 -0
  93. package/chunks/{fr-CJULI7ZX.js → fr-JXBKPJKQ.js} +89 -5
  94. package/chunks/{geminiContentGenerator-3UZFXGNT.js → geminiContentGenerator-7N2V3VW2.js} +8 -6
  95. package/chunks/{getMachineId-bsd-JXOSIJV2.js → getMachineId-bsd-4CASPIU4.js} +4 -4
  96. package/chunks/{getMachineId-darwin-TE4QRR42.js → getMachineId-darwin-HPQPEMZR.js} +4 -4
  97. package/chunks/{getMachineId-linux-S3OL52XK.js → getMachineId-linux-AUARKYHL.js} +3 -3
  98. package/chunks/{getMachineId-unsupported-DWUSBAPX.js → getMachineId-unsupported-S32ZDA2T.js} +3 -3
  99. package/chunks/{getMachineId-win-AAC5P3AP.js → getMachineId-win-4EFLHYIJ.js} +4 -4
  100. package/chunks/{glob-KNHSFFFG.js → glob-5XBCPQ2A.js} +27 -19
  101. package/chunks/{grep-LACWDZW4.js → grep-VIUU3A7X.js} +30 -19
  102. package/chunks/{ja-L7CHRQEW.js → ja-TGPZSP2B.js} +89 -5
  103. package/chunks/{keychain-token-storage-335UOLJ6.js → keychain-token-storage-6IU6ORQN.js} +3 -3
  104. package/chunks/{ls-AGXQOKSG.js → ls-JRGYIGLY.js} +4 -4
  105. package/chunks/{lsp-UDMUHNPA.js → lsp-SHMKFOAC.js} +3 -3
  106. package/chunks/{monitor-ETKWPJEH.js → monitor-6R4LIJL5.js} +40 -25
  107. package/chunks/{multipart-parser-3QWGTLK3.js → multipart-parser-AJ4WASWR.js} +2 -2
  108. package/chunks/{notebook-edit-QJJLPNYT.js → notebook-edit-5E7ULDVQ.js} +28 -20
  109. package/chunks/{openaiContentGenerator-CNNN424U.js → openaiContentGenerator-ZVHFKM3O.js} +17 -14
  110. package/chunks/{pt-M6JULLEQ.js → pt-TIBG6BIO.js} +89 -5
  111. package/chunks/{qwenContentGenerator-BOLCGK3R.js → qwenContentGenerator-B2VTVSPJ.js} +31 -23
  112. package/chunks/{qwenOAuth2-EEJGROP7.js → qwenOAuth2-2KCKWDCF.js} +6 -4
  113. package/chunks/read-file-GIT7BCDR.js +27 -0
  114. package/chunks/ripGrep-MWKFVYMS.js +48 -0
  115. package/chunks/{ru-QILM4HBC.js → ru-JBCHCK4L.js} +89 -5
  116. package/chunks/scheduler-5VOOYGBH.js +308 -0
  117. package/chunks/send-message-4QNWQJF4.js +244 -0
  118. package/chunks/{serve-OLSI7WSR.js → serve-MN6HZBWN.js} +14262 -7414
  119. package/chunks/shell-NQZQGFM2.js +56 -0
  120. package/chunks/{skill-D6YRHTTI.js → skill-WCFW4644.js} +145 -119
  121. package/chunks/{src-TMOD5X6F.js → src-7XL4G4DC.js} +88 -46
  122. package/chunks/{src-4QH4FZ6I.js → src-IHA6DTUV.js} +452 -62
  123. package/chunks/{syntheticOutput-5PVFDDJ4.js → syntheticOutput-YTYS2ZMQ.js} +4 -4
  124. package/chunks/task-create-MPORPYN6.js +19 -0
  125. package/chunks/task-list-R2YDYPZT.js +151 -0
  126. package/chunks/{task-stop-AJKPSR6R.js → task-stop-SYWJYBCM.js} +3 -3
  127. package/chunks/task-update-E4NSLKMQ.js +408 -0
  128. package/chunks/team-create-7R7KA5IP.js +314 -0
  129. package/chunks/team-delete-25OIWUPN.js +116 -0
  130. package/chunks/{todoWrite-VLAUG4CA.js → todoWrite-4YHMIF4X.js} +16 -5
  131. package/chunks/{tool-search-MZGHUUKD.js → tool-search-YBRVZCLI.js} +29 -11
  132. package/chunks/{tts-notification-K3X7X7MN.js → tts-notification-7SOEMQK4.js} +5 -4
  133. package/chunks/{web-fetch-OILB464A.js → web-fetch-MFIRHIHI.js} +5 -5
  134. package/chunks/workflow-5RIKVCIE.js +960 -0
  135. package/chunks/{write-file-BIQAA57V.js → write-file-DMQTJZOM.js} +32 -24
  136. package/chunks/{zh-PWL2NKY3.js → zh-7H5OQC4I.js} +135 -11
  137. package/chunks/{zh-TW-S3YGWICZ.js → zh-TW-P4IDHD3M.js} +128 -11
  138. package/cli.js +45402 -20570
  139. package/examples/agent/agents/diary.md +86 -0
  140. package/examples/agent/qwen-extension.json +5 -0
  141. package/examples/commands/commands/fs/grep-code.md +3 -0
  142. package/examples/commands/qwen-extension.json +5 -0
  143. package/examples/context/QWEN.md +8 -0
  144. package/examples/context/qwen-extension.json +5 -0
  145. package/examples/mcp-server/example.ts +60 -0
  146. package/examples/mcp-server/package.json +18 -0
  147. package/examples/mcp-server/qwen-extension.json +12 -0
  148. package/examples/mcp-server/tsconfig.json +13 -0
  149. package/examples/skills/qwen-extension.json +5 -0
  150. package/examples/skills/skills/synonyms/SKILL.md +48 -0
  151. package/examples/starter/QWEN.md +30 -0
  152. package/examples/starter/README.md +59 -0
  153. package/examples/starter/agents/diary.md +86 -0
  154. package/examples/starter/commands/writing/polish.md +13 -0
  155. package/examples/starter/example.ts +64 -0
  156. package/examples/starter/package.json +18 -0
  157. package/examples/starter/qwen-extension.json +12 -0
  158. package/examples/starter/skills/synonyms/SKILL.md +48 -0
  159. package/examples/starter/tsconfig.json +13 -0
  160. package/fzfWorker.js +1083 -0
  161. package/locales/ca.js +118 -5
  162. package/locales/de.js +117 -5
  163. package/locales/en.js +169 -7
  164. package/locales/fr.js +119 -5
  165. package/locales/ja.js +114 -5
  166. package/locales/pt.js +117 -5
  167. package/locales/ru.js +116 -5
  168. package/locales/zh-TW.js +161 -12
  169. package/locales/zh.js +169 -12
  170. package/package.json +4 -2
  171. package/scripts/postinstall.cjs +2 -1
  172. package/bundled/qc-helper/docs/features/checkpointing.md +0 -77
  173. package/chunks/agent-7ZN3CRHR.js +0 -48
  174. package/chunks/chunk-6PCB2DEF.js +0 -434
  175. package/chunks/chunk-EM6ETG2K.js +0 -60
  176. package/chunks/chunk-G7YTSRES.js +0 -150
  177. package/chunks/contextCommand-7IBASARL.js +0 -44
  178. package/chunks/exitPlanMode-PZAMWIRW.js +0 -227
  179. package/chunks/multipart-parser-IXGBIOIN.js +0 -384
  180. package/chunks/read-file-CCUEUFG2.js +0 -24
  181. package/chunks/ripGrep-TADOH2HK.js +0 -40
  182. package/chunks/send-message-YL44UZFC.js +0 -151
  183. package/chunks/shell-7KKKC5G7.js +0 -48
  184. package/chunks/src-IPWIHNMI.js +0 -1406
  185. package/chunks/undici-F6ZOXSS5.js +0 -8
@@ -2,16 +2,19 @@
2
2
  "use strict";
3
3
  import {
4
4
  RequestTokenizer
5
- } from "./chunk-SDHRQFOS.js";
6
- import {
7
- buildRuntimeFetchOptions,
8
- redactProxyError
9
- } from "./chunk-6PCB2DEF.js";
5
+ } from "./chunk-ZTZ4DDQE.js";
10
6
  import {
11
7
  OpenAIContentConverter,
12
8
  TaggedThinkingParser,
13
9
  openaiRequestCaptureContext
14
- } from "./chunk-K6O2NBMF.js";
10
+ } from "./chunk-OQ7NJIY7.js";
11
+ import {
12
+ createChildAbortController
13
+ } from "./chunk-64WXLC72.js";
14
+ import {
15
+ buildRuntimeFetchOptions,
16
+ redactProxyError
17
+ } from "./chunk-EYENRK4D.js";
15
18
  import {
16
19
  CAPPED_DEFAULT_MAX_TOKENS,
17
20
  DASHSCOPE_PROXY_BASE_URL,
@@ -22,14 +25,14 @@ import {
22
25
  runtimeDiagnostics,
23
26
  safeJsonParse,
24
27
  tokenLimit
25
- } from "./chunk-MAY32HXD.js";
28
+ } from "./chunk-M6VTDSVR.js";
26
29
  import {
27
30
  GenerateContentResponse
28
- } from "./chunk-MYAKAFEC.js";
31
+ } from "./chunk-55ZMG67I.js";
29
32
  import {
30
33
  createDebugLogger,
31
34
  isAbortError
32
- } from "./chunk-XP27SJMH.js";
35
+ } from "./chunk-HR7SV7AY.js";
33
36
  import {
34
37
  init_esbuild_shims
35
38
  } from "./chunk-A4BMJM77.js";
@@ -7074,6 +7077,7 @@ var DashScopeOpenAICompatibleProvider = class _DashScopeOpenAICompatibleProvider
7074
7077
  /**
7075
7078
  * Determines whether to use the DashScope-compatible provider.
7076
7079
  * Covers dashscope.aliyuncs.com, dashscope-intl.aliyuncs.com,
7080
+ * Token Plan endpoints under token-plan.<region>.maas.aliyuncs.com,
7077
7081
  * internal Alibaba domains (*.alibaba-inc.com, *.aliyun-inc.com),
7078
7082
  * and proxy matches.
7079
7083
  *
@@ -7093,12 +7097,13 @@ var DashScopeOpenAICompatibleProvider = class _DashScopeOpenAICompatibleProvider
7093
7097
  hostname = null;
7094
7098
  }
7095
7099
  const isDashscopeOrigin = hostname !== null && (hostname === "dashscope.aliyuncs.com" || hostname === "dashscope-intl.aliyuncs.com" || hostname.endsWith(".dashscope.aliyuncs.com") || hostname.endsWith(".dashscope-intl.aliyuncs.com"));
7100
+ const isTokenPlanOrigin = hostname !== null && hostname.startsWith("token-plan.") && hostname.endsWith(".maas.aliyuncs.com");
7096
7101
  const isInternalOrigin = hostname !== null && (hostname.endsWith(".alibaba-inc.com") || hostname.endsWith(".aliyun-inc.com"));
7097
7102
  const normalizedProxyUrl = DASHSCOPE_PROXY_BASE_URL?.endsWith("/") ? DASHSCOPE_PROXY_BASE_URL.slice(0, -1) : DASHSCOPE_PROXY_BASE_URL;
7098
7103
  const isProxyMatch = Boolean(
7099
7104
  normalizedProxyUrl && normalizedBaseUrl.toLowerCase() === normalizedProxyUrl.toLowerCase()
7100
7105
  );
7101
- if (normalizedProxyUrl && !isDashscopeOrigin && !isInternalOrigin && !isProxyMatch) {
7106
+ if (normalizedProxyUrl && !isDashscopeOrigin && !isTokenPlanOrigin && !isInternalOrigin && !isProxyMatch) {
7102
7107
  debugLogger.debug(
7103
7108
  `DASHSCOPE_PROXY_BASE_URL is configured but the request baseUrl does not match. DashScope headers/cache control will be skipped.`
7104
7109
  );
@@ -7108,7 +7113,7 @@ var DashScopeOpenAICompatibleProvider = class _DashScopeOpenAICompatibleProvider
7108
7113
  `DashScope provider activated via internal origin: ${hostname}`
7109
7114
  );
7110
7115
  }
7111
- return isDashscopeOrigin || isInternalOrigin || isProxyMatch;
7116
+ return isDashscopeOrigin || isTokenPlanOrigin || isInternalOrigin || isProxyMatch;
7112
7117
  }
7113
7118
  buildHeaders() {
7114
7119
  const version = this.cliConfig.getCliVersion() || "unknown";
@@ -7285,8 +7290,12 @@ var DashScopeOpenAICompatibleProvider = class _DashScopeOpenAICompatibleProvider
7285
7290
  // qwen-vl-max, qwen-vl-max-latest, etc.
7286
7291
  "qwen3-vl-plus",
7287
7292
  // qwen3-vl-plus variants
7288
- "qwen3.5-plus"
7293
+ "qwen3.5-plus",
7289
7294
  // qwen3.5-plus (has built-in vision capabilities)
7295
+ "qwen3.6-plus",
7296
+ // qwen3.6-plus (multimodal)
7297
+ "qwen3.7-plus"
7298
+ // qwen3.7-plus (multimodal)
7290
7299
  ];
7291
7300
  isVisionModel(model) {
7292
7301
  if (!model) {
@@ -7596,7 +7605,6 @@ var MiMoOpenAICompatibleProvider = class extends DefaultOpenAICompatibleProvider
7596
7605
 
7597
7606
  // packages/core/src/core/openaiContentGenerator/pipeline.ts
7598
7607
  init_esbuild_shims();
7599
- import { setMaxListeners } from "node:events";
7600
7608
 
7601
7609
  // packages/core/src/core/openaiContentGenerator/streamingToolCallParser.ts
7602
7610
  init_esbuild_shims();
@@ -7913,10 +7921,6 @@ var StreamingToolCallParser = class {
7913
7921
  };
7914
7922
 
7915
7923
  // packages/core/src/core/openaiContentGenerator/pipeline.ts
7916
- function raiseAbortListenerCap(signal) {
7917
- if (signal) setMaxListeners(0, signal);
7918
- }
7919
- __name(raiseAbortListenerCap, "raiseAbortListenerCap");
7920
7924
  var StreamContentError = class extends Error {
7921
7925
  static {
7922
7926
  __name(this, "StreamContentError");
@@ -7938,40 +7942,66 @@ var ContentGenerationPipeline = class {
7938
7942
  client;
7939
7943
  contentGeneratorConfig;
7940
7944
  async execute(request, userPromptId) {
7941
- raiseAbortListenerCap(request.config?.abortSignal);
7942
7945
  return this.executeWithErrorHandling(
7943
7946
  request,
7944
7947
  userPromptId,
7945
7948
  false,
7946
7949
  async (openaiRequest, context) => {
7947
- const openaiResponse = await this.client.chat.completions.create(
7948
- openaiRequest,
7949
- {
7950
- signal: request.config?.abortSignal
7951
- }
7952
- );
7953
- const geminiResponse = OpenAIContentConverter.convertOpenAIResponseToGemini(
7954
- openaiResponse,
7955
- context
7956
- );
7957
- return geminiResponse;
7950
+ const parentSignal = request.config?.abortSignal;
7951
+ const perRequestAc = parentSignal ? createChildAbortController(parentSignal) : void 0;
7952
+ try {
7953
+ const openaiResponse = await this.client.chat.completions.create(
7954
+ openaiRequest,
7955
+ {
7956
+ signal: perRequestAc?.signal
7957
+ }
7958
+ );
7959
+ const geminiResponse = OpenAIContentConverter.convertOpenAIResponseToGemini(
7960
+ openaiResponse,
7961
+ context
7962
+ );
7963
+ return geminiResponse;
7964
+ } finally {
7965
+ perRequestAc?.abort();
7966
+ }
7958
7967
  }
7959
7968
  );
7960
7969
  }
7961
7970
  async executeStream(request, userPromptId) {
7962
- raiseAbortListenerCap(request.config?.abortSignal);
7963
7971
  return this.executeWithErrorHandling(
7964
7972
  request,
7965
7973
  userPromptId,
7966
7974
  true,
7967
7975
  async (openaiRequest, context) => {
7968
- const stream = await this.client.chat.completions.create(
7969
- openaiRequest,
7970
- {
7971
- signal: request.config?.abortSignal
7972
- }
7976
+ const parentSignal = request.config?.abortSignal;
7977
+ const perRequestAc = parentSignal ? createChildAbortController(parentSignal) : void 0;
7978
+ let stream;
7979
+ try {
7980
+ stream = await this.client.chat.completions.create(openaiRequest, {
7981
+ signal: perRequestAc?.signal
7982
+ });
7983
+ } catch (e) {
7984
+ perRequestAc?.abort();
7985
+ throw e;
7986
+ }
7987
+ if (!perRequestAc) {
7988
+ return this.processStreamWithLogging(stream, context, request);
7989
+ }
7990
+ const ac = perRequestAc;
7991
+ const innerStream = this.processStreamWithLogging(
7992
+ stream,
7993
+ context,
7994
+ request
7973
7995
  );
7974
- return this.processStreamWithLogging(stream, context, request);
7996
+ async function* drainThenCleanup() {
7997
+ try {
7998
+ yield* innerStream;
7999
+ } finally {
8000
+ ac.abort();
8001
+ }
8002
+ }
8003
+ __name(drainThenCleanup, "drainThenCleanup");
8004
+ return drainThenCleanup();
7975
8005
  }
7976
8006
  );
7977
8007
  }
@@ -8097,6 +8127,8 @@ var ContentGenerationPipeline = class {
8097
8127
  if (isStreaming) {
8098
8128
  baseRequest.stream = true;
8099
8129
  baseRequest.stream_options = { include_usage: true };
8130
+ } else {
8131
+ baseRequest.stream = false;
8100
8132
  }
8101
8133
  if (request.config?.tools && request.config.tools.length > 0) {
8102
8134
  baseRequest.tools = await OpenAIContentConverter.convertGeminiToolsToOpenAI(
@@ -8111,7 +8143,10 @@ var ContentGenerationPipeline = class {
8111
8143
  const reasoningDisabled = request.config?.thinkingConfig?.includeThoughts === false || this.contentGeneratorConfig.reasoning === false;
8112
8144
  if (reasoningDisabled) {
8113
8145
  const typed = providerRequest;
8114
- if ("enable_thinking" in typed) {
8146
+ const model = (context.model ?? "").toLowerCase();
8147
+ if (DashScopeOpenAICompatibleProvider.isDashScopeProvider(
8148
+ this.contentGeneratorConfig
8149
+ ) && (model.startsWith("qwen") || model === "coder-model")) {
8115
8150
  typed["enable_thinking"] = false;
8116
8151
  }
8117
8152
  if ("reasoning" in typed) {
@@ -8217,7 +8252,14 @@ var ContentGenerationPipeline = class {
8217
8252
  model: effectiveModel,
8218
8253
  modalities: this.contentGeneratorConfig.modalities ?? {},
8219
8254
  startTime: Date.now(),
8220
- splitToolMedia: providerOverrides.splitToolMedia ?? this.contentGeneratorConfig.splitToolMedia ?? false,
8255
+ splitToolMedia: providerOverrides.splitToolMedia ?? this.contentGeneratorConfig.splitToolMedia ?? // Default true: the OpenAI Chat Completions spec only permits text on
8256
+ // `role: "tool"` messages, so tool-returned media (e.g. an image read
8257
+ // by read_file) embedded there is silently dropped or rejected by
8258
+ // strict providers (doubao / new-api / LM Studio) and the model never
8259
+ // sees it (QwenLM/qwen-code#4876). Splitting it into a follow-up user
8260
+ // message is spec-compliant and safe for permissive providers too.
8261
+ // Opt out via generationConfig.splitToolMedia = false.
8262
+ true,
8221
8263
  ...toolCallParser ? { toolCallParser } : {},
8222
8264
  ...responseParsingOptions ? { responseParsingOptions } : {},
8223
8265
  ...taggedThinkingParser ? { taggedThinkingParser } : {}
@@ -0,0 +1,241 @@
1
+ // Force strict mode and setup for ESM
2
+ "use strict";
3
+ import {
4
+ Mutex,
5
+ getInboxesDir,
6
+ require_proper_lockfile
7
+ } from "./chunk-J5MDQKJL.js";
8
+ import {
9
+ atomicWriteJSON
10
+ } from "./chunk-B7HXHOHU.js";
11
+ import {
12
+ createDebugLogger,
13
+ isNodeError
14
+ } from "./chunk-HR7SV7AY.js";
15
+ import {
16
+ init_esbuild_shims
17
+ } from "./chunk-A4BMJM77.js";
18
+ import {
19
+ __name,
20
+ __toESM
21
+ } from "./chunk-J2S4EL5Y.js";
22
+
23
+ // packages/core/src/agents/team/leaderPermissionBridge.ts
24
+ init_esbuild_shims();
25
+ var leaderCallbacks = null;
26
+ function registerLeader(callbacks) {
27
+ leaderCallbacks = callbacks;
28
+ }
29
+ __name(registerLeader, "registerLeader");
30
+ function getLeader() {
31
+ return leaderCallbacks;
32
+ }
33
+ __name(getLeader, "getLeader");
34
+ function unregisterLeader() {
35
+ leaderCallbacks = null;
36
+ }
37
+ __name(unregisterLeader, "unregisterLeader");
38
+ function forwardApproval(teammateName, teammateColor, details) {
39
+ if (!leaderCallbacks) {
40
+ return false;
41
+ }
42
+ leaderCallbacks.enqueueApproval({
43
+ teammateName,
44
+ teammateColor,
45
+ details
46
+ });
47
+ return true;
48
+ }
49
+ __name(forwardApproval, "forwardApproval");
50
+ function wrapConfirmWithBadge(original, teammateName, respond, _teammateColor) {
51
+ return {
52
+ ...original,
53
+ title: `[${teammateName}] ${original.title}`,
54
+ onConfirm: /* @__PURE__ */ __name(async (outcome, payload) => {
55
+ await respond(outcome, payload);
56
+ }, "onConfirm")
57
+ };
58
+ }
59
+ __name(wrapConfirmWithBadge, "wrapConfirmWithBadge");
60
+
61
+ // packages/core/src/agents/team/mailbox.ts
62
+ init_esbuild_shims();
63
+ var import_proper_lockfile = __toESM(require_proper_lockfile(), 1);
64
+ import * as fs from "node:fs/promises";
65
+ import * as path from "node:path";
66
+ var debug = createDebugLogger("AGENTS_TEAM_MAILBOX");
67
+ var LOCK_OPTIONS = {
68
+ retries: {
69
+ retries: 10,
70
+ minTimeout: 5,
71
+ maxTimeout: 100,
72
+ factor: 2,
73
+ // Jitter the backoff so cross-process contenders don't retry in
74
+ // lockstep (thundering herd) and starve each other out of the
75
+ // retry budget.
76
+ randomize: true
77
+ },
78
+ stale: 5e3,
79
+ // Stale locks from crashed processes are expected in multi-agent
80
+ // scenarios; log at debug level for traceability without noise.
81
+ onCompromised: /* @__PURE__ */ __name((err) => {
82
+ debug.debug("mailbox lock compromised:", err?.message ?? err);
83
+ }, "onCompromised")
84
+ };
85
+ var inboxLocks = /* @__PURE__ */ new Map();
86
+ function getInboxLock(inboxPath) {
87
+ let lock = inboxLocks.get(inboxPath);
88
+ if (!lock) {
89
+ lock = new Mutex();
90
+ inboxLocks.set(inboxPath, lock);
91
+ }
92
+ return lock;
93
+ }
94
+ __name(getInboxLock, "getInboxLock");
95
+ function disposeInboxLocks(teamName) {
96
+ const dir = getInboxesDir(teamName);
97
+ let evicted = 0;
98
+ for (const key of inboxLocks.keys()) {
99
+ if (path.dirname(key) === dir) {
100
+ inboxLocks.delete(key);
101
+ evicted++;
102
+ }
103
+ }
104
+ return evicted;
105
+ }
106
+ __name(disposeInboxLocks, "disposeInboxLocks");
107
+ async function withInboxLock(inboxPath, fn) {
108
+ return getInboxLock(inboxPath).runExclusive(async () => {
109
+ const release = await import_proper_lockfile.default.lock(inboxPath, LOCK_OPTIONS);
110
+ try {
111
+ return await fn();
112
+ } finally {
113
+ await release();
114
+ }
115
+ });
116
+ }
117
+ __name(withInboxLock, "withInboxLock");
118
+ function getInboxPath(teamName, agentName) {
119
+ return path.join(getInboxesDir(teamName), `${agentName}.json`);
120
+ }
121
+ __name(getInboxPath, "getInboxPath");
122
+ async function readInbox(teamName, agentName) {
123
+ const inboxPath = getInboxPath(teamName, agentName);
124
+ try {
125
+ const raw = await fs.readFile(inboxPath, "utf-8");
126
+ return JSON.parse(raw);
127
+ } catch (err) {
128
+ if (isNodeError(err) && err.code === "ENOENT") return [];
129
+ throw err;
130
+ }
131
+ }
132
+ __name(readInbox, "readInbox");
133
+ var READ_RETENTION_MS = 5 * 60 * 1e3;
134
+ async function writeMessage(teamName, toAgentName, message) {
135
+ const inboxPath = getInboxPath(teamName, toAgentName);
136
+ await ensureInboxFile(inboxPath);
137
+ await withInboxLock(inboxPath, async () => {
138
+ const messages = await readInboxRaw(inboxPath);
139
+ const cutoff = Date.now() - READ_RETENTION_MS;
140
+ const compacted = messages.filter((m) => {
141
+ if (!m.read) return true;
142
+ const ts = Date.parse(m.timestamp);
143
+ return Number.isNaN(ts) || ts >= cutoff;
144
+ });
145
+ compacted.push(message);
146
+ await atomicWriteJSON(inboxPath, compacted);
147
+ });
148
+ }
149
+ __name(writeMessage, "writeMessage");
150
+ async function consumeUnread(teamName, agentName, type) {
151
+ const inboxPath = getInboxPath(teamName, agentName);
152
+ await ensureInboxFile(inboxPath);
153
+ return withInboxLock(inboxPath, async () => {
154
+ const messages = await readInboxRaw(inboxPath);
155
+ const predicate = /* @__PURE__ */ __name((m) => !m.read && (type === void 0 || m.type === type), "predicate");
156
+ const matching = messages.filter(predicate);
157
+ if (matching.length === 0) return [];
158
+ const updated = messages.map(
159
+ (m) => predicate(m) ? { ...m, read: true } : m
160
+ );
161
+ await atomicWriteJSON(inboxPath, updated);
162
+ return matching;
163
+ });
164
+ }
165
+ __name(consumeUnread, "consumeUnread");
166
+ async function clearInbox(teamName, agentName) {
167
+ const inboxPath = getInboxPath(teamName, agentName);
168
+ try {
169
+ await fs.unlink(inboxPath);
170
+ } catch (err) {
171
+ if (!isNodeError(err) || err.code !== "ENOENT") throw err;
172
+ }
173
+ }
174
+ __name(clearInbox, "clearInbox");
175
+ async function clearAllInboxes(teamName) {
176
+ const dir = getInboxesDir(teamName);
177
+ await fs.rm(dir, { recursive: true, force: true });
178
+ disposeInboxLocks(teamName);
179
+ }
180
+ __name(clearAllInboxes, "clearAllInboxes");
181
+ async function sendStructuredMessage(teamName, toAgentName, opts) {
182
+ await writeMessage(teamName, toAgentName, {
183
+ from: opts.from,
184
+ text: opts.text,
185
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
186
+ read: false,
187
+ type: opts.type,
188
+ color: opts.color,
189
+ summary: opts.summary
190
+ });
191
+ }
192
+ __name(sendStructuredMessage, "sendStructuredMessage");
193
+ async function ensureInboxFile(inboxPath) {
194
+ await fs.mkdir(path.dirname(inboxPath), { recursive: true });
195
+ try {
196
+ await fs.writeFile(inboxPath, "[]\n", { flag: "wx" });
197
+ } catch (err) {
198
+ if (!isNodeError(err) || err.code !== "EEXIST") throw err;
199
+ }
200
+ }
201
+ __name(ensureInboxFile, "ensureInboxFile");
202
+ async function readInboxRaw(inboxPath) {
203
+ try {
204
+ const raw = await fs.readFile(inboxPath, "utf-8");
205
+ return JSON.parse(raw);
206
+ } catch (err) {
207
+ if (isNodeError(err) && err.code === "ENOENT") return [];
208
+ const errMsg = err instanceof Error ? err.message : String(err);
209
+ debug.warn(`Quarantining corrupt inbox at ${inboxPath}: ${errMsg}`);
210
+ try {
211
+ await fs.rename(inboxPath, `${inboxPath}.corrupt-${Date.now()}`);
212
+ } catch (renameErr) {
213
+ const renameMsg = renameErr instanceof Error ? renameErr.message : String(renameErr);
214
+ debug.warn(`Failed to quarantine ${inboxPath}: ${renameMsg}`);
215
+ throw err instanceof Error ? err : new Error(`Failed to read inbox at ${inboxPath}: ${errMsg}`);
216
+ }
217
+ return [];
218
+ }
219
+ }
220
+ __name(readInboxRaw, "readInboxRaw");
221
+
222
+ export {
223
+ registerLeader,
224
+ getLeader,
225
+ unregisterLeader,
226
+ forwardApproval,
227
+ wrapConfirmWithBadge,
228
+ disposeInboxLocks,
229
+ getInboxPath,
230
+ readInbox,
231
+ writeMessage,
232
+ consumeUnread,
233
+ clearInbox,
234
+ clearAllInboxes,
235
+ sendStructuredMessage
236
+ };
237
+ /**
238
+ * @license
239
+ * Copyright 2025 Qwen
240
+ * SPDX-License-Identifier: Apache-2.0
241
+ */
@@ -3,8 +3,9 @@
3
3
  import {
4
4
  QWEN_DIR,
5
5
  Storage,
6
+ resolvePath,
6
7
  sanitizeCwd
7
- } from "./chunk-XP27SJMH.js";
8
+ } from "./chunk-HR7SV7AY.js";
8
9
  import {
9
10
  init_esbuild_shims
10
11
  } from "./chunk-A4BMJM77.js";
@@ -21,6 +22,7 @@ var AUTO_MEMORY_INDEX_FILENAME = "MEMORY.md";
21
22
  var AUTO_MEMORY_METADATA_FILENAME = "meta.json";
22
23
  var AUTO_MEMORY_EXTRACT_CURSOR_FILENAME = "extract-cursor.json";
23
24
  var AUTO_MEMORY_CONSOLIDATION_LOCK_FILENAME = "consolidation.lock";
25
+ var USER_AUTO_MEMORY_DIRNAME = "memories";
24
26
  function findGitRoot(startPath) {
25
27
  let current = path.resolve(startPath);
26
28
  while (true) {
@@ -74,28 +76,31 @@ function findCanonicalGitRoot(startPath) {
74
76
  __name(findCanonicalGitRoot, "findCanonicalGitRoot");
75
77
  function getMemoryBaseDir() {
76
78
  if (process.env["QWEN_CODE_MEMORY_BASE_DIR"]) {
77
- return process.env["QWEN_CODE_MEMORY_BASE_DIR"];
79
+ return resolvePath(void 0, process.env["QWEN_CODE_MEMORY_BASE_DIR"]);
78
80
  }
79
- return Storage.getGlobalQwenDir();
81
+ return Storage.getRuntimeBaseDir();
80
82
  }
81
83
  __name(getMemoryBaseDir, "getMemoryBaseDir");
82
84
  var _autoMemoryRootCache = /* @__PURE__ */ new Map();
83
85
  function getAutoMemoryRoot(projectRoot) {
84
- const cached = _autoMemoryRootCache.get(projectRoot);
86
+ const useLocalMemory = process.env["QWEN_CODE_MEMORY_LOCAL"] === "1";
87
+ const memoryBaseDir = useLocalMemory ? "" : getMemoryBaseDir();
88
+ const cacheKey = `${useLocalMemory ? "local" : memoryBaseDir}\0${projectRoot}`;
89
+ const cached = _autoMemoryRootCache.get(cacheKey);
85
90
  if (cached !== void 0) return cached;
86
91
  let result;
87
- if (process.env["QWEN_CODE_MEMORY_LOCAL"] === "1") {
92
+ if (useLocalMemory) {
88
93
  result = path.join(projectRoot, QWEN_DIR, AUTO_MEMORY_DIRNAME);
89
94
  } else {
90
95
  const canonicalRoot = findCanonicalGitRoot(projectRoot) ?? path.resolve(projectRoot);
91
96
  result = path.join(
92
- getMemoryBaseDir(),
97
+ memoryBaseDir,
93
98
  "projects",
94
99
  sanitizeCwd(canonicalRoot),
95
100
  AUTO_MEMORY_DIRNAME
96
101
  );
97
102
  }
98
- _autoMemoryRootCache.set(projectRoot, result);
103
+ _autoMemoryRootCache.set(cacheKey, result);
99
104
  return result;
100
105
  }
101
106
  __name(getAutoMemoryRoot, "getAutoMemoryRoot");
@@ -154,6 +159,29 @@ function getAutoMemoryFilePath(projectRoot, relativePath) {
154
159
  return path.join(getAutoMemoryRoot(projectRoot), relativePath);
155
160
  }
156
161
  __name(getAutoMemoryFilePath, "getAutoMemoryFilePath");
162
+ function getUserAutoMemoryRoot() {
163
+ return path.join(getMemoryBaseDir(), USER_AUTO_MEMORY_DIRNAME);
164
+ }
165
+ __name(getUserAutoMemoryRoot, "getUserAutoMemoryRoot");
166
+ function getUserAutoMemoryIndexPath() {
167
+ return path.join(getUserAutoMemoryRoot(), AUTO_MEMORY_INDEX_FILENAME);
168
+ }
169
+ __name(getUserAutoMemoryIndexPath, "getUserAutoMemoryIndexPath");
170
+ function getUserAutoMemoryTopicPath(type) {
171
+ return path.join(getUserAutoMemoryRoot(), getAutoMemoryTopicFilename(type));
172
+ }
173
+ __name(getUserAutoMemoryTopicPath, "getUserAutoMemoryTopicPath");
174
+ function isUserAutoMemPath(absolutePath) {
175
+ const normalizedPath = path.normalize(absolutePath);
176
+ const memRoot = path.normalize(getUserAutoMemoryRoot());
177
+ const rel = path.relative(memRoot, normalizedPath);
178
+ return rel === "" || !rel.startsWith("..") && !path.isAbsolute(rel);
179
+ }
180
+ __name(isUserAutoMemPath, "isUserAutoMemPath");
181
+ function isAnyAutoMemPath(absolutePath, projectRoot) {
182
+ return isAutoMemPath(absolutePath, projectRoot) || isUserAutoMemPath(absolutePath);
183
+ }
184
+ __name(isAnyAutoMemPath, "isAnyAutoMemPath");
157
185
 
158
186
  export {
159
187
  AUTO_MEMORY_DIRNAME,
@@ -161,6 +189,7 @@ export {
161
189
  AUTO_MEMORY_METADATA_FILENAME,
162
190
  AUTO_MEMORY_EXTRACT_CURSOR_FILENAME,
163
191
  AUTO_MEMORY_CONSOLIDATION_LOCK_FILENAME,
192
+ USER_AUTO_MEMORY_DIRNAME,
164
193
  getMemoryBaseDir,
165
194
  getAutoMemoryRoot,
166
195
  clearAutoMemoryRootCache,
@@ -172,7 +201,12 @@ export {
172
201
  getAutoMemoryConsolidationLockPath,
173
202
  getAutoMemoryTopicFilename,
174
203
  getAutoMemoryTopicPath,
175
- getAutoMemoryFilePath
204
+ getAutoMemoryFilePath,
205
+ getUserAutoMemoryRoot,
206
+ getUserAutoMemoryIndexPath,
207
+ getUserAutoMemoryTopicPath,
208
+ isUserAutoMemPath,
209
+ isAnyAutoMemPath
176
210
  };
177
211
  /**
178
212
  * @license