@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
@@ -1,8 +1,5 @@
1
1
  // Force strict mode and setup for ESM
2
2
  "use strict";
3
- import {
4
- require_safer
5
- } from "./chunk-SYCJMSIJ.js";
6
3
  import {
7
4
  require_hasown
8
5
  } from "./chunk-UWCTAVOD.js";
@@ -17,9 +14,10 @@ import {
17
14
  DEFAULT_OPENAI_BASE_URL,
18
15
  convertSchema,
19
16
  normalize,
17
+ runtimeDiagnostics,
20
18
  safeJsonParse,
21
19
  tokenLimit
22
- } from "./chunk-CW44BRRA.js";
20
+ } from "./chunk-MAY32HXD.js";
23
21
  import {
24
22
  InstallationManager
25
23
  } from "./chunk-D5NTAHYL.js";
@@ -29,13 +27,13 @@ import {
29
27
  } from "./chunk-T4VD6OJ4.js";
30
28
  import {
31
29
  STRUCTURED_OUTPUT_REDACTED_ARGS
32
- } from "./chunk-JYQUJ5DS.js";
30
+ } from "./chunk-YJLGXDQJ.js";
33
31
  import {
34
32
  BaseDeclarativeTool,
35
33
  BaseToolInvocation,
36
34
  ToolDisplayNames,
37
35
  ToolNames
38
- } from "./chunk-FZIUV27X.js";
36
+ } from "./chunk-PVVL5Q3W.js";
39
37
  import {
40
38
  FatalConfigError,
41
39
  Storage,
@@ -87,9 +85,78 @@ import {
87
85
  __toESM
88
86
  } from "./chunk-J2S4EL5Y.js";
89
87
 
90
- // packages/core/node_modules/iconv-lite/lib/bom-handling.js
88
+ // node_modules/safer-buffer/safer.js
89
+ var require_safer = __commonJS({
90
+ "node_modules/safer-buffer/safer.js"(exports2, module2) {
91
+ "use strict";
92
+ init_esbuild_shims();
93
+ var buffer = __require("buffer");
94
+ var Buffer3 = buffer.Buffer;
95
+ var safer = {};
96
+ var key;
97
+ for (key in buffer) {
98
+ if (!buffer.hasOwnProperty(key)) continue;
99
+ if (key === "SlowBuffer" || key === "Buffer") continue;
100
+ safer[key] = buffer[key];
101
+ }
102
+ var Safer = safer.Buffer = {};
103
+ for (key in Buffer3) {
104
+ if (!Buffer3.hasOwnProperty(key)) continue;
105
+ if (key === "allocUnsafe" || key === "allocUnsafeSlow") continue;
106
+ Safer[key] = Buffer3[key];
107
+ }
108
+ safer.Buffer.prototype = Buffer3.prototype;
109
+ if (!Safer.from || Safer.from === Uint8Array.from) {
110
+ Safer.from = function(value, encodingOrOffset, length) {
111
+ if (typeof value === "number") {
112
+ throw new TypeError('The "value" argument must not be of type number. Received type ' + typeof value);
113
+ }
114
+ if (value && typeof value.length === "undefined") {
115
+ throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof value);
116
+ }
117
+ return Buffer3(value, encodingOrOffset, length);
118
+ };
119
+ }
120
+ if (!Safer.alloc) {
121
+ Safer.alloc = function(size, fill, encoding) {
122
+ if (typeof size !== "number") {
123
+ throw new TypeError('The "size" argument must be of type number. Received type ' + typeof size);
124
+ }
125
+ if (size < 0 || size >= 2 * (1 << 30)) {
126
+ throw new RangeError('The value "' + size + '" is invalid for option "size"');
127
+ }
128
+ var buf = Buffer3(size);
129
+ if (!fill || fill.length === 0) {
130
+ buf.fill(0);
131
+ } else if (typeof encoding === "string") {
132
+ buf.fill(fill, encoding);
133
+ } else {
134
+ buf.fill(fill);
135
+ }
136
+ return buf;
137
+ };
138
+ }
139
+ if (!safer.kStringMaxLength) {
140
+ try {
141
+ safer.kStringMaxLength = process.binding("buffer").kStringMaxLength;
142
+ } catch (e) {
143
+ }
144
+ }
145
+ if (!safer.constants) {
146
+ safer.constants = {
147
+ MAX_LENGTH: safer.kMaxLength
148
+ };
149
+ if (safer.kStringMaxLength) {
150
+ safer.constants.MAX_STRING_LENGTH = safer.kStringMaxLength;
151
+ }
152
+ }
153
+ module2.exports = safer;
154
+ }
155
+ });
156
+
157
+ // node_modules/iconv-lite/lib/bom-handling.js
91
158
  var require_bom_handling = __commonJS({
92
- "packages/core/node_modules/iconv-lite/lib/bom-handling.js"(exports2) {
159
+ "node_modules/iconv-lite/lib/bom-handling.js"(exports2) {
93
160
  "use strict";
94
161
  init_esbuild_shims();
95
162
  var BOMChar = "\uFEFF";
@@ -118,14 +185,12 @@ var require_bom_handling = __commonJS({
118
185
  __name(StripBOMWrapper, "StripBOMWrapper");
119
186
  StripBOMWrapper.prototype.write = function(buf) {
120
187
  var res = this.decoder.write(buf);
121
- if (this.pass || !res) {
188
+ if (this.pass || !res)
122
189
  return res;
123
- }
124
190
  if (res[0] === BOMChar) {
125
191
  res = res.slice(1);
126
- if (typeof this.options.stripBOM === "function") {
192
+ if (typeof this.options.stripBOM === "function")
127
193
  this.options.stripBOM();
128
- }
129
194
  }
130
195
  this.pass = true;
131
196
  return res;
@@ -136,27 +201,9 @@ var require_bom_handling = __commonJS({
136
201
  }
137
202
  });
138
203
 
139
- // packages/core/node_modules/iconv-lite/lib/helpers/merge-exports.js
140
- var require_merge_exports = __commonJS({
141
- "packages/core/node_modules/iconv-lite/lib/helpers/merge-exports.js"(exports2, module2) {
142
- "use strict";
143
- init_esbuild_shims();
144
- var hasOwn = typeof Object.hasOwn === "undefined" ? Function.call.bind(Object.prototype.hasOwnProperty) : Object.hasOwn;
145
- function mergeModules(target, module3) {
146
- for (var key in module3) {
147
- if (hasOwn(module3, key)) {
148
- target[key] = module3[key];
149
- }
150
- }
151
- }
152
- __name(mergeModules, "mergeModules");
153
- module2.exports = mergeModules;
154
- }
155
- });
156
-
157
- // packages/core/node_modules/iconv-lite/encodings/internal.js
204
+ // node_modules/iconv-lite/encodings/internal.js
158
205
  var require_internal = __commonJS({
159
- "packages/core/node_modules/iconv-lite/encodings/internal.js"(exports2, module2) {
206
+ "node_modules/iconv-lite/encodings/internal.js"(exports2, module2) {
160
207
  "use strict";
161
208
  init_esbuild_shims();
162
209
  var Buffer3 = require_safer().Buffer;
@@ -176,11 +223,9 @@ var require_internal = __commonJS({
176
223
  function InternalCodec(codecOptions, iconv) {
177
224
  this.enc = codecOptions.encodingName;
178
225
  this.bomAware = codecOptions.bomAware;
179
- if (this.enc === "base64") {
226
+ if (this.enc === "base64")
180
227
  this.encoder = InternalEncoderBase64;
181
- } else if (this.enc === "utf8") {
182
- this.encoder = InternalEncoderUtf8;
183
- } else if (this.enc === "cesu8") {
228
+ else if (this.enc === "cesu8") {
184
229
  this.enc = "utf8";
185
230
  this.encoder = InternalEncoderCesu8;
186
231
  if (Buffer3.from("eda0bdedb2a9", "hex").toString() !== "\u{1F4A9}") {
@@ -193,6 +238,9 @@ var require_internal = __commonJS({
193
238
  InternalCodec.prototype.encoder = InternalEncoder;
194
239
  InternalCodec.prototype.decoder = InternalDecoder;
195
240
  var StringDecoder = __require("string_decoder").StringDecoder;
241
+ if (!StringDecoder.prototype.end)
242
+ StringDecoder.prototype.end = function() {
243
+ };
196
244
  function InternalDecoder(options, codec) {
197
245
  this.decoder = new StringDecoder(codec.enc);
198
246
  }
@@ -233,13 +281,12 @@ var require_internal = __commonJS({
233
281
  }
234
282
  __name(InternalEncoderCesu8, "InternalEncoderCesu8");
235
283
  InternalEncoderCesu8.prototype.write = function(str) {
236
- var buf = Buffer3.alloc(str.length * 3);
237
- var bufIdx = 0;
284
+ var buf = Buffer3.alloc(str.length * 3), bufIdx = 0;
238
285
  for (var i = 0; i < str.length; i++) {
239
286
  var charCode = str.charCodeAt(i);
240
- if (charCode < 128) {
287
+ if (charCode < 128)
241
288
  buf[bufIdx++] = charCode;
242
- } else if (charCode < 2048) {
289
+ else if (charCode < 2048) {
243
290
  buf[bufIdx++] = 192 + (charCode >>> 6);
244
291
  buf[bufIdx++] = 128 + (charCode & 63);
245
292
  } else {
@@ -260,10 +307,7 @@ var require_internal = __commonJS({
260
307
  }
261
308
  __name(InternalDecoderCesu8, "InternalDecoderCesu8");
262
309
  InternalDecoderCesu8.prototype.write = function(buf) {
263
- var acc = this.acc;
264
- var contBytes = this.contBytes;
265
- var accBytes = this.accBytes;
266
- var res = "";
310
+ var acc = this.acc, contBytes = this.contBytes, accBytes = this.accBytes, res = "";
267
311
  for (var i = 0; i < buf.length; i++) {
268
312
  var curByte = buf[i];
269
313
  if ((curByte & 192) !== 128) {
@@ -290,13 +334,12 @@ var require_internal = __commonJS({
290
334
  contBytes--;
291
335
  accBytes++;
292
336
  if (contBytes === 0) {
293
- if (accBytes === 2 && acc < 128 && acc > 0) {
337
+ if (accBytes === 2 && acc < 128 && acc > 0)
294
338
  res += this.defaultCharUnicode;
295
- } else if (accBytes === 3 && acc < 2048) {
339
+ else if (accBytes === 3 && acc < 2048)
296
340
  res += this.defaultCharUnicode;
297
- } else {
341
+ else
298
342
  res += String.fromCharCode(acc);
299
- }
300
343
  }
301
344
  } else {
302
345
  res += this.defaultCharUnicode;
@@ -310,42 +353,16 @@ var require_internal = __commonJS({
310
353
  };
311
354
  InternalDecoderCesu8.prototype.end = function() {
312
355
  var res = 0;
313
- if (this.contBytes > 0) {
356
+ if (this.contBytes > 0)
314
357
  res += this.defaultCharUnicode;
315
- }
316
358
  return res;
317
359
  };
318
- function InternalEncoderUtf8(options, codec) {
319
- this.highSurrogate = "";
320
- }
321
- __name(InternalEncoderUtf8, "InternalEncoderUtf8");
322
- InternalEncoderUtf8.prototype.write = function(str) {
323
- if (this.highSurrogate) {
324
- str = this.highSurrogate + str;
325
- this.highSurrogate = "";
326
- }
327
- if (str.length > 0) {
328
- var charCode = str.charCodeAt(str.length - 1);
329
- if (charCode >= 55296 && charCode < 56320) {
330
- this.highSurrogate = str[str.length - 1];
331
- str = str.slice(0, str.length - 1);
332
- }
333
- }
334
- return Buffer3.from(str, this.enc);
335
- };
336
- InternalEncoderUtf8.prototype.end = function() {
337
- if (this.highSurrogate) {
338
- var str = this.highSurrogate;
339
- this.highSurrogate = "";
340
- return Buffer3.from(str, this.enc);
341
- }
342
- };
343
360
  }
344
361
  });
345
362
 
346
- // packages/core/node_modules/iconv-lite/encodings/utf32.js
363
+ // node_modules/iconv-lite/encodings/utf32.js
347
364
  var require_utf32 = __commonJS({
348
- "packages/core/node_modules/iconv-lite/encodings/utf32.js"(exports2) {
365
+ "node_modules/iconv-lite/encodings/utf32.js"(exports2) {
349
366
  "use strict";
350
367
  init_esbuild_shims();
351
368
  var Buffer3 = require_safer().Buffer;
@@ -374,8 +391,8 @@ var require_utf32 = __commonJS({
374
391
  var offset = 0;
375
392
  for (var i = 0; i < src.length; i += 2) {
376
393
  var code = src.readUInt16LE(i);
377
- var isHighSurrogate = code >= 55296 && code < 56320;
378
- var isLowSurrogate = code >= 56320 && code < 57344;
394
+ var isHighSurrogate = 55296 <= code && code < 56320;
395
+ var isLowSurrogate = 56320 <= code && code < 57344;
379
396
  if (this.highSurrogate) {
380
397
  if (isHighSurrogate || !isLowSurrogate) {
381
398
  write32.call(dst, this.highSurrogate, offset);
@@ -388,29 +405,26 @@ var require_utf32 = __commonJS({
388
405
  continue;
389
406
  }
390
407
  }
391
- if (isHighSurrogate) {
408
+ if (isHighSurrogate)
392
409
  this.highSurrogate = code;
393
- } else {
410
+ else {
394
411
  write32.call(dst, code, offset);
395
412
  offset += 4;
396
413
  this.highSurrogate = 0;
397
414
  }
398
415
  }
399
- if (offset < dst.length) {
416
+ if (offset < dst.length)
400
417
  dst = dst.slice(0, offset);
401
- }
402
418
  return dst;
403
419
  };
404
420
  Utf32Encoder.prototype.end = function() {
405
- if (!this.highSurrogate) {
421
+ if (!this.highSurrogate)
406
422
  return;
407
- }
408
423
  var buf = Buffer3.alloc(4);
409
- if (this.isLE) {
424
+ if (this.isLE)
410
425
  buf.writeUInt32LE(this.highSurrogate, 0);
411
- } else {
426
+ else
412
427
  buf.writeUInt32BE(this.highSurrogate, 0);
413
- }
414
428
  this.highSurrogate = 0;
415
429
  return buf;
416
430
  };
@@ -421,9 +435,8 @@ var require_utf32 = __commonJS({
421
435
  }
422
436
  __name(Utf32Decoder, "Utf32Decoder");
423
437
  Utf32Decoder.prototype.write = function(src) {
424
- if (src.length === 0) {
438
+ if (src.length === 0)
425
439
  return "";
426
- }
427
440
  var i = 0;
428
441
  var codepoint = 0;
429
442
  var dst = Buffer3.alloc(src.length + 4);
@@ -432,9 +445,8 @@ var require_utf32 = __commonJS({
432
445
  var overflow = this.overflow;
433
446
  var badChar = this.badChar;
434
447
  if (overflow.length > 0) {
435
- for (; i < src.length && overflow.length < 4; i++) {
448
+ for (; i < src.length && overflow.length < 4; i++)
436
449
  overflow.push(src[i]);
437
- }
438
450
  if (overflow.length === 4) {
439
451
  if (isLE) {
440
452
  codepoint = overflow[i] | overflow[i + 1] << 8 | overflow[i + 2] << 16 | overflow[i + 3] << 24;
@@ -487,9 +499,8 @@ var require_utf32 = __commonJS({
487
499
  Utf32AutoCodec.prototype.decoder = Utf32AutoDecoder;
488
500
  function Utf32AutoEncoder(options, codec) {
489
501
  options = options || {};
490
- if (options.addBOM === void 0) {
502
+ if (options.addBOM === void 0)
491
503
  options.addBOM = true;
492
- }
493
504
  this.encoder = codec.iconv.getEncoder(options.defaultEncoding || "utf-32le", options);
494
505
  }
495
506
  __name(Utf32AutoEncoder, "Utf32AutoEncoder");
@@ -511,15 +522,13 @@ var require_utf32 = __commonJS({
511
522
  if (!this.decoder) {
512
523
  this.initialBufs.push(buf);
513
524
  this.initialBufsLen += buf.length;
514
- if (this.initialBufsLen < 32) {
525
+ if (this.initialBufsLen < 32)
515
526
  return "";
516
- }
517
527
  var encoding = detectEncoding(this.initialBufs, this.options.defaultEncoding);
518
528
  this.decoder = this.iconv.getDecoder(encoding, this.options);
519
529
  var resStr = "";
520
- for (var i = 0; i < this.initialBufs.length; i++) {
530
+ for (var i = 0; i < this.initialBufs.length; i++)
521
531
  resStr += this.decoder.write(this.initialBufs[i]);
522
- }
523
532
  this.initialBufs.length = this.initialBufsLen = 0;
524
533
  return resStr;
525
534
  }
@@ -530,13 +539,11 @@ var require_utf32 = __commonJS({
530
539
  var encoding = detectEncoding(this.initialBufs, this.options.defaultEncoding);
531
540
  this.decoder = this.iconv.getDecoder(encoding, this.options);
532
541
  var resStr = "";
533
- for (var i = 0; i < this.initialBufs.length; i++) {
542
+ for (var i = 0; i < this.initialBufs.length; i++)
534
543
  resStr += this.decoder.write(this.initialBufs[i]);
535
- }
536
544
  var trail = this.decoder.end();
537
- if (trail) {
545
+ if (trail)
538
546
  resStr += trail;
539
- }
540
547
  this.initialBufs.length = this.initialBufsLen = 0;
541
548
  return resStr;
542
549
  }
@@ -545,11 +552,9 @@ var require_utf32 = __commonJS({
545
552
  function detectEncoding(bufs, defaultEncoding) {
546
553
  var b = [];
547
554
  var charsProcessed = 0;
548
- var invalidLE = 0;
549
- var invalidBE = 0;
550
- var bmpCharsLE = 0;
551
- var bmpCharsBE = 0;
552
- outerLoop:
555
+ var invalidLE = 0, invalidBE = 0;
556
+ var bmpCharsLE = 0, bmpCharsBE = 0;
557
+ outer_loop:
553
558
  for (var i = 0; i < bufs.length; i++) {
554
559
  var buf = bufs[i];
555
560
  for (var j = 0; j < buf.length; j++) {
@@ -570,7 +575,7 @@ var require_utf32 = __commonJS({
570
575
  b.length = 0;
571
576
  charsProcessed++;
572
577
  if (charsProcessed >= 100) {
573
- break outerLoop;
578
+ break outer_loop;
574
579
  }
575
580
  }
576
581
  }
@@ -583,9 +588,9 @@ var require_utf32 = __commonJS({
583
588
  }
584
589
  });
585
590
 
586
- // packages/core/node_modules/iconv-lite/encodings/utf16.js
591
+ // node_modules/iconv-lite/encodings/utf16.js
587
592
  var require_utf16 = __commonJS({
588
- "packages/core/node_modules/iconv-lite/encodings/utf16.js"(exports2) {
593
+ "node_modules/iconv-lite/encodings/utf16.js"(exports2) {
589
594
  "use strict";
590
595
  init_esbuild_shims();
591
596
  var Buffer3 = require_safer().Buffer;
@@ -615,12 +620,9 @@ var require_utf16 = __commonJS({
615
620
  }
616
621
  __name(Utf16BEDecoder, "Utf16BEDecoder");
617
622
  Utf16BEDecoder.prototype.write = function(buf) {
618
- if (buf.length == 0) {
623
+ if (buf.length == 0)
619
624
  return "";
620
- }
621
- var buf2 = Buffer3.alloc(buf.length + 1);
622
- var i = 0;
623
- var j = 0;
625
+ var buf2 = Buffer3.alloc(buf.length + 1), i = 0, j = 0;
624
626
  if (this.overflowByte !== -1) {
625
627
  buf2[0] = buf[0];
626
628
  buf2[1] = this.overflowByte;
@@ -646,9 +648,8 @@ var require_utf16 = __commonJS({
646
648
  Utf16Codec.prototype.decoder = Utf16Decoder;
647
649
  function Utf16Encoder(options, codec) {
648
650
  options = options || {};
649
- if (options.addBOM === void 0) {
651
+ if (options.addBOM === void 0)
650
652
  options.addBOM = true;
651
- }
652
653
  this.encoder = codec.iconv.getEncoder("utf-16le", options);
653
654
  }
654
655
  __name(Utf16Encoder, "Utf16Encoder");
@@ -670,15 +671,13 @@ var require_utf16 = __commonJS({
670
671
  if (!this.decoder) {
671
672
  this.initialBufs.push(buf);
672
673
  this.initialBufsLen += buf.length;
673
- if (this.initialBufsLen < 16) {
674
+ if (this.initialBufsLen < 16)
674
675
  return "";
675
- }
676
676
  var encoding = detectEncoding(this.initialBufs, this.options.defaultEncoding);
677
677
  this.decoder = this.iconv.getDecoder(encoding, this.options);
678
678
  var resStr = "";
679
- for (var i = 0; i < this.initialBufs.length; i++) {
679
+ for (var i = 0; i < this.initialBufs.length; i++)
680
680
  resStr += this.decoder.write(this.initialBufs[i]);
681
- }
682
681
  this.initialBufs.length = this.initialBufsLen = 0;
683
682
  return resStr;
684
683
  }
@@ -689,13 +688,11 @@ var require_utf16 = __commonJS({
689
688
  var encoding = detectEncoding(this.initialBufs, this.options.defaultEncoding);
690
689
  this.decoder = this.iconv.getDecoder(encoding, this.options);
691
690
  var resStr = "";
692
- for (var i = 0; i < this.initialBufs.length; i++) {
691
+ for (var i = 0; i < this.initialBufs.length; i++)
693
692
  resStr += this.decoder.write(this.initialBufs[i]);
694
- }
695
693
  var trail = this.decoder.end();
696
- if (trail) {
694
+ if (trail)
697
695
  resStr += trail;
698
- }
699
696
  this.initialBufs.length = this.initialBufsLen = 0;
700
697
  return resStr;
701
698
  }
@@ -704,9 +701,8 @@ var require_utf16 = __commonJS({
704
701
  function detectEncoding(bufs, defaultEncoding) {
705
702
  var b = [];
706
703
  var charsProcessed = 0;
707
- var asciiCharsLE = 0;
708
- var asciiCharsBE = 0;
709
- outerLoop:
704
+ var asciiCharsLE = 0, asciiCharsBE = 0;
705
+ outer_loop:
710
706
  for (var i = 0; i < bufs.length; i++) {
711
707
  var buf = bufs[i];
712
708
  for (var j = 0; j < buf.length; j++) {
@@ -721,7 +717,7 @@ var require_utf16 = __commonJS({
721
717
  b.length = 0;
722
718
  charsProcessed++;
723
719
  if (charsProcessed >= 100) {
724
- break outerLoop;
720
+ break outer_loop;
725
721
  }
726
722
  }
727
723
  }
@@ -734,9 +730,9 @@ var require_utf16 = __commonJS({
734
730
  }
735
731
  });
736
732
 
737
- // packages/core/node_modules/iconv-lite/encodings/utf7.js
733
+ // node_modules/iconv-lite/encodings/utf7.js
738
734
  var require_utf7 = __commonJS({
739
- "packages/core/node_modules/iconv-lite/encodings/utf7.js"(exports2) {
735
+ "node_modules/iconv-lite/encodings/utf7.js"(exports2) {
740
736
  "use strict";
741
737
  init_esbuild_shims();
742
738
  var Buffer3 = require_safer().Buffer;
@@ -769,18 +765,14 @@ var require_utf7 = __commonJS({
769
765
  __name(Utf7Decoder, "Utf7Decoder");
770
766
  var base64Regex = /[A-Za-z0-9\/+]/;
771
767
  var base64Chars = [];
772
- for (i = 0; i < 256; i++) {
768
+ for (i = 0; i < 256; i++)
773
769
  base64Chars[i] = base64Regex.test(String.fromCharCode(i));
774
- }
775
770
  var i;
776
771
  var plusChar = "+".charCodeAt(0);
777
772
  var minusChar = "-".charCodeAt(0);
778
773
  var andChar = "&".charCodeAt(0);
779
774
  Utf7Decoder.prototype.write = function(buf) {
780
- var res = "";
781
- var lastI = 0;
782
- var inBase64 = this.inBase64;
783
- var base64Accum = this.base64Accum;
775
+ var res = "", lastI = 0, inBase64 = this.inBase64, base64Accum = this.base64Accum;
784
776
  for (var i2 = 0; i2 < buf.length; i2++) {
785
777
  if (!inBase64) {
786
778
  if (buf[i2] == plusChar) {
@@ -796,9 +788,8 @@ var require_utf7 = __commonJS({
796
788
  var b64str = base64Accum + this.iconv.decode(buf.slice(lastI, i2), "ascii");
797
789
  res += this.iconv.decode(Buffer3.from(b64str, "base64"), "utf16-be");
798
790
  }
799
- if (buf[i2] != minusChar) {
791
+ if (buf[i2] != minusChar)
800
792
  i2--;
801
- }
802
793
  lastI = i2 + 1;
803
794
  inBase64 = false;
804
795
  base64Accum = "";
@@ -820,9 +811,8 @@ var require_utf7 = __commonJS({
820
811
  };
821
812
  Utf7Decoder.prototype.end = function() {
822
813
  var res = "";
823
- if (this.inBase64 && this.base64Accum.length > 0) {
814
+ if (this.inBase64 && this.base64Accum.length > 0)
824
815
  res = this.iconv.decode(Buffer3.from(this.base64Accum, "base64"), "utf16-be");
825
- }
826
816
  this.inBase64 = false;
827
817
  this.base64Accum = "";
828
818
  return res;
@@ -843,14 +833,10 @@ var require_utf7 = __commonJS({
843
833
  }
844
834
  __name(Utf7IMAPEncoder, "Utf7IMAPEncoder");
845
835
  Utf7IMAPEncoder.prototype.write = function(str) {
846
- var inBase64 = this.inBase64;
847
- var base64Accum = this.base64Accum;
848
- var base64AccumIdx = this.base64AccumIdx;
849
- var buf = Buffer3.alloc(str.length * 5 + 10);
850
- var bufIdx = 0;
836
+ var inBase64 = this.inBase64, base64Accum = this.base64Accum, base64AccumIdx = this.base64AccumIdx, buf = Buffer3.alloc(str.length * 5 + 10), bufIdx = 0;
851
837
  for (var i2 = 0; i2 < str.length; i2++) {
852
838
  var uChar = str.charCodeAt(i2);
853
- if (uChar >= 32 && uChar <= 126) {
839
+ if (32 <= uChar && uChar <= 126) {
854
840
  if (inBase64) {
855
841
  if (base64AccumIdx > 0) {
856
842
  bufIdx += buf.write(base64Accum.slice(0, base64AccumIdx).toString("base64").replace(/\//g, ",").replace(/=+$/, ""), bufIdx);
@@ -861,9 +847,8 @@ var require_utf7 = __commonJS({
861
847
  }
862
848
  if (!inBase64) {
863
849
  buf[bufIdx++] = uChar;
864
- if (uChar === andChar) {
850
+ if (uChar === andChar)
865
851
  buf[bufIdx++] = minusChar;
866
- }
867
852
  }
868
853
  } else {
869
854
  if (!inBase64) {
@@ -885,8 +870,7 @@ var require_utf7 = __commonJS({
885
870
  return buf.slice(0, bufIdx);
886
871
  };
887
872
  Utf7IMAPEncoder.prototype.end = function() {
888
- var buf = Buffer3.alloc(10);
889
- var bufIdx = 0;
873
+ var buf = Buffer3.alloc(10), bufIdx = 0;
890
874
  if (this.inBase64) {
891
875
  if (this.base64AccumIdx > 0) {
892
876
  bufIdx += buf.write(this.base64Accum.slice(0, this.base64AccumIdx).toString("base64").replace(/\//g, ",").replace(/=+$/, ""), bufIdx);
@@ -906,10 +890,7 @@ var require_utf7 = __commonJS({
906
890
  var base64IMAPChars = base64Chars.slice();
907
891
  base64IMAPChars[",".charCodeAt(0)] = true;
908
892
  Utf7IMAPDecoder.prototype.write = function(buf) {
909
- var res = "";
910
- var lastI = 0;
911
- var inBase64 = this.inBase64;
912
- var base64Accum = this.base64Accum;
893
+ var res = "", lastI = 0, inBase64 = this.inBase64, base64Accum = this.base64Accum;
913
894
  for (var i2 = 0; i2 < buf.length; i2++) {
914
895
  if (!inBase64) {
915
896
  if (buf[i2] == andChar) {
@@ -925,9 +906,8 @@ var require_utf7 = __commonJS({
925
906
  var b64str = base64Accum + this.iconv.decode(buf.slice(lastI, i2), "ascii").replace(/,/g, "/");
926
907
  res += this.iconv.decode(Buffer3.from(b64str, "base64"), "utf16-be");
927
908
  }
928
- if (buf[i2] != minusChar) {
909
+ if (buf[i2] != minusChar)
929
910
  i2--;
930
- }
931
911
  lastI = i2 + 1;
932
912
  inBase64 = false;
933
913
  base64Accum = "";
@@ -949,9 +929,8 @@ var require_utf7 = __commonJS({
949
929
  };
950
930
  Utf7IMAPDecoder.prototype.end = function() {
951
931
  var res = "";
952
- if (this.inBase64 && this.base64Accum.length > 0) {
932
+ if (this.inBase64 && this.base64Accum.length > 0)
953
933
  res = this.iconv.decode(Buffer3.from(this.base64Accum, "base64"), "utf16-be");
954
- }
955
934
  this.inBase64 = false;
956
935
  this.base64Accum = "";
957
936
  return res;
@@ -959,32 +938,28 @@ var require_utf7 = __commonJS({
959
938
  }
960
939
  });
961
940
 
962
- // packages/core/node_modules/iconv-lite/encodings/sbcs-codec.js
941
+ // node_modules/iconv-lite/encodings/sbcs-codec.js
963
942
  var require_sbcs_codec = __commonJS({
964
- "packages/core/node_modules/iconv-lite/encodings/sbcs-codec.js"(exports2) {
943
+ "node_modules/iconv-lite/encodings/sbcs-codec.js"(exports2) {
965
944
  "use strict";
966
945
  init_esbuild_shims();
967
946
  var Buffer3 = require_safer().Buffer;
968
947
  exports2._sbcs = SBCSCodec;
969
948
  function SBCSCodec(codecOptions, iconv) {
970
- if (!codecOptions) {
949
+ if (!codecOptions)
971
950
  throw new Error("SBCS codec is called without the data.");
972
- }
973
- if (!codecOptions.chars || codecOptions.chars.length !== 128 && codecOptions.chars.length !== 256) {
951
+ if (!codecOptions.chars || codecOptions.chars.length !== 128 && codecOptions.chars.length !== 256)
974
952
  throw new Error("Encoding '" + codecOptions.type + "' has incorrect 'chars' (must be of len 128 or 256)");
975
- }
976
953
  if (codecOptions.chars.length === 128) {
977
954
  var asciiString = "";
978
- for (var i = 0; i < 128; i++) {
955
+ for (var i = 0; i < 128; i++)
979
956
  asciiString += String.fromCharCode(i);
980
- }
981
957
  codecOptions.chars = asciiString + codecOptions.chars;
982
958
  }
983
959
  this.decodeBuf = Buffer3.from(codecOptions.chars, "ucs2");
984
960
  var encodeBuf = Buffer3.alloc(65536, iconv.defaultCharSingleByte.charCodeAt(0));
985
- for (var i = 0; i < codecOptions.chars.length; i++) {
961
+ for (var i = 0; i < codecOptions.chars.length; i++)
986
962
  encodeBuf[codecOptions.chars.charCodeAt(i)] = i;
987
- }
988
963
  this.encodeBuf = encodeBuf;
989
964
  }
990
965
  __name(SBCSCodec, "SBCSCodec");
@@ -996,9 +971,8 @@ var require_sbcs_codec = __commonJS({
996
971
  __name(SBCSEncoder, "SBCSEncoder");
997
972
  SBCSEncoder.prototype.write = function(str) {
998
973
  var buf = Buffer3.alloc(str.length);
999
- for (var i = 0; i < str.length; i++) {
974
+ for (var i = 0; i < str.length; i++)
1000
975
  buf[i] = this.encodeBuf[str.charCodeAt(i)];
1001
- }
1002
976
  return buf;
1003
977
  };
1004
978
  SBCSEncoder.prototype.end = function() {
@@ -1010,8 +984,7 @@ var require_sbcs_codec = __commonJS({
1010
984
  SBCSDecoder.prototype.write = function(buf) {
1011
985
  var decodeBuf = this.decodeBuf;
1012
986
  var newBuf = Buffer3.alloc(buf.length * 2);
1013
- var idx1 = 0;
1014
- var idx2 = 0;
987
+ var idx1 = 0, idx2 = 0;
1015
988
  for (var i = 0; i < buf.length; i++) {
1016
989
  idx1 = buf[i] * 2;
1017
990
  idx2 = i * 2;
@@ -1025,163 +998,163 @@ var require_sbcs_codec = __commonJS({
1025
998
  }
1026
999
  });
1027
1000
 
1028
- // packages/core/node_modules/iconv-lite/encodings/sbcs-data.js
1001
+ // node_modules/iconv-lite/encodings/sbcs-data.js
1029
1002
  var require_sbcs_data = __commonJS({
1030
- "packages/core/node_modules/iconv-lite/encodings/sbcs-data.js"(exports2, module2) {
1003
+ "node_modules/iconv-lite/encodings/sbcs-data.js"(exports2, module2) {
1031
1004
  "use strict";
1032
1005
  init_esbuild_shims();
1033
1006
  module2.exports = {
1034
1007
  // Not supported by iconv, not sure why.
1035
- 10029: "maccenteuro",
1036
- maccenteuro: {
1037
- type: "_sbcs",
1038
- chars: "\xC4\u0100\u0101\xC9\u0104\xD6\xDC\xE1\u0105\u010C\xE4\u010D\u0106\u0107\xE9\u0179\u017A\u010E\xED\u010F\u0112\u0113\u0116\xF3\u0117\xF4\xF6\xF5\xFA\u011A\u011B\xFC\u2020\xB0\u0118\xA3\xA7\u2022\xB6\xDF\xAE\xA9\u2122\u0119\xA8\u2260\u0123\u012E\u012F\u012A\u2264\u2265\u012B\u0136\u2202\u2211\u0142\u013B\u013C\u013D\u013E\u0139\u013A\u0145\u0146\u0143\xAC\u221A\u0144\u0147\u2206\xAB\xBB\u2026\xA0\u0148\u0150\xD5\u0151\u014C\u2013\u2014\u201C\u201D\u2018\u2019\xF7\u25CA\u014D\u0154\u0155\u0158\u2039\u203A\u0159\u0156\u0157\u0160\u201A\u201E\u0161\u015A\u015B\xC1\u0164\u0165\xCD\u017D\u017E\u016A\xD3\xD4\u016B\u016E\xDA\u016F\u0170\u0171\u0172\u0173\xDD\xFD\u0137\u017B\u0141\u017C\u0122\u02C7"
1008
+ "10029": "maccenteuro",
1009
+ "maccenteuro": {
1010
+ "type": "_sbcs",
1011
+ "chars": "\xC4\u0100\u0101\xC9\u0104\xD6\xDC\xE1\u0105\u010C\xE4\u010D\u0106\u0107\xE9\u0179\u017A\u010E\xED\u010F\u0112\u0113\u0116\xF3\u0117\xF4\xF6\xF5\xFA\u011A\u011B\xFC\u2020\xB0\u0118\xA3\xA7\u2022\xB6\xDF\xAE\xA9\u2122\u0119\xA8\u2260\u0123\u012E\u012F\u012A\u2264\u2265\u012B\u0136\u2202\u2211\u0142\u013B\u013C\u013D\u013E\u0139\u013A\u0145\u0146\u0143\xAC\u221A\u0144\u0147\u2206\xAB\xBB\u2026\xA0\u0148\u0150\xD5\u0151\u014C\u2013\u2014\u201C\u201D\u2018\u2019\xF7\u25CA\u014D\u0154\u0155\u0158\u2039\u203A\u0159\u0156\u0157\u0160\u201A\u201E\u0161\u015A\u015B\xC1\u0164\u0165\xCD\u017D\u017E\u016A\xD3\xD4\u016B\u016E\xDA\u016F\u0170\u0171\u0172\u0173\xDD\xFD\u0137\u017B\u0141\u017C\u0122\u02C7"
1039
1012
  },
1040
- 808: "cp808",
1041
- ibm808: "cp808",
1042
- cp808: {
1043
- type: "_sbcs",
1044
- chars: "\u0410\u0411\u0412\u0413\u0414\u0415\u0416\u0417\u0418\u0419\u041A\u041B\u041C\u041D\u041E\u041F\u0420\u0421\u0422\u0423\u0424\u0425\u0426\u0427\u0428\u0429\u042A\u042B\u042C\u042D\u042E\u042F\u0430\u0431\u0432\u0433\u0434\u0435\u0436\u0437\u0438\u0439\u043A\u043B\u043C\u043D\u043E\u043F\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556\u2555\u2563\u2551\u2557\u255D\u255C\u255B\u2510\u2514\u2534\u252C\u251C\u2500\u253C\u255E\u255F\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u2567\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256B\u256A\u2518\u250C\u2588\u2584\u258C\u2590\u2580\u0440\u0441\u0442\u0443\u0444\u0445\u0446\u0447\u0448\u0449\u044A\u044B\u044C\u044D\u044E\u044F\u0401\u0451\u0404\u0454\u0407\u0457\u040E\u045E\xB0\u2219\xB7\u221A\u2116\u20AC\u25A0\xA0"
1013
+ "808": "cp808",
1014
+ "ibm808": "cp808",
1015
+ "cp808": {
1016
+ "type": "_sbcs",
1017
+ "chars": "\u0410\u0411\u0412\u0413\u0414\u0415\u0416\u0417\u0418\u0419\u041A\u041B\u041C\u041D\u041E\u041F\u0420\u0421\u0422\u0423\u0424\u0425\u0426\u0427\u0428\u0429\u042A\u042B\u042C\u042D\u042E\u042F\u0430\u0431\u0432\u0433\u0434\u0435\u0436\u0437\u0438\u0439\u043A\u043B\u043C\u043D\u043E\u043F\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556\u2555\u2563\u2551\u2557\u255D\u255C\u255B\u2510\u2514\u2534\u252C\u251C\u2500\u253C\u255E\u255F\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u2567\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256B\u256A\u2518\u250C\u2588\u2584\u258C\u2590\u2580\u0440\u0441\u0442\u0443\u0444\u0445\u0446\u0447\u0448\u0449\u044A\u044B\u044C\u044D\u044E\u044F\u0401\u0451\u0404\u0454\u0407\u0457\u040E\u045E\xB0\u2219\xB7\u221A\u2116\u20AC\u25A0\xA0"
1045
1018
  },
1046
- mik: {
1047
- type: "_sbcs",
1048
- chars: "\u0410\u0411\u0412\u0413\u0414\u0415\u0416\u0417\u0418\u0419\u041A\u041B\u041C\u041D\u041E\u041F\u0420\u0421\u0422\u0423\u0424\u0425\u0426\u0427\u0428\u0429\u042A\u042B\u042C\u042D\u042E\u042F\u0430\u0431\u0432\u0433\u0434\u0435\u0436\u0437\u0438\u0439\u043A\u043B\u043C\u043D\u043E\u043F\u0440\u0441\u0442\u0443\u0444\u0445\u0446\u0447\u0448\u0449\u044A\u044B\u044C\u044D\u044E\u044F\u2514\u2534\u252C\u251C\u2500\u253C\u2563\u2551\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u2510\u2591\u2592\u2593\u2502\u2524\u2116\xA7\u2557\u255D\u2518\u250C\u2588\u2584\u258C\u2590\u2580\u03B1\xDF\u0393\u03C0\u03A3\u03C3\xB5\u03C4\u03A6\u0398\u03A9\u03B4\u221E\u03C6\u03B5\u2229\u2261\xB1\u2265\u2264\u2320\u2321\xF7\u2248\xB0\u2219\xB7\u221A\u207F\xB2\u25A0\xA0"
1019
+ "mik": {
1020
+ "type": "_sbcs",
1021
+ "chars": "\u0410\u0411\u0412\u0413\u0414\u0415\u0416\u0417\u0418\u0419\u041A\u041B\u041C\u041D\u041E\u041F\u0420\u0421\u0422\u0423\u0424\u0425\u0426\u0427\u0428\u0429\u042A\u042B\u042C\u042D\u042E\u042F\u0430\u0431\u0432\u0433\u0434\u0435\u0436\u0437\u0438\u0439\u043A\u043B\u043C\u043D\u043E\u043F\u0440\u0441\u0442\u0443\u0444\u0445\u0446\u0447\u0448\u0449\u044A\u044B\u044C\u044D\u044E\u044F\u2514\u2534\u252C\u251C\u2500\u253C\u2563\u2551\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u2510\u2591\u2592\u2593\u2502\u2524\u2116\xA7\u2557\u255D\u2518\u250C\u2588\u2584\u258C\u2590\u2580\u03B1\xDF\u0393\u03C0\u03A3\u03C3\xB5\u03C4\u03A6\u0398\u03A9\u03B4\u221E\u03C6\u03B5\u2229\u2261\xB1\u2265\u2264\u2320\u2321\xF7\u2248\xB0\u2219\xB7\u221A\u207F\xB2\u25A0\xA0"
1049
1022
  },
1050
- cp720: {
1051
- type: "_sbcs",
1052
- chars: "\x80\x81\xE9\xE2\x84\xE0\x86\xE7\xEA\xEB\xE8\xEF\xEE\x8D\x8E\x8F\x90\u0651\u0652\xF4\xA4\u0640\xFB\xF9\u0621\u0622\u0623\u0624\xA3\u0625\u0626\u0627\u0628\u0629\u062A\u062B\u062C\u062D\u062E\u062F\u0630\u0631\u0632\u0633\u0634\u0635\xAB\xBB\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556\u2555\u2563\u2551\u2557\u255D\u255C\u255B\u2510\u2514\u2534\u252C\u251C\u2500\u253C\u255E\u255F\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u2567\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256B\u256A\u2518\u250C\u2588\u2584\u258C\u2590\u2580\u0636\u0637\u0638\u0639\u063A\u0641\xB5\u0642\u0643\u0644\u0645\u0646\u0647\u0648\u0649\u064A\u2261\u064B\u064C\u064D\u064E\u064F\u0650\u2248\xB0\u2219\xB7\u221A\u207F\xB2\u25A0\xA0"
1023
+ "cp720": {
1024
+ "type": "_sbcs",
1025
+ "chars": "\x80\x81\xE9\xE2\x84\xE0\x86\xE7\xEA\xEB\xE8\xEF\xEE\x8D\x8E\x8F\x90\u0651\u0652\xF4\xA4\u0640\xFB\xF9\u0621\u0622\u0623\u0624\xA3\u0625\u0626\u0627\u0628\u0629\u062A\u062B\u062C\u062D\u062E\u062F\u0630\u0631\u0632\u0633\u0634\u0635\xAB\xBB\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556\u2555\u2563\u2551\u2557\u255D\u255C\u255B\u2510\u2514\u2534\u252C\u251C\u2500\u253C\u255E\u255F\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u2567\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256B\u256A\u2518\u250C\u2588\u2584\u258C\u2590\u2580\u0636\u0637\u0638\u0639\u063A\u0641\xB5\u0642\u0643\u0644\u0645\u0646\u0647\u0648\u0649\u064A\u2261\u064B\u064C\u064D\u064E\u064F\u0650\u2248\xB0\u2219\xB7\u221A\u207F\xB2\u25A0\xA0"
1053
1026
  },
1054
1027
  // Aliases of generated encodings.
1055
- ascii8bit: "ascii",
1056
- usascii: "ascii",
1057
- ansix34: "ascii",
1058
- ansix341968: "ascii",
1059
- ansix341986: "ascii",
1060
- csascii: "ascii",
1061
- cp367: "ascii",
1062
- ibm367: "ascii",
1063
- isoir6: "ascii",
1064
- iso646us: "ascii",
1065
- iso646irv: "ascii",
1066
- us: "ascii",
1067
- latin1: "iso88591",
1068
- latin2: "iso88592",
1069
- latin3: "iso88593",
1070
- latin4: "iso88594",
1071
- latin5: "iso88599",
1072
- latin6: "iso885910",
1073
- latin7: "iso885913",
1074
- latin8: "iso885914",
1075
- latin9: "iso885915",
1076
- latin10: "iso885916",
1077
- csisolatin1: "iso88591",
1078
- csisolatin2: "iso88592",
1079
- csisolatin3: "iso88593",
1080
- csisolatin4: "iso88594",
1081
- csisolatincyrillic: "iso88595",
1082
- csisolatinarabic: "iso88596",
1083
- csisolatingreek: "iso88597",
1084
- csisolatinhebrew: "iso88598",
1085
- csisolatin5: "iso88599",
1086
- csisolatin6: "iso885910",
1087
- l1: "iso88591",
1088
- l2: "iso88592",
1089
- l3: "iso88593",
1090
- l4: "iso88594",
1091
- l5: "iso88599",
1092
- l6: "iso885910",
1093
- l7: "iso885913",
1094
- l8: "iso885914",
1095
- l9: "iso885915",
1096
- l10: "iso885916",
1097
- isoir14: "iso646jp",
1098
- isoir57: "iso646cn",
1099
- isoir100: "iso88591",
1100
- isoir101: "iso88592",
1101
- isoir109: "iso88593",
1102
- isoir110: "iso88594",
1103
- isoir144: "iso88595",
1104
- isoir127: "iso88596",
1105
- isoir126: "iso88597",
1106
- isoir138: "iso88598",
1107
- isoir148: "iso88599",
1108
- isoir157: "iso885910",
1109
- isoir166: "tis620",
1110
- isoir179: "iso885913",
1111
- isoir199: "iso885914",
1112
- isoir203: "iso885915",
1113
- isoir226: "iso885916",
1114
- cp819: "iso88591",
1115
- ibm819: "iso88591",
1116
- cyrillic: "iso88595",
1117
- arabic: "iso88596",
1118
- arabic8: "iso88596",
1119
- ecma114: "iso88596",
1120
- asmo708: "iso88596",
1121
- greek: "iso88597",
1122
- greek8: "iso88597",
1123
- ecma118: "iso88597",
1124
- elot928: "iso88597",
1125
- hebrew: "iso88598",
1126
- hebrew8: "iso88598",
1127
- turkish: "iso88599",
1128
- turkish8: "iso88599",
1129
- thai: "iso885911",
1130
- thai8: "iso885911",
1131
- celtic: "iso885914",
1132
- celtic8: "iso885914",
1133
- isoceltic: "iso885914",
1134
- tis6200: "tis620",
1135
- tis62025291: "tis620",
1136
- tis62025330: "tis620",
1137
- 1e4: "macroman",
1138
- 10006: "macgreek",
1139
- 10007: "maccyrillic",
1140
- 10079: "maciceland",
1141
- 10081: "macturkish",
1142
- cspc8codepage437: "cp437",
1143
- cspc775baltic: "cp775",
1144
- cspc850multilingual: "cp850",
1145
- cspcp852: "cp852",
1146
- cspc862latinhebrew: "cp862",
1147
- cpgr: "cp869",
1148
- msee: "cp1250",
1149
- mscyrl: "cp1251",
1150
- msansi: "cp1252",
1151
- msgreek: "cp1253",
1152
- msturk: "cp1254",
1153
- mshebr: "cp1255",
1154
- msarab: "cp1256",
1155
- winbaltrim: "cp1257",
1156
- cp20866: "koi8r",
1157
- 20866: "koi8r",
1158
- ibm878: "koi8r",
1159
- cskoi8r: "koi8r",
1160
- cp21866: "koi8u",
1161
- 21866: "koi8u",
1162
- ibm1168: "koi8u",
1163
- strk10482002: "rk1048",
1164
- tcvn5712: "tcvn",
1165
- tcvn57121: "tcvn",
1166
- gb198880: "iso646cn",
1167
- cn: "iso646cn",
1168
- csiso14jisc6220ro: "iso646jp",
1169
- jisc62201969ro: "iso646jp",
1170
- jp: "iso646jp",
1171
- cshproman8: "hproman8",
1172
- r8: "hproman8",
1173
- roman8: "hproman8",
1174
- xroman8: "hproman8",
1175
- ibm1051: "hproman8",
1176
- mac: "macintosh",
1177
- csmacintosh: "macintosh"
1028
+ "ascii8bit": "ascii",
1029
+ "usascii": "ascii",
1030
+ "ansix34": "ascii",
1031
+ "ansix341968": "ascii",
1032
+ "ansix341986": "ascii",
1033
+ "csascii": "ascii",
1034
+ "cp367": "ascii",
1035
+ "ibm367": "ascii",
1036
+ "isoir6": "ascii",
1037
+ "iso646us": "ascii",
1038
+ "iso646irv": "ascii",
1039
+ "us": "ascii",
1040
+ "latin1": "iso88591",
1041
+ "latin2": "iso88592",
1042
+ "latin3": "iso88593",
1043
+ "latin4": "iso88594",
1044
+ "latin5": "iso88599",
1045
+ "latin6": "iso885910",
1046
+ "latin7": "iso885913",
1047
+ "latin8": "iso885914",
1048
+ "latin9": "iso885915",
1049
+ "latin10": "iso885916",
1050
+ "csisolatin1": "iso88591",
1051
+ "csisolatin2": "iso88592",
1052
+ "csisolatin3": "iso88593",
1053
+ "csisolatin4": "iso88594",
1054
+ "csisolatincyrillic": "iso88595",
1055
+ "csisolatinarabic": "iso88596",
1056
+ "csisolatingreek": "iso88597",
1057
+ "csisolatinhebrew": "iso88598",
1058
+ "csisolatin5": "iso88599",
1059
+ "csisolatin6": "iso885910",
1060
+ "l1": "iso88591",
1061
+ "l2": "iso88592",
1062
+ "l3": "iso88593",
1063
+ "l4": "iso88594",
1064
+ "l5": "iso88599",
1065
+ "l6": "iso885910",
1066
+ "l7": "iso885913",
1067
+ "l8": "iso885914",
1068
+ "l9": "iso885915",
1069
+ "l10": "iso885916",
1070
+ "isoir14": "iso646jp",
1071
+ "isoir57": "iso646cn",
1072
+ "isoir100": "iso88591",
1073
+ "isoir101": "iso88592",
1074
+ "isoir109": "iso88593",
1075
+ "isoir110": "iso88594",
1076
+ "isoir144": "iso88595",
1077
+ "isoir127": "iso88596",
1078
+ "isoir126": "iso88597",
1079
+ "isoir138": "iso88598",
1080
+ "isoir148": "iso88599",
1081
+ "isoir157": "iso885910",
1082
+ "isoir166": "tis620",
1083
+ "isoir179": "iso885913",
1084
+ "isoir199": "iso885914",
1085
+ "isoir203": "iso885915",
1086
+ "isoir226": "iso885916",
1087
+ "cp819": "iso88591",
1088
+ "ibm819": "iso88591",
1089
+ "cyrillic": "iso88595",
1090
+ "arabic": "iso88596",
1091
+ "arabic8": "iso88596",
1092
+ "ecma114": "iso88596",
1093
+ "asmo708": "iso88596",
1094
+ "greek": "iso88597",
1095
+ "greek8": "iso88597",
1096
+ "ecma118": "iso88597",
1097
+ "elot928": "iso88597",
1098
+ "hebrew": "iso88598",
1099
+ "hebrew8": "iso88598",
1100
+ "turkish": "iso88599",
1101
+ "turkish8": "iso88599",
1102
+ "thai": "iso885911",
1103
+ "thai8": "iso885911",
1104
+ "celtic": "iso885914",
1105
+ "celtic8": "iso885914",
1106
+ "isoceltic": "iso885914",
1107
+ "tis6200": "tis620",
1108
+ "tis62025291": "tis620",
1109
+ "tis62025330": "tis620",
1110
+ "10000": "macroman",
1111
+ "10006": "macgreek",
1112
+ "10007": "maccyrillic",
1113
+ "10079": "maciceland",
1114
+ "10081": "macturkish",
1115
+ "cspc8codepage437": "cp437",
1116
+ "cspc775baltic": "cp775",
1117
+ "cspc850multilingual": "cp850",
1118
+ "cspcp852": "cp852",
1119
+ "cspc862latinhebrew": "cp862",
1120
+ "cpgr": "cp869",
1121
+ "msee": "cp1250",
1122
+ "mscyrl": "cp1251",
1123
+ "msansi": "cp1252",
1124
+ "msgreek": "cp1253",
1125
+ "msturk": "cp1254",
1126
+ "mshebr": "cp1255",
1127
+ "msarab": "cp1256",
1128
+ "winbaltrim": "cp1257",
1129
+ "cp20866": "koi8r",
1130
+ "20866": "koi8r",
1131
+ "ibm878": "koi8r",
1132
+ "cskoi8r": "koi8r",
1133
+ "cp21866": "koi8u",
1134
+ "21866": "koi8u",
1135
+ "ibm1168": "koi8u",
1136
+ "strk10482002": "rk1048",
1137
+ "tcvn5712": "tcvn",
1138
+ "tcvn57121": "tcvn",
1139
+ "gb198880": "iso646cn",
1140
+ "cn": "iso646cn",
1141
+ "csiso14jisc6220ro": "iso646jp",
1142
+ "jisc62201969ro": "iso646jp",
1143
+ "jp": "iso646jp",
1144
+ "cshproman8": "hproman8",
1145
+ "r8": "hproman8",
1146
+ "roman8": "hproman8",
1147
+ "xroman8": "hproman8",
1148
+ "ibm1051": "hproman8",
1149
+ "mac": "macintosh",
1150
+ "csmacintosh": "macintosh"
1178
1151
  };
1179
1152
  }
1180
1153
  });
1181
1154
 
1182
- // packages/core/node_modules/iconv-lite/encodings/sbcs-data-generated.js
1155
+ // node_modules/iconv-lite/encodings/sbcs-data-generated.js
1183
1156
  var require_sbcs_data_generated = __commonJS({
1184
- "packages/core/node_modules/iconv-lite/encodings/sbcs-data-generated.js"(exports2, module2) {
1157
+ "node_modules/iconv-lite/encodings/sbcs-data-generated.js"(exports2, module2) {
1185
1158
  "use strict";
1186
1159
  init_esbuild_shims();
1187
1160
  module2.exports = {
@@ -1635,9 +1608,9 @@ var require_sbcs_data_generated = __commonJS({
1635
1608
  }
1636
1609
  });
1637
1610
 
1638
- // packages/core/node_modules/iconv-lite/encodings/dbcs-codec.js
1611
+ // node_modules/iconv-lite/encodings/dbcs-codec.js
1639
1612
  var require_dbcs_codec = __commonJS({
1640
- "packages/core/node_modules/iconv-lite/encodings/dbcs-codec.js"(exports2) {
1613
+ "node_modules/iconv-lite/encodings/dbcs-codec.js"(exports2) {
1641
1614
  "use strict";
1642
1615
  init_esbuild_shims();
1643
1616
  var Buffer3 = require_safer().Buffer;
@@ -1648,25 +1621,21 @@ var require_dbcs_codec = __commonJS({
1648
1621
  var NODE_START = -1e3;
1649
1622
  var UNASSIGNED_NODE = new Array(256);
1650
1623
  var DEF_CHAR = -1;
1651
- for (i = 0; i < 256; i++) {
1624
+ for (i = 0; i < 256; i++)
1652
1625
  UNASSIGNED_NODE[i] = UNASSIGNED;
1653
- }
1654
1626
  var i;
1655
1627
  function DBCSCodec(codecOptions, iconv) {
1656
1628
  this.encodingName = codecOptions.encodingName;
1657
- if (!codecOptions) {
1629
+ if (!codecOptions)
1658
1630
  throw new Error("DBCS codec is called without the data.");
1659
- }
1660
- if (!codecOptions.table) {
1631
+ if (!codecOptions.table)
1661
1632
  throw new Error("Encoding '" + this.encodingName + "' has no data.");
1662
- }
1663
1633
  var mappingTable = codecOptions.table();
1664
1634
  this.decodeTables = [];
1665
1635
  this.decodeTables[0] = UNASSIGNED_NODE.slice(0);
1666
1636
  this.decodeTableSeq = [];
1667
- for (var i2 = 0; i2 < mappingTable.length; i2++) {
1637
+ for (var i2 = 0; i2 < mappingTable.length; i2++)
1668
1638
  this._addDecodeChunk(mappingTable[i2]);
1669
- }
1670
1639
  if (typeof codecOptions.gb18030 === "function") {
1671
1640
  this.gb18030 = codecOptions.gb18030();
1672
1641
  var commonThirdByteNodeIdx = this.decodeTables.length;
@@ -1693,9 +1662,8 @@ var require_dbcs_codec = __commonJS({
1693
1662
  }
1694
1663
  var fourthByteNode = this.decodeTables[NODE_START - thirdByteNode[k]];
1695
1664
  for (var l = 48; l <= 57; l++) {
1696
- if (fourthByteNode[l] === UNASSIGNED) {
1665
+ if (fourthByteNode[l] === UNASSIGNED)
1697
1666
  fourthByteNode[l] = GB18030_CODE;
1698
- }
1699
1667
  }
1700
1668
  }
1701
1669
  }
@@ -1705,25 +1673,20 @@ var require_dbcs_codec = __commonJS({
1705
1673
  this.encodeTable = [];
1706
1674
  this.encodeTableSeq = [];
1707
1675
  var skipEncodeChars = {};
1708
- if (codecOptions.encodeSkipVals) {
1676
+ if (codecOptions.encodeSkipVals)
1709
1677
  for (var i2 = 0; i2 < codecOptions.encodeSkipVals.length; i2++) {
1710
1678
  var val = codecOptions.encodeSkipVals[i2];
1711
- if (typeof val === "number") {
1679
+ if (typeof val === "number")
1712
1680
  skipEncodeChars[val] = true;
1713
- } else {
1714
- for (var j = val.from; j <= val.to; j++) {
1681
+ else
1682
+ for (var j = val.from; j <= val.to; j++)
1715
1683
  skipEncodeChars[j] = true;
1716
- }
1717
- }
1718
1684
  }
1719
- }
1720
1685
  this._fillEncodeTable(0, 0, skipEncodeChars);
1721
1686
  if (codecOptions.encodeAdd) {
1722
- for (var uChar in codecOptions.encodeAdd) {
1723
- if (Object.prototype.hasOwnProperty.call(codecOptions.encodeAdd, uChar)) {
1687
+ for (var uChar in codecOptions.encodeAdd)
1688
+ if (Object.prototype.hasOwnProperty.call(codecOptions.encodeAdd, uChar))
1724
1689
  this._setEncodeChar(uChar.charCodeAt(0), codecOptions.encodeAdd[uChar]);
1725
- }
1726
- }
1727
1690
  }
1728
1691
  this.defCharSB = this.encodeTable[0][iconv.defaultCharSingleByte.charCodeAt(0)];
1729
1692
  if (this.defCharSB === UNASSIGNED) this.defCharSB = this.encodeTable[0]["?"];
@@ -1734,12 +1697,10 @@ var require_dbcs_codec = __commonJS({
1734
1697
  DBCSCodec.prototype.decoder = DBCSDecoder;
1735
1698
  DBCSCodec.prototype._getDecodeTrieNode = function(addr) {
1736
1699
  var bytes = [];
1737
- for (; addr > 0; addr >>>= 8) {
1700
+ for (; addr > 0; addr >>>= 8)
1738
1701
  bytes.push(addr & 255);
1739
- }
1740
- if (bytes.length == 0) {
1702
+ if (bytes.length == 0)
1741
1703
  bytes.push(0);
1742
- }
1743
1704
  var node = this.decodeTables[0];
1744
1705
  for (var i2 = bytes.length - 1; i2 > 0; i2--) {
1745
1706
  var val = node[bytes[i2]];
@@ -1748,9 +1709,8 @@ var require_dbcs_codec = __commonJS({
1748
1709
  this.decodeTables.push(node = UNASSIGNED_NODE.slice(0));
1749
1710
  } else if (val <= NODE_START) {
1750
1711
  node = this.decodeTables[NODE_START - val];
1751
- } else {
1712
+ } else
1752
1713
  throw new Error("Overwrite byte in " + this.encodingName + ", addr: " + addr.toString(16));
1753
- }
1754
1714
  }
1755
1715
  return node;
1756
1716
  };
@@ -1763,53 +1723,45 @@ var require_dbcs_codec = __commonJS({
1763
1723
  if (typeof part === "string") {
1764
1724
  for (var l = 0; l < part.length; ) {
1765
1725
  var code = part.charCodeAt(l++);
1766
- if (code >= 55296 && code < 56320) {
1726
+ if (55296 <= code && code < 56320) {
1767
1727
  var codeTrail = part.charCodeAt(l++);
1768
- if (codeTrail >= 56320 && codeTrail < 57344) {
1728
+ if (56320 <= codeTrail && codeTrail < 57344)
1769
1729
  writeTable[curAddr++] = 65536 + (code - 55296) * 1024 + (codeTrail - 56320);
1770
- } else {
1730
+ else
1771
1731
  throw new Error("Incorrect surrogate pair in " + this.encodingName + " at chunk " + chunk[0]);
1772
- }
1773
- } else if (code > 4080 && code <= 4095) {
1732
+ } else if (4080 < code && code <= 4095) {
1774
1733
  var len = 4095 - code + 2;
1775
1734
  var seq = [];
1776
- for (var m = 0; m < len; m++) {
1735
+ for (var m = 0; m < len; m++)
1777
1736
  seq.push(part.charCodeAt(l++));
1778
- }
1779
1737
  writeTable[curAddr++] = SEQ_START - this.decodeTableSeq.length;
1780
1738
  this.decodeTableSeq.push(seq);
1781
- } else {
1739
+ } else
1782
1740
  writeTable[curAddr++] = code;
1783
- }
1784
1741
  }
1785
1742
  } else if (typeof part === "number") {
1786
1743
  var charCode = writeTable[curAddr - 1] + 1;
1787
- for (var l = 0; l < part; l++) {
1744
+ for (var l = 0; l < part; l++)
1788
1745
  writeTable[curAddr++] = charCode++;
1789
- }
1790
- } else {
1746
+ } else
1791
1747
  throw new Error("Incorrect type '" + typeof part + "' given in " + this.encodingName + " at chunk " + chunk[0]);
1792
- }
1793
1748
  }
1794
- if (curAddr > 255) {
1749
+ if (curAddr > 255)
1795
1750
  throw new Error("Incorrect chunk in " + this.encodingName + " at addr " + chunk[0] + ": too long" + curAddr);
1796
- }
1797
1751
  };
1798
1752
  DBCSCodec.prototype._getEncodeBucket = function(uCode) {
1799
1753
  var high = uCode >> 8;
1800
- if (this.encodeTable[high] === void 0) {
1754
+ if (this.encodeTable[high] === void 0)
1801
1755
  this.encodeTable[high] = UNASSIGNED_NODE.slice(0);
1802
- }
1803
1756
  return this.encodeTable[high];
1804
1757
  };
1805
1758
  DBCSCodec.prototype._setEncodeChar = function(uCode, dbcsCode) {
1806
1759
  var bucket = this._getEncodeBucket(uCode);
1807
1760
  var low = uCode & 255;
1808
- if (bucket[low] <= SEQ_START) {
1761
+ if (bucket[low] <= SEQ_START)
1809
1762
  this.encodeTableSeq[SEQ_START - bucket[low]][DEF_CHAR] = dbcsCode;
1810
- } else if (bucket[low] == UNASSIGNED) {
1763
+ else if (bucket[low] == UNASSIGNED)
1811
1764
  bucket[low] = dbcsCode;
1812
- }
1813
1765
  };
1814
1766
  DBCSCodec.prototype._setEncodeSequence = function(seq, dbcsCode) {
1815
1767
  var uCode = seq[0];
@@ -1826,13 +1778,12 @@ var require_dbcs_codec = __commonJS({
1826
1778
  }
1827
1779
  for (var j = 1; j < seq.length - 1; j++) {
1828
1780
  var oldVal = node[uCode];
1829
- if (typeof oldVal === "object") {
1781
+ if (typeof oldVal === "object")
1830
1782
  node = oldVal;
1831
- } else {
1783
+ else {
1832
1784
  node = node[uCode] = {};
1833
- if (oldVal !== void 0) {
1785
+ if (oldVal !== void 0)
1834
1786
  node[DEF_CHAR] = oldVal;
1835
- }
1836
1787
  }
1837
1788
  }
1838
1789
  uCode = seq[seq.length - 1];
@@ -1845,9 +1796,8 @@ var require_dbcs_codec = __commonJS({
1845
1796
  for (var i2 = 0; i2 < 256; i2++) {
1846
1797
  var uCode = node[i2];
1847
1798
  var mbCode = prefix + i2;
1848
- if (skipEncodeChars[mbCode]) {
1799
+ if (skipEncodeChars[mbCode])
1849
1800
  continue;
1850
- }
1851
1801
  if (uCode >= 0) {
1852
1802
  this._setEncodeChar(uCode, mbCode);
1853
1803
  hasValues = true;
@@ -1855,11 +1805,10 @@ var require_dbcs_codec = __commonJS({
1855
1805
  var subNodeIdx = NODE_START - uCode;
1856
1806
  if (!subNodeEmpty[subNodeIdx]) {
1857
1807
  var newPrefix = mbCode << 8 >>> 0;
1858
- if (this._fillEncodeTable(subNodeIdx, newPrefix, skipEncodeChars)) {
1808
+ if (this._fillEncodeTable(subNodeIdx, newPrefix, skipEncodeChars))
1859
1809
  hasValues = true;
1860
- } else {
1810
+ else
1861
1811
  subNodeEmpty[subNodeIdx] = true;
1862
- }
1863
1812
  }
1864
1813
  } else if (uCode <= SEQ_START) {
1865
1814
  this._setEncodeSequence(this.decodeTableSeq[SEQ_START - uCode], mbCode);
@@ -1878,12 +1827,7 @@ var require_dbcs_codec = __commonJS({
1878
1827
  }
1879
1828
  __name(DBCSEncoder, "DBCSEncoder");
1880
1829
  DBCSEncoder.prototype.write = function(str) {
1881
- var newBuf = Buffer3.alloc(str.length * (this.gb18030 ? 4 : 3));
1882
- var leadSurrogate = this.leadSurrogate;
1883
- var seqObj = this.seqObj;
1884
- var nextChar = -1;
1885
- var i2 = 0;
1886
- var j = 0;
1830
+ var newBuf = Buffer3.alloc(str.length * (this.gb18030 ? 4 : 3)), leadSurrogate = this.leadSurrogate, seqObj = this.seqObj, nextChar = -1, i2 = 0, j = 0;
1887
1831
  while (true) {
1888
1832
  if (nextChar === -1) {
1889
1833
  if (i2 == str.length) break;
@@ -1892,7 +1836,7 @@ var require_dbcs_codec = __commonJS({
1892
1836
  var uCode = nextChar;
1893
1837
  nextChar = -1;
1894
1838
  }
1895
- if (uCode >= 55296 && uCode < 57344) {
1839
+ if (55296 <= uCode && uCode < 57344) {
1896
1840
  if (uCode < 56320) {
1897
1841
  if (leadSurrogate === -1) {
1898
1842
  leadSurrogate = uCode;
@@ -1920,7 +1864,7 @@ var require_dbcs_codec = __commonJS({
1920
1864
  if (typeof resCode === "object") {
1921
1865
  seqObj = resCode;
1922
1866
  continue;
1923
- } else if (typeof resCode === "number") {
1867
+ } else if (typeof resCode == "number") {
1924
1868
  dbcsCode = resCode;
1925
1869
  } else if (resCode == void 0) {
1926
1870
  resCode = seqObj[DEF_CHAR];
@@ -1933,9 +1877,8 @@ var require_dbcs_codec = __commonJS({
1933
1877
  seqObj = void 0;
1934
1878
  } else if (uCode >= 0) {
1935
1879
  var subtable = this.encodeTable[uCode >> 8];
1936
- if (subtable !== void 0) {
1880
+ if (subtable !== void 0)
1937
1881
  dbcsCode = subtable[uCode & 255];
1938
- }
1939
1882
  if (dbcsCode <= SEQ_START) {
1940
1883
  seqObj = this.encodeTableSeq[SEQ_START - dbcsCode];
1941
1884
  continue;
@@ -1955,9 +1898,8 @@ var require_dbcs_codec = __commonJS({
1955
1898
  }
1956
1899
  }
1957
1900
  }
1958
- if (dbcsCode === UNASSIGNED) {
1901
+ if (dbcsCode === UNASSIGNED)
1959
1902
  dbcsCode = this.defaultCharSingleByte;
1960
- }
1961
1903
  if (dbcsCode < 256) {
1962
1904
  newBuf[j++] = dbcsCode;
1963
1905
  } else if (dbcsCode < 65536) {
@@ -1979,11 +1921,9 @@ var require_dbcs_codec = __commonJS({
1979
1921
  return newBuf.slice(0, j);
1980
1922
  };
1981
1923
  DBCSEncoder.prototype.end = function() {
1982
- if (this.leadSurrogate === -1 && this.seqObj === void 0) {
1924
+ if (this.leadSurrogate === -1 && this.seqObj === void 0)
1983
1925
  return;
1984
- }
1985
- var newBuf = Buffer3.alloc(10);
1986
- var j = 0;
1926
+ var newBuf = Buffer3.alloc(10), j = 0;
1987
1927
  if (this.seqObj) {
1988
1928
  var dbcsCode = this.seqObj[DEF_CHAR];
1989
1929
  if (dbcsCode !== void 0) {
@@ -2014,12 +1954,7 @@ var require_dbcs_codec = __commonJS({
2014
1954
  }
2015
1955
  __name(DBCSDecoder, "DBCSDecoder");
2016
1956
  DBCSDecoder.prototype.write = function(buf) {
2017
- var newBuf = Buffer3.alloc(buf.length * 2);
2018
- var nodeIdx = this.nodeIdx;
2019
- var prevBytes = this.prevBytes;
2020
- var prevOffset = this.prevBytes.length;
2021
- var seqStart = -this.prevBytes.length;
2022
- var uCode;
1957
+ var newBuf = Buffer3.alloc(buf.length * 2), nodeIdx = this.nodeIdx, prevBytes = this.prevBytes, prevOffset = this.prevBytes.length, seqStart = -this.prevBytes.length, uCode;
2023
1958
  for (var i2 = 0, j = 0; i2 < buf.length; i2++) {
2024
1959
  var curByte = i2 >= 0 ? buf[i2] : prevBytes[i2 + prevOffset];
2025
1960
  var uCode = this.decodeTables[nodeIdx][curByte];
@@ -2046,9 +1981,8 @@ var require_dbcs_codec = __commonJS({
2046
1981
  newBuf[j++] = uCode >> 8;
2047
1982
  }
2048
1983
  uCode = seq[seq.length - 1];
2049
- } else {
1984
+ } else
2050
1985
  throw new Error("iconv-lite internal error: invalid decoding table value " + uCode + " at " + nodeIdx + "/" + curByte);
2051
- }
2052
1986
  if (uCode >= 65536) {
2053
1987
  uCode -= 65536;
2054
1988
  var uCodeLead = 55296 | uCode >> 10;
@@ -2072,27 +2006,23 @@ var require_dbcs_codec = __commonJS({
2072
2006
  var bytesArr = this.prevBytes.slice(1);
2073
2007
  this.prevBytes = [];
2074
2008
  this.nodeIdx = 0;
2075
- if (bytesArr.length > 0) {
2009
+ if (bytesArr.length > 0)
2076
2010
  ret += this.write(bytesArr);
2077
- }
2078
2011
  }
2079
2012
  this.prevBytes = [];
2080
2013
  this.nodeIdx = 0;
2081
2014
  return ret;
2082
2015
  };
2083
2016
  function findIdx(table, val) {
2084
- if (table[0] > val) {
2017
+ if (table[0] > val)
2085
2018
  return -1;
2086
- }
2087
- var l = 0;
2088
- var r = table.length;
2019
+ var l = 0, r = table.length;
2089
2020
  while (l < r - 1) {
2090
2021
  var mid = l + (r - l + 1 >> 1);
2091
- if (table[mid] <= val) {
2022
+ if (table[mid] <= val)
2092
2023
  l = mid;
2093
- } else {
2024
+ else
2094
2025
  r = mid;
2095
- }
2096
2026
  }
2097
2027
  return l;
2098
2028
  }
@@ -2100,9 +2030,9 @@ var require_dbcs_codec = __commonJS({
2100
2030
  }
2101
2031
  });
2102
2032
 
2103
- // packages/core/node_modules/iconv-lite/encodings/tables/shiftjis.json
2033
+ // node_modules/iconv-lite/encodings/tables/shiftjis.json
2104
2034
  var require_shiftjis = __commonJS({
2105
- "packages/core/node_modules/iconv-lite/encodings/tables/shiftjis.json"(exports2, module2) {
2035
+ "node_modules/iconv-lite/encodings/tables/shiftjis.json"(exports2, module2) {
2106
2036
  module2.exports = [
2107
2037
  ["0", "\0", 128],
2108
2038
  ["a1", "\uFF61", 62],
@@ -2231,9 +2161,9 @@ var require_shiftjis = __commonJS({
2231
2161
  }
2232
2162
  });
2233
2163
 
2234
- // packages/core/node_modules/iconv-lite/encodings/tables/eucjp.json
2164
+ // node_modules/iconv-lite/encodings/tables/eucjp.json
2235
2165
  var require_eucjp = __commonJS({
2236
- "packages/core/node_modules/iconv-lite/encodings/tables/eucjp.json"(exports2, module2) {
2166
+ "node_modules/iconv-lite/encodings/tables/eucjp.json"(exports2, module2) {
2237
2167
  module2.exports = [
2238
2168
  ["0", "\0", 127],
2239
2169
  ["8ea1", "\uFF61", 62],
@@ -2419,9 +2349,9 @@ var require_eucjp = __commonJS({
2419
2349
  }
2420
2350
  });
2421
2351
 
2422
- // packages/core/node_modules/iconv-lite/encodings/tables/cp936.json
2352
+ // node_modules/iconv-lite/encodings/tables/cp936.json
2423
2353
  var require_cp936 = __commonJS({
2424
- "packages/core/node_modules/iconv-lite/encodings/tables/cp936.json"(exports2, module2) {
2354
+ "node_modules/iconv-lite/encodings/tables/cp936.json"(exports2, module2) {
2425
2355
  module2.exports = [
2426
2356
  ["0", "\0", 127, "\u20AC"],
2427
2357
  ["8140", "\u4E02\u4E04\u4E05\u4E06\u4E0F\u4E12\u4E17\u4E1F\u4E20\u4E21\u4E23\u4E26\u4E29\u4E2E\u4E2F\u4E31\u4E33\u4E35\u4E37\u4E3C\u4E40\u4E41\u4E42\u4E44\u4E46\u4E4A\u4E51\u4E55\u4E57\u4E5A\u4E5B\u4E62\u4E63\u4E64\u4E65\u4E67\u4E68\u4E6A", 5, "\u4E72\u4E74", 9, "\u4E7F", 6, "\u4E87\u4E8A"],
@@ -2689,9 +2619,9 @@ var require_cp936 = __commonJS({
2689
2619
  }
2690
2620
  });
2691
2621
 
2692
- // packages/core/node_modules/iconv-lite/encodings/tables/gbk-added.json
2622
+ // node_modules/iconv-lite/encodings/tables/gbk-added.json
2693
2623
  var require_gbk_added = __commonJS({
2694
- "packages/core/node_modules/iconv-lite/encodings/tables/gbk-added.json"(exports2, module2) {
2624
+ "node_modules/iconv-lite/encodings/tables/gbk-added.json"(exports2, module2) {
2695
2625
  module2.exports = [
2696
2626
  ["a140", "\uE4C6", 62],
2697
2627
  ["a180", "\uE505", 32],
@@ -2751,16 +2681,16 @@ var require_gbk_added = __commonJS({
2751
2681
  }
2752
2682
  });
2753
2683
 
2754
- // packages/core/node_modules/iconv-lite/encodings/tables/gb18030-ranges.json
2684
+ // node_modules/iconv-lite/encodings/tables/gb18030-ranges.json
2755
2685
  var require_gb18030_ranges = __commonJS({
2756
- "packages/core/node_modules/iconv-lite/encodings/tables/gb18030-ranges.json"(exports2, module2) {
2686
+ "node_modules/iconv-lite/encodings/tables/gb18030-ranges.json"(exports2, module2) {
2757
2687
  module2.exports = { uChars: [128, 165, 169, 178, 184, 216, 226, 235, 238, 244, 248, 251, 253, 258, 276, 284, 300, 325, 329, 334, 364, 463, 465, 467, 469, 471, 473, 475, 477, 506, 594, 610, 712, 716, 730, 930, 938, 962, 970, 1026, 1104, 1106, 8209, 8215, 8218, 8222, 8231, 8241, 8244, 8246, 8252, 8365, 8452, 8454, 8458, 8471, 8482, 8556, 8570, 8596, 8602, 8713, 8720, 8722, 8726, 8731, 8737, 8740, 8742, 8748, 8751, 8760, 8766, 8777, 8781, 8787, 8802, 8808, 8816, 8854, 8858, 8870, 8896, 8979, 9322, 9372, 9548, 9588, 9616, 9622, 9634, 9652, 9662, 9672, 9676, 9680, 9702, 9735, 9738, 9793, 9795, 11906, 11909, 11913, 11917, 11928, 11944, 11947, 11951, 11956, 11960, 11964, 11979, 12284, 12292, 12312, 12319, 12330, 12351, 12436, 12447, 12535, 12543, 12586, 12842, 12850, 12964, 13200, 13215, 13218, 13253, 13263, 13267, 13270, 13384, 13428, 13727, 13839, 13851, 14617, 14703, 14801, 14816, 14964, 15183, 15471, 15585, 16471, 16736, 17208, 17325, 17330, 17374, 17623, 17997, 18018, 18212, 18218, 18301, 18318, 18760, 18811, 18814, 18820, 18823, 18844, 18848, 18872, 19576, 19620, 19738, 19887, 40870, 59244, 59336, 59367, 59413, 59417, 59423, 59431, 59437, 59443, 59452, 59460, 59478, 59493, 63789, 63866, 63894, 63976, 63986, 64016, 64018, 64021, 64025, 64034, 64037, 64042, 65074, 65093, 65107, 65112, 65127, 65132, 65375, 65510, 65536], gbChars: [0, 36, 38, 45, 50, 81, 89, 95, 96, 100, 103, 104, 105, 109, 126, 133, 148, 172, 175, 179, 208, 306, 307, 308, 309, 310, 311, 312, 313, 341, 428, 443, 544, 545, 558, 741, 742, 749, 750, 805, 819, 820, 7922, 7924, 7925, 7927, 7934, 7943, 7944, 7945, 7950, 8062, 8148, 8149, 8152, 8164, 8174, 8236, 8240, 8262, 8264, 8374, 8380, 8381, 8384, 8388, 8390, 8392, 8393, 8394, 8396, 8401, 8406, 8416, 8419, 8424, 8437, 8439, 8445, 8482, 8485, 8496, 8521, 8603, 8936, 8946, 9046, 9050, 9063, 9066, 9076, 9092, 9100, 9108, 9111, 9113, 9131, 9162, 9164, 9218, 9219, 11329, 11331, 11334, 11336, 11346, 11361, 11363, 11366, 11370, 11372, 11375, 11389, 11682, 11686, 11687, 11692, 11694, 11714, 11716, 11723, 11725, 11730, 11736, 11982, 11989, 12102, 12336, 12348, 12350, 12384, 12393, 12395, 12397, 12510, 12553, 12851, 12962, 12973, 13738, 13823, 13919, 13933, 14080, 14298, 14585, 14698, 15583, 15847, 16318, 16434, 16438, 16481, 16729, 17102, 17122, 17315, 17320, 17402, 17418, 17859, 17909, 17911, 17915, 17916, 17936, 17939, 17961, 18664, 18703, 18814, 18962, 19043, 33469, 33470, 33471, 33484, 33485, 33490, 33497, 33501, 33505, 33513, 33520, 33536, 33550, 37845, 37921, 37948, 38029, 38038, 38064, 38065, 38066, 38069, 38075, 38076, 38078, 39108, 39109, 39113, 39114, 39115, 39116, 39265, 39394, 189e3] };
2758
2688
  }
2759
2689
  });
2760
2690
 
2761
- // packages/core/node_modules/iconv-lite/encodings/tables/cp949.json
2691
+ // node_modules/iconv-lite/encodings/tables/cp949.json
2762
2692
  var require_cp949 = __commonJS({
2763
- "packages/core/node_modules/iconv-lite/encodings/tables/cp949.json"(exports2, module2) {
2693
+ "node_modules/iconv-lite/encodings/tables/cp949.json"(exports2, module2) {
2764
2694
  module2.exports = [
2765
2695
  ["0", "\0", 127],
2766
2696
  ["8141", "\uAC02\uAC03\uAC05\uAC06\uAC0B", 4, "\uAC18\uAC1E\uAC1F\uAC21\uAC22\uAC23\uAC25", 6, "\uAC2E\uAC32\uAC33\uAC34"],
@@ -3037,9 +2967,9 @@ var require_cp949 = __commonJS({
3037
2967
  }
3038
2968
  });
3039
2969
 
3040
- // packages/core/node_modules/iconv-lite/encodings/tables/cp950.json
2970
+ // node_modules/iconv-lite/encodings/tables/cp950.json
3041
2971
  var require_cp950 = __commonJS({
3042
- "packages/core/node_modules/iconv-lite/encodings/tables/cp950.json"(exports2, module2) {
2972
+ "node_modules/iconv-lite/encodings/tables/cp950.json"(exports2, module2) {
3043
2973
  module2.exports = [
3044
2974
  ["0", "\0", 127],
3045
2975
  ["a140", "\u3000\uFF0C\u3001\u3002\uFF0E\u2027\uFF1B\uFF1A\uFF1F\uFF01\uFE30\u2026\u2025\uFE50\uFE51\uFE52\xB7\uFE54\uFE55\uFE56\uFE57\uFF5C\u2013\uFE31\u2014\uFE33\u2574\uFE34\uFE4F\uFF08\uFF09\uFE35\uFE36\uFF5B\uFF5D\uFE37\uFE38\u3014\u3015\uFE39\uFE3A\u3010\u3011\uFE3B\uFE3C\u300A\u300B\uFE3D\uFE3E\u3008\u3009\uFE3F\uFE40\u300C\u300D\uFE41\uFE42\u300E\u300F\uFE43\uFE44\uFE59\uFE5A"],
@@ -3220,9 +3150,9 @@ var require_cp950 = __commonJS({
3220
3150
  }
3221
3151
  });
3222
3152
 
3223
- // packages/core/node_modules/iconv-lite/encodings/tables/big5-added.json
3153
+ // node_modules/iconv-lite/encodings/tables/big5-added.json
3224
3154
  var require_big5_added = __commonJS({
3225
- "packages/core/node_modules/iconv-lite/encodings/tables/big5-added.json"(exports2, module2) {
3155
+ "node_modules/iconv-lite/encodings/tables/big5-added.json"(exports2, module2) {
3226
3156
  module2.exports = [
3227
3157
  ["8740", "\u43F0\u4C32\u4603\u45A6\u4578\u{27267}\u4D77\u45B3\u{27CB1}\u4CE2\u{27CC5}\u3B95\u4736\u4744\u4C47\u4C40\u{242BF}\u{23617}\u{27352}\u{26E8B}\u{270D2}\u4C57\u{2A351}\u474F\u45DA\u4C85\u{27C6C}\u4D07\u4AA4\u46A1\u{26B23}\u7225\u{25A54}\u{21A63}\u{23E06}\u{23F61}\u664D\u56FB"],
3228
3158
  ["8767", "\u7D95\u591D\u{28BB9}\u3DF4\u9734\u{27BEF}\u5BDB\u{21D5E}\u5AA4\u3625\u{29EB0}\u5AD1\u5BB7\u5CFC\u676E\u8593\u{29945}\u7461\u749D\u3875\u{21D53}\u{2369E}\u{26021}\u3EEC"],
@@ -3348,16 +3278,16 @@ var require_big5_added = __commonJS({
3348
3278
  }
3349
3279
  });
3350
3280
 
3351
- // packages/core/node_modules/iconv-lite/encodings/dbcs-data.js
3281
+ // node_modules/iconv-lite/encodings/dbcs-data.js
3352
3282
  var require_dbcs_data = __commonJS({
3353
- "packages/core/node_modules/iconv-lite/encodings/dbcs-data.js"(exports2, module2) {
3283
+ "node_modules/iconv-lite/encodings/dbcs-data.js"(exports2, module2) {
3354
3284
  "use strict";
3355
3285
  init_esbuild_shims();
3356
3286
  module2.exports = {
3357
3287
  // == Japanese/ShiftJIS ====================================================
3358
3288
  // All japanese encodings are based on JIS X set of standards:
3359
3289
  // JIS X 0201 - Single-byte encoding of ASCII + ¥ + Kana chars at 0xA1-0xDF.
3360
- // JIS X 0208 - Main set of 6879 characters, placed in 94x94 plane, to be encoded by 2 bytes.
3290
+ // JIS X 0208 - Main set of 6879 characters, placed in 94x94 plane, to be encoded by 2 bytes.
3361
3291
  // Has several variations in 1978, 1983, 1990 and 1997.
3362
3292
  // JIS X 0212 - Supplementary plane of 6067 chars in 94x94 plane. 1990. Effectively dead.
3363
3293
  // JIS X 0213 - Extension and modern replacement of 0208 and 0212. Total chars: 11233.
@@ -3374,7 +3304,7 @@ var require_dbcs_data = __commonJS({
3374
3304
  // 0x8F, (0xA1-0xFE)x2 - 0212 plane (94x94).
3375
3305
  // * JIS X 208: 7-bit, direct encoding of 0208. Byte ranges: 0x21-0x7E (94 values). Uncommon.
3376
3306
  // Used as-is in ISO2022 family.
3377
- // * ISO2022-JP: Stateful encoding, with escape sequences to switch between ASCII,
3307
+ // * ISO2022-JP: Stateful encoding, with escape sequences to switch between ASCII,
3378
3308
  // 0201-1976 Roman, 0208-1978, 0208-1983.
3379
3309
  // * ISO2022-JP-1: Adds esc seq for 0212-1990.
3380
3310
  // * ISO2022-JP-2: Adds esc seq for GB2313-1980, KSX1001-1992, ISO8859-1, ISO8859-7.
@@ -3384,7 +3314,7 @@ var require_dbcs_data = __commonJS({
3384
3314
  // After JIS X 0213 appeared, Shift_JIS-2004, EUC-JISX0213 and ISO2022-JP-2004 followed, with just changing the planes.
3385
3315
  //
3386
3316
  // Overall, it seems that it's a mess :( http://www8.plala.or.jp/tkubota1/unicode-symbols-map2.html
3387
- shiftjis: {
3317
+ "shiftjis": {
3388
3318
  type: "_dbcs",
3389
3319
  table: /* @__PURE__ */ __name(function() {
3390
3320
  return require_shiftjis();
@@ -3392,17 +3322,17 @@ var require_dbcs_data = __commonJS({
3392
3322
  encodeAdd: { "\xA5": 92, "\u203E": 126 },
3393
3323
  encodeSkipVals: [{ from: 60736, to: 63808 }]
3394
3324
  },
3395
- csshiftjis: "shiftjis",
3396
- mskanji: "shiftjis",
3397
- sjis: "shiftjis",
3398
- windows31j: "shiftjis",
3399
- ms31j: "shiftjis",
3400
- xsjis: "shiftjis",
3401
- windows932: "shiftjis",
3402
- ms932: "shiftjis",
3403
- 932: "shiftjis",
3404
- cp932: "shiftjis",
3405
- eucjp: {
3325
+ "csshiftjis": "shiftjis",
3326
+ "mskanji": "shiftjis",
3327
+ "sjis": "shiftjis",
3328
+ "windows31j": "shiftjis",
3329
+ "ms31j": "shiftjis",
3330
+ "xsjis": "shiftjis",
3331
+ "windows932": "shiftjis",
3332
+ "ms932": "shiftjis",
3333
+ "932": "shiftjis",
3334
+ "cp932": "shiftjis",
3335
+ "eucjp": {
3406
3336
  type: "_dbcs",
3407
3337
  table: /* @__PURE__ */ __name(function() {
3408
3338
  return require_eucjp();
@@ -3416,37 +3346,37 @@ var require_dbcs_data = __commonJS({
3416
3346
  // http://en.wikipedia.org/wiki/GBK
3417
3347
  // We mostly implement W3C recommendation: https://www.w3.org/TR/encoding/#gbk-encoder
3418
3348
  // Oldest GB2312 (1981, ~7600 chars) is a subset of CP936
3419
- gb2312: "cp936",
3420
- gb231280: "cp936",
3421
- gb23121980: "cp936",
3422
- csgb2312: "cp936",
3423
- csiso58gb231280: "cp936",
3424
- euccn: "cp936",
3349
+ "gb2312": "cp936",
3350
+ "gb231280": "cp936",
3351
+ "gb23121980": "cp936",
3352
+ "csgb2312": "cp936",
3353
+ "csiso58gb231280": "cp936",
3354
+ "euccn": "cp936",
3425
3355
  // Microsoft's CP936 is a subset and approximation of GBK.
3426
- windows936: "cp936",
3427
- ms936: "cp936",
3428
- 936: "cp936",
3429
- cp936: {
3356
+ "windows936": "cp936",
3357
+ "ms936": "cp936",
3358
+ "936": "cp936",
3359
+ "cp936": {
3430
3360
  type: "_dbcs",
3431
3361
  table: /* @__PURE__ */ __name(function() {
3432
3362
  return require_cp936();
3433
3363
  }, "table")
3434
3364
  },
3435
3365
  // GBK (~22000 chars) is an extension of CP936 that added user-mapped chars and some other.
3436
- gbk: {
3366
+ "gbk": {
3437
3367
  type: "_dbcs",
3438
3368
  table: /* @__PURE__ */ __name(function() {
3439
3369
  return require_cp936().concat(require_gbk_added());
3440
3370
  }, "table")
3441
3371
  },
3442
- xgbk: "gbk",
3443
- isoir58: "gbk",
3372
+ "xgbk": "gbk",
3373
+ "isoir58": "gbk",
3444
3374
  // GB18030 is an algorithmic extension of GBK.
3445
3375
  // Main source: https://www.w3.org/TR/encoding/#gbk-encoder
3446
3376
  // http://icu-project.org/docs/papers/gb18030.html
3447
3377
  // http://source.icu-project.org/repos/icu/data/trunk/charset/data/xml/gb-18030-2000.xml
3448
3378
  // http://www.khngai.com/chinese/charmap/tblgbk.php?page=0
3449
- gb18030: {
3379
+ "gb18030": {
3450
3380
  type: "_dbcs",
3451
3381
  table: /* @__PURE__ */ __name(function() {
3452
3382
  return require_cp936().concat(require_gbk_added());
@@ -3457,26 +3387,26 @@ var require_dbcs_data = __commonJS({
3457
3387
  encodeSkipVals: [128],
3458
3388
  encodeAdd: { "\u20AC": 41699 }
3459
3389
  },
3460
- chinese: "gb18030",
3390
+ "chinese": "gb18030",
3461
3391
  // == Korean ===============================================================
3462
3392
  // EUC-KR, KS_C_5601 and KS X 1001 are exactly the same.
3463
- windows949: "cp949",
3464
- ms949: "cp949",
3465
- 949: "cp949",
3466
- cp949: {
3393
+ "windows949": "cp949",
3394
+ "ms949": "cp949",
3395
+ "949": "cp949",
3396
+ "cp949": {
3467
3397
  type: "_dbcs",
3468
3398
  table: /* @__PURE__ */ __name(function() {
3469
3399
  return require_cp949();
3470
3400
  }, "table")
3471
3401
  },
3472
- cseuckr: "cp949",
3473
- csksc56011987: "cp949",
3474
- euckr: "cp949",
3475
- isoir149: "cp949",
3476
- korean: "cp949",
3477
- ksc56011987: "cp949",
3478
- ksc56011989: "cp949",
3479
- ksc5601: "cp949",
3402
+ "cseuckr": "cp949",
3403
+ "csksc56011987": "cp949",
3404
+ "euckr": "cp949",
3405
+ "isoir149": "cp949",
3406
+ "korean": "cp949",
3407
+ "ksc56011987": "cp949",
3408
+ "ksc56011989": "cp949",
3409
+ "ksc5601": "cp949",
3480
3410
  // == Big5/Taiwan/Hong Kong ================================================
3481
3411
  // There are lots of tables for Big5 and cp950. Please see the following links for history:
3482
3412
  // http://moztw.org/docs/big5/ http://www.haible.de/bruno/charsets/conversion-tables/Big5.html
@@ -3485,7 +3415,7 @@ var require_dbcs_data = __commonJS({
3485
3415
  // * Windows CP 951: Microsoft variant of Big5-HKSCS-2001. Seems to be never public. http://me.abelcheung.org/articles/research/what-is-cp951/
3486
3416
  // * Big5-2003 (Taiwan standard) almost superset of cp950.
3487
3417
  // * Unicode-at-on (UAO) / Mozilla 1.8. Falling out of use on the Web. Not supported by other browsers.
3488
- // * Big5-HKSCS (-2001, -2004, -2008). Hong Kong standard.
3418
+ // * Big5-HKSCS (-2001, -2004, -2008). Hong Kong standard.
3489
3419
  // many unicode code points moved from PUA to Supplementary plane (U+2XXXX) over the years.
3490
3420
  // Plus, it has 4 combining sequences.
3491
3421
  // Seems that Mozilla refused to support it for 10 yrs. https://bugzilla.mozilla.org/show_bug.cgi?id=162431 https://bugzilla.mozilla.org/show_bug.cgi?id=310299
@@ -3496,21 +3426,21 @@ var require_dbcs_data = __commonJS({
3496
3426
  // In the encoder, it might make sense to support encoding old PUA mappings to Big5 bytes seq-s.
3497
3427
  // Official spec: http://www.ogcio.gov.hk/en/business/tech_promotion/ccli/terms/doc/2003cmp_2008.txt
3498
3428
  // http://www.ogcio.gov.hk/tc/business/tech_promotion/ccli/terms/doc/hkscs-2008-big5-iso.txt
3499
- //
3429
+ //
3500
3430
  // Current understanding of how to deal with Big5(-HKSCS) is in the Encoding Standard, http://encoding.spec.whatwg.org/#big5-encoder
3501
3431
  // Unicode mapping (http://www.unicode.org/Public/MAPPINGS/OBSOLETE/EASTASIA/OTHER/BIG5.TXT) is said to be wrong.
3502
- windows950: "cp950",
3503
- ms950: "cp950",
3504
- 950: "cp950",
3505
- cp950: {
3432
+ "windows950": "cp950",
3433
+ "ms950": "cp950",
3434
+ "950": "cp950",
3435
+ "cp950": {
3506
3436
  type: "_dbcs",
3507
3437
  table: /* @__PURE__ */ __name(function() {
3508
3438
  return require_cp950();
3509
3439
  }, "table")
3510
3440
  },
3511
3441
  // Big5 has many variations and is an extension of cp950. We use Encoding Standard's as a consensus.
3512
- big5: "big5hkscs",
3513
- big5hkscs: {
3442
+ "big5": "big5hkscs",
3443
+ "big5hkscs": {
3514
3444
  type: "_dbcs",
3515
3445
  table: /* @__PURE__ */ __name(function() {
3516
3446
  return require_cp950().concat(require_big5_added());
@@ -3589,19 +3519,18 @@ var require_dbcs_data = __commonJS({
3589
3519
  41678
3590
3520
  ]
3591
3521
  },
3592
- cnbig5: "big5hkscs",
3593
- csbig5: "big5hkscs",
3594
- xxbig5: "big5hkscs"
3522
+ "cnbig5": "big5hkscs",
3523
+ "csbig5": "big5hkscs",
3524
+ "xxbig5": "big5hkscs"
3595
3525
  };
3596
3526
  }
3597
3527
  });
3598
3528
 
3599
- // packages/core/node_modules/iconv-lite/encodings/index.js
3529
+ // node_modules/iconv-lite/encodings/index.js
3600
3530
  var require_encodings = __commonJS({
3601
- "packages/core/node_modules/iconv-lite/encodings/index.js"(exports2, module2) {
3531
+ "node_modules/iconv-lite/encodings/index.js"(exports2, module2) {
3602
3532
  "use strict";
3603
3533
  init_esbuild_shims();
3604
- var mergeModules = require_merge_exports();
3605
3534
  var modules = [
3606
3535
  require_internal(),
3607
3536
  require_utf32(),
@@ -3615,21 +3544,24 @@ var require_encodings = __commonJS({
3615
3544
  ];
3616
3545
  for (i = 0; i < modules.length; i++) {
3617
3546
  module2 = modules[i];
3618
- mergeModules(exports2, module2);
3547
+ for (enc in module2)
3548
+ if (Object.prototype.hasOwnProperty.call(module2, enc))
3549
+ exports2[enc] = module2[enc];
3619
3550
  }
3620
3551
  var module2;
3552
+ var enc;
3621
3553
  var i;
3622
3554
  }
3623
3555
  });
3624
3556
 
3625
- // packages/core/node_modules/iconv-lite/lib/streams.js
3557
+ // node_modules/iconv-lite/lib/streams.js
3626
3558
  var require_streams = __commonJS({
3627
- "packages/core/node_modules/iconv-lite/lib/streams.js"(exports2, module2) {
3559
+ "node_modules/iconv-lite/lib/streams.js"(exports2, module2) {
3628
3560
  "use strict";
3629
3561
  init_esbuild_shims();
3630
3562
  var Buffer3 = require_safer().Buffer;
3631
- module2.exports = function(streamModule) {
3632
- var Transform = streamModule.Transform;
3563
+ module2.exports = function(stream_module) {
3564
+ var Transform = stream_module.Transform;
3633
3565
  function IconvLiteEncoderStream(conv, options) {
3634
3566
  this.conv = conv;
3635
3567
  options = options || {};
@@ -3641,9 +3573,8 @@ var require_streams = __commonJS({
3641
3573
  constructor: { value: IconvLiteEncoderStream }
3642
3574
  });
3643
3575
  IconvLiteEncoderStream.prototype._transform = function(chunk, encoding, done) {
3644
- if (typeof chunk !== "string") {
3576
+ if (typeof chunk != "string")
3645
3577
  return done(new Error("Iconv encoding stream needs strings as its input."));
3646
- }
3647
3578
  try {
3648
3579
  var res = this.conv.write(chunk);
3649
3580
  if (res && res.length) this.push(res);
@@ -3683,9 +3614,8 @@ var require_streams = __commonJS({
3683
3614
  constructor: { value: IconvLiteDecoderStream }
3684
3615
  });
3685
3616
  IconvLiteDecoderStream.prototype._transform = function(chunk, encoding, done) {
3686
- if (!Buffer3.isBuffer(chunk) && !(chunk instanceof Uint8Array)) {
3617
+ if (!Buffer3.isBuffer(chunk) && !(chunk instanceof Uint8Array))
3687
3618
  return done(new Error("Iconv decoding stream needs buffers as its input."));
3688
- }
3689
3619
  try {
3690
3620
  var res = this.conv.write(chunk);
3691
3621
  if (res && res.length) this.push(res, this.encoding);
@@ -3722,14 +3652,13 @@ var require_streams = __commonJS({
3722
3652
  }
3723
3653
  });
3724
3654
 
3725
- // packages/core/node_modules/iconv-lite/lib/index.js
3655
+ // node_modules/iconv-lite/lib/index.js
3726
3656
  var require_lib = __commonJS({
3727
- "packages/core/node_modules/iconv-lite/lib/index.js"(exports2, module2) {
3657
+ "node_modules/iconv-lite/lib/index.js"(exports2, module2) {
3728
3658
  "use strict";
3729
3659
  init_esbuild_shims();
3730
3660
  var Buffer3 = require_safer().Buffer;
3731
3661
  var bomHandling = require_bom_handling();
3732
- var mergeModules = require_merge_exports();
3733
3662
  var iconv = module2.exports;
3734
3663
  iconv.encodings = null;
3735
3664
  iconv.defaultCharUnicode = "\uFFFD";
@@ -3764,38 +3693,31 @@ var require_lib = __commonJS({
3764
3693
  }, "encodingExists");
3765
3694
  iconv.toEncoding = iconv.encode;
3766
3695
  iconv.fromEncoding = iconv.decode;
3767
- iconv._codecDataCache = { __proto__: null };
3696
+ iconv._codecDataCache = {};
3768
3697
  iconv.getCodec = /* @__PURE__ */ __name(function getCodec(encoding) {
3769
- if (!iconv.encodings) {
3770
- var raw = require_encodings();
3771
- iconv.encodings = { __proto__: null };
3772
- mergeModules(iconv.encodings, raw);
3773
- }
3698
+ if (!iconv.encodings)
3699
+ iconv.encodings = require_encodings();
3774
3700
  var enc = iconv._canonicalizeEncoding(encoding);
3775
3701
  var codecOptions = {};
3776
3702
  while (true) {
3777
3703
  var codec = iconv._codecDataCache[enc];
3778
- if (codec) {
3704
+ if (codec)
3779
3705
  return codec;
3780
- }
3781
3706
  var codecDef = iconv.encodings[enc];
3782
3707
  switch (typeof codecDef) {
3783
3708
  case "string":
3784
3709
  enc = codecDef;
3785
3710
  break;
3786
3711
  case "object":
3787
- for (var key in codecDef) {
3712
+ for (var key in codecDef)
3788
3713
  codecOptions[key] = codecDef[key];
3789
- }
3790
- if (!codecOptions.encodingName) {
3714
+ if (!codecOptions.encodingName)
3791
3715
  codecOptions.encodingName = enc;
3792
- }
3793
3716
  enc = codecDef.type;
3794
3717
  break;
3795
3718
  case "function":
3796
- if (!codecOptions.encodingName) {
3719
+ if (!codecOptions.encodingName)
3797
3720
  codecOptions.encodingName = enc;
3798
- }
3799
3721
  codec = new codecDef(codecOptions, iconv);
3800
3722
  iconv._codecDataCache[codecOptions.encodingName] = codec;
3801
3723
  return codec;
@@ -3808,26 +3730,21 @@ var require_lib = __commonJS({
3808
3730
  return ("" + encoding).toLowerCase().replace(/:\d{4}$|[^0-9a-z]/g, "");
3809
3731
  };
3810
3732
  iconv.getEncoder = /* @__PURE__ */ __name(function getEncoder(encoding, options) {
3811
- var codec = iconv.getCodec(encoding);
3812
- var encoder = new codec.encoder(options, codec);
3813
- if (codec.bomAware && options && options.addBOM) {
3733
+ var codec = iconv.getCodec(encoding), encoder = new codec.encoder(options, codec);
3734
+ if (codec.bomAware && options && options.addBOM)
3814
3735
  encoder = new bomHandling.PrependBOM(encoder, options);
3815
- }
3816
3736
  return encoder;
3817
3737
  }, "getEncoder");
3818
3738
  iconv.getDecoder = /* @__PURE__ */ __name(function getDecoder(encoding, options) {
3819
- var codec = iconv.getCodec(encoding);
3820
- var decoder = new codec.decoder(options, codec);
3821
- if (codec.bomAware && !(options && options.stripBOM === false)) {
3739
+ var codec = iconv.getCodec(encoding), decoder = new codec.decoder(options, codec);
3740
+ if (codec.bomAware && !(options && options.stripBOM === false))
3822
3741
  decoder = new bomHandling.StripBOM(decoder, options);
3823
- }
3824
3742
  return decoder;
3825
3743
  }, "getDecoder");
3826
- iconv.enableStreamingAPI = /* @__PURE__ */ __name(function enableStreamingAPI(streamModule2) {
3827
- if (iconv.supportsStreams) {
3744
+ iconv.enableStreamingAPI = /* @__PURE__ */ __name(function enableStreamingAPI(stream_module2) {
3745
+ if (iconv.supportsStreams)
3828
3746
  return;
3829
- }
3830
- var streams = require_streams()(streamModule2);
3747
+ var streams = require_streams()(stream_module2);
3831
3748
  iconv.IconvLiteEncoderStream = streams.IconvLiteEncoderStream;
3832
3749
  iconv.IconvLiteDecoderStream = streams.IconvLiteDecoderStream;
3833
3750
  iconv.encodeStream = /* @__PURE__ */ __name(function encodeStream(encoding, options) {
@@ -3838,13 +3755,13 @@ var require_lib = __commonJS({
3838
3755
  }, "decodeStream");
3839
3756
  iconv.supportsStreams = true;
3840
3757
  }, "enableStreamingAPI");
3841
- var streamModule;
3758
+ var stream_module;
3842
3759
  try {
3843
- streamModule = __require("stream");
3760
+ stream_module = __require("stream");
3844
3761
  } catch (e) {
3845
3762
  }
3846
- if (streamModule && streamModule.Transform) {
3847
- iconv.enableStreamingAPI(streamModule);
3763
+ if (stream_module && stream_module.Transform) {
3764
+ iconv.enableStreamingAPI(stream_module);
3848
3765
  } else {
3849
3766
  iconv.encodeStream = iconv.decodeStream = function() {
3850
3767
  throw new Error("iconv-lite Streaming API is not enabled. Use iconv.enableStreamingAPI(require('stream')); to enable it.");
@@ -63532,6 +63449,147 @@ function normalizeSource(source) {
63532
63449
  return Array.isArray(source) ? source.join("") : source;
63533
63450
  }
63534
63451
  __name(normalizeSource, "normalizeSource");
63452
+ function parseNotebook(content) {
63453
+ const jsonContent = content.charCodeAt(0) === 65279 ? content.slice(1) : content;
63454
+ const parsed = JSON.parse(jsonContent);
63455
+ if (!parsed || typeof parsed !== "object") {
63456
+ throw new Error("Invalid notebook: expected a JSON object");
63457
+ }
63458
+ const notebook = parsed;
63459
+ if (!Array.isArray(notebook.cells)) {
63460
+ throw new Error("Invalid notebook: missing cells array");
63461
+ }
63462
+ for (let i = 0; i < notebook.cells.length; i++) {
63463
+ const cell = notebook.cells[i];
63464
+ if (!cell || typeof cell !== "object" || Array.isArray(cell)) {
63465
+ throw new Error(`Invalid notebook: cell at index ${i} is not an object`);
63466
+ }
63467
+ }
63468
+ return notebook;
63469
+ }
63470
+ __name(parseNotebook, "parseNotebook");
63471
+ function inferNotebookJsonFormat(content) {
63472
+ const lineMatch = content.match(/\n([ \t]+)"/);
63473
+ const indent = lineMatch?.[1];
63474
+ let inferredIndent;
63475
+ if (indent !== void 0) {
63476
+ inferredIndent = /^ +$/.test(indent) ? indent.length : indent;
63477
+ }
63478
+ return {
63479
+ indent: inferredIndent,
63480
+ trailingNewline: content.endsWith("\n")
63481
+ };
63482
+ }
63483
+ __name(inferNotebookJsonFormat, "inferNotebookJsonFormat");
63484
+ function serializeNotebook(notebook, format = { indent: 1, trailingNewline: true }) {
63485
+ const serialized = JSON.stringify(notebook, null, format.indent);
63486
+ return format.trailingNewline ? `${serialized}
63487
+ ` : serialized;
63488
+ }
63489
+ __name(serializeNotebook, "serializeNotebook");
63490
+ function getCellDisplayId(cell, index) {
63491
+ return typeof cell.id === "string" && cell.id.length > 0 ? cell.id : `cell-${index}`;
63492
+ }
63493
+ __name(getCellDisplayId, "getCellDisplayId");
63494
+ function hasStableCellIds(notebook) {
63495
+ return notebook.cells.every(
63496
+ (cell) => typeof cell.id === "string" && cell.id.length > 0
63497
+ );
63498
+ }
63499
+ __name(hasStableCellIds, "hasStableCellIds");
63500
+ function findCellIndexesByDisplayId(notebook, cellId) {
63501
+ const indexes = [];
63502
+ notebook.cells.forEach((cell, index) => {
63503
+ if (getCellDisplayId(cell, index) === cellId) {
63504
+ indexes.push(index);
63505
+ }
63506
+ });
63507
+ return indexes;
63508
+ }
63509
+ __name(findCellIndexesByDisplayId, "findCellIndexesByDisplayId");
63510
+ function isAmbiguousCellId(notebook, cellId) {
63511
+ return findCellIndexesByDisplayId(notebook, cellId).length > 1;
63512
+ }
63513
+ __name(isAmbiguousCellId, "isAmbiguousCellId");
63514
+ function findCellIndex(notebook, cellId) {
63515
+ const indexes = findCellIndexesByDisplayId(notebook, cellId);
63516
+ return indexes.length === 1 ? indexes[0] : -1;
63517
+ }
63518
+ __name(findCellIndex, "findCellIndex");
63519
+ function getNotebookLanguage(notebook) {
63520
+ return notebook.metadata?.language_info?.name ?? notebook.metadata?.kernelspec?.language ?? "python";
63521
+ }
63522
+ __name(getNotebookLanguage, "getNotebookLanguage");
63523
+ function shouldGenerateCellIds(notebook) {
63524
+ return (notebook.nbformat ?? 0) > 4 || (notebook.nbformat ?? 0) === 4 && (notebook.nbformat_minor ?? 0) >= 5;
63525
+ }
63526
+ __name(shouldGenerateCellIds, "shouldGenerateCellIds");
63527
+ function makeCellId(notebook) {
63528
+ if (!shouldGenerateCellIds(notebook)) {
63529
+ return void 0;
63530
+ }
63531
+ const existingDisplayIds = new Set(
63532
+ notebook.cells.map((cell, index) => getCellDisplayId(cell, index))
63533
+ );
63534
+ let fallbackIndex = 1;
63535
+ let fallback = `qwen-cell-${fallbackIndex}`;
63536
+ while (existingDisplayIds.has(fallback)) {
63537
+ fallbackIndex++;
63538
+ fallback = `qwen-cell-${fallbackIndex}`;
63539
+ }
63540
+ return fallback;
63541
+ }
63542
+ __name(makeCellId, "makeCellId");
63543
+ function inferNotebookSourceArrayStyle(notebook) {
63544
+ const sourceCell = notebook.cells.find((cell) => cell.source !== void 0);
63545
+ return sourceCell ? Array.isArray(sourceCell.source) : true;
63546
+ }
63547
+ __name(inferNotebookSourceArrayStyle, "inferNotebookSourceArrayStyle");
63548
+ function inferInsertedCellSourceArrayStyle(notebook, insertAt) {
63549
+ const previousCell = notebook.cells[insertAt - 1];
63550
+ if (previousCell?.source !== void 0) {
63551
+ return Array.isArray(previousCell.source);
63552
+ }
63553
+ const nextCell = notebook.cells[insertAt];
63554
+ if (nextCell?.source !== void 0) {
63555
+ return Array.isArray(nextCell.source);
63556
+ }
63557
+ return inferNotebookSourceArrayStyle(notebook);
63558
+ }
63559
+ __name(inferInsertedCellSourceArrayStyle, "inferInsertedCellSourceArrayStyle");
63560
+ function toNotebookSource(source, preferArray) {
63561
+ if (!preferArray) {
63562
+ return source;
63563
+ }
63564
+ if (source.length === 0) {
63565
+ return [];
63566
+ }
63567
+ const lines = [];
63568
+ let start = 0;
63569
+ for (let i = 0; i < source.length; i++) {
63570
+ if (source[i] === "\n") {
63571
+ lines.push(source.slice(start, i + 1));
63572
+ start = i + 1;
63573
+ }
63574
+ }
63575
+ if (start < source.length) {
63576
+ lines.push(source.slice(start));
63577
+ }
63578
+ return lines;
63579
+ }
63580
+ __name(toNotebookSource, "toNotebookSource");
63581
+ function normalizeEditedCell(cell, finalType) {
63582
+ cell.cell_type = finalType;
63583
+ cell.metadata ??= {};
63584
+ if (finalType === "code") {
63585
+ cell.execution_count = null;
63586
+ cell.outputs = [];
63587
+ return;
63588
+ }
63589
+ delete cell.execution_count;
63590
+ delete cell.outputs;
63591
+ }
63592
+ __name(normalizeEditedCell, "normalizeEditedCell");
63535
63593
  function processOutputText(text) {
63536
63594
  if (!text) return "";
63537
63595
  return Array.isArray(text) ? text.join("") : text;
@@ -63567,7 +63625,7 @@ function processOutput(output) {
63567
63625
  }
63568
63626
  __name(processOutput, "processOutput");
63569
63627
  function processCell(cell, index, language) {
63570
- const cellId = cell.id ?? `cell-${index}`;
63628
+ const cellId = getCellDisplayId(cell, index);
63571
63629
  const source = normalizeSource(cell.source);
63572
63630
  const parts = [];
63573
63631
  switch (cell.cell_type) {
@@ -63607,20 +63665,22 @@ function processCell(cell, index, language) {
63607
63665
  return parts.join("\n");
63608
63666
  }
63609
63667
  __name(processCell, "processCell");
63610
- async function readNotebook(filePath) {
63668
+ async function readNotebookWithMetadata(filePath) {
63611
63669
  const raw = await fs.promises.readFile(filePath, "utf-8");
63612
- const notebook = JSON.parse(raw);
63613
- const language = notebook.metadata?.language_info?.name ?? notebook.metadata?.kernelspec?.language ?? "python";
63670
+ const notebook = parseNotebook(raw);
63671
+ const language = getNotebookLanguage(notebook);
63614
63672
  if (!notebook.cells || notebook.cells.length === 0) {
63615
- return "(empty notebook)";
63673
+ return { content: "(empty notebook)", isTruncated: false };
63616
63674
  }
63617
63675
  const header = `Jupyter Notebook (${language}, ${notebook.cells.length} cells)`;
63618
63676
  const cellTexts = [];
63619
63677
  let totalLength = header.length;
63678
+ let isTruncated = false;
63620
63679
  for (let i = 0; i < notebook.cells.length; i++) {
63621
63680
  const cellText = processCell(notebook.cells[i], i, language);
63622
63681
  totalLength += cellText.length + 2;
63623
63682
  if (totalLength > MAX_NOTEBOOK_OUTPUT_CHARS) {
63683
+ isTruncated = true;
63624
63684
  cellTexts.push(
63625
63685
  `... [${notebook.cells.length - i} remaining cells truncated, total ${notebook.cells.length} cells. Use shell to inspect: cat <path> | jq '.cells[${i}:]']`
63626
63686
  );
@@ -63628,11 +63688,14 @@ async function readNotebook(filePath) {
63628
63688
  }
63629
63689
  cellTexts.push(cellText);
63630
63690
  }
63631
- return `${header}
63691
+ return {
63692
+ content: `${header}
63632
63693
 
63633
- ${cellTexts.join("\n\n")}`;
63694
+ ${cellTexts.join("\n\n")}`,
63695
+ isTruncated
63696
+ };
63634
63697
  }
63635
- __name(readNotebook, "readNotebook");
63698
+ __name(readNotebookWithMetadata, "readNotebookWithMetadata");
63636
63699
 
63637
63700
  // packages/core/src/utils/fileUtils.ts
63638
63701
  var debugLogger2 = createDebugLogger("FILE_UTILS");
@@ -63694,6 +63757,42 @@ function isValidUtf8(buffer) {
63694
63757
  }
63695
63758
  }
63696
63759
  __name(isValidUtf8, "isValidUtf8");
63760
+ function decodeBufferWithEncodingInfo(full) {
63761
+ if (full.length === 0) {
63762
+ return { content: "", encoding: "utf-8", bom: false };
63763
+ }
63764
+ const bomInfo = detectBOM(full);
63765
+ if (bomInfo) {
63766
+ return {
63767
+ content: decodeBOMBuffer(full, bomInfo),
63768
+ encoding: bomEncodingToName(bomInfo.encoding),
63769
+ // Mark bom: true for all Unicode BOM variants (UTF-8/16/32) so that
63770
+ // the BOM is re-written on save and the file's original format is preserved.
63771
+ bom: true
63772
+ };
63773
+ }
63774
+ if (isValidUtf8(full)) {
63775
+ return { content: full.toString("utf8"), encoding: "utf-8", bom: false };
63776
+ }
63777
+ const detected = detectEncodingFromBuffer(full);
63778
+ if (detected && !isUtf8CompatibleEncoding(detected)) {
63779
+ try {
63780
+ if (iconvEncodingExists(detected)) {
63781
+ return {
63782
+ content: iconvDecode(full, detected),
63783
+ encoding: detected,
63784
+ bom: false
63785
+ };
63786
+ }
63787
+ } catch (e) {
63788
+ debugLogger2.warn(
63789
+ `Failed to decode buffer as ${detected}: ${e instanceof Error ? e.message : String(e)}`
63790
+ );
63791
+ }
63792
+ }
63793
+ return { content: full.toString("utf8"), encoding: "utf-8", bom: false };
63794
+ }
63795
+ __name(decodeBufferWithEncodingInfo, "decodeBufferWithEncodingInfo");
63697
63796
  function decodeBOMBuffer(buf, bomInfo) {
63698
63797
  const content = buf.subarray(bomInfo.bomLength);
63699
63798
  switch (bomInfo.encoding) {
@@ -63731,37 +63830,7 @@ function bomEncodingToName(bomEncoding) {
63731
63830
  __name(bomEncodingToName, "bomEncodingToName");
63732
63831
  async function readFileWithEncodingInfo(filePath) {
63733
63832
  const full = await fs2.promises.readFile(filePath);
63734
- if (full.length === 0) return { content: "", encoding: "utf-8", bom: false };
63735
- const bomInfo = detectBOM(full);
63736
- if (bomInfo) {
63737
- return {
63738
- content: decodeBOMBuffer(full, bomInfo),
63739
- encoding: bomEncodingToName(bomInfo.encoding),
63740
- // Mark bom: true for all Unicode BOM variants (UTF-8/16/32) so that
63741
- // the BOM is re-written on save and the file's original format is preserved.
63742
- bom: true
63743
- };
63744
- }
63745
- if (isValidUtf8(full)) {
63746
- return { content: full.toString("utf8"), encoding: "utf-8", bom: false };
63747
- }
63748
- const detected = detectEncodingFromBuffer(full);
63749
- if (detected && !isUtf8CompatibleEncoding(detected)) {
63750
- try {
63751
- if (iconvEncodingExists(detected)) {
63752
- return {
63753
- content: iconvDecode(full, detected),
63754
- encoding: detected,
63755
- bom: false
63756
- };
63757
- }
63758
- } catch (e) {
63759
- debugLogger2.warn(
63760
- `Failed to decode file ${filePath} as ${detected}: ${e instanceof Error ? e.message : String(e)}`
63761
- );
63762
- }
63763
- }
63764
- return { content: full.toString("utf8"), encoding: "utf-8", bom: false };
63833
+ return decodeBufferWithEncodingInfo(full);
63765
63834
  }
63766
63835
  __name(readFileWithEncodingInfo, "readFileWithEncodingInfo");
63767
63836
  async function readFileWithEncoding(filePath) {
@@ -64341,10 +64410,12 @@ async function processSingleFileContent(filePath, config, offset, limit, pages)
64341
64410
  }
64342
64411
  case "notebook": {
64343
64412
  try {
64344
- const content = await readNotebook(filePath);
64413
+ const { content, isTruncated } = await readNotebookWithMetadata(filePath);
64345
64414
  return {
64346
64415
  llmContent: content,
64347
- returnDisplay: `Read notebook: ${relativePathForDisplay}`
64416
+ returnDisplay: `Read notebook: ${relativePathForDisplay}`,
64417
+ isTruncated,
64418
+ stats
64348
64419
  };
64349
64420
  } catch (e) {
64350
64421
  const msg = e instanceof Error ? e.message : String(e);
@@ -64434,6 +64505,8 @@ var SPAN_INTERACTION = "qwen-code.interaction";
64434
64505
  var SPAN_LLM_REQUEST = "qwen-code.llm_request";
64435
64506
  var SPAN_TOOL = "qwen-code.tool";
64436
64507
  var SPAN_TOOL_EXECUTION = "qwen-code.tool.execution";
64508
+ var SPAN_TOOL_BLOCKED_ON_USER = "qwen-code.tool.blocked_on_user";
64509
+ var SPAN_HOOK = "qwen-code.hook";
64437
64510
 
64438
64511
  // packages/core/src/telemetry/metrics.ts
64439
64512
  var TOOL_CALL_COUNT = `${SERVICE_NAME}.tool.call.count`;
@@ -64472,9 +64545,19 @@ var MEMORY_DREAM_DURATION = `${SERVICE_NAME}.memory.dream.duration`;
64472
64545
  var MEMORY_RECALL_COUNT = `${SERVICE_NAME}.memory.recall.count`;
64473
64546
  var MEMORY_RECALL_DURATION = `${SERVICE_NAME}.memory.recall.duration`;
64474
64547
  var baseMetricDefinition = {
64475
- getCommonAttributes: /* @__PURE__ */ __name((config) => ({
64476
- "session.id": config.getSessionId()
64477
- }), "getCommonAttributes")
64548
+ // session.id on metrics is opt-in: each session is a new value, so
64549
+ // attaching it by default would create unbounded time-series fan-out on
64550
+ // every metric backend. Operators who need session-level metric slicing
64551
+ // can enable QWEN_TELEMETRY_METRICS_INCLUDE_SESSION_ID or
64552
+ // telemetry.metrics.includeSessionId. Spans and logs always carry
64553
+ // session.id for trace/log correlation.
64554
+ getCommonAttributes: /* @__PURE__ */ __name((config) => {
64555
+ const out = {};
64556
+ if (config.getTelemetryMetricsIncludeSessionId()) {
64557
+ out["session.id"] = config.getSessionId();
64558
+ }
64559
+ return out;
64560
+ }, "getCommonAttributes")
64478
64561
  };
64479
64562
  var COUNTER_DEFINITIONS = {
64480
64563
  [TOOL_CALL_COUNT]: {
@@ -68036,6 +68119,22 @@ var v4_default = v4;
68036
68119
  // packages/core/src/utils/openaiLogger.ts
68037
68120
  import * as os2 from "os";
68038
68121
  var debugLogger6 = createDebugLogger("OPENAI_LOGGER");
68122
+ var MAIN_SESSION_PROMPT_ID_DELIMITER = "########";
68123
+ var UUID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
68124
+ function resolveOpenAILogDir(customLogDir, cwd) {
68125
+ const baseCwd = cwd || process.cwd();
68126
+ if (!customLogDir) {
68127
+ return path5.join(baseCwd, "logs", "openai");
68128
+ }
68129
+ let resolvedPath = customLogDir;
68130
+ if (customLogDir === "~" || customLogDir.startsWith("~/")) {
68131
+ resolvedPath = path5.join(os2.homedir(), customLogDir.slice(1));
68132
+ } else if (!path5.isAbsolute(customLogDir)) {
68133
+ resolvedPath = path5.resolve(baseCwd, customLogDir);
68134
+ }
68135
+ return path5.normalize(resolvedPath);
68136
+ }
68137
+ __name(resolveOpenAILogDir, "resolveOpenAILogDir");
68039
68138
  function sanitizeDiagnosticSuffix(suffix) {
68040
68139
  if (!suffix) return void 0;
68041
68140
  const sanitized = suffix.replace(/[^a-zA-Z0-9._-]+/g, "-").replace(/^-+|-+$/g, "");
@@ -68060,6 +68159,36 @@ function promptIdSuffixForFilename(promptId) {
68060
68159
  return sanitizeDiagnosticSuffix(extractSubagentSuffix(promptId));
68061
68160
  }
68062
68161
  __name(promptIdSuffixForFilename, "promptIdSuffixForFilename");
68162
+ function sessionIdFromPromptId(promptId) {
68163
+ if (!promptId) return void 0;
68164
+ const mainSessionDelimiterIndex = promptId.indexOf(
68165
+ MAIN_SESSION_PROMPT_ID_DELIMITER
68166
+ );
68167
+ if (mainSessionDelimiterIndex > 0) {
68168
+ return promptId.slice(0, mainSessionDelimiterIndex);
68169
+ }
68170
+ if (UUID_PATTERN.test(promptId)) {
68171
+ return promptId;
68172
+ }
68173
+ const parts = promptId.split("#");
68174
+ if (parts.length >= 3 && parts[0]) {
68175
+ return parts[0];
68176
+ }
68177
+ return void 0;
68178
+ }
68179
+ __name(sessionIdFromPromptId, "sessionIdFromPromptId");
68180
+ function contextForPromptId(promptId) {
68181
+ const trimmedPromptId = promptId?.trim();
68182
+ const sessionId = sessionIdFromPromptId(trimmedPromptId);
68183
+ if (!trimmedPromptId && !sessionId) {
68184
+ return null;
68185
+ }
68186
+ return {
68187
+ ...trimmedPromptId ? { promptId: trimmedPromptId } : {},
68188
+ ...sessionId ? { sessionId } : {}
68189
+ };
68190
+ }
68191
+ __name(contextForPromptId, "contextForPromptId");
68063
68192
  var OpenAILogger = class {
68064
68193
  static {
68065
68194
  __name(this, "OpenAILogger");
@@ -68074,18 +68203,7 @@ var OpenAILogger = class {
68074
68203
  * pass the project working directory from Config.getWorkingDir().
68075
68204
  */
68076
68205
  constructor(customLogDir, cwd) {
68077
- const baseCwd = cwd || process.cwd();
68078
- if (customLogDir) {
68079
- let resolvedPath = customLogDir;
68080
- if (customLogDir === "~" || customLogDir.startsWith("~/")) {
68081
- resolvedPath = path5.join(os2.homedir(), customLogDir.slice(1));
68082
- } else if (!path5.isAbsolute(customLogDir)) {
68083
- resolvedPath = path5.resolve(baseCwd, customLogDir);
68084
- }
68085
- this.logDir = path5.normalize(resolvedPath);
68086
- } else {
68087
- this.logDir = path5.join(baseCwd, "logs", "openai");
68088
- }
68206
+ this.logDir = resolveOpenAILogDir(customLogDir, cwd);
68089
68207
  }
68090
68208
  /**
68091
68209
  * Initialize the logger by creating the log directory if it doesn't exist
@@ -68126,6 +68244,7 @@ var OpenAILogger = class {
68126
68244
  message: error.message,
68127
68245
  stack: error.stack
68128
68246
  } : null,
68247
+ context: contextForPromptId(promptId),
68129
68248
  system: {
68130
68249
  hostname: os2.hostname(),
68131
68250
  platform: os2.platform(),
@@ -68774,6 +68893,17 @@ __name(addToolResultAttributes, "addToolResultAttributes");
68774
68893
 
68775
68894
  // packages/core/src/telemetry/session-tracing.ts
68776
68895
  var debugLogger8 = createDebugLogger("SESSION_TRACING");
68896
+ function resolveParentContext(parent) {
68897
+ if (parent) {
68898
+ return trace.setSpan(context.active(), parent.span);
68899
+ }
68900
+ const active = context.active();
68901
+ if (trace.getSpan(active)) {
68902
+ return active;
68903
+ }
68904
+ return getSessionContext() ?? active;
68905
+ }
68906
+ __name(resolveParentContext, "resolveParentContext");
68777
68907
  var NOOP_SPAN = trace.wrapSpanContext({
68778
68908
  traceId: "0".repeat(32),
68779
68909
  spanId: "0".repeat(16),
@@ -68787,26 +68917,55 @@ var interactionSequence = 0;
68787
68917
  var lastInteractionCtx;
68788
68918
  var cleanupIntervalStarted = false;
68789
68919
  var SPAN_TTL_MS = 30 * 60 * 1e3;
68790
- function ensureCleanupInterval() {
68791
- if (cleanupIntervalStarted) return;
68792
- cleanupIntervalStarted = true;
68793
- const interval = setInterval(() => {
68794
- const cutoff = Date.now() - SPAN_TTL_MS;
68795
- for (const [spanId, weakRef] of activeSpans) {
68796
- const ctx = weakRef.deref();
68797
- if (ctx === void 0) {
68798
- activeSpans.delete(spanId);
68799
- strongSpans.delete(spanId);
68800
- } else if (ctx.startTime < cutoff) {
68801
- if (!ctx.ended) {
68802
- ctx.ended = true;
68920
+ function sweepStaleSpans(now) {
68921
+ const cutoff = now - SPAN_TTL_MS;
68922
+ for (const [spanId, weakRef] of activeSpans) {
68923
+ const ctx = weakRef.deref();
68924
+ if (ctx === void 0) {
68925
+ activeSpans.delete(spanId);
68926
+ strongSpans.delete(spanId);
68927
+ } else if (ctx.startTime < cutoff) {
68928
+ if (!ctx.ended) {
68929
+ ctx.ended = true;
68930
+ const ageMs = now - ctx.startTime;
68931
+ const toolName = ctx.attributes["tool.name"];
68932
+ const callId = ctx.attributes["tool.call_id"];
68933
+ try {
68934
+ ctx.span.setAttributes({
68935
+ "qwen-code.span.ttl_expired": true,
68936
+ "qwen-code.span.duration_ms": ageMs,
68937
+ ...ctx.type === "tool.blocked_on_user" ? {
68938
+ decision: "aborted",
68939
+ source: "system"
68940
+ } : {}
68941
+ });
68942
+ } catch (error) {
68943
+ debugLogger8.warn(
68944
+ `Failed to stamp TTL attrs on stale span ${spanId}: ${error instanceof Error ? error.message : String(error)}`
68945
+ );
68946
+ }
68947
+ const ctxLabel = toolName && callId ? `${ctx.type} (tool.name=${toolName}, tool.call_id=${callId})` : ctx.type;
68948
+ debugLogger8.warn(
68949
+ `Stale ${ctxLabel} span ended by TTL safety net (age=${ageMs}ms, spanId=${spanId})`
68950
+ );
68951
+ try {
68803
68952
  ctx.span.end();
68953
+ } catch (error) {
68954
+ debugLogger8.warn(
68955
+ `Failed to end stale span ${spanId}: ${error instanceof Error ? error.message : String(error)}`
68956
+ );
68804
68957
  }
68805
- activeSpans.delete(spanId);
68806
- strongSpans.delete(spanId);
68807
68958
  }
68959
+ activeSpans.delete(spanId);
68960
+ strongSpans.delete(spanId);
68808
68961
  }
68809
- }, 6e4);
68962
+ }
68963
+ }
68964
+ __name(sweepStaleSpans, "sweepStaleSpans");
68965
+ function ensureCleanupInterval() {
68966
+ if (cleanupIntervalStarted) return;
68967
+ cleanupIntervalStarted = true;
68968
+ const interval = setInterval(() => sweepStaleSpans(Date.now()), 6e4);
68810
68969
  if (typeof interval.unref === "function") {
68811
68970
  interval.unref();
68812
68971
  }
@@ -68816,6 +68975,15 @@ function getSpanId(span) {
68816
68975
  return span.spanContext().spanId || "";
68817
68976
  }
68818
68977
  __name(getSpanId, "getSpanId");
68978
+ var SPAN_ERROR_MAX_CHARS = 1024;
68979
+ function truncateSpanError(s) {
68980
+ if (s.length <= SPAN_ERROR_MAX_CHARS) return s;
68981
+ let end = SPAN_ERROR_MAX_CHARS;
68982
+ const code = s.charCodeAt(end - 1);
68983
+ if (code >= 55296 && code <= 56319) end--;
68984
+ return s.slice(0, end) + "\u2026[truncated]";
68985
+ }
68986
+ __name(truncateSpanError, "truncateSpanError");
68819
68987
  function getTracer() {
68820
68988
  return trace.getTracer(SERVICE_NAME, "1.0.0");
68821
68989
  }
@@ -68879,11 +69047,15 @@ function startLLMRequestSpan(model, promptId) {
68879
69047
  return NOOP_SPAN;
68880
69048
  }
68881
69049
  const parentCtx = interactionContext.getStore();
68882
- const ctx = parentCtx ? trace.setSpan(context.active(), parentCtx.span) : getSessionContext() ?? context.active();
69050
+ const ctx = resolveParentContext(parentCtx);
68883
69051
  const attributes = {
68884
69052
  "qwen-code.model": model,
68885
69053
  "qwen-code.prompt_id": promptId,
68886
- "llm_request.context": parentCtx ? "interaction" : "standalone"
69054
+ "llm_request.context": parentCtx ? "interaction" : "standalone",
69055
+ // Dual-emit OTel GenAI semantic convention (Stable). Private name
69056
+ // (qwen-code.model) remains authoritative; gen_ai.* is a compat layer
69057
+ // for spec-aware backends. See docs/design/telemetry-llm-request-timing-design.md (D8).
69058
+ "gen_ai.request.model": model
68887
69059
  };
68888
69060
  const span = getTracer().startSpan(
68889
69061
  SPAN_LLM_REQUEST,
@@ -68911,12 +69083,44 @@ function endLLMRequestSpan(span, metadata) {
68911
69083
  const duration = metadata?.durationMs ?? Date.now() - spanCtx.startTime;
68912
69084
  const endAttributes = { duration_ms: duration };
68913
69085
  if (metadata) {
68914
- if (metadata.inputTokens !== void 0)
69086
+ if (metadata.inputTokens !== void 0) {
68915
69087
  endAttributes["input_tokens"] = metadata.inputTokens;
68916
- if (metadata.outputTokens !== void 0)
69088
+ endAttributes["gen_ai.usage.input_tokens"] = metadata.inputTokens;
69089
+ }
69090
+ if (metadata.outputTokens !== void 0) {
68917
69091
  endAttributes["output_tokens"] = metadata.outputTokens;
69092
+ endAttributes["gen_ai.usage.output_tokens"] = metadata.outputTokens;
69093
+ }
69094
+ if (metadata.cachedInputTokens !== void 0) {
69095
+ endAttributes["cached_input_tokens"] = metadata.cachedInputTokens;
69096
+ endAttributes["gen_ai.usage.cached_tokens"] = metadata.cachedInputTokens;
69097
+ }
69098
+ if (metadata.ttftMs !== void 0) {
69099
+ endAttributes["ttft_ms"] = metadata.ttftMs;
69100
+ endAttributes["gen_ai.server.time_to_first_token"] = metadata.ttftMs / 1e3;
69101
+ }
69102
+ if (metadata.requestSetupMs !== void 0) {
69103
+ endAttributes["request_setup_ms"] = metadata.requestSetupMs;
69104
+ }
69105
+ if (metadata.attempt !== void 0) {
69106
+ endAttributes["attempt"] = metadata.attempt;
69107
+ }
69108
+ if (metadata.retryTotalDelayMs !== void 0) {
69109
+ endAttributes["retry_total_delay_ms"] = metadata.retryTotalDelayMs;
69110
+ }
69111
+ if (metadata.ttftMs !== void 0) {
69112
+ const samplingMs = Math.max(
69113
+ 0,
69114
+ duration - metadata.ttftMs - (metadata.requestSetupMs ?? 0)
69115
+ );
69116
+ endAttributes["sampling_ms"] = samplingMs;
69117
+ if (samplingMs > 0 && metadata.outputTokens !== void 0) {
69118
+ endAttributes["output_tokens_per_second"] = Math.round(metadata.outputTokens / (samplingMs / 1e3) * 100) / 100;
69119
+ }
69120
+ }
68918
69121
  endAttributes["success"] = metadata.success;
68919
- if (metadata.error !== void 0) endAttributes["error"] = metadata.error;
69122
+ if (metadata.error !== void 0)
69123
+ endAttributes["error"] = truncateSpanError(metadata.error);
68920
69124
  }
68921
69125
  spanCtx.span.setAttributes(endAttributes);
68922
69126
  if (metadata === void 0 || metadata.success) {
@@ -68924,7 +69128,7 @@ function endLLMRequestSpan(span, metadata) {
68924
69128
  } else {
68925
69129
  spanCtx.span.setStatus({
68926
69130
  code: SpanStatusCode.ERROR,
68927
- message: metadata.error ?? "unknown error"
69131
+ message: metadata.error ? truncateSpanError(metadata.error) : "unknown error"
68928
69132
  });
68929
69133
  }
68930
69134
  } catch (error) {
@@ -68948,7 +69152,7 @@ function startToolSpan(toolName, attrs) {
68948
69152
  return NOOP_SPAN;
68949
69153
  }
68950
69154
  const parentCtx = interactionContext.getStore();
68951
- const ctx = parentCtx ? trace.setSpan(context.active(), parentCtx.span) : getSessionContext() ?? context.active();
69155
+ const ctx = resolveParentContext(parentCtx);
68952
69156
  const attributes = {
68953
69157
  "tool.name": toolName,
68954
69158
  ...attrs
@@ -68989,7 +69193,8 @@ function endToolSpan(span, metadata) {
68989
69193
  if (metadata) {
68990
69194
  if (metadata.success !== void 0)
68991
69195
  endAttributes["success"] = metadata.success;
68992
- if (metadata.error !== void 0) endAttributes["error"] = metadata.error;
69196
+ if (metadata.error !== void 0)
69197
+ endAttributes["error"] = truncateSpanError(metadata.error);
68993
69198
  }
68994
69199
  spanCtx.span.setAttributes(endAttributes);
68995
69200
  if (metadata) {
@@ -68998,7 +69203,7 @@ function endToolSpan(span, metadata) {
68998
69203
  } else {
68999
69204
  spanCtx.span.setStatus({
69000
69205
  code: SpanStatusCode.ERROR,
69001
- message: metadata.error ?? "tool error"
69206
+ message: metadata.error ? truncateSpanError(metadata.error) : "tool error"
69002
69207
  });
69003
69208
  }
69004
69209
  }
@@ -69028,7 +69233,7 @@ function startToolExecutionSpan() {
69028
69233
  "startToolExecutionSpan called outside runInToolSpanContext \u2014 span will not be parented to tool span"
69029
69234
  );
69030
69235
  }
69031
- const ctx = parentCtx ? trace.setSpan(context.active(), parentCtx.span) : getSessionContext() ?? context.active();
69236
+ const ctx = resolveParentContext(parentCtx);
69032
69237
  const span = getTracer().startSpan(
69033
69238
  SPAN_TOOL_EXECUTION,
69034
69239
  { kind: SpanKind.INTERNAL },
@@ -69057,16 +69262,17 @@ function endToolExecutionSpan(span, metadata) {
69057
69262
  if (metadata) {
69058
69263
  if (metadata.success !== void 0)
69059
69264
  endAttributes["success"] = metadata.success;
69060
- if (metadata.error !== void 0) endAttributes["error"] = metadata.error;
69265
+ if (metadata.error !== void 0)
69266
+ endAttributes["error"] = truncateSpanError(metadata.error);
69061
69267
  }
69062
69268
  spanCtx.span.setAttributes(endAttributes);
69063
- if (metadata) {
69269
+ if (metadata && !metadata.cancelled) {
69064
69270
  if (metadata.success !== false) {
69065
69271
  spanCtx.span.setStatus({ code: SpanStatusCode.OK });
69066
69272
  } else {
69067
69273
  spanCtx.span.setStatus({
69068
69274
  code: SpanStatusCode.ERROR,
69069
- message: metadata.error ?? "tool execution error"
69275
+ message: metadata.error ? truncateSpanError(metadata.error) : "tool execution error"
69070
69276
  });
69071
69277
  }
69072
69278
  }
@@ -69086,6 +69292,144 @@ function endToolExecutionSpan(span, metadata) {
69086
69292
  strongSpans.delete(spanId);
69087
69293
  }
69088
69294
  __name(endToolExecutionSpan, "endToolExecutionSpan");
69295
+ function startToolBlockedOnUserSpan(toolSpan, attrs) {
69296
+ if (!isTelemetrySdkInitialized()) {
69297
+ return NOOP_SPAN;
69298
+ }
69299
+ ensureCleanupInterval();
69300
+ const parentSpanId = getSpanId(toolSpan);
69301
+ const parentSpanCtx = activeSpans.get(parentSpanId)?.deref();
69302
+ if (!parentSpanCtx) {
69303
+ debugLogger8.debug(
69304
+ "startToolBlockedOnUserSpan: tool span not in activeSpans (already ended?) \u2014 using resolveParentContext fallback"
69305
+ );
69306
+ }
69307
+ const ctx = parentSpanCtx ? trace.setSpan(context.active(), parentSpanCtx.span) : resolveParentContext(void 0);
69308
+ const attributes = {};
69309
+ if (attrs?.tool_name !== void 0) attributes["tool.name"] = attrs.tool_name;
69310
+ if (attrs?.call_id !== void 0) attributes["tool.call_id"] = attrs.call_id;
69311
+ const span = getTracer().startSpan(
69312
+ SPAN_TOOL_BLOCKED_ON_USER,
69313
+ { kind: SpanKind.INTERNAL, attributes },
69314
+ ctx
69315
+ );
69316
+ const spanId = getSpanId(span);
69317
+ const spanContextObj = {
69318
+ span,
69319
+ startTime: Date.now(),
69320
+ attributes,
69321
+ type: "tool.blocked_on_user"
69322
+ };
69323
+ activeSpans.set(spanId, new WeakRef(spanContextObj));
69324
+ strongSpans.set(spanId, spanContextObj);
69325
+ return span;
69326
+ }
69327
+ __name(startToolBlockedOnUserSpan, "startToolBlockedOnUserSpan");
69328
+ function endToolBlockedOnUserSpan(span, metadata) {
69329
+ const spanId = getSpanId(span);
69330
+ const spanCtx = activeSpans.get(spanId)?.deref();
69331
+ if (!spanCtx || spanCtx.ended) return;
69332
+ spanCtx.ended = true;
69333
+ try {
69334
+ const duration = Date.now() - spanCtx.startTime;
69335
+ const endAttributes = { duration_ms: duration };
69336
+ if (metadata?.decision !== void 0)
69337
+ endAttributes["decision"] = metadata.decision;
69338
+ if (metadata?.source !== void 0)
69339
+ endAttributes["source"] = metadata.source;
69340
+ spanCtx.span.setAttributes(endAttributes);
69341
+ } catch (error) {
69342
+ debugLogger8.warn(
69343
+ `Failed to update blocked_on_user span attributes: ${error instanceof Error ? error.message : String(error)}`
69344
+ );
69345
+ }
69346
+ try {
69347
+ spanCtx.span.end();
69348
+ } catch (error) {
69349
+ debugLogger8.warn(
69350
+ `Failed to end blocked_on_user span: ${error instanceof Error ? error.message : String(error)}`
69351
+ );
69352
+ }
69353
+ activeSpans.delete(spanId);
69354
+ strongSpans.delete(spanId);
69355
+ }
69356
+ __name(endToolBlockedOnUserSpan, "endToolBlockedOnUserSpan");
69357
+ function startHookSpan(opts) {
69358
+ if (!isTelemetrySdkInitialized()) {
69359
+ return NOOP_SPAN;
69360
+ }
69361
+ ensureCleanupInterval();
69362
+ const parentCtx = toolContext.getStore() ?? interactionContext.getStore() ?? void 0;
69363
+ const ctx = resolveParentContext(parentCtx);
69364
+ const attributes = {
69365
+ hook_event: opts.hookEvent,
69366
+ "tool.name": opts.toolName
69367
+ };
69368
+ if (opts.toolUseId !== void 0) attributes["tool.use_id"] = opts.toolUseId;
69369
+ if (opts.isInterrupt !== void 0)
69370
+ attributes["is_interrupt"] = opts.isInterrupt;
69371
+ const span = getTracer().startSpan(
69372
+ SPAN_HOOK,
69373
+ { kind: SpanKind.INTERNAL, attributes },
69374
+ ctx
69375
+ );
69376
+ const spanId = getSpanId(span);
69377
+ const spanContextObj = {
69378
+ span,
69379
+ startTime: Date.now(),
69380
+ attributes,
69381
+ type: "hook"
69382
+ };
69383
+ activeSpans.set(spanId, new WeakRef(spanContextObj));
69384
+ strongSpans.set(spanId, spanContextObj);
69385
+ return span;
69386
+ }
69387
+ __name(startHookSpan, "startHookSpan");
69388
+ function endHookSpan(span, metadata) {
69389
+ const spanId = getSpanId(span);
69390
+ const spanCtx = activeSpans.get(spanId)?.deref();
69391
+ if (!spanCtx || spanCtx.ended) return;
69392
+ spanCtx.ended = true;
69393
+ try {
69394
+ const duration = Date.now() - spanCtx.startTime;
69395
+ const endAttributes = { duration_ms: duration };
69396
+ if (metadata) {
69397
+ if (metadata.success !== void 0)
69398
+ endAttributes["success"] = metadata.success;
69399
+ if (metadata.shouldProceed !== void 0)
69400
+ endAttributes["should_proceed"] = metadata.shouldProceed;
69401
+ if (metadata.shouldStop !== void 0)
69402
+ endAttributes["should_stop"] = metadata.shouldStop;
69403
+ if (metadata.blockType !== void 0)
69404
+ endAttributes["block_type"] = metadata.blockType;
69405
+ if (metadata.hasAdditionalContext !== void 0)
69406
+ endAttributes["has_additional_context"] = metadata.hasAdditionalContext;
69407
+ if (metadata.error !== void 0)
69408
+ endAttributes["error"] = truncateSpanError(metadata.error);
69409
+ }
69410
+ spanCtx.span.setAttributes(endAttributes);
69411
+ if (metadata?.error !== void 0) {
69412
+ spanCtx.span.setStatus({
69413
+ code: SpanStatusCode.ERROR,
69414
+ message: truncateSpanError(metadata.error)
69415
+ });
69416
+ }
69417
+ } catch (error) {
69418
+ debugLogger8.warn(
69419
+ `Failed to update hook span attributes/status: ${error instanceof Error ? error.message : String(error)}`
69420
+ );
69421
+ }
69422
+ try {
69423
+ spanCtx.span.end();
69424
+ } catch (error) {
69425
+ debugLogger8.warn(
69426
+ `Failed to end hook span: ${error instanceof Error ? error.message : String(error)}`
69427
+ );
69428
+ }
69429
+ activeSpans.delete(spanId);
69430
+ strongSpans.delete(spanId);
69431
+ }
69432
+ __name(endHookSpan, "endHookSpan");
69089
69433
  function getActiveInteractionSpan() {
69090
69434
  const ctx = interactionContext.getStore() ?? lastInteractionCtx;
69091
69435
  if (!ctx || ctx.ended) return void 0;
@@ -69173,11 +69517,33 @@ function initializeTelemetry(config) {
69173
69517
  return;
69174
69518
  }
69175
69519
  const debugLogger12 = createDebugLogger("OTEL");
69520
+ const userAttrs = config.getTelemetryResourceAttributes() ?? {};
69521
+ const userServiceName = userAttrs["service.name"];
69522
+ const {
69523
+ "service.name": _ignoredServiceName,
69524
+ "service.version": _ignoredServiceVersion,
69525
+ "session.id": _ignoredSessionId,
69526
+ ...nonReservedUserAttrs
69527
+ } = userAttrs;
69176
69528
  const resource = (0, import_resources2.resourceFromAttributes)({
69177
- [SemanticResourceAttributes.SERVICE_NAME]: SERVICE_NAME,
69178
- [SemanticResourceAttributes.SERVICE_VERSION]: config.getCliVersion() || "unknown",
69179
- "session.id": config.getSessionId()
69529
+ ...nonReservedUserAttrs,
69530
+ // `.trim() || SERVICE_NAME`: catches both empty string (`""`) and
69531
+ // whitespace-only values (`" "`, `"\t"`) that would otherwise produce
69532
+ // a blank service name on Resource (some backends reject these). Both
69533
+ // settings (no value trimming there) and env (`%20` decodes to `" "`)
69534
+ // can deliver whitespace-only values, so trim at the fallback point.
69535
+ [SemanticResourceAttributes.SERVICE_NAME]: userServiceName?.trim() || SERVICE_NAME,
69536
+ [SemanticResourceAttributes.SERVICE_VERSION]: config.getCliVersion() || "unknown"
69180
69537
  });
69538
+ const attrWarnings = config.getTelemetryResourceAttributeWarnings() ?? [];
69539
+ if (attrWarnings.length > 0) {
69540
+ console.warn(
69541
+ `[qwen-code telemetry] ${attrWarnings.length} resource attribute issue(s):`
69542
+ );
69543
+ for (const w of attrWarnings) {
69544
+ console.warn(` - ${w}`);
69545
+ }
69546
+ }
69181
69547
  const otlpEndpoint = config.getTelemetryOtlpEndpoint();
69182
69548
  const otlpProtocol = config.getTelemetryOtlpProtocol();
69183
69549
  const parsedEndpoint = parseOtlpEndpoint(otlpEndpoint, otlpProtocol);
@@ -69341,6 +69707,104 @@ __name(shutdownTelemetry, "shutdownTelemetry");
69341
69707
 
69342
69708
  // packages/core/src/telemetry/config.ts
69343
69709
  init_esbuild_shims();
69710
+
69711
+ // packages/core/src/telemetry/resource-attributes.ts
69712
+ init_esbuild_shims();
69713
+ init_esm();
69714
+ var RESERVED_RESOURCE_ATTRIBUTE_KEYS = /* @__PURE__ */ new Set([
69715
+ "service.version",
69716
+ "session.id"
69717
+ ]);
69718
+ function warn(msg, warnings) {
69719
+ diag.warn(msg);
69720
+ warnings?.push(msg);
69721
+ }
69722
+ __name(warn, "warn");
69723
+ function parseOtelResourceAttributes(raw, warnings) {
69724
+ if (!raw) return {};
69725
+ const out = {};
69726
+ for (const pair of raw.split(",")) {
69727
+ const trimmed = pair.trim();
69728
+ if (!trimmed) continue;
69729
+ const idx = trimmed.indexOf("=");
69730
+ if (idx < 0) {
69731
+ warn(
69732
+ `Skipping malformed OTEL_RESOURCE_ATTRIBUTES entry: "${trimmed}" (hint: percent-encode literal commas as %2C)`,
69733
+ warnings
69734
+ );
69735
+ continue;
69736
+ }
69737
+ const rawKey = trimmed.slice(0, idx).trim();
69738
+ if (!rawKey) continue;
69739
+ const valueRaw = trimmed.slice(idx + 1).trim();
69740
+ let key;
69741
+ try {
69742
+ key = decodeURIComponent(rawKey);
69743
+ } catch {
69744
+ warn(
69745
+ `Invalid percent-encoding in OTEL_RESOURCE_ATTRIBUTES key "${rawKey}", using raw key`,
69746
+ warnings
69747
+ );
69748
+ key = rawKey;
69749
+ }
69750
+ let value;
69751
+ try {
69752
+ value = decodeURIComponent(valueRaw);
69753
+ } catch {
69754
+ warn(
69755
+ `Invalid percent-encoding in OTEL_RESOURCE_ATTRIBUTES for key "${key}", using raw value`,
69756
+ warnings
69757
+ );
69758
+ value = valueRaw;
69759
+ }
69760
+ out[key] = value;
69761
+ }
69762
+ return out;
69763
+ }
69764
+ __name(parseOtelResourceAttributes, "parseOtelResourceAttributes");
69765
+ function stripReservedResourceAttributes(attrs, source, warnings) {
69766
+ for (const k of RESERVED_RESOURCE_ATTRIBUTE_KEYS) {
69767
+ if (k in attrs) {
69768
+ warn(`${source} cannot override reserved key "${k}"; ignoring`, warnings);
69769
+ delete attrs[k];
69770
+ }
69771
+ }
69772
+ return attrs;
69773
+ }
69774
+ __name(stripReservedResourceAttributes, "stripReservedResourceAttributes");
69775
+ function coerceStringResourceAttributes(raw, warnings) {
69776
+ if (raw === null || raw === void 0) return {};
69777
+ if (typeof raw !== "object" || Array.isArray(raw)) {
69778
+ warn(
69779
+ "settings.telemetry.resourceAttributes must be an object; ignoring",
69780
+ warnings
69781
+ );
69782
+ return {};
69783
+ }
69784
+ const out = {};
69785
+ for (const [k, v] of Object.entries(raw)) {
69786
+ const key = k.trim();
69787
+ if (!key) {
69788
+ warn(
69789
+ "settings.telemetry.resourceAttributes has an empty or whitespace-only key; ignoring",
69790
+ warnings
69791
+ );
69792
+ continue;
69793
+ }
69794
+ if (typeof v === "string") {
69795
+ out[key] = v;
69796
+ } else {
69797
+ warn(
69798
+ `settings.telemetry.resourceAttributes value for "${key}" must be a string (got ${typeof v}); ignoring`,
69799
+ warnings
69800
+ );
69801
+ }
69802
+ }
69803
+ return out;
69804
+ }
69805
+ __name(coerceStringResourceAttributes, "coerceStringResourceAttributes");
69806
+
69807
+ // packages/core/src/telemetry/config.ts
69344
69808
  function parseBooleanEnvFlag(value) {
69345
69809
  if (value === void 0) return void 0;
69346
69810
  return value === "true" || value === "1";
@@ -69391,6 +69855,33 @@ async function resolveTelemetrySettings(options) {
69391
69855
  const otlpTracesEndpoint = env["QWEN_TELEMETRY_OTLP_TRACES_ENDPOINT"] ?? env["OTEL_EXPORTER_OTLP_TRACES_ENDPOINT"] ?? settings.otlpTracesEndpoint;
69392
69856
  const otlpLogsEndpoint = env["QWEN_TELEMETRY_OTLP_LOGS_ENDPOINT"] ?? env["OTEL_EXPORTER_OTLP_LOGS_ENDPOINT"] ?? settings.otlpLogsEndpoint;
69393
69857
  const otlpMetricsEndpoint = env["QWEN_TELEMETRY_OTLP_METRICS_ENDPOINT"] ?? env["OTEL_EXPORTER_OTLP_METRICS_ENDPOINT"] ?? settings.otlpMetricsEndpoint;
69858
+ const resourceAttributeWarnings = [];
69859
+ const envResourceAttrs = stripReservedResourceAttributes(
69860
+ parseOtelResourceAttributes(
69861
+ env["OTEL_RESOURCE_ATTRIBUTES"],
69862
+ resourceAttributeWarnings
69863
+ ),
69864
+ "OTEL_RESOURCE_ATTRIBUTES",
69865
+ resourceAttributeWarnings
69866
+ );
69867
+ const settingsResourceAttrs = stripReservedResourceAttributes(
69868
+ coerceStringResourceAttributes(
69869
+ settings.resourceAttributes,
69870
+ resourceAttributeWarnings
69871
+ ),
69872
+ "settings.telemetry.resourceAttributes",
69873
+ resourceAttributeWarnings
69874
+ );
69875
+ const mergedResourceAttrs = {
69876
+ ...envResourceAttrs,
69877
+ ...settingsResourceAttrs
69878
+ };
69879
+ const otelServiceName = env["OTEL_SERVICE_NAME"]?.trim();
69880
+ if (otelServiceName) {
69881
+ mergedResourceAttrs["service.name"] = otelServiceName;
69882
+ }
69883
+ const resourceAttributes = Object.keys(mergedResourceAttrs).length ? mergedResourceAttrs : void 0;
69884
+ const metricsIncludeSessionId = parseBooleanEnvFlag(env["QWEN_TELEMETRY_METRICS_INCLUDE_SESSION_ID"]) ?? settings.metrics?.includeSessionId ?? false;
69394
69885
  return {
69395
69886
  enabled,
69396
69887
  target,
@@ -69401,7 +69892,10 @@ async function resolveTelemetrySettings(options) {
69401
69892
  otlpMetricsEndpoint,
69402
69893
  logPrompts,
69403
69894
  includeSensitiveSpanAttributes,
69404
- outfile
69895
+ outfile,
69896
+ resourceAttributes,
69897
+ metrics: { includeSessionId: metricsIncludeSessionId },
69898
+ resourceAttributeWarnings: resourceAttributeWarnings.length ? resourceAttributeWarnings : void 0
69405
69899
  };
69406
69900
  }
69407
69901
  __name(resolveTelemetrySettings, "resolveTelemetrySettings");
@@ -69604,6 +70098,26 @@ var TelemetryTarget = /* @__PURE__ */ ((TelemetryTarget2) => {
69604
70098
  var DEFAULT_TELEMETRY_TARGET = "local" /* LOCAL */;
69605
70099
  var DEFAULT_OTLP_ENDPOINT = "http://localhost:4317";
69606
70100
 
70101
+ // packages/core/src/core/loggingContentGenerator/streamContentDetection.ts
70102
+ init_esbuild_shims();
70103
+ function hasUserVisibleContent(chunk) {
70104
+ const parts = chunk.candidates?.[0]?.content?.parts;
70105
+ if (!parts || parts.length === 0) return false;
70106
+ return parts.some(isUserVisiblePart);
70107
+ }
70108
+ __name(hasUserVisibleContent, "hasUserVisibleContent");
70109
+ function isUserVisiblePart(part) {
70110
+ if (part === null || typeof part !== "object") return false;
70111
+ const p = part;
70112
+ if (typeof p.text === "string" && p.text.length > 0) return true;
70113
+ if (p.functionCall !== void 0) return true;
70114
+ if (p.inlineData !== void 0) return true;
70115
+ if (p.executableCode !== void 0) return true;
70116
+ if (p.thought === true) return true;
70117
+ return false;
70118
+ }
70119
+ __name(isUserVisiblePart, "isUserVisiblePart");
70120
+
69607
70121
  // packages/core/src/core/loggingContentGenerator/loggingContentGenerator.ts
69608
70122
  var debugLogger9 = createDebugLogger("LOGGING_CONTENT_GENERATOR");
69609
70123
  var MAX_RESPONSE_TEXT_LENGTH = 4096;
@@ -69614,6 +70128,7 @@ var LoggingContentGenerator = class {
69614
70128
  this.wrapped = wrapped;
69615
70129
  this.config = config;
69616
70130
  this.modalities = generatorConfig.modalities;
70131
+ this.generatorAuthType = generatorConfig.authType;
69617
70132
  if (generatorConfig.enableOpenAILogging) {
69618
70133
  this.openaiLogger = new OpenAILogger(
69619
70134
  generatorConfig.openAILoggingDir,
@@ -69628,6 +70143,7 @@ var LoggingContentGenerator = class {
69628
70143
  openaiLogger;
69629
70144
  schemaCompliance;
69630
70145
  modalities;
70146
+ generatorAuthType;
69631
70147
  getWrapped() {
69632
70148
  return this.wrapped;
69633
70149
  }
@@ -69651,7 +70167,7 @@ var LoggingContentGenerator = class {
69651
70167
  model,
69652
70168
  durationMs,
69653
70169
  prompt_id,
69654
- this.config.getAuthType(),
70170
+ this.generatorAuthType,
69655
70171
  usageMetadata,
69656
70172
  responseText,
69657
70173
  subagentNameContext.getStore()
@@ -69670,7 +70186,7 @@ var LoggingContentGenerator = class {
69670
70186
  model,
69671
70187
  durationMs,
69672
70188
  promptId: prompt_id,
69673
- authType: this.config.getAuthType(),
70189
+ authType: this.generatorAuthType,
69674
70190
  errorMessage,
69675
70191
  errorType,
69676
70192
  statusCode: errorStatus,
@@ -69710,6 +70226,10 @@ var LoggingContentGenerator = class {
69710
70226
  const isInternal = isInternalPromptId(userPromptId);
69711
70227
  const session = this.startCaptureSession();
69712
70228
  try {
70229
+ runtimeDiagnostics.recordGenerateContentRequest(req, {
70230
+ stream: false,
70231
+ source: "generateContent"
70232
+ });
69713
70233
  if (!isInternal) {
69714
70234
  addSystemPromptAttributes(
69715
70235
  this.config,
@@ -69762,6 +70282,7 @@ var LoggingContentGenerator = class {
69762
70282
  success: true,
69763
70283
  inputTokens: response.usageMetadata?.promptTokenCount,
69764
70284
  outputTokens: response.usageMetadata?.candidatesTokenCount,
70285
+ cachedInputTokens: response.usageMetadata?.cachedContentTokenCount,
69765
70286
  durationMs: Date.now() - startTime
69766
70287
  });
69767
70288
  return response;
@@ -69801,6 +70322,10 @@ var LoggingContentGenerator = class {
69801
70322
  const session = this.startCaptureSession();
69802
70323
  let stream;
69803
70324
  try {
70325
+ runtimeDiagnostics.recordGenerateContentRequest(req, {
70326
+ stream: true,
70327
+ source: "generateContentStream"
70328
+ });
69804
70329
  if (!isInternal) {
69805
70330
  addSystemPromptAttributes(
69806
70331
  this.config,
@@ -69889,6 +70414,7 @@ var LoggingContentGenerator = class {
69889
70414
  let firstModelVersion = "";
69890
70415
  let lastUsageMetadata;
69891
70416
  let errorOccurred = false;
70417
+ let ttftMs;
69892
70418
  let spanEndedByTimeout = false;
69893
70419
  const runInSpan = /* @__PURE__ */ __name((fn) => spanContext ? context.with(spanContext, fn) : fn(), "runInSpan");
69894
70420
  const STREAM_IDLE_TIMEOUT_MS = 5 * 6e4;
@@ -69925,6 +70451,9 @@ var LoggingContentGenerator = class {
69925
70451
  if (response.usageMetadata) {
69926
70452
  lastUsageMetadata = response.usageMetadata;
69927
70453
  }
70454
+ if (ttftMs === void 0 && hasUserVisibleContent(response)) {
70455
+ ttftMs = Date.now() - startTime;
70456
+ }
69928
70457
  resetSpanTimeout?.();
69929
70458
  yield response;
69930
70459
  }
@@ -69935,47 +70464,51 @@ var LoggingContentGenerator = class {
69935
70464
  const durationMs = Date.now() - startTime;
69936
70465
  const consolidatedResponse = shouldCollectResponses ? this.consolidateGeminiResponsesForLogging(responses) : void 0;
69937
70466
  const streamResponseText = isInternal ? void 0 : this.extractResponseText(consolidatedResponse);
69938
- runInSpan(
69939
- () => this.safelyLogApiResponse(
69940
- firstResponseId,
69941
- durationMs,
69942
- firstModelVersion || model,
69943
- userPromptId,
69944
- lastUsageMetadata,
69945
- streamResponseText
69946
- )
69947
- );
69948
- if (!isInternal && span) {
69949
- addModelOutputAttributes(this.config, span, streamResponseText);
70467
+ if (!spanEndedByTimeout) {
70468
+ runInSpan(
70469
+ () => this.safelyLogApiResponse(
70470
+ firstResponseId,
70471
+ durationMs,
70472
+ firstModelVersion || model,
70473
+ userPromptId,
70474
+ lastUsageMetadata,
70475
+ streamResponseText
70476
+ )
70477
+ );
70478
+ if (!isInternal && span) {
70479
+ addModelOutputAttributes(this.config, span, streamResponseText);
70480
+ }
70481
+ await runInSpan(
70482
+ () => this.safelyLogOpenAIInteraction(
70483
+ openaiRequest,
70484
+ consolidatedResponse,
70485
+ void 0,
70486
+ userPromptId
70487
+ )
70488
+ );
69950
70489
  }
69951
- await runInSpan(
69952
- () => this.safelyLogOpenAIInteraction(
69953
- openaiRequest,
69954
- consolidatedResponse,
69955
- void 0,
69956
- userPromptId
69957
- )
69958
- );
69959
70490
  } catch (error) {
69960
70491
  errorOccurred = true;
69961
- const durationMs = Date.now() - startTime;
69962
- runInSpan(
69963
- () => this.safelyLogApiError(
69964
- firstResponseId,
69965
- durationMs,
69966
- error,
69967
- firstModelVersion || model,
69968
- userPromptId
69969
- )
69970
- );
69971
- await runInSpan(
69972
- () => this.safelyLogOpenAIInteraction(
69973
- openaiRequest,
69974
- void 0,
69975
- error,
69976
- userPromptId
69977
- )
69978
- );
70492
+ if (!spanEndedByTimeout) {
70493
+ const durationMs = Date.now() - startTime;
70494
+ runInSpan(
70495
+ () => this.safelyLogApiError(
70496
+ firstResponseId,
70497
+ durationMs,
70498
+ error,
70499
+ firstModelVersion || model,
70500
+ userPromptId
70501
+ )
70502
+ );
70503
+ await runInSpan(
70504
+ () => this.safelyLogOpenAIInteraction(
70505
+ openaiRequest,
70506
+ void 0,
70507
+ error,
70508
+ userPromptId
70509
+ )
70510
+ );
70511
+ }
69979
70512
  throw error;
69980
70513
  } finally {
69981
70514
  if (spanEndTimeout !== void 0) {
@@ -69987,6 +70520,8 @@ var LoggingContentGenerator = class {
69987
70520
  success: !errorOccurred,
69988
70521
  inputTokens: lastUsageMetadata?.promptTokenCount,
69989
70522
  outputTokens: lastUsageMetadata?.candidatesTokenCount,
70523
+ cachedInputTokens: lastUsageMetadata?.cachedContentTokenCount,
70524
+ ttftMs,
69990
70525
  durationMs: Date.now() - startTime,
69991
70526
  error: errorOccurred ? aborted ? API_CALL_ABORTED_SPAN_STATUS_MESSAGE : API_CALL_FAILED_SPAN_STATUS_MESSAGE : void 0
69992
70527
  });
@@ -71675,11 +72210,11 @@ async function createContentGenerator(generatorConfig, config, isInitialAuth) {
71675
72210
  }
71676
72211
  let baseGenerator;
71677
72212
  if (authType === "openai" /* USE_OPENAI */) {
71678
- const { createOpenAIContentGenerator } = await import("./openaiContentGenerator-5NQG3W64.js");
72213
+ const { createOpenAIContentGenerator } = await import("./openaiContentGenerator-BSAWHGQJ.js");
71679
72214
  baseGenerator = createOpenAIContentGenerator(generatorConfig, config);
71680
72215
  } else if (authType === "qwen-oauth" /* QWEN_OAUTH */) {
71681
- const { getQwenOAuthClient: getQwenOauthClient } = await import("./qwenOAuth2-JE7H47TE.js");
71682
- const { QwenContentGenerator } = await import("./qwenContentGenerator-4DPUUS6R.js");
72216
+ const { getQwenOAuthClient: getQwenOauthClient } = await import("./qwenOAuth2-EEJGROP7.js");
72217
+ const { QwenContentGenerator } = await import("./qwenContentGenerator-47XRHQXM.js");
71683
72218
  try {
71684
72219
  const qwenClient = await getQwenOauthClient(
71685
72220
  config,
@@ -71696,10 +72231,10 @@ async function createContentGenerator(generatorConfig, config, isInitialAuth) {
71696
72231
  );
71697
72232
  }
71698
72233
  } else if (authType === "anthropic" /* USE_ANTHROPIC */) {
71699
- const { createAnthropicContentGenerator } = await import("./anthropicContentGenerator-ICBDZ6R2.js");
72234
+ const { createAnthropicContentGenerator } = await import("./anthropicContentGenerator-RQJNXJIY.js");
71700
72235
  baseGenerator = createAnthropicContentGenerator(generatorConfig, config);
71701
72236
  } else if (authType === "gemini" /* USE_GEMINI */ || authType === "vertex-ai" /* USE_VERTEX_AI */) {
71702
- const { createGeminiContentGenerator } = await import("./geminiContentGenerator-33RP4WKD.js");
72237
+ const { createGeminiContentGenerator } = await import("./geminiContentGenerator-E7Y6TCPU.js");
71703
72238
  baseGenerator = createGeminiContentGenerator(generatorConfig, config);
71704
72239
  } else {
71705
72240
  throw new Error(
@@ -73520,7 +74055,9 @@ var ReadFileToolInvocation = class extends BaseToolInvocation {
73520
74055
  }
73521
74056
  if (useFastPath && stats && isFullRead) {
73522
74057
  const status = cache.check(stats);
73523
- if (status.state === "fresh" && status.entry.lastReadAt !== void 0 && status.entry.lastReadWasFull && status.entry.lastReadCacheable && (status.entry.lastWriteAt === void 0 || status.entry.lastReadAt > status.entry.lastWriteAt)) {
74058
+ if (status.state === "fresh" && status.entry.lastReadAt !== void 0 && status.entry.lastReadWasFull && status.entry.lastReadCacheable && // Only quote-back if that read is still in history (issue
74059
+ // #4239: idle microcompaction flips this off when it blanks it).
74060
+ status.entry.readResidentInHistory && (status.entry.lastWriteAt === void 0 || status.entry.lastReadAt > status.entry.lastWriteAt)) {
73524
74061
  debugLogger11.debug("hit", { path: absPath });
73525
74062
  return this.unchangedResult(absPath);
73526
74063
  }
@@ -73552,7 +74089,7 @@ var ReadFileToolInvocation = class extends BaseToolInvocation {
73552
74089
  });
73553
74090
  }
73554
74091
  let llmContent;
73555
- if (result.isTruncated) {
74092
+ if (result.isTruncated && result.linesShown && result.originalLineCount !== void 0) {
73556
74093
  const [start, end] = result.linesShown;
73557
74094
  const total = result.originalLineCount;
73558
74095
  llmContent = `Showing lines ${start}-${end} of ${total} total lines.
@@ -73678,6 +74215,17 @@ var ReadFileTool = class _ReadFileTool extends BaseDeclarativeTool {
73678
74215
  if (params.limit !== void 0 && params.limit <= 0) {
73679
74216
  return "Limit must be a positive number";
73680
74217
  }
74218
+ if (params.pages !== void 0) {
74219
+ const pages = params.pages.trim();
74220
+ params.pages = pages.length > 0 ? pages : void 0;
74221
+ }
74222
+ const ext = path7.extname(filePath).toLowerCase();
74223
+ if ((params.offset !== void 0 || params.limit !== void 0) && ext === ".ipynb") {
74224
+ return "offset and limit are not supported for Jupyter notebook (.ipynb) files. Notebooks are always read in full with structured cell output.";
74225
+ }
74226
+ if (params.pages !== void 0 && ext === ".ipynb") {
74227
+ return "pages is not supported for Jupyter notebook (.ipynb) files. Notebooks are always read in full with structured cell output.";
74228
+ }
73681
74229
  if (params.pages) {
73682
74230
  const parsed = parsePDFPageRange(params.pages);
73683
74231
  if (!parsed) {
@@ -73711,6 +74259,7 @@ export {
73711
74259
  UiTelemetryService,
73712
74260
  uiTelemetryService,
73713
74261
  safeJsonStringify,
74262
+ require_safer,
73714
74263
  iconvEncode,
73715
74264
  iconvEncodingExists,
73716
74265
  isUtf8CompatibleEncoding,
@@ -73735,8 +74284,22 @@ export {
73735
74284
  getSystemEncoding,
73736
74285
  windowsCodePageToEncoding,
73737
74286
  detectEncodingFromBuffer,
74287
+ normalizeSource,
74288
+ parseNotebook,
74289
+ inferNotebookJsonFormat,
74290
+ serializeNotebook,
74291
+ getCellDisplayId,
74292
+ hasStableCellIds,
74293
+ isAmbiguousCellId,
74294
+ findCellIndex,
74295
+ getNotebookLanguage,
74296
+ makeCellId,
74297
+ inferInsertedCellSourceArrayStyle,
74298
+ toNotebookSource,
74299
+ normalizeEditedCell,
73738
74300
  DEFAULT_ENCODING,
73739
74301
  detectBOM,
74302
+ decodeBufferWithEncodingInfo,
73740
74303
  readFileWithEncodingInfo,
73741
74304
  readFileWithEncoding,
73742
74305
  countFileLines,
@@ -73790,6 +74353,7 @@ export {
73790
74353
  addModelOutputAttributes,
73791
74354
  addToolInputAttributes,
73792
74355
  addToolResultAttributes,
74356
+ truncateSpanError,
73793
74357
  startInteractionSpan,
73794
74358
  endInteractionSpan,
73795
74359
  startLLMRequestSpan,
@@ -73799,6 +74363,10 @@ export {
73799
74363
  endToolSpan,
73800
74364
  startToolExecutionSpan,
73801
74365
  endToolExecutionSpan,
74366
+ startToolBlockedOnUserSpan,
74367
+ endToolBlockedOnUserSpan,
74368
+ startHookSpan,
74369
+ endHookSpan,
73802
74370
  getActiveInteractionSpan,
73803
74371
  isTelemetrySdkInitialized,
73804
74372
  initializeTelemetry,
@@ -73900,6 +74468,7 @@ export {
73900
74468
  TaggedThinkingParser,
73901
74469
  OpenAIContentConverter,
73902
74470
  openaiRequestCaptureContext,
74471
+ resolveOpenAILogDir,
73903
74472
  OpenAILogger,
73904
74473
  openaiLogger,
73905
74474
  parseBooleanEnvFlag,
@@ -73908,6 +74477,7 @@ export {
73908
74477
  TelemetryTarget,
73909
74478
  DEFAULT_TELEMETRY_TARGET,
73910
74479
  DEFAULT_OTLP_ENDPOINT,
74480
+ defaultModalities,
73911
74481
  MODEL_GENERATION_CONFIG_FIELDS,
73912
74482
  AUTH_ENV_MAPPINGS,
73913
74483
  DEFAULT_MODELS,