@openclaw/discord 2026.11.7 → 2026.11.10-beta.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 (124) hide show
  1. package/README.md +37 -0
  2. package/dist/.setup/{account-inspect-DGkdWwix.mjs → account-inspect-CSz5Qodj.mjs} +2 -3
  3. package/dist/.setup/{accounts-C_25wyxC.mjs → accounts-DtjvhJUj.mjs} +4 -8
  4. package/dist/.setup/{active-turn-thread-route-KvRTAVE3.mjs → active-turn-thread-route-DkPnk2x8.mjs} +1 -2
  5. package/dist/.setup/{allow-list-C3j0qLDp.mjs → allow-list-CkqpzPvP.mjs} +4 -8
  6. package/dist/.setup/{api-DYRggUgK.mjs → api-C4j_kC-2.mjs} +4 -6
  7. package/dist/.setup/{approval-handler.runtime-BN4W1r0o.mjs → approval-handler.runtime-DXzPFNvC.mjs} +10 -10
  8. package/dist/.setup/{approval-message-updates-DKsCfxSW.mjs → approval-message-updates-DqOXxPss.mjs} +3 -4
  9. package/dist/.setup/{audit-BL6EoUun.mjs → audit-B9vk3V2z.mjs} +6 -7
  10. package/dist/.setup/{channel-DdI2l55_.mjs → channel-CKffiPiV.mjs} +38 -41
  11. package/dist/.setup/{channel-access-9cyzozUP.mjs → channel-access-DhJhVrdZ.mjs} +1 -2
  12. package/dist/.setup/{channel.setup-kNWMxlgu.mjs → channel.setup-DmGdG9BH.mjs} +7 -10
  13. package/dist/.setup/{command-deploy-store-DFkBTViB.mjs → command-deploy-store-DPWiBMks.mjs} +1 -2
  14. package/dist/.setup/{command-owners-C7rUdqUX.mjs → command-owners-BzlhNBxA.mjs} +1 -2
  15. package/dist/.setup/{components-C1Phe3uw.mjs → components-GePlato3.mjs} +10 -16
  16. package/dist/.setup/{components.base-CiS0h_XP.mjs → components.base-C5sAPHe4.mjs} +1 -2
  17. package/dist/.setup/config-DDwcUaxT.mjs +20 -0
  18. package/dist/.setup/{config-schema-BNKN1cu5.mjs → config-schema-D3M1livr.mjs} +5 -7
  19. package/dist/.setup/{conversation-binding-route-K_jFbvi5.mjs → conversation-binding-route-CAaWWJdQ.mjs} +2 -3
  20. package/dist/.setup/conversation-fork-B6PiUuln.mjs +197 -0
  21. package/dist/.setup/{directory-config-Ble81PWH.mjs → directory-config-BXJuh9-J.mjs} +3 -4
  22. package/dist/.setup/{directory-live-CY2-qrHI.mjs → directory-live-B9UoQG9g.mjs} +9 -64
  23. package/dist/.setup/{discord-BRVFhk09.mjs → discord-cXPUdHQi.mjs} +98 -77
  24. package/dist/.setup/{doctor-RqH-6JB0.mjs → doctor-MTAWTgRa.mjs} +7 -8
  25. package/dist/.setup/{doctor-contract-Bwv8EuQ_.mjs → doctor-contract-Dstl3cMg.mjs} +2 -3
  26. package/dist/.setup/{endpoint-runtime-lf4DeLas.mjs → endpoint-runtime-BM3x-m6O.mjs} +1 -2
  27. package/dist/.setup/{guilds-BSnrns-F.mjs → guilds-DYBhgnfq.mjs} +3 -4
  28. package/dist/.setup/{handle-action-uD87h2FK.mjs → handle-action-El1ok7Ak.mjs} +13 -12
  29. package/dist/.setup/{handle-action.guild-admin-CqBx_3mG.mjs → handle-action.guild-admin-CxYfg02j.mjs} +7 -5
  30. package/dist/.setup/identity-link-B7KOBo_l.mjs +74 -0
  31. package/dist/.setup/{listeners-DnHLrLIN.mjs → listeners-DIyynRvV.mjs} +2 -3
  32. package/dist/.setup/{live-policy-config-y0Qy36X3.mjs → live-policy-config-DjIHWFla.mjs} +3 -5
  33. package/dist/.setup/{message-handler-CWL_u0X8.mjs → message-handler-DP3cAQCZ.mjs} +18 -17
  34. package/dist/.setup/{message-handler.preflight-83tpEdBG.mjs → message-handler.preflight-S5yc9UdR.mjs} +20 -27
  35. package/dist/.setup/{message-handler.preflight-pluralkit-Dhcx7Ifz.mjs → message-handler.preflight-pluralkit-BFntgVKc.mjs} +10 -14
  36. package/dist/.setup/{message-handler.process-BC-wNZwK.mjs → message-handler.process-bXE_4sq5.mjs} +56 -67
  37. package/dist/.setup/oauth-http-DdVyzSbo.mjs +40 -0
  38. package/dist/.setup/{outbound-payload-CK3_bDvK.mjs → outbound-payload-Dh6xCO6z.mjs} +18 -13
  39. package/dist/.setup/{outbound-session-route-Ay_DnOOl.mjs → outbound-session-route-G_fK5RAh.mjs} +22 -34
  40. package/dist/.setup/{output-activity-uBpMSX75.mjs → output-activity-CDgs2s3O.mjs} +1 -2
  41. package/dist/.setup/{pluralkit-B64dfq_j.mjs → pluralkit-DcXbHTpQ.mjs} +2 -3
  42. package/dist/.setup/{preflight-audio-C6QtD6HX.mjs → preflight-audio-r4BbaJxh.mjs} +1 -2
  43. package/dist/.setup/{presence-cache-Dq-3nH7R.mjs → presence-cache-B3xj3b0l.mjs} +1 -2
  44. package/dist/.setup/{probe-CbDJojNV.mjs → probe-CfGMZwFD.mjs} +5 -6
  45. package/dist/.setup/{provider-CRb3Myky.mjs → provider-BA4ysXXm.mjs} +200 -249
  46. package/dist/.setup/{provider-session.runtime-3cZpps3H.mjs → provider-session.runtime-Cr2oPicL.mjs} +3 -3
  47. package/dist/.setup/provider.runtime-D4BlQKDq.mjs +1 -0
  48. package/dist/.setup/{proxy-fetch-BzXwBAXt.mjs → proxy-fetch-B8cK6FLQ.mjs} +1 -2
  49. package/dist/.setup/{realtime-session.runtime-BRYpjS9P.mjs → realtime-session.runtime-DQvAKxj9.mjs} +15 -25
  50. package/dist/.setup/{receive-recovery-C3Ks4wAQ.mjs → receive-recovery-DV_v5ROf.mjs} +3 -6
  51. package/dist/.setup/{resolve-allowlist-common-B-S0wRIw.mjs → resolve-allowlist-common-CYdqBUgV.mjs} +3 -4
  52. package/dist/.setup/{resolve-channels-g16NM6Ho.mjs → resolve-channels-BNnyfCR8.mjs} +6 -7
  53. package/dist/.setup/{resolve-users-DAfOOXdy.mjs → resolve-users-CDMAGrzv.mjs} +5 -6
  54. package/dist/.setup/{rolldown-runtime-B4FMCO8f.mjs → rolldown-runtime-nwUcYXjP.mjs} +1 -2
  55. package/dist/.setup/{runtime--HZ9r3tF.mjs → runtime-CkeNX7ic.mjs} +59 -50
  56. package/dist/.setup/{runtime-BMgTyuwg.mjs → runtime-DSaHEGJd.mjs} +4 -24
  57. package/dist/.setup/{runtime-DgnVQ7zW.mjs → runtime-DcBvHOm1.mjs} +1 -2
  58. package/dist/.setup/{runtime-doctor-migrations-BPV-R4G9.mjs → runtime-doctor-migrations-BpV1jKk0.mjs} +5 -9
  59. package/dist/.setup/{secret-config-contract-B1kE4sDv.mjs → secret-config-contract-CP6teHec.mjs} +1 -2
  60. package/dist/.setup/{security-audit-BFT84Uny.mjs → security-audit-CTwisG7c.mjs} +3 -4
  61. package/dist/.setup/{security-contract-DNyyjTZZ.mjs → security-contract-D-o0iWDk.mjs} +1 -2
  62. package/dist/.setup/{security-doctor-nGgPm65L.mjs → security-doctor-4s7omTZd.mjs} +1 -2
  63. package/dist/.setup/{send-CtvwfZQ2.mjs → send-DKzwsZkm.mjs} +26 -31
  64. package/dist/.setup/{send.components-CtLtE0yD.mjs → send.components-CIZALYDP.mjs} +12 -14
  65. package/dist/.setup/{send.outbound-D58xXPgs.mjs → send.outbound-cQ4Ohmsc.mjs} +11 -16
  66. package/dist/.setup/send.permissions-BvH_Dr8p.mjs +369 -0
  67. package/dist/.setup/{send.receipt-DLOV4qx6.mjs → send.receipt-CZ7ks6g7.mjs} +64 -17
  68. package/dist/.setup/send.shared-D2lh737v.mjs +259 -0
  69. package/dist/.setup/{sender-identity-BbA7FNbr.mjs → sender-identity-Dt5ELjRN.mjs} +2 -3
  70. package/dist/.setup/{session-contract-BO5tlIdl.mjs → session-contract-Bq71MS78.mjs} +1 -2
  71. package/dist/.setup/{session-key-normalization-CCHGNSQw.mjs → session-key-normalization-Cfvze5hd.mjs} +1 -2
  72. package/dist/.setup/setup-plugin-api-BJt8tAAC.mjs +2 -0
  73. package/dist/.setup/{shared-Dv2DamaK.mjs → shared-Bf7ifHlc.mjs} +14 -17
  74. package/dist/.setup/{shared-interactive-DmzaoKOM.mjs → shared-interactive-DKBw4SNV.mjs} +7 -12
  75. package/dist/.setup/{subagent-hooks-yT45eTyz.mjs → subagent-hooks-CVmIOrAR.mjs} +4 -5
  76. package/dist/.setup/{system-events-Dlzp9Jcj.mjs → system-events-DB6p2H4l.mjs} +3 -4
  77. package/dist/.setup/{target-parsing-C-HyNxcE.mjs → target-parsing-BiuhcK9Q.mjs} +1 -2
  78. package/dist/.setup/{target-resolver-BzaZPBm9.mjs → target-resolver-48znkzky.mjs} +6 -7
  79. package/dist/.setup/{thread-binding-api-BDZJD4na.mjs → thread-binding-api-Drd4Zu-5.mjs} +1 -2
  80. package/dist/.setup/{thread-bindings-DRWhgKCc.mjs → thread-bindings-DTHVdmvF.mjs} +7 -10
  81. package/dist/.setup/{thread-bindings.manager-CWJKirn1.mjs → thread-bindings.manager-6EnH3YZh.mjs} +45 -30
  82. package/dist/.setup/{thread-bindings.session-updates-DzJrXc4w.mjs → thread-bindings.session-updates-BPO6pPzd.mjs} +9 -12
  83. package/dist/.setup/{threading-BbsPuT5G.mjs → threading-PC3IIaHd.mjs} +5 -7
  84. package/dist/.setup/{timeouts-cIxzatmv.mjs → timeouts-CT9hnmo4.mjs} +1 -2
  85. package/dist/.setup/{transcripts-source-DIW1fU_P.mjs → transcripts-source-C3F_ErM1.mjs} +20 -33
  86. package/dist/.setup/{typing-CNlSKY5S.mjs → typing-DAv4S2fI.mjs} +2 -3
  87. package/dist/.setup/{voice-runtime-oJ6BZs5D.mjs → voice-runtime-CZGbraKC.mjs} +28 -46
  88. package/dist/.source-module-urls/d6c089460280c5a04184542d6712e04545caeb1ebb290d3504377b4cc5e22fea.json +1 -1
  89. package/dist/account-inspect-api.js +2 -3
  90. package/dist/action-runtime-api.js +1 -1
  91. package/dist/activities-api.js +10 -50
  92. package/dist/api.js +21 -22
  93. package/dist/assets/embedded-app-sdk.mjs +1 -1
  94. package/dist/channel-config-api.js +1 -1
  95. package/dist/channel-plugin-api.js +1 -1
  96. package/dist/contract-api.js +1 -1
  97. package/dist/directory-contract-api.js +2 -3
  98. package/dist/doctor-contract-api.js +7 -8
  99. package/dist/index.js +1 -2
  100. package/dist/runtime-api.js +23 -22
  101. package/dist/runtime-setter-api.js +1 -1
  102. package/dist/secret-contract-api.js +1 -1
  103. package/dist/security-audit-contract-api.js +1 -1
  104. package/dist/security-contract-api.js +1 -1
  105. package/dist/session-key-api.js +1 -1
  106. package/dist/setup-entry.js +2 -3
  107. package/dist/setup-plugin-api.js +1 -1
  108. package/dist/src/voice/audio-worker.runtime.js +14 -26
  109. package/dist/subagent-hooks-api.js +2 -3
  110. package/dist/thread-binding-api.js +1 -1
  111. package/dist/transcripts-source-api.js +2 -3
  112. package/node_modules/@discord/embedded-app-sdk/output/lib/zod/lib/index.cjs +2 -3
  113. package/node_modules/@discord/embedded-app-sdk/output/lib/zod/lib/index.mjs +2 -3
  114. package/node_modules/@types/node/README.md +1 -1
  115. package/node_modules/@types/node/package.json +2 -2
  116. package/node_modules/@types/node/zlib.d.ts +752 -0
  117. package/node_modules/typebox/build/format/date_time.d.mts +2 -1
  118. package/node_modules/typebox/build/format/date_time.mjs +12 -3
  119. package/node_modules/typebox/package.json +1 -1
  120. package/openclaw.plugin.json +7 -2
  121. package/package.json +5 -5
  122. package/dist/.setup/provider.runtime-tmkt3QOg.mjs +0 -1
  123. package/dist/.setup/send.shared-B_KKRrD7.mjs +0 -589
  124. package/dist/.setup/setup-plugin-api-ty5RJrMy.mjs +0 -2
@@ -1,31 +1,31 @@
1
- import { g as resolveDiscordToken, h as normalizeDiscordToken, l as resolveDiscordAccount, m as resolveDiscordMaxLinesPerMessage, p as resolveDiscordAccountDmPolicy, s as mergeDiscordAccountConfig, u as resolveDiscordAccountAllowFrom } from "./accounts-C_25wyxC.mjs";
2
- import { B as unregisterGateway, C as hasAnyChannelPermissionDiscord, N as createDiscordRestClient, y as canViewDiscordGuildChannel, z as registerGateway } from "./send.shared-B_KKRrD7.mjs";
3
- import { B as RateLimitError, J as stripUndefinedFields, L as DISCORD_REST_TIMEOUT_MS, _ as Command, d as hasDiscordV2Components, g as User, h as Message, l as Client, m as Guild, n as GuildCreateListener, o as Modal, r as ReadyListener, t as discord_exports, u as asSerializableComponent, v as CommandWithSubcommands, z as DiscordError } from "./discord-BRVFhk09.mjs";
4
- import { S as formatDiscordUserTag, _ as resolveDiscordOwnerAllowFrom, a as normalizeDiscordDisplaySlug, b as shouldEmitDiscordReactionNotification, c as resolveDiscordChannelConfig, f as resolveDiscordGuildEntry, g as resolveDiscordOwnerAccess, i as normalizeDiscordAllowList, l as resolveDiscordChannelConfigWithFallback, m as resolveDiscordMemberAllowed, n as hasConfiguredDiscordChannels, o as normalizeDiscordSlug, p as resolveDiscordMemberAccessState, r as isDiscordGroupAllowedByPolicy, s as resolveDiscordAllowListMatch, u as resolveDiscordChannelPolicyCommandAuthorizer, w as isDiscordThreadChannelType, x as formatDiscordReactionEmoji, y as resolveGroupDmAllow } from "./allow-list-C3j0qLDp.mjs";
5
- import { v as chunkDiscordTextWithMode } from "./send.receipt-DLOV4qx6.mjs";
6
- import { n as getDiscordEndpointRuntime, t as assertDiscordEndpointGatewayUrl } from "./endpoint-runtime-lf4DeLas.mjs";
7
- import { n as validateDiscordProxyUrl, r as withValidatedDiscordProxy } from "./proxy-fetch-BzXwBAXt.mjs";
8
- import { a as isDiscordRateLimitResponseBody, s as summarizeDiscordResponseBody } from "./api-DYRggUgK.mjs";
9
- import { _ as readMessagesDiscord, s as sendVoiceMessageDiscord } from "./send-CtvwfZQ2.mjs";
10
- import { s as formatMention, t as sendMessageDiscord } from "./send.outbound-D58xXPgs.mjs";
11
- import { l as withAbortTimeout } from "./timeouts-cIxzatmv.mjs";
12
- import { r as setPresence, t as clearPresences } from "./presence-cache-Dq-3nH7R.mjs";
13
- import { _ as parseDiscordModalCustomId, a as DISCORD_APPROVAL_DECISIONS, b as encodeCustomIdComponent, g as parseDiscordComponentCustomIdForInteraction, h as parseDiscordComponentCustomId, i as parseDiscordQuestionData, m as parseDiscordActivityCustomIdForInteraction, s as parseExecApprovalData, u as buildDiscordActivityCustomId, v as parseDiscordModalCustomIdForInteraction, y as decodeCustomIdComponent } from "./shared-interactive-DmzaoKOM.mjs";
14
- import { a as buildDiscordComponentMessage } from "./components-C1Phe3uw.mjs";
15
- import { a as registerDiscordComponentEntries, o as resolveDiscordComponentEntryWithPersistence, s as resolveDiscordModalEntryWithPersistence, t as editDiscordComponentMessage } from "./send.components-CtLtE0yD.mjs";
16
- import { t as getDiscordRuntime } from "./runtime-DgnVQ7zW.mjs";
17
- import { n as getDiscordActivitiesRuntime } from "./runtime-BMgTyuwg.mjs";
18
- import { t as resolveDiscordCommandOwnerAllowFrom } from "./command-owners-C7rUdqUX.mjs";
19
- import { D as getDiscordExecApprovalApprovers, _ as resolveDiscordConversationIdentity, a as resolveDiscordComponentSpec, c as formatDiscordApprovalDisplayValue, d as setDiscordPolicyBindings, f as buildDiscordConversationRouteContext, h as resolveDiscordEffectiveRoute, k as isDiscordExecApprovalClientEnabled, m as resolveDiscordConversationRoute, n as DISCORD_PRESENTATION_CAPABILITIES, p as buildDiscordRoutePeer, r as buildDiscordPresentationPayload, s as DISCORD_APPROVAL_ALLOWED_MENTIONS, u as resolveDiscordGroupToolPolicy } from "./outbound-session-route-Ay_DnOOl.mjs";
20
- import { n as discordIngressIdentity, t as selectDiscordLivePolicyConfig } from "./live-policy-config-y0Qy36X3.mjs";
21
- import { t as resolveDiscordChannelAllowlist } from "./resolve-channels-g16NM6Ho.mjs";
22
- import { t as resolveDiscordUserAllowlist } from "./resolve-users-DAfOOXdy.mjs";
23
- import { a as isThreadArchived, n as getThreadBindingManager } from "./thread-bindings.manager-CWJKirn1.mjs";
24
- import { n as resolveDiscordChannelNameSafe, r as resolveDiscordChannelTopicSafe, t as resolveDiscordChannelInfoSafe } from "./channel-access-9cyzozUP.mjs";
25
- import { a as probeDiscordApplicationId, r as parseApplicationIdFromToken } from "./probe-CbDJojNV.mjs";
26
- import { O as resolveDiscordReferencedReplyMessage, a as resolveDiscordVoiceEnabled, i as setDiscordTranscriptsVoiceManager, k as resolveDiscordReferencedReplyMessageId, l as resolveDiscordThreadLikeChannelContext, o as authorizeDiscordVoiceIngress, s as resolveDiscordVoiceAccess, u as resolveFetchedDiscordThreadLikeChannelContext } from "./transcripts-source-DIW1fU_P.mjs";
27
- import { t as resolveDiscordSenderIdentity } from "./sender-identity-BbA7FNbr.mjs";
28
- import { n as hasDiscordApprovalControl, t as discordApprovalMessageUpdates } from "./approval-message-updates-DKsCfxSW.mjs";
1
+ import { g as resolveDiscordToken, h as normalizeDiscordToken, l as resolveDiscordAccount, m as resolveDiscordMaxLinesPerMessage, p as resolveDiscordAccountDmPolicy, s as mergeDiscordAccountConfig, u as resolveDiscordAccountAllowFrom } from "./accounts-DtjvhJUj.mjs";
2
+ import { _ as registerGateway, c as hasAnyChannelPermissionDiscord, d as createDiscordRestClient, r as canViewDiscordGuildChannel, v as unregisterGateway } from "./send.permissions-BvH_Dr8p.mjs";
3
+ import { B as RateLimitError, J as stripUndefinedFields, L as DISCORD_REST_TIMEOUT_MS, _ as Command, d as hasDiscordV2Components, g as User, h as Message, l as Client, m as Guild, n as GuildCreateListener, o as Modal, r as ReadyListener, t as discord_exports, u as asSerializableComponent, v as CommandWithSubcommands, z as DiscordError } from "./discord-cXPUdHQi.mjs";
4
+ import { S as formatDiscordUserTag, _ as resolveDiscordOwnerAllowFrom, a as normalizeDiscordDisplaySlug, b as shouldEmitDiscordReactionNotification, c as resolveDiscordChannelConfig, f as resolveDiscordGuildEntry, g as resolveDiscordOwnerAccess, i as normalizeDiscordAllowList, l as resolveDiscordChannelConfigWithFallback, m as resolveDiscordMemberAllowed, n as hasConfiguredDiscordChannels, o as normalizeDiscordSlug, p as resolveDiscordMemberAccessState, r as isDiscordGroupAllowedByPolicy, s as resolveDiscordAllowListMatch, u as resolveDiscordChannelPolicyCommandAuthorizer, w as isDiscordThreadChannelType, x as formatDiscordReactionEmoji, y as resolveGroupDmAllow } from "./allow-list-CkqpzPvP.mjs";
5
+ import { S as chunkDiscordTextWithMode } from "./send.receipt-CZ7ks6g7.mjs";
6
+ import { n as getDiscordEndpointRuntime, t as assertDiscordEndpointGatewayUrl } from "./endpoint-runtime-BM3x-m6O.mjs";
7
+ import { n as validateDiscordProxyUrl, r as withValidatedDiscordProxy } from "./proxy-fetch-B8cK6FLQ.mjs";
8
+ import { a as isDiscordRateLimitResponseBody, s as summarizeDiscordResponseBody } from "./api-C4j_kC-2.mjs";
9
+ import { _ as readMessagesDiscord, s as sendVoiceMessageDiscord } from "./send-DKzwsZkm.mjs";
10
+ import { s as formatMention, t as sendMessageDiscord } from "./send.outbound-cQ4Ohmsc.mjs";
11
+ import { l as withAbortTimeout } from "./timeouts-CT9hnmo4.mjs";
12
+ import { r as setPresence, t as clearPresences } from "./presence-cache-B3xj3b0l.mjs";
13
+ import { _ as parseDiscordModalCustomId, a as DISCORD_APPROVAL_DECISIONS, b as encodeCustomIdComponent, g as parseDiscordComponentCustomIdForInteraction, h as parseDiscordComponentCustomId, i as parseDiscordQuestionData, m as parseDiscordActivityCustomIdForInteraction, s as parseExecApprovalData, u as buildDiscordActivityCustomId, v as parseDiscordModalCustomIdForInteraction, y as decodeCustomIdComponent } from "./shared-interactive-DKBw4SNV.mjs";
14
+ import { a as buildDiscordComponentMessage } from "./components-GePlato3.mjs";
15
+ import { a as registerDiscordComponentEntries, o as resolveDiscordComponentEntryWithPersistence, s as resolveDiscordModalEntryWithPersistence, t as editDiscordComponentMessage } from "./send.components-CIZALYDP.mjs";
16
+ import { t as getDiscordRuntime } from "./runtime-DcBvHOm1.mjs";
17
+ import { n as getDiscordActivitiesRuntime } from "./runtime-DSaHEGJd.mjs";
18
+ import { t as resolveDiscordCommandOwnerAllowFrom } from "./command-owners-BzlhNBxA.mjs";
19
+ import { D as getDiscordExecApprovalApprovers, _ as resolveDiscordConversationIdentity, a as resolveDiscordComponentSpec, c as formatDiscordApprovalDisplayValue, d as setDiscordPolicyBindings, f as buildDiscordConversationRouteContext, h as resolveDiscordEffectiveRoute, k as isDiscordExecApprovalClientEnabled, m as resolveDiscordConversationRoute, n as DISCORD_PRESENTATION_CAPABILITIES, p as buildDiscordRoutePeer, r as buildDiscordPresentationPayload, s as DISCORD_APPROVAL_ALLOWED_MENTIONS, u as resolveDiscordGroupToolPolicy } from "./outbound-session-route-G_fK5RAh.mjs";
20
+ import { n as discordIngressIdentity, t as selectDiscordLivePolicyConfig } from "./live-policy-config-DjIHWFla.mjs";
21
+ import { t as resolveDiscordChannelAllowlist } from "./resolve-channels-BNnyfCR8.mjs";
22
+ import { t as resolveDiscordUserAllowlist } from "./resolve-users-CDMAGrzv.mjs";
23
+ import { a as isThreadArchived, n as getThreadBindingManager } from "./thread-bindings.manager-6EnH3YZh.mjs";
24
+ import { n as resolveDiscordChannelNameSafe, r as resolveDiscordChannelTopicSafe, t as resolveDiscordChannelInfoSafe } from "./channel-access-DhJhVrdZ.mjs";
25
+ import { a as probeDiscordApplicationId, r as parseApplicationIdFromToken } from "./probe-CfGMZwFD.mjs";
26
+ import { O as resolveDiscordReferencedReplyMessage, a as resolveDiscordVoiceEnabled, i as setDiscordTranscriptsVoiceManager, k as resolveDiscordReferencedReplyMessageId, l as resolveDiscordThreadLikeChannelContext, o as authorizeDiscordVoiceIngress, s as resolveDiscordVoiceAccess, u as resolveFetchedDiscordThreadLikeChannelContext } from "./transcripts-source-C3F_ErM1.mjs";
27
+ import { t as resolveDiscordSenderIdentity } from "./sender-identity-Dt5ELjRN.mjs";
28
+ import { n as hasDiscordApprovalControl, t as discordApprovalMessageUpdates } from "./approval-message-updates-DqOXxPss.mjs";
29
29
  import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
30
30
  import { PlatformMessageNotDispatchedError, formatErrorMessage, toErrorObject } from "openclaw/plugin-sdk/error-runtime";
31
31
  import { createNonExitingRuntime, createSubsystemLogger, danger, formatDurationSeconds, logVerbose, shouldLogVerbose, sleepWithAbort, warn } from "openclaw/plugin-sdk/runtime-env";
@@ -34,9 +34,9 @@ import { resolveAgentRoute } from "openclaw/plugin-sdk/routing";
34
34
  import { asFiniteNumber, asOptionalRecord, normalizeLowercaseStringOrEmpty, normalizeOptionalLowercaseString, normalizeOptionalString, normalizeStringEntries, parseFiniteNumber, readNonBlankString, summarizeStringEntries } from "openclaw/plugin-sdk/string-coerce-runtime";
35
35
  import { captureRuntimeConfigAsyncReader, createRuntimeConfigReader, getRuntimeConfigSnapshot } from "openclaw/plugin-sdk/runtime-config-snapshot";
36
36
  import { ApplicationCommandOptionType, ButtonStyle, ChannelType, ComponentType, GatewayCloseCodes, GatewayCloseCodes as GatewayCloseCodes$1, GatewayDispatchEvents, GatewayIntentBits, GatewayOpcodes, PermissionFlagsBits } from "discord-api-types/v10";
37
- import { buildOutboundMediaLoadOptions, getAgentScopedMediaLocalRoots } from "openclaw/plugin-sdk/media-runtime";
37
+ import { MediaFetchError, buildOutboundMediaLoadOptions, getAgentScopedMediaLocalRoots } from "openclaw/plugin-sdk/media-runtime";
38
38
  import { resolveOutboundMediaAccessForConfig } from "openclaw/plugin-sdk/outbound-media";
39
- import { hasOutboundReplyContent, resolveSendableOutboundReplyParts, resolveTextChunksWithFallback } from "openclaw/plugin-sdk/reply-payload";
39
+ import { appendReplyMediaFailures, hasOutboundReplyContent, resolveSendableOutboundReplyParts, resolveTextChunksWithFallback } from "openclaw/plugin-sdk/reply-payload";
40
40
  import { expectDefined } from "openclaw/plugin-sdk/expect-runtime";
41
41
  import { MAX_TIMER_TIMEOUT_MS, asDateTimestampMs, asSafeIntegerInRange, parseStrictInteger, parseStrictPositiveInteger, resolvePromptHistoryLimit } from "openclaw/plugin-sdk/number-runtime";
42
42
  import { resolveChunkMode, resolveTextChunkLimit } from "openclaw/plugin-sdk/reply-chunking";
@@ -51,7 +51,7 @@ import { createHash, randomUUID } from "node:crypto";
51
51
  import { pruneMapToMaxSize } from "openclaw/plugin-sdk/collection-runtime";
52
52
  import { sliceUtf16Safe, truncateCodePoints, truncateUtf16Safe, withTimeout } from "openclaw/plugin-sdk/text-utility-runtime";
53
53
  import { addAllowlistUserEntriesFromConfigEntry, buildAllowlistResolutionSummary, canonicalizeAllowlistWithResolvedIds, patchAllowlistUsersInConfigEntries, summarizeMapping } from "openclaw/plugin-sdk/allow-from";
54
- import { loadWebMedia } from "openclaw/plugin-sdk/web-media";
54
+ import { LocalMediaAccessError, loadWebMedia } from "openclaw/plugin-sdk/web-media";
55
55
  import { resolveMarkdownTableMode } from "openclaw/plugin-sdk/markdown-table-runtime";
56
56
  import { buildOutboundSessionContext, listMessageReceiptPlatformIds, resolveChannelStreamingBlockEnabled, sendDurableMessageBatch } from "openclaw/plugin-sdk/channel-outbound";
57
57
  import { resolvePinnedMainDmOwnerFromAllowlist } from "openclaw/plugin-sdk/security-runtime";
@@ -77,9 +77,10 @@ import { resolveRequestUrl } from "openclaw/plugin-sdk/request-url";
77
77
  import { fetchWithRuntimeDispatcher } from "openclaw/plugin-sdk/runtime-fetch";
78
78
  import * as dns from "node:dns";
79
79
  import { resolveDirectStatusReplyForSession } from "openclaw/plugin-sdk/command-status-runtime";
80
+ import { loadCommandArgMenuModelCatalog } from "openclaw/plugin-sdk/command-surface";
80
81
  import { buildCommandTextFromArgs, findCommandByNativeName, mergeNativeCommandSpecs, parseCommandArgs, resolveCommandArgChoices, resolveCommandArgMenuAsync, serializeCommandArgs } from "openclaw/plugin-sdk/native-command-registry";
82
+ import { PLUGIN_COMMAND_DISPATCH, pluginCommandResultContinuesAgent } from "openclaw/plugin-sdk/plugin-command-runtime";
81
83
  import { recordDeliveredCommandExchange } from "openclaw/plugin-sdk/session-transcript-runtime";
82
- import { PLUGIN_COMMAND_DISPATCH } from "openclaw/plugin-sdk/plugin-command-runtime";
83
84
  import { buildCommandTextFromArgs as buildCommandTextFromArgs$1, findCommandByNativeName as findCommandByNativeName$1, formatCommandArgMenuTitle, listChatCommands, listNativeCommandSpecsForConfig, prepareSkillCommandsForAgents, resolveCommandAuthorization, resolveCommandAuthorizationAsync, resolveCommandAuthorizedFromAuthorizers, resolveEffectiveAgentRuntime, resolveNativeCommandSessionTargets, resolveStoredModelOverrideAsync, serializeCommandArgs as serializeCommandArgs$1 } from "openclaw/plugin-sdk/command-auth-native";
84
85
  import { MODEL_PICKER_CHANGED_MESSAGE, getModelsRuntimeChoices } from "openclaw/plugin-sdk/models-provider-runtime";
85
86
  import { normalizeProviderId } from "openclaw/plugin-sdk/model-ref-parse";
@@ -95,11 +96,11 @@ import { inspect } from "node:util";
95
96
  import { channelReadyPatch, createTransportActivityStatusPatch } from "openclaw/plugin-sdk/gateway-runtime";
96
97
  import { Agent } from "node:https";
97
98
  import { reportChannelRoomJoin } from "openclaw/plugin-sdk/channel-join-intro-runtime";
98
- //#region extensions/discord/src/monitor/listeners.queue.ts
99
+ // extensions/discord/src/monitor/listeners.queue.ts
99
100
  const DISCORD_SLOW_LISTENER_THRESHOLD_MS = 3e4;
100
101
  const discordEventQueueLog = createSubsystemLogger("discord/event-queue");
101
102
  async function runDiscordListenerWithSlowLog(params) {
102
- const startedAt = Date.now();
103
+ const startedAt = performance.now();
103
104
  try {
104
105
  await params.run();
105
106
  } catch (err) {
@@ -110,7 +111,7 @@ async function runDiscordListenerWithSlowLog(params) {
110
111
  throw err;
111
112
  } finally {
112
113
  const { logger, listener, event } = params;
113
- const durationMs = Date.now() - startedAt;
114
+ const durationMs = performance.now() - startedAt;
114
115
  if (!(durationMs < DISCORD_SLOW_LISTENER_THRESHOLD_MS)) {
115
116
  const duration = formatDurationSeconds(durationMs, {
116
117
  decimals: 1,
@@ -127,8 +128,7 @@ async function runDiscordListenerWithSlowLog(params) {
127
128
  }
128
129
  }
129
130
  }
130
- //#endregion
131
- //#region extensions/discord/src/monitor/presence-events.ts
131
+ // extensions/discord/src/monitor/presence-events.ts
132
132
  const DISCORD_PRESENCE_GREETING_COOLDOWN_MS = 288e5;
133
133
  function isDiscordOnlineStatus(status) {
134
134
  return status === "online" || status === "idle" || status === "dnd";
@@ -155,8 +155,7 @@ function resolveDiscordOnlinePresenceEvent(params) {
155
155
  text: lines.join("\n")
156
156
  };
157
157
  }
158
- //#endregion
159
- //#region extensions/discord/src/monitor/presence-cooldown-store.ts
158
+ // extensions/discord/src/monitor/presence-cooldown-store.ts
160
159
  const DISCORD_PRESENCE_COOLDOWN_MAX_ENTRIES = 25e3;
161
160
  function openDiscordPresenceCooldownStore() {
162
161
  return getDiscordRuntime().state.openKeyedStore({
@@ -166,8 +165,7 @@ function openDiscordPresenceCooldownStore() {
166
165
  defaultTtlMs: DISCORD_PRESENCE_GREETING_COOLDOWN_MS
167
166
  });
168
167
  }
169
- //#endregion
170
- //#region extensions/discord/src/monitor/presence-emission-gate.ts
168
+ // extensions/discord/src/monitor/presence-emission-gate.ts
171
169
  const DISCORD_PRESENCE_RECONNECT_SUPPRESS_MS = 3e5;
172
170
  const DISCORD_PRESENCE_BURST_LIMIT = 8;
173
171
  const DISCORD_PRESENCE_BURST_WINDOW_MS = 6e4;
@@ -241,8 +239,7 @@ var DiscordPresenceEmissionGate = class {
241
239
  if (state.reservations.length === 0 && !state.logged) this.burstByGuild.delete(guildId);
242
240
  }
243
241
  };
244
- //#endregion
245
- //#region extensions/discord/src/monitor/presence-transition-cache.ts
242
+ // extensions/discord/src/monitor/presence-transition-cache.ts
246
243
  const DEFAULT_PRESENCE_BASELINE_MAX_ENTRIES = 75e3;
247
244
  var DiscordPresenceBaselineCache = class {
248
245
  constructor(maxEntries = DEFAULT_PRESENCE_BASELINE_MAX_ENTRIES) {
@@ -284,8 +281,7 @@ var DiscordPresenceBaselineCache = class {
284
281
  return evictedScope;
285
282
  }
286
283
  };
287
- //#endregion
288
- //#region extensions/discord/src/monitor/thread-session-close.ts
284
+ // extensions/discord/src/monitor/thread-session-close.ts
289
285
  /**
290
286
  * Closes every session entry in the store whose key contains {@link threadId}.
291
287
  * The explicit lifecycle deletion archives the old transcript and guarantees
@@ -315,8 +311,7 @@ async function closeDiscordThreadSessions(params) {
315
311
  }
316
312
  return resetCount;
317
313
  }
318
- //#endregion
319
- //#region extensions/discord/src/monitor/dm-command-auth.ts
314
+ // extensions/discord/src/monitor/dm-command-auth.ts
320
315
  const DISCORD_CHANNEL_ID = "discord";
321
316
  function createDiscordDmIngressSubject(sender) {
322
317
  return {
@@ -418,8 +413,7 @@ async function resolveDiscordTextCommandAccess(params) {
418
413
  }
419
414
  });
420
415
  }
421
- //#endregion
422
- //#region extensions/discord/src/monitor/listeners.reactions.ts
416
+ // extensions/discord/src/monitor/listeners.reactions.ts
423
417
  var DiscordReactionListener = class {
424
418
  constructor(params) {
425
419
  this.params = params;
@@ -650,8 +644,7 @@ async function runDiscordReactionHandler(params) {
650
644
  eventParams.logger.error(danger(`discord reaction handler failed: ${String(err)}`));
651
645
  }
652
646
  }
653
- //#endregion
654
- //#region extensions/discord/src/monitor/listeners.ts
647
+ // extensions/discord/src/monitor/listeners.ts
655
648
  function registerDiscordListener(listeners, listener) {
656
649
  if (listeners.some((existing) => existing.constructor === listener.constructor)) return false;
657
650
  listeners.push(listener);
@@ -1075,8 +1068,7 @@ var DiscordThreadDeleteListener = class {
1075
1068
  });
1076
1069
  }
1077
1070
  };
1078
- //#endregion
1079
- //#region extensions/discord/src/internal/gateway-dispatch.ts
1071
+ // extensions/discord/src/internal/gateway-dispatch.ts
1080
1072
  function mapGatewayDispatchData(client, type, data) {
1081
1073
  if (type === GatewayDispatchEvents.MessageCreate) return createMessageDispatchData(client, data);
1082
1074
  if (type === GatewayDispatchEvents.MessageReactionAdd || type === GatewayDispatchEvents.MessageReactionRemove) return createReactionDispatchData(client, data);
@@ -1116,8 +1108,7 @@ function createReactionDispatchData(client, data) {
1116
1108
  })
1117
1109
  };
1118
1110
  }
1119
- //#endregion
1120
- //#region extensions/discord/src/monitor/provider.allowlist.ts
1111
+ // extensions/discord/src/monitor/provider.allowlist.ts
1121
1112
  function formatResolutionLogDetails(base, details) {
1122
1113
  const nonEmpty = details.map((value) => value?.trim()).filter((value) => Boolean(value));
1123
1114
  return nonEmpty.length > 0 ? `${base} (${nonEmpty.join("; ")})` : base;
@@ -1316,8 +1307,7 @@ async function resolveDiscordAllowlistConfig(params) {
1316
1307
  allowFrom
1317
1308
  };
1318
1309
  }
1319
- //#endregion
1320
- //#region extensions/discord/src/network-config.ts
1310
+ // extensions/discord/src/network-config.ts
1321
1311
  const DISCORD_DNS_HOSTS = [
1322
1312
  "discord.com",
1323
1313
  "discord.gg",
@@ -1367,8 +1357,7 @@ function createDiscordEndpointDnsLookup(endpointHostname) {
1367
1357
  });
1368
1358
  };
1369
1359
  }
1370
- //#endregion
1371
- //#region extensions/discord/src/monitor/rest-fetch.ts
1360
+ // extensions/discord/src/monitor/rest-fetch.ts
1372
1361
  const discordDnsLookup$1 = createDiscordDnsLookup();
1373
1362
  function createDiscordRestFetchWithDispatcher(dispatcher) {
1374
1363
  return wrapFetchWithAbortSignal(((input, init) => fetchWithRuntimeDispatcher(input, {
@@ -1407,8 +1396,7 @@ function resolveDiscordRestFetch(proxyUrl, runtime) {
1407
1396
  }
1408
1397
  return createDiscordRestFetchWithDispatcher(dispatcher ?? createHttp1Agent({ connect: { lookup: discordDnsLookup$1 } }));
1409
1398
  }
1410
- //#endregion
1411
- //#region extensions/discord/src/monitor/live-policy.ts
1399
+ // extensions/discord/src/monitor/live-policy.ts
1412
1400
  /** One reader belongs to one admitted account; transport and lifetime remain its startup owners. */
1413
1401
  function createDiscordLivePolicyReader(params) {
1414
1402
  const readConfig = params.readConfig ?? createRuntimeConfigReader(params.cfg);
@@ -1506,8 +1494,7 @@ function createDiscordLivePolicyReader(params) {
1506
1494
  }
1507
1495
  };
1508
1496
  }
1509
- //#endregion
1510
- //#region extensions/discord/src/monitor/dm-command-decision.ts
1497
+ // extensions/discord/src/monitor/dm-command-decision.ts
1511
1498
  async function handleDiscordDmCommandDecision(params) {
1512
1499
  if (params.senderAccess.decision === "pairing") {
1513
1500
  const result = await createChannelPairingChallengeIssuer({
@@ -1533,8 +1520,7 @@ async function handleDiscordDmCommandDecision(params) {
1533
1520
  }
1534
1521
  await params.onUnauthorized();
1535
1522
  }
1536
- //#endregion
1537
- //#region extensions/discord/src/monitor/live-policy-interaction.ts
1523
+ // extensions/discord/src/monitor/live-policy-interaction.ts
1538
1524
  const INTERACTION_POLICY_WAIT_MS = 1e3;
1539
1525
  async function readDiscordInteractionPolicy(readPolicy) {
1540
1526
  const timeout = /* @__PURE__ */ new Error("Discord interaction access policy resolution timed out");
@@ -1545,8 +1531,7 @@ async function readDiscordInteractionPolicy(readPolicy) {
1545
1531
  return null;
1546
1532
  }
1547
1533
  }
1548
- //#endregion
1549
- //#region extensions/discord/src/monitor/native-command-reply.ts
1534
+ // extensions/discord/src/monitor/native-command-reply.ts
1550
1535
  const DISCORD_EMPTY_VISIBLE_REPLY_WARNING = "⚠️ Command produced no visible reply.";
1551
1536
  /** Retain visible component text, not interaction IDs or option values. */
1552
1537
  function formatDiscordCommandComponents(components) {
@@ -1665,34 +1650,46 @@ async function deliverDiscordInteractionReply(params) {
1665
1650
  throw createChannelPartialDeliveryError(error, { visibleReplySent: true });
1666
1651
  }
1667
1652
  };
1668
- const files = reply.hasMedia ? await Promise.all(reply.mediaUrls.map(async (url) => {
1669
- const loaded = await loadWebMedia(url, {
1670
- localRoots: params.mediaLocalRoots,
1671
- ssrfPolicy: buildOutboundMediaLoadOptions({ mediaAccess: params.mediaAccess }).ssrfPolicy
1672
- });
1673
- return {
1674
- name: loaded.fileName ?? "upload",
1675
- data: loaded.buffer,
1676
- contentType: loaded.contentType
1677
- };
1678
- })) : void 0;
1679
- if (!files && !reply.hasText && !hasFirstMessageParts) return false;
1680
- const chunks = resolveTextChunksWithFallback(reply.text, chunkDiscordTextWithMode(reply.text, {
1653
+ const mediaFailures = [];
1654
+ const files = (await Promise.all(reply.mediaUrls.map(async (url, index) => {
1655
+ try {
1656
+ const loaded = await loadWebMedia(url, {
1657
+ localRoots: params.mediaLocalRoots,
1658
+ ssrfPolicy: buildOutboundMediaLoadOptions({ mediaAccess: params.mediaAccess }).ssrfPolicy
1659
+ });
1660
+ return {
1661
+ name: loaded.fileName ?? "upload",
1662
+ data: loaded.buffer,
1663
+ contentType: loaded.contentType
1664
+ };
1665
+ } catch (error) {
1666
+ if (!(error instanceof MediaFetchError || error instanceof LocalMediaAccessError)) throw error;
1667
+ logVerbose(`discord: interaction media not attached: ${String(error)}`);
1668
+ mediaFailures[index] = {
1669
+ code: "delivery-failed",
1670
+ kind: "document",
1671
+ label: (URL.canParse(url) ? new URL(url).pathname : url).split(/[\\/]/).findLast(Boolean) ?? `Attachment ${index + 1}`
1672
+ };
1673
+ return;
1674
+ }
1675
+ }))).filter((file) => file !== void 0);
1676
+ const text = appendReplyMediaFailures(reply.text, mediaFailures.filter(Boolean)) ?? "";
1677
+ if (files.length === 0 && !text.trim() && !hasFirstMessageParts) return false;
1678
+ const chunks = resolveTextChunksWithFallback(text, chunkDiscordTextWithMode(text, {
1681
1679
  maxChars: textLimit,
1682
1680
  maxLines: maxLinesPerMessage,
1683
1681
  chunkMode
1684
1682
  }));
1685
1683
  if (chunks.length === 0) chunks.push("");
1686
1684
  for (const [index, chunk] of chunks.entries()) {
1687
- const chunkFiles = index === 0 ? files : void 0;
1685
+ const chunkFiles = index === 0 && files.length > 0 ? files : void 0;
1688
1686
  if (!chunk.trim() && !chunkFiles && (payloadDelivered || !hasFirstMessageParts)) continue;
1689
1687
  await sendMessage(chunk, chunkFiles);
1690
1688
  }
1691
1689
  if (payloadDelivered && params.onDelivered) await params.onDelivered(deliveredText?.filter(Boolean).join("\n") ?? "");
1692
1690
  return payloadDelivered;
1693
1691
  }
1694
- //#endregion
1695
- //#region extensions/discord/src/monitor/native-command-agent-reply.ts
1692
+ // extensions/discord/src/monitor/native-command-agent-reply.ts
1696
1693
  async function dispatchDiscordNativeAgentReply(params) {
1697
1694
  const blockStreamingEnabled = resolveChannelStreamingBlockEnabled(params.discordConfig);
1698
1695
  let didReply = false;
@@ -1768,13 +1765,11 @@ async function dispatchDiscordNativeAgentReply(params) {
1768
1765
  }));
1769
1766
  return dispatchResult;
1770
1767
  }
1771
- //#endregion
1772
- //#region extensions/discord/src/monitor/commands.ts
1768
+ // extensions/discord/src/monitor/commands.ts
1773
1769
  function resolveDiscordSlashCommandConfig(raw) {
1774
1770
  return { ephemeral: raw?.ephemeral !== false };
1775
1771
  }
1776
- //#endregion
1777
- //#region extensions/discord/src/monitor/native-command-arg-ui.ts
1772
+ // extensions/discord/src/monitor/native-command-arg-ui.ts
1778
1773
  const DISCORD_COMMAND_ARG_CUSTOM_ID_KEY = "cmdarg";
1779
1774
  function parseDiscordCommandArgData(data) {
1780
1775
  if (!data || typeof data !== "object") return null;
@@ -1867,8 +1862,7 @@ function createDiscordCommandArgFallbackButton$1(params) {
1867
1862
  }
1868
1863
  };
1869
1864
  }
1870
- //#endregion
1871
- //#region extensions/discord/src/monitor/inbound-context.ts
1865
+ // extensions/discord/src/monitor/inbound-context.ts
1872
1866
  function createDiscordSupplementalContextAccessChecker(params) {
1873
1867
  const userAllowList = params.channelConfig?.users ?? params.guildInfo?.users ?? [];
1874
1868
  const roleAllowList = params.channelConfig?.roles ?? params.guildInfo?.roles ?? [];
@@ -1917,8 +1911,7 @@ function buildDiscordInboundAccessContext(params) {
1917
1911
  ownerAllowFrom: resolveDiscordOwnerAllowFrom(params)
1918
1912
  };
1919
1913
  }
1920
- //#endregion
1921
- //#region extensions/discord/src/monitor/native-command-context.ts
1914
+ // extensions/discord/src/monitor/native-command-context.ts
1922
1915
  async function buildDiscordNativeInteractionContext(params) {
1923
1916
  const { interaction, route, boundSessionKey, sessionPrefix, channelContext, ...context } = params;
1924
1917
  const targets = resolveNativeCommandSessionTargets({
@@ -2055,8 +2048,7 @@ async function buildDiscordNativeInteractionContext(params) {
2055
2048
  ...targets
2056
2049
  };
2057
2050
  }
2058
- //#endregion
2059
- //#region extensions/discord/src/monitor/native-command-route.ts
2051
+ // extensions/discord/src/monitor/native-command-route.ts
2060
2052
  function resolveDiscordNativeInteractionRouteState(params) {
2061
2053
  const { channelContext, interaction } = params;
2062
2054
  const conversationId = params.conversationId ?? channelContext.rawChannelId;
@@ -2098,8 +2090,7 @@ function resolveDiscordNativeInteractionRouteState(params) {
2098
2090
  configuredBinding
2099
2091
  };
2100
2092
  }
2101
- //#endregion
2102
- //#region extensions/discord/src/monitor/native-interaction-channel-context.ts
2093
+ // extensions/discord/src/monitor/native-interaction-channel-context.ts
2103
2094
  async function resolveDiscordNativeInteractionChannelContext(interaction, channelIdFallback) {
2104
2095
  const { channel, client, guild, rawData } = interaction;
2105
2096
  const hasGuild = Boolean(guild);
@@ -2122,8 +2113,7 @@ async function resolveDiscordNativeInteractionChannelContext(interaction, channe
2122
2113
  threadParentSlug: hasGuild ? channelContext.threadParentSlug : ""
2123
2114
  };
2124
2115
  }
2125
- //#endregion
2126
- //#region extensions/discord/src/monitor/native-command-auth.ts
2116
+ // extensions/discord/src/monitor/native-command-auth.ts
2127
2117
  function resolveDiscordNativePolicyReader(params) {
2128
2118
  return params.readPolicy ?? createDiscordLivePolicyReader({
2129
2119
  ...params,
@@ -2404,8 +2394,7 @@ async function resolveDiscordNativeAutocompleteAuthorized(params) {
2404
2394
  }
2405
2395
  return params.isPolicyCurrent?.() !== false;
2406
2396
  }
2407
- //#endregion
2408
- //#region extensions/discord/src/monitor/native-command-bypass.ts
2397
+ // extensions/discord/src/monitor/native-command-bypass.ts
2409
2398
  function shouldBypassConfiguredAcpEnsure(commandName) {
2410
2399
  const command = commandName.trim().toLowerCase();
2411
2400
  return command === "acp" || command === "status";
@@ -2414,8 +2403,7 @@ function shouldBypassConfiguredAcpGuildGuards(commandName) {
2414
2403
  const command = commandName.trim().toLowerCase();
2415
2404
  return command === "new" || command === "reset";
2416
2405
  }
2417
- //#endregion
2418
- //#region extensions/discord/src/monitor/model-picker-preference-primitives.ts
2406
+ // extensions/discord/src/monitor/model-picker-preference-primitives.ts
2419
2407
  function splitDiscordModelRef(modelRef) {
2420
2408
  const trimmed = modelRef.trim();
2421
2409
  const slashIndex = trimmed.indexOf("/");
@@ -2443,8 +2431,7 @@ function preferenceTimestampMs(value) {
2443
2431
  const parsed = typeof value === "string" ? Date.parse(value) : NaN;
2444
2432
  return Number.isFinite(parsed) ? parsed : 0;
2445
2433
  }
2446
- //#endregion
2447
- //#region extensions/discord/src/monitor/model-picker-preferences.ts
2434
+ // extensions/discord/src/monitor/model-picker-preferences.ts
2448
2435
  const RECENT_LIMIT = 5;
2449
2436
  const PREFERENCE_MAX_ENTRIES = 2e3;
2450
2437
  let lastPreferenceTimestampMs = 0;
@@ -2523,8 +2510,7 @@ async function recordDiscordModelPickerRecentModel(params) {
2523
2510
  await Promise.all(expired.map((entry) => store.delete(entry.key)));
2524
2511
  } catch {}
2525
2512
  }
2526
- //#endregion
2527
- //#region extensions/discord/src/monitor/model-picker.state.ts
2513
+ // extensions/discord/src/monitor/model-picker.state.ts
2528
2514
  const DISCORD_MODEL_PICKER_CUSTOM_ID_KEY = "mdlpk";
2529
2515
  const DISCORD_CUSTOM_ID_MAX_CHARS = 100;
2530
2516
  const DISCORD_COMPONENT_MAX_SELECT_OPTIONS = 25;
@@ -2774,8 +2760,7 @@ function getDiscordModelPickerRecentModelRefs(data, quickModels) {
2774
2760
  const defaultModelRef = `${data.resolvedDefault.provider}/${data.resolvedDefault.model}`;
2775
2761
  return [defaultModelRef, ...quickModels.filter((modelRef) => modelRef !== defaultModelRef)];
2776
2762
  }
2777
- //#endregion
2778
- //#region extensions/discord/src/monitor/model-picker.view.ts
2763
+ // extensions/discord/src/monitor/model-picker.view.ts
2779
2764
  const DISCORD_MODEL_PICKER_PAGE_INDICATOR_CUSTOM_ID = "mdlpk:nav-indicator";
2780
2765
  function parseCurrentModelRef(raw) {
2781
2766
  const match = raw?.trim().match(/^([^/]+)\/(.+)$/u);
@@ -3162,8 +3147,7 @@ function renderDiscordModelPickerRecentsView(params) {
3162
3147
  trailingRows: [backRow]
3163
3148
  });
3164
3149
  }
3165
- //#endregion
3166
- //#region extensions/discord/src/monitor/native-command-model-picker-ui.ts
3150
+ // extensions/discord/src/monitor/native-command-model-picker-ui.ts
3167
3151
  function createDiscordModelPickerSessionReader(params, readConsistency) {
3168
3152
  const storePath = resolveStorePath(params.cfg.session?.store, { agentId: params.route.agentId });
3169
3153
  return (sessionKey = params.route.sessionKey) => getSessionEntryAsync({
@@ -3324,8 +3308,7 @@ async function replyWithDiscordModelPickerProviders(params) {
3324
3308
  replyText: formatDiscordCommandComponents(rendered.components)
3325
3309
  });
3326
3310
  }
3327
- //#endregion
3328
- //#region extensions/discord/src/monitor/native-command-model-picker-interaction.ts
3311
+ // extensions/discord/src/monitor/native-command-model-picker-interaction.ts
3329
3312
  function resolveModelPickerSelectionValue(interaction) {
3330
3313
  return normalizeOptionalString(interaction.values?.[0]) ?? null;
3331
3314
  }
@@ -3688,8 +3671,7 @@ function createDiscordModelPickerFallbackSelect$1(params) {
3688
3671
  }
3689
3672
  };
3690
3673
  }
3691
- //#endregion
3692
- //#region extensions/discord/src/monitor/native-command.options.ts
3674
+ // extensions/discord/src/monitor/native-command.options.ts
3693
3675
  const DISCORD_COMMAND_DESCRIPTION_MAX = 100;
3694
3676
  function truncateDiscordCommandDescription(params) {
3695
3677
  return truncateUtf16Safe(params.value, DISCORD_COMMAND_DESCRIPTION_MAX);
@@ -3755,8 +3737,7 @@ function buildDiscordCommandOptions(params) {
3755
3737
  });
3756
3738
  });
3757
3739
  }
3758
- //#endregion
3759
- //#region extensions/discord/src/monitor/native-command.ts
3740
+ // extensions/discord/src/monitor/native-command.ts
3760
3741
  const log = createSubsystemLogger("discord/native-command");
3761
3742
  const NON_PLUGIN_COMMAND_DISPATCH = Object.freeze({ kind: "non-plugin" });
3762
3743
  function createNativeCommandDefinition(command) {
@@ -4008,24 +3989,27 @@ async function dispatchDiscordCommandInteraction(params) {
4008
3989
  if (!authority.isAllowed()) return reject("You are not authorized to use this command.", true);
4009
3990
  const isGuild = Boolean(interaction.guild);
4010
3991
  const channelId = rawChannelId || "unknown";
4011
- const menuModelContext = !(commandArgs?.raw && !commandArgs.values) && command.args?.some((arg) => typeof arg.choices === "function" && commandArgs?.values?.[arg.name] == null) && bindingReadiness?.ok !== false ? await resolveDiscordNativeChoiceContext({
3992
+ const menuNeedsModelContext = !(commandArgs?.raw && !commandArgs.values) && command.args?.some((arg) => typeof arg.choices === "function" && commandArgs?.values?.[arg.name] == null);
3993
+ const menuModelContext = menuNeedsModelContext && bindingReadiness?.ok !== false ? await resolveDiscordNativeChoiceContext({
4012
3994
  interaction,
4013
3995
  cfg,
4014
3996
  accountId,
4015
3997
  threadBindings,
4016
3998
  route: effectiveRoute
4017
3999
  }) : null;
4000
+ const menuModelCatalog = command.key === "think" && menuNeedsModelContext ? await loadCommandArgMenuModelCatalog({
4001
+ cfg,
4002
+ ...menuModelContext?.agentId ? { agentId: menuModelContext.agentId } : {}
4003
+ }) : void 0;
4018
4004
  const menu = command.key === "verbose" && bindingReadiness?.ok === false ? null : await resolveCommandArgMenuAsync({
4019
4005
  command,
4020
4006
  args: commandArgs,
4021
4007
  cfg,
4022
- session: command.key === "verbose" || command.key === "think" ? {
4023
- agentId: menuModelContext?.agentId ?? effectiveRoute.agentId,
4024
- sessionKey: effectiveRoute.sessionKey
4025
- } : void 0,
4008
+ session: command.key === "verbose" ? effectiveRoute : void 0,
4026
4009
  provider: menuModelContext?.provider,
4027
4010
  model: menuModelContext?.model,
4028
- agentRuntime: menuModelContext?.agentRuntime
4011
+ agentRuntime: menuModelContext?.agentRuntime,
4012
+ catalog: menuModelCatalog
4029
4013
  });
4030
4014
  if (policy?.isCurrent() === false) return reject("Access policy changed. Try this interaction again.", true);
4031
4015
  if (menu) {
@@ -4081,41 +4065,43 @@ async function dispatchDiscordCommandInteraction(params) {
4081
4065
  messageThreadId,
4082
4066
  threadParentId: pluginThreadParentId
4083
4067
  });
4084
- if (pluginReply.suppressReply === true) {
4085
- await settleDiscordInteractionWithoutVisibleReply(interaction);
4068
+ if (!pluginCommandResultContinuesAgent(pluginReply)) {
4069
+ if (pluginReply.suppressReply === true) {
4070
+ await settleDiscordInteractionWithoutVisibleReply(interaction);
4071
+ return {
4072
+ accepted: true,
4073
+ effectiveRoute
4074
+ };
4075
+ }
4076
+ const recordReply = async (replyText) => {
4077
+ await recordDeliveredCommandExchange({
4078
+ config: cfg,
4079
+ agentId: pluginCommandAgentId,
4080
+ sessionKey: effectiveRoute.sessionKey,
4081
+ expectedSessionId: targetSessionEntry?.sessionId,
4082
+ commandText: prompt,
4083
+ commandId: `discord:${accountId}:${channelId}:${interaction.id}`,
4084
+ replyId: "plugin-reply",
4085
+ replyText
4086
+ });
4087
+ };
4088
+ if (hasRenderableReplyPayload(pluginReply)) await deliverDiscordInteractionReply({
4089
+ interaction,
4090
+ payload: pluginReply,
4091
+ ...resolveDiscordInteractionReplyOptions({
4092
+ cfg,
4093
+ discordConfig,
4094
+ accountId
4095
+ }),
4096
+ responseEphemeral,
4097
+ onDelivered: recordReply
4098
+ });
4099
+ else if (await respond("⚠️ Command produced no visible reply.")) await recordReply(DISCORD_EMPTY_VISIBLE_REPLY_WARNING);
4086
4100
  return {
4087
4101
  accepted: true,
4088
4102
  effectiveRoute
4089
4103
  };
4090
4104
  }
4091
- const recordReply = async (replyText) => {
4092
- await recordDeliveredCommandExchange({
4093
- config: cfg,
4094
- agentId: pluginCommandAgentId,
4095
- sessionKey: effectiveRoute.sessionKey,
4096
- expectedSessionId: targetSessionEntry?.sessionId,
4097
- commandText: prompt,
4098
- commandId: `discord:${accountId}:${channelId}:${interaction.id}`,
4099
- replyId: "plugin-reply",
4100
- replyText
4101
- });
4102
- };
4103
- if (hasRenderableReplyPayload(pluginReply)) await deliverDiscordInteractionReply({
4104
- interaction,
4105
- payload: pluginReply,
4106
- ...resolveDiscordInteractionReplyOptions({
4107
- cfg,
4108
- discordConfig,
4109
- accountId
4110
- }),
4111
- responseEphemeral,
4112
- onDelivered: recordReply
4113
- });
4114
- else if (await respond("⚠️ Command produced no visible reply.")) await recordReply(DISCORD_EMPTY_VISIBLE_REPLY_WARNING);
4115
- return {
4116
- accepted: true,
4117
- effectiveRoute
4118
- };
4119
4105
  }
4120
4106
  const pickerCommandContext = shouldOpenDiscordModelPickerFromCommand({
4121
4107
  command,
@@ -4216,17 +4202,11 @@ function bindDiscordCommandControl(createControl) {
4216
4202
  const createDiscordCommandArgFallbackButton = bindDiscordCommandControl(createDiscordCommandArgFallbackButton$1);
4217
4203
  const createDiscordModelPickerFallbackButton = bindDiscordCommandControl(createDiscordModelPickerFallbackButton$1);
4218
4204
  const createDiscordModelPickerFallbackSelect = bindDiscordCommandControl(createDiscordModelPickerFallbackSelect$1);
4219
- //#endregion
4220
- //#region extensions/discord/src/monitor/agent-components-reply.ts
4205
+ // extensions/discord/src/monitor/agent-components-reply.ts
4221
4206
  async function replySilently(interaction, params, onError) {
4222
- try {
4223
- await interaction.reply(params);
4224
- } catch (error) {
4225
- onError?.(error);
4226
- }
4207
+ await interaction[interaction.responseState === "deferred-update" ? "followUp" : "reply"](params).catch((error) => onError?.(error));
4227
4208
  }
4228
- //#endregion
4229
- //#region extensions/discord/src/activities/interaction.ts
4209
+ // extensions/discord/src/activities/interaction.ts
4230
4210
  const REGISTRATION_WIDGET_ID = "AAAAAAAAAAAAAAAAAAAAAA";
4231
4211
  const PENDING_LAUNCH_WRITE_BUDGET_MS = 250;
4232
4212
  function createActivityButton(ctx) {
@@ -4276,8 +4256,7 @@ function createDiscordActivityButton(ctx, applicationId) {
4276
4256
  if (!runtime.resolveAccount(ctx.accountId, ctx.cfg)) return null;
4277
4257
  return createActivityButton(ctx);
4278
4258
  }
4279
- //#endregion
4280
- //#region extensions/discord/src/internal/gateway-close-codes.ts
4259
+ // extensions/discord/src/internal/gateway-close-codes.ts
4281
4260
  const fatalGatewayCloseCodes = /* @__PURE__ */ new Set([
4282
4261
  GatewayCloseCodes.AuthenticationFailed,
4283
4262
  GatewayCloseCodes.InvalidShard,
@@ -4298,8 +4277,7 @@ function isFatalGatewayCloseCode(code) {
4298
4277
  function canResumeAfterGatewayClose(code) {
4299
4278
  return !nonResumableGatewayCloseCodes.has(code);
4300
4279
  }
4301
- //#endregion
4302
- //#region extensions/discord/src/internal/gateway-identify-limiter.ts
4280
+ // extensions/discord/src/internal/gateway-identify-limiter.ts
4303
4281
  const IDENTIFY_WINDOW_MS = 5e3;
4304
4282
  var GatewayIdentifyLimiter = class {
4305
4283
  constructor() {
@@ -4320,8 +4298,7 @@ var GatewayIdentifyLimiter = class {
4320
4298
  }
4321
4299
  };
4322
4300
  const sharedGatewayIdentifyLimiter = new GatewayIdentifyLimiter();
4323
- //#endregion
4324
- //#region extensions/discord/src/internal/gateway-payload.ts
4301
+ // extensions/discord/src/internal/gateway-payload.ts
4325
4302
  function ensureGatewayParams(url) {
4326
4303
  const parsed = new URL(url);
4327
4304
  parsed.searchParams.set("v", parsed.searchParams.get("v") ?? "10");
@@ -4336,8 +4313,7 @@ function decodeGatewayMessage(incoming) {
4336
4313
  return null;
4337
4314
  }
4338
4315
  }
4339
- //#endregion
4340
- //#region extensions/discord/src/internal/gateway-rate-limit.ts
4316
+ // extensions/discord/src/internal/gateway-rate-limit.ts
4341
4317
  const GATEWAY_SEND_LIMIT = 120;
4342
4318
  const GATEWAY_SEND_WINDOW_MS = 6e4;
4343
4319
  const GATEWAY_SEND_QUEUE_LIMIT = GATEWAY_SEND_LIMIT;
@@ -4423,8 +4399,7 @@ var GatewaySendLimiter = class {
4423
4399
  this.scheduleFlush();
4424
4400
  }
4425
4401
  };
4426
- //#endregion
4427
- //#region extensions/discord/src/internal/gateway-voice-state-cache.ts
4402
+ // extensions/discord/src/internal/gateway-voice-state-cache.ts
4428
4403
  var DiscordGatewayVoiceStateCache = class {
4429
4404
  constructor() {
4430
4405
  this.statesByGuild = /* @__PURE__ */ new Map();
@@ -4497,8 +4472,7 @@ var DiscordGatewayVoiceStateCache = class {
4497
4472
  }
4498
4473
  }
4499
4474
  };
4500
- //#endregion
4501
- //#region extensions/discord/src/internal/gateway.ts
4475
+ // extensions/discord/src/internal/gateway.ts
4502
4476
  const GatewayIntents = GatewayIntentBits;
4503
4477
  const READY_STATE_OPEN = 1;
4504
4478
  const DEFAULT_GATEWAY_URL = "wss://gateway.discord.gg/";
@@ -4817,8 +4791,7 @@ var GatewayPlugin = class {
4817
4791
  }, true);
4818
4792
  }
4819
4793
  };
4820
- //#endregion
4821
- //#region extensions/discord/src/voice/session.ts
4794
+ // extensions/discord/src/voice/session.ts
4822
4795
  const MIN_SEGMENT_SECONDS = .35;
4823
4796
  const CAPTURE_FINALIZE_GRACE_MS = 2e3;
4824
4797
  const VOICE_CONNECT_READY_TIMEOUT_MS = 3e4;
@@ -4835,8 +4808,7 @@ function logVoiceVerbose(message) {
4835
4808
  function isVoiceChannel(type) {
4836
4809
  return type === discord_exports.ChannelType.GuildVoice || type === discord_exports.ChannelType.GuildStageVoice;
4837
4810
  }
4838
- //#endregion
4839
- //#region extensions/discord/src/voice/command.ts
4811
+ // extensions/discord/src/voice/command.ts
4840
4812
  const VOICE_CHANNEL_TYPES = [ChannelType.GuildVoice, ChannelType.GuildStageVoice];
4841
4813
  const DISCORD_VOICE_COMMAND_SPEC = {
4842
4814
  name: "vc",
@@ -5001,8 +4973,7 @@ function createDiscordVoiceCommand(startupParams) {
5001
4973
  }
5002
4974
  }();
5003
4975
  }
5004
- //#endregion
5005
- //#region extensions/discord/src/monitor/agent-components-context.ts
4976
+ // extensions/discord/src/monitor/agent-components-context.ts
5006
4977
  function resolveAgentComponentRoute(params) {
5007
4978
  return resolveAgentRoute({
5008
4979
  cfg: params.ctx.cfg,
@@ -5083,8 +5054,7 @@ async function resolveComponentInteractionContext(params) {
5083
5054
  memberRoleIds: Array.isArray(interaction.rawData.member?.roles) ? interaction.rawData.member.roles.slice() : []
5084
5055
  };
5085
5056
  }
5086
- //#endregion
5087
- //#region extensions/discord/src/monitor/agent-components-data.ts
5057
+ // extensions/discord/src/monitor/agent-components-data.ts
5088
5058
  function readParsedId(data, key) {
5089
5059
  if (!data || typeof data !== "object") return;
5090
5060
  return key in data ? data[key] : data[key === "cid" ? "componentId" : "modalId"];
@@ -5171,8 +5141,7 @@ function formatModalSubmissionText(entry, interaction) {
5171
5141
  });
5172
5142
  return [title, ...lines.length > 0 ? lines : ["- (no values)"]].join("\n");
5173
5143
  }
5174
- //#endregion
5175
- //#region extensions/discord/src/monitor/agent-components-live-policy.ts
5144
+ // extensions/discord/src/monitor/agent-components-live-policy.ts
5176
5145
  async function resolveAgentComponentPolicyContext(params) {
5177
5146
  if (!params.ctx.readPolicy) return params.ctx;
5178
5147
  try {
@@ -5192,8 +5161,7 @@ async function resolveAgentComponentPolicyContext(params) {
5192
5161
  throw error;
5193
5162
  }
5194
5163
  }
5195
- //#endregion
5196
- //#region extensions/discord/src/monitor/agent-components-dm-auth.ts
5164
+ // extensions/discord/src/monitor/agent-components-dm-auth.ts
5197
5165
  async function ensureDmComponentAuthorized(params) {
5198
5166
  const { ctx, interaction, user, componentLabel } = params;
5199
5167
  const dmPolicy = ctx.dmPolicy ?? "pairing";
@@ -5294,8 +5262,7 @@ async function resolveInteractionContextWithDmAuth(params) {
5294
5262
  })) return null;
5295
5263
  return interactionCtx;
5296
5264
  }
5297
- //#endregion
5298
- //#region extensions/discord/src/monitor/agent-components-guild-auth.ts
5265
+ // extensions/discord/src/monitor/agent-components-guild-auth.ts
5299
5266
  function resolveComponentGuildContext(params) {
5300
5267
  const guildInfo = resolveDiscordGuildEntry({
5301
5268
  guild: params.interaction.guild ?? void 0,
@@ -5463,8 +5430,7 @@ async function resolveAuthorizedComponentInteraction(params) {
5463
5430
  commandAuthorized
5464
5431
  };
5465
5432
  }
5466
- //#endregion
5467
- //#region extensions/discord/src/monitor/reply-context.ts
5433
+ // extensions/discord/src/monitor/reply-context.ts
5468
5434
  function resolveReplyContext(message, resolveDiscordMessageText) {
5469
5435
  const id = resolveDiscordReferencedReplyMessageId(message);
5470
5436
  if (!id) return null;
@@ -5495,8 +5461,7 @@ function buildGuildLabel(params) {
5495
5461
  const { guild, channelName, channelId } = params;
5496
5462
  return `${guild?.name ?? "Guild"} #${channelName} channel id:${channelId}`;
5497
5463
  }
5498
- //#endregion
5499
- //#region extensions/discord/src/monitor/reply-safety.ts
5464
+ // extensions/discord/src/monitor/reply-safety.ts
5500
5465
  const DISCORD_INTERNAL_CHANNEL_LINE_RE = /^(?:>\s*)?(?:analysis|commentary|thinking|reasoning)\s*[:=]/i;
5501
5466
  function hasNonEmptyRecord(value) {
5502
5467
  return Boolean(value && typeof value === "object" && !Array.isArray(value) && Object.keys(value).length > 0);
@@ -5543,8 +5508,7 @@ function sanitizeDiscordFrontChannelReplyPayloads(payloads, options = {}) {
5543
5508
  }
5544
5509
  return safePayloads;
5545
5510
  }
5546
- //#endregion
5547
- //#region extensions/discord/src/monitor/reply-delivery.ts
5511
+ // extensions/discord/src/monitor/reply-delivery.ts
5548
5512
  function formatDiscordReplyContext(target, sessionKey) {
5549
5513
  return `target=${target}${sessionKey ? ` session=${sessionKey}` : ""}`;
5550
5514
  }
@@ -5565,11 +5529,13 @@ function resolveBoundThreadBinding(params) {
5565
5529
  }
5566
5530
  function resolveBindingIdentity(cfg, binding) {
5567
5531
  if (!binding) return;
5568
- const displayName = `🤖 ${binding.label?.trim() || binding.agentId}`.trim();
5532
+ const baseLabel = binding.label?.trim() || binding.agentId;
5533
+ if (!baseLabel) return;
5534
+ const displayName = `🤖 ${baseLabel}`.trim();
5569
5535
  const identity = { name: truncateUtf16Safe(displayName, 80) };
5570
5536
  try {
5571
- const avatar = resolveAgentAvatar(cfg, binding.agentId);
5572
- if (avatar.kind === "remote") identity.avatarUrl = avatar.url;
5537
+ const avatar = binding.agentId ? resolveAgentAvatar(cfg, binding.agentId) : void 0;
5538
+ if (avatar?.kind === "remote") identity.avatarUrl = avatar.url;
5573
5539
  } catch {}
5574
5540
  return identity;
5575
5541
  }
@@ -5654,10 +5620,9 @@ async function deliverDiscordReply(params) {
5654
5620
  if (send.status === "partial_failed") throw createChannelPartialDeliveryError(send.error, deliveryResult);
5655
5621
  return deliveryResult;
5656
5622
  }
5657
- //#endregion
5658
- //#region extensions/discord/src/monitor/agent-components.dispatch.ts
5623
+ // extensions/discord/src/monitor/agent-components.dispatch.ts
5659
5624
  const loadReplyRuntime = createLazyRuntimeModule(() => import("openclaw/plugin-sdk/reply-runtime"));
5660
- const loadTypingRuntime = createLazyRuntimeModule(() => import("./typing-CNlSKY5S.mjs").then((n) => n.n));
5625
+ const loadTypingRuntime = createLazyRuntimeModule(() => import("./typing-DAv4S2fI.mjs").then((n) => n.n));
5661
5626
  function buildDiscordComponentConversationLabel(params) {
5662
5627
  if (params.interactionCtx.isDirectMessage) return buildDirectLabel(params.interactionCtx.user);
5663
5628
  if (params.interactionCtx.isGroupDm) return `Group DM #${params.channelCtx.channelName ?? params.interactionCtx.channelId} channel id:${params.interactionCtx.channelId}`;
@@ -5891,8 +5856,7 @@ async function dispatchDiscordComponentEvent(params) {
5891
5856
  }
5892
5857
  });
5893
5858
  }
5894
- //#endregion
5895
- //#region extensions/discord/src/interactive-dispatch.ts
5859
+ // extensions/discord/src/interactive-dispatch.ts
5896
5860
  const dispatchDiscordInteractive = createChannelInteractiveDispatcher({
5897
5861
  channel: "discord",
5898
5862
  interactiveKey: "interaction"
@@ -5903,8 +5867,7 @@ async function dispatchDiscordPluginInteractiveHandler(params) {
5903
5867
  dedupeId: params.interactionId
5904
5868
  });
5905
5869
  }
5906
- //#endregion
5907
- //#region extensions/discord/src/monitor/agent-components.plugin-interactive.ts
5870
+ // extensions/discord/src/monitor/agent-components.plugin-interactive.ts
5908
5871
  const loadConversationRuntime = createLazyRuntimeModule(() => import("openclaw/plugin-sdk/conversation-runtime"));
5909
5872
  async function dispatchPluginDiscordInteractiveEvent(params) {
5910
5873
  const normalizedConversationId = params.interactionCtx.rawGuildId || params.channelCtx.channelType === ChannelType.GroupDM ? `channel:${params.interactionCtx.channelId}` : `user:${params.interactionCtx.userId}`;
@@ -6016,8 +5979,7 @@ async function dispatchPluginDiscordInteractiveEvent(params) {
6016
5979
  }
6017
5980
  return "unmatched";
6018
5981
  }
6019
- //#endregion
6020
- //#region extensions/discord/src/monitor/agent-components.system-controls.ts
5982
+ // extensions/discord/src/monitor/agent-components.system-controls.ts
6021
5983
  const AGENT_BUTTON_KEY = "agent";
6022
5984
  const AGENT_SELECT_KEY = "agentsel";
6023
5985
  async function runAgentSystemControlInteraction(params) {
@@ -6097,9 +6059,8 @@ function createAgentSelectMenu(ctx) {
6097
6059
  }
6098
6060
  };
6099
6061
  }
6100
- //#endregion
6101
- //#region extensions/discord/src/monitor/agent-components.ts
6102
- const loadComponentsRuntime = createLazyRuntimeModule(() => import("./components-C1Phe3uw.mjs").then((n) => n.t));
6062
+ // extensions/discord/src/monitor/agent-components.ts
6063
+ const loadComponentsRuntime = createLazyRuntimeModule(() => import("./components-GePlato3.mjs").then((n) => n.t));
6103
6064
  async function resolveAuthorizedComponentEntry(params) {
6104
6065
  const entry = params.entry ?? await params.resolve(false);
6105
6066
  if (!entry) {
@@ -6353,8 +6314,7 @@ function createDiscordComponentButton(ctx) {
6353
6314
  }
6354
6315
  const createAgentComponentControls = [createAgentComponentButton, createAgentSelectMenu];
6355
6316
  const createDiscordComponentControls = [createDiscordComponentButton, ...SELECT_CONTROLS.map((spec) => (ctx) => createDiscordComponentSelectControl(spec, ctx))];
6356
- //#endregion
6357
- //#region extensions/discord/src/monitor/exec-approvals.ts
6317
+ // extensions/discord/src/monitor/exec-approvals.ts
6358
6318
  function resolveTerminalLabel(approval) {
6359
6319
  if (approval.status === "allowed" || approval.status === "denied") return formatApprovalDecisionLabel(approval.decision);
6360
6320
  return approval.status === "expired" ? "Expired" : "Cancelled";
@@ -6483,8 +6443,7 @@ function createDiscordExecApprovalButtonContext(params) {
6483
6443
  }
6484
6444
  };
6485
6445
  }
6486
- //#endregion
6487
- //#region extensions/discord/src/monitor/gateway-supervisor.ts
6446
+ // extensions/discord/src/monitor/gateway-supervisor.ts
6488
6447
  var DiscordGatewayLifecycleError = class extends Error {
6489
6448
  constructor(event) {
6490
6449
  super(`discord gateway ${event.type}: ${event.message}`, { cause: event.err instanceof Error ? event.err : void 0 });
@@ -6590,8 +6549,7 @@ function createDiscordGatewaySupervisor(params) {
6590
6549
  }
6591
6550
  };
6592
6551
  }
6593
- //#endregion
6594
- //#region extensions/discord/src/monitor/provider.commands.ts
6552
+ // extensions/discord/src/monitor/provider.commands.ts
6595
6553
  const loadPluginCommandRuntime = createLazyRuntimeModule(() => import("openclaw/plugin-sdk/plugin-command-runtime"));
6596
6554
  async function resolveDiscordProviderCommandSpecs(params) {
6597
6555
  const maxDiscordCommands = 100;
@@ -6637,8 +6595,7 @@ async function resolveDiscordProviderCommandSpecs(params) {
6637
6595
  if (params.nativeEnabled && commandSpecs.length > maxDiscordCommands) params.runtime.log?.(warn(`${commandSpecs.length} commands exceed the ${maxDiscordCommands}-command Discord limit; some commands may fail to deploy.`));
6638
6596
  return { commandSpecs };
6639
6597
  }
6640
- //#endregion
6641
- //#region extensions/discord/src/monitor/provider.deploy-errors.ts
6598
+ // extensions/discord/src/monitor/provider.deploy-errors.ts
6642
6599
  const DISCORD_DEPLOY_REJECTED_ENTRY_LIMIT = 3;
6643
6600
  function stringifyDiscordDeployField(value, depth = 2) {
6644
6601
  try {
@@ -6747,8 +6704,7 @@ function formatDiscordDeployErrorDetails(err) {
6747
6704
  function isDiscordDeployDailyCreateLimit(err) {
6748
6705
  return err instanceof DiscordError && err.discordCode === 30034 && /daily application command creates/i.test(err.message);
6749
6706
  }
6750
- //#endregion
6751
- //#region extensions/discord/src/monitor/provider.deploy.ts
6707
+ // extensions/discord/src/monitor/provider.deploy.ts
6752
6708
  function runDiscordCommandDeployInBackground(params) {
6753
6709
  if (!params.enabled) return;
6754
6710
  async function deployDiscordCommands() {
@@ -6772,11 +6728,9 @@ function runDiscordCommandDeployInBackground(params) {
6772
6728
  params.runtime.log?.(warn(`[${params.accountId}] slash command deploy failed in background (message send/receive unaffected): ${formatErrorMessage$1(err)}`));
6773
6729
  });
6774
6730
  }
6775
- //#endregion
6776
- //#region extensions/discord/src/monitor/gateway-handle.ts
6731
+ // extensions/discord/src/monitor/gateway-handle.ts
6777
6732
  const DISCORD_GATEWAY_TRANSPORT_ACTIVITY_EVENT = "openclaw:discord-gateway-transport-activity";
6778
- //#endregion
6779
- //#region extensions/discord/src/monitor/status.ts
6733
+ // extensions/discord/src/monitor/status.ts
6780
6734
  /** READY proves a prior terminal failure was repaired, so the account is restartable again. */
6781
6735
  function createDiscordReadyStatusPatch(at = Date.now()) {
6782
6736
  return channelReadyPatch({
@@ -6785,8 +6739,7 @@ function createDiscordReadyStatusPatch(at = Date.now()) {
6785
6739
  lastDisconnect: null
6786
6740
  });
6787
6741
  }
6788
- //#endregion
6789
- //#region extensions/discord/src/monitor/provider.lifecycle.ts
6742
+ // extensions/discord/src/monitor/provider.lifecycle.ts
6790
6743
  const DEFAULT_DISCORD_GATEWAY_READY_TIMEOUT_MS = 15e3;
6791
6744
  const DEFAULT_DISCORD_GATEWAY_RUNTIME_READY_TIMEOUT_MS = 3e4;
6792
6745
  const MAX_DISCORD_GATEWAY_READY_TIMEOUT_MS = 12e4;
@@ -6834,7 +6787,17 @@ async function runDiscordGatewayLifecycle(params) {
6834
6787
  const gatewayEmitter = params.gatewaySupervisor.emitter;
6835
6788
  const loggingRuntime = params.runtime;
6836
6789
  let lifecycleStopping = false;
6790
+ let hasConnected = gatewayReadyAtLifecycleStart;
6791
+ let reconnectStartedAt;
6837
6792
  const pushStatus = (patch) => {
6793
+ if (patch.connected === true) {
6794
+ if (reconnectStartedAt !== void 0) loggingRuntime.log?.("discord gateway: connection recovered");
6795
+ hasConnected = true;
6796
+ reconnectStartedAt = void 0;
6797
+ } else if (patch.connected === false && patch.lifecycle === "recovering") patch.lastDisconnect = hasConnected ? {
6798
+ ...typeof patch.lastDisconnect === "object" ? patch.lastDisconnect : {},
6799
+ at: reconnectStartedAt ??= Date.now()
6800
+ } : null;
6838
6801
  params.statusSink?.(patch);
6839
6802
  };
6840
6803
  const gatewayReadyTimeoutMs = normalizeGatewayReadyTimeoutMs(process.env[DISCORD_GATEWAY_READY_TIMEOUT_ENV]) ?? DEFAULT_DISCORD_GATEWAY_READY_TIMEOUT_MS;
@@ -7075,8 +7038,7 @@ async function runDiscordGatewayLifecycle(params) {
7075
7038
  }
7076
7039
  }
7077
7040
  }
7078
- //#endregion
7079
- //#region extensions/discord/src/internal/voice.ts
7041
+ // extensions/discord/src/internal/voice.ts
7080
7042
  var VoicePlugin = class {
7081
7043
  constructor() {
7082
7044
  this.id = "voice";
@@ -7110,8 +7072,7 @@ var VoicePlugin = class {
7110
7072
  };
7111
7073
  }
7112
7074
  };
7113
- //#endregion
7114
- //#region extensions/discord/src/monitor/presence.ts
7075
+ // extensions/discord/src/monitor/presence.ts
7115
7076
  const DEFAULT_CUSTOM_ACTIVITY_TYPE = 4;
7116
7077
  const CUSTOM_STATUS_NAME = "Custom Status";
7117
7078
  function resolveDiscordPresenceUpdate(config) {
@@ -7140,8 +7101,7 @@ function resolveDiscordPresenceUpdate(config) {
7140
7101
  afk: false
7141
7102
  };
7142
7103
  }
7143
- //#endregion
7144
- //#region extensions/discord/src/monitor/auto-presence.ts
7104
+ // extensions/discord/src/monitor/auto-presence.ts
7145
7105
  const DEFAULT_INTERVAL_MS = 3e4;
7146
7106
  const DEFAULT_MIN_UPDATE_INTERVAL_MS = 15e3;
7147
7107
  const MIN_INTERVAL_MS = 5e3;
@@ -7234,8 +7194,7 @@ function createDiscordAutoPresenceController(params) {
7234
7194
  stop: () => scheduler.stop()
7235
7195
  };
7236
7196
  }
7237
- //#endregion
7238
- //#region extensions/discord/src/monitor/gateway-metadata.ts
7197
+ // extensions/discord/src/monitor/gateway-metadata.ts
7239
7198
  const DISCORD_GATEWAY_BOT_URL = "https://discord.com/api/v10/gateway/bot";
7240
7199
  const DISCORD_API_HOST = "discord.com";
7241
7200
  const DEFAULT_DISCORD_GATEWAY_URL = "wss://gateway.discord.gg/";
@@ -7388,8 +7347,7 @@ async function fetchDiscordGatewayMetadataGuarded(input, init, options) {
7388
7347
  }).catch(() => {});
7389
7348
  return response;
7390
7349
  }
7391
- //#endregion
7392
- //#region extensions/discord/src/monitor/gateway-plugin.ts
7350
+ // extensions/discord/src/monitor/gateway-plugin.ts
7393
7351
  const DISCORD_GATEWAY_POLICY_VIOLATION_CLOSE_CODE = 1008;
7394
7352
  const DISCORD_GATEWAY_WS_RECEIVER_LIMIT_CODE = "WS_ERR_TOO_MANY_BUFFERED_PARTS";
7395
7353
  const DISCORD_GATEWAY_CLOSE_REASON_LOG_MAX_CHARS = 240;
@@ -7594,8 +7552,7 @@ function waitForDiscordGatewayPluginRegistration(plugin) {
7594
7552
  if (typeof plugin !== "object" || plugin === null) return;
7595
7553
  return registrationPromises.get(plugin);
7596
7554
  }
7597
- //#endregion
7598
- //#region extensions/discord/src/monitor/message-handler.preflight-channel-access.ts
7555
+ // extensions/discord/src/monitor/message-handler.preflight-channel-access.ts
7599
7556
  function resolveDiscordPreflightChannelAccess(params) {
7600
7557
  if (params.isGuildMessage && params.channelConfig?.enabled === false) {
7601
7558
  logVerbose(`Blocked discord channel ${params.messageChannelId} (channel disabled, ${params.channelMatchMeta})`);
@@ -7627,8 +7584,7 @@ function resolveDiscordPreflightChannelAccess(params) {
7627
7584
  }
7628
7585
  return true;
7629
7586
  }
7630
- //#endregion
7631
- //#region extensions/discord/src/monitor/listeners.guild-join.ts
7587
+ // extensions/discord/src/monitor/listeners.guild-join.ts
7632
7588
  const DISCORD_GUILD_JOIN_INTRO_MAX_AGE_MS = 3e5;
7633
7589
  var DiscordGuildJoinIntroductionListener = class extends GuildCreateListener {
7634
7590
  constructor(params) {
@@ -7752,8 +7708,7 @@ var DiscordGuildJoinIntroductionListener = class extends GuildCreateListener {
7752
7708
  await Promise.allSettled(this.pendingReports);
7753
7709
  }
7754
7710
  };
7755
- //#endregion
7756
- //#region extensions/discord/src/monitor/provider.startup.ts
7711
+ // extensions/discord/src/monitor/provider.startup.ts
7757
7712
  async function createDiscordMonitorClient(params) {
7758
7713
  let autoPresenceController = null;
7759
7714
  const gateway = createDiscordGatewayPlugin(params);
@@ -7895,8 +7850,7 @@ function registerDiscordMonitorListeners(params) {
7895
7850
  }
7896
7851
  };
7897
7852
  }
7898
- //#endregion
7899
- //#region extensions/discord/src/monitor/questions.ts
7853
+ // extensions/discord/src/monitor/questions.ts
7900
7854
  function createDiscordQuestionButton(params) {
7901
7855
  const authContext = params.authContext ?? {
7902
7856
  cfg: params.cfg,
@@ -7946,15 +7900,13 @@ function createDiscordQuestionButton(params) {
7946
7900
  }
7947
7901
  };
7948
7902
  }
7949
- //#endregion
7950
- //#region extensions/discord/src/monitor/startup-status.ts
7903
+ // extensions/discord/src/monitor/startup-status.ts
7951
7904
  function formatDiscordStartupStatusMessage(params) {
7952
7905
  const identitySuffix = params.botIdentity ? ` as ${params.botIdentity}` : "";
7953
7906
  if (params.gatewayReady) return `logged in to discord${identitySuffix}`;
7954
7907
  return `discord client initialized${identitySuffix}; awaiting gateway readiness`;
7955
7908
  }
7956
- //#endregion
7957
- //#region extensions/discord/src/monitor/provider.ts
7909
+ // extensions/discord/src/monitor/provider.ts
7958
7910
  const DEFAULT_DISCORD_MEDIA_MAX_MB = 100;
7959
7911
  const DISCORD_ACP_STATUS_PROBE_TIMEOUT_MS = 8e3;
7960
7912
  const DISCORD_ACP_STALE_RUNNING_ACTIVITY_MS = 12e4;
@@ -8015,7 +7967,7 @@ async function monitorDiscordProvider(opts) {
8015
7967
  cfg,
8016
7968
  accountId: account.accountId
8017
7969
  }) ?? "pairing";
8018
- const discordProviderSessionRuntime = await import("./provider-session.runtime-3cZpps3H.mjs");
7970
+ const discordProviderSessionRuntime = await import("./provider-session.runtime-Cr2oPicL.mjs");
8019
7971
  const threadBindingIdleTimeoutMs = discordProviderSessionRuntime.resolveThreadBindingIdleTimeoutMs({
8020
7972
  channelIdleHoursRaw: discordCfg.threadBindings?.idleHours,
8021
7973
  sessionIdleHoursRaw: cfg.session?.threadBindings?.idleHours
@@ -8326,8 +8278,8 @@ async function monitorDiscordProvider(opts) {
8326
8278
  };
8327
8279
  let voiceManager = null;
8328
8280
  if (voiceEnabled) {
8329
- const { DiscordVoiceManager } = await import("./voice-runtime-oJ6BZs5D.mjs");
8330
- const { DiscordVoiceGuildCreateListener, DiscordVoiceReadyListener, DiscordVoiceResumedListener, DiscordVoiceStateUpdateListener } = await import("./listeners-DnHLrLIN.mjs");
8281
+ const { DiscordVoiceManager } = await import("./voice-runtime-CZGbraKC.mjs");
8282
+ const { DiscordVoiceGuildCreateListener, DiscordVoiceReadyListener, DiscordVoiceResumedListener, DiscordVoiceStateUpdateListener } = await import("./listeners-DIyynRvV.mjs");
8331
8283
  voiceManager = new DiscordVoiceManager({
8332
8284
  ...monitorOptions,
8333
8285
  scheduler
@@ -8423,5 +8375,4 @@ async function monitorDiscordProvider(opts) {
8423
8375
  }
8424
8376
  }
8425
8377
  }
8426
- //#endregion
8427
8378
  export { resolveDiscordTextCommandAccess as A, buildDiscordInboundAccessContext as C, createMessageDispatchData as D, createDiscordLivePolicyReader as E, registerDiscordListener as O, buildDiscordGroupSystemPrompt as S, handleDiscordDmCommandDecision as T, isDiscordRealtimeVoiceMode as _, waitForDiscordGatewayPluginRegistration as a, resolveDiscordVoiceMode as b, formatDiscordReplySkip as c, buildGuildLabel as d, resolveReplyContext as f, VOICE_RECONNECT_GRACE_MS as g, VOICE_CONNECT_READY_TIMEOUT_MS as h, resolveDiscordGatewayIntents as i, resolveDiscordDmCommandAccess as k, sanitizeDiscordFrontChannelReplyPayloads as l, MIN_SEGMENT_SECONDS as m, resolveDiscordPreflightChannelAccess as n, deliverDiscordReply as o, CAPTURE_FINALIZE_GRACE_MS as p, createDiscordGatewayPlugin as r, formatDiscordReplyDeliveryFailure as s, monitorDiscordProvider as t, buildDirectLabel as u, isVoiceChannel as v, createDiscordSupplementalContextAccessChecker as w, createDiscordNativeCommand as x, logVoiceVerbose as y };