@openclaw/discord 2026.8.1-beta.3 → 2026.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/account-inspect-BY-ve3yH.js +45 -0
- package/dist/account-inspect-api.js +1 -1
- package/dist/{accounts-DNl-oCEw.js → accounts-CwJQoLjM.js} +87 -162
- package/dist/action-runtime-api.js +1 -1
- package/dist/{activities-api-KCBAmWxD.js → activities-api-CkKcHUB6.js} +14 -12
- package/dist/activities-api.js +1 -1
- package/dist/{allow-list-BDMimASD.js → allow-list-C2JuH-R0.js} +10 -6
- package/dist/{api-DNVbJyEy.js → api-BfmEP6wp.js} +6 -5
- package/dist/api.js +18 -18
- package/dist/{approval-handler.runtime-B12RCYr8.js → approval-handler.runtime-DZM6Kt1Z.js} +30 -106
- package/dist/{audit-Yc7eZDd6.js → audit-DIbQA4VT.js} +8 -7
- package/dist/{channel-cXYzGc4L.js → channel-CarzU3bg.js} +25 -25
- package/dist/{channel-actions.runtime-CODTvo7c.js → channel-actions.runtime-B2wMqeVK.js} +60 -57
- 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-z_ewMVa9.js} +18 -18
- package/dist/{components-ezGKo_Yh.js → components-gvRA0oaI.js} +33 -29
- package/dist/{config-schema-DC5kDtQ5.js → config-schema-B797-Spt.js} +21 -14
- package/dist/{conversation-binding-route-D6rCQ5S0.js → conversation-binding-route-DPpBRpYI.js} +1 -1
- package/dist/{directory-config-XyCfoqLg.js → directory-config-AA8wQx0D.js} +2 -2
- package/dist/directory-contract-api.js +1 -1
- package/dist/{directory-live-Df0NbFJB.js → directory-live-D_kFz_Fj.js} +4 -4
- package/dist/{doctor-DYY31GrO.js → doctor-QQTOkBfW.js} +5 -5
- package/dist/{doctor-contract-DsWvKIXF.js → doctor-contract-Co5vRCZ6.js} +9 -6
- package/dist/doctor-contract-api.js +4 -3
- package/dist/{handle-action.guild-admin-6Tvvinsa.js → handle-action.guild-admin-Cc88ZGon.js} +9 -5
- package/dist/index.js +1 -1
- package/dist/ingress-identity-BCzfPPYM.js +60 -0
- package/dist/{message-handler-B61q5MOF.js → message-handler-CAeEpqWo.js} +14 -10
- package/dist/{message-handler.preflight-Bzg_Hawz.js → message-handler.preflight-CoKoE3dY.js} +32 -91
- package/dist/{message-handler.process--4_712Ec.js → message-handler.process-cdIJ_fDT.js} +99 -123
- package/dist/{message-utils-BXLLnFl6.js → message-text-C0K4-fkg.js} +41 -34
- package/dist/{outbound-adapter-DxHTOqiN.js → outbound-adapter-Ch0At5Ra.js} +85 -78
- package/dist/{outbound-components-B2PL0ooH.js → outbound-components-Bnt_7x7r.js} +5 -4
- package/dist/outbound-session-route-CzzerX2K.js +668 -0
- package/dist/{owner-access-Bg41VzAf.js → owner-access-yc1sX7Gx.js} +7 -6
- package/dist/{pluralkit-dUl4v1X3.js → pluralkit-B3cUVI7i.js} +2 -2
- package/dist/{probe-BTdtVRwU.js → probe-3ovFAp3b.js} +3 -3
- package/dist/{probe.runtime-Dq5-PRKT.js → probe.runtime-BckHn3cJ.js} +1 -1
- package/dist/{provider-DlK_ynqt.js → provider-CjI8BSzS.js} +511 -342
- package/dist/{provider-session.runtime-CvvphHvs.js → provider-session.runtime-DdKRMcE9.js} +3 -3
- package/dist/provider.runtime-Bo1WbLLr.js +2 -0
- package/dist/{realtime-session.runtime-ysbMG8v7.js → realtime-session.runtime-37IC-p5K.js} +110 -126
- package/dist/{resolve-allowlist-common-DIVXbD1P.js → resolve-allowlist-common-BJ5UZNNT.js} +3 -3
- package/dist/{resolve-channels-CGeUoIqb.js → resolve-channels-BexR2eUn.js} +6 -5
- package/dist/{resolve-users-BtKxLUZv.js → resolve-users-BtXBCH5W.js} +5 -4
- package/dist/{retry-after-DdLPmPoa.js → retry-after-BrLjLUJi.js} +2 -1
- package/dist/{retry-DNsVTeTo.js → retry-t5RcEsPk.js} +237 -15
- package/dist/{runtime-CQovMsH3.js → runtime-BNlDfLwS.js} +2 -2
- package/dist/{runtime-D71_VFLr.js → runtime-DydyfxST.js} +182 -131
- package/dist/runtime-api.js +19 -26
- package/dist/{secret-config-contract-B3i6WxV5.js → secret-config-contract-DFu9hfU8.js} +14 -6
- package/dist/secret-contract-api.js +1 -1
- 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-mTKSBdmZ.js} +149 -58
- package/dist/{send.components-ChK1wS7w.js → send.components-nsPnc7kK.js} +29 -30
- package/dist/{send.outbound-HIkgji_7.js → send.outbound-CaOs9Zy1.js} +87 -84
- package/dist/{send.shared-B3fpaLWJ.js → send.shared-BJHt0Vyf.js} +55 -33
- package/dist/{sender-identity-BJtfyise.js → sender-identity-Dt0imZyY.js} +1 -1
- package/dist/setup-plugin-api.js +1 -1
- package/dist/{shared-CaAaoksy.js → shared-BNesVA4P.js} +43 -18
- package/dist/{subagent-hooks-CNT2ZJTJ.js → subagent-hooks-IeZVPLGj.js} +2 -2
- package/dist/subagent-hooks-api.js +1 -6
- package/dist/{system-events-Nuwoq_au.js → system-events-Be5EJI3b.js} +2 -2
- package/dist/{target-resolver-DIXShHaZ.js → target-resolver-C0MnwEki.js} +6 -5
- package/dist/targets-DQSye1Rv.js +3 -0
- package/dist/{thread-bindings-VlymUnbz.js → thread-bindings-wECUSIIG.js} +6 -6
- package/dist/{thread-bindings.manager-CngsgErq.js → thread-bindings.manager-B-3UHCc1.js} +31 -32
- package/dist/{thread-bindings.session-updates-CJb-BpPL.js → thread-bindings.session-updates-CC7HoQvt.js} +2 -1
- package/dist/{threading-DU6pgeGm.js → threading-te5ADPQI.js} +51 -27
- package/dist/{timeouts-B9cy6RvQ.js → timeouts-D86uWLt_.js} +1 -1
- package/dist/{transcripts-source-DeIMNbRh.js → transcripts-source-DkUhR7YK.js} +9 -4
- package/dist/transcripts-source-api.js +1 -1
- package/dist/{typing-oLiS5Z13.js → typing-DAwJF5VT.js} +2 -2
- package/dist/{voice-runtime-CjNFaynA.js → voice-runtime-COyYYTDD.js} +418 -74
- package/node_modules/@discord/embedded-app-sdk/node_modules/@types/lodash/README.md +1 -1
- package/node_modules/@discord/embedded-app-sdk/node_modules/@types/lodash/conforms.d.ts +2 -0
- package/node_modules/@discord/embedded-app-sdk/node_modules/@types/lodash/package.json +3 -3
- package/node_modules/@discord/embedded-app-sdk/node_modules/@types/lodash/stubArray.d.ts +2 -0
- package/node_modules/@discord/embedded-app-sdk/node_modules/@types/lodash/stubObject.d.ts +2 -0
- package/node_modules/@discord/embedded-app-sdk/node_modules/@types/lodash/stubString.d.ts +2 -0
- 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 +41 -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 +14 -6
- package/package.json +8 -8
- package/skills/discord/SKILL.md +1 -1
- package/dist/account-inspect-D5xmUpnj.js +0 -89
- 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/sdk-runtime-37OU6_Yh.js +0 -369
- 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,89 +0,0 @@
|
|
|
1
|
-
import { o as mergeDiscordAccountConfig, s as resolveDefaultDiscordAccountId, u as resolveDiscordAccountConfig } from "./accounts-DNl-oCEw.js";
|
|
2
|
-
import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "openclaw/plugin-sdk/account-id";
|
|
3
|
-
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
4
|
-
import { hasConfiguredSecretInput, normalizeSecretInputString } from "openclaw/plugin-sdk/secret-input";
|
|
5
|
-
//#region extensions/discord/src/account-token-inspect.ts
|
|
6
|
-
function inspectDiscordConfiguredToken(value) {
|
|
7
|
-
const normalized = normalizeSecretInputString(value);
|
|
8
|
-
if (normalized) return {
|
|
9
|
-
token: normalized.replace(/^Bot\s+/i, ""),
|
|
10
|
-
tokenSource: "config",
|
|
11
|
-
tokenStatus: "available"
|
|
12
|
-
};
|
|
13
|
-
if (hasConfiguredSecretInput(value)) return {
|
|
14
|
-
token: "",
|
|
15
|
-
tokenSource: "config",
|
|
16
|
-
tokenStatus: "configured_unavailable"
|
|
17
|
-
};
|
|
18
|
-
return null;
|
|
19
|
-
}
|
|
20
|
-
function inspectDiscordAccountTokenState(params) {
|
|
21
|
-
const accountToken = inspectDiscordConfiguredToken(params.accountToken);
|
|
22
|
-
if (accountToken) return {
|
|
23
|
-
...params.base,
|
|
24
|
-
...accountToken,
|
|
25
|
-
configured: true,
|
|
26
|
-
config: params.config
|
|
27
|
-
};
|
|
28
|
-
if (params.hasAccountToken) return {
|
|
29
|
-
...params.base,
|
|
30
|
-
token: "",
|
|
31
|
-
tokenSource: "none",
|
|
32
|
-
tokenStatus: "missing",
|
|
33
|
-
configured: false,
|
|
34
|
-
config: params.config
|
|
35
|
-
};
|
|
36
|
-
const channelToken = inspectDiscordConfiguredToken(params.channelToken);
|
|
37
|
-
if (channelToken) return {
|
|
38
|
-
...params.base,
|
|
39
|
-
...channelToken,
|
|
40
|
-
configured: true,
|
|
41
|
-
config: params.config
|
|
42
|
-
};
|
|
43
|
-
const fallback = params.resolveFallbackToken();
|
|
44
|
-
if (fallback.token) return {
|
|
45
|
-
...params.base,
|
|
46
|
-
token: fallback.token,
|
|
47
|
-
tokenSource: fallback.source,
|
|
48
|
-
tokenStatus: "available",
|
|
49
|
-
configured: true,
|
|
50
|
-
config: params.config
|
|
51
|
-
};
|
|
52
|
-
return {
|
|
53
|
-
...params.base,
|
|
54
|
-
token: "",
|
|
55
|
-
tokenSource: "none",
|
|
56
|
-
tokenStatus: "missing",
|
|
57
|
-
configured: false,
|
|
58
|
-
config: params.config
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
//#endregion
|
|
62
|
-
//#region extensions/discord/src/account-inspect.ts
|
|
63
|
-
function inspectDiscordAccount(params) {
|
|
64
|
-
const accountId = normalizeAccountId(params.accountId ?? resolveDefaultDiscordAccountId(params.cfg));
|
|
65
|
-
const merged = mergeDiscordAccountConfig(params.cfg, accountId);
|
|
66
|
-
const enabled = params.cfg.channels?.discord?.enabled !== false && merged.enabled !== false;
|
|
67
|
-
const accountConfig = resolveDiscordAccountConfig(params.cfg, accountId);
|
|
68
|
-
const hasAccountToken = Boolean(accountConfig && Object.hasOwn(accountConfig, "token"));
|
|
69
|
-
return inspectDiscordAccountTokenState({
|
|
70
|
-
base: {
|
|
71
|
-
accountId,
|
|
72
|
-
enabled,
|
|
73
|
-
name: normalizeOptionalString(merged.name)
|
|
74
|
-
},
|
|
75
|
-
config: merged,
|
|
76
|
-
accountToken: accountConfig?.token,
|
|
77
|
-
hasAccountToken,
|
|
78
|
-
channelToken: params.cfg.channels?.discord?.token,
|
|
79
|
-
resolveFallbackToken: () => {
|
|
80
|
-
const envToken = accountId === DEFAULT_ACCOUNT_ID ? normalizeSecretInputString(params.envToken ?? process.env.DISCORD_BOT_TOKEN) : void 0;
|
|
81
|
-
return {
|
|
82
|
-
token: envToken?.replace(/^Bot\s+/i, "") ?? "",
|
|
83
|
-
source: envToken ? "env" : "none"
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
//#endregion
|
|
89
|
-
export { inspectDiscordAccountTokenState as n, inspectDiscordAccount as t };
|
|
@@ -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 };
|