@openclaw/discord 2026.9.1-beta.1 → 2026.9.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 (165) hide show
  1. package/dist/account-inspect-BY-ve3yH.js +45 -0
  2. package/dist/account-inspect-api.js +1 -1
  3. package/dist/{accounts-CfQ-vSyf.js → accounts-CwJQoLjM.js} +89 -45
  4. package/dist/action-runtime-api.js +1 -1
  5. package/dist/{activities-api-q-9PaaHH.js → activities-api-CTcGq3Hf.js} +30 -17
  6. package/dist/activities-api.js +1 -1
  7. package/dist/{allow-list-BDMimASD.js → allow-list-DBTtR2dz.js} +13 -35
  8. package/dist/{api-DNVbJyEy.js → api-BfmEP6wp.js} +6 -5
  9. package/dist/api.js +18 -18
  10. package/dist/{approval-handler.runtime-B7qhK3fR.js → approval-handler.runtime-DUSe5fyH.js} +19 -12
  11. package/dist/{audit-CBEv_ERu.js → audit-DpPfwoJM.js} +8 -7
  12. package/dist/{channel-Dx1tMTfx.js → channel-BHajPgwR.js} +29 -23
  13. package/dist/{channel-actions.runtime-CLWWu9nC.js → channel-actions.runtime-DS8pXo0S.js} +38 -38
  14. package/dist/channel-config-api.js +1 -1
  15. package/dist/channel-plugin-api.js +1 -1
  16. package/dist/{channel.setup-DOzXS2Pk.js → channel.setup-BWmMe1tT.js} +18 -18
  17. package/dist/command-owners-D78sAoOz.js +10 -0
  18. package/dist/{components-B9V5o361.js → components-BimX47Mq.js} +111 -149
  19. package/dist/{config-schema-BR13IAx6.js → config-schema-B797-Spt.js} +19 -12
  20. package/dist/{conversation-binding-route-DJYrY2TQ.js → conversation-binding-route-DuR5NGIx.js} +1 -1
  21. package/dist/{directory-config-BK6eqekJ.js → directory-config-CD2v2Szs.js} +2 -2
  22. package/dist/directory-contract-api.js +1 -1
  23. package/dist/{directory-live-DSAJSrJk.js → directory-live-DaJzWJ2N.js} +4 -4
  24. package/dist/{doctor-Cm7Y1pJ2.js → doctor-D4HH1inA.js} +9 -6
  25. package/dist/{doctor-contract-DsWvKIXF.js → doctor-contract-Co5vRCZ6.js} +9 -6
  26. package/dist/doctor-contract-api.js +31 -28
  27. package/dist/{handle-action.guild-admin-BdwCRHmm.js → handle-action.guild-admin-4We6wWQU.js} +6 -3
  28. package/dist/index.js +1 -1
  29. package/dist/ingress-identity-XNmW-mZS.js +60 -0
  30. package/dist/{message-handler-BXpWZyni.js → message-handler-DhgBabyU.js} +61 -70
  31. package/dist/{message-handler.preflight-Ba5LAY_X.js → message-handler.preflight-oZ7dQCd0.js} +41 -101
  32. package/dist/{message-handler.process-3HEzmemS.js → message-handler.process-BzCYf1pa.js} +82 -108
  33. package/dist/{message-text-aiwO5R2F.js → message-text-DK4NnBg-.js} +11 -6
  34. package/dist/{outbound-adapter-BE4jSq2d.js → outbound-adapter-CtggmGh9.js} +52 -67
  35. package/dist/{outbound-components-oLpg8Qzb.js → outbound-components-Dn8SJWMS.js} +5 -4
  36. package/dist/{outbound-session-route-Cg15ZFJd.js → outbound-session-route-Q_HEusBQ.js} +57 -15
  37. package/dist/{owner-access-UlYi9t0M.js → owner-access-Cp8r6Ipf.js} +9 -7
  38. package/dist/{pluralkit-Tiyl70dx.js → pluralkit-BY75YcK0.js} +2 -2
  39. package/dist/{probe-n6ZXxK8V.js → probe-3ovFAp3b.js} +3 -3
  40. package/dist/{probe.runtime-CN4bdPfZ.js → probe.runtime-BckHn3cJ.js} +1 -1
  41. package/dist/{provider-session.runtime-B9xe-Qaf.js → provider-session.runtime-BL2lHBH7.js} +3 -3
  42. package/dist/{provider-B11xwilq.js → provider-uKmmrDM4.js} +299 -136
  43. package/dist/provider.runtime-C-IkWF2w.js +2 -0
  44. package/dist/{realtime-session.runtime-CU8IQUS-.js → realtime-session.runtime-CGYm1t_0.js} +798 -448
  45. package/dist/{resolve-allowlist-common-BLoYaxEG.js → resolve-allowlist-common-sKIKy-cF.js} +3 -3
  46. package/dist/{resolve-channels-C2sT_n67.js → resolve-channels-CoiMlWy0.js} +4 -4
  47. package/dist/{resolve-users-CzpjLwjy.js → resolve-users-DJpiokfW.js} +5 -4
  48. package/dist/{retry-Cv4jCU5Z.js → retry-DQt1zDgH.js} +356 -214
  49. package/dist/{retry-after-DdLPmPoa.js → retry-after-BrLjLUJi.js} +2 -1
  50. package/dist/{runtime-CY4PRMF-.js → runtime-BHsdEdr5.js} +2 -2
  51. package/dist/{runtime-BHrTlFkf.js → runtime-Ghtfh5ZA.js} +151 -109
  52. package/dist/runtime-api.js +20 -20
  53. package/dist/{secret-config-contract-B3i6WxV5.js → secret-config-contract-DFu9hfU8.js} +14 -6
  54. package/dist/secret-contract-api.js +1 -1
  55. package/dist/{security-audit-BfJhAXZp.js → security-audit-DKfK-iPY.js} +10 -11
  56. package/dist/security-audit-contract-api.js +1 -1
  57. package/dist/{security-audit.runtime-BVKF9VtY.js → security-audit.runtime-sKZyKgpx.js} +1 -1
  58. package/dist/{send-C49MFF9j.js → send-CZeWKUiA.js} +132 -100
  59. package/dist/{send.components-DKKAw5VX.js → send.components-BG5IDABj.js} +21 -15
  60. package/dist/{send.outbound-zam0TrZx.js → send.outbound-DHuFUL6W.js} +42 -63
  61. package/dist/{send.shared-JjljcV4O.js → send.shared-B0n_fWzu.js} +77 -149
  62. package/dist/{sender-identity-BJtfyise.js → sender-identity-B8Ncfi63.js} +1 -1
  63. package/dist/setup-plugin-api.js +1 -1
  64. package/dist/{shared-_5EcP4jW.js → shared-C3dKun_X.js} +24 -15
  65. package/dist/{subagent-hooks-DQzvOptn.js → subagent-hooks-ZoQXEI1E.js} +2 -2
  66. package/dist/subagent-hooks-api.js +1 -1
  67. package/dist/{system-events-C7yxaHWP.js → system-events-DFF_awl7.js} +2 -2
  68. package/dist/{target-resolver-vxIh6O3-.js → target-resolver-DLtHDwMK.js} +6 -5
  69. package/dist/targets-BObRyaKX.js +3 -0
  70. package/dist/{thread-bindings-DW5F9vat.js → thread-bindings-DKvsNjQR.js} +7 -6
  71. package/dist/{thread-bindings.manager-ByOtwjo_.js → thread-bindings.manager-pbbRT5gb.js} +38 -29
  72. package/dist/{thread-bindings.session-updates-CJb-BpPL.js → thread-bindings.session-updates-t6jeFB1-.js} +3 -2
  73. package/dist/{thread-bindings.state-D8OMdk4O.js → thread-bindings.state-DtgOqsbX.js} +34 -1
  74. package/dist/{threading-agH1T_6s.js → threading-BCx49X-6.js} +8 -6
  75. package/dist/{timeouts-B9cy6RvQ.js → timeouts-D86uWLt_.js} +1 -1
  76. package/dist/{transcripts-source-BR11iHA4.js → transcripts-source-Dc6Nnli5.js} +55 -7
  77. package/dist/transcripts-source-api.js +1 -1
  78. package/dist/{typing-Dc_YMY2e.js → typing-CuopV-Hi.js} +2 -2
  79. package/dist/{voice-runtime-DIeaa8fJ.js → voice-runtime-BQnILUbG.js} +492 -105
  80. package/node_modules/@discord/embedded-app-sdk/node_modules/@types/lodash/README.md +1 -1
  81. package/node_modules/@discord/embedded-app-sdk/node_modules/@types/lodash/conforms.d.ts +2 -0
  82. package/node_modules/@discord/embedded-app-sdk/node_modules/@types/lodash/package.json +3 -3
  83. package/node_modules/@discord/embedded-app-sdk/node_modules/@types/lodash/stubArray.d.ts +2 -0
  84. package/node_modules/@discord/embedded-app-sdk/node_modules/@types/lodash/stubObject.d.ts +2 -0
  85. package/node_modules/@discord/embedded-app-sdk/node_modules/@types/lodash/stubString.d.ts +2 -0
  86. package/node_modules/@discordjs/voice/node_modules/@types/node/README.md +1 -1
  87. package/node_modules/@discordjs/voice/node_modules/@types/node/buffer.buffer.d.ts +5 -5
  88. package/node_modules/@discordjs/voice/node_modules/@types/node/crypto.d.ts +2 -2
  89. package/node_modules/@discordjs/voice/node_modules/@types/node/http.d.ts +16 -0
  90. package/node_modules/@discordjs/voice/node_modules/@types/node/http2.d.ts +10 -2
  91. package/node_modules/@discordjs/voice/node_modules/@types/node/package.json +2 -2
  92. package/node_modules/@discordjs/voice/node_modules/@types/node/process.d.ts +52 -0
  93. package/node_modules/@discordjs/voice/node_modules/@types/node/quic.d.ts +210 -28
  94. package/node_modules/@discordjs/voice/node_modules/@types/node/sqlite.d.ts +6 -2
  95. package/node_modules/@discordjs/voice/node_modules/@types/node/test.d.ts +36 -0
  96. package/node_modules/typebox/build/format/email.mjs +1 -1
  97. package/node_modules/typebox/build/format/idna/idn-hostname.mjs +19 -1
  98. package/node_modules/typebox/build/format/json_pointer.d.mts +2 -2
  99. package/node_modules/typebox/build/format/json_pointer.mjs +2 -2
  100. package/node_modules/typebox/build/format/json_pointer_uri_fragment.d.mts +2 -2
  101. package/node_modules/typebox/build/format/json_pointer_uri_fragment.mjs +2 -2
  102. package/node_modules/typebox/build/format/relative_json_pointer.d.mts +2 -2
  103. package/node_modules/typebox/build/format/relative_json_pointer.mjs +2 -2
  104. package/node_modules/typebox/build/system/memory/assign.mjs +2 -1
  105. package/node_modules/typebox/build/system/memory/create.mjs +3 -4
  106. package/node_modules/typebox/build/system/memory/discard.mjs +2 -2
  107. package/node_modules/typebox/build/system/memory/freeze.d.mts +4 -0
  108. package/node_modules/typebox/build/system/memory/freeze.mjs +6 -0
  109. package/node_modules/typebox/build/system/memory/update.mjs +3 -2
  110. package/node_modules/typebox/package.json +1 -1
  111. package/node_modules/undici/docs/docs/api/Client.md +4 -0
  112. package/node_modules/undici/docs/docs/api/EnvHttpProxyAgent.md +3 -2
  113. package/node_modules/undici/docs/docs/api/EventSource.md +4 -0
  114. package/node_modules/undici/docs/docs/api/Interceptors.md +7 -3
  115. package/node_modules/undici/docs/docs/api/Socks5ProxyAgent.md +7 -1
  116. package/node_modules/undici/lib/cache/memory-cache-store.js +2 -2
  117. package/node_modules/undici/lib/core/symbols.js +2 -0
  118. package/node_modules/undici/lib/dispatcher/agent.js +7 -2
  119. package/node_modules/undici/lib/dispatcher/balanced-pool.js +7 -4
  120. package/node_modules/undici/lib/dispatcher/client-h1.js +12 -4
  121. package/node_modules/undici/lib/dispatcher/client-h2.js +43 -3
  122. package/node_modules/undici/lib/dispatcher/client.js +3 -2
  123. package/node_modules/undici/lib/dispatcher/dispatcher-base.js +13 -1
  124. package/node_modules/undici/lib/dispatcher/dispatcher.js +15 -1
  125. package/node_modules/undici/lib/dispatcher/dispatcher1-wrapper.js +3 -0
  126. package/node_modules/undici/lib/dispatcher/env-http-proxy-agent.js +10 -3
  127. package/node_modules/undici/lib/dispatcher/proxy-agent.js +18 -1
  128. package/node_modules/undici/lib/dispatcher/retry-agent.js +3 -0
  129. package/node_modules/undici/lib/dispatcher/round-robin-pool.js +1 -1
  130. package/node_modules/undici/lib/dispatcher/socks5-proxy-agent.js +91 -21
  131. package/node_modules/undici/lib/handler/cache-handler.js +29 -5
  132. package/node_modules/undici/lib/handler/decorator-handler.js +7 -1
  133. package/node_modules/undici/lib/handler/deduplication-handler.js +12 -6
  134. package/node_modules/undici/lib/handler/redirect-handler.js +21 -4
  135. package/node_modules/undici/lib/handler/retry-handler.js +148 -30
  136. package/node_modules/undici/lib/interceptor/cache.js +65 -12
  137. package/node_modules/undici/lib/interceptor/decompress.js +115 -13
  138. package/node_modules/undici/lib/interceptor/deduplicate.js +5 -4
  139. package/node_modules/undici/lib/interceptor/dns.js +7 -0
  140. package/node_modules/undici/lib/interceptor/dump.js +10 -23
  141. package/node_modules/undici/lib/mock/mock-agent.js +13 -1
  142. package/node_modules/undici/lib/mock/mock-utils.js +11 -10
  143. package/node_modules/undici/lib/util/cache.js +45 -3
  144. package/node_modules/undici/lib/web/cookies/parse.js +150 -147
  145. package/node_modules/undici/lib/web/eventsource/eventsource-stream.js +28 -1
  146. package/node_modules/undici/lib/web/eventsource/eventsource.js +13 -3
  147. package/node_modules/undici/lib/web/fetch/index.js +6 -0
  148. package/node_modules/undici/lib/web/fetch/request.js +2 -3
  149. package/node_modules/undici/lib/web/fetch/util.js +6 -1
  150. package/node_modules/undici/lib/web/webidl/index.js +3 -3
  151. package/node_modules/undici/lib/web/websocket/connection.js +1 -1
  152. package/node_modules/undici/lib/web/websocket/permessage-deflate.js +5 -0
  153. package/node_modules/undici/lib/web/websocket/stream/websocketstream.js +8 -10
  154. package/node_modules/undici/package.json +3 -3
  155. package/node_modules/undici/types/client.d.ts +10 -0
  156. package/node_modules/undici/types/interceptors.d.ts +2 -0
  157. package/node_modules/undici/types/mock-agent.d.ts +11 -10
  158. package/node_modules/undici/types/socks5-proxy-agent.d.ts +2 -0
  159. package/openclaw.plugin.json +15 -8
  160. package/package.json +7 -6
  161. package/skills/discord/SKILL.md +1 -1
  162. package/dist/account-inspect-BDfKyuvL.js +0 -89
  163. package/dist/provider.runtime-DiYaHvOz.js +0 -2
  164. package/dist/sdk-runtime-4geQHtXc.js +0 -338
  165. package/dist/targets-CtTKvntJ.js +0 -3
@@ -1,29 +1,31 @@
1
- import { A as ThreadUpdateListener, C as MessageCreateListener, D as ReadyListener, E as PresenceUpdateListener, G as User, H as CommandWithSubcommands, I as RateLimitError, K as hasDiscordV2Components, M as Client, N as Plugin, S as InteractionCreateListener, T as MessageReactionRemoveListener, U as Guild, V as Command, W as Message, Z as Modal, a as chunkDiscordTextWithMode, b as GuildCreateListener, ct as Row, dt as StringSelectMenu, et as Button, ft as TextDisplay, ht as BaseMessageInteractiveComponent, k as ThreadDeleteListener, nt as Container, ut as Separator, w as MessageReactionAddListener, x as GuildDeleteListener, y as discord_exports } from "./retry-Cv4jCU5Z.js";
2
- import { C as parseDiscordComponentCustomId, D as decodeCustomIdComponent, E as parseDiscordModalCustomIdForInteraction, O as encodeCustomIdComponent, S as parseDiscordActivityCustomIdForInteraction, T as parseDiscordModalCustomId, c as parseExecApprovalData, o as parseDiscordQuestionData, v as buildDiscordActivityCustomId, w as parseDiscordComponentCustomIdForInteraction } from "./components-B9V5o361.js";
3
- import { c as resolveDiscordAccount, f as resolveDiscordAccountDmPolicy, l as resolveDiscordAccountAllowFrom, m as normalizeDiscordToken, p as resolveDiscordMaxLinesPerMessage } from "./accounts-CfQ-vSyf.js";
4
- import { a as resolveDiscordComponentEntryWithPersistence, o as resolveDiscordModalEntryWithPersistence, t as editDiscordComponentMessage } from "./send.components-DKKAw5VX.js";
1
+ import { A as ThreadDeleteListener, C as InteractionCreateListener, D as PresenceUpdateListener, E as MessageReactionRemoveListener, G as Message, H as Command, K as User, L as RateLimitError, N as Client, O as ReadyListener, P as Plugin, Q as Modal, S as GuildDeleteListener, T as MessageReactionAddListener, U as CommandWithSubcommands, W as Guild, b as discord_exports, dt as Separator, ft as StringSelectMenu, gt as BaseMessageInteractiveComponent, j as ThreadUpdateListener, lt as Row, o as chunkDiscordTextWithMode, pt as TextDisplay, q as hasDiscordV2Components, rt as Container, tt as Button, w as MessageCreateListener, x as GuildCreateListener } from "./retry-DQt1zDgH.js";
2
+ import { C as parseDiscordActivityCustomIdForInteraction, D as parseDiscordModalCustomIdForInteraction, E as parseDiscordModalCustomId, O as decodeCustomIdComponent, T as parseDiscordComponentCustomIdForInteraction, c as parseExecApprovalData, k as encodeCustomIdComponent, o as parseDiscordQuestionData, w as parseDiscordComponentCustomId, y as buildDiscordActivityCustomId } from "./components-BimX47Mq.js";
3
+ import { c as resolveDiscordAccount, f as resolveDiscordAccountDmPolicy, l as resolveDiscordAccountAllowFrom, m as normalizeDiscordToken, p as resolveDiscordMaxLinesPerMessage } from "./accounts-CwJQoLjM.js";
4
+ import { a as resolveDiscordComponentEntryWithPersistence, o as resolveDiscordModalEntryWithPersistence, t as editDiscordComponentMessage } from "./send.components-BG5IDABj.js";
5
5
  import { t as getDiscordRuntime } from "./runtime-DgnVQ7zW.js";
6
- import { a as isDiscordRateLimitResponseBody, o as summarizeDiscordResponseBody } from "./api-DNVbJyEy.js";
7
- import { C as resolveTimestampMs, a as normalizeDiscordSlug, b as formatDiscordReactionEmoji, c as resolveDiscordChannelConfigWithFallback, d as resolveDiscordCommandOwnerAllowFrom, f as resolveDiscordGuildEntry, g as resolveDiscordOwnerAllowFrom, h as resolveDiscordOwnerAccess, i as normalizeDiscordDisplaySlug, l as resolveDiscordChannelPolicyCommandAuthorizer, m as resolveDiscordMemberAllowed, n as isDiscordGroupAllowedByPolicy, o as resolveDiscordAllowListMatch, p as resolveDiscordMemberAccessState, r as normalizeDiscordAllowList, v as resolveGroupDmAllow, x as formatDiscordUserTag, y as shouldEmitDiscordReactionNotification } from "./allow-list-BDMimASD.js";
8
- import { B as validateDiscordProxyUrl, G as unregisterGateway, P as createDiscordRestClient, R as DISCORD_REST_TIMEOUT_MS, V as withValidatedDiscordProxy, W as registerGateway, b as canViewDiscordGuildChannel } from "./send.shared-JjljcV4O.js";
9
- import { a as formatMention, t as sendMessageDiscord } from "./send.outbound-zam0TrZx.js";
6
+ import { a as isDiscordRateLimitResponseBody, o as summarizeDiscordResponseBody } from "./api-BfmEP6wp.js";
7
+ import { S as resolveTimestampMs, _ as resolveGroupDmAllow, a as normalizeDiscordSlug, b as formatDiscordUserTag, c as resolveDiscordChannelConfigWithFallback, d as resolveDiscordGuildEntry, f as resolveDiscordMemberAccessState, h as resolveDiscordOwnerAllowFrom, i as normalizeDiscordDisplaySlug, l as resolveDiscordChannelPolicyCommandAuthorizer, m as resolveDiscordOwnerAccess, n as isDiscordGroupAllowedByPolicy, o as resolveDiscordAllowListMatch, p as resolveDiscordMemberAllowed, r as normalizeDiscordAllowList, s as resolveDiscordChannelConfig, v as shouldEmitDiscordReactionNotification, y as formatDiscordReactionEmoji } from "./allow-list-DBTtR2dz.js";
8
+ import { B as validateDiscordProxyUrl, G as unregisterGateway, P as createDiscordRestClient, R as DISCORD_REST_TIMEOUT_MS, V as withValidatedDiscordProxy, W as registerGateway, b as canViewDiscordGuildChannel, w as hasAnyChannelPermissionDiscord } from "./send.shared-B0n_fWzu.js";
9
+ import { a as formatMention, t as sendMessageDiscord } from "./send.outbound-DHuFUL6W.js";
10
10
  import { t as isDiscordThreadChannelType } from "./channel-type-CVLZyGYS.js";
11
- import { n as getDiscordActivitiesRuntime } from "./runtime-CY4PRMF-.js";
12
- import { n as resolveDiscordVoiceEnabled, r as authorizeDiscordVoiceIngress, t as resolveDiscordVoiceAccess } from "./owner-access-UlYi9t0M.js";
11
+ import { n as getDiscordActivitiesRuntime } from "./runtime-BHsdEdr5.js";
12
+ import { n as resolveDiscordVoiceEnabled, r as authorizeDiscordVoiceIngress, t as resolveDiscordVoiceAccess } from "./owner-access-Cp8r6Ipf.js";
13
+ import { t as resolveDiscordCommandOwnerAllowFrom } from "./command-owners-D78sAoOz.js";
13
14
  import { i as setPresence, t as clearPresences } from "./presence-cache-z1N8MbJ3.js";
14
- import { s as sendVoiceMessageDiscord } from "./send-C49MFF9j.js";
15
- import { c as raceWithTimeout, u as withAbortTimeout } from "./timeouts-B9cy6RvQ.js";
16
- import { S as isDiscordExecApprovalClientEnabled, b as getDiscordExecApprovalApprovers, c as resolveDiscordEffectiveRoute, i as buildDiscordConversationRouteContext, n as DISCORD_APPROVAL_ALLOWED_MENTIONS, o as resolveDiscordBoundConversationRoute, r as formatDiscordApprovalDisplayValue, u as resolveDiscordConversationIdentity } from "./outbound-session-route-Cg15ZFJd.js";
17
- import { t as resolveDiscordChannelAllowlist } from "./resolve-channels-C2sT_n67.js";
18
- import { t as resolveDiscordUserAllowlist } from "./resolve-users-CzpjLwjy.js";
19
- import { a as isThreadArchived, c as resolveDiscordChannelInfoSafe, f as resolveDiscordChannelTopicSafe, h as formatThreadBindingDurationLabel, l as resolveDiscordChannelNameSafe, r as getThreadBindingManager, s as resolveDiscordChannelIdSafe, u as resolveDiscordChannelParentIdSafe } from "./thread-bindings.manager-ByOtwjo_.js";
20
- import { a as probeDiscordApplicationId, r as parseApplicationIdFromToken } from "./probe-n6ZXxK8V.js";
15
+ import { _ as readMessagesDiscord, s as sendVoiceMessageDiscord } from "./send-CZeWKUiA.js";
16
+ import { c as raceWithTimeout, u as withAbortTimeout } from "./timeouts-D86uWLt_.js";
17
+ import { S as isDiscordExecApprovalClientEnabled, b as getDiscordExecApprovalApprovers, c as resolveDiscordEffectiveRoute, i as buildDiscordConversationRouteContext, n as DISCORD_APPROVAL_ALLOWED_MENTIONS, o as resolveDiscordBoundConversationRoute, r as formatDiscordApprovalDisplayValue, u as resolveDiscordConversationIdentity } from "./outbound-session-route-Q_HEusBQ.js";
18
+ import { t as discordIngressIdentity } from "./ingress-identity-XNmW-mZS.js";
19
+ import { t as resolveDiscordChannelAllowlist } from "./resolve-channels-CoiMlWy0.js";
20
+ import { t as resolveDiscordUserAllowlist } from "./resolve-users-DJpiokfW.js";
21
+ import { a as isThreadArchived, c as resolveDiscordChannelInfoSafe, f as resolveDiscordChannelTopicSafe, h as formatThreadBindingDurationLabel, l as resolveDiscordChannelNameSafe, r as getThreadBindingManager, s as resolveDiscordChannelIdSafe, u as resolveDiscordChannelParentIdSafe } from "./thread-bindings.manager-pbbRT5gb.js";
22
+ import { a as probeDiscordApplicationId, r as parseApplicationIdFromToken } from "./probe-3ovFAp3b.js";
21
23
  import { i as sanitizeRecentModels, n as normalizeModelRef, r as preferenceTimestampMs, t as buildPreferenceModelKey } from "./model-picker-preference-primitives-BHT1LkR_.js";
22
- import { f as resolveDiscordChannelInfo, u as resolveDiscordMessageStickers } from "./message-text-aiwO5R2F.js";
23
- import { i as resolveDiscordThreadParentInfo } from "./threading-agH1T_6s.js";
24
- import { t as resolveDiscordSenderIdentity } from "./sender-identity-BJtfyise.js";
24
+ import { m as resolveDiscordChannelInfo, u as resolveDiscordMessageStickers } from "./message-text-DK4NnBg-.js";
25
+ import { i as resolveDiscordThreadParentInfo } from "./threading-BCx49X-6.js";
26
+ import { t as resolveDiscordSenderIdentity } from "./sender-identity-B8Ncfi63.js";
25
27
  import { logDebug, logError } from "openclaw/plugin-sdk/logging-core";
26
- import { ApplicationCommandOptionType, ButtonStyle, ChannelType, ComponentType, GatewayCloseCodes, GatewayCloseCodes as GatewayCloseCodes$1, GatewayDispatchEvents, GatewayIntentBits, GatewayOpcodes } from "discord-api-types/v10";
28
+ import { ApplicationCommandOptionType, ButtonStyle, ChannelType, ComponentType, GatewayCloseCodes, GatewayCloseCodes as GatewayCloseCodes$1, GatewayDispatchEvents, GatewayIntentBits, GatewayOpcodes, PermissionFlagsBits } from "discord-api-types/v10";
27
29
  import { Type } from "typebox";
28
30
  import { Check, Errors } from "typebox/value";
29
31
  import { createHash, randomUUID } from "node:crypto";
@@ -37,6 +39,7 @@ import { normalizeAccountId } from "openclaw/plugin-sdk/account-id";
37
39
  import { resolveAgentRoute } from "openclaw/plugin-sdk/routing";
38
40
  import { asFiniteNumber, asOptionalRecord, normalizeLowercaseStringOrEmpty, normalizeOptionalLowercaseString, normalizeOptionalString, normalizeStringEntries, parseFiniteNumber as parseFiniteNumber$1, parseStrictNonNegativeInteger as parseStrictNonNegativeInteger$1, summarizeStringEntries } from "openclaw/plugin-sdk/string-coerce-runtime";
39
41
  import { getRuntimeConfig, getRuntimeConfigSnapshot } from "openclaw/plugin-sdk/runtime-config-snapshot";
42
+ import { resolveSendableOutboundReplyParts, resolveTextChunksWithFallback } from "openclaw/plugin-sdk/reply-payload";
40
43
  import { createHttp1EnvHttpProxyAgent, createHttp1ProxyAgent, createNodeProxyAgent, resolveEnvHttpProxyAgentOptions, wrapFetchWithAbortSignal } from "openclaw/plugin-sdk/fetch-runtime";
41
44
  import { createNonExitingRuntime, createSubsystemLogger, danger, formatDurationSeconds, isVerbose, logVerbose, shouldLogVerbose, sleepWithAbort, warn } from "openclaw/plugin-sdk/runtime-env";
42
45
  import { sliceUtf16Safe, truncateUtf16Safe, withTimeout } from "openclaw/plugin-sdk/text-utility-runtime";
@@ -46,7 +49,6 @@ import { resolveChunkMode, resolveTextChunkLimit } from "openclaw/plugin-sdk/rep
46
49
  import { chunkItems, findCodeRegions, sanitizeAssistantVisibleText, sanitizeAssistantVisibleTextWithProfile } from "openclaw/plugin-sdk/text-chunking";
47
50
  import { buildOutboundSessionContext, listMessageReceiptPlatformIds, resolveChannelStreamingBlockEnabled, sendDurableMessageBatch } from "openclaw/plugin-sdk/channel-outbound";
48
51
  import { getAgentScopedMediaLocalRoots } from "openclaw/plugin-sdk/media-runtime";
49
- import { resolveSendableOutboundReplyParts, resolveTextChunksWithFallback } from "openclaw/plugin-sdk/reply-payload";
50
52
  import { loadWebMedia } from "openclaw/plugin-sdk/web-media";
51
53
  import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
52
54
  import { buildCommandTextFromArgs, findCommandByNativeName, formatCommandArgMenuTitle, listChatCommands, listNativeCommandSpecsForConfig, listSkillCommandsForAgents, resolveCommandAuthorizedFromAuthorizers, resolveEffectiveAgentRuntime, resolveNativeCommandSessionTargets, resolveStoredModelOverride, serializeCommandArgs } from "openclaw/plugin-sdk/command-auth-native";
@@ -57,13 +59,13 @@ import { CHANNEL_APPROVAL_NATIVE_RUNTIME_CONTEXT_CAPABILITY } from "openclaw/plu
57
59
  import { buildPairingReply, upsertChannelPairingRequest, upsertChannelPairingRequest as upsertChannelPairingRequest$1 } from "openclaw/plugin-sdk/conversation-runtime";
58
60
  import * as conversationRuntime from "openclaw/plugin-sdk/conversation-binding-runtime";
59
61
  import { questionGatewayRuntime } from "openclaw/plugin-sdk/question-gateway-runtime";
62
+ import { createChannelIngressResolver, readChannelIngressStoreAllowFromForDmPolicy } from "openclaw/plugin-sdk/channel-ingress-runtime";
60
63
  import { clearExpiredCooldowns, ensureAuthProfileStore, formatReasoningMessage, getPreparedModelCatalogSnapshot, isProfileInCooldown, listAgentIds, loadPreparedModelCatalog, resolveAgentAvatar, resolveAgentDir, resolveDefaultModelForAgent, resolveHumanDelayConfig, resolveProfilesUnavailableReason } from "openclaw/plugin-sdk/agent-runtime";
61
64
  import { isDangerousNameMatchingEnabled } from "openclaw/plugin-sdk/dangerous-name-runtime";
62
65
  import { resolveNativeCommandsEnabled, resolveNativeSkillsEnabled } from "openclaw/plugin-sdk/native-command-config-runtime";
63
66
  import { requestHeartbeat } from "openclaw/plugin-sdk/heartbeat-runtime";
64
67
  import { enqueueRoutedSystemEvent, enqueueRoutedSystemEvent as enqueueRoutedSystemEvent$1 } from "openclaw/plugin-sdk/system-event-runtime";
65
68
  import { deleteSessionEntry, getSessionEntry, listSessionEntries, readSessionUpdatedAt as readSessionUpdatedAt$1, resolveStorePath, resolveStorePath as resolveStorePath$1 } from "openclaw/plugin-sdk/session-store-runtime";
66
- import { createChannelIngressResolver, defineStableChannelIngressIdentity, readChannelIngressStoreAllowFromForDmPolicy } from "openclaw/plugin-sdk/channel-ingress-runtime";
67
69
  import { finalizeInboundContext } from "openclaw/plugin-sdk/reply-dispatch-runtime";
68
70
  import { createChannelPartialDeliveryError, dispatchChannelInboundTurn, formatInboundEnvelope, hasVisibleInboundReplyDispatch, isChannelPartialDeliveryError, resolveEnvelopeFormatOptions, resolveInboundSupplementalSenderAllowed, runChannelInboundEvent } from "openclaw/plugin-sdk/channel-inbound";
69
71
  import { buildCommandTextFromArgs as buildCommandTextFromArgs$1, findCommandByNativeName as findCommandByNativeName$1, mergeNativeCommandSpecs, parseCommandArgs, resolveCommandArgChoices, resolveCommandArgMenu, serializeCommandArgs as serializeCommandArgs$1 } from "openclaw/plugin-sdk/native-command-registry";
@@ -80,6 +82,7 @@ import { registerChannelRuntimeContext } from "openclaw/plugin-sdk/channel-runti
80
82
  import { stripPlainTextToolCallBlocks } from "openclaw/plugin-sdk/tool-payload";
81
83
  import { createChannelInteractiveDispatcher } from "openclaw/plugin-sdk/plugin-runtime";
82
84
  import { resolveApprovalOverGateway } from "openclaw/plugin-sdk/approval-gateway-runtime";
85
+ import { reportChannelRoomJoin } from "openclaw/plugin-sdk/channel-join-intro-runtime";
83
86
  import { resolveRequestUrl } from "openclaw/plugin-sdk/request-url";
84
87
  import { fetchWithRuntimeDispatcher } from "openclaw/plugin-sdk/runtime-fetch";
85
88
  import { Agent as Agent$1 } from "undici";
@@ -142,7 +145,7 @@ async function runDiscordListenerWithSlowLog(params) {
142
145
  }
143
146
  //#endregion
144
147
  //#region extensions/discord/src/monitor/presence-events.ts
145
- const DISCORD_PRESENCE_GREETING_COOLDOWN_MS = 480 * 60 * 1e3;
148
+ const DISCORD_PRESENCE_GREETING_COOLDOWN_MS = 288e5;
146
149
  function isDiscordOnlineStatus(status) {
147
150
  return status === "online" || status === "idle" || status === "dnd";
148
151
  }
@@ -181,9 +184,9 @@ function openDiscordPresenceCooldownStore() {
181
184
  }
182
185
  //#endregion
183
186
  //#region extensions/discord/src/monitor/presence-emission-gate.ts
184
- const DISCORD_PRESENCE_RECONNECT_SUPPRESS_MS = 300 * 1e3;
187
+ const DISCORD_PRESENCE_RECONNECT_SUPPRESS_MS = 3e5;
185
188
  const DISCORD_PRESENCE_BURST_LIMIT = 8;
186
- const DISCORD_PRESENCE_BURST_WINDOW_MS = 60 * 1e3;
189
+ const DISCORD_PRESENCE_BURST_WINDOW_MS = 6e4;
187
190
  function resolveDiscordPresenceGateOptions(config) {
188
191
  return {
189
192
  reconnectSuppressMs: config?.reconnectSuppressSeconds !== void 0 ? config.reconnectSuppressSeconds * 1e3 : DISCORD_PRESENCE_RECONNECT_SUPPRESS_MS,
@@ -341,55 +344,16 @@ async function closeDiscordThreadSessions(params) {
341
344
  }
342
345
  //#endregion
343
346
  //#region extensions/discord/src/monitor/dm-command-auth.ts
344
- const DISCORD_ALLOW_LIST_PREFIXES = [
345
- "discord:",
346
- "user:",
347
- "pk:"
348
- ];
349
347
  const DISCORD_CHANNEL_ID = "discord";
350
- const DISCORD_USER_ID_KIND = "stable-id";
351
- const DISCORD_USER_NAME_KIND = "username";
352
- function normalizeDiscordIdEntry(entry) {
353
- const text = entry.trim();
354
- if (!text) return null;
355
- const maybeId = text.replace(/^<@!?/, "").replace(/>$/, "");
356
- if (/^\d+$/.test(maybeId)) return maybeId;
357
- const prefix = DISCORD_ALLOW_LIST_PREFIXES.find((entryPrefix) => text.startsWith(entryPrefix));
358
- if (prefix) return text.slice(prefix.length).trim() || null;
359
- return null;
360
- }
361
- function normalizeDiscordNameEntry(entry) {
362
- const text = entry.trim();
363
- if (!text || text === "*" || normalizeDiscordIdEntry(text)) return null;
364
- const nameSlug = normalizeDiscordAllowList([text], DISCORD_ALLOW_LIST_PREFIXES)?.names.values().next().value;
365
- return typeof nameSlug === "string" && nameSlug ? nameSlug : null;
366
- }
367
- function normalizeDiscordNameSubject(value) {
368
- const nameSlug = normalizeDiscordAllowList([value], DISCORD_ALLOW_LIST_PREFIXES)?.names.values().next().value;
369
- return typeof nameSlug === "string" && nameSlug ? nameSlug : null;
370
- }
371
- const discordIngressIdentity = defineStableChannelIngressIdentity({
372
- key: "discordUserId",
373
- kind: DISCORD_USER_ID_KIND,
374
- normalizeEntry: normalizeDiscordIdEntry,
375
- normalizeSubject: (value) => value.trim() || null,
376
- sensitivity: "pii",
377
- aliases: [["discordUserName", normalizeDiscordNameEntry], ["discordUserTag", () => null]].map(([key, normalizeEntry]) => ({
378
- key,
379
- kind: DISCORD_USER_NAME_KIND,
380
- normalizeEntry,
381
- normalizeSubject: normalizeDiscordNameSubject,
382
- dangerous: true,
383
- sensitivity: "pii"
384
- }))
385
- });
386
348
  function createDiscordDmIngressSubject(sender) {
387
349
  return {
388
350
  stableId: sender.id,
389
351
  aliases: {
390
352
  discordUserName: sender.name,
391
- discordUserTag: sender.tag
392
- }
353
+ discordUserTag: sender.tag,
354
+ participantKind: sender.isPluralKit ? "pluralkit-member" : sender.authorKind
355
+ },
356
+ ...sender.isPluralKit ? { authentication: { discordUserId: "asserted" } } : {}
393
357
  };
394
358
  }
395
359
  function createDiscordDynamicAccessGroupResolver(params) {
@@ -464,7 +428,10 @@ async function resolveDiscordDmCommandAccess(params) {
464
428
  },
465
429
  dmPolicy: params.dmPolicy,
466
430
  groupPolicy: "disabled",
467
- policy: { mutableIdentifierMatching: params.allowNameMatching ? "enabled" : "disabled" },
431
+ policy: {
432
+ mutableIdentifierMatching: params.allowNameMatching ? "enabled" : "disabled",
433
+ ...params.minIdentifierAuthentication ? { minIdentifierAuthentication: params.minIdentifierAuthentication } : {}
434
+ },
468
435
  allowFrom: params.configuredAllowFrom,
469
436
  command: {
470
437
  hasControlCommand: false,
@@ -494,7 +461,10 @@ async function resolveDiscordTextCommandAccess(params) {
494
461
  accessGroupMembership,
495
462
  dmPolicy: "allowlist",
496
463
  groupPolicy: "allowlist",
497
- policy: { mutableIdentifierMatching: params.allowNameMatching ? "enabled" : "disabled" },
464
+ policy: {
465
+ mutableIdentifierMatching: params.allowNameMatching ? "enabled" : "disabled",
466
+ ...params.minIdentifierAuthentication ? { minIdentifierAuthentication: params.minIdentifierAuthentication } : {}
467
+ },
498
468
  allowFrom: ownerAllowFrom,
499
469
  groupAllowFrom: commandGroup,
500
470
  command: {
@@ -839,7 +809,7 @@ async function handleDiscordReactionEvent(params) {
839
809
  };
840
810
  const emitReaction = (text, parentPeerId) => {
841
811
  const { contextKey } = resolveReactionBase();
842
- enqueueRoutedSystemEvent(text, resolveAgentRoute({
812
+ const route = resolveAgentRoute({
843
813
  cfg: params.cfg,
844
814
  channel: "discord",
845
815
  accountId: params.accountId,
@@ -853,7 +823,8 @@ async function handleDiscordReactionEvent(params) {
853
823
  kind: "channel",
854
824
  id: parentPeerId
855
825
  } : void 0
856
- }), { contextKey });
826
+ });
827
+ enqueueRoutedSystemEvent(text, route, { contextKey });
857
828
  };
858
829
  const shouldNotifyReaction = (options) => shouldEmitDiscordReactionNotification({
859
830
  mode: options.mode,
@@ -1523,7 +1494,7 @@ async function dispatchDiscordNativeAgentReply(params) {
1523
1494
  deliver: async (payload) => {
1524
1495
  if (params.suppressReplies) return {
1525
1496
  visibleReplySent: false,
1526
- suppression: { reason: "no_visible_result" }
1497
+ suppression: { reason: "channel_transform" }
1527
1498
  };
1528
1499
  const payloadDelivered = await deliverDiscordInteractionReply({
1529
1500
  interaction: params.interaction,
@@ -1546,7 +1517,7 @@ async function dispatchDiscordNativeAgentReply(params) {
1546
1517
  };
1547
1518
  },
1548
1519
  onDelivered: (payload, info, result) => {
1549
- if (params.suppressReplies && info.kind === "final" && result?.suppression?.reason === "no_visible_result" && payload.text?.trim()) hiddenFinalReply = payload;
1520
+ if (params.suppressReplies && info.kind === "final" && result?.suppression?.reason === "channel_transform" && payload.text?.trim()) hiddenFinalReply = payload;
1550
1521
  if (info.kind === "final" && result?.visibleReplySent !== void 0 && (result.visibleReplySent || finalReplyOutcome !== "failed")) finalReplyOutcome = result.visibleReplySent ? "accepted" : "suppressed";
1551
1522
  },
1552
1523
  onError: (err, info) => {
@@ -1568,12 +1539,12 @@ async function dispatchDiscordNativeAgentReply(params) {
1568
1539
  disableBlockStreaming: typeof blockStreamingEnabled === "boolean" ? !blockStreamingEnabled : void 0
1569
1540
  }
1570
1541
  });
1571
- const deliberateSilentTerminalReply = turnResult.dispatched && turnResult.dispatchResult.deliberateSilentTerminalReply === true;
1542
+ const shouldSettleWithoutVisibleReply = params.suppressReplies || finalReplyOutcome === "suppressed" || turnResult.dispatched && (turnResult.dispatchResult.deliberateSilentTerminalReply === true || turnResult.dispatchResult.deferredToActiveRun !== void 0);
1572
1543
  const dispatchResult = {
1573
1544
  dispatched: turnResult.dispatched,
1574
1545
  ...hiddenFinalReply ? { hiddenFinalReply } : {}
1575
1546
  };
1576
- if (!didReply && (params.suppressReplies || finalReplyOutcome === "suppressed" || deliberateSilentTerminalReply)) {
1547
+ if (!didReply && shouldSettleWithoutVisibleReply) {
1577
1548
  await settleDiscordInteractionWithoutVisibleReply(params.interaction);
1578
1549
  return dispatchResult;
1579
1550
  }
@@ -1695,7 +1666,7 @@ function buildDiscordCommandArgMenu(params) {
1695
1666
  const commandLabel = command.nativeName ?? command.key;
1696
1667
  const userId = interaction.user?.id ?? "";
1697
1668
  const rows = chunkItems(menu.choices, 4).map((choices) => {
1698
- return new Row(choices.map((choice) => new DiscordCommandArgButton({
1669
+ const buttons = choices.map((choice) => new DiscordCommandArgButton({
1699
1670
  label: choice.label,
1700
1671
  customId: buildDiscordCommandArgCustomId({
1701
1672
  command: commandLabel,
@@ -1706,7 +1677,8 @@ function buildDiscordCommandArgMenu(params) {
1706
1677
  ctx: params.ctx,
1707
1678
  safeInteractionCall: params.safeInteractionCall,
1708
1679
  dispatchCommandInteraction: params.dispatchCommandInteraction
1709
- })));
1680
+ }));
1681
+ return new Row(buttons);
1710
1682
  });
1711
1683
  return {
1712
1684
  content: formatCommandArgMenuTitle({
@@ -2312,8 +2284,8 @@ function paginateItems(params) {
2312
2284
  };
2313
2285
  }
2314
2286
  async function loadDiscordModelPickerData(cfg, agentId) {
2315
- const { buildModelsProviderData } = await loadModelsProviderRuntime();
2316
- return buildModelsProviderData(cfg, agentId);
2287
+ const { buildPreparedModelsProviderData } = await loadModelsProviderRuntime();
2288
+ return buildPreparedModelsProviderData(cfg, agentId);
2317
2289
  }
2318
2290
  function buildDiscordModelPickerCustomId(params) {
2319
2291
  const userId = params.userId.trim();
@@ -2611,7 +2583,7 @@ function buildBucketSelectRow(params) {
2611
2583
  value: bucket.id,
2612
2584
  default: bucket.id === params.currentBucketId
2613
2585
  }));
2614
- return new Row([createModelSelect({
2586
+ const select = createModelSelect({
2615
2587
  customId: buildDiscordModelPickerCustomId({
2616
2588
  command: params.command,
2617
2589
  action: "bucket",
@@ -2626,7 +2598,8 @@ function buildBucketSelectRow(params) {
2626
2598
  }),
2627
2599
  options,
2628
2600
  placeholder: params.view === "providers" ? "Filter providers by letter range" : "Filter models by letter range"
2629
- })]);
2601
+ });
2602
+ return new Row([select]);
2630
2603
  }
2631
2604
  function getRuntimeChoices(params) {
2632
2605
  const choices = params.data.runtimeChoicesByProvider?.get(normalizeProviderId(params.provider));
@@ -3052,7 +3025,7 @@ function formatRecentsButtonLabel(modelRef, suffix) {
3052
3025
  const maxLen = 80;
3053
3026
  const label = suffix ? `${modelRef} ${suffix}` : modelRef;
3054
3027
  if (label.length <= maxLen) return label;
3055
- return suffix ? `${sliceUtf16Safe(modelRef, 0, maxLen - suffix.length - 2)}… ${suffix}` : `${sliceUtf16Safe(modelRef, 0, maxLen - 1)}…`;
3028
+ return suffix ? `${sliceUtf16Safe(modelRef, 0, maxLen - suffix.length - 2)}… ${suffix}` : `${sliceUtf16Safe(modelRef, 0, 79)}…`;
3056
3029
  }
3057
3030
  function createModelRefToken(modelRef) {
3058
3031
  const parsed = parseCurrentModelRef(modelRef);
@@ -3293,12 +3266,13 @@ function resolveDiscordModelPickerCurrentModel(params) {
3293
3266
  const fallback = `${params.data.resolvedDefault.provider}/${params.data.resolvedDefault.model}`;
3294
3267
  try {
3295
3268
  const storePath = resolveStorePath(params.cfg.session?.store, { agentId: params.route.agentId });
3269
+ const sessionEntry = getSessionEntry({
3270
+ storePath,
3271
+ sessionKey: params.route.sessionKey,
3272
+ readConsistency: "latest"
3273
+ });
3296
3274
  const override = resolveStoredModelOverride({
3297
- sessionEntry: getSessionEntry({
3298
- storePath,
3299
- sessionKey: params.route.sessionKey,
3300
- readConsistency: "latest"
3301
- }),
3275
+ sessionEntry,
3302
3276
  loadSessionEntry: (sessionKey) => getSessionEntry({
3303
3277
  storePath,
3304
3278
  sessionKey,
@@ -3317,8 +3291,9 @@ function resolveDiscordModelPickerCurrentModel(params) {
3317
3291
  }
3318
3292
  function resolveDiscordModelPickerCurrentRuntime(params) {
3319
3293
  try {
3294
+ const storePath = resolveStorePath(params.cfg.session?.store, { agentId: params.route.agentId });
3320
3295
  const sessionRuntime = normalizeOptionalString(getSessionEntry({
3321
- storePath: resolveStorePath(params.cfg.session?.store, { agentId: params.route.agentId }),
3296
+ storePath,
3322
3297
  sessionKey: params.route.sessionKey,
3323
3298
  readConsistency: "latest"
3324
3299
  })?.agentRuntimeOverride);
@@ -3974,7 +3949,8 @@ function buildDiscordCommandOptions(params) {
3974
3949
  await interaction.respond([]);
3975
3950
  return;
3976
3951
  }
3977
- const focusValue = normalizeLowercaseStringOrEmpty(interaction.options.getFocused()?.value);
3952
+ const focused = interaction.options.getFocused();
3953
+ const focusValue = normalizeLowercaseStringOrEmpty(focused?.value);
3978
3954
  const context = typeof arg.choices === "function" && resolveChoiceContext ? await resolveChoiceContext(interaction) : null;
3979
3955
  const currentCfg = resolveConfig?.() ?? cfg;
3980
3956
  const choiceCatalog = command.key === "think" ? getPreparedModelCatalogSnapshot({
@@ -4314,10 +4290,12 @@ async function dispatchDiscordCommandInteraction(params) {
4314
4290
  } : {},
4315
4291
  readOnly: true
4316
4292
  }) : void 0;
4317
- const menu = resolveCommandArgMenu({
4293
+ const menuRouteState = command.key === "verbose" ? await getNativeRouteState() : void 0;
4294
+ const menu = menuRouteState?.bindingReadiness?.ok === false ? null : resolveCommandArgMenu({
4318
4295
  command,
4319
4296
  args: commandArgs,
4320
4297
  cfg,
4298
+ session: menuRouteState?.effectiveRoute,
4321
4299
  provider: menuModelContext?.provider,
4322
4300
  model: menuModelContext?.model,
4323
4301
  agentRuntime: menuModelContext?.agentRuntime,
@@ -4856,7 +4834,10 @@ const GatewayIntents = GatewayIntentBits;
4856
4834
  const READY_STATE_OPEN = 1;
4857
4835
  const DEFAULT_GATEWAY_URL = "wss://gateway.discord.gg/";
4858
4836
  const DISCORD_GATEWAY_PAYLOAD_LIMIT_BYTES = 4096;
4859
- const DISCORD_GATEWAY_WS_CLIENT_OPTIONS = Object.freeze({ maxPayload: 16 * 1024 * 1024 });
4837
+ const DISCORD_GATEWAY_WS_CLIENT_OPTIONS = Object.freeze({
4838
+ maxPayload: 16777216,
4839
+ handshakeTimeout: 3e4
4840
+ });
4860
4841
  const INVALID_SESSION_MIN_DELAY_MS = 1e3;
4861
4842
  const INVALID_SESSION_JITTER_MS = 4e3;
4862
4843
  const RESUME_FAILURE_THRESHOLD = 3;
@@ -5039,12 +5020,10 @@ var GatewayPlugin = class extends Plugin {
5039
5020
  minDelayMs: INVALID_SESSION_MIN_DELAY_MS + Math.floor(Math.random() * INVALID_SESSION_JITTER_MS)
5040
5021
  });
5041
5022
  break;
5042
- case GatewayOpcodes.Reconnect:
5043
- this.scheduleReconnect({
5044
- reason: "reconnect-opcode",
5045
- preferResume: true
5046
- });
5047
- break;
5023
+ case GatewayOpcodes.Reconnect: this.scheduleReconnect({
5024
+ reason: "reconnect-opcode",
5025
+ preferResume: true
5026
+ });
5048
5027
  }
5049
5028
  }
5050
5029
  startHeartbeat(intervalMs) {
@@ -5486,7 +5465,7 @@ const DEFAULT_DISCORD_GATEWAY_URL = "wss://gateway.discord.gg/";
5486
5465
  const DEFAULT_DISCORD_GATEWAY_INFO_TIMEOUT_MS = 3e4;
5487
5466
  const MAX_DISCORD_GATEWAY_INFO_TIMEOUT_MS = 12e4;
5488
5467
  const DISCORD_GATEWAY_INFO_TIMEOUT_ENV = "OPENCLAW_DISCORD_GATEWAY_INFO_TIMEOUT_MS";
5489
- const DISCORD_GATEWAY_METADATA_MAX_BYTES = 4 * 1024 * 1024;
5468
+ const DISCORD_GATEWAY_METADATA_MAX_BYTES = 4194304;
5490
5469
  const DISCORD_GATEWAY_METADATA_FALLBACK_LOG_INTERVAL_MS = 6e4;
5491
5470
  const discordGatewayBotInfoSchema = Type.Object({
5492
5471
  url: Type.String({ minLength: 1 }),
@@ -5681,7 +5660,6 @@ async function fetchDiscordGatewayMetadataGuarded(input, init, options) {
5681
5660
  }
5682
5661
  //#endregion
5683
5662
  //#region extensions/discord/src/monitor/gateway-plugin.ts
5684
- const DISCORD_GATEWAY_HANDSHAKE_TIMEOUT_MS = 3e4;
5685
5663
  const DISCORD_GATEWAY_POLICY_VIOLATION_CLOSE_CODE = 1008;
5686
5664
  const DISCORD_GATEWAY_WS_RECEIVER_LIMIT_CODE = "WS_ERR_TOO_MANY_BUFFERED_PARTS";
5687
5665
  const DISCORD_GATEWAY_CLOSE_REASON_LOG_MAX_CHARS = 240;
@@ -5798,7 +5776,6 @@ function createGatewayPlugin(params) {
5798
5776
  const wsFlowId = randomUUID();
5799
5777
  const socket = new ((params.testing?.webSocketCtor) ?? ws.default)(url, {
5800
5778
  ...DISCORD_GATEWAY_WS_CLIENT_OPTIONS,
5801
- handshakeTimeout: DISCORD_GATEWAY_HANDSHAKE_TIMEOUT_MS,
5802
5779
  ...params.wsAgent ? { agent: params.wsAgent } : {}
5803
5780
  });
5804
5781
  let lastTransportError;
@@ -6526,7 +6503,7 @@ async function runDiscordGatewayLifecycle(params) {
6526
6503
  gatewayEmitter?.removeListener(DISCORD_GATEWAY_TRANSPORT_ACTIVITY_EVENT, onGatewayTransportActivity);
6527
6504
  if (params.voiceManager) {
6528
6505
  await params.voiceManager.destroy();
6529
- const { setDiscordTranscriptsVoiceManager } = await import("./transcripts-source-BR11iHA4.js").then((n) => n.n);
6506
+ const { setDiscordTranscriptsVoiceManager } = await import("./transcripts-source-Dc6Nnli5.js").then((n) => n.n);
6530
6507
  setDiscordTranscriptsVoiceManager({
6531
6508
  accountId: params.accountId,
6532
6509
  manager: null
@@ -6541,7 +6518,7 @@ async function runDiscordGatewayLifecycle(params) {
6541
6518
  let discordVoiceRuntimePromise;
6542
6519
  let discordProviderSessionRuntimePromise;
6543
6520
  async function loadDiscordVoiceRuntime() {
6544
- const promise = discordVoiceRuntimePromise ?? import("./voice-runtime-DIeaa8fJ.js");
6521
+ const promise = discordVoiceRuntimePromise ?? import("./voice-runtime-BQnILUbG.js").then((n) => n.t);
6545
6522
  discordVoiceRuntimePromise = promise;
6546
6523
  try {
6547
6524
  return await promise;
@@ -6551,7 +6528,7 @@ async function loadDiscordVoiceRuntime() {
6551
6528
  }
6552
6529
  }
6553
6530
  async function loadDiscordProviderSessionRuntime() {
6554
- const promise = discordProviderSessionRuntimePromise ?? import("./provider-session.runtime-B9xe-Qaf.js");
6531
+ const promise = discordProviderSessionRuntimePromise ?? import("./provider-session.runtime-BL2lHBH7.js");
6555
6532
  discordProviderSessionRuntimePromise = promise;
6556
6533
  try {
6557
6534
  return await promise;
@@ -6578,11 +6555,15 @@ const discordProviderRuntime = {
6578
6555
  //#endregion
6579
6556
  //#region extensions/discord/src/monitor/provider.acp.ts
6580
6557
  const DISCORD_ACP_STATUS_PROBE_TIMEOUT_MS = 8e3;
6581
- const DISCORD_ACP_STALE_RUNNING_ACTIVITY_MS = 120 * 1e3;
6558
+ const DISCORD_ACP_STALE_RUNNING_ACTIVITY_MS = 12e4;
6582
6559
  function isLegacyMissingSessionError(message) {
6583
6560
  return message.includes("Session is not ACP-enabled") || message.includes("ACP session metadata missing");
6584
6561
  }
6585
6562
  function classifyAcpStatusProbeError(params) {
6563
+ if (params.isAcpRuntimeError(params.error) && ["SESSION_OWNER_MIGRATION_REQUIRED", "SESSION_OWNER_UNSUPPORTED"].includes(params.error.detailCode ?? "")) return {
6564
+ status: "uncertain",
6565
+ reason: formatErrorMessage$1(params.error)
6566
+ };
6586
6567
  if (params.isAcpRuntimeError(params.error) && params.error.code === "ACP_SESSION_INIT_FAILED") return {
6587
6568
  status: "stale",
6588
6569
  reason: "session-init-failed"
@@ -6610,18 +6591,20 @@ async function probeDiscordAcpBindingHealth(params) {
6610
6591
  const { getAcpSessionManager, isAcpRuntimeError } = params.providerSessionRuntime;
6611
6592
  const manager = getAcpSessionManager();
6612
6593
  const statusProbeAbortController = new AbortController();
6594
+ const statusPromise = manager.getSessionStatus({
6595
+ cfg: params.cfg,
6596
+ sessionKey: params.sessionKey,
6597
+ agentId: params.agentId,
6598
+ signal: statusProbeAbortController.signal
6599
+ }).then((status) => ({
6600
+ kind: "status",
6601
+ status
6602
+ })).catch((error) => ({
6603
+ kind: "error",
6604
+ error
6605
+ }));
6613
6606
  const result = await raceWithTimeout({
6614
- promise: manager.getSessionStatus({
6615
- cfg: params.cfg,
6616
- sessionKey: params.sessionKey,
6617
- signal: statusProbeAbortController.signal
6618
- }).then((status) => ({
6619
- kind: "status",
6620
- status
6621
- })).catch((error) => ({
6622
- kind: "error",
6623
- error
6624
- })),
6607
+ promise: statusPromise,
6625
6608
  timeoutMs: DISCORD_ACP_STATUS_PROBE_TIMEOUT_MS,
6626
6609
  onTimeout: () => ({ kind: "timeout" })
6627
6610
  });
@@ -6792,7 +6775,8 @@ async function resolveGuildEntriesByChannelAllowlist(params) {
6792
6775
  };
6793
6776
  }
6794
6777
  }
6795
- summarizeMapping("discord channels", [...mappingByTarget.values()].map((group) => formatDiscordChannelResolvedGroup(group)), unresolved, params.runtime);
6778
+ const mapping = [...mappingByTarget.values()].map((group) => formatDiscordChannelResolvedGroup(group));
6779
+ summarizeMapping("discord channels", mapping, unresolved, params.runtime);
6796
6780
  return nextGuilds;
6797
6781
  } catch (err) {
6798
6782
  params.runtime.log?.(`discord channel resolve failed; using config entries. ${formatErrorMessage$1(err)}`);
@@ -6803,11 +6787,12 @@ async function resolveAllowFromByUserAllowlist(params) {
6803
6787
  const allowEntries = normalizeStringEntries(params.allowFrom).filter((entry) => entry !== "*");
6804
6788
  if (allowEntries.length === 0) return params.allowFrom;
6805
6789
  try {
6806
- const { resolvedMap, mapping, unresolved } = buildAllowlistResolutionSummary(await resolveDiscordUserAllowlist({
6790
+ const resolvedUsers = await resolveDiscordUserAllowlist({
6807
6791
  token: params.token,
6808
6792
  entries: allowEntries,
6809
6793
  fetcher: params.fetcher
6810
- }), {
6794
+ });
6795
+ const { resolvedMap, mapping, unresolved } = buildAllowlistResolutionSummary(resolvedUsers, {
6811
6796
  formatResolved: formatDiscordUserResolved,
6812
6797
  formatUnresolved: formatDiscordUserUnresolved
6813
6798
  });
@@ -6836,11 +6821,12 @@ async function resolveGuildEntriesByUserAllowlist(params) {
6836
6821
  const userEntries = collectGuildUserEntries(params.guildEntries);
6837
6822
  if (userEntries.size === 0) return params.guildEntries;
6838
6823
  try {
6839
- const { resolvedMap, mapping, unresolved } = buildAllowlistResolutionSummary(await resolveDiscordUserAllowlist({
6824
+ const resolvedUsers = await resolveDiscordUserAllowlist({
6840
6825
  token: params.token,
6841
6826
  entries: Array.from(userEntries),
6842
6827
  fetcher: params.fetcher
6843
- }), {
6828
+ });
6829
+ const { resolvedMap, mapping, unresolved } = buildAllowlistResolutionSummary(resolvedUsers, {
6844
6830
  formatResolved: formatDiscordUserResolved,
6845
6831
  formatUnresolved: formatDiscordUserUnresolved
6846
6832
  });
@@ -7157,9 +7143,7 @@ async function resolveDiscordProviderCommandSpecs(params) {
7157
7143
  const listSkillCommands = params.listSkillCommandsForAgents ?? listSkillCommandsForAgents;
7158
7144
  const listNativeCommandSpecs = params.listNativeCommandSpecsForConfig ?? listNativeCommandSpecsForConfig;
7159
7145
  const maxDiscordCommands = params.maxDiscordCommands ?? 100;
7160
- let pluginCommandRuntime;
7161
- if (params.nativeEnabled) pluginCommandRuntime = (await loadPluginCommandRuntime()).createPluginCommandRuntime();
7162
- const pluginCommandSpecs = pluginCommandRuntime?.listNativeCandidates("discord") ?? [];
7146
+ const pluginCommandSpecs = params.nativeEnabled ? (await loadPluginCommandRuntime()).createPluginCommandRuntime().listNativeCandidates("discord") : [];
7163
7147
  const onCollision = (normalizedName) => {
7164
7148
  params.runtime.error?.(danger(`discord: plugin command "/${normalizedName}" duplicates an existing native command. Skipping.`));
7165
7149
  };
@@ -7187,7 +7171,6 @@ async function resolveDiscordProviderCommandSpecs(params) {
7187
7171
  params.runtime.log?.(warn(`${initialCommandCount} commands exceed the ${maxDiscordCommands}-command Discord limit; removing per-skill commands and keeping /skill.`));
7188
7172
  } else for (const normalizedName of provisionalCollisions) onCollision(normalizedName);
7189
7173
  if (params.nativeEnabled && commandSpecs.length > maxDiscordCommands) params.runtime.log?.(warn(`${commandSpecs.length} commands exceed the ${maxDiscordCommands}-command Discord limit; some commands may fail to deploy.`));
7190
- if (commandSpecs.some((command) => "prepareDispatch" in command)) pluginCommandRuntime?.retainNativeCatalog("discord");
7191
7174
  return {
7192
7175
  skillCommands,
7193
7176
  commandSpecs
@@ -7215,7 +7198,7 @@ function logDiscordResolvedConfig(params) {
7215
7198
  limit: 4,
7216
7199
  emptyText: "any"
7217
7200
  });
7218
- logVerbose(`discord: config dm=${params.dmEnabled ? "on" : "off"} dmPolicy=${params.dmPolicy} allowFrom=${allowFromSummary} groupDm=${params.groupDmEnabled ? "on" : "off"} groupDmChannels=${groupDmChannelSummary} groupPolicy=${params.groupPolicy} guilds=${guildSummary} historyLimit=${params.historyLimit} mediaMaxMb=${Math.round(params.mediaMaxBytes / (1024 * 1024))} native=${params.nativeEnabled ? "on" : "off"} nativeSkills=${params.nativeSkillsEnabled ? "on" : "off"} accessGroups=${params.useAccessGroups ? "on" : "off"} threadBindings=${params.threadBindingsEnabled ? "on" : "off"} threadIdleTimeout=${formatThreadBindingDurationForConfigLabel(params.threadBindingIdleTimeoutMs)} threadMaxAge=${formatThreadBindingDurationForConfigLabel(params.threadBindingMaxAgeMs)}`);
7201
+ logVerbose(`discord: config dm=${params.dmEnabled ? "on" : "off"} dmPolicy=${params.dmPolicy} allowFrom=${allowFromSummary} groupDm=${params.groupDmEnabled ? "on" : "off"} groupDmChannels=${groupDmChannelSummary} groupPolicy=${params.groupPolicy} guilds=${guildSummary} historyLimit=${params.historyLimit} mediaMaxMb=${Math.round(params.mediaMaxBytes / 1048576)} native=${params.nativeEnabled ? "on" : "off"} nativeSkills=${params.nativeSkillsEnabled ? "on" : "off"} accessGroups=${params.useAccessGroups ? "on" : "off"} threadBindings=${params.threadBindingsEnabled ? "on" : "off"} threadIdleTimeout=${formatThreadBindingDurationForConfigLabel(params.threadBindingIdleTimeoutMs)} threadMaxAge=${formatThreadBindingDurationForConfigLabel(params.threadBindingMaxAgeMs)}`);
7219
7202
  }
7220
7203
  //#endregion
7221
7204
  //#region extensions/discord/src/monitor/provider.deploy-errors.ts
@@ -8203,7 +8186,9 @@ function stripDiscordInternalChannelLines(text) {
8203
8186
  return kept.join("\n");
8204
8187
  }
8205
8188
  function sanitizeDiscordFrontChannelText(text) {
8206
- return collapseExcessBlankLines(stripDiscordInternalChannelLines(stripPlainTextToolCallBlocks(sanitizeAssistantVisibleText(stripPlainTextToolCallBlocks(text, { resolveProtectedRanges: findCodeRegions })), { resolveProtectedRanges: findCodeRegions }))).trim();
8189
+ const withoutToolCallBlocks = stripPlainTextToolCallBlocks(text, { resolveProtectedRanges: findCodeRegions });
8190
+ const withoutAssistantScaffolding = sanitizeAssistantVisibleText(withoutToolCallBlocks);
8191
+ return collapseExcessBlankLines(stripDiscordInternalChannelLines(stripPlainTextToolCallBlocks(withoutAssistantScaffolding, { resolveProtectedRanges: findCodeRegions }))).trim();
8207
8192
  }
8208
8193
  function sanitizeDiscordFrontChannelReplyPayloads(payloads, options = {}) {
8209
8194
  const preserveVerboseToolProgress = options.kind === "tool";
@@ -8242,7 +8227,8 @@ function resolveBoundThreadBinding(params) {
8242
8227
  }
8243
8228
  function resolveBindingIdentity(cfg, binding) {
8244
8229
  if (!binding) return;
8245
- const identity = { name: truncateUtf16Safe(`🤖 ${binding.label?.trim() || binding.agentId}`.trim() || "🤖 agent", 80) };
8230
+ const displayName = `🤖 ${binding.label?.trim() || binding.agentId}`.trim() || "🤖 agent";
8231
+ const identity = { name: truncateUtf16Safe(displayName, 80) };
8246
8232
  try {
8247
8233
  const avatar = resolveAgentAvatar(cfg, binding.agentId);
8248
8234
  if (avatar.kind === "remote") identity.avatarUrl = avatar.url;
@@ -8317,6 +8303,7 @@ async function deliverDiscordReply(params) {
8317
8303
  threadId: delivery.threadId,
8318
8304
  identity: delivery.identity,
8319
8305
  onPlatformSendDispatch: params.onPlatformSendDispatch,
8306
+ assertDirectAdapterHandoff: params.assertPlatformSendAuthorized,
8320
8307
  deps: createDiscordDeliveryDeps({
8321
8308
  cfg: params.cfg,
8322
8309
  token: params.token,
@@ -8355,7 +8342,7 @@ async function deliverDiscordReply(params) {
8355
8342
  //#endregion
8356
8343
  //#region extensions/discord/src/monitor/agent-components.dispatch.ts
8357
8344
  const loadConversationRuntime$1 = createLazyRuntimeModule(() => import("./agent-components.runtime-CEPrf2SY.js"));
8358
- const loadTypingRuntime = createLazyRuntimeModule(() => import("./typing-Dc_YMY2e.js").then((n) => n.n));
8345
+ const loadTypingRuntime = createLazyRuntimeModule(() => import("./typing-CuopV-Hi.js").then((n) => n.n));
8359
8346
  function buildDiscordComponentConversationLabel(params) {
8360
8347
  if (params.interactionCtx.isDirectMessage) return buildDirectLabel(params.interactionCtx.user);
8361
8348
  if (params.interactionCtx.isGroupDm) return `Group DM #${params.channelCtx.channelName ?? params.interactionCtx.channelId} channel id:${params.interactionCtx.channelId}`;
@@ -8596,7 +8583,8 @@ async function dispatchDiscordComponentEvent(params) {
8596
8583
  mediaLocalRoots,
8597
8584
  kind: info.kind,
8598
8585
  bindPendingFinalDelivery: info.bindPendingFinalDelivery,
8599
- onPlatformSendDispatch: info.onPlatformSendDispatch
8586
+ onPlatformSendDispatch: info.onPlatformSendDispatch,
8587
+ assertPlatformSendAuthorized: info.assertPlatformSendAuthorized
8600
8588
  });
8601
8589
  if (result.visibleReplySent) replyReference.markSent();
8602
8590
  return result;
@@ -8761,7 +8749,7 @@ async function dispatchPluginDiscordInteractiveEvent(params) {
8761
8749
  }
8762
8750
  //#endregion
8763
8751
  //#region extensions/discord/src/monitor/agent-components.handlers.ts
8764
- const loadComponentsRuntime = createLazyRuntimeModule(() => import("./components-B9V5o361.js").then((n) => n.t));
8752
+ const loadComponentsRuntime = createLazyRuntimeModule(() => import("./components-BimX47Mq.js").then((n) => n.t));
8765
8753
  async function handleDiscordComponentEvent(params) {
8766
8754
  const parsed = parseDiscordComponentData(params.data, resolveInteractionCustomId(params.interaction));
8767
8755
  if (!parsed) {
@@ -8903,8 +8891,9 @@ async function handleDiscordModalTrigger(params) {
8903
8891
  await replyUnavailableComponentInteraction(params.interaction, "This form has expired.");
8904
8892
  return;
8905
8893
  }
8894
+ const resolvedModalId = consumed.modalId ?? modalId;
8906
8895
  const modalEntry = await resolveDiscordModalEntryWithPersistence({
8907
- id: consumed.modalId ?? modalId,
8896
+ id: resolvedModalId,
8908
8897
  consume: false
8909
8898
  });
8910
8899
  if (!modalEntry) {
@@ -9611,6 +9600,170 @@ var VoicePlugin = class extends Plugin {
9611
9600
  }
9612
9601
  };
9613
9602
  //#endregion
9603
+ //#region extensions/discord/src/monitor/message-handler.preflight-channel-access.ts
9604
+ function resolveDiscordPreflightChannelAccess(params) {
9605
+ if (params.isGuildMessage && params.channelConfig?.enabled === false) {
9606
+ logDebug(`[discord-preflight] drop: channel disabled`);
9607
+ logVerbose(`Blocked discord channel ${params.messageChannelId} (channel disabled, ${params.channelMatchMeta})`);
9608
+ return {
9609
+ allowed: false,
9610
+ channelAllowlistConfigured: false,
9611
+ channelAllowed: false
9612
+ };
9613
+ }
9614
+ const groupDmAllowed = params.isGroupDm && resolveGroupDmAllow({
9615
+ channels: params.groupDmChannels,
9616
+ channelId: params.messageChannelId,
9617
+ channelName: params.displayChannelName,
9618
+ channelSlug: params.displayChannelSlug
9619
+ });
9620
+ if (params.isGroupDm && !groupDmAllowed) return {
9621
+ allowed: false,
9622
+ channelAllowlistConfigured: false,
9623
+ channelAllowed: false
9624
+ };
9625
+ const channelAllowlistConfigured = Boolean(params.guildInfo?.channels) && Object.keys(params.guildInfo?.channels ?? {}).length > 0;
9626
+ const channelAllowed = params.channelConfig?.allowed !== false;
9627
+ if (params.isGuildMessage && !isDiscordGroupAllowedByPolicy({
9628
+ groupPolicy: params.groupPolicy,
9629
+ guildAllowlisted: Boolean(params.guildInfo),
9630
+ channelAllowlistConfigured,
9631
+ channelAllowed
9632
+ })) {
9633
+ if (params.groupPolicy === "disabled") {
9634
+ logDebug(`[discord-preflight] drop: groupPolicy disabled`);
9635
+ logVerbose(`discord: drop guild message (groupPolicy: disabled, ${params.channelMatchMeta})`);
9636
+ } else if (!channelAllowlistConfigured) {
9637
+ logDebug(`[discord-preflight] drop: groupPolicy allowlist, no channel allowlist configured`);
9638
+ logVerbose(`discord: drop guild message (groupPolicy: allowlist, no channel allowlist, ${params.channelMatchMeta})`);
9639
+ } else {
9640
+ logDebug(`[discord] Ignored message from channel ${params.messageChannelId} (not in guild allowlist). Add to guilds.<guildId>.channels to enable.`);
9641
+ logVerbose(`Blocked discord channel ${params.messageChannelId} not in guild channel allowlist (groupPolicy: allowlist, ${params.channelMatchMeta})`);
9642
+ }
9643
+ return {
9644
+ allowed: false,
9645
+ channelAllowlistConfigured,
9646
+ channelAllowed
9647
+ };
9648
+ }
9649
+ if (params.isGuildMessage && params.channelConfig?.allowed === false) {
9650
+ logDebug(`[discord-preflight] drop: channelConfig.allowed===false`);
9651
+ logVerbose(`Blocked discord channel ${params.messageChannelId} not in guild channel allowlist (${params.channelMatchMeta})`);
9652
+ return {
9653
+ allowed: false,
9654
+ channelAllowlistConfigured,
9655
+ channelAllowed
9656
+ };
9657
+ }
9658
+ if (params.isGuildMessage) {
9659
+ logDebug(`[discord-preflight] pass: channel allowed`);
9660
+ logVerbose(`discord: allow channel ${params.messageChannelId} (${params.channelMatchMeta})`);
9661
+ }
9662
+ return {
9663
+ allowed: true,
9664
+ channelAllowlistConfigured,
9665
+ channelAllowed
9666
+ };
9667
+ }
9668
+ //#endregion
9669
+ //#region extensions/discord/src/monitor/listeners.guild-join.ts
9670
+ const DISCORD_GUILD_JOIN_INTRO_MAX_AGE_MS = 3e5;
9671
+ var DiscordGuildJoinIntroductionListener = class extends GuildCreateListener {
9672
+ constructor(params) {
9673
+ super();
9674
+ this.params = params;
9675
+ }
9676
+ async handle(data, client) {
9677
+ if (!("joined_at" in data) || data.unavailable || !this.params.botUserId) return;
9678
+ const joinAgeMs = Date.now() - Date.parse(data.joined_at);
9679
+ if (!Number.isFinite(joinAgeMs) || joinAgeMs < 0 || joinAgeMs > DISCORD_GUILD_JOIN_INTRO_MAX_AGE_MS) return;
9680
+ const textChannels = data.channels.filter((channel) => channel.type === ChannelType.GuildText);
9681
+ const systemChannel = textChannels.find((channel) => channel.id === data.system_channel_id);
9682
+ const candidateChannels = systemChannel ? [systemChannel, ...textChannels.filter((channel) => channel !== systemChannel)] : textChannels;
9683
+ const discordOptions = {
9684
+ cfg: this.params.cfg,
9685
+ accountId: this.params.accountId,
9686
+ rest: client.rest
9687
+ };
9688
+ const guildInfo = resolveDiscordGuildEntry({
9689
+ guild: new Guild(client, data),
9690
+ guildId: data.id,
9691
+ guildEntries: this.params.guildEntries
9692
+ });
9693
+ const guildConfigured = !this.params.guildEntries || Object.keys(this.params.guildEntries).length === 0 || Boolean(guildInfo);
9694
+ let targetChannel;
9695
+ let roomAllowed = false;
9696
+ for (const channel of candidateChannels) if (await canViewDiscordGuildChannel(data.id, channel.id, this.params.botUserId, discordOptions) && await hasAnyChannelPermissionDiscord(data.id, channel.id, this.params.botUserId, [PermissionFlagsBits.SendMessages], discordOptions)) {
9697
+ targetChannel ??= channel;
9698
+ const channelConfig = resolveDiscordChannelConfig({
9699
+ guildInfo,
9700
+ channelId: channel.id,
9701
+ channelName: channel.name,
9702
+ channelSlug: normalizeDiscordSlug(channel.name)
9703
+ });
9704
+ roomAllowed = guildConfigured && resolveDiscordPreflightChannelAccess({
9705
+ isGuildMessage: true,
9706
+ isGroupDm: false,
9707
+ groupPolicy: this.params.groupPolicy,
9708
+ messageChannelId: channel.id,
9709
+ displayChannelName: channel.name,
9710
+ displayChannelSlug: normalizeDiscordDisplaySlug(channel.name),
9711
+ guildInfo,
9712
+ channelConfig,
9713
+ channelMatchMeta: `guild=${data.id} channel=${channel.id}`
9714
+ }).allowed;
9715
+ if (roomAllowed) {
9716
+ targetChannel = channel;
9717
+ break;
9718
+ }
9719
+ }
9720
+ if (!targetChannel) {
9721
+ this.params.logger?.info("Discord guild join introduction skipped: no writable text channel", {
9722
+ guildId: data.id,
9723
+ accountId: this.params.accountId
9724
+ });
9725
+ return;
9726
+ }
9727
+ const selectedChannel = targetChannel;
9728
+ await reportChannelRoomJoin({
9729
+ cfg: this.params.cfg,
9730
+ channel: "discord",
9731
+ accountId: this.params.accountId,
9732
+ conversationId: data.id,
9733
+ deliverTo: `channel:${selectedChannel.id}`,
9734
+ route: resolveAgentRoute({
9735
+ cfg: this.params.cfg,
9736
+ channel: "discord",
9737
+ accountId: this.params.accountId,
9738
+ guildId: data.id,
9739
+ peer: {
9740
+ kind: "channel",
9741
+ id: selectedChannel.id
9742
+ }
9743
+ }),
9744
+ roomAllowed,
9745
+ resolveRoomContext: async ({ messageLimit }) => {
9746
+ const roomContext = {
9747
+ title: `#${selectedChannel.name}`,
9748
+ purpose: selectedChannel.topic ?? void 0
9749
+ };
9750
+ try {
9751
+ const messages = await readMessagesDiscord(selectedChannel.id, { limit: messageLimit }, discordOptions);
9752
+ return {
9753
+ ...roomContext,
9754
+ recentMessages: messages.toReversed().flatMap(({ author, content }) => content.trim() ? [{
9755
+ sender: author.global_name ?? author.username,
9756
+ text: content
9757
+ }] : [])
9758
+ };
9759
+ } catch {
9760
+ return roomContext;
9761
+ }
9762
+ }
9763
+ });
9764
+ }
9765
+ };
9766
+ //#endregion
9614
9767
  //#region extensions/discord/src/monitor/provider.startup.ts
9615
9768
  function registerLatePlugin(client, plugin) {
9616
9769
  plugin.registerClient?.(client);
@@ -9735,6 +9888,14 @@ async function fetchDiscordBotIdentity(params) {
9735
9888
  function registerDiscordMonitorListeners(params) {
9736
9889
  registerDiscordListener(params.client.listeners, new DiscordInteractionListener(params.logger, params.trackInboundEvent));
9737
9890
  registerDiscordListener(params.client.listeners, new DiscordMessageListener(params.messageHandler, params.logger, params.trackInboundEvent));
9891
+ registerDiscordListener(params.client.listeners, new DiscordGuildJoinIntroductionListener({
9892
+ cfg: params.cfg,
9893
+ accountId: params.accountId,
9894
+ botUserId: params.botUserId,
9895
+ groupPolicy: params.groupPolicy,
9896
+ guildEntries: params.guildEntries,
9897
+ logger: params.logger
9898
+ }));
9738
9899
  if (shouldRegisterDiscordReactionListeners(params)) {
9739
9900
  const reactionListenerOptions = {
9740
9901
  cfg: params.cfg,
@@ -9868,8 +10029,9 @@ async function monitorDiscordProvider(opts = {}) {
9868
10029
  });
9869
10030
  let guildEntries = rawDiscordCfg.guilds;
9870
10031
  const defaultGroupPolicy = resolveDefaultGroupPolicy(cfg);
10032
+ const providerConfigPresent = cfg.channels?.discord !== void 0;
9871
10033
  const { groupPolicy, providerMissingFallbackApplied } = resolveOpenProviderRuntimeGroupPolicy({
9872
- providerConfigPresent: cfg.channels?.discord !== void 0,
10034
+ providerConfigPresent,
9873
10035
  groupPolicy: rawDiscordCfg.groupPolicy,
9874
10036
  defaultGroupPolicy
9875
10037
  });
@@ -10016,6 +10178,7 @@ async function monitorDiscordProvider(opts = {}) {
10016
10178
  const probe = await probeDiscordAcpBindingHealth({
10017
10179
  cfg,
10018
10180
  sessionKey,
10181
+ agentId: session.agentId,
10019
10182
  storedState: session.acp?.state,
10020
10183
  lastActivityAt: session.acp?.lastActivityAt,
10021
10184
  providerSessionRuntime: discordProviderSessionRuntime
@@ -10129,7 +10292,7 @@ async function monitorDiscordProvider(opts = {}) {
10129
10292
  runtime,
10130
10293
  botUserId
10131
10294
  });
10132
- const { setDiscordTranscriptsVoiceManager } = await import("./transcripts-source-BR11iHA4.js").then((n) => n.n);
10295
+ const { setDiscordTranscriptsVoiceManager } = await import("./transcripts-source-Dc6Nnli5.js").then((n) => n.n);
10133
10296
  setDiscordTranscriptsVoiceManager({
10134
10297
  accountId: account.accountId,
10135
10298
  manager: voiceManager
@@ -10235,4 +10398,4 @@ async function monitorDiscordProvider(opts = {}) {
10235
10398
  }
10236
10399
  }
10237
10400
  //#endregion
10238
- export { mapGatewayDispatchData as _, sanitizeDiscordFrontChannelReplyPayloads as a, resolveDiscordDmCommandAccess as b, resolveReplyContext as c, waitForDiscordGatewayPluginRegistration as d, createDiscordNativeCommand as f, handleDiscordDmCommandDecision as g, createDiscordSupplementalContextAccessChecker as h, formatDiscordReplySkip as i, createDiscordGatewayPlugin as l, buildDiscordInboundAccessContext as m, deliverDiscordReply as n, buildDirectLabel as o, buildDiscordGroupSystemPrompt as p, formatDiscordReplyDeliveryFailure as r, buildGuildLabel as s, monitorDiscordProvider as t, resolveDiscordGatewayIntents as u, registerDiscordListener as v, resolveDiscordTextCommandAccess as x, resolveFetchedDiscordThreadLikeChannelContext as y };
10401
+ export { resolveDiscordTextCommandAccess as S, handleDiscordDmCommandDecision as _, formatDiscordReplySkip as a, resolveFetchedDiscordThreadLikeChannelContext as b, buildGuildLabel as c, resolveDiscordGatewayIntents as d, waitForDiscordGatewayPluginRegistration as f, createDiscordSupplementalContextAccessChecker as g, buildDiscordInboundAccessContext as h, formatDiscordReplyDeliveryFailure as i, resolveReplyContext as l, buildDiscordGroupSystemPrompt as m, resolveDiscordPreflightChannelAccess as n, sanitizeDiscordFrontChannelReplyPayloads as o, createDiscordNativeCommand as p, deliverDiscordReply as r, buildDirectLabel as s, monitorDiscordProvider as t, createDiscordGatewayPlugin as u, mapGatewayDispatchData as v, resolveDiscordDmCommandAccess as x, registerDiscordListener as y };