@openclaw/discord 2026.8.1-beta.2 → 2026.8.1-beta.3

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 (100) hide show
  1. package/dist/{account-inspect-CqzrH14k.js → account-inspect-D5xmUpnj.js} +1 -1
  2. package/dist/account-inspect-api.js +1 -1
  3. package/dist/accounts-DNl-oCEw.js +371 -0
  4. package/dist/action-runtime-api.js +1 -1
  5. package/dist/{activities-api-DS7vpdtp.js → activities-api-KCBAmWxD.js} +133 -175
  6. package/dist/activities-api.js +1 -1
  7. package/dist/api.js +17 -17
  8. package/dist/{approval-handler.runtime-B6yEV79q.js → approval-handler.runtime-B12RCYr8.js} +6 -6
  9. package/dist/{approval-message-safety-AcIxvrf3.js → approval-message-safety-XGFPbDoI.js} +89 -3
  10. package/dist/{audit-Db-rlntl.js → audit-Yc7eZDd6.js} +5 -5
  11. package/dist/{channel-actions-5s_hjYKd.js → channel-actions-Dr2QI8Bf.js} +10 -6
  12. package/dist/{channel-actions.runtime-CLKrx6tr.js → channel-actions.runtime-CODTvo7c.js} +53 -68
  13. package/dist/{channel-CnnbJSt5.js → channel-cXYzGc4L.js} +74 -50
  14. package/dist/channel-config-api.js +1 -1
  15. package/dist/channel-plugin-api.js +1 -1
  16. package/dist/{channel.setup-BFAO-V1P.js → channel.setup-CSiwnMgs.js} +5 -5
  17. package/dist/{outbound-session-route-DxLkrgKQ.js → components-ezGKo_Yh.js} +3 -49
  18. package/dist/{config-schema-BgEskFAs.js → config-schema-DC5kDtQ5.js} +33 -7
  19. package/dist/conversation-binding-route-D6rCQ5S0.js +43 -0
  20. package/dist/{directory-config-BVX7Cflc.js → directory-config-XyCfoqLg.js} +2 -2
  21. package/dist/directory-contract-api.js +1 -1
  22. package/dist/{directory-live-DGIGxpIo.js → directory-live-Df0NbFJB.js} +3 -3
  23. package/dist/{doctor-BzC-TLnB.js → doctor-DYY31GrO.js} +33 -12
  24. package/dist/doctor-contract-api.js +3 -3
  25. package/dist/{handle-action.guild-admin-BNVTUISF.js → handle-action.guild-admin-6Tvvinsa.js} +2 -2
  26. package/dist/index.js +3 -4
  27. package/dist/{message-handler-Unk_f10F.js → message-handler-B61q5MOF.js} +82 -6
  28. package/dist/{message-handler.preflight-C9zecxR9.js → message-handler.preflight-Bzg_Hawz.js} +36 -46
  29. package/dist/{message-handler.process-DWQ6UHHu.js → message-handler.process--4_712Ec.js} +159 -183
  30. package/dist/{message-utils-BSCPVgy0.js → message-utils-BXLLnFl6.js} +31 -32
  31. package/dist/{outbound-adapter-D9nRivT1.js → outbound-adapter-DxHTOqiN.js} +83 -53
  32. package/dist/{outbound-components-cTzwBJ60.js → outbound-components-B2PL0ooH.js} +3 -3
  33. package/dist/owner-access-Bg41VzAf.js +107 -0
  34. package/dist/{pluralkit-DdiJ9KMK.js → pluralkit-dUl4v1X3.js} +1 -1
  35. package/dist/{probe-Bl-k5_Ku.js → probe-BTdtVRwU.js} +1 -1
  36. package/dist/{probe.runtime-M9fREKvp.js → probe.runtime-Dq5-PRKT.js} +1 -1
  37. package/dist/{provider-DvSNb-2v.js → provider-DlK_ynqt.js} +356 -967
  38. package/dist/{provider-session.runtime-BUEqD0rA.js → provider-session.runtime-CvvphHvs.js} +3 -3
  39. package/dist/provider.runtime-CzKGRiAF.js +2 -0
  40. package/dist/{realtime-session.runtime-C7wen-aF.js → realtime-session.runtime-ysbMG8v7.js} +24 -13
  41. package/dist/{resolve-allowlist-common-D04lpEzb.js → resolve-allowlist-common-DIVXbD1P.js} +2 -2
  42. package/dist/{resolve-channels-Dm7jEeg6.js → resolve-channels-CGeUoIqb.js} +3 -3
  43. package/dist/{resolve-users-bktrCUUU.js → resolve-users-BtKxLUZv.js} +2 -2
  44. package/dist/{retry-CLpJcXXf.js → retry-DNsVTeTo.js} +18 -64
  45. package/dist/{runtime-DoHjckYm.js → runtime-CQovMsH3.js} +9 -10
  46. package/dist/{runtime-DGsSyDTS.js → runtime-D71_VFLr.js} +29 -43
  47. package/dist/runtime-api.actions.js +2 -2
  48. package/dist/runtime-api.js +22 -21
  49. package/dist/runtime-api.lookup.js +5 -5
  50. package/dist/runtime-api.monitor-CzeTYF32.js +6 -0
  51. package/dist/runtime-api.monitor.js +6 -5
  52. package/dist/runtime-api.send.js +6 -6
  53. package/dist/runtime-api.threads.js +4 -4
  54. package/dist/{sdk-runtime-QpY8PvCh.js → sdk-runtime-37OU6_Yh.js} +3 -4
  55. package/dist/{secret-config-contract-B1akrlyY.js → secret-config-contract-B3i6WxV5.js} +53 -25
  56. package/dist/secret-contract-api.js +1 -1
  57. package/dist/security-audit-contract-api.js +1 -1
  58. package/dist/{security-audit.runtime-CPN0xFYz.js → security-audit.runtime-BVKF9VtY.js} +1 -1
  59. package/dist/{send-B7Q6Oc1I.js → send-rQIffSYu.js} +10 -10
  60. package/dist/{send.components-iJyFXw9L.js → send.components-ChK1wS7w.js} +14 -24
  61. package/dist/{send.outbound-DS5tHwfR.js → send.outbound-HIkgji_7.js} +26 -16
  62. package/dist/{send.reactions-BAn0iiVQ.js → send.reactions-gmJ6yFPo.js} +2 -2
  63. package/dist/{send.receipt-IPI1p-SP.js → send.receipt-Cnhoautb.js} +11 -1
  64. package/dist/{send.shared-BmwFjW6T.js → send.shared-B3fpaLWJ.js} +104 -104
  65. package/dist/{sender-identity-QtalnCYv.js → sender-identity-BJtfyise.js} +1 -1
  66. package/dist/setup-plugin-api.js +1 -1
  67. package/dist/{shared-BIXIX6uJ.js → shared-CaAaoksy.js} +15 -10
  68. package/dist/subagent-hooks-CNT2ZJTJ.js +49 -0
  69. package/dist/subagent-hooks-api.js +2 -2
  70. package/dist/{subagent-progress-DhaE_h8a.js → subagent-progress-FPLqBY1s.js} +5 -4
  71. package/dist/{system-events-CTqDf6_s.js → system-events-Nuwoq_au.js} +2 -2
  72. package/dist/{target-resolver-maOKSqO0.js → target-resolver-DIXShHaZ.js} +3 -3
  73. package/dist/targets-B2pf49zc.js +3 -0
  74. package/dist/{thread-bindings-3L8p82GV.js → thread-bindings-VlymUnbz.js} +29 -26
  75. package/dist/{thread-bindings.manager-DCIH6WDC.js → thread-bindings.manager-CngsgErq.js} +9 -8
  76. package/dist/{thread-bindings.session-updates-bJ2KQFY6.js → thread-bindings.session-updates-CJb-BpPL.js} +1 -1
  77. package/dist/{thread-bindings.state-aeV8HNgV.js → thread-bindings.state-D8OMdk4O.js} +1 -1
  78. package/dist/threading-DU6pgeGm.js +456 -0
  79. package/dist/transcripts-source-DeIMNbRh.js +265 -0
  80. package/dist/transcripts-source-api.js +7 -2
  81. package/dist/{typing-CS-nNVoe.js → typing-oLiS5Z13.js} +1 -1
  82. package/dist/{voice-runtime-BEdqNcST.js → voice-runtime-CjNFaynA.js} +181 -91
  83. package/openclaw.plugin.json +12 -6
  84. package/package.json +4 -6
  85. package/dist/accounts-DJTf1LtA.js +0 -219
  86. package/dist/channel-api-CAJ0wMoV.js +0 -21
  87. package/dist/provider.runtime-C9PnJZbZ.js +0 -2
  88. package/dist/runtime-api.monitor-CHxrFPnW.js +0 -5
  89. package/dist/subagent-hooks-CTt5KCJr.js +0 -120
  90. package/dist/targets-yUFTHoAx.js +0 -3
  91. package/dist/transcripts-source-CfFMexGt.js +0 -123
  92. package/node_modules/p-map/index.d.ts +0 -155
  93. package/node_modules/p-map/index.js +0 -285
  94. package/node_modules/p-map/license +0 -9
  95. package/node_modules/p-map/package.json +0 -57
  96. package/node_modules/p-map/readme.md +0 -190
  97. package/dist/{allow-list-DnxIlPP2.js → allow-list-BDMimASD.js} +1 -1
  98. package/dist/{audit-core-xwjIczO0.js → audit-core-BCX8UeFH.js} +1 -1
  99. package/dist/{doctor-contract-DLa-BTiU.js → doctor-contract-DsWvKIXF.js} +1 -1
  100. package/dist/{security-audit-jGnJF__m.js → security-audit-BfJhAXZp.js} +1 -1
@@ -1,12 +1,12 @@
1
- import { c as resolveDiscordChannelInfoSafe } from "./thread-bindings.manager-DCIH6WDC.js";
2
- import { normalizeLowercaseStringOrEmpty, normalizeOptionalString, normalizeOptionalStringifiedId, uniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
1
+ import { c as resolveDiscordChannelInfoSafe } from "./thread-bindings.manager-CngsgErq.js";
3
2
  import { ComponentType, StickerFormatType } from "discord-api-types/v10";
4
3
  import { asDateTimestampMs, resolveExpiresAtMsFromDurationMs } from "openclaw/plugin-sdk/number-runtime";
4
+ import { normalizeLowercaseStringOrEmpty, normalizeOptionalString, normalizeOptionalStringifiedId, uniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
5
+ import { getFileExtension, normalizeMimeType } from "openclaw/plugin-sdk/media-mime";
5
6
  import { getChildLogger, logVerbose } from "openclaw/plugin-sdk/runtime-env";
6
7
  import { saveRemoteMedia } from "openclaw/plugin-sdk/media-runtime";
7
8
  import { pruneMapToMaxSize } from "openclaw/plugin-sdk/collection-runtime";
8
9
  import { formatMediaPlaceholderText } from "openclaw/plugin-sdk/channel-inbound";
9
- import { getFileExtension, normalizeMimeType } from "openclaw/plugin-sdk/media-mime";
10
10
  //#region extensions/discord/src/monitor/message-channel-info-state.ts
11
11
  const discordChannelInfoCacheState = { entries: /* @__PURE__ */ new Map() };
12
12
  //#endregion
@@ -115,7 +115,7 @@ function formatDiscordSnapshotAuthor(author) {
115
115
  if (author.id) return `@${author.id}`;
116
116
  }
117
117
  //#endregion
118
- //#region extensions/discord/src/monitor/message-media.ts
118
+ //#region extensions/discord/src/monitor/media-ssrf-policy.ts
119
119
  const DISCORD_MEDIA_SSRF_POLICY = {
120
120
  hostnameAllowlist: [
121
121
  "cdn.discordapp.com",
@@ -125,6 +125,25 @@ const DISCORD_MEDIA_SSRF_POLICY = {
125
125
  ],
126
126
  allowRfc2544BenchmarkRange: true
127
127
  };
128
+ function mergeHostnameList(...lists) {
129
+ const merged = lists.flatMap((list) => list ?? []).map((value) => value.trim()).filter((value) => value.length > 0);
130
+ return merged.length > 0 ? uniqueStrings(merged) : void 0;
131
+ }
132
+ /** Merges caller network policy with the Discord-owned CDN allowlist. */
133
+ function resolveDiscordCdnPolicy(policy) {
134
+ if (!policy) return DISCORD_MEDIA_SSRF_POLICY;
135
+ const hostnameAllowlist = mergeHostnameList(DISCORD_MEDIA_SSRF_POLICY.hostnameAllowlist, policy.hostnameAllowlist);
136
+ const allowedHostnames = mergeHostnameList(DISCORD_MEDIA_SSRF_POLICY.allowedHostnames, policy.allowedHostnames);
137
+ return {
138
+ ...DISCORD_MEDIA_SSRF_POLICY,
139
+ ...policy,
140
+ ...allowedHostnames ? { allowedHostnames } : {},
141
+ ...hostnameAllowlist ? { hostnameAllowlist } : {},
142
+ allowRfc2544BenchmarkRange: Boolean(DISCORD_MEDIA_SSRF_POLICY.allowRfc2544BenchmarkRange) || Boolean(policy.allowRfc2544BenchmarkRange)
143
+ };
144
+ }
145
+ //#endregion
146
+ //#region extensions/discord/src/monitor/message-media.ts
128
147
  const AUDIO_ATTACHMENT_EXTENSIONS = /* @__PURE__ */ new Set([
129
148
  ".aac",
130
149
  ".caf",
@@ -171,26 +190,9 @@ function resolveDiscordMediaClassification(params) {
171
190
  ...kind ? { kind } : {}
172
191
  };
173
192
  }
174
- function mergeHostnameList(...lists) {
175
- const merged = lists.flatMap((list) => list ?? []).map((value) => value.trim()).filter((value) => value.length > 0);
176
- if (merged.length === 0) return;
177
- return uniqueStrings(merged);
178
- }
179
- function resolveDiscordMediaSsrFPolicy(policy) {
180
- if (!policy) return DISCORD_MEDIA_SSRF_POLICY;
181
- const hostnameAllowlist = mergeHostnameList(DISCORD_MEDIA_SSRF_POLICY.hostnameAllowlist, policy.hostnameAllowlist);
182
- const allowedHostnames = mergeHostnameList(DISCORD_MEDIA_SSRF_POLICY.allowedHostnames, policy.allowedHostnames);
183
- return {
184
- ...DISCORD_MEDIA_SSRF_POLICY,
185
- ...policy,
186
- ...allowedHostnames ? { allowedHostnames } : {},
187
- ...hostnameAllowlist ? { hostnameAllowlist } : {},
188
- allowRfc2544BenchmarkRange: Boolean(DISCORD_MEDIA_SSRF_POLICY.allowRfc2544BenchmarkRange) || Boolean(policy.allowRfc2544BenchmarkRange)
189
- };
190
- }
191
193
  async function resolveMediaList(message, maxBytes, options) {
192
194
  const out = [];
193
- const resolvedSsrFPolicy = resolveDiscordMediaSsrFPolicy(options?.ssrfPolicy);
195
+ const resolvedSsrFPolicy = resolveDiscordCdnPolicy(options?.ssrfPolicy);
194
196
  await appendResolvedMediaFromAttachments({
195
197
  attachments: message.attachments ?? [],
196
198
  maxBytes,
@@ -218,7 +220,7 @@ async function resolveMediaList(message, maxBytes, options) {
218
220
  async function resolveForwardedMediaList(message, maxBytes, options) {
219
221
  const snapshots = resolveDiscordMessageSnapshots(message);
220
222
  const out = [];
221
- const resolvedSsrFPolicy = resolveDiscordMediaSsrFPolicy(options?.ssrfPolicy);
223
+ const resolvedSsrFPolicy = resolveDiscordCdnPolicy(options?.ssrfPolicy);
222
224
  if (snapshots.length > 0) {
223
225
  for (const snapshot of snapshots) {
224
226
  await appendResolvedMediaFromAttachments({
@@ -276,7 +278,7 @@ async function resolveReferencedReplyMediaList(message, maxBytes, options) {
276
278
  const referencedReply = resolveDiscordReferencedReplyMessage(message);
277
279
  const out = [];
278
280
  if (!referencedReply) return out;
279
- const resolvedSsrFPolicy = resolveDiscordMediaSsrFPolicy(options?.ssrfPolicy);
281
+ const resolvedSsrFPolicy = resolveDiscordCdnPolicy(options?.ssrfPolicy);
280
282
  await appendResolvedMediaFromAttachments({
281
283
  attachments: referencedReply.attachments,
282
284
  maxBytes,
@@ -467,14 +469,11 @@ function formatDiscordMediaText(params) {
467
469
  }
468
470
  //#endregion
469
471
  //#region extensions/discord/src/monitor/message-text.ts
470
- function resolveDiscordEmbedText(embed) {
471
- const title = normalizeOptionalString(embed?.title) ?? "";
472
- const description = normalizeOptionalString(embed?.description) ?? "";
473
- if (title && description) return `${title}\n${description}`;
474
- return title || description || "";
472
+ function resolveDiscordEmbedText(embeds) {
473
+ return (embeds ?? []).flatMap(({ title, description }) => [normalizeOptionalString(title), normalizeOptionalString(description)]).filter(Boolean).join("\n");
475
474
  }
476
475
  function resolveDiscordMessageText(message, options) {
477
- const embedText = resolveDiscordEmbedText(message.embeds?.[0] ?? null);
476
+ const embedText = resolveDiscordEmbedText(message.embeds);
478
477
  const componentText = extractDiscordComponentsV2Text(resolveDiscordMessageComponents(message));
479
478
  const baseText = resolveDiscordMentions(normalizeOptionalString(message.content) || embedText || componentText || normalizeOptionalString(options?.fallbackText) || "", message);
480
479
  if (!options?.includeForwarded) return baseText;
@@ -557,9 +556,9 @@ function resolveDiscordSnapshotMessageText(snapshot) {
557
556
  attachments: snapshot.attachments ?? void 0,
558
557
  stickers: resolveDiscordSnapshotStickers(snapshot)
559
558
  });
560
- const embedText = resolveDiscordEmbedText(snapshot.embeds?.[0]);
559
+ const embedText = resolveDiscordEmbedText(snapshot.embeds);
561
560
  const componentText = extractDiscordComponentsV2Text(snapshot.components);
562
561
  return [content || embedText || componentText, attachmentText].filter(Boolean).join("\n");
563
562
  }
564
563
  //#endregion
565
- export { formatDiscordMediaText as a, resolveReferencedReplyMediaList as c, resolveDiscordChannelInfo as d, resolveDiscordMessageChannelId as f, resolveDiscordMessageText as i, hasDiscordMessageStickers as l, resolveDiscordForwardedMessagesTextFromSnapshots as n, resolveForwardedMediaList as o, resolveDiscordMessageHistoryText as r, resolveMediaList as s, resolveDiscordEmbedText as t, resolveDiscordMessageStickers as u };
564
+ export { formatDiscordMediaText as a, resolveReferencedReplyMediaList as c, resolveDiscordMessageStickers as d, resolveDiscordChannelInfo as f, resolveDiscordMessageText as i, resolveDiscordCdnPolicy as l, resolveDiscordForwardedMessagesTextFromSnapshots as n, resolveForwardedMediaList as o, resolveDiscordMessageChannelId as p, resolveDiscordMessageHistoryText as r, resolveMediaList as s, resolveDiscordEmbedText as t, hasDiscordMessageStickers as u };
@@ -1,10 +1,12 @@
1
- import { a as chunkDiscordTextWithMode, c as resolveDiscordReplyReference, f as normalizeDiscordOutboundTarget, r as hasDiscordMessageCreateAmbiguity } from "./retry-CLpJcXXf.js";
2
- import { n as createDiscordSendReceiptFromResults, t as createDiscordSendReceipt } from "./send.receipt-IPI1p-SP.js";
3
- import { n as formatDiscordApprovalDisplayValue } from "./approval-message-safety-AcIxvrf3.js";
4
- import { n as notifyDiscordInboundEventOutboundPayloadSuccess } from "./inbound-event-delivery-De2qxTrP.js";
5
- import { a as sendDiscordComponentMessageLazy, i as resolveDiscordComponentSpec, n as buildDiscordPresentationPayload, t as DISCORD_PRESENTATION_CAPABILITIES } from "./outbound-components-cTzwBJ60.js";
6
- import { normalizeLowercaseStringOrEmpty, normalizeOptionalString, normalizeOptionalStringifiedId } from "openclaw/plugin-sdk/string-coerce-runtime";
1
+ import { a as chunkDiscordTextWithMode, c as resolveDiscordReplyReference, f as normalizeDiscordOutboundTarget, r as hasDiscordMessageCreateAmbiguity } from "./retry-DNsVTeTo.js";
2
+ import { t as createDiscordActionGate } from "./accounts-DNl-oCEw.js";
3
+ import { i as toDiscordOutboundDeliveryResult, n as createDiscordSendReceiptFromResults, t as createDiscordSendReceipt } from "./send.receipt-Cnhoautb.js";
4
+ import { n as formatDiscordApprovalDisplayValue } from "./approval-message-safety-XGFPbDoI.js";
5
+ import { n as notifyDiscordInboundEventOutboundPayloadSuccess, t as discordInboundEventDelivery } from "./inbound-event-delivery-De2qxTrP.js";
6
+ import { a as sendDiscordComponentMessageLazy, i as resolveDiscordComponentSpec, n as buildDiscordPresentationPayload, t as DISCORD_PRESENTATION_CAPABILITIES } from "./outbound-components-B2PL0ooH.js";
7
7
  import { expectDefined } from "openclaw/plugin-sdk/expect-runtime";
8
+ import { normalizeLowercaseStringOrEmpty, normalizeOptionalString, normalizeOptionalStringifiedId } from "openclaw/plugin-sdk/string-coerce-runtime";
9
+ import { createSubsystemLogger } from "openclaw/plugin-sdk/runtime-env";
8
10
  import { truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
9
11
  import { createReplyToFanout, resolveOutboundSendDep } from "openclaw/plugin-sdk/channel-outbound";
10
12
  import { attachChannelToResult, createAttachedChannelResultAdapter } from "openclaw/plugin-sdk/channel-send-result";
@@ -59,7 +61,7 @@ function normalizeDiscordApprovalPayload(payload) {
59
61
  }
60
62
  //#endregion
61
63
  //#region extensions/discord/src/outbound-send-context.ts
62
- const loadDiscordSendRuntime = createLazyRuntimeModule(() => import("./send-B7Q6Oc1I.js").then((n) => n.t));
64
+ const loadDiscordSendRuntime = createLazyRuntimeModule(() => import("./send-rQIffSYu.js").then((n) => n.t));
63
65
  function resolveDiscordOutboundTarget(params) {
64
66
  if (params.threadId == null) return params.to;
65
67
  const threadId = normalizeOptionalStringifiedId(params.threadId) ?? "";
@@ -95,9 +97,10 @@ async function createDiscordPayloadSendContext(ctx) {
95
97
  }
96
98
  //#endregion
97
99
  //#region extensions/discord/src/outbound-payload.ts
100
+ const log$1 = createSubsystemLogger("discord/outbound");
98
101
  function resolveDiscordDeliveryProgress(ctx) {
99
102
  return ctx.onDeliveryResult ? async (result) => {
100
- await ctx.onDeliveryResult?.(attachChannelToResult("discord", result));
103
+ await ctx.onDeliveryResult?.(attachChannelToResult("discord", toDiscordOutboundDeliveryResult(result)));
101
104
  } : void 0;
102
105
  }
103
106
  function createDiscordUnknownPayloadResult(target) {
@@ -145,8 +148,8 @@ async function sendDiscordOutboundPayload(params) {
145
148
  const sendContext = await createDiscordPayloadSendContext(ctx);
146
149
  if (payload.audioAsVoice && mediaUrls.length > 0) {
147
150
  const voiceReply = sendContext.resolveReply();
148
- let deliveredVoice = false;
149
- let lastResult;
151
+ let voiceFailure;
152
+ let lastResult = createDiscordUnknownPayloadResult(sendContext.target);
150
153
  try {
151
154
  const voiceUrl = expectDefined(mediaUrls.at(0), "non-empty Discord voice media URLs");
152
155
  lastResult = await sendContext.sendVoice(sendContext.target, voiceUrl, {
@@ -155,33 +158,41 @@ async function sendDiscordOutboundPayload(params) {
155
158
  mediaLocalRoots: ctx.mediaLocalRoots,
156
159
  mediaReadFile: ctx.mediaReadFile
157
160
  });
158
- deliveredVoice = true;
159
161
  } catch (err) {
160
162
  if (hasDiscordMessageCreateAmbiguity(err)) throw err;
161
163
  const supplement = getReplyPayloadTtsSupplement(payload);
162
164
  const visibleFallbackText = payload.text?.trim() ? payload.text : void 0;
163
165
  const hiddenFallbackText = supplement?.visibleTextAlreadyDelivered ? void 0 : supplement?.spokenText;
164
166
  const fallbackText = visibleFallbackText ?? hiddenFallbackText;
165
- if (!fallbackText) if (supplement?.visibleTextAlreadyDelivered) lastResult = createDiscordUnknownPayloadResult(sendContext.target);
166
- else throw err;
167
- else lastResult = await sendContext.send(sendContext.target, fallbackText, {
167
+ if (!fallbackText && !supplement?.visibleTextAlreadyDelivered) throw err;
168
+ log$1.warn("discord voice send failed; continuing without voice", { error: err });
169
+ if (fallbackText) await sendContext.send(sendContext.target, fallbackText, {
168
170
  verbose: false,
169
171
  ...resolveDiscordFormattedDeliveryOptions(ctx, sendContext, voiceReply),
170
172
  onDeliveryResult: resolveDiscordDeliveryProgress(ctx)
171
173
  });
174
+ voiceFailure = { error: err };
172
175
  }
173
- if (deliveredVoice) await ctx.onDeliveryResult?.(attachChannelToResult("discord", lastResult));
174
- if (deliveredVoice && payload.text?.trim()) lastResult = await sendContext.send(sendContext.target, payload.text, {
175
- verbose: false,
176
- ...resolveDiscordFormattedDeliveryOptions(ctx, sendContext),
177
- onDeliveryResult: resolveDiscordDeliveryProgress(ctx)
178
- });
179
- for (const mediaUrl of mediaUrls.slice(1)) lastResult = await sendContext.send(sendContext.target, "", {
180
- verbose: false,
181
- ...resolveDiscordMediaDeliveryOptions(ctx, sendContext, mediaUrl),
182
- onDeliveryResult: resolveDiscordDeliveryProgress(ctx)
183
- });
184
- return attachChannelToResult("discord", lastResult);
176
+ if (!voiceFailure) {
177
+ await ctx.onDeliveryResult?.(attachChannelToResult("discord", toDiscordOutboundDeliveryResult(lastResult)));
178
+ if (payload.text?.trim()) lastResult = await sendContext.send(sendContext.target, payload.text, {
179
+ verbose: false,
180
+ ...resolveDiscordFormattedDeliveryOptions(ctx, sendContext),
181
+ onDeliveryResult: resolveDiscordDeliveryProgress(ctx)
182
+ });
183
+ }
184
+ for (const mediaUrl of mediaUrls.slice(1)) try {
185
+ lastResult = await sendContext.send(sendContext.target, "", {
186
+ verbose: false,
187
+ ...resolveDiscordMediaDeliveryOptions(ctx, sendContext, mediaUrl),
188
+ onDeliveryResult: resolveDiscordDeliveryProgress(ctx)
189
+ });
190
+ } catch (err) {
191
+ if (!voiceFailure) throw err;
192
+ log$1.warn("discord remaining media send failed after voice failure", { error: err });
193
+ }
194
+ if (voiceFailure) throw voiceFailure.error;
195
+ return attachChannelToResult("discord", toDiscordOutboundDeliveryResult(lastResult));
185
196
  }
186
197
  const componentSpec = await resolveDiscordComponentSpec(payload);
187
198
  if (!componentSpec) {
@@ -189,7 +200,7 @@ async function sendDiscordOutboundPayload(params) {
189
200
  const nativeComponents = Array.isArray(discordData.components) ? discordData.components : void 0;
190
201
  const embeds = Array.isArray(discordData.embeds) ? discordData.embeds : void 0;
191
202
  const filename = normalizeOptionalString(discordData.filename);
192
- if (nativeComponents || embeds?.length || filename) return attachChannelToResult("discord", await sendPayloadMediaSequenceOrFallback({
203
+ if (nativeComponents || embeds?.length || filename) return attachChannelToResult("discord", toDiscordOutboundDeliveryResult(await sendPayloadMediaSequenceOrFallback({
193
204
  text: payload.text ?? "",
194
205
  mediaUrls,
195
206
  fallbackResult: createDiscordUnknownPayloadResult(sendContext.target),
@@ -209,7 +220,7 @@ async function sendDiscordOutboundPayload(params) {
209
220
  filename: isFirst ? filename : void 0,
210
221
  onDeliveryResult: resolveDiscordDeliveryProgress(ctx)
211
222
  })
212
- }));
223
+ })));
213
224
  const payloadContext = {
214
225
  ...ctx,
215
226
  payload
@@ -223,9 +234,9 @@ async function sendDiscordOutboundPayload(params) {
223
234
  payloadContext.threadId = threadId;
224
235
  createdThreadId = threadId;
225
236
  }
226
- if (createdThreadId && result.channelId && result.receipt) deliveredResults.push({
237
+ if (createdThreadId && result.target?.kind === "channel" && result.receipt) deliveredResults.push({
227
238
  messageId: result.messageId,
228
- channelId: result.channelId,
239
+ channelId: result.target.id,
229
240
  receipt: result.receipt
230
241
  });
231
242
  };
@@ -242,7 +253,7 @@ async function sendDiscordOutboundPayload(params) {
242
253
  })
243
254
  } : result;
244
255
  }
245
- return attachChannelToResult("discord", await sendPayloadMediaSequenceOrFallback({
256
+ return attachChannelToResult("discord", toDiscordOutboundDeliveryResult(await sendPayloadMediaSequenceOrFallback({
246
257
  text: payload.text ?? "",
247
258
  mediaUrls,
248
259
  fallbackResult: createDiscordUnknownPayloadResult(sendContext.target),
@@ -263,13 +274,14 @@ async function sendDiscordOutboundPayload(params) {
263
274
  onDeliveryResult: resolveDiscordDeliveryProgress(ctx)
264
275
  });
265
276
  }
266
- }));
277
+ })));
267
278
  }
268
279
  //#endregion
269
280
  //#region extensions/discord/src/outbound-adapter.ts
270
281
  const DISCORD_TEXT_CHUNK_LIMIT = 2e3;
271
- const loadDiscordThreadBindings = createLazyRuntimeModule(() => import("./thread-bindings-3L8p82GV.js").then((n) => n.t));
272
- const loadDiscordComponentSendRuntime = createLazyRuntimeModule(() => import("./send.components-iJyFXw9L.js").then((n) => n.i));
282
+ const log = createSubsystemLogger("discord/outbound");
283
+ const loadDiscordThreadBindings = createLazyRuntimeModule(() => import("./thread-bindings-VlymUnbz.js").then((n) => n.t));
284
+ const loadDiscordComponentSendRuntime = createLazyRuntimeModule(() => import("./send.components-ChK1wS7w.js").then((n) => n.i));
273
285
  function resolveDiscordWebhookIdentity(params) {
274
286
  const usernameRaw = normalizeOptionalString(params.identity?.name);
275
287
  const fallbackUsername = normalizeOptionalString(params.binding.label) ?? params.binding.agentId;
@@ -325,7 +337,7 @@ async function resolveDiscordOutboundMessageSend(params) {
325
337
  cfg: params.cfg,
326
338
  ...resolveDiscordFormattingOptions({ formatting: params.formatting }),
327
339
  onDeliveryResult: params.onDeliveryResult ? async (result) => {
328
- await params.onDeliveryResult?.(attachChannelToResult("discord", result));
340
+ await params.onDeliveryResult?.(attachChannelToResult("discord", toDiscordOutboundDeliveryResult(result)));
329
341
  } : void 0,
330
342
  onPlatformSendDispatch: params.onPlatformSendDispatch
331
343
  }
@@ -380,17 +392,18 @@ const discordOutbound = {
380
392
  await ctx.onPlatformSendDispatch?.();
381
393
  } : void 0
382
394
  });
383
- if (webhookResult) return webhookResult;
395
+ if (webhookResult) return toDiscordOutboundDeliveryResult(webhookResult);
384
396
  } catch (error) {
385
397
  if (webhookSelected) throw error;
398
+ log.warn("discord webhook persona send failed; falling back to bot send", { error });
386
399
  }
387
400
  }
388
401
  const { send, target, options } = await resolveDiscordOutboundMessageSend(ctx);
389
- return await send(target, ctx.text, options);
402
+ return toDiscordOutboundDeliveryResult(await send(target, ctx.text, options));
390
403
  },
391
404
  sendMedia: async (ctx) => {
392
405
  const { send, target, options } = await resolveDiscordOutboundMessageSend(ctx);
393
- if (ctx.audioAsVoice && ctx.mediaUrl) return await (resolveOutboundSendDep(ctx.deps, "discordVoice") ?? (await loadDiscordSendRuntime()).sendVoiceMessageDiscord)(target, ctx.mediaUrl, {
406
+ if (ctx.audioAsVoice && ctx.mediaUrl) return toDiscordOutboundDeliveryResult(await (resolveOutboundSendDep(ctx.deps, "discordVoice") ?? (await loadDiscordSendRuntime()).sendVoiceMessageDiscord)(target, ctx.mediaUrl, {
394
407
  cfg: ctx.cfg,
395
408
  reply: options.reply,
396
409
  accountId: ctx.accountId ?? void 0,
@@ -399,7 +412,7 @@ const discordOutbound = {
399
412
  mediaLocalRoots: ctx.mediaLocalRoots,
400
413
  mediaReadFile: ctx.mediaReadFile,
401
414
  onPlatformSendDispatch: ctx.onPlatformSendDispatch
402
- });
415
+ }));
403
416
  const mediaOptions = {
404
417
  ...options,
405
418
  mediaUrl: ctx.mediaUrl,
@@ -414,26 +427,42 @@ const discordOutbound = {
414
427
  reply: options.reply?.scope === "all" ? options.reply : void 0
415
428
  });
416
429
  const threadId = captionResult.receipt?.threadId;
417
- if (!threadId) return mediaResult;
418
- return {
430
+ if (!threadId) return toDiscordOutboundDeliveryResult(mediaResult);
431
+ return toDiscordOutboundDeliveryResult({
419
432
  ...captionResult,
420
433
  receipt: createDiscordSendReceiptFromResults({
421
434
  results: [captionResult, mediaResult],
422
435
  threadId
423
436
  })
424
- };
437
+ });
425
438
  }
426
- return await send(target, ctx.text, mediaOptions);
439
+ return toDiscordOutboundDeliveryResult(await send(target, ctx.text, mediaOptions));
427
440
  },
428
- sendPoll: async ({ cfg, to, poll, accountId, threadId, silent, onPlatformSendDispatch }) => await (await loadDiscordSendRuntime()).sendPollDiscord(resolveDiscordOutboundTarget({
429
- to,
430
- threadId
431
- }), poll, {
432
- accountId: accountId ?? void 0,
433
- silent: silent ?? void 0,
434
- cfg,
435
- onPlatformSendDispatch
436
- })
441
+ sendPoll: async ({ cfg, to, poll, content, accountId, threadId, silent, sessionKey, inboundEventKind, onPlatformSendDispatch }) => {
442
+ if (!createDiscordActionGate({
443
+ cfg,
444
+ accountId
445
+ })("polls")) throw new Error("Discord polls are disabled.");
446
+ const outboundTo = resolveDiscordOutboundTarget({
447
+ to,
448
+ threadId
449
+ });
450
+ const result = await (await loadDiscordSendRuntime()).sendPollDiscord(outboundTo, poll, {
451
+ accountId: accountId ?? void 0,
452
+ content,
453
+ threadId: threadId ?? void 0,
454
+ silent: silent ?? void 0,
455
+ cfg,
456
+ onPlatformSendDispatch
457
+ });
458
+ discordInboundEventDelivery.notify({
459
+ sessionKey,
460
+ inboundEventKind,
461
+ to: outboundTo,
462
+ accountId
463
+ });
464
+ return result;
465
+ }
437
466
  }),
438
467
  adoptTargetFromDelivery: ({ result }) => {
439
468
  const threadId = normalizeOptionalStringifiedId(result.receipt?.threadId);
@@ -456,9 +485,10 @@ const discordOutbound = {
456
485
  to: target.to,
457
486
  threadId: target.threadId
458
487
  });
488
+ const channelId = result.target?.kind === "channel" ? result.target.id : to;
459
489
  questionGatewayRuntime.registerChannelDelivery({
460
490
  questionId,
461
- deliveryId: `discord:${target.accountId ?? "default"}:${result.channelId ?? to}:${result.messageId}`,
491
+ deliveryId: `discord:${target.accountId ?? "default"}:${channelId}:${result.messageId}`,
462
492
  finalize: async (statusLine) => {
463
493
  const { editDiscordComponentMessage } = await loadDiscordComponentSendRuntime();
464
494
  await editDiscordComponentMessage(to, result.messageId, {
@@ -1,4 +1,4 @@
1
- import { h as readDiscordComponentSpec } from "./outbound-session-route-DxLkrgKQ.js";
1
+ import { m as readDiscordComponentSpec } from "./components-ezGKo_Yh.js";
2
2
  import { createLazyRuntimeModule, createLazyRuntimeNamedExport } from "openclaw/plugin-sdk/lazy-runtime";
3
3
  //#region extensions/discord/src/outbound-components.ts
4
4
  const DISCORD_MESSAGE_COMPONENT_LIMIT = 40;
@@ -30,11 +30,11 @@ const DISCORD_PRESENTATION_CAPABILITIES = {
30
30
  }
31
31
  }
32
32
  };
33
- const loadDiscordComponentSend = createLazyRuntimeNamedExport(() => import("./send.components-iJyFXw9L.js").then((n) => n.i), "sendDiscordComponentMessage");
33
+ const loadDiscordComponentSend = createLazyRuntimeNamedExport(() => import("./send.components-ChK1wS7w.js").then((n) => n.i), "sendDiscordComponentMessage");
34
34
  async function sendDiscordComponentMessageLazy(...args) {
35
35
  return await (await loadDiscordComponentSend())(...args);
36
36
  }
37
- const loadDiscordSharedInteractive = createLazyRuntimeModule(() => import("./outbound-session-route-DxLkrgKQ.js").then((n) => n.o));
37
+ const loadDiscordSharedInteractive = createLazyRuntimeModule(() => import("./components-ezGKo_Yh.js").then((n) => n.a));
38
38
  function addPayloadTextFallback(spec, payload) {
39
39
  return spec.text ? spec : {
40
40
  ...spec,
@@ -0,0 +1,107 @@
1
+ import { l as resolveDiscordAccountAllowFrom } from "./accounts-DNl-oCEw.js";
2
+ import { c as resolveDiscordChannelConfigWithFallback, d as resolveDiscordCommandOwnerAllowFrom, f as resolveDiscordGuildEntry, n as isDiscordGroupAllowedByPolicy, p as resolveDiscordMemberAccessState, r as normalizeDiscordAllowList, t as allowListMatches } from "./allow-list-BDMimASD.js";
3
+ import { resolveCommandAuthorizedFromAuthorizers } from "openclaw/plugin-sdk/command-auth-native";
4
+ import { resolveOpenProviderRuntimeGroupPolicy } from "openclaw/plugin-sdk/runtime-group-policy";
5
+ //#region extensions/discord/src/voice/access.ts
6
+ async function authorizeDiscordVoiceIngress(params) {
7
+ const groupPolicy = params.groupPolicy ?? resolveOpenProviderRuntimeGroupPolicy({
8
+ providerConfigPresent: params.cfg.channels?.discord !== void 0,
9
+ groupPolicy: params.discordConfig.groupPolicy,
10
+ defaultGroupPolicy: params.cfg.channels?.defaults?.groupPolicy
11
+ }).groupPolicy;
12
+ const guildInfo = resolveDiscordGuildEntry({
13
+ guild: params.guild ?? {
14
+ id: params.guildId,
15
+ ...params.guildName ? { name: params.guildName } : {}
16
+ },
17
+ guildId: params.guildId,
18
+ guildEntries: params.discordConfig.guilds
19
+ });
20
+ const channelConfig = params.channelId ? resolveDiscordChannelConfigWithFallback({
21
+ guildInfo,
22
+ channelId: params.channelId,
23
+ channelName: params.channelName,
24
+ channelSlug: params.channelSlug,
25
+ parentId: params.parentId,
26
+ parentName: params.parentName,
27
+ parentSlug: params.parentSlug,
28
+ scope: params.scope
29
+ }) : null;
30
+ if (channelConfig?.enabled === false) return {
31
+ ok: false,
32
+ message: "This channel is disabled."
33
+ };
34
+ const channelAllowlistConfigured = Boolean(guildInfo?.channels) && Object.keys(guildInfo?.channels ?? {}).length > 0;
35
+ if (!params.channelId && groupPolicy === "allowlist" && channelAllowlistConfigured) return {
36
+ ok: false,
37
+ message: `${params.channelLabel ?? "This channel"} is not allowlisted for voice commands.`
38
+ };
39
+ const channelAllowed = channelConfig ? channelConfig.allowed : !channelAllowlistConfigured;
40
+ if (!isDiscordGroupAllowedByPolicy({
41
+ groupPolicy,
42
+ guildAllowlisted: Boolean(guildInfo),
43
+ channelAllowlistConfigured,
44
+ channelAllowed
45
+ }) || channelConfig?.allowed === false) return {
46
+ ok: false,
47
+ message: `${params.channelLabel ?? "This channel"} is not allowlisted for voice commands.`
48
+ };
49
+ const { hasAccessRestrictions, memberAllowed } = resolveDiscordMemberAccessState({
50
+ channelConfig,
51
+ guildInfo,
52
+ memberRoleIds: params.memberRoleIds,
53
+ sender: params.sender,
54
+ allowNameMatching: false
55
+ });
56
+ const admissionAllowList = normalizeDiscordAllowList(params.admissionAllowFrom ?? params.discordConfig.allowFrom ?? params.discordConfig.allowFrom, [
57
+ "discord:",
58
+ "user:",
59
+ "pk:"
60
+ ]);
61
+ const admissionAllowed = admissionAllowList ? allowListMatches(admissionAllowList, params.sender, { allowNameMatching: false }) : false;
62
+ const useAccessGroups = params.useAccessGroups ?? true;
63
+ return resolveCommandAuthorizedFromAuthorizers({
64
+ useAccessGroups,
65
+ authorizers: useAccessGroups ? [{
66
+ configured: admissionAllowList != null,
67
+ allowed: admissionAllowed
68
+ }, {
69
+ configured: hasAccessRestrictions,
70
+ allowed: memberAllowed
71
+ }] : [{
72
+ configured: hasAccessRestrictions,
73
+ allowed: memberAllowed
74
+ }],
75
+ modeWhenAccessGroupsOff: "configured"
76
+ }) ? {
77
+ ok: true,
78
+ channelConfig
79
+ } : {
80
+ ok: false,
81
+ message: "You are not authorized to use this command."
82
+ };
83
+ }
84
+ //#endregion
85
+ //#region extensions/discord/src/voice/config.ts
86
+ function resolveDiscordVoiceEnabled(voice) {
87
+ if (voice?.enabled !== void 0) return voice.enabled;
88
+ return voice !== void 0;
89
+ }
90
+ //#endregion
91
+ //#region extensions/discord/src/voice/owner-access.ts
92
+ function resolveDiscordVoiceAccess(params) {
93
+ const commandOwnerAllowFrom = resolveDiscordCommandOwnerAllowFrom(params.cfg);
94
+ if (commandOwnerAllowFrom) return {
95
+ admissionAllowFrom: commandOwnerAllowFrom,
96
+ ownerAllowFrom: commandOwnerAllowFrom
97
+ };
98
+ return {
99
+ admissionAllowFrom: resolveDiscordAccountAllowFrom({
100
+ cfg: params.cfg,
101
+ accountId: params.accountId
102
+ }) ?? params.discordConfig.allowFrom ?? [],
103
+ ownerAllowFrom: []
104
+ };
105
+ }
106
+ //#endregion
107
+ export { resolveDiscordVoiceEnabled as n, authorizeDiscordVoiceIngress as r, resolveDiscordVoiceAccess as t };
@@ -1,4 +1,4 @@
1
- import { tn as __exportAll } from "./retry-CLpJcXXf.js";
1
+ import { en as __exportAll } from "./retry-DNsVTeTo.js";
2
2
  import { readProviderJsonObjectResponse, readResponseTextLimited } from "openclaw/plugin-sdk/provider-http";
3
3
  import { resolveFetch } from "openclaw/plugin-sdk/fetch-runtime";
4
4
  import { buildTimeoutAbortSignal } from "openclaw/plugin-sdk/extension-shared";
@@ -1,4 +1,4 @@
1
- import { p as normalizeDiscordToken } from "./accounts-DJTf1LtA.js";
1
+ import { m as normalizeDiscordToken } from "./accounts-DNl-oCEw.js";
2
2
  import { n as DiscordApiError, r as fetchDiscord } from "./api-DNVbJyEy.js";
3
3
  import { readResponseWithLimit } from "openclaw/plugin-sdk/response-limit-runtime";
4
4
  import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
@@ -1,2 +1,2 @@
1
- import { a as probeDiscordApplicationId, i as probeDiscord, n as fetchDiscordApplicationSummary, o as resolveDiscordPrivilegedIntentsFromFlags, r as parseApplicationIdFromToken, t as fetchDiscordApplicationId } from "./probe-Bl-k5_Ku.js";
1
+ import { a as probeDiscordApplicationId, i as probeDiscord, n as fetchDiscordApplicationSummary, o as resolveDiscordPrivilegedIntentsFromFlags, r as parseApplicationIdFromToken, t as fetchDiscordApplicationId } from "./probe-BTdtVRwU.js";
2
2
  export { fetchDiscordApplicationId, fetchDiscordApplicationSummary, parseApplicationIdFromToken, probeDiscord, probeDiscordApplicationId, resolveDiscordPrivilegedIntentsFromFlags };