@openclaw/discord 2026.7.2-beta.7 → 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 (114) hide show
  1. package/dist/{account-inspect-SXiCBCgP.js → account-inspect-D5xmUpnj.js} +49 -43
  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/{active-turn-thread-route-MlKWp8RD.js → active-turn-thread-route-fmHl1HNd.js} +9 -11
  6. package/dist/{activities-api-DTKsuDxf.js → activities-api-KCBAmWxD.js} +133 -175
  7. package/dist/activities-api.js +1 -1
  8. package/dist/{allow-list-DzKrtfah.js → allow-list-BDMimASD.js} +2 -3
  9. package/dist/{api-DnrK9gML.js → api-DNVbJyEy.js} +7 -2
  10. package/dist/api.js +18 -18
  11. package/dist/{approval-handler.runtime-HymvFTYn.js → approval-handler.runtime-B12RCYr8.js} +6 -6
  12. package/dist/{approval-message-safety-DEyKVsAw.js → approval-message-safety-XGFPbDoI.js} +89 -3
  13. package/dist/{audit-CjsrabP8.js → audit-Yc7eZDd6.js} +5 -5
  14. package/dist/{channel-actions-uXFTJX3o.js → channel-actions-Dr2QI8Bf.js} +11 -7
  15. package/dist/{channel-actions.runtime-CIYU90sl.js → channel-actions.runtime-CODTvo7c.js} +99 -97
  16. package/dist/{channel-vKa-76xY.js → channel-cXYzGc4L.js} +102 -104
  17. package/dist/channel-config-api.js +1 -1
  18. package/dist/channel-plugin-api.js +1 -1
  19. package/dist/{channel.setup-CmcwZ_qd.js → channel.setup-CSiwnMgs.js} +16 -54
  20. package/dist/{outbound-session-route-H-HoyH5U.js → components-ezGKo_Yh.js} +69 -142
  21. package/dist/{config-schema-WHRQcY19.js → config-schema-DC5kDtQ5.js} +42 -11
  22. package/dist/conversation-binding-route-D6rCQ5S0.js +43 -0
  23. package/dist/{directory-config-D_LojtCe.js → directory-config-XyCfoqLg.js} +2 -2
  24. package/dist/directory-contract-api.js +1 -1
  25. package/dist/{directory-live-Bw5Ephzv.js → directory-live-Df0NbFJB.js} +7 -4
  26. package/dist/{doctor-Bc4S1qyd.js → doctor-DYY31GrO.js} +34 -13
  27. package/dist/{doctor-contract-CCFMIDk9.js → doctor-contract-DsWvKIXF.js} +2 -3
  28. package/dist/doctor-contract-api.js +147 -2
  29. package/dist/{handle-action.guild-admin-D6VRRW-C.js → handle-action.guild-admin-6Tvvinsa.js} +4 -7
  30. package/dist/{inbound-event-delivery-CEPlt2uz.js → inbound-event-delivery-De2qxTrP.js} +4 -25
  31. package/dist/index.js +5 -4
  32. package/dist/{message-handler-CeiSulIw.js → message-handler-B61q5MOF.js} +118 -33
  33. package/dist/{message-handler.preflight-DibgQFf2.js → message-handler.preflight-Bzg_Hawz.js} +75 -61
  34. package/dist/{message-handler.process-Dnc_oz9y.js → message-handler.process--4_712Ec.js} +236 -296
  35. package/dist/{message-utils-BgTwT_q7.js → message-utils-BXLLnFl6.js} +34 -35
  36. package/dist/{model-picker-preference-primitives-D25pnCOu.js → model-picker-preference-primitives-BHT1LkR_.js} +3 -3
  37. package/dist/{outbound-adapter-DtE-i2OJ.js → outbound-adapter-DxHTOqiN.js} +157 -68
  38. package/dist/{outbound-components-C7GVyfPh.js → outbound-components-B2PL0ooH.js} +3 -3
  39. package/dist/owner-access-Bg41VzAf.js +107 -0
  40. package/dist/{pluralkit-CD4B11JB.js → pluralkit-dUl4v1X3.js} +1 -1
  41. package/dist/{preflight-audio-BjnQZ5yS.js → preflight-audio-DrnqFA8U.js} +22 -28
  42. package/dist/{probe-BeWKhjqX.js → probe-BTdtVRwU.js} +37 -13
  43. package/dist/probe.runtime-Dq5-PRKT.js +2 -0
  44. package/dist/{provider-DfQJX3z5.js → provider-DlK_ynqt.js} +1131 -2021
  45. package/dist/{provider-session.runtime-Bo88k0pV.js → provider-session.runtime-CvvphHvs.js} +3 -3
  46. package/dist/provider.runtime-CzKGRiAF.js +2 -0
  47. package/dist/realtime-session.runtime-ysbMG8v7.js +1351 -0
  48. package/dist/{resolve-allowlist-common-DHERApxi.js → resolve-allowlist-common-DIVXbD1P.js} +3 -3
  49. package/dist/{resolve-channels-BjepAj8b.js → resolve-channels-CGeUoIqb.js} +4 -4
  50. package/dist/{resolve-users-Bc28htgt.js → resolve-users-BtKxLUZv.js} +3 -3
  51. package/dist/{chunk-DX4jpFQP.js → retry-DNsVTeTo.js} +308 -131
  52. package/dist/{runtime-BmW_j_hl.js → runtime-CQovMsH3.js} +12 -15
  53. package/dist/{runtime-_aRC6V2s.js → runtime-D71_VFLr.js} +49 -58
  54. package/dist/runtime-api.actions.js +2 -2
  55. package/dist/runtime-api.js +23 -23
  56. package/dist/runtime-api.lookup.js +5 -5
  57. package/dist/runtime-api.monitor-CzeTYF32.js +6 -0
  58. package/dist/runtime-api.monitor.js +6 -5
  59. package/dist/runtime-api.send.js +6 -6
  60. package/dist/runtime-api.threads.js +5 -6
  61. package/dist/sdk-runtime-37OU6_Yh.js +369 -0
  62. package/dist/{secret-config-contract-B1akrlyY.js → secret-config-contract-B3i6WxV5.js} +53 -25
  63. package/dist/secret-contract-api.js +1 -1
  64. package/dist/security-audit-contract-api.js +1 -1
  65. package/dist/{security-audit.runtime-CPN0xFYz.js → security-audit.runtime-BVKF9VtY.js} +1 -1
  66. package/dist/{send-CdkZ6zeW.js → send-rQIffSYu.js} +180 -91
  67. package/dist/{send.components-5uqwkjgE.js → send.components-ChK1wS7w.js} +32 -46
  68. package/dist/{send.outbound-D-80Ej-t.js → send.outbound-HIkgji_7.js} +57 -34
  69. package/dist/{send.reactions-CtlmGd_o.js → send.reactions-gmJ6yFPo.js} +14 -21
  70. package/dist/{send.receipt-CuwRrpFz.js → send.receipt-Cnhoautb.js} +29 -1
  71. package/dist/{send.shared-jpvAG_u6.js → send.shared-B3fpaLWJ.js} +112 -181
  72. package/dist/{sender-identity-mG_zsdox.js → sender-identity-BJtfyise.js} +1 -1
  73. package/dist/setup-entry.js +0 -5
  74. package/dist/setup-plugin-api.js +1 -1
  75. package/dist/{shared-CXF1tup1.js → shared-CaAaoksy.js} +27 -23
  76. package/dist/subagent-hooks-CNT2ZJTJ.js +49 -0
  77. package/dist/subagent-hooks-api.js +2 -6
  78. package/dist/subagent-progress-FPLqBY1s.js +110 -0
  79. package/dist/{system-events-DdUqf91B.js → system-events-Nuwoq_au.js} +2 -2
  80. package/dist/{target-resolver-C3s_2m0t.js → target-resolver-DIXShHaZ.js} +3 -3
  81. package/dist/targets-B2pf49zc.js +3 -0
  82. package/dist/{thread-bindings-C-M-ly7P.js → thread-bindings-VlymUnbz.js} +29 -28
  83. package/dist/{thread-bindings.manager-DYvSlrva.js → thread-bindings.manager-CngsgErq.js} +258 -29
  84. package/dist/{thread-bindings.session-updates-DAIlp7Px.js → thread-bindings.session-updates-CJb-BpPL.js} +1 -1
  85. package/dist/{thread-bindings.state-Cgi5uRn-.js → thread-bindings.state-D8OMdk4O.js} +3 -16
  86. package/dist/threading-DU6pgeGm.js +456 -0
  87. package/dist/transcripts-source-DeIMNbRh.js +265 -0
  88. package/dist/transcripts-source-api.js +7 -2
  89. package/dist/{typing--Mzo2kM7.js → typing-oLiS5Z13.js} +1 -1
  90. package/dist/voice-runtime-CjNFaynA.js +2549 -0
  91. package/openclaw.plugin.json +215 -25
  92. package/package.json +15 -11
  93. package/skills/discord/SKILL.md +22 -115
  94. package/dist/accounts-DJTf1LtA.js +0 -219
  95. package/dist/channel-api-CAJ0wMoV.js +0 -21
  96. package/dist/legacy-state-migrations-api.js +0 -138
  97. package/dist/manager.runtime-Bjav3pfC.js +0 -3655
  98. package/dist/preflight-audio.runtime-CoCXMM8r.js +0 -7
  99. package/dist/probe.runtime-DqFGFMbZ.js +0 -2
  100. package/dist/provider.runtime-Cy7XZmyh.js +0 -2
  101. package/dist/runtime-api.monitor-CCRubd3-.js +0 -5
  102. package/dist/session-binding-contract-api.js +0 -2
  103. package/dist/subagent-hooks-Dxy7Fmnq.js +0 -120
  104. package/dist/subagent-progress-DI3sYLLo.js +0 -664
  105. package/dist/targets-Dv_RN7vT.js +0 -3
  106. package/dist/thread-bindings.discord-api-BoDNqamb.js +0 -246
  107. package/dist/transcripts-source-DIKGsTGT.js +0 -123
  108. package/node_modules/p-map/index.d.ts +0 -155
  109. package/node_modules/p-map/index.js +0 -285
  110. package/node_modules/p-map/license +0 -9
  111. package/node_modules/p-map/package.json +0 -57
  112. package/node_modules/p-map/readme.md +0 -190
  113. package/dist/{audit-core-xwjIczO0.js → audit-core-BCX8UeFH.js} +1 -1
  114. package/dist/{security-audit-jGnJF__m.js → security-audit-BfJhAXZp.js} +1 -1
@@ -1,33 +1,34 @@
1
- import { F as Message, bt as getChannelMessage, d as discord_exports } from "./chunk-DX4jpFQP.js";
2
- import { o as resolveDefaultDiscordAccountId } from "./accounts-DJTf1LtA.js";
3
- import { C as resolveTimestampMs, S as resolveDiscordSystemLocation, _ as resolveDiscordShouldRequireMention, a as normalizeDiscordSlug, c as resolveDiscordChannelConfigWithFallback, f as resolveDiscordGuildEntry, i as normalizeDiscordDisplaySlug, n as isDiscordGroupAllowedByPolicy, p as resolveDiscordMemberAccessState, v as resolveGroupDmAllow, x as formatDiscordUserTag } from "./allow-list-DzKrtfah.js";
1
+ import { R as Message, Tt as getChannelMessage, p as discord_exports } from "./retry-DNsVTeTo.js";
2
+ import { s as resolveDefaultDiscordAccountId } from "./accounts-DNl-oCEw.js";
3
+ import { C as resolveTimestampMs, S as resolveDiscordSystemLocation, _ as resolveDiscordShouldRequireMention, a as normalizeDiscordSlug, c as resolveDiscordChannelConfigWithFallback, f as resolveDiscordGuildEntry, i as normalizeDiscordDisplaySlug, n as isDiscordGroupAllowedByPolicy, p as resolveDiscordMemberAccessState, v as resolveGroupDmAllow, x as formatDiscordUserTag } from "./allow-list-BDMimASD.js";
4
4
  import { n as DISCORD_ATTACHMENT_TOTAL_TIMEOUT_MS, t as DISCORD_ATTACHMENT_IDLE_TIMEOUT_MS } from "./timeouts-B9cy6RvQ.js";
5
- import { r as resolveDiscordConversationIdentity } from "./approval-message-safety-DEyKVsAw.js";
6
- import { f as resolveDiscordChannelInfoSafe, p as resolveDiscordChannelNameSafe } from "./thread-bindings.discord-api-BoDNqamb.js";
7
- import { C as handleDiscordDmCommandDecision, M as resolveDiscordTextCommandAccess, S as shouldIgnoreStaleDiscordRouteBinding, b as resolveDiscordConversationRoute, j as resolveDiscordDmCommandAccess, x as resolveDiscordEffectiveRoute, y as buildDiscordRoutePeer } from "./provider-DfQJX3z5.js";
8
- import { d as resolveDiscordChannelInfo, f as resolveDiscordMessageChannelId, i as resolveDiscordMessageText, o as resolveForwardedMediaList, r as resolveDiscordMessageHistoryText, s as resolveMediaList, u as resolveDiscordMessageStickers } from "./message-utils-BgTwT_q7.js";
9
- import { n as resolveDiscordWebhookId, t as resolveDiscordSenderIdentity } from "./sender-identity-mG_zsdox.js";
5
+ import { d as resolveDiscordRuntimeBindingConversationId, i as buildDiscordRoutePeer, l as resolveDiscordConversationIdentity, o as resolveDiscordConversationRoute, s as resolveDiscordEffectiveRoute } from "./approval-message-safety-XGFPbDoI.js";
6
+ import { t as resolveDiscordConversationBindingRoute } from "./conversation-binding-route-D6rCQ5S0.js";
7
+ import { c as resolveDiscordChannelInfoSafe, l as resolveDiscordChannelNameSafe } from "./thread-bindings.manager-CngsgErq.js";
8
+ import { b as resolveDiscordDmCommandAccess, g as handleDiscordDmCommandDecision, x as resolveDiscordTextCommandAccess } from "./provider-DlK_ynqt.js";
9
+ import { d as resolveDiscordMessageStickers, f as resolveDiscordChannelInfo, i as resolveDiscordMessageText, o as resolveForwardedMediaList, p as resolveDiscordMessageChannelId, r as resolveDiscordMessageHistoryText, s as resolveMediaList } from "./message-utils-BXLLnFl6.js";
10
+ import { n as resolveDiscordWebhookId, t as resolveDiscordSenderIdentity } from "./sender-identity-BJtfyise.js";
10
11
  import { t as createDiscordHistorySenderProvenance } from "./message-handler.history-CJOsN9w5.js";
11
- import { normalizeOptionalString, readStringValue } from "openclaw/plugin-sdk/string-coerce-runtime";
12
12
  import { logDebug } from "openclaw/plugin-sdk/logging-core";
13
13
  import { MessageReferenceType, MessageType } from "discord-api-types/v10";
14
- import { getChildLogger, logVerbose, shouldLogVerbose } from "openclaw/plugin-sdk/runtime-env";
14
+ import { normalizeOptionalString, readStringValue } from "openclaw/plugin-sdk/string-coerce-runtime";
15
15
  import { recordChannelActivity } from "openclaw/plugin-sdk/channel-activity-runtime";
16
+ import { mimeTypeFromFilePath } from "openclaw/plugin-sdk/media-mime";
17
+ import { getChildLogger, logVerbose, shouldLogVerbose } from "openclaw/plugin-sdk/runtime-env";
16
18
  import { formatAllowlistMatchMeta } from "openclaw/plugin-sdk/allow-from";
17
19
  import { findCodeRegions, isInsideCode } from "openclaw/plugin-sdk/text-chunking";
18
20
  import { isRecentOutboundMessageIdentity } from "openclaw/plugin-sdk/channel-outbound";
19
21
  import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
20
22
  import { isDangerousNameMatchingEnabled } from "openclaw/plugin-sdk/dangerous-name-runtime";
21
- import { enqueueSystemEvent } from "openclaw/plugin-sdk/system-event-runtime";
23
+ import { enqueueRoutedSystemEvent } from "openclaw/plugin-sdk/system-event-runtime";
22
24
  import { buildMentionRegexes, classifyChannelInboundEvent, implicitMentionKindWhen, logInboundDrop, matchesMentionWithExplicit, recordChannelBotPairLoopAndCheckSuppression, resolveInboundMentionDecision, resolveUnmentionedGroupInboundPolicy, toHistoryMediaEntries, toInboundMediaFactsWithMetadata } from "openclaw/plugin-sdk/channel-inbound";
23
- import { mimeTypeFromFilePath } from "openclaw/plugin-sdk/media-mime";
24
25
  import { hasControlCommand } from "openclaw/plugin-sdk/command-detection";
25
26
  import { isAbortRequestText } from "openclaw/plugin-sdk/command-primitives-runtime";
26
27
  import { shouldHandleTextCommands } from "openclaw/plugin-sdk/command-surface";
27
28
  import { createChannelHistoryWindow } from "openclaw/plugin-sdk/reply-history";
28
29
  //#region extensions/discord/src/monitor/message-handler.dm-preflight.ts
29
30
  const loadConversationRuntime$1 = createLazyRuntimeModule(() => import("openclaw/plugin-sdk/conversation-binding-runtime"));
30
- const loadDiscordSendRuntime = createLazyRuntimeModule(() => import("./send-CdkZ6zeW.js").then((n) => n.t));
31
+ const loadDiscordSendRuntime = createLazyRuntimeModule(() => import("./send-rQIffSYu.js").then((n) => n.t));
31
32
  function resolveDiscordDmPairingSenderId(sender) {
32
33
  return sender.isPluralKit ? `pk:${sender.id}` : sender.id;
33
34
  }
@@ -45,7 +46,7 @@ async function resolveDiscordDmPreflightAccess(params) {
45
46
  accountId: params.preflight.accountId,
46
47
  conversationId: directBindingConversationId
47
48
  });
48
- const dmAccess = await resolveDiscordDmCommandAccess({
49
+ const resolveChannelIngress = async (contextBinding, conversation) => await resolveDiscordDmCommandAccess({
49
50
  accountId: params.resolvedAccountId,
50
51
  dmPolicy: params.dmPolicy,
51
52
  configuredAllowFrom: params.preflight.allowFrom ?? [],
@@ -57,13 +58,26 @@ async function resolveDiscordDmPreflightAccess(params) {
57
58
  allowNameMatching: params.allowNameMatching,
58
59
  cfg: params.preflight.cfg,
59
60
  token: params.preflight.token,
60
- rest: params.preflight.client.rest
61
+ rest: params.preflight.client.rest,
62
+ conversationId: params.conversationId,
63
+ conversationParentId: conversation?.parentId,
64
+ conversationThreadId: conversation?.threadId,
65
+ ...contextBinding ? { contextBinding } : {}
61
66
  });
67
+ const dmAccess = await resolveChannelIngress();
62
68
  const commandAuthorized = dmAccess.senderAccess.allowed && dmAccess.commandAccess.authorized || directBindingRecord != null;
63
- if (dmAccess.senderAccess.decision === "allow") return { commandAuthorized };
69
+ if (dmAccess.senderAccess.decision === "allow") return {
70
+ commandAuthorized,
71
+ channelIngress: dmAccess,
72
+ resolveChannelIngress
73
+ };
64
74
  if (directBindingRecord) {
65
75
  logVerbose(`discord: allow bound DM conversation ${directBindingConversationId} despite dmPolicy=${params.dmPolicy}`);
66
- return { commandAuthorized };
76
+ return {
77
+ commandAuthorized,
78
+ channelIngress: dmAccess,
79
+ resolveChannelIngress
80
+ };
67
81
  }
68
82
  await handleDiscordDmCommandDecision({
69
83
  senderAccess: dmAccess.senderAccess,
@@ -475,10 +489,10 @@ function logDiscordPreflightInboundSummary(params) {
475
489
  }
476
490
  //#endregion
477
491
  //#region extensions/discord/src/monitor/message-handler.preflight-runtime.ts
478
- const loadPluralKitRuntime = createLazyRuntimeModule(() => import("./pluralkit-CD4B11JB.js").then((n) => n.n));
479
- const loadPreflightAudioRuntime = createLazyRuntimeModule(() => import("./preflight-audio-BjnQZ5yS.js"));
480
- const loadSystemEventsRuntime = createLazyRuntimeModule(() => import("./system-events-DdUqf91B.js"));
481
- const loadDiscordThreadingRuntime = createLazyRuntimeModule(() => import("./provider-DfQJX3z5.js").then((n) => n.E));
492
+ const loadPluralKitRuntime = createLazyRuntimeModule(() => import("./pluralkit-dUl4v1X3.js").then((n) => n.n));
493
+ const loadPreflightAudioRuntime = createLazyRuntimeModule(() => import("./preflight-audio-DrnqFA8U.js"));
494
+ const loadSystemEventsRuntime = createLazyRuntimeModule(() => import("./system-events-Nuwoq_au.js"));
495
+ const loadDiscordThreadingRuntime = createLazyRuntimeModule(() => import("./threading-DU6pgeGm.js").then((n) => n.t));
482
496
  function isPreflightAborted(abortSignal) {
483
497
  return Boolean(abortSignal?.aborted);
484
498
  }
@@ -541,40 +555,21 @@ async function resolveDiscordPreflightRoute(params) {
541
555
  }),
542
556
  parentConversationId: params.earlyThreadParentId
543
557
  });
544
- const bindingConversationId = params.isDirectMessage ? resolveDiscordConversationIdentity({
545
- isDirectMessage: true,
546
- userId: params.author.id
547
- }) ?? `user:${params.author.id}` : params.messageChannelId;
548
- let runtimeRoute = conversationRuntime.resolveRuntimeConversationBindingRoute({
549
- route,
550
- conversation: {
551
- channel: "discord",
552
- accountId: params.preflight.accountId,
553
- conversationId: bindingConversationId,
554
- parentConversationId: params.earlyThreadParentId
555
- }
558
+ const bindingConversationId = resolveDiscordRuntimeBindingConversationId({
559
+ isDirectMessage: params.isDirectMessage,
560
+ isGroupDm: params.isGroupDm,
561
+ userId: params.author.id,
562
+ channelId: params.messageChannelId
556
563
  });
557
- if (shouldIgnoreStaleDiscordRouteBinding({
558
- bindingRecord: runtimeRoute.bindingRecord,
559
- route
560
- })) {
561
- logVerbose(`discord: ignoring stale route binding for conversation ${bindingConversationId} (${runtimeRoute.bindingRecord?.targetSessionKey} -> ${route.sessionKey})`);
562
- runtimeRoute = {
563
- bindingRecord: null,
564
- route
565
- };
566
- }
567
- let threadBinding = runtimeRoute.bindingRecord ?? void 0;
568
- const configuredRoute = threadBinding == null ? conversationRuntime.resolveConfiguredBindingRoute({
564
+ const { runtimeRoute, configuredRoute } = resolveDiscordConversationBindingRoute({
569
565
  cfg: params.preflight.cfg,
570
566
  route,
571
- conversation: {
572
- channel: "discord",
573
- accountId: params.preflight.accountId,
574
- conversationId: params.messageChannelId,
575
- parentConversationId: params.earlyThreadParentId
576
- }
577
- }) : null;
567
+ accountId: params.preflight.accountId,
568
+ runtimeConversationId: bindingConversationId,
569
+ configuredConversationId: params.messageChannelId,
570
+ parentConversationId: params.earlyThreadParentId
571
+ });
572
+ let threadBinding = runtimeRoute.bindingRecord ?? void 0;
578
573
  const configuredBinding = configuredRoute?.bindingResolution ?? null;
579
574
  if (!threadBinding && configuredBinding) threadBinding = configuredBinding.record;
580
575
  const boundSessionKey = conversationRuntime.isPluginOwnedSessionBindingRecord(threadBinding) ? "" : runtimeRoute.boundSessionKey ?? threadBinding?.targetSessionKey?.trim();
@@ -771,6 +766,8 @@ async function preflightDiscordMessage(params) {
771
766
  const resolvedAccountId = params.accountId ?? resolveDefaultDiscordAccountId(params.cfg);
772
767
  const allowNameMatching = isDangerousNameMatchingEnabled(params.discordConfig);
773
768
  let commandAuthorized = true;
769
+ let channelIngress;
770
+ let resolveChannelIngress;
774
771
  if (isDirectMessage) {
775
772
  const access = await resolveDiscordDmPreflightAccess({
776
773
  preflight: params,
@@ -778,11 +775,14 @@ async function preflightDiscordMessage(params) {
778
775
  sender,
779
776
  dmPolicy,
780
777
  resolvedAccountId,
781
- allowNameMatching
778
+ allowNameMatching,
779
+ conversationId: messageChannelId
782
780
  });
783
781
  if (isPreflightAborted(params.abortSignal)) return null;
784
782
  if (!access) return null;
785
783
  commandAuthorized = access.commandAuthorized;
784
+ channelIngress = access.channelIngress;
785
+ resolveChannelIngress = access.resolveChannelIngress;
786
786
  }
787
787
  const botId = params.botUserId;
788
788
  const baseText = resolveDiscordMessageText(message, { includeForwarded: false });
@@ -960,7 +960,7 @@ async function preflightDiscordMessage(params) {
960
960
  const hasControlCommandInMessage = hasControlCommand(baseText, params.cfg);
961
961
  const hasAbortRequest = isAbortRequestText(baseText);
962
962
  if (!isDirectMessage) {
963
- const commandAccess = await resolveDiscordTextCommandAccess({
963
+ const resolveCommandIngress = async (contextBinding, conversation) => await resolveDiscordTextCommandAccess({
964
964
  accountId: params.accountId,
965
965
  cfg: params.cfg,
966
966
  ownerAllowFrom: params.allowFrom,
@@ -973,10 +973,17 @@ async function preflightDiscordMessage(params) {
973
973
  memberAllowed,
974
974
  allowNameMatching,
975
975
  allowTextCommands,
976
- hasControlCommand: hasControlCommandInMessage
976
+ hasControlCommand: hasControlCommandInMessage,
977
+ conversationId: messageChannelId,
978
+ conversationParentId: conversation?.parentId,
979
+ conversationThreadId: conversation?.threadId,
980
+ ...contextBinding ? { contextBinding } : {}
977
981
  });
978
- commandAuthorized = commandAccess.authorized;
979
- if (commandAccess.shouldBlockControlCommand) {
982
+ const commandAccess = await resolveCommandIngress();
983
+ commandAuthorized = commandAccess.commandAccess.authorized;
984
+ channelIngress = commandAccess;
985
+ resolveChannelIngress = resolveCommandIngress;
986
+ if (commandAccess.commandAccess.shouldBlockControlCommand) {
980
987
  logInboundDrop({
981
988
  log: logVerbose,
982
989
  channel: "discord",
@@ -1060,10 +1067,7 @@ async function preflightDiscordMessage(params) {
1060
1067
  const systemText = resolveDiscordSystemEvent(message, systemLocation);
1061
1068
  if (systemText) {
1062
1069
  logDebug(`[discord-preflight] drop: system event`);
1063
- enqueueSystemEvent(systemText, {
1064
- sessionKey: effectiveRoute.sessionKey,
1065
- contextKey: `discord:system:${messageChannelId}:${message.id}`
1066
- });
1070
+ enqueueRoutedSystemEvent(systemText, effectiveRoute, { contextKey: `discord:system:${messageChannelId}:${message.id}` });
1067
1071
  return null;
1068
1072
  }
1069
1073
  const hasNativeMedia = (message.attachments?.length ?? 0) > 0 || resolveDiscordMessageStickers(message).length > 0;
@@ -1099,6 +1103,13 @@ async function preflightDiscordMessage(params) {
1099
1103
  return null;
1100
1104
  }
1101
1105
  }
1106
+ const guildId = isGuildMessage ? data.guild?.id ?? data.guild_id ?? message.guild_id : void 0;
1107
+ const conversationAvatar = isDirectMessage || guildId ? params.avatarResolver?.resolve({
1108
+ client: params.client,
1109
+ conversationId: messageChannelId,
1110
+ author,
1111
+ ...guildId ? { guildId } : {}
1112
+ }) : void 0;
1102
1113
  const mediaResolveOptions = {
1103
1114
  fetchImpl: params.discordRestFetch,
1104
1115
  ssrfPolicy: params.cfg.browser?.ssrfPolicy,
@@ -1128,11 +1139,14 @@ async function preflightDiscordMessage(params) {
1128
1139
  isDirectMessage,
1129
1140
  isGroupDm,
1130
1141
  commandAuthorized,
1142
+ channelIngress,
1143
+ resolveChannelIngress,
1131
1144
  baseText,
1132
1145
  messageText,
1133
1146
  ...preflightTranscript !== void 0 ? { preflightAudioTranscript: preflightTranscript } : {},
1134
1147
  preparedMedia,
1135
1148
  wasMentioned,
1149
+ conversationAvatar,
1136
1150
  route: effectiveRoute,
1137
1151
  threadBinding,
1138
1152
  boundSessionKey: boundSessionKey || void 0,