@openclaw/discord 2026.9.8 → 2026.10.1-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (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-BilYSrRF.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-access-C12aDZ0p.mjs → channel-access-BRp3Y-rF.mjs} +4 -17
  11. package/dist/.setup/{channel-type-DRCrEMss.mjs → channel-type-D1_b5UhU.mjs} +12 -16
  12. package/dist/.setup/{channel-DxlUVU9t.mjs → channel-z5lQMS_9.mjs} +79 -75
  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-BNToPZrx.mjs} +7 -6
  26. package/dist/.setup/{message-handler.preflight-v-__NSDq.mjs → message-handler.preflight-D0BcCyI7.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-CThRmCWK.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-D2OKMo0f.mjs} +273 -446
  34. package/dist/.setup/{provider-session.runtime-BYlTBFD2.mjs → provider-session.runtime-BupCTZQv.mjs} +3 -3
  35. package/dist/.setup/provider.runtime-BaW_JnfU.mjs +2 -0
  36. package/dist/.setup/{realtime-session.runtime-oUd9DOcz.mjs → realtime-session.runtime-D5RSC8Mm.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-Bc75quiH.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,6 +1,6 @@
1
- import { i as createNoopThreadBindingManager, t as createThreadBindingManager } from "./thread-bindings.manager-DN-NissX.mjs";
2
- import { c as reconcileAcpThreadBindingsOnStartup } from "./thread-bindings-D7TfgjR_.mjs";
3
- import { t as createDiscordMessageHandler } from "./message-handler-B-Jk4oDk.mjs";
1
+ import { i as createNoopThreadBindingManager, t as createThreadBindingManager } from "./thread-bindings.manager-plk0zJAW.mjs";
2
+ import { c as reconcileAcpThreadBindingsOnStartup } from "./thread-bindings-yNNlcUWE.mjs";
3
+ import { t as createDiscordMessageHandler } from "./message-handler-BNToPZrx.mjs";
4
4
  import { resolveThreadBindingIdleTimeoutMs, resolveThreadBindingMaxAgeMs, resolveThreadBindingsEnabled } from "openclaw/plugin-sdk/conversation-runtime";
5
5
  import { getAcpSessionManager, isAcpRuntimeError } from "openclaw/plugin-sdk/acp-runtime";
6
6
  export { createDiscordMessageHandler, createNoopThreadBindingManager, createThreadBindingManager, getAcpSessionManager, isAcpRuntimeError, reconcileAcpThreadBindingsOnStartup, resolveThreadBindingIdleTimeoutMs, resolveThreadBindingMaxAgeMs, resolveThreadBindingsEnabled };
@@ -0,0 +1,2 @@
1
+ import { t as monitorDiscordProvider } from "./provider-D2OKMo0f.mjs";
2
+ export { monitorDiscordProvider };
@@ -1,12 +1,12 @@
1
- import { _ as releaseDiscordAudioInput, g as getDiscordAudioOutputStatus, h as admitDiscordAudioInput, m as DiscordAudioOutputStatus, u as createDiscordPcmToRealtimeConverter, v as restoreDiscordAudioError, x as setDiscordAudioOutputStatus } from "./receive-recovery-CHPOsnLc.mjs";
1
+ import { _ as releaseDiscordAudioInput, g as getDiscordAudioOutputStatus, h as admitDiscordAudioInput, m as DiscordAudioOutputStatus, u as createDiscordPcmToRealtimeConverter, v as restoreDiscordAudioError, x as setDiscordAudioOutputStatus } from "./receive-recovery-GqF2PUN_.mjs";
2
2
  import { n as discordRealtimeVoiceSecretOwnerId } from "./secret-config-contract-uOE2J7yM.mjs";
3
- import { g as logVoiceVerbose } from "./provider-B_G5hASF.mjs";
4
- import { a as logDiscordVoiceAgentControlResult, c as formatRealtimeLifecycleLog, i as handleDiscordVoiceAgentControlToolCall, l as formatVoiceLogPreview, n as DiscordRealtimeRecording, o as maybeControlDiscordVoiceAgentRun, r as formatVoiceIngressPrompt, s as formatRealtimeInterruptionLog, u as shouldLogRealtimeVerboseEvent } from "./voice-runtime-B46rcwrG.mjs";
3
+ import { g as logVoiceVerbose } from "./provider-D2OKMo0f.mjs";
4
+ import { a as logDiscordVoiceAgentControlResult, c as formatRealtimeLifecycleLog, i as handleDiscordVoiceAgentControlToolCall, l as formatVoiceLogPreview, n as DiscordRealtimeRecording, o as maybeControlDiscordVoiceAgentRun, r as formatVoiceIngressPrompt, s as formatRealtimeInterruptionLog, u as shouldLogRealtimeVerboseEvent } from "./voice-runtime-Bc75quiH.mjs";
5
+ import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
5
6
  import { randomUUID } from "node:crypto";
6
7
  import { asDateTimestampMs, resolveExpiresAtMsFromDurationMs } from "openclaw/plugin-sdk/number-runtime";
7
8
  import { formatErrorMessage } from "openclaw/plugin-sdk/ssrf-runtime";
8
9
  import { formatErrorMessage as formatErrorMessage$1, readErrorName, toErrorObject } from "openclaw/plugin-sdk/error-runtime";
9
- import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
10
10
  import { createSubsystemLogger } from "openclaw/plugin-sdk/runtime-env";
11
11
  import { sliceUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
12
12
  import { MessageChannel } from "node:worker_threads";
@@ -192,10 +192,8 @@ var DiscordRealtimeTurns = class {
192
192
  this.lastSpeakerTurn = void 0;
193
193
  }
194
194
  clear() {
195
- this.pendingAudio = false;
196
- this.lastSpeakerTurn = void 0;
197
- this.resetPartialWakeNameTracking();
198
- this.pendingWakeNameFollowup = void 0;
195
+ this.resetProviderContinuity();
196
+ this.wakeNameAckedForTurn = false;
199
197
  }
200
198
  consumePendingSpeakerContext() {
201
199
  this.pendingAudio = false;
@@ -297,9 +297,6 @@ var DiscordOpusEncodeStream = class extends Duplex {
297
297
  return this.push(packet);
298
298
  }
299
299
  };
300
- function pcmInt16ToBuffer(pcm) {
301
- return Buffer.from(pcm.buffer, pcm.byteOffset, pcm.byteLength);
302
- }
303
300
  async function decodeOpusStreamChunks(stream, params) {
304
301
  try {
305
302
  for await (const { pcm, packet } of decodeOpusFrames(stream, params)) await params.onChunk(pcm, packet);
@@ -328,7 +325,7 @@ async function* decodeOpusFrames(stream, params) {
328
325
  if (!chunk || !(chunk instanceof Buffer) || chunk.length === 0) continue;
329
326
  const decoded = decoder.decode(chunk, { maxFrameSize: DISCORD_OPUS_MAX_DECODE_FRAME_SIZE });
330
327
  if (decoded.length > 0) yield {
331
- pcm: pcmInt16ToBuffer(decoded),
328
+ pcm: Buffer.from(decoded.buffer, decoded.byteOffset, decoded.byteLength),
332
329
  packet: chunk
333
330
  };
334
331
  }
@@ -1,6 +1,6 @@
1
- import { o as normalizeDiscordSlug } from "./channel-type-DRCrEMss.mjs";
2
- import { m as normalizeDiscordToken } from "./accounts-ChaMcixG.mjs";
3
- import { r as fetchDiscord } from "./api-DVbJwZVt.mjs";
1
+ import { s as normalizeDiscordSlug } from "./channel-type-D1_b5UhU.mjs";
2
+ import { m as normalizeDiscordToken } from "./accounts-DXHCL8Zm.mjs";
3
+ import { r as fetchDiscord } from "./api-_oznjffB.mjs";
4
4
  //#region extensions/discord/src/guilds.ts
5
5
  async function listGuilds(token, fetcher, options) {
6
6
  return (await fetchDiscord("/users/@me/guilds", token, fetcher, options)).filter((guild) => typeof guild.id === "string" && typeof guild.name === "string").map((guild) => ({
@@ -14,15 +14,11 @@ async function listGuilds(token, fetcher, options) {
14
14
  function resolveDiscordAllowlistToken(token) {
15
15
  return normalizeDiscordToken(token, "channels.discord.token");
16
16
  }
17
- function findDiscordGuildByName(guilds, input) {
18
- const slug = normalizeDiscordSlug(input);
19
- if (!slug) return;
20
- return guilds.find((guild) => guild.slug === slug);
21
- }
22
17
  function filterDiscordGuilds(guilds, params) {
23
18
  if (params.guildId) return guilds.filter((guild) => guild.id === params.guildId);
24
19
  if (params.guildName) {
25
- const match = findDiscordGuildByName(guilds, params.guildName);
20
+ const slug = normalizeDiscordSlug(params.guildName);
21
+ const match = slug ? guilds.find((guild) => guild.slug === slug) : void 0;
26
22
  return match ? [match] : [];
27
23
  }
28
24
  return guilds;
@@ -1,7 +1,7 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.mjs";
2
- import { o as normalizeDiscordSlug, t as isDiscordThreadChannelType } from "./channel-type-DRCrEMss.mjs";
3
- import { n as DiscordApiError, r as fetchDiscord, t as DISCORD_DIRECTORY_LOOKUP_TIMEOUT_MS } from "./api-DVbJwZVt.mjs";
4
- import { n as resolveDiscordAllowlistToken, r as listGuilds, t as filterDiscordGuilds } from "./resolve-allowlist-common-DPdRggu5.mjs";
2
+ import { s as normalizeDiscordSlug, t as isDiscordThreadChannelType } from "./channel-type-D1_b5UhU.mjs";
3
+ import { n as DiscordApiError, r as fetchDiscord, t as DISCORD_DIRECTORY_LOOKUP_TIMEOUT_MS } from "./api-_oznjffB.mjs";
4
+ import { n as resolveDiscordAllowlistToken, r as listGuilds, t as filterDiscordGuilds } from "./resolve-allowlist-common-DUYRrrVB.mjs";
5
5
  //#region extensions/discord/src/resolve-channels.ts
6
6
  var resolve_channels_exports = /* @__PURE__ */ __exportAll({ resolveDiscordChannelAllowlist: () => resolveDiscordChannelAllowlist });
7
7
  function parseDiscordChannelInput(raw) {
@@ -1,7 +1,7 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.mjs";
2
- import { r as fetchDiscord, t as DISCORD_DIRECTORY_LOOKUP_TIMEOUT_MS } from "./api-DVbJwZVt.mjs";
3
- import { n as resolveDiscordAllowlistToken, r as listGuilds, t as filterDiscordGuilds } from "./resolve-allowlist-common-DPdRggu5.mjs";
4
- import { normalizeLowercaseStringOrEmpty, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
2
+ import { r as fetchDiscord, t as DISCORD_DIRECTORY_LOOKUP_TIMEOUT_MS } from "./api-_oznjffB.mjs";
3
+ import { n as resolveDiscordAllowlistToken, r as listGuilds, t as filterDiscordGuilds } from "./resolve-allowlist-common-DUYRrrVB.mjs";
4
+ import { normalizeLowercaseStringOrEmpty, normalizeOptionalLowercaseString, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
5
5
  //#region extensions/discord/src/resolve-users.ts
6
6
  var resolve_users_exports = /* @__PURE__ */ __exportAll({ resolveDiscordUserAllowlist: () => resolveDiscordUserAllowlist });
7
7
  function parseDiscordUserInput(raw) {
@@ -32,14 +32,11 @@ function scoreDiscordMember(member, query) {
32
32
  const candidates = [
33
33
  user.username,
34
34
  user.global_name,
35
- member.nick ?? void 0
36
- ].map((value) => {
37
- const normalized = normalizeOptionalString(value);
38
- return normalized ? normalizeLowercaseStringOrEmpty(normalized) : void 0;
39
- }).filter(Boolean);
35
+ member.nick
36
+ ].map(normalizeOptionalLowercaseString).filter((value) => value !== void 0);
40
37
  let score = 0;
41
38
  if (candidates.some((value) => value === q)) score += 3;
42
- if (candidates.some((value) => value?.includes(q))) score += 1;
39
+ if (candidates.some((value) => value.includes(q))) score += 1;
43
40
  if (!user.bot) score += 1;
44
41
  return score;
45
42
  }
@@ -1,5 +1,4 @@
1
- import { v as RateLimitError } from "./discord-0xJYfdDD.mjs";
2
- import { expectDefined } from "openclaw/plugin-sdk/expect-runtime";
1
+ import { v as RateLimitError } from "./discord-J7aRzq2Q.mjs";
3
2
  import { parseStrictNonNegativeInteger, resolveIntegerOption } from "openclaw/plugin-sdk/number-runtime";
4
3
  import { collectErrorGraphCandidates, extractErrorCode, formatErrorMessage, readErrorName } from "openclaw/plugin-sdk/error-runtime";
5
4
  import { classifyTransientNetworkErrorCode, createChannelApiRetryRunner, resolveRetryConfig, retryAsync } from "openclaw/plugin-sdk/retry-runtime";
@@ -7,6 +6,7 @@ import { buildMessagingTarget, parseMentionPrefixOrAtUserTarget, requireTargetKi
7
6
  import { sleepWithAbort } from "openclaw/plugin-sdk/runtime-env";
8
7
  import { resolveAllowlistMatchByCandidates } from "openclaw/plugin-sdk/allow-from";
9
8
  import { chunkByParagraph } from "openclaw/plugin-sdk/reply-chunking";
9
+ import { expectDefined } from "openclaw/plugin-sdk/expect-runtime";
10
10
  import { chunkTextForOutbound, findCodeRegions } from "openclaw/plugin-sdk/text-chunking";
11
11
  import { isSingleUseReplyToMode } from "openclaw/plugin-sdk/reply-reference";
12
12
  import { createMessageReceiptFromOutboundResults } from "openclaw/plugin-sdk/channel-outbound";
@@ -114,19 +114,11 @@ function normalizeAllowFromDiscordUserId(entry) {
114
114
  if (!trimmed || trimmed === "*") return;
115
115
  const mentionMatch = /^<@!?(\d+)>$/.exec(trimmed);
116
116
  if (mentionMatch) return mentionMatch[1];
117
- const prefixedMatch = /^(?:discord:)?user:(\d+)$/.exec(trimmed);
118
- if (prefixedMatch) return prefixedMatch[1];
119
- const discordMatch = /^discord:(\d+)$/.exec(trimmed);
120
- if (discordMatch) return discordMatch[1];
121
- return /^\d+$/.test(trimmed) ? trimmed : void 0;
117
+ return /^(?:(?:discord:)?user:|discord:)?(\d+)$/.exec(trimmed)?.[1];
122
118
  }
123
119
  function looksLikeDiscordTargetId(raw) {
124
120
  const trimmed = raw.trim();
125
- if (!trimmed) return false;
126
- if (/^<@!?\d+>$/.test(trimmed)) return true;
127
- if (/^(?:(?:user|channel|discord):\d+|discord:(?:user|channel):\d+)$/i.test(trimmed)) return true;
128
- if (/^\d{6,}$/.test(trimmed)) return true;
129
- return false;
121
+ return /^<@!?\d+>$/.test(trimmed) || /^(?:(?:user|channel|discord):\d+|discord:(?:user|channel):\d+)$/i.test(trimmed) || /^\d{6,}$/.test(trimmed);
130
122
  }
131
123
  //#endregion
132
124
  //#region extensions/discord/src/reply-reference.ts
@@ -183,19 +175,12 @@ function createDiscordSendReceipt(params) {
183
175
  messageId
184
176
  };
185
177
  if (params.channelId) result.channelId = params.channelId;
186
- if (params.reply?.scope === "first" && index === 0) {
187
- const rawResult = {
188
- channel: "discord",
189
- messageId
190
- };
191
- if (params.channelId) rawResult.channelId = params.channelId;
192
- result.receipt = createMessageReceiptFromOutboundResults({
193
- results: [rawResult],
194
- kind: params.kind,
195
- threadId: params.threadId,
196
- replyToId: params.reply.messageId
197
- });
198
- }
178
+ if (params.reply?.scope === "first" && index === 0) result.receipt = createMessageReceiptFromOutboundResults({
179
+ results: [{ ...result }],
180
+ kind: params.kind,
181
+ threadId: params.threadId,
182
+ replyToId: params.reply.messageId
183
+ });
199
184
  return result;
200
185
  });
201
186
  return createMessageReceiptFromOutboundResults({
@@ -242,6 +227,12 @@ function getGraphemeSegmenter() {
242
227
  graphemeSegmenter ??= new Intl.Segmenter(void 0, { granularity: "grapheme" });
243
228
  return graphemeSegmenter;
244
229
  }
230
+ /** Uses the same source text that created segments. */
231
+ function containingSegment(segments, text, index) {
232
+ const position = Number.isNaN(index) ? 0 : Math.trunc(index);
233
+ const codePoint = text.codePointAt(position);
234
+ return segments.containing(codePoint !== void 0 && codePoint > 65535 ? position + 1 : position);
235
+ }
245
236
  /**
246
237
  * Chooses a whole-grapheme cut within the hard budget, honoring a usable preference.
247
238
  * If no whole grapheme fits, allowPartial permits a surrogate-safe progress cut;
@@ -253,8 +244,8 @@ function findGraphemeChunkEnd(text, start, maxEnd, preferredEnd = maxEnd, allowP
253
244
  const preferred = Number.isInteger(preferredEnd) && preferredEnd > start && preferredEnd <= hardEnd ? preferredEnd : hardEnd;
254
245
  if (preferred === text.length) return preferred;
255
246
  const segments = getGraphemeSegmenter().segment(text);
256
- let end = segments.containing(preferred)?.index ?? preferred;
257
- if (end <= start && preferred < hardEnd) end = hardEnd === text.length ? hardEnd : segments.containing(hardEnd)?.index ?? hardEnd;
247
+ let end = containingSegment(segments, text, preferred)?.index ?? preferred;
248
+ if (end <= start && preferred < hardEnd) end = hardEnd === text.length ? hardEnd : containingSegment(segments, text, hardEnd)?.index ?? hardEnd;
258
249
  return end > start ? end : allowPartial ? avoidTrailingHighSurrogateBreak(text, start, hardEnd) : start;
259
250
  }
260
251
  //#endregion
@@ -489,27 +480,21 @@ function createDiscordRanges(source, maxChars, maxLines) {
489
480
  offset += line.length + 1;
490
481
  }
491
482
  if (!fence) collect(source.length);
492
- const firstSpanEndingAfter = (position) => {
483
+ const firstMatchingIndex = (length, before) => {
493
484
  let low = 0;
494
- let high = spans.length;
485
+ let high = length;
495
486
  while (low < high) {
496
487
  const middle = low + Math.floor((high - low) / 2);
497
- if (expectDefined(spans[middle], "Discord inline span").end <= position) low = middle + 1;
488
+ if (before(middle)) low = middle + 1;
498
489
  else high = middle;
499
490
  }
500
491
  return low;
501
492
  };
502
- const firstPrefixEndingAfter = (position) => {
503
- let low = 0;
504
- let high = spans.length;
505
- while (low < high) {
506
- const middle = low + Math.floor((high - low) / 2);
507
- const span = expectDefined(spans[middle], "Discord inline span");
508
- if (span.base + span.code.prefix.end <= position) low = middle + 1;
509
- else high = middle;
510
- }
511
- return spans[low];
512
- };
493
+ const firstSpanEndingAfter = (position) => firstMatchingIndex(spans.length, (index) => expectDefined(spans[index], "Discord inline span").end <= position);
494
+ const firstPrefixEndingAfter = (position) => spans[firstMatchingIndex(spans.length, (index) => {
495
+ const span = expectDefined(spans[index], "Discord inline span");
496
+ return span.base + span.code.prefix.end <= position;
497
+ })];
513
498
  const overlaps = (start, end) => {
514
499
  const span = spans[firstSpanEndingAfter(start)];
515
500
  return Boolean(span && span.start < end);
@@ -556,16 +541,7 @@ function createDiscordRanges(source, maxChars, maxLines) {
556
541
  }
557
542
  return text + source.slice(cursor, end);
558
543
  };
559
- const fenceEndingAtOrAfter = (position) => {
560
- let low = 0;
561
- let high = fences.length;
562
- while (low < high) {
563
- const middle = low + Math.floor((high - low) / 2);
564
- if (expectDefined(fences[middle], "Discord fence range").end < position) low = middle + 1;
565
- else high = middle;
566
- }
567
- return fences[low];
568
- };
544
+ const fenceEndingAtOrAfter = (position) => fences[firstMatchingIndex(fences.length, (index) => expectDefined(fences[index], "Discord fence range").end < position)];
569
545
  const fenceAt = (position) => {
570
546
  const range = fenceEndingAtOrAfter(position);
571
547
  return range && range.bodyStart - 1 <= position && (position < range.end || position === range.end && range.closeStart === range.end) ? range : void 0;
@@ -1,5 +1,5 @@
1
- import { c as resolveDiscordAccount, g as selectDiscordActivitiesRuntimeConfig, n as isDiscordAccountEnabledForRuntime, r as listDiscordAccountIds } from "./accounts-ChaMcixG.mjs";
2
- import { R as resolveDiscordProxyFetchForAccount } from "./send.shared-DGFkbkQR.mjs";
1
+ import { c as resolveDiscordAccount, g as selectDiscordActivitiesRuntimeConfig, n as isDiscordAccountEnabledForRuntime, r as listDiscordAccountIds } from "./accounts-DXHCL8Zm.mjs";
2
+ import { R as resolveDiscordProxyFetchForAccount } from "./send.shared-BQIUh6Vn.mjs";
3
3
  import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
4
4
  //#region extensions/discord/src/activities/config.ts
5
5
  function resolveDiscordActivitiesConfig(account, env = process.env) {