@openclaw/discord 2026.5.7 → 2026.5.10-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{access-CHY9FK3X.js → access-R4X7pYt4.js} +1 -1
- package/dist/action-runtime-api.js +1 -1
- package/dist/{allow-list-ek-1hMKN.js → allow-list-4wnZg5P9.js} +2 -6
- package/dist/api.js +18 -16
- package/dist/{approval-handler.runtime-BBZRYAGs.js → approval-handler.runtime-B5BCBw4D.js} +3 -4
- package/dist/{approval-native-CBdZsAR7.js → approval-native-CrCc3b4u.js} +2 -2
- package/dist/{approval-shared-Ck6TxKgo.js → approval-shared-Ckk65xSG.js} +1 -1
- package/dist/{audit-CCJ0h49k.js → audit-BRBe8xFv.js} +4 -4
- package/dist/{channel-UXGa9PGc.js → channel-DTBEGHsT.js} +53 -31
- package/dist/{channel-actions-Br29_1nE.js → channel-actions-CHgoSpPF.js} +27 -1
- package/dist/{channel-actions.runtime-ChmNUig1.js → channel-actions.runtime-E5Plubuu.js} +5 -5
- package/dist/channel-config-api.js +1 -1
- package/dist/channel-plugin-api.js +1 -1
- package/dist/{channel.setup-D_xyQu_h.js → channel.setup-EQXuueIk.js} +3 -3
- package/dist/chunk-DYl-_5RL.js +179 -0
- package/dist/{components-D5LnN7ZQ.js → components-BJOShoIU.js} +2 -3
- package/dist/{config-schema-Cc953rAs.js → config-schema-BGn5I3_3.js} +46 -1
- package/dist/contract-api.js +7 -7
- package/dist/{conversation-identity-DHhS0ez3.js → conversation-identity-BPQm_uhV.js} +1 -1
- package/dist/{directory-config-DoETeOOx.js → directory-config-JBaFwbAQ.js} +1 -1
- package/dist/directory-contract-api.js +1 -1
- package/dist/{directory-live-DJ0V5asB.js → directory-live-B4kW11z5.js} +2 -2
- package/dist/{discord-eZlimVfW.js → discord-DtHMmZqJ.js} +58 -15
- package/dist/{doctor-Bo-yifB3.js → doctor-CPV4Ch3V.js} +3 -3
- package/dist/{doctor-contract-Bso46EOQ.js → doctor-contract-BGjjFBdq.js} +1 -1
- package/dist/doctor-contract-api.js +1 -1
- package/dist/{handle-action.guild-admin-sJiQymg8.js → handle-action.guild-admin-DSeMCHvR.js} +6 -3
- package/dist/{inbound-context-CRylwjg0.js → inbound-context-BAwOn5Iq.js} +1 -1
- package/dist/manager.runtime-DGvCDWI5.js +2082 -0
- package/dist/{message-handler-C9Ohf-ea.js → message-handler-BWHSteQf.js} +7 -7
- package/dist/{message-handler.preflight-BrvazsYn.js → message-handler.preflight-q7ose9Ta.js} +31 -42
- package/dist/{message-handler.process-CEnzuLiN.js → message-handler.process-BN8bE7AE.js} +81 -64
- package/dist/{message-utils-9kaGF59d.js → message-utils-DEjCwCRz.js} +2 -2
- package/dist/normalize-Cu94FOqy.js +58 -0
- package/dist/{outbound-adapter-DNsTVJfH.js → outbound-adapter-Bt8FL3yO.js} +78 -17
- package/dist/{outbound-session-route-DK9qkPgP.js → outbound-session-route-BaJRt05p.js} +1 -1
- package/dist/{pluralkit-OFss_pIy.js → pluralkit-CUfobeQu.js} +1 -1
- package/dist/{preflight-audio-CRmUxxuM.js → preflight-audio-BcsH127L.js} +1 -1
- package/dist/{preview-streaming-Cc_oeIPP.js → preview-streaming-DCPAe24T.js} +1 -0
- package/dist/{probe.runtime-CMgUDax3.js → probe.runtime-4Q9GD7FG.js} +1 -1
- package/dist/{provider-CuOh6z_b.js → provider-DBvvDP9A.js} +185 -225
- package/dist/{provider-session.runtime-CCESIHVo.js → provider-session.runtime-DepAOR1U.js} +3 -3
- package/dist/provider.runtime-BlbOt97W.js +2 -0
- package/dist/{reply-delivery-D9aKHtDH.js → reply-delivery-vHSqaKKo.js} +9 -6
- package/dist/{resolve-allowlist-common-_e1cWOb3.js → resolve-allowlist-common-ZcVU4OMA.js} +1 -1
- package/dist/{resolve-channels-kyuvrXJg.js → resolve-channels-D9Dubj_y.js} +3 -3
- package/dist/{resolve-users-CAwh4EBq.js → resolve-users-DlzKsLQe.js} +2 -2
- package/dist/route-resolution-foWW8_D1.js +268 -0
- package/dist/runtime-api.actions.js +2 -2
- package/dist/runtime-api.js +25 -25
- package/dist/runtime-api.lookup.js +6 -6
- package/dist/runtime-api.monitor-CsetE9pd.js +6 -0
- package/dist/runtime-api.monitor.js +7 -7
- package/dist/runtime-api.send.js +5 -5
- package/dist/runtime-api.threads.js +5 -5
- package/dist/{runtime-D8alY00g.js → runtime-oXRGbcb5.js} +7 -7
- package/dist/runtime-setter-api.js +1 -1
- package/dist/secret-contract-api.js +1 -1
- package/dist/{security-audit-BtRd_VhN.js → security-audit-BQ_sGK3J.js} +1 -1
- package/dist/security-audit-contract-api.js +1 -1
- package/dist/{security-audit.runtime-Dm1LW9KX.js → security-audit.runtime-B7Gmz2DX.js} +1 -1
- package/dist/security-contract-api.js +1 -1
- package/dist/{send-8S_HKJpQ.js → send-BSBMchf8.js} +83 -57
- package/dist/{send.components-A42c_5tQ.js → send.components-BoEhxys4.js} +22 -15
- package/dist/{send.outbound-D3tonSz8.js → send.outbound-B2DK2loZ.js} +22 -11
- package/dist/send.receipt-BAZw2Zsz.js +35 -0
- package/dist/{send.shared-BQGiUPvZ.js → send.shared-DzwpAEMP.js} +26 -7
- package/dist/session-key-api.js +1 -1
- package/dist/setup-plugin-api.js +1 -1
- package/dist/{shared-BEW4H3bj.js → shared-CBsrEG5q.js} +8 -8
- package/dist/{shared-interactive-KgJjCqnB.js → shared-interactive-D39V9Wtn.js} +3 -3
- package/dist/{subagent-hooks-T0LPLh4H.js → subagent-hooks-BDy1pJD5.js} +2 -2
- package/dist/subagent-hooks-api.js +1 -1
- package/dist/{system-events-_fzSG--3.js → system-events-BeVImqnV.js} +1 -1
- package/dist/target-parsing-D-H7nnh2.js +51 -0
- package/dist/target-resolver-DzOelJEt.js +85 -0
- package/dist/targets-Dj-qyUaE.js +3 -0
- package/dist/test-api.js +4 -4
- package/dist/{thread-bindings-CMpZjP50.js → thread-bindings-DUzBL8jL.js} +7 -7
- package/dist/{thread-bindings.discord-api-CwWGoyei.js → thread-bindings.discord-api-dpSDYFKX.js} +7 -7
- package/dist/{thread-bindings.manager-BtxfLfWf.js → thread-bindings.manager-DTuwm8Tk.js} +5 -6
- package/dist/{thread-bindings.session-updates-jcZSiRPI.js → thread-bindings.session-updates-BhcGQTJb.js} +1 -1
- package/dist/{threading-BMmpA2JR.js → threading-CTUnZtNi.js} +4 -5
- package/dist/timeouts.js +1 -1
- package/dist/{typing-Bw6NKWLZ.js → typing-BYeVSviE.js} +2 -3
- package/openclaw.plugin.json +222 -1
- package/package.json +5 -5
- package/dist/manager.runtime-Cug1PoeZ.js +0 -1025
- package/dist/provider.runtime-B68g3qLv.js +0 -2
- package/dist/rolldown-runtime-C3SqQTfK.js +0 -28
- package/dist/route-resolution-BWErj5Cn.js +0 -236
- package/dist/runtime-api.monitor-DzkCxeBL.js +0 -6
- package/dist/target-resolver-DA84_xbt.js +0 -365
- package/dist/targets-FwL1BPTU.js +0 -2
- /package/dist/{agent-components.runtime-Dof1YMSz.js → agent-components.runtime-zT8qPsnM.js} +0 -0
- /package/dist/{audit-core-CejGc3hO.js → audit-core-CG37TsZm.js} +0 -0
- /package/dist/{channel-access-DFIQqbYm.js → channel-access-BL-wemES.js} +0 -0
- /package/dist/{doctor-shared-Cqvfgv9m.js → doctor-shared-D_QLzu30.js} +0 -0
- /package/dist/{mentions-BPZUaFk7.js → mentions-f806C7MB.js} +0 -0
- /package/dist/{preflight-audio.runtime-DPVbpZid.js → preflight-audio.runtime-fXnUxxBa.js} +0 -0
- /package/dist/{probe-E80IMT1X.js → probe-CjO53qsc.js} +0 -0
- /package/dist/{runtime-K9RT6Egn.js → runtime-BqCoo-zp.js} +0 -0
- /package/dist/{secret-config-contract-5S9U9pjx.js → secret-config-contract-BCQNNS7N.js} +0 -0
- /package/dist/{security-contract-BE8rsdPq.js → security-contract-DrbQqyyW.js} +0 -0
- /package/dist/{security-doctor-DiilN216.js → security-doctor-BJH5YIGL.js} +0 -0
- /package/dist/{sender-identity-BGUfyvOC.js → sender-identity-CDOVm5Dk.js} +0 -0
- /package/dist/{session-contract-CuW9Nlxg.js → session-contract-D871HDFG.js} +0 -0
- /package/dist/{session-key-normalization-B5La-jFM.js → session-key-normalization-BQNCS1gu.js} +0 -0
- /package/dist/{thread-bindings.state-WU4duXKY.js → thread-bindings.state-DwgDYzBM.js} +0 -0
- /package/dist/{timeouts-CdsmBWWs.js → timeouts-C3FYXWJX.js} +0 -0
|
@@ -1,32 +1,32 @@
|
|
|
1
|
+
import { A as Button, B as Separator, C as User, D as Modal, G as BaseMessageInteractiveComponent, H as TextDisplay, M as Container, R as Row, S as Message, V as StringSelectMenu, a as MessageReactionRemoveListener, b as CommandWithSubcommands, d as Client, f as Plugin, h as RateLimitError, i as MessageReactionAddListener, l as ThreadUpdateListener, n as InteractionCreateListener, o as PresenceUpdateListener, r as MessageCreateListener, s as ReadyListener, t as discord_exports, x as Guild, y as Command } from "./discord-DtHMmZqJ.js";
|
|
1
2
|
import { t as normalizeDiscordToken } from "./token-BZtonk7d.js";
|
|
2
3
|
import { c as resolveDiscordAccountAllowFrom, d as resolveDiscordAccountDmPolicy, f as resolveDiscordMaxLinesPerMessage, s as resolveDiscordAccount } from "./accounts-CaHGiVB4.js";
|
|
3
|
-
import {
|
|
4
|
-
import { a as resolveDiscordComponentEntryWithPersistence, o as resolveDiscordModalEntryWithPersistence, t as editDiscordComponentMessage } from "./send.components-A42c_5tQ.js";
|
|
4
|
+
import { a as resolveDiscordComponentEntryWithPersistence, o as resolveDiscordModalEntryWithPersistence, t as editDiscordComponentMessage } from "./send.components-BoEhxys4.js";
|
|
5
5
|
import { c as setPresence, i as unregisterGateway, r as registerGateway } from "./gateway-registry-BKG4KIVC.js";
|
|
6
|
-
import {
|
|
7
|
-
import { F as DISCORD_REST_TIMEOUT_MS, I as validateDiscordProxyUrl, L as withValidatedDiscordProxy, j as createDiscordRestClient } from "./send.shared-
|
|
6
|
+
import { t as chunkDiscordTextWithMode } from "./chunk-DYl-_5RL.js";
|
|
7
|
+
import { F as DISCORD_REST_TIMEOUT_MS, I as validateDiscordProxyUrl, L as withValidatedDiscordProxy, j as createDiscordRestClient } from "./send.shared-DzwpAEMP.js";
|
|
8
8
|
import { a as summarizeDiscordResponseBody, i as isDiscordRateLimitResponseBody } from "./api-DzNBVTto.js";
|
|
9
9
|
import { n as formatDiscordUserTag, t as formatDiscordReactionEmoji } from "./format-D8TsaXxW.js";
|
|
10
|
-
import { _ as resolveGroupDmAllow, a as normalizeDiscordSlug, c as resolveDiscordChannelConfigWithFallback, d as resolveDiscordGuildEntry, f as resolveDiscordMemberAccessState, i as normalizeDiscordDisplaySlug, l as resolveDiscordChannelPolicyCommandAuthorizer, m as resolveDiscordOwnerAccess, n as isDiscordGroupAllowedByPolicy, o as resolveDiscordAllowListMatch, r as normalizeDiscordAllowList, v as shouldEmitDiscordReactionNotification } from "./allow-list-
|
|
11
|
-
import { t as formatMention } from "./mentions-
|
|
12
|
-
import { _ as parseDiscordModalCustomIdForInteraction, g as parseDiscordModalCustomId, h as parseDiscordComponentCustomIdForInteraction, m as parseDiscordComponentCustomId } from "./components-
|
|
13
|
-
import { i as isDiscordExecApprovalClientEnabled, n as getDiscordExecApprovalApprovers } from "./approval-shared-
|
|
14
|
-
import "./approval-native-
|
|
15
|
-
import { t as resolveDiscordConversationIdentity } from "./conversation-identity-
|
|
16
|
-
import { t as resolveDiscordChannelAllowlist } from "./resolve-channels-
|
|
17
|
-
import { t as resolveDiscordUserAllowlist } from "./resolve-users-
|
|
18
|
-
import { a as isThreadArchived, d as formatThreadBindingDurationLabel } from "./thread-bindings.discord-api-
|
|
19
|
-
import { i as resolveDiscordChannelParentIdSafe, n as resolveDiscordChannelInfoSafe, o as resolveDiscordChannelTopicSafe, r as resolveDiscordChannelNameSafe, t as resolveDiscordChannelIdSafe } from "./channel-access-
|
|
20
|
-
import { r as parseApplicationIdFromToken, t as fetchDiscordApplicationId } from "./probe-
|
|
21
|
-
import { o as raceWithTimeout, s as withAbortTimeout } from "./timeouts-
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import { t as resolveDiscordSenderIdentity } from "./sender-identity-
|
|
26
|
-
import { n as buildDiscordInboundAccessContext, t as buildDiscordGroupSystemPrompt } from "./inbound-context-
|
|
27
|
-
import { n as resolveDiscordVoiceEnabled, t as authorizeDiscordVoiceIngress } from "./access-
|
|
28
|
-
import { n as buildDirectLabel, r as buildGuildLabel, t as deliverDiscordReply } from "./reply-delivery-
|
|
29
|
-
import "./approval-handler.runtime-
|
|
10
|
+
import { _ as resolveGroupDmAllow, a as normalizeDiscordSlug, c as resolveDiscordChannelConfigWithFallback, d as resolveDiscordGuildEntry, f as resolveDiscordMemberAccessState, i as normalizeDiscordDisplaySlug, l as resolveDiscordChannelPolicyCommandAuthorizer, m as resolveDiscordOwnerAccess, n as isDiscordGroupAllowedByPolicy, o as resolveDiscordAllowListMatch, r as normalizeDiscordAllowList, v as shouldEmitDiscordReactionNotification } from "./allow-list-4wnZg5P9.js";
|
|
11
|
+
import { t as formatMention } from "./mentions-f806C7MB.js";
|
|
12
|
+
import { _ as parseDiscordModalCustomIdForInteraction, g as parseDiscordModalCustomId, h as parseDiscordComponentCustomIdForInteraction, m as parseDiscordComponentCustomId } from "./components-BJOShoIU.js";
|
|
13
|
+
import { i as isDiscordExecApprovalClientEnabled, n as getDiscordExecApprovalApprovers } from "./approval-shared-Ckk65xSG.js";
|
|
14
|
+
import "./approval-native-CrCc3b4u.js";
|
|
15
|
+
import { t as resolveDiscordConversationIdentity } from "./conversation-identity-BPQm_uhV.js";
|
|
16
|
+
import { t as resolveDiscordChannelAllowlist } from "./resolve-channels-D9Dubj_y.js";
|
|
17
|
+
import { t as resolveDiscordUserAllowlist } from "./resolve-users-DlzKsLQe.js";
|
|
18
|
+
import { a as isThreadArchived, d as formatThreadBindingDurationLabel } from "./thread-bindings.discord-api-dpSDYFKX.js";
|
|
19
|
+
import { i as resolveDiscordChannelParentIdSafe, n as resolveDiscordChannelInfoSafe, o as resolveDiscordChannelTopicSafe, r as resolveDiscordChannelNameSafe, t as resolveDiscordChannelIdSafe } from "./channel-access-BL-wemES.js";
|
|
20
|
+
import { r as parseApplicationIdFromToken, t as fetchDiscordApplicationId } from "./probe-CjO53qsc.js";
|
|
21
|
+
import { o as raceWithTimeout, s as withAbortTimeout } from "./timeouts-C3FYXWJX.js";
|
|
22
|
+
import { i as resolveDiscordEffectiveRoute, n as resolveDiscordBoundConversationRoute, o as handleDiscordDmCommandDecision, s as resolveDiscordDmCommandAccess } from "./route-resolution-foWW8_D1.js";
|
|
23
|
+
import { c as resolveDiscordChannelInfo } from "./message-utils-DEjCwCRz.js";
|
|
24
|
+
import { i as resolveDiscordThreadParentInfo } from "./threading-CTUnZtNi.js";
|
|
25
|
+
import { t as resolveDiscordSenderIdentity } from "./sender-identity-CDOVm5Dk.js";
|
|
26
|
+
import { n as buildDiscordInboundAccessContext, t as buildDiscordGroupSystemPrompt } from "./inbound-context-BAwOn5Iq.js";
|
|
27
|
+
import { n as resolveDiscordVoiceEnabled, t as authorizeDiscordVoiceIngress } from "./access-R4X7pYt4.js";
|
|
28
|
+
import { n as buildDirectLabel, r as buildGuildLabel, t as deliverDiscordReply } from "./reply-delivery-vHSqaKKo.js";
|
|
29
|
+
import "./approval-handler.runtime-B5BCBw4D.js";
|
|
30
30
|
import { normalizeAccountId } from "openclaw/plugin-sdk/account-id";
|
|
31
31
|
import { chunkItems, logDebug, logError, normalizeLowercaseStringOrEmpty, normalizeOptionalLowercaseString, normalizeOptionalString, normalizeStringEntries, summarizeStringEntries, withTimeout } from "openclaw/plugin-sdk/text-runtime";
|
|
32
32
|
import { resolveAgentRoute } from "openclaw/plugin-sdk/routing";
|
|
@@ -34,6 +34,7 @@ import { getRuntimeConfig } from "openclaw/plugin-sdk/runtime-config-snapshot";
|
|
|
34
34
|
import { ApplicationCommandOptionType, ButtonStyle, ChannelType, ComponentType, GatewayCloseCodes, GatewayCloseCodes as GatewayCloseCodes$1, GatewayDispatchEvents, GatewayIntentBits, GatewayOpcodes } from "discord-api-types/v10";
|
|
35
35
|
import { randomUUID } from "node:crypto";
|
|
36
36
|
import path from "node:path";
|
|
37
|
+
import { resolvePinnedMainDmOwnerFromAllowlist as resolvePinnedMainDmOwnerFromAllowlist$1 } from "openclaw/plugin-sdk/security-runtime";
|
|
37
38
|
import { Type } from "typebox";
|
|
38
39
|
import { Check, Errors } from "typebox/value";
|
|
39
40
|
import { inspect } from "node:util";
|
|
@@ -45,6 +46,7 @@ import { wrapFetchWithAbortSignal } from "openclaw/plugin-sdk/fetch-runtime";
|
|
|
45
46
|
import { createNonExitingRuntime, createSubsystemLogger, danger, formatDurationSeconds, isVerbose, logVerbose, shouldLogVerbose, warn } from "openclaw/plugin-sdk/runtime-env";
|
|
46
47
|
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
47
48
|
import { resolveMarkdownTableMode } from "openclaw/plugin-sdk/markdown-table-runtime";
|
|
49
|
+
import { createChannelMessageReplyPipeline } from "openclaw/plugin-sdk/channel-message";
|
|
48
50
|
import { fetchWithSsrFGuard, formatErrorMessage as formatErrorMessage$1 } from "openclaw/plugin-sdk/ssrf-runtime";
|
|
49
51
|
import { createChannelPairingChallengeIssuer } from "openclaw/plugin-sdk/channel-pairing";
|
|
50
52
|
import { CHANNEL_APPROVAL_NATIVE_RUNTIME_CONTEXT_CAPABILITY } from "openclaw/plugin-sdk/approval-handler-adapter-runtime";
|
|
@@ -57,15 +59,13 @@ import { clearExpiredCooldowns, ensureAuthProfileStore, isProfileInCooldown, res
|
|
|
57
59
|
import { GROUP_POLICY_BLOCKED_LABEL, resolveDefaultGroupPolicy, resolveOpenProviderRuntimeGroupPolicy, warnMissingProviderGroupPolicyFallbackOnce } from "openclaw/plugin-sdk/runtime-group-policy";
|
|
58
60
|
import { isDangerousNameMatchingEnabled } from "openclaw/plugin-sdk/dangerous-name-runtime";
|
|
59
61
|
import { resolveNativeCommandsEnabled, resolveNativeSkillsEnabled } from "openclaw/plugin-sdk/native-command-config-runtime";
|
|
60
|
-
import { readStoreAllowFromForDmPolicy, readStoreAllowFromForDmPolicy as readStoreAllowFromForDmPolicy$1, resolveDmGroupAccessWithLists, resolvePinnedMainDmOwnerFromAllowlist as resolvePinnedMainDmOwnerFromAllowlist$1 } from "openclaw/plugin-sdk/security-runtime";
|
|
61
62
|
import { enqueueSystemEvent, enqueueSystemEvent as enqueueSystemEvent$1 } from "openclaw/plugin-sdk/system-event-runtime";
|
|
63
|
+
import { readChannelIngressStoreAllowFromForDmPolicy } from "openclaw/plugin-sdk/channel-ingress-runtime";
|
|
62
64
|
import { applyModelOverrideToSessionEntry } from "openclaw/plugin-sdk/model-session-runtime";
|
|
63
65
|
import { loadSessionStore, readSessionUpdatedAt as readSessionUpdatedAt$1, resolveStorePath, resolveStorePath as resolveStorePath$1, updateSessionStore } from "openclaw/plugin-sdk/session-store-runtime";
|
|
64
66
|
import { formatInboundEnvelope, resolveEnvelopeFormatOptions } from "openclaw/plugin-sdk/channel-inbound";
|
|
65
|
-
import { resolveCommandAuthorizedFromAuthorizers, resolveNativeCommandSessionTargets } from "openclaw/plugin-sdk/command-auth-native";
|
|
66
|
-
import { buildCommandTextFromArgs, findCommandByNativeName, parseCommandArgs, resolveCommandArgChoices, resolveCommandArgMenu, serializeCommandArgs } from "openclaw/plugin-sdk/native-command-registry";
|
|
67
|
-
import { buildCommandTextFromArgs as buildCommandTextFromArgs$1, findCommandByNativeName as findCommandByNativeName$1, formatCommandArgMenuTitle, listChatCommands, listNativeCommandSpecsForConfig, listSkillCommandsForAgents, resolveStoredModelOverride, serializeCommandArgs as serializeCommandArgs$1 } from "openclaw/plugin-sdk/command-auth";
|
|
68
|
-
import { createChannelReplyPipeline } from "openclaw/plugin-sdk/channel-reply-pipeline";
|
|
67
|
+
import { buildCommandTextFromArgs, findCommandByNativeName, formatCommandArgMenuTitle, listChatCommands, listNativeCommandSpecsForConfig, listSkillCommandsForAgents, resolveCommandAuthorizedFromAuthorizers, resolveNativeCommandSessionTargets, resolveStoredModelOverride, serializeCommandArgs } from "openclaw/plugin-sdk/command-auth-native";
|
|
68
|
+
import { buildCommandTextFromArgs as buildCommandTextFromArgs$1, findCommandByNativeName as findCommandByNativeName$1, parseCommandArgs, resolveCommandArgChoices, resolveCommandArgMenu, serializeCommandArgs as serializeCommandArgs$1 } from "openclaw/plugin-sdk/native-command-registry";
|
|
69
69
|
import { resolveDirectStatusReplyForSession } from "openclaw/plugin-sdk/command-status-runtime";
|
|
70
70
|
import * as pluginRuntime from "openclaw/plugin-sdk/plugin-runtime";
|
|
71
71
|
import { createInteractiveConversationBindingHelpers, dispatchPluginInteractiveHandler } from "openclaw/plugin-sdk/plugin-runtime";
|
|
@@ -275,38 +275,22 @@ async function authorizeDiscordReactionIngress(params) {
|
|
|
275
275
|
reason: "group-dm-disabled"
|
|
276
276
|
};
|
|
277
277
|
if (params.isDirectMessage) {
|
|
278
|
-
const
|
|
279
|
-
|
|
278
|
+
const access = await resolveDiscordDmCommandAccess({
|
|
279
|
+
cfg: params.cfg,
|
|
280
280
|
accountId: params.accountId,
|
|
281
|
-
dmPolicy: params.dmPolicy
|
|
282
|
-
});
|
|
283
|
-
const access = resolveDmGroupAccessWithLists({
|
|
284
|
-
isGroup: false,
|
|
285
281
|
dmPolicy: params.dmPolicy,
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
"pk:"
|
|
295
|
-
]);
|
|
296
|
-
return (allowList ? resolveDiscordAllowListMatch({
|
|
297
|
-
allowList,
|
|
298
|
-
candidate: {
|
|
299
|
-
id: params.user.id,
|
|
300
|
-
name: params.user.username,
|
|
301
|
-
tag: formatDiscordUserTag(params.user)
|
|
302
|
-
},
|
|
303
|
-
allowNameMatching: params.allowNameMatching
|
|
304
|
-
}) : { allowed: false }).allowed;
|
|
305
|
-
}
|
|
282
|
+
configuredAllowFrom: params.allowFrom,
|
|
283
|
+
sender: {
|
|
284
|
+
id: params.user.id,
|
|
285
|
+
name: params.user.username,
|
|
286
|
+
tag: formatDiscordUserTag(params.user)
|
|
287
|
+
},
|
|
288
|
+
allowNameMatching: params.allowNameMatching,
|
|
289
|
+
eventKind: "reaction"
|
|
306
290
|
});
|
|
307
|
-
if (access.decision !== "allow") return {
|
|
291
|
+
if (access.senderAccess.decision !== "allow") return {
|
|
308
292
|
allowed: false,
|
|
309
|
-
reason: access.
|
|
293
|
+
reason: access.senderAccess.reasonCode
|
|
310
294
|
};
|
|
311
295
|
}
|
|
312
296
|
if (params.isGroupDm && !resolveGroupDmAllow({
|
|
@@ -453,6 +437,7 @@ async function handleDiscordReactionEvent(params) {
|
|
|
453
437
|
const isGroupDm = channelType === discord_exports.ChannelType.GroupDM;
|
|
454
438
|
const isThreadChannel = channelContext.isThreadChannel;
|
|
455
439
|
const reactionIngressBase = {
|
|
440
|
+
cfg: params.cfg,
|
|
456
441
|
accountId: params.accountId,
|
|
457
442
|
user,
|
|
458
443
|
memberRoleIds,
|
|
@@ -509,7 +494,8 @@ async function handleDiscordReactionEvent(params) {
|
|
|
509
494
|
id: parentPeerId
|
|
510
495
|
} : void 0
|
|
511
496
|
}).sessionKey,
|
|
512
|
-
contextKey
|
|
497
|
+
contextKey,
|
|
498
|
+
trusted: false
|
|
513
499
|
});
|
|
514
500
|
};
|
|
515
501
|
const shouldNotifyReaction = (options) => shouldEmitDiscordReactionNotification({
|
|
@@ -860,7 +846,7 @@ const nativeCommandRuntime = {
|
|
|
860
846
|
//#endregion
|
|
861
847
|
//#region extensions/discord/src/monitor/native-command-agent-reply.ts
|
|
862
848
|
async function dispatchDiscordNativeAgentReply(params) {
|
|
863
|
-
const { onModelSelected, ...replyPipeline } =
|
|
849
|
+
const { onModelSelected, ...replyPipeline } = createChannelMessageReplyPipeline({
|
|
864
850
|
cfg: params.cfg,
|
|
865
851
|
agentId: params.effectiveRoute.agentId,
|
|
866
852
|
channel: "discord",
|
|
@@ -985,7 +971,7 @@ function resolveDiscordNativeCommandAllowlistAccess(params) {
|
|
|
985
971
|
}).allowed
|
|
986
972
|
};
|
|
987
973
|
}
|
|
988
|
-
function resolveDiscordGuildNativeCommandAuthorized(params) {
|
|
974
|
+
async function resolveDiscordGuildNativeCommandAuthorized(params) {
|
|
989
975
|
const { groupPolicy } = resolveOpenProviderRuntimeGroupPolicy({
|
|
990
976
|
providerConfigPresent: params.cfg.channels?.discord !== void 0,
|
|
991
977
|
groupPolicy: params.discordConfig?.groupPolicy,
|
|
@@ -1137,10 +1123,9 @@ async function resolveDiscordNativeAutocompleteAuthorized(params) {
|
|
|
1137
1123
|
tag: sender.tag
|
|
1138
1124
|
},
|
|
1139
1125
|
allowNameMatching,
|
|
1140
|
-
useAccessGroups,
|
|
1141
1126
|
cfg,
|
|
1142
1127
|
rest: interaction.client.rest
|
|
1143
|
-
})).decision !== "allow") return false;
|
|
1128
|
+
})).senderAccess.decision !== "allow") return false;
|
|
1144
1129
|
}
|
|
1145
1130
|
if (!resolveDiscordNativeGroupDmAccess({
|
|
1146
1131
|
isGroupDm,
|
|
@@ -1152,6 +1137,7 @@ async function resolveDiscordNativeAutocompleteAuthorized(params) {
|
|
|
1152
1137
|
}).allowed) return false;
|
|
1153
1138
|
if (!isDirectMessage) return resolveDiscordGuildNativeCommandAuthorized({
|
|
1154
1139
|
cfg,
|
|
1140
|
+
accountId,
|
|
1155
1141
|
discordConfig,
|
|
1156
1142
|
useAccessGroups,
|
|
1157
1143
|
commandsAllowFromAccess,
|
|
@@ -1325,7 +1311,7 @@ async function handleDiscordCommandArgInteraction(params) {
|
|
|
1325
1311
|
await params.safeInteractionCall("command arg ack", () => interaction.acknowledge());
|
|
1326
1312
|
return;
|
|
1327
1313
|
}
|
|
1328
|
-
const commandDefinition = findCommandByNativeName
|
|
1314
|
+
const commandDefinition = findCommandByNativeName(parsed.command, "discord") ?? listChatCommands().find((entry) => entry.key === parsed.command);
|
|
1329
1315
|
if (!commandDefinition) {
|
|
1330
1316
|
await clearWithMessage("Sorry, that command is no longer available.");
|
|
1331
1317
|
return;
|
|
@@ -1337,9 +1323,9 @@ async function handleDiscordCommandArgInteraction(params) {
|
|
|
1337
1323
|
});
|
|
1338
1324
|
const commandArgsWithRaw = {
|
|
1339
1325
|
...commandArgs,
|
|
1340
|
-
raw: serializeCommandArgs
|
|
1326
|
+
raw: serializeCommandArgs(commandDefinition, commandArgs)
|
|
1341
1327
|
};
|
|
1342
|
-
const prompt = buildCommandTextFromArgs
|
|
1328
|
+
const prompt = buildCommandTextFromArgs(commandDefinition, commandArgsWithRaw);
|
|
1343
1329
|
await params.dispatchCommandInteraction({
|
|
1344
1330
|
interaction,
|
|
1345
1331
|
prompt,
|
|
@@ -2226,7 +2212,7 @@ function resolveCommandArgStringValue(args, key) {
|
|
|
2226
2212
|
function shouldOpenDiscordModelPickerFromCommand(params) {
|
|
2227
2213
|
const context = resolveDiscordModelPickerCommandContext(params.command);
|
|
2228
2214
|
if (!context) return null;
|
|
2229
|
-
const serializedArgs = normalizeOptionalString(serializeCommandArgs
|
|
2215
|
+
const serializedArgs = normalizeOptionalString(serializeCommandArgs(params.command, params.commandArgs)) ?? "";
|
|
2230
2216
|
if (context === "model") return !resolveCommandArgStringValue(params.commandArgs, "model") && !serializedArgs ? context : null;
|
|
2231
2217
|
return serializedArgs ? null : context;
|
|
2232
2218
|
}
|
|
@@ -2371,12 +2357,14 @@ async function replyWithDiscordModelPickerProviders(params) {
|
|
|
2371
2357
|
allowedModelRefs: buildDiscordModelPickerAllowedModelRefs(data),
|
|
2372
2358
|
limit: 5
|
|
2373
2359
|
});
|
|
2360
|
+
const currentProvider = splitDiscordModelRef(currentModel ?? "")?.provider;
|
|
2361
|
+
const initialProvider = currentProvider && data.byProvider.has(currentProvider) ? currentProvider : data.providers[0] ?? data.resolvedDefault.provider;
|
|
2374
2362
|
const payload = {
|
|
2375
2363
|
...toDiscordModelPickerMessagePayload(renderDiscordModelPickerModelsView({
|
|
2376
2364
|
command: params.command,
|
|
2377
2365
|
userId: params.userId,
|
|
2378
2366
|
data,
|
|
2379
|
-
provider:
|
|
2367
|
+
provider: initialProvider,
|
|
2380
2368
|
page: 1,
|
|
2381
2369
|
providerPage: 1,
|
|
2382
2370
|
currentModel,
|
|
@@ -2415,7 +2403,7 @@ function resolveModelPickerSelectionValue(interaction) {
|
|
|
2415
2403
|
return first.trim() || null;
|
|
2416
2404
|
}
|
|
2417
2405
|
function buildDiscordModelPickerSelectionCommand(params) {
|
|
2418
|
-
const commandDefinition = findCommandByNativeName
|
|
2406
|
+
const commandDefinition = findCommandByNativeName("model", "discord") ?? listChatCommands().find((entry) => entry.key === "model");
|
|
2419
2407
|
if (!commandDefinition) return null;
|
|
2420
2408
|
const runtime = normalizeOptionalString(params.runtime);
|
|
2421
2409
|
const raw = runtime ? `${params.modelRef} --runtime ${runtime}` : params.modelRef;
|
|
@@ -2426,7 +2414,7 @@ function buildDiscordModelPickerSelectionCommand(params) {
|
|
|
2426
2414
|
return {
|
|
2427
2415
|
command: commandDefinition,
|
|
2428
2416
|
args: commandArgs,
|
|
2429
|
-
prompt: buildCommandTextFromArgs
|
|
2417
|
+
prompt: buildCommandTextFromArgs(commandDefinition, commandArgs)
|
|
2430
2418
|
};
|
|
2431
2419
|
}
|
|
2432
2420
|
function listDiscordModelPickerProviderModels(data, provider) {
|
|
@@ -2458,6 +2446,11 @@ async function handleDiscordModelPickerInteraction(params) {
|
|
|
2458
2446
|
await params.safeInteractionCall("model picker ack", () => interaction.acknowledge());
|
|
2459
2447
|
return;
|
|
2460
2448
|
}
|
|
2449
|
+
let deferredUpdate = interaction.acknowledged;
|
|
2450
|
+
if (!deferredUpdate) {
|
|
2451
|
+
if (await params.safeInteractionCall("model picker defer", () => interaction.acknowledge()) === null) return;
|
|
2452
|
+
deferredUpdate = true;
|
|
2453
|
+
}
|
|
2461
2454
|
const route = await resolveDiscordModelPickerRoute({
|
|
2462
2455
|
interaction,
|
|
2463
2456
|
cfg: ctx.cfg,
|
|
@@ -2485,7 +2478,7 @@ async function handleDiscordModelPickerInteraction(params) {
|
|
|
2485
2478
|
allowedModelRefs,
|
|
2486
2479
|
limit: 5
|
|
2487
2480
|
});
|
|
2488
|
-
const updatePicker = async (payload) => await params.safeInteractionCall("model picker update", () => interaction.update(payload));
|
|
2481
|
+
const updatePicker = async (payload) => await params.safeInteractionCall("model picker update", () => deferredUpdate ? interaction.editReply(payload) : interaction.update(payload));
|
|
2489
2482
|
const showNotice = async (message) => await updatePicker(buildDiscordModelPickerNoticePayload(message));
|
|
2490
2483
|
if (parsed.action === "recents") {
|
|
2491
2484
|
await updatePicker(toDiscordModelPickerMessagePayload(renderDiscordModelPickerRecentsView({
|
|
@@ -2854,7 +2847,7 @@ function resolveDiscordCommandOwnerAllowFrom(cfg) {
|
|
|
2854
2847
|
function createDiscordNativeCommand(params) {
|
|
2855
2848
|
const { command, cfg, discordConfig, accountId, sessionPrefix, ephemeralDefault, threadBindings } = params;
|
|
2856
2849
|
const fallbackCommandDefinition = createNativeCommandDefinition(command);
|
|
2857
|
-
const commandDefinition = nativeCommandRuntime.matchPluginCommand(`/${command.name}`) !== null ? fallbackCommandDefinition : findCommandByNativeName(command.name, "discord", { includeBundledChannelFallback: false }) ?? fallbackCommandDefinition;
|
|
2850
|
+
const commandDefinition = nativeCommandRuntime.matchPluginCommand(`/${command.name}`) !== null ? fallbackCommandDefinition : findCommandByNativeName$1(command.name, "discord", { includeBundledChannelFallback: false }) ?? fallbackCommandDefinition;
|
|
2858
2851
|
const argDefinitions = commandDefinition.args ?? command.args;
|
|
2859
2852
|
const commandOptions = buildDiscordCommandOptions({
|
|
2860
2853
|
command: commandDefinition,
|
|
@@ -2899,11 +2892,11 @@ function createDiscordNativeCommand(params) {
|
|
|
2899
2892
|
const commandArgs = argDefinitions?.length ? readDiscordCommandArgs(interaction, argDefinitions) : command.acceptsArgs ? parseCommandArgs(commandDefinition, interaction.options.getString("input") ?? "") : void 0;
|
|
2900
2893
|
const commandArgsWithRaw = commandArgs ? {
|
|
2901
2894
|
...commandArgs,
|
|
2902
|
-
raw: serializeCommandArgs(commandDefinition, commandArgs) ?? commandArgs.raw
|
|
2895
|
+
raw: serializeCommandArgs$1(commandDefinition, commandArgs) ?? commandArgs.raw
|
|
2903
2896
|
} : void 0;
|
|
2904
2897
|
await dispatchDiscordCommandInteraction({
|
|
2905
2898
|
interaction,
|
|
2906
|
-
prompt: buildCommandTextFromArgs(commandDefinition, commandArgsWithRaw),
|
|
2899
|
+
prompt: buildCommandTextFromArgs$1(commandDefinition, commandArgsWithRaw),
|
|
2907
2900
|
command: commandDefinition,
|
|
2908
2901
|
commandArgs: commandArgsWithRaw,
|
|
2909
2902
|
cfg,
|
|
@@ -3067,14 +3060,13 @@ async function dispatchDiscordCommandInteraction(params) {
|
|
|
3067
3060
|
tag: sender.tag
|
|
3068
3061
|
},
|
|
3069
3062
|
allowNameMatching,
|
|
3070
|
-
useAccessGroups,
|
|
3071
3063
|
cfg,
|
|
3072
3064
|
rest: interaction.client.rest
|
|
3073
3065
|
});
|
|
3074
|
-
commandAuthorized = dmAccess.
|
|
3075
|
-
if (dmAccess.decision !== "allow") {
|
|
3066
|
+
commandAuthorized = dmAccess.senderAccess.allowed ? dmAccess.commandAccess.authorized : false;
|
|
3067
|
+
if (dmAccess.senderAccess.decision !== "allow") {
|
|
3076
3068
|
await handleDiscordDmCommandDecision({
|
|
3077
|
-
dmAccess,
|
|
3069
|
+
senderAccess: dmAccess.senderAccess,
|
|
3078
3070
|
accountId,
|
|
3079
3071
|
sender: {
|
|
3080
3072
|
id: user.id,
|
|
@@ -3108,8 +3100,9 @@ async function dispatchDiscordCommandInteraction(params) {
|
|
|
3108
3100
|
return { accepted: false };
|
|
3109
3101
|
}
|
|
3110
3102
|
if (!isDirectMessage) {
|
|
3111
|
-
commandAuthorized = resolveDiscordGuildNativeCommandAuthorized({
|
|
3103
|
+
commandAuthorized = await resolveDiscordGuildNativeCommandAuthorized({
|
|
3112
3104
|
cfg,
|
|
3105
|
+
accountId,
|
|
3113
3106
|
discordConfig,
|
|
3114
3107
|
useAccessGroups,
|
|
3115
3108
|
commandsAllowFromAccess,
|
|
@@ -4953,18 +4946,20 @@ async function resolveDiscordAllowlistConfig(params) {
|
|
|
4953
4946
|
fetcher: params.fetcher,
|
|
4954
4947
|
runtime: params.runtime
|
|
4955
4948
|
});
|
|
4956
|
-
|
|
4957
|
-
|
|
4958
|
-
|
|
4959
|
-
|
|
4960
|
-
|
|
4961
|
-
|
|
4962
|
-
|
|
4963
|
-
|
|
4964
|
-
|
|
4965
|
-
|
|
4966
|
-
|
|
4967
|
-
|
|
4949
|
+
if (isDangerousNameMatchingEnabled(params.discordConfig)) {
|
|
4950
|
+
allowFrom = await resolveAllowFromByUserAllowlist({
|
|
4951
|
+
token: params.token,
|
|
4952
|
+
allowFrom,
|
|
4953
|
+
fetcher: params.fetcher,
|
|
4954
|
+
runtime: params.runtime
|
|
4955
|
+
});
|
|
4956
|
+
if (hasGuildEntries(guildEntries)) guildEntries = await resolveGuildEntriesByUserAllowlist({
|
|
4957
|
+
token: params.token,
|
|
4958
|
+
guildEntries,
|
|
4959
|
+
fetcher: params.fetcher,
|
|
4960
|
+
runtime: params.runtime
|
|
4961
|
+
});
|
|
4962
|
+
}
|
|
4968
4963
|
return {
|
|
4969
4964
|
guildEntries: hasGuildEntries(guildEntries) ? guildEntries : void 0,
|
|
4970
4965
|
allowFrom
|
|
@@ -5413,6 +5408,7 @@ async function authorizeVoiceCommand(interaction, params, options) {
|
|
|
5413
5408
|
const access = await authorizeDiscordVoiceIngress({
|
|
5414
5409
|
cfg: params.cfg,
|
|
5415
5410
|
discordConfig: params.discordConfig,
|
|
5411
|
+
accountId: params.accountId,
|
|
5416
5412
|
groupPolicy: params.groupPolicy,
|
|
5417
5413
|
useAccessGroups: params.useAccessGroups,
|
|
5418
5414
|
guild: interaction.guild,
|
|
@@ -5730,35 +5726,6 @@ async function replySilently(interaction, params) {
|
|
|
5730
5726
|
//#region extensions/discord/src/monitor/agent-components-dm-auth.ts
|
|
5731
5727
|
async function ensureDmComponentAuthorized(params) {
|
|
5732
5728
|
const { ctx, interaction, user, componentLabel, replyOpts } = params;
|
|
5733
|
-
const allowFromPrefixes = [
|
|
5734
|
-
"discord:",
|
|
5735
|
-
"user:",
|
|
5736
|
-
"pk:"
|
|
5737
|
-
];
|
|
5738
|
-
const resolveAllowMatch = (entries) => {
|
|
5739
|
-
const allowList = normalizeDiscordAllowList(entries, allowFromPrefixes);
|
|
5740
|
-
return allowList ? resolveDiscordAllowListMatch({
|
|
5741
|
-
allowList,
|
|
5742
|
-
candidate: {
|
|
5743
|
-
id: user.id,
|
|
5744
|
-
name: user.username,
|
|
5745
|
-
tag: formatDiscordUserTag(user)
|
|
5746
|
-
},
|
|
5747
|
-
allowNameMatching: isDangerousNameMatchingEnabled(ctx.discordConfig)
|
|
5748
|
-
}) : { allowed: false };
|
|
5749
|
-
};
|
|
5750
|
-
const resolveAllowMatchWithAccessGroups = async (entries) => {
|
|
5751
|
-
const staticMatch = resolveAllowMatch(entries);
|
|
5752
|
-
if (staticMatch.allowed) return staticMatch;
|
|
5753
|
-
return (await resolveDiscordDmAccessGroupEntries({
|
|
5754
|
-
cfg: ctx.cfg,
|
|
5755
|
-
allowFrom: entries,
|
|
5756
|
-
sender: { id: user.id },
|
|
5757
|
-
accountId: ctx.accountId,
|
|
5758
|
-
token: ctx.token,
|
|
5759
|
-
isSenderAllowed: (senderId, allowFrom) => resolveAllowMatch(allowFrom).allowed || allowFrom.includes(senderId)
|
|
5760
|
-
})).length > 0 ? resolveAllowMatch([...entries, `discord:${user.id}`]) : staticMatch;
|
|
5761
|
-
};
|
|
5762
5729
|
const dmPolicy = ctx.dmPolicy ?? "pairing";
|
|
5763
5730
|
if (dmPolicy === "disabled") {
|
|
5764
5731
|
logVerbose(`agent ${componentLabel}: blocked (DM policy disabled)`);
|
|
@@ -5768,8 +5735,27 @@ async function ensureDmComponentAuthorized(params) {
|
|
|
5768
5735
|
});
|
|
5769
5736
|
return false;
|
|
5770
5737
|
}
|
|
5771
|
-
|
|
5772
|
-
|
|
5738
|
+
const access = await resolveDiscordDmCommandAccess({
|
|
5739
|
+
accountId: ctx.accountId,
|
|
5740
|
+
dmPolicy,
|
|
5741
|
+
configuredAllowFrom: ctx.allowFrom ?? [],
|
|
5742
|
+
sender: {
|
|
5743
|
+
id: user.id,
|
|
5744
|
+
name: user.username,
|
|
5745
|
+
tag: formatDiscordUserTag(user)
|
|
5746
|
+
},
|
|
5747
|
+
allowNameMatching: isDangerousNameMatchingEnabled(ctx.discordConfig),
|
|
5748
|
+
cfg: ctx.cfg,
|
|
5749
|
+
token: ctx.token,
|
|
5750
|
+
readStoreAllowFrom: async ({ accountId, dmPolicy }) => await readChannelIngressStoreAllowFromForDmPolicy({
|
|
5751
|
+
provider: "discord",
|
|
5752
|
+
accountId,
|
|
5753
|
+
dmPolicy
|
|
5754
|
+
}),
|
|
5755
|
+
eventKind: "button"
|
|
5756
|
+
});
|
|
5757
|
+
if (access.senderAccess.decision === "allow") return true;
|
|
5758
|
+
if (access.senderAccess.decision !== "pairing") {
|
|
5773
5759
|
logVerbose(`agent ${componentLabel}: blocked DM user ${user.id} (not in allowFrom)`);
|
|
5774
5760
|
await replySilently(interaction, {
|
|
5775
5761
|
content: `You are not authorized to use this ${componentLabel}.`,
|
|
@@ -5777,46 +5763,31 @@ async function ensureDmComponentAuthorized(params) {
|
|
|
5777
5763
|
});
|
|
5778
5764
|
return false;
|
|
5779
5765
|
}
|
|
5780
|
-
|
|
5781
|
-
|
|
5782
|
-
|
|
5783
|
-
|
|
5784
|
-
|
|
5785
|
-
|
|
5786
|
-
|
|
5787
|
-
|
|
5788
|
-
|
|
5789
|
-
|
|
5790
|
-
|
|
5791
|
-
|
|
5792
|
-
|
|
5793
|
-
|
|
5794
|
-
|
|
5795
|
-
|
|
5796
|
-
|
|
5797
|
-
|
|
5798
|
-
|
|
5799
|
-
|
|
5800
|
-
|
|
5801
|
-
|
|
5802
|
-
|
|
5803
|
-
|
|
5804
|
-
|
|
5805
|
-
sendPairingReply: async (text) => {
|
|
5806
|
-
await interaction.reply({
|
|
5807
|
-
content: text,
|
|
5808
|
-
...replyOpts
|
|
5809
|
-
});
|
|
5810
|
-
}
|
|
5811
|
-
})).created) await replySilently(interaction, {
|
|
5812
|
-
content: "Pairing already requested. Ask the bot owner to approve your code.",
|
|
5813
|
-
...replyOpts
|
|
5814
|
-
});
|
|
5815
|
-
return false;
|
|
5816
|
-
}
|
|
5817
|
-
logVerbose(`agent ${componentLabel}: blocked DM user ${user.id} (not in allowFrom)`);
|
|
5818
|
-
await replySilently(interaction, {
|
|
5819
|
-
content: `You are not authorized to use this ${componentLabel}.`,
|
|
5766
|
+
if (!(await createChannelPairingChallengeIssuer({
|
|
5767
|
+
channel: "discord",
|
|
5768
|
+
upsertPairingRequest: async ({ id, meta }) => {
|
|
5769
|
+
return await upsertChannelPairingRequest$1({
|
|
5770
|
+
channel: "discord",
|
|
5771
|
+
id,
|
|
5772
|
+
accountId: ctx.accountId,
|
|
5773
|
+
meta
|
|
5774
|
+
});
|
|
5775
|
+
}
|
|
5776
|
+
})({
|
|
5777
|
+
senderId: user.id,
|
|
5778
|
+
senderIdLine: `Your Discord user id: ${user.id}`,
|
|
5779
|
+
meta: {
|
|
5780
|
+
tag: formatDiscordUserTag(user),
|
|
5781
|
+
name: user.username
|
|
5782
|
+
},
|
|
5783
|
+
sendPairingReply: async (text) => {
|
|
5784
|
+
await interaction.reply({
|
|
5785
|
+
content: text,
|
|
5786
|
+
...replyOpts
|
|
5787
|
+
});
|
|
5788
|
+
}
|
|
5789
|
+
})).created) await replySilently(interaction, {
|
|
5790
|
+
content: "Pairing already requested. Ask the bot owner to approve your code.",
|
|
5820
5791
|
...replyOpts
|
|
5821
5792
|
});
|
|
5822
5793
|
return false;
|
|
@@ -6028,7 +5999,7 @@ async function resolveAuthorizedComponentInteraction(params) {
|
|
|
6028
5999
|
guildInfo,
|
|
6029
6000
|
channelConfig,
|
|
6030
6001
|
allowNameMatching,
|
|
6031
|
-
commandAuthorized: resolveComponentCommandAuthorized({
|
|
6002
|
+
commandAuthorized: await resolveComponentCommandAuthorized({
|
|
6032
6003
|
ctx: params.ctx,
|
|
6033
6004
|
interactionCtx,
|
|
6034
6005
|
channelConfig,
|
|
@@ -6039,7 +6010,7 @@ async function resolveAuthorizedComponentInteraction(params) {
|
|
|
6039
6010
|
replyOpts
|
|
6040
6011
|
};
|
|
6041
6012
|
}
|
|
6042
|
-
function resolveComponentCommandAuthorized(params) {
|
|
6013
|
+
async function resolveComponentCommandAuthorized(params) {
|
|
6043
6014
|
const { ctx, interactionCtx, channelConfig, guildInfo } = params;
|
|
6044
6015
|
if (interactionCtx.isDirectMessage) return true;
|
|
6045
6016
|
const { ownerAllowList, ownerAllowed: ownerOk } = resolveDiscordOwnerAccess({
|
|
@@ -6206,18 +6177,13 @@ const AGENT_SELECT_KEY = "agentsel";
|
|
|
6206
6177
|
//#endregion
|
|
6207
6178
|
//#region extensions/discord/src/monitor/agent-components.dispatch.ts
|
|
6208
6179
|
let conversationRuntimePromise$1;
|
|
6209
|
-
let replyPipelineRuntimePromise;
|
|
6210
6180
|
let typingRuntimePromise;
|
|
6211
6181
|
async function loadConversationRuntime$1() {
|
|
6212
|
-
conversationRuntimePromise$1 ??= import("./agent-components.runtime-
|
|
6182
|
+
conversationRuntimePromise$1 ??= import("./agent-components.runtime-zT8qPsnM.js");
|
|
6213
6183
|
return await conversationRuntimePromise$1;
|
|
6214
6184
|
}
|
|
6215
|
-
async function loadReplyPipelineRuntime() {
|
|
6216
|
-
replyPipelineRuntimePromise ??= import("openclaw/plugin-sdk/channel-reply-pipeline");
|
|
6217
|
-
return await replyPipelineRuntimePromise;
|
|
6218
|
-
}
|
|
6219
6185
|
async function loadTypingRuntime() {
|
|
6220
|
-
typingRuntimePromise ??= import("./typing-
|
|
6186
|
+
typingRuntimePromise ??= import("./typing-BYeVSviE.js").then((n) => n.n);
|
|
6221
6187
|
return await typingRuntimePromise;
|
|
6222
6188
|
}
|
|
6223
6189
|
function buildDiscordComponentConversationLabel(params) {
|
|
@@ -6303,7 +6269,7 @@ async function dispatchDiscordComponentEvent(params) {
|
|
|
6303
6269
|
return typeof candidate === "string" && /^\d+$/.test(candidate) ? candidate : void 0;
|
|
6304
6270
|
}
|
|
6305
6271
|
}) : null;
|
|
6306
|
-
const commandAuthorized = resolveComponentCommandAuthorized({
|
|
6272
|
+
const commandAuthorized = await resolveComponentCommandAuthorized({
|
|
6307
6273
|
ctx,
|
|
6308
6274
|
interactionCtx,
|
|
6309
6275
|
channelConfig,
|
|
@@ -6363,13 +6329,6 @@ async function dispatchDiscordComponentEvent(params) {
|
|
|
6363
6329
|
});
|
|
6364
6330
|
const deliverTarget = `channel:${interactionCtx.channelId}`;
|
|
6365
6331
|
const typingChannelId = interactionCtx.channelId;
|
|
6366
|
-
const { createChannelReplyPipeline } = await loadReplyPipelineRuntime();
|
|
6367
|
-
const { onModelSelected, ...replyPipeline } = createChannelReplyPipeline({
|
|
6368
|
-
cfg: ctx.cfg,
|
|
6369
|
-
agentId,
|
|
6370
|
-
channel: "discord",
|
|
6371
|
-
accountId
|
|
6372
|
-
});
|
|
6373
6332
|
const tableMode = resolveMarkdownTableMode({
|
|
6374
6333
|
cfg: ctx.cfg,
|
|
6375
6334
|
channel: "discord",
|
|
@@ -6401,12 +6360,15 @@ async function dispatchDiscordComponentEvent(params) {
|
|
|
6401
6360
|
raw: interaction
|
|
6402
6361
|
}),
|
|
6403
6362
|
resolveTurn: () => ({
|
|
6363
|
+
cfg: ctx.cfg,
|
|
6404
6364
|
channel: "discord",
|
|
6405
6365
|
accountId,
|
|
6366
|
+
agentId,
|
|
6406
6367
|
routeSessionKey: sessionKey,
|
|
6407
6368
|
storePath,
|
|
6408
6369
|
ctxPayload,
|
|
6409
6370
|
recordInboundSession,
|
|
6371
|
+
dispatchReplyWithBufferedBlockDispatcher,
|
|
6410
6372
|
record: {
|
|
6411
6373
|
updateLastRoute: interactionCtx.isDirectMessage ? {
|
|
6412
6374
|
sessionKey: route.mainSessionKey,
|
|
@@ -6425,53 +6387,50 @@ async function dispatchDiscordComponentEvent(params) {
|
|
|
6425
6387
|
logVerbose(`discord: failed updating component session meta: ${String(err)}`);
|
|
6426
6388
|
}
|
|
6427
6389
|
},
|
|
6428
|
-
|
|
6429
|
-
|
|
6430
|
-
|
|
6431
|
-
|
|
6432
|
-
|
|
6433
|
-
|
|
6434
|
-
|
|
6435
|
-
|
|
6436
|
-
|
|
6437
|
-
|
|
6390
|
+
delivery: {
|
|
6391
|
+
deliver: async (payload) => {
|
|
6392
|
+
const replyToId = replyReference.use();
|
|
6393
|
+
await deliverDiscordReply({
|
|
6394
|
+
cfg: ctx.cfg,
|
|
6395
|
+
replies: [payload],
|
|
6396
|
+
target: deliverTarget,
|
|
6397
|
+
token,
|
|
6398
|
+
accountId,
|
|
6399
|
+
rest: interaction.client.rest,
|
|
6400
|
+
runtime,
|
|
6401
|
+
replyToId,
|
|
6402
|
+
replyToMode,
|
|
6403
|
+
textLimit,
|
|
6404
|
+
maxLinesPerMessage: resolveDiscordMaxLinesPerMessage({
|
|
6438
6405
|
cfg: ctx.cfg,
|
|
6439
|
-
|
|
6440
|
-
|
|
6441
|
-
|
|
6442
|
-
|
|
6443
|
-
|
|
6444
|
-
|
|
6445
|
-
|
|
6446
|
-
|
|
6447
|
-
|
|
6448
|
-
|
|
6449
|
-
|
|
6450
|
-
|
|
6451
|
-
|
|
6452
|
-
|
|
6453
|
-
|
|
6454
|
-
|
|
6455
|
-
|
|
6406
|
+
discordConfig: ctx.discordConfig,
|
|
6407
|
+
accountId
|
|
6408
|
+
}),
|
|
6409
|
+
tableMode,
|
|
6410
|
+
chunkMode: resolveChunkMode(ctx.cfg, "discord", accountId),
|
|
6411
|
+
mediaLocalRoots
|
|
6412
|
+
});
|
|
6413
|
+
replyReference.markSent();
|
|
6414
|
+
},
|
|
6415
|
+
onError: (err) => {
|
|
6416
|
+
logError(`discord component dispatch failed: ${String(err)}`);
|
|
6417
|
+
}
|
|
6418
|
+
},
|
|
6419
|
+
replyPipeline: {},
|
|
6420
|
+
dispatcherOptions: {
|
|
6421
|
+
humanDelay: resolveHumanDelayConfig(ctx.cfg, agentId),
|
|
6422
|
+
onReplyStart: async () => {
|
|
6423
|
+
try {
|
|
6424
|
+
const { sendTyping } = await loadTypingRuntime();
|
|
6425
|
+
await sendTyping({
|
|
6426
|
+
rest: feedbackRest,
|
|
6427
|
+
channelId: typingChannelId
|
|
6456
6428
|
});
|
|
6457
|
-
|
|
6458
|
-
|
|
6459
|
-
onReplyStart: async () => {
|
|
6460
|
-
try {
|
|
6461
|
-
const { sendTyping } = await loadTypingRuntime();
|
|
6462
|
-
await sendTyping({
|
|
6463
|
-
rest: feedbackRest,
|
|
6464
|
-
channelId: typingChannelId
|
|
6465
|
-
});
|
|
6466
|
-
} catch (err) {
|
|
6467
|
-
logVerbose(`discord: typing failed for component reply: ${String(err)}`);
|
|
6468
|
-
}
|
|
6469
|
-
},
|
|
6470
|
-
onError: (err) => {
|
|
6471
|
-
logError(`discord component dispatch failed: ${String(err)}`);
|
|
6429
|
+
} catch (err) {
|
|
6430
|
+
logVerbose(`discord: typing failed for component reply: ${String(err)}`);
|
|
6472
6431
|
}
|
|
6473
6432
|
}
|
|
6474
|
-
}
|
|
6433
|
+
}
|
|
6475
6434
|
})
|
|
6476
6435
|
}
|
|
6477
6436
|
});
|
|
@@ -6511,7 +6470,7 @@ async function dispatchDiscordPluginInteractiveHandler(params) {
|
|
|
6511
6470
|
//#region extensions/discord/src/monitor/agent-components.plugin-interactive.ts
|
|
6512
6471
|
let conversationRuntimePromise;
|
|
6513
6472
|
async function loadConversationRuntime() {
|
|
6514
|
-
conversationRuntimePromise ??= import("./agent-components.runtime-
|
|
6473
|
+
conversationRuntimePromise ??= import("./agent-components.runtime-zT8qPsnM.js");
|
|
6515
6474
|
return await conversationRuntimePromise;
|
|
6516
6475
|
}
|
|
6517
6476
|
async function dispatchPluginDiscordInteractiveEvent(params) {
|
|
@@ -6637,7 +6596,7 @@ async function dispatchPluginDiscordInteractiveEvent(params) {
|
|
|
6637
6596
|
//#region extensions/discord/src/monitor/agent-components.handlers.ts
|
|
6638
6597
|
let componentsRuntimePromise;
|
|
6639
6598
|
async function loadComponentsRuntime() {
|
|
6640
|
-
componentsRuntimePromise ??= import("./components-
|
|
6599
|
+
componentsRuntimePromise ??= import("./components-BJOShoIU.js").then((n) => n.t);
|
|
6641
6600
|
return await componentsRuntimePromise;
|
|
6642
6601
|
}
|
|
6643
6602
|
async function handleDiscordComponentEvent(params) {
|
|
@@ -8142,7 +8101,7 @@ function logDiscordStartupPhase(params) {
|
|
|
8142
8101
|
});
|
|
8143
8102
|
}
|
|
8144
8103
|
async function loadDiscordVoiceRuntime() {
|
|
8145
|
-
const promise = discordVoiceRuntimePromise ?? import("./manager.runtime-
|
|
8104
|
+
const promise = discordVoiceRuntimePromise ?? import("./manager.runtime-DGvCDWI5.js");
|
|
8146
8105
|
discordVoiceRuntimePromise = promise;
|
|
8147
8106
|
try {
|
|
8148
8107
|
return await promise;
|
|
@@ -8152,7 +8111,7 @@ async function loadDiscordVoiceRuntime() {
|
|
|
8152
8111
|
}
|
|
8153
8112
|
}
|
|
8154
8113
|
async function loadDiscordProviderSessionRuntime() {
|
|
8155
|
-
const promise = discordProviderSessionRuntimePromise ?? import("./provider-session.runtime-
|
|
8114
|
+
const promise = discordProviderSessionRuntimePromise ?? import("./provider-session.runtime-DepAOR1U.js");
|
|
8156
8115
|
discordProviderSessionRuntimePromise = promise;
|
|
8157
8116
|
try {
|
|
8158
8117
|
return await promise;
|
|
@@ -8247,6 +8206,7 @@ async function monitorDiscordProvider(opts = {}) {
|
|
|
8247
8206
|
token,
|
|
8248
8207
|
guildEntries,
|
|
8249
8208
|
allowFrom,
|
|
8209
|
+
discordConfig: discordCfg,
|
|
8250
8210
|
fetcher: discordRestFetch,
|
|
8251
8211
|
runtime
|
|
8252
8212
|
});
|