@openclaw/discord 2026.11.7 → 2026.11.9

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 (107) hide show
  1. package/dist/.setup/{account-inspect-DGkdWwix.mjs → account-inspect-CSz5Qodj.mjs} +2 -3
  2. package/dist/.setup/{accounts-C_25wyxC.mjs → accounts-DtjvhJUj.mjs} +4 -8
  3. package/dist/.setup/{active-turn-thread-route-KvRTAVE3.mjs → active-turn-thread-route-DkPnk2x8.mjs} +1 -2
  4. package/dist/.setup/{allow-list-C3j0qLDp.mjs → allow-list-CkqpzPvP.mjs} +4 -8
  5. package/dist/.setup/{api-DYRggUgK.mjs → api-C4j_kC-2.mjs} +4 -6
  6. package/dist/.setup/{approval-handler.runtime-BN4W1r0o.mjs → approval-handler.runtime-bB4eKcGl.mjs} +9 -10
  7. package/dist/.setup/{approval-message-updates-DKsCfxSW.mjs → approval-message-updates-DqOXxPss.mjs} +3 -4
  8. package/dist/.setup/{audit-BL6EoUun.mjs → audit-D1UISAXW.mjs} +6 -7
  9. package/dist/.setup/{channel-access-9cyzozUP.mjs → channel-access-DhJhVrdZ.mjs} +1 -2
  10. package/dist/.setup/{channel-DdI2l55_.mjs → channel-i4V5w1Nh.mjs} +35 -41
  11. package/dist/.setup/{channel.setup-kNWMxlgu.mjs → channel.setup-BrGEJ0Ia.mjs} +7 -10
  12. package/dist/.setup/{command-deploy-store-DFkBTViB.mjs → command-deploy-store-DPWiBMks.mjs} +1 -2
  13. package/dist/.setup/{command-owners-C7rUdqUX.mjs → command-owners-BzlhNBxA.mjs} +1 -2
  14. package/dist/.setup/{components-C1Phe3uw.mjs → components-DeCLO9w0.mjs} +10 -16
  15. package/dist/.setup/{components.base-CiS0h_XP.mjs → components.base-C5sAPHe4.mjs} +1 -2
  16. package/dist/.setup/{config-schema-BNKN1cu5.mjs → config-schema-GX2yDgIH.mjs} +3 -5
  17. package/dist/.setup/{conversation-binding-route-K_jFbvi5.mjs → conversation-binding-route-CHCfhsCl.mjs} +2 -3
  18. package/dist/.setup/{directory-config-Ble81PWH.mjs → directory-config-BXJuh9-J.mjs} +3 -4
  19. package/dist/.setup/{directory-live-CY2-qrHI.mjs → directory-live-dzJ14-DT.mjs} +9 -64
  20. package/dist/.setup/{discord-BRVFhk09.mjs → discord-BGkLzt2b.mjs} +93 -72
  21. package/dist/.setup/{doctor-RqH-6JB0.mjs → doctor-DBBXoP9w.mjs} +7 -8
  22. package/dist/.setup/{doctor-contract-Bwv8EuQ_.mjs → doctor-contract-Dstl3cMg.mjs} +2 -3
  23. package/dist/.setup/{endpoint-runtime-lf4DeLas.mjs → endpoint-runtime-BM3x-m6O.mjs} +1 -2
  24. package/dist/.setup/{guilds-BSnrns-F.mjs → guilds-DYBhgnfq.mjs} +3 -4
  25. package/dist/.setup/{handle-action-uD87h2FK.mjs → handle-action-Dx2N-4A6.mjs} +11 -11
  26. package/dist/.setup/{handle-action.guild-admin-CqBx_3mG.mjs → handle-action.guild-admin-CGzsE3bM.mjs} +7 -5
  27. package/dist/.setup/{listeners-DnHLrLIN.mjs → listeners-DHjDOlXW.mjs} +2 -3
  28. package/dist/.setup/{live-policy-config-y0Qy36X3.mjs → live-policy-config-DjIHWFla.mjs} +3 -5
  29. package/dist/.setup/{message-handler-CWL_u0X8.mjs → message-handler-OqhwO2Il.mjs} +11 -15
  30. package/dist/.setup/{message-handler.preflight-83tpEdBG.mjs → message-handler.preflight-DaqozzfW.mjs} +20 -43
  31. package/dist/.setup/{message-handler.preflight-pluralkit-Dhcx7Ifz.mjs → message-handler.preflight-pluralkit-CPWdqrEU.mjs} +10 -14
  32. package/dist/.setup/{message-handler.process-BC-wNZwK.mjs → message-handler.process-C6ETXKq2.mjs} +26 -34
  33. package/dist/.setup/{outbound-payload-CK3_bDvK.mjs → outbound-payload-DOFjmMNE.mjs} +9 -11
  34. package/dist/.setup/{outbound-session-route-Ay_DnOOl.mjs → outbound-session-route-CzL157kC.mjs} +22 -34
  35. package/dist/.setup/{output-activity-uBpMSX75.mjs → output-activity-CDgs2s3O.mjs} +1 -2
  36. package/dist/.setup/{pluralkit-B64dfq_j.mjs → pluralkit-DcXbHTpQ.mjs} +2 -3
  37. package/dist/.setup/{preflight-audio-C6QtD6HX.mjs → preflight-audio-r4BbaJxh.mjs} +1 -2
  38. package/dist/.setup/{presence-cache-Dq-3nH7R.mjs → presence-cache-B3xj3b0l.mjs} +1 -2
  39. package/dist/.setup/{probe-CbDJojNV.mjs → probe-CfGMZwFD.mjs} +5 -6
  40. package/dist/.setup/{provider-CRb3Myky.mjs → provider-BcSZ6vqo.mjs} +110 -186
  41. package/dist/.setup/{provider-session.runtime-3cZpps3H.mjs → provider-session.runtime-CxGNqH7Q.mjs} +3 -3
  42. package/dist/.setup/provider.runtime-DPhNybGw.mjs +1 -0
  43. package/dist/.setup/{proxy-fetch-BzXwBAXt.mjs → proxy-fetch-B8cK6FLQ.mjs} +1 -2
  44. package/dist/.setup/{realtime-session.runtime-BRYpjS9P.mjs → realtime-session.runtime-Carw2Z1J.mjs} +15 -25
  45. package/dist/.setup/{receive-recovery-C3Ks4wAQ.mjs → receive-recovery-DV_v5ROf.mjs} +3 -6
  46. package/dist/.setup/{resolve-allowlist-common-B-S0wRIw.mjs → resolve-allowlist-common-CYdqBUgV.mjs} +3 -4
  47. package/dist/.setup/{resolve-channels-g16NM6Ho.mjs → resolve-channels-BNnyfCR8.mjs} +6 -7
  48. package/dist/.setup/{resolve-users-DAfOOXdy.mjs → resolve-users-CDMAGrzv.mjs} +5 -6
  49. package/dist/.setup/{rolldown-runtime-B4FMCO8f.mjs → rolldown-runtime-nwUcYXjP.mjs} +1 -2
  50. package/dist/.setup/{runtime-BMgTyuwg.mjs → runtime-B-PgPsGR.mjs} +4 -6
  51. package/dist/.setup/{runtime--HZ9r3tF.mjs → runtime-BJxDx_zr.mjs} +49 -47
  52. package/dist/.setup/{runtime-DgnVQ7zW.mjs → runtime-DcBvHOm1.mjs} +1 -2
  53. package/dist/.setup/{runtime-doctor-migrations-BPV-R4G9.mjs → runtime-doctor-migrations-BpV1jKk0.mjs} +5 -9
  54. package/dist/.setup/{secret-config-contract-B1kE4sDv.mjs → secret-config-contract-CP6teHec.mjs} +1 -2
  55. package/dist/.setup/{security-audit-BFT84Uny.mjs → security-audit-CTwisG7c.mjs} +3 -4
  56. package/dist/.setup/{security-contract-DNyyjTZZ.mjs → security-contract-D-o0iWDk.mjs} +1 -2
  57. package/dist/.setup/{security-doctor-nGgPm65L.mjs → security-doctor-4s7omTZd.mjs} +1 -2
  58. package/dist/.setup/{send-CtvwfZQ2.mjs → send-BQtMCED2.mjs} +19 -28
  59. package/dist/.setup/{send.components-CtLtE0yD.mjs → send.components-BTjOU5BX.mjs} +11 -14
  60. package/dist/.setup/{send.outbound-D58xXPgs.mjs → send.outbound-izfb48w-.mjs} +10 -16
  61. package/dist/.setup/{send.receipt-DLOV4qx6.mjs → send.receipt-D0vpuJMr.mjs} +64 -17
  62. package/dist/.setup/{send.shared-B_KKRrD7.mjs → send.shared-BVJkIe93.mjs} +15 -20
  63. package/dist/.setup/{sender-identity-BbA7FNbr.mjs → sender-identity-Dt5ELjRN.mjs} +2 -3
  64. package/dist/.setup/{session-contract-BO5tlIdl.mjs → session-contract-Bq71MS78.mjs} +1 -2
  65. package/dist/.setup/{session-key-normalization-CCHGNSQw.mjs → session-key-normalization-Cfvze5hd.mjs} +1 -2
  66. package/dist/.setup/setup-plugin-api-DCiNtEra.mjs +2 -0
  67. package/dist/.setup/{shared-Dv2DamaK.mjs → shared-djlPz0hY.mjs} +14 -17
  68. package/dist/.setup/{shared-interactive-DmzaoKOM.mjs → shared-interactive-DKBw4SNV.mjs} +7 -12
  69. package/dist/.setup/{subagent-hooks-yT45eTyz.mjs → subagent-hooks-BTmMGFYh.mjs} +3 -4
  70. package/dist/.setup/{system-events-Dlzp9Jcj.mjs → system-events-LN3PXCia.mjs} +3 -4
  71. package/dist/.setup/{target-parsing-C-HyNxcE.mjs → target-parsing-BiuhcK9Q.mjs} +1 -2
  72. package/dist/.setup/{target-resolver-BzaZPBm9.mjs → target-resolver-C98DQ-sp.mjs} +6 -7
  73. package/dist/.setup/{thread-binding-api-BDZJD4na.mjs → thread-binding-api-Drd4Zu-5.mjs} +1 -2
  74. package/dist/.setup/{thread-bindings-DRWhgKCc.mjs → thread-bindings-ESkVljSW.mjs} +7 -10
  75. package/dist/.setup/{thread-bindings.manager-CWJKirn1.mjs → thread-bindings.manager-BG7MMT7H.mjs} +15 -20
  76. package/dist/.setup/{thread-bindings.session-updates-DzJrXc4w.mjs → thread-bindings.session-updates-Ddn14oJa.mjs} +6 -10
  77. package/dist/.setup/{threading-BbsPuT5G.mjs → threading-BzxVQcv8.mjs} +5 -7
  78. package/dist/.setup/{timeouts-cIxzatmv.mjs → timeouts-CT9hnmo4.mjs} +1 -2
  79. package/dist/.setup/{transcripts-source-DIW1fU_P.mjs → transcripts-source-a1btN-pC.mjs} +20 -33
  80. package/dist/.setup/{typing-CNlSKY5S.mjs → typing-DAv4S2fI.mjs} +2 -3
  81. package/dist/.setup/{voice-runtime-oJ6BZs5D.mjs → voice-runtime-BI76hQQH.mjs} +28 -46
  82. package/dist/.source-module-urls/d6c089460280c5a04184542d6712e04545caeb1ebb290d3504377b4cc5e22fea.json +1 -1
  83. package/dist/account-inspect-api.js +2 -3
  84. package/dist/action-runtime-api.js +1 -1
  85. package/dist/activities-api.js +9 -13
  86. package/dist/api.js +21 -22
  87. package/dist/channel-config-api.js +1 -1
  88. package/dist/channel-plugin-api.js +1 -1
  89. package/dist/contract-api.js +1 -1
  90. package/dist/directory-contract-api.js +2 -3
  91. package/dist/doctor-contract-api.js +5 -7
  92. package/dist/index.js +1 -2
  93. package/dist/runtime-api.js +22 -22
  94. package/dist/runtime-setter-api.js +1 -1
  95. package/dist/secret-contract-api.js +1 -1
  96. package/dist/security-audit-contract-api.js +1 -1
  97. package/dist/security-contract-api.js +1 -1
  98. package/dist/session-key-api.js +1 -1
  99. package/dist/setup-entry.js +2 -3
  100. package/dist/setup-plugin-api.js +1 -1
  101. package/dist/src/voice/audio-worker.runtime.js +8 -14
  102. package/dist/subagent-hooks-api.js +2 -3
  103. package/dist/thread-binding-api.js +1 -1
  104. package/dist/transcripts-source-api.js +2 -3
  105. package/package.json +4 -4
  106. package/dist/.setup/provider.runtime-tmkt3QOg.mjs +0 -1
  107. package/dist/.setup/setup-plugin-api-ty5RJrMy.mjs +0 -2
@@ -1,5 +1,4 @@
1
1
  import { buildMutableAllowEntryDetector } from "openclaw/plugin-sdk/channel-policy";
2
- //#region extensions/discord/src/security-doctor.ts
2
+ // extensions/discord/src/security-doctor.ts
3
3
  const isDiscordMutableAllowEntry = buildMutableAllowEntryDetector({ stableIdPattern: /^(?:\d+|<@!?\d+>|(?:discord|user|pk):.+)$/ });
4
- //#endregion
5
4
  export { isDiscordMutableAllowEntry as t };
@@ -1,13 +1,13 @@
1
- import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.mjs";
2
- import { C as hasAnyChannelPermissionDiscord, D as createDiscordMessageNonce, F as resolveDiscordClientAccountContext, I as resolveDiscordRest, M as createDiscordClient, O as resolveDiscordMessageFlags, S as hasAllGuildPermissionsDiscord, _ as canManageGuildMemberRoleDiscord, a as normalizeEmojiName, b as fetchChannelPermissionsDiscord, c as resolveChannelId, d as sendDiscordChunks, g as DiscordSendError, h as DISCORD_MAX_STICKER_BYTES, j as resolveDiscordSuppressEmbeds, m as DISCORD_MAX_EVENT_COVER_BYTES, n as buildDiscordTextChunks, o as normalizeReactionEmoji, p as DISCORD_MAX_EMOJI_BYTES, r as buildReactionIdentifier, t as buildDiscordSendError, v as canManageGuildRoleDiscord, w as hasAnyGuildPermissionDiscord, x as fetchMemberGuildPermissionsDiscord, y as canViewDiscordGuildChannel } from "./send.shared-B_KKRrD7.mjs";
3
- import { B as RateLimitError, C as listMessageReactionUsers, D as editChannelMessage, E as deleteChannelMessage, F as getGuildVoiceState, G as readRetryAfter, H as isUnknownDiscordVoiceStateError, I as listGuildEmojis, J as stripUndefinedFields, L as DISCORD_REST_TIMEOUT_MS, M as unpinChannelMessage, N as getGuild, O as getChannel, P as getGuildMember, S as deleteOwnMessageReaction, T as createThread, U as readDiscordCode, V as isUnknownDiscordMessageError, W as readDiscordMessage, j as pinChannelMessage, k as getChannelMessage, q as withDiscordRequestAuthority, w as createChannelMessage, x as createOwnMessageReaction, z as DiscordError } from "./discord-BRVFhk09.mjs";
4
- import { C as parseDiscordRetryAfterBodySeconds } from "./allow-list-C3j0qLDp.mjs";
5
- import { _ as recordDiscordMessageCreateAmbiguity, h as createDiscordRetryRunner, m as classifyDiscordDeliveryFailure, n as createDiscordSendReceiptFromResults, r as createDiscordSendResult, v as chunkDiscordTextWithMode } from "./send.receipt-DLOV4qx6.mjs";
6
- import { n as getDiscordEndpointRuntime, r as resolveDiscordEndpointAttachmentGuard } from "./endpoint-runtime-lf4DeLas.mjs";
7
- import { o as parseDiscordHttpErrorBody } from "./api-DYRggUgK.mjs";
8
- import { t as parseAndResolveDiscordTarget } from "./target-resolver-BzaZPBm9.mjs";
9
- import { a as prepareDiscordOutboundText, n as sendPollDiscord, r as sendStickerDiscord, t as sendMessageDiscord } from "./send.outbound-D58xXPgs.mjs";
10
- import { n as DISCORD_ATTACHMENT_TOTAL_TIMEOUT_MS } from "./timeouts-cIxzatmv.mjs";
1
+ import { t as __exportAll } from "./rolldown-runtime-nwUcYXjP.mjs";
2
+ import { C as hasAnyChannelPermissionDiscord, D as createDiscordMessageNonce, F as resolveDiscordClientAccountContext, I as resolveDiscordRest, M as createDiscordClient, O as resolveDiscordMessageFlags, S as hasAllGuildPermissionsDiscord, _ as canManageGuildMemberRoleDiscord, a as normalizeEmojiName, b as fetchChannelPermissionsDiscord, c as resolveChannelId, d as sendDiscordChunks, g as DiscordSendError, h as DISCORD_MAX_STICKER_BYTES, j as resolveDiscordSuppressEmbeds, m as DISCORD_MAX_EVENT_COVER_BYTES, n as buildDiscordTextChunks, o as normalizeReactionEmoji, p as DISCORD_MAX_EMOJI_BYTES, r as buildReactionIdentifier, t as buildDiscordSendError, v as canManageGuildRoleDiscord, w as hasAnyGuildPermissionDiscord, x as fetchMemberGuildPermissionsDiscord, y as canViewDiscordGuildChannel } from "./send.shared-BVJkIe93.mjs";
3
+ import { B as RateLimitError, C as listMessageReactionUsers, D as editChannelMessage, E as deleteChannelMessage, F as getGuildVoiceState, G as readRetryAfter, H as isUnknownDiscordVoiceStateError, I as listGuildEmojis, J as stripUndefinedFields, L as DISCORD_REST_TIMEOUT_MS, M as unpinChannelMessage, N as getGuild, O as getChannel, P as getGuildMember, S as deleteOwnMessageReaction, T as createThread, U as readDiscordCode, V as isUnknownDiscordMessageError, W as readDiscordMessage, j as pinChannelMessage, k as getChannelMessage, q as withDiscordRequestAuthority, w as createChannelMessage, x as createOwnMessageReaction, z as DiscordError } from "./discord-BGkLzt2b.mjs";
4
+ import { C as parseDiscordRetryAfterBodySeconds } from "./allow-list-CkqpzPvP.mjs";
5
+ import { S as chunkDiscordTextWithMode, n as createDiscordSendReceiptFromResults, r as createDiscordSendResult, v as classifyDiscordDeliveryFailure, x as recordDiscordMessageCreateAmbiguity, y as createDiscordRetryRunner } from "./send.receipt-D0vpuJMr.mjs";
6
+ import { n as getDiscordEndpointRuntime, r as resolveDiscordEndpointAttachmentGuard } from "./endpoint-runtime-BM3x-m6O.mjs";
7
+ import { o as parseDiscordHttpErrorBody } from "./api-C4j_kC-2.mjs";
8
+ import { t as parseAndResolveDiscordTarget } from "./target-resolver-C98DQ-sp.mjs";
9
+ import { a as prepareDiscordOutboundText, n as sendPollDiscord, r as sendStickerDiscord, t as sendMessageDiscord } from "./send.outbound-izfb48w-.mjs";
10
+ import { n as DISCORD_ATTACHMENT_TOTAL_TIMEOUT_MS } from "./timeouts-CT9hnmo4.mjs";
11
11
  import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
12
12
  import { resolvePreferredOpenClawTmpDir, withTempWorkspace } from "openclaw/plugin-sdk/temp-path";
13
13
  import { normalizeLowercaseStringOrEmpty, normalizeOptionalLowercaseString, normalizeOptionalString, normalizeStringEntries } from "openclaw/plugin-sdk/string-coerce-runtime";
@@ -26,7 +26,7 @@ import { buildTimeoutAbortSignal } from "openclaw/plugin-sdk/extension-shared";
26
26
  import fs from "node:fs/promises";
27
27
  import path from "node:path";
28
28
  import { writeExternalFileWithinRoot } from "openclaw/plugin-sdk/security-runtime";
29
- //#region extensions/discord/src/send.channels.ts
29
+ // extensions/discord/src/send.channels.ts
30
30
  async function createChannelDiscord(payload, opts) {
31
31
  const rest = resolveDiscordRest(opts);
32
32
  const body = stripUndefinedFields({
@@ -87,8 +87,7 @@ async function removeChannelPermissionDiscord(channelId, targetId, opts) {
87
87
  await resolveDiscordRest(opts).delete(Routes.channelPermission(channelId, targetId));
88
88
  return { ok: true };
89
89
  }
90
- //#endregion
91
- //#region extensions/discord/src/send.emojis-stickers.ts
90
+ // extensions/discord/src/send.emojis-stickers.ts
92
91
  const DISCORD_IMAGE_UPLOAD_TYPES = [
93
92
  "image/png",
94
93
  "image/jpeg",
@@ -146,8 +145,7 @@ async function uploadStickerDiscord(payload, opts) {
146
145
  }
147
146
  });
148
147
  }
149
- //#endregion
150
- //#region extensions/discord/src/send.guild.ts
148
+ // extensions/discord/src/send.guild.ts
151
149
  function readDiscordResource(read) {
152
150
  return async (id, opts) => await read(resolveDiscordRest(opts), id);
153
151
  }
@@ -226,8 +224,7 @@ async function banMemberDiscord(payload, opts) {
226
224
  });
227
225
  return { ok: true };
228
226
  }
229
- //#endregion
230
- //#region extensions/discord/src/send.messages.ts
227
+ // extensions/discord/src/send.messages.ts
231
228
  const DISCORD_THREAD_TRANSPORT_ONLY_MAX_LINES = Number.MAX_SAFE_INTEGER;
232
229
  function resolveDiscordThreadStarterMessageId(thread) {
233
230
  const starterMessage = "message" in thread ? thread.message : void 0;
@@ -429,8 +426,7 @@ async function searchMessagesDiscord(query, opts) {
429
426
  assertDiscordSearchResponse(result);
430
427
  return result;
431
428
  }
432
- //#endregion
433
- //#region extensions/discord/src/send.webhook.ts
429
+ // extensions/discord/src/send.webhook.ts
434
430
  const DISCORD_WEBHOOK_ERROR_BODY_LIMIT_BYTES = 8192;
435
431
  const DISCORD_WEBHOOK_TIMEOUT_MS = DISCORD_REST_TIMEOUT_MS;
436
432
  function throwIfWebhookDeadlineExpired(signal) {
@@ -548,8 +544,7 @@ async function sendWebhookMessageDiscord(text, opts) {
548
544
  deadline.cleanup();
549
545
  }
550
546
  }
551
- //#endregion
552
- //#region extensions/discord/src/send.voice.ts
547
+ // extensions/discord/src/send.voice.ts
553
548
  const WAVEFORM_SAMPLES = 256;
554
549
  const DISCORD_OPUS_SAMPLE_RATE_HZ = 48e3;
555
550
  const DISCORD_VOICE_ERROR_BODY_LIMIT_BYTES = 8192;
@@ -861,8 +856,7 @@ async function sendVoiceMessageDiscord(to, audioPath, opts) {
861
856
  });
862
857
  });
863
858
  }
864
- //#endregion
865
- //#region extensions/discord/src/send.typing.ts
859
+ // extensions/discord/src/send.typing.ts
866
860
  async function sendTypingDiscord(channelId, opts) {
867
861
  await resolveDiscordRest(opts).post(Routes.channelTyping(channelId));
868
862
  return {
@@ -870,8 +864,7 @@ async function sendTypingDiscord(channelId, opts) {
870
864
  channelId
871
865
  };
872
866
  }
873
- //#endregion
874
- //#region extensions/discord/src/send.reactions.ts
867
+ // extensions/discord/src/send.reactions.ts
875
868
  function reactionMutation(operation, label) {
876
869
  return async (channelId, messageId, emoji, opts) => {
877
870
  const { rest, request } = createDiscordClient(opts);
@@ -927,8 +920,7 @@ async function fetchReactionsDiscord(channelId, messageId, opts) {
927
920
  }
928
921
  return summaries;
929
922
  }
930
- //#endregion
931
- //#region extensions/discord/src/send.ts
923
+ // extensions/discord/src/send.ts
932
924
  var send_exports = /* @__PURE__ */ __exportAll({
933
925
  DiscordSendError: () => DiscordSendError,
934
926
  DiscordThreadInitialMessageError: () => DiscordThreadInitialMessageError,
@@ -984,5 +976,4 @@ var send_exports = /* @__PURE__ */ __exportAll({
984
976
  uploadEmojiDiscord: () => uploadEmojiDiscord,
985
977
  uploadStickerDiscord: () => uploadStickerDiscord
986
978
  });
987
- //#endregion
988
979
  export { listScheduledEventsDiscord as A, moveChannelDiscord as B, fetchChannelInfoDiscord as C, fetchVoiceStatusDiscord as D, fetchRoleInfoDiscord as E, uploadEmojiDiscord as F, setChannelPermissionDiscord as H, uploadStickerDiscord as I, createChannelDiscord as L, resolveEventCoverImage as M, timeoutMemberDiscord as N, kickMemberDiscord as O, listGuildEmojisDiscord as P, deleteChannelDiscord as R, createScheduledEventDiscord as S, fetchMemberInfoDiscord as T, removeChannelPermissionDiscord as V, readMessagesDiscord as _, removeReactionDiscord as a, addRoleDiscord as b, sendWebhookMessageDiscord as c, deleteMessageDiscord as d, editMessageDiscord as f, pinMessageDiscord as g, listThreadsDiscord as h, removeOwnReactionsDiscord as i, removeRoleDiscord as j, listGuildChannelsDiscord as k, DiscordThreadInitialMessageError as l, listPinsDiscord as m, fetchReactionsDiscord as n, sendTypingDiscord as o, fetchMessageDiscord as p, reactMessageDiscord as r, sendVoiceMessageDiscord as s, send_exports as t, createThreadDiscord as u, searchMessagesDiscord as v, fetchGuildInfoDiscord as w, banMemberDiscord as x, unpinMessageDiscord as y, editChannelDiscord as z };
@@ -1,11 +1,11 @@
1
- import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.mjs";
2
- import { D as createDiscordMessageNonce, M as createDiscordClient, T as SUPPRESS_NOTIFICATIONS_FLAG, c as resolveChannelId, l as resolveDiscordChannel, t as buildDiscordSendError } from "./send.shared-B_KKRrD7.mjs";
3
- import { D as editChannelMessage, f as serializePayload, q as withDiscordRequestAuthority, w as createChannelMessage } from "./discord-BRVFhk09.mjs";
4
- import { r as createDiscordSendResult } from "./send.receipt-DLOV4qx6.mjs";
5
- import { t as parseAndResolveDiscordTarget } from "./target-resolver-BzaZPBm9.mjs";
6
- import { t as sendMessageDiscord } from "./send.outbound-D58xXPgs.mjs";
7
- import { a as buildDiscordComponentMessage, u as resolveDiscordComponentAttachmentName } from "./components-C1Phe3uw.mjs";
8
- import { n as getOptionalDiscordRuntime } from "./runtime-DgnVQ7zW.mjs";
1
+ import { t as __exportAll } from "./rolldown-runtime-nwUcYXjP.mjs";
2
+ import { D as createDiscordMessageNonce, M as createDiscordClient, T as SUPPRESS_NOTIFICATIONS_FLAG, c as resolveChannelId, l as resolveDiscordChannel, t as buildDiscordSendError } from "./send.shared-BVJkIe93.mjs";
3
+ import { D as editChannelMessage, f as serializePayload, q as withDiscordRequestAuthority, w as createChannelMessage } from "./discord-BGkLzt2b.mjs";
4
+ import { r as createDiscordSendResult } from "./send.receipt-D0vpuJMr.mjs";
5
+ import { t as parseAndResolveDiscordTarget } from "./target-resolver-C98DQ-sp.mjs";
6
+ import { t as sendMessageDiscord } from "./send.outbound-izfb48w-.mjs";
7
+ import { a as buildDiscordComponentMessage, u as resolveDiscordComponentAttachmentName } from "./components-DeCLO9w0.mjs";
8
+ import { n as getOptionalDiscordRuntime } from "./runtime-DcBvHOm1.mjs";
9
9
  import { hasNonEmptyString, uniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
10
10
  import { ChannelType } from "discord-api-types/v10";
11
11
  import { loadOutboundMediaFromUrl } from "openclaw/plugin-sdk/outbound-media";
@@ -16,7 +16,7 @@ import { recordChannelActivity } from "openclaw/plugin-sdk/channel-activity-runt
16
16
  import { extensionForMime } from "openclaw/plugin-sdk/media-mime";
17
17
  import { createPluginStateErrorReporter } from "openclaw/plugin-sdk/plugin-state-runtime";
18
18
  import { createAsyncLock } from "openclaw/plugin-sdk/async-lock-runtime";
19
- //#region extensions/discord/src/components-registry-state.ts
19
+ // extensions/discord/src/components-registry-state.ts
20
20
  const discordComponentRegistryState = resolveGlobalSingleton(Symbol.for("openclaw.discord.componentRegistryState"), () => ({
21
21
  withRegistryLock: createAsyncLock(),
22
22
  componentEntries: /* @__PURE__ */ new Map(),
@@ -31,8 +31,7 @@ const discordComponentRegistryState = resolveGlobalSingleton(Symbol.for("opencla
31
31
  state.persistentModalStore = void 0;
32
32
  state.persistentRegistryDisabled = false;
33
33
  }));
34
- //#endregion
35
- //#region extensions/discord/src/components-registry.ts
34
+ // extensions/discord/src/components-registry.ts
36
35
  const DEFAULT_COMPONENT_TTL_MS = 18e5;
37
36
  const PERSISTENT_COMPONENT_NAMESPACE = "discord.components";
38
37
  const PERSISTENT_MODAL_NAMESPACE = "discord.modals";
@@ -227,8 +226,7 @@ async function resolveDiscordModalEntryWithPersistence(params) {
227
226
  });
228
227
  });
229
228
  }
230
- //#endregion
231
- //#region extensions/discord/src/send.components.ts
229
+ // extensions/discord/src/send.components.ts
232
230
  var send_components_exports = /* @__PURE__ */ __exportAll({
233
231
  editDiscordComponentMessage: () => editDiscordComponentMessage,
234
232
  registerBuiltDiscordComponentMessage: () => registerBuiltDiscordComponentMessage,
@@ -394,5 +392,4 @@ async function writeDiscordComponentMessage(to, spec, opts, messageId) {
394
392
  });
395
393
  return deliveryResult ?? toDeliveryResult();
396
394
  }
397
- //#endregion
398
395
  export { registerDiscordComponentEntries as a, send_components_exports as i, registerBuiltDiscordComponentMessage as n, resolveDiscordComponentEntryWithPersistence as o, sendDiscordComponentMessage as r, resolveDiscordModalEntryWithPersistence as s, editDiscordComponentMessage as t };
@@ -1,9 +1,8 @@
1
- import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.mjs";
2
- import { A as resolveDiscordSendEmbeds, D as createDiscordMessageNonce, E as buildDiscordMessageRequest, M as createDiscordClient, O as resolveDiscordMessageFlags, c as resolveChannelId, d as sendDiscordChunks, f as sendDiscordMedia, i as normalizeDiscordPollInput, j as resolveDiscordSuppressEmbeds, k as resolveDiscordSendComponents, l as resolveDiscordChannel, n as buildDiscordTextChunks, s as normalizeStickerIds, t as buildDiscordSendError } from "./send.shared-B_KKRrD7.mjs";
3
- import { T as createThread, q as withDiscordRequestAuthority, w as createChannelMessage } from "./discord-BRVFhk09.mjs";
4
- import { n as createDiscordSendReceiptFromResults, r as createDiscordSendResult, u as createReusableDiscordReplyReference } from "./send.receipt-DLOV4qx6.mjs";
5
- import { a as normalizeDiscordSnowflake, i as normalizeDiscordHandleKey, s as resolveDiscordDirectoryUserId } from "./directory-live-CY2-qrHI.mjs";
6
- import { t as parseAndResolveDiscordTarget } from "./target-resolver-BzaZPBm9.mjs";
1
+ import { t as __exportAll } from "./rolldown-runtime-nwUcYXjP.mjs";
2
+ import { A as resolveDiscordSendEmbeds, D as createDiscordMessageNonce, E as buildDiscordMessageRequest, M as createDiscordClient, O as resolveDiscordMessageFlags, c as resolveChannelId, d as sendDiscordChunks, f as sendDiscordMedia, i as normalizeDiscordPollInput, j as resolveDiscordSuppressEmbeds, k as resolveDiscordSendComponents, l as resolveDiscordChannel, n as buildDiscordTextChunks, s as normalizeStickerIds, t as buildDiscordSendError } from "./send.shared-BVJkIe93.mjs";
3
+ import { T as createThread, q as withDiscordRequestAuthority, w as createChannelMessage } from "./discord-BGkLzt2b.mjs";
4
+ import { d as normalizeDiscordSnowflake, m as createReusableDiscordReplyReference, n as createDiscordSendReceiptFromResults, p as resolveDiscordDirectoryUserId, r as createDiscordSendResult, u as normalizeDiscordHandleKey } from "./send.receipt-D0vpuJMr.mjs";
5
+ import { t as parseAndResolveDiscordTarget } from "./target-resolver-C98DQ-sp.mjs";
7
6
  import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
8
7
  import { ChannelType } from "discord-api-types/v10";
9
8
  import { requireRuntimeConfig } from "openclaw/plugin-sdk/plugin-config-runtime";
@@ -14,7 +13,7 @@ import { truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
14
13
  import { recordChannelActivity } from "openclaw/plugin-sdk/channel-activity-runtime";
15
14
  import { resolveMarkdownTableMode } from "openclaw/plugin-sdk/markdown-table-runtime";
16
15
  import { fromMarkdown } from "mdast-util-from-markdown";
17
- //#region extensions/discord/src/url-ranges.ts
16
+ // extensions/discord/src/url-ranges.ts
18
17
  const DISCORD_URL_START_RE = /(?:[A-Za-z][A-Za-z0-9+.-]*:\/\/|www\.|\/\/|mailto:)/giu;
19
18
  function findDiscordUrlRanges(markdown) {
20
19
  const ranges = [];
@@ -42,8 +41,7 @@ function findDiscordUrlRanges(markdown) {
42
41
  }
43
42
  return ranges;
44
43
  }
45
- //#endregion
46
- //#region extensions/discord/src/mentions.ts
44
+ // extensions/discord/src/mentions.ts
47
45
  const MENTION_CANDIDATE_PATTERN = /(^|[\s([{"'.,;:!?])@([a-z0-9_.-]{2,32}(?:#[0-9]{4})?)/gi;
48
46
  const DISCORD_RESERVED_MENTIONS = /* @__PURE__ */ new Set(["everyone", "here"]);
49
47
  const DISCORD_DISCRIMINATOR_SUFFIX = /#\d{4}$/;
@@ -138,8 +136,7 @@ function rewriteDiscordKnownMentions(text, params) {
138
136
  function discordTextHasBroadcastMention(text) {
139
137
  return DISCORD_BROADCAST_MENTION_PATTERN.test(text);
140
138
  }
141
- //#endregion
142
- //#region extensions/discord/src/markdown.ts
139
+ // extensions/discord/src/markdown.ts
143
140
  const DISCORD_NATIVE_TOKEN_RE = /<a?:[A-Za-z0-9_]+:\d+>|<\/[^>]+:\d+>/giu;
144
141
  function normalizeDiscordBold(markdown) {
145
142
  if (!markdown.includes("__")) return markdown;
@@ -288,8 +285,7 @@ function normalizeDiscordBold(markdown) {
288
285
  function renderDiscordMarkdown(markdown, tableMode) {
289
286
  return normalizeDiscordBold(convertMarkdownTables(markdown, tableMode));
290
287
  }
291
- //#endregion
292
- //#region extensions/discord/src/outbound-text.ts
288
+ // extensions/discord/src/outbound-text.ts
293
289
  function prepareDiscordOutboundText(text, params) {
294
290
  const { account } = params;
295
291
  const renderedText = renderDiscordMarkdown(text, params.tableMode ?? resolveMarkdownTableMode({
@@ -306,8 +302,7 @@ function prepareDiscordOutboundText(text, params) {
306
302
  })
307
303
  };
308
304
  }
309
- //#endregion
310
- //#region extensions/discord/src/send.outbound.ts
305
+ // extensions/discord/src/send.outbound.ts
311
306
  var send_outbound_exports = /* @__PURE__ */ __exportAll({
312
307
  sendMessageDiscord: () => sendMessageDiscord,
313
308
  sendPollDiscord: () => sendPollDiscord,
@@ -574,5 +569,4 @@ async function sendDiscordStructuredMessage(to, opts, kind, buildPayload) {
574
569
  });
575
570
  });
576
571
  }
577
- //#endregion
578
572
  export { prepareDiscordOutboundText as a, send_outbound_exports as i, sendPollDiscord as n, discordTextHasBroadcastMention as o, sendStickerDiscord as r, formatMention as s, sendMessageDiscord as t };
@@ -1,16 +1,19 @@
1
- import { B as RateLimitError } from "./discord-BRVFhk09.mjs";
2
- import { t as parseDiscordTarget } from "./target-parsing-C-HyNxcE.mjs";
1
+ import { B as RateLimitError } from "./discord-BGkLzt2b.mjs";
2
+ import { t as parseDiscordTarget } from "./target-parsing-BiuhcK9Q.mjs";
3
3
  import { collectErrorGraphCandidates, extractErrorCode, formatErrorMessage, readErrorName } from "openclaw/plugin-sdk/error-runtime";
4
4
  import { sleepWithAbort } from "openclaw/plugin-sdk/runtime-env";
5
+ import { normalizeAccountId } from "openclaw/plugin-sdk/routing";
6
+ import { normalizeOptionalString, normalizeOptionalStringifiedId } from "openclaw/plugin-sdk/string-coerce-runtime";
5
7
  import { expectDefined } from "openclaw/plugin-sdk/expect-runtime";
6
8
  import { parseStrictNonNegativeInteger, resolveIntegerOption } from "openclaw/plugin-sdk/number-runtime";
7
9
  import { chunkByParagraph } from "openclaw/plugin-sdk/reply-chunking";
8
10
  import { chunkTextForOutbound, findCodeRegions } from "openclaw/plugin-sdk/text-chunking";
9
11
  import { classifyTransientNetworkErrorCode, createChannelApiRetryRunner, resolveRetryConfig, retryAsync } from "openclaw/plugin-sdk/retry-runtime";
10
12
  import { isSingleUseReplyToMode } from "openclaw/plugin-sdk/reply-reference";
13
+ import { pruneMapToMaxSize } from "openclaw/plugin-sdk/collection-runtime";
11
14
  import { createMessageReceiptFromOutboundResults } from "openclaw/plugin-sdk/channel-outbound";
12
15
  import { attachChannelToResults } from "openclaw/plugin-sdk/channel-send-result";
13
- //#region packages/normalization-core/src/utf16-slice.ts
16
+ // packages/normalization-core/src/utf16-slice.ts
14
17
  function isHighSurrogate(codeUnit) {
15
18
  return codeUnit >= 55296 && codeUnit <= 56319;
16
19
  }
@@ -23,8 +26,7 @@ function avoidTrailingHighSurrogateBreak(text, start, end) {
23
26
  const adjusted = end - 1;
24
27
  return adjusted > start ? adjusted : end + 1;
25
28
  }
26
- //#endregion
27
- //#region packages/normalization-core/src/grapheme.ts
29
+ // packages/normalization-core/src/grapheme.ts
28
30
  let graphemeSegmenter;
29
31
  function getGraphemeSegmenter() {
30
32
  graphemeSegmenter ??= new Intl.Segmenter(void 0, { granularity: "grapheme" });
@@ -48,8 +50,7 @@ function findGraphemeChunkEnd(text, start, maxEnd, preferredEnd = maxEnd, allowP
48
50
  if (end <= start && preferred < hardEnd) end = hardEnd === text.length ? hardEnd : segments.containing(hardEnd)?.index ?? hardEnd;
49
51
  return end > start ? end : allowPartial ? avoidTrailingHighSurrogateBreak(text, start, hardEnd) : start;
50
52
  }
51
- //#endregion
52
- //#region extensions/discord/src/chunk.ts
53
+ // extensions/discord/src/chunk.ts
53
54
  const DEFAULT_MAX_CHARS = 2e3;
54
55
  const DEFAULT_MAX_LINES = 17;
55
56
  const REASONING_ITALICS_MARKER_CHARS = 2;
@@ -364,8 +365,7 @@ function createDiscordRanges(source, maxChars, maxLines) {
364
365
  cutBoundary
365
366
  };
366
367
  }
367
- //#endregion
368
- //#region extensions/discord/src/retry.ts
368
+ // extensions/discord/src/retry.ts
369
369
  const DISCORD_RETRY_DEFAULTS = {
370
370
  attempts: 3,
371
371
  minDelayMs: 500,
@@ -459,8 +459,7 @@ function createDiscordRetryRunner(params) {
459
459
  })(runRequest, label);
460
460
  };
461
461
  }
462
- //#endregion
463
- //#region extensions/discord/src/reply-reference.ts
462
+ // extensions/discord/src/reply-reference.ts
464
463
  function resolveDiscordReplyReference(params) {
465
464
  if (!params.replyToId) return;
466
465
  const singleUse = params.replyToIdSource !== "explicit" && params.replyToMode !== void 0 && isSingleUseReplyToMode(params.replyToMode);
@@ -478,8 +477,58 @@ function createReusableDiscordReplyReference(messageId) {
478
477
  function resolveDiscordReplyMessageId(reply, isFirst) {
479
478
  return reply && (isFirst || reply.scope === "all") ? reply.messageId : void 0;
480
479
  }
481
- //#endregion
482
- //#region extensions/discord/src/normalize.ts
480
+ // extensions/discord/src/directory-cache-state.ts
481
+ const discordDirectoryCacheState = { handlesByAccount: /* @__PURE__ */ new Map() };
482
+ // extensions/discord/src/directory-cache.ts
483
+ const DISCORD_DIRECTORY_CACHE_MAX_ENTRIES = 4e3;
484
+ const DISCORD_DISCRIMINATOR_SUFFIX = /#\d{4}$/;
485
+ function normalizeDiscordSnowflake(value) {
486
+ const text = normalizeOptionalStringifiedId(value) ?? "";
487
+ if (!/^\d+$/.test(text)) return null;
488
+ return text;
489
+ }
490
+ function normalizeDiscordHandleKey(raw) {
491
+ let handle = normalizeOptionalString(raw) ?? "";
492
+ if (!handle) return null;
493
+ if (handle.startsWith("@")) handle = normalizeOptionalString(handle.slice(1)) ?? "";
494
+ if (!handle || /\s/.test(handle)) return null;
495
+ return handle.toLowerCase();
496
+ }
497
+ function ensureAccountCache(accountId) {
498
+ const cacheKey = normalizeAccountId(accountId);
499
+ const existing = discordDirectoryCacheState.handlesByAccount.get(cacheKey);
500
+ if (existing) return existing;
501
+ const created = /* @__PURE__ */ new Map();
502
+ discordDirectoryCacheState.handlesByAccount.set(cacheKey, created);
503
+ return created;
504
+ }
505
+ function setCacheEntry(cache, key, userId) {
506
+ const previous = cache.get(key);
507
+ cache.delete(key);
508
+ cache.set(key, previous === void 0 || previous === userId ? userId : null);
509
+ pruneMapToMaxSize(cache, DISCORD_DIRECTORY_CACHE_MAX_ENTRIES);
510
+ }
511
+ function rememberDiscordDirectoryUser(params) {
512
+ const userId = normalizeDiscordSnowflake(params.userId);
513
+ if (!userId) return;
514
+ const cache = ensureAccountCache(params.accountId);
515
+ for (const candidate of params.handles) {
516
+ if (typeof candidate !== "string") continue;
517
+ const handle = normalizeDiscordHandleKey(candidate);
518
+ if (!handle) continue;
519
+ setCacheEntry(cache, handle, userId);
520
+ const withoutDiscriminator = handle.replace(DISCORD_DISCRIMINATOR_SUFFIX, "");
521
+ if (withoutDiscriminator && withoutDiscriminator !== handle) setCacheEntry(cache, withoutDiscriminator, userId);
522
+ }
523
+ }
524
+ function resolveDiscordDirectoryUserId(params) {
525
+ const cache = discordDirectoryCacheState.handlesByAccount.get(normalizeAccountId(params.accountId));
526
+ if (!cache) return;
527
+ const handle = normalizeDiscordHandleKey(params.handle);
528
+ if (!handle) return;
529
+ return cache.get(handle) ?? void 0;
530
+ }
531
+ // extensions/discord/src/normalize.ts
483
532
  function normalizeDiscordMessagingTarget(raw) {
484
533
  return parseDiscordTarget(raw, { defaultKind: "channel" })?.normalized;
485
534
  }
@@ -524,8 +573,7 @@ function looksLikeDiscordTargetId(raw) {
524
573
  const trimmed = raw.trim();
525
574
  return /^<@!?\d+>$/.test(trimmed) || /^(?:(?:user|channel|discord):\d+|discord:(?:user|channel):\d+)$/i.test(trimmed) || /^\d{6,}$/.test(trimmed);
526
575
  }
527
- //#endregion
528
- //#region extensions/discord/src/send.receipt.ts
576
+ // extensions/discord/src/send.receipt.ts
529
577
  function toDiscordOutboundDeliveryResult(result) {
530
578
  const { channelId, ...delivery } = result;
531
579
  return {
@@ -588,5 +636,4 @@ function createDiscordSendResult(params) {
588
636
  })
589
637
  };
590
638
  }
591
- //#endregion
592
- export { recordDiscordMessageCreateAmbiguity as _, allowFromContainsDiscordUserId as a, normalizeDiscordMessagingTarget as c, resolveDiscordReplyMessageId as d, resolveDiscordReplyReference as f, hasDiscordMessageCreateAmbiguity as g, createDiscordRetryRunner as h, toDiscordOutboundDeliveryResult as i, normalizeDiscordOutboundTarget as l, classifyDiscordDeliveryFailure as m, createDiscordSendReceiptFromResults as n, looksLikeDiscordTargetId as o, canFallbackDiscordWebhookSend as p, createDiscordSendResult as r, matchesDiscordToolContextTarget as s, createDiscordSendReceipt as t, createReusableDiscordReplyReference as u, chunkDiscordTextWithMode as v, findGraphemeChunkEnd as y };
639
+ export { findGraphemeChunkEnd as C, chunkDiscordTextWithMode as S, canFallbackDiscordWebhookSend as _, allowFromContainsDiscordUserId as a, hasDiscordMessageCreateAmbiguity as b, normalizeDiscordMessagingTarget as c, normalizeDiscordSnowflake as d, rememberDiscordDirectoryUser as f, resolveDiscordReplyReference as g, resolveDiscordReplyMessageId as h, toDiscordOutboundDeliveryResult as i, normalizeDiscordOutboundTarget as l, createReusableDiscordReplyReference as m, createDiscordSendReceiptFromResults as n, looksLikeDiscordTargetId as o, resolveDiscordDirectoryUserId as p, createDiscordSendResult as r, matchesDiscordToolContextTarget as s, createDiscordSendReceipt as t, normalizeDiscordHandleKey as u, classifyDiscordDeliveryFailure as v, recordDiscordMessageCreateAmbiguity as x, createDiscordRetryRunner as y };
@@ -1,9 +1,9 @@
1
- import { h as normalizeDiscordToken, l as resolveDiscordAccount, s as mergeDiscordAccountConfig } from "./accounts-C_25wyxC.mjs";
2
- import { A as getThreadMember, N as getGuild, O as getChannel, P as getGuildMember, R as RequestClient, b as getCurrentUser, d as hasDiscordV2Components, f as serializePayload, p as Embed, w as createChannelMessage, y as createUserDmChannel, z as DiscordError } from "./discord-BRVFhk09.mjs";
3
- import { w as isDiscordThreadChannelType } from "./allow-list-C3j0qLDp.mjs";
4
- import { d as resolveDiscordReplyMessageId, h as createDiscordRetryRunner, v as chunkDiscordTextWithMode } from "./send.receipt-DLOV4qx6.mjs";
5
- import { t as resolveDiscordProxyFetchForAccount } from "./proxy-fetch-BzXwBAXt.mjs";
6
- import { t as parseAndResolveDiscordTarget } from "./target-resolver-BzaZPBm9.mjs";
1
+ import { h as normalizeDiscordToken, l as resolveDiscordAccount, s as mergeDiscordAccountConfig } from "./accounts-DtjvhJUj.mjs";
2
+ import { A as getThreadMember, N as getGuild, O as getChannel, P as getGuildMember, R as RequestClient, b as getCurrentUser, d as hasDiscordV2Components, f as serializePayload, p as Embed, w as createChannelMessage, y as createUserDmChannel, z as DiscordError } from "./discord-BGkLzt2b.mjs";
3
+ import { w as isDiscordThreadChannelType } from "./allow-list-CkqpzPvP.mjs";
4
+ import { S as chunkDiscordTextWithMode, h as resolveDiscordReplyMessageId, y as createDiscordRetryRunner } from "./send.receipt-D0vpuJMr.mjs";
5
+ import { t as resolveDiscordProxyFetchForAccount } from "./proxy-fetch-B8cK6FLQ.mjs";
6
+ import { t as parseAndResolveDiscordTarget } from "./target-resolver-C98DQ-sp.mjs";
7
7
  import { normalizeAccountId } from "openclaw/plugin-sdk/routing";
8
8
  import { normalizeOptionalString, normalizeStringEntries } from "openclaw/plugin-sdk/string-coerce-runtime";
9
9
  import { ChannelType, MessageFlags, PermissionFlagsBits } from "discord-api-types/v10";
@@ -13,7 +13,7 @@ import { loadOutboundMediaFromUrl } from "openclaw/plugin-sdk/outbound-media";
13
13
  import { requireRuntimeConfig } from "openclaw/plugin-sdk/plugin-config-runtime";
14
14
  import { resolveTextChunksWithFallback } from "openclaw/plugin-sdk/reply-payload";
15
15
  import { randomBytes } from "node:crypto";
16
- //#region extensions/discord/src/monitor/gateway-registry.ts
16
+ // extensions/discord/src/monitor/gateway-registry.ts
17
17
  /**
18
18
  * Module-level registry of active Discord GatewayPlugin instances.
19
19
  * Bridges the gap between agent tool handlers (which only have REST access)
@@ -34,8 +34,7 @@ function getGateway(accountId) {
34
34
  function clearGateways() {
35
35
  gatewayRegistry.clear();
36
36
  }
37
- //#endregion
38
- //#region extensions/discord/src/client.ts
37
+ // extensions/discord/src/client.ts
39
38
  function createDiscordRuntimeAccountContext(params) {
40
39
  return {
41
40
  cfg: params.cfg,
@@ -78,7 +77,7 @@ function createDiscordRestClient(opts) {
78
77
  accountId: opts.accountId
79
78
  });
80
79
  const token = explicitToken ?? resolveToken(account);
81
- const { rest, signal, timeoutMs } = opts;
80
+ const { rest, signal, callerSignal, timeoutMs } = opts;
82
81
  if (rest) return {
83
82
  token,
84
83
  rest,
@@ -90,6 +89,7 @@ function createDiscordRestClient(opts) {
90
89
  rest: new RequestClient(token, {
91
90
  ...proxyFetch ? { fetch: proxyFetch } : {},
92
91
  ...signal ? { signal } : {},
92
+ ...callerSignal ? { callerSignal } : {},
93
93
  ...timeoutMs !== void 0 ? { timeout: timeoutMs } : {}
94
94
  }),
95
95
  account
@@ -107,7 +107,7 @@ function createDiscordClient(opts) {
107
107
  request: createDiscordRetryRunner({
108
108
  retry: opts.retry,
109
109
  verbose: opts.verbose,
110
- signal: opts.signal,
110
+ signal: opts.signal && opts.callerSignal ? AbortSignal.any([opts.signal, opts.callerSignal]) : opts.callerSignal ?? opts.signal,
111
111
  isGatewayDisconnected: () => {
112
112
  const gateway = getGateway(restAccount.accountId);
113
113
  return gateway !== void 0 && !gateway.isConnected;
@@ -119,8 +119,7 @@ function createDiscordClient(opts) {
119
119
  function resolveDiscordRest(opts) {
120
120
  return createDiscordRestClient(opts).rest;
121
121
  }
122
- //#endregion
123
- //#region extensions/discord/src/send.message-request.ts
122
+ // extensions/discord/src/send.message-request.ts
124
123
  const SUPPRESS_EMBEDS_FLAG = MessageFlags.SuppressEmbeds;
125
124
  const SUPPRESS_NOTIFICATIONS_FLAG = MessageFlags.SuppressNotifications;
126
125
  function createDiscordMessageNonce() {
@@ -162,8 +161,7 @@ function buildDiscordMessageRequest(params) {
162
161
  ...nonce ? { enforce_nonce: true } : {}
163
162
  };
164
163
  }
165
- //#endregion
166
- //#region extensions/discord/src/send.permissions.ts
164
+ // extensions/discord/src/send.permissions.ts
167
165
  const PERMISSION_ENTRIES = Object.entries(PermissionFlagsBits).filter(([, value]) => typeof value === "bigint");
168
166
  const ALL_PERMISSIONS = PERMISSION_ENTRIES.reduce((acc, [, value]) => acc | value, 0n);
169
167
  const ADMINISTRATOR_BIT = PermissionFlagsBits.Administrator;
@@ -380,8 +378,7 @@ async function fetchChannelPermissionsDiscord(channelId, opts) {
380
378
  channelType
381
379
  };
382
380
  }
383
- //#endregion
384
- //#region extensions/discord/src/send.types.ts
381
+ // extensions/discord/src/send.types.ts
385
382
  var DiscordSendError = class extends Error {
386
383
  constructor(message, opts) {
387
384
  super(message);
@@ -395,8 +392,7 @@ var DiscordSendError = class extends Error {
395
392
  const DISCORD_MAX_EMOJI_BYTES = 262144;
396
393
  const DISCORD_MAX_STICKER_BYTES = 524288;
397
394
  const DISCORD_MAX_EVENT_COVER_BYTES = 8388608;
398
- //#endregion
399
- //#region extensions/discord/src/send.shared.ts
395
+ // extensions/discord/src/send.shared.ts
400
396
  const DISCORD_TEXT_LIMIT = 2e3;
401
397
  const DISCORD_MAX_STICKERS = 3;
402
398
  const DISCORD_POLL_MAX_ANSWERS = 10;
@@ -585,5 +581,4 @@ function buildReactionIdentifier(emoji) {
585
581
  if (emoji.id && emoji.name) return `${emoji.name}:${emoji.id}`;
586
582
  return emoji.name ?? "";
587
583
  }
588
- //#endregion
589
584
  export { resolveDiscordSendEmbeds as A, unregisterGateway as B, hasAnyChannelPermissionDiscord as C, createDiscordMessageNonce as D, buildDiscordMessageRequest as E, resolveDiscordClientAccountContext as F, resolveDiscordRest as I, clearGateways as L, createDiscordClient as M, createDiscordRestClient as N, resolveDiscordMessageFlags as O, createDiscordRuntimeAccountContext as P, getGateway as R, hasAllGuildPermissionsDiscord as S, SUPPRESS_NOTIFICATIONS_FLAG as T, canManageGuildMemberRoleDiscord as _, normalizeEmojiName as a, fetchChannelPermissionsDiscord as b, resolveChannelId as c, sendDiscordChunks as d, sendDiscordMedia as f, DiscordSendError as g, DISCORD_MAX_STICKER_BYTES as h, normalizeDiscordPollInput as i, resolveDiscordSuppressEmbeds as j, resolveDiscordSendComponents as k, resolveDiscordChannel as l, DISCORD_MAX_EVENT_COVER_BYTES as m, buildDiscordTextChunks as n, normalizeReactionEmoji as o, DISCORD_MAX_EMOJI_BYTES as p, buildReactionIdentifier as r, normalizeStickerIds as s, buildDiscordSendError as t, resolveDiscordTargetChannelId as u, canManageGuildRoleDiscord as v, hasAnyGuildPermissionDiscord as w, fetchMemberGuildPermissionsDiscord as x, canViewDiscordGuildChannel as y, registerGateway as z };
@@ -1,6 +1,6 @@
1
- import { S as formatDiscordUserTag } from "./allow-list-C3j0qLDp.mjs";
1
+ import { S as formatDiscordUserTag } from "./allow-list-CkqpzPvP.mjs";
2
2
  import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
3
- //#region extensions/discord/src/monitor/sender-identity.ts
3
+ // extensions/discord/src/monitor/sender-identity.ts
4
4
  function resolveDiscordWebhookId(message) {
5
5
  return normalizeOptionalString(message.webhookId ?? message.webhook_id) ?? null;
6
6
  }
@@ -32,5 +32,4 @@ function resolveDiscordSenderIdentity(params) {
32
32
  isPluralKit: false
33
33
  };
34
34
  }
35
- //#endregion
36
35
  export { resolveDiscordWebhookId as n, resolveDiscordSenderIdentity as t };
@@ -1,6 +1,5 @@
1
- //#region extensions/discord/src/session-contract.ts
1
+ // extensions/discord/src/session-contract.ts
2
2
  function deriveLegacySessionChatType(sessionKey) {
3
3
  return /^discord:(?:[^:]+:)?guild-[^:]+:channel-[^:]+$/.test(sessionKey) ? "channel" : void 0;
4
4
  }
5
- //#endregion
6
5
  export { deriveLegacySessionChatType as t };
@@ -1,5 +1,5 @@
1
1
  import { normalizeLowercaseStringOrEmpty } from "openclaw/plugin-sdk/string-coerce-runtime";
2
- //#region extensions/discord/src/session-key-normalization.ts
2
+ // extensions/discord/src/session-key-normalization.ts
3
3
  function normalizeExplicitDiscordSessionKey(sessionKey, ctx) {
4
4
  let normalized = normalizeLowercaseStringOrEmpty(sessionKey);
5
5
  const chatType = normalizeLowercaseStringOrEmpty(ctx.ChatType);
@@ -13,5 +13,4 @@ function normalizeExplicitDiscordSessionKey(sessionKey, ctx) {
13
13
  const directId = senderId || fromDiscordId;
14
14
  return directId && directId === match[2] ? `${match[1]}discord:direct:${match[2]}` : normalized;
15
15
  }
16
- //#endregion
17
16
  export { normalizeExplicitDiscordSessionKey as t };
@@ -0,0 +1,2 @@
1
+ export { t as discordSetupPlugin } from "./channel.setup-BrGEJ0Ia.mjs";
2
+ import "../setup-plugin-api.js";
@@ -1,12 +1,12 @@
1
- import { c as resolveDefaultDiscordAccountId, f as resolveDiscordAccountDisabledReason, i as listDiscordAccountIds, l as resolveDiscordAccount, p as resolveDiscordAccountDmPolicy, r as isDiscordAccountEnabledForRuntime, s as mergeDiscordAccountConfig, u as resolveDiscordAccountAllowFrom } from "./accounts-C_25wyxC.mjs";
2
- import { t as inspectDiscordAccount } from "./account-inspect-DGkdWwix.mjs";
3
- import { t as parseDiscordTarget } from "./target-parsing-C-HyNxcE.mjs";
4
- import { n as discordIngressIdentity, t as selectDiscordLivePolicyConfig } from "./live-policy-config-y0Qy36X3.mjs";
5
- import { t as DiscordChannelConfigSchema } from "./config-schema-BNKN1cu5.mjs";
6
- import { n as normalizeCompatibilityConfig } from "./doctor-contract-Bwv8EuQ_.mjs";
7
- import { r as secretTargetRegistryEntries, t as collectRuntimeConfigAssignments } from "./secret-config-contract-B1kE4sDv.mjs";
8
- import { n as unsupportedSecretRefSurfacePatterns, t as collectUnsupportedSecretRefConfigCandidates } from "./security-contract-DNyyjTZZ.mjs";
9
- import { t as deriveLegacySessionChatType } from "./session-contract-BO5tlIdl.mjs";
1
+ import { c as resolveDefaultDiscordAccountId, f as resolveDiscordAccountDisabledReason, i as listDiscordAccountIds, l as resolveDiscordAccount, p as resolveDiscordAccountDmPolicy, r as isDiscordAccountEnabledForRuntime, s as mergeDiscordAccountConfig, u as resolveDiscordAccountAllowFrom } from "./accounts-DtjvhJUj.mjs";
2
+ import { t as inspectDiscordAccount } from "./account-inspect-CSz5Qodj.mjs";
3
+ import { t as parseDiscordTarget } from "./target-parsing-BiuhcK9Q.mjs";
4
+ import { n as discordIngressIdentity, t as selectDiscordLivePolicyConfig } from "./live-policy-config-DjIHWFla.mjs";
5
+ import { t as DiscordChannelConfigSchema } from "./config-schema-GX2yDgIH.mjs";
6
+ import { n as normalizeCompatibilityConfig } from "./doctor-contract-Dstl3cMg.mjs";
7
+ import { r as secretTargetRegistryEntries, t as collectRuntimeConfigAssignments } from "./secret-config-contract-CP6teHec.mjs";
8
+ import { n as unsupportedSecretRefSurfacePatterns, t as collectUnsupportedSecretRefConfigCandidates } from "./security-contract-D-o0iWDk.mjs";
9
+ import { t as deriveLegacySessionChatType } from "./session-contract-Bq71MS78.mjs";
10
10
  import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
11
11
  import { normalizeAccountId } from "openclaw/plugin-sdk/account-id";
12
12
  import { describeAccountSnapshot } from "openclaw/plugin-sdk/account-helpers";
@@ -17,7 +17,7 @@ import { createConditionalWarningCollector, createOpenProviderConfiguredRouteWar
17
17
  import { identityEntryAuthenticationClassifier } from "openclaw/plugin-sdk/channel-ingress-runtime";
18
18
  import { defineChannelSetupContract } from "openclaw/plugin-sdk/channel-setup";
19
19
  import { createEnvPatchedAccountSetupAdapter } from "openclaw/plugin-sdk/setup-runtime";
20
- //#region extensions/discord/src/security.ts
20
+ // extensions/discord/src/security.ts
21
21
  const resolveDiscordDmPolicy = createScopedDmSecurityResolver({
22
22
  channelKey: "discord",
23
23
  resolvePolicy: (account) => account.config.dmPolicy,
@@ -60,10 +60,9 @@ const discordSecurityAdapter = {
60
60
  severity: "warn",
61
61
  title: "Discord security warning"
62
62
  }),
63
- collectAuditFindings: async (params) => (await import("./security-audit-BFT84Uny.mjs").then((n) => n.n)).collectDiscordSecurityAuditFindings(params)
63
+ collectAuditFindings: async (params) => (await import("./security-audit-CTwisG7c.mjs").then((n) => n.n)).collectDiscordSecurityAuditFindings(params)
64
64
  };
65
- //#endregion
66
- //#region extensions/discord/src/setup-adapter.ts
65
+ // extensions/discord/src/setup-adapter.ts
67
66
  const discordSetupAdapter = createEnvPatchedAccountSetupAdapter({
68
67
  channelKey: "discord",
69
68
  defaultAccountOnlyEnvError: "DISCORD_BOT_TOKEN can only be used for the default account.",
@@ -93,11 +92,10 @@ const discordSetupContract = defineChannelSetupContract({
93
92
  },
94
93
  legacyAdapter: discordSetupAdapter
95
94
  });
96
- //#endregion
97
- //#region extensions/discord/src/shared.ts
95
+ // extensions/discord/src/shared.ts
98
96
  const DISCORD_CHANNEL = "discord";
99
97
  const livePolicyConfigPrefixes = Object.keys(selectDiscordLivePolicyConfig({})).flatMap((key) => [`channels.discord.${key}`, `channels.discord.accounts.*.${key}`]);
100
- const loadDiscordDoctorModule = createLazyRuntimeModule(() => import("./doctor-RqH-6JB0.mjs"));
98
+ const loadDiscordDoctorModule = createLazyRuntimeModule(() => import("./doctor-DBBXoP9w.mjs"));
101
99
  const discordDoctor = {
102
100
  dmAllowFromMode: "topOnly",
103
101
  groupModel: "route",
@@ -223,5 +221,4 @@ function createDiscordPluginBase(params) {
223
221
  }
224
222
  };
225
223
  }
226
- //#endregion
227
224
  export { discordSecurityAdapter as i, discordConfigAdapter as n, discordSetupContract as r, createDiscordPluginBase as t };