@qwen-code/qwen-code 0.20.2-jobbench-no-todo-write.0 → 0.21.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 (370) hide show
  1. package/bundled/qc-helper/docs/configuration/settings.md +5 -0
  2. package/bundled/qc-helper/docs/features/sub-agents.md +23 -5
  3. package/bundled/qc-helper/docs/integration-github-action.md +9 -9
  4. package/bundled/review/SKILL.md +7 -3
  5. package/chunks/MaxSizedBox-5DPPWPGT.js +85 -0
  6. package/chunks/{StandaloneSessionPicker-WBRBHD2M.js → StandaloneSessionPicker-BIRMPLRD.js} +66 -58
  7. package/chunks/{acp-startup-profiler-N3RHHXJ3.js → acp-startup-profiler-RV3IV562.js} +2 -2
  8. package/chunks/{acpAgent-BBQZ33CA.js → acpAgent-6J2U72PQ.js} +706 -182
  9. package/chunks/agent-6ODUANDO.js +81 -0
  10. package/chunks/agent-headless-7BYQTMHW.js +75 -0
  11. package/chunks/{anthropicContentGenerator-HGWAHO24.js → anthropicContentGenerator-75BKLTSP.js} +117 -43
  12. package/chunks/{artifact-tool-56T5IMBP.js → artifact-tool-Y5T7GG7F.js} +3 -3
  13. package/chunks/{askUserQuestion-E25OBIC2.js → askUserQuestion-2H6747FR.js} +3 -3
  14. package/chunks/bridge-ZUB64FAE.js +90 -0
  15. package/chunks/{build-SSCNEHZZ.js → build-RV63TIRH.js} +2 -3
  16. package/chunks/{ca-N6VVUFVB.js → ca-25EDXPFZ.js} +2 -0
  17. package/chunks/{channel-worker-group-LFBT7K64.js → channel-worker-group-2ZD7TVAT.js} +7 -6
  18. package/chunks/{channel-worker-manager-3RUPERG2.js → channel-worker-manager-4OA4BCGB.js} +189 -29
  19. package/chunks/{channel-worker-supervisor-A3KVATD3.js → channel-worker-supervisor-V7KCFJTS.js} +6 -5
  20. package/chunks/{chunk-TYQMGACW.js → chunk-22C7BQ6D.js} +508 -10967
  21. package/chunks/chunk-2JZBVYTU.js +452 -0
  22. package/chunks/{chunk-H2XVO6NE.js → chunk-2MIN6GRR.js} +1 -1
  23. package/chunks/{chunk-B2HSPMD4.js → chunk-2NH6DYI4.js} +12 -12
  24. package/chunks/chunk-2SCDWPXI.js +246 -0
  25. package/chunks/{chunk-JK26TQON.js → chunk-2X55UKQE.js} +3 -3
  26. package/chunks/{chunk-7VUQQBR7.js → chunk-3QMGYBFN.js} +2 -65
  27. package/chunks/{chunk-UMCULC5M.js → chunk-3RN6GBKS.js} +1 -1
  28. package/chunks/{chunk-QR6U5QPP.js → chunk-3SJ43L4W.js} +4 -0
  29. package/chunks/chunk-46UV252V.js +128 -0
  30. package/chunks/{chunk-GPMVHZP4.js → chunk-4WIZGAH3.js} +7 -7
  31. package/chunks/{chunk-CI3GWKGJ.js → chunk-55DJUCI2.js} +87 -29
  32. package/chunks/{chunk-QNLNLENL.js → chunk-5I2IWRSH.js} +2 -2
  33. package/chunks/{chunk-D7WXIW7H.js → chunk-5NBDS5S6.js} +145 -5
  34. package/chunks/{chunk-E4IMU4Y5.js → chunk-63P4EL5V.js} +1 -1
  35. package/chunks/chunk-6FGBXPWM.js +293 -0
  36. package/chunks/{chunk-NEEB7UEN.js → chunk-6GMVPFB2.js} +153 -72
  37. package/chunks/{chunk-KWK7UE6L.js → chunk-6OUGMXDC.js} +6 -6
  38. package/chunks/{chunk-QRUIS3DN.js → chunk-6PEXNQTX.js} +22 -1
  39. package/chunks/{chunk-77OZOGPT.js → chunk-7JURR4JT.js} +1 -1
  40. package/chunks/{chunk-4MWNZNJ4.js → chunk-7MVVZO4N.js} +4 -4
  41. package/chunks/{chunk-6ZBPS62S.js → chunk-7ZCNENPP.js} +1 -1
  42. package/chunks/{chunk-6X4GWOPW.js → chunk-A5L3JMUA.js} +1 -1
  43. package/chunks/{chunk-B3I77W5J.js → chunk-ACY3A37B.js} +3 -3
  44. package/chunks/chunk-AMDSOFFV.js +10860 -0
  45. package/chunks/{chunk-RV4C2ZFG.js → chunk-BIQWWWJN.js} +1 -1
  46. package/chunks/{chunk-ZHERRXZJ.js → chunk-BJX6ZSUK.js} +4 -4
  47. package/chunks/chunk-BK2UNYWD.js +29 -0
  48. package/chunks/{chunk-7TLUW4ZE.js → chunk-BKHWX6I2.js} +3 -3
  49. package/chunks/chunk-BPJSQIJX.js +100 -0
  50. package/chunks/{chunk-M7WBGLYP.js → chunk-BULDBTYC.js} +2 -0
  51. package/chunks/{chunk-H4A4A2SY.js → chunk-CIKQ7KKO.js} +4625 -8645
  52. package/chunks/{chunk-QZJY47IE.js → chunk-D3UEZIQH.js} +7 -5
  53. package/chunks/chunk-DHHOYAPR.js +1462 -0
  54. package/chunks/{chunk-LESHKUWF.js → chunk-DLWL3Z7A.js} +5 -3
  55. package/chunks/{chunk-XHATNRQA.js → chunk-DP3IHZGG.js} +0 -2
  56. package/chunks/chunk-E5TUC6CA.js +479 -0
  57. package/chunks/{chunk-6NRFYMKG.js → chunk-EBJQ6AXW.js} +11 -10
  58. package/chunks/{chunk-HABKX6LY.js → chunk-EPDRMGT4.js} +164 -17
  59. package/chunks/{chunk-P2BQZ7H7.js → chunk-ETSW4KLJ.js} +2 -2
  60. package/chunks/{chunk-KHOVYUHX.js → chunk-FNQ6T3CV.js} +20 -3
  61. package/chunks/{chunk-64EG42HV.js → chunk-FQK6JAFG.js} +72 -23
  62. package/chunks/{chunk-L6U47G5P.js → chunk-FSITMZJH.js} +8 -8
  63. package/chunks/{chunk-6RLROE6G.js → chunk-GLWP3FDB.js} +80 -15
  64. package/chunks/{chunk-CXIOPXRR.js → chunk-GSN55ZRI.js} +5 -5
  65. package/chunks/{chunk-LVA5OHQO.js → chunk-H4SBPHSA.js} +3 -3
  66. package/chunks/chunk-H5FFA6TH.js +902 -0
  67. package/chunks/{chunk-TDKQP3M6.js → chunk-HIJQF5B5.js} +1 -1
  68. package/chunks/{chunk-NXE6SQIV.js → chunk-IJTOWOD7.js} +14 -3
  69. package/chunks/chunk-IKCX4CCL.js +469 -0
  70. package/chunks/{chunk-7SSWNGEJ.js → chunk-IKYJHJNF.js} +3 -3
  71. package/chunks/{chunk-64XKYOXK.js → chunk-IO3IX5Q4.js} +1 -1
  72. package/chunks/{chunk-RS7MT2QG.js → chunk-IPUUTYMV.js} +2 -4
  73. package/chunks/{chunk-XU457J4V.js → chunk-IRH27ZC2.js} +2 -2
  74. package/chunks/{chunk-SVIMKSEI.js → chunk-J24WCGIN.js} +4 -4
  75. package/chunks/{chunk-4LVZNIDO.js → chunk-J56UI34H.js} +4 -13
  76. package/chunks/{chunk-TJTKSVIV.js → chunk-JLU636DO.js} +5 -1
  77. package/chunks/{chunk-7PIL2BYF.js → chunk-JVPM2ULZ.js} +6 -6
  78. package/chunks/{chunk-KBB5O3JO.js → chunk-JXJFVC6E.js} +37 -18
  79. package/chunks/chunk-JZA3JUDJ.js +82 -0
  80. package/chunks/{chunk-45PO6ZIS.js → chunk-K36B6G2O.js} +5 -5
  81. package/chunks/{chunk-GPSKDNEE.js → chunk-K4XWPEWB.js} +4 -4
  82. package/chunks/{chunk-K7EUPLIP.js → chunk-KIM5GUMA.js} +654 -117
  83. package/chunks/{chunk-42W5BDEY.js → chunk-KMQ33DO4.js} +7 -5
  84. package/chunks/{chunk-E2UVIFI2.js → chunk-KRXPRVGL.js} +0 -1
  85. package/chunks/{chunk-WHGVTP7Q.js → chunk-L26JL52R.js} +3 -3
  86. package/chunks/{chunk-7Z6JQEL6.js → chunk-L5UHQJTJ.js} +1 -1
  87. package/chunks/{chunk-26CBI4DC.js → chunk-LB6DUZ26.js} +259 -67
  88. package/chunks/chunk-LEH5C7FV.js +232 -0
  89. package/chunks/{chunk-UTGFTJ2H.js → chunk-LH2BYDQ5.js} +6 -4
  90. package/chunks/{chunk-QKTHJXCS.js → chunk-LK7CHLVP.js} +79 -2
  91. package/chunks/{chunk-V7WNRZL7.js → chunk-LKEJ26GS.js} +11 -11
  92. package/chunks/{chunk-6VPLV3L3.js → chunk-LQIW3YFY.js} +227 -41
  93. package/chunks/chunk-LS77BEZP.js +405 -0
  94. package/chunks/{chunk-5WDRI7US.js → chunk-M4FMGVY4.js} +3 -3
  95. package/chunks/{chunk-57FIIFJN.js → chunk-M5JM7OSF.js} +1 -1
  96. package/chunks/{chunk-7362QS5B.js → chunk-MB4MZHMJ.js} +80 -37
  97. package/chunks/{chunk-4K56OJFJ.js → chunk-MUP3T3AD.js} +1 -1
  98. package/chunks/{chunk-CJQ3FZ2G.js → chunk-MVSUYZDT.js} +4 -4
  99. package/chunks/{chunk-6FZYKBKV.js → chunk-MZAXJAUM.js} +1 -1
  100. package/chunks/{chunk-32L4D2O2.js → chunk-NH6KE4JX.js} +3 -3
  101. package/chunks/chunk-NIBLUX3Y.js +934 -0
  102. package/chunks/{chunk-OQB4EXO4.js → chunk-NL7LTRLR.js} +1 -1
  103. package/chunks/{chunk-6S5HSCOI.js → chunk-OFDOK3VM.js} +5 -5
  104. package/chunks/{chunk-LIZRAKPB.js → chunk-OHNBB4XR.js} +1 -1
  105. package/chunks/{chunk-MDZTPSXO.js → chunk-OKY7HXPG.js} +2 -2
  106. package/chunks/{chunk-NHDKSOEY.js → chunk-P3QQPMQA.js} +5 -5
  107. package/chunks/{chunk-4SCOLXTD.js → chunk-PC6JANNU.js} +5 -5
  108. package/chunks/{chunk-IWALV67J.js → chunk-PHOF65IG.js} +4300 -1284
  109. package/chunks/{chunk-OQ5SYCPE.js → chunk-PJIZUQVC.js} +2 -2
  110. package/chunks/{chunk-5DTTYNB7.js → chunk-PQNHRFJC.js} +16 -3
  111. package/chunks/{chunk-YM3SZTH4.js → chunk-PR75REBZ.js} +18 -1
  112. package/chunks/{chunk-5XORMWA2.js → chunk-PSOO6YXD.js} +18 -15
  113. package/chunks/{chunk-X6N25LXS.js → chunk-PWTZEM3C.js} +2 -2
  114. package/chunks/{chunk-GSX6P2JW.js → chunk-PWVFN2LF.js} +1 -1
  115. package/chunks/{chunk-AHX6AKPD.js → chunk-Q4M4MDQ4.js} +2 -2
  116. package/chunks/{chunk-3EHJ44GG.js → chunk-QAF7NMK7.js} +1 -1
  117. package/chunks/{chunk-WSYKDFYR.js → chunk-R5AFZNQW.js} +5 -5
  118. package/chunks/{chunk-63DJBU32.js → chunk-RF3EXIHJ.js} +39 -18
  119. package/chunks/{chunk-4K7VDKAD.js → chunk-RHLZR4E5.js} +1 -1
  120. package/chunks/{chunk-SXPSOMQ4.js → chunk-RIBKPMRP.js} +220 -141
  121. package/chunks/{chunk-RVLZCXEE.js → chunk-RWTEFFPU.js} +82 -3
  122. package/chunks/{chunk-ZUTM4LHM.js → chunk-RZIX2G32.js} +1 -1
  123. package/chunks/{chunk-ZKBNRL6O.js → chunk-SQCQ4KO2.js} +336 -404
  124. package/chunks/{chunk-THJNPLI4.js → chunk-TARRHLLG.js} +1 -0
  125. package/chunks/{chunk-RHYFF54J.js → chunk-TEHGS6UP.js} +50 -21
  126. package/chunks/{chunk-ACQJPDDS.js → chunk-TGILQ3YH.js} +8 -8
  127. package/chunks/{chunk-Q2YKNMLS.js → chunk-TOFQCPDC.js} +43 -10
  128. package/chunks/{chunk-ACZIBDYD.js → chunk-TPRQ7RZH.js} +587 -176
  129. package/chunks/{chunk-T4TZQJ7W.js → chunk-TWPJO254.js} +5 -16
  130. package/chunks/{chunk-7MWABCXU.js → chunk-U7M2DMGW.js} +3 -3
  131. package/chunks/{chunk-KQQ757OQ.js → chunk-UDX5OBWR.js} +41 -9
  132. package/chunks/{chunk-SRPZG4ER.js → chunk-USTWD7QV.js} +6 -4
  133. package/chunks/{chunk-NPQDJGKU.js → chunk-UUUTRMI2.js} +1 -1
  134. package/chunks/chunk-UW5EOVUN.js +249 -0
  135. package/chunks/{chunk-6IL7KRLE.js → chunk-VAK25FTU.js} +1 -1
  136. package/chunks/{chunk-TDDFEPBX.js → chunk-VIA5XA4U.js} +5 -2
  137. package/chunks/{chunk-3BJDQVE6.js → chunk-VRYUBFMC.js} +1 -1
  138. package/chunks/{chunk-PLQODS7F.js → chunk-VULLI6WQ.js} +172 -6
  139. package/chunks/{chunk-GN45XAAU.js → chunk-WCXCRJYB.js} +1 -1
  140. package/chunks/{chunk-2LI23QA6.js → chunk-X5XDDSSH.js} +1 -1
  141. package/chunks/{chunk-O32RMIMO.js → chunk-Y34KJKDC.js} +1 -1
  142. package/chunks/{chunk-7ZD5EKXE.js → chunk-YBL3QUDD.js} +2 -2
  143. package/chunks/{chunk-H4AR2JQF.js → chunk-YH6G52F2.js} +3 -3
  144. package/chunks/{chunk-3G3UUMRS.js → chunk-YPE6A4GC.js} +2 -2
  145. package/chunks/{chunk-3F2JUWCH.js → chunk-YX324OPW.js} +1 -1
  146. package/chunks/{chunk-CGIDQG6J.js → chunk-Z2BC6UJ5.js} +3 -3
  147. package/chunks/{chunk-QLJUC7TG.js → chunk-ZD6UTE4A.js} +1 -1
  148. package/chunks/{chunk-ZPWJZHJ2.js → chunk-ZFDTEDCF.js} +6 -6
  149. package/chunks/chunk-ZJHVAS7M.js +289 -0
  150. package/chunks/{chunk-XAGLQITN.js → chunk-ZNAUOR2I.js} +15 -12
  151. package/chunks/{chunk-T2L47JJK.js → chunk-ZOIFNCKL.js} +4 -4
  152. package/chunks/{computer-use-RZ3UUWYW.js → computer-use-SOQ4E3VX.js} +43 -34
  153. package/chunks/{config-utils-SQUBZEQM.js → config-utils-7V7GGIW6.js} +3 -3
  154. package/chunks/contextCommand-JLHYA34Z.js +80 -0
  155. package/chunks/{create-sub-session-AZ77LBL3.js → create-sub-session-IWW2IZ2T.js} +3 -3
  156. package/chunks/{create-sub-session-EQG73FT6.js → create-sub-session-QRJLW5BV.js} +43 -34
  157. package/chunks/{cron-create-KTWJM7QT.js → cron-create-YIID5XAW.js} +6 -6
  158. package/chunks/{cron-delete-2P3I5ULL.js → cron-delete-ZVHYCEP2.js} +5 -5
  159. package/chunks/{cron-list-PXDPGEDQ.js → cron-list-XEGS463Q.js} +5 -5
  160. package/chunks/{daemon-RAPSDJH7.js → daemon-YO6433NF.js} +350 -53
  161. package/chunks/daemon-status-provider-2233Q37D.js +89 -0
  162. package/chunks/{de-4IBXM7CN.js → de-HGRCYDEJ.js} +1 -0
  163. package/chunks/{dist-UIFWIFRO.js → dist-46NQKLTW.js} +2 -2
  164. package/chunks/{dist-XRYV6TJP.js → dist-AIKFMUKK.js} +50 -4
  165. package/chunks/{dist-XBJVSWS2.js → dist-BBLXMS3N.js} +14 -2
  166. package/chunks/{dist-OMW6WDEO.js → dist-F6IBUDR4.js} +40 -9
  167. package/chunks/{dist-PJLG2XYX.js → dist-WEAHOXDM.js} +1 -1
  168. package/chunks/{dist-OAV7LJGJ.js → dist-YFNEUWSE.js} +26 -2
  169. package/chunks/earlyInputCapture-A7NDU3PF.js +82 -0
  170. package/chunks/{edit-XRSKQPHQ.js → edit-OBDSQURM.js} +43 -34
  171. package/chunks/{en-USMCCJAJ.js → en-MTWBNGDO.js} +15 -0
  172. package/chunks/{enter-worktree-WAHCWE6I.js → enter-worktree-U6MRPQ2P.js} +43 -34
  173. package/chunks/{enterPlanMode-QIOYLDCF.js → enterPlanMode-BC5QUZZ2.js} +43 -34
  174. package/chunks/{environment-T3FXCDJI.js → environment-W5UFC2CH.js} +46 -37
  175. package/chunks/errors-M7CLORXH.js +88 -0
  176. package/chunks/{exit-worktree-RHVTLX6T.js → exit-worktree-DGNYMECB.js} +43 -34
  177. package/chunks/{exitPlanMode-UATOE2GQ.js → exitPlanMode-GXTBWQAR.js} +43 -34
  178. package/chunks/{fast-path-J3RHOYSZ.js → fast-path-JJZFJANL.js} +6 -6
  179. package/chunks/{fast-path-settings-XB3CPUJT.js → fast-path-settings-WQJU2LAT.js} +2 -2
  180. package/chunks/{fr-WVHEBDDB.js → fr-45RLL55O.js} +1 -0
  181. package/chunks/{gemini-P72OGOH6.js → gemini-QS36EBZV.js} +133 -102
  182. package/chunks/{geminiContentGenerator-F6EG5FXF.js → geminiContentGenerator-AG4KB6CV.js} +14 -8
  183. package/chunks/{getMachineId-bsd-QFVLPUPT.js → getMachineId-bsd-V7W3GODC.js} +1 -1
  184. package/chunks/{getMachineId-darwin-DGMQQE2E.js → getMachineId-darwin-TDO75DQP.js} +1 -1
  185. package/chunks/{getMachineId-linux-R4Z6CSWC.js → getMachineId-linux-TF43WQT2.js} +1 -1
  186. package/chunks/{getMachineId-unsupported-Z3SBVBUV.js → getMachineId-unsupported-ZGUO3TXT.js} +1 -1
  187. package/chunks/{getMachineId-win-SCK5UFDT.js → getMachineId-win-ECFYZZFQ.js} +1 -1
  188. package/chunks/{glob-WHASQZRX.js → glob-V7R3PSK3.js} +43 -34
  189. package/chunks/{grep-LS7AADJ3.js → grep-QYPSK7OP.js} +43 -34
  190. package/chunks/handleAutoUpdate-6DBEZYPV.js +81 -0
  191. package/chunks/{i18n-IMVASWIF.js → i18n-VUJJZIMU.js} +44 -35
  192. package/chunks/image-gen-Z3VPGKRC.js +240 -0
  193. package/chunks/initializer-UWAK5U5O.js +86 -0
  194. package/chunks/installationInfo-6O2YAA52.js +80 -0
  195. package/chunks/{ja-KY4ROZTE.js → ja-B7DF7DFG.js} +1 -0
  196. package/chunks/{keychain-token-storage-6ACJDYIB.js → keychain-token-storage-MDTG3WRM.js} +3 -3
  197. package/chunks/{kittyProtocolDetector-HCNNKJTI.js → kittyProtocolDetector-MBRTDRBK.js} +5 -3
  198. package/chunks/list-GB4ESM3T.js +89 -0
  199. package/chunks/list-agents-5KJJHR6I.js +80 -0
  200. package/chunks/loadedSettingsAdapter-OT6JVQ7U.js +83 -0
  201. package/chunks/loggingContentGenerator-HS3S5H3Q.js +1077 -0
  202. package/chunks/{loop-wakeup-RNMRVA66.js → loop-wakeup-FXKNNYSY.js} +7 -7
  203. package/chunks/{ls-J2ZI5XYK.js → ls-NTK6VOQJ.js} +5 -5
  204. package/chunks/{lsp-UMS3NUB5.js → lsp-2JI24STP.js} +3 -3
  205. package/chunks/{managed-npm-update-L6UY7OM7.js → managed-npm-update-JYEMMXA3.js} +94 -37
  206. package/chunks/mcp-6DBDJPFU.js +83 -0
  207. package/chunks/{monitor-DXYFB5QD.js → monitor-R3ODH5U6.js} +45 -35
  208. package/chunks/node-UUDY34IG.js +305 -0
  209. package/chunks/nonInteractiveCli-MOYCYBBU.js +141 -0
  210. package/chunks/{notebook-edit-KGD7YJEA.js → notebook-edit-BNOK452R.js} +43 -34
  211. package/chunks/{openaiContentGenerator-C74A2XAU.js → openaiContentGenerator-WMCU3O2H.js} +27 -17
  212. package/chunks/pidfile-TFRZZZIO.js +86 -0
  213. package/chunks/{processUtils-GUT5B4R6.js → processUtils-RT7UNCC2.js} +2 -2
  214. package/chunks/{pt-OK455PLH.js → pt-22Q3FP73.js} +1 -0
  215. package/chunks/{qwenContentGenerator-PT46FQPA.js → qwenContentGenerator-HHCRK4SX.js} +56 -41
  216. package/chunks/{qwenOAuth2-S7DZHUUU.js → qwenOAuth2-OWLB5AKH.js} +14 -27
  217. package/chunks/read-file-APMO3PSX.js +31 -0
  218. package/chunks/{read-mcp-resource-F6HYMDUY.js → read-mcp-resource-4DKQWGHD.js} +3 -3
  219. package/chunks/{record-artifact-7GCFLDD7.js → record-artifact-RQKFYO5B.js} +3 -3
  220. package/chunks/resumeHistoryUtils-6KRYEAWZ.js +91 -0
  221. package/chunks/ripGrep-BEJDEDXW.js +73 -0
  222. package/chunks/{ru-7SPDGMGD.js → ru-FZCNZHDC.js} +1 -0
  223. package/chunks/{run-qwen-serve-QO4PT5NV.js → run-qwen-serve-FU6HEM4J.js} +276 -62
  224. package/chunks/{runtime-EOTXBUM6.js → runtime-XXRRTNP6.js} +55 -44
  225. package/chunks/{scheduler-MAIQ2PHR.js → scheduler-G2ZS2Z7E.js} +43 -34
  226. package/chunks/{sdk-exporters-grpc-ETLH47EP.js → sdk-exporters-grpc-AK3LGHNO.js} +3 -3
  227. package/chunks/{sdk-exporters-http-T3POX73F.js → sdk-exporters-http-FYBSUCPD.js} +6 -6
  228. package/chunks/{sdk-impl-NSLPDH6I.js → sdk-impl-GMVPB7NB.js} +6 -6
  229. package/chunks/{send-message-PYIJ2PZL.js → send-message-Q6OOR6BR.js} +46 -9
  230. package/chunks/serve-7BSTXJ4T.js +89 -0
  231. package/chunks/{server-CBCC3XQC.js → server-4UMH7OIZ.js} +2348 -396
  232. package/chunks/{session-RQUEFQDL.js → session-K3O3Q2SV.js} +107 -88
  233. package/chunks/{settings-QHXCJDSR.js → settings-CR2EWTBA.js} +53 -44
  234. package/chunks/shell-HH3PF3A2.js +83 -0
  235. package/chunks/{skill-WHSGTGKP.js → skill-I3SDA4MB.js} +17 -15
  236. package/chunks/spawnChannel-RWNDBXGA.js +82 -0
  237. package/chunks/{src-F3HKX47D.js → src-GE4TTTML.js} +290 -171
  238. package/chunks/{standalone-update-BKLONSVI.js → standalone-update-Q6WFRZZQ.js} +45 -36
  239. package/chunks/{startInteractiveUI-TNJ37X5W.js → startInteractiveUI-SLZGHRPH.js} +736 -298
  240. package/chunks/{syntheticOutput-H7RTI5KL.js → syntheticOutput-I3757IWH.js} +4 -4
  241. package/chunks/{task-create-7474AJJD.js → task-create-N7WQSGYA.js} +10 -10
  242. package/chunks/{task-list-633HGOIB.js → task-list-FOPULZEP.js} +7 -7
  243. package/chunks/{task-stop-MNUGHPIA.js → task-stop-H6RHXFVQ.js} +4 -4
  244. package/chunks/{task-update-66GQB5LI.js → task-update-M57TFZJT.js} +10 -10
  245. package/chunks/{team-create-LUHJ7ZCC.js → team-create-YJALH5D2.js} +44 -35
  246. package/chunks/{team-delete-BB3CG3QF.js → team-delete-QE2UXJL7.js} +7 -7
  247. package/chunks/{team-plan-approval-X3DYRL6L.js → team-plan-approval-34QFYKGN.js} +43 -34
  248. package/chunks/theme-manager-SWRILQHI.js +77 -0
  249. package/chunks/todoWrite-VQ7FKOHL.js +358 -0
  250. package/chunks/{tool-search-BAWOETUY.js → tool-search-NF7GB6LE.js} +16 -16
  251. package/chunks/total-session-admission-DLHHHLD3.js +84 -0
  252. package/chunks/{tree-sitter-FS4VPMZA.js → tree-sitter-4D7QS7F6.js} +1 -1
  253. package/chunks/{tree-sitter-bash-6B46JJCV.js → tree-sitter-bash-VEJGF5XF.js} +1 -1
  254. package/chunks/{trustedFolders-4UEOIKOF.js → trustedFolders-KHXHY6PY.js} +44 -35
  255. package/chunks/{update-relaunch-WDWABT5P.js → update-relaunch-WBUZJC5O.js} +5 -5
  256. package/chunks/updateCheck-RKL6M5XN.js +92 -0
  257. package/chunks/useAutoAcceptIndicator-CFQ5BUJL.js +93 -0
  258. package/chunks/{validateNonInterActiveAuth-OKUE3JLF.js → validateNonInterActiveAuth-3R223G3R.js} +91 -81
  259. package/chunks/{version-GMUULLWB.js → version-HS7YSFHV.js} +1 -1
  260. package/chunks/{web-fetch-JBWTMPFN.js → web-fetch-NKCSG7ZE.js} +18 -16
  261. package/chunks/{web-search-27COJHJT.js → web-search-S62WAP4S.js} +13 -27
  262. package/chunks/{workflow-5L37J7YF.js → workflow-QAGU5RU4.js} +44 -35
  263. package/chunks/workspace-providers-status-QSVZUETE.js +86 -0
  264. package/chunks/{workspace-registration-store-TYPYXIP6.js → workspace-registration-store-24JMHDGF.js} +2 -2
  265. package/chunks/workspace-registry-UT4RBNBM.js +88 -0
  266. package/chunks/workspace-service-JFWRUS4V.js +98 -0
  267. package/chunks/workspace-skills-status-ZBBKJOI2.js +85 -0
  268. package/chunks/write-file-VHIXW5M7.js +73 -0
  269. package/chunks/{zh-WY5DWYZD.js → zh-LUIGBD55.js} +15 -0
  270. package/chunks/{zh-TW-BM47YBFH.js → zh-TW-F5KG2IYD.js} +15 -0
  271. package/cli-entry.js +10 -1
  272. package/cli.js +13 -13
  273. package/locales/ca.js +2 -0
  274. package/locales/de.js +1 -0
  275. package/locales/en.js +25 -0
  276. package/locales/fr.js +1 -0
  277. package/locales/ja.js +1 -0
  278. package/locales/pt.js +1 -0
  279. package/locales/ru.js +1 -0
  280. package/locales/zh-TW.js +23 -0
  281. package/locales/zh.js +23 -0
  282. package/package.json +3 -3
  283. package/web-shell/assets/{arc-BWFm0SI0.js → arc-DcbWnB9T.js} +1 -1
  284. package/web-shell/assets/{architectureDiagram-3BPJPVTR-CZ_yL-DQ.js → architectureDiagram-3BPJPVTR-kMMF5sud.js} +1 -1
  285. package/web-shell/assets/{blockDiagram-GPEHLZMM-B9F9mJvG.js → blockDiagram-GPEHLZMM-Htl9vTJS.js} +1 -1
  286. package/web-shell/assets/{c4Diagram-AAUBKEIU-BUdwJW5f.js → c4Diagram-AAUBKEIU-BnZnm0mQ.js} +1 -1
  287. package/web-shell/assets/channel-Cq7YKtfC.js +1 -0
  288. package/web-shell/assets/{chunk-2J33WTMH-w4cF-qlF.js → chunk-2J33WTMH-DziB7kDG.js} +1 -1
  289. package/web-shell/assets/{chunk-4BX2VUAB-BXwURxHJ.js → chunk-4BX2VUAB-CmkD8daw.js} +1 -1
  290. package/web-shell/assets/{chunk-55IACEB6-Gem3LalC.js → chunk-55IACEB6-CHAd9A_U.js} +1 -1
  291. package/web-shell/assets/{chunk-727SXJPM-A3ddVojI.js → chunk-727SXJPM-Dqaam3fE.js} +1 -1
  292. package/web-shell/assets/{chunk-AQP2D5EJ-CjHZ5L_R.js → chunk-AQP2D5EJ-D_-saBYM.js} +1 -1
  293. package/web-shell/assets/{chunk-FMBD7UC4-CKgdgcpv.js → chunk-FMBD7UC4-B9r_veWD.js} +1 -1
  294. package/web-shell/assets/{chunk-ND2GUHAM-Cn2Dykjb.js → chunk-ND2GUHAM-B3EaCSpL.js} +1 -1
  295. package/web-shell/assets/{chunk-QZHKN3VN--0SyraC5.js → chunk-QZHKN3VN-CYq8x9mn.js} +1 -1
  296. package/web-shell/assets/classDiagram-4FO5ZUOK-CQ9aC1Tg.js +1 -0
  297. package/web-shell/assets/classDiagram-v2-Q7XG4LA2-CQ9aC1Tg.js +1 -0
  298. package/web-shell/assets/{cose-bilkent-S5V4N54A-CphhAity.js → cose-bilkent-S5V4N54A-D0ng4uiB.js} +1 -1
  299. package/web-shell/assets/{dagre-BM42HDAG-DU--jiKp.js → dagre-BM42HDAG-DCZollQv.js} +1 -1
  300. package/web-shell/assets/{diagram-2AECGRRQ-BzvuZw1Y.js → diagram-2AECGRRQ-Dfk2pWS0.js} +1 -1
  301. package/web-shell/assets/{diagram-5GNKFQAL-D84-49Y0.js → diagram-5GNKFQAL-kX38ltWR.js} +1 -1
  302. package/web-shell/assets/{diagram-KO2AKTUF-DQTq-3_3.js → diagram-KO2AKTUF-CJz2vsXh.js} +1 -1
  303. package/web-shell/assets/{diagram-LMA3HP47-8FTrshzN.js → diagram-LMA3HP47-BvMLZm_7.js} +1 -1
  304. package/web-shell/assets/{diagram-OG6HWLK6-BCjpDBCm.js → diagram-OG6HWLK6-l7kfStkO.js} +1 -1
  305. package/web-shell/assets/{erDiagram-TEJ5UH35-BtRObkmg.js → erDiagram-TEJ5UH35-BSVa8GGT.js} +1 -1
  306. package/web-shell/assets/{flowDiagram-I6XJVG4X-DTrW6oxy.js → flowDiagram-I6XJVG4X-CoawKIXH.js} +1 -1
  307. package/web-shell/assets/{ganttDiagram-6RSMTGT7-BgPNSW6j.js → ganttDiagram-6RSMTGT7-DFUDH0zF.js} +1 -1
  308. package/web-shell/assets/{gitGraphDiagram-PVQCEYII-BTclNgGV.js → gitGraphDiagram-PVQCEYII-Y2pvpT4e.js} +1 -1
  309. package/web-shell/assets/{index-CxA7AqY6.js → index-D0GX0zZf.js} +1 -1
  310. package/web-shell/assets/index-D9haPt0X.css +5 -0
  311. package/web-shell/assets/index-ckX9Pq5k.js +1230 -0
  312. package/web-shell/assets/{infoDiagram-5YYISTIA-DCE4AJt2.js → infoDiagram-5YYISTIA-CU8_zLiX.js} +1 -1
  313. package/web-shell/assets/{ishikawaDiagram-YF4QCWOH-C8iE6q4Y.js → ishikawaDiagram-YF4QCWOH-AVQiV0DU.js} +1 -1
  314. package/web-shell/assets/{journeyDiagram-JHISSGLW-C_dxdyEc.js → journeyDiagram-JHISSGLW-DQ0VSKa3.js} +1 -1
  315. package/web-shell/assets/{kanban-definition-UN3LZRKU-Dw3n1u3w.js → kanban-definition-UN3LZRKU-BqnWqsE_.js} +1 -1
  316. package/web-shell/assets/{linear-C2BF2zJ9.js → linear-BkoihsaA.js} +1 -1
  317. package/web-shell/assets/{mermaid.core-CGTQU3MA.js → mermaid.core-5RJs-31j.js} +5 -5
  318. package/web-shell/assets/{mindmap-definition-RKZ34NQL-BVFZm9ZC.js → mindmap-definition-RKZ34NQL-D33Bxnpd.js} +1 -1
  319. package/web-shell/assets/{pieDiagram-4H26LBE5-Cc-TNN3n.js → pieDiagram-4H26LBE5-BuEAw3BH.js} +1 -1
  320. package/web-shell/assets/{quadrantDiagram-W4KKPZXB-CgW3Rzsi.js → quadrantDiagram-W4KKPZXB-Kox_usEq.js} +1 -1
  321. package/web-shell/assets/{requirementDiagram-4Y6WPE33-BAaj0Y3B.js → requirementDiagram-4Y6WPE33-CNjeUif0.js} +1 -1
  322. package/web-shell/assets/{sankeyDiagram-5OEKKPKP-XJWmekxS.js → sankeyDiagram-5OEKKPKP-BCd2OL_U.js} +1 -1
  323. package/web-shell/assets/{sequenceDiagram-3UESZ5HK-CtRc_0wf.js → sequenceDiagram-3UESZ5HK-CF2ZTsz0.js} +1 -1
  324. package/web-shell/assets/{stateDiagram-AJRCARHV-WCnvMGy5.js → stateDiagram-AJRCARHV-qenSzHtm.js} +1 -1
  325. package/web-shell/assets/stateDiagram-v2-BHNVJYJU-B7W4zlCr.js +1 -0
  326. package/web-shell/assets/{timeline-definition-PNZ67QCA-C9cRx49L.js → timeline-definition-PNZ67QCA-B5DyWdgs.js} +1 -1
  327. package/web-shell/assets/{vennDiagram-CIIHVFJN-BvXOCEt-.js → vennDiagram-CIIHVFJN-DqP4I_o_.js} +1 -1
  328. package/web-shell/assets/{wardley-L42UT6IY-ByafGtzu.js → wardley-L42UT6IY-CJe2e4mg.js} +1 -1
  329. package/web-shell/assets/{wardleyDiagram-YWT4CUSO-CozAnw8x.js → wardleyDiagram-YWT4CUSO-BMDSw-Rr.js} +1 -1
  330. package/web-shell/assets/{xychartDiagram-2RQKCTM6-Camu9Qvq.js → xychartDiagram-2RQKCTM6-BTVZYkxD.js} +1 -1
  331. package/web-shell/index.html +17 -13
  332. package/chunks/MaxSizedBox-HNWBEL5H.js +0 -77
  333. package/chunks/agent-KTMY6SF3.js +0 -72
  334. package/chunks/agent-headless-HJ56ZZOW.js +0 -66
  335. package/chunks/bridge-AMC5AD7W.js +0 -80
  336. package/chunks/chunk-CBOQ3HY7.js +0 -2019
  337. package/chunks/chunk-UHGNAWHK.js +0 -6928
  338. package/chunks/contextCommand-PW4GINQU.js +0 -71
  339. package/chunks/daemon-status-provider-3IWTBWQ3.js +0 -79
  340. package/chunks/earlyInputCapture-TYNI3B6E.js +0 -73
  341. package/chunks/errors-QAWTJTAW.js +0 -79
  342. package/chunks/handleAutoUpdate-V5A3JHOG.js +0 -72
  343. package/chunks/initializer-JJLF5JCJ.js +0 -77
  344. package/chunks/installationInfo-LAWMHQAG.js +0 -71
  345. package/chunks/list-L2ECB6UM.js +0 -80
  346. package/chunks/loadedSettingsAdapter-RLMZ4Z3E.js +0 -74
  347. package/chunks/mcp-E4O7Z6FO.js +0 -74
  348. package/chunks/nonInteractiveCli-GU2UKULE.js +0 -131
  349. package/chunks/pidfile-IWQWZNZV.js +0 -77
  350. package/chunks/read-file-ZOCXW4AD.js +0 -31
  351. package/chunks/resumeHistoryUtils-TJWRDE2L.js +0 -83
  352. package/chunks/ripGrep-OFKAW2VE.js +0 -64
  353. package/chunks/serve-UB4CF67Q.js +0 -80
  354. package/chunks/shell-RPK7EAOC.js +0 -74
  355. package/chunks/spawnChannel-IUP3ZNMT.js +0 -73
  356. package/chunks/theme-manager-ALL7F4CJ.js +0 -68
  357. package/chunks/total-session-admission-PLONPNXI.js +0 -74
  358. package/chunks/updateCheck-PVROE4GR.js +0 -87
  359. package/chunks/useAutoAcceptIndicator-6BNLNN5S.js +0 -85
  360. package/chunks/workspace-providers-status-2U3IF4TX.js +0 -77
  361. package/chunks/workspace-registry-DLQDDDIF.js +0 -78
  362. package/chunks/workspace-service-7K3LF4QX.js +0 -89
  363. package/chunks/workspace-skills-status-4DOZ3DBS.js +0 -76
  364. package/chunks/write-file-PTPXDKZ3.js +0 -64
  365. package/web-shell/assets/channel-DiLlxxIf.js +0 -1
  366. package/web-shell/assets/classDiagram-4FO5ZUOK-CkylTdM4.js +0 -1
  367. package/web-shell/assets/classDiagram-v2-Q7XG4LA2-CkylTdM4.js +0 -1
  368. package/web-shell/assets/index-CGtQqOIa.css +0 -5
  369. package/web-shell/assets/index-TtM0hVjU.js +0 -1207
  370. package/web-shell/assets/stateDiagram-v2-BHNVJYJU-D1gzH2Ue.js +0 -1
@@ -0,0 +1,1077 @@
1
+ // Force strict mode and setup for ESM
2
+ "use strict";
3
+ import {
4
+ OpenAILogger
5
+ } from "./chunk-ZJHVAS7M.js";
6
+ import "./chunk-NIBLUX3Y.js";
7
+ import {
8
+ OpenAIContentConverter,
9
+ openaiRequestCaptureContext
10
+ } from "./chunk-DHHOYAPR.js";
11
+ import "./chunk-BPJSQIJX.js";
12
+ import {
13
+ retryContext
14
+ } from "./chunk-P3QQPMQA.js";
15
+ import "./chunk-6FGBXPWM.js";
16
+ import {
17
+ getGenAiUsageProvenance
18
+ } from "./chunk-H5FFA6TH.js";
19
+ import {
20
+ runtimeDiagnostics
21
+ } from "./chunk-LS77BEZP.js";
22
+ import {
23
+ createGenAiRequestObserverContext
24
+ } from "./chunk-LEH5C7FV.js";
25
+ import {
26
+ ApiErrorEvent,
27
+ ApiRequestEvent,
28
+ ApiResponseEvent,
29
+ isInternalPromptId,
30
+ logApiError,
31
+ logApiRequest,
32
+ logApiResponse,
33
+ subagentNameContext
34
+ } from "./chunk-CIKQ7KKO.js";
35
+ import "./chunk-VGC4I5JJ.js";
36
+ import "./chunk-MUP3T3AD.js";
37
+ import "./chunk-IKCX4CCL.js";
38
+ import "./chunk-46UV252V.js";
39
+ import "./chunk-A4UCTEB5.js";
40
+ import "./chunk-XWRJCPHC.js";
41
+ import "./chunk-UW5EOVUN.js";
42
+ import "./chunk-2JZBVYTU.js";
43
+ import "./chunk-5I2IWRSH.js";
44
+ import "./chunk-A5L3JMUA.js";
45
+ import {
46
+ API_CALL_ABORTED_SPAN_STATUS_MESSAGE,
47
+ API_CALL_FAILED_SPAN_STATUS_MESSAGE,
48
+ addModelOutputAttributes,
49
+ addSystemPromptAttributes,
50
+ addToolSchemaAttributes,
51
+ areSensitiveSpanAttributesEnabled,
52
+ endLLMRequestSpan,
53
+ startLLMRequestSpan
54
+ } from "./chunk-MB4MZHMJ.js";
55
+ import "./chunk-HTR4WV6U.js";
56
+ import "./chunk-BULDBTYC.js";
57
+ import "./chunk-U7ZFW55U.js";
58
+ import "./chunk-UUUTRMI2.js";
59
+ import "./chunk-PR75REBZ.js";
60
+ import {
61
+ createDebugLogger,
62
+ getErrorMessage,
63
+ getErrorStatus,
64
+ getErrorType
65
+ } from "./chunk-NL7LTRLR.js";
66
+ import "./chunk-75DOP5OR.js";
67
+ import "./chunk-DMTGGOSA.js";
68
+ import "./chunk-YQ3U5MUC.js";
69
+ import {
70
+ GenerateContentResponse
71
+ } from "./chunk-22C7BQ6D.js";
72
+ import "./chunk-TYAMGABM.js";
73
+ import "./chunk-FCMNKVXT.js";
74
+ import "./chunk-AMDSOFFV.js";
75
+ import {
76
+ context,
77
+ init_esm,
78
+ trace
79
+ } from "./chunk-TARRHLLG.js";
80
+ import {
81
+ init_esbuild_shims
82
+ } from "./chunk-5O2XNYP6.js";
83
+ import {
84
+ __name
85
+ } from "./chunk-J2S4EL5Y.js";
86
+
87
+ // packages/core/src/core/loggingContentGenerator/index.ts
88
+ init_esbuild_shims();
89
+
90
+ // packages/core/src/core/loggingContentGenerator/loggingContentGenerator.ts
91
+ init_esbuild_shims();
92
+ init_esm();
93
+
94
+ // packages/core/src/core/loggingContentGenerator/streamContentDetection.ts
95
+ init_esbuild_shims();
96
+ function hasUserVisibleContent(chunk) {
97
+ const parts = chunk.candidates?.[0]?.content?.parts;
98
+ if (!parts || parts.length === 0) return false;
99
+ return parts.some(isUserVisiblePart);
100
+ }
101
+ __name(hasUserVisibleContent, "hasUserVisibleContent");
102
+ function isUserVisiblePart(part) {
103
+ if (part === null || typeof part !== "object") return false;
104
+ const p = part;
105
+ if (typeof p.text === "string" && p.text.length > 0) return true;
106
+ if (p.functionCall !== void 0) return true;
107
+ if (p.inlineData !== void 0) return true;
108
+ if (p.executableCode !== void 0) return true;
109
+ if (p.thought === true) return true;
110
+ return false;
111
+ }
112
+ __name(isUserVisiblePart, "isUserVisiblePart");
113
+
114
+ // packages/core/src/telemetry/gen-ai-provider.ts
115
+ init_esbuild_shims();
116
+ var PROVIDER_BY_ENV_KEY = {
117
+ ANTHROPIC_API_KEY: "anthropic",
118
+ BAILIAN_CODING_PLAN_API_KEY: "dashscope",
119
+ BAILIAN_TOKEN_PLAN_API_KEY: "dashscope",
120
+ DASHSCOPE_API_KEY: "dashscope",
121
+ DEEPSEEK_API_KEY: "deepseek",
122
+ IDEALAB_API_KEY: "dashscope",
123
+ MINIMAX_API_KEY: "minimax",
124
+ MIMO_API_KEY: "mimo",
125
+ MISTRAL_API_KEY: "mistral_ai",
126
+ MODELSCOPE_API_KEY: "modelscope",
127
+ OPENAI_API_KEY: "openai",
128
+ OPENROUTER_API_KEY: "openrouter",
129
+ REQUESTY_API_KEY: "requesty",
130
+ XAI_API_KEY: "x_ai",
131
+ XIAOMI_MIMO_API_KEY: "mimo",
132
+ ZAI_API_KEY: "z_ai"
133
+ };
134
+ function isHostOrSubdomain(hostname, domain) {
135
+ return hostname === domain || hostname.endsWith(`.${domain}`);
136
+ }
137
+ __name(isHostOrSubdomain, "isHostOrSubdomain");
138
+ function providerFromHostname(hostname) {
139
+ if (isHostOrSubdomain(hostname, "dashscope.aliyuncs.com") || isHostOrSubdomain(hostname, "dashscope-intl.aliyuncs.com") || isHostOrSubdomain(hostname, "dashscope-us.aliyuncs.com") || hostname.startsWith("token-plan.") && isHostOrSubdomain(hostname, "maas.aliyuncs.com") || hostname.endsWith(".alibaba-inc.com") || hostname.endsWith(".aliyun-inc.com")) {
140
+ return "dashscope";
141
+ }
142
+ if (isHostOrSubdomain(hostname, "openai.azure.com") || isHostOrSubdomain(hostname, "services.ai.azure.com")) {
143
+ return "azure.ai.openai";
144
+ }
145
+ if (isHostOrSubdomain(hostname, "deepseek.com")) return "deepseek";
146
+ if (isHostOrSubdomain(hostname, "x.ai")) return "x_ai";
147
+ if (isHostOrSubdomain(hostname, "mistral.ai")) return "mistral_ai";
148
+ if (isHostOrSubdomain(hostname, "minimax.io") || isHostOrSubdomain(hostname, "minimaxi.com")) {
149
+ return "minimax";
150
+ }
151
+ if (isHostOrSubdomain(hostname, "z.ai") || isHostOrSubdomain(hostname, "bigmodel.cn")) {
152
+ return "z_ai";
153
+ }
154
+ if (isHostOrSubdomain(hostname, "modelscope.cn")) return "modelscope";
155
+ if (isHostOrSubdomain(hostname, "xiaomimimo.com")) return "mimo";
156
+ if (isHostOrSubdomain(hostname, "openrouter.ai")) return "openrouter";
157
+ if (isHostOrSubdomain(hostname, "requesty.ai")) return "requesty";
158
+ if (isHostOrSubdomain(hostname, "anthropic.com")) return "anthropic";
159
+ if (isHostOrSubdomain(hostname, "openai.com")) return "openai";
160
+ return void 0;
161
+ }
162
+ __name(providerFromHostname, "providerFromHostname");
163
+ function parsedUrl(value) {
164
+ if (!value) return void 0;
165
+ try {
166
+ return new URL(value);
167
+ } catch {
168
+ return void 0;
169
+ }
170
+ }
171
+ __name(parsedUrl, "parsedUrl");
172
+ function normalizedEndpoint(value) {
173
+ const url = parsedUrl(value);
174
+ if (!url) return void 0;
175
+ const pathname = url.pathname.replace(/\/+$/, "") || "/";
176
+ return `${url.protocol}//${url.host}${pathname}${url.search}`;
177
+ }
178
+ __name(normalizedEndpoint, "normalizedEndpoint");
179
+ function resolveGenAiProviderName(config, dashscopeProxyBaseUrl) {
180
+ if (config.authType === "qwen-oauth") return "dashscope";
181
+ const baseUrl = normalizedEndpoint(config.baseUrl);
182
+ const proxyUrl = normalizedEndpoint(dashscopeProxyBaseUrl);
183
+ if (baseUrl && proxyUrl && baseUrl === proxyUrl) return "dashscope";
184
+ const hostname = parsedUrl(config.baseUrl)?.hostname.toLowerCase();
185
+ if (hostname) {
186
+ const provider = providerFromHostname(hostname);
187
+ if (provider) return provider;
188
+ }
189
+ const envProvider = config.apiKeyEnvKey ? PROVIDER_BY_ENV_KEY[config.apiKeyEnvKey.toUpperCase()] : void 0;
190
+ if (envProvider) return envProvider;
191
+ switch (config.authType) {
192
+ case "anthropic":
193
+ return "anthropic";
194
+ case "gemini":
195
+ return "gcp.gemini";
196
+ case "vertex-ai":
197
+ return "gcp.vertex_ai";
198
+ default:
199
+ return "openai";
200
+ }
201
+ }
202
+ __name(resolveGenAiProviderName, "resolveGenAiProviderName");
203
+ function resolveGenAiOperationName(authType) {
204
+ return authType === "gemini" || authType === "vertex-ai" ? "generate_content" : "chat";
205
+ }
206
+ __name(resolveGenAiOperationName, "resolveGenAiOperationName");
207
+ function resolveGenAiOutputType(authType, config) {
208
+ if (authType !== "gemini" && authType !== "vertex-ai") return void 0;
209
+ const mimeType = config?.responseMimeType?.split(";", 1)[0]?.trim().toLowerCase();
210
+ if (mimeType) {
211
+ if (mimeType === "application/json" || mimeType.endsWith("+json")) {
212
+ return "json";
213
+ }
214
+ if (mimeType.startsWith("text/")) return "text";
215
+ if (mimeType.startsWith("image/")) return "image";
216
+ if (mimeType.startsWith("audio/")) return "speech";
217
+ }
218
+ const modalities = config?.responseModalities;
219
+ if (modalities?.length !== 1) return void 0;
220
+ switch (String(modalities[0]).toUpperCase()) {
221
+ case "TEXT":
222
+ return "text";
223
+ case "IMAGE":
224
+ return "image";
225
+ case "AUDIO":
226
+ return "speech";
227
+ default:
228
+ return void 0;
229
+ }
230
+ }
231
+ __name(resolveGenAiOutputType, "resolveGenAiOutputType");
232
+
233
+ // packages/core/src/core/loggingContentGenerator/loggingContentGenerator.ts
234
+ function snapshotRetryMetadata() {
235
+ const ctx = retryContext.getStore();
236
+ return {
237
+ attempt: ctx?.attempt ?? 1,
238
+ requestSetupMs: ctx?.requestSetupMs,
239
+ retryTotalDelayMs: ctx?.retryTotalDelayMs
240
+ };
241
+ }
242
+ __name(snapshotRetryMetadata, "snapshotRetryMetadata");
243
+ function usageSpanMetadata(usage) {
244
+ const provenance = getGenAiUsageProvenance(usage);
245
+ return {
246
+ inputTokens: usage?.promptTokenCount,
247
+ outputTokens: usage?.candidatesTokenCount,
248
+ cachedInputTokens: usage?.cachedContentTokenCount,
249
+ cachedInputTokensReported: provenance?.cachedInputTokensReported ?? usage?.cachedContentTokenCount !== void 0,
250
+ cacheCreationInputTokens: provenance?.cacheCreationInputTokens
251
+ };
252
+ }
253
+ __name(usageSpanMetadata, "usageSpanMetadata");
254
+ function orderedFinishReasons(response) {
255
+ const reasons = (response.candidates ?? []).map((candidate, position) => ({
256
+ index: candidate.index ?? position,
257
+ reason: candidate.finishReason ? String(candidate.finishReason) : void 0
258
+ })).filter(
259
+ (entry) => entry.reason !== void 0
260
+ ).sort((left, right) => left.index - right.index).map((entry) => entry.reason);
261
+ return reasons.length > 0 ? reasons : void 0;
262
+ }
263
+ __name(orderedFinishReasons, "orderedFinishReasons");
264
+ var debugLogger = createDebugLogger("LOGGING_CONTENT_GENERATOR");
265
+ var MAX_RESPONSE_TEXT_LENGTH = 4096;
266
+ var RESPONSE_TEXT_TRUNCATION_SUFFIX = "...[truncated]";
267
+ var LoggingContentGenerator = class {
268
+ constructor(wrapped, config, generatorConfig) {
269
+ this.wrapped = wrapped;
270
+ this.config = config;
271
+ this.modalities = generatorConfig.modalities;
272
+ this.splitToolMedia = generatorConfig.splitToolMedia;
273
+ this.toolResultContentFormat = generatorConfig.toolResultContentFormat;
274
+ this.generatorAuthType = generatorConfig.authType;
275
+ this.genAiProviderName = resolveGenAiProviderName(
276
+ generatorConfig,
277
+ process.env["DASHSCOPE_PROXY_BASE_URL"]
278
+ );
279
+ this.genAiOperationName = resolveGenAiOperationName(
280
+ generatorConfig.authType
281
+ );
282
+ if (generatorConfig.enableOpenAILogging) {
283
+ this.openaiLogger = new OpenAILogger(
284
+ generatorConfig.openAILoggingDir,
285
+ config.getWorkingDir()
286
+ );
287
+ this.schemaCompliance = generatorConfig.schemaCompliance;
288
+ }
289
+ }
290
+ static {
291
+ __name(this, "LoggingContentGenerator");
292
+ }
293
+ openaiLogger;
294
+ schemaCompliance;
295
+ modalities;
296
+ splitToolMedia;
297
+ toolResultContentFormat;
298
+ generatorAuthType;
299
+ genAiProviderName;
300
+ genAiOperationName;
301
+ getWrapped() {
302
+ return this.wrapped;
303
+ }
304
+ logApiRequest(contents, model, promptId) {
305
+ const requestText = JSON.stringify(contents);
306
+ logApiRequest(
307
+ this.config,
308
+ new ApiRequestEvent(
309
+ model,
310
+ promptId,
311
+ requestText,
312
+ subagentNameContext.getStore()
313
+ )
314
+ );
315
+ }
316
+ _logApiResponse(responseId, durationMs, model, prompt_id, usageMetadata, responseText) {
317
+ logApiResponse(
318
+ this.config,
319
+ new ApiResponseEvent(
320
+ responseId,
321
+ model,
322
+ durationMs,
323
+ prompt_id,
324
+ this.generatorAuthType,
325
+ usageMetadata,
326
+ responseText,
327
+ subagentNameContext.getStore()
328
+ )
329
+ );
330
+ }
331
+ _logApiError(responseId, durationMs, error, model, prompt_id) {
332
+ const errorMessage = getErrorMessage(error);
333
+ const errorType = getErrorType(error);
334
+ const errorResponseId = error?.requestID || error?.request_id || responseId;
335
+ const errorStatus = getErrorStatus(error);
336
+ logApiError(
337
+ this.config,
338
+ new ApiErrorEvent({
339
+ responseId: errorResponseId,
340
+ model,
341
+ durationMs,
342
+ promptId: prompt_id,
343
+ authType: this.generatorAuthType,
344
+ errorMessage,
345
+ errorType,
346
+ statusCode: errorStatus,
347
+ subagentName: subagentNameContext.getStore()
348
+ })
349
+ );
350
+ }
351
+ safelyLogApiError(responseId, durationMs, error, model, prompt_id) {
352
+ try {
353
+ this._logApiError(responseId, durationMs, error, model, prompt_id);
354
+ } catch (loggingError) {
355
+ debugLogger.warn("Failed to log API error:", loggingError);
356
+ }
357
+ }
358
+ safelyLogApiResponse(responseId, durationMs, model, prompt_id, usageMetadata, responseText) {
359
+ try {
360
+ this._logApiResponse(
361
+ responseId,
362
+ durationMs,
363
+ model,
364
+ prompt_id,
365
+ usageMetadata,
366
+ responseText
367
+ );
368
+ } catch (loggingError) {
369
+ debugLogger.warn("Failed to log API response:", loggingError);
370
+ }
371
+ }
372
+ async generateContent(req, userPromptId) {
373
+ const retrySnapshot = snapshotRetryMetadata();
374
+ const llmSpan = startLLMRequestSpan(req.model, userPromptId, {
375
+ operationName: this.genAiOperationName,
376
+ providerName: this.genAiProviderName,
377
+ outputType: resolveGenAiOutputType(this.generatorAuthType, req.config)
378
+ });
379
+ try {
380
+ llmSpan.setAttribute("llm_request.stream", false);
381
+ } catch {
382
+ }
383
+ const spanContext = createGenAiRequestObserverContext(
384
+ trace.setSpan(context.active(), llmSpan),
385
+ llmSpan
386
+ );
387
+ const startTime = Date.now();
388
+ const isInternal = isInternalPromptId(userPromptId);
389
+ const session = this.startCaptureSession();
390
+ try {
391
+ runtimeDiagnostics.recordGenerateContentRequest(req, {
392
+ stream: false,
393
+ source: "generateContent"
394
+ });
395
+ if (!isInternal) {
396
+ addSystemPromptAttributes(
397
+ this.config,
398
+ llmSpan,
399
+ req.config?.systemInstruction
400
+ );
401
+ addToolSchemaAttributes(
402
+ this.config,
403
+ llmSpan,
404
+ req.config?.tools
405
+ );
406
+ }
407
+ const response = await context.with(spanContext, async () => {
408
+ if (!isInternal) {
409
+ this.logApiRequest(
410
+ this.toContents(req.contents),
411
+ req.model,
412
+ userPromptId
413
+ );
414
+ }
415
+ const result = await session.wrap(
416
+ () => this.wrapped.generateContent(req, userPromptId)
417
+ );
418
+ const durationMs = Date.now() - startTime;
419
+ const shouldCollectSensitiveSpanAttributes = !isInternal && this.shouldCollectSensitiveSpanAttributes();
420
+ const modelOutput = shouldCollectSensitiveSpanAttributes ? this.extractResponseTextForSensitiveSpan(
421
+ result,
422
+ this.config.getTelemetrySensitiveSpanAttributeMaxLength()
423
+ ) : void 0;
424
+ const responseText = isInternal ? void 0 : this.extractResponseText(result, MAX_RESPONSE_TEXT_LENGTH);
425
+ if (shouldCollectSensitiveSpanAttributes) {
426
+ this.safelyAddModelOutputAttributes(llmSpan, modelOutput);
427
+ }
428
+ this.safelyLogApiResponse(
429
+ result.responseId ?? "",
430
+ durationMs,
431
+ result.modelVersion || req.model,
432
+ userPromptId,
433
+ result.usageMetadata,
434
+ responseText
435
+ );
436
+ try {
437
+ await this.safelyLogOpenAIInteraction(
438
+ await session.resolve(req),
439
+ result,
440
+ void 0,
441
+ userPromptId
442
+ );
443
+ } catch (loggingError) {
444
+ debugLogger.warn("Failed to log OpenAI interaction:", loggingError);
445
+ }
446
+ return result;
447
+ });
448
+ endLLMRequestSpan(llmSpan, {
449
+ success: true,
450
+ ...usageSpanMetadata(response.usageMetadata),
451
+ durationMs: Date.now() - startTime,
452
+ responseId: response.responseId || void 0,
453
+ responseModel: response.modelVersion || void 0,
454
+ finishReasons: orderedFinishReasons(response),
455
+ thoughtsTokenCount: response.usageMetadata?.thoughtsTokenCount,
456
+ subagentName: subagentNameContext.getStore() || void 0,
457
+ ...retrySnapshot,
458
+ config: this.config
459
+ });
460
+ return response;
461
+ } catch (error) {
462
+ const durationMs = Date.now() - startTime;
463
+ const aborted = req.config?.abortSignal?.aborted ?? false;
464
+ endLLMRequestSpan(llmSpan, {
465
+ success: false,
466
+ durationMs,
467
+ error: aborted ? API_CALL_ABORTED_SPAN_STATUS_MESSAGE : API_CALL_FAILED_SPAN_STATUS_MESSAGE,
468
+ errorType: getErrorType(error),
469
+ errorStatusCode: getErrorStatus(error),
470
+ subagentName: subagentNameContext.getStore() || void 0,
471
+ ...retrySnapshot,
472
+ config: this.config
473
+ });
474
+ await context.with(spanContext, async () => {
475
+ this.safelyLogApiError("", durationMs, error, req.model, userPromptId);
476
+ try {
477
+ await this.safelyLogOpenAIInteraction(
478
+ await session.resolve(req),
479
+ void 0,
480
+ error,
481
+ userPromptId
482
+ );
483
+ } catch (loggingError) {
484
+ debugLogger.warn("Failed to log OpenAI interaction:", loggingError);
485
+ }
486
+ });
487
+ throw error;
488
+ }
489
+ }
490
+ async generateContentStream(req, userPromptId) {
491
+ const retrySnapshot = snapshotRetryMetadata();
492
+ const llmSpan = startLLMRequestSpan(req.model, userPromptId, {
493
+ operationName: this.genAiOperationName,
494
+ providerName: this.genAiProviderName,
495
+ outputType: resolveGenAiOutputType(this.generatorAuthType, req.config)
496
+ });
497
+ try {
498
+ llmSpan.setAttribute("llm_request.stream", true);
499
+ } catch {
500
+ }
501
+ const spanContext = createGenAiRequestObserverContext(
502
+ trace.setSpan(context.active(), llmSpan),
503
+ llmSpan
504
+ );
505
+ const startTime = Date.now();
506
+ const isInternal = isInternalPromptId(userPromptId);
507
+ const session = this.startCaptureSession();
508
+ let stream;
509
+ try {
510
+ runtimeDiagnostics.recordGenerateContentRequest(req, {
511
+ stream: true,
512
+ source: "generateContentStream"
513
+ });
514
+ if (!isInternal) {
515
+ addSystemPromptAttributes(
516
+ this.config,
517
+ llmSpan,
518
+ req.config?.systemInstruction
519
+ );
520
+ addToolSchemaAttributes(
521
+ this.config,
522
+ llmSpan,
523
+ req.config?.tools
524
+ );
525
+ }
526
+ stream = await context.with(spanContext, async () => {
527
+ if (!isInternal) {
528
+ this.logApiRequest(
529
+ this.toContents(req.contents),
530
+ req.model,
531
+ userPromptId
532
+ );
533
+ }
534
+ return session.wrap(
535
+ () => this.wrapped.generateContentStream(req, userPromptId)
536
+ );
537
+ });
538
+ } catch (error) {
539
+ const durationMs = Date.now() - startTime;
540
+ context.with(
541
+ spanContext,
542
+ () => this.safelyLogApiError("", durationMs, error, req.model, userPromptId)
543
+ );
544
+ const aborted = req.config?.abortSignal?.aborted ?? false;
545
+ endLLMRequestSpan(llmSpan, {
546
+ success: false,
547
+ durationMs,
548
+ error: aborted ? API_CALL_ABORTED_SPAN_STATUS_MESSAGE : API_CALL_FAILED_SPAN_STATUS_MESSAGE,
549
+ errorType: getErrorType(error),
550
+ errorStatusCode: getErrorStatus(error),
551
+ subagentName: subagentNameContext.getStore() || void 0,
552
+ ...retrySnapshot,
553
+ config: this.config
554
+ });
555
+ try {
556
+ await this.safelyLogOpenAIInteraction(
557
+ await session.resolve(req),
558
+ void 0,
559
+ error,
560
+ userPromptId
561
+ );
562
+ } catch (loggingError) {
563
+ debugLogger.warn("Failed to log OpenAI interaction:", loggingError);
564
+ }
565
+ throw error;
566
+ }
567
+ let resolvedRequest;
568
+ if (this.openaiLogger) {
569
+ try {
570
+ resolvedRequest = await session.resolve(req);
571
+ } catch (loggingError) {
572
+ debugLogger.warn("Failed to resolve OpenAI request:", loggingError);
573
+ }
574
+ }
575
+ return context.with(
576
+ spanContext,
577
+ () => this.loggingStreamWrapper(
578
+ stream,
579
+ startTime,
580
+ userPromptId,
581
+ req.model,
582
+ resolvedRequest,
583
+ llmSpan,
584
+ spanContext,
585
+ req.config?.abortSignal,
586
+ retrySnapshot
587
+ )
588
+ );
589
+ }
590
+ startCaptureSession() {
591
+ let captured;
592
+ const skipCapture = !this.openaiLogger;
593
+ return {
594
+ wrap: /* @__PURE__ */ __name((fn) => skipCapture ? fn() : openaiRequestCaptureContext.run((built) => {
595
+ captured = built;
596
+ }, fn), "wrap"),
597
+ resolve: /* @__PURE__ */ __name(async (req) => this.openaiLogger ? captured ?? await this.buildOpenAIRequestForLogging(req) : void 0, "resolve")
598
+ };
599
+ }
600
+ async *loggingStreamWrapper(stream, startTime, userPromptId, model, openaiRequest, span, spanContext, abortSignal, retrySnapshot) {
601
+ const isInternal = isInternalPromptId(userPromptId);
602
+ const shouldCollectResponses = !isInternal || !!this.openaiLogger;
603
+ const responses = [];
604
+ let lastResponseForLogging;
605
+ let firstResponseId = "";
606
+ let firstModelVersion = "";
607
+ let lastUsageMetadata;
608
+ let errorOccurred = false;
609
+ const finishReasons = /* @__PURE__ */ new Map();
610
+ let lastError;
611
+ const subagentName = subagentNameContext.getStore();
612
+ let ttftMs;
613
+ let spanEndedByTimeout = false;
614
+ const runInSpan = /* @__PURE__ */ __name((fn) => spanContext ? context.with(spanContext, fn) : fn(), "runInSpan");
615
+ const STREAM_IDLE_TIMEOUT_MS = 5 * 6e4;
616
+ let spanEndTimeout;
617
+ const resetSpanTimeout = span ? () => {
618
+ if (spanEndedByTimeout) return;
619
+ if (spanEndTimeout !== void 0) clearTimeout(spanEndTimeout);
620
+ spanEndTimeout = setTimeout(() => {
621
+ try {
622
+ span.setAttribute("stream.timed_out", true);
623
+ } catch {
624
+ }
625
+ endLLMRequestSpan(span, {
626
+ success: false,
627
+ ...usageSpanMetadata(lastUsageMetadata),
628
+ durationMs: Date.now() - startTime,
629
+ error: "Stream span timed out (idle)",
630
+ responseId: firstResponseId || void 0,
631
+ responseModel: firstModelVersion || void 0,
632
+ finishReasons: finishReasons.size > 0 ? [...finishReasons.entries()].sort(([left], [right]) => left - right).map(([, reason]) => reason) : void 0,
633
+ subagentName: subagentName || void 0,
634
+ ...retrySnapshot,
635
+ config: this.config
636
+ });
637
+ spanEndedByTimeout = true;
638
+ }, STREAM_IDLE_TIMEOUT_MS);
639
+ spanEndTimeout.unref();
640
+ } : void 0;
641
+ resetSpanTimeout?.();
642
+ try {
643
+ for await (const response of stream) {
644
+ if (!firstResponseId && response.responseId) {
645
+ firstResponseId = response.responseId;
646
+ }
647
+ if (!firstModelVersion && response.modelVersion) {
648
+ firstModelVersion = response.modelVersion;
649
+ }
650
+ const candidate = response.candidates?.[0];
651
+ if (shouldCollectResponses) {
652
+ lastResponseForLogging = response;
653
+ if ((candidate?.content?.parts?.length ?? 0) > 0 || candidate?.finishReason) {
654
+ responses.push(response);
655
+ }
656
+ }
657
+ if (response.usageMetadata) {
658
+ lastUsageMetadata = response.usageMetadata;
659
+ }
660
+ for (const [position, responseCandidate] of (response.candidates ?? []).entries()) {
661
+ if (responseCandidate.finishReason) {
662
+ finishReasons.set(
663
+ responseCandidate.index ?? position,
664
+ String(responseCandidate.finishReason)
665
+ );
666
+ }
667
+ }
668
+ if (ttftMs === void 0 && hasUserVisibleContent(response)) {
669
+ ttftMs = Date.now() - startTime;
670
+ }
671
+ resetSpanTimeout?.();
672
+ yield response;
673
+ }
674
+ if (spanEndTimeout !== void 0) {
675
+ clearTimeout(spanEndTimeout);
676
+ spanEndTimeout = void 0;
677
+ }
678
+ const durationMs = Date.now() - startTime;
679
+ if (lastResponseForLogging && responses.at(-1) !== lastResponseForLogging) {
680
+ responses.push(lastResponseForLogging);
681
+ }
682
+ const consolidatedResponse = shouldCollectResponses ? this.consolidateGeminiResponsesForLogging(responses) : void 0;
683
+ if (consolidatedResponse) {
684
+ consolidatedResponse.usageMetadata = lastUsageMetadata;
685
+ }
686
+ const shouldCollectSensitiveSpanAttributes = !isInternal && span !== void 0 && this.shouldCollectSensitiveSpanAttributes();
687
+ const streamModelOutput = shouldCollectSensitiveSpanAttributes ? this.extractResponseTextForSensitiveSpan(
688
+ consolidatedResponse,
689
+ this.config.getTelemetrySensitiveSpanAttributeMaxLength()
690
+ ) : void 0;
691
+ const streamResponseText = isInternal ? void 0 : this.extractResponseText(
692
+ consolidatedResponse,
693
+ MAX_RESPONSE_TEXT_LENGTH
694
+ );
695
+ if (!spanEndedByTimeout) {
696
+ runInSpan(
697
+ () => this.safelyLogApiResponse(
698
+ firstResponseId,
699
+ durationMs,
700
+ firstModelVersion || model,
701
+ userPromptId,
702
+ lastUsageMetadata,
703
+ streamResponseText
704
+ )
705
+ );
706
+ if (shouldCollectSensitiveSpanAttributes && span) {
707
+ this.safelyAddModelOutputAttributes(span, streamModelOutput);
708
+ }
709
+ await runInSpan(
710
+ () => this.safelyLogOpenAIInteraction(
711
+ openaiRequest,
712
+ consolidatedResponse,
713
+ void 0,
714
+ userPromptId
715
+ )
716
+ );
717
+ }
718
+ } catch (error) {
719
+ errorOccurred = true;
720
+ lastError = error;
721
+ if (!spanEndedByTimeout) {
722
+ const durationMs = Date.now() - startTime;
723
+ runInSpan(
724
+ () => this.safelyLogApiError(
725
+ firstResponseId,
726
+ durationMs,
727
+ error,
728
+ firstModelVersion || model,
729
+ userPromptId
730
+ )
731
+ );
732
+ await runInSpan(
733
+ () => this.safelyLogOpenAIInteraction(
734
+ openaiRequest,
735
+ void 0,
736
+ error,
737
+ userPromptId
738
+ )
739
+ );
740
+ }
741
+ throw error;
742
+ } finally {
743
+ if (spanEndTimeout !== void 0) {
744
+ clearTimeout(spanEndTimeout);
745
+ }
746
+ if (span && !spanEndedByTimeout) {
747
+ const aborted = abortSignal?.aborted ?? false;
748
+ endLLMRequestSpan(span, {
749
+ success: !errorOccurred,
750
+ ...usageSpanMetadata(lastUsageMetadata),
751
+ ttftMs,
752
+ durationMs: Date.now() - startTime,
753
+ error: errorOccurred ? aborted ? API_CALL_ABORTED_SPAN_STATUS_MESSAGE : API_CALL_FAILED_SPAN_STATUS_MESSAGE : void 0,
754
+ responseId: firstResponseId || void 0,
755
+ responseModel: firstModelVersion || void 0,
756
+ finishReasons: finishReasons.size > 0 ? [...finishReasons.entries()].sort(([left], [right]) => left - right).map(([, reason]) => reason) : void 0,
757
+ thoughtsTokenCount: lastUsageMetadata?.thoughtsTokenCount,
758
+ subagentName: subagentName || void 0,
759
+ errorType: lastError ? getErrorType(lastError) : void 0,
760
+ errorStatusCode: lastError ? getErrorStatus(lastError) : void 0,
761
+ ...retrySnapshot,
762
+ config: this.config
763
+ });
764
+ }
765
+ }
766
+ }
767
+ async buildOpenAIRequestForLogging(request) {
768
+ if (!this.openaiLogger) {
769
+ return void 0;
770
+ }
771
+ const requestContext = this.createLoggingRequestContext(request.model);
772
+ const messages = OpenAIContentConverter.convertGeminiRequestToOpenAI(
773
+ request,
774
+ requestContext,
775
+ {
776
+ cleanOrphanToolCalls: false
777
+ }
778
+ );
779
+ const openaiRequest = {
780
+ model: request.model,
781
+ messages
782
+ };
783
+ if (request.config?.tools) {
784
+ openaiRequest.tools = await OpenAIContentConverter.convertGeminiToolsToOpenAI(
785
+ request.config.tools,
786
+ this.schemaCompliance ?? "auto"
787
+ );
788
+ }
789
+ if (request.config?.temperature !== void 0) {
790
+ openaiRequest.temperature = request.config.temperature;
791
+ }
792
+ if (request.config?.topP !== void 0) {
793
+ openaiRequest.top_p = request.config.topP;
794
+ }
795
+ if (request.config?.maxOutputTokens !== void 0) {
796
+ openaiRequest.max_tokens = request.config.maxOutputTokens;
797
+ }
798
+ if (request.config?.presencePenalty !== void 0) {
799
+ openaiRequest.presence_penalty = request.config.presencePenalty;
800
+ }
801
+ if (request.config?.frequencyPenalty !== void 0) {
802
+ openaiRequest.frequency_penalty = request.config.frequencyPenalty;
803
+ }
804
+ return openaiRequest;
805
+ }
806
+ createLoggingRequestContext(model) {
807
+ return {
808
+ model,
809
+ modalities: this.modalities ?? {},
810
+ // Mirror the pipeline default (see pipeline.ts createRequestContext) so the
811
+ // --openai-logging fallback reconstruction reflects the same split as the
812
+ // request actually sent. Opt out via generationConfig.splitToolMedia = false.
813
+ splitToolMedia: this.splitToolMedia ?? true,
814
+ toolResultContentFormat: this.toolResultContentFormat ?? "parts",
815
+ startTime: 0
816
+ };
817
+ }
818
+ async logOpenAIInteraction(openaiRequest, response, error, promptId) {
819
+ if (!this.openaiLogger || !openaiRequest) {
820
+ return;
821
+ }
822
+ const openaiResponse = response ? this.convertGeminiResponseToOpenAIForLogging(response, openaiRequest) : void 0;
823
+ await this.openaiLogger.logInteraction(
824
+ openaiRequest,
825
+ openaiResponse,
826
+ error instanceof Error ? error : error ? new Error(String(error)) : void 0,
827
+ promptId
828
+ );
829
+ }
830
+ async safelyLogOpenAIInteraction(openaiRequest, response, error, promptId) {
831
+ try {
832
+ await this.logOpenAIInteraction(openaiRequest, response, error, promptId);
833
+ } catch (loggingError) {
834
+ debugLogger.warn("Failed to log OpenAI interaction:", loggingError);
835
+ }
836
+ }
837
+ convertGeminiResponseToOpenAIForLogging(response, openaiRequest) {
838
+ return OpenAIContentConverter.convertGeminiResponseToOpenAI(
839
+ response,
840
+ this.createLoggingRequestContext(openaiRequest.model)
841
+ );
842
+ }
843
+ consolidateGeminiResponsesForLogging(responses) {
844
+ if (responses.length === 0) {
845
+ return void 0;
846
+ }
847
+ const consolidated = new GenerateContentResponse();
848
+ const combinedParts = [];
849
+ const functionCallIndex = /* @__PURE__ */ new Map();
850
+ let finishReason;
851
+ let usageMetadata;
852
+ for (const response of responses) {
853
+ if (response.usageMetadata) {
854
+ usageMetadata = response.usageMetadata;
855
+ }
856
+ const candidate = response.candidates?.[0];
857
+ if (candidate?.finishReason) {
858
+ finishReason = candidate.finishReason;
859
+ }
860
+ const parts = candidate?.content?.parts ?? [];
861
+ for (const part of parts) {
862
+ if (typeof part === "string") {
863
+ combinedParts.push({ text: part });
864
+ continue;
865
+ }
866
+ if ("text" in part) {
867
+ if (part.text) {
868
+ combinedParts.push({
869
+ text: part.text,
870
+ ...part.thought ? { thought: true } : {},
871
+ ...part.thoughtSignature ? { thoughtSignature: part.thoughtSignature } : {}
872
+ });
873
+ }
874
+ continue;
875
+ }
876
+ if ("functionCall" in part && part.functionCall) {
877
+ const callKey = part.functionCall.id || part.functionCall.name || "tool_call";
878
+ const existingIndex = functionCallIndex.get(callKey);
879
+ const functionPart = { functionCall: part.functionCall };
880
+ if (existingIndex !== void 0) {
881
+ combinedParts[existingIndex] = functionPart;
882
+ } else {
883
+ functionCallIndex.set(callKey, combinedParts.length);
884
+ combinedParts.push(functionPart);
885
+ }
886
+ continue;
887
+ }
888
+ if ("functionResponse" in part && part.functionResponse) {
889
+ combinedParts.push({ functionResponse: part.functionResponse });
890
+ continue;
891
+ }
892
+ combinedParts.push(part);
893
+ }
894
+ }
895
+ const lastResponse = responses[responses.length - 1];
896
+ const lastCandidate = lastResponse.candidates?.[0];
897
+ consolidated.responseId = lastResponse.responseId;
898
+ consolidated.createTime = lastResponse.createTime;
899
+ consolidated.modelVersion = lastResponse.modelVersion;
900
+ consolidated.promptFeedback = lastResponse.promptFeedback;
901
+ consolidated.usageMetadata = usageMetadata;
902
+ consolidated.candidates = [
903
+ {
904
+ content: {
905
+ role: lastCandidate?.content?.role || "model",
906
+ parts: combinedParts
907
+ },
908
+ ...finishReason ? { finishReason } : {},
909
+ index: 0,
910
+ safetyRatings: lastCandidate?.safetyRatings || []
911
+ }
912
+ ];
913
+ return consolidated;
914
+ }
915
+ extractResponseText(response, maxLength) {
916
+ let text = "";
917
+ let truncated = false;
918
+ const maxPrefixLength = Math.max(
919
+ 0,
920
+ maxLength - RESPONSE_TEXT_TRUNCATION_SUFFIX.length
921
+ );
922
+ const hasText = this.forEachVisibleResponseText(response, (partText) => {
923
+ if (truncated) {
924
+ return;
925
+ }
926
+ const remaining = maxPrefixLength - text.length;
927
+ if (partText.length <= remaining) {
928
+ text += partText;
929
+ return;
930
+ }
931
+ text += partText.slice(0, Math.max(0, remaining));
932
+ truncated = true;
933
+ });
934
+ if (!hasText) {
935
+ return void 0;
936
+ }
937
+ return truncated ? `${text}${RESPONSE_TEXT_TRUNCATION_SUFFIX}` : text;
938
+ }
939
+ extractResponseTextForSensitiveSpan(response, maxLength) {
940
+ let text = "";
941
+ let originalLength = 0;
942
+ const hasText = this.forEachVisibleResponseText(response, (partText) => {
943
+ originalLength += partText.length;
944
+ const remaining = maxLength - text.length;
945
+ if (remaining > 0) {
946
+ text += partText.slice(0, remaining);
947
+ }
948
+ });
949
+ if (!hasText) {
950
+ return void 0;
951
+ }
952
+ return { text, originalLength };
953
+ }
954
+ forEachVisibleResponseText(response, onText) {
955
+ const parts = response?.candidates?.[0]?.content?.parts;
956
+ if (!parts?.length) {
957
+ return false;
958
+ }
959
+ let hasText = false;
960
+ for (const part of parts) {
961
+ const text = this.getVisibleResponsePartText(part);
962
+ if (text === void 0) {
963
+ continue;
964
+ }
965
+ hasText = true;
966
+ onText(text);
967
+ }
968
+ return hasText;
969
+ }
970
+ getVisibleResponsePartText(part) {
971
+ if (typeof part === "string") {
972
+ return part;
973
+ }
974
+ if ("text" in part && typeof part.text === "string" && !("thought" in part && part.thought)) {
975
+ return part.text;
976
+ }
977
+ return void 0;
978
+ }
979
+ safelyAddModelOutputAttributes(span, modelOutput) {
980
+ try {
981
+ addModelOutputAttributes(
982
+ this.config,
983
+ span,
984
+ modelOutput?.text,
985
+ modelOutput?.originalLength
986
+ );
987
+ } catch (error) {
988
+ debugLogger.warn("Failed to add model output span attributes:", error);
989
+ }
990
+ }
991
+ shouldCollectSensitiveSpanAttributes() {
992
+ return areSensitiveSpanAttributesEnabled(this.config);
993
+ }
994
+ async countTokens(req) {
995
+ return this.wrapped.countTokens(req);
996
+ }
997
+ async embedContent(req) {
998
+ return this.wrapped.embedContent(req);
999
+ }
1000
+ useSummarizedThinking() {
1001
+ return this.wrapped.useSummarizedThinking();
1002
+ }
1003
+ toContents(contents) {
1004
+ if (Array.isArray(contents)) {
1005
+ return contents.map((c) => this.toContent(c));
1006
+ }
1007
+ return [this.toContent(contents)];
1008
+ }
1009
+ toContent(content) {
1010
+ if (Array.isArray(content)) {
1011
+ return {
1012
+ role: "user",
1013
+ parts: this.toParts(content)
1014
+ };
1015
+ }
1016
+ if (typeof content === "string") {
1017
+ return {
1018
+ role: "user",
1019
+ parts: [{ text: content }]
1020
+ };
1021
+ }
1022
+ if ("parts" in content) {
1023
+ return {
1024
+ ...content,
1025
+ parts: content.parts ? this.toParts(content.parts.filter((p) => p != null)) : []
1026
+ };
1027
+ }
1028
+ return {
1029
+ role: "user",
1030
+ parts: [this.toPart(content)]
1031
+ };
1032
+ }
1033
+ toParts(parts) {
1034
+ return parts.map((p) => this.toPart(p));
1035
+ }
1036
+ toPart(part) {
1037
+ if (typeof part === "string") {
1038
+ return { text: part };
1039
+ }
1040
+ if ("thought" in part && part.thought) {
1041
+ const thoughtText = `[Thought: ${part.thought}]`;
1042
+ const newPart = { ...part };
1043
+ delete newPart["thought"];
1044
+ const hasApiContent = "functionCall" in newPart || "functionResponse" in newPart || "inlineData" in newPart || "fileData" in newPart;
1045
+ if (hasApiContent) {
1046
+ return newPart;
1047
+ }
1048
+ const text = newPart.text;
1049
+ const existingText = text ? String(text) : "";
1050
+ const combinedText = existingText ? `${existingText}
1051
+ ${thoughtText}` : thoughtText;
1052
+ return {
1053
+ ...newPart,
1054
+ text: combinedText
1055
+ };
1056
+ }
1057
+ return part;
1058
+ }
1059
+ };
1060
+ export {
1061
+ LoggingContentGenerator
1062
+ };
1063
+ /**
1064
+ * @license
1065
+ * Copyright 2026 Qwen Team
1066
+ * SPDX-License-Identifier: Apache-2.0
1067
+ */
1068
+ /**
1069
+ * @license
1070
+ * Copyright 2025 Google LLC
1071
+ * SPDX-License-Identifier: Apache-2.0
1072
+ */
1073
+ /**
1074
+ * @license
1075
+ * Copyright 2025 Qwen
1076
+ * SPDX-License-Identifier: Apache-2.0
1077
+ */