@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,31 +1,31 @@
1
- import { Dt as deleteChannelMessage, a as chunkDiscordTextWithMode, kt as editChannelMessage, v as resolveDiscordChannelId, wt as createChannelMessage, y as discord_exports } from "./retry-Cv4jCU5Z.js";
2
- import { p as resolveDiscordMaxLinesPerMessage } from "./accounts-CfQ-vSyf.js";
3
- import { C as resolveTimestampMs, a as normalizeDiscordSlug, r as normalizeDiscordAllowList } from "./allow-list-BDMimASD.js";
4
- import { F as createDiscordRuntimeAccountContext, P as createDiscordRestClient, d as resolveDiscordTargetChannelId, k as resolveDiscordMessageFlags } from "./send.shared-JjljcV4O.js";
5
- import { i as discordTextHasBroadcastMention } from "./send.outbound-zam0TrZx.js";
6
- import { a as removeReactionDiscord, f as editMessageDiscord, r as reactMessageDiscord } from "./send-C49MFF9j.js";
7
- import { n as DISCORD_ATTACHMENT_TOTAL_TIMEOUT_MS, t as DISCORD_ATTACHMENT_IDLE_TIMEOUT_MS } from "./timeouts-B9cy6RvQ.js";
8
- import "./targets-CtTKvntJ.js";
9
- import { a as buildDiscordRoutePeer, h as discordInboundEventDelivery, u as resolveDiscordConversationIdentity } from "./outbound-session-route-Cg15ZFJd.js";
10
- import { t as DISCORD_TEXT_CHUNK_LIMIT } from "./outbound-adapter-BE4jSq2d.js";
11
- import { a as sanitizeDiscordFrontChannelReplyPayloads, c as resolveReplyContext, h as createDiscordSupplementalContextAccessChecker, i as formatDiscordReplySkip, m as buildDiscordInboundAccessContext, n as deliverDiscordReply, o as buildDirectLabel, r as formatDiscordReplyDeliveryFailure, s as buildGuildLabel } from "./provider-B11xwilq.js";
12
- import { a as formatDiscordMediaText, c as resolveReferencedReplyMediaList, i as resolveDiscordMessageText, u as resolveDiscordMessageStickers } from "./message-text-aiwO5R2F.js";
13
- import { a as resolveDiscordThreadStarter, n as resolveDiscordAutoThreadReplyPlan } from "./threading-agH1T_6s.js";
14
- import { n as resolveDiscordWebhookId } from "./sender-identity-BJtfyise.js";
1
+ import { At as editChannelMessage, Ot as deleteChannelMessage, Tt as createChannelMessage, b as discord_exports, o as chunkDiscordTextWithMode, y as resolveDiscordChannelId } from "./retry-DQt1zDgH.js";
2
+ import { p as resolveDiscordMaxLinesPerMessage } from "./accounts-CwJQoLjM.js";
3
+ import { S as resolveTimestampMs, a as normalizeDiscordSlug, r as normalizeDiscordAllowList } from "./allow-list-DBTtR2dz.js";
4
+ import { F as createDiscordRuntimeAccountContext, P as createDiscordRestClient, d as resolveDiscordTargetChannelId, k as resolveDiscordMessageFlags } from "./send.shared-B0n_fWzu.js";
5
+ import { i as discordTextHasBroadcastMention } from "./send.outbound-DHuFUL6W.js";
6
+ import { a as removeReactionDiscord, f as editMessageDiscord, r as reactMessageDiscord } from "./send-CZeWKUiA.js";
7
+ import { n as DISCORD_ATTACHMENT_TOTAL_TIMEOUT_MS, t as DISCORD_ATTACHMENT_IDLE_TIMEOUT_MS } from "./timeouts-D86uWLt_.js";
8
+ import "./targets-BObRyaKX.js";
9
+ import { a as buildDiscordRoutePeer, h as discordInboundEventDelivery, u as resolveDiscordConversationIdentity } from "./outbound-session-route-Q_HEusBQ.js";
10
+ import { t as DISCORD_TEXT_CHUNK_LIMIT } from "./outbound-adapter-CtggmGh9.js";
11
+ import { a as formatDiscordReplySkip, c as buildGuildLabel, g as createDiscordSupplementalContextAccessChecker, h as buildDiscordInboundAccessContext, i as formatDiscordReplyDeliveryFailure, l as resolveReplyContext, o as sanitizeDiscordFrontChannelReplyPayloads, r as deliverDiscordReply, s as buildDirectLabel } from "./provider-uKmmrDM4.js";
12
+ import { a as formatDiscordMediaText, c as resolveReferencedReplyMediaList, i as resolveDiscordMessageText, u as resolveDiscordMessageStickers } from "./message-text-DK4NnBg-.js";
13
+ import { a as resolveDiscordThreadStarter, n as resolveDiscordAutoThreadReplyPlan } from "./threading-BCx49X-6.js";
14
+ import { n as resolveDiscordWebhookId } from "./sender-identity-B8Ncfi63.js";
15
15
  import { t as beginDiscordActiveTurnThreadRoute } from "./active-turn-thread-route-fmHl1HNd.js";
16
16
  import { n as filterDiscordHistoryEntriesForContext, t as createDiscordHistorySenderProvenance } from "./message-handler.history-CJOsN9w5.js";
17
- import { t as sendTyping } from "./typing-Dc_YMY2e.js";
17
+ import { t as sendTyping } from "./typing-CuopV-Hi.js";
18
18
  import { expectDefined } from "openclaw/plugin-sdk/expect-runtime";
19
19
  import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
20
20
  import { buildAgentSessionKey, resolveThreadSessionKeys } from "openclaw/plugin-sdk/routing";
21
+ import { getReplyPayloadTtsSupplement, isReplyPayloadNonTerminalToolErrorWarning, resolveSendableOutboundReplyParts } from "openclaw/plugin-sdk/reply-payload";
21
22
  import { danger, logVerbose, shouldLogVerbose, sleepWithAbort } from "openclaw/plugin-sdk/runtime-env";
22
23
  import { truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
23
24
  import { resolveMarkdownTableMode } from "openclaw/plugin-sdk/markdown-table-runtime";
24
25
  import { resolveChunkMode } from "openclaw/plugin-sdk/reply-chunking";
25
26
  import { convertMarkdownTables, stripInlineDirectiveTagsForDelivery, stripReasoningTagsFromText } from "openclaw/plugin-sdk/text-chunking";
26
- import { bindIngressLifecycleToReplyOptions, buildChannelProgressDraftLine, buildChannelProgressDraftLineForEntry, createChannelMessageReplyPipeline, createChannelProgressDraftCompositor, createFinalizableDraftStreamControlsForState, createTypingCallbacks, defineFinalizableLivePreviewAdapter, deliverWithFinalizableLivePreviewAdapter, resolveChannelDraftStreamingChunking, resolveChannelMessageSourceReplyDeliveryMode, resolveChannelPreviewStreamMode, resolveChannelStreamingBlockEnabled, resolveChannelStreamingPreviewCommandText, resolveChannelStreamingPreviewToolProgress, resolveChannelStreamingProgressNarration, resolveChannelStreamingSuppressDefaultToolProgressMessages, resolveTranscriptBackedChannelFinalText } from "openclaw/plugin-sdk/channel-outbound";
27
+ import { bindIngressLifecycleToReplyOptions, createChannelMessageReplyPipeline, createChannelProgressDraftCompositor, createFinalizableDraftStreamControlsForState, createTypingCallbacks, defineFinalizableLivePreviewAdapter, deliverWithFinalizableLivePreviewAdapter, resolveChannelDraftStreamingChunking, resolveChannelMessageSourceReplyDeliveryMode, resolveChannelPreviewStreamMode, resolveChannelStreamingBlockEnabled, resolveChannelStreamingPreviewCommandText, resolveChannelStreamingProgressNarration, resolveTranscriptBackedChannelFinalText } from "openclaw/plugin-sdk/channel-outbound";
27
28
  import { getAgentScopedMediaLocalRoots } from "openclaw/plugin-sdk/media-runtime";
28
- import { getReplyPayloadTtsSupplement, isReplyPayloadNonTerminalToolErrorWarning, resolveSendableOutboundReplyParts } from "openclaw/plugin-sdk/reply-payload";
29
29
  import { evaluateSupplementalContextVisibility } from "openclaw/plugin-sdk/security-runtime";
30
30
  import { resolvePinnedMainDmOwnerFromAllowlist } from "openclaw/plugin-sdk/conversation-runtime";
31
31
  import { resolveAgentConfig } from "openclaw/plugin-sdk/agent-scope-runtime";
@@ -37,23 +37,20 @@ import { getGlobalHookRunner } from "openclaw/plugin-sdk/plugin-runtime";
37
37
  import { buildHistoryContextFromEntries, buildInboundHistoryFromEntries, createChannelHistoryWindow } from "openclaw/plugin-sdk/reply-history";
38
38
  import { resolveChannelContextVisibilityMode } from "openclaw/plugin-sdk/context-visibility-runtime";
39
39
  import { formatAudioTranscriptForAgent } from "openclaw/plugin-sdk/media-understanding-runtime";
40
- import { DEFAULT_TIMING, createStatusReactionController, logAckFailure, logTypingFailure, shouldAckReaction } from "openclaw/plugin-sdk/channel-feedback";
40
+ import { createStatusReactionController, logAckFailure, logTypingFailure, shouldAckReaction } from "openclaw/plugin-sdk/channel-feedback";
41
41
  import { readLatestAssistantTextByIdentity } from "openclaw/plugin-sdk/session-transcript-runtime";
42
42
  //#region extensions/discord/src/monitor/message-handler.retry.ts
43
43
  const REPLY_SESSION_INIT_CONFLICT_MESSAGE_RE = /^reply session initialization conflicted for \S+$/u;
44
44
  const DISCORD_SESSION_CONFLICT_FAILURE_TEXT = "⚠️ Couldn't process this message because the session stayed busy. Please try again in a moment.";
45
- function isReplySessionInitConflictError(error) {
45
+ async function completeDiscordSessionConflict(error, sourceReplyDeliveryMode, deliver, onDeliveryError) {
46
46
  const message = error instanceof Error ? error.message : String(error);
47
- return REPLY_SESSION_INIT_CONFLICT_MESSAGE_RE.test(message);
48
- }
49
- async function completeDiscordSessionConflict(error, deliver, onDeliveryError) {
50
- if (!isReplySessionInitConflictError(error)) return false;
47
+ if (!REPLY_SESSION_INIT_CONFLICT_MESSAGE_RE.test(message)) return;
48
+ if (sourceReplyDeliveryMode === "message_tool_only") return "suppressed";
51
49
  try {
52
- await deliver({
50
+ return (await deliver({
53
51
  text: DISCORD_SESSION_CONFLICT_FAILURE_TEXT,
54
52
  isError: true
55
- }, { kind: "final" });
56
- return true;
53
+ }, { kind: "final" })).visibleReplySent ? "delivered" : "suppressed";
57
54
  } catch (deliveryError) {
58
55
  onDeliveryError(deliveryError, { kind: "final" });
59
56
  throw new Error(`discord: reply session init conflict exhausted and terminal notice failed: ${String(deliveryError)}`, { cause: deliveryError });
@@ -74,9 +71,6 @@ function normalizeDiscordDmOwnerEntry(entry) {
74
71
  ])?.ids.values().next().value;
75
72
  return typeof candidate === "string" && /^\d+$/.test(candidate) ? candidate : void 0;
76
73
  }
77
- function isContextAborted(abortSignal) {
78
- return Boolean(abortSignal?.aborted);
79
- }
80
74
  async function buildDiscordMessageProcessContext(params) {
81
75
  const { ctx, text, mediaList } = params;
82
76
  const { cfg, discordConfig, accountId, runtime, botUserId, mediaMaxBytes, discordRestFetch, abortSignal, guildHistories, historyLimit, replyToMode, message, author, sender, canonicalMessageId, data, client, channelInfo, channelName, messageChannelId, isGuildMessage, isDirectMessage, isGroupDm, baseText, preflightAudioTranscript, threadChannel, threadParentId, threadParentName, threadParentType, threadName, displayChannelSlug, guildInfo, guildSlug, memberRoleIds, channelConfig, baseSessionKey, boundSessionKey, route, commandAuthorized, hasControlCommand, resolveChannelIngress } = ctx;
@@ -116,10 +110,11 @@ async function buildDiscordMessageProcessContext(params) {
116
110
  channel: "discord",
117
111
  accountId
118
112
  });
113
+ const allowNameMatching = isDangerousNameMatchingEnabled(discordConfig);
119
114
  const isSupplementalContextSenderAllowed = createDiscordSupplementalContextAccessChecker({
120
115
  channelConfig,
121
116
  guildInfo,
122
- allowNameMatching: isDangerousNameMatchingEnabled(discordConfig),
117
+ allowNameMatching,
123
118
  isGuild: isGuildMessage
124
119
  });
125
120
  const storePath = resolveStorePath(cfg.session?.store, { agentId: route.agentId });
@@ -202,17 +197,19 @@ async function buildDiscordMessageProcessContext(params) {
202
197
  parentType: threadParentType,
203
198
  resolveTimestampMs
204
199
  });
205
- if (starter?.text) if (evaluateSupplementalContextVisibility({
206
- mode: contextVisibilityMode,
207
- kind: "thread",
208
- senderAllowed: isSupplementalContextSenderAllowed({
209
- id: starter.authorId,
210
- name: starter.authorName ?? starter.author,
211
- tag: starter.authorTag,
212
- memberRoleIds: starter.memberRoleIds
213
- })
214
- }).include) threadStarterBody = starter.text;
215
- else logVerbose(`discord: drop thread starter context (mode=${contextVisibilityMode})`);
200
+ if (starter?.text) {
201
+ if (evaluateSupplementalContextVisibility({
202
+ mode: contextVisibilityMode,
203
+ kind: "thread",
204
+ senderAllowed: isSupplementalContextSenderAllowed({
205
+ id: starter.authorId,
206
+ name: starter.authorName ?? starter.author,
207
+ tag: starter.authorTag,
208
+ memberRoleIds: starter.memberRoleIds
209
+ })
210
+ }).include) threadStarterBody = starter.text;
211
+ else logVerbose(`discord: drop thread starter context (mode=${contextVisibilityMode})`);
212
+ }
216
213
  }
217
214
  const parentName = threadParentName ?? "parent";
218
215
  threadLabel = threadName ? `Discord thread #${normalizeDiscordSlug(parentName)} › ${threadName}` : `Discord thread #${normalizeDiscordSlug(parentName)}`;
@@ -380,7 +377,7 @@ async function buildDiscordMessageProcessContext(params) {
380
377
  totalTimeoutMs: DISCORD_ATTACHMENT_TOTAL_TIMEOUT_MS,
381
378
  abortSignal
382
379
  });
383
- return isContextAborted(abortSignal) ? [] : await toInboundMediaFactsWithMetadata(referencedReplyMediaList, { messageId: replyContext.id });
380
+ return abortSignal?.aborted ? [] : await toInboundMediaFactsWithMetadata(referencedReplyMediaList, { messageId: replyContext.id });
384
381
  }
385
382
  } : void 0,
386
383
  thread: {
@@ -458,9 +455,6 @@ async function buildDiscordMessageProcessContext(params) {
458
455
  }
459
456
  //#endregion
460
457
  //#region extensions/discord/src/monitor/message-handler.process-progress.ts
461
- function isProcessAborted$1(abortSignal) {
462
- return Boolean(abortSignal?.aborted);
463
- }
464
458
  function isFailedProgress(payload) {
465
459
  return payload.phase === "error" || payload.status === "failed" || payload.status === "error" || typeof payload.exitCode === "number" && payload.exitCode !== 0;
466
460
  }
@@ -513,7 +507,7 @@ function createDiscordMessageProgressRuntime(params) {
513
507
  shouldYieldDraftCommentary = isActive;
514
508
  },
515
509
  onNarrationUpdate: draftPreview.narrationProgressEnabled ? async (payload) => {
516
- if (isProcessAborted$1(abortSignal) || shouldYieldDraftCommentary()) return;
510
+ if (abortSignal?.aborted || shouldYieldDraftCommentary()) return;
517
511
  await draftPreview.pushNarrationProgress(payload.text);
518
512
  } : void 0,
519
513
  onProgressNarratorLifecycle: draftPreview.narrationProgressEnabled ? (lifecycle) => draftPreview.setProgressNarratorLifecycle(lifecycle) : void 0,
@@ -526,7 +520,7 @@ function createDiscordMessageProgressRuntime(params) {
526
520
  },
527
521
  streamReasoningInNonStreamModes: reasoningWindowEnabled,
528
522
  onToolStart: async (payload) => {
529
- if (isProcessAborted$1(abortSignal)) return false;
523
+ if (abortSignal?.aborted) return false;
530
524
  await params.reactions.maybeBindToToolReaction(payload);
531
525
  await params.reactions.controller.setTool(payload.name);
532
526
  return await draftPreview.pushToolEvent(payload);
@@ -554,11 +548,11 @@ function createDiscordMessageProgressRuntime(params) {
554
548
  return await draftPreview.pushPatchEvent(payload);
555
549
  },
556
550
  onCompactionStart: async () => {
557
- if (!isProcessAborted$1(abortSignal)) await params.reactions.controller.setCompacting();
551
+ if (!abortSignal?.aborted) await params.reactions.controller.setCompacting();
558
552
  return false;
559
553
  },
560
554
  onCompactionEnd: async () => {
561
- if (!isProcessAborted$1(abortSignal)) {
555
+ if (!abortSignal?.aborted) {
562
556
  params.reactions.controller.cancelPending();
563
557
  await params.reactions.controller.setThinking();
564
558
  }
@@ -650,15 +644,13 @@ function createDiscordMessageReactionRuntime(params) {
650
644
  messageId: message.id,
651
645
  reactionContext: ackReactionContext
652
646
  });
653
- const statusReactionTiming = DEFAULT_TIMING;
654
647
  let statusReactionTarget = `${messageChannelId}/${message.id}`;
655
648
  let statusReactionsActive = statusReactionsEnabled;
656
649
  let statusReactions = createStatusReactionController({
657
650
  enabled: statusReactionsEnabled,
658
651
  adapter: discordAdapter,
659
652
  initialEmoji: ackReaction,
660
- emojis: void 0,
661
- timing: statusReactionTiming,
653
+ presentation: "acknowledgement",
662
654
  onError: (err) => {
663
655
  logAckFailure({
664
656
  log: logVerbose,
@@ -711,8 +703,7 @@ function createDiscordMessageReactionRuntime(params) {
711
703
  reactionContext: ackReactionContext
712
704
  }),
713
705
  initialEmoji: emoji,
714
- emojis: void 0,
715
- timing: statusReactionTiming,
706
+ presentation: "acknowledgement",
716
707
  onError: (err) => {
717
708
  logAckFailure({
718
709
  log: logVerbose,
@@ -859,6 +850,7 @@ function createDiscordDraftStream(params) {
859
850
  };
860
851
  const { loop, update, stop, discardPending, seal } = createFinalizableDraftStreamControlsForState({
861
852
  throttleMs,
853
+ coalesceInFlight: true,
862
854
  state: streamState,
863
855
  sendOrEditStreamMessage
864
856
  });
@@ -990,13 +982,8 @@ function createDiscordDraftPreviewController(params) {
990
982
  let progressDraftStartedBeforeFinal = false;
991
983
  let progressDraftCollapsed = false;
992
984
  let progressNarratorLifecycle;
993
- const previewToolProgressEnabled = Boolean(draftStream) && resolveChannelStreamingPreviewToolProgress(params.discordConfig, true, discordStreamMode);
994
985
  const narrationProgressEnabled = Boolean(draftStream) && discordStreamMode === "progress" && resolveChannelStreamingProgressNarration(params.discordConfig);
995
986
  const narrationHideCommandText = narrationProgressEnabled && resolveChannelStreamingPreviewCommandText(params.discordConfig) === "status";
996
- const suppressDefaultToolProgressMessages = Boolean(draftStream) && resolveChannelStreamingSuppressDefaultToolProgressMessages(params.discordConfig, {
997
- draftStreamActive: true,
998
- previewToolProgressEnabled
999
- });
1000
987
  const progressSeed = `${params.accountId}:${params.deliverChannelId}`;
1001
988
  const progressDraft = createChannelProgressDraftCompositor({
1002
989
  entry: params.discordConfig,
@@ -1005,9 +992,7 @@ function createDiscordDraftPreviewController(params) {
1005
992
  seed: progressSeed,
1006
993
  reasoningLinePrefix: "🧠 ",
1007
994
  commentaryLinePrefix: "💬 ",
1008
- reasoningGate: previewToolProgressEnabled,
1009
995
  commentaryItalics: false,
1010
- buildProgressEventLine: (input, options) => input.event === "tool" || input.event === "item" || input.event === "command-output" ? buildChannelProgressDraftLineForEntry(params.discordConfig, input, options) : buildChannelProgressDraftLine(input, options),
1011
996
  update: async (previewText, options) => {
1012
997
  if (!draftStream) return false;
1013
998
  lastPartialText = previewText;
@@ -1040,10 +1025,6 @@ function createDiscordDraftPreviewController(params) {
1040
1025
  }
1041
1026
  resetProgressState();
1042
1027
  };
1043
- const pushPreambleHeadline = async (text, options) => {
1044
- if (discordStreamMode === "progress") return await progressDraft.pushPreambleHeadline(text, options);
1045
- return false;
1046
- };
1047
1028
  const beginNewProgressTurn = (options) => {
1048
1029
  const beganNewTurn = progressDraft.beginNewTurn(options);
1049
1030
  if (beganNewTurn) {
@@ -1060,11 +1041,10 @@ function createDiscordDraftPreviewController(params) {
1060
1041
  };
1061
1042
  return {
1062
1043
  draftStream,
1063
- previewToolProgressEnabled,
1064
1044
  narrationProgressEnabled,
1065
1045
  narrationHideCommandText,
1066
1046
  commentaryProgressEnabled: progressDraft.commentaryProgressEnabled,
1067
- suppressDefaultToolProgressMessages,
1047
+ suppressDefaultToolProgressMessages: progressDraft.suppressDefaultToolProgressMessages,
1068
1048
  get isProgressMode() {
1069
1049
  return discordStreamMode === "progress";
1070
1050
  },
@@ -1115,31 +1095,18 @@ function createDiscordDraftPreviewController(params) {
1115
1095
  disableBlockStreamingForDraft: draftStream ? true : void 0,
1116
1096
  pushToolEvent: progressDraft.pushToolEvent,
1117
1097
  pushItemEvent: progressDraft.pushItemEvent,
1118
- pushApprovalEvent: progressDraft.pushApprovalEvent,
1098
+ pushApprovalEvent: progressDraft.pushApprovalEvent.bind(progressDraft),
1119
1099
  pushCommandOutputEvent: progressDraft.pushCommandOutputEvent,
1120
1100
  pushPatchEvent: progressDraft.pushPatchEvent,
1121
- async pushToolProgress(line, options) {
1122
- return await progressDraft.pushToolProgress(line, options);
1123
- },
1124
- async pushPlanProgress(steps, options) {
1125
- return await progressDraft.pushPlanProgress(steps, options);
1126
- },
1127
- async pushReasoningProgress(text, options) {
1128
- return await progressDraft.pushReasoningProgress(text, options);
1129
- },
1130
- async pushNarrationProgress(text) {
1131
- return await progressDraft.pushNarrationProgress(text);
1132
- },
1133
- pushPreambleHeadline,
1101
+ pushPlanProgress: progressDraft.pushPlanProgress.bind(progressDraft),
1102
+ pushReasoningProgress: progressDraft.pushReasoningProgress.bind(progressDraft),
1103
+ pushNarrationProgress: progressDraft.pushNarrationProgress.bind(progressDraft),
1134
1104
  async pushPreambleItemEvent(payload) {
1135
- const headlineAccepted = await pushPreambleHeadline(payload.progressText, { itemId: payload.itemId });
1105
+ const headlineAccepted = await progressDraft.pushPreambleHeadline(payload.progressText, { itemId: payload.itemId });
1136
1106
  if (!progressDraft.commentaryProgressEnabled) return headlineAccepted;
1137
1107
  const commentaryAccepted = await progressDraft.pushCommentaryProgress(payload.progressText, { itemId: payload.itemId });
1138
1108
  return headlineAccepted || commentaryAccepted;
1139
1109
  },
1140
- async pushCommentaryProgress(text, options) {
1141
- return await progressDraft.pushCommentaryProgress(text, options);
1142
- },
1143
1110
  resolvePreviewFinalText(text) {
1144
1111
  if (typeof text !== "string") return;
1145
1112
  const formatted = convertMarkdownTables(stripInlineDirectiveTagsForDelivery(text).text, params.tableMode);
@@ -1236,7 +1203,7 @@ function shouldStartDiscordProgressDraftNow(line) {
1236
1203
  }
1237
1204
  //#endregion
1238
1205
  //#region extensions/discord/src/monitor/reply-typing-feedback.ts
1239
- const DISCORD_REPLY_TYPING_MAX_DURATION_MS = 20 * 6e4;
1206
+ const DISCORD_REPLY_TYPING_MAX_DURATION_MS = 12e5;
1240
1207
  function createDiscordReplyTypingFeedback(params) {
1241
1208
  const rest = params.rest ?? createDiscordRestClient({
1242
1209
  cfg: params.cfg,
@@ -1426,9 +1393,6 @@ function createDiscordMessageActiveThreadRoute(params) {
1426
1393
  //#endregion
1427
1394
  //#region extensions/discord/src/monitor/message-handler.process.ts
1428
1395
  const TARGETED_ONLY_ALLOWED_MENTIONS = { parse: ["users", "roles"] };
1429
- function isProcessAborted(abortSignal) {
1430
- return Boolean(abortSignal?.aborted);
1431
- }
1432
1396
  function isFallbackOnlyToolWarningFinal(payload) {
1433
1397
  if (payload.isError !== true || !isReplyPayloadNonTerminalToolErrorWarning(payload)) return false;
1434
1398
  return !resolveSendableOutboundReplyParts(payload).hasMedia;
@@ -1439,7 +1403,7 @@ async function processDiscordMessage(ctx, observer) {
1439
1403
  async function processDiscordMessageInner(ctx, observer) {
1440
1404
  const dispatchStartedAt = Date.now();
1441
1405
  const { cfg, accountId, token, runtime, textLimit, replyToMode, message, messageChannelId, isGuildMessage, isDirectMessage, isGroupDm, messageText, threadBindings, route, abortSignal, turnAdoptionLifecycle, preparedMedia: mediaList } = ctx;
1442
- if (isProcessAborted(abortSignal)) return;
1406
+ if (abortSignal?.aborted) return;
1443
1407
  const text = messageText;
1444
1408
  if (!text && mediaList.length === 0) {
1445
1409
  logVerbose("discord: drop message " + message.id + " (empty content)");
@@ -1542,7 +1506,7 @@ async function processDiscordMessageInner(ctx, observer) {
1542
1506
  });
1543
1507
  let replyLifecycleStarted = false;
1544
1508
  const onDiscordReplyStart = async () => {
1545
- if (isProcessAborted(abortSignal)) return;
1509
+ if (abortSignal?.aborted) return;
1546
1510
  replyLifecycleStarted = true;
1547
1511
  await replyPipeline.typingCallbacks?.onReplyStart();
1548
1512
  await reactions.controller.setThinking();
@@ -1555,7 +1519,7 @@ async function processDiscordMessageInner(ctx, observer) {
1555
1519
  isFallbackOnlyToolWarningFinal
1556
1520
  });
1557
1521
  const deliverDiscordPayload = async (payload, info, options) => {
1558
- if (isProcessAborted(abortSignal)) {
1522
+ if (abortSignal?.aborted) {
1559
1523
  logVerbose(formatDiscordReplySkip({
1560
1524
  kind: info.kind,
1561
1525
  reason: "aborted before delivery",
@@ -1569,8 +1533,9 @@ async function processDiscordMessageInner(ctx, observer) {
1569
1533
  const raw = (payload.text ?? "").trim();
1570
1534
  const body = raw.startsWith("Reasoning:\n") ? raw.slice(11).trim() : raw;
1571
1535
  if (!body) return { visibleReplySent: false };
1536
+ const chunkLimit = Math.max(256, Math.min(textLimit, 2e3) - 8);
1572
1537
  const chunks = chunkDiscordTextWithMode(body, {
1573
- maxChars: Math.max(256, Math.min(textLimit, 2e3) - 8),
1538
+ maxChars: chunkLimit,
1574
1539
  maxLines: maxLinesPerMessage,
1575
1540
  chunkMode
1576
1541
  });
@@ -1598,7 +1563,8 @@ async function processDiscordMessageInner(ctx, observer) {
1598
1563
  mediaLocalRoots,
1599
1564
  kind: "block",
1600
1565
  bindPendingFinalDelivery: info.bindPendingFinalDelivery,
1601
- onPlatformSendDispatch: info.onPlatformSendDispatch
1566
+ onPlatformSendDispatch: info.onPlatformSendDispatch,
1567
+ assertPlatformSendAuthorized: info.assertPlatformSendAuthorized
1602
1568
  });
1603
1569
  if (result.visibleReplySent) replyReference.markSent();
1604
1570
  return result;
@@ -1615,10 +1581,11 @@ async function processDiscordMessageInner(ctx, observer) {
1615
1581
  finalText: payload.text,
1616
1582
  resolveCandidateText: resolveCurrentTurnTranscriptFinalText
1617
1583
  }) : payload.text;
1618
- const [deliverablePayload] = sanitizeDiscordFrontChannelReplyPayloads([finalText !== payload.text ? {
1584
+ const effectivePayload = finalText !== payload.text ? {
1619
1585
  ...payload,
1620
1586
  text: finalText
1621
- } : payload], { kind: info.kind });
1587
+ } : payload;
1588
+ const [deliverablePayload] = sanitizeDiscordFrontChannelReplyPayloads([effectivePayload], { kind: info.kind });
1622
1589
  if (!deliverablePayload) {
1623
1590
  logVerbose(formatDiscordReplySkip({
1624
1591
  kind: info.kind,
@@ -1652,7 +1619,7 @@ async function processDiscordMessageInner(ctx, observer) {
1652
1619
  },
1653
1620
  buildFinalEdit: () => {},
1654
1621
  editFinal: async (previewMessageId, edit) => {
1655
- if (isProcessAborted(abortSignal)) throw new Error("process aborted");
1622
+ if (abortSignal?.aborted) throw new Error("process aborted");
1656
1623
  notifyFinalReplyStart();
1657
1624
  await editMessageDiscord(deliverChannelId, previewMessageId, edit, {
1658
1625
  cfg,
@@ -1670,7 +1637,7 @@ async function processDiscordMessageInner(ctx, observer) {
1670
1637
  }
1671
1638
  }),
1672
1639
  deliverNormally: async () => {
1673
- if (isProcessAborted(abortSignal)) return false;
1640
+ if (abortSignal?.aborted) return false;
1674
1641
  const fallbackPayload = ttsSupplement && ttsSupplement.visibleTextAlreadyDelivered !== true && !deliverablePayload.text?.trim() ? {
1675
1642
  ...deliverablePayload,
1676
1643
  text: ttsSupplement.spokenText
@@ -1698,7 +1665,8 @@ async function processDiscordMessageInner(ctx, observer) {
1698
1665
  allowedMentions,
1699
1666
  kind: info.kind,
1700
1667
  bindPendingFinalDelivery: info.bindPendingFinalDelivery,
1701
- onPlatformSendDispatch: info.onPlatformSendDispatch
1668
+ onPlatformSendDispatch: info.onPlatformSendDispatch,
1669
+ assertPlatformSendAuthorized: info.assertPlatformSendAuthorized
1702
1670
  })).visibleReplySent;
1703
1671
  },
1704
1672
  onNormalDelivered: () => {
@@ -1707,7 +1675,7 @@ async function processDiscordMessageInner(ctx, observer) {
1707
1675
  }
1708
1676
  })).kind !== "normal-skipped") return { visibleReplySent: true };
1709
1677
  }
1710
- if (isProcessAborted(abortSignal)) {
1678
+ if (abortSignal?.aborted) {
1711
1679
  logVerbose(formatDiscordReplySkip({
1712
1680
  kind: info.kind,
1713
1681
  reason: "aborted before delivery",
@@ -1737,7 +1705,8 @@ async function processDiscordMessageInner(ctx, observer) {
1737
1705
  mediaLocalRoots,
1738
1706
  kind: info.kind,
1739
1707
  bindPendingFinalDelivery: info.bindPendingFinalDelivery,
1740
- onPlatformSendDispatch: info.onPlatformSendDispatch
1708
+ onPlatformSendDispatch: info.onPlatformSendDispatch,
1709
+ assertPlatformSendAuthorized: info.assertPlatformSendAuthorized
1741
1710
  });
1742
1711
  if (!result.visibleReplySent) return result;
1743
1712
  replyReference.markSent();
@@ -1765,7 +1734,7 @@ async function processDiscordMessageInner(ctx, observer) {
1765
1734
  let dispatchError = false;
1766
1735
  let dispatchAborted = false;
1767
1736
  const deliverPendingToolWarningFinalIfNeeded = async () => {
1768
- if (!pendingToolWarningFinal || userFacingFinalDelivered || isProcessAborted(abortSignal)) return;
1737
+ if (!pendingToolWarningFinal || userFacingFinalDelivered || abortSignal?.aborted) return;
1769
1738
  const pending = pendingToolWarningFinal;
1770
1739
  pendingToolWarningFinal = void 0;
1771
1740
  try {
@@ -1777,7 +1746,7 @@ async function processDiscordMessageInner(ctx, observer) {
1777
1746
  }
1778
1747
  };
1779
1748
  try {
1780
- if (isProcessAborted(abortSignal)) {
1749
+ if (abortSignal?.aborted) {
1781
1750
  dispatchAborted = true;
1782
1751
  return;
1783
1752
  }
@@ -1836,7 +1805,7 @@ async function processDiscordMessageInner(ctx, observer) {
1836
1805
  });
1837
1806
  if (!preparedResult.dispatched) return;
1838
1807
  dispatchResult = preparedResult.dispatchResult;
1839
- if (isProcessAborted(abortSignal)) {
1808
+ if (abortSignal?.aborted) {
1840
1809
  dispatchAborted = true;
1841
1810
  return;
1842
1811
  }
@@ -1850,15 +1819,20 @@ async function processDiscordMessageInner(ctx, observer) {
1850
1819
  markFinalReplyDelivered();
1851
1820
  }
1852
1821
  } catch (err) {
1853
- if (isProcessAborted(abortSignal)) {
1822
+ if (abortSignal?.aborted) {
1854
1823
  dispatchAborted = true;
1855
1824
  return;
1856
1825
  }
1857
1826
  dispatchError = true;
1858
- if (await completeDiscordSessionConflict(err, (payload, info) => deliverDiscordPayload(payload, {
1827
+ const conflictOutcome = await completeDiscordSessionConflict(err, sourceReplyDeliveryMode, (payload, info) => deliverDiscordPayload(payload, {
1859
1828
  ...info,
1860
- onPlatformSendDispatch: () => Promise.resolve()
1861
- }), onDiscordDeliveryError)) return;
1829
+ onPlatformSendDispatch: () => Promise.resolve(),
1830
+ assertPlatformSendAuthorized: () => void 0
1831
+ }), onDiscordDeliveryError);
1832
+ if (conflictOutcome) {
1833
+ runtime.error(`discord: reply session init conflict exhausted; terminal notice ${conflictOutcome} (sourceReplyDeliveryMode=${sourceReplyDeliveryMode}, message=${message.id}, session=${persistedSessionKey})`);
1834
+ return;
1835
+ }
1862
1836
  throw err;
1863
1837
  } finally {
1864
1838
  activeThreadRoute.end();
@@ -1,4 +1,4 @@
1
- import { c as resolveDiscordChannelInfoSafe } from "./thread-bindings.manager-ByOtwjo_.js";
1
+ import { c as resolveDiscordChannelInfoSafe } from "./thread-bindings.manager-pbbRT5gb.js";
2
2
  import { ComponentType, StickerFormatType } from "discord-api-types/v10";
3
3
  import { asDateTimestampMs, resolveExpiresAtMsFromDurationMs } from "openclaw/plugin-sdk/number-runtime";
4
4
  import { normalizeLowercaseStringOrEmpty, normalizeOptionalString, normalizeOptionalStringifiedId, uniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
@@ -11,8 +11,8 @@ import { formatMediaPlaceholderText } from "openclaw/plugin-sdk/channel-inbound"
11
11
  const discordChannelInfoCacheState = { entries: /* @__PURE__ */ new Map() };
12
12
  //#endregion
13
13
  //#region extensions/discord/src/monitor/message-channel-info.ts
14
- const DISCORD_CHANNEL_INFO_CACHE_TTL_MS = 300 * 1e3;
15
- const DISCORD_CHANNEL_INFO_NEGATIVE_CACHE_TTL_MS = 30 * 1e3;
14
+ const DISCORD_CHANNEL_INFO_CACHE_TTL_MS = 3e5;
15
+ const DISCORD_CHANNEL_INFO_NEGATIVE_CACHE_TTL_MS = 3e4;
16
16
  const DISCORD_CHANNEL_INFO_CACHE_MAX_ENTRIES = 1e3;
17
17
  function resolveDiscordChannelInfoCacheExpiresAt(ttlMs, nowMs) {
18
18
  return resolveExpiresAtMsFromDurationMs(ttlMs, { nowMs });
@@ -131,6 +131,11 @@ function resolveDiscordReferencedReplyMessage(message) {
131
131
  const referenceType = message.messageReference?.type;
132
132
  return Number(referenceType) === FORWARD_MESSAGE_REFERENCE_TYPE ? null : message.referencedMessage ?? null;
133
133
  }
134
+ function resolveDiscordReferencedReplyMessageId(message) {
135
+ const referenceType = message.messageReference?.type;
136
+ if (Number(referenceType) === FORWARD_MESSAGE_REFERENCE_TYPE) return null;
137
+ return normalizeOptionalString(message.messageReference?.message_id) ?? normalizeOptionalString(message.referencedMessage?.id) ?? null;
138
+ }
134
139
  function formatDiscordSnapshotAuthor(author) {
135
140
  if (!author) return;
136
141
  const globalName = normalizeOptionalString(author.global_name) ?? void 0;
@@ -497,8 +502,8 @@ function resolveDiscordMentions(text, message) {
497
502
  if (!Array.isArray(mentions) || mentions.length === 0) return text;
498
503
  let out = text;
499
504
  for (const user of mentions) {
500
- const label = user.globalName || user.username;
501
- out = out.replace(new RegExp(`<@!?${user.id}>`, "g"), `@${label}`);
505
+ const label = user.globalName || user.username || user.id;
506
+ out = out.replace(new RegExp(`<@!?${user.id}>`, "g"), () => `@${label}`);
502
507
  }
503
508
  return out;
504
509
  }
@@ -563,4 +568,4 @@ function resolveDiscordSnapshotMessageText(snapshot) {
563
568
  return [content || embedText || componentText, attachmentText].filter(Boolean).join("\n");
564
569
  }
565
570
  //#endregion
566
- export { formatDiscordMediaText as a, resolveReferencedReplyMediaList as c, resolveDiscordCdnPolicy as d, resolveDiscordChannelInfo as f, resolveDiscordMessageText as i, hasDiscordMessageStickers as l, resolveDiscordForwardedMessagesTextFromSnapshots as n, resolveForwardedMediaList as o, resolveDiscordMessageChannelId as p, resolveDiscordMessageHistoryText as r, resolveMediaList as s, resolveDiscordEmbedText as t, resolveDiscordMessageStickers as u };
571
+ export { formatDiscordMediaText as a, resolveReferencedReplyMediaList as c, resolveDiscordReferencedReplyMessage as d, resolveDiscordReferencedReplyMessageId as f, resolveDiscordMessageChannelId as h, resolveDiscordMessageText as i, hasDiscordMessageStickers as l, resolveDiscordChannelInfo as m, resolveDiscordForwardedMessagesTextFromSnapshots as n, resolveForwardedMediaList as o, resolveDiscordCdnPolicy as p, resolveDiscordMessageHistoryText as r, resolveMediaList as s, resolveDiscordEmbedText as t, resolveDiscordMessageStickers as u };