@openclaw/discord 2026.9.7 → 2026.10.1-beta.1

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 (147) hide show
  1. package/README.md +7 -0
  2. package/dist/.setup/{account-inspect-De8hOUxG.mjs → account-inspect-CjKqkDnH.mjs} +2 -2
  3. package/dist/.setup/{accounts-ChaMcixG.mjs → accounts-DXHCL8Zm.mjs} +9 -32
  4. package/dist/.setup/{active-turn-thread-route-fmHl1HNd.mjs → active-turn-thread-route-C4tp9noA.mjs} +5 -9
  5. package/dist/.setup/{activities-api-tvbsU2e3.mjs → activities-api-BL_hJ0JQ.mjs} +15 -18
  6. package/dist/.setup/{api-DVbJwZVt.mjs → api-_oznjffB.mjs} +1 -1
  7. package/dist/.setup/{approval-handler.runtime-DxCK2Rux.mjs → approval-handler.runtime-G-tMI_uD.mjs} +22 -61
  8. package/dist/.setup/{approval-message-updates-BKFqavHZ.mjs → approval-message-updates-CgRwc2_Q.mjs} +2 -2
  9. package/dist/.setup/{audit-CLg9I71N.mjs → audit-DtvzxONM.mjs} +4 -4
  10. package/dist/.setup/{channel-DxlUVU9t.mjs → channel-Ct3fRxet.mjs} +79 -75
  11. package/dist/.setup/{channel-access-C12aDZ0p.mjs → channel-access-BRp3Y-rF.mjs} +4 -17
  12. package/dist/.setup/{channel-type-DRCrEMss.mjs → channel-type-D1_b5UhU.mjs} +12 -16
  13. package/dist/.setup/{channel.setup-CRo1GjV7.mjs → channel.setup-DBJtugJO.mjs} +14 -34
  14. package/dist/.setup/{components-Cq1PvIpN.mjs → components-CzXLR3QH.mjs} +56 -72
  15. package/dist/.setup/{config-schema-oxELUSDx.mjs → config-schema-CsemBDpS.mjs} +6 -17
  16. package/dist/.setup/{conversation-binding-route-Caz_XuFH.mjs → conversation-binding-route-Bi62ApSt.mjs} +1 -1
  17. package/dist/.setup/{directory-config-esqNn0Eo.mjs → directory-config-BH1LA-gi.mjs} +1 -1
  18. package/dist/.setup/{directory-live-DtKRHuGV.mjs → directory-live-C9xz7IPm.mjs} +10 -13
  19. package/dist/.setup/{discord-0xJYfdDD.mjs → discord-J7aRzq2Q.mjs} +101 -381
  20. package/dist/.setup/{doctor-BCl1H5tl.mjs → doctor-DxSAngJq.mjs} +31 -70
  21. package/dist/.setup/doctor-contract-Bg3NPAMw.mjs +137 -0
  22. package/dist/.setup/{handle-action-CUvQWnE7.mjs → handle-action-DlmFX-_G.mjs} +10 -11
  23. package/dist/.setup/{handle-action.guild-admin-Df-8gVle.mjs → handle-action.guild-admin-BnyqTczR.mjs} +67 -129
  24. package/dist/.setup/{live-policy-config-8Pv20CHc.mjs → live-policy-config-emmPNyh4.mjs} +1 -1
  25. package/dist/.setup/{message-handler-B-Jk4oDk.mjs → message-handler-CDWDjWF0.mjs} +6 -6
  26. package/dist/.setup/{message-handler.preflight-v-__NSDq.mjs → message-handler.preflight-Cop4atEb.mjs} +13 -23
  27. package/dist/.setup/{message-handler.preflight-pluralkit-CWLUBVcx.mjs → message-handler.preflight-pluralkit-D1g3eq0B.mjs} +5 -8
  28. package/dist/.setup/{message-handler.process-BNFFuChn.mjs → message-handler.process-lX7pDqsd.mjs} +57 -96
  29. package/dist/.setup/{outbound-adapter-BobT-kse.mjs → outbound-adapter-BPq0c2wY.mjs} +11 -17
  30. package/dist/.setup/{outbound-session-route-zVGxxceg.mjs → outbound-session-route-DGPPKA0z.mjs} +21 -46
  31. package/dist/.setup/{presence-cache-Di3H3DIU.mjs → presence-cache-Dg3_dADn.mjs} +2 -4
  32. package/dist/.setup/{probe-LYrIHlBF.mjs → probe-DIRY8vh7.mjs} +17 -27
  33. package/dist/.setup/{provider-B_G5hASF.mjs → provider-DIexE7gK.mjs} +273 -446
  34. package/dist/.setup/{provider-session.runtime-BYlTBFD2.mjs → provider-session.runtime-C2UCZz8d.mjs} +3 -3
  35. package/dist/.setup/provider.runtime-Dkzrmmcm.mjs +2 -0
  36. package/dist/.setup/{realtime-session.runtime-oUd9DOcz.mjs → realtime-session.runtime-DvjyeY87.mjs} +6 -8
  37. package/dist/.setup/{receive-recovery-CHPOsnLc.mjs → receive-recovery-GqF2PUN_.mjs} +1 -4
  38. package/dist/.setup/{resolve-allowlist-common-DPdRggu5.mjs → resolve-allowlist-common-DUYRrrVB.mjs} +5 -9
  39. package/dist/.setup/{resolve-channels-BFPNRmVv.mjs → resolve-channels--MUatisx.mjs} +3 -3
  40. package/dist/.setup/{resolve-users-0-aBuCy3.mjs → resolve-users-CxLcDmM0.mjs} +6 -9
  41. package/dist/.setup/{retry-pz_cSha2.mjs → retry-BKzO25k4.mjs} +27 -51
  42. package/dist/.setup/{runtime-sUksZ--Q.mjs → runtime-CerRBfaa.mjs} +2 -2
  43. package/dist/.setup/{runtime-FN000lxA.mjs → runtime-CwUA0RLr.mjs} +228 -255
  44. package/dist/.setup/{runtime-doctor-migrations-CshUGl36.mjs → runtime-doctor-migrations-BPV-R4G9.mjs} +6 -0
  45. package/dist/.setup/{security-audit-Cdaegq7C.mjs → security-audit-D42cp5N7.mjs} +21 -48
  46. package/dist/.setup/{send-CrfEI6Bs.mjs → send-2X7m2Zmw.mjs} +45 -58
  47. package/dist/.setup/{send.components-DxQAMfES.mjs → send.components-RqvgmCs3.mjs} +44 -90
  48. package/dist/.setup/{send.outbound-BISKnb-a.mjs → send.outbound-B4QHSEzm.mjs} +60 -98
  49. package/dist/.setup/{send.shared-DGFkbkQR.mjs → send.shared-BQIUh6Vn.mjs} +13 -20
  50. package/dist/.setup/{sender-identity-B9X5Vb9R.mjs → sender-identity-CooeYfAn.mjs} +1 -1
  51. package/dist/.setup/{session-key-normalization-wJgsKPNF.mjs → session-key-normalization-CCHGNSQw.mjs} +3 -9
  52. package/dist/.setup/setup-plugin-api-nn_giXvZ.mjs +3 -0
  53. package/dist/.setup/{shared-B3wZ4hN-.mjs → shared-CIJn6AEC.mjs} +7 -7
  54. package/dist/.setup/{subagent-hooks-nlUE9ow7.mjs → subagent-hooks-BYlVnxzy.mjs} +4 -9
  55. package/dist/.setup/{system-events-CdeZnvPV.mjs → system-events-CQ3if_pS.mjs} +2 -2
  56. package/dist/.setup/{target-resolver-BuLapkhy.mjs → target-resolver-Dzxf80Y3.mjs} +5 -13
  57. package/dist/.setup/targets-Lf8D55w-.mjs +3 -0
  58. package/dist/.setup/{thread-bindings-D7TfgjR_.mjs → thread-bindings-yNNlcUWE.mjs} +5 -6
  59. package/dist/.setup/{thread-bindings.manager-DN-NissX.mjs → thread-bindings.manager-plk0zJAW.mjs} +14 -20
  60. package/dist/.setup/{thread-bindings.session-updates-CshfKghV.mjs → thread-bindings.session-updates-C9aKtVs6.mjs} +295 -5
  61. package/dist/.setup/{timeouts-D86uWLt_.mjs → timeouts-pun7VJ02.mjs} +2 -15
  62. package/dist/.setup/{transcripts-source-p8EV179h.mjs → transcripts-source-CNWswry-.mjs} +31 -79
  63. package/dist/.setup/typing-CNlSKY5S.mjs +11 -0
  64. package/dist/.setup/{voice-runtime-B46rcwrG.mjs → voice-runtime-CeS6zfY3.mjs} +62 -110
  65. package/dist/account-inspect-api.js +1 -1
  66. package/dist/action-runtime-api.js +1 -1
  67. package/dist/activities-api.js +1 -1
  68. package/dist/api.js +18 -18
  69. package/dist/channel-config-api.js +1 -1
  70. package/dist/channel-plugin-api.js +1 -1
  71. package/dist/control-ui/2afbdab1d3aa65a789d8a3eba666f4b1ec5df07073538fe30d6cf32093a1fb2d/index.js +1 -0
  72. package/dist/directory-contract-api.js +1 -1
  73. package/dist/doctor-contract-api.js +19 -128
  74. package/dist/index.js +1 -1
  75. package/dist/runtime-api.js +20 -21
  76. package/dist/security-audit-contract-api.js +1 -1
  77. package/dist/session-key-api.js +1 -1
  78. package/dist/setup-entry.js +1 -1
  79. package/dist/setup-plugin-api.js +1 -1
  80. package/dist/src/voice/audio-worker.runtime.js +6 -8
  81. package/dist/subagent-hooks-api.js +1 -1
  82. package/dist/transcripts-source-api.js +1 -1
  83. package/node_modules/libopus-wasm/CHANGELOG.md +8 -0
  84. package/node_modules/libopus-wasm/dist/discordjs.d.ts.map +1 -1
  85. package/node_modules/libopus-wasm/dist/discordjs.js +14 -2
  86. package/node_modules/libopus-wasm/dist/generated/libopus.generated.mjs +0 -0
  87. package/node_modules/libopus-wasm/dist/index.d.ts.map +1 -1
  88. package/node_modules/libopus-wasm/dist/index.js +55 -100
  89. package/node_modules/libopus-wasm/package.json +5 -5
  90. package/node_modules/undici/README.md +10 -1
  91. package/node_modules/undici/docs/docs/api/Agent.md +8 -8
  92. package/node_modules/undici/docs/docs/api/DiagnosticsChannel.md +9 -6
  93. package/node_modules/undici/docs/docs/api/Dispatcher.md +9 -0
  94. package/node_modules/undici/docs/docs/api/Errors.md +25 -0
  95. package/node_modules/undici/docs/docs/api/Fetch.md +10 -0
  96. package/node_modules/undici/docs/docs/api/Interceptors.md +4 -3
  97. package/node_modules/undici/docs/docs/api/Pool.md +5 -6
  98. package/node_modules/undici/docs/docs/index.md +10 -1
  99. package/node_modules/undici/lib/api/readable.js +1 -2
  100. package/node_modules/undici/lib/core/request.js +23 -2
  101. package/node_modules/undici/lib/core/util.js +0 -39
  102. package/node_modules/undici/lib/dispatcher/client-h1.js +11 -4
  103. package/node_modules/undici/lib/dispatcher/client-h2.js +52 -8
  104. package/node_modules/undici/lib/dispatcher/client.js +6 -1
  105. package/node_modules/undici/lib/dispatcher/env-http-proxy-agent.js +21 -6
  106. package/node_modules/undici/lib/dispatcher/pool-base.js +63 -2
  107. package/node_modules/undici/lib/dispatcher/pool.js +90 -7
  108. package/node_modules/undici/lib/dispatcher/proxy-agent.js +16 -3
  109. package/node_modules/undici/lib/handler/deduplication-handler.js +24 -11
  110. package/node_modules/undici/lib/handler/redirect-handler.js +5 -0
  111. package/node_modules/undici/lib/handler/retry-handler.js +72 -13
  112. package/node_modules/undici/lib/interceptor/cache.js +4 -1
  113. package/node_modules/undici/lib/interceptor/decompress.js +236 -69
  114. package/node_modules/undici/lib/web/cache/cache.js +17 -8
  115. package/node_modules/undici/lib/web/cache/cachestorage.js +11 -5
  116. package/node_modules/undici/lib/web/cookies/index.js +19 -7
  117. package/node_modules/undici/lib/web/cookies/util.js +3 -1
  118. package/node_modules/undici/lib/web/eventsource/eventsource.js +25 -1
  119. package/node_modules/undici/lib/web/fetch/body.js +22 -15
  120. package/node_modules/undici/lib/web/fetch/data-url.js +6 -6
  121. package/node_modules/undici/lib/web/fetch/formdata.js +30 -36
  122. package/node_modules/undici/lib/web/fetch/headers.js +34 -31
  123. package/node_modules/undici/lib/web/fetch/index.js +46 -25
  124. package/node_modules/undici/lib/web/fetch/request.js +74 -79
  125. package/node_modules/undici/lib/web/fetch/response.js +43 -44
  126. package/node_modules/undici/lib/web/fetch/util.js +7 -7
  127. package/node_modules/undici/lib/web/infra/index.js +16 -1
  128. package/node_modules/undici/lib/web/webidl/index.js +2 -14
  129. package/node_modules/undici/lib/web/websocket/connection.js +33 -12
  130. package/node_modules/undici/lib/web/websocket/events.js +43 -26
  131. package/node_modules/undici/lib/web/websocket/receiver.js +2 -0
  132. package/node_modules/undici/lib/web/websocket/stream/websocketerror.js +13 -10
  133. package/node_modules/undici/lib/web/websocket/stream/websocketstream.js +19 -4
  134. package/node_modules/undici/lib/web/websocket/websocket.js +44 -41
  135. package/node_modules/undici/package.json +1 -1
  136. package/node_modules/undici/types/diagnostics-channel.d.ts +2 -1
  137. package/node_modules/undici/types/interceptors.d.ts +1 -1
  138. package/node_modules/undici/types/webidl.d.ts +13 -7
  139. package/openclaw.plugin.json +6 -0
  140. package/package.json +12 -7
  141. package/dist/.setup/doctor-contract-CvvgwrrG.mjs +0 -409
  142. package/dist/.setup/model-picker-preference-primitives-BHT1LkR_.mjs +0 -37
  143. package/dist/.setup/provider.runtime-CUE3UxER.mjs +0 -2
  144. package/dist/.setup/setup-plugin-api-BQUBxbhe.mjs +0 -3
  145. package/dist/.setup/targets-0KUcEIYx.mjs +0 -3
  146. package/dist/.setup/thread-bindings.state-g6v9zAym.mjs +0 -331
  147. package/dist/.setup/typing-BiHCzBRu.mjs +0 -15
@@ -1,9 +1,9 @@
1
+ import { normalizeLowercaseStringOrEmpty, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
1
2
  import { ChannelType } from "discord-api-types/v10";
2
3
  import { asFiniteNumberInRange, parseDateStringTimestampMs, parseStrictFiniteNumber } from "openclaw/plugin-sdk/number-runtime";
3
4
  import { readResponseWithLimit } from "openclaw/plugin-sdk/response-limit-runtime";
4
5
  import { fetchWithSsrFGuard, isBlockedHostnameOrIp, isLoopbackHost } from "openclaw/plugin-sdk/ssrf-runtime";
5
- import { normalizeLowercaseStringOrEmpty, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
6
- import { buildChannelKeyCandidates, resolveChannelEntryMatchWithFallback, resolveChannelMatchConfig } from "openclaw/plugin-sdk/channel-targets";
6
+ import { buildChannelKeyCandidates, normalizeChannelSlug, resolveChannelEntryMatchWithFallback, resolveChannelMatchConfig } from "openclaw/plugin-sdk/channel-targets";
7
7
  import { resolveAllowlistMatchByCandidates } from "openclaw/plugin-sdk/allow-from";
8
8
  //#region extensions/discord/src/endpoint-runtime.ts
9
9
  const DISCORD_ENDPOINT_RESPONSE_MAX_BYTES = 8388608;
@@ -224,7 +224,7 @@ function normalizeDiscordAllowList(raw, prefixes) {
224
224
  };
225
225
  }
226
226
  function normalizeDiscordSlug(value) {
227
- return normalizeLowercaseStringOrEmpty(value).replace(/^#/, "").replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
227
+ return normalizeChannelSlug(value);
228
228
  }
229
229
  function normalizeDiscordDisplaySlug(value) {
230
230
  return normalizeLowercaseStringOrEmpty(value).normalize("NFC").replace(/^#/, "").replace(/[\s_]+/g, "-").replace(/[^\p{L}\p{M}\p{N}-]+/gu, "-").replace(/-{2,}/g, "-").replace(/^-+|-+$/g, "");
@@ -354,17 +354,13 @@ function resolveDiscordOwnerAccess(params) {
354
354
  }
355
355
  function resolveDiscordCommandAuthorized(params) {
356
356
  if (!params.isDirectMessage) return true;
357
- const allowList = normalizeDiscordAllowList(params.allowFrom, [
358
- "discord:",
359
- "user:",
360
- "pk:"
361
- ]);
362
- if (!allowList) return true;
363
- return allowListMatches(allowList, {
364
- id: params.author.id,
365
- name: params.author.username,
366
- tag: formatDiscordUserTag(params.author)
367
- }, { allowNameMatching: params.allowNameMatching });
357
+ return resolveDiscordUserAllowed({
358
+ allowList: params.allowFrom,
359
+ userId: params.author.id,
360
+ userName: params.author.username,
361
+ userTag: formatDiscordUserTag(params.author),
362
+ allowNameMatching: params.allowNameMatching
363
+ });
368
364
  }
369
365
  function resolveDiscordGuildEntry(params) {
370
366
  const guild = params.guild;
@@ -472,7 +468,7 @@ function isDiscordGroupAllowedByPolicy(params) {
472
468
  return params.groupPolicy !== "allowlist" || !params.channelAllowlistConfigured || params.channelAllowed;
473
469
  }
474
470
  function resolveDiscordChannelPolicyCommandAuthorizer(params) {
475
- const channelAllowlistConfigured = Boolean(params.guildInfo?.channels) && Object.keys(params.guildInfo?.channels ?? {}).length > 0;
471
+ const channelAllowlistConfigured = hasConfiguredDiscordChannels(params.guildInfo?.channels);
476
472
  return {
477
473
  configured: params.groupPolicy === "allowlist" && (Boolean(params.guildInfo) || channelAllowlistConfigured),
478
474
  allowed: isDiscordGroupAllowedByPolicy({
@@ -531,4 +527,4 @@ function isDiscordThreadChannelType(channelType) {
531
527
  return channelType === ChannelType.AnnouncementThread || channelType === ChannelType.PublicThread || channelType === ChannelType.PrivateThread;
532
528
  }
533
529
  //#endregion
534
- export { resolveDiscordSystemLocation as C, getDiscordEndpointRuntime as D, assertDiscordEndpointGatewayUrl as E, resolveDiscordEndpointAttachmentGuard as O, formatDiscordUserTag as S, parseDiscordRetryAfterBodySeconds as T, resolveDiscordOwnerAllowFrom as _, normalizeDiscordDisplaySlug as a, shouldEmitDiscordReactionNotification as b, resolveDiscordChannelConfig as c, resolveDiscordCommandAuthorized as d, resolveDiscordGuildEntry as f, resolveDiscordOwnerAccess as g, resolveDiscordMentionPolicy as h, normalizeDiscordAllowList as i, resolveDiscordEndpointMediaGuard as k, resolveDiscordChannelConfigWithFallback as l, resolveDiscordMemberAllowed as m, allowListMatches as n, normalizeDiscordSlug as o, resolveDiscordMemberAccessState as p, isDiscordGroupAllowedByPolicy as r, resolveDiscordAllowListMatch as s, isDiscordThreadChannelType as t, resolveDiscordChannelPolicyCommandAuthorizer as u, resolveDiscordShouldRequireMention as v, resolveTimestampMs as w, formatDiscordReactionEmoji as x, resolveGroupDmAllow as y };
530
+ export { resolveDiscordEndpointMediaGuard as A, formatDiscordUserTag as C, assertDiscordEndpointGatewayUrl as D, parseDiscordRetryAfterBodySeconds as E, getDiscordEndpointRuntime as O, formatDiscordReactionEmoji as S, resolveTimestampMs as T, resolveDiscordOwnerAccess as _, normalizeDiscordAllowList as a, resolveGroupDmAllow as b, resolveDiscordAllowListMatch as c, resolveDiscordChannelPolicyCommandAuthorizer as d, resolveDiscordCommandAuthorized as f, resolveDiscordMentionPolicy as g, resolveDiscordMemberAllowed as h, isDiscordGroupAllowedByPolicy as i, resolveDiscordEndpointAttachmentGuard as k, resolveDiscordChannelConfig as l, resolveDiscordMemberAccessState as m, allowListMatches as n, normalizeDiscordDisplaySlug as o, resolveDiscordGuildEntry as p, hasConfiguredDiscordChannels as r, normalizeDiscordSlug as s, isDiscordThreadChannelType as t, resolveDiscordChannelConfigWithFallback as u, resolveDiscordOwnerAllowFrom as v, resolveDiscordSystemLocation as w, shouldEmitDiscordReactionNotification as x, resolveDiscordShouldRequireMention as y };
@@ -1,9 +1,9 @@
1
- import { _ as inspectDiscordAccountTokenState, h as resolveDiscordToken, l as resolveDiscordAccountAllowFrom, o as mergeDiscordAccountConfig, s as resolveDefaultDiscordAccountId, u as resolveDiscordAccountConfig } from "./accounts-ChaMcixG.mjs";
2
- import { i as discordSetupContract, t as createDiscordPluginBase } from "./shared-B3wZ4hN-.mjs";
3
- import { t as resolveDiscordChannelAllowlist } from "./resolve-channels-BFPNRmVv.mjs";
4
- import { t as resolveDiscordUserAllowlist } from "./resolve-users-0-aBuCy3.mjs";
5
- import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "openclaw/plugin-sdk/account-id";
1
+ import { _ as inspectDiscordAccountTokenState, h as resolveDiscordToken, l as resolveDiscordAccountAllowFrom, o as mergeDiscordAccountConfig, s as resolveDefaultDiscordAccountId, u as resolveDiscordAccountConfig } from "./accounts-DXHCL8Zm.mjs";
2
+ import { i as discordSetupContract, t as createDiscordPluginBase } from "./shared-CIJn6AEC.mjs";
3
+ import { t as resolveDiscordChannelAllowlist } from "./resolve-channels--MUatisx.mjs";
4
+ import { t as resolveDiscordUserAllowlist } from "./resolve-users-CxLcDmM0.mjs";
6
5
  import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
6
+ import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "openclaw/plugin-sdk/account-id";
7
7
  import { resolveBasicAllowFromEntries } from "openclaw/plugin-sdk/allow-from";
8
8
  import { createAccountScopedAllowFromSection, createAccountScopedGroupAccessSection, createSetupTranslator, createStandardChannelSetupStatus, defineTokenCredential, parseMentionOrPrefixedId, patchChannelConfigForAccount, promptResolvedAllowFrom, resolveEntriesWithOptionalToken, resolveSetupAccountId, setSetupChannelEnabled, splitSetupEntries } from "openclaw/plugin-sdk/setup-runtime";
9
9
  import { formatDocsLink } from "openclaw/plugin-sdk/setup-tools";
@@ -197,16 +197,6 @@ function createDiscordSetupWizardBase(handlers) {
197
197
  //#region extensions/discord/src/setup-surface.ts
198
198
  const t = createSetupTranslator();
199
199
  const channel = "discord";
200
- async function resolveDiscordAllowFromEntries(params) {
201
- return await resolveBasicAllowFromEntries({
202
- token: params.token,
203
- entries: params.entries,
204
- resolveEntries: async ({ token, entries }) => await resolveDiscordUserAllowlist({
205
- token,
206
- entries
207
- })
208
- });
209
- }
210
200
  async function promptDiscordAllowFrom(params) {
211
201
  const accountId = resolveSetupAccountId({
212
202
  accountId: params.accountId,
@@ -239,14 +229,11 @@ async function promptDiscordAllowFrom(params) {
239
229
  parseInputs: splitSetupEntries,
240
230
  parseId: parseDiscordAllowFromId,
241
231
  invalidWithoutTokenNote: t("wizard.discord.allowFromInvalidWithoutToken"),
242
- resolveEntries: async ({ token, entries }) => (await resolveDiscordUserAllowlist({
232
+ resolveEntries: async ({ token, entries }) => await resolveBasicAllowFromEntries({
243
233
  token,
244
- entries
245
- })).map((entry) => ({
246
- input: entry.input,
247
- resolved: entry.resolved,
248
- id: entry.id ?? null
249
- }))
234
+ entries,
235
+ resolveEntries: resolveDiscordUserAllowlist
236
+ })
250
237
  });
251
238
  return patchChannelConfigForAccount({
252
239
  cfg: params.cfg,
@@ -269,24 +256,17 @@ async function resolveDiscordGroupAllowlist(params) {
269
256
  input,
270
257
  resolved: false
271
258
  }),
272
- resolveEntries: async ({ token, entries }) => await resolveDiscordChannelAllowlist({
273
- token,
274
- entries
275
- })
259
+ resolveEntries: resolveDiscordChannelAllowlist
276
260
  });
277
261
  }
278
262
  const discordSetupWizard = createDiscordSetupWizardBase({
279
263
  promptAllowFrom: promptDiscordAllowFrom,
280
- resolveAllowFromEntries: async ({ cfg, accountId, credentialValues, entries }) => await resolveDiscordAllowFromEntries({
264
+ resolveAllowFromEntries: async ({ cfg, accountId, credentialValues, entries }) => await resolveBasicAllowFromEntries({
281
265
  token: resolveDiscordToken(cfg, { accountId }).token || (typeof credentialValues.token === "string" ? credentialValues.token : ""),
282
- entries
266
+ entries,
267
+ resolveEntries: resolveDiscordUserAllowlist
283
268
  }),
284
- resolveGroupAllowlist: async ({ cfg, accountId, credentialValues, entries }) => await resolveDiscordGroupAllowlist({
285
- cfg,
286
- accountId,
287
- credentialValues,
288
- entries
289
- })
269
+ resolveGroupAllowlist: resolveDiscordGroupAllowlist
290
270
  });
291
271
  //#endregion
292
272
  //#region extensions/discord/src/channel.setup.ts
@@ -1,8 +1,8 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.mjs";
2
- import { B as Container, F as RadioGroup, G as RoleSelectMenu, H as LinkButton, I as TextInput, J as Separator, K as Row, L as AnySelectMenu, M as CheckboxGroup, N as Label, P as Modal, Q as UserSelectMenu, R as Button, U as MediaGallery, V as File, W as MentionableSelectMenu, X as TextDisplay, Y as StringSelectMenu, Z as Thumbnail, et as parseCustomId, q as Section, z as ChannelSelectMenu } from "./discord-0xJYfdDD.mjs";
2
+ import { B as Container, F as RadioGroup, G as RoleSelectMenu, H as LinkButton, I as TextInput, J as Separator, K as Row, L as AnySelectMenu, M as CheckboxGroup, N as Label, P as Modal, Q as UserSelectMenu, R as Button, U as MediaGallery, V as File, W as MentionableSelectMenu, X as TextDisplay, Y as StringSelectMenu, Z as Thumbnail, et as parseCustomId, q as Section, tt as stripUndefinedFields, z as ChannelSelectMenu } from "./discord-J7aRzq2Q.mjs";
3
+ import { asOptionalRecord, normalizeLowercaseStringOrEmpty, normalizeOptionalString, readNonBlankString } from "openclaw/plugin-sdk/string-coerce-runtime";
3
4
  import { ButtonStyle, MessageFlags, TextInputStyle } from "discord-api-types/v10";
4
5
  import crypto from "node:crypto";
5
- import { normalizeLowercaseStringOrEmpty, normalizeOptionalString, readNonBlankString } from "openclaw/plugin-sdk/string-coerce-runtime";
6
6
  import { legacyInteractiveReplyToPresentation, resolveMessagePresentationActionValue, resolveMessagePresentationButtonAction, resolveMessagePresentationOptionAction } from "openclaw/plugin-sdk/interactive-runtime";
7
7
  import { resolveAskUserQuestionOptionIndex } from "openclaw/plugin-sdk/reply-payload";
8
8
  import { buildApprovalResolutionRef } from "openclaw/plugin-sdk/approval-reference-runtime";
@@ -86,20 +86,17 @@ function parseDiscordComponentCustomId(id) {
86
86
  const parsed = parseCustomId(id);
87
87
  if (parsed.key !== "occomp") return null;
88
88
  const data = decodeParsedCustomIdData(parsed.data);
89
- const componentId = data.cid;
90
- if (typeof componentId !== "string" || !componentId.trim()) return null;
91
- const modalId = data.mid;
89
+ const componentId = readNonBlankString(data.cid);
90
+ if (!componentId) return null;
92
91
  return {
93
92
  componentId,
94
- modalId: typeof modalId === "string" && modalId.trim() ? modalId : void 0
93
+ modalId: readNonBlankString(data.mid)
95
94
  };
96
95
  }
97
96
  function parseDiscordModalCustomId(id) {
98
97
  const parsed = parseCustomId(id);
99
98
  if (parsed.key !== "ocmodal") return null;
100
- const modalId = decodeParsedCustomIdData(parsed.data).mid;
101
- if (typeof modalId !== "string" || !modalId.trim()) return null;
102
- return modalId;
99
+ return readNonBlankString(decodeParsedCustomIdData(parsed.data).mid) ?? null;
103
100
  }
104
101
  function isDiscordComponentWildcardRegistrationId(id) {
105
102
  return /^__openclaw_discord_component_[a-z_]+_wildcard__$/.test(id);
@@ -127,8 +124,9 @@ function parseDiscordModalCustomIdForInteraction(id) {
127
124
  const DISCORD_COMPONENT_ATTACHMENT_PREFIX = "attachment://";
128
125
  const BLOCK_ALIASES = /* @__PURE__ */ new Map([["row", "actions"], ["action-row", "actions"]]);
129
126
  function requireObject(value, label) {
130
- if (!value || typeof value !== "object" || Array.isArray(value)) throw new Error(`${label} must be an object`);
131
- return value;
127
+ const record = asOptionalRecord(value);
128
+ if (!record) throw new Error(`${label} must be an object`);
129
+ return record;
132
130
  }
133
131
  function readRequiredString(value, label, trim = true) {
134
132
  if (typeof value !== "string") throw new Error(`${label} must be a string`);
@@ -150,14 +148,14 @@ function readOptionalStringArray(value, label) {
150
148
  }
151
149
  function readOptionalInteger(value, label, bounds) {
152
150
  if (value == null) return;
153
- if (typeof value !== "number" || !Number.isFinite(value) || !Number.isInteger(value)) throw new Error(`${label} must be an integer`);
151
+ if (typeof value !== "number" || !Number.isInteger(value)) throw new Error(`${label} must be an integer`);
154
152
  if (bounds?.min !== void 0 && value < bounds.min) throw new Error(`${label} must be at least ${bounds.min}`);
155
153
  if (bounds?.max !== void 0 && value > bounds.max) throw new Error(`${label} must be at most ${bounds.max}`);
156
154
  return value;
157
155
  }
158
156
  function readOptionalEmoji(value, label) {
159
- if (!value || typeof value !== "object" || Array.isArray(value)) return;
160
- const obj = value;
157
+ const obj = asOptionalRecord(value);
158
+ if (!obj) return;
161
159
  return {
162
160
  name: readRequiredString(obj.name, `${label}.name`),
163
161
  id: normalizeOptionalString(obj.id),
@@ -165,9 +163,7 @@ function readOptionalEmoji(value, label) {
165
163
  };
166
164
  }
167
165
  function normalizeModalFieldName(value, index) {
168
- const trimmed = value?.trim();
169
- if (trimmed) return trimmed;
170
- return `field_${index + 1}`;
166
+ return value?.trim() || `field_${index + 1}`;
171
167
  }
172
168
  function readAttachmentName(value, label, filenameLabel = "a filename") {
173
169
  const trimmed = value.trim();
@@ -209,7 +205,7 @@ function parseButtonSpec(raw, label) {
209
205
  const obj = requireObject(raw, label);
210
206
  const style = normalizeOptionalString(obj.style);
211
207
  const url = normalizeOptionalString(obj.url);
212
- if ((style === "link" || url) && !url) throw new Error(`${label}.url is required for link buttons`);
208
+ if (style === "link" && !url) throw new Error(`${label}.url is required for link buttons`);
213
209
  return {
214
210
  label: readRequiredString(obj.label, `${label}.label`),
215
211
  style,
@@ -334,15 +330,11 @@ function parseComponentBlock(raw, label) {
334
330
  }
335
331
  case "separator": {
336
332
  const spacingRaw = obj.spacing;
337
- let spacing;
338
- if (spacingRaw === "small" || spacingRaw === "large") spacing = spacingRaw;
339
- else if (spacingRaw === 1 || spacingRaw === 2) spacing = spacingRaw;
340
- else if (spacingRaw !== void 0) throw new Error(`${label}.spacing must be "small", "large", 1, or 2`);
341
- const divider = typeof obj.divider === "boolean" ? obj.divider : void 0;
333
+ if (spacingRaw !== void 0 && spacingRaw !== "small" && spacingRaw !== "large" && spacingRaw !== 1 && spacingRaw !== 2) throw new Error(`${label}.spacing must be "small", "large", 1, or 2`);
342
334
  return {
343
335
  type: "separator",
344
- spacing,
345
- divider
336
+ spacing: spacingRaw,
337
+ divider: typeof obj.divider === "boolean" ? obj.divider : void 0
346
338
  };
347
339
  }
348
340
  case "actions": {
@@ -413,12 +405,13 @@ function readDiscordComponentSpec(raw) {
413
405
  fields
414
406
  };
415
407
  }
408
+ const container = asOptionalRecord(obj.container);
416
409
  return {
417
410
  text: readNonBlankString(obj.text),
418
411
  reusable: typeof obj.reusable === "boolean" ? obj.reusable : void 0,
419
- container: typeof obj.container === "object" && obj.container && !Array.isArray(obj.container) ? {
420
- accentColor: obj.container.accentColor,
421
- spoiler: typeof obj.container.spoiler === "boolean" ? obj.container.spoiler : void 0
412
+ container: container ? {
413
+ accentColor: container.accentColor,
414
+ spoiler: typeof container.spoiler === "boolean" ? container.spoiler : void 0
422
415
  } : void 0,
423
416
  blocks,
424
417
  modal
@@ -469,11 +462,6 @@ function createDiscordSelectMenu(type, customId, options) {
469
462
  if (select instanceof StringSelectMenu) select.options = options ?? [];
470
463
  return select;
471
464
  }
472
- function buildTextDisplays(text, texts) {
473
- if (texts && texts.length > 0) return texts.map((entry) => new TextDisplay(entry));
474
- if (text) return [new TextDisplay(text)];
475
- return [];
476
- }
477
465
  function createButtonComponent(params) {
478
466
  const style = mapButtonStyle(params.spec.style);
479
467
  if (style === ButtonStyle.Link || Boolean(params.spec.url)) {
@@ -509,16 +497,16 @@ function createButtonComponent(params) {
509
497
  if (internalCustomId) return { component: new DynamicButton() };
510
498
  return {
511
499
  component: new DynamicButton(),
512
- entry: {
500
+ entry: stripUndefinedFields({
513
501
  id: componentId,
514
502
  kind: params.modalId ? "modal-trigger" : "button",
515
503
  label: params.spec.label,
516
- ...params.spec.callbackData !== void 0 ? { callbackData: params.spec.callbackData } : {},
517
- ...params.spec.callbackDataKind !== void 0 ? { callbackDataKind: params.spec.callbackDataKind } : {},
518
- ...params.modalId !== void 0 ? { modalId: params.modalId } : {},
519
- ...params.spec.reusable !== void 0 ? { reusable: params.spec.reusable } : {},
520
- ...params.spec.allowedUsers !== void 0 ? { allowedUsers: params.spec.allowedUsers } : {}
521
- }
504
+ callbackData: params.spec.callbackData,
505
+ callbackDataKind: params.spec.callbackDataKind,
506
+ modalId: params.modalId,
507
+ reusable: params.spec.reusable,
508
+ allowedUsers: params.spec.allowedUsers
509
+ })
522
510
  };
523
511
  }
524
512
  function createSelectComponent(params) {
@@ -534,7 +522,7 @@ function createSelectComponent(params) {
534
522
  select.disabled = false;
535
523
  return {
536
524
  component: select,
537
- entry: {
525
+ entry: stripUndefinedFields({
538
526
  id: componentId,
539
527
  kind: "select",
540
528
  label: params.spec.placeholder ?? {
@@ -544,22 +532,21 @@ function createSelectComponent(params) {
544
532
  mentionable: "mentionable select",
545
533
  channel: "channel select"
546
534
  }[type],
547
- ...params.spec.callbackData !== void 0 ? { callbackData: params.spec.callbackData } : {},
548
- ...params.spec.callbackDataKind !== void 0 ? { callbackDataKind: params.spec.callbackDataKind } : {},
535
+ callbackData: params.spec.callbackData,
536
+ callbackDataKind: params.spec.callbackDataKind,
549
537
  selectType: type,
550
- ...type === "string" ? { options: options.map((option) => ({
538
+ options: type === "string" ? options.map((option) => ({
551
539
  value: option.value,
552
540
  label: option.label
553
- })) } : {},
554
- ...params.spec.allowedUsers !== void 0 ? { allowedUsers: params.spec.allowedUsers } : {}
555
- }
541
+ })) : void 0,
542
+ allowedUsers: params.spec.allowedUsers
543
+ })
556
544
  };
557
545
  }
558
546
  function buildDiscordComponentMessage(params) {
559
547
  const entries = [];
560
548
  const consumptionGroupId = createShortId("grp_");
561
549
  const modals = [];
562
- const components = [];
563
550
  const containerChildren = [];
564
551
  const addEntry = (entry) => {
565
552
  const reusable = entry.reusable ?? params.spec.reusable;
@@ -580,7 +567,7 @@ function buildDiscordComponentMessage(params) {
580
567
  continue;
581
568
  }
582
569
  if (block.type === "section") {
583
- const displays = buildTextDisplays(block.text, block.texts);
570
+ const displays = (block.texts?.length ? block.texts : block.text ? [block.text] : []).map((entry) => new TextDisplay(entry));
584
571
  if (displays.length > 3) throw new Error("Section blocks support up to 3 text displays");
585
572
  let accessory;
586
573
  if (block.accessory?.type === "thumbnail") accessory = new Thumbnail(block.accessory.url);
@@ -626,32 +613,32 @@ function buildDiscordComponentMessage(params) {
626
613
  }
627
614
  if (params.spec.modal) {
628
615
  const modalId = createShortId("mdl_");
629
- const fields = params.spec.modal.fields.map((field, index) => ({
616
+ const fields = params.spec.modal.fields.map((field, index) => stripUndefinedFields({
630
617
  id: createShortId("fld_"),
631
618
  name: normalizeModalFieldName(field.name, index),
632
619
  label: field.label,
633
620
  type: field.type,
634
- ...field.description !== void 0 ? { description: field.description } : {},
635
- ...field.placeholder !== void 0 ? { placeholder: field.placeholder } : {},
636
- ...field.required !== void 0 ? { required: field.required } : {},
637
- ...field.options !== void 0 ? { options: field.options } : {},
638
- ...field.minValues !== void 0 ? { minValues: field.minValues } : {},
639
- ...field.maxValues !== void 0 ? { maxValues: field.maxValues } : {},
640
- ...field.minLength !== void 0 ? { minLength: field.minLength } : {},
641
- ...field.maxLength !== void 0 ? { maxLength: field.maxLength } : {},
642
- ...field.style !== void 0 ? { style: field.style } : {}
621
+ description: field.description,
622
+ placeholder: field.placeholder,
623
+ required: field.required,
624
+ options: field.options,
625
+ minValues: field.minValues,
626
+ maxValues: field.maxValues,
627
+ minLength: field.minLength,
628
+ maxLength: field.maxLength,
629
+ style: field.style
643
630
  }));
644
- modals.push({
631
+ modals.push(stripUndefinedFields({
645
632
  id: modalId,
646
633
  title: params.spec.modal.title,
647
634
  fields,
648
- ...params.spec.modal.callbackData !== void 0 ? { callbackData: params.spec.modal.callbackData } : {},
649
- ...params.sessionKey !== void 0 ? { sessionKey: params.sessionKey } : {},
650
- ...params.agentId !== void 0 ? { agentId: params.agentId } : {},
651
- ...params.accountId !== void 0 ? { accountId: params.accountId } : {},
652
- ...params.spec.reusable !== void 0 ? { reusable: params.spec.reusable } : {},
653
- ...params.spec.modal.allowedUsers !== void 0 ? { allowedUsers: params.spec.modal.allowedUsers } : {}
654
- });
635
+ callbackData: params.spec.modal.callbackData,
636
+ sessionKey: params.sessionKey,
637
+ agentId: params.agentId,
638
+ accountId: params.accountId,
639
+ reusable: params.spec.reusable,
640
+ allowedUsers: params.spec.modal.allowedUsers
641
+ }));
655
642
  const { component, entry } = createButtonComponent({
656
643
  spec: {
657
644
  label: params.spec.modal.triggerLabel ?? "Open form",
@@ -667,11 +654,10 @@ function buildDiscordComponentMessage(params) {
667
654
  }
668
655
  if (containerChildren.length === 0) throw new Error("components must include at least one block, text, or modal trigger");
669
656
  const container = new Container(containerChildren, params.spec.container);
670
- components.push(container);
671
657
  const consumptionGroupEntryIds = entries.map((entry) => entry.id);
672
658
  for (const entry of entries) entry.consumptionGroupEntryIds = consumptionGroupEntryIds;
673
659
  return {
674
- components,
660
+ components: [container],
675
661
  entries,
676
662
  modals
677
663
  };
@@ -818,12 +804,10 @@ function parseExecApprovalData(data) {
818
804
  }
819
805
  //#endregion
820
806
  //#region extensions/discord/src/question-custom-id.ts
821
- const DISCORD_QUESTION_CUSTOM_ID_MAX_CHARS = 100;
822
807
  const QUESTION_RECORD_ID_PATTERN = /^ask_[a-f0-9]{32}$/u;
823
808
  function buildDiscordQuestionCustomId(callback) {
824
809
  if (!QUESTION_RECORD_ID_PATTERN.test(callback.questionId) || !Number.isInteger(callback.optionIndex) || callback.optionIndex < 0 || callback.optionIndex > 3) return;
825
- const customId = `ocq:id=${callback.questionId};i=${callback.optionIndex}`;
826
- return customId.length <= DISCORD_QUESTION_CUSTOM_ID_MAX_CHARS ? customId : void 0;
810
+ return `ocq:id=${callback.questionId};i=${callback.optionIndex}`;
827
811
  }
828
812
  function parseDiscordQuestionData(data) {
829
813
  const questionId = typeof data.id === "string" ? data.id : "";
@@ -1,9 +1,9 @@
1
- import { t as runtime_doctor_migrations_exports } from "./runtime-doctor-migrations-CshUGl36.mjs";
2
- import { normalizeLegacyDmAliases } from "openclaw/plugin-sdk/channel-config-helpers";
1
+ import { t as runtime_doctor_migrations_exports } from "./runtime-doctor-migrations-BPV-R4G9.mjs";
3
2
  import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
3
+ import { normalizeLegacyDmAliases } from "openclaw/plugin-sdk/channel-config-helpers";
4
4
  import { buildSecretInputSchema, registerSensitiveConfigSchema } from "openclaw/plugin-sdk/secret-input";
5
5
  import { createChannelConfigUiHints } from "openclaw/plugin-sdk/channel-core";
6
- import { ChannelBotLoopProtectionSchema, ChannelDangerouslyAllowNameMatchingSchema, ChannelPreviewStreamingConfigSchema, ChannelStreamingProgressSchema, ProviderCommandsSchema, TtsConfigSchema, buildChannelAccountSchemaParts, buildChannelAllowBotsSchema, buildChannelConfigSchema, buildChannelExecApprovalsSchema, buildChannelReactionShape, buildGroupEntrySchema, refineChannelDmPolicy } from "openclaw/plugin-sdk/channel-config-schema";
6
+ import { ChannelBotLoopProtectionSchema, ChannelDangerouslyAllowNameMatchingSchema, ChannelPreviewStreamingConfigSchema, ChannelThreadBindingsSchema, ProviderCommandsSchema, TtsConfigSchema, buildChannelAccountSchemaParts, buildChannelAllowBotsSchema, buildChannelConfigSchema, buildChannelExecApprovalsSchema, buildChannelReactionShape, buildGroupEntrySchema, refineChannelDmPolicy } from "openclaw/plugin-sdk/channel-config-schema";
7
7
  import { z } from "zod";
8
8
  //#region extensions/discord/src/config-ui-hints.ts
9
9
  const discordChannelConfigUiHints = {
@@ -334,7 +334,6 @@ const discordChannelConfigUiHints = {
334
334
  //#endregion
335
335
  //#region extensions/discord/src/config-schema.ts
336
336
  const SecretInputSchema = buildSecretInputSchema();
337
- const DiscordPreviewStreamingConfigSchema = ChannelPreviewStreamingConfigSchema.extend({ progress: ChannelStreamingProgressSchema.optional() }).strict();
338
337
  const DiscordIdSchema = z.union([z.string(), z.number()]).transform((value, ctx) => {
339
338
  if (typeof value === "number") {
340
339
  if (!Number.isSafeInteger(value) || value < 0) {
@@ -407,15 +406,11 @@ const DiscordGuildSchema = buildGroupEntrySchema({
407
406
  "allowFrom",
408
407
  "systemPrompt"
409
408
  ] });
410
- const DiscordVoiceAutoJoinSchema = z.object({
411
- guildId: z.string().min(1),
412
- channelId: z.string().min(1),
413
- whenOccupied: z.boolean().optional()
414
- }).strict();
415
409
  const DiscordVoiceAllowedChannelSchema = z.object({
416
410
  guildId: z.string().min(1),
417
411
  channelId: z.string().min(1)
418
412
  }).strict();
413
+ const DiscordVoiceAutoJoinSchema = DiscordVoiceAllowedChannelSchema.extend({ whenOccupied: z.boolean().optional() });
419
414
  const DiscordVoiceRealtimeToolPolicySchema = z.enum([
420
415
  "safe-read-only",
421
416
  "owner",
@@ -478,7 +473,7 @@ const DiscordVoiceSchema = z.object({
478
473
  const { accountShape, rootPolicyShape } = buildChannelAccountSchemaParts({
479
474
  omit: ["groupAllowFrom"],
480
475
  allowFrom: DiscordIdListSchema.optional(),
481
- streaming: DiscordPreviewStreamingConfigSchema.optional()
476
+ streaming: ChannelPreviewStreamingConfigSchema.optional()
482
477
  });
483
478
  const DiscordAccountSchemaBase = z.object({
484
479
  ...accountShape,
@@ -527,13 +522,7 @@ const DiscordAccountSchemaBase = z.object({
527
522
  ttlMs: z.number().int().positive().max(864e5).optional()
528
523
  }).strict().optional(),
529
524
  slashCommand: z.object({ ephemeral: z.boolean().optional() }).strict().optional(),
530
- threadBindings: z.object({
531
- enabled: z.boolean().optional(),
532
- idleHours: z.number().nonnegative().optional(),
533
- maxAgeHours: z.number().nonnegative().optional(),
534
- spawnSessions: z.boolean().optional(),
535
- defaultSpawnContext: z.enum(["isolated", "fork"]).optional()
536
- }).strict().optional(),
525
+ threadBindings: ChannelThreadBindingsSchema.optional(),
537
526
  intents: z.object({
538
527
  messageContent: z.boolean().optional(),
539
528
  presence: z.boolean().optional(),
@@ -1,4 +1,4 @@
1
- import { m as shouldIgnoreStaleDiscordRouteBinding } from "./outbound-session-route-zVGxxceg.mjs";
1
+ import { m as shouldIgnoreStaleDiscordRouteBinding } from "./outbound-session-route-DGPPKA0z.mjs";
2
2
  import { logVerbose } from "openclaw/plugin-sdk/runtime-env";
3
3
  import { resolveConfiguredBindingRoute, resolveRuntimeConversationBindingRoute } from "openclaw/plugin-sdk/conversation-binding-runtime";
4
4
  //#region extensions/discord/src/monitor/conversation-binding-route.ts
@@ -1,5 +1,5 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.mjs";
2
- import { l as resolveDiscordAccountAllowFrom, o as mergeDiscordAccountConfig, s as resolveDefaultDiscordAccountId } from "./accounts-ChaMcixG.mjs";
2
+ import { l as resolveDiscordAccountAllowFrom, o as mergeDiscordAccountConfig, s as resolveDefaultDiscordAccountId } from "./accounts-DXHCL8Zm.mjs";
3
3
  import { normalizeAccountId } from "openclaw/plugin-sdk/account-id";
4
4
  import { createResolvedDirectoryEntriesLister } from "openclaw/plugin-sdk/directory-config-runtime";
5
5
  //#region extensions/discord/src/directory-config.ts
@@ -1,19 +1,16 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.mjs";
2
- import { o as normalizeDiscordSlug } from "./channel-type-DRCrEMss.mjs";
3
- import { c as resolveDiscordAccount, m as normalizeDiscordToken } from "./accounts-ChaMcixG.mjs";
4
- import { r as fetchDiscord, t as DISCORD_DIRECTORY_LOOKUP_TIMEOUT_MS } from "./api-DVbJwZVt.mjs";
5
- import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "openclaw/plugin-sdk/routing";
2
+ import { s as normalizeDiscordSlug } from "./channel-type-D1_b5UhU.mjs";
3
+ import { c as resolveDiscordAccount, m as normalizeDiscordToken } from "./accounts-DXHCL8Zm.mjs";
4
+ import { r as fetchDiscord, t as DISCORD_DIRECTORY_LOOKUP_TIMEOUT_MS } from "./api-_oznjffB.mjs";
6
5
  import { normalizeLowercaseStringOrEmpty, normalizeOptionalLowercaseString, normalizeOptionalString, normalizeOptionalStringifiedId } from "openclaw/plugin-sdk/string-coerce-runtime";
6
+ import { normalizeAccountId } from "openclaw/plugin-sdk/routing";
7
7
  //#region extensions/discord/src/directory-cache-state.ts
8
8
  const discordDirectoryCacheState = { handlesByAccount: /* @__PURE__ */ new Map() };
9
9
  //#endregion
10
10
  //#region extensions/discord/src/directory-cache.ts
11
11
  const DISCORD_DIRECTORY_CACHE_MAX_ENTRIES = 4e3;
12
12
  const DISCORD_DISCRIMINATOR_SUFFIX = /#\d{4}$/;
13
- function normalizeAccountCacheKey(accountId) {
14
- return normalizeAccountId(accountId ?? DEFAULT_ACCOUNT_ID) || DEFAULT_ACCOUNT_ID;
15
- }
16
- function normalizeSnowflake(value) {
13
+ function normalizeDiscordSnowflake(value) {
17
14
  const text = normalizeOptionalStringifiedId(value) ?? "";
18
15
  if (!/^\d+$/.test(text)) return null;
19
16
  return text;
@@ -26,7 +23,7 @@ function normalizeDiscordHandleKey(raw) {
26
23
  return normalizeLowercaseStringOrEmpty(handle);
27
24
  }
28
25
  function ensureAccountCache(accountId) {
29
- const cacheKey = normalizeAccountCacheKey(accountId);
26
+ const cacheKey = normalizeAccountId(accountId);
30
27
  const existing = discordDirectoryCacheState.handlesByAccount.get(cacheKey);
31
28
  if (existing) return existing;
32
29
  const created = /* @__PURE__ */ new Map();
@@ -34,14 +31,14 @@ function ensureAccountCache(accountId) {
34
31
  return created;
35
32
  }
36
33
  function setCacheEntry(cache, key, userId) {
37
- if (cache.has(key)) cache.delete(key);
34
+ cache.delete(key);
38
35
  cache.set(key, userId);
39
36
  if (cache.size <= DISCORD_DIRECTORY_CACHE_MAX_ENTRIES) return;
40
37
  const oldest = cache.keys().next();
41
38
  if (!oldest.done) cache.delete(oldest.value);
42
39
  }
43
40
  function rememberDiscordDirectoryUser(params) {
44
- const userId = normalizeSnowflake(params.userId);
41
+ const userId = normalizeDiscordSnowflake(params.userId);
45
42
  if (!userId) return;
46
43
  const cache = ensureAccountCache(params.accountId);
47
44
  for (const candidate of params.handles) {
@@ -54,7 +51,7 @@ function rememberDiscordDirectoryUser(params) {
54
51
  }
55
52
  }
56
53
  function resolveDiscordDirectoryUserId(params) {
57
- const cache = discordDirectoryCacheState.handlesByAccount.get(normalizeAccountCacheKey(params.accountId));
54
+ const cache = discordDirectoryCacheState.handlesByAccount.get(normalizeAccountId(params.accountId));
58
55
  if (!cache) return;
59
56
  const handle = normalizeDiscordHandleKey(params.handle);
60
57
  if (!handle) return;
@@ -155,4 +152,4 @@ async function listDiscordDirectoryPeersLive(params) {
155
152
  return rows;
156
153
  }
157
154
  //#endregion
158
- export { rememberDiscordDirectoryUser as a, normalizeDiscordHandleKey as i, listDiscordDirectoryGroupsLive as n, resolveDiscordDirectoryUserId as o, listDiscordDirectoryPeersLive as r, directory_live_exports as t };
155
+ export { normalizeDiscordSnowflake as a, normalizeDiscordHandleKey as i, listDiscordDirectoryGroupsLive as n, rememberDiscordDirectoryUser as o, listDiscordDirectoryPeersLive as r, resolveDiscordDirectoryUserId as s, directory_live_exports as t };