@openclaw/discord 2026.8.1-beta.3 → 2026.8.1

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 (274) hide show
  1. package/dist/{account-inspect-D5xmUpnj.js → account-inspect-BDfKyuvL.js} +1 -1
  2. package/dist/account-inspect-api.js +1 -1
  3. package/dist/{accounts-DNl-oCEw.js → accounts-CfQ-vSyf.js} +5 -124
  4. package/dist/action-runtime-api.js +1 -1
  5. package/dist/{activities-api-KCBAmWxD.js → activities-api-Dl-TOyOX.js} +5 -4
  6. package/dist/activities-api.js +1 -1
  7. package/dist/api.js +16 -16
  8. package/dist/{approval-handler.runtime-B12RCYr8.js → approval-handler.runtime-q4Zqo44V.js} +28 -105
  9. package/dist/{audit-Yc7eZDd6.js → audit-DgrvFPGt.js} +5 -5
  10. package/dist/{channel-cXYzGc4L.js → channel-BsQUalPw.js} +18 -20
  11. package/dist/{channel-actions.runtime-CODTvo7c.js → channel-actions.runtime-UMGGIfSy.js} +59 -58
  12. package/dist/channel-config-api.js +1 -1
  13. package/dist/channel-plugin-api.js +1 -1
  14. package/dist/channel-type-CVLZyGYS.js +7 -0
  15. package/dist/{channel.setup-CSiwnMgs.js → channel.setup-rPs4dsk_.js} +5 -5
  16. package/dist/{components-ezGKo_Yh.js → components-Dk35LTf_.js} +33 -29
  17. package/dist/{config-schema-DC5kDtQ5.js → config-schema-CxPqtVI1.js} +16 -10
  18. package/dist/{conversation-binding-route-D6rCQ5S0.js → conversation-binding-route-BjvX4e35.js} +1 -1
  19. package/dist/{directory-config-XyCfoqLg.js → directory-config-B7DY_pNG.js} +2 -2
  20. package/dist/directory-contract-api.js +1 -1
  21. package/dist/{directory-live-Df0NbFJB.js → directory-live-DuAXKkan.js} +2 -2
  22. package/dist/doctor-contract-api.js +1 -1
  23. package/dist/{doctor-DYY31GrO.js → doctor-zQTtn6hm.js} +4 -4
  24. package/dist/{handle-action.guild-admin-6Tvvinsa.js → handle-action.guild-admin-DZewwLr1.js} +9 -5
  25. package/dist/index.js +1 -1
  26. package/dist/ingress-identity-CzZKcPK8.js +60 -0
  27. package/dist/{message-handler-B61q5MOF.js → message-handler-C5By3yl5.js} +5 -5
  28. package/dist/{message-handler.preflight-Bzg_Hawz.js → message-handler.preflight-DrszWuHw.js} +20 -84
  29. package/dist/{message-handler.process--4_712Ec.js → message-handler.process-DyFPDLCt.js} +60 -66
  30. package/dist/{message-utils-BXLLnFl6.js → message-text-Ca8M6TU8.js} +34 -32
  31. package/dist/{outbound-adapter-DxHTOqiN.js → outbound-adapter-Dif8p481.js} +58 -61
  32. package/dist/{outbound-components-B2PL0ooH.js → outbound-components-wjv7yyAj.js} +5 -4
  33. package/dist/outbound-session-route-Bn4uXaoE.js +665 -0
  34. package/dist/{owner-access-Bg41VzAf.js → owner-access-UlYi9t0M.js} +1 -1
  35. package/dist/{pluralkit-dUl4v1X3.js → pluralkit-9EuEN4UD.js} +1 -1
  36. package/dist/{probe-BTdtVRwU.js → probe-n6ZXxK8V.js} +1 -1
  37. package/dist/{probe.runtime-Dq5-PRKT.js → probe.runtime-CN4bdPfZ.js} +1 -1
  38. package/dist/{provider-DlK_ynqt.js → provider-LXiOcJrH.js} +443 -295
  39. package/dist/{provider-session.runtime-CvvphHvs.js → provider-session.runtime-DSNe7r2W.js} +3 -3
  40. package/dist/provider.runtime-DiInaDXO.js +2 -0
  41. package/dist/{realtime-session.runtime-ysbMG8v7.js → realtime-session.runtime-DOViOIjY.js} +106 -122
  42. package/dist/{resolve-allowlist-common-DIVXbD1P.js → resolve-allowlist-common-BLoYaxEG.js} +1 -1
  43. package/dist/{resolve-channels-CGeUoIqb.js → resolve-channels-D2yl_2CN.js} +4 -3
  44. package/dist/{resolve-users-BtKxLUZv.js → resolve-users-BLxfqajZ.js} +2 -2
  45. package/dist/{retry-DNsVTeTo.js → retry-DqHCW6PV.js} +220 -6
  46. package/dist/{runtime-D71_VFLr.js → runtime-BYamRVPN.js} +73 -56
  47. package/dist/{runtime-CQovMsH3.js → runtime-DrxVBTtp.js} +2 -2
  48. package/dist/runtime-api.js +16 -23
  49. package/dist/{sdk-runtime-37OU6_Yh.js → sdk-runtime-6tfgYDjY.js} +55 -86
  50. package/dist/{security-audit-BfJhAXZp.js → security-audit-DKfK-iPY.js} +10 -11
  51. package/dist/security-audit-contract-api.js +1 -1
  52. package/dist/{security-audit.runtime-BVKF9VtY.js → security-audit.runtime-sKZyKgpx.js} +1 -1
  53. package/dist/{send-rQIffSYu.js → send-UJHiAm4C.js} +78 -15
  54. package/dist/{send.components-ChK1wS7w.js → send.components-CrBJpGT_.js} +15 -22
  55. package/dist/{send.outbound-HIkgji_7.js → send.outbound-D7JYmfm9.js} +58 -69
  56. package/dist/{send.shared-B3fpaLWJ.js → send.shared-DZJ1akvQ.js} +36 -21
  57. package/dist/setup-plugin-api.js +1 -1
  58. package/dist/{shared-CaAaoksy.js → shared-Dii2HTn7.js} +31 -9
  59. package/dist/{subagent-hooks-CNT2ZJTJ.js → subagent-hooks-JyGrtQIl.js} +2 -2
  60. package/dist/subagent-hooks-api.js +1 -6
  61. package/dist/{system-events-Nuwoq_au.js → system-events-BEmcj4xJ.js} +1 -1
  62. package/dist/{target-resolver-DIXShHaZ.js → target-resolver-V-IYae6s.js} +3 -3
  63. package/dist/targets-CQp53cGj.js +3 -0
  64. package/dist/{thread-bindings-VlymUnbz.js → thread-bindings-DvYP79fy.js} +3 -4
  65. package/dist/{thread-bindings.manager-CngsgErq.js → thread-bindings.manager-Clm77DBM.js} +8 -12
  66. package/dist/{threading-DU6pgeGm.js → threading-CXuu_7o9.js} +47 -25
  67. package/dist/{transcripts-source-DeIMNbRh.js → transcripts-source-BLEMH_yi.js} +9 -4
  68. package/dist/transcripts-source-api.js +1 -1
  69. package/dist/{typing-oLiS5Z13.js → typing-B9snnwMe.js} +1 -1
  70. package/dist/{voice-runtime-CjNFaynA.js → voice-runtime-DY6_o73o.js} +76 -66
  71. package/node_modules/@discord/embedded-app-sdk/node_modules/uuid/README.md +19 -19
  72. package/node_modules/@discord/embedded-app-sdk/node_modules/uuid/dist/v1.js +7 -3
  73. package/node_modules/@discord/embedded-app-sdk/node_modules/uuid/dist/v7.js +5 -2
  74. package/node_modules/@discord/embedded-app-sdk/node_modules/uuid/dist-node/v1.js +7 -3
  75. package/node_modules/@discord/embedded-app-sdk/node_modules/uuid/dist-node/v7.js +5 -2
  76. package/node_modules/@discord/embedded-app-sdk/node_modules/uuid/package.json +4 -3
  77. package/node_modules/@discordjs/voice/node_modules/@types/node/README.md +1 -1
  78. package/node_modules/@discordjs/voice/node_modules/@types/node/child_process.d.ts +0 -1
  79. package/node_modules/@discordjs/voice/node_modules/@types/node/crypto.d.ts +6 -6
  80. package/node_modules/@discordjs/voice/node_modules/@types/node/dns/promises.d.ts +5 -5
  81. package/node_modules/@discordjs/voice/node_modules/@types/node/dns.d.ts +5 -5
  82. package/node_modules/@discordjs/voice/node_modules/@types/node/fs.d.ts +7 -0
  83. package/node_modules/@discordjs/voice/node_modules/@types/node/http.d.ts +30 -0
  84. package/node_modules/@discordjs/voice/node_modules/@types/node/http2.d.ts +4 -4
  85. package/node_modules/@discordjs/voice/node_modules/@types/node/os.d.ts +30 -30
  86. package/node_modules/@discordjs/voice/node_modules/@types/node/package.json +2 -2
  87. package/node_modules/@discordjs/voice/node_modules/@types/node/perf_hooks.d.ts +2 -1
  88. package/node_modules/@discordjs/voice/node_modules/@types/node/process.d.ts +42 -43
  89. package/node_modules/@discordjs/voice/node_modules/@types/node/quic.d.ts +1049 -84
  90. package/node_modules/@discordjs/voice/node_modules/@types/node/sqlite.d.ts +14 -1
  91. package/node_modules/@discordjs/voice/node_modules/@types/node/stream/iter.d.ts +3 -2
  92. package/node_modules/@discordjs/voice/node_modules/@types/node/test.d.ts +61 -0
  93. package/node_modules/@discordjs/voice/node_modules/@types/node/v8.d.ts +20 -23
  94. package/node_modules/discord-api-types/CHANGELOG.md +8 -0
  95. package/node_modules/discord-api-types/package.json +4 -4
  96. package/node_modules/discord-api-types/payloads/v10/channel.d.ts +2 -2
  97. package/node_modules/discord-api-types/payloads/v10/channel.d.ts.map +1 -1
  98. package/node_modules/discord-api-types/payloads/v10/gateway.d.ts +4 -0
  99. package/node_modules/discord-api-types/payloads/v10/gateway.d.ts.map +1 -1
  100. package/node_modules/discord-api-types/payloads/v10/gateway.js.map +1 -1
  101. package/node_modules/discord-api-types/payloads/v10/message.d.ts +4 -1
  102. package/node_modules/discord-api-types/payloads/v10/message.d.ts.map +1 -1
  103. package/node_modules/discord-api-types/payloads/v10/message.js +1 -0
  104. package/node_modules/discord-api-types/payloads/v10/message.js.map +1 -1
  105. package/node_modules/discord-api-types/payloads/v9/channel.d.ts +2 -2
  106. package/node_modules/discord-api-types/payloads/v9/channel.d.ts.map +1 -1
  107. package/node_modules/discord-api-types/payloads/v9/gateway.d.ts +4 -0
  108. package/node_modules/discord-api-types/payloads/v9/gateway.d.ts.map +1 -1
  109. package/node_modules/discord-api-types/payloads/v9/gateway.js.map +1 -1
  110. package/node_modules/discord-api-types/payloads/v9/message.d.ts +4 -1
  111. package/node_modules/discord-api-types/payloads/v9/message.d.ts.map +1 -1
  112. package/node_modules/discord-api-types/payloads/v9/message.js +1 -0
  113. package/node_modules/discord-api-types/payloads/v9/message.js.map +1 -1
  114. package/node_modules/typebox/build/format/date.d.mts +1 -1
  115. package/node_modules/typebox/build/format/date.mjs +1 -1
  116. package/node_modules/typebox/build/format/date_time.d.mts +2 -2
  117. package/node_modules/typebox/build/format/date_time.mjs +3 -3
  118. package/node_modules/typebox/build/format/email.d.mts +1 -1
  119. package/node_modules/typebox/build/format/email.mjs +2 -2
  120. package/node_modules/typebox/build/format/hostname.mjs +2 -10
  121. package/node_modules/typebox/build/format/idn_email.d.mts +1 -1
  122. package/node_modules/typebox/build/format/idn_email.mjs +3 -3
  123. package/node_modules/typebox/build/format/idn_hostname.d.mts +1 -0
  124. package/node_modules/typebox/build/format/idn_hostname.mjs +3 -11
  125. package/node_modules/typebox/build/format/idna/format/bidi.d.mts +3 -0
  126. package/node_modules/typebox/build/format/idna/format/bidi.mjs +98 -0
  127. package/node_modules/typebox/build/format/idna/format/puny.d.mts +3 -0
  128. package/node_modules/typebox/build/format/idna/format/puny.mjs +144 -0
  129. package/node_modules/typebox/build/format/idna/hostname.d.mts +1 -0
  130. package/node_modules/typebox/build/format/idna/hostname.mjs +16 -0
  131. package/node_modules/typebox/build/format/idna/idn-hostname.d.mts +1 -0
  132. package/node_modules/typebox/build/format/idna/idn-hostname.mjs +23 -0
  133. package/node_modules/typebox/build/format/idna/index.d.mts +2 -0
  134. package/node_modules/typebox/build/format/idna/index.mjs +2 -0
  135. package/node_modules/typebox/build/format/idna/label/ascii.d.mts +1 -0
  136. package/node_modules/typebox/build/format/idna/label/ascii.mjs +9 -0
  137. package/node_modules/typebox/build/format/idna/label/puny.d.mts +1 -0
  138. package/node_modules/typebox/build/format/idna/label/puny.mjs +28 -0
  139. package/node_modules/typebox/build/format/idna/label/unicode.d.mts +1 -0
  140. package/node_modules/typebox/build/format/idna/label/unicode.mjs +106 -0
  141. package/node_modules/typebox/build/format/idna/pattern/pattern.d.mts +30 -0
  142. package/node_modules/typebox/build/format/idna/pattern/pattern.mjs +70 -0
  143. package/node_modules/typebox/build/format/ipv4.d.mts +0 -1
  144. package/node_modules/typebox/build/format/ipv4.mjs +2 -32
  145. package/node_modules/typebox/build/format/ipv6.mjs +2 -61
  146. package/node_modules/typebox/build/format/iri.d.mts +2 -2
  147. package/node_modules/typebox/build/format/iri.mjs +26 -8
  148. package/node_modules/typebox/build/format/iri_reference.d.mts +2 -2
  149. package/node_modules/typebox/build/format/iri_reference.mjs +9 -55
  150. package/node_modules/typebox/build/format/regex.d.mts +1 -2
  151. package/node_modules/typebox/build/format/regex.mjs +2 -6
  152. package/node_modules/typebox/build/format/time.d.mts +2 -2
  153. package/node_modules/typebox/build/format/time.mjs +19 -14
  154. package/node_modules/typebox/build/format/uri.d.mts +1 -1
  155. package/node_modules/typebox/build/format/uri.mjs +3 -130
  156. package/node_modules/typebox/build/format/uri_reference.d.mts +1 -1
  157. package/node_modules/typebox/build/format/uri_reference.mjs +2 -3
  158. package/node_modules/typebox/build/format/uri_template.d.mts +2 -3
  159. package/node_modules/typebox/build/format/uri_template.mjs +4 -5
  160. package/node_modules/typebox/build/format/url.d.mts +3 -3
  161. package/node_modules/typebox/build/format/url.mjs +4 -5
  162. package/node_modules/typebox/build/guard/emit.d.mts +3 -1
  163. package/node_modules/typebox/build/guard/emit.mjs +12 -5
  164. package/node_modules/typebox/build/guard/guard.d.mts +8 -2
  165. package/node_modules/typebox/build/guard/guard.mjs +25 -4
  166. package/node_modules/typebox/build/guard/string.d.mts +2 -2
  167. package/node_modules/typebox/build/guard/string.mjs +7 -7
  168. package/node_modules/typebox/build/schema/engine/_context.mjs +3 -3
  169. package/node_modules/typebox/build/schema/engine/_functions.mjs +1 -2
  170. package/node_modules/typebox/build/schema/engine/_regexp.d.mts +2 -0
  171. package/node_modules/typebox/build/schema/engine/_regexp.mjs +4 -0
  172. package/node_modules/typebox/build/schema/engine/_stack.mjs +12 -13
  173. package/node_modules/typebox/build/schema/engine/additionalItems.mjs +17 -7
  174. package/node_modules/typebox/build/schema/engine/additionalProperties.mjs +4 -3
  175. package/node_modules/typebox/build/schema/engine/contains.mjs +18 -6
  176. package/node_modules/typebox/build/schema/engine/enum.mjs +1 -1
  177. package/node_modules/typebox/build/schema/engine/items.mjs +26 -6
  178. package/node_modules/typebox/build/schema/engine/maxContains.mjs +3 -3
  179. package/node_modules/typebox/build/schema/engine/minContains.mjs +14 -4
  180. package/node_modules/typebox/build/schema/engine/not.mjs +4 -2
  181. package/node_modules/typebox/build/schema/engine/oneOf.mjs +7 -6
  182. package/node_modules/typebox/build/schema/engine/pattern.mjs +3 -2
  183. package/node_modules/typebox/build/schema/engine/patternProperties.mjs +4 -3
  184. package/node_modules/typebox/build/schema/engine/ref.mjs +1 -7
  185. package/node_modules/typebox/build/schema/engine/schema.mjs +13 -4
  186. package/node_modules/typebox/build/schema/engine/type.mjs +1 -1
  187. package/node_modules/typebox/build/schema/resolve/resolve.d.mts +4 -1
  188. package/node_modules/typebox/build/schema/resolve/resolve.mjs +202 -1
  189. package/node_modules/typebox/build/schema/static/propertyNames.d.mts +5 -0
  190. package/node_modules/typebox/build/schema/static/propertyNames.mjs +3 -0
  191. package/node_modules/typebox/build/schema/static/schema.d.mts +3 -0
  192. package/node_modules/typebox/build/schema/types/index.d.mts +0 -2
  193. package/node_modules/typebox/build/schema/types/index.mjs +0 -2
  194. package/node_modules/typebox/build/system/memory/clone.mjs +14 -11
  195. package/node_modules/typebox/build/system/memory/discard.mjs +6 -5
  196. package/node_modules/typebox/build/system/settings/settings.d.mts +9 -0
  197. package/node_modules/typebox/build/system/settings/settings.mjs +2 -0
  198. package/node_modules/typebox/build/type/engine/call/distribute_arguments.d.mts +6 -1
  199. package/node_modules/typebox/build/type/engine/call/distribute_arguments.mjs +16 -3
  200. package/node_modules/typebox/build/type/engine/call/instantiate.mjs +34 -4
  201. package/node_modules/typebox/build/type/engine/evaluate/broaden.d.mts +5 -5
  202. package/node_modules/typebox/build/type/engine/evaluate/broaden.mjs +20 -26
  203. package/node_modules/typebox/build/type/engine/evaluate/compare.d.mts +6 -10
  204. package/node_modules/typebox/build/type/engine/evaluate/compare.mjs +9 -13
  205. package/node_modules/typebox/build/type/engine/evaluate/composite.d.mts +7 -4
  206. package/node_modules/typebox/build/type/engine/evaluate/composite.mjs +12 -19
  207. package/node_modules/typebox/build/type/engine/evaluate/distribute.d.mts +4 -20
  208. package/node_modules/typebox/build/type/engine/evaluate/distribute.mjs +8 -20
  209. package/node_modules/typebox/build/type/engine/evaluate/evaluate.d.mts +4 -4
  210. package/node_modules/typebox/build/type/engine/evaluate/evaluate.mjs +11 -8
  211. package/node_modules/typebox/build/type/engine/evaluate/flatten.d.mts +1 -1
  212. package/node_modules/typebox/build/type/engine/evaluate/flatten.mjs +3 -4
  213. package/node_modules/typebox/build/type/engine/evaluate/narrow.d.mts +17 -2
  214. package/node_modules/typebox/build/type/engine/evaluate/narrow.mjs +26 -6
  215. package/node_modules/typebox/build/type/engine/exclude/operation.mjs +3 -4
  216. package/node_modules/typebox/build/type/engine/extract/operation.d.mts +1 -1
  217. package/node_modules/typebox/build/type/engine/extract/operation.mjs +3 -4
  218. package/node_modules/typebox/build/type/engine/priority/priority.d.mts +2 -2
  219. package/node_modules/typebox/build/type/engine/priority/priority.mjs +3 -4
  220. package/node_modules/typebox/build/type/script/mapping.d.mts +32 -29
  221. package/node_modules/typebox/build/type/script/mapping.mjs +18 -25
  222. package/node_modules/typebox/build/type/script/parser.d.mts +19 -25
  223. package/node_modules/typebox/build/type/script/parser.mjs +27 -23
  224. package/node_modules/typebox/build/value/errors/errors.d.mts +2 -2
  225. package/node_modules/typebox/build/value/errors/errors.mjs +1 -1
  226. package/node_modules/typebox/package.json +27 -27
  227. package/node_modules/typebox/readme.md +79 -82
  228. package/node_modules/undici/docs/docs/api/Client.md +21 -8
  229. package/node_modules/undici/lib/api/readable.js +33 -43
  230. package/node_modules/undici/lib/core/connect.js +16 -2
  231. package/node_modules/undici/lib/core/symbols.js +1 -0
  232. package/node_modules/undici/lib/dispatcher/client-h1.js +3 -3
  233. package/node_modules/undici/lib/dispatcher/client-h2.js +179 -10
  234. package/node_modules/undici/lib/dispatcher/client.js +74 -29
  235. package/node_modules/undici/lib/dispatcher/env-http-proxy-agent.js +28 -6
  236. package/node_modules/undici/lib/dispatcher/socks5-proxy-agent.js +15 -1
  237. package/node_modules/undici/lib/handler/retry-handler.js +7 -2
  238. package/node_modules/undici/lib/interceptor/cache.js +5 -2
  239. package/node_modules/undici/lib/interceptor/deduplicate.js +1 -1
  240. package/node_modules/undici/lib/mock/mock-utils.js +213 -24
  241. package/node_modules/undici/lib/util/cache.js +2 -4
  242. package/node_modules/undici/lib/web/websocket/websocket.js +22 -0
  243. package/node_modules/undici/package.json +1 -1
  244. package/node_modules/undici/types/client.d.ts +40 -0
  245. package/node_modules/ws/lib/permessage-deflate.js +3 -1
  246. package/node_modules/ws/package.json +1 -1
  247. package/openclaw.plugin.json +12 -4
  248. package/package.json +8 -8
  249. package/skills/discord/SKILL.md +1 -1
  250. package/dist/approval-message-safety-XGFPbDoI.js +0 -226
  251. package/dist/audit-core-BCX8UeFH.js +0 -105
  252. package/dist/channel-actions-Dr2QI8Bf.js +0 -212
  253. package/dist/inbound-event-delivery-De2qxTrP.js +0 -39
  254. package/dist/provider.runtime-CzKGRiAF.js +0 -2
  255. package/dist/runtime-api.actions.js +0 -3
  256. package/dist/runtime-api.lookup.js +0 -7
  257. package/dist/runtime-api.monitor-CzeTYF32.js +0 -6
  258. package/dist/runtime-api.monitor.js +0 -9
  259. package/dist/runtime-api.send.js +0 -7
  260. package/dist/runtime-api.threads.js +0 -5
  261. package/dist/send.reactions-gmJ6yFPo.js +0 -78
  262. package/dist/send.receipt-Cnhoautb.js +0 -76
  263. package/dist/subagent-progress-FPLqBY1s.js +0 -110
  264. package/dist/targets-B2pf49zc.js +0 -3
  265. package/node_modules/typebox/build/format/_idna.d.mts +0 -2
  266. package/node_modules/typebox/build/format/_idna.mjs +0 -246
  267. package/node_modules/typebox/build/format/_puny.d.mts +0 -1
  268. package/node_modules/typebox/build/format/_puny.mjs +0 -77
  269. package/node_modules/typebox/build/schema/resolve/ref.d.mts +0 -3
  270. package/node_modules/typebox/build/schema/resolve/ref.mjs +0 -146
  271. package/node_modules/typebox/build/schema/types/contentEncoding.d.mts +0 -9
  272. package/node_modules/typebox/build/schema/types/contentEncoding.mjs +0 -13
  273. package/node_modules/typebox/build/schema/types/contentMediaType.d.mts +0 -9
  274. package/node_modules/typebox/build/schema/types/contentMediaType.mjs +0 -13
@@ -1,30 +1,23 @@
1
- import { O as resolveDiscordOutboundSessionRoute } from "./accounts-DNl-oCEw.js";
2
- import { n as registerBuiltDiscordComponentMessage, r as sendDiscordComponentMessage, t as editDiscordComponentMessage } from "./send.components-ChK1wS7w.js";
1
+ import { n as registerBuiltDiscordComponentMessage, r as sendDiscordComponentMessage, t as editDiscordComponentMessage } from "./send.components-CrBJpGT_.js";
3
2
  import { r as setDiscordRuntime } from "./runtime-DgnVQ7zW.js";
4
- import { n as listDiscordDirectoryGroupsLive, r as listDiscordDirectoryPeersLive } from "./directory-live-Df0NbFJB.js";
3
+ import { n as listDiscordDirectoryGroupsLive, r as listDiscordDirectoryPeersLive } from "./directory-live-DuAXKkan.js";
5
4
  import { _ as resolveDiscordShouldRequireMention, a as normalizeDiscordSlug, c as resolveDiscordChannelConfigWithFallback, f as resolveDiscordGuildEntry, n as isDiscordGroupAllowedByPolicy, r as normalizeDiscordAllowList, s as resolveDiscordChannelConfig, t as allowListMatches, u as resolveDiscordCommandAuthorized, v as resolveGroupDmAllow, y as shouldEmitDiscordReactionNotification } from "./allow-list-BDMimASD.js";
6
- import { C as hasAllGuildPermissionsDiscord, G as registerGateway, K as unregisterGateway, S as fetchMemberGuildPermissionsDiscord, T as hasAnyGuildPermissionDiscord, U as clearGateways, W as getGateway, _ as DiscordSendError, x as fetchChannelPermissionsDiscord } from "./send.shared-B3fpaLWJ.js";
7
- import { n as sendPollDiscord, r as sendStickerDiscord, t as sendMessageDiscord } from "./send.outbound-HIkgji_7.js";
5
+ import { C as hasAllGuildPermissionsDiscord, G as unregisterGateway, H as clearGateways, S as fetchMemberGuildPermissionsDiscord, T as hasAnyGuildPermissionDiscord, U as getGateway, W as registerGateway, _ as DiscordSendError, x as fetchChannelPermissionsDiscord } from "./send.shared-DZJ1akvQ.js";
6
+ import { n as sendPollDiscord, r as sendStickerDiscord, t as sendMessageDiscord } from "./send.outbound-D7JYmfm9.js";
8
7
  import { i as setPresence, n as getPresence, r as presenceCacheSize, t as clearPresences } from "./presence-cache-z1N8MbJ3.js";
9
- import { A as listGuildEmojisDiscord, C as fetchVoiceStatusDiscord, D as removeRoleDiscord, E as listScheduledEventsDiscord, F as editChannelDiscord, I as moveChannelDiscord, L as removeChannelPermissionDiscord, M as uploadStickerDiscord, N as createChannelDiscord, O as resolveEventCoverImage, P as deleteChannelDiscord, R as setChannelPermissionDiscord, S as fetchRoleInfoDiscord, T as listGuildChannelsDiscord, _ as banMemberDiscord, c as editMessageDiscord, d as listThreadsDiscord, f as pinMessageDiscord, g as addRoleDiscord, h as unpinMessageDiscord, i as sendWebhookMessageDiscord, j as uploadEmojiDiscord, k as timeoutMemberDiscord, l as fetchMessageDiscord, m as searchMessagesDiscord, n as sendTypingDiscord, o as createThreadDiscord, p as readMessagesDiscord, r as sendVoiceMessageDiscord, s as deleteMessageDiscord, u as listPinsDiscord, v as createScheduledEventDiscord, w as kickMemberDiscord, x as fetchMemberInfoDiscord, y as fetchChannelInfoDiscord } from "./send-rQIffSYu.js";
8
+ import { A as listScheduledEventsDiscord, B as moveChannelDiscord, C as fetchChannelInfoDiscord, D as fetchVoiceStatusDiscord, E as fetchRoleInfoDiscord, F as uploadEmojiDiscord, H as setChannelPermissionDiscord, I as uploadStickerDiscord, L as createChannelDiscord, M as resolveEventCoverImage, N as timeoutMemberDiscord, O as kickMemberDiscord, P as listGuildEmojisDiscord, R as deleteChannelDiscord, S as createScheduledEventDiscord, T as fetchMemberInfoDiscord, V as removeChannelPermissionDiscord, _ as readMessagesDiscord, a as removeReactionDiscord, b as addRoleDiscord, c as sendWebhookMessageDiscord, d as deleteMessageDiscord, f as editMessageDiscord, g as pinMessageDiscord, h as listThreadsDiscord, i as removeOwnReactionsDiscord, j as removeRoleDiscord, k as listGuildChannelsDiscord, m as listPinsDiscord, n as fetchReactionsDiscord, o as sendTypingDiscord, p as fetchMessageDiscord, r as reactMessageDiscord, s as sendVoiceMessageDiscord, u as createThreadDiscord, v as searchMessagesDiscord, x as banMemberDiscord, y as unpinMessageDiscord, z as editChannelDiscord } from "./send-UJHiAm4C.js";
10
9
  import { a as isAbortError, i as DISCORD_DEFAULT_LISTENER_TIMEOUT_MS, l as runDiscordTaskWithTimeout, n as DISCORD_ATTACHMENT_TOTAL_TIMEOUT_MS, o as normalizeDiscordInboundWorkerTimeoutMs, r as DISCORD_DEFAULT_INBOUND_WORKER_TIMEOUT_MS, s as normalizeDiscordListenerTimeoutMs, t as DISCORD_ATTACHMENT_IDLE_TIMEOUT_MS } from "./timeouts-B9cy6RvQ.js";
11
- import { i as removeReactionDiscord, n as reactMessageDiscord, r as removeOwnReactionsDiscord, t as fetchReactionsDiscord } from "./send.reactions-gmJ6yFPo.js";
12
- import { c as readDiscordChannelMoveParams, i as requiredGuildPermissionForModerationAction, l as readDiscordParentIdParam, n as isDiscordModerationAction, o as readDiscordChannelCreateParams, r as readDiscordModerationCommand, s as readDiscordChannelEditParams, t as handleDiscordAction } from "./runtime-D71_VFLr.js";
13
- import { t as discordMessageActions } from "./channel-actions-Dr2QI8Bf.js";
10
+ import { c as readDiscordChannelMoveParams, i as requiredGuildPermissionForModerationAction, l as readDiscordParentIdParam, n as isDiscordModerationAction, o as readDiscordChannelCreateParams, r as readDiscordModerationCommand, s as readDiscordChannelEditParams, t as handleDiscordAction } from "./runtime-BYamRVPN.js";
11
+ import { p as discordMessageActions, t as resolveDiscordOutboundSessionRoute } from "./outbound-session-route-Bn4uXaoE.js";
14
12
  import { C as resolveThreadBindingMaxAgeExpiresAt, S as resolveThreadBindingInactivityExpiresAt, w as resolveThreadBindingMaxAgeMs, x as resolveThreadBindingIdleTimeoutMs } from "./thread-bindings.state-D8OMdk4O.js";
15
13
  import { n as setThreadBindingMaxAgeBySessionKey, t as setThreadBindingIdleTimeoutBySessionKey } from "./thread-bindings.session-updates-CJb-BpPL.js";
16
- import { t as resolveDiscordChannelAllowlist } from "./resolve-channels-CGeUoIqb.js";
17
- import { t as resolveDiscordUserAllowlist } from "./resolve-users-BtKxLUZv.js";
18
- import { _ as resolveThreadBindingThreadName, g as resolveThreadBindingIntroText, h as formatThreadBindingDurationLabel, m as resolveThreadBindingPersonaFromRecord, n as createThreadBindingManager, p as resolveThreadBindingPersona, r as getThreadBindingManager, t as createNoopThreadBindingManager } from "./thread-bindings.manager-CngsgErq.js";
19
- import { a as reconcileAcpThreadBindingsOnStartup, c as resolveDiscordThreadBindingMaxAgeMs, i as listThreadBindingsForAccount, l as resolveThreadBindingsEnabled, n as autoBindSpawnedDiscordSubagent, o as unbindThreadBindingsBySessionKey, r as listThreadBindingsBySessionKey, s as resolveDiscordThreadBindingIdleTimeoutMs } from "./thread-bindings-VlymUnbz.js";
20
- import { i as probeDiscord, n as fetchDiscordApplicationSummary, o as resolveDiscordPrivilegedIntentsFromFlags, r as parseApplicationIdFromToken, t as fetchDiscordApplicationId } from "./probe-BTdtVRwU.js";
21
- import "./runtime-api.actions.js";
22
- import { r as collectDiscordAuditChannelIds, t as auditDiscordChannelPermissions } from "./audit-Yc7eZDd6.js";
23
- import "./runtime-api.lookup.js";
24
- import { d as waitForDiscordGatewayPluginRegistration, f as createDiscordNativeCommand, l as createDiscordGatewayPlugin, t as monitorDiscordProvider, u as resolveDiscordGatewayIntents, v as registerDiscordListener } from "./provider-DlK_ynqt.js";
25
- import { o as sanitizeDiscordThreadName, r as resolveDiscordReplyTarget } from "./threading-DU6pgeGm.js";
26
- import { t as createDiscordMessageHandler } from "./message-handler-B61q5MOF.js";
27
- import "./runtime-api.monitor-CzeTYF32.js";
28
- import "./runtime-api.send.js";
29
- import "./runtime-api.threads.js";
14
+ import { t as resolveDiscordChannelAllowlist } from "./resolve-channels-D2yl_2CN.js";
15
+ import { t as resolveDiscordUserAllowlist } from "./resolve-users-BLxfqajZ.js";
16
+ import { _ as resolveThreadBindingThreadName, g as resolveThreadBindingIntroText, h as formatThreadBindingDurationLabel, m as resolveThreadBindingPersonaFromRecord, n as createThreadBindingManager, p as resolveThreadBindingPersona, r as getThreadBindingManager, t as createNoopThreadBindingManager } from "./thread-bindings.manager-Clm77DBM.js";
17
+ import { a as reconcileAcpThreadBindingsOnStartup, c as resolveDiscordThreadBindingMaxAgeMs, i as listThreadBindingsForAccount, l as resolveThreadBindingsEnabled, n as autoBindSpawnedDiscordSubagent, o as unbindThreadBindingsBySessionKey, r as listThreadBindingsBySessionKey, s as resolveDiscordThreadBindingIdleTimeoutMs } from "./thread-bindings-DvYP79fy.js";
18
+ import { i as probeDiscord, n as fetchDiscordApplicationSummary, o as resolveDiscordPrivilegedIntentsFromFlags, r as parseApplicationIdFromToken, t as fetchDiscordApplicationId } from "./probe-n6ZXxK8V.js";
19
+ import { r as collectDiscordAuditChannelIds, t as auditDiscordChannelPermissions } from "./audit-DgrvFPGt.js";
20
+ import { d as resolveDiscordGatewayIntents, f as waitForDiscordGatewayPluginRegistration, p as createDiscordNativeCommand, t as monitorDiscordProvider, u as createDiscordGatewayPlugin, y as registerDiscordListener } from "./provider-LXiOcJrH.js";
21
+ import { o as sanitizeDiscordThreadName, r as resolveDiscordReplyTarget } from "./threading-CXuu_7o9.js";
22
+ import { t as createDiscordMessageHandler } from "./message-handler-C5By3yl5.js";
30
23
  export { DISCORD_ATTACHMENT_IDLE_TIMEOUT_MS, DISCORD_ATTACHMENT_TOTAL_TIMEOUT_MS, DISCORD_DEFAULT_INBOUND_WORKER_TIMEOUT_MS, DISCORD_DEFAULT_LISTENER_TIMEOUT_MS, DiscordSendError, addRoleDiscord, allowListMatches, auditDiscordChannelPermissions, autoBindSpawnedDiscordSubagent, banMemberDiscord, clearGateways, clearPresences, collectDiscordAuditChannelIds, createChannelDiscord, createDiscordGatewayPlugin, createDiscordMessageHandler, createDiscordNativeCommand, createNoopThreadBindingManager, createScheduledEventDiscord, createThreadBindingManager, createThreadDiscord, deleteChannelDiscord, deleteMessageDiscord, discordMessageActions, editChannelDiscord, editDiscordComponentMessage, editMessageDiscord, fetchChannelInfoDiscord, fetchChannelPermissionsDiscord, fetchDiscordApplicationId, fetchDiscordApplicationSummary, fetchMemberGuildPermissionsDiscord, fetchMemberInfoDiscord, fetchMessageDiscord, fetchReactionsDiscord, fetchRoleInfoDiscord, fetchVoiceStatusDiscord, formatThreadBindingDurationLabel, getGateway, getPresence, getThreadBindingManager, handleDiscordAction, hasAllGuildPermissionsDiscord, hasAnyGuildPermissionDiscord, isAbortError, isDiscordGroupAllowedByPolicy, isDiscordModerationAction, kickMemberDiscord, listDiscordDirectoryGroupsLive, listDiscordDirectoryPeersLive, listGuildChannelsDiscord, listGuildEmojisDiscord, listPinsDiscord, listScheduledEventsDiscord, listThreadBindingsBySessionKey, listThreadBindingsForAccount, listThreadsDiscord, monitorDiscordProvider, moveChannelDiscord, normalizeDiscordAllowList, normalizeDiscordInboundWorkerTimeoutMs, normalizeDiscordListenerTimeoutMs, normalizeDiscordSlug, parseApplicationIdFromToken, pinMessageDiscord, presenceCacheSize, probeDiscord, reactMessageDiscord, readDiscordChannelCreateParams, readDiscordChannelEditParams, readDiscordChannelMoveParams, readDiscordModerationCommand, readDiscordParentIdParam, readMessagesDiscord, reconcileAcpThreadBindingsOnStartup, registerBuiltDiscordComponentMessage, registerDiscordListener, registerGateway, removeChannelPermissionDiscord, removeOwnReactionsDiscord, removeReactionDiscord, removeRoleDiscord, requiredGuildPermissionForModerationAction, resolveDiscordChannelAllowlist, resolveDiscordChannelConfig, resolveDiscordChannelConfigWithFallback, resolveDiscordCommandAuthorized, resolveDiscordGatewayIntents, resolveDiscordGuildEntry, resolveDiscordOutboundSessionRoute, resolveDiscordPrivilegedIntentsFromFlags, resolveDiscordReplyTarget, resolveDiscordShouldRequireMention, resolveDiscordThreadBindingIdleTimeoutMs, resolveDiscordThreadBindingMaxAgeMs, resolveDiscordUserAllowlist, resolveEventCoverImage, resolveGroupDmAllow, resolveThreadBindingIdleTimeoutMs, resolveThreadBindingInactivityExpiresAt, resolveThreadBindingIntroText, resolveThreadBindingMaxAgeExpiresAt, resolveThreadBindingMaxAgeMs, resolveThreadBindingPersona, resolveThreadBindingPersonaFromRecord, resolveThreadBindingThreadName, resolveThreadBindingsEnabled, runDiscordTaskWithTimeout, sanitizeDiscordThreadName, searchMessagesDiscord, sendDiscordComponentMessage, sendMessageDiscord, sendPollDiscord, sendStickerDiscord, sendTypingDiscord, sendVoiceMessageDiscord, sendWebhookMessageDiscord, setChannelPermissionDiscord, setDiscordRuntime, setPresence, setThreadBindingIdleTimeoutBySessionKey, setThreadBindingMaxAgeBySessionKey, shouldEmitDiscordReactionNotification, timeoutMemberDiscord, unbindThreadBindingsBySessionKey, unpinMessageDiscord, unregisterGateway, uploadEmojiDiscord, uploadStickerDiscord, waitForDiscordGatewayPluginRegistration };
@@ -1,4 +1,4 @@
1
- import { p as discord_exports } from "./retry-DNsVTeTo.js";
1
+ import { y as discord_exports } from "./retry-DqHCW6PV.js";
2
2
  import { createRequire } from "node:module";
3
3
  import fs from "node:fs/promises";
4
4
  import { formatErrorMessage } from "openclaw/plugin-sdk/ssrf-runtime";
@@ -99,29 +99,6 @@ function buildWavBuffer(pcm) {
99
99
  header.writeUInt32LE(pcm.length, 40);
100
100
  return Buffer.concat([header, pcm]);
101
101
  }
102
- async function createOpusDecoder(params) {
103
- let decoder;
104
- try {
105
- decoder = await createDecoder({
106
- channels: CHANNELS,
107
- sampleRate: SAMPLE_RATE
108
- });
109
- } catch (err) {
110
- const failure = formatErrorMessage(err);
111
- if (!warnedOpusMissing) {
112
- warnedOpusMissing = true;
113
- params.onWarn(`discord voice: no usable opus decoder available (libopus-wasm: ${failure}); cannot decode voice audio`);
114
- }
115
- return null;
116
- }
117
- return {
118
- name: "libopus-wasm",
119
- decoder: {
120
- decode: (buffer) => pcmInt16ToBuffer(decoder.decode(buffer, { maxFrameSize: DISCORD_OPUS_FRAME_SIZE })),
121
- free: () => decoder.free()
122
- }
123
- };
124
- }
125
102
  function createDiscordOpusEncodeStream() {
126
103
  return new DiscordOpusEncodeStream();
127
104
  }
@@ -185,99 +162,92 @@ function createDiscordOpusPlaybackStream(input) {
185
162
  }
186
163
  var DiscordOpusEncodeStream = class extends Transform {
187
164
  #buffer = Buffer.alloc(0);
188
- #encoder = null;
189
- #encoderPromise = null;
165
+ #encoder;
190
166
  constructor() {
191
167
  super({ readableObjectMode: true });
192
168
  }
193
- async #getEncoder() {
194
- if (!this.#encoderPromise) this.#encoderPromise = createEncoder({
169
+ _construct(done) {
170
+ createEncoder({
195
171
  application: Application.Audio,
196
172
  channels: CHANNELS,
197
173
  sampleRate: SAMPLE_RATE
198
- });
199
- if (!this.#encoder) this.#encoder = await this.#encoderPromise;
200
- return this.#encoder;
174
+ }).then((encoder) => {
175
+ this.#encoder = encoder;
176
+ done();
177
+ }, (err) => done(err instanceof Error ? err : new Error(formatErrorMessage(err))));
201
178
  }
202
179
  _transform(chunk, _encoding, done) {
203
- (async () => {
204
- try {
205
- const encoder = await this.#getEncoder();
206
- this.#buffer = this.#buffer.length > 0 ? Buffer.concat([this.#buffer, chunk]) : Buffer.from(chunk);
207
- while (this.#buffer.length >= DISCORD_OPUS_FRAME_BYTES) {
208
- const frame = this.#buffer.subarray(0, DISCORD_OPUS_FRAME_BYTES);
209
- this.#buffer = this.#buffer.subarray(DISCORD_OPUS_FRAME_BYTES);
210
- this.push(Buffer.from(encoder.encode(frame, { frameSize: DISCORD_OPUS_FRAME_SIZE })));
211
- }
212
- done();
213
- } catch (err) {
214
- done(err instanceof Error ? err : new Error(formatErrorMessage(err)));
180
+ try {
181
+ this.#buffer = this.#buffer.length > 0 ? Buffer.concat([this.#buffer, chunk]) : Buffer.from(chunk);
182
+ while (this.#buffer.length >= DISCORD_OPUS_FRAME_BYTES) {
183
+ const frame = this.#buffer.subarray(0, DISCORD_OPUS_FRAME_BYTES);
184
+ this.#buffer = this.#buffer.subarray(DISCORD_OPUS_FRAME_BYTES);
185
+ this.#encodeFrame(frame);
215
186
  }
216
- })();
187
+ done();
188
+ } catch (err) {
189
+ done(err instanceof Error ? err : new Error(formatErrorMessage(err)));
190
+ }
217
191
  }
218
- _final(done) {
219
- (async () => {
220
- try {
221
- if (this.#buffer.length > 0) {
222
- const encoder = await this.#getEncoder();
223
- const frame = Buffer.alloc(DISCORD_OPUS_FRAME_BYTES);
224
- this.#buffer.copy(frame);
225
- this.#buffer = Buffer.alloc(0);
226
- this.push(Buffer.from(encoder.encode(frame, { frameSize: DISCORD_OPUS_FRAME_SIZE })));
227
- }
228
- this.#freeEncoder();
229
- done();
230
- } catch (err) {
231
- done(err instanceof Error ? err : new Error(formatErrorMessage(err)));
192
+ _flush(done) {
193
+ try {
194
+ if (this.#buffer.length > 0) {
195
+ const frame = Buffer.alloc(DISCORD_OPUS_FRAME_BYTES);
196
+ this.#buffer.copy(frame);
197
+ this.#buffer = Buffer.alloc(0);
198
+ this.#encodeFrame(frame);
232
199
  }
233
- })();
200
+ done();
201
+ } catch (err) {
202
+ done(err instanceof Error ? err : new Error(formatErrorMessage(err)));
203
+ }
234
204
  }
235
205
  _destroy(err, done) {
236
- this.#freeEncoder();
206
+ this.#encoder?.free();
207
+ this.#buffer = Buffer.alloc(0);
237
208
  done(err);
238
209
  }
239
- #freeEncoder() {
240
- this.#encoder?.free();
241
- this.#encoder = null;
210
+ #encodeFrame(frame) {
211
+ this.push(Buffer.from(this.#encoder.encode(frame, { frameSize: DISCORD_OPUS_FRAME_SIZE })));
242
212
  }
243
213
  };
244
214
  function pcmInt16ToBuffer(pcm) {
245
215
  return Buffer.from(pcm.buffer, pcm.byteOffset, pcm.byteLength);
246
216
  }
247
217
  async function decodeOpusStream(stream, params) {
248
- const selected = await createOpusDecoder({ onWarn: params.onWarn });
249
- if (!selected) return Buffer.alloc(0);
250
- params.onVerbose(`opus decoder: ${selected.name}`);
251
218
  const chunks = [];
219
+ await decodeOpusStreamChunks(stream, {
220
+ ...params,
221
+ onChunk: (chunk) => chunks.push(chunk)
222
+ });
223
+ return Buffer.concat(chunks);
224
+ }
225
+ async function decodeOpusStreamChunks(stream, params) {
226
+ let decoder;
252
227
  try {
253
- for await (const chunk of stream) {
254
- if (!chunk || !(chunk instanceof Buffer) || chunk.length === 0) continue;
255
- const decoded = await selected.decoder.decode(chunk);
256
- if (decoded && decoded.length > 0) chunks.push(Buffer.from(decoded));
257
- }
228
+ decoder = await createDecoder({
229
+ channels: CHANNELS,
230
+ sampleRate: SAMPLE_RATE
231
+ });
258
232
  } catch (err) {
259
- params.onError?.(err);
260
- if (shouldLogVerbose()) logVerbose(`discord voice: opus decode failed: ${formatErrorMessage(err)}`);
261
- } finally {
262
- await selected.decoder.free?.();
233
+ if (!warnedOpusMissing) {
234
+ warnedOpusMissing = true;
235
+ params.onWarn(`discord voice: no usable opus decoder available (libopus-wasm: ${formatErrorMessage(err)}); cannot decode voice audio`);
236
+ }
237
+ return;
263
238
  }
264
- return chunks.length > 0 ? Buffer.concat(chunks) : Buffer.alloc(0);
265
- }
266
- async function decodeOpusStreamChunks(stream, params) {
267
- const selected = await createOpusDecoder({ onWarn: params.onWarn });
268
- if (!selected) return;
269
- params.onVerbose(`opus decoder: ${selected.name}`);
239
+ params.onVerbose("opus decoder: libopus-wasm");
270
240
  try {
271
241
  for await (const chunk of stream) {
272
242
  if (!chunk || !(chunk instanceof Buffer) || chunk.length === 0) continue;
273
- const decoded = await selected.decoder.decode(chunk);
274
- if (decoded && decoded.length > 0) params.onChunk(Buffer.from(decoded));
243
+ const decoded = decoder.decode(chunk, { maxFrameSize: DISCORD_OPUS_FRAME_SIZE });
244
+ if (decoded.length > 0) params.onChunk(pcmInt16ToBuffer(decoded));
275
245
  }
276
246
  } catch (err) {
277
247
  params.onError?.(err);
278
248
  if (shouldLogVerbose()) logVerbose(`discord voice: opus decode failed: ${formatErrorMessage(err)}`);
279
249
  } finally {
280
- await selected.decoder.free?.();
250
+ decoder.free();
281
251
  }
282
252
  }
283
253
  function convertDiscordPcm48kStereoToRealtimePcm24kMono(pcm) {
@@ -338,7 +308,6 @@ const CAPTURE_FINALIZE_GRACE_MS = 2e3;
338
308
  const VOICE_CONNECT_READY_TIMEOUT_MS = 3e4;
339
309
  const VOICE_RECONNECT_GRACE_MS = 15e3;
340
310
  const PLAYBACK_READY_TIMEOUT_MS = 6e4;
341
- const SPEAKING_READY_TIMEOUT_MS = 6e4;
342
311
  function resolveVoiceTimeoutMs(value, fallbackMs) {
343
312
  if (typeof value !== "number" || !Number.isFinite(value) || value <= 0) return fallbackMs;
344
313
  return Math.floor(value);
@@ -366,4 +335,4 @@ function loadDiscordVoiceSdk() {
366
335
  return cachedDiscordVoiceSdk;
367
336
  }
368
337
  //#endregion
369
- export { formatVoiceLogPreview as S, decodeOpusStream as _, SPEAKING_READY_TIMEOUT_MS as a, formatVoiceIngressPrompt as b, isDiscordRealtimeVoiceMode as c, resolveDiscordVoiceMode as d, resolveVoiceTimeoutMs as f, createDiscordOpusPlaybackStream as g, createDiscordOpusEncodeStream as h, PLAYBACK_READY_TIMEOUT_MS as i, isVoiceChannel as l, convertRealtimePcm24kMonoToDiscordPcm48kStereo as m, CAPTURE_FINALIZE_GRACE_MS as n, VOICE_CONNECT_READY_TIMEOUT_MS as o, convertDiscordPcm48kStereoToRealtimePcm24kMono as p, MIN_SEGMENT_SECONDS as r, VOICE_RECONNECT_GRACE_MS as s, loadDiscordVoiceSdk as t, logVoiceVerbose as u, decodeOpusStreamChunks as v, maybeControlDiscordVoiceAgentRun as x, writeVoiceWavFile as y };
338
+ export { decodeOpusStreamChunks as _, VOICE_CONNECT_READY_TIMEOUT_MS as a, maybeControlDiscordVoiceAgentRun as b, isVoiceChannel as c, resolveVoiceTimeoutMs as d, convertDiscordPcm48kStereoToRealtimePcm24kMono as f, decodeOpusStream as g, createDiscordOpusPlaybackStream as h, PLAYBACK_READY_TIMEOUT_MS as i, logVoiceVerbose as l, createDiscordOpusEncodeStream as m, CAPTURE_FINALIZE_GRACE_MS as n, VOICE_RECONNECT_GRACE_MS as o, convertRealtimePcm24kMonoToDiscordPcm48kStereo as p, MIN_SEGMENT_SECONDS as r, isDiscordRealtimeVoiceMode as s, loadDiscordVoiceSdk as t, resolveDiscordVoiceMode as u, writeVoiceWavFile as v, formatVoiceLogPreview as x, formatVoiceIngressPrompt as y };
@@ -32,12 +32,8 @@ function listBroadMemberTargetPaths(params) {
32
32
  }
33
33
  function addDiscordNameBasedEntries(params) {
34
34
  if (!Array.isArray(params.values)) return;
35
- for (const value of params.values) {
36
- if (!isDiscordMutableAllowEntry(String(value))) continue;
37
- const text = normalizeOptionalString(String(value)) ?? "";
38
- if (!text) continue;
39
- params.target.add(`${params.source}:${text}`);
40
- }
35
+ const entries = new Set(params.values.map((value) => String(value).trim()).filter(isDiscordMutableAllowEntry));
36
+ if (entries.size > 0) params.target.set(params.source, entries.size);
41
37
  }
42
38
  async function collectDiscordSecurityAuditFindings(params) {
43
39
  const findings = [];
@@ -45,7 +41,7 @@ async function collectDiscordSecurityAuditFindings(params) {
45
41
  const accountId = normalizeOptionalString(params.accountId) ?? params.account.accountId ?? "default";
46
42
  const dangerousNameMatchingEnabled = isDangerousNameMatchingEnabled(discordCfg);
47
43
  const storeAllowFrom = await readChannelAllowFromStore("discord", process.env, accountId).catch(() => []);
48
- const discordNameBasedAllowEntries = /* @__PURE__ */ new Set();
44
+ const discordNameBasedAllowEntries = /* @__PURE__ */ new Map();
49
45
  const discordPathPrefix = params.orderedAccountIds.length > 1 || params.hasExplicitAccountPath ? `channels.discord.accounts.${accountId}` : "channels.discord";
50
46
  if ((discordCfg.groupPolicy ?? params.cfg.channels?.defaults?.groupPolicy ?? "allowlist") === "allowlist") {
51
47
  const broadMemberPaths = listBroadMemberTargetPaths({
@@ -73,7 +69,7 @@ async function collectDiscordSecurityAuditFindings(params) {
73
69
  addDiscordNameBasedEntries({
74
70
  target: discordNameBasedAllowEntries,
75
71
  values: storeAllowFrom,
76
- source: "~/.openclaw/credentials/discord-allowFrom.json"
72
+ source: "Discord pairing store"
77
73
  });
78
74
  const guildEntries = discordCfg.guilds ?? {};
79
75
  for (const [guildKey, guildValue] of Object.entries(guildEntries)) {
@@ -96,13 +92,16 @@ async function collectDiscordSecurityAuditFindings(params) {
96
92
  }
97
93
  }
98
94
  if (discordNameBasedAllowEntries.size > 0) {
99
- const examples = Array.from(discordNameBasedAllowEntries).slice(0, 5);
100
- const more = discordNameBasedAllowEntries.size > examples.length ? ` (+${discordNameBasedAllowEntries.size - examples.length} more)` : "";
95
+ const counts = Array.from(discordNameBasedAllowEntries);
96
+ const entryCount = counts.reduce((total, [, count]) => total + count, 0);
97
+ const sources = counts.slice(0, 5).map(([source, count]) => `${source} (${count})`);
98
+ const more = counts.length > sources.length ? ` (+${counts.length - sources.length} more sources)` : "";
99
+ const summary = `Found ${entryCount} name/tag entries: ${sources.join(", ")}${more}.`;
101
100
  findings.push({
102
101
  checkId: "channels.discord.allowFrom.name_based_entries",
103
102
  severity: dangerousNameMatchingEnabled ? "info" : "warn",
104
103
  title: dangerousNameMatchingEnabled ? "Discord allowlist uses break-glass name/tag matching" : "Discord allowlist contains name or tag entries",
105
- detail: dangerousNameMatchingEnabled ? `Discord name/tag allowlist matching is explicitly enabled via dangerouslyAllowNameMatching. This mutable-identity mode is operator-selected break-glass behavior and out-of-scope for vulnerability reports by itself. Found: ${examples.join(", ")}${more}.` : `Discord name/tag allowlist matching uses normalized slugs and can collide across users. Found: ${examples.join(", ")}${more}.`,
104
+ detail: dangerousNameMatchingEnabled ? "Discord name/tag allowlist matching is explicitly enabled via dangerouslyAllowNameMatching. This mutable-identity mode is operator-selected break-glass behavior and out-of-scope for vulnerability reports by itself. " + summary : "Discord name/tag allowlist matching uses normalized slugs and can collide across users. " + summary,
106
105
  remediation: dangerousNameMatchingEnabled ? "Prefer stable Discord IDs (or <@id>/user:<id>/pk:<id>), then disable dangerouslyAllowNameMatching." : "Prefer stable Discord IDs (or <@id>/user:<id>/pk:<id>) in channels.discord.allowFrom and channels.discord.guilds.*.users, or explicitly opt in with dangerouslyAllowNameMatching=true if you accept the risk."
107
106
  });
108
107
  }
@@ -1,2 +1,2 @@
1
- import { t as collectDiscordSecurityAuditFindings } from "./security-audit-BfJhAXZp.js";
1
+ import { t as collectDiscordSecurityAuditFindings } from "./security-audit-DKfK-iPY.js";
2
2
  export { collectDiscordSecurityAuditFindings };
@@ -1,2 +1,2 @@
1
- import { t as collectDiscordSecurityAuditFindings } from "./security-audit-BfJhAXZp.js";
1
+ import { t as collectDiscordSecurityAuditFindings } from "./security-audit-DKfK-iPY.js";
2
2
  export { collectDiscordSecurityAuditFindings };
@@ -1,11 +1,8 @@
1
- import { $t as timeoutGuildMember, A as RateLimitError, At as pinChannelMessage, Bt as deleteChannelPermission, Ct as editChannelMessage, Dt as listChannelArchivedThreads, Ft as createGuildBan, Gt as listGuildChannels, Ht as getGuildMember, It as createGuildChannel, Jt as listGuildScheduledEvents, Kt as listGuildEmojis, Lt as createGuildEmoji, M as readDiscordCode, Mt as sendChannelTyping, N as readDiscordMessage, Nt as unpinChannelMessage, Ot as listChannelMessages, P as readRetryAfter, Pt as addGuildMemberRole, Qt as removeGuildMemberRole, Rt as createGuildScheduledEvent, St as editChannel, Tt as getChannelMessage, Ut as getGuildVoiceState, Vt as getGuild, Wt as listGuildActiveThreads, Xt as putChannelPermission, Yt as moveGuildChannels, Zt as removeGuildMember, bt as deleteChannel, en as __exportAll, i as recordDiscordMessageCreateAmbiguity, j as isUnknownDiscordVoiceStateError, jt as searchGuildMessages, k as DiscordError, kt as listChannelPins, n as createDiscordRetryRunner, qt as listGuildRoles, t as classifyDiscordDeliveryFailure, wt as getChannel, xt as deleteChannelMessage, yt as createThread, zt as createGuildSticker } from "./retry-DNsVTeTo.js";
1
+ import { $t as listGuildRoles, At as getChannel, B as readRetryAfter, Bt as addGuildMemberRole, Ct as listMessageReactionUsers, Dt as deleteChannelMessage, Et as deleteChannel, F as DiscordError, Ft as listChannelPins, Gt as createGuildSticker, Ht as createGuildChannel, I as RateLimitError, It as pinChannelMessage, Jt as getGuildMember, Kt as deleteChannelPermission, L as isUnknownDiscordVoiceStateError, Lt as searchGuildMessages, Nt as listChannelArchivedThreads, Ot as editChannel, Pt as listChannelMessages, Qt as listGuildEmojis, R as readDiscordCode, Rt as sendChannelTyping, St as deleteOwnMessageReaction, Tt as createThread, Ut as createGuildEmoji, Vt as createGuildBan, Wt as createGuildScheduledEvent, Xt as listGuildActiveThreads, Yt as getGuildVoiceState, Zt as listGuildChannels, an as timeoutGuildMember, c as createDiscordSendResult, en as listGuildScheduledEvents, i as recordDiscordMessageCreateAmbiguity, in as removeGuildMemberRole, jt as getChannelMessage, kt as editChannelMessage, n as createDiscordRetryRunner, nn as putChannelPermission, on as __exportAll, qt as getGuild, rn as removeGuildMember, t as classifyDiscordDeliveryFailure, tn as moveGuildChannels, xt as createOwnMessageReaction, z as readDiscordMessage, zt as unpinChannelMessage } from "./retry-DqHCW6PV.js";
2
2
  import { t as parseDiscordRetryAfterBodySeconds } from "./retry-after-DdLPmPoa.js";
3
- import { c as resolveDiscordAccount } from "./accounts-DNl-oCEw.js";
4
- import { A as resolveDiscordMessageFlags, C as hasAllGuildPermissionsDiscord, L as resolveDiscordClientAccountContext, N as resolveDiscordSuppressEmbeds, P as createDiscordClient, R as resolveDiscordRest, S as fetchMemberGuildPermissionsDiscord, T as hasAnyGuildPermissionDiscord, _ as DiscordSendError, b as canViewDiscordGuildChannel, g as DISCORD_MAX_STICKER_BYTES, h as DISCORD_MAX_EVENT_COVER_BYTES, k as createDiscordMessageNonce, l as resolveChannelId, m as DISCORD_MAX_EMOJI_BYTES, n as buildDiscordTextChunks, o as normalizeEmojiName, p as sendDiscordText, q as parseAndResolveChannelRecipient, t as buildDiscordSendError, v as canManageGuildMemberRoleDiscord, w as hasAnyChannelPermissionDiscord, x as fetchChannelPermissionsDiscord, y as canManageGuildRoleDiscord, z as DISCORD_REST_TIMEOUT_MS } from "./send.shared-B3fpaLWJ.js";
5
- import { n as sendPollDiscord, o as rewriteDiscordKnownMentions, r as sendStickerDiscord, t as sendMessageDiscord } from "./send.outbound-HIkgji_7.js";
6
- import { r as createDiscordSendResult } from "./send.receipt-Cnhoautb.js";
3
+ import { C as hasAllGuildPermissionsDiscord, I as resolveDiscordClientAccountContext, K as parseAndResolveChannelRecipient, L as resolveDiscordRest, M as resolveDiscordSuppressEmbeds, N as createDiscordClient, O as createDiscordMessageNonce, R as DISCORD_REST_TIMEOUT_MS, S as fetchMemberGuildPermissionsDiscord, T as hasAnyGuildPermissionDiscord, _ as DiscordSendError, b as canViewDiscordGuildChannel, g as DISCORD_MAX_STICKER_BYTES, h as DISCORD_MAX_EVENT_COVER_BYTES, i as formatReactionEmoji, k as resolveDiscordMessageFlags, l as resolveChannelId, m as DISCORD_MAX_EMOJI_BYTES, n as buildDiscordTextChunks, o as normalizeEmojiName, p as sendDiscordText, r as buildReactionIdentifier, s as normalizeReactionEmoji, t as buildDiscordSendError, v as canManageGuildMemberRoleDiscord, w as hasAnyChannelPermissionDiscord, x as fetchChannelPermissionsDiscord, y as canManageGuildRoleDiscord } from "./send.shared-DZJ1akvQ.js";
4
+ import { n as sendPollDiscord, o as rewriteDiscordKnownMentions, r as sendStickerDiscord, t as sendMessageDiscord } from "./send.outbound-D7JYmfm9.js";
7
5
  import { n as DISCORD_ATTACHMENT_TOTAL_TIMEOUT_MS } from "./timeouts-B9cy6RvQ.js";
8
- import { i as removeReactionDiscord, n as reactMessageDiscord, r as removeOwnReactionsDiscord, t as fetchReactionsDiscord } from "./send.reactions-gmJ6yFPo.js";
9
6
  import fs from "node:fs/promises";
10
7
  import { ChannelType } from "discord-api-types/v10";
11
8
  import crypto from "node:crypto";
@@ -763,7 +760,7 @@ async function uploadVoiceAttachment(params) {
763
760
  * 2. Upload the OGG file to the provided URL
764
761
  * 3. Send the message with flag 8192 and attachment metadata
765
762
  */
766
- async function sendDiscordVoiceMessage(rest, channelId, audioBuffer, metadata, replyTo, request, silent, token) {
763
+ async function sendDiscordVoiceMessage(rest, channelId, audioBuffer, metadata, replyTo, request, silent, token, onPlatformSendDispatch) {
767
764
  const filename = "voice-message.ogg";
768
765
  const fileSize = audioBuffer.byteLength;
769
766
  const botToken = token;
@@ -803,6 +800,7 @@ async function sendDiscordVoiceMessage(rest, channelId, audioBuffer, metadata, r
803
800
  let messageCreateMayHaveCommitted = false;
804
801
  try {
805
802
  return await request(async () => {
803
+ await onPlatformSendDispatch?.();
806
804
  try {
807
805
  return await rest.post(`/channels/${channelId}/messages`, { body: messagePayload });
808
806
  } catch (error) {
@@ -859,10 +857,6 @@ async function sendVoiceMessageDiscord(to, audioPath, opts) {
859
857
  let rest;
860
858
  let channelId;
861
859
  try {
862
- const accountInfo = resolveDiscordAccount({
863
- cfg,
864
- accountId: opts.accountId
865
- });
866
860
  const client = createDiscordClient({
867
861
  ...opts,
868
862
  cfg
@@ -870,15 +864,15 @@ async function sendVoiceMessageDiscord(to, audioPath, opts) {
870
864
  token = client.token;
871
865
  rest = client.rest;
872
866
  const request = client.request;
873
- const recipient = await parseAndResolveChannelRecipient(to, cfg, opts.accountId);
867
+ const accountInfo = client.account;
868
+ const recipient = await parseAndResolveChannelRecipient(to, cfg, accountInfo.accountId);
874
869
  channelId = (await resolveChannelId(rest, recipient, request)).channelId;
875
870
  const ogg = await ensureOggOpus(localInputPath);
876
871
  oggPath = ogg.path;
877
872
  oggCleanup = ogg.cleanup;
878
873
  const metadata = await getVoiceMessageMetadata(oggPath);
879
874
  const audioBuffer = await fs.readFile(oggPath);
880
- await opts.onPlatformSendDispatch?.();
881
- const result = await sendDiscordVoiceMessage(rest, channelId, audioBuffer, metadata, opts.reply?.messageId, request, opts.silent, token);
875
+ const result = await sendDiscordVoiceMessage(rest, channelId, audioBuffer, metadata, opts.reply?.messageId, request, opts.silent, token, opts.onPlatformSendDispatch);
882
876
  recordChannelActivity({
883
877
  channel: "discord",
884
878
  accountId: accountInfo.accountId,
@@ -909,6 +903,75 @@ async function sendTypingDiscord(channelId, opts) {
909
903
  };
910
904
  }
911
905
  //#endregion
906
+ //#region extensions/discord/src/send.reactions.ts
907
+ function resolveDiscordReactionClient(opts) {
908
+ if (opts.rest && opts.cfg && opts.accountId) return createDiscordClient(opts);
909
+ if (!opts.cfg) throw new Error("Discord reactions requires a resolved runtime config. Load and resolve config at the command or gateway boundary, then pass cfg through the runtime path.");
910
+ const cfg = requireRuntimeConfig(opts.cfg, "Discord reactions");
911
+ return createDiscordClient({
912
+ ...opts,
913
+ cfg
914
+ });
915
+ }
916
+ async function reactMessageDiscord(channelId, messageId, emoji, opts) {
917
+ const { rest, request } = resolveDiscordReactionClient(opts);
918
+ const encoded = normalizeReactionEmoji(emoji);
919
+ await request(() => createOwnMessageReaction(rest, channelId, messageId, encoded), "react");
920
+ return { ok: true };
921
+ }
922
+ async function removeReactionDiscord(channelId, messageId, emoji, opts) {
923
+ const { rest, request } = resolveDiscordReactionClient(opts);
924
+ const encoded = normalizeReactionEmoji(emoji);
925
+ await request(() => deleteOwnMessageReaction(rest, channelId, messageId, encoded), "reaction-remove");
926
+ return { ok: true };
927
+ }
928
+ async function removeOwnReactionsDiscord(channelId, messageId, opts) {
929
+ const { rest, request } = resolveDiscordReactionClient(opts);
930
+ const message = await request(() => getChannelMessage(rest, channelId, messageId), "reaction-list");
931
+ const identifiers = /* @__PURE__ */ new Set();
932
+ for (const reaction of message.reactions ?? []) {
933
+ const identifier = reaction.me ? buildReactionIdentifier(reaction.emoji) : void 0;
934
+ if (identifier) identifiers.add(identifier);
935
+ }
936
+ if (identifiers.size === 0) return {
937
+ ok: true,
938
+ removed: []
939
+ };
940
+ const removed = Array.from(identifiers);
941
+ await Promise.all(removed.map((identifier) => request(() => deleteOwnMessageReaction(rest, channelId, messageId, normalizeReactionEmoji(identifier)), "reaction-remove")));
942
+ return {
943
+ ok: true,
944
+ removed
945
+ };
946
+ }
947
+ async function fetchReactionsDiscord(channelId, messageId, opts) {
948
+ const { rest, request } = resolveDiscordReactionClient(opts);
949
+ const reactions = (await request(() => getChannelMessage(rest, channelId, messageId), "reaction-list")).reactions ?? [];
950
+ if (reactions.length === 0) return [];
951
+ const limit = typeof opts.limit === "number" && Number.isFinite(opts.limit) ? Math.min(Math.max(Math.floor(opts.limit), 1), 100) : 100;
952
+ const summaries = [];
953
+ for (const reaction of reactions) {
954
+ const identifier = buildReactionIdentifier(reaction.emoji);
955
+ if (!identifier) continue;
956
+ const encoded = encodeURIComponent(identifier);
957
+ const users = await request(() => listMessageReactionUsers(rest, channelId, messageId, encoded, { limit }), "reaction-users");
958
+ summaries.push({
959
+ emoji: {
960
+ id: reaction.emoji.id ?? null,
961
+ name: reaction.emoji.name ?? null,
962
+ raw: formatReactionEmoji(reaction.emoji)
963
+ },
964
+ count: reaction.count,
965
+ users: users.map((user) => ({
966
+ id: user.id,
967
+ username: user.username,
968
+ tag: user.username && user.discriminator ? `${user.username}#${user.discriminator}` : user.username
969
+ }))
970
+ });
971
+ }
972
+ return summaries;
973
+ }
974
+ //#endregion
912
975
  //#region extensions/discord/src/send.ts
913
976
  var send_exports = /* @__PURE__ */ __exportAll({
914
977
  DiscordSendError: () => DiscordSendError,
@@ -966,4 +1029,4 @@ var send_exports = /* @__PURE__ */ __exportAll({
966
1029
  uploadStickerDiscord: () => uploadStickerDiscord
967
1030
  });
968
1031
  //#endregion
969
- export { listGuildEmojisDiscord as A, fetchVoiceStatusDiscord as C, removeRoleDiscord as D, listScheduledEventsDiscord as E, editChannelDiscord as F, moveChannelDiscord as I, removeChannelPermissionDiscord as L, uploadStickerDiscord as M, createChannelDiscord as N, resolveEventCoverImage as O, deleteChannelDiscord as P, setChannelPermissionDiscord as R, fetchRoleInfoDiscord as S, listGuildChannelsDiscord as T, banMemberDiscord as _, DiscordThreadInitialMessageError as a, fetchGuildInfoDiscord as b, editMessageDiscord as c, listThreadsDiscord as d, pinMessageDiscord as f, addRoleDiscord as g, unpinMessageDiscord as h, sendWebhookMessageDiscord as i, uploadEmojiDiscord as j, timeoutMemberDiscord as k, fetchMessageDiscord as l, searchMessagesDiscord as m, sendTypingDiscord as n, createThreadDiscord as o, readMessagesDiscord as p, sendVoiceMessageDiscord as r, deleteMessageDiscord as s, send_exports as t, listPinsDiscord as u, createScheduledEventDiscord as v, kickMemberDiscord as w, fetchMemberInfoDiscord as x, fetchChannelInfoDiscord as y };
1032
+ export { listScheduledEventsDiscord as A, moveChannelDiscord as B, fetchChannelInfoDiscord as C, fetchVoiceStatusDiscord as D, fetchRoleInfoDiscord as E, uploadEmojiDiscord as F, setChannelPermissionDiscord as H, uploadStickerDiscord as I, createChannelDiscord as L, resolveEventCoverImage as M, timeoutMemberDiscord as N, kickMemberDiscord as O, listGuildEmojisDiscord as P, deleteChannelDiscord as R, createScheduledEventDiscord as S, fetchMemberInfoDiscord as T, removeChannelPermissionDiscord as V, readMessagesDiscord as _, removeReactionDiscord as a, addRoleDiscord as b, sendWebhookMessageDiscord as c, deleteMessageDiscord as d, editMessageDiscord as f, pinMessageDiscord as g, listThreadsDiscord as h, removeOwnReactionsDiscord as i, removeRoleDiscord as j, listGuildChannelsDiscord as k, DiscordThreadInitialMessageError as l, listPinsDiscord as m, fetchReactionsDiscord as n, sendTypingDiscord as o, fetchMessageDiscord as p, reactMessageDiscord as r, sendVoiceMessageDiscord as s, send_exports as t, createThreadDiscord as u, searchMessagesDiscord as v, fetchGuildInfoDiscord as w, banMemberDiscord as x, unpinMessageDiscord as y, editChannelDiscord as z };
@@ -1,15 +1,14 @@
1
- import { Ct as editChannelMessage, V as serializePayload, en as __exportAll, vt as createChannelMessage } from "./retry-DNsVTeTo.js";
2
- import { d as buildDiscordComponentMessage, f as buildDiscordComponentMessageFlags, h as resolveDiscordComponentAttachmentName } from "./components-ezGKo_Yh.js";
3
- import { c as resolveDiscordAccount, y as loadOutboundMediaFromUrl } from "./accounts-DNl-oCEw.js";
1
+ import { c as createDiscordSendResult, kt as editChannelMessage, on as __exportAll, q as serializePayload, wt as createChannelMessage } from "./retry-DqHCW6PV.js";
2
+ import { d as buildDiscordComponentMessage, f as buildDiscordComponentMessageFlags, g as resolveDiscordComponentAttachmentName } from "./components-Dk35LTf_.js";
4
3
  import { n as getOptionalDiscordRuntime } from "./runtime-DgnVQ7zW.js";
5
- import { D as SUPPRESS_NOTIFICATIONS_FLAG, P as createDiscordClient, k as createDiscordMessageNonce, l as resolveChannelId, q as parseAndResolveChannelRecipient, t as buildDiscordSendError, u as resolveDiscordChannel } from "./send.shared-B3fpaLWJ.js";
6
- import { t as sendMessageDiscord } from "./send.outbound-HIkgji_7.js";
7
- import { r as createDiscordSendResult } from "./send.receipt-Cnhoautb.js";
4
+ import { E as SUPPRESS_NOTIFICATIONS_FLAG, K as parseAndResolveChannelRecipient, N as createDiscordClient, O as createDiscordMessageNonce, l as resolveChannelId, t as buildDiscordSendError, u as resolveDiscordChannel } from "./send.shared-DZJ1akvQ.js";
5
+ import { t as sendMessageDiscord } from "./send.outbound-D7JYmfm9.js";
8
6
  import { ChannelType } from "discord-api-types/v10";
9
7
  import { asDateTimestampMs, isFutureDateTimestampMs, resolveDateTimestampMs, resolveExpiresAtMsFromDurationMs } from "openclaw/plugin-sdk/number-runtime";
10
8
  import { uniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
11
9
  import { recordChannelActivity } from "openclaw/plugin-sdk/channel-activity-runtime";
12
10
  import { extensionForMime } from "openclaw/plugin-sdk/media-mime";
11
+ import { loadOutboundMediaFromUrl } from "openclaw/plugin-sdk/outbound-media";
13
12
  import { requireRuntimeConfig } from "openclaw/plugin-sdk/plugin-config-runtime";
14
13
  import { createPluginStateErrorReporter } from "openclaw/plugin-sdk/plugin-state-runtime";
15
14
  import { resolveGlobalSingleton } from "openclaw/plugin-sdk/global-singleton";
@@ -364,7 +363,7 @@ async function buildDiscordComponentPayload(params) {
364
363
  });
365
364
  const filenameOverride = params.opts.filename?.trim();
366
365
  const explicitAttachmentName = extractComponentAttachmentNames(spec)[0];
367
- resolvedFileName = filenameOverride || media.fileName || explicitAttachmentName || `upload${extensionForMime(media.contentType) ?? ""}`;
366
+ resolvedFileName = filenameOverride || explicitAttachmentName || media.fileName || `upload${extensionForMime(media.contentType) ?? ""}`;
368
367
  spec = withImplicitComponentAttachmentBlock(spec, resolvedFileName);
369
368
  files = [{
370
369
  data: media.buffer,
@@ -406,7 +405,7 @@ async function sendDiscordComponentMessage(to, spec, opts) {
406
405
  token: opts.token,
407
406
  rest: opts.rest,
408
407
  mediaUrl: opts.mediaUrl,
409
- filename: opts.filename,
408
+ filename: opts.filename?.trim() || extractComponentAttachmentNames(spec)[0],
410
409
  mediaLocalRoots: opts.mediaLocalRoots,
411
410
  mediaReadFile: opts.mediaReadFile,
412
411
  mediaAccess: opts.mediaAccess,
@@ -421,15 +420,11 @@ async function sendDiscordComponentMessage(to, spec, opts) {
421
420
  ...opts.suppressEmbeds === void 0 ? {} : { suppressEmbeds: opts.suppressEmbeds }
422
421
  });
423
422
  const cfg = requireRuntimeConfig(opts.cfg, "Discord component send");
424
- const accountInfo = resolveDiscordAccount({
425
- cfg,
426
- accountId: opts.accountId
427
- });
428
- const { token, rest, request } = createDiscordClient({
423
+ const { token, rest, request, account: accountInfo } = createDiscordClient({
429
424
  ...opts,
430
425
  cfg
431
426
  });
432
- const { channelId } = await resolveChannelId(rest, await parseAndResolveChannelRecipient(to, cfg, opts.accountId), request);
427
+ const { channelId } = await resolveChannelId(rest, await parseAndResolveChannelRecipient(to, cfg, accountInfo.accountId), request);
433
428
  const channel = await resolveDiscordChannel(rest, channelId);
434
429
  if (channel && DISCORD_FORUM_LIKE_TYPES.has(channel.type)) throw new Error("Discord components are not supported in forum-style channels");
435
430
  const { body: componentBody, buildResult } = await buildDiscordComponentPayload({
@@ -444,8 +439,10 @@ async function sendDiscordComponentMessage(to, spec, opts) {
444
439
  };
445
440
  let result;
446
441
  try {
447
- await opts.onPlatformSendDispatch?.();
448
- result = await request(() => createChannelMessage(rest, channelId, { body }), "components", { safety: "nonce-protected-create" });
442
+ result = await request(async () => {
443
+ await opts.onPlatformSendDispatch?.();
444
+ return createChannelMessage(rest, channelId, { body });
445
+ }, "components", { safety: "nonce-protected-create" });
449
446
  } catch (err) {
450
447
  throw await buildDiscordSendError(err, {
451
448
  channelId,
@@ -476,15 +473,11 @@ async function sendDiscordComponentMessage(to, spec, opts) {
476
473
  }
477
474
  async function editDiscordComponentMessage(to, messageId, spec, opts) {
478
475
  const cfg = requireRuntimeConfig(opts.cfg, "Discord component edit");
479
- const accountInfo = resolveDiscordAccount({
480
- cfg,
481
- accountId: opts.accountId
482
- });
483
- const { token, rest, request } = createDiscordClient({
476
+ const { token, rest, request, account: accountInfo } = createDiscordClient({
484
477
  ...opts,
485
478
  cfg
486
479
  });
487
- const { channelId } = await resolveChannelId(rest, await parseAndResolveChannelRecipient(to, cfg, opts.accountId), request);
480
+ const { channelId } = await resolveChannelId(rest, await parseAndResolveChannelRecipient(to, cfg, accountInfo.accountId), request);
488
481
  const { body, buildResult } = await buildDiscordComponentPayload({
489
482
  spec,
490
483
  opts,