@openclaw/discord 2026.9.6 → 2026.9.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/icon.png +0 -0
- package/dist/.setup/{account-inspect-BwQj24ht.mjs → account-inspect-De8hOUxG.mjs} +1 -1
- package/dist/.setup/{accounts-CwJQoLjM.mjs → accounts-ChaMcixG.mjs} +1 -4
- package/dist/.setup/{activities-api-COU4-0nR.mjs → activities-api-tvbsU2e3.mjs} +38 -66
- package/dist/.setup/{api-CBK9zcq5.mjs → api-DVbJwZVt.mjs} +10 -2
- package/dist/.setup/{approval-handler.runtime-CbBktBb4.mjs → approval-handler.runtime-DxCK2Rux.mjs} +49 -125
- package/dist/.setup/{approval-message-updates-jf9zMaIC.mjs → approval-message-updates-BKFqavHZ.mjs} +2 -2
- package/dist/.setup/{audit-vKbh-LFR.mjs → audit-CLg9I71N.mjs} +5 -5
- package/dist/.setup/{channel-Dv4e3Jpc.mjs → channel-DxlUVU9t.mjs} +121 -227
- package/dist/.setup/{channel-type-DKnjV1XW.mjs → channel-type-DRCrEMss.mjs} +22 -22
- package/dist/.setup/{channel.setup-0NX6FFwi.mjs → channel.setup-CRo1GjV7.mjs} +6 -9
- package/dist/.setup/{components-yBEb75bB.mjs → components-Cq1PvIpN.mjs} +41 -69
- package/dist/.setup/{config-schema-CiZz-mtA.mjs → config-schema-oxELUSDx.mjs} +19 -44
- package/dist/.setup/{conversation-binding-route-B7qImK_b.mjs → conversation-binding-route-Caz_XuFH.mjs} +10 -5
- package/dist/.setup/{directory-config-BytTftz-.mjs → directory-config-esqNn0Eo.mjs} +6 -9
- package/dist/.setup/{directory-live--EGTH0DC.mjs → directory-live-DtKRHuGV.mjs} +6 -12
- package/dist/.setup/{discord-BXpHW-cu.mjs → discord-0xJYfdDD.mjs} +82 -386
- package/dist/.setup/{doctor-D1R-uFIu.mjs → doctor-BCl1H5tl.mjs} +21 -36
- package/dist/.setup/{doctor-contract-Co5vRCZ6.mjs → doctor-contract-CvvgwrrG.mjs} +41 -50
- package/dist/.setup/{channel-actions.runtime-leZuw01r.mjs → handle-action-CUvQWnE7.mjs} +67 -104
- package/dist/.setup/{handle-action.guild-admin-DcFa8NwA.mjs → handle-action.guild-admin-Df-8gVle.mjs} +62 -120
- package/dist/.setup/{live-policy-config-eKQ-PLdy.mjs → live-policy-config-8Pv20CHc.mjs} +2 -3
- package/dist/.setup/{message-handler-X6ejmbtY.mjs → message-handler-B-Jk4oDk.mjs} +18 -94
- package/dist/.setup/{message-handler.preflight-pluralkit-8Xji34AF.mjs → message-handler.preflight-pluralkit-CWLUBVcx.mjs} +8 -10
- package/dist/.setup/{message-handler.preflight-DE_POxFc.mjs → message-handler.preflight-v-__NSDq.mjs} +69 -180
- package/dist/.setup/{message-handler.process-CCmIVnxy.mjs → message-handler.process-BNFFuChn.mjs} +65 -86
- package/dist/.setup/{outbound-adapter-ClIgmu4F.mjs → outbound-adapter-BobT-kse.mjs} +105 -19
- package/dist/.setup/{outbound-session-route-VulUE0yV.mjs → outbound-session-route-zVGxxceg.mjs} +140 -108
- package/dist/.setup/{pluralkit-CdAt1G0P.mjs → pluralkit-a6_NLfH9.mjs} +1 -1
- package/dist/.setup/{presence-cache-dYSHPWMx.mjs → presence-cache-Di3H3DIU.mjs} +0 -4
- package/dist/.setup/{probe-CupW4we4.mjs → probe-LYrIHlBF.mjs} +13 -4
- package/dist/.setup/{provider-iOf73HW-.mjs → provider-B_G5hASF.mjs} +721 -1416
- package/dist/.setup/provider-session.runtime-BYlTBFD2.mjs +6 -0
- package/dist/.setup/provider.runtime-CUE3UxER.mjs +2 -0
- package/dist/.setup/{realtime-session.runtime-Dz8uVutq.mjs → realtime-session.runtime-oUd9DOcz.mjs} +41 -55
- package/dist/.setup/{receive-recovery-DHst8WRx.mjs → receive-recovery-CHPOsnLc.mjs} +1 -4
- package/dist/.setup/{resolve-allowlist-common-CwMBzbx9.mjs → resolve-allowlist-common-DPdRggu5.mjs} +4 -7
- package/dist/.setup/{resolve-channels-BbvsLQOZ.mjs → resolve-channels-BFPNRmVv.mjs} +21 -40
- package/dist/.setup/{resolve-users-ByFlR7LQ.mjs → resolve-users-0-aBuCy3.mjs} +4 -4
- package/dist/.setup/{retry-BEYkDy0P.mjs → retry-pz_cSha2.mjs} +3 -3
- package/dist/.setup/rolldown-runtime-B4FMCO8f.mjs +28 -0
- package/dist/.setup/{runtime-B8lJfyrA.mjs → runtime-FN000lxA.mjs} +60 -162
- package/dist/.setup/runtime-doctor-migrations-CshUGl36.mjs +159 -0
- package/dist/.setup/{runtime-DisDbixd.mjs → runtime-sUksZ--Q.mjs} +2 -5
- package/dist/.setup/{secret-config-contract-DFu9hfU8.mjs → secret-config-contract-uOE2J7yM.mjs} +15 -85
- package/dist/.setup/{security-audit-s5w50-Ly.mjs → security-audit-Cdaegq7C.mjs} +3 -1
- package/dist/.setup/{send-CIBzvXjS.mjs → send-CrfEI6Bs.mjs} +53 -108
- package/dist/.setup/{send.components-ChY21qr-.mjs → send.components-DxQAMfES.mjs} +62 -107
- package/dist/.setup/{send.outbound-QTyuFupn.mjs → send.outbound-BISKnb-a.mjs} +66 -140
- package/dist/.setup/{send.shared-VNvWfX2T.mjs → send.shared-DGFkbkQR.mjs} +10 -25
- package/dist/.setup/{sender-identity-0Ymgvmaj.mjs → sender-identity-B9X5Vb9R.mjs} +2 -3
- package/dist/.setup/setup-plugin-api-BQUBxbhe.mjs +3 -0
- package/dist/.setup/{shared-DHPDaMSx.mjs → shared-B3wZ4hN-.mjs} +25 -32
- package/dist/.setup/{subagent-hooks-CjW7r8Pe.mjs → subagent-hooks-nlUE9ow7.mjs} +5 -6
- package/dist/.setup/system-events-CdeZnvPV.mjs +33 -0
- package/dist/.setup/{target-resolver-BXpy6VT8.mjs → target-resolver-BuLapkhy.mjs} +9 -12
- package/dist/.setup/targets-0KUcEIYx.mjs +3 -0
- package/dist/.setup/{thread-bindings-CEh2dhqP.mjs → thread-bindings-D7TfgjR_.mjs} +33 -35
- package/dist/.setup/{thread-bindings.manager-ve-i6oqt.mjs → thread-bindings.manager-DN-NissX.mjs} +325 -233
- package/dist/.setup/thread-bindings.session-updates-CshfKghV.mjs +359 -0
- package/dist/.setup/{thread-bindings.state-BThFQEga.mjs → thread-bindings.state-g6v9zAym.mjs} +21 -62
- package/dist/.setup/{transcripts-source-DVegW0WI.mjs → transcripts-source-p8EV179h.mjs} +76 -235
- package/dist/.setup/{typing-BKZL5fGj.mjs → typing-BiHCzBRu.mjs} +2 -1
- package/dist/.setup/{voice-runtime-elTtjEIG.mjs → voice-runtime-B46rcwrG.mjs} +140 -244
- package/dist/account-inspect-api.js +1 -1
- package/dist/action-runtime-api.js +1 -1
- package/dist/activities-api.js +1 -1
- package/dist/api.js +18 -18
- package/dist/channel-config-api.js +1 -1
- package/dist/channel-plugin-api.js +1 -1
- package/dist/directory-contract-api.js +1 -1
- package/dist/doctor-contract-api.js +4 -4
- package/dist/index.js +1 -1
- package/dist/runtime-api.js +20 -20
- package/dist/secret-contract-api.js +1 -1
- package/dist/security-audit-contract-api.js +1 -1
- package/dist/setup-entry.js +1 -1
- package/dist/setup-plugin-api.js +1 -1
- package/dist/src/voice/audio-worker.runtime.js +15 -24
- package/dist/subagent-hooks-api.js +3 -4
- package/dist/transcripts-source-api.js +1 -1
- package/node_modules/@types/node/README.md +2 -2
- package/node_modules/@types/node/child_process.d.ts +1 -1
- package/node_modules/@types/node/crypto.d.ts +20 -8
- package/node_modules/@types/node/ffi.d.ts +14 -0
- package/node_modules/@types/node/http2.d.ts +3 -2
- package/node_modules/@types/node/net.d.ts +16 -4
- package/node_modules/@types/node/package.json +2 -17
- package/node_modules/@types/node/process.d.ts +1 -0
- package/node_modules/@types/node/quic.d.ts +39 -1
- package/node_modules/@types/node/stream/iter.d.ts +9 -12
- package/node_modules/@types/node/test/reporters.d.ts +1 -0
- package/node_modules/@types/node/test.d.ts +72 -0
- package/node_modules/@types/node/tls.d.ts +14 -10
- package/node_modules/@types/node/vm.d.ts +2 -1
- package/node_modules/@types/node/worker_threads.d.ts +4 -1
- package/node_modules/typebox/build/compile/code.mjs +1 -2
- package/node_modules/typebox/build/compile/validator.mjs +5 -1
- package/node_modules/typebox/build/format/iri.mjs +16 -9
- package/node_modules/typebox/build/guard/emit.mjs +2 -2
- package/node_modules/typebox/build/guard/guard.d.mts +7 -5
- package/node_modules/typebox/build/guard/guard.mjs +14 -9
- package/node_modules/typebox/build/guard/index.mjs +6 -0
- package/node_modules/typebox/build/guard/unicode/unicode.d.mts +6 -0
- package/node_modules/typebox/build/guard/unicode/unicode.mjs +35 -0
- package/node_modules/typebox/build/guard/{string.mjs → unicode/unicode_segment.mjs} +16 -19
- package/node_modules/typebox/build/schema/build.mjs +2 -3
- package/node_modules/typebox/build/schema/engine/_pathing.d.mts +1 -0
- package/node_modules/typebox/build/schema/engine/_pathing.mjs +11 -0
- package/node_modules/typebox/build/schema/engine/_refine.mjs +13 -5
- package/node_modules/typebox/build/schema/engine/additionalProperties.mjs +2 -1
- package/node_modules/typebox/build/schema/engine/dependencies.mjs +2 -1
- package/node_modules/typebox/build/schema/engine/dependentSchemas.mjs +2 -1
- package/node_modules/typebox/build/schema/engine/dynamicRef.d.mts +1 -1
- package/node_modules/typebox/build/schema/engine/dynamicRef.mjs +2 -2
- package/node_modules/typebox/build/schema/engine/format.mjs +9 -2
- package/node_modules/typebox/build/schema/engine/patternProperties.mjs +3 -2
- package/node_modules/typebox/build/schema/engine/properties.mjs +3 -2
- package/node_modules/typebox/build/schema/engine/propertyNames.mjs +2 -1
- package/node_modules/typebox/build/schema/engine/recursiveRef.d.mts +1 -1
- package/node_modules/typebox/build/schema/engine/recursiveRef.mjs +2 -2
- package/node_modules/typebox/build/schema/engine/ref.d.mts +1 -1
- package/node_modules/typebox/build/schema/engine/ref.mjs +2 -2
- package/node_modules/typebox/build/schema/engine/schema.mjs +24 -24
- package/node_modules/typebox/build/schema/parse.mjs +3 -0
- package/node_modules/typebox/build/schema/pointer/pointer.d.mts +1 -6
- package/node_modules/typebox/build/schema/pointer/pointer.mjs +47 -64
- package/node_modules/typebox/build/system/settings/internal.d.mts +2 -0
- package/node_modules/typebox/build/system/settings/internal.mjs +20 -0
- package/node_modules/typebox/build/system/settings/settings.d.mts +11 -0
- package/node_modules/typebox/build/system/settings/settings.mjs +14 -0
- package/node_modules/typebox/build/type/extends/inference.d.mts +1 -1
- package/node_modules/typebox/build/type/extends/inference.mjs +15 -2
- package/node_modules/typebox/build/type/extends/tuple.d.mts +2 -1
- package/node_modules/typebox/build/type/extends/tuple.mjs +21 -1
- package/node_modules/typebox/build/value/parse/parse.mjs +10 -4
- package/node_modules/typebox/package.json +1 -1
- package/node_modules/typebox/readme.md +3 -1
- package/openclaw.plugin.json +21 -1
- package/package.json +5 -5
- package/dist/.setup/agent-components.runtime-CEPrf2SY.mjs +0 -4
- package/dist/.setup/probe.runtime-DBQ_AGPe.mjs +0 -2
- package/dist/.setup/provider-session.runtime-DrGAYnZv.mjs +0 -6
- package/dist/.setup/provider.runtime-BmjW_pIw.mjs +0 -2
- package/dist/.setup/security-audit.runtime-DHtYenx9.mjs +0 -2
- package/dist/.setup/setup-plugin-api-Dvr41dyx.mjs +0 -3
- package/dist/.setup/system-events-B2YEEMbS.mjs +0 -34
- package/dist/.setup/targets-CvemhN3i.mjs +0 -3
- package/dist/.setup/thread-bindings.session-updates-DCQq1WZ5.mjs +0 -55
- /package/node_modules/typebox/build/guard/{string.d.mts → unicode/unicode_segment.d.mts} +0 -0
package/dist/.setup/{secret-config-contract-DFu9hfU8.mjs → secret-config-contract-uOE2J7yM.mjs}
RENAMED
|
@@ -1,98 +1,28 @@
|
|
|
1
1
|
import { normalizeAccountId } from "openclaw/plugin-sdk/account-id";
|
|
2
|
-
import { collectNestedChannelFieldAssignments, collectSimpleChannelFieldAssignments, getChannelSurface, hasConfiguredSecretInputValue, isBaseFieldActiveForChannelSurface, isEnabledFlag, isRecord } from "openclaw/plugin-sdk/channel-secret-basic-runtime";
|
|
2
|
+
import { collectNestedChannelFieldAssignments, collectSimpleChannelFieldAssignments, createChannelSecretTargetRegistryEntries, getChannelSurface, hasConfiguredSecretInputValue, isBaseFieldActiveForChannelSurface, isEnabledFlag, isRecord } from "openclaw/plugin-sdk/channel-secret-basic-runtime";
|
|
3
3
|
import { collectNestedChannelTtsAssignments } from "openclaw/plugin-sdk/channel-secret-tts-runtime";
|
|
4
4
|
//#region extensions/discord/src/secret-config-contract.ts
|
|
5
|
-
function createVoiceProviderSecretTarget(params) {
|
|
6
|
-
const path = `${params.scope === "account" ? "channels.discord.accounts.*" : "channels.discord"}.voice.${params.providerPath}.providers.*.apiKey`;
|
|
7
|
-
return {
|
|
8
|
-
id: path,
|
|
9
|
-
targetType: path,
|
|
10
|
-
configFile: "openclaw.json",
|
|
11
|
-
pathPattern: path,
|
|
12
|
-
secretShape: "secret_input",
|
|
13
|
-
expectedResolvedValue: "string",
|
|
14
|
-
includeInPlan: true,
|
|
15
|
-
includeInConfigure: true,
|
|
16
|
-
includeInAudit: true,
|
|
17
|
-
providerIdPathSegmentIndex: path.split(".").length - 2
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
5
|
function discordRealtimeVoiceSecretOwnerId(accountId, providerId) {
|
|
21
6
|
return `discord:voice:realtime:${normalizeAccountId(accountId)}:${providerId}`;
|
|
22
7
|
}
|
|
23
8
|
function isRealtimeVoiceActive(value) {
|
|
24
9
|
return isRecord(value) && isEnabledFlag(value) && value.mode !== "stt-tts";
|
|
25
10
|
}
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
secretShape: "secret_input",
|
|
33
|
-
expectedResolvedValue: "string",
|
|
34
|
-
includeInPlan: true,
|
|
35
|
-
includeInConfigure: true,
|
|
36
|
-
includeInAudit: true
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
id: "channels.discord.accounts.*.token",
|
|
40
|
-
targetType: "channels.discord.accounts.*.token",
|
|
41
|
-
configFile: "openclaw.json",
|
|
42
|
-
pathPattern: "channels.discord.accounts.*.token",
|
|
43
|
-
secretShape: "secret_input",
|
|
44
|
-
expectedResolvedValue: "string",
|
|
45
|
-
includeInPlan: true,
|
|
46
|
-
includeInConfigure: true,
|
|
47
|
-
includeInAudit: true
|
|
48
|
-
},
|
|
49
|
-
createVoiceProviderSecretTarget({
|
|
50
|
-
providerPath: "realtime",
|
|
51
|
-
scope: "account"
|
|
52
|
-
}),
|
|
53
|
-
createVoiceProviderSecretTarget({
|
|
54
|
-
providerPath: "tts",
|
|
55
|
-
scope: "account"
|
|
56
|
-
}),
|
|
57
|
-
createVoiceProviderSecretTarget({
|
|
58
|
-
providerPath: "tts.personas.*",
|
|
59
|
-
scope: "account"
|
|
60
|
-
}),
|
|
61
|
-
{
|
|
62
|
-
id: "channels.discord.pluralkit.token",
|
|
63
|
-
targetType: "channels.discord.pluralkit.token",
|
|
64
|
-
configFile: "openclaw.json",
|
|
65
|
-
pathPattern: "channels.discord.pluralkit.token",
|
|
66
|
-
secretShape: "secret_input",
|
|
67
|
-
expectedResolvedValue: "string",
|
|
68
|
-
includeInPlan: true,
|
|
69
|
-
includeInConfigure: true,
|
|
70
|
-
includeInAudit: true
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
id: "channels.discord.token",
|
|
74
|
-
targetType: "channels.discord.token",
|
|
75
|
-
configFile: "openclaw.json",
|
|
76
|
-
pathPattern: "channels.discord.token",
|
|
77
|
-
secretShape: "secret_input",
|
|
78
|
-
expectedResolvedValue: "string",
|
|
79
|
-
includeInPlan: true,
|
|
80
|
-
includeInConfigure: true,
|
|
81
|
-
includeInAudit: true
|
|
82
|
-
},
|
|
83
|
-
createVoiceProviderSecretTarget({
|
|
84
|
-
providerPath: "realtime",
|
|
85
|
-
scope: "channel"
|
|
86
|
-
}),
|
|
87
|
-
createVoiceProviderSecretTarget({
|
|
88
|
-
providerPath: "tts",
|
|
89
|
-
scope: "channel"
|
|
90
|
-
}),
|
|
91
|
-
createVoiceProviderSecretTarget({
|
|
92
|
-
providerPath: "tts.personas.*",
|
|
93
|
-
scope: "channel"
|
|
94
|
-
})
|
|
11
|
+
const secretPaths = [
|
|
12
|
+
"pluralkit.token",
|
|
13
|
+
"token",
|
|
14
|
+
"voice.realtime.providers.*.apiKey",
|
|
15
|
+
"voice.tts.providers.*.apiKey",
|
|
16
|
+
"voice.tts.personas.*.providers.*.apiKey"
|
|
95
17
|
];
|
|
18
|
+
const secretTargetRegistryEntries = createChannelSecretTargetRegistryEntries({
|
|
19
|
+
channelKey: "discord",
|
|
20
|
+
account: secretPaths,
|
|
21
|
+
channel: secretPaths
|
|
22
|
+
}).map((entry) => {
|
|
23
|
+
if (entry.pathPattern.endsWith(".providers.*.apiKey")) entry.providerIdPathSegmentIndex = entry.pathPattern.split(".").length - 2;
|
|
24
|
+
return entry;
|
|
25
|
+
});
|
|
96
26
|
function collectRuntimeConfigAssignments(params) {
|
|
97
27
|
const resolved = getChannelSurface(params.config, "discord");
|
|
98
28
|
if (!resolved) return;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.mjs";
|
|
1
2
|
import { t as isDiscordMutableAllowEntry } from "./security-doctor-nGgPm65L.mjs";
|
|
2
3
|
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
3
4
|
import { readChannelAllowFromStore } from "openclaw/plugin-sdk/conversation-runtime";
|
|
@@ -5,6 +6,7 @@ import { coerceNativeSetting, normalizeAllowFromList } from "openclaw/plugin-sdk
|
|
|
5
6
|
import { isDangerousNameMatchingEnabled } from "openclaw/plugin-sdk/dangerous-name-runtime";
|
|
6
7
|
import { resolveNativeCommandsEnabled, resolveNativeSkillsEnabled } from "openclaw/plugin-sdk/native-command-config-runtime";
|
|
7
8
|
//#region extensions/discord/src/security-audit.ts
|
|
9
|
+
var security_audit_exports = /* @__PURE__ */ __exportAll({ collectDiscordSecurityAuditFindings: () => collectDiscordSecurityAuditFindings });
|
|
8
10
|
function isWildcardEntry(value) {
|
|
9
11
|
return String(value).trim() === "*";
|
|
10
12
|
}
|
|
@@ -143,4 +145,4 @@ async function collectDiscordSecurityAuditFindings(params) {
|
|
|
143
145
|
return findings;
|
|
144
146
|
}
|
|
145
147
|
//#endregion
|
|
146
|
-
export { collectDiscordSecurityAuditFindings as t };
|
|
148
|
+
export { security_audit_exports as n, collectDiscordSecurityAuditFindings as t };
|
|
@@ -1,21 +1,22 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.mjs";
|
|
2
|
+
import { At as deleteChannelPermission, Bt as putChannelPermission, C as withDiscordRequestAuthority, Ct as unpinChannelMessage, Dt as createGuildEmoji, Et as createGuildChannel, Ft as listGuildChannels, Ht as removeGuildMemberRole, It as listGuildEmojis, Lt as listGuildRoles, Mt as getGuildMember, Nt as getGuildVoiceState, Ot as createGuildScheduledEvent, Pt as listGuildActiveThreads, Rt as listGuildScheduledEvents, S as readRetryAfter, St as sendChannelTyping, Tt as createGuildBan, Ut as timeoutGuildMember, Vt as removeGuildMember, _ as DiscordError, _t as listChannelArchivedThreads, at as createOwnMessageReaction, b as readDiscordCode, bt as pinChannelMessage, dt as deleteChannelMessage, ft as editChannel, ht as getChannelMessage, jt as getGuild, kt as createGuildSticker, lt as createThread, mt as getChannel, ot as deleteOwnMessageReaction, pt as editChannelMessage, st as listMessageReactionUsers, tt as stripUndefinedFields, ut as deleteChannel, v as RateLimitError, vt as listChannelMessages, wt as addGuildMemberRole, x as readDiscordMessage, xt as searchGuildMessages, y as isUnknownDiscordVoiceStateError, yt as listChannelPins, zt as moveGuildChannels } from "./discord-0xJYfdDD.mjs";
|
|
3
|
+
import { D as getDiscordEndpointRuntime, O as resolveDiscordEndpointAttachmentGuard, T as parseDiscordRetryAfterBodySeconds } from "./channel-type-DRCrEMss.mjs";
|
|
4
|
+
import { o as parseDiscordHttpErrorBody } from "./api-DVbJwZVt.mjs";
|
|
5
|
+
import { a as recordDiscordMessageCreateAmbiguity, f as createReusableDiscordReplyReference, l as createDiscordSendReceiptFromResults, n as classifyDiscordDeliveryFailure, o as chunkDiscordTextWithMode, p as resolveDiscordReplyMessageId, r as createDiscordRetryRunner, u as createDiscordSendResult } from "./retry-pz_cSha2.mjs";
|
|
6
|
+
import { C as hasAnyChannelPermissionDiscord, D as createDiscordMessageNonce, F as resolveDiscordClientAccountContext, G as parseAndResolveChannelRecipient, I as resolveDiscordRest, L as DISCORD_REST_TIMEOUT_MS, M as createDiscordClient, O as resolveDiscordMessageFlags, S as hasAllGuildPermissionsDiscord, _ as canManageGuildMemberRoleDiscord, a as normalizeEmojiName, b as fetchChannelPermissionsDiscord, c as resolveChannelId, f as sendDiscordText, g as DiscordSendError, h as DISCORD_MAX_STICKER_BYTES, j as resolveDiscordSuppressEmbeds, m as DISCORD_MAX_EVENT_COVER_BYTES, n as buildDiscordTextChunks, o as normalizeReactionEmoji, p as DISCORD_MAX_EMOJI_BYTES, r as buildReactionIdentifier, t as buildDiscordSendError, v as canManageGuildRoleDiscord, w as hasAnyGuildPermissionDiscord, x as fetchMemberGuildPermissionsDiscord, y as canViewDiscordGuildChannel } from "./send.shared-DGFkbkQR.mjs";
|
|
7
|
+
import { i as prepareDiscordOutboundText, n as sendPollDiscord, r as sendStickerDiscord, t as sendMessageDiscord } from "./send.outbound-BISKnb-a.mjs";
|
|
6
8
|
import { n as DISCORD_ATTACHMENT_TOTAL_TIMEOUT_MS } from "./timeouts-D86uWLt_.mjs";
|
|
7
9
|
import fs from "node:fs/promises";
|
|
8
10
|
import { ChannelType } from "discord-api-types/v10";
|
|
9
11
|
import crypto from "node:crypto";
|
|
10
|
-
import { parseStrictFiniteNumber, resolveExpiresAtMsFromDurationMs, timestampMsToIsoString } from "openclaw/plugin-sdk/number-runtime";
|
|
11
12
|
import { expectDefined } from "openclaw/plugin-sdk/expect-runtime";
|
|
13
|
+
import { parseStrictFiniteNumber, resolveExpiresAtMsFromDurationMs, timestampMsToIsoString } from "openclaw/plugin-sdk/number-runtime";
|
|
12
14
|
import { fetchWithSsrFGuard } from "openclaw/plugin-sdk/ssrf-runtime";
|
|
13
15
|
import { formatErrorMessage as formatErrorMessage$1 } from "openclaw/plugin-sdk/error-runtime";
|
|
14
16
|
import { readProviderJsonResponse, readResponseTextLimited } from "openclaw/plugin-sdk/provider-http";
|
|
15
17
|
import { normalizeLowercaseStringOrEmpty, normalizeOptionalLowercaseString, normalizeOptionalString, normalizeStringEntries } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
16
18
|
import { recordChannelActivity } from "openclaw/plugin-sdk/channel-activity-runtime";
|
|
17
19
|
import { requireRuntimeConfig } from "openclaw/plugin-sdk/plugin-config-runtime";
|
|
18
|
-
import { truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
19
20
|
import { recordOutboundMessageIdentity } from "openclaw/plugin-sdk/channel-outbound";
|
|
20
21
|
import { MEDIA_FFMPEG_MAX_AUDIO_DURATION_SECS, buildOutboundMediaLoadOptions, extensionForMime, maxBytesForKind, parseFfprobeCodecAndSampleRate, runFfmpeg, runFfprobe, unlinkIfExists } from "openclaw/plugin-sdk/media-runtime";
|
|
21
22
|
import { loadWebMediaRaw } from "openclaw/plugin-sdk/web-media";
|
|
@@ -26,33 +27,36 @@ import { writeExternalFileWithinRoot } from "openclaw/plugin-sdk/security-runtim
|
|
|
26
27
|
//#region extensions/discord/src/send.channels.ts
|
|
27
28
|
async function createChannelDiscord(payload, opts) {
|
|
28
29
|
const rest = resolveDiscordRest(opts);
|
|
29
|
-
const body = {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
30
|
+
const body = stripUndefinedFields({
|
|
31
|
+
name: payload.name,
|
|
32
|
+
type: payload.type,
|
|
33
|
+
parent_id: payload.parentId || void 0,
|
|
34
|
+
topic: payload.topic || void 0,
|
|
35
|
+
position: payload.position,
|
|
36
|
+
nsfw: payload.nsfw
|
|
37
|
+
});
|
|
35
38
|
return await createGuildChannel(rest, payload.guildId, { body });
|
|
36
39
|
}
|
|
37
40
|
async function editChannelDiscord(payload, opts) {
|
|
38
41
|
const rest = resolveDiscordRest(opts);
|
|
39
|
-
const body = {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
42
|
+
const body = stripUndefinedFields({
|
|
43
|
+
name: payload.name,
|
|
44
|
+
topic: payload.topic,
|
|
45
|
+
position: payload.position,
|
|
46
|
+
parent_id: payload.parentId,
|
|
47
|
+
nsfw: payload.nsfw,
|
|
48
|
+
rate_limit_per_user: payload.rateLimitPerUser,
|
|
49
|
+
archived: payload.archived,
|
|
50
|
+
locked: payload.locked,
|
|
51
|
+
auto_archive_duration: payload.autoArchiveDuration,
|
|
52
|
+
available_tags: payload.availableTags === void 0 ? void 0 : payload.availableTags.map((tag) => stripUndefinedFields({
|
|
53
|
+
id: tag.id,
|
|
54
|
+
name: tag.name,
|
|
55
|
+
moderated: tag.moderated,
|
|
56
|
+
emoji_id: tag.emoji_id,
|
|
57
|
+
emoji_name: tag.emoji_name
|
|
58
|
+
}))
|
|
59
|
+
});
|
|
56
60
|
return await editChannel(rest, payload.channelId, { body });
|
|
57
61
|
}
|
|
58
62
|
async function deleteChannelDiscord(channelId, opts) {
|
|
@@ -75,9 +79,11 @@ async function moveChannelDiscord(payload, opts) {
|
|
|
75
79
|
}
|
|
76
80
|
async function setChannelPermissionDiscord(payload, opts) {
|
|
77
81
|
const rest = resolveDiscordRest(opts);
|
|
78
|
-
const body = {
|
|
79
|
-
|
|
80
|
-
|
|
82
|
+
const body = stripUndefinedFields({
|
|
83
|
+
type: payload.targetType,
|
|
84
|
+
allow: payload.allow,
|
|
85
|
+
deny: payload.deny
|
|
86
|
+
});
|
|
81
87
|
await putChannelPermission(rest, payload.channelId, payload.targetId, { body });
|
|
82
88
|
return { ok: true };
|
|
83
89
|
}
|
|
@@ -434,23 +440,16 @@ async function searchMessagesDiscord(query, opts) {
|
|
|
434
440
|
//#region extensions/discord/src/send.webhook.ts
|
|
435
441
|
const DISCORD_WEBHOOK_ERROR_BODY_LIMIT_BYTES = 8192;
|
|
436
442
|
const DISCORD_WEBHOOK_TIMEOUT_MS = DISCORD_REST_TIMEOUT_MS;
|
|
437
|
-
function coerceWebhookErrorBody(raw) {
|
|
438
|
-
if (!raw) return;
|
|
439
|
-
try {
|
|
440
|
-
return JSON.parse(raw);
|
|
441
|
-
} catch {
|
|
442
|
-
return { message: truncateUtf16Safe(raw, 200) };
|
|
443
|
-
}
|
|
444
|
-
}
|
|
445
443
|
function throwIfWebhookDeadlineExpired(signal) {
|
|
446
444
|
if (!signal?.aborted) return;
|
|
447
445
|
throw signal.reason instanceof Error ? signal.reason : /* @__PURE__ */ new Error("Discord webhook send timed out");
|
|
448
446
|
}
|
|
449
447
|
async function throwWebhookResponseError(response, signal) {
|
|
450
|
-
const
|
|
448
|
+
const raw = await readResponseTextLimited(response, DISCORD_WEBHOOK_ERROR_BODY_LIMIT_BYTES, { chunkTimeoutMs: DISCORD_WEBHOOK_TIMEOUT_MS }).catch(() => {
|
|
451
449
|
throwIfWebhookDeadlineExpired(signal);
|
|
452
450
|
return "";
|
|
453
|
-
})
|
|
451
|
+
});
|
|
452
|
+
const parsed = parseDiscordHttpErrorBody(raw);
|
|
454
453
|
if (response.status === 429) throw new RateLimitError(response, {
|
|
455
454
|
message: readDiscordMessage(parsed, "Rate limited"),
|
|
456
455
|
retry_after: readRetryAfter(parsed, response, 1),
|
|
@@ -565,17 +564,6 @@ async function sendWebhookMessageDiscord(text, opts) {
|
|
|
565
564
|
}
|
|
566
565
|
//#endregion
|
|
567
566
|
//#region extensions/discord/src/voice-message.ts
|
|
568
|
-
/**
|
|
569
|
-
* Discord Voice Message Support
|
|
570
|
-
*
|
|
571
|
-
* Implements sending voice messages via Discord's API.
|
|
572
|
-
* Voice messages require:
|
|
573
|
-
* - OGG/Opus format audio
|
|
574
|
-
* - Waveform data (base64 encoded, up to 256 samples, 0-255 values)
|
|
575
|
-
* - Duration in seconds
|
|
576
|
-
* - Message flag 8192 (IS_VOICE_MESSAGE)
|
|
577
|
-
* - No other content (text, embeds, etc.)
|
|
578
|
-
*/
|
|
579
567
|
const DISCORD_VOICE_MESSAGE_FLAG = 8192;
|
|
580
568
|
const WAVEFORM_SAMPLES = 256;
|
|
581
569
|
const DISCORD_OPUS_SAMPLE_RATE_HZ = 48e3;
|
|
@@ -595,12 +583,6 @@ async function runFfmpegToOutput(params) {
|
|
|
595
583
|
}
|
|
596
584
|
});
|
|
597
585
|
}
|
|
598
|
-
function createRateLimitError(response, body) {
|
|
599
|
-
return new RateLimitError(response, body);
|
|
600
|
-
}
|
|
601
|
-
/**
|
|
602
|
-
* Get audio duration using ffprobe
|
|
603
|
-
*/
|
|
604
586
|
async function getAudioDuration(filePath) {
|
|
605
587
|
try {
|
|
606
588
|
const stdout = await runFfprobe([
|
|
@@ -620,10 +602,6 @@ async function getAudioDuration(filePath) {
|
|
|
620
602
|
throw new Error(`Failed to get audio duration: ${errMessage}`, { cause: err });
|
|
621
603
|
}
|
|
622
604
|
}
|
|
623
|
-
/**
|
|
624
|
-
* Generate waveform data from audio file using ffmpeg
|
|
625
|
-
* Returns base64 encoded byte array of amplitude samples (0-255)
|
|
626
|
-
*/
|
|
627
605
|
async function generateWaveform(filePath) {
|
|
628
606
|
try {
|
|
629
607
|
return await generateWaveformFromPcm(filePath);
|
|
@@ -631,9 +609,6 @@ async function generateWaveform(filePath) {
|
|
|
631
609
|
return generatePlaceholderWaveform();
|
|
632
610
|
}
|
|
633
611
|
}
|
|
634
|
-
/**
|
|
635
|
-
* Generate waveform by extracting raw PCM data and sampling amplitudes
|
|
636
|
-
*/
|
|
637
612
|
async function generateWaveformFromPcm(filePath) {
|
|
638
613
|
const tempDir = resolvePreferredOpenClawTmpDir();
|
|
639
614
|
const tempPcm = path.join(tempDir, `waveform-${crypto.randomUUID()}.raw`);
|
|
@@ -681,9 +656,6 @@ async function generateWaveformFromPcm(filePath) {
|
|
|
681
656
|
await unlinkIfExists(tempPcm);
|
|
682
657
|
}
|
|
683
658
|
}
|
|
684
|
-
/**
|
|
685
|
-
* Generate a placeholder waveform (for when audio processing fails)
|
|
686
|
-
*/
|
|
687
659
|
function generatePlaceholderWaveform() {
|
|
688
660
|
const waveform = [];
|
|
689
661
|
for (let i = 0; i < WAVEFORM_SAMPLES; i++) {
|
|
@@ -760,17 +732,10 @@ async function getVoiceMessageMetadata(filePath) {
|
|
|
760
732
|
await waveform;
|
|
761
733
|
}
|
|
762
734
|
}
|
|
763
|
-
function coerceDiscordErrorBody(raw) {
|
|
764
|
-
if (!raw) return;
|
|
765
|
-
try {
|
|
766
|
-
return JSON.parse(raw);
|
|
767
|
-
} catch {
|
|
768
|
-
return { message: truncateUtf16Safe(raw, 200) };
|
|
769
|
-
}
|
|
770
|
-
}
|
|
771
735
|
async function createVoiceRequestError(response, fallbackMessage) {
|
|
772
|
-
const
|
|
773
|
-
|
|
736
|
+
const raw = await readResponseTextLimited(response, DISCORD_VOICE_ERROR_BODY_LIMIT_BYTES).catch(() => "");
|
|
737
|
+
const parsed = parseDiscordHttpErrorBody(raw);
|
|
738
|
+
if (response.status === 429) throw new RateLimitError(response, {
|
|
774
739
|
message: readDiscordMessage(parsed, "You are being rate limited."),
|
|
775
740
|
retry_after: readRetryAfter(parsed, response, 1),
|
|
776
741
|
global: parsed && typeof parsed === "object" && "global" in parsed ? Boolean(parsed.global) : false
|
|
@@ -836,14 +801,6 @@ async function uploadVoiceAttachment(params) {
|
|
|
836
801
|
await release();
|
|
837
802
|
}
|
|
838
803
|
}
|
|
839
|
-
/**
|
|
840
|
-
* Send a voice message to Discord
|
|
841
|
-
*
|
|
842
|
-
* This follows Discord's voice message protocol:
|
|
843
|
-
* 1. Request upload URL from Discord
|
|
844
|
-
* 2. Upload the OGG file to the provided URL
|
|
845
|
-
* 3. Send the message with flag 8192 and attachment metadata
|
|
846
|
-
*/
|
|
847
804
|
async function sendDiscordVoiceMessage(rest, channelId, audioBuffer, metadata, replyTo, request, silent, token, onPlatformSendDispatch, assertPlatformSendAuthorized) {
|
|
848
805
|
const filename = "voice-message.ogg";
|
|
849
806
|
const fileSize = audioBuffer.byteLength;
|
|
@@ -903,14 +860,6 @@ async function sendDiscordVoiceMessage(rest, channelId, audioBuffer, metadata, r
|
|
|
903
860
|
}
|
|
904
861
|
//#endregion
|
|
905
862
|
//#region extensions/discord/src/send.voice.ts
|
|
906
|
-
function toDiscordSendResult(result, fallbackChannelId, reply) {
|
|
907
|
-
return createDiscordSendResult({
|
|
908
|
-
result,
|
|
909
|
-
fallbackChannelId,
|
|
910
|
-
kind: "voice",
|
|
911
|
-
reply
|
|
912
|
-
});
|
|
913
|
-
}
|
|
914
863
|
async function withMaterializedVoiceMessageInput(mediaUrl, opts, run) {
|
|
915
864
|
const media = await loadWebMediaRaw(mediaUrl, buildOutboundMediaLoadOptions({
|
|
916
865
|
maxBytes: maxBytesForKind("audio"),
|
|
@@ -926,16 +875,7 @@ async function withMaterializedVoiceMessageInput(mediaUrl, opts, run) {
|
|
|
926
875
|
prefix: "voice-src-"
|
|
927
876
|
}, async (workspace) => await run(await workspace.write(`input${ext}`, media.buffer)));
|
|
928
877
|
}
|
|
929
|
-
/**
|
|
930
|
-
* Send a voice message to Discord.
|
|
931
|
-
*
|
|
932
|
-
* Voice messages are a special Discord feature that displays audio with a waveform
|
|
933
|
-
* visualization. They require OGG/Opus format and cannot include text content.
|
|
934
|
-
*
|
|
935
|
-
* @param to - Recipient (user ID for DM or channel ID)
|
|
936
|
-
* @param audioPath - Path to local audio file (will be converted to OGG/Opus if needed)
|
|
937
|
-
* @param opts - Send options
|
|
938
|
-
*/
|
|
878
|
+
/** Discord voice messages require OGG/Opus audio with a waveform and cannot include text. */
|
|
939
879
|
async function sendVoiceMessageDiscord(to, audioPath, opts) {
|
|
940
880
|
return await withDiscordRequestAuthority(opts.assertPlatformSendAuthorized, () => sendVoiceMessageDiscordInternal(to, audioPath, opts));
|
|
941
881
|
}
|
|
@@ -969,7 +909,12 @@ async function sendVoiceMessageDiscordInternal(to, audioPath, opts) {
|
|
|
969
909
|
accountId: accountInfo.accountId,
|
|
970
910
|
direction: "outbound"
|
|
971
911
|
});
|
|
972
|
-
return
|
|
912
|
+
return createDiscordSendResult({
|
|
913
|
+
result,
|
|
914
|
+
fallbackChannelId: channelId,
|
|
915
|
+
kind: "voice",
|
|
916
|
+
reply: opts.reply
|
|
917
|
+
});
|
|
973
918
|
} catch (err) {
|
|
974
919
|
if (channelId && rest && token) throw await buildDiscordSendError(err, {
|
|
975
920
|
channelId,
|
|
@@ -1051,7 +996,7 @@ async function fetchReactionsDiscord(channelId, messageId, opts) {
|
|
|
1051
996
|
emoji: {
|
|
1052
997
|
id: reaction.emoji.id ?? null,
|
|
1053
998
|
name: reaction.emoji.name ?? null,
|
|
1054
|
-
raw:
|
|
999
|
+
raw: identifier
|
|
1055
1000
|
},
|
|
1056
1001
|
count: reaction.count,
|
|
1057
1002
|
users: users.map((user) => ({
|