@openclaw/discord 2026.10.2 → 2026.10.5-beta.2
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/.setup/account-inspect-8cCu6uPG.mjs +31 -0
- package/dist/.setup/{accounts-HE9-mj1L.mjs → accounts-ljrzXBJi.mjs} +47 -45
- package/dist/.setup/{allow-list-vxkG9_JD.mjs → allow-list-B_ToXtew.mjs} +34 -101
- package/dist/.setup/{api-DlNUkDqj.mjs → api-CtmE1OUN.mjs} +25 -31
- package/dist/.setup/{approval-handler.runtime-DmnEa54W.mjs → approval-handler.runtime-D7FoZSn0.mjs} +30 -53
- package/dist/.setup/{approval-message-updates-B0jdSqOj.mjs → approval-message-updates-CIGByUcE.mjs} +2 -2
- package/dist/.setup/{audit-BpikUwN_.mjs → audit-zSawfbsN.mjs} +5 -8
- package/dist/.setup/{channel-Dr-AUnGt.mjs → channel-DI7DMzu0.mjs} +136 -215
- package/dist/.setup/{channel-access-BRp3Y-rF.mjs → channel-access-DasWY_OV.mjs} +6 -7
- package/dist/.setup/{channel.setup-BmNvkidb.mjs → channel.setup-DdFVN1mr.mjs} +35 -64
- package/dist/.setup/{components-DLJR0xU-.mjs → components-HN9052L1.mjs} +123 -146
- package/dist/.setup/{config-schema-BQWfnSCx.mjs → config-schema-_uBILpQf.mjs} +7 -3
- package/dist/.setup/{conversation-binding-route-DicJC1Lj.mjs → conversation-binding-route-DTjCBx-O.mjs} +1 -1
- package/dist/.setup/{directory-config-gqsdcplU.mjs → directory-config-3iVub-3m.mjs} +1 -1
- package/dist/.setup/{directory-live-Bipr0eUJ.mjs → directory-live-DLygQVtW.mjs} +18 -22
- package/dist/.setup/{discord-9gysrhzp.mjs → discord-BGqgx-yd.mjs} +686 -854
- package/dist/.setup/{doctor-B2bskDcF.mjs → doctor-DSrNJ7m2.mjs} +36 -47
- package/dist/.setup/{doctor-contract-Bg3NPAMw.mjs → doctor-contract-Bwv8EuQ_.mjs} +7 -16
- package/dist/.setup/{handle-action-UmkjXBfo.mjs → handle-action-CXH1h1tq.mjs} +25 -38
- package/dist/.setup/{handle-action.guild-admin-CB4sc9VV.mjs → handle-action.guild-admin-CHKW6PIs.mjs} +25 -31
- package/dist/.setup/{live-policy-config-VxexfRKo.mjs → live-policy-config-BPoB3eQi.mjs} +1 -1
- package/dist/.setup/{message-handler-BK69A-NB.mjs → message-handler-Ii_etru1.mjs} +9 -14
- package/dist/.setup/{message-handler.preflight-DFpsh90H.mjs → message-handler.preflight-C7YuSRl_.mjs} +79 -128
- package/dist/.setup/{message-handler.preflight-pluralkit-BXGGVmpe.mjs → message-handler.preflight-pluralkit-C3iAG--b.mjs} +6 -6
- package/dist/.setup/{message-handler.process-TKoqcqIP.mjs → message-handler.process-ClgWYH6o.mjs} +234 -206
- package/dist/.setup/{outbound-adapter-D4wRAb5S.mjs → outbound-adapter-D8OOIuKn.mjs} +73 -112
- package/dist/.setup/{outbound-session-route-BvBH4LC6.mjs → outbound-session-route-B0Hpwn3Q.mjs} +57 -115
- package/dist/.setup/output-activity-uBpMSX75.mjs +11 -0
- package/dist/.setup/{pluralkit-a6_NLfH9.mjs → pluralkit-B64dfq_j.mjs} +3 -1
- package/dist/.setup/{preflight-audio-DHGIHEpv.mjs → preflight-audio-wWgsZG5F.mjs} +1 -5
- package/dist/.setup/{presence-cache-Dg3_dADn.mjs → presence-cache-DCeTsL73.mjs} +3 -6
- package/dist/.setup/{probe-BwSKpnZf.mjs → probe-D3P1x4aN.mjs} +10 -18
- package/dist/.setup/{provider-YP8gN9_o.mjs → provider-D9EzOfG8.mjs} +2990 -3903
- package/dist/.setup/{provider-session.runtime-D1gkPxHT.mjs → provider-session.runtime-CsnRvddI.mjs} +5 -5
- package/dist/.setup/provider.runtime-BQVcM7Pg.mjs +2 -0
- package/dist/.setup/{realtime-session.runtime-BKUQBy1u.mjs → realtime-session.runtime-CxGBk8H-.mjs} +69 -98
- package/dist/.setup/{receive-recovery-DgkX7Qvi.mjs → receive-recovery-eVmK2_hl.mjs} +2 -12
- package/dist/.setup/resolve-allowlist-common-DNSsUQRF.mjs +66 -0
- package/dist/.setup/resolve-channels-UdT38DzU.mjs +173 -0
- package/dist/.setup/{resolve-users-DNrwvunm.mjs → resolve-users-DnCsrXZ_.mjs} +12 -41
- package/dist/.setup/{runtime-CESTexGn.mjs → runtime-CRTkKU1G.mjs} +202 -313
- package/dist/.setup/{runtime-DPcmPST9.mjs → runtime-DPm3gZXk.mjs} +2 -2
- package/dist/.setup/{secret-config-contract-uOE2J7yM.mjs → secret-config-contract-CIsH7R3B.mjs} +9 -18
- package/dist/.setup/{security-audit-D42cp5N7.mjs → security-audit-BFT84Uny.mjs} +1 -2
- package/dist/.setup/security-contract-DNyyjTZZ.mjs +19 -0
- package/dist/.setup/{send-CJk3VP5q.mjs → send-DbILKgcm.mjs} +184 -241
- package/dist/.setup/{send.components-dPljuV24.mjs → send.components-FxOS3CeP.mjs} +47 -63
- package/dist/.setup/{send.outbound-rOboMO_6.mjs → send.outbound-_jx4Xpd3.mjs} +178 -202
- package/dist/.setup/{send.receipt-DVOg2Oaw.mjs → send.receipt-BAlzXd8e.mjs} +33 -109
- package/dist/.setup/{send.shared-C4CN24D9.mjs → send.shared-CjQ4jbMA.mjs} +97 -153
- package/dist/.setup/{sender-identity-AHpUNr72.mjs → sender-identity-BNBvGt1l.mjs} +1 -1
- package/dist/.setup/setup-plugin-api-xfOFmxHP.mjs +3 -0
- package/dist/.setup/{shared-BoBnM5kM.mjs → shared-CestGDpq.mjs} +30 -20
- package/dist/.setup/{subagent-hooks-HH8Uy9cx.mjs → subagent-hooks-CME7dSGf.mjs} +5 -10
- package/dist/.setup/{system-events-Cwxaww8i.mjs → system-events-BwwSDCw4.mjs} +2 -2
- package/dist/.setup/target-parsing-C-HyNxcE.mjs +48 -0
- package/dist/.setup/{target-resolver-CSFoPQ12.mjs → target-resolver-Bse8fuTi.mjs} +11 -27
- package/dist/.setup/targets-DZJjkzwv.mjs +3 -0
- package/dist/.setup/{thread-bindings-DjQCkmsd.mjs → thread-bindings-0hPTSK14.mjs} +61 -52
- package/dist/.setup/{thread-bindings.manager-D2-GYZ5s.mjs → thread-bindings.manager-CdNa6UIs.mjs} +138 -211
- package/dist/.setup/{thread-bindings.session-updates-Bu_CGr_O.mjs → thread-bindings.session-updates-DGSljVf6.mjs} +60 -99
- package/dist/.setup/threading-BKe3E3tp.mjs +246 -0
- package/dist/.setup/{timeouts-pun7VJ02.mjs → timeouts-CuNARfyw.mjs} +10 -18
- package/dist/.setup/{transcripts-source-CaZQnGRH.mjs → transcripts-source-0qQYVu2H.mjs} +50 -368
- package/dist/.setup/{voice-runtime-DDymtIw8.mjs → voice-runtime-QlZJ4sHv.mjs} +166 -322
- package/dist/account-inspect-api.js +1 -1
- package/dist/action-runtime-api.js +1 -1
- package/dist/activities-api.js +77 -120
- package/dist/api.js +19 -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 +1 -1
- package/dist/runtime-api.js +21 -20
- package/dist/secret-contract-api.js +1 -1
- package/dist/security-audit-contract-api.js +1 -1
- package/dist/security-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 +38 -57
- package/dist/subagent-hooks-api.js +1 -1
- package/dist/transcripts-source-api.js +1 -1
- package/node_modules/@types/node/README.md +1 -1
- package/node_modules/@types/node/crypto.d.ts +2 -2
- package/node_modules/@types/node/dgram.d.ts +1 -1
- package/node_modules/@types/node/package.json +2 -2
- package/node_modules/@types/node/zlib.d.ts +6 -0
- package/node_modules/@types/ws/README.md +1 -1
- package/node_modules/@types/ws/index.d.mts +4 -0
- package/node_modules/@types/ws/index.d.ts +4 -0
- package/node_modules/@types/ws/package.json +3 -3
- package/node_modules/discord-api-types/_generated_/rest/v10/interfaces.d.ts +21 -0
- package/node_modules/discord-api-types/_generated_/rest/v10/interfaces.d.ts.map +1 -1
- package/node_modules/discord-api-types/_generated_/rest/v9/interfaces.d.ts +21 -0
- package/node_modules/discord-api-types/_generated_/rest/v9/interfaces.d.ts.map +1 -1
- package/node_modules/discord-api-types/globals.d.ts +6 -0
- package/node_modules/discord-api-types/globals.d.ts.map +1 -1
- package/node_modules/discord-api-types/globals.js +6 -0
- package/node_modules/discord-api-types/globals.js.map +1 -1
- package/node_modules/discord-api-types/package.json +3 -3
- package/node_modules/discord-api-types/payloads/index.mjs +1 -0
- package/node_modules/discord-api-types/payloads/v10/applicationIdentityProfile.d.ts +207 -0
- package/node_modules/discord-api-types/payloads/v10/applicationIdentityProfile.d.ts.map +1 -0
- package/node_modules/discord-api-types/payloads/v10/applicationIdentityProfile.js +25 -0
- package/node_modules/discord-api-types/payloads/v10/applicationIdentityProfile.js.map +1 -0
- package/node_modules/discord-api-types/payloads/v10/autoModeration.d.ts +1 -1
- package/node_modules/discord-api-types/payloads/v10/autoModeration.d.ts.map +1 -1
- package/node_modules/discord-api-types/payloads/v10/guild.d.ts +27 -23
- package/node_modules/discord-api-types/payloads/v10/guild.d.ts.map +1 -1
- package/node_modules/discord-api-types/payloads/v10/guild.js +26 -22
- package/node_modules/discord-api-types/payloads/v10/guild.js.map +1 -1
- package/node_modules/discord-api-types/payloads/v10/index.d.ts +1 -0
- package/node_modules/discord-api-types/payloads/v10/index.d.ts.map +1 -1
- package/node_modules/discord-api-types/payloads/v10/index.js +1 -0
- package/node_modules/discord-api-types/payloads/v10/index.js.map +1 -1
- package/node_modules/discord-api-types/payloads/v10/index.mjs +1 -0
- package/node_modules/discord-api-types/payloads/v9/applicationIdentityProfile.d.ts +207 -0
- package/node_modules/discord-api-types/payloads/v9/applicationIdentityProfile.d.ts.map +1 -0
- package/node_modules/discord-api-types/payloads/v9/applicationIdentityProfile.js +25 -0
- package/node_modules/discord-api-types/payloads/v9/applicationIdentityProfile.js.map +1 -0
- package/node_modules/discord-api-types/payloads/v9/autoModeration.d.ts +1 -1
- package/node_modules/discord-api-types/payloads/v9/autoModeration.d.ts.map +1 -1
- package/node_modules/discord-api-types/payloads/v9/guild.d.ts +27 -23
- package/node_modules/discord-api-types/payloads/v9/guild.d.ts.map +1 -1
- package/node_modules/discord-api-types/payloads/v9/guild.js +26 -22
- package/node_modules/discord-api-types/payloads/v9/guild.js.map +1 -1
- package/node_modules/discord-api-types/payloads/v9/index.d.ts +1 -0
- package/node_modules/discord-api-types/payloads/v9/index.d.ts.map +1 -1
- package/node_modules/discord-api-types/payloads/v9/index.js +1 -0
- package/node_modules/discord-api-types/payloads/v9/index.js.map +1 -1
- package/node_modules/discord-api-types/payloads/v9/index.mjs +1 -0
- package/node_modules/discord-api-types/rest/common.d.ts +2 -0
- package/node_modules/discord-api-types/rest/common.d.ts.map +1 -1
- package/node_modules/discord-api-types/rest/common.js +2 -0
- package/node_modules/discord-api-types/rest/common.js.map +1 -1
- package/node_modules/discord-api-types/rest/v10/applicationIdentityProfile.d.ts +70 -0
- package/node_modules/discord-api-types/rest/v10/applicationIdentityProfile.d.ts.map +1 -0
- package/node_modules/discord-api-types/rest/v10/applicationIdentityProfile.js +3 -0
- package/node_modules/discord-api-types/rest/v10/applicationIdentityProfile.js.map +1 -0
- package/node_modules/discord-api-types/rest/v10/index.d.ts +1 -0
- package/node_modules/discord-api-types/rest/v10/index.d.ts.map +1 -1
- package/node_modules/discord-api-types/rest/v10/index.js +29 -0
- package/node_modules/discord-api-types/rest/v10/index.js.map +1 -1
- package/node_modules/discord-api-types/rest/v10/interactions.d.ts +4 -2
- package/node_modules/discord-api-types/rest/v10/interactions.d.ts.map +1 -1
- package/node_modules/discord-api-types/rest/v10/user.d.ts +2 -2
- package/node_modules/discord-api-types/rest/v10/user.d.ts.map +1 -1
- package/node_modules/discord-api-types/rest/v9/applicationIdentityProfile.d.ts +70 -0
- package/node_modules/discord-api-types/rest/v9/applicationIdentityProfile.d.ts.map +1 -0
- package/node_modules/discord-api-types/rest/v9/applicationIdentityProfile.js +3 -0
- package/node_modules/discord-api-types/rest/v9/applicationIdentityProfile.js.map +1 -0
- package/node_modules/discord-api-types/rest/v9/index.d.ts +1 -0
- package/node_modules/discord-api-types/rest/v9/index.d.ts.map +1 -1
- package/node_modules/discord-api-types/rest/v9/index.js +29 -0
- package/node_modules/discord-api-types/rest/v9/index.js.map +1 -1
- package/node_modules/discord-api-types/rest/v9/interactions.d.ts +4 -2
- package/node_modules/discord-api-types/rest/v9/interactions.d.ts.map +1 -1
- package/node_modules/discord-api-types/rest/v9/user.d.ts +2 -2
- package/node_modules/discord-api-types/rest/v9/user.d.ts.map +1 -1
- package/node_modules/discord-api-types/v10.mjs +1 -0
- package/node_modules/discord-api-types/v9.mjs +1 -0
- package/node_modules/micromark/dev/lib/compile.d.ts.map +1 -1
- package/node_modules/micromark/dev/lib/compile.js +14 -4
- package/node_modules/micromark/dev/lib/create-tokenizer.d.ts.map +1 -1
- package/node_modules/micromark/dev/lib/create-tokenizer.js +7 -6
- package/node_modules/micromark/dev/lib/initialize/document.js +25 -21
- package/node_modules/micromark/dev/lib/initialize/text.d.ts.map +1 -1
- package/node_modules/micromark/dev/lib/initialize/text.js +10 -6
- package/node_modules/micromark/dev/lib/preprocess.d.ts.map +1 -1
- package/node_modules/micromark/dev/lib/preprocess.js +19 -21
- package/node_modules/micromark/lib/compile.d.ts.map +1 -1
- package/node_modules/micromark/lib/compile.js +37 -29
- package/node_modules/micromark/lib/create-tokenizer.d.ts.map +1 -1
- package/node_modules/micromark/lib/create-tokenizer.js +37 -35
- package/node_modules/micromark/lib/initialize/document.js +21 -13
- package/node_modules/micromark/lib/initialize/text.d.ts.map +1 -1
- package/node_modules/micromark/lib/initialize/text.js +7 -3
- package/node_modules/micromark/lib/preprocess.d.ts.map +1 -1
- package/node_modules/micromark/lib/preprocess.js +16 -19
- package/node_modules/micromark/package.json +2 -15
- package/node_modules/micromark-core-commonmark/dev/lib/attention.js +18 -24
- package/node_modules/micromark-core-commonmark/dev/lib/code-fenced.d.ts.map +1 -1
- package/node_modules/micromark-core-commonmark/dev/lib/code-fenced.js +1 -43
- package/node_modules/micromark-core-commonmark/dev/lib/code-indented.js +19 -43
- package/node_modules/micromark-core-commonmark/dev/lib/heading-atx.js +2 -6
- package/node_modules/micromark-core-commonmark/dev/lib/html-flow.d.ts.map +1 -1
- package/node_modules/micromark-core-commonmark/dev/lib/html-flow.js +2 -53
- package/node_modules/micromark-core-commonmark/dev/lib/label-end.js +14 -12
- package/node_modules/micromark-core-commonmark/dev/lib/label-start-image.d.ts.map +1 -1
- package/node_modules/micromark-core-commonmark/dev/lib/label-start-image.js +14 -5
- package/node_modules/micromark-core-commonmark/dev/lib/label-start-link.d.ts.map +1 -1
- package/node_modules/micromark-core-commonmark/dev/lib/label-start-link.js +14 -5
- package/node_modules/micromark-core-commonmark/dev/lib/partial-non-lazy-continuation.d.ts +4 -0
- package/node_modules/micromark-core-commonmark/dev/lib/partial-non-lazy-continuation.d.ts.map +1 -0
- package/node_modules/micromark-core-commonmark/dev/lib/partial-non-lazy-continuation.js +67 -0
- package/node_modules/micromark-core-commonmark/dev/lib/setext-underline.d.ts.map +1 -1
- package/node_modules/micromark-core-commonmark/dev/lib/setext-underline.js +8 -5
- package/node_modules/micromark-core-commonmark/lib/attention.js +14 -24
- package/node_modules/micromark-core-commonmark/lib/code-fenced.d.ts.map +1 -1
- package/node_modules/micromark-core-commonmark/lib/code-fenced.js +1 -39
- package/node_modules/micromark-core-commonmark/lib/code-indented.js +11 -29
- package/node_modules/micromark-core-commonmark/lib/heading-atx.js +2 -6
- package/node_modules/micromark-core-commonmark/lib/html-flow.d.ts.map +1 -1
- package/node_modules/micromark-core-commonmark/lib/html-flow.js +2 -51
- package/node_modules/micromark-core-commonmark/lib/label-end.js +11 -10
- package/node_modules/micromark-core-commonmark/lib/label-start-image.d.ts.map +1 -1
- package/node_modules/micromark-core-commonmark/lib/label-start-image.js +11 -3
- package/node_modules/micromark-core-commonmark/lib/label-start-link.d.ts.map +1 -1
- package/node_modules/micromark-core-commonmark/lib/label-start-link.js +11 -3
- package/node_modules/micromark-core-commonmark/lib/partial-non-lazy-continuation.d.ts +4 -0
- package/node_modules/micromark-core-commonmark/lib/partial-non-lazy-continuation.d.ts.map +1 -0
- package/node_modules/micromark-core-commonmark/lib/partial-non-lazy-continuation.js +61 -0
- package/node_modules/micromark-core-commonmark/lib/setext-underline.d.ts.map +1 -1
- package/node_modules/micromark-core-commonmark/lib/setext-underline.js +7 -5
- package/node_modules/micromark-core-commonmark/package.json +4 -16
- package/node_modules/micromark-factory-space/dev/index.d.ts +24 -1
- package/node_modules/micromark-factory-space/dev/index.d.ts.map +1 -1
- package/node_modules/micromark-factory-space/dev/index.js +58 -3
- package/node_modules/micromark-factory-space/index.d.ts +24 -1
- package/node_modules/micromark-factory-space/index.d.ts.map +1 -1
- package/node_modules/micromark-factory-space/index.js +55 -3
- package/node_modules/micromark-factory-space/package.json +1 -10
- package/node_modules/micromark-factory-space/readme.md +25 -25
- package/node_modules/micromark-util-edit-map/dev/index.d.ts +78 -0
- package/node_modules/micromark-util-edit-map/dev/index.d.ts.map +1 -0
- package/node_modules/micromark-util-edit-map/dev/index.js +237 -0
- package/node_modules/micromark-util-edit-map/index.d.ts +78 -0
- package/node_modules/micromark-util-edit-map/index.d.ts.map +1 -0
- package/node_modules/micromark-util-edit-map/index.js +225 -0
- package/node_modules/micromark-util-edit-map/license +22 -0
- package/node_modules/micromark-util-edit-map/package.json +48 -0
- package/node_modules/micromark-util-edit-map/readme.md +234 -0
- package/node_modules/micromark-util-types/index.d.ts +6 -3
- package/node_modules/micromark-util-types/package.json +2 -36
- package/node_modules/ws/lib/websocket.js +17 -3
- package/node_modules/ws/package.json +1 -1
- package/openclaw.plugin.json +3 -6
- package/package.json +7 -12
- package/dist/.setup/account-inspect-DsER5ILV.mjs +0 -45
- package/dist/.setup/provider.runtime-CZ51OIgD.mjs +0 -2
- package/dist/.setup/resolve-allowlist-common-BUyU3C-T.mjs +0 -27
- package/dist/.setup/resolve-channels-DA6QlhZN.mjs +0 -246
- package/dist/.setup/security-contract-DSHk7I2w.mjs +0 -26
- package/dist/.setup/setup-plugin-api-BVlCz3fm.mjs +0 -3
- package/dist/.setup/targets-bqXQENmX.mjs +0 -3
- package/dist/control-ui/2afbdab1d3aa65a789d8a3eba666f4b1ec5df07073538fe30d6cf32093a1fb2d/index.js +0 -1
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { t as createDiscordActionGate } from "./accounts-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { t as createDiscordActionGate } from "./accounts-ljrzXBJi.mjs";
|
|
2
|
+
import { d as normalizeDiscordMessagingTarget, f as normalizeDiscordOutboundTarget, g as hasDiscordMessageCreateAmbiguity, i as toDiscordOutboundDeliveryResult, n as createDiscordSendReceiptFromResults, p as canFallbackDiscordWebhookSend, s as resolveDiscordReplyReference, t as createDiscordSendReceipt, v as chunkDiscordTextWithMode } from "./send.receipt-BAlzXd8e.mjs";
|
|
3
|
+
import { t as parseDiscordTarget } from "./target-parsing-C-HyNxcE.mjs";
|
|
4
|
+
import { a as resolveDiscordComponentSpec, b as discordInboundEventDelivery, c as formatDiscordApprovalDisplayValue, g as resolveDiscordCurrentConversationIdentity, n as DISCORD_PRESENTATION_CAPABILITIES, o as sendDiscordComponentMessageLazy, r as buildDiscordPresentationPayload, x as notifyDiscordInboundEventOutboundPayloadSuccess } from "./outbound-session-route-B0Hpwn3Q.mjs";
|
|
4
5
|
import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
|
|
5
6
|
import { createSubsystemLogger } from "openclaw/plugin-sdk/runtime-env";
|
|
6
|
-
import { normalizeLowercaseStringOrEmpty, normalizeOptionalString, normalizeOptionalStringifiedId } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
7
|
+
import { asOptionalRecord, normalizeLowercaseStringOrEmpty, normalizeOptionalString, normalizeOptionalStringifiedId } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
7
8
|
import { getReplyPayloadTtsSupplement, resolvePayloadMediaUrls, sendPayloadMediaSequenceOrFallback, sendTextMediaPayload } from "openclaw/plugin-sdk/reply-payload";
|
|
8
9
|
import { expectDefined } from "openclaw/plugin-sdk/expect-runtime";
|
|
9
10
|
import { truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
@@ -54,9 +55,7 @@ function resolveDiscordConversationIdFromTargets(targets) {
|
|
|
54
55
|
}
|
|
55
56
|
}
|
|
56
57
|
function parseDiscordParentChannelFromSessionKey(raw) {
|
|
57
|
-
const
|
|
58
|
-
if (!sessionKey) return;
|
|
59
|
-
const match = sessionKey.match(/(?:^|:)channel:([^:]+)$/);
|
|
58
|
+
const match = normalizeLowercaseStringOrEmpty(raw).match(/(?:^|:)channel:([^:]+)$/);
|
|
60
59
|
return match?.[1] ? `channel:${match[1]}` : void 0;
|
|
61
60
|
}
|
|
62
61
|
function resolveDiscordCommandConversation(params) {
|
|
@@ -111,46 +110,34 @@ const DISCORD_VIDEO_MEDIA_EXTENSIONS = [
|
|
|
111
110
|
".mp4",
|
|
112
111
|
".webm"
|
|
113
112
|
];
|
|
114
|
-
function
|
|
113
|
+
function isLikelyDiscordVideoMedia(mediaUrl) {
|
|
115
114
|
const trimmed = mediaUrl.trim();
|
|
116
|
-
if (!trimmed) return
|
|
115
|
+
if (!trimmed) return false;
|
|
116
|
+
let path;
|
|
117
117
|
try {
|
|
118
|
-
const
|
|
119
|
-
|
|
118
|
+
const { pathname } = new URL(trimmed);
|
|
119
|
+
path = pathname.slice(pathname.lastIndexOf("/") + 1);
|
|
120
120
|
try {
|
|
121
|
-
|
|
122
|
-
} catch {
|
|
123
|
-
return normalizeLowercaseStringOrEmpty(fileName);
|
|
124
|
-
}
|
|
121
|
+
path = decodeURIComponent(path);
|
|
122
|
+
} catch {}
|
|
125
123
|
} catch {
|
|
126
|
-
|
|
127
|
-
const withoutQuery = withoutHash.split("?", 1)[0] ?? withoutHash;
|
|
128
|
-
return normalizeLowercaseStringOrEmpty(withoutQuery);
|
|
124
|
+
path = trimmed.split(/[?#]/, 1)[0] ?? trimmed;
|
|
129
125
|
}
|
|
130
|
-
|
|
131
|
-
function isLikelyDiscordVideoMedia(mediaUrl) {
|
|
132
|
-
const normalized = normalizeMediaPathForExtension(mediaUrl);
|
|
126
|
+
const normalized = normalizeLowercaseStringOrEmpty(path);
|
|
133
127
|
return DISCORD_VIDEO_MEDIA_EXTENSIONS.some((ext) => normalized.endsWith(ext));
|
|
134
128
|
}
|
|
135
129
|
//#endregion
|
|
136
130
|
//#region extensions/discord/src/outbound-approval.ts
|
|
137
|
-
function hasApprovalChannelData(payload) {
|
|
138
|
-
const channelData = payload.channelData;
|
|
139
|
-
if (!channelData || typeof channelData !== "object" || Array.isArray(channelData)) return false;
|
|
140
|
-
return Boolean(channelData.execApproval);
|
|
141
|
-
}
|
|
142
|
-
function neutralizeDiscordApprovalMentions(value) {
|
|
143
|
-
return value.replace(/@everyone/gi, "@everyone").replace(/@here/gi, "@here").replace(/<@/g, "<@").replace(/<#/g, "<#");
|
|
144
|
-
}
|
|
145
131
|
function normalizeDiscordApprovalPayload(payload) {
|
|
146
|
-
|
|
132
|
+
if (!asOptionalRecord(payload.channelData)?.execApproval || !payload.text) return payload;
|
|
133
|
+
return {
|
|
147
134
|
...payload,
|
|
148
|
-
text:
|
|
149
|
-
}
|
|
135
|
+
text: payload.text.replace(/@everyone/gi, "@everyone").replace(/@here/gi, "@here").replace(/<@/g, "<@").replace(/<#/g, "<#")
|
|
136
|
+
};
|
|
150
137
|
}
|
|
151
138
|
//#endregion
|
|
152
139
|
//#region extensions/discord/src/outbound-send-context.ts
|
|
153
|
-
const loadDiscordSendRuntime = createLazyRuntimeModule(() => import("./send-
|
|
140
|
+
const loadDiscordSendRuntime = createLazyRuntimeModule(() => import("./send-DbILKgcm.mjs").then((n) => n.t));
|
|
154
141
|
function resolveDiscordFormattingOptions(ctx) {
|
|
155
142
|
const formatting = ctx.formatting;
|
|
156
143
|
return {
|
|
@@ -192,39 +179,33 @@ function createDiscordUnknownPayloadResult(target) {
|
|
|
192
179
|
})
|
|
193
180
|
};
|
|
194
181
|
}
|
|
195
|
-
function
|
|
196
|
-
|
|
182
|
+
async function sendDiscordOutboundPayload(params) {
|
|
183
|
+
const ctx = params.ctx;
|
|
184
|
+
const payload = normalizeDiscordApprovalPayload({
|
|
185
|
+
...ctx.payload,
|
|
186
|
+
text: ctx.payload.text ?? ""
|
|
187
|
+
});
|
|
188
|
+
const mediaUrls = resolvePayloadMediaUrls(payload);
|
|
189
|
+
const sendContext = await createDiscordPayloadSendContext(ctx);
|
|
190
|
+
const deliveryOptions = (reply = sendContext.resolveReply()) => ({
|
|
197
191
|
reply,
|
|
198
192
|
accountId: ctx.accountId ?? void 0,
|
|
199
193
|
silent: ctx.silent ?? void 0,
|
|
200
194
|
cfg: ctx.cfg,
|
|
201
195
|
onPlatformSendDispatch: ctx.onPlatformSendDispatch,
|
|
202
196
|
assertPlatformSendAuthorized: ctx.assertDirectAdapterHandoff
|
|
203
|
-
};
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
return {
|
|
207
|
-
...resolveDiscordDeliveryOptions$1(ctx, sendContext, reply),
|
|
197
|
+
});
|
|
198
|
+
const formattedDeliveryOptions = (reply = sendContext.resolveReply()) => ({
|
|
199
|
+
...deliveryOptions(reply),
|
|
208
200
|
...sendContext.formatting
|
|
209
|
-
};
|
|
210
|
-
|
|
211
|
-
function resolveDiscordMediaDeliveryOptions(ctx, sendContext, mediaUrl) {
|
|
212
|
-
return {
|
|
201
|
+
});
|
|
202
|
+
const mediaDeliveryOptions = (mediaUrl) => ({
|
|
213
203
|
mediaUrl,
|
|
214
204
|
mediaAccess: ctx.mediaAccess,
|
|
215
205
|
mediaLocalRoots: ctx.mediaLocalRoots,
|
|
216
206
|
mediaReadFile: ctx.mediaReadFile,
|
|
217
|
-
...
|
|
218
|
-
};
|
|
219
|
-
}
|
|
220
|
-
async function sendDiscordOutboundPayload(params) {
|
|
221
|
-
const ctx = params.ctx;
|
|
222
|
-
const payload = normalizeDiscordApprovalPayload({
|
|
223
|
-
...ctx.payload,
|
|
224
|
-
text: ctx.payload.text ?? ""
|
|
207
|
+
...formattedDeliveryOptions()
|
|
225
208
|
});
|
|
226
|
-
const mediaUrls = resolvePayloadMediaUrls(payload);
|
|
227
|
-
const sendContext = await createDiscordPayloadSendContext(ctx);
|
|
228
209
|
const payloadContext = {
|
|
229
210
|
...ctx,
|
|
230
211
|
payload
|
|
@@ -261,7 +242,7 @@ async function sendDiscordOutboundPayload(params) {
|
|
|
261
242
|
try {
|
|
262
243
|
const voiceUrl = expectDefined(mediaUrls.at(0), "non-empty Discord voice media URLs");
|
|
263
244
|
lastResult = await sendContext.sendVoice(sendContext.target, voiceUrl, {
|
|
264
|
-
...
|
|
245
|
+
...deliveryOptions(voiceReply),
|
|
265
246
|
mediaAccess: ctx.mediaAccess,
|
|
266
247
|
mediaLocalRoots: ctx.mediaLocalRoots,
|
|
267
248
|
mediaReadFile: ctx.mediaReadFile
|
|
@@ -276,23 +257,23 @@ async function sendDiscordOutboundPayload(params) {
|
|
|
276
257
|
log$1.warn("discord voice send failed; continuing without voice", { error: err });
|
|
277
258
|
if (fallbackText) await sendContext.send(sendContext.target, fallbackText, {
|
|
278
259
|
verbose: false,
|
|
279
|
-
...
|
|
260
|
+
...formattedDeliveryOptions(voiceReply),
|
|
280
261
|
onDeliveryResult
|
|
281
262
|
});
|
|
282
263
|
voiceFailure = { error: err };
|
|
283
264
|
}
|
|
284
265
|
if (!voiceFailure) {
|
|
285
|
-
await
|
|
266
|
+
await onDeliveryResult(lastResult);
|
|
286
267
|
if (payload.text?.trim()) lastResult = await sendContext.send(sendContext.target, payload.text, {
|
|
287
268
|
verbose: false,
|
|
288
|
-
...
|
|
269
|
+
...formattedDeliveryOptions(),
|
|
289
270
|
onDeliveryResult
|
|
290
271
|
});
|
|
291
272
|
}
|
|
292
273
|
for (const mediaUrl of mediaUrls.slice(1)) try {
|
|
293
274
|
lastResult = await sendContext.send(sendContext.target, "", {
|
|
294
275
|
verbose: false,
|
|
295
|
-
...
|
|
276
|
+
...mediaDeliveryOptions(mediaUrl),
|
|
296
277
|
onDeliveryResult
|
|
297
278
|
});
|
|
298
279
|
} catch (err) {
|
|
@@ -302,59 +283,46 @@ async function sendDiscordOutboundPayload(params) {
|
|
|
302
283
|
if (voiceFailure) throw voiceFailure.error;
|
|
303
284
|
return completeDelivery(lastResult);
|
|
304
285
|
}
|
|
305
|
-
const discordData = payload.channelData?.discord
|
|
286
|
+
const discordData = asOptionalRecord(payload.channelData?.discord) ?? {};
|
|
306
287
|
const filename = normalizeOptionalString(discordData.filename);
|
|
307
288
|
const componentSpec = await resolveDiscordComponentSpec(payload);
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
sendNoMedia: async () => await sendContext.send(sendContext.target, payload.text ?? "", {
|
|
316
|
-
verbose: false,
|
|
317
|
-
components: nativeComponents,
|
|
318
|
-
embeds,
|
|
319
|
-
filename,
|
|
320
|
-
...resolveDiscordFormattedDeliveryOptions(ctx, sendContext),
|
|
321
|
-
onDeliveryResult
|
|
322
|
-
}),
|
|
323
|
-
send: async ({ text, mediaUrl, isFirst }) => await sendContext.send(sendContext.target, text, {
|
|
324
|
-
verbose: false,
|
|
325
|
-
...resolveDiscordMediaDeliveryOptions(ctx, sendContext, mediaUrl),
|
|
326
|
-
components: isFirst ? nativeComponents : void 0,
|
|
327
|
-
embeds: isFirst ? embeds : void 0,
|
|
328
|
-
filename: isFirst ? filename : void 0,
|
|
329
|
-
onDeliveryResult
|
|
330
|
-
})
|
|
331
|
-
}));
|
|
332
|
-
return completeResult(await sendTextMediaPayload({
|
|
333
|
-
channel: "discord",
|
|
334
|
-
ctx: payloadContext,
|
|
335
|
-
adapter: params.fallbackAdapter
|
|
336
|
-
}));
|
|
337
|
-
}
|
|
289
|
+
const nativeComponents = !componentSpec && Array.isArray(discordData.components) ? discordData.components : void 0;
|
|
290
|
+
const embeds = !componentSpec && Array.isArray(discordData.embeds) ? discordData.embeds : void 0;
|
|
291
|
+
if (!componentSpec && !nativeComponents && !embeds?.length && !filename) return completeResult(await sendTextMediaPayload({
|
|
292
|
+
channel: "discord",
|
|
293
|
+
ctx: payloadContext,
|
|
294
|
+
adapter: params.fallbackAdapter
|
|
295
|
+
}));
|
|
338
296
|
return completeDelivery(await sendPayloadMediaSequenceOrFallback({
|
|
339
297
|
text: payload.text ?? "",
|
|
340
298
|
mediaUrls,
|
|
341
299
|
fallbackResult: createDiscordUnknownPayloadResult(sendContext.target),
|
|
342
|
-
sendNoMedia: async () => {
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
300
|
+
sendNoMedia: async () => componentSpec ? await sendDiscordComponentMessageLazy(sendContext.target, componentSpec, {
|
|
301
|
+
...formattedDeliveryOptions(),
|
|
302
|
+
filename,
|
|
303
|
+
onDeliveryResult
|
|
304
|
+
}) : await sendContext.send(sendContext.target, payload.text ?? "", {
|
|
305
|
+
verbose: false,
|
|
306
|
+
components: nativeComponents,
|
|
307
|
+
embeds,
|
|
308
|
+
filename,
|
|
309
|
+
...formattedDeliveryOptions(),
|
|
310
|
+
onDeliveryResult
|
|
311
|
+
}),
|
|
349
312
|
send: async ({ text, mediaUrl, isFirst }) => {
|
|
350
|
-
if (isFirst) return await sendDiscordComponentMessageLazy(sendContext.target, componentSpec, {
|
|
351
|
-
...
|
|
313
|
+
if (componentSpec && isFirst) return await sendDiscordComponentMessageLazy(sendContext.target, componentSpec, {
|
|
314
|
+
...mediaDeliveryOptions(mediaUrl),
|
|
352
315
|
filename,
|
|
353
316
|
onDeliveryResult
|
|
354
317
|
});
|
|
355
318
|
return await sendContext.send(sendContext.target, text, {
|
|
356
319
|
verbose: false,
|
|
357
|
-
...
|
|
320
|
+
...mediaDeliveryOptions(mediaUrl),
|
|
321
|
+
...!componentSpec ? {
|
|
322
|
+
components: isFirst ? nativeComponents : void 0,
|
|
323
|
+
embeds: isFirst ? embeds : void 0,
|
|
324
|
+
filename: isFirst ? filename : void 0
|
|
325
|
+
} : {},
|
|
358
326
|
onDeliveryResult
|
|
359
327
|
});
|
|
360
328
|
}
|
|
@@ -365,8 +333,8 @@ async function sendDiscordOutboundPayload(params) {
|
|
|
365
333
|
const DISCORD_TEXT_CHUNK_LIMIT = 2e3;
|
|
366
334
|
const DISCORD_PRECHUNK_MAX_LINES = Number.MAX_SAFE_INTEGER;
|
|
367
335
|
const log = createSubsystemLogger("discord/outbound");
|
|
368
|
-
const loadDiscordThreadBindings = createLazyRuntimeModule(() => import("./thread-bindings-
|
|
369
|
-
const loadDiscordComponentSendRuntime = createLazyRuntimeModule(() => import("./send.components-
|
|
336
|
+
const loadDiscordThreadBindings = createLazyRuntimeModule(() => import("./thread-bindings-0hPTSK14.mjs").then((n) => n.i));
|
|
337
|
+
const loadDiscordComponentSendRuntime = createLazyRuntimeModule(() => import("./send.components-FxOS3CeP.mjs").then((n) => n.i));
|
|
370
338
|
function resolveDiscordDeliveryOptions(params) {
|
|
371
339
|
return {
|
|
372
340
|
onPlatformSendDispatch: params.onPlatformSendDispatch,
|
|
@@ -401,24 +369,17 @@ async function maybeSendDiscordWebhookText(params) {
|
|
|
401
369
|
}
|
|
402
370
|
async function resolveDiscordOutboundMessageSend(params) {
|
|
403
371
|
const send = resolveOutboundSendDep(params.deps, "discord") ?? (await loadDiscordSendRuntime()).sendMessageDiscord;
|
|
404
|
-
const reply = resolveDiscordReplyReference(
|
|
405
|
-
replyToId: params.replyToId,
|
|
406
|
-
replyToIdSource: params.replyToIdSource,
|
|
407
|
-
replyToMode: params.replyToMode
|
|
408
|
-
});
|
|
372
|
+
const reply = resolveDiscordReplyReference(params);
|
|
409
373
|
return {
|
|
410
374
|
send,
|
|
411
|
-
target: resolveDiscordAttachedOutboundTarget(
|
|
412
|
-
to: params.to,
|
|
413
|
-
threadId: params.threadId
|
|
414
|
-
}),
|
|
375
|
+
target: resolveDiscordAttachedOutboundTarget(params),
|
|
415
376
|
options: {
|
|
416
377
|
verbose: false,
|
|
417
378
|
reply,
|
|
418
379
|
accountId: params.accountId ?? void 0,
|
|
419
380
|
silent: params.silent ?? void 0,
|
|
420
381
|
cfg: params.cfg,
|
|
421
|
-
...resolveDiscordFormattingOptions(
|
|
382
|
+
...resolveDiscordFormattingOptions(params),
|
|
422
383
|
...resolveDiscordDeliveryOptions(params)
|
|
423
384
|
}
|
|
424
385
|
};
|
package/dist/.setup/{outbound-session-route-BvBH4LC6.mjs → outbound-session-route-B0Hpwn3Q.mjs}
RENAMED
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as inspectDiscordAccount } from "./account-inspect-
|
|
3
|
-
import { A as isDiscordThreadChannelType } from "./allow-list-
|
|
4
|
-
import { d as normalizeDiscordMessagingTarget,
|
|
5
|
-
import {
|
|
1
|
+
import { i as listDiscordAccountIds, l as resolveDiscordAccount, t as createDiscordActionGate } from "./accounts-ljrzXBJi.mjs";
|
|
2
|
+
import { t as inspectDiscordAccount } from "./account-inspect-8cCu6uPG.mjs";
|
|
3
|
+
import { A as isDiscordThreadChannelType } from "./allow-list-B_ToXtew.mjs";
|
|
4
|
+
import { d as normalizeDiscordMessagingTarget, u as matchesDiscordToolContextTarget } from "./send.receipt-BAlzXd8e.mjs";
|
|
5
|
+
import { t as parseDiscordTarget } from "./target-parsing-C-HyNxcE.mjs";
|
|
6
|
+
import { h as readDiscordComponentSpec, m as coerceDiscordComponentParam } from "./components-HN9052L1.mjs";
|
|
6
7
|
import { n as resolveDiscordCommandOwnerEntries } from "./command-owners-D78sAoOz.mjs";
|
|
7
8
|
import { createLazyRuntimeMethod, createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
|
|
8
9
|
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
9
|
-
import { asOptionalRecord, isRecord, normalizeOptionalLowercaseString, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
10
10
|
import { buildOutboundBaseSessionKey, deriveLastRoutePolicy, isAcpSessionKey, isSubagentSessionKey, parseAgentSessionKey, resolveAgentIdFromSessionKey, resolveAgentRoute } from "openclaw/plugin-sdk/routing";
|
|
11
|
+
import { asNonArrayRecord, asOptionalRecord, isRecord, normalizeOptionalLowercaseString, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
11
12
|
import { createUnionActionGate } from "openclaw/plugin-sdk/channel-actions";
|
|
12
13
|
import { ChannelType } from "discord-api-types/v10";
|
|
13
14
|
import { resolveAskUserQuestionOptionIndices } from "openclaw/plugin-sdk/reply-payload";
|
|
@@ -19,7 +20,7 @@ import { extractToolSend } from "openclaw/plugin-sdk/tool-send";
|
|
|
19
20
|
import { createInboundEventDeliveryCorrelation } from "openclaw/plugin-sdk/inbound-event-delivery";
|
|
20
21
|
//#region extensions/discord/src/exec-approvals.ts
|
|
21
22
|
function normalizeDiscordApproverId(value) {
|
|
22
|
-
const trimmed = value.trim();
|
|
23
|
+
const trimmed = String(value).trim();
|
|
23
24
|
if (!trimmed) return;
|
|
24
25
|
if (/^\d+$/.test(trimmed)) return trimmed;
|
|
25
26
|
try {
|
|
@@ -29,37 +30,26 @@ function normalizeDiscordApproverId(value) {
|
|
|
29
30
|
return;
|
|
30
31
|
}
|
|
31
32
|
}
|
|
32
|
-
function resolveDiscordOwnerApprovers(cfg) {
|
|
33
|
-
return resolveApprovalApprovers({
|
|
34
|
-
explicit: resolveDiscordCommandOwnerEntries(cfg),
|
|
35
|
-
normalizeApprover: (value) => normalizeDiscordApproverId(String(value))
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
33
|
function getDiscordExecApprovalApprovers(params) {
|
|
39
34
|
return resolveApprovalApprovers({
|
|
40
|
-
explicit: params.configOverride?.approvers ?? resolveDiscordAccount(params).config.execApprovals?.approvers ??
|
|
41
|
-
|
|
35
|
+
explicit: params.configOverride?.approvers ?? resolveDiscordAccount(params).config.execApprovals?.approvers ?? resolveApprovalApprovers({
|
|
36
|
+
explicit: resolveDiscordCommandOwnerEntries(params.cfg),
|
|
37
|
+
normalizeApprover: normalizeDiscordApproverId
|
|
38
|
+
}),
|
|
39
|
+
normalizeApprover: normalizeDiscordApproverId
|
|
42
40
|
});
|
|
43
41
|
}
|
|
44
42
|
function isDiscordExecApprovalClientEnabled(params) {
|
|
45
43
|
const config = params.configOverride ?? resolveDiscordAccount(params).config.execApprovals;
|
|
46
44
|
return isChannelExecApprovalClientEnabledFromConfig({
|
|
47
45
|
enabled: config?.enabled,
|
|
48
|
-
approverCount: getDiscordExecApprovalApprovers(
|
|
49
|
-
cfg: params.cfg,
|
|
50
|
-
accountId: params.accountId,
|
|
51
|
-
configOverride: params.configOverride
|
|
52
|
-
}).length
|
|
46
|
+
approverCount: getDiscordExecApprovalApprovers(params).length
|
|
53
47
|
});
|
|
54
48
|
}
|
|
55
49
|
function isDiscordExecApprovalApprover(params) {
|
|
56
50
|
const senderId = params.senderId?.trim();
|
|
57
51
|
if (!senderId) return false;
|
|
58
|
-
return getDiscordExecApprovalApprovers(
|
|
59
|
-
cfg: params.cfg,
|
|
60
|
-
accountId: params.accountId,
|
|
61
|
-
configOverride: params.configOverride
|
|
62
|
-
}).includes(senderId);
|
|
52
|
+
return getDiscordExecApprovalApprovers(params).includes(senderId);
|
|
63
53
|
}
|
|
64
54
|
function shouldSuppressLocalDiscordExecApprovalPrompt(params) {
|
|
65
55
|
const metadata = getExecApprovalReplyMetadata(params.payload);
|
|
@@ -89,57 +79,35 @@ function resolveRequiredDiscordChannelPermissions(channelType) {
|
|
|
89
79
|
if (channelType === ChannelType.GuildVoice || channelType === ChannelType.GuildStageVoice) return [...REQUIRED_VOICE_CHANNEL_PERMISSIONS];
|
|
90
80
|
return [...REQUIRED_TEXT_CHANNEL_PERMISSIONS];
|
|
91
81
|
}
|
|
92
|
-
function
|
|
93
|
-
if (!guilds) return [];
|
|
82
|
+
function collectDiscordAuditChannelIdsForAccount(config) {
|
|
94
83
|
const ids = /* @__PURE__ */ new Set();
|
|
95
|
-
for (const entry of Object.values(guilds)) {
|
|
84
|
+
for (const entry of Object.values(config.guilds ?? {})) {
|
|
96
85
|
if (!entry || typeof entry !== "object") continue;
|
|
97
86
|
const channelsRaw = entry.channels;
|
|
98
87
|
if (!isRecord(channelsRaw)) continue;
|
|
99
88
|
for (const [key, value] of Object.entries(channelsRaw)) {
|
|
100
89
|
const channelId = normalizeOptionalString(key) ?? "";
|
|
101
|
-
if (!channelId) continue;
|
|
102
|
-
if (channelId === "*") continue;
|
|
103
|
-
if (value?.enabled === false) continue;
|
|
90
|
+
if (!channelId || channelId === "*" || value?.enabled === false) continue;
|
|
104
91
|
ids.add(channelId);
|
|
105
92
|
}
|
|
106
93
|
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
function collectDiscordAuditChannelIdsForGuilds(guilds) {
|
|
110
|
-
const keys = listConfiguredGuildChannelKeys(guilds);
|
|
111
|
-
const channelIds = keys.filter((key) => /^\d+$/.test(key));
|
|
112
|
-
return {
|
|
113
|
-
channelIds,
|
|
114
|
-
unresolvedChannels: keys.length - channelIds.length
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
|
-
function collectDiscordAuditChannelIdsForAccount(config) {
|
|
118
|
-
const collected = collectDiscordAuditChannelIdsForGuilds(config.guilds);
|
|
119
|
-
const channelIds = new Set(collected.channelIds);
|
|
120
|
-
let unresolvedVoiceChannels = 0;
|
|
94
|
+
const channelIds = new Set([...ids].filter((key) => /^\d+$/.test(key)));
|
|
95
|
+
let unresolvedChannels = ids.size - channelIds.size;
|
|
121
96
|
for (const entry of config.voice?.autoJoin ?? []) {
|
|
122
97
|
const channelId = normalizeOptionalString(entry?.channelId) ?? "";
|
|
123
98
|
if (/^\d+$/.test(channelId)) channelIds.add(channelId);
|
|
124
|
-
else if (channelId)
|
|
99
|
+
else if (channelId) unresolvedChannels++;
|
|
125
100
|
}
|
|
126
101
|
return {
|
|
127
102
|
channelIds: [...channelIds].toSorted((a, b) => a.localeCompare(b)),
|
|
128
|
-
unresolvedChannels
|
|
103
|
+
unresolvedChannels
|
|
129
104
|
};
|
|
130
105
|
}
|
|
131
106
|
async function auditDiscordChannelPermissionsWithFetcher(params) {
|
|
132
107
|
const started = Date.now();
|
|
133
108
|
const token = normalizeOptionalString(params.token) ?? "";
|
|
134
|
-
if (!token || params.channelIds.length === 0) return {
|
|
135
|
-
ok: true,
|
|
136
|
-
checkedChannels: 0,
|
|
137
|
-
unresolvedChannels: 0,
|
|
138
|
-
channels: [],
|
|
139
|
-
elapsedMs: Date.now() - started
|
|
140
|
-
};
|
|
141
109
|
const channels = [];
|
|
142
|
-
for (const channelId of params.channelIds) try {
|
|
110
|
+
for (const channelId of token ? params.channelIds : []) try {
|
|
143
111
|
const perms = await params.fetchChannelPermissions(channelId, {
|
|
144
112
|
cfg: params.cfg,
|
|
145
113
|
token,
|
|
@@ -243,9 +211,6 @@ const localExecutionActions = /* @__PURE__ */ new Set([
|
|
|
243
211
|
"sticker-upload",
|
|
244
212
|
"event-create"
|
|
245
213
|
]);
|
|
246
|
-
function resolveDiscordActionExecutionMode({ action }) {
|
|
247
|
-
return localExecutionActions.has(action) ? "local" : "gateway";
|
|
248
|
-
}
|
|
249
214
|
function resolveDiscordThreadReplyDeliveryAlias(args) {
|
|
250
215
|
if (normalizeOptionalString(args.target) || normalizeOptionalString(args.to) || normalizeOptionalString(args.channelId)) return;
|
|
251
216
|
const threadId = normalizeOptionalString(args.threadId);
|
|
@@ -256,7 +221,7 @@ function resolveDiscordThreadReplyTarget(args) {
|
|
|
256
221
|
const target = threadId !== void 0 ? `channel:${threadId}` : normalizeOptionalString(args.channelId) ?? normalizeOptionalString(args.to) ?? normalizeOptionalString(args.target);
|
|
257
222
|
return target ? normalizeDiscordMessagingTarget(target) : void 0;
|
|
258
223
|
}
|
|
259
|
-
const loadDiscordChannelActionsRuntime = createLazyRuntimeModule(() => import("./handle-action-
|
|
224
|
+
const loadDiscordChannelActionsRuntime = createLazyRuntimeModule(() => import("./handle-action-CXH1h1tq.mjs"));
|
|
260
225
|
const discordActionGroups = [
|
|
261
226
|
{
|
|
262
227
|
gate: "polls",
|
|
@@ -388,7 +353,7 @@ function describeDiscordMessageTool({ cfg, accountId }) {
|
|
|
388
353
|
actions: ["react", "reactions"],
|
|
389
354
|
properties: { emoji: Type.Optional(Type.String({ description: `Unicode emoji or custom name:id (also <:name:id> / <a:name:id>).${actions.has("emoji-list") ? " Use action:\"emoji-list\" for server emojis." : ""}` })) }
|
|
390
355
|
});
|
|
391
|
-
|
|
356
|
+
schema.push({
|
|
392
357
|
actions: ["send"],
|
|
393
358
|
visibility: "all-configured",
|
|
394
359
|
properties: { components: Type.Optional(Type.Object({
|
|
@@ -432,7 +397,7 @@ const discordMessageActions = {
|
|
|
432
397
|
"pin",
|
|
433
398
|
"unpin"
|
|
434
399
|
],
|
|
435
|
-
resolveExecutionMode:
|
|
400
|
+
resolveExecutionMode: ({ action }) => localExecutionActions.has(action) ? "local" : "gateway",
|
|
436
401
|
describeMessageTool: describeDiscordMessageTool,
|
|
437
402
|
supportsAction: ({ action }) => action !== "poll",
|
|
438
403
|
messageActionTargetAliases: { "thread-reply": {
|
|
@@ -471,7 +436,7 @@ const discordMessageActions = {
|
|
|
471
436
|
if ((componentSpec || nativeComponents) && embeds?.length) return null;
|
|
472
437
|
const filename = normalizeOptionalString(ctx.params.filename);
|
|
473
438
|
if (!componentSpec && !nativeComponents && !embeds?.length && !filename) return payloadWithDeliveryMetadata;
|
|
474
|
-
const discordData = payloadWithDeliveryMetadata.channelData?.discord
|
|
439
|
+
const discordData = asNonArrayRecord(payloadWithDeliveryMetadata.channelData?.discord);
|
|
475
440
|
return {
|
|
476
441
|
...payloadWithDeliveryMetadata,
|
|
477
442
|
channelData: {
|
|
@@ -494,9 +459,7 @@ const discordMessageActions = {
|
|
|
494
459
|
//#endregion
|
|
495
460
|
//#region extensions/discord/src/conversation-identity.ts
|
|
496
461
|
function normalizeDiscordTarget(raw, defaultKind) {
|
|
497
|
-
|
|
498
|
-
if (!trimmed) return;
|
|
499
|
-
return parseDiscordTarget(trimmed, { defaultKind })?.normalized;
|
|
462
|
+
return parseDiscordTarget(normalizeOptionalString(raw) ?? "", { defaultKind })?.normalized;
|
|
500
463
|
}
|
|
501
464
|
function buildDiscordConversationIdentity(kind, rawId) {
|
|
502
465
|
const trimmed = normalizeOptionalString(rawId);
|
|
@@ -565,23 +528,13 @@ function resolveDiscordConversationRoute(params) {
|
|
|
565
528
|
}
|
|
566
529
|
}
|
|
567
530
|
function resolveDiscordBoundConversationRoute(params) {
|
|
531
|
+
const route = resolveDiscordConversationRoute({
|
|
532
|
+
...params,
|
|
533
|
+
peer: buildDiscordRoutePeer(params)
|
|
534
|
+
});
|
|
568
535
|
return resolveDiscordEffectiveRoute({
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
accountId: params.accountId,
|
|
572
|
-
guildId: params.guildId,
|
|
573
|
-
memberRoleIds: params.memberRoleIds,
|
|
574
|
-
peer: buildDiscordRoutePeer({
|
|
575
|
-
isDirectMessage: params.isDirectMessage,
|
|
576
|
-
isGroupDm: params.isGroupDm,
|
|
577
|
-
directUserId: params.directUserId,
|
|
578
|
-
conversationId: params.conversationId
|
|
579
|
-
}),
|
|
580
|
-
parentConversationId: params.parentConversationId
|
|
581
|
-
}),
|
|
582
|
-
boundSessionKey: params.boundSessionKey,
|
|
583
|
-
configuredRoute: params.configuredRoute,
|
|
584
|
-
matchedBy: params.matchedBy
|
|
536
|
+
...params,
|
|
537
|
+
route
|
|
585
538
|
});
|
|
586
539
|
}
|
|
587
540
|
function resolveDiscordEffectiveRoute(params) {
|
|
@@ -649,16 +602,14 @@ function escapeDiscordApprovalDisplayCharacter(character) {
|
|
|
649
602
|
/** Keep opaque approval metadata bounded, single-line, and inert in Discord Markdown. */
|
|
650
603
|
function formatDiscordApprovalDisplayValue(value, maxChars = 200) {
|
|
651
604
|
const limit = Number.isFinite(maxChars) ? Math.max(0, Math.trunc(maxChars)) : 200;
|
|
652
|
-
|
|
653
|
-
const escaped = escapedParts.join("");
|
|
654
|
-
if (escaped.length <= limit) return escaped;
|
|
655
|
-
if (limit <= 3) return ".".repeat(limit);
|
|
605
|
+
let escaped = "";
|
|
656
606
|
let bounded = "";
|
|
657
|
-
for (const
|
|
658
|
-
|
|
659
|
-
bounded
|
|
607
|
+
for (const character of value) {
|
|
608
|
+
escaped += escapeDiscordApprovalDisplayCharacter(character);
|
|
609
|
+
if (escaped.length <= limit - 3) bounded = escaped;
|
|
610
|
+
if (escaped.length > limit) return limit <= 3 ? ".".repeat(limit) : `${bounded}...`;
|
|
660
611
|
}
|
|
661
|
-
return
|
|
612
|
+
return escaped;
|
|
662
613
|
}
|
|
663
614
|
//#endregion
|
|
664
615
|
//#region extensions/discord/src/outbound-components.ts
|
|
@@ -691,39 +642,33 @@ const DISCORD_PRESENTATION_CAPABILITIES = {
|
|
|
691
642
|
}
|
|
692
643
|
}
|
|
693
644
|
};
|
|
694
|
-
const sendDiscordComponentMessageLazy = createLazyRuntimeMethod(createLazyRuntimeModule(() => import("./send.components-
|
|
695
|
-
const loadDiscordSharedInteractive = createLazyRuntimeModule(() => import("./components-
|
|
645
|
+
const sendDiscordComponentMessageLazy = createLazyRuntimeMethod(createLazyRuntimeModule(() => import("./send.components-FxOS3CeP.mjs").then((n) => n.i)), (runtime) => runtime.sendDiscordComponentMessage);
|
|
646
|
+
const loadDiscordSharedInteractive = createLazyRuntimeModule(() => import("./components-HN9052L1.mjs").then((n) => n.a));
|
|
696
647
|
function addPayloadTextFallback(spec, payload) {
|
|
697
648
|
return spec.text ? spec : {
|
|
698
649
|
...spec,
|
|
699
650
|
text: payload.text?.trim() ? payload.text : void 0
|
|
700
651
|
};
|
|
701
652
|
}
|
|
702
|
-
function
|
|
703
|
-
|
|
704
|
-
if (
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
const blocks
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
if (
|
|
653
|
+
function isDiscordComponentSpecWithinMessageLimit(params) {
|
|
654
|
+
const spec = addPayloadTextFallback(params.spec, { text: params.fallbackText });
|
|
655
|
+
if (spec.text && Array.from(spec.text).length > DISCORD_TEXT_DISPLAY_LIMIT) return false;
|
|
656
|
+
const includesMedia = params.includesMedia === true;
|
|
657
|
+
const blocks = spec.blocks ?? [];
|
|
658
|
+
let count = 1 + (spec.text ? 1 : 0);
|
|
659
|
+
for (const block of blocks) if (block.type === "section") {
|
|
660
|
+
const textCount = block.texts?.length ? block.texts.length : block.text ? 1 : 0;
|
|
661
|
+
count += 1 + textCount + (block.accessory ? 1 : 0);
|
|
662
|
+
} else if (block.type === "actions") count += 1 + (block.buttons?.length ?? (block.select ? 1 : 0));
|
|
663
|
+
else count += 1;
|
|
664
|
+
if (spec.modal) {
|
|
712
665
|
const lastBlock = blocks.at(-1);
|
|
713
666
|
const triggerFitsLastRow = lastBlock?.type === "actions" && !lastBlock.select && (lastBlock.buttons?.length ?? 0) < 5;
|
|
714
667
|
count += triggerFitsLastRow ? 1 : 2;
|
|
715
668
|
}
|
|
716
669
|
const hasFileBlock = blocks.some((block) => block.type === "file");
|
|
717
|
-
if (
|
|
718
|
-
return count;
|
|
719
|
-
}
|
|
720
|
-
function isDiscordComponentSpecWithinMessageLimit(params) {
|
|
721
|
-
const countedSpec = addPayloadTextFallback(params.spec, { text: params.fallbackText });
|
|
722
|
-
if (countedSpec.text && Array.from(countedSpec.text).length > DISCORD_TEXT_DISPLAY_LIMIT) return false;
|
|
723
|
-
return countDiscordMessageComponents({
|
|
724
|
-
spec: countedSpec,
|
|
725
|
-
includesMedia: params.includesMedia === true
|
|
726
|
-
}) <= DISCORD_MESSAGE_COMPONENT_LIMIT;
|
|
670
|
+
if (includesMedia && !hasFileBlock) count += 1;
|
|
671
|
+
return count <= DISCORD_MESSAGE_COMPONENT_LIMIT;
|
|
727
672
|
}
|
|
728
673
|
async function buildDiscordPresentationPayload(params) {
|
|
729
674
|
const componentSpec = (await loadDiscordSharedInteractive()).buildDiscordPresentationComponents(params.presentation, { questionOptionIndices: resolveAskUserQuestionOptionIndices(params.payload) });
|
|
@@ -792,10 +737,7 @@ function resolveDiscordOutboundTargetKindHint(params) {
|
|
|
792
737
|
const resolvedKind = params.resolvedTarget?.kind;
|
|
793
738
|
if (resolvedKind === "user") return "user";
|
|
794
739
|
if (resolvedKind === "group" || resolvedKind === "channel") return "channel";
|
|
795
|
-
|
|
796
|
-
if (/^channel:/i.test(target)) return "channel";
|
|
797
|
-
if (/^(user:|discord:|@|<@!?)/i.test(target)) return "user";
|
|
798
|
-
return "channel";
|
|
740
|
+
return /^(user:|discord:|@|<@!?)/i.test(params.target.trim()) ? "user" : "channel";
|
|
799
741
|
}
|
|
800
742
|
//#endregion
|
|
801
743
|
export { collectDiscordAuditChannelIdsForAccount as C, isDiscordExecApprovalClientEnabled as D, isDiscordExecApprovalApprover as E, shouldSuppressLocalDiscordExecApprovalPrompt as O, auditDiscordChannelPermissionsWithFetcher as S, getDiscordExecApprovalApprovers as T, resolveDiscordRuntimeBindingConversationId as _, resolveDiscordComponentSpec as a, discordInboundEventDelivery as b, formatDiscordApprovalDisplayValue as c, resolveDiscordBoundConversationRoute as d, resolveDiscordConversationRoute as f, resolveDiscordCurrentConversationIdentity as g, resolveDiscordConversationIdentity as h, isDiscordComponentSpecWithinMessageLimit as i, buildDiscordConversationRouteContext as l, shouldIgnoreStaleDiscordRouteBinding as m, DISCORD_PRESENTATION_CAPABILITIES as n, sendDiscordComponentMessageLazy as o, resolveDiscordEffectiveRoute as p, buildDiscordPresentationPayload as r, DISCORD_APPROVAL_ALLOWED_MENTIONS as s, resolveDiscordOutboundSessionRoute as t, buildDiscordRoutePeer as u, discordMessageActions as v, resolveRequiredDiscordChannelPermissions as w, notifyDiscordInboundEventOutboundPayloadSuccess as x, isTrustedRequesterGuildAdminAction as y };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//#region extensions/discord/src/voice/output-activity.ts
|
|
2
|
+
function resolveDiscordOutputAudioDelta(previous, sourceAudioBytes) {
|
|
3
|
+
const sinkAudioBytes = Math.floor((previous.sourceAudioBytes + sourceAudioBytes) / 2) * 8 - previous.sinkAudioBytes;
|
|
4
|
+
return {
|
|
5
|
+
audioMs: sinkAudioBytes / 192,
|
|
6
|
+
sourceAudioBytes,
|
|
7
|
+
sinkAudioBytes
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
//#endregion
|
|
11
|
+
export { resolveDiscordOutputAudioDelta as t };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.mjs";
|
|
2
2
|
import { resolveFetch } from "openclaw/plugin-sdk/fetch-runtime";
|
|
3
|
+
import { redactToolPayloadText } from "openclaw/plugin-sdk/logging-core";
|
|
3
4
|
import { readProviderJsonObjectResponse, readResponseTextLimited } from "openclaw/plugin-sdk/provider-http";
|
|
4
5
|
import { buildTimeoutAbortSignal } from "openclaw/plugin-sdk/extension-shared";
|
|
5
6
|
//#region extensions/discord/src/pluralkit.ts
|
|
@@ -31,7 +32,8 @@ async function fetchPluralKitMessageInfo(params) {
|
|
|
31
32
|
}
|
|
32
33
|
if (!res.ok) {
|
|
33
34
|
const text = await readResponseTextLimited(res, PLURALKIT_ERROR_BODY_LIMIT_BYTES).catch(() => "");
|
|
34
|
-
const
|
|
35
|
+
const redacted = text.trim() ? redactToolPayloadText(text.trim()) : "";
|
|
36
|
+
const detail = redacted ? `: ${redacted}` : "";
|
|
35
37
|
throw new Error(`PluralKit API failed (${res.status})${detail}`);
|
|
36
38
|
}
|
|
37
39
|
return await readProviderJsonObjectResponse(res, "PluralKit message");
|