@openclaw/discord 2026.8.1-beta.2 → 2026.8.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/{account-inspect-CqzrH14k.js → account-inspect-BDfKyuvL.js} +1 -1
- package/dist/account-inspect-api.js +1 -1
- package/dist/{accounts-DJTf1LtA.js → accounts-CfQ-vSyf.js} +34 -1
- package/dist/action-runtime-api.js +1 -1
- package/dist/{activities-api-DS7vpdtp.js → activities-api-Dl-TOyOX.js} +134 -175
- package/dist/activities-api.js +1 -1
- package/dist/api.js +17 -17
- package/dist/{approval-handler.runtime-B6yEV79q.js → approval-handler.runtime-q4Zqo44V.js} +29 -106
- package/dist/{audit-Db-rlntl.js → audit-DgrvFPGt.js} +5 -5
- package/dist/{channel-CnnbJSt5.js → channel-BsQUalPw.js} +72 -50
- package/dist/{channel-actions.runtime-CLKrx6tr.js → channel-actions.runtime-UMGGIfSy.js} +31 -45
- package/dist/channel-config-api.js +1 -1
- package/dist/channel-plugin-api.js +1 -1
- package/dist/channel-type-CVLZyGYS.js +7 -0
- package/dist/{channel.setup-BFAO-V1P.js → channel.setup-rPs4dsk_.js} +5 -5
- package/dist/{outbound-session-route-DxLkrgKQ.js → components-Dk35LTf_.js} +34 -76
- package/dist/{config-schema-BgEskFAs.js → config-schema-CxPqtVI1.js} +46 -14
- package/dist/conversation-binding-route-BjvX4e35.js +43 -0
- package/dist/{directory-config-BVX7Cflc.js → directory-config-B7DY_pNG.js} +2 -2
- package/dist/directory-contract-api.js +1 -1
- package/dist/{directory-live-DGIGxpIo.js → directory-live-DuAXKkan.js} +3 -3
- package/dist/doctor-contract-api.js +2 -2
- package/dist/{doctor-BzC-TLnB.js → doctor-zQTtn6hm.js} +33 -12
- package/dist/{handle-action.guild-admin-BNVTUISF.js → handle-action.guild-admin-DZewwLr1.js} +9 -5
- package/dist/index.js +3 -4
- package/dist/ingress-identity-CzZKcPK8.js +60 -0
- package/dist/{message-handler-Unk_f10F.js → message-handler-C5By3yl5.js} +82 -6
- package/dist/{message-handler.preflight-C9zecxR9.js → message-handler.preflight-DrszWuHw.js} +44 -118
- package/dist/{message-handler.process-DWQ6UHHu.js → message-handler.process-DyFPDLCt.js} +205 -235
- package/dist/{message-utils-BSCPVgy0.js → message-text-Ca8M6TU8.js} +43 -42
- package/dist/{outbound-adapter-D9nRivT1.js → outbound-adapter-Dif8p481.js} +118 -91
- package/dist/{outbound-components-cTzwBJ60.js → outbound-components-wjv7yyAj.js} +5 -4
- package/dist/outbound-session-route-Bn4uXaoE.js +665 -0
- package/dist/owner-access-UlYi9t0M.js +107 -0
- package/dist/{pluralkit-DdiJ9KMK.js → pluralkit-9EuEN4UD.js} +1 -1
- package/dist/{probe-Bl-k5_Ku.js → probe-n6ZXxK8V.js} +1 -1
- package/dist/{probe.runtime-M9fREKvp.js → probe.runtime-CN4bdPfZ.js} +1 -1
- package/dist/{provider-DvSNb-2v.js → provider-LXiOcJrH.js} +887 -1350
- package/dist/{provider-session.runtime-BUEqD0rA.js → provider-session.runtime-DSNe7r2W.js} +3 -3
- package/dist/provider.runtime-DiInaDXO.js +2 -0
- package/dist/{realtime-session.runtime-C7wen-aF.js → realtime-session.runtime-DOViOIjY.js} +129 -134
- package/dist/{resolve-allowlist-common-D04lpEzb.js → resolve-allowlist-common-BLoYaxEG.js} +2 -2
- package/dist/{resolve-channels-Dm7jEeg6.js → resolve-channels-D2yl_2CN.js} +5 -4
- package/dist/{resolve-users-bktrCUUU.js → resolve-users-BLxfqajZ.js} +2 -2
- package/dist/{retry-CLpJcXXf.js → retry-DqHCW6PV.js} +187 -19
- package/dist/{runtime-DGsSyDTS.js → runtime-BYamRVPN.js} +89 -86
- package/dist/{runtime-DoHjckYm.js → runtime-DrxVBTtp.js} +9 -10
- package/dist/runtime-api.js +19 -25
- package/dist/{sdk-runtime-QpY8PvCh.js → sdk-runtime-6tfgYDjY.js} +57 -89
- package/dist/{secret-config-contract-B1akrlyY.js → secret-config-contract-B3i6WxV5.js} +53 -25
- package/dist/secret-contract-api.js +1 -1
- package/dist/{security-audit-jGnJF__m.js → security-audit-DKfK-iPY.js} +11 -12
- package/dist/security-audit-contract-api.js +1 -1
- package/dist/{security-audit.runtime-CPN0xFYz.js → security-audit.runtime-sKZyKgpx.js} +1 -1
- package/dist/{send-B7Q6Oc1I.js → send-UJHiAm4C.js} +82 -19
- package/dist/{send.components-iJyFXw9L.js → send.components-CrBJpGT_.js} +22 -39
- package/dist/{send.outbound-DS5tHwfR.js → send.outbound-D7JYmfm9.js} +77 -78
- package/dist/{send.shared-BmwFjW6T.js → send.shared-DZJ1akvQ.js} +136 -121
- package/dist/{sender-identity-QtalnCYv.js → sender-identity-BJtfyise.js} +1 -1
- package/dist/setup-plugin-api.js +1 -1
- package/dist/{shared-BIXIX6uJ.js → shared-Dii2HTn7.js} +41 -14
- package/dist/subagent-hooks-JyGrtQIl.js +49 -0
- package/dist/subagent-hooks-api.js +1 -6
- package/dist/{system-events-CTqDf6_s.js → system-events-BEmcj4xJ.js} +2 -2
- package/dist/{target-resolver-maOKSqO0.js → target-resolver-V-IYae6s.js} +3 -3
- package/dist/targets-CQp53cGj.js +3 -0
- package/dist/{thread-bindings-3L8p82GV.js → thread-bindings-DvYP79fy.js} +28 -26
- package/dist/{thread-bindings.manager-DCIH6WDC.js → thread-bindings.manager-Clm77DBM.js} +11 -14
- package/dist/{thread-bindings.session-updates-bJ2KQFY6.js → thread-bindings.session-updates-CJb-BpPL.js} +1 -1
- package/dist/{thread-bindings.state-aeV8HNgV.js → thread-bindings.state-D8OMdk4O.js} +1 -1
- package/dist/threading-CXuu_7o9.js +478 -0
- package/dist/transcripts-source-BLEMH_yi.js +270 -0
- package/dist/transcripts-source-api.js +7 -2
- package/dist/{typing-CS-nNVoe.js → typing-B9snnwMe.js} +1 -1
- package/dist/{voice-runtime-BEdqNcST.js → voice-runtime-DY6_o73o.js} +250 -150
- package/node_modules/@discord/embedded-app-sdk/node_modules/uuid/README.md +19 -19
- package/node_modules/@discord/embedded-app-sdk/node_modules/uuid/dist/v1.js +7 -3
- package/node_modules/@discord/embedded-app-sdk/node_modules/uuid/dist/v7.js +5 -2
- package/node_modules/@discord/embedded-app-sdk/node_modules/uuid/dist-node/v1.js +7 -3
- package/node_modules/@discord/embedded-app-sdk/node_modules/uuid/dist-node/v7.js +5 -2
- package/node_modules/@discord/embedded-app-sdk/node_modules/uuid/package.json +4 -3
- package/node_modules/@discordjs/voice/node_modules/@types/node/README.md +1 -1
- package/node_modules/@discordjs/voice/node_modules/@types/node/child_process.d.ts +0 -1
- package/node_modules/@discordjs/voice/node_modules/@types/node/crypto.d.ts +6 -6
- package/node_modules/@discordjs/voice/node_modules/@types/node/dns/promises.d.ts +5 -5
- package/node_modules/@discordjs/voice/node_modules/@types/node/dns.d.ts +5 -5
- package/node_modules/@discordjs/voice/node_modules/@types/node/fs.d.ts +7 -0
- package/node_modules/@discordjs/voice/node_modules/@types/node/http.d.ts +30 -0
- package/node_modules/@discordjs/voice/node_modules/@types/node/http2.d.ts +4 -4
- package/node_modules/@discordjs/voice/node_modules/@types/node/os.d.ts +30 -30
- package/node_modules/@discordjs/voice/node_modules/@types/node/package.json +2 -2
- package/node_modules/@discordjs/voice/node_modules/@types/node/perf_hooks.d.ts +2 -1
- package/node_modules/@discordjs/voice/node_modules/@types/node/process.d.ts +42 -43
- package/node_modules/@discordjs/voice/node_modules/@types/node/quic.d.ts +1049 -84
- package/node_modules/@discordjs/voice/node_modules/@types/node/sqlite.d.ts +14 -1
- package/node_modules/@discordjs/voice/node_modules/@types/node/stream/iter.d.ts +3 -2
- package/node_modules/@discordjs/voice/node_modules/@types/node/test.d.ts +61 -0
- package/node_modules/@discordjs/voice/node_modules/@types/node/v8.d.ts +20 -23
- package/node_modules/discord-api-types/CHANGELOG.md +8 -0
- package/node_modules/discord-api-types/package.json +4 -4
- package/node_modules/discord-api-types/payloads/v10/channel.d.ts +2 -2
- package/node_modules/discord-api-types/payloads/v10/channel.d.ts.map +1 -1
- package/node_modules/discord-api-types/payloads/v10/gateway.d.ts +4 -0
- package/node_modules/discord-api-types/payloads/v10/gateway.d.ts.map +1 -1
- package/node_modules/discord-api-types/payloads/v10/gateway.js.map +1 -1
- package/node_modules/discord-api-types/payloads/v10/message.d.ts +4 -1
- package/node_modules/discord-api-types/payloads/v10/message.d.ts.map +1 -1
- package/node_modules/discord-api-types/payloads/v10/message.js +1 -0
- package/node_modules/discord-api-types/payloads/v10/message.js.map +1 -1
- package/node_modules/discord-api-types/payloads/v9/channel.d.ts +2 -2
- package/node_modules/discord-api-types/payloads/v9/channel.d.ts.map +1 -1
- package/node_modules/discord-api-types/payloads/v9/gateway.d.ts +4 -0
- package/node_modules/discord-api-types/payloads/v9/gateway.d.ts.map +1 -1
- package/node_modules/discord-api-types/payloads/v9/gateway.js.map +1 -1
- package/node_modules/discord-api-types/payloads/v9/message.d.ts +4 -1
- package/node_modules/discord-api-types/payloads/v9/message.d.ts.map +1 -1
- package/node_modules/discord-api-types/payloads/v9/message.js +1 -0
- package/node_modules/discord-api-types/payloads/v9/message.js.map +1 -1
- package/node_modules/typebox/build/format/date.d.mts +1 -1
- package/node_modules/typebox/build/format/date.mjs +1 -1
- package/node_modules/typebox/build/format/date_time.d.mts +2 -2
- package/node_modules/typebox/build/format/date_time.mjs +3 -3
- package/node_modules/typebox/build/format/email.d.mts +1 -1
- package/node_modules/typebox/build/format/email.mjs +2 -2
- package/node_modules/typebox/build/format/hostname.mjs +2 -10
- package/node_modules/typebox/build/format/idn_email.d.mts +1 -1
- package/node_modules/typebox/build/format/idn_email.mjs +3 -3
- package/node_modules/typebox/build/format/idn_hostname.d.mts +1 -0
- package/node_modules/typebox/build/format/idn_hostname.mjs +3 -11
- package/node_modules/typebox/build/format/idna/format/bidi.d.mts +3 -0
- package/node_modules/typebox/build/format/idna/format/bidi.mjs +98 -0
- package/node_modules/typebox/build/format/idna/format/puny.d.mts +3 -0
- package/node_modules/typebox/build/format/idna/format/puny.mjs +144 -0
- package/node_modules/typebox/build/format/idna/hostname.d.mts +1 -0
- package/node_modules/typebox/build/format/idna/hostname.mjs +16 -0
- package/node_modules/typebox/build/format/idna/idn-hostname.d.mts +1 -0
- package/node_modules/typebox/build/format/idna/idn-hostname.mjs +23 -0
- package/node_modules/typebox/build/format/idna/index.d.mts +2 -0
- package/node_modules/typebox/build/format/idna/index.mjs +2 -0
- package/node_modules/typebox/build/format/idna/label/ascii.d.mts +1 -0
- package/node_modules/typebox/build/format/idna/label/ascii.mjs +9 -0
- package/node_modules/typebox/build/format/idna/label/puny.d.mts +1 -0
- package/node_modules/typebox/build/format/idna/label/puny.mjs +28 -0
- package/node_modules/typebox/build/format/idna/label/unicode.d.mts +1 -0
- package/node_modules/typebox/build/format/idna/label/unicode.mjs +106 -0
- package/node_modules/typebox/build/format/idna/pattern/pattern.d.mts +30 -0
- package/node_modules/typebox/build/format/idna/pattern/pattern.mjs +70 -0
- package/node_modules/typebox/build/format/ipv4.d.mts +0 -1
- package/node_modules/typebox/build/format/ipv4.mjs +2 -32
- package/node_modules/typebox/build/format/ipv6.mjs +2 -61
- package/node_modules/typebox/build/format/iri.d.mts +2 -2
- package/node_modules/typebox/build/format/iri.mjs +26 -8
- package/node_modules/typebox/build/format/iri_reference.d.mts +2 -2
- package/node_modules/typebox/build/format/iri_reference.mjs +9 -55
- package/node_modules/typebox/build/format/regex.d.mts +1 -2
- package/node_modules/typebox/build/format/regex.mjs +2 -6
- package/node_modules/typebox/build/format/time.d.mts +2 -2
- package/node_modules/typebox/build/format/time.mjs +19 -14
- package/node_modules/typebox/build/format/uri.d.mts +1 -1
- package/node_modules/typebox/build/format/uri.mjs +3 -130
- package/node_modules/typebox/build/format/uri_reference.d.mts +1 -1
- package/node_modules/typebox/build/format/uri_reference.mjs +2 -3
- package/node_modules/typebox/build/format/uri_template.d.mts +2 -3
- package/node_modules/typebox/build/format/uri_template.mjs +4 -5
- package/node_modules/typebox/build/format/url.d.mts +3 -3
- package/node_modules/typebox/build/format/url.mjs +4 -5
- package/node_modules/typebox/build/guard/emit.d.mts +3 -1
- package/node_modules/typebox/build/guard/emit.mjs +12 -5
- package/node_modules/typebox/build/guard/guard.d.mts +8 -2
- package/node_modules/typebox/build/guard/guard.mjs +25 -4
- package/node_modules/typebox/build/guard/string.d.mts +2 -2
- package/node_modules/typebox/build/guard/string.mjs +7 -7
- package/node_modules/typebox/build/schema/engine/_context.mjs +3 -3
- package/node_modules/typebox/build/schema/engine/_functions.mjs +1 -2
- package/node_modules/typebox/build/schema/engine/_regexp.d.mts +2 -0
- package/node_modules/typebox/build/schema/engine/_regexp.mjs +4 -0
- package/node_modules/typebox/build/schema/engine/_stack.mjs +12 -13
- package/node_modules/typebox/build/schema/engine/additionalItems.mjs +17 -7
- package/node_modules/typebox/build/schema/engine/additionalProperties.mjs +4 -3
- package/node_modules/typebox/build/schema/engine/contains.mjs +18 -6
- package/node_modules/typebox/build/schema/engine/enum.mjs +1 -1
- package/node_modules/typebox/build/schema/engine/items.mjs +26 -6
- package/node_modules/typebox/build/schema/engine/maxContains.mjs +3 -3
- package/node_modules/typebox/build/schema/engine/minContains.mjs +14 -4
- package/node_modules/typebox/build/schema/engine/not.mjs +4 -2
- package/node_modules/typebox/build/schema/engine/oneOf.mjs +7 -6
- package/node_modules/typebox/build/schema/engine/pattern.mjs +3 -2
- package/node_modules/typebox/build/schema/engine/patternProperties.mjs +4 -3
- package/node_modules/typebox/build/schema/engine/ref.mjs +1 -7
- package/node_modules/typebox/build/schema/engine/schema.mjs +13 -4
- package/node_modules/typebox/build/schema/engine/type.mjs +1 -1
- package/node_modules/typebox/build/schema/resolve/resolve.d.mts +4 -1
- package/node_modules/typebox/build/schema/resolve/resolve.mjs +202 -1
- package/node_modules/typebox/build/schema/static/propertyNames.d.mts +5 -0
- package/node_modules/typebox/build/schema/static/propertyNames.mjs +3 -0
- package/node_modules/typebox/build/schema/static/schema.d.mts +3 -0
- package/node_modules/typebox/build/schema/types/index.d.mts +0 -2
- package/node_modules/typebox/build/schema/types/index.mjs +0 -2
- package/node_modules/typebox/build/system/memory/clone.mjs +14 -11
- package/node_modules/typebox/build/system/memory/discard.mjs +6 -5
- package/node_modules/typebox/build/system/settings/settings.d.mts +9 -0
- package/node_modules/typebox/build/system/settings/settings.mjs +2 -0
- package/node_modules/typebox/build/type/engine/call/distribute_arguments.d.mts +6 -1
- package/node_modules/typebox/build/type/engine/call/distribute_arguments.mjs +16 -3
- package/node_modules/typebox/build/type/engine/call/instantiate.mjs +34 -4
- package/node_modules/typebox/build/type/engine/evaluate/broaden.d.mts +5 -5
- package/node_modules/typebox/build/type/engine/evaluate/broaden.mjs +20 -26
- package/node_modules/typebox/build/type/engine/evaluate/compare.d.mts +6 -10
- package/node_modules/typebox/build/type/engine/evaluate/compare.mjs +9 -13
- package/node_modules/typebox/build/type/engine/evaluate/composite.d.mts +7 -4
- package/node_modules/typebox/build/type/engine/evaluate/composite.mjs +12 -19
- package/node_modules/typebox/build/type/engine/evaluate/distribute.d.mts +4 -20
- package/node_modules/typebox/build/type/engine/evaluate/distribute.mjs +8 -20
- package/node_modules/typebox/build/type/engine/evaluate/evaluate.d.mts +4 -4
- package/node_modules/typebox/build/type/engine/evaluate/evaluate.mjs +11 -8
- package/node_modules/typebox/build/type/engine/evaluate/flatten.d.mts +1 -1
- package/node_modules/typebox/build/type/engine/evaluate/flatten.mjs +3 -4
- package/node_modules/typebox/build/type/engine/evaluate/narrow.d.mts +17 -2
- package/node_modules/typebox/build/type/engine/evaluate/narrow.mjs +26 -6
- package/node_modules/typebox/build/type/engine/exclude/operation.mjs +3 -4
- package/node_modules/typebox/build/type/engine/extract/operation.d.mts +1 -1
- package/node_modules/typebox/build/type/engine/extract/operation.mjs +3 -4
- package/node_modules/typebox/build/type/engine/priority/priority.d.mts +2 -2
- package/node_modules/typebox/build/type/engine/priority/priority.mjs +3 -4
- package/node_modules/typebox/build/type/script/mapping.d.mts +32 -29
- package/node_modules/typebox/build/type/script/mapping.mjs +18 -25
- package/node_modules/typebox/build/type/script/parser.d.mts +19 -25
- package/node_modules/typebox/build/type/script/parser.mjs +27 -23
- package/node_modules/typebox/build/value/errors/errors.d.mts +2 -2
- package/node_modules/typebox/build/value/errors/errors.mjs +1 -1
- package/node_modules/typebox/package.json +27 -27
- package/node_modules/typebox/readme.md +79 -82
- package/node_modules/undici/docs/docs/api/Client.md +21 -8
- package/node_modules/undici/lib/api/readable.js +33 -43
- package/node_modules/undici/lib/core/connect.js +16 -2
- package/node_modules/undici/lib/core/symbols.js +1 -0
- package/node_modules/undici/lib/dispatcher/client-h1.js +3 -3
- package/node_modules/undici/lib/dispatcher/client-h2.js +179 -10
- package/node_modules/undici/lib/dispatcher/client.js +74 -29
- package/node_modules/undici/lib/dispatcher/env-http-proxy-agent.js +28 -6
- package/node_modules/undici/lib/dispatcher/socks5-proxy-agent.js +15 -1
- package/node_modules/undici/lib/handler/retry-handler.js +7 -2
- package/node_modules/undici/lib/interceptor/cache.js +5 -2
- package/node_modules/undici/lib/interceptor/deduplicate.js +1 -1
- package/node_modules/undici/lib/mock/mock-utils.js +213 -24
- package/node_modules/undici/lib/util/cache.js +2 -4
- package/node_modules/undici/lib/web/websocket/websocket.js +22 -0
- package/node_modules/undici/package.json +1 -1
- package/node_modules/undici/types/client.d.ts +40 -0
- package/node_modules/ws/lib/permessage-deflate.js +3 -1
- package/node_modules/ws/package.json +1 -1
- package/openclaw.plugin.json +24 -10
- package/package.json +8 -10
- package/skills/discord/SKILL.md +1 -1
- package/dist/approval-message-safety-AcIxvrf3.js +0 -140
- package/dist/audit-core-xwjIczO0.js +0 -105
- package/dist/channel-actions-5s_hjYKd.js +0 -208
- package/dist/channel-api-CAJ0wMoV.js +0 -21
- package/dist/inbound-event-delivery-De2qxTrP.js +0 -39
- package/dist/provider.runtime-C9PnJZbZ.js +0 -2
- package/dist/runtime-api.actions.js +0 -3
- package/dist/runtime-api.lookup.js +0 -7
- package/dist/runtime-api.monitor-CHxrFPnW.js +0 -5
- package/dist/runtime-api.monitor.js +0 -8
- package/dist/runtime-api.send.js +0 -7
- package/dist/runtime-api.threads.js +0 -5
- package/dist/send.reactions-BAn0iiVQ.js +0 -78
- package/dist/send.receipt-IPI1p-SP.js +0 -66
- package/dist/subagent-hooks-CTt5KCJr.js +0 -120
- package/dist/subagent-progress-DhaE_h8a.js +0 -109
- package/dist/targets-yUFTHoAx.js +0 -3
- package/dist/transcripts-source-CfFMexGt.js +0 -123
- package/node_modules/p-map/index.d.ts +0 -155
- package/node_modules/p-map/index.js +0 -285
- package/node_modules/p-map/license +0 -9
- package/node_modules/p-map/package.json +0 -57
- package/node_modules/p-map/readme.md +0 -190
- package/node_modules/typebox/build/format/_idna.d.mts +0 -2
- package/node_modules/typebox/build/format/_idna.mjs +0 -246
- package/node_modules/typebox/build/format/_puny.d.mts +0 -1
- package/node_modules/typebox/build/format/_puny.mjs +0 -77
- package/node_modules/typebox/build/schema/resolve/ref.d.mts +0 -3
- package/node_modules/typebox/build/schema/resolve/ref.mjs +0 -146
- package/node_modules/typebox/build/schema/types/contentEncoding.d.mts +0 -9
- package/node_modules/typebox/build/schema/types/contentEncoding.mjs +0 -13
- package/node_modules/typebox/build/schema/types/contentMediaType.d.mts +0 -9
- package/node_modules/typebox/build/schema/types/contentMediaType.mjs +0 -13
- package/dist/{allow-list-DnxIlPP2.js → allow-list-BDMimASD.js} +1 -1
- package/dist/{doctor-contract-DLa-BTiU.js → doctor-contract-DsWvKIXF.js} +1 -1
|
@@ -1,53 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { t as parseAndResolveDiscordTarget } from "./target-resolver-
|
|
4
|
-
import {
|
|
5
|
-
import { normalizeOptionalString, normalizeStringEntries } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
1
|
+
import { At as getChannel, J as Embed, Jt as getGuildMember, K as hasDiscordV2Components, Mt as getThreadMember, P as RequestClient, a as chunkDiscordTextWithMode, bt as getCurrentUser, d as resolveDiscordReplyMessageId, n as createDiscordRetryRunner, q as serializePayload, qt as getGuild, wt as createChannelMessage, yt as createUserDmChannel } from "./retry-DqHCW6PV.js";
|
|
2
|
+
import { c as resolveDiscordAccount, m as normalizeDiscordToken, o as mergeDiscordAccountConfig } from "./accounts-CfQ-vSyf.js";
|
|
3
|
+
import { t as parseAndResolveDiscordTarget } from "./target-resolver-V-IYae6s.js";
|
|
4
|
+
import { t as isDiscordThreadChannelType } from "./channel-type-CVLZyGYS.js";
|
|
6
5
|
import { ChannelType, MessageFlags, PermissionFlagsBits } from "discord-api-types/v10";
|
|
7
6
|
import { randomBytes } from "node:crypto";
|
|
8
7
|
import { expectDefined } from "openclaw/plugin-sdk/expect-runtime";
|
|
8
|
+
import { normalizeAccountId } from "openclaw/plugin-sdk/routing";
|
|
9
|
+
import { normalizeOptionalString, normalizeStringEntries } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
10
|
+
import { requireRuntimeConfig } from "openclaw/plugin-sdk/plugin-config-runtime";
|
|
11
|
+
import { resolveTextChunksWithFallback } from "openclaw/plugin-sdk/reply-payload";
|
|
9
12
|
import { makeProxyFetch } from "openclaw/plugin-sdk/fetch-runtime";
|
|
10
13
|
import { danger } from "openclaw/plugin-sdk/runtime-env";
|
|
11
|
-
import { requireRuntimeConfig } from "openclaw/plugin-sdk/plugin-config-runtime";
|
|
12
14
|
import { PollLayoutType } from "discord-api-types/payloads/v10";
|
|
13
15
|
import { buildOutboundMediaLoadOptions, extensionForMime, normalizePollDurationHours, normalizePollInput } from "openclaw/plugin-sdk/media-runtime";
|
|
14
|
-
import { resolveTextChunksWithFallback } from "openclaw/plugin-sdk/reply-payload";
|
|
15
16
|
import { loadWebMedia } from "openclaw/plugin-sdk/web-media";
|
|
16
|
-
//#region extensions/discord/src/proxy-fetch.ts
|
|
17
|
-
function resolveDiscordProxyUrl(account, cfg) {
|
|
18
|
-
const accountProxy = normalizeOptionalString(account.config.proxy);
|
|
19
|
-
if (accountProxy) return accountProxy;
|
|
20
|
-
return normalizeOptionalString(cfg?.channels?.discord?.proxy);
|
|
21
|
-
}
|
|
22
|
-
function resolveDiscordProxyFetchByUrl(proxyUrl, runtime) {
|
|
23
|
-
return withValidatedDiscordProxy(proxyUrl, runtime, (proxy) => makeProxyFetch(proxy));
|
|
24
|
-
}
|
|
25
|
-
function resolveDiscordProxyFetchForAccount(account, cfg, runtime) {
|
|
26
|
-
return resolveDiscordProxyFetchByUrl(resolveDiscordProxyUrl(account, cfg), runtime);
|
|
27
|
-
}
|
|
28
|
-
function withValidatedDiscordProxy(proxyUrl, runtime, createValue) {
|
|
29
|
-
const proxy = proxyUrl?.trim();
|
|
30
|
-
if (!proxy) return;
|
|
31
|
-
try {
|
|
32
|
-
validateDiscordProxyUrl(proxy);
|
|
33
|
-
return createValue(proxy);
|
|
34
|
-
} catch (err) {
|
|
35
|
-
runtime?.error?.(danger(`discord: invalid rest proxy: ${String(err)}`));
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
function validateDiscordProxyUrl(proxyUrl) {
|
|
40
|
-
let parsed;
|
|
41
|
-
try {
|
|
42
|
-
parsed = new URL(proxyUrl);
|
|
43
|
-
} catch {
|
|
44
|
-
throw new Error("Proxy URL must be a valid http or https URL");
|
|
45
|
-
}
|
|
46
|
-
if (!["http:", "https:"].includes(parsed.protocol)) throw new Error("Proxy URL must use http or https");
|
|
47
|
-
if (!parsed.hostname) throw new Error("Proxy URL must include a host");
|
|
48
|
-
return proxyUrl;
|
|
49
|
-
}
|
|
50
|
-
//#endregion
|
|
51
17
|
//#region extensions/discord/src/recipient-resolution.ts
|
|
52
18
|
async function parseAndResolveRecipient(raw, cfg, accountId, parseOptions = {}) {
|
|
53
19
|
if (!cfg) throw new Error("Discord recipient resolution requires a resolved runtime config. Load and resolve config at the command or gateway boundary, then pass cfg through the runtime path.");
|
|
@@ -65,7 +31,14 @@ async function parseAndResolveRecipient(raw, cfg, accountId, parseOptions = {})
|
|
|
65
31
|
};
|
|
66
32
|
}
|
|
67
33
|
async function parseAndResolveChannelRecipient(raw, cfg, accountId) {
|
|
68
|
-
|
|
34
|
+
const resolved = await parseAndResolveDiscordTarget(raw, {
|
|
35
|
+
cfg: requireRuntimeConfig(cfg, "Discord recipient resolution"),
|
|
36
|
+
accountId
|
|
37
|
+
}, { defaultKind: "channel" });
|
|
38
|
+
return {
|
|
39
|
+
kind: resolved.kind,
|
|
40
|
+
id: resolved.id
|
|
41
|
+
};
|
|
69
42
|
}
|
|
70
43
|
//#endregion
|
|
71
44
|
//#region extensions/discord/src/monitor/gateway-registry.ts
|
|
@@ -97,6 +70,41 @@ function clearGateways() {
|
|
|
97
70
|
gatewayRegistry.clear();
|
|
98
71
|
}
|
|
99
72
|
//#endregion
|
|
73
|
+
//#region extensions/discord/src/proxy-fetch.ts
|
|
74
|
+
function resolveDiscordProxyUrl(account, cfg) {
|
|
75
|
+
const accountProxy = normalizeOptionalString(account.config.proxy);
|
|
76
|
+
if (accountProxy) return accountProxy;
|
|
77
|
+
return normalizeOptionalString(cfg?.channels?.discord?.proxy);
|
|
78
|
+
}
|
|
79
|
+
function resolveDiscordProxyFetchByUrl(proxyUrl, runtime) {
|
|
80
|
+
return withValidatedDiscordProxy(proxyUrl, runtime, (proxy) => makeProxyFetch(proxy));
|
|
81
|
+
}
|
|
82
|
+
function resolveDiscordProxyFetchForAccount(account, cfg, runtime) {
|
|
83
|
+
return resolveDiscordProxyFetchByUrl(resolveDiscordProxyUrl(account, cfg), runtime);
|
|
84
|
+
}
|
|
85
|
+
function withValidatedDiscordProxy(proxyUrl, runtime, createValue) {
|
|
86
|
+
const proxy = proxyUrl?.trim();
|
|
87
|
+
if (!proxy) return;
|
|
88
|
+
try {
|
|
89
|
+
validateDiscordProxyUrl(proxy);
|
|
90
|
+
return createValue(proxy);
|
|
91
|
+
} catch (err) {
|
|
92
|
+
runtime?.error?.(danger(`discord: invalid rest proxy: ${String(err)}`));
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
function validateDiscordProxyUrl(proxyUrl) {
|
|
97
|
+
let parsed;
|
|
98
|
+
try {
|
|
99
|
+
parsed = new URL(proxyUrl);
|
|
100
|
+
} catch {
|
|
101
|
+
throw new Error("Proxy URL must be a valid http or https URL");
|
|
102
|
+
}
|
|
103
|
+
if (!["http:", "https:"].includes(parsed.protocol)) throw new Error("Proxy URL must use http or https");
|
|
104
|
+
if (!parsed.hostname) throw new Error("Proxy URL must include a host");
|
|
105
|
+
return proxyUrl;
|
|
106
|
+
}
|
|
107
|
+
//#endregion
|
|
100
108
|
//#region extensions/discord/src/proxy-request-client.ts
|
|
101
109
|
const DISCORD_REST_TIMEOUT_MS = 15e3;
|
|
102
110
|
function createDiscordRequestClient(token, options) {
|
|
@@ -181,7 +189,11 @@ function createDiscordRestClient(opts) {
|
|
|
181
189
|
};
|
|
182
190
|
}
|
|
183
191
|
function createDiscordClient(opts) {
|
|
184
|
-
const { token, rest, account } = createDiscordRestClient(opts);
|
|
192
|
+
const { token, rest, account: restAccount } = createDiscordRestClient(opts);
|
|
193
|
+
const account = normalizeDiscordToken(opts.token, "channels.discord.token") ? resolveDiscordAccount({
|
|
194
|
+
cfg: opts.cfg,
|
|
195
|
+
accountId: opts.accountId
|
|
196
|
+
}) : restAccount;
|
|
185
197
|
return {
|
|
186
198
|
token,
|
|
187
199
|
rest,
|
|
@@ -189,16 +201,70 @@ function createDiscordClient(opts) {
|
|
|
189
201
|
retry: opts.retry,
|
|
190
202
|
verbose: opts.verbose,
|
|
191
203
|
isGatewayDisconnected: () => {
|
|
192
|
-
const gateway = getGateway(
|
|
204
|
+
const gateway = getGateway(restAccount.accountId);
|
|
193
205
|
return gateway !== void 0 && !gateway.isConnected;
|
|
194
206
|
}
|
|
195
|
-
})
|
|
207
|
+
}),
|
|
208
|
+
account
|
|
196
209
|
};
|
|
197
210
|
}
|
|
198
211
|
function resolveDiscordRest(opts) {
|
|
199
212
|
return createDiscordRestClient(opts).rest;
|
|
200
213
|
}
|
|
201
214
|
//#endregion
|
|
215
|
+
//#region extensions/discord/src/send.message-request.ts
|
|
216
|
+
const SUPPRESS_EMBEDS_FLAG = MessageFlags.SuppressEmbeds;
|
|
217
|
+
const SUPPRESS_NOTIFICATIONS_FLAG = MessageFlags.SuppressNotifications;
|
|
218
|
+
function createDiscordMessageNonce() {
|
|
219
|
+
return randomBytes(12).toString("hex");
|
|
220
|
+
}
|
|
221
|
+
function resolveDiscordSendComponents(params) {
|
|
222
|
+
if (!params.components || !params.isFirst) return;
|
|
223
|
+
return typeof params.components === "function" ? params.components(params.text) : params.components;
|
|
224
|
+
}
|
|
225
|
+
function normalizeDiscordEmbeds(embeds) {
|
|
226
|
+
if (!embeds?.length) return;
|
|
227
|
+
return embeds.map((embed) => embed instanceof Embed ? embed : new Embed(embed));
|
|
228
|
+
}
|
|
229
|
+
function resolveDiscordSendEmbeds(params) {
|
|
230
|
+
if (!params.embeds || !params.isFirst) return;
|
|
231
|
+
return normalizeDiscordEmbeds(params.embeds);
|
|
232
|
+
}
|
|
233
|
+
function buildDiscordMessagePayload(params) {
|
|
234
|
+
const payload = {};
|
|
235
|
+
const hasV2 = hasDiscordV2Components(params.components);
|
|
236
|
+
const trimmed = params.text.trim();
|
|
237
|
+
if (!hasV2 && trimmed) payload.content = params.text;
|
|
238
|
+
if (params.components?.length) payload.components = params.components;
|
|
239
|
+
if (!hasV2 && params.embeds?.length) payload.embeds = params.embeds;
|
|
240
|
+
if (params.allowedMentions) payload.allowed_mentions = params.allowedMentions;
|
|
241
|
+
if (params.flags !== void 0) payload.flags = params.flags;
|
|
242
|
+
if (params.files?.length) payload.files = params.files;
|
|
243
|
+
return payload;
|
|
244
|
+
}
|
|
245
|
+
function resolveDiscordMessageFlags(params) {
|
|
246
|
+
let flags = 0;
|
|
247
|
+
if (params.suppressEmbeds) flags |= SUPPRESS_EMBEDS_FLAG;
|
|
248
|
+
if (params.silent) flags |= SUPPRESS_NOTIFICATIONS_FLAG;
|
|
249
|
+
return flags || void 0;
|
|
250
|
+
}
|
|
251
|
+
function resolveDiscordSuppressEmbeds(params) {
|
|
252
|
+
return params.override ?? params.configured ?? true;
|
|
253
|
+
}
|
|
254
|
+
function buildDiscordMessageRequest(params) {
|
|
255
|
+
const payload = buildDiscordMessagePayload(params);
|
|
256
|
+
const nonce = params.endpoint === "create-message" ? params.nonce ?? createDiscordMessageNonce() : void 0;
|
|
257
|
+
return {
|
|
258
|
+
...serializePayload(payload),
|
|
259
|
+
...params.replyTo ? { message_reference: {
|
|
260
|
+
message_id: params.replyTo,
|
|
261
|
+
fail_if_not_exists: false
|
|
262
|
+
} } : {},
|
|
263
|
+
...nonce !== void 0 ? { nonce } : {},
|
|
264
|
+
...nonce ? { enforce_nonce: true } : {}
|
|
265
|
+
};
|
|
266
|
+
}
|
|
267
|
+
//#endregion
|
|
202
268
|
//#region extensions/discord/src/send.permissions.ts
|
|
203
269
|
const PERMISSION_ENTRIES = Object.entries(PermissionFlagsBits).filter(([, value]) => typeof value === "bigint");
|
|
204
270
|
const ALL_PERMISSIONS = PERMISSION_ENTRIES.reduce((acc, [, value]) => acc | value, 0n);
|
|
@@ -220,9 +286,6 @@ function hasAdministrator(bitfield) {
|
|
|
220
286
|
function hasPermissionBit(bitfield, permission) {
|
|
221
287
|
return (bitfield & permission) === permission;
|
|
222
288
|
}
|
|
223
|
-
function isThreadChannelType(channelType) {
|
|
224
|
-
return channelType === ChannelType.GuildNewsThread || channelType === ChannelType.GuildPublicThread || channelType === ChannelType.GuildPrivateThread;
|
|
225
|
-
}
|
|
226
289
|
async function fetchBotUserId(rest) {
|
|
227
290
|
const me = await getCurrentUser(rest);
|
|
228
291
|
if (!me?.id) throw new Error("Failed to resolve bot user id");
|
|
@@ -277,7 +340,7 @@ function resolveMemberChannelPermissionBits(params) {
|
|
|
277
340
|
async function resolveChannelPermissionSubject(rest, channel) {
|
|
278
341
|
const channelType = "type" in channel ? channel.type : void 0;
|
|
279
342
|
const parentId = "parent_id" in channel ? channel.parent_id : void 0;
|
|
280
|
-
if (
|
|
343
|
+
if (isDiscordThreadChannelType(channelType) && parentId) return await getChannel(rest, parentId);
|
|
281
344
|
return channel;
|
|
282
345
|
}
|
|
283
346
|
/**
|
|
@@ -312,7 +375,7 @@ async function canViewDiscordGuildChannel(guildId, channelId, userId, opts) {
|
|
|
312
375
|
channel: permissionChannel
|
|
313
376
|
});
|
|
314
377
|
if (!hasPermissionBit(permissions, PermissionFlagsBits.ViewChannel)) return false;
|
|
315
|
-
if ("type" in channel && channel.type === ChannelType.
|
|
378
|
+
if ("type" in channel && channel.type === ChannelType.PrivateThread) {
|
|
316
379
|
if (hasPermissionBit(permissions, PermissionFlagsBits.ManageThreads)) return true;
|
|
317
380
|
await getThreadMember(rest, channel.id, userId);
|
|
318
381
|
}
|
|
@@ -453,62 +516,6 @@ const DISCORD_MAX_EMOJI_BYTES = 256 * 1024;
|
|
|
453
516
|
const DISCORD_MAX_STICKER_BYTES = 512 * 1024;
|
|
454
517
|
const DISCORD_MAX_EVENT_COVER_BYTES = 8 * 1024 * 1024;
|
|
455
518
|
//#endregion
|
|
456
|
-
//#region extensions/discord/src/send.message-request.ts
|
|
457
|
-
const SUPPRESS_EMBEDS_FLAG = MessageFlags.SuppressEmbeds;
|
|
458
|
-
const SUPPRESS_NOTIFICATIONS_FLAG = MessageFlags.SuppressNotifications;
|
|
459
|
-
function createDiscordMessageNonce() {
|
|
460
|
-
return randomBytes(12).toString("hex");
|
|
461
|
-
}
|
|
462
|
-
function resolveDiscordSendComponents(params) {
|
|
463
|
-
if (!params.components || !params.isFirst) return;
|
|
464
|
-
return typeof params.components === "function" ? params.components(params.text) : params.components;
|
|
465
|
-
}
|
|
466
|
-
function normalizeDiscordEmbeds(embeds) {
|
|
467
|
-
if (!embeds?.length) return;
|
|
468
|
-
return embeds.map((embed) => embed instanceof Embed ? embed : new Embed(embed));
|
|
469
|
-
}
|
|
470
|
-
function resolveDiscordSendEmbeds(params) {
|
|
471
|
-
if (!params.embeds || !params.isFirst) return;
|
|
472
|
-
return normalizeDiscordEmbeds(params.embeds);
|
|
473
|
-
}
|
|
474
|
-
function buildDiscordMessagePayload(params) {
|
|
475
|
-
const payload = {};
|
|
476
|
-
const hasV2 = hasV2Components(params.components);
|
|
477
|
-
const trimmed = params.text.trim();
|
|
478
|
-
if (!hasV2 && trimmed) payload.content = params.text;
|
|
479
|
-
if (params.components?.length) payload.components = params.components;
|
|
480
|
-
if (!hasV2 && params.embeds?.length) payload.embeds = params.embeds;
|
|
481
|
-
if (params.allowedMentions) payload.allowed_mentions = params.allowedMentions;
|
|
482
|
-
if (params.flags !== void 0) payload.flags = params.flags;
|
|
483
|
-
if (params.files?.length) payload.files = params.files;
|
|
484
|
-
return payload;
|
|
485
|
-
}
|
|
486
|
-
function resolveDiscordMessageFlags(params) {
|
|
487
|
-
let flags = 0;
|
|
488
|
-
if (params.suppressEmbeds) flags |= SUPPRESS_EMBEDS_FLAG;
|
|
489
|
-
if (params.silent) flags |= SUPPRESS_NOTIFICATIONS_FLAG;
|
|
490
|
-
return flags || void 0;
|
|
491
|
-
}
|
|
492
|
-
function resolveDiscordSuppressEmbeds(params) {
|
|
493
|
-
return params.override ?? params.configured ?? true;
|
|
494
|
-
}
|
|
495
|
-
function buildDiscordMessageRequest(params) {
|
|
496
|
-
const payload = buildDiscordMessagePayload(params);
|
|
497
|
-
const nonce = params.endpoint === "create-message" ? params.nonce ?? createDiscordMessageNonce() : void 0;
|
|
498
|
-
return stripUndefinedFields({
|
|
499
|
-
...serializePayload(payload),
|
|
500
|
-
...params.replyTo ? { message_reference: {
|
|
501
|
-
message_id: params.replyTo,
|
|
502
|
-
fail_if_not_exists: false
|
|
503
|
-
} } : {},
|
|
504
|
-
nonce,
|
|
505
|
-
enforce_nonce: nonce ? true : void 0
|
|
506
|
-
});
|
|
507
|
-
}
|
|
508
|
-
function hasV2Components(components) {
|
|
509
|
-
return Boolean(components?.some((component) => "isV2" in component && component.isV2));
|
|
510
|
-
}
|
|
511
|
-
//#endregion
|
|
512
519
|
//#region extensions/discord/src/send.shared.ts
|
|
513
520
|
const DISCORD_TEXT_LIMIT = 2e3;
|
|
514
521
|
const DISCORD_MAX_STICKERS = 3;
|
|
@@ -589,14 +596,14 @@ async function buildDiscordSendError(err, ctx) {
|
|
|
589
596
|
probedChannelType = permissions.channelType;
|
|
590
597
|
const current = new Set(permissions.permissions);
|
|
591
598
|
const required = ["ViewChannel", "SendMessages"];
|
|
592
|
-
if (
|
|
599
|
+
if (isDiscordThreadChannelType(probedChannelType)) required.push("SendMessagesInThreads");
|
|
593
600
|
if (ctx.hasMedia) required.push("AttachFiles");
|
|
594
601
|
missing = required.filter((permission) => !current.has(permission));
|
|
595
602
|
} catch {}
|
|
596
603
|
const status = getDiscordErrorStatus(err);
|
|
597
604
|
const apiDetails = [`code=${code}`, status != null ? `status=${status}` : void 0].filter(Boolean).join(" ");
|
|
598
605
|
const probedPermissions = ["ViewChannel", "SendMessages"];
|
|
599
|
-
if (
|
|
606
|
+
if (isDiscordThreadChannelType(probedChannelType)) probedPermissions.push("SendMessagesInThreads");
|
|
600
607
|
if (ctx.hasMedia) probedPermissions.push("AttachFiles");
|
|
601
608
|
const probeSummary = probedPermissions.join("/");
|
|
602
609
|
return new DiscordSendError(`${missing.length ? `discord missing permissions in channel ${ctx.channelId}: ${missing.join(", ")}` : `discord missing permissions in channel ${ctx.channelId}; permission probe did not identify missing ${probeSummary}`} (${apiDetails}). bot might be blocked by channel/thread overrides, archived thread state, reply target visibility, or app-role position`, {
|
|
@@ -638,14 +645,13 @@ function buildDiscordTextChunks(text, opts = {}) {
|
|
|
638
645
|
}
|
|
639
646
|
async function sendDiscordText(params) {
|
|
640
647
|
const { rest, channelId, text, request, reply, maxLinesPerMessage, components, embeds, allowedMentions, chunkMode, silent, suppressEmbeds, maxChars, onResult, onPlatformSendDispatch } = params;
|
|
641
|
-
if (!text.trim()) throw new Error("Message must be non-empty for Discord sends");
|
|
642
648
|
const chunks = buildDiscordTextChunks(text, {
|
|
643
649
|
maxLinesPerMessage,
|
|
644
650
|
chunkMode,
|
|
645
651
|
maxChars
|
|
646
652
|
});
|
|
653
|
+
if (!chunks.length) chunks.push("");
|
|
647
654
|
const sendChunk = async (chunk, isFirst) => {
|
|
648
|
-
const chunkReplyTo = resolveDiscordReplyMessageId(reply, isFirst);
|
|
649
655
|
const chunkComponents = resolveDiscordSendComponents({
|
|
650
656
|
components,
|
|
651
657
|
text: chunk,
|
|
@@ -655,6 +661,9 @@ async function sendDiscordText(params) {
|
|
|
655
661
|
embeds,
|
|
656
662
|
isFirst
|
|
657
663
|
});
|
|
664
|
+
if (!chunk.trim() && !chunkComponents?.length && !chunkEmbeds?.length) throw new Error("Message must be non-empty for Discord sends");
|
|
665
|
+
const chunkReplyTo = resolveDiscordReplyMessageId(reply, isFirst);
|
|
666
|
+
const kind = chunkComponents?.length || chunkEmbeds?.length ? "card" : "text";
|
|
658
667
|
const flags = resolveDiscordMessageFlags({
|
|
659
668
|
silent,
|
|
660
669
|
suppressEmbeds: suppressEmbeds && !chunkEmbeds?.length
|
|
@@ -668,15 +677,18 @@ async function sendDiscordText(params) {
|
|
|
668
677
|
flags,
|
|
669
678
|
replyTo: chunkReplyTo
|
|
670
679
|
});
|
|
671
|
-
await onPlatformSendDispatch?.();
|
|
672
680
|
return {
|
|
673
|
-
result: await request(() =>
|
|
674
|
-
|
|
681
|
+
result: await request(async () => {
|
|
682
|
+
await onPlatformSendDispatch?.();
|
|
683
|
+
return createChannelMessage(rest, channelId, { body });
|
|
684
|
+
}, "text", { safety: "nonce-protected-create" }),
|
|
685
|
+
replyToId: chunkReplyTo,
|
|
686
|
+
kind
|
|
675
687
|
};
|
|
676
688
|
};
|
|
677
689
|
if (chunks.length === 1) {
|
|
678
|
-
const { result, replyToId } = await sendChunk(expectDefined(chunks.at(0), "single Discord text chunk"), true);
|
|
679
|
-
await onResult?.(result,
|
|
690
|
+
const { result, replyToId, kind } = await sendChunk(expectDefined(chunks.at(0), "single Discord text chunk"), true);
|
|
691
|
+
await onResult?.(result, kind, replyToId);
|
|
680
692
|
return {
|
|
681
693
|
...result,
|
|
682
694
|
platformMessageIds: result.id ? [result.id] : []
|
|
@@ -687,7 +699,7 @@ async function sendDiscordText(params) {
|
|
|
687
699
|
for (const [index, chunk] of chunks.entries()) {
|
|
688
700
|
const sent = await sendChunk(chunk, index === 0);
|
|
689
701
|
last = sent.result;
|
|
690
|
-
await onResult?.(last,
|
|
702
|
+
await onResult?.(last, sent.kind, sent.replyToId);
|
|
691
703
|
if (last.id) platformMessageIds.push(last.id);
|
|
692
704
|
}
|
|
693
705
|
if (!last) throw new Error("Discord send failed (empty chunk result)");
|
|
@@ -739,8 +751,10 @@ async function sendDiscordMedia(params) {
|
|
|
739
751
|
});
|
|
740
752
|
let res;
|
|
741
753
|
try {
|
|
742
|
-
await
|
|
743
|
-
|
|
754
|
+
res = await request(async () => {
|
|
755
|
+
await onPlatformSendDispatch?.();
|
|
756
|
+
return createChannelMessage(rest, channelId, { body });
|
|
757
|
+
}, "media", { safety: "nonce-protected-create" });
|
|
744
758
|
} catch (err) {
|
|
745
759
|
if (!isDiscordUploadTooLargeError(err)) throw err;
|
|
746
760
|
return sendDiscordText({
|
|
@@ -776,7 +790,8 @@ async function sendDiscordMedia(params) {
|
|
|
776
790
|
suppressEmbeds,
|
|
777
791
|
allowedMentions,
|
|
778
792
|
maxChars,
|
|
779
|
-
onResult
|
|
793
|
+
onResult,
|
|
794
|
+
onPlatformSendDispatch
|
|
780
795
|
});
|
|
781
796
|
for (const id of followup.platformMessageIds) if (id) platformMessageIds.push(id);
|
|
782
797
|
}
|
|
@@ -793,4 +808,4 @@ function formatReactionEmoji(emoji) {
|
|
|
793
808
|
return buildReactionIdentifier(emoji);
|
|
794
809
|
}
|
|
795
810
|
//#endregion
|
|
796
|
-
export {
|
|
811
|
+
export { resolveDiscordSendComponents as A, validateDiscordProxyUrl as B, hasAllGuildPermissionsDiscord as C, buildDiscordMessageRequest as D, SUPPRESS_NOTIFICATIONS_FLAG as E, createDiscordRuntimeAccountContext as F, unregisterGateway as G, clearGateways as H, resolveDiscordClientAccountContext as I, parseAndResolveChannelRecipient as K, resolveDiscordRest as L, resolveDiscordSuppressEmbeds as M, createDiscordClient as N, createDiscordMessageNonce as O, createDiscordRestClient as P, DISCORD_REST_TIMEOUT_MS as R, fetchMemberGuildPermissionsDiscord as S, hasAnyGuildPermissionDiscord as T, getGateway as U, withValidatedDiscordProxy as V, registerGateway as W, DiscordSendError as _, normalizeDiscordPollInput as a, canViewDiscordGuildChannel as b, normalizeStickerIds as c, resolveDiscordTargetChannelId as d, sendDiscordMedia as f, DISCORD_MAX_STICKER_BYTES as g, DISCORD_MAX_EVENT_COVER_BYTES as h, formatReactionEmoji as i, resolveDiscordSendEmbeds as j, resolveDiscordMessageFlags as k, resolveChannelId as l, DISCORD_MAX_EMOJI_BYTES as m, buildDiscordTextChunks as n, normalizeEmojiName as o, sendDiscordText as p, buildReactionIdentifier as r, normalizeReactionEmoji as s, buildDiscordSendError as t, resolveDiscordChannel as u, canManageGuildMemberRoleDiscord as v, hasAnyChannelPermissionDiscord as w, fetchChannelPermissionsDiscord as x, canManageGuildRoleDiscord as y, resolveDiscordProxyFetchForAccount as z };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { x as formatDiscordUserTag } from "./allow-list-
|
|
1
|
+
import { x as formatDiscordUserTag } from "./allow-list-BDMimASD.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) {
|
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-rPs4dsk_.js";
|
|
2
2
|
export { discordSetupPlugin };
|
|
@@ -1,19 +1,39 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as
|
|
3
|
-
import {
|
|
4
|
-
import { t as
|
|
5
|
-
import { n as normalizeCompatibilityConfig } from "./doctor-contract-
|
|
6
|
-
import {
|
|
1
|
+
import { c as resolveDiscordAccount, d as resolveDiscordAccountDisabledReason, f as resolveDiscordAccountDmPolicy, l as resolveDiscordAccountAllowFrom, n as isDiscordAccountEnabledForRuntime, o as mergeDiscordAccountConfig, r as listDiscordAccountIds, s as resolveDefaultDiscordAccountId } from "./accounts-CfQ-vSyf.js";
|
|
2
|
+
import { t as inspectDiscordAccount } from "./account-inspect-BDfKyuvL.js";
|
|
3
|
+
import { t as discordIngressIdentity } from "./ingress-identity-CzZKcPK8.js";
|
|
4
|
+
import { t as DiscordChannelConfigSchema } from "./config-schema-CxPqtVI1.js";
|
|
5
|
+
import { n as normalizeCompatibilityConfig } from "./doctor-contract-DsWvKIXF.js";
|
|
6
|
+
import { r as secretTargetRegistryEntries, t as collectRuntimeConfigAssignments } from "./secret-config-contract-B3i6WxV5.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";
|
|
9
9
|
import { describeAccountSnapshot } from "openclaw/plugin-sdk/account-helpers";
|
|
10
|
-
import { normalizeAccountId } from "openclaw/plugin-sdk/account-id";
|
|
10
|
+
import { DEFAULT_ACCOUNT_ID as DEFAULT_ACCOUNT_ID$1, normalizeAccountId } from "openclaw/plugin-sdk/account-id";
|
|
11
11
|
import { adaptScopedAccountAccessor, createScopedChannelConfigAdapter, createScopedDmSecurityResolver } from "openclaw/plugin-sdk/channel-config-helpers";
|
|
12
|
+
import { PAIRING_APPROVED_MESSAGE, buildTokenChannelStatusSummary, projectCredentialSnapshotFields, resolveConfiguredFromCredentialStatuses as resolveConfiguredFromCredentialStatuses$1 } from "openclaw/plugin-sdk/channel-status";
|
|
12
13
|
import { formatAllowFromLowercase } from "openclaw/plugin-sdk/allow-from";
|
|
13
14
|
import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
|
|
14
|
-
import { createOpenProviderConfiguredRouteWarningCollector } from "openclaw/plugin-sdk/channel-policy";
|
|
15
|
+
import { createConditionalWarningCollector, createOpenProviderConfiguredRouteWarningCollector } from "openclaw/plugin-sdk/channel-policy";
|
|
16
|
+
import { identityEntryAuthenticationClassifier } from "openclaw/plugin-sdk/channel-ingress-runtime";
|
|
15
17
|
import { defineChannelSetupContract } from "openclaw/plugin-sdk/channel-setup";
|
|
16
18
|
import { createEnvPatchedAccountSetupAdapter } from "openclaw/plugin-sdk/setup-runtime";
|
|
19
|
+
//#region extensions/discord/src/channel-api.ts
|
|
20
|
+
const DISCORD_CHANNEL_META = {
|
|
21
|
+
id: "discord",
|
|
22
|
+
label: "Discord",
|
|
23
|
+
selectionLabel: "Discord (Bot API)",
|
|
24
|
+
detailLabel: "Discord Bot",
|
|
25
|
+
docsPath: "/channels/discord",
|
|
26
|
+
docsLabel: "discord",
|
|
27
|
+
blurb: "very well supported right now.",
|
|
28
|
+
systemImage: "bubble.left.and.bubble.right",
|
|
29
|
+
markdownCapable: true,
|
|
30
|
+
preferSessionLookupForAnnounceTarget: true
|
|
31
|
+
};
|
|
32
|
+
function getChatChannelMeta(id) {
|
|
33
|
+
if (id !== DISCORD_CHANNEL_META.id) throw new Error(`Unsupported Discord channel meta lookup: ${id}`);
|
|
34
|
+
return DISCORD_CHANNEL_META;
|
|
35
|
+
}
|
|
36
|
+
//#endregion
|
|
17
37
|
//#region extensions/discord/src/security.ts
|
|
18
38
|
const resolveDiscordDmPolicy = createScopedDmSecurityResolver({
|
|
19
39
|
channelKey: "discord",
|
|
@@ -30,6 +50,7 @@ const resolveDiscordDmPolicy = createScopedDmSecurityResolver({
|
|
|
30
50
|
})
|
|
31
51
|
}),
|
|
32
52
|
policyPathSuffix: "dmPolicy",
|
|
53
|
+
classifyEntryAuthentication: identityEntryAuthenticationClassifier(discordIngressIdentity),
|
|
33
54
|
normalizeEntry: (raw) => raw.trim().replace(/^(discord|user):/i, "").replace(/^<@!?(\d+)>$/, "$1")
|
|
34
55
|
});
|
|
35
56
|
const collectDiscordSecurityWarnings = createOpenProviderConfiguredRouteWarningCollector({
|
|
@@ -48,10 +69,16 @@ const collectDiscordSecurityWarnings = createOpenProviderConfiguredRouteWarningC
|
|
|
48
69
|
remediation: "Set channels.discord.groupPolicy=\"allowlist\" and configure channels.discord.guilds.<id>.channels"
|
|
49
70
|
}
|
|
50
71
|
});
|
|
51
|
-
const
|
|
72
|
+
const collectDiscordSecurityFindings = createConditionalWarningCollector.findings({
|
|
73
|
+
collectWarnings: collectDiscordSecurityWarnings,
|
|
74
|
+
checkId: "channels.discord.groups.open",
|
|
75
|
+
severity: "critical",
|
|
76
|
+
title: "Discord security warning"
|
|
77
|
+
});
|
|
78
|
+
const loadDiscordSecurityAuditModule = createLazyRuntimeModule(() => import("./security-audit.runtime-sKZyKgpx.js"));
|
|
52
79
|
const discordSecurityAdapter = {
|
|
53
80
|
resolveDmPolicy: resolveDiscordDmPolicy,
|
|
54
|
-
collectWarnings:
|
|
81
|
+
collectWarnings: collectDiscordSecurityFindings,
|
|
55
82
|
collectAuditFindings: async (params) => (await loadDiscordSecurityAuditModule()).collectDiscordSecurityAuditFindings(params)
|
|
56
83
|
};
|
|
57
84
|
const discordSetupContract = defineChannelSetupContract({
|
|
@@ -87,7 +114,7 @@ const DISCORD_LEGACY_CONFIG_RULES = [];
|
|
|
87
114
|
//#endregion
|
|
88
115
|
//#region extensions/discord/src/shared.ts
|
|
89
116
|
const DISCORD_CHANNEL = "discord";
|
|
90
|
-
const loadDiscordDoctorModule = createLazyRuntimeModule(() => import("./doctor-
|
|
117
|
+
const loadDiscordDoctorModule = createLazyRuntimeModule(() => import("./doctor-zQTtn6hm.js"));
|
|
91
118
|
const discordDoctor = {
|
|
92
119
|
dmAllowFromMode: "topOnly",
|
|
93
120
|
groupModel: "route",
|
|
@@ -161,10 +188,10 @@ function createDiscordPluginBase(params) {
|
|
|
161
188
|
hasConfiguredState: ({ env }) => typeof env?.DISCORD_BOT_TOKEN === "string" && env.DISCORD_BOT_TOKEN.trim().length > 0,
|
|
162
189
|
isEnabled: (account, cfg) => isDiscordAccountEnabledForRuntime(account, cfg),
|
|
163
190
|
disabledReason: (account, cfg) => resolveDiscordAccountDisabledReason(account, cfg),
|
|
164
|
-
isConfigured: (account) => resolveConfiguredFromCredentialStatuses(account) ?? Boolean(account.token?.trim()),
|
|
191
|
+
isConfigured: (account) => resolveConfiguredFromCredentialStatuses$1(account) ?? Boolean(account.token?.trim()),
|
|
165
192
|
describeAccount: (account) => describeAccountSnapshot({
|
|
166
193
|
account,
|
|
167
|
-
configured: resolveConfiguredFromCredentialStatuses(account) ?? Boolean(account.token?.trim()),
|
|
194
|
+
configured: resolveConfiguredFromCredentialStatuses$1(account) ?? Boolean(account.token?.trim()),
|
|
168
195
|
extra: {
|
|
169
196
|
tokenSource: account.tokenSource,
|
|
170
197
|
tokenStatus: account.tokenStatus
|
|
@@ -182,4 +209,4 @@ function createDiscordPluginBase(params) {
|
|
|
182
209
|
};
|
|
183
210
|
}
|
|
184
211
|
//#endregion
|
|
185
|
-
export { discordSecurityAdapter as a, discordSetupContract as i, discordConfigAdapter as n, DISCORD_LEGACY_CONFIG_RULES as r, createDiscordPluginBase as t };
|
|
212
|
+
export { discordSecurityAdapter as a, buildTokenChannelStatusSummary as c, discordSetupContract as i, projectCredentialSnapshotFields as l, discordConfigAdapter as n, DEFAULT_ACCOUNT_ID$1 as o, DISCORD_LEGACY_CONFIG_RULES as r, PAIRING_APPROVED_MESSAGE as s, createDiscordPluginBase as t, resolveConfiguredFromCredentialStatuses$1 as u };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { on as __exportAll } from "./retry-DqHCW6PV.js";
|
|
2
|
+
import { o as unbindThreadBindingsBySessionKey, r as listThreadBindingsBySessionKey } from "./thread-bindings-DvYP79fy.js";
|
|
3
|
+
import { normalizeOptionalLowercaseString, normalizeOptionalStringifiedId } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
4
|
+
//#region extensions/discord/src/subagent-hooks.ts
|
|
5
|
+
var subagent_hooks_exports = /* @__PURE__ */ __exportAll({
|
|
6
|
+
handleDiscordSubagentDeliveryTarget: () => handleDiscordSubagentDeliveryTarget,
|
|
7
|
+
handleDiscordSubagentEnded: () => handleDiscordSubagentEnded
|
|
8
|
+
});
|
|
9
|
+
function normalizeThreadBindingTargetKind(raw) {
|
|
10
|
+
const normalized = normalizeOptionalLowercaseString(raw);
|
|
11
|
+
if (normalized === "subagent" || normalized === "acp") return normalized;
|
|
12
|
+
}
|
|
13
|
+
function handleDiscordSubagentEnded(event) {
|
|
14
|
+
unbindThreadBindingsBySessionKey({
|
|
15
|
+
targetSessionKey: event.targetSessionKey,
|
|
16
|
+
accountId: event.accountId,
|
|
17
|
+
targetKind: normalizeThreadBindingTargetKind(event.targetKind),
|
|
18
|
+
reason: event.reason,
|
|
19
|
+
sendFarewell: event.sendFarewell
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
function handleDiscordSubagentDeliveryTarget(event) {
|
|
23
|
+
if (!event.expectsCompletionMessage) return;
|
|
24
|
+
if (normalizeOptionalLowercaseString(event.requesterOrigin?.channel) !== "discord") return;
|
|
25
|
+
const requesterAccountId = event.requesterOrigin?.accountId?.trim();
|
|
26
|
+
const requesterThreadId = event.requesterOrigin?.threadId != null && event.requesterOrigin.threadId !== "" ? normalizeOptionalStringifiedId(event.requesterOrigin.threadId) ?? "" : "";
|
|
27
|
+
const bindings = listThreadBindingsBySessionKey({
|
|
28
|
+
targetSessionKey: event.childSessionKey,
|
|
29
|
+
...requesterAccountId ? { accountId: requesterAccountId } : {},
|
|
30
|
+
targetKind: "subagent"
|
|
31
|
+
});
|
|
32
|
+
if (bindings.length === 0) return;
|
|
33
|
+
let binding;
|
|
34
|
+
if (requesterThreadId) binding = bindings.find((entry) => {
|
|
35
|
+
if (entry.threadId !== requesterThreadId) return false;
|
|
36
|
+
if (requesterAccountId && entry.accountId !== requesterAccountId) return false;
|
|
37
|
+
return true;
|
|
38
|
+
});
|
|
39
|
+
if (!binding && bindings.length === 1) binding = bindings[0];
|
|
40
|
+
if (!binding) return;
|
|
41
|
+
return { origin: {
|
|
42
|
+
channel: "discord",
|
|
43
|
+
accountId: binding.accountId,
|
|
44
|
+
to: `channel:${binding.threadId}`,
|
|
45
|
+
threadId: binding.threadId
|
|
46
|
+
} };
|
|
47
|
+
}
|
|
48
|
+
//#endregion
|
|
49
|
+
export { handleDiscordSubagentEnded as n, subagent_hooks_exports as r, handleDiscordSubagentDeliveryTarget as t };
|
|
@@ -1,12 +1,7 @@
|
|
|
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-
|
|
4
|
-
const loadDiscordSubagentProgressModule = createLazyRuntimeModule(() => import("./subagent-progress-DhaE_h8a.js"));
|
|
3
|
+
const loadDiscordSubagentHooksModule = createLazyRuntimeModule(() => import("./subagent-hooks-JyGrtQIl.js").then((n) => n.r));
|
|
5
4
|
function registerDiscordSubagentHooks(api) {
|
|
6
|
-
api.on("gateway_start", async () => {
|
|
7
|
-
const { recoverDiscordSubagentProgress } = await loadDiscordSubagentProgressModule();
|
|
8
|
-
await recoverDiscordSubagentProgress(api);
|
|
9
|
-
});
|
|
10
5
|
api.on("subagent_ended", async (event) => {
|
|
11
6
|
const { handleDiscordSubagentEnded } = await loadDiscordSubagentHooksModule();
|
|
12
7
|
handleDiscordSubagentEnded(event);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { x as formatDiscordUserTag } from "./allow-list-
|
|
1
|
+
import { y as discord_exports } from "./retry-DqHCW6PV.js";
|
|
2
|
+
import { x as formatDiscordUserTag } from "./allow-list-BDMimASD.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 {
|
|
2
|
-
import { c as
|
|
3
|
-
import { a as rememberDiscordDirectoryUser, r as listDiscordDirectoryPeersLive } from "./directory-live-
|
|
1
|
+
import { _ as parseDiscordTarget, on as __exportAll, p as allowFromContainsDiscordUserId } from "./retry-DqHCW6PV.js";
|
|
2
|
+
import { c as resolveDiscordAccount, l as resolveDiscordAccountAllowFrom } from "./accounts-CfQ-vSyf.js";
|
|
3
|
+
import { a as rememberDiscordDirectoryUser, r as listDiscordDirectoryPeersLive } from "./directory-live-DuAXKkan.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);
|