@qwen-code/qwen-code 0.21.12-preview.3 → 0.21.12

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 (348) hide show
  1. package/bundled/qc-helper/docs/configuration/settings.md +10 -0
  2. package/bundled/qc-helper/docs/features/channels/overview.md +1 -1
  3. package/bundled/qc-helper/docs/features/channels/plugins.md +11 -11
  4. package/bundled/qc-helper/docs/features/code-review.md +1 -1
  5. package/bundled/qc-helper/docs/qwen-serve.md +99 -34
  6. package/bundled/review/SKILL.md +55 -36
  7. package/chunks/{MaxSizedBox-EIK4BHBQ.js → MaxSizedBox-ZSJJ2D5S.js} +46 -46
  8. package/chunks/{StandaloneSessionPicker-NHVJDRYD.js → StandaloneSessionPicker-WHUHQXSA.js} +65 -66
  9. package/chunks/{acp-startup-profiler-JMJBZDVO.js → acp-startup-profiler-SVPUHLXV.js} +2 -2
  10. package/chunks/{acpAgent-37UDZP64.js → acpAgent-7JOAESF5.js} +960 -539
  11. package/chunks/{agent-FAWBG7PP.js → agent-E6V3VXQR.js} +42 -42
  12. package/chunks/{agent-headless-SHK4PCCH.js → agent-headless-OEQNFOMH.js} +42 -42
  13. package/chunks/{anthropicContentGenerator-4JSC3ZFL.js → anthropicContentGenerator-YDT4EOKO.js} +25 -25
  14. package/chunks/{artifact-tool-FRMBPDPB.js → artifact-tool-4GCQQDZI.js} +5 -5
  15. package/chunks/{askUserQuestion-7G3LI3IZ.js → askUserQuestion-HZJJLR3Z.js} +2 -2
  16. package/chunks/{bridge-DEAYNDCI.js → bridge-NPBV53UA.js} +49 -49
  17. package/chunks/{build-RZS65IIX.js → build-GDBLPA24.js} +1 -1
  18. package/chunks/{channel-management-service-SKAN6NOB.js → channel-management-service-OADNGQM3.js} +4 -4
  19. package/chunks/{channel-settings-store-UIGYER6R.js → channel-settings-store-4ODLJ4X2.js} +49 -49
  20. package/chunks/{channel-worker-group-YPTB5ASD.js → channel-worker-group-IHBIHQ45.js} +7 -7
  21. package/chunks/{channel-worker-manager-4EHJSPRH.js → channel-worker-manager-GEHYJ5AE.js} +7 -7
  22. package/chunks/{channel-worker-supervisor-DZKHYFHV.js → channel-worker-supervisor-ZJIIWM4I.js} +5 -5
  23. package/chunks/{chunk-LHOG4E6Y.js → chunk-22C7BQ6D.js} +3 -3
  24. package/chunks/{chunk-DP3IHZGG.js → chunk-2AUM35J5.js} +59 -7
  25. package/chunks/{chunk-2SB4SLKC.js → chunk-2IIJTXYF.js} +1 -3
  26. package/chunks/{chunk-DYVCDQW2.js → chunk-2IVYL3IF.js} +1 -1
  27. package/chunks/{chunk-EYW54TBD.js → chunk-2ZWH53I4.js} +3 -3
  28. package/chunks/{chunk-5I5NMQCU.js → chunk-36XKGB7E.js} +3 -3
  29. package/chunks/{chunk-AQHNAA7E.js → chunk-3AEKDXKT.js} +1 -1
  30. package/chunks/{chunk-M6SXIXBV.js → chunk-3GDBZJD6.js} +6 -6
  31. package/chunks/{chunk-6XZERB6P.js → chunk-3GM5DLBI.js} +5 -5
  32. package/chunks/{chunk-4M2F7OG7.js → chunk-3LDGOQXZ.js} +6 -6
  33. package/chunks/{chunk-BKHCW2BI.js → chunk-3VUENPWF.js} +10 -0
  34. package/chunks/{chunk-ENEEQMGM.js → chunk-45NQKMYB.js} +1 -1
  35. package/chunks/{chunk-MDFUBQAQ.js → chunk-47BGDLJG.js} +119 -27
  36. package/chunks/{chunk-EFIMD5VA.js → chunk-4AOVQPJU.js} +1 -1
  37. package/chunks/{chunk-HB6QW4LM.js → chunk-4KM2SYK5.js} +19 -16
  38. package/chunks/{chunk-UNCIELQJ.js → chunk-4XA4QIUA.js} +1 -1
  39. package/chunks/{chunk-2J53A6MV.js → chunk-56HVDG3M.js} +4 -4
  40. package/chunks/{chunk-N3FJOQX7.js → chunk-5AFGJNY6.js} +4 -4
  41. package/chunks/{chunk-2AZMF6G5.js → chunk-5RUCD4ED.js} +2 -2
  42. package/chunks/{chunk-32VOOMEF.js → chunk-62X3CM7Q.js} +7 -7
  43. package/chunks/{chunk-6LYDH7VT.js → chunk-63FNZTWG.js} +2 -2
  44. package/chunks/{chunk-P64FPV3G.js → chunk-6JEIRPLN.js} +47 -4
  45. package/chunks/{chunk-O5G7IQGM.js → chunk-6P5EXEBL.js} +499 -112
  46. package/chunks/{chunk-3ZYX7AUR.js → chunk-6SPD4Z7F.js} +1 -1
  47. package/chunks/{chunk-YZJVVQD3.js → chunk-6ZKSO6K7.js} +7 -7
  48. package/chunks/{chunk-N5ULBHP3.js → chunk-7KJPO7YH.js} +2 -2
  49. package/chunks/{chunk-MZSJ43WV.js → chunk-7U5G6JXI.js} +24 -2
  50. package/chunks/{chunk-K7JW6V5O.js → chunk-A6NRNRKE.js} +1 -1
  51. package/chunks/{chunk-XLQS3VI6.js → chunk-AKBFSOC5.js} +2 -2
  52. package/chunks/{chunk-LT532KF4.js → chunk-AW27A43Y.js} +10 -12
  53. package/chunks/{chunk-M4NWDIFU.js → chunk-AZQ3DT76.js} +1 -1
  54. package/chunks/{chunk-4GLFFNP3.js → chunk-B4VN3VDH.js} +5 -5
  55. package/chunks/{chunk-YTYPRVIZ.js → chunk-BSR5AXZR.js} +4 -3
  56. package/chunks/{chunk-AJX4ITUG.js → chunk-BSSLSQEW.js} +3 -3
  57. package/chunks/{chunk-EYY4IBPV.js → chunk-CGM3E75C.js} +3 -3
  58. package/chunks/{chunk-V4MJ56RS.js → chunk-CIDQISGM.js} +5 -5
  59. package/chunks/{chunk-T6W4KACQ.js → chunk-CPFFU46D.js} +1 -1
  60. package/chunks/{chunk-TYCXSMZU.js → chunk-CQ6IPDQW.js} +3 -3
  61. package/chunks/{chunk-KIFRFCCB.js → chunk-CZ4OWGQQ.js} +67 -22
  62. package/chunks/{chunk-N7NBMAMW.js → chunk-D2RNVVH6.js} +2 -2
  63. package/chunks/{chunk-KPVVWKF3.js → chunk-D7QGE3RT.js} +1 -1
  64. package/chunks/{chunk-TYGKUOEG.js → chunk-DAV4QFD5.js} +3 -11
  65. package/chunks/{chunk-QUESTNOP.js → chunk-DD6O3ZRD.js} +1 -1
  66. package/chunks/{chunk-NWPO6I7V.js → chunk-DEDESZDL.js} +1 -1
  67. package/chunks/{chunk-7LZ7DK4D.js → chunk-DFVXU5YM.js} +1 -1
  68. package/chunks/{chunk-TBVNYG5B.js → chunk-DG4IQ6JG.js} +5 -5
  69. package/chunks/{chunk-SAQHDAUJ.js → chunk-DPTMKFIH.js} +452 -57
  70. package/chunks/{chunk-M6HXP2SG.js → chunk-EBPLKY6U.js} +2192 -849
  71. package/chunks/{chunk-3XZYK76R.js → chunk-EJOGLSNJ.js} +2 -2
  72. package/chunks/{chunk-L7T742G2.js → chunk-FA5K6YI2.js} +47 -3
  73. package/chunks/{chunk-M2NMFAFR.js → chunk-FMIH5KMQ.js} +1 -1
  74. package/chunks/{chunk-HHGQGTJQ.js → chunk-FQDCO3CJ.js} +10 -1
  75. package/chunks/{chunk-V3LXMASR.js → chunk-FRHQQC2Z.js} +1 -1
  76. package/chunks/{chunk-732MOPEM.js → chunk-G6MUFRNI.js} +1 -1
  77. package/chunks/{chunk-KNXA5XXK.js → chunk-GXTMEATA.js} +15 -34
  78. package/chunks/{chunk-7SUQZ7QH.js → chunk-GZDWTBT3.js} +2 -2
  79. package/chunks/{chunk-IQFYO5BF.js → chunk-H7TMVHKE.js} +1 -1
  80. package/chunks/{chunk-KNQZXSLW.js → chunk-HG3UBTJ4.js} +23 -9
  81. package/chunks/{chunk-MPBRV3UU.js → chunk-HOSVOUDK.js} +71 -0
  82. package/chunks/{chunk-OPBATTFQ.js → chunk-HTYND72J.js} +1 -1
  83. package/chunks/{chunk-I4XSOFH2.js → chunk-I7BT2MME.js} +1 -1
  84. package/chunks/{chunk-LHY6HBRA.js → chunk-IH4Z54RJ.js} +7 -5
  85. package/chunks/{chunk-GYBDYWMV.js → chunk-IRSLAS4M.js} +2 -2
  86. package/chunks/{chunk-UZPWH6SP.js → chunk-IX4PWUDU.js} +401 -173
  87. package/chunks/{chunk-KT4OWAAZ.js → chunk-JRIVMPD2.js} +3 -3
  88. package/chunks/{chunk-Q7YDKOGY.js → chunk-JVEGA3MM.js} +1 -1
  89. package/chunks/{chunk-O5AZPHYZ.js → chunk-K34GJQOZ.js} +138 -16
  90. package/chunks/{chunk-L2GTEEEU.js → chunk-K5IDV3PC.js} +44 -1
  91. package/chunks/{chunk-5HBFERG5.js → chunk-KEC5FHLM.js} +3 -3
  92. package/chunks/{chunk-5PWLQ7SK.js → chunk-KLOMACIR.js} +15 -8
  93. package/chunks/{chunk-XWUQ4IH5.js → chunk-KWX56CHZ.js} +7 -7
  94. package/chunks/{chunk-VQZXRLEX.js → chunk-LCX5B364.js} +3 -3
  95. package/chunks/{chunk-CTQE2NB2.js → chunk-LSRI3ND3.js} +1 -1
  96. package/chunks/{chunk-5TXOGH4I.js → chunk-LUISTZXI.js} +3 -3
  97. package/chunks/{chunk-6AECVSVX.js → chunk-MAKIANMX.js} +3 -3
  98. package/chunks/{chunk-M4OYAR6J.js → chunk-MDNUCDKZ.js} +2 -2
  99. package/chunks/{chunk-CZXQ4UZA.js → chunk-MELQSJOU.js} +1 -1
  100. package/chunks/{chunk-6ZIIHBNV.js → chunk-MUNA4QDC.js} +4 -4
  101. package/chunks/{chunk-E5BWLU5J.js → chunk-N4SVADAV.js} +305 -143
  102. package/chunks/{chunk-URK542T4.js → chunk-NF5J2WFA.js} +15 -2
  103. package/chunks/{chunk-GJJQV4PY.js → chunk-NLFLYSS4.js} +1 -1
  104. package/chunks/{chunk-FRH4SSGX.js → chunk-NW2GIPG3.js} +2 -4
  105. package/chunks/{chunk-JS4Q5NG5.js → chunk-NX4A23LY.js} +3 -3
  106. package/chunks/{chunk-DEG7R6Z6.js → chunk-OK47XBYH.js} +79 -36
  107. package/chunks/{chunk-7D4KEFOT.js → chunk-OPVF453Q.js} +3 -3
  108. package/chunks/{chunk-J7DNMZFO.js → chunk-OR64CU46.js} +1 -1
  109. package/chunks/{chunk-DAX3G67A.js → chunk-OWGRUU7F.js} +1 -1
  110. package/chunks/{chunk-M2PY7CNK.js → chunk-OWXFBIB6.js} +2 -2
  111. package/chunks/{chunk-NELCY6JT.js → chunk-OYWVIXHT.js} +1 -3
  112. package/chunks/{chunk-V7RNNPGC.js → chunk-P5Y23G2L.js} +18 -1
  113. package/chunks/{chunk-QZ5G26ZE.js → chunk-PTSEETCO.js} +27 -27
  114. package/chunks/{chunk-IEP44U2R.js → chunk-PVXEJB66.js} +1 -1
  115. package/chunks/{chunk-NC4O6UE6.js → chunk-PZW46OTB.js} +2 -2
  116. package/chunks/{chunk-RQVVXDHS.js → chunk-Q4ZPYNIZ.js} +4 -4
  117. package/chunks/{chunk-QSWDGAIC.js → chunk-QILD6R27.js} +1 -1
  118. package/chunks/{chunk-GLWWPFTW.js → chunk-QLTATTPS.js} +1 -1
  119. package/chunks/{chunk-QTI7SRXI.js → chunk-QPBFRWCP.js} +3 -3
  120. package/chunks/{chunk-3TT6MZHJ.js → chunk-QSD4UH74.js} +842 -62
  121. package/chunks/{chunk-TEKFBSMY.js → chunk-RDVNSJQU.js} +3 -3
  122. package/chunks/{chunk-NPE3STIW.js → chunk-ROIJYS5K.js} +6 -6
  123. package/chunks/{chunk-JEMR2FTD.js → chunk-RQJA2YYO.js} +4 -4
  124. package/chunks/{chunk-YI6UGZF5.js → chunk-S6TCTH4Z.js} +13 -13
  125. package/chunks/{chunk-ZGWY4YUB.js → chunk-SYHXR6WM.js} +5 -5
  126. package/chunks/{chunk-O4BBDP2G.js → chunk-TB4YFWXG.js} +2 -2
  127. package/chunks/{chunk-ILVATFYJ.js → chunk-TDESMS7M.js} +22 -18
  128. package/chunks/{chunk-47FQVRCO.js → chunk-TMFWI4RC.js} +1 -1
  129. package/chunks/{chunk-T4FTABSW.js → chunk-TQDFSQQF.js} +1 -1
  130. package/chunks/{chunk-ZV4XVYL3.js → chunk-TTRH3RTQ.js} +4 -4
  131. package/chunks/{chunk-ZWPWQEF5.js → chunk-TXP5NGG3.js} +1 -1
  132. package/chunks/{chunk-E3GLDLYB.js → chunk-TYAMGABM.js} +0 -6
  133. package/chunks/{chunk-VWD7SNNN.js → chunk-UI5UGEF4.js} +1082 -926
  134. package/chunks/{chunk-MWZYNOCG.js → chunk-ULNWG62W.js} +3 -3
  135. package/chunks/{chunk-HGCQ5SE7.js → chunk-UXEO7E3V.js} +21 -0
  136. package/chunks/{chunk-U6PTKAOW.js → chunk-V6OBVAST.js} +1 -1
  137. package/chunks/{chunk-5UPJ774B.js → chunk-VIFA5VJD.js} +1 -1
  138. package/chunks/{chunk-Y66OOMKS.js → chunk-VLHR7F4E.js} +595 -58
  139. package/chunks/{chunk-EYS3GGM3.js → chunk-VPV7WBVT.js} +1 -1
  140. package/chunks/{chunk-XCGIMOLN.js → chunk-WCCLLK7X.js} +14 -1
  141. package/chunks/{chunk-JL3LC3CQ.js → chunk-WCEI6J56.js} +1 -1
  142. package/chunks/{chunk-JXK3WAP7.js → chunk-WDVDVWJ3.js} +6 -6
  143. package/chunks/{chunk-ZQSNP4TG.js → chunk-WI6GIM2M.js} +2 -2
  144. package/chunks/{chunk-TRYJ3BVE.js → chunk-WM3LUQLO.js} +7 -7
  145. package/chunks/{chunk-VJNBRRZG.js → chunk-WZMH7II3.js} +1 -1
  146. package/chunks/{chunk-HBZUU4AE.js → chunk-X5SLJOMF.js} +9 -7
  147. package/chunks/{chunk-FDWH6CBK.js → chunk-XAFIL4BD.js} +7 -7
  148. package/chunks/{chunk-P2UCMHDT.js → chunk-XDRXOSAD.js} +3 -3
  149. package/chunks/{chunk-RRQJPCRQ.js → chunk-XH3KAV2G.js} +2 -2
  150. package/chunks/{chunk-F6AOBFUN.js → chunk-YBHUXEC6.js} +1 -1
  151. package/chunks/{chunk-GZGDJ4E6.js → chunk-YBVVOSOH.js} +1 -1
  152. package/chunks/{chunk-EXG2R5UR.js → chunk-YCHNAKC5.js} +16 -14
  153. package/chunks/{chunk-XTH2OMDS.js → chunk-YIGGWOJE.js} +1 -1
  154. package/chunks/{chunk-IX7CFQGA.js → chunk-YILJKX2T.js} +3 -3
  155. package/chunks/{chunk-SSAOTDK7.js → chunk-YX2RDGAL.js} +1 -1
  156. package/chunks/{chunk-6S52N6PG.js → chunk-ZBB5EZZV.js} +2 -2
  157. package/chunks/{chunk-3GCU5O2E.js → chunk-ZLCT4C5A.js} +1 -1
  158. package/chunks/{chunk-4ETA3KRC.js → chunk-ZMY2P4L3.js} +3 -3
  159. package/chunks/{chunk-575MI5K3.js → chunk-ZQUY3ZJU.js} +4 -4
  160. package/chunks/{computer-use-S4JEU5P7.js → computer-use-F4URV4TU.js} +45 -45
  161. package/chunks/{config-utils-TXVKR27S.js → config-utils-Z3OW3IQG.js} +4 -4
  162. package/chunks/{contextCommand-2H5OH2HW.js → contextCommand-IGSS2U5J.js} +44 -44
  163. package/chunks/{core-runtime-IAQ4DD4Y.js → core-runtime-H5CZDN3A.js} +42 -42
  164. package/chunks/{create-sub-session-EKHKXJAA.js → create-sub-session-PA7MFTHK.js} +42 -42
  165. package/chunks/{create-sub-session-Y4WYDZGC.js → create-sub-session-XT6DLYOE.js} +2 -2
  166. package/chunks/{cron-create-ZOVA3CC2.js → cron-create-2JZ2TWTF.js} +4 -4
  167. package/chunks/{cron-delete-7Z3H4LJY.js → cron-delete-CTPD2P26.js} +4 -4
  168. package/chunks/{cron-list-UHGX3IQG.js → cron-list-V44KHAF6.js} +4 -4
  169. package/chunks/{daemon-PXIC4ZDK.js → daemon-GED37WOX.js} +30 -2
  170. package/chunks/daemon-git-worktree-guard-LZDCNJGV.js +2062 -0
  171. package/chunks/daemon-status-provider-QYM57Z44.js +102 -0
  172. package/chunks/{daemon-trust-policy-7JOBVFH3.js → daemon-trust-policy-TSRVEYZR.js} +48 -48
  173. package/chunks/{daemon-trust-policy-monitor-OU3NRHAR.js → daemon-trust-policy-monitor-2K2YETMT.js} +48 -48
  174. package/chunks/{deferred-core-runtime-SFT3KI2C.js → deferred-core-runtime-FKJ3OYE7.js} +44 -44
  175. package/chunks/{devtools-X6ROTKHE.js → devtools-4QFYJT6U.js} +1 -1
  176. package/chunks/{display-image-ZE3GZNIK.js → display-image-M2ELAVN4.js} +4 -4
  177. package/chunks/{dist-KTYDJNYM.js → dist-4ZPG4BY6.js} +2 -2
  178. package/chunks/{dist-NPS52B2V.js → dist-BROOP2EG.js} +1 -1
  179. package/chunks/{dist-BW2LDPV3.js → dist-IYYN3RUT.js} +2 -2
  180. package/chunks/{dist-EFJILGIS.js → dist-JWMKPWT5.js} +3 -1
  181. package/chunks/{dist-AVUYBK7L.js → dist-K7IQB53U.js} +1 -1
  182. package/chunks/{dist-PKSRQAR2.js → dist-MAQXAQ2Y.js} +1 -1
  183. package/chunks/{dist-BNWP6IZL.js → dist-WJ4BHIEW.js} +2 -2
  184. package/chunks/{dist-ZWDH5HLS.js → dist-YEPL4RAW.js} +1 -1
  185. package/chunks/{earlyInputCapture-27RPWE2D.js → earlyInputCapture-WJBSJQUF.js} +43 -43
  186. package/chunks/{edit-WXVZ7FHS.js → edit-X73LA4YO.js} +50 -49
  187. package/chunks/{enter-worktree-TYMVXFLA.js → enter-worktree-CLRQTIVN.js} +47 -47
  188. package/chunks/{enterPlanMode-FT4MRU5N.js → enterPlanMode-6BDYUQ5T.js} +48 -48
  189. package/chunks/{environment-Z6OMA34I.js → environment-WOAJXJDJ.js} +44 -44
  190. package/chunks/{errors-YMXK2GG3.js → errors-7OY5MXYY.js} +44 -44
  191. package/chunks/{exit-worktree-ODZUQLGJ.js → exit-worktree-TFFJXCRT.js} +47 -47
  192. package/chunks/{exitPlanMode-MBPAPBBV.js → exitPlanMode-WDURQMIU.js} +42 -42
  193. package/chunks/{external-tool-guard-provider-5HTGOPGU.js → external-tool-guard-provider-TE4DRY36.js} +1 -1
  194. package/chunks/{fast-path-ZU5T6XSN.js → fast-path-QQLGC37M.js} +5 -5
  195. package/chunks/{gemini-OZK6AIMC.js → gemini-VHE62IJL.js} +110 -105
  196. package/chunks/{geminiContentGenerator-MC6ZKWZG.js → geminiContentGenerator-VSHIEGAQ.js} +11 -11
  197. package/chunks/{glob-KJ4A4ZOM.js → glob-VMEEDDLO.js} +49 -49
  198. package/chunks/{goal-tools-JDK2SNMV.js → goal-tools-M4UDAZXP.js} +4 -4
  199. package/chunks/{grep-QWBLG564.js → grep-F4UAR7KX.js} +47 -47
  200. package/chunks/{handleAutoUpdate-M3ACKDKF.js → handleAutoUpdate-GN7Z6QAC.js} +46 -46
  201. package/chunks/{i18n-FPW7XZL5.js → i18n-ETW24DHW.js} +43 -43
  202. package/chunks/{image-gen-OTFC2S7L.js → image-gen-YPK2AZT4.js} +11 -11
  203. package/chunks/{initializer-5HKUXXBT.js → initializer-UA6KQ7MS.js} +49 -49
  204. package/chunks/{installationInfo-4OA6UW7V.js → installationInfo-P7OTIR4P.js} +43 -43
  205. package/chunks/{keychain-token-storage-JTWUYFU7.js → keychain-token-storage-NKKCUHI2.js} +2 -2
  206. package/chunks/{list-3TKZ264A.js → list-GRAMIQOT.js} +51 -51
  207. package/chunks/{list-agents-4GQ2XNEU.js → list-agents-O6WSY4CT.js} +2 -2
  208. package/chunks/{loadedSettingsAdapter-IRUANLS2.js → loadedSettingsAdapter-5O2TDS3I.js} +48 -48
  209. package/chunks/{loggingContentGenerator-D4URLH2A.js → loggingContentGenerator-J2J2AANS.js} +151 -120
  210. package/chunks/{loop-wakeup-HOQI3K5D.js → loop-wakeup-GVQRMUKS.js} +5 -5
  211. package/chunks/{ls-FSHISLLA.js → ls-6W2D7TKU.js} +6 -6
  212. package/chunks/{lsp-APQJ5ZEZ.js → lsp-NJ4KFBI2.js} +2 -2
  213. package/chunks/{managed-npm-update-2O7XSAWJ.js → managed-npm-update-WMV5ITKU.js} +45 -45
  214. package/chunks/{mcp-AFVHCHKT.js → mcp-XLP33CAI.js} +48 -48
  215. package/chunks/{monitor-PY4WDSX3.js → monitor-2MM23VDV.js} +47 -47
  216. package/chunks/{node-YSOU44FX.js → node-UUDY34IG.js} +3 -3
  217. package/chunks/nonInteractiveCli-KTA5K6FS.js +163 -0
  218. package/chunks/{notebook-edit-GEPL33NO.js → notebook-edit-QD4TRKLY.js} +47 -47
  219. package/chunks/{openaiContentGenerator-ACYSXQ6R.js → openaiContentGenerator-KLHSPVN2.js} +31 -31
  220. package/chunks/{pidfile-SUNYCAA4.js → pidfile-RQGZBNXT.js} +43 -43
  221. package/chunks/{processUtils-F7LP7YUV.js → processUtils-HZZDA2VV.js} +2 -2
  222. package/chunks/{qwenContentGenerator-BB6IPELF.js → qwenContentGenerator-T75M2Z3B.js} +50 -50
  223. package/chunks/{qwenOAuth2-OU3WGDOI.js → qwenOAuth2-5QZU444W.js} +10 -10
  224. package/chunks/{read-file-GORBXJTS.js → read-file-LOVUSBJC.js} +12 -12
  225. package/chunks/{read-mcp-resource-TJSJRH4F.js → read-mcp-resource-GWCP23WG.js} +2 -2
  226. package/chunks/{read-package-up-TCM6I7S2.js → read-package-up-K6RKTL5D.js} +1 -1
  227. package/chunks/{record-artifact-FXF5LHPE.js → record-artifact-IYQDEYMV.js} +3 -3
  228. package/chunks/{resumeHistoryUtils-FOAJJJWK.js → resumeHistoryUtils-LVKSSQII.js} +50 -50
  229. package/chunks/{ripGrep-RNLIZGCY.js → ripGrep-ZJSHKB6H.js} +42 -42
  230. package/chunks/{run-qwen-serve-GVMMX3IU.js → run-qwen-serve-GZW7B4WK.js} +186 -90
  231. package/chunks/{runtime-RNBZ5FDD.js → runtime-MYRXEO2E.js} +53 -53
  232. package/chunks/{scheduler-NTRFSPIP.js → scheduler-DPTPI6FW.js} +44 -44
  233. package/chunks/{sdk-exporters-grpc-4QKV6MCX.js → sdk-exporters-grpc-54L4LS5L.js} +2 -2
  234. package/chunks/{sdk-exporters-http-2VPMAPFI.js → sdk-exporters-http-NHBYB5FZ.js} +21 -17
  235. package/chunks/{sdk-impl-5W3JUCWF.js → sdk-impl-SK4P5WON.js} +17 -14
  236. package/chunks/{send-message-RBYLV5NY.js → send-message-O7FO63UK.js} +6 -6
  237. package/chunks/{serve-H3PGA26U.js → serve-XCG4XCDA.js} +52 -52
  238. package/chunks/{server-SUXD2F3C.js → server-AWQHKXLG.js} +310 -200
  239. package/chunks/{session-MTFVUWWM.js → session-P5FKNCNR.js} +94 -97
  240. package/chunks/{settings-GUJ3TN2J.js → settings-CSYVIP2R.js} +47 -47
  241. package/chunks/{shell-C2UP5FF2.js → shell-EGTSUO2P.js} +42 -42
  242. package/chunks/{skill-4XCNK55E.js → skill-IFUD72GF.js} +22 -22
  243. package/chunks/{skill-settings-Y2BU27XM.js → skill-settings-YOE7LBHE.js} +47 -47
  244. package/chunks/{spawnChannel-UUUUK734.js → spawnChannel-PQSZIOLY.js} +45 -47
  245. package/chunks/{standalone-update-MJ722XZ4.js → standalone-update-RB2EGUSF.js} +44 -44
  246. package/chunks/{startInteractiveUI-TCPIPNGN.js → startInteractiveUI-KMYUJ2MU.js} +3040 -2399
  247. package/chunks/{syntheticOutput-D3Z64LJC.js → syntheticOutput-DVHJMUGV.js} +3 -3
  248. package/chunks/{task-create-URFZ5EUX.js → task-create-4NC7PDI4.js} +11 -11
  249. package/chunks/{task-list-6JDFMPUW.js → task-list-LBSRMOC7.js} +5 -5
  250. package/chunks/{task-stop-HHUGCD25.js → task-stop-YFNATTIM.js} +2 -2
  251. package/chunks/{task-update-DVV6CUGI.js → task-update-BPLM52GD.js} +12 -12
  252. package/chunks/{team-create-WZWH2NJI.js → team-create-B6A6MJBT.js} +47 -47
  253. package/chunks/{team-delete-PZGGBQLM.js → team-delete-MKYMYBFM.js} +5 -5
  254. package/chunks/{team-plan-approval-SUZQJCWJ.js → team-plan-approval-5WO3CXXU.js} +48 -48
  255. package/chunks/{terminal-image-renderer-BCUN3Z3W.js → terminal-image-renderer-BTRE2GEU.js} +44 -44
  256. package/chunks/{theme-manager-UGMFDREN.js → theme-manager-XL2N5SBY.js} +43 -43
  257. package/chunks/{todoWrite-WINAZSZI.js → todoWrite-K5K7NRE5.js} +4 -4
  258. package/chunks/{tool-search-B6F3MPUZ.js → tool-search-QNBLXUGR.js} +18 -18
  259. package/chunks/{total-session-admission-MQLBJ5WL.js → total-session-admission-N4E5SFBO.js} +49 -49
  260. package/chunks/{trustedFolders-2XST7U5C.js → trustedFolders-MQS46LIU.js} +43 -43
  261. package/chunks/{update-relaunch-OVC7YNGD.js → update-relaunch-536KRL33.js} +5 -5
  262. package/chunks/{updateCheck-YAKM36WQ.js → updateCheck-QJI2SYWF.js} +48 -48
  263. package/chunks/{useAutoAcceptIndicator-RF6FVX3S.js → useAutoAcceptIndicator-7QASHD46.js} +51 -51
  264. package/chunks/{validateNonInterActiveAuth-IPPXFNQH.js → validateNonInterActiveAuth-ZNRGWBLV.js} +86 -88
  265. package/chunks/{version-4IDFEXOU.js → version-DBEQAFRW.js} +2 -2
  266. package/chunks/{web-fetch-NUOLHXPN.js → web-fetch-MBIVXKPE.js} +21 -21
  267. package/chunks/{web-search-LVOOV4XZ.js → web-search-4LBIN6VF.js} +16 -16
  268. package/chunks/{workflow-JSTYTG3K.js → workflow-LNMA55HY.js} +127 -61
  269. package/chunks/{workspace-providers-status-U4EYXA4K.js → workspace-providers-status-PDDMI6ST.js} +51 -51
  270. package/chunks/{workspace-registration-store-OG66U3CB.js → workspace-registration-store-BGRKKIYR.js} +1 -1
  271. package/chunks/{workspace-registry-WSHWQRQQ.js → workspace-registry-L4NCJ34K.js} +49 -49
  272. package/chunks/{workspace-service-QZXQHX2F.js → workspace-service-LOXYKYTR.js} +54 -54
  273. package/chunks/{workspace-skills-status-VRBHEX5O.js → workspace-skills-status-IJ5FOQI6.js} +49 -49
  274. package/chunks/{workspace-trust-reconciler-FCRIUIOF.js → workspace-trust-reconciler-H36TCR2S.js} +57 -57
  275. package/chunks/{write-file-PYL3JCCD.js → write-file-JJAY7JSP.js} +42 -42
  276. package/chunks/{zoom-image-RS6MU26F.js → zoom-image-4MVVVM7E.js} +12 -12
  277. package/cli.js +18 -17
  278. package/package.json +4 -4
  279. package/web-shell/assets/{arc-CgGUyHWd.js → arc-B-89zHN4.js} +1 -1
  280. package/web-shell/assets/{architectureDiagram-3BPJPVTR-BR0Qv-1Y.js → architectureDiagram-3BPJPVTR-BkcOncHk.js} +1 -1
  281. package/web-shell/assets/{blockDiagram-GPEHLZMM-DIoaceaI.js → blockDiagram-GPEHLZMM-DQ4yboaF.js} +1 -1
  282. package/web-shell/assets/{c4Diagram-AAUBKEIU-Bc5k6BbI.js → c4Diagram-AAUBKEIU-C_8ZjPDI.js} +1 -1
  283. package/web-shell/assets/channel-Du2WFns8.js +1 -0
  284. package/web-shell/assets/{chunk-2J33WTMH-DtPEz2WX.js → chunk-2J33WTMH-naKVe1Bm.js} +1 -1
  285. package/web-shell/assets/{chunk-4BX2VUAB-Dydo6ydE.js → chunk-4BX2VUAB-DdoViKT2.js} +1 -1
  286. package/web-shell/assets/{chunk-55IACEB6-DD9_VWXm.js → chunk-55IACEB6-DUDQZEwU.js} +1 -1
  287. package/web-shell/assets/{chunk-727SXJPM-DVI2m59k.js → chunk-727SXJPM-BqpDTR5s.js} +1 -1
  288. package/web-shell/assets/{chunk-AQP2D5EJ-luatmaTN.js → chunk-AQP2D5EJ-CdmEknkT.js} +1 -1
  289. package/web-shell/assets/{chunk-FMBD7UC4-Duy8NTIi.js → chunk-FMBD7UC4-CH7fFTLB.js} +1 -1
  290. package/web-shell/assets/{chunk-ND2GUHAM-CrL1yhms.js → chunk-ND2GUHAM-ObgSuFKF.js} +1 -1
  291. package/web-shell/assets/{chunk-QZHKN3VN-C7BX6bu1.js → chunk-QZHKN3VN-D9fKdv_s.js} +1 -1
  292. package/web-shell/assets/classDiagram-4FO5ZUOK-Zw0HafH6.js +1 -0
  293. package/web-shell/assets/classDiagram-v2-Q7XG4LA2-Zw0HafH6.js +1 -0
  294. package/web-shell/assets/{cose-bilkent-S5V4N54A-BTzs7mIi.js → cose-bilkent-S5V4N54A-CvzATMx9.js} +1 -1
  295. package/web-shell/assets/{dagre-BM42HDAG-3VTUmWts.js → dagre-BM42HDAG-M_xU21QW.js} +1 -1
  296. package/web-shell/assets/{diagram-2AECGRRQ-Ehdp75GN.js → diagram-2AECGRRQ-CNrl9sW1.js} +1 -1
  297. package/web-shell/assets/{diagram-5GNKFQAL-B3wu3teE.js → diagram-5GNKFQAL-CUweVT6T.js} +1 -1
  298. package/web-shell/assets/{diagram-KO2AKTUF-DjgTSf2S.js → diagram-KO2AKTUF-D3n6Lxjo.js} +1 -1
  299. package/web-shell/assets/{diagram-LMA3HP47-Br9mwjY3.js → diagram-LMA3HP47-0SeFPK4t.js} +1 -1
  300. package/web-shell/assets/{diagram-OG6HWLK6-D4xz5M-z.js → diagram-OG6HWLK6-DAgyEwge.js} +1 -1
  301. package/web-shell/assets/{erDiagram-TEJ5UH35-CXayWlG_.js → erDiagram-TEJ5UH35-CzxBBDIK.js} +1 -1
  302. package/web-shell/assets/{flowDiagram-I6XJVG4X-CLonjQTi.js → flowDiagram-I6XJVG4X-B0uj0jyo.js} +1 -1
  303. package/web-shell/assets/{ganttDiagram-6RSMTGT7-BTySFT-1.js → ganttDiagram-6RSMTGT7-DFzcj5km.js} +1 -1
  304. package/web-shell/assets/{gitGraphDiagram-PVQCEYII--2WcUjOe.js → gitGraphDiagram-PVQCEYII-DylJ_Fc9.js} +1 -1
  305. package/web-shell/assets/index-BIGQygTL.css +5 -0
  306. package/web-shell/assets/{index-DPJHkFOG.js → index-BKSAnXU9.js} +1 -1
  307. package/web-shell/assets/index-J7OMTqAN.js +1789 -0
  308. package/web-shell/assets/{infoDiagram-5YYISTIA-9vpgAf1m.js → infoDiagram-5YYISTIA-BYMcJVMI.js} +1 -1
  309. package/web-shell/assets/{ishikawaDiagram-YF4QCWOH-DcRpHnAW.js → ishikawaDiagram-YF4QCWOH-t1quI1S3.js} +1 -1
  310. package/web-shell/assets/{journeyDiagram-JHISSGLW-C2TKorRm.js → journeyDiagram-JHISSGLW-YM_QVUJm.js} +1 -1
  311. package/web-shell/assets/{kanban-definition-UN3LZRKU-DdsFwB8b.js → kanban-definition-UN3LZRKU-jw8OddK1.js} +1 -1
  312. package/web-shell/assets/{linear-7PjRvJrf.js → linear-Dlr3RVuP.js} +1 -1
  313. package/web-shell/assets/{mermaid.core-raDXa11C.js → mermaid.core-CqGKzNzd.js} +5 -5
  314. package/web-shell/assets/{mindmap-definition-RKZ34NQL-DLHc-PRN.js → mindmap-definition-RKZ34NQL-BqureoOS.js} +1 -1
  315. package/web-shell/assets/{pieDiagram-4H26LBE5-BftYpeTW.js → pieDiagram-4H26LBE5-Da20HkK1.js} +1 -1
  316. package/web-shell/assets/{quadrantDiagram-W4KKPZXB-O-6ygOYn.js → quadrantDiagram-W4KKPZXB-BsNlMvJy.js} +1 -1
  317. package/web-shell/assets/{requirementDiagram-4Y6WPE33-BmZWVufJ.js → requirementDiagram-4Y6WPE33-DzVCQCse.js} +1 -1
  318. package/web-shell/assets/{sankeyDiagram-5OEKKPKP-2x5beiWt.js → sankeyDiagram-5OEKKPKP-BMo16voT.js} +1 -1
  319. package/web-shell/assets/{sequenceDiagram-3UESZ5HK-BH8uKokQ.js → sequenceDiagram-3UESZ5HK-Bgi-pdHk.js} +1 -1
  320. package/web-shell/assets/{stateDiagram-AJRCARHV-Dq1MFgX_.js → stateDiagram-AJRCARHV-xaPQXwGk.js} +1 -1
  321. package/web-shell/assets/stateDiagram-v2-BHNVJYJU-D5RqimXD.js +1 -0
  322. package/web-shell/assets/{timeline-definition-PNZ67QCA-Cl2WKbv9.js → timeline-definition-PNZ67QCA-C_9RuvKG.js} +1 -1
  323. package/web-shell/assets/{vennDiagram-CIIHVFJN-BqoRo_Q-.js → vennDiagram-CIIHVFJN-Bgu6vdla.js} +1 -1
  324. package/web-shell/assets/{wardley-L42UT6IY-BTxp-Yot.js → wardley-L42UT6IY-CFTZ8IrX.js} +1 -1
  325. package/web-shell/assets/{wardleyDiagram-YWT4CUSO-DFXVCSH2.js → wardleyDiagram-YWT4CUSO-BASW9Vmt.js} +1 -1
  326. package/web-shell/assets/{xychartDiagram-2RQKCTM6-qQhWx0aE.js → xychartDiagram-2RQKCTM6--Nh-CD3F.js} +1 -1
  327. package/web-shell/index.html +2 -2
  328. package/chunks/chunk-CG3OQDNY.js +0 -649
  329. package/chunks/chunk-L34XSHIZ.js +0 -28
  330. package/chunks/chunk-N2TNM3QB.js +0 -9
  331. package/chunks/chunk-UOMZKPI5.js +0 -830
  332. package/chunks/chunk-WFRHWDBT.js +0 -622
  333. package/chunks/chunk-WLML6VIA.js +0 -18
  334. package/chunks/chunk-ZBBVBZBR.js +0 -137
  335. package/chunks/chunk-bdqvmfwv-OHYAFAAO.js +0 -17446
  336. package/chunks/daemon-status-provider-LPYR2GXY.js +0 -103
  337. package/chunks/dispatch-B53LNEO4.js +0 -37
  338. package/chunks/nonInteractiveCli-ZHW6F76F.js +0 -166
  339. package/chunks/opentui-entry-SBAOWW7M.js +0 -52325
  340. package/chunks/runtime-gate-T4ICWGQJ.js +0 -89
  341. package/chunks/wrapper-46Z24CTM.js +0 -35
  342. package/web-shell/assets/channel-D2b9IYpS.js +0 -1
  343. package/web-shell/assets/classDiagram-4FO5ZUOK-DHatTCmD.js +0 -1
  344. package/web-shell/assets/classDiagram-v2-Q7XG4LA2-DHatTCmD.js +0 -1
  345. package/web-shell/assets/index-CIFO52Wx.css +0 -5
  346. package/web-shell/assets/index-bhq3CUUF.js +0 -1789
  347. package/web-shell/assets/stateDiagram-v2-BHNVJYJU-spuAYji6.js +0 -1
  348. /package/chunks/{chunk-44CTCCLY.js → chunk-NWNEANAT.js} +0 -0
@@ -14,14 +14,18 @@ import {
14
14
  SPAN_TOOL_EXECUTION,
15
15
  TOOL_FAILURE_KIND_ATTRIBUTE,
16
16
  TOOL_FAILURE_KIND_CANCELLED,
17
- require_src
18
- } from "./chunk-L2GTEEEU.js";
17
+ require_src,
18
+ sessionIdContext
19
+ } from "./chunk-K5IDV3PC.js";
19
20
  import {
20
21
  createDebugLogger,
21
22
  getCurrentSessionId,
23
+ getErrorType,
24
+ getSessionIdFromContext,
22
25
  setSessionContext,
26
+ setSessionIdOnContext,
23
27
  setShellTracePropagation
24
- } from "./chunk-MPBRV3UU.js";
28
+ } from "./chunk-HOSVOUDK.js";
25
29
  import {
26
30
  DiagLogLevel,
27
31
  ROOT_CONTEXT,
@@ -762,6 +766,55 @@ function recordMemoryRecallDeliveryMetrics(config, latencyMs, attrs) {
762
766
  }
763
767
  __name(recordMemoryRecallDeliveryMetrics, "recordMemoryRecallDeliveryMetrics");
764
768
 
769
+ // packages/core/src/utils/textUtils.ts
770
+ init_esbuild_shims();
771
+ import { stripVTControlCharacters } from "node:util";
772
+ var CONTROL_CHARS_RE = /[\u0000-\u001f\u007f-\u009f]/g;
773
+ function stripAnsiAndControl(text) {
774
+ return stripVTControlCharacters(text).replace(CONTROL_CHARS_RE, "");
775
+ }
776
+ __name(stripAnsiAndControl, "stripAnsiAndControl");
777
+ function safeLiteralReplace(str, oldString, newString) {
778
+ if (oldString === "" || !str.includes(oldString)) {
779
+ return str;
780
+ }
781
+ if (!newString.includes("$")) {
782
+ return str.replaceAll(oldString, newString);
783
+ }
784
+ const escapedNewString = newString.replaceAll("$", "$$$$");
785
+ return str.replaceAll(oldString, escapedNewString);
786
+ }
787
+ __name(safeLiteralReplace, "safeLiteralReplace");
788
+ function isBinary(data, sampleSize = 512) {
789
+ if (!data) {
790
+ return false;
791
+ }
792
+ const sample = data.length > sampleSize ? data.subarray(0, sampleSize) : data;
793
+ for (const byte of sample) {
794
+ if (byte === 0) {
795
+ return true;
796
+ }
797
+ }
798
+ return false;
799
+ }
800
+ __name(isBinary, "isBinary");
801
+ function normalizeContent(content) {
802
+ let normalized = content.replace(/^\uFEFF/, "");
803
+ normalized = normalized.replace(/\r\n/g, "\n").replace(/\r/g, "\n");
804
+ return normalized;
805
+ }
806
+ __name(normalizeContent, "normalizeContent");
807
+
808
+ // packages/core/src/extension/redaction.ts
809
+ init_esbuild_shims();
810
+ var REDACTED_URL_CREDENTIAL = "***REDACTED***";
811
+ var URL_CREDENTIALS_PATTERN = /\b([a-z][a-z0-9+.-]*:\/\/)(?:[^/\s]+@)+/gi;
812
+ var UPLOAD_IDENTITY_PATTERN = /\bupload:v1:[0-9a-fA-F-]+:/gu;
813
+ function redactUrlCredentials(source) {
814
+ return source.replace(UPLOAD_IDENTITY_PATTERN, "upload:").replace(URL_CREDENTIALS_PATTERN, `$1${REDACTED_URL_CREDENTIAL}@`);
815
+ }
816
+ __name(redactUrlCredentials, "redactUrlCredentials");
817
+
765
818
  // packages/core/src/telemetry/session-tracing.ts
766
819
  init_esbuild_shims();
767
820
  init_esm();
@@ -939,7 +992,7 @@ function initializeTelemetry(config) {
939
992
  telemetryInitPromise ??= (async () => {
940
993
  const debugLogger3 = createDebugLogger("OTEL");
941
994
  try {
942
- const { startTelemetrySdk } = await import("./sdk-impl-5W3JUCWF.js");
995
+ const { startTelemetrySdk } = await import("./sdk-impl-SK4P5WON.js");
943
996
  if (telemetryInitialized) return;
944
997
  const started = await startTelemetrySdk(config);
945
998
  if (!started) return;
@@ -990,7 +1043,7 @@ function shutdownTelemetry() {
990
1043
  telemetryShutdownPromise = void 0;
991
1044
  return;
992
1045
  }
993
- endInteractionSpan("cancelled");
1046
+ endAllInteractionSpans("cancelled");
994
1047
  const currentSessionId = getCurrentSessionId();
995
1048
  if (currentSessionId) {
996
1049
  emitSessionEnd(currentSessionId);
@@ -1084,27 +1137,29 @@ var NOOP_SPAN = trace.wrapSpanContext({
1084
1137
  var interactionContext = new AsyncLocalStorage();
1085
1138
  var toolContext = new AsyncLocalStorage();
1086
1139
  var subagentContext = new AsyncLocalStorage();
1140
+ var activeInteractionsByPromptId = /* @__PURE__ */ new Map();
1087
1141
  var interactionIdentityByPromptId = /* @__PURE__ */ new Map();
1088
1142
  function isInNativeSubagentSpan() {
1089
1143
  const ctx = subagentContext.getStore();
1090
1144
  return ctx !== void 0 && !ctx.ended;
1091
1145
  }
1092
1146
  __name(isInNativeSubagentSpan, "isInNativeSubagentSpan");
1093
- function resolveSessionId(parentCtx) {
1147
+ function resolveSessionId(parentCtx, explicitSessionId, activeContext = context.active()) {
1094
1148
  const fromParent = parentCtx?.attributes?.["session.id"];
1095
- return typeof fromParent === "string" && fromParent ? fromParent : getCurrentSessionId();
1149
+ if (typeof fromParent === "string" && fromParent) return fromParent;
1150
+ if (explicitSessionId) return explicitSessionId;
1151
+ return getSessionIdFromContext(activeContext) ?? (sessionIdContext.getStore() || getCurrentSessionId());
1096
1152
  }
1097
1153
  __name(resolveSessionId, "resolveSessionId");
1098
- function resolveGenAiUserId(parentCtx, promptId) {
1154
+ function resolveGenAiUserId(parentCtx, promptId, explicitUserId) {
1099
1155
  const logicalParent = parentCtx ?? (promptId ? interactionIdentityByPromptId.get(promptId) : void 0);
1100
1156
  const value = logicalParent?.attributes["gen_ai.user.id"];
1101
- return typeof value === "string" && value ? value : void 0;
1157
+ return typeof value === "string" && value ? value : explicitUserId;
1102
1158
  }
1103
1159
  __name(resolveGenAiUserId, "resolveGenAiUserId");
1104
1160
  var activeSpans = /* @__PURE__ */ new Map();
1105
1161
  var strongSpans = /* @__PURE__ */ new Map();
1106
1162
  var interactionSequence = 0;
1107
- var lastInteractionCtx;
1108
1163
  var cleanupIntervalStarted = false;
1109
1164
  var SPAN_TTL_MS_DEFAULT = 30 * 60 * 1e3;
1110
1165
  var SPAN_TTL_MS_LONG = 4 * 60 * 60 * 1e3;
@@ -1124,7 +1179,7 @@ function ttlFor(ctx) {
1124
1179
  __name(ttlFor, "ttlFor");
1125
1180
  function sweepStaleSpans(now) {
1126
1181
  for (const [promptId, ctx] of interactionIdentityByPromptId) {
1127
- if (now - ctx.startTime >= SPAN_TTL_MS_DEFAULT) {
1182
+ if (now - ctx.lastActivityTime >= SPAN_TTL_MS_DEFAULT) {
1128
1183
  interactionIdentityByPromptId.delete(promptId);
1129
1184
  }
1130
1185
  }
@@ -1135,9 +1190,16 @@ function sweepStaleSpans(now) {
1135
1190
  strongSpans.delete(spanId);
1136
1191
  continue;
1137
1192
  }
1138
- if (now - ctx.startTime < ttlFor(ctx)) continue;
1193
+ const ttlReferenceTime = ctx.type === "interaction" ? ctx.lastActivityTime ?? ctx.startTime : ctx.startTime;
1194
+ if (now - ttlReferenceTime < ttlFor(ctx)) continue;
1139
1195
  if (!ctx.ended) {
1140
1196
  ctx.ended = true;
1197
+ if (ctx.type === "interaction") {
1198
+ const promptId = ctx.attributes["qwen-code.prompt_id"];
1199
+ if (typeof promptId === "string" && activeInteractionsByPromptId.get(promptId) === ctx) {
1200
+ activeInteractionsByPromptId.delete(promptId);
1201
+ }
1202
+ }
1141
1203
  const ageMs = now - ctx.startTime;
1142
1204
  const toolName = ctx.attributes["gen_ai.tool.name"] ?? ctx.attributes["tool.name"];
1143
1205
  const callId = ctx.attributes["tool.call_id"];
@@ -1206,55 +1268,146 @@ function truncateSpanText(s, maxChars = SPAN_TEXT_MAX_CHARS) {
1206
1268
  }
1207
1269
  __name(truncateSpanText, "truncateSpanText");
1208
1270
  function truncateSpanError(s) {
1209
- return truncateSpanText(s);
1271
+ return truncateSpanText(redactUrlCredentials(stripAnsiAndControl(s)));
1210
1272
  }
1211
1273
  __name(truncateSpanError, "truncateSpanError");
1212
1274
  function getTracer() {
1213
1275
  return trace.getTracer(SERVICE_NAME, "1.0.0");
1214
1276
  }
1215
1277
  __name(getTracer, "getTracer");
1216
- function startInteractionSpan(config, options) {
1217
- if (!isTelemetrySdkInitialized()) return;
1218
- ensureCleanupInterval();
1219
- interactionSequence++;
1278
+ function buildInteractionAttributes(config, options) {
1279
+ const sessionId = config.getSessionId();
1220
1280
  const userId = config.getTelemetryUserId();
1221
- const attributes = {
1222
- "session.id": config.getSessionId(),
1281
+ return {
1282
+ "session.id": sessionId,
1223
1283
  ...userId ? { "gen_ai.user.id": userId } : {},
1284
+ "gen_ai.operation.name": "invoke_agent",
1285
+ "gen_ai.agent.name": "qwen-code",
1286
+ "gen_ai.conversation.id": sessionId,
1287
+ ...config.getJsonSchema?.() ? { "gen_ai.output.type": "json" } : {},
1224
1288
  "qwen-code.prompt_id": options.promptId,
1225
1289
  "qwen-code.message_type": options.messageType,
1226
1290
  "qwen-code.model": options.model,
1227
1291
  "qwen-code.approval_mode": config.getApprovalMode(),
1228
1292
  "interaction.sequence": interactionSequence
1229
1293
  };
1294
+ }
1295
+ __name(buildInteractionAttributes, "buildInteractionAttributes");
1296
+ function finalizeInteractionContext(spanCtx, status, metadata) {
1297
+ if (spanCtx.ended) return;
1298
+ spanCtx.ended = true;
1299
+ const promptId = spanCtx.attributes["qwen-code.prompt_id"];
1300
+ if (typeof promptId === "string" && activeInteractionsByPromptId.get(promptId) === spanCtx) {
1301
+ activeInteractionsByPromptId.delete(promptId);
1302
+ const identity = interactionIdentityByPromptId.get(promptId);
1303
+ if (identity) identity.lastActivityTime = Date.now();
1304
+ }
1305
+ try {
1306
+ const duration = Date.now() - spanCtx.startTime;
1307
+ const attributes = {
1308
+ "interaction.duration_ms": duration,
1309
+ "qwen-code.turn_status": status
1310
+ };
1311
+ if (status === "error") {
1312
+ attributes["error.type"] = metadata?.errorType || "interaction_error";
1313
+ }
1314
+ spanCtx.span.setAttributes(attributes);
1315
+ if (status === "error") {
1316
+ spanCtx.span.setStatus({
1317
+ code: SpanStatusCode.ERROR,
1318
+ message: truncateSpanError(metadata?.errorMessage ?? "unknown error")
1319
+ });
1320
+ }
1321
+ } catch (error) {
1322
+ debugLogger2.warn(
1323
+ `Failed to update interaction span attributes/status: ${error instanceof Error ? error.message : String(error)}`
1324
+ );
1325
+ }
1326
+ try {
1327
+ spanCtx.span.end();
1328
+ } catch (error) {
1329
+ debugLogger2.warn(
1330
+ `Failed to end interaction span: ${error instanceof Error ? error.message : String(error)}`
1331
+ );
1332
+ }
1333
+ const spanId = getSpanId(spanCtx.span);
1334
+ activeSpans.delete(spanId);
1335
+ strongSpans.delete(spanId);
1336
+ }
1337
+ __name(finalizeInteractionContext, "finalizeInteractionContext");
1338
+ function registerInteractionContext(promptId, spanContextObj) {
1339
+ const existing = activeInteractionsByPromptId.get(promptId);
1340
+ if (existing && !existing.ended) {
1341
+ debugLogger2.warn(
1342
+ `Replacing unfinished interaction for promptId=${promptId}; ending the previous span as cancelled`
1343
+ );
1344
+ finalizeInteractionContext(existing, "cancelled", { promptId });
1345
+ }
1346
+ const spanId = getSpanId(spanContextObj.span);
1347
+ activeSpans.set(spanId, new WeakRef(spanContextObj));
1348
+ strongSpans.set(spanId, spanContextObj);
1349
+ activeInteractionsByPromptId.set(promptId, spanContextObj);
1350
+ const userId = spanContextObj.attributes["gen_ai.user.id"];
1351
+ if (typeof userId === "string" && userId) {
1352
+ interactionIdentityByPromptId.set(promptId, {
1353
+ lastActivityTime: spanContextObj.lastActivityTime ?? spanContextObj.startTime,
1354
+ attributes: { "gen_ai.user.id": userId }
1355
+ });
1356
+ } else {
1357
+ interactionIdentityByPromptId.delete(promptId);
1358
+ }
1359
+ }
1360
+ __name(registerInteractionContext, "registerInteractionContext");
1361
+ function getInteractionContext(promptId) {
1362
+ if (promptId !== void 0) {
1363
+ const exact = activeInteractionsByPromptId.get(promptId);
1364
+ return exact && !exact.ended ? exact : void 0;
1365
+ }
1366
+ const current = interactionContext.getStore();
1367
+ return current && !current.ended ? current : void 0;
1368
+ }
1369
+ __name(getInteractionContext, "getInteractionContext");
1370
+ function touchInteractionContext(spanCtx) {
1371
+ if (!spanCtx || spanCtx.type !== "interaction" || spanCtx.ended) return false;
1372
+ const promptId = spanCtx.attributes["qwen-code.prompt_id"];
1373
+ if (typeof promptId !== "string" || activeInteractionsByPromptId.get(promptId) !== spanCtx) {
1374
+ return false;
1375
+ }
1376
+ const now = Date.now();
1377
+ spanCtx.lastActivityTime = now;
1378
+ const identity = interactionIdentityByPromptId.get(promptId);
1379
+ if (identity) identity.lastActivityTime = now;
1380
+ return true;
1381
+ }
1382
+ __name(touchInteractionContext, "touchInteractionContext");
1383
+ function resolveGenAiParentContext(parent) {
1384
+ if (!parent && interactionContext.getStore()) return ROOT_CONTEXT;
1385
+ return resolveParentContext(parent);
1386
+ }
1387
+ __name(resolveGenAiParentContext, "resolveGenAiParentContext");
1388
+ function startInteractionSpan(config, options) {
1389
+ if (!isTelemetrySdkInitialized()) return;
1390
+ ensureCleanupInterval();
1391
+ interactionSequence++;
1392
+ const attributes = buildInteractionAttributes(config, options);
1230
1393
  const span = getTracer().startSpan(
1231
1394
  SPAN_INTERACTION,
1232
1395
  { kind: SpanKind.INTERNAL, attributes },
1233
1396
  ROOT_CONTEXT
1234
1397
  );
1235
- const spanId = getSpanId(span);
1236
1398
  const spanContextObj = {
1237
1399
  span,
1238
1400
  startTime: Date.now(),
1401
+ lastActivityTime: Date.now(),
1239
1402
  attributes,
1240
1403
  type: "interaction"
1241
1404
  };
1242
- activeSpans.set(spanId, new WeakRef(spanContextObj));
1243
- strongSpans.set(spanId, spanContextObj);
1244
- if (userId) {
1245
- interactionIdentityByPromptId.set(options.promptId, {
1246
- startTime: spanContextObj.startTime,
1247
- attributes: { "gen_ai.user.id": userId }
1248
- });
1249
- } else {
1250
- interactionIdentityByPromptId.delete(options.promptId);
1251
- }
1252
- lastInteractionCtx = spanContextObj;
1405
+ registerInteractionContext(options.promptId, spanContextObj);
1253
1406
  interactionContext.enterWith(spanContextObj);
1254
1407
  }
1255
1408
  __name(startInteractionSpan, "startInteractionSpan");
1256
1409
  function endInteractionSpan(status, metadata) {
1257
- const spanCtx = interactionContext.getStore() ?? lastInteractionCtx;
1410
+ const spanCtx = getInteractionContext(metadata?.promptId);
1258
1411
  if (!spanCtx) return;
1259
1412
  if (spanCtx.ended) {
1260
1413
  debugLogger2.debug(
@@ -1262,42 +1415,24 @@ function endInteractionSpan(status, metadata) {
1262
1415
  );
1263
1416
  return;
1264
1417
  }
1265
- spanCtx.ended = true;
1266
- lastInteractionCtx = void 0;
1267
- const duration = Date.now() - spanCtx.startTime;
1268
- spanCtx.span.setAttributes({
1269
- "interaction.duration_ms": duration,
1270
- "qwen-code.turn_status": status
1271
- });
1272
- if (status === "error") {
1273
- spanCtx.span.setStatus({
1274
- code: SpanStatusCode.ERROR,
1275
- message: metadata?.errorMessage ?? "unknown error"
1276
- });
1277
- } else {
1278
- spanCtx.span.setStatus({ code: SpanStatusCode.OK });
1418
+ const current = interactionContext.getStore();
1419
+ finalizeInteractionContext(spanCtx, status, metadata);
1420
+ if (current === spanCtx) interactionContext.enterWith(void 0);
1421
+ }
1422
+ __name(endInteractionSpan, "endInteractionSpan");
1423
+ function endAllInteractionSpans(status = "cancelled") {
1424
+ for (const spanCtx of [...activeInteractionsByPromptId.values()]) {
1425
+ finalizeInteractionContext(spanCtx, status);
1279
1426
  }
1280
- spanCtx.span.end();
1281
- const spanId = getSpanId(spanCtx.span);
1282
- activeSpans.delete(spanId);
1283
- strongSpans.delete(spanId);
1284
1427
  interactionContext.enterWith(void 0);
1285
1428
  }
1286
- __name(endInteractionSpan, "endInteractionSpan");
1429
+ __name(endAllInteractionSpans, "endAllInteractionSpans");
1287
1430
  async function withInteractionSpan(config, options, fn, getResultStatus) {
1288
1431
  if (!isTelemetrySdkInitialized()) return await fn();
1289
1432
  ensureCleanupInterval();
1290
1433
  interactionSequence++;
1291
- const userId = config.getTelemetryUserId();
1292
- const attributes = {
1293
- "session.id": config.getSessionId(),
1294
- ...userId ? { "gen_ai.user.id": userId } : {},
1295
- "qwen-code.prompt_id": options.promptId,
1296
- "qwen-code.message_type": options.messageType,
1297
- "qwen-code.model": options.model,
1298
- "qwen-code.approval_mode": config.getApprovalMode(),
1299
- "interaction.sequence": interactionSequence
1300
- };
1434
+ const sessionId = config.getSessionId();
1435
+ const attributes = buildInteractionAttributes(config, options);
1301
1436
  const parentContext = options.parentContext ?? ROOT_CONTEXT;
1302
1437
  const span = getTracer().startSpan(
1303
1438
  SPAN_INTERACTION,
@@ -1307,105 +1442,95 @@ async function withInteractionSpan(config, options, fn, getResultStatus) {
1307
1442
  },
1308
1443
  parentContext
1309
1444
  );
1310
- const spanId = getSpanId(span);
1311
1445
  const spanContextObj = {
1312
1446
  span,
1313
1447
  startTime: Date.now(),
1448
+ lastActivityTime: Date.now(),
1314
1449
  attributes,
1315
1450
  type: "interaction"
1316
1451
  };
1317
- activeSpans.set(spanId, new WeakRef(spanContextObj));
1318
- strongSpans.set(spanId, spanContextObj);
1319
- if (userId) {
1320
- interactionIdentityByPromptId.set(options.promptId, {
1321
- startTime: spanContextObj.startTime,
1322
- attributes: { "gen_ai.user.id": userId }
1323
- });
1324
- } else {
1325
- interactionIdentityByPromptId.delete(options.promptId);
1326
- }
1327
- const activeContext = trace.setSpan(parentContext, span);
1452
+ registerInteractionContext(options.promptId, spanContextObj);
1453
+ const activeContext = trace.setSpan(
1454
+ setSessionIdOnContext(parentContext, sessionId),
1455
+ span
1456
+ );
1328
1457
  return await context.with(
1329
1458
  activeContext,
1330
1459
  async () => interactionContext.run(spanContextObj, async () => {
1331
1460
  let terminalStatus = "ok";
1332
- let errorStatusSet = false;
1461
+ let errorMetadata;
1333
1462
  try {
1334
1463
  const result = await fn();
1335
1464
  terminalStatus = getResultStatus?.(result) ?? "ok";
1336
1465
  return result;
1337
1466
  } catch (error) {
1338
1467
  terminalStatus = "error";
1339
- span.setStatus({
1340
- code: SpanStatusCode.ERROR,
1341
- message: truncateSpanError(
1342
- error instanceof Error ? error.message : String(error)
1343
- )
1344
- });
1345
- errorStatusSet = true;
1468
+ errorMetadata = {
1469
+ promptId: options.promptId,
1470
+ errorMessage: error instanceof Error ? error.message : String(error),
1471
+ errorType: getErrorType(error)
1472
+ };
1346
1473
  throw error;
1347
1474
  } finally {
1348
- if (!spanContextObj.ended) {
1349
- spanContextObj.ended = true;
1350
- const duration = Date.now() - spanContextObj.startTime;
1351
- span.setAttributes({
1352
- "interaction.duration_ms": duration,
1353
- "qwen-code.turn_status": terminalStatus
1354
- });
1355
- if (terminalStatus === "ok") {
1356
- span.setStatus({ code: SpanStatusCode.OK });
1357
- } else if (terminalStatus === "error" && !errorStatusSet) {
1358
- span.setStatus({
1359
- code: SpanStatusCode.ERROR,
1360
- message: "interaction error"
1361
- });
1362
- }
1363
- span.end();
1364
- activeSpans.delete(spanId);
1365
- strongSpans.delete(spanId);
1366
- }
1475
+ finalizeInteractionContext(spanContextObj, terminalStatus, {
1476
+ promptId: options.promptId,
1477
+ ...terminalStatus === "error" && !errorMetadata ? {
1478
+ errorMessage: "interaction error",
1479
+ errorType: "interaction_error"
1480
+ } : errorMetadata
1481
+ });
1367
1482
  }
1368
1483
  })
1369
1484
  );
1370
1485
  }
1371
1486
  __name(withInteractionSpan, "withInteractionSpan");
1372
- function startLLMRequestSpan(model, promptId, options) {
1487
+ function startLLMRequestSpanWithContext(model, promptId, options) {
1373
1488
  if (!isTelemetrySdkInitialized()) {
1374
- return NOOP_SPAN;
1489
+ return {
1490
+ span: NOOP_SPAN,
1491
+ context: trace.setSpan(context.active(), NOOP_SPAN)
1492
+ };
1375
1493
  }
1376
- const parentCtx = subagentContext.getStore() ?? interactionContext.getStore();
1377
- const ctx = resolveParentContext(parentCtx);
1378
- const sessionId = resolveSessionId(parentCtx);
1379
- const userId = resolveGenAiUserId(parentCtx, promptId);
1494
+ const interactionParentCtx = getInteractionContext(promptId);
1495
+ touchInteractionContext(interactionParentCtx);
1496
+ const parentCtx = subagentContext.getStore() ?? toolContext.getStore() ?? interactionParentCtx;
1497
+ const ctx = resolveGenAiParentContext(parentCtx);
1498
+ const sessionId = resolveSessionId(parentCtx, options?.sessionId, ctx);
1499
+ const userId = resolveGenAiUserId(parentCtx, promptId, options?.userId);
1380
1500
  const attributes = {
1381
1501
  ...sessionId ? { "session.id": sessionId } : {},
1382
1502
  ...sessionId ? { "gen_ai.conversation.id": sessionId } : {},
1383
1503
  ...userId ? { "gen_ai.user.id": userId } : {},
1384
1504
  "qwen-code.prompt_id": promptId,
1385
- "llm_request.context": subagentContext.getStore() ? "subagent" : interactionContext.getStore() ? "interaction" : "standalone",
1505
+ "llm_request.context": parentCtx?.type === "subagent" ? "subagent" : interactionParentCtx ? "interaction" : "standalone",
1386
1506
  // Emit the version-pinned OTel GenAI semantic convention.
1387
1507
  "gen_ai.request.model": model,
1388
1508
  ...options?.operationName ? { "gen_ai.operation.name": options.operationName } : {},
1389
1509
  ...options?.providerName ? { "gen_ai.provider.name": options.providerName } : {},
1390
1510
  ...options?.outputType ? { "gen_ai.output.type": options.outputType } : {}
1391
1511
  };
1512
+ const sessionContext = setSessionIdOnContext(ctx, sessionId);
1392
1513
  const span = getTracer().startSpan(
1393
1514
  SPAN_LLM_REQUEST,
1394
1515
  { kind: SpanKind.INTERNAL, attributes },
1395
- ctx
1516
+ sessionContext
1396
1517
  );
1397
1518
  const spanId = getSpanId(span);
1398
1519
  const spanContextObj = {
1399
1520
  span,
1400
1521
  startTime: Date.now(),
1522
+ ...interactionParentCtx ? { interactionOwner: interactionParentCtx } : {},
1401
1523
  attributes,
1402
1524
  type: "llm_request"
1403
1525
  };
1404
1526
  activeSpans.set(spanId, new WeakRef(spanContextObj));
1405
1527
  strongSpans.set(spanId, spanContextObj);
1406
- return span;
1528
+ return {
1529
+ span,
1530
+ context: trace.setSpan(sessionContext, span)
1531
+ };
1407
1532
  }
1408
- __name(startLLMRequestSpan, "startLLMRequestSpan");
1533
+ __name(startLLMRequestSpanWithContext, "startLLMRequestSpanWithContext");
1409
1534
  function endLLMRequestSpan(span, metadata) {
1410
1535
  const spanId = getSpanId(span);
1411
1536
  const spanCtx = activeSpans.get(spanId)?.deref();
@@ -1472,10 +1597,13 @@ function endLLMRequestSpan(span, metadata) {
1472
1597
  if (metadata.subagentName !== void 0) {
1473
1598
  endAttributes["subagent_name"] = metadata.subagentName;
1474
1599
  }
1475
- if (metadata.errorType !== void 0) {
1600
+ if (metadata.errorType && !metadata.cancelled) {
1476
1601
  endAttributes["error_type"] = metadata.errorType;
1477
1602
  endAttributes["error.type"] = metadata.errorType;
1478
1603
  }
1604
+ if (!metadata.success && !metadata.cancelled && endAttributes["error.type"] === void 0) {
1605
+ endAttributes["error.type"] = "llm_error";
1606
+ }
1479
1607
  if (metadata.errorStatusCode !== void 0) {
1480
1608
  endAttributes["error_status_code"] = metadata.errorStatusCode;
1481
1609
  }
@@ -1509,9 +1637,7 @@ function endLLMRequestSpan(span, metadata) {
1509
1637
  `Failed to record API request breakdown histogram: ${error instanceof Error ? error.message : String(error)}`
1510
1638
  );
1511
1639
  }
1512
- if (metadata === void 0 || metadata.success) {
1513
- spanCtx.span.setStatus({ code: SpanStatusCode.OK });
1514
- } else {
1640
+ if (metadata !== void 0 && !metadata.success && !metadata.cancelled) {
1515
1641
  spanCtx.span.setStatus({
1516
1642
  code: SpanStatusCode.ERROR,
1517
1643
  message: metadata.error ? truncateSpanError(metadata.error) : "unknown error"
@@ -1531,6 +1657,7 @@ function endLLMRequestSpan(span, metadata) {
1531
1657
  }
1532
1658
  activeSpans.delete(spanId);
1533
1659
  strongSpans.delete(spanId);
1660
+ touchInteractionContext(spanCtx.interactionOwner);
1534
1661
  }
1535
1662
  __name(endLLMRequestSpan, "endLLMRequestSpan");
1536
1663
  function startToolSpan(toolName, attrs, description, promptId) {
@@ -1539,10 +1666,13 @@ function startToolSpan(toolName, attrs, description, promptId) {
1539
1666
  }
1540
1667
  let span;
1541
1668
  try {
1542
- const parentCtx = subagentContext.getStore() ?? interactionContext.getStore();
1543
- const ctx = resolveParentContext(parentCtx);
1544
- const sessionId = resolveSessionId(parentCtx);
1669
+ const interactionParentCtx = getInteractionContext(promptId);
1670
+ touchInteractionContext(interactionParentCtx);
1671
+ const parentCtx = subagentContext.getStore() ?? toolContext.getStore() ?? interactionParentCtx;
1672
+ const ctx = resolveGenAiParentContext(parentCtx);
1673
+ const sessionId = resolveSessionId(parentCtx, void 0, ctx);
1545
1674
  const userId = resolveGenAiUserId(parentCtx, promptId);
1675
+ const agentName = (subagentContext.getStore() ?? interactionParentCtx)?.attributes["gen_ai.agent.name"];
1546
1676
  const attributes = {
1547
1677
  ...sessionId ? { "session.id": sessionId } : {},
1548
1678
  ...attrs,
@@ -1550,6 +1680,7 @@ function startToolSpan(toolName, attrs, description, promptId) {
1550
1680
  "gen_ai.operation.name": "execute_tool",
1551
1681
  "gen_ai.tool.name": toolName,
1552
1682
  "gen_ai.tool.type": "function",
1683
+ ...typeof agentName === "string" ? { "gen_ai.agent.name": agentName } : {},
1553
1684
  ...description ? {
1554
1685
  "gen_ai.tool.description": truncateSpanText(
1555
1686
  description,
@@ -1557,6 +1688,9 @@ function startToolSpan(toolName, attrs, description, promptId) {
1557
1688
  )
1558
1689
  } : {}
1559
1690
  };
1691
+ if (typeof agentName !== "string") {
1692
+ delete attributes["gen_ai.agent.name"];
1693
+ }
1560
1694
  span = getTracer().startSpan(
1561
1695
  SPAN_TOOL,
1562
1696
  { kind: SpanKind.INTERNAL, attributes },
@@ -1566,6 +1700,7 @@ function startToolSpan(toolName, attrs, description, promptId) {
1566
1700
  const spanContextObj = {
1567
1701
  span,
1568
1702
  startTime: Date.now(),
1703
+ ...interactionParentCtx ? { interactionOwner: interactionParentCtx } : {},
1569
1704
  attributes,
1570
1705
  type: "tool"
1571
1706
  };
@@ -1588,7 +1723,11 @@ function runInToolSpanContext(span, fn) {
1588
1723
  const spanId = getSpanId(span);
1589
1724
  const spanCtx = activeSpans.get(spanId)?.deref();
1590
1725
  if (!spanCtx) return fn();
1591
- const otelCtxWithSpan = trace.setSpan(context.active(), span);
1726
+ const sessionId = resolveSessionId(spanCtx);
1727
+ const otelCtxWithSpan = trace.setSpan(
1728
+ setSessionIdOnContext(context.active(), sessionId),
1729
+ span
1730
+ );
1592
1731
  return toolContext.run(spanCtx, () => context.with(otelCtxWithSpan, fn));
1593
1732
  }
1594
1733
  __name(runInToolSpanContext, "runInToolSpanContext");
@@ -1612,17 +1751,16 @@ function endToolSpan(span, metadata) {
1612
1751
  }
1613
1752
  if (metadata.error !== void 0)
1614
1753
  endAttributes["error"] = truncateSpanError(metadata.error);
1754
+ if (metadata.success === false && !metadata.cancelled) {
1755
+ endAttributes["error.type"] = "tool_error";
1756
+ }
1615
1757
  if (metadata.cancelled) {
1616
1758
  endAttributes[TOOL_FAILURE_KIND_ATTRIBUTE] = TOOL_FAILURE_KIND_CANCELLED;
1617
1759
  }
1618
1760
  }
1619
1761
  spanCtx.span.setAttributes(endAttributes);
1620
1762
  if (metadata) {
1621
- if (metadata.cancelled) {
1622
- spanCtx.span.setStatus({ code: SpanStatusCode.UNSET });
1623
- } else if (metadata.success !== false) {
1624
- spanCtx.span.setStatus({ code: SpanStatusCode.OK });
1625
- } else {
1763
+ if (!metadata.cancelled && metadata.success === false) {
1626
1764
  spanCtx.span.setStatus({
1627
1765
  code: SpanStatusCode.ERROR,
1628
1766
  message: metadata.error ? truncateSpanError(metadata.error) : "tool error"
@@ -1643,6 +1781,7 @@ function endToolSpan(span, metadata) {
1643
1781
  }
1644
1782
  activeSpans.delete(spanId);
1645
1783
  strongSpans.delete(spanId);
1784
+ touchInteractionContext(spanCtx.interactionOwner);
1646
1785
  }
1647
1786
  __name(endToolSpan, "endToolSpan");
1648
1787
  function startToolExecutionSpan(options) {
@@ -1709,6 +1848,8 @@ function endToolExecutionSpan(span, metadata) {
1709
1848
  spanCtx.ended = true;
1710
1849
  try {
1711
1850
  const duration = Date.now() - spanCtx.startTime;
1851
+ const executionStatus = metadata?.executionStatus;
1852
+ const cancelled = metadata?.cancelled === true || executionStatus === "cancelled";
1712
1853
  const endAttributes = {};
1713
1854
  if (metadata?.attributes) {
1714
1855
  Object.assign(endAttributes, metadata.attributes);
@@ -1722,19 +1863,21 @@ function endToolExecutionSpan(span, metadata) {
1722
1863
  if (metadata.executionStatus !== void 0) {
1723
1864
  endAttributes["execution_status"] = metadata.executionStatus;
1724
1865
  }
1725
- if (metadata.errorType !== void 0) {
1866
+ if (metadata.errorType) {
1726
1867
  endAttributes["error_type"] = metadata.errorType;
1727
- endAttributes["error.type"] = metadata.errorType;
1868
+ if (!cancelled) {
1869
+ endAttributes["error.type"] = metadata.errorType;
1870
+ }
1871
+ }
1872
+ const failed = !cancelled && executionStatus !== "not_started" && (executionStatus === void 0 ? metadata.success === false : executionStatus !== "success");
1873
+ if (failed && endAttributes["error.type"] === void 0) {
1874
+ endAttributes["error.type"] = "tool_execution_error";
1728
1875
  }
1729
1876
  }
1730
1877
  spanCtx.span.setAttributes(endAttributes);
1731
- const executionStatus = metadata?.executionStatus;
1732
- const cancelled = metadata?.cancelled === true || executionStatus === "cancelled";
1733
1878
  if (metadata && !cancelled && executionStatus !== "not_started") {
1734
1879
  const succeeded = executionStatus === void 0 ? metadata.success !== false : executionStatus === "success";
1735
- if (succeeded) {
1736
- spanCtx.span.setStatus({ code: SpanStatusCode.OK });
1737
- } else {
1880
+ if (!succeeded) {
1738
1881
  spanCtx.span.setStatus({
1739
1882
  code: SpanStatusCode.ERROR,
1740
1883
  message: metadata.error ? truncateSpanError(metadata.error) : "tool execution error"
@@ -1835,6 +1978,7 @@ function startHookSpan(opts) {
1835
1978
  }
1836
1979
  ensureCleanupInterval();
1837
1980
  const parentCtx = toolContext.getStore() ?? subagentContext.getStore() ?? interactionContext.getStore() ?? void 0;
1981
+ touchInteractionContext(interactionContext.getStore());
1838
1982
  const ctx = resolveParentContext(parentCtx);
1839
1983
  const sessionId = resolveSessionId(parentCtx);
1840
1984
  const attributes = {
@@ -1854,6 +1998,7 @@ function startHookSpan(opts) {
1854
1998
  const spanContextObj = {
1855
1999
  span,
1856
2000
  startTime: Date.now(),
2001
+ ...interactionContext.getStore() ? { interactionOwner: interactionContext.getStore() } : {},
1857
2002
  attributes,
1858
2003
  type: "hook"
1859
2004
  };
@@ -1895,6 +2040,8 @@ function endHookSpan(span, metadata) {
1895
2040
  );
1896
2041
  if (metadata.error !== void 0)
1897
2042
  endAttributes["error"] = truncateSpanError(metadata.error);
2043
+ if (metadata.error !== void 0)
2044
+ endAttributes["error.type"] = "hook_error";
1898
2045
  }
1899
2046
  spanCtx.span.setAttributes(endAttributes);
1900
2047
  if (metadata?.error !== void 0) {
@@ -1917,18 +2064,21 @@ function endHookSpan(span, metadata) {
1917
2064
  }
1918
2065
  activeSpans.delete(spanId);
1919
2066
  strongSpans.delete(spanId);
2067
+ touchInteractionContext(spanCtx.interactionOwner);
1920
2068
  }
1921
2069
  __name(endHookSpan, "endHookSpan");
1922
2070
  function startSubagentSpan(opts) {
1923
2071
  if (!isTelemetrySdkInitialized()) return NOOP_SPAN;
1924
2072
  ensureCleanupInterval();
1925
2073
  const parentCtx = subagentContext.getStore() ?? toolContext.getStore() ?? interactionContext.getStore();
2074
+ const sessionId = resolveSessionId(parentCtx, opts.sessionId) ?? opts.sessionId;
1926
2075
  const userId = resolveGenAiUserId(parentCtx);
1927
2076
  const attributes = {
1928
2077
  // Spec-aligned (OTel GenAI Agent Spans, Development status).
1929
2078
  "gen_ai.operation.name": "invoke_agent",
1930
2079
  "gen_ai.agent.name": opts.subagentName,
1931
- "gen_ai.conversation.id": opts.sessionId,
2080
+ "gen_ai.conversation.id": sessionId,
2081
+ "session.id": sessionId,
1932
2082
  ...userId ? { "gen_ai.user.id": userId } : {},
1933
2083
  // Vendor identity and lifecycle. The per-invocation ID stays private;
1934
2084
  // gen_ai.agent.id is reserved for a stable agent definition identity.
@@ -1988,7 +2138,11 @@ function runInSubagentSpanContext(span, fn) {
1988
2138
  const spanId = getSpanId(span);
1989
2139
  const spanCtx = activeSpans.get(spanId)?.deref();
1990
2140
  if (!spanCtx) return fn();
1991
- const otelCtxWithSpan = trace.setSpan(context.active(), span);
2141
+ const sessionId = resolveSessionId(spanCtx);
2142
+ const otelCtxWithSpan = trace.setSpan(
2143
+ setSessionIdOnContext(context.active(), sessionId),
2144
+ span
2145
+ );
1992
2146
  return subagentContext.run(
1993
2147
  spanCtx,
1994
2148
  () => toolContext.run(void 0, () => context.with(otelCtxWithSpan, fn))
@@ -2026,17 +2180,15 @@ function endSubagentSpan(span, metadata) {
2026
2180
  if (metadata.resultSummaryPresent !== void 0) {
2027
2181
  endAttributes["qwen-code.subagent.result_summary_present"] = metadata.resultSummaryPresent;
2028
2182
  }
2029
- if (metadata.error !== void 0) {
2183
+ if (metadata.status === "failed" && metadata.error !== void 0) {
2030
2184
  const truncated = truncateSpanError(metadata.error);
2031
2185
  endAttributes["exception.message"] = truncated;
2032
2186
  }
2033
- if (metadata.errorType !== void 0) {
2034
- endAttributes["error.type"] = metadata.errorType;
2187
+ if (metadata.status === "failed") {
2188
+ endAttributes["error.type"] = metadata.errorType || "subagent_error";
2035
2189
  }
2036
2190
  spanCtx.span.setAttributes(endAttributes);
2037
- if (metadata.status === "completed") {
2038
- spanCtx.span.setStatus({ code: SpanStatusCode.OK });
2039
- } else if (metadata.status === "failed") {
2191
+ if (metadata.status === "failed") {
2040
2192
  spanCtx.span.setStatus({
2041
2193
  code: SpanStatusCode.ERROR,
2042
2194
  message: metadata.error ? truncateSpanError(metadata.error) : "subagent failed"
@@ -2058,12 +2210,16 @@ function endSubagentSpan(span, metadata) {
2058
2210
  strongSpans.delete(spanId);
2059
2211
  }
2060
2212
  __name(endSubagentSpan, "endSubagentSpan");
2061
- function getActiveInteractionSpan() {
2062
- const ctx = interactionContext.getStore() ?? lastInteractionCtx;
2063
- if (!ctx || ctx.ended) return void 0;
2064
- return ctx.span;
2213
+ function getActiveInteractionSpan(promptId) {
2214
+ return getInteractionContext(promptId)?.span;
2065
2215
  }
2066
2216
  __name(getActiveInteractionSpan, "getActiveInteractionSpan");
2217
+ function recordInteractionActivity(promptId, expectedOwner) {
2218
+ const spanCtx = getInteractionContext(promptId);
2219
+ if (!spanCtx || spanCtx.span !== expectedOwner) return false;
2220
+ return touchInteractionContext(spanCtx);
2221
+ }
2222
+ __name(recordInteractionActivity, "recordInteractionActivity");
2067
2223
 
2068
2224
  export {
2069
2225
  getMeter,
@@ -2097,12 +2253,17 @@ export {
2097
2253
  API_CALL_FAILED_SPAN_STATUS_MESSAGE,
2098
2254
  API_CALL_ABORTED_SPAN_STATUS_MESSAGE,
2099
2255
  safeSetStatus,
2256
+ stripAnsiAndControl,
2257
+ safeLiteralReplace,
2258
+ isBinary,
2259
+ normalizeContent,
2260
+ redactUrlCredentials,
2100
2261
  isInNativeSubagentSpan,
2101
2262
  truncateSpanError,
2102
2263
  startInteractionSpan,
2103
2264
  endInteractionSpan,
2104
2265
  withInteractionSpan,
2105
- startLLMRequestSpan,
2266
+ startLLMRequestSpanWithContext,
2106
2267
  endLLMRequestSpan,
2107
2268
  startToolSpan,
2108
2269
  runInToolSpanContext,
@@ -2117,6 +2278,7 @@ export {
2117
2278
  runInSubagentSpanContext,
2118
2279
  endSubagentSpan,
2119
2280
  getActiveInteractionSpan,
2281
+ recordInteractionActivity,
2120
2282
  emitSessionStart,
2121
2283
  emitSessionEnd,
2122
2284
  isTelemetrySdkInitialized,