@openclaw/discord 2026.11.7 → 2026.11.10-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 (124) 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-C3j0qLDp.mjs → allow-list-CkqpzPvP.mjs} +4 -8
  6. package/dist/.setup/{api-DYRggUgK.mjs → api-C4j_kC-2.mjs} +4 -6
  7. package/dist/.setup/{approval-handler.runtime-BN4W1r0o.mjs → approval-handler.runtime-DXzPFNvC.mjs} +10 -10
  8. package/dist/.setup/{approval-message-updates-DKsCfxSW.mjs → approval-message-updates-DqOXxPss.mjs} +3 -4
  9. package/dist/.setup/{audit-BL6EoUun.mjs → audit-B9vk3V2z.mjs} +6 -7
  10. package/dist/.setup/{channel-DdI2l55_.mjs → channel-CKffiPiV.mjs} +38 -41
  11. package/dist/.setup/{channel-access-9cyzozUP.mjs → channel-access-DhJhVrdZ.mjs} +1 -2
  12. package/dist/.setup/{channel.setup-kNWMxlgu.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-C1Phe3uw.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-K_jFbvi5.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-CY2-qrHI.mjs → directory-live-B9UoQG9g.mjs} +9 -64
  23. package/dist/.setup/{discord-BRVFhk09.mjs → discord-cXPUdHQi.mjs} +98 -77
  24. package/dist/.setup/{doctor-RqH-6JB0.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-BSnrns-F.mjs → guilds-DYBhgnfq.mjs} +3 -4
  28. package/dist/.setup/{handle-action-uD87h2FK.mjs → handle-action-El1ok7Ak.mjs} +13 -12
  29. package/dist/.setup/{handle-action.guild-admin-CqBx_3mG.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-DnHLrLIN.mjs → listeners-DIyynRvV.mjs} +2 -3
  32. package/dist/.setup/{live-policy-config-y0Qy36X3.mjs → live-policy-config-DjIHWFla.mjs} +3 -5
  33. package/dist/.setup/{message-handler-CWL_u0X8.mjs → message-handler-DP3cAQCZ.mjs} +18 -17
  34. package/dist/.setup/{message-handler.preflight-83tpEdBG.mjs → message-handler.preflight-S5yc9UdR.mjs} +20 -27
  35. package/dist/.setup/{message-handler.preflight-pluralkit-Dhcx7Ifz.mjs → message-handler.preflight-pluralkit-BFntgVKc.mjs} +10 -14
  36. package/dist/.setup/{message-handler.process-BC-wNZwK.mjs → message-handler.process-bXE_4sq5.mjs} +56 -67
  37. package/dist/.setup/oauth-http-DdVyzSbo.mjs +40 -0
  38. package/dist/.setup/{outbound-payload-CK3_bDvK.mjs → outbound-payload-Dh6xCO6z.mjs} +18 -13
  39. package/dist/.setup/{outbound-session-route-Ay_DnOOl.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-CbDJojNV.mjs → probe-CfGMZwFD.mjs} +5 -6
  45. package/dist/.setup/{provider-CRb3Myky.mjs → provider-BA4ysXXm.mjs} +200 -249
  46. package/dist/.setup/{provider-session.runtime-3cZpps3H.mjs → provider-session.runtime-Cr2oPicL.mjs} +3 -3
  47. package/dist/.setup/provider.runtime-D4BlQKDq.mjs +1 -0
  48. package/dist/.setup/{proxy-fetch-BzXwBAXt.mjs → proxy-fetch-B8cK6FLQ.mjs} +1 -2
  49. package/dist/.setup/{realtime-session.runtime-BRYpjS9P.mjs → realtime-session.runtime-DQvAKxj9.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-B-S0wRIw.mjs → resolve-allowlist-common-CYdqBUgV.mjs} +3 -4
  52. package/dist/.setup/{resolve-channels-g16NM6Ho.mjs → resolve-channels-BNnyfCR8.mjs} +6 -7
  53. package/dist/.setup/{resolve-users-DAfOOXdy.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--HZ9r3tF.mjs → runtime-CkeNX7ic.mjs} +59 -50
  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-CtvwfZQ2.mjs → send-DKzwsZkm.mjs} +26 -31
  64. package/dist/.setup/{send.components-CtLtE0yD.mjs → send.components-CIZALYDP.mjs} +12 -14
  65. package/dist/.setup/{send.outbound-D58xXPgs.mjs → send.outbound-cQ4Ohmsc.mjs} +11 -16
  66. package/dist/.setup/send.permissions-BvH_Dr8p.mjs +369 -0
  67. package/dist/.setup/{send.receipt-DLOV4qx6.mjs → send.receipt-CZ7ks6g7.mjs} +64 -17
  68. package/dist/.setup/send.shared-D2lh737v.mjs +259 -0
  69. package/dist/.setup/{sender-identity-BbA7FNbr.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-Dv2DamaK.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-yT45eTyz.mjs → subagent-hooks-CVmIOrAR.mjs} +4 -5
  76. package/dist/.setup/{system-events-Dlzp9Jcj.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-BzaZPBm9.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-DRWhgKCc.mjs → thread-bindings-DTHVdmvF.mjs} +7 -10
  81. package/dist/.setup/{thread-bindings.manager-CWJKirn1.mjs → thread-bindings.manager-6EnH3YZh.mjs} +45 -30
  82. package/dist/.setup/{thread-bindings.session-updates-DzJrXc4w.mjs → thread-bindings.session-updates-BPO6pPzd.mjs} +9 -12
  83. package/dist/.setup/{threading-BbsPuT5G.mjs → threading-PC3IIaHd.mjs} +5 -7
  84. package/dist/.setup/{timeouts-cIxzatmv.mjs → timeouts-CT9hnmo4.mjs} +1 -2
  85. package/dist/.setup/{transcripts-source-DIW1fU_P.mjs → transcripts-source-C3F_ErM1.mjs} +20 -33
  86. package/dist/.setup/{typing-CNlSKY5S.mjs → typing-DAv4S2fI.mjs} +2 -3
  87. package/dist/.setup/{voice-runtime-oJ6BZs5D.mjs → voice-runtime-CZGbraKC.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/provider.runtime-tmkt3QOg.mjs +0 -1
  123. package/dist/.setup/send.shared-B_KKRrD7.mjs +0 -589
  124. package/dist/.setup/setup-plugin-api-ty5RJrMy.mjs +0 -2
@@ -1,6 +1,6 @@
1
- import { i as createNoopThreadBindingManager, t as createThreadBindingManager } from "./thread-bindings.manager-CWJKirn1.mjs";
2
- import { l as reconcileAcpThreadBindingsOnStartup } from "./thread-bindings-DRWhgKCc.mjs";
3
- import { t as createDiscordMessageHandler } from "./message-handler-CWL_u0X8.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-DP3cAQCZ.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-BA4ysXXm.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-CRb3Myky.mjs";
5
- import { a as maybeControlDiscordVoiceAgentRun, i as logDiscordVoiceAgentControlResult, n as formatVoiceIngressPrompt, r as handleDiscordVoiceAgentControlToolCall, t as DiscordRealtimeRecording } from "./voice-runtime-oJ6BZs5D.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-BA4ysXXm.mjs";
5
+ import { a as maybeControlDiscordVoiceAgentRun, i as logDiscordVoiceAgentControlResult, n as formatVoiceIngressPrompt, r as handleDiscordVoiceAgentControlToolCall, t as DiscordRealtimeRecording } from "./voice-runtime-CZGbraKC.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 = () => ({});
@@ -1722,8 +1714,7 @@ var DiscordRealtimeSpeakerSession = class {
1722
1714
  this.lastRealtimeError.suppressed = 0;
1723
1715
  }
1724
1716
  };
1725
- //#endregion
1726
- //#region extensions/discord/src/voice/realtime-session.runtime.ts
1717
+ // extensions/discord/src/voice/realtime-session.runtime.ts
1727
1718
  const logger = createSubsystemLogger("discord/voice");
1728
1719
  const MAX_REALTIME_SPEAKERS = 8;
1729
1720
  const REALTIME_SPEAKER_IDLE_MS = 6e4;
@@ -2060,5 +2051,4 @@ var DiscordRealtimeVoiceSession = class {
2060
2051
  logger.info(`discord voice: realtime speaker retired user=${speaker.userId} reason=${reason}${reason === "input-timeout" ? "; idle speaker input expired; speak again to reconnect" : ""}`);
2061
2052
  }
2062
2053
  };
2063
- //#endregion
2064
2054
  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-C3j0qLDp.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 { a as normalizeDiscordDisplaySlug, o as normalizeDiscordSlug, w as isDiscordThreadChannelType } from "./allow-list-C3j0qLDp.mjs";
3
- import { n as DiscordApiError, r as fetchDiscord, t as DISCORD_DIRECTORY_LOOKUP_TIMEOUT_MS } from "./api-DYRggUgK.mjs";
4
- import { n as listGuilds, t as listDiscordGuildChannels } from "./guilds-BSnrns-F.mjs";
5
- import { n as parseDiscordAllowlistInput, r as resolveDiscordAllowlistToken, t as filterDiscordGuilds } from "./resolve-allowlist-common-B-S0wRIw.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) => {
@@ -172,5 +172,4 @@ async function resolveDiscordChannelAllowlist(params) {
172
172
  for (const input of params.entries) results.push(await resolveEntry(input));
173
173
  return results;
174
174
  }
175
- //#endregion
176
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-DYRggUgK.mjs";
3
- import { n as listGuilds, r as searchDiscordGuildMembers } from "./guilds-BSnrns-F.mjs";
4
- import { n as parseDiscordAllowlistInput, r as resolveDiscordAllowlistToken, t as filterDiscordGuilds } from "./resolve-allowlist-common-B-S0wRIw.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-B_KKRrD7.mjs";
3
- import { l as resolveDiscordChannelConfigWithFallback, n as hasConfiguredDiscordChannels, o as normalizeDiscordSlug, r as isDiscordGroupAllowedByPolicy, w as isDiscordThreadChannelType, y as resolveGroupDmAllow } from "./allow-list-C3j0qLDp.mjs";
4
- import { f as resolveDiscordReplyReference, u as createReusableDiscordReplyReference } from "./send.receipt-DLOV4qx6.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-CtvwfZQ2.mjs";
7
- import { r as sendStickerDiscord, t as sendMessageDiscord } from "./send.outbound-D58xXPgs.mjs";
8
- import { n as getPresence } from "./presence-cache-Dq-3nH7R.mjs";
9
- import { c as coerceDiscordComponentParam, l as readDiscordComponentSpec } from "./components-C1Phe3uw.mjs";
10
- import { r as sendDiscordComponentMessage } from "./send.components-CtLtE0yD.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,
@@ -141,8 +141,7 @@ function readDiscordChannelMoveParams(params) {
141
141
  position: readNonNegativeIntegerParam(params, "position")
142
142
  };
143
143
  }
144
- //#endregion
145
- //#region extensions/discord/src/actions/runtime.messaging.shared.ts
144
+ // extensions/discord/src/actions/runtime.messaging.shared.ts
146
145
  function allowsAllDiscordGuildChannels(channels) {
147
146
  const wildcard = channels?.["*"];
148
147
  if (!wildcard || wildcard.enabled === false) return false;
@@ -297,7 +296,10 @@ function createDiscordMessagingActionContext(params) {
297
296
  const withOpts = (extra) => createDiscordActionOptions({
298
297
  cfg: params.cfg,
299
298
  accountId,
300
- extra
299
+ extra: {
300
+ ...params.options?.callerSignal ? { callerSignal: params.options.callerSignal } : {},
301
+ ...extra
302
+ }
301
303
  });
302
304
  const resolvedReactionAccountId = accountId ?? resolveDefaultDiscordAccountId(params.cfg);
303
305
  const isCurrentReadTarget = (channelId) => {
@@ -483,13 +485,15 @@ function createDiscordMessagingActionContext(params) {
483
485
  } catch {
484
486
  return (await resolveDiscordTargetChannelId(target, {
485
487
  cfg: params.cfg,
486
- accountId: resolvedReactionAccountId
488
+ accountId: resolvedReactionAccountId,
489
+ ...params.options?.callerSignal ? { callerSignal: params.options.callerSignal } : {}
487
490
  })).channelId;
488
491
  }
489
492
  },
490
493
  withOpts,
491
494
  withReactionRuntimeOptions: (extra) => ({
492
495
  ...reactionRuntimeOptions,
496
+ ...params.options?.callerSignal ? { callerSignal: params.options.callerSignal } : {},
493
497
  ...extra
494
498
  }),
495
499
  normalizeMessage: (message) => {
@@ -498,8 +502,15 @@ function createDiscordMessagingActionContext(params) {
498
502
  }
499
503
  };
500
504
  }
501
- //#endregion
502
- //#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
+ }
503
514
  const expressionPermissions = [PermissionFlagsBits.ManageGuildExpressions, PermissionFlagsBits.CreateGuildExpressions];
504
515
  const channelGuard = {
505
516
  gate: "channels",
@@ -567,20 +578,14 @@ async function resolveGuildIdForGuildAdminAction(params) {
567
578
  if (guildId) return guildId;
568
579
  const channelLikeId = readStringParam(params.values, "channelId") ?? readStringParam(params.values, "categoryId");
569
580
  if (!channelLikeId) return;
570
- const channel = await fetchChannelInfoDiscord(channelLikeId, createDiscordActionOptions({
571
- cfg: params.cfg,
572
- accountId: params.accountId
573
- }));
581
+ const channel = await fetchChannelInfoDiscord(channelLikeId, guildActionOptions(params));
574
582
  return "guild_id" in channel ? channel.guild_id : void 0;
575
583
  }
576
584
  async function resolveGuildAdminActionPermissions(params) {
577
585
  if (params.action !== "channelEdit") return params.guard.permissions;
578
586
  const channelId = readStringParam(params.values, "channelId");
579
587
  if (!channelId) return params.guard.permissions;
580
- const channel = await fetchChannelInfoDiscord(channelId, createDiscordActionOptions({
581
- cfg: params.cfg,
582
- accountId: params.accountId
583
- }));
588
+ const channel = await fetchChannelInfoDiscord(channelId, guildActionOptions(params));
584
589
  const channelType = "type" in channel ? channel.type : void 0;
585
590
  if (!isDiscordThreadChannelType(channelType)) return params.guard.permissions;
586
591
  const edit = readDiscordChannelEditParams(params.values);
@@ -596,10 +601,7 @@ async function verifySenderGuildAdminPermission(params) {
596
601
  });
597
602
  const guildId = await resolveGuildIdForGuildAdminAction(params);
598
603
  if (!guildId) throw new Error(`Guild id required to authorize Discord guild action: ${params.action}`);
599
- const actionOptions = createDiscordActionOptions({
600
- cfg: params.cfg,
601
- accountId: params.accountId
602
- });
604
+ const actionOptions = guildActionOptions(params);
603
605
  const targetChannelId = guard?.permissionScope === "channel" || params.action === "eventCreate" ? readStringParam(params.values, params.action === "categoryEdit" || params.action === "categoryDelete" ? "categoryId" : "channelId") : void 0;
604
606
  const hasPermission = targetChannelId ? await hasAnyChannelPermissionDiscord(guildId, targetChannelId, senderUserId, requiredPermissions, actionOptions) : await hasAnyGuildPermissionDiscord(guildId, senderUserId, requiredPermissions, actionOptions);
605
607
  const requiresCurrentThreadAccess = params.action === "channelEdit" && requiredPermissions.includes(PermissionFlagsBits.SendMessages);
@@ -628,7 +630,8 @@ async function handleDiscordGuildAction(action, params, isActionEnabled, cfg, op
628
630
  action,
629
631
  values: params,
630
632
  accountId,
631
- cfg
633
+ cfg,
634
+ ...options?.callerSignal ? { callerSignal: options.callerSignal } : {}
632
635
  });
633
636
  const readTargetGate = createDiscordMessagingActionContext({
634
637
  action,
@@ -639,12 +642,14 @@ async function handleDiscordGuildAction(action, params, isActionEnabled, cfg, op
639
642
  });
640
643
  const withOpts = () => createDiscordActionOptions({
641
644
  cfg,
642
- accountId
645
+ accountId,
646
+ ...options?.callerSignal ? { extra: { callerSignal: options.callerSignal } } : {}
643
647
  });
644
648
  const mediaPolicyOptions = {
645
649
  mediaAccess: options?.mediaAccess,
646
650
  mediaLocalRoots: options?.mediaLocalRoots,
647
- mediaReadFile: options?.mediaReadFile
651
+ mediaReadFile: options?.mediaReadFile,
652
+ ...options?.callerSignal ? { callerSignal: options.callerSignal } : {}
648
653
  };
649
654
  const readRequiredString = (key) => readStringParam(params, key, { required: true });
650
655
  const readMetadataGuildId = async (guildId = readRequiredString("guildId")) => {
@@ -670,9 +675,10 @@ async function handleDiscordGuildAction(action, params, isActionEnabled, cfg, op
670
675
  });
671
676
  }
672
677
  const effectiveAccountId = accountId ?? resolveDefaultDiscordAccountId(cfg);
673
- const member = await fetchMemberInfoDiscord(guildId, userId, createDiscordActionOptions({
678
+ const member = await fetchMemberInfoDiscord(guildId, userId, guildActionOptions({
674
679
  cfg,
675
- accountId: effectiveAccountId
680
+ accountId: effectiveAccountId,
681
+ ...options?.callerSignal ? { callerSignal: options.callerSignal } : {}
676
682
  }));
677
683
  const presence = getPresence(effectiveAccountId, userId);
678
684
  const activities = presence?.activities;
@@ -702,7 +708,8 @@ async function handleDiscordGuildAction(action, params, isActionEnabled, cfg, op
702
708
  const guildId = await resolveGuildIdForGuildAdminAction({
703
709
  values: params,
704
710
  accountId,
705
- cfg
711
+ cfg,
712
+ ...options?.callerSignal ? { callerSignal: options.callerSignal } : {}
706
713
  });
707
714
  if (!guildId) throw new Error("Discord emoji listing requires guildId or a server channel.");
708
715
  await readMetadataGuildId(guildId);
@@ -876,8 +883,7 @@ async function handleDiscordGuildAction(action, params, isActionEnabled, cfg, op
876
883
  default: throw new Error(`Unknown action: ${action}`);
877
884
  }
878
885
  }
879
- //#endregion
880
- //#region extensions/discord/src/actions/runtime.messaging.messages.ts
886
+ // extensions/discord/src/actions/runtime.messaging.messages.ts
881
887
  function parseDiscordMessageLink(link) {
882
888
  const match = link.trim().match(/^(?:https?:\/\/)?(?:ptb\.|canary\.)?discord(?:app)?\.com\/channels\/(\d+)\/(\d+)\/(\d+)(?:\/?|\?.*)$/i);
883
889
  if (!match) throw new Error("Invalid Discord message link. Expected https://discord.com/channels/<guildId>/<channelId>/<messageId>.");
@@ -896,7 +902,7 @@ async function handleDiscordMessageManagementAction(ctx) {
896
902
  if (!ctx.isActionEnabled(gate)) throw new Error(`Discord ${gate} are disabled.`);
897
903
  const channelId = ctx.resolveChannelId();
898
904
  await ctx.assertReadTargetAllowed({ channelId });
899
- 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));
900
906
  return jsonResult({
901
907
  ok: true,
902
908
  [gate]: value
@@ -956,11 +962,17 @@ async function handleDiscordMessageManagementAction(ctx) {
956
962
  }).getText(), {
957
963
  maxChars: Math.min(ctx.accountConfig.textChunkLimit ?? 2e3, 2e3),
958
964
  maxLinesPerMessage: Number.MAX_SAFE_INTEGER
959
- })[0] ?? "" : readStringParam(ctx.params, "content", {
965
+ })[0] ?? "" : prepareDiscordOutboundText(readStringParam(ctx.params, "content", {
960
966
  required: true,
961
967
  allowEmpty: true,
962
968
  trim: false
963
- });
969
+ }), {
970
+ cfg: ctx.cfg,
971
+ account: resolveDiscordAccount({
972
+ cfg: ctx.cfg,
973
+ accountId: ctx.accountId
974
+ })
975
+ }).textWithMentions;
964
976
  await ctx.assertReadTargetAllowed({ channelId });
965
977
  const message = await editMessageDiscord(channelId, messageId, {
966
978
  content,
@@ -1030,8 +1042,7 @@ async function handleDiscordMessageManagementAction(ctx) {
1030
1042
  default: return;
1031
1043
  }
1032
1044
  }
1033
- //#endregion
1034
- //#region extensions/discord/src/actions/runtime.messaging.send.ts
1045
+ // extensions/discord/src/actions/runtime.messaging.send.ts
1035
1046
  function resolveActionReplyReference(ctx, replyToId) {
1036
1047
  const reply = ctx.options?.reply;
1037
1048
  return reply ? resolveDiscordReplyReference({
@@ -1276,8 +1287,7 @@ async function handleDiscordMessageSendAction(ctx) {
1276
1287
  default: return;
1277
1288
  }
1278
1289
  }
1279
- //#endregion
1280
- //#region extensions/discord/src/actions/runtime.moderation-shared.ts
1290
+ // extensions/discord/src/actions/runtime.moderation-shared.ts
1281
1291
  const moderationPermissions = {
1282
1292
  timeout: PermissionFlagsBits.ModerateMembers,
1283
1293
  kick: PermissionFlagsBits.KickMembers,
@@ -1304,8 +1314,7 @@ function readDiscordModerationCommand(action, params) {
1304
1314
  })
1305
1315
  };
1306
1316
  }
1307
- //#endregion
1308
- //#region extensions/discord/src/actions/runtime.ts
1317
+ // extensions/discord/src/actions/runtime.ts
1309
1318
  const ACTIVITY_TYPE_MAP = /* @__PURE__ */ new Map([
1310
1319
  ["playing", 0],
1311
1320
  ["streaming", 1],
@@ -1387,7 +1396,8 @@ async function handleDiscordAction(params, cfg, options) {
1387
1396
  const senderUserId = readStringParam(params, "senderUserId");
1388
1397
  const withOpts = () => createDiscordActionOptions({
1389
1398
  cfg,
1390
- accountId
1399
+ accountId,
1400
+ ...options?.callerSignal ? { extra: { callerSignal: options.callerSignal } } : {}
1391
1401
  });
1392
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.");
1393
1403
  const target = {
@@ -1457,5 +1467,4 @@ async function handleDiscordAction(params, cfg, options) {
1457
1467
  }
1458
1468
  throw new Error(`Unknown action: ${action}`);
1459
1469
  }
1460
- //#endregion
1461
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 };
@@ -1,5 +1,5 @@
1
- import { n as __reExport, t as __exportAll } from "./rolldown-runtime-B4FMCO8f.mjs";
2
- //#region packages/normalization-core/src/record-coerce.ts
1
+ import { n as __reExport, t as __exportAll } from "./rolldown-runtime-nwUcYXjP.mjs";
2
+ // packages/normalization-core/src/record-coerce.ts
3
3
  /** Type guard for non-array object records at browser-safe boundaries. */
4
4
  function isRecord(value) {
5
5
  return value !== null && typeof value === "object" && !Array.isArray(value);
@@ -8,8 +8,7 @@ function isRecord(value) {
8
8
  function asNullableRecord(value) {
9
9
  return isRecord(value) ? value : null;
10
10
  }
11
- //#endregion
12
- //#region src/config/channel-config-normalization.ts
11
+ // src/config/channel-config-normalization.ts
13
12
  /** Applies one channel-specific doctor migration to every object-shaped account. */
14
13
  function normalizeChannelAccounts(params) {
15
14
  const rawAccounts = asNullableRecord(params.entry.accounts);
@@ -85,8 +84,7 @@ function normalizeChannelConfigEntries(params) {
85
84
  changes
86
85
  };
87
86
  }
88
- //#endregion
89
- //#region src/plugin-sdk/legacy-webhook-listener-migration.ts
87
+ // src/plugin-sdk/legacy-webhook-listener-migration.ts
90
88
  /** Preserve explicitly configured webhook listeners while moving ingress onto Gateway routes. */
91
89
  function createLegacyWebhookListenerDoctorContract(params) {
92
90
  const portKey = params.portKey ?? "webhookPort";
@@ -156,10 +154,8 @@ function createLegacyWebhookListenerDoctorContract(params) {
156
154
  }
157
155
  };
158
156
  }
159
- //#endregion
160
- //#region \0openclaw:bundled-sdk:openclaw/plugin-sdk/runtime-doctor-migrations
157
+ // \0openclaw:bundled-sdk:openclaw/plugin-sdk/runtime-doctor-migrations
161
158
  var runtime_doctor_migrations_exports = /* @__PURE__ */ __exportAll({ createLegacyWebhookListenerDoctorContract: () => createLegacyWebhookListenerDoctorContract });
162
159
  import * as import_openclaw_plugin_sdk_runtime_doctor_migrations from "openclaw/plugin-sdk/runtime-doctor-migrations";
163
160
  __reExport(runtime_doctor_migrations_exports, import_openclaw_plugin_sdk_runtime_doctor_migrations);
164
- //#endregion
165
161
  export { runtime_doctor_migrations_exports as t };
@@ -1,7 +1,7 @@
1
1
  import { normalizeAccountId } from "openclaw/plugin-sdk/account-id";
2
2
  import { collectNestedChannelFieldAssignments, collectSimpleChannelFieldAssignments, createChannelSecretTargetRegistryEntries, getChannelRecord, hasConfiguredSecretInputValue, isBaseFieldActiveForChannelSurface, isEnabledFlag, isRecord, resolveChannelAccountSurface } from "openclaw/plugin-sdk/channel-secret-basic-runtime";
3
3
  import { collectNestedChannelTtsAssignments } from "openclaw/plugin-sdk/channel-secret-tts-runtime";
4
- //#region extensions/discord/src/secret-config-contract.ts
4
+ // extensions/discord/src/secret-config-contract.ts
5
5
  function discordRealtimeVoiceSecretOwnerId(accountId, providerId) {
6
6
  return `discord:voice:realtime:${normalizeAccountId(accountId)}:${providerId}`;
7
7
  }
@@ -69,5 +69,4 @@ function collectRuntimeConfigAssignments(params) {
69
69
  accountInactiveReason: "Discord account is disabled, voice is disabled, or voice mode is stt-tts for this account."
70
70
  });
71
71
  }
72
- //#endregion
73
72
  export { discordRealtimeVoiceSecretOwnerId as n, secretTargetRegistryEntries as r, collectRuntimeConfigAssignments as t };