@openclaw/discord 2026.10.5 → 2026.10.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 (64) hide show
  1. package/dist/.setup/{approval-handler.runtime-D88-QVlO.mjs → approval-handler.runtime-BvF8oUpa.mjs} +9 -9
  2. package/dist/.setup/{approval-message-updates-CIGByUcE.mjs → approval-message-updates-wbUqLtLI.mjs} +2 -2
  3. package/dist/.setup/{audit-TGIPL0f_.mjs → audit-UwzCdDJk.mjs} +3 -3
  4. package/dist/.setup/{channel-C24afwHP.mjs → channel-BlvyeRAu.mjs} +72 -49
  5. package/dist/.setup/{channel.setup-B3KEh05g.mjs → channel.setup-By7wNopw.mjs} +1 -1
  6. package/dist/.setup/{command-owners-C7rUdqUX.mjs → command-owners-D78sAoOz.mjs} +1 -1
  7. package/dist/.setup/{components-HN9052L1.mjs → components-C_cuoW1q.mjs} +1 -1
  8. package/dist/.setup/conversation-binding-route-fdYsXexV.mjs +68 -0
  9. package/dist/.setup/{discord-BGqgx-yd.mjs → discord-Cl2OPTZ6.mjs} +18 -14
  10. package/dist/.setup/{doctor-9Ka20lDD.mjs → doctor-94GSI6lY.mjs} +2 -2
  11. package/dist/.setup/{handle-action-CsQmpfGZ.mjs → handle-action-0-FZD3Am.mjs} +7 -7
  12. package/dist/.setup/{handle-action.guild-admin-Aw-vutu3.mjs → handle-action.guild-admin-DfAWANBE.mjs} +2 -2
  13. package/dist/.setup/{message-handler-C_BQFYCW.mjs → message-handler-CtR2w7W_.mjs} +4 -4
  14. package/dist/.setup/{message-handler.preflight-C_xFOxPN.mjs → message-handler.preflight-BqUw7LWb.mjs} +11 -10
  15. package/dist/.setup/{message-handler.preflight-pluralkit-CfRsEwg4.mjs → message-handler.preflight-pluralkit-BU9I_X-b.mjs} +4 -6
  16. package/dist/.setup/{message-handler.process-_np9if7z.mjs → message-handler.process-BZeWmSNC.mjs} +40 -50
  17. package/dist/.setup/{outbound-adapter-L3UDoMOG.mjs → outbound-adapter-DBwgKemw.mjs} +5 -5
  18. package/dist/.setup/{outbound-session-route-iwnu6IK8.mjs → outbound-session-route-CsHHPxsQ.mjs} +24 -7
  19. package/dist/.setup/{provider-CbmXLYrW.mjs → provider-DUTsZJHz.mjs} +230 -205
  20. package/dist/.setup/{provider-session.runtime-BMOuDbod.mjs → provider-session.runtime-Ucr3XodI.mjs} +3 -3
  21. package/dist/.setup/provider.runtime-J8NuMCNs.mjs +1 -0
  22. package/dist/.setup/{realtime-session.runtime-YCumnRSE.mjs → realtime-session.runtime-bNnPOKP_.mjs} +161 -150
  23. package/dist/.setup/{receive-recovery-eVmK2_hl.mjs → receive-recovery-CKvaG2Hf.mjs} +4 -25
  24. package/dist/.setup/{runtime-DPm3gZXk.mjs → runtime-Cg5pIBm_.mjs} +1 -1
  25. package/dist/.setup/{runtime-CRTkKU1G.mjs → runtime-DE6W14G3.mjs} +7 -7
  26. package/dist/.setup/{send-DbILKgcm.mjs → send-yR1hfybW.mjs} +26 -12
  27. package/dist/.setup/{send.components-FxOS3CeP.mjs → send.components--dxMjc2O.mjs} +5 -5
  28. package/dist/.setup/{send.outbound-_jx4Xpd3.mjs → send.outbound-B5vQwgUK.mjs} +10 -4
  29. package/dist/.setup/{send.receipt-BAlzXd8e.mjs → send.receipt-eE3zLTDH.mjs} +3 -9
  30. package/dist/.setup/{send.shared-CjQ4jbMA.mjs → send.shared-iGf1rqAm.mjs} +4 -3
  31. package/dist/.setup/setup-plugin-api-DVpA_yqS.mjs +2 -0
  32. package/dist/.setup/{shared-C027f-lL.mjs → shared-DgzLizSt.mjs} +1 -1
  33. package/dist/.setup/{subagent-hooks-CME7dSGf.mjs → subagent-hooks-tBtaqWkD.mjs} +21 -12
  34. package/dist/.setup/{system-events-BwwSDCw4.mjs → system-events-DGsxf-l9.mjs} +1 -1
  35. package/dist/.setup/{target-resolver-Bse8fuTi.mjs → target-resolver-BFOKmBni.mjs} +1 -1
  36. package/dist/.setup/{targets-DZJjkzwv.mjs → targets-UbCpek5o.mjs} +1 -1
  37. package/dist/.setup/{thread-bindings-0hPTSK14.mjs → thread-bindings-Dsc3zsrI.mjs} +29 -7
  38. package/dist/.setup/{thread-bindings.manager-CdNa6UIs.mjs → thread-bindings.manager-BMpmKLQh.mjs} +63 -19
  39. package/dist/.setup/{thread-bindings.session-updates-DGSljVf6.mjs → thread-bindings.session-updates-BMdJeJMc.mjs} +39 -122
  40. package/dist/.setup/{threading-BWz5lW0p.mjs → threading-Cg_QRc8s.mjs} +2 -2
  41. package/dist/.setup/{transcripts-source-EMrQb132.mjs → transcripts-source-fRvFsZng.mjs} +12 -17
  42. package/dist/.setup/{voice-runtime-BFEBhf2B.mjs → voice-runtime-DHDNu0fz.mjs} +73 -120
  43. package/dist/action-runtime-api.js +1 -1
  44. package/dist/activities-api.js +3 -3
  45. package/dist/api.js +11 -11
  46. package/dist/channel-plugin-api.js +1 -1
  47. package/dist/runtime-api.js +15 -15
  48. package/dist/setup-entry.js +1 -1
  49. package/dist/setup-plugin-api.js +1 -1
  50. package/dist/src/voice/audio-worker.runtime.js +8 -11
  51. package/dist/subagent-hooks-api.js +1 -1
  52. package/dist/transcripts-source-api.js +1 -1
  53. package/node_modules/mdast-util-from-markdown/dev/lib/index.js +152 -45
  54. package/node_modules/mdast-util-from-markdown/dev/lib/types.d.ts +26 -0
  55. package/node_modules/mdast-util-from-markdown/lib/index.js +133 -40
  56. package/node_modules/mdast-util-from-markdown/lib/types.d.ts +26 -0
  57. package/node_modules/mdast-util-from-markdown/package.json +6 -7
  58. package/node_modules/mdast-util-from-markdown/readme.md +15 -1
  59. package/node_modules/typebox/build/value/clean/from_object.mjs +1 -1
  60. package/node_modules/typebox/package.json +1 -1
  61. package/package.json +6 -6
  62. package/dist/.setup/conversation-binding-route-r4XyytCE.mjs +0 -51
  63. package/dist/.setup/provider.runtime-1yN_05AK.mjs +0 -1
  64. package/dist/.setup/setup-plugin-api-BFl2FljJ.mjs +0 -2
@@ -1,5 +1,5 @@
1
1
  import { A as isDiscordThreadChannelType } from "./allow-list-B_ToXtew.mjs";
2
- import { D as resolveDiscordMessageStickers } from "./transcripts-source-EMrQb132.mjs";
2
+ import { D as resolveDiscordMessageStickers } from "./transcripts-source-fRvFsZng.mjs";
3
3
  import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
4
4
  import { logVerbose } from "openclaw/plugin-sdk/runtime-env";
5
5
  import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
@@ -19,9 +19,7 @@ function isBoundThreadBotSystemMessage(params) {
19
19
  return DISCORD_BOUND_THREAD_SYSTEM_PREFIXES.some((prefix) => text.startsWith(prefix));
20
20
  }
21
21
  function isDiscordThreadChannelMessage(params) {
22
- if (!params.isGuildMessage) return false;
23
- const channel = "channel" in params.message ? params.message.channel : void 0;
24
- return Boolean(channel && typeof channel === "object" && "isThread" in channel && typeof channel.isThread === "function" && channel.isThread() || isDiscordThreadChannelType(params.channelInfo?.type));
22
+ return params.isGuildMessage && isDiscordThreadChannelType(params.channelInfo?.type);
25
23
  }
26
24
  function resolveInjectedBoundThreadLookupRecord(params) {
27
25
  const getByThreadId = params.threadBindings.getByThreadId;
@@ -115,8 +113,8 @@ function resolveDiscordHistoryMediaIds(message) {
115
113
  //#region extensions/discord/src/monitor/message-handler.preflight-runtime.ts
116
114
  const loadPluralKitRuntime = createLazyRuntimeModule(() => import("./pluralkit-B64dfq_j.mjs").then((n) => n.n));
117
115
  const loadPreflightAudioRuntime = createLazyRuntimeModule(() => import("./preflight-audio-wWgsZG5F.mjs"));
118
- const loadSystemEventsRuntime = createLazyRuntimeModule(() => import("./system-events-BwwSDCw4.mjs"));
119
- const loadDiscordThreadingRuntime = createLazyRuntimeModule(() => import("./threading-BWz5lW0p.mjs").then((n) => n.t));
116
+ const loadSystemEventsRuntime = createLazyRuntimeModule(() => import("./system-events-DGsxf-l9.mjs"));
117
+ const loadDiscordThreadingRuntime = createLazyRuntimeModule(() => import("./threading-Cg_QRc8s.mjs").then((n) => n.t));
120
118
  //#endregion
121
119
  //#region extensions/discord/src/monitor/message-handler.preflight-pluralkit.ts
122
120
  async function resolveDiscordPreflightPluralKitInfo(params) {
@@ -1,21 +1,21 @@
1
1
  import { m as resolveDiscordMaxLinesPerMessage } from "./accounts-ljrzXBJi.mjs";
2
2
  import { i as normalizeDiscordAllowList, o as normalizeDiscordSlug, w as resolveTimestampMs } from "./allow-list-B_ToXtew.mjs";
3
- import { F as createDiscordRuntimeAccountContext, O as resolveDiscordMessageFlags, P as createDiscordRestClient, u as resolveDiscordTargetChannelId } from "./send.shared-CjQ4jbMA.mjs";
4
- import { U as captureDiscordRequestAuthority, W as withDiscordRequestAuthority, Z as Message, _t as getGuildMember, lt as deleteChannelMessage, t as discord_exports, ut as editChannelMessage } from "./discord-BGqgx-yd.mjs";
5
- import { v as chunkDiscordTextWithMode } from "./send.receipt-BAlzXd8e.mjs";
3
+ import { F as createDiscordRuntimeAccountContext, O as resolveDiscordMessageFlags, P as createDiscordRestClient, u as resolveDiscordTargetChannelId } from "./send.shared-iGf1rqAm.mjs";
4
+ import { G as withDiscordRequestAuthority, Q as Message, W as captureDiscordRequestAuthority, dt as editChannelMessage, t as discord_exports, ut as deleteChannelMessage, vt as getGuildMember } from "./discord-Cl2OPTZ6.mjs";
5
+ import { v as chunkDiscordTextWithMode } from "./send.receipt-eE3zLTDH.mjs";
6
6
  import { n as resolveDiscordChannelId } from "./target-parsing-C-HyNxcE.mjs";
7
- import { a as removeReactionDiscord, r as reactMessageDiscord } from "./send-DbILKgcm.mjs";
8
- import { a as discordTextHasBroadcastMention } from "./send.outbound-_jx4Xpd3.mjs";
7
+ import { a as removeReactionDiscord, r as reactMessageDiscord } from "./send-yR1hfybW.mjs";
8
+ import { o as discordTextHasBroadcastMention } from "./send.outbound-B5vQwgUK.mjs";
9
9
  import { n as DISCORD_ATTACHMENT_TOTAL_TIMEOUT_MS, t as DISCORD_ATTACHMENT_IDLE_TIMEOUT_MS } from "./timeouts-CuNARfyw.mjs";
10
- import "./targets-DZJjkzwv.mjs";
11
- import { b as discordInboundEventDelivery, h as resolveDiscordConversationIdentity, u as buildDiscordRoutePeer } from "./outbound-session-route-iwnu6IK8.mjs";
12
- import { t as DISCORD_TEXT_CHUNK_LIMIT } from "./outbound-adapter-L3UDoMOG.mjs";
13
- import { T as createDiscordSupplementalContextAccessChecker, c as formatDiscordReplySkip, d as buildGuildLabel, f as resolveReplyContext, l as sanitizeDiscordFrontChannelReplyPayloads, o as deliverDiscordReply, s as formatDiscordReplyDeliveryFailure, u as buildDirectLabel, w as buildDiscordInboundAccessContext } from "./provider-CbmXLYrW.mjs";
14
- import { D as resolveDiscordMessageStickers, b as resolveDiscordMessageText, h as resolveDiscordThreadStarter, k as resolveDiscordReferencedReplyMessageId, v as resolveDiscordMessageHistoryText, w as resolveReferencedReplyMediaList, x as formatDiscordMediaText } from "./transcripts-source-EMrQb132.mjs";
10
+ import "./targets-UbCpek5o.mjs";
11
+ import { C as discordInboundEventDelivery, p as buildDiscordRoutePeer, v as resolveDiscordConversationIdentity } from "./outbound-session-route-CsHHPxsQ.mjs";
12
+ import { t as DISCORD_TEXT_CHUNK_LIMIT } from "./outbound-adapter-DBwgKemw.mjs";
13
+ import { T as createDiscordSupplementalContextAccessChecker, c as formatDiscordReplySkip, d as buildGuildLabel, f as resolveReplyContext, l as sanitizeDiscordFrontChannelReplyPayloads, o as deliverDiscordReply, s as formatDiscordReplyDeliveryFailure, u as buildDirectLabel, w as buildDiscordInboundAccessContext } from "./provider-DUTsZJHz.mjs";
14
+ import { D as resolveDiscordMessageStickers, b as resolveDiscordMessageText, h as resolveDiscordThreadStarter, k as resolveDiscordReferencedReplyMessageId, v as resolveDiscordMessageHistoryText, w as resolveReferencedReplyMediaList, x as formatDiscordMediaText } from "./transcripts-source-fRvFsZng.mjs";
15
15
  import { n as resolveDiscordWebhookId, t as resolveDiscordSenderIdentity } from "./sender-identity-BNBvGt1l.mjs";
16
- import { n as resolveDiscordAutoThreadReplyPlan } from "./threading-BWz5lW0p.mjs";
16
+ import { n as resolveDiscordAutoThreadReplyPlan } from "./threading-Cg_QRc8s.mjs";
17
17
  import { t as beginDiscordActiveTurnThreadRoute } from "./active-turn-thread-route-C4tp9noA.mjs";
18
- import { a as createDiscordHistorySenderProvenance, l as isBoundThreadBotSystemMessage, m as shouldIgnoreBoundThreadWebhookMessage, o as filterDiscordHistoryEntriesForContext, s as resolveDiscordHistoryMediaIds, t as resolveDiscordPreflightPluralKitInfo } from "./message-handler.preflight-pluralkit-CfRsEwg4.mjs";
18
+ import { a as createDiscordHistorySenderProvenance, l as isBoundThreadBotSystemMessage, m as shouldIgnoreBoundThreadWebhookMessage, o as filterDiscordHistoryEntriesForContext, s as resolveDiscordHistoryMediaIds, t as resolveDiscordPreflightPluralKitInfo } from "./message-handler.preflight-pluralkit-BU9I_X-b.mjs";
19
19
  import { t as sendTyping } from "./typing-CNlSKY5S.mjs";
20
20
  import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
21
21
  import { danger, logVerbose, shouldLogVerbose, sleepWithAbort } from "openclaw/plugin-sdk/runtime-env";
@@ -36,14 +36,14 @@ import { resolvePinnedMainDmOwnerFromAllowlist as resolvePinnedMainDmOwnerFromAl
36
36
  import { resolveAgentConfig } from "openclaw/plugin-sdk/agent-scope-runtime";
37
37
  import { isDangerousNameMatchingEnabled } from "openclaw/plugin-sdk/dangerous-name-runtime";
38
38
  import { EmbeddedBlockChunker, resolveAckReaction, resolveAgentConfig as resolveAgentConfig$1, resolveHumanDelayConfig } from "openclaw/plugin-sdk/agent-runtime";
39
- import { getSessionEntry, readSessionUpdatedAtAsync, resolveStorePath } from "openclaw/plugin-sdk/session-store-runtime";
39
+ import { getSessionEntryAsync, readSessionUpdatedAtAsync, resolveStorePath } from "openclaw/plugin-sdk/session-store-runtime";
40
40
  import { buildChannelInboundEventContext, createCommandTurnContext, dispatchChannelInboundTurn, formatInboundEnvelope, formatInboundMediaUnavailableText, getGroupThreadDeliverySession, hasFinalInboundReplyDispatch, readAgentRunTerminalOutcome, resolveEnvelopeFormatOptions, toHistoryMediaEntries, toInboundMediaFactsWithMetadata } from "openclaw/plugin-sdk/channel-inbound";
41
+ import { readLatestAssistantTextByIdentity } from "openclaw/plugin-sdk/session-transcript-runtime";
41
42
  import { getGlobalHookRunner } from "openclaw/plugin-sdk/plugin-runtime";
42
43
  import { buildHistoryContextFromEntries, buildInboundHistoryFromEntries, createChannelHistoryWindow } from "openclaw/plugin-sdk/reply-history";
43
44
  import { resolveChannelContextVisibilityMode } from "openclaw/plugin-sdk/context-visibility-runtime";
44
45
  import { formatAudioTranscriptForAgent } from "openclaw/plugin-sdk/media-understanding-runtime";
45
46
  import { createStatusReactionController, logAckFailure, logTypingFailure, shouldAckReaction } from "openclaw/plugin-sdk/channel-feedback";
46
- import { readLatestAssistantTextByIdentity } from "openclaw/plugin-sdk/session-transcript-runtime";
47
47
  //#region extensions/discord/src/monitor/message-handler.recent-history.ts
48
48
  /** Fetch a physical recent window, never walking older pages to refill filtered rows. */
49
49
  async function recoverDiscordChannelHistory(params) {
@@ -233,7 +233,7 @@ async function buildDiscordMessageProcessContext(params) {
233
233
  });
234
234
  const storePath = resolveStorePath(cfg.session?.store, { agentId: route.agentId });
235
235
  const envelopeOptions = resolveEnvelopeFormatOptions(cfg);
236
- const routeSession = getSessionEntry({
236
+ const routeSession = await getSessionEntryAsync({
237
237
  agentId: route.agentId,
238
238
  storePath,
239
239
  sessionKey: route.sessionKey,
@@ -248,13 +248,8 @@ async function buildDiscordMessageProcessContext(params) {
248
248
  sessionKey: boundSessionKey ?? route.sessionKey,
249
249
  readConsistency: "latest"
250
250
  };
251
- const historySession = recoversHistory ? historySessionScope.sessionKey === route.sessionKey ? routeSession : getSessionEntry(historySessionScope) : void 0;
252
- const isHistoryCurrent = () => {
253
- if (abortSignal?.aborted || ctx.isPolicyCurrent?.() === false) return false;
254
- if (!recoversHistory) return true;
255
- const current = getSessionEntry(historySessionScope);
256
- return current?.sessionId === historySession?.sessionId && current?.lifecycleRevision === historySession?.lifecycleRevision && current?.sessionStartedAt === historySession?.sessionStartedAt && current?.updatedAt === 0 === (historySession?.updatedAt === 0);
257
- };
251
+ const historySession = recoversHistory ? historySessionScope.sessionKey === route.sessionKey ? routeSession : await getSessionEntryAsync(historySessionScope) : void 0;
252
+ const isHistoryCurrent = () => !abortSignal?.aborted && ctx.isPolicyCurrent?.() !== false;
258
253
  const channelHistory = createChannelHistoryWindow({ historyMap: guildHistories });
259
254
  let visibleChannelHistory;
260
255
  const unavailableMediaCount = mediaList.filter((media) => !media.path).length;
@@ -593,20 +588,20 @@ async function buildDiscordMessageProcessContext(params) {
593
588
  }
594
589
  //#endregion
595
590
  //#region extensions/discord/src/monitor/message-handler.process-progress.ts
596
- function createDiscordMessageProgressRuntime(params) {
591
+ async function createDiscordMessageProgressRuntime(params) {
597
592
  const { ctx, draftPreview } = params;
598
593
  const { cfg, route, abortSignal } = ctx;
599
- const reasoningLevel = (() => {
594
+ const reasoningLevel = await (async () => {
600
595
  const cfgDefault = resolveAgentConfig(cfg, route.agentId ?? "main")?.reasoningDefault ?? cfg.agents?.defaults?.reasoningDefault;
601
596
  const configDefault = cfgDefault === "on" || cfgDefault === "stream" ? cfgDefault : "off";
602
597
  if (!params.sessionKey) return configDefault;
603
598
  try {
604
599
  const storePath = resolveStorePath(cfg.session?.store, { agentId: route.agentId });
605
- const level = getSessionEntry({
600
+ const level = (await getSessionEntryAsync({
606
601
  agentId: route.agentId,
607
602
  sessionKey: params.sessionKey,
608
603
  storePath
609
- })?.reasoningLevel;
604
+ }))?.reasoningLevel;
610
605
  if (level === "on" || level === "stream" || level === "off") return level;
611
606
  } catch {
612
607
  return "off";
@@ -870,7 +865,6 @@ function createDiscordDraftStream(params) {
870
865
  let streamMessage;
871
866
  let lastSentText = "";
872
867
  const sendOrEditStreamMessage = async ({ text, complete }) => {
873
- const generation = lifecycle.generation;
874
868
  const targetChannelId = channelId;
875
869
  const trimmed = text.trimEnd();
876
870
  if (!trimmed) return false;
@@ -891,7 +885,7 @@ function createDiscordDraftStream(params) {
891
885
  };
892
886
  if (streamMessage !== void 0) {
893
887
  await editChannelMessage(rest, streamMessage.channelId, streamMessage.messageId, { body });
894
- if (generation === lifecycle.generation) lastSentText = trimmed;
888
+ lastSentText = trimmed;
895
889
  return true;
896
890
  }
897
891
  const replyToMessageId = (typeof params.replyToMessageId === "function" ? params.replyToMessageId() : params.replyToMessageId)?.trim();
@@ -899,27 +893,22 @@ function createDiscordDraftStream(params) {
899
893
  message_id: replyToMessageId,
900
894
  fail_if_not_exists: false
901
895
  } : void 0;
902
- return await lifecycle.createMessage(async () => {
903
- const sent = await rest.post(Routes.channelMessages(targetChannelId), { body: {
904
- ...body,
905
- ...messageReference ? { message_reference: messageReference } : {}
906
- } });
907
- return typeof sent?.id === "string" && sent.id ? {
908
- channelId: targetChannelId,
909
- messageId: sent.id
910
- } : void 0;
911
- }, (message) => {
912
- if (!message) {
913
- streamState.stopped = true;
914
- params.warn?.("discord stream preview stopped (missing message id from send)");
915
- return false;
916
- }
917
- streamMessage = message;
918
- lastSentText = trimmed;
919
- return true;
920
- });
896
+ const sent = await rest.post(Routes.channelMessages(targetChannelId), { body: {
897
+ ...body,
898
+ ...messageReference ? { message_reference: messageReference } : {}
899
+ } });
900
+ if (typeof sent?.id !== "string" || !sent.id) {
901
+ streamState.stopped = true;
902
+ params.warn?.("discord stream preview stopped (missing message id from send)");
903
+ return false;
904
+ }
905
+ streamMessage = {
906
+ channelId: targetChannelId,
907
+ messageId: sent.id
908
+ };
909
+ lastSentText = trimmed;
910
+ return true;
921
911
  } catch (err) {
922
- if (generation !== lifecycle.generation) return true;
923
912
  streamState.stopped = true;
924
913
  params.warn?.(`discord stream preview failed: ${formatErrorMessage(err)}`);
925
914
  return false;
@@ -1224,6 +1213,7 @@ function createDiscordDraftPreviewController(params) {
1224
1213
  };
1225
1214
  freezeProgress();
1226
1215
  await withDiscordRequestAuthority(assertCurrent, async () => {
1216
+ await info.onPlatformSendDispatch?.();
1227
1217
  assertCurrent();
1228
1218
  stream.update(text, { complete: true });
1229
1219
  await stream.flush();
@@ -1436,7 +1426,7 @@ function createDiscordMessageReplyRuntime(params) {
1436
1426
  if (!sessionKey) return;
1437
1427
  try {
1438
1428
  const storePath = resolveStorePath(cfg.session?.store, { agentId: route.agentId });
1439
- const sessionEntry = getSessionEntry({
1429
+ const sessionEntry = await getSessionEntryAsync({
1440
1430
  agentId: route.agentId,
1441
1431
  sessionKey,
1442
1432
  storePath
@@ -1612,7 +1602,7 @@ async function processDiscordMessage(ctx, observer) {
1612
1602
  await retainedProgress;
1613
1603
  };
1614
1604
  let pendingToolWarningFinal;
1615
- const progress = createDiscordMessageProgressRuntime({
1605
+ const progress = await createDiscordMessageProgressRuntime({
1616
1606
  ctx,
1617
1607
  sessionKey: ctxPayload.SessionKey,
1618
1608
  sourceRepliesAreToolOnly,
@@ -1,7 +1,7 @@
1
1
  import { t as createDiscordActionGate } from "./accounts-ljrzXBJi.mjs";
2
- import { d as normalizeDiscordMessagingTarget, f as normalizeDiscordOutboundTarget, g as hasDiscordMessageCreateAmbiguity, i as toDiscordOutboundDeliveryResult, n as createDiscordSendReceiptFromResults, p as canFallbackDiscordWebhookSend, s as resolveDiscordReplyReference, t as createDiscordSendReceipt, v as chunkDiscordTextWithMode } from "./send.receipt-BAlzXd8e.mjs";
2
+ import { d as normalizeDiscordMessagingTarget, f as normalizeDiscordOutboundTarget, g as hasDiscordMessageCreateAmbiguity, i as toDiscordOutboundDeliveryResult, n as createDiscordSendReceiptFromResults, p as canFallbackDiscordWebhookSend, s as resolveDiscordReplyReference, t as createDiscordSendReceipt, v as chunkDiscordTextWithMode } from "./send.receipt-eE3zLTDH.mjs";
3
3
  import { t as parseDiscordTarget } from "./target-parsing-C-HyNxcE.mjs";
4
- import { a as resolveDiscordComponentSpec, b as discordInboundEventDelivery, c as formatDiscordApprovalDisplayValue, g as resolveDiscordCurrentConversationIdentity, n as DISCORD_PRESENTATION_CAPABILITIES, o as sendDiscordComponentMessageLazy, r as buildDiscordPresentationPayload, x as notifyDiscordInboundEventOutboundPayloadSuccess } from "./outbound-session-route-iwnu6IK8.mjs";
4
+ import { C as discordInboundEventDelivery, a as resolveDiscordComponentSpec, c as formatDiscordApprovalDisplayValue, n as DISCORD_PRESENTATION_CAPABILITIES, o as sendDiscordComponentMessageLazy, r as buildDiscordPresentationPayload, w as notifyDiscordInboundEventOutboundPayloadSuccess, y as resolveDiscordCurrentConversationIdentity } from "./outbound-session-route-CsHHPxsQ.mjs";
5
5
  import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
6
6
  import { createSubsystemLogger } from "openclaw/plugin-sdk/runtime-env";
7
7
  import { asOptionalRecord, normalizeLowercaseStringOrEmpty, normalizeOptionalString, normalizeOptionalStringifiedId } from "openclaw/plugin-sdk/string-coerce-runtime";
@@ -137,7 +137,7 @@ function normalizeDiscordApprovalPayload(payload) {
137
137
  }
138
138
  //#endregion
139
139
  //#region extensions/discord/src/outbound-send-context.ts
140
- const loadDiscordSendRuntime = createLazyRuntimeModule(() => import("./send-DbILKgcm.mjs").then((n) => n.t));
140
+ const loadDiscordSendRuntime = createLazyRuntimeModule(() => import("./send-yR1hfybW.mjs").then((n) => n.t));
141
141
  function resolveDiscordFormattingOptions(ctx) {
142
142
  const formatting = ctx.formatting;
143
143
  return {
@@ -333,8 +333,8 @@ async function sendDiscordOutboundPayload(params) {
333
333
  const DISCORD_TEXT_CHUNK_LIMIT = 2e3;
334
334
  const DISCORD_PRECHUNK_MAX_LINES = Number.MAX_SAFE_INTEGER;
335
335
  const log = createSubsystemLogger("discord/outbound");
336
- const loadDiscordThreadBindings = createLazyRuntimeModule(() => import("./thread-bindings-0hPTSK14.mjs").then((n) => n.i));
337
- const loadDiscordComponentSendRuntime = createLazyRuntimeModule(() => import("./send.components-FxOS3CeP.mjs").then((n) => n.i));
336
+ const loadDiscordThreadBindings = createLazyRuntimeModule(() => import("./thread-bindings-Dsc3zsrI.mjs").then((n) => n.i));
337
+ const loadDiscordComponentSendRuntime = createLazyRuntimeModule(() => import("./send.components--dxMjc2O.mjs").then((n) => n.i));
338
338
  function resolveDiscordDeliveryOptions(params) {
339
339
  return {
340
340
  onPlatformSendDispatch: params.onPlatformSendDispatch,
@@ -1,18 +1,20 @@
1
1
  import { i as listDiscordAccountIds, l as resolveDiscordAccount, t as createDiscordActionGate } from "./accounts-ljrzXBJi.mjs";
2
2
  import { t as inspectDiscordAccount } from "./account-inspect-8cCu6uPG.mjs";
3
3
  import { A as isDiscordThreadChannelType } from "./allow-list-B_ToXtew.mjs";
4
- import { d as normalizeDiscordMessagingTarget, u as matchesDiscordToolContextTarget } from "./send.receipt-BAlzXd8e.mjs";
4
+ import { d as normalizeDiscordMessagingTarget, u as matchesDiscordToolContextTarget } from "./send.receipt-eE3zLTDH.mjs";
5
5
  import { t as parseDiscordTarget } from "./target-parsing-C-HyNxcE.mjs";
6
- import { h as readDiscordComponentSpec, m as coerceDiscordComponentParam } from "./components-HN9052L1.mjs";
7
- import { n as resolveDiscordCommandOwnerEntries } from "./command-owners-C7rUdqUX.mjs";
6
+ import { h as readDiscordComponentSpec, m as coerceDiscordComponentParam } from "./components-C_cuoW1q.mjs";
7
+ import { n as resolveDiscordCommandOwnerEntries } from "./command-owners-D78sAoOz.mjs";
8
8
  import { createLazyRuntimeMethod, createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
9
9
  import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
10
+ import { normalizeAccountId } from "openclaw/plugin-sdk/account-id";
10
11
  import { buildOutboundBaseSessionKey, deriveLastRoutePolicy, isAcpSessionKey, isSubagentSessionKey, parseAgentSessionKey, resolveAgentIdFromSessionKey, resolveAgentRoute } from "openclaw/plugin-sdk/routing";
11
12
  import { asNonArrayRecord, asOptionalRecord, isRecord, normalizeOptionalLowercaseString, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
12
13
  import { createUnionActionGate } from "openclaw/plugin-sdk/channel-actions";
13
14
  import { ChannelType } from "discord-api-types/v10";
14
15
  import { resolveAskUserQuestionOptionIndices } from "openclaw/plugin-sdk/reply-payload";
15
16
  import { Type } from "typebox";
17
+ import { resolveGlobalMap } from "openclaw/plugin-sdk/global-singleton";
16
18
  import { buildThreadAwareOutboundSessionRoute } from "openclaw/plugin-sdk/channel-core";
17
19
  import { getExecApprovalReplyMetadata, isChannelExecApprovalClientEnabledFromConfig, matchesApprovalRequestFilters } from "openclaw/plugin-sdk/approval-client-runtime";
18
20
  import { resolveApprovalApprovers } from "openclaw/plugin-sdk/approval-auth-runtime";
@@ -221,7 +223,7 @@ function resolveDiscordThreadReplyTarget(args) {
221
223
  const target = threadId !== void 0 ? `channel:${threadId}` : normalizeOptionalString(args.channelId) ?? normalizeOptionalString(args.to) ?? normalizeOptionalString(args.target);
222
224
  return target ? normalizeDiscordMessagingTarget(target) : void 0;
223
225
  }
224
- const loadDiscordChannelActionsRuntime = createLazyRuntimeModule(() => import("./handle-action-CsQmpfGZ.mjs"));
226
+ const loadDiscordChannelActionsRuntime = createLazyRuntimeModule(() => import("./handle-action-0-FZD3Am.mjs"));
225
227
  const discordActionGroups = [
226
228
  {
227
229
  gate: "polls",
@@ -568,6 +570,21 @@ function shouldIgnoreStaleDiscordRouteBinding(params) {
568
570
  return bound.agentId !== params.route.agentId;
569
571
  }
570
572
  //#endregion
573
+ //#region extensions/discord/src/channel-policy-state.ts
574
+ const channelPolicyBindings = resolveGlobalMap(Symbol.for("openclaw.discord.channel-policy-bindings"), "close-and-restart");
575
+ function setDiscordChannelPolicyBindings(accountId, bindings) {
576
+ channelPolicyBindings.set(normalizeAccountId(accountId), [...bindings]);
577
+ }
578
+ function listBindings(accountId, guildKey) {
579
+ return (channelPolicyBindings.get(normalizeAccountId(accountId)) ?? []).filter((binding) => binding.guildKey === guildKey);
580
+ }
581
+ function getDiscordChannelPolicyBinding(accountId, guildKey, channelKey) {
582
+ return listBindings(accountId, guildKey).find((binding) => binding.channelKey === channelKey)?.channelId;
583
+ }
584
+ function findDiscordChannelPolicyKey(accountId, guildKey, channelId) {
585
+ return listBindings(accountId, guildKey).find((binding) => binding.channelId === channelId)?.channelKey;
586
+ }
587
+ //#endregion
571
588
  //#region extensions/discord/src/approval-message-safety.ts
572
589
  const DISCORD_APPROVAL_ALLOWED_MENTIONS = { parse: [] };
573
590
  const DISCORD_MARKDOWN_META_CHARACTERS = /* @__PURE__ */ new Set([
@@ -642,8 +659,8 @@ const DISCORD_PRESENTATION_CAPABILITIES = {
642
659
  }
643
660
  }
644
661
  };
645
- const sendDiscordComponentMessageLazy = createLazyRuntimeMethod(createLazyRuntimeModule(() => import("./send.components-FxOS3CeP.mjs").then((n) => n.i)), (runtime) => runtime.sendDiscordComponentMessage);
646
- const loadDiscordSharedInteractive = createLazyRuntimeModule(() => import("./components-HN9052L1.mjs").then((n) => n.a));
662
+ const sendDiscordComponentMessageLazy = createLazyRuntimeMethod(createLazyRuntimeModule(() => import("./send.components--dxMjc2O.mjs").then((n) => n.i)), (runtime) => runtime.sendDiscordComponentMessage);
663
+ const loadDiscordSharedInteractive = createLazyRuntimeModule(() => import("./components-C_cuoW1q.mjs").then((n) => n.a));
647
664
  function addPayloadTextFallback(spec, payload) {
648
665
  return spec.text ? spec : {
649
666
  ...spec,
@@ -740,4 +757,4 @@ function resolveDiscordOutboundTargetKindHint(params) {
740
757
  return /^(user:|discord:|@|<@!?)/i.test(params.target.trim()) ? "user" : "channel";
741
758
  }
742
759
  //#endregion
743
- export { collectDiscordAuditChannelIdsForAccount as C, isDiscordExecApprovalClientEnabled as D, isDiscordExecApprovalApprover as E, shouldSuppressLocalDiscordExecApprovalPrompt as O, auditDiscordChannelPermissionsWithFetcher as S, getDiscordExecApprovalApprovers as T, resolveDiscordRuntimeBindingConversationId as _, resolveDiscordComponentSpec as a, discordInboundEventDelivery as b, formatDiscordApprovalDisplayValue as c, resolveDiscordBoundConversationRoute as d, resolveDiscordConversationRoute as f, resolveDiscordCurrentConversationIdentity as g, resolveDiscordConversationIdentity as h, isDiscordComponentSpecWithinMessageLimit as i, buildDiscordConversationRouteContext as l, shouldIgnoreStaleDiscordRouteBinding as m, DISCORD_PRESENTATION_CAPABILITIES as n, sendDiscordComponentMessageLazy as o, resolveDiscordEffectiveRoute as p, buildDiscordPresentationPayload as r, DISCORD_APPROVAL_ALLOWED_MENTIONS as s, resolveDiscordOutboundSessionRoute as t, buildDiscordRoutePeer as u, discordMessageActions as v, resolveRequiredDiscordChannelPermissions as w, notifyDiscordInboundEventOutboundPayloadSuccess as x, isTrustedRequesterGuildAdminAction as y };
760
+ export { isDiscordExecApprovalClientEnabled as A, discordInboundEventDelivery as C, resolveRequiredDiscordChannelPermissions as D, collectDiscordAuditChannelIdsForAccount as E, getDiscordExecApprovalApprovers as O, isTrustedRequesterGuildAdminAction as S, auditDiscordChannelPermissionsWithFetcher as T, shouldIgnoreStaleDiscordRouteBinding as _, resolveDiscordComponentSpec as a, resolveDiscordRuntimeBindingConversationId as b, formatDiscordApprovalDisplayValue as c, setDiscordChannelPolicyBindings as d, buildDiscordConversationRouteContext as f, resolveDiscordEffectiveRoute as g, resolveDiscordConversationRoute as h, isDiscordComponentSpecWithinMessageLimit as i, shouldSuppressLocalDiscordExecApprovalPrompt as j, isDiscordExecApprovalApprover as k, findDiscordChannelPolicyKey as l, resolveDiscordBoundConversationRoute as m, DISCORD_PRESENTATION_CAPABILITIES as n, sendDiscordComponentMessageLazy as o, buildDiscordRoutePeer as p, buildDiscordPresentationPayload as r, DISCORD_APPROVAL_ALLOWED_MENTIONS as s, resolveDiscordOutboundSessionRoute as t, getDiscordChannelPolicyBinding as u, resolveDiscordConversationIdentity as v, notifyDiscordInboundEventOutboundPayloadSuccess as w, discordMessageActions as x, resolveDiscordCurrentConversationIdentity as y };