@openclaw/discord 2026.8.1-beta.3 → 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-D5xmUpnj.js → account-inspect-BDfKyuvL.js} +1 -1
- package/dist/account-inspect-api.js +1 -1
- package/dist/{accounts-DNl-oCEw.js → accounts-CfQ-vSyf.js} +5 -124
- package/dist/action-runtime-api.js +1 -1
- package/dist/{activities-api-KCBAmWxD.js → activities-api-Dl-TOyOX.js} +5 -4
- package/dist/activities-api.js +1 -1
- package/dist/api.js +16 -16
- package/dist/{approval-handler.runtime-B12RCYr8.js → approval-handler.runtime-q4Zqo44V.js} +28 -105
- package/dist/{audit-Yc7eZDd6.js → audit-DgrvFPGt.js} +5 -5
- package/dist/{channel-cXYzGc4L.js → channel-BsQUalPw.js} +18 -20
- package/dist/{channel-actions.runtime-CODTvo7c.js → channel-actions.runtime-UMGGIfSy.js} +59 -58
- 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-CSiwnMgs.js → channel.setup-rPs4dsk_.js} +5 -5
- package/dist/{components-ezGKo_Yh.js → components-Dk35LTf_.js} +33 -29
- package/dist/{config-schema-DC5kDtQ5.js → config-schema-CxPqtVI1.js} +16 -10
- package/dist/{conversation-binding-route-D6rCQ5S0.js → conversation-binding-route-BjvX4e35.js} +1 -1
- package/dist/{directory-config-XyCfoqLg.js → directory-config-B7DY_pNG.js} +2 -2
- package/dist/directory-contract-api.js +1 -1
- package/dist/{directory-live-Df0NbFJB.js → directory-live-DuAXKkan.js} +2 -2
- package/dist/doctor-contract-api.js +1 -1
- package/dist/{doctor-DYY31GrO.js → doctor-zQTtn6hm.js} +4 -4
- package/dist/{handle-action.guild-admin-6Tvvinsa.js → handle-action.guild-admin-DZewwLr1.js} +9 -5
- package/dist/index.js +1 -1
- package/dist/ingress-identity-CzZKcPK8.js +60 -0
- package/dist/{message-handler-B61q5MOF.js → message-handler-C5By3yl5.js} +5 -5
- package/dist/{message-handler.preflight-Bzg_Hawz.js → message-handler.preflight-DrszWuHw.js} +20 -84
- package/dist/{message-handler.process--4_712Ec.js → message-handler.process-DyFPDLCt.js} +60 -66
- package/dist/{message-utils-BXLLnFl6.js → message-text-Ca8M6TU8.js} +34 -32
- package/dist/{outbound-adapter-DxHTOqiN.js → outbound-adapter-Dif8p481.js} +58 -61
- package/dist/{outbound-components-B2PL0ooH.js → outbound-components-wjv7yyAj.js} +5 -4
- package/dist/outbound-session-route-Bn4uXaoE.js +665 -0
- package/dist/{owner-access-Bg41VzAf.js → owner-access-UlYi9t0M.js} +1 -1
- package/dist/{pluralkit-dUl4v1X3.js → pluralkit-9EuEN4UD.js} +1 -1
- package/dist/{probe-BTdtVRwU.js → probe-n6ZXxK8V.js} +1 -1
- package/dist/{probe.runtime-Dq5-PRKT.js → probe.runtime-CN4bdPfZ.js} +1 -1
- package/dist/{provider-DlK_ynqt.js → provider-LXiOcJrH.js} +443 -295
- package/dist/{provider-session.runtime-CvvphHvs.js → provider-session.runtime-DSNe7r2W.js} +3 -3
- package/dist/provider.runtime-DiInaDXO.js +2 -0
- package/dist/{realtime-session.runtime-ysbMG8v7.js → realtime-session.runtime-DOViOIjY.js} +106 -122
- package/dist/{resolve-allowlist-common-DIVXbD1P.js → resolve-allowlist-common-BLoYaxEG.js} +1 -1
- package/dist/{resolve-channels-CGeUoIqb.js → resolve-channels-D2yl_2CN.js} +4 -3
- package/dist/{resolve-users-BtKxLUZv.js → resolve-users-BLxfqajZ.js} +2 -2
- package/dist/{retry-DNsVTeTo.js → retry-DqHCW6PV.js} +220 -6
- package/dist/{runtime-D71_VFLr.js → runtime-BYamRVPN.js} +73 -56
- package/dist/{runtime-CQovMsH3.js → runtime-DrxVBTtp.js} +2 -2
- package/dist/runtime-api.js +16 -23
- package/dist/{sdk-runtime-37OU6_Yh.js → sdk-runtime-6tfgYDjY.js} +55 -86
- package/dist/{security-audit-BfJhAXZp.js → security-audit-DKfK-iPY.js} +10 -11
- package/dist/security-audit-contract-api.js +1 -1
- package/dist/{security-audit.runtime-BVKF9VtY.js → security-audit.runtime-sKZyKgpx.js} +1 -1
- package/dist/{send-rQIffSYu.js → send-UJHiAm4C.js} +78 -15
- package/dist/{send.components-ChK1wS7w.js → send.components-CrBJpGT_.js} +15 -22
- package/dist/{send.outbound-HIkgji_7.js → send.outbound-D7JYmfm9.js} +58 -69
- package/dist/{send.shared-B3fpaLWJ.js → send.shared-DZJ1akvQ.js} +36 -21
- package/dist/setup-plugin-api.js +1 -1
- package/dist/{shared-CaAaoksy.js → shared-Dii2HTn7.js} +31 -9
- package/dist/{subagent-hooks-CNT2ZJTJ.js → subagent-hooks-JyGrtQIl.js} +2 -2
- package/dist/subagent-hooks-api.js +1 -6
- package/dist/{system-events-Nuwoq_au.js → system-events-BEmcj4xJ.js} +1 -1
- package/dist/{target-resolver-DIXShHaZ.js → target-resolver-V-IYae6s.js} +3 -3
- package/dist/targets-CQp53cGj.js +3 -0
- package/dist/{thread-bindings-VlymUnbz.js → thread-bindings-DvYP79fy.js} +3 -4
- package/dist/{thread-bindings.manager-CngsgErq.js → thread-bindings.manager-Clm77DBM.js} +8 -12
- package/dist/{threading-DU6pgeGm.js → threading-CXuu_7o9.js} +47 -25
- package/dist/{transcripts-source-DeIMNbRh.js → transcripts-source-BLEMH_yi.js} +9 -4
- package/dist/transcripts-source-api.js +1 -1
- package/dist/{typing-oLiS5Z13.js → typing-B9snnwMe.js} +1 -1
- package/dist/{voice-runtime-CjNFaynA.js → voice-runtime-DY6_o73o.js} +76 -66
- 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 +12 -4
- package/package.json +8 -8
- package/skills/discord/SKILL.md +1 -1
- package/dist/approval-message-safety-XGFPbDoI.js +0 -226
- package/dist/audit-core-BCX8UeFH.js +0 -105
- package/dist/channel-actions-Dr2QI8Bf.js +0 -212
- package/dist/inbound-event-delivery-De2qxTrP.js +0 -39
- package/dist/provider.runtime-CzKGRiAF.js +0 -2
- package/dist/runtime-api.actions.js +0 -3
- package/dist/runtime-api.lookup.js +0 -7
- package/dist/runtime-api.monitor-CzeTYF32.js +0 -6
- package/dist/runtime-api.monitor.js +0 -9
- package/dist/runtime-api.send.js +0 -7
- package/dist/runtime-api.threads.js +0 -5
- package/dist/send.reactions-gmJ6yFPo.js +0 -78
- package/dist/send.receipt-Cnhoautb.js +0 -76
- package/dist/subagent-progress-FPLqBY1s.js +0 -110
- package/dist/targets-B2pf49zc.js +0 -3
- 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
|
@@ -1,226 +0,0 @@
|
|
|
1
|
-
import { c as resolveDiscordAccount, k as parseDiscordTarget } from "./accounts-DNl-oCEw.js";
|
|
2
|
-
import { deriveLastRoutePolicy, isAcpSessionKey, isSubagentSessionKey, parseAgentSessionKey, resolveAgentIdFromSessionKey, resolveAgentRoute } from "openclaw/plugin-sdk/routing";
|
|
3
|
-
import { normalizeOptionalLowercaseString, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
4
|
-
import { createChannelApproverDmTargetResolver, createChannelNativeOriginTargetResolver } from "openclaw/plugin-sdk/approval-native-runtime";
|
|
5
|
-
import { getExecApprovalReplyMetadata, isChannelExecApprovalClientEnabledFromConfig, matchesApprovalRequestFilters } from "openclaw/plugin-sdk/approval-client-runtime";
|
|
6
|
-
import { resolveApprovalApprovers } from "openclaw/plugin-sdk/approval-auth-runtime";
|
|
7
|
-
import { createApproverRestrictedNativeApprovalCapability } from "openclaw/plugin-sdk/approval-delivery-runtime";
|
|
8
|
-
//#region extensions/discord/src/exec-approvals.ts
|
|
9
|
-
function normalizeDiscordApproverId(value) {
|
|
10
|
-
const trimmed = value.trim();
|
|
11
|
-
if (!trimmed) return;
|
|
12
|
-
if (/^\d+$/.test(trimmed)) return trimmed;
|
|
13
|
-
try {
|
|
14
|
-
const target = parseDiscordTarget(trimmed);
|
|
15
|
-
return target?.kind === "user" ? target.id : void 0;
|
|
16
|
-
} catch {
|
|
17
|
-
return;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
function resolveDiscordOwnerApprovers(cfg) {
|
|
21
|
-
const ownerAllowFrom = cfg.commands?.ownerAllowFrom;
|
|
22
|
-
if (!Array.isArray(ownerAllowFrom) || ownerAllowFrom.length === 0) return [];
|
|
23
|
-
return resolveApprovalApprovers({
|
|
24
|
-
explicit: ownerAllowFrom,
|
|
25
|
-
normalizeApprover: (value) => normalizeDiscordApproverId(String(value))
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
function getDiscordExecApprovalApprovers(params) {
|
|
29
|
-
return resolveApprovalApprovers({
|
|
30
|
-
explicit: params.configOverride?.approvers ?? resolveDiscordAccount(params).config.execApprovals?.approvers ?? resolveDiscordOwnerApprovers(params.cfg),
|
|
31
|
-
normalizeApprover: (value) => normalizeDiscordApproverId(String(value))
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
function isDiscordExecApprovalClientEnabled(params) {
|
|
35
|
-
return isChannelExecApprovalClientEnabledFromConfig({
|
|
36
|
-
enabled: (params.configOverride ?? resolveDiscordAccount(params).config.execApprovals)?.enabled,
|
|
37
|
-
approverCount: getDiscordExecApprovalApprovers({
|
|
38
|
-
cfg: params.cfg,
|
|
39
|
-
accountId: params.accountId,
|
|
40
|
-
configOverride: params.configOverride
|
|
41
|
-
}).length
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
function isDiscordExecApprovalApprover(params) {
|
|
45
|
-
const senderId = params.senderId?.trim();
|
|
46
|
-
if (!senderId) return false;
|
|
47
|
-
return getDiscordExecApprovalApprovers({
|
|
48
|
-
cfg: params.cfg,
|
|
49
|
-
accountId: params.accountId,
|
|
50
|
-
configOverride: params.configOverride
|
|
51
|
-
}).includes(senderId);
|
|
52
|
-
}
|
|
53
|
-
function shouldSuppressLocalDiscordExecApprovalPrompt(params) {
|
|
54
|
-
const metadata = getExecApprovalReplyMetadata(params.payload);
|
|
55
|
-
const config = resolveDiscordAccount(params).config.execApprovals;
|
|
56
|
-
return params.hint?.kind === "approval-pending" && params.hint.nativeRouteActive === true && isDiscordExecApprovalClientEnabled(params) && metadata !== null && matchesApprovalRequestFilters({
|
|
57
|
-
request: {
|
|
58
|
-
agentId: metadata.agentId,
|
|
59
|
-
sessionKey: metadata.sessionKey
|
|
60
|
-
},
|
|
61
|
-
agentFilter: config?.agentFilter,
|
|
62
|
-
sessionFilter: config?.sessionFilter
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
//#endregion
|
|
66
|
-
//#region extensions/discord/src/conversation-identity.ts
|
|
67
|
-
function normalizeDiscordTarget(raw, defaultKind) {
|
|
68
|
-
const trimmed = normalizeOptionalString(raw);
|
|
69
|
-
if (!trimmed) return;
|
|
70
|
-
return parseDiscordTarget(trimmed, { defaultKind })?.normalized;
|
|
71
|
-
}
|
|
72
|
-
function buildDiscordConversationIdentity(kind, rawId) {
|
|
73
|
-
const trimmed = normalizeOptionalString(rawId);
|
|
74
|
-
return trimmed ? `${kind}:${trimmed}` : void 0;
|
|
75
|
-
}
|
|
76
|
-
function resolveDiscordConversationIdentity(params) {
|
|
77
|
-
return params.isDirectMessage ? buildDiscordConversationIdentity("user", params.userId) : buildDiscordConversationIdentity("channel", params.channelId);
|
|
78
|
-
}
|
|
79
|
-
function resolveDiscordRuntimeBindingConversationId(params) {
|
|
80
|
-
if (params.isDirectMessage && !params.isGroupDm) return buildDiscordConversationIdentity("user", params.userId) ?? params.channelId;
|
|
81
|
-
return params.channelId;
|
|
82
|
-
}
|
|
83
|
-
function resolveDiscordCurrentConversationIdentity(params) {
|
|
84
|
-
if (normalizeOptionalLowercaseString(params.chatType) === "direct") {
|
|
85
|
-
const senderTarget = normalizeDiscordTarget(params.from, "user");
|
|
86
|
-
if (senderTarget?.startsWith("user:")) return senderTarget;
|
|
87
|
-
}
|
|
88
|
-
for (const candidate of [
|
|
89
|
-
params.originatingTo,
|
|
90
|
-
params.commandTo,
|
|
91
|
-
params.fallbackTo
|
|
92
|
-
]) {
|
|
93
|
-
const target = normalizeDiscordTarget(candidate, "channel");
|
|
94
|
-
if (target) return target;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
//#endregion
|
|
98
|
-
//#region extensions/discord/src/monitor/route-resolution.ts
|
|
99
|
-
function buildDiscordRoutePeer(params) {
|
|
100
|
-
return {
|
|
101
|
-
kind: params.isGroupDm ? "group" : params.isDirectMessage ? "direct" : "channel",
|
|
102
|
-
id: params.isDirectMessage && !params.isGroupDm ? params.directUserId?.trim() || params.conversationId : params.conversationId
|
|
103
|
-
};
|
|
104
|
-
}
|
|
105
|
-
function buildDiscordConversationRouteContext(params) {
|
|
106
|
-
return {
|
|
107
|
-
ConversationRouteContextObserved: true,
|
|
108
|
-
ConversationRoutePeerId: buildDiscordRoutePeer(params).id,
|
|
109
|
-
NativeChannelId: params.conversationId,
|
|
110
|
-
InboundAccessAuthorized: true,
|
|
111
|
-
MessageThreadId: params.isThread ? params.conversationId : void 0,
|
|
112
|
-
ThreadParentId: params.isThread ? params.parentConversationId : void 0
|
|
113
|
-
};
|
|
114
|
-
}
|
|
115
|
-
function resolveDiscordConversationRoute(params) {
|
|
116
|
-
return resolveAgentRoute({
|
|
117
|
-
cfg: params.cfg,
|
|
118
|
-
channel: "discord",
|
|
119
|
-
accountId: params.accountId,
|
|
120
|
-
guildId: params.guildId ?? void 0,
|
|
121
|
-
memberRoleIds: params.memberRoleIds,
|
|
122
|
-
peer: params.peer,
|
|
123
|
-
parentPeer: params.parentConversationId ? {
|
|
124
|
-
kind: "channel",
|
|
125
|
-
id: params.parentConversationId
|
|
126
|
-
} : void 0
|
|
127
|
-
});
|
|
128
|
-
}
|
|
129
|
-
function resolveDiscordBoundConversationRoute(params) {
|
|
130
|
-
return resolveDiscordEffectiveRoute({
|
|
131
|
-
route: resolveDiscordConversationRoute({
|
|
132
|
-
cfg: params.cfg,
|
|
133
|
-
accountId: params.accountId,
|
|
134
|
-
guildId: params.guildId,
|
|
135
|
-
memberRoleIds: params.memberRoleIds,
|
|
136
|
-
peer: buildDiscordRoutePeer({
|
|
137
|
-
isDirectMessage: params.isDirectMessage,
|
|
138
|
-
isGroupDm: params.isGroupDm,
|
|
139
|
-
directUserId: params.directUserId,
|
|
140
|
-
conversationId: params.conversationId
|
|
141
|
-
}),
|
|
142
|
-
parentConversationId: params.parentConversationId
|
|
143
|
-
}),
|
|
144
|
-
boundSessionKey: params.boundSessionKey,
|
|
145
|
-
configuredRoute: params.configuredRoute,
|
|
146
|
-
matchedBy: params.matchedBy
|
|
147
|
-
});
|
|
148
|
-
}
|
|
149
|
-
function resolveDiscordEffectiveRoute(params) {
|
|
150
|
-
const boundSessionKey = params.boundSessionKey?.trim();
|
|
151
|
-
if (!boundSessionKey) return params.configuredRoute?.route ?? params.route;
|
|
152
|
-
return {
|
|
153
|
-
...params.route,
|
|
154
|
-
sessionKey: boundSessionKey,
|
|
155
|
-
agentId: resolveAgentIdFromSessionKey(boundSessionKey),
|
|
156
|
-
lastRoutePolicy: deriveLastRoutePolicy({
|
|
157
|
-
sessionKey: boundSessionKey,
|
|
158
|
-
mainSessionKey: params.route.mainSessionKey
|
|
159
|
-
}),
|
|
160
|
-
...params.matchedBy ? { matchedBy: params.matchedBy } : {}
|
|
161
|
-
};
|
|
162
|
-
}
|
|
163
|
-
function hasExplicitRuntimeBindingIntent(record) {
|
|
164
|
-
if (record.targetKind === "subagent") return true;
|
|
165
|
-
if (isAcpSessionKey(record.targetSessionKey) || isSubagentSessionKey(record.targetSessionKey)) return true;
|
|
166
|
-
const metadata = record.metadata;
|
|
167
|
-
if (!metadata || typeof metadata !== "object") return false;
|
|
168
|
-
return typeof metadata.boundBy === "string" || typeof metadata.label === "string" || typeof metadata.threadName === "string" || metadata.pluginBindingOwner === "plugin";
|
|
169
|
-
}
|
|
170
|
-
function shouldIgnoreStaleDiscordRouteBinding(params) {
|
|
171
|
-
const bindingRecord = params.bindingRecord;
|
|
172
|
-
const boundSessionKey = bindingRecord?.targetSessionKey?.trim();
|
|
173
|
-
if (!bindingRecord || !boundSessionKey || hasExplicitRuntimeBindingIntent(bindingRecord)) return false;
|
|
174
|
-
const bound = parseAgentSessionKey(boundSessionKey);
|
|
175
|
-
const routed = parseAgentSessionKey(params.route.sessionKey);
|
|
176
|
-
if (!bound || !routed || bound.rest !== routed.rest) return false;
|
|
177
|
-
return bound.agentId !== params.route.agentId;
|
|
178
|
-
}
|
|
179
|
-
//#endregion
|
|
180
|
-
//#region extensions/discord/src/approval-message-safety.ts
|
|
181
|
-
const DISCORD_APPROVAL_ALLOWED_MENTIONS = { parse: [] };
|
|
182
|
-
const DISCORD_MARKDOWN_META_CHARACTERS = /* @__PURE__ */ new Set([
|
|
183
|
-
"\\",
|
|
184
|
-
"`",
|
|
185
|
-
"*",
|
|
186
|
-
"_",
|
|
187
|
-
"{",
|
|
188
|
-
"}",
|
|
189
|
-
"[",
|
|
190
|
-
"]",
|
|
191
|
-
"(",
|
|
192
|
-
")",
|
|
193
|
-
"<",
|
|
194
|
-
">",
|
|
195
|
-
"#",
|
|
196
|
-
"+",
|
|
197
|
-
"-",
|
|
198
|
-
".",
|
|
199
|
-
"!",
|
|
200
|
-
"|",
|
|
201
|
-
"~"
|
|
202
|
-
]);
|
|
203
|
-
function escapeDiscordApprovalDisplayCharacter(character) {
|
|
204
|
-
if (character === "\n") return "\\n";
|
|
205
|
-
if (character === "\r") return "\\r";
|
|
206
|
-
if (character === " ") return "\\t";
|
|
207
|
-
const codePoint = character.codePointAt(0) ?? 0;
|
|
208
|
-
if (codePoint <= 31 || codePoint >= 127 && codePoint <= 159 || codePoint === 8232 || codePoint === 8233) return `\\u{${codePoint.toString(16).padStart(4, "0")}}`;
|
|
209
|
-
return DISCORD_MARKDOWN_META_CHARACTERS.has(character) ? `\\${character}` : character;
|
|
210
|
-
}
|
|
211
|
-
/** Keep opaque approval metadata bounded, single-line, and inert in Discord Markdown. */
|
|
212
|
-
function formatDiscordApprovalDisplayValue(value, maxChars = 200) {
|
|
213
|
-
const limit = Number.isFinite(maxChars) ? Math.max(0, Math.trunc(maxChars)) : 200;
|
|
214
|
-
const escapedParts = Array.from(value, escapeDiscordApprovalDisplayCharacter);
|
|
215
|
-
const escaped = escapedParts.join("");
|
|
216
|
-
if (escaped.length <= limit) return escaped;
|
|
217
|
-
if (limit <= 3) return ".".repeat(limit);
|
|
218
|
-
let bounded = "";
|
|
219
|
-
for (const part of escapedParts) {
|
|
220
|
-
if (bounded.length + part.length > limit - 3) break;
|
|
221
|
-
bounded += part;
|
|
222
|
-
}
|
|
223
|
-
return `${bounded}...`;
|
|
224
|
-
}
|
|
225
|
-
//#endregion
|
|
226
|
-
export { createChannelApproverDmTargetResolver as _, resolveDiscordBoundConversationRoute as a, matchesApprovalRequestFilters as b, shouldIgnoreStaleDiscordRouteBinding as c, resolveDiscordRuntimeBindingConversationId as d, getDiscordExecApprovalApprovers as f, createApproverRestrictedNativeApprovalCapability as g, shouldSuppressLocalDiscordExecApprovalPrompt as h, buildDiscordRoutePeer as i, resolveDiscordConversationIdentity as l, isDiscordExecApprovalClientEnabled as m, formatDiscordApprovalDisplayValue as n, resolveDiscordConversationRoute as o, isDiscordExecApprovalApprover as p, buildDiscordConversationRouteContext as r, resolveDiscordEffectiveRoute as s, DISCORD_APPROVAL_ALLOWED_MENTIONS as t, resolveDiscordCurrentConversationIdentity as u, createChannelNativeOriginTargetResolver as v, isChannelExecApprovalClientEnabledFromConfig as y };
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import { ChannelType } from "discord-api-types/v10";
|
|
2
|
-
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
3
|
-
import { isRecord, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
4
|
-
//#region extensions/discord/src/audit-core.ts
|
|
5
|
-
const REQUIRED_TEXT_CHANNEL_PERMISSIONS = ["ViewChannel", "SendMessages"];
|
|
6
|
-
const REQUIRED_VOICE_CHANNEL_PERMISSIONS = [
|
|
7
|
-
"ViewChannel",
|
|
8
|
-
"Connect",
|
|
9
|
-
"Speak",
|
|
10
|
-
"SendMessages",
|
|
11
|
-
"ReadMessageHistory"
|
|
12
|
-
];
|
|
13
|
-
function resolveRequiredDiscordChannelPermissions(channelType) {
|
|
14
|
-
if (channelType === ChannelType.GuildVoice || channelType === ChannelType.GuildStageVoice) return [...REQUIRED_VOICE_CHANNEL_PERMISSIONS];
|
|
15
|
-
return [...REQUIRED_TEXT_CHANNEL_PERMISSIONS];
|
|
16
|
-
}
|
|
17
|
-
function shouldAuditChannelConfig(config) {
|
|
18
|
-
if (!config) return true;
|
|
19
|
-
if (config.enabled === false) return false;
|
|
20
|
-
return true;
|
|
21
|
-
}
|
|
22
|
-
function listConfiguredGuildChannelKeys(guilds) {
|
|
23
|
-
if (!guilds) return [];
|
|
24
|
-
const ids = /* @__PURE__ */ new Set();
|
|
25
|
-
for (const entry of Object.values(guilds)) {
|
|
26
|
-
if (!entry || typeof entry !== "object") continue;
|
|
27
|
-
const channelsRaw = entry.channels;
|
|
28
|
-
if (!isRecord(channelsRaw)) continue;
|
|
29
|
-
for (const [key, value] of Object.entries(channelsRaw)) {
|
|
30
|
-
const channelId = normalizeOptionalString(key) ?? "";
|
|
31
|
-
if (!channelId) continue;
|
|
32
|
-
if (channelId === "*") continue;
|
|
33
|
-
if (!shouldAuditChannelConfig(value)) continue;
|
|
34
|
-
ids.add(channelId);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
return [...ids].toSorted((a, b) => a.localeCompare(b));
|
|
38
|
-
}
|
|
39
|
-
function collectDiscordAuditChannelIdsForGuilds(guilds) {
|
|
40
|
-
const keys = listConfiguredGuildChannelKeys(guilds);
|
|
41
|
-
const channelIds = keys.filter((key) => /^\d+$/.test(key));
|
|
42
|
-
return {
|
|
43
|
-
channelIds,
|
|
44
|
-
unresolvedChannels: keys.length - channelIds.length
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
function collectDiscordAuditChannelIdsForAccount(config) {
|
|
48
|
-
const collected = collectDiscordAuditChannelIdsForGuilds(config.guilds);
|
|
49
|
-
const channelIds = new Set(collected.channelIds);
|
|
50
|
-
let unresolvedVoiceChannels = 0;
|
|
51
|
-
for (const entry of config.voice?.autoJoin ?? []) {
|
|
52
|
-
const channelId = normalizeOptionalString(entry?.channelId) ?? "";
|
|
53
|
-
if (/^\d+$/.test(channelId)) channelIds.add(channelId);
|
|
54
|
-
else if (channelId) unresolvedVoiceChannels++;
|
|
55
|
-
}
|
|
56
|
-
return {
|
|
57
|
-
channelIds: [...channelIds].toSorted((a, b) => a.localeCompare(b)),
|
|
58
|
-
unresolvedChannels: collected.unresolvedChannels + unresolvedVoiceChannels
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
async function auditDiscordChannelPermissionsWithFetcher(params) {
|
|
62
|
-
const started = Date.now();
|
|
63
|
-
const token = normalizeOptionalString(params.token) ?? "";
|
|
64
|
-
if (!token || params.channelIds.length === 0) return {
|
|
65
|
-
ok: true,
|
|
66
|
-
checkedChannels: 0,
|
|
67
|
-
unresolvedChannels: 0,
|
|
68
|
-
channels: [],
|
|
69
|
-
elapsedMs: Date.now() - started
|
|
70
|
-
};
|
|
71
|
-
const channels = [];
|
|
72
|
-
for (const channelId of params.channelIds) try {
|
|
73
|
-
const perms = await params.fetchChannelPermissions(channelId, {
|
|
74
|
-
cfg: params.cfg,
|
|
75
|
-
token,
|
|
76
|
-
accountId: params.accountId ?? void 0
|
|
77
|
-
});
|
|
78
|
-
const missing = resolveRequiredDiscordChannelPermissions(perms.channelType).filter((p) => !perms.permissions.includes(p));
|
|
79
|
-
channels.push({
|
|
80
|
-
channelId,
|
|
81
|
-
ok: missing.length === 0,
|
|
82
|
-
missing: missing.length ? missing : void 0,
|
|
83
|
-
error: null,
|
|
84
|
-
matchKey: channelId,
|
|
85
|
-
matchSource: "id"
|
|
86
|
-
});
|
|
87
|
-
} catch (err) {
|
|
88
|
-
channels.push({
|
|
89
|
-
channelId,
|
|
90
|
-
ok: false,
|
|
91
|
-
error: formatErrorMessage(err),
|
|
92
|
-
matchKey: channelId,
|
|
93
|
-
matchSource: "id"
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
return {
|
|
97
|
-
ok: channels.every((c) => c.ok),
|
|
98
|
-
checkedChannels: channels.length,
|
|
99
|
-
unresolvedChannels: 0,
|
|
100
|
-
channels,
|
|
101
|
-
elapsedMs: Date.now() - started
|
|
102
|
-
};
|
|
103
|
-
}
|
|
104
|
-
//#endregion
|
|
105
|
-
export { collectDiscordAuditChannelIdsForAccount as n, resolveRequiredDiscordChannelPermissions as r, auditDiscordChannelPermissionsWithFetcher as t };
|
|
@@ -1,212 +0,0 @@
|
|
|
1
|
-
import { m as readDiscordComponentSpec } from "./components-ezGKo_Yh.js";
|
|
2
|
-
import { r as listDiscordAccountIds, t as createDiscordActionGate } from "./accounts-DNl-oCEw.js";
|
|
3
|
-
import { t as inspectDiscordAccount } from "./account-inspect-D5xmUpnj.js";
|
|
4
|
-
import { r as withDiscordInboundEventDeliveryMetadata } from "./inbound-event-delivery-De2qxTrP.js";
|
|
5
|
-
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
6
|
-
import { createUnionActionGate } from "openclaw/plugin-sdk/channel-actions";
|
|
7
|
-
import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
|
|
8
|
-
import { extractToolSend } from "openclaw/plugin-sdk/tool-send";
|
|
9
|
-
//#region extensions/discord/src/trusted-requester-actions.ts
|
|
10
|
-
const trustedRequesterGuildAdminActions = /* @__PURE__ */ new Set([
|
|
11
|
-
"emoji-upload",
|
|
12
|
-
"sticker-upload",
|
|
13
|
-
"role-add",
|
|
14
|
-
"role-remove",
|
|
15
|
-
"channel-create",
|
|
16
|
-
"channel-edit",
|
|
17
|
-
"channel-delete",
|
|
18
|
-
"channel-move",
|
|
19
|
-
"category-create",
|
|
20
|
-
"category-edit",
|
|
21
|
-
"category-delete",
|
|
22
|
-
"event-create",
|
|
23
|
-
"timeout",
|
|
24
|
-
"kick",
|
|
25
|
-
"ban"
|
|
26
|
-
]);
|
|
27
|
-
function isTrustedRequesterGuildAdminAction(action) {
|
|
28
|
-
return trustedRequesterGuildAdminActions.has(action);
|
|
29
|
-
}
|
|
30
|
-
//#endregion
|
|
31
|
-
//#region extensions/discord/src/channel-actions.ts
|
|
32
|
-
const localExecutionActions = /* @__PURE__ */ new Set([
|
|
33
|
-
"send",
|
|
34
|
-
"poll",
|
|
35
|
-
"upload-file",
|
|
36
|
-
"thread-reply",
|
|
37
|
-
"sticker",
|
|
38
|
-
"emoji-upload",
|
|
39
|
-
"sticker-upload",
|
|
40
|
-
"event-create"
|
|
41
|
-
]);
|
|
42
|
-
function resolveDiscordActionExecutionMode({ action }) {
|
|
43
|
-
return localExecutionActions.has(action) ? "local" : "gateway";
|
|
44
|
-
}
|
|
45
|
-
const loadDiscordChannelActionsRuntime = createLazyRuntimeModule(() => import("./channel-actions.runtime-CODTvo7c.js"));
|
|
46
|
-
function listDiscoverableDiscordAccounts(cfg) {
|
|
47
|
-
return listDiscordAccountIds(cfg).map((accountId) => inspectDiscordAccount({
|
|
48
|
-
cfg,
|
|
49
|
-
accountId
|
|
50
|
-
})).filter((account) => account.enabled && account.configured);
|
|
51
|
-
}
|
|
52
|
-
function resolveDiscordActionDiscovery(cfg) {
|
|
53
|
-
const accounts = listDiscoverableDiscordAccounts(cfg);
|
|
54
|
-
if (accounts.length === 0) return null;
|
|
55
|
-
const unionGate = createUnionActionGate(accounts, (account) => createDiscordActionGate({
|
|
56
|
-
cfg,
|
|
57
|
-
accountId: account.accountId
|
|
58
|
-
}));
|
|
59
|
-
return { isEnabled: (key, defaultValue = true) => unionGate(key, defaultValue) };
|
|
60
|
-
}
|
|
61
|
-
function resolveScopedDiscordActionDiscovery(params) {
|
|
62
|
-
if (!params.accountId) return resolveDiscordActionDiscovery(params.cfg);
|
|
63
|
-
const account = inspectDiscordAccount({
|
|
64
|
-
cfg: params.cfg,
|
|
65
|
-
accountId: params.accountId
|
|
66
|
-
});
|
|
67
|
-
if (!account.enabled || !account.configured) return null;
|
|
68
|
-
const gate = createDiscordActionGate({
|
|
69
|
-
cfg: params.cfg,
|
|
70
|
-
accountId: account.accountId
|
|
71
|
-
});
|
|
72
|
-
return { isEnabled: (key, defaultValue = true) => gate(key, defaultValue) };
|
|
73
|
-
}
|
|
74
|
-
function describeDiscordMessageTool({ cfg, accountId }) {
|
|
75
|
-
const discovery = resolveScopedDiscordActionDiscovery({
|
|
76
|
-
cfg,
|
|
77
|
-
accountId
|
|
78
|
-
});
|
|
79
|
-
if (!discovery) return {
|
|
80
|
-
actions: [],
|
|
81
|
-
capabilities: [],
|
|
82
|
-
schema: null
|
|
83
|
-
};
|
|
84
|
-
const actions = /* @__PURE__ */ new Set(["send"]);
|
|
85
|
-
if (discovery.isEnabled("polls")) actions.add("poll");
|
|
86
|
-
if (discovery.isEnabled("reactions")) {
|
|
87
|
-
actions.add("react");
|
|
88
|
-
actions.add("reactions");
|
|
89
|
-
actions.add("emoji-list");
|
|
90
|
-
}
|
|
91
|
-
if (discovery.isEnabled("messages")) {
|
|
92
|
-
actions.add("upload-file");
|
|
93
|
-
actions.add("read");
|
|
94
|
-
actions.add("edit");
|
|
95
|
-
actions.add("delete");
|
|
96
|
-
}
|
|
97
|
-
if (discovery.isEnabled("pins")) {
|
|
98
|
-
actions.add("pin");
|
|
99
|
-
actions.add("unpin");
|
|
100
|
-
actions.add("list-pins");
|
|
101
|
-
}
|
|
102
|
-
if (discovery.isEnabled("permissions")) actions.add("permissions");
|
|
103
|
-
if (discovery.isEnabled("threads")) {
|
|
104
|
-
actions.add("thread-create");
|
|
105
|
-
actions.add("thread-list");
|
|
106
|
-
actions.add("thread-reply");
|
|
107
|
-
}
|
|
108
|
-
if (discovery.isEnabled("search")) actions.add("search");
|
|
109
|
-
if (discovery.isEnabled("stickers")) actions.add("sticker");
|
|
110
|
-
if (discovery.isEnabled("memberInfo")) actions.add("member-info");
|
|
111
|
-
if (discovery.isEnabled("roleInfo")) actions.add("role-info");
|
|
112
|
-
if (discovery.isEnabled("emojiUploads")) actions.add("emoji-upload");
|
|
113
|
-
if (discovery.isEnabled("stickerUploads")) actions.add("sticker-upload");
|
|
114
|
-
if (discovery.isEnabled("roles", false)) {
|
|
115
|
-
actions.add("role-add");
|
|
116
|
-
actions.add("role-remove");
|
|
117
|
-
}
|
|
118
|
-
if (discovery.isEnabled("channelInfo")) {
|
|
119
|
-
actions.add("channel-info");
|
|
120
|
-
actions.add("channel-list");
|
|
121
|
-
}
|
|
122
|
-
if (discovery.isEnabled("channels")) {
|
|
123
|
-
actions.add("channel-create");
|
|
124
|
-
actions.add("channel-edit");
|
|
125
|
-
actions.add("channel-delete");
|
|
126
|
-
actions.add("channel-move");
|
|
127
|
-
actions.add("category-create");
|
|
128
|
-
actions.add("category-edit");
|
|
129
|
-
actions.add("category-delete");
|
|
130
|
-
}
|
|
131
|
-
if (discovery.isEnabled("voiceStatus")) actions.add("voice-status");
|
|
132
|
-
if (discovery.isEnabled("events")) {
|
|
133
|
-
actions.add("event-list");
|
|
134
|
-
actions.add("event-create");
|
|
135
|
-
}
|
|
136
|
-
if (discovery.isEnabled("moderation", false)) {
|
|
137
|
-
actions.add("timeout");
|
|
138
|
-
actions.add("kick");
|
|
139
|
-
actions.add("ban");
|
|
140
|
-
}
|
|
141
|
-
if (discovery.isEnabled("presence", false)) actions.add("set-presence");
|
|
142
|
-
return {
|
|
143
|
-
actions: Array.from(actions),
|
|
144
|
-
capabilities: ["presentation"]
|
|
145
|
-
};
|
|
146
|
-
}
|
|
147
|
-
const discordMessageActions = {
|
|
148
|
-
providerOwnedReadGates: true,
|
|
149
|
-
resolveExecutionMode: resolveDiscordActionExecutionMode,
|
|
150
|
-
describeMessageTool: describeDiscordMessageTool,
|
|
151
|
-
supportsAction: ({ action }) => action !== "poll",
|
|
152
|
-
requiresTrustedRequesterSender: ({ action, toolContext }) => Boolean(toolContext) && isTrustedRequesterGuildAdminAction(action),
|
|
153
|
-
extractToolSend: ({ args }) => {
|
|
154
|
-
const action = normalizeOptionalString(args.action) ?? "";
|
|
155
|
-
if (action === "sendMessage") return extractToolSend(args, "sendMessage");
|
|
156
|
-
if (action === "threadReply") {
|
|
157
|
-
const channelId = normalizeOptionalString(args.channelId) ?? "";
|
|
158
|
-
return channelId ? { to: `channel:${channelId}` } : null;
|
|
159
|
-
}
|
|
160
|
-
return null;
|
|
161
|
-
},
|
|
162
|
-
prepareSendPayload: ({ ctx, payload }) => {
|
|
163
|
-
if (ctx.action !== "send") return null;
|
|
164
|
-
const payloadWithDeliveryMetadata = withDiscordInboundEventDeliveryMetadata(payload, {
|
|
165
|
-
sessionKey: ctx.sessionKey,
|
|
166
|
-
inboundEventKind: ctx.inboundEventKind
|
|
167
|
-
});
|
|
168
|
-
const rawComponents = ctx.params.components;
|
|
169
|
-
if (typeof rawComponents === "function") return null;
|
|
170
|
-
const componentSpec = rawComponents && typeof rawComponents === "object" && !Array.isArray(rawComponents) ? readDiscordComponentSpec(rawComponents) : void 0;
|
|
171
|
-
const nativeComponents = Array.isArray(rawComponents) ? rawComponents : void 0;
|
|
172
|
-
const embeds = Array.isArray(ctx.params.embeds) ? ctx.params.embeds : void 0;
|
|
173
|
-
if ((componentSpec || nativeComponents) && embeds?.length) return null;
|
|
174
|
-
const filename = normalizeOptionalString(ctx.params.filename);
|
|
175
|
-
if (!componentSpec && !nativeComponents && !embeds?.length && !filename) return payloadWithDeliveryMetadata;
|
|
176
|
-
const discordData = payloadWithDeliveryMetadata.channelData?.discord && typeof payloadWithDeliveryMetadata.channelData.discord === "object" && !Array.isArray(payloadWithDeliveryMetadata.channelData.discord) ? payloadWithDeliveryMetadata.channelData.discord : {};
|
|
177
|
-
return {
|
|
178
|
-
...payloadWithDeliveryMetadata,
|
|
179
|
-
channelData: {
|
|
180
|
-
...payloadWithDeliveryMetadata.channelData,
|
|
181
|
-
discord: {
|
|
182
|
-
...discordData,
|
|
183
|
-
...componentSpec ? { components: componentSpec } : {},
|
|
184
|
-
...nativeComponents ? { components: nativeComponents } : {},
|
|
185
|
-
...embeds?.length ? { embeds } : {},
|
|
186
|
-
...filename ? { filename } : {}
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
};
|
|
190
|
-
},
|
|
191
|
-
handleAction: async ({ action, params, cfg, accountId, requesterAccountId, requesterSenderId, senderIsOwner, toolContext, mediaAccess, mediaLocalRoots, mediaReadFile, sessionKey, inboundEventKind, conversationReadOrigin, reply }) => {
|
|
192
|
-
return await (await loadDiscordChannelActionsRuntime()).handleDiscordMessageAction({
|
|
193
|
-
action,
|
|
194
|
-
params,
|
|
195
|
-
cfg,
|
|
196
|
-
accountId,
|
|
197
|
-
requesterSenderId,
|
|
198
|
-
senderIsOwner,
|
|
199
|
-
toolContext,
|
|
200
|
-
mediaAccess,
|
|
201
|
-
mediaLocalRoots,
|
|
202
|
-
mediaReadFile,
|
|
203
|
-
...sessionKey ? { sessionKey } : {},
|
|
204
|
-
...inboundEventKind ? { inboundEventKind } : {},
|
|
205
|
-
...requesterAccountId ? { requesterAccountId } : {},
|
|
206
|
-
...conversationReadOrigin ? { conversationReadOrigin } : {},
|
|
207
|
-
...reply ? { reply } : {}
|
|
208
|
-
});
|
|
209
|
-
}
|
|
210
|
-
};
|
|
211
|
-
//#endregion
|
|
212
|
-
export { isTrustedRequesterGuildAdminAction as n, discordMessageActions as t };
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { asOptionalRecord, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
2
|
-
import { createInboundEventDeliveryCorrelation } from "openclaw/plugin-sdk/inbound-event-delivery";
|
|
3
|
-
//#region extensions/discord/src/inbound-event-delivery.ts
|
|
4
|
-
const DISCORD_INBOUND_EVENT_DELIVERY_KEY = "__openclawInboundEventDelivery";
|
|
5
|
-
function normalizeDiscordDeliveryTarget(value) {
|
|
6
|
-
return value.trim().replace(/^discord:/iu, "").replace(/^channel:/iu, "").toLowerCase();
|
|
7
|
-
}
|
|
8
|
-
const discordInboundEventDelivery = createInboundEventDeliveryCorrelation({ targetsMatch: (expected, actual) => normalizeDiscordDeliveryTarget(expected) === normalizeDiscordDeliveryTarget(actual) });
|
|
9
|
-
function withDiscordInboundEventDeliveryMetadata(payload, params) {
|
|
10
|
-
const sessionKey = params.sessionKey?.trim();
|
|
11
|
-
if (!sessionKey || params.inboundEventKind !== "room_event") return payload;
|
|
12
|
-
const channelData = asOptionalRecord(payload.channelData) ?? {};
|
|
13
|
-
const discordData = asOptionalRecord(channelData.discord) ?? {};
|
|
14
|
-
return {
|
|
15
|
-
...payload,
|
|
16
|
-
channelData: {
|
|
17
|
-
...channelData,
|
|
18
|
-
discord: {
|
|
19
|
-
...discordData,
|
|
20
|
-
[DISCORD_INBOUND_EVENT_DELIVERY_KEY]: {
|
|
21
|
-
sessionKey,
|
|
22
|
-
inboundEventKind: params.inboundEventKind
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
function notifyDiscordInboundEventOutboundPayloadSuccess(params) {
|
|
29
|
-
const metadata = asOptionalRecord(asOptionalRecord(asOptionalRecord(params.payload.channelData)?.discord)?.[DISCORD_INBOUND_EVENT_DELIVERY_KEY]);
|
|
30
|
-
if (!metadata) return;
|
|
31
|
-
discordInboundEventDelivery.notify({
|
|
32
|
-
sessionKey: normalizeOptionalString(metadata.sessionKey),
|
|
33
|
-
inboundEventKind: normalizeOptionalString(metadata.inboundEventKind),
|
|
34
|
-
to: params.to,
|
|
35
|
-
accountId: params.accountId
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
//#endregion
|
|
39
|
-
export { notifyDiscordInboundEventOutboundPayloadSuccess as n, withDiscordInboundEventDeliveryMetadata as r, discordInboundEventDelivery as t };
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { c as readDiscordChannelMoveParams, i as requiredGuildPermissionForModerationAction, l as readDiscordParentIdParam, n as isDiscordModerationAction, o as readDiscordChannelCreateParams, r as readDiscordModerationCommand, s as readDiscordChannelEditParams, t as handleDiscordAction } from "./runtime-D71_VFLr.js";
|
|
2
|
-
import { t as discordMessageActions } from "./channel-actions-Dr2QI8Bf.js";
|
|
3
|
-
export { discordMessageActions, handleDiscordAction, isDiscordModerationAction, readDiscordChannelCreateParams, readDiscordChannelEditParams, readDiscordChannelMoveParams, readDiscordModerationCommand, readDiscordParentIdParam, requiredGuildPermissionForModerationAction };
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { r as setDiscordRuntime } from "./runtime-DgnVQ7zW.js";
|
|
2
|
-
import { n as listDiscordDirectoryGroupsLive, r as listDiscordDirectoryPeersLive } from "./directory-live-Df0NbFJB.js";
|
|
3
|
-
import { t as resolveDiscordChannelAllowlist } from "./resolve-channels-CGeUoIqb.js";
|
|
4
|
-
import { t as resolveDiscordUserAllowlist } from "./resolve-users-BtKxLUZv.js";
|
|
5
|
-
import { i as probeDiscord, n as fetchDiscordApplicationSummary, o as resolveDiscordPrivilegedIntentsFromFlags, r as parseApplicationIdFromToken, t as fetchDiscordApplicationId } from "./probe-BTdtVRwU.js";
|
|
6
|
-
import { r as collectDiscordAuditChannelIds, t as auditDiscordChannelPermissions } from "./audit-Yc7eZDd6.js";
|
|
7
|
-
export { auditDiscordChannelPermissions, collectDiscordAuditChannelIds, fetchDiscordApplicationId, fetchDiscordApplicationSummary, listDiscordDirectoryGroupsLive, listDiscordDirectoryPeersLive, parseApplicationIdFromToken, probeDiscord, resolveDiscordChannelAllowlist, resolveDiscordPrivilegedIntentsFromFlags, resolveDiscordUserAllowlist, setDiscordRuntime };
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { _ as resolveDiscordShouldRequireMention, a as normalizeDiscordSlug, c as resolveDiscordChannelConfigWithFallback, f as resolveDiscordGuildEntry, n as isDiscordGroupAllowedByPolicy, r as normalizeDiscordAllowList, s as resolveDiscordChannelConfig, t as allowListMatches, u as resolveDiscordCommandAuthorized, v as resolveGroupDmAllow, y as shouldEmitDiscordReactionNotification } from "./allow-list-BDMimASD.js";
|
|
2
|
-
import { G as registerGateway, K as unregisterGateway, U as clearGateways, W as getGateway } from "./send.shared-B3fpaLWJ.js";
|
|
3
|
-
import { i as setPresence, n as getPresence, r as presenceCacheSize, t as clearPresences } from "./presence-cache-z1N8MbJ3.js";
|
|
4
|
-
import { a as isAbortError, i as DISCORD_DEFAULT_LISTENER_TIMEOUT_MS, l as runDiscordTaskWithTimeout, n as DISCORD_ATTACHMENT_TOTAL_TIMEOUT_MS, o as normalizeDiscordInboundWorkerTimeoutMs, r as DISCORD_DEFAULT_INBOUND_WORKER_TIMEOUT_MS, s as normalizeDiscordListenerTimeoutMs, t as DISCORD_ATTACHMENT_IDLE_TIMEOUT_MS } from "./timeouts-B9cy6RvQ.js";
|
|
5
|
-
import { d as waitForDiscordGatewayPluginRegistration, f as createDiscordNativeCommand, l as createDiscordGatewayPlugin, t as monitorDiscordProvider, u as resolveDiscordGatewayIntents, v as registerDiscordListener } from "./provider-DlK_ynqt.js";
|
|
6
|
-
import { o as sanitizeDiscordThreadName, r as resolveDiscordReplyTarget } from "./threading-DU6pgeGm.js";
|
|
7
|
-
import { t as createDiscordMessageHandler } from "./message-handler-B61q5MOF.js";
|
|
8
|
-
import "./runtime-api.monitor-CzeTYF32.js";
|
|
9
|
-
export { DISCORD_ATTACHMENT_IDLE_TIMEOUT_MS, DISCORD_ATTACHMENT_TOTAL_TIMEOUT_MS, DISCORD_DEFAULT_INBOUND_WORKER_TIMEOUT_MS, DISCORD_DEFAULT_LISTENER_TIMEOUT_MS, allowListMatches, clearGateways, clearPresences, createDiscordGatewayPlugin, createDiscordMessageHandler, createDiscordNativeCommand, getGateway, getPresence, isAbortError, isDiscordGroupAllowedByPolicy, monitorDiscordProvider, normalizeDiscordAllowList, normalizeDiscordInboundWorkerTimeoutMs, normalizeDiscordListenerTimeoutMs, normalizeDiscordSlug, presenceCacheSize, registerDiscordListener, registerGateway, resolveDiscordChannelConfig, resolveDiscordChannelConfigWithFallback, resolveDiscordCommandAuthorized, resolveDiscordGatewayIntents, resolveDiscordGuildEntry, resolveDiscordReplyTarget, resolveDiscordShouldRequireMention, resolveGroupDmAllow, runDiscordTaskWithTimeout, sanitizeDiscordThreadName, setPresence, shouldEmitDiscordReactionNotification, unregisterGateway, waitForDiscordGatewayPluginRegistration };
|
package/dist/runtime-api.send.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { O as resolveDiscordOutboundSessionRoute } from "./accounts-DNl-oCEw.js";
|
|
2
|
-
import { n as registerBuiltDiscordComponentMessage, r as sendDiscordComponentMessage, t as editDiscordComponentMessage } from "./send.components-ChK1wS7w.js";
|
|
3
|
-
import { C as hasAllGuildPermissionsDiscord, S as fetchMemberGuildPermissionsDiscord, T as hasAnyGuildPermissionDiscord, _ as DiscordSendError, x as fetchChannelPermissionsDiscord } from "./send.shared-B3fpaLWJ.js";
|
|
4
|
-
import { n as sendPollDiscord, r as sendStickerDiscord, t as sendMessageDiscord } from "./send.outbound-HIkgji_7.js";
|
|
5
|
-
import { A as listGuildEmojisDiscord, C as fetchVoiceStatusDiscord, D as removeRoleDiscord, E as listScheduledEventsDiscord, F as editChannelDiscord, I as moveChannelDiscord, L as removeChannelPermissionDiscord, M as uploadStickerDiscord, N as createChannelDiscord, O as resolveEventCoverImage, P as deleteChannelDiscord, R as setChannelPermissionDiscord, S as fetchRoleInfoDiscord, T as listGuildChannelsDiscord, _ as banMemberDiscord, c as editMessageDiscord, d as listThreadsDiscord, f as pinMessageDiscord, g as addRoleDiscord, h as unpinMessageDiscord, i as sendWebhookMessageDiscord, j as uploadEmojiDiscord, k as timeoutMemberDiscord, l as fetchMessageDiscord, m as searchMessagesDiscord, n as sendTypingDiscord, o as createThreadDiscord, p as readMessagesDiscord, r as sendVoiceMessageDiscord, s as deleteMessageDiscord, u as listPinsDiscord, v as createScheduledEventDiscord, w as kickMemberDiscord, x as fetchMemberInfoDiscord, y as fetchChannelInfoDiscord } from "./send-rQIffSYu.js";
|
|
6
|
-
import { i as removeReactionDiscord, n as reactMessageDiscord, r as removeOwnReactionsDiscord, t as fetchReactionsDiscord } from "./send.reactions-gmJ6yFPo.js";
|
|
7
|
-
export { DiscordSendError, addRoleDiscord, banMemberDiscord, createChannelDiscord, createScheduledEventDiscord, createThreadDiscord, deleteChannelDiscord, deleteMessageDiscord, editChannelDiscord, editDiscordComponentMessage, editMessageDiscord, fetchChannelInfoDiscord, fetchChannelPermissionsDiscord, fetchMemberGuildPermissionsDiscord, fetchMemberInfoDiscord, fetchMessageDiscord, fetchReactionsDiscord, fetchRoleInfoDiscord, fetchVoiceStatusDiscord, hasAllGuildPermissionsDiscord, hasAnyGuildPermissionDiscord, kickMemberDiscord, listGuildChannelsDiscord, listGuildEmojisDiscord, listPinsDiscord, listScheduledEventsDiscord, listThreadsDiscord, moveChannelDiscord, pinMessageDiscord, reactMessageDiscord, readMessagesDiscord, registerBuiltDiscordComponentMessage, removeChannelPermissionDiscord, removeOwnReactionsDiscord, removeReactionDiscord, removeRoleDiscord, resolveDiscordOutboundSessionRoute, resolveEventCoverImage, searchMessagesDiscord, sendDiscordComponentMessage, sendMessageDiscord, sendPollDiscord, sendStickerDiscord, sendTypingDiscord, sendVoiceMessageDiscord, sendWebhookMessageDiscord, setChannelPermissionDiscord, timeoutMemberDiscord, unpinMessageDiscord, uploadEmojiDiscord, uploadStickerDiscord };
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { C as resolveThreadBindingMaxAgeExpiresAt, S as resolveThreadBindingInactivityExpiresAt, w as resolveThreadBindingMaxAgeMs, x as resolveThreadBindingIdleTimeoutMs } from "./thread-bindings.state-D8OMdk4O.js";
|
|
2
|
-
import { n as setThreadBindingMaxAgeBySessionKey, t as setThreadBindingIdleTimeoutBySessionKey } from "./thread-bindings.session-updates-CJb-BpPL.js";
|
|
3
|
-
import { _ as resolveThreadBindingThreadName, g as resolveThreadBindingIntroText, h as formatThreadBindingDurationLabel, m as resolveThreadBindingPersonaFromRecord, n as createThreadBindingManager, p as resolveThreadBindingPersona, r as getThreadBindingManager, t as createNoopThreadBindingManager } from "./thread-bindings.manager-CngsgErq.js";
|
|
4
|
-
import { a as reconcileAcpThreadBindingsOnStartup, c as resolveDiscordThreadBindingMaxAgeMs, i as listThreadBindingsForAccount, l as resolveThreadBindingsEnabled, n as autoBindSpawnedDiscordSubagent, o as unbindThreadBindingsBySessionKey, r as listThreadBindingsBySessionKey, s as resolveDiscordThreadBindingIdleTimeoutMs } from "./thread-bindings-VlymUnbz.js";
|
|
5
|
-
export { autoBindSpawnedDiscordSubagent, createNoopThreadBindingManager, createThreadBindingManager, formatThreadBindingDurationLabel, getThreadBindingManager, listThreadBindingsBySessionKey, listThreadBindingsForAccount, reconcileAcpThreadBindingsOnStartup, resolveDiscordThreadBindingIdleTimeoutMs, resolveDiscordThreadBindingMaxAgeMs, resolveThreadBindingIdleTimeoutMs, resolveThreadBindingInactivityExpiresAt, resolveThreadBindingIntroText, resolveThreadBindingMaxAgeExpiresAt, resolveThreadBindingMaxAgeMs, resolveThreadBindingPersona, resolveThreadBindingPersonaFromRecord, resolveThreadBindingThreadName, resolveThreadBindingsEnabled, setThreadBindingIdleTimeoutBySessionKey, setThreadBindingMaxAgeBySessionKey, unbindThreadBindingsBySessionKey };
|