@openclaw/discord 2026.7.2-beta.4 → 2026.7.2-beta.5

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 (81) hide show
  1. package/README.md +1 -1
  2. package/dist/{account-inspect-Dztmn4J4.js → account-inspect-SXiCBCgP.js} +1 -1
  3. package/dist/account-inspect-api.js +1 -1
  4. package/dist/{accounts-D2LKPukU.js → accounts-DJTf1LtA.js} +13 -15
  5. package/dist/action-runtime-api.js +1 -1
  6. package/dist/{activities-api-8TMGXUH4.js → activities-api-CHnz7E7t.js} +5 -5
  7. package/dist/activities-api.js +1 -1
  8. package/dist/api.js +16 -16
  9. package/dist/{approval-handler.runtime-ClZpan85.js → approval-handler.runtime-86UuBchU.js} +5 -5
  10. package/dist/{approval-message-safety-LyND6GR3.js → approval-message-safety-yjFtfJcK.js} +2 -2
  11. package/dist/{audit-CFfounXC.js → audit-BF8hmDKp.js} +4 -4
  12. package/dist/{channel-yq-so4jJ.js → channel-DnOg9aoT.js} +19 -18
  13. package/dist/{channel-actions-C8n1zWZ-.js → channel-actions-BweII8kV.js} +4 -4
  14. package/dist/{channel-actions.runtime-CgJy35O0.js → channel-actions.runtime-Dsv063Re.js} +6 -6
  15. package/dist/channel-plugin-api.js +1 -1
  16. package/dist/{channel.setup-Tn_O2B7F.js → channel.setup-Cpv7n0I8.js} +23 -50
  17. package/dist/{chunk-BrZocpfs.js → chunk-CMVEczdm.js} +12 -0
  18. package/dist/{directory-config-DF85-bUY.js → directory-config-677F_rhf.js} +2 -2
  19. package/dist/directory-contract-api.js +1 -1
  20. package/dist/{directory-live-CrMtTrb0.js → directory-live-BQk4bBOC.js} +6 -6
  21. package/dist/{doctor-CORGPgoY.js → doctor-DIcs6IDL.js} +4 -4
  22. package/dist/{doctor-contract-BPUD3Di9.js → doctor-contract-CCFMIDk9.js} +15 -58
  23. package/dist/doctor-contract-api.js +1 -1
  24. package/dist/{handle-action.guild-admin-DikBWer5.js → handle-action.guild-admin-D14y2JtA.js} +2 -2
  25. package/dist/index.js +2 -2
  26. package/dist/legacy-state-migrations-api.js +1 -34
  27. package/dist/{manager.runtime-DVvlH8NR.js → manager.runtime-asX6a4R4.js} +3 -3
  28. package/dist/{message-handler-1ui-YxsF.js → message-handler-CxjL-a-8.js} +7 -47
  29. package/dist/message-handler.history-CJOsN9w5.js +28 -0
  30. package/dist/{message-handler.preflight-CAEQvP3t.js → message-handler.preflight-D-5zBjwh.js} +33 -48
  31. package/dist/{message-handler.process-REBztvIW.js → message-handler.process-W9QxWA1g.js} +58 -44
  32. package/dist/{message-utils-ajbkdTVA.js → message-utils-DSxXsDcG.js} +1 -1
  33. package/dist/model-picker-preference-primitives-D25pnCOu.js +37 -0
  34. package/dist/{outbound-adapter-XZWo4_HD.js → outbound-adapter-kse7KV--.js} +61 -96
  35. package/dist/{outbound-components-CTFDDcq5.js → outbound-components-DNgLQwXl.js} +3 -3
  36. package/dist/{outbound-session-route-D_nc_Ayk.js → outbound-session-route-DJUzy5WA.js} +1 -1
  37. package/dist/{pluralkit-CCovPs9s.js → pluralkit-DbN-Z7BG.js} +1 -1
  38. package/dist/{probe-Bci2pS8M.js → probe-BYRdyuw1.js} +43 -53
  39. package/dist/{probe.runtime-C88gnnXj.js → probe.runtime-uyKOQSBB.js} +1 -1
  40. package/dist/{provider-CfiChtjf.js → provider-Ca5Gua1B.js} +143 -123
  41. package/dist/{provider-session.runtime-D9GTBKPg.js → provider-session.runtime-IEheobg4.js} +3 -3
  42. package/dist/provider.runtime-Bn8horYu.js +2 -0
  43. package/dist/{resolve-allowlist-common-C1hTvZa4.js → resolve-allowlist-common-BU6_eGKg.js} +1 -1
  44. package/dist/{resolve-channels-CmFAdMeQ.js → resolve-channels-ByNsOMJj.js} +2 -2
  45. package/dist/{resolve-users-Cmu75lZy.js → resolve-users-CgWAonw-.js} +2 -2
  46. package/dist/{runtime-D-6AugWA.js → runtime-BZm4_qXV.js} +9 -9
  47. package/dist/runtime-api.actions.js +2 -2
  48. package/dist/runtime-api.js +19 -19
  49. package/dist/runtime-api.lookup.js +5 -5
  50. package/dist/{runtime-api.monitor-DPa2ZoSK.js → runtime-api.monitor-BKYTUIuf.js} +2 -2
  51. package/dist/runtime-api.monitor.js +4 -4
  52. package/dist/runtime-api.send.js +6 -6
  53. package/dist/runtime-api.threads.js +3 -3
  54. package/dist/{runtime-TwM8IrZU.js → runtime-h03Wce1c.js} +2 -2
  55. package/dist/security-audit-contract-api.js +1 -1
  56. package/dist/{security-audit-njzOejQp.js → security-audit-jGnJF__m.js} +38 -0
  57. package/dist/{security-audit.runtime-DZbDdAnw.js → security-audit.runtime-CPN0xFYz.js} +1 -1
  58. package/dist/{send-CfnXLUXq.js → send-C_PfNVFH.js} +5 -5
  59. package/dist/{send.components-V7cyCKbH.js → send.components-BrfbRJNq.js} +5 -5
  60. package/dist/{send.outbound-BbC2qjpH.js → send.outbound-1t1CryCK.js} +10 -35
  61. package/dist/{send.reactions-bLrJCZ4G.js → send.reactions-gesJG-Yp.js} +2 -2
  62. package/dist/{send.shared-Dfacnk-E.js → send.shared-BRGI9T9F.js} +3 -3
  63. package/dist/session-binding-contract-api.js +1 -1
  64. package/dist/setup-plugin-api.js +1 -1
  65. package/dist/{shared-DMA7f3a8.js → shared--6-q1Zhl.js} +5 -5
  66. package/dist/{subagent-hooks-kFyJQ-MK.js → subagent-hooks-Dx9hr5Qy.js} +3 -3
  67. package/dist/subagent-hooks-api.js +2 -2
  68. package/dist/{subagent-progress-mjPRFz-a.js → subagent-progress-BZREb7jm.js} +2 -2
  69. package/dist/{system-events-BSlhBq3u.js → system-events-tVfIe6Xm.js} +1 -1
  70. package/dist/{target-resolver-Bo1oWLPO.js → target-resolver-_m_TsenB.js} +3 -3
  71. package/dist/targets-DqNz_mmW.js +3 -0
  72. package/dist/{thread-bindings-DAHJuT22.js → thread-bindings-u_7pNz5d.js} +4 -4
  73. package/dist/{thread-bindings.discord-api-C_tCQcv3.js → thread-bindings.discord-api-DOCKdVgx.js} +4 -4
  74. package/dist/{thread-bindings.manager-DlZEGvC1.js → thread-bindings.manager-BB-OD9-d.js} +5 -4
  75. package/dist/{transcripts-source-CyJ-sc3n.js → transcripts-source-BW2VfPX0.js} +1 -1
  76. package/dist/transcripts-source-api.js +1 -1
  77. package/dist/{typing-Ci9nhuSi.js → typing-eAhz8LT2.js} +1 -1
  78. package/package.json +4 -5
  79. package/dist/provider.runtime-DSzKjpKs.js +0 -2
  80. package/dist/targets-CB8ahjZk.js +0 -3
  81. package/npm-shrinkwrap.json +0 -1139
@@ -1,5 +1,5 @@
1
1
  import { isSupportedRealtimeVoiceActivationName, normalizeRealtimeVoiceActivationNamePrefix } from "openclaw/plugin-sdk/realtime-voice";
2
- import { asObjectRecord, defineChannelAliasMigration, hasLegacyAccountStreamingAliases, normalizeChannelAccounts, stripRetiredChannelKeys } from "openclaw/plugin-sdk/runtime-doctor";
2
+ import { asObjectRecord, defineChannelAliasMigration, defineKeyMoveMigration, hasLegacyAccountStreamingAliases, normalizeChannelAccounts, stripRetiredChannelKeys } from "openclaw/plugin-sdk/runtime-doctor";
3
3
  //#region extensions/discord/src/doctor-contract.ts
4
4
  const LEGACY_TTS_PROVIDER_KEYS = [
5
5
  "openai",
@@ -46,15 +46,16 @@ function hasLegacyTtsProviderKeys(value) {
46
46
  if (!tts) return false;
47
47
  return LEGACY_TTS_PROVIDER_KEYS.some((key) => Object.hasOwn(tts, key));
48
48
  }
49
- function hasLegacyDiscordGuildChannelAllowAlias(value) {
50
- const guilds = asObjectRecord(asObjectRecord(value)?.guilds);
51
- if (!guilds) return false;
52
- return Object.values(guilds).some((guildValue) => {
53
- const channels = asObjectRecord(asObjectRecord(guildValue)?.channels);
54
- if (!channels) return false;
55
- return Object.values(channels).some((channel) => Object.hasOwn(asObjectRecord(channel) ?? {}, "allow"));
56
- });
57
- }
49
+ const guildChannelAllowMigration = defineKeyMoveMigration({
50
+ scope: [
51
+ "guilds",
52
+ "*",
53
+ "channels",
54
+ "*"
55
+ ],
56
+ from: ["allow"],
57
+ to: ["enabled"]
58
+ });
58
59
  function hasLegacyDiscordGuildChannelAgentId(value) {
59
60
  const guilds = asObjectRecord(asObjectRecord(value)?.guilds);
60
61
  if (!guilds) return false;
@@ -177,50 +178,6 @@ function normalizeUnsupportedRealtimeWakeNames(entry, pathPrefix, changes) {
177
178
  changed: true
178
179
  };
179
180
  }
180
- function normalizeDiscordGuildChannelAllowAliases(params) {
181
- const guilds = asObjectRecord(params.entry.guilds);
182
- if (!guilds) return {
183
- entry: params.entry,
184
- changed: false
185
- };
186
- let changed = false;
187
- const nextGuilds = { ...guilds };
188
- for (const [guildId, guildValue] of Object.entries(guilds)) {
189
- const guild = asObjectRecord(guildValue);
190
- const channels = asObjectRecord(guild?.channels);
191
- if (!guild || !channels) continue;
192
- let channelsChanged = false;
193
- const nextChannels = { ...channels };
194
- for (const [channelId, channelValue] of Object.entries(channels)) {
195
- const channel = asObjectRecord(channelValue);
196
- if (!channel || !Object.hasOwn(channel, "allow")) continue;
197
- const nextChannel = { ...channel };
198
- if (nextChannel.enabled === void 0) {
199
- nextChannel.enabled = channel.allow;
200
- params.changes.push(`Moved ${params.pathPrefix}.guilds.${guildId}.channels.${channelId}.allow → ${params.pathPrefix}.guilds.${guildId}.channels.${channelId}.enabled.`);
201
- } else params.changes.push(`Removed ${params.pathPrefix}.guilds.${guildId}.channels.${channelId}.allow (${params.pathPrefix}.guilds.${guildId}.channels.${channelId}.enabled already set).`);
202
- delete nextChannel.allow;
203
- nextChannels[channelId] = nextChannel;
204
- channelsChanged = true;
205
- }
206
- if (!channelsChanged) continue;
207
- nextGuilds[guildId] = {
208
- ...guild,
209
- channels: nextChannels
210
- };
211
- changed = true;
212
- }
213
- return changed ? {
214
- entry: {
215
- ...params.entry,
216
- guilds: nextGuilds
217
- },
218
- changed: true
219
- } : {
220
- entry: params.entry,
221
- changed: false
222
- };
223
- }
224
181
  function isDiscordChannelAgentBinding(value, match) {
225
182
  const binding = asObjectRecord(value);
226
183
  const bindingMatch = asObjectRecord(binding?.match);
@@ -324,7 +281,7 @@ const legacyConfigRules = [
324
281
  {
325
282
  path: ["channels", "discord"],
326
283
  message: "channels.discord.guilds.<id>.channels.<id>.allow is legacy; use channels.discord.guilds.<id>.channels.<id>.enabled instead. Run \"openclaw doctor --fix\".",
327
- match: hasLegacyDiscordGuildChannelAllowAlias
284
+ match: guildChannelAllowMigration.hasLegacy
328
285
  },
329
286
  {
330
287
  path: [
@@ -333,7 +290,7 @@ const legacyConfigRules = [
333
290
  "accounts"
334
291
  ],
335
292
  message: "channels.discord.accounts.<id>.guilds.<id>.channels.<id>.allow is legacy; use channels.discord.accounts.<id>.guilds.<id>.channels.<id>.enabled instead. Run \"openclaw doctor --fix\".",
336
- match: (value) => hasLegacyAccountStreamingAliases(value, hasLegacyDiscordGuildChannelAllowAlias)
293
+ match: (value) => hasLegacyAccountStreamingAliases(value, guildChannelAllowMigration.hasLegacy)
337
294
  },
338
295
  {
339
296
  path: ["channels", "discord"],
@@ -385,7 +342,7 @@ function normalizeCompatibilityConfig({ cfg }) {
385
342
  let updated = rawEntry;
386
343
  let changed = tuningKnobs.config !== cfg;
387
344
  if (tuningKnobs.changed) changes.push("Removed retired Discord tuning knobs.");
388
- const guildAliases = normalizeDiscordGuildChannelAllowAliases({
345
+ const guildAliases = guildChannelAllowMigration.normalize({
389
346
  entry: updated,
390
347
  pathPrefix: "channels.discord",
391
348
  changes
@@ -406,7 +363,7 @@ function normalizeCompatibilityConfig({ cfg }) {
406
363
  pathPrefix: "channels.discord",
407
364
  changes,
408
365
  normalizeAccount: ({ account, accountId, pathPrefix, changes: accountChanges }) => {
409
- const guilds = normalizeDiscordGuildChannelAllowAliases({
366
+ const guilds = guildChannelAllowMigration.normalize({
410
367
  entry: account,
411
368
  pathPrefix,
412
369
  changes: accountChanges
@@ -1,2 +1,2 @@
1
- import { n as normalizeCompatibilityConfig, t as legacyConfigRules } from "./doctor-contract-BPUD3Di9.js";
1
+ import { n as normalizeCompatibilityConfig, t as legacyConfigRules } from "./doctor-contract-CCFMIDk9.js";
2
2
  export { legacyConfigRules, normalizeCompatibilityConfig };
@@ -1,6 +1,6 @@
1
- import { c as readDiscordChannelMoveParams, n as isDiscordModerationAction, o as readDiscordChannelCreateParams, r as readDiscordModerationCommand, s as readDiscordChannelEditParams, t as handleDiscordAction } from "./runtime-D-6AugWA.js";
1
+ import { c as readDiscordChannelMoveParams, n as isDiscordModerationAction, o as readDiscordChannelCreateParams, r as readDiscordModerationCommand, s as readDiscordChannelEditParams, t as handleDiscordAction } from "./runtime-BZm4_qXV.js";
2
2
  import "./action-runtime-api.js";
3
- import { n as isTrustedRequesterGuildAdminAction } from "./channel-actions-C8n1zWZ-.js";
3
+ import { n as isTrustedRequesterGuildAdminAction } from "./channel-actions-BweII8kV.js";
4
4
  import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
5
5
  import { readNonNegativeIntegerParam, readPositiveIntegerParam, readStringArrayParam, readStringParam } from "openclaw/plugin-sdk/agent-runtime";
6
6
  //#region extensions/discord/src/actions/handle-action.guild-admin.ts
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
- import { t as registerDiscordActivities } from "./activities-api-8TMGXUH4.js";
1
+ import { t as registerDiscordActivities } from "./activities-api-CHnz7E7t.js";
2
2
  import { registerDiscordSubagentHooks } from "./subagent-hooks-api.js";
3
- import { t as discordVoiceTranscriptsSourceProvider } from "./transcripts-source-CyJ-sc3n.js";
3
+ import { t as discordVoiceTranscriptsSourceProvider } from "./transcripts-source-BW2VfPX0.js";
4
4
  import "./transcripts-source-api.js";
5
5
  import { defineBundledChannelEntry } from "openclaw/plugin-sdk/channel-entry-contract";
6
6
  //#region extensions/discord/index.ts
@@ -1,10 +1,9 @@
1
1
  import { n as DISCORD_COMMAND_DEPLOY_HASH_NAMESPACE, t as DISCORD_COMMAND_DEPLOY_HASH_MAX_ENTRIES } from "./command-deploy-store-DFkBTViB.js";
2
2
  import { A as toBindingRecordKey, a as THREAD_BINDINGS_MAX_ENTRIES, d as normalizePersistedBinding, o as THREAD_BINDINGS_NAMESPACE } from "./thread-bindings.state-Cgi5uRn-.js";
3
- import { createHash } from "node:crypto";
3
+ import { i as timestampMs, r as sanitizeRecentModels, t as buildPreferenceModelKey } from "./model-picker-preference-primitives-D25pnCOu.js";
4
4
  import { MAX_DATE_TIMESTAMP_MS, timestampMsToIsoString } from "openclaw/plugin-sdk/number-runtime";
5
5
  import path from "node:path";
6
6
  import fs from "node:fs";
7
- import { normalizeProviderId } from "openclaw/plugin-sdk/provider-model-shared";
8
7
  //#region extensions/discord/src/monitor/model-picker-preferences-migrations.ts
9
8
  const PREFERENCE_MAX_ENTRIES = 2e3;
10
9
  const MAX_PLUGIN_STATE_KEY_BYTES = 512;
@@ -34,38 +33,6 @@ function normalizeLegacyPreferenceKey(key) {
34
33
  if (!trimmed || textEncoder.encode(trimmed).length > MAX_PLUGIN_STATE_KEY_BYTES) return;
35
34
  return trimmed;
36
35
  }
37
- function normalizeModelRef(raw) {
38
- const value = raw?.trim();
39
- if (!value) return null;
40
- const slashIndex = value.indexOf("/");
41
- if (slashIndex <= 0 || slashIndex >= value.length - 1) return null;
42
- const provider = normalizeProviderId(value.slice(0, slashIndex));
43
- const model = value.slice(slashIndex + 1).trim();
44
- return provider && model ? `${provider}/${model}` : null;
45
- }
46
- function sanitizeRecentModels(models, limit) {
47
- const deduped = [];
48
- const seen = /* @__PURE__ */ new Set();
49
- if (!Array.isArray(models)) return deduped;
50
- for (const item of models) {
51
- const normalized = normalizeModelRef(typeof item === "string" ? item : void 0);
52
- if (!normalized || seen.has(normalized)) continue;
53
- seen.add(normalized);
54
- deduped.push(normalized);
55
- if (deduped.length >= limit) break;
56
- }
57
- return deduped;
58
- }
59
- function hashSegment(value, length) {
60
- return createHash("sha256").update(value, "utf8").digest("hex").slice(0, length);
61
- }
62
- function buildPreferenceModelKey(scopeKey, modelRef) {
63
- return `v1:${hashSegment(scopeKey, 32)}:${hashSegment(modelRef, 24)}`;
64
- }
65
- function timestampMs(value) {
66
- const parsed = typeof value === "string" ? Date.parse(value) : NaN;
67
- return Number.isFinite(parsed) ? parsed : 0;
68
- }
69
36
  function legacyUpdatedAtForIndex(updatedAt, index, total) {
70
37
  const baseMs = timestampMs(updatedAt);
71
38
  return timestampMsToIsoString(Math.min(baseMs + Math.max(0, total), MAX_DATE_TIMESTAMP_MS) - Math.max(0, index)) ?? timestampMsToIsoString(baseMs) ?? timestampMsToIsoString(Math.max(0, total - index)) ?? "1970-01-01T00:00:00.000Z";
@@ -1,8 +1,8 @@
1
- import { O as isUnknownDiscordVoiceStateError, Rt as getGuildVoiceState, S as VoiceStateUpdateListener, b as ResumedListener, d as discord_exports, l as parseDiscordTarget, y as ReadyListener } from "./chunk-BrZocpfs.js";
1
+ import { O as isUnknownDiscordVoiceStateError, Rt as getGuildVoiceState, S as VoiceStateUpdateListener, b as ResumedListener, d as discord_exports, l as parseDiscordTarget, y as ReadyListener } from "./chunk-CMVEczdm.js";
2
2
  import { t as getDiscordRuntime } from "./runtime-DgnVQ7zW.js";
3
3
  import { a as normalizeDiscordSlug, h as resolveDiscordOwnerAccess, x as formatDiscordUserTag } from "./allow-list-DzKrtfah.js";
4
- import { a as formatMention } from "./send.outbound-BbC2qjpH.js";
5
- import { g as buildDiscordGroupSystemPrompt, l as resolveDiscordVoiceAccess, m as resolveDiscordVoiceEnabled, u as authorizeDiscordVoiceIngress } from "./provider-CfiChtjf.js";
4
+ import { a as formatMention } from "./send.outbound-1t1CryCK.js";
5
+ import { g as buildDiscordGroupSystemPrompt, l as resolveDiscordVoiceAccess, m as resolveDiscordVoiceEnabled, u as authorizeDiscordVoiceIngress } from "./provider-Ca5Gua1B.js";
6
6
  import { createRequire } from "node:module";
7
7
  import { resolveAgentRoute } from "openclaw/plugin-sdk/routing";
8
8
  import { asBoolean, normalizeOptionalString, uniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
@@ -1,13 +1,14 @@
1
1
  import { t as getDiscordRuntime } from "./runtime-DgnVQ7zW.js";
2
- import { d as resolveDiscordChannelIdSafe, f as resolveDiscordChannelInfoSafe, h as resolveDiscordChannelParentSafe, p as resolveDiscordChannelNameSafe } from "./thread-bindings.discord-api-C_tCQcv3.js";
3
- import { w as mapGatewayDispatchData } from "./provider-CfiChtjf.js";
4
- import { f as resolveDiscordMessageChannelId, i as resolveDiscordMessageText, l as hasDiscordMessageStickers } from "./message-utils-ajbkdTVA.js";
2
+ import { d as resolveDiscordChannelIdSafe, f as resolveDiscordChannelInfoSafe, h as resolveDiscordChannelParentSafe, p as resolveDiscordChannelNameSafe } from "./thread-bindings.discord-api-DOCKdVgx.js";
3
+ import { w as mapGatewayDispatchData } from "./provider-Ca5Gua1B.js";
4
+ import { f as resolveDiscordMessageChannelId, i as resolveDiscordMessageText, l as hasDiscordMessageStickers } from "./message-utils-DSxXsDcG.js";
5
5
  import { GatewayDispatchEvents } from "discord-api-types/v10";
6
6
  import { danger } from "openclaw/plugin-sdk/runtime-env";
7
7
  import { resolveBatchedReplyThreadingPolicy } from "openclaw/plugin-sdk/reply-reference";
8
8
  import { createChannelIngressMonitor, createChannelRunQueue } from "openclaw/plugin-sdk/channel-outbound";
9
9
  import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
10
10
  import { resolveOpenProviderRuntimeGroupPolicy } from "openclaw/plugin-sdk/runtime-group-policy";
11
+ import { fanInChannelIngressLifecycles } from "openclaw/plugin-sdk/channel-ingress-runtime";
11
12
  import { createChannelInboundDebouncer, shouldDebounceTextInbound } from "openclaw/plugin-sdk/channel-inbound";
12
13
  //#region extensions/discord/src/monitor/ingress.ts
13
14
  const DISCORD_INGRESS_PAYLOAD_VERSION = 1;
@@ -193,7 +194,7 @@ function applyImplicitReplyBatchGate(ctx, replyToMode, isBatched) {
193
194
  }
194
195
  //#endregion
195
196
  //#region extensions/discord/src/monitor/message-run-queue.ts
196
- const loadMessageProcessRuntime = createLazyRuntimeModule(() => import("./message-handler.process-REBztvIW.js"));
197
+ const loadMessageProcessRuntime = createLazyRuntimeModule(() => import("./message-handler.process-W9QxWA1g.js"));
197
198
  async function processDiscordQueuedMessage(params) {
198
199
  const abortSignal = params.job.runtime.abortSignal && params.lifecycleSignal ? AbortSignal.any([params.job.runtime.abortSignal, params.lifecycleSignal]) : params.job.runtime.abortSignal ?? params.lifecycleSignal;
199
200
  try {
@@ -275,51 +276,10 @@ function createDiscordMessageRunQueue(params) {
275
276
  }
276
277
  //#endregion
277
278
  //#region extensions/discord/src/monitor/message-dispatcher.ts
278
- const loadMessagePreflightRuntime = createLazyRuntimeModule(() => import("./message-handler.preflight-CAEQvP3t.js"));
279
+ const loadMessagePreflightRuntime = createLazyRuntimeModule(() => import("./message-handler.preflight-D-5zBjwh.js"));
279
280
  function isNonEmptyString(value) {
280
281
  return typeof value === "string" && value.length > 0;
281
282
  }
282
- function buildFlushIngressLifecycle(entries) {
283
- const lifecycles = entries.map((entry) => entry.turnAdoptionLifecycle).filter((lifecycle) => lifecycle !== void 0);
284
- const [firstLifecycle] = lifecycles;
285
- if (!firstLifecycle) return {
286
- lifecycle: void 0,
287
- settle: async () => {},
288
- abandon: async () => {}
289
- };
290
- let handedOff = false;
291
- const adoptAll = async () => {
292
- for (const lifecycle of lifecycles) await lifecycle.onAdopted();
293
- };
294
- return {
295
- lifecycle: {
296
- abortSignal: lifecycles.length === 1 ? firstLifecycle.abortSignal : AbortSignal.any(lifecycles.map((lifecycle) => lifecycle.abortSignal)),
297
- onAdopted: async () => {
298
- handedOff = true;
299
- await adoptAll();
300
- },
301
- onDeferred: () => {
302
- handedOff = true;
303
- for (const lifecycle of lifecycles) lifecycle.onDeferred();
304
- },
305
- onAdoptionFinalizing: () => {
306
- for (const lifecycle of lifecycles) lifecycle.onAdoptionFinalizing();
307
- },
308
- onAbandoned: async () => {
309
- handedOff = true;
310
- for (const lifecycle of lifecycles) await lifecycle.onAbandoned();
311
- }
312
- },
313
- settle: async () => {
314
- if (!handedOff) await adoptAll();
315
- },
316
- abandon: async () => {
317
- if (handedOff) return;
318
- handedOff = true;
319
- for (const lifecycle of lifecycles) await lifecycle.onAbandoned();
320
- }
321
- };
322
- }
323
283
  function createDiscordMessageDispatcher(params) {
324
284
  const { groupPolicy } = resolveOpenProviderRuntimeGroupPolicy({
325
285
  providerConfigPresent: params.cfg.channels?.discord !== void 0,
@@ -371,7 +331,7 @@ function createDiscordMessageDispatcher(params) {
371
331
  for (const entry of entries) pendingDebounceEntries.delete(entry);
372
332
  const last = entries.at(-1);
373
333
  if (!last) return;
374
- const ingress = buildFlushIngressLifecycle(entries);
334
+ const ingress = fanInChannelIngressLifecycles(entries.map((entry) => entry.turnAdoptionLifecycle));
375
335
  const abortSignal = last.abortSignal;
376
336
  if (abortSignal?.aborted) {
377
337
  await ingress.abandon(abortSignal.reason);
@@ -0,0 +1,28 @@
1
+ import { filterSupplementalContextItems } from "openclaw/plugin-sdk/security-runtime";
2
+ //#region extensions/discord/src/monitor/message-handler.history.ts
3
+ function createDiscordHistorySenderProvenance(params) {
4
+ return Object.freeze({
5
+ id: params.sender.id,
6
+ name: params.sender.name,
7
+ tag: params.sender.tag,
8
+ memberRoleIds: Object.freeze([...params.memberRoleIds])
9
+ });
10
+ }
11
+ function filterDiscordHistoryEntriesForContext(params) {
12
+ if (params.mode === "all") return {
13
+ entries: [...params.entries],
14
+ omitted: 0
15
+ };
16
+ const filtered = filterSupplementalContextItems({
17
+ items: params.entries,
18
+ mode: params.mode,
19
+ kind: "history",
20
+ isSenderAllowed: (entry) => Boolean(entry.senderProvenance) && params.isSenderAllowed(entry.senderProvenance)
21
+ });
22
+ return {
23
+ entries: filtered.items,
24
+ omitted: filtered.omitted
25
+ };
26
+ }
27
+ //#endregion
28
+ export { filterDiscordHistoryEntriesForContext as n, createDiscordHistorySenderProvenance as t };
@@ -1,12 +1,13 @@
1
- import { F as Message, bt as getChannelMessage, d as discord_exports } from "./chunk-BrZocpfs.js";
2
- import { o as resolveDefaultDiscordAccountId } from "./accounts-D2LKPukU.js";
1
+ import { F as Message, bt as getChannelMessage, d as discord_exports } from "./chunk-CMVEczdm.js";
2
+ import { o as resolveDefaultDiscordAccountId } from "./accounts-DJTf1LtA.js";
3
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";
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-LyND6GR3.js";
6
- import { f as resolveDiscordChannelInfoSafe, p as resolveDiscordChannelNameSafe } from "./thread-bindings.discord-api-C_tCQcv3.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-CfiChtjf.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-ajbkdTVA.js";
5
+ import { r as resolveDiscordConversationIdentity } from "./approval-message-safety-yjFtfJcK.js";
6
+ import { f as resolveDiscordChannelInfoSafe, p as resolveDiscordChannelNameSafe } from "./thread-bindings.discord-api-DOCKdVgx.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-Ca5Gua1B.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-DSxXsDcG.js";
9
9
  import { n as resolveDiscordWebhookId, t as resolveDiscordSenderIdentity } from "./sender-identity-mG_zsdox.js";
10
+ import { t as createDiscordHistorySenderProvenance } from "./message-handler.history-CJOsN9w5.js";
10
11
  import { normalizeOptionalString, readStringValue } from "openclaw/plugin-sdk/string-coerce-runtime";
11
12
  import { logDebug } from "openclaw/plugin-sdk/logging-core";
12
13
  import { MessageReferenceType, MessageType } from "discord-api-types/v10";
@@ -18,14 +19,15 @@ import { isRecentOutboundMessageIdentity } from "openclaw/plugin-sdk/channel-out
18
19
  import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
19
20
  import { isDangerousNameMatchingEnabled } from "openclaw/plugin-sdk/dangerous-name-runtime";
20
21
  import { enqueueSystemEvent } from "openclaw/plugin-sdk/system-event-runtime";
21
- import { buildMentionRegexes, classifyChannelInboundEvent, implicitMentionKindWhen, logInboundDrop, matchesMentionWithExplicit, recordChannelBotPairLoopAndCheckSuppression, recordDroppedChannelInboundHistory, resolveInboundMentionDecision, resolveUnmentionedGroupInboundPolicy, toInboundMediaFacts } from "openclaw/plugin-sdk/channel-inbound";
22
+ import { buildMentionRegexes, classifyChannelInboundEvent, implicitMentionKindWhen, logInboundDrop, matchesMentionWithExplicit, recordChannelBotPairLoopAndCheckSuppression, resolveInboundMentionDecision, resolveUnmentionedGroupInboundPolicy, toHistoryMediaEntries, toInboundMediaFacts } from "openclaw/plugin-sdk/channel-inbound";
22
23
  import { mimeTypeFromFilePath } from "openclaw/plugin-sdk/media-mime";
23
24
  import { hasControlCommand } from "openclaw/plugin-sdk/command-detection";
24
25
  import { isAbortRequestText } from "openclaw/plugin-sdk/command-primitives-runtime";
25
26
  import { shouldHandleTextCommands } from "openclaw/plugin-sdk/command-surface";
27
+ import { createChannelHistoryWindow } from "openclaw/plugin-sdk/reply-history";
26
28
  //#region extensions/discord/src/monitor/message-handler.dm-preflight.ts
27
29
  const loadConversationRuntime$1 = createLazyRuntimeModule(() => import("openclaw/plugin-sdk/conversation-binding-runtime"));
28
- const loadDiscordSendRuntime = createLazyRuntimeModule(() => import("./send-CfnXLUXq.js").then((n) => n.t));
30
+ const loadDiscordSendRuntime = createLazyRuntimeModule(() => import("./send-C_PfNVFH.js").then((n) => n.t));
29
31
  function resolveDiscordDmPairingSenderId(sender) {
30
32
  return sender.isPluralKit ? `pk:${sender.id}` : sender.id;
31
33
  }
@@ -445,7 +447,11 @@ function buildDiscordPreflightHistoryEntry(params) {
445
447
  sender: params.senderLabel,
446
448
  body: textForHistory,
447
449
  timestamp: resolveTimestampMs(params.message.timestamp),
448
- messageId: params.message.id
450
+ messageId: params.message.id,
451
+ senderProvenance: createDiscordHistorySenderProvenance({
452
+ sender: params.sender,
453
+ memberRoleIds: params.memberRoleIds
454
+ })
449
455
  } : void 0;
450
456
  }
451
457
  //#endregion
@@ -460,10 +466,10 @@ function logDiscordPreflightInboundSummary(params) {
460
466
  }
461
467
  //#endregion
462
468
  //#region extensions/discord/src/monitor/message-handler.preflight-runtime.ts
463
- const loadPluralKitRuntime = createLazyRuntimeModule(() => import("./pluralkit-CCovPs9s.js").then((n) => n.n));
469
+ const loadPluralKitRuntime = createLazyRuntimeModule(() => import("./pluralkit-DbN-Z7BG.js").then((n) => n.n));
464
470
  const loadPreflightAudioRuntime = createLazyRuntimeModule(() => import("./preflight-audio-BjnQZ5yS.js"));
465
- const loadSystemEventsRuntime = createLazyRuntimeModule(() => import("./system-events-BSlhBq3u.js"));
466
- const loadDiscordThreadingRuntime = createLazyRuntimeModule(() => import("./provider-CfiChtjf.js").then((n) => n.E));
471
+ const loadSystemEventsRuntime = createLazyRuntimeModule(() => import("./system-events-tVfIe6Xm.js"));
472
+ const loadDiscordThreadingRuntime = createLazyRuntimeModule(() => import("./provider-Ca5Gua1B.js").then((n) => n.E));
467
473
  function isPreflightAborted(abortSignal) {
468
474
  return Boolean(abortSignal?.aborted);
469
475
  }
@@ -636,41 +642,18 @@ async function resolveDiscordHistoryMediaForPendingRecord(params) {
636
642
  }));
637
643
  }
638
644
  async function recordDiscordPendingHistoryEntry(params) {
639
- if (params.preflight.historyLimit <= 0) return;
640
- await recordDroppedChannelInboundHistory({
641
- input: {
642
- id: params.message.id,
643
- timestamp: params.entry?.timestamp,
644
- rawText: params.entry?.body ?? "",
645
- textForAgent: params.entry?.body,
646
- raw: params.message
647
- },
648
- admission: {
649
- kind: "drop",
650
- reason: "discord-preflight",
651
- recordHistory: true
652
- },
653
- preflight: {
654
- message: params.entry ? {
655
- rawBody: params.entry.body,
656
- body: params.entry.body,
657
- bodyForAgent: params.entry.body,
658
- senderLabel: params.entry.sender,
659
- envelopeFrom: params.entry.sender
660
- } : void 0,
661
- history: {
662
- key: params.historyKey,
663
- historyMap: params.preflight.guildHistories,
664
- limit: params.preflight.historyLimit,
665
- recordOnDrop: true,
666
- mediaLimit: DISCORD_HISTORY_MEDIA_MAX_ATTACHMENTS,
667
- shouldRecord: () => !isPreflightAborted(params.preflight.abortSignal)
668
- },
669
- media: () => resolveDiscordHistoryMediaForPendingRecord({
670
- preflight: params.preflight,
671
- message: params.message
672
- })
673
- }
645
+ if (!params.entry || params.preflight.historyLimit <= 0) return;
646
+ await createChannelHistoryWindow({ historyMap: params.preflight.guildHistories }).recordWithMedia({
647
+ historyKey: params.historyKey,
648
+ entry: params.entry,
649
+ limit: params.preflight.historyLimit,
650
+ mediaLimit: DISCORD_HISTORY_MEDIA_MAX_ATTACHMENTS,
651
+ messageId: params.message.id,
652
+ shouldRecord: () => !isPreflightAborted(params.preflight.abortSignal),
653
+ media: async () => toHistoryMediaEntries(await resolveDiscordHistoryMediaForPendingRecord({
654
+ preflight: params.preflight,
655
+ message: params.message
656
+ }), { messageId: params.message.id })
674
657
  });
675
658
  }
676
659
  async function preflightDiscordMessage(params) {
@@ -895,7 +878,9 @@ async function preflightDiscordMessage(params) {
895
878
  isGuildMessage,
896
879
  historyLimit: params.historyLimit,
897
880
  message,
898
- senderLabel: sender.label
881
+ senderLabel: sender.label,
882
+ sender,
883
+ memberRoleIds
899
884
  });
900
885
  const threadOwnerId = threadChannel ? resolveDiscordChannelInfoSafe(threadChannel).ownerId ?? channelInfo?.ownerId : void 0;
901
886
  const shouldRequireMentionByConfig = resolveDiscordShouldRequireMention({