@openclaw/discord 2026.9.6 → 2026.9.8
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/assets/icon.png +0 -0
- package/dist/.setup/{account-inspect-BwQj24ht.mjs → account-inspect-De8hOUxG.mjs} +1 -1
- package/dist/.setup/{accounts-CwJQoLjM.mjs → accounts-ChaMcixG.mjs} +1 -4
- package/dist/.setup/{activities-api-COU4-0nR.mjs → activities-api-tvbsU2e3.mjs} +38 -66
- package/dist/.setup/{api-CBK9zcq5.mjs → api-DVbJwZVt.mjs} +10 -2
- package/dist/.setup/{approval-handler.runtime-CbBktBb4.mjs → approval-handler.runtime-DxCK2Rux.mjs} +49 -125
- package/dist/.setup/{approval-message-updates-jf9zMaIC.mjs → approval-message-updates-BKFqavHZ.mjs} +2 -2
- package/dist/.setup/{audit-vKbh-LFR.mjs → audit-CLg9I71N.mjs} +5 -5
- package/dist/.setup/{channel-Dv4e3Jpc.mjs → channel-DxlUVU9t.mjs} +121 -227
- package/dist/.setup/{channel-type-DKnjV1XW.mjs → channel-type-DRCrEMss.mjs} +22 -22
- package/dist/.setup/{channel.setup-0NX6FFwi.mjs → channel.setup-CRo1GjV7.mjs} +6 -9
- package/dist/.setup/{components-yBEb75bB.mjs → components-Cq1PvIpN.mjs} +41 -69
- package/dist/.setup/{config-schema-CiZz-mtA.mjs → config-schema-oxELUSDx.mjs} +19 -44
- package/dist/.setup/{conversation-binding-route-B7qImK_b.mjs → conversation-binding-route-Caz_XuFH.mjs} +10 -5
- package/dist/.setup/{directory-config-BytTftz-.mjs → directory-config-esqNn0Eo.mjs} +6 -9
- package/dist/.setup/{directory-live--EGTH0DC.mjs → directory-live-DtKRHuGV.mjs} +6 -12
- package/dist/.setup/{discord-BXpHW-cu.mjs → discord-0xJYfdDD.mjs} +82 -386
- package/dist/.setup/{doctor-D1R-uFIu.mjs → doctor-BCl1H5tl.mjs} +21 -36
- package/dist/.setup/{doctor-contract-Co5vRCZ6.mjs → doctor-contract-CvvgwrrG.mjs} +41 -50
- package/dist/.setup/{channel-actions.runtime-leZuw01r.mjs → handle-action-CUvQWnE7.mjs} +67 -104
- package/dist/.setup/{handle-action.guild-admin-DcFa8NwA.mjs → handle-action.guild-admin-Df-8gVle.mjs} +62 -120
- package/dist/.setup/{live-policy-config-eKQ-PLdy.mjs → live-policy-config-8Pv20CHc.mjs} +2 -3
- package/dist/.setup/{message-handler-X6ejmbtY.mjs → message-handler-B-Jk4oDk.mjs} +18 -94
- package/dist/.setup/{message-handler.preflight-pluralkit-8Xji34AF.mjs → message-handler.preflight-pluralkit-CWLUBVcx.mjs} +8 -10
- package/dist/.setup/{message-handler.preflight-DE_POxFc.mjs → message-handler.preflight-v-__NSDq.mjs} +69 -180
- package/dist/.setup/{message-handler.process-CCmIVnxy.mjs → message-handler.process-BNFFuChn.mjs} +65 -86
- package/dist/.setup/{outbound-adapter-ClIgmu4F.mjs → outbound-adapter-BobT-kse.mjs} +105 -19
- package/dist/.setup/{outbound-session-route-VulUE0yV.mjs → outbound-session-route-zVGxxceg.mjs} +140 -108
- package/dist/.setup/{pluralkit-CdAt1G0P.mjs → pluralkit-a6_NLfH9.mjs} +1 -1
- package/dist/.setup/{presence-cache-dYSHPWMx.mjs → presence-cache-Di3H3DIU.mjs} +0 -4
- package/dist/.setup/{probe-CupW4we4.mjs → probe-LYrIHlBF.mjs} +13 -4
- package/dist/.setup/{provider-iOf73HW-.mjs → provider-B_G5hASF.mjs} +721 -1416
- package/dist/.setup/provider-session.runtime-BYlTBFD2.mjs +6 -0
- package/dist/.setup/provider.runtime-CUE3UxER.mjs +2 -0
- package/dist/.setup/{realtime-session.runtime-Dz8uVutq.mjs → realtime-session.runtime-oUd9DOcz.mjs} +41 -55
- package/dist/.setup/{receive-recovery-DHst8WRx.mjs → receive-recovery-CHPOsnLc.mjs} +1 -4
- package/dist/.setup/{resolve-allowlist-common-CwMBzbx9.mjs → resolve-allowlist-common-DPdRggu5.mjs} +4 -7
- package/dist/.setup/{resolve-channels-BbvsLQOZ.mjs → resolve-channels-BFPNRmVv.mjs} +21 -40
- package/dist/.setup/{resolve-users-ByFlR7LQ.mjs → resolve-users-0-aBuCy3.mjs} +4 -4
- package/dist/.setup/{retry-BEYkDy0P.mjs → retry-pz_cSha2.mjs} +3 -3
- package/dist/.setup/rolldown-runtime-B4FMCO8f.mjs +28 -0
- package/dist/.setup/{runtime-B8lJfyrA.mjs → runtime-FN000lxA.mjs} +60 -162
- package/dist/.setup/runtime-doctor-migrations-CshUGl36.mjs +159 -0
- package/dist/.setup/{runtime-DisDbixd.mjs → runtime-sUksZ--Q.mjs} +2 -5
- package/dist/.setup/{secret-config-contract-DFu9hfU8.mjs → secret-config-contract-uOE2J7yM.mjs} +15 -85
- package/dist/.setup/{security-audit-s5w50-Ly.mjs → security-audit-Cdaegq7C.mjs} +3 -1
- package/dist/.setup/{send-CIBzvXjS.mjs → send-CrfEI6Bs.mjs} +53 -108
- package/dist/.setup/{send.components-ChY21qr-.mjs → send.components-DxQAMfES.mjs} +62 -107
- package/dist/.setup/{send.outbound-QTyuFupn.mjs → send.outbound-BISKnb-a.mjs} +66 -140
- package/dist/.setup/{send.shared-VNvWfX2T.mjs → send.shared-DGFkbkQR.mjs} +10 -25
- package/dist/.setup/{sender-identity-0Ymgvmaj.mjs → sender-identity-B9X5Vb9R.mjs} +2 -3
- package/dist/.setup/setup-plugin-api-BQUBxbhe.mjs +3 -0
- package/dist/.setup/{shared-DHPDaMSx.mjs → shared-B3wZ4hN-.mjs} +25 -32
- package/dist/.setup/{subagent-hooks-CjW7r8Pe.mjs → subagent-hooks-nlUE9ow7.mjs} +5 -6
- package/dist/.setup/system-events-CdeZnvPV.mjs +33 -0
- package/dist/.setup/{target-resolver-BXpy6VT8.mjs → target-resolver-BuLapkhy.mjs} +9 -12
- package/dist/.setup/targets-0KUcEIYx.mjs +3 -0
- package/dist/.setup/{thread-bindings-CEh2dhqP.mjs → thread-bindings-D7TfgjR_.mjs} +33 -35
- package/dist/.setup/{thread-bindings.manager-ve-i6oqt.mjs → thread-bindings.manager-DN-NissX.mjs} +325 -233
- package/dist/.setup/thread-bindings.session-updates-CshfKghV.mjs +359 -0
- package/dist/.setup/{thread-bindings.state-BThFQEga.mjs → thread-bindings.state-g6v9zAym.mjs} +21 -62
- package/dist/.setup/{transcripts-source-DVegW0WI.mjs → transcripts-source-p8EV179h.mjs} +76 -235
- package/dist/.setup/{typing-BKZL5fGj.mjs → typing-BiHCzBRu.mjs} +2 -1
- package/dist/.setup/{voice-runtime-elTtjEIG.mjs → voice-runtime-B46rcwrG.mjs} +140 -244
- package/dist/account-inspect-api.js +1 -1
- package/dist/action-runtime-api.js +1 -1
- package/dist/activities-api.js +1 -1
- package/dist/api.js +18 -18
- package/dist/channel-config-api.js +1 -1
- package/dist/channel-plugin-api.js +1 -1
- package/dist/directory-contract-api.js +1 -1
- package/dist/doctor-contract-api.js +4 -4
- package/dist/index.js +1 -1
- package/dist/runtime-api.js +20 -20
- package/dist/secret-contract-api.js +1 -1
- package/dist/security-audit-contract-api.js +1 -1
- package/dist/setup-entry.js +1 -1
- package/dist/setup-plugin-api.js +1 -1
- package/dist/src/voice/audio-worker.runtime.js +15 -24
- package/dist/subagent-hooks-api.js +3 -4
- package/dist/transcripts-source-api.js +1 -1
- package/node_modules/@types/node/README.md +2 -2
- package/node_modules/@types/node/child_process.d.ts +1 -1
- package/node_modules/@types/node/crypto.d.ts +20 -8
- package/node_modules/@types/node/ffi.d.ts +14 -0
- package/node_modules/@types/node/http2.d.ts +3 -2
- package/node_modules/@types/node/net.d.ts +16 -4
- package/node_modules/@types/node/package.json +2 -17
- package/node_modules/@types/node/process.d.ts +1 -0
- package/node_modules/@types/node/quic.d.ts +39 -1
- package/node_modules/@types/node/stream/iter.d.ts +9 -12
- package/node_modules/@types/node/test/reporters.d.ts +1 -0
- package/node_modules/@types/node/test.d.ts +72 -0
- package/node_modules/@types/node/tls.d.ts +14 -10
- package/node_modules/@types/node/vm.d.ts +2 -1
- package/node_modules/@types/node/worker_threads.d.ts +4 -1
- package/node_modules/typebox/build/compile/code.mjs +1 -2
- package/node_modules/typebox/build/compile/validator.mjs +5 -1
- package/node_modules/typebox/build/format/iri.mjs +16 -9
- package/node_modules/typebox/build/guard/emit.mjs +2 -2
- package/node_modules/typebox/build/guard/guard.d.mts +7 -5
- package/node_modules/typebox/build/guard/guard.mjs +14 -9
- package/node_modules/typebox/build/guard/index.mjs +6 -0
- package/node_modules/typebox/build/guard/unicode/unicode.d.mts +6 -0
- package/node_modules/typebox/build/guard/unicode/unicode.mjs +35 -0
- package/node_modules/typebox/build/guard/{string.mjs → unicode/unicode_segment.mjs} +16 -19
- package/node_modules/typebox/build/schema/build.mjs +2 -3
- package/node_modules/typebox/build/schema/engine/_pathing.d.mts +1 -0
- package/node_modules/typebox/build/schema/engine/_pathing.mjs +11 -0
- package/node_modules/typebox/build/schema/engine/_refine.mjs +13 -5
- package/node_modules/typebox/build/schema/engine/additionalProperties.mjs +2 -1
- package/node_modules/typebox/build/schema/engine/dependencies.mjs +2 -1
- package/node_modules/typebox/build/schema/engine/dependentSchemas.mjs +2 -1
- package/node_modules/typebox/build/schema/engine/dynamicRef.d.mts +1 -1
- package/node_modules/typebox/build/schema/engine/dynamicRef.mjs +2 -2
- package/node_modules/typebox/build/schema/engine/format.mjs +9 -2
- package/node_modules/typebox/build/schema/engine/patternProperties.mjs +3 -2
- package/node_modules/typebox/build/schema/engine/properties.mjs +3 -2
- package/node_modules/typebox/build/schema/engine/propertyNames.mjs +2 -1
- package/node_modules/typebox/build/schema/engine/recursiveRef.d.mts +1 -1
- package/node_modules/typebox/build/schema/engine/recursiveRef.mjs +2 -2
- package/node_modules/typebox/build/schema/engine/ref.d.mts +1 -1
- package/node_modules/typebox/build/schema/engine/ref.mjs +2 -2
- package/node_modules/typebox/build/schema/engine/schema.mjs +24 -24
- package/node_modules/typebox/build/schema/parse.mjs +3 -0
- package/node_modules/typebox/build/schema/pointer/pointer.d.mts +1 -6
- package/node_modules/typebox/build/schema/pointer/pointer.mjs +47 -64
- package/node_modules/typebox/build/system/settings/internal.d.mts +2 -0
- package/node_modules/typebox/build/system/settings/internal.mjs +20 -0
- package/node_modules/typebox/build/system/settings/settings.d.mts +11 -0
- package/node_modules/typebox/build/system/settings/settings.mjs +14 -0
- package/node_modules/typebox/build/type/extends/inference.d.mts +1 -1
- package/node_modules/typebox/build/type/extends/inference.mjs +15 -2
- package/node_modules/typebox/build/type/extends/tuple.d.mts +2 -1
- package/node_modules/typebox/build/type/extends/tuple.mjs +21 -1
- package/node_modules/typebox/build/value/parse/parse.mjs +10 -4
- package/node_modules/typebox/package.json +1 -1
- package/node_modules/typebox/readme.md +3 -1
- package/openclaw.plugin.json +21 -1
- package/package.json +5 -5
- package/dist/.setup/agent-components.runtime-CEPrf2SY.mjs +0 -4
- package/dist/.setup/probe.runtime-DBQ_AGPe.mjs +0 -2
- package/dist/.setup/provider-session.runtime-DrGAYnZv.mjs +0 -6
- package/dist/.setup/provider.runtime-BmjW_pIw.mjs +0 -2
- package/dist/.setup/security-audit.runtime-DHtYenx9.mjs +0 -2
- package/dist/.setup/setup-plugin-api-Dvr41dyx.mjs +0 -3
- package/dist/.setup/system-events-B2YEEMbS.mjs +0 -34
- package/dist/.setup/targets-CvemhN3i.mjs +0 -3
- package/dist/.setup/thread-bindings.session-updates-DCQq1WZ5.mjs +0 -55
- /package/node_modules/typebox/build/guard/{string.d.mts → unicode/unicode_segment.d.mts} +0 -0
package/dist/.setup/{message-handler.process-CCmIVnxy.mjs → message-handler.process-BNFFuChn.mjs}
RENAMED
|
@@ -1,33 +1,35 @@
|
|
|
1
|
-
import { C as withDiscordRequestAuthority, D as Message,
|
|
2
|
-
import {
|
|
3
|
-
import { p as resolveDiscordMaxLinesPerMessage } from "./accounts-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { a as discordTextHasBroadcastMention } from "./send.outbound-
|
|
7
|
-
import {
|
|
8
|
-
import { a as removeReactionDiscord, r as reactMessageDiscord } from "./send-
|
|
1
|
+
import { C as withDiscordRequestAuthority, D as Message, Mt as getGuildMember, ct as createChannelMessage, dt as deleteChannelMessage, pt as editChannelMessage, t as discord_exports, vt as listChannelMessages } from "./discord-0xJYfdDD.mjs";
|
|
2
|
+
import { i as normalizeDiscordAllowList, o as normalizeDiscordSlug, w as resolveTimestampMs } from "./channel-type-DRCrEMss.mjs";
|
|
3
|
+
import { p as resolveDiscordMaxLinesPerMessage } from "./accounts-ChaMcixG.mjs";
|
|
4
|
+
import { o as chunkDiscordTextWithMode, x as resolveDiscordChannelId } from "./retry-pz_cSha2.mjs";
|
|
5
|
+
import { N as createDiscordRestClient, O as resolveDiscordMessageFlags, P as createDiscordRuntimeAccountContext, u as resolveDiscordTargetChannelId } from "./send.shared-DGFkbkQR.mjs";
|
|
6
|
+
import { a as discordTextHasBroadcastMention } from "./send.outbound-BISKnb-a.mjs";
|
|
7
|
+
import { C as resolveReferencedReplyMediaList, E as resolveDiscordMessageStickers, O as resolveDiscordReferencedReplyMessageId, _ as resolveDiscordMessageHistoryText, b as formatDiscordMediaText, f as resolveDiscordAutoThreadReplyPlan, m as resolveDiscordThreadStarter, y as resolveDiscordMessageText } from "./transcripts-source-p8EV179h.mjs";
|
|
8
|
+
import { a as removeReactionDiscord, r as reactMessageDiscord } from "./send-CrfEI6Bs.mjs";
|
|
9
9
|
import { n as DISCORD_ATTACHMENT_TOTAL_TIMEOUT_MS, t as DISCORD_ATTACHMENT_IDLE_TIMEOUT_MS } from "./timeouts-D86uWLt_.mjs";
|
|
10
|
-
import "./targets-
|
|
11
|
-
import { b as discordInboundEventDelivery, h as resolveDiscordConversationIdentity, u as buildDiscordRoutePeer } from "./outbound-session-route-
|
|
12
|
-
import { t as DISCORD_TEXT_CHUNK_LIMIT } from "./outbound-adapter-
|
|
13
|
-
import {
|
|
14
|
-
import { n as resolveDiscordWebhookId, t as resolveDiscordSenderIdentity } from "./sender-identity-
|
|
10
|
+
import "./targets-0KUcEIYx.mjs";
|
|
11
|
+
import { b as discordInboundEventDelivery, h as resolveDiscordConversationIdentity, u as buildDiscordRoutePeer } from "./outbound-session-route-zVGxxceg.mjs";
|
|
12
|
+
import { t as DISCORD_TEXT_CHUNK_LIMIT } from "./outbound-adapter-BobT-kse.mjs";
|
|
13
|
+
import { T as createDiscordSupplementalContextAccessChecker, a as formatDiscordReplySkip, c as buildGuildLabel, i as formatDiscordReplyDeliveryFailure, l as resolveReplyContext, o as sanitizeDiscordFrontChannelReplyPayloads, r as deliverDiscordReply, s as buildDirectLabel, w as buildDiscordInboundAccessContext } from "./provider-B_G5hASF.mjs";
|
|
14
|
+
import { n as resolveDiscordWebhookId, t as resolveDiscordSenderIdentity } from "./sender-identity-B9X5Vb9R.mjs";
|
|
15
15
|
import { t as beginDiscordActiveTurnThreadRoute } from "./active-turn-thread-route-fmHl1HNd.mjs";
|
|
16
|
-
import { a as createDiscordHistorySenderProvenance,
|
|
17
|
-
import { t as sendTyping } from "./typing-
|
|
16
|
+
import { a as createDiscordHistorySenderProvenance, h as shouldIgnoreBoundThreadWebhookMessage, l as isBoundThreadBotSystemMessage, o as filterDiscordHistoryEntriesForContext, s as resolveDiscordHistoryMediaIds, t as resolveDiscordPreflightPluralKitInfo } from "./message-handler.preflight-pluralkit-CWLUBVcx.mjs";
|
|
17
|
+
import { t as sendTyping } from "./typing-BiHCzBRu.mjs";
|
|
18
18
|
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
19
19
|
import { buildAgentSessionKey, resolveThreadSessionKeys } from "openclaw/plugin-sdk/routing";
|
|
20
|
+
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
20
21
|
import { getReplyPayloadTtsSupplement, isReplyPayloadNonTerminalToolErrorWarning, resolveSendableOutboundReplyParts } from "openclaw/plugin-sdk/reply-payload";
|
|
21
22
|
import { danger, logVerbose, shouldLogVerbose, sleepWithAbort } from "openclaw/plugin-sdk/runtime-env";
|
|
22
23
|
import { truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
23
24
|
import { resolveChunkMode } from "openclaw/plugin-sdk/reply-chunking";
|
|
24
25
|
import { resolveMarkdownTableMode } from "openclaw/plugin-sdk/markdown-table-runtime";
|
|
25
26
|
import { stripInlineDirectiveTagsForDelivery, stripReasoningTagsFromText } from "openclaw/plugin-sdk/text-chunking";
|
|
27
|
+
import { resolveBatchedReplyThreadingPolicy } from "openclaw/plugin-sdk/reply-reference";
|
|
26
28
|
import { bindIngressLifecycleToReplyOptions, createChannelMessageReplyPipeline, createChannelProgressDraftCompositor, createFinalizableDraftLifecycle, createLivePreviewLifecycle, createTypingCallbacks, isRecentOutboundMessageIdentity, resolveChannelDraftStreamingChunking, resolveChannelMessageSourceReplyDeliveryMode, resolveChannelPreviewStreamMode, resolveChannelStreamingBlockEnabled, resolveChannelStreamingPreviewCommandText, resolveChannelStreamingProgressNarration, resolveTranscriptBackedChannelFinalText } from "openclaw/plugin-sdk/channel-outbound";
|
|
27
29
|
import { getAgentScopedMediaLocalRoots } from "openclaw/plugin-sdk/media-runtime";
|
|
28
|
-
import { buildChannelInboundEventContext,
|
|
30
|
+
import { buildChannelInboundEventContext, createCommandTurnContext, dispatchChannelInboundTurn, formatInboundEnvelope, formatInboundMediaUnavailableText, getGroupThreadDeliverySession, hasFinalInboundReplyDispatch, readAgentRunTerminalOutcome, resolveEnvelopeFormatOptions, toHistoryMediaEntries, toInboundMediaFactsWithMetadata } from "openclaw/plugin-sdk/channel-inbound";
|
|
29
31
|
import { evaluateSupplementalContextVisibility } from "openclaw/plugin-sdk/security-runtime";
|
|
30
|
-
import { resolvePinnedMainDmOwnerFromAllowlist } from "openclaw/plugin-sdk/conversation-runtime";
|
|
32
|
+
import { resolvePinnedMainDmOwnerFromAllowlist as resolvePinnedMainDmOwnerFromAllowlist$1 } from "openclaw/plugin-sdk/conversation-runtime";
|
|
31
33
|
import { resolveAgentConfig } from "openclaw/plugin-sdk/agent-scope-runtime";
|
|
32
34
|
import { isDangerousNameMatchingEnabled } from "openclaw/plugin-sdk/dangerous-name-runtime";
|
|
33
35
|
import { EmbeddedBlockChunker, resolveAckReaction, resolveAgentConfig as resolveAgentConfig$1, resolveHumanDelayConfig } from "openclaw/plugin-sdk/agent-runtime";
|
|
@@ -52,11 +54,6 @@ async function recoverDiscordChannelHistory(params) {
|
|
|
52
54
|
const cachedMedia = new Map((ctx.guildHistories.get(ctx.messageChannelId) ?? []).map((entry) => [entry.messageId, entry]));
|
|
53
55
|
const members = /* @__PURE__ */ new Map();
|
|
54
56
|
const roleAllowList = ctx.channelConfig?.roles ?? ctx.guildInfo?.roles ?? [];
|
|
55
|
-
const mentionRegexes = ctx.discordConfig?.allowBots === "mentions" ? buildMentionRegexes(ctx.cfg, ctx.route.agentId, {
|
|
56
|
-
provider: "discord",
|
|
57
|
-
conversationId: ctx.messageChannelId,
|
|
58
|
-
providerPolicy: ctx.discordConfig.mentionPatterns
|
|
59
|
-
}) : [];
|
|
60
57
|
const entries = [];
|
|
61
58
|
try {
|
|
62
59
|
while (remaining > 0 && isCurrent()) {
|
|
@@ -103,14 +100,6 @@ async function recoverDiscordChannelHistory(params) {
|
|
|
103
100
|
member: row.member,
|
|
104
101
|
pluralkitInfo
|
|
105
102
|
});
|
|
106
|
-
if (row.author.bot && !sender.isPluralKit) {
|
|
107
|
-
const allowBots = ctx.discordConfig?.allowBots;
|
|
108
|
-
if (!allowBots) continue;
|
|
109
|
-
if (allowBots === "mentions") {
|
|
110
|
-
const documents = resolveDiscordMessageMentionDocuments(message);
|
|
111
|
-
if (!(row.mentions.some((user) => user.id === ctx.botUserId) && (row.type !== discord_exports.MessageType.Reply || documents.some((text) => hasRawDiscordUserMention(text, ctx.botUserId)))) && !documents.some((text) => matchesActiveDiscordMentionPatterns(text, mentionRegexes))) continue;
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
103
|
let member = row.member;
|
|
115
104
|
if (params.mode !== "all" && roleAllowList.length > 0 && !member && guildId && !params.isSenderAllowed({
|
|
116
105
|
...sender,
|
|
@@ -221,7 +210,7 @@ async function buildDiscordMessageProcessContext(params) {
|
|
|
221
210
|
isGuild: isGuildMessage,
|
|
222
211
|
channelTopic: channelInfo?.topic
|
|
223
212
|
});
|
|
224
|
-
const pinnedMainDmOwner = isDirectMessage ? resolvePinnedMainDmOwnerFromAllowlist({
|
|
213
|
+
const pinnedMainDmOwner = isDirectMessage ? resolvePinnedMainDmOwnerFromAllowlist$1({
|
|
225
214
|
dmScope: cfg.session?.dmScope,
|
|
226
215
|
allowFrom: channelConfig?.users ?? guildInfo?.users,
|
|
227
216
|
normalizeEntry: normalizeDiscordDmOwnerEntry
|
|
@@ -434,11 +423,11 @@ async function buildDiscordMessageProcessContext(params) {
|
|
|
434
423
|
threadId: threadChannel?.id ?? autoThreadContext?.createdThreadId ?? void 0
|
|
435
424
|
});
|
|
436
425
|
if (!isHistoryCurrent()) return null;
|
|
426
|
+
const batchMessageIds = ctx.sourceMessageIds && ctx.sourceMessageIds.length > 1 ? [...ctx.sourceMessageIds] : void 0;
|
|
437
427
|
const ctxPayload = await (ctx.buildContext ?? buildChannelInboundEventContext)({
|
|
438
428
|
channelIngress,
|
|
439
429
|
channel: "discord",
|
|
440
430
|
resolveSupplementalMedia: true,
|
|
441
|
-
suppressSelfQuoteBody: false,
|
|
442
431
|
contextVisibility: contextVisibilityMode,
|
|
443
432
|
accountId: route.accountId,
|
|
444
433
|
messageId: canonicalMessageId ?? message.id,
|
|
@@ -479,6 +468,7 @@ async function buildDiscordMessageProcessContext(params) {
|
|
|
479
468
|
},
|
|
480
469
|
reply: {
|
|
481
470
|
to: effectiveTo,
|
|
471
|
+
replyToId: resolveDiscordReferencedReplyMessageId(message) ?? void 0,
|
|
482
472
|
...originatingTo !== effectiveTo ? { originatingTo } : {}
|
|
483
473
|
},
|
|
484
474
|
message: {
|
|
@@ -534,6 +524,10 @@ async function buildDiscordMessageProcessContext(params) {
|
|
|
534
524
|
groupSystemPrompt: isGuildMessage ? groupSystemPrompt : void 0
|
|
535
525
|
},
|
|
536
526
|
extra: {
|
|
527
|
+
MessageSids: batchMessageIds,
|
|
528
|
+
MessageSidFirst: batchMessageIds?.[0],
|
|
529
|
+
MessageSidLast: batchMessageIds?.at(-1),
|
|
530
|
+
ReplyThreading: resolveBatchedReplyThreadingPolicy(replyToMode, batchMessageIds !== void 0),
|
|
537
531
|
GroupThread: ctx.groupThread,
|
|
538
532
|
...preflightAudioTranscript !== void 0 ? { Transcript: preflightAudioTranscript } : {},
|
|
539
533
|
GroupSubject: isDirectMessage ? void 0 : groupChannel,
|
|
@@ -642,6 +636,7 @@ function createDiscordMessageProgressRuntime(params) {
|
|
|
642
636
|
onQueuedFollowupAdmitted: draftPreview.draftStream ? () => {
|
|
643
637
|
if (draftPreview.handleQueuedFollowupAdmitted()) params.onTurnReset();
|
|
644
638
|
} : void 0,
|
|
639
|
+
onQueuedFollowupSettled: draftPreview.draftStream ? () => draftPreview.cleanup() : void 0,
|
|
645
640
|
suppressDefaultToolProgressMessages: params.sourceRepliesAreToolOnly && params.reactions.statusReactionsExplicitlyEnabled || draftPreview.suppressDefaultToolProgressMessages ? true : void 0,
|
|
646
641
|
allowToolLifecycleWhenProgressHidden: params.reactions.statusReactionsEnabled ? true : void 0,
|
|
647
642
|
commentaryProgressEnabled: draftPreview.isProgressMode ? draftPreview.commentaryProgressEnabled : void 0,
|
|
@@ -736,13 +731,6 @@ function queueInitialDiscordAckReaction(params) {
|
|
|
736
731
|
}
|
|
737
732
|
//#endregion
|
|
738
733
|
//#region extensions/discord/src/monitor/message-handler.process-reactions.ts
|
|
739
|
-
function readToolStringArg(args, key) {
|
|
740
|
-
const value = args[key];
|
|
741
|
-
return typeof value === "string" && value.trim() ? value.trim() : void 0;
|
|
742
|
-
}
|
|
743
|
-
function readToolBooleanArg(args, key) {
|
|
744
|
-
return args[key] === true;
|
|
745
|
-
}
|
|
746
734
|
function createDiscordMessageReactionRuntime(params) {
|
|
747
735
|
const { ctx } = params;
|
|
748
736
|
const { cfg, accountId, token, ackReactionScope, message, messageChannelId, isGuildMessage, isDirectMessage, isGroupDm, canDetectMention, effectiveWasMentioned, shouldBypassMention, route } = ctx;
|
|
@@ -784,10 +772,10 @@ function createDiscordMessageReactionRuntime(params) {
|
|
|
784
772
|
});
|
|
785
773
|
let statusReactionTarget = `${messageChannelId}/${message.id}`;
|
|
786
774
|
let statusReactionsActive = statusReactionsEnabled;
|
|
787
|
-
|
|
788
|
-
enabled
|
|
789
|
-
adapter
|
|
790
|
-
initialEmoji
|
|
775
|
+
const createController = (enabled, adapter, initialEmoji) => createStatusReactionController({
|
|
776
|
+
enabled,
|
|
777
|
+
adapter,
|
|
778
|
+
initialEmoji,
|
|
791
779
|
presentation: "acknowledgement",
|
|
792
780
|
onError: (err) => {
|
|
793
781
|
logAckFailure({
|
|
@@ -798,8 +786,9 @@ function createDiscordMessageReactionRuntime(params) {
|
|
|
798
786
|
});
|
|
799
787
|
}
|
|
800
788
|
});
|
|
789
|
+
let statusReactions = createController(statusReactionsEnabled, discordAdapter, ackReaction);
|
|
801
790
|
const resolveTrackedReactionChannelId = async (args) => {
|
|
802
|
-
const target =
|
|
791
|
+
const target = normalizeOptionalString(args.channelId) ?? normalizeOptionalString(args.channel_id) ?? normalizeOptionalString(args.to);
|
|
803
792
|
if (!target) return messageChannelId;
|
|
804
793
|
try {
|
|
805
794
|
return resolveDiscordChannelId(target);
|
|
@@ -814,11 +803,11 @@ function createDiscordMessageReactionRuntime(params) {
|
|
|
814
803
|
const maybeBindToToolReaction = async (payload) => {
|
|
815
804
|
if (params.sourceRepliesAreToolOnly || cfg.messages?.statusReactions?.enabled === false || payload.phase !== "start" || payload.name !== "message" || !payload.args) return;
|
|
816
805
|
const args = payload.args;
|
|
817
|
-
if (
|
|
818
|
-
if (!(
|
|
819
|
-
const emoji =
|
|
820
|
-
if (!emoji ||
|
|
821
|
-
const trackedMessageId =
|
|
806
|
+
if (normalizeOptionalString(args.action)?.toLowerCase() !== "react") return;
|
|
807
|
+
if (!(args.trackToolCalls === true || args.track_tool_calls === true)) return;
|
|
808
|
+
const emoji = normalizeOptionalString(args.emoji);
|
|
809
|
+
if (!emoji || args.remove === true) return;
|
|
810
|
+
const trackedMessageId = normalizeOptionalString(args.messageId) ?? normalizeOptionalString(args.message_id) ?? message.id;
|
|
822
811
|
let trackedChannelId;
|
|
823
812
|
try {
|
|
824
813
|
trackedChannelId = await resolveTrackedReactionChannelId(args);
|
|
@@ -826,31 +815,18 @@ function createDiscordMessageReactionRuntime(params) {
|
|
|
826
815
|
logAckFailure({
|
|
827
816
|
log: logVerbose,
|
|
828
817
|
channel: "discord",
|
|
829
|
-
target: `${
|
|
818
|
+
target: `${normalizeOptionalString(args.to) ?? normalizeOptionalString(args.channelId) ?? messageChannelId}/${trackedMessageId}`,
|
|
830
819
|
error: err
|
|
831
820
|
});
|
|
832
821
|
return;
|
|
833
822
|
}
|
|
834
823
|
statusReactionTarget = `${trackedChannelId}/${trackedMessageId}`;
|
|
835
824
|
if (statusReactionsActive) statusReactions.clear();
|
|
836
|
-
statusReactions =
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
reactionContext: ackReactionContext
|
|
842
|
-
}),
|
|
843
|
-
initialEmoji: emoji,
|
|
844
|
-
presentation: "acknowledgement",
|
|
845
|
-
onError: (err) => {
|
|
846
|
-
logAckFailure({
|
|
847
|
-
log: logVerbose,
|
|
848
|
-
channel: "discord",
|
|
849
|
-
target: statusReactionTarget,
|
|
850
|
-
error: err
|
|
851
|
-
});
|
|
852
|
-
}
|
|
853
|
-
});
|
|
825
|
+
statusReactions = createController(true, createDiscordAckReactionAdapter({
|
|
826
|
+
channelId: trackedChannelId,
|
|
827
|
+
messageId: trackedMessageId,
|
|
828
|
+
reactionContext: ackReactionContext
|
|
829
|
+
}), emoji);
|
|
854
830
|
statusReactionsActive = true;
|
|
855
831
|
statusReactions.setQueued();
|
|
856
832
|
};
|
|
@@ -858,7 +834,6 @@ function createDiscordMessageReactionRuntime(params) {
|
|
|
858
834
|
const queueInitialAckReactionAfterRecord = () => {
|
|
859
835
|
if (initialAckReactionQueued) return;
|
|
860
836
|
initialAckReactionQueued = true;
|
|
861
|
-
if (statusReactionsEnabled) statusReactionsActive = true;
|
|
862
837
|
queueInitialDiscordAckReaction({
|
|
863
838
|
enabled: statusReactionsEnabled,
|
|
864
839
|
shouldSendAckReaction,
|
|
@@ -936,12 +911,13 @@ function createDiscordDraftStream(params) {
|
|
|
936
911
|
if (trimmed.length < minInitialChars) return false;
|
|
937
912
|
}
|
|
938
913
|
try {
|
|
914
|
+
const body = {
|
|
915
|
+
content: trimmed,
|
|
916
|
+
allowed_mentions: DISCORD_PREVIEW_ALLOWED_MENTIONS,
|
|
917
|
+
...flags ? { flags } : {}
|
|
918
|
+
};
|
|
939
919
|
if (streamMessage !== void 0) {
|
|
940
|
-
await editChannelMessage(rest, streamMessage.channelId, streamMessage.messageId, { body
|
|
941
|
-
content: trimmed,
|
|
942
|
-
allowed_mentions: DISCORD_PREVIEW_ALLOWED_MENTIONS,
|
|
943
|
-
...flags ? { flags } : {}
|
|
944
|
-
} });
|
|
920
|
+
await editChannelMessage(rest, streamMessage.channelId, streamMessage.messageId, { body });
|
|
945
921
|
if (generation === streamGeneration) lastSentText = trimmed;
|
|
946
922
|
return true;
|
|
947
923
|
}
|
|
@@ -952,9 +928,7 @@ function createDiscordDraftStream(params) {
|
|
|
952
928
|
} : void 0;
|
|
953
929
|
activeCreateGeneration = generation;
|
|
954
930
|
const sentMessageId = (await createChannelMessage(rest, targetChannelId, { body: {
|
|
955
|
-
|
|
956
|
-
allowed_mentions: DISCORD_PREVIEW_ALLOWED_MENTIONS,
|
|
957
|
-
...flags ? { flags } : {},
|
|
931
|
+
...body,
|
|
958
932
|
...messageReference ? { message_reference: messageReference } : {}
|
|
959
933
|
} }))?.id;
|
|
960
934
|
const shouldDiscardStaleCreate = activeCreateGeneration === generation && discardActiveCreate;
|
|
@@ -1405,13 +1379,13 @@ function createDiscordMessageReplyRuntime(params) {
|
|
|
1405
1379
|
const { ctx, processContext } = params;
|
|
1406
1380
|
const { cfg, discordConfig, accountId, token, guildHistories, historyLimit, textLimit, messageChannelId, isDirectMessage, route } = ctx;
|
|
1407
1381
|
const { ctxPayload, deliverTarget, replyReference } = processContext;
|
|
1408
|
-
const
|
|
1382
|
+
const deliverChannelId = deliverTarget.startsWith("channel:") ? deliverTarget.slice(8) : messageChannelId;
|
|
1409
1383
|
let typingFeedback;
|
|
1410
1384
|
const getTypingFeedback = () => typingFeedback ??= createDiscordReplyTypingFeedback({
|
|
1411
1385
|
cfg,
|
|
1412
1386
|
token,
|
|
1413
1387
|
accountId,
|
|
1414
|
-
channelId:
|
|
1388
|
+
channelId: deliverChannelId,
|
|
1415
1389
|
rest: params.feedbackRest,
|
|
1416
1390
|
log: logVerbose,
|
|
1417
1391
|
keepaliveIntervalMs: params.shouldDisableCoreTypingKeepalive ? void 0 : 0
|
|
@@ -1475,7 +1449,6 @@ function createDiscordMessageReplyRuntime(params) {
|
|
|
1475
1449
|
return;
|
|
1476
1450
|
}
|
|
1477
1451
|
};
|
|
1478
|
-
const deliverChannelId = deliverTarget.startsWith("channel:") ? deliverTarget.slice(8) : messageChannelId;
|
|
1479
1452
|
return {
|
|
1480
1453
|
replyPipeline,
|
|
1481
1454
|
onModelSelected,
|
|
@@ -1548,15 +1521,22 @@ function isFallbackOnlyToolWarningFinal(payload) {
|
|
|
1548
1521
|
}
|
|
1549
1522
|
async function processDiscordMessage(ctx, observer) {
|
|
1550
1523
|
const dispatchStartedAt = Date.now();
|
|
1551
|
-
const { cfg, accountId, token, runtime, textLimit, replyToMode, message, messageChannelId, isGuildMessage, isDirectMessage, isGroupDm, messageText, threadBindings, route, abortSignal, turnAdoptionLifecycle, preparedMedia: mediaList } = ctx;
|
|
1552
|
-
if (abortSignal?.aborted) return;
|
|
1524
|
+
const { cfg, accountId, token, runtime, textLimit, replyToMode, message, messageChannelId, isGuildMessage, isDirectMessage, isGroupDm, messageText, threadBindings, route, abortSignal, isPolicyCurrent, turnAdoptionLifecycle, preparedMedia: mediaList } = ctx;
|
|
1525
|
+
if (abortSignal?.aborted || isPolicyCurrent?.() === false) return;
|
|
1553
1526
|
const text = messageText;
|
|
1554
1527
|
if (!text && mediaList.length === 0) {
|
|
1555
1528
|
logVerbose("discord: drop message " + message.id + " (empty content)");
|
|
1556
1529
|
return;
|
|
1557
1530
|
}
|
|
1558
1531
|
const boundThreadId = ctx.threadBinding?.conversation?.conversationId?.trim();
|
|
1559
|
-
if (boundThreadId && typeof threadBindings.touchThread === "function")
|
|
1532
|
+
if (boundThreadId && typeof threadBindings.touchThread === "function") {
|
|
1533
|
+
try {
|
|
1534
|
+
await threadBindings.touchThread({ threadId: boundThreadId });
|
|
1535
|
+
} catch (error) {
|
|
1536
|
+
runtime.error(danger(`discord: failed to refresh thread binding activity (${boundThreadId}): ${String(error)}`));
|
|
1537
|
+
}
|
|
1538
|
+
if (abortSignal?.aborted || isPolicyCurrent?.() === false) return;
|
|
1539
|
+
}
|
|
1560
1540
|
const sourceReplyDeliveryMode = resolveChannelMessageSourceReplyDeliveryMode({
|
|
1561
1541
|
cfg,
|
|
1562
1542
|
ctx: {
|
|
@@ -1669,7 +1649,6 @@ async function processDiscordMessage(ctx, observer) {
|
|
|
1669
1649
|
token,
|
|
1670
1650
|
accountId,
|
|
1671
1651
|
rest: reactions.deliveryRest,
|
|
1672
|
-
runtime,
|
|
1673
1652
|
replyToMode,
|
|
1674
1653
|
textLimit,
|
|
1675
1654
|
maxLinesPerMessage,
|
|
@@ -1817,7 +1796,7 @@ async function processDiscordMessage(ctx, observer) {
|
|
|
1817
1796
|
}
|
|
1818
1797
|
};
|
|
1819
1798
|
try {
|
|
1820
|
-
if (abortSignal?.aborted) {
|
|
1799
|
+
if (abortSignal?.aborted || isPolicyCurrent?.() === false) {
|
|
1821
1800
|
dispatchAborted = true;
|
|
1822
1801
|
return;
|
|
1823
1802
|
}
|
|
@@ -1921,4 +1900,4 @@ async function processDiscordMessage(ctx, observer) {
|
|
|
1921
1900
|
}
|
|
1922
1901
|
}
|
|
1923
1902
|
//#endregion
|
|
1924
|
-
export {
|
|
1903
|
+
export { processDiscordMessage };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as createDiscordActionGate } from "./accounts-
|
|
2
|
-
import { c as
|
|
3
|
-
import { a as resolveDiscordComponentSpec, b as discordInboundEventDelivery, c as formatDiscordApprovalDisplayValue, n as DISCORD_PRESENTATION_CAPABILITIES, o as sendDiscordComponentMessageLazy, r as buildDiscordPresentationPayload, x as notifyDiscordInboundEventOutboundPayloadSuccess } from "./outbound-session-route-
|
|
1
|
+
import { t as createDiscordActionGate } from "./accounts-ChaMcixG.mjs";
|
|
2
|
+
import { b as parseDiscordTarget, c as createDiscordSendReceipt, d as toDiscordOutboundDeliveryResult, i as hasDiscordMessageCreateAmbiguity, l as createDiscordSendReceiptFromResults, m as resolveDiscordReplyReference, o as chunkDiscordTextWithMode, t as canFallbackDiscordWebhookSend, v as normalizeDiscordMessagingTarget, y as normalizeDiscordOutboundTarget } from "./retry-pz_cSha2.mjs";
|
|
3
|
+
import { a as resolveDiscordComponentSpec, b as discordInboundEventDelivery, c as formatDiscordApprovalDisplayValue, g as resolveDiscordCurrentConversationIdentity, n as DISCORD_PRESENTATION_CAPABILITIES, o as sendDiscordComponentMessageLazy, r as buildDiscordPresentationPayload, x as notifyDiscordInboundEventOutboundPayloadSuccess } from "./outbound-session-route-zVGxxceg.mjs";
|
|
4
4
|
import { expectDefined } from "openclaw/plugin-sdk/expect-runtime";
|
|
5
5
|
import { normalizeLowercaseStringOrEmpty, normalizeOptionalString, normalizeOptionalStringifiedId } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
6
6
|
import { getReplyPayloadTtsSupplement, resolvePayloadMediaUrls, sendPayloadMediaSequenceOrFallback, sendTextMediaPayload } from "openclaw/plugin-sdk/reply-payload";
|
|
@@ -10,6 +10,98 @@ import { createReplyToFanout, resolveOutboundSendDep } from "openclaw/plugin-sdk
|
|
|
10
10
|
import { attachChannelToResult, createAttachedChannelResultAdapter } from "openclaw/plugin-sdk/channel-send-result";
|
|
11
11
|
import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
|
|
12
12
|
import { questionGatewayRuntime } from "openclaw/plugin-sdk/question-gateway-runtime";
|
|
13
|
+
//#region extensions/discord/src/channel.conversation.ts
|
|
14
|
+
function resolveDiscordAttachedOutboundTarget(params) {
|
|
15
|
+
if (params.threadId == null) return params.to;
|
|
16
|
+
const threadId = normalizeOptionalStringifiedId(params.threadId) ?? "";
|
|
17
|
+
return threadId ? `channel:${threadId}` : params.to;
|
|
18
|
+
}
|
|
19
|
+
function buildDiscordCrossContextPresentation(params) {
|
|
20
|
+
return {
|
|
21
|
+
tone: "neutral",
|
|
22
|
+
blocks: [...params.message.trim() ? [{
|
|
23
|
+
type: "text",
|
|
24
|
+
text: params.message
|
|
25
|
+
}, { type: "divider" }] : [], {
|
|
26
|
+
type: "context",
|
|
27
|
+
text: `From ${params.originLabel}`
|
|
28
|
+
}]
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
function normalizeDiscordAcpConversationId(conversationId) {
|
|
32
|
+
const normalized = conversationId.trim();
|
|
33
|
+
return normalized ? { conversationId: normalized } : null;
|
|
34
|
+
}
|
|
35
|
+
function matchDiscordAcpConversation(params) {
|
|
36
|
+
if (params.bindingConversationId === params.conversationId) return {
|
|
37
|
+
conversationId: params.conversationId,
|
|
38
|
+
matchPriority: 2
|
|
39
|
+
};
|
|
40
|
+
if (params.parentConversationId && params.parentConversationId !== params.conversationId && params.bindingConversationId === params.parentConversationId) return {
|
|
41
|
+
conversationId: params.parentConversationId,
|
|
42
|
+
matchPriority: 1
|
|
43
|
+
};
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
function resolveDiscordConversationIdFromTargets(targets) {
|
|
47
|
+
for (const raw of targets) {
|
|
48
|
+
const trimmed = raw?.trim();
|
|
49
|
+
if (!trimmed) continue;
|
|
50
|
+
try {
|
|
51
|
+
const target = parseDiscordTarget(trimmed, { defaultKind: "channel" });
|
|
52
|
+
if (target?.normalized) return target.normalized;
|
|
53
|
+
} catch {}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
function parseDiscordParentChannelFromSessionKey(raw) {
|
|
57
|
+
const sessionKey = normalizeLowercaseStringOrEmpty(raw);
|
|
58
|
+
if (!sessionKey) return;
|
|
59
|
+
const match = sessionKey.match(/(?:^|:)channel:([^:]+)$/);
|
|
60
|
+
return match?.[1] ? `channel:${match[1]}` : void 0;
|
|
61
|
+
}
|
|
62
|
+
function resolveDiscordCommandConversation(params) {
|
|
63
|
+
const threadConversation = resolveDiscordThreadConversationRef(params);
|
|
64
|
+
if (threadConversation) return threadConversation;
|
|
65
|
+
const conversationId = resolveDiscordCurrentConversationIdentity({
|
|
66
|
+
from: params.from,
|
|
67
|
+
chatType: params.chatType,
|
|
68
|
+
originatingTo: params.originatingTo,
|
|
69
|
+
commandTo: params.commandTo,
|
|
70
|
+
fallbackTo: params.fallbackTo
|
|
71
|
+
});
|
|
72
|
+
return conversationId ? { conversationId } : null;
|
|
73
|
+
}
|
|
74
|
+
function resolveDiscordThreadConversationRef(params) {
|
|
75
|
+
const threadId = normalizeOptionalStringifiedId(params.threadId);
|
|
76
|
+
if (!threadId) return null;
|
|
77
|
+
const targets = [
|
|
78
|
+
params.originatingTo ?? params.to,
|
|
79
|
+
params.commandTo,
|
|
80
|
+
params.fallbackTo ?? params.conversationId
|
|
81
|
+
];
|
|
82
|
+
const parentConversationId = normalizeDiscordMessagingTarget(normalizeOptionalStringifiedId(params.threadParentId) ?? "") || parseDiscordParentChannelFromSessionKey(params.parentSessionKey) || resolveDiscordConversationIdFromTargets(targets);
|
|
83
|
+
return {
|
|
84
|
+
conversationId: threadId,
|
|
85
|
+
...parentConversationId && parentConversationId !== threadId ? { parentConversationId } : {}
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
function resolveDiscordInboundConversation(params) {
|
|
89
|
+
const threadConversation = resolveDiscordThreadConversationRef({
|
|
90
|
+
to: params.to,
|
|
91
|
+
conversationId: params.conversationId,
|
|
92
|
+
threadId: params.threadId,
|
|
93
|
+
threadParentId: params.threadParentId
|
|
94
|
+
});
|
|
95
|
+
if (threadConversation) return threadConversation;
|
|
96
|
+
const conversationId = resolveDiscordCurrentConversationIdentity({
|
|
97
|
+
from: params.from,
|
|
98
|
+
chatType: params.isGroup ? "group" : "direct",
|
|
99
|
+
originatingTo: params.to,
|
|
100
|
+
fallbackTo: params.conversationId
|
|
101
|
+
});
|
|
102
|
+
return conversationId ? { conversationId } : null;
|
|
103
|
+
}
|
|
104
|
+
//#endregion
|
|
13
105
|
//#region extensions/discord/src/media-detection.ts
|
|
14
106
|
const DISCORD_VIDEO_MEDIA_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
15
107
|
".avi",
|
|
@@ -59,13 +151,7 @@ function normalizeDiscordApprovalPayload(payload) {
|
|
|
59
151
|
}
|
|
60
152
|
//#endregion
|
|
61
153
|
//#region extensions/discord/src/outbound-send-context.ts
|
|
62
|
-
const loadDiscordSendRuntime = createLazyRuntimeModule(() => import("./send-
|
|
63
|
-
function resolveDiscordOutboundTarget(params) {
|
|
64
|
-
if (params.threadId == null) return params.to;
|
|
65
|
-
const threadId = normalizeOptionalStringifiedId(params.threadId) ?? "";
|
|
66
|
-
if (!threadId) return params.to;
|
|
67
|
-
return `channel:${threadId}`;
|
|
68
|
-
}
|
|
154
|
+
const loadDiscordSendRuntime = createLazyRuntimeModule(() => import("./send-CrfEI6Bs.mjs").then((n) => n.t));
|
|
69
155
|
function resolveDiscordFormattingOptions(ctx) {
|
|
70
156
|
const formatting = ctx.formatting;
|
|
71
157
|
return {
|
|
@@ -79,7 +165,7 @@ async function createDiscordPayloadSendContext(ctx) {
|
|
|
79
165
|
const runtime = await loadDiscordSendRuntime();
|
|
80
166
|
const nextReplyToId = createReplyToFanout(ctx);
|
|
81
167
|
return {
|
|
82
|
-
target:
|
|
168
|
+
target: resolveDiscordAttachedOutboundTarget({
|
|
83
169
|
to: ctx.to,
|
|
84
170
|
threadId: ctx.threadId
|
|
85
171
|
}),
|
|
@@ -280,8 +366,8 @@ async function sendDiscordOutboundPayload(params) {
|
|
|
280
366
|
const DISCORD_TEXT_CHUNK_LIMIT = 2e3;
|
|
281
367
|
const DISCORD_PRECHUNK_MAX_LINES = Number.MAX_SAFE_INTEGER;
|
|
282
368
|
const log = createSubsystemLogger("discord/outbound");
|
|
283
|
-
const loadDiscordThreadBindings = createLazyRuntimeModule(() => import("./thread-bindings-
|
|
284
|
-
const loadDiscordComponentSendRuntime = createLazyRuntimeModule(() => import("./send.components-
|
|
369
|
+
const loadDiscordThreadBindings = createLazyRuntimeModule(() => import("./thread-bindings-D7TfgjR_.mjs").then((n) => n.i));
|
|
370
|
+
const loadDiscordComponentSendRuntime = createLazyRuntimeModule(() => import("./send.components-DxQAMfES.mjs").then((n) => n.i));
|
|
285
371
|
function resolveDiscordDeliveryOptions(params) {
|
|
286
372
|
return {
|
|
287
373
|
onPlatformSendDispatch: params.onPlatformSendDispatch,
|
|
@@ -323,7 +409,7 @@ async function resolveDiscordOutboundMessageSend(params) {
|
|
|
323
409
|
});
|
|
324
410
|
return {
|
|
325
411
|
send,
|
|
326
|
-
target:
|
|
412
|
+
target: resolveDiscordAttachedOutboundTarget({
|
|
327
413
|
to: params.to,
|
|
328
414
|
threadId: params.threadId
|
|
329
415
|
}),
|
|
@@ -427,7 +513,7 @@ const discordOutbound = {
|
|
|
427
513
|
cfg,
|
|
428
514
|
accountId
|
|
429
515
|
})("polls")) throw new Error("Discord polls are disabled.");
|
|
430
|
-
const outboundTo =
|
|
516
|
+
const outboundTo = resolveDiscordAttachedOutboundTarget({
|
|
431
517
|
to,
|
|
432
518
|
threadId
|
|
433
519
|
});
|
|
@@ -456,7 +542,7 @@ const discordOutbound = {
|
|
|
456
542
|
afterDeliverPayload: async ({ cfg, target, payload, results }) => {
|
|
457
543
|
notifyDiscordInboundEventOutboundPayloadSuccess({
|
|
458
544
|
payload,
|
|
459
|
-
to:
|
|
545
|
+
to: resolveDiscordAttachedOutboundTarget({
|
|
460
546
|
to: target.to,
|
|
461
547
|
threadId: target.threadId
|
|
462
548
|
}),
|
|
@@ -466,7 +552,7 @@ const discordOutbound = {
|
|
|
466
552
|
const result = results.find((candidate) => candidate.channel === "discord" && candidate.messageId);
|
|
467
553
|
const componentSpec = questionId ? await resolveDiscordComponentSpec(payload) : void 0;
|
|
468
554
|
if (questionId && result && componentSpec) {
|
|
469
|
-
const to =
|
|
555
|
+
const to = resolveDiscordAttachedOutboundTarget({
|
|
470
556
|
to: target.to,
|
|
471
557
|
threadId: target.threadId
|
|
472
558
|
});
|
|
@@ -495,8 +581,8 @@ const discordOutbound = {
|
|
|
495
581
|
const { getThreadBindingManager } = await loadDiscordThreadBindings();
|
|
496
582
|
const manager = getThreadBindingManager(target.accountId ?? void 0);
|
|
497
583
|
if (!manager?.getByThreadId(threadId)) return;
|
|
498
|
-
manager.touchThread({ threadId });
|
|
584
|
+
await manager.touchThread({ threadId });
|
|
499
585
|
}
|
|
500
586
|
};
|
|
501
587
|
//#endregion
|
|
502
|
-
export { discordOutbound as n, DISCORD_TEXT_CHUNK_LIMIT as t };
|
|
588
|
+
export { normalizeDiscordAcpConversationId as a, resolveDiscordInboundConversation as c, matchDiscordAcpConversation as i, discordOutbound as n, resolveDiscordAttachedOutboundTarget as o, buildDiscordCrossContextPresentation as r, resolveDiscordCommandConversation as s, DISCORD_TEXT_CHUNK_LIMIT as t };
|