@qwen-code/qwen-code 0.16.0-preview.0 → 0.16.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/bundled/qc-helper/docs/configuration/settings.md +39 -37
  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 +119 -14
  10. package/bundled/review/SKILL.md +12 -3
  11. package/chunks/{agent-ZNQPH67I.js → agent-2JCG7FDJ.js} +9 -11
  12. package/chunks/{anthropicContentGenerator-ICBDZ6R2.js → anthropicContentGenerator-RQJNXJIY.js} +6 -3
  13. package/chunks/{askUserQuestion-WQILGUSQ.js → askUserQuestion-PQPMPNM3.js} +1 -1
  14. package/chunks/{ca-S3XJMT6P.js → ca-UZ7BANMN.js} +3 -3
  15. package/chunks/{chunk-XVHR7ATJ.js → chunk-4AOCVI6J.js} +1 -0
  16. package/chunks/chunk-7LMPOVYW.js +956 -0
  17. package/chunks/{chunk-MNPZ2WO6.js → chunk-BAZDG3QU.js} +9104 -3955
  18. package/chunks/{chunk-AEJ2DKLP.js → chunk-C6WMLUNB.js} +1 -1
  19. package/chunks/{chunk-PPHYLJSS.js → chunk-CAVZVZX6.js} +2 -2
  20. package/chunks/{chunk-VTPOO6GV.js → chunk-CSWBPY3P.js} +1 -1
  21. package/chunks/chunk-D6LBYOCX.js +19126 -0
  22. package/chunks/{chunk-NAID3ZWF.js → chunk-DMIMF3CG.js} +1 -1
  23. package/chunks/{chunk-2B7UBDY5.js → chunk-GGNTZ2NH.js} +90 -19
  24. package/chunks/chunk-HW5S7L73.js +379 -0
  25. package/chunks/{chunk-C3LHPHN2.js → chunk-JCR2WRXZ.js} +1227 -657
  26. package/chunks/{chunk-EDYSNFEM.js → chunk-L5E26RN6.js} +2 -2
  27. package/chunks/{chunk-CW44BRRA.js → chunk-MAY32HXD.js} +375 -0
  28. package/chunks/{chunk-7QXHXMC6.js → chunk-N6GSJHZ4.js} +96 -20
  29. package/chunks/{chunk-FZIUV27X.js → chunk-PVVL5Q3W.js} +31 -0
  30. package/chunks/{chunk-YHEAJFCI.js → chunk-USE2VQ5P.js} +3 -0
  31. package/chunks/{chunk-JYQUJ5DS.js → chunk-YJLGXDQJ.js} +1 -1
  32. package/chunks/{contextCommand-IGBCEXI4.js → contextCommand-XVRGKS3Q.js} +11 -13
  33. package/chunks/{cron-create-AVI3Q267.js → cron-create-IGYXQVG4.js} +27 -1
  34. package/chunks/{cron-delete-ZCEGDXXV.js → cron-delete-ETKIZCWT.js} +1 -1
  35. package/chunks/{cron-list-VN653OK5.js → cron-list-BVCUSWRU.js} +1 -1
  36. package/chunks/{de-MNR4SMAI.js → de-V4IE2OOZ.js} +3 -3
  37. package/chunks/{dist-RRYNPBOE.js → dist-4L54HRX2.js} +2 -2
  38. package/chunks/{dist-WP4AH3VK.js → dist-BXDUQ2QY.js} +1 -1
  39. package/chunks/{dist-M6GFCZ7S.js → dist-MN2PDDPR.js} +1 -1
  40. package/chunks/{edit-74Q4AFHQ.js → edit-3MLXHQPW.js} +22 -12
  41. package/chunks/{en-FIUWJSZR.js → en-HGJ2SPLM.js} +4 -3
  42. package/chunks/{enter-worktree-H72HXC7D.js → enter-worktree-OCA4SG6D.js} +35 -11
  43. package/chunks/{exit-worktree-FGIQO3S3.js → exit-worktree-6EDLXVEV.js} +35 -11
  44. package/chunks/{exitPlanMode-NBR2PK2D.js → exitPlanMode-H75KHRX4.js} +9 -11
  45. package/chunks/{fr-OFJFHLCR.js → fr-CJULI7ZX.js} +3 -3
  46. package/chunks/{geminiContentGenerator-33RP4WKD.js → geminiContentGenerator-E7Y6TCPU.js} +1 -1
  47. package/chunks/{glob-WEE3CJL6.js → glob-JFFSKARO.js} +9 -11
  48. package/chunks/{grep-DZKSBFZK.js → grep-7TAFR7MX.js} +9 -11
  49. package/chunks/{ja-V6OQ6VL7.js → ja-L7CHRQEW.js} +3 -3
  50. package/chunks/{ls-6F3VSP6S.js → ls-7HD6XG3V.js} +1 -1
  51. package/chunks/{lsp-67Y7DJN5.js → lsp-ZZSFCIWD.js} +1 -1
  52. package/chunks/{monitor-EDZWEZVS.js → monitor-YX2ABLXH.js} +21 -11
  53. package/chunks/notebook-edit-EEJEGFZR.js +756 -0
  54. package/chunks/{openaiContentGenerator-5NQG3W64.js → openaiContentGenerator-BSAWHGQJ.js} +9 -8
  55. package/chunks/{pt-ZLE6SA4A.js → pt-M6JULLEQ.js} +3 -3
  56. package/chunks/{qwenContentGenerator-4DPUUS6R.js → qwenContentGenerator-47XRHQXM.js} +11 -13
  57. package/chunks/{qwenOAuth2-JE7H47TE.js → qwenOAuth2-EEJGROP7.js} +7 -1
  58. package/chunks/{read-file-CQOF7BQ2.js → read-file-O53WD46Y.js} +4 -5
  59. package/chunks/{ripGrep-KR5LKGTI.js → ripGrep-OXNZ5Z3T.js} +9 -11
  60. package/chunks/{ru-A4OHIUNN.js → ru-QILM4HBC.js} +3 -3
  61. package/chunks/{send-message-GB4AQZNC.js → send-message-ULK4MQXJ.js} +22 -1
  62. package/chunks/{serve-GAD2PEST.js → serve-H2REZAYD.js} +13728 -3026
  63. package/chunks/{shell-E2HMCBGR.js → shell-DET66JID.js} +9 -11
  64. package/chunks/{skill-KDZH6UZ6.js → skill-ZIXPX3L3.js} +19 -6
  65. package/chunks/{src-LY4RU5AI.js → src-PN3XGQYP.js} +205 -13
  66. package/chunks/{syntheticOutput-HFL3DE7R.js → syntheticOutput-IS2X5OZ2.js} +2 -2
  67. package/chunks/{task-stop-ZQF26RXS.js → task-stop-7QSJGSSP.js} +1 -1
  68. package/chunks/{todoWrite-U4SC643O.js → todoWrite-7CVACFUX.js} +2 -2
  69. package/chunks/{tool-search-U4XQVLFU.js → tool-search-GTYLSGZ3.js} +4 -5
  70. package/chunks/{web-fetch-BRWZ4WSE.js → web-fetch-ENQ2I5JA.js} +5 -2
  71. package/chunks/{write-file-NBLRMNGB.js → write-file-NILNEZCR.js} +19 -12
  72. package/chunks/{zh-V32QONGV.js → zh-PWL2NKY3.js} +4 -3
  73. package/chunks/{zh-TW-552S24LR.js → zh-TW-S3YGWICZ.js} +4 -3
  74. package/cli.js +14832 -49049
  75. package/locales/ca.js +4 -5
  76. package/locales/de.js +4 -5
  77. package/locales/en.js +6 -5
  78. package/locales/fr.js +4 -5
  79. package/locales/ja.js +4 -5
  80. package/locales/pt.js +4 -5
  81. package/locales/ru.js +4 -5
  82. package/locales/zh-TW.js +5 -4
  83. package/locales/zh.js +5 -4
  84. package/package.json +2 -2
  85. package/chunks/chunk-3MBY4GKN.js +0 -350
  86. package/chunks/chunk-5P5XGNYH.js +0 -93
  87. package/chunks/chunk-JHMX4QTD.js +0 -2306
  88. package/chunks/chunk-SYCJMSIJ.js +0 -82
  89. package/chunks/chunk-Y6Z2O3WR.js +0 -33
@@ -2,7 +2,7 @@
2
2
  "use strict";
3
3
  import {
4
4
  ToolNames
5
- } from "./chunk-FZIUV27X.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 */,
@@ -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-NAID3ZWF.js";
5
+ } from "./chunk-DMIMF3CG.js";
6
6
  import {
7
7
  buildRuntimeFetchOptions,
8
8
  redactProxyError
9
- } from "./chunk-VTPOO6GV.js";
9
+ } from "./chunk-CSWBPY3P.js";
10
10
  import {
11
11
  OpenAIContentConverter,
12
12
  TaggedThinkingParser,
13
13
  openaiRequestCaptureContext
14
- } from "./chunk-C3LHPHN2.js";
14
+ } from "./chunk-JCR2WRXZ.js";
15
15
  import {
16
16
  CAPPED_DEFAULT_MAX_TOKENS,
17
17
  DASHSCOPE_PROXY_BASE_URL,
@@ -19,9 +19,10 @@ import {
19
19
  DEFAULT_MAX_RETRIES,
20
20
  DEFAULT_TIMEOUT,
21
21
  hasExplicitOutputLimit,
22
+ runtimeDiagnostics,
22
23
  safeJsonParse,
23
24
  tokenLimit
24
- } from "./chunk-CW44BRRA.js";
25
+ } from "./chunk-MAY32HXD.js";
25
26
  import {
26
27
  GenerateContentResponse
27
28
  } from "./chunk-T4VD6OJ4.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
  }
@@ -7296,6 +7317,25 @@ var DashScopeOpenAICompatibleProvider = class _DashScopeOpenAICompatibleProvider
7296
7317
 
7297
7318
  // packages/core/src/core/openaiContentGenerator/provider/deepseek.ts
7298
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
7299
7339
  function isDeepSeekHostname(contentGeneratorConfig) {
7300
7340
  const baseUrl = contentGeneratorConfig.baseUrl ?? "";
7301
7341
  if (!baseUrl) return false;
@@ -7347,7 +7387,7 @@ var DeepSeekOpenAICompatibleProvider = class extends DefaultOpenAICompatibleProv
7347
7387
  }
7348
7388
  const messages = reshaped.messages.map((message) => {
7349
7389
  const flattened = flattenContentParts(message);
7350
- return ensureReasoningContentOnToolCalls(flattened);
7390
+ return ensureReasoningContentOnAssistantMessage(flattened);
7351
7391
  });
7352
7392
  return {
7353
7393
  ...reshaped,
@@ -7409,20 +7449,6 @@ function translateReasoningEffort(request) {
7409
7449
  return next;
7410
7450
  }
7411
7451
  __name(translateReasoningEffort, "translateReasoningEffort");
7412
- function ensureReasoningContentOnToolCalls(message) {
7413
- if (message.role !== "assistant") {
7414
- return message;
7415
- }
7416
- const extended = message;
7417
- if (typeof extended.reasoning_content === "string" && extended.reasoning_content.length > 0) {
7418
- return message;
7419
- }
7420
- return {
7421
- ...extended,
7422
- reasoning_content: ""
7423
- };
7424
- }
7425
- __name(ensureReasoningContentOnToolCalls, "ensureReasoningContentOnToolCalls");
7426
7452
 
7427
7453
  // packages/core/src/core/openaiContentGenerator/provider/openrouter.ts
7428
7454
  init_esbuild_shims();
@@ -7524,6 +7550,50 @@ function stripReasoningContent(message) {
7524
7550
  }
7525
7551
  __name(stripReasoningContent, "stripReasoningContent");
7526
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
+
7527
7597
  // packages/core/src/core/openaiContentGenerator/pipeline.ts
7528
7598
  init_esbuild_shims();
7529
7599
  import { setMaxListeners } from "node:events";
@@ -8120,6 +8190,7 @@ var ContentGenerationPipeline = class {
8120
8190
  isStreaming
8121
8191
  );
8122
8192
  openaiRequestCaptureContext.getStore()?.(openaiRequest);
8193
+ runtimeDiagnostics.recordOpenAIWireRequest(openaiRequest);
8123
8194
  const result = await executor(openaiRequest, context);
8124
8195
  return result;
8125
8196
  } catch (error) {
@@ -8138,6 +8209,7 @@ var ContentGenerationPipeline = class {
8138
8209
  */
8139
8210
  createRequestContext(request, isStreaming) {
8140
8211
  const effectiveModel = request.model || this.contentGeneratorConfig.model;
8212
+ const providerOverrides = this.config.provider.getRequestContextOverrides?.() ?? {};
8141
8213
  const toolCallParser = isStreaming ? new StreamingToolCallParser() : void 0;
8142
8214
  const responseParsingOptions = this.config.provider.getResponseParsingOptions?.();
8143
8215
  const taggedThinkingParser = isStreaming && responseParsingOptions?.taggedThinkingTags ? new TaggedThinkingParser() : void 0;
@@ -8145,7 +8217,7 @@ var ContentGenerationPipeline = class {
8145
8217
  model: effectiveModel,
8146
8218
  modalities: this.contentGeneratorConfig.modalities ?? {},
8147
8219
  startTime: Date.now(),
8148
- splitToolMedia: this.contentGeneratorConfig.splitToolMedia ?? false,
8220
+ splitToolMedia: providerOverrides.splitToolMedia ?? this.contentGeneratorConfig.splitToolMedia ?? false,
8149
8221
  ...toolCallParser ? { toolCallParser } : {},
8150
8222
  ...responseParsingOptions ? { responseParsingOptions } : {},
8151
8223
  ...taggedThinkingParser ? { taggedThinkingParser } : {}
@@ -8337,6 +8409,9 @@ function determineProvider(contentGeneratorConfig, cliConfig) {
8337
8409
  cliConfig
8338
8410
  );
8339
8411
  }
8412
+ if (MiMoOpenAICompatibleProvider.isMiMoProvider(config)) {
8413
+ return new MiMoOpenAICompatibleProvider(contentGeneratorConfig, cliConfig);
8414
+ }
8340
8415
  if (OpenRouterOpenAICompatibleProvider.isOpenRouterProvider(config)) {
8341
8416
  return new OpenRouterOpenAICompatibleProvider(
8342
8417
  contentGeneratorConfig,
@@ -8371,6 +8446,7 @@ export {
8371
8446
  OpenRouterOpenAICompatibleProvider,
8372
8447
  MiniMaxOpenAICompatibleProvider,
8373
8448
  MistralOpenAICompatibleProvider,
8449
+ MiMoOpenAICompatibleProvider,
8374
8450
  ContentGenerationPipeline,
8375
8451
  EnhancedErrorHandler,
8376
8452
  OpenAIContentGenerator,
@@ -14155,6 +14155,10 @@ var ToolErrorType = /* @__PURE__ */ ((ToolErrorType2) => {
14155
14155
  ToolErrorType2["EDIT_REQUIRES_PRIOR_READ"] = "edit_requires_prior_read";
14156
14156
  ToolErrorType2["FILE_CHANGED_SINCE_READ"] = "file_changed_since_read";
14157
14157
  ToolErrorType2["PRIOR_READ_VERIFICATION_FAILED"] = "prior_read_verification_failed";
14158
+ ToolErrorType2["TARGET_NOT_REGULAR_FILE"] = "target_not_regular_file";
14159
+ ToolErrorType2["NOTEBOOK_EDIT_FAILURE"] = "notebook_edit_failure";
14160
+ ToolErrorType2["NOTEBOOK_INVALID_JSON"] = "notebook_invalid_json";
14161
+ ToolErrorType2["NOTEBOOK_CELL_NOT_FOUND"] = "notebook_cell_not_found";
14158
14162
  ToolErrorType2["GLOB_EXECUTION_ERROR"] = "glob_execution_error";
14159
14163
  ToolErrorType2["GREP_EXECUTION_ERROR"] = "grep_execution_error";
14160
14164
  ToolErrorType2["LS_EXECUTION_ERROR"] = "ls_execution_error";
@@ -14608,6 +14612,31 @@ var DeclarativeTool = class {
14608
14612
  parametersJsonSchema: this.parameterSchema
14609
14613
  };
14610
14614
  }
14615
+ /**
14616
+ * Projects tool params for the AUTO approval mode classifier.
14617
+ *
14618
+ * Tools with security-relevant parameters (file paths, shell commands,
14619
+ * URLs) should override this to redact voluminous or sensitive fields
14620
+ * (full content, secrets) while exposing enough for the classifier to
14621
+ * judge safety.
14622
+ *
14623
+ * Returns:
14624
+ * - object: projected params to send to the classifier
14625
+ * - empty string: signals "no security relevance" — the classifier
14626
+ * transcript will record only the tool name
14627
+ * - undefined: fall back to raw params (only safe when the tool is
14628
+ * known to have no sensitive params)
14629
+ *
14630
+ * Default is the empty-string sentinel — fail-closed: a third-party
14631
+ * MCP tool (or any tool that has not opted in) does not leak its raw
14632
+ * parameters (potentially containing API keys, tokens, file contents)
14633
+ * into the classifier LLM prompt. Tools that want their args inspected
14634
+ * by the classifier for safety judgement should override this and
14635
+ * return an object with only the security-relevant fields.
14636
+ */
14637
+ toAutoClassifierInput(_params) {
14638
+ return "";
14639
+ }
14611
14640
  /**
14612
14641
  * Validates the raw tool parameters.
14613
14642
  * Subclasses should override this to add custom validation logic
@@ -14832,6 +14861,7 @@ var ToolNames = {
14832
14861
  SEND_MESSAGE: "send_message",
14833
14862
  STRUCTURED_OUTPUT: "structured_output",
14834
14863
  MONITOR: "monitor",
14864
+ NOTEBOOK_EDIT: "notebook_edit",
14835
14865
  TOOL_SEARCH: "tool_search",
14836
14866
  ENTER_WORKTREE: "enter_worktree",
14837
14867
  EXIT_WORKTREE: "exit_worktree"
@@ -14859,6 +14889,7 @@ var ToolDisplayNames = {
14859
14889
  SEND_MESSAGE: "SendMessage",
14860
14890
  STRUCTURED_OUTPUT: "StructuredOutput",
14861
14891
  MONITOR: "Monitor",
14892
+ NOTEBOOK_EDIT: "NotebookEdit",
14862
14893
  TOOL_SEARCH: "ToolSearch",
14863
14894
  ENTER_WORKTREE: "EnterWorktree",
14864
14895
  EXIT_WORKTREE: "ExitWorktree"
@@ -1005,6 +1005,9 @@ var AcpBridge = class extends EventEmitter {
1005
1005
  }
1006
1006
  };
1007
1007
 
1008
+ // packages/channels/base/dist/DaemonChannelBridge.js
1009
+ init_esbuild_shims();
1010
+
1008
1011
  export {
1009
1012
  resolvePath,
1010
1013
  getGlobalQwenDir,