@openclaw/discord 2026.9.6 → 2026.9.7

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 (150) hide show
  1. package/assets/icon.png +0 -0
  2. package/dist/.setup/{account-inspect-BwQj24ht.mjs → account-inspect-De8hOUxG.mjs} +1 -1
  3. package/dist/.setup/{accounts-CwJQoLjM.mjs → accounts-ChaMcixG.mjs} +1 -4
  4. package/dist/.setup/{activities-api-COU4-0nR.mjs → activities-api-tvbsU2e3.mjs} +38 -66
  5. package/dist/.setup/{api-CBK9zcq5.mjs → api-DVbJwZVt.mjs} +10 -2
  6. package/dist/.setup/{approval-handler.runtime-CbBktBb4.mjs → approval-handler.runtime-DxCK2Rux.mjs} +49 -125
  7. package/dist/.setup/{approval-message-updates-jf9zMaIC.mjs → approval-message-updates-BKFqavHZ.mjs} +2 -2
  8. package/dist/.setup/{audit-vKbh-LFR.mjs → audit-CLg9I71N.mjs} +5 -5
  9. package/dist/.setup/{channel-Dv4e3Jpc.mjs → channel-DxlUVU9t.mjs} +121 -227
  10. package/dist/.setup/{channel-type-DKnjV1XW.mjs → channel-type-DRCrEMss.mjs} +22 -22
  11. package/dist/.setup/{channel.setup-0NX6FFwi.mjs → channel.setup-CRo1GjV7.mjs} +6 -9
  12. package/dist/.setup/{components-yBEb75bB.mjs → components-Cq1PvIpN.mjs} +41 -69
  13. package/dist/.setup/{config-schema-CiZz-mtA.mjs → config-schema-oxELUSDx.mjs} +19 -44
  14. package/dist/.setup/{conversation-binding-route-B7qImK_b.mjs → conversation-binding-route-Caz_XuFH.mjs} +10 -5
  15. package/dist/.setup/{directory-config-BytTftz-.mjs → directory-config-esqNn0Eo.mjs} +6 -9
  16. package/dist/.setup/{directory-live--EGTH0DC.mjs → directory-live-DtKRHuGV.mjs} +6 -12
  17. package/dist/.setup/{discord-BXpHW-cu.mjs → discord-0xJYfdDD.mjs} +82 -386
  18. package/dist/.setup/{doctor-D1R-uFIu.mjs → doctor-BCl1H5tl.mjs} +21 -36
  19. package/dist/.setup/{doctor-contract-Co5vRCZ6.mjs → doctor-contract-CvvgwrrG.mjs} +41 -50
  20. package/dist/.setup/{channel-actions.runtime-leZuw01r.mjs → handle-action-CUvQWnE7.mjs} +67 -104
  21. package/dist/.setup/{handle-action.guild-admin-DcFa8NwA.mjs → handle-action.guild-admin-Df-8gVle.mjs} +62 -120
  22. package/dist/.setup/{live-policy-config-eKQ-PLdy.mjs → live-policy-config-8Pv20CHc.mjs} +2 -3
  23. package/dist/.setup/{message-handler-X6ejmbtY.mjs → message-handler-B-Jk4oDk.mjs} +18 -94
  24. package/dist/.setup/{message-handler.preflight-pluralkit-8Xji34AF.mjs → message-handler.preflight-pluralkit-CWLUBVcx.mjs} +8 -10
  25. package/dist/.setup/{message-handler.preflight-DE_POxFc.mjs → message-handler.preflight-v-__NSDq.mjs} +69 -180
  26. package/dist/.setup/{message-handler.process-CCmIVnxy.mjs → message-handler.process-BNFFuChn.mjs} +65 -86
  27. package/dist/.setup/{outbound-adapter-ClIgmu4F.mjs → outbound-adapter-BobT-kse.mjs} +105 -19
  28. package/dist/.setup/{outbound-session-route-VulUE0yV.mjs → outbound-session-route-zVGxxceg.mjs} +140 -108
  29. package/dist/.setup/{pluralkit-CdAt1G0P.mjs → pluralkit-a6_NLfH9.mjs} +1 -1
  30. package/dist/.setup/{presence-cache-dYSHPWMx.mjs → presence-cache-Di3H3DIU.mjs} +0 -4
  31. package/dist/.setup/{probe-CupW4we4.mjs → probe-LYrIHlBF.mjs} +13 -4
  32. package/dist/.setup/{provider-iOf73HW-.mjs → provider-B_G5hASF.mjs} +721 -1416
  33. package/dist/.setup/provider-session.runtime-BYlTBFD2.mjs +6 -0
  34. package/dist/.setup/provider.runtime-CUE3UxER.mjs +2 -0
  35. package/dist/.setup/{realtime-session.runtime-Dz8uVutq.mjs → realtime-session.runtime-oUd9DOcz.mjs} +41 -55
  36. package/dist/.setup/{receive-recovery-DHst8WRx.mjs → receive-recovery-CHPOsnLc.mjs} +1 -4
  37. package/dist/.setup/{resolve-allowlist-common-CwMBzbx9.mjs → resolve-allowlist-common-DPdRggu5.mjs} +4 -7
  38. package/dist/.setup/{resolve-channels-BbvsLQOZ.mjs → resolve-channels-BFPNRmVv.mjs} +21 -40
  39. package/dist/.setup/{resolve-users-ByFlR7LQ.mjs → resolve-users-0-aBuCy3.mjs} +4 -4
  40. package/dist/.setup/{retry-BEYkDy0P.mjs → retry-pz_cSha2.mjs} +3 -3
  41. package/dist/.setup/rolldown-runtime-B4FMCO8f.mjs +28 -0
  42. package/dist/.setup/{runtime-B8lJfyrA.mjs → runtime-FN000lxA.mjs} +60 -162
  43. package/dist/.setup/runtime-doctor-migrations-CshUGl36.mjs +159 -0
  44. package/dist/.setup/{runtime-DisDbixd.mjs → runtime-sUksZ--Q.mjs} +2 -5
  45. package/dist/.setup/{secret-config-contract-DFu9hfU8.mjs → secret-config-contract-uOE2J7yM.mjs} +15 -85
  46. package/dist/.setup/{security-audit-s5w50-Ly.mjs → security-audit-Cdaegq7C.mjs} +3 -1
  47. package/dist/.setup/{send-CIBzvXjS.mjs → send-CrfEI6Bs.mjs} +53 -108
  48. package/dist/.setup/{send.components-ChY21qr-.mjs → send.components-DxQAMfES.mjs} +62 -107
  49. package/dist/.setup/{send.outbound-QTyuFupn.mjs → send.outbound-BISKnb-a.mjs} +66 -140
  50. package/dist/.setup/{send.shared-VNvWfX2T.mjs → send.shared-DGFkbkQR.mjs} +10 -25
  51. package/dist/.setup/{sender-identity-0Ymgvmaj.mjs → sender-identity-B9X5Vb9R.mjs} +2 -3
  52. package/dist/.setup/setup-plugin-api-BQUBxbhe.mjs +3 -0
  53. package/dist/.setup/{shared-DHPDaMSx.mjs → shared-B3wZ4hN-.mjs} +25 -32
  54. package/dist/.setup/{subagent-hooks-CjW7r8Pe.mjs → subagent-hooks-nlUE9ow7.mjs} +5 -6
  55. package/dist/.setup/system-events-CdeZnvPV.mjs +33 -0
  56. package/dist/.setup/{target-resolver-BXpy6VT8.mjs → target-resolver-BuLapkhy.mjs} +9 -12
  57. package/dist/.setup/targets-0KUcEIYx.mjs +3 -0
  58. package/dist/.setup/{thread-bindings-CEh2dhqP.mjs → thread-bindings-D7TfgjR_.mjs} +33 -35
  59. package/dist/.setup/{thread-bindings.manager-ve-i6oqt.mjs → thread-bindings.manager-DN-NissX.mjs} +325 -233
  60. package/dist/.setup/thread-bindings.session-updates-CshfKghV.mjs +359 -0
  61. package/dist/.setup/{thread-bindings.state-BThFQEga.mjs → thread-bindings.state-g6v9zAym.mjs} +21 -62
  62. package/dist/.setup/{transcripts-source-DVegW0WI.mjs → transcripts-source-p8EV179h.mjs} +76 -235
  63. package/dist/.setup/{typing-BKZL5fGj.mjs → typing-BiHCzBRu.mjs} +2 -1
  64. package/dist/.setup/{voice-runtime-elTtjEIG.mjs → voice-runtime-B46rcwrG.mjs} +140 -244
  65. package/dist/account-inspect-api.js +1 -1
  66. package/dist/action-runtime-api.js +1 -1
  67. package/dist/activities-api.js +1 -1
  68. package/dist/api.js +18 -18
  69. package/dist/channel-config-api.js +1 -1
  70. package/dist/channel-plugin-api.js +1 -1
  71. package/dist/directory-contract-api.js +1 -1
  72. package/dist/doctor-contract-api.js +4 -4
  73. package/dist/index.js +1 -1
  74. package/dist/runtime-api.js +20 -20
  75. package/dist/secret-contract-api.js +1 -1
  76. package/dist/security-audit-contract-api.js +1 -1
  77. package/dist/setup-entry.js +1 -1
  78. package/dist/setup-plugin-api.js +1 -1
  79. package/dist/src/voice/audio-worker.runtime.js +15 -24
  80. package/dist/subagent-hooks-api.js +3 -4
  81. package/dist/transcripts-source-api.js +1 -1
  82. package/node_modules/@types/node/README.md +2 -2
  83. package/node_modules/@types/node/child_process.d.ts +1 -1
  84. package/node_modules/@types/node/crypto.d.ts +20 -8
  85. package/node_modules/@types/node/ffi.d.ts +14 -0
  86. package/node_modules/@types/node/http2.d.ts +3 -2
  87. package/node_modules/@types/node/net.d.ts +16 -4
  88. package/node_modules/@types/node/package.json +2 -17
  89. package/node_modules/@types/node/process.d.ts +1 -0
  90. package/node_modules/@types/node/quic.d.ts +39 -1
  91. package/node_modules/@types/node/stream/iter.d.ts +9 -12
  92. package/node_modules/@types/node/test/reporters.d.ts +1 -0
  93. package/node_modules/@types/node/test.d.ts +72 -0
  94. package/node_modules/@types/node/tls.d.ts +14 -10
  95. package/node_modules/@types/node/vm.d.ts +2 -1
  96. package/node_modules/@types/node/worker_threads.d.ts +4 -1
  97. package/node_modules/typebox/build/compile/code.mjs +1 -2
  98. package/node_modules/typebox/build/compile/validator.mjs +5 -1
  99. package/node_modules/typebox/build/format/iri.mjs +16 -9
  100. package/node_modules/typebox/build/guard/emit.mjs +2 -2
  101. package/node_modules/typebox/build/guard/guard.d.mts +7 -5
  102. package/node_modules/typebox/build/guard/guard.mjs +14 -9
  103. package/node_modules/typebox/build/guard/index.mjs +6 -0
  104. package/node_modules/typebox/build/guard/unicode/unicode.d.mts +6 -0
  105. package/node_modules/typebox/build/guard/unicode/unicode.mjs +35 -0
  106. package/node_modules/typebox/build/guard/{string.mjs → unicode/unicode_segment.mjs} +16 -19
  107. package/node_modules/typebox/build/schema/build.mjs +2 -3
  108. package/node_modules/typebox/build/schema/engine/_pathing.d.mts +1 -0
  109. package/node_modules/typebox/build/schema/engine/_pathing.mjs +11 -0
  110. package/node_modules/typebox/build/schema/engine/_refine.mjs +13 -5
  111. package/node_modules/typebox/build/schema/engine/additionalProperties.mjs +2 -1
  112. package/node_modules/typebox/build/schema/engine/dependencies.mjs +2 -1
  113. package/node_modules/typebox/build/schema/engine/dependentSchemas.mjs +2 -1
  114. package/node_modules/typebox/build/schema/engine/dynamicRef.d.mts +1 -1
  115. package/node_modules/typebox/build/schema/engine/dynamicRef.mjs +2 -2
  116. package/node_modules/typebox/build/schema/engine/format.mjs +9 -2
  117. package/node_modules/typebox/build/schema/engine/patternProperties.mjs +3 -2
  118. package/node_modules/typebox/build/schema/engine/properties.mjs +3 -2
  119. package/node_modules/typebox/build/schema/engine/propertyNames.mjs +2 -1
  120. package/node_modules/typebox/build/schema/engine/recursiveRef.d.mts +1 -1
  121. package/node_modules/typebox/build/schema/engine/recursiveRef.mjs +2 -2
  122. package/node_modules/typebox/build/schema/engine/ref.d.mts +1 -1
  123. package/node_modules/typebox/build/schema/engine/ref.mjs +2 -2
  124. package/node_modules/typebox/build/schema/engine/schema.mjs +24 -24
  125. package/node_modules/typebox/build/schema/parse.mjs +3 -0
  126. package/node_modules/typebox/build/schema/pointer/pointer.d.mts +1 -6
  127. package/node_modules/typebox/build/schema/pointer/pointer.mjs +47 -64
  128. package/node_modules/typebox/build/system/settings/internal.d.mts +2 -0
  129. package/node_modules/typebox/build/system/settings/internal.mjs +20 -0
  130. package/node_modules/typebox/build/system/settings/settings.d.mts +11 -0
  131. package/node_modules/typebox/build/system/settings/settings.mjs +14 -0
  132. package/node_modules/typebox/build/type/extends/inference.d.mts +1 -1
  133. package/node_modules/typebox/build/type/extends/inference.mjs +15 -2
  134. package/node_modules/typebox/build/type/extends/tuple.d.mts +2 -1
  135. package/node_modules/typebox/build/type/extends/tuple.mjs +21 -1
  136. package/node_modules/typebox/build/value/parse/parse.mjs +10 -4
  137. package/node_modules/typebox/package.json +1 -1
  138. package/node_modules/typebox/readme.md +3 -1
  139. package/openclaw.plugin.json +21 -1
  140. package/package.json +5 -5
  141. package/dist/.setup/agent-components.runtime-CEPrf2SY.mjs +0 -4
  142. package/dist/.setup/probe.runtime-DBQ_AGPe.mjs +0 -2
  143. package/dist/.setup/provider-session.runtime-DrGAYnZv.mjs +0 -6
  144. package/dist/.setup/provider.runtime-BmjW_pIw.mjs +0 -2
  145. package/dist/.setup/security-audit.runtime-DHtYenx9.mjs +0 -2
  146. package/dist/.setup/setup-plugin-api-Dvr41dyx.mjs +0 -3
  147. package/dist/.setup/system-events-B2YEEMbS.mjs +0 -34
  148. package/dist/.setup/targets-CvemhN3i.mjs +0 -3
  149. package/dist/.setup/thread-bindings.session-updates-DCQq1WZ5.mjs +0 -55
  150. /package/node_modules/typebox/build/guard/{string.d.mts → unicode/unicode_segment.d.mts} +0 -0
@@ -1,18 +1,20 @@
1
- import { c as resolveDiscordAccount, i as listDiscordStartupAccountIds, l as resolveDiscordAccountAllowFrom, r as listDiscordAccountIds, s as resolveDefaultDiscordAccountId, u as resolveDiscordAccountConfig } from "./accounts-CwJQoLjM.mjs";
1
+ import { C as withDiscordRequestAuthority } from "./discord-0xJYfdDD.mjs";
2
+ import { c as resolveDiscordAccount, i as listDiscordStartupAccountIds, l as resolveDiscordAccountAllowFrom, r as listDiscordAccountIds, s as resolveDefaultDiscordAccountId, u as resolveDiscordAccountConfig } from "./accounts-ChaMcixG.mjs";
2
3
  import { t as getDiscordRuntime } from "./runtime-DgnVQ7zW.mjs";
3
- import { _ as normalizeDiscordMessagingTarget, g as matchesDiscordToolContextTarget, h as looksLikeDiscordTargetId, y as parseDiscordTarget } from "./retry-BEYkDy0P.mjs";
4
+ import { _ as matchesDiscordToolContextTarget, b as parseDiscordTarget, g as looksLikeDiscordTargetId, v as normalizeDiscordMessagingTarget } from "./retry-pz_cSha2.mjs";
4
5
  import { u as withAbortTimeout } from "./timeouts-D86uWLt_.mjs";
5
- import { A as createChannelApproverDmTargetResolver, D as isDiscordExecApprovalClientEnabled, E as isDiscordExecApprovalApprover, M as isChannelExecApprovalClientEnabledFromConfig, N as matchesApprovalRequestFilters, O as shouldSuppressLocalDiscordExecApprovalPrompt, T as getDiscordExecApprovalApprovers, _ as resolveDiscordRuntimeBindingConversationId, f as resolveDiscordConversationRoute, g as resolveDiscordCurrentConversationIdentity, j as createChannelNativeOriginTargetResolver, k as createApproverRestrictedNativeApprovalCapability, t as resolveDiscordOutboundSessionRoute, v as discordMessageActions, w as resolveRequiredDiscordChannelPermissions } from "./outbound-session-route-VulUE0yV.mjs";
6
- import { a as discordSecurityAdapter, c as buildTokenChannelStatusSummary, i as discordSetupContract, l as projectCredentialSnapshotFields, n as discordConfigAdapter, o as DEFAULT_ACCOUNT_ID$1, s as PAIRING_APPROVED_MESSAGE, t as createDiscordPluginBase, u as resolveConfiguredFromCredentialStatuses } from "./shared-DHPDaMSx.mjs";
6
+ import { D as isDiscordExecApprovalClientEnabled, E as isDiscordExecApprovalApprover, O as shouldSuppressLocalDiscordExecApprovalPrompt, T as getDiscordExecApprovalApprovers, _ as resolveDiscordRuntimeBindingConversationId, f as resolveDiscordConversationRoute, t as resolveDiscordOutboundSessionRoute, v as discordMessageActions, w as resolveRequiredDiscordChannelPermissions } from "./outbound-session-route-zVGxxceg.mjs";
7
+ import { a as normalizeDiscordAcpConversationId, c as resolveDiscordInboundConversation, i as matchDiscordAcpConversation, n as discordOutbound, o as resolveDiscordAttachedOutboundTarget, r as buildDiscordCrossContextPresentation, s as resolveDiscordCommandConversation } from "./outbound-adapter-BobT-kse.mjs";
7
8
  import { r as openDiscordCommandDeployHashStore } from "./command-deploy-store-DFkBTViB.mjs";
8
- import { t as resolveDiscordConversationBindingRoute } from "./conversation-binding-route-B7qImK_b.mjs";
9
- import { n as setThreadBindingMaxAgeBySessionKey, t as setThreadBindingIdleTimeoutBySessionKey } from "./thread-bindings.session-updates-DCQq1WZ5.mjs";
10
- import { n as discordOutbound } from "./outbound-adapter-ClIgmu4F.mjs";
9
+ import { t as resolveDiscordConversationBindingRoute } from "./conversation-binding-route-Caz_XuFH.mjs";
10
+ import { a as discordSecurityAdapter, i as discordSetupContract, n as discordConfigAdapter, t as createDiscordPluginBase } from "./shared-B3wZ4hN-.mjs";
11
11
  import { t as normalizeExplicitDiscordSessionKey } from "./session-key-normalization-wJgsKPNF.mjs";
12
+ import { i as setThreadBindingMaxAgeBySessionKeyAsync, n as setThreadBindingIdleTimeoutBySessionKeyAsync, r as setThreadBindingMaxAgeBySessionKey, t as setThreadBindingIdleTimeoutBySessionKey } from "./thread-bindings.session-updates-CshfKghV.mjs";
12
13
  import { t as defaultTopLevelPlacement } from "./thread-binding-api-BDZJD4na.mjs";
13
14
  import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
14
- import { normalizeAccountId } from "openclaw/plugin-sdk/account-id";
15
- import { normalizeLowercaseStringOrEmpty, normalizeOptionalString, normalizeOptionalStringifiedId } from "openclaw/plugin-sdk/string-coerce-runtime";
15
+ import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "openclaw/plugin-sdk/account-id";
16
+ import { PAIRING_APPROVED_MESSAGE, buildTokenChannelStatusSummary, projectCredentialSnapshotFields, resolveConfiguredFromCredentialStatuses } from "openclaw/plugin-sdk/channel-status";
17
+ import { normalizeLowercaseStringOrEmpty, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
16
18
  import { createRuntimeConfigReader } from "openclaw/plugin-sdk/runtime-config-snapshot";
17
19
  import { sleepWithAbort } from "openclaw/plugin-sdk/runtime-env";
18
20
  import { createChannelMessageAdapterFromOutbound } from "openclaw/plugin-sdk/channel-outbound";
@@ -24,8 +26,10 @@ import { createPairingPrefixStripper } from "openclaw/plugin-sdk/channel-pairing
24
26
  import { createChannelDirectoryAdapter, createRuntimeDirectoryLiveAdapter } from "openclaw/plugin-sdk/directory-runtime";
25
27
  import { appendMatchMetadata, createComputedAccountStatusAdapter, createDefaultChannelRuntimeState, isRecord as isRecord$1, readAccountStatusSnapshot, resolveEnabledConfiguredAccountId } from "openclaw/plugin-sdk/status-helpers";
26
28
  import { resolveTargetsWithOptionalToken } from "openclaw/plugin-sdk/target-resolver-runtime";
29
+ import { createApproverRestrictedNativeApprovalCapability } from "openclaw/plugin-sdk/approval-delivery-runtime";
27
30
  import { createLazyChannelApprovalNativeRuntimeAdapter } from "openclaw/plugin-sdk/approval-handler-adapter-runtime";
28
- import { doesApprovalRequestSelectChannelAccount, resolveApprovalRequestSessionConversation } from "openclaw/plugin-sdk/approval-native-runtime";
31
+ import { createChannelApproverDmTargetResolver, createChannelNativeOriginTargetResolver, doesApprovalRequestSelectChannelAccount, resolveApprovalRequestSessionConversation } from "openclaw/plugin-sdk/approval-native-runtime";
32
+ import { isChannelExecApprovalClientEnabledFromConfig, matchesApprovalRequestFilters } from "openclaw/plugin-sdk/approval-client-runtime";
29
33
  import { resolveThreadBindingSpawnPolicy } from "openclaw/plugin-sdk/conversation-runtime";
30
34
  import { resolveScopeRequireMention, resolveScopeToolsPolicy, scopeKey } from "openclaw/plugin-sdk/channel-policy";
31
35
  import { normalizeAtHashSlug } from "openclaw/plugin-sdk/string-normalization-runtime";
@@ -79,14 +83,13 @@ function normalizeDiscordThreadId(value) {
79
83
  const normalized = value.trim();
80
84
  return /^\d+$/.test(normalized) ? normalized : void 0;
81
85
  }
82
- function createDiscordOriginTargetResolver(configOverride) {
86
+ function createDiscordOriginTargetResolver() {
83
87
  return createChannelNativeOriginTargetResolver({
84
88
  channel: "discord",
85
89
  shouldHandleRequest: ({ cfg, accountId, request }) => shouldHandleDiscordApprovalRequest({
86
90
  cfg,
87
91
  accountId,
88
- request,
89
- configOverride
92
+ request
90
93
  }),
91
94
  resolveTurnSourceTarget: (request) => {
92
95
  const sessionConversation = resolveApprovalRequestSessionConversation({
@@ -98,7 +101,7 @@ function createDiscordOriginTargetResolver(configOverride) {
98
101
  const turnSourceChannel = normalizeLowercaseStringOrEmpty(request.request.turnSourceChannel);
99
102
  const rawTurnSourceTo = normalizeOptionalString(request.request.turnSourceTo) ?? "";
100
103
  const turnSourceTo = normalizeDiscordOriginChannelId(rawTurnSourceTo);
101
- const threadId = normalizeDiscordThreadId(request.request.turnSourceThreadId) ?? normalizeDiscordThreadId(sessionConversation?.threadId) ?? void 0;
104
+ const threadId = normalizeDiscordThreadId(request.request.turnSourceThreadId) ?? normalizeDiscordThreadId(sessionConversation?.threadId);
102
105
  const hasExplicitOriginTarget = /^(?:channel|group):/i.test(rawTurnSourceTo);
103
106
  if (turnSourceChannel !== "discord" || !turnSourceTo || sessionKind === "dm") return null;
104
107
  return hasExplicitOriginTarget || sessionKind === "channel" || sessionKind === "group" ? {
@@ -116,7 +119,7 @@ function createDiscordOriginTargetResolver(configOverride) {
116
119
  const targetTo = normalizeDiscordOriginChannelId(sessionTarget.to);
117
120
  return targetTo ? {
118
121
  to: targetTo,
119
- threadId: normalizeDiscordThreadId(sessionTarget.threadId) ?? normalizeDiscordThreadId(sessionConversation?.threadId) ?? void 0
122
+ threadId: normalizeDiscordThreadId(sessionTarget.threadId) ?? normalizeDiscordThreadId(sessionConversation?.threadId)
120
123
  } : null;
121
124
  },
122
125
  resolveFallbackTarget: (request) => {
@@ -129,58 +132,53 @@ function createDiscordOriginTargetResolver(configOverride) {
129
132
  const fallbackChannelId = normalizeDiscordOriginChannelId(sessionConversation?.id);
130
133
  return fallbackChannelId ? {
131
134
  to: fallbackChannelId,
132
- threadId: normalizeDiscordThreadId(sessionConversation?.threadId) ?? void 0
135
+ threadId: normalizeDiscordThreadId(sessionConversation?.threadId)
133
136
  } : null;
134
137
  }
135
138
  });
136
139
  }
137
- function createDiscordApproverDmTargetResolver(configOverride) {
140
+ function createDiscordApproverDmTargetResolver() {
138
141
  return createChannelApproverDmTargetResolver({
139
142
  shouldHandleRequest: ({ cfg, accountId, request }) => shouldHandleDiscordApprovalRequest({
140
143
  cfg,
141
144
  accountId,
142
- request,
143
- configOverride
145
+ request
144
146
  }),
145
147
  resolveApprovers: ({ cfg, accountId }) => getDiscordExecApprovalApprovers({
146
148
  cfg,
147
- accountId,
148
- configOverride
149
+ accountId
149
150
  }),
150
151
  mapApprover: (approver) => ({ to: approver })
151
152
  });
152
153
  }
153
- function createDiscordApprovalCapability(configOverride) {
154
+ function createDiscordApprovalCapability() {
154
155
  return createApproverRestrictedNativeApprovalCapability({
155
156
  channel: "discord",
156
157
  channelLabel: "Discord",
157
158
  describeExecApprovalSetup: ({ accountId }) => {
158
159
  const prefix = accountId && accountId !== "default" ? `channels.discord.accounts.${accountId}` : "channels.discord";
159
- return `Approve it from the Web UI or terminal UI for now. Discord supports native exec approvals for this account. Configure \`${prefix}.execApprovals.approvers\` or \`commands.ownerAllowFrom\`; set \`${prefix}.execApprovals.enabled\` to \`auto\` or \`true\`.`;
160
+ return `Approve it from the Web UI for now. Discord supports native exec approvals for this account. Configure \`${prefix}.execApprovals.approvers\` or \`commands.ownerAllowFrom\`; set \`${prefix}.execApprovals.enabled\` to \`auto\` or \`true\`.`;
160
161
  },
161
162
  listAccountIds: listDiscordAccountIds,
162
163
  hasApprovers: ({ cfg, accountId }) => getDiscordExecApprovalApprovers({
163
164
  cfg,
164
- accountId,
165
- configOverride
165
+ accountId
166
166
  }).length > 0,
167
167
  isExecAuthorizedSender: ({ cfg, accountId, senderId }) => isDiscordExecApprovalApprover({
168
168
  cfg,
169
169
  accountId,
170
- senderId,
171
- configOverride
170
+ senderId
172
171
  }),
173
172
  isNativeDeliveryEnabled: ({ cfg, accountId }) => isDiscordExecApprovalClientEnabled({
174
173
  cfg,
175
- accountId,
176
- configOverride
174
+ accountId
177
175
  }),
178
- resolveNativeDeliveryMode: ({ cfg, accountId }) => configOverride?.target ?? resolveDiscordAccount({
176
+ resolveNativeDeliveryMode: ({ cfg, accountId }) => resolveDiscordAccount({
179
177
  cfg,
180
178
  accountId
181
179
  }).config.execApprovals?.target ?? "dm",
182
- resolveOriginTarget: createDiscordOriginTargetResolver(configOverride),
183
- resolveApproverDmTargets: createDiscordApproverDmTargetResolver(configOverride),
180
+ resolveOriginTarget: createDiscordOriginTargetResolver(),
181
+ resolveApproverDmTargets: createDiscordApproverDmTargetResolver(),
184
182
  notifyOriginWhenDmOnly: true,
185
183
  nativeRuntime: createLazyChannelApprovalNativeRuntimeAdapter({
186
184
  capabilityBoundary: true,
@@ -191,16 +189,14 @@ function createDiscordApprovalCapability(configOverride) {
191
189
  ],
192
190
  isConfigured: ({ cfg, accountId }) => isDiscordExecApprovalClientEnabled({
193
191
  cfg,
194
- accountId,
195
- configOverride
192
+ accountId
196
193
  }),
197
194
  shouldHandle: ({ cfg, accountId, request }) => shouldHandleDiscordApprovalRequest({
198
195
  cfg,
199
196
  accountId,
200
- request,
201
- configOverride
197
+ request
202
198
  }),
203
- load: async () => (await import("./approval-handler.runtime-CbBktBb4.mjs")).discordApprovalNativeRuntime
199
+ load: async () => (await import("./approval-handler.runtime-DxCK2Rux.mjs")).discordApprovalNativeRuntime
204
200
  })
205
201
  });
206
202
  }
@@ -210,119 +206,23 @@ function getDiscordApprovalCapability() {
210
206
  return cachedDiscordApprovalCapability;
211
207
  }
212
208
  //#endregion
213
- //#region extensions/discord/src/channel.conversation.ts
214
- function resolveDiscordAttachedOutboundTarget(params) {
215
- if (params.threadId == null) return params.to;
216
- const threadId = normalizeOptionalStringifiedId(params.threadId) ?? "";
217
- return threadId ? `channel:${threadId}` : params.to;
218
- }
219
- function buildDiscordCrossContextPresentation(params) {
220
- return {
221
- tone: "neutral",
222
- blocks: [...params.message.trim() ? [{
223
- type: "text",
224
- text: params.message
225
- }, { type: "divider" }] : [], {
226
- type: "context",
227
- text: `From ${params.originLabel}`
228
- }]
229
- };
230
- }
231
- function normalizeDiscordAcpConversationId(conversationId) {
232
- const normalized = conversationId.trim();
233
- return normalized ? { conversationId: normalized } : null;
234
- }
235
- function matchDiscordAcpConversation(params) {
236
- if (params.bindingConversationId === params.conversationId) return {
237
- conversationId: params.conversationId,
238
- matchPriority: 2
239
- };
240
- if (params.parentConversationId && params.parentConversationId !== params.conversationId && params.bindingConversationId === params.parentConversationId) return {
241
- conversationId: params.parentConversationId,
242
- matchPriority: 1
243
- };
244
- return null;
245
- }
246
- function resolveDiscordConversationIdFromTargets(targets) {
247
- for (const raw of targets) {
248
- const trimmed = raw?.trim();
249
- if (!trimmed) continue;
250
- try {
251
- const target = parseDiscordTarget(trimmed, { defaultKind: "channel" });
252
- if (target?.normalized) return target.normalized;
253
- } catch {
254
- const mentionMatch = trimmed.match(/^<#(\d+)>$/);
255
- if (mentionMatch?.[1]) return `channel:${mentionMatch[1]}`;
256
- if (/^\d{6,}$/.test(trimmed)) return normalizeDiscordMessagingTarget(trimmed);
257
- }
258
- }
259
- }
260
- function parseDiscordParentChannelFromSessionKey(raw) {
261
- const sessionKey = normalizeLowercaseStringOrEmpty(raw);
262
- if (!sessionKey) return;
263
- const match = sessionKey.match(/(?:^|:)channel:([^:]+)$/);
264
- return match?.[1] ? `channel:${match[1]}` : void 0;
265
- }
266
- function resolveDiscordCommandConversation(params) {
267
- const threadConversation = resolveDiscordThreadConversationRef(params);
268
- if (threadConversation) return threadConversation;
269
- const conversationId = resolveDiscordCurrentConversationIdentity({
270
- from: params.from,
271
- chatType: params.chatType,
272
- originatingTo: params.originatingTo,
273
- commandTo: params.commandTo,
274
- fallbackTo: params.fallbackTo
275
- });
276
- return conversationId ? { conversationId } : null;
277
- }
278
- function resolveDiscordThreadConversationRef(params) {
279
- const threadId = normalizeOptionalStringifiedId(params.threadId);
280
- if (!threadId) return null;
281
- const targets = [
282
- params.originatingTo ?? params.to,
283
- params.commandTo,
284
- params.fallbackTo ?? params.conversationId
285
- ];
286
- const parentConversationId = normalizeDiscordMessagingTarget(normalizeOptionalStringifiedId(params.threadParentId) ?? "") || parseDiscordParentChannelFromSessionKey(params.parentSessionKey) || resolveDiscordConversationIdFromTargets(targets);
287
- return {
288
- conversationId: threadId,
289
- ...parentConversationId && parentConversationId !== threadId ? { parentConversationId } : {}
290
- };
291
- }
292
- function resolveDiscordInboundConversation(params) {
293
- const threadConversation = resolveDiscordThreadConversationRef({
294
- to: params.to,
295
- conversationId: params.conversationId,
296
- threadId: params.threadId,
297
- threadParentId: params.threadParentId
298
- });
299
- if (threadConversation) return threadConversation;
300
- const conversationId = resolveDiscordCurrentConversationIdentity({
301
- from: params.from,
302
- chatType: params.isGroup ? "group" : "direct",
303
- originatingTo: params.to,
304
- fallbackTo: params.conversationId
305
- });
306
- return conversationId ? { conversationId } : null;
307
- }
308
- //#endregion
309
209
  //#region extensions/discord/src/channel.loaders.ts
310
- const loadDiscordDirectoryConfigModule = createLazyRuntimeModule(() => import("./directory-config-BytTftz-.mjs").then((n) => n.t));
311
- const loadDiscordResolveChannelsModule = createLazyRuntimeModule(() => import("./resolve-channels-BbvsLQOZ.mjs").then((n) => n.n));
312
- const loadDiscordResolveUsersModule = createLazyRuntimeModule(() => import("./resolve-users-ByFlR7LQ.mjs").then((n) => n.n));
313
- const loadDiscordThreadBindingsManagerModule = createLazyRuntimeModule(() => import("./thread-bindings.manager-ve-i6oqt.mjs").then((n) => n.i));
314
- const loadDiscordTargetResolverModule = createLazyRuntimeModule(() => import("./target-resolver-BXpy6VT8.mjs").then((n) => n.r));
315
- const loadDiscordProviderRuntime = createLazyRuntimeModule(() => import("./provider.runtime-BmjW_pIw.mjs"));
316
- const loadDiscordProbeRuntime = createLazyRuntimeModule(() => import("./probe.runtime-DBQ_AGPe.mjs"));
210
+ const loadDiscordDirectoryConfigModule = createLazyRuntimeModule(() => import("./directory-config-esqNn0Eo.mjs").then((n) => n.t));
211
+ const loadDiscordResolveChannelsModule = createLazyRuntimeModule(() => import("./resolve-channels-BFPNRmVv.mjs").then((n) => n.n));
212
+ const loadDiscordResolveUsersModule = createLazyRuntimeModule(() => import("./resolve-users-0-aBuCy3.mjs").then((n) => n.n));
213
+ const loadDiscordThreadBindingsManagerModule = createLazyRuntimeModule(() => import("./thread-bindings.manager-DN-NissX.mjs").then((n) => n.r));
214
+ const loadDiscordTargetResolverModule = createLazyRuntimeModule(() => import("./target-resolver-BuLapkhy.mjs").then((n) => n.r));
215
+ const loadDiscordProviderRuntime = createLazyRuntimeModule(() => import("./provider.runtime-CUE3UxER.mjs"));
216
+ const loadDiscordProbeRuntime = createLazyRuntimeModule(() => import("./probe-LYrIHlBF.mjs").then((n) => n.o));
317
217
  async function probeDiscordStatusAccount(params) {
318
218
  const startedAtMs = Date.now();
319
219
  const runtime = await loadDiscordProbeRuntime();
320
220
  const remainingMs = Math.max(1, params.timeoutMs - Math.max(0, Date.now() - startedAtMs));
321
221
  return await runtime.probeDiscord(params.token, remainingMs, { includeApplication: true });
322
222
  }
323
- const loadDiscordAuditModule = createLazyRuntimeModule(() => import("./audit-vKbh-LFR.mjs").then((n) => n.n));
324
- const loadDiscordSendModule = createLazyRuntimeModule(() => import("./send-CIBzvXjS.mjs").then((n) => n.t));
325
- const loadDiscordDirectoryLiveModule = createLazyRuntimeModule(() => import("./directory-live--EGTH0DC.mjs").then((n) => n.t));
223
+ const loadDiscordAuditModule = createLazyRuntimeModule(() => import("./audit-CLg9I71N.mjs").then((n) => n.n));
224
+ const loadDiscordSendModule = createLazyRuntimeModule(() => import("./send-CrfEI6Bs.mjs").then((n) => n.t));
225
+ const loadDiscordDirectoryLiveModule = createLazyRuntimeModule(() => import("./directory-live-DtKRHuGV.mjs").then((n) => n.t));
326
226
  //#endregion
327
227
  //#region extensions/discord/src/conversation-route-owner.ts
328
228
  function inspectDiscordConversationRouteOwner(params) {
@@ -337,8 +237,9 @@ function inspectDiscordConversationRouteOwner(params) {
337
237
  userId: direct ? params.conversation.peerId : void 0,
338
238
  channelId: nativeConversationId
339
239
  });
340
- const route = resolveDiscordConversationRoute({
240
+ const route = ({ boundAgentId }) => resolveDiscordConversationRoute({
341
241
  cfg: params.cfg,
242
+ defaultAgentId: boundAgentId,
342
243
  accountId,
343
244
  guildId: params.conversation.context?.guildId,
344
245
  memberRoleIds: params.conversation.context?.memberRoleIds,
@@ -350,7 +251,7 @@ function inspectDiscordConversationRouteOwner(params) {
350
251
  });
351
252
  const { runtimeRoute, configuredRoute } = resolveDiscordConversationBindingRoute({
352
253
  cfg: params.cfg,
353
- route,
254
+ resolveRoute: route,
354
255
  accountId,
355
256
  runtimeConversationId,
356
257
  configuredConversationId: threadConversationId ?? nativeConversationId,
@@ -366,28 +267,25 @@ function inspectDiscordConversationRouteOwner(params) {
366
267
  if (runtimeRoute.pluginId) return {
367
268
  kind: "plugin",
368
269
  pluginId: runtimeRoute.pluginId,
369
- fallbackAgentId: route.agentId
270
+ fallbackAgentId: runtimeRoute.route.agentId
370
271
  };
371
272
  return {
372
273
  kind: "agent",
373
- agentId: runtimeRoute.boundAgentId ?? configuredRoute?.boundAgentId ?? route.agentId
274
+ agentId: runtimeRoute.boundAgentId ?? configuredRoute?.boundAgentId ?? runtimeRoute.route.agentId
374
275
  };
375
276
  }
376
277
  //#endregion
377
278
  //#region extensions/discord/src/group-policy.ts
378
- function normalizeDiscordSlug(value) {
379
- return normalizeAtHashSlug(value);
380
- }
381
279
  const guildScopeKey = (guildKey) => scopeKey(["guild", guildKey]);
382
280
  const channelScopeKey = (guildKey, channelKey) => scopeKey(["guild", guildKey], ["channel", channelKey]);
383
281
  function resolveDiscordGuildKey(guilds, groupSpace) {
384
282
  if (!guilds || Object.keys(guilds).length === 0) return;
385
283
  const space = normalizeOptionalString(groupSpace) ?? "";
386
284
  if (space && guilds[space]) return space;
387
- const normalized = normalizeDiscordSlug(space);
285
+ const normalized = normalizeAtHashSlug(space);
388
286
  if (normalized && guilds[normalized]) return normalized;
389
287
  if (normalized) {
390
- const match = Object.entries(guilds).find(([, entry]) => normalizeDiscordSlug(entry?.slug ?? void 0) === normalized);
288
+ const match = Object.entries(guilds).find(([, entry]) => normalizeAtHashSlug(entry?.slug ?? void 0) === normalized);
391
289
  if (match) return match[0];
392
290
  }
393
291
  return guilds["*"] ? "*" : void 0;
@@ -395,11 +293,11 @@ function resolveDiscordGuildKey(guilds, groupSpace) {
395
293
  function resolveDiscordChannelKey(channelEntries, params) {
396
294
  if (!channelEntries || Object.keys(channelEntries).length === 0) return;
397
295
  const groupChannel = params.groupChannel;
398
- const channelSlug = normalizeDiscordSlug(groupChannel);
296
+ const channelSlug = normalizeAtHashSlug(groupChannel);
399
297
  if (params.groupId && channelEntries[params.groupId]) return params.groupId;
400
298
  if (channelSlug && channelEntries[channelSlug]) return channelSlug;
401
299
  if (channelSlug && channelEntries[`#${channelSlug}`]) return `#${channelSlug}`;
402
- const normalizedGroupChannel = groupChannel ? normalizeDiscordSlug(groupChannel) : void 0;
300
+ const normalizedGroupChannel = groupChannel ? normalizeAtHashSlug(groupChannel) : void 0;
403
301
  return normalizedGroupChannel !== void 0 && channelEntries[normalizedGroupChannel] ? normalizedGroupChannel : void 0;
404
302
  }
405
303
  function buildDiscordPolicyTree(guilds) {
@@ -448,11 +346,8 @@ function resolveDiscordGroupToolPolicy(params) {
448
346
  }
449
347
  //#endregion
450
348
  //#region extensions/discord/src/status-issues.ts
451
- function readDiscordApplicationSummary(value) {
452
- if (!isRecord$1(value)) return {};
453
- const intentsRaw = value.intents;
454
- if (!isRecord$1(intentsRaw)) return {};
455
- return { intents: { messageContent: intentsRaw.messageContent === "enabled" || intentsRaw.messageContent === "limited" || intentsRaw.messageContent === "disabled" ? intentsRaw.messageContent : void 0 } };
349
+ function isDiscordMessageContentIntentDisabled(value) {
350
+ return isRecord$1(value) && isRecord$1(value.intents) && value.intents.messageContent === "disabled";
456
351
  }
457
352
  function readDiscordPermissionsAuditSummary(value) {
458
353
  if (!isRecord$1(value)) return {};
@@ -492,7 +387,6 @@ function collectDiscordStatusIssues(accounts) {
492
387
  if (!account) continue;
493
388
  const accountId = resolveEnabledConfiguredAccountId(account);
494
389
  if (!accountId) continue;
495
- const app = readDiscordApplicationSummary(account.application);
496
390
  if (account.groupPolicy === "allowlist" && account.guildsConfigured === 0) {
497
391
  const guildGuidance = accountId === "default" ? "Add your server under channels.discord.guilds. If channels.discord.accounts.default.guilds is set, add it there instead." : `Add your server under channels.discord.accounts.${accountId}.guilds.`;
498
392
  issues.push({
@@ -503,7 +397,7 @@ function collectDiscordStatusIssues(accounts) {
503
397
  fix: `${guildGuidance} Refresh channel status after the configuration reload applies.`
504
398
  });
505
399
  }
506
- if (app.intents?.messageContent === "disabled") issues.push({
400
+ if (isDiscordMessageContentIntentDisabled(account.application)) issues.push({
507
401
  channel: "discord",
508
402
  accountId,
509
403
  kind: "intent",
@@ -538,6 +432,47 @@ function collectDiscordStatusIssues(accounts) {
538
432
  return issues;
539
433
  }
540
434
  //#endregion
435
+ //#region extensions/discord/src/thread-bindings-channel.ts
436
+ function toConversationLifecycleBinding(binding) {
437
+ return {
438
+ boundAt: binding.boundAt,
439
+ lastActivityAt: typeof binding.lastActivityAt === "number" ? binding.lastActivityAt : binding.boundAt,
440
+ idleTimeoutMs: typeof binding.idleTimeoutMs === "number" ? binding.idleTimeoutMs : void 0,
441
+ maxAgeMs: typeof binding.maxAgeMs === "number" ? binding.maxAgeMs : void 0
442
+ };
443
+ }
444
+ const discordConversationBindings = {
445
+ supportsCurrentConversationBinding: true,
446
+ bindingStore: "adapter",
447
+ defaultTopLevelPlacement,
448
+ createManager: async ({ cfg, accountId }) => (await loadDiscordThreadBindingsManagerModule()).createThreadBindingManager({
449
+ cfg,
450
+ accountId: accountId ?? void 0,
451
+ persist: false,
452
+ enableSweeper: false
453
+ }),
454
+ setIdleTimeoutBySessionKey: ({ targetSessionKey, accountId, idleTimeoutMs }) => setThreadBindingIdleTimeoutBySessionKey({
455
+ targetSessionKey,
456
+ accountId: accountId ?? void 0,
457
+ idleTimeoutMs
458
+ }).map(toConversationLifecycleBinding),
459
+ setMaxAgeBySessionKey: ({ targetSessionKey, accountId, maxAgeMs }) => setThreadBindingMaxAgeBySessionKey({
460
+ targetSessionKey,
461
+ accountId: accountId ?? void 0,
462
+ maxAgeMs
463
+ }).map(toConversationLifecycleBinding),
464
+ setIdleTimeoutBySessionKeyAsync: async ({ targetSessionKey, accountId, idleTimeoutMs }) => (await setThreadBindingIdleTimeoutBySessionKeyAsync({
465
+ targetSessionKey,
466
+ accountId: accountId ?? void 0,
467
+ idleTimeoutMs
468
+ })).map(toConversationLifecycleBinding),
469
+ setMaxAgeBySessionKeyAsync: async ({ targetSessionKey, accountId, maxAgeMs }) => (await setThreadBindingMaxAgeBySessionKeyAsync({
470
+ targetSessionKey,
471
+ accountId: accountId ?? void 0,
472
+ maxAgeMs
473
+ })).map(toConversationLifecycleBinding)
474
+ };
475
+ //#endregion
541
476
  //#region extensions/discord/src/channel.ts
542
477
  const DISCORD_ACCOUNT_STARTUP_STAGGER_MS = 1e4;
543
478
  const discordMessageAdapter = createChannelMessageAdapterFromOutbound({
@@ -556,6 +491,22 @@ const discordMessageAdapter = createChannelMessageAdapterFromOutbound({
556
491
  } }
557
492
  }
558
493
  });
494
+ async function sendDiscordHeartbeatTyping(params) {
495
+ const resolvedTo = resolveDiscordAttachedOutboundTarget(params);
496
+ const target = parseDiscordTarget(resolvedTo, { defaultKind: "channel" });
497
+ if (!target || target.kind !== "channel") return;
498
+ const { sendTypingDiscord } = await loadDiscordSendModule();
499
+ const assertCurrent = () => {
500
+ params.signal?.throwIfAborted();
501
+ params.assertPlatformSendAuthorized?.();
502
+ };
503
+ assertCurrent();
504
+ await withDiscordRequestAuthority(assertCurrent, () => sendTypingDiscord(target.id, {
505
+ cfg: params.cfg,
506
+ accountId: params.accountId ?? void 0,
507
+ signal: params.signal
508
+ }));
509
+ }
559
510
  function startDiscordStartupProbe(params) {
560
511
  (async () => {
561
512
  try {
@@ -614,14 +565,6 @@ const resolveDiscordAllowlistNames = createAccountScopedAllowlistNameResolver({
614
565
  entries
615
566
  })
616
567
  });
617
- function toConversationLifecycleBinding(binding) {
618
- return {
619
- boundAt: binding.boundAt,
620
- lastActivityAt: typeof binding.lastActivityAt === "number" ? binding.lastActivityAt : binding.boundAt,
621
- idleTimeoutMs: typeof binding.idleTimeoutMs === "number" ? binding.idleTimeoutMs : void 0,
622
- maxAgeMs: typeof binding.maxAgeMs === "number" ? binding.maxAgeMs : void 0
623
- };
624
- }
625
568
  const discordPlugin = createChatChannelPlugin({
626
569
  base: {
627
570
  ...createDiscordPluginBase({ setupContract: discordSetupContract }),
@@ -659,14 +602,7 @@ const discordPlugin = createChatChannelPlugin({
659
602
  directTargetStyle: "user-prefixed",
660
603
  targetIdComparison: "lowercase",
661
604
  normalizeTarget: normalizeDiscordMessagingTarget,
662
- resolveInboundConversation: ({ from, to, conversationId, threadId, threadParentId, isGroup }) => resolveDiscordInboundConversation({
663
- from,
664
- to,
665
- conversationId,
666
- threadId,
667
- threadParentId,
668
- isGroup
669
- }),
605
+ resolveInboundConversation: resolveDiscordInboundConversation,
670
606
  normalizeExplicitSessionKey: ({ sessionKey, ctx }) => normalizeExplicitDiscordSessionKey(sessionKey, ctx),
671
607
  resolveSessionTarget: ({ id }) => normalizeDiscordMessagingTarget(`channel:${id}`),
672
608
  inferTargetChatType: ({ to }) => {
@@ -679,7 +615,7 @@ const discordPlugin = createChatChannelPlugin({
679
615
  }
680
616
  },
681
617
  buildCrossContextPresentation: buildDiscordCrossContextPresentation,
682
- resolveOutboundSessionRoute: (params) => resolveDiscordOutboundSessionRoute(params),
618
+ resolveOutboundSessionRoute: resolveDiscordOutboundSessionRoute,
683
619
  targetResolver: {
684
620
  looksLikeId: looksLikeDiscordTargetId,
685
621
  hint: "<channelId|user:ID|channel:ID>",
@@ -758,52 +694,15 @@ const discordPlugin = createChatChannelPlugin({
758
694
  conversationId,
759
695
  parentConversationId
760
696
  }),
761
- resolveCommandConversation: ({ threadId, threadParentId, parentSessionKey, from, chatType, originatingTo, commandTo, fallbackTo }) => resolveDiscordCommandConversation({
762
- threadId,
763
- threadParentId,
764
- parentSessionKey,
765
- from,
766
- chatType,
767
- originatingTo,
768
- commandTo,
769
- fallbackTo
770
- })
697
+ resolveCommandConversation: resolveDiscordCommandConversation
771
698
  },
772
- conversationBindings: {
773
- supportsCurrentConversationBinding: true,
774
- bindingStore: "adapter",
775
- defaultTopLevelPlacement,
776
- createManager: async ({ cfg, accountId }) => (await loadDiscordThreadBindingsManagerModule()).createThreadBindingManagerAsync({
777
- cfg,
778
- accountId: accountId ?? void 0,
779
- persist: false,
780
- enableSweeper: false
781
- }),
782
- setIdleTimeoutBySessionKey: ({ targetSessionKey, accountId, idleTimeoutMs }) => setThreadBindingIdleTimeoutBySessionKey({
783
- targetSessionKey,
784
- accountId: accountId ?? void 0,
785
- idleTimeoutMs
786
- }).map(toConversationLifecycleBinding),
787
- setMaxAgeBySessionKey: ({ targetSessionKey, accountId, maxAgeMs }) => setThreadBindingMaxAgeBySessionKey({
788
- targetSessionKey,
789
- accountId: accountId ?? void 0,
790
- maxAgeMs
791
- }).map(toConversationLifecycleBinding)
699
+ conversationBindings: discordConversationBindings,
700
+ heartbeat: {
701
+ sendTyping: sendDiscordHeartbeatTyping,
702
+ sendTypingGuarded: sendDiscordHeartbeatTyping
792
703
  },
793
- heartbeat: { sendTyping: async ({ cfg, to, accountId, threadId }) => {
794
- const resolvedTo = resolveDiscordAttachedOutboundTarget({
795
- to,
796
- threadId
797
- });
798
- const target = parseDiscordTarget(resolvedTo, { defaultKind: "channel" });
799
- if (!target || target.kind !== "channel") return;
800
- await (await loadDiscordSendModule()).sendTypingDiscord(target.id, {
801
- cfg,
802
- accountId: accountId ?? void 0
803
- });
804
- } },
805
704
  status: createComputedAccountStatusAdapter({
806
- defaultRuntime: createDefaultChannelRuntimeState(DEFAULT_ACCOUNT_ID$1, {
705
+ defaultRuntime: createDefaultChannelRuntimeState(DEFAULT_ACCOUNT_ID, {
807
706
  connected: false,
808
707
  reconnectAttempts: 0,
809
708
  lastConnectedAt: null,
@@ -1043,12 +942,7 @@ const discordPlugin = createChatChannelPlugin({
1043
942
  ...discordOutbound,
1044
943
  preferFinalAssistantVisibleText: true,
1045
944
  shouldTreatDeliveredTextAsVisible: shouldTreatDiscordDeliveredTextAsVisible,
1046
- shouldSuppressLocalPayloadPrompt: ({ cfg, accountId, payload, hint }) => shouldSuppressLocalDiscordExecApprovalPrompt({
1047
- cfg,
1048
- accountId,
1049
- payload,
1050
- hint
1051
- })
945
+ shouldSuppressLocalPayloadPrompt: shouldSuppressLocalDiscordExecApprovalPrompt
1052
946
  }
1053
947
  });
1054
948
  //#endregion
@@ -243,12 +243,11 @@ function resolveDiscordAllowListNameMatch(list, candidate) {
243
243
  return null;
244
244
  }
245
245
  function allowListMatches(list, candidate, params) {
246
- if (list.allowAll) return true;
247
- if (candidate.id && list.ids.has(candidate.id)) return true;
248
- if (params?.allowNameMatching === true) {
249
- if (resolveDiscordAllowListNameMatch(list, candidate)) return true;
250
- }
251
- return false;
246
+ return resolveDiscordAllowListMatch({
247
+ allowList: list,
248
+ candidate,
249
+ allowNameMatching: params?.allowNameMatching
250
+ }).allowed;
252
251
  }
253
252
  function resolveDiscordAllowListMatch(params) {
254
253
  const { allowList, candidate } = params;
@@ -414,6 +413,7 @@ function resolveDiscordChannelConfigEntry(entry) {
414
413
  return {
415
414
  allowed: entry.enabled !== false,
416
415
  requireMention: entry.requireMention,
416
+ requireMentionInBotThreads: entry.requireMentionInBotThreads,
417
417
  ignoreOtherMentions: entry.ignoreOtherMentions,
418
418
  skills: entry.skills,
419
419
  enabled: entry.enabled,
@@ -427,15 +427,12 @@ function resolveDiscordChannelConfigEntry(entry) {
427
427
  };
428
428
  }
429
429
  function resolveDiscordChannelConfig(params) {
430
- const { guildInfo, channelId, channelName, channelSlug } = params;
431
- const channels = guildInfo?.channels;
432
- if (!hasConfiguredDiscordChannels(channels)) return null;
433
- const match = resolveDiscordChannelEntryMatch(channels, {
434
- id: channelId,
435
- name: channelName,
436
- slug: channelSlug
430
+ return resolveDiscordChannelConfigWithFallback({
431
+ guildInfo: params.guildInfo,
432
+ channelId: params.channelId,
433
+ channelName: params.channelName,
434
+ channelSlug: params.channelSlug
437
435
  });
438
- return resolveChannelMatchConfig(match, resolveDiscordChannelConfigEntry) ?? { allowed: false };
439
436
  }
440
437
  function resolveDiscordChannelConfigWithFallback(params) {
441
438
  const { guildInfo, channelId, channelName, channelSlug, parentId, parentName, parentSlug, scope } = params;
@@ -454,17 +451,20 @@ function resolveDiscordChannelConfigWithFallback(params) {
454
451
  } : void 0);
455
452
  return resolveChannelMatchConfig(match, resolveDiscordChannelConfigEntry) ?? { allowed: false };
456
453
  }
454
+ /** Boolean runtime API retained for plugins built against OpenClaw 2026.9.6. */
457
455
  function resolveDiscordShouldRequireMention(params) {
458
- if (!params.isGuildMessage) return false;
459
- if (params.isAutoThreadOwnedByBot ?? isDiscordAutoThreadOwnedByBot(params)) return false;
460
- return params.channelConfig?.requireMention ?? params.guildInfo?.requireMention ?? true;
456
+ return resolveDiscordMentionPolicy(params).requireMention;
461
457
  }
462
- function isDiscordAutoThreadOwnedByBot(params) {
463
- if (!params.isThread) return false;
464
- if (!params.channelConfig?.autoThread) return false;
458
+ function resolveDiscordMentionPolicy(params) {
465
459
  const botId = params.botId?.trim();
466
460
  const threadOwnerId = params.threadOwnerId?.trim();
467
- return Boolean(botId && threadOwnerId && botId === threadOwnerId);
461
+ const isBotOwnedThread = Boolean(params.isGuildMessage && (params.isAutoThreadOwnedByBot === true || params.isThread && botId && threadOwnerId === botId));
462
+ const isAutoThreadOwnedByBot = params.isAutoThreadOwnedByBot ?? (isBotOwnedThread && params.channelConfig?.autoThread);
463
+ const requireMentionInBotThreads = isBotOwnedThread ? params.channelConfig?.requireMentionInBotThreads ?? params.guildInfo?.requireMentionInBotThreads : void 0;
464
+ return {
465
+ requireMention: requireMentionInBotThreads ?? (params.isGuildMessage && !isAutoThreadOwnedByBot ? params.channelConfig?.requireMention ?? params.guildInfo?.requireMention ?? true : false),
466
+ allowedImplicitMentionKinds: requireMentionInBotThreads === true ? ["native"] : void 0
467
+ };
468
468
  }
469
469
  function isDiscordGroupAllowedByPolicy(params) {
470
470
  if (params.groupPolicy === "allowlist" && !params.guildAllowlisted) return false;
@@ -531,4 +531,4 @@ function isDiscordThreadChannelType(channelType) {
531
531
  return channelType === ChannelType.AnnouncementThread || channelType === ChannelType.PublicThread || channelType === ChannelType.PrivateThread;
532
532
  }
533
533
  //#endregion
534
- export { resolveTimestampMs as C, resolveDiscordEndpointAttachmentGuard as D, getDiscordEndpointRuntime as E, resolveDiscordEndpointMediaGuard as O, resolveDiscordSystemLocation as S, assertDiscordEndpointGatewayUrl as T, resolveDiscordShouldRequireMention as _, normalizeDiscordDisplaySlug as a, formatDiscordReactionEmoji as b, resolveDiscordChannelConfig as c, resolveDiscordCommandAuthorized as d, resolveDiscordGuildEntry as f, resolveDiscordOwnerAllowFrom as g, resolveDiscordOwnerAccess as h, normalizeDiscordAllowList as i, resolveDiscordChannelConfigWithFallback as l, resolveDiscordMemberAllowed as m, allowListMatches as n, normalizeDiscordSlug as o, resolveDiscordMemberAccessState as p, isDiscordGroupAllowedByPolicy as r, resolveDiscordAllowListMatch as s, isDiscordThreadChannelType as t, resolveDiscordChannelPolicyCommandAuthorizer as u, resolveGroupDmAllow as v, parseDiscordRetryAfterBodySeconds as w, formatDiscordUserTag as x, shouldEmitDiscordReactionNotification as y };
534
+ export { resolveDiscordSystemLocation as C, getDiscordEndpointRuntime as D, assertDiscordEndpointGatewayUrl as E, resolveDiscordEndpointAttachmentGuard as O, formatDiscordUserTag as S, parseDiscordRetryAfterBodySeconds as T, resolveDiscordOwnerAllowFrom as _, normalizeDiscordDisplaySlug as a, shouldEmitDiscordReactionNotification as b, resolveDiscordChannelConfig as c, resolveDiscordCommandAuthorized as d, resolveDiscordGuildEntry as f, resolveDiscordOwnerAccess as g, resolveDiscordMentionPolicy as h, normalizeDiscordAllowList as i, resolveDiscordEndpointMediaGuard as k, resolveDiscordChannelConfigWithFallback as l, resolveDiscordMemberAllowed as m, allowListMatches as n, normalizeDiscordSlug as o, resolveDiscordMemberAccessState as p, isDiscordGroupAllowedByPolicy as r, resolveDiscordAllowListMatch as s, isDiscordThreadChannelType as t, resolveDiscordChannelPolicyCommandAuthorizer as u, resolveDiscordShouldRequireMention as v, resolveTimestampMs as w, formatDiscordReactionEmoji as x, resolveGroupDmAllow as y };