@openclaw/discord 2026.11.5 → 2026.11.10-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 (125) hide show
  1. package/README.md +37 -0
  2. package/dist/.setup/{account-inspect-DGkdWwix.mjs → account-inspect-CSz5Qodj.mjs} +2 -3
  3. package/dist/.setup/{accounts-C_25wyxC.mjs → accounts-DtjvhJUj.mjs} +4 -8
  4. package/dist/.setup/{active-turn-thread-route-KvRTAVE3.mjs → active-turn-thread-route-DkPnk2x8.mjs} +1 -2
  5. package/dist/.setup/{allow-list-BXrS8-R9.mjs → allow-list-CkqpzPvP.mjs} +5 -9
  6. package/dist/.setup/{api-BlBD4ism.mjs → api-C4j_kC-2.mjs} +4 -6
  7. package/dist/.setup/{approval-handler.runtime-o2N6GRFH.mjs → approval-handler.runtime-DjtQbUPp.mjs} +10 -10
  8. package/dist/.setup/{approval-message-updates-DKsCfxSW.mjs → approval-message-updates-DqOXxPss.mjs} +3 -4
  9. package/dist/.setup/{audit-5b-FXj9R.mjs → audit-B9vk3V2z.mjs} +6 -7
  10. package/dist/.setup/{channel-CplVDtyZ.mjs → channel-Cihfaj84.mjs} +38 -41
  11. package/dist/.setup/{channel-access-9cyzozUP.mjs → channel-access-DhJhVrdZ.mjs} +1 -2
  12. package/dist/.setup/{channel.setup-B3MtmBQG.mjs → channel.setup-DmGdG9BH.mjs} +7 -10
  13. package/dist/.setup/{command-deploy-store-DFkBTViB.mjs → command-deploy-store-DPWiBMks.mjs} +1 -2
  14. package/dist/.setup/{command-owners-C7rUdqUX.mjs → command-owners-BzlhNBxA.mjs} +1 -2
  15. package/dist/.setup/{components-YCvQ6YLS.mjs → components-GePlato3.mjs} +10 -16
  16. package/dist/.setup/{components.base-CiS0h_XP.mjs → components.base-C5sAPHe4.mjs} +1 -2
  17. package/dist/.setup/config-DDwcUaxT.mjs +20 -0
  18. package/dist/.setup/{config-schema-BNKN1cu5.mjs → config-schema-D3M1livr.mjs} +5 -7
  19. package/dist/.setup/{conversation-binding-route-kCTw8cij.mjs → conversation-binding-route-CAaWWJdQ.mjs} +2 -3
  20. package/dist/.setup/conversation-fork-B6PiUuln.mjs +197 -0
  21. package/dist/.setup/{directory-config-Ble81PWH.mjs → directory-config-BXJuh9-J.mjs} +3 -4
  22. package/dist/.setup/directory-live-B9UoQG9g.mjs +90 -0
  23. package/dist/.setup/{discord-DGVSguhx.mjs → discord-cXPUdHQi.mjs} +98 -77
  24. package/dist/.setup/{doctor-eujgbnpZ.mjs → doctor-MTAWTgRa.mjs} +7 -8
  25. package/dist/.setup/{doctor-contract-Bwv8EuQ_.mjs → doctor-contract-Dstl3cMg.mjs} +2 -3
  26. package/dist/.setup/{endpoint-runtime-lf4DeLas.mjs → endpoint-runtime-BM3x-m6O.mjs} +1 -2
  27. package/dist/.setup/{guilds-eDq22iSM.mjs → guilds-DYBhgnfq.mjs} +3 -4
  28. package/dist/.setup/{handle-action-CktwmzMz.mjs → handle-action-El1ok7Ak.mjs} +13 -12
  29. package/dist/.setup/{handle-action.guild-admin-WLQ7fRqI.mjs → handle-action.guild-admin-CxYfg02j.mjs} +7 -5
  30. package/dist/.setup/identity-link-B7KOBo_l.mjs +74 -0
  31. package/dist/.setup/{listeners-Df8lx3vK.mjs → listeners-DIyynRvV.mjs} +2 -3
  32. package/dist/.setup/{live-policy-config-DiBVuaU6.mjs → live-policy-config-DjIHWFla.mjs} +3 -5
  33. package/dist/.setup/{message-handler-DeoWTD-4.mjs → message-handler-BoQcvdfV.mjs} +18 -17
  34. package/dist/.setup/{message-handler.preflight-DKOjgF0z.mjs → message-handler.preflight-C7uhmcsV.mjs} +20 -27
  35. package/dist/.setup/{message-handler.preflight-pluralkit-CYZfXXb6.mjs → message-handler.preflight-pluralkit-BFntgVKc.mjs} +10 -14
  36. package/dist/.setup/{message-handler.process-RKRgMCJy.mjs → message-handler.process-B29pkCxQ.mjs} +54 -66
  37. package/dist/.setup/oauth-http-DdVyzSbo.mjs +40 -0
  38. package/dist/.setup/{outbound-payload-BaZmjewa.mjs → outbound-payload-Dh6xCO6z.mjs} +18 -13
  39. package/dist/.setup/{outbound-session-route-Cgx4i9cS.mjs → outbound-session-route-G_fK5RAh.mjs} +22 -34
  40. package/dist/.setup/{output-activity-uBpMSX75.mjs → output-activity-CDgs2s3O.mjs} +1 -2
  41. package/dist/.setup/{pluralkit-B64dfq_j.mjs → pluralkit-DcXbHTpQ.mjs} +2 -3
  42. package/dist/.setup/{preflight-audio-C6QtD6HX.mjs → preflight-audio-r4BbaJxh.mjs} +1 -2
  43. package/dist/.setup/{presence-cache-Dq-3nH7R.mjs → presence-cache-B3xj3b0l.mjs} +1 -2
  44. package/dist/.setup/{probe-DezB-6xz.mjs → probe-CfGMZwFD.mjs} +5 -6
  45. package/dist/.setup/{provider-D63dgDSw.mjs → provider-CnDxdXUm.mjs} +252 -246
  46. package/dist/.setup/{provider-session.runtime-ePktW62k.mjs → provider-session.runtime-CCBGrm-d.mjs} +3 -3
  47. package/dist/.setup/provider.runtime-BoSMAwDb.mjs +1 -0
  48. package/dist/.setup/{proxy-fetch-BzXwBAXt.mjs → proxy-fetch-B8cK6FLQ.mjs} +1 -2
  49. package/dist/.setup/{realtime-session.runtime-rlZ3WzwC.mjs → realtime-session.runtime-OD95VAEG.mjs} +15 -25
  50. package/dist/.setup/{receive-recovery-C3Ks4wAQ.mjs → receive-recovery-DV_v5ROf.mjs} +3 -6
  51. package/dist/.setup/{resolve-allowlist-common-Bk8Fj6Ik.mjs → resolve-allowlist-common-CYdqBUgV.mjs} +3 -4
  52. package/dist/.setup/{resolve-channels-Bp8frXvc.mjs → resolve-channels-BNnyfCR8.mjs} +10 -9
  53. package/dist/.setup/{resolve-users-Cvcj22sG.mjs → resolve-users-CDMAGrzv.mjs} +5 -6
  54. package/dist/.setup/{rolldown-runtime-B4FMCO8f.mjs → rolldown-runtime-nwUcYXjP.mjs} +1 -2
  55. package/dist/.setup/{runtime-BJaCvlmq.mjs → runtime-CkeNX7ic.mjs} +62 -51
  56. package/dist/.setup/{runtime-BMgTyuwg.mjs → runtime-DSaHEGJd.mjs} +4 -24
  57. package/dist/.setup/{runtime-DgnVQ7zW.mjs → runtime-DcBvHOm1.mjs} +1 -2
  58. package/dist/.setup/{runtime-doctor-migrations-BPV-R4G9.mjs → runtime-doctor-migrations-BpV1jKk0.mjs} +5 -9
  59. package/dist/.setup/{secret-config-contract-B1kE4sDv.mjs → secret-config-contract-CP6teHec.mjs} +1 -2
  60. package/dist/.setup/{security-audit-BFT84Uny.mjs → security-audit-CTwisG7c.mjs} +3 -4
  61. package/dist/.setup/{security-contract-DNyyjTZZ.mjs → security-contract-D-o0iWDk.mjs} +1 -2
  62. package/dist/.setup/{security-doctor-nGgPm65L.mjs → security-doctor-4s7omTZd.mjs} +1 -2
  63. package/dist/.setup/{send-CVW7V-VZ.mjs → send-DKzwsZkm.mjs} +28 -32
  64. package/dist/.setup/{send.components-C8YXdnO_.mjs → send.components-CIZALYDP.mjs} +12 -14
  65. package/dist/.setup/{send.outbound-Uzcmh3Yd.mjs → send.outbound-cQ4Ohmsc.mjs} +11 -16
  66. package/dist/.setup/send.permissions-BvH_Dr8p.mjs +369 -0
  67. package/dist/.setup/{send.receipt-NZDOTZBU.mjs → send.receipt-CZ7ks6g7.mjs} +64 -17
  68. package/dist/.setup/send.shared-D2lh737v.mjs +259 -0
  69. package/dist/.setup/{sender-identity-76HFb8eK.mjs → sender-identity-Dt5ELjRN.mjs} +2 -3
  70. package/dist/.setup/{session-contract-BO5tlIdl.mjs → session-contract-Bq71MS78.mjs} +1 -2
  71. package/dist/.setup/{session-key-normalization-CCHGNSQw.mjs → session-key-normalization-Cfvze5hd.mjs} +1 -2
  72. package/dist/.setup/setup-plugin-api-BJt8tAAC.mjs +2 -0
  73. package/dist/.setup/{shared-yDUSExm2.mjs → shared-Bf7ifHlc.mjs} +14 -17
  74. package/dist/.setup/{shared-interactive-DmzaoKOM.mjs → shared-interactive-DKBw4SNV.mjs} +7 -12
  75. package/dist/.setup/{subagent-hooks-CDkdHQyy.mjs → subagent-hooks-CVmIOrAR.mjs} +4 -5
  76. package/dist/.setup/{system-events-yfWz150v.mjs → system-events-DB6p2H4l.mjs} +3 -4
  77. package/dist/.setup/{target-parsing-C-HyNxcE.mjs → target-parsing-BiuhcK9Q.mjs} +1 -2
  78. package/dist/.setup/{target-resolver-BOOzqxxM.mjs → target-resolver-48znkzky.mjs} +6 -7
  79. package/dist/.setup/{thread-binding-api-BDZJD4na.mjs → thread-binding-api-Drd4Zu-5.mjs} +1 -2
  80. package/dist/.setup/{thread-bindings-zce4cpu_.mjs → thread-bindings-DTHVdmvF.mjs} +7 -10
  81. package/dist/.setup/{thread-bindings.manager-NywKzUtc.mjs → thread-bindings.manager-6EnH3YZh.mjs} +45 -30
  82. package/dist/.setup/{thread-bindings.session-updates-D0j7oh8S.mjs → thread-bindings.session-updates-BPO6pPzd.mjs} +9 -12
  83. package/dist/.setup/{threading-DodLYDt-.mjs → threading-PC3IIaHd.mjs} +5 -7
  84. package/dist/.setup/{timeouts-cIxzatmv.mjs → timeouts-CT9hnmo4.mjs} +1 -2
  85. package/dist/.setup/{transcripts-source-ie9GBWaU.mjs → transcripts-source-C3F_ErM1.mjs} +33 -46
  86. package/dist/.setup/{typing-CNlSKY5S.mjs → typing-DAv4S2fI.mjs} +2 -3
  87. package/dist/.setup/{voice-runtime-Dc8Su9Cm.mjs → voice-runtime-CzV3fXxV.mjs} +28 -46
  88. package/dist/.source-module-urls/d6c089460280c5a04184542d6712e04545caeb1ebb290d3504377b4cc5e22fea.json +1 -1
  89. package/dist/account-inspect-api.js +2 -3
  90. package/dist/action-runtime-api.js +1 -1
  91. package/dist/activities-api.js +10 -50
  92. package/dist/api.js +21 -22
  93. package/dist/assets/embedded-app-sdk.mjs +1 -1
  94. package/dist/channel-config-api.js +1 -1
  95. package/dist/channel-plugin-api.js +1 -1
  96. package/dist/contract-api.js +1 -1
  97. package/dist/directory-contract-api.js +2 -3
  98. package/dist/doctor-contract-api.js +7 -8
  99. package/dist/index.js +1 -2
  100. package/dist/runtime-api.js +23 -22
  101. package/dist/runtime-setter-api.js +1 -1
  102. package/dist/secret-contract-api.js +1 -1
  103. package/dist/security-audit-contract-api.js +1 -1
  104. package/dist/security-contract-api.js +1 -1
  105. package/dist/session-key-api.js +1 -1
  106. package/dist/setup-entry.js +2 -3
  107. package/dist/setup-plugin-api.js +1 -1
  108. package/dist/src/voice/audio-worker.runtime.js +14 -26
  109. package/dist/subagent-hooks-api.js +2 -3
  110. package/dist/thread-binding-api.js +1 -1
  111. package/dist/transcripts-source-api.js +2 -3
  112. package/node_modules/@discord/embedded-app-sdk/output/lib/zod/lib/index.cjs +2 -3
  113. package/node_modules/@discord/embedded-app-sdk/output/lib/zod/lib/index.mjs +2 -3
  114. package/node_modules/@types/node/README.md +1 -1
  115. package/node_modules/@types/node/package.json +2 -2
  116. package/node_modules/@types/node/zlib.d.ts +752 -0
  117. package/node_modules/typebox/build/format/date_time.d.mts +2 -1
  118. package/node_modules/typebox/build/format/date_time.mjs +12 -3
  119. package/node_modules/typebox/package.json +1 -1
  120. package/openclaw.plugin.json +7 -2
  121. package/package.json +5 -5
  122. package/dist/.setup/directory-live-DH3tpS3x.mjs +0 -144
  123. package/dist/.setup/provider.runtime-DcNkwhPW.mjs +0 -1
  124. package/dist/.setup/send.shared-a_6Oeyg1.mjs +0 -589
  125. package/dist/.setup/setup-plugin-api-BExhGEhL.mjs +0 -2
@@ -1,6 +1,6 @@
1
- import { i as createNoopThreadBindingManager, t as createThreadBindingManager } from "./thread-bindings.manager-NywKzUtc.mjs";
2
- import { l as reconcileAcpThreadBindingsOnStartup } from "./thread-bindings-zce4cpu_.mjs";
3
- import { t as createDiscordMessageHandler } from "./message-handler-DeoWTD-4.mjs";
1
+ import { i as createNoopThreadBindingManager, t as createThreadBindingManager } from "./thread-bindings.manager-6EnH3YZh.mjs";
2
+ import { l as reconcileAcpThreadBindingsOnStartup } from "./thread-bindings-DTHVdmvF.mjs";
3
+ import { t as createDiscordMessageHandler } from "./message-handler-BoQcvdfV.mjs";
4
4
  import { resolveThreadBindingIdleTimeoutMs, resolveThreadBindingMaxAgeMs, resolveThreadBindingsEnabled } from "openclaw/plugin-sdk/conversation-runtime";
5
5
  import { getAcpSessionManager, isAcpRuntimeError, rethrowIncognitoSessionError } from "openclaw/plugin-sdk/acp-runtime";
6
6
  export { createDiscordMessageHandler, createNoopThreadBindingManager, createThreadBindingManager, getAcpSessionManager, isAcpRuntimeError, reconcileAcpThreadBindingsOnStartup, resolveThreadBindingIdleTimeoutMs, resolveThreadBindingMaxAgeMs, resolveThreadBindingsEnabled, rethrowIncognitoSessionError };
@@ -0,0 +1 @@
1
+ export { t as monitorDiscordProvider } from "./provider-CnDxdXUm.mjs";
@@ -1,7 +1,7 @@
1
1
  import { danger } from "openclaw/plugin-sdk/runtime-env";
2
2
  import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
3
3
  import { makeProxyFetch } from "openclaw/plugin-sdk/fetch-runtime";
4
- //#region extensions/discord/src/proxy-fetch.ts
4
+ // extensions/discord/src/proxy-fetch.ts
5
5
  function resolveDiscordProxyFetchForAccount(account, cfg) {
6
6
  return withValidatedDiscordProxy(normalizeOptionalString(account.config.proxy) ?? normalizeOptionalString(cfg?.channels?.discord?.proxy), void 0, makeProxyFetch);
7
7
  }
@@ -26,5 +26,4 @@ function validateDiscordProxyUrl(proxyUrl) {
26
26
  if (!["http:", "https:"].includes(parsed.protocol)) throw new Error("Proxy URL must use http or https");
27
27
  return proxyUrl;
28
28
  }
29
- //#endregion
30
29
  export { validateDiscordProxyUrl as n, withValidatedDiscordProxy as r, resolveDiscordProxyFetchForAccount as t };
@@ -1,8 +1,8 @@
1
- import { _ as setDiscordAudioOutputStatus, h as restoreDiscordAudioError, l as createDiscordPcmToRealtimeConverter, m as getDiscordAudioOutputStatus, p as DiscordAudioOutputStatus } from "./receive-recovery-C3Ks4wAQ.mjs";
2
- import { t as resolveDiscordOutputAudioDelta } from "./output-activity-uBpMSX75.mjs";
3
- import { n as discordRealtimeVoiceSecretOwnerId } from "./secret-config-contract-B1kE4sDv.mjs";
4
- import { y as logVoiceVerbose } from "./provider-D63dgDSw.mjs";
5
- import { a as maybeControlDiscordVoiceAgentRun, i as logDiscordVoiceAgentControlResult, n as formatVoiceIngressPrompt, r as handleDiscordVoiceAgentControlToolCall, t as DiscordRealtimeRecording } from "./voice-runtime-Dc8Su9Cm.mjs";
1
+ import { _ as setDiscordAudioOutputStatus, h as restoreDiscordAudioError, l as createDiscordPcmToRealtimeConverter, m as getDiscordAudioOutputStatus, p as DiscordAudioOutputStatus } from "./receive-recovery-DV_v5ROf.mjs";
2
+ import { t as resolveDiscordOutputAudioDelta } from "./output-activity-CDgs2s3O.mjs";
3
+ import { n as discordRealtimeVoiceSecretOwnerId } from "./secret-config-contract-CP6teHec.mjs";
4
+ import { y as logVoiceVerbose } from "./provider-CnDxdXUm.mjs";
5
+ import { a as maybeControlDiscordVoiceAgentRun, i as logDiscordVoiceAgentControlResult, n as formatVoiceIngressPrompt, r as handleDiscordVoiceAgentControlToolCall, t as DiscordRealtimeRecording } from "./voice-runtime-CzV3fXxV.mjs";
6
6
  import { MessageChannel } from "node:worker_threads";
7
7
  import { formatErrorMessage, readErrorName, toErrorObject, toStringifiedError } from "openclaw/plugin-sdk/error-runtime";
8
8
  import { createSubsystemLogger } from "openclaw/plugin-sdk/runtime-env";
@@ -13,7 +13,7 @@ import { sliceUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
13
13
  import { createDeferred } from "openclaw/plugin-sdk/extension-shared";
14
14
  import { REALTIME_VOICE_AGENT_CONSULT_TOOL_NAME, REALTIME_VOICE_AGENT_CONTROL_TOOL, REALTIME_VOICE_AGENT_CONTROL_TOOL_NAME, REALTIME_VOICE_AUDIO_FORMAT_PCM16_24KHZ, buildRealtimeVoiceAgentErrorProviderResult, buildRealtimeVoiceSessionInstructions, buildRealtimeVoiceSpeakExactMessage, canonicalizeRealtimeVoiceProviderId, classifyRealtimeVoiceConsultToolCall, classifySkippableRealtimeVoiceConsultTranscript, createRealtimeVoiceAgentTalkbackQueue, createRealtimeVoiceOutputActivityTracker, createRealtimeVoiceSessionHarness, isRealtimeVoiceAudioAudible, isRealtimeVoiceWakeNameRequired, matchRealtimeVoiceActivationName, matchRealtimeVoiceConsultQuestions, projectInternalRealtimeVoicePublicConfig, realtimeVoiceAudioDurationMs, registerRealtimeVoiceSelection, resolveConfiguredRealtimeVoiceProviderAsync, resolveRealtimeVoiceAgentConsultTools, resolveRealtimeVoiceBargeIn, resolveRealtimeVoiceInterruptResponseOnInputAudio, resolveRealtimeVoiceMinBargeInAudioEndMs, resolveRealtimeVoiceSessionPolicy } from "openclaw/plugin-sdk/realtime-voice";
15
15
  import { assertSecretOwnerAvailable, isSecretOwnerAvailable } from "openclaw/plugin-sdk/channel-secret-owner-runtime";
16
- //#region extensions/discord/src/voice/realtime-player.ts
16
+ // extensions/discord/src/voice/realtime-player.ts
17
17
  /** Room-level policy stays on main; the worker owns the physical player and FIFO. */
18
18
  var DiscordRealtimePlayer = class {
19
19
  constructor(audio) {
@@ -77,8 +77,7 @@ var DiscordRealtimePlayer = class {
77
77
  this.audio.send({ type: "output-shutdown" });
78
78
  }
79
79
  };
80
- //#endregion
81
- //#region extensions/discord/src/voice/realtime-speaker-config.ts
80
+ // extensions/discord/src/voice/realtime-speaker-config.ts
82
81
  /** Prepare shared provider credentials once before any speaker starts capturing audio. */
83
82
  async function prepareDiscordRealtimeProvider(params) {
84
83
  const { realtimeConfig, isAgentProxy } = params;
@@ -179,8 +178,7 @@ function resolveDiscordRealtimeSpeakerConfig(params) {
179
178
  resolvedVoice: normalizeOptionalString(resolved.providerConfig.voice)
180
179
  };
181
180
  }
182
- //#endregion
183
- //#region extensions/discord/src/voice/log-preview.ts
181
+ // extensions/discord/src/voice/log-preview.ts
184
182
  const DISCORD_REALTIME_INTERRUPTION_MESSAGES = /* @__PURE__ */ new Map([
185
183
  ["client:response.cancel", "interrupt requested"],
186
184
  ["client:conversation.item.truncate.skipped", "interrupt ignored"],
@@ -195,8 +193,7 @@ function formatRealtimeInfoLog(event) {
195
193
  const detail = event.detail ? ` ${event.detail}` : "";
196
194
  return `discord voice: realtime lifecycle ${event.direction}:${event.type}${detail}`;
197
195
  }
198
- //#endregion
199
- //#region extensions/discord/src/voice/realtime-transcript.ts
196
+ // extensions/discord/src/voice/realtime-transcript.ts
200
197
  const PARTIAL_TRANSCRIPT_MAX_CHARS = 240;
201
198
  function mergeRealtimePartialTranscript(previous, next) {
202
199
  const trimmed = next.trim();
@@ -204,8 +201,7 @@ function mergeRealtimePartialTranscript(previous, next) {
204
201
  const merged = trimmed.startsWith(previous) ? trimmed : `${previous}${next}`;
205
202
  return sliceUtf16Safe(merged, 0, PARTIAL_TRANSCRIPT_MAX_CHARS);
206
203
  }
207
- //#endregion
208
- //#region extensions/discord/src/voice/realtime-turns.ts
204
+ // extensions/discord/src/voice/realtime-turns.ts
209
205
  const logger$4 = createSubsystemLogger("discord/voice");
210
206
  const DISCORD_REALTIME_WAKE_NAME_FOLLOWUP_TTL_MS = 1e4;
211
207
  const REALTIME_PCM16_BYTES_PER_SAMPLE = 2;
@@ -392,8 +388,7 @@ var DiscordRealtimeTurns = class {
392
388
  function isDiscordRealtimeSpeakerContext(value) {
393
389
  return Boolean(value) && typeof value === "object" && typeof value.userId === "string" && typeof value.senderIsOwner === "boolean" && typeof value.speakerLabel === "string";
394
390
  }
395
- //#endregion
396
- //#region extensions/discord/src/voice/realtime-consults.ts
391
+ // extensions/discord/src/voice/realtime-consults.ts
397
392
  const logger$3 = createSubsystemLogger("discord/voice");
398
393
  const DISCORD_REALTIME_TALKBACK_DEBOUNCE_MS = 350;
399
394
  const DISCORD_REALTIME_FALLBACK_TEXT = "I hit an error while checking that. Please try again.";
@@ -750,8 +745,7 @@ var DiscordRealtimeConsults = class {
750
745
  this.params.harness.forcedConsults.clear();
751
746
  }
752
747
  };
753
- //#endregion
754
- //#region extensions/discord/src/voice/realtime-output.ts
748
+ // extensions/discord/src/voice/realtime-output.ts
755
749
  /** Main retains provider item identity; physical output state belongs to the worker. */
756
750
  var DiscordRealtimeOutput = class {
757
751
  constructor(params) {
@@ -890,8 +884,7 @@ var DiscordRealtimeOutput = class {
890
884
  this.params.onClose(this, reason);
891
885
  }
892
886
  };
893
- //#endregion
894
- //#region extensions/discord/src/voice/realtime-playback.ts
887
+ // extensions/discord/src/voice/realtime-playback.ts
895
888
  const logger$2 = createSubsystemLogger("discord/voice");
896
889
  const DISCORD_REALTIME_CONTROL_SPEECH_DEDUPE_MS = 5e3;
897
890
  const DISCORD_REALTIME_MAX_RETAINED_RESPONSES = 32;
@@ -1295,8 +1288,7 @@ var DiscordRealtimePlayback = class {
1295
1288
  this.drainQueuedExactSpeechMessages();
1296
1289
  }
1297
1290
  };
1298
- //#endregion
1299
- //#region extensions/discord/src/voice/realtime-speaker-session.ts
1291
+ // extensions/discord/src/voice/realtime-speaker-session.ts
1300
1292
  const logger$1 = createSubsystemLogger("discord/voice");
1301
1293
  const DISCORD_REALTIME_DUPLICATE_ERROR_SUPPRESS_MS = 6e4;
1302
1294
  const discordRealtimeTalkPayload = () => ({});
@@ -1720,8 +1712,7 @@ var DiscordRealtimeSpeakerSession = class {
1720
1712
  this.lastRealtimeError.suppressed = 0;
1721
1713
  }
1722
1714
  };
1723
- //#endregion
1724
- //#region extensions/discord/src/voice/realtime-session.runtime.ts
1715
+ // extensions/discord/src/voice/realtime-session.runtime.ts
1725
1716
  const logger = createSubsystemLogger("discord/voice");
1726
1717
  const MAX_REALTIME_SPEAKERS = 8;
1727
1718
  const REALTIME_SPEAKER_IDLE_MS = 6e4;
@@ -2058,5 +2049,4 @@ var DiscordRealtimeVoiceSession = class {
2058
2049
  logger.info(`discord voice: realtime speaker retired user=${speaker.userId} reason=${reason}${reason === "input-timeout" ? "; idle speaker input expired; speak again to reconnect" : ""}`);
2059
2050
  }
2060
2051
  };
2061
- //#endregion
2062
2052
  export { DiscordRealtimeVoiceSession };
@@ -7,7 +7,7 @@ import { resolveFfmpegBin } from "openclaw/plugin-sdk/media-runtime";
7
7
  import { createStreamingPcmResampler } from "openclaw/plugin-sdk/realtime-voice-provider";
8
8
  import { logVerbose, shouldLogVerbose } from "openclaw/plugin-sdk/runtime-env";
9
9
  import { resolvePreferredOpenClawTmpDir, tempWorkspace } from "openclaw/plugin-sdk/temp-path";
10
- //#region extensions/discord/src/voice/audio-worker-protocol.ts
10
+ // extensions/discord/src/voice/audio-worker-protocol.ts
11
11
  const DISCORD_AUDIO_OUTPUT_STATUS = 1;
12
12
  const DiscordAudioOutputStatus = {
13
13
  Buffering: 0n,
@@ -41,8 +41,7 @@ function serializeDiscordAudioError(error) {
41
41
  function restoreDiscordAudioError(error) {
42
42
  return Object.assign(new Error(error.message), error);
43
43
  }
44
- //#endregion
45
- //#region extensions/discord/src/voice/audio.ts
44
+ // extensions/discord/src/voice/audio.ts
46
45
  const SAMPLE_RATE = 48e3;
47
46
  const CHANNELS = 2;
48
47
  const BIT_DEPTH = 16;
@@ -379,8 +378,7 @@ async function writeVoiceWavFile(chunks) {
379
378
  throw error;
380
379
  }
381
380
  }
382
- //#endregion
383
- //#region extensions/discord/src/voice/receive-recovery.ts
381
+ // extensions/discord/src/voice/receive-recovery.ts
384
382
  const DECRYPT_FAILURE_WINDOW_MS = 3e4;
385
383
  const DECRYPT_FAILURE_RECONNECT_THRESHOLD = 3;
386
384
  const DECRYPT_FAILURE_MARKER = "DecryptionFailed(";
@@ -462,5 +460,4 @@ function enableDaveReceivePassthrough(params) {
462
460
  onWarn(`discord voice: failed to enable DAVE passthrough guild=${target.guildId} channel=${target.channelId} reason=${reason}`);
463
461
  }
464
462
  }
465
- //#endregion
466
463
  export { setDiscordAudioOutputStatus as _, recoverDaveZeroTransition as a, createDiscordOpusPlaybackStream as c, decodeOpusStreamChunks as d, writeVoiceWavFile as f, serializeDiscordAudioError as g, restoreDiscordAudioError as h, noteVoiceDecryptFailure as i, createDiscordPcmToRealtimeConverter as l, getDiscordAudioOutputStatus as m, analyzeVoiceReceiveError as n, resetVoiceReceiveRecoveryState as o, DiscordAudioOutputStatus as p, enableDaveReceivePassthrough as r, DiscordOpusEncodeStream as s, DECRYPT_FAILURE_WINDOW_MS as t, createRealtimePcmToDiscordConverter as u };
@@ -1,6 +1,6 @@
1
- import { h as normalizeDiscordToken } from "./accounts-C_25wyxC.mjs";
2
- import { o as normalizeDiscordSlug } from "./allow-list-BXrS8-R9.mjs";
3
- //#region extensions/discord/src/resolve-allowlist-common.ts
1
+ import { h as normalizeDiscordToken } from "./accounts-DtjvhJUj.mjs";
2
+ import { o as normalizeDiscordSlug } from "./allow-list-CkqpzPvP.mjs";
3
+ // extensions/discord/src/resolve-allowlist-common.ts
4
4
  function resolveDiscordAllowlistToken(token) {
5
5
  return normalizeDiscordToken(token, "channels.discord.token");
6
6
  }
@@ -52,5 +52,4 @@ function parseDiscordAllowlistInput(raw, kind) {
52
52
  guildOnly: true
53
53
  } : { name: trimmed.replace(/^@/, "") };
54
54
  }
55
- //#endregion
56
55
  export { parseDiscordAllowlistInput as n, resolveDiscordAllowlistToken as r, filterDiscordGuilds as t };
@@ -1,9 +1,9 @@
1
- import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.mjs";
2
- import { o as normalizeDiscordSlug, w as isDiscordThreadChannelType } from "./allow-list-BXrS8-R9.mjs";
3
- import { n as DiscordApiError, r as fetchDiscord, t as DISCORD_DIRECTORY_LOOKUP_TIMEOUT_MS } from "./api-BlBD4ism.mjs";
4
- import { n as listGuilds, t as listDiscordGuildChannels } from "./guilds-eDq22iSM.mjs";
5
- import { n as parseDiscordAllowlistInput, r as resolveDiscordAllowlistToken, t as filterDiscordGuilds } from "./resolve-allowlist-common-Bk8Fj6Ik.mjs";
6
- //#region extensions/discord/src/resolve-channels.ts
1
+ import { t as __exportAll } from "./rolldown-runtime-nwUcYXjP.mjs";
2
+ import { a as normalizeDiscordDisplaySlug, o as normalizeDiscordSlug, w as isDiscordThreadChannelType } from "./allow-list-CkqpzPvP.mjs";
3
+ import { n as DiscordApiError, r as fetchDiscord, t as DISCORD_DIRECTORY_LOOKUP_TIMEOUT_MS } from "./api-C4j_kC-2.mjs";
4
+ import { n as listGuilds, t as listDiscordGuildChannels } from "./guilds-DYBhgnfq.mjs";
5
+ import { n as parseDiscordAllowlistInput, r as resolveDiscordAllowlistToken, t as filterDiscordGuilds } from "./resolve-allowlist-common-CYdqBUgV.mjs";
6
+ // extensions/discord/src/resolve-channels.ts
7
7
  var resolve_channels_exports = /* @__PURE__ */ __exportAll({ resolveDiscordChannelAllowlist: () => resolveDiscordChannelAllowlist });
8
8
  async function listGuildChannels(token, fetcher, guildId) {
9
9
  return (await listDiscordGuildChannels(token, fetcher, guildId)).map((channel) => {
@@ -81,8 +81,10 @@ async function resolveDiscordChannelAllowlist(params) {
81
81
  const ids = channels.filter((channel) => channel.id === query);
82
82
  if (ids.length) return ids;
83
83
  }
84
- const slug = normalizeDiscordSlug(query);
85
- return channels.filter((channel) => normalizeDiscordSlug(channel.name) === slug);
84
+ const slug = normalizeDiscordDisplaySlug(query);
85
+ if (!slug) return [];
86
+ const matchSlug = normalizeDiscordSlug(query) === slug ? normalizeDiscordSlug : normalizeDiscordDisplaySlug;
87
+ return channels.filter((channel) => matchSlug(channel.name) === slug);
86
88
  }
87
89
  const resolveEntry = async (input) => {
88
90
  const parsed = parseDiscordAllowlistInput(input, "channel");
@@ -170,5 +172,4 @@ async function resolveDiscordChannelAllowlist(params) {
170
172
  for (const input of params.entries) results.push(await resolveEntry(input));
171
173
  return results;
172
174
  }
173
- //#endregion
174
175
  export { resolve_channels_exports as n, resolveDiscordChannelAllowlist as t };
@@ -1,9 +1,9 @@
1
- import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.mjs";
2
- import { t as DISCORD_DIRECTORY_LOOKUP_TIMEOUT_MS } from "./api-BlBD4ism.mjs";
3
- import { n as listGuilds, r as searchDiscordGuildMembers } from "./guilds-eDq22iSM.mjs";
4
- import { n as parseDiscordAllowlistInput, r as resolveDiscordAllowlistToken, t as filterDiscordGuilds } from "./resolve-allowlist-common-Bk8Fj6Ik.mjs";
1
+ import { t as __exportAll } from "./rolldown-runtime-nwUcYXjP.mjs";
2
+ import { t as DISCORD_DIRECTORY_LOOKUP_TIMEOUT_MS } from "./api-C4j_kC-2.mjs";
3
+ import { n as listGuilds, r as searchDiscordGuildMembers } from "./guilds-DYBhgnfq.mjs";
4
+ import { n as parseDiscordAllowlistInput, r as resolveDiscordAllowlistToken, t as filterDiscordGuilds } from "./resolve-allowlist-common-CYdqBUgV.mjs";
5
5
  import { normalizeOptionalLowercaseString, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
6
- //#region extensions/discord/src/resolve-users.ts
6
+ // extensions/discord/src/resolve-users.ts
7
7
  var resolve_users_exports = /* @__PURE__ */ __exportAll({ resolveDiscordUserAllowlist: () => resolveDiscordUserAllowlist });
8
8
  function scoreDiscordMember(member, query) {
9
9
  const q = query.toLowerCase();
@@ -82,5 +82,4 @@ async function resolveDiscordUserAllowlist(params) {
82
82
  }
83
83
  return results;
84
84
  }
85
- //#endregion
86
85
  export { resolve_users_exports as n, resolveDiscordUserAllowlist as t };
@@ -1,5 +1,5 @@
1
1
  import "node:module";
2
- //#region \0rolldown/runtime.js
2
+ // \0rolldown/runtime.js
3
3
  var __defProp = Object.defineProperty;
4
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -24,5 +24,4 @@ var __copyProps = (to, from, except, desc) => {
24
24
  return to;
25
25
  };
26
26
  var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
27
- //#endregion
28
27
  export { __reExport as n, __exportAll as t };
@@ -1,13 +1,14 @@
1
- import { c as resolveDefaultDiscordAccountId, s as mergeDiscordAccountConfig, t as createDiscordActionGate } from "./accounts-C_25wyxC.mjs";
2
- import { C as hasAnyChannelPermissionDiscord, P as createDiscordRuntimeAccountContext, R as getGateway, _ as canManageGuildMemberRoleDiscord, b as fetchChannelPermissionsDiscord, n as buildDiscordTextChunks, u as resolveDiscordTargetChannelId, v as canManageGuildRoleDiscord, w as hasAnyGuildPermissionDiscord, y as canViewDiscordGuildChannel } from "./send.shared-a_6Oeyg1.mjs";
3
- import { l as resolveDiscordChannelConfigWithFallback, n as hasConfiguredDiscordChannels, o as normalizeDiscordSlug, r as isDiscordGroupAllowedByPolicy, w as isDiscordThreadChannelType, y as resolveGroupDmAllow } from "./allow-list-BXrS8-R9.mjs";
4
- import { f as resolveDiscordReplyReference, u as createReusableDiscordReplyReference } from "./send.receipt-NZDOTZBU.mjs";
5
- import { n as resolveDiscordChannelId, t as parseDiscordTarget } from "./target-parsing-C-HyNxcE.mjs";
6
- import { A as listScheduledEventsDiscord, B as moveChannelDiscord, C as fetchChannelInfoDiscord, D as fetchVoiceStatusDiscord, E as fetchRoleInfoDiscord, F as uploadEmojiDiscord, H as setChannelPermissionDiscord, I as uploadStickerDiscord, L as createChannelDiscord, M as resolveEventCoverImage, N as timeoutMemberDiscord, O as kickMemberDiscord, P as listGuildEmojisDiscord, R as deleteChannelDiscord, S as createScheduledEventDiscord, T as fetchMemberInfoDiscord, V as removeChannelPermissionDiscord, _ as readMessagesDiscord, a as removeReactionDiscord, b as addRoleDiscord, d as deleteMessageDiscord, f as editMessageDiscord, g as pinMessageDiscord, h as listThreadsDiscord, i as removeOwnReactionsDiscord, j as removeRoleDiscord, k as listGuildChannelsDiscord, l as DiscordThreadInitialMessageError, m as listPinsDiscord, n as fetchReactionsDiscord, p as fetchMessageDiscord, r as reactMessageDiscord, s as sendVoiceMessageDiscord, u as createThreadDiscord, v as searchMessagesDiscord, w as fetchGuildInfoDiscord, x as banMemberDiscord, y as unpinMessageDiscord, z as editChannelDiscord } from "./send-CVW7V-VZ.mjs";
7
- import { r as sendStickerDiscord, t as sendMessageDiscord } from "./send.outbound-Uzcmh3Yd.mjs";
8
- import { n as getPresence } from "./presence-cache-Dq-3nH7R.mjs";
9
- import { c as coerceDiscordComponentParam, l as readDiscordComponentSpec } from "./components-YCvQ6YLS.mjs";
10
- import { r as sendDiscordComponentMessage } from "./send.components-C8YXdnO_.mjs";
1
+ import { c as resolveDefaultDiscordAccountId, l as resolveDiscordAccount, s as mergeDiscordAccountConfig, t as createDiscordActionGate } from "./accounts-DtjvhJUj.mjs";
2
+ import { c as hasAnyChannelPermissionDiscord, f as createDiscordRuntimeAccountContext, g as getGateway, i as fetchChannelPermissionsDiscord, l as hasAnyGuildPermissionDiscord, n as canManageGuildRoleDiscord, r as canViewDiscordGuildChannel, t as canManageGuildMemberRoleDiscord } from "./send.permissions-BvH_Dr8p.mjs";
3
+ import { l as resolveDiscordChannelConfigWithFallback, n as hasConfiguredDiscordChannels, o as normalizeDiscordSlug, r as isDiscordGroupAllowedByPolicy, w as isDiscordThreadChannelType, y as resolveGroupDmAllow } from "./allow-list-CkqpzPvP.mjs";
4
+ import { g as resolveDiscordReplyReference, m as createReusableDiscordReplyReference } from "./send.receipt-CZ7ks6g7.mjs";
5
+ import { n as buildDiscordTextChunks, u as resolveDiscordTargetChannelId } from "./send.shared-D2lh737v.mjs";
6
+ import { n as resolveDiscordChannelId, t as parseDiscordTarget } from "./target-parsing-BiuhcK9Q.mjs";
7
+ import { A as listScheduledEventsDiscord, B as moveChannelDiscord, C as fetchChannelInfoDiscord, D as fetchVoiceStatusDiscord, E as fetchRoleInfoDiscord, F as uploadEmojiDiscord, H as setChannelPermissionDiscord, I as uploadStickerDiscord, L as createChannelDiscord, M as resolveEventCoverImage, N as timeoutMemberDiscord, O as kickMemberDiscord, P as listGuildEmojisDiscord, R as deleteChannelDiscord, S as createScheduledEventDiscord, T as fetchMemberInfoDiscord, V as removeChannelPermissionDiscord, _ as readMessagesDiscord, a as removeReactionDiscord, b as addRoleDiscord, d as deleteMessageDiscord, f as editMessageDiscord, g as pinMessageDiscord, h as listThreadsDiscord, i as removeOwnReactionsDiscord, j as removeRoleDiscord, k as listGuildChannelsDiscord, l as DiscordThreadInitialMessageError, m as listPinsDiscord, n as fetchReactionsDiscord, p as fetchMessageDiscord, r as reactMessageDiscord, s as sendVoiceMessageDiscord, u as createThreadDiscord, v as searchMessagesDiscord, w as fetchGuildInfoDiscord, x as banMemberDiscord, y as unpinMessageDiscord, z as editChannelDiscord } from "./send-DKzwsZkm.mjs";
8
+ import { a as prepareDiscordOutboundText, r as sendStickerDiscord, t as sendMessageDiscord } from "./send.outbound-cQ4Ohmsc.mjs";
9
+ import { n as getPresence } from "./presence-cache-B3xj3b0l.mjs";
10
+ import { c as coerceDiscordComponentParam, l as readDiscordComponentSpec } from "./components-GePlato3.mjs";
11
+ import { r as sendDiscordComponentMessage } from "./send.components-CIZALYDP.mjs";
11
12
  import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
12
13
  import { asBoolean, asOptionalRecord, isRecord, normalizeLowercaseStringOrEmpty } from "openclaw/plugin-sdk/string-coerce-runtime";
13
14
  import { assertMediaNotDataUrl, jsonResult, parseAvailableTags, readNonNegativeIntegerParam, readPositiveIntegerParam, readReactionParams, readStringArrayParam, readStringParam, withNormalizedTimestamp } from "openclaw/plugin-sdk/channel-actions";
@@ -16,7 +17,7 @@ import { createChannelProgressDraftCompositor } from "openclaw/plugin-sdk/channe
16
17
  import { normalizeAccountId } from "openclaw/plugin-sdk/account-resolution";
17
18
  import { resolveOpenProviderRuntimeGroupPolicy } from "openclaw/plugin-sdk/runtime-group-policy";
18
19
  import { readBooleanParam } from "openclaw/plugin-sdk/boolean-param";
19
- //#region extensions/discord/src/actions/runtime.messaging.thread-list.ts
20
+ // extensions/discord/src/actions/runtime.messaging.thread-list.ts
20
21
  function readDiscordChannelStringField(value, ...keys) {
21
22
  if (!value || typeof value !== "object") return;
22
23
  const record = value;
@@ -74,8 +75,7 @@ function filterDiscordActiveThreadList(params) {
74
75
  })
75
76
  };
76
77
  }
77
- //#endregion
78
- //#region extensions/discord/src/actions/runtime.shared.ts
78
+ // extensions/discord/src/actions/runtime.shared.ts
79
79
  /** Discord REST auto_archive_duration allowlist (minutes). */
80
80
  const DISCORD_AUTO_ARCHIVE_MINUTES = /* @__PURE__ */ new Set([
81
81
  60,
@@ -116,6 +116,7 @@ function readDiscordChannelCreateParams(params) {
116
116
  }
117
117
  function readDiscordChannelEditParams(params) {
118
118
  const parentId = readDiscordParentIdParam(params);
119
+ const appliedTags = readStringArrayParam(params, "appliedTags", { allowEmpty: true });
119
120
  return {
120
121
  channelId: readStringParam(params, "channelId", { required: true }),
121
122
  name: readStringParam(params, "name"),
@@ -127,7 +128,8 @@ function readDiscordChannelEditParams(params) {
127
128
  archived: asBoolean(params.archived),
128
129
  locked: asBoolean(params.locked),
129
130
  autoArchiveDuration: readDiscordAutoArchiveDurationParam(params, "autoArchiveDuration"),
130
- availableTags: parseAvailableTags(params.availableTags)
131
+ availableTags: parseAvailableTags(params.availableTags),
132
+ appliedTags
131
133
  };
132
134
  }
133
135
  function readDiscordChannelMoveParams(params) {
@@ -139,8 +141,7 @@ function readDiscordChannelMoveParams(params) {
139
141
  position: readNonNegativeIntegerParam(params, "position")
140
142
  };
141
143
  }
142
- //#endregion
143
- //#region extensions/discord/src/actions/runtime.messaging.shared.ts
144
+ // extensions/discord/src/actions/runtime.messaging.shared.ts
144
145
  function allowsAllDiscordGuildChannels(channels) {
145
146
  const wildcard = channels?.["*"];
146
147
  if (!wildcard || wildcard.enabled === false) return false;
@@ -295,7 +296,10 @@ function createDiscordMessagingActionContext(params) {
295
296
  const withOpts = (extra) => createDiscordActionOptions({
296
297
  cfg: params.cfg,
297
298
  accountId,
298
- extra
299
+ extra: {
300
+ ...params.options?.callerSignal ? { callerSignal: params.options.callerSignal } : {},
301
+ ...extra
302
+ }
299
303
  });
300
304
  const resolvedReactionAccountId = accountId ?? resolveDefaultDiscordAccountId(params.cfg);
301
305
  const isCurrentReadTarget = (channelId) => {
@@ -481,13 +485,15 @@ function createDiscordMessagingActionContext(params) {
481
485
  } catch {
482
486
  return (await resolveDiscordTargetChannelId(target, {
483
487
  cfg: params.cfg,
484
- accountId: resolvedReactionAccountId
488
+ accountId: resolvedReactionAccountId,
489
+ ...params.options?.callerSignal ? { callerSignal: params.options.callerSignal } : {}
485
490
  })).channelId;
486
491
  }
487
492
  },
488
493
  withOpts,
489
494
  withReactionRuntimeOptions: (extra) => ({
490
495
  ...reactionRuntimeOptions,
496
+ ...params.options?.callerSignal ? { callerSignal: params.options.callerSignal } : {},
491
497
  ...extra
492
498
  }),
493
499
  normalizeMessage: (message) => {
@@ -496,8 +502,15 @@ function createDiscordMessagingActionContext(params) {
496
502
  }
497
503
  };
498
504
  }
499
- //#endregion
500
- //#region extensions/discord/src/actions/runtime.guild.ts
505
+ // extensions/discord/src/actions/runtime.guild.ts
506
+ /** Options for permission and metadata lookups that run before an action's own send options. */
507
+ function guildActionOptions(params) {
508
+ return createDiscordActionOptions({
509
+ cfg: params.cfg,
510
+ accountId: params.accountId,
511
+ ...params.callerSignal ? { extra: { callerSignal: params.callerSignal } } : {}
512
+ });
513
+ }
501
514
  const expressionPermissions = [PermissionFlagsBits.ManageGuildExpressions, PermissionFlagsBits.CreateGuildExpressions];
502
515
  const channelGuard = {
503
516
  gate: "channels",
@@ -565,20 +578,14 @@ async function resolveGuildIdForGuildAdminAction(params) {
565
578
  if (guildId) return guildId;
566
579
  const channelLikeId = readStringParam(params.values, "channelId") ?? readStringParam(params.values, "categoryId");
567
580
  if (!channelLikeId) return;
568
- const channel = await fetchChannelInfoDiscord(channelLikeId, createDiscordActionOptions({
569
- cfg: params.cfg,
570
- accountId: params.accountId
571
- }));
581
+ const channel = await fetchChannelInfoDiscord(channelLikeId, guildActionOptions(params));
572
582
  return "guild_id" in channel ? channel.guild_id : void 0;
573
583
  }
574
584
  async function resolveGuildAdminActionPermissions(params) {
575
585
  if (params.action !== "channelEdit") return params.guard.permissions;
576
586
  const channelId = readStringParam(params.values, "channelId");
577
587
  if (!channelId) return params.guard.permissions;
578
- const channel = await fetchChannelInfoDiscord(channelId, createDiscordActionOptions({
579
- cfg: params.cfg,
580
- accountId: params.accountId
581
- }));
588
+ const channel = await fetchChannelInfoDiscord(channelId, guildActionOptions(params));
582
589
  const channelType = "type" in channel ? channel.type : void 0;
583
590
  if (!isDiscordThreadChannelType(channelType)) return params.guard.permissions;
584
591
  const edit = readDiscordChannelEditParams(params.values);
@@ -594,10 +601,7 @@ async function verifySenderGuildAdminPermission(params) {
594
601
  });
595
602
  const guildId = await resolveGuildIdForGuildAdminAction(params);
596
603
  if (!guildId) throw new Error(`Guild id required to authorize Discord guild action: ${params.action}`);
597
- const actionOptions = createDiscordActionOptions({
598
- cfg: params.cfg,
599
- accountId: params.accountId
600
- });
604
+ const actionOptions = guildActionOptions(params);
601
605
  const targetChannelId = guard?.permissionScope === "channel" || params.action === "eventCreate" ? readStringParam(params.values, params.action === "categoryEdit" || params.action === "categoryDelete" ? "categoryId" : "channelId") : void 0;
602
606
  const hasPermission = targetChannelId ? await hasAnyChannelPermissionDiscord(guildId, targetChannelId, senderUserId, requiredPermissions, actionOptions) : await hasAnyGuildPermissionDiscord(guildId, senderUserId, requiredPermissions, actionOptions);
603
607
  const requiresCurrentThreadAccess = params.action === "channelEdit" && requiredPermissions.includes(PermissionFlagsBits.SendMessages);
@@ -626,7 +630,8 @@ async function handleDiscordGuildAction(action, params, isActionEnabled, cfg, op
626
630
  action,
627
631
  values: params,
628
632
  accountId,
629
- cfg
633
+ cfg,
634
+ ...options?.callerSignal ? { callerSignal: options.callerSignal } : {}
630
635
  });
631
636
  const readTargetGate = createDiscordMessagingActionContext({
632
637
  action,
@@ -637,12 +642,14 @@ async function handleDiscordGuildAction(action, params, isActionEnabled, cfg, op
637
642
  });
638
643
  const withOpts = () => createDiscordActionOptions({
639
644
  cfg,
640
- accountId
645
+ accountId,
646
+ ...options?.callerSignal ? { extra: { callerSignal: options.callerSignal } } : {}
641
647
  });
642
648
  const mediaPolicyOptions = {
643
649
  mediaAccess: options?.mediaAccess,
644
650
  mediaLocalRoots: options?.mediaLocalRoots,
645
- mediaReadFile: options?.mediaReadFile
651
+ mediaReadFile: options?.mediaReadFile,
652
+ ...options?.callerSignal ? { callerSignal: options.callerSignal } : {}
646
653
  };
647
654
  const readRequiredString = (key) => readStringParam(params, key, { required: true });
648
655
  const readMetadataGuildId = async (guildId = readRequiredString("guildId")) => {
@@ -668,9 +675,10 @@ async function handleDiscordGuildAction(action, params, isActionEnabled, cfg, op
668
675
  });
669
676
  }
670
677
  const effectiveAccountId = accountId ?? resolveDefaultDiscordAccountId(cfg);
671
- const member = await fetchMemberInfoDiscord(guildId, userId, createDiscordActionOptions({
678
+ const member = await fetchMemberInfoDiscord(guildId, userId, guildActionOptions({
672
679
  cfg,
673
- accountId: effectiveAccountId
680
+ accountId: effectiveAccountId,
681
+ ...options?.callerSignal ? { callerSignal: options.callerSignal } : {}
674
682
  }));
675
683
  const presence = getPresence(effectiveAccountId, userId);
676
684
  const activities = presence?.activities;
@@ -700,7 +708,8 @@ async function handleDiscordGuildAction(action, params, isActionEnabled, cfg, op
700
708
  const guildId = await resolveGuildIdForGuildAdminAction({
701
709
  values: params,
702
710
  accountId,
703
- cfg
711
+ cfg,
712
+ ...options?.callerSignal ? { callerSignal: options.callerSignal } : {}
704
713
  });
705
714
  if (!guildId) throw new Error("Discord emoji listing requires guildId or a server channel.");
706
715
  await readMetadataGuildId(guildId);
@@ -874,8 +883,7 @@ async function handleDiscordGuildAction(action, params, isActionEnabled, cfg, op
874
883
  default: throw new Error(`Unknown action: ${action}`);
875
884
  }
876
885
  }
877
- //#endregion
878
- //#region extensions/discord/src/actions/runtime.messaging.messages.ts
886
+ // extensions/discord/src/actions/runtime.messaging.messages.ts
879
887
  function parseDiscordMessageLink(link) {
880
888
  const match = link.trim().match(/^(?:https?:\/\/)?(?:ptb\.|canary\.)?discord(?:app)?\.com\/channels\/(\d+)\/(\d+)\/(\d+)(?:\/?|\?.*)$/i);
881
889
  if (!match) throw new Error("Invalid Discord message link. Expected https://discord.com/channels/<guildId>/<channelId>/<messageId>.");
@@ -894,7 +902,7 @@ async function handleDiscordMessageManagementAction(ctx) {
894
902
  if (!ctx.isActionEnabled(gate)) throw new Error(`Discord ${gate} are disabled.`);
895
903
  const channelId = ctx.resolveChannelId();
896
904
  await ctx.assertReadTargetAllowed({ channelId });
897
- const value = permissions ? await fetchChannelPermissionsDiscord(channelId, ctx.withOpts()) : (await listPinsDiscord(channelId, ctx.withOpts())).map((pin) => ctx.normalizeMessage(pin));
905
+ const value = permissions ? await fetchChannelPermissionsDiscord(channelId, ctx.withOpts()) : (await listPinsDiscord(channelId, ctx.withOpts(), readPositiveIntegerParam(ctx.params, "limit"))).map((pin) => ctx.normalizeMessage(pin));
898
906
  return jsonResult({
899
907
  ok: true,
900
908
  [gate]: value
@@ -954,11 +962,17 @@ async function handleDiscordMessageManagementAction(ctx) {
954
962
  }).getText(), {
955
963
  maxChars: Math.min(ctx.accountConfig.textChunkLimit ?? 2e3, 2e3),
956
964
  maxLinesPerMessage: Number.MAX_SAFE_INTEGER
957
- })[0] ?? "" : readStringParam(ctx.params, "content", {
965
+ })[0] ?? "" : prepareDiscordOutboundText(readStringParam(ctx.params, "content", {
958
966
  required: true,
959
967
  allowEmpty: true,
960
968
  trim: false
961
- });
969
+ }), {
970
+ cfg: ctx.cfg,
971
+ account: resolveDiscordAccount({
972
+ cfg: ctx.cfg,
973
+ accountId: ctx.accountId
974
+ })
975
+ }).textWithMentions;
962
976
  await ctx.assertReadTargetAllowed({ channelId });
963
977
  const message = await editMessageDiscord(channelId, messageId, {
964
978
  content,
@@ -1028,8 +1042,7 @@ async function handleDiscordMessageManagementAction(ctx) {
1028
1042
  default: return;
1029
1043
  }
1030
1044
  }
1031
- //#endregion
1032
- //#region extensions/discord/src/actions/runtime.messaging.send.ts
1045
+ // extensions/discord/src/actions/runtime.messaging.send.ts
1033
1046
  function resolveActionReplyReference(ctx, replyToId) {
1034
1047
  const reply = ctx.options?.reply;
1035
1048
  return reply ? resolveDiscordReplyReference({
@@ -1274,8 +1287,7 @@ async function handleDiscordMessageSendAction(ctx) {
1274
1287
  default: return;
1275
1288
  }
1276
1289
  }
1277
- //#endregion
1278
- //#region extensions/discord/src/actions/runtime.moderation-shared.ts
1290
+ // extensions/discord/src/actions/runtime.moderation-shared.ts
1279
1291
  const moderationPermissions = {
1280
1292
  timeout: PermissionFlagsBits.ModerateMembers,
1281
1293
  kick: PermissionFlagsBits.KickMembers,
@@ -1302,8 +1314,7 @@ function readDiscordModerationCommand(action, params) {
1302
1314
  })
1303
1315
  };
1304
1316
  }
1305
- //#endregion
1306
- //#region extensions/discord/src/actions/runtime.ts
1317
+ // extensions/discord/src/actions/runtime.ts
1307
1318
  const ACTIVITY_TYPE_MAP = /* @__PURE__ */ new Map([
1308
1319
  ["playing", 0],
1309
1320
  ["streaming", 1],
@@ -1385,7 +1396,8 @@ async function handleDiscordAction(params, cfg, options) {
1385
1396
  const senderUserId = readStringParam(params, "senderUserId");
1386
1397
  const withOpts = () => createDiscordActionOptions({
1387
1398
  cfg,
1388
- accountId
1399
+ accountId,
1400
+ ...options?.callerSignal ? { extra: { callerSignal: options.callerSignal } } : {}
1389
1401
  });
1390
1402
  if (!await (senderUserId ? hasAnyGuildPermissionDiscord(command.guildId, senderUserId, [requiredGuildPermissionForModerationAction(command.action)], withOpts()) : true)) throw new Error("Sender does not have required permissions for this moderation action.");
1391
1403
  const target = {
@@ -1455,5 +1467,4 @@ async function handleDiscordAction(params, cfg, options) {
1455
1467
  }
1456
1468
  throw new Error(`Unknown action: ${action}`);
1457
1469
  }
1458
- //#endregion
1459
1470
  export { readDiscordAutoArchiveDurationParam as a, readDiscordChannelMoveParams as c, requiredGuildPermissionForModerationAction as i, readDiscordParentIdParam as l, isDiscordModerationAction as n, readDiscordChannelCreateParams as o, readDiscordModerationCommand as r, readDiscordChannelEditParams as s, handleDiscordAction as t };
@@ -1,26 +1,7 @@
1
- import { _ as selectDiscordActivitiesRuntimeConfig, i as listDiscordAccountIds, l as resolveDiscordAccount, r as isDiscordAccountEnabledForRuntime } from "./accounts-C_25wyxC.mjs";
2
- import { t as resolveDiscordProxyFetchForAccount } from "./proxy-fetch-BzXwBAXt.mjs";
3
- import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
4
- //#region extensions/discord/src/activities/config.ts
5
- function resolveDiscordActivitiesConfig(account, env = process.env) {
6
- if (!account.activities) return {
7
- enabled: false,
8
- reason: "not-configured"
9
- };
10
- const clientSecret = normalizeOptionalString(account.activities.clientSecret) ?? normalizeOptionalString(env.DISCORD_CLIENT_SECRET);
11
- if (!clientSecret) return {
12
- enabled: false,
13
- reason: "missing-client-secret"
14
- };
15
- const applicationId = normalizeOptionalString(account.activities.applicationId);
16
- return {
17
- enabled: true,
18
- clientSecret,
19
- ...applicationId ? { applicationId } : {}
20
- };
21
- }
22
- //#endregion
23
- //#region extensions/discord/src/activities/runtime.ts
1
+ import { _ as selectDiscordActivitiesRuntimeConfig, i as listDiscordAccountIds, l as resolveDiscordAccount, r as isDiscordAccountEnabledForRuntime } from "./accounts-DtjvhJUj.mjs";
2
+ import { t as resolveDiscordProxyFetchForAccount } from "./proxy-fetch-B8cK6FLQ.mjs";
3
+ import { t as resolveDiscordActivitiesConfig } from "./config-DDwcUaxT.mjs";
4
+ // extensions/discord/src/activities/runtime.ts
24
5
  var DiscordActivitiesRuntime = class {
25
6
  constructor(store, getCurrentConfig, env = process.env) {
26
7
  this.store = store;
@@ -73,5 +54,4 @@ function setDiscordActivitiesRuntime(runtime) {
73
54
  function getDiscordActivitiesRuntime() {
74
55
  return activeRuntime;
75
56
  }
76
- //#endregion
77
57
  export { getDiscordActivitiesRuntime as n, setDiscordActivitiesRuntime as r, DiscordActivitiesRuntime as t };
@@ -1,8 +1,7 @@
1
1
  import { createPluginRuntimeStore } from "openclaw/plugin-sdk/runtime-store";
2
- //#region extensions/discord/src/runtime.ts
2
+ // extensions/discord/src/runtime.ts
3
3
  const { setRuntime: setDiscordRuntime, tryGetRuntime: getOptionalDiscordRuntime, getRuntime: getDiscordRuntime } = createPluginRuntimeStore({
4
4
  pluginId: "discord",
5
5
  errorMessage: "Discord runtime not initialized"
6
6
  });
7
- //#endregion
8
7
  export { getOptionalDiscordRuntime as n, setDiscordRuntime as r, getDiscordRuntime as t };