@qwen-code/qwen-code 0.15.12-preview.3 → 0.16.0

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 (94) hide show
  1. package/bundled/qc-helper/docs/configuration/settings.md +59 -61
  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/skills.md +3 -0
  7. package/bundled/qc-helper/docs/features/structured-output.md +309 -0
  8. package/bundled/qc-helper/docs/features/sub-agents.md +47 -5
  9. package/bundled/qc-helper/docs/qwen-serve.md +134 -10
  10. package/bundled/review/SKILL.md +12 -3
  11. package/chunks/{agent-LIAWUWAO.js → agent-K6OWOMBN.js} +15 -17
  12. package/chunks/{anthropicContentGenerator-4QE6LTVV.js → anthropicContentGenerator-RQJNXJIY.js} +7 -4
  13. package/chunks/{askUserQuestion-QFSCBTUO.js → askUserQuestion-PQPMPNM3.js} +2 -2
  14. package/chunks/{ca-S3XJMT6P.js → ca-UZ7BANMN.js} +3 -3
  15. package/chunks/{chunk-AJSOD5IR.js → chunk-3T4ZT63H.js} +8833 -3600
  16. package/chunks/{chunk-B7ZL7HUA.js → chunk-4AOCVI6J.js} +2 -1
  17. package/chunks/{chunk-AOJ3BBY7.js → chunk-4J63U5QO.js} +17 -349
  18. package/chunks/{chunk-AEJ2DKLP.js → chunk-C6WMLUNB.js} +1 -1
  19. package/chunks/{chunk-JMZQICAL.js → chunk-CAVZVZX6.js} +2 -2
  20. package/chunks/{chunk-CAWKL3UC.js → chunk-CSWBPY3P.js} +2 -2
  21. package/chunks/{chunk-G27O2LD2.js → chunk-D5NTAHYL.js} +1 -1
  22. package/chunks/{chunk-BXNCPI75.js → chunk-DMIMF3CG.js} +2 -2
  23. package/chunks/{chunk-OCC4MZRS.js → chunk-F23NCRJ2.js} +1 -1
  24. package/chunks/{chunk-5QQ5FGTU.js → chunk-G7YTSRES.js} +1 -1
  25. package/chunks/{chunk-SQNQIOD5.js → chunk-GGNTZ2NH.js} +92 -21
  26. package/chunks/{chunk-FKVKVE6N.js → chunk-KXZ4TJB4.js} +1 -1
  27. package/chunks/chunk-L34E6AGL.js +19126 -0
  28. package/chunks/{chunk-CBVB66WY.js → chunk-L5E26RN6.js} +2 -2
  29. package/chunks/{chunk-UXW7MYAW.js → chunk-MAY32HXD.js} +376 -1
  30. package/chunks/{chunk-GC5RXNL2.js → chunk-NOAHME6A.js} +115 -23
  31. package/chunks/{chunk-CM2IESUE.js → chunk-PR4T27R7.js} +1 -1
  32. package/chunks/{chunk-FYMSCRHM.js → chunk-PVVL5Q3W.js} +32 -1
  33. package/chunks/{chunk-YHEAJFCI.js → chunk-USE2VQ5P.js} +3 -0
  34. package/chunks/chunk-VMOAQVBP.js +379 -0
  35. package/chunks/{chunk-XLQ4E5PS.js → chunk-WCZWAKFG.js} +795 -142
  36. package/chunks/{chunk-GJXIKCKL.js → chunk-XP27SJMH.js} +76 -5
  37. package/chunks/{chunk-TPGOGCWM.js → chunk-YJLGXDQJ.js} +1 -1
  38. package/chunks/{contextCommand-SVLAZMQL.js → contextCommand-7CPNXBLO.js} +17 -19
  39. package/chunks/{cron-create-WUTD5ZTH.js → cron-create-IGYXQVG4.js} +28 -2
  40. package/chunks/{cron-delete-N3UQYCRA.js → cron-delete-ETKIZCWT.js} +2 -2
  41. package/chunks/{cron-list-Z6RJJ4YH.js → cron-list-BVCUSWRU.js} +2 -2
  42. package/chunks/{de-MNR4SMAI.js → de-V4IE2OOZ.js} +3 -3
  43. package/chunks/{dist-RRYNPBOE.js → dist-4L54HRX2.js} +2 -2
  44. package/chunks/{dist-WP4AH3VK.js → dist-BXDUQ2QY.js} +1 -1
  45. package/chunks/{dist-M6GFCZ7S.js → dist-MN2PDDPR.js} +1 -1
  46. package/chunks/{edit-VNAZBIZR.js → edit-CBM5NDVK.js} +28 -18
  47. package/chunks/{en-NRN4QBAT.js → en-HGJ2SPLM.js} +5 -3
  48. package/chunks/{enter-worktree-FOF5YZIV.js → enter-worktree-XABKPLO6.js} +41 -17
  49. package/chunks/{exit-worktree-Y6QVAO3C.js → exit-worktree-56MN2PCL.js} +41 -17
  50. package/chunks/{exitPlanMode-QZKO7GH7.js → exitPlanMode-YDNPCSCJ.js} +15 -17
  51. package/chunks/{fr-OFJFHLCR.js → fr-CJULI7ZX.js} +3 -3
  52. package/chunks/{geminiContentGenerator-DYHZPKJX.js → geminiContentGenerator-ZGPNBFDS.js} +3 -3
  53. package/chunks/{glob-G7XATELV.js → glob-ZHA35VO5.js} +15 -17
  54. package/chunks/{grep-4SETMY47.js → grep-RV6V6T52.js} +15 -17
  55. package/chunks/{ja-V6OQ6VL7.js → ja-L7CHRQEW.js} +3 -3
  56. package/chunks/{keychain-token-storage-DMFP5IJM.js → keychain-token-storage-335UOLJ6.js} +2 -2
  57. package/chunks/{ls-SUILOZZB.js → ls-7HD6XG3V.js} +3 -3
  58. package/chunks/{lsp-6TQBWVMZ.js → lsp-ZZSFCIWD.js} +2 -2
  59. package/chunks/{monitor-JTLJBJ7H.js → monitor-5G2OBGE5.js} +27 -17
  60. package/chunks/notebook-edit-XUBTCT6L.js +756 -0
  61. package/chunks/{openaiContentGenerator-3H7XOZBW.js → openaiContentGenerator-POYAZQ6I.js} +12 -11
  62. package/chunks/{pt-ZLE6SA4A.js → pt-M6JULLEQ.js} +3 -3
  63. package/chunks/{qwenContentGenerator-FAU3QPYO.js → qwenContentGenerator-2E4H56DK.js} +17 -19
  64. package/chunks/{qwenOAuth2-JSQ7EPR3.js → qwenOAuth2-EEJGROP7.js} +9 -3
  65. package/chunks/{read-file-WWUQVNCZ.js → read-file-3JIOOXFT.js} +7 -8
  66. package/chunks/{ripGrep-WCOAIWL6.js → ripGrep-LEI3L6PM.js} +15 -17
  67. package/chunks/{ru-A4OHIUNN.js → ru-QILM4HBC.js} +3 -3
  68. package/chunks/{send-message-Q2JRAC3J.js → send-message-ULK4MQXJ.js} +23 -2
  69. package/chunks/{serve-VJEEEXA6.js → serve-CFVRMD4W.js} +8500 -1663
  70. package/chunks/{shell-IAOKGIJ6.js → shell-3B5DZ437.js} +15 -17
  71. package/chunks/{skill-NHW6222K.js → skill-STSZUBXR.js} +23 -10
  72. package/chunks/{src-OWV5HVQQ.js → src-ROFXAPEP.js} +211 -19
  73. package/chunks/{syntheticOutput-S4DRGMQM.js → syntheticOutput-IS2X5OZ2.js} +3 -3
  74. package/chunks/{task-stop-7THHVAQS.js → task-stop-7QSJGSSP.js} +2 -2
  75. package/chunks/{todoWrite-WKUGUTPX.js → todoWrite-7CVACFUX.js} +3 -3
  76. package/chunks/{tool-search-MSJ6SXLI.js → tool-search-ARWOD3GD.js} +7 -8
  77. package/chunks/{web-fetch-OZE6ZQUF.js → web-fetch-ENQ2I5JA.js} +7 -4
  78. package/chunks/{write-file-RKCENFZ5.js → write-file-6MRT7TEW.js} +25 -18
  79. package/chunks/{zh-RN3JULHO.js → zh-PWL2NKY3.js} +5 -3
  80. package/chunks/{zh-TW-XZEHEV5S.js → zh-TW-S3YGWICZ.js} +5 -3
  81. package/cli.js +58070 -75930
  82. package/locales/ca.js +4 -5
  83. package/locales/de.js +4 -5
  84. package/locales/en.js +8 -5
  85. package/locales/fr.js +4 -5
  86. package/locales/ja.js +4 -5
  87. package/locales/pt.js +4 -5
  88. package/locales/ru.js +4 -5
  89. package/locales/zh-TW.js +6 -4
  90. package/locales/zh.js +6 -4
  91. package/package.json +2 -2
  92. package/chunks/chunk-5P5XGNYH.js +0 -93
  93. package/chunks/chunk-SYCJMSIJ.js +0 -82
  94. package/chunks/chunk-Y6Z2O3WR.js +0 -33
@@ -2,7 +2,7 @@
2
2
  "use strict";
3
3
  import {
4
4
  ToolNames
5
- } from "./chunk-FYMSCRHM.js";
5
+ } from "./chunk-PVVL5Q3W.js";
6
6
  import {
7
7
  init_esbuild_shims
8
8
  } from "./chunk-A4BMJM77.js";
@@ -85,7 +85,7 @@ async function checkPriorRead(cache, filePath, verb, options = {}) {
85
85
  }
86
86
  if (status.state === "fresh" && status.entry.lastReadAt !== void 0 && !status.entry.lastReadCacheable) {
87
87
  const verbBare2 = verb === "editing" ? "edit" : "overwrite";
88
- const raw2 = `File ${filePath} is a binary / image / audio / video / PDF / notebook payload that the ${ToolNames.READ_FILE} tool returns as a structured value rather than as plain text. The Edit / WriteFile tools cannot mutate that payload safely \u2014 re-reading it would not change this. Use a different mechanism (e.g. shell tool with a binary-aware writer) if you need to ${verbBare2} it.`;
88
+ const raw2 = `File ${filePath} is a binary / image / audio / video / PDF / notebook payload that the ${ToolNames.READ_FILE} tool returns as a structured value rather than as plain text. The Edit / WriteFile tools cannot mutate that payload safely \u2014 re-reading it would not change this. If this is a Jupyter notebook (.ipynb), use the ${ToolNames.NOTEBOOK_EDIT} tool for cell-level edits after reading it. For other non-text files, use a different mechanism (e.g. shell tool with an appropriate writer) if you need to ${verbBare2} it.`;
89
89
  return {
90
90
  ok: false,
91
91
  type: "edit_requires_prior_read" /* EDIT_REQUIRES_PRIOR_READ */,
@@ -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";
@@ -10,6 +10,371 @@ import {
10
10
  __name
11
11
  } from "./chunk-J2S4EL5Y.js";
12
12
 
13
+ // packages/core/src/utils/runtimeDiagnostics.ts
14
+ init_esbuild_shims();
15
+ var RUNTIME_PROFILE_ENV = "QWEN_CODE_PROFILE_RUNTIME";
16
+ function isRuntimeDiagnosticsEnabled(env = process.env) {
17
+ return env[RUNTIME_PROFILE_ENV] === "1";
18
+ }
19
+ __name(isRuntimeDiagnosticsEnabled, "isRuntimeDiagnosticsEnabled");
20
+ var RuntimeDiagnosticsCollector = class {
21
+ static {
22
+ __name(this, "RuntimeDiagnosticsCollector");
23
+ }
24
+ enabled;
25
+ now;
26
+ startedAt;
27
+ requestIndex = 0;
28
+ openAIWireRequestIndex = 0;
29
+ anthropicWireRequestIndex = 0;
30
+ requests = [];
31
+ openaiWireRequests = [];
32
+ anthropicWireRequests = [];
33
+ tools = createInitialToolDiagnostics();
34
+ constructor(options = {}) {
35
+ this.enabled = options.enabled ?? isRuntimeDiagnosticsEnabled();
36
+ this.now = options.now ?? (() => (/* @__PURE__ */ new Date()).toISOString());
37
+ this.startedAt = this.now();
38
+ }
39
+ reset(options = {}) {
40
+ this.enabled = options.enabled ?? isRuntimeDiagnosticsEnabled();
41
+ this.startedAt = this.now();
42
+ this.requestIndex = 0;
43
+ this.openAIWireRequestIndex = 0;
44
+ this.anthropicWireRequestIndex = 0;
45
+ this.requests = [];
46
+ this.openaiWireRequests = [];
47
+ this.anthropicWireRequests = [];
48
+ this.tools = createInitialToolDiagnostics();
49
+ }
50
+ isEnabled() {
51
+ return this.enabled;
52
+ }
53
+ recordGenerateContentRequest(request, options) {
54
+ if (!this.enabled) {
55
+ return;
56
+ }
57
+ this.requestIndex += 1;
58
+ this.requests.push({
59
+ index: this.requestIndex,
60
+ timestamp: this.now(),
61
+ source: options.source,
62
+ model: request.model,
63
+ stream: options.stream,
64
+ serializedBytes: utf8Bytes(toJsonSafeRequest(request)),
65
+ contents: summarizeContents(request.contents),
66
+ systemInstructionBytes: summarizeContentTextBytes(
67
+ request.config?.systemInstruction
68
+ ),
69
+ generationConfigBytes: utf8Bytes(toJsonSafeConfig(request.config)),
70
+ tools: summarizeToolSchemas(request.config?.tools)
71
+ });
72
+ }
73
+ recordOpenAIWireRequest(request) {
74
+ if (!this.enabled) {
75
+ return;
76
+ }
77
+ this.openAIWireRequestIndex += 1;
78
+ this.openaiWireRequests.push({
79
+ index: this.openAIWireRequestIndex,
80
+ timestamp: this.now(),
81
+ ...summarizeOpenAIWireRequest(request)
82
+ });
83
+ }
84
+ recordAnthropicWireRequest(request) {
85
+ if (!this.enabled) {
86
+ return;
87
+ }
88
+ this.anthropicWireRequestIndex += 1;
89
+ this.anthropicWireRequests.push({
90
+ index: this.anthropicWireRequestIndex,
91
+ timestamp: this.now(),
92
+ ...summarizeAnthropicWireRequest(request)
93
+ });
94
+ }
95
+ recordToolUse(name, args) {
96
+ if (!this.enabled) {
97
+ return;
98
+ }
99
+ const argBytes = utf8Bytes(args);
100
+ const tool = this.getToolNameDiagnostics(name);
101
+ tool.uses += 1;
102
+ tool.argBytes += argBytes;
103
+ tool.maxArgBytes = Math.max(tool.maxArgBytes, argBytes);
104
+ this.tools.toolUseCount += 1;
105
+ this.tools.totalToolUseArgBytes += argBytes;
106
+ this.tools.maxToolUseArgBytes = Math.max(
107
+ this.tools.maxToolUseArgBytes,
108
+ argBytes
109
+ );
110
+ }
111
+ recordToolResult(record) {
112
+ if (!this.enabled) {
113
+ return;
114
+ }
115
+ const tool = this.getToolNameDiagnostics(record.name);
116
+ tool.results += 1;
117
+ tool.resultBytes += record.resultBytes;
118
+ tool.maxResultBytes = Math.max(tool.maxResultBytes, record.resultBytes);
119
+ if (record.isError) {
120
+ tool.errors += 1;
121
+ this.tools.toolResultErrorCount += 1;
122
+ }
123
+ this.tools.toolResultCount += 1;
124
+ this.tools.totalToolResultBytes += record.resultBytes;
125
+ this.tools.maxToolResultBytes = Math.max(
126
+ this.tools.maxToolResultBytes,
127
+ record.resultBytes
128
+ );
129
+ }
130
+ snapshot() {
131
+ return {
132
+ enabled: this.enabled,
133
+ startedAt: this.startedAt,
134
+ requests: this.requests.map((request) => ({
135
+ ...request,
136
+ contents: {
137
+ ...request.contents,
138
+ roleCounts: { ...request.contents.roleCounts }
139
+ },
140
+ tools: { ...request.tools }
141
+ })),
142
+ openaiWireRequests: this.openaiWireRequests.map((request) => ({
143
+ ...request,
144
+ messageBytesByRole: { ...request.messageBytesByRole },
145
+ topLevelKeys: [...request.topLevelKeys]
146
+ })),
147
+ anthropicWireRequests: this.anthropicWireRequests.map((request) => ({
148
+ ...request,
149
+ messageBytesByRole: { ...request.messageBytesByRole },
150
+ topLevelKeys: [...request.topLevelKeys]
151
+ })),
152
+ tools: {
153
+ ...this.tools,
154
+ byName: Object.fromEntries(
155
+ Object.entries(this.tools.byName).map(([name, value]) => [
156
+ name,
157
+ { ...value }
158
+ ])
159
+ )
160
+ }
161
+ };
162
+ }
163
+ getToolNameDiagnostics(name) {
164
+ const existing = this.tools.byName[name];
165
+ if (existing) {
166
+ return existing;
167
+ }
168
+ const created = createInitialToolNameDiagnostics();
169
+ this.tools.byName[name] = created;
170
+ return created;
171
+ }
172
+ };
173
+ var runtimeDiagnostics = new RuntimeDiagnosticsCollector();
174
+ function summarizeOpenAIWireRequest(request) {
175
+ const requestRecord = asRecord(request);
176
+ const messages = Array.isArray(requestRecord["messages"]) ? requestRecord["messages"] : [];
177
+ const tools = Array.isArray(requestRecord["tools"]) ? requestRecord["tools"] : [];
178
+ const messageBytesByRole = {};
179
+ for (const message of messages) {
180
+ const messageRecord = asRecord(message);
181
+ const role = typeof messageRecord["role"] === "string" ? messageRecord["role"] : "unknown";
182
+ messageBytesByRole[role] = (messageBytesByRole[role] ?? 0) + utf8Bytes(messageRecord["content"]);
183
+ }
184
+ return {
185
+ model: typeof requestRecord["model"] === "string" ? requestRecord["model"] : "unknown",
186
+ stream: requestRecord["stream"] === true,
187
+ bodyBytes: utf8Bytes(request),
188
+ messageCount: messages.length,
189
+ messageBytesByRole,
190
+ toolsCount: tools.length,
191
+ toolSchemaBytes: utf8Bytes(tools),
192
+ topLevelKeys: Object.keys(requestRecord).sort()
193
+ };
194
+ }
195
+ __name(summarizeOpenAIWireRequest, "summarizeOpenAIWireRequest");
196
+ function summarizeAnthropicWireRequest(request) {
197
+ const requestRecord = asRecord(request);
198
+ const messages = Array.isArray(requestRecord["messages"]) ? requestRecord["messages"] : [];
199
+ const tools = Array.isArray(requestRecord["tools"]) ? requestRecord["tools"] : [];
200
+ const messageBytesByRole = {};
201
+ for (const message of messages) {
202
+ const messageRecord = asRecord(message);
203
+ const role = typeof messageRecord["role"] === "string" ? messageRecord["role"] : "unknown";
204
+ messageBytesByRole[role] = (messageBytesByRole[role] ?? 0) + utf8Bytes(messageRecord["content"]);
205
+ }
206
+ return {
207
+ model: typeof requestRecord["model"] === "string" ? requestRecord["model"] : "unknown",
208
+ stream: requestRecord["stream"] === true,
209
+ bodyBytes: utf8Bytes(request),
210
+ messageCount: messages.length,
211
+ messageBytesByRole,
212
+ systemBytes: utf8Bytes(requestRecord["system"]),
213
+ toolsCount: tools.length,
214
+ toolSchemaBytes: utf8Bytes(tools),
215
+ topLevelKeys: Object.keys(requestRecord).sort()
216
+ };
217
+ }
218
+ __name(summarizeAnthropicWireRequest, "summarizeAnthropicWireRequest");
219
+ function createInitialToolDiagnostics() {
220
+ return {
221
+ toolUseCount: 0,
222
+ toolResultCount: 0,
223
+ toolResultErrorCount: 0,
224
+ totalToolUseArgBytes: 0,
225
+ maxToolUseArgBytes: 0,
226
+ totalToolResultBytes: 0,
227
+ maxToolResultBytes: 0,
228
+ byName: /* @__PURE__ */ Object.create(null)
229
+ };
230
+ }
231
+ __name(createInitialToolDiagnostics, "createInitialToolDiagnostics");
232
+ function createInitialToolNameDiagnostics() {
233
+ return {
234
+ uses: 0,
235
+ argBytes: 0,
236
+ maxArgBytes: 0,
237
+ results: 0,
238
+ errors: 0,
239
+ resultBytes: 0,
240
+ maxResultBytes: 0
241
+ };
242
+ }
243
+ __name(createInitialToolNameDiagnostics, "createInitialToolNameDiagnostics");
244
+ function summarizeContents(contents) {
245
+ const summary = {
246
+ count: 0,
247
+ roleCounts: {},
248
+ partCount: 0,
249
+ textBytes: 0,
250
+ functionCallCount: 0,
251
+ functionCallArgBytes: 0,
252
+ functionResponseCount: 0,
253
+ functionResponseBytes: 0,
254
+ inlineDataCount: 0,
255
+ inlineDataBytes: 0,
256
+ fileDataCount: 0
257
+ };
258
+ const contentItems = Array.isArray(contents) ? contents : contents === void 0 || contents === null ? [] : [contents];
259
+ for (const content of contentItems) {
260
+ summary.count += 1;
261
+ if (typeof content === "string") {
262
+ summary.roleCounts["user"] = (summary.roleCounts["user"] ?? 0) + 1;
263
+ summary.partCount += 1;
264
+ summary.textBytes += utf8Bytes(content);
265
+ continue;
266
+ }
267
+ const contentRecord = asRecord(content);
268
+ const role = typeof contentRecord["role"] === "string" ? contentRecord["role"] : "unknown";
269
+ summary.roleCounts[role] = (summary.roleCounts[role] ?? 0) + 1;
270
+ const parts = Array.isArray(contentRecord["parts"]) ? contentRecord["parts"] : [];
271
+ summarizeParts(parts, summary);
272
+ }
273
+ return summary;
274
+ }
275
+ __name(summarizeContents, "summarizeContents");
276
+ function summarizeContentTextBytes(content) {
277
+ const summary = summarizeContents(content);
278
+ return summary.textBytes;
279
+ }
280
+ __name(summarizeContentTextBytes, "summarizeContentTextBytes");
281
+ function summarizeParts(parts, summary) {
282
+ for (const part of parts) {
283
+ summary.partCount += 1;
284
+ if (typeof part === "string") {
285
+ summary.textBytes += utf8Bytes(part);
286
+ continue;
287
+ }
288
+ const partRecord = asRecord(part);
289
+ if (typeof partRecord["text"] === "string") {
290
+ summary.textBytes += utf8Bytes(partRecord["text"]);
291
+ }
292
+ const functionCall = asOptionalRecord(partRecord["functionCall"]);
293
+ if (functionCall) {
294
+ summary.functionCallCount += 1;
295
+ summary.functionCallArgBytes += utf8Bytes(functionCall["args"]);
296
+ }
297
+ const functionResponse = asOptionalRecord(partRecord["functionResponse"]);
298
+ if (functionResponse) {
299
+ summary.functionResponseCount += 1;
300
+ summary.functionResponseBytes += utf8Bytes(functionResponse["response"]) + utf8Bytes(functionResponse["parts"]);
301
+ }
302
+ const inlineData = asOptionalRecord(partRecord["inlineData"]);
303
+ if (inlineData) {
304
+ summary.inlineDataCount += 1;
305
+ summary.inlineDataBytes += utf8Bytes(inlineData["data"]);
306
+ }
307
+ if (partRecord["fileData"]) {
308
+ summary.fileDataCount += 1;
309
+ }
310
+ }
311
+ }
312
+ __name(summarizeParts, "summarizeParts");
313
+ function summarizeToolSchemas(tools) {
314
+ const toolList = Array.isArray(tools) ? tools : [];
315
+ let functionDeclarationCount = 0;
316
+ for (const tool of toolList) {
317
+ const toolRecord = asRecord(tool);
318
+ const declarations = Array.isArray(toolRecord["functionDeclarations"]) ? toolRecord["functionDeclarations"] : [];
319
+ functionDeclarationCount += declarations.length;
320
+ }
321
+ return {
322
+ count: toolList.length,
323
+ functionDeclarationCount,
324
+ schemaBytes: utf8Bytes(toolList)
325
+ };
326
+ }
327
+ __name(summarizeToolSchemas, "summarizeToolSchemas");
328
+ function toJsonSafeRequest(request) {
329
+ return {
330
+ model: request.model,
331
+ contents: request.contents,
332
+ config: toJsonSafeConfig(request.config)
333
+ };
334
+ }
335
+ __name(toJsonSafeRequest, "toJsonSafeRequest");
336
+ function toJsonSafeConfig(config) {
337
+ if (!config) {
338
+ return void 0;
339
+ }
340
+ const configRecord = asRecord(config);
341
+ const safeConfig = {};
342
+ for (const [key, value] of Object.entries(configRecord)) {
343
+ if (key === "abortSignal") {
344
+ continue;
345
+ }
346
+ safeConfig[key] = value;
347
+ }
348
+ return safeConfig;
349
+ }
350
+ __name(toJsonSafeConfig, "toJsonSafeConfig");
351
+ function utf8Bytes(value) {
352
+ if (value === void 0 || value === null) {
353
+ return 0;
354
+ }
355
+ if (typeof value === "string") {
356
+ return Buffer.byteLength(value, "utf8");
357
+ }
358
+ return Buffer.byteLength(safeStringify(value), "utf8");
359
+ }
360
+ __name(utf8Bytes, "utf8Bytes");
361
+ function safeStringify(value) {
362
+ try {
363
+ return JSON.stringify(value) ?? "";
364
+ } catch {
365
+ return "[unserializable]";
366
+ }
367
+ }
368
+ __name(safeStringify, "safeStringify");
369
+ function asRecord(value) {
370
+ return typeof value === "object" && value !== null ? value : {};
371
+ }
372
+ __name(asRecord, "asRecord");
373
+ function asOptionalRecord(value) {
374
+ return typeof value === "object" && value !== null ? value : null;
375
+ }
376
+ __name(asOptionalRecord, "asOptionalRecord");
377
+
13
378
  // packages/core/src/core/tokenLimits.ts
14
379
  init_esbuild_shims();
15
380
  var DEFAULT_TOKEN_LIMIT = 131072;
@@ -1012,6 +1377,11 @@ __name(toOpenAPI30, "toOpenAPI30");
1012
1377
  export {
1013
1378
  safeJsonParse,
1014
1379
  convertSchema,
1380
+ isRuntimeDiagnosticsEnabled,
1381
+ RuntimeDiagnosticsCollector,
1382
+ runtimeDiagnostics,
1383
+ summarizeOpenAIWireRequest,
1384
+ summarizeAnthropicWireRequest,
1015
1385
  DEFAULT_TOKEN_LIMIT,
1016
1386
  DEFAULT_OUTPUT_TOKEN_LIMIT,
1017
1387
  CAPPED_DEFAULT_MAX_TOKENS,
@@ -1026,6 +1396,11 @@ export {
1026
1396
  DEFAULT_DASHSCOPE_BASE_URL,
1027
1397
  DASHSCOPE_PROXY_BASE_URL
1028
1398
  };
1399
+ /**
1400
+ * @license
1401
+ * Copyright 2026 Qwen
1402
+ * SPDX-License-Identifier: Apache-2.0
1403
+ */
1029
1404
  /**
1030
1405
  * @license
1031
1406
  * Copyright 2025 Qwen
@@ -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-XLQ4E5PS.js";
14
+ } from "./chunk-WCZWAKFG.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,
@@ -4,7 +4,7 @@ import {
4
4
  QWEN_DIR,
5
5
  Storage,
6
6
  sanitizeCwd
7
- } from "./chunk-GJXIKCKL.js";
7
+ } from "./chunk-XP27SJMH.js";
8
8
  import {
9
9
  init_esbuild_shims
10
10
  } from "./chunk-A4BMJM77.js";