@qwen-code/qwen-code 0.18.0-preview.1 → 0.18.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 (141) hide show
  1. package/bundled/qc-helper/SKILL.md +1 -2
  2. package/bundled/qc-helper/docs/_meta.ts +1 -0
  3. package/bundled/qc-helper/docs/configuration/settings.md +20 -24
  4. package/bundled/qc-helper/docs/features/_meta.ts +0 -3
  5. package/bundled/qc-helper/docs/features/approval-mode.md +10 -14
  6. package/bundled/qc-helper/docs/features/commands.md +47 -23
  7. package/bundled/qc-helper/docs/features/followup-suggestions.md +2 -2
  8. package/bundled/qc-helper/docs/features/scheduled-tasks.md +1 -1
  9. package/bundled/qc-helper/docs/features/sub-agents.md +60 -0
  10. package/bundled/qc-helper/docs/qwen-serve-deploy-local.md +221 -0
  11. package/bundled/qc-helper/docs/qwen-serve.md +234 -24
  12. package/chunks/{agent-SXS4NQWS.js → agent-LOTJK6AH.js} +25 -19
  13. package/chunks/agent-headless-TU3EPMYU.js +50 -0
  14. package/chunks/{anthropicContentGenerator-4QBVSFSJ.js → anthropicContentGenerator-2HBRNQ3B.js} +7 -7
  15. package/chunks/{askUserQuestion-NOOLRWCJ.js → askUserQuestion-OGCMIBQM.js} +45 -3
  16. package/chunks/{ca-WRHFBIDH.js → ca-BARBRL6N.js} +48 -1
  17. package/chunks/{chunk-JMLIPZUU.js → chunk-2Y5SYSD3.js} +361 -583
  18. package/chunks/chunk-3DHXZ6EV.js +241 -0
  19. package/chunks/{chunk-AVLOK27J.js → chunk-3HTIVKZE.js} +1 -1
  20. package/chunks/{chunk-BNESGOSJ.js → chunk-55ZMG67I.js} +1 -1
  21. package/chunks/chunk-64WXLC72.js +98 -0
  22. package/chunks/{chunk-F6FLCHCS.js → chunk-6YIUGZTC.js} +1069 -211
  23. package/chunks/{chunk-C6WMLUNB.js → chunk-72LDN5PP.js} +1 -1
  24. package/chunks/{chunk-ERREX2ES.js → chunk-7BCMOPIM.js} +64 -24
  25. package/chunks/{chunk-6VFG3EUJ.js → chunk-A7B4ISQP.js} +1 -1
  26. package/chunks/{chunk-F5ORN4YO.js → chunk-B7HXHOHU.js} +1 -1
  27. package/chunks/{chunk-5RNZ2QKF.js → chunk-BIVG75CP.js} +1 -1
  28. package/chunks/{chunk-MVX64PNU.js → chunk-EYENRK4D.js} +1 -1
  29. package/chunks/{chunk-SZOEIL6S.js → chunk-H6BD2ELD.js} +1 -0
  30. package/chunks/{chunk-SCHRFI7O.js → chunk-HLPLOD42.js} +1 -1
  31. package/chunks/{chunk-R5PDRHEF.js → chunk-HR7SV7AY.js} +68 -47
  32. package/chunks/{chunk-JSYEZAYV.js → chunk-IDX6COTE.js} +2 -2
  33. package/chunks/{chunk-6KH2Q7XN.js → chunk-IWAYOW5Q.js} +17482 -11669
  34. package/chunks/chunk-J5MDQKJL.js +2230 -0
  35. package/chunks/{chunk-USE2VQ5P.js → chunk-JTQAQBTV.js} +21 -0
  36. package/chunks/{chunk-ZW7GBCRE.js → chunk-LBP46COL.js} +1014 -163
  37. package/chunks/chunk-LD2XBG6Z.js +102 -0
  38. package/chunks/{chunk-KOA52UTF.js → chunk-LEJ42GNY.js} +14 -14
  39. package/chunks/{chunk-D46KOV3C.js → chunk-M6VTDSVR.js} +1 -1
  40. package/chunks/{chunk-SHUT5MQY.js → chunk-MFBBBTNY.js} +1 -1
  41. package/chunks/{chunk-PLYZAP4W.js → chunk-OHEGWO4L.js} +101 -23
  42. package/chunks/{chunk-NQZ33PWX.js → chunk-PL3MVCWD.js} +11 -11
  43. package/chunks/chunk-QQDPRDVW.js +25 -0
  44. package/chunks/chunk-R7ODSGTK.js +159 -0
  45. package/chunks/{chunk-GBEPNWYB.js → chunk-SEGYWKIH.js} +1 -1
  46. package/chunks/chunk-SKBPNJEW.js +45 -0
  47. package/chunks/{chunk-UABFCMPA.js → chunk-SNGELLWX.js} +3 -1
  48. package/chunks/chunk-XBY7E2FX.js +605 -0
  49. package/chunks/{chunk-G763GDO6.js → chunk-XV4HCEVI.js} +36 -3
  50. package/chunks/{chunk-WFVXF3OM.js → chunk-Z2Z3GUXZ.js} +1 -0
  51. package/chunks/{chunk-BBTV54KB.js → chunk-ZTZ4DDQE.js} +2 -2
  52. package/chunks/{computer-use-CT6MU6P3.js → computer-use-3RH2DOM6.js} +25 -19
  53. package/chunks/contextCommand-K347QT6O.js +52 -0
  54. package/chunks/{cron-create-PIPMXQN4.js → cron-create-YJL3KFWI.js} +3 -3
  55. package/chunks/{cron-delete-6Y5XIDMS.js → cron-delete-WKWSJZQA.js} +3 -3
  56. package/chunks/{cron-list-A4WNRUWZ.js → cron-list-B52XEXAZ.js} +3 -3
  57. package/chunks/{de-M5RPB2NB.js → de-YGKK2BC4.js} +48 -1
  58. package/chunks/{devtools-IXE4UP72.js → devtools-FM6GJPYG.js} +1 -1
  59. package/chunks/{dist-R2SXPG74.js → dist-4LXD6L6X.js} +2 -2
  60. package/chunks/{dist-TE5QKMGR.js → dist-H6ONXVLG.js} +1 -1
  61. package/chunks/{dist-ZMQ4TXD5.js → dist-KAZ3SEBX.js} +2 -2
  62. package/chunks/{dist-BXDUQ2QY.js → dist-PK7DFCAW.js} +1 -1
  63. package/chunks/{edit-A4YK7AIB.js → edit-KU4PJGEX.js} +26 -20
  64. package/chunks/{en-UMYKQAZE.js → en-DHGYHIHX.js} +77 -2
  65. package/chunks/{enter-worktree-VNEQINLC.js → enter-worktree-PPYIDCWI.js} +25 -19
  66. package/chunks/enterPlanMode-5CZDMCB4.js +158 -0
  67. package/chunks/{exit-worktree-AVSMXC33.js → exit-worktree-UY3CGHKC.js} +25 -19
  68. package/chunks/exitPlanMode-3DN4QNSG.js +703 -0
  69. package/chunks/{fr-MPYXXXPW.js → fr-JXBKPJKQ.js} +48 -1
  70. package/chunks/{geminiContentGenerator-CR2WGARL.js → geminiContentGenerator-7A6I2RWB.js} +7 -7
  71. package/chunks/{getMachineId-bsd-F7GNPTER.js → getMachineId-bsd-4CASPIU4.js} +1 -1
  72. package/chunks/{getMachineId-darwin-T73DJL27.js → getMachineId-darwin-HPQPEMZR.js} +1 -1
  73. package/chunks/{getMachineId-linux-MKQTFPQM.js → getMachineId-linux-AUARKYHL.js} +1 -1
  74. package/chunks/{getMachineId-unsupported-MUR5KOQE.js → getMachineId-unsupported-S32ZDA2T.js} +1 -1
  75. package/chunks/{getMachineId-win-CDYFC6ZM.js → getMachineId-win-4EFLHYIJ.js} +1 -1
  76. package/chunks/{glob-5V32KOG5.js → glob-OFNQSS52.js} +25 -19
  77. package/chunks/{grep-PUTEPBR4.js → grep-6J2MSUM5.js} +28 -19
  78. package/chunks/{ja-NFZ32AB3.js → ja-TGPZSP2B.js} +48 -1
  79. package/chunks/{keychain-token-storage-UHGOCDD6.js → keychain-token-storage-6IU6ORQN.js} +3 -3
  80. package/chunks/{ls-34DLNYCD.js → ls-V3O6A5PT.js} +4 -4
  81. package/chunks/{lsp-NCDEHH3V.js → lsp-G2OCIFUA.js} +3 -3
  82. package/chunks/{monitor-EJBR5VCR.js → monitor-FKLHV423.js} +25 -19
  83. package/chunks/{notebook-edit-DZHGPP2L.js → notebook-edit-KTBYFKWG.js} +26 -20
  84. package/chunks/{openaiContentGenerator-4QNV3CHM.js → openaiContentGenerator-L5KSWQY7.js} +15 -14
  85. package/chunks/{pt-BR43FRBA.js → pt-TIBG6BIO.js} +48 -1
  86. package/chunks/{qwenContentGenerator-3XOCEMQO.js → qwenContentGenerator-PYOXLMBW.js} +27 -21
  87. package/chunks/{qwenOAuth2-KRJT35QH.js → qwenOAuth2-2KCKWDCF.js} +6 -5
  88. package/chunks/{read-file-VZ2SQQIX.js → read-file-JQVRK4NU.js} +11 -11
  89. package/chunks/ripGrep-2L4LPNAJ.js +48 -0
  90. package/chunks/{ru-DQCW2KHD.js → ru-JBCHCK4L.js} +48 -1
  91. package/chunks/{scheduler-H32DZVDV.js → scheduler-FGNXY4JQ.js} +25 -19
  92. package/chunks/send-message-SZFWNOCL.js +244 -0
  93. package/chunks/{serve-56G4B5W6.js → serve-N2IBLA3G.js} +13592 -4979
  94. package/chunks/{shell-Q77KNP4N.js → shell-PTEG6UX4.js} +25 -19
  95. package/chunks/{skill-CLWFJYBG.js → skill-X4NTK4NH.js} +64 -113
  96. package/chunks/{src-47L2LUOU.js → src-GLLQ3R5W.js} +307 -32
  97. package/chunks/{syntheticOutput-T5SWX3YF.js → syntheticOutput-IKAY5F6X.js} +4 -4
  98. package/chunks/task-create-MQICOJFV.js +19 -0
  99. package/chunks/task-list-RIHJCH32.js +151 -0
  100. package/chunks/{task-stop-3VHAQMYM.js → task-stop-FWZRFANS.js} +3 -3
  101. package/chunks/task-update-2LHPXOYM.js +408 -0
  102. package/chunks/team-create-2E4PF4KN.js +314 -0
  103. package/chunks/team-delete-DAUDQS4J.js +116 -0
  104. package/chunks/{todoWrite-EAGJGKO5.js → todoWrite-HTUACZES.js} +5 -5
  105. package/chunks/{tool-search-Q75AYDTP.js → tool-search-KTVULRES.js} +11 -11
  106. package/chunks/{web-fetch-SS6IKK6N.js → web-fetch-CZ7LLKPE.js} +5 -5
  107. package/chunks/workflow-L2ZUUDT2.js +960 -0
  108. package/chunks/{write-file-RENGC25N.js → write-file-ZEB2JDYH.js} +26 -20
  109. package/chunks/{zh-6VFXOAR5.js → zh-7H5OQC4I.js} +82 -7
  110. package/chunks/{zh-TW-IQZ4AD5M.js → zh-TW-P4IDHD3M.js} +79 -7
  111. package/cli.js +11248 -5119
  112. package/examples/agent/qwen-extension.json +1 -0
  113. package/examples/commands/qwen-extension.json +1 -0
  114. package/examples/context/qwen-extension.json +1 -0
  115. package/examples/mcp-server/qwen-extension.json +1 -0
  116. package/examples/skills/qwen-extension.json +1 -0
  117. package/examples/starter/QWEN.md +30 -0
  118. package/examples/starter/README.md +59 -0
  119. package/examples/starter/agents/diary.md +86 -0
  120. package/examples/starter/commands/writing/polish.md +13 -0
  121. package/examples/starter/example.ts +64 -0
  122. package/examples/starter/package.json +18 -0
  123. package/examples/starter/qwen-extension.json +12 -0
  124. package/examples/starter/skills/synonyms/SKILL.md +48 -0
  125. package/examples/starter/tsconfig.json +13 -0
  126. package/fzfWorker.js +1083 -0
  127. package/locales/ca.js +51 -0
  128. package/locales/de.js +51 -0
  129. package/locales/en.js +89 -2
  130. package/locales/fr.js +53 -2
  131. package/locales/ja.js +52 -2
  132. package/locales/pt.js +52 -2
  133. package/locales/ru.js +53 -2
  134. package/locales/zh-TW.js +90 -11
  135. package/locales/zh.js +94 -11
  136. package/package.json +3 -2
  137. package/bundled/qc-helper/docs/features/checkpointing.md +0 -77
  138. package/chunks/contextCommand-YODJQYIV.js +0 -46
  139. package/chunks/exitPlanMode-5SQYVROD.js +0 -229
  140. package/chunks/ripGrep-SBIZCPOL.js +0 -42
  141. package/chunks/send-message-YYF56TS7.js +0 -151
@@ -2,7 +2,7 @@
2
2
  "use strict";
3
3
  import {
4
4
  getGlobalQwenDir
5
- } from "./chunk-USE2VQ5P.js";
5
+ } from "./chunk-JTQAQBTV.js";
6
6
  import {
7
7
  init_esbuild_shims
8
8
  } from "./chunk-A4BMJM77.js";
@@ -2,16 +2,19 @@
2
2
  "use strict";
3
3
  import {
4
4
  RequestTokenizer
5
- } from "./chunk-BBTV54KB.js";
5
+ } from "./chunk-ZTZ4DDQE.js";
6
6
  import {
7
7
  OpenAIContentConverter,
8
8
  TaggedThinkingParser,
9
9
  openaiRequestCaptureContext
10
- } from "./chunk-F6FLCHCS.js";
10
+ } from "./chunk-6YIUGZTC.js";
11
+ import {
12
+ createChildAbortController
13
+ } from "./chunk-64WXLC72.js";
11
14
  import {
12
15
  buildRuntimeFetchOptions,
13
16
  redactProxyError
14
- } from "./chunk-MVX64PNU.js";
17
+ } from "./chunk-EYENRK4D.js";
15
18
  import {
16
19
  CAPPED_DEFAULT_MAX_TOKENS,
17
20
  DASHSCOPE_PROXY_BASE_URL,
@@ -22,14 +25,14 @@ import {
22
25
  runtimeDiagnostics,
23
26
  safeJsonParse,
24
27
  tokenLimit
25
- } from "./chunk-D46KOV3C.js";
28
+ } from "./chunk-M6VTDSVR.js";
26
29
  import {
27
30
  GenerateContentResponse
28
- } from "./chunk-BNESGOSJ.js";
31
+ } from "./chunk-55ZMG67I.js";
29
32
  import {
30
33
  createDebugLogger,
31
34
  isAbortError
32
- } from "./chunk-R5PDRHEF.js";
35
+ } from "./chunk-HR7SV7AY.js";
33
36
  import {
34
37
  init_esbuild_shims
35
38
  } from "./chunk-A4BMJM77.js";
@@ -7944,17 +7947,23 @@ var ContentGenerationPipeline = class {
7944
7947
  userPromptId,
7945
7948
  false,
7946
7949
  async (openaiRequest, context) => {
7947
- const openaiResponse = await this.client.chat.completions.create(
7948
- openaiRequest,
7949
- {
7950
- signal: request.config?.abortSignal
7951
- }
7952
- );
7953
- const geminiResponse = OpenAIContentConverter.convertOpenAIResponseToGemini(
7954
- openaiResponse,
7955
- context
7956
- );
7957
- return geminiResponse;
7950
+ const parentSignal = request.config?.abortSignal;
7951
+ const perRequestAc = parentSignal ? createChildAbortController(parentSignal) : void 0;
7952
+ try {
7953
+ const openaiResponse = await this.client.chat.completions.create(
7954
+ openaiRequest,
7955
+ {
7956
+ signal: perRequestAc?.signal
7957
+ }
7958
+ );
7959
+ const geminiResponse = OpenAIContentConverter.convertOpenAIResponseToGemini(
7960
+ openaiResponse,
7961
+ context
7962
+ );
7963
+ return geminiResponse;
7964
+ } finally {
7965
+ perRequestAc?.abort();
7966
+ }
7958
7967
  }
7959
7968
  );
7960
7969
  }
@@ -7964,13 +7973,35 @@ var ContentGenerationPipeline = class {
7964
7973
  userPromptId,
7965
7974
  true,
7966
7975
  async (openaiRequest, context) => {
7967
- const stream = await this.client.chat.completions.create(
7968
- openaiRequest,
7969
- {
7970
- signal: request.config?.abortSignal
7971
- }
7976
+ const parentSignal = request.config?.abortSignal;
7977
+ const perRequestAc = parentSignal ? createChildAbortController(parentSignal) : void 0;
7978
+ let stream;
7979
+ try {
7980
+ stream = await this.client.chat.completions.create(openaiRequest, {
7981
+ signal: perRequestAc?.signal
7982
+ });
7983
+ } catch (e) {
7984
+ perRequestAc?.abort();
7985
+ throw e;
7986
+ }
7987
+ if (!perRequestAc) {
7988
+ return this.processStreamWithLogging(stream, context, request);
7989
+ }
7990
+ const ac = perRequestAc;
7991
+ const innerStream = this.processStreamWithLogging(
7992
+ stream,
7993
+ context,
7994
+ request
7972
7995
  );
7973
- return this.processStreamWithLogging(stream, context, request);
7996
+ async function* drainThenCleanup() {
7997
+ try {
7998
+ yield* innerStream;
7999
+ } finally {
8000
+ ac.abort();
8001
+ }
8002
+ }
8003
+ __name(drainThenCleanup, "drainThenCleanup");
8004
+ return drainThenCleanup();
7974
8005
  }
7975
8006
  );
7976
8007
  }
@@ -8096,6 +8127,8 @@ var ContentGenerationPipeline = class {
8096
8127
  if (isStreaming) {
8097
8128
  baseRequest.stream = true;
8098
8129
  baseRequest.stream_options = { include_usage: true };
8130
+ } else {
8131
+ baseRequest.stream = false;
8099
8132
  }
8100
8133
  if (request.config?.tools && request.config.tools.length > 0) {
8101
8134
  baseRequest.tools = await OpenAIContentConverter.convertGeminiToolsToOpenAI(
@@ -8219,7 +8252,14 @@ var ContentGenerationPipeline = class {
8219
8252
  model: effectiveModel,
8220
8253
  modalities: this.contentGeneratorConfig.modalities ?? {},
8221
8254
  startTime: Date.now(),
8222
- splitToolMedia: providerOverrides.splitToolMedia ?? this.contentGeneratorConfig.splitToolMedia ?? false,
8255
+ splitToolMedia: providerOverrides.splitToolMedia ?? this.contentGeneratorConfig.splitToolMedia ?? // Default true: the OpenAI Chat Completions spec only permits text on
8256
+ // `role: "tool"` messages, so tool-returned media (e.g. an image read
8257
+ // by read_file) embedded there is silently dropped or rejected by
8258
+ // strict providers (doubao / new-api / LM Studio) and the model never
8259
+ // sees it (QwenLM/qwen-code#4876). Splitting it into a follow-up user
8260
+ // message is spec-compliant and safe for permissive providers too.
8261
+ // Opt out via generationConfig.splitToolMedia = false.
8262
+ true,
8223
8263
  ...toolCallParser ? { toolCallParser } : {},
8224
8264
  ...responseParsingOptions ? { responseParsingOptions } : {},
8225
8265
  ...taggedThinkingParser ? { taggedThinkingParser } : {}
@@ -2,7 +2,7 @@
2
2
  "use strict";
3
3
  import {
4
4
  createDebugLogger
5
- } from "./chunk-R5PDRHEF.js";
5
+ } from "./chunk-HR7SV7AY.js";
6
6
  import {
7
7
  init_esbuild_shims
8
8
  } from "./chunk-A4BMJM77.js";
@@ -3,7 +3,7 @@
3
3
  import {
4
4
  createDebugLogger,
5
5
  isNodeError
6
- } from "./chunk-R5PDRHEF.js";
6
+ } from "./chunk-HR7SV7AY.js";
7
7
  import {
8
8
  init_esbuild_shims
9
9
  } from "./chunk-A4BMJM77.js";
@@ -5,7 +5,7 @@ import {
5
5
  BaseToolInvocation,
6
6
  ToolDisplayNames,
7
7
  ToolNames
8
- } from "./chunk-G763GDO6.js";
8
+ } from "./chunk-XV4HCEVI.js";
9
9
  import {
10
10
  init_esbuild_shims
11
11
  } from "./chunk-A4BMJM77.js";
@@ -2,7 +2,7 @@
2
2
  "use strict";
3
3
  import {
4
4
  createDebugLogger
5
- } from "./chunk-R5PDRHEF.js";
5
+ } from "./chunk-HR7SV7AY.js";
6
6
  import {
7
7
  init_esbuild_shims
8
8
  } from "./chunk-A4BMJM77.js";
@@ -31,5 +31,6 @@ var wrapper_default = import_websocket.default;
31
31
 
32
32
  export {
33
33
  import_websocket,
34
+ import_websocket_server,
34
35
  wrapper_default
35
36
  };
@@ -5,7 +5,7 @@ import {
5
5
  } from "./chunk-OFEVLU4C.js";
6
6
  import {
7
7
  SchemaValidator
8
- } from "./chunk-G763GDO6.js";
8
+ } from "./chunk-XV4HCEVI.js";
9
9
  import {
10
10
  init_esbuild_shims
11
11
  } from "./chunk-A4BMJM77.js";
@@ -2,8 +2,9 @@
2
2
  "use strict";
3
3
  import {
4
4
  init_esm,
5
+ isSpanContextValid,
5
6
  trace
6
- } from "./chunk-WFVXF3OM.js";
7
+ } from "./chunk-Z2Z3GUXZ.js";
7
8
  import {
8
9
  init_esbuild_shims
9
10
  } from "./chunk-A4BMJM77.js";
@@ -648,12 +649,6 @@ var Storage = class _Storage {
648
649
  getProjectRoot() {
649
650
  return this.targetDir;
650
651
  }
651
- getHistoryDir() {
652
- const hash = getProjectHash(this.getProjectRoot());
653
- const historyDir = path2.join(_Storage.getRuntimeBaseDir(), "history");
654
- const targetDir = path2.join(historyDir, hash);
655
- return targetDir;
656
- }
657
652
  getWorkspaceSettingsPath() {
658
653
  return path2.join(this.getQwenDir(), "settings.json");
659
654
  }
@@ -729,13 +724,9 @@ async function updateSymlink(linkPath, targetPath, options) {
729
724
  }
730
725
  __name(updateSymlink, "updateSymlink");
731
726
 
732
- // packages/core/src/utils/debugLogger.ts
727
+ // packages/core/src/telemetry/trace-context.ts
733
728
  init_esbuild_shims();
734
729
  init_esm();
735
- import { promises as fs4 } from "node:fs";
736
- import path4 from "node:path";
737
- import { AsyncLocalStorage as AsyncLocalStorage2 } from "node:async_hooks";
738
- import util from "node:util";
739
730
 
740
731
  // packages/core/src/telemetry/session-context.ts
741
732
  init_esbuild_shims();
@@ -755,7 +746,63 @@ function getCurrentSessionId() {
755
746
  }
756
747
  __name(getCurrentSessionId, "getCurrentSessionId");
757
748
 
749
+ // packages/core/src/telemetry/trace-context.ts
750
+ function extractTraceContext(span) {
751
+ const ctx = span?.spanContext();
752
+ if (ctx && isSpanContextValid(ctx)) {
753
+ return {
754
+ traceId: ctx.traceId,
755
+ spanId: ctx.spanId,
756
+ traceFlags: ctx.traceFlags
757
+ };
758
+ }
759
+ return null;
760
+ }
761
+ __name(extractTraceContext, "extractTraceContext");
762
+ function getActiveSpanTraceContext() {
763
+ try {
764
+ return extractTraceContext(trace.getActiveSpan());
765
+ } catch {
766
+ return null;
767
+ }
768
+ }
769
+ __name(getActiveSpanTraceContext, "getActiveSpanTraceContext");
770
+ function getSessionRootTraceContext() {
771
+ try {
772
+ const sessionCtx = getSessionContext();
773
+ return extractTraceContext(
774
+ sessionCtx ? trace.getSpan(sessionCtx) : void 0
775
+ );
776
+ } catch {
777
+ return null;
778
+ }
779
+ }
780
+ __name(getSessionRootTraceContext, "getSessionRootTraceContext");
781
+ function getTraceContext() {
782
+ return getActiveSpanTraceContext() ?? getSessionRootTraceContext();
783
+ }
784
+ __name(getTraceContext, "getTraceContext");
785
+ function formatTraceparent(ctx) {
786
+ const flags = (ctx.traceFlags & 255).toString(16).padStart(2, "0");
787
+ return `00-${ctx.traceId}-${ctx.spanId}-${flags}`;
788
+ }
789
+ __name(formatTraceparent, "formatTraceparent");
790
+ var shellTracePropagationEnabled = false;
791
+ function setShellTracePropagation(enabled) {
792
+ shellTracePropagationEnabled = enabled;
793
+ }
794
+ __name(setShellTracePropagation, "setShellTracePropagation");
795
+ function isShellTracePropagationEnabled() {
796
+ return shellTracePropagationEnabled;
797
+ }
798
+ __name(isShellTracePropagationEnabled, "isShellTracePropagationEnabled");
799
+
758
800
  // packages/core/src/utils/debugLogger.ts
801
+ init_esbuild_shims();
802
+ import { promises as fs4 } from "node:fs";
803
+ import path4 from "node:path";
804
+ import { AsyncLocalStorage as AsyncLocalStorage2 } from "node:async_hooks";
805
+ import util from "node:util";
759
806
  var ensureDebugDirPromise = null;
760
807
  var ensuredDebugDirPath = null;
761
808
  var hasWriteFailure = false;
@@ -794,40 +841,6 @@ function formatArgs(args) {
794
841
  }).map((arg) => typeof arg === "string" ? arg : util.inspect(arg)).join(" ");
795
842
  }
796
843
  __name(formatArgs, "formatArgs");
797
- var ZERO_TRACE_ID = "00000000000000000000000000000000";
798
- function getActiveSpanTraceContext() {
799
- try {
800
- const activeSpan = trace.getActiveSpan();
801
- if (activeSpan) {
802
- const ctx = activeSpan.spanContext();
803
- if (ctx.traceId !== ZERO_TRACE_ID) {
804
- return { traceId: ctx.traceId, spanId: ctx.spanId };
805
- }
806
- }
807
- return null;
808
- } catch {
809
- return null;
810
- }
811
- }
812
- __name(getActiveSpanTraceContext, "getActiveSpanTraceContext");
813
- function getSessionRootTraceContext() {
814
- try {
815
- const sessionContext2 = getSessionContext();
816
- const sessionSpan = sessionContext2 ? trace.getSpan(sessionContext2) : null;
817
- const ctx = sessionSpan?.spanContext();
818
- if (ctx && ctx.traceId !== ZERO_TRACE_ID) {
819
- return { traceId: ctx.traceId, spanId: ctx.spanId };
820
- }
821
- return null;
822
- } catch {
823
- return null;
824
- }
825
- }
826
- __name(getSessionRootTraceContext, "getSessionRootTraceContext");
827
- function getTraceContext() {
828
- return getActiveSpanTraceContext() ?? getSessionRootTraceContext();
829
- }
830
- __name(getTraceContext, "getTraceContext");
831
844
  function buildLogLine(level, message, tag, traceCtx) {
832
845
  const timestamp = (/* @__PURE__ */ new Date()).toISOString();
833
846
  const tagPart = tag ? ` [${tag}]` : "";
@@ -950,8 +963,11 @@ export {
950
963
  Storage,
951
964
  updateSymlink,
952
965
  setSessionContext,
953
- getSessionContext,
954
966
  getCurrentSessionId,
967
+ getTraceContext,
968
+ formatTraceparent,
969
+ setShellTracePropagation,
970
+ isShellTracePropagationEnabled,
955
971
  isDebugLoggingDegraded,
956
972
  resetDebugLoggingState,
957
973
  setDebugLogSession,
@@ -968,3 +984,8 @@ export {
968
984
  * Copyright 2025 Qwen Code
969
985
  * SPDX-License-Identifier: Apache-2.0
970
986
  */
987
+ /**
988
+ * @license
989
+ * Copyright 2025 Qwen
990
+ * SPDX-License-Identifier: Apache-2.0
991
+ */
@@ -2,11 +2,11 @@
2
2
  "use strict";
3
3
  import {
4
4
  atomicWriteFileSync
5
- } from "./chunk-F5ORN4YO.js";
5
+ } from "./chunk-B7HXHOHU.js";
6
6
  import {
7
7
  Storage,
8
8
  createDebugLogger
9
- } from "./chunk-R5PDRHEF.js";
9
+ } from "./chunk-HR7SV7AY.js";
10
10
  import {
11
11
  init_esbuild_shims
12
12
  } from "./chunk-A4BMJM77.js";