@qwen-code/qwen-code 0.15.12-preview.2 → 0.16.0-nightly.20260522.48b0a8bfc

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 (97) hide show
  1. package/bundled/qc-helper/docs/configuration/settings.md +69 -71
  2. package/bundled/qc-helper/docs/features/_meta.ts +2 -0
  3. package/bundled/qc-helper/docs/features/approval-mode.md +119 -2
  4. package/bundled/qc-helper/docs/features/auto-mode.md +263 -0
  5. package/bundled/qc-helper/docs/features/commands.md +11 -10
  6. package/bundled/qc-helper/docs/features/lsp.md +87 -10
  7. package/bundled/qc-helper/docs/features/skills.md +3 -0
  8. package/bundled/qc-helper/docs/features/structured-output.md +309 -0
  9. package/bundled/qc-helper/docs/features/sub-agents.md +47 -5
  10. package/bundled/qc-helper/docs/qwen-serve.md +179 -24
  11. package/bundled/qc-helper/docs/reference/keyboard-shortcuts.md +11 -11
  12. package/bundled/review/SKILL.md +12 -3
  13. package/bundled/stuck/SKILL.md +124 -0
  14. package/chunks/{agent-UQY6A6OS.js → agent-GRCSD6XI.js} +15 -17
  15. package/chunks/{anthropicContentGenerator-4QE6LTVV.js → anthropicContentGenerator-RQJNXJIY.js} +7 -4
  16. package/chunks/{askUserQuestion-QFSCBTUO.js → askUserQuestion-PQPMPNM3.js} +2 -2
  17. package/chunks/{ca-VQSV6JHA.js → ca-UZ7BANMN.js} +29 -3
  18. package/chunks/{chunk-B7ZL7HUA.js → chunk-4AOCVI6J.js} +2 -1
  19. package/chunks/{chunk-PCL3EJGY.js → chunk-4U3O4VDA.js} +4722 -3823
  20. package/chunks/{chunk-AEJ2DKLP.js → chunk-C6WMLUNB.js} +1 -1
  21. package/chunks/{chunk-FSYKVGER.js → chunk-C7PY32RJ.js} +115 -23
  22. package/chunks/{chunk-JMZQICAL.js → chunk-CAVZVZX6.js} +2 -2
  23. package/chunks/{chunk-CAWKL3UC.js → chunk-CSWBPY3P.js} +2 -2
  24. package/chunks/{chunk-G27O2LD2.js → chunk-D5NTAHYL.js} +1 -1
  25. package/chunks/{chunk-BXNCPI75.js → chunk-DMIMF3CG.js} +2 -2
  26. package/chunks/{chunk-OCC4MZRS.js → chunk-F23NCRJ2.js} +1 -1
  27. package/chunks/{chunk-SOIEFHIK.js → chunk-G7YTSRES.js} +1 -100
  28. package/chunks/{chunk-SQNQIOD5.js → chunk-GGNTZ2NH.js} +92 -21
  29. package/chunks/{chunk-FKVKVE6N.js → chunk-KXZ4TJB4.js} +1 -1
  30. package/chunks/{chunk-CBVB66WY.js → chunk-L5E26RN6.js} +2 -2
  31. package/chunks/{chunk-UXW7MYAW.js → chunk-MAY32HXD.js} +376 -1
  32. package/chunks/{chunk-2WFU3IUH.js → chunk-OZO6R4KI.js} +11796 -4086
  33. package/chunks/{chunk-CM2IESUE.js → chunk-PR4T27R7.js} +1 -1
  34. package/chunks/{chunk-FYMSCRHM.js → chunk-PVVL5Q3W.js} +32 -1
  35. package/chunks/{chunk-MXBWOU2L.js → chunk-TM4RMEYN.js} +17 -349
  36. package/chunks/{chunk-YHEAJFCI.js → chunk-USE2VQ5P.js} +3 -0
  37. package/chunks/chunk-UY2AYRZF.js +19126 -0
  38. package/chunks/{chunk-GJXIKCKL.js → chunk-XP27SJMH.js} +76 -5
  39. package/chunks/chunk-XTYIPAUG.js +379 -0
  40. package/chunks/{chunk-TPGOGCWM.js → chunk-YJLGXDQJ.js} +1 -1
  41. package/chunks/{contextCommand-MQRG6RMG.js → contextCommand-O2OLCMOG.js} +17 -19
  42. package/chunks/{cron-create-WUTD5ZTH.js → cron-create-IGYXQVG4.js} +28 -2
  43. package/chunks/{cron-delete-N3UQYCRA.js → cron-delete-ETKIZCWT.js} +2 -2
  44. package/chunks/{cron-list-Z6RJJ4YH.js → cron-list-BVCUSWRU.js} +2 -2
  45. package/chunks/{de-M2IPQRBS.js → de-V4IE2OOZ.js} +29 -3
  46. package/chunks/{dist-RRYNPBOE.js → dist-4L54HRX2.js} +2 -2
  47. package/chunks/{dist-WP4AH3VK.js → dist-BXDUQ2QY.js} +1 -1
  48. package/chunks/{dist-M6GFCZ7S.js → dist-MN2PDDPR.js} +1 -1
  49. package/chunks/{edit-3KCBTA25.js → edit-NRL5ZYWP.js} +32 -18
  50. package/chunks/{en-N5GMPCVT.js → en-HGJ2SPLM.js} +32 -3
  51. package/chunks/{enter-worktree-VWS5QZTU.js → enter-worktree-TLT6EXVN.js} +41 -17
  52. package/chunks/{exit-worktree-RVXFWAPD.js → exit-worktree-PE7RZMLE.js} +41 -17
  53. package/chunks/{exitPlanMode-UL5DILDG.js → exitPlanMode-JYMKAHYD.js} +15 -17
  54. package/chunks/{fr-BTHRYEXO.js → fr-CJULI7ZX.js} +29 -3
  55. package/chunks/{geminiContentGenerator-O2OPGHJG.js → geminiContentGenerator-GYIOVT4A.js} +3 -3
  56. package/chunks/{glob-57BSREPN.js → glob-T7KIVIWT.js} +15 -17
  57. package/chunks/{grep-XO5JOC7T.js → grep-4KI7ZJR5.js} +15 -17
  58. package/chunks/{ja-D63TAEBO.js → ja-L7CHRQEW.js} +29 -3
  59. package/chunks/{keychain-token-storage-DMFP5IJM.js → keychain-token-storage-335UOLJ6.js} +2 -2
  60. package/chunks/{ls-SUILOZZB.js → ls-7HD6XG3V.js} +3 -3
  61. package/chunks/{lsp-6TQBWVMZ.js → lsp-ZZSFCIWD.js} +2 -2
  62. package/chunks/{monitor-BECPGO3K.js → monitor-L5YPPGVO.js} +45 -26
  63. package/chunks/notebook-edit-HYXLIC3D.js +756 -0
  64. package/chunks/{openaiContentGenerator-KEZQHIRM.js → openaiContentGenerator-XRP5JM6P.js} +12 -11
  65. package/chunks/{pt-XUV7FSKC.js → pt-M6JULLEQ.js} +29 -3
  66. package/chunks/{qwenContentGenerator-RPMRXTNH.js → qwenContentGenerator-EOX3HZXX.js} +17 -19
  67. package/chunks/{qwenOAuth2-JSQ7EPR3.js → qwenOAuth2-EEJGROP7.js} +9 -3
  68. package/chunks/{read-file-LGHEIQNH.js → read-file-3XOYPTIB.js} +7 -8
  69. package/chunks/{ripGrep-6SFSXZ2G.js → ripGrep-5QUURWGU.js} +15 -17
  70. package/chunks/{ru-7KHWMN3A.js → ru-QILM4HBC.js} +29 -3
  71. package/chunks/{send-message-Q2JRAC3J.js → send-message-ULK4MQXJ.js} +23 -2
  72. package/chunks/{serve-27O2AFE3.js → serve-AZ44ZNWF.js} +8864 -1351
  73. package/chunks/{shell-J7K5KYCH.js → shell-O6OTTSIP.js} +15 -17
  74. package/chunks/{skill-2R7P4ATS.js → skill-MUGS3H4M.js} +23 -10
  75. package/chunks/{src-CGEDVW67.js → src-YCQBAYCP.js} +292 -28
  76. package/chunks/{syntheticOutput-S4DRGMQM.js → syntheticOutput-IS2X5OZ2.js} +3 -3
  77. package/chunks/{task-stop-7THHVAQS.js → task-stop-7QSJGSSP.js} +2 -2
  78. package/chunks/{todoWrite-WKUGUTPX.js → todoWrite-7CVACFUX.js} +3 -3
  79. package/chunks/{tool-search-XOH3ZWVS.js → tool-search-UFDQJOXT.js} +7 -8
  80. package/chunks/{web-fetch-OZE6ZQUF.js → web-fetch-ENQ2I5JA.js} +7 -4
  81. package/chunks/{write-file-74NQ27Q2.js → write-file-GBLDDYQT.js} +29 -18
  82. package/chunks/{zh-VGHU6XBB.js → zh-PWL2NKY3.js} +32 -3
  83. package/chunks/{zh-TW-O36Q4V7E.js → zh-TW-S3YGWICZ.js} +32 -3
  84. package/cli.js +61338 -76795
  85. package/locales/ca.js +44 -5
  86. package/locales/de.js +44 -5
  87. package/locales/en.js +49 -5
  88. package/locales/fr.js +45 -5
  89. package/locales/ja.js +43 -5
  90. package/locales/pt.js +43 -5
  91. package/locales/ru.js +43 -5
  92. package/locales/zh-TW.js +46 -4
  93. package/locales/zh.js +46 -4
  94. package/package.json +2 -2
  95. package/chunks/chunk-5P5XGNYH.js +0 -93
  96. package/chunks/chunk-SYCJMSIJ.js +0 -82
  97. package/chunks/chunk-Y6Z2O3WR.js +0 -33
@@ -2,7 +2,7 @@
2
2
  "use strict";
3
3
  import {
4
4
  getGlobalQwenDir
5
- } from "./chunk-YHEAJFCI.js";
5
+ } from "./chunk-USE2VQ5P.js";
6
6
  import {
7
7
  init_esbuild_shims
8
8
  } from "./chunk-A4BMJM77.js";
@@ -2,16 +2,16 @@
2
2
  "use strict";
3
3
  import {
4
4
  RequestTokenizer
5
- } from "./chunk-BXNCPI75.js";
5
+ } from "./chunk-DMIMF3CG.js";
6
6
  import {
7
7
  buildRuntimeFetchOptions,
8
8
  redactProxyError
9
- } from "./chunk-CAWKL3UC.js";
9
+ } from "./chunk-CSWBPY3P.js";
10
10
  import {
11
11
  OpenAIContentConverter,
12
12
  TaggedThinkingParser,
13
13
  openaiRequestCaptureContext
14
- } from "./chunk-PCL3EJGY.js";
14
+ } from "./chunk-4U3O4VDA.js";
15
15
  import {
16
16
  CAPPED_DEFAULT_MAX_TOKENS,
17
17
  DASHSCOPE_PROXY_BASE_URL,
@@ -19,16 +19,17 @@ import {
19
19
  DEFAULT_MAX_RETRIES,
20
20
  DEFAULT_TIMEOUT,
21
21
  hasExplicitOutputLimit,
22
+ runtimeDiagnostics,
22
23
  safeJsonParse,
23
24
  tokenLimit
24
- } from "./chunk-UXW7MYAW.js";
25
+ } from "./chunk-MAY32HXD.js";
25
26
  import {
26
27
  GenerateContentResponse
27
28
  } from "./chunk-T4VD6OJ4.js";
28
29
  import {
29
30
  createDebugLogger,
30
31
  isAbortError
31
- } from "./chunk-GJXIKCKL.js";
32
+ } from "./chunk-XP27SJMH.js";
32
33
  import {
33
34
  init_esbuild_shims
34
35
  } from "./chunk-A4BMJM77.js";
@@ -6902,6 +6903,24 @@ OpenAI.Containers = Containers;
6902
6903
  init_esbuild_shims();
6903
6904
 
6904
6905
  // packages/core/src/core/openaiContentGenerator/provider/default.ts
6906
+ function shouldMirrorReasoningContentForQwen3(model) {
6907
+ return model.toLowerCase().includes("qwen3");
6908
+ }
6909
+ __name(shouldMirrorReasoningContentForQwen3, "shouldMirrorReasoningContentForQwen3");
6910
+ function mirrorReasoningContentToReasoning(message) {
6911
+ if (message.role !== "assistant") {
6912
+ return message;
6913
+ }
6914
+ const assistant = message;
6915
+ if (typeof assistant.reasoning_content !== "string" || assistant.reasoning_content.length === 0 || typeof assistant.reasoning === "string") {
6916
+ return message;
6917
+ }
6918
+ return {
6919
+ ...assistant,
6920
+ reasoning: assistant.reasoning_content
6921
+ };
6922
+ }
6923
+ __name(mirrorReasoningContentToReasoning, "mirrorReasoningContentToReasoning");
6905
6924
  var DefaultOpenAICompatibleProvider = class {
6906
6925
  static {
6907
6926
  __name(this, "DefaultOpenAICompatibleProvider");
@@ -6945,8 +6964,10 @@ var DefaultOpenAICompatibleProvider = class {
6945
6964
  buildRequest(request, _userPromptId) {
6946
6965
  const extraBody = this.contentGeneratorConfig.extra_body;
6947
6966
  const requestWithTokenLimits = this.applyOutputTokenLimit(request);
6967
+ const messages = shouldMirrorReasoningContentForQwen3(request.model) ? requestWithTokenLimits.messages.map(mirrorReasoningContentToReasoning) : requestWithTokenLimits.messages;
6948
6968
  return {
6949
6969
  ...requestWithTokenLimits,
6970
+ messages,
6950
6971
  ...extraBody ? extraBody : {}
6951
6972
  };
6952
6973
  }
@@ -7050,6 +7071,16 @@ var DashScopeOpenAICompatibleProvider = class _DashScopeOpenAICompatibleProvider
7050
7071
  constructor(contentGeneratorConfig, cliConfig) {
7051
7072
  super(contentGeneratorConfig, cliConfig);
7052
7073
  }
7074
+ /**
7075
+ * Determines whether to use the DashScope-compatible provider.
7076
+ * Covers dashscope.aliyuncs.com, dashscope-intl.aliyuncs.com,
7077
+ * internal Alibaba domains (*.alibaba-inc.com, *.aliyun-inc.com),
7078
+ * and proxy matches.
7079
+ *
7080
+ * Note: any *.alibaba-inc.com / *.aliyun-inc.com host is treated as a
7081
+ * DashScope-compatible endpoint by design. Keep this generic and avoid
7082
+ * embedding individual private gateway hostnames in provider detection.
7083
+ */
7053
7084
  static isDashScopeProvider(contentGeneratorConfig) {
7054
7085
  const { authType, baseUrl } = contentGeneratorConfig;
7055
7086
  if (authType === "qwen-oauth" /* QWEN_OAUTH */) return true;
@@ -7062,16 +7093,22 @@ var DashScopeOpenAICompatibleProvider = class _DashScopeOpenAICompatibleProvider
7062
7093
  hostname = null;
7063
7094
  }
7064
7095
  const isDashscopeOrigin = hostname !== null && (hostname === "dashscope.aliyuncs.com" || hostname === "dashscope-intl.aliyuncs.com" || hostname.endsWith(".dashscope.aliyuncs.com") || hostname.endsWith(".dashscope-intl.aliyuncs.com"));
7096
+ const isInternalOrigin = hostname !== null && (hostname.endsWith(".alibaba-inc.com") || hostname.endsWith(".aliyun-inc.com"));
7065
7097
  const normalizedProxyUrl = DASHSCOPE_PROXY_BASE_URL?.endsWith("/") ? DASHSCOPE_PROXY_BASE_URL.slice(0, -1) : DASHSCOPE_PROXY_BASE_URL;
7066
7098
  const isProxyMatch = Boolean(
7067
7099
  normalizedProxyUrl && normalizedBaseUrl.toLowerCase() === normalizedProxyUrl.toLowerCase()
7068
7100
  );
7069
- if (normalizedProxyUrl && !isDashscopeOrigin && !isProxyMatch) {
7101
+ if (normalizedProxyUrl && !isDashscopeOrigin && !isInternalOrigin && !isProxyMatch) {
7070
7102
  debugLogger.debug(
7071
7103
  `DASHSCOPE_PROXY_BASE_URL is configured but the request baseUrl does not match. DashScope headers/cache control will be skipped.`
7072
7104
  );
7073
7105
  }
7074
- return isDashscopeOrigin || isProxyMatch;
7106
+ if (isInternalOrigin) {
7107
+ debugLogger.debug(
7108
+ `DashScope provider activated via internal origin: ${hostname}`
7109
+ );
7110
+ }
7111
+ return isDashscopeOrigin || isInternalOrigin || isProxyMatch;
7075
7112
  }
7076
7113
  buildHeaders() {
7077
7114
  const version = this.cliConfig.getCliVersion() || "unknown";
@@ -7280,6 +7317,25 @@ var DashScopeOpenAICompatibleProvider = class _DashScopeOpenAICompatibleProvider
7280
7317
 
7281
7318
  // packages/core/src/core/openaiContentGenerator/provider/deepseek.ts
7282
7319
  init_esbuild_shims();
7320
+
7321
+ // packages/core/src/core/openaiContentGenerator/provider/utils.ts
7322
+ init_esbuild_shims();
7323
+ function ensureReasoningContentOnAssistantMessage(message) {
7324
+ if (message.role !== "assistant") {
7325
+ return message;
7326
+ }
7327
+ const assistant = message;
7328
+ if (typeof assistant.reasoning_content === "string") {
7329
+ return message;
7330
+ }
7331
+ return {
7332
+ ...assistant,
7333
+ reasoning_content: ""
7334
+ };
7335
+ }
7336
+ __name(ensureReasoningContentOnAssistantMessage, "ensureReasoningContentOnAssistantMessage");
7337
+
7338
+ // packages/core/src/core/openaiContentGenerator/provider/deepseek.ts
7283
7339
  function isDeepSeekHostname(contentGeneratorConfig) {
7284
7340
  const baseUrl = contentGeneratorConfig.baseUrl ?? "";
7285
7341
  if (!baseUrl) return false;
@@ -7331,7 +7387,7 @@ var DeepSeekOpenAICompatibleProvider = class extends DefaultOpenAICompatibleProv
7331
7387
  }
7332
7388
  const messages = reshaped.messages.map((message) => {
7333
7389
  const flattened = flattenContentParts(message);
7334
- return ensureReasoningContentOnToolCalls(flattened);
7390
+ return ensureReasoningContentOnAssistantMessage(flattened);
7335
7391
  });
7336
7392
  return {
7337
7393
  ...reshaped,
@@ -7393,20 +7449,6 @@ function translateReasoningEffort(request) {
7393
7449
  return next;
7394
7450
  }
7395
7451
  __name(translateReasoningEffort, "translateReasoningEffort");
7396
- function ensureReasoningContentOnToolCalls(message) {
7397
- if (message.role !== "assistant") {
7398
- return message;
7399
- }
7400
- const extended = message;
7401
- if (typeof extended.reasoning_content === "string" && extended.reasoning_content.length > 0) {
7402
- return message;
7403
- }
7404
- return {
7405
- ...extended,
7406
- reasoning_content: ""
7407
- };
7408
- }
7409
- __name(ensureReasoningContentOnToolCalls, "ensureReasoningContentOnToolCalls");
7410
7452
 
7411
7453
  // packages/core/src/core/openaiContentGenerator/provider/openrouter.ts
7412
7454
  init_esbuild_shims();
@@ -7508,6 +7550,50 @@ function stripReasoningContent(message) {
7508
7550
  }
7509
7551
  __name(stripReasoningContent, "stripReasoningContent");
7510
7552
 
7553
+ // packages/core/src/core/openaiContentGenerator/provider/mimo.ts
7554
+ init_esbuild_shims();
7555
+ function isMiMoProvider(contentGeneratorConfig) {
7556
+ const baseUrl = contentGeneratorConfig.baseUrl ?? "";
7557
+ if (baseUrl) {
7558
+ try {
7559
+ const hostname = new URL(baseUrl).hostname.toLowerCase();
7560
+ if (hostname === "xiaomimimo.com" || hostname.endsWith(".xiaomimimo.com")) {
7561
+ return true;
7562
+ }
7563
+ } catch {
7564
+ }
7565
+ }
7566
+ const model = contentGeneratorConfig.model ?? "";
7567
+ return model.toLowerCase().startsWith("mimo-");
7568
+ }
7569
+ __name(isMiMoProvider, "isMiMoProvider");
7570
+ var MiMoOpenAICompatibleProvider = class extends DefaultOpenAICompatibleProvider {
7571
+ static {
7572
+ __name(this, "MiMoOpenAICompatibleProvider");
7573
+ }
7574
+ constructor(contentGeneratorConfig, cliConfig) {
7575
+ super(contentGeneratorConfig, cliConfig);
7576
+ }
7577
+ static isMiMoProvider = isMiMoProvider;
7578
+ buildRequest(request, userPromptId) {
7579
+ const baseRequest = super.buildRequest(request, userPromptId);
7580
+ if (!baseRequest.messages?.length) {
7581
+ return baseRequest;
7582
+ }
7583
+ return {
7584
+ ...baseRequest,
7585
+ messages: baseRequest.messages.map(
7586
+ ensureReasoningContentOnAssistantMessage
7587
+ )
7588
+ };
7589
+ }
7590
+ getRequestContextOverrides() {
7591
+ return {
7592
+ splitToolMedia: this.contentGeneratorConfig.splitToolMedia ?? true
7593
+ };
7594
+ }
7595
+ };
7596
+
7511
7597
  // packages/core/src/core/openaiContentGenerator/pipeline.ts
7512
7598
  init_esbuild_shims();
7513
7599
  import { setMaxListeners } from "node:events";
@@ -8104,6 +8190,7 @@ var ContentGenerationPipeline = class {
8104
8190
  isStreaming
8105
8191
  );
8106
8192
  openaiRequestCaptureContext.getStore()?.(openaiRequest);
8193
+ runtimeDiagnostics.recordOpenAIWireRequest(openaiRequest);
8107
8194
  const result = await executor(openaiRequest, context);
8108
8195
  return result;
8109
8196
  } catch (error) {
@@ -8122,6 +8209,7 @@ var ContentGenerationPipeline = class {
8122
8209
  */
8123
8210
  createRequestContext(request, isStreaming) {
8124
8211
  const effectiveModel = request.model || this.contentGeneratorConfig.model;
8212
+ const providerOverrides = this.config.provider.getRequestContextOverrides?.() ?? {};
8125
8213
  const toolCallParser = isStreaming ? new StreamingToolCallParser() : void 0;
8126
8214
  const responseParsingOptions = this.config.provider.getResponseParsingOptions?.();
8127
8215
  const taggedThinkingParser = isStreaming && responseParsingOptions?.taggedThinkingTags ? new TaggedThinkingParser() : void 0;
@@ -8129,7 +8217,7 @@ var ContentGenerationPipeline = class {
8129
8217
  model: effectiveModel,
8130
8218
  modalities: this.contentGeneratorConfig.modalities ?? {},
8131
8219
  startTime: Date.now(),
8132
- splitToolMedia: this.contentGeneratorConfig.splitToolMedia ?? false,
8220
+ splitToolMedia: providerOverrides.splitToolMedia ?? this.contentGeneratorConfig.splitToolMedia ?? false,
8133
8221
  ...toolCallParser ? { toolCallParser } : {},
8134
8222
  ...responseParsingOptions ? { responseParsingOptions } : {},
8135
8223
  ...taggedThinkingParser ? { taggedThinkingParser } : {}
@@ -8321,6 +8409,9 @@ function determineProvider(contentGeneratorConfig, cliConfig) {
8321
8409
  cliConfig
8322
8410
  );
8323
8411
  }
8412
+ if (MiMoOpenAICompatibleProvider.isMiMoProvider(config)) {
8413
+ return new MiMoOpenAICompatibleProvider(contentGeneratorConfig, cliConfig);
8414
+ }
8324
8415
  if (OpenRouterOpenAICompatibleProvider.isOpenRouterProvider(config)) {
8325
8416
  return new OpenRouterOpenAICompatibleProvider(
8326
8417
  contentGeneratorConfig,
@@ -8355,6 +8446,7 @@ export {
8355
8446
  OpenRouterOpenAICompatibleProvider,
8356
8447
  MiniMaxOpenAICompatibleProvider,
8357
8448
  MistralOpenAICompatibleProvider,
8449
+ MiMoOpenAICompatibleProvider,
8358
8450
  ContentGenerationPipeline,
8359
8451
  EnhancedErrorHandler,
8360
8452
  OpenAIContentGenerator,
@@ -5,7 +5,7 @@ import {
5
5
  } from "./chunk-OFEVLU4C.js";
6
6
  import {
7
7
  SchemaValidator
8
- } from "./chunk-FYMSCRHM.js";
8
+ } from "./chunk-PVVL5Q3W.js";
9
9
  import {
10
10
  init_esbuild_shims
11
11
  } from "./chunk-A4BMJM77.js";
@@ -20,7 +20,7 @@ function buildDefaultPromptId(purpose) {
20
20
  }
21
21
  __name(buildDefaultPromptId, "buildDefaultPromptId");
22
22
  function resolveDefaultModel(config, override) {
23
- return override ?? config.getFastModelForSideQuery?.() ?? config.getFastModel?.() ?? config.getModel() ?? DEFAULT_QWEN_MODEL;
23
+ return override ?? config.getFastModel?.() ?? config.getModel() ?? DEFAULT_QWEN_MODEL;
24
24
  }
25
25
  __name(resolveDefaultModel, "resolveDefaultModel");
26
26
  function applyThinkingDefault(callerConfig) {
@@ -2,7 +2,7 @@
2
2
  "use strict";
3
3
  import {
4
4
  createDebugLogger
5
- } from "./chunk-GJXIKCKL.js";
5
+ } from "./chunk-XP27SJMH.js";
6
6
  import {
7
7
  require_undici
8
8
  } from "./chunk-E7E2MFYM.js";
@@ -323,7 +323,7 @@ function buildFetchOptionsWithDispatcher(sdkType, proxyUrl) {
323
323
  }
324
324
  try {
325
325
  const dispatcher = getOrCreateSharedDispatcher(proxyUrl);
326
- return { fetchOptions: { dispatcher } };
326
+ return { fetchOptions: { dispatcher }, fetch: import_undici.fetch };
327
327
  } catch (error) {
328
328
  const hostname = extractHostnameFromProxyUrl(proxyUrl);
329
329
  const failureCount = recordProxyFailure(hostname);
@@ -3,7 +3,7 @@
3
3
  import {
4
4
  Storage,
5
5
  createDebugLogger
6
- } from "./chunk-GJXIKCKL.js";
6
+ } from "./chunk-XP27SJMH.js";
7
7
  import {
8
8
  init_esbuild_shims
9
9
  } from "./chunk-A4BMJM77.js";
@@ -3,10 +3,10 @@
3
3
  import {
4
4
  TextTokenizer,
5
5
  isSupportedImageMimeType
6
- } from "./chunk-CAWKL3UC.js";
6
+ } from "./chunk-CSWBPY3P.js";
7
7
  import {
8
8
  createDebugLogger
9
- } from "./chunk-GJXIKCKL.js";
9
+ } from "./chunk-XP27SJMH.js";
10
10
  import {
11
11
  init_esbuild_shims
12
12
  } from "./chunk-A4BMJM77.js";
@@ -2,7 +2,7 @@
2
2
  "use strict";
3
3
  import {
4
4
  createDebugLogger
5
- } from "./chunk-GJXIKCKL.js";
5
+ } from "./chunk-XP27SJMH.js";
6
6
  import {
7
7
  init_esbuild_shims
8
8
  } from "./chunk-A4BMJM77.js";
@@ -1,15 +1,8 @@
1
1
  // Force strict mode and setup for ESM
2
2
  "use strict";
3
3
  import {
4
- init_esm as init_esm2
5
- } from "./chunk-PCL3EJGY.js";
6
- import {
7
- FatalConfigError,
8
4
  createDebugLogger
9
- } from "./chunk-GJXIKCKL.js";
10
- import {
11
- init_esm
12
- } from "./chunk-QWSRH265.js";
5
+ } from "./chunk-XP27SJMH.js";
13
6
  import {
14
7
  init_esbuild_shims
15
8
  } from "./chunk-A4BMJM77.js";
@@ -17,87 +10,6 @@ import {
17
10
  __name
18
11
  } from "./chunk-J2S4EL5Y.js";
19
12
 
20
- // packages/core/src/telemetry/config.ts
21
- init_esbuild_shims();
22
-
23
- // packages/core/src/telemetry/index.ts
24
- init_esbuild_shims();
25
- init_esm();
26
- init_esm2();
27
- var TelemetryTarget = /* @__PURE__ */ ((TelemetryTarget2) => {
28
- TelemetryTarget2["GCP"] = "gcp";
29
- TelemetryTarget2["LOCAL"] = "local";
30
- return TelemetryTarget2;
31
- })(TelemetryTarget || {});
32
- var DEFAULT_TELEMETRY_TARGET = "local" /* LOCAL */;
33
- var DEFAULT_OTLP_ENDPOINT = "http://localhost:4317";
34
-
35
- // packages/core/src/telemetry/config.ts
36
- function parseBooleanEnvFlag(value) {
37
- if (value === void 0) return void 0;
38
- return value === "true" || value === "1";
39
- }
40
- __name(parseBooleanEnvFlag, "parseBooleanEnvFlag");
41
- function parseTelemetryTargetValue(value) {
42
- if (value === void 0) return void 0;
43
- if (value === "local" /* LOCAL */ || value === "local") {
44
- return "local" /* LOCAL */;
45
- }
46
- if (value === "gcp" /* GCP */ || value === "gcp") {
47
- return "gcp" /* GCP */;
48
- }
49
- return void 0;
50
- }
51
- __name(parseTelemetryTargetValue, "parseTelemetryTargetValue");
52
- async function resolveTelemetrySettings(options) {
53
- const argv = options.argv ?? {};
54
- const env = options.env ?? {};
55
- const settings = options.settings ?? {};
56
- const enabled = argv.telemetry ?? parseBooleanEnvFlag(env["QWEN_TELEMETRY_ENABLED"]) ?? settings.enabled;
57
- const rawTarget = argv.telemetryTarget ?? env["QWEN_TELEMETRY_TARGET"] ?? settings.target;
58
- const target = parseTelemetryTargetValue(rawTarget);
59
- if (rawTarget !== void 0 && target === void 0) {
60
- throw new FatalConfigError(
61
- `Invalid telemetry target: ${String(
62
- rawTarget
63
- )}. Valid values are: local, gcp`
64
- );
65
- }
66
- const otlpEndpoint = argv.telemetryOtlpEndpoint ?? env["QWEN_TELEMETRY_OTLP_ENDPOINT"] ?? env["OTEL_EXPORTER_OTLP_ENDPOINT"] ?? settings.otlpEndpoint;
67
- const rawProtocol = argv.telemetryOtlpProtocol ?? env["QWEN_TELEMETRY_OTLP_PROTOCOL"] ?? settings.otlpProtocol;
68
- const otlpProtocol = ["grpc", "http"].find(
69
- (p) => p === rawProtocol
70
- );
71
- if (rawProtocol !== void 0 && otlpProtocol === void 0) {
72
- throw new FatalConfigError(
73
- `Invalid telemetry OTLP protocol: ${String(
74
- rawProtocol
75
- )}. Valid values are: grpc, http`
76
- );
77
- }
78
- const logPrompts = argv.telemetryLogPrompts ?? parseBooleanEnvFlag(env["QWEN_TELEMETRY_LOG_PROMPTS"]) ?? settings.logPrompts;
79
- const includeSensitiveSpanAttributes = parseBooleanEnvFlag(
80
- env["QWEN_TELEMETRY_INCLUDE_SENSITIVE_SPAN_ATTRIBUTES"]
81
- ) ?? settings.includeSensitiveSpanAttributes ?? false;
82
- const outfile = argv.telemetryOutfile ?? env["QWEN_TELEMETRY_OUTFILE"] ?? settings.outfile;
83
- const otlpTracesEndpoint = env["QWEN_TELEMETRY_OTLP_TRACES_ENDPOINT"] ?? env["OTEL_EXPORTER_OTLP_TRACES_ENDPOINT"] ?? settings.otlpTracesEndpoint;
84
- const otlpLogsEndpoint = env["QWEN_TELEMETRY_OTLP_LOGS_ENDPOINT"] ?? env["OTEL_EXPORTER_OTLP_LOGS_ENDPOINT"] ?? settings.otlpLogsEndpoint;
85
- const otlpMetricsEndpoint = env["QWEN_TELEMETRY_OTLP_METRICS_ENDPOINT"] ?? env["OTEL_EXPORTER_OTLP_METRICS_ENDPOINT"] ?? settings.otlpMetricsEndpoint;
86
- return {
87
- enabled,
88
- target,
89
- otlpEndpoint,
90
- otlpProtocol,
91
- otlpTracesEndpoint,
92
- otlpLogsEndpoint,
93
- otlpMetricsEndpoint,
94
- logPrompts,
95
- includeSensitiveSpanAttributes,
96
- outfile
97
- };
98
- }
99
- __name(resolveTelemetrySettings, "resolveTelemetrySettings");
100
-
101
13
  // packages/core/src/utils/xml.ts
102
14
  init_esbuild_shims();
103
15
  function escapeXml(text) {
@@ -221,22 +133,11 @@ ${body}
221
133
  __name(buildSkillLlmContent, "buildSkillLlmContent");
222
134
 
223
135
  export {
224
- parseBooleanEnvFlag,
225
- parseTelemetryTargetValue,
226
- resolveTelemetrySettings,
227
- TelemetryTarget,
228
- DEFAULT_TELEMETRY_TARGET,
229
- DEFAULT_OTLP_ENDPOINT,
230
136
  escapeXml,
231
137
  escapeSystemReminderTags,
232
138
  registerSkillHooks,
233
139
  buildSkillLlmContent
234
140
  };
235
- /**
236
- * @license
237
- * Copyright 2025 Google LLC
238
- * SPDX-License-Identifier: Apache-2.0
239
- */
240
141
  /**
241
142
  * @license
242
143
  * Copyright 2025 Qwen
@@ -2,11 +2,11 @@
2
2
  "use strict";
3
3
  import {
4
4
  formatFetchErrorForUser
5
- } from "./chunk-FKVKVE6N.js";
5
+ } from "./chunk-KXZ4TJB4.js";
6
6
  import {
7
7
  Storage,
8
8
  createDebugLogger
9
- } from "./chunk-GJXIKCKL.js";
9
+ } from "./chunk-XP27SJMH.js";
10
10
  import {
11
11
  init_esbuild_shims
12
12
  } from "./chunk-A4BMJM77.js";
@@ -1202,6 +1202,23 @@ var CredentialsClearRequiredError = class extends Error {
1202
1202
  __name(this, "CredentialsClearRequiredError");
1203
1203
  }
1204
1204
  };
1205
+ var QwenOAuthPollError = class extends Error {
1206
+ static {
1207
+ __name(this, "QwenOAuthPollError");
1208
+ }
1209
+ status;
1210
+ oauthError;
1211
+ description;
1212
+ constructor(opts) {
1213
+ super(
1214
+ `Device token poll failed: ${opts.oauthError ?? "Unknown error"} - ${opts.description ?? "(no description)"}`
1215
+ );
1216
+ this.name = "QwenOAuthPollError";
1217
+ this.oauthError = opts.oauthError;
1218
+ this.description = opts.description;
1219
+ this.status = opts.status;
1220
+ }
1221
+ };
1205
1222
  function isDeviceAuthorizationSuccess(response) {
1206
1223
  return "device_code" in response;
1207
1224
  }
@@ -1245,7 +1262,7 @@ var QwenOAuth2Client = class {
1245
1262
  return { token: void 0 };
1246
1263
  }
1247
1264
  }
1248
- async requestDeviceAuthorization(options) {
1265
+ async requestDeviceAuthorization(options, fetchOpts) {
1249
1266
  const bodyData = {
1250
1267
  client_id: QWEN_OAUTH_CLIENT_ID,
1251
1268
  scope: options.scope,
@@ -1259,7 +1276,13 @@ var QwenOAuth2Client = class {
1259
1276
  Accept: "application/json",
1260
1277
  "x-request-id": randomUUID2()
1261
1278
  },
1262
- body: objectToUrlEncoded(bodyData)
1279
+ body: objectToUrlEncoded(bodyData),
1280
+ // PR #4255 — daemon device-flow registry passes its
1281
+ // `cancelController.signal` so dispose / cancel during a slow
1282
+ // device-authorization request actually aborts the in-flight
1283
+ // socket immediately. Pre-existing CLI callers omit it; the
1284
+ // optional shape preserves backward compatibility.
1285
+ ...fetchOpts?.signal ? { signal: fetchOpts.signal } : {}
1263
1286
  });
1264
1287
  if (!response.ok) {
1265
1288
  const errorData = await response.text();
@@ -1268,7 +1291,18 @@ var QwenOAuth2Client = class {
1268
1291
  );
1269
1292
  }
1270
1293
  const result = await response.json();
1271
- debugLogger2.debug("Device authorization result:", result);
1294
+ if (isDeviceAuthorizationSuccess(result)) {
1295
+ debugLogger2.debug("Device authorization result (sanitized):", {
1296
+ ok: true,
1297
+ expires_in: result.expires_in
1298
+ });
1299
+ } else {
1300
+ const errorData = result;
1301
+ debugLogger2.debug("Device authorization result (sanitized):", {
1302
+ ok: false,
1303
+ error: errorData?.error
1304
+ });
1305
+ }
1272
1306
  if (!isDeviceAuthorizationSuccess(result)) {
1273
1307
  const errorData = result;
1274
1308
  throw new Error(
@@ -1277,7 +1311,7 @@ var QwenOAuth2Client = class {
1277
1311
  }
1278
1312
  return result;
1279
1313
  }
1280
- async pollDeviceToken(options) {
1314
+ async pollDeviceToken(options, fetchOpts) {
1281
1315
  const bodyData = {
1282
1316
  grant_type: QWEN_OAUTH_GRANT_TYPE,
1283
1317
  client_id: QWEN_OAUTH_CLIENT_ID,
@@ -1290,7 +1324,12 @@ var QwenOAuth2Client = class {
1290
1324
  "Content-Type": "application/x-www-form-urlencoded",
1291
1325
  Accept: "application/json"
1292
1326
  },
1293
- body: objectToUrlEncoded(bodyData)
1327
+ body: objectToUrlEncoded(bodyData),
1328
+ // PR #4255 — daemon device-flow registry passes its per-entry
1329
+ // `cancelController.signal` so cancel() / dispose() during a
1330
+ // slow IdP response actually aborts the in-flight socket
1331
+ // instead of waiting for the upstream timeout.
1332
+ ...fetchOpts?.signal ? { signal: fetchOpts.signal } : {}
1294
1333
  });
1295
1334
  if (!response.ok) {
1296
1335
  const responseText = await response.text();
@@ -1298,11 +1337,11 @@ var QwenOAuth2Client = class {
1298
1337
  try {
1299
1338
  errorData = JSON.parse(responseText);
1300
1339
  } catch (_parseError) {
1301
- const error2 = new Error(
1340
+ const error = new Error(
1302
1341
  `Device token poll failed: ${response.status} ${response.statusText}. Response: ${responseText}`
1303
1342
  );
1304
- error2.status = response.status;
1305
- throw error2;
1343
+ error.status = response.status;
1344
+ throw error;
1306
1345
  }
1307
1346
  if (response.status === 400 && errorData.error === "authorization_pending") {
1308
1347
  return { status: "pending" };
@@ -1313,11 +1352,11 @@ var QwenOAuth2Client = class {
1313
1352
  slowDown: true
1314
1353
  };
1315
1354
  }
1316
- const error = new Error(
1317
- `Device token poll failed: ${errorData.error || "Unknown error"} - ${errorData.error_description}`
1318
- );
1319
- error.status = response.status;
1320
- throw error;
1355
+ throw new QwenOAuthPollError({
1356
+ oauthError: errorData.error,
1357
+ description: errorData.error_description,
1358
+ status: response.status
1359
+ });
1321
1360
  }
1322
1361
  return await response.json();
1323
1362
  }
@@ -1608,10 +1647,6 @@ async function authWithQwenDeviceFlow(client, config) {
1608
1647
  };
1609
1648
  client.setCredentials(credentials);
1610
1649
  await cacheQwenCredentials(credentials);
1611
- try {
1612
- SharedTokenManager.getInstance().clearCache();
1613
- } catch {
1614
- }
1615
1650
  emitAuthProgress(
1616
1651
  "success",
1617
1652
  "Authentication successful! Access token obtained."
@@ -1712,12 +1747,45 @@ Server requested to slow down, increasing poll interval to ${pollInterval}ms'`
1712
1747
  }
1713
1748
  }
1714
1749
  __name(authWithQwenDeviceFlow, "authWithQwenDeviceFlow");
1715
- async function cacheQwenCredentials(credentials) {
1750
+ var QWEN_CREDENTIAL_FILE_MODE = 384;
1751
+ async function cacheQwenCredentials(credentials, opts) {
1716
1752
  const filePath = getQwenCachedCredentialPath();
1717
1753
  try {
1718
1754
  await fs7.mkdir(path3.dirname(filePath), { recursive: true });
1719
1755
  const credString = JSON.stringify(credentials, null, 2);
1720
- await fs7.writeFile(filePath, credString);
1756
+ const tempPath = `${filePath}.tmp.${process.pid}.${randomUUID2()}`;
1757
+ try {
1758
+ await fs7.writeFile(tempPath, credString, {
1759
+ mode: QWEN_CREDENTIAL_FILE_MODE,
1760
+ ...opts?.signal ? { signal: opts.signal } : {}
1761
+ });
1762
+ try {
1763
+ await fs7.chmod(tempPath, QWEN_CREDENTIAL_FILE_MODE);
1764
+ } catch (chmodErr) {
1765
+ if (process.platform !== "win32") {
1766
+ throw new Error(
1767
+ `cacheQwenCredentials: refusing to publish credentials \u2014 chmod 0o${QWEN_CREDENTIAL_FILE_MODE.toString(8)} on temp file failed: ${chmodErr instanceof Error ? chmodErr.message : String(chmodErr)}`
1768
+ );
1769
+ }
1770
+ debugLogger2.warn(
1771
+ `cacheQwenCredentials: chmod 0o${QWEN_CREDENTIAL_FILE_MODE.toString(8)} on Windows temp file ${tempPath} failed; relying on NTFS ACL: ${chmodErr instanceof Error ? chmodErr.message : String(chmodErr)}`
1772
+ );
1773
+ }
1774
+ await fs7.rename(tempPath, filePath);
1775
+ } catch (writeErr) {
1776
+ try {
1777
+ await fs7.unlink(tempPath);
1778
+ } catch {
1779
+ }
1780
+ throw writeErr;
1781
+ }
1782
+ try {
1783
+ SharedTokenManager.getInstance().clearCache();
1784
+ } catch (clearErr) {
1785
+ debugLogger2.warn(
1786
+ `cacheQwenCredentials: SharedTokenManager.clearCache failed; in-process callers may serve stale credentials until the next mtime poll: ${clearErr instanceof Error ? clearErr.message : String(clearErr)}`
1787
+ );
1788
+ }
1721
1789
  } catch (error) {
1722
1790
  const errorMessage = error instanceof Error ? error.message : String(error);
1723
1791
  const errorCode = error instanceof Error && "code" in error ? error.code : void 0;
@@ -1766,6 +1834,7 @@ export {
1766
1834
  generateCodeChallenge,
1767
1835
  generatePKCEPair,
1768
1836
  CredentialsClearRequiredError,
1837
+ QwenOAuthPollError,
1769
1838
  isDeviceAuthorizationSuccess,
1770
1839
  isDeviceTokenSuccess,
1771
1840
  isDeviceTokenPending,
@@ -1774,6 +1843,8 @@ export {
1774
1843
  QwenOAuth2Event,
1775
1844
  qwenOAuth2Events,
1776
1845
  getQwenOAuthClient,
1846
+ QWEN_CREDENTIAL_FILE_MODE,
1847
+ cacheQwenCredentials,
1777
1848
  clearQwenCredentials,
1778
1849
  clearCachedCredentialFile
1779
1850
  };
@@ -3,7 +3,7 @@
3
3
  import {
4
4
  getErrorMessage,
5
5
  isNodeError
6
- } from "./chunk-GJXIKCKL.js";
6
+ } from "./chunk-XP27SJMH.js";
7
7
  import {
8
8
  init_esbuild_shims
9
9
  } from "./chunk-A4BMJM77.js";