@qwen-code/qwen-code 0.15.12-preview.3 → 0.16.0-nightly.20260522.48b0a8bfc

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (94) hide show
  1. package/bundled/qc-helper/docs/configuration/settings.md +59 -61
  2. package/bundled/qc-helper/docs/features/_meta.ts +2 -0
  3. package/bundled/qc-helper/docs/features/approval-mode.md +119 -2
  4. package/bundled/qc-helper/docs/features/auto-mode.md +263 -0
  5. package/bundled/qc-helper/docs/features/commands.md +11 -10
  6. package/bundled/qc-helper/docs/features/skills.md +3 -0
  7. package/bundled/qc-helper/docs/features/structured-output.md +309 -0
  8. package/bundled/qc-helper/docs/features/sub-agents.md +47 -5
  9. package/bundled/qc-helper/docs/qwen-serve.md +134 -10
  10. package/bundled/review/SKILL.md +12 -3
  11. package/chunks/{agent-LIAWUWAO.js → agent-GRCSD6XI.js} +15 -17
  12. package/chunks/{anthropicContentGenerator-4QE6LTVV.js → anthropicContentGenerator-RQJNXJIY.js} +7 -4
  13. package/chunks/{askUserQuestion-QFSCBTUO.js → askUserQuestion-PQPMPNM3.js} +2 -2
  14. package/chunks/{ca-S3XJMT6P.js → ca-UZ7BANMN.js} +3 -3
  15. package/chunks/{chunk-B7ZL7HUA.js → chunk-4AOCVI6J.js} +2 -1
  16. package/chunks/{chunk-XLQ4E5PS.js → chunk-4U3O4VDA.js} +800 -142
  17. package/chunks/{chunk-AEJ2DKLP.js → chunk-C6WMLUNB.js} +1 -1
  18. package/chunks/{chunk-GC5RXNL2.js → chunk-C7PY32RJ.js} +115 -23
  19. package/chunks/{chunk-JMZQICAL.js → chunk-CAVZVZX6.js} +2 -2
  20. package/chunks/{chunk-CAWKL3UC.js → chunk-CSWBPY3P.js} +2 -2
  21. package/chunks/{chunk-G27O2LD2.js → chunk-D5NTAHYL.js} +1 -1
  22. package/chunks/{chunk-BXNCPI75.js → chunk-DMIMF3CG.js} +2 -2
  23. package/chunks/{chunk-OCC4MZRS.js → chunk-F23NCRJ2.js} +1 -1
  24. package/chunks/{chunk-5QQ5FGTU.js → chunk-G7YTSRES.js} +1 -1
  25. package/chunks/{chunk-SQNQIOD5.js → chunk-GGNTZ2NH.js} +92 -21
  26. package/chunks/{chunk-FKVKVE6N.js → chunk-KXZ4TJB4.js} +1 -1
  27. package/chunks/{chunk-CBVB66WY.js → chunk-L5E26RN6.js} +2 -2
  28. package/chunks/{chunk-UXW7MYAW.js → chunk-MAY32HXD.js} +376 -1
  29. package/chunks/{chunk-AJSOD5IR.js → chunk-OZO6R4KI.js} +9167 -3624
  30. package/chunks/{chunk-CM2IESUE.js → chunk-PR4T27R7.js} +1 -1
  31. package/chunks/{chunk-FYMSCRHM.js → chunk-PVVL5Q3W.js} +32 -1
  32. package/chunks/{chunk-AOJ3BBY7.js → chunk-TM4RMEYN.js} +17 -349
  33. package/chunks/{chunk-YHEAJFCI.js → chunk-USE2VQ5P.js} +3 -0
  34. package/chunks/chunk-UY2AYRZF.js +19126 -0
  35. package/chunks/{chunk-GJXIKCKL.js → chunk-XP27SJMH.js} +76 -5
  36. package/chunks/chunk-XTYIPAUG.js +379 -0
  37. package/chunks/{chunk-TPGOGCWM.js → chunk-YJLGXDQJ.js} +1 -1
  38. package/chunks/{contextCommand-SVLAZMQL.js → contextCommand-O2OLCMOG.js} +17 -19
  39. package/chunks/{cron-create-WUTD5ZTH.js → cron-create-IGYXQVG4.js} +28 -2
  40. package/chunks/{cron-delete-N3UQYCRA.js → cron-delete-ETKIZCWT.js} +2 -2
  41. package/chunks/{cron-list-Z6RJJ4YH.js → cron-list-BVCUSWRU.js} +2 -2
  42. package/chunks/{de-MNR4SMAI.js → de-V4IE2OOZ.js} +3 -3
  43. package/chunks/{dist-RRYNPBOE.js → dist-4L54HRX2.js} +2 -2
  44. package/chunks/{dist-WP4AH3VK.js → dist-BXDUQ2QY.js} +1 -1
  45. package/chunks/{dist-M6GFCZ7S.js → dist-MN2PDDPR.js} +1 -1
  46. package/chunks/{edit-VNAZBIZR.js → edit-NRL5ZYWP.js} +28 -18
  47. package/chunks/{en-NRN4QBAT.js → en-HGJ2SPLM.js} +5 -3
  48. package/chunks/{enter-worktree-FOF5YZIV.js → enter-worktree-TLT6EXVN.js} +41 -17
  49. package/chunks/{exit-worktree-Y6QVAO3C.js → exit-worktree-PE7RZMLE.js} +41 -17
  50. package/chunks/{exitPlanMode-QZKO7GH7.js → exitPlanMode-JYMKAHYD.js} +15 -17
  51. package/chunks/{fr-OFJFHLCR.js → fr-CJULI7ZX.js} +3 -3
  52. package/chunks/{geminiContentGenerator-DYHZPKJX.js → geminiContentGenerator-GYIOVT4A.js} +3 -3
  53. package/chunks/{glob-G7XATELV.js → glob-T7KIVIWT.js} +15 -17
  54. package/chunks/{grep-4SETMY47.js → grep-4KI7ZJR5.js} +15 -17
  55. package/chunks/{ja-V6OQ6VL7.js → ja-L7CHRQEW.js} +3 -3
  56. package/chunks/{keychain-token-storage-DMFP5IJM.js → keychain-token-storage-335UOLJ6.js} +2 -2
  57. package/chunks/{ls-SUILOZZB.js → ls-7HD6XG3V.js} +3 -3
  58. package/chunks/{lsp-6TQBWVMZ.js → lsp-ZZSFCIWD.js} +2 -2
  59. package/chunks/{monitor-JTLJBJ7H.js → monitor-L5YPPGVO.js} +27 -17
  60. package/chunks/notebook-edit-HYXLIC3D.js +756 -0
  61. package/chunks/{openaiContentGenerator-3H7XOZBW.js → openaiContentGenerator-XRP5JM6P.js} +12 -11
  62. package/chunks/{pt-ZLE6SA4A.js → pt-M6JULLEQ.js} +3 -3
  63. package/chunks/{qwenContentGenerator-FAU3QPYO.js → qwenContentGenerator-EOX3HZXX.js} +17 -19
  64. package/chunks/{qwenOAuth2-JSQ7EPR3.js → qwenOAuth2-EEJGROP7.js} +9 -3
  65. package/chunks/{read-file-WWUQVNCZ.js → read-file-3XOYPTIB.js} +7 -8
  66. package/chunks/{ripGrep-WCOAIWL6.js → ripGrep-5QUURWGU.js} +15 -17
  67. package/chunks/{ru-A4OHIUNN.js → ru-QILM4HBC.js} +3 -3
  68. package/chunks/{send-message-Q2JRAC3J.js → send-message-ULK4MQXJ.js} +23 -2
  69. package/chunks/{serve-VJEEEXA6.js → serve-AZ44ZNWF.js} +8500 -1663
  70. package/chunks/{shell-IAOKGIJ6.js → shell-O6OTTSIP.js} +15 -17
  71. package/chunks/{skill-NHW6222K.js → skill-MUGS3H4M.js} +23 -10
  72. package/chunks/{src-OWV5HVQQ.js → src-YCQBAYCP.js} +213 -19
  73. package/chunks/{syntheticOutput-S4DRGMQM.js → syntheticOutput-IS2X5OZ2.js} +3 -3
  74. package/chunks/{task-stop-7THHVAQS.js → task-stop-7QSJGSSP.js} +2 -2
  75. package/chunks/{todoWrite-WKUGUTPX.js → todoWrite-7CVACFUX.js} +3 -3
  76. package/chunks/{tool-search-MSJ6SXLI.js → tool-search-UFDQJOXT.js} +7 -8
  77. package/chunks/{web-fetch-OZE6ZQUF.js → web-fetch-ENQ2I5JA.js} +7 -4
  78. package/chunks/{write-file-RKCENFZ5.js → write-file-GBLDDYQT.js} +25 -18
  79. package/chunks/{zh-RN3JULHO.js → zh-PWL2NKY3.js} +5 -3
  80. package/chunks/{zh-TW-XZEHEV5S.js → zh-TW-S3YGWICZ.js} +5 -3
  81. package/cli.js +58094 -75935
  82. package/locales/ca.js +4 -5
  83. package/locales/de.js +4 -5
  84. package/locales/en.js +8 -5
  85. package/locales/fr.js +4 -5
  86. package/locales/ja.js +4 -5
  87. package/locales/pt.js +4 -5
  88. package/locales/ru.js +4 -5
  89. package/locales/zh-TW.js +6 -4
  90. package/locales/zh.js +6 -4
  91. package/package.json +2 -2
  92. package/chunks/chunk-5P5XGNYH.js +0 -93
  93. package/chunks/chunk-SYCJMSIJ.js +0 -82
  94. package/chunks/chunk-Y6Z2O3WR.js +0 -33
@@ -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";
@@ -12,30 +9,31 @@ import {
12
9
  } from "./chunk-OFEVLU4C.js";
13
10
  import {
14
11
  isAutoMemPath
15
- } from "./chunk-CM2IESUE.js";
12
+ } from "./chunk-PR4T27R7.js";
16
13
  import {
17
14
  DEFAULT_OPENAI_BASE_URL,
18
15
  convertSchema,
19
16
  normalize,
17
+ runtimeDiagnostics,
20
18
  safeJsonParse,
21
19
  tokenLimit
22
- } from "./chunk-UXW7MYAW.js";
20
+ } from "./chunk-MAY32HXD.js";
23
21
  import {
24
22
  InstallationManager
25
- } from "./chunk-G27O2LD2.js";
23
+ } from "./chunk-D5NTAHYL.js";
26
24
  import {
27
25
  FinishReason,
28
26
  GenerateContentResponse
29
27
  } from "./chunk-T4VD6OJ4.js";
30
28
  import {
31
29
  STRUCTURED_OUTPUT_REDACTED_ARGS
32
- } from "./chunk-TPGOGCWM.js";
30
+ } from "./chunk-YJLGXDQJ.js";
33
31
  import {
34
32
  BaseDeclarativeTool,
35
33
  BaseToolInvocation,
36
34
  ToolDisplayNames,
37
35
  ToolNames
38
- } from "./chunk-FYMSCRHM.js";
36
+ } from "./chunk-PVVL5Q3W.js";
39
37
  import {
40
38
  FatalConfigError,
41
39
  Storage,
@@ -51,7 +49,7 @@ import {
51
49
  setSessionContext,
52
50
  shortenPath,
53
51
  unescapePath
54
- } from "./chunk-GJXIKCKL.js";
52
+ } from "./chunk-XP27SJMH.js";
55
53
  import {
56
54
  require_dist
57
55
  } from "./chunk-ZERZSAZL.js";
@@ -87,6 +85,75 @@ import {
87
85
  __toESM
88
86
  } from "./chunk-J2S4EL5Y.js";
89
87
 
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
+
90
157
  // packages/core/node_modules/iconv-lite/lib/bom-handling.js
91
158
  var require_bom_handling = __commonJS({
92
159
  "packages/core/node_modules/iconv-lite/lib/bom-handling.js"(exports2) {
@@ -63532,6 +63599,147 @@ function normalizeSource(source) {
63532
63599
  return Array.isArray(source) ? source.join("") : source;
63533
63600
  }
63534
63601
  __name(normalizeSource, "normalizeSource");
63602
+ function parseNotebook(content) {
63603
+ const jsonContent = content.charCodeAt(0) === 65279 ? content.slice(1) : content;
63604
+ const parsed = JSON.parse(jsonContent);
63605
+ if (!parsed || typeof parsed !== "object") {
63606
+ throw new Error("Invalid notebook: expected a JSON object");
63607
+ }
63608
+ const notebook = parsed;
63609
+ if (!Array.isArray(notebook.cells)) {
63610
+ throw new Error("Invalid notebook: missing cells array");
63611
+ }
63612
+ for (let i = 0; i < notebook.cells.length; i++) {
63613
+ const cell = notebook.cells[i];
63614
+ if (!cell || typeof cell !== "object" || Array.isArray(cell)) {
63615
+ throw new Error(`Invalid notebook: cell at index ${i} is not an object`);
63616
+ }
63617
+ }
63618
+ return notebook;
63619
+ }
63620
+ __name(parseNotebook, "parseNotebook");
63621
+ function inferNotebookJsonFormat(content) {
63622
+ const lineMatch = content.match(/\n([ \t]+)"/);
63623
+ const indent = lineMatch?.[1];
63624
+ let inferredIndent;
63625
+ if (indent !== void 0) {
63626
+ inferredIndent = /^ +$/.test(indent) ? indent.length : indent;
63627
+ }
63628
+ return {
63629
+ indent: inferredIndent,
63630
+ trailingNewline: content.endsWith("\n")
63631
+ };
63632
+ }
63633
+ __name(inferNotebookJsonFormat, "inferNotebookJsonFormat");
63634
+ function serializeNotebook(notebook, format = { indent: 1, trailingNewline: true }) {
63635
+ const serialized = JSON.stringify(notebook, null, format.indent);
63636
+ return format.trailingNewline ? `${serialized}
63637
+ ` : serialized;
63638
+ }
63639
+ __name(serializeNotebook, "serializeNotebook");
63640
+ function getCellDisplayId(cell, index) {
63641
+ return typeof cell.id === "string" && cell.id.length > 0 ? cell.id : `cell-${index}`;
63642
+ }
63643
+ __name(getCellDisplayId, "getCellDisplayId");
63644
+ function hasStableCellIds(notebook) {
63645
+ return notebook.cells.every(
63646
+ (cell) => typeof cell.id === "string" && cell.id.length > 0
63647
+ );
63648
+ }
63649
+ __name(hasStableCellIds, "hasStableCellIds");
63650
+ function findCellIndexesByDisplayId(notebook, cellId) {
63651
+ const indexes = [];
63652
+ notebook.cells.forEach((cell, index) => {
63653
+ if (getCellDisplayId(cell, index) === cellId) {
63654
+ indexes.push(index);
63655
+ }
63656
+ });
63657
+ return indexes;
63658
+ }
63659
+ __name(findCellIndexesByDisplayId, "findCellIndexesByDisplayId");
63660
+ function isAmbiguousCellId(notebook, cellId) {
63661
+ return findCellIndexesByDisplayId(notebook, cellId).length > 1;
63662
+ }
63663
+ __name(isAmbiguousCellId, "isAmbiguousCellId");
63664
+ function findCellIndex(notebook, cellId) {
63665
+ const indexes = findCellIndexesByDisplayId(notebook, cellId);
63666
+ return indexes.length === 1 ? indexes[0] : -1;
63667
+ }
63668
+ __name(findCellIndex, "findCellIndex");
63669
+ function getNotebookLanguage(notebook) {
63670
+ return notebook.metadata?.language_info?.name ?? notebook.metadata?.kernelspec?.language ?? "python";
63671
+ }
63672
+ __name(getNotebookLanguage, "getNotebookLanguage");
63673
+ function shouldGenerateCellIds(notebook) {
63674
+ return (notebook.nbformat ?? 0) > 4 || (notebook.nbformat ?? 0) === 4 && (notebook.nbformat_minor ?? 0) >= 5;
63675
+ }
63676
+ __name(shouldGenerateCellIds, "shouldGenerateCellIds");
63677
+ function makeCellId(notebook) {
63678
+ if (!shouldGenerateCellIds(notebook)) {
63679
+ return void 0;
63680
+ }
63681
+ const existingDisplayIds = new Set(
63682
+ notebook.cells.map((cell, index) => getCellDisplayId(cell, index))
63683
+ );
63684
+ let fallbackIndex = 1;
63685
+ let fallback = `qwen-cell-${fallbackIndex}`;
63686
+ while (existingDisplayIds.has(fallback)) {
63687
+ fallbackIndex++;
63688
+ fallback = `qwen-cell-${fallbackIndex}`;
63689
+ }
63690
+ return fallback;
63691
+ }
63692
+ __name(makeCellId, "makeCellId");
63693
+ function inferNotebookSourceArrayStyle(notebook) {
63694
+ const sourceCell = notebook.cells.find((cell) => cell.source !== void 0);
63695
+ return sourceCell ? Array.isArray(sourceCell.source) : true;
63696
+ }
63697
+ __name(inferNotebookSourceArrayStyle, "inferNotebookSourceArrayStyle");
63698
+ function inferInsertedCellSourceArrayStyle(notebook, insertAt) {
63699
+ const previousCell = notebook.cells[insertAt - 1];
63700
+ if (previousCell?.source !== void 0) {
63701
+ return Array.isArray(previousCell.source);
63702
+ }
63703
+ const nextCell = notebook.cells[insertAt];
63704
+ if (nextCell?.source !== void 0) {
63705
+ return Array.isArray(nextCell.source);
63706
+ }
63707
+ return inferNotebookSourceArrayStyle(notebook);
63708
+ }
63709
+ __name(inferInsertedCellSourceArrayStyle, "inferInsertedCellSourceArrayStyle");
63710
+ function toNotebookSource(source, preferArray) {
63711
+ if (!preferArray) {
63712
+ return source;
63713
+ }
63714
+ if (source.length === 0) {
63715
+ return [];
63716
+ }
63717
+ const lines = [];
63718
+ let start = 0;
63719
+ for (let i = 0; i < source.length; i++) {
63720
+ if (source[i] === "\n") {
63721
+ lines.push(source.slice(start, i + 1));
63722
+ start = i + 1;
63723
+ }
63724
+ }
63725
+ if (start < source.length) {
63726
+ lines.push(source.slice(start));
63727
+ }
63728
+ return lines;
63729
+ }
63730
+ __name(toNotebookSource, "toNotebookSource");
63731
+ function normalizeEditedCell(cell, finalType) {
63732
+ cell.cell_type = finalType;
63733
+ cell.metadata ??= {};
63734
+ if (finalType === "code") {
63735
+ cell.execution_count = null;
63736
+ cell.outputs = [];
63737
+ return;
63738
+ }
63739
+ delete cell.execution_count;
63740
+ delete cell.outputs;
63741
+ }
63742
+ __name(normalizeEditedCell, "normalizeEditedCell");
63535
63743
  function processOutputText(text) {
63536
63744
  if (!text) return "";
63537
63745
  return Array.isArray(text) ? text.join("") : text;
@@ -63567,7 +63775,7 @@ function processOutput(output) {
63567
63775
  }
63568
63776
  __name(processOutput, "processOutput");
63569
63777
  function processCell(cell, index, language) {
63570
- const cellId = cell.id ?? `cell-${index}`;
63778
+ const cellId = getCellDisplayId(cell, index);
63571
63779
  const source = normalizeSource(cell.source);
63572
63780
  const parts = [];
63573
63781
  switch (cell.cell_type) {
@@ -63607,20 +63815,22 @@ function processCell(cell, index, language) {
63607
63815
  return parts.join("\n");
63608
63816
  }
63609
63817
  __name(processCell, "processCell");
63610
- async function readNotebook(filePath) {
63818
+ async function readNotebookWithMetadata(filePath) {
63611
63819
  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";
63820
+ const notebook = parseNotebook(raw);
63821
+ const language = getNotebookLanguage(notebook);
63614
63822
  if (!notebook.cells || notebook.cells.length === 0) {
63615
- return "(empty notebook)";
63823
+ return { content: "(empty notebook)", isTruncated: false };
63616
63824
  }
63617
63825
  const header = `Jupyter Notebook (${language}, ${notebook.cells.length} cells)`;
63618
63826
  const cellTexts = [];
63619
63827
  let totalLength = header.length;
63828
+ let isTruncated = false;
63620
63829
  for (let i = 0; i < notebook.cells.length; i++) {
63621
63830
  const cellText = processCell(notebook.cells[i], i, language);
63622
63831
  totalLength += cellText.length + 2;
63623
63832
  if (totalLength > MAX_NOTEBOOK_OUTPUT_CHARS) {
63833
+ isTruncated = true;
63624
63834
  cellTexts.push(
63625
63835
  `... [${notebook.cells.length - i} remaining cells truncated, total ${notebook.cells.length} cells. Use shell to inspect: cat <path> | jq '.cells[${i}:]']`
63626
63836
  );
@@ -63628,11 +63838,14 @@ async function readNotebook(filePath) {
63628
63838
  }
63629
63839
  cellTexts.push(cellText);
63630
63840
  }
63631
- return `${header}
63841
+ return {
63842
+ content: `${header}
63632
63843
 
63633
- ${cellTexts.join("\n\n")}`;
63844
+ ${cellTexts.join("\n\n")}`,
63845
+ isTruncated
63846
+ };
63634
63847
  }
63635
- __name(readNotebook, "readNotebook");
63848
+ __name(readNotebookWithMetadata, "readNotebookWithMetadata");
63636
63849
 
63637
63850
  // packages/core/src/utils/fileUtils.ts
63638
63851
  var debugLogger2 = createDebugLogger("FILE_UTILS");
@@ -63694,6 +63907,42 @@ function isValidUtf8(buffer) {
63694
63907
  }
63695
63908
  }
63696
63909
  __name(isValidUtf8, "isValidUtf8");
63910
+ function decodeBufferWithEncodingInfo(full) {
63911
+ if (full.length === 0) {
63912
+ return { content: "", encoding: "utf-8", bom: false };
63913
+ }
63914
+ const bomInfo = detectBOM(full);
63915
+ if (bomInfo) {
63916
+ return {
63917
+ content: decodeBOMBuffer(full, bomInfo),
63918
+ encoding: bomEncodingToName(bomInfo.encoding),
63919
+ // Mark bom: true for all Unicode BOM variants (UTF-8/16/32) so that
63920
+ // the BOM is re-written on save and the file's original format is preserved.
63921
+ bom: true
63922
+ };
63923
+ }
63924
+ if (isValidUtf8(full)) {
63925
+ return { content: full.toString("utf8"), encoding: "utf-8", bom: false };
63926
+ }
63927
+ const detected = detectEncodingFromBuffer(full);
63928
+ if (detected && !isUtf8CompatibleEncoding(detected)) {
63929
+ try {
63930
+ if (iconvEncodingExists(detected)) {
63931
+ return {
63932
+ content: iconvDecode(full, detected),
63933
+ encoding: detected,
63934
+ bom: false
63935
+ };
63936
+ }
63937
+ } catch (e) {
63938
+ debugLogger2.warn(
63939
+ `Failed to decode buffer as ${detected}: ${e instanceof Error ? e.message : String(e)}`
63940
+ );
63941
+ }
63942
+ }
63943
+ return { content: full.toString("utf8"), encoding: "utf-8", bom: false };
63944
+ }
63945
+ __name(decodeBufferWithEncodingInfo, "decodeBufferWithEncodingInfo");
63697
63946
  function decodeBOMBuffer(buf, bomInfo) {
63698
63947
  const content = buf.subarray(bomInfo.bomLength);
63699
63948
  switch (bomInfo.encoding) {
@@ -63731,37 +63980,7 @@ function bomEncodingToName(bomEncoding) {
63731
63980
  __name(bomEncodingToName, "bomEncodingToName");
63732
63981
  async function readFileWithEncodingInfo(filePath) {
63733
63982
  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 };
63983
+ return decodeBufferWithEncodingInfo(full);
63765
63984
  }
63766
63985
  __name(readFileWithEncodingInfo, "readFileWithEncodingInfo");
63767
63986
  async function readFileWithEncoding(filePath) {
@@ -64341,10 +64560,12 @@ async function processSingleFileContent(filePath, config, offset, limit, pages)
64341
64560
  }
64342
64561
  case "notebook": {
64343
64562
  try {
64344
- const content = await readNotebook(filePath);
64563
+ const { content, isTruncated } = await readNotebookWithMetadata(filePath);
64345
64564
  return {
64346
64565
  llmContent: content,
64347
- returnDisplay: `Read notebook: ${relativePathForDisplay}`
64566
+ returnDisplay: `Read notebook: ${relativePathForDisplay}`,
64567
+ isTruncated,
64568
+ stats
64348
64569
  };
64349
64570
  } catch (e) {
64350
64571
  const msg = e instanceof Error ? e.message : String(e);
@@ -64434,6 +64655,8 @@ var SPAN_INTERACTION = "qwen-code.interaction";
64434
64655
  var SPAN_LLM_REQUEST = "qwen-code.llm_request";
64435
64656
  var SPAN_TOOL = "qwen-code.tool";
64436
64657
  var SPAN_TOOL_EXECUTION = "qwen-code.tool.execution";
64658
+ var SPAN_TOOL_BLOCKED_ON_USER = "qwen-code.tool.blocked_on_user";
64659
+ var SPAN_HOOK = "qwen-code.hook";
64437
64660
 
64438
64661
  // packages/core/src/telemetry/metrics.ts
64439
64662
  var TOOL_CALL_COUNT = `${SERVICE_NAME}.tool.call.count`;
@@ -64472,9 +64695,19 @@ var MEMORY_DREAM_DURATION = `${SERVICE_NAME}.memory.dream.duration`;
64472
64695
  var MEMORY_RECALL_COUNT = `${SERVICE_NAME}.memory.recall.count`;
64473
64696
  var MEMORY_RECALL_DURATION = `${SERVICE_NAME}.memory.recall.duration`;
64474
64697
  var baseMetricDefinition = {
64475
- getCommonAttributes: /* @__PURE__ */ __name((config) => ({
64476
- "session.id": config.getSessionId()
64477
- }), "getCommonAttributes")
64698
+ // session.id on metrics is opt-in: each session is a new value, so
64699
+ // attaching it by default would create unbounded time-series fan-out on
64700
+ // every metric backend. Operators who need session-level metric slicing
64701
+ // can enable QWEN_TELEMETRY_METRICS_INCLUDE_SESSION_ID or
64702
+ // telemetry.metrics.includeSessionId. Spans and logs always carry
64703
+ // session.id for trace/log correlation.
64704
+ getCommonAttributes: /* @__PURE__ */ __name((config) => {
64705
+ const out = {};
64706
+ if (config.getTelemetryMetricsIncludeSessionId()) {
64707
+ out["session.id"] = config.getSessionId();
64708
+ }
64709
+ return out;
64710
+ }, "getCommonAttributes")
64478
64711
  };
64479
64712
  var COUNTER_DEFINITIONS = {
64480
64713
  [TOOL_CALL_COUNT]: {
@@ -68036,6 +68269,22 @@ var v4_default = v4;
68036
68269
  // packages/core/src/utils/openaiLogger.ts
68037
68270
  import * as os2 from "os";
68038
68271
  var debugLogger6 = createDebugLogger("OPENAI_LOGGER");
68272
+ var MAIN_SESSION_PROMPT_ID_DELIMITER = "########";
68273
+ 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;
68274
+ function resolveOpenAILogDir(customLogDir, cwd) {
68275
+ const baseCwd = cwd || process.cwd();
68276
+ if (!customLogDir) {
68277
+ return path5.join(baseCwd, "logs", "openai");
68278
+ }
68279
+ let resolvedPath = customLogDir;
68280
+ if (customLogDir === "~" || customLogDir.startsWith("~/")) {
68281
+ resolvedPath = path5.join(os2.homedir(), customLogDir.slice(1));
68282
+ } else if (!path5.isAbsolute(customLogDir)) {
68283
+ resolvedPath = path5.resolve(baseCwd, customLogDir);
68284
+ }
68285
+ return path5.normalize(resolvedPath);
68286
+ }
68287
+ __name(resolveOpenAILogDir, "resolveOpenAILogDir");
68039
68288
  function sanitizeDiagnosticSuffix(suffix) {
68040
68289
  if (!suffix) return void 0;
68041
68290
  const sanitized = suffix.replace(/[^a-zA-Z0-9._-]+/g, "-").replace(/^-+|-+$/g, "");
@@ -68060,6 +68309,36 @@ function promptIdSuffixForFilename(promptId) {
68060
68309
  return sanitizeDiagnosticSuffix(extractSubagentSuffix(promptId));
68061
68310
  }
68062
68311
  __name(promptIdSuffixForFilename, "promptIdSuffixForFilename");
68312
+ function sessionIdFromPromptId(promptId) {
68313
+ if (!promptId) return void 0;
68314
+ const mainSessionDelimiterIndex = promptId.indexOf(
68315
+ MAIN_SESSION_PROMPT_ID_DELIMITER
68316
+ );
68317
+ if (mainSessionDelimiterIndex > 0) {
68318
+ return promptId.slice(0, mainSessionDelimiterIndex);
68319
+ }
68320
+ if (UUID_PATTERN.test(promptId)) {
68321
+ return promptId;
68322
+ }
68323
+ const parts = promptId.split("#");
68324
+ if (parts.length >= 3 && parts[0]) {
68325
+ return parts[0];
68326
+ }
68327
+ return void 0;
68328
+ }
68329
+ __name(sessionIdFromPromptId, "sessionIdFromPromptId");
68330
+ function contextForPromptId(promptId) {
68331
+ const trimmedPromptId = promptId?.trim();
68332
+ const sessionId = sessionIdFromPromptId(trimmedPromptId);
68333
+ if (!trimmedPromptId && !sessionId) {
68334
+ return null;
68335
+ }
68336
+ return {
68337
+ ...trimmedPromptId ? { promptId: trimmedPromptId } : {},
68338
+ ...sessionId ? { sessionId } : {}
68339
+ };
68340
+ }
68341
+ __name(contextForPromptId, "contextForPromptId");
68063
68342
  var OpenAILogger = class {
68064
68343
  static {
68065
68344
  __name(this, "OpenAILogger");
@@ -68074,18 +68353,7 @@ var OpenAILogger = class {
68074
68353
  * pass the project working directory from Config.getWorkingDir().
68075
68354
  */
68076
68355
  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
- }
68356
+ this.logDir = resolveOpenAILogDir(customLogDir, cwd);
68089
68357
  }
68090
68358
  /**
68091
68359
  * Initialize the logger by creating the log directory if it doesn't exist
@@ -68126,6 +68394,7 @@ var OpenAILogger = class {
68126
68394
  message: error.message,
68127
68395
  stack: error.stack
68128
68396
  } : null,
68397
+ context: contextForPromptId(promptId),
68129
68398
  system: {
68130
68399
  hostname: os2.hostname(),
68131
68400
  platform: os2.platform(),
@@ -68774,6 +69043,17 @@ __name(addToolResultAttributes, "addToolResultAttributes");
68774
69043
 
68775
69044
  // packages/core/src/telemetry/session-tracing.ts
68776
69045
  var debugLogger8 = createDebugLogger("SESSION_TRACING");
69046
+ function resolveParentContext(parent) {
69047
+ if (parent) {
69048
+ return trace.setSpan(context.active(), parent.span);
69049
+ }
69050
+ const active = context.active();
69051
+ if (trace.getSpan(active)) {
69052
+ return active;
69053
+ }
69054
+ return getSessionContext() ?? active;
69055
+ }
69056
+ __name(resolveParentContext, "resolveParentContext");
68777
69057
  var NOOP_SPAN = trace.wrapSpanContext({
68778
69058
  traceId: "0".repeat(32),
68779
69059
  spanId: "0".repeat(16),
@@ -68787,26 +69067,55 @@ var interactionSequence = 0;
68787
69067
  var lastInteractionCtx;
68788
69068
  var cleanupIntervalStarted = false;
68789
69069
  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;
69070
+ function sweepStaleSpans(now) {
69071
+ const cutoff = now - SPAN_TTL_MS;
69072
+ for (const [spanId, weakRef] of activeSpans) {
69073
+ const ctx = weakRef.deref();
69074
+ if (ctx === void 0) {
69075
+ activeSpans.delete(spanId);
69076
+ strongSpans.delete(spanId);
69077
+ } else if (ctx.startTime < cutoff) {
69078
+ if (!ctx.ended) {
69079
+ ctx.ended = true;
69080
+ const ageMs = now - ctx.startTime;
69081
+ const toolName = ctx.attributes["tool.name"];
69082
+ const callId = ctx.attributes["tool.call_id"];
69083
+ try {
69084
+ ctx.span.setAttributes({
69085
+ "qwen-code.span.ttl_expired": true,
69086
+ "qwen-code.span.duration_ms": ageMs,
69087
+ ...ctx.type === "tool.blocked_on_user" ? {
69088
+ decision: "aborted",
69089
+ source: "system"
69090
+ } : {}
69091
+ });
69092
+ } catch (error) {
69093
+ debugLogger8.warn(
69094
+ `Failed to stamp TTL attrs on stale span ${spanId}: ${error instanceof Error ? error.message : String(error)}`
69095
+ );
69096
+ }
69097
+ const ctxLabel = toolName && callId ? `${ctx.type} (tool.name=${toolName}, tool.call_id=${callId})` : ctx.type;
69098
+ debugLogger8.warn(
69099
+ `Stale ${ctxLabel} span ended by TTL safety net (age=${ageMs}ms, spanId=${spanId})`
69100
+ );
69101
+ try {
68803
69102
  ctx.span.end();
69103
+ } catch (error) {
69104
+ debugLogger8.warn(
69105
+ `Failed to end stale span ${spanId}: ${error instanceof Error ? error.message : String(error)}`
69106
+ );
68804
69107
  }
68805
- activeSpans.delete(spanId);
68806
- strongSpans.delete(spanId);
68807
69108
  }
69109
+ activeSpans.delete(spanId);
69110
+ strongSpans.delete(spanId);
68808
69111
  }
68809
- }, 6e4);
69112
+ }
69113
+ }
69114
+ __name(sweepStaleSpans, "sweepStaleSpans");
69115
+ function ensureCleanupInterval() {
69116
+ if (cleanupIntervalStarted) return;
69117
+ cleanupIntervalStarted = true;
69118
+ const interval = setInterval(() => sweepStaleSpans(Date.now()), 6e4);
68810
69119
  if (typeof interval.unref === "function") {
68811
69120
  interval.unref();
68812
69121
  }
@@ -68816,6 +69125,15 @@ function getSpanId(span) {
68816
69125
  return span.spanContext().spanId || "";
68817
69126
  }
68818
69127
  __name(getSpanId, "getSpanId");
69128
+ var SPAN_ERROR_MAX_CHARS = 1024;
69129
+ function truncateSpanError(s) {
69130
+ if (s.length <= SPAN_ERROR_MAX_CHARS) return s;
69131
+ let end = SPAN_ERROR_MAX_CHARS;
69132
+ const code = s.charCodeAt(end - 1);
69133
+ if (code >= 55296 && code <= 56319) end--;
69134
+ return s.slice(0, end) + "\u2026[truncated]";
69135
+ }
69136
+ __name(truncateSpanError, "truncateSpanError");
68819
69137
  function getTracer() {
68820
69138
  return trace.getTracer(SERVICE_NAME, "1.0.0");
68821
69139
  }
@@ -68879,7 +69197,7 @@ function startLLMRequestSpan(model, promptId) {
68879
69197
  return NOOP_SPAN;
68880
69198
  }
68881
69199
  const parentCtx = interactionContext.getStore();
68882
- const ctx = parentCtx ? trace.setSpan(context.active(), parentCtx.span) : getSessionContext() ?? context.active();
69200
+ const ctx = resolveParentContext(parentCtx);
68883
69201
  const attributes = {
68884
69202
  "qwen-code.model": model,
68885
69203
  "qwen-code.prompt_id": promptId,
@@ -68916,7 +69234,8 @@ function endLLMRequestSpan(span, metadata) {
68916
69234
  if (metadata.outputTokens !== void 0)
68917
69235
  endAttributes["output_tokens"] = metadata.outputTokens;
68918
69236
  endAttributes["success"] = metadata.success;
68919
- if (metadata.error !== void 0) endAttributes["error"] = metadata.error;
69237
+ if (metadata.error !== void 0)
69238
+ endAttributes["error"] = truncateSpanError(metadata.error);
68920
69239
  }
68921
69240
  spanCtx.span.setAttributes(endAttributes);
68922
69241
  if (metadata === void 0 || metadata.success) {
@@ -68924,7 +69243,7 @@ function endLLMRequestSpan(span, metadata) {
68924
69243
  } else {
68925
69244
  spanCtx.span.setStatus({
68926
69245
  code: SpanStatusCode.ERROR,
68927
- message: metadata.error ?? "unknown error"
69246
+ message: metadata.error ? truncateSpanError(metadata.error) : "unknown error"
68928
69247
  });
68929
69248
  }
68930
69249
  } catch (error) {
@@ -68948,7 +69267,7 @@ function startToolSpan(toolName, attrs) {
68948
69267
  return NOOP_SPAN;
68949
69268
  }
68950
69269
  const parentCtx = interactionContext.getStore();
68951
- const ctx = parentCtx ? trace.setSpan(context.active(), parentCtx.span) : getSessionContext() ?? context.active();
69270
+ const ctx = resolveParentContext(parentCtx);
68952
69271
  const attributes = {
68953
69272
  "tool.name": toolName,
68954
69273
  ...attrs
@@ -68989,7 +69308,8 @@ function endToolSpan(span, metadata) {
68989
69308
  if (metadata) {
68990
69309
  if (metadata.success !== void 0)
68991
69310
  endAttributes["success"] = metadata.success;
68992
- if (metadata.error !== void 0) endAttributes["error"] = metadata.error;
69311
+ if (metadata.error !== void 0)
69312
+ endAttributes["error"] = truncateSpanError(metadata.error);
68993
69313
  }
68994
69314
  spanCtx.span.setAttributes(endAttributes);
68995
69315
  if (metadata) {
@@ -68998,7 +69318,7 @@ function endToolSpan(span, metadata) {
68998
69318
  } else {
68999
69319
  spanCtx.span.setStatus({
69000
69320
  code: SpanStatusCode.ERROR,
69001
- message: metadata.error ?? "tool error"
69321
+ message: metadata.error ? truncateSpanError(metadata.error) : "tool error"
69002
69322
  });
69003
69323
  }
69004
69324
  }
@@ -69028,7 +69348,7 @@ function startToolExecutionSpan() {
69028
69348
  "startToolExecutionSpan called outside runInToolSpanContext \u2014 span will not be parented to tool span"
69029
69349
  );
69030
69350
  }
69031
- const ctx = parentCtx ? trace.setSpan(context.active(), parentCtx.span) : getSessionContext() ?? context.active();
69351
+ const ctx = resolveParentContext(parentCtx);
69032
69352
  const span = getTracer().startSpan(
69033
69353
  SPAN_TOOL_EXECUTION,
69034
69354
  { kind: SpanKind.INTERNAL },
@@ -69057,16 +69377,17 @@ function endToolExecutionSpan(span, metadata) {
69057
69377
  if (metadata) {
69058
69378
  if (metadata.success !== void 0)
69059
69379
  endAttributes["success"] = metadata.success;
69060
- if (metadata.error !== void 0) endAttributes["error"] = metadata.error;
69380
+ if (metadata.error !== void 0)
69381
+ endAttributes["error"] = truncateSpanError(metadata.error);
69061
69382
  }
69062
69383
  spanCtx.span.setAttributes(endAttributes);
69063
- if (metadata) {
69384
+ if (metadata && !metadata.cancelled) {
69064
69385
  if (metadata.success !== false) {
69065
69386
  spanCtx.span.setStatus({ code: SpanStatusCode.OK });
69066
69387
  } else {
69067
69388
  spanCtx.span.setStatus({
69068
69389
  code: SpanStatusCode.ERROR,
69069
- message: metadata.error ?? "tool execution error"
69390
+ message: metadata.error ? truncateSpanError(metadata.error) : "tool execution error"
69070
69391
  });
69071
69392
  }
69072
69393
  }
@@ -69086,6 +69407,144 @@ function endToolExecutionSpan(span, metadata) {
69086
69407
  strongSpans.delete(spanId);
69087
69408
  }
69088
69409
  __name(endToolExecutionSpan, "endToolExecutionSpan");
69410
+ function startToolBlockedOnUserSpan(toolSpan, attrs) {
69411
+ if (!isTelemetrySdkInitialized()) {
69412
+ return NOOP_SPAN;
69413
+ }
69414
+ ensureCleanupInterval();
69415
+ const parentSpanId = getSpanId(toolSpan);
69416
+ const parentSpanCtx = activeSpans.get(parentSpanId)?.deref();
69417
+ if (!parentSpanCtx) {
69418
+ debugLogger8.debug(
69419
+ "startToolBlockedOnUserSpan: tool span not in activeSpans (already ended?) \u2014 using resolveParentContext fallback"
69420
+ );
69421
+ }
69422
+ const ctx = parentSpanCtx ? trace.setSpan(context.active(), parentSpanCtx.span) : resolveParentContext(void 0);
69423
+ const attributes = {};
69424
+ if (attrs?.tool_name !== void 0) attributes["tool.name"] = attrs.tool_name;
69425
+ if (attrs?.call_id !== void 0) attributes["tool.call_id"] = attrs.call_id;
69426
+ const span = getTracer().startSpan(
69427
+ SPAN_TOOL_BLOCKED_ON_USER,
69428
+ { kind: SpanKind.INTERNAL, attributes },
69429
+ ctx
69430
+ );
69431
+ const spanId = getSpanId(span);
69432
+ const spanContextObj = {
69433
+ span,
69434
+ startTime: Date.now(),
69435
+ attributes,
69436
+ type: "tool.blocked_on_user"
69437
+ };
69438
+ activeSpans.set(spanId, new WeakRef(spanContextObj));
69439
+ strongSpans.set(spanId, spanContextObj);
69440
+ return span;
69441
+ }
69442
+ __name(startToolBlockedOnUserSpan, "startToolBlockedOnUserSpan");
69443
+ function endToolBlockedOnUserSpan(span, metadata) {
69444
+ const spanId = getSpanId(span);
69445
+ const spanCtx = activeSpans.get(spanId)?.deref();
69446
+ if (!spanCtx || spanCtx.ended) return;
69447
+ spanCtx.ended = true;
69448
+ try {
69449
+ const duration = Date.now() - spanCtx.startTime;
69450
+ const endAttributes = { duration_ms: duration };
69451
+ if (metadata?.decision !== void 0)
69452
+ endAttributes["decision"] = metadata.decision;
69453
+ if (metadata?.source !== void 0)
69454
+ endAttributes["source"] = metadata.source;
69455
+ spanCtx.span.setAttributes(endAttributes);
69456
+ } catch (error) {
69457
+ debugLogger8.warn(
69458
+ `Failed to update blocked_on_user span attributes: ${error instanceof Error ? error.message : String(error)}`
69459
+ );
69460
+ }
69461
+ try {
69462
+ spanCtx.span.end();
69463
+ } catch (error) {
69464
+ debugLogger8.warn(
69465
+ `Failed to end blocked_on_user span: ${error instanceof Error ? error.message : String(error)}`
69466
+ );
69467
+ }
69468
+ activeSpans.delete(spanId);
69469
+ strongSpans.delete(spanId);
69470
+ }
69471
+ __name(endToolBlockedOnUserSpan, "endToolBlockedOnUserSpan");
69472
+ function startHookSpan(opts) {
69473
+ if (!isTelemetrySdkInitialized()) {
69474
+ return NOOP_SPAN;
69475
+ }
69476
+ ensureCleanupInterval();
69477
+ const parentCtx = toolContext.getStore() ?? interactionContext.getStore() ?? void 0;
69478
+ const ctx = resolveParentContext(parentCtx);
69479
+ const attributes = {
69480
+ hook_event: opts.hookEvent,
69481
+ "tool.name": opts.toolName
69482
+ };
69483
+ if (opts.toolUseId !== void 0) attributes["tool.use_id"] = opts.toolUseId;
69484
+ if (opts.isInterrupt !== void 0)
69485
+ attributes["is_interrupt"] = opts.isInterrupt;
69486
+ const span = getTracer().startSpan(
69487
+ SPAN_HOOK,
69488
+ { kind: SpanKind.INTERNAL, attributes },
69489
+ ctx
69490
+ );
69491
+ const spanId = getSpanId(span);
69492
+ const spanContextObj = {
69493
+ span,
69494
+ startTime: Date.now(),
69495
+ attributes,
69496
+ type: "hook"
69497
+ };
69498
+ activeSpans.set(spanId, new WeakRef(spanContextObj));
69499
+ strongSpans.set(spanId, spanContextObj);
69500
+ return span;
69501
+ }
69502
+ __name(startHookSpan, "startHookSpan");
69503
+ function endHookSpan(span, metadata) {
69504
+ const spanId = getSpanId(span);
69505
+ const spanCtx = activeSpans.get(spanId)?.deref();
69506
+ if (!spanCtx || spanCtx.ended) return;
69507
+ spanCtx.ended = true;
69508
+ try {
69509
+ const duration = Date.now() - spanCtx.startTime;
69510
+ const endAttributes = { duration_ms: duration };
69511
+ if (metadata) {
69512
+ if (metadata.success !== void 0)
69513
+ endAttributes["success"] = metadata.success;
69514
+ if (metadata.shouldProceed !== void 0)
69515
+ endAttributes["should_proceed"] = metadata.shouldProceed;
69516
+ if (metadata.shouldStop !== void 0)
69517
+ endAttributes["should_stop"] = metadata.shouldStop;
69518
+ if (metadata.blockType !== void 0)
69519
+ endAttributes["block_type"] = metadata.blockType;
69520
+ if (metadata.hasAdditionalContext !== void 0)
69521
+ endAttributes["has_additional_context"] = metadata.hasAdditionalContext;
69522
+ if (metadata.error !== void 0)
69523
+ endAttributes["error"] = truncateSpanError(metadata.error);
69524
+ }
69525
+ spanCtx.span.setAttributes(endAttributes);
69526
+ if (metadata?.error !== void 0) {
69527
+ spanCtx.span.setStatus({
69528
+ code: SpanStatusCode.ERROR,
69529
+ message: truncateSpanError(metadata.error)
69530
+ });
69531
+ }
69532
+ } catch (error) {
69533
+ debugLogger8.warn(
69534
+ `Failed to update hook span attributes/status: ${error instanceof Error ? error.message : String(error)}`
69535
+ );
69536
+ }
69537
+ try {
69538
+ spanCtx.span.end();
69539
+ } catch (error) {
69540
+ debugLogger8.warn(
69541
+ `Failed to end hook span: ${error instanceof Error ? error.message : String(error)}`
69542
+ );
69543
+ }
69544
+ activeSpans.delete(spanId);
69545
+ strongSpans.delete(spanId);
69546
+ }
69547
+ __name(endHookSpan, "endHookSpan");
69089
69548
  function getActiveInteractionSpan() {
69090
69549
  const ctx = interactionContext.getStore() ?? lastInteractionCtx;
69091
69550
  if (!ctx || ctx.ended) return void 0;
@@ -69173,11 +69632,33 @@ function initializeTelemetry(config) {
69173
69632
  return;
69174
69633
  }
69175
69634
  const debugLogger12 = createDebugLogger("OTEL");
69635
+ const userAttrs = config.getTelemetryResourceAttributes() ?? {};
69636
+ const userServiceName = userAttrs["service.name"];
69637
+ const {
69638
+ "service.name": _ignoredServiceName,
69639
+ "service.version": _ignoredServiceVersion,
69640
+ "session.id": _ignoredSessionId,
69641
+ ...nonReservedUserAttrs
69642
+ } = userAttrs;
69176
69643
  const resource = (0, import_resources2.resourceFromAttributes)({
69177
- [SemanticResourceAttributes.SERVICE_NAME]: SERVICE_NAME,
69178
- [SemanticResourceAttributes.SERVICE_VERSION]: config.getCliVersion() || "unknown",
69179
- "session.id": config.getSessionId()
69644
+ ...nonReservedUserAttrs,
69645
+ // `.trim() || SERVICE_NAME`: catches both empty string (`""`) and
69646
+ // whitespace-only values (`" "`, `"\t"`) that would otherwise produce
69647
+ // a blank service name on Resource (some backends reject these). Both
69648
+ // settings (no value trimming there) and env (`%20` decodes to `" "`)
69649
+ // can deliver whitespace-only values, so trim at the fallback point.
69650
+ [SemanticResourceAttributes.SERVICE_NAME]: userServiceName?.trim() || SERVICE_NAME,
69651
+ [SemanticResourceAttributes.SERVICE_VERSION]: config.getCliVersion() || "unknown"
69180
69652
  });
69653
+ const attrWarnings = config.getTelemetryResourceAttributeWarnings() ?? [];
69654
+ if (attrWarnings.length > 0) {
69655
+ console.warn(
69656
+ `[qwen-code telemetry] ${attrWarnings.length} resource attribute issue(s):`
69657
+ );
69658
+ for (const w of attrWarnings) {
69659
+ console.warn(` - ${w}`);
69660
+ }
69661
+ }
69181
69662
  const otlpEndpoint = config.getTelemetryOtlpEndpoint();
69182
69663
  const otlpProtocol = config.getTelemetryOtlpProtocol();
69183
69664
  const parsedEndpoint = parseOtlpEndpoint(otlpEndpoint, otlpProtocol);
@@ -69341,6 +69822,104 @@ __name(shutdownTelemetry, "shutdownTelemetry");
69341
69822
 
69342
69823
  // packages/core/src/telemetry/config.ts
69343
69824
  init_esbuild_shims();
69825
+
69826
+ // packages/core/src/telemetry/resource-attributes.ts
69827
+ init_esbuild_shims();
69828
+ init_esm();
69829
+ var RESERVED_RESOURCE_ATTRIBUTE_KEYS = /* @__PURE__ */ new Set([
69830
+ "service.version",
69831
+ "session.id"
69832
+ ]);
69833
+ function warn(msg, warnings) {
69834
+ diag.warn(msg);
69835
+ warnings?.push(msg);
69836
+ }
69837
+ __name(warn, "warn");
69838
+ function parseOtelResourceAttributes(raw, warnings) {
69839
+ if (!raw) return {};
69840
+ const out = {};
69841
+ for (const pair of raw.split(",")) {
69842
+ const trimmed = pair.trim();
69843
+ if (!trimmed) continue;
69844
+ const idx = trimmed.indexOf("=");
69845
+ if (idx < 0) {
69846
+ warn(
69847
+ `Skipping malformed OTEL_RESOURCE_ATTRIBUTES entry: "${trimmed}" (hint: percent-encode literal commas as %2C)`,
69848
+ warnings
69849
+ );
69850
+ continue;
69851
+ }
69852
+ const rawKey = trimmed.slice(0, idx).trim();
69853
+ if (!rawKey) continue;
69854
+ const valueRaw = trimmed.slice(idx + 1).trim();
69855
+ let key;
69856
+ try {
69857
+ key = decodeURIComponent(rawKey);
69858
+ } catch {
69859
+ warn(
69860
+ `Invalid percent-encoding in OTEL_RESOURCE_ATTRIBUTES key "${rawKey}", using raw key`,
69861
+ warnings
69862
+ );
69863
+ key = rawKey;
69864
+ }
69865
+ let value;
69866
+ try {
69867
+ value = decodeURIComponent(valueRaw);
69868
+ } catch {
69869
+ warn(
69870
+ `Invalid percent-encoding in OTEL_RESOURCE_ATTRIBUTES for key "${key}", using raw value`,
69871
+ warnings
69872
+ );
69873
+ value = valueRaw;
69874
+ }
69875
+ out[key] = value;
69876
+ }
69877
+ return out;
69878
+ }
69879
+ __name(parseOtelResourceAttributes, "parseOtelResourceAttributes");
69880
+ function stripReservedResourceAttributes(attrs, source, warnings) {
69881
+ for (const k of RESERVED_RESOURCE_ATTRIBUTE_KEYS) {
69882
+ if (k in attrs) {
69883
+ warn(`${source} cannot override reserved key "${k}"; ignoring`, warnings);
69884
+ delete attrs[k];
69885
+ }
69886
+ }
69887
+ return attrs;
69888
+ }
69889
+ __name(stripReservedResourceAttributes, "stripReservedResourceAttributes");
69890
+ function coerceStringResourceAttributes(raw, warnings) {
69891
+ if (raw === null || raw === void 0) return {};
69892
+ if (typeof raw !== "object" || Array.isArray(raw)) {
69893
+ warn(
69894
+ "settings.telemetry.resourceAttributes must be an object; ignoring",
69895
+ warnings
69896
+ );
69897
+ return {};
69898
+ }
69899
+ const out = {};
69900
+ for (const [k, v] of Object.entries(raw)) {
69901
+ const key = k.trim();
69902
+ if (!key) {
69903
+ warn(
69904
+ "settings.telemetry.resourceAttributes has an empty or whitespace-only key; ignoring",
69905
+ warnings
69906
+ );
69907
+ continue;
69908
+ }
69909
+ if (typeof v === "string") {
69910
+ out[key] = v;
69911
+ } else {
69912
+ warn(
69913
+ `settings.telemetry.resourceAttributes value for "${key}" must be a string (got ${typeof v}); ignoring`,
69914
+ warnings
69915
+ );
69916
+ }
69917
+ }
69918
+ return out;
69919
+ }
69920
+ __name(coerceStringResourceAttributes, "coerceStringResourceAttributes");
69921
+
69922
+ // packages/core/src/telemetry/config.ts
69344
69923
  function parseBooleanEnvFlag(value) {
69345
69924
  if (value === void 0) return void 0;
69346
69925
  return value === "true" || value === "1";
@@ -69391,6 +69970,33 @@ async function resolveTelemetrySettings(options) {
69391
69970
  const otlpTracesEndpoint = env["QWEN_TELEMETRY_OTLP_TRACES_ENDPOINT"] ?? env["OTEL_EXPORTER_OTLP_TRACES_ENDPOINT"] ?? settings.otlpTracesEndpoint;
69392
69971
  const otlpLogsEndpoint = env["QWEN_TELEMETRY_OTLP_LOGS_ENDPOINT"] ?? env["OTEL_EXPORTER_OTLP_LOGS_ENDPOINT"] ?? settings.otlpLogsEndpoint;
69393
69972
  const otlpMetricsEndpoint = env["QWEN_TELEMETRY_OTLP_METRICS_ENDPOINT"] ?? env["OTEL_EXPORTER_OTLP_METRICS_ENDPOINT"] ?? settings.otlpMetricsEndpoint;
69973
+ const resourceAttributeWarnings = [];
69974
+ const envResourceAttrs = stripReservedResourceAttributes(
69975
+ parseOtelResourceAttributes(
69976
+ env["OTEL_RESOURCE_ATTRIBUTES"],
69977
+ resourceAttributeWarnings
69978
+ ),
69979
+ "OTEL_RESOURCE_ATTRIBUTES",
69980
+ resourceAttributeWarnings
69981
+ );
69982
+ const settingsResourceAttrs = stripReservedResourceAttributes(
69983
+ coerceStringResourceAttributes(
69984
+ settings.resourceAttributes,
69985
+ resourceAttributeWarnings
69986
+ ),
69987
+ "settings.telemetry.resourceAttributes",
69988
+ resourceAttributeWarnings
69989
+ );
69990
+ const mergedResourceAttrs = {
69991
+ ...envResourceAttrs,
69992
+ ...settingsResourceAttrs
69993
+ };
69994
+ const otelServiceName = env["OTEL_SERVICE_NAME"]?.trim();
69995
+ if (otelServiceName) {
69996
+ mergedResourceAttrs["service.name"] = otelServiceName;
69997
+ }
69998
+ const resourceAttributes = Object.keys(mergedResourceAttrs).length ? mergedResourceAttrs : void 0;
69999
+ const metricsIncludeSessionId = parseBooleanEnvFlag(env["QWEN_TELEMETRY_METRICS_INCLUDE_SESSION_ID"]) ?? settings.metrics?.includeSessionId ?? false;
69394
70000
  return {
69395
70001
  enabled,
69396
70002
  target,
@@ -69401,7 +70007,10 @@ async function resolveTelemetrySettings(options) {
69401
70007
  otlpMetricsEndpoint,
69402
70008
  logPrompts,
69403
70009
  includeSensitiveSpanAttributes,
69404
- outfile
70010
+ outfile,
70011
+ resourceAttributes,
70012
+ metrics: { includeSessionId: metricsIncludeSessionId },
70013
+ resourceAttributeWarnings: resourceAttributeWarnings.length ? resourceAttributeWarnings : void 0
69405
70014
  };
69406
70015
  }
69407
70016
  __name(resolveTelemetrySettings, "resolveTelemetrySettings");
@@ -69614,6 +70223,7 @@ var LoggingContentGenerator = class {
69614
70223
  this.wrapped = wrapped;
69615
70224
  this.config = config;
69616
70225
  this.modalities = generatorConfig.modalities;
70226
+ this.generatorAuthType = generatorConfig.authType;
69617
70227
  if (generatorConfig.enableOpenAILogging) {
69618
70228
  this.openaiLogger = new OpenAILogger(
69619
70229
  generatorConfig.openAILoggingDir,
@@ -69628,6 +70238,7 @@ var LoggingContentGenerator = class {
69628
70238
  openaiLogger;
69629
70239
  schemaCompliance;
69630
70240
  modalities;
70241
+ generatorAuthType;
69631
70242
  getWrapped() {
69632
70243
  return this.wrapped;
69633
70244
  }
@@ -69651,7 +70262,7 @@ var LoggingContentGenerator = class {
69651
70262
  model,
69652
70263
  durationMs,
69653
70264
  prompt_id,
69654
- this.config.getAuthType(),
70265
+ this.generatorAuthType,
69655
70266
  usageMetadata,
69656
70267
  responseText,
69657
70268
  subagentNameContext.getStore()
@@ -69670,7 +70281,7 @@ var LoggingContentGenerator = class {
69670
70281
  model,
69671
70282
  durationMs,
69672
70283
  promptId: prompt_id,
69673
- authType: this.config.getAuthType(),
70284
+ authType: this.generatorAuthType,
69674
70285
  errorMessage,
69675
70286
  errorType,
69676
70287
  statusCode: errorStatus,
@@ -69710,6 +70321,10 @@ var LoggingContentGenerator = class {
69710
70321
  const isInternal = isInternalPromptId(userPromptId);
69711
70322
  const session = this.startCaptureSession();
69712
70323
  try {
70324
+ runtimeDiagnostics.recordGenerateContentRequest(req, {
70325
+ stream: false,
70326
+ source: "generateContent"
70327
+ });
69713
70328
  if (!isInternal) {
69714
70329
  addSystemPromptAttributes(
69715
70330
  this.config,
@@ -69801,6 +70416,10 @@ var LoggingContentGenerator = class {
69801
70416
  const session = this.startCaptureSession();
69802
70417
  let stream;
69803
70418
  try {
70419
+ runtimeDiagnostics.recordGenerateContentRequest(req, {
70420
+ stream: true,
70421
+ source: "generateContentStream"
70422
+ });
69804
70423
  if (!isInternal) {
69805
70424
  addSystemPromptAttributes(
69806
70425
  this.config,
@@ -69935,47 +70554,51 @@ var LoggingContentGenerator = class {
69935
70554
  const durationMs = Date.now() - startTime;
69936
70555
  const consolidatedResponse = shouldCollectResponses ? this.consolidateGeminiResponsesForLogging(responses) : void 0;
69937
70556
  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);
70557
+ if (!spanEndedByTimeout) {
70558
+ runInSpan(
70559
+ () => this.safelyLogApiResponse(
70560
+ firstResponseId,
70561
+ durationMs,
70562
+ firstModelVersion || model,
70563
+ userPromptId,
70564
+ lastUsageMetadata,
70565
+ streamResponseText
70566
+ )
70567
+ );
70568
+ if (!isInternal && span) {
70569
+ addModelOutputAttributes(this.config, span, streamResponseText);
70570
+ }
70571
+ await runInSpan(
70572
+ () => this.safelyLogOpenAIInteraction(
70573
+ openaiRequest,
70574
+ consolidatedResponse,
70575
+ void 0,
70576
+ userPromptId
70577
+ )
70578
+ );
69950
70579
  }
69951
- await runInSpan(
69952
- () => this.safelyLogOpenAIInteraction(
69953
- openaiRequest,
69954
- consolidatedResponse,
69955
- void 0,
69956
- userPromptId
69957
- )
69958
- );
69959
70580
  } catch (error) {
69960
70581
  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
- );
70582
+ if (!spanEndedByTimeout) {
70583
+ const durationMs = Date.now() - startTime;
70584
+ runInSpan(
70585
+ () => this.safelyLogApiError(
70586
+ firstResponseId,
70587
+ durationMs,
70588
+ error,
70589
+ firstModelVersion || model,
70590
+ userPromptId
70591
+ )
70592
+ );
70593
+ await runInSpan(
70594
+ () => this.safelyLogOpenAIInteraction(
70595
+ openaiRequest,
70596
+ void 0,
70597
+ error,
70598
+ userPromptId
70599
+ )
70600
+ );
70601
+ }
69979
70602
  throw error;
69980
70603
  } finally {
69981
70604
  if (spanEndTimeout !== void 0) {
@@ -71675,11 +72298,11 @@ async function createContentGenerator(generatorConfig, config, isInitialAuth) {
71675
72298
  }
71676
72299
  let baseGenerator;
71677
72300
  if (authType === "openai" /* USE_OPENAI */) {
71678
- const { createOpenAIContentGenerator } = await import("./openaiContentGenerator-3H7XOZBW.js");
72301
+ const { createOpenAIContentGenerator } = await import("./openaiContentGenerator-XRP5JM6P.js");
71679
72302
  baseGenerator = createOpenAIContentGenerator(generatorConfig, config);
71680
72303
  } else if (authType === "qwen-oauth" /* QWEN_OAUTH */) {
71681
- const { getQwenOAuthClient: getQwenOauthClient } = await import("./qwenOAuth2-JSQ7EPR3.js");
71682
- const { QwenContentGenerator } = await import("./qwenContentGenerator-FAU3QPYO.js");
72304
+ const { getQwenOAuthClient: getQwenOauthClient } = await import("./qwenOAuth2-EEJGROP7.js");
72305
+ const { QwenContentGenerator } = await import("./qwenContentGenerator-EOX3HZXX.js");
71683
72306
  try {
71684
72307
  const qwenClient = await getQwenOauthClient(
71685
72308
  config,
@@ -71696,10 +72319,10 @@ async function createContentGenerator(generatorConfig, config, isInitialAuth) {
71696
72319
  );
71697
72320
  }
71698
72321
  } else if (authType === "anthropic" /* USE_ANTHROPIC */) {
71699
- const { createAnthropicContentGenerator } = await import("./anthropicContentGenerator-4QE6LTVV.js");
72322
+ const { createAnthropicContentGenerator } = await import("./anthropicContentGenerator-RQJNXJIY.js");
71700
72323
  baseGenerator = createAnthropicContentGenerator(generatorConfig, config);
71701
72324
  } else if (authType === "gemini" /* USE_GEMINI */ || authType === "vertex-ai" /* USE_VERTEX_AI */) {
71702
- const { createGeminiContentGenerator } = await import("./geminiContentGenerator-DYHZPKJX.js");
72325
+ const { createGeminiContentGenerator } = await import("./geminiContentGenerator-GYIOVT4A.js");
71703
72326
  baseGenerator = createGeminiContentGenerator(generatorConfig, config);
71704
72327
  } else {
71705
72328
  throw new Error(
@@ -73520,7 +74143,9 @@ var ReadFileToolInvocation = class extends BaseToolInvocation {
73520
74143
  }
73521
74144
  if (useFastPath && stats && isFullRead) {
73522
74145
  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)) {
74146
+ 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
74147
+ // #4239: idle microcompaction flips this off when it blanks it).
74148
+ status.entry.readResidentInHistory && (status.entry.lastWriteAt === void 0 || status.entry.lastReadAt > status.entry.lastWriteAt)) {
73524
74149
  debugLogger11.debug("hit", { path: absPath });
73525
74150
  return this.unchangedResult(absPath);
73526
74151
  }
@@ -73552,7 +74177,7 @@ var ReadFileToolInvocation = class extends BaseToolInvocation {
73552
74177
  });
73553
74178
  }
73554
74179
  let llmContent;
73555
- if (result.isTruncated) {
74180
+ if (result.isTruncated && result.linesShown && result.originalLineCount !== void 0) {
73556
74181
  const [start, end] = result.linesShown;
73557
74182
  const total = result.originalLineCount;
73558
74183
  llmContent = `Showing lines ${start}-${end} of ${total} total lines.
@@ -73678,6 +74303,17 @@ var ReadFileTool = class _ReadFileTool extends BaseDeclarativeTool {
73678
74303
  if (params.limit !== void 0 && params.limit <= 0) {
73679
74304
  return "Limit must be a positive number";
73680
74305
  }
74306
+ if (params.pages !== void 0) {
74307
+ const pages = params.pages.trim();
74308
+ params.pages = pages.length > 0 ? pages : void 0;
74309
+ }
74310
+ const ext = path7.extname(filePath).toLowerCase();
74311
+ if ((params.offset !== void 0 || params.limit !== void 0) && ext === ".ipynb") {
74312
+ return "offset and limit are not supported for Jupyter notebook (.ipynb) files. Notebooks are always read in full with structured cell output.";
74313
+ }
74314
+ if (params.pages !== void 0 && ext === ".ipynb") {
74315
+ return "pages is not supported for Jupyter notebook (.ipynb) files. Notebooks are always read in full with structured cell output.";
74316
+ }
73681
74317
  if (params.pages) {
73682
74318
  const parsed = parsePDFPageRange(params.pages);
73683
74319
  if (!parsed) {
@@ -73711,6 +74347,7 @@ export {
73711
74347
  UiTelemetryService,
73712
74348
  uiTelemetryService,
73713
74349
  safeJsonStringify,
74350
+ require_safer,
73714
74351
  iconvEncode,
73715
74352
  iconvEncodingExists,
73716
74353
  isUtf8CompatibleEncoding,
@@ -73735,8 +74372,22 @@ export {
73735
74372
  getSystemEncoding,
73736
74373
  windowsCodePageToEncoding,
73737
74374
  detectEncodingFromBuffer,
74375
+ normalizeSource,
74376
+ parseNotebook,
74377
+ inferNotebookJsonFormat,
74378
+ serializeNotebook,
74379
+ getCellDisplayId,
74380
+ hasStableCellIds,
74381
+ isAmbiguousCellId,
74382
+ findCellIndex,
74383
+ getNotebookLanguage,
74384
+ makeCellId,
74385
+ inferInsertedCellSourceArrayStyle,
74386
+ toNotebookSource,
74387
+ normalizeEditedCell,
73738
74388
  DEFAULT_ENCODING,
73739
74389
  detectBOM,
74390
+ decodeBufferWithEncodingInfo,
73740
74391
  readFileWithEncodingInfo,
73741
74392
  readFileWithEncoding,
73742
74393
  countFileLines,
@@ -73790,6 +74441,7 @@ export {
73790
74441
  addModelOutputAttributes,
73791
74442
  addToolInputAttributes,
73792
74443
  addToolResultAttributes,
74444
+ truncateSpanError,
73793
74445
  startInteractionSpan,
73794
74446
  endInteractionSpan,
73795
74447
  startLLMRequestSpan,
@@ -73799,6 +74451,10 @@ export {
73799
74451
  endToolSpan,
73800
74452
  startToolExecutionSpan,
73801
74453
  endToolExecutionSpan,
74454
+ startToolBlockedOnUserSpan,
74455
+ endToolBlockedOnUserSpan,
74456
+ startHookSpan,
74457
+ endHookSpan,
73802
74458
  getActiveInteractionSpan,
73803
74459
  isTelemetrySdkInitialized,
73804
74460
  initializeTelemetry,
@@ -73900,6 +74556,7 @@ export {
73900
74556
  TaggedThinkingParser,
73901
74557
  OpenAIContentConverter,
73902
74558
  openaiRequestCaptureContext,
74559
+ resolveOpenAILogDir,
73903
74560
  OpenAILogger,
73904
74561
  openaiLogger,
73905
74562
  parseBooleanEnvFlag,
@@ -73908,6 +74565,7 @@ export {
73908
74565
  TelemetryTarget,
73909
74566
  DEFAULT_TELEMETRY_TARGET,
73910
74567
  DEFAULT_OTLP_ENDPOINT,
74568
+ defaultModalities,
73911
74569
  MODEL_GENERATION_CONFIG_FIELDS,
73912
74570
  AUTH_ENV_MAPPINGS,
73913
74571
  DEFAULT_MODELS,