@qwen-code/qwen-code 0.15.12-preview.3 → 0.16.0

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-K6OWOMBN.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-AJSOD5IR.js → chunk-3T4ZT63H.js} +8833 -3600
  16. package/chunks/{chunk-B7ZL7HUA.js → chunk-4AOCVI6J.js} +2 -1
  17. package/chunks/{chunk-AOJ3BBY7.js → chunk-4J63U5QO.js} +17 -349
  18. package/chunks/{chunk-AEJ2DKLP.js → chunk-C6WMLUNB.js} +1 -1
  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-L34E6AGL.js +19126 -0
  28. package/chunks/{chunk-CBVB66WY.js → chunk-L5E26RN6.js} +2 -2
  29. package/chunks/{chunk-UXW7MYAW.js → chunk-MAY32HXD.js} +376 -1
  30. package/chunks/{chunk-GC5RXNL2.js → chunk-NOAHME6A.js} +115 -23
  31. package/chunks/{chunk-CM2IESUE.js → chunk-PR4T27R7.js} +1 -1
  32. package/chunks/{chunk-FYMSCRHM.js → chunk-PVVL5Q3W.js} +32 -1
  33. package/chunks/{chunk-YHEAJFCI.js → chunk-USE2VQ5P.js} +3 -0
  34. package/chunks/chunk-VMOAQVBP.js +379 -0
  35. package/chunks/{chunk-XLQ4E5PS.js → chunk-WCZWAKFG.js} +795 -142
  36. package/chunks/{chunk-GJXIKCKL.js → chunk-XP27SJMH.js} +76 -5
  37. package/chunks/{chunk-TPGOGCWM.js → chunk-YJLGXDQJ.js} +1 -1
  38. package/chunks/{contextCommand-SVLAZMQL.js → contextCommand-7CPNXBLO.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-CBM5NDVK.js} +28 -18
  47. package/chunks/{en-NRN4QBAT.js → en-HGJ2SPLM.js} +5 -3
  48. package/chunks/{enter-worktree-FOF5YZIV.js → enter-worktree-XABKPLO6.js} +41 -17
  49. package/chunks/{exit-worktree-Y6QVAO3C.js → exit-worktree-56MN2PCL.js} +41 -17
  50. package/chunks/{exitPlanMode-QZKO7GH7.js → exitPlanMode-YDNPCSCJ.js} +15 -17
  51. package/chunks/{fr-OFJFHLCR.js → fr-CJULI7ZX.js} +3 -3
  52. package/chunks/{geminiContentGenerator-DYHZPKJX.js → geminiContentGenerator-ZGPNBFDS.js} +3 -3
  53. package/chunks/{glob-G7XATELV.js → glob-ZHA35VO5.js} +15 -17
  54. package/chunks/{grep-4SETMY47.js → grep-RV6V6T52.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-5G2OBGE5.js} +27 -17
  60. package/chunks/notebook-edit-XUBTCT6L.js +756 -0
  61. package/chunks/{openaiContentGenerator-3H7XOZBW.js → openaiContentGenerator-POYAZQ6I.js} +12 -11
  62. package/chunks/{pt-ZLE6SA4A.js → pt-M6JULLEQ.js} +3 -3
  63. package/chunks/{qwenContentGenerator-FAU3QPYO.js → qwenContentGenerator-2E4H56DK.js} +17 -19
  64. package/chunks/{qwenOAuth2-JSQ7EPR3.js → qwenOAuth2-EEJGROP7.js} +9 -3
  65. package/chunks/{read-file-WWUQVNCZ.js → read-file-3JIOOXFT.js} +7 -8
  66. package/chunks/{ripGrep-WCOAIWL6.js → ripGrep-LEI3L6PM.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-CFVRMD4W.js} +8500 -1663
  70. package/chunks/{shell-IAOKGIJ6.js → shell-3B5DZ437.js} +15 -17
  71. package/chunks/{skill-NHW6222K.js → skill-STSZUBXR.js} +23 -10
  72. package/chunks/{src-OWV5HVQQ.js → src-ROFXAPEP.js} +211 -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-ARWOD3GD.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-6MRT7TEW.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 +58070 -75930
  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,142 @@ 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( +)"/);
63623
+ return {
63624
+ indent: lineMatch?.[1]?.length,
63625
+ trailingNewline: content.endsWith("\n")
63626
+ };
63627
+ }
63628
+ __name(inferNotebookJsonFormat, "inferNotebookJsonFormat");
63629
+ function serializeNotebook(notebook, format = { indent: 1, trailingNewline: true }) {
63630
+ const serialized = JSON.stringify(notebook, null, format.indent);
63631
+ return format.trailingNewline ? `${serialized}
63632
+ ` : serialized;
63633
+ }
63634
+ __name(serializeNotebook, "serializeNotebook");
63635
+ function getCellDisplayId(cell, index) {
63636
+ return typeof cell.id === "string" && cell.id.length > 0 ? cell.id : `cell-${index}`;
63637
+ }
63638
+ __name(getCellDisplayId, "getCellDisplayId");
63639
+ function hasStableCellIds(notebook) {
63640
+ return notebook.cells.every(
63641
+ (cell) => typeof cell.id === "string" && cell.id.length > 0
63642
+ );
63643
+ }
63644
+ __name(hasStableCellIds, "hasStableCellIds");
63645
+ function findCellIndexesByDisplayId(notebook, cellId) {
63646
+ const indexes = [];
63647
+ notebook.cells.forEach((cell, index) => {
63648
+ if (getCellDisplayId(cell, index) === cellId) {
63649
+ indexes.push(index);
63650
+ }
63651
+ });
63652
+ return indexes;
63653
+ }
63654
+ __name(findCellIndexesByDisplayId, "findCellIndexesByDisplayId");
63655
+ function isAmbiguousCellId(notebook, cellId) {
63656
+ return findCellIndexesByDisplayId(notebook, cellId).length > 1;
63657
+ }
63658
+ __name(isAmbiguousCellId, "isAmbiguousCellId");
63659
+ function findCellIndex(notebook, cellId) {
63660
+ const indexes = findCellIndexesByDisplayId(notebook, cellId);
63661
+ return indexes.length === 1 ? indexes[0] : -1;
63662
+ }
63663
+ __name(findCellIndex, "findCellIndex");
63664
+ function getNotebookLanguage(notebook) {
63665
+ return notebook.metadata?.language_info?.name ?? notebook.metadata?.kernelspec?.language ?? "python";
63666
+ }
63667
+ __name(getNotebookLanguage, "getNotebookLanguage");
63668
+ function shouldGenerateCellIds(notebook) {
63669
+ return (notebook.nbformat ?? 0) > 4 || (notebook.nbformat ?? 0) === 4 && (notebook.nbformat_minor ?? 0) >= 5;
63670
+ }
63671
+ __name(shouldGenerateCellIds, "shouldGenerateCellIds");
63672
+ function makeCellId(notebook) {
63673
+ if (!shouldGenerateCellIds(notebook)) {
63674
+ return void 0;
63675
+ }
63676
+ const existingDisplayIds = new Set(
63677
+ notebook.cells.map((cell, index) => getCellDisplayId(cell, index))
63678
+ );
63679
+ let fallbackIndex = 1;
63680
+ let fallback = `qwen-cell-${fallbackIndex}`;
63681
+ while (existingDisplayIds.has(fallback)) {
63682
+ fallbackIndex++;
63683
+ fallback = `qwen-cell-${fallbackIndex}`;
63684
+ }
63685
+ return fallback;
63686
+ }
63687
+ __name(makeCellId, "makeCellId");
63688
+ function inferNotebookSourceArrayStyle(notebook) {
63689
+ const sourceCell = notebook.cells.find((cell) => cell.source !== void 0);
63690
+ return sourceCell ? Array.isArray(sourceCell.source) : true;
63691
+ }
63692
+ __name(inferNotebookSourceArrayStyle, "inferNotebookSourceArrayStyle");
63693
+ function inferInsertedCellSourceArrayStyle(notebook, insertAt) {
63694
+ const previousCell = notebook.cells[insertAt - 1];
63695
+ if (previousCell?.source !== void 0) {
63696
+ return Array.isArray(previousCell.source);
63697
+ }
63698
+ const nextCell = notebook.cells[insertAt];
63699
+ if (nextCell?.source !== void 0) {
63700
+ return Array.isArray(nextCell.source);
63701
+ }
63702
+ return inferNotebookSourceArrayStyle(notebook);
63703
+ }
63704
+ __name(inferInsertedCellSourceArrayStyle, "inferInsertedCellSourceArrayStyle");
63705
+ function toNotebookSource(source, preferArray) {
63706
+ if (!preferArray) {
63707
+ return source;
63708
+ }
63709
+ if (source.length === 0) {
63710
+ return [];
63711
+ }
63712
+ const lines = [];
63713
+ let start = 0;
63714
+ for (let i = 0; i < source.length; i++) {
63715
+ if (source[i] === "\n") {
63716
+ lines.push(source.slice(start, i + 1));
63717
+ start = i + 1;
63718
+ }
63719
+ }
63720
+ if (start < source.length) {
63721
+ lines.push(source.slice(start));
63722
+ }
63723
+ return lines;
63724
+ }
63725
+ __name(toNotebookSource, "toNotebookSource");
63726
+ function normalizeEditedCell(cell, finalType) {
63727
+ cell.cell_type = finalType;
63728
+ cell.metadata ??= {};
63729
+ if (finalType === "code") {
63730
+ cell.execution_count = null;
63731
+ cell.outputs = [];
63732
+ return;
63733
+ }
63734
+ delete cell.execution_count;
63735
+ delete cell.outputs;
63736
+ }
63737
+ __name(normalizeEditedCell, "normalizeEditedCell");
63535
63738
  function processOutputText(text) {
63536
63739
  if (!text) return "";
63537
63740
  return Array.isArray(text) ? text.join("") : text;
@@ -63567,7 +63770,7 @@ function processOutput(output) {
63567
63770
  }
63568
63771
  __name(processOutput, "processOutput");
63569
63772
  function processCell(cell, index, language) {
63570
- const cellId = cell.id ?? `cell-${index}`;
63773
+ const cellId = getCellDisplayId(cell, index);
63571
63774
  const source = normalizeSource(cell.source);
63572
63775
  const parts = [];
63573
63776
  switch (cell.cell_type) {
@@ -63607,20 +63810,22 @@ function processCell(cell, index, language) {
63607
63810
  return parts.join("\n");
63608
63811
  }
63609
63812
  __name(processCell, "processCell");
63610
- async function readNotebook(filePath) {
63813
+ async function readNotebookWithMetadata(filePath) {
63611
63814
  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";
63815
+ const notebook = parseNotebook(raw);
63816
+ const language = getNotebookLanguage(notebook);
63614
63817
  if (!notebook.cells || notebook.cells.length === 0) {
63615
- return "(empty notebook)";
63818
+ return { content: "(empty notebook)", isTruncated: false };
63616
63819
  }
63617
63820
  const header = `Jupyter Notebook (${language}, ${notebook.cells.length} cells)`;
63618
63821
  const cellTexts = [];
63619
63822
  let totalLength = header.length;
63823
+ let isTruncated = false;
63620
63824
  for (let i = 0; i < notebook.cells.length; i++) {
63621
63825
  const cellText = processCell(notebook.cells[i], i, language);
63622
63826
  totalLength += cellText.length + 2;
63623
63827
  if (totalLength > MAX_NOTEBOOK_OUTPUT_CHARS) {
63828
+ isTruncated = true;
63624
63829
  cellTexts.push(
63625
63830
  `... [${notebook.cells.length - i} remaining cells truncated, total ${notebook.cells.length} cells. Use shell to inspect: cat <path> | jq '.cells[${i}:]']`
63626
63831
  );
@@ -63628,11 +63833,14 @@ async function readNotebook(filePath) {
63628
63833
  }
63629
63834
  cellTexts.push(cellText);
63630
63835
  }
63631
- return `${header}
63836
+ return {
63837
+ content: `${header}
63632
63838
 
63633
- ${cellTexts.join("\n\n")}`;
63839
+ ${cellTexts.join("\n\n")}`,
63840
+ isTruncated
63841
+ };
63634
63842
  }
63635
- __name(readNotebook, "readNotebook");
63843
+ __name(readNotebookWithMetadata, "readNotebookWithMetadata");
63636
63844
 
63637
63845
  // packages/core/src/utils/fileUtils.ts
63638
63846
  var debugLogger2 = createDebugLogger("FILE_UTILS");
@@ -63694,6 +63902,42 @@ function isValidUtf8(buffer) {
63694
63902
  }
63695
63903
  }
63696
63904
  __name(isValidUtf8, "isValidUtf8");
63905
+ function decodeBufferWithEncodingInfo(full) {
63906
+ if (full.length === 0) {
63907
+ return { content: "", encoding: "utf-8", bom: false };
63908
+ }
63909
+ const bomInfo = detectBOM(full);
63910
+ if (bomInfo) {
63911
+ return {
63912
+ content: decodeBOMBuffer(full, bomInfo),
63913
+ encoding: bomEncodingToName(bomInfo.encoding),
63914
+ // Mark bom: true for all Unicode BOM variants (UTF-8/16/32) so that
63915
+ // the BOM is re-written on save and the file's original format is preserved.
63916
+ bom: true
63917
+ };
63918
+ }
63919
+ if (isValidUtf8(full)) {
63920
+ return { content: full.toString("utf8"), encoding: "utf-8", bom: false };
63921
+ }
63922
+ const detected = detectEncodingFromBuffer(full);
63923
+ if (detected && !isUtf8CompatibleEncoding(detected)) {
63924
+ try {
63925
+ if (iconvEncodingExists(detected)) {
63926
+ return {
63927
+ content: iconvDecode(full, detected),
63928
+ encoding: detected,
63929
+ bom: false
63930
+ };
63931
+ }
63932
+ } catch (e) {
63933
+ debugLogger2.warn(
63934
+ `Failed to decode buffer as ${detected}: ${e instanceof Error ? e.message : String(e)}`
63935
+ );
63936
+ }
63937
+ }
63938
+ return { content: full.toString("utf8"), encoding: "utf-8", bom: false };
63939
+ }
63940
+ __name(decodeBufferWithEncodingInfo, "decodeBufferWithEncodingInfo");
63697
63941
  function decodeBOMBuffer(buf, bomInfo) {
63698
63942
  const content = buf.subarray(bomInfo.bomLength);
63699
63943
  switch (bomInfo.encoding) {
@@ -63731,37 +63975,7 @@ function bomEncodingToName(bomEncoding) {
63731
63975
  __name(bomEncodingToName, "bomEncodingToName");
63732
63976
  async function readFileWithEncodingInfo(filePath) {
63733
63977
  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 };
63978
+ return decodeBufferWithEncodingInfo(full);
63765
63979
  }
63766
63980
  __name(readFileWithEncodingInfo, "readFileWithEncodingInfo");
63767
63981
  async function readFileWithEncoding(filePath) {
@@ -64341,10 +64555,12 @@ async function processSingleFileContent(filePath, config, offset, limit, pages)
64341
64555
  }
64342
64556
  case "notebook": {
64343
64557
  try {
64344
- const content = await readNotebook(filePath);
64558
+ const { content, isTruncated } = await readNotebookWithMetadata(filePath);
64345
64559
  return {
64346
64560
  llmContent: content,
64347
- returnDisplay: `Read notebook: ${relativePathForDisplay}`
64561
+ returnDisplay: `Read notebook: ${relativePathForDisplay}`,
64562
+ isTruncated,
64563
+ stats
64348
64564
  };
64349
64565
  } catch (e) {
64350
64566
  const msg = e instanceof Error ? e.message : String(e);
@@ -64434,6 +64650,8 @@ var SPAN_INTERACTION = "qwen-code.interaction";
64434
64650
  var SPAN_LLM_REQUEST = "qwen-code.llm_request";
64435
64651
  var SPAN_TOOL = "qwen-code.tool";
64436
64652
  var SPAN_TOOL_EXECUTION = "qwen-code.tool.execution";
64653
+ var SPAN_TOOL_BLOCKED_ON_USER = "qwen-code.tool.blocked_on_user";
64654
+ var SPAN_HOOK = "qwen-code.hook";
64437
64655
 
64438
64656
  // packages/core/src/telemetry/metrics.ts
64439
64657
  var TOOL_CALL_COUNT = `${SERVICE_NAME}.tool.call.count`;
@@ -64472,9 +64690,19 @@ var MEMORY_DREAM_DURATION = `${SERVICE_NAME}.memory.dream.duration`;
64472
64690
  var MEMORY_RECALL_COUNT = `${SERVICE_NAME}.memory.recall.count`;
64473
64691
  var MEMORY_RECALL_DURATION = `${SERVICE_NAME}.memory.recall.duration`;
64474
64692
  var baseMetricDefinition = {
64475
- getCommonAttributes: /* @__PURE__ */ __name((config) => ({
64476
- "session.id": config.getSessionId()
64477
- }), "getCommonAttributes")
64693
+ // session.id on metrics is opt-in: each session is a new value, so
64694
+ // attaching it by default would create unbounded time-series fan-out on
64695
+ // every metric backend. Operators who need session-level metric slicing
64696
+ // can enable QWEN_TELEMETRY_METRICS_INCLUDE_SESSION_ID or
64697
+ // telemetry.metrics.includeSessionId. Spans and logs always carry
64698
+ // session.id for trace/log correlation.
64699
+ getCommonAttributes: /* @__PURE__ */ __name((config) => {
64700
+ const out = {};
64701
+ if (config.getTelemetryMetricsIncludeSessionId()) {
64702
+ out["session.id"] = config.getSessionId();
64703
+ }
64704
+ return out;
64705
+ }, "getCommonAttributes")
64478
64706
  };
64479
64707
  var COUNTER_DEFINITIONS = {
64480
64708
  [TOOL_CALL_COUNT]: {
@@ -68036,6 +68264,22 @@ var v4_default = v4;
68036
68264
  // packages/core/src/utils/openaiLogger.ts
68037
68265
  import * as os2 from "os";
68038
68266
  var debugLogger6 = createDebugLogger("OPENAI_LOGGER");
68267
+ var MAIN_SESSION_PROMPT_ID_DELIMITER = "########";
68268
+ 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;
68269
+ function resolveOpenAILogDir(customLogDir, cwd) {
68270
+ const baseCwd = cwd || process.cwd();
68271
+ if (!customLogDir) {
68272
+ return path5.join(baseCwd, "logs", "openai");
68273
+ }
68274
+ let resolvedPath = customLogDir;
68275
+ if (customLogDir === "~" || customLogDir.startsWith("~/")) {
68276
+ resolvedPath = path5.join(os2.homedir(), customLogDir.slice(1));
68277
+ } else if (!path5.isAbsolute(customLogDir)) {
68278
+ resolvedPath = path5.resolve(baseCwd, customLogDir);
68279
+ }
68280
+ return path5.normalize(resolvedPath);
68281
+ }
68282
+ __name(resolveOpenAILogDir, "resolveOpenAILogDir");
68039
68283
  function sanitizeDiagnosticSuffix(suffix) {
68040
68284
  if (!suffix) return void 0;
68041
68285
  const sanitized = suffix.replace(/[^a-zA-Z0-9._-]+/g, "-").replace(/^-+|-+$/g, "");
@@ -68060,6 +68304,36 @@ function promptIdSuffixForFilename(promptId) {
68060
68304
  return sanitizeDiagnosticSuffix(extractSubagentSuffix(promptId));
68061
68305
  }
68062
68306
  __name(promptIdSuffixForFilename, "promptIdSuffixForFilename");
68307
+ function sessionIdFromPromptId(promptId) {
68308
+ if (!promptId) return void 0;
68309
+ const mainSessionDelimiterIndex = promptId.indexOf(
68310
+ MAIN_SESSION_PROMPT_ID_DELIMITER
68311
+ );
68312
+ if (mainSessionDelimiterIndex > 0) {
68313
+ return promptId.slice(0, mainSessionDelimiterIndex);
68314
+ }
68315
+ if (UUID_PATTERN.test(promptId)) {
68316
+ return promptId;
68317
+ }
68318
+ const parts = promptId.split("#");
68319
+ if (parts.length >= 3 && parts[0]) {
68320
+ return parts[0];
68321
+ }
68322
+ return void 0;
68323
+ }
68324
+ __name(sessionIdFromPromptId, "sessionIdFromPromptId");
68325
+ function contextForPromptId(promptId) {
68326
+ const trimmedPromptId = promptId?.trim();
68327
+ const sessionId = sessionIdFromPromptId(trimmedPromptId);
68328
+ if (!trimmedPromptId && !sessionId) {
68329
+ return null;
68330
+ }
68331
+ return {
68332
+ ...trimmedPromptId ? { promptId: trimmedPromptId } : {},
68333
+ ...sessionId ? { sessionId } : {}
68334
+ };
68335
+ }
68336
+ __name(contextForPromptId, "contextForPromptId");
68063
68337
  var OpenAILogger = class {
68064
68338
  static {
68065
68339
  __name(this, "OpenAILogger");
@@ -68074,18 +68348,7 @@ var OpenAILogger = class {
68074
68348
  * pass the project working directory from Config.getWorkingDir().
68075
68349
  */
68076
68350
  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
- }
68351
+ this.logDir = resolveOpenAILogDir(customLogDir, cwd);
68089
68352
  }
68090
68353
  /**
68091
68354
  * Initialize the logger by creating the log directory if it doesn't exist
@@ -68126,6 +68389,7 @@ var OpenAILogger = class {
68126
68389
  message: error.message,
68127
68390
  stack: error.stack
68128
68391
  } : null,
68392
+ context: contextForPromptId(promptId),
68129
68393
  system: {
68130
68394
  hostname: os2.hostname(),
68131
68395
  platform: os2.platform(),
@@ -68774,6 +69038,17 @@ __name(addToolResultAttributes, "addToolResultAttributes");
68774
69038
 
68775
69039
  // packages/core/src/telemetry/session-tracing.ts
68776
69040
  var debugLogger8 = createDebugLogger("SESSION_TRACING");
69041
+ function resolveParentContext(parent) {
69042
+ if (parent) {
69043
+ return trace.setSpan(context.active(), parent.span);
69044
+ }
69045
+ const active = context.active();
69046
+ if (trace.getSpan(active)) {
69047
+ return active;
69048
+ }
69049
+ return getSessionContext() ?? active;
69050
+ }
69051
+ __name(resolveParentContext, "resolveParentContext");
68777
69052
  var NOOP_SPAN = trace.wrapSpanContext({
68778
69053
  traceId: "0".repeat(32),
68779
69054
  spanId: "0".repeat(16),
@@ -68787,26 +69062,55 @@ var interactionSequence = 0;
68787
69062
  var lastInteractionCtx;
68788
69063
  var cleanupIntervalStarted = false;
68789
69064
  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;
69065
+ function sweepStaleSpans(now) {
69066
+ const cutoff = now - SPAN_TTL_MS;
69067
+ for (const [spanId, weakRef] of activeSpans) {
69068
+ const ctx = weakRef.deref();
69069
+ if (ctx === void 0) {
69070
+ activeSpans.delete(spanId);
69071
+ strongSpans.delete(spanId);
69072
+ } else if (ctx.startTime < cutoff) {
69073
+ if (!ctx.ended) {
69074
+ ctx.ended = true;
69075
+ const ageMs = now - ctx.startTime;
69076
+ const toolName = ctx.attributes["tool.name"];
69077
+ const callId = ctx.attributes["tool.call_id"];
69078
+ try {
69079
+ ctx.span.setAttributes({
69080
+ "qwen-code.span.ttl_expired": true,
69081
+ "qwen-code.span.duration_ms": ageMs,
69082
+ ...ctx.type === "tool.blocked_on_user" ? {
69083
+ decision: "aborted",
69084
+ source: "system"
69085
+ } : {}
69086
+ });
69087
+ } catch (error) {
69088
+ debugLogger8.warn(
69089
+ `Failed to stamp TTL attrs on stale span ${spanId}: ${error instanceof Error ? error.message : String(error)}`
69090
+ );
69091
+ }
69092
+ const ctxLabel = toolName && callId ? `${ctx.type} (tool.name=${toolName}, tool.call_id=${callId})` : ctx.type;
69093
+ debugLogger8.warn(
69094
+ `Stale ${ctxLabel} span ended by TTL safety net (age=${ageMs}ms, spanId=${spanId})`
69095
+ );
69096
+ try {
68803
69097
  ctx.span.end();
69098
+ } catch (error) {
69099
+ debugLogger8.warn(
69100
+ `Failed to end stale span ${spanId}: ${error instanceof Error ? error.message : String(error)}`
69101
+ );
68804
69102
  }
68805
- activeSpans.delete(spanId);
68806
- strongSpans.delete(spanId);
68807
69103
  }
69104
+ activeSpans.delete(spanId);
69105
+ strongSpans.delete(spanId);
68808
69106
  }
68809
- }, 6e4);
69107
+ }
69108
+ }
69109
+ __name(sweepStaleSpans, "sweepStaleSpans");
69110
+ function ensureCleanupInterval() {
69111
+ if (cleanupIntervalStarted) return;
69112
+ cleanupIntervalStarted = true;
69113
+ const interval = setInterval(() => sweepStaleSpans(Date.now()), 6e4);
68810
69114
  if (typeof interval.unref === "function") {
68811
69115
  interval.unref();
68812
69116
  }
@@ -68816,6 +69120,15 @@ function getSpanId(span) {
68816
69120
  return span.spanContext().spanId || "";
68817
69121
  }
68818
69122
  __name(getSpanId, "getSpanId");
69123
+ var SPAN_ERROR_MAX_CHARS = 1024;
69124
+ function truncateSpanError(s) {
69125
+ if (s.length <= SPAN_ERROR_MAX_CHARS) return s;
69126
+ let end = SPAN_ERROR_MAX_CHARS;
69127
+ const code = s.charCodeAt(end - 1);
69128
+ if (code >= 55296 && code <= 56319) end--;
69129
+ return s.slice(0, end) + "\u2026[truncated]";
69130
+ }
69131
+ __name(truncateSpanError, "truncateSpanError");
68819
69132
  function getTracer() {
68820
69133
  return trace.getTracer(SERVICE_NAME, "1.0.0");
68821
69134
  }
@@ -68879,7 +69192,7 @@ function startLLMRequestSpan(model, promptId) {
68879
69192
  return NOOP_SPAN;
68880
69193
  }
68881
69194
  const parentCtx = interactionContext.getStore();
68882
- const ctx = parentCtx ? trace.setSpan(context.active(), parentCtx.span) : getSessionContext() ?? context.active();
69195
+ const ctx = resolveParentContext(parentCtx);
68883
69196
  const attributes = {
68884
69197
  "qwen-code.model": model,
68885
69198
  "qwen-code.prompt_id": promptId,
@@ -68916,7 +69229,8 @@ function endLLMRequestSpan(span, metadata) {
68916
69229
  if (metadata.outputTokens !== void 0)
68917
69230
  endAttributes["output_tokens"] = metadata.outputTokens;
68918
69231
  endAttributes["success"] = metadata.success;
68919
- if (metadata.error !== void 0) endAttributes["error"] = metadata.error;
69232
+ if (metadata.error !== void 0)
69233
+ endAttributes["error"] = truncateSpanError(metadata.error);
68920
69234
  }
68921
69235
  spanCtx.span.setAttributes(endAttributes);
68922
69236
  if (metadata === void 0 || metadata.success) {
@@ -68924,7 +69238,7 @@ function endLLMRequestSpan(span, metadata) {
68924
69238
  } else {
68925
69239
  spanCtx.span.setStatus({
68926
69240
  code: SpanStatusCode.ERROR,
68927
- message: metadata.error ?? "unknown error"
69241
+ message: metadata.error ? truncateSpanError(metadata.error) : "unknown error"
68928
69242
  });
68929
69243
  }
68930
69244
  } catch (error) {
@@ -68948,7 +69262,7 @@ function startToolSpan(toolName, attrs) {
68948
69262
  return NOOP_SPAN;
68949
69263
  }
68950
69264
  const parentCtx = interactionContext.getStore();
68951
- const ctx = parentCtx ? trace.setSpan(context.active(), parentCtx.span) : getSessionContext() ?? context.active();
69265
+ const ctx = resolveParentContext(parentCtx);
68952
69266
  const attributes = {
68953
69267
  "tool.name": toolName,
68954
69268
  ...attrs
@@ -68989,7 +69303,8 @@ function endToolSpan(span, metadata) {
68989
69303
  if (metadata) {
68990
69304
  if (metadata.success !== void 0)
68991
69305
  endAttributes["success"] = metadata.success;
68992
- if (metadata.error !== void 0) endAttributes["error"] = metadata.error;
69306
+ if (metadata.error !== void 0)
69307
+ endAttributes["error"] = truncateSpanError(metadata.error);
68993
69308
  }
68994
69309
  spanCtx.span.setAttributes(endAttributes);
68995
69310
  if (metadata) {
@@ -68998,7 +69313,7 @@ function endToolSpan(span, metadata) {
68998
69313
  } else {
68999
69314
  spanCtx.span.setStatus({
69000
69315
  code: SpanStatusCode.ERROR,
69001
- message: metadata.error ?? "tool error"
69316
+ message: metadata.error ? truncateSpanError(metadata.error) : "tool error"
69002
69317
  });
69003
69318
  }
69004
69319
  }
@@ -69028,7 +69343,7 @@ function startToolExecutionSpan() {
69028
69343
  "startToolExecutionSpan called outside runInToolSpanContext \u2014 span will not be parented to tool span"
69029
69344
  );
69030
69345
  }
69031
- const ctx = parentCtx ? trace.setSpan(context.active(), parentCtx.span) : getSessionContext() ?? context.active();
69346
+ const ctx = resolveParentContext(parentCtx);
69032
69347
  const span = getTracer().startSpan(
69033
69348
  SPAN_TOOL_EXECUTION,
69034
69349
  { kind: SpanKind.INTERNAL },
@@ -69057,16 +69372,17 @@ function endToolExecutionSpan(span, metadata) {
69057
69372
  if (metadata) {
69058
69373
  if (metadata.success !== void 0)
69059
69374
  endAttributes["success"] = metadata.success;
69060
- if (metadata.error !== void 0) endAttributes["error"] = metadata.error;
69375
+ if (metadata.error !== void 0)
69376
+ endAttributes["error"] = truncateSpanError(metadata.error);
69061
69377
  }
69062
69378
  spanCtx.span.setAttributes(endAttributes);
69063
- if (metadata) {
69379
+ if (metadata && !metadata.cancelled) {
69064
69380
  if (metadata.success !== false) {
69065
69381
  spanCtx.span.setStatus({ code: SpanStatusCode.OK });
69066
69382
  } else {
69067
69383
  spanCtx.span.setStatus({
69068
69384
  code: SpanStatusCode.ERROR,
69069
- message: metadata.error ?? "tool execution error"
69385
+ message: metadata.error ? truncateSpanError(metadata.error) : "tool execution error"
69070
69386
  });
69071
69387
  }
69072
69388
  }
@@ -69086,6 +69402,144 @@ function endToolExecutionSpan(span, metadata) {
69086
69402
  strongSpans.delete(spanId);
69087
69403
  }
69088
69404
  __name(endToolExecutionSpan, "endToolExecutionSpan");
69405
+ function startToolBlockedOnUserSpan(toolSpan, attrs) {
69406
+ if (!isTelemetrySdkInitialized()) {
69407
+ return NOOP_SPAN;
69408
+ }
69409
+ ensureCleanupInterval();
69410
+ const parentSpanId = getSpanId(toolSpan);
69411
+ const parentSpanCtx = activeSpans.get(parentSpanId)?.deref();
69412
+ if (!parentSpanCtx) {
69413
+ debugLogger8.debug(
69414
+ "startToolBlockedOnUserSpan: tool span not in activeSpans (already ended?) \u2014 using resolveParentContext fallback"
69415
+ );
69416
+ }
69417
+ const ctx = parentSpanCtx ? trace.setSpan(context.active(), parentSpanCtx.span) : resolveParentContext(void 0);
69418
+ const attributes = {};
69419
+ if (attrs?.tool_name !== void 0) attributes["tool.name"] = attrs.tool_name;
69420
+ if (attrs?.call_id !== void 0) attributes["tool.call_id"] = attrs.call_id;
69421
+ const span = getTracer().startSpan(
69422
+ SPAN_TOOL_BLOCKED_ON_USER,
69423
+ { kind: SpanKind.INTERNAL, attributes },
69424
+ ctx
69425
+ );
69426
+ const spanId = getSpanId(span);
69427
+ const spanContextObj = {
69428
+ span,
69429
+ startTime: Date.now(),
69430
+ attributes,
69431
+ type: "tool.blocked_on_user"
69432
+ };
69433
+ activeSpans.set(spanId, new WeakRef(spanContextObj));
69434
+ strongSpans.set(spanId, spanContextObj);
69435
+ return span;
69436
+ }
69437
+ __name(startToolBlockedOnUserSpan, "startToolBlockedOnUserSpan");
69438
+ function endToolBlockedOnUserSpan(span, metadata) {
69439
+ const spanId = getSpanId(span);
69440
+ const spanCtx = activeSpans.get(spanId)?.deref();
69441
+ if (!spanCtx || spanCtx.ended) return;
69442
+ spanCtx.ended = true;
69443
+ try {
69444
+ const duration = Date.now() - spanCtx.startTime;
69445
+ const endAttributes = { duration_ms: duration };
69446
+ if (metadata?.decision !== void 0)
69447
+ endAttributes["decision"] = metadata.decision;
69448
+ if (metadata?.source !== void 0)
69449
+ endAttributes["source"] = metadata.source;
69450
+ spanCtx.span.setAttributes(endAttributes);
69451
+ } catch (error) {
69452
+ debugLogger8.warn(
69453
+ `Failed to update blocked_on_user span attributes: ${error instanceof Error ? error.message : String(error)}`
69454
+ );
69455
+ }
69456
+ try {
69457
+ spanCtx.span.end();
69458
+ } catch (error) {
69459
+ debugLogger8.warn(
69460
+ `Failed to end blocked_on_user span: ${error instanceof Error ? error.message : String(error)}`
69461
+ );
69462
+ }
69463
+ activeSpans.delete(spanId);
69464
+ strongSpans.delete(spanId);
69465
+ }
69466
+ __name(endToolBlockedOnUserSpan, "endToolBlockedOnUserSpan");
69467
+ function startHookSpan(opts) {
69468
+ if (!isTelemetrySdkInitialized()) {
69469
+ return NOOP_SPAN;
69470
+ }
69471
+ ensureCleanupInterval();
69472
+ const parentCtx = toolContext.getStore() ?? interactionContext.getStore() ?? void 0;
69473
+ const ctx = resolveParentContext(parentCtx);
69474
+ const attributes = {
69475
+ hook_event: opts.hookEvent,
69476
+ "tool.name": opts.toolName
69477
+ };
69478
+ if (opts.toolUseId !== void 0) attributes["tool.use_id"] = opts.toolUseId;
69479
+ if (opts.isInterrupt !== void 0)
69480
+ attributes["is_interrupt"] = opts.isInterrupt;
69481
+ const span = getTracer().startSpan(
69482
+ SPAN_HOOK,
69483
+ { kind: SpanKind.INTERNAL, attributes },
69484
+ ctx
69485
+ );
69486
+ const spanId = getSpanId(span);
69487
+ const spanContextObj = {
69488
+ span,
69489
+ startTime: Date.now(),
69490
+ attributes,
69491
+ type: "hook"
69492
+ };
69493
+ activeSpans.set(spanId, new WeakRef(spanContextObj));
69494
+ strongSpans.set(spanId, spanContextObj);
69495
+ return span;
69496
+ }
69497
+ __name(startHookSpan, "startHookSpan");
69498
+ function endHookSpan(span, metadata) {
69499
+ const spanId = getSpanId(span);
69500
+ const spanCtx = activeSpans.get(spanId)?.deref();
69501
+ if (!spanCtx || spanCtx.ended) return;
69502
+ spanCtx.ended = true;
69503
+ try {
69504
+ const duration = Date.now() - spanCtx.startTime;
69505
+ const endAttributes = { duration_ms: duration };
69506
+ if (metadata) {
69507
+ if (metadata.success !== void 0)
69508
+ endAttributes["success"] = metadata.success;
69509
+ if (metadata.shouldProceed !== void 0)
69510
+ endAttributes["should_proceed"] = metadata.shouldProceed;
69511
+ if (metadata.shouldStop !== void 0)
69512
+ endAttributes["should_stop"] = metadata.shouldStop;
69513
+ if (metadata.blockType !== void 0)
69514
+ endAttributes["block_type"] = metadata.blockType;
69515
+ if (metadata.hasAdditionalContext !== void 0)
69516
+ endAttributes["has_additional_context"] = metadata.hasAdditionalContext;
69517
+ if (metadata.error !== void 0)
69518
+ endAttributes["error"] = truncateSpanError(metadata.error);
69519
+ }
69520
+ spanCtx.span.setAttributes(endAttributes);
69521
+ if (metadata?.error !== void 0) {
69522
+ spanCtx.span.setStatus({
69523
+ code: SpanStatusCode.ERROR,
69524
+ message: truncateSpanError(metadata.error)
69525
+ });
69526
+ }
69527
+ } catch (error) {
69528
+ debugLogger8.warn(
69529
+ `Failed to update hook span attributes/status: ${error instanceof Error ? error.message : String(error)}`
69530
+ );
69531
+ }
69532
+ try {
69533
+ spanCtx.span.end();
69534
+ } catch (error) {
69535
+ debugLogger8.warn(
69536
+ `Failed to end hook span: ${error instanceof Error ? error.message : String(error)}`
69537
+ );
69538
+ }
69539
+ activeSpans.delete(spanId);
69540
+ strongSpans.delete(spanId);
69541
+ }
69542
+ __name(endHookSpan, "endHookSpan");
69089
69543
  function getActiveInteractionSpan() {
69090
69544
  const ctx = interactionContext.getStore() ?? lastInteractionCtx;
69091
69545
  if (!ctx || ctx.ended) return void 0;
@@ -69173,11 +69627,33 @@ function initializeTelemetry(config) {
69173
69627
  return;
69174
69628
  }
69175
69629
  const debugLogger12 = createDebugLogger("OTEL");
69630
+ const userAttrs = config.getTelemetryResourceAttributes() ?? {};
69631
+ const userServiceName = userAttrs["service.name"];
69632
+ const {
69633
+ "service.name": _ignoredServiceName,
69634
+ "service.version": _ignoredServiceVersion,
69635
+ "session.id": _ignoredSessionId,
69636
+ ...nonReservedUserAttrs
69637
+ } = userAttrs;
69176
69638
  const resource = (0, import_resources2.resourceFromAttributes)({
69177
- [SemanticResourceAttributes.SERVICE_NAME]: SERVICE_NAME,
69178
- [SemanticResourceAttributes.SERVICE_VERSION]: config.getCliVersion() || "unknown",
69179
- "session.id": config.getSessionId()
69639
+ ...nonReservedUserAttrs,
69640
+ // `.trim() || SERVICE_NAME`: catches both empty string (`""`) and
69641
+ // whitespace-only values (`" "`, `"\t"`) that would otherwise produce
69642
+ // a blank service name on Resource (some backends reject these). Both
69643
+ // settings (no value trimming there) and env (`%20` decodes to `" "`)
69644
+ // can deliver whitespace-only values, so trim at the fallback point.
69645
+ [SemanticResourceAttributes.SERVICE_NAME]: userServiceName?.trim() || SERVICE_NAME,
69646
+ [SemanticResourceAttributes.SERVICE_VERSION]: config.getCliVersion() || "unknown"
69180
69647
  });
69648
+ const attrWarnings = config.getTelemetryResourceAttributeWarnings() ?? [];
69649
+ if (attrWarnings.length > 0) {
69650
+ console.warn(
69651
+ `[qwen-code telemetry] ${attrWarnings.length} resource attribute issue(s):`
69652
+ );
69653
+ for (const w of attrWarnings) {
69654
+ console.warn(` - ${w}`);
69655
+ }
69656
+ }
69181
69657
  const otlpEndpoint = config.getTelemetryOtlpEndpoint();
69182
69658
  const otlpProtocol = config.getTelemetryOtlpProtocol();
69183
69659
  const parsedEndpoint = parseOtlpEndpoint(otlpEndpoint, otlpProtocol);
@@ -69341,6 +69817,104 @@ __name(shutdownTelemetry, "shutdownTelemetry");
69341
69817
 
69342
69818
  // packages/core/src/telemetry/config.ts
69343
69819
  init_esbuild_shims();
69820
+
69821
+ // packages/core/src/telemetry/resource-attributes.ts
69822
+ init_esbuild_shims();
69823
+ init_esm();
69824
+ var RESERVED_RESOURCE_ATTRIBUTE_KEYS = /* @__PURE__ */ new Set([
69825
+ "service.version",
69826
+ "session.id"
69827
+ ]);
69828
+ function warn(msg, warnings) {
69829
+ diag.warn(msg);
69830
+ warnings?.push(msg);
69831
+ }
69832
+ __name(warn, "warn");
69833
+ function parseOtelResourceAttributes(raw, warnings) {
69834
+ if (!raw) return {};
69835
+ const out = {};
69836
+ for (const pair of raw.split(",")) {
69837
+ const trimmed = pair.trim();
69838
+ if (!trimmed) continue;
69839
+ const idx = trimmed.indexOf("=");
69840
+ if (idx < 0) {
69841
+ warn(
69842
+ `Skipping malformed OTEL_RESOURCE_ATTRIBUTES entry: "${trimmed}" (hint: percent-encode literal commas as %2C)`,
69843
+ warnings
69844
+ );
69845
+ continue;
69846
+ }
69847
+ const rawKey = trimmed.slice(0, idx).trim();
69848
+ if (!rawKey) continue;
69849
+ const valueRaw = trimmed.slice(idx + 1).trim();
69850
+ let key;
69851
+ try {
69852
+ key = decodeURIComponent(rawKey);
69853
+ } catch {
69854
+ warn(
69855
+ `Invalid percent-encoding in OTEL_RESOURCE_ATTRIBUTES key "${rawKey}", using raw key`,
69856
+ warnings
69857
+ );
69858
+ key = rawKey;
69859
+ }
69860
+ let value;
69861
+ try {
69862
+ value = decodeURIComponent(valueRaw);
69863
+ } catch {
69864
+ warn(
69865
+ `Invalid percent-encoding in OTEL_RESOURCE_ATTRIBUTES for key "${key}", using raw value`,
69866
+ warnings
69867
+ );
69868
+ value = valueRaw;
69869
+ }
69870
+ out[key] = value;
69871
+ }
69872
+ return out;
69873
+ }
69874
+ __name(parseOtelResourceAttributes, "parseOtelResourceAttributes");
69875
+ function stripReservedResourceAttributes(attrs, source, warnings) {
69876
+ for (const k of RESERVED_RESOURCE_ATTRIBUTE_KEYS) {
69877
+ if (k in attrs) {
69878
+ warn(`${source} cannot override reserved key "${k}"; ignoring`, warnings);
69879
+ delete attrs[k];
69880
+ }
69881
+ }
69882
+ return attrs;
69883
+ }
69884
+ __name(stripReservedResourceAttributes, "stripReservedResourceAttributes");
69885
+ function coerceStringResourceAttributes(raw, warnings) {
69886
+ if (raw === null || raw === void 0) return {};
69887
+ if (typeof raw !== "object" || Array.isArray(raw)) {
69888
+ warn(
69889
+ "settings.telemetry.resourceAttributes must be an object; ignoring",
69890
+ warnings
69891
+ );
69892
+ return {};
69893
+ }
69894
+ const out = {};
69895
+ for (const [k, v] of Object.entries(raw)) {
69896
+ const key = k.trim();
69897
+ if (!key) {
69898
+ warn(
69899
+ "settings.telemetry.resourceAttributes has an empty or whitespace-only key; ignoring",
69900
+ warnings
69901
+ );
69902
+ continue;
69903
+ }
69904
+ if (typeof v === "string") {
69905
+ out[key] = v;
69906
+ } else {
69907
+ warn(
69908
+ `settings.telemetry.resourceAttributes value for "${key}" must be a string (got ${typeof v}); ignoring`,
69909
+ warnings
69910
+ );
69911
+ }
69912
+ }
69913
+ return out;
69914
+ }
69915
+ __name(coerceStringResourceAttributes, "coerceStringResourceAttributes");
69916
+
69917
+ // packages/core/src/telemetry/config.ts
69344
69918
  function parseBooleanEnvFlag(value) {
69345
69919
  if (value === void 0) return void 0;
69346
69920
  return value === "true" || value === "1";
@@ -69391,6 +69965,33 @@ async function resolveTelemetrySettings(options) {
69391
69965
  const otlpTracesEndpoint = env["QWEN_TELEMETRY_OTLP_TRACES_ENDPOINT"] ?? env["OTEL_EXPORTER_OTLP_TRACES_ENDPOINT"] ?? settings.otlpTracesEndpoint;
69392
69966
  const otlpLogsEndpoint = env["QWEN_TELEMETRY_OTLP_LOGS_ENDPOINT"] ?? env["OTEL_EXPORTER_OTLP_LOGS_ENDPOINT"] ?? settings.otlpLogsEndpoint;
69393
69967
  const otlpMetricsEndpoint = env["QWEN_TELEMETRY_OTLP_METRICS_ENDPOINT"] ?? env["OTEL_EXPORTER_OTLP_METRICS_ENDPOINT"] ?? settings.otlpMetricsEndpoint;
69968
+ const resourceAttributeWarnings = [];
69969
+ const envResourceAttrs = stripReservedResourceAttributes(
69970
+ parseOtelResourceAttributes(
69971
+ env["OTEL_RESOURCE_ATTRIBUTES"],
69972
+ resourceAttributeWarnings
69973
+ ),
69974
+ "OTEL_RESOURCE_ATTRIBUTES",
69975
+ resourceAttributeWarnings
69976
+ );
69977
+ const settingsResourceAttrs = stripReservedResourceAttributes(
69978
+ coerceStringResourceAttributes(
69979
+ settings.resourceAttributes,
69980
+ resourceAttributeWarnings
69981
+ ),
69982
+ "settings.telemetry.resourceAttributes",
69983
+ resourceAttributeWarnings
69984
+ );
69985
+ const mergedResourceAttrs = {
69986
+ ...envResourceAttrs,
69987
+ ...settingsResourceAttrs
69988
+ };
69989
+ const otelServiceName = env["OTEL_SERVICE_NAME"]?.trim();
69990
+ if (otelServiceName) {
69991
+ mergedResourceAttrs["service.name"] = otelServiceName;
69992
+ }
69993
+ const resourceAttributes = Object.keys(mergedResourceAttrs).length ? mergedResourceAttrs : void 0;
69994
+ const metricsIncludeSessionId = parseBooleanEnvFlag(env["QWEN_TELEMETRY_METRICS_INCLUDE_SESSION_ID"]) ?? settings.metrics?.includeSessionId ?? false;
69394
69995
  return {
69395
69996
  enabled,
69396
69997
  target,
@@ -69401,7 +70002,10 @@ async function resolveTelemetrySettings(options) {
69401
70002
  otlpMetricsEndpoint,
69402
70003
  logPrompts,
69403
70004
  includeSensitiveSpanAttributes,
69404
- outfile
70005
+ outfile,
70006
+ resourceAttributes,
70007
+ metrics: { includeSessionId: metricsIncludeSessionId },
70008
+ resourceAttributeWarnings: resourceAttributeWarnings.length ? resourceAttributeWarnings : void 0
69405
70009
  };
69406
70010
  }
69407
70011
  __name(resolveTelemetrySettings, "resolveTelemetrySettings");
@@ -69614,6 +70218,7 @@ var LoggingContentGenerator = class {
69614
70218
  this.wrapped = wrapped;
69615
70219
  this.config = config;
69616
70220
  this.modalities = generatorConfig.modalities;
70221
+ this.generatorAuthType = generatorConfig.authType;
69617
70222
  if (generatorConfig.enableOpenAILogging) {
69618
70223
  this.openaiLogger = new OpenAILogger(
69619
70224
  generatorConfig.openAILoggingDir,
@@ -69628,6 +70233,7 @@ var LoggingContentGenerator = class {
69628
70233
  openaiLogger;
69629
70234
  schemaCompliance;
69630
70235
  modalities;
70236
+ generatorAuthType;
69631
70237
  getWrapped() {
69632
70238
  return this.wrapped;
69633
70239
  }
@@ -69651,7 +70257,7 @@ var LoggingContentGenerator = class {
69651
70257
  model,
69652
70258
  durationMs,
69653
70259
  prompt_id,
69654
- this.config.getAuthType(),
70260
+ this.generatorAuthType,
69655
70261
  usageMetadata,
69656
70262
  responseText,
69657
70263
  subagentNameContext.getStore()
@@ -69670,7 +70276,7 @@ var LoggingContentGenerator = class {
69670
70276
  model,
69671
70277
  durationMs,
69672
70278
  promptId: prompt_id,
69673
- authType: this.config.getAuthType(),
70279
+ authType: this.generatorAuthType,
69674
70280
  errorMessage,
69675
70281
  errorType,
69676
70282
  statusCode: errorStatus,
@@ -69710,6 +70316,10 @@ var LoggingContentGenerator = class {
69710
70316
  const isInternal = isInternalPromptId(userPromptId);
69711
70317
  const session = this.startCaptureSession();
69712
70318
  try {
70319
+ runtimeDiagnostics.recordGenerateContentRequest(req, {
70320
+ stream: false,
70321
+ source: "generateContent"
70322
+ });
69713
70323
  if (!isInternal) {
69714
70324
  addSystemPromptAttributes(
69715
70325
  this.config,
@@ -69801,6 +70411,10 @@ var LoggingContentGenerator = class {
69801
70411
  const session = this.startCaptureSession();
69802
70412
  let stream;
69803
70413
  try {
70414
+ runtimeDiagnostics.recordGenerateContentRequest(req, {
70415
+ stream: true,
70416
+ source: "generateContentStream"
70417
+ });
69804
70418
  if (!isInternal) {
69805
70419
  addSystemPromptAttributes(
69806
70420
  this.config,
@@ -69935,47 +70549,51 @@ var LoggingContentGenerator = class {
69935
70549
  const durationMs = Date.now() - startTime;
69936
70550
  const consolidatedResponse = shouldCollectResponses ? this.consolidateGeminiResponsesForLogging(responses) : void 0;
69937
70551
  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);
70552
+ if (!spanEndedByTimeout) {
70553
+ runInSpan(
70554
+ () => this.safelyLogApiResponse(
70555
+ firstResponseId,
70556
+ durationMs,
70557
+ firstModelVersion || model,
70558
+ userPromptId,
70559
+ lastUsageMetadata,
70560
+ streamResponseText
70561
+ )
70562
+ );
70563
+ if (!isInternal && span) {
70564
+ addModelOutputAttributes(this.config, span, streamResponseText);
70565
+ }
70566
+ await runInSpan(
70567
+ () => this.safelyLogOpenAIInteraction(
70568
+ openaiRequest,
70569
+ consolidatedResponse,
70570
+ void 0,
70571
+ userPromptId
70572
+ )
70573
+ );
69950
70574
  }
69951
- await runInSpan(
69952
- () => this.safelyLogOpenAIInteraction(
69953
- openaiRequest,
69954
- consolidatedResponse,
69955
- void 0,
69956
- userPromptId
69957
- )
69958
- );
69959
70575
  } catch (error) {
69960
70576
  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
- );
70577
+ if (!spanEndedByTimeout) {
70578
+ const durationMs = Date.now() - startTime;
70579
+ runInSpan(
70580
+ () => this.safelyLogApiError(
70581
+ firstResponseId,
70582
+ durationMs,
70583
+ error,
70584
+ firstModelVersion || model,
70585
+ userPromptId
70586
+ )
70587
+ );
70588
+ await runInSpan(
70589
+ () => this.safelyLogOpenAIInteraction(
70590
+ openaiRequest,
70591
+ void 0,
70592
+ error,
70593
+ userPromptId
70594
+ )
70595
+ );
70596
+ }
69979
70597
  throw error;
69980
70598
  } finally {
69981
70599
  if (spanEndTimeout !== void 0) {
@@ -71675,11 +72293,11 @@ async function createContentGenerator(generatorConfig, config, isInitialAuth) {
71675
72293
  }
71676
72294
  let baseGenerator;
71677
72295
  if (authType === "openai" /* USE_OPENAI */) {
71678
- const { createOpenAIContentGenerator } = await import("./openaiContentGenerator-3H7XOZBW.js");
72296
+ const { createOpenAIContentGenerator } = await import("./openaiContentGenerator-POYAZQ6I.js");
71679
72297
  baseGenerator = createOpenAIContentGenerator(generatorConfig, config);
71680
72298
  } else if (authType === "qwen-oauth" /* QWEN_OAUTH */) {
71681
- const { getQwenOAuthClient: getQwenOauthClient } = await import("./qwenOAuth2-JSQ7EPR3.js");
71682
- const { QwenContentGenerator } = await import("./qwenContentGenerator-FAU3QPYO.js");
72299
+ const { getQwenOAuthClient: getQwenOauthClient } = await import("./qwenOAuth2-EEJGROP7.js");
72300
+ const { QwenContentGenerator } = await import("./qwenContentGenerator-2E4H56DK.js");
71683
72301
  try {
71684
72302
  const qwenClient = await getQwenOauthClient(
71685
72303
  config,
@@ -71696,10 +72314,10 @@ async function createContentGenerator(generatorConfig, config, isInitialAuth) {
71696
72314
  );
71697
72315
  }
71698
72316
  } else if (authType === "anthropic" /* USE_ANTHROPIC */) {
71699
- const { createAnthropicContentGenerator } = await import("./anthropicContentGenerator-4QE6LTVV.js");
72317
+ const { createAnthropicContentGenerator } = await import("./anthropicContentGenerator-RQJNXJIY.js");
71700
72318
  baseGenerator = createAnthropicContentGenerator(generatorConfig, config);
71701
72319
  } else if (authType === "gemini" /* USE_GEMINI */ || authType === "vertex-ai" /* USE_VERTEX_AI */) {
71702
- const { createGeminiContentGenerator } = await import("./geminiContentGenerator-DYHZPKJX.js");
72320
+ const { createGeminiContentGenerator } = await import("./geminiContentGenerator-ZGPNBFDS.js");
71703
72321
  baseGenerator = createGeminiContentGenerator(generatorConfig, config);
71704
72322
  } else {
71705
72323
  throw new Error(
@@ -73520,7 +74138,9 @@ var ReadFileToolInvocation = class extends BaseToolInvocation {
73520
74138
  }
73521
74139
  if (useFastPath && stats && isFullRead) {
73522
74140
  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)) {
74141
+ 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
74142
+ // #4239: idle microcompaction flips this off when it blanks it).
74143
+ status.entry.readResidentInHistory && (status.entry.lastWriteAt === void 0 || status.entry.lastReadAt > status.entry.lastWriteAt)) {
73524
74144
  debugLogger11.debug("hit", { path: absPath });
73525
74145
  return this.unchangedResult(absPath);
73526
74146
  }
@@ -73552,7 +74172,7 @@ var ReadFileToolInvocation = class extends BaseToolInvocation {
73552
74172
  });
73553
74173
  }
73554
74174
  let llmContent;
73555
- if (result.isTruncated) {
74175
+ if (result.isTruncated && result.linesShown && result.originalLineCount !== void 0) {
73556
74176
  const [start, end] = result.linesShown;
73557
74177
  const total = result.originalLineCount;
73558
74178
  llmContent = `Showing lines ${start}-${end} of ${total} total lines.
@@ -73678,6 +74298,17 @@ var ReadFileTool = class _ReadFileTool extends BaseDeclarativeTool {
73678
74298
  if (params.limit !== void 0 && params.limit <= 0) {
73679
74299
  return "Limit must be a positive number";
73680
74300
  }
74301
+ if (params.pages !== void 0) {
74302
+ const pages = params.pages.trim();
74303
+ params.pages = pages.length > 0 ? pages : void 0;
74304
+ }
74305
+ const ext = path7.extname(filePath).toLowerCase();
74306
+ if ((params.offset !== void 0 || params.limit !== void 0) && ext === ".ipynb") {
74307
+ return "offset and limit are not supported for Jupyter notebook (.ipynb) files. Notebooks are always read in full with structured cell output.";
74308
+ }
74309
+ if (params.pages !== void 0 && ext === ".ipynb") {
74310
+ return "pages is not supported for Jupyter notebook (.ipynb) files. Notebooks are always read in full with structured cell output.";
74311
+ }
73681
74312
  if (params.pages) {
73682
74313
  const parsed = parsePDFPageRange(params.pages);
73683
74314
  if (!parsed) {
@@ -73711,6 +74342,7 @@ export {
73711
74342
  UiTelemetryService,
73712
74343
  uiTelemetryService,
73713
74344
  safeJsonStringify,
74345
+ require_safer,
73714
74346
  iconvEncode,
73715
74347
  iconvEncodingExists,
73716
74348
  isUtf8CompatibleEncoding,
@@ -73735,8 +74367,22 @@ export {
73735
74367
  getSystemEncoding,
73736
74368
  windowsCodePageToEncoding,
73737
74369
  detectEncodingFromBuffer,
74370
+ normalizeSource,
74371
+ parseNotebook,
74372
+ inferNotebookJsonFormat,
74373
+ serializeNotebook,
74374
+ getCellDisplayId,
74375
+ hasStableCellIds,
74376
+ isAmbiguousCellId,
74377
+ findCellIndex,
74378
+ getNotebookLanguage,
74379
+ makeCellId,
74380
+ inferInsertedCellSourceArrayStyle,
74381
+ toNotebookSource,
74382
+ normalizeEditedCell,
73738
74383
  DEFAULT_ENCODING,
73739
74384
  detectBOM,
74385
+ decodeBufferWithEncodingInfo,
73740
74386
  readFileWithEncodingInfo,
73741
74387
  readFileWithEncoding,
73742
74388
  countFileLines,
@@ -73790,6 +74436,7 @@ export {
73790
74436
  addModelOutputAttributes,
73791
74437
  addToolInputAttributes,
73792
74438
  addToolResultAttributes,
74439
+ truncateSpanError,
73793
74440
  startInteractionSpan,
73794
74441
  endInteractionSpan,
73795
74442
  startLLMRequestSpan,
@@ -73799,6 +74446,10 @@ export {
73799
74446
  endToolSpan,
73800
74447
  startToolExecutionSpan,
73801
74448
  endToolExecutionSpan,
74449
+ startToolBlockedOnUserSpan,
74450
+ endToolBlockedOnUserSpan,
74451
+ startHookSpan,
74452
+ endHookSpan,
73802
74453
  getActiveInteractionSpan,
73803
74454
  isTelemetrySdkInitialized,
73804
74455
  initializeTelemetry,
@@ -73900,6 +74551,7 @@ export {
73900
74551
  TaggedThinkingParser,
73901
74552
  OpenAIContentConverter,
73902
74553
  openaiRequestCaptureContext,
74554
+ resolveOpenAILogDir,
73903
74555
  OpenAILogger,
73904
74556
  openaiLogger,
73905
74557
  parseBooleanEnvFlag,
@@ -73908,6 +74560,7 @@ export {
73908
74560
  TelemetryTarget,
73909
74561
  DEFAULT_TELEMETRY_TARGET,
73910
74562
  DEFAULT_OTLP_ENDPOINT,
74563
+ defaultModalities,
73911
74564
  MODEL_GENERATION_CONFIG_FIELDS,
73912
74565
  AUTH_ENV_MAPPINGS,
73913
74566
  DEFAULT_MODELS,