@openclaw/discord 2026.6.8 → 2026.6.9
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/action-runtime-api.js +1 -1
- package/dist/{api-BmXlcjYW.js → api-4GFMoWu0.js} +4 -1
- package/dist/api.js +15 -15
- package/dist/{approval-handler.runtime-B3gyUd-L.js → approval-handler.runtime-20qhf0uH.js} +3 -3
- package/dist/{audit-BlfewK04.js → audit-CCffO6o7.js} +3 -3
- package/dist/{channel-actions-BnPHwCZ_.js → channel-actions-DDT9kJXw.js} +12 -6
- package/dist/{channel-actions.runtime-DX5iW6ut.js → channel-actions.runtime-CfMUtfAv.js} +5 -5
- package/dist/{channel-b0hY1EJw.js → channel-fEBKaO2Q.js} +28 -20
- package/dist/channel-plugin-api.js +1 -1
- package/dist/{channel.setup-By5cfELZ.js → channel.setup-DRJiHe7I.js} +2 -3
- package/dist/{components-D-CYw0-b.js → components-CXEorOhu.js} +1 -1
- package/dist/{conversation-identity-CKzQAqFF.js → conversation-identity-BvlP-djn.js} +2 -2
- package/dist/{directory-config-Bu7FYOsl.js → directory-config-Bg8bulWB.js} +1 -1
- package/dist/directory-contract-api.js +1 -1
- package/dist/{directory-live-LjENjK6L.js → directory-live-BAJw6kS2.js} +2 -2
- package/dist/{handle-action.guild-admin-BS2qnhXF.js → handle-action.guild-admin-RxnJFLgU.js} +14 -9
- package/dist/index.js +1 -1
- package/dist/{manager.runtime-BU1vkOeO.js → manager.runtime-Bh5X0o8P.js} +12 -4
- package/dist/{message-handler-CQVkXHMN.js → message-handler-Dg3DRD0e.js} +6 -6
- package/dist/{message-handler.preflight-DAnLOeDA.js → message-handler.preflight-CcexCYuy.js} +10 -10
- package/dist/{message-handler.process-Dp5NQT05.js → message-handler.process-CN8bVDxj.js} +37 -45
- package/dist/{message-utils-Bx993JLN.js → message-utils-ConlUKCU.js} +1 -1
- package/dist/{outbound-adapter-CmN7ao1t.js → outbound-adapter-XuMiR77A.js} +6 -6
- package/dist/{pluralkit-SYmlmerw.js → pluralkit-o6s-EP9g.js} +4 -2
- package/dist/{probe-2MdGjUAf.js → probe-CxnDikWm.js} +5 -2
- package/dist/{probe.runtime-J927koKG.js → probe.runtime-DLFkSDVB.js} +1 -1
- package/dist/{provider-DrScDA1p.js → provider-4VG5CvC-.js} +98 -69
- package/dist/{provider-session.runtime-DXTzSYOJ.js → provider-session.runtime-ChdHgGCo.js} +3 -3
- package/dist/provider.runtime-B4QuZl_o.js +2 -0
- package/dist/{resolve-allowlist-common-B3p7cT8F.js → resolve-allowlist-common-BDpBb8dF.js} +1 -1
- package/dist/{resolve-channels-Rautpk8n.js → resolve-channels-DpM2v0Am.js} +3 -3
- package/dist/{resolve-users-Bw7vvtsi.js → resolve-users-Dl6np4pH.js} +3 -3
- package/dist/{runtime-C80YEJ7Z.js → runtime-CkdyyjTb.js} +24 -10
- package/dist/runtime-api.actions.js +2 -2
- package/dist/runtime-api.js +19 -19
- package/dist/runtime-api.lookup.js +5 -5
- package/dist/runtime-api.monitor-9pShEBWs.js +6 -0
- package/dist/runtime-api.monitor.js +4 -4
- package/dist/runtime-api.send.js +5 -5
- package/dist/runtime-api.threads.js +3 -3
- package/dist/{send-zGsXF-up.js → send-CIhsDMqs.js} +8 -5
- package/dist/{send.components-ktzrUTkt.js → send.components-DxoGyTkn.js} +4 -4
- package/dist/{send.outbound-C8oC51um.js → send.outbound-DaUyYuZa.js} +53 -10
- package/dist/{send.receipt-DsQWEQ2O.js → send.receipt-De_2iEWU.js} +2 -24
- package/dist/{send.shared-Dvo2ZCVG.js → send.shared-gtgBGDuV.js} +13 -5
- package/dist/session-binding-contract-api.js +1 -1
- package/dist/setup-plugin-api.js +1 -1
- package/dist/{subagent-hooks-kjrWDeDg.js → subagent-hooks-DPCipg2M.js} +2 -2
- package/dist/subagent-hooks-api.js +1 -1
- package/dist/{system-events-CvU3Aduf.js → system-events-4vmuyaBF.js} +1 -1
- package/dist/{target-resolver-DMPTzuo7.js → target-resolver-CVrOhQyC.js} +2 -2
- package/dist/targets-CRGgRKs7.js +3 -0
- package/dist/{thread-bindings-DO32M2kW.js → thread-bindings-D2SBj6F8.js} +4 -4
- package/dist/{thread-bindings.discord-api-304M1PMr.js → thread-bindings.discord-api-C7STOVXm.js} +4 -4
- package/dist/{thread-bindings.manager-C9YT7wF2.js → thread-bindings.manager-CN4MIGoJ.js} +3 -3
- package/dist/{transcripts-source-Chy2OrO_.js → transcripts-source-39NBdNeE.js} +1 -1
- package/dist/transcripts-source-api.js +1 -1
- package/dist/{typing-BaivbXIG.js → typing-CxIYS3vQ.js} +1 -1
- package/node_modules/undici/README.md +59 -18
- package/node_modules/undici/docs/docs/GettingStarted.md +278 -0
- package/node_modules/undici/docs/docs/api/Agent.md +3 -0
- package/node_modules/undici/docs/docs/api/BalancedPool.md +1 -1
- package/node_modules/undici/docs/docs/api/Client.md +44 -5
- package/node_modules/undici/docs/docs/api/Connector.md +1 -0
- package/node_modules/undici/docs/docs/api/Cookies.md +28 -1
- package/node_modules/undici/docs/docs/api/Dispatcher.md +22 -5
- package/node_modules/undici/docs/docs/api/EnvHttpProxyAgent.md +6 -9
- package/node_modules/undici/docs/docs/api/Errors.md +12 -0
- package/node_modules/undici/docs/docs/api/EventSource.md +50 -3
- package/node_modules/undici/docs/docs/api/Fetch.md +5 -3
- package/node_modules/undici/docs/docs/api/H2CClient.md +3 -3
- package/node_modules/undici/docs/docs/api/MockAgent.md +1 -1
- package/node_modules/undici/docs/docs/api/MockCallHistory.md +1 -1
- package/node_modules/undici/docs/docs/api/Pool.md +4 -1
- package/node_modules/undici/docs/docs/api/RedirectHandler.md +4 -1
- package/node_modules/undici/docs/docs/api/RetryAgent.md +3 -3
- package/node_modules/undici/docs/docs/api/RetryHandler.md +6 -6
- package/node_modules/undici/docs/docs/api/RoundRobinPool.md +1 -1
- package/node_modules/undici/docs/docs/api/SnapshotAgent.md +3 -3
- package/node_modules/undici/docs/docs/api/Socks5ProxyAgent.md +1 -0
- package/node_modules/undici/docs/docs/api/api-lifecycle.md +4 -4
- package/node_modules/undici/lib/core/connect.js +29 -4
- package/node_modules/undici/lib/core/util.js +8 -6
- package/node_modules/undici/lib/dispatcher/client-h1.js +69 -2
- package/node_modules/undici/lib/dispatcher/client-h2.js +160 -37
- package/node_modules/undici/lib/dispatcher/client.js +36 -7
- package/node_modules/undici/lib/dispatcher/dispatcher-base.js +1 -0
- package/node_modules/undici/lib/dispatcher/proxy-agent.js +2 -1
- package/node_modules/undici/lib/dispatcher/socks5-proxy-agent.js +4 -2
- package/node_modules/undici/lib/handler/redirect-handler.js +36 -11
- package/node_modules/undici/lib/interceptor/dns.js +4 -0
- package/node_modules/undici/lib/interceptor/redirect.js +3 -3
- package/node_modules/undici/lib/mock/mock-call-history.js +1 -1
- package/node_modules/undici/lib/mock/snapshot-agent.js +9 -1
- package/node_modules/undici/lib/util/cache.js +8 -2
- package/node_modules/undici/lib/web/cookies/parse.js +17 -25
- package/node_modules/undici/lib/web/eventsource/eventsource.js +7 -18
- package/node_modules/undici/lib/web/eventsource/util.js +32 -1
- package/node_modules/undici/lib/web/fetch/body.js +43 -0
- package/node_modules/undici/lib/web/fetch/index.js +17 -3
- package/node_modules/undici/lib/web/fetch/request.js +33 -3
- package/node_modules/undici/lib/web/websocket/receiver.js +20 -3
- package/node_modules/undici/lib/web/websocket/stream/websocketstream.js +8 -1
- package/node_modules/undici/lib/web/websocket/websocket.js +3 -1
- package/node_modules/undici/package.json +1 -1
- package/node_modules/undici/types/client.d.ts +5 -0
- package/node_modules/undici/types/connector.d.ts +1 -0
- package/node_modules/undici/types/fetch.d.ts +5 -1
- package/node_modules/undici/types/interceptors.d.ts +1 -1
- package/npm-shrinkwrap.json +7 -7
- package/package.json +5 -5
- package/dist/provider.runtime-nb-6cRoy.js +0 -2
- package/dist/runtime-api.monitor-D8KNDAd5.js +0 -6
- package/dist/targets-CKaNidbk.js +0 -3
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { Ut as resolveDiscordChannelId, c as discord_exports, ft as editChannelMessage, s as chunkDiscordTextWithMode, st as createChannelMessage, ut as deleteChannelMessage } from "./send.receipt-
|
|
1
|
+
import { Ut as resolveDiscordChannelId, c as discord_exports, ft as editChannelMessage, s as chunkDiscordTextWithMode, st as createChannelMessage, ut as deleteChannelMessage } from "./send.receipt-De_2iEWU.js";
|
|
2
2
|
import { f as resolveDiscordMaxLinesPerMessage, s as resolveDiscordAccount } from "./accounts-P19jm1lf.js";
|
|
3
|
-
import { I as createDiscordRestClient, L as createDiscordRuntimeAccountContext, _ as resolveDiscordMessageFlags, d as resolveDiscordTargetChannelId } from "./send.shared-
|
|
3
|
+
import { I as createDiscordRestClient, L as createDiscordRuntimeAccountContext, _ as resolveDiscordMessageFlags, d as resolveDiscordTargetChannelId } from "./send.shared-gtgBGDuV.js";
|
|
4
4
|
import { S as resolveTimestampMs, a as normalizeDiscordSlug, r as normalizeDiscordAllowList } from "./allow-list-C-MqM-B_.js";
|
|
5
|
-
import { a as removeReactionDiscord, f as editMessageDiscord, r as reactMessageDiscord } from "./send-
|
|
6
|
-
import { a as discordTextHasTargetedMention, i as discordTextHasBroadcastMention, s as rewriteDiscordKnownMentions } from "./send.outbound-
|
|
7
|
-
import "./targets-
|
|
8
|
-
import { t as resolveDiscordConversationIdentity } from "./conversation-identity-
|
|
5
|
+
import { a as removeReactionDiscord, f as editMessageDiscord, r as reactMessageDiscord } from "./send-CIhsDMqs.js";
|
|
6
|
+
import { a as discordTextHasTargetedMention, i as discordTextHasBroadcastMention, s as rewriteDiscordKnownMentions } from "./send.outbound-DaUyYuZa.js";
|
|
7
|
+
import "./targets-CRGgRKs7.js";
|
|
8
|
+
import { t as resolveDiscordConversationIdentity } from "./conversation-identity-BvlP-djn.js";
|
|
9
9
|
import { t as beginDiscordInboundEventDeliveryCorrelation } from "./inbound-event-delivery-CEPlt2uz.js";
|
|
10
|
-
import { t as DISCORD_TEXT_CHUNK_LIMIT } from "./outbound-adapter-CmN7ao1t.js";
|
|
11
|
-
import { t as resolveDiscordPreviewStreamMode } from "./preview-streaming-DXT8oJdo.js";
|
|
12
10
|
import { n as DISCORD_ATTACHMENT_TOTAL_TIMEOUT_MS, t as DISCORD_ATTACHMENT_IDLE_TIMEOUT_MS } from "./timeouts-C5TBc_9x.js";
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import { n as
|
|
11
|
+
import { t as DISCORD_TEXT_CHUNK_LIMIT } from "./outbound-adapter-XuMiR77A.js";
|
|
12
|
+
import { t as resolveDiscordPreviewStreamMode } from "./preview-streaming-DXT8oJdo.js";
|
|
13
|
+
import { C as resolveDiscordAutoThreadReplyPlan, T as resolveDiscordThreadStarter, a as buildGuildLabel, h as createDiscordSupplementalContextAccessChecker, i as buildDirectLabel, m as buildDiscordInboundAccessContext, n as deliverDiscordReply, o as resolveReplyContext, r as sanitizeDiscordFrontChannelReplyPayloads } from "./provider-4VG5CvC-.js";
|
|
14
|
+
import { a as resolveForwardedMediaList, o as resolveMediaList, r as resolveDiscordMessageText, s as resolveReferencedReplyMediaList } from "./message-utils-ConlUKCU.js";
|
|
15
|
+
import { n as createDiscordReplyTypingFeedback } from "./message-handler-Dg3DRD0e.js";
|
|
16
16
|
import { buildAgentSessionKey, resolveThreadSessionKeys } from "openclaw/plugin-sdk/routing";
|
|
17
17
|
import { MessageFlags } from "discord-api-types/v10";
|
|
18
18
|
import path from "node:path";
|
|
@@ -536,8 +536,7 @@ function createDiscordDraftPreviewController(params) {
|
|
|
536
536
|
const discordStreamMode = resolveDiscordPreviewStreamMode(params.discordConfig);
|
|
537
537
|
const draftMaxChars = Math.min(params.textLimit, 2e3);
|
|
538
538
|
const accountBlockStreamingEnabled = resolveChannelStreamingBlockEnabled(params.discordConfig) ?? params.cfg.agents?.defaults?.blockStreamingDefault === "on";
|
|
539
|
-
const
|
|
540
|
-
const draftStream = (!params.sourceRepliesAreToolOnly || canStreamProgressDraftForToolOnlySource) && discordStreamMode !== "off" && !accountBlockStreamingEnabled ? createDiscordDraftStream({
|
|
539
|
+
const draftStream = !params.sourceRepliesAreToolOnly && discordStreamMode !== "off" && !accountBlockStreamingEnabled ? createDiscordDraftStream({
|
|
541
540
|
rest: params.deliveryRest,
|
|
542
541
|
channelId: params.deliverChannelId,
|
|
543
542
|
maxChars: draftMaxChars,
|
|
@@ -622,10 +621,6 @@ function createDiscordDraftPreviewController(params) {
|
|
|
622
621
|
finalizedViaPreviewMessage = true;
|
|
623
622
|
},
|
|
624
623
|
disableBlockStreamingForDraft: draftStream ? true : void 0,
|
|
625
|
-
async startProgressDraft() {
|
|
626
|
-
if (!draftStream || discordStreamMode !== "progress") return;
|
|
627
|
-
await progressDraft.start();
|
|
628
|
-
},
|
|
629
624
|
async pushToolProgress(line, options) {
|
|
630
625
|
await progressDraft.pushToolProgress(line, options);
|
|
631
626
|
},
|
|
@@ -921,14 +916,20 @@ async function processDiscordMessageInner(ctx, observer) {
|
|
|
921
916
|
statusReactionsActive = true;
|
|
922
917
|
statusReactions.setQueued();
|
|
923
918
|
};
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
919
|
+
let initialAckReactionQueued = false;
|
|
920
|
+
const queueInitialAckReactionAfterRecord = () => {
|
|
921
|
+
if (initialAckReactionQueued) return;
|
|
922
|
+
initialAckReactionQueued = true;
|
|
923
|
+
if (statusReactionsEnabled) statusReactionsActive = true;
|
|
924
|
+
queueInitialDiscordAckReaction({
|
|
925
|
+
enabled: statusReactionsEnabled,
|
|
926
|
+
shouldSendAckReaction,
|
|
927
|
+
ackReaction,
|
|
928
|
+
statusReactions,
|
|
929
|
+
reactionAdapter: discordAdapter,
|
|
930
|
+
target: `${messageChannelId}/${message.id}`
|
|
931
|
+
});
|
|
932
|
+
};
|
|
932
933
|
const processContext = await buildDiscordMessageProcessContext({
|
|
933
934
|
ctx,
|
|
934
935
|
text,
|
|
@@ -1054,15 +1055,6 @@ async function processDiscordMessageInner(ctx, observer) {
|
|
|
1054
1055
|
}));
|
|
1055
1056
|
return null;
|
|
1056
1057
|
}
|
|
1057
|
-
if (payload.isReasoning) {
|
|
1058
|
-
logVerbose(formatDiscordReplySkip({
|
|
1059
|
-
kind: info.kind,
|
|
1060
|
-
reason: "reasoning payload",
|
|
1061
|
-
target: deliverTarget,
|
|
1062
|
-
sessionKey: ctxPayload.SessionKey
|
|
1063
|
-
}));
|
|
1064
|
-
return null;
|
|
1065
|
-
}
|
|
1066
1058
|
if (draftPreview.draftStream && draftPreview.isProgressMode && info.kind === "block") {
|
|
1067
1059
|
if (!resolveSendableOutboundReplyParts(payload).hasMedia && !payload.isError) return null;
|
|
1068
1060
|
}
|
|
@@ -1080,15 +1072,6 @@ async function processDiscordMessageInner(ctx, observer) {
|
|
|
1080
1072
|
return { visibleReplySent: false };
|
|
1081
1073
|
}
|
|
1082
1074
|
const isFinal = info.kind === "final";
|
|
1083
|
-
if (payload.isReasoning) {
|
|
1084
|
-
logVerbose(formatDiscordReplySkip({
|
|
1085
|
-
kind: info.kind,
|
|
1086
|
-
reason: "reasoning payload",
|
|
1087
|
-
target: deliverTarget,
|
|
1088
|
-
sessionKey: ctxPayload.SessionKey
|
|
1089
|
-
}));
|
|
1090
|
-
return { visibleReplySent: false };
|
|
1091
|
-
}
|
|
1092
1075
|
if (isFinal && !options?.allowFallbackOnlyToolWarning && isFallbackOnlyToolWarningFinal(payload)) {
|
|
1093
1076
|
if (!userFacingFinalDelivered && (!finalReplyStartNotified || userFacingFinalDeliveryFailed)) pendingToolWarningFinal = {
|
|
1094
1077
|
payload,
|
|
@@ -1307,6 +1290,7 @@ async function processDiscordMessageInner(ctx, observer) {
|
|
|
1307
1290
|
storePath: turn.storePath,
|
|
1308
1291
|
ctxPayload,
|
|
1309
1292
|
recordInboundSession,
|
|
1293
|
+
afterRecord: queueInitialAckReactionAfterRecord,
|
|
1310
1294
|
dispatchReplyWithBufferedBlockDispatcher,
|
|
1311
1295
|
dispatcherOptions: {
|
|
1312
1296
|
...replyPipeline,
|
|
@@ -1332,13 +1316,14 @@ async function processDiscordMessageInner(ctx, observer) {
|
|
|
1332
1316
|
sourceReplyDeliveryMode,
|
|
1333
1317
|
queuedDeliveryCorrelations: isRoomEvent ? [{ begin: beginDeliveryCorrelation }] : void 0,
|
|
1334
1318
|
suppressTyping: isRoomEvent ? true : void 0,
|
|
1335
|
-
allowProgressCallbacksWhenSourceDeliverySuppressed: sourceRepliesAreToolOnly &&
|
|
1319
|
+
allowProgressCallbacksWhenSourceDeliverySuppressed: sourceRepliesAreToolOnly && statusReactionsExplicitlyEnabled ? true : void 0,
|
|
1336
1320
|
disableBlockStreaming: sourceRepliesAreToolOnly ? true : draftPreview.disableBlockStreamingForDraft ?? (typeof resolvedBlockStreamingEnabled === "boolean" ? !resolvedBlockStreamingEnabled : void 0),
|
|
1337
1321
|
onPartialReply: draftPreview.draftStream && !draftPreview.isProgressMode ? (payload) => draftPreview.updateFromPartial(payload.text) : void 0,
|
|
1338
1322
|
onAssistantMessageStart: draftPreview.draftStream ? () => draftPreview.handleAssistantMessageBoundary() : void 0,
|
|
1339
1323
|
onReasoningEnd: draftPreview.draftStream ? () => draftPreview.handleAssistantMessageBoundary() : void 0,
|
|
1340
1324
|
onModelSelected,
|
|
1341
|
-
suppressDefaultToolProgressMessages: draftPreview.suppressDefaultToolProgressMessages ? true : void 0,
|
|
1325
|
+
suppressDefaultToolProgressMessages: sourceRepliesAreToolOnly && statusReactionsExplicitlyEnabled || draftPreview.suppressDefaultToolProgressMessages ? true : void 0,
|
|
1326
|
+
allowToolLifecycleWhenProgressHidden: statusReactionsEnabled ? true : void 0,
|
|
1342
1327
|
commentaryProgressEnabled: draftPreview.isProgressMode ? draftPreview.commentaryProgressEnabled : void 0,
|
|
1343
1328
|
onVerboseProgressVisibility: (isActive) => {
|
|
1344
1329
|
verboseProgressActive = isActive;
|
|
@@ -1353,6 +1338,8 @@ async function processDiscordMessageInner(ctx, observer) {
|
|
|
1353
1338
|
await statusReactions.setTool(payload.name);
|
|
1354
1339
|
await draftPreview.pushToolProgress(buildChannelProgressDraftLineForEntry(discordConfig, {
|
|
1355
1340
|
event: "tool",
|
|
1341
|
+
itemId: payload.itemId,
|
|
1342
|
+
toolCallId: payload.toolCallId,
|
|
1356
1343
|
name: payload.name,
|
|
1357
1344
|
phase: payload.phase,
|
|
1358
1345
|
args: payload.args
|
|
@@ -1367,6 +1354,7 @@ async function processDiscordMessageInner(ctx, observer) {
|
|
|
1367
1354
|
await draftPreview.pushToolProgress(buildChannelProgressDraftLineForEntry(discordConfig, {
|
|
1368
1355
|
event: "item",
|
|
1369
1356
|
itemId: payload.itemId,
|
|
1357
|
+
toolCallId: payload.toolCallId,
|
|
1370
1358
|
itemKind: payload.kind,
|
|
1371
1359
|
title: payload.title,
|
|
1372
1360
|
name: payload.name,
|
|
@@ -1402,6 +1390,8 @@ async function processDiscordMessageInner(ctx, observer) {
|
|
|
1402
1390
|
if (payload.phase !== "end") return;
|
|
1403
1391
|
await draftPreview.pushToolProgress(buildChannelProgressDraftLine({
|
|
1404
1392
|
event: "command-output",
|
|
1393
|
+
itemId: payload.itemId,
|
|
1394
|
+
toolCallId: payload.toolCallId,
|
|
1405
1395
|
phase: payload.phase,
|
|
1406
1396
|
title: payload.title,
|
|
1407
1397
|
name: payload.name,
|
|
@@ -1413,6 +1403,8 @@ async function processDiscordMessageInner(ctx, observer) {
|
|
|
1413
1403
|
if (payload.phase !== "end") return;
|
|
1414
1404
|
await draftPreview.pushToolProgress(buildChannelProgressDraftLine({
|
|
1415
1405
|
event: "patch",
|
|
1406
|
+
itemId: payload.itemId,
|
|
1407
|
+
toolCallId: payload.toolCallId,
|
|
1416
1408
|
phase: payload.phase,
|
|
1417
1409
|
title: payload.title,
|
|
1418
1410
|
name: payload.name,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { u as resolveDiscordChannelInfoSafe } from "./thread-bindings.discord-api-304M1PMr.js";
|
|
2
1
|
import { o as mergeAbortSignals } from "./timeouts-C5TBc_9x.js";
|
|
2
|
+
import { u as resolveDiscordChannelInfoSafe } from "./thread-bindings.discord-api-C7STOVXm.js";
|
|
3
3
|
import { normalizeLowercaseStringOrEmpty, normalizeOptionalString, normalizeOptionalStringifiedId, uniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
4
4
|
import { ComponentType, StickerFormatType } from "discord-api-types/v10";
|
|
5
5
|
import { asDateTimestampMs, resolveExpiresAtMsFromDurationMs } from "openclaw/plugin-sdk/number-runtime";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { o as normalizeDiscordOutboundTarget, s as chunkDiscordTextWithMode, t as createDiscordSendReceipt, x as DiscordError } from "./send.receipt-
|
|
1
|
+
import { o as normalizeDiscordOutboundTarget, s as chunkDiscordTextWithMode, t as createDiscordSendReceipt, x as DiscordError } from "./send.receipt-De_2iEWU.js";
|
|
2
2
|
import { s as resolveDiscordAccount } from "./accounts-P19jm1lf.js";
|
|
3
|
-
import { d as readDiscordComponentSpec } from "./components-
|
|
3
|
+
import { d as readDiscordComponentSpec } from "./components-CXEorOhu.js";
|
|
4
4
|
import { t as parseDiscordRetryAfterBodySeconds } from "./retry-after-D5_VmM-_.js";
|
|
5
5
|
import { n as notifyDiscordInboundEventOutboundPayloadSuccess } from "./inbound-event-delivery-CEPlt2uz.js";
|
|
6
6
|
import { normalizeLowercaseStringOrEmpty, normalizeOptionalString, normalizeOptionalStringifiedId } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
@@ -86,11 +86,11 @@ function normalizeDiscordApprovalPayload(payload) {
|
|
|
86
86
|
let discordComponentSendPromise;
|
|
87
87
|
let discordSharedInteractivePromise;
|
|
88
88
|
async function sendDiscordComponentMessageLazy(...args) {
|
|
89
|
-
discordComponentSendPromise ??= import("./send.components-
|
|
89
|
+
discordComponentSendPromise ??= import("./send.components-DxoGyTkn.js").then((n) => n.i).then((module) => module.sendDiscordComponentMessage);
|
|
90
90
|
return await (await discordComponentSendPromise)(...args);
|
|
91
91
|
}
|
|
92
92
|
function loadDiscordSharedInteractive() {
|
|
93
|
-
discordSharedInteractivePromise ??= import("./components-
|
|
93
|
+
discordSharedInteractivePromise ??= import("./components-CXEorOhu.js").then((n) => n.a);
|
|
94
94
|
return discordSharedInteractivePromise;
|
|
95
95
|
}
|
|
96
96
|
function addPayloadTextFallback(spec, payload) {
|
|
@@ -125,7 +125,7 @@ async function resolveDiscordComponentSpec(payload) {
|
|
|
125
125
|
//#region extensions/discord/src/outbound-send-context.ts
|
|
126
126
|
let discordSendRuntimePromise;
|
|
127
127
|
async function loadDiscordSendRuntime() {
|
|
128
|
-
discordSendRuntimePromise ??= import("./send-
|
|
128
|
+
discordSendRuntimePromise ??= import("./send-CIhsDMqs.js").then((n) => n.t);
|
|
129
129
|
return await discordSendRuntimePromise;
|
|
130
130
|
}
|
|
131
131
|
function resolveDiscordOutboundTarget(params) {
|
|
@@ -280,7 +280,7 @@ function stripDiscordInternalRuntimeScaffolding(text) {
|
|
|
280
280
|
}
|
|
281
281
|
let discordThreadBindingsPromise;
|
|
282
282
|
function loadDiscordThreadBindings() {
|
|
283
|
-
discordThreadBindingsPromise ??= import("./thread-bindings-
|
|
283
|
+
discordThreadBindingsPromise ??= import("./thread-bindings-D2SBj6F8.js").then((n) => n.t);
|
|
284
284
|
return discordThreadBindingsPromise;
|
|
285
285
|
}
|
|
286
286
|
function resolveDiscordWebhookIdentity(params) {
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { Wt as __exportAll } from "./send.receipt-
|
|
1
|
+
import { Wt as __exportAll } from "./send.receipt-De_2iEWU.js";
|
|
2
2
|
import { resolveFetch } from "openclaw/plugin-sdk/fetch-runtime";
|
|
3
|
+
import { readResponseTextLimited } from "openclaw/plugin-sdk/provider-http";
|
|
3
4
|
//#region extensions/discord/src/pluralkit.ts
|
|
4
5
|
var pluralkit_exports = /* @__PURE__ */ __exportAll({ fetchPluralKitMessageInfo: () => fetchPluralKitMessageInfo });
|
|
5
6
|
const PLURALKIT_API_BASE = "https://api.pluralkit.me/v2";
|
|
7
|
+
const PLURALKIT_ERROR_BODY_LIMIT_BYTES = 8 * 1024;
|
|
6
8
|
async function fetchPluralKitMessageInfo(params) {
|
|
7
9
|
if (!params.config?.enabled) return null;
|
|
8
10
|
const fetchImpl = resolveFetch(params.fetcher);
|
|
@@ -12,7 +14,7 @@ async function fetchPluralKitMessageInfo(params) {
|
|
|
12
14
|
const res = await fetchImpl(`${PLURALKIT_API_BASE}/messages/${params.messageId}`, { headers });
|
|
13
15
|
if (res.status === 404) return null;
|
|
14
16
|
if (!res.ok) {
|
|
15
|
-
const text = await res
|
|
17
|
+
const text = await readResponseTextLimited(res, PLURALKIT_ERROR_BODY_LIMIT_BYTES).catch(() => "");
|
|
16
18
|
const detail = text.trim() ? `: ${text.trim()}` : "";
|
|
17
19
|
throw new Error(`PluralKit API failed (${res.status})${detail}`);
|
|
18
20
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { p as normalizeDiscordToken } from "./accounts-P19jm1lf.js";
|
|
2
|
-
import { n as fetchDiscord, t as DiscordApiError } from "./api-
|
|
2
|
+
import { n as fetchDiscord, t as DiscordApiError } from "./api-4GFMoWu0.js";
|
|
3
3
|
import { resolveFetch } from "openclaw/plugin-sdk/fetch-runtime";
|
|
4
4
|
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
5
5
|
import { fetchWithTimeout } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
@@ -67,8 +67,9 @@ async function probeDiscord(token, timeoutMs, opts) {
|
|
|
67
67
|
error: "missing token",
|
|
68
68
|
elapsedMs: Date.now() - started
|
|
69
69
|
};
|
|
70
|
+
let res;
|
|
70
71
|
try {
|
|
71
|
-
|
|
72
|
+
res = await fetchWithTimeout(`${DISCORD_API_BASE}/users/@me`, { headers: { Authorization: `Bot ${normalized}` } }, timeoutMs, getResolvedFetch(fetcher));
|
|
72
73
|
if (!res.ok) {
|
|
73
74
|
result.status = res.status;
|
|
74
75
|
result.error = `getMe failed (${res.status})`;
|
|
@@ -95,6 +96,8 @@ async function probeDiscord(token, timeoutMs, opts) {
|
|
|
95
96
|
error: formatErrorMessage(err),
|
|
96
97
|
elapsedMs: Date.now() - started
|
|
97
98
|
};
|
|
99
|
+
} finally {
|
|
100
|
+
if (res?.bodyUsed !== true) await res?.body?.cancel().catch(() => void 0);
|
|
98
101
|
}
|
|
99
102
|
}
|
|
100
103
|
/**
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as resolveDiscordPrivilegedIntentsFromFlags, i as probeDiscord, n as fetchDiscordApplicationSummary, r as parseApplicationIdFromToken, t as fetchDiscordApplicationId } from "./probe-
|
|
1
|
+
import { a as resolveDiscordPrivilegedIntentsFromFlags, i as probeDiscord, n as fetchDiscordApplicationSummary, r as parseApplicationIdFromToken, t as fetchDiscordApplicationId } from "./probe-CxnDikWm.js";
|
|
2
2
|
export { fetchDiscordApplicationId, fetchDiscordApplicationSummary, parseApplicationIdFromToken, probeDiscord, resolveDiscordPrivilegedIntentsFromFlags };
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import { $ as BaseMessageInteractiveComponent, A as User, B as Container, D as CommandWithSubcommands, E as Command, F as Modal, J as Separator, K as Row, O as Guild, R as Button, S as RateLimitError, Wt as __exportAll, X as TextDisplay, Y as StringSelectMenu, c as discord_exports, ct as createThread, d as MessageReactionAddListener, dt as editChannel, f as MessageReactionRemoveListener, g as ThreadUpdateListener, k as Message, l as InteractionCreateListener, m as ReadyListener, mt as getChannelMessage, p as PresenceUpdateListener, s as chunkDiscordTextWithMode, u as MessageCreateListener, v as Client, y as Plugin } from "./send.receipt-
|
|
1
|
+
import { $ as BaseMessageInteractiveComponent, A as User, B as Container, D as CommandWithSubcommands, E as Command, F as Modal, J as Separator, K as Row, O as Guild, R as Button, S as RateLimitError, Wt as __exportAll, X as TextDisplay, Y as StringSelectMenu, c as discord_exports, ct as createThread, d as MessageReactionAddListener, dt as editChannel, f as MessageReactionRemoveListener, g as ThreadUpdateListener, k as Message, l as InteractionCreateListener, m as ReadyListener, mt as getChannelMessage, p as PresenceUpdateListener, s as chunkDiscordTextWithMode, u as MessageCreateListener, v as Client, y as Plugin } from "./send.receipt-De_2iEWU.js";
|
|
2
2
|
import { c as resolveDiscordAccountAllowFrom, d as resolveDiscordAccountDmPolicy, f as resolveDiscordMaxLinesPerMessage, p as normalizeDiscordToken, s as resolveDiscordAccount } from "./accounts-P19jm1lf.js";
|
|
3
|
-
import { _ as parseDiscordComponentCustomId, b as parseDiscordModalCustomIdForInteraction, v as parseDiscordComponentCustomIdForInteraction, y as parseDiscordModalCustomId } from "./components-
|
|
4
|
-
import { a as resolveDiscordComponentEntryWithPersistence, o as resolveDiscordModalEntryWithPersistence, t as editDiscordComponentMessage } from "./send.components-
|
|
3
|
+
import { _ as parseDiscordComponentCustomId, b as parseDiscordModalCustomIdForInteraction, v as parseDiscordComponentCustomIdForInteraction, y as parseDiscordModalCustomId } from "./components-CXEorOhu.js";
|
|
4
|
+
import { a as resolveDiscordComponentEntryWithPersistence, o as resolveDiscordModalEntryWithPersistence, t as editDiscordComponentMessage } from "./send.components-DxoGyTkn.js";
|
|
5
5
|
import { c as setPresence, i as unregisterGateway, r as registerGateway } from "./gateway-registry-DPxmW0Db.js";
|
|
6
|
-
import { B as DISCORD_REST_TIMEOUT_MS, D as canViewDiscordGuildChannel, H as withValidatedDiscordProxy, I as createDiscordRestClient, V as validateDiscordProxyUrl } from "./send.shared-
|
|
7
|
-
import { a as summarizeDiscordResponseBody, i as isDiscordRateLimitResponseBody } from "./api-
|
|
6
|
+
import { B as DISCORD_REST_TIMEOUT_MS, D as canViewDiscordGuildChannel, H as withValidatedDiscordProxy, I as createDiscordRestClient, V as validateDiscordProxyUrl } from "./send.shared-gtgBGDuV.js";
|
|
7
|
+
import { a as summarizeDiscordResponseBody, i as isDiscordRateLimitResponseBody } from "./api-4GFMoWu0.js";
|
|
8
8
|
import { S as resolveTimestampMs, _ as resolveGroupDmAllow, a as normalizeDiscordSlug, b as formatDiscordUserTag, c as resolveDiscordChannelConfigWithFallback, d as resolveDiscordGuildEntry, f as resolveDiscordMemberAccessState, h as resolveDiscordOwnerAllowFrom, i as normalizeDiscordDisplaySlug, l as resolveDiscordChannelPolicyCommandAuthorizer, m as resolveDiscordOwnerAccess, n as isDiscordGroupAllowedByPolicy, o as resolveDiscordAllowListMatch, p as resolveDiscordMemberAllowed, r as normalizeDiscordAllowList, v as shouldEmitDiscordReactionNotification, y as formatDiscordReactionEmoji } from "./allow-list-C-MqM-B_.js";
|
|
9
|
-
import { s as sendVoiceMessageDiscord } from "./send-
|
|
10
|
-
import { o as formatMention, t as sendMessageDiscord } from "./send.outbound-
|
|
9
|
+
import { s as sendVoiceMessageDiscord } from "./send-CIhsDMqs.js";
|
|
10
|
+
import { o as formatMention, t as sendMessageDiscord } from "./send.outbound-DaUyYuZa.js";
|
|
11
11
|
import { t as getDiscordRuntime } from "./runtime-DgnVQ7zW.js";
|
|
12
|
-
import { a as getDiscordExecApprovalApprovers, s as isDiscordExecApprovalClientEnabled, t as resolveDiscordConversationIdentity } from "./conversation-identity-
|
|
13
|
-
import { t as resolveDiscordChannelAllowlist } from "./resolve-channels-Rautpk8n.js";
|
|
14
|
-
import { t as resolveDiscordUserAllowlist } from "./resolve-users-Bw7vvtsi.js";
|
|
15
|
-
import { _ as formatThreadBindingDurationLabel, a as isThreadArchived, d as resolveDiscordChannelNameSafe, f as resolveDiscordChannelParentIdSafe, l as resolveDiscordChannelIdSafe, m as resolveDiscordChannelTopicSafe, p as resolveDiscordChannelParentSafe, u as resolveDiscordChannelInfoSafe } from "./thread-bindings.discord-api-304M1PMr.js";
|
|
16
|
-
import { r as parseApplicationIdFromToken, t as fetchDiscordApplicationId } from "./probe-2MdGjUAf.js";
|
|
12
|
+
import { a as getDiscordExecApprovalApprovers, s as isDiscordExecApprovalClientEnabled, t as resolveDiscordConversationIdentity } from "./conversation-identity-BvlP-djn.js";
|
|
17
13
|
import { d as withAbortTimeout, l as raceWithTimeout } from "./timeouts-C5TBc_9x.js";
|
|
18
|
-
import {
|
|
14
|
+
import { t as resolveDiscordChannelAllowlist } from "./resolve-channels-DpM2v0Am.js";
|
|
15
|
+
import { t as resolveDiscordUserAllowlist } from "./resolve-users-Dl6np4pH.js";
|
|
16
|
+
import { _ as formatThreadBindingDurationLabel, a as isThreadArchived, d as resolveDiscordChannelNameSafe, f as resolveDiscordChannelParentIdSafe, l as resolveDiscordChannelIdSafe, m as resolveDiscordChannelTopicSafe, p as resolveDiscordChannelParentSafe, u as resolveDiscordChannelInfoSafe } from "./thread-bindings.discord-api-C7STOVXm.js";
|
|
17
|
+
import { r as parseApplicationIdFromToken, t as fetchDiscordApplicationId } from "./probe-CxnDikWm.js";
|
|
18
|
+
import { d as resolveDiscordMessageChannelId, n as resolveDiscordForwardedMessagesTextFromSnapshots, t as resolveDiscordEmbedText, u as resolveDiscordChannelInfo } from "./message-utils-ConlUKCU.js";
|
|
19
19
|
import { t as resolveDiscordSenderIdentity } from "./sender-identity-CEsfDF0L.js";
|
|
20
|
-
import "./approval-handler.runtime-
|
|
20
|
+
import "./approval-handler.runtime-20qhf0uH.js";
|
|
21
21
|
import { normalizeAccountId } from "openclaw/plugin-sdk/account-id";
|
|
22
22
|
import { normalizeLowercaseStringOrEmpty, normalizeOptionalLowercaseString, normalizeOptionalString, normalizeOptionalStringifiedId, normalizeStringEntries, normalizeStringEntriesLower, summarizeStringEntries } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
23
23
|
import { buildAgentSessionKey, deriveLastRoutePolicy, isAcpSessionKey, isSubagentSessionKey, parseAgentSessionKey, resolveAgentIdFromSessionKey, resolveAgentRoute } from "openclaw/plugin-sdk/routing";
|
|
24
|
-
import { getRuntimeConfig } from "openclaw/plugin-sdk/runtime-config-snapshot";
|
|
24
|
+
import { getRuntimeConfig, getRuntimeConfigSnapshot } from "openclaw/plugin-sdk/runtime-config-snapshot";
|
|
25
25
|
import { ApplicationCommandOptionType, ButtonStyle, ChannelType, ComponentType, GatewayCloseCodes, GatewayCloseCodes as GatewayCloseCodes$1, GatewayDispatchEvents, GatewayIntentBits, GatewayOpcodes } from "discord-api-types/v10";
|
|
26
26
|
import { MAX_DATE_TIMESTAMP_MS, asDateTimestampMs, parseFiniteNumber, parseStrictFiniteNumber, parseStrictInteger, parseStrictNonNegativeInteger, parseStrictPositiveInteger, resolveDateTimestampMs, resolveTimestampMsToIsoString } from "openclaw/plugin-sdk/number-runtime";
|
|
27
27
|
import { createHash, randomUUID } from "node:crypto";
|
|
@@ -46,7 +46,7 @@ import { createChannelPairingChallengeIssuer } from "openclaw/plugin-sdk/channel
|
|
|
46
46
|
import { CHANNEL_APPROVAL_NATIVE_RUNTIME_CONTEXT_CAPABILITY } from "openclaw/plugin-sdk/approval-handler-adapter-runtime";
|
|
47
47
|
import { addAllowlistUserEntriesFromConfigEntry, buildAllowlistResolutionSummary, canonicalizeAllowlistWithResolvedIds, patchAllowlistUsersInConfigEntries, summarizeMapping } from "openclaw/plugin-sdk/allow-from";
|
|
48
48
|
import { buildPairingReply, upsertChannelPairingRequest, upsertChannelPairingRequest as upsertChannelPairingRequest$1 } from "openclaw/plugin-sdk/conversation-runtime";
|
|
49
|
-
import { clearExpiredCooldowns, ensureAuthProfileStore, isProfileInCooldown, resolveAgentAvatar, resolveDefaultModelForAgent, resolveHumanDelayConfig, resolveProfilesUnavailableReason } from "openclaw/plugin-sdk/agent-runtime";
|
|
49
|
+
import { clearExpiredCooldowns, ensureAuthProfileStore, formatReasoningMessage, isProfileInCooldown, resolveAgentAvatar, resolveDefaultModelForAgent, resolveHumanDelayConfig, resolveProfilesUnavailableReason } from "openclaw/plugin-sdk/agent-runtime";
|
|
50
50
|
import { truncateUtf16Safe, withTimeout } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
51
51
|
import { isDangerousNameMatchingEnabled } from "openclaw/plugin-sdk/dangerous-name-runtime";
|
|
52
52
|
import { resolveNativeCommandsEnabled, resolveNativeSkillsEnabled } from "openclaw/plugin-sdk/native-command-config-runtime";
|
|
@@ -56,7 +56,7 @@ import { createChannelIngressResolver, defineStableChannelIngressIdentity, readC
|
|
|
56
56
|
import { applyModelOverrideToSessionEntry, resolveChannelModelOverride } from "openclaw/plugin-sdk/model-session-runtime";
|
|
57
57
|
import { completeWithPreparedSimpleCompletionModel, extractAssistantText, prepareSimpleCompletionModelForAgent } from "openclaw/plugin-sdk/simple-completion-runtime";
|
|
58
58
|
import { createReplyReferencePlanner } from "openclaw/plugin-sdk/reply-reference";
|
|
59
|
-
import { getSessionEntry, loadSessionStore, readSessionUpdatedAt as readSessionUpdatedAt$1, resolveStorePath, resolveStorePath as resolveStorePath$1
|
|
59
|
+
import { getSessionEntry, listSessionEntries, loadSessionStore, patchSessionEntry, readSessionUpdatedAt as readSessionUpdatedAt$1, resolveStorePath, resolveStorePath as resolveStorePath$1 } from "openclaw/plugin-sdk/session-store-runtime";
|
|
60
60
|
import { formatInboundEnvelope, resolveEnvelopeFormatOptions, runChannelInboundEvent } from "openclaw/plugin-sdk/channel-inbound";
|
|
61
61
|
import { buildCommandTextFromArgs, findCommandByNativeName, formatCommandArgMenuTitle, listChatCommands, listNativeCommandSpecsForConfig, listSkillCommandsForAgents, resolveCommandAuthorizedFromAuthorizers, resolveNativeCommandSessionTargets, resolveStoredModelOverride, serializeCommandArgs } from "openclaw/plugin-sdk/command-auth-native";
|
|
62
62
|
import { buildCommandTextFromArgs as buildCommandTextFromArgs$1, findCommandByNativeName as findCommandByNativeName$1, parseCommandArgs, resolveCommandArgChoices, resolveCommandArgMenu, serializeCommandArgs as serializeCommandArgs$1 } from "openclaw/plugin-sdk/native-command-registry";
|
|
@@ -660,6 +660,17 @@ async function maybeCreateDiscordAutoThread(params) {
|
|
|
660
660
|
const messageChannelId = resolveTrimmedDiscordMessageChannelId(params);
|
|
661
661
|
if (!messageChannelId) return;
|
|
662
662
|
try {
|
|
663
|
+
try {
|
|
664
|
+
const existingThreadId = (await getChannelMessage(params.client.rest, messageChannelId, params.message.id))?.thread?.id;
|
|
665
|
+
if (existingThreadId) {
|
|
666
|
+
logVerbose(`discord: autoThread reusing existing thread ${existingThreadId} on ${messageChannelId}/${params.message.id}`);
|
|
667
|
+
return existingThreadId;
|
|
668
|
+
}
|
|
669
|
+
} catch {}
|
|
670
|
+
if (params.message.author?.bot) {
|
|
671
|
+
logVerbose(`discord: autoThread skipped for bot-authored message ${messageChannelId}/${params.message.id}`);
|
|
672
|
+
return;
|
|
673
|
+
}
|
|
663
674
|
const rawThreadSource = params.baseText || params.combinedBody || "Thread";
|
|
664
675
|
const threadName = sanitizeDiscordThreadName(rawThreadSource, params.message.id);
|
|
665
676
|
const archiveDuration = params.channelConfig?.autoArchiveDuration ? Number(params.channelConfig.autoArchiveDuration) : 60;
|
|
@@ -1210,15 +1221,25 @@ async function closeDiscordThreadSessions(params) {
|
|
|
1210
1221
|
}
|
|
1211
1222
|
const storePath = resolveStorePath(cfg.session?.store, { agentId: accountId });
|
|
1212
1223
|
let resetCount = 0;
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1224
|
+
for (const { sessionKey, entry } of listSessionEntries({ storePath })) {
|
|
1225
|
+
if (!sessionKeyContainsThreadId(sessionKey) || entry.updatedAt === 0) continue;
|
|
1226
|
+
let resetEntry = false;
|
|
1227
|
+
await patchSessionEntry({
|
|
1228
|
+
storePath,
|
|
1229
|
+
sessionKey,
|
|
1230
|
+
replaceEntry: true,
|
|
1231
|
+
update: (current) => {
|
|
1232
|
+
if (current.updatedAt === 0) return null;
|
|
1233
|
+
if (current.updatedAt !== entry.updatedAt || current.sessionId !== entry.sessionId) return null;
|
|
1234
|
+
resetEntry = true;
|
|
1235
|
+
return {
|
|
1236
|
+
...current,
|
|
1237
|
+
updatedAt: 0
|
|
1238
|
+
};
|
|
1239
|
+
}
|
|
1240
|
+
});
|
|
1241
|
+
if (resetEntry) resetCount += 1;
|
|
1242
|
+
}
|
|
1222
1243
|
return resetCount;
|
|
1223
1244
|
}
|
|
1224
1245
|
//#endregion
|
|
@@ -3297,32 +3318,37 @@ function toDiscordModelPickerMessagePayload(view) {
|
|
|
3297
3318
|
async function persistDiscordModelPickerOverride(params) {
|
|
3298
3319
|
const storePath = resolveStorePath(params.cfg.session?.store, { agentId: params.route.agentId });
|
|
3299
3320
|
let persisted = false;
|
|
3300
|
-
await
|
|
3301
|
-
|
|
3321
|
+
await patchSessionEntry({
|
|
3322
|
+
storePath,
|
|
3323
|
+
sessionKey: params.route.sessionKey,
|
|
3324
|
+
fallbackEntry: {
|
|
3302
3325
|
sessionId: randomUUID(),
|
|
3303
3326
|
updatedAt: Date.now()
|
|
3304
|
-
}
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
if (
|
|
3318
|
-
entry.agentRuntimeOverride
|
|
3327
|
+
},
|
|
3328
|
+
replaceEntry: true,
|
|
3329
|
+
update: (entry) => {
|
|
3330
|
+
persisted = applyModelOverrideToSessionEntry({
|
|
3331
|
+
entry,
|
|
3332
|
+
selection: {
|
|
3333
|
+
provider: params.provider,
|
|
3334
|
+
model: params.model,
|
|
3335
|
+
isDefault: params.isDefault
|
|
3336
|
+
},
|
|
3337
|
+
markLiveSwitchPending: true
|
|
3338
|
+
}).updated || persisted;
|
|
3339
|
+
const runtime = params.runtime?.trim();
|
|
3340
|
+
if (runtime && runtime !== "auto" && runtime !== "default") {
|
|
3341
|
+
if (entry.agentRuntimeOverride !== runtime) {
|
|
3342
|
+
entry.agentRuntimeOverride = runtime;
|
|
3343
|
+
delete entry.agentHarnessId;
|
|
3344
|
+
persisted = true;
|
|
3345
|
+
}
|
|
3346
|
+
} else if (runtime && entry.agentRuntimeOverride) {
|
|
3347
|
+
delete entry.agentRuntimeOverride;
|
|
3319
3348
|
delete entry.agentHarnessId;
|
|
3320
3349
|
persisted = true;
|
|
3321
3350
|
}
|
|
3322
|
-
|
|
3323
|
-
delete entry.agentRuntimeOverride;
|
|
3324
|
-
delete entry.agentHarnessId;
|
|
3325
|
-
persisted = true;
|
|
3351
|
+
return entry;
|
|
3326
3352
|
}
|
|
3327
3353
|
});
|
|
3328
3354
|
return persisted;
|
|
@@ -4146,7 +4172,7 @@ function resolveDiscordCommandLogLabel(command) {
|
|
|
4146
4172
|
return command.key;
|
|
4147
4173
|
}
|
|
4148
4174
|
function buildDiscordCommandOptions(params) {
|
|
4149
|
-
const { command, cfg, authorizeChoiceContext, resolveChoiceContext } = params;
|
|
4175
|
+
const { command, cfg, resolveConfig, authorizeChoiceContext, resolveChoiceContext } = params;
|
|
4150
4176
|
const commandLabel = resolveDiscordCommandLogLabel(command);
|
|
4151
4177
|
const args = command.args;
|
|
4152
4178
|
if (!args || args.length === 0) return;
|
|
@@ -4185,7 +4211,7 @@ function buildDiscordCommandOptions(params) {
|
|
|
4185
4211
|
const choices = resolveCommandArgChoices({
|
|
4186
4212
|
command,
|
|
4187
4213
|
arg,
|
|
4188
|
-
cfg,
|
|
4214
|
+
cfg: resolveConfig?.() ?? cfg,
|
|
4189
4215
|
provider: context?.provider,
|
|
4190
4216
|
model: context?.model
|
|
4191
4217
|
});
|
|
@@ -4221,19 +4247,21 @@ function createDiscordNativeCommand(params) {
|
|
|
4221
4247
|
const pluginCommandMatch = nativeCommandRuntime.matchPluginCommand(`/${command.name}`);
|
|
4222
4248
|
const commandDefinition = pluginCommandMatch !== null ? fallbackCommandDefinition : findCommandByNativeName$1(command.name, "discord", { includeBundledChannelFallback: false }) ?? fallbackCommandDefinition;
|
|
4223
4249
|
const argDefinitions = commandDefinition.args ?? command.args;
|
|
4250
|
+
const resolveCurrentConfig = () => getRuntimeConfigSnapshot() ?? cfg;
|
|
4224
4251
|
const commandOptions = buildDiscordCommandOptions({
|
|
4225
4252
|
command: commandDefinition,
|
|
4226
4253
|
cfg,
|
|
4254
|
+
resolveConfig: resolveCurrentConfig,
|
|
4227
4255
|
authorizeChoiceContext: async (interaction) => await resolveDiscordNativeAutocompleteAuthorized({
|
|
4228
4256
|
interaction,
|
|
4229
|
-
cfg,
|
|
4257
|
+
cfg: resolveCurrentConfig(),
|
|
4230
4258
|
discordConfig,
|
|
4231
4259
|
accountId,
|
|
4232
4260
|
skipCommandOwnerAllowFrom: pluginCommandMatch !== null
|
|
4233
4261
|
}),
|
|
4234
4262
|
resolveChoiceContext: async (interaction) => resolveDiscordNativeChoiceContext({
|
|
4235
4263
|
interaction,
|
|
4236
|
-
cfg,
|
|
4264
|
+
cfg: resolveCurrentConfig(),
|
|
4237
4265
|
accountId,
|
|
4238
4266
|
threadBindings
|
|
4239
4267
|
})
|
|
@@ -4284,7 +4312,8 @@ function createDiscordNativeCommand(params) {
|
|
|
4284
4312
|
}();
|
|
4285
4313
|
}
|
|
4286
4314
|
async function dispatchDiscordCommandInteraction(params) {
|
|
4287
|
-
const { interaction, prompt, command, commandArgs, cfg, discordConfig, accountId, sessionPrefix, preferFollowUp, threadBindings, responseEphemeral, suppressReplies } = params;
|
|
4315
|
+
const { interaction, prompt, command, commandArgs, cfg: inputConfig, discordConfig, accountId, sessionPrefix, preferFollowUp, threadBindings, responseEphemeral, suppressReplies } = params;
|
|
4316
|
+
const cfg = getRuntimeConfigSnapshot() ?? inputConfig;
|
|
4288
4317
|
const commandName = command.nativeName ?? command.key;
|
|
4289
4318
|
const respond = async (content, options) => {
|
|
4290
4319
|
const ephemeral = options?.ephemeral ?? responseEphemeral;
|
|
@@ -5265,16 +5294,6 @@ var GatewayPlugin = class extends Plugin {
|
|
|
5265
5294
|
getRateLimitStatus() {
|
|
5266
5295
|
return this.outboundLimiter.getStatus();
|
|
5267
5296
|
}
|
|
5268
|
-
getIntentsInfo() {
|
|
5269
|
-
return {
|
|
5270
|
-
intents: this.options.intents ?? 0,
|
|
5271
|
-
hasGuilds: this.hasIntent(GatewayIntentBits.Guilds),
|
|
5272
|
-
hasGuildMembers: this.hasIntent(GatewayIntentBits.GuildMembers),
|
|
5273
|
-
hasGuildPresences: this.hasIntent(GatewayIntentBits.GuildPresences),
|
|
5274
|
-
hasGuildMessages: this.hasIntent(GatewayIntentBits.GuildMessages),
|
|
5275
|
-
hasMessageContent: this.hasIntent(GatewayIntentBits.MessageContent)
|
|
5276
|
-
};
|
|
5277
|
-
}
|
|
5278
5297
|
hasIntent(intent) {
|
|
5279
5298
|
return Boolean((this.options.intents ?? 0) & intent);
|
|
5280
5299
|
}
|
|
@@ -7876,10 +7895,20 @@ function resolveDiscordDeliveryOptions(params) {
|
|
|
7876
7895
|
}
|
|
7877
7896
|
};
|
|
7878
7897
|
}
|
|
7898
|
+
function formatDiscordReasoningPayload(payload) {
|
|
7899
|
+
if (payload.isReasoning !== true) return payload;
|
|
7900
|
+
const text = typeof payload.text === "string" ? payload.text.trim() : "";
|
|
7901
|
+
const nextPayload = {
|
|
7902
|
+
...payload,
|
|
7903
|
+
text: formatReasoningMessage(text)
|
|
7904
|
+
};
|
|
7905
|
+
delete nextPayload.isReasoning;
|
|
7906
|
+
return nextPayload;
|
|
7907
|
+
}
|
|
7879
7908
|
async function deliverDiscordReply(params) {
|
|
7880
7909
|
params.runtime;
|
|
7881
7910
|
const delivery = resolveDiscordDeliveryOptions(params);
|
|
7882
|
-
const payloads = sanitizeDiscordFrontChannelReplyPayloads(params.replies, { kind: params.kind });
|
|
7911
|
+
const payloads = sanitizeDiscordFrontChannelReplyPayloads(params.replies, { kind: params.kind }).map(formatDiscordReasoningPayload);
|
|
7883
7912
|
if (payloads.length === 0) return;
|
|
7884
7913
|
const send = await sendDurableMessageBatch({
|
|
7885
7914
|
cfg: params.cfg,
|
|
@@ -7917,7 +7946,7 @@ async function loadConversationRuntime$1() {
|
|
|
7917
7946
|
return await conversationRuntimePromise$1;
|
|
7918
7947
|
}
|
|
7919
7948
|
async function loadTypingRuntime() {
|
|
7920
|
-
typingRuntimePromise ??= import("./typing-
|
|
7949
|
+
typingRuntimePromise ??= import("./typing-CxIYS3vQ.js").then((n) => n.n);
|
|
7921
7950
|
return await typingRuntimePromise;
|
|
7922
7951
|
}
|
|
7923
7952
|
function buildDiscordComponentConversationLabel(params) {
|
|
@@ -8338,7 +8367,7 @@ async function dispatchPluginDiscordInteractiveEvent(params) {
|
|
|
8338
8367
|
//#region extensions/discord/src/monitor/agent-components.handlers.ts
|
|
8339
8368
|
let componentsRuntimePromise;
|
|
8340
8369
|
async function loadComponentsRuntime() {
|
|
8341
|
-
componentsRuntimePromise ??= import("./components-
|
|
8370
|
+
componentsRuntimePromise ??= import("./components-CXEorOhu.js").then((n) => n.t);
|
|
8342
8371
|
return await componentsRuntimePromise;
|
|
8343
8372
|
}
|
|
8344
8373
|
async function handleDiscordComponentEvent(params) {
|
|
@@ -9556,7 +9585,7 @@ async function runDiscordGatewayLifecycle(params) {
|
|
|
9556
9585
|
gatewayEmitter?.removeListener(DISCORD_GATEWAY_TRANSPORT_ACTIVITY_EVENT, onGatewayTransportActivity);
|
|
9557
9586
|
if (params.voiceManager) {
|
|
9558
9587
|
await params.voiceManager.destroy();
|
|
9559
|
-
const { setDiscordTranscriptsVoiceManager } = await import("./transcripts-source-
|
|
9588
|
+
const { setDiscordTranscriptsVoiceManager } = await import("./transcripts-source-39NBdNeE.js").then((n) => n.n);
|
|
9560
9589
|
setDiscordTranscriptsVoiceManager({
|
|
9561
9590
|
accountId: params.accountId,
|
|
9562
9591
|
manager: null
|
|
@@ -9834,7 +9863,7 @@ function logDiscordStartupPhase(params) {
|
|
|
9834
9863
|
});
|
|
9835
9864
|
}
|
|
9836
9865
|
async function loadDiscordVoiceRuntime() {
|
|
9837
|
-
const promise = discordVoiceRuntimePromise ?? import("./manager.runtime-
|
|
9866
|
+
const promise = discordVoiceRuntimePromise ?? import("./manager.runtime-Bh5X0o8P.js");
|
|
9838
9867
|
discordVoiceRuntimePromise = promise;
|
|
9839
9868
|
try {
|
|
9840
9869
|
return await promise;
|
|
@@ -9844,7 +9873,7 @@ async function loadDiscordVoiceRuntime() {
|
|
|
9844
9873
|
}
|
|
9845
9874
|
}
|
|
9846
9875
|
async function loadDiscordProviderSessionRuntime() {
|
|
9847
|
-
const promise = discordProviderSessionRuntimePromise ?? import("./provider-session.runtime-
|
|
9876
|
+
const promise = discordProviderSessionRuntimePromise ?? import("./provider-session.runtime-ChdHgGCo.js");
|
|
9848
9877
|
discordProviderSessionRuntimePromise = promise;
|
|
9849
9878
|
try {
|
|
9850
9879
|
return await promise;
|
|
@@ -10114,7 +10143,7 @@ async function monitorDiscordProvider(opts = {}) {
|
|
|
10114
10143
|
runtime,
|
|
10115
10144
|
botUserId
|
|
10116
10145
|
});
|
|
10117
|
-
const { setDiscordTranscriptsVoiceManager } = await import("./transcripts-source-
|
|
10146
|
+
const { setDiscordTranscriptsVoiceManager } = await import("./transcripts-source-39NBdNeE.js").then((n) => n.n);
|
|
10118
10147
|
setDiscordTranscriptsVoiceManager({
|
|
10119
10148
|
accountId: account.accountId,
|
|
10120
10149
|
manager: voiceManager
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a as reconcileAcpThreadBindingsOnStartup } from "./thread-bindings-
|
|
2
|
-
import { n as createThreadBindingManager, t as createNoopThreadBindingManager } from "./thread-bindings.manager-
|
|
3
|
-
import { t as createDiscordMessageHandler } from "./message-handler-
|
|
1
|
+
import { a as reconcileAcpThreadBindingsOnStartup } from "./thread-bindings-D2SBj6F8.js";
|
|
2
|
+
import { n as createThreadBindingManager, t as createNoopThreadBindingManager } from "./thread-bindings.manager-CN4MIGoJ.js";
|
|
3
|
+
import { t as createDiscordMessageHandler } from "./message-handler-Dg3DRD0e.js";
|
|
4
4
|
import { resolveThreadBindingIdleTimeoutMs, resolveThreadBindingMaxAgeMs, resolveThreadBindingsEnabled } from "openclaw/plugin-sdk/conversation-runtime";
|
|
5
5
|
import { getAcpSessionManager, isAcpRuntimeError } from "openclaw/plugin-sdk/acp-runtime";
|
|
6
6
|
export { createDiscordMessageHandler, createNoopThreadBindingManager, createThreadBindingManager, getAcpSessionManager, isAcpRuntimeError, reconcileAcpThreadBindingsOnStartup, resolveThreadBindingIdleTimeoutMs, resolveThreadBindingMaxAgeMs, resolveThreadBindingsEnabled };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { p as normalizeDiscordToken } from "./accounts-P19jm1lf.js";
|
|
2
|
-
import { n as fetchDiscord } from "./api-
|
|
2
|
+
import { n as fetchDiscord } from "./api-4GFMoWu0.js";
|
|
3
3
|
import { a as normalizeDiscordSlug } from "./allow-list-C-MqM-B_.js";
|
|
4
4
|
//#region extensions/discord/src/guilds.ts
|
|
5
5
|
async function listGuilds(token, fetcher) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Wt as __exportAll } from "./send.receipt-
|
|
2
|
-
import { n as fetchDiscord, t as DiscordApiError } from "./api-
|
|
1
|
+
import { Wt as __exportAll } from "./send.receipt-De_2iEWU.js";
|
|
2
|
+
import { n as fetchDiscord, t as DiscordApiError } from "./api-4GFMoWu0.js";
|
|
3
3
|
import { a as normalizeDiscordSlug } from "./allow-list-C-MqM-B_.js";
|
|
4
|
-
import { i as listGuilds, n as filterDiscordGuilds, r as resolveDiscordAllowlistToken, t as buildDiscordUnresolvedResults } from "./resolve-allowlist-common-
|
|
4
|
+
import { i as listGuilds, n as filterDiscordGuilds, r as resolveDiscordAllowlistToken, t as buildDiscordUnresolvedResults } from "./resolve-allowlist-common-BDpBb8dF.js";
|
|
5
5
|
//#region extensions/discord/src/resolve-channels.ts
|
|
6
6
|
var resolve_channels_exports = /* @__PURE__ */ __exportAll({ resolveDiscordChannelAllowlist: () => resolveDiscordChannelAllowlist });
|
|
7
7
|
function parseDiscordChannelInput(raw) {
|