@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,33 +1,35 @@
|
|
|
1
|
-
import { A as
|
|
2
|
-
import { C as
|
|
3
|
-
import { c as resolveDiscordAccount, f as resolveDiscordAccountDmPolicy, l as resolveDiscordAccountAllowFrom, m as normalizeDiscordToken, p as resolveDiscordMaxLinesPerMessage } from "./accounts-
|
|
4
|
-
import { a as resolveDiscordComponentEntryWithPersistence, o as resolveDiscordModalEntryWithPersistence, t as editDiscordComponentMessage } from "./send.components-
|
|
1
|
+
import { A as ThreadUpdateListener, C as MessageCreateListener, D as ReadyListener, E as PresenceUpdateListener, G as User, H as CommandWithSubcommands, I as RateLimitError, K as hasDiscordV2Components, M as Client, N as Plugin, S as InteractionCreateListener, T as MessageReactionRemoveListener, U as Guild, V as Command, W as Message, Z as Modal, a as chunkDiscordTextWithMode, b as GuildCreateListener, ct as Row, dt as StringSelectMenu, et as Button, ft as TextDisplay, ht as BaseMessageInteractiveComponent, k as ThreadDeleteListener, nt as Container, ut as Separator, w as MessageReactionAddListener, x as GuildDeleteListener, y as discord_exports } from "./retry-t5RcEsPk.js";
|
|
2
|
+
import { C as parseDiscordActivityCustomIdForInteraction, D as parseDiscordModalCustomIdForInteraction, E as parseDiscordModalCustomId, O as decodeCustomIdComponent, T as parseDiscordComponentCustomIdForInteraction, c as parseExecApprovalData, k as encodeCustomIdComponent, o as parseDiscordQuestionData, w as parseDiscordComponentCustomId, y as buildDiscordActivityCustomId } from "./components-gvRA0oaI.js";
|
|
3
|
+
import { c as resolveDiscordAccount, f as resolveDiscordAccountDmPolicy, l as resolveDiscordAccountAllowFrom, m as normalizeDiscordToken, p as resolveDiscordMaxLinesPerMessage } from "./accounts-CwJQoLjM.js";
|
|
4
|
+
import { a as resolveDiscordComponentEntryWithPersistence, o as resolveDiscordModalEntryWithPersistence, t as editDiscordComponentMessage } from "./send.components-nsPnc7kK.js";
|
|
5
5
|
import { t as getDiscordRuntime } from "./runtime-DgnVQ7zW.js";
|
|
6
|
-
import { a as isDiscordRateLimitResponseBody, o as summarizeDiscordResponseBody } from "./api-
|
|
7
|
-
import { C as resolveTimestampMs, a as normalizeDiscordSlug, b as formatDiscordReactionEmoji, c as resolveDiscordChannelConfigWithFallback, d as resolveDiscordCommandOwnerAllowFrom, f as resolveDiscordGuildEntry, g as resolveDiscordOwnerAllowFrom, h as resolveDiscordOwnerAccess, i as normalizeDiscordDisplaySlug, l as resolveDiscordChannelPolicyCommandAuthorizer, m as resolveDiscordMemberAllowed, n as isDiscordGroupAllowedByPolicy, o as resolveDiscordAllowListMatch, p as resolveDiscordMemberAccessState, r as normalizeDiscordAllowList, v as resolveGroupDmAllow, x as formatDiscordUserTag, y as shouldEmitDiscordReactionNotification } from "./allow-list-
|
|
8
|
-
import {
|
|
9
|
-
import { a as formatMention, t as sendMessageDiscord } from "./send.outbound-
|
|
10
|
-
import {
|
|
11
|
-
import { n as
|
|
6
|
+
import { a as isDiscordRateLimitResponseBody, o as summarizeDiscordResponseBody } from "./api-BfmEP6wp.js";
|
|
7
|
+
import { C as resolveTimestampMs, a as normalizeDiscordSlug, b as formatDiscordReactionEmoji, c as resolveDiscordChannelConfigWithFallback, d as resolveDiscordCommandOwnerAllowFrom, f as resolveDiscordGuildEntry, g as resolveDiscordOwnerAllowFrom, h as resolveDiscordOwnerAccess, i as normalizeDiscordDisplaySlug, l as resolveDiscordChannelPolicyCommandAuthorizer, m as resolveDiscordMemberAllowed, n as isDiscordGroupAllowedByPolicy, o as resolveDiscordAllowListMatch, p as resolveDiscordMemberAccessState, r as normalizeDiscordAllowList, s as resolveDiscordChannelConfig, v as resolveGroupDmAllow, x as formatDiscordUserTag, y as shouldEmitDiscordReactionNotification } from "./allow-list-C2JuH-R0.js";
|
|
8
|
+
import { B as validateDiscordProxyUrl, G as unregisterGateway, P as createDiscordRestClient, R as DISCORD_REST_TIMEOUT_MS, V as withValidatedDiscordProxy, W as registerGateway, b as canViewDiscordGuildChannel, w as hasAnyChannelPermissionDiscord } from "./send.shared-BJHt0Vyf.js";
|
|
9
|
+
import { a as formatMention, t as sendMessageDiscord } from "./send.outbound-CaOs9Zy1.js";
|
|
10
|
+
import { t as isDiscordThreadChannelType } from "./channel-type-CVLZyGYS.js";
|
|
11
|
+
import { n as getDiscordActivitiesRuntime } from "./runtime-BNlDfLwS.js";
|
|
12
|
+
import { n as resolveDiscordVoiceEnabled, r as authorizeDiscordVoiceIngress, t as resolveDiscordVoiceAccess } from "./owner-access-yc1sX7Gx.js";
|
|
12
13
|
import { i as setPresence, t as clearPresences } from "./presence-cache-z1N8MbJ3.js";
|
|
13
|
-
import {
|
|
14
|
-
import { c as raceWithTimeout, u as withAbortTimeout } from "./timeouts-
|
|
15
|
-
import {
|
|
16
|
-
import { t as
|
|
17
|
-
import { t as
|
|
18
|
-
import {
|
|
19
|
-
import { a as
|
|
14
|
+
import { _ as readMessagesDiscord, s as sendVoiceMessageDiscord } from "./send-mTKSBdmZ.js";
|
|
15
|
+
import { c as raceWithTimeout, u as withAbortTimeout } from "./timeouts-D86uWLt_.js";
|
|
16
|
+
import { S as isDiscordExecApprovalClientEnabled, b as getDiscordExecApprovalApprovers, c as resolveDiscordEffectiveRoute, i as buildDiscordConversationRouteContext, n as DISCORD_APPROVAL_ALLOWED_MENTIONS, o as resolveDiscordBoundConversationRoute, r as formatDiscordApprovalDisplayValue, u as resolveDiscordConversationIdentity } from "./outbound-session-route-CzzerX2K.js";
|
|
17
|
+
import { t as discordIngressIdentity } from "./ingress-identity-BCzfPPYM.js";
|
|
18
|
+
import { t as resolveDiscordChannelAllowlist } from "./resolve-channels-BexR2eUn.js";
|
|
19
|
+
import { t as resolveDiscordUserAllowlist } from "./resolve-users-BtXBCH5W.js";
|
|
20
|
+
import { a as isThreadArchived, c as resolveDiscordChannelInfoSafe, f as resolveDiscordChannelTopicSafe, h as formatThreadBindingDurationLabel, l as resolveDiscordChannelNameSafe, r as getThreadBindingManager, s as resolveDiscordChannelIdSafe, u as resolveDiscordChannelParentIdSafe } from "./thread-bindings.manager-B-3UHCc1.js";
|
|
21
|
+
import { a as probeDiscordApplicationId, r as parseApplicationIdFromToken } from "./probe-3ovFAp3b.js";
|
|
20
22
|
import { i as sanitizeRecentModels, n as normalizeModelRef, r as preferenceTimestampMs, t as buildPreferenceModelKey } from "./model-picker-preference-primitives-BHT1LkR_.js";
|
|
21
|
-
import {
|
|
22
|
-
import { i as resolveDiscordThreadParentInfo } from "./threading-
|
|
23
|
-
import { t as resolveDiscordSenderIdentity } from "./sender-identity-
|
|
23
|
+
import { m as resolveDiscordChannelInfo, u as resolveDiscordMessageStickers } from "./message-text-C0K4-fkg.js";
|
|
24
|
+
import { i as resolveDiscordThreadParentInfo } from "./threading-te5ADPQI.js";
|
|
25
|
+
import { t as resolveDiscordSenderIdentity } from "./sender-identity-Dt0imZyY.js";
|
|
24
26
|
import { logDebug, logError } from "openclaw/plugin-sdk/logging-core";
|
|
25
|
-
import { ApplicationCommandOptionType, ButtonStyle, ChannelType, ComponentType, GatewayCloseCodes, GatewayCloseCodes as GatewayCloseCodes$1, GatewayDispatchEvents, GatewayIntentBits, GatewayOpcodes } from "discord-api-types/v10";
|
|
27
|
+
import { ApplicationCommandOptionType, ButtonStyle, ChannelType, ComponentType, GatewayCloseCodes, GatewayCloseCodes as GatewayCloseCodes$1, GatewayDispatchEvents, GatewayIntentBits, GatewayOpcodes, PermissionFlagsBits } from "discord-api-types/v10";
|
|
28
|
+
import { Type } from "typebox";
|
|
29
|
+
import { Check, Errors } from "typebox/value";
|
|
26
30
|
import { createHash, randomUUID } from "node:crypto";
|
|
27
31
|
import { MAX_DATE_TIMESTAMP_MS, MAX_TIMER_TIMEOUT_MS, asDateTimestampMs, asSafeIntegerInRange, parseFiniteNumber, parseStrictInteger, parseStrictPositiveInteger, resolveDateTimestampMs, resolveTimestampMsToIsoString } from "openclaw/plugin-sdk/number-runtime";
|
|
28
32
|
import { expectDefined } from "openclaw/plugin-sdk/expect-runtime";
|
|
29
|
-
import { Type } from "typebox";
|
|
30
|
-
import { Check, Errors } from "typebox/value";
|
|
31
33
|
import { inspect } from "node:util";
|
|
32
34
|
import { readResponseWithLimit } from "openclaw/plugin-sdk/response-limit-runtime";
|
|
33
35
|
import { PlatformMessageNotDispatchedError, formatErrorMessage, toErrorObject } from "openclaw/plugin-sdk/error-runtime";
|
|
@@ -36,6 +38,7 @@ import { normalizeAccountId } from "openclaw/plugin-sdk/account-id";
|
|
|
36
38
|
import { resolveAgentRoute } from "openclaw/plugin-sdk/routing";
|
|
37
39
|
import { asFiniteNumber, asOptionalRecord, normalizeLowercaseStringOrEmpty, normalizeOptionalLowercaseString, normalizeOptionalString, normalizeStringEntries, parseFiniteNumber as parseFiniteNumber$1, parseStrictNonNegativeInteger as parseStrictNonNegativeInteger$1, summarizeStringEntries } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
38
40
|
import { getRuntimeConfig, getRuntimeConfigSnapshot } from "openclaw/plugin-sdk/runtime-config-snapshot";
|
|
41
|
+
import { resolveSendableOutboundReplyParts, resolveTextChunksWithFallback } from "openclaw/plugin-sdk/reply-payload";
|
|
39
42
|
import { createHttp1EnvHttpProxyAgent, createHttp1ProxyAgent, createNodeProxyAgent, resolveEnvHttpProxyAgentOptions, wrapFetchWithAbortSignal } from "openclaw/plugin-sdk/fetch-runtime";
|
|
40
43
|
import { createNonExitingRuntime, createSubsystemLogger, danger, formatDurationSeconds, isVerbose, logVerbose, shouldLogVerbose, sleepWithAbort, warn } from "openclaw/plugin-sdk/runtime-env";
|
|
41
44
|
import { sliceUtf16Safe, truncateUtf16Safe, withTimeout } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
@@ -45,7 +48,6 @@ import { resolveChunkMode, resolveTextChunkLimit } from "openclaw/plugin-sdk/rep
|
|
|
45
48
|
import { chunkItems, findCodeRegions, sanitizeAssistantVisibleText, sanitizeAssistantVisibleTextWithProfile } from "openclaw/plugin-sdk/text-chunking";
|
|
46
49
|
import { buildOutboundSessionContext, listMessageReceiptPlatformIds, resolveChannelStreamingBlockEnabled, sendDurableMessageBatch } from "openclaw/plugin-sdk/channel-outbound";
|
|
47
50
|
import { getAgentScopedMediaLocalRoots } from "openclaw/plugin-sdk/media-runtime";
|
|
48
|
-
import { resolveSendableOutboundReplyParts, resolveTextChunksWithFallback } from "openclaw/plugin-sdk/reply-payload";
|
|
49
51
|
import { loadWebMedia } from "openclaw/plugin-sdk/web-media";
|
|
50
52
|
import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
|
|
51
53
|
import { buildCommandTextFromArgs, findCommandByNativeName, formatCommandArgMenuTitle, listChatCommands, listNativeCommandSpecsForConfig, listSkillCommandsForAgents, resolveCommandAuthorizedFromAuthorizers, resolveEffectiveAgentRuntime, resolveNativeCommandSessionTargets, resolveStoredModelOverride, serializeCommandArgs } from "openclaw/plugin-sdk/command-auth-native";
|
|
@@ -56,15 +58,15 @@ import { CHANNEL_APPROVAL_NATIVE_RUNTIME_CONTEXT_CAPABILITY } from "openclaw/plu
|
|
|
56
58
|
import { buildPairingReply, upsertChannelPairingRequest, upsertChannelPairingRequest as upsertChannelPairingRequest$1 } from "openclaw/plugin-sdk/conversation-runtime";
|
|
57
59
|
import * as conversationRuntime from "openclaw/plugin-sdk/conversation-binding-runtime";
|
|
58
60
|
import { questionGatewayRuntime } from "openclaw/plugin-sdk/question-gateway-runtime";
|
|
61
|
+
import { createChannelIngressResolver, readChannelIngressStoreAllowFromForDmPolicy } from "openclaw/plugin-sdk/channel-ingress-runtime";
|
|
59
62
|
import { clearExpiredCooldowns, ensureAuthProfileStore, formatReasoningMessage, getPreparedModelCatalogSnapshot, isProfileInCooldown, listAgentIds, loadPreparedModelCatalog, resolveAgentAvatar, resolveAgentDir, resolveDefaultModelForAgent, resolveHumanDelayConfig, resolveProfilesUnavailableReason } from "openclaw/plugin-sdk/agent-runtime";
|
|
60
63
|
import { isDangerousNameMatchingEnabled } from "openclaw/plugin-sdk/dangerous-name-runtime";
|
|
61
64
|
import { resolveNativeCommandsEnabled, resolveNativeSkillsEnabled } from "openclaw/plugin-sdk/native-command-config-runtime";
|
|
62
65
|
import { requestHeartbeat } from "openclaw/plugin-sdk/heartbeat-runtime";
|
|
63
66
|
import { enqueueRoutedSystemEvent, enqueueRoutedSystemEvent as enqueueRoutedSystemEvent$1 } from "openclaw/plugin-sdk/system-event-runtime";
|
|
64
67
|
import { deleteSessionEntry, getSessionEntry, listSessionEntries, readSessionUpdatedAt as readSessionUpdatedAt$1, resolveStorePath, resolveStorePath as resolveStorePath$1 } from "openclaw/plugin-sdk/session-store-runtime";
|
|
65
|
-
import { createChannelIngressResolver, defineStableChannelIngressIdentity, readChannelIngressStoreAllowFromForDmPolicy } from "openclaw/plugin-sdk/channel-ingress-runtime";
|
|
66
|
-
import { createChannelPartialDeliveryError, dispatchChannelInboundTurn, formatInboundEnvelope, hasVisibleInboundReplyDispatch, isChannelPartialDeliveryError, resolveEnvelopeFormatOptions, resolveInboundSupplementalSenderAllowed, runChannelInboundEvent } from "openclaw/plugin-sdk/channel-inbound";
|
|
67
68
|
import { finalizeInboundContext } from "openclaw/plugin-sdk/reply-dispatch-runtime";
|
|
69
|
+
import { createChannelPartialDeliveryError, dispatchChannelInboundTurn, formatInboundEnvelope, hasVisibleInboundReplyDispatch, isChannelPartialDeliveryError, resolveEnvelopeFormatOptions, resolveInboundSupplementalSenderAllowed, runChannelInboundEvent } from "openclaw/plugin-sdk/channel-inbound";
|
|
68
70
|
import { buildCommandTextFromArgs as buildCommandTextFromArgs$1, findCommandByNativeName as findCommandByNativeName$1, mergeNativeCommandSpecs, parseCommandArgs, resolveCommandArgChoices, resolveCommandArgMenu, serializeCommandArgs as serializeCommandArgs$1 } from "openclaw/plugin-sdk/native-command-registry";
|
|
69
71
|
import { PLUGIN_COMMAND_DISPATCH } from "openclaw/plugin-sdk/plugin-command-runtime";
|
|
70
72
|
import { resolveDirectStatusReplyForSession } from "openclaw/plugin-sdk/command-status-runtime";
|
|
@@ -79,6 +81,7 @@ import { registerChannelRuntimeContext } from "openclaw/plugin-sdk/channel-runti
|
|
|
79
81
|
import { stripPlainTextToolCallBlocks } from "openclaw/plugin-sdk/tool-payload";
|
|
80
82
|
import { createChannelInteractiveDispatcher } from "openclaw/plugin-sdk/plugin-runtime";
|
|
81
83
|
import { resolveApprovalOverGateway } from "openclaw/plugin-sdk/approval-gateway-runtime";
|
|
84
|
+
import { reportChannelRoomJoin } from "openclaw/plugin-sdk/channel-join-intro-runtime";
|
|
82
85
|
import { resolveRequestUrl } from "openclaw/plugin-sdk/request-url";
|
|
83
86
|
import { fetchWithRuntimeDispatcher } from "openclaw/plugin-sdk/runtime-fetch";
|
|
84
87
|
import { Agent as Agent$1 } from "undici";
|
|
@@ -141,7 +144,7 @@ async function runDiscordListenerWithSlowLog(params) {
|
|
|
141
144
|
}
|
|
142
145
|
//#endregion
|
|
143
146
|
//#region extensions/discord/src/monitor/presence-events.ts
|
|
144
|
-
const DISCORD_PRESENCE_GREETING_COOLDOWN_MS =
|
|
147
|
+
const DISCORD_PRESENCE_GREETING_COOLDOWN_MS = 288e5;
|
|
145
148
|
function isDiscordOnlineStatus(status) {
|
|
146
149
|
return status === "online" || status === "idle" || status === "dnd";
|
|
147
150
|
}
|
|
@@ -180,9 +183,9 @@ function openDiscordPresenceCooldownStore() {
|
|
|
180
183
|
}
|
|
181
184
|
//#endregion
|
|
182
185
|
//#region extensions/discord/src/monitor/presence-emission-gate.ts
|
|
183
|
-
const DISCORD_PRESENCE_RECONNECT_SUPPRESS_MS =
|
|
186
|
+
const DISCORD_PRESENCE_RECONNECT_SUPPRESS_MS = 3e5;
|
|
184
187
|
const DISCORD_PRESENCE_BURST_LIMIT = 8;
|
|
185
|
-
const DISCORD_PRESENCE_BURST_WINDOW_MS =
|
|
188
|
+
const DISCORD_PRESENCE_BURST_WINDOW_MS = 6e4;
|
|
186
189
|
function resolveDiscordPresenceGateOptions(config) {
|
|
187
190
|
return {
|
|
188
191
|
reconnectSuppressMs: config?.reconnectSuppressSeconds !== void 0 ? config.reconnectSuppressSeconds * 1e3 : DISCORD_PRESENCE_RECONNECT_SUPPRESS_MS,
|
|
@@ -340,55 +343,16 @@ async function closeDiscordThreadSessions(params) {
|
|
|
340
343
|
}
|
|
341
344
|
//#endregion
|
|
342
345
|
//#region extensions/discord/src/monitor/dm-command-auth.ts
|
|
343
|
-
const DISCORD_ALLOW_LIST_PREFIXES = [
|
|
344
|
-
"discord:",
|
|
345
|
-
"user:",
|
|
346
|
-
"pk:"
|
|
347
|
-
];
|
|
348
346
|
const DISCORD_CHANNEL_ID = "discord";
|
|
349
|
-
const DISCORD_USER_ID_KIND = "stable-id";
|
|
350
|
-
const DISCORD_USER_NAME_KIND = "username";
|
|
351
|
-
function normalizeDiscordIdEntry(entry) {
|
|
352
|
-
const text = entry.trim();
|
|
353
|
-
if (!text) return null;
|
|
354
|
-
const maybeId = text.replace(/^<@!?/, "").replace(/>$/, "");
|
|
355
|
-
if (/^\d+$/.test(maybeId)) return maybeId;
|
|
356
|
-
const prefix = DISCORD_ALLOW_LIST_PREFIXES.find((entryPrefix) => text.startsWith(entryPrefix));
|
|
357
|
-
if (prefix) return text.slice(prefix.length).trim() || null;
|
|
358
|
-
return null;
|
|
359
|
-
}
|
|
360
|
-
function normalizeDiscordNameEntry(entry) {
|
|
361
|
-
const text = entry.trim();
|
|
362
|
-
if (!text || text === "*" || normalizeDiscordIdEntry(text)) return null;
|
|
363
|
-
const nameSlug = normalizeDiscordAllowList([text], DISCORD_ALLOW_LIST_PREFIXES)?.names.values().next().value;
|
|
364
|
-
return typeof nameSlug === "string" && nameSlug ? nameSlug : null;
|
|
365
|
-
}
|
|
366
|
-
function normalizeDiscordNameSubject(value) {
|
|
367
|
-
const nameSlug = normalizeDiscordAllowList([value], DISCORD_ALLOW_LIST_PREFIXES)?.names.values().next().value;
|
|
368
|
-
return typeof nameSlug === "string" && nameSlug ? nameSlug : null;
|
|
369
|
-
}
|
|
370
|
-
const discordIngressIdentity = defineStableChannelIngressIdentity({
|
|
371
|
-
key: "discordUserId",
|
|
372
|
-
kind: DISCORD_USER_ID_KIND,
|
|
373
|
-
normalizeEntry: normalizeDiscordIdEntry,
|
|
374
|
-
normalizeSubject: (value) => value.trim() || null,
|
|
375
|
-
sensitivity: "pii",
|
|
376
|
-
aliases: [["discordUserName", normalizeDiscordNameEntry], ["discordUserTag", () => null]].map(([key, normalizeEntry]) => ({
|
|
377
|
-
key,
|
|
378
|
-
kind: DISCORD_USER_NAME_KIND,
|
|
379
|
-
normalizeEntry,
|
|
380
|
-
normalizeSubject: normalizeDiscordNameSubject,
|
|
381
|
-
dangerous: true,
|
|
382
|
-
sensitivity: "pii"
|
|
383
|
-
}))
|
|
384
|
-
});
|
|
385
347
|
function createDiscordDmIngressSubject(sender) {
|
|
386
348
|
return {
|
|
387
349
|
stableId: sender.id,
|
|
388
350
|
aliases: {
|
|
389
351
|
discordUserName: sender.name,
|
|
390
|
-
discordUserTag: sender.tag
|
|
391
|
-
|
|
352
|
+
discordUserTag: sender.tag,
|
|
353
|
+
participantKind: sender.isPluralKit ? "pluralkit-member" : sender.authorKind
|
|
354
|
+
},
|
|
355
|
+
...sender.isPluralKit ? { authentication: { discordUserId: "asserted" } } : {}
|
|
392
356
|
};
|
|
393
357
|
}
|
|
394
358
|
function createDiscordDynamicAccessGroupResolver(params) {
|
|
@@ -463,7 +427,10 @@ async function resolveDiscordDmCommandAccess(params) {
|
|
|
463
427
|
},
|
|
464
428
|
dmPolicy: params.dmPolicy,
|
|
465
429
|
groupPolicy: "disabled",
|
|
466
|
-
policy: {
|
|
430
|
+
policy: {
|
|
431
|
+
mutableIdentifierMatching: params.allowNameMatching ? "enabled" : "disabled",
|
|
432
|
+
...params.minIdentifierAuthentication ? { minIdentifierAuthentication: params.minIdentifierAuthentication } : {}
|
|
433
|
+
},
|
|
467
434
|
allowFrom: params.configuredAllowFrom,
|
|
468
435
|
command: {
|
|
469
436
|
hasControlCommand: false,
|
|
@@ -493,7 +460,10 @@ async function resolveDiscordTextCommandAccess(params) {
|
|
|
493
460
|
accessGroupMembership,
|
|
494
461
|
dmPolicy: "allowlist",
|
|
495
462
|
groupPolicy: "allowlist",
|
|
496
|
-
policy: {
|
|
463
|
+
policy: {
|
|
464
|
+
mutableIdentifierMatching: params.allowNameMatching ? "enabled" : "disabled",
|
|
465
|
+
...params.minIdentifierAuthentication ? { minIdentifierAuthentication: params.minIdentifierAuthentication } : {}
|
|
466
|
+
},
|
|
497
467
|
allowFrom: ownerAllowFrom,
|
|
498
468
|
groupAllowFrom: commandGroup,
|
|
499
469
|
command: {
|
|
@@ -505,9 +475,6 @@ async function resolveDiscordTextCommandAccess(params) {
|
|
|
505
475
|
}
|
|
506
476
|
//#endregion
|
|
507
477
|
//#region extensions/discord/src/monitor/thread-channel-context.ts
|
|
508
|
-
function isDiscordThreadChannelType(type) {
|
|
509
|
-
return type === discord_exports.ChannelType.PublicThread || type === discord_exports.ChannelType.PrivateThread || type === discord_exports.ChannelType.AnnouncementThread;
|
|
510
|
-
}
|
|
511
478
|
function buildFetchedChannelInfo(channel) {
|
|
512
479
|
const channelInfo = resolveDiscordChannelInfoSafe(channel);
|
|
513
480
|
if (channelInfo.type === void 0) return null;
|
|
@@ -834,14 +801,14 @@ async function handleDiscordReactionEvent(params) {
|
|
|
834
801
|
const guildSlug = guildInfo?.slug || (data.guild?.name ? normalizeDiscordSlug(data.guild.name) : data.guild_id ?? (isGroupDm ? "group-dm" : "dm"));
|
|
835
802
|
const channelLabel = channelSlug ? `#${channelSlug}` : channelName ? `#${normalizeDiscordSlug(channelName)}` : `#${data.channel_id}`;
|
|
836
803
|
reactionBase = {
|
|
837
|
-
baseText: `Discord reaction ${action}: ${emojiLabel} by ${actorLabel} on ${guildSlug} ${channelLabel} msg ${data.message_id}`,
|
|
838
|
-
contextKey: `discord:reaction:${action}:${data.message_id}:${user.id}:${emojiLabel}`
|
|
804
|
+
baseText: `Discord ${data.burst ? "super " : ""}reaction ${action}: ${emojiLabel} by ${actorLabel} on ${guildSlug} ${channelLabel} msg ${data.message_id}`,
|
|
805
|
+
contextKey: `discord:reaction:${action}:${data.message_id}:${user.id}:${emojiLabel}${data.burst ? ":burst" : ""}`
|
|
839
806
|
};
|
|
840
807
|
return reactionBase;
|
|
841
808
|
};
|
|
842
809
|
const emitReaction = (text, parentPeerId) => {
|
|
843
810
|
const { contextKey } = resolveReactionBase();
|
|
844
|
-
|
|
811
|
+
const route = resolveAgentRoute({
|
|
845
812
|
cfg: params.cfg,
|
|
846
813
|
channel: "discord",
|
|
847
814
|
accountId: params.accountId,
|
|
@@ -855,7 +822,8 @@ async function handleDiscordReactionEvent(params) {
|
|
|
855
822
|
kind: "channel",
|
|
856
823
|
id: parentPeerId
|
|
857
824
|
} : void 0
|
|
858
|
-
})
|
|
825
|
+
});
|
|
826
|
+
enqueueRoutedSystemEvent(text, route, { contextKey });
|
|
859
827
|
};
|
|
860
828
|
const shouldNotifyReaction = (options) => shouldEmitDiscordReactionNotification({
|
|
861
829
|
mode: options.mode,
|
|
@@ -1520,6 +1488,7 @@ async function dispatchDiscordNativeAgentReply(params) {
|
|
|
1520
1488
|
sessionKey: params.ctxPayload.SessionKey ?? params.effectiveRoute.sessionKey
|
|
1521
1489
|
},
|
|
1522
1490
|
ctxPayload: params.ctxPayload,
|
|
1491
|
+
dispatchReplyFromConfig: params.dispatchReplyFromConfig,
|
|
1523
1492
|
delivery: {
|
|
1524
1493
|
deliver: async (payload) => {
|
|
1525
1494
|
if (params.suppressReplies) return {
|
|
@@ -1569,12 +1538,12 @@ async function dispatchDiscordNativeAgentReply(params) {
|
|
|
1569
1538
|
disableBlockStreaming: typeof blockStreamingEnabled === "boolean" ? !blockStreamingEnabled : void 0
|
|
1570
1539
|
}
|
|
1571
1540
|
});
|
|
1572
|
-
const
|
|
1541
|
+
const shouldSettleWithoutVisibleReply = params.suppressReplies || finalReplyOutcome === "suppressed" || turnResult.dispatched && (turnResult.dispatchResult.deliberateSilentTerminalReply === true || turnResult.dispatchResult.deferredToActiveRun !== void 0);
|
|
1573
1542
|
const dispatchResult = {
|
|
1574
1543
|
dispatched: turnResult.dispatched,
|
|
1575
1544
|
...hiddenFinalReply ? { hiddenFinalReply } : {}
|
|
1576
1545
|
};
|
|
1577
|
-
if (!didReply &&
|
|
1546
|
+
if (!didReply && shouldSettleWithoutVisibleReply) {
|
|
1578
1547
|
await settleDiscordInteractionWithoutVisibleReply(params.interaction);
|
|
1579
1548
|
return dispatchResult;
|
|
1580
1549
|
}
|
|
@@ -1593,6 +1562,150 @@ async function dispatchDiscordNativeAgentReply(params) {
|
|
|
1593
1562
|
return dispatchResult;
|
|
1594
1563
|
}
|
|
1595
1564
|
//#endregion
|
|
1565
|
+
//#region extensions/discord/src/monitor/commands.ts
|
|
1566
|
+
function resolveDiscordSlashCommandConfig(raw) {
|
|
1567
|
+
return { ephemeral: raw?.ephemeral !== false };
|
|
1568
|
+
}
|
|
1569
|
+
//#endregion
|
|
1570
|
+
//#region extensions/discord/src/monitor/native-command-arg-ui.ts
|
|
1571
|
+
const DISCORD_COMMAND_ARG_CUSTOM_ID_KEY = "cmdarg";
|
|
1572
|
+
function createCommandArgsWithValue(params) {
|
|
1573
|
+
return { values: { [params.argName]: params.value } };
|
|
1574
|
+
}
|
|
1575
|
+
function buildDiscordCommandArgCustomId(params) {
|
|
1576
|
+
return [
|
|
1577
|
+
`${DISCORD_COMMAND_ARG_CUSTOM_ID_KEY}:command=${encodeCustomIdComponent(params.command)}`,
|
|
1578
|
+
`arg=${encodeCustomIdComponent(params.arg)}`,
|
|
1579
|
+
`value=${encodeCustomIdComponent(params.value)}`,
|
|
1580
|
+
`user=${encodeCustomIdComponent(params.userId)}`
|
|
1581
|
+
].join(";");
|
|
1582
|
+
}
|
|
1583
|
+
function parseDiscordCommandArgData(data) {
|
|
1584
|
+
if (!data || typeof data !== "object") return null;
|
|
1585
|
+
const coerce = (value) => typeof value === "string" || typeof value === "number" ? String(value) : "";
|
|
1586
|
+
const rawCommand = coerce(data.command);
|
|
1587
|
+
const rawArg = coerce(data.arg);
|
|
1588
|
+
const rawValue = coerce(data.value);
|
|
1589
|
+
const rawUser = coerce(data.user);
|
|
1590
|
+
if (!rawCommand || !rawArg || !rawValue || !rawUser) return null;
|
|
1591
|
+
return {
|
|
1592
|
+
command: decodeCustomIdComponent(rawCommand),
|
|
1593
|
+
arg: decodeCustomIdComponent(rawArg),
|
|
1594
|
+
value: decodeCustomIdComponent(rawValue),
|
|
1595
|
+
userId: decodeCustomIdComponent(rawUser)
|
|
1596
|
+
};
|
|
1597
|
+
}
|
|
1598
|
+
async function handleDiscordCommandArgInteraction(params) {
|
|
1599
|
+
const { interaction, data, ctx } = params;
|
|
1600
|
+
const clearWithMessage = async (content) => await params.safeInteractionCall("command arg update", () => interaction.update({
|
|
1601
|
+
content,
|
|
1602
|
+
components: []
|
|
1603
|
+
}));
|
|
1604
|
+
const parsed = parseDiscordCommandArgData(data);
|
|
1605
|
+
if (!parsed) {
|
|
1606
|
+
await clearWithMessage("Sorry, that selection is no longer available.");
|
|
1607
|
+
return;
|
|
1608
|
+
}
|
|
1609
|
+
if (interaction.user?.id && interaction.user.id !== parsed.userId) {
|
|
1610
|
+
await params.safeInteractionCall("command arg ack", () => interaction.acknowledge());
|
|
1611
|
+
return;
|
|
1612
|
+
}
|
|
1613
|
+
const commandDefinition = findCommandByNativeName(parsed.command, "discord") ?? listChatCommands().find((entry) => entry.key === parsed.command);
|
|
1614
|
+
if (!commandDefinition) {
|
|
1615
|
+
await clearWithMessage("Sorry, that command is no longer available.");
|
|
1616
|
+
return;
|
|
1617
|
+
}
|
|
1618
|
+
if (await clearWithMessage(`⏳ Applying ${parsed.value}...`) === null) return;
|
|
1619
|
+
const commandArgs = createCommandArgsWithValue({
|
|
1620
|
+
argName: parsed.arg,
|
|
1621
|
+
value: parsed.value
|
|
1622
|
+
});
|
|
1623
|
+
const commandArgsWithRaw = {
|
|
1624
|
+
...commandArgs,
|
|
1625
|
+
raw: serializeCommandArgs(commandDefinition, commandArgs)
|
|
1626
|
+
};
|
|
1627
|
+
const prompt = buildCommandTextFromArgs(commandDefinition, commandArgsWithRaw);
|
|
1628
|
+
await params.dispatchCommandInteraction({
|
|
1629
|
+
interaction,
|
|
1630
|
+
prompt,
|
|
1631
|
+
command: commandDefinition,
|
|
1632
|
+
commandArgs: commandArgsWithRaw,
|
|
1633
|
+
cfg: ctx.cfg,
|
|
1634
|
+
discordConfig: ctx.discordConfig,
|
|
1635
|
+
accountId: ctx.accountId,
|
|
1636
|
+
sessionPrefix: ctx.sessionPrefix,
|
|
1637
|
+
preferFollowUp: true,
|
|
1638
|
+
threadBindings: ctx.threadBindings,
|
|
1639
|
+
responseEphemeral: resolveDiscordSlashCommandConfig(ctx.discordConfig?.slashCommand).ephemeral,
|
|
1640
|
+
dispatchReplyFromConfig: ctx.dispatchReplyFromConfig,
|
|
1641
|
+
pluginCommandDispatch: { kind: "non-plugin" }
|
|
1642
|
+
});
|
|
1643
|
+
}
|
|
1644
|
+
async function runDiscordCommandArgButton(params) {
|
|
1645
|
+
await handleDiscordCommandArgInteraction(params);
|
|
1646
|
+
}
|
|
1647
|
+
var DiscordCommandArgButton = class extends Button {
|
|
1648
|
+
constructor(params) {
|
|
1649
|
+
super();
|
|
1650
|
+
this.style = ButtonStyle.Secondary;
|
|
1651
|
+
this.label = params.label;
|
|
1652
|
+
this.customId = params.customId;
|
|
1653
|
+
this.params = params;
|
|
1654
|
+
}
|
|
1655
|
+
async run(interaction, data) {
|
|
1656
|
+
await runDiscordCommandArgButton({
|
|
1657
|
+
...this.params,
|
|
1658
|
+
interaction,
|
|
1659
|
+
data
|
|
1660
|
+
});
|
|
1661
|
+
}
|
|
1662
|
+
};
|
|
1663
|
+
function buildDiscordCommandArgMenu(params) {
|
|
1664
|
+
const { command, menu, interaction } = params;
|
|
1665
|
+
const commandLabel = command.nativeName ?? command.key;
|
|
1666
|
+
const userId = interaction.user?.id ?? "";
|
|
1667
|
+
const rows = chunkItems(menu.choices, 4).map((choices) => {
|
|
1668
|
+
const buttons = choices.map((choice) => new DiscordCommandArgButton({
|
|
1669
|
+
label: choice.label,
|
|
1670
|
+
customId: buildDiscordCommandArgCustomId({
|
|
1671
|
+
command: commandLabel,
|
|
1672
|
+
arg: menu.arg.name,
|
|
1673
|
+
value: choice.value,
|
|
1674
|
+
userId
|
|
1675
|
+
}),
|
|
1676
|
+
ctx: params.ctx,
|
|
1677
|
+
safeInteractionCall: params.safeInteractionCall,
|
|
1678
|
+
dispatchCommandInteraction: params.dispatchCommandInteraction
|
|
1679
|
+
}));
|
|
1680
|
+
return new Row(buttons);
|
|
1681
|
+
});
|
|
1682
|
+
return {
|
|
1683
|
+
content: formatCommandArgMenuTitle({
|
|
1684
|
+
command,
|
|
1685
|
+
menu
|
|
1686
|
+
}),
|
|
1687
|
+
components: rows
|
|
1688
|
+
};
|
|
1689
|
+
}
|
|
1690
|
+
var DiscordCommandArgFallbackButton = class extends Button {
|
|
1691
|
+
constructor(params) {
|
|
1692
|
+
super();
|
|
1693
|
+
this.params = params;
|
|
1694
|
+
this.label = "cmdarg";
|
|
1695
|
+
this.customId = "cmdarg:seed=1";
|
|
1696
|
+
}
|
|
1697
|
+
async run(interaction, data) {
|
|
1698
|
+
await runDiscordCommandArgButton({
|
|
1699
|
+
...this.params,
|
|
1700
|
+
interaction,
|
|
1701
|
+
data
|
|
1702
|
+
});
|
|
1703
|
+
}
|
|
1704
|
+
};
|
|
1705
|
+
function createDiscordCommandArgFallbackButton$1(params) {
|
|
1706
|
+
return new DiscordCommandArgFallbackButton(params);
|
|
1707
|
+
}
|
|
1708
|
+
//#endregion
|
|
1596
1709
|
//#region extensions/discord/src/monitor/native-interaction-channel-context.ts
|
|
1597
1710
|
async function resolveDiscordNativeInteractionChannelContext(params) {
|
|
1598
1711
|
const channelContext = await resolveDiscordThreadLikeChannelContext({
|
|
@@ -1992,188 +2105,6 @@ function buildDiscordNativeCommandContext(params) {
|
|
|
1992
2105
|
});
|
|
1993
2106
|
}
|
|
1994
2107
|
//#endregion
|
|
1995
|
-
//#region extensions/discord/src/monitor/native-command-status.ts
|
|
1996
|
-
async function maybeDeliverDiscordDirectStatus(params) {
|
|
1997
|
-
if (params.suppressReplies || params.commandName !== "status") return null;
|
|
1998
|
-
const statusReply = await params.resolveDirectStatusReplyForSession({
|
|
1999
|
-
cfg: params.cfg,
|
|
2000
|
-
sessionKey: params.commandTargetSessionKey?.trim() || params.sessionKey,
|
|
2001
|
-
channel: params.channel,
|
|
2002
|
-
senderId: params.senderId,
|
|
2003
|
-
senderIsOwner: params.senderIsOwner,
|
|
2004
|
-
isAuthorizedSender: params.isAuthorizedSender,
|
|
2005
|
-
isGroup: params.isGroup,
|
|
2006
|
-
defaultGroupActivation: params.defaultGroupActivation
|
|
2007
|
-
});
|
|
2008
|
-
if (statusReply && hasRenderableReplyPayload(statusReply)) {
|
|
2009
|
-
await deliverDiscordInteractionReply({
|
|
2010
|
-
interaction: params.interaction,
|
|
2011
|
-
payload: statusReply,
|
|
2012
|
-
mediaLocalRoots: params.mediaLocalRoots,
|
|
2013
|
-
textLimit: resolveTextChunkLimit(params.cfg, "discord", params.accountId, { fallbackLimit: 2e3 }),
|
|
2014
|
-
maxLinesPerMessage: resolveDiscordMaxLinesPerMessage({
|
|
2015
|
-
cfg: params.cfg,
|
|
2016
|
-
discordConfig: params.discordConfig,
|
|
2017
|
-
accountId: params.accountId
|
|
2018
|
-
}),
|
|
2019
|
-
preferFollowUp: params.preferFollowUp,
|
|
2020
|
-
responseEphemeral: params.responseEphemeral,
|
|
2021
|
-
chunkMode: resolveChunkMode(params.cfg, "discord", params.accountId)
|
|
2022
|
-
});
|
|
2023
|
-
return {
|
|
2024
|
-
accepted: true,
|
|
2025
|
-
effectiveRoute: params.effectiveRoute
|
|
2026
|
-
};
|
|
2027
|
-
}
|
|
2028
|
-
await params.respond("Status unavailable.");
|
|
2029
|
-
return {
|
|
2030
|
-
accepted: true,
|
|
2031
|
-
effectiveRoute: params.effectiveRoute
|
|
2032
|
-
};
|
|
2033
|
-
}
|
|
2034
|
-
//#endregion
|
|
2035
|
-
//#region extensions/discord/src/monitor/commands.ts
|
|
2036
|
-
function resolveDiscordSlashCommandConfig(raw) {
|
|
2037
|
-
return { ephemeral: raw?.ephemeral !== false };
|
|
2038
|
-
}
|
|
2039
|
-
//#endregion
|
|
2040
|
-
//#region extensions/discord/src/monitor/native-command-arg-ui.ts
|
|
2041
|
-
const DISCORD_COMMAND_ARG_CUSTOM_ID_KEY = "cmdarg";
|
|
2042
|
-
function createCommandArgsWithValue(params) {
|
|
2043
|
-
return { values: { [params.argName]: params.value } };
|
|
2044
|
-
}
|
|
2045
|
-
function buildDiscordCommandArgCustomId(params) {
|
|
2046
|
-
return [
|
|
2047
|
-
`${DISCORD_COMMAND_ARG_CUSTOM_ID_KEY}:command=${encodeCustomIdComponent(params.command)}`,
|
|
2048
|
-
`arg=${encodeCustomIdComponent(params.arg)}`,
|
|
2049
|
-
`value=${encodeCustomIdComponent(params.value)}`,
|
|
2050
|
-
`user=${encodeCustomIdComponent(params.userId)}`
|
|
2051
|
-
].join(";");
|
|
2052
|
-
}
|
|
2053
|
-
function parseDiscordCommandArgData(data) {
|
|
2054
|
-
if (!data || typeof data !== "object") return null;
|
|
2055
|
-
const coerce = (value) => typeof value === "string" || typeof value === "number" ? String(value) : "";
|
|
2056
|
-
const rawCommand = coerce(data.command);
|
|
2057
|
-
const rawArg = coerce(data.arg);
|
|
2058
|
-
const rawValue = coerce(data.value);
|
|
2059
|
-
const rawUser = coerce(data.user);
|
|
2060
|
-
if (!rawCommand || !rawArg || !rawValue || !rawUser) return null;
|
|
2061
|
-
return {
|
|
2062
|
-
command: decodeCustomIdComponent(rawCommand),
|
|
2063
|
-
arg: decodeCustomIdComponent(rawArg),
|
|
2064
|
-
value: decodeCustomIdComponent(rawValue),
|
|
2065
|
-
userId: decodeCustomIdComponent(rawUser)
|
|
2066
|
-
};
|
|
2067
|
-
}
|
|
2068
|
-
async function handleDiscordCommandArgInteraction(params) {
|
|
2069
|
-
const { interaction, data, ctx } = params;
|
|
2070
|
-
const clearWithMessage = async (content) => await params.safeInteractionCall("command arg update", () => interaction.update({
|
|
2071
|
-
content,
|
|
2072
|
-
components: []
|
|
2073
|
-
}));
|
|
2074
|
-
const parsed = parseDiscordCommandArgData(data);
|
|
2075
|
-
if (!parsed) {
|
|
2076
|
-
await clearWithMessage("Sorry, that selection is no longer available.");
|
|
2077
|
-
return;
|
|
2078
|
-
}
|
|
2079
|
-
if (interaction.user?.id && interaction.user.id !== parsed.userId) {
|
|
2080
|
-
await params.safeInteractionCall("command arg ack", () => interaction.acknowledge());
|
|
2081
|
-
return;
|
|
2082
|
-
}
|
|
2083
|
-
const commandDefinition = findCommandByNativeName(parsed.command, "discord") ?? listChatCommands().find((entry) => entry.key === parsed.command);
|
|
2084
|
-
if (!commandDefinition) {
|
|
2085
|
-
await clearWithMessage("Sorry, that command is no longer available.");
|
|
2086
|
-
return;
|
|
2087
|
-
}
|
|
2088
|
-
if (await clearWithMessage(`⏳ Applying ${parsed.value}...`) === null) return;
|
|
2089
|
-
const commandArgs = createCommandArgsWithValue({
|
|
2090
|
-
argName: parsed.arg,
|
|
2091
|
-
value: parsed.value
|
|
2092
|
-
});
|
|
2093
|
-
const commandArgsWithRaw = {
|
|
2094
|
-
...commandArgs,
|
|
2095
|
-
raw: serializeCommandArgs(commandDefinition, commandArgs)
|
|
2096
|
-
};
|
|
2097
|
-
const prompt = buildCommandTextFromArgs(commandDefinition, commandArgsWithRaw);
|
|
2098
|
-
await params.dispatchCommandInteraction({
|
|
2099
|
-
interaction,
|
|
2100
|
-
prompt,
|
|
2101
|
-
command: commandDefinition,
|
|
2102
|
-
commandArgs: commandArgsWithRaw,
|
|
2103
|
-
cfg: ctx.cfg,
|
|
2104
|
-
discordConfig: ctx.discordConfig,
|
|
2105
|
-
accountId: ctx.accountId,
|
|
2106
|
-
sessionPrefix: ctx.sessionPrefix,
|
|
2107
|
-
preferFollowUp: true,
|
|
2108
|
-
threadBindings: ctx.threadBindings,
|
|
2109
|
-
responseEphemeral: resolveDiscordSlashCommandConfig(ctx.discordConfig?.slashCommand).ephemeral,
|
|
2110
|
-
pluginCommandDispatch: { kind: "non-plugin" }
|
|
2111
|
-
});
|
|
2112
|
-
}
|
|
2113
|
-
async function runDiscordCommandArgButton(params) {
|
|
2114
|
-
await handleDiscordCommandArgInteraction(params);
|
|
2115
|
-
}
|
|
2116
|
-
var DiscordCommandArgButton = class extends Button {
|
|
2117
|
-
constructor(params) {
|
|
2118
|
-
super();
|
|
2119
|
-
this.style = ButtonStyle.Secondary;
|
|
2120
|
-
this.label = params.label;
|
|
2121
|
-
this.customId = params.customId;
|
|
2122
|
-
this.params = params;
|
|
2123
|
-
}
|
|
2124
|
-
async run(interaction, data) {
|
|
2125
|
-
await runDiscordCommandArgButton({
|
|
2126
|
-
...this.params,
|
|
2127
|
-
interaction,
|
|
2128
|
-
data
|
|
2129
|
-
});
|
|
2130
|
-
}
|
|
2131
|
-
};
|
|
2132
|
-
function buildDiscordCommandArgMenu(params) {
|
|
2133
|
-
const { command, menu, interaction } = params;
|
|
2134
|
-
const commandLabel = command.nativeName ?? command.key;
|
|
2135
|
-
const userId = interaction.user?.id ?? "";
|
|
2136
|
-
const rows = chunkItems(menu.choices, 4).map((choices) => {
|
|
2137
|
-
return new Row(choices.map((choice) => new DiscordCommandArgButton({
|
|
2138
|
-
label: choice.label,
|
|
2139
|
-
customId: buildDiscordCommandArgCustomId({
|
|
2140
|
-
command: commandLabel,
|
|
2141
|
-
arg: menu.arg.name,
|
|
2142
|
-
value: choice.value,
|
|
2143
|
-
userId
|
|
2144
|
-
}),
|
|
2145
|
-
ctx: params.ctx,
|
|
2146
|
-
safeInteractionCall: params.safeInteractionCall,
|
|
2147
|
-
dispatchCommandInteraction: params.dispatchCommandInteraction
|
|
2148
|
-
})));
|
|
2149
|
-
});
|
|
2150
|
-
return {
|
|
2151
|
-
content: formatCommandArgMenuTitle({
|
|
2152
|
-
command,
|
|
2153
|
-
menu
|
|
2154
|
-
}),
|
|
2155
|
-
components: rows
|
|
2156
|
-
};
|
|
2157
|
-
}
|
|
2158
|
-
var DiscordCommandArgFallbackButton = class extends Button {
|
|
2159
|
-
constructor(params) {
|
|
2160
|
-
super();
|
|
2161
|
-
this.params = params;
|
|
2162
|
-
this.label = "cmdarg";
|
|
2163
|
-
this.customId = "cmdarg:seed=1";
|
|
2164
|
-
}
|
|
2165
|
-
async run(interaction, data) {
|
|
2166
|
-
await runDiscordCommandArgButton({
|
|
2167
|
-
...this.params,
|
|
2168
|
-
interaction,
|
|
2169
|
-
data
|
|
2170
|
-
});
|
|
2171
|
-
}
|
|
2172
|
-
};
|
|
2173
|
-
function createDiscordCommandArgFallbackButton$1(params) {
|
|
2174
|
-
return new DiscordCommandArgFallbackButton(params);
|
|
2175
|
-
}
|
|
2176
|
-
//#endregion
|
|
2177
2108
|
//#region extensions/discord/src/monitor/model-picker-preferences.ts
|
|
2178
2109
|
const DEFAULT_RECENT_LIMIT = 5;
|
|
2179
2110
|
const PREFERENCE_MAX_ENTRIES = 2e3;
|
|
@@ -2352,8 +2283,8 @@ function paginateItems(params) {
|
|
|
2352
2283
|
};
|
|
2353
2284
|
}
|
|
2354
2285
|
async function loadDiscordModelPickerData(cfg, agentId) {
|
|
2355
|
-
const {
|
|
2356
|
-
return
|
|
2286
|
+
const { buildPreparedModelsProviderData } = await loadModelsProviderRuntime();
|
|
2287
|
+
return buildPreparedModelsProviderData(cfg, agentId);
|
|
2357
2288
|
}
|
|
2358
2289
|
function buildDiscordModelPickerCustomId(params) {
|
|
2359
2290
|
const userId = params.userId.trim();
|
|
@@ -2651,7 +2582,7 @@ function buildBucketSelectRow(params) {
|
|
|
2651
2582
|
value: bucket.id,
|
|
2652
2583
|
default: bucket.id === params.currentBucketId
|
|
2653
2584
|
}));
|
|
2654
|
-
|
|
2585
|
+
const select = createModelSelect({
|
|
2655
2586
|
customId: buildDiscordModelPickerCustomId({
|
|
2656
2587
|
command: params.command,
|
|
2657
2588
|
action: "bucket",
|
|
@@ -2666,7 +2597,8 @@ function buildBucketSelectRow(params) {
|
|
|
2666
2597
|
}),
|
|
2667
2598
|
options,
|
|
2668
2599
|
placeholder: params.view === "providers" ? "Filter providers by letter range" : "Filter models by letter range"
|
|
2669
|
-
})
|
|
2600
|
+
});
|
|
2601
|
+
return new Row([select]);
|
|
2670
2602
|
}
|
|
2671
2603
|
function getRuntimeChoices(params) {
|
|
2672
2604
|
const choices = params.data.runtimeChoicesByProvider?.get(normalizeProviderId(params.provider));
|
|
@@ -3092,7 +3024,7 @@ function formatRecentsButtonLabel(modelRef, suffix) {
|
|
|
3092
3024
|
const maxLen = 80;
|
|
3093
3025
|
const label = suffix ? `${modelRef} ${suffix}` : modelRef;
|
|
3094
3026
|
if (label.length <= maxLen) return label;
|
|
3095
|
-
return suffix ? `${sliceUtf16Safe(modelRef, 0, maxLen - suffix.length - 2)}… ${suffix}` : `${sliceUtf16Safe(modelRef, 0,
|
|
3027
|
+
return suffix ? `${sliceUtf16Safe(modelRef, 0, maxLen - suffix.length - 2)}… ${suffix}` : `${sliceUtf16Safe(modelRef, 0, 79)}…`;
|
|
3096
3028
|
}
|
|
3097
3029
|
function createModelRefToken(modelRef) {
|
|
3098
3030
|
const parsed = parseCurrentModelRef(modelRef);
|
|
@@ -3170,6 +3102,7 @@ async function applyDiscordModelPickerSelection(params) {
|
|
|
3170
3102
|
preferFollowUp: true,
|
|
3171
3103
|
threadBindings: params.threadBindings,
|
|
3172
3104
|
suppressReplies: true,
|
|
3105
|
+
dispatchReplyFromConfig: params.dispatchReplyFromConfig,
|
|
3173
3106
|
pluginCommandDispatch: { kind: "non-plugin" }
|
|
3174
3107
|
}), 12e3);
|
|
3175
3108
|
if (!dispatchResult.accepted) return {
|
|
@@ -3332,12 +3265,13 @@ function resolveDiscordModelPickerCurrentModel(params) {
|
|
|
3332
3265
|
const fallback = `${params.data.resolvedDefault.provider}/${params.data.resolvedDefault.model}`;
|
|
3333
3266
|
try {
|
|
3334
3267
|
const storePath = resolveStorePath(params.cfg.session?.store, { agentId: params.route.agentId });
|
|
3268
|
+
const sessionEntry = getSessionEntry({
|
|
3269
|
+
storePath,
|
|
3270
|
+
sessionKey: params.route.sessionKey,
|
|
3271
|
+
readConsistency: "latest"
|
|
3272
|
+
});
|
|
3335
3273
|
const override = resolveStoredModelOverride({
|
|
3336
|
-
sessionEntry
|
|
3337
|
-
storePath,
|
|
3338
|
-
sessionKey: params.route.sessionKey,
|
|
3339
|
-
readConsistency: "latest"
|
|
3340
|
-
}),
|
|
3274
|
+
sessionEntry,
|
|
3341
3275
|
loadSessionEntry: (sessionKey) => getSessionEntry({
|
|
3342
3276
|
storePath,
|
|
3343
3277
|
sessionKey,
|
|
@@ -3356,8 +3290,9 @@ function resolveDiscordModelPickerCurrentModel(params) {
|
|
|
3356
3290
|
}
|
|
3357
3291
|
function resolveDiscordModelPickerCurrentRuntime(params) {
|
|
3358
3292
|
try {
|
|
3293
|
+
const storePath = resolveStorePath(params.cfg.session?.store, { agentId: params.route.agentId });
|
|
3359
3294
|
const sessionRuntime = normalizeOptionalString(getSessionEntry({
|
|
3360
|
-
storePath
|
|
3295
|
+
storePath,
|
|
3361
3296
|
sessionKey: params.route.sessionKey,
|
|
3362
3297
|
readConsistency: "latest"
|
|
3363
3298
|
})?.agentRuntimeOverride);
|
|
@@ -3827,6 +3762,7 @@ async function handleDiscordModelPickerInteraction(params) {
|
|
|
3827
3762
|
accountId: ctx.accountId,
|
|
3828
3763
|
sessionPrefix: ctx.sessionPrefix,
|
|
3829
3764
|
threadBindings: ctx.threadBindings,
|
|
3765
|
+
dispatchReplyFromConfig: ctx.dispatchReplyFromConfig,
|
|
3830
3766
|
route,
|
|
3831
3767
|
resolvedModelRef,
|
|
3832
3768
|
selectedRuntime,
|
|
@@ -3890,6 +3826,46 @@ function createDiscordModelPickerFallbackSelect$1(params) {
|
|
|
3890
3826
|
return new DiscordModelPickerFallbackSelect(params);
|
|
3891
3827
|
}
|
|
3892
3828
|
//#endregion
|
|
3829
|
+
//#region extensions/discord/src/monitor/native-command-status.ts
|
|
3830
|
+
async function maybeDeliverDiscordDirectStatus(params) {
|
|
3831
|
+
if (params.suppressReplies || params.commandName !== "status") return null;
|
|
3832
|
+
const statusReply = await params.resolveDirectStatusReplyForSession({
|
|
3833
|
+
cfg: params.cfg,
|
|
3834
|
+
sessionKey: params.commandTargetSessionKey?.trim() || params.sessionKey,
|
|
3835
|
+
channel: params.channel,
|
|
3836
|
+
senderId: params.senderId,
|
|
3837
|
+
senderIsOwner: params.senderIsOwner,
|
|
3838
|
+
isAuthorizedSender: params.isAuthorizedSender,
|
|
3839
|
+
isGroup: params.isGroup,
|
|
3840
|
+
defaultGroupActivation: params.defaultGroupActivation
|
|
3841
|
+
});
|
|
3842
|
+
if (statusReply && hasRenderableReplyPayload(statusReply)) {
|
|
3843
|
+
await deliverDiscordInteractionReply({
|
|
3844
|
+
interaction: params.interaction,
|
|
3845
|
+
payload: statusReply,
|
|
3846
|
+
mediaLocalRoots: params.mediaLocalRoots,
|
|
3847
|
+
textLimit: resolveTextChunkLimit(params.cfg, "discord", params.accountId, { fallbackLimit: 2e3 }),
|
|
3848
|
+
maxLinesPerMessage: resolveDiscordMaxLinesPerMessage({
|
|
3849
|
+
cfg: params.cfg,
|
|
3850
|
+
discordConfig: params.discordConfig,
|
|
3851
|
+
accountId: params.accountId
|
|
3852
|
+
}),
|
|
3853
|
+
preferFollowUp: params.preferFollowUp,
|
|
3854
|
+
responseEphemeral: params.responseEphemeral,
|
|
3855
|
+
chunkMode: resolveChunkMode(params.cfg, "discord", params.accountId)
|
|
3856
|
+
});
|
|
3857
|
+
return {
|
|
3858
|
+
accepted: true,
|
|
3859
|
+
effectiveRoute: params.effectiveRoute
|
|
3860
|
+
};
|
|
3861
|
+
}
|
|
3862
|
+
await params.respond("Status unavailable.");
|
|
3863
|
+
return {
|
|
3864
|
+
accepted: true,
|
|
3865
|
+
effectiveRoute: params.effectiveRoute
|
|
3866
|
+
};
|
|
3867
|
+
}
|
|
3868
|
+
//#endregion
|
|
3893
3869
|
//#region extensions/discord/src/monitor/native-command.args.ts
|
|
3894
3870
|
function readDiscordCommandArgs(interaction, definitions) {
|
|
3895
3871
|
if (!definitions || definitions.length === 0) return;
|
|
@@ -3972,7 +3948,8 @@ function buildDiscordCommandOptions(params) {
|
|
|
3972
3948
|
await interaction.respond([]);
|
|
3973
3949
|
return;
|
|
3974
3950
|
}
|
|
3975
|
-
const
|
|
3951
|
+
const focused = interaction.options.getFocused();
|
|
3952
|
+
const focusValue = normalizeLowercaseStringOrEmpty(focused?.value);
|
|
3976
3953
|
const context = typeof arg.choices === "function" && resolveChoiceContext ? await resolveChoiceContext(interaction) : null;
|
|
3977
3954
|
const currentCfg = resolveConfig?.() ?? cfg;
|
|
3978
3955
|
const choiceCatalog = command.key === "think" ? getPreparedModelCatalogSnapshot({
|
|
@@ -4019,7 +3996,7 @@ function buildDiscordCommandOptions(params) {
|
|
|
4019
3996
|
const log = createSubsystemLogger("discord/native-command");
|
|
4020
3997
|
const NON_PLUGIN_COMMAND_DISPATCH = Object.freeze({ kind: "non-plugin" });
|
|
4021
3998
|
function createDiscordNativeCommand(params) {
|
|
4022
|
-
const { command, cfg, discordConfig, accountId, sessionPrefix, ephemeralDefault, threadBindings } = params;
|
|
3999
|
+
const { command, cfg, discordConfig, accountId, sessionPrefix, ephemeralDefault, threadBindings, dispatchReplyFromConfig } = params;
|
|
4023
4000
|
const fallbackCommandDefinition = createNativeCommandDefinition(command);
|
|
4024
4001
|
const pluginCommandCandidate = "prepareDispatch" in command ? command : void 0;
|
|
4025
4002
|
const commandDefinition = pluginCommandCandidate ? fallbackCommandDefinition : findCommandByNativeName$1(command.name, "discord", { includeBundledChannelFallback: false }) ?? fallbackCommandDefinition;
|
|
@@ -4086,13 +4063,14 @@ function createDiscordNativeCommand(params) {
|
|
|
4086
4063
|
preferFollowUp: true,
|
|
4087
4064
|
threadBindings,
|
|
4088
4065
|
responseEphemeral: ephemeralDefault,
|
|
4066
|
+
dispatchReplyFromConfig,
|
|
4089
4067
|
pluginCommandDispatch: preparedPluginCommand ?? NON_PLUGIN_COMMAND_DISPATCH
|
|
4090
4068
|
});
|
|
4091
4069
|
}
|
|
4092
4070
|
}();
|
|
4093
4071
|
}
|
|
4094
4072
|
async function dispatchDiscordCommandInteraction(params) {
|
|
4095
|
-
const { interaction, prompt, command, commandArgs, cfg: inputConfig, discordConfig, accountId, sessionPrefix, preferFollowUp, threadBindings, responseEphemeral, suppressReplies } = params;
|
|
4073
|
+
const { interaction, prompt, command, commandArgs, cfg: inputConfig, discordConfig, accountId, sessionPrefix, preferFollowUp, threadBindings, responseEphemeral, suppressReplies, dispatchReplyFromConfig } = params;
|
|
4096
4074
|
const cfg = getRuntimeConfigSnapshot() ?? inputConfig;
|
|
4097
4075
|
const commandName = command.nativeName ?? command.key;
|
|
4098
4076
|
const respond = async (content, options) => {
|
|
@@ -4330,7 +4308,8 @@ async function dispatchDiscordCommandInteraction(params) {
|
|
|
4330
4308
|
discordConfig,
|
|
4331
4309
|
accountId,
|
|
4332
4310
|
sessionPrefix,
|
|
4333
|
-
threadBindings
|
|
4311
|
+
threadBindings,
|
|
4312
|
+
dispatchReplyFromConfig
|
|
4334
4313
|
},
|
|
4335
4314
|
safeInteractionCall: safeDiscordInteractionCall,
|
|
4336
4315
|
dispatchCommandInteraction: dispatchDiscordCommandInteraction
|
|
@@ -4517,6 +4496,7 @@ async function dispatchDiscordCommandInteraction(params) {
|
|
|
4517
4496
|
preferFollowUp,
|
|
4518
4497
|
responseEphemeral,
|
|
4519
4498
|
suppressReplies,
|
|
4499
|
+
dispatchReplyFromConfig,
|
|
4520
4500
|
log,
|
|
4521
4501
|
pluginCommandDispatch: params.pluginCommandDispatch
|
|
4522
4502
|
});
|
|
@@ -4851,7 +4831,10 @@ const GatewayIntents = GatewayIntentBits;
|
|
|
4851
4831
|
const READY_STATE_OPEN = 1;
|
|
4852
4832
|
const DEFAULT_GATEWAY_URL = "wss://gateway.discord.gg/";
|
|
4853
4833
|
const DISCORD_GATEWAY_PAYLOAD_LIMIT_BYTES = 4096;
|
|
4854
|
-
const DISCORD_GATEWAY_WS_CLIENT_OPTIONS = Object.freeze({
|
|
4834
|
+
const DISCORD_GATEWAY_WS_CLIENT_OPTIONS = Object.freeze({
|
|
4835
|
+
maxPayload: 16777216,
|
|
4836
|
+
handshakeTimeout: 3e4
|
|
4837
|
+
});
|
|
4855
4838
|
const INVALID_SESSION_MIN_DELAY_MS = 1e3;
|
|
4856
4839
|
const INVALID_SESSION_JITTER_MS = 4e3;
|
|
4857
4840
|
const RESUME_FAILURE_THRESHOLD = 3;
|
|
@@ -4891,6 +4874,9 @@ var GatewayPlugin = class extends Plugin {
|
|
|
4891
4874
|
listVoiceChannelStates(guildId, channelId) {
|
|
4892
4875
|
return this.voiceStateCache.listVoiceChannelStates(guildId, channelId);
|
|
4893
4876
|
}
|
|
4877
|
+
async fetchGuildEmojis(guildId, fetcher) {
|
|
4878
|
+
return this.client ? await this.client.fetchGuildEmojis(guildId, fetcher) : await fetcher();
|
|
4879
|
+
}
|
|
4894
4880
|
takeVoiceStateTransition(state) {
|
|
4895
4881
|
return this.voiceStateCache.takeTransition(state);
|
|
4896
4882
|
}
|
|
@@ -5031,12 +5017,10 @@ var GatewayPlugin = class extends Plugin {
|
|
|
5031
5017
|
minDelayMs: INVALID_SESSION_MIN_DELAY_MS + Math.floor(Math.random() * INVALID_SESSION_JITTER_MS)
|
|
5032
5018
|
});
|
|
5033
5019
|
break;
|
|
5034
|
-
case GatewayOpcodes.Reconnect:
|
|
5035
|
-
|
|
5036
|
-
|
|
5037
|
-
|
|
5038
|
-
});
|
|
5039
|
-
break;
|
|
5020
|
+
case GatewayOpcodes.Reconnect: this.scheduleReconnect({
|
|
5021
|
+
reason: "reconnect-opcode",
|
|
5022
|
+
preferResume: true
|
|
5023
|
+
});
|
|
5040
5024
|
}
|
|
5041
5025
|
}
|
|
5042
5026
|
startHeartbeat(intervalMs) {
|
|
@@ -5478,7 +5462,7 @@ const DEFAULT_DISCORD_GATEWAY_URL = "wss://gateway.discord.gg/";
|
|
|
5478
5462
|
const DEFAULT_DISCORD_GATEWAY_INFO_TIMEOUT_MS = 3e4;
|
|
5479
5463
|
const MAX_DISCORD_GATEWAY_INFO_TIMEOUT_MS = 12e4;
|
|
5480
5464
|
const DISCORD_GATEWAY_INFO_TIMEOUT_ENV = "OPENCLAW_DISCORD_GATEWAY_INFO_TIMEOUT_MS";
|
|
5481
|
-
const DISCORD_GATEWAY_METADATA_MAX_BYTES =
|
|
5465
|
+
const DISCORD_GATEWAY_METADATA_MAX_BYTES = 4194304;
|
|
5482
5466
|
const DISCORD_GATEWAY_METADATA_FALLBACK_LOG_INTERVAL_MS = 6e4;
|
|
5483
5467
|
const discordGatewayBotInfoSchema = Type.Object({
|
|
5484
5468
|
url: Type.String({ minLength: 1 }),
|
|
@@ -5673,7 +5657,6 @@ async function fetchDiscordGatewayMetadataGuarded(input, init, options) {
|
|
|
5673
5657
|
}
|
|
5674
5658
|
//#endregion
|
|
5675
5659
|
//#region extensions/discord/src/monitor/gateway-plugin.ts
|
|
5676
|
-
const DISCORD_GATEWAY_HANDSHAKE_TIMEOUT_MS = 3e4;
|
|
5677
5660
|
const DISCORD_GATEWAY_POLICY_VIOLATION_CLOSE_CODE = 1008;
|
|
5678
5661
|
const DISCORD_GATEWAY_WS_RECEIVER_LIMIT_CODE = "WS_ERR_TOO_MANY_BUFFERED_PARTS";
|
|
5679
5662
|
const DISCORD_GATEWAY_CLOSE_REASON_LOG_MAX_CHARS = 240;
|
|
@@ -5741,7 +5724,7 @@ function resolveDiscordGatewayIntents(params) {
|
|
|
5741
5724
|
const intentsConfig = params?.intentsConfig;
|
|
5742
5725
|
const voiceEnabled = params?.voiceEnabled;
|
|
5743
5726
|
const voiceStatesEnabled = intentsConfig?.voiceStates ?? voiceEnabled ?? false;
|
|
5744
|
-
let intents = GatewayIntents.Guilds | GatewayIntents.GuildMessages | GatewayIntents.DirectMessages | GatewayIntents.GuildMessageReactions | GatewayIntents.DirectMessageReactions;
|
|
5727
|
+
let intents = GatewayIntents.Guilds | GatewayIntents.GuildExpressions | GatewayIntents.GuildMessages | GatewayIntents.DirectMessages | GatewayIntents.GuildMessageReactions | GatewayIntents.DirectMessageReactions;
|
|
5745
5728
|
if (intentsConfig?.messageContent !== false) intents |= GatewayIntents.MessageContent;
|
|
5746
5729
|
if (voiceStatesEnabled) intents |= GatewayIntents.GuildVoiceStates;
|
|
5747
5730
|
if (intentsConfig?.presence) intents |= GatewayIntents.GuildPresences;
|
|
@@ -5790,7 +5773,6 @@ function createGatewayPlugin(params) {
|
|
|
5790
5773
|
const wsFlowId = randomUUID();
|
|
5791
5774
|
const socket = new ((params.testing?.webSocketCtor) ?? ws.default)(url, {
|
|
5792
5775
|
...DISCORD_GATEWAY_WS_CLIENT_OPTIONS,
|
|
5793
|
-
handshakeTimeout: DISCORD_GATEWAY_HANDSHAKE_TIMEOUT_MS,
|
|
5794
5776
|
...params.wsAgent ? { agent: params.wsAgent } : {}
|
|
5795
5777
|
});
|
|
5796
5778
|
let lastTransportError;
|
|
@@ -6518,7 +6500,7 @@ async function runDiscordGatewayLifecycle(params) {
|
|
|
6518
6500
|
gatewayEmitter?.removeListener(DISCORD_GATEWAY_TRANSPORT_ACTIVITY_EVENT, onGatewayTransportActivity);
|
|
6519
6501
|
if (params.voiceManager) {
|
|
6520
6502
|
await params.voiceManager.destroy();
|
|
6521
|
-
const { setDiscordTranscriptsVoiceManager } = await import("./transcripts-source-
|
|
6503
|
+
const { setDiscordTranscriptsVoiceManager } = await import("./transcripts-source-DkUhR7YK.js").then((n) => n.n);
|
|
6522
6504
|
setDiscordTranscriptsVoiceManager({
|
|
6523
6505
|
accountId: params.accountId,
|
|
6524
6506
|
manager: null
|
|
@@ -6533,7 +6515,7 @@ async function runDiscordGatewayLifecycle(params) {
|
|
|
6533
6515
|
let discordVoiceRuntimePromise;
|
|
6534
6516
|
let discordProviderSessionRuntimePromise;
|
|
6535
6517
|
async function loadDiscordVoiceRuntime() {
|
|
6536
|
-
const promise = discordVoiceRuntimePromise ?? import("./voice-runtime-
|
|
6518
|
+
const promise = discordVoiceRuntimePromise ?? import("./voice-runtime-COyYYTDD.js").then((n) => n.t);
|
|
6537
6519
|
discordVoiceRuntimePromise = promise;
|
|
6538
6520
|
try {
|
|
6539
6521
|
return await promise;
|
|
@@ -6543,7 +6525,7 @@ async function loadDiscordVoiceRuntime() {
|
|
|
6543
6525
|
}
|
|
6544
6526
|
}
|
|
6545
6527
|
async function loadDiscordProviderSessionRuntime() {
|
|
6546
|
-
const promise = discordProviderSessionRuntimePromise ?? import("./provider-session.runtime-
|
|
6528
|
+
const promise = discordProviderSessionRuntimePromise ?? import("./provider-session.runtime-DdKRMcE9.js");
|
|
6547
6529
|
discordProviderSessionRuntimePromise = promise;
|
|
6548
6530
|
try {
|
|
6549
6531
|
return await promise;
|
|
@@ -6570,11 +6552,15 @@ const discordProviderRuntime = {
|
|
|
6570
6552
|
//#endregion
|
|
6571
6553
|
//#region extensions/discord/src/monitor/provider.acp.ts
|
|
6572
6554
|
const DISCORD_ACP_STATUS_PROBE_TIMEOUT_MS = 8e3;
|
|
6573
|
-
const DISCORD_ACP_STALE_RUNNING_ACTIVITY_MS =
|
|
6555
|
+
const DISCORD_ACP_STALE_RUNNING_ACTIVITY_MS = 12e4;
|
|
6574
6556
|
function isLegacyMissingSessionError(message) {
|
|
6575
6557
|
return message.includes("Session is not ACP-enabled") || message.includes("ACP session metadata missing");
|
|
6576
6558
|
}
|
|
6577
6559
|
function classifyAcpStatusProbeError(params) {
|
|
6560
|
+
if (params.isAcpRuntimeError(params.error) && ["SESSION_OWNER_MIGRATION_REQUIRED", "SESSION_OWNER_UNSUPPORTED"].includes(params.error.detailCode ?? "")) return {
|
|
6561
|
+
status: "uncertain",
|
|
6562
|
+
reason: formatErrorMessage$1(params.error)
|
|
6563
|
+
};
|
|
6578
6564
|
if (params.isAcpRuntimeError(params.error) && params.error.code === "ACP_SESSION_INIT_FAILED") return {
|
|
6579
6565
|
status: "stale",
|
|
6580
6566
|
reason: "session-init-failed"
|
|
@@ -6602,18 +6588,20 @@ async function probeDiscordAcpBindingHealth(params) {
|
|
|
6602
6588
|
const { getAcpSessionManager, isAcpRuntimeError } = params.providerSessionRuntime;
|
|
6603
6589
|
const manager = getAcpSessionManager();
|
|
6604
6590
|
const statusProbeAbortController = new AbortController();
|
|
6591
|
+
const statusPromise = manager.getSessionStatus({
|
|
6592
|
+
cfg: params.cfg,
|
|
6593
|
+
sessionKey: params.sessionKey,
|
|
6594
|
+
agentId: params.agentId,
|
|
6595
|
+
signal: statusProbeAbortController.signal
|
|
6596
|
+
}).then((status) => ({
|
|
6597
|
+
kind: "status",
|
|
6598
|
+
status
|
|
6599
|
+
})).catch((error) => ({
|
|
6600
|
+
kind: "error",
|
|
6601
|
+
error
|
|
6602
|
+
}));
|
|
6605
6603
|
const result = await raceWithTimeout({
|
|
6606
|
-
promise:
|
|
6607
|
-
cfg: params.cfg,
|
|
6608
|
-
sessionKey: params.sessionKey,
|
|
6609
|
-
signal: statusProbeAbortController.signal
|
|
6610
|
-
}).then((status) => ({
|
|
6611
|
-
kind: "status",
|
|
6612
|
-
status
|
|
6613
|
-
})).catch((error) => ({
|
|
6614
|
-
kind: "error",
|
|
6615
|
-
error
|
|
6616
|
-
})),
|
|
6604
|
+
promise: statusPromise,
|
|
6617
6605
|
timeoutMs: DISCORD_ACP_STATUS_PROBE_TIMEOUT_MS,
|
|
6618
6606
|
onTimeout: () => ({ kind: "timeout" })
|
|
6619
6607
|
});
|
|
@@ -6784,7 +6772,8 @@ async function resolveGuildEntriesByChannelAllowlist(params) {
|
|
|
6784
6772
|
};
|
|
6785
6773
|
}
|
|
6786
6774
|
}
|
|
6787
|
-
|
|
6775
|
+
const mapping = [...mappingByTarget.values()].map((group) => formatDiscordChannelResolvedGroup(group));
|
|
6776
|
+
summarizeMapping("discord channels", mapping, unresolved, params.runtime);
|
|
6788
6777
|
return nextGuilds;
|
|
6789
6778
|
} catch (err) {
|
|
6790
6779
|
params.runtime.log?.(`discord channel resolve failed; using config entries. ${formatErrorMessage$1(err)}`);
|
|
@@ -6795,11 +6784,12 @@ async function resolveAllowFromByUserAllowlist(params) {
|
|
|
6795
6784
|
const allowEntries = normalizeStringEntries(params.allowFrom).filter((entry) => entry !== "*");
|
|
6796
6785
|
if (allowEntries.length === 0) return params.allowFrom;
|
|
6797
6786
|
try {
|
|
6798
|
-
const
|
|
6787
|
+
const resolvedUsers = await resolveDiscordUserAllowlist({
|
|
6799
6788
|
token: params.token,
|
|
6800
6789
|
entries: allowEntries,
|
|
6801
6790
|
fetcher: params.fetcher
|
|
6802
|
-
})
|
|
6791
|
+
});
|
|
6792
|
+
const { resolvedMap, mapping, unresolved } = buildAllowlistResolutionSummary(resolvedUsers, {
|
|
6803
6793
|
formatResolved: formatDiscordUserResolved,
|
|
6804
6794
|
formatUnresolved: formatDiscordUserUnresolved
|
|
6805
6795
|
});
|
|
@@ -6828,11 +6818,12 @@ async function resolveGuildEntriesByUserAllowlist(params) {
|
|
|
6828
6818
|
const userEntries = collectGuildUserEntries(params.guildEntries);
|
|
6829
6819
|
if (userEntries.size === 0) return params.guildEntries;
|
|
6830
6820
|
try {
|
|
6831
|
-
const
|
|
6821
|
+
const resolvedUsers = await resolveDiscordUserAllowlist({
|
|
6832
6822
|
token: params.token,
|
|
6833
6823
|
entries: Array.from(userEntries),
|
|
6834
6824
|
fetcher: params.fetcher
|
|
6835
|
-
})
|
|
6825
|
+
});
|
|
6826
|
+
const { resolvedMap, mapping, unresolved } = buildAllowlistResolutionSummary(resolvedUsers, {
|
|
6836
6827
|
formatResolved: formatDiscordUserResolved,
|
|
6837
6828
|
formatUnresolved: formatDiscordUserUnresolved
|
|
6838
6829
|
});
|
|
@@ -7207,7 +7198,7 @@ function logDiscordResolvedConfig(params) {
|
|
|
7207
7198
|
limit: 4,
|
|
7208
7199
|
emptyText: "any"
|
|
7209
7200
|
});
|
|
7210
|
-
logVerbose(`discord: config dm=${params.dmEnabled ? "on" : "off"} dmPolicy=${params.dmPolicy} allowFrom=${allowFromSummary} groupDm=${params.groupDmEnabled ? "on" : "off"} groupDmChannels=${groupDmChannelSummary} groupPolicy=${params.groupPolicy} guilds=${guildSummary} historyLimit=${params.historyLimit} mediaMaxMb=${Math.round(params.mediaMaxBytes /
|
|
7201
|
+
logVerbose(`discord: config dm=${params.dmEnabled ? "on" : "off"} dmPolicy=${params.dmPolicy} allowFrom=${allowFromSummary} groupDm=${params.groupDmEnabled ? "on" : "off"} groupDmChannels=${groupDmChannelSummary} groupPolicy=${params.groupPolicy} guilds=${guildSummary} historyLimit=${params.historyLimit} mediaMaxMb=${Math.round(params.mediaMaxBytes / 1048576)} native=${params.nativeEnabled ? "on" : "off"} nativeSkills=${params.nativeSkillsEnabled ? "on" : "off"} accessGroups=${params.useAccessGroups ? "on" : "off"} threadBindings=${params.threadBindingsEnabled ? "on" : "off"} threadIdleTimeout=${formatThreadBindingDurationForConfigLabel(params.threadBindingIdleTimeoutMs)} threadMaxAge=${formatThreadBindingDurationForConfigLabel(params.threadBindingMaxAgeMs)}`);
|
|
7211
7202
|
}
|
|
7212
7203
|
//#endregion
|
|
7213
7204
|
//#region extensions/discord/src/monitor/provider.deploy-errors.ts
|
|
@@ -7591,9 +7582,6 @@ function formatUsername(user) {
|
|
|
7591
7582
|
if (user.discriminator && user.discriminator !== "0") return `${user.username}#${user.discriminator}`;
|
|
7592
7583
|
return user.username;
|
|
7593
7584
|
}
|
|
7594
|
-
function isThreadChannelType(channelType) {
|
|
7595
|
-
return channelType === ChannelType.PublicThread || channelType === ChannelType.PrivateThread || channelType === ChannelType.AnnouncementThread;
|
|
7596
|
-
}
|
|
7597
7585
|
function resolveAgentComponentRoute(params) {
|
|
7598
7586
|
return resolveAgentRoute({
|
|
7599
7587
|
cfg: params.ctx.cfg,
|
|
@@ -7636,7 +7624,7 @@ function resolveDiscordChannelContext(interaction) {
|
|
|
7636
7624
|
const channelSlug = channelName ? normalizeDiscordSlug(channelName) : "";
|
|
7637
7625
|
const displayChannelSlug = channelName ? normalizeDiscordDisplaySlug(channelName) : "";
|
|
7638
7626
|
const channelType = channelInfo.type;
|
|
7639
|
-
const isThread =
|
|
7627
|
+
const isThread = isDiscordThreadChannelType(channelType);
|
|
7640
7628
|
let parentId;
|
|
7641
7629
|
let parentName;
|
|
7642
7630
|
let parentSlug = "";
|
|
@@ -8198,7 +8186,9 @@ function stripDiscordInternalChannelLines(text) {
|
|
|
8198
8186
|
return kept.join("\n");
|
|
8199
8187
|
}
|
|
8200
8188
|
function sanitizeDiscordFrontChannelText(text) {
|
|
8201
|
-
|
|
8189
|
+
const withoutToolCallBlocks = stripPlainTextToolCallBlocks(text, { resolveProtectedRanges: findCodeRegions });
|
|
8190
|
+
const withoutAssistantScaffolding = sanitizeAssistantVisibleText(withoutToolCallBlocks);
|
|
8191
|
+
return collapseExcessBlankLines(stripDiscordInternalChannelLines(stripPlainTextToolCallBlocks(withoutAssistantScaffolding, { resolveProtectedRanges: findCodeRegions }))).trim();
|
|
8202
8192
|
}
|
|
8203
8193
|
function sanitizeDiscordFrontChannelReplyPayloads(payloads, options = {}) {
|
|
8204
8194
|
const preserveVerboseToolProgress = options.kind === "tool";
|
|
@@ -8237,7 +8227,8 @@ function resolveBoundThreadBinding(params) {
|
|
|
8237
8227
|
}
|
|
8238
8228
|
function resolveBindingIdentity(cfg, binding) {
|
|
8239
8229
|
if (!binding) return;
|
|
8240
|
-
const
|
|
8230
|
+
const displayName = `🤖 ${binding.label?.trim() || binding.agentId}`.trim() || "🤖 agent";
|
|
8231
|
+
const identity = { name: truncateUtf16Safe(displayName, 80) };
|
|
8241
8232
|
try {
|
|
8242
8233
|
const avatar = resolveAgentAvatar(cfg, binding.agentId);
|
|
8243
8234
|
if (avatar.kind === "remote") identity.avatarUrl = avatar.url;
|
|
@@ -8311,6 +8302,8 @@ async function deliverDiscordReply(params) {
|
|
|
8311
8302
|
formatting: delivery.formatting,
|
|
8312
8303
|
threadId: delivery.threadId,
|
|
8313
8304
|
identity: delivery.identity,
|
|
8305
|
+
onPlatformSendDispatch: params.onPlatformSendDispatch,
|
|
8306
|
+
assertDirectAdapterHandoff: params.assertPlatformSendAuthorized,
|
|
8314
8307
|
deps: createDiscordDeliveryDeps({
|
|
8315
8308
|
cfg: params.cfg,
|
|
8316
8309
|
token: params.token,
|
|
@@ -8349,7 +8342,7 @@ async function deliverDiscordReply(params) {
|
|
|
8349
8342
|
//#endregion
|
|
8350
8343
|
//#region extensions/discord/src/monitor/agent-components.dispatch.ts
|
|
8351
8344
|
const loadConversationRuntime$1 = createLazyRuntimeModule(() => import("./agent-components.runtime-CEPrf2SY.js"));
|
|
8352
|
-
const loadTypingRuntime = createLazyRuntimeModule(() => import("./typing-
|
|
8345
|
+
const loadTypingRuntime = createLazyRuntimeModule(() => import("./typing-DAwJF5VT.js").then((n) => n.n));
|
|
8353
8346
|
function buildDiscordComponentConversationLabel(params) {
|
|
8354
8347
|
if (params.interactionCtx.isDirectMessage) return buildDirectLabel(params.interactionCtx.user);
|
|
8355
8348
|
if (params.interactionCtx.isGroupDm) return `Group DM #${params.channelCtx.channelName ?? params.interactionCtx.channelId} channel id:${params.interactionCtx.channelId}`;
|
|
@@ -8589,7 +8582,9 @@ async function dispatchDiscordComponentEvent(params) {
|
|
|
8589
8582
|
chunkMode: resolveChunkMode(ctx.cfg, "discord", accountId),
|
|
8590
8583
|
mediaLocalRoots,
|
|
8591
8584
|
kind: info.kind,
|
|
8592
|
-
bindPendingFinalDelivery: info.bindPendingFinalDelivery
|
|
8585
|
+
bindPendingFinalDelivery: info.bindPendingFinalDelivery,
|
|
8586
|
+
onPlatformSendDispatch: info.onPlatformSendDispatch,
|
|
8587
|
+
assertPlatformSendAuthorized: info.assertPlatformSendAuthorized
|
|
8593
8588
|
});
|
|
8594
8589
|
if (result.visibleReplySent) replyReference.markSent();
|
|
8595
8590
|
return result;
|
|
@@ -8754,7 +8749,7 @@ async function dispatchPluginDiscordInteractiveEvent(params) {
|
|
|
8754
8749
|
}
|
|
8755
8750
|
//#endregion
|
|
8756
8751
|
//#region extensions/discord/src/monitor/agent-components.handlers.ts
|
|
8757
|
-
const loadComponentsRuntime = createLazyRuntimeModule(() => import("./components-
|
|
8752
|
+
const loadComponentsRuntime = createLazyRuntimeModule(() => import("./components-gvRA0oaI.js").then((n) => n.t));
|
|
8758
8753
|
async function handleDiscordComponentEvent(params) {
|
|
8759
8754
|
const parsed = parseDiscordComponentData(params.data, resolveInteractionCustomId(params.interaction));
|
|
8760
8755
|
if (!parsed) {
|
|
@@ -8896,8 +8891,9 @@ async function handleDiscordModalTrigger(params) {
|
|
|
8896
8891
|
await replyUnavailableComponentInteraction(params.interaction, "This form has expired.");
|
|
8897
8892
|
return;
|
|
8898
8893
|
}
|
|
8894
|
+
const resolvedModalId = consumed.modalId ?? modalId;
|
|
8899
8895
|
const modalEntry = await resolveDiscordModalEntryWithPersistence({
|
|
8900
|
-
id:
|
|
8896
|
+
id: resolvedModalId,
|
|
8901
8897
|
consume: false
|
|
8902
8898
|
});
|
|
8903
8899
|
if (!modalEntry) {
|
|
@@ -9400,29 +9396,24 @@ var QuestionButton = class extends Button {
|
|
|
9400
9396
|
try {
|
|
9401
9397
|
await interaction.acknowledge();
|
|
9402
9398
|
} catch {}
|
|
9403
|
-
let
|
|
9399
|
+
let content;
|
|
9404
9400
|
try {
|
|
9405
|
-
|
|
9401
|
+
content = (await this.ctx.resolveQuestion({
|
|
9406
9402
|
cfg: this.ctx.cfg,
|
|
9407
9403
|
questionId: callback.questionId,
|
|
9408
9404
|
optionIndex: callback.optionIndex,
|
|
9409
9405
|
senderId: interaction.userId,
|
|
9410
9406
|
clientDisplayName: `Discord question (${this.ctx.accountId})`
|
|
9411
|
-
});
|
|
9407
|
+
})).status === "answered" ? "Answer submitted." : "This question was already answered.";
|
|
9412
9408
|
} catch {
|
|
9413
|
-
|
|
9414
|
-
await interaction.followUp({
|
|
9415
|
-
content: "Could not submit this answer.",
|
|
9416
|
-
ephemeral: true
|
|
9417
|
-
});
|
|
9418
|
-
} catch {}
|
|
9419
|
-
return;
|
|
9409
|
+
content = "Could not submit this answer.";
|
|
9420
9410
|
}
|
|
9421
9411
|
try {
|
|
9422
|
-
|
|
9423
|
-
content
|
|
9412
|
+
const feedback = {
|
|
9413
|
+
content,
|
|
9424
9414
|
ephemeral: true
|
|
9425
|
-
}
|
|
9415
|
+
};
|
|
9416
|
+
await (interaction.responseState === "unacknowledged" ? interaction.reply(feedback) : interaction.followUp(feedback));
|
|
9426
9417
|
} catch {}
|
|
9427
9418
|
}
|
|
9428
9419
|
};
|
|
@@ -9466,7 +9457,8 @@ function createDiscordProviderInteractionSurface(params) {
|
|
|
9466
9457
|
accountId: params.accountId,
|
|
9467
9458
|
sessionPrefix: params.sessionPrefix,
|
|
9468
9459
|
ephemeralDefault: params.ephemeralDefault,
|
|
9469
|
-
threadBindings: params.threadBindings
|
|
9460
|
+
threadBindings: params.threadBindings,
|
|
9461
|
+
dispatchReplyFromConfig: params.channelRuntime?.reply?.dispatchReplyFromConfig
|
|
9470
9462
|
});
|
|
9471
9463
|
});
|
|
9472
9464
|
const execApprovalsConfig = params.discordConfig.execApprovals ?? {};
|
|
@@ -9511,21 +9503,24 @@ function createDiscordProviderInteractionSurface(params) {
|
|
|
9511
9503
|
discordConfig: params.discordConfig,
|
|
9512
9504
|
accountId: params.accountId,
|
|
9513
9505
|
sessionPrefix: params.sessionPrefix,
|
|
9514
|
-
threadBindings: params.threadBindings
|
|
9506
|
+
threadBindings: params.threadBindings,
|
|
9507
|
+
dispatchReplyFromConfig: params.channelRuntime?.reply?.dispatchReplyFromConfig
|
|
9515
9508
|
}),
|
|
9516
9509
|
createDiscordModelPickerFallbackButton({
|
|
9517
9510
|
cfg: params.cfg,
|
|
9518
9511
|
discordConfig: params.discordConfig,
|
|
9519
9512
|
accountId: params.accountId,
|
|
9520
9513
|
sessionPrefix: params.sessionPrefix,
|
|
9521
|
-
threadBindings: params.threadBindings
|
|
9514
|
+
threadBindings: params.threadBindings,
|
|
9515
|
+
dispatchReplyFromConfig: params.channelRuntime?.reply?.dispatchReplyFromConfig
|
|
9522
9516
|
}),
|
|
9523
9517
|
createDiscordModelPickerFallbackSelect({
|
|
9524
9518
|
cfg: params.cfg,
|
|
9525
9519
|
discordConfig: params.discordConfig,
|
|
9526
9520
|
accountId: params.accountId,
|
|
9527
9521
|
sessionPrefix: params.sessionPrefix,
|
|
9528
|
-
threadBindings: params.threadBindings
|
|
9522
|
+
threadBindings: params.threadBindings,
|
|
9523
|
+
dispatchReplyFromConfig: params.channelRuntime?.reply?.dispatchReplyFromConfig
|
|
9529
9524
|
})
|
|
9530
9525
|
];
|
|
9531
9526
|
const activityButton = createDiscordActivityButton({
|
|
@@ -9605,6 +9600,170 @@ var VoicePlugin = class extends Plugin {
|
|
|
9605
9600
|
}
|
|
9606
9601
|
};
|
|
9607
9602
|
//#endregion
|
|
9603
|
+
//#region extensions/discord/src/monitor/message-handler.preflight-channel-access.ts
|
|
9604
|
+
function resolveDiscordPreflightChannelAccess(params) {
|
|
9605
|
+
if (params.isGuildMessage && params.channelConfig?.enabled === false) {
|
|
9606
|
+
logDebug(`[discord-preflight] drop: channel disabled`);
|
|
9607
|
+
logVerbose(`Blocked discord channel ${params.messageChannelId} (channel disabled, ${params.channelMatchMeta})`);
|
|
9608
|
+
return {
|
|
9609
|
+
allowed: false,
|
|
9610
|
+
channelAllowlistConfigured: false,
|
|
9611
|
+
channelAllowed: false
|
|
9612
|
+
};
|
|
9613
|
+
}
|
|
9614
|
+
const groupDmAllowed = params.isGroupDm && resolveGroupDmAllow({
|
|
9615
|
+
channels: params.groupDmChannels,
|
|
9616
|
+
channelId: params.messageChannelId,
|
|
9617
|
+
channelName: params.displayChannelName,
|
|
9618
|
+
channelSlug: params.displayChannelSlug
|
|
9619
|
+
});
|
|
9620
|
+
if (params.isGroupDm && !groupDmAllowed) return {
|
|
9621
|
+
allowed: false,
|
|
9622
|
+
channelAllowlistConfigured: false,
|
|
9623
|
+
channelAllowed: false
|
|
9624
|
+
};
|
|
9625
|
+
const channelAllowlistConfigured = Boolean(params.guildInfo?.channels) && Object.keys(params.guildInfo?.channels ?? {}).length > 0;
|
|
9626
|
+
const channelAllowed = params.channelConfig?.allowed !== false;
|
|
9627
|
+
if (params.isGuildMessage && !isDiscordGroupAllowedByPolicy({
|
|
9628
|
+
groupPolicy: params.groupPolicy,
|
|
9629
|
+
guildAllowlisted: Boolean(params.guildInfo),
|
|
9630
|
+
channelAllowlistConfigured,
|
|
9631
|
+
channelAllowed
|
|
9632
|
+
})) {
|
|
9633
|
+
if (params.groupPolicy === "disabled") {
|
|
9634
|
+
logDebug(`[discord-preflight] drop: groupPolicy disabled`);
|
|
9635
|
+
logVerbose(`discord: drop guild message (groupPolicy: disabled, ${params.channelMatchMeta})`);
|
|
9636
|
+
} else if (!channelAllowlistConfigured) {
|
|
9637
|
+
logDebug(`[discord-preflight] drop: groupPolicy allowlist, no channel allowlist configured`);
|
|
9638
|
+
logVerbose(`discord: drop guild message (groupPolicy: allowlist, no channel allowlist, ${params.channelMatchMeta})`);
|
|
9639
|
+
} else {
|
|
9640
|
+
logDebug(`[discord] Ignored message from channel ${params.messageChannelId} (not in guild allowlist). Add to guilds.<guildId>.channels to enable.`);
|
|
9641
|
+
logVerbose(`Blocked discord channel ${params.messageChannelId} not in guild channel allowlist (groupPolicy: allowlist, ${params.channelMatchMeta})`);
|
|
9642
|
+
}
|
|
9643
|
+
return {
|
|
9644
|
+
allowed: false,
|
|
9645
|
+
channelAllowlistConfigured,
|
|
9646
|
+
channelAllowed
|
|
9647
|
+
};
|
|
9648
|
+
}
|
|
9649
|
+
if (params.isGuildMessage && params.channelConfig?.allowed === false) {
|
|
9650
|
+
logDebug(`[discord-preflight] drop: channelConfig.allowed===false`);
|
|
9651
|
+
logVerbose(`Blocked discord channel ${params.messageChannelId} not in guild channel allowlist (${params.channelMatchMeta})`);
|
|
9652
|
+
return {
|
|
9653
|
+
allowed: false,
|
|
9654
|
+
channelAllowlistConfigured,
|
|
9655
|
+
channelAllowed
|
|
9656
|
+
};
|
|
9657
|
+
}
|
|
9658
|
+
if (params.isGuildMessage) {
|
|
9659
|
+
logDebug(`[discord-preflight] pass: channel allowed`);
|
|
9660
|
+
logVerbose(`discord: allow channel ${params.messageChannelId} (${params.channelMatchMeta})`);
|
|
9661
|
+
}
|
|
9662
|
+
return {
|
|
9663
|
+
allowed: true,
|
|
9664
|
+
channelAllowlistConfigured,
|
|
9665
|
+
channelAllowed
|
|
9666
|
+
};
|
|
9667
|
+
}
|
|
9668
|
+
//#endregion
|
|
9669
|
+
//#region extensions/discord/src/monitor/listeners.guild-join.ts
|
|
9670
|
+
const DISCORD_GUILD_JOIN_INTRO_MAX_AGE_MS = 3e5;
|
|
9671
|
+
var DiscordGuildJoinIntroductionListener = class extends GuildCreateListener {
|
|
9672
|
+
constructor(params) {
|
|
9673
|
+
super();
|
|
9674
|
+
this.params = params;
|
|
9675
|
+
}
|
|
9676
|
+
async handle(data, client) {
|
|
9677
|
+
if (!("joined_at" in data) || data.unavailable || !this.params.botUserId) return;
|
|
9678
|
+
const joinAgeMs = Date.now() - Date.parse(data.joined_at);
|
|
9679
|
+
if (!Number.isFinite(joinAgeMs) || joinAgeMs < 0 || joinAgeMs > DISCORD_GUILD_JOIN_INTRO_MAX_AGE_MS) return;
|
|
9680
|
+
const textChannels = data.channels.filter((channel) => channel.type === ChannelType.GuildText);
|
|
9681
|
+
const systemChannel = textChannels.find((channel) => channel.id === data.system_channel_id);
|
|
9682
|
+
const candidateChannels = systemChannel ? [systemChannel, ...textChannels.filter((channel) => channel !== systemChannel)] : textChannels;
|
|
9683
|
+
const discordOptions = {
|
|
9684
|
+
cfg: this.params.cfg,
|
|
9685
|
+
accountId: this.params.accountId,
|
|
9686
|
+
rest: client.rest
|
|
9687
|
+
};
|
|
9688
|
+
const guildInfo = resolveDiscordGuildEntry({
|
|
9689
|
+
guild: new Guild(client, data),
|
|
9690
|
+
guildId: data.id,
|
|
9691
|
+
guildEntries: this.params.guildEntries
|
|
9692
|
+
});
|
|
9693
|
+
const guildConfigured = !this.params.guildEntries || Object.keys(this.params.guildEntries).length === 0 || Boolean(guildInfo);
|
|
9694
|
+
let targetChannel;
|
|
9695
|
+
let roomAllowed = false;
|
|
9696
|
+
for (const channel of candidateChannels) if (await canViewDiscordGuildChannel(data.id, channel.id, this.params.botUserId, discordOptions) && await hasAnyChannelPermissionDiscord(data.id, channel.id, this.params.botUserId, [PermissionFlagsBits.SendMessages], discordOptions)) {
|
|
9697
|
+
targetChannel ??= channel;
|
|
9698
|
+
const channelConfig = resolveDiscordChannelConfig({
|
|
9699
|
+
guildInfo,
|
|
9700
|
+
channelId: channel.id,
|
|
9701
|
+
channelName: channel.name,
|
|
9702
|
+
channelSlug: normalizeDiscordSlug(channel.name)
|
|
9703
|
+
});
|
|
9704
|
+
roomAllowed = guildConfigured && resolveDiscordPreflightChannelAccess({
|
|
9705
|
+
isGuildMessage: true,
|
|
9706
|
+
isGroupDm: false,
|
|
9707
|
+
groupPolicy: this.params.groupPolicy,
|
|
9708
|
+
messageChannelId: channel.id,
|
|
9709
|
+
displayChannelName: channel.name,
|
|
9710
|
+
displayChannelSlug: normalizeDiscordDisplaySlug(channel.name),
|
|
9711
|
+
guildInfo,
|
|
9712
|
+
channelConfig,
|
|
9713
|
+
channelMatchMeta: `guild=${data.id} channel=${channel.id}`
|
|
9714
|
+
}).allowed;
|
|
9715
|
+
if (roomAllowed) {
|
|
9716
|
+
targetChannel = channel;
|
|
9717
|
+
break;
|
|
9718
|
+
}
|
|
9719
|
+
}
|
|
9720
|
+
if (!targetChannel) {
|
|
9721
|
+
this.params.logger?.info("Discord guild join introduction skipped: no writable text channel", {
|
|
9722
|
+
guildId: data.id,
|
|
9723
|
+
accountId: this.params.accountId
|
|
9724
|
+
});
|
|
9725
|
+
return;
|
|
9726
|
+
}
|
|
9727
|
+
const selectedChannel = targetChannel;
|
|
9728
|
+
await reportChannelRoomJoin({
|
|
9729
|
+
cfg: this.params.cfg,
|
|
9730
|
+
channel: "discord",
|
|
9731
|
+
accountId: this.params.accountId,
|
|
9732
|
+
conversationId: data.id,
|
|
9733
|
+
deliverTo: `channel:${selectedChannel.id}`,
|
|
9734
|
+
route: resolveAgentRoute({
|
|
9735
|
+
cfg: this.params.cfg,
|
|
9736
|
+
channel: "discord",
|
|
9737
|
+
accountId: this.params.accountId,
|
|
9738
|
+
guildId: data.id,
|
|
9739
|
+
peer: {
|
|
9740
|
+
kind: "channel",
|
|
9741
|
+
id: selectedChannel.id
|
|
9742
|
+
}
|
|
9743
|
+
}),
|
|
9744
|
+
roomAllowed,
|
|
9745
|
+
resolveRoomContext: async ({ messageLimit }) => {
|
|
9746
|
+
const roomContext = {
|
|
9747
|
+
title: `#${selectedChannel.name}`,
|
|
9748
|
+
purpose: selectedChannel.topic ?? void 0
|
|
9749
|
+
};
|
|
9750
|
+
try {
|
|
9751
|
+
const messages = await readMessagesDiscord(selectedChannel.id, { limit: messageLimit }, discordOptions);
|
|
9752
|
+
return {
|
|
9753
|
+
...roomContext,
|
|
9754
|
+
recentMessages: messages.toReversed().flatMap(({ author, content }) => content.trim() ? [{
|
|
9755
|
+
sender: author.global_name ?? author.username,
|
|
9756
|
+
text: content
|
|
9757
|
+
}] : [])
|
|
9758
|
+
};
|
|
9759
|
+
} catch {
|
|
9760
|
+
return roomContext;
|
|
9761
|
+
}
|
|
9762
|
+
}
|
|
9763
|
+
});
|
|
9764
|
+
}
|
|
9765
|
+
};
|
|
9766
|
+
//#endregion
|
|
9608
9767
|
//#region extensions/discord/src/monitor/provider.startup.ts
|
|
9609
9768
|
function registerLatePlugin(client, plugin) {
|
|
9610
9769
|
plugin.registerClient?.(client);
|
|
@@ -9729,6 +9888,14 @@ async function fetchDiscordBotIdentity(params) {
|
|
|
9729
9888
|
function registerDiscordMonitorListeners(params) {
|
|
9730
9889
|
registerDiscordListener(params.client.listeners, new DiscordInteractionListener(params.logger, params.trackInboundEvent));
|
|
9731
9890
|
registerDiscordListener(params.client.listeners, new DiscordMessageListener(params.messageHandler, params.logger, params.trackInboundEvent));
|
|
9891
|
+
registerDiscordListener(params.client.listeners, new DiscordGuildJoinIntroductionListener({
|
|
9892
|
+
cfg: params.cfg,
|
|
9893
|
+
accountId: params.accountId,
|
|
9894
|
+
botUserId: params.botUserId,
|
|
9895
|
+
groupPolicy: params.groupPolicy,
|
|
9896
|
+
guildEntries: params.guildEntries,
|
|
9897
|
+
logger: params.logger
|
|
9898
|
+
}));
|
|
9732
9899
|
if (shouldRegisterDiscordReactionListeners(params)) {
|
|
9733
9900
|
const reactionListenerOptions = {
|
|
9734
9901
|
cfg: params.cfg,
|
|
@@ -9862,8 +10029,9 @@ async function monitorDiscordProvider(opts = {}) {
|
|
|
9862
10029
|
});
|
|
9863
10030
|
let guildEntries = rawDiscordCfg.guilds;
|
|
9864
10031
|
const defaultGroupPolicy = resolveDefaultGroupPolicy(cfg);
|
|
10032
|
+
const providerConfigPresent = cfg.channels?.discord !== void 0;
|
|
9865
10033
|
const { groupPolicy, providerMissingFallbackApplied } = resolveOpenProviderRuntimeGroupPolicy({
|
|
9866
|
-
providerConfigPresent
|
|
10034
|
+
providerConfigPresent,
|
|
9867
10035
|
groupPolicy: rawDiscordCfg.groupPolicy,
|
|
9868
10036
|
defaultGroupPolicy
|
|
9869
10037
|
});
|
|
@@ -10010,6 +10178,7 @@ async function monitorDiscordProvider(opts = {}) {
|
|
|
10010
10178
|
const probe = await probeDiscordAcpBindingHealth({
|
|
10011
10179
|
cfg,
|
|
10012
10180
|
sessionKey,
|
|
10181
|
+
agentId: session.agentId,
|
|
10013
10182
|
storedState: session.acp?.state,
|
|
10014
10183
|
lastActivityAt: session.acp?.lastActivityAt,
|
|
10015
10184
|
providerSessionRuntime: discordProviderSessionRuntime
|
|
@@ -10123,7 +10292,7 @@ async function monitorDiscordProvider(opts = {}) {
|
|
|
10123
10292
|
runtime,
|
|
10124
10293
|
botUserId
|
|
10125
10294
|
});
|
|
10126
|
-
const { setDiscordTranscriptsVoiceManager } = await import("./transcripts-source-
|
|
10295
|
+
const { setDiscordTranscriptsVoiceManager } = await import("./transcripts-source-DkUhR7YK.js").then((n) => n.n);
|
|
10127
10296
|
setDiscordTranscriptsVoiceManager({
|
|
10128
10297
|
accountId: account.accountId,
|
|
10129
10298
|
manager: voiceManager
|
|
@@ -10229,4 +10398,4 @@ async function monitorDiscordProvider(opts = {}) {
|
|
|
10229
10398
|
}
|
|
10230
10399
|
}
|
|
10231
10400
|
//#endregion
|
|
10232
|
-
export {
|
|
10401
|
+
export { resolveDiscordTextCommandAccess as S, handleDiscordDmCommandDecision as _, formatDiscordReplySkip as a, resolveFetchedDiscordThreadLikeChannelContext as b, buildGuildLabel as c, resolveDiscordGatewayIntents as d, waitForDiscordGatewayPluginRegistration as f, createDiscordSupplementalContextAccessChecker as g, buildDiscordInboundAccessContext as h, formatDiscordReplyDeliveryFailure as i, resolveReplyContext as l, buildDiscordGroupSystemPrompt as m, resolveDiscordPreflightChannelAccess as n, sanitizeDiscordFrontChannelReplyPayloads as o, createDiscordNativeCommand as p, deliverDiscordReply as r, buildDirectLabel as s, monitorDiscordProvider as t, createDiscordGatewayPlugin as u, mapGatewayDispatchData as v, resolveDiscordDmCommandAccess as x, registerDiscordListener as y };
|