@openclaw/discord 2026.7.2-beta.1 → 2026.7.2-beta.3
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-api.js +1 -1
- package/dist/{account-inspect-DDZtT5C8.js → account-inspect-dFV0JrnR.js} +2 -2
- package/dist/{accounts-P19jm1lf.js → accounts-CMd4nzLB.js} +8 -4
- package/dist/action-runtime-api.js +1 -1
- package/dist/activities-api-DS1L7KRY.js +765 -0
- package/dist/activities-api.js +2 -0
- package/dist/{allow-list-B7qOH5xu.js → allow-list-DzKrtfah.js} +18 -7
- package/dist/{api--f62GFaS.js → api-C43z8vUm.js} +6 -4
- package/dist/api.js +27 -18
- package/dist/{approval-handler.runtime-DeyIiw5I.js → approval-handler.runtime-BbkfPoGc.js} +7 -8
- package/dist/{conversation-identity-BpkAzklg.js → approval-message-safety-DrLlgIPz.js} +49 -3
- package/dist/assets/embedded-app-sdk.mjs +1 -0
- package/dist/{audit-Df2w046a.js → audit-BC6bgPMX.js} +4 -4
- package/dist/{channel-nYmJ7FKQ.js → channel-5MfaC2IE.js} +55 -44
- package/dist/{channel-actions-ChpBSRcu.js → channel-actions-DicWTbYH.js} +5 -5
- package/dist/{channel-actions.runtime-D8V8tyCq.js → channel-actions.runtime-D9Qadn-l.js} +50 -50
- package/dist/channel-config-api.js +1 -1
- package/dist/channel-plugin-api.js +1 -1
- package/dist/{channel.setup-DyihrqHH.js → channel.setup-CJXfFclP.js} +17 -20
- package/dist/{send.receipt-aegk69an.js → chunk-CWzmeWf_.js} +312 -401
- package/dist/command-deploy-store-DFkBTViB.js +12 -0
- package/dist/{config-schema-_bUKcWRm.js → config-schema-BxrgfSMD.js} +31 -2
- package/dist/{directory-config-BUe-qq_C.js → directory-config-CmukHSms.js} +2 -2
- package/dist/directory-contract-api.js +1 -1
- package/dist/{directory-live-DZByMdPO.js → directory-live-BYlCRO__.js} +11 -9
- package/dist/{doctor-bMaWXFKu.js → doctor-Ci7USQAW.js} +4 -4
- package/dist/{handle-action.guild-admin-C_PQcBEV.js → handle-action.guild-admin-Bsk2YBPs.js} +2 -2
- package/dist/index.js +3 -1
- package/dist/legacy-state-migrations-api.js +17 -2
- package/dist/{manager.runtime-3RVMVkyx.js → manager.runtime-Cc8vS-M7.js} +191 -192
- package/dist/message-handler-CWJ-mQvH.js +590 -0
- package/dist/{message-handler.preflight-BI86IbHz.js → message-handler.preflight-DK46_qbS.js} +19 -18
- package/dist/{message-handler.process-bPS_9_tb.js → message-handler.process-BK0mjFJH.js} +88 -86
- package/dist/{message-utils-D4j07taS.js → message-utils-Cfe6CZ6N.js} +9 -7
- package/dist/{outbound-adapter-Czny0Fae.js → outbound-adapter-B2_oa-zV.js} +38 -7
- package/dist/{outbound-components-oJKLj62G.js → outbound-components-BGhk6HI3.js} +3 -3
- package/dist/{components-BVrfRS-F.js → outbound-session-route-M2bEY9tI.js} +171 -53
- package/dist/{pluralkit-UXq1OyUI.js → pluralkit-CT0VRsZd.js} +2 -2
- package/dist/{probe-DxjMBeVG.js → probe-C3SCKyYU.js} +35 -12
- package/dist/{probe.runtime-Bc8Oo6e8.js → probe.runtime-D55QqC9u.js} +1 -1
- package/dist/{provider-DWvDNb4J.js → provider-HW0G-2l6.js} +1810 -1513
- package/dist/{provider-session.runtime-D5pCGibh.js → provider-session.runtime-cCfGMsF_.js} +3 -3
- package/dist/provider.runtime-BWCRsVoT.js +2 -0
- package/dist/{resolve-allowlist-common-B9S8LLBd.js → resolve-allowlist-common-CJlqw_nC.js} +3 -3
- package/dist/{resolve-channels-BrkWOKdG.js → resolve-channels-9KcG3mLg.js} +4 -4
- package/dist/{resolve-users-OjrXXvJP.js → resolve-users-GCGf3oV0.js} +3 -3
- package/dist/retry-after-DdLPmPoa.js +12 -0
- package/dist/runtime-CD5MRZkD.js +83 -0
- package/dist/{runtime-C618lis9.js → runtime-Z2qkKakn.js} +64 -43
- package/dist/runtime-api.actions.js +2 -2
- package/dist/runtime-api.js +26 -25
- package/dist/runtime-api.lookup.js +5 -5
- package/dist/runtime-api.monitor-C3EDYJqk.js +6 -0
- package/dist/runtime-api.monitor.js +8 -8
- package/dist/runtime-api.send.js +6 -5
- package/dist/runtime-api.threads.js +6 -6
- package/dist/{secret-config-contract-BDNrRWvd.js → secret-config-contract-B1akrlyY.js} +1 -0
- package/dist/secret-contract-api.js +1 -1
- package/dist/{security-audit-Bh_65L5C.js → security-audit-DtT0SIns.js} +1 -1
- package/dist/security-audit-contract-api.js +1 -1
- package/dist/{security-audit.runtime-CpPdDNEt.js → security-audit.runtime-DEEywczv.js} +1 -1
- package/dist/security-doctor-nGgPm65L.js +5 -0
- package/dist/{send-BFpa_DHn.js → send-CSRxNNgq.js} +16 -95
- package/dist/{send.components-BaXQJKWT.js → send.components-DLqzOEPJ.js} +47 -38
- package/dist/{send.outbound-BlA6VzSE.js → send.outbound-C1SfX20w.js} +7 -6
- package/dist/send.reactions-Cj4ugX3F.js +85 -0
- package/dist/send.receipt-CuwRrpFz.js +48 -0
- package/dist/{send.shared-Xz7IMVpu.js → send.shared-Dber6X57.js} +78 -74
- package/dist/{sender-identity-C62lBe18.js → sender-identity-mG_zsdox.js} +1 -1
- package/dist/session-binding-contract-api.js +1 -1
- package/dist/setup-plugin-api.js +1 -1
- package/dist/{shared-BLYBt5SA.js → shared-BEhmAdMY.js} +9 -9
- package/dist/{subagent-hooks-DKJ4p-Oy.js → subagent-hooks-Wrk61DwY.js} +3 -3
- package/dist/subagent-hooks-api.js +10 -1
- package/dist/subagent-progress-B2fpHe3m.js +662 -0
- package/dist/{system-events-DKwfE-2z.js → system-events-AhfcKRRb.js} +2 -2
- package/dist/{target-resolver-BQyEHyeS.js → target-resolver-vqLA450R.js} +3 -3
- package/dist/targets-BjEMIe8t.js +3 -0
- package/dist/{thread-bindings-BbzjUuNB.js → thread-bindings-CJQoXuWY.js} +7 -7
- package/dist/{thread-bindings.discord-api-DJD3qwIN.js → thread-bindings.discord-api-mNCWlgvM.js} +5 -5
- package/dist/{thread-bindings.manager-BIBm6bQd.js → thread-bindings.manager-D1z8mK4b.js} +5 -5
- package/dist/{thread-bindings.session-updates-eRcJlzIU.js → thread-bindings.session-updates-DnTpkroM.js} +1 -1
- package/dist/{timeouts-ZRc9Lw4y.js → timeouts-B9cy6RvQ.js} +1 -5
- package/dist/{transcripts-source-CLZ5X8fh.js → transcripts-source-DjDbt14x.js} +1 -1
- package/dist/transcripts-source-api.js +1 -1
- package/dist/{typing-BnYT7Szq.js → typing-wxtm1NlF.js} +2 -2
- package/node_modules/@discord/embedded-app-sdk/LICENSE.md +9 -0
- package/node_modules/@discord/embedded-app-sdk/README.md +74 -0
- package/node_modules/@discord/embedded-app-sdk/output/Constants.cjs +100 -0
- package/node_modules/@discord/embedded-app-sdk/output/Constants.d.ts +88 -0
- package/node_modules/@discord/embedded-app-sdk/output/Constants.mjs +96 -0
- package/node_modules/@discord/embedded-app-sdk/output/Discord.cjs +286 -0
- package/node_modules/@discord/embedded-app-sdk/output/Discord.d.ts +603 -0
- package/node_modules/@discord/embedded-app-sdk/output/Discord.mjs +284 -0
- package/node_modules/@discord/embedded-app-sdk/output/_virtual/BigInteger.cjs +11 -0
- package/node_modules/@discord/embedded-app-sdk/output/_virtual/BigInteger.mjs +7 -0
- package/node_modules/@discord/embedded-app-sdk/output/_virtual/BigInteger2.cjs +5 -0
- package/node_modules/@discord/embedded-app-sdk/output/_virtual/BigInteger2.mjs +3 -0
- package/node_modules/@discord/embedded-app-sdk/output/_virtual/_commonjsHelpers.cjs +10 -0
- package/node_modules/@discord/embedded-app-sdk/output/_virtual/_commonjsHelpers.mjs +7 -0
- package/node_modules/@discord/embedded-app-sdk/output/_virtual/index.cjs +11 -0
- package/node_modules/@discord/embedded-app-sdk/output/_virtual/index.mjs +7 -0
- package/node_modules/@discord/embedded-app-sdk/output/_virtual/index2.cjs +11 -0
- package/node_modules/@discord/embedded-app-sdk/output/_virtual/index2.mjs +7 -0
- package/node_modules/@discord/embedded-app-sdk/output/_virtual/index3.cjs +5 -0
- package/node_modules/@discord/embedded-app-sdk/output/_virtual/index3.mjs +3 -0
- package/node_modules/@discord/embedded-app-sdk/output/_virtual/index4.cjs +5 -0
- package/node_modules/@discord/embedded-app-sdk/output/_virtual/index4.mjs +3 -0
- package/node_modules/@discord/embedded-app-sdk/output/commands/authenticate.cjs +11 -0
- package/node_modules/@discord/embedded-app-sdk/output/commands/authenticate.d.ts +25 -0
- package/node_modules/@discord/embedded-app-sdk/output/commands/authenticate.mjs +9 -0
- package/node_modules/@discord/embedded-app-sdk/output/commands/authorize.cjs +16 -0
- package/node_modules/@discord/embedded-app-sdk/output/commands/authorize.d.ts +20 -0
- package/node_modules/@discord/embedded-app-sdk/output/commands/authorize.mjs +14 -0
- package/node_modules/@discord/embedded-app-sdk/output/commands/captureLog.cjs +12 -0
- package/node_modules/@discord/embedded-app-sdk/output/commands/captureLog.d.ts +10 -0
- package/node_modules/@discord/embedded-app-sdk/output/commands/captureLog.mjs +10 -0
- package/node_modules/@discord/embedded-app-sdk/output/commands/encourageHardwareAcceleration.cjs +12 -0
- package/node_modules/@discord/embedded-app-sdk/output/commands/encourageHardwareAcceleration.d.ts +7 -0
- package/node_modules/@discord/embedded-app-sdk/output/commands/encourageHardwareAcceleration.mjs +10 -0
- package/node_modules/@discord/embedded-app-sdk/output/commands/getActivityInstanceConnectedParticipants.cjs +8 -0
- package/node_modules/@discord/embedded-app-sdk/output/commands/getActivityInstanceConnectedParticipants.d.ts +18 -0
- package/node_modules/@discord/embedded-app-sdk/output/commands/getActivityInstanceConnectedParticipants.mjs +6 -0
- package/node_modules/@discord/embedded-app-sdk/output/commands/getChannel.cjs +29 -0
- package/node_modules/@discord/embedded-app-sdk/output/commands/getChannel.d.ts +230 -0
- package/node_modules/@discord/embedded-app-sdk/output/commands/getChannel.mjs +27 -0
- package/node_modules/@discord/embedded-app-sdk/output/commands/getChannelPermissions.cjs +13 -0
- package/node_modules/@discord/embedded-app-sdk/output/commands/getChannelPermissions.d.ts +8 -0
- package/node_modules/@discord/embedded-app-sdk/output/commands/getChannelPermissions.mjs +11 -0
- package/node_modules/@discord/embedded-app-sdk/output/commands/getEntitlements.cjs +12 -0
- package/node_modules/@discord/embedded-app-sdk/output/commands/getEntitlements.d.ts +22 -0
- package/node_modules/@discord/embedded-app-sdk/output/commands/getEntitlements.mjs +10 -0
- package/node_modules/@discord/embedded-app-sdk/output/commands/getPlatformBehaviors.cjs +16 -0
- package/node_modules/@discord/embedded-app-sdk/output/commands/getPlatformBehaviors.d.ts +11 -0
- package/node_modules/@discord/embedded-app-sdk/output/commands/getPlatformBehaviors.mjs +14 -0
- package/node_modules/@discord/embedded-app-sdk/output/commands/getQuest.cjs +8 -0
- package/node_modules/@discord/embedded-app-sdk/output/commands/getQuest.d.ts +6 -0
- package/node_modules/@discord/embedded-app-sdk/output/commands/getQuest.mjs +6 -0
- package/node_modules/@discord/embedded-app-sdk/output/commands/getQuestEnrollmentStatus.cjs +8 -0
- package/node_modules/@discord/embedded-app-sdk/output/commands/getQuestEnrollmentStatus.d.ts +7 -0
- package/node_modules/@discord/embedded-app-sdk/output/commands/getQuestEnrollmentStatus.mjs +6 -0
- package/node_modules/@discord/embedded-app-sdk/output/commands/getRelationships.cjs +8 -0
- package/node_modules/@discord/embedded-app-sdk/output/commands/getRelationships.d.ts +70 -0
- package/node_modules/@discord/embedded-app-sdk/output/commands/getRelationships.mjs +6 -0
- package/node_modules/@discord/embedded-app-sdk/output/commands/getSkus.cjs +12 -0
- package/node_modules/@discord/embedded-app-sdk/output/commands/getSkus.d.ts +15 -0
- package/node_modules/@discord/embedded-app-sdk/output/commands/getSkus.mjs +10 -0
- package/node_modules/@discord/embedded-app-sdk/output/commands/getUser.cjs +8 -0
- package/node_modules/@discord/embedded-app-sdk/output/commands/getUser.d.ts +17 -0
- package/node_modules/@discord/embedded-app-sdk/output/commands/getUser.mjs +6 -0
- package/node_modules/@discord/embedded-app-sdk/output/commands/index.cjs +76 -0
- package/node_modules/@discord/embedded-app-sdk/output/commands/index.d.ts +562 -0
- package/node_modules/@discord/embedded-app-sdk/output/commands/index.mjs +68 -0
- package/node_modules/@discord/embedded-app-sdk/output/commands/initiateImageUpload.cjs +17 -0
- package/node_modules/@discord/embedded-app-sdk/output/commands/initiateImageUpload.d.ts +12 -0
- package/node_modules/@discord/embedded-app-sdk/output/commands/initiateImageUpload.mjs +15 -0
- package/node_modules/@discord/embedded-app-sdk/output/commands/inviteUserEmbedded.cjs +8 -0
- package/node_modules/@discord/embedded-app-sdk/output/commands/inviteUserEmbedded.d.ts +4 -0
- package/node_modules/@discord/embedded-app-sdk/output/commands/inviteUserEmbedded.mjs +6 -0
- package/node_modules/@discord/embedded-app-sdk/output/commands/openExternalLink.cjs +12 -0
- package/node_modules/@discord/embedded-app-sdk/output/commands/openExternalLink.d.ts +10 -0
- package/node_modules/@discord/embedded-app-sdk/output/commands/openExternalLink.mjs +10 -0
- package/node_modules/@discord/embedded-app-sdk/output/commands/openInviteDialog.cjs +14 -0
- package/node_modules/@discord/embedded-app-sdk/output/commands/openInviteDialog.d.ts +7 -0
- package/node_modules/@discord/embedded-app-sdk/output/commands/openInviteDialog.mjs +12 -0
- package/node_modules/@discord/embedded-app-sdk/output/commands/openShareMomentDialog.cjs +14 -0
- package/node_modules/@discord/embedded-app-sdk/output/commands/openShareMomentDialog.d.ts +9 -0
- package/node_modules/@discord/embedded-app-sdk/output/commands/openShareMomentDialog.mjs +12 -0
- package/node_modules/@discord/embedded-app-sdk/output/commands/questStartTimer.cjs +8 -0
- package/node_modules/@discord/embedded-app-sdk/output/commands/questStartTimer.d.ts +5 -0
- package/node_modules/@discord/embedded-app-sdk/output/commands/questStartTimer.mjs +6 -0
- package/node_modules/@discord/embedded-app-sdk/output/commands/requestProxyTicketRefresh.cjs +8 -0
- package/node_modules/@discord/embedded-app-sdk/output/commands/requestProxyTicketRefresh.d.ts +3 -0
- package/node_modules/@discord/embedded-app-sdk/output/commands/requestProxyTicketRefresh.mjs +6 -0
- package/node_modules/@discord/embedded-app-sdk/output/commands/setActivity.cjs +48 -0
- package/node_modules/@discord/embedded-app-sdk/output/commands/setActivity.d.ts +304 -0
- package/node_modules/@discord/embedded-app-sdk/output/commands/setActivity.mjs +46 -0
- package/node_modules/@discord/embedded-app-sdk/output/commands/setConfig.cjs +12 -0
- package/node_modules/@discord/embedded-app-sdk/output/commands/setConfig.d.ts +10 -0
- package/node_modules/@discord/embedded-app-sdk/output/commands/setConfig.mjs +10 -0
- package/node_modules/@discord/embedded-app-sdk/output/commands/setOrientationLockState.cjs +20 -0
- package/node_modules/@discord/embedded-app-sdk/output/commands/setOrientationLockState.d.ts +11 -0
- package/node_modules/@discord/embedded-app-sdk/output/commands/setOrientationLockState.mjs +18 -0
- package/node_modules/@discord/embedded-app-sdk/output/commands/shareInteraction.cjs +8 -0
- package/node_modules/@discord/embedded-app-sdk/output/commands/shareInteraction.d.ts +26 -0
- package/node_modules/@discord/embedded-app-sdk/output/commands/shareInteraction.mjs +6 -0
- package/node_modules/@discord/embedded-app-sdk/output/commands/shareLink.cjs +16 -0
- package/node_modules/@discord/embedded-app-sdk/output/commands/shareLink.d.ts +17 -0
- package/node_modules/@discord/embedded-app-sdk/output/commands/shareLink.mjs +14 -0
- package/node_modules/@discord/embedded-app-sdk/output/commands/startPurchase.cjs +12 -0
- package/node_modules/@discord/embedded-app-sdk/output/commands/startPurchase.d.ts +24 -0
- package/node_modules/@discord/embedded-app-sdk/output/commands/startPurchase.mjs +10 -0
- package/node_modules/@discord/embedded-app-sdk/output/commands/userSettingsGetLocale.cjs +12 -0
- package/node_modules/@discord/embedded-app-sdk/output/commands/userSettingsGetLocale.d.ts +7 -0
- package/node_modules/@discord/embedded-app-sdk/output/commands/userSettingsGetLocale.mjs +10 -0
- package/node_modules/@discord/embedded-app-sdk/output/error.cjs +12 -0
- package/node_modules/@discord/embedded-app-sdk/output/error.d.ts +10 -0
- package/node_modules/@discord/embedded-app-sdk/output/error.mjs +10 -0
- package/node_modules/@discord/embedded-app-sdk/output/generated/schemas.cjs +408 -0
- package/node_modules/@discord/embedded-app-sdk/output/generated/schemas.d.ts +2227 -0
- package/node_modules/@discord/embedded-app-sdk/output/generated/schemas.mjs +387 -0
- package/node_modules/@discord/embedded-app-sdk/output/index.cjs +44 -0
- package/node_modules/@discord/embedded-app-sdk/output/index.d.ts +17 -0
- package/node_modules/@discord/embedded-app-sdk/output/index.mjs +14 -0
- package/node_modules/@discord/embedded-app-sdk/output/interface.d.ts +35 -0
- package/node_modules/@discord/embedded-app-sdk/output/lib/big-integer/BigInteger.cjs +1460 -0
- package/node_modules/@discord/embedded-app-sdk/output/lib/big-integer/BigInteger.mjs +1458 -0
- package/node_modules/@discord/embedded-app-sdk/output/lib/decimal.js-light/decimal.cjs +1991 -0
- package/node_modules/@discord/embedded-app-sdk/output/lib/decimal.js-light/decimal.mjs +1987 -0
- package/node_modules/@discord/embedded-app-sdk/output/lib/eventemitter3/index.cjs +10 -0
- package/node_modules/@discord/embedded-app-sdk/output/lib/eventemitter3/index.mjs +5 -0
- package/node_modules/@discord/embedded-app-sdk/output/lib/eventemitter3/index2.cjs +350 -0
- package/node_modules/@discord/embedded-app-sdk/output/lib/eventemitter3/index2.mjs +348 -0
- package/node_modules/@discord/embedded-app-sdk/output/lib/lodash.transform/index.cjs +2343 -0
- package/node_modules/@discord/embedded-app-sdk/output/lib/lodash.transform/index.mjs +2341 -0
- package/node_modules/@discord/embedded-app-sdk/output/lib/tslib/tslib.es6.cjs +37 -0
- package/node_modules/@discord/embedded-app-sdk/output/lib/tslib/tslib.es6.mjs +35 -0
- package/node_modules/@discord/embedded-app-sdk/output/lib/uuid/dist/esm-browser/native.cjs +8 -0
- package/node_modules/@discord/embedded-app-sdk/output/lib/uuid/dist/esm-browser/native.mjs +4 -0
- package/node_modules/@discord/embedded-app-sdk/output/lib/uuid/dist/esm-browser/rng.cjs +17 -0
- package/node_modules/@discord/embedded-app-sdk/output/lib/uuid/dist/esm-browser/rng.mjs +13 -0
- package/node_modules/@discord/embedded-app-sdk/output/lib/uuid/dist/esm-browser/stringify.cjs +30 -0
- package/node_modules/@discord/embedded-app-sdk/output/lib/uuid/dist/esm-browser/stringify.mjs +28 -0
- package/node_modules/@discord/embedded-app-sdk/output/lib/uuid/dist/esm-browser/v4.cjs +23 -0
- package/node_modules/@discord/embedded-app-sdk/output/lib/uuid/dist/esm-browser/v4.mjs +19 -0
- package/node_modules/@discord/embedded-app-sdk/output/lib/zod/lib/index.cjs +4342 -0
- package/node_modules/@discord/embedded-app-sdk/output/lib/zod/lib/index.mjs +4233 -0
- package/node_modules/@discord/embedded-app-sdk/output/mock.cjs +181 -0
- package/node_modules/@discord/embedded-app-sdk/output/mock.d.ts +579 -0
- package/node_modules/@discord/embedded-app-sdk/output/mock.mjs +178 -0
- package/node_modules/@discord/embedded-app-sdk/output/package.json.cjs +5 -0
- package/node_modules/@discord/embedded-app-sdk/output/package.json.mjs +3 -0
- package/node_modules/@discord/embedded-app-sdk/output/schema/common.cjs +587 -0
- package/node_modules/@discord/embedded-app-sdk/output/schema/common.d.ts +5141 -0
- package/node_modules/@discord/embedded-app-sdk/output/schema/common.mjs +531 -0
- package/node_modules/@discord/embedded-app-sdk/output/schema/events.cjs +221 -0
- package/node_modules/@discord/embedded-app-sdk/output/schema/events.d.ts +3832 -0
- package/node_modules/@discord/embedded-app-sdk/output/schema/events.mjs +213 -0
- package/node_modules/@discord/embedded-app-sdk/output/schema/index.cjs +47 -0
- package/node_modules/@discord/embedded-app-sdk/output/schema/index.d.ts +59 -0
- package/node_modules/@discord/embedded-app-sdk/output/schema/index.mjs +44 -0
- package/node_modules/@discord/embedded-app-sdk/output/schema/responses.cjs +189 -0
- package/node_modules/@discord/embedded-app-sdk/output/schema/responses.d.ts +7224 -0
- package/node_modules/@discord/embedded-app-sdk/output/schema/responses.mjs +163 -0
- package/node_modules/@discord/embedded-app-sdk/output/schema/types.d.ts +61 -0
- package/node_modules/@discord/embedded-app-sdk/output/utils/BigFlagUtils.cjs +235 -0
- package/node_modules/@discord/embedded-app-sdk/output/utils/BigFlagUtils.d.ts +59 -0
- package/node_modules/@discord/embedded-app-sdk/output/utils/BigFlagUtils.mjs +231 -0
- package/node_modules/@discord/embedded-app-sdk/output/utils/PermissionUtils.cjs +14 -0
- package/node_modules/@discord/embedded-app-sdk/output/utils/PermissionUtils.d.ts +6 -0
- package/node_modules/@discord/embedded-app-sdk/output/utils/PermissionUtils.mjs +10 -0
- package/node_modules/@discord/embedded-app-sdk/output/utils/PriceConstants.cjs +373 -0
- package/node_modules/@discord/embedded-app-sdk/output/utils/PriceConstants.d.ts +368 -0
- package/node_modules/@discord/embedded-app-sdk/output/utils/PriceConstants.mjs +371 -0
- package/node_modules/@discord/embedded-app-sdk/output/utils/PriceUtils.cjs +26 -0
- package/node_modules/@discord/embedded-app-sdk/output/utils/PriceUtils.d.ts +8 -0
- package/node_modules/@discord/embedded-app-sdk/output/utils/PriceUtils.mjs +22 -0
- package/node_modules/@discord/embedded-app-sdk/output/utils/assertUnreachable.cjs +13 -0
- package/node_modules/@discord/embedded-app-sdk/output/utils/assertUnreachable.d.ts +5 -0
- package/node_modules/@discord/embedded-app-sdk/output/utils/assertUnreachable.mjs +9 -0
- package/node_modules/@discord/embedded-app-sdk/output/utils/commandFactory.cjs +37 -0
- package/node_modules/@discord/embedded-app-sdk/output/utils/commandFactory.d.ts +9 -0
- package/node_modules/@discord/embedded-app-sdk/output/utils/commandFactory.mjs +34 -0
- package/node_modules/@discord/embedded-app-sdk/output/utils/compatCommandFactory.cjs +39 -0
- package/node_modules/@discord/embedded-app-sdk/output/utils/compatCommandFactory.d.ts +15 -0
- package/node_modules/@discord/embedded-app-sdk/output/utils/compatCommandFactory.mjs +35 -0
- package/node_modules/@discord/embedded-app-sdk/output/utils/console.cjs +19 -0
- package/node_modules/@discord/embedded-app-sdk/output/utils/console.d.ts +3 -0
- package/node_modules/@discord/embedded-app-sdk/output/utils/console.mjs +16 -0
- package/node_modules/@discord/embedded-app-sdk/output/utils/getDefaultSdkConfiguration.cjs +11 -0
- package/node_modules/@discord/embedded-app-sdk/output/utils/getDefaultSdkConfiguration.d.ts +2 -0
- package/node_modules/@discord/embedded-app-sdk/output/utils/getDefaultSdkConfiguration.mjs +7 -0
- package/node_modules/@discord/embedded-app-sdk/output/utils/patchUrlMappings.cjs +153 -0
- package/node_modules/@discord/embedded-app-sdk/output/utils/patchUrlMappings.d.ts +17 -0
- package/node_modules/@discord/embedded-app-sdk/output/utils/patchUrlMappings.mjs +150 -0
- package/node_modules/@discord/embedded-app-sdk/output/utils/url.cjs +62 -0
- package/node_modules/@discord/embedded-app-sdk/output/utils/url.d.ts +17 -0
- package/node_modules/@discord/embedded-app-sdk/output/utils/url.mjs +59 -0
- package/node_modules/@discord/embedded-app-sdk/output/utils/zodUtils.cjs +44 -0
- package/node_modules/@discord/embedded-app-sdk/output/utils/zodUtils.d.ts +28 -0
- package/node_modules/@discord/embedded-app-sdk/output/utils/zodUtils.mjs +41 -0
- package/node_modules/@discord/embedded-app-sdk/package.json +88 -0
- package/node_modules/@types/lodash/LICENSE +21 -0
- package/node_modules/@types/lodash/README.md +15 -0
- package/node_modules/@types/lodash/add.d.ts +2 -0
- package/node_modules/@types/lodash/after.d.ts +2 -0
- package/node_modules/@types/lodash/ary.d.ts +2 -0
- package/node_modules/@types/lodash/assign.d.ts +2 -0
- package/node_modules/@types/lodash/assignIn.d.ts +2 -0
- package/node_modules/@types/lodash/assignInWith.d.ts +2 -0
- package/node_modules/@types/lodash/assignWith.d.ts +2 -0
- package/node_modules/@types/lodash/at.d.ts +2 -0
- package/node_modules/@types/lodash/attempt.d.ts +2 -0
- package/node_modules/@types/lodash/before.d.ts +2 -0
- package/node_modules/@types/lodash/bind.d.ts +2 -0
- package/node_modules/@types/lodash/bindAll.d.ts +2 -0
- package/node_modules/@types/lodash/bindKey.d.ts +2 -0
- package/node_modules/@types/lodash/camelCase.d.ts +2 -0
- package/node_modules/@types/lodash/capitalize.d.ts +2 -0
- package/node_modules/@types/lodash/castArray.d.ts +2 -0
- package/node_modules/@types/lodash/ceil.d.ts +2 -0
- package/node_modules/@types/lodash/chain.d.ts +2 -0
- package/node_modules/@types/lodash/chunk.d.ts +2 -0
- package/node_modules/@types/lodash/clamp.d.ts +2 -0
- package/node_modules/@types/lodash/clone.d.ts +2 -0
- package/node_modules/@types/lodash/cloneDeep.d.ts +2 -0
- package/node_modules/@types/lodash/cloneDeepWith.d.ts +2 -0
- package/node_modules/@types/lodash/cloneWith.d.ts +2 -0
- package/node_modules/@types/lodash/common/array.d.ts +2160 -0
- package/node_modules/@types/lodash/common/collection.d.ts +1938 -0
- package/node_modules/@types/lodash/common/common.d.ts +287 -0
- package/node_modules/@types/lodash/common/date.d.ts +23 -0
- package/node_modules/@types/lodash/common/function.d.ts +1455 -0
- package/node_modules/@types/lodash/common/lang.d.ts +1696 -0
- package/node_modules/@types/lodash/common/math.d.ts +407 -0
- package/node_modules/@types/lodash/common/number.d.ts +131 -0
- package/node_modules/@types/lodash/common/object.d.ts +2643 -0
- package/node_modules/@types/lodash/common/seq.d.ts +210 -0
- package/node_modules/@types/lodash/common/string.d.ts +788 -0
- package/node_modules/@types/lodash/common/util.d.ts +1220 -0
- package/node_modules/@types/lodash/compact.d.ts +2 -0
- package/node_modules/@types/lodash/concat.d.ts +2 -0
- package/node_modules/@types/lodash/cond.d.ts +2 -0
- package/node_modules/@types/lodash/conformsTo.d.ts +2 -0
- package/node_modules/@types/lodash/constant.d.ts +2 -0
- package/node_modules/@types/lodash/countBy.d.ts +2 -0
- package/node_modules/@types/lodash/create.d.ts +2 -0
- package/node_modules/@types/lodash/curry.d.ts +2 -0
- package/node_modules/@types/lodash/curryRight.d.ts +2 -0
- package/node_modules/@types/lodash/debounce.d.ts +2 -0
- package/node_modules/@types/lodash/deburr.d.ts +2 -0
- package/node_modules/@types/lodash/defaultTo.d.ts +2 -0
- package/node_modules/@types/lodash/defaults.d.ts +2 -0
- package/node_modules/@types/lodash/defaultsDeep.d.ts +2 -0
- package/node_modules/@types/lodash/defer.d.ts +2 -0
- package/node_modules/@types/lodash/delay.d.ts +2 -0
- package/node_modules/@types/lodash/difference.d.ts +2 -0
- package/node_modules/@types/lodash/differenceBy.d.ts +2 -0
- package/node_modules/@types/lodash/differenceWith.d.ts +2 -0
- package/node_modules/@types/lodash/divide.d.ts +2 -0
- package/node_modules/@types/lodash/drop.d.ts +2 -0
- package/node_modules/@types/lodash/dropRight.d.ts +2 -0
- package/node_modules/@types/lodash/dropRightWhile.d.ts +2 -0
- package/node_modules/@types/lodash/dropWhile.d.ts +2 -0
- package/node_modules/@types/lodash/each.d.ts +2 -0
- package/node_modules/@types/lodash/eachRight.d.ts +2 -0
- package/node_modules/@types/lodash/endsWith.d.ts +2 -0
- package/node_modules/@types/lodash/entries.d.ts +2 -0
- package/node_modules/@types/lodash/entriesIn.d.ts +2 -0
- package/node_modules/@types/lodash/eq.d.ts +2 -0
- package/node_modules/@types/lodash/escape.d.ts +2 -0
- package/node_modules/@types/lodash/escapeRegExp.d.ts +2 -0
- package/node_modules/@types/lodash/every.d.ts +2 -0
- package/node_modules/@types/lodash/extend.d.ts +2 -0
- package/node_modules/@types/lodash/extendWith.d.ts +2 -0
- package/node_modules/@types/lodash/fill.d.ts +2 -0
- package/node_modules/@types/lodash/filter.d.ts +2 -0
- package/node_modules/@types/lodash/find.d.ts +2 -0
- package/node_modules/@types/lodash/findIndex.d.ts +2 -0
- package/node_modules/@types/lodash/findKey.d.ts +2 -0
- package/node_modules/@types/lodash/findLast.d.ts +2 -0
- package/node_modules/@types/lodash/findLastIndex.d.ts +2 -0
- package/node_modules/@types/lodash/findLastKey.d.ts +2 -0
- package/node_modules/@types/lodash/first.d.ts +2 -0
- package/node_modules/@types/lodash/flatMap.d.ts +2 -0
- package/node_modules/@types/lodash/flatMapDeep.d.ts +2 -0
- package/node_modules/@types/lodash/flatMapDepth.d.ts +2 -0
- package/node_modules/@types/lodash/flatten.d.ts +2 -0
- package/node_modules/@types/lodash/flattenDeep.d.ts +2 -0
- package/node_modules/@types/lodash/flattenDepth.d.ts +2 -0
- package/node_modules/@types/lodash/flip.d.ts +2 -0
- package/node_modules/@types/lodash/floor.d.ts +2 -0
- package/node_modules/@types/lodash/flow.d.ts +2 -0
- package/node_modules/@types/lodash/flowRight.d.ts +2 -0
- package/node_modules/@types/lodash/forEach.d.ts +2 -0
- package/node_modules/@types/lodash/forEachRight.d.ts +2 -0
- package/node_modules/@types/lodash/forIn.d.ts +2 -0
- package/node_modules/@types/lodash/forInRight.d.ts +2 -0
- package/node_modules/@types/lodash/forOwn.d.ts +2 -0
- package/node_modules/@types/lodash/forOwnRight.d.ts +2 -0
- package/node_modules/@types/lodash/fp/F.d.ts +2 -0
- package/node_modules/@types/lodash/fp/T.d.ts +2 -0
- package/node_modules/@types/lodash/fp/__.d.ts +3 -0
- package/node_modules/@types/lodash/fp/add.d.ts +2 -0
- package/node_modules/@types/lodash/fp/after.d.ts +2 -0
- package/node_modules/@types/lodash/fp/all.d.ts +2 -0
- package/node_modules/@types/lodash/fp/allPass.d.ts +2 -0
- package/node_modules/@types/lodash/fp/always.d.ts +2 -0
- package/node_modules/@types/lodash/fp/any.d.ts +2 -0
- package/node_modules/@types/lodash/fp/anyPass.d.ts +2 -0
- package/node_modules/@types/lodash/fp/apply.d.ts +2 -0
- package/node_modules/@types/lodash/fp/ary.d.ts +2 -0
- package/node_modules/@types/lodash/fp/assign.d.ts +2 -0
- package/node_modules/@types/lodash/fp/assignAll.d.ts +2 -0
- package/node_modules/@types/lodash/fp/assignAllWith.d.ts +2 -0
- package/node_modules/@types/lodash/fp/assignIn.d.ts +2 -0
- package/node_modules/@types/lodash/fp/assignInAll.d.ts +2 -0
- package/node_modules/@types/lodash/fp/assignInAllWith.d.ts +2 -0
- package/node_modules/@types/lodash/fp/assignInWith.d.ts +2 -0
- package/node_modules/@types/lodash/fp/assignWith.d.ts +2 -0
- package/node_modules/@types/lodash/fp/assoc.d.ts +2 -0
- package/node_modules/@types/lodash/fp/assocPath.d.ts +2 -0
- package/node_modules/@types/lodash/fp/at.d.ts +2 -0
- package/node_modules/@types/lodash/fp/attempt.d.ts +2 -0
- package/node_modules/@types/lodash/fp/before.d.ts +2 -0
- package/node_modules/@types/lodash/fp/bind.d.ts +2 -0
- package/node_modules/@types/lodash/fp/bindAll.d.ts +2 -0
- package/node_modules/@types/lodash/fp/bindKey.d.ts +2 -0
- package/node_modules/@types/lodash/fp/camelCase.d.ts +2 -0
- package/node_modules/@types/lodash/fp/capitalize.d.ts +2 -0
- package/node_modules/@types/lodash/fp/castArray.d.ts +2 -0
- package/node_modules/@types/lodash/fp/ceil.d.ts +2 -0
- package/node_modules/@types/lodash/fp/chunk.d.ts +2 -0
- package/node_modules/@types/lodash/fp/clamp.d.ts +2 -0
- package/node_modules/@types/lodash/fp/clone.d.ts +2 -0
- package/node_modules/@types/lodash/fp/cloneDeep.d.ts +2 -0
- package/node_modules/@types/lodash/fp/cloneDeepWith.d.ts +2 -0
- package/node_modules/@types/lodash/fp/cloneWith.d.ts +2 -0
- package/node_modules/@types/lodash/fp/compact.d.ts +2 -0
- package/node_modules/@types/lodash/fp/complement.d.ts +2 -0
- package/node_modules/@types/lodash/fp/compose.d.ts +2 -0
- package/node_modules/@types/lodash/fp/concat.d.ts +2 -0
- package/node_modules/@types/lodash/fp/cond.d.ts +2 -0
- package/node_modules/@types/lodash/fp/conforms.d.ts +2 -0
- package/node_modules/@types/lodash/fp/conformsTo.d.ts +2 -0
- package/node_modules/@types/lodash/fp/constant.d.ts +2 -0
- package/node_modules/@types/lodash/fp/contains.d.ts +2 -0
- package/node_modules/@types/lodash/fp/convert.d.ts +15 -0
- package/node_modules/@types/lodash/fp/countBy.d.ts +2 -0
- package/node_modules/@types/lodash/fp/create.d.ts +2 -0
- package/node_modules/@types/lodash/fp/curry.d.ts +2 -0
- package/node_modules/@types/lodash/fp/curryN.d.ts +2 -0
- package/node_modules/@types/lodash/fp/curryRight.d.ts +2 -0
- package/node_modules/@types/lodash/fp/curryRightN.d.ts +2 -0
- package/node_modules/@types/lodash/fp/debounce.d.ts +2 -0
- package/node_modules/@types/lodash/fp/deburr.d.ts +2 -0
- package/node_modules/@types/lodash/fp/defaultTo.d.ts +2 -0
- package/node_modules/@types/lodash/fp/defaults.d.ts +2 -0
- package/node_modules/@types/lodash/fp/defaultsAll.d.ts +2 -0
- package/node_modules/@types/lodash/fp/defaultsDeep.d.ts +2 -0
- package/node_modules/@types/lodash/fp/defaultsDeepAll.d.ts +2 -0
- package/node_modules/@types/lodash/fp/defer.d.ts +2 -0
- package/node_modules/@types/lodash/fp/delay.d.ts +2 -0
- package/node_modules/@types/lodash/fp/difference.d.ts +2 -0
- package/node_modules/@types/lodash/fp/differenceBy.d.ts +2 -0
- package/node_modules/@types/lodash/fp/differenceWith.d.ts +2 -0
- package/node_modules/@types/lodash/fp/dissoc.d.ts +2 -0
- package/node_modules/@types/lodash/fp/dissocPath.d.ts +2 -0
- package/node_modules/@types/lodash/fp/divide.d.ts +2 -0
- package/node_modules/@types/lodash/fp/drop.d.ts +2 -0
- package/node_modules/@types/lodash/fp/dropLast.d.ts +2 -0
- package/node_modules/@types/lodash/fp/dropLastWhile.d.ts +2 -0
- package/node_modules/@types/lodash/fp/dropRight.d.ts +2 -0
- package/node_modules/@types/lodash/fp/dropRightWhile.d.ts +2 -0
- package/node_modules/@types/lodash/fp/dropWhile.d.ts +2 -0
- package/node_modules/@types/lodash/fp/each.d.ts +2 -0
- package/node_modules/@types/lodash/fp/eachRight.d.ts +2 -0
- package/node_modules/@types/lodash/fp/endsWith.d.ts +2 -0
- package/node_modules/@types/lodash/fp/entries.d.ts +2 -0
- package/node_modules/@types/lodash/fp/entriesIn.d.ts +2 -0
- package/node_modules/@types/lodash/fp/eq.d.ts +2 -0
- package/node_modules/@types/lodash/fp/equals.d.ts +2 -0
- package/node_modules/@types/lodash/fp/escape.d.ts +2 -0
- package/node_modules/@types/lodash/fp/escapeRegExp.d.ts +2 -0
- package/node_modules/@types/lodash/fp/every.d.ts +2 -0
- package/node_modules/@types/lodash/fp/extend.d.ts +2 -0
- package/node_modules/@types/lodash/fp/extendAll.d.ts +2 -0
- package/node_modules/@types/lodash/fp/extendAllWith.d.ts +2 -0
- package/node_modules/@types/lodash/fp/extendWith.d.ts +2 -0
- package/node_modules/@types/lodash/fp/fill.d.ts +2 -0
- package/node_modules/@types/lodash/fp/filter.d.ts +2 -0
- package/node_modules/@types/lodash/fp/find.d.ts +2 -0
- package/node_modules/@types/lodash/fp/findFrom.d.ts +2 -0
- package/node_modules/@types/lodash/fp/findIndex.d.ts +2 -0
- package/node_modules/@types/lodash/fp/findIndexFrom.d.ts +2 -0
- package/node_modules/@types/lodash/fp/findKey.d.ts +2 -0
- package/node_modules/@types/lodash/fp/findLast.d.ts +2 -0
- package/node_modules/@types/lodash/fp/findLastFrom.d.ts +2 -0
- package/node_modules/@types/lodash/fp/findLastIndex.d.ts +2 -0
- package/node_modules/@types/lodash/fp/findLastIndexFrom.d.ts +2 -0
- package/node_modules/@types/lodash/fp/findLastKey.d.ts +2 -0
- package/node_modules/@types/lodash/fp/first.d.ts +2 -0
- package/node_modules/@types/lodash/fp/flatMap.d.ts +2 -0
- package/node_modules/@types/lodash/fp/flatMapDeep.d.ts +2 -0
- package/node_modules/@types/lodash/fp/flatMapDepth.d.ts +2 -0
- package/node_modules/@types/lodash/fp/flatten.d.ts +2 -0
- package/node_modules/@types/lodash/fp/flattenDeep.d.ts +2 -0
- package/node_modules/@types/lodash/fp/flattenDepth.d.ts +2 -0
- package/node_modules/@types/lodash/fp/flip.d.ts +2 -0
- package/node_modules/@types/lodash/fp/floor.d.ts +2 -0
- package/node_modules/@types/lodash/fp/flow.d.ts +2 -0
- package/node_modules/@types/lodash/fp/flowRight.d.ts +2 -0
- package/node_modules/@types/lodash/fp/forEach.d.ts +2 -0
- package/node_modules/@types/lodash/fp/forEachRight.d.ts +2 -0
- package/node_modules/@types/lodash/fp/forIn.d.ts +2 -0
- package/node_modules/@types/lodash/fp/forInRight.d.ts +2 -0
- package/node_modules/@types/lodash/fp/forOwn.d.ts +2 -0
- package/node_modules/@types/lodash/fp/forOwnRight.d.ts +2 -0
- package/node_modules/@types/lodash/fp/fromPairs.d.ts +2 -0
- package/node_modules/@types/lodash/fp/functions.d.ts +2 -0
- package/node_modules/@types/lodash/fp/functionsIn.d.ts +2 -0
- package/node_modules/@types/lodash/fp/get.d.ts +2 -0
- package/node_modules/@types/lodash/fp/getOr.d.ts +2 -0
- package/node_modules/@types/lodash/fp/groupBy.d.ts +2 -0
- package/node_modules/@types/lodash/fp/gt.d.ts +2 -0
- package/node_modules/@types/lodash/fp/gte.d.ts +2 -0
- package/node_modules/@types/lodash/fp/has.d.ts +2 -0
- package/node_modules/@types/lodash/fp/hasIn.d.ts +2 -0
- package/node_modules/@types/lodash/fp/head.d.ts +2 -0
- package/node_modules/@types/lodash/fp/identical.d.ts +2 -0
- package/node_modules/@types/lodash/fp/identity.d.ts +2 -0
- package/node_modules/@types/lodash/fp/inRange.d.ts +2 -0
- package/node_modules/@types/lodash/fp/includes.d.ts +2 -0
- package/node_modules/@types/lodash/fp/includesFrom.d.ts +2 -0
- package/node_modules/@types/lodash/fp/indexBy.d.ts +2 -0
- package/node_modules/@types/lodash/fp/indexOf.d.ts +2 -0
- package/node_modules/@types/lodash/fp/indexOfFrom.d.ts +2 -0
- package/node_modules/@types/lodash/fp/init.d.ts +2 -0
- package/node_modules/@types/lodash/fp/initial.d.ts +2 -0
- package/node_modules/@types/lodash/fp/intersection.d.ts +2 -0
- package/node_modules/@types/lodash/fp/intersectionBy.d.ts +2 -0
- package/node_modules/@types/lodash/fp/intersectionWith.d.ts +2 -0
- package/node_modules/@types/lodash/fp/invert.d.ts +2 -0
- package/node_modules/@types/lodash/fp/invertBy.d.ts +2 -0
- package/node_modules/@types/lodash/fp/invertObj.d.ts +2 -0
- package/node_modules/@types/lodash/fp/invoke.d.ts +2 -0
- package/node_modules/@types/lodash/fp/invokeArgs.d.ts +2 -0
- package/node_modules/@types/lodash/fp/invokeArgsMap.d.ts +2 -0
- package/node_modules/@types/lodash/fp/invokeMap.d.ts +2 -0
- package/node_modules/@types/lodash/fp/isArguments.d.ts +2 -0
- package/node_modules/@types/lodash/fp/isArray.d.ts +2 -0
- package/node_modules/@types/lodash/fp/isArrayBuffer.d.ts +2 -0
- package/node_modules/@types/lodash/fp/isArrayLike.d.ts +2 -0
- package/node_modules/@types/lodash/fp/isArrayLikeObject.d.ts +2 -0
- package/node_modules/@types/lodash/fp/isBoolean.d.ts +2 -0
- package/node_modules/@types/lodash/fp/isBuffer.d.ts +2 -0
- package/node_modules/@types/lodash/fp/isDate.d.ts +2 -0
- package/node_modules/@types/lodash/fp/isElement.d.ts +2 -0
- package/node_modules/@types/lodash/fp/isEmpty.d.ts +2 -0
- package/node_modules/@types/lodash/fp/isEqual.d.ts +2 -0
- package/node_modules/@types/lodash/fp/isEqualWith.d.ts +2 -0
- package/node_modules/@types/lodash/fp/isError.d.ts +2 -0
- package/node_modules/@types/lodash/fp/isFinite.d.ts +2 -0
- package/node_modules/@types/lodash/fp/isFunction.d.ts +2 -0
- package/node_modules/@types/lodash/fp/isInteger.d.ts +2 -0
- package/node_modules/@types/lodash/fp/isLength.d.ts +2 -0
- package/node_modules/@types/lodash/fp/isMap.d.ts +2 -0
- package/node_modules/@types/lodash/fp/isMatch.d.ts +2 -0
- package/node_modules/@types/lodash/fp/isMatchWith.d.ts +2 -0
- package/node_modules/@types/lodash/fp/isNaN.d.ts +2 -0
- package/node_modules/@types/lodash/fp/isNative.d.ts +2 -0
- package/node_modules/@types/lodash/fp/isNil.d.ts +2 -0
- package/node_modules/@types/lodash/fp/isNull.d.ts +2 -0
- package/node_modules/@types/lodash/fp/isNumber.d.ts +2 -0
- package/node_modules/@types/lodash/fp/isObject.d.ts +2 -0
- package/node_modules/@types/lodash/fp/isObjectLike.d.ts +2 -0
- package/node_modules/@types/lodash/fp/isPlainObject.d.ts +2 -0
- package/node_modules/@types/lodash/fp/isRegExp.d.ts +2 -0
- package/node_modules/@types/lodash/fp/isSafeInteger.d.ts +2 -0
- package/node_modules/@types/lodash/fp/isSet.d.ts +2 -0
- package/node_modules/@types/lodash/fp/isString.d.ts +2 -0
- package/node_modules/@types/lodash/fp/isSymbol.d.ts +2 -0
- package/node_modules/@types/lodash/fp/isTypedArray.d.ts +2 -0
- package/node_modules/@types/lodash/fp/isUndefined.d.ts +2 -0
- package/node_modules/@types/lodash/fp/isWeakMap.d.ts +2 -0
- package/node_modules/@types/lodash/fp/isWeakSet.d.ts +2 -0
- package/node_modules/@types/lodash/fp/iteratee.d.ts +2 -0
- package/node_modules/@types/lodash/fp/join.d.ts +2 -0
- package/node_modules/@types/lodash/fp/juxt.d.ts +2 -0
- package/node_modules/@types/lodash/fp/kebabCase.d.ts +2 -0
- package/node_modules/@types/lodash/fp/keyBy.d.ts +2 -0
- package/node_modules/@types/lodash/fp/keys.d.ts +2 -0
- package/node_modules/@types/lodash/fp/keysIn.d.ts +2 -0
- package/node_modules/@types/lodash/fp/last.d.ts +2 -0
- package/node_modules/@types/lodash/fp/lastIndexOf.d.ts +2 -0
- package/node_modules/@types/lodash/fp/lastIndexOfFrom.d.ts +2 -0
- package/node_modules/@types/lodash/fp/lowerCase.d.ts +2 -0
- package/node_modules/@types/lodash/fp/lowerFirst.d.ts +2 -0
- package/node_modules/@types/lodash/fp/lt.d.ts +2 -0
- package/node_modules/@types/lodash/fp/lte.d.ts +2 -0
- package/node_modules/@types/lodash/fp/map.d.ts +2 -0
- package/node_modules/@types/lodash/fp/mapKeys.d.ts +2 -0
- package/node_modules/@types/lodash/fp/mapValues.d.ts +2 -0
- package/node_modules/@types/lodash/fp/matches.d.ts +2 -0
- package/node_modules/@types/lodash/fp/matchesProperty.d.ts +2 -0
- package/node_modules/@types/lodash/fp/max.d.ts +2 -0
- package/node_modules/@types/lodash/fp/maxBy.d.ts +2 -0
- package/node_modules/@types/lodash/fp/mean.d.ts +2 -0
- package/node_modules/@types/lodash/fp/meanBy.d.ts +2 -0
- package/node_modules/@types/lodash/fp/memoize.d.ts +2 -0
- package/node_modules/@types/lodash/fp/merge.d.ts +2 -0
- package/node_modules/@types/lodash/fp/mergeAll.d.ts +2 -0
- package/node_modules/@types/lodash/fp/mergeAllWith.d.ts +2 -0
- package/node_modules/@types/lodash/fp/mergeWith.d.ts +2 -0
- package/node_modules/@types/lodash/fp/method.d.ts +2 -0
- package/node_modules/@types/lodash/fp/methodOf.d.ts +2 -0
- package/node_modules/@types/lodash/fp/min.d.ts +2 -0
- package/node_modules/@types/lodash/fp/minBy.d.ts +2 -0
- package/node_modules/@types/lodash/fp/multiply.d.ts +2 -0
- package/node_modules/@types/lodash/fp/nAry.d.ts +2 -0
- package/node_modules/@types/lodash/fp/negate.d.ts +2 -0
- package/node_modules/@types/lodash/fp/noConflict.d.ts +2 -0
- package/node_modules/@types/lodash/fp/noop.d.ts +2 -0
- package/node_modules/@types/lodash/fp/now.d.ts +2 -0
- package/node_modules/@types/lodash/fp/nth.d.ts +2 -0
- package/node_modules/@types/lodash/fp/nthArg.d.ts +2 -0
- package/node_modules/@types/lodash/fp/omit.d.ts +2 -0
- package/node_modules/@types/lodash/fp/omitAll.d.ts +2 -0
- package/node_modules/@types/lodash/fp/omitBy.d.ts +2 -0
- package/node_modules/@types/lodash/fp/once.d.ts +2 -0
- package/node_modules/@types/lodash/fp/orderBy.d.ts +2 -0
- package/node_modules/@types/lodash/fp/over.d.ts +2 -0
- package/node_modules/@types/lodash/fp/overArgs.d.ts +2 -0
- package/node_modules/@types/lodash/fp/overEvery.d.ts +2 -0
- package/node_modules/@types/lodash/fp/overSome.d.ts +2 -0
- package/node_modules/@types/lodash/fp/pad.d.ts +2 -0
- package/node_modules/@types/lodash/fp/padChars.d.ts +2 -0
- package/node_modules/@types/lodash/fp/padCharsEnd.d.ts +2 -0
- package/node_modules/@types/lodash/fp/padCharsStart.d.ts +2 -0
- package/node_modules/@types/lodash/fp/padEnd.d.ts +2 -0
- package/node_modules/@types/lodash/fp/padStart.d.ts +2 -0
- package/node_modules/@types/lodash/fp/parseInt.d.ts +2 -0
- package/node_modules/@types/lodash/fp/partial.d.ts +2 -0
- package/node_modules/@types/lodash/fp/partialRight.d.ts +2 -0
- package/node_modules/@types/lodash/fp/partition.d.ts +2 -0
- package/node_modules/@types/lodash/fp/path.d.ts +2 -0
- package/node_modules/@types/lodash/fp/pathEq.d.ts +2 -0
- package/node_modules/@types/lodash/fp/pathOr.d.ts +2 -0
- package/node_modules/@types/lodash/fp/paths.d.ts +2 -0
- package/node_modules/@types/lodash/fp/pick.d.ts +2 -0
- package/node_modules/@types/lodash/fp/pickAll.d.ts +2 -0
- package/node_modules/@types/lodash/fp/pickBy.d.ts +2 -0
- package/node_modules/@types/lodash/fp/pipe.d.ts +2 -0
- package/node_modules/@types/lodash/fp/placeholder.d.ts +3 -0
- package/node_modules/@types/lodash/fp/pluck.d.ts +2 -0
- package/node_modules/@types/lodash/fp/prop.d.ts +2 -0
- package/node_modules/@types/lodash/fp/propEq.d.ts +2 -0
- package/node_modules/@types/lodash/fp/propOr.d.ts +2 -0
- package/node_modules/@types/lodash/fp/property.d.ts +2 -0
- package/node_modules/@types/lodash/fp/propertyOf.d.ts +2 -0
- package/node_modules/@types/lodash/fp/props.d.ts +2 -0
- package/node_modules/@types/lodash/fp/pull.d.ts +2 -0
- package/node_modules/@types/lodash/fp/pullAll.d.ts +2 -0
- package/node_modules/@types/lodash/fp/pullAllBy.d.ts +2 -0
- package/node_modules/@types/lodash/fp/pullAllWith.d.ts +2 -0
- package/node_modules/@types/lodash/fp/pullAt.d.ts +2 -0
- package/node_modules/@types/lodash/fp/random.d.ts +2 -0
- package/node_modules/@types/lodash/fp/range.d.ts +2 -0
- package/node_modules/@types/lodash/fp/rangeRight.d.ts +2 -0
- package/node_modules/@types/lodash/fp/rangeStep.d.ts +2 -0
- package/node_modules/@types/lodash/fp/rangeStepRight.d.ts +2 -0
- package/node_modules/@types/lodash/fp/rearg.d.ts +2 -0
- package/node_modules/@types/lodash/fp/reduce.d.ts +2 -0
- package/node_modules/@types/lodash/fp/reduceRight.d.ts +2 -0
- package/node_modules/@types/lodash/fp/reject.d.ts +2 -0
- package/node_modules/@types/lodash/fp/remove.d.ts +2 -0
- package/node_modules/@types/lodash/fp/repeat.d.ts +2 -0
- package/node_modules/@types/lodash/fp/replace.d.ts +2 -0
- package/node_modules/@types/lodash/fp/rest.d.ts +2 -0
- package/node_modules/@types/lodash/fp/restFrom.d.ts +2 -0
- package/node_modules/@types/lodash/fp/result.d.ts +2 -0
- package/node_modules/@types/lodash/fp/reverse.d.ts +2 -0
- package/node_modules/@types/lodash/fp/round.d.ts +2 -0
- package/node_modules/@types/lodash/fp/runInContext.d.ts +2 -0
- package/node_modules/@types/lodash/fp/sample.d.ts +2 -0
- package/node_modules/@types/lodash/fp/sampleSize.d.ts +2 -0
- package/node_modules/@types/lodash/fp/set.d.ts +2 -0
- package/node_modules/@types/lodash/fp/setWith.d.ts +2 -0
- package/node_modules/@types/lodash/fp/shuffle.d.ts +2 -0
- package/node_modules/@types/lodash/fp/size.d.ts +2 -0
- package/node_modules/@types/lodash/fp/slice.d.ts +2 -0
- package/node_modules/@types/lodash/fp/snakeCase.d.ts +2 -0
- package/node_modules/@types/lodash/fp/some.d.ts +2 -0
- package/node_modules/@types/lodash/fp/sortBy.d.ts +2 -0
- package/node_modules/@types/lodash/fp/sortedIndex.d.ts +2 -0
- package/node_modules/@types/lodash/fp/sortedIndexBy.d.ts +2 -0
- package/node_modules/@types/lodash/fp/sortedIndexOf.d.ts +2 -0
- package/node_modules/@types/lodash/fp/sortedLastIndex.d.ts +2 -0
- package/node_modules/@types/lodash/fp/sortedLastIndexBy.d.ts +2 -0
- package/node_modules/@types/lodash/fp/sortedLastIndexOf.d.ts +2 -0
- package/node_modules/@types/lodash/fp/sortedUniq.d.ts +2 -0
- package/node_modules/@types/lodash/fp/sortedUniqBy.d.ts +2 -0
- package/node_modules/@types/lodash/fp/split.d.ts +2 -0
- package/node_modules/@types/lodash/fp/spread.d.ts +2 -0
- package/node_modules/@types/lodash/fp/spreadFrom.d.ts +2 -0
- package/node_modules/@types/lodash/fp/startCase.d.ts +2 -0
- package/node_modules/@types/lodash/fp/startsWith.d.ts +2 -0
- package/node_modules/@types/lodash/fp/stubArray.d.ts +2 -0
- package/node_modules/@types/lodash/fp/stubFalse.d.ts +2 -0
- package/node_modules/@types/lodash/fp/stubObject.d.ts +2 -0
- package/node_modules/@types/lodash/fp/stubString.d.ts +2 -0
- package/node_modules/@types/lodash/fp/stubTrue.d.ts +2 -0
- package/node_modules/@types/lodash/fp/subtract.d.ts +2 -0
- package/node_modules/@types/lodash/fp/sum.d.ts +2 -0
- package/node_modules/@types/lodash/fp/sumBy.d.ts +2 -0
- package/node_modules/@types/lodash/fp/symmetricDifference.d.ts +2 -0
- package/node_modules/@types/lodash/fp/symmetricDifferenceBy.d.ts +2 -0
- package/node_modules/@types/lodash/fp/symmetricDifferenceWith.d.ts +2 -0
- package/node_modules/@types/lodash/fp/tail.d.ts +2 -0
- package/node_modules/@types/lodash/fp/take.d.ts +2 -0
- package/node_modules/@types/lodash/fp/takeLast.d.ts +2 -0
- package/node_modules/@types/lodash/fp/takeLastWhile.d.ts +2 -0
- package/node_modules/@types/lodash/fp/takeRight.d.ts +2 -0
- package/node_modules/@types/lodash/fp/takeRightWhile.d.ts +2 -0
- package/node_modules/@types/lodash/fp/takeWhile.d.ts +2 -0
- package/node_modules/@types/lodash/fp/tap.d.ts +2 -0
- package/node_modules/@types/lodash/fp/template.d.ts +2 -0
- package/node_modules/@types/lodash/fp/throttle.d.ts +2 -0
- package/node_modules/@types/lodash/fp/thru.d.ts +2 -0
- package/node_modules/@types/lodash/fp/times.d.ts +2 -0
- package/node_modules/@types/lodash/fp/toArray.d.ts +2 -0
- package/node_modules/@types/lodash/fp/toFinite.d.ts +2 -0
- package/node_modules/@types/lodash/fp/toInteger.d.ts +2 -0
- package/node_modules/@types/lodash/fp/toLength.d.ts +2 -0
- package/node_modules/@types/lodash/fp/toLower.d.ts +2 -0
- package/node_modules/@types/lodash/fp/toNumber.d.ts +2 -0
- package/node_modules/@types/lodash/fp/toPairs.d.ts +2 -0
- package/node_modules/@types/lodash/fp/toPairsIn.d.ts +2 -0
- package/node_modules/@types/lodash/fp/toPath.d.ts +2 -0
- package/node_modules/@types/lodash/fp/toPlainObject.d.ts +2 -0
- package/node_modules/@types/lodash/fp/toSafeInteger.d.ts +2 -0
- package/node_modules/@types/lodash/fp/toString.d.ts +2 -0
- package/node_modules/@types/lodash/fp/toUpper.d.ts +2 -0
- package/node_modules/@types/lodash/fp/transform.d.ts +2 -0
- package/node_modules/@types/lodash/fp/trim.d.ts +2 -0
- package/node_modules/@types/lodash/fp/trimChars.d.ts +2 -0
- package/node_modules/@types/lodash/fp/trimCharsEnd.d.ts +2 -0
- package/node_modules/@types/lodash/fp/trimCharsStart.d.ts +2 -0
- package/node_modules/@types/lodash/fp/trimEnd.d.ts +2 -0
- package/node_modules/@types/lodash/fp/trimStart.d.ts +2 -0
- package/node_modules/@types/lodash/fp/truncate.d.ts +2 -0
- package/node_modules/@types/lodash/fp/unapply.d.ts +2 -0
- package/node_modules/@types/lodash/fp/unary.d.ts +2 -0
- package/node_modules/@types/lodash/fp/unescape.d.ts +2 -0
- package/node_modules/@types/lodash/fp/union.d.ts +2 -0
- package/node_modules/@types/lodash/fp/unionBy.d.ts +2 -0
- package/node_modules/@types/lodash/fp/unionWith.d.ts +2 -0
- package/node_modules/@types/lodash/fp/uniq.d.ts +2 -0
- package/node_modules/@types/lodash/fp/uniqBy.d.ts +2 -0
- package/node_modules/@types/lodash/fp/uniqWith.d.ts +2 -0
- package/node_modules/@types/lodash/fp/uniqueId.d.ts +2 -0
- package/node_modules/@types/lodash/fp/unnest.d.ts +2 -0
- package/node_modules/@types/lodash/fp/unset.d.ts +2 -0
- package/node_modules/@types/lodash/fp/unzip.d.ts +2 -0
- package/node_modules/@types/lodash/fp/unzipWith.d.ts +2 -0
- package/node_modules/@types/lodash/fp/update.d.ts +2 -0
- package/node_modules/@types/lodash/fp/updateWith.d.ts +2 -0
- package/node_modules/@types/lodash/fp/upperCase.d.ts +2 -0
- package/node_modules/@types/lodash/fp/upperFirst.d.ts +2 -0
- package/node_modules/@types/lodash/fp/useWith.d.ts +2 -0
- package/node_modules/@types/lodash/fp/values.d.ts +2 -0
- package/node_modules/@types/lodash/fp/valuesIn.d.ts +2 -0
- package/node_modules/@types/lodash/fp/where.d.ts +2 -0
- package/node_modules/@types/lodash/fp/whereEq.d.ts +2 -0
- package/node_modules/@types/lodash/fp/without.d.ts +2 -0
- package/node_modules/@types/lodash/fp/words.d.ts +2 -0
- package/node_modules/@types/lodash/fp/wrap.d.ts +2 -0
- package/node_modules/@types/lodash/fp/xor.d.ts +2 -0
- package/node_modules/@types/lodash/fp/xorBy.d.ts +2 -0
- package/node_modules/@types/lodash/fp/xorWith.d.ts +2 -0
- package/node_modules/@types/lodash/fp/zip.d.ts +2 -0
- package/node_modules/@types/lodash/fp/zipAll.d.ts +2 -0
- package/node_modules/@types/lodash/fp/zipObj.d.ts +2 -0
- package/node_modules/@types/lodash/fp/zipObject.d.ts +2 -0
- package/node_modules/@types/lodash/fp/zipObjectDeep.d.ts +2 -0
- package/node_modules/@types/lodash/fp/zipWith.d.ts +2 -0
- package/node_modules/@types/lodash/fp.d.ts +4962 -0
- package/node_modules/@types/lodash/fromPairs.d.ts +2 -0
- package/node_modules/@types/lodash/functions.d.ts +2 -0
- package/node_modules/@types/lodash/functionsIn.d.ts +2 -0
- package/node_modules/@types/lodash/get.d.ts +2 -0
- package/node_modules/@types/lodash/groupBy.d.ts +2 -0
- package/node_modules/@types/lodash/gt.d.ts +2 -0
- package/node_modules/@types/lodash/gte.d.ts +2 -0
- package/node_modules/@types/lodash/has.d.ts +2 -0
- package/node_modules/@types/lodash/hasIn.d.ts +2 -0
- package/node_modules/@types/lodash/head.d.ts +2 -0
- package/node_modules/@types/lodash/identity.d.ts +2 -0
- package/node_modules/@types/lodash/inRange.d.ts +2 -0
- package/node_modules/@types/lodash/includes.d.ts +2 -0
- package/node_modules/@types/lodash/index.d.ts +21 -0
- package/node_modules/@types/lodash/indexOf.d.ts +2 -0
- package/node_modules/@types/lodash/initial.d.ts +2 -0
- package/node_modules/@types/lodash/intersection.d.ts +2 -0
- package/node_modules/@types/lodash/intersectionBy.d.ts +2 -0
- package/node_modules/@types/lodash/intersectionWith.d.ts +2 -0
- package/node_modules/@types/lodash/invert.d.ts +2 -0
- package/node_modules/@types/lodash/invertBy.d.ts +2 -0
- package/node_modules/@types/lodash/invoke.d.ts +2 -0
- package/node_modules/@types/lodash/invokeMap.d.ts +2 -0
- package/node_modules/@types/lodash/isArguments.d.ts +2 -0
- package/node_modules/@types/lodash/isArray.d.ts +2 -0
- package/node_modules/@types/lodash/isArrayBuffer.d.ts +2 -0
- package/node_modules/@types/lodash/isArrayLike.d.ts +2 -0
- package/node_modules/@types/lodash/isArrayLikeObject.d.ts +2 -0
- package/node_modules/@types/lodash/isBoolean.d.ts +2 -0
- package/node_modules/@types/lodash/isBuffer.d.ts +2 -0
- package/node_modules/@types/lodash/isDate.d.ts +2 -0
- package/node_modules/@types/lodash/isElement.d.ts +2 -0
- package/node_modules/@types/lodash/isEmpty.d.ts +2 -0
- package/node_modules/@types/lodash/isEqual.d.ts +2 -0
- package/node_modules/@types/lodash/isEqualWith.d.ts +2 -0
- package/node_modules/@types/lodash/isError.d.ts +2 -0
- package/node_modules/@types/lodash/isFinite.d.ts +2 -0
- package/node_modules/@types/lodash/isFunction.d.ts +2 -0
- package/node_modules/@types/lodash/isInteger.d.ts +2 -0
- package/node_modules/@types/lodash/isLength.d.ts +2 -0
- package/node_modules/@types/lodash/isMap.d.ts +2 -0
- package/node_modules/@types/lodash/isMatch.d.ts +2 -0
- package/node_modules/@types/lodash/isMatchWith.d.ts +2 -0
- package/node_modules/@types/lodash/isNaN.d.ts +2 -0
- package/node_modules/@types/lodash/isNative.d.ts +2 -0
- package/node_modules/@types/lodash/isNil.d.ts +2 -0
- package/node_modules/@types/lodash/isNull.d.ts +2 -0
- package/node_modules/@types/lodash/isNumber.d.ts +2 -0
- package/node_modules/@types/lodash/isObject.d.ts +2 -0
- package/node_modules/@types/lodash/isObjectLike.d.ts +2 -0
- package/node_modules/@types/lodash/isPlainObject.d.ts +2 -0
- package/node_modules/@types/lodash/isRegExp.d.ts +2 -0
- package/node_modules/@types/lodash/isSafeInteger.d.ts +2 -0
- package/node_modules/@types/lodash/isSet.d.ts +2 -0
- package/node_modules/@types/lodash/isString.d.ts +2 -0
- package/node_modules/@types/lodash/isSymbol.d.ts +2 -0
- package/node_modules/@types/lodash/isTypedArray.d.ts +2 -0
- package/node_modules/@types/lodash/isUndefined.d.ts +2 -0
- package/node_modules/@types/lodash/isWeakMap.d.ts +2 -0
- package/node_modules/@types/lodash/isWeakSet.d.ts +2 -0
- package/node_modules/@types/lodash/iteratee.d.ts +2 -0
- package/node_modules/@types/lodash/join.d.ts +2 -0
- package/node_modules/@types/lodash/kebabCase.d.ts +2 -0
- package/node_modules/@types/lodash/keyBy.d.ts +2 -0
- package/node_modules/@types/lodash/keys.d.ts +2 -0
- package/node_modules/@types/lodash/keysIn.d.ts +2 -0
- package/node_modules/@types/lodash/last.d.ts +2 -0
- package/node_modules/@types/lodash/lastIndexOf.d.ts +2 -0
- package/node_modules/@types/lodash/lowerCase.d.ts +2 -0
- package/node_modules/@types/lodash/lowerFirst.d.ts +2 -0
- package/node_modules/@types/lodash/lt.d.ts +2 -0
- package/node_modules/@types/lodash/lte.d.ts +2 -0
- package/node_modules/@types/lodash/map.d.ts +2 -0
- package/node_modules/@types/lodash/mapKeys.d.ts +2 -0
- package/node_modules/@types/lodash/mapValues.d.ts +2 -0
- package/node_modules/@types/lodash/matches.d.ts +2 -0
- package/node_modules/@types/lodash/matchesProperty.d.ts +2 -0
- package/node_modules/@types/lodash/max.d.ts +2 -0
- package/node_modules/@types/lodash/maxBy.d.ts +2 -0
- package/node_modules/@types/lodash/mean.d.ts +2 -0
- package/node_modules/@types/lodash/meanBy.d.ts +2 -0
- package/node_modules/@types/lodash/memoize.d.ts +2 -0
- package/node_modules/@types/lodash/merge.d.ts +2 -0
- package/node_modules/@types/lodash/mergeWith.d.ts +2 -0
- package/node_modules/@types/lodash/method.d.ts +2 -0
- package/node_modules/@types/lodash/methodOf.d.ts +2 -0
- package/node_modules/@types/lodash/min.d.ts +2 -0
- package/node_modules/@types/lodash/minBy.d.ts +2 -0
- package/node_modules/@types/lodash/mixin.d.ts +2 -0
- package/node_modules/@types/lodash/multiply.d.ts +2 -0
- package/node_modules/@types/lodash/negate.d.ts +2 -0
- package/node_modules/@types/lodash/noConflict.d.ts +2 -0
- package/node_modules/@types/lodash/noop.d.ts +2 -0
- package/node_modules/@types/lodash/now.d.ts +2 -0
- package/node_modules/@types/lodash/nth.d.ts +2 -0
- package/node_modules/@types/lodash/nthArg.d.ts +2 -0
- package/node_modules/@types/lodash/omit.d.ts +2 -0
- package/node_modules/@types/lodash/omitBy.d.ts +2 -0
- package/node_modules/@types/lodash/once.d.ts +2 -0
- package/node_modules/@types/lodash/orderBy.d.ts +2 -0
- package/node_modules/@types/lodash/over.d.ts +2 -0
- package/node_modules/@types/lodash/overArgs.d.ts +2 -0
- package/node_modules/@types/lodash/overEvery.d.ts +2 -0
- package/node_modules/@types/lodash/overSome.d.ts +2 -0
- package/node_modules/@types/lodash/package.json +56 -0
- package/node_modules/@types/lodash/pad.d.ts +2 -0
- package/node_modules/@types/lodash/padEnd.d.ts +2 -0
- package/node_modules/@types/lodash/padStart.d.ts +2 -0
- package/node_modules/@types/lodash/parseInt.d.ts +2 -0
- package/node_modules/@types/lodash/partial.d.ts +2 -0
- package/node_modules/@types/lodash/partialRight.d.ts +2 -0
- package/node_modules/@types/lodash/partition.d.ts +2 -0
- package/node_modules/@types/lodash/pick.d.ts +2 -0
- package/node_modules/@types/lodash/pickBy.d.ts +2 -0
- package/node_modules/@types/lodash/property.d.ts +2 -0
- package/node_modules/@types/lodash/propertyOf.d.ts +2 -0
- package/node_modules/@types/lodash/pull.d.ts +2 -0
- package/node_modules/@types/lodash/pullAll.d.ts +2 -0
- package/node_modules/@types/lodash/pullAllBy.d.ts +2 -0
- package/node_modules/@types/lodash/pullAllWith.d.ts +2 -0
- package/node_modules/@types/lodash/pullAt.d.ts +2 -0
- package/node_modules/@types/lodash/random.d.ts +2 -0
- package/node_modules/@types/lodash/range.d.ts +2 -0
- package/node_modules/@types/lodash/rangeRight.d.ts +2 -0
- package/node_modules/@types/lodash/rearg.d.ts +2 -0
- package/node_modules/@types/lodash/reduce.d.ts +2 -0
- package/node_modules/@types/lodash/reduceRight.d.ts +2 -0
- package/node_modules/@types/lodash/reject.d.ts +2 -0
- package/node_modules/@types/lodash/remove.d.ts +2 -0
- package/node_modules/@types/lodash/repeat.d.ts +2 -0
- package/node_modules/@types/lodash/replace.d.ts +2 -0
- package/node_modules/@types/lodash/rest.d.ts +2 -0
- package/node_modules/@types/lodash/result.d.ts +2 -0
- package/node_modules/@types/lodash/reverse.d.ts +2 -0
- package/node_modules/@types/lodash/round.d.ts +2 -0
- package/node_modules/@types/lodash/runInContext.d.ts +2 -0
- package/node_modules/@types/lodash/sample.d.ts +2 -0
- package/node_modules/@types/lodash/sampleSize.d.ts +2 -0
- package/node_modules/@types/lodash/set.d.ts +2 -0
- package/node_modules/@types/lodash/setWith.d.ts +2 -0
- package/node_modules/@types/lodash/shuffle.d.ts +2 -0
- package/node_modules/@types/lodash/size.d.ts +2 -0
- package/node_modules/@types/lodash/slice.d.ts +2 -0
- package/node_modules/@types/lodash/snakeCase.d.ts +2 -0
- package/node_modules/@types/lodash/some.d.ts +2 -0
- package/node_modules/@types/lodash/sortBy.d.ts +2 -0
- package/node_modules/@types/lodash/sortedIndex.d.ts +2 -0
- package/node_modules/@types/lodash/sortedIndexBy.d.ts +2 -0
- package/node_modules/@types/lodash/sortedIndexOf.d.ts +2 -0
- package/node_modules/@types/lodash/sortedLastIndex.d.ts +2 -0
- package/node_modules/@types/lodash/sortedLastIndexBy.d.ts +2 -0
- package/node_modules/@types/lodash/sortedLastIndexOf.d.ts +2 -0
- package/node_modules/@types/lodash/sortedUniq.d.ts +2 -0
- package/node_modules/@types/lodash/sortedUniqBy.d.ts +2 -0
- package/node_modules/@types/lodash/split.d.ts +2 -0
- package/node_modules/@types/lodash/spread.d.ts +2 -0
- package/node_modules/@types/lodash/startCase.d.ts +2 -0
- package/node_modules/@types/lodash/startsWith.d.ts +2 -0
- package/node_modules/@types/lodash/stubFalse.d.ts +2 -0
- package/node_modules/@types/lodash/stubTrue.d.ts +2 -0
- package/node_modules/@types/lodash/subtract.d.ts +2 -0
- package/node_modules/@types/lodash/sum.d.ts +2 -0
- package/node_modules/@types/lodash/sumBy.d.ts +2 -0
- package/node_modules/@types/lodash/tail.d.ts +2 -0
- package/node_modules/@types/lodash/take.d.ts +2 -0
- package/node_modules/@types/lodash/takeRight.d.ts +2 -0
- package/node_modules/@types/lodash/takeRightWhile.d.ts +2 -0
- package/node_modules/@types/lodash/takeWhile.d.ts +2 -0
- package/node_modules/@types/lodash/tap.d.ts +2 -0
- package/node_modules/@types/lodash/template.d.ts +2 -0
- package/node_modules/@types/lodash/throttle.d.ts +2 -0
- package/node_modules/@types/lodash/thru.d.ts +2 -0
- package/node_modules/@types/lodash/times.d.ts +2 -0
- package/node_modules/@types/lodash/toArray.d.ts +2 -0
- package/node_modules/@types/lodash/toFinite.d.ts +2 -0
- package/node_modules/@types/lodash/toInteger.d.ts +2 -0
- package/node_modules/@types/lodash/toLength.d.ts +2 -0
- package/node_modules/@types/lodash/toLower.d.ts +2 -0
- package/node_modules/@types/lodash/toNumber.d.ts +2 -0
- package/node_modules/@types/lodash/toPairs.d.ts +2 -0
- package/node_modules/@types/lodash/toPairsIn.d.ts +2 -0
- package/node_modules/@types/lodash/toPath.d.ts +2 -0
- package/node_modules/@types/lodash/toPlainObject.d.ts +2 -0
- package/node_modules/@types/lodash/toSafeInteger.d.ts +2 -0
- package/node_modules/@types/lodash/toString.d.ts +2 -0
- package/node_modules/@types/lodash/toUpper.d.ts +2 -0
- package/node_modules/@types/lodash/transform.d.ts +2 -0
- package/node_modules/@types/lodash/trim.d.ts +2 -0
- package/node_modules/@types/lodash/trimEnd.d.ts +2 -0
- package/node_modules/@types/lodash/trimStart.d.ts +2 -0
- package/node_modules/@types/lodash/truncate.d.ts +2 -0
- package/node_modules/@types/lodash/unary.d.ts +2 -0
- package/node_modules/@types/lodash/unescape.d.ts +2 -0
- package/node_modules/@types/lodash/union.d.ts +2 -0
- package/node_modules/@types/lodash/unionBy.d.ts +2 -0
- package/node_modules/@types/lodash/unionWith.d.ts +2 -0
- package/node_modules/@types/lodash/uniq.d.ts +2 -0
- package/node_modules/@types/lodash/uniqBy.d.ts +2 -0
- package/node_modules/@types/lodash/uniqWith.d.ts +2 -0
- package/node_modules/@types/lodash/uniqueId.d.ts +2 -0
- package/node_modules/@types/lodash/unset.d.ts +2 -0
- package/node_modules/@types/lodash/unzip.d.ts +2 -0
- package/node_modules/@types/lodash/unzipWith.d.ts +2 -0
- package/node_modules/@types/lodash/update.d.ts +2 -0
- package/node_modules/@types/lodash/updateWith.d.ts +2 -0
- package/node_modules/@types/lodash/upperCase.d.ts +2 -0
- package/node_modules/@types/lodash/upperFirst.d.ts +2 -0
- package/node_modules/@types/lodash/values.d.ts +2 -0
- package/node_modules/@types/lodash/valuesIn.d.ts +2 -0
- package/node_modules/@types/lodash/without.d.ts +2 -0
- package/node_modules/@types/lodash/words.d.ts +2 -0
- package/node_modules/@types/lodash/wrap.d.ts +2 -0
- package/node_modules/@types/lodash/xor.d.ts +2 -0
- package/node_modules/@types/lodash/xorBy.d.ts +2 -0
- package/node_modules/@types/lodash/xorWith.d.ts +2 -0
- package/node_modules/@types/lodash/zip.d.ts +2 -0
- package/node_modules/@types/lodash/zipObject.d.ts +2 -0
- package/node_modules/@types/lodash/zipObjectDeep.d.ts +2 -0
- package/node_modules/@types/lodash/zipWith.d.ts +2 -0
- package/node_modules/@types/lodash.transform/LICENSE +21 -0
- package/node_modules/@types/lodash.transform/README.md +23 -0
- package/node_modules/@types/lodash.transform/index.d.ts +4 -0
- package/node_modules/@types/lodash.transform/package.json +32 -0
- package/node_modules/@types/uuid/LICENSE +21 -0
- package/node_modules/@types/uuid/README.md +15 -0
- package/node_modules/@types/uuid/index.d.mts +19 -0
- package/node_modules/@types/uuid/index.d.ts +113 -0
- package/node_modules/@types/uuid/package.json +54 -0
- package/node_modules/big-integer/BigInteger.d.ts +2393 -0
- package/node_modules/big-integer/BigInteger.js +1453 -0
- package/node_modules/big-integer/BigInteger.min.js +1 -0
- package/node_modules/big-integer/LICENSE +24 -0
- package/node_modules/big-integer/README.md +589 -0
- package/node_modules/big-integer/bower.json +29 -0
- package/node_modules/big-integer/package.json +48 -0
- package/node_modules/big-integer/tsconfig.json +24 -0
- package/node_modules/decimal.js-light/CHANGELOG.md +87 -0
- package/node_modules/decimal.js-light/LICENCE.md +23 -0
- package/node_modules/decimal.js-light/README.md +92 -0
- package/node_modules/decimal.js-light/decimal.d.ts +570 -0
- package/node_modules/decimal.js-light/decimal.js +2014 -0
- package/node_modules/decimal.js-light/decimal.min.js +3 -0
- package/node_modules/decimal.js-light/decimal.mjs +1985 -0
- package/node_modules/decimal.js-light/doc/API.html +1312 -0
- package/node_modules/decimal.js-light/doc/decimal.js.map +1 -0
- package/node_modules/decimal.js-light/package.json +36 -0
- package/node_modules/eventemitter3/LICENSE +21 -0
- package/node_modules/eventemitter3/README.md +85 -0
- package/node_modules/eventemitter3/dist/eventemitter3.esm.js +355 -0
- package/node_modules/eventemitter3/dist/eventemitter3.esm.min.js +1 -0
- package/node_modules/eventemitter3/dist/eventemitter3.esm.min.js.map +1 -0
- package/node_modules/eventemitter3/dist/eventemitter3.umd.js +363 -0
- package/node_modules/eventemitter3/dist/eventemitter3.umd.min.js +1 -0
- package/node_modules/eventemitter3/dist/eventemitter3.umd.min.js.map +1 -0
- package/node_modules/eventemitter3/index.d.ts +135 -0
- package/node_modules/eventemitter3/index.js +336 -0
- package/node_modules/eventemitter3/index.mjs +4 -0
- package/node_modules/eventemitter3/package.json +62 -0
- package/node_modules/lodash.transform/LICENSE +47 -0
- package/node_modules/lodash.transform/README.md +18 -0
- package/node_modules/lodash.transform/index.js +2329 -0
- package/node_modules/lodash.transform/package.json +17 -0
- package/node_modules/uuid/LICENSE.md +9 -0
- package/node_modules/uuid/README.md +491 -0
- package/node_modules/uuid/dist/index.d.ts +15 -0
- package/node_modules/uuid/dist/index.js +14 -0
- package/node_modules/uuid/dist/max.d.ts +2 -0
- package/node_modules/uuid/dist/max.js +1 -0
- package/node_modules/uuid/dist/md5.d.ts +2 -0
- package/node_modules/uuid/dist/md5.js +135 -0
- package/node_modules/uuid/dist/nil.d.ts +2 -0
- package/node_modules/uuid/dist/nil.js +1 -0
- package/node_modules/uuid/dist/parse.d.ts +3 -0
- package/node_modules/uuid/dist/parse.js +9 -0
- package/node_modules/uuid/dist/regex.d.ts +2 -0
- package/node_modules/uuid/dist/regex.js +1 -0
- package/node_modules/uuid/dist/rng.d.ts +1 -0
- package/node_modules/uuid/dist/rng.js +4 -0
- package/node_modules/uuid/dist/sha1.d.ts +2 -0
- package/node_modules/uuid/dist/sha1.js +70 -0
- package/node_modules/uuid/dist/stringify.d.ts +3 -0
- package/node_modules/uuid/dist/stringify.js +35 -0
- package/node_modules/uuid/dist/types.d.ts +22 -0
- package/node_modules/uuid/dist/types.js +1 -0
- package/node_modules/uuid/dist/uuid-bin.d.ts +1 -0
- package/node_modules/uuid/dist/uuid-bin.js +70 -0
- package/node_modules/uuid/dist/v1.d.ts +11 -0
- package/node_modules/uuid/dist/v1.js +83 -0
- package/node_modules/uuid/dist/v1ToV6.d.ts +3 -0
- package/node_modules/uuid/dist/v1ToV6.js +10 -0
- package/node_modules/uuid/dist/v3.d.ts +9 -0
- package/node_modules/uuid/dist/v3.js +9 -0
- package/node_modules/uuid/dist/v35.d.ts +7 -0
- package/node_modules/uuid/dist/v35.js +39 -0
- package/node_modules/uuid/dist/v4.d.ts +4 -0
- package/node_modules/uuid/dist/v4.js +29 -0
- package/node_modules/uuid/dist/v5.d.ts +9 -0
- package/node_modules/uuid/dist/v5.js +9 -0
- package/node_modules/uuid/dist/v6.d.ts +4 -0
- package/node_modules/uuid/dist/v6.js +20 -0
- package/node_modules/uuid/dist/v6ToV1.d.ts +2 -0
- package/node_modules/uuid/dist/v6ToV1.js +10 -0
- package/node_modules/uuid/dist/v7.d.ts +9 -0
- package/node_modules/uuid/dist/v7.js +65 -0
- package/node_modules/uuid/dist/validate.d.ts +2 -0
- package/node_modules/uuid/dist/validate.js +5 -0
- package/node_modules/uuid/dist/version.d.ts +2 -0
- package/node_modules/uuid/dist/version.js +8 -0
- package/node_modules/uuid/dist-node/bin/uuid +2 -0
- package/node_modules/uuid/dist-node/index.js +14 -0
- package/node_modules/uuid/dist-node/max.js +1 -0
- package/node_modules/uuid/dist-node/md5.js +11 -0
- package/node_modules/uuid/dist-node/nil.js +1 -0
- package/node_modules/uuid/dist-node/parse.js +9 -0
- package/node_modules/uuid/dist-node/regex.js +1 -0
- package/node_modules/uuid/dist-node/rng.js +4 -0
- package/node_modules/uuid/dist-node/sha1.js +11 -0
- package/node_modules/uuid/dist-node/stringify.js +35 -0
- package/node_modules/uuid/dist-node/types.js +1 -0
- package/node_modules/uuid/dist-node/uuid-bin.js +70 -0
- package/node_modules/uuid/dist-node/v1.js +83 -0
- package/node_modules/uuid/dist-node/v1ToV6.js +10 -0
- package/node_modules/uuid/dist-node/v3.js +9 -0
- package/node_modules/uuid/dist-node/v35.js +39 -0
- package/node_modules/uuid/dist-node/v4.js +29 -0
- package/node_modules/uuid/dist-node/v5.js +9 -0
- package/node_modules/uuid/dist-node/v6.js +20 -0
- package/node_modules/uuid/dist-node/v6ToV1.js +10 -0
- package/node_modules/uuid/dist-node/v7.js +65 -0
- package/node_modules/uuid/dist-node/validate.js +5 -0
- package/node_modules/uuid/dist-node/version.js +8 -0
- package/node_modules/uuid/package.json +110 -0
- package/node_modules/zod/LICENSE +21 -0
- package/node_modules/zod/README.md +208 -0
- package/node_modules/zod/index.cjs +33 -0
- package/node_modules/zod/index.d.cts +4 -0
- package/node_modules/zod/index.d.ts +4 -0
- package/node_modules/zod/index.js +4 -0
- package/node_modules/zod/package.json +118 -0
- package/node_modules/zod/src/index.ts +4 -0
- package/node_modules/zod/src/v3/ZodError.ts +330 -0
- package/node_modules/zod/src/v3/benchmarks/datetime.ts +58 -0
- package/node_modules/zod/src/v3/benchmarks/discriminatedUnion.ts +80 -0
- package/node_modules/zod/src/v3/benchmarks/index.ts +59 -0
- package/node_modules/zod/src/v3/benchmarks/ipv4.ts +57 -0
- package/node_modules/zod/src/v3/benchmarks/object.ts +69 -0
- package/node_modules/zod/src/v3/benchmarks/primitives.ts +162 -0
- package/node_modules/zod/src/v3/benchmarks/realworld.ts +63 -0
- package/node_modules/zod/src/v3/benchmarks/string.ts +55 -0
- package/node_modules/zod/src/v3/benchmarks/union.ts +80 -0
- package/node_modules/zod/src/v3/errors.ts +13 -0
- package/node_modules/zod/src/v3/external.ts +6 -0
- package/node_modules/zod/src/v3/helpers/enumUtil.ts +17 -0
- package/node_modules/zod/src/v3/helpers/errorUtil.ts +8 -0
- package/node_modules/zod/src/v3/helpers/parseUtil.ts +176 -0
- package/node_modules/zod/src/v3/helpers/partialUtil.ts +34 -0
- package/node_modules/zod/src/v3/helpers/typeAliases.ts +2 -0
- package/node_modules/zod/src/v3/helpers/util.ts +224 -0
- package/node_modules/zod/src/v3/index.ts +4 -0
- package/node_modules/zod/src/v3/locales/en.ts +124 -0
- package/node_modules/zod/src/v3/standard-schema.ts +113 -0
- package/node_modules/zod/src/v3/tests/Mocker.ts +54 -0
- package/node_modules/zod/src/v3/tests/all-errors.test.ts +157 -0
- package/node_modules/zod/src/v3/tests/anyunknown.test.ts +28 -0
- package/node_modules/zod/src/v3/tests/array.test.ts +71 -0
- package/node_modules/zod/src/v3/tests/async-parsing.test.ts +388 -0
- package/node_modules/zod/src/v3/tests/async-refinements.test.ts +46 -0
- package/node_modules/zod/src/v3/tests/base.test.ts +29 -0
- package/node_modules/zod/src/v3/tests/bigint.test.ts +55 -0
- package/node_modules/zod/src/v3/tests/branded.test.ts +53 -0
- package/node_modules/zod/src/v3/tests/catch.test.ts +220 -0
- package/node_modules/zod/src/v3/tests/coerce.test.ts +133 -0
- package/node_modules/zod/src/v3/tests/complex.test.ts +56 -0
- package/node_modules/zod/src/v3/tests/custom.test.ts +31 -0
- package/node_modules/zod/src/v3/tests/date.test.ts +32 -0
- package/node_modules/zod/src/v3/tests/deepmasking.test.ts +186 -0
- package/node_modules/zod/src/v3/tests/default.test.ts +112 -0
- package/node_modules/zod/src/v3/tests/description.test.ts +33 -0
- package/node_modules/zod/src/v3/tests/discriminated-unions.test.ts +315 -0
- package/node_modules/zod/src/v3/tests/enum.test.ts +80 -0
- package/node_modules/zod/src/v3/tests/error.test.ts +551 -0
- package/node_modules/zod/src/v3/tests/firstparty.test.ts +87 -0
- package/node_modules/zod/src/v3/tests/firstpartyschematypes.test.ts +21 -0
- package/node_modules/zod/src/v3/tests/function.test.ts +257 -0
- package/node_modules/zod/src/v3/tests/generics.test.ts +48 -0
- package/node_modules/zod/src/v3/tests/instanceof.test.ts +37 -0
- package/node_modules/zod/src/v3/tests/intersection.test.ts +110 -0
- package/node_modules/zod/src/v3/tests/language-server.source.ts +76 -0
- package/node_modules/zod/src/v3/tests/language-server.test.ts +207 -0
- package/node_modules/zod/src/v3/tests/literal.test.ts +36 -0
- package/node_modules/zod/src/v3/tests/map.test.ts +110 -0
- package/node_modules/zod/src/v3/tests/masking.test.ts +4 -0
- package/node_modules/zod/src/v3/tests/mocker.test.ts +19 -0
- package/node_modules/zod/src/v3/tests/nan.test.ts +21 -0
- package/node_modules/zod/src/v3/tests/nativeEnum.test.ts +87 -0
- package/node_modules/zod/src/v3/tests/nullable.test.ts +42 -0
- package/node_modules/zod/src/v3/tests/number.test.ts +176 -0
- package/node_modules/zod/src/v3/tests/object-augmentation.test.ts +29 -0
- package/node_modules/zod/src/v3/tests/object-in-es5-env.test.ts +29 -0
- package/node_modules/zod/src/v3/tests/object.test.ts +434 -0
- package/node_modules/zod/src/v3/tests/optional.test.ts +42 -0
- package/node_modules/zod/src/v3/tests/parseUtil.test.ts +23 -0
- package/node_modules/zod/src/v3/tests/parser.test.ts +41 -0
- package/node_modules/zod/src/v3/tests/partials.test.ts +243 -0
- package/node_modules/zod/src/v3/tests/pickomit.test.ts +111 -0
- package/node_modules/zod/src/v3/tests/pipeline.test.ts +29 -0
- package/node_modules/zod/src/v3/tests/preprocess.test.ts +186 -0
- package/node_modules/zod/src/v3/tests/primitive.test.ts +440 -0
- package/node_modules/zod/src/v3/tests/promise.test.ts +90 -0
- package/node_modules/zod/src/v3/tests/readonly.test.ts +194 -0
- package/node_modules/zod/src/v3/tests/record.test.ts +171 -0
- package/node_modules/zod/src/v3/tests/recursive.test.ts +197 -0
- package/node_modules/zod/src/v3/tests/refine.test.ts +313 -0
- package/node_modules/zod/src/v3/tests/safeparse.test.ts +27 -0
- package/node_modules/zod/src/v3/tests/set.test.ts +142 -0
- package/node_modules/zod/src/v3/tests/standard-schema.test.ts +83 -0
- package/node_modules/zod/src/v3/tests/string.test.ts +916 -0
- package/node_modules/zod/src/v3/tests/transformer.test.ts +233 -0
- package/node_modules/zod/src/v3/tests/tuple.test.ts +90 -0
- package/node_modules/zod/src/v3/tests/unions.test.ts +57 -0
- package/node_modules/zod/src/v3/tests/validations.test.ts +133 -0
- package/node_modules/zod/src/v3/tests/void.test.ts +15 -0
- package/node_modules/zod/src/v3/types.ts +5136 -0
- package/node_modules/zod/src/v4/classic/checks.ts +30 -0
- package/node_modules/zod/src/v4/classic/coerce.ts +27 -0
- package/node_modules/zod/src/v4/classic/compat.ts +66 -0
- package/node_modules/zod/src/v4/classic/errors.ts +75 -0
- package/node_modules/zod/src/v4/classic/external.ts +50 -0
- package/node_modules/zod/src/v4/classic/index.ts +5 -0
- package/node_modules/zod/src/v4/classic/iso.ts +90 -0
- package/node_modules/zod/src/v4/classic/parse.ts +33 -0
- package/node_modules/zod/src/v4/classic/schemas.ts +2054 -0
- package/node_modules/zod/src/v4/classic/tests/anyunknown.test.ts +26 -0
- package/node_modules/zod/src/v4/classic/tests/array.test.ts +264 -0
- package/node_modules/zod/src/v4/classic/tests/assignability.test.ts +210 -0
- package/node_modules/zod/src/v4/classic/tests/async-parsing.test.ts +381 -0
- package/node_modules/zod/src/v4/classic/tests/async-refinements.test.ts +68 -0
- package/node_modules/zod/src/v4/classic/tests/base.test.ts +7 -0
- package/node_modules/zod/src/v4/classic/tests/bigint.test.ts +54 -0
- package/node_modules/zod/src/v4/classic/tests/brand.test.ts +63 -0
- package/node_modules/zod/src/v4/classic/tests/catch.test.ts +252 -0
- package/node_modules/zod/src/v4/classic/tests/coalesce.test.ts +20 -0
- package/node_modules/zod/src/v4/classic/tests/coerce.test.ts +160 -0
- package/node_modules/zod/src/v4/classic/tests/continuability.test.ts +352 -0
- package/node_modules/zod/src/v4/classic/tests/custom.test.ts +40 -0
- package/node_modules/zod/src/v4/classic/tests/date.test.ts +31 -0
- package/node_modules/zod/src/v4/classic/tests/datetime.test.ts +296 -0
- package/node_modules/zod/src/v4/classic/tests/default.test.ts +313 -0
- package/node_modules/zod/src/v4/classic/tests/description.test.ts +32 -0
- package/node_modules/zod/src/v4/classic/tests/discriminated-unions.test.ts +619 -0
- package/node_modules/zod/src/v4/classic/tests/enum.test.ts +285 -0
- package/node_modules/zod/src/v4/classic/tests/error-utils.test.ts +527 -0
- package/node_modules/zod/src/v4/classic/tests/error.test.ts +711 -0
- package/node_modules/zod/src/v4/classic/tests/file.test.ts +91 -0
- package/node_modules/zod/src/v4/classic/tests/firstparty.test.ts +175 -0
- package/node_modules/zod/src/v4/classic/tests/function.test.ts +268 -0
- package/node_modules/zod/src/v4/classic/tests/generics.test.ts +72 -0
- package/node_modules/zod/src/v4/classic/tests/index.test.ts +829 -0
- package/node_modules/zod/src/v4/classic/tests/instanceof.test.ts +34 -0
- package/node_modules/zod/src/v4/classic/tests/intersection.test.ts +171 -0
- package/node_modules/zod/src/v4/classic/tests/json.test.ts +108 -0
- package/node_modules/zod/src/v4/classic/tests/lazy.test.ts +227 -0
- package/node_modules/zod/src/v4/classic/tests/literal.test.ts +92 -0
- package/node_modules/zod/src/v4/classic/tests/map.test.ts +196 -0
- package/node_modules/zod/src/v4/classic/tests/nan.test.ts +21 -0
- package/node_modules/zod/src/v4/classic/tests/nested-refine.test.ts +168 -0
- package/node_modules/zod/src/v4/classic/tests/nonoptional.test.ts +86 -0
- package/node_modules/zod/src/v4/classic/tests/nullable.test.ts +22 -0
- package/node_modules/zod/src/v4/classic/tests/number.test.ts +247 -0
- package/node_modules/zod/src/v4/classic/tests/object.test.ts +563 -0
- package/node_modules/zod/src/v4/classic/tests/optional.test.ts +123 -0
- package/node_modules/zod/src/v4/classic/tests/partial.test.ts +147 -0
- package/node_modules/zod/src/v4/classic/tests/pickomit.test.ts +127 -0
- package/node_modules/zod/src/v4/classic/tests/pipe.test.ts +81 -0
- package/node_modules/zod/src/v4/classic/tests/prefault.test.ts +37 -0
- package/node_modules/zod/src/v4/classic/tests/preprocess.test.ts +298 -0
- package/node_modules/zod/src/v4/classic/tests/primitive.test.ts +175 -0
- package/node_modules/zod/src/v4/classic/tests/promise.test.ts +81 -0
- package/node_modules/zod/src/v4/classic/tests/prototypes.test.ts +23 -0
- package/node_modules/zod/src/v4/classic/tests/readonly.test.ts +252 -0
- package/node_modules/zod/src/v4/classic/tests/record.test.ts +342 -0
- package/node_modules/zod/src/v4/classic/tests/recursive-types.test.ts +356 -0
- package/node_modules/zod/src/v4/classic/tests/refine.test.ts +532 -0
- package/node_modules/zod/src/v4/classic/tests/registries.test.ts +204 -0
- package/node_modules/zod/src/v4/classic/tests/set.test.ts +179 -0
- package/node_modules/zod/src/v4/classic/tests/standard-schema.test.ts +57 -0
- package/node_modules/zod/src/v4/classic/tests/string-formats.test.ts +109 -0
- package/node_modules/zod/src/v4/classic/tests/string.test.ts +881 -0
- package/node_modules/zod/src/v4/classic/tests/stringbool.test.ts +66 -0
- package/node_modules/zod/src/v4/classic/tests/template-literal.test.ts +758 -0
- package/node_modules/zod/src/v4/classic/tests/to-json-schema.test.ts +2314 -0
- package/node_modules/zod/src/v4/classic/tests/transform.test.ts +250 -0
- package/node_modules/zod/src/v4/classic/tests/tuple.test.ts +163 -0
- package/node_modules/zod/src/v4/classic/tests/union.test.ts +94 -0
- package/node_modules/zod/src/v4/classic/tests/validations.test.ts +283 -0
- package/node_modules/zod/src/v4/classic/tests/void.test.ts +12 -0
- package/node_modules/zod/src/v4/core/api.ts +1594 -0
- package/node_modules/zod/src/v4/core/checks.ts +1283 -0
- package/node_modules/zod/src/v4/core/config.ts +15 -0
- package/node_modules/zod/src/v4/core/core.ts +134 -0
- package/node_modules/zod/src/v4/core/doc.ts +44 -0
- package/node_modules/zod/src/v4/core/errors.ts +424 -0
- package/node_modules/zod/src/v4/core/function.ts +176 -0
- package/node_modules/zod/src/v4/core/index.ts +15 -0
- package/node_modules/zod/src/v4/core/json-schema.ts +143 -0
- package/node_modules/zod/src/v4/core/parse.ts +94 -0
- package/node_modules/zod/src/v4/core/regexes.ts +135 -0
- package/node_modules/zod/src/v4/core/registries.ts +96 -0
- package/node_modules/zod/src/v4/core/schemas.ts +3842 -0
- package/node_modules/zod/src/v4/core/standard-schema.ts +64 -0
- package/node_modules/zod/src/v4/core/tests/index.test.ts +46 -0
- package/node_modules/zod/src/v4/core/tests/locales/be.test.ts +124 -0
- package/node_modules/zod/src/v4/core/tests/locales/en.test.ts +22 -0
- package/node_modules/zod/src/v4/core/tests/locales/ru.test.ts +128 -0
- package/node_modules/zod/src/v4/core/tests/locales/tr.test.ts +69 -0
- package/node_modules/zod/src/v4/core/to-json-schema.ts +977 -0
- package/node_modules/zod/src/v4/core/util.ts +775 -0
- package/node_modules/zod/src/v4/core/versions.ts +5 -0
- package/node_modules/zod/src/v4/core/zsf.ts +323 -0
- package/node_modules/zod/src/v4/index.ts +4 -0
- package/node_modules/zod/src/v4/locales/ar.ts +125 -0
- package/node_modules/zod/src/v4/locales/az.ts +121 -0
- package/node_modules/zod/src/v4/locales/be.ts +184 -0
- package/node_modules/zod/src/v4/locales/ca.ts +127 -0
- package/node_modules/zod/src/v4/locales/cs.ts +142 -0
- package/node_modules/zod/src/v4/locales/de.ts +124 -0
- package/node_modules/zod/src/v4/locales/en.ts +127 -0
- package/node_modules/zod/src/v4/locales/eo.ts +125 -0
- package/node_modules/zod/src/v4/locales/es.ts +125 -0
- package/node_modules/zod/src/v4/locales/fa.ts +134 -0
- package/node_modules/zod/src/v4/locales/fi.ts +131 -0
- package/node_modules/zod/src/v4/locales/fr-CA.ts +126 -0
- package/node_modules/zod/src/v4/locales/fr.ts +124 -0
- package/node_modules/zod/src/v4/locales/he.ts +125 -0
- package/node_modules/zod/src/v4/locales/hu.ts +126 -0
- package/node_modules/zod/src/v4/locales/id.ts +125 -0
- package/node_modules/zod/src/v4/locales/index.ts +39 -0
- package/node_modules/zod/src/v4/locales/it.ts +125 -0
- package/node_modules/zod/src/v4/locales/ja.ts +122 -0
- package/node_modules/zod/src/v4/locales/kh.ts +126 -0
- package/node_modules/zod/src/v4/locales/ko.ts +131 -0
- package/node_modules/zod/src/v4/locales/mk.ts +127 -0
- package/node_modules/zod/src/v4/locales/ms.ts +124 -0
- package/node_modules/zod/src/v4/locales/nl.ts +126 -0
- package/node_modules/zod/src/v4/locales/no.ts +124 -0
- package/node_modules/zod/src/v4/locales/ota.ts +125 -0
- package/node_modules/zod/src/v4/locales/pl.ts +126 -0
- package/node_modules/zod/src/v4/locales/ps.ts +133 -0
- package/node_modules/zod/src/v4/locales/pt.ts +123 -0
- package/node_modules/zod/src/v4/locales/ru.ts +184 -0
- package/node_modules/zod/src/v4/locales/sl.ts +126 -0
- package/node_modules/zod/src/v4/locales/sv.ts +127 -0
- package/node_modules/zod/src/v4/locales/ta.ts +125 -0
- package/node_modules/zod/src/v4/locales/th.ts +126 -0
- package/node_modules/zod/src/v4/locales/tr.ts +121 -0
- package/node_modules/zod/src/v4/locales/ua.ts +126 -0
- package/node_modules/zod/src/v4/locales/ur.ts +126 -0
- package/node_modules/zod/src/v4/locales/vi.ts +125 -0
- package/node_modules/zod/src/v4/locales/zh-CN.ts +123 -0
- package/node_modules/zod/src/v4/locales/zh-TW.ts +125 -0
- package/node_modules/zod/src/v4/mini/checks.ts +32 -0
- package/node_modules/zod/src/v4/mini/coerce.ts +22 -0
- package/node_modules/zod/src/v4/mini/external.ts +40 -0
- package/node_modules/zod/src/v4/mini/index.ts +3 -0
- package/node_modules/zod/src/v4/mini/iso.ts +62 -0
- package/node_modules/zod/src/v4/mini/parse.ts +1 -0
- package/node_modules/zod/src/v4/mini/schemas.ts +1579 -0
- package/node_modules/zod/src/v4/mini/tests/assignability.test.ts +129 -0
- package/node_modules/zod/src/v4/mini/tests/brand.test.ts +51 -0
- package/node_modules/zod/src/v4/mini/tests/checks.test.ts +144 -0
- package/node_modules/zod/src/v4/mini/tests/computed.test.ts +36 -0
- package/node_modules/zod/src/v4/mini/tests/error.test.ts +22 -0
- package/node_modules/zod/src/v4/mini/tests/functions.test.ts +43 -0
- package/node_modules/zod/src/v4/mini/tests/index.test.ts +871 -0
- package/node_modules/zod/src/v4/mini/tests/number.test.ts +95 -0
- package/node_modules/zod/src/v4/mini/tests/object.test.ts +185 -0
- package/node_modules/zod/src/v4/mini/tests/prototypes.test.ts +43 -0
- package/node_modules/zod/src/v4/mini/tests/recursive-types.test.ts +275 -0
- package/node_modules/zod/src/v4/mini/tests/string.test.ts +299 -0
- package/node_modules/zod/src/v4-mini/index.ts +1 -0
- package/node_modules/zod/v3/ZodError.cjs +138 -0
- package/node_modules/zod/v3/ZodError.d.cts +164 -0
- package/node_modules/zod/v3/ZodError.d.ts +164 -0
- package/node_modules/zod/v3/ZodError.js +133 -0
- package/node_modules/zod/v3/errors.cjs +17 -0
- package/node_modules/zod/v3/errors.d.cts +5 -0
- package/node_modules/zod/v3/errors.d.ts +5 -0
- package/node_modules/zod/v3/errors.js +9 -0
- package/node_modules/zod/v3/external.cjs +22 -0
- package/node_modules/zod/v3/external.d.cts +6 -0
- package/node_modules/zod/v3/external.d.ts +6 -0
- package/node_modules/zod/v3/external.js +6 -0
- package/node_modules/zod/v3/helpers/enumUtil.cjs +2 -0
- package/node_modules/zod/v3/helpers/enumUtil.d.cts +8 -0
- package/node_modules/zod/v3/helpers/enumUtil.d.ts +8 -0
- package/node_modules/zod/v3/helpers/enumUtil.js +1 -0
- package/node_modules/zod/v3/helpers/errorUtil.cjs +9 -0
- package/node_modules/zod/v3/helpers/errorUtil.d.cts +9 -0
- package/node_modules/zod/v3/helpers/errorUtil.d.ts +9 -0
- package/node_modules/zod/v3/helpers/errorUtil.js +6 -0
- package/node_modules/zod/v3/helpers/parseUtil.cjs +124 -0
- package/node_modules/zod/v3/helpers/parseUtil.d.cts +78 -0
- package/node_modules/zod/v3/helpers/parseUtil.d.ts +78 -0
- package/node_modules/zod/v3/helpers/parseUtil.js +109 -0
- package/node_modules/zod/v3/helpers/partialUtil.cjs +2 -0
- package/node_modules/zod/v3/helpers/partialUtil.d.cts +8 -0
- package/node_modules/zod/v3/helpers/partialUtil.d.ts +8 -0
- package/node_modules/zod/v3/helpers/partialUtil.js +1 -0
- package/node_modules/zod/v3/helpers/typeAliases.cjs +2 -0
- package/node_modules/zod/v3/helpers/typeAliases.d.cts +2 -0
- package/node_modules/zod/v3/helpers/typeAliases.d.ts +2 -0
- package/node_modules/zod/v3/helpers/typeAliases.js +1 -0
- package/node_modules/zod/v3/helpers/util.cjs +137 -0
- package/node_modules/zod/v3/helpers/util.d.cts +85 -0
- package/node_modules/zod/v3/helpers/util.d.ts +85 -0
- package/node_modules/zod/v3/helpers/util.js +133 -0
- package/node_modules/zod/v3/index.cjs +33 -0
- package/node_modules/zod/v3/index.d.cts +4 -0
- package/node_modules/zod/v3/index.d.ts +4 -0
- package/node_modules/zod/v3/index.js +4 -0
- package/node_modules/zod/v3/locales/en.cjs +111 -0
- package/node_modules/zod/v3/locales/en.d.cts +3 -0
- package/node_modules/zod/v3/locales/en.d.ts +3 -0
- package/node_modules/zod/v3/locales/en.js +109 -0
- package/node_modules/zod/v3/standard-schema.cjs +2 -0
- package/node_modules/zod/v3/standard-schema.d.cts +102 -0
- package/node_modules/zod/v3/standard-schema.d.ts +102 -0
- package/node_modules/zod/v3/standard-schema.js +1 -0
- package/node_modules/zod/v3/types.cjs +3775 -0
- package/node_modules/zod/v3/types.d.cts +1031 -0
- package/node_modules/zod/v3/types.d.ts +1031 -0
- package/node_modules/zod/v3/types.js +3693 -0
- package/node_modules/zod/v4/classic/checks.cjs +32 -0
- package/node_modules/zod/v4/classic/checks.d.cts +1 -0
- package/node_modules/zod/v4/classic/checks.d.ts +1 -0
- package/node_modules/zod/v4/classic/checks.js +1 -0
- package/node_modules/zod/v4/classic/coerce.cjs +47 -0
- package/node_modules/zod/v4/classic/coerce.d.cts +17 -0
- package/node_modules/zod/v4/classic/coerce.d.ts +17 -0
- package/node_modules/zod/v4/classic/coerce.js +17 -0
- package/node_modules/zod/v4/classic/compat.cjs +57 -0
- package/node_modules/zod/v4/classic/compat.d.cts +46 -0
- package/node_modules/zod/v4/classic/compat.d.ts +46 -0
- package/node_modules/zod/v4/classic/compat.js +27 -0
- package/node_modules/zod/v4/classic/errors.cjs +67 -0
- package/node_modules/zod/v4/classic/errors.d.cts +30 -0
- package/node_modules/zod/v4/classic/errors.d.ts +30 -0
- package/node_modules/zod/v4/classic/errors.js +41 -0
- package/node_modules/zod/v4/classic/external.cjs +70 -0
- package/node_modules/zod/v4/classic/external.d.cts +13 -0
- package/node_modules/zod/v4/classic/external.d.ts +13 -0
- package/node_modules/zod/v4/classic/external.js +18 -0
- package/node_modules/zod/v4/classic/index.cjs +33 -0
- package/node_modules/zod/v4/classic/index.d.cts +4 -0
- package/node_modules/zod/v4/classic/index.d.ts +4 -0
- package/node_modules/zod/v4/classic/index.js +4 -0
- package/node_modules/zod/v4/classic/iso.cjs +60 -0
- package/node_modules/zod/v4/classic/iso.d.cts +22 -0
- package/node_modules/zod/v4/classic/iso.d.ts +22 -0
- package/node_modules/zod/v4/classic/iso.js +30 -0
- package/node_modules/zod/v4/classic/parse.cjs +32 -0
- package/node_modules/zod/v4/classic/parse.d.cts +23 -0
- package/node_modules/zod/v4/classic/parse.d.ts +23 -0
- package/node_modules/zod/v4/classic/parse.js +6 -0
- package/node_modules/zod/v4/classic/schemas.cjs +1109 -0
- package/node_modules/zod/v4/classic/schemas.d.cts +630 -0
- package/node_modules/zod/v4/classic/schemas.d.ts +630 -0
- package/node_modules/zod/v4/classic/schemas.js +1006 -0
- package/node_modules/zod/v4/core/api.cjs +1039 -0
- package/node_modules/zod/v4/core/api.d.cts +284 -0
- package/node_modules/zod/v4/core/api.d.ts +284 -0
- package/node_modules/zod/v4/core/api.js +906 -0
- package/node_modules/zod/v4/core/checks.cjs +591 -0
- package/node_modules/zod/v4/core/checks.d.cts +278 -0
- package/node_modules/zod/v4/core/checks.d.ts +278 -0
- package/node_modules/zod/v4/core/checks.js +565 -0
- package/node_modules/zod/v4/core/core.cjs +67 -0
- package/node_modules/zod/v4/core/core.d.cts +49 -0
- package/node_modules/zod/v4/core/core.d.ts +49 -0
- package/node_modules/zod/v4/core/core.js +61 -0
- package/node_modules/zod/v4/core/doc.cjs +39 -0
- package/node_modules/zod/v4/core/doc.d.cts +14 -0
- package/node_modules/zod/v4/core/doc.d.ts +14 -0
- package/node_modules/zod/v4/core/doc.js +35 -0
- package/node_modules/zod/v4/core/errors.cjs +226 -0
- package/node_modules/zod/v4/core/errors.d.cts +208 -0
- package/node_modules/zod/v4/core/errors.d.ts +208 -0
- package/node_modules/zod/v4/core/errors.js +195 -0
- package/node_modules/zod/v4/core/function.cjs +102 -0
- package/node_modules/zod/v4/core/function.d.cts +52 -0
- package/node_modules/zod/v4/core/function.d.ts +52 -0
- package/node_modules/zod/v4/core/function.js +75 -0
- package/node_modules/zod/v4/core/index.cjs +44 -0
- package/node_modules/zod/v4/core/index.d.cts +15 -0
- package/node_modules/zod/v4/core/index.d.ts +15 -0
- package/node_modules/zod/v4/core/index.js +15 -0
- package/node_modules/zod/v4/core/json-schema.cjs +2 -0
- package/node_modules/zod/v4/core/json-schema.d.cts +87 -0
- package/node_modules/zod/v4/core/json-schema.d.ts +87 -0
- package/node_modules/zod/v4/core/json-schema.js +1 -0
- package/node_modules/zod/v4/core/parse.cjs +87 -0
- package/node_modules/zod/v4/core/parse.d.cts +25 -0
- package/node_modules/zod/v4/core/parse.d.ts +25 -0
- package/node_modules/zod/v4/core/parse.js +57 -0
- package/node_modules/zod/v4/core/regexes.cjs +103 -0
- package/node_modules/zod/v4/core/regexes.d.cts +62 -0
- package/node_modules/zod/v4/core/regexes.d.ts +62 -0
- package/node_modules/zod/v4/core/regexes.js +95 -0
- package/node_modules/zod/v4/core/registries.cjs +56 -0
- package/node_modules/zod/v4/core/registries.d.cts +35 -0
- package/node_modules/zod/v4/core/registries.d.ts +35 -0
- package/node_modules/zod/v4/core/registries.js +51 -0
- package/node_modules/zod/v4/core/schemas.cjs +1748 -0
- package/node_modules/zod/v4/core/schemas.d.cts +1041 -0
- package/node_modules/zod/v4/core/schemas.d.ts +1041 -0
- package/node_modules/zod/v4/core/schemas.js +1717 -0
- package/node_modules/zod/v4/core/standard-schema.cjs +2 -0
- package/node_modules/zod/v4/core/standard-schema.d.cts +55 -0
- package/node_modules/zod/v4/core/standard-schema.d.ts +55 -0
- package/node_modules/zod/v4/core/standard-schema.js +1 -0
- package/node_modules/zod/v4/core/to-json-schema.cjs +854 -0
- package/node_modules/zod/v4/core/to-json-schema.d.cts +88 -0
- package/node_modules/zod/v4/core/to-json-schema.d.ts +88 -0
- package/node_modules/zod/v4/core/to-json-schema.js +849 -0
- package/node_modules/zod/v4/core/util.cjs +539 -0
- package/node_modules/zod/v4/core/util.d.cts +183 -0
- package/node_modules/zod/v4/core/util.d.ts +183 -0
- package/node_modules/zod/v4/core/util.js +493 -0
- package/node_modules/zod/v4/core/versions.cjs +8 -0
- package/node_modules/zod/v4/core/versions.d.cts +5 -0
- package/node_modules/zod/v4/core/versions.d.ts +5 -0
- package/node_modules/zod/v4/core/versions.js +5 -0
- package/node_modules/zod/v4/index.cjs +22 -0
- package/node_modules/zod/v4/index.d.cts +3 -0
- package/node_modules/zod/v4/index.d.ts +3 -0
- package/node_modules/zod/v4/index.js +3 -0
- package/node_modules/zod/v4/locales/ar.cjs +142 -0
- package/node_modules/zod/v4/locales/ar.d.cts +4 -0
- package/node_modules/zod/v4/locales/ar.d.ts +4 -0
- package/node_modules/zod/v4/locales/ar.js +116 -0
- package/node_modules/zod/v4/locales/az.cjs +141 -0
- package/node_modules/zod/v4/locales/az.d.cts +4 -0
- package/node_modules/zod/v4/locales/az.d.ts +4 -0
- package/node_modules/zod/v4/locales/az.js +115 -0
- package/node_modules/zod/v4/locales/be.cjs +190 -0
- package/node_modules/zod/v4/locales/be.d.cts +4 -0
- package/node_modules/zod/v4/locales/be.d.ts +4 -0
- package/node_modules/zod/v4/locales/be.js +164 -0
- package/node_modules/zod/v4/locales/ca.cjs +144 -0
- package/node_modules/zod/v4/locales/ca.d.cts +4 -0
- package/node_modules/zod/v4/locales/ca.d.ts +4 -0
- package/node_modules/zod/v4/locales/ca.js +118 -0
- package/node_modules/zod/v4/locales/cs.cjs +161 -0
- package/node_modules/zod/v4/locales/cs.d.cts +4 -0
- package/node_modules/zod/v4/locales/cs.d.ts +4 -0
- package/node_modules/zod/v4/locales/cs.js +135 -0
- package/node_modules/zod/v4/locales/de.cjs +142 -0
- package/node_modules/zod/v4/locales/de.d.cts +4 -0
- package/node_modules/zod/v4/locales/de.d.ts +4 -0
- package/node_modules/zod/v4/locales/de.js +116 -0
- package/node_modules/zod/v4/locales/en.cjs +145 -0
- package/node_modules/zod/v4/locales/en.d.cts +5 -0
- package/node_modules/zod/v4/locales/en.d.ts +5 -0
- package/node_modules/zod/v4/locales/en.js +117 -0
- package/node_modules/zod/v4/locales/eo.cjs +144 -0
- package/node_modules/zod/v4/locales/eo.d.cts +5 -0
- package/node_modules/zod/v4/locales/eo.d.ts +5 -0
- package/node_modules/zod/v4/locales/eo.js +116 -0
- package/node_modules/zod/v4/locales/es.cjs +143 -0
- package/node_modules/zod/v4/locales/es.d.cts +4 -0
- package/node_modules/zod/v4/locales/es.d.ts +4 -0
- package/node_modules/zod/v4/locales/es.js +117 -0
- package/node_modules/zod/v4/locales/fa.cjs +148 -0
- package/node_modules/zod/v4/locales/fa.d.cts +4 -0
- package/node_modules/zod/v4/locales/fa.d.ts +4 -0
- package/node_modules/zod/v4/locales/fa.js +122 -0
- package/node_modules/zod/v4/locales/fi.cjs +148 -0
- package/node_modules/zod/v4/locales/fi.d.cts +4 -0
- package/node_modules/zod/v4/locales/fi.d.ts +4 -0
- package/node_modules/zod/v4/locales/fi.js +122 -0
- package/node_modules/zod/v4/locales/fr-CA.cjs +143 -0
- package/node_modules/zod/v4/locales/fr-CA.d.cts +4 -0
- package/node_modules/zod/v4/locales/fr-CA.d.ts +4 -0
- package/node_modules/zod/v4/locales/fr-CA.js +117 -0
- package/node_modules/zod/v4/locales/fr.cjs +142 -0
- package/node_modules/zod/v4/locales/fr.d.cts +4 -0
- package/node_modules/zod/v4/locales/fr.d.ts +4 -0
- package/node_modules/zod/v4/locales/fr.js +116 -0
- package/node_modules/zod/v4/locales/he.cjs +143 -0
- package/node_modules/zod/v4/locales/he.d.cts +4 -0
- package/node_modules/zod/v4/locales/he.d.ts +4 -0
- package/node_modules/zod/v4/locales/he.js +117 -0
- package/node_modules/zod/v4/locales/hu.cjs +143 -0
- package/node_modules/zod/v4/locales/hu.d.cts +4 -0
- package/node_modules/zod/v4/locales/hu.d.ts +4 -0
- package/node_modules/zod/v4/locales/hu.js +117 -0
- package/node_modules/zod/v4/locales/id.cjs +142 -0
- package/node_modules/zod/v4/locales/id.d.cts +4 -0
- package/node_modules/zod/v4/locales/id.d.ts +4 -0
- package/node_modules/zod/v4/locales/id.js +116 -0
- package/node_modules/zod/v4/locales/index.cjs +84 -0
- package/node_modules/zod/v4/locales/index.d.cts +39 -0
- package/node_modules/zod/v4/locales/index.d.ts +39 -0
- package/node_modules/zod/v4/locales/index.js +39 -0
- package/node_modules/zod/v4/locales/it.cjs +143 -0
- package/node_modules/zod/v4/locales/it.d.cts +4 -0
- package/node_modules/zod/v4/locales/it.d.ts +4 -0
- package/node_modules/zod/v4/locales/it.js +117 -0
- package/node_modules/zod/v4/locales/ja.cjs +141 -0
- package/node_modules/zod/v4/locales/ja.d.cts +4 -0
- package/node_modules/zod/v4/locales/ja.d.ts +4 -0
- package/node_modules/zod/v4/locales/ja.js +115 -0
- package/node_modules/zod/v4/locales/kh.cjs +143 -0
- package/node_modules/zod/v4/locales/kh.d.cts +4 -0
- package/node_modules/zod/v4/locales/kh.d.ts +4 -0
- package/node_modules/zod/v4/locales/kh.js +117 -0
- package/node_modules/zod/v4/locales/ko.cjs +147 -0
- package/node_modules/zod/v4/locales/ko.d.cts +4 -0
- package/node_modules/zod/v4/locales/ko.d.ts +4 -0
- package/node_modules/zod/v4/locales/ko.js +121 -0
- package/node_modules/zod/v4/locales/mk.cjs +144 -0
- package/node_modules/zod/v4/locales/mk.d.cts +4 -0
- package/node_modules/zod/v4/locales/mk.d.ts +4 -0
- package/node_modules/zod/v4/locales/mk.js +118 -0
- package/node_modules/zod/v4/locales/ms.cjs +142 -0
- package/node_modules/zod/v4/locales/ms.d.cts +4 -0
- package/node_modules/zod/v4/locales/ms.d.ts +4 -0
- package/node_modules/zod/v4/locales/ms.js +116 -0
- package/node_modules/zod/v4/locales/nl.cjs +143 -0
- package/node_modules/zod/v4/locales/nl.d.cts +4 -0
- package/node_modules/zod/v4/locales/nl.d.ts +4 -0
- package/node_modules/zod/v4/locales/nl.js +117 -0
- package/node_modules/zod/v4/locales/no.cjs +142 -0
- package/node_modules/zod/v4/locales/no.d.cts +4 -0
- package/node_modules/zod/v4/locales/no.d.ts +4 -0
- package/node_modules/zod/v4/locales/no.js +116 -0
- package/node_modules/zod/v4/locales/ota.cjs +143 -0
- package/node_modules/zod/v4/locales/ota.d.cts +4 -0
- package/node_modules/zod/v4/locales/ota.d.ts +4 -0
- package/node_modules/zod/v4/locales/ota.js +117 -0
- package/node_modules/zod/v4/locales/pl.cjs +143 -0
- package/node_modules/zod/v4/locales/pl.d.cts +4 -0
- package/node_modules/zod/v4/locales/pl.d.ts +4 -0
- package/node_modules/zod/v4/locales/pl.js +117 -0
- package/node_modules/zod/v4/locales/ps.cjs +148 -0
- package/node_modules/zod/v4/locales/ps.d.cts +4 -0
- package/node_modules/zod/v4/locales/ps.d.ts +4 -0
- package/node_modules/zod/v4/locales/ps.js +122 -0
- package/node_modules/zod/v4/locales/pt.cjs +142 -0
- package/node_modules/zod/v4/locales/pt.d.cts +4 -0
- package/node_modules/zod/v4/locales/pt.d.ts +4 -0
- package/node_modules/zod/v4/locales/pt.js +116 -0
- package/node_modules/zod/v4/locales/ru.cjs +190 -0
- package/node_modules/zod/v4/locales/ru.d.cts +4 -0
- package/node_modules/zod/v4/locales/ru.d.ts +4 -0
- package/node_modules/zod/v4/locales/ru.js +164 -0
- package/node_modules/zod/v4/locales/sl.cjs +143 -0
- package/node_modules/zod/v4/locales/sl.d.cts +4 -0
- package/node_modules/zod/v4/locales/sl.d.ts +4 -0
- package/node_modules/zod/v4/locales/sl.js +117 -0
- package/node_modules/zod/v4/locales/sv.cjs +144 -0
- package/node_modules/zod/v4/locales/sv.d.cts +4 -0
- package/node_modules/zod/v4/locales/sv.d.ts +4 -0
- package/node_modules/zod/v4/locales/sv.js +118 -0
- package/node_modules/zod/v4/locales/ta.cjs +143 -0
- package/node_modules/zod/v4/locales/ta.d.cts +4 -0
- package/node_modules/zod/v4/locales/ta.d.ts +4 -0
- package/node_modules/zod/v4/locales/ta.js +117 -0
- package/node_modules/zod/v4/locales/th.cjs +143 -0
- package/node_modules/zod/v4/locales/th.d.cts +4 -0
- package/node_modules/zod/v4/locales/th.d.ts +4 -0
- package/node_modules/zod/v4/locales/th.js +117 -0
- package/node_modules/zod/v4/locales/tr.cjs +143 -0
- package/node_modules/zod/v4/locales/tr.d.cts +5 -0
- package/node_modules/zod/v4/locales/tr.d.ts +5 -0
- package/node_modules/zod/v4/locales/tr.js +115 -0
- package/node_modules/zod/v4/locales/ua.cjs +143 -0
- package/node_modules/zod/v4/locales/ua.d.cts +4 -0
- package/node_modules/zod/v4/locales/ua.d.ts +4 -0
- package/node_modules/zod/v4/locales/ua.js +117 -0
- package/node_modules/zod/v4/locales/ur.cjs +143 -0
- package/node_modules/zod/v4/locales/ur.d.cts +4 -0
- package/node_modules/zod/v4/locales/ur.d.ts +4 -0
- package/node_modules/zod/v4/locales/ur.js +117 -0
- package/node_modules/zod/v4/locales/vi.cjs +142 -0
- package/node_modules/zod/v4/locales/vi.d.cts +4 -0
- package/node_modules/zod/v4/locales/vi.d.ts +4 -0
- package/node_modules/zod/v4/locales/vi.js +116 -0
- package/node_modules/zod/v4/locales/zh-CN.cjs +142 -0
- package/node_modules/zod/v4/locales/zh-CN.d.cts +4 -0
- package/node_modules/zod/v4/locales/zh-CN.d.ts +4 -0
- package/node_modules/zod/v4/locales/zh-CN.js +116 -0
- package/node_modules/zod/v4/locales/zh-TW.cjs +143 -0
- package/node_modules/zod/v4/locales/zh-TW.d.cts +4 -0
- package/node_modules/zod/v4/locales/zh-TW.d.ts +4 -0
- package/node_modules/zod/v4/locales/zh-TW.js +117 -0
- package/node_modules/zod/v4/mini/checks.cjs +34 -0
- package/node_modules/zod/v4/mini/checks.d.cts +1 -0
- package/node_modules/zod/v4/mini/checks.d.ts +1 -0
- package/node_modules/zod/v4/mini/checks.js +1 -0
- package/node_modules/zod/v4/mini/coerce.cjs +47 -0
- package/node_modules/zod/v4/mini/coerce.d.cts +7 -0
- package/node_modules/zod/v4/mini/coerce.d.ts +7 -0
- package/node_modules/zod/v4/mini/coerce.js +17 -0
- package/node_modules/zod/v4/mini/external.cjs +62 -0
- package/node_modules/zod/v4/mini/external.d.cts +11 -0
- package/node_modules/zod/v4/mini/external.d.ts +11 -0
- package/node_modules/zod/v4/mini/external.js +13 -0
- package/node_modules/zod/v4/mini/index.cjs +32 -0
- package/node_modules/zod/v4/mini/index.d.cts +3 -0
- package/node_modules/zod/v4/mini/index.d.ts +3 -0
- package/node_modules/zod/v4/mini/index.js +3 -0
- package/node_modules/zod/v4/mini/iso.cjs +60 -0
- package/node_modules/zod/v4/mini/iso.d.cts +22 -0
- package/node_modules/zod/v4/mini/iso.d.ts +22 -0
- package/node_modules/zod/v4/mini/iso.js +30 -0
- package/node_modules/zod/v4/mini/parse.cjs +8 -0
- package/node_modules/zod/v4/mini/parse.d.cts +1 -0
- package/node_modules/zod/v4/mini/parse.d.ts +1 -0
- package/node_modules/zod/v4/mini/parse.js +1 -0
- package/node_modules/zod/v4/mini/schemas.cjs +839 -0
- package/node_modules/zod/v4/mini/schemas.d.cts +356 -0
- package/node_modules/zod/v4/mini/schemas.d.ts +356 -0
- package/node_modules/zod/v4/mini/schemas.js +732 -0
- package/node_modules/zod/v4-mini/index.cjs +17 -0
- package/node_modules/zod/v4-mini/index.d.cts +1 -0
- package/node_modules/zod/v4-mini/index.d.ts +1 -0
- package/node_modules/zod/v4-mini/index.js +1 -0
- package/npm-shrinkwrap.json +90 -3
- package/openclaw.plugin.json +99 -2
- package/package.json +16 -7
- package/dist/approval-custom-id-NYPYj9Po.js +0 -58
- package/dist/approval-message-safety-C-8BL6Kv.js +0 -47
- package/dist/configured-state.js +0 -6
- package/dist/message-handler-CIxWq5Yh.js +0 -532
- package/dist/provider.runtime-C2iIfbTs.js +0 -2
- package/dist/retry-after-D5_VmM-_.js +0 -25
- package/dist/runtime-api.monitor-DSbfGnzS.js +0 -6
- package/dist/security-doctor-uUo8hTD5.js +0 -18
- package/dist/targets-DvItNIvP.js +0 -3
- package/dist/timeouts.js +0 -2
- package/dist/{preflight-audio-DYL2ABgA.js → preflight-audio-DDSZna4F.js} +1 -1
- package/dist/{thread-bindings.state-9VAxhVf6.js → thread-bindings.state-C5afR9TD.js} +1 -1
|
@@ -1,56 +1,56 @@
|
|
|
1
|
-
import { C as Client, D as RateLimitError, F as Message, I as User, K as Container, M as Command, N as CommandWithSubcommands, P as Guild, Q as Row, V as Modal, W as Button,
|
|
2
|
-
import { c as resolveDiscordAccountAllowFrom, d as resolveDiscordAccountDmPolicy, f as resolveDiscordMaxLinesPerMessage, p as normalizeDiscordToken, s as resolveDiscordAccount } from "./accounts-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { a as isDiscordRateLimitResponseBody, o as summarizeDiscordResponseBody } from "./api--f62GFaS.js";
|
|
8
|
-
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-B7qOH5xu.js";
|
|
9
|
-
import { s as sendVoiceMessageDiscord } from "./send-BFpa_DHn.js";
|
|
10
|
-
import { a as formatMention, t as sendMessageDiscord } from "./send.outbound-BlA6VzSE.js";
|
|
11
|
-
import { d as withAbortTimeout, l as raceWithTimeout } from "./timeouts-ZRc9Lw4y.js";
|
|
12
|
-
import { r as parseExecApprovalData } from "./approval-custom-id-NYPYj9Po.js";
|
|
1
|
+
import { C as Client, D as RateLimitError, F as Message, I as User, K as Container, M as Command, N as CommandWithSubcommands, P as Guild, Q as Row, V as Modal, W as Button, Yt as __exportAll, _ as MessageReactionRemoveListener, _t as editChannel, at as BaseMessageInteractiveComponent, bt as getChannelMessage, d as discord_exports, et as Separator, f as GuildCreateListener, g as MessageReactionAddListener, h as MessageCreateListener, m as InteractionCreateListener, mt as createThread, nt as TextDisplay, p as GuildDeleteListener, t as chunkDiscordTextWithMode, tt as StringSelectMenu, v as PresenceUpdateListener, w as Plugin, x as ThreadUpdateListener, y as ReadyListener } from "./chunk-CWzmeWf_.js";
|
|
2
|
+
import { c as resolveDiscordAccountAllowFrom, d as resolveDiscordAccountDmPolicy, f as resolveDiscordMaxLinesPerMessage, p as normalizeDiscordToken, s as resolveDiscordAccount } from "./accounts-CMd4nzLB.js";
|
|
3
|
+
import { n as getDiscordActivitiesRuntime } from "./runtime-CD5MRZkD.js";
|
|
4
|
+
import { C as parseDiscordActivityCustomIdForInteraction, D as parseDiscordModalCustomIdForInteraction, E as parseDiscordModalCustomId, O as decodeCustomIdComponent, T as parseDiscordComponentCustomIdForInteraction, k as encodeCustomIdComponent, l as parseExecApprovalData, s as parseDiscordQuestionData, w as parseDiscordComponentCustomId, y as buildDiscordActivityCustomId } from "./outbound-session-route-M2bEY9tI.js";
|
|
5
|
+
import { D as canViewDiscordGuildChannel, F as createDiscordRestClient, H as registerGateway, K as validateDiscordProxyUrl, U as unregisterGateway, q as withValidatedDiscordProxy, z as DISCORD_REST_TIMEOUT_MS } from "./send.shared-Dber6X57.js";
|
|
6
|
+
import { _ as resolveDiscordModalEntryWithPersistence, g as resolveDiscordComponentEntryWithPersistence, t as editDiscordComponentMessage } from "./send.components-DLqzOEPJ.js";
|
|
13
7
|
import { t as getDiscordRuntime } from "./runtime-DgnVQ7zW.js";
|
|
14
|
-
import { a as
|
|
15
|
-
import { t as
|
|
16
|
-
import { t as
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import { t as
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
8
|
+
import { a as isDiscordRateLimitResponseBody, o as summarizeDiscordResponseBody } from "./api-C43z8vUm.js";
|
|
9
|
+
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, t as allowListMatches, v as resolveGroupDmAllow, x as formatDiscordUserTag, y as shouldEmitDiscordReactionNotification } from "./allow-list-DzKrtfah.js";
|
|
10
|
+
import { a as formatMention, t as sendMessageDiscord } from "./send.outbound-C1SfX20w.js";
|
|
11
|
+
import { i as setPresence, t as clearPresences } from "./presence-cache-z1N8MbJ3.js";
|
|
12
|
+
import { n as sendVoiceMessageDiscord } from "./send-CSRxNNgq.js";
|
|
13
|
+
import { c as raceWithTimeout, u as withAbortTimeout } from "./timeouts-B9cy6RvQ.js";
|
|
14
|
+
import { a as getDiscordExecApprovalApprovers, n as formatDiscordApprovalDisplayValue, r as resolveDiscordConversationIdentity, s as isDiscordExecApprovalClientEnabled, t as DISCORD_APPROVAL_ALLOWED_MENTIONS } from "./approval-message-safety-DrLlgIPz.js";
|
|
15
|
+
import { t as resolveDiscordChannelAllowlist } from "./resolve-channels-9KcG3mLg.js";
|
|
16
|
+
import { t as resolveDiscordUserAllowlist } from "./resolve-users-GCGf3oV0.js";
|
|
17
|
+
import { _ as formatThreadBindingDurationLabel, a as isThreadArchived, d as resolveDiscordChannelNameSafe, f as resolveDiscordChannelParentIdSafe, l as resolveDiscordChannelIdSafe, m as resolveDiscordChannelTopicSafe, p as resolveDiscordChannelParentSafe, u as resolveDiscordChannelInfoSafe } from "./thread-bindings.discord-api-mNCWlgvM.js";
|
|
18
|
+
import { r as parseApplicationIdFromToken, t as fetchDiscordApplicationId } from "./probe-C3SCKyYU.js";
|
|
19
|
+
import { d as resolveDiscordMessageChannelId, n as resolveDiscordForwardedMessagesTextFromSnapshots, t as resolveDiscordEmbedText, u as resolveDiscordChannelInfo } from "./message-utils-Cfe6CZ6N.js";
|
|
20
|
+
import { t as resolveDiscordSenderIdentity } from "./sender-identity-mG_zsdox.js";
|
|
23
21
|
import { normalizeAccountId } from "openclaw/plugin-sdk/account-id";
|
|
24
|
-
import { normalizeLowercaseStringOrEmpty, normalizeOptionalLowercaseString, normalizeOptionalString, normalizeOptionalStringifiedId, normalizeStringEntries, normalizeStringEntriesLower, summarizeStringEntries } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
25
22
|
import { buildAgentSessionKey, deriveLastRoutePolicy, isAcpSessionKey, isSubagentSessionKey, parseAgentSessionKey, resolveAgentIdFromSessionKey, resolveAgentRoute } from "openclaw/plugin-sdk/routing";
|
|
23
|
+
import { normalizeLowercaseStringOrEmpty, normalizeOptionalLowercaseString, normalizeOptionalString, normalizeOptionalStringifiedId, normalizeStringEntries, normalizeStringEntriesLower, summarizeStringEntries } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
26
24
|
import { getRuntimeConfig, getRuntimeConfigSnapshot } from "openclaw/plugin-sdk/runtime-config-snapshot";
|
|
25
|
+
import { logDebug, logError } from "openclaw/plugin-sdk/logging-core";
|
|
27
26
|
import { ApplicationCommandOptionType, ButtonStyle, ChannelType, ComponentType, GatewayCloseCodes, GatewayCloseCodes as GatewayCloseCodes$1, GatewayDispatchEvents, GatewayIntentBits, GatewayOpcodes } from "discord-api-types/v10";
|
|
28
|
-
import { MAX_DATE_TIMESTAMP_MS, asDateTimestampMs, parseFiniteNumber, parseStrictFiniteNumber, parseStrictInteger, parseStrictNonNegativeInteger, parseStrictPositiveInteger, resolveDateTimestampMs, resolveTimestampMsToIsoString } from "openclaw/plugin-sdk/number-runtime";
|
|
29
27
|
import { createHash, randomUUID } from "node:crypto";
|
|
30
|
-
import
|
|
31
|
-
import { resolvePinnedMainDmOwnerFromAllowlist as resolvePinnedMainDmOwnerFromAllowlist$1 } from "openclaw/plugin-sdk/security-runtime";
|
|
28
|
+
import { MAX_DATE_TIMESTAMP_MS, asDateTimestampMs, parseFiniteNumber, parseStrictFiniteNumber, parseStrictInteger, parseStrictNonNegativeInteger, parseStrictPositiveInteger, resolveDateTimestampMs, resolveTimestampMsToIsoString } from "openclaw/plugin-sdk/number-runtime";
|
|
32
29
|
import { expectDefined } from "openclaw/plugin-sdk/expect-runtime";
|
|
33
30
|
import { Type } from "typebox";
|
|
34
31
|
import { Check, Errors } from "typebox/value";
|
|
35
32
|
import { inspect } from "node:util";
|
|
36
33
|
import { readResponseWithLimit } from "openclaw/plugin-sdk/response-limit-runtime";
|
|
37
34
|
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
38
|
-
import {
|
|
39
|
-
import { resolveSendableOutboundReplyParts, resolveTextChunksWithFallback } from "openclaw/plugin-sdk/reply-payload";
|
|
40
|
-
import { loadWebMedia } from "openclaw/plugin-sdk/web-media";
|
|
41
|
-
import { resolveChunkMode, resolveTextChunkLimit } from "openclaw/plugin-sdk/reply-chunking";
|
|
35
|
+
import { fetchWithSsrFGuard, formatErrorMessage as formatErrorMessage$1 } from "openclaw/plugin-sdk/ssrf-runtime";
|
|
42
36
|
import { createHttp1EnvHttpProxyAgent, createHttp1ProxyAgent, createNodeProxyAgent, resolveEnvHttpProxyAgentOptions, wrapFetchWithAbortSignal } from "openclaw/plugin-sdk/fetch-runtime";
|
|
43
|
-
import { createNonExitingRuntime, createSubsystemLogger, danger, formatDurationSeconds, isVerbose, logVerbose, shouldLogVerbose, warn } from "openclaw/plugin-sdk/runtime-env";
|
|
37
|
+
import { createNonExitingRuntime, createSubsystemLogger, danger, formatDurationSeconds, isVerbose, logVerbose, shouldLogVerbose, sleepWithAbort, warn } from "openclaw/plugin-sdk/runtime-env";
|
|
44
38
|
import { sliceUtf16Safe, truncateUtf16Safe, withTimeout } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
45
|
-
import {
|
|
39
|
+
import { addAllowlistUserEntriesFromConfigEntry, buildAllowlistResolutionSummary, canonicalizeAllowlistWithResolvedIds, patchAllowlistUsersInConfigEntries, summarizeMapping } from "openclaw/plugin-sdk/allow-from";
|
|
46
40
|
import { resolveMarkdownTableMode } from "openclaw/plugin-sdk/markdown-table-runtime";
|
|
41
|
+
import { resolveChunkMode, resolveTextChunkLimit } from "openclaw/plugin-sdk/reply-chunking";
|
|
47
42
|
import { chunkItems, sanitizeAssistantVisibleText, sanitizeAssistantVisibleTextWithProfile } from "openclaw/plugin-sdk/text-chunking";
|
|
43
|
+
import { createReplyReferencePlanner } from "openclaw/plugin-sdk/reply-reference";
|
|
48
44
|
import { buildOutboundSessionContext, createChannelMessageReplyPipeline, resolveChannelStreamingBlockEnabled, sendDurableMessageBatch } from "openclaw/plugin-sdk/channel-outbound";
|
|
49
|
-
import {
|
|
45
|
+
import { getAgentScopedMediaLocalRoots } from "openclaw/plugin-sdk/media-runtime";
|
|
46
|
+
import { resolveSendableOutboundReplyParts, resolveTextChunksWithFallback } from "openclaw/plugin-sdk/reply-payload";
|
|
47
|
+
import { loadWebMedia } from "openclaw/plugin-sdk/web-media";
|
|
48
|
+
import { createLazyRuntimeModule, createLazyRuntimeNamedExport } from "openclaw/plugin-sdk/lazy-runtime";
|
|
49
|
+
import { resolvePinnedMainDmOwnerFromAllowlist as resolvePinnedMainDmOwnerFromAllowlist$1 } from "openclaw/plugin-sdk/security-runtime";
|
|
50
50
|
import { GROUP_POLICY_BLOCKED_LABEL, resolveDefaultGroupPolicy, resolveOpenProviderRuntimeGroupPolicy, warnMissingProviderGroupPolicyFallbackOnce } from "openclaw/plugin-sdk/runtime-group-policy";
|
|
51
51
|
import { createChannelPairingChallengeIssuer } from "openclaw/plugin-sdk/channel-pairing";
|
|
52
52
|
import { CHANNEL_APPROVAL_NATIVE_RUNTIME_CONTEXT_CAPABILITY } from "openclaw/plugin-sdk/approval-handler-adapter-runtime";
|
|
53
|
-
import {
|
|
53
|
+
import { questionGatewayRuntime } from "openclaw/plugin-sdk/question-gateway-runtime";
|
|
54
54
|
import { buildPairingReply, upsertChannelPairingRequest, upsertChannelPairingRequest as upsertChannelPairingRequest$1 } from "openclaw/plugin-sdk/conversation-runtime";
|
|
55
55
|
import { clearExpiredCooldowns, ensureAuthProfileStore, formatReasoningMessage, isProfileInCooldown, loadModelCatalog, resolveAgentAvatar, resolveDefaultModelForAgent, resolveHumanDelayConfig, resolveProfilesUnavailableReason } from "openclaw/plugin-sdk/agent-runtime";
|
|
56
56
|
import { isDangerousNameMatchingEnabled } from "openclaw/plugin-sdk/dangerous-name-runtime";
|
|
@@ -62,7 +62,7 @@ import { createChannelIngressResolver, defineStableChannelIngressIdentity, readC
|
|
|
62
62
|
import { ModelSelectionLockedError, applyModelOverrideToSessionEntry, resolveChannelModelOverride } from "openclaw/plugin-sdk/model-session-runtime";
|
|
63
63
|
import { completeWithPreparedSimpleCompletionModel, extractAssistantText, prepareSimpleCompletionModelForAgent } from "openclaw/plugin-sdk/simple-completion-runtime";
|
|
64
64
|
import { getSessionEntry, listSessionEntries, patchSessionEntry, readSessionUpdatedAt as readSessionUpdatedAt$1, resolveStorePath, resolveStorePath as resolveStorePath$1 } from "openclaw/plugin-sdk/session-store-runtime";
|
|
65
|
-
import { formatInboundEnvelope, resolveEnvelopeFormatOptions, runChannelInboundEvent } from "openclaw/plugin-sdk/channel-inbound";
|
|
65
|
+
import { formatInboundEnvelope, resolveEnvelopeFormatOptions, resolveInboundSupplementalSenderAllowed, runChannelInboundEvent } from "openclaw/plugin-sdk/channel-inbound";
|
|
66
66
|
import { buildCommandTextFromArgs, findCommandByNativeName, formatCommandArgMenuTitle, listChatCommands, listNativeCommandSpecsForConfig, listSkillCommandsForAgents, resolveCommandAuthorizedFromAuthorizers, resolveEffectiveAgentRuntime, resolveNativeCommandSessionTargets, resolveStoredModelOverride, serializeCommandArgs } from "openclaw/plugin-sdk/command-auth-native";
|
|
67
67
|
import { buildCommandTextFromArgs as buildCommandTextFromArgs$1, findCommandByNativeName as findCommandByNativeName$1, parseCommandArgs, resolveCommandArgChoices, resolveCommandArgMenu, serializeCommandArgs as serializeCommandArgs$1 } from "openclaw/plugin-sdk/native-command-registry";
|
|
68
68
|
import { resolveDirectStatusReplyForSession } from "openclaw/plugin-sdk/command-status-runtime";
|
|
@@ -77,10 +77,8 @@ import { Agent } from "node:https";
|
|
|
77
77
|
import { captureHttpExchange, captureWsEvent, resolveDebugProxySettings, resolveEffectiveDebugProxyUrl } from "openclaw/plugin-sdk/proxy-capture";
|
|
78
78
|
import * as dns from "node:dns";
|
|
79
79
|
import { registerChannelRuntimeContext } from "openclaw/plugin-sdk/channel-runtime-context";
|
|
80
|
-
import { logDebug, logError } from "openclaw/plugin-sdk/logging-core";
|
|
81
80
|
import { stripPlainTextToolCallBlocks } from "openclaw/plugin-sdk/tool-payload";
|
|
82
81
|
import { resolveApprovalOverGateway } from "openclaw/plugin-sdk/approval-gateway-runtime";
|
|
83
|
-
import { resolveStateDir } from "openclaw/plugin-sdk/state-paths";
|
|
84
82
|
import { resolveRequestUrl } from "openclaw/plugin-sdk/request-url";
|
|
85
83
|
import { fetchWithRuntimeDispatcher } from "openclaw/plugin-sdk/runtime-fetch";
|
|
86
84
|
import { Agent as Agent$1 } from "undici";
|
|
@@ -1259,6 +1257,85 @@ function openDiscordPresenceCooldownStore() {
|
|
|
1259
1257
|
});
|
|
1260
1258
|
}
|
|
1261
1259
|
//#endregion
|
|
1260
|
+
//#region extensions/discord/src/monitor/presence-emission-gate.ts
|
|
1261
|
+
const DISCORD_PRESENCE_RECONNECT_SUPPRESS_MS = 300 * 1e3;
|
|
1262
|
+
const DISCORD_PRESENCE_BURST_LIMIT = 8;
|
|
1263
|
+
const DISCORD_PRESENCE_BURST_WINDOW_MS = 60 * 1e3;
|
|
1264
|
+
function resolveDiscordPresenceGateOptions(config) {
|
|
1265
|
+
return {
|
|
1266
|
+
reconnectSuppressMs: config?.reconnectSuppressSeconds !== void 0 ? config.reconnectSuppressSeconds * 1e3 : DISCORD_PRESENCE_RECONNECT_SUPPRESS_MS,
|
|
1267
|
+
burstLimit: config?.burstLimit ?? DISCORD_PRESENCE_BURST_LIMIT,
|
|
1268
|
+
burstWindowMs: config?.burstWindowSeconds !== void 0 ? config.burstWindowSeconds * 1e3 : DISCORD_PRESENCE_BURST_WINDOW_MS
|
|
1269
|
+
};
|
|
1270
|
+
}
|
|
1271
|
+
/**
|
|
1272
|
+
* Per-account lifecycle gate for online-presence events. Reconnect state belongs to the Gateway
|
|
1273
|
+
* session, while burst state follows the guild-owned configuration that supplies its limits.
|
|
1274
|
+
*/
|
|
1275
|
+
var DiscordPresenceEmissionGate = class {
|
|
1276
|
+
constructor() {
|
|
1277
|
+
this.reconnectLogged = false;
|
|
1278
|
+
this.burstByGuild = /* @__PURE__ */ new Map();
|
|
1279
|
+
this.nextReservationId = 0;
|
|
1280
|
+
}
|
|
1281
|
+
noteGatewaySessionReset(nowMs) {
|
|
1282
|
+
this.lastSessionResetAtMs = nowMs;
|
|
1283
|
+
this.reconnectLogged = false;
|
|
1284
|
+
}
|
|
1285
|
+
evaluateReconnectWindow(nowMs, options) {
|
|
1286
|
+
if (this.lastSessionResetAtMs !== void 0 && options.reconnectSuppressMs > 0 && nowMs - this.lastSessionResetAtMs < options.reconnectSuppressMs) {
|
|
1287
|
+
const shouldLog = !this.reconnectLogged;
|
|
1288
|
+
this.reconnectLogged = true;
|
|
1289
|
+
return {
|
|
1290
|
+
allowed: false,
|
|
1291
|
+
reason: "reconnect-window",
|
|
1292
|
+
shouldLog
|
|
1293
|
+
};
|
|
1294
|
+
}
|
|
1295
|
+
return { allowed: true };
|
|
1296
|
+
}
|
|
1297
|
+
reserveBurst(guildId, nowMs, options) {
|
|
1298
|
+
const state = this.burstByGuild.get(guildId) ?? {
|
|
1299
|
+
reservations: [],
|
|
1300
|
+
logged: false
|
|
1301
|
+
};
|
|
1302
|
+
state.reservations = state.reservations.filter((reservation) => !reservation.committed || nowMs - reservation.atMs < options.burstWindowMs);
|
|
1303
|
+
this.burstByGuild.set(guildId, state);
|
|
1304
|
+
if (state.reservations.length >= options.burstLimit) {
|
|
1305
|
+
const shouldLog = !state.logged;
|
|
1306
|
+
state.logged = true;
|
|
1307
|
+
return {
|
|
1308
|
+
allowed: false,
|
|
1309
|
+
reason: state.reservations.some((reservation) => !reservation.committed) ? "burst-pending" : "burst",
|
|
1310
|
+
shouldLog
|
|
1311
|
+
};
|
|
1312
|
+
}
|
|
1313
|
+
state.logged = false;
|
|
1314
|
+
const reservation = {
|
|
1315
|
+
id: this.nextReservationId++,
|
|
1316
|
+
atMs: nowMs,
|
|
1317
|
+
committed: false
|
|
1318
|
+
};
|
|
1319
|
+
state.reservations.push(reservation);
|
|
1320
|
+
return {
|
|
1321
|
+
allowed: true,
|
|
1322
|
+
reservation: reservation.id
|
|
1323
|
+
};
|
|
1324
|
+
}
|
|
1325
|
+
commitBurst(guildId, reservation, nowMs) {
|
|
1326
|
+
const entry = this.burstByGuild.get(guildId)?.reservations.find((candidate) => candidate.id === reservation);
|
|
1327
|
+
if (!entry) return;
|
|
1328
|
+
entry.atMs = nowMs;
|
|
1329
|
+
entry.committed = true;
|
|
1330
|
+
}
|
|
1331
|
+
releaseBurst(guildId, reservation) {
|
|
1332
|
+
const state = this.burstByGuild.get(guildId);
|
|
1333
|
+
if (!state) return;
|
|
1334
|
+
state.reservations = state.reservations.filter((candidate) => candidate.id !== reservation);
|
|
1335
|
+
if (state.reservations.length === 0 && !state.logged) this.burstByGuild.delete(guildId);
|
|
1336
|
+
}
|
|
1337
|
+
};
|
|
1338
|
+
//#endregion
|
|
1262
1339
|
//#region extensions/discord/src/monitor/presence-transition-cache.ts
|
|
1263
1340
|
const DEFAULT_PRESENCE_BASELINE_MAX_ENTRIES = 75e3;
|
|
1264
1341
|
var DiscordPresenceBaselineCache = class {
|
|
@@ -1362,9 +1439,11 @@ var DiscordMessageListener = class extends MessageCreateListener {
|
|
|
1362
1439
|
}
|
|
1363
1440
|
async handle(data, client) {
|
|
1364
1441
|
this.onEvent?.();
|
|
1365
|
-
|
|
1442
|
+
try {
|
|
1443
|
+
await this.handler(data, client);
|
|
1444
|
+
} catch (err) {
|
|
1366
1445
|
(this.logger ?? discordEventQueueLog).error(danger(`discord handler failed: ${String(err)}`));
|
|
1367
|
-
}
|
|
1446
|
+
}
|
|
1368
1447
|
}
|
|
1369
1448
|
};
|
|
1370
1449
|
var DiscordInteractionListener = class extends InteractionCreateListener {
|
|
@@ -1389,6 +1468,7 @@ var DiscordPresenceListener = class extends PresenceUpdateListener {
|
|
|
1389
1468
|
this.gatewayGeneration = 0;
|
|
1390
1469
|
this.cooldownStore = params.cooldownStore ?? openDiscordPresenceCooldownStore();
|
|
1391
1470
|
this.presenceBaseline = params.presenceBaseline ?? new DiscordPresenceBaselineCache();
|
|
1471
|
+
this.emissionGate = params.emissionGate ?? new DiscordPresenceEmissionGate();
|
|
1392
1472
|
}
|
|
1393
1473
|
seedGuildSnapshot(data) {
|
|
1394
1474
|
const config = resolveDiscordGuildEntry({
|
|
@@ -1436,6 +1516,7 @@ var DiscordPresenceListener = class extends PresenceUpdateListener {
|
|
|
1436
1516
|
}
|
|
1437
1517
|
resetGatewaySession() {
|
|
1438
1518
|
this.gatewayGeneration += 1;
|
|
1519
|
+
this.emissionGate.noteGatewaySessionReset(this.params.nowMs?.() ?? Date.now());
|
|
1439
1520
|
this.presenceBaseline.clear();
|
|
1440
1521
|
this.guildPresenceState.clear();
|
|
1441
1522
|
this.pendingByGuildUser.clear();
|
|
@@ -1477,34 +1558,70 @@ var DiscordPresenceListener = class extends PresenceUpdateListener {
|
|
|
1477
1558
|
else if (isDiscordOnlineStatus(data.status)) this.recordPresenceBaseline(data.guild_id, presenceKey, "online");
|
|
1478
1559
|
return;
|
|
1479
1560
|
}
|
|
1480
|
-
const
|
|
1481
|
-
|
|
1482
|
-
if (
|
|
1561
|
+
const gateOptions = resolveDiscordPresenceGateOptions(config);
|
|
1562
|
+
const reconnectGate = this.emissionGate.evaluateReconnectWindow(nowMs, gateOptions);
|
|
1563
|
+
if (!reconnectGate.allowed) {
|
|
1564
|
+
if (reconnectGate.shouldLog) (this.params.logger ?? discordEventQueueLog).info("Discord presence events suppressed", {
|
|
1565
|
+
reason: reconnectGate.reason,
|
|
1566
|
+
accountId: this.params.accountId,
|
|
1567
|
+
guildId: data.guild_id
|
|
1568
|
+
});
|
|
1483
1569
|
this.recordPresenceBaseline(data.guild_id, presenceKey, "online");
|
|
1484
1570
|
return;
|
|
1485
1571
|
}
|
|
1486
|
-
const
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1572
|
+
const burstNowMs = this.params.nowMs?.() ?? Date.now();
|
|
1573
|
+
const burstGate = this.emissionGate.reserveBurst(data.guild_id, burstNowMs, gateOptions);
|
|
1574
|
+
if (!burstGate.allowed) {
|
|
1575
|
+
if (burstGate.shouldLog) (this.params.logger ?? discordEventQueueLog).info("Discord presence events suppressed", {
|
|
1576
|
+
reason: burstGate.reason,
|
|
1577
|
+
accountId: this.params.accountId,
|
|
1578
|
+
guildId: data.guild_id
|
|
1579
|
+
});
|
|
1580
|
+
if (burstGate.reason === "burst-pending") return;
|
|
1581
|
+
this.recordPresenceBaseline(data.guild_id, presenceKey, "online");
|
|
1582
|
+
return;
|
|
1583
|
+
}
|
|
1584
|
+
const burstReservation = burstGate.reservation;
|
|
1585
|
+
let burstCommitted = false;
|
|
1586
|
+
let cooldownReserved = false;
|
|
1496
1587
|
try {
|
|
1497
|
-
|
|
1588
|
+
const fetchedUserIsBot = data.user.bot === void 0 && (await client.fetchUser(userId)).bot === true;
|
|
1589
|
+
if (!this.isCurrentGeneration(data.guild_id, gatewayGeneration, guildGeneration)) return;
|
|
1590
|
+
if (fetchedUserIsBot) {
|
|
1498
1591
|
this.recordPresenceBaseline(data.guild_id, presenceKey, "online");
|
|
1499
1592
|
return;
|
|
1500
1593
|
}
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1594
|
+
const canViewTargetChannel = await canViewDiscordGuildChannel(data.guild_id, presenceEvent.channelId, userId, {
|
|
1595
|
+
cfg: this.params.cfg,
|
|
1596
|
+
accountId: this.params.accountId,
|
|
1597
|
+
rest: client.rest
|
|
1598
|
+
});
|
|
1599
|
+
if (!this.isCurrentGeneration(data.guild_id, gatewayGeneration, guildGeneration)) return;
|
|
1600
|
+
if (!canViewTargetChannel) {
|
|
1601
|
+
this.recordPresenceBaseline(data.guild_id, presenceKey, "online");
|
|
1602
|
+
return;
|
|
1603
|
+
}
|
|
1604
|
+
const route = resolveAgentRoute({
|
|
1605
|
+
cfg: this.params.cfg,
|
|
1606
|
+
channel: "discord",
|
|
1607
|
+
accountId: this.params.accountId,
|
|
1608
|
+
guildId: data.guild_id,
|
|
1609
|
+
peer: {
|
|
1610
|
+
kind: "channel",
|
|
1611
|
+
id: presenceEvent.channelId
|
|
1612
|
+
}
|
|
1613
|
+
});
|
|
1614
|
+
try {
|
|
1615
|
+
cooldownReserved = this.cooldownStore.registerIfAbsent(presenceKey, nowMs, { ttlMs: DISCORD_PRESENCE_GREETING_COOLDOWN_MS });
|
|
1616
|
+
if (!cooldownReserved) {
|
|
1617
|
+
this.recordPresenceBaseline(data.guild_id, presenceKey, "online");
|
|
1618
|
+
return;
|
|
1619
|
+
}
|
|
1620
|
+
} catch (err) {
|
|
1621
|
+
(this.params.logger ?? discordEventQueueLog).warn(danger(`discord presence cooldown persistence failed: ${String(err)}`));
|
|
1622
|
+
return;
|
|
1623
|
+
}
|
|
1624
|
+
if (!enqueueSystemEvent(presenceEvent.text, {
|
|
1508
1625
|
sessionKey: route.sessionKey,
|
|
1509
1626
|
contextKey: `discord:presence-online:${this.params.accountId}:${data.guild_id}:${userId}`,
|
|
1510
1627
|
deliveryContext: {
|
|
@@ -1512,28 +1629,26 @@ var DiscordPresenceListener = class extends PresenceUpdateListener {
|
|
|
1512
1629
|
to: `channel:${presenceEvent.channelId}`,
|
|
1513
1630
|
accountId: this.params.accountId
|
|
1514
1631
|
}
|
|
1632
|
+
})) return;
|
|
1633
|
+
this.emissionGate.commitBurst(data.guild_id, burstReservation, this.params.nowMs?.() ?? Date.now());
|
|
1634
|
+
burstCommitted = true;
|
|
1635
|
+
this.recordPresenceBaseline(data.guild_id, presenceKey, "online");
|
|
1636
|
+
requestHeartbeat({
|
|
1637
|
+
source: "notifications-event",
|
|
1638
|
+
intent: "immediate",
|
|
1639
|
+
reason: "wake",
|
|
1640
|
+
agentId: route.agentId,
|
|
1641
|
+
sessionKey: route.sessionKey,
|
|
1642
|
+
heartbeat: {
|
|
1643
|
+
target: "discord",
|
|
1644
|
+
to: `channel:${presenceEvent.channelId}`,
|
|
1645
|
+
accountId: this.params.accountId
|
|
1646
|
+
}
|
|
1515
1647
|
});
|
|
1516
|
-
}
|
|
1517
|
-
if (
|
|
1518
|
-
|
|
1519
|
-
}
|
|
1520
|
-
if (!queued) {
|
|
1521
|
-
if (this.cooldownStore.lookup(presenceKey) === nowMs) this.cooldownStore.delete(presenceKey);
|
|
1522
|
-
return;
|
|
1648
|
+
} finally {
|
|
1649
|
+
if (!burstCommitted) this.emissionGate.releaseBurst(data.guild_id, burstReservation);
|
|
1650
|
+
if (cooldownReserved && !burstCommitted && this.cooldownStore.lookup(presenceKey) === nowMs) this.cooldownStore.delete(presenceKey);
|
|
1523
1651
|
}
|
|
1524
|
-
this.recordPresenceBaseline(data.guild_id, presenceKey, "online");
|
|
1525
|
-
requestHeartbeat({
|
|
1526
|
-
source: "notifications-event",
|
|
1527
|
-
intent: "immediate",
|
|
1528
|
-
reason: "wake",
|
|
1529
|
-
agentId: route.agentId,
|
|
1530
|
-
sessionKey: route.sessionKey,
|
|
1531
|
-
heartbeat: {
|
|
1532
|
-
target: "discord",
|
|
1533
|
-
to: `channel:${presenceEvent.channelId}`,
|
|
1534
|
-
accountId: this.params.accountId
|
|
1535
|
-
}
|
|
1536
|
-
});
|
|
1537
1652
|
}
|
|
1538
1653
|
isCurrentGeneration(guildId, gatewayGeneration, guildGeneration) {
|
|
1539
1654
|
return gatewayGeneration === this.gatewayGeneration && guildGeneration === (this.guildPresenceState.get(guildId)?.generation ?? 0);
|
|
@@ -1606,6 +1721,62 @@ var DiscordThreadUpdateListener = class extends ThreadUpdateListener {
|
|
|
1606
1721
|
}
|
|
1607
1722
|
};
|
|
1608
1723
|
//#endregion
|
|
1724
|
+
//#region extensions/discord/src/internal/gateway-dispatch.ts
|
|
1725
|
+
function dispatchVoiceGatewayEvent(client, type, data) {
|
|
1726
|
+
const guildId = readGuildId(data);
|
|
1727
|
+
if (!guildId) return;
|
|
1728
|
+
const adapter = (client.getPlugin("voice")?.adapters)?.get(guildId);
|
|
1729
|
+
const voiceServerUpdate = GatewayDispatchEvents.VoiceServerUpdate;
|
|
1730
|
+
const voiceStateUpdate = GatewayDispatchEvents.VoiceStateUpdate;
|
|
1731
|
+
if (type === voiceServerUpdate) adapter?.onVoiceServerUpdate?.(data);
|
|
1732
|
+
if (type === voiceStateUpdate) adapter?.onVoiceStateUpdate?.(data);
|
|
1733
|
+
}
|
|
1734
|
+
function mapGatewayDispatchData(client, type, data) {
|
|
1735
|
+
const messageCreate = GatewayDispatchEvents.MessageCreate;
|
|
1736
|
+
const reactionAdd = GatewayDispatchEvents.MessageReactionAdd;
|
|
1737
|
+
const reactionRemove = GatewayDispatchEvents.MessageReactionRemove;
|
|
1738
|
+
if (type === messageCreate) return createMessageDispatchData(client, data);
|
|
1739
|
+
if (type === reactionAdd || type === reactionRemove) return createReactionDispatchData(client, data);
|
|
1740
|
+
return data;
|
|
1741
|
+
}
|
|
1742
|
+
function createMessageDispatchData(client, data) {
|
|
1743
|
+
const message = new Message(client, data);
|
|
1744
|
+
return {
|
|
1745
|
+
...data,
|
|
1746
|
+
id: data.id,
|
|
1747
|
+
channel_id: data.channel_id,
|
|
1748
|
+
channelId: data.channel_id,
|
|
1749
|
+
message,
|
|
1750
|
+
author: message.author ?? (data.author ? new User(client, data.author) : null),
|
|
1751
|
+
member: data.member,
|
|
1752
|
+
rawMember: data.member,
|
|
1753
|
+
guild: data.guild_id ? new Guild(client, data.guild_id) : null
|
|
1754
|
+
};
|
|
1755
|
+
}
|
|
1756
|
+
function createReactionDispatchData(client, data) {
|
|
1757
|
+
const userRaw = data.member?.user && typeof data.member.user === "object" ? {
|
|
1758
|
+
id: data.user_id,
|
|
1759
|
+
username: "",
|
|
1760
|
+
...data.member.user
|
|
1761
|
+
} : {
|
|
1762
|
+
id: data.user_id,
|
|
1763
|
+
username: ""
|
|
1764
|
+
};
|
|
1765
|
+
return {
|
|
1766
|
+
...data,
|
|
1767
|
+
user: new User(client, userRaw),
|
|
1768
|
+
rawMember: data.member,
|
|
1769
|
+
guild: data.guild_id ? new Guild(client, data.guild_id) : null,
|
|
1770
|
+
message: new Message(client, {
|
|
1771
|
+
id: data.message_id,
|
|
1772
|
+
channelId: data.channel_id
|
|
1773
|
+
})
|
|
1774
|
+
};
|
|
1775
|
+
}
|
|
1776
|
+
function readGuildId(data) {
|
|
1777
|
+
return data && typeof data === "object" && typeof data.guild_id === "string" ? data.guild_id : void 0;
|
|
1778
|
+
}
|
|
1779
|
+
//#endregion
|
|
1609
1780
|
//#region extensions/discord/src/monitor/dm-command-decision.ts
|
|
1610
1781
|
async function handleDiscordDmCommandDecision(params) {
|
|
1611
1782
|
if (params.senderAccess.decision === "allow") return true;
|
|
@@ -2213,16 +2384,23 @@ function shouldBypassConfiguredAcpGuildGuards(commandName) {
|
|
|
2213
2384
|
//#endregion
|
|
2214
2385
|
//#region extensions/discord/src/monitor/inbound-context.ts
|
|
2215
2386
|
function createDiscordSupplementalContextAccessChecker(params) {
|
|
2387
|
+
const userAllowList = params.channelConfig?.users ?? params.guildInfo?.users ?? [];
|
|
2388
|
+
const roleAllowList = params.channelConfig?.roles ?? params.guildInfo?.roles ?? [];
|
|
2389
|
+
const allowFrom = [...userAllowList, ...roleAllowList];
|
|
2216
2390
|
return (sender) => {
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2391
|
+
return resolveInboundSupplementalSenderAllowed({
|
|
2392
|
+
isGroup: params.isGuild,
|
|
2393
|
+
groupPolicy: allowFrom.length === 0 ? "open" : "allowlist",
|
|
2394
|
+
allowFrom,
|
|
2395
|
+
isSenderAllowed: () => resolveDiscordMemberAllowed({
|
|
2396
|
+
userAllowList,
|
|
2397
|
+
roleAllowList,
|
|
2398
|
+
memberRoleIds: sender.memberRoleIds ?? [],
|
|
2399
|
+
userId: sender.id ?? "",
|
|
2400
|
+
userName: sender.name,
|
|
2401
|
+
userTag: sender.tag,
|
|
2402
|
+
allowNameMatching: params.allowNameMatching
|
|
2403
|
+
})
|
|
2226
2404
|
});
|
|
2227
2405
|
};
|
|
2228
2406
|
}
|
|
@@ -5127,62 +5305,6 @@ function canResumeAfterGatewayClose(code) {
|
|
|
5127
5305
|
return !nonResumableGatewayCloseCodes.has(code);
|
|
5128
5306
|
}
|
|
5129
5307
|
//#endregion
|
|
5130
|
-
//#region extensions/discord/src/internal/gateway-dispatch.ts
|
|
5131
|
-
function dispatchVoiceGatewayEvent(client, type, data) {
|
|
5132
|
-
const guildId = readGuildId(data);
|
|
5133
|
-
if (!guildId) return;
|
|
5134
|
-
const adapter = (client.getPlugin("voice")?.adapters)?.get(guildId);
|
|
5135
|
-
const voiceServerUpdate = GatewayDispatchEvents.VoiceServerUpdate;
|
|
5136
|
-
const voiceStateUpdate = GatewayDispatchEvents.VoiceStateUpdate;
|
|
5137
|
-
if (type === voiceServerUpdate) adapter?.onVoiceServerUpdate?.(data);
|
|
5138
|
-
if (type === voiceStateUpdate) adapter?.onVoiceStateUpdate?.(data);
|
|
5139
|
-
}
|
|
5140
|
-
function mapGatewayDispatchData(client, type, data) {
|
|
5141
|
-
const messageCreate = GatewayDispatchEvents.MessageCreate;
|
|
5142
|
-
const reactionAdd = GatewayDispatchEvents.MessageReactionAdd;
|
|
5143
|
-
const reactionRemove = GatewayDispatchEvents.MessageReactionRemove;
|
|
5144
|
-
if (type === messageCreate) return createMessageDispatchData(client, data);
|
|
5145
|
-
if (type === reactionAdd || type === reactionRemove) return createReactionDispatchData(client, data);
|
|
5146
|
-
return data;
|
|
5147
|
-
}
|
|
5148
|
-
function createMessageDispatchData(client, data) {
|
|
5149
|
-
const message = new Message(client, data);
|
|
5150
|
-
return {
|
|
5151
|
-
...data,
|
|
5152
|
-
id: data.id,
|
|
5153
|
-
channel_id: data.channel_id,
|
|
5154
|
-
channelId: data.channel_id,
|
|
5155
|
-
message,
|
|
5156
|
-
author: message.author ?? (data.author ? new User(client, data.author) : null),
|
|
5157
|
-
member: data.member,
|
|
5158
|
-
rawMember: data.member,
|
|
5159
|
-
guild: data.guild_id ? new Guild(client, data.guild_id) : null
|
|
5160
|
-
};
|
|
5161
|
-
}
|
|
5162
|
-
function createReactionDispatchData(client, data) {
|
|
5163
|
-
const userRaw = data.member?.user && typeof data.member.user === "object" ? {
|
|
5164
|
-
id: data.user_id,
|
|
5165
|
-
username: "",
|
|
5166
|
-
...data.member.user
|
|
5167
|
-
} : {
|
|
5168
|
-
id: data.user_id,
|
|
5169
|
-
username: ""
|
|
5170
|
-
};
|
|
5171
|
-
return {
|
|
5172
|
-
...data,
|
|
5173
|
-
user: new User(client, userRaw),
|
|
5174
|
-
rawMember: data.member,
|
|
5175
|
-
guild: data.guild_id ? new Guild(client, data.guild_id) : null,
|
|
5176
|
-
message: new Message(client, {
|
|
5177
|
-
id: data.message_id,
|
|
5178
|
-
channelId: data.channel_id
|
|
5179
|
-
})
|
|
5180
|
-
};
|
|
5181
|
-
}
|
|
5182
|
-
function readGuildId(data) {
|
|
5183
|
-
return data && typeof data === "object" && typeof data.guild_id === "string" ? data.guild_id : void 0;
|
|
5184
|
-
}
|
|
5185
|
-
//#endregion
|
|
5186
5308
|
//#region extensions/discord/src/internal/gateway-identify-limiter.ts
|
|
5187
5309
|
const IDENTIFY_WINDOW_MS = 5e3;
|
|
5188
5310
|
function normalizeMaxConcurrency(value) {
|
|
@@ -5397,10 +5519,15 @@ var DiscordGatewayVoiceStateCache = class {
|
|
|
5397
5519
|
return;
|
|
5398
5520
|
}
|
|
5399
5521
|
const states = /* @__PURE__ */ new Map();
|
|
5400
|
-
|
|
5401
|
-
|
|
5402
|
-
|
|
5403
|
-
|
|
5522
|
+
const membersByUserId = new Map((guild.members ?? []).map((member) => [member.user.id, member]));
|
|
5523
|
+
for (const state of guild.voice_states) if (state.channel_id) {
|
|
5524
|
+
const member = state.member ?? membersByUserId.get(state.user_id);
|
|
5525
|
+
states.set(state.user_id, {
|
|
5526
|
+
...state,
|
|
5527
|
+
...member ? { member } : {},
|
|
5528
|
+
guild_id: guild.id
|
|
5529
|
+
});
|
|
5530
|
+
}
|
|
5404
5531
|
this.statesByGuild.set(guild.id, states);
|
|
5405
5532
|
return;
|
|
5406
5533
|
}
|
|
@@ -5412,6 +5539,7 @@ var DiscordGatewayVoiceStateCache = class {
|
|
|
5412
5539
|
const previous = states.get(state.user_id);
|
|
5413
5540
|
const current = {
|
|
5414
5541
|
...state,
|
|
5542
|
+
...state.member ? {} : previous?.member ? { member: previous.member } : {},
|
|
5415
5543
|
guild_id: guildId
|
|
5416
5544
|
};
|
|
5417
5545
|
this.transitionsByState.set(state, {
|
|
@@ -5706,7 +5834,7 @@ var GatewayPlugin = class extends Plugin {
|
|
|
5706
5834
|
}
|
|
5707
5835
|
this.voiceStateCache.apply(payload);
|
|
5708
5836
|
dispatchVoiceGatewayEvent(this.client, payload.t, payload.d);
|
|
5709
|
-
const data = mapGatewayDispatchData(this.client, payload.t, payload.d);
|
|
5837
|
+
const data = payload.t === GatewayDispatchEvents.MessageCreate ? payload.d : mapGatewayDispatchData(this.client, payload.t, payload.d);
|
|
5710
5838
|
await this.client.dispatchGatewayEvent(payload.t, data);
|
|
5711
5839
|
if (payload.t === GatewayDispatchEvents.InteractionCreate && this.options.autoInteractions) await this.client.handleInteraction(payload.d);
|
|
5712
5840
|
}
|
|
@@ -6235,9 +6363,12 @@ function resolveGatewayInfoWithFallback(params) {
|
|
|
6235
6363
|
};
|
|
6236
6364
|
}
|
|
6237
6365
|
async function fetchDiscordGatewayMetadataGuarded(input, init, options) {
|
|
6366
|
+
const requestInit = init;
|
|
6367
|
+
const signal = requestInit?.signal ?? void 0;
|
|
6238
6368
|
const guarded = await fetchWithSsrFGuard({
|
|
6239
6369
|
url: resolveFetchInputUrl(input),
|
|
6240
|
-
init,
|
|
6370
|
+
init: requestInit,
|
|
6371
|
+
...signal ? { signal } : {},
|
|
6241
6372
|
policy: { allowedHostnames: [DISCORD_API_HOST] },
|
|
6242
6373
|
capture: false,
|
|
6243
6374
|
auditContext: "discord.gateway.metadata",
|
|
@@ -6652,628 +6783,1134 @@ function createDiscordGatewaySupervisor(params) {
|
|
|
6652
6783
|
};
|
|
6653
6784
|
}
|
|
6654
6785
|
//#endregion
|
|
6655
|
-
//#region extensions/discord/src/
|
|
6656
|
-
const
|
|
6657
|
-
|
|
6658
|
-
|
|
6659
|
-
|
|
6660
|
-
|
|
6661
|
-
|
|
6662
|
-
|
|
6663
|
-
|
|
6664
|
-
|
|
6665
|
-
|
|
6666
|
-
|
|
6667
|
-
|
|
6668
|
-
|
|
6786
|
+
//#region extensions/discord/src/gateway-logging.ts
|
|
6787
|
+
const INFO_DEBUG_MARKERS = [
|
|
6788
|
+
"Gateway websocket closed",
|
|
6789
|
+
"Gateway reconnect scheduled in",
|
|
6790
|
+
"Gateway forcing fresh IDENTIFY after"
|
|
6791
|
+
];
|
|
6792
|
+
const shouldPromoteGatewayDebug = (message) => INFO_DEBUG_MARKERS.some((marker) => message.includes(marker));
|
|
6793
|
+
const formatGatewayMetrics = (metrics) => {
|
|
6794
|
+
if (metrics === null || metrics === void 0) return String(metrics);
|
|
6795
|
+
if (typeof metrics === "string") return metrics;
|
|
6796
|
+
if (typeof metrics === "number" || typeof metrics === "boolean" || typeof metrics === "bigint") return String(metrics);
|
|
6797
|
+
try {
|
|
6798
|
+
return JSON.stringify(metrics);
|
|
6799
|
+
} catch {
|
|
6800
|
+
return "[unserializable metrics]";
|
|
6801
|
+
}
|
|
6802
|
+
};
|
|
6803
|
+
function attachDiscordGatewayLogging(params) {
|
|
6804
|
+
const { emitter, runtime } = params;
|
|
6805
|
+
if (!emitter) return () => {};
|
|
6806
|
+
const onGatewayDebug = (msg) => {
|
|
6807
|
+
const message = String(msg);
|
|
6808
|
+
logVerbose(`discord gateway: ${message}`);
|
|
6809
|
+
if (shouldPromoteGatewayDebug(message)) runtime.log?.(`discord gateway: ${message}`);
|
|
6669
6810
|
};
|
|
6670
|
-
|
|
6671
|
-
|
|
6672
|
-
reason: "status-error-running-stale"
|
|
6673
|
-
} : {
|
|
6674
|
-
status: "uncertain",
|
|
6675
|
-
reason: "status-error"
|
|
6811
|
+
const onGatewayWarning = (warning) => {
|
|
6812
|
+
logVerbose(`discord gateway warning: ${String(warning)}`);
|
|
6676
6813
|
};
|
|
6677
|
-
|
|
6678
|
-
|
|
6679
|
-
if (params.storedState !== "running") return 0;
|
|
6680
|
-
const nowMs = asDateTimestampMs(Date.now());
|
|
6681
|
-
if (nowMs === void 0) return 0;
|
|
6682
|
-
const activityAtMs = asDateTimestampMs(params.lastActivityAt);
|
|
6683
|
-
return Math.max(0, nowMs - (activityAtMs === void 0 ? 0 : Math.max(0, Math.floor(activityAtMs))));
|
|
6684
|
-
}
|
|
6685
|
-
async function probeDiscordAcpBindingHealth(params) {
|
|
6686
|
-
const { getAcpSessionManager, isAcpRuntimeError } = params.providerSessionRuntime;
|
|
6687
|
-
const manager = getAcpSessionManager();
|
|
6688
|
-
const statusProbeAbortController = new AbortController();
|
|
6689
|
-
const result = await raceWithTimeout({
|
|
6690
|
-
promise: manager.getSessionStatus({
|
|
6691
|
-
cfg: params.cfg,
|
|
6692
|
-
sessionKey: params.sessionKey,
|
|
6693
|
-
signal: statusProbeAbortController.signal
|
|
6694
|
-
}).then((status) => ({
|
|
6695
|
-
kind: "status",
|
|
6696
|
-
status
|
|
6697
|
-
})).catch((error) => ({
|
|
6698
|
-
kind: "error",
|
|
6699
|
-
error
|
|
6700
|
-
})),
|
|
6701
|
-
timeoutMs: DISCORD_ACP_STATUS_PROBE_TIMEOUT_MS,
|
|
6702
|
-
onTimeout: () => ({ kind: "timeout" })
|
|
6703
|
-
});
|
|
6704
|
-
if (result.kind === "timeout") statusProbeAbortController.abort();
|
|
6705
|
-
const runningForMs = resolveRunningActivityAgeMs(params);
|
|
6706
|
-
const isStaleRunning = params.storedState === "running" && runningForMs >= DISCORD_ACP_STALE_RUNNING_ACTIVITY_MS;
|
|
6707
|
-
if (result.kind === "timeout") return isStaleRunning ? {
|
|
6708
|
-
status: "stale",
|
|
6709
|
-
reason: "status-timeout-running-stale"
|
|
6710
|
-
} : {
|
|
6711
|
-
status: "uncertain",
|
|
6712
|
-
reason: "status-timeout"
|
|
6814
|
+
const onGatewayMetrics = (metrics) => {
|
|
6815
|
+
logVerbose(`discord gateway metrics: ${formatGatewayMetrics(metrics)}`);
|
|
6713
6816
|
};
|
|
6714
|
-
|
|
6715
|
-
|
|
6716
|
-
|
|
6717
|
-
|
|
6718
|
-
|
|
6719
|
-
|
|
6720
|
-
|
|
6721
|
-
reason: "status-error-state"
|
|
6817
|
+
emitter.on("debug", onGatewayDebug);
|
|
6818
|
+
emitter.on("warning", onGatewayWarning);
|
|
6819
|
+
emitter.on("metrics", onGatewayMetrics);
|
|
6820
|
+
return () => {
|
|
6821
|
+
emitter.removeListener("debug", onGatewayDebug);
|
|
6822
|
+
emitter.removeListener("warning", onGatewayWarning);
|
|
6823
|
+
emitter.removeListener("metrics", onGatewayMetrics);
|
|
6722
6824
|
};
|
|
6723
|
-
return { status: "healthy" };
|
|
6724
6825
|
}
|
|
6725
6826
|
//#endregion
|
|
6726
|
-
//#region extensions/discord/src/monitor
|
|
6727
|
-
function
|
|
6728
|
-
const
|
|
6729
|
-
return
|
|
6730
|
-
|
|
6731
|
-
|
|
6732
|
-
|
|
6733
|
-
|
|
6734
|
-
}
|
|
6735
|
-
|
|
6736
|
-
|
|
6737
|
-
|
|
6738
|
-
|
|
6739
|
-
|
|
6827
|
+
//#region extensions/discord/src/monitor.gateway.ts
|
|
6828
|
+
async function waitForDiscordGatewayStop(params) {
|
|
6829
|
+
const { gateway, abortSignal } = params;
|
|
6830
|
+
return await new Promise((resolve, reject) => {
|
|
6831
|
+
let settled = false;
|
|
6832
|
+
const cleanup = () => {
|
|
6833
|
+
abortSignal?.removeEventListener("abort", onAbort);
|
|
6834
|
+
params.gatewaySupervisor?.detachLifecycle();
|
|
6835
|
+
};
|
|
6836
|
+
const finishResolve = () => {
|
|
6837
|
+
if (settled) return;
|
|
6838
|
+
settled = true;
|
|
6839
|
+
try {
|
|
6840
|
+
gateway?.disconnect?.();
|
|
6841
|
+
} finally {
|
|
6842
|
+
cleanup();
|
|
6843
|
+
resolve();
|
|
6844
|
+
}
|
|
6845
|
+
};
|
|
6846
|
+
const finishReject = (err) => {
|
|
6847
|
+
if (settled) return;
|
|
6848
|
+
settled = true;
|
|
6849
|
+
try {
|
|
6850
|
+
gateway?.disconnect?.();
|
|
6851
|
+
} finally {
|
|
6852
|
+
cleanup();
|
|
6853
|
+
reject(toLintErrorObject(err, "Non-Error rejection"));
|
|
6854
|
+
}
|
|
6855
|
+
};
|
|
6856
|
+
const onAbort = () => {
|
|
6857
|
+
finishResolve();
|
|
6858
|
+
};
|
|
6859
|
+
const onGatewayEvent = (event) => {
|
|
6860
|
+
if ((params.onGatewayEvent?.(event) ?? "stop") === "stop") finishReject(new DiscordGatewayLifecycleError(event));
|
|
6861
|
+
};
|
|
6862
|
+
const onForceStop = (err) => {
|
|
6863
|
+
finishReject(err);
|
|
6864
|
+
};
|
|
6865
|
+
if (abortSignal?.aborted) {
|
|
6866
|
+
onAbort();
|
|
6867
|
+
return;
|
|
6868
|
+
}
|
|
6869
|
+
abortSignal?.addEventListener("abort", onAbort, { once: true });
|
|
6870
|
+
params.gatewaySupervisor?.attachLifecycle(onGatewayEvent);
|
|
6871
|
+
params.registerForceStop?.(onForceStop);
|
|
6872
|
+
});
|
|
6740
6873
|
}
|
|
6741
|
-
function
|
|
6742
|
-
|
|
6743
|
-
return
|
|
6744
|
-
|
|
6745
|
-
|
|
6746
|
-
|
|
6747
|
-
aliasSummary ? `aliases:${aliasSummary}` : void 0
|
|
6748
|
-
]);
|
|
6874
|
+
function toLintErrorObject(value, fallbackMessage) {
|
|
6875
|
+
if (value instanceof Error) return value;
|
|
6876
|
+
if (typeof value === "string") return new Error(value);
|
|
6877
|
+
const error = new Error(fallbackMessage, { cause: value });
|
|
6878
|
+
if (typeof value === "object" && value !== null || typeof value === "function") Object.assign(error, value);
|
|
6879
|
+
return error;
|
|
6749
6880
|
}
|
|
6750
|
-
|
|
6751
|
-
|
|
6752
|
-
|
|
6753
|
-
|
|
6754
|
-
|
|
6755
|
-
|
|
6881
|
+
//#endregion
|
|
6882
|
+
//#region extensions/discord/src/monitor/provider.lifecycle.ts
|
|
6883
|
+
const DEFAULT_DISCORD_GATEWAY_READY_TIMEOUT_MS = 15e3;
|
|
6884
|
+
const DEFAULT_DISCORD_GATEWAY_RUNTIME_READY_TIMEOUT_MS = 3e4;
|
|
6885
|
+
const MAX_DISCORD_GATEWAY_READY_TIMEOUT_MS = 12e4;
|
|
6886
|
+
const DISCORD_GATEWAY_READY_TIMEOUT_ENV = "OPENCLAW_DISCORD_READY_TIMEOUT_MS";
|
|
6887
|
+
const DISCORD_GATEWAY_RUNTIME_READY_TIMEOUT_ENV = "OPENCLAW_DISCORD_RUNTIME_READY_TIMEOUT_MS";
|
|
6888
|
+
const DISCORD_GATEWAY_READY_POLL_MS = 250;
|
|
6889
|
+
const DISCORD_GATEWAY_READY_RETRY_BACKOFF_MS = 2e3;
|
|
6890
|
+
const DISCORD_GATEWAY_STARTUP_DISCONNECT_DRAIN_TIMEOUT_MS = 5e3;
|
|
6891
|
+
const DISCORD_GATEWAY_STARTUP_TERMINATE_CLOSE_TIMEOUT_MS = 1e3;
|
|
6892
|
+
const DISCORD_GATEWAY_TRANSPORT_ACTIVITY_STATUS_MIN_INTERVAL_MS = 3e4;
|
|
6893
|
+
function normalizeGatewayReadyTimeoutMs(value) {
|
|
6894
|
+
const numeric = parseStrictPositiveInteger(value);
|
|
6895
|
+
if (numeric === void 0) return;
|
|
6896
|
+
return Math.min(numeric, MAX_DISCORD_GATEWAY_READY_TIMEOUT_MS);
|
|
6756
6897
|
}
|
|
6757
|
-
function
|
|
6758
|
-
|
|
6759
|
-
const target = displayName || entry.id;
|
|
6760
|
-
const formatted = formatResolutionLogDetails(formatResolvedBase(entry.input, target), [
|
|
6761
|
-
displayName && entry.id && entry.id !== entry.input ? `id:${entry.id}` : void 0,
|
|
6762
|
-
entry.guildName ? `guild:${entry.guildName}` : void 0,
|
|
6763
|
-
entry.note
|
|
6764
|
-
]);
|
|
6765
|
-
return formatted === entry.input ? null : formatted;
|
|
6898
|
+
function resolveDiscordGatewayReadyTimeoutMs(params) {
|
|
6899
|
+
return normalizeGatewayReadyTimeoutMs(params?.configuredTimeoutMs) ?? normalizeGatewayReadyTimeoutMs(params?.env?.[DISCORD_GATEWAY_READY_TIMEOUT_ENV]) ?? DEFAULT_DISCORD_GATEWAY_READY_TIMEOUT_MS;
|
|
6766
6900
|
}
|
|
6767
|
-
function
|
|
6768
|
-
return
|
|
6769
|
-
entry.name ? `name:${entry.name}` : void 0,
|
|
6770
|
-
entry.guildName ? `guild:${entry.guildName}` : void 0,
|
|
6771
|
-
entry.note
|
|
6772
|
-
]);
|
|
6901
|
+
function resolveDiscordGatewayRuntimeReadyTimeoutMs(params) {
|
|
6902
|
+
return normalizeGatewayReadyTimeoutMs(params?.configuredTimeoutMs) ?? normalizeGatewayReadyTimeoutMs(params?.env?.[DISCORD_GATEWAY_RUNTIME_READY_TIMEOUT_ENV]) ?? DEFAULT_DISCORD_GATEWAY_RUNTIME_READY_TIMEOUT_MS;
|
|
6773
6903
|
}
|
|
6774
|
-
function
|
|
6775
|
-
if (!
|
|
6776
|
-
const
|
|
6777
|
-
|
|
6778
|
-
|
|
6779
|
-
|
|
6904
|
+
async function restartGatewayAfterReadyTimeout(params) {
|
|
6905
|
+
if (!params.gateway || params.abortSignal?.aborted) return;
|
|
6906
|
+
const socket = params.gateway.ws;
|
|
6907
|
+
if (!socket) {
|
|
6908
|
+
params.gateway.disconnect();
|
|
6909
|
+
if (!params.abortSignal?.aborted) params.gateway.connect(false);
|
|
6910
|
+
return;
|
|
6780
6911
|
}
|
|
6781
|
-
|
|
6912
|
+
await new Promise((resolve, reject) => {
|
|
6913
|
+
let settled = false;
|
|
6914
|
+
let drainTimeout;
|
|
6915
|
+
let terminateCloseTimeout;
|
|
6916
|
+
const ignoreSocketError = () => {};
|
|
6917
|
+
const clearTimers = () => {
|
|
6918
|
+
if (drainTimeout) {
|
|
6919
|
+
clearTimeout(drainTimeout);
|
|
6920
|
+
drainTimeout = void 0;
|
|
6921
|
+
}
|
|
6922
|
+
if (terminateCloseTimeout) {
|
|
6923
|
+
clearTimeout(terminateCloseTimeout);
|
|
6924
|
+
terminateCloseTimeout = void 0;
|
|
6925
|
+
}
|
|
6926
|
+
};
|
|
6927
|
+
const cleanup = () => {
|
|
6928
|
+
clearTimers();
|
|
6929
|
+
socket.removeListener("close", onClose);
|
|
6930
|
+
socket.removeListener("error", ignoreSocketError);
|
|
6931
|
+
};
|
|
6932
|
+
const finishResolve = () => {
|
|
6933
|
+
if (settled) return;
|
|
6934
|
+
settled = true;
|
|
6935
|
+
cleanup();
|
|
6936
|
+
resolve();
|
|
6937
|
+
};
|
|
6938
|
+
const finishReject = (error) => {
|
|
6939
|
+
if (params.abortSignal?.aborted) {
|
|
6940
|
+
finishResolve();
|
|
6941
|
+
return;
|
|
6942
|
+
}
|
|
6943
|
+
if (settled) return;
|
|
6944
|
+
settled = true;
|
|
6945
|
+
cleanup();
|
|
6946
|
+
reject(error);
|
|
6947
|
+
};
|
|
6948
|
+
const onClose = () => {
|
|
6949
|
+
finishResolve();
|
|
6950
|
+
};
|
|
6951
|
+
socket.on("error", ignoreSocketError);
|
|
6952
|
+
socket.on("close", onClose);
|
|
6953
|
+
params.gateway?.disconnect();
|
|
6954
|
+
drainTimeout = setTimeout(() => {
|
|
6955
|
+
if (settled) return;
|
|
6956
|
+
if (typeof socket.terminate !== "function") {
|
|
6957
|
+
finishReject(/* @__PURE__ */ new Error(`discord gateway socket did not close within ${DISCORD_GATEWAY_STARTUP_DISCONNECT_DRAIN_TIMEOUT_MS}ms before restart`));
|
|
6958
|
+
return;
|
|
6959
|
+
}
|
|
6960
|
+
params.runtime.error?.(danger(`discord: startup restart waiting on a stale gateway socket for ${DISCORD_GATEWAY_STARTUP_DISCONNECT_DRAIN_TIMEOUT_MS}ms; forcing terminate before reconnect`));
|
|
6961
|
+
try {
|
|
6962
|
+
socket.terminate();
|
|
6963
|
+
} catch {
|
|
6964
|
+
finishReject(/* @__PURE__ */ new Error(`discord gateway socket did not close within ${DISCORD_GATEWAY_STARTUP_DISCONNECT_DRAIN_TIMEOUT_MS}ms before restart`));
|
|
6965
|
+
return;
|
|
6966
|
+
}
|
|
6967
|
+
terminateCloseTimeout = setTimeout(() => {
|
|
6968
|
+
finishReject(/* @__PURE__ */ new Error(`discord gateway socket did not close within ${DISCORD_GATEWAY_STARTUP_DISCONNECT_DRAIN_TIMEOUT_MS}ms before restart`));
|
|
6969
|
+
}, DISCORD_GATEWAY_STARTUP_TERMINATE_CLOSE_TIMEOUT_MS);
|
|
6970
|
+
terminateCloseTimeout.unref?.();
|
|
6971
|
+
}, DISCORD_GATEWAY_STARTUP_DISCONNECT_DRAIN_TIMEOUT_MS);
|
|
6972
|
+
drainTimeout.unref?.();
|
|
6973
|
+
});
|
|
6974
|
+
if (!params.abortSignal?.aborted) params.gateway.connect(false);
|
|
6782
6975
|
}
|
|
6783
|
-
function
|
|
6784
|
-
|
|
6785
|
-
|
|
6976
|
+
function parseGatewayCloseCode(message) {
|
|
6977
|
+
const match = /Gateway websocket closed:\s*(\d{3,5})/.exec(message);
|
|
6978
|
+
if (!match?.[1]) return;
|
|
6979
|
+
const code = Number.parseInt(match[1], 10);
|
|
6980
|
+
return Number.isFinite(code) ? code : void 0;
|
|
6786
6981
|
}
|
|
6787
|
-
function
|
|
6788
|
-
|
|
6982
|
+
function resolveTransportActivityAt(event) {
|
|
6983
|
+
const at = event?.at;
|
|
6984
|
+
const timestampMs = asDateTimestampMs(at);
|
|
6985
|
+
return timestampMs !== void 0 && timestampMs >= 0 ? timestampMs : Date.now();
|
|
6789
6986
|
}
|
|
6790
|
-
function
|
|
6791
|
-
|
|
6792
|
-
|
|
6793
|
-
|
|
6794
|
-
|
|
6795
|
-
|
|
6796
|
-
|
|
6797
|
-
|
|
6798
|
-
|
|
6799
|
-
|
|
6800
|
-
guildKey
|
|
6801
|
-
});
|
|
6802
|
-
continue;
|
|
6987
|
+
function createGatewayStatusObserver(params) {
|
|
6988
|
+
let forceStopHandler;
|
|
6989
|
+
let queuedForceStopError;
|
|
6990
|
+
let readyPollId;
|
|
6991
|
+
let readyTimeoutId;
|
|
6992
|
+
const shouldStop = () => params.abortSignal?.aborted || params.isLifecycleStopping();
|
|
6993
|
+
const clearReadyWatch = () => {
|
|
6994
|
+
if (readyPollId) {
|
|
6995
|
+
clearInterval(readyPollId);
|
|
6996
|
+
readyPollId = void 0;
|
|
6803
6997
|
}
|
|
6804
|
-
|
|
6805
|
-
|
|
6806
|
-
|
|
6807
|
-
|
|
6808
|
-
|
|
6809
|
-
|
|
6810
|
-
|
|
6811
|
-
|
|
6812
|
-
|
|
6813
|
-
|
|
6814
|
-
|
|
6815
|
-
|
|
6816
|
-
|
|
6817
|
-
|
|
6818
|
-
|
|
6819
|
-
|
|
6998
|
+
if (readyTimeoutId) {
|
|
6999
|
+
clearTimeout(readyTimeoutId);
|
|
7000
|
+
readyTimeoutId = void 0;
|
|
7001
|
+
}
|
|
7002
|
+
};
|
|
7003
|
+
const triggerForceStop = (err) => {
|
|
7004
|
+
if (forceStopHandler) {
|
|
7005
|
+
forceStopHandler(err);
|
|
7006
|
+
return;
|
|
7007
|
+
}
|
|
7008
|
+
queuedForceStopError = err;
|
|
7009
|
+
};
|
|
7010
|
+
const pushConnectedStatus = (at) => {
|
|
7011
|
+
params.pushStatus({
|
|
7012
|
+
...createConnectedChannelStatusPatch(at),
|
|
7013
|
+
lastDisconnect: null,
|
|
7014
|
+
lastError: null
|
|
6820
7015
|
});
|
|
6821
|
-
|
|
6822
|
-
|
|
6823
|
-
|
|
6824
|
-
const
|
|
6825
|
-
|
|
6826
|
-
|
|
6827
|
-
|
|
6828
|
-
const sourceGuild = params.guildEntries[source.guildKey] ?? {};
|
|
6829
|
-
if (!entry.resolved || !entry.guildId) {
|
|
6830
|
-
unresolved.push(formatDiscordChannelUnresolved(entry));
|
|
6831
|
-
continue;
|
|
7016
|
+
};
|
|
7017
|
+
const startReadyWatch = () => {
|
|
7018
|
+
clearReadyWatch();
|
|
7019
|
+
const pollConnected = () => {
|
|
7020
|
+
if (shouldStop()) {
|
|
7021
|
+
clearReadyWatch();
|
|
7022
|
+
return;
|
|
6832
7023
|
}
|
|
6833
|
-
|
|
6834
|
-
|
|
6835
|
-
|
|
6836
|
-
|
|
6837
|
-
|
|
6838
|
-
|
|
6839
|
-
|
|
6840
|
-
|
|
6841
|
-
|
|
6842
|
-
|
|
6843
|
-
|
|
6844
|
-
|
|
6845
|
-
|
|
6846
|
-
|
|
6847
|
-
|
|
6848
|
-
|
|
6849
|
-
|
|
6850
|
-
|
|
6851
|
-
|
|
6852
|
-
|
|
6853
|
-
|
|
6854
|
-
|
|
6855
|
-
|
|
6856
|
-
|
|
6857
|
-
|
|
6858
|
-
|
|
6859
|
-
|
|
6860
|
-
|
|
6861
|
-
|
|
6862
|
-
|
|
6863
|
-
|
|
6864
|
-
|
|
6865
|
-
|
|
6866
|
-
|
|
6867
|
-
|
|
6868
|
-
|
|
7024
|
+
if (!params.gateway?.isConnected) return;
|
|
7025
|
+
clearReadyWatch();
|
|
7026
|
+
pushConnectedStatus(Date.now());
|
|
7027
|
+
};
|
|
7028
|
+
pollConnected();
|
|
7029
|
+
if (!readyTimeoutId) {
|
|
7030
|
+
readyPollId = setInterval(pollConnected, DISCORD_GATEWAY_READY_POLL_MS);
|
|
7031
|
+
readyPollId.unref?.();
|
|
7032
|
+
readyTimeoutId = setTimeout(() => {
|
|
7033
|
+
clearReadyWatch();
|
|
7034
|
+
if (shouldStop() || params.gateway?.isConnected) return;
|
|
7035
|
+
const at = Date.now();
|
|
7036
|
+
const error = /* @__PURE__ */ new Error(`discord gateway opened but did not reach READY within ${params.runtimeReadyTimeoutMs}ms`);
|
|
7037
|
+
params.pushStatus({
|
|
7038
|
+
connected: false,
|
|
7039
|
+
lastEventAt: at,
|
|
7040
|
+
lastDisconnect: {
|
|
7041
|
+
at,
|
|
7042
|
+
error: "runtime-not-ready"
|
|
7043
|
+
},
|
|
7044
|
+
lastError: "runtime-not-ready"
|
|
7045
|
+
});
|
|
7046
|
+
params.runtime.error?.(danger(error.message));
|
|
7047
|
+
triggerForceStop(error);
|
|
7048
|
+
}, params.runtimeReadyTimeoutMs);
|
|
7049
|
+
readyTimeoutId.unref?.();
|
|
7050
|
+
}
|
|
7051
|
+
};
|
|
7052
|
+
const onGatewayDebug = (msg) => {
|
|
7053
|
+
if (shouldStop()) return;
|
|
7054
|
+
const at = Date.now();
|
|
7055
|
+
const message = String(msg);
|
|
7056
|
+
if (message.includes("Gateway websocket opened")) {
|
|
7057
|
+
params.pushStatus({
|
|
7058
|
+
connected: false,
|
|
7059
|
+
lastEventAt: at
|
|
7060
|
+
});
|
|
7061
|
+
startReadyWatch();
|
|
7062
|
+
return;
|
|
7063
|
+
}
|
|
7064
|
+
if (message.includes("Gateway websocket closed")) {
|
|
7065
|
+
clearReadyWatch();
|
|
7066
|
+
const code = parseGatewayCloseCode(message);
|
|
7067
|
+
params.pushStatus({
|
|
7068
|
+
connected: false,
|
|
7069
|
+
lastEventAt: at,
|
|
7070
|
+
lastDisconnect: {
|
|
7071
|
+
at,
|
|
7072
|
+
...code !== void 0 ? { status: code } : {}
|
|
7073
|
+
}
|
|
7074
|
+
});
|
|
7075
|
+
return;
|
|
7076
|
+
}
|
|
7077
|
+
if (message.includes("Gateway reconnect scheduled in")) {
|
|
7078
|
+
clearReadyWatch();
|
|
7079
|
+
params.pushStatus({
|
|
7080
|
+
connected: false,
|
|
7081
|
+
lastEventAt: at,
|
|
7082
|
+
lastError: message
|
|
7083
|
+
});
|
|
7084
|
+
}
|
|
7085
|
+
};
|
|
7086
|
+
return {
|
|
7087
|
+
onGatewayDebug,
|
|
7088
|
+
clearReadyWatch,
|
|
7089
|
+
registerForceStop: (handler) => {
|
|
7090
|
+
forceStopHandler = handler;
|
|
7091
|
+
if (queuedForceStopError !== void 0) {
|
|
7092
|
+
const err = queuedForceStopError;
|
|
7093
|
+
queuedForceStopError = void 0;
|
|
7094
|
+
handler(err);
|
|
6869
7095
|
}
|
|
7096
|
+
},
|
|
7097
|
+
dispose: () => {
|
|
7098
|
+
clearReadyWatch();
|
|
7099
|
+
forceStopHandler = void 0;
|
|
7100
|
+
queuedForceStopError = void 0;
|
|
6870
7101
|
}
|
|
6871
|
-
|
|
6872
|
-
return nextGuilds;
|
|
6873
|
-
} catch (err) {
|
|
6874
|
-
params.runtime.log?.(`discord channel resolve failed; using config entries. ${formatErrorMessage$1(err)}`);
|
|
6875
|
-
return params.guildEntries;
|
|
6876
|
-
}
|
|
7102
|
+
};
|
|
6877
7103
|
}
|
|
6878
|
-
async function
|
|
6879
|
-
const
|
|
6880
|
-
|
|
6881
|
-
|
|
6882
|
-
|
|
6883
|
-
|
|
6884
|
-
|
|
6885
|
-
|
|
6886
|
-
|
|
6887
|
-
|
|
6888
|
-
|
|
7104
|
+
async function waitForGatewayReady(params) {
|
|
7105
|
+
const waitUntilReady = async () => {
|
|
7106
|
+
const deadlineAt = Date.now() + params.readyTimeoutMs;
|
|
7107
|
+
while (!params.abortSignal?.aborted) {
|
|
7108
|
+
if (await params.beforePoll?.() === "stop") return "stopped";
|
|
7109
|
+
if (params.gateway?.isConnected === true) {
|
|
7110
|
+
const at = Date.now();
|
|
7111
|
+
params.pushStatus?.({
|
|
7112
|
+
...createConnectedChannelStatusPatch(at),
|
|
7113
|
+
lastDisconnect: null,
|
|
7114
|
+
lastError: null
|
|
7115
|
+
});
|
|
7116
|
+
return "ready";
|
|
7117
|
+
}
|
|
7118
|
+
if (Date.now() >= deadlineAt) return "timeout";
|
|
7119
|
+
await new Promise((resolve) => {
|
|
7120
|
+
setTimeout(resolve, DISCORD_GATEWAY_READY_POLL_MS).unref?.();
|
|
7121
|
+
});
|
|
7122
|
+
}
|
|
7123
|
+
return "stopped";
|
|
7124
|
+
};
|
|
7125
|
+
if (!params.gateway) {
|
|
7126
|
+
if (await waitUntilReady() === "timeout") throw new Error(`discord gateway did not reach READY within ${params.readyTimeoutMs}ms`);
|
|
7127
|
+
return;
|
|
7128
|
+
}
|
|
7129
|
+
let attempt = 0;
|
|
7130
|
+
while (!params.abortSignal?.aborted) {
|
|
7131
|
+
if (await waitUntilReady() !== "timeout") return;
|
|
7132
|
+
attempt += 1;
|
|
7133
|
+
const restartAt = Date.now();
|
|
7134
|
+
params.runtime.error?.(danger(`discord: gateway READY wait timed out after ${params.readyTimeoutMs}ms; reconnecting with backoff (attempt ${attempt})`));
|
|
7135
|
+
params.pushStatus?.({
|
|
7136
|
+
connected: false,
|
|
7137
|
+
lastEventAt: restartAt,
|
|
7138
|
+
lastDisconnect: {
|
|
7139
|
+
at: restartAt,
|
|
7140
|
+
error: "startup-not-ready"
|
|
7141
|
+
},
|
|
7142
|
+
lastError: "startup-not-ready"
|
|
6889
7143
|
});
|
|
6890
|
-
|
|
6891
|
-
|
|
6892
|
-
|
|
7144
|
+
await params.beforeRestart?.();
|
|
7145
|
+
await restartGatewayAfterReadyTimeout({
|
|
7146
|
+
gateway: params.gateway,
|
|
7147
|
+
abortSignal: params.abortSignal,
|
|
7148
|
+
runtime: params.runtime
|
|
6893
7149
|
});
|
|
6894
|
-
|
|
6895
|
-
|
|
6896
|
-
|
|
6897
|
-
|
|
6898
|
-
|
|
6899
|
-
}
|
|
6900
|
-
}
|
|
6901
|
-
function collectGuildUserEntries(guildEntries) {
|
|
6902
|
-
const userEntries = /* @__PURE__ */ new Set();
|
|
6903
|
-
for (const guild of Object.values(guildEntries)) {
|
|
6904
|
-
if (!guild || typeof guild !== "object") continue;
|
|
6905
|
-
addAllowlistUserEntriesFromConfigEntry(userEntries, guild);
|
|
6906
|
-
const channels = guild.channels ?? {};
|
|
6907
|
-
for (const channel of Object.values(channels)) addAllowlistUserEntriesFromConfigEntry(userEntries, channel);
|
|
6908
|
-
}
|
|
6909
|
-
return userEntries;
|
|
6910
|
-
}
|
|
6911
|
-
async function resolveGuildEntriesByUserAllowlist(params) {
|
|
6912
|
-
const userEntries = collectGuildUserEntries(params.guildEntries);
|
|
6913
|
-
if (userEntries.size === 0) return params.guildEntries;
|
|
6914
|
-
try {
|
|
6915
|
-
const { resolvedMap, mapping, unresolved } = buildAllowlistResolutionSummary(await resolveDiscordUserAllowlist({
|
|
6916
|
-
token: params.token,
|
|
6917
|
-
entries: Array.from(userEntries),
|
|
6918
|
-
fetcher: params.fetcher
|
|
6919
|
-
}), {
|
|
6920
|
-
formatResolved: formatDiscordUserResolved,
|
|
6921
|
-
formatUnresolved: formatDiscordUserUnresolved
|
|
6922
|
-
});
|
|
6923
|
-
const nextGuilds = { ...params.guildEntries };
|
|
6924
|
-
for (const [guildKey, guildConfig] of Object.entries(params.guildEntries)) {
|
|
6925
|
-
if (!guildConfig || typeof guildConfig !== "object") continue;
|
|
6926
|
-
const nextGuild = { ...guildConfig };
|
|
6927
|
-
const users = guildConfig.users;
|
|
6928
|
-
if (Array.isArray(users) && users.length > 0) nextGuild.users = canonicalizeAllowlistWithResolvedIds({
|
|
6929
|
-
existing: users,
|
|
6930
|
-
resolvedMap
|
|
6931
|
-
});
|
|
6932
|
-
const channels = guildConfig.channels ?? {};
|
|
6933
|
-
if (channels && typeof channels === "object") nextGuild.channels = patchAllowlistUsersInConfigEntries({
|
|
6934
|
-
entries: channels,
|
|
6935
|
-
resolvedMap,
|
|
6936
|
-
strategy: "canonicalize"
|
|
6937
|
-
});
|
|
6938
|
-
nextGuilds[guildKey] = nextGuild;
|
|
7150
|
+
if (params.abortSignal?.aborted) return;
|
|
7151
|
+
try {
|
|
7152
|
+
await sleepWithAbort(DISCORD_GATEWAY_READY_RETRY_BACKOFF_MS, params.abortSignal, { ref: false });
|
|
7153
|
+
} catch {
|
|
7154
|
+
return;
|
|
6939
7155
|
}
|
|
6940
|
-
summarizeMapping("discord channel users", mapping, unresolved, params.runtime);
|
|
6941
|
-
return nextGuilds;
|
|
6942
|
-
} catch (err) {
|
|
6943
|
-
params.runtime.log?.(`discord channel user resolve failed; using config entries. ${formatErrorMessage$1(err)}`);
|
|
6944
|
-
return params.guildEntries;
|
|
6945
7156
|
}
|
|
6946
7157
|
}
|
|
6947
|
-
async function
|
|
6948
|
-
|
|
6949
|
-
|
|
6950
|
-
if (
|
|
6951
|
-
|
|
6952
|
-
|
|
6953
|
-
|
|
7158
|
+
async function runDiscordGatewayLifecycle(params) {
|
|
7159
|
+
const gateway = params.gateway;
|
|
7160
|
+
const gatewayReadyAtLifecycleStart = gateway?.isConnected === true;
|
|
7161
|
+
if (gateway) registerGateway(params.accountId, gateway);
|
|
7162
|
+
const gatewayEmitter = params.gatewaySupervisor.emitter ?? getDiscordGatewayEmitter(gateway);
|
|
7163
|
+
const stopGatewayLogging = attachDiscordGatewayLogging({
|
|
7164
|
+
emitter: gatewayEmitter,
|
|
6954
7165
|
runtime: params.runtime
|
|
6955
7166
|
});
|
|
6956
|
-
|
|
6957
|
-
|
|
6958
|
-
|
|
6959
|
-
|
|
6960
|
-
|
|
6961
|
-
|
|
7167
|
+
let lifecycleStopping = false;
|
|
7168
|
+
const pushStatus = (patch) => {
|
|
7169
|
+
params.statusSink?.(patch);
|
|
7170
|
+
};
|
|
7171
|
+
const gatewayReadyTimeoutMs = resolveDiscordGatewayReadyTimeoutMs({
|
|
7172
|
+
configuredTimeoutMs: params.gatewayReadyTimeoutMs,
|
|
7173
|
+
env: process.env
|
|
7174
|
+
});
|
|
7175
|
+
const gatewayRuntimeReadyTimeoutMs = resolveDiscordGatewayRuntimeReadyTimeoutMs({
|
|
7176
|
+
configuredTimeoutMs: params.gatewayRuntimeReadyTimeoutMs,
|
|
7177
|
+
env: process.env
|
|
7178
|
+
});
|
|
7179
|
+
const statusObserver = createGatewayStatusObserver({
|
|
7180
|
+
gateway,
|
|
7181
|
+
abortSignal: params.abortSignal,
|
|
7182
|
+
runtime: params.runtime,
|
|
7183
|
+
pushStatus,
|
|
7184
|
+
isLifecycleStopping: () => lifecycleStopping,
|
|
7185
|
+
runtimeReadyTimeoutMs: gatewayRuntimeReadyTimeoutMs
|
|
7186
|
+
});
|
|
7187
|
+
gatewayEmitter?.on("debug", statusObserver.onGatewayDebug);
|
|
7188
|
+
let lastTransportActivityStatusAt;
|
|
7189
|
+
const onGatewayTransportActivity = (event) => {
|
|
7190
|
+
if (lifecycleStopping || params.abortSignal?.aborted) return;
|
|
7191
|
+
const at = resolveTransportActivityAt(event);
|
|
7192
|
+
if (lastTransportActivityStatusAt !== void 0 && at - lastTransportActivityStatusAt < DISCORD_GATEWAY_TRANSPORT_ACTIVITY_STATUS_MIN_INTERVAL_MS) return;
|
|
7193
|
+
lastTransportActivityStatusAt = at;
|
|
7194
|
+
pushStatus(createTransportActivityStatusPatch(at));
|
|
7195
|
+
};
|
|
7196
|
+
gatewayEmitter?.on(DISCORD_GATEWAY_TRANSPORT_ACTIVITY_EVENT, onGatewayTransportActivity);
|
|
7197
|
+
let sawDisallowedIntents = false;
|
|
7198
|
+
const handleGatewayEvent = (event) => {
|
|
7199
|
+
if (params.abortSignal?.aborted && event.type === "reconnect-exhausted") {
|
|
7200
|
+
lifecycleStopping = true;
|
|
7201
|
+
params.runtime.log?.(`discord: treating reconnect-exhausted during expected shutdown as clean: ${event.message}`);
|
|
7202
|
+
return "continue";
|
|
7203
|
+
}
|
|
7204
|
+
if (event.type === "disallowed-intents") {
|
|
7205
|
+
lifecycleStopping = true;
|
|
7206
|
+
sawDisallowedIntents = true;
|
|
7207
|
+
params.runtime.error?.(danger("discord: gateway closed with code 4014 (missing privileged gateway intents). Enable the required intents in the Discord Developer Portal or disable them in config."));
|
|
7208
|
+
return "stop";
|
|
7209
|
+
}
|
|
7210
|
+
if (event.shouldStopLifecycle) lifecycleStopping = true;
|
|
7211
|
+
params.runtime.error?.(danger(event.shouldStopLifecycle ? `discord gateway ${event.type}: ${event.message}` : `discord gateway error: ${event.message}`));
|
|
7212
|
+
return event.shouldStopLifecycle ? "stop" : "continue";
|
|
7213
|
+
};
|
|
7214
|
+
const drainPendingGatewayErrors = () => params.gatewaySupervisor.drainPending((event) => {
|
|
7215
|
+
if (handleGatewayEvent(event) !== "stop") return "continue";
|
|
7216
|
+
if (event.type === "disallowed-intents") return "stop";
|
|
7217
|
+
throw new DiscordGatewayLifecycleError(event);
|
|
7218
|
+
});
|
|
7219
|
+
try {
|
|
7220
|
+
if (drainPendingGatewayErrors() === "stop") return;
|
|
7221
|
+
if (gatewayReadyAtLifecycleStart && params.voiceManager) params.voiceManager.autoJoin().catch((err) => params.runtime.error?.(danger(`discord voice: autoJoin failed: ${formatErrorMessage$1(err)}`)));
|
|
7222
|
+
await waitForGatewayReady({
|
|
7223
|
+
gateway,
|
|
7224
|
+
abortSignal: params.abortSignal,
|
|
7225
|
+
beforePoll: drainPendingGatewayErrors,
|
|
7226
|
+
pushStatus,
|
|
7227
|
+
runtime: params.runtime,
|
|
7228
|
+
beforeRestart: statusObserver.clearReadyWatch,
|
|
7229
|
+
readyTimeoutMs: gatewayReadyTimeoutMs
|
|
6962
7230
|
});
|
|
6963
|
-
if (
|
|
6964
|
-
|
|
6965
|
-
|
|
6966
|
-
|
|
6967
|
-
|
|
7231
|
+
if (drainPendingGatewayErrors() === "stop") return;
|
|
7232
|
+
await waitForDiscordGatewayStop({
|
|
7233
|
+
gateway: gateway ? { disconnect: () => gateway.disconnect() } : void 0,
|
|
7234
|
+
abortSignal: params.abortSignal,
|
|
7235
|
+
gatewaySupervisor: params.gatewaySupervisor,
|
|
7236
|
+
onGatewayEvent: handleGatewayEvent,
|
|
7237
|
+
registerForceStop: statusObserver.registerForceStop
|
|
6968
7238
|
});
|
|
6969
|
-
}
|
|
6970
|
-
return {
|
|
6971
|
-
guildEntries: hasGuildEntries(guildEntries) ? guildEntries : void 0,
|
|
6972
|
-
allowFrom
|
|
6973
|
-
};
|
|
6974
|
-
}
|
|
6975
|
-
//#endregion
|
|
6976
|
-
//#region extensions/discord/src/monitor/provider.cleanup.ts
|
|
6977
|
-
function cleanupDiscordProviderStartup(params) {
|
|
6978
|
-
params.deactivateMessageHandler?.();
|
|
6979
|
-
params.autoPresenceController?.stop();
|
|
6980
|
-
params.setStatus?.({ connected: false });
|
|
6981
|
-
if (params.onEarlyGatewayDebug) params.earlyGatewayEmitter?.removeListener("debug", params.onEarlyGatewayDebug);
|
|
6982
|
-
if (!params.lifecycleStarted) try {
|
|
6983
|
-
params.lifecycleGateway?.disconnect();
|
|
6984
7239
|
} catch (err) {
|
|
6985
|
-
|
|
7240
|
+
if (!sawDisallowedIntents && !params.isDisallowedIntentsError(err)) throw err;
|
|
7241
|
+
} finally {
|
|
7242
|
+
lifecycleStopping = true;
|
|
7243
|
+
params.gatewaySupervisor.detachLifecycle();
|
|
7244
|
+
unregisterGateway(params.accountId);
|
|
7245
|
+
stopGatewayLogging();
|
|
7246
|
+
statusObserver.dispose();
|
|
7247
|
+
gatewayEmitter?.removeListener("debug", statusObserver.onGatewayDebug);
|
|
7248
|
+
gatewayEmitter?.removeListener(DISCORD_GATEWAY_TRANSPORT_ACTIVITY_EVENT, onGatewayTransportActivity);
|
|
7249
|
+
if (params.voiceManager) {
|
|
7250
|
+
await params.voiceManager.destroy();
|
|
7251
|
+
const { setDiscordTranscriptsVoiceManager } = await import("./transcripts-source-DjDbt14x.js").then((n) => n.n);
|
|
7252
|
+
setDiscordTranscriptsVoiceManager({
|
|
7253
|
+
accountId: params.accountId,
|
|
7254
|
+
manager: null
|
|
7255
|
+
});
|
|
7256
|
+
params.voiceManagerRef.current = null;
|
|
7257
|
+
}
|
|
7258
|
+
params.threadBindings.stop();
|
|
6986
7259
|
}
|
|
6987
|
-
params.gatewaySupervisor?.dispose();
|
|
6988
|
-
if (!params.lifecycleStarted) params.threadBindings.stop();
|
|
6989
7260
|
}
|
|
6990
7261
|
//#endregion
|
|
6991
|
-
//#region extensions/discord/src/monitor/provider.
|
|
6992
|
-
let
|
|
6993
|
-
|
|
6994
|
-
|
|
6995
|
-
|
|
7262
|
+
//#region extensions/discord/src/monitor/provider-runtime.ts
|
|
7263
|
+
let discordVoiceRuntimePromise;
|
|
7264
|
+
let discordProviderSessionRuntimePromise;
|
|
7265
|
+
async function loadDiscordVoiceRuntime() {
|
|
7266
|
+
const promise = discordVoiceRuntimePromise ?? import("./manager.runtime-Cc8vS-M7.js");
|
|
7267
|
+
discordVoiceRuntimePromise = promise;
|
|
6996
7268
|
try {
|
|
6997
7269
|
return await promise;
|
|
6998
7270
|
} catch (error) {
|
|
6999
|
-
if (
|
|
7271
|
+
if (discordVoiceRuntimePromise === promise) discordVoiceRuntimePromise = void 0;
|
|
7000
7272
|
throw error;
|
|
7001
7273
|
}
|
|
7002
7274
|
}
|
|
7003
|
-
async function
|
|
7004
|
-
const
|
|
7005
|
-
|
|
7006
|
-
|
|
7007
|
-
|
|
7008
|
-
|
|
7009
|
-
if (
|
|
7010
|
-
|
|
7011
|
-
params.runtime.error?.(danger(`discord: plugin command "/${normalizedName}" duplicates an existing native command. Skipping.`));
|
|
7012
|
-
continue;
|
|
7013
|
-
}
|
|
7014
|
-
existingNames.add(normalizedName);
|
|
7015
|
-
merged.push({
|
|
7016
|
-
name: pluginCommand.name,
|
|
7017
|
-
description: pluginCommand.description,
|
|
7018
|
-
acceptsArgs: pluginCommand.acceptsArgs
|
|
7019
|
-
});
|
|
7020
|
-
}
|
|
7021
|
-
return merged;
|
|
7022
|
-
}
|
|
7023
|
-
async function resolveDiscordProviderCommandSpecs(params) {
|
|
7024
|
-
const listSkillCommands = params.listSkillCommandsForAgents ?? listSkillCommandsForAgents;
|
|
7025
|
-
const listNativeCommandSpecs = params.listNativeCommandSpecsForConfig ?? listNativeCommandSpecsForConfig;
|
|
7026
|
-
const maxDiscordCommands = params.maxDiscordCommands ?? 100;
|
|
7027
|
-
let skillCommands = params.nativeEnabled && params.nativeSkillsEnabled ? listSkillCommands({ cfg: params.cfg }) : [];
|
|
7028
|
-
let commandSpecs = params.nativeEnabled ? listNativeCommandSpecs(params.cfg, {
|
|
7029
|
-
skillCommands,
|
|
7030
|
-
provider: "discord"
|
|
7031
|
-
}) : [];
|
|
7032
|
-
if (params.nativeEnabled) commandSpecs = await appendPluginCommandSpecs({
|
|
7033
|
-
commandSpecs,
|
|
7034
|
-
runtime: params.runtime,
|
|
7035
|
-
cfg: params.cfg,
|
|
7036
|
-
getPluginCommandSpecs: params.getPluginCommandSpecs
|
|
7037
|
-
});
|
|
7038
|
-
const initialCommandCount = commandSpecs.length;
|
|
7039
|
-
if (params.nativeEnabled && params.nativeSkillsEnabled && commandSpecs.length > maxDiscordCommands) {
|
|
7040
|
-
skillCommands = [];
|
|
7041
|
-
commandSpecs = listNativeCommandSpecs(params.cfg, {
|
|
7042
|
-
skillCommands: [],
|
|
7043
|
-
provider: "discord"
|
|
7044
|
-
});
|
|
7045
|
-
commandSpecs = await appendPluginCommandSpecs({
|
|
7046
|
-
commandSpecs,
|
|
7047
|
-
runtime: params.runtime,
|
|
7048
|
-
cfg: params.cfg,
|
|
7049
|
-
getPluginCommandSpecs: params.getPluginCommandSpecs
|
|
7050
|
-
});
|
|
7051
|
-
params.runtime.log?.(warn(`${initialCommandCount} commands exceed the ${maxDiscordCommands}-command Discord limit; removing per-skill commands and keeping /skill.`));
|
|
7275
|
+
async function loadDiscordProviderSessionRuntime() {
|
|
7276
|
+
const promise = discordProviderSessionRuntimePromise ?? import("./provider-session.runtime-cCfGMsF_.js");
|
|
7277
|
+
discordProviderSessionRuntimePromise = promise;
|
|
7278
|
+
try {
|
|
7279
|
+
return await promise;
|
|
7280
|
+
} catch (error) {
|
|
7281
|
+
if (discordProviderSessionRuntimePromise === promise) discordProviderSessionRuntimePromise = void 0;
|
|
7282
|
+
throw error;
|
|
7052
7283
|
}
|
|
7053
|
-
if (params.nativeEnabled && commandSpecs.length > maxDiscordCommands) params.runtime.log?.(warn(`${commandSpecs.length} commands exceed the ${maxDiscordCommands}-command Discord limit; some commands may fail to deploy.`));
|
|
7054
|
-
return {
|
|
7055
|
-
skillCommands,
|
|
7056
|
-
commandSpecs
|
|
7057
|
-
};
|
|
7058
7284
|
}
|
|
7285
|
+
const discordProviderRuntime = {
|
|
7286
|
+
fetchDiscordApplicationId,
|
|
7287
|
+
createDiscordNativeCommand,
|
|
7288
|
+
runDiscordGatewayLifecycle,
|
|
7289
|
+
loadDiscordVoiceRuntime,
|
|
7290
|
+
loadDiscordProviderSessionRuntime,
|
|
7291
|
+
createClient: (...args) => new Client(...args),
|
|
7292
|
+
getPluginCommandSpecs: void 0,
|
|
7293
|
+
resolveDiscordAccount,
|
|
7294
|
+
resolveNativeCommandsEnabled,
|
|
7295
|
+
resolveNativeSkillsEnabled,
|
|
7296
|
+
listNativeCommandSpecsForConfig,
|
|
7297
|
+
listSkillCommandsForAgents,
|
|
7298
|
+
isVerbose,
|
|
7299
|
+
shouldLogVerbose
|
|
7300
|
+
};
|
|
7059
7301
|
//#endregion
|
|
7060
|
-
//#region extensions/discord/src/monitor/provider.
|
|
7061
|
-
|
|
7062
|
-
|
|
7063
|
-
|
|
7064
|
-
|
|
7065
|
-
function logDiscordResolvedConfig(params) {
|
|
7066
|
-
const allowFromSummary = summarizeStringEntries({
|
|
7067
|
-
entries: params.allowFrom ?? [],
|
|
7068
|
-
limit: 4,
|
|
7069
|
-
emptyText: "any"
|
|
7070
|
-
});
|
|
7071
|
-
const groupDmChannelSummary = summarizeStringEntries({
|
|
7072
|
-
entries: params.groupDmChannels ?? [],
|
|
7073
|
-
limit: 4,
|
|
7074
|
-
emptyText: "any"
|
|
7075
|
-
});
|
|
7076
|
-
const guildSummary = summarizeStringEntries({
|
|
7077
|
-
entries: Object.keys(params.guildEntries ?? {}),
|
|
7078
|
-
limit: 4,
|
|
7079
|
-
emptyText: "any"
|
|
7080
|
-
});
|
|
7081
|
-
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 / (1024 * 1024))} 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)}`);
|
|
7302
|
+
//#region extensions/discord/src/monitor/provider.acp.ts
|
|
7303
|
+
const DISCORD_ACP_STATUS_PROBE_TIMEOUT_MS = 8e3;
|
|
7304
|
+
const DISCORD_ACP_STALE_RUNNING_ACTIVITY_MS = 120 * 1e3;
|
|
7305
|
+
function isLegacyMissingSessionError(message) {
|
|
7306
|
+
return message.includes("Session is not ACP-enabled") || message.includes("ACP session metadata missing");
|
|
7082
7307
|
}
|
|
7083
|
-
|
|
7084
|
-
|
|
7085
|
-
|
|
7086
|
-
|
|
7087
|
-
|
|
7088
|
-
|
|
7089
|
-
|
|
7308
|
+
function classifyAcpStatusProbeError(params) {
|
|
7309
|
+
if (params.isAcpRuntimeError(params.error) && params.error.code === "ACP_SESSION_INIT_FAILED") return {
|
|
7310
|
+
status: "stale",
|
|
7311
|
+
reason: "session-init-failed"
|
|
7312
|
+
};
|
|
7313
|
+
if (isLegacyMissingSessionError(formatErrorMessage$1(params.error))) return {
|
|
7314
|
+
status: "stale",
|
|
7315
|
+
reason: "session-missing"
|
|
7316
|
+
};
|
|
7317
|
+
return params.isStaleRunning ? {
|
|
7318
|
+
status: "stale",
|
|
7319
|
+
reason: "status-error-running-stale"
|
|
7320
|
+
} : {
|
|
7321
|
+
status: "uncertain",
|
|
7322
|
+
reason: "status-error"
|
|
7323
|
+
};
|
|
7090
7324
|
}
|
|
7091
|
-
function
|
|
7092
|
-
if (
|
|
7093
|
-
const
|
|
7094
|
-
|
|
7095
|
-
|
|
7096
|
-
|
|
7097
|
-
if (typeof context.timeoutMs === "number" && Number.isFinite(context.timeoutMs)) deployErr.deployTimeoutMs = context.timeoutMs;
|
|
7325
|
+
function resolveRunningActivityAgeMs(params) {
|
|
7326
|
+
if (params.storedState !== "running") return 0;
|
|
7327
|
+
const nowMs = asDateTimestampMs(Date.now());
|
|
7328
|
+
if (nowMs === void 0) return 0;
|
|
7329
|
+
const activityAtMs = asDateTimestampMs(params.lastActivityAt);
|
|
7330
|
+
return Math.max(0, nowMs - (activityAtMs === void 0 ? 0 : Math.max(0, Math.floor(activityAtMs))));
|
|
7098
7331
|
}
|
|
7099
|
-
function
|
|
7100
|
-
|
|
7101
|
-
|
|
7102
|
-
|
|
7103
|
-
|
|
7104
|
-
|
|
7105
|
-
|
|
7106
|
-
|
|
7107
|
-
|
|
7108
|
-
|
|
7332
|
+
async function probeDiscordAcpBindingHealth(params) {
|
|
7333
|
+
const { getAcpSessionManager, isAcpRuntimeError } = params.providerSessionRuntime;
|
|
7334
|
+
const manager = getAcpSessionManager();
|
|
7335
|
+
const statusProbeAbortController = new AbortController();
|
|
7336
|
+
const result = await raceWithTimeout({
|
|
7337
|
+
promise: manager.getSessionStatus({
|
|
7338
|
+
cfg: params.cfg,
|
|
7339
|
+
sessionKey: params.sessionKey,
|
|
7340
|
+
signal: statusProbeAbortController.signal
|
|
7341
|
+
}).then((status) => ({
|
|
7342
|
+
kind: "status",
|
|
7343
|
+
status
|
|
7344
|
+
})).catch((error) => ({
|
|
7345
|
+
kind: "error",
|
|
7346
|
+
error
|
|
7347
|
+
})),
|
|
7348
|
+
timeoutMs: DISCORD_ACP_STATUS_PROBE_TIMEOUT_MS,
|
|
7349
|
+
onTimeout: () => ({ kind: "timeout" })
|
|
7350
|
+
});
|
|
7351
|
+
if (result.kind === "timeout") statusProbeAbortController.abort();
|
|
7352
|
+
const runningForMs = resolveRunningActivityAgeMs(params);
|
|
7353
|
+
const isStaleRunning = params.storedState === "running" && runningForMs >= DISCORD_ACP_STALE_RUNNING_ACTIVITY_MS;
|
|
7354
|
+
if (result.kind === "timeout") return isStaleRunning ? {
|
|
7355
|
+
status: "stale",
|
|
7356
|
+
reason: "status-timeout-running-stale"
|
|
7357
|
+
} : {
|
|
7358
|
+
status: "uncertain",
|
|
7359
|
+
reason: "status-timeout"
|
|
7360
|
+
};
|
|
7361
|
+
if (result.kind === "error") return classifyAcpStatusProbeError({
|
|
7362
|
+
error: result.error,
|
|
7363
|
+
isStaleRunning,
|
|
7364
|
+
isAcpRuntimeError
|
|
7365
|
+
});
|
|
7366
|
+
if (result.status.state === "error") return {
|
|
7367
|
+
status: "uncertain",
|
|
7368
|
+
reason: "status-error-state"
|
|
7369
|
+
};
|
|
7370
|
+
return { status: "healthy" };
|
|
7109
7371
|
}
|
|
7110
|
-
|
|
7111
|
-
|
|
7112
|
-
|
|
7113
|
-
|
|
7372
|
+
//#endregion
|
|
7373
|
+
//#region extensions/discord/src/monitor/provider.allowlist.ts
|
|
7374
|
+
function formatResolutionLogDetails(base, details) {
|
|
7375
|
+
const nonEmpty = details.map((value) => value?.trim()).filter((value) => Boolean(value));
|
|
7376
|
+
return nonEmpty.length > 0 ? `${base} (${nonEmpty.join("; ")})` : base;
|
|
7114
7377
|
}
|
|
7115
|
-
function
|
|
7116
|
-
if (!
|
|
7117
|
-
|
|
7118
|
-
const source = (payload.errors && typeof payload.errors === "object" ? payload.errors : void 0) ?? rawBody;
|
|
7119
|
-
return source && typeof source === "object" ? source : null;
|
|
7378
|
+
function formatResolvedBase(input, target) {
|
|
7379
|
+
if (!target) return input;
|
|
7380
|
+
return input === target ? input : `${input}→${target}`;
|
|
7120
7381
|
}
|
|
7121
|
-
function
|
|
7122
|
-
|
|
7382
|
+
function formatAliasSummary(aliases) {
|
|
7383
|
+
if (aliases.length === 0) return;
|
|
7384
|
+
const preview = aliases.slice(0, 3).join(", ");
|
|
7385
|
+
if (aliases.length <= 3) return preview;
|
|
7386
|
+
return `${preview}, +${aliases.length - 3} more`;
|
|
7123
7387
|
}
|
|
7124
|
-
function
|
|
7125
|
-
|
|
7126
|
-
|
|
7388
|
+
function formatDiscordChannelResolvedGroup(entry) {
|
|
7389
|
+
const aliasSummary = formatAliasSummary(entry.aliases);
|
|
7390
|
+
return formatResolutionLogDetails(entry.target, [
|
|
7391
|
+
entry.guildName ? `guild:${entry.guildName}` : void 0,
|
|
7392
|
+
entry.channelName ? `channel:${entry.channelName}` : void 0,
|
|
7393
|
+
entry.note,
|
|
7394
|
+
aliasSummary ? `aliases:${aliasSummary}` : void 0
|
|
7395
|
+
]);
|
|
7127
7396
|
}
|
|
7128
|
-
function
|
|
7129
|
-
return
|
|
7397
|
+
function formatDiscordChannelUnresolved(entry) {
|
|
7398
|
+
return formatResolutionLogDetails(entry.input, [
|
|
7399
|
+
entry.guildName ? `guild:${entry.guildName}` : entry.guildId ? `guildId:${entry.guildId}` : void 0,
|
|
7400
|
+
entry.channelName ? `channel:${entry.channelName}` : entry.channelId ? `channelId:${entry.channelId}` : void 0,
|
|
7401
|
+
entry.note
|
|
7402
|
+
]);
|
|
7130
7403
|
}
|
|
7131
|
-
function
|
|
7132
|
-
|
|
7133
|
-
const
|
|
7134
|
-
const
|
|
7135
|
-
|
|
7404
|
+
function formatDiscordUserResolved(entry) {
|
|
7405
|
+
const displayName = entry.name?.trim();
|
|
7406
|
+
const target = displayName || entry.id;
|
|
7407
|
+
const formatted = formatResolutionLogDetails(formatResolvedBase(entry.input, target), [
|
|
7408
|
+
displayName && entry.id && entry.id !== entry.input ? `id:${entry.id}` : void 0,
|
|
7409
|
+
entry.guildName ? `guild:${entry.guildName}` : void 0,
|
|
7410
|
+
entry.note
|
|
7411
|
+
]);
|
|
7412
|
+
return formatted === entry.input ? null : formatted;
|
|
7136
7413
|
}
|
|
7137
|
-
function
|
|
7138
|
-
|
|
7139
|
-
|
|
7140
|
-
|
|
7141
|
-
|
|
7142
|
-
|
|
7143
|
-
return "request";
|
|
7414
|
+
function formatDiscordUserUnresolved(entry) {
|
|
7415
|
+
return formatResolutionLogDetails(entry.input, [
|
|
7416
|
+
entry.name ? `name:${entry.name}` : void 0,
|
|
7417
|
+
entry.guildName ? `guild:${entry.guildName}` : void 0,
|
|
7418
|
+
entry.note
|
|
7419
|
+
]);
|
|
7144
7420
|
}
|
|
7145
|
-
function
|
|
7146
|
-
if (!
|
|
7147
|
-
const
|
|
7148
|
-
const
|
|
7149
|
-
|
|
7150
|
-
|
|
7151
|
-
|
|
7152
|
-
|
|
7153
|
-
if (timeoutMs !== void 0) timing.push(`timeout=${formatDurationSeconds(timeoutMs, { decimals: timeoutMs >= 1e3 ? 1 : 0 })}`);
|
|
7154
|
-
if (requestMs !== void 0) timing.push(`observed=${formatDurationSeconds(requestMs, { decimals: requestMs >= 1e3 ? 1 : 0 })}`);
|
|
7155
|
-
const timingText = timing.length > 0 ? ` (${timing.join(", ")})` : "";
|
|
7156
|
-
if (timeoutMs !== void 0 && requestMs !== void 0 && requestMs >= timeoutMs) return `Discord REST ${operation} timed out${timingText}`;
|
|
7157
|
-
return `Discord REST ${operation} was aborted${timingText}`;
|
|
7421
|
+
function toGuildEntries(value) {
|
|
7422
|
+
if (!value || typeof value !== "object") return {};
|
|
7423
|
+
const out = {};
|
|
7424
|
+
for (const [key, entry] of Object.entries(value)) {
|
|
7425
|
+
if (!entry || typeof entry !== "object") continue;
|
|
7426
|
+
out[key] = entry;
|
|
7427
|
+
}
|
|
7428
|
+
return out;
|
|
7158
7429
|
}
|
|
7159
|
-
function
|
|
7160
|
-
if (!
|
|
7161
|
-
|
|
7162
|
-
const status = readNonNegativeInteger(deployErr.status) ?? readNonNegativeInteger(deployErr.statusCode);
|
|
7163
|
-
const retryAfterSeconds = readFiniteNumber(deployErr.retryAfter) ?? readFiniteNumber(readDiscordDeployObjectField(deployErr.rawBody, "retry_after"));
|
|
7164
|
-
if (!(err instanceof RateLimitError || status === 429 || retryAfterSeconds !== void 0)) return;
|
|
7165
|
-
const rawGlobal = readDiscordDeployObjectField(deployErr.rawBody, "global");
|
|
7166
|
-
const scope = typeof deployErr.scope === "string" && deployErr.scope.trim().length > 0 ? deployErr.scope : rawGlobal === true ? "global" : rawGlobal === false ? "route" : void 0;
|
|
7167
|
-
const discordCode = typeof deployErr.discordCode === "number" || typeof deployErr.discordCode === "string" ? deployErr.discordCode : void 0;
|
|
7168
|
-
return {
|
|
7169
|
-
status,
|
|
7170
|
-
retryAfterMs: retryAfterSeconds === void 0 ? void 0 : Math.max(0, retryAfterSeconds * 1e3),
|
|
7171
|
-
scope,
|
|
7172
|
-
discordCode
|
|
7173
|
-
};
|
|
7430
|
+
function toAllowlistEntries(value) {
|
|
7431
|
+
if (!Array.isArray(value)) return;
|
|
7432
|
+
return normalizeStringEntries(value);
|
|
7174
7433
|
}
|
|
7175
|
-
function
|
|
7176
|
-
|
|
7177
|
-
if (!rateLimit) return "";
|
|
7178
|
-
const details = [];
|
|
7179
|
-
if (typeof rateLimit.status === "number") details.push(`status=${rateLimit.status}`);
|
|
7180
|
-
if (typeof rateLimit.retryAfterMs === "number") details.push(`retryAfter=${formatDurationSeconds(rateLimit.retryAfterMs, { decimals: 1 })}`);
|
|
7181
|
-
if (rateLimit.scope) details.push(`scope=${rateLimit.scope}`);
|
|
7182
|
-
if (typeof rateLimit.discordCode === "number" || typeof rateLimit.discordCode === "string") details.push(`code=${rateLimit.discordCode}`);
|
|
7183
|
-
return details.length > 0 ? ` (${details.join(", ")})` : "";
|
|
7434
|
+
function hasGuildEntries(value) {
|
|
7435
|
+
return Object.keys(value).length > 0;
|
|
7184
7436
|
}
|
|
7185
|
-
function
|
|
7186
|
-
const
|
|
7187
|
-
|
|
7188
|
-
|
|
7189
|
-
|
|
7190
|
-
|
|
7191
|
-
|
|
7192
|
-
|
|
7437
|
+
function collectChannelResolutionInputs(guildEntries) {
|
|
7438
|
+
const entries = [];
|
|
7439
|
+
for (const [guildKey, guildCfg] of Object.entries(guildEntries)) {
|
|
7440
|
+
if (guildKey === "*") continue;
|
|
7441
|
+
const channels = guildCfg?.channels ?? {};
|
|
7442
|
+
const channelKeys = Object.keys(channels).filter((key) => key !== "*");
|
|
7443
|
+
if (channelKeys.length === 0) {
|
|
7444
|
+
const input = /^\d+$/.test(guildKey) ? `guild:${guildKey}` : guildKey;
|
|
7445
|
+
entries.push({
|
|
7446
|
+
input,
|
|
7447
|
+
guildKey
|
|
7448
|
+
});
|
|
7449
|
+
continue;
|
|
7450
|
+
}
|
|
7451
|
+
for (const channelKey of channelKeys) entries.push({
|
|
7452
|
+
input: `${guildKey}/${channelKey}`,
|
|
7453
|
+
guildKey,
|
|
7454
|
+
channelKey
|
|
7455
|
+
});
|
|
7456
|
+
}
|
|
7457
|
+
return entries;
|
|
7193
7458
|
}
|
|
7194
|
-
function
|
|
7195
|
-
const
|
|
7196
|
-
|
|
7197
|
-
|
|
7198
|
-
|
|
7199
|
-
|
|
7200
|
-
|
|
7201
|
-
|
|
7202
|
-
|
|
7203
|
-
const
|
|
7204
|
-
const
|
|
7205
|
-
|
|
7206
|
-
|
|
7207
|
-
|
|
7208
|
-
|
|
7209
|
-
|
|
7459
|
+
async function resolveGuildEntriesByChannelAllowlist(params) {
|
|
7460
|
+
const entries = collectChannelResolutionInputs(params.guildEntries);
|
|
7461
|
+
if (entries.length === 0) return params.guildEntries;
|
|
7462
|
+
try {
|
|
7463
|
+
const resolved = await resolveDiscordChannelAllowlist({
|
|
7464
|
+
token: params.token,
|
|
7465
|
+
entries: entries.map((entry) => entry.input),
|
|
7466
|
+
fetcher: params.fetcher
|
|
7467
|
+
});
|
|
7468
|
+
const sourceByInput = new Map(entries.map((entry) => [entry.input, entry]));
|
|
7469
|
+
const nextGuilds = { ...params.guildEntries };
|
|
7470
|
+
const mappingByTarget = /* @__PURE__ */ new Map();
|
|
7471
|
+
const unresolved = [];
|
|
7472
|
+
for (const entry of resolved) {
|
|
7473
|
+
const source = sourceByInput.get(entry.input);
|
|
7474
|
+
if (!source) continue;
|
|
7475
|
+
const sourceGuild = params.guildEntries[source.guildKey] ?? {};
|
|
7476
|
+
if (!entry.resolved || !entry.guildId) {
|
|
7477
|
+
unresolved.push(formatDiscordChannelUnresolved(entry));
|
|
7478
|
+
continue;
|
|
7479
|
+
}
|
|
7480
|
+
const target = entry.channelId ? `${entry.guildId}/${entry.channelId}` : entry.guildId;
|
|
7481
|
+
const existingGroup = mappingByTarget.get(target) ?? {
|
|
7482
|
+
target,
|
|
7483
|
+
aliases: [],
|
|
7484
|
+
guildName: entry.guildName,
|
|
7485
|
+
channelName: entry.channelName,
|
|
7486
|
+
note: entry.note
|
|
7487
|
+
};
|
|
7488
|
+
if (entry.input !== target && !existingGroup.aliases.includes(entry.input)) existingGroup.aliases.push(entry.input);
|
|
7489
|
+
if (!existingGroup.guildName && entry.guildName) existingGroup.guildName = entry.guildName;
|
|
7490
|
+
if (!existingGroup.channelName && entry.channelName) existingGroup.channelName = entry.channelName;
|
|
7491
|
+
if (!existingGroup.note && entry.note) existingGroup.note = entry.note;
|
|
7492
|
+
mappingByTarget.set(target, existingGroup);
|
|
7493
|
+
const existing = nextGuilds[entry.guildId] ?? {};
|
|
7494
|
+
const mergedChannels = {
|
|
7495
|
+
...sourceGuild.channels,
|
|
7496
|
+
...existing.channels
|
|
7497
|
+
};
|
|
7498
|
+
const mergedGuild = {
|
|
7499
|
+
...sourceGuild,
|
|
7500
|
+
...existing,
|
|
7501
|
+
channels: mergedChannels
|
|
7502
|
+
};
|
|
7503
|
+
nextGuilds[entry.guildId] = mergedGuild;
|
|
7504
|
+
if (source.channelKey && entry.channelId) {
|
|
7505
|
+
const sourceChannel = sourceGuild.channels?.[source.channelKey];
|
|
7506
|
+
if (sourceChannel) nextGuilds[entry.guildId] = {
|
|
7507
|
+
...mergedGuild,
|
|
7508
|
+
channels: {
|
|
7509
|
+
...mergedChannels,
|
|
7510
|
+
[entry.channelId]: {
|
|
7511
|
+
...sourceChannel,
|
|
7512
|
+
...mergedChannels[entry.channelId]
|
|
7513
|
+
}
|
|
7514
|
+
}
|
|
7515
|
+
};
|
|
7516
|
+
}
|
|
7517
|
+
}
|
|
7518
|
+
summarizeMapping("discord channels", [...mappingByTarget.values()].map((group) => formatDiscordChannelResolvedGroup(group)), unresolved, params.runtime);
|
|
7519
|
+
return nextGuilds;
|
|
7520
|
+
} catch (err) {
|
|
7521
|
+
params.runtime.log?.(`discord channel resolve failed; using config entries. ${formatErrorMessage$1(err)}`);
|
|
7522
|
+
return params.guildEntries;
|
|
7523
|
+
}
|
|
7210
7524
|
}
|
|
7211
|
-
function
|
|
7212
|
-
|
|
7213
|
-
|
|
7214
|
-
|
|
7525
|
+
async function resolveAllowFromByUserAllowlist(params) {
|
|
7526
|
+
const allowEntries = normalizeStringEntries(params.allowFrom).filter((entry) => entry !== "*");
|
|
7527
|
+
if (allowEntries.length === 0) return params.allowFrom;
|
|
7528
|
+
try {
|
|
7529
|
+
const { resolvedMap, mapping, unresolved } = buildAllowlistResolutionSummary(await resolveDiscordUserAllowlist({
|
|
7530
|
+
token: params.token,
|
|
7531
|
+
entries: allowEntries,
|
|
7532
|
+
fetcher: params.fetcher
|
|
7533
|
+
}), {
|
|
7534
|
+
formatResolved: formatDiscordUserResolved,
|
|
7535
|
+
formatUnresolved: formatDiscordUserUnresolved
|
|
7536
|
+
});
|
|
7537
|
+
const allowFrom = canonicalizeAllowlistWithResolvedIds({
|
|
7538
|
+
existing: params.allowFrom,
|
|
7539
|
+
resolvedMap
|
|
7540
|
+
});
|
|
7541
|
+
summarizeMapping("discord users", mapping, unresolved, params.runtime);
|
|
7542
|
+
return allowFrom;
|
|
7543
|
+
} catch (err) {
|
|
7544
|
+
params.runtime.log?.(`discord user resolve failed; using config entries. ${formatErrorMessage$1(err)}`);
|
|
7545
|
+
return params.allowFrom;
|
|
7546
|
+
}
|
|
7215
7547
|
}
|
|
7216
|
-
function
|
|
7217
|
-
|
|
7218
|
-
const
|
|
7219
|
-
|
|
7220
|
-
|
|
7221
|
-
|
|
7222
|
-
|
|
7223
|
-
|
|
7224
|
-
|
|
7225
|
-
|
|
7226
|
-
|
|
7227
|
-
|
|
7228
|
-
|
|
7229
|
-
|
|
7230
|
-
|
|
7231
|
-
|
|
7232
|
-
|
|
7233
|
-
|
|
7234
|
-
|
|
7548
|
+
function collectGuildUserEntries(guildEntries) {
|
|
7549
|
+
const userEntries = /* @__PURE__ */ new Set();
|
|
7550
|
+
for (const guild of Object.values(guildEntries)) {
|
|
7551
|
+
if (!guild || typeof guild !== "object") continue;
|
|
7552
|
+
addAllowlistUserEntriesFromConfigEntry(userEntries, guild);
|
|
7553
|
+
const channels = guild.channels ?? {};
|
|
7554
|
+
for (const channel of Object.values(channels)) addAllowlistUserEntriesFromConfigEntry(userEntries, channel);
|
|
7555
|
+
}
|
|
7556
|
+
return userEntries;
|
|
7557
|
+
}
|
|
7558
|
+
async function resolveGuildEntriesByUserAllowlist(params) {
|
|
7559
|
+
const userEntries = collectGuildUserEntries(params.guildEntries);
|
|
7560
|
+
if (userEntries.size === 0) return params.guildEntries;
|
|
7561
|
+
try {
|
|
7562
|
+
const { resolvedMap, mapping, unresolved } = buildAllowlistResolutionSummary(await resolveDiscordUserAllowlist({
|
|
7563
|
+
token: params.token,
|
|
7564
|
+
entries: Array.from(userEntries),
|
|
7565
|
+
fetcher: params.fetcher
|
|
7566
|
+
}), {
|
|
7567
|
+
formatResolved: formatDiscordUserResolved,
|
|
7568
|
+
formatUnresolved: formatDiscordUserUnresolved
|
|
7569
|
+
});
|
|
7570
|
+
const nextGuilds = { ...params.guildEntries };
|
|
7571
|
+
for (const [guildKey, guildConfig] of Object.entries(params.guildEntries)) {
|
|
7572
|
+
if (!guildConfig || typeof guildConfig !== "object") continue;
|
|
7573
|
+
const nextGuild = { ...guildConfig };
|
|
7574
|
+
const users = guildConfig.users;
|
|
7575
|
+
if (Array.isArray(users) && users.length > 0) nextGuild.users = canonicalizeAllowlistWithResolvedIds({
|
|
7576
|
+
existing: users,
|
|
7577
|
+
resolvedMap
|
|
7235
7578
|
});
|
|
7579
|
+
const channels = guildConfig.channels ?? {};
|
|
7580
|
+
if (channels && typeof channels === "object") nextGuild.channels = patchAllowlistUsersInConfigEntries({
|
|
7581
|
+
entries: channels,
|
|
7582
|
+
resolvedMap,
|
|
7583
|
+
strategy: "canonicalize"
|
|
7584
|
+
});
|
|
7585
|
+
nextGuilds[guildKey] = nextGuild;
|
|
7236
7586
|
}
|
|
7237
|
-
|
|
7238
|
-
|
|
7239
|
-
|
|
7240
|
-
|
|
7241
|
-
|
|
7587
|
+
summarizeMapping("discord channel users", mapping, unresolved, params.runtime);
|
|
7588
|
+
return nextGuilds;
|
|
7589
|
+
} catch (err) {
|
|
7590
|
+
params.runtime.log?.(`discord channel user resolve failed; using config entries. ${formatErrorMessage$1(err)}`);
|
|
7591
|
+
return params.guildEntries;
|
|
7242
7592
|
}
|
|
7243
|
-
const rejectedEntries = formatDiscordRejectedDeployEntries({
|
|
7244
|
-
rawBody,
|
|
7245
|
-
requestBody
|
|
7246
|
-
});
|
|
7247
|
-
if (rejectedEntries.length > 0) details.push(`rejected=${rejectedEntries.join("; ")}`);
|
|
7248
|
-
return details.length > 0 ? ` (${details.join(", ")})` : "";
|
|
7249
7593
|
}
|
|
7250
|
-
function
|
|
7251
|
-
|
|
7252
|
-
|
|
7253
|
-
|
|
7254
|
-
|
|
7255
|
-
|
|
7594
|
+
async function resolveDiscordAllowlistConfig(params) {
|
|
7595
|
+
let guildEntries = toGuildEntries(params.guildEntries);
|
|
7596
|
+
let allowFrom = toAllowlistEntries(params.allowFrom);
|
|
7597
|
+
if (hasGuildEntries(guildEntries)) guildEntries = await resolveGuildEntriesByChannelAllowlist({
|
|
7598
|
+
token: params.token,
|
|
7599
|
+
guildEntries,
|
|
7600
|
+
fetcher: params.fetcher,
|
|
7601
|
+
runtime: params.runtime
|
|
7602
|
+
});
|
|
7603
|
+
if (isDangerousNameMatchingEnabled(params.discordConfig)) {
|
|
7604
|
+
allowFrom = await resolveAllowFromByUserAllowlist({
|
|
7605
|
+
token: params.token,
|
|
7606
|
+
allowFrom,
|
|
7607
|
+
fetcher: params.fetcher,
|
|
7608
|
+
runtime: params.runtime
|
|
7609
|
+
});
|
|
7610
|
+
if (hasGuildEntries(guildEntries)) guildEntries = await resolveGuildEntriesByUserAllowlist({
|
|
7611
|
+
token: params.token,
|
|
7612
|
+
guildEntries,
|
|
7613
|
+
fetcher: params.fetcher,
|
|
7614
|
+
runtime: params.runtime
|
|
7615
|
+
});
|
|
7616
|
+
}
|
|
7617
|
+
return {
|
|
7618
|
+
guildEntries: hasGuildEntries(guildEntries) ? guildEntries : void 0,
|
|
7619
|
+
allowFrom
|
|
7620
|
+
};
|
|
7256
7621
|
}
|
|
7257
7622
|
//#endregion
|
|
7258
|
-
//#region extensions/discord/src/monitor/provider.
|
|
7259
|
-
function
|
|
7260
|
-
|
|
7261
|
-
|
|
7262
|
-
|
|
7263
|
-
|
|
7264
|
-
|
|
7265
|
-
|
|
7266
|
-
|
|
7267
|
-
|
|
7268
|
-
|
|
7623
|
+
//#region extensions/discord/src/monitor/provider.cleanup.ts
|
|
7624
|
+
async function cleanupDiscordProviderStartup(params) {
|
|
7625
|
+
await params.deactivateMessageHandler?.();
|
|
7626
|
+
params.autoPresenceController?.stop();
|
|
7627
|
+
params.setStatus?.({ connected: false });
|
|
7628
|
+
if (params.onEarlyGatewayDebug) params.earlyGatewayEmitter?.removeListener("debug", params.onEarlyGatewayDebug);
|
|
7629
|
+
if (!params.lifecycleStarted) try {
|
|
7630
|
+
params.lifecycleGateway?.disconnect();
|
|
7631
|
+
} catch (err) {
|
|
7632
|
+
params.runtime.error?.(danger(`discord: failed to disconnect gateway during startup cleanup: ${String(err)}`));
|
|
7633
|
+
}
|
|
7634
|
+
params.gatewaySupervisor?.dispose();
|
|
7635
|
+
if (!params.lifecycleStarted) params.threadBindings.stop();
|
|
7269
7636
|
}
|
|
7270
7637
|
//#endregion
|
|
7271
|
-
//#region extensions/discord/src/monitor/provider.
|
|
7272
|
-
|
|
7273
|
-
|
|
7638
|
+
//#region extensions/discord/src/monitor/provider.commands.ts
|
|
7639
|
+
const loadPluginCommandSpecs = createLazyRuntimeNamedExport(() => import("openclaw/plugin-sdk/plugin-runtime"), "getPluginCommandSpecs");
|
|
7640
|
+
async function appendPluginCommandSpecs(params) {
|
|
7641
|
+
const merged = [...params.commandSpecs];
|
|
7642
|
+
const existingNames = new Set(normalizeStringEntriesLower(merged.map((spec) => spec.name)));
|
|
7643
|
+
const getPluginCommandSpecs = params.getPluginCommandSpecs ?? await loadPluginCommandSpecs();
|
|
7644
|
+
for (const pluginCommand of getPluginCommandSpecs("discord", { config: params.cfg })) {
|
|
7645
|
+
const normalizedName = normalizeLowercaseStringOrEmpty(pluginCommand.name);
|
|
7646
|
+
if (!normalizedName) continue;
|
|
7647
|
+
if (existingNames.has(normalizedName)) {
|
|
7648
|
+
params.runtime.error?.(danger(`discord: plugin command "/${normalizedName}" duplicates an existing native command. Skipping.`));
|
|
7649
|
+
continue;
|
|
7650
|
+
}
|
|
7651
|
+
existingNames.add(normalizedName);
|
|
7652
|
+
merged.push({
|
|
7653
|
+
name: pluginCommand.name,
|
|
7654
|
+
description: pluginCommand.description,
|
|
7655
|
+
acceptsArgs: pluginCommand.acceptsArgs
|
|
7656
|
+
});
|
|
7657
|
+
}
|
|
7658
|
+
return merged;
|
|
7274
7659
|
}
|
|
7275
|
-
function
|
|
7276
|
-
|
|
7660
|
+
async function resolveDiscordProviderCommandSpecs(params) {
|
|
7661
|
+
const listSkillCommands = params.listSkillCommandsForAgents ?? listSkillCommandsForAgents;
|
|
7662
|
+
const listNativeCommandSpecs = params.listNativeCommandSpecsForConfig ?? listNativeCommandSpecsForConfig;
|
|
7663
|
+
const maxDiscordCommands = params.maxDiscordCommands ?? 100;
|
|
7664
|
+
let skillCommands = params.nativeEnabled && params.nativeSkillsEnabled ? listSkillCommands({ cfg: params.cfg }) : [];
|
|
7665
|
+
let commandSpecs = params.nativeEnabled ? listNativeCommandSpecs(params.cfg, {
|
|
7666
|
+
skillCommands,
|
|
7667
|
+
provider: "discord"
|
|
7668
|
+
}) : [];
|
|
7669
|
+
if (params.nativeEnabled) commandSpecs = await appendPluginCommandSpecs({
|
|
7670
|
+
commandSpecs,
|
|
7671
|
+
runtime: params.runtime,
|
|
7672
|
+
cfg: params.cfg,
|
|
7673
|
+
getPluginCommandSpecs: params.getPluginCommandSpecs
|
|
7674
|
+
});
|
|
7675
|
+
const initialCommandCount = commandSpecs.length;
|
|
7676
|
+
if (params.nativeEnabled && params.nativeSkillsEnabled && commandSpecs.length > maxDiscordCommands) {
|
|
7677
|
+
skillCommands = [];
|
|
7678
|
+
commandSpecs = listNativeCommandSpecs(params.cfg, {
|
|
7679
|
+
skillCommands: [],
|
|
7680
|
+
provider: "discord"
|
|
7681
|
+
});
|
|
7682
|
+
commandSpecs = await appendPluginCommandSpecs({
|
|
7683
|
+
commandSpecs,
|
|
7684
|
+
runtime: params.runtime,
|
|
7685
|
+
cfg: params.cfg,
|
|
7686
|
+
getPluginCommandSpecs: params.getPluginCommandSpecs
|
|
7687
|
+
});
|
|
7688
|
+
params.runtime.log?.(warn(`${initialCommandCount} commands exceed the ${maxDiscordCommands}-command Discord limit; removing per-skill commands and keeping /skill.`));
|
|
7689
|
+
}
|
|
7690
|
+
if (params.nativeEnabled && commandSpecs.length > maxDiscordCommands) params.runtime.log?.(warn(`${commandSpecs.length} commands exceed the ${maxDiscordCommands}-command Discord limit; some commands may fail to deploy.`));
|
|
7691
|
+
return {
|
|
7692
|
+
skillCommands,
|
|
7693
|
+
commandSpecs
|
|
7694
|
+
};
|
|
7695
|
+
}
|
|
7696
|
+
//#endregion
|
|
7697
|
+
//#region extensions/discord/src/monitor/provider.config-log.ts
|
|
7698
|
+
function formatThreadBindingDurationForConfigLabel(durationMs) {
|
|
7699
|
+
const label = formatThreadBindingDurationLabel(durationMs);
|
|
7700
|
+
return label === "disabled" ? "off" : label;
|
|
7701
|
+
}
|
|
7702
|
+
function logDiscordResolvedConfig(params) {
|
|
7703
|
+
const allowFromSummary = summarizeStringEntries({
|
|
7704
|
+
entries: params.allowFrom ?? [],
|
|
7705
|
+
limit: 4,
|
|
7706
|
+
emptyText: "any"
|
|
7707
|
+
});
|
|
7708
|
+
const groupDmChannelSummary = summarizeStringEntries({
|
|
7709
|
+
entries: params.groupDmChannels ?? [],
|
|
7710
|
+
limit: 4,
|
|
7711
|
+
emptyText: "any"
|
|
7712
|
+
});
|
|
7713
|
+
const guildSummary = summarizeStringEntries({
|
|
7714
|
+
entries: Object.keys(params.guildEntries ?? {}),
|
|
7715
|
+
limit: 4,
|
|
7716
|
+
emptyText: "any"
|
|
7717
|
+
});
|
|
7718
|
+
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 / (1024 * 1024))} 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)}`);
|
|
7719
|
+
}
|
|
7720
|
+
//#endregion
|
|
7721
|
+
//#region extensions/discord/src/monitor/provider.deploy-errors.ts
|
|
7722
|
+
const DISCORD_DEPLOY_REJECTED_ENTRY_LIMIT = 3;
|
|
7723
|
+
function attachDiscordDeployRequestBody(err, body) {
|
|
7724
|
+
if (!err || typeof err !== "object" || body === void 0) return;
|
|
7725
|
+
const deployErr = err;
|
|
7726
|
+
if (deployErr.deployRequestBody === void 0) deployErr.deployRequestBody = body;
|
|
7727
|
+
}
|
|
7728
|
+
function attachDiscordDeployRestContext(err, context) {
|
|
7729
|
+
if (!err || typeof err !== "object") return;
|
|
7730
|
+
const deployErr = err;
|
|
7731
|
+
deployErr.deployRestMethod = context.method;
|
|
7732
|
+
deployErr.deployRestPath = context.path;
|
|
7733
|
+
deployErr.deployRequestMs = context.requestMs;
|
|
7734
|
+
if (typeof context.timeoutMs === "number" && Number.isFinite(context.timeoutMs)) deployErr.deployTimeoutMs = context.timeoutMs;
|
|
7735
|
+
}
|
|
7736
|
+
function stringifyDiscordDeployField(value) {
|
|
7737
|
+
if (typeof value === "string") return JSON.stringify(value);
|
|
7738
|
+
try {
|
|
7739
|
+
return JSON.stringify(value);
|
|
7740
|
+
} catch {
|
|
7741
|
+
return inspect(value, {
|
|
7742
|
+
depth: 2,
|
|
7743
|
+
breakLength: 120
|
|
7744
|
+
});
|
|
7745
|
+
}
|
|
7746
|
+
}
|
|
7747
|
+
function readDiscordDeployRejectedFields(value) {
|
|
7748
|
+
if (Array.isArray(value)) return value.filter((entry) => typeof entry === "string").slice(0, 6);
|
|
7749
|
+
if (!value || typeof value !== "object") return [];
|
|
7750
|
+
return Object.keys(value).slice(0, 6);
|
|
7751
|
+
}
|
|
7752
|
+
function resolveDiscordRejectedDeployEntriesSource(rawBody) {
|
|
7753
|
+
if (!rawBody || typeof rawBody !== "object") return null;
|
|
7754
|
+
const payload = rawBody;
|
|
7755
|
+
const source = (payload.errors && typeof payload.errors === "object" ? payload.errors : void 0) ?? rawBody;
|
|
7756
|
+
return source && typeof source === "object" ? source : null;
|
|
7757
|
+
}
|
|
7758
|
+
function readDiscordDeployObjectField(value, field) {
|
|
7759
|
+
return value && typeof value === "object" && field in value ? value[field] : void 0;
|
|
7760
|
+
}
|
|
7761
|
+
function readFiniteNumber(value) {
|
|
7762
|
+
if (typeof value === "number" && Number.isFinite(value)) return value;
|
|
7763
|
+
if (typeof value === "string" && value.trim().length > 0) return parseStrictFiniteNumber(value);
|
|
7764
|
+
}
|
|
7765
|
+
function readNonNegativeInteger(value) {
|
|
7766
|
+
return parseStrictNonNegativeInteger(value);
|
|
7767
|
+
}
|
|
7768
|
+
function isAbortLikeError(err) {
|
|
7769
|
+
if (!err || typeof err !== "object") return false;
|
|
7770
|
+
const name = "name" in err && typeof err.name === "string" ? err.name : void 0;
|
|
7771
|
+
const message = formatErrorMessage$1(err);
|
|
7772
|
+
return name === "AbortError" || message === "This operation was aborted" || message === "The operation was aborted" || /\boperation was aborted\b/i.test(message);
|
|
7773
|
+
}
|
|
7774
|
+
function formatDiscordDeployRestOperation(err) {
|
|
7775
|
+
const method = typeof err.deployRestMethod === "string" && err.deployRestMethod.trim().length > 0 ? err.deployRestMethod.toUpperCase() : void 0;
|
|
7776
|
+
const path = typeof err.deployRestPath === "string" && err.deployRestPath.trim().length > 0 ? err.deployRestPath : void 0;
|
|
7777
|
+
if (method && path) return `${method} ${path}`;
|
|
7778
|
+
if (method) return method;
|
|
7779
|
+
if (path) return path;
|
|
7780
|
+
return "request";
|
|
7781
|
+
}
|
|
7782
|
+
function formatDiscordDeployErrorMessage(err) {
|
|
7783
|
+
if (!isAbortLikeError(err)) return formatErrorMessage$1(err);
|
|
7784
|
+
const deployErr = err && typeof err === "object" ? err : {};
|
|
7785
|
+
const requestMs = readFiniteNumber(deployErr.deployRequestMs);
|
|
7786
|
+
const timeoutMs = readFiniteNumber(deployErr.deployTimeoutMs);
|
|
7787
|
+
const operation = formatDiscordDeployRestOperation(deployErr);
|
|
7788
|
+
if (!(requestMs !== void 0 || timeoutMs !== void 0 || deployErr.deployRestMethod !== void 0 || deployErr.deployRestPath !== void 0)) return "Discord REST request was aborted";
|
|
7789
|
+
const timing = [];
|
|
7790
|
+
if (timeoutMs !== void 0) timing.push(`timeout=${formatDurationSeconds(timeoutMs, { decimals: timeoutMs >= 1e3 ? 1 : 0 })}`);
|
|
7791
|
+
if (requestMs !== void 0) timing.push(`observed=${formatDurationSeconds(requestMs, { decimals: requestMs >= 1e3 ? 1 : 0 })}`);
|
|
7792
|
+
const timingText = timing.length > 0 ? ` (${timing.join(", ")})` : "";
|
|
7793
|
+
if (timeoutMs !== void 0 && requestMs !== void 0 && requestMs >= timeoutMs) return `Discord REST ${operation} timed out${timingText}`;
|
|
7794
|
+
return `Discord REST ${operation} was aborted${timingText}`;
|
|
7795
|
+
}
|
|
7796
|
+
function resolveDiscordDeployRateLimitDetails(err) {
|
|
7797
|
+
if (!err || typeof err !== "object") return;
|
|
7798
|
+
const deployErr = err;
|
|
7799
|
+
const status = readNonNegativeInteger(deployErr.status) ?? readNonNegativeInteger(deployErr.statusCode);
|
|
7800
|
+
const retryAfterSeconds = readFiniteNumber(deployErr.retryAfter) ?? readFiniteNumber(readDiscordDeployObjectField(deployErr.rawBody, "retry_after"));
|
|
7801
|
+
if (!(err instanceof RateLimitError || status === 429 || retryAfterSeconds !== void 0)) return;
|
|
7802
|
+
const rawGlobal = readDiscordDeployObjectField(deployErr.rawBody, "global");
|
|
7803
|
+
const scope = typeof deployErr.scope === "string" && deployErr.scope.trim().length > 0 ? deployErr.scope : rawGlobal === true ? "global" : rawGlobal === false ? "route" : void 0;
|
|
7804
|
+
const discordCode = typeof deployErr.discordCode === "number" || typeof deployErr.discordCode === "string" ? deployErr.discordCode : void 0;
|
|
7805
|
+
return {
|
|
7806
|
+
status,
|
|
7807
|
+
retryAfterMs: retryAfterSeconds === void 0 ? void 0 : Math.max(0, retryAfterSeconds * 1e3),
|
|
7808
|
+
scope,
|
|
7809
|
+
discordCode
|
|
7810
|
+
};
|
|
7811
|
+
}
|
|
7812
|
+
function formatDiscordDeployRateLimitDetails(err) {
|
|
7813
|
+
const rateLimit = resolveDiscordDeployRateLimitDetails(err);
|
|
7814
|
+
if (!rateLimit) return "";
|
|
7815
|
+
const details = [];
|
|
7816
|
+
if (typeof rateLimit.status === "number") details.push(`status=${rateLimit.status}`);
|
|
7817
|
+
if (typeof rateLimit.retryAfterMs === "number") details.push(`retryAfter=${formatDurationSeconds(rateLimit.retryAfterMs, { decimals: 1 })}`);
|
|
7818
|
+
if (rateLimit.scope) details.push(`scope=${rateLimit.scope}`);
|
|
7819
|
+
if (typeof rateLimit.discordCode === "number" || typeof rateLimit.discordCode === "string") details.push(`code=${rateLimit.discordCode}`);
|
|
7820
|
+
return details.length > 0 ? ` (${details.join(", ")})` : "";
|
|
7821
|
+
}
|
|
7822
|
+
function formatDiscordDeployRateLimitWarning(err, accountId) {
|
|
7823
|
+
const rateLimit = resolveDiscordDeployRateLimitDetails(err);
|
|
7824
|
+
if (!rateLimit) return;
|
|
7825
|
+
const parts = [`[${accountId}] slash command deploy rate limited`];
|
|
7826
|
+
if (typeof rateLimit.retryAfterMs === "number") parts.push(`retry after ${formatDurationSeconds(rateLimit.retryAfterMs, { decimals: 1 })}`);
|
|
7827
|
+
if (rateLimit.scope) parts.push(`scope=${rateLimit.scope}`);
|
|
7828
|
+
if (typeof rateLimit.discordCode === "number" || typeof rateLimit.discordCode === "string") parts.push(`code=${rateLimit.discordCode}`);
|
|
7829
|
+
return `${parts.join("; ")}. Existing slash commands stay active. Message send/receive is unaffected.`;
|
|
7830
|
+
}
|
|
7831
|
+
function formatDiscordRejectedDeployEntries(params) {
|
|
7832
|
+
const requestBody = Array.isArray(params.requestBody) ? params.requestBody : null;
|
|
7833
|
+
const rejectedEntriesSource = resolveDiscordRejectedDeployEntriesSource(params.rawBody);
|
|
7834
|
+
if (!rejectedEntriesSource || !requestBody || requestBody.length === 0) return [];
|
|
7835
|
+
return Object.entries(rejectedEntriesSource).filter(([key]) => /^\d+$/.test(key)).slice(0, DISCORD_DEPLOY_REJECTED_ENTRY_LIMIT).flatMap(([key, value]) => {
|
|
7836
|
+
const index = Number.parseInt(key, 10);
|
|
7837
|
+
if (!Number.isFinite(index) || index < 0 || index >= requestBody.length) return [];
|
|
7838
|
+
const command = requestBody[index];
|
|
7839
|
+
if (!command || typeof command !== "object") return [`#${index} fields=${readDiscordDeployRejectedFields(value).join("|") || "unknown"}`];
|
|
7840
|
+
const payload = command;
|
|
7841
|
+
const parts = [`#${index}`, `fields=${readDiscordDeployRejectedFields(value).join("|") || "unknown"}`];
|
|
7842
|
+
if (typeof payload.name === "string" && payload.name.trim().length > 0) parts.push(`name=${payload.name}`);
|
|
7843
|
+
if (payload.description !== void 0) parts.push(`description=${stringifyDiscordDeployField(payload.description)}`);
|
|
7844
|
+
if (Array.isArray(payload.options) && payload.options.length > 0) parts.push(`options=${payload.options.length}`);
|
|
7845
|
+
return [parts.join(" ")];
|
|
7846
|
+
});
|
|
7847
|
+
}
|
|
7848
|
+
function isRedundantDiscordDeployBody(rawBody) {
|
|
7849
|
+
if (!rawBody || typeof rawBody !== "object" || Array.isArray(rawBody)) return false;
|
|
7850
|
+
const keys = Object.keys(rawBody);
|
|
7851
|
+
return keys.length > 0 && keys.every((key) => key === "message" || key === "code");
|
|
7852
|
+
}
|
|
7853
|
+
function formatDiscordDeployErrorDetails(err) {
|
|
7854
|
+
if (!err || typeof err !== "object") return "";
|
|
7855
|
+
const rateLimitDetails = formatDiscordDeployRateLimitDetails(err);
|
|
7856
|
+
if (rateLimitDetails) return rateLimitDetails;
|
|
7857
|
+
const status = err.status;
|
|
7858
|
+
const discordCode = err.discordCode;
|
|
7859
|
+
const rawBody = err.rawBody;
|
|
7860
|
+
const requestBody = err.deployRequestBody;
|
|
7861
|
+
const details = [];
|
|
7862
|
+
if (typeof status === "number") details.push(`status=${status}`);
|
|
7863
|
+
if (typeof discordCode === "number" || typeof discordCode === "string") details.push(`code=${discordCode}`);
|
|
7864
|
+
if (rawBody !== void 0 && !isRedundantDiscordDeployBody(rawBody)) {
|
|
7865
|
+
let bodyText;
|
|
7866
|
+
try {
|
|
7867
|
+
bodyText = JSON.stringify(rawBody);
|
|
7868
|
+
} catch {
|
|
7869
|
+
bodyText = typeof rawBody === "string" ? rawBody : inspect(rawBody, {
|
|
7870
|
+
depth: 3,
|
|
7871
|
+
breakLength: 120
|
|
7872
|
+
});
|
|
7873
|
+
}
|
|
7874
|
+
if (bodyText) {
|
|
7875
|
+
const maxLen = 800;
|
|
7876
|
+
const trimmed = bodyText.length > maxLen ? `${truncateUtf16Safe(bodyText, maxLen)}...` : bodyText;
|
|
7877
|
+
details.push(`body=${trimmed}`);
|
|
7878
|
+
}
|
|
7879
|
+
}
|
|
7880
|
+
const rejectedEntries = formatDiscordRejectedDeployEntries({
|
|
7881
|
+
rawBody,
|
|
7882
|
+
requestBody
|
|
7883
|
+
});
|
|
7884
|
+
if (rejectedEntries.length > 0) details.push(`rejected=${rejectedEntries.join("; ")}`);
|
|
7885
|
+
return details.length > 0 ? ` (${details.join(", ")})` : "";
|
|
7886
|
+
}
|
|
7887
|
+
function isDiscordDeployDailyCreateLimit(err) {
|
|
7888
|
+
if (!err || typeof err !== "object") return false;
|
|
7889
|
+
const deployErr = err;
|
|
7890
|
+
const discordCode = readNonNegativeInteger(deployErr.discordCode);
|
|
7891
|
+
const rawCode = readNonNegativeInteger(readDiscordDeployObjectField(deployErr.rawBody, "code"));
|
|
7892
|
+
return (discordCode === 30034 || rawCode === 30034) && /daily application command creates/i.test(formatErrorMessage$1(err));
|
|
7893
|
+
}
|
|
7894
|
+
//#endregion
|
|
7895
|
+
//#region extensions/discord/src/monitor/provider.startup-log.ts
|
|
7896
|
+
function formatDiscordStartupGatewayState(gateway) {
|
|
7897
|
+
if (!gateway) return "gateway=missing";
|
|
7898
|
+
const reconnectAttempts = gateway.reconnectAttempts;
|
|
7899
|
+
return `gatewayConnected=${gateway.isConnected ? "true" : "false"} reconnectAttempts=${typeof reconnectAttempts === "number" ? reconnectAttempts : "na"}`;
|
|
7900
|
+
}
|
|
7901
|
+
function logDiscordStartupPhase$1(params) {
|
|
7902
|
+
if (!(params.isVerbose ?? isVerbose)()) return;
|
|
7903
|
+
const elapsedMs = Math.max(0, Date.now() - params.startAt);
|
|
7904
|
+
const suffix = [params.details, formatDiscordStartupGatewayState(params.gateway)].filter((value) => Boolean(value)).join(" ");
|
|
7905
|
+
params.runtime.log?.(`discord startup [${params.accountId}] ${params.phase} ${elapsedMs}ms${suffix ? ` ${suffix}` : ""}`);
|
|
7906
|
+
}
|
|
7907
|
+
//#endregion
|
|
7908
|
+
//#region extensions/discord/src/monitor/provider.deploy.ts
|
|
7909
|
+
function readDeployRequestBody(data) {
|
|
7910
|
+
return data && typeof data === "object" && "body" in data ? data.body : void 0;
|
|
7911
|
+
}
|
|
7912
|
+
function isDeployCommandsPath(path) {
|
|
7913
|
+
return path.startsWith("/applications/") && path.includes("/commands");
|
|
7277
7914
|
}
|
|
7278
7915
|
function wrapDeployRestMethod(params) {
|
|
7279
7916
|
return async (path, data, query) => {
|
|
@@ -7391,8 +8028,75 @@ function runDiscordCommandDeployInBackground(params) {
|
|
|
7391
8028
|
});
|
|
7392
8029
|
}
|
|
7393
8030
|
//#endregion
|
|
7394
|
-
//#region extensions/discord/src/
|
|
7395
|
-
async function
|
|
8031
|
+
//#region extensions/discord/src/monitor/agent-components-reply.ts
|
|
8032
|
+
async function replySilently(interaction, params) {
|
|
8033
|
+
try {
|
|
8034
|
+
await interaction.reply(params);
|
|
8035
|
+
} catch {}
|
|
8036
|
+
}
|
|
8037
|
+
//#endregion
|
|
8038
|
+
//#region extensions/discord/src/activities/interaction.ts
|
|
8039
|
+
const REGISTRATION_WIDGET_ID = "AAAAAAAAAAAAAAAAAAAAAA";
|
|
8040
|
+
const PENDING_LAUNCH_WRITE_BUDGET_MS = 250;
|
|
8041
|
+
var DiscordActivityButton = class extends Button {
|
|
8042
|
+
constructor(ctx, deps) {
|
|
8043
|
+
super();
|
|
8044
|
+
this.ctx = ctx;
|
|
8045
|
+
this.deps = deps;
|
|
8046
|
+
this.label = "Open widget";
|
|
8047
|
+
this.customId = buildDiscordActivityCustomId(REGISTRATION_WIDGET_ID);
|
|
8048
|
+
this.customIdParser = parseDiscordActivityCustomIdForInteraction;
|
|
8049
|
+
this.pendingLaunchFailureLogged = false;
|
|
8050
|
+
}
|
|
8051
|
+
logPendingLaunchFailure(error) {
|
|
8052
|
+
if (this.pendingLaunchFailureLogged) return;
|
|
8053
|
+
this.pendingLaunchFailureLogged = true;
|
|
8054
|
+
this.deps.logError(`discord activity: failed to record pending launch: ${String(error)}`);
|
|
8055
|
+
}
|
|
8056
|
+
async run(interaction, data) {
|
|
8057
|
+
if (typeof data.widgetId !== "string") {
|
|
8058
|
+
await this.deps.reply(interaction, {
|
|
8059
|
+
content: "This widget is no longer valid.",
|
|
8060
|
+
ephemeral: true
|
|
8061
|
+
});
|
|
8062
|
+
return;
|
|
8063
|
+
}
|
|
8064
|
+
const runtime = getDiscordActivitiesRuntime();
|
|
8065
|
+
const channelId = interaction.rawData.channel_id;
|
|
8066
|
+
const discordUserId = interaction.userId;
|
|
8067
|
+
if (!runtime || !channelId || !discordUserId) this.logPendingLaunchFailure(/* @__PURE__ */ new Error("missing activity runtime or interaction identity"));
|
|
8068
|
+
else {
|
|
8069
|
+
const write = runtime.store.recordPendingLaunch({
|
|
8070
|
+
accountId: this.ctx.accountId,
|
|
8071
|
+
channelId,
|
|
8072
|
+
discordUserId,
|
|
8073
|
+
widgetId: data.widgetId,
|
|
8074
|
+
createdAt: Date.now()
|
|
8075
|
+
}).then(() => "written").catch((error) => {
|
|
8076
|
+
this.logPendingLaunchFailure(error);
|
|
8077
|
+
return "failed";
|
|
8078
|
+
});
|
|
8079
|
+
const timeout = new Promise((resolve) => {
|
|
8080
|
+
setTimeout(() => resolve("timeout"), PENDING_LAUNCH_WRITE_BUDGET_MS).unref?.();
|
|
8081
|
+
});
|
|
8082
|
+
if (await Promise.race([write, timeout]) === "timeout") this.logPendingLaunchFailure(/* @__PURE__ */ new Error(`pending launch write exceeded ${PENDING_LAUNCH_WRITE_BUDGET_MS}ms`));
|
|
8083
|
+
}
|
|
8084
|
+
await interaction.launchActivity();
|
|
8085
|
+
}
|
|
8086
|
+
};
|
|
8087
|
+
function createDiscordActivityButton(ctx, applicationId, deps = {}) {
|
|
8088
|
+
const runtime = getDiscordActivitiesRuntime();
|
|
8089
|
+
if (!runtime || !runtime.isAccountEnabled(ctx.accountId, ctx.cfg)) return null;
|
|
8090
|
+
if (applicationId) runtime.registerApplicationId(ctx.accountId, applicationId);
|
|
8091
|
+
if (!runtime.resolveAccount(ctx.accountId, ctx.cfg)) return null;
|
|
8092
|
+
return new DiscordActivityButton(ctx, {
|
|
8093
|
+
reply: deps.reply ?? replySilently,
|
|
8094
|
+
logError: deps.logError ?? logError
|
|
8095
|
+
});
|
|
8096
|
+
}
|
|
8097
|
+
//#endregion
|
|
8098
|
+
//#region extensions/discord/src/voice/access.ts
|
|
8099
|
+
async function authorizeDiscordVoiceIngress(params) {
|
|
7396
8100
|
const groupPolicy = params.groupPolicy ?? resolveOpenProviderRuntimeGroupPolicy({
|
|
7397
8101
|
providerConfigPresent: params.cfg.channels?.discord !== void 0,
|
|
7398
8102
|
groupPolicy: params.discordConfig.groupPolicy,
|
|
@@ -7442,17 +8146,18 @@ async function authorizeDiscordVoiceIngress(params) {
|
|
|
7442
8146
|
sender: params.sender,
|
|
7443
8147
|
allowNameMatching: false
|
|
7444
8148
|
});
|
|
7445
|
-
const
|
|
7446
|
-
|
|
7447
|
-
|
|
7448
|
-
|
|
7449
|
-
|
|
8149
|
+
const admissionAllowList = normalizeDiscordAllowList(params.admissionAllowFrom ?? params.discordConfig.allowFrom ?? params.discordConfig.dm?.allowFrom, [
|
|
8150
|
+
"discord:",
|
|
8151
|
+
"user:",
|
|
8152
|
+
"pk:"
|
|
8153
|
+
]);
|
|
8154
|
+
const admissionAllowed = admissionAllowList ? allowListMatches(admissionAllowList, params.sender, { allowNameMatching: false }) : false;
|
|
7450
8155
|
const useAccessGroups = params.useAccessGroups ?? params.cfg.commands?.useAccessGroups !== false;
|
|
7451
8156
|
return resolveCommandAuthorizedFromAuthorizers({
|
|
7452
8157
|
useAccessGroups,
|
|
7453
8158
|
authorizers: useAccessGroups ? [{
|
|
7454
|
-
configured:
|
|
7455
|
-
allowed:
|
|
8159
|
+
configured: admissionAllowList != null,
|
|
8160
|
+
allowed: admissionAllowed
|
|
7456
8161
|
}, {
|
|
7457
8162
|
configured: hasAccessRestrictions,
|
|
7458
8163
|
allowed: memberAllowed
|
|
@@ -7471,17 +8176,19 @@ async function authorizeDiscordVoiceIngress(params) {
|
|
|
7471
8176
|
}
|
|
7472
8177
|
//#endregion
|
|
7473
8178
|
//#region extensions/discord/src/voice/owner-access.ts
|
|
7474
|
-
function
|
|
8179
|
+
function resolveDiscordVoiceAccess(params) {
|
|
7475
8180
|
const commandOwnerAllowFrom = resolveDiscordCommandOwnerAllowFrom(params.cfg);
|
|
7476
8181
|
if (commandOwnerAllowFrom) return {
|
|
8182
|
+
admissionAllowFrom: commandOwnerAllowFrom,
|
|
7477
8183
|
ownerAllowFrom: commandOwnerAllowFrom,
|
|
7478
8184
|
ownerAllowAll: commandOwnerAllowFrom.includes("*")
|
|
7479
8185
|
};
|
|
7480
8186
|
return {
|
|
7481
|
-
|
|
8187
|
+
admissionAllowFrom: resolveDiscordAccountAllowFrom({
|
|
7482
8188
|
cfg: params.cfg,
|
|
7483
8189
|
accountId: params.accountId
|
|
7484
8190
|
}) ?? params.discordConfig.allowFrom ?? params.discordConfig.dm?.allowFrom ?? [],
|
|
8191
|
+
ownerAllowFrom: [],
|
|
7485
8192
|
ownerAllowAll: false
|
|
7486
8193
|
};
|
|
7487
8194
|
}
|
|
@@ -7512,7 +8219,7 @@ async function authorizeVoiceCommand(interaction, params, options) {
|
|
|
7512
8219
|
author: user,
|
|
7513
8220
|
member: interaction.rawData.member
|
|
7514
8221
|
});
|
|
7515
|
-
const
|
|
8222
|
+
const voiceAccess = resolveDiscordVoiceAccess(params);
|
|
7516
8223
|
const access = await authorizeDiscordVoiceIngress({
|
|
7517
8224
|
cfg: params.cfg,
|
|
7518
8225
|
discordConfig: params.discordConfig,
|
|
@@ -7530,8 +8237,7 @@ async function authorizeVoiceCommand(interaction, params, options) {
|
|
|
7530
8237
|
scope: channelContext.isThreadChannel ? "thread" : "channel",
|
|
7531
8238
|
channelLabel: channelId ? formatMention({ channelId }) : "This channel",
|
|
7532
8239
|
memberRoleIds,
|
|
7533
|
-
|
|
7534
|
-
ownerAllowAll: ownerAccess.ownerAllowAll,
|
|
8240
|
+
admissionAllowFrom: voiceAccess.admissionAllowFrom,
|
|
7535
8241
|
sender: {
|
|
7536
8242
|
id: sender.id,
|
|
7537
8243
|
name: sender.name,
|
|
@@ -7822,13 +8528,6 @@ async function resolveComponentInteractionContext(params) {
|
|
|
7822
8528
|
};
|
|
7823
8529
|
}
|
|
7824
8530
|
//#endregion
|
|
7825
|
-
//#region extensions/discord/src/monitor/agent-components-reply.ts
|
|
7826
|
-
async function replySilently(interaction, params) {
|
|
7827
|
-
try {
|
|
7828
|
-
await interaction.reply(params);
|
|
7829
|
-
} catch {}
|
|
7830
|
-
}
|
|
7831
|
-
//#endregion
|
|
7832
8531
|
//#region extensions/discord/src/monitor/agent-components-dm-auth.ts
|
|
7833
8532
|
async function ensureDmComponentAuthorized(params) {
|
|
7834
8533
|
const { ctx, interaction, user, componentLabel, replyOpts } = params;
|
|
@@ -8467,7 +9166,7 @@ async function deliverDiscordReply(params) {
|
|
|
8467
9166
|
//#endregion
|
|
8468
9167
|
//#region extensions/discord/src/monitor/agent-components.dispatch.ts
|
|
8469
9168
|
const loadConversationRuntime$1 = createLazyRuntimeModule(() => import("./agent-components.runtime-CEPrf2SY.js"));
|
|
8470
|
-
const loadTypingRuntime = createLazyRuntimeModule(() => import("./typing-
|
|
9169
|
+
const loadTypingRuntime = createLazyRuntimeModule(() => import("./typing-wxtm1NlF.js").then((n) => n.n));
|
|
8471
9170
|
function buildDiscordComponentConversationLabel(params) {
|
|
8472
9171
|
if (params.interactionCtx.isDirectMessage) return buildDirectLabel(params.interactionCtx.user);
|
|
8473
9172
|
if (params.interactionCtx.isGroupDm) return `Group DM #${params.channelCtx.channelName ?? params.interactionCtx.channelId} channel id:${params.interactionCtx.channelId}`;
|
|
@@ -8576,7 +9275,7 @@ async function dispatchDiscordComponentEvent(params) {
|
|
|
8576
9275
|
previousTimestamp,
|
|
8577
9276
|
envelope: envelopeOptions
|
|
8578
9277
|
});
|
|
8579
|
-
const { createReplyReferencePlanner,
|
|
9278
|
+
const { createReplyReferencePlanner, finalizeInboundContext, resolveChunkMode, resolveTextChunkLimit } = await (async () => {
|
|
8580
9279
|
return { ...await loadConversationRuntime$1() };
|
|
8581
9280
|
})();
|
|
8582
9281
|
const ctxPayload = finalizeInboundContext({
|
|
@@ -8652,12 +9351,11 @@ async function dispatchDiscordComponentEvent(params) {
|
|
|
8652
9351
|
cfg: ctx.cfg,
|
|
8653
9352
|
channel: "discord",
|
|
8654
9353
|
accountId,
|
|
8655
|
-
|
|
8656
|
-
|
|
8657
|
-
|
|
9354
|
+
route: {
|
|
9355
|
+
agentId,
|
|
9356
|
+
sessionKey
|
|
9357
|
+
},
|
|
8658
9358
|
ctxPayload,
|
|
8659
|
-
recordInboundSession,
|
|
8660
|
-
dispatchReplyWithBufferedBlockDispatcher,
|
|
8661
9359
|
record: {
|
|
8662
9360
|
updateLastRoute: interactionCtx.isDirectMessage ? {
|
|
8663
9361
|
sessionKey: inboundLastRouteSessionKey,
|
|
@@ -8880,7 +9578,7 @@ async function dispatchPluginDiscordInteractiveEvent(params) {
|
|
|
8880
9578
|
}
|
|
8881
9579
|
//#endregion
|
|
8882
9580
|
//#region extensions/discord/src/monitor/agent-components.handlers.ts
|
|
8883
|
-
const loadComponentsRuntime = createLazyRuntimeModule(() => import("./
|
|
9581
|
+
const loadComponentsRuntime = createLazyRuntimeModule(() => import("./outbound-session-route-M2bEY9tI.js").then((n) => n.n));
|
|
8884
9582
|
async function handleDiscordComponentEvent(params) {
|
|
8885
9583
|
const parsed = parseDiscordComponentData(params.data, resolveInteractionCustomId(params.interaction));
|
|
8886
9584
|
if (!parsed) {
|
|
@@ -9372,769 +10070,388 @@ var DiscordComponentSelectControl = class extends BaseMessageInteractiveComponen
|
|
|
9372
10070
|
await this.handlers.handleComponentEvent({
|
|
9373
10071
|
ctx: this.ctx,
|
|
9374
10072
|
interaction,
|
|
9375
|
-
data,
|
|
9376
|
-
componentLabel: this.spec.componentLabel,
|
|
9377
|
-
label: this.spec.label,
|
|
9378
|
-
values: interaction.values ?? []
|
|
9379
|
-
});
|
|
9380
|
-
}
|
|
9381
|
-
};
|
|
9382
|
-
var DiscordComponentButton = class extends Button {
|
|
9383
|
-
constructor(ctx, handlers) {
|
|
9384
|
-
super();
|
|
9385
|
-
this.ctx = ctx;
|
|
9386
|
-
this.handlers = handlers;
|
|
9387
|
-
this.label = "component";
|
|
9388
|
-
this.customId = "__openclaw_discord_component_button_wildcard__";
|
|
9389
|
-
this.style = ButtonStyle.Primary;
|
|
9390
|
-
this.customIdParser = parseDiscordComponentCustomIdForInteraction;
|
|
9391
|
-
}
|
|
9392
|
-
async run(interaction, data) {
|
|
9393
|
-
if (parseDiscordComponentData(data, resolveInteractionCustomId(interaction))?.modalId) {
|
|
9394
|
-
await this.handlers.handleModalTrigger({
|
|
9395
|
-
ctx: this.ctx,
|
|
9396
|
-
interaction,
|
|
9397
|
-
data,
|
|
9398
|
-
label: "discord component modal"
|
|
9399
|
-
});
|
|
9400
|
-
return;
|
|
9401
|
-
}
|
|
9402
|
-
await this.handlers.handleComponentEvent({
|
|
9403
|
-
ctx: this.ctx,
|
|
9404
|
-
interaction,
|
|
9405
|
-
data,
|
|
9406
|
-
componentLabel: "button",
|
|
9407
|
-
label: "discord component button"
|
|
9408
|
-
});
|
|
9409
|
-
}
|
|
9410
|
-
};
|
|
9411
|
-
function createSelectControl(spec, ctx, handlers) {
|
|
9412
|
-
return new DiscordComponentSelectControl(spec, ctx, handlers);
|
|
9413
|
-
}
|
|
9414
|
-
function bindSelectControl(spec) {
|
|
9415
|
-
return (ctx, handlers) => createSelectControl(spec, ctx, handlers);
|
|
9416
|
-
}
|
|
9417
|
-
function createDiscordComponentButtonControl(ctx, handlers) {
|
|
9418
|
-
return new DiscordComponentButton(ctx, handlers);
|
|
9419
|
-
}
|
|
9420
|
-
const createDiscordComponentStringSelectControl = bindSelectControl(SELECT_CONTROLS.string);
|
|
9421
|
-
const createDiscordComponentUserSelectControl = bindSelectControl(SELECT_CONTROLS.user);
|
|
9422
|
-
const createDiscordComponentRoleSelectControl = bindSelectControl(SELECT_CONTROLS.role);
|
|
9423
|
-
const createDiscordComponentMentionableSelectControl = bindSelectControl(SELECT_CONTROLS.mentionable);
|
|
9424
|
-
const createDiscordComponentChannelSelectControl = bindSelectControl(SELECT_CONTROLS.channel);
|
|
9425
|
-
//#endregion
|
|
9426
|
-
//#region extensions/discord/src/monitor/agent-components.ts
|
|
9427
|
-
function bindDiscordComponentControl(createControl) {
|
|
9428
|
-
return (ctx) => createControl(ctx, discordComponentControlHandlers);
|
|
9429
|
-
}
|
|
9430
|
-
const createDiscordComponentButton = bindDiscordComponentControl(createDiscordComponentButtonControl);
|
|
9431
|
-
const createDiscordComponentStringSelect = bindDiscordComponentControl(createDiscordComponentStringSelectControl);
|
|
9432
|
-
const createDiscordComponentUserSelect = bindDiscordComponentControl(createDiscordComponentUserSelectControl);
|
|
9433
|
-
const createDiscordComponentRoleSelect = bindDiscordComponentControl(createDiscordComponentRoleSelectControl);
|
|
9434
|
-
const createDiscordComponentMentionableSelect = bindDiscordComponentControl(createDiscordComponentMentionableSelectControl);
|
|
9435
|
-
const createDiscordComponentChannelSelect = bindDiscordComponentControl(createDiscordComponentChannelSelectControl);
|
|
9436
|
-
const createAgentComponentControls = [createAgentComponentButton, createAgentSelectMenu];
|
|
9437
|
-
const createDiscordComponentControls = [
|
|
9438
|
-
createDiscordComponentButton,
|
|
9439
|
-
createDiscordComponentStringSelect,
|
|
9440
|
-
createDiscordComponentUserSelect,
|
|
9441
|
-
createDiscordComponentRoleSelect,
|
|
9442
|
-
createDiscordComponentMentionableSelect,
|
|
9443
|
-
createDiscordComponentChannelSelect
|
|
9444
|
-
];
|
|
9445
|
-
function createDiscordComponentModal(ctx) {
|
|
9446
|
-
return new DiscordComponentModal(ctx);
|
|
9447
|
-
}
|
|
9448
|
-
//#endregion
|
|
9449
|
-
//#region extensions/discord/src/monitor/exec-approvals.ts
|
|
9450
|
-
function resolveTerminalLabel(approval) {
|
|
9451
|
-
if (approval.status === "allowed") return approval.decision === "allow-always" ? "Allowed always" : "Allowed once";
|
|
9452
|
-
if (approval.status === "denied") return "Denied";
|
|
9453
|
-
return approval.status === "expired" ? "Expired" : "Cancelled";
|
|
9454
|
-
}
|
|
9455
|
-
function buildTerminalPayload(params) {
|
|
9456
|
-
const { approval } = params;
|
|
9457
|
-
const label = resolveTerminalLabel(approval);
|
|
9458
|
-
const accentColor = approval.status === "denied" ? "#ED4245" : approval.status === "allowed" ? "#57F287" : "#99AAB5";
|
|
9459
|
-
return {
|
|
9460
|
-
allowed_mentions: DISCORD_APPROVAL_ALLOWED_MENTIONS,
|
|
9461
|
-
components: [new Container([
|
|
9462
|
-
new TextDisplay(params.applied ? "## Approval resolved" : "## Approval already resolved"),
|
|
9463
|
-
new TextDisplay(`Canonical result: **${label}**`),
|
|
9464
|
-
new Separator({
|
|
9465
|
-
divider: false,
|
|
9466
|
-
spacing: "small"
|
|
9467
|
-
}),
|
|
9468
|
-
new TextDisplay(`-# ID: ${formatDiscordApprovalDisplayValue(approval.id)}`)
|
|
9469
|
-
], { accentColor })]
|
|
9470
|
-
};
|
|
9471
|
-
}
|
|
9472
|
-
function isStructuredApprovalNotFoundError(err) {
|
|
9473
|
-
if (!err || typeof err !== "object") return false;
|
|
9474
|
-
const record = err;
|
|
9475
|
-
if (record.gatewayCode === "APPROVAL_NOT_FOUND") return true;
|
|
9476
|
-
return record.gatewayCode === "INVALID_REQUEST" && record.details?.reason === "APPROVAL_NOT_FOUND";
|
|
9477
|
-
}
|
|
9478
|
-
var ExecApprovalButton = class extends Button {
|
|
9479
|
-
constructor(ctx) {
|
|
9480
|
-
super();
|
|
9481
|
-
this.ctx = ctx;
|
|
9482
|
-
this.label = "execapproval";
|
|
9483
|
-
this.customId = "execapproval:seed=1";
|
|
9484
|
-
this.style = ButtonStyle.Primary;
|
|
9485
|
-
}
|
|
9486
|
-
async run(interaction, data) {
|
|
9487
|
-
const parsed = parseExecApprovalData(data);
|
|
9488
|
-
if (!parsed) {
|
|
9489
|
-
try {
|
|
9490
|
-
await interaction.reply({
|
|
9491
|
-
content: "This approval is no longer valid.",
|
|
9492
|
-
ephemeral: true
|
|
9493
|
-
});
|
|
9494
|
-
} catch {}
|
|
9495
|
-
return;
|
|
9496
|
-
}
|
|
9497
|
-
const approvers = this.ctx.getApprovers();
|
|
9498
|
-
const userId = interaction.userId;
|
|
9499
|
-
if (!approvers.some((id) => id === userId)) {
|
|
9500
|
-
try {
|
|
9501
|
-
await interaction.reply({
|
|
9502
|
-
content: "⛔ You are not authorized to approve requests.",
|
|
9503
|
-
ephemeral: true
|
|
9504
|
-
});
|
|
9505
|
-
} catch {}
|
|
9506
|
-
return;
|
|
9507
|
-
}
|
|
9508
|
-
const decisionLabel = parsed.action === "allow-once" ? "Allowed (once)" : parsed.action === "allow-always" ? "Allowed (always)" : "Denied";
|
|
9509
|
-
try {
|
|
9510
|
-
await interaction.acknowledge();
|
|
9511
|
-
} catch {}
|
|
9512
|
-
const result = await this.ctx.resolveApproval(parsed.approvalId, parsed.approvalKind, parsed.action);
|
|
9513
|
-
if (!result.ok) {
|
|
9514
|
-
try {
|
|
9515
|
-
await interaction.followUp({
|
|
9516
|
-
content: result.reason === "not-found" ? `That approval request is no longer pending. It may have expired or already been resolved.` : `Failed to submit approval decision for **${decisionLabel}**. The request may have expired or already been resolved.`,
|
|
9517
|
-
ephemeral: true
|
|
9518
|
-
});
|
|
9519
|
-
} catch {}
|
|
9520
|
-
return;
|
|
9521
|
-
}
|
|
9522
|
-
const terminalLabel = resolveTerminalLabel(result.resolution.approval);
|
|
9523
|
-
let terminalized = false;
|
|
9524
|
-
try {
|
|
9525
|
-
await interaction.editReply(buildTerminalPayload({
|
|
9526
|
-
approval: result.resolution.approval,
|
|
9527
|
-
applied: result.resolution.applied
|
|
9528
|
-
}));
|
|
9529
|
-
terminalized = true;
|
|
9530
|
-
} catch {}
|
|
9531
|
-
if (!terminalized || !result.resolution.applied) try {
|
|
9532
|
-
await interaction.followUp({
|
|
9533
|
-
content: result.resolution.applied ? `Approval resolved: ${terminalLabel}.` : `This approval was already resolved: ${terminalLabel}.`,
|
|
9534
|
-
ephemeral: true
|
|
9535
|
-
});
|
|
9536
|
-
} catch {}
|
|
9537
|
-
}
|
|
9538
|
-
};
|
|
9539
|
-
function createExecApprovalButton(ctx) {
|
|
9540
|
-
return new ExecApprovalButton(ctx);
|
|
9541
|
-
}
|
|
9542
|
-
function createDiscordExecApprovalButtonContext(params) {
|
|
9543
|
-
return {
|
|
9544
|
-
getApprovers: () => getDiscordExecApprovalApprovers({
|
|
9545
|
-
cfg: params.cfg,
|
|
9546
|
-
accountId: params.accountId,
|
|
9547
|
-
configOverride: params.config
|
|
9548
|
-
}),
|
|
9549
|
-
resolveApproval: async (approvalId, approvalKind, decision) => {
|
|
9550
|
-
try {
|
|
9551
|
-
return {
|
|
9552
|
-
ok: true,
|
|
9553
|
-
resolution: await resolveApprovalOverGateway({
|
|
9554
|
-
cfg: params.cfg,
|
|
9555
|
-
approvalId,
|
|
9556
|
-
approvalKind,
|
|
9557
|
-
decision,
|
|
9558
|
-
gatewayUrl: params.gatewayUrl,
|
|
9559
|
-
clientDisplayName: `Discord approval (${params.accountId})`
|
|
9560
|
-
})
|
|
9561
|
-
};
|
|
9562
|
-
} catch (err) {
|
|
9563
|
-
return {
|
|
9564
|
-
ok: false,
|
|
9565
|
-
reason: isStructuredApprovalNotFoundError(err) ? "not-found" : "error"
|
|
9566
|
-
};
|
|
9567
|
-
}
|
|
9568
|
-
}
|
|
9569
|
-
};
|
|
9570
|
-
}
|
|
9571
|
-
//#endregion
|
|
9572
|
-
//#region extensions/discord/src/monitor/provider.interactions.ts
|
|
9573
|
-
function createDiscordProviderInteractionSurface(params) {
|
|
9574
|
-
const createNativeCommand = params.createNativeCommand ?? createDiscordNativeCommand;
|
|
9575
|
-
const commands = params.commandSpecs.map((spec) => createNativeCommand({
|
|
9576
|
-
command: spec,
|
|
9577
|
-
cfg: params.cfg,
|
|
9578
|
-
discordConfig: params.discordConfig,
|
|
9579
|
-
accountId: params.accountId,
|
|
9580
|
-
sessionPrefix: params.sessionPrefix,
|
|
9581
|
-
ephemeralDefault: params.ephemeralDefault,
|
|
9582
|
-
threadBindings: params.threadBindings
|
|
9583
|
-
}));
|
|
9584
|
-
if (params.nativeEnabled && params.voiceEnabled) commands.push(createDiscordVoiceCommand({
|
|
9585
|
-
cfg: params.cfg,
|
|
9586
|
-
discordConfig: params.discordConfig,
|
|
9587
|
-
accountId: params.accountId,
|
|
9588
|
-
groupPolicy: params.groupPolicy,
|
|
9589
|
-
useAccessGroups: params.useAccessGroups,
|
|
9590
|
-
getManager: () => params.voiceManagerRef.current,
|
|
9591
|
-
ephemeralDefault: params.ephemeralDefault
|
|
9592
|
-
}));
|
|
9593
|
-
const execApprovalsConfig = params.discordConfig.execApprovals ?? {};
|
|
9594
|
-
const execApprovalsEnabled = isDiscordExecApprovalClientEnabled({
|
|
9595
|
-
cfg: params.cfg,
|
|
9596
|
-
accountId: params.accountId,
|
|
9597
|
-
configOverride: execApprovalsConfig
|
|
9598
|
-
});
|
|
9599
|
-
const approvalActionsEnabled = getDiscordExecApprovalApprovers({
|
|
9600
|
-
cfg: params.cfg,
|
|
9601
|
-
accountId: params.accountId,
|
|
9602
|
-
configOverride: execApprovalsConfig
|
|
9603
|
-
}).length > 0;
|
|
9604
|
-
if (execApprovalsEnabled) registerChannelRuntimeContext({
|
|
9605
|
-
channelRuntime: params.channelRuntime,
|
|
9606
|
-
channelId: "discord",
|
|
9607
|
-
accountId: params.accountId,
|
|
9608
|
-
capability: CHANNEL_APPROVAL_NATIVE_RUNTIME_CONTEXT_CAPABILITY,
|
|
9609
|
-
context: {
|
|
9610
|
-
token: params.token,
|
|
9611
|
-
config: execApprovalsConfig
|
|
9612
|
-
},
|
|
9613
|
-
abortSignal: params.abortSignal
|
|
9614
|
-
});
|
|
9615
|
-
const components = [
|
|
9616
|
-
createDiscordCommandArgFallbackButton({
|
|
9617
|
-
cfg: params.cfg,
|
|
9618
|
-
discordConfig: params.discordConfig,
|
|
9619
|
-
accountId: params.accountId,
|
|
9620
|
-
sessionPrefix: params.sessionPrefix,
|
|
9621
|
-
threadBindings: params.threadBindings
|
|
9622
|
-
}),
|
|
9623
|
-
createDiscordModelPickerFallbackButton({
|
|
9624
|
-
cfg: params.cfg,
|
|
9625
|
-
discordConfig: params.discordConfig,
|
|
9626
|
-
accountId: params.accountId,
|
|
9627
|
-
sessionPrefix: params.sessionPrefix,
|
|
9628
|
-
threadBindings: params.threadBindings
|
|
9629
|
-
}),
|
|
9630
|
-
createDiscordModelPickerFallbackSelect({
|
|
9631
|
-
cfg: params.cfg,
|
|
9632
|
-
discordConfig: params.discordConfig,
|
|
9633
|
-
accountId: params.accountId,
|
|
9634
|
-
sessionPrefix: params.sessionPrefix,
|
|
9635
|
-
threadBindings: params.threadBindings
|
|
9636
|
-
})
|
|
9637
|
-
];
|
|
9638
|
-
const modals = [];
|
|
9639
|
-
if (approvalActionsEnabled) components.push(createExecApprovalButton(createDiscordExecApprovalButtonContext({
|
|
9640
|
-
cfg: params.cfg,
|
|
9641
|
-
accountId: params.accountId,
|
|
9642
|
-
config: execApprovalsConfig
|
|
9643
|
-
})));
|
|
9644
|
-
if ((params.discordConfig.agentComponents ?? {}).enabled ?? true) {
|
|
9645
|
-
const componentContext = {
|
|
9646
|
-
cfg: params.cfg,
|
|
9647
|
-
discordConfig: params.discordConfig,
|
|
9648
|
-
accountId: params.accountId,
|
|
9649
|
-
guildEntries: params.guildEntries,
|
|
9650
|
-
allowFrom: params.allowFrom,
|
|
9651
|
-
dmPolicy: params.dmPolicy,
|
|
9652
|
-
runtime: params.runtime,
|
|
9653
|
-
token: params.token
|
|
9654
|
-
};
|
|
9655
|
-
components.push(...createAgentComponentControls.map((create) => create(componentContext)));
|
|
9656
|
-
components.push(...createDiscordComponentControls.map((create) => create(componentContext)));
|
|
9657
|
-
modals.push(createDiscordComponentModal(componentContext));
|
|
9658
|
-
}
|
|
9659
|
-
return {
|
|
9660
|
-
commands,
|
|
9661
|
-
components,
|
|
9662
|
-
modals
|
|
9663
|
-
};
|
|
9664
|
-
}
|
|
9665
|
-
//#endregion
|
|
9666
|
-
//#region extensions/discord/src/gateway-logging.ts
|
|
9667
|
-
const INFO_DEBUG_MARKERS = [
|
|
9668
|
-
"Gateway websocket closed",
|
|
9669
|
-
"Gateway reconnect scheduled in",
|
|
9670
|
-
"Gateway forcing fresh IDENTIFY after"
|
|
9671
|
-
];
|
|
9672
|
-
const shouldPromoteGatewayDebug = (message) => INFO_DEBUG_MARKERS.some((marker) => message.includes(marker));
|
|
9673
|
-
const formatGatewayMetrics = (metrics) => {
|
|
9674
|
-
if (metrics === null || metrics === void 0) return String(metrics);
|
|
9675
|
-
if (typeof metrics === "string") return metrics;
|
|
9676
|
-
if (typeof metrics === "number" || typeof metrics === "boolean" || typeof metrics === "bigint") return String(metrics);
|
|
9677
|
-
try {
|
|
9678
|
-
return JSON.stringify(metrics);
|
|
9679
|
-
} catch {
|
|
9680
|
-
return "[unserializable metrics]";
|
|
10073
|
+
data,
|
|
10074
|
+
componentLabel: this.spec.componentLabel,
|
|
10075
|
+
label: this.spec.label,
|
|
10076
|
+
values: interaction.values ?? []
|
|
10077
|
+
});
|
|
9681
10078
|
}
|
|
9682
10079
|
};
|
|
9683
|
-
|
|
9684
|
-
|
|
9685
|
-
|
|
9686
|
-
|
|
9687
|
-
|
|
9688
|
-
|
|
9689
|
-
|
|
9690
|
-
|
|
9691
|
-
|
|
9692
|
-
|
|
9693
|
-
|
|
9694
|
-
|
|
9695
|
-
|
|
9696
|
-
|
|
9697
|
-
|
|
9698
|
-
|
|
9699
|
-
|
|
9700
|
-
|
|
9701
|
-
emitter.removeListener("debug", onGatewayDebug);
|
|
9702
|
-
emitter.removeListener("warning", onGatewayWarning);
|
|
9703
|
-
emitter.removeListener("metrics", onGatewayMetrics);
|
|
9704
|
-
};
|
|
9705
|
-
}
|
|
9706
|
-
//#endregion
|
|
9707
|
-
//#region extensions/discord/src/monitor.gateway.ts
|
|
9708
|
-
async function waitForDiscordGatewayStop(params) {
|
|
9709
|
-
const { gateway, abortSignal } = params;
|
|
9710
|
-
return await new Promise((resolve, reject) => {
|
|
9711
|
-
let settled = false;
|
|
9712
|
-
const cleanup = () => {
|
|
9713
|
-
abortSignal?.removeEventListener("abort", onAbort);
|
|
9714
|
-
params.gatewaySupervisor?.detachLifecycle();
|
|
9715
|
-
};
|
|
9716
|
-
const finishResolve = () => {
|
|
9717
|
-
if (settled) return;
|
|
9718
|
-
settled = true;
|
|
9719
|
-
try {
|
|
9720
|
-
gateway?.disconnect?.();
|
|
9721
|
-
} finally {
|
|
9722
|
-
cleanup();
|
|
9723
|
-
resolve();
|
|
9724
|
-
}
|
|
9725
|
-
};
|
|
9726
|
-
const finishReject = (err) => {
|
|
9727
|
-
if (settled) return;
|
|
9728
|
-
settled = true;
|
|
9729
|
-
try {
|
|
9730
|
-
gateway?.disconnect?.();
|
|
9731
|
-
} finally {
|
|
9732
|
-
cleanup();
|
|
9733
|
-
reject(toLintErrorObject(err, "Non-Error rejection"));
|
|
9734
|
-
}
|
|
9735
|
-
};
|
|
9736
|
-
const onAbort = () => {
|
|
9737
|
-
finishResolve();
|
|
9738
|
-
};
|
|
9739
|
-
const onGatewayEvent = (event) => {
|
|
9740
|
-
if ((params.onGatewayEvent?.(event) ?? "stop") === "stop") finishReject(new DiscordGatewayLifecycleError(event));
|
|
9741
|
-
};
|
|
9742
|
-
const onForceStop = (err) => {
|
|
9743
|
-
finishReject(err);
|
|
9744
|
-
};
|
|
9745
|
-
if (abortSignal?.aborted) {
|
|
9746
|
-
onAbort();
|
|
10080
|
+
var DiscordComponentButton = class extends Button {
|
|
10081
|
+
constructor(ctx, handlers) {
|
|
10082
|
+
super();
|
|
10083
|
+
this.ctx = ctx;
|
|
10084
|
+
this.handlers = handlers;
|
|
10085
|
+
this.label = "component";
|
|
10086
|
+
this.customId = "__openclaw_discord_component_button_wildcard__";
|
|
10087
|
+
this.style = ButtonStyle.Primary;
|
|
10088
|
+
this.customIdParser = parseDiscordComponentCustomIdForInteraction;
|
|
10089
|
+
}
|
|
10090
|
+
async run(interaction, data) {
|
|
10091
|
+
if (parseDiscordComponentData(data, resolveInteractionCustomId(interaction))?.modalId) {
|
|
10092
|
+
await this.handlers.handleModalTrigger({
|
|
10093
|
+
ctx: this.ctx,
|
|
10094
|
+
interaction,
|
|
10095
|
+
data,
|
|
10096
|
+
label: "discord component modal"
|
|
10097
|
+
});
|
|
9747
10098
|
return;
|
|
9748
10099
|
}
|
|
9749
|
-
|
|
9750
|
-
|
|
9751
|
-
|
|
9752
|
-
|
|
10100
|
+
await this.handlers.handleComponentEvent({
|
|
10101
|
+
ctx: this.ctx,
|
|
10102
|
+
interaction,
|
|
10103
|
+
data,
|
|
10104
|
+
componentLabel: "button",
|
|
10105
|
+
label: "discord component button"
|
|
10106
|
+
});
|
|
10107
|
+
}
|
|
10108
|
+
};
|
|
10109
|
+
function createSelectControl(spec, ctx, handlers) {
|
|
10110
|
+
return new DiscordComponentSelectControl(spec, ctx, handlers);
|
|
9753
10111
|
}
|
|
9754
|
-
function
|
|
9755
|
-
|
|
9756
|
-
if (typeof value === "string") return new Error(value);
|
|
9757
|
-
const error = new Error(fallbackMessage, { cause: value });
|
|
9758
|
-
if (typeof value === "object" && value !== null || typeof value === "function") Object.assign(error, value);
|
|
9759
|
-
return error;
|
|
10112
|
+
function bindSelectControl(spec) {
|
|
10113
|
+
return (ctx, handlers) => createSelectControl(spec, ctx, handlers);
|
|
9760
10114
|
}
|
|
9761
|
-
|
|
9762
|
-
|
|
9763
|
-
const DEFAULT_DISCORD_GATEWAY_READY_TIMEOUT_MS = 15e3;
|
|
9764
|
-
const DEFAULT_DISCORD_GATEWAY_RUNTIME_READY_TIMEOUT_MS = 3e4;
|
|
9765
|
-
const MAX_DISCORD_GATEWAY_READY_TIMEOUT_MS = 12e4;
|
|
9766
|
-
const DISCORD_GATEWAY_READY_TIMEOUT_ENV = "OPENCLAW_DISCORD_READY_TIMEOUT_MS";
|
|
9767
|
-
const DISCORD_GATEWAY_RUNTIME_READY_TIMEOUT_ENV = "OPENCLAW_DISCORD_RUNTIME_READY_TIMEOUT_MS";
|
|
9768
|
-
const DISCORD_GATEWAY_READY_POLL_MS = 250;
|
|
9769
|
-
const DISCORD_GATEWAY_READY_RETRY_BACKOFF_MS = 2e3;
|
|
9770
|
-
const DISCORD_GATEWAY_STARTUP_DISCONNECT_DRAIN_TIMEOUT_MS = 5e3;
|
|
9771
|
-
const DISCORD_GATEWAY_STARTUP_TERMINATE_CLOSE_TIMEOUT_MS = 1e3;
|
|
9772
|
-
const DISCORD_GATEWAY_TRANSPORT_ACTIVITY_STATUS_MIN_INTERVAL_MS = 3e4;
|
|
9773
|
-
function normalizeGatewayReadyTimeoutMs(value) {
|
|
9774
|
-
const numeric = parseStrictPositiveInteger(value);
|
|
9775
|
-
if (numeric === void 0) return;
|
|
9776
|
-
return Math.min(numeric, MAX_DISCORD_GATEWAY_READY_TIMEOUT_MS);
|
|
10115
|
+
function createDiscordComponentButtonControl(ctx, handlers) {
|
|
10116
|
+
return new DiscordComponentButton(ctx, handlers);
|
|
9777
10117
|
}
|
|
9778
|
-
|
|
9779
|
-
|
|
10118
|
+
const createDiscordComponentStringSelectControl = bindSelectControl(SELECT_CONTROLS.string);
|
|
10119
|
+
const createDiscordComponentUserSelectControl = bindSelectControl(SELECT_CONTROLS.user);
|
|
10120
|
+
const createDiscordComponentRoleSelectControl = bindSelectControl(SELECT_CONTROLS.role);
|
|
10121
|
+
const createDiscordComponentMentionableSelectControl = bindSelectControl(SELECT_CONTROLS.mentionable);
|
|
10122
|
+
const createDiscordComponentChannelSelectControl = bindSelectControl(SELECT_CONTROLS.channel);
|
|
10123
|
+
//#endregion
|
|
10124
|
+
//#region extensions/discord/src/monitor/agent-components.ts
|
|
10125
|
+
function bindDiscordComponentControl(createControl) {
|
|
10126
|
+
return (ctx) => createControl(ctx, discordComponentControlHandlers);
|
|
9780
10127
|
}
|
|
9781
|
-
|
|
9782
|
-
|
|
10128
|
+
const createDiscordComponentButton = bindDiscordComponentControl(createDiscordComponentButtonControl);
|
|
10129
|
+
const createDiscordComponentStringSelect = bindDiscordComponentControl(createDiscordComponentStringSelectControl);
|
|
10130
|
+
const createDiscordComponentUserSelect = bindDiscordComponentControl(createDiscordComponentUserSelectControl);
|
|
10131
|
+
const createDiscordComponentRoleSelect = bindDiscordComponentControl(createDiscordComponentRoleSelectControl);
|
|
10132
|
+
const createDiscordComponentMentionableSelect = bindDiscordComponentControl(createDiscordComponentMentionableSelectControl);
|
|
10133
|
+
const createDiscordComponentChannelSelect = bindDiscordComponentControl(createDiscordComponentChannelSelectControl);
|
|
10134
|
+
const createAgentComponentControls = [createAgentComponentButton, createAgentSelectMenu];
|
|
10135
|
+
const createDiscordComponentControls = [
|
|
10136
|
+
createDiscordComponentButton,
|
|
10137
|
+
createDiscordComponentStringSelect,
|
|
10138
|
+
createDiscordComponentUserSelect,
|
|
10139
|
+
createDiscordComponentRoleSelect,
|
|
10140
|
+
createDiscordComponentMentionableSelect,
|
|
10141
|
+
createDiscordComponentChannelSelect
|
|
10142
|
+
];
|
|
10143
|
+
function createDiscordComponentModal(ctx) {
|
|
10144
|
+
return new DiscordComponentModal(ctx);
|
|
9783
10145
|
}
|
|
9784
|
-
|
|
9785
|
-
|
|
9786
|
-
|
|
9787
|
-
if (
|
|
9788
|
-
|
|
9789
|
-
|
|
9790
|
-
return;
|
|
9791
|
-
}
|
|
9792
|
-
await new Promise((resolve, reject) => {
|
|
9793
|
-
let settled = false;
|
|
9794
|
-
let drainTimeout;
|
|
9795
|
-
let terminateCloseTimeout;
|
|
9796
|
-
const ignoreSocketError = () => {};
|
|
9797
|
-
const clearTimers = () => {
|
|
9798
|
-
if (drainTimeout) {
|
|
9799
|
-
clearTimeout(drainTimeout);
|
|
9800
|
-
drainTimeout = void 0;
|
|
9801
|
-
}
|
|
9802
|
-
if (terminateCloseTimeout) {
|
|
9803
|
-
clearTimeout(terminateCloseTimeout);
|
|
9804
|
-
terminateCloseTimeout = void 0;
|
|
9805
|
-
}
|
|
9806
|
-
};
|
|
9807
|
-
const cleanup = () => {
|
|
9808
|
-
clearTimers();
|
|
9809
|
-
socket.removeListener("close", onClose);
|
|
9810
|
-
socket.removeListener("error", ignoreSocketError);
|
|
9811
|
-
};
|
|
9812
|
-
const finishResolve = () => {
|
|
9813
|
-
if (settled) return;
|
|
9814
|
-
settled = true;
|
|
9815
|
-
cleanup();
|
|
9816
|
-
resolve();
|
|
9817
|
-
};
|
|
9818
|
-
const finishReject = (error) => {
|
|
9819
|
-
if (params.abortSignal?.aborted) {
|
|
9820
|
-
finishResolve();
|
|
9821
|
-
return;
|
|
9822
|
-
}
|
|
9823
|
-
if (settled) return;
|
|
9824
|
-
settled = true;
|
|
9825
|
-
cleanup();
|
|
9826
|
-
reject(error);
|
|
9827
|
-
};
|
|
9828
|
-
const onClose = () => {
|
|
9829
|
-
finishResolve();
|
|
9830
|
-
};
|
|
9831
|
-
socket.on("error", ignoreSocketError);
|
|
9832
|
-
socket.on("close", onClose);
|
|
9833
|
-
params.gateway?.disconnect();
|
|
9834
|
-
drainTimeout = setTimeout(() => {
|
|
9835
|
-
if (settled) return;
|
|
9836
|
-
if (typeof socket.terminate !== "function") {
|
|
9837
|
-
finishReject(/* @__PURE__ */ new Error(`discord gateway socket did not close within ${DISCORD_GATEWAY_STARTUP_DISCONNECT_DRAIN_TIMEOUT_MS}ms before restart`));
|
|
9838
|
-
return;
|
|
9839
|
-
}
|
|
9840
|
-
params.runtime.error?.(danger(`discord: startup restart waiting on a stale gateway socket for ${DISCORD_GATEWAY_STARTUP_DISCONNECT_DRAIN_TIMEOUT_MS}ms; forcing terminate before reconnect`));
|
|
9841
|
-
try {
|
|
9842
|
-
socket.terminate();
|
|
9843
|
-
} catch {
|
|
9844
|
-
finishReject(/* @__PURE__ */ new Error(`discord gateway socket did not close within ${DISCORD_GATEWAY_STARTUP_DISCONNECT_DRAIN_TIMEOUT_MS}ms before restart`));
|
|
9845
|
-
return;
|
|
9846
|
-
}
|
|
9847
|
-
terminateCloseTimeout = setTimeout(() => {
|
|
9848
|
-
finishReject(/* @__PURE__ */ new Error(`discord gateway socket did not close within ${DISCORD_GATEWAY_STARTUP_DISCONNECT_DRAIN_TIMEOUT_MS}ms before restart`));
|
|
9849
|
-
}, DISCORD_GATEWAY_STARTUP_TERMINATE_CLOSE_TIMEOUT_MS);
|
|
9850
|
-
terminateCloseTimeout.unref?.();
|
|
9851
|
-
}, DISCORD_GATEWAY_STARTUP_DISCONNECT_DRAIN_TIMEOUT_MS);
|
|
9852
|
-
drainTimeout.unref?.();
|
|
9853
|
-
});
|
|
9854
|
-
if (!params.abortSignal?.aborted) params.gateway.connect(false);
|
|
10146
|
+
//#endregion
|
|
10147
|
+
//#region extensions/discord/src/monitor/exec-approvals.ts
|
|
10148
|
+
function resolveTerminalLabel(approval) {
|
|
10149
|
+
if (approval.status === "allowed") return approval.decision === "allow-always" ? "Allowed always" : "Allowed once";
|
|
10150
|
+
if (approval.status === "denied") return "Denied";
|
|
10151
|
+
return approval.status === "expired" ? "Expired" : "Cancelled";
|
|
9855
10152
|
}
|
|
9856
|
-
function
|
|
9857
|
-
const
|
|
9858
|
-
|
|
9859
|
-
const
|
|
9860
|
-
return
|
|
10153
|
+
function buildTerminalPayload(params) {
|
|
10154
|
+
const { approval } = params;
|
|
10155
|
+
const label = resolveTerminalLabel(approval);
|
|
10156
|
+
const accentColor = approval.status === "denied" ? "#ED4245" : approval.status === "allowed" ? "#57F287" : "#99AAB5";
|
|
10157
|
+
return {
|
|
10158
|
+
allowed_mentions: DISCORD_APPROVAL_ALLOWED_MENTIONS,
|
|
10159
|
+
components: [new Container([
|
|
10160
|
+
new TextDisplay(params.applied ? "## Approval resolved" : "## Approval already resolved"),
|
|
10161
|
+
new TextDisplay(`Canonical result: **${label}**`),
|
|
10162
|
+
new Separator({
|
|
10163
|
+
divider: false,
|
|
10164
|
+
spacing: "small"
|
|
10165
|
+
}),
|
|
10166
|
+
new TextDisplay(`-# ID: ${formatDiscordApprovalDisplayValue(approval.id)}`)
|
|
10167
|
+
], { accentColor })]
|
|
10168
|
+
};
|
|
9861
10169
|
}
|
|
9862
|
-
function
|
|
9863
|
-
|
|
9864
|
-
const
|
|
9865
|
-
|
|
10170
|
+
function isStructuredApprovalNotFoundError(err) {
|
|
10171
|
+
if (!err || typeof err !== "object") return false;
|
|
10172
|
+
const record = err;
|
|
10173
|
+
if (record.gatewayCode === "APPROVAL_NOT_FOUND") return true;
|
|
10174
|
+
return record.gatewayCode === "INVALID_REQUEST" && record.details?.reason === "APPROVAL_NOT_FOUND";
|
|
9866
10175
|
}
|
|
9867
|
-
|
|
9868
|
-
|
|
9869
|
-
|
|
9870
|
-
|
|
9871
|
-
|
|
9872
|
-
|
|
9873
|
-
|
|
9874
|
-
|
|
9875
|
-
|
|
9876
|
-
|
|
9877
|
-
|
|
9878
|
-
|
|
9879
|
-
|
|
9880
|
-
|
|
9881
|
-
|
|
9882
|
-
};
|
|
9883
|
-
const triggerForceStop = (err) => {
|
|
9884
|
-
if (forceStopHandler) {
|
|
9885
|
-
forceStopHandler(err);
|
|
9886
|
-
return;
|
|
9887
|
-
}
|
|
9888
|
-
queuedForceStopError = err;
|
|
9889
|
-
};
|
|
9890
|
-
const pushConnectedStatus = (at) => {
|
|
9891
|
-
params.pushStatus({
|
|
9892
|
-
...createConnectedChannelStatusPatch(at),
|
|
9893
|
-
lastDisconnect: null,
|
|
9894
|
-
lastError: null
|
|
9895
|
-
});
|
|
9896
|
-
};
|
|
9897
|
-
const startReadyWatch = () => {
|
|
9898
|
-
clearReadyWatch();
|
|
9899
|
-
const pollConnected = () => {
|
|
9900
|
-
if (shouldStop()) {
|
|
9901
|
-
clearReadyWatch();
|
|
9902
|
-
return;
|
|
9903
|
-
}
|
|
9904
|
-
if (!params.gateway?.isConnected) return;
|
|
9905
|
-
clearReadyWatch();
|
|
9906
|
-
pushConnectedStatus(Date.now());
|
|
9907
|
-
};
|
|
9908
|
-
pollConnected();
|
|
9909
|
-
if (!readyTimeoutId) {
|
|
9910
|
-
readyPollId = setInterval(pollConnected, DISCORD_GATEWAY_READY_POLL_MS);
|
|
9911
|
-
readyPollId.unref?.();
|
|
9912
|
-
readyTimeoutId = setTimeout(() => {
|
|
9913
|
-
clearReadyWatch();
|
|
9914
|
-
if (shouldStop() || params.gateway?.isConnected) return;
|
|
9915
|
-
const at = Date.now();
|
|
9916
|
-
const error = /* @__PURE__ */ new Error(`discord gateway opened but did not reach READY within ${params.runtimeReadyTimeoutMs}ms`);
|
|
9917
|
-
params.pushStatus({
|
|
9918
|
-
connected: false,
|
|
9919
|
-
lastEventAt: at,
|
|
9920
|
-
lastDisconnect: {
|
|
9921
|
-
at,
|
|
9922
|
-
error: "runtime-not-ready"
|
|
9923
|
-
},
|
|
9924
|
-
lastError: "runtime-not-ready"
|
|
10176
|
+
var ExecApprovalButton = class extends Button {
|
|
10177
|
+
constructor(ctx) {
|
|
10178
|
+
super();
|
|
10179
|
+
this.ctx = ctx;
|
|
10180
|
+
this.label = "execapproval";
|
|
10181
|
+
this.customId = "execapproval:seed=1";
|
|
10182
|
+
this.style = ButtonStyle.Primary;
|
|
10183
|
+
}
|
|
10184
|
+
async run(interaction, data) {
|
|
10185
|
+
const parsed = parseExecApprovalData(data);
|
|
10186
|
+
if (!parsed) {
|
|
10187
|
+
try {
|
|
10188
|
+
await interaction.reply({
|
|
10189
|
+
content: "This approval is no longer valid.",
|
|
10190
|
+
ephemeral: true
|
|
9925
10191
|
});
|
|
9926
|
-
|
|
9927
|
-
triggerForceStop(error);
|
|
9928
|
-
}, params.runtimeReadyTimeoutMs);
|
|
9929
|
-
readyTimeoutId.unref?.();
|
|
9930
|
-
}
|
|
9931
|
-
};
|
|
9932
|
-
const onGatewayDebug = (msg) => {
|
|
9933
|
-
if (shouldStop()) return;
|
|
9934
|
-
const at = Date.now();
|
|
9935
|
-
const message = String(msg);
|
|
9936
|
-
if (message.includes("Gateway websocket opened")) {
|
|
9937
|
-
params.pushStatus({
|
|
9938
|
-
connected: false,
|
|
9939
|
-
lastEventAt: at
|
|
9940
|
-
});
|
|
9941
|
-
startReadyWatch();
|
|
10192
|
+
} catch {}
|
|
9942
10193
|
return;
|
|
9943
10194
|
}
|
|
9944
|
-
|
|
9945
|
-
|
|
9946
|
-
|
|
9947
|
-
|
|
9948
|
-
|
|
9949
|
-
|
|
9950
|
-
|
|
9951
|
-
|
|
9952
|
-
|
|
9953
|
-
}
|
|
9954
|
-
});
|
|
10195
|
+
const approvers = this.ctx.getApprovers();
|
|
10196
|
+
const userId = interaction.userId;
|
|
10197
|
+
if (!approvers.some((id) => id === userId)) {
|
|
10198
|
+
try {
|
|
10199
|
+
await interaction.reply({
|
|
10200
|
+
content: "⛔ You are not authorized to approve requests.",
|
|
10201
|
+
ephemeral: true
|
|
10202
|
+
});
|
|
10203
|
+
} catch {}
|
|
9955
10204
|
return;
|
|
9956
10205
|
}
|
|
9957
|
-
|
|
9958
|
-
|
|
9959
|
-
|
|
9960
|
-
|
|
9961
|
-
|
|
9962
|
-
|
|
9963
|
-
|
|
9964
|
-
|
|
9965
|
-
|
|
9966
|
-
|
|
9967
|
-
onGatewayDebug,
|
|
9968
|
-
clearReadyWatch,
|
|
9969
|
-
registerForceStop: (handler) => {
|
|
9970
|
-
forceStopHandler = handler;
|
|
9971
|
-
if (queuedForceStopError !== void 0) {
|
|
9972
|
-
const err = queuedForceStopError;
|
|
9973
|
-
queuedForceStopError = void 0;
|
|
9974
|
-
handler(err);
|
|
9975
|
-
}
|
|
9976
|
-
},
|
|
9977
|
-
dispose: () => {
|
|
9978
|
-
clearReadyWatch();
|
|
9979
|
-
forceStopHandler = void 0;
|
|
9980
|
-
queuedForceStopError = void 0;
|
|
9981
|
-
}
|
|
9982
|
-
};
|
|
9983
|
-
}
|
|
9984
|
-
async function waitForGatewayReady(params) {
|
|
9985
|
-
const waitUntilReady = async () => {
|
|
9986
|
-
const deadlineAt = Date.now() + params.readyTimeoutMs;
|
|
9987
|
-
while (!params.abortSignal?.aborted) {
|
|
9988
|
-
if (await params.beforePoll?.() === "stop") return "stopped";
|
|
9989
|
-
if (params.gateway?.isConnected === true) {
|
|
9990
|
-
const at = Date.now();
|
|
9991
|
-
params.pushStatus?.({
|
|
9992
|
-
...createConnectedChannelStatusPatch(at),
|
|
9993
|
-
lastDisconnect: null,
|
|
9994
|
-
lastError: null
|
|
10206
|
+
const decisionLabel = parsed.action === "allow-once" ? "Allowed (once)" : parsed.action === "allow-always" ? "Allowed (always)" : "Denied";
|
|
10207
|
+
try {
|
|
10208
|
+
await interaction.acknowledge();
|
|
10209
|
+
} catch {}
|
|
10210
|
+
const result = await this.ctx.resolveApproval(parsed.approvalId, parsed.approvalKind, parsed.action);
|
|
10211
|
+
if (!result.ok) {
|
|
10212
|
+
try {
|
|
10213
|
+
await interaction.followUp({
|
|
10214
|
+
content: result.reason === "not-found" ? `That approval request is no longer pending. It may have expired or already been resolved.` : `Failed to submit approval decision for **${decisionLabel}**. The request may have expired or already been resolved.`,
|
|
10215
|
+
ephemeral: true
|
|
9995
10216
|
});
|
|
9996
|
-
|
|
9997
|
-
|
|
9998
|
-
|
|
9999
|
-
|
|
10000
|
-
|
|
10001
|
-
|
|
10217
|
+
} catch {}
|
|
10218
|
+
return;
|
|
10219
|
+
}
|
|
10220
|
+
const terminalLabel = resolveTerminalLabel(result.resolution.approval);
|
|
10221
|
+
let terminalized = false;
|
|
10222
|
+
try {
|
|
10223
|
+
await interaction.editReply(buildTerminalPayload({
|
|
10224
|
+
approval: result.resolution.approval,
|
|
10225
|
+
applied: result.resolution.applied
|
|
10226
|
+
}));
|
|
10227
|
+
terminalized = true;
|
|
10228
|
+
} catch {}
|
|
10229
|
+
if (!terminalized || !result.resolution.applied) try {
|
|
10230
|
+
await interaction.followUp({
|
|
10231
|
+
content: result.resolution.applied ? `Approval resolved: ${terminalLabel}.` : `This approval was already resolved: ${terminalLabel}.`,
|
|
10232
|
+
ephemeral: true
|
|
10233
|
+
});
|
|
10234
|
+
} catch {}
|
|
10235
|
+
}
|
|
10236
|
+
};
|
|
10237
|
+
function createExecApprovalButton(ctx) {
|
|
10238
|
+
return new ExecApprovalButton(ctx);
|
|
10239
|
+
}
|
|
10240
|
+
function createDiscordExecApprovalButtonContext(params) {
|
|
10241
|
+
return {
|
|
10242
|
+
getApprovers: () => getDiscordExecApprovalApprovers({
|
|
10243
|
+
cfg: params.cfg,
|
|
10244
|
+
accountId: params.accountId,
|
|
10245
|
+
configOverride: params.config
|
|
10246
|
+
}),
|
|
10247
|
+
resolveApproval: async (approvalId, approvalKind, decision) => {
|
|
10248
|
+
try {
|
|
10249
|
+
return {
|
|
10250
|
+
ok: true,
|
|
10251
|
+
resolution: await resolveApprovalOverGateway({
|
|
10252
|
+
cfg: params.cfg,
|
|
10253
|
+
approvalId,
|
|
10254
|
+
approvalKind,
|
|
10255
|
+
decision,
|
|
10256
|
+
gatewayUrl: params.gatewayUrl,
|
|
10257
|
+
clientDisplayName: `Discord approval (${params.accountId})`
|
|
10258
|
+
})
|
|
10259
|
+
};
|
|
10260
|
+
} catch (err) {
|
|
10261
|
+
return {
|
|
10262
|
+
ok: false,
|
|
10263
|
+
reason: isStructuredApprovalNotFoundError(err) ? "not-found" : "error"
|
|
10264
|
+
};
|
|
10265
|
+
}
|
|
10002
10266
|
}
|
|
10003
|
-
return "stopped";
|
|
10004
|
-
};
|
|
10005
|
-
if (!params.gateway) {
|
|
10006
|
-
if (await waitUntilReady() === "timeout") throw new Error(`discord gateway did not reach READY within ${params.readyTimeoutMs}ms`);
|
|
10007
|
-
return;
|
|
10008
|
-
}
|
|
10009
|
-
let attempt = 0;
|
|
10010
|
-
while (!params.abortSignal?.aborted) {
|
|
10011
|
-
if (await waitUntilReady() !== "timeout") return;
|
|
10012
|
-
attempt += 1;
|
|
10013
|
-
const restartAt = Date.now();
|
|
10014
|
-
params.runtime.error?.(danger(`discord: gateway READY wait timed out after ${params.readyTimeoutMs}ms; reconnecting with backoff (attempt ${attempt})`));
|
|
10015
|
-
params.pushStatus?.({
|
|
10016
|
-
connected: false,
|
|
10017
|
-
lastEventAt: restartAt,
|
|
10018
|
-
lastDisconnect: {
|
|
10019
|
-
at: restartAt,
|
|
10020
|
-
error: "startup-not-ready"
|
|
10021
|
-
},
|
|
10022
|
-
lastError: "startup-not-ready"
|
|
10023
|
-
});
|
|
10024
|
-
await params.beforeRestart?.();
|
|
10025
|
-
await restartGatewayAfterReadyTimeout({
|
|
10026
|
-
gateway: params.gateway,
|
|
10027
|
-
abortSignal: params.abortSignal,
|
|
10028
|
-
runtime: params.runtime
|
|
10029
|
-
});
|
|
10030
|
-
if (params.abortSignal?.aborted) return;
|
|
10031
|
-
await new Promise((resolve) => {
|
|
10032
|
-
setTimeout(resolve, DISCORD_GATEWAY_READY_RETRY_BACKOFF_MS).unref?.();
|
|
10033
|
-
});
|
|
10034
|
-
}
|
|
10035
|
-
}
|
|
10036
|
-
async function runDiscordGatewayLifecycle(params) {
|
|
10037
|
-
const gateway = params.gateway;
|
|
10038
|
-
const gatewayReadyAtLifecycleStart = gateway?.isConnected === true;
|
|
10039
|
-
if (gateway) registerGateway(params.accountId, gateway);
|
|
10040
|
-
const gatewayEmitter = params.gatewaySupervisor.emitter ?? getDiscordGatewayEmitter(gateway);
|
|
10041
|
-
const stopGatewayLogging = attachDiscordGatewayLogging({
|
|
10042
|
-
emitter: gatewayEmitter,
|
|
10043
|
-
runtime: params.runtime
|
|
10044
|
-
});
|
|
10045
|
-
let lifecycleStopping = false;
|
|
10046
|
-
const pushStatus = (patch) => {
|
|
10047
|
-
params.statusSink?.(patch);
|
|
10048
|
-
};
|
|
10049
|
-
const gatewayReadyTimeoutMs = resolveDiscordGatewayReadyTimeoutMs({
|
|
10050
|
-
configuredTimeoutMs: params.gatewayReadyTimeoutMs,
|
|
10051
|
-
env: process.env
|
|
10052
|
-
});
|
|
10053
|
-
const gatewayRuntimeReadyTimeoutMs = resolveDiscordGatewayRuntimeReadyTimeoutMs({
|
|
10054
|
-
configuredTimeoutMs: params.gatewayRuntimeReadyTimeoutMs,
|
|
10055
|
-
env: process.env
|
|
10056
|
-
});
|
|
10057
|
-
const statusObserver = createGatewayStatusObserver({
|
|
10058
|
-
gateway,
|
|
10059
|
-
abortSignal: params.abortSignal,
|
|
10060
|
-
runtime: params.runtime,
|
|
10061
|
-
pushStatus,
|
|
10062
|
-
isLifecycleStopping: () => lifecycleStopping,
|
|
10063
|
-
runtimeReadyTimeoutMs: gatewayRuntimeReadyTimeoutMs
|
|
10064
|
-
});
|
|
10065
|
-
gatewayEmitter?.on("debug", statusObserver.onGatewayDebug);
|
|
10066
|
-
let lastTransportActivityStatusAt;
|
|
10067
|
-
const onGatewayTransportActivity = (event) => {
|
|
10068
|
-
if (lifecycleStopping || params.abortSignal?.aborted) return;
|
|
10069
|
-
const at = resolveTransportActivityAt(event);
|
|
10070
|
-
if (lastTransportActivityStatusAt !== void 0 && at - lastTransportActivityStatusAt < DISCORD_GATEWAY_TRANSPORT_ACTIVITY_STATUS_MIN_INTERVAL_MS) return;
|
|
10071
|
-
lastTransportActivityStatusAt = at;
|
|
10072
|
-
pushStatus(createTransportActivityStatusPatch(at));
|
|
10073
10267
|
};
|
|
10074
|
-
|
|
10075
|
-
|
|
10076
|
-
|
|
10077
|
-
|
|
10078
|
-
|
|
10079
|
-
|
|
10080
|
-
|
|
10268
|
+
}
|
|
10269
|
+
//#endregion
|
|
10270
|
+
//#region extensions/discord/src/monitor/questions.ts
|
|
10271
|
+
var QuestionButton = class extends Button {
|
|
10272
|
+
constructor(ctx) {
|
|
10273
|
+
super();
|
|
10274
|
+
this.ctx = ctx;
|
|
10275
|
+
this.label = "question";
|
|
10276
|
+
this.customId = "ocq:id=seed;i=0";
|
|
10277
|
+
this.style = ButtonStyle.Primary;
|
|
10278
|
+
}
|
|
10279
|
+
async run(interaction, data) {
|
|
10280
|
+
const callback = parseDiscordQuestionData(data);
|
|
10281
|
+
if (!callback) {
|
|
10282
|
+
await interaction.reply({
|
|
10283
|
+
content: "This question is no longer valid.",
|
|
10284
|
+
ephemeral: true
|
|
10285
|
+
});
|
|
10286
|
+
return;
|
|
10081
10287
|
}
|
|
10082
|
-
if (
|
|
10083
|
-
|
|
10084
|
-
|
|
10085
|
-
|
|
10086
|
-
|
|
10288
|
+
if (!await this.ctx.authorizeQuestion(interaction)) return;
|
|
10289
|
+
try {
|
|
10290
|
+
await interaction.acknowledge();
|
|
10291
|
+
} catch {}
|
|
10292
|
+
let result;
|
|
10293
|
+
try {
|
|
10294
|
+
result = await this.ctx.resolveQuestion({
|
|
10295
|
+
cfg: this.ctx.cfg,
|
|
10296
|
+
questionId: callback.questionId,
|
|
10297
|
+
optionIndex: callback.optionIndex,
|
|
10298
|
+
senderId: interaction.userId,
|
|
10299
|
+
clientDisplayName: `Discord question (${this.ctx.accountId})`
|
|
10300
|
+
});
|
|
10301
|
+
} catch {
|
|
10302
|
+
try {
|
|
10303
|
+
await interaction.followUp({
|
|
10304
|
+
content: "Could not submit this answer.",
|
|
10305
|
+
ephemeral: true
|
|
10306
|
+
});
|
|
10307
|
+
} catch {}
|
|
10308
|
+
return;
|
|
10087
10309
|
}
|
|
10088
|
-
|
|
10089
|
-
|
|
10090
|
-
|
|
10310
|
+
try {
|
|
10311
|
+
await interaction.followUp({
|
|
10312
|
+
content: result.status === "answered" ? "Answer submitted." : "This question was already answered.",
|
|
10313
|
+
ephemeral: true
|
|
10314
|
+
});
|
|
10315
|
+
} catch {}
|
|
10316
|
+
}
|
|
10317
|
+
};
|
|
10318
|
+
function createDiscordQuestionButton(params) {
|
|
10319
|
+
const authContext = params.authContext ?? {
|
|
10320
|
+
cfg: params.cfg,
|
|
10321
|
+
accountId: params.accountId
|
|
10091
10322
|
};
|
|
10092
|
-
|
|
10093
|
-
|
|
10094
|
-
|
|
10095
|
-
|
|
10323
|
+
return new QuestionButton({
|
|
10324
|
+
cfg: params.cfg,
|
|
10325
|
+
accountId: params.accountId,
|
|
10326
|
+
resolveQuestion: params.resolveQuestion ?? questionGatewayRuntime.resolveOption,
|
|
10327
|
+
authorizeQuestion: params.authorizeQuestion ?? (async (interaction) => Boolean(await resolveAuthorizedComponentInteraction({
|
|
10328
|
+
ctx: authContext,
|
|
10329
|
+
interaction,
|
|
10330
|
+
label: "discord question",
|
|
10331
|
+
componentLabel: "button",
|
|
10332
|
+
unauthorizedReply: "You are not authorized to answer this question.",
|
|
10333
|
+
defer: false
|
|
10334
|
+
})))
|
|
10096
10335
|
});
|
|
10097
|
-
|
|
10098
|
-
|
|
10099
|
-
|
|
10100
|
-
|
|
10101
|
-
|
|
10102
|
-
|
|
10103
|
-
|
|
10104
|
-
|
|
10105
|
-
|
|
10106
|
-
|
|
10107
|
-
|
|
10108
|
-
|
|
10109
|
-
|
|
10110
|
-
|
|
10111
|
-
|
|
10112
|
-
|
|
10113
|
-
|
|
10114
|
-
|
|
10115
|
-
|
|
10116
|
-
|
|
10117
|
-
|
|
10118
|
-
|
|
10119
|
-
}
|
|
10120
|
-
|
|
10121
|
-
|
|
10122
|
-
|
|
10123
|
-
|
|
10124
|
-
|
|
10125
|
-
|
|
10126
|
-
|
|
10127
|
-
|
|
10128
|
-
|
|
10129
|
-
|
|
10130
|
-
|
|
10336
|
+
}
|
|
10337
|
+
//#endregion
|
|
10338
|
+
//#region extensions/discord/src/monitor/provider.interactions.ts
|
|
10339
|
+
function createDiscordProviderInteractionSurface(params) {
|
|
10340
|
+
const createNativeCommand = params.createNativeCommand ?? createDiscordNativeCommand;
|
|
10341
|
+
const commands = params.commandSpecs.map((spec) => createNativeCommand({
|
|
10342
|
+
command: spec,
|
|
10343
|
+
cfg: params.cfg,
|
|
10344
|
+
discordConfig: params.discordConfig,
|
|
10345
|
+
accountId: params.accountId,
|
|
10346
|
+
sessionPrefix: params.sessionPrefix,
|
|
10347
|
+
ephemeralDefault: params.ephemeralDefault,
|
|
10348
|
+
threadBindings: params.threadBindings
|
|
10349
|
+
}));
|
|
10350
|
+
if (params.nativeEnabled && params.voiceEnabled) commands.push(createDiscordVoiceCommand({
|
|
10351
|
+
cfg: params.cfg,
|
|
10352
|
+
discordConfig: params.discordConfig,
|
|
10353
|
+
accountId: params.accountId,
|
|
10354
|
+
groupPolicy: params.groupPolicy,
|
|
10355
|
+
useAccessGroups: params.useAccessGroups,
|
|
10356
|
+
getManager: () => params.voiceManagerRef.current,
|
|
10357
|
+
ephemeralDefault: params.ephemeralDefault
|
|
10358
|
+
}));
|
|
10359
|
+
const execApprovalsConfig = params.discordConfig.execApprovals ?? {};
|
|
10360
|
+
const execApprovalsEnabled = isDiscordExecApprovalClientEnabled({
|
|
10361
|
+
cfg: params.cfg,
|
|
10362
|
+
accountId: params.accountId,
|
|
10363
|
+
configOverride: execApprovalsConfig
|
|
10364
|
+
});
|
|
10365
|
+
const approvalActionsEnabled = getDiscordExecApprovalApprovers({
|
|
10366
|
+
cfg: params.cfg,
|
|
10367
|
+
accountId: params.accountId,
|
|
10368
|
+
configOverride: execApprovalsConfig
|
|
10369
|
+
}).length > 0;
|
|
10370
|
+
if (execApprovalsEnabled) registerChannelRuntimeContext({
|
|
10371
|
+
channelRuntime: params.channelRuntime,
|
|
10372
|
+
channelId: "discord",
|
|
10373
|
+
accountId: params.accountId,
|
|
10374
|
+
capability: CHANNEL_APPROVAL_NATIVE_RUNTIME_CONTEXT_CAPABILITY,
|
|
10375
|
+
context: {
|
|
10376
|
+
token: params.token,
|
|
10377
|
+
config: execApprovalsConfig
|
|
10378
|
+
},
|
|
10379
|
+
abortSignal: params.abortSignal
|
|
10380
|
+
});
|
|
10381
|
+
const components = [
|
|
10382
|
+
createDiscordQuestionButton({
|
|
10383
|
+
cfg: params.cfg,
|
|
10384
|
+
accountId: params.accountId,
|
|
10385
|
+
authContext: {
|
|
10386
|
+
cfg: params.cfg,
|
|
10131
10387
|
accountId: params.accountId,
|
|
10132
|
-
|
|
10133
|
-
|
|
10134
|
-
|
|
10135
|
-
|
|
10136
|
-
|
|
10388
|
+
discordConfig: params.discordConfig,
|
|
10389
|
+
runtime: params.runtime,
|
|
10390
|
+
token: params.token,
|
|
10391
|
+
guildEntries: params.guildEntries,
|
|
10392
|
+
allowFrom: params.allowFrom,
|
|
10393
|
+
dmPolicy: params.dmPolicy
|
|
10394
|
+
}
|
|
10395
|
+
}),
|
|
10396
|
+
createDiscordCommandArgFallbackButton({
|
|
10397
|
+
cfg: params.cfg,
|
|
10398
|
+
discordConfig: params.discordConfig,
|
|
10399
|
+
accountId: params.accountId,
|
|
10400
|
+
sessionPrefix: params.sessionPrefix,
|
|
10401
|
+
threadBindings: params.threadBindings
|
|
10402
|
+
}),
|
|
10403
|
+
createDiscordModelPickerFallbackButton({
|
|
10404
|
+
cfg: params.cfg,
|
|
10405
|
+
discordConfig: params.discordConfig,
|
|
10406
|
+
accountId: params.accountId,
|
|
10407
|
+
sessionPrefix: params.sessionPrefix,
|
|
10408
|
+
threadBindings: params.threadBindings
|
|
10409
|
+
}),
|
|
10410
|
+
createDiscordModelPickerFallbackSelect({
|
|
10411
|
+
cfg: params.cfg,
|
|
10412
|
+
discordConfig: params.discordConfig,
|
|
10413
|
+
accountId: params.accountId,
|
|
10414
|
+
sessionPrefix: params.sessionPrefix,
|
|
10415
|
+
threadBindings: params.threadBindings
|
|
10416
|
+
})
|
|
10417
|
+
];
|
|
10418
|
+
const activityButton = createDiscordActivityButton({
|
|
10419
|
+
cfg: params.cfg,
|
|
10420
|
+
discordConfig: params.discordConfig,
|
|
10421
|
+
accountId: params.accountId,
|
|
10422
|
+
guildEntries: params.guildEntries,
|
|
10423
|
+
allowFrom: params.allowFrom,
|
|
10424
|
+
dmPolicy: params.dmPolicy,
|
|
10425
|
+
runtime: params.runtime,
|
|
10426
|
+
token: params.token
|
|
10427
|
+
}, params.applicationId);
|
|
10428
|
+
if (activityButton) components.push(activityButton);
|
|
10429
|
+
const modals = [];
|
|
10430
|
+
if (approvalActionsEnabled) components.push(createExecApprovalButton(createDiscordExecApprovalButtonContext({
|
|
10431
|
+
cfg: params.cfg,
|
|
10432
|
+
accountId: params.accountId,
|
|
10433
|
+
config: execApprovalsConfig
|
|
10434
|
+
})));
|
|
10435
|
+
if ((params.discordConfig.agentComponents ?? {}).enabled ?? true) {
|
|
10436
|
+
const componentContext = {
|
|
10437
|
+
cfg: params.cfg,
|
|
10438
|
+
discordConfig: params.discordConfig,
|
|
10439
|
+
accountId: params.accountId,
|
|
10440
|
+
guildEntries: params.guildEntries,
|
|
10441
|
+
allowFrom: params.allowFrom,
|
|
10442
|
+
dmPolicy: params.dmPolicy,
|
|
10443
|
+
runtime: params.runtime,
|
|
10444
|
+
token: params.token
|
|
10445
|
+
};
|
|
10446
|
+
components.push(...createAgentComponentControls.map((create) => create(componentContext)));
|
|
10447
|
+
components.push(...createDiscordComponentControls.map((create) => create(componentContext)));
|
|
10448
|
+
modals.push(createDiscordComponentModal(componentContext));
|
|
10137
10449
|
}
|
|
10450
|
+
return {
|
|
10451
|
+
commands,
|
|
10452
|
+
components,
|
|
10453
|
+
modals
|
|
10454
|
+
};
|
|
10138
10455
|
}
|
|
10139
10456
|
//#endregion
|
|
10140
10457
|
//#region extensions/discord/src/internal/voice.ts
|
|
@@ -10224,7 +10541,7 @@ async function createDiscordMonitorClient(params) {
|
|
|
10224
10541
|
publicKey: "a",
|
|
10225
10542
|
token: params.token,
|
|
10226
10543
|
autoDeploy: false,
|
|
10227
|
-
|
|
10544
|
+
commandDeployHashStore: params.commandDeployHashStore,
|
|
10228
10545
|
requestOptions: {
|
|
10229
10546
|
timeout: DISCORD_REST_TIMEOUT_MS,
|
|
10230
10547
|
runtimeProfile: "persistent",
|
|
@@ -10401,35 +10718,12 @@ function formatDiscordStartupStatusMessage(params) {
|
|
|
10401
10718
|
//#endregion
|
|
10402
10719
|
//#region extensions/discord/src/monitor/provider.ts
|
|
10403
10720
|
const DEFAULT_DISCORD_MEDIA_MAX_MB = 100;
|
|
10404
|
-
let discordVoiceRuntimePromise;
|
|
10405
|
-
let discordProviderSessionRuntimePromise;
|
|
10406
|
-
let getPluginCommandSpecsForTesting;
|
|
10407
10721
|
function logDiscordStartupPhase(params) {
|
|
10408
10722
|
logDiscordStartupPhase$1({
|
|
10409
10723
|
...params,
|
|
10410
|
-
isVerbose
|
|
10724
|
+
isVerbose: discordProviderRuntime.isVerbose
|
|
10411
10725
|
});
|
|
10412
10726
|
}
|
|
10413
|
-
async function loadDiscordVoiceRuntime() {
|
|
10414
|
-
const promise = discordVoiceRuntimePromise ?? import("./manager.runtime-3RVMVkyx.js");
|
|
10415
|
-
discordVoiceRuntimePromise = promise;
|
|
10416
|
-
try {
|
|
10417
|
-
return await promise;
|
|
10418
|
-
} catch (error) {
|
|
10419
|
-
if (discordVoiceRuntimePromise === promise) discordVoiceRuntimePromise = void 0;
|
|
10420
|
-
throw error;
|
|
10421
|
-
}
|
|
10422
|
-
}
|
|
10423
|
-
async function loadDiscordProviderSessionRuntime() {
|
|
10424
|
-
const promise = discordProviderSessionRuntimePromise ?? import("./provider-session.runtime-D5pCGibh.js");
|
|
10425
|
-
discordProviderSessionRuntimePromise = promise;
|
|
10426
|
-
try {
|
|
10427
|
-
return await promise;
|
|
10428
|
-
} catch (error) {
|
|
10429
|
-
if (discordProviderSessionRuntimePromise === promise) discordProviderSessionRuntimePromise = void 0;
|
|
10430
|
-
throw error;
|
|
10431
|
-
}
|
|
10432
|
-
}
|
|
10433
10727
|
const DISCORD_DISALLOWED_INTENTS_CODE = GatewayCloseCodes$1.DisallowedIntents;
|
|
10434
10728
|
function isDiscordDisallowedIntentsError(err) {
|
|
10435
10729
|
if (!err) return false;
|
|
@@ -10438,7 +10732,7 @@ function isDiscordDisallowedIntentsError(err) {
|
|
|
10438
10732
|
async function monitorDiscordProvider(opts = {}) {
|
|
10439
10733
|
const startupStartedAt = Date.now();
|
|
10440
10734
|
const cfg = opts.config ?? getRuntimeConfig();
|
|
10441
|
-
const account = resolveDiscordAccount({
|
|
10735
|
+
const account = discordProviderRuntime.resolveDiscordAccount({
|
|
10442
10736
|
cfg,
|
|
10443
10737
|
accountId: opts.accountId
|
|
10444
10738
|
});
|
|
@@ -10482,7 +10776,7 @@ async function monitorDiscordProvider(opts = {}) {
|
|
|
10482
10776
|
cfg,
|
|
10483
10777
|
accountId: account.accountId
|
|
10484
10778
|
}) ?? "pairing";
|
|
10485
|
-
const discordProviderSessionRuntime = await loadDiscordProviderSessionRuntime();
|
|
10779
|
+
const discordProviderSessionRuntime = await discordProviderRuntime.loadDiscordProviderSessionRuntime();
|
|
10486
10780
|
const threadBindingIdleTimeoutMs = discordProviderSessionRuntime.resolveThreadBindingIdleTimeoutMs({
|
|
10487
10781
|
channelIdleHoursRaw: discordAccountThreadBindings?.idleHours ?? discordRootThreadBindings?.idleHours,
|
|
10488
10782
|
sessionIdleHoursRaw: cfg.session?.threadBindings?.idleHours
|
|
@@ -10497,12 +10791,12 @@ async function monitorDiscordProvider(opts = {}) {
|
|
|
10497
10791
|
});
|
|
10498
10792
|
const groupDmEnabled = dmConfig?.groupEnabled ?? false;
|
|
10499
10793
|
const groupDmChannels = dmConfig?.groupChannels;
|
|
10500
|
-
const nativeEnabled = resolveNativeCommandsEnabled({
|
|
10794
|
+
const nativeEnabled = discordProviderRuntime.resolveNativeCommandsEnabled({
|
|
10501
10795
|
providerId: "discord",
|
|
10502
10796
|
providerSetting: discordCfg.commands?.native,
|
|
10503
10797
|
globalSetting: cfg.commands?.native
|
|
10504
10798
|
});
|
|
10505
|
-
const nativeSkillsEnabled = resolveNativeSkillsEnabled({
|
|
10799
|
+
const nativeSkillsEnabled = discordProviderRuntime.resolveNativeSkillsEnabled({
|
|
10506
10800
|
providerId: "discord",
|
|
10507
10801
|
providerSetting: discordCfg.commands?.nativeSkills,
|
|
10508
10802
|
globalSetting: cfg.commands?.nativeSkills
|
|
@@ -10522,7 +10816,7 @@ async function monitorDiscordProvider(opts = {}) {
|
|
|
10522
10816
|
});
|
|
10523
10817
|
guildEntries = allowlistResolved.guildEntries;
|
|
10524
10818
|
allowFrom = allowlistResolved.allowFrom ?? [];
|
|
10525
|
-
if (shouldLogVerbose()) logDiscordResolvedConfig({
|
|
10819
|
+
if (discordProviderRuntime.shouldLogVerbose()) logDiscordResolvedConfig({
|
|
10526
10820
|
dmEnabled,
|
|
10527
10821
|
dmPolicy,
|
|
10528
10822
|
allowFrom,
|
|
@@ -10545,7 +10839,7 @@ async function monitorDiscordProvider(opts = {}) {
|
|
|
10545
10839
|
phase: "fetch-application-id:start",
|
|
10546
10840
|
startAt: startupStartedAt
|
|
10547
10841
|
});
|
|
10548
|
-
const applicationId = (typeof discordCfg.applicationId === "string" && discordCfg.applicationId.trim() ? discordCfg.applicationId.trim() : void 0) ?? parseApplicationIdFromToken(token) ?? await fetchDiscordApplicationId(token, 4e3, discordRestFetch);
|
|
10842
|
+
const applicationId = (typeof discordCfg.applicationId === "string" && discordCfg.applicationId.trim() ? discordCfg.applicationId.trim() : void 0) ?? parseApplicationIdFromToken(token) ?? await discordProviderRuntime.fetchDiscordApplicationId(token, 4e3, discordRestFetch);
|
|
10549
10843
|
if (!applicationId) throw new Error("Failed to resolve Discord application id");
|
|
10550
10844
|
logDiscordStartupPhase({
|
|
10551
10845
|
runtime,
|
|
@@ -10559,9 +10853,9 @@ async function monitorDiscordProvider(opts = {}) {
|
|
|
10559
10853
|
runtime,
|
|
10560
10854
|
nativeEnabled,
|
|
10561
10855
|
nativeSkillsEnabled,
|
|
10562
|
-
listSkillCommandsForAgents,
|
|
10563
|
-
listNativeCommandSpecsForConfig,
|
|
10564
|
-
getPluginCommandSpecs:
|
|
10856
|
+
listSkillCommandsForAgents: discordProviderRuntime.listSkillCommandsForAgents,
|
|
10857
|
+
listNativeCommandSpecsForConfig: discordProviderRuntime.listNativeCommandSpecsForConfig,
|
|
10858
|
+
getPluginCommandSpecs: discordProviderRuntime.getPluginCommandSpecs
|
|
10565
10859
|
});
|
|
10566
10860
|
const voiceManagerRef = { current: null };
|
|
10567
10861
|
const threadBindings = threadBindingsEnabled ? discordProviderSessionRuntime.createThreadBindingManager({
|
|
@@ -10605,6 +10899,7 @@ async function monitorDiscordProvider(opts = {}) {
|
|
|
10605
10899
|
cfg,
|
|
10606
10900
|
discordConfig: discordCfg,
|
|
10607
10901
|
accountId: account.accountId,
|
|
10902
|
+
applicationId,
|
|
10608
10903
|
token,
|
|
10609
10904
|
commandSpecs,
|
|
10610
10905
|
nativeEnabled,
|
|
@@ -10621,7 +10916,7 @@ async function monitorDiscordProvider(opts = {}) {
|
|
|
10621
10916
|
runtime,
|
|
10622
10917
|
channelRuntime: opts.channelRuntime,
|
|
10623
10918
|
abortSignal: opts.abortSignal,
|
|
10624
|
-
createNativeCommand: createDiscordNativeCommand
|
|
10919
|
+
createNativeCommand: discordProviderRuntime.createDiscordNativeCommand
|
|
10625
10920
|
});
|
|
10626
10921
|
const { client, gateway, gatewaySupervisor: createdGatewaySupervisor, autoPresenceController: createdAutoPresenceController } = await createDiscordMonitorClient({
|
|
10627
10922
|
accountId: account.accountId,
|
|
@@ -10634,7 +10929,8 @@ async function monitorDiscordProvider(opts = {}) {
|
|
|
10634
10929
|
voiceEnabled,
|
|
10635
10930
|
discordConfig: discordCfg,
|
|
10636
10931
|
runtime,
|
|
10637
|
-
|
|
10932
|
+
commandDeployHashStore: opts.commandDeployHashStore,
|
|
10933
|
+
createClient: discordProviderRuntime.createClient,
|
|
10638
10934
|
createGatewayPlugin: createDiscordGatewayPlugin,
|
|
10639
10935
|
createGatewaySupervisor: createDiscordGatewaySupervisor,
|
|
10640
10936
|
createAutoPresenceController: createDiscordAutoPresenceController,
|
|
@@ -10645,7 +10941,7 @@ async function monitorDiscordProvider(opts = {}) {
|
|
|
10645
10941
|
autoPresenceController = createdAutoPresenceController;
|
|
10646
10942
|
earlyGatewayEmitter = gatewaySupervisor.emitter;
|
|
10647
10943
|
onEarlyGatewayDebug = (msg) => {
|
|
10648
|
-
if (!isVerbose()) return;
|
|
10944
|
+
if (!discordProviderRuntime.isVerbose()) return;
|
|
10649
10945
|
runtime.log?.(`discord startup [${account.accountId}] gateway-debug ${Math.max(0, Date.now() - startupStartedAt)}ms ${String(msg)}`);
|
|
10650
10946
|
};
|
|
10651
10947
|
earlyGatewayEmitter?.on("debug", onEarlyGatewayDebug);
|
|
@@ -10663,8 +10959,8 @@ async function monitorDiscordProvider(opts = {}) {
|
|
|
10663
10959
|
enabled: nativeEnabled,
|
|
10664
10960
|
accountId: account.accountId,
|
|
10665
10961
|
startupStartedAt,
|
|
10666
|
-
shouldLogVerbose,
|
|
10667
|
-
isVerbose
|
|
10962
|
+
shouldLogVerbose: discordProviderRuntime.shouldLogVerbose,
|
|
10963
|
+
isVerbose: discordProviderRuntime.isVerbose
|
|
10668
10964
|
});
|
|
10669
10965
|
const logger = createSubsystemLogger("discord/monitor");
|
|
10670
10966
|
const guildHistories = /* @__PURE__ */ new Map();
|
|
@@ -10683,7 +10979,7 @@ async function monitorDiscordProvider(opts = {}) {
|
|
|
10683
10979
|
});
|
|
10684
10980
|
let voiceManager = null;
|
|
10685
10981
|
if (voiceEnabled) {
|
|
10686
|
-
const { DiscordVoiceGuildCreateListener, DiscordVoiceManager, DiscordVoiceReadyListener, DiscordVoiceResumedListener, DiscordVoiceStateUpdateListener } = await loadDiscordVoiceRuntime();
|
|
10982
|
+
const { DiscordVoiceGuildCreateListener, DiscordVoiceManager, DiscordVoiceReadyListener, DiscordVoiceResumedListener, DiscordVoiceStateUpdateListener } = await discordProviderRuntime.loadDiscordVoiceRuntime();
|
|
10687
10983
|
voiceManager = new DiscordVoiceManager({
|
|
10688
10984
|
client,
|
|
10689
10985
|
cfg,
|
|
@@ -10692,7 +10988,7 @@ async function monitorDiscordProvider(opts = {}) {
|
|
|
10692
10988
|
runtime,
|
|
10693
10989
|
botUserId
|
|
10694
10990
|
});
|
|
10695
|
-
const { setDiscordTranscriptsVoiceManager } = await import("./transcripts-source-
|
|
10991
|
+
const { setDiscordTranscriptsVoiceManager } = await import("./transcripts-source-DjDbt14x.js").then((n) => n.n);
|
|
10696
10992
|
setDiscordTranscriptsVoiceManager({
|
|
10697
10993
|
accountId: account.accountId,
|
|
10698
10994
|
manager: voiceManager
|
|
@@ -10704,6 +11000,7 @@ async function monitorDiscordProvider(opts = {}) {
|
|
|
10704
11000
|
registerDiscordListener(client.listeners, new DiscordVoiceStateUpdateListener(voiceManager));
|
|
10705
11001
|
}
|
|
10706
11002
|
const messageHandler = discordProviderSessionRuntime.createDiscordMessageHandler({
|
|
11003
|
+
client,
|
|
10707
11004
|
cfg,
|
|
10708
11005
|
discordConfig: discordCfg,
|
|
10709
11006
|
accountId: account.accountId,
|
|
@@ -10768,7 +11065,7 @@ async function monitorDiscordProvider(opts = {}) {
|
|
|
10768
11065
|
lifecycleStarted = true;
|
|
10769
11066
|
earlyGatewayEmitter?.removeListener("debug", onEarlyGatewayDebug);
|
|
10770
11067
|
onEarlyGatewayDebug = void 0;
|
|
10771
|
-
await runDiscordGatewayLifecycle({
|
|
11068
|
+
await discordProviderRuntime.runDiscordGatewayLifecycle({
|
|
10772
11069
|
accountId: account.accountId,
|
|
10773
11070
|
gateway: lifecycleGateway,
|
|
10774
11071
|
runtime,
|
|
@@ -10783,7 +11080,7 @@ async function monitorDiscordProvider(opts = {}) {
|
|
|
10783
11080
|
gatewayRuntimeReadyTimeoutMs: account.config.gatewayRuntimeReadyTimeoutMs
|
|
10784
11081
|
});
|
|
10785
11082
|
} finally {
|
|
10786
|
-
cleanupDiscordProviderStartup({
|
|
11083
|
+
await cleanupDiscordProviderStartup({
|
|
10787
11084
|
deactivateMessageHandler,
|
|
10788
11085
|
autoPresenceController,
|
|
10789
11086
|
setStatus: opts.setStatus,
|
|
@@ -10798,4 +11095,4 @@ async function monitorDiscordProvider(opts = {}) {
|
|
|
10798
11095
|
}
|
|
10799
11096
|
}
|
|
10800
11097
|
//#endregion
|
|
10801
|
-
export {
|
|
11098
|
+
export { resolveDiscordDmCommandAccess as A, mapGatewayDispatchData as C, resolveDiscordReplyTarget as D, resolveDiscordAutoThreadReplyPlan as E, resolveDiscordThreadStarter as O, handleDiscordDmCommandDecision as S, threading_exports as T, createDiscordSupplementalContextAccessChecker as _, buildDirectLabel as a, resolveDiscordEffectiveRoute as b, resolveDiscordVoiceAccess as c, resolveDiscordGatewayIntents as d, waitForDiscordGatewayPluginRegistration as f, buildDiscordInboundAccessContext as g, buildDiscordGroupSystemPrompt as h, sanitizeDiscordFrontChannelReplyPayloads as i, resolveDiscordTextCommandAccess as j, sanitizeDiscordThreadName as k, authorizeDiscordVoiceIngress as l, createDiscordNativeCommand as m, deliverDiscordReply as n, buildGuildLabel as o, resolveDiscordVoiceEnabled as p, formatDiscordReplyDeliveryFailure as r, resolveReplyContext as s, monitorDiscordProvider as t, createDiscordGatewayPlugin as u, buildDiscordRoutePeer as v, registerDiscordListener as w, shouldIgnoreStaleDiscordRouteBinding as x, resolveDiscordConversationRoute as y };
|