@openclaw/discord 2026.10.2 → 2026.10.5-beta.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 (246) hide show
  1. package/dist/.setup/account-inspect-8cCu6uPG.mjs +31 -0
  2. package/dist/.setup/{accounts-HE9-mj1L.mjs → accounts-ljrzXBJi.mjs} +47 -45
  3. package/dist/.setup/{allow-list-vxkG9_JD.mjs → allow-list-B_ToXtew.mjs} +34 -101
  4. package/dist/.setup/{api-DlNUkDqj.mjs → api-CtmE1OUN.mjs} +25 -31
  5. package/dist/.setup/{approval-handler.runtime-DmnEa54W.mjs → approval-handler.runtime-D7FoZSn0.mjs} +30 -53
  6. package/dist/.setup/{approval-message-updates-B0jdSqOj.mjs → approval-message-updates-CIGByUcE.mjs} +2 -2
  7. package/dist/.setup/{audit-BpikUwN_.mjs → audit-zSawfbsN.mjs} +5 -8
  8. package/dist/.setup/{channel-Dr-AUnGt.mjs → channel-DI7DMzu0.mjs} +136 -215
  9. package/dist/.setup/{channel-access-BRp3Y-rF.mjs → channel-access-DasWY_OV.mjs} +6 -7
  10. package/dist/.setup/{channel.setup-BmNvkidb.mjs → channel.setup-DdFVN1mr.mjs} +35 -64
  11. package/dist/.setup/{components-DLJR0xU-.mjs → components-HN9052L1.mjs} +123 -146
  12. package/dist/.setup/{config-schema-BQWfnSCx.mjs → config-schema-_uBILpQf.mjs} +7 -3
  13. package/dist/.setup/{conversation-binding-route-DicJC1Lj.mjs → conversation-binding-route-DTjCBx-O.mjs} +1 -1
  14. package/dist/.setup/{directory-config-gqsdcplU.mjs → directory-config-3iVub-3m.mjs} +1 -1
  15. package/dist/.setup/{directory-live-Bipr0eUJ.mjs → directory-live-DLygQVtW.mjs} +18 -22
  16. package/dist/.setup/{discord-9gysrhzp.mjs → discord-BGqgx-yd.mjs} +686 -854
  17. package/dist/.setup/{doctor-B2bskDcF.mjs → doctor-DSrNJ7m2.mjs} +36 -47
  18. package/dist/.setup/{doctor-contract-Bg3NPAMw.mjs → doctor-contract-Bwv8EuQ_.mjs} +7 -16
  19. package/dist/.setup/{handle-action-UmkjXBfo.mjs → handle-action-CXH1h1tq.mjs} +25 -38
  20. package/dist/.setup/{handle-action.guild-admin-CB4sc9VV.mjs → handle-action.guild-admin-CHKW6PIs.mjs} +25 -31
  21. package/dist/.setup/{live-policy-config-VxexfRKo.mjs → live-policy-config-BPoB3eQi.mjs} +1 -1
  22. package/dist/.setup/{message-handler-BK69A-NB.mjs → message-handler-Ii_etru1.mjs} +9 -14
  23. package/dist/.setup/{message-handler.preflight-DFpsh90H.mjs → message-handler.preflight-C7YuSRl_.mjs} +79 -128
  24. package/dist/.setup/{message-handler.preflight-pluralkit-BXGGVmpe.mjs → message-handler.preflight-pluralkit-C3iAG--b.mjs} +6 -6
  25. package/dist/.setup/{message-handler.process-TKoqcqIP.mjs → message-handler.process-ClgWYH6o.mjs} +234 -206
  26. package/dist/.setup/{outbound-adapter-D4wRAb5S.mjs → outbound-adapter-D8OOIuKn.mjs} +73 -112
  27. package/dist/.setup/{outbound-session-route-BvBH4LC6.mjs → outbound-session-route-B0Hpwn3Q.mjs} +57 -115
  28. package/dist/.setup/output-activity-uBpMSX75.mjs +11 -0
  29. package/dist/.setup/{pluralkit-a6_NLfH9.mjs → pluralkit-B64dfq_j.mjs} +3 -1
  30. package/dist/.setup/{preflight-audio-DHGIHEpv.mjs → preflight-audio-wWgsZG5F.mjs} +1 -5
  31. package/dist/.setup/{presence-cache-Dg3_dADn.mjs → presence-cache-DCeTsL73.mjs} +3 -6
  32. package/dist/.setup/{probe-BwSKpnZf.mjs → probe-D3P1x4aN.mjs} +10 -18
  33. package/dist/.setup/{provider-YP8gN9_o.mjs → provider-D9EzOfG8.mjs} +2990 -3903
  34. package/dist/.setup/{provider-session.runtime-D1gkPxHT.mjs → provider-session.runtime-CsnRvddI.mjs} +5 -5
  35. package/dist/.setup/provider.runtime-BQVcM7Pg.mjs +2 -0
  36. package/dist/.setup/{realtime-session.runtime-BKUQBy1u.mjs → realtime-session.runtime-CxGBk8H-.mjs} +69 -98
  37. package/dist/.setup/{receive-recovery-DgkX7Qvi.mjs → receive-recovery-eVmK2_hl.mjs} +2 -12
  38. package/dist/.setup/resolve-allowlist-common-DNSsUQRF.mjs +66 -0
  39. package/dist/.setup/resolve-channels-UdT38DzU.mjs +173 -0
  40. package/dist/.setup/{resolve-users-DNrwvunm.mjs → resolve-users-DnCsrXZ_.mjs} +12 -41
  41. package/dist/.setup/{runtime-CESTexGn.mjs → runtime-CRTkKU1G.mjs} +202 -313
  42. package/dist/.setup/{runtime-DPcmPST9.mjs → runtime-DPm3gZXk.mjs} +2 -2
  43. package/dist/.setup/{secret-config-contract-uOE2J7yM.mjs → secret-config-contract-CIsH7R3B.mjs} +9 -18
  44. package/dist/.setup/{security-audit-D42cp5N7.mjs → security-audit-BFT84Uny.mjs} +1 -2
  45. package/dist/.setup/security-contract-DNyyjTZZ.mjs +19 -0
  46. package/dist/.setup/{send-CJk3VP5q.mjs → send-DbILKgcm.mjs} +184 -241
  47. package/dist/.setup/{send.components-dPljuV24.mjs → send.components-FxOS3CeP.mjs} +47 -63
  48. package/dist/.setup/{send.outbound-rOboMO_6.mjs → send.outbound-_jx4Xpd3.mjs} +178 -202
  49. package/dist/.setup/{send.receipt-DVOg2Oaw.mjs → send.receipt-BAlzXd8e.mjs} +33 -109
  50. package/dist/.setup/{send.shared-C4CN24D9.mjs → send.shared-CjQ4jbMA.mjs} +97 -153
  51. package/dist/.setup/{sender-identity-AHpUNr72.mjs → sender-identity-BNBvGt1l.mjs} +1 -1
  52. package/dist/.setup/setup-plugin-api-xfOFmxHP.mjs +3 -0
  53. package/dist/.setup/{shared-BoBnM5kM.mjs → shared-CestGDpq.mjs} +30 -20
  54. package/dist/.setup/{subagent-hooks-HH8Uy9cx.mjs → subagent-hooks-CME7dSGf.mjs} +5 -10
  55. package/dist/.setup/{system-events-Cwxaww8i.mjs → system-events-BwwSDCw4.mjs} +2 -2
  56. package/dist/.setup/target-parsing-C-HyNxcE.mjs +48 -0
  57. package/dist/.setup/{target-resolver-CSFoPQ12.mjs → target-resolver-Bse8fuTi.mjs} +11 -27
  58. package/dist/.setup/targets-DZJjkzwv.mjs +3 -0
  59. package/dist/.setup/{thread-bindings-DjQCkmsd.mjs → thread-bindings-0hPTSK14.mjs} +61 -52
  60. package/dist/.setup/{thread-bindings.manager-D2-GYZ5s.mjs → thread-bindings.manager-CdNa6UIs.mjs} +138 -211
  61. package/dist/.setup/{thread-bindings.session-updates-Bu_CGr_O.mjs → thread-bindings.session-updates-DGSljVf6.mjs} +60 -99
  62. package/dist/.setup/threading-BKe3E3tp.mjs +246 -0
  63. package/dist/.setup/{timeouts-pun7VJ02.mjs → timeouts-CuNARfyw.mjs} +10 -18
  64. package/dist/.setup/{transcripts-source-CaZQnGRH.mjs → transcripts-source-0qQYVu2H.mjs} +50 -368
  65. package/dist/.setup/{voice-runtime-DDymtIw8.mjs → voice-runtime-QlZJ4sHv.mjs} +166 -322
  66. package/dist/account-inspect-api.js +1 -1
  67. package/dist/action-runtime-api.js +1 -1
  68. package/dist/activities-api.js +77 -120
  69. package/dist/api.js +19 -18
  70. package/dist/channel-config-api.js +1 -1
  71. package/dist/channel-plugin-api.js +1 -1
  72. package/dist/directory-contract-api.js +1 -1
  73. package/dist/doctor-contract-api.js +1 -1
  74. package/dist/runtime-api.js +21 -20
  75. package/dist/secret-contract-api.js +1 -1
  76. package/dist/security-audit-contract-api.js +1 -1
  77. package/dist/security-contract-api.js +1 -1
  78. package/dist/setup-entry.js +1 -1
  79. package/dist/setup-plugin-api.js +1 -1
  80. package/dist/src/voice/audio-worker.runtime.js +38 -57
  81. package/dist/subagent-hooks-api.js +1 -1
  82. package/dist/transcripts-source-api.js +1 -1
  83. package/node_modules/@types/node/README.md +1 -1
  84. package/node_modules/@types/node/crypto.d.ts +2 -2
  85. package/node_modules/@types/node/dgram.d.ts +1 -1
  86. package/node_modules/@types/node/package.json +2 -2
  87. package/node_modules/@types/node/zlib.d.ts +6 -0
  88. package/node_modules/@types/ws/README.md +1 -1
  89. package/node_modules/@types/ws/index.d.mts +4 -0
  90. package/node_modules/@types/ws/index.d.ts +4 -0
  91. package/node_modules/@types/ws/package.json +3 -3
  92. package/node_modules/discord-api-types/_generated_/rest/v10/interfaces.d.ts +21 -0
  93. package/node_modules/discord-api-types/_generated_/rest/v10/interfaces.d.ts.map +1 -1
  94. package/node_modules/discord-api-types/_generated_/rest/v9/interfaces.d.ts +21 -0
  95. package/node_modules/discord-api-types/_generated_/rest/v9/interfaces.d.ts.map +1 -1
  96. package/node_modules/discord-api-types/globals.d.ts +6 -0
  97. package/node_modules/discord-api-types/globals.d.ts.map +1 -1
  98. package/node_modules/discord-api-types/globals.js +6 -0
  99. package/node_modules/discord-api-types/globals.js.map +1 -1
  100. package/node_modules/discord-api-types/package.json +3 -3
  101. package/node_modules/discord-api-types/payloads/index.mjs +1 -0
  102. package/node_modules/discord-api-types/payloads/v10/applicationIdentityProfile.d.ts +207 -0
  103. package/node_modules/discord-api-types/payloads/v10/applicationIdentityProfile.d.ts.map +1 -0
  104. package/node_modules/discord-api-types/payloads/v10/applicationIdentityProfile.js +25 -0
  105. package/node_modules/discord-api-types/payloads/v10/applicationIdentityProfile.js.map +1 -0
  106. package/node_modules/discord-api-types/payloads/v10/autoModeration.d.ts +1 -1
  107. package/node_modules/discord-api-types/payloads/v10/autoModeration.d.ts.map +1 -1
  108. package/node_modules/discord-api-types/payloads/v10/guild.d.ts +27 -23
  109. package/node_modules/discord-api-types/payloads/v10/guild.d.ts.map +1 -1
  110. package/node_modules/discord-api-types/payloads/v10/guild.js +26 -22
  111. package/node_modules/discord-api-types/payloads/v10/guild.js.map +1 -1
  112. package/node_modules/discord-api-types/payloads/v10/index.d.ts +1 -0
  113. package/node_modules/discord-api-types/payloads/v10/index.d.ts.map +1 -1
  114. package/node_modules/discord-api-types/payloads/v10/index.js +1 -0
  115. package/node_modules/discord-api-types/payloads/v10/index.js.map +1 -1
  116. package/node_modules/discord-api-types/payloads/v10/index.mjs +1 -0
  117. package/node_modules/discord-api-types/payloads/v9/applicationIdentityProfile.d.ts +207 -0
  118. package/node_modules/discord-api-types/payloads/v9/applicationIdentityProfile.d.ts.map +1 -0
  119. package/node_modules/discord-api-types/payloads/v9/applicationIdentityProfile.js +25 -0
  120. package/node_modules/discord-api-types/payloads/v9/applicationIdentityProfile.js.map +1 -0
  121. package/node_modules/discord-api-types/payloads/v9/autoModeration.d.ts +1 -1
  122. package/node_modules/discord-api-types/payloads/v9/autoModeration.d.ts.map +1 -1
  123. package/node_modules/discord-api-types/payloads/v9/guild.d.ts +27 -23
  124. package/node_modules/discord-api-types/payloads/v9/guild.d.ts.map +1 -1
  125. package/node_modules/discord-api-types/payloads/v9/guild.js +26 -22
  126. package/node_modules/discord-api-types/payloads/v9/guild.js.map +1 -1
  127. package/node_modules/discord-api-types/payloads/v9/index.d.ts +1 -0
  128. package/node_modules/discord-api-types/payloads/v9/index.d.ts.map +1 -1
  129. package/node_modules/discord-api-types/payloads/v9/index.js +1 -0
  130. package/node_modules/discord-api-types/payloads/v9/index.js.map +1 -1
  131. package/node_modules/discord-api-types/payloads/v9/index.mjs +1 -0
  132. package/node_modules/discord-api-types/rest/common.d.ts +2 -0
  133. package/node_modules/discord-api-types/rest/common.d.ts.map +1 -1
  134. package/node_modules/discord-api-types/rest/common.js +2 -0
  135. package/node_modules/discord-api-types/rest/common.js.map +1 -1
  136. package/node_modules/discord-api-types/rest/v10/applicationIdentityProfile.d.ts +70 -0
  137. package/node_modules/discord-api-types/rest/v10/applicationIdentityProfile.d.ts.map +1 -0
  138. package/node_modules/discord-api-types/rest/v10/applicationIdentityProfile.js +3 -0
  139. package/node_modules/discord-api-types/rest/v10/applicationIdentityProfile.js.map +1 -0
  140. package/node_modules/discord-api-types/rest/v10/index.d.ts +1 -0
  141. package/node_modules/discord-api-types/rest/v10/index.d.ts.map +1 -1
  142. package/node_modules/discord-api-types/rest/v10/index.js +29 -0
  143. package/node_modules/discord-api-types/rest/v10/index.js.map +1 -1
  144. package/node_modules/discord-api-types/rest/v10/interactions.d.ts +4 -2
  145. package/node_modules/discord-api-types/rest/v10/interactions.d.ts.map +1 -1
  146. package/node_modules/discord-api-types/rest/v10/user.d.ts +2 -2
  147. package/node_modules/discord-api-types/rest/v10/user.d.ts.map +1 -1
  148. package/node_modules/discord-api-types/rest/v9/applicationIdentityProfile.d.ts +70 -0
  149. package/node_modules/discord-api-types/rest/v9/applicationIdentityProfile.d.ts.map +1 -0
  150. package/node_modules/discord-api-types/rest/v9/applicationIdentityProfile.js +3 -0
  151. package/node_modules/discord-api-types/rest/v9/applicationIdentityProfile.js.map +1 -0
  152. package/node_modules/discord-api-types/rest/v9/index.d.ts +1 -0
  153. package/node_modules/discord-api-types/rest/v9/index.d.ts.map +1 -1
  154. package/node_modules/discord-api-types/rest/v9/index.js +29 -0
  155. package/node_modules/discord-api-types/rest/v9/index.js.map +1 -1
  156. package/node_modules/discord-api-types/rest/v9/interactions.d.ts +4 -2
  157. package/node_modules/discord-api-types/rest/v9/interactions.d.ts.map +1 -1
  158. package/node_modules/discord-api-types/rest/v9/user.d.ts +2 -2
  159. package/node_modules/discord-api-types/rest/v9/user.d.ts.map +1 -1
  160. package/node_modules/discord-api-types/v10.mjs +1 -0
  161. package/node_modules/discord-api-types/v9.mjs +1 -0
  162. package/node_modules/micromark/dev/lib/compile.d.ts.map +1 -1
  163. package/node_modules/micromark/dev/lib/compile.js +14 -4
  164. package/node_modules/micromark/dev/lib/create-tokenizer.d.ts.map +1 -1
  165. package/node_modules/micromark/dev/lib/create-tokenizer.js +7 -6
  166. package/node_modules/micromark/dev/lib/initialize/document.js +25 -21
  167. package/node_modules/micromark/dev/lib/initialize/text.d.ts.map +1 -1
  168. package/node_modules/micromark/dev/lib/initialize/text.js +10 -6
  169. package/node_modules/micromark/dev/lib/preprocess.d.ts.map +1 -1
  170. package/node_modules/micromark/dev/lib/preprocess.js +19 -21
  171. package/node_modules/micromark/lib/compile.d.ts.map +1 -1
  172. package/node_modules/micromark/lib/compile.js +37 -29
  173. package/node_modules/micromark/lib/create-tokenizer.d.ts.map +1 -1
  174. package/node_modules/micromark/lib/create-tokenizer.js +37 -35
  175. package/node_modules/micromark/lib/initialize/document.js +21 -13
  176. package/node_modules/micromark/lib/initialize/text.d.ts.map +1 -1
  177. package/node_modules/micromark/lib/initialize/text.js +7 -3
  178. package/node_modules/micromark/lib/preprocess.d.ts.map +1 -1
  179. package/node_modules/micromark/lib/preprocess.js +16 -19
  180. package/node_modules/micromark/package.json +2 -15
  181. package/node_modules/micromark-core-commonmark/dev/lib/attention.js +18 -24
  182. package/node_modules/micromark-core-commonmark/dev/lib/code-fenced.d.ts.map +1 -1
  183. package/node_modules/micromark-core-commonmark/dev/lib/code-fenced.js +1 -43
  184. package/node_modules/micromark-core-commonmark/dev/lib/code-indented.js +19 -43
  185. package/node_modules/micromark-core-commonmark/dev/lib/heading-atx.js +2 -6
  186. package/node_modules/micromark-core-commonmark/dev/lib/html-flow.d.ts.map +1 -1
  187. package/node_modules/micromark-core-commonmark/dev/lib/html-flow.js +2 -53
  188. package/node_modules/micromark-core-commonmark/dev/lib/label-end.js +14 -12
  189. package/node_modules/micromark-core-commonmark/dev/lib/label-start-image.d.ts.map +1 -1
  190. package/node_modules/micromark-core-commonmark/dev/lib/label-start-image.js +14 -5
  191. package/node_modules/micromark-core-commonmark/dev/lib/label-start-link.d.ts.map +1 -1
  192. package/node_modules/micromark-core-commonmark/dev/lib/label-start-link.js +14 -5
  193. package/node_modules/micromark-core-commonmark/dev/lib/partial-non-lazy-continuation.d.ts +4 -0
  194. package/node_modules/micromark-core-commonmark/dev/lib/partial-non-lazy-continuation.d.ts.map +1 -0
  195. package/node_modules/micromark-core-commonmark/dev/lib/partial-non-lazy-continuation.js +67 -0
  196. package/node_modules/micromark-core-commonmark/dev/lib/setext-underline.d.ts.map +1 -1
  197. package/node_modules/micromark-core-commonmark/dev/lib/setext-underline.js +8 -5
  198. package/node_modules/micromark-core-commonmark/lib/attention.js +14 -24
  199. package/node_modules/micromark-core-commonmark/lib/code-fenced.d.ts.map +1 -1
  200. package/node_modules/micromark-core-commonmark/lib/code-fenced.js +1 -39
  201. package/node_modules/micromark-core-commonmark/lib/code-indented.js +11 -29
  202. package/node_modules/micromark-core-commonmark/lib/heading-atx.js +2 -6
  203. package/node_modules/micromark-core-commonmark/lib/html-flow.d.ts.map +1 -1
  204. package/node_modules/micromark-core-commonmark/lib/html-flow.js +2 -51
  205. package/node_modules/micromark-core-commonmark/lib/label-end.js +11 -10
  206. package/node_modules/micromark-core-commonmark/lib/label-start-image.d.ts.map +1 -1
  207. package/node_modules/micromark-core-commonmark/lib/label-start-image.js +11 -3
  208. package/node_modules/micromark-core-commonmark/lib/label-start-link.d.ts.map +1 -1
  209. package/node_modules/micromark-core-commonmark/lib/label-start-link.js +11 -3
  210. package/node_modules/micromark-core-commonmark/lib/partial-non-lazy-continuation.d.ts +4 -0
  211. package/node_modules/micromark-core-commonmark/lib/partial-non-lazy-continuation.d.ts.map +1 -0
  212. package/node_modules/micromark-core-commonmark/lib/partial-non-lazy-continuation.js +61 -0
  213. package/node_modules/micromark-core-commonmark/lib/setext-underline.d.ts.map +1 -1
  214. package/node_modules/micromark-core-commonmark/lib/setext-underline.js +7 -5
  215. package/node_modules/micromark-core-commonmark/package.json +4 -16
  216. package/node_modules/micromark-factory-space/dev/index.d.ts +24 -1
  217. package/node_modules/micromark-factory-space/dev/index.d.ts.map +1 -1
  218. package/node_modules/micromark-factory-space/dev/index.js +58 -3
  219. package/node_modules/micromark-factory-space/index.d.ts +24 -1
  220. package/node_modules/micromark-factory-space/index.d.ts.map +1 -1
  221. package/node_modules/micromark-factory-space/index.js +55 -3
  222. package/node_modules/micromark-factory-space/package.json +1 -10
  223. package/node_modules/micromark-factory-space/readme.md +25 -25
  224. package/node_modules/micromark-util-edit-map/dev/index.d.ts +78 -0
  225. package/node_modules/micromark-util-edit-map/dev/index.d.ts.map +1 -0
  226. package/node_modules/micromark-util-edit-map/dev/index.js +237 -0
  227. package/node_modules/micromark-util-edit-map/index.d.ts +78 -0
  228. package/node_modules/micromark-util-edit-map/index.d.ts.map +1 -0
  229. package/node_modules/micromark-util-edit-map/index.js +225 -0
  230. package/node_modules/micromark-util-edit-map/license +22 -0
  231. package/node_modules/micromark-util-edit-map/package.json +48 -0
  232. package/node_modules/micromark-util-edit-map/readme.md +234 -0
  233. package/node_modules/micromark-util-types/index.d.ts +6 -3
  234. package/node_modules/micromark-util-types/package.json +2 -36
  235. package/node_modules/ws/lib/websocket.js +17 -3
  236. package/node_modules/ws/package.json +1 -1
  237. package/openclaw.plugin.json +3 -6
  238. package/package.json +7 -12
  239. package/dist/.setup/account-inspect-DsER5ILV.mjs +0 -45
  240. package/dist/.setup/provider.runtime-CZ51OIgD.mjs +0 -2
  241. package/dist/.setup/resolve-allowlist-common-BUyU3C-T.mjs +0 -27
  242. package/dist/.setup/resolve-channels-DA6QlhZN.mjs +0 -246
  243. package/dist/.setup/security-contract-DSHk7I2w.mjs +0 -26
  244. package/dist/.setup/setup-plugin-api-BVlCz3fm.mjs +0 -3
  245. package/dist/.setup/targets-bqXQENmX.mjs +0 -3
  246. package/dist/control-ui/2afbdab1d3aa65a789d8a3eba666f4b1ec5df07073538fe30d6cf32093a1fb2d/index.js +0 -1
@@ -1,9 +1,9 @@
1
- import { A as resolveDiscordSendEmbeds, D as createDiscordMessageNonce, E as buildDiscordMessageRequest, M as parseAndResolveChannelRecipient, N as createDiscordClient, O as resolveDiscordMessageFlags, c as resolveChannelId, d as sendDiscordMedia, f as sendDiscordText, i as normalizeDiscordPollInput, j as resolveDiscordSuppressEmbeds, k as resolveDiscordSendComponents, l as resolveDiscordChannel, n as buildDiscordTextChunks, s as normalizeStickerIds, t as buildDiscordSendError } from "./send.shared-C4CN24D9.mjs";
2
- import { C as withDiscordRequestAuthority, st as createThread } from "./discord-9gysrhzp.mjs";
3
- import { a as createReusableDiscordReplyReference, n as createDiscordSendReceiptFromResults, r as createDiscordSendResult } from "./send.receipt-DVOg2Oaw.mjs";
4
- import { a as normalizeDiscordSnowflake, i as normalizeDiscordHandleKey, s as resolveDiscordDirectoryUserId } from "./directory-live-Bipr0eUJ.mjs";
5
- import { normalizeLowercaseStringOrEmpty, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
6
- import { ChannelType, Routes } from "discord-api-types/v10";
1
+ import { A as resolveDiscordSendEmbeds, D as createDiscordMessageNonce, E as buildDiscordMessageRequest, M as parseAndResolveChannelRecipient, N as createDiscordClient, O as resolveDiscordMessageFlags, c as resolveChannelId, d as sendDiscordChunks, f as sendDiscordMedia, i as normalizeDiscordPollInput, j as resolveDiscordSuppressEmbeds, k as resolveDiscordSendComponents, l as resolveDiscordChannel, n as buildDiscordTextChunks, s as normalizeStickerIds, t as buildDiscordSendError } from "./send.shared-CjQ4jbMA.mjs";
2
+ import { W as withDiscordRequestAuthority, ct as createThread, st as createChannelMessage } from "./discord-BGqgx-yd.mjs";
3
+ import { a as createReusableDiscordReplyReference, n as createDiscordSendReceiptFromResults, r as createDiscordSendResult } from "./send.receipt-BAlzXd8e.mjs";
4
+ import { a as normalizeDiscordSnowflake, i as normalizeDiscordHandleKey, s as resolveDiscordDirectoryUserId } from "./directory-live-DLygQVtW.mjs";
5
+ import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
6
+ import { ChannelType } from "discord-api-types/v10";
7
7
  import { requireRuntimeConfig } from "openclaw/plugin-sdk/plugin-config-runtime";
8
8
  import { expectDefined } from "openclaw/plugin-sdk/expect-runtime";
9
9
  import { resolveChunkMode } from "openclaw/plugin-sdk/reply-chunking";
@@ -37,25 +37,22 @@ function resolveConfiguredMentionAlias(handle, mentionAliases) {
37
37
  const alias = normalizeDiscordHandleKey(rawAlias);
38
38
  if (!alias) continue;
39
39
  const aliasWithoutDiscriminator = alias.replace(DISCORD_DISCRIMINATOR_SUFFIX, "");
40
- if (alias === key || withoutDiscriminator && withoutDiscriminator !== key && alias === withoutDiscriminator || aliasWithoutDiscriminator && aliasWithoutDiscriminator !== alias && aliasWithoutDiscriminator === key) {
40
+ if (alias === key || alias === withoutDiscriminator || aliasWithoutDiscriminator === key) {
41
41
  const userId = normalizeDiscordSnowflake(rawUserId);
42
42
  if (userId) return userId;
43
43
  }
44
44
  }
45
45
  }
46
46
  function rewritePlainTextMentions(text, params) {
47
- if (!text.includes("@")) return text;
48
- return text.replace(MENTION_CANDIDATE_PATTERN, (match, prefix, rawHandle) => {
49
- const handle = normalizeOptionalString(rawHandle) ?? "";
50
- if (!handle) return match;
51
- const lookup = normalizeLowercaseStringOrEmpty(handle);
47
+ return text.replace(MENTION_CANDIDATE_PATTERN, (match, prefix, handle) => {
48
+ const lookup = handle.toLowerCase();
52
49
  if (DISCORD_RESERVED_MENTIONS.has(lookup)) return match;
53
50
  const userId = resolveConfiguredMentionAlias(handle, params.mentionAliases) ?? resolveDiscordDirectoryUserId({
54
51
  accountId: params.accountId,
55
52
  handle
56
53
  });
57
54
  if (!userId) return match;
58
- return `${String(prefix ?? "")}${formatMention({ userId })}`;
55
+ return `${prefix}${formatMention({ userId })}`;
59
56
  });
60
57
  }
61
58
  function countBacktickRun(text, index) {
@@ -118,7 +115,6 @@ function findDiscordUrlRanges(markdown) {
118
115
  const ranges = [];
119
116
  for (const match of markdown.matchAll(DISCORD_URL_START_RE)) {
120
117
  const start = match.index;
121
- if (start === void 0) continue;
122
118
  const preceding = markdown[start - 1] ?? "";
123
119
  if (/[\p{L}\p{N}]/u.test(preceding) || preceding === "_" && markdown[start - 2] !== "_") continue;
124
120
  let end = start + match[0].length;
@@ -146,17 +142,15 @@ function markdownSemanticSignature(root) {
146
142
  node: root,
147
143
  parentStrong: false
148
144
  }];
149
- while (pending.length > 0) {
150
- const event = pending.pop();
151
- if (!event) continue;
145
+ for (let event = pending.pop(); event; event = pending.pop()) {
152
146
  if (event.exiting) {
153
147
  parts.push(")");
154
148
  continue;
155
149
  }
156
150
  const { node } = event;
157
151
  const redundantStrong = event.parentStrong && node.type === "strong";
158
- const fields = Object.fromEntries(Object.entries(node).filter(([key]) => key !== "children" && key !== "position"));
159
- const children = node.children ?? [];
152
+ const { children: childNodes, position: _position, ...fields } = node;
153
+ const children = childNodes ?? [];
160
154
  if (!redundantStrong) {
161
155
  parts.push(`(${JSON.stringify(fields)}`);
162
156
  pending.push({
@@ -185,9 +179,7 @@ function normalizeDiscordBold(markdown) {
185
179
  const sourceTree = fromMarkdown(markdown);
186
180
  const activeSpanIds = [];
187
181
  const pending = [{ node: sourceTree }];
188
- while (pending.length > 0) {
189
- const event = pending.pop();
190
- if (!event) continue;
182
+ for (let event = pending.pop(); event; event = pending.pop()) {
191
183
  if (event.exiting !== void 0) {
192
184
  activeSpanIds.pop();
193
185
  continue;
@@ -268,10 +260,10 @@ function normalizeDiscordBold(markdown) {
268
260
  const interiorStart = span.start + 2;
269
261
  strongInteriorStartByEnd.set(span.end, Math.min(strongInteriorStartByEnd.get(span.end) ?? interiorStart, interiorStart));
270
262
  }
271
- const nativeTokenRanges = [...markdown.matchAll(DISCORD_NATIVE_TOKEN_RE)].flatMap((match) => match.index === void 0 ? [] : [{
263
+ const nativeTokenRanges = [...markdown.matchAll(DISCORD_NATIVE_TOKEN_RE)].map((match) => ({
272
264
  start: match.index,
273
265
  end: match.index + match[0].length
274
- }]);
266
+ }));
275
267
  const protectedRanges = [
276
268
  ...findDiscordUrlRanges(markdown),
277
269
  ...astLinkRanges,
@@ -303,9 +295,9 @@ function normalizeDiscordBold(markdown) {
303
295
  }))), ...contentEdits].toSorted((left, right) => left.start - right.start);
304
296
  const editsBySpan = /* @__PURE__ */ new Map();
305
297
  for (const edit of edits) {
306
- const spanEdits = editsBySpan.get(edit.spanId);
307
- if (spanEdits) spanEdits.push(edit);
308
- else editsBySpan.set(edit.spanId, [edit]);
298
+ const spanEdits = editsBySpan.get(edit.spanId) ?? [];
299
+ spanEdits.push(edit);
300
+ editsBySpan.set(edit.spanId, spanEdits);
309
301
  }
310
302
  const renderEdits = (selectedEdits, start = 0, end = markdown.length) => {
311
303
  let cursor = start;
@@ -388,96 +380,105 @@ function isForumLikeChannel(channel) {
388
380
  return channel?.type === ChannelType.GuildForum || channel?.type === ChannelType.GuildMedia;
389
381
  }
390
382
  async function sendMessageDiscord(to, text, opts) {
391
- return await withDiscordRequestAuthority(opts.assertPlatformSendAuthorized, () => sendMessageDiscordInternal(to, text, opts));
392
- }
393
- async function sendMessageDiscordInternal(to, text, opts) {
394
- const cfg = requireRuntimeConfig(opts.cfg, "Discord send");
395
- const { token, rest, request, account: accountInfo } = createDiscordClient({
396
- ...opts,
397
- cfg
398
- });
399
- const chunkMode = opts.chunkMode ?? resolveChunkMode(cfg, "discord", accountInfo.accountId);
400
- const maxLinesPerMessage = opts.maxLinesPerMessage ?? accountInfo.config.maxLinesPerMessage;
401
- const suppressEmbeds = resolveDiscordSuppressEmbeds({
402
- configured: accountInfo.config.suppressEmbeds,
403
- override: opts.suppressEmbeds
404
- });
405
- const mediaMaxBytes = typeof accountInfo.config.mediaMaxMb === "number" ? accountInfo.config.mediaMaxMb * 1024 * 1024 : DEFAULT_DISCORD_MEDIA_MAX_MB * 1024 * 1024;
406
- const { renderedText, textWithMentions, textLimit } = prepareDiscordOutboundText(text ?? "", {
407
- cfg,
408
- account: accountInfo,
409
- tableMode: opts.tableMode,
410
- textLimit: opts.textLimit
411
- });
412
- const recipient = await parseAndResolveChannelRecipient(to, cfg, accountInfo.accountId);
413
- const { channelId } = await resolveChannelId(rest, recipient, request);
414
- const channel = await resolveDiscordChannel(rest, channelId);
415
- const deliveredResults = [];
416
- let deliveryThreadId;
417
- const reportResult = async (progressResult, kind, replyToId) => {
418
- const deliveredResult = createDiscordSendResult({
419
- result: progressResult,
420
- fallbackChannelId: deliveryThreadId ?? channelId,
421
- kind,
422
- threadId: deliveryThreadId,
423
- reply: createReusableDiscordReplyReference(replyToId)
424
- });
425
- deliveredResults.push(deliveredResult);
426
- await opts.onDeliveryResult?.(deliveredResult);
427
- };
428
- const textSendOptions = {
429
- rest,
430
- request,
431
- maxLinesPerMessage,
432
- chunkMode,
433
- silent: opts.silent,
434
- suppressEmbeds,
435
- allowedMentions: opts.allowedMentions,
436
- maxChars: textLimit,
437
- onResult: reportResult,
438
- onPlatformSendDispatch: opts.onPlatformSendDispatch,
439
- assertPlatformSendAuthorized: opts.assertPlatformSendAuthorized
440
- };
441
- const mediaSendOptions = {
442
- filename: opts.filename,
443
- mediaAccess: opts.mediaAccess,
444
- mediaLocalRoots: opts.mediaLocalRoots,
445
- mediaReadFile: opts.mediaReadFile,
446
- maxBytes: mediaMaxBytes
447
- };
448
- if (isForumLikeChannel(channel)) {
449
- if (((channel.flags ?? 0) & DISCORD_FORUM_REQUIRE_TAG_FLAG) !== 0) throw new Error(`Discord forum channel ${channelId} requires an applied tag; use thread-create with appliedTags, then send to the created thread.`);
450
- const threadName = deriveForumThreadName(renderedText);
451
- const chunks = buildDiscordTextChunks(textWithMentions, {
452
- maxLinesPerMessage,
453
- chunkMode,
454
- maxChars: textLimit
383
+ return await withDiscordRequestAuthority(opts.assertPlatformSendAuthorized, async () => {
384
+ const cfg = requireRuntimeConfig(opts.cfg, "Discord send");
385
+ const { token, rest, request, account: accountInfo } = createDiscordClient({
386
+ ...opts,
387
+ cfg
455
388
  });
456
- const starterContent = chunks[0]?.trim() ? chunks[0] : threadName;
457
- const starterComponents = resolveDiscordSendComponents({
458
- components: opts.components,
459
- text: starterContent,
460
- isFirst: true
389
+ const chunkMode = opts.chunkMode ?? resolveChunkMode(cfg, "discord", accountInfo.accountId);
390
+ const maxLinesPerMessage = opts.maxLinesPerMessage ?? accountInfo.config.maxLinesPerMessage;
391
+ const suppressEmbeds = resolveDiscordSuppressEmbeds({
392
+ configured: accountInfo.config.suppressEmbeds,
393
+ override: opts.suppressEmbeds
461
394
  });
462
- const starterEmbeds = resolveDiscordSendEmbeds({
463
- embeds: opts.embeds,
464
- isFirst: true
395
+ const mediaMaxBytes = typeof accountInfo.config.mediaMaxMb === "number" ? accountInfo.config.mediaMaxMb * 1024 * 1024 : DEFAULT_DISCORD_MEDIA_MAX_MB * 1024 * 1024;
396
+ const { renderedText, textWithMentions, textLimit } = prepareDiscordOutboundText(text ?? "", {
397
+ cfg,
398
+ account: accountInfo,
399
+ tableMode: opts.tableMode,
400
+ textLimit: opts.textLimit
465
401
  });
466
- const starterFlags = resolveDiscordMessageFlags({
402
+ const recipient = await parseAndResolveChannelRecipient(to, cfg, accountInfo.accountId);
403
+ const { channelId } = await resolveChannelId(rest, recipient, request);
404
+ const channel = await resolveDiscordChannel(rest, channelId);
405
+ const deliveredResults = [];
406
+ let deliveryThreadId;
407
+ const reportResult = async (progressResult, kind, replyToId) => {
408
+ const deliveredResult = createDiscordSendResult({
409
+ result: progressResult,
410
+ fallbackChannelId: deliveryThreadId ?? channelId,
411
+ kind,
412
+ threadId: deliveryThreadId,
413
+ reply: createReusableDiscordReplyReference(replyToId)
414
+ });
415
+ deliveredResults.push(deliveredResult);
416
+ await opts.onDeliveryResult?.(deliveredResult);
417
+ };
418
+ const textSendOptions = {
419
+ rest,
420
+ request,
421
+ maxLinesPerMessage,
422
+ chunkMode,
467
423
  silent: opts.silent,
468
- suppressEmbeds: suppressEmbeds && !starterEmbeds?.length
469
- });
470
- const starterBody = buildDiscordMessageRequest({
471
- endpoint: "forum-thread",
472
- text: starterContent,
473
- components: starterComponents,
474
- embeds: starterEmbeds,
475
- flags: starterFlags,
476
- allowedMentions: opts.allowedMentions
477
- });
478
- let threadRes;
479
- try {
480
- threadRes = await request(async () => {
424
+ suppressEmbeds,
425
+ allowedMentions: opts.allowedMentions,
426
+ maxChars: textLimit,
427
+ onResult: reportResult,
428
+ onPlatformSendDispatch: opts.onPlatformSendDispatch,
429
+ assertPlatformSendAuthorized: opts.assertPlatformSendAuthorized
430
+ };
431
+ const mediaSendOptions = {
432
+ filename: opts.filename,
433
+ mediaAccess: opts.mediaAccess,
434
+ mediaLocalRoots: opts.mediaLocalRoots,
435
+ mediaReadFile: opts.mediaReadFile,
436
+ maxBytes: mediaMaxBytes
437
+ };
438
+ async function sendWithError(targetChannelId, send) {
439
+ try {
440
+ return await send();
441
+ } catch (err) {
442
+ throw await buildDiscordSendError(err, {
443
+ channelId: targetChannelId,
444
+ cfg,
445
+ rest,
446
+ token,
447
+ hasMedia: Boolean(opts.mediaUrl)
448
+ });
449
+ }
450
+ }
451
+ if (isForumLikeChannel(channel)) {
452
+ if (((channel.flags ?? 0) & DISCORD_FORUM_REQUIRE_TAG_FLAG) !== 0) throw new Error(`Discord forum channel ${channelId} requires an applied tag; use thread-create with appliedTags, then send to the created thread.`);
453
+ const threadName = deriveForumThreadName(renderedText);
454
+ const chunks = buildDiscordTextChunks(textWithMentions, {
455
+ maxLinesPerMessage,
456
+ chunkMode,
457
+ maxChars: textLimit
458
+ });
459
+ const starterContent = chunks[0]?.trim() ? chunks[0] : threadName;
460
+ const starterComponents = resolveDiscordSendComponents({
461
+ components: opts.components,
462
+ text: starterContent,
463
+ isFirst: true
464
+ });
465
+ const starterEmbeds = resolveDiscordSendEmbeds({
466
+ embeds: opts.embeds,
467
+ isFirst: true
468
+ });
469
+ const starterFlags = resolveDiscordMessageFlags({
470
+ silent: opts.silent,
471
+ suppressEmbeds: suppressEmbeds && !starterEmbeds?.length
472
+ });
473
+ const starterBody = buildDiscordMessageRequest({
474
+ endpoint: "forum-thread",
475
+ text: starterContent,
476
+ components: starterComponents,
477
+ embeds: starterEmbeds,
478
+ flags: starterFlags,
479
+ allowedMentions: opts.allowedMentions
480
+ });
481
+ const threadRes = await sendWithError(channelId, () => request(async () => {
481
482
  await opts.onPlatformSendDispatch?.();
482
483
  opts.assertPlatformSendAuthorized?.();
483
484
  return createThread(rest, channelId, { body: {
@@ -485,109 +486,84 @@ async function sendMessageDiscordInternal(to, text, opts) {
485
486
  ...channel.default_auto_archive_duration === void 0 ? {} : { auto_archive_duration: channel.default_auto_archive_duration },
486
487
  message: starterBody
487
488
  } });
488
- }, "forum-thread", { safety: "non-idempotent-create" });
489
- } catch (err) {
490
- throw await buildDiscordSendError(err, {
491
- channelId,
492
- cfg,
493
- rest,
494
- token,
495
- hasMedia: Boolean(opts.mediaUrl)
489
+ }, "forum-thread", { safety: "non-idempotent-create" }));
490
+ const threadId = threadRes.id;
491
+ deliveryThreadId = threadId;
492
+ const messageId = threadRes.message?.id ?? threadId;
493
+ const resultChannelId = threadRes.message?.channel_id ?? threadId;
494
+ const remainingChunks = chunks.slice(1);
495
+ const starterResult = createDiscordSendResult({
496
+ result: {
497
+ id: messageId,
498
+ channel_id: resultChannelId
499
+ },
500
+ fallbackChannelId: channelId,
501
+ kind: "text",
502
+ threadId
496
503
  });
497
- }
498
- const threadId = threadRes.id;
499
- deliveryThreadId = threadId;
500
- const messageId = threadRes.message?.id ?? threadId;
501
- const resultChannelId = threadRes.message?.channel_id ?? threadId;
502
- const remainingChunks = chunks.slice(1);
503
- const starterResult = createDiscordSendResult({
504
- result: {
505
- id: messageId,
506
- channel_id: resultChannelId
507
- },
508
- fallbackChannelId: channelId,
509
- kind: "text",
510
- threadId
511
- });
512
- deliveredResults.push(starterResult);
513
- await opts.onDeliveryResult?.(starterResult);
514
- try {
515
- let textChunks = remainingChunks;
516
- if (opts.mediaUrl) {
517
- const [mediaCaption, ...afterMediaChunks] = remainingChunks;
518
- await sendDiscordMedia({
504
+ deliveredResults.push(starterResult);
505
+ await opts.onDeliveryResult?.(starterResult);
506
+ await sendWithError(threadId, async () => {
507
+ let textChunks = remainingChunks;
508
+ if (opts.mediaUrl) {
509
+ const [mediaCaption, ...afterMediaChunks] = remainingChunks;
510
+ await sendDiscordMedia({
511
+ ...textSendOptions,
512
+ ...mediaSendOptions,
513
+ channelId: threadId,
514
+ text: mediaCaption ?? "",
515
+ mediaUrl: opts.mediaUrl
516
+ });
517
+ textChunks = afterMediaChunks;
518
+ }
519
+ for (const chunk of textChunks) await sendDiscordChunks({
519
520
  ...textSendOptions,
520
- ...mediaSendOptions,
521
521
  channelId: threadId,
522
- text: mediaCaption ?? "",
523
- mediaUrl: opts.mediaUrl
522
+ text: chunk
524
523
  });
525
- textChunks = afterMediaChunks;
526
- }
527
- for (const chunk of textChunks) await sendDiscordText({
528
- ...textSendOptions,
529
- channelId: threadId,
530
- text: chunk
531
524
  });
532
- } catch (err) {
533
- throw await buildDiscordSendError(err, {
534
- channelId: threadId,
535
- cfg,
536
- rest,
537
- token,
538
- hasMedia: Boolean(opts.mediaUrl)
525
+ recordChannelActivity({
526
+ channel: "discord",
527
+ accountId: accountInfo.accountId,
528
+ direction: "outbound"
539
529
  });
530
+ return {
531
+ ...starterResult,
532
+ receipt: createDiscordSendReceiptFromResults({
533
+ results: deliveredResults,
534
+ threadId
535
+ })
536
+ };
540
537
  }
538
+ const result = await sendWithError(channelId, async () => {
539
+ const message = {
540
+ ...textSendOptions,
541
+ channelId,
542
+ text: textWithMentions,
543
+ reply: opts.reply,
544
+ components: opts.components,
545
+ embeds: opts.embeds
546
+ };
547
+ return opts.mediaUrl ? await sendDiscordMedia({
548
+ ...message,
549
+ ...mediaSendOptions,
550
+ mediaUrl: opts.mediaUrl
551
+ }) : await sendDiscordChunks(message);
552
+ });
541
553
  recordChannelActivity({
542
554
  channel: "discord",
543
555
  accountId: accountInfo.accountId,
544
556
  direction: "outbound"
545
557
  });
546
558
  return {
547
- ...starterResult,
548
- receipt: createDiscordSendReceiptFromResults({
549
- results: deliveredResults,
550
- threadId
551
- })
559
+ ...createDiscordSendResult({
560
+ result,
561
+ fallbackChannelId: channelId,
562
+ kind: "text"
563
+ }),
564
+ receipt: createDiscordSendReceiptFromResults({ results: deliveredResults })
552
565
  };
553
- }
554
- let result;
555
- try {
556
- const message = {
557
- ...textSendOptions,
558
- channelId,
559
- text: textWithMentions,
560
- reply: opts.reply,
561
- components: opts.components,
562
- embeds: opts.embeds
563
- };
564
- result = opts.mediaUrl ? await sendDiscordMedia({
565
- ...message,
566
- ...mediaSendOptions,
567
- mediaUrl: opts.mediaUrl
568
- }) : await sendDiscordText(message);
569
- } catch (err) {
570
- throw await buildDiscordSendError(err, {
571
- channelId,
572
- cfg,
573
- rest,
574
- token,
575
- hasMedia: Boolean(opts.mediaUrl)
576
- });
577
- }
578
- recordChannelActivity({
579
- channel: "discord",
580
- accountId: accountInfo.accountId,
581
- direction: "outbound"
582
566
  });
583
- return {
584
- ...createDiscordSendResult({
585
- result,
586
- fallbackChannelId: channelId,
587
- kind: "text"
588
- }),
589
- receipt: createDiscordSendReceiptFromResults({ results: deliveredResults })
590
- };
591
567
  }
592
568
  async function sendStickerDiscord(to, stickerIds, opts) {
593
569
  return sendDiscordStructuredMessage(to, opts, "sticker", () => ({ sticker_ids: normalizeStickerIds(stickerIds) }));
@@ -630,7 +606,7 @@ async function sendDiscordStructuredMessage(to, opts, kind, buildPayload) {
630
606
  const result = await request(async () => {
631
607
  await opts.onPlatformSendDispatch?.();
632
608
  opts.assertPlatformSendAuthorized?.();
633
- return await rest.post(Routes.channelMessages(channelId), { body });
609
+ return createChannelMessage(rest, channelId, { body });
634
610
  }, kind, { safety: "nonce-protected-create" });
635
611
  recordChannelActivity({
636
612
  channel: "discord",