@openclaw/discord 2026.9.1-beta.1 → 2026.9.1

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 (93) hide show
  1. package/dist/account-inspect-BY-ve3yH.js +45 -0
  2. package/dist/account-inspect-api.js +1 -1
  3. package/dist/{accounts-CfQ-vSyf.js → accounts-CwJQoLjM.js} +89 -45
  4. package/dist/action-runtime-api.js +1 -1
  5. package/dist/{activities-api-q-9PaaHH.js → activities-api-E-segZn6.js} +30 -17
  6. package/dist/activities-api.js +1 -1
  7. package/dist/{allow-list-BDMimASD.js → allow-list-C2JuH-R0.js} +10 -6
  8. package/dist/{api-DNVbJyEy.js → api-BfmEP6wp.js} +6 -5
  9. package/dist/api.js +18 -18
  10. package/dist/{approval-handler.runtime-B7qhK3fR.js → approval-handler.runtime-CW5k3mSa.js} +19 -12
  11. package/dist/{audit-CBEv_ERu.js → audit-B9rydv5a.js} +8 -7
  12. package/dist/{channel-Dx1tMTfx.js → channel-D93LnbTE.js} +29 -23
  13. package/dist/{channel-actions.runtime-CLWWu9nC.js → channel-actions.runtime-DMFv4doE.js} +16 -13
  14. package/dist/channel-config-api.js +1 -1
  15. package/dist/channel-plugin-api.js +1 -1
  16. package/dist/{channel.setup-DOzXS2Pk.js → channel.setup-DTL7kPOM.js} +18 -18
  17. package/dist/{components-B9V5o361.js → components-DmXYIQ26.js} +111 -149
  18. package/dist/{config-schema-BR13IAx6.js → config-schema-B797-Spt.js} +19 -12
  19. package/dist/{conversation-binding-route-DJYrY2TQ.js → conversation-binding-route-24afmvEC.js} +1 -1
  20. package/dist/{directory-config-BK6eqekJ.js → directory-config-BD4YL7wT.js} +2 -2
  21. package/dist/directory-contract-api.js +1 -1
  22. package/dist/{directory-live-DSAJSrJk.js → directory-live-BrFVc1Ds.js} +4 -4
  23. package/dist/{doctor-Cm7Y1pJ2.js → doctor-BUB41_lr.js} +5 -5
  24. package/dist/{doctor-contract-DsWvKIXF.js → doctor-contract-Co5vRCZ6.js} +9 -6
  25. package/dist/doctor-contract-api.js +3 -2
  26. package/dist/{handle-action.guild-admin-BdwCRHmm.js → handle-action.guild-admin-B0egstYq.js} +2 -2
  27. package/dist/index.js +1 -1
  28. package/dist/ingress-identity-BCzfPPYM.js +60 -0
  29. package/dist/{message-handler-BXpWZyni.js → message-handler-Qdw9c0j4.js} +14 -10
  30. package/dist/{message-handler.preflight-Ba5LAY_X.js → message-handler.preflight-Dxi2yBfR.js} +41 -101
  31. package/dist/{message-handler.process-3HEzmemS.js → message-handler.process-BYDjtxZJ.js} +83 -109
  32. package/dist/{message-text-aiwO5R2F.js → message-text-BRVqYm-t.js} +11 -6
  33. package/dist/{outbound-adapter-BE4jSq2d.js → outbound-adapter-DEhthWTk.js} +52 -67
  34. package/dist/{outbound-components-oLpg8Qzb.js → outbound-components-DehyxvA4.js} +5 -4
  35. package/dist/{outbound-session-route-Cg15ZFJd.js → outbound-session-route-BFGRF9fE.js} +55 -12
  36. package/dist/{owner-access-UlYi9t0M.js → owner-access-yc1sX7Gx.js} +7 -6
  37. package/dist/{pluralkit-Tiyl70dx.js → pluralkit-XmmAHoV6.js} +2 -2
  38. package/dist/{probe-n6ZXxK8V.js → probe-3ovFAp3b.js} +3 -3
  39. package/dist/{probe.runtime-CN4bdPfZ.js → probe.runtime-BckHn3cJ.js} +1 -1
  40. package/dist/{provider-B11xwilq.js → provider-DuDtKbF8.js} +294 -131
  41. package/dist/{provider-session.runtime-B9xe-Qaf.js → provider-session.runtime-BA2BPyZ4.js} +3 -3
  42. package/dist/provider.runtime-Db8YwZBv.js +2 -0
  43. package/dist/{realtime-session.runtime-CU8IQUS-.js → realtime-session.runtime-DgSbX6ay.js} +103 -163
  44. package/dist/{resolve-allowlist-common-BLoYaxEG.js → resolve-allowlist-common-BJ5UZNNT.js} +3 -3
  45. package/dist/{resolve-channels-C2sT_n67.js → resolve-channels-CYseD5Uw.js} +4 -4
  46. package/dist/{resolve-users-CzpjLwjy.js → resolve-users-DrmhDrqm.js} +5 -4
  47. package/dist/{retry-Cv4jCU5Z.js → retry-BNCxiyyR.js} +120 -32
  48. package/dist/{retry-after-DdLPmPoa.js → retry-after-BrLjLUJi.js} +2 -1
  49. package/dist/{runtime-BHrTlFkf.js → runtime-BbWNtfyq.js} +127 -93
  50. package/dist/{runtime-CY4PRMF-.js → runtime-DB7Fb6AU.js} +2 -2
  51. package/dist/runtime-api.js +19 -19
  52. package/dist/{secret-config-contract-B3i6WxV5.js → secret-config-contract-DFu9hfU8.js} +14 -6
  53. package/dist/secret-contract-api.js +1 -1
  54. package/dist/{security-audit-BfJhAXZp.js → security-audit-DKfK-iPY.js} +10 -11
  55. package/dist/security-audit-contract-api.js +1 -1
  56. package/dist/{security-audit.runtime-BVKF9VtY.js → security-audit.runtime-sKZyKgpx.js} +1 -1
  57. package/dist/{send-C49MFF9j.js → send-BnTEIeLE.js} +132 -100
  58. package/dist/{send.components-DKKAw5VX.js → send.components-BWVEcjRP.js} +21 -15
  59. package/dist/{send.outbound-zam0TrZx.js → send.outbound-b5xwHTlL.js} +35 -22
  60. package/dist/{send.shared-JjljcV4O.js → send.shared-5vxBTagO.js} +25 -18
  61. package/dist/{sender-identity-BJtfyise.js → sender-identity-Dt0imZyY.js} +1 -1
  62. package/dist/setup-plugin-api.js +1 -1
  63. package/dist/{shared-_5EcP4jW.js → shared-BSJWHEMA.js} +20 -14
  64. package/dist/{subagent-hooks-DQzvOptn.js → subagent-hooks-IzQKX4RQ.js} +2 -2
  65. package/dist/subagent-hooks-api.js +1 -1
  66. package/dist/{system-events-C7yxaHWP.js → system-events-BOiDS8b3.js} +2 -2
  67. package/dist/{target-resolver-vxIh6O3-.js → target-resolver-BVI8xSSC.js} +6 -5
  68. package/dist/targets-DbxVbq8k.js +3 -0
  69. package/dist/{thread-bindings-DW5F9vat.js → thread-bindings-D7mcaXQC.js} +6 -5
  70. package/dist/{thread-bindings.manager-ByOtwjo_.js → thread-bindings.manager-B1oySiVc.js} +37 -28
  71. package/dist/{thread-bindings.session-updates-CJb-BpPL.js → thread-bindings.session-updates-CC7HoQvt.js} +2 -1
  72. package/dist/{threading-agH1T_6s.js → threading-OQnL-0Zx.js} +8 -6
  73. package/dist/{timeouts-B9cy6RvQ.js → timeouts-D86uWLt_.js} +1 -1
  74. package/dist/{transcripts-source-BR11iHA4.js → transcripts-source-D8lH7AkN.js} +9 -4
  75. package/dist/transcripts-source-api.js +1 -1
  76. package/dist/{typing-Dc_YMY2e.js → typing-C9q0AQMb.js} +2 -2
  77. package/dist/{voice-runtime-DIeaa8fJ.js → voice-runtime-Dfhjh1tV.js} +433 -93
  78. package/node_modules/@discord/embedded-app-sdk/node_modules/@types/lodash/README.md +1 -1
  79. package/node_modules/@discord/embedded-app-sdk/node_modules/@types/lodash/conforms.d.ts +2 -0
  80. package/node_modules/@discord/embedded-app-sdk/node_modules/@types/lodash/package.json +3 -3
  81. package/node_modules/@discord/embedded-app-sdk/node_modules/@types/lodash/stubArray.d.ts +2 -0
  82. package/node_modules/@discord/embedded-app-sdk/node_modules/@types/lodash/stubObject.d.ts +2 -0
  83. package/node_modules/@discord/embedded-app-sdk/node_modules/@types/lodash/stubString.d.ts +2 -0
  84. package/node_modules/typebox/build/format/email.mjs +1 -1
  85. package/node_modules/typebox/build/format/idna/idn-hostname.mjs +19 -1
  86. package/node_modules/typebox/package.json +1 -1
  87. package/openclaw.plugin.json +14 -6
  88. package/package.json +6 -5
  89. package/skills/discord/SKILL.md +1 -1
  90. package/dist/account-inspect-BDfKyuvL.js +0 -89
  91. package/dist/provider.runtime-DiYaHvOz.js +0 -2
  92. package/dist/sdk-runtime-4geQHtXc.js +0 -338
  93. package/dist/targets-CtTKvntJ.js +0 -3
@@ -1,6 +1,6 @@
1
- import { Tt as createThread, c as createDiscordSendResult, s as createDiscordSendReceiptFromResults, u as createReusableDiscordReplyReference, wt as createChannelMessage } from "./retry-Cv4jCU5Z.js";
2
- import { i as normalizeDiscordHandleKey, o as resolveDiscordDirectoryUserId } from "./directory-live-DSAJSrJk.js";
3
- import { A as resolveDiscordSendComponents, D as buildDiscordMessageRequest, K as parseAndResolveChannelRecipient, M as resolveDiscordSuppressEmbeds, N as createDiscordClient, O as createDiscordMessageNonce, a as normalizeDiscordPollInput, c as normalizeStickerIds, f as sendDiscordMedia, j as resolveDiscordSendEmbeds, k as resolveDiscordMessageFlags, l as resolveChannelId, n as buildDiscordTextChunks, p as sendDiscordText, t as buildDiscordSendError, u as resolveDiscordChannel } from "./send.shared-JjljcV4O.js";
1
+ import { Et as createThread, Tt as createChannelMessage, c as createDiscordSendReceiptFromResults, d as createReusableDiscordReplyReference, l as createDiscordSendResult } from "./retry-BNCxiyyR.js";
2
+ import { i as normalizeDiscordHandleKey, o as resolveDiscordDirectoryUserId } from "./directory-live-BrFVc1Ds.js";
3
+ import { A as resolveDiscordSendComponents, D as buildDiscordMessageRequest, K as parseAndResolveChannelRecipient, M as resolveDiscordSuppressEmbeds, N as createDiscordClient, O as createDiscordMessageNonce, a as normalizeDiscordPollInput, c as normalizeStickerIds, f as sendDiscordMedia, j as resolveDiscordSendEmbeds, k as resolveDiscordMessageFlags, l as resolveChannelId, n as buildDiscordTextChunks, p as sendDiscordText, t as buildDiscordSendError, u as resolveDiscordChannel } from "./send.shared-5vxBTagO.js";
4
4
  import { ChannelType } from "discord-api-types/v10";
5
5
  import { expectDefined } from "openclaw/plugin-sdk/expect-runtime";
6
6
  import { normalizeLowercaseStringOrEmpty, normalizeOptionalString, normalizeOptionalStringifiedId } from "openclaw/plugin-sdk/string-coerce-runtime";
@@ -247,10 +247,12 @@ function normalizeDiscordBold(markdown) {
247
247
  for (const edit of edits) {
248
248
  while ((protectedRanges[rangeIndex]?.end ?? Number.POSITIVE_INFINITY) <= edit.start) rangeIndex += 1;
249
249
  const range = protectedRanges[rangeIndex];
250
- if (range && (edit.consume === 0 ? edit.start >= range.start && edit.start < range.end : edit.start < range.end && edit.start + edit.consume > range.start)) if (edit.delimiter) protectedSpanIds.add(edit.spanId);
251
- else {
252
- protectedEditKeys.add(`${edit.start}:${edit.consume}:${edit.marker}`);
253
- spansWithProtectedContent.add(edit.spanId);
250
+ if (range && (edit.consume === 0 ? edit.start >= range.start && edit.start < range.end : edit.start < range.end && edit.start + edit.consume > range.start)) {
251
+ if (edit.delimiter) protectedSpanIds.add(edit.spanId);
252
+ else {
253
+ protectedEditKeys.add(`${edit.start}:${edit.consume}:${edit.marker}`);
254
+ spansWithProtectedContent.add(edit.spanId);
255
+ }
254
256
  }
255
257
  }
256
258
  for (const spanId of spansWithProtectedContent) {
@@ -420,14 +422,16 @@ async function sendDiscordThreadTextChunks(params) {
420
422
  allowedMentions: params.allowedMentions,
421
423
  maxChars: params.maxChars,
422
424
  onResult: params.onResult,
423
- onPlatformSendDispatch: params.onPlatformSendDispatch
425
+ onPlatformSendDispatch: params.onPlatformSendDispatch,
426
+ assertPlatformSendAuthorized: params.assertPlatformSendAuthorized
424
427
  });
425
428
  }
426
429
  /** Discord thread names are capped at 100 characters. */
427
430
  const DISCORD_THREAD_NAME_LIMIT = 100;
428
431
  /** Derive a thread title from the first non-empty line of the message text. */
429
432
  function deriveForumThreadName(text) {
430
- return truncateUtf16Safe(normalizeOptionalString(text.split("\n").find((line) => normalizeOptionalString(line))) ?? "", DISCORD_THREAD_NAME_LIMIT) || (/* @__PURE__ */ new Date()).toISOString().slice(0, 16);
433
+ const firstLine = normalizeOptionalString(text.split("\n").find((line) => normalizeOptionalString(line))) ?? "";
434
+ return truncateUtf16Safe(firstLine, DISCORD_THREAD_NAME_LIMIT) || (/* @__PURE__ */ new Date()).toISOString().slice(0, 16);
431
435
  }
432
436
  /** Forum/Media channels cannot receive regular messages; detect them here. */
433
437
  function isForumLikeChannel(channel) {
@@ -449,7 +453,8 @@ async function resolveDiscordSendTarget(to, opts) {
449
453
  ...opts,
450
454
  cfg
451
455
  });
452
- const { channelId } = await resolveChannelId(rest, await parseAndResolveChannelRecipient(to, cfg, account.accountId), request);
456
+ const recipient = await parseAndResolveChannelRecipient(to, cfg, account.accountId);
457
+ const { channelId } = await resolveChannelId(rest, recipient, request);
453
458
  return {
454
459
  rest,
455
460
  request,
@@ -482,7 +487,8 @@ async function sendMessageDiscord(to, text, opts) {
482
487
  accountId: accountInfo.accountId,
483
488
  mentionAliases: accountInfo.config.mentionAliases
484
489
  });
485
- const { channelId } = await resolveChannelId(rest, await parseAndResolveChannelRecipient(to, cfg, accountInfo.accountId), request);
490
+ const recipient = await parseAndResolveChannelRecipient(to, cfg, accountInfo.accountId);
491
+ const { channelId } = await resolveChannelId(rest, recipient, request);
486
492
  const channel = await resolveDiscordChannel(rest, channelId);
487
493
  const deliveredResults = [];
488
494
  let deliveryThreadId;
@@ -513,21 +519,23 @@ async function sendMessageDiscord(to, text, opts) {
513
519
  embeds: opts.embeds,
514
520
  isFirst: true
515
521
  });
522
+ const starterFlags = resolveDiscordMessageFlags({
523
+ silent: opts.silent,
524
+ suppressEmbeds: suppressEmbeds && !starterEmbeds?.length
525
+ });
516
526
  const starterBody = buildDiscordMessageRequest({
517
527
  endpoint: "forum-thread",
518
528
  text: starterContent,
519
529
  components: starterComponents,
520
530
  embeds: starterEmbeds,
521
- flags: resolveDiscordMessageFlags({
522
- silent: opts.silent,
523
- suppressEmbeds: suppressEmbeds && !starterEmbeds?.length
524
- }),
531
+ flags: starterFlags,
525
532
  allowedMentions: opts.allowedMentions
526
533
  });
527
534
  let threadRes;
528
535
  try {
529
536
  threadRes = await request(async () => {
530
537
  await opts.onPlatformSendDispatch?.();
538
+ opts.assertPlatformSendAuthorized?.();
531
539
  return createThread(rest, channelId, { body: {
532
540
  name: threadName,
533
541
  ...channel.default_auto_archive_duration === void 0 ? {} : { auto_archive_duration: channel.default_auto_archive_duration },
@@ -578,7 +586,8 @@ async function sendMessageDiscord(to, text, opts) {
578
586
  allowedMentions: opts.allowedMentions,
579
587
  maxChars: textLimit,
580
588
  onResult: reportResult,
581
- onPlatformSendDispatch: opts.onPlatformSendDispatch
589
+ onPlatformSendDispatch: opts.onPlatformSendDispatch,
590
+ assertPlatformSendAuthorized: opts.assertPlatformSendAuthorized
582
591
  });
583
592
  await sendDiscordThreadTextChunks({
584
593
  rest,
@@ -592,7 +601,8 @@ async function sendMessageDiscord(to, text, opts) {
592
601
  suppressEmbeds,
593
602
  allowedMentions: opts.allowedMentions,
594
603
  onResult: reportResult,
595
- onPlatformSendDispatch: opts.onPlatformSendDispatch
604
+ onPlatformSendDispatch: opts.onPlatformSendDispatch,
605
+ assertPlatformSendAuthorized: opts.assertPlatformSendAuthorized
596
606
  });
597
607
  } else await sendDiscordThreadTextChunks({
598
608
  rest,
@@ -606,7 +616,8 @@ async function sendMessageDiscord(to, text, opts) {
606
616
  suppressEmbeds,
607
617
  allowedMentions: opts.allowedMentions,
608
618
  onResult: reportResult,
609
- onPlatformSendDispatch: opts.onPlatformSendDispatch
619
+ onPlatformSendDispatch: opts.onPlatformSendDispatch,
620
+ assertPlatformSendAuthorized: opts.assertPlatformSendAuthorized
610
621
  });
611
622
  } catch (err) {
612
623
  throw await buildDiscordSendError(err, {
@@ -653,7 +664,8 @@ async function sendMessageDiscord(to, text, opts) {
653
664
  allowedMentions: opts.allowedMentions,
654
665
  maxChars: textLimit,
655
666
  onResult: reportResult,
656
- onPlatformSendDispatch: opts.onPlatformSendDispatch
667
+ onPlatformSendDispatch: opts.onPlatformSendDispatch,
668
+ assertPlatformSendAuthorized: opts.assertPlatformSendAuthorized
657
669
  });
658
670
  else result = await sendDiscordText({
659
671
  rest,
@@ -670,7 +682,8 @@ async function sendMessageDiscord(to, text, opts) {
670
682
  allowedMentions: opts.allowedMentions,
671
683
  maxChars: textLimit,
672
684
  onResult: reportResult,
673
- onPlatformSendDispatch: opts.onPlatformSendDispatch
685
+ onPlatformSendDispatch: opts.onPlatformSendDispatch,
686
+ assertPlatformSendAuthorized: opts.assertPlatformSendAuthorized
674
687
  });
675
688
  } catch (err) {
676
689
  throw await buildDiscordSendError(err, {
@@ -687,8 +700,7 @@ async function sendMessageDiscord(to, text, opts) {
687
700
  direction: "outbound"
688
701
  });
689
702
  return {
690
- messageId: result.id || "unknown",
691
- channelId: result.channel_id ?? channelId,
703
+ ...toDiscordSendResult(result, channelId),
692
704
  receipt: createDiscordSendReceiptFromResults({ results: deliveredResults })
693
705
  };
694
706
  }
@@ -735,6 +747,7 @@ async function resolveDiscordStructuredSendContext(to, opts) {
735
747
  send: async (kind, body) => {
736
748
  const result = await request(async () => {
737
749
  await opts.onPlatformSendDispatch?.();
750
+ opts.assertPlatformSendAuthorized?.();
738
751
  return createChannelMessage(rest, channelId, { body });
739
752
  }, kind, { safety: "nonce-protected-create" });
740
753
  recordChannelActivity({
@@ -1,6 +1,6 @@
1
- import { At as getChannel, J as Embed, Jt as getGuildMember, K as hasDiscordV2Components, Mt as getThreadMember, P as RequestClient, a as chunkDiscordTextWithMode, bt as getCurrentUser, d as resolveDiscordReplyMessageId, n as createDiscordRetryRunner, q as serializePayload, qt as getGuild, wt as createChannelMessage, yt as createUserDmChannel } from "./retry-Cv4jCU5Z.js";
2
- import { c as resolveDiscordAccount, m as normalizeDiscordToken, o as mergeDiscordAccountConfig } from "./accounts-CfQ-vSyf.js";
3
- import { t as parseAndResolveDiscordTarget } from "./target-resolver-vxIh6O3-.js";
1
+ import { F as RequestClient, J as serializePayload, Jt as getGuild, Nt as getThreadMember, Tt as createChannelMessage, Y as Embed, Yt as getGuildMember, bt as createUserDmChannel, f as resolveDiscordReplyMessageId, jt as getChannel, o as chunkDiscordTextWithMode, q as hasDiscordV2Components, r as createDiscordRetryRunner, xt as getCurrentUser } from "./retry-BNCxiyyR.js";
2
+ import { c as resolveDiscordAccount, m as normalizeDiscordToken, o as mergeDiscordAccountConfig } from "./accounts-CwJQoLjM.js";
3
+ import { t as parseAndResolveDiscordTarget } from "./target-resolver-BVI8xSSC.js";
4
4
  import { t as isDiscordThreadChannelType } from "./channel-type-CVLZyGYS.js";
5
5
  import { ChannelType, MessageFlags, PermissionFlagsBits } from "discord-api-types/v10";
6
6
  import { randomBytes } from "node:crypto";
@@ -8,22 +8,23 @@ import { expectDefined } from "openclaw/plugin-sdk/expect-runtime";
8
8
  import { normalizeAccountId } from "openclaw/plugin-sdk/routing";
9
9
  import { normalizeOptionalString, normalizeStringEntries } from "openclaw/plugin-sdk/string-coerce-runtime";
10
10
  import { requireRuntimeConfig } from "openclaw/plugin-sdk/plugin-config-runtime";
11
+ import { resolveTextChunksWithFallback } from "openclaw/plugin-sdk/reply-payload";
11
12
  import { makeProxyFetch } from "openclaw/plugin-sdk/fetch-runtime";
12
13
  import { danger } from "openclaw/plugin-sdk/runtime-env";
13
14
  import { PollLayoutType } from "discord-api-types/payloads/v10";
14
15
  import { buildOutboundMediaLoadOptions, extensionForMime, normalizePollDurationHours, normalizePollInput } from "openclaw/plugin-sdk/media-runtime";
15
- import { resolveTextChunksWithFallback } from "openclaw/plugin-sdk/reply-payload";
16
16
  import { loadWebMedia } from "openclaw/plugin-sdk/web-media";
17
17
  //#region extensions/discord/src/recipient-resolution.ts
18
18
  async function parseAndResolveRecipient(raw, cfg, accountId, parseOptions = {}) {
19
19
  if (!cfg) throw new Error("Discord recipient resolution requires a resolved runtime config. Load and resolve config at the command or gateway boundary, then pass cfg through the runtime path.");
20
20
  const resolvedCfg = requireRuntimeConfig(cfg, "Discord recipient resolution");
21
+ const accountInfo = resolveDiscordAccount({
22
+ cfg: resolvedCfg,
23
+ accountId
24
+ });
21
25
  const resolved = await parseAndResolveDiscordTarget(raw, {
22
26
  cfg: resolvedCfg,
23
- accountId: resolveDiscordAccount({
24
- cfg: resolvedCfg,
25
- accountId
26
- }).accountId
27
+ accountId: accountInfo.accountId
27
28
  }, parseOptions);
28
29
  return {
29
30
  kind: resolved.kind,
@@ -31,8 +32,9 @@ async function parseAndResolveRecipient(raw, cfg, accountId, parseOptions = {})
31
32
  };
32
33
  }
33
34
  async function parseAndResolveChannelRecipient(raw, cfg, accountId) {
35
+ const resolvedCfg = requireRuntimeConfig(cfg, "Discord recipient resolution");
34
36
  const resolved = await parseAndResolveDiscordTarget(raw, {
35
- cfg: requireRuntimeConfig(cfg, "Discord recipient resolution"),
37
+ cfg: resolvedCfg,
36
38
  accountId
37
39
  }, { defaultKind: "channel" });
38
40
  return {
@@ -512,9 +514,9 @@ var DiscordSendError = class extends Error {
512
514
  return this.message;
513
515
  }
514
516
  };
515
- const DISCORD_MAX_EMOJI_BYTES = 256 * 1024;
516
- const DISCORD_MAX_STICKER_BYTES = 512 * 1024;
517
- const DISCORD_MAX_EVENT_COVER_BYTES = 8 * 1024 * 1024;
517
+ const DISCORD_MAX_EMOJI_BYTES = 262144;
518
+ const DISCORD_MAX_STICKER_BYTES = 524288;
519
+ const DISCORD_MAX_EVENT_COVER_BYTES = 8388608;
518
520
  //#endregion
519
521
  //#region extensions/discord/src/send.shared.ts
520
522
  const DISCORD_TEXT_LIMIT = 2e3;
@@ -637,14 +639,15 @@ async function resolveDiscordChannel(rest, channelId) {
637
639
  }
638
640
  function buildDiscordTextChunks(text, opts = {}) {
639
641
  if (!text) return [];
640
- return resolveTextChunksWithFallback(text, chunkDiscordTextWithMode(text, {
642
+ const chunks = chunkDiscordTextWithMode(text, {
641
643
  maxChars: opts.maxChars ?? DISCORD_TEXT_LIMIT,
642
644
  maxLines: opts.maxLinesPerMessage,
643
645
  chunkMode: opts.chunkMode
644
- }));
646
+ });
647
+ return resolveTextChunksWithFallback(text, chunks);
645
648
  }
646
649
  async function sendDiscordText(params) {
647
- const { rest, channelId, text, request, reply, maxLinesPerMessage, components, embeds, allowedMentions, chunkMode, silent, suppressEmbeds, maxChars, onResult, onPlatformSendDispatch } = params;
650
+ const { rest, channelId, text, request, reply, maxLinesPerMessage, components, embeds, allowedMentions, chunkMode, silent, suppressEmbeds, maxChars, onResult, onPlatformSendDispatch, assertPlatformSendAuthorized } = params;
648
651
  const chunks = buildDiscordTextChunks(text, {
649
652
  maxLinesPerMessage,
650
653
  chunkMode,
@@ -680,6 +683,7 @@ async function sendDiscordText(params) {
680
683
  return {
681
684
  result: await request(async () => {
682
685
  await onPlatformSendDispatch?.();
686
+ assertPlatformSendAuthorized?.();
683
687
  return createChannelMessage(rest, channelId, { body });
684
688
  }, "text", { safety: "nonce-protected-create" }),
685
689
  replyToId: chunkReplyTo,
@@ -709,7 +713,7 @@ async function sendDiscordText(params) {
709
713
  };
710
714
  }
711
715
  async function sendDiscordMedia(params) {
712
- const { rest, channelId, text, mediaUrl, filename, mediaAccess, mediaLocalRoots, mediaReadFile, maxBytes, reply, request, maxLinesPerMessage, components, embeds, allowedMentions, chunkMode, silent, suppressEmbeds, maxChars, onResult, onPlatformSendDispatch } = params;
716
+ const { rest, channelId, text, mediaUrl, filename, mediaAccess, mediaLocalRoots, mediaReadFile, maxBytes, reply, request, maxLinesPerMessage, components, embeds, allowedMentions, chunkMode, silent, suppressEmbeds, maxChars, onResult, onPlatformSendDispatch, assertPlatformSendAuthorized } = params;
713
717
  const media = await loadWebMedia(mediaUrl, buildOutboundMediaLoadOptions({
714
718
  maxBytes,
715
719
  mediaAccess,
@@ -753,6 +757,7 @@ async function sendDiscordMedia(params) {
753
757
  try {
754
758
  res = await request(async () => {
755
759
  await onPlatformSendDispatch?.();
760
+ assertPlatformSendAuthorized?.();
756
761
  return createChannelMessage(rest, channelId, { body });
757
762
  }, "media", { safety: "nonce-protected-create" });
758
763
  } catch (err) {
@@ -770,7 +775,8 @@ async function sendDiscordMedia(params) {
770
775
  allowedMentions,
771
776
  maxChars,
772
777
  onResult,
773
- onPlatformSendDispatch
778
+ onPlatformSendDispatch,
779
+ assertPlatformSendAuthorized
774
780
  });
775
781
  }
776
782
  await onResult?.(res, "media", reply?.messageId);
@@ -791,7 +797,8 @@ async function sendDiscordMedia(params) {
791
797
  allowedMentions,
792
798
  maxChars,
793
799
  onResult,
794
- onPlatformSendDispatch
800
+ onPlatformSendDispatch,
801
+ assertPlatformSendAuthorized
795
802
  });
796
803
  for (const id of followup.platformMessageIds) if (id) platformMessageIds.push(id);
797
804
  }
@@ -1,4 +1,4 @@
1
- import { x as formatDiscordUserTag } from "./allow-list-BDMimASD.js";
1
+ import { x as formatDiscordUserTag } from "./allow-list-C2JuH-R0.js";
2
2
  import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
3
3
  //#region extensions/discord/src/monitor/sender-identity.ts
4
4
  function resolveDiscordWebhookId(message) {
@@ -1,2 +1,2 @@
1
- import { t as discordSetupPlugin } from "./channel.setup-DOzXS2Pk.js";
1
+ import { t as discordSetupPlugin } from "./channel.setup-DTL7kPOM.js";
2
2
  export { discordSetupPlugin };
@@ -1,8 +1,9 @@
1
- import { c as resolveDiscordAccount, d as resolveDiscordAccountDisabledReason, f as resolveDiscordAccountDmPolicy, l as resolveDiscordAccountAllowFrom, n as isDiscordAccountEnabledForRuntime, o as mergeDiscordAccountConfig, r as listDiscordAccountIds, s as resolveDefaultDiscordAccountId } from "./accounts-CfQ-vSyf.js";
2
- import { t as inspectDiscordAccount } from "./account-inspect-BDfKyuvL.js";
3
- import { t as DiscordChannelConfigSchema } from "./config-schema-BR13IAx6.js";
4
- import { n as normalizeCompatibilityConfig } from "./doctor-contract-DsWvKIXF.js";
5
- import { r as secretTargetRegistryEntries, t as collectRuntimeConfigAssignments } from "./secret-config-contract-B3i6WxV5.js";
1
+ import { c as resolveDiscordAccount, d as resolveDiscordAccountDisabledReason, f as resolveDiscordAccountDmPolicy, l as resolveDiscordAccountAllowFrom, n as isDiscordAccountEnabledForRuntime, o as mergeDiscordAccountConfig, r as listDiscordAccountIds, s as resolveDefaultDiscordAccountId } from "./accounts-CwJQoLjM.js";
2
+ import { t as inspectDiscordAccount } from "./account-inspect-BY-ve3yH.js";
3
+ import { t as discordIngressIdentity } from "./ingress-identity-BCzfPPYM.js";
4
+ import { t as DiscordChannelConfigSchema } from "./config-schema-B797-Spt.js";
5
+ import { n as normalizeCompatibilityConfig } from "./doctor-contract-Co5vRCZ6.js";
6
+ import { r as secretTargetRegistryEntries, t as collectRuntimeConfigAssignments } from "./secret-config-contract-DFu9hfU8.js";
6
7
  import { n as unsupportedSecretRefSurfacePatterns, t as collectUnsupportedSecretRefConfigCandidates } from "./security-contract-DSHk7I2w.js";
7
8
  import { t as deriveLegacySessionChatType } from "./session-contract-BO5tlIdl.js";
8
9
  import { describeAccountSnapshot } from "openclaw/plugin-sdk/account-helpers";
@@ -12,6 +13,7 @@ import { PAIRING_APPROVED_MESSAGE, buildTokenChannelStatusSummary, projectCreden
12
13
  import { formatAllowFromLowercase } from "openclaw/plugin-sdk/allow-from";
13
14
  import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
14
15
  import { createConditionalWarningCollector, createOpenProviderConfiguredRouteWarningCollector } from "openclaw/plugin-sdk/channel-policy";
16
+ import { identityEntryAuthenticationClassifier } from "openclaw/plugin-sdk/channel-ingress-runtime";
15
17
  import { defineChannelSetupContract } from "openclaw/plugin-sdk/channel-setup";
16
18
  import { createEnvPatchedAccountSetupAdapter } from "openclaw/plugin-sdk/setup-runtime";
17
19
  //#region extensions/discord/src/channel-api.ts
@@ -48,6 +50,7 @@ const resolveDiscordDmPolicy = createScopedDmSecurityResolver({
48
50
  })
49
51
  }),
50
52
  policyPathSuffix: "dmPolicy",
53
+ classifyEntryAuthentication: identityEntryAuthenticationClassifier(discordIngressIdentity),
51
54
  normalizeEntry: (raw) => raw.trim().replace(/^(discord|user):/i, "").replace(/^<@!?(\d+)>$/, "$1")
52
55
  });
53
56
  const collectDiscordSecurityWarnings = createOpenProviderConfiguredRouteWarningCollector({
@@ -72,12 +75,21 @@ const collectDiscordSecurityFindings = createConditionalWarningCollector.finding
72
75
  severity: "critical",
73
76
  title: "Discord security warning"
74
77
  });
75
- const loadDiscordSecurityAuditModule = createLazyRuntimeModule(() => import("./security-audit.runtime-BVKF9VtY.js"));
78
+ const loadDiscordSecurityAuditModule = createLazyRuntimeModule(() => import("./security-audit.runtime-sKZyKgpx.js"));
76
79
  const discordSecurityAdapter = {
77
80
  resolveDmPolicy: resolveDiscordDmPolicy,
78
81
  collectWarnings: collectDiscordSecurityFindings,
79
82
  collectAuditFindings: async (params) => (await loadDiscordSecurityAuditModule()).collectDiscordSecurityAuditFindings(params)
80
83
  };
84
+ //#endregion
85
+ //#region extensions/discord/src/setup-adapter.ts
86
+ const discordSetupAdapter = createEnvPatchedAccountSetupAdapter({
87
+ channelKey: "discord",
88
+ defaultAccountOnlyEnvError: "DISCORD_BOT_TOKEN can only be used for the default account.",
89
+ missingCredentialError: "Discord requires token (or --use-env).",
90
+ hasCredentials: (input) => Boolean(input.token),
91
+ buildPatch: (input) => input.token ? { token: input.token } : {}
92
+ });
81
93
  const discordSetupContract = defineChannelSetupContract({
82
94
  fields: {
83
95
  token: {
@@ -97,13 +109,7 @@ const discordSetupContract = defineChannelSetupContract({
97
109
  envVars: ["DISCORD_BOT_TOKEN"]
98
110
  }
99
111
  },
100
- legacyAdapter: createEnvPatchedAccountSetupAdapter({
101
- channelKey: "discord",
102
- defaultAccountOnlyEnvError: "DISCORD_BOT_TOKEN can only be used for the default account.",
103
- missingCredentialError: "Discord requires token (or --use-env).",
104
- hasCredentials: (input) => Boolean(input.token),
105
- buildPatch: (input) => input.token ? { token: input.token } : {}
106
- })
112
+ legacyAdapter: discordSetupAdapter
107
113
  });
108
114
  //#endregion
109
115
  //#region extensions/discord/src/doctor-shared.ts
@@ -111,7 +117,7 @@ const DISCORD_LEGACY_CONFIG_RULES = [];
111
117
  //#endregion
112
118
  //#region extensions/discord/src/shared.ts
113
119
  const DISCORD_CHANNEL = "discord";
114
- const loadDiscordDoctorModule = createLazyRuntimeModule(() => import("./doctor-Cm7Y1pJ2.js"));
120
+ const loadDiscordDoctorModule = createLazyRuntimeModule(() => import("./doctor-BUB41_lr.js"));
115
121
  const discordDoctor = {
116
122
  dmAllowFromMode: "topOnly",
117
123
  groupModel: "route",
@@ -1,5 +1,5 @@
1
- import { on as __exportAll } from "./retry-Cv4jCU5Z.js";
2
- import { o as unbindThreadBindingsBySessionKey, r as listThreadBindingsBySessionKey } from "./thread-bindings-DW5F9vat.js";
1
+ import { sn as __exportAll } from "./retry-BNCxiyyR.js";
2
+ import { o as unbindThreadBindingsBySessionKey, r as listThreadBindingsBySessionKey } from "./thread-bindings-D7mcaXQC.js";
3
3
  import { normalizeOptionalLowercaseString, normalizeOptionalStringifiedId } from "openclaw/plugin-sdk/string-coerce-runtime";
4
4
  //#region extensions/discord/src/subagent-hooks.ts
5
5
  var subagent_hooks_exports = /* @__PURE__ */ __exportAll({
@@ -1,6 +1,6 @@
1
1
  import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
2
2
  //#region extensions/discord/subagent-hooks-api.ts
3
- const loadDiscordSubagentHooksModule = createLazyRuntimeModule(() => import("./subagent-hooks-DQzvOptn.js").then((n) => n.r));
3
+ const loadDiscordSubagentHooksModule = createLazyRuntimeModule(() => import("./subagent-hooks-IzQKX4RQ.js").then((n) => n.r));
4
4
  function registerDiscordSubagentHooks(api) {
5
5
  api.on("subagent_ended", async (event) => {
6
6
  const { handleDiscordSubagentEnded } = await loadDiscordSubagentHooksModule();
@@ -1,5 +1,5 @@
1
- import { y as discord_exports } from "./retry-Cv4jCU5Z.js";
2
- import { x as formatDiscordUserTag } from "./allow-list-BDMimASD.js";
1
+ import { b as discord_exports } from "./retry-BNCxiyyR.js";
2
+ import { x as formatDiscordUserTag } from "./allow-list-C2JuH-R0.js";
3
3
  //#region extensions/discord/src/monitor/system-events.ts
4
4
  function resolveDiscordSystemEvent(message, location) {
5
5
  switch (message.type) {
@@ -1,6 +1,6 @@
1
- import { _ as parseDiscordTarget, on as __exportAll, p as allowFromContainsDiscordUserId } from "./retry-Cv4jCU5Z.js";
2
- import { c as resolveDiscordAccount, l as resolveDiscordAccountAllowFrom } from "./accounts-CfQ-vSyf.js";
3
- import { a as rememberDiscordDirectoryUser, r as listDiscordDirectoryPeersLive } from "./directory-live-DSAJSrJk.js";
1
+ import { m as allowFromContainsDiscordUserId, sn as __exportAll, v as parseDiscordTarget } from "./retry-BNCxiyyR.js";
2
+ import { c as resolveDiscordAccount, l as resolveDiscordAccountAllowFrom } from "./accounts-CwJQoLjM.js";
3
+ import { a as rememberDiscordDirectoryUser, r as listDiscordDirectoryPeersLive } from "./directory-live-BrFVc1Ds.js";
4
4
  import { buildMessagingTarget } from "openclaw/plugin-sdk/channel-targets";
5
5
  //#region extensions/discord/src/send-target-parsing.ts
6
6
  const parseDiscordSendTarget = (raw, options = {}) => parseDiscordTarget(raw, options);
@@ -62,10 +62,11 @@ function safeParseDiscordTarget(input, options) {
62
62
  }
63
63
  }
64
64
  function isConfiguredAllowedDiscordDmUser(input, options) {
65
- return allowFromContainsDiscordUserId(resolveDiscordAccountAllowFrom({
65
+ const allowFrom = resolveDiscordAccountAllowFrom({
66
66
  cfg: options.cfg,
67
67
  accountId: options.accountId
68
- }) ?? [], input);
68
+ }) ?? [];
69
+ return allowFromContainsDiscordUserId(allowFrom, input);
69
70
  }
70
71
  function isExplicitUserLookup(input, options) {
71
72
  if (/^<@!?(\d+)>$/.test(input)) return true;
@@ -0,0 +1,3 @@
1
+ import "./retry-BNCxiyyR.js";
2
+ import "./target-resolver-BVI8xSSC.js";
3
+ export {};
@@ -1,8 +1,8 @@
1
- import { _ as parseDiscordTarget, on as __exportAll } from "./retry-Cv4jCU5Z.js";
2
- import "./targets-CtTKvntJ.js";
1
+ import { sn as __exportAll, v as parseDiscordTarget } from "./retry-BNCxiyyR.js";
2
+ import "./targets-DbxVbq8k.js";
3
3
  import { C as resolveThreadBindingMaxAgeExpiresAt, O as shouldPersistBindingMutations, S as resolveThreadBindingInactivityExpiresAt, T as saveBindingsToDisk, h as refreshUnboundThreadWebhookIdentity, m as normalizeThreadId, n as MANAGERS_BY_ACCOUNT_ID, t as BINDINGS_BY_THREAD_ID, u as getThreadBindingToken, v as removeBindingRecord, w as resolveThreadBindingMaxAgeMs$1, x as resolveThreadBindingIdleTimeoutMs$1 } from "./thread-bindings.state-D8OMdk4O.js";
4
- import { n as setThreadBindingMaxAgeBySessionKey, r as resolveBindingIdsForTargetSession, t as setThreadBindingIdleTimeoutBySessionKey } from "./thread-bindings.session-updates-CJb-BpPL.js";
5
- import { _ as resolveThreadBindingThreadName, g as resolveThreadBindingIntroText, h as formatThreadBindingDurationLabel, m as resolveThreadBindingPersonaFromRecord, n as createThreadBindingManager, o as resolveChannelIdForBinding, p as resolveThreadBindingPersona, r as getThreadBindingManager, t as createNoopThreadBindingManager } from "./thread-bindings.manager-ByOtwjo_.js";
4
+ import { n as setThreadBindingMaxAgeBySessionKey, r as resolveBindingIdsForTargetSession, t as setThreadBindingIdleTimeoutBySessionKey } from "./thread-bindings.session-updates-CC7HoQvt.js";
5
+ import { _ as resolveThreadBindingThreadName, g as resolveThreadBindingIntroText, h as formatThreadBindingDurationLabel, m as resolveThreadBindingPersonaFromRecord, n as createThreadBindingManager, o as resolveChannelIdForBinding, p as resolveThreadBindingPersona, r as getThreadBindingManager, t as createNoopThreadBindingManager } from "./thread-bindings.manager-B1oySiVc.js";
6
6
  import { normalizeAccountId } from "openclaw/plugin-sdk/routing";
7
7
  import { normalizeOptionalLowercaseString, normalizeOptionalString, uniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
8
8
  import { resolveThreadBindingIdleTimeoutMs, resolveThreadBindingMaxAgeMs, resolveThreadBindingsEnabled } from "openclaw/plugin-sdk/conversation-runtime";
@@ -141,7 +141,8 @@ async function reconcileAcpThreadBindingsOnStartup(params) {
141
141
  }
142
142
  const session = readAcpSessionEntry({
143
143
  cfg: params.cfg,
144
- sessionKey
144
+ sessionKey,
145
+ agentId: binding.agentId
145
146
  });
146
147
  if (!session) {
147
148
  staleBindings.push(binding);