@openclaw/discord 2026.10.10-beta.4 → 2026.10.10

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 (166) hide show
  1. package/dist/.setup/{account-inspect-8cCu6uPG.mjs → account-inspect-X_Xlr42B.mjs} +2 -3
  2. package/dist/.setup/{accounts-ljrzXBJi.mjs → accounts-C18HNgge.mjs} +4 -8
  3. package/dist/.setup/{active-turn-thread-route-C4tp9noA.mjs → active-turn-thread-route-BAc_Xik-.mjs} +1 -2
  4. package/dist/.setup/{allow-list-B_ToXtew.mjs → allow-list-D1ZGfhXh.mjs} +5 -10
  5. package/dist/.setup/{api-CtmE1OUN.mjs → api-Bth1wKF9.mjs} +3 -5
  6. package/dist/.setup/{approval-handler.runtime-BvF8oUpa.mjs → approval-handler.runtime-BAoEELJJ.mjs} +8 -9
  7. package/dist/.setup/{approval-message-updates-wbUqLtLI.mjs → approval-message-updates-Cks-MSCJ.mjs} +3 -4
  8. package/dist/.setup/{audit-UwzCdDJk.mjs → audit-Dw_rAZIz.mjs} +6 -7
  9. package/dist/.setup/{channel-BlvyeRAu.mjs → channel-BMpMAeQL.mjs} +33 -41
  10. package/dist/.setup/{channel-access-DasWY_OV.mjs → channel-access-BPrWoEXM.mjs} +1 -2
  11. package/dist/.setup/{channel.setup-By7wNopw.mjs → channel.setup-DVe7Y3Jf.mjs} +8 -12
  12. package/dist/.setup/{command-deploy-store-DFkBTViB.mjs → command-deploy-store-DPWiBMks.mjs} +1 -2
  13. package/dist/.setup/{command-owners-D78sAoOz.mjs → command-owners-BzlhNBxA.mjs} +2 -3
  14. package/dist/.setup/{components-C_cuoW1q.mjs → components-BvOWSPxr.mjs} +11 -20
  15. package/dist/.setup/{config-schema-_uBILpQf.mjs → config-schema-Coyq5wOr.mjs} +3 -5
  16. package/dist/.setup/{conversation-binding-route-fdYsXexV.mjs → conversation-binding-route-DOPUZNYo.mjs} +2 -3
  17. package/dist/.setup/{directory-config-3iVub-3m.mjs → directory-config-CIqVnQtn.mjs} +3 -4
  18. package/dist/.setup/{directory-live-DLygQVtW.mjs → directory-live-DUuPEWub.mjs} +7 -10
  19. package/dist/.setup/{discord-Cl2OPTZ6.mjs → discord-eFlHX1Gn.mjs} +35 -68
  20. package/dist/.setup/{doctor-94GSI6lY.mjs → doctor-Dty_Ossy.mjs} +8 -9
  21. package/dist/.setup/{doctor-contract-Bwv8EuQ_.mjs → doctor-contract-Dstl3cMg.mjs} +2 -3
  22. package/dist/.setup/{handle-action-0-FZD3Am.mjs → handle-action-DXY91jF-.mjs} +10 -11
  23. package/dist/.setup/{handle-action.guild-admin-DfAWANBE.mjs → handle-action.guild-admin-BvBCfhXF.mjs} +3 -4
  24. package/dist/.setup/{live-policy-config-BPoB3eQi.mjs → live-policy-config-DO1Fk2hp.mjs} +3 -5
  25. package/dist/.setup/{message-handler-CtR2w7W_.mjs → message-handler-fL1j1NiR.mjs} +11 -16
  26. package/dist/.setup/{message-handler.preflight-BqUw7LWb.mjs → message-handler.preflight-DkjwNZAd.mjs} +20 -28
  27. package/dist/.setup/{message-handler.preflight-pluralkit-BU9I_X-b.mjs → message-handler.preflight-pluralkit-DR4BnvMU.mjs} +10 -14
  28. package/dist/.setup/{message-handler.process-BZeWmSNC.mjs → message-handler.process-ClOwIPDK.mjs} +33 -47
  29. package/dist/.setup/{outbound-adapter-DBwgKemw.mjs → outbound-adapter-DWyAWBFh.mjs} +13 -19
  30. package/dist/.setup/{outbound-session-route-CsHHPxsQ.mjs → outbound-session-route-TFBPPkoz.mjs} +21 -32
  31. package/dist/.setup/{output-activity-uBpMSX75.mjs → output-activity-CDgs2s3O.mjs} +1 -2
  32. package/dist/.setup/{pluralkit-B64dfq_j.mjs → pluralkit-DcXbHTpQ.mjs} +2 -3
  33. package/dist/.setup/{preflight-audio-wWgsZG5F.mjs → preflight-audio-CwtPIsvk.mjs} +1 -2
  34. package/dist/.setup/{presence-cache-DCeTsL73.mjs → presence-cache-CgutE4NN.mjs} +1 -2
  35. package/dist/.setup/{probe-D3P1x4aN.mjs → probe-DNge7OEP.mjs} +5 -6
  36. package/dist/.setup/{provider-DUTsZJHz.mjs → provider-BBDuE14w.mjs} +165 -227
  37. package/dist/.setup/{provider-session.runtime-Ucr3XodI.mjs → provider-session.runtime-D8hMXXqJ.mjs} +3 -3
  38. package/dist/.setup/provider.runtime-BQ1z4Aq1.mjs +1 -0
  39. package/dist/.setup/{realtime-session.runtime-bNnPOKP_.mjs → realtime-session.runtime-cetognkp.mjs} +14 -23
  40. package/dist/.setup/{receive-recovery-CKvaG2Hf.mjs → receive-recovery-C77CVdGM.mjs} +3 -6
  41. package/dist/.setup/{resolve-allowlist-common-DNSsUQRF.mjs → resolve-allowlist-common-CI77288n.mjs} +5 -7
  42. package/dist/.setup/{resolve-channels-UdT38DzU.mjs → resolve-channels-DYc6-xgV.mjs} +5 -6
  43. package/dist/.setup/{resolve-users-DnCsrXZ_.mjs → resolve-users-BQT7XWF2.mjs} +4 -5
  44. package/dist/.setup/{rolldown-runtime-B4FMCO8f.mjs → rolldown-runtime-nwUcYXjP.mjs} +1 -2
  45. package/dist/.setup/{runtime-DE6W14G3.mjs → runtime-CI0UJqeS.mjs} +23 -35
  46. package/dist/.setup/{runtime-Cg5pIBm_.mjs → runtime-CcijhTJT.mjs} +4 -6
  47. package/dist/.setup/{runtime-DgnVQ7zW.mjs → runtime-DcBvHOm1.mjs} +1 -2
  48. package/dist/.setup/{runtime-doctor-migrations-BPV-R4G9.mjs → runtime-doctor-migrations-BpV1jKk0.mjs} +5 -9
  49. package/dist/.setup/{secret-config-contract-CIsH7R3B.mjs → secret-config-contract-BdbCvqnM.mjs} +1 -2
  50. package/dist/.setup/{security-audit-BFT84Uny.mjs → security-audit-CTwisG7c.mjs} +3 -4
  51. package/dist/.setup/{security-contract-DNyyjTZZ.mjs → security-contract-D-o0iWDk.mjs} +1 -2
  52. package/dist/.setup/{security-doctor-nGgPm65L.mjs → security-doctor-4s7omTZd.mjs} +1 -2
  53. package/dist/.setup/{send-yR1hfybW.mjs → send-Cbq-IVsS.mjs} +18 -28
  54. package/dist/.setup/{send.components--dxMjc2O.mjs → send.components-BV6ucNpJ.mjs} +10 -13
  55. package/dist/.setup/{send.outbound-B5vQwgUK.mjs → send.outbound-CGhBhzjQ.mjs} +9 -13
  56. package/dist/.setup/{send.receipt-eE3zLTDH.mjs → send.receipt-Dw-_r5Bx.mjs} +17 -19
  57. package/dist/.setup/{send.shared-iGf1rqAm.mjs → send.shared-D4MioxW_.mjs} +14 -23
  58. package/dist/.setup/{sender-identity-BNBvGt1l.mjs → sender-identity-DrN5c4ec.mjs} +2 -3
  59. package/dist/.setup/{session-contract-BO5tlIdl.mjs → session-contract-Bq71MS78.mjs} +1 -2
  60. package/dist/.setup/{session-key-normalization-CCHGNSQw.mjs → session-key-normalization-Cfvze5hd.mjs} +1 -2
  61. package/dist/.setup/setup-plugin-api-B4J6wmL1.mjs +2 -0
  62. package/dist/.setup/{shared-DgzLizSt.mjs → shared-Bp0sxD5R.mjs} +15 -19
  63. package/dist/.setup/{subagent-hooks-tBtaqWkD.mjs → subagent-hooks-mQbDkvuD.mjs} +3 -4
  64. package/dist/.setup/{system-events-DGsxf-l9.mjs → system-events-2zc2eGfF.mjs} +3 -4
  65. package/dist/.setup/{target-parsing-C-HyNxcE.mjs → target-parsing-BiuhcK9Q.mjs} +1 -2
  66. package/dist/.setup/{target-resolver-BFOKmBni.mjs → target-resolver-CAHeVfmZ.mjs} +6 -7
  67. package/dist/.setup/targets-BaklhOqq.mjs +3 -0
  68. package/dist/.setup/{thread-binding-api-BDZJD4na.mjs → thread-binding-api-Drd4Zu-5.mjs} +1 -2
  69. package/dist/.setup/{thread-bindings-Dsc3zsrI.mjs → thread-bindings-Dg7X_ZXP.mjs} +8 -11
  70. package/dist/.setup/{thread-bindings.manager-BMpmKLQh.mjs → thread-bindings.manager-DCDYksah.mjs} +15 -20
  71. package/dist/.setup/{thread-bindings.session-updates-BMdJeJMc.mjs → thread-bindings.session-updates-C76plLS3.mjs} +5 -9
  72. package/dist/.setup/{threading-Cg_QRc8s.mjs → threading-l0UfrE6x.mjs} +6 -9
  73. package/dist/.setup/{timeouts-CuNARfyw.mjs → timeouts-DTrUsJ_W.mjs} +1 -2
  74. package/dist/.setup/{transcripts-source-fRvFsZng.mjs → transcripts-source-CGgOaWcu.mjs} +19 -32
  75. package/dist/.setup/{typing-CNlSKY5S.mjs → typing-DAv4S2fI.mjs} +2 -3
  76. package/dist/.setup/{voice-runtime-DHDNu0fz.mjs → voice-runtime-DY1EwDfi.mjs} +33 -55
  77. package/dist/.source-module-urls/d6c089460280c5a04184542d6712e04545caeb1ebb290d3504377b4cc5e22fea.json +1 -1
  78. package/dist/account-inspect-api.js +2 -3
  79. package/dist/action-runtime-api.js +1 -1
  80. package/dist/activities-api.js +13 -20
  81. package/dist/api.js +21 -22
  82. package/dist/assets/embedded-app-sdk.mjs +1 -1
  83. package/dist/channel-config-api.js +1 -1
  84. package/dist/channel-plugin-api.js +1 -1
  85. package/dist/contract-api.js +1 -1
  86. package/dist/directory-contract-api.js +2 -3
  87. package/dist/doctor-contract-api.js +5 -7
  88. package/dist/index.js +1 -2
  89. package/dist/runtime-api.js +22 -22
  90. package/dist/runtime-setter-api.js +1 -1
  91. package/dist/secret-contract-api.js +1 -1
  92. package/dist/security-audit-contract-api.js +1 -1
  93. package/dist/security-contract-api.js +1 -1
  94. package/dist/session-key-api.js +1 -1
  95. package/dist/setup-entry.js +2 -3
  96. package/dist/setup-plugin-api.js +1 -1
  97. package/dist/src/voice/audio-worker.runtime.js +8 -14
  98. package/dist/subagent-hooks-api.js +2 -3
  99. package/dist/thread-binding-api.js +1 -1
  100. package/dist/transcripts-source-api.js +2 -3
  101. package/node_modules/@discord/embedded-app-sdk/output/lib/zod/lib/index.cjs +3 -2
  102. package/node_modules/@discord/embedded-app-sdk/output/lib/zod/lib/index.mjs +3 -2
  103. package/node_modules/undici/README.md +25 -3
  104. package/node_modules/undici/docs/docs/api/CacheStore.md +24 -9
  105. package/node_modules/undici/docs/docs/api/Client.md +11 -6
  106. package/node_modules/undici/docs/docs/api/Dispatcher.md +3 -0
  107. package/node_modules/undici/docs/docs/api/Errors.md +76 -1
  108. package/node_modules/undici/docs/docs/api/H2CClient.md +3 -2
  109. package/node_modules/undici/docs/docs/api/Interceptors.md +13 -6
  110. package/node_modules/undici/docs/docs/api/RedirectHandler.md +13 -10
  111. package/node_modules/undici/docs/docs/index.md +12 -12
  112. package/node_modules/undici/docs/docs/type-map.json +66 -66
  113. package/node_modules/undici/lib/cache/memory-cache-store.js +48 -13
  114. package/node_modules/undici/lib/cache/sqlite-cache-store.js +83 -5
  115. package/node_modules/undici/lib/core/connect.js +10 -4
  116. package/node_modules/undici/lib/core/constants.js +12 -1
  117. package/node_modules/undici/lib/core/errors.js +38 -1
  118. package/node_modules/undici/lib/core/request.js +16 -1
  119. package/node_modules/undici/lib/core/symbols.js +2 -0
  120. package/node_modules/undici/lib/core/util.js +26 -1
  121. package/node_modules/undici/lib/dispatcher/agent.js +6 -2
  122. package/node_modules/undici/lib/dispatcher/client-h1.js +116 -80
  123. package/node_modules/undici/lib/dispatcher/client-h2.js +46 -14
  124. package/node_modules/undici/lib/dispatcher/client.js +4 -1
  125. package/node_modules/undici/lib/dispatcher/dispatcher-base.js +3 -2
  126. package/node_modules/undici/lib/dispatcher/dispatcher1-wrapper.js +20 -3
  127. package/node_modules/undici/lib/dispatcher/parser-h1.js +1064 -0
  128. package/node_modules/undici/lib/dispatcher/pool-base.js +65 -28
  129. package/node_modules/undici/lib/dispatcher/pool.js +11 -8
  130. package/node_modules/undici/lib/dispatcher/proxy-agent.js +18 -8
  131. package/node_modules/undici/lib/dispatcher/retry-agent.js +10 -0
  132. package/node_modules/undici/lib/dispatcher/round-robin-pool.js +15 -5
  133. package/node_modules/undici/lib/handler/cache-handler.js +153 -15
  134. package/node_modules/undici/lib/handler/deduplication-handler.js +112 -51
  135. package/node_modules/undici/lib/handler/redirect-handler.js +28 -8
  136. package/node_modules/undici/lib/handler/retry-handler.js +44 -11
  137. package/node_modules/undici/lib/interceptor/cache.js +11 -3
  138. package/node_modules/undici/lib/interceptor/decompress.js +22 -9
  139. package/node_modules/undici/lib/interceptor/dns.js +11 -0
  140. package/node_modules/undici/lib/interceptor/response-error.js +72 -28
  141. package/node_modules/undici/lib/milo/LICENSE.md +7 -0
  142. package/node_modules/undici/lib/milo/no-simd.js +1002 -0
  143. package/node_modules/undici/lib/milo/simd.js +1002 -0
  144. package/node_modules/undici/lib/mock/mock-agent.js +11 -0
  145. package/node_modules/undici/lib/mock/snapshot-recorder.js +3 -2
  146. package/node_modules/undici/lib/mock/snapshot-utils.js +3 -2
  147. package/node_modules/undici/lib/util/cache.js +11 -5
  148. package/node_modules/undici/lib/web/cookies/util.js +19 -2
  149. package/node_modules/undici/lib/web/eventsource/eventsource-stream.js +69 -15
  150. package/node_modules/undici/lib/web/eventsource/eventsource.js +25 -2
  151. package/node_modules/undici/lib/web/fetch/body.js +47 -38
  152. package/node_modules/undici/lib/web/fetch/formdata-parser.js +12 -4
  153. package/node_modules/undici/lib/web/fetch/headers.js +2 -2
  154. package/node_modules/undici/lib/web/fetch/index.js +8 -4
  155. package/node_modules/undici/lib/web/subresource-integrity/subresource-integrity.js +5 -5
  156. package/node_modules/undici/lib/web/websocket/receiver.js +25 -4
  157. package/node_modules/undici/package.json +7 -5
  158. package/node_modules/undici/types/cache-interceptor.d.ts +10 -0
  159. package/node_modules/undici/types/client.d.ts +10 -4
  160. package/node_modules/undici/types/errors.d.ts +16 -1
  161. package/node_modules/undici/types/h2c-client.d.ts +1 -1
  162. package/node_modules/undici/types/interceptors.d.ts +6 -1
  163. package/package.json +5 -5
  164. package/dist/.setup/provider.runtime-J8NuMCNs.mjs +0 -1
  165. package/dist/.setup/setup-plugin-api-DVpA_yqS.mjs +0 -2
  166. package/dist/.setup/targets-UbCpek5o.mjs +0 -3
@@ -1,28 +1,28 @@
1
- import { g as resolveDiscordToken, h as normalizeDiscordToken, l as resolveDiscordAccount, m as resolveDiscordMaxLinesPerMessage, p as resolveDiscordAccountDmPolicy, s as mergeDiscordAccountConfig, u as resolveDiscordAccountAllowFrom } from "./accounts-ljrzXBJi.mjs";
2
- import { A as isDiscordThreadChannelType, D as getDiscordEndpointRuntime, E as assertDiscordEndpointGatewayUrl, S as formatDiscordUserTag, _ as resolveDiscordOwnerAllowFrom, a as normalizeDiscordDisplaySlug, b as shouldEmitDiscordReactionNotification, c as resolveDiscordChannelConfig, f as resolveDiscordGuildEntry, g as resolveDiscordOwnerAccess, i as normalizeDiscordAllowList, l as resolveDiscordChannelConfigWithFallback, m as resolveDiscordMemberAllowed, n as hasConfiguredDiscordChannels, o as normalizeDiscordSlug, p as resolveDiscordMemberAccessState, r as isDiscordGroupAllowedByPolicy, s as resolveDiscordAllowListMatch, u as resolveDiscordChannelPolicyCommandAuthorizer, w as resolveTimestampMs, x as formatDiscordReactionEmoji, y as resolveGroupDmAllow } from "./allow-list-B_ToXtew.mjs";
3
- import { B as validateDiscordProxyUrl, C as hasAnyChannelPermissionDiscord, G as unregisterGateway, P as createDiscordRestClient, R as DISCORD_REST_TIMEOUT_MS, V as withValidatedDiscordProxy, W as registerGateway, y as canViewDiscordGuildChannel } from "./send.shared-iGf1rqAm.mjs";
4
- import { i as setPresence, t as clearPresences } from "./presence-cache-DCeTsL73.mjs";
5
- import { $ as User, A as StringSelectMenu, D as Row, F as Plugin, K as hasDiscordV2Components, P as Client, Q as Message, R as RateLimitError, X as CommandWithSubcommands, Y as Command, Z as Guild, a as MessageCreateListener, c as PresenceUpdateListener, d as ThreadUpdateListener, et as BaseMessageInteractiveComponent, h as Modal, i as InteractionCreateListener, j as TextDisplay, k as Separator, l as ReadyListener, n as GuildCreateListener, o as MessageReactionAddListener, r as GuildDeleteListener, s as MessageReactionRemoveListener, t as discord_exports, u as ThreadDeleteListener, x as Container, y as Button } from "./discord-Cl2OPTZ6.mjs";
6
- import { v as chunkDiscordTextWithMode } from "./send.receipt-eE3zLTDH.mjs";
7
- import { a as isDiscordRateLimitResponseBody, s as summarizeDiscordResponseBody } from "./api-CtmE1OUN.mjs";
8
- import { _ as readMessagesDiscord, s as sendVoiceMessageDiscord } from "./send-yR1hfybW.mjs";
9
- import { s as formatMention, t as sendMessageDiscord } from "./send.outbound-B5vQwgUK.mjs";
10
- import { l as withAbortTimeout } from "./timeouts-CuNARfyw.mjs";
11
- import { C as parseDiscordActivityCustomIdForInteraction, D as parseDiscordModalCustomIdForInteraction, E as parseDiscordModalCustomId, O as decodeCustomIdComponent, T as parseDiscordComponentCustomIdForInteraction, c as parseExecApprovalData, d as buildDiscordComponentMessage, k as encodeCustomIdComponent, o as parseDiscordQuestionData, w as parseDiscordComponentCustomId, y as buildDiscordActivityCustomId } from "./components-C_cuoW1q.mjs";
12
- import { a as registerDiscordComponentEntries, o as resolveDiscordComponentEntryWithPersistence, s as resolveDiscordModalEntryWithPersistence, t as editDiscordComponentMessage } from "./send.components--dxMjc2O.mjs";
13
- import { t as getDiscordRuntime } from "./runtime-DgnVQ7zW.mjs";
14
- import { n as getDiscordActivitiesRuntime } from "./runtime-Cg5pIBm_.mjs";
15
- import { t as resolveDiscordCommandOwnerAllowFrom } from "./command-owners-D78sAoOz.mjs";
16
- import { A as isDiscordExecApprovalClientEnabled, O as getDiscordExecApprovalApprovers, a as resolveDiscordComponentSpec, c as formatDiscordApprovalDisplayValue, d as setDiscordChannelPolicyBindings, f as buildDiscordConversationRouteContext, g as resolveDiscordEffectiveRoute, m as resolveDiscordBoundConversationRoute, n as DISCORD_PRESENTATION_CAPABILITIES, p as buildDiscordRoutePeer, r as buildDiscordPresentationPayload, s as DISCORD_APPROVAL_ALLOWED_MENTIONS, v as resolveDiscordConversationIdentity } from "./outbound-session-route-CsHHPxsQ.mjs";
17
- import { n as discordIngressIdentity, t as selectDiscordLivePolicyConfig } from "./live-policy-config-BPoB3eQi.mjs";
18
- import { t as resolveDiscordChannelAllowlist } from "./resolve-channels-UdT38DzU.mjs";
19
- import { t as resolveDiscordUserAllowlist } from "./resolve-users-DnCsrXZ_.mjs";
20
- import { a as isThreadArchived, n as getThreadBindingManager } from "./thread-bindings.manager-BMpmKLQh.mjs";
21
- import { n as resolveDiscordChannelInfoSafe, o as resolveDiscordChannelTopicSafe, r as resolveDiscordChannelNameSafe } from "./channel-access-DasWY_OV.mjs";
22
- import { a as probeDiscordApplicationId, r as parseApplicationIdFromToken } from "./probe-D3P1x4aN.mjs";
23
- import { O as resolveDiscordReferencedReplyMessage, a as authorizeDiscordVoiceIngress, c as resolveDiscordVoiceEnabled, i as setDiscordTranscriptsVoiceManager, k as resolveDiscordReferencedReplyMessageId, l as resolveDiscordThreadLikeChannelContext, o as resolveDiscordVoiceAccess, u as resolveFetchedDiscordThreadLikeChannelContext } from "./transcripts-source-fRvFsZng.mjs";
24
- import { t as resolveDiscordSenderIdentity } from "./sender-identity-BNBvGt1l.mjs";
25
- import { n as hasDiscordApprovalControl, t as discordApprovalMessageUpdates } from "./approval-message-updates-wbUqLtLI.mjs";
1
+ import { g as resolveDiscordToken, h as normalizeDiscordToken, l as resolveDiscordAccount, m as resolveDiscordMaxLinesPerMessage, p as resolveDiscordAccountDmPolicy, s as mergeDiscordAccountConfig, u as resolveDiscordAccountAllowFrom } from "./accounts-C18HNgge.mjs";
2
+ import { A as isDiscordThreadChannelType, D as getDiscordEndpointRuntime, E as assertDiscordEndpointGatewayUrl, S as formatDiscordUserTag, _ as resolveDiscordOwnerAllowFrom, a as normalizeDiscordDisplaySlug, b as shouldEmitDiscordReactionNotification, c as resolveDiscordChannelConfig, f as resolveDiscordGuildEntry, g as resolveDiscordOwnerAccess, i as normalizeDiscordAllowList, l as resolveDiscordChannelConfigWithFallback, m as resolveDiscordMemberAllowed, n as hasConfiguredDiscordChannels, o as normalizeDiscordSlug, p as resolveDiscordMemberAccessState, r as isDiscordGroupAllowedByPolicy, s as resolveDiscordAllowListMatch, u as resolveDiscordChannelPolicyCommandAuthorizer, w as resolveTimestampMs, x as formatDiscordReactionEmoji, y as resolveGroupDmAllow } from "./allow-list-D1ZGfhXh.mjs";
3
+ import { B as validateDiscordProxyUrl, C as hasAnyChannelPermissionDiscord, G as unregisterGateway, P as createDiscordRestClient, R as DISCORD_REST_TIMEOUT_MS, V as withValidatedDiscordProxy, W as registerGateway, y as canViewDiscordGuildChannel } from "./send.shared-D4MioxW_.mjs";
4
+ import { i as setPresence, t as clearPresences } from "./presence-cache-CgutE4NN.mjs";
5
+ import { $ as User, A as StringSelectMenu, D as Row, F as Plugin, K as hasDiscordV2Components, P as Client, Q as Message, R as RateLimitError, X as CommandWithSubcommands, Y as Command, Z as Guild, a as MessageCreateListener, c as PresenceUpdateListener, d as ThreadUpdateListener, et as BaseMessageInteractiveComponent, h as Modal, i as InteractionCreateListener, j as TextDisplay, k as Separator, l as ReadyListener, n as GuildCreateListener, o as MessageReactionAddListener, r as GuildDeleteListener, s as MessageReactionRemoveListener, t as discord_exports, u as ThreadDeleteListener, x as Container, y as Button } from "./discord-eFlHX1Gn.mjs";
6
+ import { v as chunkDiscordTextWithMode } from "./send.receipt-Dw-_r5Bx.mjs";
7
+ import { a as isDiscordRateLimitResponseBody, s as summarizeDiscordResponseBody } from "./api-Bth1wKF9.mjs";
8
+ import { _ as readMessagesDiscord, s as sendVoiceMessageDiscord } from "./send-Cbq-IVsS.mjs";
9
+ import { s as formatMention, t as sendMessageDiscord } from "./send.outbound-CGhBhzjQ.mjs";
10
+ import { l as withAbortTimeout } from "./timeouts-DTrUsJ_W.mjs";
11
+ import { C as parseDiscordActivityCustomIdForInteraction, D as parseDiscordModalCustomIdForInteraction, E as parseDiscordModalCustomId, O as decodeCustomIdComponent, T as parseDiscordComponentCustomIdForInteraction, c as parseExecApprovalData, d as buildDiscordComponentMessage, k as encodeCustomIdComponent, o as parseDiscordQuestionData, w as parseDiscordComponentCustomId, y as buildDiscordActivityCustomId } from "./components-BvOWSPxr.mjs";
12
+ import { a as registerDiscordComponentEntries, o as resolveDiscordComponentEntryWithPersistence, s as resolveDiscordModalEntryWithPersistence, t as editDiscordComponentMessage } from "./send.components-BV6ucNpJ.mjs";
13
+ import { t as getDiscordRuntime } from "./runtime-DcBvHOm1.mjs";
14
+ import { n as getDiscordActivitiesRuntime } from "./runtime-CcijhTJT.mjs";
15
+ import { t as resolveDiscordCommandOwnerAllowFrom } from "./command-owners-BzlhNBxA.mjs";
16
+ import { A as isDiscordExecApprovalClientEnabled, O as getDiscordExecApprovalApprovers, a as resolveDiscordComponentSpec, c as formatDiscordApprovalDisplayValue, d as setDiscordChannelPolicyBindings, f as buildDiscordConversationRouteContext, g as resolveDiscordEffectiveRoute, m as resolveDiscordBoundConversationRoute, n as DISCORD_PRESENTATION_CAPABILITIES, p as buildDiscordRoutePeer, r as buildDiscordPresentationPayload, s as DISCORD_APPROVAL_ALLOWED_MENTIONS, v as resolveDiscordConversationIdentity } from "./outbound-session-route-TFBPPkoz.mjs";
17
+ import { n as discordIngressIdentity, t as selectDiscordLivePolicyConfig } from "./live-policy-config-DO1Fk2hp.mjs";
18
+ import { t as resolveDiscordChannelAllowlist } from "./resolve-channels-DYc6-xgV.mjs";
19
+ import { t as resolveDiscordUserAllowlist } from "./resolve-users-BQT7XWF2.mjs";
20
+ import { a as isThreadArchived, n as getThreadBindingManager } from "./thread-bindings.manager-DCDYksah.mjs";
21
+ import { n as resolveDiscordChannelInfoSafe, o as resolveDiscordChannelTopicSafe, r as resolveDiscordChannelNameSafe } from "./channel-access-BPrWoEXM.mjs";
22
+ import { a as probeDiscordApplicationId, r as parseApplicationIdFromToken } from "./probe-DNge7OEP.mjs";
23
+ import { O as resolveDiscordReferencedReplyMessage, a as authorizeDiscordVoiceIngress, c as resolveDiscordVoiceEnabled, i as setDiscordTranscriptsVoiceManager, k as resolveDiscordReferencedReplyMessageId, l as resolveDiscordThreadLikeChannelContext, o as resolveDiscordVoiceAccess, u as resolveFetchedDiscordThreadLikeChannelContext } from "./transcripts-source-CGgOaWcu.mjs";
24
+ import { t as resolveDiscordSenderIdentity } from "./sender-identity-DrN5c4ec.mjs";
25
+ import { n as hasDiscordApprovalControl, t as discordApprovalMessageUpdates } from "./approval-message-updates-Cks-MSCJ.mjs";
26
26
  import { createRequire } from "node:module";
27
27
  import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
28
28
  import { PlatformMessageNotDispatchedError, formatErrorMessage, toErrorObject } from "openclaw/plugin-sdk/error-runtime";
@@ -90,7 +90,7 @@ import { createChannelInteractiveDispatcher } from "openclaw/plugin-sdk/plugin-r
90
90
  import { resolveApprovalOverGateway } from "openclaw/plugin-sdk/approval-gateway-runtime";
91
91
  import { Agent } from "node:https";
92
92
  import { reportChannelRoomJoin } from "openclaw/plugin-sdk/channel-join-intro-runtime";
93
- //#region extensions/discord/src/monitor/listeners.queue.ts
93
+ // extensions/discord/src/monitor/listeners.queue.ts
94
94
  const DISCORD_SLOW_LISTENER_THRESHOLD_MS = 3e4;
95
95
  const discordEventQueueLog = createSubsystemLogger("discord/event-queue");
96
96
  function formatListenerContextValue(value) {
@@ -144,8 +144,7 @@ async function runDiscordListenerWithSlowLog(params) {
144
144
  });
145
145
  }
146
146
  }
147
- //#endregion
148
- //#region extensions/discord/src/monitor/presence-events.ts
147
+ // extensions/discord/src/monitor/presence-events.ts
149
148
  const DISCORD_PRESENCE_GREETING_COOLDOWN_MS = 288e5;
150
149
  function isDiscordOnlineStatus(status) {
151
150
  return status === "online" || status === "idle" || status === "dnd";
@@ -172,8 +171,7 @@ function resolveDiscordOnlinePresenceEvent(params) {
172
171
  text: lines.join("\n")
173
172
  };
174
173
  }
175
- //#endregion
176
- //#region extensions/discord/src/monitor/presence-cooldown-store.ts
174
+ // extensions/discord/src/monitor/presence-cooldown-store.ts
177
175
  const DISCORD_PRESENCE_COOLDOWN_MAX_ENTRIES = 25e3;
178
176
  function openDiscordPresenceCooldownStore() {
179
177
  return getDiscordRuntime().state.openKeyedStore({
@@ -183,8 +181,7 @@ function openDiscordPresenceCooldownStore() {
183
181
  defaultTtlMs: DISCORD_PRESENCE_GREETING_COOLDOWN_MS
184
182
  });
185
183
  }
186
- //#endregion
187
- //#region extensions/discord/src/monitor/presence-emission-gate.ts
184
+ // extensions/discord/src/monitor/presence-emission-gate.ts
188
185
  const DISCORD_PRESENCE_RECONNECT_SUPPRESS_MS = 3e5;
189
186
  const DISCORD_PRESENCE_BURST_LIMIT = 8;
190
187
  const DISCORD_PRESENCE_BURST_WINDOW_MS = 6e4;
@@ -262,8 +259,7 @@ var DiscordPresenceEmissionGate = class {
262
259
  if (state.reservations.length === 0 && !state.logged) this.burstByGuild.delete(guildId);
263
260
  }
264
261
  };
265
- //#endregion
266
- //#region extensions/discord/src/monitor/presence-transition-cache.ts
262
+ // extensions/discord/src/monitor/presence-transition-cache.ts
267
263
  const DEFAULT_PRESENCE_BASELINE_MAX_ENTRIES = 75e3;
268
264
  var DiscordPresenceBaselineCache = class {
269
265
  constructor(maxEntries = DEFAULT_PRESENCE_BASELINE_MAX_ENTRIES) {
@@ -308,8 +304,7 @@ var DiscordPresenceBaselineCache = class {
308
304
  return evictedScope;
309
305
  }
310
306
  };
311
- //#endregion
312
- //#region extensions/discord/src/monitor/thread-session-close.ts
307
+ // extensions/discord/src/monitor/thread-session-close.ts
313
308
  /**
314
309
  * Closes every session entry in the store whose key contains {@link threadId}.
315
310
  * The explicit lifecycle deletion archives the old transcript and guarantees
@@ -339,8 +334,7 @@ async function closeDiscordThreadSessions(params) {
339
334
  }
340
335
  return resetCount;
341
336
  }
342
- //#endregion
343
- //#region extensions/discord/src/monitor/dm-command-auth.ts
337
+ // extensions/discord/src/monitor/dm-command-auth.ts
344
338
  const DISCORD_CHANNEL_ID = "discord";
345
339
  function createDiscordDmIngressSubject(sender) {
346
340
  return {
@@ -447,8 +441,7 @@ async function resolveDiscordTextCommandAccess(params) {
447
441
  }
448
442
  });
449
443
  }
450
- //#endregion
451
- //#region extensions/discord/src/monitor/listeners.reactions.ts
444
+ // extensions/discord/src/monitor/listeners.reactions.ts
452
445
  var DiscordReactionListener = class extends MessageReactionAddListener {
453
446
  constructor(params) {
454
447
  super();
@@ -715,8 +708,7 @@ async function handleDiscordReactionEvent(params) {
715
708
  params.logger.error(danger(`discord reaction handler failed: ${String(err)}`));
716
709
  }
717
710
  }
718
- //#endregion
719
- //#region extensions/discord/src/monitor/listeners.ts
711
+ // extensions/discord/src/monitor/listeners.ts
720
712
  function registerDiscordListener(listeners, listener) {
721
713
  if (listeners.some((existing) => existing.constructor === listener.constructor)) return false;
722
714
  listeners.push(listener);
@@ -1113,8 +1105,7 @@ var DiscordThreadDeleteListener = class extends ThreadDeleteListener {
1113
1105
  });
1114
1106
  }
1115
1107
  };
1116
- //#endregion
1117
- //#region extensions/discord/src/internal/gateway-dispatch.ts
1108
+ // extensions/discord/src/internal/gateway-dispatch.ts
1118
1109
  function dispatchVoiceGatewayEvent(client, payload) {
1119
1110
  const guildId = readGuildId(payload.d);
1120
1111
  if (!guildId) return;
@@ -1164,8 +1155,7 @@ function createReactionDispatchData(client, data) {
1164
1155
  function readGuildId(data) {
1165
1156
  return data && typeof data === "object" && typeof data.guild_id === "string" ? data.guild_id : void 0;
1166
1157
  }
1167
- //#endregion
1168
- //#region extensions/discord/src/monitor/provider.allowlist.ts
1158
+ // extensions/discord/src/monitor/provider.allowlist.ts
1169
1159
  function formatResolutionLogDetails(base, details) {
1170
1160
  const nonEmpty = details.map((value) => value?.trim()).filter((value) => Boolean(value));
1171
1161
  return nonEmpty.length > 0 ? `${base} (${nonEmpty.join("; ")})` : base;
@@ -1388,8 +1378,7 @@ async function resolveDiscordAllowlistConfig(params) {
1388
1378
  allowFrom
1389
1379
  };
1390
1380
  }
1391
- //#endregion
1392
- //#region extensions/discord/src/network-config.ts
1381
+ // extensions/discord/src/network-config.ts
1393
1382
  const DISCORD_DNS_HOSTS = [
1394
1383
  "discord.com",
1395
1384
  "discord.gg",
@@ -1443,8 +1432,7 @@ function createDiscordEndpointDnsLookup(endpointHostname) {
1443
1432
  });
1444
1433
  };
1445
1434
  }
1446
- //#endregion
1447
- //#region extensions/discord/src/monitor/rest-fetch.ts
1435
+ // extensions/discord/src/monitor/rest-fetch.ts
1448
1436
  const discordDnsLookup$1 = createDiscordDnsLookup();
1449
1437
  function createEnvProxyDiscordRestDispatcher(runtime) {
1450
1438
  const envProxyOptions = resolveEnvHttpProxyAgentOptions();
@@ -1486,8 +1474,7 @@ function resolveDiscordRestFetch(proxyUrl, runtime) {
1486
1474
  }
1487
1475
  return createDiscordRestFetchWithDispatcher(createEnvProxyDiscordRestDispatcher(runtime) ?? createHttp1Agent({ connect: { lookup: discordDnsLookup$1 } }));
1488
1476
  }
1489
- //#endregion
1490
- //#region extensions/discord/src/monitor/live-policy.ts
1477
+ // extensions/discord/src/monitor/live-policy.ts
1491
1478
  /** One reader belongs to one admitted account; transport and lifetime remain its startup owners. */
1492
1479
  function createDiscordLivePolicyReader(params) {
1493
1480
  const readConfig = params.readConfig ?? createRuntimeConfigReader(params.cfg);
@@ -1585,8 +1572,7 @@ function createDiscordLivePolicyReader(params) {
1585
1572
  }
1586
1573
  };
1587
1574
  }
1588
- //#endregion
1589
- //#region extensions/discord/src/monitor/dm-command-decision.ts
1575
+ // extensions/discord/src/monitor/dm-command-decision.ts
1590
1576
  async function handleDiscordDmCommandDecision(params) {
1591
1577
  if (params.senderAccess.decision === "allow") return true;
1592
1578
  if (params.senderAccess.decision === "pairing") {
@@ -1615,8 +1601,7 @@ async function handleDiscordDmCommandDecision(params) {
1615
1601
  await params.onUnauthorized();
1616
1602
  return false;
1617
1603
  }
1618
- //#endregion
1619
- //#region extensions/discord/src/monitor/live-policy-interaction.ts
1604
+ // extensions/discord/src/monitor/live-policy-interaction.ts
1620
1605
  const INTERACTION_POLICY_WAIT_MS = 1e3;
1621
1606
  async function readDiscordInteractionPolicy(readPolicy) {
1622
1607
  const timeout = /* @__PURE__ */ new Error("Discord interaction access policy resolution timed out");
@@ -1627,8 +1612,7 @@ async function readDiscordInteractionPolicy(readPolicy) {
1627
1612
  return null;
1628
1613
  }
1629
1614
  }
1630
- //#endregion
1631
- //#region extensions/discord/src/monitor/native-command-reply.ts
1615
+ // extensions/discord/src/monitor/native-command-reply.ts
1632
1616
  const DISCORD_EMPTY_VISIBLE_REPLY_WARNING = "⚠️ Command produced no visible reply.";
1633
1617
  /** Retain visible component text, not interaction IDs or option values. */
1634
1618
  function formatDiscordCommandComponents(components) {
@@ -1769,8 +1753,7 @@ async function deliverDiscordInteractionReply(params) {
1769
1753
  if (payloadDelivered && params.onDelivered) await params.onDelivered(deliveredText?.filter(Boolean).join("\n") ?? "");
1770
1754
  return payloadDelivered;
1771
1755
  }
1772
- //#endregion
1773
- //#region extensions/discord/src/monitor/native-command-agent-reply.ts
1756
+ // extensions/discord/src/monitor/native-command-agent-reply.ts
1774
1757
  async function dispatchDiscordNativeAgentReply(params) {
1775
1758
  const blockStreamingEnabled = resolveChannelStreamingBlockEnabled(params.discordConfig);
1776
1759
  let didReply = false;
@@ -1846,13 +1829,11 @@ async function dispatchDiscordNativeAgentReply(params) {
1846
1829
  }));
1847
1830
  return dispatchResult;
1848
1831
  }
1849
- //#endregion
1850
- //#region extensions/discord/src/monitor/commands.ts
1832
+ // extensions/discord/src/monitor/commands.ts
1851
1833
  function resolveDiscordSlashCommandConfig(raw) {
1852
1834
  return { ephemeral: raw?.ephemeral !== false };
1853
1835
  }
1854
- //#endregion
1855
- //#region extensions/discord/src/monitor/native-command-arg-ui.ts
1836
+ // extensions/discord/src/monitor/native-command-arg-ui.ts
1856
1837
  const DISCORD_COMMAND_ARG_CUSTOM_ID_KEY = "cmdarg";
1857
1838
  function buildDiscordCommandArgCustomId(params) {
1858
1839
  return [
@@ -1964,8 +1945,7 @@ function createDiscordCommandArgFallbackButton$1(params) {
1964
1945
  style: ButtonStyle.Primary
1965
1946
  });
1966
1947
  }
1967
- //#endregion
1968
- //#region extensions/discord/src/monitor/inbound-context.ts
1948
+ // extensions/discord/src/monitor/inbound-context.ts
1969
1949
  function createDiscordSupplementalContextAccessChecker(params) {
1970
1950
  const userAllowList = params.channelConfig?.users ?? params.guildInfo?.users ?? [];
1971
1951
  const roleAllowList = params.channelConfig?.roles ?? params.guildInfo?.roles ?? [];
@@ -2004,8 +1984,7 @@ function buildDiscordInboundAccessContext(params) {
2004
1984
  ownerAllowFrom: resolveDiscordOwnerAllowFrom(params)
2005
1985
  };
2006
1986
  }
2007
- //#endregion
2008
- //#region extensions/discord/src/monitor/native-command-context.ts
1987
+ // extensions/discord/src/monitor/native-command-context.ts
2009
1988
  async function buildDiscordNativeCommandContext(params) {
2010
1989
  const conversationLabel = params.isDirectMessage ? params.user.globalName ?? params.user.username : params.channelId;
2011
1990
  const { groupSystemPrompt, ownerAllowFrom, channelStructuredContext } = buildDiscordInboundAccessContext(params);
@@ -2139,8 +2118,7 @@ async function buildDiscordNativeInteractionContext(params) {
2139
2118
  ...targets
2140
2119
  };
2141
2120
  }
2142
- //#endregion
2143
- //#region extensions/discord/src/monitor/native-command-route.ts
2121
+ // extensions/discord/src/monitor/native-command-route.ts
2144
2122
  function resolveDiscordNativeInteractionRouteState(params) {
2145
2123
  const route = resolveDiscordBoundConversationRoute(params);
2146
2124
  const configuredRoute = params.threadBinding == null ? resolveConfiguredBindingRoute({
@@ -2167,8 +2145,7 @@ function resolveDiscordNativeInteractionRouteState(params) {
2167
2145
  configuredBinding
2168
2146
  };
2169
2147
  }
2170
- //#endregion
2171
- //#region extensions/discord/src/monitor/native-interaction-channel-context.ts
2148
+ // extensions/discord/src/monitor/native-interaction-channel-context.ts
2172
2149
  async function resolveDiscordNativeInteractionChannelContext(interaction, channelIdFallback) {
2173
2150
  const { channel, client, guild, rawData } = interaction;
2174
2151
  const hasGuild = Boolean(guild);
@@ -2191,8 +2168,7 @@ async function resolveDiscordNativeInteractionChannelContext(interaction, channe
2191
2168
  threadParentSlug: hasGuild ? channelContext.threadParentSlug : ""
2192
2169
  };
2193
2170
  }
2194
- //#endregion
2195
- //#region extensions/discord/src/monitor/native-command-auth.ts
2171
+ // extensions/discord/src/monitor/native-command-auth.ts
2196
2172
  function resolveDiscordNativePolicyReader(params) {
2197
2173
  return params.readPolicy ?? createDiscordLivePolicyReader({
2198
2174
  ...params,
@@ -2478,8 +2454,7 @@ async function resolveDiscordNativeAutocompleteAuthorized(params) {
2478
2454
  }
2479
2455
  return params.isPolicyCurrent?.() !== false;
2480
2456
  }
2481
- //#endregion
2482
- //#region extensions/discord/src/monitor/native-command-bypass.ts
2457
+ // extensions/discord/src/monitor/native-command-bypass.ts
2483
2458
  function shouldBypassConfiguredAcpEnsure(commandName) {
2484
2459
  const command = commandName.trim().toLowerCase();
2485
2460
  return command === "acp" || command === "status";
@@ -2488,8 +2463,7 @@ function shouldBypassConfiguredAcpGuildGuards(commandName) {
2488
2463
  const command = commandName.trim().toLowerCase();
2489
2464
  return command === "new" || command === "reset";
2490
2465
  }
2491
- //#endregion
2492
- //#region extensions/discord/src/monitor/model-picker-preference-primitives.ts
2466
+ // extensions/discord/src/monitor/model-picker-preference-primitives.ts
2493
2467
  function splitDiscordModelRef(modelRef) {
2494
2468
  const trimmed = modelRef.trim();
2495
2469
  const slashIndex = trimmed.indexOf("/");
@@ -2530,8 +2504,7 @@ function preferenceTimestampMs(value) {
2530
2504
  const parsed = typeof value === "string" ? Date.parse(value) : NaN;
2531
2505
  return Number.isFinite(parsed) ? parsed : 0;
2532
2506
  }
2533
- //#endregion
2534
- //#region extensions/discord/src/monitor/model-picker-preferences.ts
2507
+ // extensions/discord/src/monitor/model-picker-preferences.ts
2535
2508
  const DEFAULT_RECENT_LIMIT = 5;
2536
2509
  const PREFERENCE_MAX_ENTRIES = 2e3;
2537
2510
  let lastPreferenceTimestampMs = 0;
@@ -2613,8 +2586,7 @@ async function recordDiscordModelPickerRecentModel(params) {
2613
2586
  await Promise.all(scopedEntries.slice(limit).map((entry) => store.delete(entry.key)));
2614
2587
  } catch {}
2615
2588
  }
2616
- //#endregion
2617
- //#region extensions/discord/src/monitor/model-picker.state.ts
2589
+ // extensions/discord/src/monitor/model-picker.state.ts
2618
2590
  const DISCORD_MODEL_PICKER_CUSTOM_ID_KEY = "mdlpk";
2619
2591
  const DISCORD_CUSTOM_ID_MAX_CHARS = 100;
2620
2592
  const DISCORD_COMPONENT_MAX_SELECT_OPTIONS = 25;
@@ -2864,8 +2836,7 @@ function getDiscordModelPickerRecentModelRefs(data, quickModels) {
2864
2836
  const defaultModelRef = `${data.resolvedDefault.provider}/${data.resolvedDefault.model}`;
2865
2837
  return [defaultModelRef, ...quickModels.filter((modelRef) => modelRef !== defaultModelRef)];
2866
2838
  }
2867
- //#endregion
2868
- //#region extensions/discord/src/monitor/model-picker.view.ts
2839
+ // extensions/discord/src/monitor/model-picker.view.ts
2869
2840
  const DISCORD_MODEL_PICKER_PAGE_INDICATOR_CUSTOM_ID = "mdlpk:nav-indicator";
2870
2841
  function parseCurrentModelRef(raw) {
2871
2842
  const match = raw?.trim().match(/^([^/]+)\/(.+)$/u);
@@ -3234,8 +3205,7 @@ function renderDiscordModelPickerRecentsView(params) {
3234
3205
  trailingRows: [backRow]
3235
3206
  });
3236
3207
  }
3237
- //#endregion
3238
- //#region extensions/discord/src/monitor/native-command-model-picker-apply.ts
3208
+ // extensions/discord/src/monitor/native-command-model-picker-apply.ts
3239
3209
  async function applyDiscordModelPickerSelection(params) {
3240
3210
  const failureNotice = `❌ Failed to apply ${params.resolvedModelRef}. Try /model ${params.resolvedModelRef} directly.`;
3241
3211
  try {
@@ -3295,8 +3265,7 @@ async function applyDiscordModelPickerSelection(params) {
3295
3265
  };
3296
3266
  }
3297
3267
  }
3298
- //#endregion
3299
- //#region extensions/discord/src/monitor/native-command-model-picker-ui.ts
3268
+ // extensions/discord/src/monitor/native-command-model-picker-ui.ts
3300
3269
  function createDiscordModelPickerSessionReader(params, readConsistency) {
3301
3270
  const storePath = resolveStorePath(params.cfg.session?.store, { agentId: params.route.agentId });
3302
3271
  return (sessionKey = params.route.sessionKey) => getSessionEntryAsync({
@@ -3460,8 +3429,7 @@ async function replyWithDiscordModelPickerProviders(params) {
3460
3429
  replyText: formatDiscordCommandComponents(rendered.components)
3461
3430
  });
3462
3431
  }
3463
- //#endregion
3464
- //#region extensions/discord/src/monitor/native-command-model-picker-interaction.ts
3432
+ // extensions/discord/src/monitor/native-command-model-picker-interaction.ts
3465
3433
  function resolveModelPickerSelectionValue(interaction) {
3466
3434
  return normalizeOptionalString(interaction.values?.[0]) ?? null;
3467
3435
  }
@@ -3822,8 +3790,7 @@ function createDiscordModelPickerFallbackSelect$1(params) {
3822
3790
  }
3823
3791
  }();
3824
3792
  }
3825
- //#endregion
3826
- //#region extensions/discord/src/monitor/native-command-status.ts
3793
+ // extensions/discord/src/monitor/native-command-status.ts
3827
3794
  async function maybeDeliverDiscordDirectStatus(params) {
3828
3795
  if (params.suppressReplies || params.commandName !== "status") return null;
3829
3796
  const statusReply = await params.resolveDirectStatusReplyForSession({
@@ -3862,8 +3829,7 @@ async function maybeDeliverDiscordDirectStatus(params) {
3862
3829
  effectiveRoute: params.effectiveRoute
3863
3830
  };
3864
3831
  }
3865
- //#endregion
3866
- //#region extensions/discord/src/monitor/native-command.args.ts
3832
+ // extensions/discord/src/monitor/native-command.args.ts
3867
3833
  function readDiscordCommandArgs(interaction, definitions) {
3868
3834
  if (!definitions || definitions.length === 0) return;
3869
3835
  const values = {};
@@ -3886,8 +3852,7 @@ function createNativeCommandDefinition(command) {
3886
3852
  scope: "native"
3887
3853
  };
3888
3854
  }
3889
- //#endregion
3890
- //#region extensions/discord/src/monitor/native-command.options.ts
3855
+ // extensions/discord/src/monitor/native-command.options.ts
3891
3856
  const log$1 = createSubsystemLogger("discord/native-command");
3892
3857
  const DISCORD_COMMAND_DESCRIPTION_MAX = 100;
3893
3858
  function truncateDiscordCommandDescription(params) {
@@ -3964,8 +3929,7 @@ function buildDiscordCommandOptions(params) {
3964
3929
  });
3965
3930
  });
3966
3931
  }
3967
- //#endregion
3968
- //#region extensions/discord/src/monitor/native-command.ts
3932
+ // extensions/discord/src/monitor/native-command.ts
3969
3933
  const log = createSubsystemLogger("discord/native-command");
3970
3934
  const NON_PLUGIN_COMMAND_DISPATCH = Object.freeze({ kind: "non-plugin" });
3971
3935
  function createDiscordNativeCommand(params) {
@@ -4417,8 +4381,7 @@ function bindDiscordCommandControl(createControl) {
4417
4381
  const createDiscordCommandArgFallbackButton = bindDiscordCommandControl(createDiscordCommandArgFallbackButton$1);
4418
4382
  const createDiscordModelPickerFallbackButton = bindDiscordCommandControl(createDiscordModelPickerFallbackButton$1);
4419
4383
  const createDiscordModelPickerFallbackSelect = bindDiscordCommandControl(createDiscordModelPickerFallbackSelect$1);
4420
- //#endregion
4421
- //#region extensions/discord/src/internal/gateway-close-codes.ts
4384
+ // extensions/discord/src/internal/gateway-close-codes.ts
4422
4385
  const fatalGatewayCloseCodes = /* @__PURE__ */ new Set([
4423
4386
  GatewayCloseCodes.AuthenticationFailed,
4424
4387
  GatewayCloseCodes.InvalidShard,
@@ -4439,8 +4402,7 @@ function isFatalGatewayCloseCode(code) {
4439
4402
  function canResumeAfterGatewayClose(code) {
4440
4403
  return !nonResumableGatewayCloseCodes.has(code);
4441
4404
  }
4442
- //#endregion
4443
- //#region extensions/discord/src/internal/gateway-identify-limiter.ts
4405
+ // extensions/discord/src/internal/gateway-identify-limiter.ts
4444
4406
  const IDENTIFY_WINDOW_MS = 5e3;
4445
4407
  var GatewayIdentifyLimiter = class {
4446
4408
  async wait() {
@@ -4457,8 +4419,7 @@ var GatewayIdentifyLimiter = class {
4457
4419
  }
4458
4420
  };
4459
4421
  const sharedGatewayIdentifyLimiter = new GatewayIdentifyLimiter();
4460
- //#endregion
4461
- //#region extensions/discord/src/internal/gateway-lifecycle.ts
4422
+ // extensions/discord/src/internal/gateway-lifecycle.ts
4462
4423
  var GatewayHeartbeatTimers = class {
4463
4424
  start(params) {
4464
4425
  this.stop();
@@ -4508,8 +4469,7 @@ var GatewayReconnectTimer = class {
4508
4469
  this.timeout.unref?.();
4509
4470
  }
4510
4471
  };
4511
- //#endregion
4512
- //#region extensions/discord/src/internal/gateway-payload.ts
4472
+ // extensions/discord/src/internal/gateway-payload.ts
4513
4473
  function ensureGatewayParams(url) {
4514
4474
  const parsed = new URL(url);
4515
4475
  parsed.searchParams.set("v", parsed.searchParams.get("v") ?? "10");
@@ -4524,8 +4484,7 @@ function decodeGatewayMessage(incoming) {
4524
4484
  return null;
4525
4485
  }
4526
4486
  }
4527
- //#endregion
4528
- //#region extensions/discord/src/internal/gateway-rate-limit.ts
4487
+ // extensions/discord/src/internal/gateway-rate-limit.ts
4529
4488
  const GATEWAY_SEND_LIMIT = 120;
4530
4489
  const GATEWAY_SEND_WINDOW_MS = 6e4;
4531
4490
  const GATEWAY_SEND_QUEUE_LIMIT = GATEWAY_SEND_LIMIT;
@@ -4623,8 +4582,7 @@ var GatewaySendLimiter = class {
4623
4582
  this.scheduleFlush();
4624
4583
  }
4625
4584
  };
4626
- //#endregion
4627
- //#region extensions/discord/src/internal/gateway-voice-state-cache.ts
4585
+ // extensions/discord/src/internal/gateway-voice-state-cache.ts
4628
4586
  var DiscordGatewayVoiceStateCache = class {
4629
4587
  constructor() {
4630
4588
  this.statesByGuild = /* @__PURE__ */ new Map();
@@ -4700,12 +4658,10 @@ var DiscordGatewayVoiceStateCache = class {
4700
4658
  }
4701
4659
  }
4702
4660
  };
4703
- //#endregion
4704
- //#region extensions/discord/src/internal/ws-runtime.ts
4661
+ // extensions/discord/src/internal/ws-runtime.ts
4705
4662
  const require = createRequire(import.meta.url);
4706
4663
  const WebSocket = require(path.join(path.dirname(require.resolve("ws/package.json")), "index.js"));
4707
- //#endregion
4708
- //#region extensions/discord/src/internal/gateway.ts
4664
+ // extensions/discord/src/internal/gateway.ts
4709
4665
  const GatewayIntents = GatewayIntentBits;
4710
4666
  const READY_STATE_OPEN = 1;
4711
4667
  const DEFAULT_GATEWAY_URL = "wss://gateway.discord.gg/";
@@ -5009,8 +4965,7 @@ var GatewayPlugin = class extends Plugin {
5009
4965
  return this.outboundLimiter.getStatus();
5010
4966
  }
5011
4967
  };
5012
- //#endregion
5013
- //#region extensions/discord/src/monitor/gateway-supervisor.ts
4968
+ // extensions/discord/src/monitor/gateway-supervisor.ts
5014
4969
  var DiscordGatewayLifecycleError = class extends Error {
5015
4970
  constructor(event) {
5016
4971
  super(`discord gateway ${event.type}: ${event.message}`, { cause: event.err instanceof Error ? event.err : void 0 });
@@ -5127,8 +5082,7 @@ function createDiscordGatewaySupervisor(params) {
5127
5082
  }
5128
5083
  };
5129
5084
  }
5130
- //#endregion
5131
- //#region extensions/discord/src/gateway-logging.ts
5085
+ // extensions/discord/src/gateway-logging.ts
5132
5086
  const INFO_DEBUG_MARKERS = [
5133
5087
  "Gateway websocket closed",
5134
5088
  "Gateway reconnect scheduled in",
@@ -5167,8 +5121,7 @@ function attachDiscordGatewayLogging(params) {
5167
5121
  emitter.removeListener("metrics", onGatewayMetrics);
5168
5122
  };
5169
5123
  }
5170
- //#endregion
5171
- //#region extensions/discord/src/monitor.gateway.ts
5124
+ // extensions/discord/src/monitor.gateway.ts
5172
5125
  async function waitForDiscordGatewayStop(params) {
5173
5126
  const { gateway, abortSignal } = params;
5174
5127
  return await new Promise((resolve, reject) => {
@@ -5202,11 +5155,9 @@ async function waitForDiscordGatewayStop(params) {
5202
5155
  params.registerForceStop?.(finishReject);
5203
5156
  });
5204
5157
  }
5205
- //#endregion
5206
- //#region extensions/discord/src/monitor/gateway-handle.ts
5158
+ // extensions/discord/src/monitor/gateway-handle.ts
5207
5159
  const DISCORD_GATEWAY_TRANSPORT_ACTIVITY_EVENT = "openclaw:discord-gateway-transport-activity";
5208
- //#endregion
5209
- //#region extensions/discord/src/monitor/status.ts
5160
+ // extensions/discord/src/monitor/status.ts
5210
5161
  /** READY proves a prior terminal failure was repaired, so the account is restartable again. */
5211
5162
  function createDiscordReadyStatusPatch(at = Date.now()) {
5212
5163
  return channelReadyPatch({
@@ -5215,8 +5166,7 @@ function createDiscordReadyStatusPatch(at = Date.now()) {
5215
5166
  lastDisconnect: null
5216
5167
  });
5217
5168
  }
5218
- //#endregion
5219
- //#region extensions/discord/src/monitor/provider.lifecycle.ts
5169
+ // extensions/discord/src/monitor/provider.lifecycle.ts
5220
5170
  const DEFAULT_DISCORD_GATEWAY_READY_TIMEOUT_MS = 15e3;
5221
5171
  const DEFAULT_DISCORD_GATEWAY_RUNTIME_READY_TIMEOUT_MS = 3e4;
5222
5172
  const MAX_DISCORD_GATEWAY_READY_TIMEOUT_MS = 12e4;
@@ -5555,14 +5505,13 @@ async function runDiscordGatewayLifecycle(params) {
5555
5505
  }
5556
5506
  }
5557
5507
  }
5558
- //#endregion
5559
- //#region extensions/discord/src/monitor/provider-runtime.ts
5508
+ // extensions/discord/src/monitor/provider-runtime.ts
5560
5509
  const discordProviderRuntime = {
5561
5510
  probeDiscordApplicationId,
5562
5511
  createDiscordNativeCommand,
5563
5512
  runDiscordGatewayLifecycle,
5564
- loadDiscordVoiceRuntime: () => import("./voice-runtime-DHDNu0fz.mjs").then((n) => n.t),
5565
- loadDiscordProviderSessionRuntime: () => import("./provider-session.runtime-Ucr3XodI.mjs"),
5513
+ loadDiscordVoiceRuntime: () => import("./voice-runtime-DY1EwDfi.mjs").then((n) => n.t),
5514
+ loadDiscordProviderSessionRuntime: () => import("./provider-session.runtime-D8hMXXqJ.mjs"),
5566
5515
  createClient: (...args) => new Client(...args),
5567
5516
  resolveDiscordAccount,
5568
5517
  resolveNativeCommandsEnabled,
@@ -5572,8 +5521,7 @@ const discordProviderRuntime = {
5572
5521
  isVerbose,
5573
5522
  shouldLogVerbose
5574
5523
  };
5575
- //#endregion
5576
- //#region extensions/discord/src/monitor/provider.acp.ts
5524
+ // extensions/discord/src/monitor/provider.acp.ts
5577
5525
  const DISCORD_ACP_STATUS_PROBE_TIMEOUT_MS = 8e3;
5578
5526
  const DISCORD_ACP_STALE_RUNNING_ACTIVITY_MS = 12e4;
5579
5527
  function classifyAcpStatusProbeError(params) {
@@ -5646,8 +5594,7 @@ async function probeDiscordAcpBindingHealth(params) {
5646
5594
  };
5647
5595
  return { status: "healthy" };
5648
5596
  }
5649
- //#endregion
5650
- //#region extensions/discord/src/monitor/provider.cleanup.ts
5597
+ // extensions/discord/src/monitor/provider.cleanup.ts
5651
5598
  async function cleanupDiscordProviderStartup(params) {
5652
5599
  try {
5653
5600
  const listenersStopped = params.stopMonitorListeners?.();
@@ -5669,8 +5616,7 @@ async function cleanupDiscordProviderStartup(params) {
5669
5616
  if (!params.lifecycleStarted) await params.threadBindings.stop();
5670
5617
  }
5671
5618
  }
5672
- //#endregion
5673
- //#region extensions/discord/src/voice/session.ts
5619
+ // extensions/discord/src/voice/session.ts
5674
5620
  const MIN_SEGMENT_SECONDS = .35;
5675
5621
  const CAPTURE_FINALIZE_GRACE_MS = 2e3;
5676
5622
  const VOICE_CONNECT_READY_TIMEOUT_MS = 3e4;
@@ -5693,8 +5639,7 @@ function logVoiceVerbose(message) {
5693
5639
  function isVoiceChannel(type) {
5694
5640
  return type === discord_exports.ChannelType.GuildVoice || type === discord_exports.ChannelType.GuildStageVoice;
5695
5641
  }
5696
- //#endregion
5697
- //#region extensions/discord/src/voice/command.ts
5642
+ // extensions/discord/src/voice/command.ts
5698
5643
  const VOICE_CHANNEL_TYPES = [ChannelType.GuildVoice, ChannelType.GuildStageVoice];
5699
5644
  const DISCORD_VOICE_COMMAND_SPEC = {
5700
5645
  name: "vc",
@@ -5859,14 +5804,26 @@ function createDiscordVoiceCommand(startupParams) {
5859
5804
  }
5860
5805
  }();
5861
5806
  }
5862
- //#endregion
5863
- //#region extensions/discord/src/monitor/provider.commands.ts
5807
+ // extensions/discord/src/monitor/provider.commands.ts
5864
5808
  const loadPluginCommandRuntime = createLazyRuntimeModule(() => import("openclaw/plugin-sdk/plugin-command-runtime"));
5865
5809
  async function resolveDiscordProviderCommandSpecs(params) {
5866
5810
  const listSkillCommands = params.prepareSkillCommandsForAgents ?? prepareSkillCommandsForAgents;
5867
5811
  const listNativeCommandSpecs = params.listNativeCommandSpecsForConfig ?? listNativeCommandSpecsForConfig;
5868
5812
  const maxDiscordCommands = params.maxDiscordCommands ?? 100;
5869
- const pluginCommandSpecs = params.nativeEnabled ? (await loadPluginCommandRuntime()).createPluginCommandRuntime().listNativeCandidates("discord") : [];
5813
+ const pluginCommandSpecs = [];
5814
+ if (params.nativeEnabled) {
5815
+ const candidates = (await loadPluginCommandRuntime()).createPluginCommandRuntime().listNativeCandidates("discord");
5816
+ for (const command of candidates) {
5817
+ if (command.name.length > 32) {
5818
+ params.runtime.error?.(danger(`discord: plugin command "/${command.name.slice(0, 32)}…" exceeds the 32-character name limit. Set a shorter Discord native alias. Skipping.`));
5819
+ continue;
5820
+ }
5821
+ pluginCommandSpecs.push({
5822
+ ...command,
5823
+ name: command.name.toLowerCase()
5824
+ });
5825
+ }
5826
+ }
5870
5827
  const onCollision = (normalizedName) => {
5871
5828
  params.runtime.error?.(danger(`discord: plugin command "/${normalizedName}" duplicates an existing native command. Skipping.`));
5872
5829
  };
@@ -5899,8 +5856,7 @@ async function resolveDiscordProviderCommandSpecs(params) {
5899
5856
  commandSpecs
5900
5857
  };
5901
5858
  }
5902
- //#endregion
5903
- //#region extensions/discord/src/monitor/provider.deploy-errors.ts
5859
+ // extensions/discord/src/monitor/provider.deploy-errors.ts
5904
5860
  const DISCORD_DEPLOY_REJECTED_ENTRY_LIMIT = 3;
5905
5861
  function attachDiscordDeployRequestBody(err, body) {
5906
5862
  if (!err || typeof err !== "object" || body === void 0) return;
@@ -6048,8 +6004,7 @@ function isDiscordDeployDailyCreateLimit(err) {
6048
6004
  const rawCode = parseStrictNonNegativeInteger(readDiscordDeployObjectField(deployErr.rawBody, "code"));
6049
6005
  return (discordCode === 30034 || rawCode === 30034) && /daily application command creates/i.test(formatErrorMessage$1(err));
6050
6006
  }
6051
- //#endregion
6052
- //#region extensions/discord/src/monitor/provider.startup-log.ts
6007
+ // extensions/discord/src/monitor/provider.startup-log.ts
6053
6008
  function formatDiscordStartupGatewayState(gateway) {
6054
6009
  if (!gateway) return "gateway=missing";
6055
6010
  const reconnectAttempts = gateway.reconnectAttempts;
@@ -6061,8 +6016,7 @@ function logDiscordStartupPhase(params) {
6061
6016
  const suffix = [params.details, formatDiscordStartupGatewayState(params.gateway)].filter((value) => Boolean(value)).join(" ");
6062
6017
  params.runtime.log?.(`discord startup [${params.accountId}] ${params.phase} ${elapsedMs}ms${suffix ? ` ${suffix}` : ""}`);
6063
6018
  }
6064
- //#endregion
6065
- //#region extensions/discord/src/monitor/provider.deploy.ts
6019
+ // extensions/discord/src/monitor/provider.deploy.ts
6066
6020
  function readDeployRequestBody(data) {
6067
6021
  return data && typeof data === "object" && "body" in data ? data.body : void 0;
6068
6022
  }
@@ -6172,8 +6126,7 @@ function runDiscordCommandDeployInBackground(params) {
6172
6126
  params.runtime.log?.(warn(`[${params.accountId}] slash command deploy failed in background (message send/receive unaffected): ${formatErrorMessage$1(err)}`));
6173
6127
  });
6174
6128
  }
6175
- //#endregion
6176
- //#region extensions/discord/src/monitor/agent-components-reply.ts
6129
+ // extensions/discord/src/monitor/agent-components-reply.ts
6177
6130
  async function replySilently(interaction, params, onError) {
6178
6131
  try {
6179
6132
  await interaction.reply(params);
@@ -6181,8 +6134,7 @@ async function replySilently(interaction, params, onError) {
6181
6134
  onError?.(error);
6182
6135
  }
6183
6136
  }
6184
- //#endregion
6185
- //#region extensions/discord/src/activities/interaction.ts
6137
+ // extensions/discord/src/activities/interaction.ts
6186
6138
  const REGISTRATION_WIDGET_ID = "AAAAAAAAAAAAAAAAAAAAAA";
6187
6139
  const PENDING_LAUNCH_WRITE_BUDGET_MS = 250;
6188
6140
  var DiscordActivityButton = class extends Button {
@@ -6234,8 +6186,7 @@ function createDiscordActivityButton(ctx, applicationId) {
6234
6186
  if (!runtime.resolveAccount(ctx.accountId, ctx.cfg)) return null;
6235
6187
  return new DiscordActivityButton(ctx);
6236
6188
  }
6237
- //#endregion
6238
- //#region extensions/discord/src/monitor/agent-components-context.ts
6189
+ // extensions/discord/src/monitor/agent-components-context.ts
6239
6190
  function resolveAgentComponentRoute(params) {
6240
6191
  return resolveAgentRoute({
6241
6192
  cfg: params.ctx.cfg,
@@ -6316,8 +6267,7 @@ async function resolveComponentInteractionContext(params) {
6316
6267
  memberRoleIds: Array.isArray(interaction.rawData.member?.roles) ? interaction.rawData.member.roles.slice() : []
6317
6268
  };
6318
6269
  }
6319
- //#endregion
6320
- //#region extensions/discord/src/monitor/agent-components-data.ts
6270
+ // extensions/discord/src/monitor/agent-components-data.ts
6321
6271
  function readParsedId(data, key) {
6322
6272
  if (!data || typeof data !== "object") return;
6323
6273
  return key in data ? data[key] : data[key === "cid" ? "componentId" : "modalId"];
@@ -6410,8 +6360,7 @@ function formatModalSubmissionText(entry, interaction) {
6410
6360
  });
6411
6361
  return [title, ...lines.length > 0 ? lines : ["- (no values)"]].join("\n");
6412
6362
  }
6413
- //#endregion
6414
- //#region extensions/discord/src/monitor/agent-components-live-policy.ts
6363
+ // extensions/discord/src/monitor/agent-components-live-policy.ts
6415
6364
  async function resolveAgentComponentPolicyContext(params) {
6416
6365
  if (!params.ctx.readPolicy) return params.ctx;
6417
6366
  try {
@@ -6431,8 +6380,7 @@ async function resolveAgentComponentPolicyContext(params) {
6431
6380
  throw error;
6432
6381
  }
6433
6382
  }
6434
- //#endregion
6435
- //#region extensions/discord/src/monitor/agent-components-dm-auth.ts
6383
+ // extensions/discord/src/monitor/agent-components-dm-auth.ts
6436
6384
  async function ensureDmComponentAuthorized(params) {
6437
6385
  const { ctx, interaction, user, componentLabel } = params;
6438
6386
  const dmPolicy = ctx.dmPolicy ?? "pairing";
@@ -6533,8 +6481,7 @@ async function resolveInteractionContextWithDmAuth(params) {
6533
6481
  })) return null;
6534
6482
  return interactionCtx;
6535
6483
  }
6536
- //#endregion
6537
- //#region extensions/discord/src/monitor/agent-components-guild-auth.ts
6484
+ // extensions/discord/src/monitor/agent-components-guild-auth.ts
6538
6485
  function resolveComponentGuildContext(params) {
6539
6486
  const guildInfo = resolveDiscordGuildEntry({
6540
6487
  guild: params.interaction.guild ?? void 0,
@@ -6706,8 +6653,7 @@ async function resolveComponentCommandAuthorized(params) {
6706
6653
  modeWhenAccessGroupsOff: "configured"
6707
6654
  });
6708
6655
  }
6709
- //#endregion
6710
- //#region extensions/discord/src/monitor/reply-context.ts
6656
+ // extensions/discord/src/monitor/reply-context.ts
6711
6657
  function resolveReplyContext(message, resolveDiscordMessageText) {
6712
6658
  const id = resolveDiscordReferencedReplyMessageId(message);
6713
6659
  if (!id) return null;
@@ -6744,8 +6690,7 @@ function buildGuildLabel(params) {
6744
6690
  const { guild, channelName, channelId } = params;
6745
6691
  return `${guild?.name ?? "Guild"} #${channelName} channel id:${channelId}`;
6746
6692
  }
6747
- //#endregion
6748
- //#region extensions/discord/src/monitor/reply-safety.ts
6693
+ // extensions/discord/src/monitor/reply-safety.ts
6749
6694
  const DISCORD_INTERNAL_CHANNEL_LINE_RE = /^(?:>\s*)?(?:analysis|commentary|thinking|reasoning)\s*[:=]/i;
6750
6695
  function hasNonEmptyRecord(value) {
6751
6696
  return Boolean(value && typeof value === "object" && !Array.isArray(value) && Object.keys(value).length > 0);
@@ -6795,8 +6740,7 @@ function sanitizeDiscordFrontChannelReplyPayloads(payloads, options = {}) {
6795
6740
  }
6796
6741
  return safePayloads;
6797
6742
  }
6798
- //#endregion
6799
- //#region extensions/discord/src/monitor/reply-delivery.ts
6743
+ // extensions/discord/src/monitor/reply-delivery.ts
6800
6744
  function formatDiscordReplyContext(target, sessionKey) {
6801
6745
  return `target=${target}${sessionKey ? ` session=${sessionKey}` : ""}`;
6802
6746
  }
@@ -6906,10 +6850,9 @@ async function deliverDiscordReply(params) {
6906
6850
  if (send.status === "partial_failed") throw createChannelPartialDeliveryError(send.error, deliveryResult);
6907
6851
  return deliveryResult;
6908
6852
  }
6909
- //#endregion
6910
- //#region extensions/discord/src/monitor/agent-components.dispatch.ts
6853
+ // extensions/discord/src/monitor/agent-components.dispatch.ts
6911
6854
  const loadReplyRuntime = createLazyRuntimeModule(() => import("openclaw/plugin-sdk/reply-runtime"));
6912
- const loadTypingRuntime = createLazyRuntimeModule(() => import("./typing-CNlSKY5S.mjs").then((n) => n.n));
6855
+ const loadTypingRuntime = createLazyRuntimeModule(() => import("./typing-DAv4S2fI.mjs").then((n) => n.n));
6913
6856
  function buildDiscordComponentConversationLabel(params) {
6914
6857
  if (params.interactionCtx.isDirectMessage) return buildDirectLabel(params.interactionCtx.user);
6915
6858
  if (params.interactionCtx.isGroupDm) return `Group DM #${params.channelCtx.channelName ?? params.interactionCtx.channelId} channel id:${params.interactionCtx.channelId}`;
@@ -7153,8 +7096,7 @@ async function dispatchDiscordComponentEvent(params) {
7153
7096
  }
7154
7097
  });
7155
7098
  }
7156
- //#endregion
7157
- //#region extensions/discord/src/interactive-dispatch.ts
7099
+ // extensions/discord/src/interactive-dispatch.ts
7158
7100
  const dispatchDiscordInteractive = createChannelInteractiveDispatcher({
7159
7101
  channel: "discord",
7160
7102
  interactiveKey: "interaction"
@@ -7165,8 +7107,7 @@ async function dispatchDiscordPluginInteractiveHandler(params) {
7165
7107
  dedupeId: params.interactionId
7166
7108
  });
7167
7109
  }
7168
- //#endregion
7169
- //#region extensions/discord/src/monitor/agent-components.plugin-interactive.ts
7110
+ // extensions/discord/src/monitor/agent-components.plugin-interactive.ts
7170
7111
  const loadConversationRuntime = createLazyRuntimeModule(() => import("openclaw/plugin-sdk/conversation-runtime"));
7171
7112
  async function dispatchPluginDiscordInteractiveEvent(params) {
7172
7113
  const normalizedConversationId = params.interactionCtx.rawGuildId || params.channelCtx.channelType === ChannelType.GroupDM ? `channel:${params.interactionCtx.channelId}` : `user:${params.interactionCtx.userId}`;
@@ -7278,9 +7219,8 @@ async function dispatchPluginDiscordInteractiveEvent(params) {
7278
7219
  }
7279
7220
  return "unmatched";
7280
7221
  }
7281
- //#endregion
7282
- //#region extensions/discord/src/monitor/agent-components.handlers.ts
7283
- const loadComponentsRuntime = createLazyRuntimeModule(() => import("./components-C_cuoW1q.mjs").then((n) => n.t));
7222
+ // extensions/discord/src/monitor/agent-components.handlers.ts
7223
+ const loadComponentsRuntime = createLazyRuntimeModule(() => import("./components-BvOWSPxr.mjs").then((n) => n.t));
7284
7224
  async function resolveAuthorizedComponentEntry(params) {
7285
7225
  const entry = params.entry ?? await params.resolve(false);
7286
7226
  if (!entry) {
@@ -7472,8 +7412,7 @@ function createDiscordComponentModal(ctx) {
7472
7412
  }
7473
7413
  }();
7474
7414
  }
7475
- //#endregion
7476
- //#region extensions/discord/src/monitor/agent-components.system-controls.ts
7415
+ // extensions/discord/src/monitor/agent-components.system-controls.ts
7477
7416
  const AGENT_BUTTON_KEY = "agent";
7478
7417
  const AGENT_SELECT_KEY = "agentsel";
7479
7418
  async function runAgentSystemControlInteraction(params) {
@@ -7559,8 +7498,7 @@ function createAgentSelectMenu(ctx) {
7559
7498
  }
7560
7499
  }();
7561
7500
  }
7562
- //#endregion
7563
- //#region extensions/discord/src/monitor/agent-components.wildcard-controls.ts
7501
+ // extensions/discord/src/monitor/agent-components.wildcard-controls.ts
7564
7502
  const SELECT_CONTROLS = [
7565
7503
  {
7566
7504
  type: ComponentType.StringSelect,
@@ -7642,12 +7580,10 @@ function createDiscordComponentButton(ctx, handlers) {
7642
7580
  }();
7643
7581
  }
7644
7582
  const discordComponentControlFactories = [createDiscordComponentButton, ...SELECT_CONTROLS.map((spec) => (ctx, handlers) => createDiscordComponentSelectControl(spec, ctx, handlers))];
7645
- //#endregion
7646
- //#region extensions/discord/src/monitor/agent-components.ts
7583
+ // extensions/discord/src/monitor/agent-components.ts
7647
7584
  const createAgentComponentControls = [createAgentComponentButton, createAgentSelectMenu];
7648
7585
  const createDiscordComponentControls = discordComponentControlFactories.map((createControl) => (ctx) => createControl(ctx, discordComponentControlHandlers));
7649
- //#endregion
7650
- //#region extensions/discord/src/monitor/exec-approvals.ts
7586
+ // extensions/discord/src/monitor/exec-approvals.ts
7651
7587
  function resolveTerminalLabel(approval) {
7652
7588
  if (approval.status === "allowed") return approval.decision === "allow-always" ? "Allowed always" : "Allowed once";
7653
7589
  if (approval.status === "denied") return "Denied";
@@ -7770,8 +7706,7 @@ function createDiscordExecApprovalButtonContext(params) {
7770
7706
  }
7771
7707
  };
7772
7708
  }
7773
- //#endregion
7774
- //#region extensions/discord/src/monitor/questions.ts
7709
+ // extensions/discord/src/monitor/questions.ts
7775
7710
  var QuestionButton = class extends Button {
7776
7711
  constructor(ctx) {
7777
7712
  super();
@@ -7832,8 +7767,7 @@ function createDiscordQuestionButton(params) {
7832
7767
  })))
7833
7768
  });
7834
7769
  }
7835
- //#endregion
7836
- //#region extensions/discord/src/monitor/provider.interactions.ts
7770
+ // extensions/discord/src/monitor/provider.interactions.ts
7837
7771
  function createDiscordProviderInteractionSurface(params) {
7838
7772
  const createNativeCommand = params.createNativeCommand ?? createDiscordNativeCommand;
7839
7773
  const accountContext = {
@@ -7920,8 +7854,7 @@ function createDiscordProviderInteractionSurface(params) {
7920
7854
  modals
7921
7855
  };
7922
7856
  }
7923
- //#endregion
7924
- //#region extensions/discord/src/internal/voice.ts
7857
+ // extensions/discord/src/internal/voice.ts
7925
7858
  var VoicePlugin = class extends Plugin {
7926
7859
  constructor(..._args) {
7927
7860
  super(..._args);
@@ -7956,8 +7889,7 @@ var VoicePlugin = class extends Plugin {
7956
7889
  };
7957
7890
  }
7958
7891
  };
7959
- //#endregion
7960
- //#region extensions/discord/src/monitor/presence.ts
7892
+ // extensions/discord/src/monitor/presence.ts
7961
7893
  const DEFAULT_CUSTOM_ACTIVITY_TYPE = 4;
7962
7894
  const CUSTOM_STATUS_NAME = "Custom Status";
7963
7895
  function resolveDiscordPresenceUpdate(config) {
@@ -7986,8 +7918,7 @@ function resolveDiscordPresenceUpdate(config) {
7986
7918
  afk: false
7987
7919
  };
7988
7920
  }
7989
- //#endregion
7990
- //#region extensions/discord/src/monitor/auto-presence.ts
7921
+ // extensions/discord/src/monitor/auto-presence.ts
7991
7922
  const DEFAULT_INTERVAL_MS = 3e4;
7992
7923
  const DEFAULT_MIN_UPDATE_INTERVAL_MS = 15e3;
7993
7924
  const MIN_INTERVAL_MS = 5e3;
@@ -8106,8 +8037,7 @@ function createDiscordAutoPresenceController(params) {
8106
8037
  stop: () => scheduler.stop()
8107
8038
  };
8108
8039
  }
8109
- //#endregion
8110
- //#region extensions/discord/src/monitor/gateway-metadata.ts
8040
+ // extensions/discord/src/monitor/gateway-metadata.ts
8111
8041
  const DISCORD_GATEWAY_BOT_URL = "https://discord.com/api/v10/gateway/bot";
8112
8042
  const DISCORD_API_HOST = "discord.com";
8113
8043
  const DEFAULT_DISCORD_GATEWAY_URL = "wss://gateway.discord.gg/";
@@ -8275,8 +8205,7 @@ async function fetchDiscordGatewayMetadataGuarded(input, init, options) {
8275
8205
  }).catch(() => {});
8276
8206
  return response;
8277
8207
  }
8278
- //#endregion
8279
- //#region extensions/discord/src/monitor/gateway-plugin.ts
8208
+ // extensions/discord/src/monitor/gateway-plugin.ts
8280
8209
  const DISCORD_GATEWAY_POLICY_VIOLATION_CLOSE_CODE = 1008;
8281
8210
  const DISCORD_GATEWAY_WS_RECEIVER_LIMIT_CODE = "WS_ERR_TOO_MANY_BUFFERED_PARTS";
8282
8211
  const DISCORD_GATEWAY_CLOSE_REASON_LOG_MAX_CHARS = 240;
@@ -8506,8 +8435,7 @@ function createDiscordGatewayPlugin(params) {
8506
8435
  ...wsAgent ? { wsAgent } : {}
8507
8436
  });
8508
8437
  }
8509
- //#endregion
8510
- //#region extensions/discord/src/monitor/message-handler.preflight-channel-access.ts
8438
+ // extensions/discord/src/monitor/message-handler.preflight-channel-access.ts
8511
8439
  function resolveDiscordPreflightChannelAccess(params) {
8512
8440
  if (params.isGuildMessage && params.channelConfig?.enabled === false) {
8513
8441
  logDebug(`[discord-preflight] drop: channel disabled`);
@@ -8552,8 +8480,7 @@ function resolveDiscordPreflightChannelAccess(params) {
8552
8480
  }
8553
8481
  return true;
8554
8482
  }
8555
- //#endregion
8556
- //#region extensions/discord/src/monitor/listeners.guild-join.ts
8483
+ // extensions/discord/src/monitor/listeners.guild-join.ts
8557
8484
  const DISCORD_GUILD_JOIN_INTRO_MAX_AGE_MS = 3e5;
8558
8485
  var DiscordGuildJoinIntroductionListener = class extends GuildCreateListener {
8559
8486
  constructor(params) {
@@ -8677,8 +8604,7 @@ var DiscordGuildJoinIntroductionListener = class extends GuildCreateListener {
8677
8604
  await Promise.allSettled(this.pendingReports);
8678
8605
  }
8679
8606
  };
8680
- //#endregion
8681
- //#region extensions/discord/src/monitor/provider.startup.ts
8607
+ // extensions/discord/src/monitor/provider.startup.ts
8682
8608
  async function createDiscordMonitorClient(params) {
8683
8609
  let autoPresenceController = null;
8684
8610
  const constructorPlugins = [createDiscordGatewayPlugin(params)];
@@ -8717,26 +8643,41 @@ async function createDiscordMonitorClient(params) {
8717
8643
  if (!client.plugins.some((entry) => entry.id === voicePlugin.id)) client.plugins.push(voicePlugin);
8718
8644
  }
8719
8645
  const gateway = client.getPlugin("gateway");
8720
- await waitForDiscordGatewayPluginRegistration(gateway);
8721
- const gatewaySupervisor = createDiscordGatewaySupervisor({
8722
- ...params,
8723
- gateway
8724
- });
8725
- if (gateway) {
8726
- autoPresenceController = createDiscordAutoPresenceController({
8646
+ let gatewaySupervisor;
8647
+ try {
8648
+ await waitForDiscordGatewayPluginRegistration(gateway);
8649
+ gatewaySupervisor = createDiscordGatewaySupervisor({
8727
8650
  ...params,
8728
- gateway,
8729
- log: (message) => params.runtime.log?.(message)
8651
+ gateway
8730
8652
  });
8731
- autoPresenceController.start();
8653
+ if (gateway) {
8654
+ autoPresenceController = createDiscordAutoPresenceController({
8655
+ ...params,
8656
+ gateway,
8657
+ log: (message) => params.runtime.log?.(message)
8658
+ });
8659
+ autoPresenceController.start();
8660
+ }
8661
+ return {
8662
+ client,
8663
+ gateway,
8664
+ gatewaySupervisor,
8665
+ autoPresenceController,
8666
+ eventQueueOpts
8667
+ };
8668
+ } catch (err) {
8669
+ try {
8670
+ gateway?.disconnect();
8671
+ } catch (cleanupErr) {
8672
+ params.runtime.error?.(danger("discord: failed to disconnect gateway during startup cleanup: " + String(cleanupErr)));
8673
+ }
8674
+ try {
8675
+ gatewaySupervisor?.dispose();
8676
+ } catch (cleanupErr) {
8677
+ params.runtime.error?.(danger("discord: failed to dispose supervisor during startup cleanup: " + String(cleanupErr)));
8678
+ }
8679
+ throw err;
8732
8680
  }
8733
- return {
8734
- client,
8735
- gateway,
8736
- gatewaySupervisor,
8737
- autoPresenceController,
8738
- eventQueueOpts
8739
- };
8740
8681
  }
8741
8682
  async function fetchDiscordBotIdentity(params) {
8742
8683
  params.logStartupPhase("fetch-bot-identity:start");
@@ -8818,15 +8759,13 @@ function registerDiscordMonitorListeners(params) {
8818
8759
  }
8819
8760
  };
8820
8761
  }
8821
- //#endregion
8822
- //#region extensions/discord/src/monitor/startup-status.ts
8762
+ // extensions/discord/src/monitor/startup-status.ts
8823
8763
  function formatDiscordStartupStatusMessage(params) {
8824
8764
  const identitySuffix = params.botIdentity ? ` as ${params.botIdentity}` : "";
8825
8765
  if (params.gatewayReady) return `logged in to discord${identitySuffix}`;
8826
8766
  return `discord client initialized${identitySuffix}; awaiting gateway readiness`;
8827
8767
  }
8828
- //#endregion
8829
- //#region extensions/discord/src/monitor/provider.ts
8768
+ // extensions/discord/src/monitor/provider.ts
8830
8769
  const DEFAULT_DISCORD_MEDIA_MAX_MB = 100;
8831
8770
  const DISCORD_DISALLOWED_INTENTS_CODE = GatewayCloseCodes$1.DisallowedIntents;
8832
8771
  function formatThreadBindingDurationForConfigLabel(durationMs) {
@@ -9206,5 +9145,4 @@ async function monitorDiscordProvider(opts) {
9206
9145
  });
9207
9146
  }
9208
9147
  }
9209
- //#endregion
9210
9148
  export { resolveDiscordDmCommandAccess as A, buildDiscordGroupSystemPrompt as C, createDiscordLivePolicyReader as D, handleDiscordDmCommandDecision as E, mapGatewayDispatchData as O, createDiscordNativeCommand as S, createDiscordSupplementalContextAccessChecker as T, isDiscordRealtimeVoiceMode as _, waitForDiscordGatewayPluginRegistration as a, resolveDiscordVoiceMode as b, formatDiscordReplySkip as c, buildGuildLabel as d, resolveReplyContext as f, VOICE_RECONNECT_GRACE_MS as g, VOICE_CONNECT_READY_TIMEOUT_MS as h, resolveDiscordGatewayIntents as i, resolveDiscordTextCommandAccess as j, registerDiscordListener as k, sanitizeDiscordFrontChannelReplyPayloads as l, MIN_SEGMENT_SECONDS as m, resolveDiscordPreflightChannelAccess as n, deliverDiscordReply as o, CAPTURE_FINALIZE_GRACE_MS as p, createDiscordGatewayPlugin as r, formatDiscordReplyDeliveryFailure as s, monitorDiscordProvider as t, buildDirectLabel as u, isVoiceChannel as v, buildDiscordInboundAccessContext as w, resolveVoiceTimeoutMs as x, logVoiceVerbose as y };