@qwen-code/qwen-code 0.17.0 → 0.17.1-nightly.20260604.16dd99fa3

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 (91) hide show
  1. package/bundled/qc-helper/docs/configuration/_meta.ts +0 -3
  2. package/bundled/qc-helper/docs/configuration/settings.md +13 -12
  3. package/bundled/qc-helper/docs/configuration/themes.md +39 -0
  4. package/bundled/qc-helper/docs/features/approval-mode.md +26 -22
  5. package/bundled/qc-helper/docs/features/commands.md +68 -12
  6. package/bundled/qc-helper/docs/features/status-line.md +168 -32
  7. package/bundled/qc-helper/docs/reference/keyboard-shortcuts.md +16 -0
  8. package/bundled/simplify/SKILL.md +123 -0
  9. package/chunks/{agent-KVXFGIOU.js → agent-GNHB6UIW.js} +14 -13
  10. package/chunks/{anthropicContentGenerator-L4HWAOIV.js → anthropicContentGenerator-M45RXZVS.js} +48 -5
  11. package/chunks/{askUserQuestion-DC6OWQIL.js → askUserQuestion-TGRD7FNQ.js} +1 -1
  12. package/chunks/{ca-NMZFEGAU.js → ca-6RSCDYUS.js} +2 -1
  13. package/chunks/{chunk-J5VCSWPA.js → chunk-3PJXIDKI.js} +1153 -103
  14. package/chunks/{chunk-EMVEDSVZ.js → chunk-6O244QKR.js} +43 -3
  15. package/chunks/chunk-7TQVELRB.js +10412 -0
  16. package/chunks/{chunk-HCSJIOLR.js → chunk-BNESGOSJ.js} +7450 -3516
  17. package/chunks/{chunk-7YJIR2FX.js → chunk-G4K6P5KN.js} +8 -15
  18. package/chunks/chunk-HX3JRTWL.js +393 -0
  19. package/chunks/{chunk-V7LMZR76.js → chunk-JBSYXHJF.js} +1 -1
  20. package/chunks/{chunk-R2B65CAN.js → chunk-JKUAX6UT.js} +0 -1
  21. package/chunks/{chunk-7EHPK6TK.js → chunk-JR346RJ5.js} +4007 -2390
  22. package/chunks/{chunk-JI7FDD65.js → chunk-K3VUDSWM.js} +9 -6
  23. package/chunks/chunk-MRO43B25.js +30 -0
  24. package/chunks/{chunk-4O2TWJK4.js → chunk-NDZEP7SA.js} +183 -40
  25. package/chunks/{chunk-7NNBQRV7.js → chunk-NJY4F5NM.js} +4 -4
  26. package/chunks/{chunk-ODPVJ6JJ.js → chunk-OJFMTECH.js} +6 -1
  27. package/chunks/{chunk-U2K6HDUJ.js → chunk-QVJ33ZBG.js} +23 -13
  28. package/chunks/{chunk-HAQCNXSG.js → chunk-RQW7WUJR.js} +15 -0
  29. package/chunks/{chunk-UQRYJQBE.js → chunk-SOGUPKP6.js} +1 -1
  30. package/chunks/{chunk-6NUSWV4M.js → chunk-TDZCEIK6.js} +2 -0
  31. package/chunks/{chunk-QEXSIXLX.js → chunk-XK4IGU5E.js} +10 -10
  32. package/chunks/{chunk-MEN6IEKX.js → chunk-YVGIQ2CS.js} +456 -1225
  33. package/chunks/{computer-use-2J5ZXEER.js → computer-use-NAHQPV2L.js} +24 -6
  34. package/chunks/{contextCommand-52NTEMCT.js → contextCommand-VKNIA257.js} +16 -15
  35. package/chunks/{cron-create-FXRORK2U.js → cron-create-V3UK2SJN.js} +1 -1
  36. package/chunks/{cron-delete-D24IN6CA.js → cron-delete-MANALPCP.js} +1 -1
  37. package/chunks/{cron-list-SMOX26SL.js → cron-list-UDIYK3B3.js} +1 -1
  38. package/chunks/{de-OIMT3OMI.js → de-APURNJ3I.js} +2 -1
  39. package/chunks/{dist-GRQVFL3G.js → dist-ATAKC63R.js} +1 -1
  40. package/chunks/{edit-RLFUTT5F.js → edit-YP22XCVA.js} +14 -13
  41. package/chunks/{en-2IFZ5THF.js → en-FYO57HJW.js} +3 -1
  42. package/chunks/{enter-worktree-CYRAPQKJ.js → enter-worktree-BD7UFMUZ.js} +14 -13
  43. package/chunks/{exit-worktree-WQZM72QD.js → exit-worktree-AVWBCQWY.js} +14 -13
  44. package/chunks/{exitPlanMode-STFEBQZE.js → exitPlanMode-2D6EGF76.js} +14 -13
  45. package/chunks/{fr-PVELSHTV.js → fr-32YHQZIS.js} +2 -1
  46. package/chunks/{geminiContentGenerator-DIV32SKO.js → geminiContentGenerator-YFVW6DXY.js} +4 -3
  47. package/chunks/{glob-N3XO4RVI.js → glob-NZWP66L5.js} +14 -13
  48. package/chunks/{grep-AK5MP7P3.js → grep-RFEZDGI4.js} +14 -13
  49. package/chunks/{ja-P5TK5GNN.js → ja-PEUXN4XT.js} +2 -1
  50. package/chunks/{ls-7FYQHPWF.js → ls-T4SVZWR6.js} +1 -1
  51. package/chunks/{lsp-DKG34USR.js → lsp-U4ZQLNIS.js} +1 -1
  52. package/chunks/{monitor-IVBWJZEZ.js → monitor-OHKCQLFQ.js} +17 -14
  53. package/chunks/{multipart-parser-IXGBIOIN.js → multipart-parser-AJ4WASWR.js} +2 -2
  54. package/chunks/{notebook-edit-PM46AXFS.js → notebook-edit-AFRICVUX.js} +14 -13
  55. package/chunks/{openaiContentGenerator-4QXCH7L2.js → openaiContentGenerator-47KB64GP.js} +11 -10
  56. package/chunks/{pt-A5GHG66T.js → pt-2INS7YVC.js} +2 -1
  57. package/chunks/{qwenContentGenerator-BLXQIIMX.js → qwenContentGenerator-7BC2OW3T.js} +16 -15
  58. package/chunks/{qwenOAuth2-BAN2EGSH.js → qwenOAuth2-LKXG7XVO.js} +2 -1
  59. package/chunks/{read-file-IEQAS3EZ.js → read-file-MXUW3RUF.js} +8 -7
  60. package/chunks/{ripGrep-HQO7IE4C.js → ripGrep-AHBINNF3.js} +14 -13
  61. package/chunks/{ru-66XKB4QX.js → ru-6CQ5HNHB.js} +2 -1
  62. package/chunks/scheduler-KBRJ3LFC.js +306 -0
  63. package/chunks/{send-message-ZL7CDM7K.js → send-message-GFYV7WLL.js} +1 -1
  64. package/chunks/{serve-CYRAK4UM.js → serve-PVFP6HD7.js} +43 -30
  65. package/chunks/{shell-UZBGNO2Q.js → shell-JOXQ5PPL.js} +14 -13
  66. package/chunks/{skill-JVC34QYN.js → skill-73RYGDJQ.js} +9 -8
  67. package/chunks/{src-TMOD5X6F.js → src-7XL4G4DC.js} +88 -46
  68. package/chunks/{src-FOODLH7B.js → src-DR3Y7J6D.js} +41 -15
  69. package/chunks/{syntheticOutput-U3YJ3GOO.js → syntheticOutput-DM43O6TY.js} +2 -2
  70. package/chunks/{task-stop-NPUI3YBA.js → task-stop-WKP5OB3V.js} +1 -1
  71. package/chunks/{todoWrite-Y6F7YEIM.js → todoWrite-GHL6DCLP.js} +14 -3
  72. package/chunks/{tool-search-P7PRPOW3.js → tool-search-DRMR34WX.js} +8 -7
  73. package/chunks/{web-fetch-XWEK4TFX.js → web-fetch-SZIV74ZX.js} +2 -2
  74. package/chunks/{write-file-SIIEUON5.js → write-file-B45ZAKUJ.js} +16 -15
  75. package/chunks/{zh-TW-3ND6DQRX.js → zh-TW-SSL3ATVZ.js} +3 -1
  76. package/chunks/{zh-OB5P2ZDO.js → zh-ZHZCMIRG.js} +3 -1
  77. package/cli.js +38665 -53791
  78. package/locales/ca.js +2 -1
  79. package/locales/de.js +2 -1
  80. package/locales/en.js +4 -1
  81. package/locales/fr.js +2 -1
  82. package/locales/ja.js +2 -1
  83. package/locales/pt.js +2 -1
  84. package/locales/ru.js +2 -1
  85. package/locales/zh-TW.js +4 -1
  86. package/locales/zh.js +4 -1
  87. package/package.json +2 -2
  88. package/chunks/chunk-EM6ETG2K.js +0 -60
  89. package/chunks/chunk-TI4GXJKO.js +0 -4277
  90. package/chunks/multipart-parser-3QWGTLK3.js +0 -384
  91. package/chunks/src-IPWIHNMI.js +0 -1406
@@ -3,6 +3,9 @@
3
3
  import {
4
4
  formatFetchErrorForUser
5
5
  } from "./chunk-OIL7KDWV.js";
6
+ import {
7
+ atomicWriteFile
8
+ } from "./chunk-HX3JRTWL.js";
6
9
  import {
7
10
  Storage,
8
11
  createDebugLogger
@@ -944,7 +947,6 @@ var SharedTokenManager = class _SharedTokenManager {
944
947
  async saveCredentialsToFile(credentials) {
945
948
  const filePath = this.getCredentialFilePath();
946
949
  const dirPath = path2.dirname(filePath);
947
- const tempPath = `${filePath}.tmp.${randomUUID()}`;
948
950
  try {
949
951
  await this.withTimeout(
950
952
  fs6.mkdir(dirPath, { recursive: true, mode: 448 }),
@@ -960,16 +962,11 @@ var SharedTokenManager = class _SharedTokenManager {
960
962
  }
961
963
  const credString = JSON.stringify(credentials, null, 2);
962
964
  try {
963
- await this.withTimeout(
964
- fs6.writeFile(tempPath, credString, { mode: 384 }),
965
- 5e3,
966
- "File operation"
967
- );
968
- await this.withTimeout(
969
- fs6.rename(tempPath, filePath),
970
- 5e3,
971
- "File operation"
972
- );
965
+ await atomicWriteFile(filePath, credString, {
966
+ mode: 384,
967
+ forceMode: true,
968
+ noFollow: true
969
+ });
973
970
  const stats = await this.withTimeout(
974
971
  fs6.stat(filePath),
975
972
  5e3,
@@ -977,10 +974,6 @@ var SharedTokenManager = class _SharedTokenManager {
977
974
  );
978
975
  this.memoryCache.fileModTime = stats.mtimeMs;
979
976
  } catch (error) {
980
- try {
981
- await this.withTimeout(fs6.unlink(tempPath), 1e3, "File operation");
982
- } catch (_cleanupError) {
983
- }
984
977
  throw new TokenManagerError(
985
978
  "FILE_ACCESS_ERROR" /* FILE_ACCESS_ERROR */,
986
979
  `Failed to write credentials file: ${error instanceof Error ? error.message : String(error)}`,
@@ -0,0 +1,393 @@
1
+ // Force strict mode and setup for ESM
2
+ "use strict";
3
+ import {
4
+ createDebugLogger,
5
+ isNodeError
6
+ } from "./chunk-ACBGEKB7.js";
7
+ import {
8
+ init_esbuild_shims
9
+ } from "./chunk-A4BMJM77.js";
10
+ import {
11
+ __name
12
+ } from "./chunk-J2S4EL5Y.js";
13
+
14
+ // packages/core/src/utils/atomicFileWrite.ts
15
+ init_esbuild_shims();
16
+ import * as crypto from "node:crypto";
17
+ import * as fsSync from "node:fs";
18
+ import * as fs from "node:fs/promises";
19
+ import * as path from "node:path";
20
+ var debugLogger = createDebugLogger("ATOMIC_WRITE");
21
+ async function renameWithRetry(src, dest, retries, delayMs, _renameImpl = fs.rename) {
22
+ for (let attempt = 0; attempt <= retries; attempt++) {
23
+ try {
24
+ await _renameImpl(src, dest);
25
+ return;
26
+ } catch (error) {
27
+ const isRetryable = isNodeError(error) && (error.code === "EPERM" || error.code === "EACCES");
28
+ if (!isRetryable || attempt === retries) {
29
+ throw error;
30
+ }
31
+ await new Promise(
32
+ (resolve2) => setTimeout(resolve2, delayMs * 2 ** attempt)
33
+ );
34
+ }
35
+ }
36
+ }
37
+ __name(renameWithRetry, "renameWithRetry");
38
+ async function resolveSymlinkChain(filePath) {
39
+ const maxHops = 40;
40
+ let current = filePath;
41
+ for (let i = 0; i < maxHops; i++) {
42
+ let lstats;
43
+ try {
44
+ lstats = await fs.lstat(current);
45
+ } catch (err2) {
46
+ if (isNodeError(err2) && err2.code === "ENOENT") {
47
+ return current;
48
+ }
49
+ throw err2;
50
+ }
51
+ if (!lstats.isSymbolicLink()) {
52
+ return current;
53
+ }
54
+ const linkTarget = await fs.readlink(current);
55
+ if (path.isAbsolute(linkTarget)) {
56
+ current = linkTarget;
57
+ } else {
58
+ const parentDir = await fs.realpath(path.dirname(current));
59
+ current = path.resolve(parentDir, linkTarget);
60
+ }
61
+ }
62
+ const err = new Error(
63
+ `ELOOP: too many levels of symbolic links, resolve '${filePath}'`
64
+ );
65
+ err.code = "ELOOP";
66
+ throw err;
67
+ }
68
+ __name(resolveSymlinkChain, "resolveSymlinkChain");
69
+ async function atomicWriteFile(filePath, data, options, _testFs) {
70
+ const retries = options?.retries ?? 3;
71
+ const delayMs = options?.delayMs ?? 50;
72
+ const flush = options?.flush ?? true;
73
+ const encoding = options?.encoding ?? "utf-8";
74
+ const renameImpl = _testFs?.rename ?? fs.rename;
75
+ const writeFileImpl = _testFs?.writeFile ?? fs.writeFile;
76
+ const openImpl = _testFs?.open ?? fs.open;
77
+ const chmodImpl = _testFs?.chmod ?? fs.chmod;
78
+ const fchmodImpl = _testFs?.fchmod ?? ((fh, mode) => fh.chmod(mode));
79
+ const unlinkImpl = _testFs?.unlink ?? fs.unlink;
80
+ const targetPath = options?.noFollow ? filePath : await resolveSymlinkChain(filePath).catch((err) => {
81
+ throw annotateWriteError(err, filePath);
82
+ });
83
+ let existingStat;
84
+ try {
85
+ existingStat = await fs.stat(targetPath);
86
+ } catch (err) {
87
+ if (!isNodeError(err) || err.code !== "ENOENT") {
88
+ throw err;
89
+ }
90
+ }
91
+ let existingMode;
92
+ if (!options?.forceMode || options?.mode === void 0) {
93
+ existingMode = existingStat !== void 0 ? existingStat.mode & 4095 : void 0;
94
+ }
95
+ const desiredMode = existingMode ?? options?.mode;
96
+ const writeOptions = {};
97
+ if (typeof data === "string") writeOptions.encoding = encoding;
98
+ if (flush) writeOptions.flush = true;
99
+ if (desiredMode !== void 0) writeOptions.mode = desiredMode;
100
+ const tryChmod = /* @__PURE__ */ __name(async (target) => {
101
+ if (desiredMode === void 0) return;
102
+ try {
103
+ await chmodImpl(target, desiredMode);
104
+ } catch (chmodErr) {
105
+ if (!isNodeError(chmodErr) || chmodErr.code !== "ENOSYS" && chmodErr.code !== "ENOTSUP") {
106
+ throw chmodErr;
107
+ }
108
+ }
109
+ }, "tryChmod");
110
+ const ownershipWouldChange = /* @__PURE__ */ __name(() => {
111
+ if (existingStat === void 0) return false;
112
+ if (process.platform === "win32") return false;
113
+ const euid = process.geteuid?.();
114
+ if (euid === void 0) return false;
115
+ return existingStat.uid !== euid;
116
+ }, "ownershipWouldChange");
117
+ if (existingStat !== void 0 && existingStat.isFile() && ownershipWouldChange()) {
118
+ await fs.writeFile(targetPath, data, writeOptions);
119
+ await tryChmod(targetPath);
120
+ return;
121
+ }
122
+ const tmpPath = `${targetPath}.${crypto.randomBytes(6).toString("hex")}.tmp`;
123
+ try {
124
+ await writeFileImpl(tmpPath, data, writeOptions);
125
+ await tryChmod(tmpPath);
126
+ await renameWithRetry(tmpPath, targetPath, retries, delayMs, renameImpl);
127
+ } catch (error) {
128
+ try {
129
+ await unlinkImpl(tmpPath);
130
+ } catch {
131
+ }
132
+ if (isNodeError(error) && error.code === "EXDEV") {
133
+ try {
134
+ if (options?.noFollow) {
135
+ try {
136
+ await unlinkImpl(targetPath);
137
+ } catch (unlinkErr) {
138
+ if (!isNodeError(unlinkErr) || unlinkErr.code !== "ENOENT") {
139
+ throw unlinkErr;
140
+ }
141
+ }
142
+ const fd = await openImpl(
143
+ targetPath,
144
+ fsSync.constants.O_WRONLY | fsSync.constants.O_CREAT | fsSync.constants.O_EXCL,
145
+ desiredMode ?? 438
146
+ );
147
+ let writeOk = false;
148
+ try {
149
+ try {
150
+ await fd.writeFile(
151
+ typeof data === "string" ? Buffer.from(data, encoding) : data
152
+ );
153
+ if (flush) await fd.sync();
154
+ if (desiredMode !== void 0) {
155
+ try {
156
+ await fchmodImpl(fd, desiredMode);
157
+ } catch (chmodErr) {
158
+ if (!isNodeError(chmodErr) || chmodErr.code !== "ENOSYS" && chmodErr.code !== "ENOTSUP") {
159
+ throw chmodErr;
160
+ }
161
+ }
162
+ }
163
+ writeOk = true;
164
+ } finally {
165
+ await fd.close();
166
+ }
167
+ } catch (writeErr) {
168
+ if (!writeOk) {
169
+ try {
170
+ await unlinkImpl(targetPath);
171
+ } catch (orphanErr) {
172
+ debugLogger.debug(
173
+ `orphan unlink failed for ${targetPath}:`,
174
+ orphanErr
175
+ );
176
+ }
177
+ }
178
+ throw writeErr;
179
+ }
180
+ } else {
181
+ await writeFileImpl(targetPath, data, writeOptions);
182
+ await tryChmod(targetPath);
183
+ }
184
+ return;
185
+ } catch (fallbackError) {
186
+ throw annotateWriteError(fallbackError, targetPath);
187
+ }
188
+ }
189
+ throw annotateWriteError(error, targetPath);
190
+ }
191
+ }
192
+ __name(atomicWriteFile, "atomicWriteFile");
193
+ function annotateWriteError(error, targetPath, fnName = "atomicWriteFile") {
194
+ if (error instanceof Error && !error.message.startsWith(`${fnName}(`)) {
195
+ error.message = `${fnName}(${JSON.stringify(targetPath)}): ${error.message}`;
196
+ }
197
+ return error;
198
+ }
199
+ __name(annotateWriteError, "annotateWriteError");
200
+ async function atomicWriteJSON(filePath, data, options) {
201
+ await atomicWriteFile(filePath, JSON.stringify(data, null, 2), {
202
+ encoding: "utf-8",
203
+ ...options
204
+ });
205
+ }
206
+ __name(atomicWriteJSON, "atomicWriteJSON");
207
+ function blockingSleep(ms) {
208
+ if (ms <= 0) return;
209
+ const sab = new SharedArrayBuffer(4);
210
+ const i32 = new Int32Array(sab);
211
+ Atomics.wait(i32, 0, 0, ms);
212
+ }
213
+ __name(blockingSleep, "blockingSleep");
214
+ function renameWithRetrySync(src, dest, retries, delayMs, _renameImpl = fsSync.renameSync) {
215
+ for (let attempt = 0; attempt <= retries; attempt++) {
216
+ try {
217
+ _renameImpl(src, dest);
218
+ return;
219
+ } catch (error) {
220
+ const isRetryable = isNodeError(error) && (error.code === "EPERM" || error.code === "EACCES");
221
+ if (!isRetryable || attempt === retries) {
222
+ throw error;
223
+ }
224
+ blockingSleep(delayMs * 2 ** attempt);
225
+ }
226
+ }
227
+ }
228
+ __name(renameWithRetrySync, "renameWithRetrySync");
229
+ function resolveSymlinkChainSync(filePath) {
230
+ const maxHops = 40;
231
+ let current = filePath;
232
+ for (let i = 0; i < maxHops; i++) {
233
+ let lstats;
234
+ try {
235
+ lstats = fsSync.lstatSync(current);
236
+ } catch (err2) {
237
+ if (isNodeError(err2) && err2.code === "ENOENT") {
238
+ return current;
239
+ }
240
+ throw err2;
241
+ }
242
+ if (!lstats.isSymbolicLink()) {
243
+ return current;
244
+ }
245
+ const linkTarget = fsSync.readlinkSync(current);
246
+ if (path.isAbsolute(linkTarget)) {
247
+ current = linkTarget;
248
+ } else {
249
+ const parentDir = fsSync.realpathSync(path.dirname(current));
250
+ current = path.resolve(parentDir, linkTarget);
251
+ }
252
+ }
253
+ const err = new Error(
254
+ `ELOOP: too many levels of symbolic links, resolve '${filePath}'`
255
+ );
256
+ err.code = "ELOOP";
257
+ throw err;
258
+ }
259
+ __name(resolveSymlinkChainSync, "resolveSymlinkChainSync");
260
+ function atomicWriteFileSync(filePath, data, options, _testFs) {
261
+ const retries = options?.retries ?? 3;
262
+ const delayMs = options?.delayMs ?? 50;
263
+ const flush = options?.flush ?? true;
264
+ const encoding = options?.encoding ?? "utf-8";
265
+ const renameImpl = _testFs?.rename ?? fsSync.renameSync;
266
+ const writeFileImpl = _testFs?.writeFile ?? fsSync.writeFileSync;
267
+ const openImpl = _testFs?.open ?? fsSync.openSync;
268
+ const chmodImpl = _testFs?.chmod ?? fsSync.chmodSync;
269
+ const fchmodImpl = _testFs?.fchmod ?? fsSync.fchmodSync;
270
+ const unlinkImpl = _testFs?.unlink ?? fsSync.unlinkSync;
271
+ let targetPath;
272
+ if (options?.noFollow) {
273
+ targetPath = filePath;
274
+ } else {
275
+ try {
276
+ targetPath = resolveSymlinkChainSync(filePath);
277
+ } catch (err) {
278
+ throw annotateWriteError(err, filePath, "atomicWriteFileSync");
279
+ }
280
+ }
281
+ const tmpPath = `${targetPath}.${crypto.randomBytes(6).toString("hex")}.tmp`;
282
+ let existingMode;
283
+ if (!options?.forceMode || options?.mode === void 0) {
284
+ try {
285
+ const stat2 = fsSync.statSync(targetPath);
286
+ existingMode = stat2.mode & 4095;
287
+ } catch (err) {
288
+ if (!isNodeError(err) || err.code !== "ENOENT") {
289
+ throw err;
290
+ }
291
+ }
292
+ }
293
+ const desiredMode = existingMode ?? options?.mode;
294
+ const writeOptions = {};
295
+ if (typeof data === "string") writeOptions.encoding = encoding;
296
+ if (flush) writeOptions.flush = true;
297
+ if (desiredMode !== void 0) writeOptions.mode = desiredMode;
298
+ const tryChmodSync = /* @__PURE__ */ __name((target) => {
299
+ if (desiredMode === void 0) return;
300
+ try {
301
+ chmodImpl(target, desiredMode);
302
+ } catch (chmodErr) {
303
+ if (!isNodeError(chmodErr) || chmodErr.code !== "ENOSYS" && chmodErr.code !== "ENOTSUP") {
304
+ throw chmodErr;
305
+ }
306
+ }
307
+ }, "tryChmodSync");
308
+ try {
309
+ writeFileImpl(tmpPath, data, writeOptions);
310
+ tryChmodSync(tmpPath);
311
+ renameWithRetrySync(tmpPath, targetPath, retries, delayMs, renameImpl);
312
+ } catch (error) {
313
+ try {
314
+ unlinkImpl(tmpPath);
315
+ } catch {
316
+ }
317
+ if (isNodeError(error) && error.code === "EXDEV") {
318
+ try {
319
+ if (options?.noFollow) {
320
+ try {
321
+ unlinkImpl(targetPath);
322
+ } catch (unlinkErr) {
323
+ if (!isNodeError(unlinkErr) || unlinkErr.code !== "ENOENT") {
324
+ throw unlinkErr;
325
+ }
326
+ }
327
+ const fd = openImpl(
328
+ targetPath,
329
+ fsSync.constants.O_WRONLY | fsSync.constants.O_CREAT | fsSync.constants.O_EXCL,
330
+ desiredMode ?? 438
331
+ );
332
+ let writeOk = false;
333
+ try {
334
+ try {
335
+ const buf = typeof data === "string" ? Buffer.from(data, encoding) : data;
336
+ fsSync.writeFileSync(fd, buf);
337
+ if (flush) fsSync.fsyncSync(fd);
338
+ if (desiredMode !== void 0) {
339
+ try {
340
+ fchmodImpl(fd, desiredMode);
341
+ } catch (chmodErr) {
342
+ if (!isNodeError(chmodErr) || chmodErr.code !== "ENOSYS" && chmodErr.code !== "ENOTSUP") {
343
+ throw chmodErr;
344
+ }
345
+ }
346
+ }
347
+ writeOk = true;
348
+ } finally {
349
+ fsSync.closeSync(fd);
350
+ }
351
+ } catch (writeErr) {
352
+ if (!writeOk) {
353
+ try {
354
+ unlinkImpl(targetPath);
355
+ } catch (orphanErr) {
356
+ debugLogger.debug(
357
+ `orphan unlink failed for ${targetPath}:`,
358
+ orphanErr
359
+ );
360
+ }
361
+ }
362
+ throw writeErr;
363
+ }
364
+ } else {
365
+ writeFileImpl(targetPath, data, writeOptions);
366
+ tryChmodSync(targetPath);
367
+ }
368
+ return;
369
+ } catch (fallbackError) {
370
+ throw annotateWriteError(
371
+ fallbackError,
372
+ targetPath,
373
+ "atomicWriteFileSync"
374
+ );
375
+ }
376
+ }
377
+ throw annotateWriteError(error, targetPath, "atomicWriteFileSync");
378
+ }
379
+ }
380
+ __name(atomicWriteFileSync, "atomicWriteFileSync");
381
+
382
+ export {
383
+ renameWithRetry,
384
+ atomicWriteFile,
385
+ atomicWriteJSON,
386
+ renameWithRetrySync,
387
+ atomicWriteFileSync
388
+ };
389
+ /**
390
+ * @license
391
+ * Copyright 2025 Qwen Team
392
+ * SPDX-License-Identifier: Apache-2.0
393
+ */
@@ -3,7 +3,7 @@
3
3
  import {
4
4
  TextTokenizer,
5
5
  isSupportedImageMimeType
6
- } from "./chunk-U2K6HDUJ.js";
6
+ } from "./chunk-QVJ33ZBG.js";
7
7
  import {
8
8
  createDebugLogger
9
9
  } from "./chunk-ACBGEKB7.js";
@@ -14840,7 +14840,6 @@ export {
14840
14840
  ToolErrorType,
14841
14841
  require_fast_deep_equal,
14842
14842
  require_fast_uri,
14843
- require_ajv,
14844
14843
  require_dist,
14845
14844
  SchemaValidator,
14846
14845
  AgentStatistics,