@openclaw/discord 2026.7.2-beta.7 → 2026.8.1-beta.3

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 (114) hide show
  1. package/dist/{account-inspect-SXiCBCgP.js → account-inspect-D5xmUpnj.js} +49 -43
  2. package/dist/account-inspect-api.js +1 -1
  3. package/dist/accounts-DNl-oCEw.js +371 -0
  4. package/dist/action-runtime-api.js +1 -1
  5. package/dist/{active-turn-thread-route-MlKWp8RD.js → active-turn-thread-route-fmHl1HNd.js} +9 -11
  6. package/dist/{activities-api-DTKsuDxf.js → activities-api-KCBAmWxD.js} +133 -175
  7. package/dist/activities-api.js +1 -1
  8. package/dist/{allow-list-DzKrtfah.js → allow-list-BDMimASD.js} +2 -3
  9. package/dist/{api-DnrK9gML.js → api-DNVbJyEy.js} +7 -2
  10. package/dist/api.js +18 -18
  11. package/dist/{approval-handler.runtime-HymvFTYn.js → approval-handler.runtime-B12RCYr8.js} +6 -6
  12. package/dist/{approval-message-safety-DEyKVsAw.js → approval-message-safety-XGFPbDoI.js} +89 -3
  13. package/dist/{audit-CjsrabP8.js → audit-Yc7eZDd6.js} +5 -5
  14. package/dist/{channel-actions-uXFTJX3o.js → channel-actions-Dr2QI8Bf.js} +11 -7
  15. package/dist/{channel-actions.runtime-CIYU90sl.js → channel-actions.runtime-CODTvo7c.js} +99 -97
  16. package/dist/{channel-vKa-76xY.js → channel-cXYzGc4L.js} +102 -104
  17. package/dist/channel-config-api.js +1 -1
  18. package/dist/channel-plugin-api.js +1 -1
  19. package/dist/{channel.setup-CmcwZ_qd.js → channel.setup-CSiwnMgs.js} +16 -54
  20. package/dist/{outbound-session-route-H-HoyH5U.js → components-ezGKo_Yh.js} +69 -142
  21. package/dist/{config-schema-WHRQcY19.js → config-schema-DC5kDtQ5.js} +42 -11
  22. package/dist/conversation-binding-route-D6rCQ5S0.js +43 -0
  23. package/dist/{directory-config-D_LojtCe.js → directory-config-XyCfoqLg.js} +2 -2
  24. package/dist/directory-contract-api.js +1 -1
  25. package/dist/{directory-live-Bw5Ephzv.js → directory-live-Df0NbFJB.js} +7 -4
  26. package/dist/{doctor-Bc4S1qyd.js → doctor-DYY31GrO.js} +34 -13
  27. package/dist/{doctor-contract-CCFMIDk9.js → doctor-contract-DsWvKIXF.js} +2 -3
  28. package/dist/doctor-contract-api.js +147 -2
  29. package/dist/{handle-action.guild-admin-D6VRRW-C.js → handle-action.guild-admin-6Tvvinsa.js} +4 -7
  30. package/dist/{inbound-event-delivery-CEPlt2uz.js → inbound-event-delivery-De2qxTrP.js} +4 -25
  31. package/dist/index.js +5 -4
  32. package/dist/{message-handler-CeiSulIw.js → message-handler-B61q5MOF.js} +118 -33
  33. package/dist/{message-handler.preflight-DibgQFf2.js → message-handler.preflight-Bzg_Hawz.js} +75 -61
  34. package/dist/{message-handler.process-Dnc_oz9y.js → message-handler.process--4_712Ec.js} +236 -296
  35. package/dist/{message-utils-BgTwT_q7.js → message-utils-BXLLnFl6.js} +34 -35
  36. package/dist/{model-picker-preference-primitives-D25pnCOu.js → model-picker-preference-primitives-BHT1LkR_.js} +3 -3
  37. package/dist/{outbound-adapter-DtE-i2OJ.js → outbound-adapter-DxHTOqiN.js} +157 -68
  38. package/dist/{outbound-components-C7GVyfPh.js → outbound-components-B2PL0ooH.js} +3 -3
  39. package/dist/owner-access-Bg41VzAf.js +107 -0
  40. package/dist/{pluralkit-CD4B11JB.js → pluralkit-dUl4v1X3.js} +1 -1
  41. package/dist/{preflight-audio-BjnQZ5yS.js → preflight-audio-DrnqFA8U.js} +22 -28
  42. package/dist/{probe-BeWKhjqX.js → probe-BTdtVRwU.js} +37 -13
  43. package/dist/probe.runtime-Dq5-PRKT.js +2 -0
  44. package/dist/{provider-DfQJX3z5.js → provider-DlK_ynqt.js} +1131 -2021
  45. package/dist/{provider-session.runtime-Bo88k0pV.js → provider-session.runtime-CvvphHvs.js} +3 -3
  46. package/dist/provider.runtime-CzKGRiAF.js +2 -0
  47. package/dist/realtime-session.runtime-ysbMG8v7.js +1351 -0
  48. package/dist/{resolve-allowlist-common-DHERApxi.js → resolve-allowlist-common-DIVXbD1P.js} +3 -3
  49. package/dist/{resolve-channels-BjepAj8b.js → resolve-channels-CGeUoIqb.js} +4 -4
  50. package/dist/{resolve-users-Bc28htgt.js → resolve-users-BtKxLUZv.js} +3 -3
  51. package/dist/{chunk-DX4jpFQP.js → retry-DNsVTeTo.js} +308 -131
  52. package/dist/{runtime-BmW_j_hl.js → runtime-CQovMsH3.js} +12 -15
  53. package/dist/{runtime-_aRC6V2s.js → runtime-D71_VFLr.js} +49 -58
  54. package/dist/runtime-api.actions.js +2 -2
  55. package/dist/runtime-api.js +23 -23
  56. package/dist/runtime-api.lookup.js +5 -5
  57. package/dist/runtime-api.monitor-CzeTYF32.js +6 -0
  58. package/dist/runtime-api.monitor.js +6 -5
  59. package/dist/runtime-api.send.js +6 -6
  60. package/dist/runtime-api.threads.js +5 -6
  61. package/dist/sdk-runtime-37OU6_Yh.js +369 -0
  62. package/dist/{secret-config-contract-B1akrlyY.js → secret-config-contract-B3i6WxV5.js} +53 -25
  63. package/dist/secret-contract-api.js +1 -1
  64. package/dist/security-audit-contract-api.js +1 -1
  65. package/dist/{security-audit.runtime-CPN0xFYz.js → security-audit.runtime-BVKF9VtY.js} +1 -1
  66. package/dist/{send-CdkZ6zeW.js → send-rQIffSYu.js} +180 -91
  67. package/dist/{send.components-5uqwkjgE.js → send.components-ChK1wS7w.js} +32 -46
  68. package/dist/{send.outbound-D-80Ej-t.js → send.outbound-HIkgji_7.js} +57 -34
  69. package/dist/{send.reactions-CtlmGd_o.js → send.reactions-gmJ6yFPo.js} +14 -21
  70. package/dist/{send.receipt-CuwRrpFz.js → send.receipt-Cnhoautb.js} +29 -1
  71. package/dist/{send.shared-jpvAG_u6.js → send.shared-B3fpaLWJ.js} +112 -181
  72. package/dist/{sender-identity-mG_zsdox.js → sender-identity-BJtfyise.js} +1 -1
  73. package/dist/setup-entry.js +0 -5
  74. package/dist/setup-plugin-api.js +1 -1
  75. package/dist/{shared-CXF1tup1.js → shared-CaAaoksy.js} +27 -23
  76. package/dist/subagent-hooks-CNT2ZJTJ.js +49 -0
  77. package/dist/subagent-hooks-api.js +2 -6
  78. package/dist/subagent-progress-FPLqBY1s.js +110 -0
  79. package/dist/{system-events-DdUqf91B.js → system-events-Nuwoq_au.js} +2 -2
  80. package/dist/{target-resolver-C3s_2m0t.js → target-resolver-DIXShHaZ.js} +3 -3
  81. package/dist/targets-B2pf49zc.js +3 -0
  82. package/dist/{thread-bindings-C-M-ly7P.js → thread-bindings-VlymUnbz.js} +29 -28
  83. package/dist/{thread-bindings.manager-DYvSlrva.js → thread-bindings.manager-CngsgErq.js} +258 -29
  84. package/dist/{thread-bindings.session-updates-DAIlp7Px.js → thread-bindings.session-updates-CJb-BpPL.js} +1 -1
  85. package/dist/{thread-bindings.state-Cgi5uRn-.js → thread-bindings.state-D8OMdk4O.js} +3 -16
  86. package/dist/threading-DU6pgeGm.js +456 -0
  87. package/dist/transcripts-source-DeIMNbRh.js +265 -0
  88. package/dist/transcripts-source-api.js +7 -2
  89. package/dist/{typing--Mzo2kM7.js → typing-oLiS5Z13.js} +1 -1
  90. package/dist/voice-runtime-CjNFaynA.js +2549 -0
  91. package/openclaw.plugin.json +215 -25
  92. package/package.json +15 -11
  93. package/skills/discord/SKILL.md +22 -115
  94. package/dist/accounts-DJTf1LtA.js +0 -219
  95. package/dist/channel-api-CAJ0wMoV.js +0 -21
  96. package/dist/legacy-state-migrations-api.js +0 -138
  97. package/dist/manager.runtime-Bjav3pfC.js +0 -3655
  98. package/dist/preflight-audio.runtime-CoCXMM8r.js +0 -7
  99. package/dist/probe.runtime-DqFGFMbZ.js +0 -2
  100. package/dist/provider.runtime-Cy7XZmyh.js +0 -2
  101. package/dist/runtime-api.monitor-CCRubd3-.js +0 -5
  102. package/dist/session-binding-contract-api.js +0 -2
  103. package/dist/subagent-hooks-Dxy7Fmnq.js +0 -120
  104. package/dist/subagent-progress-DI3sYLLo.js +0 -664
  105. package/dist/targets-Dv_RN7vT.js +0 -3
  106. package/dist/thread-bindings.discord-api-BoDNqamb.js +0 -246
  107. package/dist/transcripts-source-DIKGsTGT.js +0 -123
  108. package/node_modules/p-map/index.d.ts +0 -155
  109. package/node_modules/p-map/index.js +0 -285
  110. package/node_modules/p-map/license +0 -9
  111. package/node_modules/p-map/package.json +0 -57
  112. package/node_modules/p-map/readme.md +0 -190
  113. package/dist/{audit-core-xwjIczO0.js → audit-core-BCX8UeFH.js} +1 -1
  114. package/dist/{security-audit-jGnJF__m.js → security-audit-BfJhAXZp.js} +1 -1
@@ -1,60 +1,59 @@
1
- import { l as parseDiscordTarget, o as looksLikeDiscordTargetId, s as normalizeDiscordMessagingTarget } from "./chunk-DX4jpFQP.js";
2
- import { c as resolveDiscordAccountAllowFrom, i as listEnabledDiscordAccounts, o as resolveDefaultDiscordAccountId, r as listDiscordAccountIds, s as resolveDiscordAccount } from "./accounts-DJTf1LtA.js";
3
- import { t as resolveDiscordOutboundSessionRoute } from "./outbound-session-route-H-HoyH5U.js";
1
+ import { d as normalizeDiscordMessagingTarget, u as looksLikeDiscordTargetId } from "./retry-DNsVTeTo.js";
2
+ import { F as projectCredentialSnapshotFields, I as resolveConfiguredFromCredentialStatuses, M as PAIRING_APPROVED_MESSAGE, N as buildTokenChannelStatusSummary, O as resolveDiscordOutboundSessionRoute, c as resolveDiscordAccount, i as listDiscordStartupAccountIds, j as DEFAULT_ACCOUNT_ID, k as parseDiscordTarget, l as resolveDiscordAccountAllowFrom, r as listDiscordAccountIds, s as resolveDefaultDiscordAccountId } from "./accounts-DNl-oCEw.js";
4
3
  import { t as getDiscordRuntime } from "./runtime-DgnVQ7zW.js";
5
- import { a as projectCredentialSnapshotFields, n as PAIRING_APPROVED_MESSAGE, o as resolveConfiguredFromCredentialStatuses, r as buildTokenChannelStatusSummary, t as DEFAULT_ACCOUNT_ID } from "./channel-api-CAJ0wMoV.js";
6
4
  import { u as withAbortTimeout } from "./timeouts-B9cy6RvQ.js";
7
- import { a as getDiscordExecApprovalApprovers, c as shouldSuppressLocalDiscordExecApprovalPrompt, d as createChannelNativeOriginTargetResolver, f as isChannelExecApprovalClientEnabledFromConfig, i as resolveDiscordCurrentConversationIdentity, l as createApproverRestrictedNativeApprovalCapability, o as isDiscordExecApprovalApprover, p as matchesApprovalRequestFilters, s as isDiscordExecApprovalClientEnabled, u as createChannelApproverDmTargetResolver } from "./approval-message-safety-DEyKVsAw.js";
8
- import { r as resolveRequiredDiscordChannelPermissions } from "./audit-core-xwjIczO0.js";
9
- import { t as discordMessageActions$1 } from "./channel-actions-uXFTJX3o.js";
5
+ import { _ as createChannelApproverDmTargetResolver, b as matchesApprovalRequestFilters, d as resolveDiscordRuntimeBindingConversationId, f as getDiscordExecApprovalApprovers, g as createApproverRestrictedNativeApprovalCapability, h as shouldSuppressLocalDiscordExecApprovalPrompt, m as isDiscordExecApprovalClientEnabled, o as resolveDiscordConversationRoute, p as isDiscordExecApprovalApprover, u as resolveDiscordCurrentConversationIdentity, v as createChannelNativeOriginTargetResolver, y as isChannelExecApprovalClientEnabledFromConfig } from "./approval-message-safety-XGFPbDoI.js";
6
+ import { r as resolveRequiredDiscordChannelPermissions } from "./audit-core-BCX8UeFH.js";
7
+ import { t as discordMessageActions } from "./channel-actions-Dr2QI8Bf.js";
10
8
  import { r as openDiscordCommandDeployHashStore } from "./command-deploy-store-DFkBTViB.js";
11
- import { n as setThreadBindingMaxAgeBySessionKey, t as setThreadBindingIdleTimeoutBySessionKey } from "./thread-bindings.session-updates-DAIlp7Px.js";
12
- import { n as discordOutbound } from "./outbound-adapter-DtE-i2OJ.js";
13
- import { a as discordSetupContract, i as discordSetupAdapter, n as discordConfigAdapter, o as discordSecurityAdapter, t as createDiscordPluginBase } from "./shared-CXF1tup1.js";
9
+ import { t as resolveDiscordConversationBindingRoute } from "./conversation-binding-route-D6rCQ5S0.js";
10
+ import { n as setThreadBindingMaxAgeBySessionKey, t as setThreadBindingIdleTimeoutBySessionKey } from "./thread-bindings.session-updates-CJb-BpPL.js";
11
+ import { n as discordOutbound } from "./outbound-adapter-DxHTOqiN.js";
12
+ import { a as discordSecurityAdapter, i as discordSetupContract, n as discordConfigAdapter, t as createDiscordPluginBase } from "./shared-CaAaoksy.js";
14
13
  import { t as normalizeExplicitDiscordSessionKey } from "./session-key-normalization-wJgsKPNF.js";
15
14
  import { t as defaultTopLevelPlacement } from "./thread-binding-api-BDZJD4na.js";
16
- import { normalizeLowercaseStringOrEmpty, normalizeOptionalString, normalizeOptionalStringifiedId } from "openclaw/plugin-sdk/string-coerce-runtime";
17
15
  import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
18
- import { sleepWithAbort } from "openclaw/plugin-sdk/runtime-env";
16
+ import { normalizeLowercaseStringOrEmpty, normalizeOptionalString, normalizeOptionalStringifiedId } from "openclaw/plugin-sdk/string-coerce-runtime";
19
17
  import { createChatChannelPlugin } from "openclaw/plugin-sdk/channel-core";
18
+ import { sleepWithAbort } from "openclaw/plugin-sdk/runtime-env";
20
19
  import { createChannelMessageAdapterFromOutbound } from "openclaw/plugin-sdk/channel-outbound";
21
20
  import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
22
21
  import { buildLegacyDmAccountAllowlistAdapter, createAccountScopedAllowlistNameResolver, createNestedAllowlistOverrideResolver } from "openclaw/plugin-sdk/allowlist-config-edit";
23
22
  import { createPairingPrefixStripper } from "openclaw/plugin-sdk/channel-pairing";
24
23
  import { createChannelDirectoryAdapter, createRuntimeDirectoryLiveAdapter } from "openclaw/plugin-sdk/directory-runtime";
25
- import { appendMatchMetadata, asString, createComputedAccountStatusAdapter, createDefaultChannelRuntimeState, isRecord as isRecord$1, readAccountStatusSnapshot, resolveEnabledConfiguredAccountId } from "openclaw/plugin-sdk/status-helpers";
24
+ import { appendMatchMetadata, createComputedAccountStatusAdapter, createDefaultChannelRuntimeState, isRecord as isRecord$1, readAccountStatusSnapshot, resolveEnabledConfiguredAccountId } from "openclaw/plugin-sdk/status-helpers";
26
25
  import { resolveTargetsWithOptionalToken } from "openclaw/plugin-sdk/target-resolver-runtime";
27
26
  import { createLazyChannelApprovalNativeRuntimeAdapter } from "openclaw/plugin-sdk/approval-handler-adapter-runtime";
28
- import { doesApprovalRequestMatchChannelAccount, resolveApprovalRequestSessionConversation } from "openclaw/plugin-sdk/approval-native-runtime";
27
+ import { doesApprovalRequestSelectChannelAccount, resolveApprovalRequestSessionConversation } from "openclaw/plugin-sdk/approval-native-runtime";
28
+ import { resolveThreadBindingSpawnPolicy } from "openclaw/plugin-sdk/conversation-runtime";
29
29
  import { resolveScopeRequireMention, resolveScopeToolsPolicy, scopeKey } from "openclaw/plugin-sdk/channel-policy";
30
30
  import { normalizeAtHashSlug } from "openclaw/plugin-sdk/string-normalization-runtime";
31
31
  //#region extensions/discord/src/approval-shared.ts
32
- function shouldHandleDiscordApprovalRequest(params) {
33
- const config = params.configOverride ?? resolveDiscordAccount({
34
- cfg: params.cfg,
35
- accountId: params.accountId
36
- }).config.execApprovals;
37
- const approvers = getDiscordExecApprovalApprovers({
38
- cfg: params.cfg,
39
- accountId: params.accountId,
40
- configOverride: params.configOverride
41
- });
42
- if (!doesApprovalRequestMatchChannelAccount({
43
- cfg: params.cfg,
44
- request: params.request,
45
- channel: "discord",
46
- accountId: params.accountId
47
- })) return false;
48
- if (!isChannelExecApprovalClientEnabledFromConfig({
32
+ function isDiscordApprovalAccountEligible(params) {
33
+ const account = resolveDiscordAccount(params);
34
+ const config = params.configOverride ?? account.config.execApprovals;
35
+ return account.enabled && isChannelExecApprovalClientEnabledFromConfig({
49
36
  enabled: config?.enabled,
50
- approverCount: approvers.length
51
- })) return false;
52
- return matchesApprovalRequestFilters({
37
+ approverCount: getDiscordExecApprovalApprovers(params).length
38
+ }) && matchesApprovalRequestFilters({
53
39
  request: params.request.request,
54
40
  agentFilter: config?.agentFilter,
55
41
  sessionFilter: config?.sessionFilter
56
42
  });
57
43
  }
44
+ function shouldHandleDiscordApprovalRequest(params) {
45
+ const accountId = params.accountId ?? resolveDefaultDiscordAccountId(params.cfg);
46
+ if (!doesApprovalRequestSelectChannelAccount({
47
+ ...params,
48
+ channel: "discord",
49
+ defaultAccountId: resolveDefaultDiscordAccountId(params.cfg),
50
+ eligibleAccountIds: isDiscordApprovalAccountEligible({
51
+ ...params,
52
+ accountId
53
+ }) ? [accountId] : []
54
+ })) return false;
55
+ return isDiscordApprovalAccountEligible(params);
56
+ }
58
57
  //#endregion
59
58
  //#region extensions/discord/src/approval-native.ts
60
59
  function extractDiscordSessionKind(sessionKey) {
@@ -195,7 +194,7 @@ function createDiscordApprovalCapability(configOverride) {
195
194
  request,
196
195
  configOverride
197
196
  }),
198
- load: async () => (await import("./approval-handler.runtime-HymvFTYn.js")).discordApprovalNativeRuntime
197
+ load: async () => (await import("./approval-handler.runtime-B12RCYr8.js")).discordApprovalNativeRuntime
199
198
  })
200
199
  });
201
200
  }
@@ -302,22 +301,70 @@ function resolveDiscordInboundConversation(params) {
302
301
  }
303
302
  //#endregion
304
303
  //#region extensions/discord/src/channel.loaders.ts
305
- const loadDiscordDirectoryConfigModule = createLazyRuntimeModule(() => import("./directory-config-D_LojtCe.js").then((n) => n.t));
306
- const loadDiscordResolveChannelsModule = createLazyRuntimeModule(() => import("./resolve-channels-BjepAj8b.js").then((n) => n.n));
307
- const loadDiscordResolveUsersModule = createLazyRuntimeModule(() => import("./resolve-users-Bc28htgt.js").then((n) => n.n));
308
- const loadDiscordThreadBindingsManagerModule = createLazyRuntimeModule(() => import("./thread-bindings.manager-DYvSlrva.js").then((n) => n.a));
309
- const loadDiscordTargetResolverModule = createLazyRuntimeModule(() => import("./target-resolver-C3s_2m0t.js").then((n) => n.r));
310
- const loadDiscordProviderRuntime = createLazyRuntimeModule(() => import("./provider.runtime-Cy7XZmyh.js"));
311
- const loadDiscordProbeRuntime = createLazyRuntimeModule(() => import("./probe.runtime-DqFGFMbZ.js"));
304
+ const loadDiscordDirectoryConfigModule = createLazyRuntimeModule(() => import("./directory-config-XyCfoqLg.js").then((n) => n.t));
305
+ const loadDiscordResolveChannelsModule = createLazyRuntimeModule(() => import("./resolve-channels-CGeUoIqb.js").then((n) => n.n));
306
+ const loadDiscordResolveUsersModule = createLazyRuntimeModule(() => import("./resolve-users-BtKxLUZv.js").then((n) => n.n));
307
+ const loadDiscordThreadBindingsManagerModule = createLazyRuntimeModule(() => import("./thread-bindings.manager-CngsgErq.js").then((n) => n.i));
308
+ const loadDiscordTargetResolverModule = createLazyRuntimeModule(() => import("./target-resolver-DIXShHaZ.js").then((n) => n.r));
309
+ const loadDiscordProviderRuntime = createLazyRuntimeModule(() => import("./provider.runtime-CzKGRiAF.js"));
310
+ const loadDiscordProbeRuntime = createLazyRuntimeModule(() => import("./probe.runtime-Dq5-PRKT.js"));
312
311
  async function probeDiscordStatusAccount(params) {
313
312
  const startedAtMs = Date.now();
314
313
  const runtime = await loadDiscordProbeRuntime();
315
314
  const remainingMs = Math.max(1, params.timeoutMs - Math.max(0, Date.now() - startedAtMs));
316
315
  return await runtime.probeDiscord(params.token, remainingMs, { includeApplication: true });
317
316
  }
318
- const loadDiscordAuditModule = createLazyRuntimeModule(() => import("./audit-CjsrabP8.js").then((n) => n.n));
319
- const loadDiscordSendModule = createLazyRuntimeModule(() => import("./send-CdkZ6zeW.js").then((n) => n.t));
320
- const loadDiscordDirectoryLiveModule = createLazyRuntimeModule(() => import("./directory-live-Bw5Ephzv.js").then((n) => n.t));
317
+ const loadDiscordAuditModule = createLazyRuntimeModule(() => import("./audit-Yc7eZDd6.js").then((n) => n.n));
318
+ const loadDiscordSendModule = createLazyRuntimeModule(() => import("./send-rQIffSYu.js").then((n) => n.t));
319
+ const loadDiscordDirectoryLiveModule = createLazyRuntimeModule(() => import("./directory-live-Df0NbFJB.js").then((n) => n.t));
320
+ //#endregion
321
+ //#region extensions/discord/src/conversation-route-owner.ts
322
+ function inspectDiscordConversationRouteOwner(params) {
323
+ const direct = params.conversation.kind === "direct";
324
+ const nativeConversationId = params.conversation.nativeChannelId ?? params.conversation.peerId;
325
+ const threadConversationId = direct ? void 0 : params.conversation.threadId;
326
+ const runtimeConversationId = threadConversationId ?? resolveDiscordRuntimeBindingConversationId({
327
+ isDirectMessage: direct,
328
+ isGroupDm: params.conversation.kind === "group",
329
+ userId: direct ? params.conversation.peerId : void 0,
330
+ channelId: nativeConversationId
331
+ });
332
+ const route = resolveDiscordConversationRoute({
333
+ cfg: params.cfg,
334
+ accountId: params.accountId,
335
+ guildId: params.conversation.context?.guildId,
336
+ memberRoleIds: params.conversation.context?.memberRoleIds,
337
+ peer: {
338
+ kind: params.conversation.kind,
339
+ id: params.conversation.peerId
340
+ },
341
+ parentConversationId: params.conversation.context?.parentPeerId
342
+ });
343
+ const { runtimeRoute, configuredRoute } = resolveDiscordConversationBindingRoute({
344
+ cfg: params.cfg,
345
+ route,
346
+ accountId: params.accountId,
347
+ runtimeConversationId,
348
+ configuredConversationId: threadConversationId ?? nativeConversationId,
349
+ parentConversationId: params.conversation.context?.parentPeerId,
350
+ touchBinding: false
351
+ });
352
+ if (!runtimeRoute.bindingOwnerAvailable && resolveThreadBindingSpawnPolicy({
353
+ cfg: params.cfg,
354
+ channel: "discord",
355
+ accountId: params.accountId,
356
+ kind: "subagent"
357
+ }).enabled) return { kind: "unavailable" };
358
+ if (runtimeRoute.pluginId) return {
359
+ kind: "plugin",
360
+ pluginId: runtimeRoute.pluginId,
361
+ fallbackAgentId: route.agentId
362
+ };
363
+ return {
364
+ kind: "agent",
365
+ agentId: runtimeRoute.boundAgentId ?? configuredRoute?.boundAgentId ?? route.agentId
366
+ };
367
+ }
321
368
  //#endregion
322
369
  //#region extensions/discord/src/group-policy.ts
323
370
  function normalizeDiscordSlug(value) {
@@ -406,13 +453,13 @@ function readDiscordPermissionsAuditSummary(value) {
406
453
  unresolvedChannels,
407
454
  channels: Array.isArray(channelsRaw) ? channelsRaw.map((entry) => {
408
455
  if (!isRecord$1(entry)) return null;
409
- const channelId = asString(entry.channelId);
456
+ const channelId = normalizeOptionalString(entry.channelId);
410
457
  if (!channelId) return null;
411
458
  const ok = typeof entry.ok === "boolean" ? entry.ok : void 0;
412
- const missing = Array.isArray(entry.missing) ? entry.missing.map((v) => asString(v)).filter(Boolean) : void 0;
413
- const error = asString(entry.error) ?? null;
414
- const matchKey = asString(entry.matchKey) ?? void 0;
415
- const matchSource = asString(entry.matchSource) ?? void 0;
459
+ const missing = Array.isArray(entry.missing) ? entry.missing.map((v) => normalizeOptionalString(v)).filter(Boolean) : void 0;
460
+ const error = normalizeOptionalString(entry.error) ?? null;
461
+ const matchKey = normalizeOptionalString(entry.matchKey);
462
+ const matchSource = normalizeOptionalString(entry.matchSource);
416
463
  return {
417
464
  channelId,
418
465
  ok,
@@ -427,32 +474,10 @@ function readDiscordPermissionsAuditSummary(value) {
427
474
  function collectDiscordStatusIssues(accounts) {
428
475
  const issues = [];
429
476
  for (const entry of accounts) {
430
- const account = readAccountStatusSnapshot(entry, [
431
- "healthState",
432
- "application",
433
- "audit"
434
- ]);
477
+ const account = readAccountStatusSnapshot(entry, ["application", "audit"]);
435
478
  if (!account) continue;
436
479
  const accountId = resolveEnabledConfiguredAccountId(account);
437
480
  if (!accountId) continue;
438
- const running = account.running === true;
439
- const healthState = asString(account.healthState);
440
- if (healthState === "stale-socket" || healthState === "stuck" || healthState === "disconnected" || healthState === "not-running") {
441
- const runningLabel = running ? "running" : "not running";
442
- issues.push({
443
- channel: "discord",
444
- accountId,
445
- kind: "runtime",
446
- message: `Discord gateway transport is degraded (${healthState}; account is ${runningLabel}).`,
447
- fix: "Check gateway event-loop health and Discord connectivity, then restart the Discord channel or gateway if the transport does not recover."
448
- });
449
- } else if (running && account.connected === false) issues.push({
450
- channel: "discord",
451
- accountId,
452
- kind: "runtime",
453
- message: "Discord gateway transport is running but disconnected.",
454
- fix: "Check gateway logs for Discord websocket errors and wait for reconnect; restart the Discord channel or gateway if it does not recover."
455
- });
456
481
  if (readDiscordApplicationSummary(account.application).intents?.messageContent === "disabled") issues.push({
457
482
  channel: "discord",
458
483
  accountId,
@@ -536,34 +561,8 @@ function startDiscordStartupProbe(params) {
536
561
  function shouldTreatDiscordDeliveredTextAsVisible(params) {
537
562
  return params.kind === "block" && typeof params.text === "string" && params.text.trim().length > 0;
538
563
  }
539
- function resolveRuntimeDiscordMessageActions() {
540
- try {
541
- return getDiscordRuntime().channel?.discord?.messageActions ?? null;
542
- } catch {
543
- return null;
544
- }
545
- }
546
- const discordMessageActions = {
547
- resolveExecutionMode: (ctx) => resolveRuntimeDiscordMessageActions()?.resolveExecutionMode?.(ctx) ?? discordMessageActions$1.resolveExecutionMode?.(ctx) ?? "local",
548
- describeMessageTool: (ctx) => resolveRuntimeDiscordMessageActions()?.describeMessageTool?.(ctx) ?? discordMessageActions$1.describeMessageTool?.(ctx) ?? null,
549
- requiresTrustedRequesterSender: (ctx) => resolveRuntimeDiscordMessageActions()?.requiresTrustedRequesterSender?.(ctx) ?? discordMessageActions$1.requiresTrustedRequesterSender?.(ctx) ?? false,
550
- extractToolSend: (ctx) => resolveRuntimeDiscordMessageActions()?.extractToolSend?.(ctx) ?? discordMessageActions$1.extractToolSend?.(ctx) ?? null,
551
- prepareSendPayload: (ctx) => resolveRuntimeDiscordMessageActions()?.prepareSendPayload?.(ctx) ?? discordMessageActions$1.prepareSendPayload?.(ctx) ?? null,
552
- handleAction: async (ctx) => {
553
- const runtimeHandleAction = resolveRuntimeDiscordMessageActions()?.handleAction;
554
- if (runtimeHandleAction) return await runtimeHandleAction(ctx);
555
- if (!discordMessageActions$1.handleAction) throw new Error("Discord message actions not available");
556
- return await discordMessageActions$1.handleAction(ctx);
557
- }
558
- };
559
- function resolveDiscordStartupAccountIds(cfg) {
560
- const startupAccountIds = listEnabledDiscordAccounts(cfg).filter((candidate) => resolveConfiguredFromCredentialStatuses(candidate) ?? Boolean(normalizeOptionalString(candidate.token))).map((candidate) => candidate.accountId);
561
- const defaultAccountId = resolveDefaultDiscordAccountId(cfg);
562
- if (!startupAccountIds.includes(defaultAccountId)) return startupAccountIds;
563
- return [defaultAccountId, ...startupAccountIds.filter((candidateId) => candidateId !== defaultAccountId)];
564
- }
565
564
  function resolveDiscordStartupDelayMs(cfg, accountId) {
566
- const startupIndex = resolveDiscordStartupAccountIds(cfg).findIndex((candidateId) => candidateId === accountId);
565
+ const startupIndex = listDiscordStartupAccountIds(cfg).findIndex((candidateId) => candidateId === accountId);
567
566
  return startupIndex <= 0 ? 0 : startupIndex * DISCORD_ACCOUNT_STARTUP_STAGGER_MS;
568
567
  }
569
568
  function formatDiscordIntents(intents) {
@@ -600,10 +599,7 @@ function toConversationLifecycleBinding(binding) {
600
599
  }
601
600
  const discordPlugin = createChatChannelPlugin({
602
601
  base: {
603
- ...createDiscordPluginBase({
604
- setup: discordSetupAdapter,
605
- setupContract: discordSetupContract
606
- }),
602
+ ...createDiscordPluginBase({ setupContract: discordSetupContract }),
607
603
  allowlist: {
608
604
  ...buildLegacyDmAccountAllowlistAdapter({
609
605
  channelId: "discord",
@@ -633,6 +629,7 @@ const discordPlugin = createChatChannelPlugin({
633
629
  "- Forms: add `components.modal` (title, fields). OpenClaw adds a trigger button and routes submissions as new messages."
634
630
  ] },
635
631
  messaging: {
632
+ resolveConversationRouteOwner: inspectDiscordConversationRouteOwner,
636
633
  targetPrefixes: ["discord"],
637
634
  directTargetStyle: "user-prefixed",
638
635
  targetIdComparison: "lowercase",
@@ -749,6 +746,7 @@ const discordPlugin = createChatChannelPlugin({
749
746
  },
750
747
  conversationBindings: {
751
748
  supportsCurrentConversationBinding: true,
749
+ bindingStore: "adapter",
752
750
  defaultTopLevelPlacement,
753
751
  createManager: async ({ cfg, accountId }) => (await loadDiscordThreadBindingsManagerModule()).createThreadBindingManager({
754
752
  cfg,
@@ -1,2 +1,2 @@
1
- import { t as DiscordChannelConfigSchema } from "./config-schema-WHRQcY19.js";
1
+ import { t as DiscordChannelConfigSchema } from "./config-schema-DC5kDtQ5.js";
2
2
  export { DiscordChannelConfigSchema };
@@ -1,2 +1,2 @@
1
- import { t as discordPlugin } from "./channel-vKa-76xY.js";
1
+ import { t as discordPlugin } from "./channel-cXYzGc4L.js";
2
2
  export { discordPlugin };
@@ -1,8 +1,8 @@
1
- import { a as mergeDiscordAccountConfig, c as resolveDiscordAccountAllowFrom, l as resolveDiscordAccountConfig, m as resolveDiscordToken, o as resolveDefaultDiscordAccountId } from "./accounts-DJTf1LtA.js";
2
- import { n as inspectDiscordConfiguredToken } from "./account-inspect-SXiCBCgP.js";
3
- import { a as discordSetupContract, i as discordSetupAdapter, t as createDiscordPluginBase } from "./shared-CXF1tup1.js";
4
- import { t as resolveDiscordChannelAllowlist } from "./resolve-channels-BjepAj8b.js";
5
- import { t as resolveDiscordUserAllowlist } from "./resolve-users-Bc28htgt.js";
1
+ import { h as resolveDiscordToken, l as resolveDiscordAccountAllowFrom, o as mergeDiscordAccountConfig, s as resolveDefaultDiscordAccountId, u as resolveDiscordAccountConfig } from "./accounts-DNl-oCEw.js";
2
+ import { n as inspectDiscordAccountTokenState } from "./account-inspect-D5xmUpnj.js";
3
+ import { i as discordSetupContract, t as createDiscordPluginBase } from "./shared-CaAaoksy.js";
4
+ import { t as resolveDiscordChannelAllowlist } from "./resolve-channels-CGeUoIqb.js";
5
+ import { t as resolveDiscordUserAllowlist } from "./resolve-users-BtKxLUZv.js";
6
6
  import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "openclaw/plugin-sdk/account-id";
7
7
  import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
8
8
  import { resolveBasicAllowFromEntries } from "openclaw/plugin-sdk/allow-from";
@@ -25,54 +25,17 @@ function inspectDiscordSetupAccount(params) {
25
25
  const enabled = params.cfg.channels?.discord?.enabled !== false && config.enabled !== false;
26
26
  const accountConfig = resolveDiscordAccountConfig(params.cfg, accountId);
27
27
  const hasAccountToken = Boolean(accountConfig && Object.hasOwn(accountConfig, "token"));
28
- const accountToken = inspectDiscordConfiguredToken(accountConfig?.token);
29
- if (accountToken) return {
30
- accountId,
31
- enabled,
32
- token: accountToken.token,
33
- tokenSource: accountToken.tokenSource,
34
- tokenStatus: accountToken.tokenStatus,
35
- configured: true,
36
- config
37
- };
38
- if (hasAccountToken) return {
39
- accountId,
40
- enabled,
41
- token: "",
42
- tokenSource: "none",
43
- tokenStatus: "missing",
44
- configured: false,
45
- config
46
- };
47
- const channelToken = inspectDiscordConfiguredToken(params.cfg.channels?.discord?.token);
48
- if (channelToken) return {
49
- accountId,
50
- enabled,
51
- token: channelToken.token,
52
- tokenSource: channelToken.tokenSource,
53
- tokenStatus: channelToken.tokenStatus,
54
- configured: true,
55
- config
56
- };
57
- const tokenResolution = resolveDiscordToken(params.cfg, { accountId });
58
- if (tokenResolution.token) return {
59
- accountId,
60
- enabled,
61
- token: tokenResolution.token,
62
- tokenSource: tokenResolution.source,
63
- tokenStatus: "available",
64
- configured: true,
65
- config
66
- };
67
- return {
68
- accountId,
69
- enabled,
70
- token: "",
71
- tokenSource: "none",
72
- tokenStatus: "missing",
73
- configured: false,
74
- config
75
- };
28
+ return inspectDiscordAccountTokenState({
29
+ base: {
30
+ accountId,
31
+ enabled
32
+ },
33
+ config,
34
+ accountToken: accountConfig?.token,
35
+ hasAccountToken,
36
+ channelToken: params.cfg.channels?.discord?.token,
37
+ resolveFallbackToken: () => resolveDiscordToken(params.cfg, { accountId })
38
+ });
76
39
  }
77
40
  //#endregion
78
41
  //#region extensions/discord/src/setup-core.ts
@@ -332,7 +295,6 @@ const discordSetupPlugin = { ...createDiscordPluginBase({
332
295
  entries
333
296
  })
334
297
  }),
335
- setup: discordSetupAdapter,
336
298
  setupContract: discordSetupContract
337
299
  }) };
338
300
  //#endregion