@openclaw/discord 2026.5.7 → 2026.5.10-beta.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 (110) hide show
  1. package/dist/{access-CHY9FK3X.js → access-R4X7pYt4.js} +1 -1
  2. package/dist/action-runtime-api.js +1 -1
  3. package/dist/{allow-list-ek-1hMKN.js → allow-list-4wnZg5P9.js} +2 -6
  4. package/dist/api.js +18 -16
  5. package/dist/{approval-handler.runtime-BBZRYAGs.js → approval-handler.runtime-B5BCBw4D.js} +3 -4
  6. package/dist/{approval-native-CBdZsAR7.js → approval-native-CrCc3b4u.js} +2 -2
  7. package/dist/{approval-shared-Ck6TxKgo.js → approval-shared-Ckk65xSG.js} +1 -1
  8. package/dist/{audit-CCJ0h49k.js → audit-BRBe8xFv.js} +4 -4
  9. package/dist/{channel-UXGa9PGc.js → channel-DTBEGHsT.js} +53 -31
  10. package/dist/{channel-actions-Br29_1nE.js → channel-actions-CHgoSpPF.js} +27 -1
  11. package/dist/{channel-actions.runtime-ChmNUig1.js → channel-actions.runtime-E5Plubuu.js} +5 -5
  12. package/dist/channel-config-api.js +1 -1
  13. package/dist/channel-plugin-api.js +1 -1
  14. package/dist/{channel.setup-D_xyQu_h.js → channel.setup-EQXuueIk.js} +3 -3
  15. package/dist/chunk-DYl-_5RL.js +179 -0
  16. package/dist/{components-D5LnN7ZQ.js → components-BJOShoIU.js} +2 -3
  17. package/dist/{config-schema-Cc953rAs.js → config-schema-BGn5I3_3.js} +46 -1
  18. package/dist/contract-api.js +7 -7
  19. package/dist/{conversation-identity-DHhS0ez3.js → conversation-identity-BPQm_uhV.js} +1 -1
  20. package/dist/{directory-config-DoETeOOx.js → directory-config-JBaFwbAQ.js} +1 -1
  21. package/dist/directory-contract-api.js +1 -1
  22. package/dist/{directory-live-DJ0V5asB.js → directory-live-B4kW11z5.js} +2 -2
  23. package/dist/{discord-eZlimVfW.js → discord-DtHMmZqJ.js} +58 -15
  24. package/dist/{doctor-Bo-yifB3.js → doctor-CPV4Ch3V.js} +3 -3
  25. package/dist/{doctor-contract-Bso46EOQ.js → doctor-contract-BGjjFBdq.js} +1 -1
  26. package/dist/doctor-contract-api.js +1 -1
  27. package/dist/{handle-action.guild-admin-sJiQymg8.js → handle-action.guild-admin-DSeMCHvR.js} +6 -3
  28. package/dist/{inbound-context-CRylwjg0.js → inbound-context-BAwOn5Iq.js} +1 -1
  29. package/dist/manager.runtime-DGvCDWI5.js +2082 -0
  30. package/dist/{message-handler-C9Ohf-ea.js → message-handler-BWHSteQf.js} +7 -7
  31. package/dist/{message-handler.preflight-BrvazsYn.js → message-handler.preflight-q7ose9Ta.js} +31 -42
  32. package/dist/{message-handler.process-CEnzuLiN.js → message-handler.process-BN8bE7AE.js} +81 -64
  33. package/dist/{message-utils-9kaGF59d.js → message-utils-DEjCwCRz.js} +2 -2
  34. package/dist/normalize-Cu94FOqy.js +58 -0
  35. package/dist/{outbound-adapter-DNsTVJfH.js → outbound-adapter-Bt8FL3yO.js} +78 -17
  36. package/dist/{outbound-session-route-DK9qkPgP.js → outbound-session-route-BaJRt05p.js} +1 -1
  37. package/dist/{pluralkit-OFss_pIy.js → pluralkit-CUfobeQu.js} +1 -1
  38. package/dist/{preflight-audio-CRmUxxuM.js → preflight-audio-BcsH127L.js} +1 -1
  39. package/dist/{preview-streaming-Cc_oeIPP.js → preview-streaming-DCPAe24T.js} +1 -0
  40. package/dist/{probe.runtime-CMgUDax3.js → probe.runtime-4Q9GD7FG.js} +1 -1
  41. package/dist/{provider-CuOh6z_b.js → provider-DBvvDP9A.js} +185 -225
  42. package/dist/{provider-session.runtime-CCESIHVo.js → provider-session.runtime-DepAOR1U.js} +3 -3
  43. package/dist/provider.runtime-BlbOt97W.js +2 -0
  44. package/dist/{reply-delivery-D9aKHtDH.js → reply-delivery-vHSqaKKo.js} +9 -6
  45. package/dist/{resolve-allowlist-common-_e1cWOb3.js → resolve-allowlist-common-ZcVU4OMA.js} +1 -1
  46. package/dist/{resolve-channels-kyuvrXJg.js → resolve-channels-D9Dubj_y.js} +3 -3
  47. package/dist/{resolve-users-CAwh4EBq.js → resolve-users-DlzKsLQe.js} +2 -2
  48. package/dist/route-resolution-foWW8_D1.js +268 -0
  49. package/dist/runtime-api.actions.js +2 -2
  50. package/dist/runtime-api.js +25 -25
  51. package/dist/runtime-api.lookup.js +6 -6
  52. package/dist/runtime-api.monitor-CsetE9pd.js +6 -0
  53. package/dist/runtime-api.monitor.js +7 -7
  54. package/dist/runtime-api.send.js +5 -5
  55. package/dist/runtime-api.threads.js +5 -5
  56. package/dist/{runtime-D8alY00g.js → runtime-oXRGbcb5.js} +7 -7
  57. package/dist/runtime-setter-api.js +1 -1
  58. package/dist/secret-contract-api.js +1 -1
  59. package/dist/{security-audit-BtRd_VhN.js → security-audit-BQ_sGK3J.js} +1 -1
  60. package/dist/security-audit-contract-api.js +1 -1
  61. package/dist/{security-audit.runtime-Dm1LW9KX.js → security-audit.runtime-B7Gmz2DX.js} +1 -1
  62. package/dist/security-contract-api.js +1 -1
  63. package/dist/{send-8S_HKJpQ.js → send-BSBMchf8.js} +83 -57
  64. package/dist/{send.components-A42c_5tQ.js → send.components-BoEhxys4.js} +22 -15
  65. package/dist/{send.outbound-D3tonSz8.js → send.outbound-B2DK2loZ.js} +22 -11
  66. package/dist/send.receipt-BAZw2Zsz.js +35 -0
  67. package/dist/{send.shared-BQGiUPvZ.js → send.shared-DzwpAEMP.js} +26 -7
  68. package/dist/session-key-api.js +1 -1
  69. package/dist/setup-plugin-api.js +1 -1
  70. package/dist/{shared-BEW4H3bj.js → shared-CBsrEG5q.js} +8 -8
  71. package/dist/{shared-interactive-KgJjCqnB.js → shared-interactive-D39V9Wtn.js} +3 -3
  72. package/dist/{subagent-hooks-T0LPLh4H.js → subagent-hooks-BDy1pJD5.js} +2 -2
  73. package/dist/subagent-hooks-api.js +1 -1
  74. package/dist/{system-events-_fzSG--3.js → system-events-BeVImqnV.js} +1 -1
  75. package/dist/target-parsing-D-H7nnh2.js +51 -0
  76. package/dist/target-resolver-DzOelJEt.js +85 -0
  77. package/dist/targets-Dj-qyUaE.js +3 -0
  78. package/dist/test-api.js +4 -4
  79. package/dist/{thread-bindings-CMpZjP50.js → thread-bindings-DUzBL8jL.js} +7 -7
  80. package/dist/{thread-bindings.discord-api-CwWGoyei.js → thread-bindings.discord-api-dpSDYFKX.js} +7 -7
  81. package/dist/{thread-bindings.manager-BtxfLfWf.js → thread-bindings.manager-DTuwm8Tk.js} +5 -6
  82. package/dist/{thread-bindings.session-updates-jcZSiRPI.js → thread-bindings.session-updates-BhcGQTJb.js} +1 -1
  83. package/dist/{threading-BMmpA2JR.js → threading-CTUnZtNi.js} +4 -5
  84. package/dist/timeouts.js +1 -1
  85. package/dist/{typing-Bw6NKWLZ.js → typing-BYeVSviE.js} +2 -3
  86. package/openclaw.plugin.json +222 -1
  87. package/package.json +5 -5
  88. package/dist/manager.runtime-Cug1PoeZ.js +0 -1025
  89. package/dist/provider.runtime-B68g3qLv.js +0 -2
  90. package/dist/rolldown-runtime-C3SqQTfK.js +0 -28
  91. package/dist/route-resolution-BWErj5Cn.js +0 -236
  92. package/dist/runtime-api.monitor-DzkCxeBL.js +0 -6
  93. package/dist/target-resolver-DA84_xbt.js +0 -365
  94. package/dist/targets-FwL1BPTU.js +0 -2
  95. /package/dist/{agent-components.runtime-Dof1YMSz.js → agent-components.runtime-zT8qPsnM.js} +0 -0
  96. /package/dist/{audit-core-CejGc3hO.js → audit-core-CG37TsZm.js} +0 -0
  97. /package/dist/{channel-access-DFIQqbYm.js → channel-access-BL-wemES.js} +0 -0
  98. /package/dist/{doctor-shared-Cqvfgv9m.js → doctor-shared-D_QLzu30.js} +0 -0
  99. /package/dist/{mentions-BPZUaFk7.js → mentions-f806C7MB.js} +0 -0
  100. /package/dist/{preflight-audio.runtime-DPVbpZid.js → preflight-audio.runtime-fXnUxxBa.js} +0 -0
  101. /package/dist/{probe-E80IMT1X.js → probe-CjO53qsc.js} +0 -0
  102. /package/dist/{runtime-K9RT6Egn.js → runtime-BqCoo-zp.js} +0 -0
  103. /package/dist/{secret-config-contract-5S9U9pjx.js → secret-config-contract-BCQNNS7N.js} +0 -0
  104. /package/dist/{security-contract-BE8rsdPq.js → security-contract-DrbQqyyW.js} +0 -0
  105. /package/dist/{security-doctor-DiilN216.js → security-doctor-BJH5YIGL.js} +0 -0
  106. /package/dist/{sender-identity-BGUfyvOC.js → sender-identity-CDOVm5Dk.js} +0 -0
  107. /package/dist/{session-contract-CuW9Nlxg.js → session-contract-D871HDFG.js} +0 -0
  108. /package/dist/{session-key-normalization-B5La-jFM.js → session-key-normalization-BQNCS1gu.js} +0 -0
  109. /package/dist/{thread-bindings.state-WU4duXKY.js → thread-bindings.state-DwgDYzBM.js} +0 -0
  110. /package/dist/{timeouts-CdsmBWWs.js → timeouts-C3FYXWJX.js} +0 -0
@@ -1,4 +1,4 @@
1
- import { c as resolveDiscordChannelConfigWithFallback, d as resolveDiscordGuildEntry, f as resolveDiscordMemberAccessState, m as resolveDiscordOwnerAccess, n as isDiscordGroupAllowedByPolicy } from "./allow-list-ek-1hMKN.js";
1
+ import { c as resolveDiscordChannelConfigWithFallback, d as resolveDiscordGuildEntry, f as resolveDiscordMemberAccessState, m as resolveDiscordOwnerAccess, n as isDiscordGroupAllowedByPolicy } from "./allow-list-4wnZg5P9.js";
2
2
  import { resolveOpenProviderRuntimeGroupPolicy } from "openclaw/plugin-sdk/runtime-group-policy";
3
3
  import { resolveCommandAuthorizedFromAuthorizers } from "openclaw/plugin-sdk/command-auth-native";
4
4
  //#region extensions/discord/src/voice/config.ts
@@ -1,2 +1,2 @@
1
- import { t as handleDiscordAction } from "./runtime-D8alY00g.js";
1
+ import { t as handleDiscordAction } from "./runtime-oXRGbcb5.js";
2
2
  export { handleDiscordAction };
@@ -1,7 +1,6 @@
1
1
  import { n as formatDiscordUserTag } from "./format-D8TsaXxW.js";
2
2
  import { normalizeLowercaseStringOrEmpty, normalizeOptionalString } from "openclaw/plugin-sdk/text-runtime";
3
3
  import { buildChannelKeyCandidates, resolveChannelEntryMatchWithFallback, resolveChannelMatchConfig } from "openclaw/plugin-sdk/channel-targets";
4
- import { evaluateGroupRouteAccessForPolicy } from "openclaw/plugin-sdk/group-access";
5
4
  //#region extensions/discord/src/monitor/allow-list.ts
6
5
  const DISCORD_OWNER_ALLOWLIST_PREFIXES = [
7
6
  "discord:",
@@ -282,11 +281,8 @@ function isDiscordAutoThreadOwnedByBot(params) {
282
281
  }
283
282
  function isDiscordGroupAllowedByPolicy(params) {
284
283
  if (params.groupPolicy === "allowlist" && !params.guildAllowlisted) return false;
285
- return evaluateGroupRouteAccessForPolicy({
286
- groupPolicy: params.groupPolicy === "allowlist" && !params.channelAllowlistConfigured ? "open" : params.groupPolicy,
287
- routeAllowlistConfigured: params.channelAllowlistConfigured,
288
- routeMatched: params.channelAllowed
289
- }).allowed;
284
+ if (params.groupPolicy === "disabled") return false;
285
+ return params.groupPolicy !== "allowlist" || !params.channelAllowlistConfigured || params.channelAllowed;
290
286
  }
291
287
  function resolveDiscordChannelPolicyCommandAuthorizer(params) {
292
288
  const channelAllowlistConfigured = Boolean(params.guildInfo?.channels) && Object.keys(params.guildInfo?.channels ?? {}).length > 0;
package/dist/api.js CHANGED
@@ -1,23 +1,25 @@
1
1
  import { a as mergeDiscordAccountConfig, f as resolveDiscordMaxLinesPerMessage, i as listEnabledDiscordAccounts, l as resolveDiscordAccountConfig, o as resolveDefaultDiscordAccountId, r as listDiscordAccountIds, s as resolveDiscordAccount, t as createDiscordActionGate } from "./accounts-CaHGiVB4.js";
2
2
  import { t as inspectDiscordAccount } from "./account-inspect-BcQAxhKY.js";
3
- import { a as normalizeDiscordMessagingTarget, c as parseDiscordTarget, i as looksLikeDiscordTargetId, l as resolveDiscordChannelId, n as resolveDiscordTarget, o as normalizeDiscordOutboundTarget, r as parseDiscordSendTarget } from "./target-resolver-DA84_xbt.js";
3
+ import { n as resolveDiscordChannelId, t as parseDiscordTarget } from "./target-parsing-D-H7nnh2.js";
4
4
  import { n as fetchDiscord, r as requestDiscord, t as DiscordApiError } from "./api-DzNBVTto.js";
5
- import { _ as parseDiscordModalCustomIdForInteraction, a as buildDiscordComponentMessage, c as readDiscordComponentSpec, d as DISCORD_MODAL_CUSTOM_ID_KEY, f as buildDiscordComponentCustomId, g as parseDiscordModalCustomId, h as parseDiscordComponentCustomIdForInteraction, i as createDiscordFormModal, l as resolveDiscordComponentAttachmentName, m as parseDiscordComponentCustomId, n as formatDiscordComponentEventText, o as buildDiscordComponentMessageFlags, p as buildDiscordModalCustomId, r as DiscordFormModal, s as DISCORD_COMPONENT_ATTACHMENT_PREFIX, u as DISCORD_COMPONENT_CUSTOM_ID_KEY } from "./components-D5LnN7ZQ.js";
6
- import { t as buildDiscordInteractiveComponents } from "./shared-interactive-KgJjCqnB.js";
7
- import "./targets-FwL1BPTU.js";
8
- import { a as shouldSuppressLocalDiscordExecApprovalPrompt, i as isDiscordExecApprovalClientEnabled, n as getDiscordExecApprovalApprovers, r as isDiscordExecApprovalApprover } from "./approval-shared-Ck6TxKgo.js";
9
- import { i as resolveDiscordGroupToolPolicy, n as collectDiscordStatusIssues, r as resolveDiscordGroupRequireMention, t as discordPlugin } from "./channel-UXGa9PGc.js";
10
- import { t as normalizeExplicitDiscordSessionKey } from "./session-key-normalization-B5La-jFM.js";
11
- import { t as discordSetupPlugin } from "./channel.setup-D_xyQu_h.js";
12
- import { n as handleDiscordSubagentEnded, r as handleDiscordSubagentSpawning, t as handleDiscordSubagentDeliveryTarget } from "./subagent-hooks-T0LPLh4H.js";
13
- import { t as tryHandleDiscordMessageActionGuildAdmin } from "./handle-action.guild-admin-sJiQymg8.js";
14
- import { n as listDiscordDirectoryGroupsFromConfig, r as listDiscordDirectoryPeersFromConfig } from "./directory-config-DoETeOOx.js";
15
- import { t as fetchPluralKitMessageInfo } from "./pluralkit-OFss_pIy.js";
16
- import { a as resolveDiscordPrivilegedIntentsFromFlags, i as probeDiscord, n as fetchDiscordApplicationSummary, r as parseApplicationIdFromToken, t as fetchDiscordApplicationId } from "./probe-E80IMT1X.js";
17
- import { t as collectDiscordSecurityAuditFindings } from "./security-audit-BtRd_VhN.js";
18
- import { a as mergeAbortSignals, i as DISCORD_DEFAULT_LISTENER_TIMEOUT_MS, n as DISCORD_ATTACHMENT_TOTAL_TIMEOUT_MS, r as DISCORD_DEFAULT_INBOUND_WORKER_TIMEOUT_MS, t as DISCORD_ATTACHMENT_IDLE_TIMEOUT_MS } from "./timeouts-CdsmBWWs.js";
5
+ import { i as normalizeDiscordOutboundTarget, n as looksLikeDiscordTargetId, r as normalizeDiscordMessagingTarget } from "./normalize-Cu94FOqy.js";
6
+ import { i as parseDiscordSendTarget, n as resolveDiscordTarget } from "./target-resolver-DzOelJEt.js";
7
+ import { _ as parseDiscordModalCustomIdForInteraction, a as buildDiscordComponentMessage, c as readDiscordComponentSpec, d as DISCORD_MODAL_CUSTOM_ID_KEY, f as buildDiscordComponentCustomId, g as parseDiscordModalCustomId, h as parseDiscordComponentCustomIdForInteraction, i as createDiscordFormModal, l as resolveDiscordComponentAttachmentName, m as parseDiscordComponentCustomId, n as formatDiscordComponentEventText, o as buildDiscordComponentMessageFlags, p as buildDiscordModalCustomId, r as DiscordFormModal, s as DISCORD_COMPONENT_ATTACHMENT_PREFIX, u as DISCORD_COMPONENT_CUSTOM_ID_KEY } from "./components-BJOShoIU.js";
8
+ import { t as buildDiscordInteractiveComponents } from "./shared-interactive-D39V9Wtn.js";
9
+ import "./targets-Dj-qyUaE.js";
10
+ import { a as shouldSuppressLocalDiscordExecApprovalPrompt, i as isDiscordExecApprovalClientEnabled, n as getDiscordExecApprovalApprovers, r as isDiscordExecApprovalApprover } from "./approval-shared-Ckk65xSG.js";
11
+ import { i as resolveDiscordGroupToolPolicy, n as collectDiscordStatusIssues, r as resolveDiscordGroupRequireMention, t as discordPlugin } from "./channel-DTBEGHsT.js";
12
+ import { t as normalizeExplicitDiscordSessionKey } from "./session-key-normalization-BQNCS1gu.js";
13
+ import { t as discordSetupPlugin } from "./channel.setup-EQXuueIk.js";
14
+ import { n as handleDiscordSubagentEnded, r as handleDiscordSubagentSpawning, t as handleDiscordSubagentDeliveryTarget } from "./subagent-hooks-BDy1pJD5.js";
15
+ import { t as tryHandleDiscordMessageActionGuildAdmin } from "./handle-action.guild-admin-DSeMCHvR.js";
16
+ import { n as listDiscordDirectoryGroupsFromConfig, r as listDiscordDirectoryPeersFromConfig } from "./directory-config-JBaFwbAQ.js";
17
+ import { t as fetchPluralKitMessageInfo } from "./pluralkit-CUfobeQu.js";
18
+ import { a as resolveDiscordPrivilegedIntentsFromFlags, i as probeDiscord, n as fetchDiscordApplicationSummary, r as parseApplicationIdFromToken, t as fetchDiscordApplicationId } from "./probe-CjO53qsc.js";
19
+ import { t as collectDiscordSecurityAuditFindings } from "./security-audit-BQ_sGK3J.js";
20
+ import { a as mergeAbortSignals, i as DISCORD_DEFAULT_LISTENER_TIMEOUT_MS, n as DISCORD_ATTACHMENT_TOTAL_TIMEOUT_MS, r as DISCORD_DEFAULT_INBOUND_WORKER_TIMEOUT_MS, t as DISCORD_ATTACHMENT_IDLE_TIMEOUT_MS } from "./timeouts-C3FYXWJX.js";
19
21
  import { resolveOpenProviderRuntimeGroupPolicy as resolveDiscordRuntimeGroupPolicy } from "openclaw/plugin-sdk/runtime-group-policy";
20
22
  //#region extensions/discord/api.ts
21
- const handleDiscordMessageAction = async (...args) => (await import("./channel-actions.runtime-ChmNUig1.js")).handleDiscordMessageAction(...args);
23
+ const handleDiscordMessageAction = async (...args) => (await import("./channel-actions.runtime-E5Plubuu.js")).handleDiscordMessageAction(...args);
22
24
  //#endregion
23
25
  export { DISCORD_ATTACHMENT_IDLE_TIMEOUT_MS, DISCORD_ATTACHMENT_TOTAL_TIMEOUT_MS, DISCORD_COMPONENT_ATTACHMENT_PREFIX, DISCORD_COMPONENT_CUSTOM_ID_KEY, DISCORD_DEFAULT_INBOUND_WORKER_TIMEOUT_MS, DISCORD_DEFAULT_LISTENER_TIMEOUT_MS, DISCORD_MODAL_CUSTOM_ID_KEY, DiscordApiError, DiscordFormModal, buildDiscordComponentCustomId, buildDiscordComponentMessage, buildDiscordComponentMessageFlags, buildDiscordInteractiveComponents, buildDiscordModalCustomId, collectDiscordSecurityAuditFindings, collectDiscordStatusIssues, createDiscordActionGate, createDiscordFormModal, discordPlugin, discordSetupPlugin, fetchDiscord, fetchDiscordApplicationId, fetchDiscordApplicationSummary, fetchPluralKitMessageInfo, formatDiscordComponentEventText, getDiscordExecApprovalApprovers, handleDiscordMessageAction, handleDiscordSubagentDeliveryTarget, handleDiscordSubagentEnded, handleDiscordSubagentSpawning, inspectDiscordAccount, isDiscordExecApprovalApprover, isDiscordExecApprovalClientEnabled, listDiscordAccountIds, listDiscordDirectoryGroupsFromConfig, listDiscordDirectoryPeersFromConfig, listEnabledDiscordAccounts, looksLikeDiscordTargetId, mergeAbortSignals, mergeDiscordAccountConfig, normalizeDiscordMessagingTarget, normalizeDiscordOutboundTarget, normalizeExplicitDiscordSessionKey, parseApplicationIdFromToken, parseDiscordComponentCustomId, parseDiscordComponentCustomIdForInteraction as parseDiscordComponentCustomIdForCarbon, parseDiscordComponentCustomIdForInteraction, parseDiscordModalCustomId, parseDiscordModalCustomIdForInteraction as parseDiscordModalCustomIdForCarbon, parseDiscordModalCustomIdForInteraction, parseDiscordSendTarget, parseDiscordTarget, probeDiscord, readDiscordComponentSpec, requestDiscord, resolveDefaultDiscordAccountId, resolveDiscordAccount, resolveDiscordAccountConfig, resolveDiscordChannelId, resolveDiscordComponentAttachmentName, resolveDiscordGroupRequireMention, resolveDiscordGroupToolPolicy, resolveDiscordMaxLinesPerMessage, resolveDiscordPrivilegedIntentsFromFlags, resolveDiscordRuntimeGroupPolicy, resolveDiscordTarget, shouldSuppressLocalDiscordExecApprovalPrompt, tryHandleDiscordMessageActionGuildAdmin };
@@ -1,8 +1,7 @@
1
- import { t as __exportAll } from "./rolldown-runtime-C3SqQTfK.js";
1
+ import { $ as createChannelMessage, A as Button, B as Separator, H as TextDisplay, J as createUserDmChannel, M as Container, Pt as __exportAll, R as Row, it as editChannelMessage, nt as deleteChannelMessage, w as serializePayload } from "./discord-DtHMmZqJ.js";
2
2
  import { t as inspectDiscordAccount } from "./account-inspect-BcQAxhKY.js";
3
- import { $ as createChannelMessage, A as Button, B as Separator, H as TextDisplay, J as createUserDmChannel, M as Container, R as Row, it as editChannelMessage, nt as deleteChannelMessage, w as serializePayload } from "./discord-eZlimVfW.js";
4
- import { A as createDiscordClient, y as stripUndefinedFields } from "./send.shared-BQGiUPvZ.js";
5
- import { i as isDiscordExecApprovalClientEnabled, t as shouldHandleDiscordApprovalRequest } from "./approval-shared-Ck6TxKgo.js";
3
+ import { A as createDiscordClient, y as stripUndefinedFields } from "./send.shared-DzwpAEMP.js";
4
+ import { i as isDiscordExecApprovalClientEnabled, t as shouldHandleDiscordApprovalRequest } from "./approval-shared-Ckk65xSG.js";
6
5
  import { logDebug, logError, normalizeOptionalString } from "openclaw/plugin-sdk/text-runtime";
7
6
  import { ButtonStyle } from "discord-api-types/v10";
8
7
  import { createChannelApprovalNativeRuntimeAdapter } from "openclaw/plugin-sdk/approval-handler-runtime";
@@ -1,5 +1,5 @@
1
1
  import { r as listDiscordAccountIds, s as resolveDiscordAccount } from "./accounts-CaHGiVB4.js";
2
- import { c as createChannelNativeOriginTargetResolver, i as isDiscordExecApprovalClientEnabled, n as getDiscordExecApprovalApprovers, o as createApproverRestrictedNativeApprovalCapability, r as isDiscordExecApprovalApprover, s as createChannelApproverDmTargetResolver, t as shouldHandleDiscordApprovalRequest } from "./approval-shared-Ck6TxKgo.js";
2
+ import { c as createChannelNativeOriginTargetResolver, i as isDiscordExecApprovalClientEnabled, n as getDiscordExecApprovalApprovers, o as createApproverRestrictedNativeApprovalCapability, r as isDiscordExecApprovalApprover, s as createChannelApproverDmTargetResolver, t as shouldHandleDiscordApprovalRequest } from "./approval-shared-Ckk65xSG.js";
3
3
  import { normalizeLowercaseStringOrEmpty, normalizeOptionalString } from "openclaw/plugin-sdk/text-runtime";
4
4
  import { createLazyChannelApprovalNativeRuntimeAdapter } from "openclaw/plugin-sdk/approval-handler-adapter-runtime";
5
5
  import { resolveApprovalRequestSessionConversation } from "openclaw/plugin-sdk/approval-native-runtime";
@@ -140,7 +140,7 @@ function createDiscordApprovalCapability(configOverride) {
140
140
  request,
141
141
  configOverride
142
142
  }),
143
- load: async () => (await import("./approval-handler.runtime-BBZRYAGs.js").then((n) => n.t)).discordApprovalNativeRuntime
143
+ load: async () => (await import("./approval-handler.runtime-B5BCBw4D.js").then((n) => n.t)).discordApprovalNativeRuntime
144
144
  })
145
145
  });
146
146
  }
@@ -1,5 +1,5 @@
1
1
  import { s as resolveDiscordAccount } from "./accounts-CaHGiVB4.js";
2
- import { c as parseDiscordTarget } from "./target-resolver-DA84_xbt.js";
2
+ import { t as parseDiscordTarget } from "./target-parsing-D-H7nnh2.js";
3
3
  import { createChannelApproverDmTargetResolver, createChannelNativeOriginTargetResolver, doesApprovalRequestMatchChannelAccount } from "openclaw/plugin-sdk/approval-native-runtime";
4
4
  import { getExecApprovalReplyMetadata, isChannelExecApprovalClientEnabledFromConfig, matchesApprovalRequestFilters } from "openclaw/plugin-sdk/approval-client-runtime";
5
5
  import { resolveApprovalApprovers } from "openclaw/plugin-sdk/approval-auth-runtime";
@@ -1,8 +1,8 @@
1
- import { t as __exportAll } from "./rolldown-runtime-C3SqQTfK.js";
1
+ import { Pt as __exportAll } from "./discord-DtHMmZqJ.js";
2
2
  import { t as inspectDiscordAccount } from "./account-inspect-BcQAxhKY.js";
3
- import { T as fetchChannelPermissionsDiscord } from "./send.shared-BQGiUPvZ.js";
4
- import "./send-8S_HKJpQ.js";
5
- import { n as collectDiscordAuditChannelIdsForAccount, t as auditDiscordChannelPermissionsWithFetcher } from "./audit-core-CejGc3hO.js";
3
+ import { T as fetchChannelPermissionsDiscord } from "./send.shared-DzwpAEMP.js";
4
+ import "./send-BSBMchf8.js";
5
+ import { n as collectDiscordAuditChannelIdsForAccount, t as auditDiscordChannelPermissionsWithFetcher } from "./audit-core-CG37TsZm.js";
6
6
  //#region extensions/discord/src/audit.ts
7
7
  var audit_exports = /* @__PURE__ */ __exportAll({
8
8
  auditDiscordChannelPermissions: () => auditDiscordChannelPermissions,
@@ -1,21 +1,23 @@
1
1
  import { c as resolveDiscordAccountAllowFrom, r as listDiscordAccountIds, s as resolveDiscordAccount } from "./accounts-CaHGiVB4.js";
2
2
  import { a as projectCredentialSnapshotFields, n as PAIRING_APPROVED_MESSAGE, o as resolveConfiguredFromCredentialStatuses, r as buildTokenChannelStatusSummary, t as DEFAULT_ACCOUNT_ID } from "./channel-api-CTSWMrnD.js";
3
- import { a as normalizeDiscordMessagingTarget, c as parseDiscordTarget, i as looksLikeDiscordTargetId, n as resolveDiscordTarget } from "./target-resolver-DA84_xbt.js";
4
- import { t as resolveDiscordOutboundSessionRoute } from "./outbound-session-route-DK9qkPgP.js";
5
- import { t as getDiscordRuntime } from "./runtime-K9RT6Egn.js";
6
- import { a as shouldSuppressLocalDiscordExecApprovalPrompt } from "./approval-shared-Ck6TxKgo.js";
7
- import { t as getDiscordApprovalCapability } from "./approval-native-CBdZsAR7.js";
8
- import { r as resolveRequiredDiscordChannelPermissions } from "./audit-core-CejGc3hO.js";
9
- import { t as discordMessageActions$1 } from "./channel-actions-Br29_1nE.js";
10
- import { n as resolveDiscordCurrentConversationIdentity } from "./conversation-identity-DHhS0ez3.js";
11
- import { n as setThreadBindingMaxAgeBySessionKey, t as setThreadBindingIdleTimeoutBySessionKey } from "./thread-bindings.session-updates-jcZSiRPI.js";
12
- import { n as discordOutbound } from "./outbound-adapter-DNsTVJfH.js";
13
- import { i as discordSecurityAdapter, n as discordConfigAdapter, r as discordSetupAdapter, t as createDiscordPluginBase } from "./shared-BEW4H3bj.js";
14
- import { t as normalizeExplicitDiscordSessionKey } from "./session-key-normalization-B5La-jFM.js";
3
+ import { t as parseDiscordTarget } from "./target-parsing-D-H7nnh2.js";
4
+ import { t as resolveDiscordOutboundSessionRoute } from "./outbound-session-route-BaJRt05p.js";
5
+ import { n as looksLikeDiscordTargetId, r as normalizeDiscordMessagingTarget } from "./normalize-Cu94FOqy.js";
6
+ import { t as getDiscordRuntime } from "./runtime-BqCoo-zp.js";
7
+ import { a as shouldSuppressLocalDiscordExecApprovalPrompt } from "./approval-shared-Ckk65xSG.js";
8
+ import { t as getDiscordApprovalCapability } from "./approval-native-CrCc3b4u.js";
9
+ import { r as resolveRequiredDiscordChannelPermissions } from "./audit-core-CG37TsZm.js";
10
+ import { t as discordMessageActions$1 } from "./channel-actions-CHgoSpPF.js";
11
+ import { n as resolveDiscordCurrentConversationIdentity } from "./conversation-identity-BPQm_uhV.js";
12
+ import { n as setThreadBindingMaxAgeBySessionKey, t as setThreadBindingIdleTimeoutBySessionKey } from "./thread-bindings.session-updates-BhcGQTJb.js";
13
+ import { n as discordOutbound } from "./outbound-adapter-Bt8FL3yO.js";
14
+ import { i as discordSecurityAdapter, n as discordConfigAdapter, r as discordSetupAdapter, t as createDiscordPluginBase } from "./shared-CBsrEG5q.js";
15
+ import { t as normalizeExplicitDiscordSessionKey } from "./session-key-normalization-BQNCS1gu.js";
15
16
  import { normalizeLowercaseStringOrEmpty, normalizeOptionalString, normalizeOptionalStringifiedId } from "openclaw/plugin-sdk/text-runtime";
16
17
  import { createChatChannelPlugin } from "openclaw/plugin-sdk/channel-core";
17
18
  import { sleepWithAbort } from "openclaw/plugin-sdk/runtime-env";
18
19
  import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
20
+ import { createChannelMessageAdapterFromOutbound } from "openclaw/plugin-sdk/channel-message";
19
21
  import { buildLegacyDmAccountAllowlistAdapter, createAccountScopedAllowlistNameResolver, createNestedAllowlistOverrideResolver } from "openclaw/plugin-sdk/allowlist-config-edit";
20
22
  import { createPairingPrefixStripper } from "openclaw/plugin-sdk/channel-pairing";
21
23
  import { createChannelDirectoryAdapter, createRuntimeDirectoryLiveAdapter } from "openclaw/plugin-sdk/directory-runtime";
@@ -127,28 +129,29 @@ let discordProbeRuntimePromise;
127
129
  let discordAuditModulePromise;
128
130
  let discordSendModulePromise;
129
131
  let discordDirectoryLiveModulePromise;
130
- const loadDiscordDirectoryConfigModule = createLazyRuntimeModule(() => import("./directory-config-DoETeOOx.js").then((n) => n.t));
131
- const loadDiscordResolveChannelsModule = createLazyRuntimeModule(() => import("./resolve-channels-kyuvrXJg.js").then((n) => n.n));
132
- const loadDiscordResolveUsersModule = createLazyRuntimeModule(() => import("./resolve-users-CAwh4EBq.js").then((n) => n.n));
133
- const loadDiscordThreadBindingsManagerModule = createLazyRuntimeModule(() => import("./thread-bindings.manager-BtxfLfWf.js").then((n) => n.a));
132
+ const loadDiscordDirectoryConfigModule = createLazyRuntimeModule(() => import("./directory-config-JBaFwbAQ.js").then((n) => n.t));
133
+ const loadDiscordResolveChannelsModule = createLazyRuntimeModule(() => import("./resolve-channels-D9Dubj_y.js").then((n) => n.n));
134
+ const loadDiscordResolveUsersModule = createLazyRuntimeModule(() => import("./resolve-users-DlzKsLQe.js").then((n) => n.n));
135
+ const loadDiscordThreadBindingsManagerModule = createLazyRuntimeModule(() => import("./thread-bindings.manager-DTuwm8Tk.js").then((n) => n.a));
136
+ const loadDiscordTargetResolverModule = createLazyRuntimeModule(() => import("./target-resolver-DzOelJEt.js").then((n) => n.r));
134
137
  async function loadDiscordProviderRuntime() {
135
- discordProviderRuntimePromise ??= import("./provider.runtime-B68g3qLv.js");
138
+ discordProviderRuntimePromise ??= import("./provider.runtime-BlbOt97W.js");
136
139
  return await discordProviderRuntimePromise;
137
140
  }
138
141
  async function loadDiscordProbeRuntime() {
139
- discordProbeRuntimePromise ??= import("./probe.runtime-CMgUDax3.js");
142
+ discordProbeRuntimePromise ??= import("./probe.runtime-4Q9GD7FG.js");
140
143
  return await discordProbeRuntimePromise;
141
144
  }
142
145
  async function loadDiscordAuditModule() {
143
- discordAuditModulePromise ??= import("./audit-CCJ0h49k.js").then((n) => n.n);
146
+ discordAuditModulePromise ??= import("./audit-BRBe8xFv.js").then((n) => n.n);
144
147
  return await discordAuditModulePromise;
145
148
  }
146
149
  async function loadDiscordSendModule() {
147
- discordSendModulePromise ??= import("./send-8S_HKJpQ.js").then((n) => n.t);
150
+ discordSendModulePromise ??= import("./send-BSBMchf8.js").then((n) => n.t);
148
151
  return await discordSendModulePromise;
149
152
  }
150
153
  async function loadDiscordDirectoryLiveModule() {
151
- discordDirectoryLiveModulePromise ??= import("./directory-live-DJ0V5asB.js").then((n) => n.t);
154
+ discordDirectoryLiveModulePromise ??= import("./directory-live-B4kW11z5.js").then((n) => n.t);
152
155
  return await discordDirectoryLiveModulePromise;
153
156
  }
154
157
  //#endregion
@@ -313,6 +316,22 @@ function collectDiscordStatusIssues(accounts) {
313
316
  //#endregion
314
317
  //#region extensions/discord/src/channel.ts
315
318
  const DISCORD_ACCOUNT_STARTUP_STAGGER_MS = 1e4;
319
+ const discordMessageAdapter = createChannelMessageAdapterFromOutbound({
320
+ id: "discord",
321
+ outbound: discordOutbound,
322
+ live: {
323
+ capabilities: {
324
+ draftPreview: true,
325
+ previewFinalization: true,
326
+ progressUpdates: true
327
+ },
328
+ finalizer: { capabilities: {
329
+ finalEdit: true,
330
+ normalFallback: true,
331
+ discardPending: true
332
+ } }
333
+ }
334
+ });
316
335
  function startDiscordStartupProbe(params) {
317
336
  (async () => {
318
337
  try {
@@ -354,6 +373,7 @@ const discordMessageActions = {
354
373
  resolveExecutionMode: (ctx) => resolveRuntimeDiscordMessageActions()?.resolveExecutionMode?.(ctx) ?? discordMessageActions$1.resolveExecutionMode?.(ctx) ?? "local",
355
374
  describeMessageTool: (ctx) => resolveRuntimeDiscordMessageActions()?.describeMessageTool?.(ctx) ?? discordMessageActions$1.describeMessageTool?.(ctx) ?? null,
356
375
  extractToolSend: (ctx) => resolveRuntimeDiscordMessageActions()?.extractToolSend?.(ctx) ?? discordMessageActions$1.extractToolSend?.(ctx) ?? null,
376
+ prepareSendPayload: (ctx) => resolveRuntimeDiscordMessageActions()?.prepareSendPayload?.(ctx) ?? discordMessageActions$1.prepareSendPayload?.(ctx) ?? null,
357
377
  handleAction: async (ctx) => {
358
378
  const runtimeHandleAction = resolveRuntimeDiscordMessageActions()?.handleAction;
359
379
  if (runtimeHandleAction) return await runtimeHandleAction(ctx);
@@ -452,17 +472,18 @@ const discordPlugin = createChatChannelPlugin({
452
472
  targetResolver: {
453
473
  looksLikeId: looksLikeDiscordTargetId,
454
474
  hint: "<channelId|user:ID|channel:ID>",
455
- resolveTarget: async ({ cfg, accountId, input, preferredKind }) => {
456
- const target = await resolveDiscordTarget(input, {
475
+ resolveTarget: async ({ cfg, accountId, input, normalized, preferredKind }) => {
476
+ const resolved = await (await loadDiscordTargetResolverModule()).resolveDiscordTarget(input, {
457
477
  cfg,
458
- accountId: accountId ?? void 0
459
- }, { defaultKind: preferredKind === "user" ? "user" : "channel" });
460
- return target ? {
461
- to: target.normalized,
462
- kind: target.kind,
463
- display: target.raw,
464
- source: "normalized"
465
- } : null;
478
+ accountId
479
+ }, preferredKind === "user" ? { defaultKind: "user" } : preferredKind === "channel" || preferredKind === "group" ? { defaultKind: "channel" } : {});
480
+ if (!resolved) return null;
481
+ return {
482
+ to: resolved.normalized,
483
+ kind: resolved.kind === "user" ? "user" : "channel",
484
+ display: resolved.raw,
485
+ source: resolved.normalized === normalized ? "normalized" : "directory"
486
+ };
466
487
  }
467
488
  }
468
489
  },
@@ -476,6 +497,7 @@ const discordPlugin = createChatChannelPlugin({
476
497
  listGroupsLive: (runtime) => runtime.listDiscordDirectoryGroupsLive
477
498
  })
478
499
  }),
500
+ message: discordMessageAdapter,
479
501
  resolver: { resolveTargets: async ({ cfg, accountId, inputs, kind }) => {
480
502
  const account = resolveDiscordAccount({
481
503
  cfg,
@@ -1,12 +1,13 @@
1
1
  import { r as listDiscordAccountIds, t as createDiscordActionGate } from "./accounts-CaHGiVB4.js";
2
2
  import { t as inspectDiscordAccount } from "./account-inspect-BcQAxhKY.js";
3
+ import { c as readDiscordComponentSpec } from "./components-BJOShoIU.js";
3
4
  import { normalizeOptionalString } from "openclaw/plugin-sdk/text-runtime";
4
5
  import { createUnionActionGate } from "openclaw/plugin-sdk/channel-actions";
5
6
  import { extractToolSend } from "openclaw/plugin-sdk/tool-send";
6
7
  //#region extensions/discord/src/channel-actions.ts
7
8
  let discordChannelActionsRuntimePromise;
8
9
  async function loadDiscordChannelActionsRuntime() {
9
- discordChannelActionsRuntimePromise ??= import("./channel-actions.runtime-ChmNUig1.js");
10
+ discordChannelActionsRuntimePromise ??= import("./channel-actions.runtime-E5Plubuu.js");
10
11
  return await discordChannelActionsRuntimePromise;
11
12
  }
12
13
  function listDiscoverableDiscordAccounts(cfg) {
@@ -122,6 +123,31 @@ const discordMessageActions = {
122
123
  }
123
124
  return null;
124
125
  },
126
+ prepareSendPayload: ({ ctx, payload }) => {
127
+ if (ctx.action !== "send") return null;
128
+ const rawComponents = ctx.params.components;
129
+ if (typeof rawComponents === "function") return null;
130
+ const componentSpec = rawComponents && typeof rawComponents === "object" && !Array.isArray(rawComponents) ? readDiscordComponentSpec(rawComponents) : void 0;
131
+ const nativeComponents = Array.isArray(rawComponents) ? rawComponents : void 0;
132
+ const embeds = Array.isArray(ctx.params.embeds) ? ctx.params.embeds : void 0;
133
+ if ((componentSpec || nativeComponents) && embeds?.length) return null;
134
+ const filename = normalizeOptionalString(ctx.params.filename);
135
+ if (!componentSpec && !nativeComponents && !embeds?.length && !filename) return payload;
136
+ const discordData = payload.channelData?.discord && typeof payload.channelData.discord === "object" && !Array.isArray(payload.channelData.discord) ? payload.channelData.discord : {};
137
+ return {
138
+ ...payload,
139
+ channelData: {
140
+ ...payload.channelData,
141
+ discord: {
142
+ ...discordData,
143
+ ...componentSpec ? { components: componentSpec } : {},
144
+ ...nativeComponents ? { components: nativeComponents } : {},
145
+ ...embeds?.length ? { embeds } : {},
146
+ ...filename ? { filename } : {}
147
+ }
148
+ }
149
+ };
150
+ },
125
151
  handleAction: async ({ action, params, cfg, accountId, requesterSenderId, toolContext, mediaAccess, mediaLocalRoots, mediaReadFile }) => {
126
152
  return await (await loadDiscordChannelActionsRuntime()).handleDiscordMessageAction({
127
153
  action,
@@ -1,9 +1,9 @@
1
- import { l as resolveDiscordChannelId } from "./target-resolver-DA84_xbt.js";
2
- import { t as handleDiscordAction } from "./runtime-D8alY00g.js";
3
- import { n as buildDiscordPresentationComponents, t as buildDiscordInteractiveComponents } from "./shared-interactive-KgJjCqnB.js";
4
- import "./targets-FwL1BPTU.js";
1
+ import { n as resolveDiscordChannelId } from "./target-parsing-D-H7nnh2.js";
2
+ import { t as handleDiscordAction } from "./runtime-oXRGbcb5.js";
3
+ import { n as buildDiscordPresentationComponents, t as buildDiscordInteractiveComponents } from "./shared-interactive-D39V9Wtn.js";
4
+ import "./targets-Dj-qyUaE.js";
5
5
  import "./action-runtime-api.js";
6
- import { t as tryHandleDiscordMessageActionGuildAdmin } from "./handle-action.guild-admin-sJiQymg8.js";
6
+ import { t as tryHandleDiscordMessageActionGuildAdmin } from "./handle-action.guild-admin-DSeMCHvR.js";
7
7
  import { normalizeOptionalStringifiedId } from "openclaw/plugin-sdk/text-runtime";
8
8
  import { resolveReactionMessageId } from "openclaw/plugin-sdk/channel-actions";
9
9
  import { readBooleanParam } from "openclaw/plugin-sdk/boolean-param";
@@ -1,2 +1,2 @@
1
- import { t as DiscordChannelConfigSchema } from "./config-schema-Cc953rAs.js";
1
+ import { t as DiscordChannelConfigSchema } from "./config-schema-BGn5I3_3.js";
2
2
  export { DiscordChannelConfigSchema };
@@ -1,2 +1,2 @@
1
- import { t as discordPlugin } from "./channel-UXGa9PGc.js";
1
+ import { t as discordPlugin } from "./channel-DTBEGHsT.js";
2
2
  export { discordPlugin };
@@ -1,8 +1,8 @@
1
1
  import { n as resolveDiscordToken } from "./token-BZtonk7d.js";
2
2
  import { a as mergeDiscordAccountConfig, c as resolveDiscordAccountAllowFrom, l as resolveDiscordAccountConfig, o as resolveDefaultDiscordAccountId } from "./accounts-CaHGiVB4.js";
3
- import { r as discordSetupAdapter, t as createDiscordPluginBase } from "./shared-BEW4H3bj.js";
4
- import { t as resolveDiscordChannelAllowlist } from "./resolve-channels-kyuvrXJg.js";
5
- import { t as resolveDiscordUserAllowlist } from "./resolve-users-CAwh4EBq.js";
3
+ import { r as discordSetupAdapter, t as createDiscordPluginBase } from "./shared-CBsrEG5q.js";
4
+ import { t as resolveDiscordChannelAllowlist } from "./resolve-channels-D9Dubj_y.js";
5
+ import { t as resolveDiscordUserAllowlist } from "./resolve-users-DlzKsLQe.js";
6
6
  import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "openclaw/plugin-sdk/account-id";
7
7
  import { hasConfiguredSecretInput, normalizeSecretInputString } from "openclaw/plugin-sdk/secret-input";
8
8
  import { normalizeOptionalString } from "openclaw/plugin-sdk/text-runtime";
@@ -0,0 +1,179 @@
1
+ import { chunkMarkdownTextWithMode } from "openclaw/plugin-sdk/reply-chunking";
2
+ //#region extensions/discord/src/chunk.ts
3
+ const DEFAULT_MAX_CHARS = 2e3;
4
+ const DEFAULT_MAX_LINES = 17;
5
+ const FENCE_RE = /^( {0,3})(`{3,}|~{3,})(.*)$/;
6
+ const CJK_PUNCTUATION_BREAK_AFTER_RE = /[、。,.!?;:)]}〉》」』】〕〗〙]/u;
7
+ function countLines(text) {
8
+ if (!text) return 0;
9
+ return text.split("\n").length;
10
+ }
11
+ function parseFenceLine(line) {
12
+ const match = line.match(FENCE_RE);
13
+ if (!match) return null;
14
+ const indent = match[1] ?? "";
15
+ const marker = match[2] ?? "";
16
+ return {
17
+ indent,
18
+ markerChar: marker[0] ?? "`",
19
+ markerLen: marker.length,
20
+ openLine: line
21
+ };
22
+ }
23
+ function closeFenceLine(openFence) {
24
+ return `${openFence.indent}${openFence.markerChar.repeat(openFence.markerLen)}`;
25
+ }
26
+ function closeFenceIfNeeded(text, openFence) {
27
+ if (!openFence) return text;
28
+ const closeLine = closeFenceLine(openFence);
29
+ if (!text) return closeLine;
30
+ if (!text.endsWith("\n")) return `${text}\n${closeLine}`;
31
+ return `${text}${closeLine}`;
32
+ }
33
+ function isHighSurrogate(code) {
34
+ return code >= 55296 && code <= 56319;
35
+ }
36
+ function isLowSurrogate(code) {
37
+ return code >= 56320 && code <= 57343;
38
+ }
39
+ function clampToCodePointBoundary(text, index) {
40
+ const boundary = Math.min(Math.max(0, index), text.length);
41
+ if (boundary <= 0 || boundary >= text.length) return boundary;
42
+ const previous = text.charCodeAt(boundary - 1);
43
+ const next = text.charCodeAt(boundary);
44
+ if (isHighSurrogate(previous) && isLowSurrogate(next)) return boundary > 1 ? boundary - 1 : boundary + 1;
45
+ return boundary;
46
+ }
47
+ function findWhitespaceBreak(window) {
48
+ for (let i = window.length - 1; i >= 0; i--) if (/\s/.test(window[i])) return i;
49
+ return -1;
50
+ }
51
+ function findCjkPunctuationBreak(window) {
52
+ for (let end = window.length; end > 0;) {
53
+ const start = isLowSurrogate(window.charCodeAt(end - 1)) && end > 1 ? end - 2 : end - 1;
54
+ const char = window.slice(start, end);
55
+ if (start > 0 && CJK_PUNCTUATION_BREAK_AFTER_RE.test(char)) return end;
56
+ end = start;
57
+ }
58
+ return -1;
59
+ }
60
+ function splitLongLine(line, maxChars, opts) {
61
+ const limit = Math.max(1, Math.floor(maxChars));
62
+ if (line.length <= limit) return [line];
63
+ const out = [];
64
+ let remaining = line;
65
+ while (remaining.length > limit) {
66
+ if (opts.preserveWhitespace) {
67
+ const breakIdx = clampToCodePointBoundary(remaining, limit);
68
+ out.push(remaining.slice(0, breakIdx));
69
+ remaining = remaining.slice(breakIdx);
70
+ continue;
71
+ }
72
+ const window = remaining.slice(0, limit);
73
+ let breakIdx = findWhitespaceBreak(window);
74
+ if (breakIdx <= 0) breakIdx = findCjkPunctuationBreak(window);
75
+ if (breakIdx <= 0) breakIdx = clampToCodePointBoundary(remaining, limit);
76
+ out.push(remaining.slice(0, breakIdx));
77
+ remaining = remaining.slice(breakIdx);
78
+ }
79
+ if (remaining.length) out.push(remaining);
80
+ return out;
81
+ }
82
+ /**
83
+ * Chunks outbound Discord text by both character count and (soft) line count,
84
+ * while keeping fenced code blocks balanced across chunks.
85
+ */
86
+ function chunkDiscordText(text, opts = {}) {
87
+ const maxChars = Math.max(1, Math.floor(opts.maxChars ?? DEFAULT_MAX_CHARS));
88
+ const maxLines = Math.max(1, Math.floor(opts.maxLines ?? DEFAULT_MAX_LINES));
89
+ const body = text ?? "";
90
+ if (!body) return [];
91
+ if (body.length <= maxChars && countLines(body) <= maxLines) return [body];
92
+ const lines = body.split("\n");
93
+ const chunks = [];
94
+ let current = "";
95
+ let currentLines = 0;
96
+ let openFence = null;
97
+ const flush = () => {
98
+ if (!current) return;
99
+ const payload = closeFenceIfNeeded(current, openFence);
100
+ if (payload.trim().length) chunks.push(payload);
101
+ current = "";
102
+ currentLines = 0;
103
+ if (openFence) {
104
+ current = openFence.openLine;
105
+ currentLines = 1;
106
+ }
107
+ };
108
+ for (const originalLine of lines) {
109
+ const fenceInfo = parseFenceLine(originalLine);
110
+ const wasInsideFence = openFence !== null;
111
+ let nextOpenFence = openFence;
112
+ if (fenceInfo) {
113
+ if (!openFence) nextOpenFence = fenceInfo;
114
+ else if (openFence.markerChar === fenceInfo.markerChar && fenceInfo.markerLen >= openFence.markerLen) nextOpenFence = null;
115
+ }
116
+ const reserveChars = nextOpenFence ? closeFenceLine(nextOpenFence).length + 1 : 0;
117
+ const reserveLines = nextOpenFence ? 1 : 0;
118
+ const effectiveMaxChars = maxChars - reserveChars;
119
+ const effectiveMaxLines = maxLines - reserveLines;
120
+ const charLimit = effectiveMaxChars > 0 ? effectiveMaxChars : maxChars;
121
+ const lineLimit = effectiveMaxLines > 0 ? effectiveMaxLines : maxLines;
122
+ const prefixLen = current.length > 0 ? current.length + 1 : 0;
123
+ const segments = splitLongLine(originalLine, Math.max(1, charLimit - prefixLen), { preserveWhitespace: wasInsideFence });
124
+ for (let segIndex = 0; segIndex < segments.length; segIndex++) {
125
+ const segment = segments[segIndex];
126
+ const isLineContinuation = segIndex > 0;
127
+ const addition = `${isLineContinuation ? "" : current.length > 0 ? "\n" : ""}${segment}`;
128
+ const nextLen = current.length + addition.length;
129
+ const nextLines = currentLines + (isLineContinuation ? 0 : 1);
130
+ if ((nextLen > charLimit || nextLines > lineLimit) && current.length > 0) flush();
131
+ if (current.length > 0) {
132
+ current += addition;
133
+ if (!isLineContinuation) currentLines += 1;
134
+ } else {
135
+ current = segment;
136
+ currentLines = 1;
137
+ }
138
+ }
139
+ openFence = nextOpenFence;
140
+ }
141
+ if (current.length) {
142
+ const payload = closeFenceIfNeeded(current, openFence);
143
+ if (payload.trim().length) chunks.push(payload);
144
+ }
145
+ return rebalanceReasoningItalics(text, chunks);
146
+ }
147
+ function chunkDiscordTextWithMode(text, opts) {
148
+ if ((opts.chunkMode ?? "length") !== "newline") return chunkDiscordText(text, opts);
149
+ const lineChunks = chunkMarkdownTextWithMode(text, Math.max(1, Math.floor(opts.maxChars ?? DEFAULT_MAX_CHARS)), "newline");
150
+ const chunks = [];
151
+ for (const line of lineChunks) {
152
+ const nested = chunkDiscordText(line, opts);
153
+ if (!nested.length && line) {
154
+ chunks.push(line);
155
+ continue;
156
+ }
157
+ chunks.push(...nested);
158
+ }
159
+ return chunks;
160
+ }
161
+ function rebalanceReasoningItalics(source, chunks) {
162
+ if (chunks.length <= 1) return chunks;
163
+ if (!(source.startsWith("Reasoning:\n_") && source.trimEnd().endsWith("_"))) return chunks;
164
+ const adjusted = [...chunks];
165
+ for (let i = 0; i < adjusted.length; i++) {
166
+ const isLast = i === adjusted.length - 1;
167
+ const current = adjusted[i];
168
+ if (!current.trimEnd().endsWith("_")) adjusted[i] = `${current}_`;
169
+ if (isLast) break;
170
+ const next = adjusted[i + 1];
171
+ const leadingWhitespaceLen = next.length - next.trimStart().length;
172
+ const leadingWhitespace = next.slice(0, leadingWhitespaceLen);
173
+ const nextBody = next.slice(leadingWhitespaceLen);
174
+ if (!nextBody.startsWith("_")) adjusted[i + 1] = `${leadingWhitespace}_${nextBody}`;
175
+ }
176
+ return adjusted;
177
+ }
178
+ //#endregion
179
+ export { chunkDiscordTextWithMode as t };
@@ -1,6 +1,5 @@
1
- import { t as __exportAll } from "./rolldown-runtime-C3SqQTfK.js";
2
- import { A as Button, B as Separator, D as Modal, E as Label, F as MediaGallery, H as TextDisplay, I as MentionableSelectMenu, K as parseCustomId, L as RoleSelectMenu, M as Container, N as File, O as RadioGroup, P as LinkButton, R as Row, T as CheckboxGroup, U as Thumbnail, V as StringSelectMenu, W as UserSelectMenu, j as ChannelSelectMenu, k as TextInput, z as Section } from "./discord-eZlimVfW.js";
3
- import { t as buildDiscordInteractiveComponents } from "./shared-interactive-KgJjCqnB.js";
1
+ import { A as Button, B as Separator, D as Modal, E as Label, F as MediaGallery, H as TextDisplay, I as MentionableSelectMenu, K as parseCustomId, L as RoleSelectMenu, M as Container, N as File, O as RadioGroup, P as LinkButton, Pt as __exportAll, R as Row, T as CheckboxGroup, U as Thumbnail, V as StringSelectMenu, W as UserSelectMenu, j as ChannelSelectMenu, k as TextInput, z as Section } from "./discord-DtHMmZqJ.js";
2
+ import { t as buildDiscordInteractiveComponents } from "./shared-interactive-D39V9Wtn.js";
4
3
  import { normalizeLowercaseStringOrEmpty } from "openclaw/plugin-sdk/text-runtime";
5
4
  import { ButtonStyle, MessageFlags, TextInputStyle } from "discord-api-types/v10";
6
5
  import crypto from "node:crypto";
@@ -180,7 +180,52 @@ const DiscordChannelConfigSchema = buildChannelConfigSchema(DiscordConfigSchema,
180
180
  },
181
181
  "voice.model": {
182
182
  label: "Discord Voice Model",
183
- help: "Optional LLM model override for Discord voice channel responses (for example openai/gpt-5.4-mini). Leave unset to inherit the routed agent model."
183
+ help: "Optional LLM model override for Discord voice channel responses and realtime agent consults (for example openai-codex/gpt-5.5). Leave unset to inherit the routed agent model."
184
+ },
185
+ "voice.mode": {
186
+ label: "Discord Voice Mode",
187
+ help: "Conversation mode: agent-proxy (default) uses realtime voice as the microphone/speaker for the routed OpenClaw agent, stt-tts uses batch speech-to-text plus TTS, and bidi lets the realtime provider converse directly with the OpenClaw consult tool."
188
+ },
189
+ "voice.agentSession": {
190
+ label: "Discord Voice Agent Session",
191
+ help: "Controls which OpenClaw conversation receives voice turns. Leave unset for the voice channel session, or set mode=\"target\" with a Discord target such as channel:123 to make voice an extension of an existing text channel session."
192
+ },
193
+ "voice.agentSession.target": {
194
+ label: "Discord Voice Agent Session Target",
195
+ help: "Discord target used when voice.agentSession.mode=\"target\", for example channel:123."
196
+ },
197
+ "voice.realtime.provider": {
198
+ label: "Discord Realtime Provider",
199
+ help: "Realtime voice provider for agent-proxy or bidi Discord voice modes, such as openai."
200
+ },
201
+ "voice.realtime.model": {
202
+ label: "Discord Realtime Model",
203
+ help: "Provider realtime session model, such as gpt-realtime-2. This is separate from voice.model, which remains the OpenClaw agent brain model."
204
+ },
205
+ "voice.realtime.voice": {
206
+ label: "Discord Realtime Voice",
207
+ help: "Provider realtime output voice, such as cedar."
208
+ },
209
+ "voice.realtime.toolPolicy": {
210
+ label: "Discord Realtime Tool Policy",
211
+ help: "Tool policy for the OpenClaw agent consult tool in realtime voice modes: safe-read-only, owner, or none. Default is owner for agent-proxy and safe-read-only for bidi."
212
+ },
213
+ "voice.realtime.consultPolicy": {
214
+ label: "Discord Realtime Consult Policy",
215
+ help: "Use always to strongly prefer the OpenClaw agent brain for substantive realtime turns. agent-proxy defaults to always."
216
+ },
217
+ "voice.realtime.bargeIn": {
218
+ label: "Discord Realtime Barge-In",
219
+ help: "Allow Discord speaker-start events to interrupt active realtime playback. Set true to keep manual interruption when provider input-audio interruption is disabled for echo control."
220
+ },
221
+ "voice.realtime.minBargeInAudioEndMs": {
222
+ label: "Discord Realtime Minimum Barge-In Audio (ms)",
223
+ help: "Minimum assistant playback duration before a Discord barge-in truncates realtime audio. Default: 250; set 0 for immediate interruption in low-echo rooms."
224
+ },
225
+ "voice.realtime.providers": {
226
+ label: "Discord Realtime Provider Settings",
227
+ help: "Provider-specific realtime voice settings keyed by provider id.",
228
+ advanced: true
184
229
  },
185
230
  "voice.autoJoin": {
186
231
  label: "Discord Voice Auto-Join",