@qwen-code/qwen-code 0.18.0-preview.0 → 0.18.0-preview.2

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 (107) hide show
  1. package/bundled/qc-helper/SKILL.md +1 -2
  2. package/bundled/qc-helper/docs/configuration/settings.md +17 -19
  3. package/bundled/qc-helper/docs/features/_meta.ts +0 -3
  4. package/bundled/qc-helper/docs/features/commands.md +14 -12
  5. package/bundled/qc-helper/docs/features/scheduled-tasks.md +1 -1
  6. package/bundled/qc-helper/docs/features/sub-agents.md +39 -0
  7. package/chunks/{agent-6J2FFD7S.js → agent-QB7TZ4HW.js} +22 -16
  8. package/chunks/agent-headless-APVHH7QM.js +50 -0
  9. package/chunks/{anthropicContentGenerator-4QBVSFSJ.js → anthropicContentGenerator-M45EVVRM.js} +4 -4
  10. package/chunks/{askUserQuestion-NOOLRWCJ.js → askUserQuestion-WM2KHM3K.js} +2 -2
  11. package/chunks/{ca-WRHFBIDH.js → ca-BARBRL6N.js} +48 -1
  12. package/chunks/{chunk-G763GDO6.js → chunk-2ZTWI7KH.js} +15 -3
  13. package/chunks/chunk-64WXLC72.js +98 -0
  14. package/chunks/{chunk-UQZQP5PA.js → chunk-7YKXFA3D.js} +11 -11
  15. package/chunks/chunk-AJIR24J2.js +59 -0
  16. package/chunks/{chunk-UXBKX55L.js → chunk-AVW55ZCO.js} +61 -23
  17. package/chunks/{chunk-SHUT5MQY.js → chunk-CNHFPN7T.js} +1 -1
  18. package/chunks/{chunk-5RNZ2QKF.js → chunk-CNSMKPK6.js} +1 -1
  19. package/chunks/{chunk-BBTV54KB.js → chunk-CWV3SJZS.js} +2 -2
  20. package/chunks/{chunk-GBEPNWYB.js → chunk-GX7VH5JQ.js} +1 -1
  21. package/chunks/chunk-HGJPQK33.js +2231 -0
  22. package/chunks/chunk-HV3ZZ7G4.js +159 -0
  23. package/chunks/{chunk-BPZQVC2P.js → chunk-HXJE7VOG.js} +25 -32
  24. package/chunks/{chunk-PLYZAP4W.js → chunk-ICOI4E4S.js} +1 -1
  25. package/chunks/{chunk-6VFG3EUJ.js → chunk-JUGRPQAB.js} +1 -1
  26. package/chunks/{chunk-AVLOK27J.js → chunk-JVQOQ3OU.js} +1 -1
  27. package/chunks/{chunk-R5PDRHEF.js → chunk-JXAZUMDW.js} +67 -45
  28. package/chunks/{chunk-UABFCMPA.js → chunk-KC6ZMJ5X.js} +3 -1
  29. package/chunks/chunk-LD2XBG6Z.js +102 -0
  30. package/chunks/{chunk-MVX64PNU.js → chunk-LR62TEET.js} +1 -1
  31. package/chunks/{chunk-JMLIPZUU.js → chunk-MVIVIPCU.js} +3 -3
  32. package/chunks/{chunk-IKOMHTCC.js → chunk-NW5QBUYO.js} +6 -6
  33. package/chunks/{chunk-JSYEZAYV.js → chunk-P4J26VDS.js} +2 -2
  34. package/chunks/{chunk-SCHRFI7O.js → chunk-PAEBHDIO.js} +1 -1
  35. package/chunks/{chunk-BUOJN3MM.js → chunk-QCG6KPNM.js} +3685 -1897
  36. package/chunks/chunk-SKBPNJEW.js +45 -0
  37. package/chunks/{chunk-F5ORN4YO.js → chunk-UAMOBVVW.js} +1 -1
  38. package/chunks/chunk-XBFVXFB2.js +216 -0
  39. package/chunks/{chunk-D46KOV3C.js → chunk-Y7R6H6FT.js} +1 -1
  40. package/chunks/{chunk-3H7ENG2Q.js → chunk-ZK4AMNIU.js} +113 -41
  41. package/chunks/{computer-use-6LZXL3UW.js → computer-use-B7VIUI7F.js} +22 -16
  42. package/chunks/contextCommand-63RZ3O5R.js +52 -0
  43. package/chunks/{cron-create-PIPMXQN4.js → cron-create-FI5LJVUS.js} +2 -2
  44. package/chunks/{cron-delete-6Y5XIDMS.js → cron-delete-ZGUXWBTG.js} +2 -2
  45. package/chunks/{cron-list-A4WNRUWZ.js → cron-list-QNNZGMN3.js} +2 -2
  46. package/chunks/{de-M5RPB2NB.js → de-YGKK2BC4.js} +48 -1
  47. package/chunks/{edit-J7D6VMPQ.js → edit-6UBTS2J5.js} +23 -17
  48. package/chunks/{en-UMYKQAZE.js → en-HSQQNQUB.js} +73 -2
  49. package/chunks/{enter-worktree-NDJTVGYJ.js → enter-worktree-NN7LIXCM.js} +22 -16
  50. package/chunks/{exit-worktree-UB6XYYAX.js → exit-worktree-GGSS5KIE.js} +22 -16
  51. package/chunks/{exitPlanMode-V6X2KL4X.js → exitPlanMode-H323NHB2.js} +22 -16
  52. package/chunks/{fr-MPYXXXPW.js → fr-JXBKPJKQ.js} +48 -1
  53. package/chunks/{geminiContentGenerator-3AKHMB3P.js → geminiContentGenerator-I4H2NLJG.js} +4 -4
  54. package/chunks/{glob-PBG5DRG4.js → glob-OLCX57MD.js} +22 -16
  55. package/chunks/{grep-VQ56EWQ7.js → grep-7HXIMDOW.js} +22 -16
  56. package/chunks/{ja-NFZ32AB3.js → ja-TGPZSP2B.js} +48 -1
  57. package/chunks/{keychain-token-storage-UHGOCDD6.js → keychain-token-storage-LB46DAEK.js} +2 -2
  58. package/chunks/{ls-34DLNYCD.js → ls-6PEZUK6O.js} +3 -3
  59. package/chunks/{lsp-NCDEHH3V.js → lsp-JZSJOVT7.js} +2 -2
  60. package/chunks/{monitor-J3YCSOEH.js → monitor-SQO7MVAV.js} +22 -16
  61. package/chunks/{notebook-edit-AL3CBYJ6.js → notebook-edit-72L3EBAL.js} +23 -17
  62. package/chunks/{openaiContentGenerator-3U6UARHS.js → openaiContentGenerator-FTR7CDWF.js} +12 -11
  63. package/chunks/{pt-BR43FRBA.js → pt-TIBG6BIO.js} +48 -1
  64. package/chunks/{qwenContentGenerator-JRFHJRH6.js → qwenContentGenerator-U5UFQ566.js} +24 -18
  65. package/chunks/{qwenOAuth2-KRJT35QH.js → qwenOAuth2-EFSECGHF.js} +4 -4
  66. package/chunks/{read-file-ZF6EIVE3.js → read-file-UA64EEQC.js} +8 -8
  67. package/chunks/{ripGrep-N2ZT7M6Z.js → ripGrep-WSYCWZVK.js} +22 -16
  68. package/chunks/{ru-DQCW2KHD.js → ru-JBCHCK4L.js} +48 -1
  69. package/chunks/{scheduler-OS37FUFT.js → scheduler-VBASHOCA.js} +22 -16
  70. package/chunks/send-message-OYJZ5TPG.js +244 -0
  71. package/chunks/{serve-ABOLLDNN.js → serve-A7E2OJDR.js} +45 -36
  72. package/chunks/{shell-XGN7IDUS.js → shell-3NFOT6F5.js} +22 -16
  73. package/chunks/{skill-YQQ6CR4U.js → skill-RA5YUREY.js} +10 -10
  74. package/chunks/{src-LORPPHWB.js → src-NFCMARMT.js} +186 -23
  75. package/chunks/{syntheticOutput-T5SWX3YF.js → syntheticOutput-DETQ2YM6.js} +3 -3
  76. package/chunks/task-create-Y3ZKTJIG.js +19 -0
  77. package/chunks/task-list-ONXJ3I3A.js +151 -0
  78. package/chunks/{task-stop-3VHAQMYM.js → task-stop-UHDC4N5B.js} +2 -2
  79. package/chunks/task-update-TCNOU3P5.js +397 -0
  80. package/chunks/team-create-6SR4OVRG.js +313 -0
  81. package/chunks/team-delete-EJ4U4DDP.js +114 -0
  82. package/chunks/{todoWrite-EAGJGKO5.js → todoWrite-TEYDRS5L.js} +4 -4
  83. package/chunks/{tool-search-PDOJPXJJ.js → tool-search-OD435A3X.js} +8 -8
  84. package/chunks/{web-fetch-SS6IKK6N.js → web-fetch-6W67H5PO.js} +4 -4
  85. package/chunks/workflow-62DHH4EO.js +708 -0
  86. package/chunks/{write-file-VWWCN7LI.js → write-file-475L5OPP.js} +23 -17
  87. package/chunks/{zh-TW-IQZ4AD5M.js → zh-TW-G3HFHVVT.js} +74 -6
  88. package/chunks/{zh-6VFXOAR5.js → zh-VCLWO26Y.js} +77 -6
  89. package/cli.js +6429 -3123
  90. package/examples/agent/qwen-extension.json +1 -0
  91. package/examples/commands/qwen-extension.json +1 -0
  92. package/examples/context/qwen-extension.json +1 -0
  93. package/examples/mcp-server/qwen-extension.json +1 -0
  94. package/examples/skills/qwen-extension.json +1 -0
  95. package/locales/ca.js +51 -0
  96. package/locales/de.js +51 -0
  97. package/locales/en.js +83 -2
  98. package/locales/fr.js +53 -2
  99. package/locales/ja.js +52 -2
  100. package/locales/pt.js +52 -2
  101. package/locales/ru.js +53 -2
  102. package/locales/zh-TW.js +85 -11
  103. package/locales/zh.js +89 -11
  104. package/package.json +2 -2
  105. package/bundled/qc-helper/docs/features/checkpointing.md +0 -77
  106. package/chunks/contextCommand-ZV5QQ2LA.js +0 -46
  107. package/chunks/send-message-YYF56TS7.js +0 -151
@@ -0,0 +1,45 @@
1
+ // Force strict mode and setup for ESM
2
+ "use strict";
3
+ import {
4
+ init_esbuild_shims
5
+ } from "./chunk-A4BMJM77.js";
6
+ import {
7
+ __name
8
+ } from "./chunk-J2S4EL5Y.js";
9
+
10
+ // packages/core/src/agents/runtime/agent-types.ts
11
+ init_esbuild_shims();
12
+ var AgentTerminateMode = /* @__PURE__ */ ((AgentTerminateMode2) => {
13
+ AgentTerminateMode2["ERROR"] = "ERROR";
14
+ AgentTerminateMode2["TIMEOUT"] = "TIMEOUT";
15
+ AgentTerminateMode2["GOAL"] = "GOAL";
16
+ AgentTerminateMode2["MAX_TURNS"] = "MAX_TURNS";
17
+ AgentTerminateMode2["CANCELLED"] = "CANCELLED";
18
+ AgentTerminateMode2["SHUTDOWN"] = "SHUTDOWN";
19
+ return AgentTerminateMode2;
20
+ })(AgentTerminateMode || {});
21
+ var AgentStatus = /* @__PURE__ */ ((AgentStatus2) => {
22
+ AgentStatus2["INITIALIZING"] = "initializing";
23
+ AgentStatus2["RUNNING"] = "running";
24
+ AgentStatus2["IDLE"] = "idle";
25
+ AgentStatus2["COMPLETED"] = "completed";
26
+ AgentStatus2["FAILED"] = "failed";
27
+ AgentStatus2["CANCELLED"] = "cancelled";
28
+ return AgentStatus2;
29
+ })(AgentStatus || {});
30
+ var isTerminalStatus = /* @__PURE__ */ __name((s) => s === "completed" /* COMPLETED */ || s === "failed" /* FAILED */ || s === "cancelled" /* CANCELLED */, "isTerminalStatus");
31
+ var isSuccessStatus = /* @__PURE__ */ __name((s) => s === "idle" /* IDLE */ || s === "completed" /* COMPLETED */, "isSuccessStatus");
32
+ var isSettledStatus = /* @__PURE__ */ __name((s) => s === "idle" /* IDLE */ || isTerminalStatus(s), "isSettledStatus");
33
+
34
+ export {
35
+ AgentTerminateMode,
36
+ AgentStatus,
37
+ isTerminalStatus,
38
+ isSuccessStatus,
39
+ isSettledStatus
40
+ };
41
+ /**
42
+ * @license
43
+ * Copyright 2025 Qwen
44
+ * SPDX-License-Identifier: Apache-2.0
45
+ */
@@ -3,7 +3,7 @@
3
3
  import {
4
4
  createDebugLogger,
5
5
  isNodeError
6
- } from "./chunk-R5PDRHEF.js";
6
+ } from "./chunk-JXAZUMDW.js";
7
7
  import {
8
8
  init_esbuild_shims
9
9
  } from "./chunk-A4BMJM77.js";
@@ -0,0 +1,216 @@
1
+ // Force strict mode and setup for ESM
2
+ "use strict";
3
+ import {
4
+ INBOXES_DIR,
5
+ LEADER_NAME,
6
+ TASKS_DIR,
7
+ TEAMMATE_COLORS,
8
+ TEAMS_DIR,
9
+ TEAM_CONFIG_FILENAME
10
+ } from "./chunk-LD2XBG6Z.js";
11
+ import {
12
+ atomicWriteJSON
13
+ } from "./chunk-UAMOBVVW.js";
14
+ import {
15
+ Storage,
16
+ isNodeError
17
+ } from "./chunk-JXAZUMDW.js";
18
+ import {
19
+ init_esbuild_shims
20
+ } from "./chunk-A4BMJM77.js";
21
+ import {
22
+ __name
23
+ } from "./chunk-J2S4EL5Y.js";
24
+
25
+ // packages/core/src/agents/team/teamHelpers.ts
26
+ init_esbuild_shims();
27
+ import * as fs from "node:fs/promises";
28
+ import * as path from "node:path";
29
+ function getTeamsRootDir() {
30
+ return path.join(Storage.getGlobalQwenDir(), TEAMS_DIR);
31
+ }
32
+ __name(getTeamsRootDir, "getTeamsRootDir");
33
+ function getTeamDir(teamName) {
34
+ return path.join(getTeamsRootDir(), teamName);
35
+ }
36
+ __name(getTeamDir, "getTeamDir");
37
+ function getTeamFilePath(teamName) {
38
+ return path.join(getTeamDir(teamName), TEAM_CONFIG_FILENAME);
39
+ }
40
+ __name(getTeamFilePath, "getTeamFilePath");
41
+ function getInboxesDir(teamName) {
42
+ return path.join(getTeamDir(teamName), INBOXES_DIR);
43
+ }
44
+ __name(getInboxesDir, "getInboxesDir");
45
+ function getTasksDir(teamName) {
46
+ return path.join(Storage.getGlobalQwenDir(), TASKS_DIR, teamName);
47
+ }
48
+ __name(getTasksDir, "getTasksDir");
49
+ function sanitizeName(name) {
50
+ return name.toLowerCase().replace(/[^a-z0-9-]/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "");
51
+ }
52
+ __name(sanitizeName, "sanitizeName");
53
+ function formatAgentId(name, teamName) {
54
+ return `${sanitizeName(name)}@${sanitizeName(teamName)}`;
55
+ }
56
+ __name(formatAgentId, "formatAgentId");
57
+ function generateUniqueTeammateName(baseName, existingMembers) {
58
+ const sanitized = sanitizeName(baseName);
59
+ if (!sanitized) {
60
+ throw new Error(
61
+ `Teammate name "${baseName}" sanitizes to an empty string. Choose a name with at least one alphanumeric character.`
62
+ );
63
+ }
64
+ if (sanitized === LEADER_NAME) {
65
+ throw new Error(
66
+ `"${LEADER_NAME}" is reserved for the team leader. Choose a different teammate name.`
67
+ );
68
+ }
69
+ const existingNames = new Set(existingMembers.map((m) => m.name));
70
+ if (existingNames.has(sanitized)) {
71
+ const existingList = [...existingNames].join(", ") || "<none>";
72
+ throw new Error(
73
+ `A teammate named "${sanitized}" already exists in this team (existing: ${existingList}). Choose a different name.`
74
+ );
75
+ }
76
+ return sanitized;
77
+ }
78
+ __name(generateUniqueTeammateName, "generateUniqueTeammateName");
79
+ function assignTeammateColor(existingMembers) {
80
+ const usedColors = new Set(
81
+ existingMembers.map((m) => m.color).filter((c) => c !== void 0)
82
+ );
83
+ for (const color of TEAMMATE_COLORS) {
84
+ if (!usedColors.has(color)) {
85
+ return color;
86
+ }
87
+ }
88
+ return TEAMMATE_COLORS[existingMembers.length % TEAMMATE_COLORS.length];
89
+ }
90
+ __name(assignTeammateColor, "assignTeammateColor");
91
+ function clearTeammateColors(members) {
92
+ return members.map((m) => {
93
+ const { color: _, ...rest } = m;
94
+ return rest;
95
+ });
96
+ }
97
+ __name(clearTeammateColors, "clearTeammateColors");
98
+ function setMemberActive(members, agentId, isActive) {
99
+ return members.map((m) => m.agentId === agentId ? { ...m, isActive } : m);
100
+ }
101
+ __name(setMemberActive, "setMemberActive");
102
+ function findMemberById(members, agentId) {
103
+ return members.find((m) => m.agentId === agentId);
104
+ }
105
+ __name(findMemberById, "findMemberById");
106
+ function findMemberByName(members, name) {
107
+ const sanitized = sanitizeName(name);
108
+ return members.find((m) => m.name === sanitized);
109
+ }
110
+ __name(findMemberByName, "findMemberByName");
111
+ async function readTeamFile(teamName) {
112
+ const filePath = getTeamFilePath(teamName);
113
+ try {
114
+ const raw = await fs.readFile(filePath, "utf-8");
115
+ return JSON.parse(raw);
116
+ } catch (err) {
117
+ if (isNodeError(err) && err.code === "ENOENT") {
118
+ return void 0;
119
+ }
120
+ throw err;
121
+ }
122
+ }
123
+ __name(readTeamFile, "readTeamFile");
124
+ async function writeTeamFile(teamName, teamFile) {
125
+ const filePath = getTeamFilePath(teamName);
126
+ await fs.mkdir(path.dirname(filePath), { recursive: true });
127
+ await atomicWriteJSON(filePath, teamFile);
128
+ }
129
+ __name(writeTeamFile, "writeTeamFile");
130
+ async function createTeamFile(teamName, teamFile) {
131
+ const filePath = getTeamFilePath(teamName);
132
+ await fs.mkdir(path.dirname(filePath), { recursive: true });
133
+ await fs.writeFile(filePath, JSON.stringify(teamFile, null, 2) + "\n", {
134
+ encoding: "utf-8",
135
+ flag: "wx"
136
+ });
137
+ }
138
+ __name(createTeamFile, "createTeamFile");
139
+ function isPidAlive(pid) {
140
+ try {
141
+ process.kill(pid, 0);
142
+ return true;
143
+ } catch (err) {
144
+ return isNodeError(err) && err.code === "EPERM";
145
+ }
146
+ }
147
+ __name(isPidAlive, "isPidAlive");
148
+ async function tryReclaimStaleTeam(teamName) {
149
+ let existing;
150
+ try {
151
+ existing = await readTeamFile(teamName);
152
+ } catch {
153
+ return false;
154
+ }
155
+ if (!existing) {
156
+ await deleteTeamDirs(teamName);
157
+ return true;
158
+ }
159
+ if (typeof existing.leadPid !== "number" || existing.leadPid <= 0) {
160
+ return false;
161
+ }
162
+ if (existing.leadPid !== process.pid && isPidAlive(existing.leadPid)) {
163
+ return false;
164
+ }
165
+ await deleteTeamDirs(teamName);
166
+ return true;
167
+ }
168
+ __name(tryReclaimStaleTeam, "tryReclaimStaleTeam");
169
+ async function deleteTeamDirs(teamName) {
170
+ const teamDir = getTeamDir(teamName);
171
+ const tasksDir = getTasksDir(teamName);
172
+ await Promise.allSettled([
173
+ fs.rm(teamDir, { recursive: true, force: true }),
174
+ fs.rm(tasksDir, { recursive: true, force: true })
175
+ ]);
176
+ }
177
+ __name(deleteTeamDirs, "deleteTeamDirs");
178
+ async function listTeamNames() {
179
+ const teamsRoot = getTeamsRootDir();
180
+ try {
181
+ const entries = await fs.readdir(teamsRoot, {
182
+ withFileTypes: true
183
+ });
184
+ return entries.filter((e) => e.isDirectory()).map((e) => e.name);
185
+ } catch {
186
+ return [];
187
+ }
188
+ }
189
+ __name(listTeamNames, "listTeamNames");
190
+
191
+ export {
192
+ getTeamsRootDir,
193
+ getTeamDir,
194
+ getTeamFilePath,
195
+ getInboxesDir,
196
+ getTasksDir,
197
+ sanitizeName,
198
+ formatAgentId,
199
+ generateUniqueTeammateName,
200
+ assignTeammateColor,
201
+ clearTeammateColors,
202
+ setMemberActive,
203
+ findMemberById,
204
+ findMemberByName,
205
+ readTeamFile,
206
+ writeTeamFile,
207
+ createTeamFile,
208
+ tryReclaimStaleTeam,
209
+ deleteTeamDirs,
210
+ listTeamNames
211
+ };
212
+ /**
213
+ * @license
214
+ * Copyright 2025 Qwen
215
+ * SPDX-License-Identifier: Apache-2.0
216
+ */
@@ -2,7 +2,7 @@
2
2
  "use strict";
3
3
  import {
4
4
  createDebugLogger
5
- } from "./chunk-R5PDRHEF.js";
5
+ } from "./chunk-JXAZUMDW.js";
6
6
  import {
7
7
  init_esbuild_shims
8
8
  } from "./chunk-A4BMJM77.js";
@@ -20,19 +20,19 @@ import {
20
20
  } from "./chunk-OFEVLU4C.js";
21
21
  import {
22
22
  isAnyAutoMemPath
23
- } from "./chunk-AVLOK27J.js";
23
+ } from "./chunk-JVQOQ3OU.js";
24
24
  import {
25
25
  InstallationManager
26
- } from "./chunk-JSYEZAYV.js";
26
+ } from "./chunk-P4J26VDS.js";
27
27
  import {
28
28
  STRUCTURED_OUTPUT_REDACTED_ARGS
29
- } from "./chunk-5RNZ2QKF.js";
29
+ } from "./chunk-CNSMKPK6.js";
30
30
  import {
31
31
  BaseDeclarativeTool,
32
32
  BaseToolInvocation,
33
33
  ToolDisplayNames,
34
34
  ToolNames
35
- } from "./chunk-G763GDO6.js";
35
+ } from "./chunk-2ZTWI7KH.js";
36
36
  import {
37
37
  DEFAULT_OPENAI_BASE_URL,
38
38
  convertSchema,
@@ -40,7 +40,7 @@ import {
40
40
  runtimeDiagnostics,
41
41
  safeJsonParse,
42
42
  tokenLimit
43
- } from "./chunk-D46KOV3C.js";
43
+ } from "./chunk-Y7R6H6FT.js";
44
44
  import {
45
45
  FinishReason,
46
46
  GenerateContentResponse
@@ -58,9 +58,10 @@ import {
58
58
  isSubpaths,
59
59
  makeRelative,
60
60
  setSessionContext,
61
+ setShellTracePropagation,
61
62
  shortenPath,
62
63
  unescapePath
63
- } from "./chunk-R5PDRHEF.js";
64
+ } from "./chunk-JXAZUMDW.js";
64
65
  import {
65
66
  require_dist
66
67
  } from "./chunk-ZERZSAZL.js";
@@ -68341,6 +68342,9 @@ function initializeTelemetry(config) {
68341
68342
  telemetryInitialized = true;
68342
68343
  const sessionId = config.getSessionId();
68343
68344
  setSessionContext(createSessionRootContext(sessionId), sessionId);
68345
+ setShellTracePropagation(
68346
+ config.getOutboundCorrelationPropagateTraceContext()
68347
+ );
68344
68348
  initializeMetrics(config);
68345
68349
  } catch (error) {
68346
68350
  debugLogger12.error("Error starting OpenTelemetry SDK:", error);
@@ -68404,6 +68408,7 @@ async function shutdownTelemetry() {
68404
68408
  sdk = void 0;
68405
68409
  telemetryShutdownPromise = void 0;
68406
68410
  setSessionContext(void 0);
68411
+ setShellTracePropagation(false);
68407
68412
  }
68408
68413
  })();
68409
68414
  return telemetryShutdownPromise;
@@ -68657,6 +68662,7 @@ var UiTelemetryService = class extends EventEmitter {
68657
68662
  #metrics = createInitialMetrics();
68658
68663
  #lastPromptTokenCount = 0;
68659
68664
  #lastCachedContentTokenCount = 0;
68665
+ #sessionStartTime = /* @__PURE__ */ new Date();
68660
68666
  addEvent(event) {
68661
68667
  switch (event["event.name"]) {
68662
68668
  case EVENT_API_RESPONSE:
@@ -68689,6 +68695,9 @@ var UiTelemetryService = class extends EventEmitter {
68689
68695
  lastPromptTokenCount: this.#lastPromptTokenCount
68690
68696
  });
68691
68697
  }
68698
+ getSessionStartTime() {
68699
+ return this.#sessionStartTime;
68700
+ }
68692
68701
  getLastCachedContentTokenCount() {
68693
68702
  return this.#lastCachedContentTokenCount;
68694
68703
  }
@@ -68702,6 +68711,7 @@ var UiTelemetryService = class extends EventEmitter {
68702
68711
  this.#metrics = createInitialMetrics();
68703
68712
  this.#lastPromptTokenCount = 0;
68704
68713
  this.#lastCachedContentTokenCount = 0;
68714
+ this.#sessionStartTime = /* @__PURE__ */ new Date();
68705
68715
  this.emit("update", {
68706
68716
  metrics: this.#metrics,
68707
68717
  lastPromptTokenCount: this.#lastPromptTokenCount
@@ -68847,6 +68857,7 @@ var LoggingContentGenerator = class {
68847
68857
  this.wrapped = wrapped;
68848
68858
  this.config = config;
68849
68859
  this.modalities = generatorConfig.modalities;
68860
+ this.splitToolMedia = generatorConfig.splitToolMedia;
68850
68861
  this.generatorAuthType = generatorConfig.authType;
68851
68862
  if (generatorConfig.enableOpenAILogging) {
68852
68863
  this.openaiLogger = new OpenAILogger(
@@ -68862,6 +68873,7 @@ var LoggingContentGenerator = class {
68862
68873
  openaiLogger;
68863
68874
  schemaCompliance;
68864
68875
  modalities;
68876
+ splitToolMedia;
68865
68877
  generatorAuthType;
68866
68878
  getWrapped() {
68867
68879
  return this.wrapped;
@@ -69298,6 +69310,10 @@ var LoggingContentGenerator = class {
69298
69310
  return {
69299
69311
  model,
69300
69312
  modalities: this.modalities ?? {},
69313
+ // Mirror the pipeline default (see pipeline.ts createRequestContext) so the
69314
+ // --openai-logging fallback reconstruction reflects the same split as the
69315
+ // request actually sent. Opt out via generationConfig.splitToolMedia = false.
69316
+ splitToolMedia: this.splitToolMedia ?? true,
69301
69317
  startTime: 0
69302
69318
  };
69303
69319
  }
@@ -69672,7 +69688,18 @@ var MODALITY_PATTERNS = [
69672
69688
  // Moonshot / Kimi
69673
69689
  // -------------------
69674
69690
  [/^kimi-k2\.5/, { image: true, video: true }],
69675
- [/^kimi-/, {}]
69691
+ [/^kimi-/, {}],
69692
+ // -------------------
69693
+ // ByteDance Doubao — Seed-series and *-vision / *-vl models accept image
69694
+ // input; other Doubao models (pro / lite / text) are text-only.
69695
+ // (QwenLM/qwen-code#4876)
69696
+ // -------------------
69697
+ // seedance (text→video) and seedream (text→image) are generation models with
69698
+ // text-only input — exclude them before the multimodal Seed chat series.
69699
+ [/^doubao-seed(ance|ream)/, {}],
69700
+ [/^doubao-seed/, { image: true }],
69701
+ [/^doubao-.*(vision|vl)/, { image: true }],
69702
+ [/^doubao/, {}]
69676
69703
  ];
69677
69704
  function defaultModalities(model) {
69678
69705
  const norm = normalize(model);
@@ -69685,6 +69712,20 @@ function defaultModalities(model) {
69685
69712
  }
69686
69713
  __name(defaultModalities, "defaultModalities");
69687
69714
 
69715
+ // packages/core/src/utils/runtimeModelPrefix.ts
69716
+ init_esbuild_shims();
69717
+ var RUNTIME_SNAPSHOT_PREFIX = "$runtime|";
69718
+ function stripRuntimeSnapshotPrefix(modelId) {
69719
+ let id = modelId;
69720
+ while (id.startsWith(RUNTIME_SNAPSHOT_PREFIX)) {
69721
+ const stripped = id.split("|").slice(2).join("|");
69722
+ if (!stripped) break;
69723
+ id = stripped;
69724
+ }
69725
+ return id;
69726
+ }
69727
+ __name(stripRuntimeSnapshotPrefix, "stripRuntimeSnapshotPrefix");
69728
+
69688
69729
  // packages/core/src/models/modelRegistry.ts
69689
69730
  init_esbuild_shims();
69690
69731
 
@@ -70277,11 +70318,6 @@ var ModelsConfig = class _ModelsConfig {
70277
70318
  throw error;
70278
70319
  }
70279
70320
  }
70280
- /**
70281
- * Prefix used to identify RuntimeModelSnapshot IDs.
70282
- * Chosen to avoid conflicts with real model IDs which may contain `-` or `:`.
70283
- */
70284
- static RUNTIME_SNAPSHOT_PREFIX = "$runtime|";
70285
70321
  /**
70286
70322
  * Build a RuntimeModelSnapshot ID from authType and modelId.
70287
70323
  * The format is: `$runtime|${authType}|${modelId}`
@@ -70294,7 +70330,7 @@ var ModelsConfig = class _ModelsConfig {
70294
70330
  * @returns The snapshot ID in format `$runtime|${authType}|${modelId}`
70295
70331
  */
70296
70332
  buildRuntimeModelSnapshotId(authType, modelId) {
70297
- return `${_ModelsConfig.RUNTIME_SNAPSHOT_PREFIX}${authType}|${modelId}`;
70333
+ return `${RUNTIME_SNAPSHOT_PREFIX}${authType}|${modelId}`;
70298
70334
  }
70299
70335
  /**
70300
70336
  * Extract RuntimeModelSnapshot ID from modelId if it's a runtime model reference.
@@ -70311,7 +70347,7 @@ var ModelsConfig = class _ModelsConfig {
70311
70347
  * @returns The RuntimeModelSnapshot ID if found, undefined otherwise
70312
70348
  */
70313
70349
  extractRuntimeModelSnapshotId(modelId) {
70314
- if (modelId.startsWith(_ModelsConfig.RUNTIME_SNAPSHOT_PREFIX)) {
70350
+ if (modelId.startsWith(RUNTIME_SNAPSHOT_PREFIX)) {
70315
70351
  if (this.runtimeModelSnapshots.has(modelId)) {
70316
70352
  return modelId;
70317
70353
  }
@@ -70622,6 +70658,10 @@ var ModelsConfig = class _ModelsConfig {
70622
70658
  const isUnchanged = previousAuthType === authType && this._generationConfig.model === modelId && !isProviderChanged;
70623
70659
  const savedApiKey = isUnchanged ? this._generationConfig.apiKey : void 0;
70624
70660
  const savedApiKeySource = isUnchanged ? this.generationConfigSources["apiKey"] ? { ...this.generationConfigSources["apiKey"] } : void 0 : void 0;
70661
+ const baseUrlSource2 = this.generationConfigSources["baseUrl"];
70662
+ const shouldPreserveResolvedBaseUrl = isUnchanged && !!this._generationConfig.baseUrl && (baseUrlSource2?.kind === "cli" || baseUrlSource2?.kind === "env" || baseUrlSource2?.kind === "settings");
70663
+ const savedBaseUrl = shouldPreserveResolvedBaseUrl ? this._generationConfig.baseUrl : void 0;
70664
+ const savedBaseUrlSource = shouldPreserveResolvedBaseUrl ? baseUrlSource2 ? { ...baseUrlSource2 } : void 0 : void 0;
70625
70665
  this.applyResolvedModelDefaults(resolved);
70626
70666
  if (isUnchanged && !this._generationConfig.apiKey && savedApiKey) {
70627
70667
  this._generationConfig.apiKey = savedApiKey;
@@ -70629,6 +70669,12 @@ var ModelsConfig = class _ModelsConfig {
70629
70669
  this.generationConfigSources["apiKey"] = savedApiKeySource;
70630
70670
  }
70631
70671
  }
70672
+ if (savedBaseUrl) {
70673
+ this._generationConfig.baseUrl = savedBaseUrl;
70674
+ if (savedBaseUrlSource) {
70675
+ this.generationConfigSources["baseUrl"] = savedBaseUrlSource;
70676
+ }
70677
+ }
70632
70678
  this.strictModelProviderSelection = true;
70633
70679
  this.activeRuntimeModelSnapshotId = void 0;
70634
70680
  return;
@@ -70992,6 +71038,17 @@ function createContentGeneratorConfig(config, authType, generationConfig) {
70992
71038
  ).config;
70993
71039
  }
70994
71040
  __name(createContentGeneratorConfig, "createContentGeneratorConfig");
71041
+ function getModuleNotFoundError(error) {
71042
+ let current = error;
71043
+ while (current instanceof Error) {
71044
+ if ("code" in current && current.code === "ERR_MODULE_NOT_FOUND") {
71045
+ return current;
71046
+ }
71047
+ current = current.cause;
71048
+ }
71049
+ return void 0;
71050
+ }
71051
+ __name(getModuleNotFoundError, "getModuleNotFoundError");
70995
71052
  async function createContentGenerator(generatorConfig, config, isInitialAuth) {
70996
71053
  const validation = validateModelConfig(generatorConfig, false);
70997
71054
  if (!validation.valid) {
@@ -71002,37 +71059,50 @@ async function createContentGenerator(generatorConfig, config, isInitialAuth) {
71002
71059
  throw new Error("ContentGeneratorConfig must have an authType");
71003
71060
  }
71004
71061
  let baseGenerator;
71005
- if (authType === "openai" /* USE_OPENAI */) {
71006
- const { createOpenAIContentGenerator } = await import("./openaiContentGenerator-3U6UARHS.js");
71007
- baseGenerator = createOpenAIContentGenerator(generatorConfig, config);
71008
- } else if (authType === "qwen-oauth" /* QWEN_OAUTH */) {
71009
- const { getQwenOAuthClient: getQwenOauthClient } = await import("./qwenOAuth2-KRJT35QH.js");
71010
- const { QwenContentGenerator } = await import("./qwenContentGenerator-JRFHJRH6.js");
71011
- try {
71012
- const qwenClient = await getQwenOauthClient(
71013
- config,
71014
- isInitialAuth ? { requireCachedCredentials: true } : void 0
71015
- );
71016
- baseGenerator = new QwenContentGenerator(
71017
- qwenClient,
71018
- generatorConfig,
71019
- config
71062
+ try {
71063
+ if (authType === "openai" /* USE_OPENAI */) {
71064
+ const { createOpenAIContentGenerator } = await import("./openaiContentGenerator-FTR7CDWF.js");
71065
+ baseGenerator = createOpenAIContentGenerator(generatorConfig, config);
71066
+ } else if (authType === "qwen-oauth" /* QWEN_OAUTH */) {
71067
+ const { getQwenOAuthClient: getQwenOauthClient } = await import("./qwenOAuth2-EFSECGHF.js");
71068
+ const { QwenContentGenerator } = await import("./qwenContentGenerator-U5UFQ566.js");
71069
+ try {
71070
+ const qwenClient = await getQwenOauthClient(
71071
+ config,
71072
+ isInitialAuth ? { requireCachedCredentials: true } : void 0
71073
+ );
71074
+ baseGenerator = new QwenContentGenerator(
71075
+ qwenClient,
71076
+ generatorConfig,
71077
+ config
71078
+ );
71079
+ } catch (error) {
71080
+ if (getModuleNotFoundError(error)) {
71081
+ throw error;
71082
+ }
71083
+ throw new Error(error instanceof Error ? error.message : String(error));
71084
+ }
71085
+ } else if (authType === "anthropic" /* USE_ANTHROPIC */) {
71086
+ const { createAnthropicContentGenerator } = await import("./anthropicContentGenerator-M45EVVRM.js");
71087
+ baseGenerator = createAnthropicContentGenerator(generatorConfig, config);
71088
+ } else if (authType === "gemini" /* USE_GEMINI */ || authType === "vertex-ai" /* USE_VERTEX_AI */) {
71089
+ const { createGeminiContentGenerator } = await import("./geminiContentGenerator-I4H2NLJG.js");
71090
+ baseGenerator = createGeminiContentGenerator(generatorConfig, config);
71091
+ } else {
71092
+ throw new Error(
71093
+ `Error creating contentGenerator: Unsupported authType: ${authType}`
71020
71094
  );
71021
- } catch (error) {
71095
+ }
71096
+ } catch (error) {
71097
+ const moduleNotFoundError = getModuleNotFoundError(error);
71098
+ if (moduleNotFoundError) {
71022
71099
  throw new Error(
71023
- `${error instanceof Error ? error.message : String(error)}`
71100
+ `Qwen Code was updated in the background and needs to be restarted.
71101
+ Please exit and restart Qwen Code to use the '${authType}' provider.`,
71102
+ { cause: moduleNotFoundError }
71024
71103
  );
71025
71104
  }
71026
- } else if (authType === "anthropic" /* USE_ANTHROPIC */) {
71027
- const { createAnthropicContentGenerator } = await import("./anthropicContentGenerator-4QBVSFSJ.js");
71028
- baseGenerator = createAnthropicContentGenerator(generatorConfig, config);
71029
- } else if (authType === "gemini" /* USE_GEMINI */ || authType === "vertex-ai" /* USE_VERTEX_AI */) {
71030
- const { createGeminiContentGenerator } = await import("./geminiContentGenerator-3AKHMB3P.js");
71031
- baseGenerator = createGeminiContentGenerator(generatorConfig, config);
71032
- } else {
71033
- throw new Error(
71034
- `Error creating contentGenerator: Unsupported authType: ${authType}`
71035
- );
71105
+ throw error;
71036
71106
  }
71037
71107
  return new LoggingContentGenerator(baseGenerator, config, generatorConfig);
71038
71108
  }
@@ -73317,6 +73387,8 @@ export {
73317
73387
  DEFAULT_OTLP_ENDPOINT,
73318
73388
  retryContext,
73319
73389
  defaultModalities,
73390
+ RUNTIME_SNAPSHOT_PREFIX,
73391
+ stripRuntimeSnapshotPrefix,
73320
73392
  MODEL_GENERATION_CONFIG_FIELDS,
73321
73393
  AUTH_ENV_MAPPINGS,
73322
73394
  DEFAULT_MODELS,
@@ -3,38 +3,44 @@
3
3
  import {
4
4
  Client,
5
5
  StdioClientTransport
6
- } from "./chunk-BUOJN3MM.js";
6
+ } from "./chunk-QCG6KPNM.js";
7
7
  import "./chunk-K5PGHDBN.js";
8
+ import "./chunk-SKBPNJEW.js";
8
9
  import "./chunk-O4PICXES.js";
9
10
  import "./chunk-TW522KN6.js";
11
+ import "./chunk-AJIR24J2.js";
12
+ import "./chunk-HGJPQK33.js";
13
+ import "./chunk-XBFVXFB2.js";
10
14
  import "./chunk-MLZQVCF3.js";
11
- import "./chunk-SCHRFI7O.js";
12
- import "./chunk-PLYZAP4W.js";
13
- import "./chunk-UABFCMPA.js";
15
+ import "./chunk-PAEBHDIO.js";
16
+ import "./chunk-LD2XBG6Z.js";
17
+ import "./chunk-ICOI4E4S.js";
18
+ import "./chunk-KC6ZMJ5X.js";
14
19
  import "./chunk-77WXWU44.js";
15
- import "./chunk-6VFG3EUJ.js";
20
+ import "./chunk-JUGRPQAB.js";
21
+ import "./chunk-64WXLC72.js";
16
22
  import {
17
23
  safeJsonStringify
18
- } from "./chunk-3H7ENG2Q.js";
24
+ } from "./chunk-ZK4AMNIU.js";
19
25
  import "./chunk-3PJXIDKI.js";
20
26
  import "./chunk-UWCTAVOD.js";
21
27
  import "./chunk-OFEVLU4C.js";
22
- import "./chunk-AVLOK27J.js";
23
- import "./chunk-JSYEZAYV.js";
24
- import "./chunk-5RNZ2QKF.js";
28
+ import "./chunk-JVQOQ3OU.js";
29
+ import "./chunk-P4J26VDS.js";
30
+ import "./chunk-CNSMKPK6.js";
25
31
  import {
26
32
  BaseDeclarativeTool,
27
33
  BaseToolInvocation
28
- } from "./chunk-G763GDO6.js";
29
- import "./chunk-JMLIPZUU.js";
30
- import "./chunk-GBEPNWYB.js";
31
- import "./chunk-F5ORN4YO.js";
32
- import "./chunk-MVX64PNU.js";
33
- import "./chunk-D46KOV3C.js";
34
+ } from "./chunk-2ZTWI7KH.js";
35
+ import "./chunk-MVIVIPCU.js";
36
+ import "./chunk-GX7VH5JQ.js";
37
+ import "./chunk-UAMOBVVW.js";
38
+ import "./chunk-LR62TEET.js";
39
+ import "./chunk-Y7R6H6FT.js";
34
40
  import "./chunk-BNESGOSJ.js";
35
41
  import "./chunk-SZOEIL6S.js";
36
42
  import "./chunk-5IFG2VC4.js";
37
- import "./chunk-R5PDRHEF.js";
43
+ import "./chunk-JXAZUMDW.js";
38
44
  import "./chunk-ZERZSAZL.js";
39
45
  import "./chunk-QN5NZ3UQ.js";
40
46
  import "./chunk-BR4QREVK.js";