@openclaw/discord 2026.8.1 → 2026.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) 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-Dl-TOyOX.js → activities-api-CkKcHUB6.js} +14 -13
  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 +17 -17
  10. package/dist/{approval-handler.runtime-q4Zqo44V.js → approval-handler.runtime-DZM6Kt1Z.js} +8 -7
  11. package/dist/{audit-DgrvFPGt.js → audit-DIbQA4VT.js} +8 -7
  12. package/dist/{channel-BsQUalPw.js → channel-CarzU3bg.js} +24 -22
  13. package/dist/{channel-actions.runtime-UMGGIfSy.js → channel-actions.runtime-B2wMqeVK.js} +13 -11
  14. package/dist/channel-config-api.js +1 -1
  15. package/dist/channel-plugin-api.js +1 -1
  16. package/dist/{channel.setup-rPs4dsk_.js → channel.setup-z_ewMVa9.js} +18 -18
  17. package/dist/{components-Dk35LTf_.js → components-gvRA0oaI.js} +1 -1
  18. package/dist/{config-schema-CxPqtVI1.js → config-schema-B797-Spt.js} +5 -4
  19. package/dist/{conversation-binding-route-BjvX4e35.js → conversation-binding-route-DPpBRpYI.js} +1 -1
  20. package/dist/{directory-config-B7DY_pNG.js → directory-config-AA8wQx0D.js} +2 -2
  21. package/dist/directory-contract-api.js +1 -1
  22. package/dist/{directory-live-DuAXKkan.js → directory-live-D_kFz_Fj.js} +4 -4
  23. package/dist/{doctor-zQTtn6hm.js → doctor-QQTOkBfW.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-DZewwLr1.js → handle-action.guild-admin-Cc88ZGon.js} +2 -2
  27. package/dist/index.js +1 -1
  28. package/dist/{ingress-identity-CzZKcPK8.js → ingress-identity-BCzfPPYM.js} +1 -1
  29. package/dist/{message-handler-C5By3yl5.js → message-handler-CAeEpqWo.js} +14 -10
  30. package/dist/{message-handler.preflight-DrszWuHw.js → message-handler.preflight-CoKoE3dY.js} +24 -19
  31. package/dist/{message-handler.process-DyFPDLCt.js → message-handler.process-cdIJ_fDT.js} +56 -74
  32. package/dist/{message-text-Ca8M6TU8.js → message-text-C0K4-fkg.js} +9 -4
  33. package/dist/{outbound-adapter-Dif8p481.js → outbound-adapter-Ch0At5Ra.js} +34 -24
  34. package/dist/{outbound-components-wjv7yyAj.js → outbound-components-Bnt_7x7r.js} +3 -3
  35. package/dist/{outbound-session-route-Bn4uXaoE.js → outbound-session-route-CzzerX2K.js} +10 -7
  36. package/dist/{owner-access-UlYi9t0M.js → owner-access-yc1sX7Gx.js} +7 -6
  37. package/dist/{pluralkit-9EuEN4UD.js → pluralkit-B3cUVI7i.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-LXiOcJrH.js → provider-CjI8BSzS.js} +97 -76
  41. package/dist/{provider-session.runtime-DSNe7r2W.js → provider-session.runtime-DdKRMcE9.js} +3 -3
  42. package/dist/provider.runtime-Bo1WbLLr.js +2 -0
  43. package/dist/{realtime-session.runtime-DOViOIjY.js → realtime-session.runtime-37IC-p5K.js} +5 -5
  44. package/dist/{resolve-allowlist-common-BLoYaxEG.js → resolve-allowlist-common-BJ5UZNNT.js} +3 -3
  45. package/dist/{resolve-channels-D2yl_2CN.js → resolve-channels-BexR2eUn.js} +4 -4
  46. package/dist/{resolve-users-BLxfqajZ.js → resolve-users-BtXBCH5W.js} +5 -4
  47. package/dist/{retry-after-DdLPmPoa.js → retry-after-BrLjLUJi.js} +2 -1
  48. package/dist/{retry-DqHCW6PV.js → retry-t5RcEsPk.js} +37 -29
  49. package/dist/{runtime-DrxVBTtp.js → runtime-BNlDfLwS.js} +2 -2
  50. package/dist/{runtime-BYamRVPN.js → runtime-DydyfxST.js} +126 -92
  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/{send-UJHiAm4C.js → send-mTKSBdmZ.js} +76 -48
  55. package/dist/{send.components-CrBJpGT_.js → send.components-nsPnc7kK.js} +20 -14
  56. package/dist/{send.outbound-D7JYmfm9.js → send.outbound-CaOs9Zy1.js} +34 -20
  57. package/dist/{send.shared-DZJ1akvQ.js → send.shared-BJHt0Vyf.js} +24 -17
  58. package/dist/{sender-identity-BJtfyise.js → sender-identity-Dt0imZyY.js} +1 -1
  59. package/dist/setup-plugin-api.js +1 -1
  60. package/dist/{shared-Dii2HTn7.js → shared-BNesVA4P.js} +17 -14
  61. package/dist/{subagent-hooks-JyGrtQIl.js → subagent-hooks-IeZVPLGj.js} +2 -2
  62. package/dist/subagent-hooks-api.js +1 -1
  63. package/dist/{system-events-BEmcj4xJ.js → system-events-Be5EJI3b.js} +2 -2
  64. package/dist/{target-resolver-V-IYae6s.js → target-resolver-C0MnwEki.js} +6 -5
  65. package/dist/targets-DQSye1Rv.js +3 -0
  66. package/dist/{thread-bindings-DvYP79fy.js → thread-bindings-wECUSIIG.js} +6 -5
  67. package/dist/{thread-bindings.manager-Clm77DBM.js → thread-bindings.manager-B-3UHCc1.js} +28 -25
  68. package/dist/{thread-bindings.session-updates-CJb-BpPL.js → thread-bindings.session-updates-CC7HoQvt.js} +2 -1
  69. package/dist/{threading-CXuu_7o9.js → threading-te5ADPQI.js} +8 -6
  70. package/dist/{timeouts-B9cy6RvQ.js → timeouts-D86uWLt_.js} +1 -1
  71. package/dist/{transcripts-source-BLEMH_yi.js → transcripts-source-DkUhR7YK.js} +3 -3
  72. package/dist/transcripts-source-api.js +1 -1
  73. package/dist/{typing-B9snnwMe.js → typing-DAwJF5VT.js} +2 -2
  74. package/dist/{voice-runtime-DY6_o73o.js → voice-runtime-COyYYTDD.js} +348 -14
  75. package/node_modules/@discord/embedded-app-sdk/node_modules/@types/lodash/README.md +1 -1
  76. package/node_modules/@discord/embedded-app-sdk/node_modules/@types/lodash/conforms.d.ts +2 -0
  77. package/node_modules/@discord/embedded-app-sdk/node_modules/@types/lodash/package.json +3 -3
  78. package/node_modules/@discord/embedded-app-sdk/node_modules/@types/lodash/stubArray.d.ts +2 -0
  79. package/node_modules/@discord/embedded-app-sdk/node_modules/@types/lodash/stubObject.d.ts +2 -0
  80. package/node_modules/@discord/embedded-app-sdk/node_modules/@types/lodash/stubString.d.ts +2 -0
  81. package/node_modules/typebox/build/format/email.mjs +1 -1
  82. package/node_modules/typebox/build/format/idna/idn-hostname.mjs +19 -1
  83. package/node_modules/typebox/package.json +1 -1
  84. package/openclaw.plugin.json +2 -2
  85. package/package.json +5 -5
  86. package/dist/account-inspect-BDfKyuvL.js +0 -89
  87. package/dist/provider.runtime-DiInaDXO.js +0 -2
  88. package/dist/sdk-runtime-6tfgYDjY.js +0 -338
  89. package/dist/targets-CQp53cGj.js +0 -3
@@ -1,23 +1,23 @@
1
- import { n as registerBuiltDiscordComponentMessage, r as sendDiscordComponentMessage, t as editDiscordComponentMessage } from "./send.components-CrBJpGT_.js";
1
+ import { n as registerBuiltDiscordComponentMessage, r as sendDiscordComponentMessage, t as editDiscordComponentMessage } from "./send.components-nsPnc7kK.js";
2
2
  import { r as setDiscordRuntime } from "./runtime-DgnVQ7zW.js";
3
- import { n as listDiscordDirectoryGroupsLive, r as listDiscordDirectoryPeersLive } from "./directory-live-DuAXKkan.js";
4
- import { _ as resolveDiscordShouldRequireMention, a as normalizeDiscordSlug, c as resolveDiscordChannelConfigWithFallback, f as resolveDiscordGuildEntry, n as isDiscordGroupAllowedByPolicy, r as normalizeDiscordAllowList, s as resolveDiscordChannelConfig, t as allowListMatches, u as resolveDiscordCommandAuthorized, v as resolveGroupDmAllow, y as shouldEmitDiscordReactionNotification } from "./allow-list-BDMimASD.js";
5
- import { C as hasAllGuildPermissionsDiscord, G as unregisterGateway, H as clearGateways, S as fetchMemberGuildPermissionsDiscord, T as hasAnyGuildPermissionDiscord, U as getGateway, W as registerGateway, _ as DiscordSendError, x as fetchChannelPermissionsDiscord } from "./send.shared-DZJ1akvQ.js";
6
- import { n as sendPollDiscord, r as sendStickerDiscord, t as sendMessageDiscord } from "./send.outbound-D7JYmfm9.js";
3
+ import { n as listDiscordDirectoryGroupsLive, r as listDiscordDirectoryPeersLive } from "./directory-live-D_kFz_Fj.js";
4
+ import { _ as resolveDiscordShouldRequireMention, a as normalizeDiscordSlug, c as resolveDiscordChannelConfigWithFallback, f as resolveDiscordGuildEntry, n as isDiscordGroupAllowedByPolicy, r as normalizeDiscordAllowList, s as resolveDiscordChannelConfig, t as allowListMatches, u as resolveDiscordCommandAuthorized, v as resolveGroupDmAllow, y as shouldEmitDiscordReactionNotification } from "./allow-list-C2JuH-R0.js";
5
+ import { C as hasAllGuildPermissionsDiscord, G as unregisterGateway, H as clearGateways, S as fetchMemberGuildPermissionsDiscord, T as hasAnyGuildPermissionDiscord, U as getGateway, W as registerGateway, _ as DiscordSendError, x as fetchChannelPermissionsDiscord } from "./send.shared-BJHt0Vyf.js";
6
+ import { n as sendPollDiscord, r as sendStickerDiscord, t as sendMessageDiscord } from "./send.outbound-CaOs9Zy1.js";
7
7
  import { i as setPresence, n as getPresence, r as presenceCacheSize, t as clearPresences } from "./presence-cache-z1N8MbJ3.js";
8
- import { A as listScheduledEventsDiscord, B as moveChannelDiscord, C as fetchChannelInfoDiscord, D as fetchVoiceStatusDiscord, E as fetchRoleInfoDiscord, F as uploadEmojiDiscord, H as setChannelPermissionDiscord, I as uploadStickerDiscord, L as createChannelDiscord, M as resolveEventCoverImage, N as timeoutMemberDiscord, O as kickMemberDiscord, P as listGuildEmojisDiscord, R as deleteChannelDiscord, S as createScheduledEventDiscord, T as fetchMemberInfoDiscord, V as removeChannelPermissionDiscord, _ as readMessagesDiscord, a as removeReactionDiscord, b as addRoleDiscord, c as sendWebhookMessageDiscord, d as deleteMessageDiscord, f as editMessageDiscord, g as pinMessageDiscord, h as listThreadsDiscord, i as removeOwnReactionsDiscord, j as removeRoleDiscord, k as listGuildChannelsDiscord, m as listPinsDiscord, n as fetchReactionsDiscord, o as sendTypingDiscord, p as fetchMessageDiscord, r as reactMessageDiscord, s as sendVoiceMessageDiscord, u as createThreadDiscord, v as searchMessagesDiscord, x as banMemberDiscord, y as unpinMessageDiscord, z as editChannelDiscord } from "./send-UJHiAm4C.js";
9
- import { a as isAbortError, i as DISCORD_DEFAULT_LISTENER_TIMEOUT_MS, l as runDiscordTaskWithTimeout, n as DISCORD_ATTACHMENT_TOTAL_TIMEOUT_MS, o as normalizeDiscordInboundWorkerTimeoutMs, r as DISCORD_DEFAULT_INBOUND_WORKER_TIMEOUT_MS, s as normalizeDiscordListenerTimeoutMs, t as DISCORD_ATTACHMENT_IDLE_TIMEOUT_MS } from "./timeouts-B9cy6RvQ.js";
10
- import { c as readDiscordChannelMoveParams, i as requiredGuildPermissionForModerationAction, l as readDiscordParentIdParam, n as isDiscordModerationAction, o as readDiscordChannelCreateParams, r as readDiscordModerationCommand, s as readDiscordChannelEditParams, t as handleDiscordAction } from "./runtime-BYamRVPN.js";
11
- import { p as discordMessageActions, t as resolveDiscordOutboundSessionRoute } from "./outbound-session-route-Bn4uXaoE.js";
8
+ import { A as listScheduledEventsDiscord, B as moveChannelDiscord, C as fetchChannelInfoDiscord, D as fetchVoiceStatusDiscord, E as fetchRoleInfoDiscord, F as uploadEmojiDiscord, H as setChannelPermissionDiscord, I as uploadStickerDiscord, L as createChannelDiscord, M as resolveEventCoverImage, N as timeoutMemberDiscord, O as kickMemberDiscord, P as listGuildEmojisDiscord, R as deleteChannelDiscord, S as createScheduledEventDiscord, T as fetchMemberInfoDiscord, V as removeChannelPermissionDiscord, _ as readMessagesDiscord, a as removeReactionDiscord, b as addRoleDiscord, c as sendWebhookMessageDiscord, d as deleteMessageDiscord, f as editMessageDiscord, g as pinMessageDiscord, h as listThreadsDiscord, i as removeOwnReactionsDiscord, j as removeRoleDiscord, k as listGuildChannelsDiscord, m as listPinsDiscord, n as fetchReactionsDiscord, o as sendTypingDiscord, p as fetchMessageDiscord, r as reactMessageDiscord, s as sendVoiceMessageDiscord, u as createThreadDiscord, v as searchMessagesDiscord, x as banMemberDiscord, y as unpinMessageDiscord, z as editChannelDiscord } from "./send-mTKSBdmZ.js";
9
+ import { a as isAbortError, i as DISCORD_DEFAULT_LISTENER_TIMEOUT_MS, l as runDiscordTaskWithTimeout, n as DISCORD_ATTACHMENT_TOTAL_TIMEOUT_MS, o as normalizeDiscordInboundWorkerTimeoutMs, r as DISCORD_DEFAULT_INBOUND_WORKER_TIMEOUT_MS, s as normalizeDiscordListenerTimeoutMs, t as DISCORD_ATTACHMENT_IDLE_TIMEOUT_MS } from "./timeouts-D86uWLt_.js";
10
+ import { c as readDiscordChannelMoveParams, i as requiredGuildPermissionForModerationAction, l as readDiscordParentIdParam, n as isDiscordModerationAction, o as readDiscordChannelCreateParams, r as readDiscordModerationCommand, s as readDiscordChannelEditParams, t as handleDiscordAction } from "./runtime-DydyfxST.js";
11
+ import { p as discordMessageActions, t as resolveDiscordOutboundSessionRoute } from "./outbound-session-route-CzzerX2K.js";
12
12
  import { C as resolveThreadBindingMaxAgeExpiresAt, S as resolveThreadBindingInactivityExpiresAt, w as resolveThreadBindingMaxAgeMs, x as resolveThreadBindingIdleTimeoutMs } from "./thread-bindings.state-D8OMdk4O.js";
13
- import { n as setThreadBindingMaxAgeBySessionKey, t as setThreadBindingIdleTimeoutBySessionKey } from "./thread-bindings.session-updates-CJb-BpPL.js";
14
- import { t as resolveDiscordChannelAllowlist } from "./resolve-channels-D2yl_2CN.js";
15
- import { t as resolveDiscordUserAllowlist } from "./resolve-users-BLxfqajZ.js";
16
- import { _ as resolveThreadBindingThreadName, g as resolveThreadBindingIntroText, h as formatThreadBindingDurationLabel, m as resolveThreadBindingPersonaFromRecord, n as createThreadBindingManager, p as resolveThreadBindingPersona, r as getThreadBindingManager, t as createNoopThreadBindingManager } from "./thread-bindings.manager-Clm77DBM.js";
17
- import { a as reconcileAcpThreadBindingsOnStartup, c as resolveDiscordThreadBindingMaxAgeMs, i as listThreadBindingsForAccount, l as resolveThreadBindingsEnabled, n as autoBindSpawnedDiscordSubagent, o as unbindThreadBindingsBySessionKey, r as listThreadBindingsBySessionKey, s as resolveDiscordThreadBindingIdleTimeoutMs } from "./thread-bindings-DvYP79fy.js";
18
- import { i as probeDiscord, n as fetchDiscordApplicationSummary, o as resolveDiscordPrivilegedIntentsFromFlags, r as parseApplicationIdFromToken, t as fetchDiscordApplicationId } from "./probe-n6ZXxK8V.js";
19
- import { r as collectDiscordAuditChannelIds, t as auditDiscordChannelPermissions } from "./audit-DgrvFPGt.js";
20
- import { d as resolveDiscordGatewayIntents, f as waitForDiscordGatewayPluginRegistration, p as createDiscordNativeCommand, t as monitorDiscordProvider, u as createDiscordGatewayPlugin, y as registerDiscordListener } from "./provider-LXiOcJrH.js";
21
- import { o as sanitizeDiscordThreadName, r as resolveDiscordReplyTarget } from "./threading-CXuu_7o9.js";
22
- import { t as createDiscordMessageHandler } from "./message-handler-C5By3yl5.js";
13
+ import { n as setThreadBindingMaxAgeBySessionKey, t as setThreadBindingIdleTimeoutBySessionKey } from "./thread-bindings.session-updates-CC7HoQvt.js";
14
+ import { t as resolveDiscordChannelAllowlist } from "./resolve-channels-BexR2eUn.js";
15
+ import { t as resolveDiscordUserAllowlist } from "./resolve-users-BtXBCH5W.js";
16
+ import { _ as resolveThreadBindingThreadName, g as resolveThreadBindingIntroText, h as formatThreadBindingDurationLabel, m as resolveThreadBindingPersonaFromRecord, n as createThreadBindingManager, p as resolveThreadBindingPersona, r as getThreadBindingManager, t as createNoopThreadBindingManager } from "./thread-bindings.manager-B-3UHCc1.js";
17
+ import { a as reconcileAcpThreadBindingsOnStartup, c as resolveDiscordThreadBindingMaxAgeMs, i as listThreadBindingsForAccount, l as resolveThreadBindingsEnabled, n as autoBindSpawnedDiscordSubagent, o as unbindThreadBindingsBySessionKey, r as listThreadBindingsBySessionKey, s as resolveDiscordThreadBindingIdleTimeoutMs } from "./thread-bindings-wECUSIIG.js";
18
+ import { i as probeDiscord, n as fetchDiscordApplicationSummary, o as resolveDiscordPrivilegedIntentsFromFlags, r as parseApplicationIdFromToken, t as fetchDiscordApplicationId } from "./probe-3ovFAp3b.js";
19
+ import { r as collectDiscordAuditChannelIds, t as auditDiscordChannelPermissions } from "./audit-DIbQA4VT.js";
20
+ import { d as resolveDiscordGatewayIntents, f as waitForDiscordGatewayPluginRegistration, p as createDiscordNativeCommand, t as monitorDiscordProvider, u as createDiscordGatewayPlugin, y as registerDiscordListener } from "./provider-CjI8BSzS.js";
21
+ import { o as sanitizeDiscordThreadName, r as resolveDiscordReplyTarget } from "./threading-te5ADPQI.js";
22
+ import { t as createDiscordMessageHandler } from "./message-handler-CAeEpqWo.js";
23
23
  export { DISCORD_ATTACHMENT_IDLE_TIMEOUT_MS, DISCORD_ATTACHMENT_TOTAL_TIMEOUT_MS, DISCORD_DEFAULT_INBOUND_WORKER_TIMEOUT_MS, DISCORD_DEFAULT_LISTENER_TIMEOUT_MS, DiscordSendError, addRoleDiscord, allowListMatches, auditDiscordChannelPermissions, autoBindSpawnedDiscordSubagent, banMemberDiscord, clearGateways, clearPresences, collectDiscordAuditChannelIds, createChannelDiscord, createDiscordGatewayPlugin, createDiscordMessageHandler, createDiscordNativeCommand, createNoopThreadBindingManager, createScheduledEventDiscord, createThreadBindingManager, createThreadDiscord, deleteChannelDiscord, deleteMessageDiscord, discordMessageActions, editChannelDiscord, editDiscordComponentMessage, editMessageDiscord, fetchChannelInfoDiscord, fetchChannelPermissionsDiscord, fetchDiscordApplicationId, fetchDiscordApplicationSummary, fetchMemberGuildPermissionsDiscord, fetchMemberInfoDiscord, fetchMessageDiscord, fetchReactionsDiscord, fetchRoleInfoDiscord, fetchVoiceStatusDiscord, formatThreadBindingDurationLabel, getGateway, getPresence, getThreadBindingManager, handleDiscordAction, hasAllGuildPermissionsDiscord, hasAnyGuildPermissionDiscord, isAbortError, isDiscordGroupAllowedByPolicy, isDiscordModerationAction, kickMemberDiscord, listDiscordDirectoryGroupsLive, listDiscordDirectoryPeersLive, listGuildChannelsDiscord, listGuildEmojisDiscord, listPinsDiscord, listScheduledEventsDiscord, listThreadBindingsBySessionKey, listThreadBindingsForAccount, listThreadsDiscord, monitorDiscordProvider, moveChannelDiscord, normalizeDiscordAllowList, normalizeDiscordInboundWorkerTimeoutMs, normalizeDiscordListenerTimeoutMs, normalizeDiscordSlug, parseApplicationIdFromToken, pinMessageDiscord, presenceCacheSize, probeDiscord, reactMessageDiscord, readDiscordChannelCreateParams, readDiscordChannelEditParams, readDiscordChannelMoveParams, readDiscordModerationCommand, readDiscordParentIdParam, readMessagesDiscord, reconcileAcpThreadBindingsOnStartup, registerBuiltDiscordComponentMessage, registerDiscordListener, registerGateway, removeChannelPermissionDiscord, removeOwnReactionsDiscord, removeReactionDiscord, removeRoleDiscord, requiredGuildPermissionForModerationAction, resolveDiscordChannelAllowlist, resolveDiscordChannelConfig, resolveDiscordChannelConfigWithFallback, resolveDiscordCommandAuthorized, resolveDiscordGatewayIntents, resolveDiscordGuildEntry, resolveDiscordOutboundSessionRoute, resolveDiscordPrivilegedIntentsFromFlags, resolveDiscordReplyTarget, resolveDiscordShouldRequireMention, resolveDiscordThreadBindingIdleTimeoutMs, resolveDiscordThreadBindingMaxAgeMs, resolveDiscordUserAllowlist, resolveEventCoverImage, resolveGroupDmAllow, resolveThreadBindingIdleTimeoutMs, resolveThreadBindingInactivityExpiresAt, resolveThreadBindingIntroText, resolveThreadBindingMaxAgeExpiresAt, resolveThreadBindingMaxAgeMs, resolveThreadBindingPersona, resolveThreadBindingPersonaFromRecord, resolveThreadBindingThreadName, resolveThreadBindingsEnabled, runDiscordTaskWithTimeout, sanitizeDiscordThreadName, searchMessagesDiscord, sendDiscordComponentMessage, sendMessageDiscord, sendPollDiscord, sendStickerDiscord, sendTypingDiscord, sendVoiceMessageDiscord, sendWebhookMessageDiscord, setChannelPermissionDiscord, setDiscordRuntime, setPresence, setThreadBindingIdleTimeoutBySessionKey, setThreadBindingMaxAgeBySessionKey, shouldEmitDiscordReactionNotification, timeoutMemberDiscord, unbindThreadBindingsBySessionKey, unpinMessageDiscord, unregisterGateway, uploadEmojiDiscord, uploadStickerDiscord, waitForDiscordGatewayPluginRegistration };
@@ -3,7 +3,7 @@ import { collectNestedChannelFieldAssignments, collectSimpleChannelFieldAssignme
3
3
  import { collectNestedChannelTtsAssignments } from "openclaw/plugin-sdk/channel-secret-tts-runtime";
4
4
  //#region extensions/discord/src/secret-config-contract.ts
5
5
  function createVoiceProviderSecretTarget(params) {
6
- const path = `${params.scope === "account" ? "channels.discord.accounts.*" : "channels.discord"}.voice.${params.capability}.providers.*.apiKey`;
6
+ const path = `${params.scope === "account" ? "channels.discord.accounts.*" : "channels.discord"}.voice.${params.providerPath}.providers.*.apiKey`;
7
7
  return {
8
8
  id: path,
9
9
  targetType: path,
@@ -14,7 +14,7 @@ function createVoiceProviderSecretTarget(params) {
14
14
  includeInPlan: true,
15
15
  includeInConfigure: true,
16
16
  includeInAudit: true,
17
- providerIdPathSegmentIndex: params.scope === "account" ? 7 : 5
17
+ providerIdPathSegmentIndex: path.split(".").length - 2
18
18
  };
19
19
  }
20
20
  function discordRealtimeVoiceSecretOwnerId(accountId, providerId) {
@@ -47,11 +47,15 @@ const secretTargetRegistryEntries = [
47
47
  includeInAudit: true
48
48
  },
49
49
  createVoiceProviderSecretTarget({
50
- capability: "realtime",
50
+ providerPath: "realtime",
51
51
  scope: "account"
52
52
  }),
53
53
  createVoiceProviderSecretTarget({
54
- capability: "tts",
54
+ providerPath: "tts",
55
+ scope: "account"
56
+ }),
57
+ createVoiceProviderSecretTarget({
58
+ providerPath: "tts.personas.*",
55
59
  scope: "account"
56
60
  }),
57
61
  {
@@ -77,11 +81,15 @@ const secretTargetRegistryEntries = [
77
81
  includeInAudit: true
78
82
  },
79
83
  createVoiceProviderSecretTarget({
80
- capability: "realtime",
84
+ providerPath: "realtime",
85
+ scope: "channel"
86
+ }),
87
+ createVoiceProviderSecretTarget({
88
+ providerPath: "tts",
81
89
  scope: "channel"
82
90
  }),
83
91
  createVoiceProviderSecretTarget({
84
- capability: "tts",
92
+ providerPath: "tts.personas.*",
85
93
  scope: "channel"
86
94
  })
87
95
  ];
@@ -1,2 +1,2 @@
1
- import { r as secretTargetRegistryEntries, t as collectRuntimeConfigAssignments } from "./secret-config-contract-B3i6WxV5.js";
1
+ import { r as secretTargetRegistryEntries, t as collectRuntimeConfigAssignments } from "./secret-config-contract-DFu9hfU8.js";
2
2
  export { collectRuntimeConfigAssignments, secretTargetRegistryEntries };
@@ -1,8 +1,8 @@
1
- import { $t as listGuildRoles, At as getChannel, B as readRetryAfter, Bt as addGuildMemberRole, Ct as listMessageReactionUsers, Dt as deleteChannelMessage, Et as deleteChannel, F as DiscordError, Ft as listChannelPins, Gt as createGuildSticker, Ht as createGuildChannel, I as RateLimitError, It as pinChannelMessage, Jt as getGuildMember, Kt as deleteChannelPermission, L as isUnknownDiscordVoiceStateError, Lt as searchGuildMessages, Nt as listChannelArchivedThreads, Ot as editChannel, Pt as listChannelMessages, Qt as listGuildEmojis, R as readDiscordCode, Rt as sendChannelTyping, St as deleteOwnMessageReaction, Tt as createThread, Ut as createGuildEmoji, Vt as createGuildBan, Wt as createGuildScheduledEvent, Xt as listGuildActiveThreads, Yt as getGuildVoiceState, Zt as listGuildChannels, an as timeoutGuildMember, c as createDiscordSendResult, en as listGuildScheduledEvents, i as recordDiscordMessageCreateAmbiguity, in as removeGuildMemberRole, jt as getChannelMessage, kt as editChannelMessage, n as createDiscordRetryRunner, nn as putChannelPermission, on as __exportAll, qt as getGuild, rn as removeGuildMember, t as classifyDiscordDeliveryFailure, tn as moveGuildChannels, xt as createOwnMessageReaction, z as readDiscordMessage, zt as unpinChannelMessage } from "./retry-DqHCW6PV.js";
2
- import { t as parseDiscordRetryAfterBodySeconds } from "./retry-after-DdLPmPoa.js";
3
- import { C as hasAllGuildPermissionsDiscord, I as resolveDiscordClientAccountContext, K as parseAndResolveChannelRecipient, L as resolveDiscordRest, M as resolveDiscordSuppressEmbeds, N as createDiscordClient, O as createDiscordMessageNonce, R as DISCORD_REST_TIMEOUT_MS, S as fetchMemberGuildPermissionsDiscord, T as hasAnyGuildPermissionDiscord, _ as DiscordSendError, b as canViewDiscordGuildChannel, g as DISCORD_MAX_STICKER_BYTES, h as DISCORD_MAX_EVENT_COVER_BYTES, i as formatReactionEmoji, k as resolveDiscordMessageFlags, l as resolveChannelId, m as DISCORD_MAX_EMOJI_BYTES, n as buildDiscordTextChunks, o as normalizeEmojiName, p as sendDiscordText, r as buildReactionIdentifier, s as normalizeReactionEmoji, t as buildDiscordSendError, v as canManageGuildMemberRoleDiscord, w as hasAnyChannelPermissionDiscord, x as fetchChannelPermissionsDiscord, y as canManageGuildRoleDiscord } from "./send.shared-DZJ1akvQ.js";
4
- import { n as sendPollDiscord, o as rewriteDiscordKnownMentions, r as sendStickerDiscord, t as sendMessageDiscord } from "./send.outbound-D7JYmfm9.js";
5
- import { n as DISCORD_ATTACHMENT_TOTAL_TIMEOUT_MS } from "./timeouts-B9cy6RvQ.js";
1
+ import { $t as listGuildRoles, At as getChannel, B as readRetryAfter, Bt as addGuildMemberRole, Ct as listMessageReactionUsers, Dt as deleteChannelMessage, Et as deleteChannel, F as DiscordError, Ft as listChannelPins, Gt as createGuildSticker, Ht as createGuildChannel, I as RateLimitError, It as pinChannelMessage, Jt as getGuildMember, Kt as deleteChannelPermission, L as isUnknownDiscordVoiceStateError, Lt as searchGuildMessages, Nt as listChannelArchivedThreads, Ot as editChannel, Pt as listChannelMessages, Qt as listGuildEmojis, R as readDiscordCode, Rt as sendChannelTyping, St as deleteOwnMessageReaction, Tt as createThread, Ut as createGuildEmoji, Vt as createGuildBan, Wt as createGuildScheduledEvent, Xt as listGuildActiveThreads, Yt as getGuildVoiceState, Zt as listGuildChannels, an as timeoutGuildMember, c as createDiscordSendResult, en as listGuildScheduledEvents, i as recordDiscordMessageCreateAmbiguity, in as removeGuildMemberRole, jt as getChannelMessage, kt as editChannelMessage, n as createDiscordRetryRunner, nn as putChannelPermission, on as __exportAll, qt as getGuild, rn as removeGuildMember, t as classifyDiscordDeliveryFailure, tn as moveGuildChannels, xt as createOwnMessageReaction, z as readDiscordMessage, zt as unpinChannelMessage } from "./retry-t5RcEsPk.js";
2
+ import { t as parseDiscordRetryAfterBodySeconds } from "./retry-after-BrLjLUJi.js";
3
+ import { C as hasAllGuildPermissionsDiscord, I as resolveDiscordClientAccountContext, K as parseAndResolveChannelRecipient, L as resolveDiscordRest, M as resolveDiscordSuppressEmbeds, N as createDiscordClient, O as createDiscordMessageNonce, R as DISCORD_REST_TIMEOUT_MS, S as fetchMemberGuildPermissionsDiscord, T as hasAnyGuildPermissionDiscord, _ as DiscordSendError, b as canViewDiscordGuildChannel, g as DISCORD_MAX_STICKER_BYTES, h as DISCORD_MAX_EVENT_COVER_BYTES, i as formatReactionEmoji, k as resolveDiscordMessageFlags, l as resolveChannelId, m as DISCORD_MAX_EMOJI_BYTES, n as buildDiscordTextChunks, o as normalizeEmojiName, p as sendDiscordText, r as buildReactionIdentifier, s as normalizeReactionEmoji, t as buildDiscordSendError, v as canManageGuildMemberRoleDiscord, w as hasAnyChannelPermissionDiscord, x as fetchChannelPermissionsDiscord, y as canManageGuildRoleDiscord } from "./send.shared-BJHt0Vyf.js";
4
+ import { n as sendPollDiscord, o as rewriteDiscordKnownMentions, r as sendStickerDiscord, t as sendMessageDiscord } from "./send.outbound-CaOs9Zy1.js";
5
+ import { n as DISCORD_ATTACHMENT_TOTAL_TIMEOUT_MS } from "./timeouts-D86uWLt_.js";
6
6
  import fs from "node:fs/promises";
7
7
  import { ChannelType } from "discord-api-types/v10";
8
8
  import crypto from "node:crypto";
@@ -55,7 +55,8 @@ async function editChannelDiscord(payload, opts) {
55
55
  return await editChannel(rest, payload.channelId, { body });
56
56
  }
57
57
  async function deleteChannelDiscord(channelId, opts) {
58
- await deleteChannel(resolveDiscordRest(opts), channelId);
58
+ const rest = resolveDiscordRest(opts);
59
+ await deleteChannel(rest, channelId);
59
60
  return {
60
61
  ok: true,
61
62
  channelId
@@ -80,13 +81,15 @@ async function setChannelPermissionDiscord(payload, opts) {
80
81
  return { ok: true };
81
82
  }
82
83
  async function removeChannelPermissionDiscord(channelId, targetId, opts) {
83
- await deleteChannelPermission(resolveDiscordRest(opts), channelId, targetId);
84
+ const rest = resolveDiscordRest(opts);
85
+ await deleteChannelPermission(rest, channelId, targetId);
84
86
  return { ok: true };
85
87
  }
86
88
  //#endregion
87
89
  //#region extensions/discord/src/send.emojis-stickers.ts
88
90
  async function listGuildEmojisDiscord(guildId, opts) {
89
- return await listGuildEmojis(resolveDiscordRest(opts), guildId);
91
+ const rest = resolveDiscordRest(opts);
92
+ return await listGuildEmojis(rest, guildId);
90
93
  }
91
94
  async function uploadEmojiDiscord(payload, opts) {
92
95
  const rest = resolveDiscordRest(opts);
@@ -133,27 +136,34 @@ async function uploadStickerDiscord(payload, opts) {
133
136
  //#endregion
134
137
  //#region extensions/discord/src/send.guild.ts
135
138
  async function fetchMemberInfoDiscord(guildId, userId, opts) {
136
- return await getGuildMember(resolveDiscordRest(opts), guildId, userId);
139
+ const rest = resolveDiscordRest(opts);
140
+ return await getGuildMember(rest, guildId, userId);
137
141
  }
138
142
  async function fetchRoleInfoDiscord(guildId, opts) {
139
- return await listGuildRoles(resolveDiscordRest(opts), guildId);
143
+ const rest = resolveDiscordRest(opts);
144
+ return await listGuildRoles(rest, guildId);
140
145
  }
141
146
  async function addRoleDiscord(payload, opts) {
142
- await addGuildMemberRole(resolveDiscordRest(opts), payload.guildId, payload.userId, payload.roleId);
147
+ const rest = resolveDiscordRest(opts);
148
+ await addGuildMemberRole(rest, payload.guildId, payload.userId, payload.roleId);
143
149
  return { ok: true };
144
150
  }
145
151
  async function removeRoleDiscord(payload, opts) {
146
- await removeGuildMemberRole(resolveDiscordRest(opts), payload.guildId, payload.userId, payload.roleId);
152
+ const rest = resolveDiscordRest(opts);
153
+ await removeGuildMemberRole(rest, payload.guildId, payload.userId, payload.roleId);
147
154
  return { ok: true };
148
155
  }
149
156
  async function fetchChannelInfoDiscord(channelId, opts) {
150
- return await getChannel(resolveDiscordRest(opts), channelId);
157
+ const rest = resolveDiscordRest(opts);
158
+ return await getChannel(rest, channelId);
151
159
  }
152
160
  async function fetchGuildInfoDiscord(guildId, opts) {
153
- return await getGuild(resolveDiscordRest(opts), guildId);
161
+ const rest = resolveDiscordRest(opts);
162
+ return await getGuild(rest, guildId);
154
163
  }
155
164
  async function listGuildChannelsDiscord(guildId, opts) {
156
- return await listGuildChannels(resolveDiscordRest(opts), guildId);
165
+ const rest = resolveDiscordRest(opts);
166
+ return await listGuildChannels(rest, guildId);
157
167
  }
158
168
  async function fetchVoiceStatusDiscord(guildId, userId, opts) {
159
169
  const rest = resolveDiscordRest(opts);
@@ -172,7 +182,8 @@ async function fetchVoiceStatusDiscord(guildId, userId, opts) {
172
182
  }
173
183
  }
174
184
  async function listScheduledEventsDiscord(guildId, opts) {
175
- return await listGuildScheduledEvents(resolveDiscordRest(opts), guildId);
185
+ const rest = resolveDiscordRest(opts);
186
+ return await listGuildScheduledEvents(rest, guildId);
176
187
  }
177
188
  const ALLOWED_EVENT_COVER_TYPES = /* @__PURE__ */ new Set([
178
189
  "image/png",
@@ -187,13 +198,15 @@ async function resolveEventCoverImage(imageUrl, opts) {
187
198
  return `data:${contentType};base64,${media.buffer.toString("base64")}`;
188
199
  }
189
200
  async function createScheduledEventDiscord(guildId, payload, opts) {
190
- return await createGuildScheduledEvent(resolveDiscordRest(opts), guildId, payload);
201
+ const rest = resolveDiscordRest(opts);
202
+ return await createGuildScheduledEvent(rest, guildId, payload);
191
203
  }
192
204
  async function timeoutMemberDiscord(payload, opts) {
193
205
  const rest = resolveDiscordRest(opts);
194
206
  let until = payload.until;
195
207
  if (!until && payload.durationMinutes) {
196
- until = timestampMsToIsoString(resolveExpiresAtMsFromDurationMs(payload.durationMinutes * 60 * 1e3));
208
+ const ms = payload.durationMinutes * 60 * 1e3;
209
+ until = timestampMsToIsoString(resolveExpiresAtMsFromDurationMs(ms));
197
210
  if (!until) throw new Error("Discord timeout duration is outside the supported Date range");
198
211
  }
199
212
  return await timeoutGuildMember(rest, payload.guildId, payload.userId, {
@@ -202,7 +215,8 @@ async function timeoutMemberDiscord(payload, opts) {
202
215
  });
203
216
  }
204
217
  async function kickMemberDiscord(payload, opts) {
205
- await removeGuildMember(resolveDiscordRest(opts), payload.guildId, payload.userId, { headers: payload.reason ? { "X-Audit-Log-Reason": encodeURIComponent(payload.reason) } : void 0 });
218
+ const rest = resolveDiscordRest(opts);
219
+ await removeGuildMember(rest, payload.guildId, payload.userId, { headers: payload.reason ? { "X-Audit-Log-Reason": encodeURIComponent(payload.reason) } : void 0 });
206
220
  return { ok: true };
207
221
  }
208
222
  async function banMemberDiscord(payload, opts) {
@@ -265,28 +279,34 @@ async function readMessagesDiscord(channelId, query, opts) {
265
279
  return assertDiscordResponseArray(await listChannelMessages(rest, channelId, params), "message read");
266
280
  }
267
281
  async function fetchMessageDiscord(channelId, messageId, opts) {
268
- return await getChannelMessage(resolveDiscordRest(opts), channelId, messageId);
282
+ const rest = resolveDiscordRest(opts);
283
+ return await getChannelMessage(rest, channelId, messageId);
269
284
  }
270
285
  async function editMessageDiscord(channelId, messageId, payload, opts) {
271
- return await editChannelMessage(resolveDiscordRest(opts), channelId, messageId, { body: {
286
+ const rest = resolveDiscordRest(opts);
287
+ return await editChannelMessage(rest, channelId, messageId, { body: {
272
288
  content: payload.content,
273
289
  ...payload.flags !== void 0 ? { flags: payload.flags } : {}
274
290
  } });
275
291
  }
276
292
  async function deleteMessageDiscord(channelId, messageId, opts) {
277
- await deleteChannelMessage(resolveDiscordRest(opts), channelId, messageId);
293
+ const rest = resolveDiscordRest(opts);
294
+ await deleteChannelMessage(rest, channelId, messageId);
278
295
  return { ok: true };
279
296
  }
280
297
  async function pinMessageDiscord(channelId, messageId, opts) {
281
- await pinChannelMessage(resolveDiscordRest(opts), channelId, messageId);
298
+ const rest = resolveDiscordRest(opts);
299
+ await pinChannelMessage(rest, channelId, messageId);
282
300
  return { ok: true };
283
301
  }
284
302
  async function unpinMessageDiscord(channelId, messageId, opts) {
285
- await unpinChannelMessage(resolveDiscordRest(opts), channelId, messageId);
303
+ const rest = resolveDiscordRest(opts);
304
+ await unpinChannelMessage(rest, channelId, messageId);
286
305
  return { ok: true };
287
306
  }
288
307
  async function listPinsDiscord(channelId, opts) {
289
- return await listChannelPins(resolveDiscordRest(opts), channelId);
308
+ const rest = resolveDiscordRest(opts);
309
+ return await listChannelPins(rest, channelId);
290
310
  }
291
311
  async function createThreadDiscord(channelId, payload, opts) {
292
312
  const { rest, request } = createDiscordClient(opts);
@@ -299,7 +319,8 @@ async function createThreadDiscord(channelId, payload, opts) {
299
319
  const archiveDuration = payload.autoArchiveMinutes ?? resolveDefaultThreadAutoArchiveDuration(channel);
300
320
  if (archiveDuration !== void 0) body.auto_archive_duration = archiveDuration;
301
321
  const isForumLike = channel?.type === ChannelType.GuildForum || channel?.type === ChannelType.GuildMedia;
302
- const initialMessageChunks = buildDiscordTextChunks(isForumLike ? payload.content?.trim() ? payload.content : payload.name : payload.content?.trim() ? payload.content : "", { maxLinesPerMessage: DISCORD_THREAD_TRANSPORT_ONLY_MAX_LINES });
322
+ const initialMessageContent = isForumLike ? payload.content?.trim() ? payload.content : payload.name : payload.content?.trim() ? payload.content : "";
323
+ const initialMessageChunks = buildDiscordTextChunks(initialMessageContent, { maxLinesPerMessage: DISCORD_THREAD_TRANSPORT_ONLY_MAX_LINES });
303
324
  if (isForumLike) {
304
325
  body.message = { content: initialMessageChunks[0] ?? payload.name };
305
326
  if (payload.appliedTags?.length) body.applied_tags = payload.appliedTags;
@@ -381,7 +402,7 @@ async function searchMessagesDiscord(query, opts) {
381
402
  }
382
403
  //#endregion
383
404
  //#region extensions/discord/src/send.webhook.ts
384
- const DISCORD_WEBHOOK_ERROR_BODY_LIMIT_BYTES = 8 * 1024;
405
+ const DISCORD_WEBHOOK_ERROR_BODY_LIMIT_BYTES = 8192;
385
406
  const DISCORD_WEBHOOK_TIMEOUT_MS = DISCORD_REST_TIMEOUT_MS;
386
407
  function resolveWebhookExecutionUrl(params) {
387
408
  const baseUrl = new URL(`https://discord.com/api/v10/webhooks/${encodeURIComponent(params.webhookId)}/${encodeURIComponent(params.webhookToken)}`);
@@ -453,6 +474,7 @@ async function sendWebhookMessageDiscord(text, opts) {
453
474
  try {
454
475
  const response = await request(async () => {
455
476
  await opts.onPlatformSendDispatch?.();
477
+ opts.assertPlatformSendAuthorized?.();
456
478
  const attemptResponse = await (proxyFetch ?? fetch)(url, {
457
479
  method: "POST",
458
480
  headers: { "content-type": "application/json" },
@@ -515,7 +537,7 @@ async function sendWebhookMessageDiscord(text, opts) {
515
537
  const DISCORD_VOICE_MESSAGE_FLAG = 8192;
516
538
  const WAVEFORM_SAMPLES = 256;
517
539
  const DISCORD_OPUS_SAMPLE_RATE_HZ = 48e3;
518
- const DISCORD_VOICE_ERROR_BODY_LIMIT_BYTES = 8 * 1024;
540
+ const DISCORD_VOICE_ERROR_BODY_LIMIT_BYTES = 8192;
519
541
  const DISCORD_VOICE_UPLOAD_SSRF_POLICY = {
520
542
  allowRfc2544BenchmarkRange: true,
521
543
  allowIpv6UniqueLocalRange: true
@@ -539,7 +561,7 @@ function createRateLimitError(response, body) {
539
561
  */
540
562
  async function getAudioDuration(filePath) {
541
563
  try {
542
- const duration = parseStrictFiniteNumber(await runFfprobe([
564
+ const stdout = await runFfprobe([
543
565
  "-v",
544
566
  "error",
545
567
  "-show_entries",
@@ -547,7 +569,8 @@ async function getAudioDuration(filePath) {
547
569
  "-of",
548
570
  "csv=p=0",
549
571
  filePath
550
- ]));
572
+ ]);
573
+ const duration = parseStrictFiniteNumber(stdout);
551
574
  if (duration === void 0) throw new Error("Could not parse duration");
552
575
  return Math.round(duration * 100) / 100;
553
576
  } catch (err) {
@@ -635,7 +658,7 @@ async function ensureOggOpus(filePath) {
635
658
  const trimmed = filePath.trim();
636
659
  if (/^[a-z][a-z0-9+.-]*:\/\//i.test(trimmed)) throw new Error(`Voice message conversion requires a local file path; received a URL/protocol source: ${trimmed}`);
637
660
  if (normalizeLowercaseStringOrEmpty(path.extname(filePath)) === ".ogg") try {
638
- const { codec, sampleRateHz } = parseFfprobeCodecAndSampleRate(await runFfprobe([
661
+ const stdout = await runFfprobe([
639
662
  "-v",
640
663
  "error",
641
664
  "-select_streams",
@@ -645,7 +668,8 @@ async function ensureOggOpus(filePath) {
645
668
  "-of",
646
669
  "csv=p=0",
647
670
  filePath
648
- ]));
671
+ ]);
672
+ const { codec, sampleRateHz } = parseFfprobeCodecAndSampleRate(stdout);
649
673
  if (codec === "opus" && sampleRateHz === DISCORD_OPUS_SAMPLE_RATE_HZ) return {
650
674
  path: filePath,
651
675
  cleanup: false
@@ -708,20 +732,22 @@ async function createVoiceRequestError(response, fallbackMessage) {
708
732
  return new DiscordError(response, parsed ?? { message: fallbackMessage });
709
733
  }
710
734
  async function requestVoiceUploadUrl(params) {
711
- const { response: res, release } = await fetchWithSsrFGuard({
712
- url: `${params.rest.options?.baseUrl ?? "https://discord.com/api"}/channels/${params.channelId}/attachments`,
713
- init: {
714
- method: "POST",
715
- headers: {
716
- Authorization: `Bot ${params.botToken}`,
717
- "Content-Type": "application/json"
718
- },
719
- body: JSON.stringify({ files: [{
720
- filename: params.filename,
721
- file_size: params.fileSize,
722
- id: "0"
723
- }] })
735
+ const url = `${params.rest.options?.baseUrl ?? "https://discord.com/api"}/channels/${params.channelId}/attachments`;
736
+ const uploadUrlInit = {
737
+ method: "POST",
738
+ headers: {
739
+ Authorization: `Bot ${params.botToken}`,
740
+ "Content-Type": "application/json"
724
741
  },
742
+ body: JSON.stringify({ files: [{
743
+ filename: params.filename,
744
+ file_size: params.fileSize,
745
+ id: "0"
746
+ }] })
747
+ };
748
+ const { response: res, release } = await fetchWithSsrFGuard({
749
+ url,
750
+ init: uploadUrlInit,
725
751
  timeoutMs: params.rest.options.timeout,
726
752
  policy: DISCORD_VOICE_UPLOAD_SSRF_POLICY,
727
753
  auditContext: "discord.voice.upload-url"
@@ -760,7 +786,7 @@ async function uploadVoiceAttachment(params) {
760
786
  * 2. Upload the OGG file to the provided URL
761
787
  * 3. Send the message with flag 8192 and attachment metadata
762
788
  */
763
- async function sendDiscordVoiceMessage(rest, channelId, audioBuffer, metadata, replyTo, request, silent, token, onPlatformSendDispatch) {
789
+ async function sendDiscordVoiceMessage(rest, channelId, audioBuffer, metadata, replyTo, request, silent, token, onPlatformSendDispatch, assertPlatformSendAuthorized) {
764
790
  const filename = "voice-message.ogg";
765
791
  const fileSize = audioBuffer.byteLength;
766
792
  const botToken = token;
@@ -801,6 +827,7 @@ async function sendDiscordVoiceMessage(rest, channelId, audioBuffer, metadata, r
801
827
  try {
802
828
  return await request(async () => {
803
829
  await onPlatformSendDispatch?.();
830
+ assertPlatformSendAuthorized?.();
804
831
  try {
805
832
  return await rest.post(`/channels/${channelId}/messages`, { body: messagePayload });
806
833
  } catch (error) {
@@ -872,7 +899,7 @@ async function sendVoiceMessageDiscord(to, audioPath, opts) {
872
899
  oggCleanup = ogg.cleanup;
873
900
  const metadata = await getVoiceMessageMetadata(oggPath);
874
901
  const audioBuffer = await fs.readFile(oggPath);
875
- const result = await sendDiscordVoiceMessage(rest, channelId, audioBuffer, metadata, opts.reply?.messageId, request, opts.silent, token, opts.onPlatformSendDispatch);
902
+ const result = await sendDiscordVoiceMessage(rest, channelId, audioBuffer, metadata, opts.reply?.messageId, request, opts.silent, token, opts.onPlatformSendDispatch, opts.assertPlatformSendAuthorized);
876
903
  recordChannelActivity({
877
904
  channel: "discord",
878
905
  accountId: accountInfo.accountId,
@@ -896,7 +923,8 @@ async function sendVoiceMessageDiscord(to, audioPath, opts) {
896
923
  //#endregion
897
924
  //#region extensions/discord/src/send.typing.ts
898
925
  async function sendTypingDiscord(channelId, opts) {
899
- await sendChannelTyping(resolveDiscordRest(opts), channelId);
926
+ const rest = resolveDiscordRest(opts);
927
+ await sendChannelTyping(rest, channelId);
900
928
  return {
901
929
  ok: true,
902
930
  channelId
@@ -1,8 +1,8 @@
1
- import { c as createDiscordSendResult, kt as editChannelMessage, on as __exportAll, q as serializePayload, wt as createChannelMessage } from "./retry-DqHCW6PV.js";
2
- import { d as buildDiscordComponentMessage, f as buildDiscordComponentMessageFlags, g as resolveDiscordComponentAttachmentName } from "./components-Dk35LTf_.js";
1
+ import { c as createDiscordSendResult, kt as editChannelMessage, on as __exportAll, q as serializePayload, wt as createChannelMessage } from "./retry-t5RcEsPk.js";
2
+ import { d as buildDiscordComponentMessage, f as buildDiscordComponentMessageFlags, g as resolveDiscordComponentAttachmentName } from "./components-gvRA0oaI.js";
3
3
  import { n as getOptionalDiscordRuntime } from "./runtime-DgnVQ7zW.js";
4
- import { E as SUPPRESS_NOTIFICATIONS_FLAG, K as parseAndResolveChannelRecipient, N as createDiscordClient, O as createDiscordMessageNonce, l as resolveChannelId, t as buildDiscordSendError, u as resolveDiscordChannel } from "./send.shared-DZJ1akvQ.js";
5
- import { t as sendMessageDiscord } from "./send.outbound-D7JYmfm9.js";
4
+ import { E as SUPPRESS_NOTIFICATIONS_FLAG, K as parseAndResolveChannelRecipient, N as createDiscordClient, O as createDiscordMessageNonce, l as resolveChannelId, t as buildDiscordSendError, u as resolveDiscordChannel } from "./send.shared-BJHt0Vyf.js";
5
+ import { t as sendMessageDiscord } from "./send.outbound-CaOs9Zy1.js";
6
6
  import { ChannelType } from "discord-api-types/v10";
7
7
  import { asDateTimestampMs, isFutureDateTimestampMs, resolveDateTimestampMs, resolveExpiresAtMsFromDurationMs } from "openclaw/plugin-sdk/number-runtime";
8
8
  import { uniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
@@ -28,7 +28,7 @@ const discordComponentRegistryState = resolveGlobalSingleton(Symbol.for("opencla
28
28
  });
29
29
  //#endregion
30
30
  //#region extensions/discord/src/components-registry.ts
31
- const DEFAULT_COMPONENT_TTL_MS = 1800 * 1e3;
31
+ const DEFAULT_COMPONENT_TTL_MS = 18e5;
32
32
  const PERSISTENT_COMPONENT_NAMESPACE = "discord.components";
33
33
  const PERSISTENT_MODAL_NAMESPACE = "discord.modals";
34
34
  const PERSISTENT_COMPONENT_MAX_ENTRIES = 500;
@@ -371,7 +371,8 @@ async function buildDiscordComponentPayload(params) {
371
371
  contentType: media.contentType
372
372
  }];
373
373
  }
374
- const uniqueAttachmentNames = uniqueStrings(extractComponentAttachmentNames(spec));
374
+ const attachmentNames = extractComponentAttachmentNames(spec);
375
+ const uniqueAttachmentNames = uniqueStrings(attachmentNames);
375
376
  if (uniqueAttachmentNames.length > 1) throw new Error("Discord component attachments currently support a single file. Use media-gallery for multiple files.");
376
377
  const expectedAttachmentName = uniqueAttachmentNames[0];
377
378
  if (expectedAttachmentName && resolvedFileName && expectedAttachmentName !== resolvedFileName) throw new Error(`Component file block expects attachment "${expectedAttachmentName}", but the uploaded file is "${resolvedFileName}". Update components.blocks[].file or provide a matching filename.`);
@@ -384,14 +385,15 @@ async function buildDiscordComponentPayload(params) {
384
385
  });
385
386
  const flags = buildDiscordComponentMessageFlags(buildResult.components);
386
387
  const finalFlags = params.opts.silent ? (flags ?? 0) | SUPPRESS_NOTIFICATIONS_FLAG : flags ?? void 0;
388
+ const payload = {
389
+ components: buildResult.components,
390
+ allowed_mentions: params.opts.allowedMentions,
391
+ ...finalFlags ? { flags: finalFlags } : {},
392
+ ...files ? { files } : {}
393
+ };
387
394
  return {
388
395
  body: {
389
- ...serializePayload({
390
- components: buildResult.components,
391
- allowed_mentions: params.opts.allowedMentions,
392
- ...finalFlags ? { flags: finalFlags } : {},
393
- ...files ? { files } : {}
394
- }),
396
+ ...serializePayload(payload),
395
397
  ...messageReference ? { message_reference: messageReference } : {}
396
398
  },
397
399
  buildResult
@@ -417,6 +419,7 @@ async function sendDiscordComponentMessage(to, spec, opts) {
417
419
  chunkMode: opts.chunkMode,
418
420
  onDeliveryResult: opts.onDeliveryResult,
419
421
  onPlatformSendDispatch: opts.onPlatformSendDispatch,
422
+ assertPlatformSendAuthorized: opts.assertPlatformSendAuthorized,
420
423
  ...opts.suppressEmbeds === void 0 ? {} : { suppressEmbeds: opts.suppressEmbeds }
421
424
  });
422
425
  const cfg = requireRuntimeConfig(opts.cfg, "Discord component send");
@@ -424,7 +427,8 @@ async function sendDiscordComponentMessage(to, spec, opts) {
424
427
  ...opts,
425
428
  cfg
426
429
  });
427
- const { channelId } = await resolveChannelId(rest, await parseAndResolveChannelRecipient(to, cfg, accountInfo.accountId), request);
430
+ const recipient = await parseAndResolveChannelRecipient(to, cfg, accountInfo.accountId);
431
+ const { channelId } = await resolveChannelId(rest, recipient, request);
428
432
  const channel = await resolveDiscordChannel(rest, channelId);
429
433
  if (channel && DISCORD_FORUM_LIKE_TYPES.has(channel.type)) throw new Error("Discord components are not supported in forum-style channels");
430
434
  const { body: componentBody, buildResult } = await buildDiscordComponentPayload({
@@ -441,6 +445,7 @@ async function sendDiscordComponentMessage(to, spec, opts) {
441
445
  try {
442
446
  result = await request(async () => {
443
447
  await opts.onPlatformSendDispatch?.();
448
+ opts.assertPlatformSendAuthorized?.();
444
449
  return createChannelMessage(rest, channelId, { body });
445
450
  }, "components", { safety: "nonce-protected-create" });
446
451
  } catch (err) {
@@ -477,7 +482,8 @@ async function editDiscordComponentMessage(to, messageId, spec, opts) {
477
482
  ...opts,
478
483
  cfg
479
484
  });
480
- const { channelId } = await resolveChannelId(rest, await parseAndResolveChannelRecipient(to, cfg, accountInfo.accountId), request);
485
+ const recipient = await parseAndResolveChannelRecipient(to, cfg, accountInfo.accountId);
486
+ const { channelId } = await resolveChannelId(rest, recipient, request);
481
487
  const { body, buildResult } = await buildDiscordComponentPayload({
482
488
  spec,
483
489
  opts,