@openclaw/discord 2026.7.1-beta.6 → 2026.7.2-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/action-runtime-api.js +1 -1
- package/dist/{allow-list-C-MqM-B_.js → allow-list-B7qOH5xu.js} +22 -1
- package/dist/{api-DPRqYi4Z.js → api--f62GFaS.js} +38 -23
- package/dist/api.js +15 -15
- package/dist/approval-custom-id-NYPYj9Po.js +58 -0
- package/dist/{approval-handler.runtime-Bw2pZNk1.js → approval-handler.runtime-DeyIiw5I.js} +28 -23
- package/dist/approval-message-safety-C-8BL6Kv.js +47 -0
- package/dist/{audit-MLpDpN3Z.js → audit-Df2w046a.js} +3 -3
- package/dist/{channel-actions-D_fjVUZ_.js → channel-actions-ChpBSRcu.js} +6 -4
- package/dist/{channel-actions.runtime-CVHlFqQg.js → channel-actions.runtime-D8V8tyCq.js} +41 -12
- package/dist/channel-config-api.js +1 -1
- package/dist/{channel-DGWPH5u3.js → channel-nYmJ7FKQ.js} +275 -62
- package/dist/channel-plugin-api.js +1 -1
- package/dist/{channel.setup-tZcpIn4e.js → channel.setup-DyihrqHH.js} +3 -3
- package/dist/{components-BIBizbtZ.js → components-BVrfRS-F.js} +78 -52
- package/dist/config-api-B18fR8M5.js +3 -0
- package/dist/{config-schema-BgIhO3ko.js → config-schema-_bUKcWRm.js} +42 -82
- package/dist/conversation-identity-BpkAzklg.js +94 -0
- package/dist/{directory-config-ByaUKL1f.js → directory-config-BUe-qq_C.js} +1 -1
- package/dist/directory-contract-api.js +1 -1
- package/dist/{directory-live-BX79ImQA.js → directory-live-DZByMdPO.js} +6 -6
- package/dist/{doctor-Bgoxm5AN.js → doctor-bMaWXFKu.js} +5 -4
- package/dist/doctor-contract-api.js +1 -1
- package/dist/{doctor-contract-CU7lnZTF.js → doctor-contract-wId6pV41.js} +41 -37
- package/dist/{handle-action.guild-admin-CgJSNVui.js → handle-action.guild-admin-C_PQcBEV.js} +12 -12
- package/dist/index.js +1 -1
- package/dist/legacy-state-migrations-api.js +24 -2
- package/dist/{manager.runtime-DaB-CTrt.js → manager.runtime-3RVMVkyx.js} +546 -154
- package/dist/{message-handler-DcgvugZt.js → message-handler-CIxWq5Yh.js} +8 -9
- package/dist/{message-handler.preflight-DvLXiYVH.js → message-handler.preflight-BI86IbHz.js} +46 -22
- package/dist/{message-handler.process-Cjf30P_B.js → message-handler.process-bPS_9_tb.js} +241 -107
- package/dist/{message-utils-B_3yA5bN.js → message-utils-D4j07taS.js} +2 -3
- package/dist/{outbound-adapter-82RWi_SR.js → outbound-adapter-Czny0Fae.js} +16 -68
- package/dist/outbound-components-oJKLj62G.js +99 -0
- package/dist/pluralkit-UXq1OyUI.js +40 -0
- package/dist/{probe-D1ImJEo2.js → probe-DxjMBeVG.js} +1 -1
- package/dist/{probe.runtime-B1dsEeBD.js → probe.runtime-Bc8Oo6e8.js} +1 -1
- package/dist/{provider-BkfbC9FQ.js → provider-DWvDNb4J.js} +702 -236
- package/dist/{provider-session.runtime-BDjyFw6Y.js → provider-session.runtime-D5pCGibh.js} +3 -3
- package/dist/provider.runtime-C2iIfbTs.js +2 -0
- package/dist/{resolve-allowlist-common-CWbE8XlH.js → resolve-allowlist-common-B9S8LLBd.js} +5 -5
- package/dist/{resolve-channels-CcpvWoRa.js → resolve-channels-BrkWOKdG.js} +7 -7
- package/dist/{resolve-users-DJamun9s.js → resolve-users-OjrXXvJP.js} +5 -5
- package/dist/{runtime-C6rRmQ6l.js → runtime-C618lis9.js} +223 -33
- package/dist/runtime-api.actions.js +2 -2
- package/dist/runtime-api.js +23 -23
- package/dist/runtime-api.lookup.js +5 -5
- package/dist/runtime-api.monitor-DSbfGnzS.js +6 -0
- package/dist/runtime-api.monitor.js +7 -7
- package/dist/runtime-api.send.js +5 -5
- package/dist/runtime-api.threads.js +5 -5
- package/dist/{send-iJ0B4bAX.js → send-BFpa_DHn.js} +21 -12
- package/dist/{send.components-D0I39utR.js → send.components-BaXQJKWT.js} +15 -10
- package/dist/{send.outbound-Bj61Q3a0.js → send.outbound-BlA6VzSE.js} +22 -12
- package/dist/{send.receipt-BpBQED_5.js → send.receipt-aegk69an.js} +59 -75
- package/dist/{send.shared-wAwMhHDN.js → send.shared-Xz7IMVpu.js} +44 -20
- package/dist/{sender-identity-CEsfDF0L.js → sender-identity-C62lBe18.js} +1 -1
- package/dist/session-binding-contract-api.js +1 -1
- package/dist/setup-plugin-api.js +1 -1
- package/dist/{shared-BQVKfnev.js → shared-BLYBt5SA.js} +3 -3
- package/dist/{subagent-hooks-B-bJxxGg.js → subagent-hooks-DKJ4p-Oy.js} +2 -2
- package/dist/subagent-hooks-api.js +1 -1
- package/dist/{system-events-DVnqSyTt.js → system-events-DKwfE-2z.js} +2 -2
- package/dist/{target-resolver-CwHaSLt3.js → target-resolver-BQyEHyeS.js} +2 -2
- package/dist/targets-DvItNIvP.js +3 -0
- package/dist/thread-binding-api-BDZJD4na.js +4 -0
- package/dist/thread-binding-api.js +1 -3
- package/dist/{thread-bindings-DsTxqu3E.js → thread-bindings-BbzjUuNB.js} +26 -43
- package/dist/{thread-bindings.discord-api-BjIf9lGs.js → thread-bindings.discord-api-DJD3qwIN.js} +8 -10
- package/dist/{thread-bindings.manager-Bwmtqc3E.js → thread-bindings.manager-BIBm6bQd.js} +4 -4
- package/dist/{thread-bindings.session-updates-Chs3HgGa.js → thread-bindings.session-updates-eRcJlzIU.js} +1 -1
- package/dist/{thread-bindings.state-iSWjCYjB.js → thread-bindings.state-9VAxhVf6.js} +3 -14
- package/dist/{timeouts-C5TBc_9x.js → timeouts-ZRc9Lw4y.js} +3 -15
- package/dist/timeouts.js +1 -1
- package/dist/{transcripts-source-BvvM5Ns9.js → transcripts-source-CLZ5X8fh.js} +1 -1
- package/dist/transcripts-source-api.js +1 -1
- package/dist/{typing-BVcJgILg.js → typing-BnYT7Szq.js} +2 -2
- package/node_modules/p-map/index.d.ts +155 -0
- package/node_modules/p-map/index.js +284 -0
- package/node_modules/p-map/license +9 -0
- package/node_modules/p-map/package.json +57 -0
- package/node_modules/p-map/readme.md +190 -0
- package/npm-shrinkwrap.json +16 -3
- package/openclaw.plugin.json +70 -2
- package/package.json +6 -4
- package/dist/config-api-JiPdJeb0.js +0 -2
- package/dist/conversation-identity-DWC5d8Sy.js +0 -272
- package/dist/pluralkit-DcD-3EcL.js +0 -24
- package/dist/preview-streaming-DXT8oJdo.js +0 -8
- package/dist/provider.runtime-WrJXikSv.js +0 -2
- package/dist/runtime-api.monitor-C2_WVtJf.js +0 -6
- package/dist/targets-69w7c3vU.js +0 -3
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { D as RateLimitError, Ft as getGuild, It as getGuildMember, L as serializePayload, R as Embed, T as RequestClient, ct as createUserDmChannel, i as resolveDiscordReplyMessageId, lt as getCurrentUser, pt as createChannelMessage, u as chunkDiscordTextWithMode, yt as getChannel } from "./send.receipt-aegk69an.js";
|
|
2
2
|
import { a as mergeDiscordAccountConfig, p as normalizeDiscordToken, s as resolveDiscordAccount } from "./accounts-P19jm1lf.js";
|
|
3
|
-
import { t as parseAndResolveDiscordTarget } from "./target-resolver-
|
|
3
|
+
import { t as parseAndResolveDiscordTarget } from "./target-resolver-BQyEHyeS.js";
|
|
4
4
|
import { normalizeOptionalString, normalizeStringEntries } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
5
5
|
import { normalizeAccountId } from "openclaw/plugin-sdk/routing";
|
|
6
6
|
import { ChannelType, MessageFlags, PermissionFlagsBits } from "discord-api-types/v10";
|
|
7
7
|
import { parseStrictNonNegativeInteger } from "openclaw/plugin-sdk/number-runtime";
|
|
8
|
+
import { randomBytes } from "node:crypto";
|
|
9
|
+
import { expectDefined } from "openclaw/plugin-sdk/expect-runtime";
|
|
8
10
|
import { collectErrorGraphCandidates, extractErrorCode, formatErrorMessage, readErrorName } from "openclaw/plugin-sdk/error-runtime";
|
|
9
11
|
import { PollLayoutType } from "discord-api-types/payloads/v10";
|
|
10
12
|
import { buildOutboundMediaLoadOptions, extensionForMime, normalizePollDurationHours, normalizePollInput } from "openclaw/plugin-sdk/media-runtime";
|
|
@@ -116,6 +118,13 @@ const DISCORD_RETRYABLE_ERROR_CODES = /* @__PURE__ */ new Set([
|
|
|
116
118
|
"UND_ERR_SOCKET"
|
|
117
119
|
]);
|
|
118
120
|
const DISCORD_TRANSIENT_MESSAGE_RE = /\b(?:bad gateway|fetch failed|network error|networkerror|service unavailable|socket hang up|temporarily unavailable|timed out|timeout)\b|connection (?:closed|reset|refused)/i;
|
|
121
|
+
const DISCORD_PRECONNECT_ERROR_CODES = /* @__PURE__ */ new Set([
|
|
122
|
+
"EAI_AGAIN",
|
|
123
|
+
"ECONNREFUSED",
|
|
124
|
+
"ENETUNREACH",
|
|
125
|
+
"ENOTFOUND",
|
|
126
|
+
"UND_ERR_CONNECT_TIMEOUT"
|
|
127
|
+
]);
|
|
119
128
|
const log = createSubsystemLogger("discord/retry");
|
|
120
129
|
function readDiscordErrorStatus(err) {
|
|
121
130
|
if (!err || typeof err !== "object") return;
|
|
@@ -133,6 +142,18 @@ function isRetryableDiscordTransientError(err) {
|
|
|
133
142
|
}
|
|
134
143
|
return false;
|
|
135
144
|
}
|
|
145
|
+
function isRetryableDiscordPreConnectError(err) {
|
|
146
|
+
if (err instanceof RateLimitError) return true;
|
|
147
|
+
for (const candidate of collectErrorGraphCandidates(err, (current) => [current.cause, current.error])) {
|
|
148
|
+
if (readDiscordErrorStatus(candidate) === 429) return true;
|
|
149
|
+
const code = extractErrorCode(candidate);
|
|
150
|
+
if (code && DISCORD_PRECONNECT_ERROR_CODES.has(code.toUpperCase())) return true;
|
|
151
|
+
}
|
|
152
|
+
return false;
|
|
153
|
+
}
|
|
154
|
+
function resolveDiscordRetryPredicate(safety) {
|
|
155
|
+
return safety === "non-idempotent-create" ? isRetryableDiscordPreConnectError : isRetryableDiscordTransientError;
|
|
156
|
+
}
|
|
136
157
|
function isRetryableDiscordGatewayTransportError(err) {
|
|
137
158
|
if (!isRetryableDiscordTransientError(err) || err instanceof RateLimitError) return false;
|
|
138
159
|
return !collectErrorGraphCandidates(err, (current) => [current.cause, current.error]).some((candidate) => readDiscordErrorStatus(candidate) !== void 0);
|
|
@@ -143,7 +164,8 @@ function createDiscordRetryRunner(params) {
|
|
|
143
164
|
...params.retry
|
|
144
165
|
});
|
|
145
166
|
const attempts = retryConfig.attempts > 1 ? retryConfig.attempts + DISCORD_GATEWAY_RECONNECT_EXTRA_ATTEMPTS : retryConfig.attempts;
|
|
146
|
-
return (fn, label) => {
|
|
167
|
+
return (fn, label, options) => {
|
|
168
|
+
const isRetryable = resolveDiscordRetryPredicate(options?.safety ?? "idempotent");
|
|
147
169
|
let observedGatewayDisconnect = false;
|
|
148
170
|
const runRequest = async () => {
|
|
149
171
|
observedGatewayDisconnect ||= params.isGatewayDisconnected?.() === true;
|
|
@@ -158,7 +180,7 @@ function createDiscordRetryRunner(params) {
|
|
|
158
180
|
...retryConfig,
|
|
159
181
|
attempts,
|
|
160
182
|
label,
|
|
161
|
-
shouldRetry: (err, attempt) =>
|
|
183
|
+
shouldRetry: (err, attempt) => isRetryable(err) && (attempt < retryConfig.attempts || observedGatewayDisconnect && isRetryableDiscordGatewayTransportError(err)),
|
|
162
184
|
retryAfterMs: (err) => err instanceof RateLimitError ? err.retryAfter * 1e3 : void 0,
|
|
163
185
|
onRetry: params.verbose ? (info) => {
|
|
164
186
|
const maxAttempts = observedGatewayDisconnect ? attempts : retryConfig.attempts;
|
|
@@ -529,6 +551,9 @@ const DISCORD_MAX_EVENT_COVER_BYTES = 8 * 1024 * 1024;
|
|
|
529
551
|
//#region extensions/discord/src/send.message-request.ts
|
|
530
552
|
const SUPPRESS_EMBEDS_FLAG = MessageFlags.SuppressEmbeds;
|
|
531
553
|
const SUPPRESS_NOTIFICATIONS_FLAG = MessageFlags.SuppressNotifications;
|
|
554
|
+
function createDiscordMessageNonce() {
|
|
555
|
+
return randomBytes(12).toString("hex");
|
|
556
|
+
}
|
|
532
557
|
function resolveDiscordSendComponents(params) {
|
|
533
558
|
if (!params.components || !params.isFirst) return;
|
|
534
559
|
return typeof params.components === "function" ? params.components(params.text) : params.components;
|
|
@@ -560,12 +585,16 @@ function resolveDiscordMessageFlags(params) {
|
|
|
560
585
|
return flags || void 0;
|
|
561
586
|
}
|
|
562
587
|
function buildDiscordMessageRequest(params) {
|
|
588
|
+
const payload = buildDiscordMessagePayload(params);
|
|
589
|
+
const nonce = params.endpoint === "create-message" ? params.nonce ?? createDiscordMessageNonce() : void 0;
|
|
563
590
|
return stripUndefinedFields({
|
|
564
|
-
...serializePayload(
|
|
591
|
+
...serializePayload(payload),
|
|
565
592
|
...params.replyTo ? { message_reference: {
|
|
566
593
|
message_id: params.replyTo,
|
|
567
594
|
fail_if_not_exists: false
|
|
568
|
-
} } : {}
|
|
595
|
+
} } : {},
|
|
596
|
+
nonce,
|
|
597
|
+
enforce_nonce: nonce ? true : void 0
|
|
569
598
|
});
|
|
570
599
|
}
|
|
571
600
|
function stripUndefinedFields(value) {
|
|
@@ -687,9 +716,9 @@ async function resolveDiscordTargetChannelId(raw, opts) {
|
|
|
687
716
|
const { rest, request } = createDiscordClient(opts);
|
|
688
717
|
return await resolveChannelId(rest, recipient, request);
|
|
689
718
|
}
|
|
690
|
-
async function
|
|
719
|
+
async function resolveDiscordChannel(rest, channelId) {
|
|
691
720
|
try {
|
|
692
|
-
return
|
|
721
|
+
return await getChannel(rest, channelId);
|
|
693
722
|
} catch {
|
|
694
723
|
return;
|
|
695
724
|
}
|
|
@@ -702,12 +731,6 @@ function buildDiscordTextChunks(text, opts = {}) {
|
|
|
702
731
|
chunkMode: opts.chunkMode
|
|
703
732
|
}));
|
|
704
733
|
}
|
|
705
|
-
function toDiscordFileBlob(data) {
|
|
706
|
-
if (data instanceof Blob) return data;
|
|
707
|
-
const arrayBuffer = new ArrayBuffer(data.byteLength);
|
|
708
|
-
new Uint8Array(arrayBuffer).set(data);
|
|
709
|
-
return new Blob([arrayBuffer]);
|
|
710
|
-
}
|
|
711
734
|
async function sendDiscordText(params) {
|
|
712
735
|
const { rest, channelId, text, request, reply, maxLinesPerMessage, components, embeds, allowedMentions, chunkMode, silent, suppressEmbeds, maxChars, onResult } = params;
|
|
713
736
|
if (!text.trim()) throw new Error("Message must be non-empty for Discord sends");
|
|
@@ -732,6 +755,7 @@ async function sendDiscordText(params) {
|
|
|
732
755
|
suppressEmbeds: suppressEmbeds && !chunkEmbeds?.length
|
|
733
756
|
});
|
|
734
757
|
const body = buildDiscordMessageRequest({
|
|
758
|
+
endpoint: "create-message",
|
|
735
759
|
text: chunk,
|
|
736
760
|
components: chunkComponents,
|
|
737
761
|
embeds: chunkEmbeds,
|
|
@@ -740,12 +764,12 @@ async function sendDiscordText(params) {
|
|
|
740
764
|
replyTo: chunkReplyTo
|
|
741
765
|
});
|
|
742
766
|
return {
|
|
743
|
-
result: await request(() => createChannelMessage(rest, channelId, { body }), "text"),
|
|
767
|
+
result: await request(() => createChannelMessage(rest, channelId, { body }), "text", { safety: "nonce-protected-create" }),
|
|
744
768
|
replyToId: chunkReplyTo
|
|
745
769
|
};
|
|
746
770
|
};
|
|
747
771
|
if (chunks.length === 1) {
|
|
748
|
-
const { result, replyToId } = await sendChunk(chunks
|
|
772
|
+
const { result, replyToId } = await sendChunk(expectDefined(chunks.at(0), "single Discord text chunk"), true);
|
|
749
773
|
await onResult?.(result, "text", replyToId);
|
|
750
774
|
return {
|
|
751
775
|
...result,
|
|
@@ -781,7 +805,6 @@ async function sendDiscordMedia(params) {
|
|
|
781
805
|
maxChars
|
|
782
806
|
}) : [];
|
|
783
807
|
const caption = chunks[0] ?? "";
|
|
784
|
-
const fileData = toDiscordFileBlob(media.buffer);
|
|
785
808
|
const captionComponents = resolveDiscordSendComponents({
|
|
786
809
|
components,
|
|
787
810
|
text: caption,
|
|
@@ -792,6 +815,7 @@ async function sendDiscordMedia(params) {
|
|
|
792
815
|
isFirst: true
|
|
793
816
|
});
|
|
794
817
|
const body = buildDiscordMessageRequest({
|
|
818
|
+
endpoint: "create-message",
|
|
795
819
|
text: caption,
|
|
796
820
|
components: captionComponents,
|
|
797
821
|
embeds: captionEmbeds,
|
|
@@ -802,13 +826,13 @@ async function sendDiscordMedia(params) {
|
|
|
802
826
|
}),
|
|
803
827
|
replyTo: resolveDiscordReplyMessageId(reply, true),
|
|
804
828
|
files: [{
|
|
805
|
-
data:
|
|
829
|
+
data: media.buffer,
|
|
806
830
|
name: resolvedFileName
|
|
807
831
|
}]
|
|
808
832
|
});
|
|
809
833
|
let res;
|
|
810
834
|
try {
|
|
811
|
-
res = await request(() => createChannelMessage(rest, channelId, { body }), "media");
|
|
835
|
+
res = await request(() => createChannelMessage(rest, channelId, { body }), "media", { safety: "nonce-protected-create" });
|
|
812
836
|
} catch (err) {
|
|
813
837
|
if (!isDiscordUploadTooLargeError(err)) throw err;
|
|
814
838
|
return sendDiscordText({
|
|
@@ -860,4 +884,4 @@ function formatReactionEmoji(emoji) {
|
|
|
860
884
|
return buildReactionIdentifier(emoji);
|
|
861
885
|
}
|
|
862
886
|
//#endregion
|
|
863
|
-
export { hasAllGuildPermissionsDiscord as A, DISCORD_REST_TIMEOUT_MS as B, DISCORD_MAX_STICKER_BYTES as C, canViewDiscordGuildChannel as D, canManageGuildRoleDiscord as E, createDiscordClient as F, registerGateway as G, withValidatedDiscordProxy as H, createDiscordRestClient as I, unregisterGateway as K, createDiscordRuntimeAccountContext as L, hasAnyGuildPermissionDiscord as M, isThreadChannelType as N, fetchChannelPermissionsDiscord as O, parseAndResolveChannelRecipient as P, resolveDiscordClientAccountContext as R, DISCORD_MAX_EVENT_COVER_BYTES as S, canManageGuildMemberRoleDiscord as T, clearGateways as U, validateDiscordProxyUrl as V, getGateway as W, resolveDiscordMessageFlags as _, normalizeDiscordPollInput as a, stripUndefinedFields as b, normalizeStickerIds as c, resolveDiscordTargetChannelId as d, sendDiscordMedia as f,
|
|
887
|
+
export { hasAllGuildPermissionsDiscord as A, DISCORD_REST_TIMEOUT_MS as B, DISCORD_MAX_STICKER_BYTES as C, canViewDiscordGuildChannel as D, canManageGuildRoleDiscord as E, createDiscordClient as F, registerGateway as G, withValidatedDiscordProxy as H, createDiscordRestClient as I, unregisterGateway as K, createDiscordRuntimeAccountContext as L, hasAnyGuildPermissionDiscord as M, isThreadChannelType as N, fetchChannelPermissionsDiscord as O, parseAndResolveChannelRecipient as P, resolveDiscordClientAccountContext as R, DISCORD_MAX_EVENT_COVER_BYTES as S, canManageGuildMemberRoleDiscord as T, clearGateways as U, validateDiscordProxyUrl as V, getGateway as W, resolveDiscordMessageFlags as _, normalizeDiscordPollInput as a, stripUndefinedFields as b, normalizeStickerIds as c, resolveDiscordTargetChannelId as d, sendDiscordMedia as f, createDiscordMessageNonce as g, buildDiscordMessageRequest as h, formatReactionEmoji as i, hasAnyChannelPermissionDiscord as j, fetchMemberGuildPermissionsDiscord as k, resolveChannelId as l, SUPPRESS_NOTIFICATIONS_FLAG as m, buildDiscordTextChunks as n, normalizeEmojiName as o, sendDiscordText as p, buildReactionIdentifier as r, normalizeReactionEmoji as s, buildDiscordSendError as t, resolveDiscordChannel as u, resolveDiscordSendComponents as v, DiscordSendError as w, DISCORD_MAX_EMOJI_BYTES as x, resolveDiscordSendEmbeds as y, resolveDiscordRest as z };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { x as formatDiscordUserTag } from "./allow-list-B7qOH5xu.js";
|
|
2
2
|
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
3
3
|
//#region extensions/discord/src/monitor/sender-identity.ts
|
|
4
4
|
function resolveDiscordWebhookId(message) {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as testing, n as createThreadBindingManager } from "./thread-bindings.manager-
|
|
1
|
+
import { i as testing, n as createThreadBindingManager } from "./thread-bindings.manager-BIBm6bQd.js";
|
|
2
2
|
export { createThreadBindingManager, testing as discordThreadBindingTesting };
|
package/dist/setup-plugin-api.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as discordSetupPlugin } from "./channel.setup-
|
|
1
|
+
import { t as discordSetupPlugin } from "./channel.setup-DyihrqHH.js";
|
|
2
2
|
export { discordSetupPlugin };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { t as inspectDiscordAccount } from "./account-inspect-DDZtT5C8.js";
|
|
2
2
|
import { a as mergeDiscordAccountConfig, c as resolveDiscordAccountAllowFrom, d as resolveDiscordAccountDmPolicy, n as isDiscordAccountEnabledForRuntime, o as resolveDefaultDiscordAccountId, r as listDiscordAccountIds, s as resolveDiscordAccount, u as resolveDiscordAccountDisabledReason } from "./accounts-P19jm1lf.js";
|
|
3
3
|
import { i as getChatChannelMeta, o as resolveConfiguredFromCredentialStatuses } from "./channel-api-CAJ0wMoV.js";
|
|
4
|
-
import { t as DiscordChannelConfigSchema } from "./config-schema-
|
|
5
|
-
import { n as normalizeCompatibilityConfig } from "./doctor-contract-
|
|
4
|
+
import { t as DiscordChannelConfigSchema } from "./config-schema-_bUKcWRm.js";
|
|
5
|
+
import { n as normalizeCompatibilityConfig } from "./doctor-contract-wId6pV41.js";
|
|
6
6
|
import { n as secretTargetRegistryEntries, t as collectRuntimeConfigAssignments } from "./secret-config-contract-BDNrRWvd.js";
|
|
7
7
|
import { n as unsupportedSecretRefSurfacePatterns, t as collectUnsupportedSecretRefConfigCandidates } from "./security-contract-DSHk7I2w.js";
|
|
8
8
|
import { t as deriveLegacySessionChatType } from "./session-contract-BO5tlIdl.js";
|
|
@@ -66,7 +66,7 @@ const DISCORD_LEGACY_CONFIG_RULES = [];
|
|
|
66
66
|
//#endregion
|
|
67
67
|
//#region extensions/discord/src/shared.ts
|
|
68
68
|
const DISCORD_CHANNEL = "discord";
|
|
69
|
-
const loadDiscordDoctorModule = createLazyRuntimeModule(() => import("./doctor-
|
|
69
|
+
const loadDiscordDoctorModule = createLazyRuntimeModule(() => import("./doctor-bMaWXFKu.js"));
|
|
70
70
|
const discordDoctor = {
|
|
71
71
|
dmAllowFromMode: "topOnly",
|
|
72
72
|
groupModel: "route",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Xt as __exportAll } from "./send.receipt-aegk69an.js";
|
|
2
2
|
import { s as resolveDiscordAccount } from "./accounts-P19jm1lf.js";
|
|
3
|
-
import { n as autoBindSpawnedDiscordSubagent, o as unbindThreadBindingsBySessionKey, r as listThreadBindingsBySessionKey } from "./thread-bindings-
|
|
3
|
+
import { n as autoBindSpawnedDiscordSubagent, o as unbindThreadBindingsBySessionKey, r as listThreadBindingsBySessionKey } from "./thread-bindings-BbzjUuNB.js";
|
|
4
4
|
import { normalizeOptionalLowercaseString, normalizeOptionalStringifiedId } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
5
5
|
import { formatThreadBindingDisabledError, formatThreadBindingSpawnDisabledError, resolveThreadBindingSpawnPolicy } from "openclaw/plugin-sdk/conversation-runtime";
|
|
6
6
|
//#region extensions/discord/src/subagent-hooks.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
|
|
2
2
|
//#region extensions/discord/subagent-hooks-api.ts
|
|
3
|
-
const loadDiscordSubagentHooksModule = createLazyRuntimeModule(() => import("./subagent-hooks-
|
|
3
|
+
const loadDiscordSubagentHooksModule = createLazyRuntimeModule(() => import("./subagent-hooks-DKJ4p-Oy.js").then((n) => n.i));
|
|
4
4
|
function registerDiscordSubagentHooks(api) {
|
|
5
5
|
api.on("subagent_ended", async (event) => {
|
|
6
6
|
const { handleDiscordSubagentEnded } = await loadDiscordSubagentHooksModule();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { d as discord_exports } from "./send.receipt-
|
|
2
|
-
import {
|
|
1
|
+
import { d as discord_exports } from "./send.receipt-aegk69an.js";
|
|
2
|
+
import { x as formatDiscordUserTag } from "./allow-list-B7qOH5xu.js";
|
|
3
3
|
//#region extensions/discord/src/monitor/system-events.ts
|
|
4
4
|
function resolveDiscordSystemEvent(message, location) {
|
|
5
5
|
switch (message.type) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Jt as
|
|
1
|
+
import { Jt as parseDiscordTarget, Xt as __exportAll, o as allowFromContainsDiscordUserId } from "./send.receipt-aegk69an.js";
|
|
2
2
|
import { c as resolveDiscordAccountAllowFrom, s as resolveDiscordAccount } from "./accounts-P19jm1lf.js";
|
|
3
|
-
import { i as rememberDiscordDirectoryUser, r as listDiscordDirectoryPeersLive } from "./directory-live-
|
|
3
|
+
import { i as rememberDiscordDirectoryUser, r as listDiscordDirectoryPeersLive } from "./directory-live-DZByMdPO.js";
|
|
4
4
|
import { buildMessagingTarget } from "openclaw/plugin-sdk/channel-targets";
|
|
5
5
|
//#region extensions/discord/src/send-target-parsing.ts
|
|
6
6
|
const parseDiscordSendTarget = (raw, options = {}) => parseDiscordTarget(raw, options);
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { Jt as
|
|
2
|
-
import "./targets-
|
|
3
|
-
import { A as shouldPersistBindingMutations, C as resolveThreadBindingIdleTimeoutMs$1, D as saveBindingsToDisk, E as resolveThreadBindingMaxAgeMs$1, T as resolveThreadBindingMaxAgeExpiresAt, d as isRecentlyUnboundThreadWebhookMessage, g as rememberRecentUnboundWebhookEcho, h as normalizeThreadId, n as MANAGERS_BY_ACCOUNT_ID, t as BINDINGS_BY_THREAD_ID, u as getThreadBindingToken, w as resolveThreadBindingInactivityExpiresAt, y as removeBindingRecord } from "./thread-bindings.state-
|
|
4
|
-
import { n as setThreadBindingMaxAgeBySessionKey, r as resolveBindingIdsForTargetSession, t as setThreadBindingIdleTimeoutBySessionKey } from "./thread-bindings.session-updates-
|
|
5
|
-
import { _ as formatThreadBindingDurationLabel, b as resolveThreadBindingThreadName, g as resolveThreadBindingPersonaFromRecord, h as resolveThreadBindingPersona, s as resolveChannelIdForBinding, y as resolveThreadBindingIntroText } from "./thread-bindings.discord-api-
|
|
6
|
-
import { i as testing, n as createThreadBindingManager, r as getThreadBindingManager, t as createNoopThreadBindingManager } from "./thread-bindings.manager-
|
|
1
|
+
import { Jt as parseDiscordTarget, Xt as __exportAll } from "./send.receipt-aegk69an.js";
|
|
2
|
+
import "./targets-DvItNIvP.js";
|
|
3
|
+
import { A as shouldPersistBindingMutations, C as resolveThreadBindingIdleTimeoutMs$1, D as saveBindingsToDisk, E as resolveThreadBindingMaxAgeMs$1, T as resolveThreadBindingMaxAgeExpiresAt, d as isRecentlyUnboundThreadWebhookMessage, g as rememberRecentUnboundWebhookEcho, h as normalizeThreadId, n as MANAGERS_BY_ACCOUNT_ID, t as BINDINGS_BY_THREAD_ID, u as getThreadBindingToken, w as resolveThreadBindingInactivityExpiresAt, y as removeBindingRecord } from "./thread-bindings.state-9VAxhVf6.js";
|
|
4
|
+
import { n as setThreadBindingMaxAgeBySessionKey, r as resolveBindingIdsForTargetSession, t as setThreadBindingIdleTimeoutBySessionKey } from "./thread-bindings.session-updates-eRcJlzIU.js";
|
|
5
|
+
import { _ as formatThreadBindingDurationLabel, b as resolveThreadBindingThreadName, g as resolveThreadBindingPersonaFromRecord, h as resolveThreadBindingPersona, s as resolveChannelIdForBinding, y as resolveThreadBindingIntroText } from "./thread-bindings.discord-api-DJD3qwIN.js";
|
|
6
|
+
import { i as testing, n as createThreadBindingManager, r as getThreadBindingManager, t as createNoopThreadBindingManager } from "./thread-bindings.manager-BIBm6bQd.js";
|
|
7
7
|
import { normalizeOptionalLowercaseString, normalizeOptionalString, uniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
8
8
|
import { normalizeAccountId } from "openclaw/plugin-sdk/routing";
|
|
9
9
|
import { resolveThreadBindingIdleTimeoutMs, resolveThreadBindingMaxAgeMs, resolveThreadBindingsEnabled } from "openclaw/plugin-sdk/conversation-runtime";
|
|
10
10
|
import { readAcpSessionEntry } from "openclaw/plugin-sdk/acp-runtime";
|
|
11
|
+
import pMap from "p-map";
|
|
11
12
|
//#region extensions/discord/src/monitor/thread-bindings.config.ts
|
|
12
13
|
function resolveDiscordThreadBindingIdleTimeoutMs(params) {
|
|
13
14
|
const accountId = normalizeAccountId(params.accountId);
|
|
@@ -30,23 +31,6 @@ function resolveDiscordThreadBindingMaxAgeMs(params) {
|
|
|
30
31
|
//#endregion
|
|
31
32
|
//#region extensions/discord/src/monitor/thread-bindings.lifecycle.ts
|
|
32
33
|
const ACP_STARTUP_HEALTH_PROBE_CONCURRENCY_LIMIT = 8;
|
|
33
|
-
async function mapWithConcurrency(params) {
|
|
34
|
-
if (params.items.length === 0) return [];
|
|
35
|
-
const limit = Math.max(1, Math.floor(params.limit));
|
|
36
|
-
const resultsByIndex = /* @__PURE__ */ new Map();
|
|
37
|
-
let nextIndex = 0;
|
|
38
|
-
const runWorker = async () => {
|
|
39
|
-
for (;;) {
|
|
40
|
-
const index = nextIndex;
|
|
41
|
-
nextIndex += 1;
|
|
42
|
-
if (index >= params.items.length) return;
|
|
43
|
-
resultsByIndex.set(index, await params.worker(params.items[index], index));
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
const workers = Array.from({ length: Math.min(limit, params.items.length) }, () => runWorker());
|
|
47
|
-
await Promise.all(workers);
|
|
48
|
-
return params.items.map((_item, index) => resultsByIndex.get(index));
|
|
49
|
-
}
|
|
50
34
|
function listThreadBindingsForAccount(accountId) {
|
|
51
35
|
const manager = getThreadBindingManager(accountId);
|
|
52
36
|
if (!manager) return [];
|
|
@@ -177,28 +161,27 @@ async function reconcileAcpThreadBindingsOnStartup(params) {
|
|
|
177
161
|
});
|
|
178
162
|
}
|
|
179
163
|
if (params.healthProbe && probeTargets.length > 0) {
|
|
180
|
-
const probeResults = await
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
cfg: params.cfg,
|
|
189
|
-
accountId: manager.accountId,
|
|
190
|
-
sessionKey,
|
|
191
|
-
binding,
|
|
192
|
-
session
|
|
193
|
-
}))?.status ?? "uncertain"
|
|
194
|
-
};
|
|
195
|
-
} catch {
|
|
196
|
-
return {
|
|
164
|
+
const probeResults = await pMap(probeTargets, async ({ binding, sessionKey, session }) => {
|
|
165
|
+
try {
|
|
166
|
+
return {
|
|
167
|
+
binding,
|
|
168
|
+
status: (await params.healthProbe?.({
|
|
169
|
+
cfg: params.cfg,
|
|
170
|
+
accountId: manager.accountId,
|
|
171
|
+
sessionKey,
|
|
197
172
|
binding,
|
|
198
|
-
|
|
199
|
-
}
|
|
200
|
-
}
|
|
173
|
+
session
|
|
174
|
+
}))?.status ?? "uncertain"
|
|
175
|
+
};
|
|
176
|
+
} catch {
|
|
177
|
+
return {
|
|
178
|
+
binding,
|
|
179
|
+
status: "uncertain"
|
|
180
|
+
};
|
|
201
181
|
}
|
|
182
|
+
}, {
|
|
183
|
+
concurrency: ACP_STARTUP_HEALTH_PROBE_CONCURRENCY_LIMIT,
|
|
184
|
+
stopOnError: true
|
|
202
185
|
});
|
|
203
186
|
for (const probeResult of probeResults) if (probeResult.status === "stale") staleBindings.push(probeResult.binding);
|
|
204
187
|
}
|
package/dist/{thread-bindings.discord-api-BjIf9lGs.js → thread-bindings.discord-api-DJD3qwIN.js}
RENAMED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { I as createDiscordRestClient } from "./send.shared-
|
|
3
|
-
import { c as sendWebhookMessageDiscord, u as createThreadDiscord } from "./send-
|
|
4
|
-
import { t as sendMessageDiscord } from "./send.outbound-
|
|
5
|
-
import { M as toReusableWebhookKey, _ as rememberReusableWebhook, i as REUSABLE_WEBHOOKS_BY_ACCOUNT_CHANNEL, t as BINDINGS_BY_THREAD_ID } from "./thread-bindings.state-
|
|
1
|
+
import { Yt as resolveDiscordChannelId, st as createChannelWebhook, yt as getChannel } from "./send.receipt-aegk69an.js";
|
|
2
|
+
import { I as createDiscordRestClient } from "./send.shared-Xz7IMVpu.js";
|
|
3
|
+
import { c as sendWebhookMessageDiscord, u as createThreadDiscord } from "./send-BFpa_DHn.js";
|
|
4
|
+
import { t as sendMessageDiscord } from "./send.outbound-BlA6VzSE.js";
|
|
5
|
+
import { M as toReusableWebhookKey, _ as rememberReusableWebhook, i as REUSABLE_WEBHOOKS_BY_ACCOUNT_CHANNEL, t as BINDINGS_BY_THREAD_ID } from "./thread-bindings.state-9VAxhVf6.js";
|
|
6
6
|
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
7
7
|
import { ChannelType } from "discord-api-types/v10";
|
|
8
8
|
import { parseStrictNonNegativeInteger } from "openclaw/plugin-sdk/number-runtime";
|
|
9
9
|
import { logVerbose } from "openclaw/plugin-sdk/runtime-env";
|
|
10
|
+
import { truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
10
11
|
import { SYSTEM_MARK } from "openclaw/plugin-sdk/text-chunking";
|
|
11
12
|
import { formatThreadBindingDurationLabel, resolveThreadBindingFarewellText, resolveThreadBindingIntroText, resolveThreadBindingThreadName } from "openclaw/plugin-sdk/conversation-runtime";
|
|
12
13
|
//#region extensions/discord/src/monitor/thread-bindings.persona.ts
|
|
@@ -16,7 +17,7 @@ function normalizePersonaLabel(value) {
|
|
|
16
17
|
return value.replace(/\s+/g, " ").trim() || void 0;
|
|
17
18
|
}
|
|
18
19
|
function resolveThreadBindingPersona(params) {
|
|
19
|
-
return `${SYSTEM_MARK} ${normalizePersonaLabel(params.label) || normalizePersonaLabel(params.agentId) || "agent"}
|
|
20
|
+
return truncateUtf16Safe(`${SYSTEM_MARK} ${normalizePersonaLabel(params.label) || normalizePersonaLabel(params.agentId) || "agent"}`, THREAD_BINDING_PERSONA_MAX_CHARS);
|
|
20
21
|
}
|
|
21
22
|
function resolveThreadBindingPersonaFromRecord(record) {
|
|
22
23
|
return resolveThreadBindingPersona({
|
|
@@ -227,10 +228,7 @@ async function resolveChannelIdForBinding(params) {
|
|
|
227
228
|
}
|
|
228
229
|
async function createThreadForBinding(params) {
|
|
229
230
|
try {
|
|
230
|
-
return (normalizeOptionalString((await createThreadDiscord(params.channelId, {
|
|
231
|
-
name: params.threadName,
|
|
232
|
-
autoArchiveMinutes: 60
|
|
233
|
-
}, {
|
|
231
|
+
return (normalizeOptionalString((await createThreadDiscord(params.channelId, { name: params.threadName }, {
|
|
234
232
|
cfg: params.cfg,
|
|
235
233
|
accountId: params.accountId,
|
|
236
234
|
token: params.token
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { I as createDiscordRestClient } from "./send.shared-
|
|
3
|
-
import { C as resolveThreadBindingIdleTimeoutMs$1, D as saveBindingsToDisk, E as resolveThreadBindingMaxAgeMs$1, F as THREAD_BINDINGS_SWEEP_INTERVAL_MS, N as DEFAULT_THREAD_BINDING_IDLE_TIMEOUT_MS, O as setBindingRecord, S as resolveBindingRecordKey, T as resolveThreadBindingMaxAgeExpiresAt, b as resetThreadBindingsForTests, c as ensureBindingsLoaded, g as rememberRecentUnboundWebhookEcho, h as normalizeThreadId, k as shouldDefaultPersist, l as forgetThreadBindingToken, m as normalizeThreadBindingDurationMs, n as MANAGERS_BY_ACCOUNT_ID, p as normalizeTargetKind, r as PERSIST_BY_ACCOUNT_ID, s as THREAD_BINDING_TOUCH_PERSIST_MIN_INTERVAL_MS, t as BINDINGS_BY_THREAD_ID, u as getThreadBindingToken, v as rememberThreadBindingToken, w as resolveThreadBindingInactivityExpiresAt, x as resolveBindingIdsForSession, y as removeBindingRecord } from "./thread-bindings.state-
|
|
4
|
-
import { a as isThreadArchived, b as resolveThreadBindingThreadName, c as summarizeDiscordError, i as isDiscordThreadGoneError, n as createWebhookForChannel, o as maybeSendBindingMessage, r as findReusableWebhook, s as resolveChannelIdForBinding, t as createThreadForBinding, v as resolveThreadBindingFarewellText } from "./thread-bindings.discord-api-
|
|
1
|
+
import { Xt as __exportAll, Yt as resolveDiscordChannelId, yt as getChannel } from "./send.receipt-aegk69an.js";
|
|
2
|
+
import { I as createDiscordRestClient } from "./send.shared-Xz7IMVpu.js";
|
|
3
|
+
import { C as resolveThreadBindingIdleTimeoutMs$1, D as saveBindingsToDisk, E as resolveThreadBindingMaxAgeMs$1, F as THREAD_BINDINGS_SWEEP_INTERVAL_MS, N as DEFAULT_THREAD_BINDING_IDLE_TIMEOUT_MS, O as setBindingRecord, S as resolveBindingRecordKey, T as resolveThreadBindingMaxAgeExpiresAt, b as resetThreadBindingsForTests, c as ensureBindingsLoaded, g as rememberRecentUnboundWebhookEcho, h as normalizeThreadId, k as shouldDefaultPersist, l as forgetThreadBindingToken, m as normalizeThreadBindingDurationMs, n as MANAGERS_BY_ACCOUNT_ID, p as normalizeTargetKind, r as PERSIST_BY_ACCOUNT_ID, s as THREAD_BINDING_TOUCH_PERSIST_MIN_INTERVAL_MS, t as BINDINGS_BY_THREAD_ID, u as getThreadBindingToken, v as rememberThreadBindingToken, w as resolveThreadBindingInactivityExpiresAt, x as resolveBindingIdsForSession, y as removeBindingRecord } from "./thread-bindings.state-9VAxhVf6.js";
|
|
4
|
+
import { a as isThreadArchived, b as resolveThreadBindingThreadName, c as summarizeDiscordError, i as isDiscordThreadGoneError, n as createWebhookForChannel, o as maybeSendBindingMessage, r as findReusableWebhook, s as resolveChannelIdForBinding, t as createThreadForBinding, v as resolveThreadBindingFarewellText } from "./thread-bindings.discord-api-DJD3qwIN.js";
|
|
5
5
|
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
6
6
|
import { normalizeAccountId, resolveAgentIdFromSessionKey } from "openclaw/plugin-sdk/routing";
|
|
7
7
|
import { getRuntimeConfigSnapshot } from "openclaw/plugin-sdk/runtime-config-snapshot";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as shouldPersistBindingMutations, D as saveBindingsToDisk, O as setBindingRecord, c as ensureBindingsLoaded, t as BINDINGS_BY_THREAD_ID, x as resolveBindingIdsForSession } from "./thread-bindings.state-
|
|
1
|
+
import { A as shouldPersistBindingMutations, D as saveBindingsToDisk, O as setBindingRecord, c as ensureBindingsLoaded, t as BINDINGS_BY_THREAD_ID, x as resolveBindingIdsForSession } from "./thread-bindings.state-9VAxhVf6.js";
|
|
2
2
|
import { normalizeAccountId } from "openclaw/plugin-sdk/routing";
|
|
3
3
|
//#region extensions/discord/src/monitor/thread-bindings.session-shared.ts
|
|
4
4
|
function normalizeNonNegativeMs(raw) {
|
|
@@ -89,7 +89,7 @@ function normalizePersistedBinding(threadIdKey, raw) {
|
|
|
89
89
|
const value = raw;
|
|
90
90
|
const threadId = normalizeThreadId(value.threadId ?? threadIdKey);
|
|
91
91
|
const channelId = normalizeOptionalString(value.channelId) ?? "";
|
|
92
|
-
const targetSessionKey = normalizeOptionalString(value.targetSessionKey) ??
|
|
92
|
+
const targetSessionKey = normalizeOptionalString(value.targetSessionKey) ?? "";
|
|
93
93
|
if (!threadId || !channelId || !targetSessionKey) return null;
|
|
94
94
|
const accountId = normalizeAccountId(value.accountId);
|
|
95
95
|
const targetKind = normalizeTargetKind(value.targetKind, targetSessionKey);
|
|
@@ -103,17 +103,6 @@ function normalizePersistedBinding(threadIdKey, raw) {
|
|
|
103
103
|
const idleTimeoutMs = typeof value.idleTimeoutMs === "number" && Number.isFinite(value.idleTimeoutMs) ? Math.max(0, Math.floor(value.idleTimeoutMs)) : void 0;
|
|
104
104
|
const maxAgeMs = typeof value.maxAgeMs === "number" && Number.isFinite(value.maxAgeMs) ? Math.max(0, Math.floor(value.maxAgeMs)) : void 0;
|
|
105
105
|
const metadata = value.metadata && typeof value.metadata === "object" ? { ...value.metadata } : void 0;
|
|
106
|
-
const legacyExpiresAt = typeof value.expiresAt === "number" && Number.isFinite(value.expiresAt) ? Math.max(0, Math.floor(value.expiresAt ?? 0)) : void 0;
|
|
107
|
-
let migratedIdleTimeoutMs = idleTimeoutMs;
|
|
108
|
-
let migratedMaxAgeMs = maxAgeMs;
|
|
109
|
-
if (migratedIdleTimeoutMs === void 0 && migratedMaxAgeMs === void 0 && legacyExpiresAt != null) if (legacyExpiresAt <= 0) {
|
|
110
|
-
migratedIdleTimeoutMs = 0;
|
|
111
|
-
migratedMaxAgeMs = 0;
|
|
112
|
-
} else {
|
|
113
|
-
const baseBoundAt = boundAt > 0 ? boundAt : lastActivityAt;
|
|
114
|
-
migratedIdleTimeoutMs = 0;
|
|
115
|
-
migratedMaxAgeMs = Math.max(1, legacyExpiresAt - Math.max(0, baseBoundAt));
|
|
116
|
-
}
|
|
117
106
|
const record = {
|
|
118
107
|
accountId,
|
|
119
108
|
channelId,
|
|
@@ -128,8 +117,8 @@ function normalizePersistedBinding(threadIdKey, raw) {
|
|
|
128
117
|
if (label !== void 0) record.label = label;
|
|
129
118
|
if (webhookId !== void 0) record.webhookId = webhookId;
|
|
130
119
|
if (webhookToken !== void 0) record.webhookToken = webhookToken;
|
|
131
|
-
if (
|
|
132
|
-
if (
|
|
120
|
+
if (idleTimeoutMs !== void 0) record.idleTimeoutMs = idleTimeoutMs;
|
|
121
|
+
if (maxAgeMs !== void 0) record.maxAgeMs = maxAgeMs;
|
|
133
122
|
if (metadata !== void 0) record.metadata = metadata;
|
|
134
123
|
return record;
|
|
135
124
|
}
|
|
@@ -22,26 +22,14 @@ function isAbortError(error) {
|
|
|
22
22
|
}
|
|
23
23
|
function mergeAbortSignals(signals) {
|
|
24
24
|
const activeSignals = signals.filter((signal) => Boolean(signal));
|
|
25
|
-
|
|
26
|
-
if (activeSignals.length === 1) return activeSignals[0];
|
|
27
|
-
if (typeof AbortSignal.any === "function") return AbortSignal.any(activeSignals);
|
|
28
|
-
const fallbackController = new AbortController();
|
|
29
|
-
for (const signal of activeSignals) if (signal.aborted) {
|
|
30
|
-
fallbackController.abort();
|
|
31
|
-
return fallbackController.signal;
|
|
32
|
-
}
|
|
33
|
-
const abortFallback = () => {
|
|
34
|
-
fallbackController.abort();
|
|
35
|
-
for (const signal of activeSignals) signal.removeEventListener("abort", abortFallback);
|
|
36
|
-
};
|
|
37
|
-
for (const signal of activeSignals) signal.addEventListener("abort", abortFallback, { once: true });
|
|
38
|
-
return fallbackController.signal;
|
|
25
|
+
return activeSignals.length > 1 ? AbortSignal.any(activeSignals) : activeSignals[0];
|
|
39
26
|
}
|
|
40
27
|
/** @deprecated Discord no longer uses this for channel-owned message run timeouts. */
|
|
41
28
|
async function runDiscordTaskWithTimeout(params) {
|
|
42
29
|
const timeoutMs = params.timeoutMs === void 0 ? void 0 : resolveTimerTimeoutMs(params.timeoutMs, 0, 0);
|
|
43
30
|
const timeoutAbortController = timeoutMs ? new AbortController() : void 0;
|
|
44
|
-
const
|
|
31
|
+
const abortSignals = [...params.abortSignals ?? [], timeoutAbortController?.signal].filter((signal) => Boolean(signal));
|
|
32
|
+
const mergedAbortSignal = abortSignals.length > 1 ? AbortSignal.any(abortSignals) : abortSignals[0];
|
|
45
33
|
let timedOut = false;
|
|
46
34
|
let timeoutHandle = null;
|
|
47
35
|
const runPromise = params.run(mergedAbortSignal).catch((error) => {
|
package/dist/timeouts.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as DISCORD_DEFAULT_LISTENER_TIMEOUT_MS, n as DISCORD_ATTACHMENT_TOTAL_TIMEOUT_MS, r as DISCORD_DEFAULT_INBOUND_WORKER_TIMEOUT_MS, t as DISCORD_ATTACHMENT_IDLE_TIMEOUT_MS } from "./timeouts-
|
|
1
|
+
import { i as DISCORD_DEFAULT_LISTENER_TIMEOUT_MS, n as DISCORD_ATTACHMENT_TOTAL_TIMEOUT_MS, r as DISCORD_DEFAULT_INBOUND_WORKER_TIMEOUT_MS, t as DISCORD_ATTACHMENT_IDLE_TIMEOUT_MS } from "./timeouts-ZRc9Lw4y.js";
|
|
2
2
|
export { DISCORD_ATTACHMENT_IDLE_TIMEOUT_MS, DISCORD_ATTACHMENT_TOTAL_TIMEOUT_MS, DISCORD_DEFAULT_INBOUND_WORKER_TIMEOUT_MS, DISCORD_DEFAULT_LISTENER_TIMEOUT_MS };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Xt as __exportAll } from "./send.receipt-aegk69an.js";
|
|
2
2
|
//#region extensions/discord/src/voice/transcripts-source.ts
|
|
3
3
|
var transcripts_source_exports = /* @__PURE__ */ __exportAll({
|
|
4
4
|
discordVoiceTranscriptsSourceProvider: () => discordVoiceTranscriptsSourceProvider,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as discordVoiceTranscriptsSourceProvider } from "./transcripts-source-
|
|
1
|
+
import { t as discordVoiceTranscriptsSourceProvider } from "./transcripts-source-CLZ5X8fh.js";
|
|
2
2
|
export { discordVoiceTranscriptsSourceProvider };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { l as raceWithTimeout } from "./timeouts-
|
|
1
|
+
import { Et as sendChannelTyping, Xt as __exportAll } from "./send.receipt-aegk69an.js";
|
|
2
|
+
import { l as raceWithTimeout } from "./timeouts-ZRc9Lw4y.js";
|
|
3
3
|
//#region extensions/discord/src/monitor/typing.ts
|
|
4
4
|
var typing_exports = /* @__PURE__ */ __exportAll({ sendTyping: () => sendTyping });
|
|
5
5
|
const DISCORD_TYPING_START_TIMEOUT_MS = 5e3;
|