@qwen-code/qwen-code 0.21.1 → 0.21.2

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 (321) hide show
  1. package/bundled/qc-helper/docs/configuration/settings.md +1 -0
  2. package/bundled/qc-helper/docs/features/channels/_meta.ts +1 -0
  3. package/bundled/qc-helper/docs/features/channels/github.md +42 -10
  4. package/bundled/qc-helper/docs/features/channels/gitlab.md +171 -0
  5. package/bundled/qc-helper/docs/features/code-review.md +20 -0
  6. package/bundled/qc-helper/docs/features/hooks.md +20 -0
  7. package/bundled/qc-helper/docs/features/sub-agents.md +22 -8
  8. package/bundled/qc-helper/docs/qwen-serve.md +7 -5
  9. package/bundled/review/SKILL.md +1 -1
  10. package/chunks/{MaxSizedBox-VI3ROJJA.js → MaxSizedBox-TQBQ247P.js} +42 -38
  11. package/chunks/{StandaloneSessionPicker-LYXKD2EV.js → StandaloneSessionPicker-2HPTKCLX.js} +58 -54
  12. package/chunks/{acp-startup-profiler-DFVPFQ6C.js → acp-startup-profiler-2C4A5ZTJ.js} +2 -2
  13. package/chunks/{acpAgent-WN5SRDQO.js → acpAgent-PS6EDGH3.js} +431 -168
  14. package/chunks/{agent-K6ECSM64.js → agent-VDOUB35F.js} +38 -34
  15. package/chunks/{agent-headless-NO4Y2HOE.js → agent-headless-EO53EFS2.js} +38 -34
  16. package/chunks/{anthropicContentGenerator-V2QOGVYD.js → anthropicContentGenerator-OFHSZJBF.js} +6 -6
  17. package/chunks/{artifact-tool-6K6U7XYJ.js → artifact-tool-RDN2W7ND.js} +2 -2
  18. package/chunks/{askUserQuestion-GD2IJJ7I.js → askUserQuestion-OZERWH5R.js} +2 -2
  19. package/chunks/{bridge-3KJEWDNE.js → bridge-W7AZSRZQ.js} +42 -38
  20. package/chunks/{build-S6DO7LMM.js → build-GDBLPA24.js} +1 -1
  21. package/chunks/{channel-management-service-XR7GZSWF.js → channel-management-service-5S7YCWX5.js} +20 -5
  22. package/chunks/{channel-settings-store-HW4FXXUA.js → channel-settings-store-JFVRSNER.js} +44 -40
  23. package/chunks/{channel-worker-group-XDPTDWTX.js → channel-worker-group-OVWGYMZS.js} +5 -5
  24. package/chunks/{channel-worker-manager-YYEHVRRE.js → channel-worker-manager-H55GKOQA.js} +5 -5
  25. package/chunks/{channel-worker-supervisor-74HTWA2G.js → channel-worker-supervisor-CABBXYHK.js} +3 -3
  26. package/chunks/{chunk-UWMLWVCA.js → chunk-2IIJTXYF.js} +26 -10
  27. package/chunks/{chunk-VYOXCEPJ.js → chunk-2KKCCLPT.js} +1 -1
  28. package/chunks/{chunk-T4TXDL7G.js → chunk-2LEOZTBT.js} +36 -24
  29. package/chunks/{chunk-XWWKIXVD.js → chunk-3APUUXRF.js} +1 -1
  30. package/chunks/{chunk-TCIFAA7K.js → chunk-3F2WDAV6.js} +2 -2
  31. package/chunks/{chunk-SGFT55XI.js → chunk-3I6DUGQD.js} +1 -1
  32. package/chunks/{chunk-ZURDMIDR.js → chunk-44F4LBWZ.js} +228 -71
  33. package/chunks/{chunk-GKX7E4CO.js → chunk-45IOTAUS.js} +1 -1
  34. package/chunks/{chunk-6QIGFD5W.js → chunk-4KP2F2TE.js} +1 -1
  35. package/chunks/{chunk-X5WNMMIA.js → chunk-54YCNSK5.js} +4241 -1636
  36. package/chunks/{chunk-P4WOAOJW.js → chunk-56Z7QEAQ.js} +67 -21
  37. package/chunks/{chunk-UPUG4GXM.js → chunk-5NNHICSA.js} +3 -3
  38. package/chunks/{chunk-LGAOC3ZS.js → chunk-675H6PLP.js} +1 -1
  39. package/chunks/{chunk-5KTQXHPY.js → chunk-6CQWRWUC.js} +3 -3
  40. package/chunks/chunk-6FMJLI5M.js +1591 -0
  41. package/chunks/{chunk-GZ3RCT54.js → chunk-6MPDY6ZG.js} +1 -1
  42. package/chunks/{chunk-RCUQIPTN.js → chunk-6PQPKTXP.js} +1 -1
  43. package/chunks/{chunk-KCO4FLFJ.js → chunk-6TAASXWL.js} +3 -3
  44. package/chunks/{chunk-JHNRZMHI.js → chunk-77V3VIKL.js} +9 -9
  45. package/chunks/{chunk-CAPPWD3X.js → chunk-7KAXXBER.js} +3 -3
  46. package/chunks/{chunk-A4COXFB3.js → chunk-7SJN2IWT.js} +5 -5
  47. package/chunks/{chunk-Y4IHBGBP.js → chunk-7ULQIS27.js} +1 -1
  48. package/chunks/{chunk-5MKRTI4T.js → chunk-A7Y5H4TX.js} +4 -4
  49. package/chunks/{chunk-CVHIL5IG.js → chunk-AOHY3QJ3.js} +13 -6
  50. package/chunks/chunk-AQ37AY7B.js +93 -0
  51. package/chunks/{chunk-OCESJA77.js → chunk-AUOULH6Q.js} +45 -45
  52. package/chunks/{chunk-UBEPNVDI.js → chunk-BBIQAX4V.js} +3 -3
  53. package/chunks/{chunk-JSD33JG6.js → chunk-CBBP4BMC.js} +23 -9
  54. package/chunks/{chunk-ZHBO7WVX.js → chunk-CNTR4GR6.js} +1 -1
  55. package/chunks/{chunk-PB3MBFKG.js → chunk-CO2U743O.js} +4 -4
  56. package/chunks/{chunk-XZC5VLBZ.js → chunk-CPZAH673.js} +4 -0
  57. package/chunks/{chunk-T3O2B4XO.js → chunk-CU47KXB5.js} +3 -3
  58. package/chunks/{chunk-2LKVPASC.js → chunk-D4HTUMGX.js} +3 -3
  59. package/chunks/{chunk-BNWB5CYE.js → chunk-D6MDRSZ6.js} +7 -7
  60. package/chunks/{chunk-7BAU433D.js → chunk-DEEABGH2.js} +867 -91
  61. package/chunks/{chunk-52ZSWYEG.js → chunk-DQ2O5QOJ.js} +1 -1
  62. package/chunks/{chunk-WBSMNTSV.js → chunk-DSFHVTWD.js} +2 -2
  63. package/chunks/{chunk-PT722TDT.js → chunk-DUNI4EBW.js} +701 -86
  64. package/chunks/{chunk-UHUSJ6X7.js → chunk-E2BHWIDT.js} +19 -4
  65. package/chunks/{chunk-T2QMKU3R.js → chunk-E2FN6SM7.js} +17 -5
  66. package/chunks/{chunk-W4MIWP6M.js → chunk-E6CJ2SMM.js} +2 -2
  67. package/chunks/{chunk-5ZF5XXTS.js → chunk-EQNUDTL6.js} +2 -2
  68. package/chunks/{chunk-2N7CODY5.js → chunk-EU5TBFJI.js} +2 -2
  69. package/chunks/{chunk-TFRMVU6R.js → chunk-FANRZEAJ.js} +1 -1
  70. package/chunks/{chunk-WBL3FJEU.js → chunk-FC4KQFCS.js} +1 -1
  71. package/chunks/{chunk-GNR2RNMP.js → chunk-FCYYAB4S.js} +2 -2
  72. package/chunks/{chunk-FNMZK765.js → chunk-FJ5WUMUQ.js} +1 -1
  73. package/chunks/{chunk-J7OACQDE.js → chunk-FNDXMN7I.js} +71 -49
  74. package/chunks/{chunk-U3E3UQAA.js → chunk-FS674JW4.js} +3 -3
  75. package/chunks/{chunk-S7W2GKIO.js → chunk-G7XXKQYS.js} +2 -0
  76. package/chunks/{chunk-VWOOBLTY.js → chunk-GJ2GBPBD.js} +2 -2
  77. package/chunks/{chunk-TBBV36Y4.js → chunk-GL4JOZXU.js} +4 -4
  78. package/chunks/{chunk-FTD6DP4T.js → chunk-GURGAJTX.js} +2 -1
  79. package/chunks/{chunk-65PQENQP.js → chunk-H6I4PGRV.js} +5 -5
  80. package/chunks/{chunk-7XATOOE7.js → chunk-HC45LTEN.js} +1 -1
  81. package/chunks/{chunk-VCPIZRYH.js → chunk-HIVKI6O6.js} +7 -7
  82. package/chunks/{chunk-HMRM2A3U.js → chunk-HX6RLYUO.js} +3 -3
  83. package/chunks/{chunk-GZXCZHCT.js → chunk-I3G5JWBV.js} +1 -1
  84. package/chunks/{chunk-2XSLTRFZ.js → chunk-I5BT7ADR.js} +2 -2
  85. package/chunks/{chunk-GATT5TKW.js → chunk-IGTHU3T4.js} +1 -1
  86. package/chunks/{chunk-4G2BISNC.js → chunk-IIUGIWWY.js} +1 -1
  87. package/chunks/{chunk-7I5GTCT4.js → chunk-JCJ7LKNA.js} +5104 -4817
  88. package/chunks/{chunk-657BH7VM.js → chunk-JE2CEOBO.js} +2 -2
  89. package/chunks/{chunk-S3TWXGKA.js → chunk-JE7KQ2UP.js} +4 -2
  90. package/chunks/{chunk-BPZKP57P.js → chunk-JJPKFJBT.js} +3 -3
  91. package/chunks/{chunk-6PE7N3A4.js → chunk-JLZ3RBQG.js} +7 -5
  92. package/chunks/{chunk-2LQTH543.js → chunk-JXVC2PL3.js} +2 -2
  93. package/chunks/{chunk-JCW2R7WC.js → chunk-K623ENWT.js} +3 -79
  94. package/chunks/{chunk-T2NCM2ET.js → chunk-K6KS3LTN.js} +2 -749
  95. package/chunks/{chunk-6RPMI2AB.js → chunk-KR32NIAN.js} +6 -6
  96. package/chunks/{chunk-XBYYDKAZ.js → chunk-KWHKHSIS.js} +8 -7
  97. package/chunks/{chunk-EVKE2FZL.js → chunk-KXDONCPU.js} +4 -4
  98. package/chunks/{chunk-5TBMQLGG.js → chunk-L2E5GFAG.js} +2 -2
  99. package/chunks/{chunk-MHAIJPTD.js → chunk-L32VV3ZJ.js} +12 -12
  100. package/chunks/{chunk-OKF7JF3R.js → chunk-LHKCY7DY.js} +3 -3
  101. package/chunks/{chunk-LW3RFMG7.js → chunk-LOY7RWQG.js} +3 -3
  102. package/chunks/{chunk-AQIDMUGU.js → chunk-LYI2PZDK.js} +1 -1
  103. package/chunks/{chunk-YGF33UXG.js → chunk-MB32MS4U.js} +12 -3
  104. package/chunks/{chunk-Y6AXW2OG.js → chunk-MM7TH7ZM.js} +1 -1
  105. package/chunks/{chunk-2DN4J57Y.js → chunk-N4ACHWNH.js} +1 -1
  106. package/chunks/{chunk-M7OONWYU.js → chunk-NBD76HUW.js} +4 -2
  107. package/chunks/{chunk-A2D5BAVP.js → chunk-NHFEMWAZ.js} +1 -1
  108. package/chunks/{chunk-3EFXSQCM.js → chunk-NTDH4IML.js} +7 -7
  109. package/chunks/chunk-O6GEWCJA.js +21 -0
  110. package/chunks/{chunk-7DXQIJID.js → chunk-OFZKFPYG.js} +3 -3
  111. package/chunks/{chunk-JTV5K7NH.js → chunk-P5VC5USY.js} +1 -1
  112. package/chunks/{chunk-Q43KPN7X.js → chunk-P755N4CS.js} +3 -3
  113. package/chunks/{chunk-XFZYFU3I.js → chunk-PCK4B6LR.js} +1 -1
  114. package/chunks/{chunk-EJGJIBRS.js → chunk-PJOHNFIY.js} +3 -3
  115. package/chunks/{chunk-WUZ7H6DP.js → chunk-PVNQRENX.js} +1 -1
  116. package/chunks/{chunk-LO4ROVP4.js → chunk-PZEXDV3H.js} +106 -8
  117. package/chunks/{chunk-WZRWHXFE.js → chunk-Q3T5KA2V.js} +1 -1
  118. package/chunks/{chunk-QIZKCVM3.js → chunk-Q5WZTTWE.js} +4 -4
  119. package/chunks/{chunk-BGTQCTQW.js → chunk-QARJNL2V.js} +3 -3
  120. package/chunks/{chunk-GXIJHV66.js → chunk-QCXGC7QB.js} +3 -3
  121. package/chunks/{chunk-DZLYR4U3.js → chunk-QDK4F2N5.js} +1 -1
  122. package/chunks/{chunk-NOKIVHOL.js → chunk-QTHQ6Z5X.js} +1 -1
  123. package/chunks/{chunk-A3NDJ5SB.js → chunk-R2XWGR75.js} +2 -2
  124. package/chunks/{chunk-JX27F6QS.js → chunk-RDJOB6S3.js} +1 -1
  125. package/chunks/{chunk-TV64SXKD.js → chunk-RG64CDT2.js} +4 -4
  126. package/chunks/{chunk-JFMA7Y5M.js → chunk-RSVPYAGK.js} +5 -5
  127. package/chunks/{chunk-64LQLPL7.js → chunk-SHN4KHDK.js} +3 -3
  128. package/chunks/chunk-T3CHYWJZ.js +758 -0
  129. package/chunks/{chunk-PONHVBRT.js → chunk-TEGJSJDF.js} +2 -2
  130. package/chunks/{chunk-75GFAX4R.js → chunk-THVU3RNH.js} +1 -1
  131. package/chunks/{record-artifact-XAMSFSW4.js → chunk-TIRRPCFS.js} +22 -7
  132. package/chunks/{chunk-HV26XH34.js → chunk-TTJZAIFP.js} +3 -3
  133. package/chunks/{chunk-JMONIXMJ.js → chunk-TZTAV5RH.js} +1 -1
  134. package/chunks/{chunk-7AEJDLRA.js → chunk-UV6KF7T3.js} +2 -2
  135. package/chunks/{chunk-PLDQBIO6.js → chunk-V25K5ID7.js} +1 -1
  136. package/chunks/{chunk-S4WJVPZW.js → chunk-V4XNUDPE.js} +3 -3
  137. package/chunks/{chunk-2FAK6PNM.js → chunk-VEMNQMHA.js} +2 -2
  138. package/chunks/{chunk-CQL64ESB.js → chunk-VMX5RZQH.js} +12 -10
  139. package/chunks/{chunk-EIF3FXTB.js → chunk-W3UKBMSI.js} +63 -18
  140. package/chunks/{chunk-TDL6LB4K.js → chunk-WWCMSZII.js} +21 -9
  141. package/chunks/{chunk-5YKDXHUY.js → chunk-XP4L6KS3.js} +2 -2
  142. package/chunks/{chunk-RPLGZJV2.js → chunk-XQK4XXTN.js} +1 -1
  143. package/chunks/{chunk-KAMYKP7E.js → chunk-XUGZYLDH.js} +1 -1
  144. package/chunks/{chunk-MR5EAQ5M.js → chunk-YANIWTRZ.js} +1 -1
  145. package/chunks/{chunk-3L2SPEBH.js → chunk-YGE3IXJP.js} +1 -1
  146. package/chunks/{chunk-BCZFQXWK.js → chunk-YUFIEIWC.js} +1 -1
  147. package/chunks/{chunk-75MIQ3LV.js → chunk-Z3S5EMOW.js} +4 -4
  148. package/chunks/{chunk-BMFALVGQ.js → chunk-ZMOJ7ISP.js} +1 -1
  149. package/chunks/{chunk-GEBV2JGB.js → chunk-ZPZ7ZJEE.js} +1 -1
  150. package/chunks/{computer-use-ZTIDHMMA.js → computer-use-5QWCFNKD.js} +38 -34
  151. package/chunks/{config-utils-NYSXDMEQ.js → config-utils-WADIDWGG.js} +4 -4
  152. package/chunks/{contextCommand-2PIEU37Z.js → contextCommand-4Z7T7TUM.js} +40 -36
  153. package/chunks/{core-runtime-3XEYLQFK.js → core-runtime-6N4EFC2Q.js} +38 -34
  154. package/chunks/{create-sub-session-SBYUMSSS.js → create-sub-session-62YZWVAY.js} +2 -2
  155. package/chunks/{create-sub-session-R76FVXCI.js → create-sub-session-AEREHZBQ.js} +38 -34
  156. package/chunks/{cron-create-2QK6TCEC.js → cron-create-6E7GIQTG.js} +4 -4
  157. package/chunks/{cron-delete-FDCDFYMG.js → cron-delete-JD26XY3W.js} +4 -4
  158. package/chunks/{cron-list-XN3WVBTP.js → cron-list-CUWFB44G.js} +4 -4
  159. package/chunks/{daemon-Q2AB5Z23.js → daemon-PCNCI5YU.js} +72 -3
  160. package/chunks/{daemon-status-provider-3XJI6CAL.js → daemon-status-provider-DDF7C5M7.js} +46 -42
  161. package/chunks/{daemon-trust-policy-ILUDTLHD.js → daemon-trust-policy-Q4KSOJTR.js} +43 -39
  162. package/chunks/{daemon-trust-policy-monitor-HS3PKKRO.js → daemon-trust-policy-monitor-V6FTE3IY.js} +43 -39
  163. package/chunks/{deferred-core-runtime-X4QV662U.js → deferred-core-runtime-GHJ5GQHK.js} +38 -34
  164. package/chunks/{dist-BSTVRPMT.js → dist-26BIMQT6.js} +276 -16
  165. package/chunks/{dist-SV7Q3AWJ.js → dist-2PERFI23.js} +12 -9
  166. package/chunks/{dist-DOLYHMXE.js → dist-OAOC5OV4.js} +2 -2
  167. package/chunks/{dist-YGBBMK3Z.js → dist-PVEAFLHY.js} +5 -4
  168. package/chunks/{dist-HVRQ2CFL.js → dist-SL2LUMML.js} +1180 -5
  169. package/chunks/dist-ULIG4M5H.js +13415 -0
  170. package/chunks/{dist-IXQEQWRG.js → dist-WGMNT3JQ.js} +1 -1
  171. package/chunks/{dist-SSU66DM4.js → dist-ZHXOBXDN.js} +1 -1
  172. package/chunks/{earlyInputCapture-XKLZT7ZD.js → earlyInputCapture-TQXLLISD.js} +39 -35
  173. package/chunks/{edit-HHGIOTQ2.js → edit-FJEUV6KZ.js} +38 -34
  174. package/chunks/{enter-worktree-ZN7PUQ46.js → enter-worktree-7GE3TZ4P.js} +38 -34
  175. package/chunks/{enterPlanMode-EIFIDSIV.js → enterPlanMode-KR5TMPCJ.js} +38 -34
  176. package/chunks/{environment-XXQ75D2Q.js → environment-SWL3CMB3.js} +40 -36
  177. package/chunks/{errors-4GMVU7CK.js → errors-XQE7BGZV.js} +40 -36
  178. package/chunks/{exit-worktree-GXMI4ATY.js → exit-worktree-CHKTYNCV.js} +38 -34
  179. package/chunks/{exitPlanMode-34UVY7M6.js → exitPlanMode-QYAG6LWX.js} +38 -34
  180. package/chunks/{fast-path-VPIVA7L6.js → fast-path-Z2K7W6DC.js} +2 -2
  181. package/chunks/{gemini-4BWIK4WD.js → gemini-YU4XKEDG.js} +91 -87
  182. package/chunks/{geminiContentGenerator-3XVV5MSS.js → geminiContentGenerator-ZZX6NBO4.js} +6 -6
  183. package/chunks/{glob-TZ2ABCJG.js → glob-VYF5CXSX.js} +38 -34
  184. package/chunks/goal-tools-HGO6VXPB.js +335 -0
  185. package/chunks/{grep-BEF463NA.js → grep-5DP5ZUTW.js} +38 -34
  186. package/chunks/{handleAutoUpdate-L6ERF36Y.js → handleAutoUpdate-UVBJ56DL.js} +42 -38
  187. package/chunks/{i18n-FMM5FDXR.js → i18n-UQNYHEUD.js} +39 -35
  188. package/chunks/{image-gen-HHVLF7HS.js → image-gen-WHPIZNWF.js} +9 -9
  189. package/chunks/{initializer-625TIAIO.js → initializer-GMIICF4W.js} +44 -40
  190. package/chunks/{installationInfo-6AM4I2Y3.js → installationInfo-4MGG4WVI.js} +39 -35
  191. package/chunks/{keychain-token-storage-72IYCAZV.js → keychain-token-storage-IKO4G53C.js} +2 -2
  192. package/chunks/list-CPN2W334.js +92 -0
  193. package/chunks/{list-agents-R6KDXQR3.js → list-agents-PXJ7ZUFB.js} +2 -2
  194. package/chunks/{loadedSettingsAdapter-SPUTNKAV.js → loadedSettingsAdapter-ZQAV5NDO.js} +43 -39
  195. package/chunks/{loggingContentGenerator-LKOF7XI7.js → loggingContentGenerator-5E7W4IEP.js} +18 -18
  196. package/chunks/{loop-wakeup-3IQKCYAH.js → loop-wakeup-Y26NQZ5I.js} +13 -6
  197. package/chunks/{ls-DKZ37A7N.js → ls-ONQTTMQR.js} +4 -4
  198. package/chunks/{lsp-QNWN7KN3.js → lsp-YGHHRGMD.js} +2 -2
  199. package/chunks/{managed-npm-update-ACQGGIN5.js → managed-npm-update-MKKAXYXA.js} +39 -35
  200. package/chunks/{mcp-SZLHKFJW.js → mcp-V5NTJF6X.js} +43 -39
  201. package/chunks/{monitor-DF52UVHI.js → monitor-CO3ASY6E.js} +38 -34
  202. package/chunks/nonInteractiveCli-ZJYEOO7U.js +148 -0
  203. package/chunks/{notebook-edit-FCWS4XVN.js → notebook-edit-Z7AEE6FM.js} +38 -34
  204. package/chunks/{openaiContentGenerator-7LDK3DCJ.js → openaiContentGenerator-CA3MQOP3.js} +19 -19
  205. package/chunks/{pidfile-6ERW3DF4.js → pidfile-NL7MKDRU.js} +39 -35
  206. package/chunks/{processUtils-COKZAMUP.js → processUtils-PB5K2DYH.js} +2 -2
  207. package/chunks/{qwenContentGenerator-TKWUMR7N.js → qwenContentGenerator-JYFNDCOS.js} +44 -40
  208. package/chunks/{qwenOAuth2-7HMU47SF.js → qwenOAuth2-W2ALKQDD.js} +8 -8
  209. package/chunks/{read-file-X6DRC574.js → read-file-IEOR5H5W.js} +11 -11
  210. package/chunks/{read-mcp-resource-GFTWYXMK.js → read-mcp-resource-U2IJN5HM.js} +2 -2
  211. package/chunks/record-artifact-MGPJ7EG4.js +21 -0
  212. package/chunks/{resumeHistoryUtils-PFPM2GWM.js → resumeHistoryUtils-BNBTP5AS.js} +44 -40
  213. package/chunks/{ripGrep-OWV2IVJC.js → ripGrep-UMQODKEB.js} +38 -34
  214. package/chunks/{run-qwen-serve-TSTCO4XE.js → run-qwen-serve-RN2R6QQW.js} +116 -65
  215. package/chunks/{runtime-DAUPSUKI.js → runtime-QFJ2MJF5.js} +48 -44
  216. package/chunks/{scheduler-KMADMT26.js → scheduler-AMYUFOZI.js} +38 -34
  217. package/chunks/{sdk-exporters-http-WO556XNU.js → sdk-exporters-http-4BQANSJ6.js} +3 -3
  218. package/chunks/{sdk-impl-LPAVACSF.js → sdk-impl-Z4VXWVFX.js} +3 -3
  219. package/chunks/{send-message-SAWK4DZX.js → send-message-PMP4ATVM.js} +6 -11
  220. package/chunks/{serve-NNRWS6F4.js → serve-EIIYJVX3.js} +43 -39
  221. package/chunks/{server-WEH7DVCH.js → server-EP2LLAPD.js} +1768 -712
  222. package/chunks/{session-WXC56V2I.js → session-GMPZBLOW.js} +83 -79
  223. package/chunks/{settings-DJDXFDZ3.js → settings-LN7RNKBS.js} +47 -43
  224. package/chunks/{shell-JN5VRQXD.js → shell-EM2OWU5X.js} +38 -34
  225. package/chunks/{skill-SGXPKJCS.js → skill-T5VPSK73.js} +17 -16
  226. package/chunks/{skill-settings-VJ5PDMZI.js → skill-settings-GMR3GMNY.js} +42 -38
  227. package/chunks/{spawnChannel-ETMJW7YX.js → spawnChannel-YPCU62DI.js} +40 -36
  228. package/chunks/{standalone-update-MK3Z7KBI.js → standalone-update-JAKIM2NF.js} +40 -36
  229. package/chunks/{startInteractiveUI-ZCGIXPGT.js → startInteractiveUI-YETQWGYF.js} +774 -779
  230. package/chunks/{syntheticOutput-355CB6CJ.js → syntheticOutput-D7E6ZFKR.js} +3 -3
  231. package/chunks/{task-create-INGWNUG4.js → task-create-NFCYD43L.js} +10 -9
  232. package/chunks/{task-list-5XNNGTF4.js → task-list-TAVMGEVD.js} +5 -5
  233. package/chunks/{task-stop-4ROAOBXH.js → task-stop-ZDF2UJRM.js} +2 -2
  234. package/chunks/{task-update-CRK5VWWZ.js → task-update-6L7LHGEX.js} +10 -9
  235. package/chunks/{team-create-QQGAJG7P.js → team-create-LFJ6HGNY.js} +38 -34
  236. package/chunks/{team-delete-S2RCXA4P.js → team-delete-DPGGRQBU.js} +5 -5
  237. package/chunks/{team-plan-approval-RT7Q5R6O.js → team-plan-approval-C2KLSDGO.js} +38 -34
  238. package/chunks/{theme-manager-EEWIQJ7J.js → theme-manager-JQ3ZGBP5.js} +39 -35
  239. package/chunks/{todoWrite-7WM3VDMY.js → todoWrite-2UO5G6G6.js} +32 -4
  240. package/chunks/{tool-search-Z3Z4AYKP.js → tool-search-FAZBFRJZ.js} +15 -14
  241. package/chunks/{total-session-admission-44JKRWQD.js → total-session-admission-5CALIVYO.js} +42 -38
  242. package/chunks/{trustedFolders-X2JEIO57.js → trustedFolders-KOPSP44S.js} +39 -35
  243. package/chunks/{update-relaunch-VWNPYDIP.js → update-relaunch-6QL2TICS.js} +5 -5
  244. package/chunks/{updateCheck-KAQH67DV.js → updateCheck-4Q6RIKFW.js} +41 -37
  245. package/chunks/{useAutoAcceptIndicator-JH6BCF7S.js → useAutoAcceptIndicator-Q5BMKZV3.js} +47 -43
  246. package/chunks/{validateNonInterActiveAuth-GIUJ2UFS.js → validateNonInterActiveAuth-GKOC5F6Z.js} +79 -75
  247. package/chunks/{version-BGLYIJUY.js → version-VSATY2LD.js} +1 -1
  248. package/chunks/{web-fetch-OTDU4VQF.js → web-fetch-JCLKL6NL.js} +14 -14
  249. package/chunks/{web-search-FP6SIHPR.js → web-search-DSQTFUBX.js} +8 -8
  250. package/chunks/{workflow-YCIVBYSB.js → workflow-M6QAVKVJ.js} +41 -37
  251. package/chunks/workspace-providers-status-YKLTLMJA.js +89 -0
  252. package/chunks/{workspace-registration-store-OTMS3H4C.js → workspace-registration-store-5DMGKU64.js} +1 -1
  253. package/chunks/{workspace-registry-O63R6IZ4.js → workspace-registry-PTYUSYXX.js} +42 -38
  254. package/chunks/{workspace-service-M6LLHKJ5.js → workspace-service-25ML3T47.js} +48 -44
  255. package/chunks/{workspace-skills-status-C2V7BAIS.js → workspace-skills-status-YKZWOYRX.js} +44 -40
  256. package/chunks/{workspace-trust-reconciler-IBUPOUJN.js → workspace-trust-reconciler-5FI2S3OS.js} +47 -43
  257. package/chunks/write-file-AY7VLP5X.js +78 -0
  258. package/chunks/zoom-image-S4LJZMD5.js +224 -0
  259. package/cli.js +50 -16
  260. package/package.json +3 -3
  261. package/web-shell/assets/{arc-75-Wdeo3.js → arc-xjArKHU2.js} +1 -1
  262. package/web-shell/assets/{architectureDiagram-3BPJPVTR-FKeXQbyP.js → architectureDiagram-3BPJPVTR-BgrQDNYG.js} +1 -1
  263. package/web-shell/assets/{blockDiagram-GPEHLZMM-CY0vc-A3.js → blockDiagram-GPEHLZMM-CXxWC-1_.js} +1 -1
  264. package/web-shell/assets/{c4Diagram-AAUBKEIU-CNP-A-8u.js → c4Diagram-AAUBKEIU-Dx1tLm3v.js} +1 -1
  265. package/web-shell/assets/channel-B1cyk94G.js +1 -0
  266. package/web-shell/assets/{chunk-2J33WTMH-GybS4Gii.js → chunk-2J33WTMH-CBxjogVR.js} +1 -1
  267. package/web-shell/assets/{chunk-4BX2VUAB-02H91V8v.js → chunk-4BX2VUAB-izb-rY5W.js} +1 -1
  268. package/web-shell/assets/{chunk-55IACEB6-D3M-2VT6.js → chunk-55IACEB6-NzLyvSb8.js} +1 -1
  269. package/web-shell/assets/{chunk-727SXJPM-CCu29u4H.js → chunk-727SXJPM-DVyKb0dl.js} +1 -1
  270. package/web-shell/assets/{chunk-AQP2D5EJ-CaFKWgrn.js → chunk-AQP2D5EJ-BtqL7NzB.js} +1 -1
  271. package/web-shell/assets/{chunk-FMBD7UC4-ZZpPqIwQ.js → chunk-FMBD7UC4-iNpdKIO0.js} +1 -1
  272. package/web-shell/assets/{chunk-ND2GUHAM-D22DqGs8.js → chunk-ND2GUHAM-DI7cbFmX.js} +1 -1
  273. package/web-shell/assets/{chunk-QZHKN3VN-Bu85S0fw.js → chunk-QZHKN3VN-3Y_-xFYs.js} +1 -1
  274. package/web-shell/assets/classDiagram-4FO5ZUOK-BpBYZoRE.js +1 -0
  275. package/web-shell/assets/classDiagram-v2-Q7XG4LA2-BpBYZoRE.js +1 -0
  276. package/web-shell/assets/{cose-bilkent-S5V4N54A-f1CK1Gwe.js → cose-bilkent-S5V4N54A--raRatZn.js} +1 -1
  277. package/web-shell/assets/{dagre-BM42HDAG-D0Ow8F_n.js → dagre-BM42HDAG-B8SU70mO.js} +1 -1
  278. package/web-shell/assets/{diagram-2AECGRRQ-BPrmTWp8.js → diagram-2AECGRRQ-ewgoakXo.js} +1 -1
  279. package/web-shell/assets/{diagram-5GNKFQAL-HccuFAzy.js → diagram-5GNKFQAL-Bm_JLTnS.js} +1 -1
  280. package/web-shell/assets/{diagram-KO2AKTUF-BrS76mbA.js → diagram-KO2AKTUF-DEIUjUy9.js} +1 -1
  281. package/web-shell/assets/{diagram-LMA3HP47-V7T9lU-5.js → diagram-LMA3HP47-C2Wmrpj-.js} +1 -1
  282. package/web-shell/assets/{diagram-OG6HWLK6-DKidyJMR.js → diagram-OG6HWLK6-CtYe6bFx.js} +1 -1
  283. package/web-shell/assets/{erDiagram-TEJ5UH35-DBadZIkp.js → erDiagram-TEJ5UH35-DfpHcWLV.js} +1 -1
  284. package/web-shell/assets/{flowDiagram-I6XJVG4X-BymfqdNJ.js → flowDiagram-I6XJVG4X-CAiUhio5.js} +1 -1
  285. package/web-shell/assets/{ganttDiagram-6RSMTGT7-DOw340jf.js → ganttDiagram-6RSMTGT7-CYc7ezr4.js} +1 -1
  286. package/web-shell/assets/{gitGraphDiagram-PVQCEYII-_8EiD8sl.js → gitGraphDiagram-PVQCEYII-70lbkcRS.js} +1 -1
  287. package/web-shell/assets/index-C1k3PDuU.css +5 -0
  288. package/web-shell/assets/index-C2GE3DAF.js +74 -0
  289. package/web-shell/assets/index-DZLIXILO.js +1750 -0
  290. package/web-shell/assets/{index-CKIadvET.js → index-Ww86nT9f.js} +1 -1
  291. package/web-shell/assets/{infoDiagram-5YYISTIA-D61KYQBu.js → infoDiagram-5YYISTIA-C7e8DWPa.js} +1 -1
  292. package/web-shell/assets/{ishikawaDiagram-YF4QCWOH-CsiXSpNx.js → ishikawaDiagram-YF4QCWOH-BYLr2op-.js} +1 -1
  293. package/web-shell/assets/{journeyDiagram-JHISSGLW-Sdfionyh.js → journeyDiagram-JHISSGLW-hEibAHKX.js} +1 -1
  294. package/web-shell/assets/{kanban-definition-UN3LZRKU-C3WI3Cnl.js → kanban-definition-UN3LZRKU-F2rt8Uhp.js} +1 -1
  295. package/web-shell/assets/{linear-Dpigcc62.js → linear-DPhyNezd.js} +1 -1
  296. package/web-shell/assets/{mermaid.core-Ct97pqgW.js → mermaid.core-ZUtnug0n.js} +5 -5
  297. package/web-shell/assets/{mindmap-definition-RKZ34NQL-BzeaN0rB.js → mindmap-definition-RKZ34NQL-DDWcMoi8.js} +1 -1
  298. package/web-shell/assets/{pieDiagram-4H26LBE5-CvjgcbVD.js → pieDiagram-4H26LBE5-CTRKzw1_.js} +1 -1
  299. package/web-shell/assets/{quadrantDiagram-W4KKPZXB-BUzgTNdH.js → quadrantDiagram-W4KKPZXB-CAEwYG_z.js} +1 -1
  300. package/web-shell/assets/{requirementDiagram-4Y6WPE33-B7zKlgUQ.js → requirementDiagram-4Y6WPE33-CRjnH9D9.js} +1 -1
  301. package/web-shell/assets/{sankeyDiagram-5OEKKPKP-Bb9CQgrT.js → sankeyDiagram-5OEKKPKP-LPQT_sOd.js} +1 -1
  302. package/web-shell/assets/{sequenceDiagram-3UESZ5HK-DJ6V7itG.js → sequenceDiagram-3UESZ5HK-Ht2Iqvb0.js} +1 -1
  303. package/web-shell/assets/{stateDiagram-AJRCARHV-IImflERY.js → stateDiagram-AJRCARHV-CIUdqOXu.js} +1 -1
  304. package/web-shell/assets/stateDiagram-v2-BHNVJYJU-BmqqQZ6w.js +1 -0
  305. package/web-shell/assets/{timeline-definition-PNZ67QCA-6Q_uWHKh.js → timeline-definition-PNZ67QCA-BcilneZF.js} +1 -1
  306. package/web-shell/assets/{vennDiagram-CIIHVFJN-TmyKyjwv.js → vennDiagram-CIIHVFJN-BljwiiH1.js} +1 -1
  307. package/web-shell/assets/{wardley-L42UT6IY-CRh9uiPv.js → wardley-L42UT6IY-DeKjkYjq.js} +1 -1
  308. package/web-shell/assets/{wardleyDiagram-YWT4CUSO-59TKAW8w.js → wardleyDiagram-YWT4CUSO-L3U1H7KG.js} +1 -1
  309. package/web-shell/assets/{xychartDiagram-2RQKCTM6-GCSUIK2L.js → xychartDiagram-2RQKCTM6-IJnWsgMT.js} +1 -1
  310. package/web-shell/index.html +2 -2
  311. package/chunks/list-L2GA674Y.js +0 -88
  312. package/chunks/nonInteractiveCli-5T7KYKLK.js +0 -144
  313. package/chunks/workspace-providers-status-S35YAIUS.js +0 -85
  314. package/chunks/write-file-3BZC3EAE.js +0 -72
  315. package/chunks/zoom-image-TZ6S2O57.js +0 -351
  316. package/web-shell/assets/channel-DPYMT76A.js +0 -1
  317. package/web-shell/assets/classDiagram-4FO5ZUOK--JstsIgL.js +0 -1
  318. package/web-shell/assets/classDiagram-v2-Q7XG4LA2--JstsIgL.js +0 -1
  319. package/web-shell/assets/index-D1eXNRHe.js +0 -1389
  320. package/web-shell/assets/index-DVLD4CQq.css +0 -5
  321. package/web-shell/assets/stateDiagram-v2-BHNVJYJU-CYI_YoNR.js +0 -1
@@ -4,14 +4,15 @@ import {
4
4
  require_follow_redirects,
5
5
  require_form_data,
6
6
  require_proxy_from_env
7
- } from "./chunk-S3TWXGKA.js";
8
- import "./chunk-T2NCM2ET.js";
7
+ } from "./chunk-JE7KQ2UP.js";
8
+ import "./chunk-K6KS3LTN.js";
9
+ import "./chunk-T3CHYWJZ.js";
9
10
  import {
10
11
  ChannelBase,
11
12
  isTerminalTaskLifecycleType,
12
13
  sanitizeLogText,
13
14
  sanitizeSenderName
14
- } from "./chunk-7I5GTCT4.js";
15
+ } from "./chunk-JCJ7LKNA.js";
15
16
  import "./chunk-UDXSXLER.js";
16
17
  import "./chunk-H6XPXXMH.js";
17
18
  import "./chunk-CR3C7WXL.js";
@@ -36,7 +37,7 @@ init_esbuild_shims();
36
37
  // packages/channels/dingtalk/dist/DingtalkAdapter.js
37
38
  init_esbuild_shims();
38
39
  import { mkdirSync, writeFileSync } from "node:fs";
39
- import { randomUUID } from "node:crypto";
40
+ import { randomUUID as randomUUID4 } from "node:crypto";
40
41
  import { basename as basename2, join } from "node:path";
41
42
  import { tmpdir as tmpdir2 } from "node:os";
42
43
  import { Buffer as Buffer2 } from "node:buffer";
@@ -47,6 +48,7 @@ init_esbuild_shims();
47
48
  // node_modules/dingtalk-stream-sdk-nodejs/dist/constants.mjs
48
49
  init_esbuild_shims();
49
50
  var TOPIC_ROBOT = "/v1.0/im/bot/messages/get";
51
+ var TOPIC_CARD = "/v1.0/card/instances/callback";
50
52
 
51
53
  // node_modules/dingtalk-stream-sdk-nodejs/dist/client.mjs
52
54
  init_esbuild_shims();
@@ -4538,6 +4540,17 @@ function replaceImageMarkers(text, markers, replacements) {
4538
4540
  return result;
4539
4541
  }
4540
4542
  __name(replaceImageMarkers, "replaceImageMarkers");
4543
+ function sanitizeStreamingImageMarkers(text) {
4544
+ const markers = findImageMarkers(text);
4545
+ let result = replaceImageMarkers(text, markers, markers.map(() => "[Image pending]"));
4546
+ const visibleText = maskCode(result);
4547
+ const partialMarker = /\[(?:I(?:M(?:A(?:G(?:E(?::[^\]\r\n]*)?)?)?)?)?)?$/i.exec(visibleText);
4548
+ if (partialMarker?.index !== void 0) {
4549
+ result = `${result.slice(0, partialMarker.index)}[Image pending]`;
4550
+ }
4551
+ return result;
4552
+ }
4553
+ __name(sanitizeStreamingImageMarkers, "sanitizeStreamingImageMarkers");
4541
4554
  function isInside(realPath, directory) {
4542
4555
  const pathFromDirectory = relative(directory, realPath);
4543
4556
  return pathFromDirectory === "" || !pathFromDirectory.startsWith("..") && !isAbsolute(pathFromDirectory);
@@ -4958,6 +4971,994 @@ var DingtalkConnectionManager = class {
4958
4971
  }
4959
4972
  };
4960
4973
 
4974
+ // packages/channels/dingtalk/dist/interactive-card-client.js
4975
+ init_esbuild_shims();
4976
+ import { randomUUID } from "node:crypto";
4977
+ var STATUS_CARD_TEMPLATE_ID = "675cde2f-f526-40cb-b828-f5b2b57b8b77.schema";
4978
+ var QUESTION_CARD_TEMPLATE_ID = "c2a6355b-9724-4f7e-9653-d33fcb3311bb.schema";
4979
+ var DINGTALK_API = "https://api.dingtalk.com";
4980
+ var CARD_FETCH_TIMEOUT_MS = 1e4;
4981
+ function stringifyCardParamMap(cardParamMap) {
4982
+ return Object.fromEntries(Object.entries(cardParamMap).map(([key, value]) => [
4983
+ key,
4984
+ typeof value === "string" ? value : JSON.stringify(value)
4985
+ ]));
4986
+ }
4987
+ __name(stringifyCardParamMap, "stringifyCardParamMap");
4988
+ var DingtalkInteractiveCardClient = class {
4989
+ static {
4990
+ __name(this, "DingtalkInteractiveCardClient");
4991
+ }
4992
+ options;
4993
+ fetch;
4994
+ constructor(options) {
4995
+ this.options = options;
4996
+ this.fetch = options.fetch ?? globalThis.fetch;
4997
+ }
4998
+ async createAndDeliver(input) {
4999
+ const targetModel = input.target.isGroup ? {
5000
+ imGroupOpenDeliverModel: {
5001
+ robotCode: this.options.robotCode,
5002
+ extension: { dynamicSummary: "true" }
5003
+ }
5004
+ } : {
5005
+ imRobotOpenDeliverModel: {
5006
+ spaceType: "IM_ROBOT",
5007
+ robotCode: this.options.robotCode,
5008
+ extension: { dynamicSummary: "true" }
5009
+ }
5010
+ };
5011
+ const data = await this.request("/v1.0/card/instances/createAndDeliver", "POST", {
5012
+ cardTemplateId: input.templateId,
5013
+ outTrackId: input.outTrackId,
5014
+ cardData: {
5015
+ cardParamMap: stringifyCardParamMap(input.cardParamMap)
5016
+ },
5017
+ callbackType: "STREAM",
5018
+ imGroupOpenSpaceModel: { supportForward: true },
5019
+ imRobotOpenSpaceModel: { supportForward: true },
5020
+ openSpaceId: input.target.isGroup ? `dtv1.card//IM_GROUP.${input.target.chatId}` : `dtv1.card//IM_ROBOT.${input.target.chatId}`,
5021
+ userIdType: 1,
5022
+ ...targetModel
5023
+ }, input.templateId);
5024
+ const result = data && typeof data === "object" ? data.result : void 0;
5025
+ const deliveries = result?.deliverResults;
5026
+ if (Array.isArray(deliveries)) {
5027
+ const failure = deliveries.find((entry) => entry !== null && typeof entry === "object" && entry.success === false);
5028
+ if (failure) {
5029
+ throw new Error(`${input.templateId}: ${typeof failure.errorMsg === "string" && failure.errorMsg.trim() ? failure.errorMsg.trim() : "DingTalk card delivery failed"}`);
5030
+ }
5031
+ }
5032
+ }
5033
+ async openOrUpdateStream(input) {
5034
+ await this.request("/v1.0/card/streaming", "PUT", {
5035
+ outTrackId: input.outTrackId,
5036
+ guid: randomUUID(),
5037
+ key: input.key,
5038
+ content: input.content,
5039
+ isFull: true,
5040
+ isFinalize: input.finalize,
5041
+ isError: input.isError ?? false
5042
+ });
5043
+ }
5044
+ async updateInstance(input) {
5045
+ await this.request("/v1.0/card/instances", "PUT", {
5046
+ outTrackId: input.outTrackId,
5047
+ cardData: {
5048
+ cardParamMap: stringifyCardParamMap(input.cardParamMap)
5049
+ },
5050
+ cardUpdateOptions: { updateCardDataByKey: true }
5051
+ });
5052
+ }
5053
+ async request(path, method, body, templateId) {
5054
+ const token = await this.options.getAccessToken();
5055
+ const response = await this.fetch(`${DINGTALK_API}${path}`, {
5056
+ method,
5057
+ headers: {
5058
+ "Content-Type": "application/json",
5059
+ "x-acs-dingtalk-access-token": token
5060
+ },
5061
+ body: JSON.stringify(body),
5062
+ signal: AbortSignal.timeout(CARD_FETCH_TIMEOUT_MS)
5063
+ });
5064
+ if (!response.ok) {
5065
+ const detail = (await response.text().catch(() => "")).slice(0, 300);
5066
+ throw new Error(`DingTalk Card OpenAPI ${method} ${path} failed${templateId ? ` for ${templateId}` : ""}: HTTP ${response.status}${detail ? ` ${detail}` : ""}`);
5067
+ }
5068
+ return response.json().catch(() => void 0);
5069
+ }
5070
+ };
5071
+
5072
+ // packages/channels/dingtalk/dist/interactive-card-types.js
5073
+ init_esbuild_shims();
5074
+ var DEFAULT_QUESTION_TIMEOUT_MS = 27e4;
5075
+ function asRecord(value) {
5076
+ return value !== null && typeof value === "object" && !Array.isArray(value) ? value : void 0;
5077
+ }
5078
+ __name(asRecord, "asRecord");
5079
+ function parseEmbeddedRecord(value) {
5080
+ if (typeof value !== "string") {
5081
+ return asRecord(value);
5082
+ }
5083
+ try {
5084
+ return asRecord(JSON.parse(value));
5085
+ } catch {
5086
+ return void 0;
5087
+ }
5088
+ }
5089
+ __name(parseEmbeddedRecord, "parseEmbeddedRecord");
5090
+ function parseBooleanLike(value) {
5091
+ return value === true || value === "true" || value === 1 || value === "1";
5092
+ }
5093
+ __name(parseBooleanLike, "parseBooleanLike");
5094
+ function optionalBoolean(value, path, fallback) {
5095
+ if (value === void 0)
5096
+ return fallback;
5097
+ if (typeof value !== "boolean") {
5098
+ throw new Error(`DingTalk interactiveCards.${path} must be a boolean.`);
5099
+ }
5100
+ return value;
5101
+ }
5102
+ __name(optionalBoolean, "optionalBoolean");
5103
+ function parseDingtalkInteractiveCardConfig(value) {
5104
+ if (value !== void 0 && !asRecord(value)) {
5105
+ throw new Error("DingTalk interactiveCards must be an object.");
5106
+ }
5107
+ const configured = value !== void 0;
5108
+ const root = asRecord(value) ?? {};
5109
+ const status = asRecord(root["statusCard"]);
5110
+ const question = asRecord(root["questionCard"]);
5111
+ if (root["statusCard"] !== void 0 && !status) {
5112
+ throw new Error("DingTalk interactiveCards.statusCard must be an object.");
5113
+ }
5114
+ if (root["questionCard"] !== void 0 && !question) {
5115
+ throw new Error("DingTalk interactiveCards.questionCard must be an object.");
5116
+ }
5117
+ const timeoutMs = question?.["timeoutMs"] === void 0 ? DEFAULT_QUESTION_TIMEOUT_MS : question["timeoutMs"];
5118
+ if (typeof timeoutMs !== "number" || !Number.isFinite(timeoutMs) || timeoutMs <= 0) {
5119
+ throw new Error("DingTalk interactiveCards.questionCard.timeoutMs must be a finite positive number.");
5120
+ }
5121
+ return {
5122
+ enabled: optionalBoolean(root["enabled"], "enabled", configured),
5123
+ statusCard: {
5124
+ enabled: optionalBoolean(status?.["enabled"], "statusCard.enabled", true)
5125
+ },
5126
+ questionCard: {
5127
+ enabled: optionalBoolean(question?.["enabled"], "questionCard.enabled", true),
5128
+ timeoutMs
5129
+ }
5130
+ };
5131
+ }
5132
+ __name(parseDingtalkInteractiveCardConfig, "parseDingtalkInteractiveCardConfig");
5133
+ function parseDingtalkCardCallback(value) {
5134
+ const root = parseEmbeddedRecord(value);
5135
+ if (!root)
5136
+ return void 0;
5137
+ const embeddedValue = parseEmbeddedRecord(root["value"]);
5138
+ const embeddedContent = parseEmbeddedRecord(root["content"]);
5139
+ const privateSources = [embeddedValue, embeddedContent, root].map((source) => parseEmbeddedRecord(source?.["cardPrivateData"])).filter((source) => source !== void 0);
5140
+ const sources = [
5141
+ embeddedValue,
5142
+ embeddedContent,
5143
+ ...privateSources,
5144
+ root
5145
+ ].filter((source) => source !== void 0);
5146
+ const pickString = /* @__PURE__ */ __name((...keys) => {
5147
+ for (const source of sources) {
5148
+ for (const key of keys) {
5149
+ const candidate = source[key];
5150
+ if (typeof candidate === "string" && candidate.trim()) {
5151
+ return candidate.trim();
5152
+ }
5153
+ }
5154
+ }
5155
+ return void 0;
5156
+ }, "pickString");
5157
+ const privateData = privateSources[0];
5158
+ const actionIds = privateData?.["actionIds"];
5159
+ const actionId = (Array.isArray(actionIds) && typeof actionIds[0] === "string" && actionIds[0].trim() ? actionIds[0].trim() : void 0) ?? pickString("actionValue", "eventKey", "actionId");
5160
+ const outTrackId = pickString("outTrackId");
5161
+ const actorId = parseDingtalkCardActorId(root);
5162
+ if (!outTrackId || !actionId || !actorId)
5163
+ return void 0;
5164
+ const params = sources.map((source) => parseEmbeddedRecord(source["params"])).find((source) => source !== void 0);
5165
+ const formData = sources.flatMap((source) => [
5166
+ parseEmbeddedRecord(source["formData"]),
5167
+ parseEmbeddedRecord(parseEmbeddedRecord(source["params"])?.["form"])
5168
+ ]).find((source) => source !== void 0);
5169
+ const hasCancelField = params !== void 0 && Object.prototype.hasOwnProperty.call(params, "user_cancel");
5170
+ return {
5171
+ outTrackId,
5172
+ actionId,
5173
+ actorId,
5174
+ formData: formData ?? {},
5175
+ hasBusinessPayload: formData !== void 0 || hasCancelField,
5176
+ isCancel: hasCancelField && parseBooleanLike(params["user_cancel"])
5177
+ };
5178
+ }
5179
+ __name(parseDingtalkCardCallback, "parseDingtalkCardCallback");
5180
+ function parseDingtalkCardActorId(value) {
5181
+ const root = parseEmbeddedRecord(value);
5182
+ if (!root)
5183
+ return void 0;
5184
+ return ["userId", "senderStaffId", "senderId"].map((key) => root[key]).find((candidate) => typeof candidate === "string" && candidate.trim().length > 0)?.trim();
5185
+ }
5186
+ __name(parseDingtalkCardActorId, "parseDingtalkCardActorId");
5187
+
5188
+ // packages/channels/dingtalk/dist/status-card-controller.js
5189
+ init_esbuild_shims();
5190
+ import { randomUUID as randomUUID2 } from "node:crypto";
5191
+ var FLUSH_INTERVAL_MS = 500;
5192
+ var CONTENT_LIMIT = 2e4;
5193
+ var TRUNCATION_MARKER = "[Earlier output truncated]\n";
5194
+ function boundContent(content) {
5195
+ if (content.length <= CONTENT_LIMIT)
5196
+ return content;
5197
+ return `${TRUNCATION_MARKER}${content.slice(content.length - (CONTENT_LIMIT - TRUNCATION_MARKER.length))}`;
5198
+ }
5199
+ __name(boundContent, "boundContent");
5200
+ var StatusCardController = class {
5201
+ static {
5202
+ __name(this, "StatusCardController");
5203
+ }
5204
+ options;
5205
+ recordsBySegment = /* @__PURE__ */ new Map();
5206
+ recordsByOutTrack = /* @__PURE__ */ new Map();
5207
+ segmentIdsByRun = /* @__PURE__ */ new Map();
5208
+ terminalSegmentIds = /* @__PURE__ */ new Set();
5209
+ constructor(options) {
5210
+ this.options = options;
5211
+ }
5212
+ append(segment, target, chunk) {
5213
+ if (!chunk || this.terminalSegmentIds.has(segment.segmentId))
5214
+ return;
5215
+ let record = this.recordsBySegment.get(segment.segmentId);
5216
+ if (!record) {
5217
+ record = this.createRecord(segment, target);
5218
+ }
5219
+ if (record.terminal)
5220
+ return;
5221
+ record.content = boundContent(record.content + chunk);
5222
+ if (record.streamFailed)
5223
+ return;
5224
+ record.pendingSnapshot = sanitizeStreamingImageMarkers(record.content);
5225
+ this.scheduleFlush(record);
5226
+ }
5227
+ createRecord(segment, target) {
5228
+ const outTrackId = `qwen-status-${randomUUID2()}`;
5229
+ const record = {
5230
+ segmentId: segment.segmentId,
5231
+ runId: segment.runId,
5232
+ sessionId: segment.sessionId,
5233
+ ownerId: segment.owner.id,
5234
+ target,
5235
+ outTrackId,
5236
+ content: "",
5237
+ startedAt: Date.now(),
5238
+ lastStatusSecond: 0,
5239
+ ready: Promise.resolve(false),
5240
+ terminal: false,
5241
+ streamFailed: false,
5242
+ stopClaimed: false,
5243
+ forbiddenActors: /* @__PURE__ */ new Set(),
5244
+ lastWriteAt: Date.now(),
5245
+ writeChain: Promise.resolve()
5246
+ };
5247
+ this.recordsBySegment.set(record.segmentId, record);
5248
+ this.recordsByOutTrack.set(outTrackId, record);
5249
+ const segmentIds = this.segmentIdsByRun.get(record.runId) ?? /* @__PURE__ */ new Set();
5250
+ segmentIds.add(record.segmentId);
5251
+ this.segmentIdsByRun.set(record.runId, segmentIds);
5252
+ record.ready = this.create(record, target);
5253
+ return record;
5254
+ }
5255
+ complete(segmentId, text) {
5256
+ return this.finalize(segmentId, boundContent(text), "Completed", false);
5257
+ }
5258
+ fail(segmentId, error) {
5259
+ void this.finalize(segmentId, boundContent(error), "Failed", true);
5260
+ }
5261
+ cancelRun(runId, reason) {
5262
+ for (const segmentId of [...this.segmentIdsByRun.get(runId) ?? []]) {
5263
+ const record = this.recordsBySegment.get(segmentId);
5264
+ if (!record)
5265
+ continue;
5266
+ void this.finalize(segmentId, sanitizeStreamingImageMarkers(record.content), reason === "cancel_command" ? "Stopped" : "Cancelled", false);
5267
+ }
5268
+ }
5269
+ claimStop(outTrackId, actorId) {
5270
+ const record = this.recordsByOutTrack.get(outTrackId);
5271
+ if (!record || record.terminal || record.stopClaimed) {
5272
+ return { kind: "ignored", actorId };
5273
+ }
5274
+ if (record.ownerId !== actorId) {
5275
+ if (record.forbiddenActors.has(actorId)) {
5276
+ return { kind: "ignored" };
5277
+ }
5278
+ record.forbiddenActors.add(actorId);
5279
+ return { kind: "forbidden", actorId, target: record.target };
5280
+ }
5281
+ record.stopClaimed = true;
5282
+ return {
5283
+ kind: "accepted",
5284
+ execute: /* @__PURE__ */ __name(async () => {
5285
+ const cancelled = await this.options.cancelRun(record.sessionId, record.runId);
5286
+ if (this.recordsByOutTrack.get(outTrackId) !== record || record.terminal) {
5287
+ return;
5288
+ }
5289
+ if (!cancelled) {
5290
+ record.stopClaimed = false;
5291
+ return;
5292
+ }
5293
+ this.cancelRun(record.runId, "cancel_command");
5294
+ }, "execute")
5295
+ };
5296
+ }
5297
+ async create(record, target) {
5298
+ try {
5299
+ await this.options.client.createAndDeliver({
5300
+ templateId: STATUS_CARD_TEMPLATE_ID,
5301
+ outTrackId: record.outTrackId,
5302
+ target,
5303
+ cardParamMap: {
5304
+ content: "",
5305
+ flowStatus: 2,
5306
+ statusLine: this.statusLine(record, "Running").text,
5307
+ hasAction: "true",
5308
+ stop_action: "true"
5309
+ }
5310
+ });
5311
+ await this.options.client.openOrUpdateStream({
5312
+ outTrackId: record.outTrackId,
5313
+ key: "content",
5314
+ content: "",
5315
+ finalize: false
5316
+ });
5317
+ return true;
5318
+ } catch (error) {
5319
+ this.options.onError?.("status card creation", error);
5320
+ await this.options.client.updateInstance({
5321
+ outTrackId: record.outTrackId,
5322
+ cardParamMap: {
5323
+ flowStatus: 3,
5324
+ statusLine: "Unavailable",
5325
+ hasAction: "false",
5326
+ stop_action: "false"
5327
+ }
5328
+ }).catch(() => {
5329
+ });
5330
+ return false;
5331
+ }
5332
+ }
5333
+ scheduleFlush(record) {
5334
+ if (record.flushTimer || record.inFlight || record.terminal)
5335
+ return;
5336
+ const delay = Math.max(0, FLUSH_INTERVAL_MS - (Date.now() - record.lastWriteAt));
5337
+ record.flushTimer = setTimeout(() => {
5338
+ record.flushTimer = void 0;
5339
+ this.flush(record);
5340
+ }, delay);
5341
+ }
5342
+ flush(record) {
5343
+ if (record.terminal || record.inFlight || record.pendingSnapshot === void 0)
5344
+ return;
5345
+ const content = record.pendingSnapshot;
5346
+ record.pendingSnapshot = void 0;
5347
+ const write = record.writeChain.then(async () => {
5348
+ const ready = await record.ready;
5349
+ if (!ready || record.terminal)
5350
+ return;
5351
+ await this.options.client.openOrUpdateStream({
5352
+ outTrackId: record.outTrackId,
5353
+ key: "content",
5354
+ content,
5355
+ finalize: false
5356
+ });
5357
+ await this.updateRunningStatus(record);
5358
+ }).catch((error) => {
5359
+ record.streamFailed = true;
5360
+ record.pendingSnapshot = void 0;
5361
+ this.options.onError?.("status card streaming", error);
5362
+ });
5363
+ const tracked = write.finally(() => {
5364
+ if (record.inFlight === tracked) {
5365
+ record.inFlight = void 0;
5366
+ }
5367
+ record.lastWriteAt = Date.now();
5368
+ if (record.pendingSnapshot !== void 0)
5369
+ this.scheduleFlush(record);
5370
+ });
5371
+ record.inFlight = tracked;
5372
+ record.writeChain = tracked;
5373
+ }
5374
+ async finalize(segmentId, content, state, isError) {
5375
+ const record = this.recordsBySegment.get(segmentId);
5376
+ if (!record || record.terminal)
5377
+ return false;
5378
+ record.terminal = true;
5379
+ this.terminalSegmentIds.add(segmentId);
5380
+ while (this.terminalSegmentIds.size > 1e3) {
5381
+ const oldest = this.terminalSegmentIds.values().next().value;
5382
+ if (oldest === void 0)
5383
+ break;
5384
+ this.terminalSegmentIds.delete(oldest);
5385
+ }
5386
+ if (record.flushTimer)
5387
+ clearTimeout(record.flushTimer);
5388
+ record.flushTimer = void 0;
5389
+ record.pendingSnapshot = void 0;
5390
+ try {
5391
+ if (!await record.ready)
5392
+ return false;
5393
+ await record.writeChain;
5394
+ const finalContent = boundContent(sanitizeStreamingImageMarkers(content || record.content));
5395
+ await this.options.client.openOrUpdateStream({
5396
+ outTrackId: record.outTrackId,
5397
+ key: "content",
5398
+ content: "",
5399
+ finalize: true,
5400
+ isError
5401
+ });
5402
+ await this.options.client.updateInstance({
5403
+ outTrackId: record.outTrackId,
5404
+ cardParamMap: {
5405
+ blockList: JSON.stringify([
5406
+ {
5407
+ type: 0,
5408
+ markdown: finalContent
5409
+ }
5410
+ ]),
5411
+ content: finalContent,
5412
+ copy_content: finalContent,
5413
+ flowStatus: 3,
5414
+ statusLine: this.statusLine(record, state).text,
5415
+ hasAction: "false",
5416
+ stop_action: "false"
5417
+ }
5418
+ });
5419
+ record.content = "";
5420
+ return true;
5421
+ } catch (error) {
5422
+ this.options.onError?.("status card finalization", error);
5423
+ return false;
5424
+ } finally {
5425
+ if (this.recordsBySegment.get(segmentId) === record) {
5426
+ this.recordsBySegment.delete(segmentId);
5427
+ }
5428
+ if (this.recordsByOutTrack.get(record.outTrackId) === record) {
5429
+ this.recordsByOutTrack.delete(record.outTrackId);
5430
+ }
5431
+ const segmentIds = this.segmentIdsByRun.get(record.runId);
5432
+ segmentIds?.delete(segmentId);
5433
+ if (segmentIds?.size === 0) {
5434
+ this.segmentIdsByRun.delete(record.runId);
5435
+ }
5436
+ }
5437
+ }
5438
+ statusLine(record, state) {
5439
+ const second = Math.max(0, Math.floor((Date.now() - record.startedAt) / 1e3));
5440
+ const model = this.options.model?.trim();
5441
+ return {
5442
+ text: [state, model, `${second}s`].filter(Boolean).join(" \xB7 "),
5443
+ second
5444
+ };
5445
+ }
5446
+ async updateRunningStatus(record) {
5447
+ if (record.terminal)
5448
+ return;
5449
+ const status = this.statusLine(record, "Running");
5450
+ if (status.second === record.lastStatusSecond)
5451
+ return;
5452
+ try {
5453
+ await this.options.client.updateInstance({
5454
+ outTrackId: record.outTrackId,
5455
+ cardParamMap: { statusLine: status.text }
5456
+ });
5457
+ record.lastStatusSecond = status.second;
5458
+ } catch (error) {
5459
+ this.options.onError?.("status card metadata", error);
5460
+ }
5461
+ }
5462
+ };
5463
+
5464
+ // packages/channels/dingtalk/dist/question-card-controller.js
5465
+ init_esbuild_shims();
5466
+ import { randomUUID as randomUUID3 } from "node:crypto";
5467
+ var OTHER_OPTION_VALUE = "__qwen_other__";
5468
+ var QuestionCardController = class {
5469
+ static {
5470
+ __name(this, "QuestionCardController");
5471
+ }
5472
+ options;
5473
+ byRequest = /* @__PURE__ */ new Map();
5474
+ byOutTrack = /* @__PURE__ */ new Map();
5475
+ activeByScope = /* @__PURE__ */ new Map();
5476
+ pendingByRun = /* @__PURE__ */ new Map();
5477
+ nextSequence = 0;
5478
+ constructor(options) {
5479
+ this.options = options;
5480
+ }
5481
+ async present(context, target) {
5482
+ const scopeKey = this.scopeKey(context);
5483
+ const active = this.activeByScope.get(scopeKey);
5484
+ if (active?.state === "reserved" || active?.state === "pending") {
5485
+ if (active.context.runId === context.runId) {
5486
+ return { kind: "unsupported" };
5487
+ }
5488
+ if (active.state === "pending")
5489
+ this.reserveTerminalProjection(active);
5490
+ void this.finalize(active, "expired", "A newer question is available. Answer the latest card.");
5491
+ }
5492
+ const record = {
5493
+ context,
5494
+ target,
5495
+ outTrackId: `qwen-question-${randomUUID3()}`,
5496
+ scopeKey,
5497
+ sequence: this.nextSequence++,
5498
+ state: "reserved",
5499
+ delivered: false,
5500
+ forbiddenActors: /* @__PURE__ */ new Set()
5501
+ };
5502
+ this.byRequest.set(context.requestId, record);
5503
+ this.byOutTrack.set(record.outTrackId, record);
5504
+ this.activeByScope.set(record.scopeKey, record);
5505
+ const unsubscribe = context.onSettled((reason) => {
5506
+ if (record.state === "claimed")
5507
+ return;
5508
+ if (record.state === "pending")
5509
+ this.reserveTerminalProjection(record);
5510
+ void this.finalize(record, reason === "resolved_outside_presenter" ? "resolved_outside_presenter" : "cancelled");
5511
+ });
5512
+ record.unsubscribe = unsubscribe;
5513
+ if (record.state === "terminal")
5514
+ unsubscribe();
5515
+ try {
5516
+ await this.options.client.createAndDeliver({
5517
+ templateId: QUESTION_CARD_TEMPLATE_ID,
5518
+ outTrackId: record.outTrackId,
5519
+ target,
5520
+ cardParamMap: this.cardData(context)
5521
+ });
5522
+ record.delivered = true;
5523
+ } catch (error) {
5524
+ this.options.onError?.("question card creation", error);
5525
+ if (record.state === "terminal") {
5526
+ return { kind: "presented" };
5527
+ }
5528
+ await this.finalize(record, "cancelled");
5529
+ try {
5530
+ await this.options.sendFallback(context.target.chatId, this.fallbackText(context));
5531
+ } catch (fallbackError) {
5532
+ this.options.onError?.("question fallback delivery", fallbackError);
5533
+ }
5534
+ await context.respond({ outcome: { outcome: "cancelled" } });
5535
+ return { kind: "handled" };
5536
+ }
5537
+ if (record.state !== "reserved") {
5538
+ await this.projectTerminal(record);
5539
+ return { kind: "presented" };
5540
+ }
5541
+ const latest = this.activeByScope.get(record.scopeKey);
5542
+ if (latest && latest.sequence > record.sequence) {
5543
+ await this.finalize(record, "expired", "A newer question is available. Answer the latest card.");
5544
+ return { kind: "presented" };
5545
+ }
5546
+ record.state = "pending";
5547
+ this.activeByScope.set(record.scopeKey, record);
5548
+ const pending = this.pendingByRun.get(context.runId) ?? /* @__PURE__ */ new Set();
5549
+ pending.add(context.requestId);
5550
+ this.pendingByRun.set(context.runId, pending);
5551
+ record.timer = setTimeout(() => {
5552
+ void this.expire(record);
5553
+ }, this.options.timeoutMs);
5554
+ record.timer.unref?.();
5555
+ return { kind: "presented" };
5556
+ }
5557
+ claim(callback) {
5558
+ const record = this.byOutTrack.get(callback.outTrackId);
5559
+ if (!record || record.state !== "pending") {
5560
+ return { kind: "ignored", actorId: callback.actorId };
5561
+ }
5562
+ if (record.context.owner.id !== callback.actorId) {
5563
+ if (record.forbiddenActors.has(callback.actorId)) {
5564
+ return { kind: "ignored" };
5565
+ }
5566
+ record.forbiddenActors.add(callback.actorId);
5567
+ return {
5568
+ kind: "forbidden",
5569
+ actorId: callback.actorId,
5570
+ target: record.target
5571
+ };
5572
+ }
5573
+ if (callback.hasBusinessPayload === false) {
5574
+ return { kind: "ignored", actorId: callback.actorId };
5575
+ }
5576
+ if (callback.isCancel || callback.actionId === "cancel") {
5577
+ this.reserveTerminalProjection(record);
5578
+ record.state = "claimed";
5579
+ return {
5580
+ kind: "accepted",
5581
+ execute: /* @__PURE__ */ __name(() => this.respond(record, "cancelled"), "execute")
5582
+ };
5583
+ }
5584
+ if (callback.actionId !== "submit" && callback.actionId !== record.context.requestId) {
5585
+ return { kind: "ignored", actorId: callback.actorId };
5586
+ }
5587
+ const answers = this.parseAnswers(record, callback.formData);
5588
+ if (!answers)
5589
+ return { kind: "ignored", actorId: callback.actorId };
5590
+ this.reserveTerminalProjection(record);
5591
+ record.state = "claimed";
5592
+ return {
5593
+ kind: "accepted",
5594
+ execute: /* @__PURE__ */ __name(() => this.respond(record, "submitted", answers), "execute")
5595
+ };
5596
+ }
5597
+ cancelRun(runId, terminalState = "cancelled") {
5598
+ const requestIds = [...this.pendingByRun.get(runId) ?? []];
5599
+ for (const requestId of requestIds) {
5600
+ const record = this.byRequest.get(requestId);
5601
+ if (record) {
5602
+ this.reserveTerminalProjection(record);
5603
+ void this.finalize(record, terminalState, terminalState === "expired" ? "This question is no longer available." : void 0);
5604
+ }
5605
+ }
5606
+ }
5607
+ async respond(record, terminalState, answers) {
5608
+ try {
5609
+ const accepted = await record.context.respond(terminalState === "submitted" ? {
5610
+ outcome: {
5611
+ outcome: "selected",
5612
+ optionId: record.context.submitOptionId
5613
+ },
5614
+ answers
5615
+ } : { outcome: { outcome: "cancelled" } });
5616
+ await this.finalize(record, accepted ? terminalState : "expired", accepted ? void 0 : "This question is no longer available.");
5617
+ } catch (error) {
5618
+ this.options.onError?.("question response", error);
5619
+ await this.finalize(record, "expired", "This question is no longer available.");
5620
+ }
5621
+ }
5622
+ async expire(record) {
5623
+ if (record.state !== "pending")
5624
+ return;
5625
+ this.reserveTerminalProjection(record);
5626
+ await this.finalize(record, "expired");
5627
+ try {
5628
+ await record.context.respond({ outcome: { outcome: "cancelled" } });
5629
+ } catch (error) {
5630
+ this.options.onError?.("expired question cancellation", error);
5631
+ }
5632
+ }
5633
+ async finalize(record, state, description) {
5634
+ if (record.state === "terminal")
5635
+ return;
5636
+ record.state = "terminal";
5637
+ record.terminalState = state;
5638
+ record.terminalDescription = description;
5639
+ if (record.timer)
5640
+ clearTimeout(record.timer);
5641
+ record.timer = void 0;
5642
+ record.unsubscribe?.();
5643
+ record.unsubscribe = void 0;
5644
+ this.byRequest.delete(record.context.requestId);
5645
+ this.byOutTrack.delete(record.outTrackId);
5646
+ if (this.activeByScope.get(record.scopeKey) === record) {
5647
+ this.activeByScope.delete(record.scopeKey);
5648
+ }
5649
+ const pending = this.pendingByRun.get(record.context.runId);
5650
+ pending?.delete(record.context.requestId);
5651
+ if (pending?.size === 0)
5652
+ this.pendingByRun.delete(record.context.runId);
5653
+ if (record.delivered) {
5654
+ const finishTerminalProjection = record.finishTerminalProjection;
5655
+ record.finishTerminalProjection = void 0;
5656
+ if (finishTerminalProjection) {
5657
+ await finishTerminalProjection(() => this.projectTerminal(record));
5658
+ } else {
5659
+ await this.projectTerminal(record);
5660
+ }
5661
+ }
5662
+ }
5663
+ reserveTerminalProjection(record) {
5664
+ record.finishTerminalProjection ??= this.options.reserveRunProjection?.(record.context.runId);
5665
+ }
5666
+ async projectTerminal(record) {
5667
+ if (!record.terminalState)
5668
+ return;
5669
+ const cardParamMap = {
5670
+ submitted: {
5671
+ card_status: "submitted",
5672
+ question_desc: "Submitted.",
5673
+ form_btn_text: "Submitted"
5674
+ },
5675
+ expired: {
5676
+ card_status: "expired",
5677
+ question_desc: "This question expired. Please retry.",
5678
+ form_btn_text: "Expired"
5679
+ },
5680
+ resolved_outside_presenter: {
5681
+ card_status: "expired",
5682
+ question_desc: "Resolved outside this card.",
5683
+ form_btn_text: "Expired"
5684
+ },
5685
+ cancelled: {
5686
+ card_status: "cancelled",
5687
+ question_desc: "Cancelled.",
5688
+ form_btn_text: "Cancelled"
5689
+ }
5690
+ };
5691
+ try {
5692
+ await this.options.client.updateInstance({
5693
+ outTrackId: record.outTrackId,
5694
+ cardParamMap: {
5695
+ ...cardParamMap[record.terminalState],
5696
+ ...record.terminalDescription ? { question_desc: record.terminalDescription } : {}
5697
+ }
5698
+ });
5699
+ } catch (error) {
5700
+ this.options.onError?.("question card finalization", error);
5701
+ }
5702
+ }
5703
+ parseAnswers(record, formData) {
5704
+ const allowed = new Set(record.context.questions.flatMap((question) => [
5705
+ question.answerKey,
5706
+ this.otherAnswerKey(question.answerKey)
5707
+ ]));
5708
+ if (Object.keys(formData).some((key) => !allowed.has(key))) {
5709
+ return void 0;
5710
+ }
5711
+ const answers = {};
5712
+ for (const question of record.context.questions) {
5713
+ const values = this.readAnswerValues(formData[question.answerKey]);
5714
+ if (values.length === 0 || !question.multiSelect && values.length !== 1)
5715
+ return void 0;
5716
+ const optionLabels = new Set(question.options.map((option) => option.label));
5717
+ const customValue = this.readAnswerValues(formData[this.otherAnswerKey(question.answerKey)])[0]?.trim();
5718
+ const normalized = [];
5719
+ for (const value of values) {
5720
+ if (value === OTHER_OPTION_VALUE) {
5721
+ if (!customValue)
5722
+ return void 0;
5723
+ normalized.push(customValue);
5724
+ } else if (optionLabels.has(value)) {
5725
+ normalized.push(value);
5726
+ } else {
5727
+ return void 0;
5728
+ }
5729
+ }
5730
+ answers[question.answerKey] = normalized.join(", ");
5731
+ }
5732
+ return answers;
5733
+ }
5734
+ readAnswerValues(value) {
5735
+ if (typeof value === "string")
5736
+ return value.trim() ? [value.trim()] : [];
5737
+ if (Array.isArray(value)) {
5738
+ return value.filter((item) => typeof item === "string").map((item) => item.trim()).filter(Boolean);
5739
+ }
5740
+ if (value !== null && typeof value === "object") {
5741
+ return this.readAnswerValues(value["value"]);
5742
+ }
5743
+ return [];
5744
+ }
5745
+ otherAnswerKey(answerKey) {
5746
+ return `${answerKey}_other`;
5747
+ }
5748
+ scopeKey(context) {
5749
+ return `${context.sessionId}\0${context.owner.id}`;
5750
+ }
5751
+ cardData(context) {
5752
+ const first = context.questions[0];
5753
+ return {
5754
+ question_id: context.requestId,
5755
+ question_title: first.header,
5756
+ question_desc: first.question,
5757
+ card_status: "pending",
5758
+ form_btn_text: "Submit",
5759
+ selected_text: "",
5760
+ selected_values: "[]",
5761
+ form: {
5762
+ fields: context.questions.flatMap((question) => [
5763
+ {
5764
+ name: question.answerKey,
5765
+ label: question.question,
5766
+ type: question.multiSelect ? "MULTI_CHECKBOX_GROUP" : "CHECKBOX_GROUP",
5767
+ required: true,
5768
+ options: [
5769
+ ...question.options.map((option) => ({
5770
+ value: option.label,
5771
+ text: option.label
5772
+ })),
5773
+ { value: OTHER_OPTION_VALUE, text: "Other" }
5774
+ ]
5775
+ },
5776
+ {
5777
+ name: this.otherAnswerKey(question.answerKey),
5778
+ label: `${question.header}: Other`,
5779
+ type: "TEXT",
5780
+ required: false,
5781
+ placeholder: "Enter a custom answer when Other is selected"
5782
+ }
5783
+ ])
5784
+ }
5785
+ };
5786
+ }
5787
+ fallbackText(context) {
5788
+ const questions = context.questions.map((question) => `- ${question.question}: ${question.options.map((option) => option.label).join(", ")}`).join("\n");
5789
+ return `The interactive question could not be delivered, so this request was cancelled. Please retry.
5790
+ ${questions}`;
5791
+ }
5792
+ };
5793
+
5794
+ // packages/channels/dingtalk/dist/interaction-presenter.js
5795
+ init_esbuild_shims();
5796
+ var DingtalkInteractionPresenter = class {
5797
+ static {
5798
+ __name(this, "DingtalkInteractionPresenter");
5799
+ }
5800
+ options;
5801
+ runs = /* @__PURE__ */ new Map();
5802
+ segments = /* @__PURE__ */ new Map();
5803
+ terminalSegmentIds = /* @__PURE__ */ new Set();
5804
+ constructor(options) {
5805
+ this.options = options;
5806
+ }
5807
+ registerRun(runId, ownerId, target) {
5808
+ this.runs.set(runId, {
5809
+ ownerId,
5810
+ target,
5811
+ projectionChain: Promise.resolve(),
5812
+ terminal: false
5813
+ });
5814
+ }
5815
+ appendOutput(segment, chunk) {
5816
+ const run = this.runs.get(segment.runId);
5817
+ if (!run || run.terminal || run.ownerId !== segment.owner.id || run.target.chatId !== segment.target.chatId || run.target.isGroup !== segment.target.isGroup || !chunk || this.terminalSegmentIds.has(segment.segmentId)) {
5818
+ return;
5819
+ }
5820
+ const existing = this.segments.get(segment.segmentId);
5821
+ if (existing && existing.run !== run)
5822
+ return;
5823
+ const presentation = existing ?? {
5824
+ run,
5825
+ context: segment,
5826
+ content: ""
5827
+ };
5828
+ presentation.content = this.boundContent(presentation.content + chunk);
5829
+ this.segments.set(segment.segmentId, presentation);
5830
+ run.activeSegmentId = segment.segmentId;
5831
+ if (!this.options.statusCards)
5832
+ return;
5833
+ void this.enqueue(run, () => {
5834
+ this.options.statusCards?.append(segment, this.cardTarget(segment.target), chunk);
5835
+ });
5836
+ }
5837
+ closeOutput(segmentId, text, reason, segment) {
5838
+ let presentation = this.segments.get(segmentId);
5839
+ if (!presentation && segment && text) {
5840
+ this.appendOutput(segment, text);
5841
+ presentation = this.segments.get(segmentId);
5842
+ }
5843
+ if (!presentation)
5844
+ return Promise.resolve(false);
5845
+ const run = presentation.run;
5846
+ if (run.terminal)
5847
+ return Promise.resolve(false);
5848
+ this.segments.delete(segmentId);
5849
+ this.addTerminalSegment(segmentId);
5850
+ if (run.activeSegmentId === segmentId) {
5851
+ run.activeSegmentId = void 0;
5852
+ }
5853
+ return this.enqueue(run, async () => {
5854
+ const statusCards = this.options.statusCards;
5855
+ if (reason === "failed") {
5856
+ statusCards?.fail(segmentId, text);
5857
+ return statusCards !== void 0;
5858
+ }
5859
+ if (reason === "cancelled") {
5860
+ return statusCards !== void 0;
5861
+ }
5862
+ const completed = statusCards !== void 0 && await statusCards.complete(segmentId, text);
5863
+ if (completed)
5864
+ return true;
5865
+ const fallbackText = text || presentation.content;
5866
+ if (!fallbackText || !this.options.sendFallback)
5867
+ return false;
5868
+ await this.options.sendFallback(presentation.context.target.chatId, fallbackText, presentation.context.sessionId);
5869
+ return true;
5870
+ });
5871
+ }
5872
+ presentInput(context) {
5873
+ const run = this.runs.get(context.runId);
5874
+ if (!run || run.terminal || run.ownerId !== context.owner.id || run.target.chatId !== context.target.chatId || run.target.isGroup !== context.target.isGroup) {
5875
+ return Promise.resolve({ kind: "unsupported" });
5876
+ }
5877
+ const questionCards = this.options.questionCards;
5878
+ if (!questionCards)
5879
+ return Promise.resolve({ kind: "unsupported" });
5880
+ return questionCards.present(context, this.cardTarget(context.target));
5881
+ }
5882
+ terminalizeRun(runId, terminal, detail = "") {
5883
+ const run = this.runs.get(runId);
5884
+ if (!run || run.terminal)
5885
+ return;
5886
+ this.options.questionCards?.cancelRun(runId, terminal === "cancelled" && (detail === "cancel_command" || detail === "clear") ? "cancelled" : "expired");
5887
+ run.terminal = true;
5888
+ const activeSegmentId = run.activeSegmentId;
5889
+ run.activeSegmentId = void 0;
5890
+ if (activeSegmentId) {
5891
+ this.segments.delete(activeSegmentId);
5892
+ this.addTerminalSegment(activeSegmentId);
5893
+ }
5894
+ const finalization = this.enqueue(run, async () => {
5895
+ if (terminal === "failed" && activeSegmentId) {
5896
+ this.options.statusCards?.fail(activeSegmentId, detail);
5897
+ } else if (terminal === "cancelled") {
5898
+ this.options.statusCards?.cancelRun(runId, detail === "cancel_command" ? "cancel_command" : "dropped");
5899
+ } else if (activeSegmentId) {
5900
+ await this.options.statusCards?.complete(activeSegmentId, detail);
5901
+ }
5902
+ });
5903
+ void finalization.then(() => {
5904
+ if (this.runs.get(runId) === run)
5905
+ this.runs.delete(runId);
5906
+ }, () => {
5907
+ if (this.runs.get(runId) === run)
5908
+ this.runs.delete(runId);
5909
+ });
5910
+ }
5911
+ reserveProjection(runId) {
5912
+ const run = this.runs.get(runId);
5913
+ if (!run || run.terminal)
5914
+ return void 0;
5915
+ let supplyOperation;
5916
+ const operation = new Promise((resolve) => {
5917
+ supplyOperation = resolve;
5918
+ });
5919
+ const result = this.enqueue(run, async () => {
5920
+ const execute = await operation;
5921
+ await execute();
5922
+ });
5923
+ let supplied = false;
5924
+ return (execute) => {
5925
+ if (!supplied) {
5926
+ supplied = true;
5927
+ supplyOperation(execute);
5928
+ }
5929
+ return result;
5930
+ };
5931
+ }
5932
+ enqueue(run, operation) {
5933
+ const result = run.projectionChain.then(operation);
5934
+ run.projectionChain = result.then(() => void 0, () => void 0);
5935
+ return result;
5936
+ }
5937
+ boundContent(content) {
5938
+ const limit = 2e4;
5939
+ const marker = "[Earlier output truncated]\n";
5940
+ if (content.length <= limit)
5941
+ return content;
5942
+ return `${marker}${content.slice(content.length - (limit - marker.length))}`;
5943
+ }
5944
+ cardTarget(target) {
5945
+ const isGroup = target.isGroup === true;
5946
+ return {
5947
+ chatId: isGroup ? target.chatId : target.senderId,
5948
+ isGroup
5949
+ };
5950
+ }
5951
+ addTerminalSegment(segmentId) {
5952
+ this.terminalSegmentIds.add(segmentId);
5953
+ while (this.terminalSegmentIds.size > 1e3) {
5954
+ const oldest = this.terminalSegmentIds.values().next().value;
5955
+ if (oldest === void 0)
5956
+ break;
5957
+ this.terminalSegmentIds.delete(oldest);
5958
+ }
5959
+ }
5960
+ };
5961
+
4961
5962
  // packages/channels/dingtalk/dist/DingtalkAdapter.js
4962
5963
  var DEDUP_TTL_MS = 5 * 60 * 1e3;
4963
5964
  var ACK_REACTION_NAME = "\u{1F440}";
@@ -5050,6 +6051,14 @@ var DingtalkChannel = class _DingtalkChannel extends ChannelBase {
5050
6051
  * on (re)connect, so a long-lived socket serves a stale one after ~2h.
5051
6052
  */
5052
6053
  proactiveToken;
6054
+ interactiveCardConfig;
6055
+ interactiveCardClient;
6056
+ statusCardController;
6057
+ questionCardController;
6058
+ interactionPresenter;
6059
+ inboundCardOwners = /* @__PURE__ */ new Map();
6060
+ cardRunBySession = /* @__PURE__ */ new Map();
6061
+ cardRuns = /* @__PURE__ */ new Map();
5053
6062
  constructor(name, config, bridge, options) {
5054
6063
  super(name, config, bridge, options);
5055
6064
  this.atSender = config["atSender"] === true;
@@ -5063,6 +6072,7 @@ var DingtalkChannel = class _DingtalkChannel extends ChannelBase {
5063
6072
  } else if (!this.config.instructions.includes("[IMAGE:")) {
5064
6073
  this.config.instructions += IMAGE_INSTRUCTIONS;
5065
6074
  }
6075
+ this.interactiveCardConfig = parseDingtalkInteractiveCardConfig(config.interactiveCards);
5066
6076
  if (!config.clientId || !config.clientSecret) {
5067
6077
  throw new Error(`Channel "${name}" requires clientId and clientSecret for DingTalk.`);
5068
6078
  }
@@ -5072,6 +6082,44 @@ var DingtalkChannel = class _DingtalkChannel extends ChannelBase {
5072
6082
  }
5073
6083
  const useConnectionManager = rawUseConnectionManager ?? true;
5074
6084
  this.client = this.createClient(useConnectionManager);
6085
+ if (this.interactiveCardConfig.enabled) {
6086
+ this.interactiveCardClient = new DingtalkInteractiveCardClient({
6087
+ robotCode: config.clientId,
6088
+ getAccessToken: /* @__PURE__ */ __name(() => this.getProactiveToken(), "getAccessToken")
6089
+ });
6090
+ if (this.interactiveCardConfig.statusCard.enabled && config.blockStreaming !== "on") {
6091
+ this.statusCardController = new StatusCardController({
6092
+ client: this.interactiveCardClient,
6093
+ cancelRun: /* @__PURE__ */ __name((sessionId, runId) => this.requestPromptRunCancellation(sessionId, runId), "cancelRun"),
6094
+ ...config.model ? { model: config.model } : {},
6095
+ onError: /* @__PURE__ */ __name((operation, error) => {
6096
+ process.stderr.write(`[DingTalk:${this.name}] ${operation} failed: ${sanitizeLogText(String(error), 300)}
6097
+ `);
6098
+ }, "onError")
6099
+ });
6100
+ }
6101
+ if (this.interactiveCardConfig.questionCard.enabled) {
6102
+ this.questionCardController = new QuestionCardController({
6103
+ client: this.interactiveCardClient,
6104
+ timeoutMs: this.interactiveCardConfig.questionCard.timeoutMs,
6105
+ sendFallback: /* @__PURE__ */ __name((chatId, text) => this.sendMessage(chatId, text), "sendFallback"),
6106
+ reserveRunProjection: /* @__PURE__ */ __name((runId) => this.interactionPresenter?.reserveProjection(runId), "reserveRunProjection"),
6107
+ onError: /* @__PURE__ */ __name((operation, error) => {
6108
+ process.stderr.write(`[DingTalk:${this.name}] ${operation} failed: ${sanitizeLogText(String(error), 300)}
6109
+ `);
6110
+ }, "onError")
6111
+ });
6112
+ }
6113
+ if (this.statusCardController || this.questionCardController) {
6114
+ this.interactionPresenter = new DingtalkInteractionPresenter({
6115
+ statusCards: this.statusCardController,
6116
+ questionCards: this.questionCardController,
6117
+ ...config.blockStreaming !== "on" ? {
6118
+ sendFallback: /* @__PURE__ */ __name((chatId, text, sessionId) => this.sendResponseMessage(chatId, text, sessionId), "sendFallback")
6119
+ } : {}
6120
+ });
6121
+ }
6122
+ }
5075
6123
  if (useConnectionManager) {
5076
6124
  this.connectionManager = new DingtalkConnectionManager({
5077
6125
  initialClient: this.client,
@@ -5113,6 +6161,47 @@ var DingtalkChannel = class _DingtalkChannel extends ChannelBase {
5113
6161
  });
5114
6162
  this.onMessage(msg);
5115
6163
  });
6164
+ if (this.interactiveCardConfig.enabled) {
6165
+ client.registerCallbackListener(TOPIC_CARD, (msg) => {
6166
+ this.onCardCallback(client, msg);
6167
+ });
6168
+ }
6169
+ }
6170
+ onCardCallback(client, msg) {
6171
+ const callback = parseDingtalkCardCallback(msg.data);
6172
+ const actorId = callback?.actorId ?? parseDingtalkCardActorId(msg.data);
6173
+ let result;
6174
+ try {
6175
+ result = callback ? this.routeCardCallback(callback) : { kind: "ignored", ...actorId ? { actorId } : {} };
6176
+ } catch (err) {
6177
+ process.stderr.write(`[DingTalk:${this.name}] card callback routing failed: ${sanitizeLogText(String(err), 200)}
6178
+ `);
6179
+ result = { kind: "ignored", ...actorId ? { actorId } : {} };
6180
+ }
6181
+ client.send(msg.headers.messageId, {
6182
+ status: EventAck.SUCCESS,
6183
+ message: "ok"
6184
+ });
6185
+ if (result.kind === "accepted") {
6186
+ void result.execute().catch((err) => {
6187
+ process.stderr.write(`[DingTalk:${this.name}] card callback action failed: ${sanitizeLogText(String(err), 200)}
6188
+ `);
6189
+ });
6190
+ } else if (result.kind === "forbidden") {
6191
+ void this.sendCardInteractionFeedback(result.actorId, result.target).catch((err) => {
6192
+ process.stderr.write(`[DingTalk:${this.name}] card interaction feedback failed: ${sanitizeLogText(String(err), 200)}
6193
+ `);
6194
+ });
6195
+ }
6196
+ }
6197
+ routeCardCallback(callback) {
6198
+ if (callback.actionId === "btn_stop") {
6199
+ return this.statusCardController?.claimStop(callback.outTrackId, callback.actorId) ?? { kind: "ignored", actorId: callback.actorId };
6200
+ }
6201
+ return this.questionCardController?.claim(callback) ?? {
6202
+ kind: "ignored",
6203
+ actorId: callback.actorId
6204
+ };
5116
6205
  }
5117
6206
  onDownStream(raw, client) {
5118
6207
  this.connectionManager?.noteActivity(client);
@@ -5384,6 +6473,22 @@ var DingtalkChannel = class _DingtalkChannel extends ChannelBase {
5384
6473
  };
5385
6474
  return data.access_token;
5386
6475
  }
6476
+ sendCardInteractionFeedback(actorId, target) {
6477
+ if (target?.isGroup) {
6478
+ return this.sendProactiveChunk({
6479
+ channelName: this.name,
6480
+ senderId: actorId,
6481
+ chatId: target.chatId,
6482
+ isGroup: true
6483
+ }, "\u5361\u7247\u64CD\u4F5C", "\u4EC5\u4EFB\u52A1\u53D1\u8D77\u4EBA\u53EF\u4EE5\u64CD\u4F5C\u8FD9\u5F20\u5361\u7247\uFF0C\u672C\u6B21\u64CD\u4F5C\u672A\u751F\u6548\u3002", "card interaction feedback");
6484
+ }
6485
+ return this.sendProactiveChunk({
6486
+ channelName: this.name,
6487
+ senderId: actorId,
6488
+ chatId: actorId,
6489
+ isGroup: false
6490
+ }, "\u5361\u7247\u64CD\u4F5C", "\u4F60\u65E0\u6743\u64CD\u4F5C\u8FD9\u5F20\u5361\u7247\uFF0C\u4EC5\u4EFB\u52A1\u53D1\u8D77\u4EBA\u53EF\u4EE5\u63D0\u4EA4\u6216\u505C\u6B62\u3002", "card interaction feedback");
6491
+ }
5387
6492
  async sendProactiveChunk(target, title, text, chunkLabel) {
5388
6493
  const targetKind = target.isGroup === true ? "group" : "dm";
5389
6494
  for (let attempt = 0; ; attempt++) {
@@ -5593,6 +6698,12 @@ var DingtalkChannel = class _DingtalkChannel extends ChannelBase {
5593
6698
  }
5594
6699
  this.sessionMentionTargets.delete(sessionId);
5595
6700
  this.textReplySessions.delete(sessionId);
6701
+ const cardRunId = this.cardRunBySession.get(sessionId);
6702
+ if (cardRunId) {
6703
+ this.cardRunBySession.delete(sessionId);
6704
+ this.interactionPresenter?.terminalizeRun(cardRunId, "cancelled");
6705
+ this.cardRuns.delete(cardRunId);
6706
+ }
5596
6707
  const keys = this.sessionReactionKeys.get(sessionId);
5597
6708
  if (keys) {
5598
6709
  this.sessionReactionKeys.delete(sessionId);
@@ -5609,12 +6720,33 @@ var DingtalkChannel = class _DingtalkChannel extends ChannelBase {
5609
6720
  onTaskLifecycle(event) {
5610
6721
  if (event.type === "started") {
5611
6722
  this.startReaction(event.chatId, event.messageId, event.sessionId);
6723
+ const inboundOwner = event.messageId ? this.inboundCardOwners.get(event.messageId) : void 0;
6724
+ if (event.messageId)
6725
+ this.inboundCardOwners.delete(event.messageId);
6726
+ if (event.runId && event.owner && inboundOwner?.ownerId === event.owner.id) {
6727
+ this.cardRuns.set(event.runId, inboundOwner);
6728
+ this.cardRunBySession.set(event.sessionId, event.runId);
6729
+ this.interactionPresenter?.registerRun(event.runId, event.owner.id, inboundOwner.target);
6730
+ }
5612
6731
  return;
5613
6732
  }
5614
6733
  if (isTerminalTaskLifecycleType(event.type)) {
5615
6734
  if (event.messageId)
5616
6735
  this.mentionTargets.delete(event.messageId);
5617
6736
  this.stopReaction(event.chatId, event.messageId, event.sessionId);
6737
+ if (event.runId) {
6738
+ if (event.type === "failed") {
6739
+ this.interactionPresenter?.terminalizeRun(event.runId, "failed", event.error);
6740
+ } else if (event.type === "cancelled") {
6741
+ this.interactionPresenter?.terminalizeRun(event.runId, "cancelled", event.reason);
6742
+ } else {
6743
+ this.interactionPresenter?.terminalizeRun(event.runId, "completed");
6744
+ }
6745
+ this.cardRuns.delete(event.runId);
6746
+ if (this.cardRunBySession.get(event.sessionId) === event.runId) {
6747
+ this.cardRunBySession.delete(event.sessionId);
6748
+ }
6749
+ }
5618
6750
  }
5619
6751
  }
5620
6752
  onPromptBufferDropped(_chatId, sessionId, messageIds) {
@@ -5661,6 +6793,21 @@ var DingtalkChannel = class _DingtalkChannel extends ChannelBase {
5661
6793
  if (!await this.preflightInbound(envelope))
5662
6794
  return;
5663
6795
  const messageId = envelope.messageId;
6796
+ if (messageId && envelope.senderId) {
6797
+ this.inboundCardOwners.delete(messageId);
6798
+ this.inboundCardOwners.set(messageId, {
6799
+ ownerId: envelope.senderId,
6800
+ target: {
6801
+ chatId: envelope.chatId,
6802
+ isGroup: envelope.isGroup
6803
+ }
6804
+ });
6805
+ if (this.inboundCardOwners.size > 1e3) {
6806
+ const oldest = this.inboundCardOwners.keys().next().value;
6807
+ if (oldest !== void 0)
6808
+ this.inboundCardOwners.delete(oldest);
6809
+ }
6810
+ }
5664
6811
  const atUserId = envelope[mentionTarget];
5665
6812
  if (this.atSender && messageId && atUserId) {
5666
6813
  this.mentionTargets.set(messageId, atUserId);
@@ -5704,6 +6851,34 @@ var DingtalkChannel = class _DingtalkChannel extends ChannelBase {
5704
6851
  }
5705
6852
  await this.sendReply(chatId, text);
5706
6853
  }
6854
+ async onResponseComplete(chatId, text, sessionId, segment) {
6855
+ if (segment && this.interactionPresenter) {
6856
+ const outgoingText = await this.prepareOutgoingText(text);
6857
+ if (await this.interactionPresenter.closeOutput(segment.segmentId, outgoingText, "completed", segment)) {
6858
+ return;
6859
+ }
6860
+ }
6861
+ await this.sendResponseMessage(chatId, text, sessionId);
6862
+ }
6863
+ onOutputSegmentEnd(_chatId, _sessionId, segment, reason) {
6864
+ if (!this.interactionPresenter)
6865
+ return;
6866
+ return this.interactionPresenter.closeOutput(segment.segmentId, "", reason, segment).then(() => void 0);
6867
+ }
6868
+ onResponseChunk(_chatId, chunk, _sessionId, segment) {
6869
+ if (segment)
6870
+ this.interactionPresenter?.appendOutput(segment, chunk);
6871
+ }
6872
+ async presentUserInputRequest(context) {
6873
+ const run = this.cardRuns.get(context.runId);
6874
+ if (!run || run.ownerId !== context.owner.id) {
6875
+ return { kind: "unsupported" };
6876
+ }
6877
+ if (!this.questionCardController || !this.interactionPresenter) {
6878
+ return { kind: "unsupported" };
6879
+ }
6880
+ return this.interactionPresenter.presentInput(context);
6881
+ }
5707
6882
  /**
5708
6883
  * Extract quoted/referenced message context from a reply.
5709
6884
  * DingTalk provides this via text.repliedMsg (newer) or quoteMessage (legacy).
@@ -5860,7 +7035,7 @@ var DingtalkChannel = class _DingtalkChannel extends ChannelBase {
5860
7035
  }
5861
7036
  ];
5862
7037
  } else {
5863
- const dir = join(tmpdir2(), "channel-files", randomUUID());
7038
+ const dir = join(tmpdir2(), "channel-files", randomUUID4());
5864
7039
  mkdirSync(dir, { recursive: true });
5865
7040
  const safeName = basename2(fileName || "") || `dingtalk_${mediaType}_${Date.now()}`;
5866
7041
  const filePath = join(dir, safeName);