@openclaw/discord 2026.10.2 → 2026.10.5-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.setup/account-inspect-8cCu6uPG.mjs +31 -0
- package/dist/.setup/{accounts-HE9-mj1L.mjs → accounts-ljrzXBJi.mjs} +47 -45
- package/dist/.setup/{allow-list-vxkG9_JD.mjs → allow-list-B_ToXtew.mjs} +34 -101
- package/dist/.setup/{api-DlNUkDqj.mjs → api-CtmE1OUN.mjs} +25 -31
- package/dist/.setup/{approval-handler.runtime-DmnEa54W.mjs → approval-handler.runtime-D7FoZSn0.mjs} +30 -53
- package/dist/.setup/{approval-message-updates-B0jdSqOj.mjs → approval-message-updates-CIGByUcE.mjs} +2 -2
- package/dist/.setup/{audit-BpikUwN_.mjs → audit-zSawfbsN.mjs} +5 -8
- package/dist/.setup/{channel-Dr-AUnGt.mjs → channel-DI7DMzu0.mjs} +136 -215
- package/dist/.setup/{channel-access-BRp3Y-rF.mjs → channel-access-DasWY_OV.mjs} +6 -7
- package/dist/.setup/{channel.setup-BmNvkidb.mjs → channel.setup-DdFVN1mr.mjs} +35 -64
- package/dist/.setup/{components-DLJR0xU-.mjs → components-HN9052L1.mjs} +123 -146
- package/dist/.setup/{config-schema-BQWfnSCx.mjs → config-schema-_uBILpQf.mjs} +7 -3
- package/dist/.setup/{conversation-binding-route-DicJC1Lj.mjs → conversation-binding-route-DTjCBx-O.mjs} +1 -1
- package/dist/.setup/{directory-config-gqsdcplU.mjs → directory-config-3iVub-3m.mjs} +1 -1
- package/dist/.setup/{directory-live-Bipr0eUJ.mjs → directory-live-DLygQVtW.mjs} +18 -22
- package/dist/.setup/{discord-9gysrhzp.mjs → discord-BGqgx-yd.mjs} +686 -854
- package/dist/.setup/{doctor-B2bskDcF.mjs → doctor-DSrNJ7m2.mjs} +36 -47
- package/dist/.setup/{doctor-contract-Bg3NPAMw.mjs → doctor-contract-Bwv8EuQ_.mjs} +7 -16
- package/dist/.setup/{handle-action-UmkjXBfo.mjs → handle-action-CXH1h1tq.mjs} +25 -38
- package/dist/.setup/{handle-action.guild-admin-CB4sc9VV.mjs → handle-action.guild-admin-CHKW6PIs.mjs} +25 -31
- package/dist/.setup/{live-policy-config-VxexfRKo.mjs → live-policy-config-BPoB3eQi.mjs} +1 -1
- package/dist/.setup/{message-handler-BK69A-NB.mjs → message-handler-Ii_etru1.mjs} +9 -14
- package/dist/.setup/{message-handler.preflight-DFpsh90H.mjs → message-handler.preflight-C7YuSRl_.mjs} +79 -128
- package/dist/.setup/{message-handler.preflight-pluralkit-BXGGVmpe.mjs → message-handler.preflight-pluralkit-C3iAG--b.mjs} +6 -6
- package/dist/.setup/{message-handler.process-TKoqcqIP.mjs → message-handler.process-ClgWYH6o.mjs} +234 -206
- package/dist/.setup/{outbound-adapter-D4wRAb5S.mjs → outbound-adapter-D8OOIuKn.mjs} +73 -112
- package/dist/.setup/{outbound-session-route-BvBH4LC6.mjs → outbound-session-route-B0Hpwn3Q.mjs} +57 -115
- package/dist/.setup/output-activity-uBpMSX75.mjs +11 -0
- package/dist/.setup/{pluralkit-a6_NLfH9.mjs → pluralkit-B64dfq_j.mjs} +3 -1
- package/dist/.setup/{preflight-audio-DHGIHEpv.mjs → preflight-audio-wWgsZG5F.mjs} +1 -5
- package/dist/.setup/{presence-cache-Dg3_dADn.mjs → presence-cache-DCeTsL73.mjs} +3 -6
- package/dist/.setup/{probe-BwSKpnZf.mjs → probe-D3P1x4aN.mjs} +10 -18
- package/dist/.setup/{provider-YP8gN9_o.mjs → provider-D9EzOfG8.mjs} +2990 -3903
- package/dist/.setup/{provider-session.runtime-D1gkPxHT.mjs → provider-session.runtime-CsnRvddI.mjs} +5 -5
- package/dist/.setup/provider.runtime-BQVcM7Pg.mjs +2 -0
- package/dist/.setup/{realtime-session.runtime-BKUQBy1u.mjs → realtime-session.runtime-CxGBk8H-.mjs} +69 -98
- package/dist/.setup/{receive-recovery-DgkX7Qvi.mjs → receive-recovery-eVmK2_hl.mjs} +2 -12
- package/dist/.setup/resolve-allowlist-common-DNSsUQRF.mjs +66 -0
- package/dist/.setup/resolve-channels-UdT38DzU.mjs +173 -0
- package/dist/.setup/{resolve-users-DNrwvunm.mjs → resolve-users-DnCsrXZ_.mjs} +12 -41
- package/dist/.setup/{runtime-CESTexGn.mjs → runtime-CRTkKU1G.mjs} +202 -313
- package/dist/.setup/{runtime-DPcmPST9.mjs → runtime-DPm3gZXk.mjs} +2 -2
- package/dist/.setup/{secret-config-contract-uOE2J7yM.mjs → secret-config-contract-CIsH7R3B.mjs} +9 -18
- package/dist/.setup/{security-audit-D42cp5N7.mjs → security-audit-BFT84Uny.mjs} +1 -2
- package/dist/.setup/security-contract-DNyyjTZZ.mjs +19 -0
- package/dist/.setup/{send-CJk3VP5q.mjs → send-DbILKgcm.mjs} +184 -241
- package/dist/.setup/{send.components-dPljuV24.mjs → send.components-FxOS3CeP.mjs} +47 -63
- package/dist/.setup/{send.outbound-rOboMO_6.mjs → send.outbound-_jx4Xpd3.mjs} +178 -202
- package/dist/.setup/{send.receipt-DVOg2Oaw.mjs → send.receipt-BAlzXd8e.mjs} +33 -109
- package/dist/.setup/{send.shared-C4CN24D9.mjs → send.shared-CjQ4jbMA.mjs} +97 -153
- package/dist/.setup/{sender-identity-AHpUNr72.mjs → sender-identity-BNBvGt1l.mjs} +1 -1
- package/dist/.setup/setup-plugin-api-xfOFmxHP.mjs +3 -0
- package/dist/.setup/{shared-BoBnM5kM.mjs → shared-CestGDpq.mjs} +30 -20
- package/dist/.setup/{subagent-hooks-HH8Uy9cx.mjs → subagent-hooks-CME7dSGf.mjs} +5 -10
- package/dist/.setup/{system-events-Cwxaww8i.mjs → system-events-BwwSDCw4.mjs} +2 -2
- package/dist/.setup/target-parsing-C-HyNxcE.mjs +48 -0
- package/dist/.setup/{target-resolver-CSFoPQ12.mjs → target-resolver-Bse8fuTi.mjs} +11 -27
- package/dist/.setup/targets-DZJjkzwv.mjs +3 -0
- package/dist/.setup/{thread-bindings-DjQCkmsd.mjs → thread-bindings-0hPTSK14.mjs} +61 -52
- package/dist/.setup/{thread-bindings.manager-D2-GYZ5s.mjs → thread-bindings.manager-CdNa6UIs.mjs} +138 -211
- package/dist/.setup/{thread-bindings.session-updates-Bu_CGr_O.mjs → thread-bindings.session-updates-DGSljVf6.mjs} +60 -99
- package/dist/.setup/threading-BKe3E3tp.mjs +246 -0
- package/dist/.setup/{timeouts-pun7VJ02.mjs → timeouts-CuNARfyw.mjs} +10 -18
- package/dist/.setup/{transcripts-source-CaZQnGRH.mjs → transcripts-source-0qQYVu2H.mjs} +50 -368
- package/dist/.setup/{voice-runtime-DDymtIw8.mjs → voice-runtime-QlZJ4sHv.mjs} +166 -322
- package/dist/account-inspect-api.js +1 -1
- package/dist/action-runtime-api.js +1 -1
- package/dist/activities-api.js +77 -120
- package/dist/api.js +19 -18
- package/dist/channel-config-api.js +1 -1
- package/dist/channel-plugin-api.js +1 -1
- package/dist/directory-contract-api.js +1 -1
- package/dist/doctor-contract-api.js +1 -1
- package/dist/runtime-api.js +21 -20
- package/dist/secret-contract-api.js +1 -1
- package/dist/security-audit-contract-api.js +1 -1
- package/dist/security-contract-api.js +1 -1
- package/dist/setup-entry.js +1 -1
- package/dist/setup-plugin-api.js +1 -1
- package/dist/src/voice/audio-worker.runtime.js +38 -57
- package/dist/subagent-hooks-api.js +1 -1
- package/dist/transcripts-source-api.js +1 -1
- package/node_modules/@types/node/README.md +1 -1
- package/node_modules/@types/node/crypto.d.ts +2 -2
- package/node_modules/@types/node/dgram.d.ts +1 -1
- package/node_modules/@types/node/package.json +2 -2
- package/node_modules/@types/node/zlib.d.ts +6 -0
- package/node_modules/@types/ws/README.md +1 -1
- package/node_modules/@types/ws/index.d.mts +4 -0
- package/node_modules/@types/ws/index.d.ts +4 -0
- package/node_modules/@types/ws/package.json +3 -3
- package/node_modules/discord-api-types/_generated_/rest/v10/interfaces.d.ts +21 -0
- package/node_modules/discord-api-types/_generated_/rest/v10/interfaces.d.ts.map +1 -1
- package/node_modules/discord-api-types/_generated_/rest/v9/interfaces.d.ts +21 -0
- package/node_modules/discord-api-types/_generated_/rest/v9/interfaces.d.ts.map +1 -1
- package/node_modules/discord-api-types/globals.d.ts +6 -0
- package/node_modules/discord-api-types/globals.d.ts.map +1 -1
- package/node_modules/discord-api-types/globals.js +6 -0
- package/node_modules/discord-api-types/globals.js.map +1 -1
- package/node_modules/discord-api-types/package.json +3 -3
- package/node_modules/discord-api-types/payloads/index.mjs +1 -0
- package/node_modules/discord-api-types/payloads/v10/applicationIdentityProfile.d.ts +207 -0
- package/node_modules/discord-api-types/payloads/v10/applicationIdentityProfile.d.ts.map +1 -0
- package/node_modules/discord-api-types/payloads/v10/applicationIdentityProfile.js +25 -0
- package/node_modules/discord-api-types/payloads/v10/applicationIdentityProfile.js.map +1 -0
- package/node_modules/discord-api-types/payloads/v10/autoModeration.d.ts +1 -1
- package/node_modules/discord-api-types/payloads/v10/autoModeration.d.ts.map +1 -1
- package/node_modules/discord-api-types/payloads/v10/guild.d.ts +27 -23
- package/node_modules/discord-api-types/payloads/v10/guild.d.ts.map +1 -1
- package/node_modules/discord-api-types/payloads/v10/guild.js +26 -22
- package/node_modules/discord-api-types/payloads/v10/guild.js.map +1 -1
- package/node_modules/discord-api-types/payloads/v10/index.d.ts +1 -0
- package/node_modules/discord-api-types/payloads/v10/index.d.ts.map +1 -1
- package/node_modules/discord-api-types/payloads/v10/index.js +1 -0
- package/node_modules/discord-api-types/payloads/v10/index.js.map +1 -1
- package/node_modules/discord-api-types/payloads/v10/index.mjs +1 -0
- package/node_modules/discord-api-types/payloads/v9/applicationIdentityProfile.d.ts +207 -0
- package/node_modules/discord-api-types/payloads/v9/applicationIdentityProfile.d.ts.map +1 -0
- package/node_modules/discord-api-types/payloads/v9/applicationIdentityProfile.js +25 -0
- package/node_modules/discord-api-types/payloads/v9/applicationIdentityProfile.js.map +1 -0
- package/node_modules/discord-api-types/payloads/v9/autoModeration.d.ts +1 -1
- package/node_modules/discord-api-types/payloads/v9/autoModeration.d.ts.map +1 -1
- package/node_modules/discord-api-types/payloads/v9/guild.d.ts +27 -23
- package/node_modules/discord-api-types/payloads/v9/guild.d.ts.map +1 -1
- package/node_modules/discord-api-types/payloads/v9/guild.js +26 -22
- package/node_modules/discord-api-types/payloads/v9/guild.js.map +1 -1
- package/node_modules/discord-api-types/payloads/v9/index.d.ts +1 -0
- package/node_modules/discord-api-types/payloads/v9/index.d.ts.map +1 -1
- package/node_modules/discord-api-types/payloads/v9/index.js +1 -0
- package/node_modules/discord-api-types/payloads/v9/index.js.map +1 -1
- package/node_modules/discord-api-types/payloads/v9/index.mjs +1 -0
- package/node_modules/discord-api-types/rest/common.d.ts +2 -0
- package/node_modules/discord-api-types/rest/common.d.ts.map +1 -1
- package/node_modules/discord-api-types/rest/common.js +2 -0
- package/node_modules/discord-api-types/rest/common.js.map +1 -1
- package/node_modules/discord-api-types/rest/v10/applicationIdentityProfile.d.ts +70 -0
- package/node_modules/discord-api-types/rest/v10/applicationIdentityProfile.d.ts.map +1 -0
- package/node_modules/discord-api-types/rest/v10/applicationIdentityProfile.js +3 -0
- package/node_modules/discord-api-types/rest/v10/applicationIdentityProfile.js.map +1 -0
- package/node_modules/discord-api-types/rest/v10/index.d.ts +1 -0
- package/node_modules/discord-api-types/rest/v10/index.d.ts.map +1 -1
- package/node_modules/discord-api-types/rest/v10/index.js +29 -0
- package/node_modules/discord-api-types/rest/v10/index.js.map +1 -1
- package/node_modules/discord-api-types/rest/v10/interactions.d.ts +4 -2
- package/node_modules/discord-api-types/rest/v10/interactions.d.ts.map +1 -1
- package/node_modules/discord-api-types/rest/v10/user.d.ts +2 -2
- package/node_modules/discord-api-types/rest/v10/user.d.ts.map +1 -1
- package/node_modules/discord-api-types/rest/v9/applicationIdentityProfile.d.ts +70 -0
- package/node_modules/discord-api-types/rest/v9/applicationIdentityProfile.d.ts.map +1 -0
- package/node_modules/discord-api-types/rest/v9/applicationIdentityProfile.js +3 -0
- package/node_modules/discord-api-types/rest/v9/applicationIdentityProfile.js.map +1 -0
- package/node_modules/discord-api-types/rest/v9/index.d.ts +1 -0
- package/node_modules/discord-api-types/rest/v9/index.d.ts.map +1 -1
- package/node_modules/discord-api-types/rest/v9/index.js +29 -0
- package/node_modules/discord-api-types/rest/v9/index.js.map +1 -1
- package/node_modules/discord-api-types/rest/v9/interactions.d.ts +4 -2
- package/node_modules/discord-api-types/rest/v9/interactions.d.ts.map +1 -1
- package/node_modules/discord-api-types/rest/v9/user.d.ts +2 -2
- package/node_modules/discord-api-types/rest/v9/user.d.ts.map +1 -1
- package/node_modules/discord-api-types/v10.mjs +1 -0
- package/node_modules/discord-api-types/v9.mjs +1 -0
- package/node_modules/micromark/dev/lib/compile.d.ts.map +1 -1
- package/node_modules/micromark/dev/lib/compile.js +14 -4
- package/node_modules/micromark/dev/lib/create-tokenizer.d.ts.map +1 -1
- package/node_modules/micromark/dev/lib/create-tokenizer.js +7 -6
- package/node_modules/micromark/dev/lib/initialize/document.js +25 -21
- package/node_modules/micromark/dev/lib/initialize/text.d.ts.map +1 -1
- package/node_modules/micromark/dev/lib/initialize/text.js +10 -6
- package/node_modules/micromark/dev/lib/preprocess.d.ts.map +1 -1
- package/node_modules/micromark/dev/lib/preprocess.js +19 -21
- package/node_modules/micromark/lib/compile.d.ts.map +1 -1
- package/node_modules/micromark/lib/compile.js +37 -29
- package/node_modules/micromark/lib/create-tokenizer.d.ts.map +1 -1
- package/node_modules/micromark/lib/create-tokenizer.js +37 -35
- package/node_modules/micromark/lib/initialize/document.js +21 -13
- package/node_modules/micromark/lib/initialize/text.d.ts.map +1 -1
- package/node_modules/micromark/lib/initialize/text.js +7 -3
- package/node_modules/micromark/lib/preprocess.d.ts.map +1 -1
- package/node_modules/micromark/lib/preprocess.js +16 -19
- package/node_modules/micromark/package.json +2 -15
- package/node_modules/micromark-core-commonmark/dev/lib/attention.js +18 -24
- package/node_modules/micromark-core-commonmark/dev/lib/code-fenced.d.ts.map +1 -1
- package/node_modules/micromark-core-commonmark/dev/lib/code-fenced.js +1 -43
- package/node_modules/micromark-core-commonmark/dev/lib/code-indented.js +19 -43
- package/node_modules/micromark-core-commonmark/dev/lib/heading-atx.js +2 -6
- package/node_modules/micromark-core-commonmark/dev/lib/html-flow.d.ts.map +1 -1
- package/node_modules/micromark-core-commonmark/dev/lib/html-flow.js +2 -53
- package/node_modules/micromark-core-commonmark/dev/lib/label-end.js +14 -12
- package/node_modules/micromark-core-commonmark/dev/lib/label-start-image.d.ts.map +1 -1
- package/node_modules/micromark-core-commonmark/dev/lib/label-start-image.js +14 -5
- package/node_modules/micromark-core-commonmark/dev/lib/label-start-link.d.ts.map +1 -1
- package/node_modules/micromark-core-commonmark/dev/lib/label-start-link.js +14 -5
- package/node_modules/micromark-core-commonmark/dev/lib/partial-non-lazy-continuation.d.ts +4 -0
- package/node_modules/micromark-core-commonmark/dev/lib/partial-non-lazy-continuation.d.ts.map +1 -0
- package/node_modules/micromark-core-commonmark/dev/lib/partial-non-lazy-continuation.js +67 -0
- package/node_modules/micromark-core-commonmark/dev/lib/setext-underline.d.ts.map +1 -1
- package/node_modules/micromark-core-commonmark/dev/lib/setext-underline.js +8 -5
- package/node_modules/micromark-core-commonmark/lib/attention.js +14 -24
- package/node_modules/micromark-core-commonmark/lib/code-fenced.d.ts.map +1 -1
- package/node_modules/micromark-core-commonmark/lib/code-fenced.js +1 -39
- package/node_modules/micromark-core-commonmark/lib/code-indented.js +11 -29
- package/node_modules/micromark-core-commonmark/lib/heading-atx.js +2 -6
- package/node_modules/micromark-core-commonmark/lib/html-flow.d.ts.map +1 -1
- package/node_modules/micromark-core-commonmark/lib/html-flow.js +2 -51
- package/node_modules/micromark-core-commonmark/lib/label-end.js +11 -10
- package/node_modules/micromark-core-commonmark/lib/label-start-image.d.ts.map +1 -1
- package/node_modules/micromark-core-commonmark/lib/label-start-image.js +11 -3
- package/node_modules/micromark-core-commonmark/lib/label-start-link.d.ts.map +1 -1
- package/node_modules/micromark-core-commonmark/lib/label-start-link.js +11 -3
- package/node_modules/micromark-core-commonmark/lib/partial-non-lazy-continuation.d.ts +4 -0
- package/node_modules/micromark-core-commonmark/lib/partial-non-lazy-continuation.d.ts.map +1 -0
- package/node_modules/micromark-core-commonmark/lib/partial-non-lazy-continuation.js +61 -0
- package/node_modules/micromark-core-commonmark/lib/setext-underline.d.ts.map +1 -1
- package/node_modules/micromark-core-commonmark/lib/setext-underline.js +7 -5
- package/node_modules/micromark-core-commonmark/package.json +4 -16
- package/node_modules/micromark-factory-space/dev/index.d.ts +24 -1
- package/node_modules/micromark-factory-space/dev/index.d.ts.map +1 -1
- package/node_modules/micromark-factory-space/dev/index.js +58 -3
- package/node_modules/micromark-factory-space/index.d.ts +24 -1
- package/node_modules/micromark-factory-space/index.d.ts.map +1 -1
- package/node_modules/micromark-factory-space/index.js +55 -3
- package/node_modules/micromark-factory-space/package.json +1 -10
- package/node_modules/micromark-factory-space/readme.md +25 -25
- package/node_modules/micromark-util-edit-map/dev/index.d.ts +78 -0
- package/node_modules/micromark-util-edit-map/dev/index.d.ts.map +1 -0
- package/node_modules/micromark-util-edit-map/dev/index.js +237 -0
- package/node_modules/micromark-util-edit-map/index.d.ts +78 -0
- package/node_modules/micromark-util-edit-map/index.d.ts.map +1 -0
- package/node_modules/micromark-util-edit-map/index.js +225 -0
- package/node_modules/micromark-util-edit-map/license +22 -0
- package/node_modules/micromark-util-edit-map/package.json +48 -0
- package/node_modules/micromark-util-edit-map/readme.md +234 -0
- package/node_modules/micromark-util-types/index.d.ts +6 -3
- package/node_modules/micromark-util-types/package.json +2 -36
- package/node_modules/ws/lib/websocket.js +17 -3
- package/node_modules/ws/package.json +1 -1
- package/openclaw.plugin.json +3 -6
- package/package.json +7 -12
- package/dist/.setup/account-inspect-DsER5ILV.mjs +0 -45
- package/dist/.setup/provider.runtime-CZ51OIgD.mjs +0 -2
- package/dist/.setup/resolve-allowlist-common-BUyU3C-T.mjs +0 -27
- package/dist/.setup/resolve-channels-DA6QlhZN.mjs +0 -246
- package/dist/.setup/security-contract-DSHk7I2w.mjs +0 -26
- package/dist/.setup/setup-plugin-api-BVlCz3fm.mjs +0 -3
- package/dist/.setup/targets-bqXQENmX.mjs +0 -3
- package/dist/control-ui/2afbdab1d3aa65a789d8a3eba666f4b1ec5df07073538fe30d6cf32093a1fb2d/index.js +0 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { R as RateLimitError } from "./discord-BGqgx-yd.mjs";
|
|
2
|
+
import { t as parseDiscordTarget } from "./target-parsing-C-HyNxcE.mjs";
|
|
2
3
|
import { collectErrorGraphCandidates, extractErrorCode, formatErrorMessage, readErrorName } from "openclaw/plugin-sdk/error-runtime";
|
|
3
4
|
import { sleepWithAbort } from "openclaw/plugin-sdk/runtime-env";
|
|
4
5
|
import { expectDefined } from "openclaw/plugin-sdk/expect-runtime";
|
|
@@ -6,8 +7,6 @@ import { parseStrictNonNegativeInteger, resolveIntegerOption } from "openclaw/pl
|
|
|
6
7
|
import { chunkByParagraph } from "openclaw/plugin-sdk/reply-chunking";
|
|
7
8
|
import { chunkTextForOutbound, findCodeRegions } from "openclaw/plugin-sdk/text-chunking";
|
|
8
9
|
import { classifyTransientNetworkErrorCode, createChannelApiRetryRunner, resolveRetryConfig, retryAsync } from "openclaw/plugin-sdk/retry-runtime";
|
|
9
|
-
import { buildMessagingTarget, parseMentionPrefixOrAtUserTarget, requireTargetKind } from "openclaw/plugin-sdk/channel-targets";
|
|
10
|
-
import { resolveAllowlistMatchByCandidates } from "openclaw/plugin-sdk/allow-from";
|
|
11
10
|
import { isSingleUseReplyToMode } from "openclaw/plugin-sdk/reply-reference";
|
|
12
11
|
import { createMessageReceiptFromOutboundResults } from "openclaw/plugin-sdk/channel-outbound";
|
|
13
12
|
import { attachChannelToResults } from "openclaw/plugin-sdk/channel-send-result";
|
|
@@ -47,6 +46,9 @@ function findGraphemeChunkEnd(text, start, maxEnd, preferredEnd = maxEnd, allowP
|
|
|
47
46
|
if (hardEnd <= start) return start;
|
|
48
47
|
const preferred = Number.isInteger(preferredEnd) && preferredEnd > start && preferredEnd <= hardEnd ? preferredEnd : hardEnd;
|
|
49
48
|
if (preferred === text.length) return preferred;
|
|
49
|
+
const before = text.charCodeAt(preferred - 1);
|
|
50
|
+
const after = text.charCodeAt(preferred);
|
|
51
|
+
if (Number.isInteger(preferred) && before <= 127 && after <= 127 && !(before === 13 && after === 10)) return preferred;
|
|
50
52
|
const segments = getGraphemeSegmenter().segment(text);
|
|
51
53
|
let end = containingSegment(segments, text, preferred)?.index ?? preferred;
|
|
52
54
|
if (end <= start && preferred < hardEnd) end = hardEnd === text.length ? hardEnd : containingSegment(segments, text, hardEnd)?.index ?? hardEnd;
|
|
@@ -62,9 +64,6 @@ const FENCE_RE = /^( {0,3})(`{3,}|~{3,})(.*)$/;
|
|
|
62
64
|
function hasReasoningItalics(text) {
|
|
63
65
|
return /^(?:Reasoning:|Thinking\.{0,3})\n+_/u.test(text) && text.trimEnd().endsWith("_");
|
|
64
66
|
}
|
|
65
|
-
function resolveDiscordChunkLimit(value, fallback) {
|
|
66
|
-
return resolveIntegerOption(value, fallback, { min: 1 });
|
|
67
|
-
}
|
|
68
67
|
function countLines(text) {
|
|
69
68
|
if (!text) return 0;
|
|
70
69
|
let count = 1;
|
|
@@ -88,8 +87,8 @@ function closesFence(open, close) {
|
|
|
88
87
|
return open.marker[0] === close.marker[0] && close.marker.length >= open.marker.length;
|
|
89
88
|
}
|
|
90
89
|
function chunkDiscordText(text, opts = {}) {
|
|
91
|
-
const hardMaxChars =
|
|
92
|
-
const maxLines =
|
|
90
|
+
const hardMaxChars = resolveIntegerOption(opts.maxChars, DEFAULT_MAX_CHARS, { min: 1 });
|
|
91
|
+
const maxLines = resolveIntegerOption(opts.maxLines, DEFAULT_MAX_LINES, { min: 1 });
|
|
93
92
|
if (!text) return [];
|
|
94
93
|
if (text.length <= hardMaxChars && countLines(text) <= maxLines) return [text];
|
|
95
94
|
const maxChars = hardMaxChars >= MIN_REASONING_ITALICS_CHUNK_CHARS && hasReasoningItalics(text) ? hardMaxChars - REASONING_ITALICS_MARKER_CHARS : hardMaxChars;
|
|
@@ -98,16 +97,14 @@ function chunkDiscordText(text, opts = {}) {
|
|
|
98
97
|
let current;
|
|
99
98
|
let consumed = 0;
|
|
100
99
|
let lineStart = 0;
|
|
101
|
-
const raw = (frame) => {
|
|
100
|
+
const raw = (frame, body = text.slice(frame.start, frame.end)) => {
|
|
102
101
|
const prefix = ranges.fenceAt(frame.start)?.reopenLine ?? "";
|
|
103
|
-
const body = text.slice(frame.start, frame.end);
|
|
104
102
|
return prefix + (prefix ? "\n" : "") + body;
|
|
105
103
|
};
|
|
106
104
|
const render = (frame) => {
|
|
107
105
|
const body = ranges.render(frame.start, frame.end);
|
|
108
106
|
if (body === void 0) return;
|
|
109
|
-
const
|
|
110
|
-
const result = prefix + (prefix ? "\n" : "") + body;
|
|
107
|
+
const result = raw(frame, body);
|
|
111
108
|
const close = ranges.fenceAt(frame.end);
|
|
112
109
|
return close?.reopenLine ? result + (result.endsWith("\n") ? "" : "\n") + close.closeLine : result;
|
|
113
110
|
};
|
|
@@ -174,7 +171,7 @@ function chunkDiscordText(text, opts = {}) {
|
|
|
174
171
|
}
|
|
175
172
|
function chunkDiscordTextWithMode(text, opts) {
|
|
176
173
|
if ((opts.chunkMode ?? "length") !== "newline") return chunkDiscordText(text, opts);
|
|
177
|
-
return chunkByParagraph(text,
|
|
174
|
+
return chunkByParagraph(text, resolveIntegerOption(opts.maxChars, DEFAULT_MAX_CHARS, { min: 1 }), { splitLongParagraphs: false }).flatMap((line) => {
|
|
178
175
|
const chunks = chunkDiscordText(line, opts);
|
|
179
176
|
return chunks.length || !line ? chunks : [line];
|
|
180
177
|
});
|
|
@@ -379,13 +376,16 @@ const DISCORD_RETRY_DEFAULTS = {
|
|
|
379
376
|
const DISCORD_GATEWAY_RECONNECT_EXTRA_ATTEMPTS = 2;
|
|
380
377
|
const DISCORD_TRANSIENT_MESSAGE_RE = /\b(?:bad gateway|fetch failed|network error|networkerror|service unavailable|socket hang up|temporarily unavailable|timed out|timeout)\b|connection (?:closed|reset|refused)/i;
|
|
381
378
|
const ambiguousDiscordMessageCreates = /* @__PURE__ */ new WeakSet();
|
|
379
|
+
function collectDiscordErrorCandidates(error) {
|
|
380
|
+
return collectErrorGraphCandidates(error, (current) => [current.cause, current.error]);
|
|
381
|
+
}
|
|
382
382
|
function readDiscordErrorStatus(err) {
|
|
383
383
|
if (!err || typeof err !== "object") return;
|
|
384
384
|
const raw = "status" in err && err.status !== void 0 ? err.status : "statusCode" in err && err.statusCode !== void 0 ? err.statusCode : void 0;
|
|
385
385
|
return parseStrictNonNegativeInteger(raw);
|
|
386
386
|
}
|
|
387
387
|
function classifyDiscordDeliveryFailure(error) {
|
|
388
|
-
const candidates =
|
|
388
|
+
const candidates = collectDiscordErrorCandidates(error);
|
|
389
389
|
for (const candidate of candidates) {
|
|
390
390
|
const status = readDiscordErrorStatus(candidate);
|
|
391
391
|
if (status !== void 0) {
|
|
@@ -401,7 +401,7 @@ function recordDiscordMessageCreateAmbiguity(error) {
|
|
|
401
401
|
if (error !== null && typeof error === "object") ambiguousDiscordMessageCreates.add(error);
|
|
402
402
|
}
|
|
403
403
|
function hasDiscordMessageCreateAmbiguity(error) {
|
|
404
|
-
return
|
|
404
|
+
return collectDiscordErrorCandidates(error).some((candidate) => candidate !== null && typeof candidate === "object" && ambiguousDiscordMessageCreates.has(candidate));
|
|
405
405
|
}
|
|
406
406
|
function canFallbackDiscordWebhookSend(error) {
|
|
407
407
|
if (hasDiscordMessageCreateAmbiguity(error)) return false;
|
|
@@ -409,28 +409,17 @@ function canFallbackDiscordWebhookSend(error) {
|
|
|
409
409
|
return failure === "rejected" || failure === "pre-connect";
|
|
410
410
|
}
|
|
411
411
|
function hasDiscordRateLimitRejection(error) {
|
|
412
|
-
return error instanceof RateLimitError ||
|
|
412
|
+
return error instanceof RateLimitError || collectDiscordErrorCandidates(error).some((candidate) => readDiscordErrorStatus(candidate) === 429);
|
|
413
413
|
}
|
|
414
|
-
function
|
|
414
|
+
function isRetryableDiscordError(error, safety = "idempotent") {
|
|
415
415
|
const failure = classifyDiscordDeliveryFailure(error);
|
|
416
|
-
return failure === "
|
|
417
|
-
}
|
|
418
|
-
function isRetryableDiscordPreConnectError(error) {
|
|
419
|
-
const failure = classifyDiscordDeliveryFailure(error);
|
|
420
|
-
return failure === "pre-connect" || failure === "rejected" && hasDiscordRateLimitRejection(error);
|
|
421
|
-
}
|
|
422
|
-
function resolveDiscordRetryPredicate(safety) {
|
|
423
|
-
return safety === "non-idempotent-create" ? isRetryableDiscordPreConnectError : isRetryableDiscordTransientError;
|
|
424
|
-
}
|
|
425
|
-
function isRetryableDiscordGatewayTransportError(err) {
|
|
426
|
-
if (!isRetryableDiscordTransientError(err) || err instanceof RateLimitError) return false;
|
|
427
|
-
return !collectErrorGraphCandidates(err, (current) => [current.cause, current.error]).some((candidate) => readDiscordErrorStatus(candidate) !== void 0);
|
|
416
|
+
return failure === "pre-connect" || (safety === "non-idempotent-create" ? failure === "rejected" && hasDiscordRateLimitRejection(error) : failure === "ambiguous" || hasDiscordRateLimitRejection(error));
|
|
428
417
|
}
|
|
429
418
|
function createDiscordRetryRunner(params) {
|
|
430
419
|
const retryConfig = resolveRetryConfig(DISCORD_RETRY_DEFAULTS, params.retry);
|
|
431
420
|
const attempts = retryConfig.attempts > 1 ? retryConfig.attempts + DISCORD_GATEWAY_RECONNECT_EXTRA_ATTEMPTS : retryConfig.attempts;
|
|
432
421
|
return (fn, label, options) => {
|
|
433
|
-
const
|
|
422
|
+
const safety = options?.safety ?? "idempotent";
|
|
434
423
|
let observedGatewayDisconnect = false;
|
|
435
424
|
const runRequest = async () => {
|
|
436
425
|
if (params.signal?.aborted) throw params.signal.reason instanceof Error ? params.signal.reason : /* @__PURE__ */ new Error("Discord request aborted");
|
|
@@ -442,7 +431,7 @@ function createDiscordRetryRunner(params) {
|
|
|
442
431
|
throw err;
|
|
443
432
|
}
|
|
444
433
|
};
|
|
445
|
-
const shouldRetry = (err, attempt) =>
|
|
434
|
+
const shouldRetry = (err, attempt) => isRetryableDiscordError(err, safety) && (attempt < retryConfig.attempts || observedGatewayDisconnect && isRetryableDiscordError(err) && !(err instanceof RateLimitError) && !collectDiscordErrorCandidates(err).some((candidate) => readDiscordErrorStatus(candidate) !== void 0));
|
|
446
435
|
const retryAfterMs = (err) => err instanceof RateLimitError ? err.retryAfter * 1e3 : void 0;
|
|
447
436
|
const signal = params.signal;
|
|
448
437
|
if (signal) return retryAsync(runRequest, {
|
|
@@ -472,56 +461,6 @@ function createDiscordRetryRunner(params) {
|
|
|
472
461
|
};
|
|
473
462
|
}
|
|
474
463
|
//#endregion
|
|
475
|
-
//#region extensions/discord/src/target-parsing.ts
|
|
476
|
-
function parseDiscordTarget(raw, options = {}) {
|
|
477
|
-
const trimmed = raw.trim();
|
|
478
|
-
if (!trimmed) return;
|
|
479
|
-
const providerPrefixedTarget = parseDiscordProviderPrefixedTarget(trimmed);
|
|
480
|
-
if (providerPrefixedTarget) return providerPrefixedTarget;
|
|
481
|
-
const userTarget = parseMentionPrefixOrAtUserTarget({
|
|
482
|
-
raw: trimmed,
|
|
483
|
-
mentionPattern: /^<@!?(\d+)>$/,
|
|
484
|
-
prefixes: [
|
|
485
|
-
{
|
|
486
|
-
prefix: "user:",
|
|
487
|
-
kind: "user"
|
|
488
|
-
},
|
|
489
|
-
{
|
|
490
|
-
prefix: "channel:",
|
|
491
|
-
kind: "channel"
|
|
492
|
-
},
|
|
493
|
-
{
|
|
494
|
-
prefix: "discord:",
|
|
495
|
-
kind: "user"
|
|
496
|
-
}
|
|
497
|
-
],
|
|
498
|
-
atUserPattern: /^\d+$/,
|
|
499
|
-
atUserErrorMessage: "Discord DMs require a user id (use user:<id> or a <@id> mention)"
|
|
500
|
-
});
|
|
501
|
-
if (userTarget) return userTarget;
|
|
502
|
-
if (/^\d+$/.test(trimmed)) {
|
|
503
|
-
if (options.defaultKind) return buildMessagingTarget(options.defaultKind, trimmed, trimmed);
|
|
504
|
-
throw new Error(options.ambiguousMessage ?? `Ambiguous Discord recipient "${trimmed}". For DMs use "user:${trimmed}" or "<@${trimmed}>"; for channels use "channel:${trimmed}".`);
|
|
505
|
-
}
|
|
506
|
-
return buildMessagingTarget("channel", trimmed, trimmed);
|
|
507
|
-
}
|
|
508
|
-
function parseDiscordProviderPrefixedTarget(raw) {
|
|
509
|
-
const match = /^discord:(channel|user):(.+)$/i.exec(raw);
|
|
510
|
-
if (!match) return;
|
|
511
|
-
const kind = match[1]?.toLowerCase();
|
|
512
|
-
const id = match[2]?.trim();
|
|
513
|
-
if (!kind || !id) return;
|
|
514
|
-
return buildMessagingTarget(kind, id, `${kind}:${id}`);
|
|
515
|
-
}
|
|
516
|
-
function resolveDiscordChannelId(raw) {
|
|
517
|
-
const target = parseDiscordTarget(raw, { defaultKind: "channel" });
|
|
518
|
-
return requireTargetKind({
|
|
519
|
-
platform: "Discord",
|
|
520
|
-
target,
|
|
521
|
-
kind: "channel"
|
|
522
|
-
});
|
|
523
|
-
}
|
|
524
|
-
//#endregion
|
|
525
464
|
//#region extensions/discord/src/normalize.ts
|
|
526
465
|
function normalizeDiscordMessagingTarget(raw) {
|
|
527
466
|
return parseDiscordTarget(raw, { defaultKind: "channel" })?.normalized;
|
|
@@ -543,16 +482,10 @@ function normalizeDiscordOutboundTarget(to, allowFrom) {
|
|
|
543
482
|
ok: false,
|
|
544
483
|
error: /* @__PURE__ */ new Error("Discord recipient is required. Use \"channel:<id>\" for channels or \"user:<id>\" for DMs.")
|
|
545
484
|
};
|
|
546
|
-
if (/^\d+$/.test(trimmed)) {
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
};
|
|
551
|
-
return {
|
|
552
|
-
ok: true,
|
|
553
|
-
to: `channel:${trimmed}`
|
|
554
|
-
};
|
|
555
|
-
}
|
|
485
|
+
if (/^\d+$/.test(trimmed)) return {
|
|
486
|
+
ok: true,
|
|
487
|
+
to: `${allowFromContainsDiscordUserId(allowFrom, trimmed) ? "user" : "channel"}:${trimmed}`
|
|
488
|
+
};
|
|
556
489
|
return {
|
|
557
490
|
ok: true,
|
|
558
491
|
to: trimmed
|
|
@@ -561,18 +494,10 @@ function normalizeDiscordOutboundTarget(to, allowFrom) {
|
|
|
561
494
|
function allowFromContainsDiscordUserId(allowFrom, userId) {
|
|
562
495
|
const normalizedUserId = userId.trim();
|
|
563
496
|
if (!normalizedUserId) return false;
|
|
564
|
-
|
|
565
|
-
return resolveAllowlistMatchByCandidates({
|
|
566
|
-
allowList: normalizedAllowFrom,
|
|
567
|
-
candidates: [{
|
|
568
|
-
value: normalizedUserId,
|
|
569
|
-
source: "id"
|
|
570
|
-
}]
|
|
571
|
-
}).allowed;
|
|
497
|
+
return (allowFrom ?? []).map(normalizeAllowFromDiscordUserId).includes(normalizedUserId);
|
|
572
498
|
}
|
|
573
499
|
function normalizeAllowFromDiscordUserId(entry) {
|
|
574
500
|
const trimmed = entry.trim().toLowerCase();
|
|
575
|
-
if (!trimmed || trimmed === "*") return;
|
|
576
501
|
const mentionMatch = /^<@!?(\d+)>$/.exec(trimmed);
|
|
577
502
|
if (mentionMatch) return mentionMatch[1];
|
|
578
503
|
return /^(?:(?:discord:)?user:|discord:)?(\d+)$/.exec(trimmed)?.[1];
|
|
@@ -654,18 +579,17 @@ function createDiscordSendReceipt(params) {
|
|
|
654
579
|
function createDiscordSendResult(params) {
|
|
655
580
|
const messageId = params.result.id ?? "";
|
|
656
581
|
const channelId = params.result.channel_id ?? params.fallbackChannelId;
|
|
657
|
-
const receiptParams = {
|
|
658
|
-
platformMessageIds: params.result.platformMessageIds?.length ? params.result.platformMessageIds : [messageId],
|
|
659
|
-
channelId,
|
|
660
|
-
kind: params.kind
|
|
661
|
-
};
|
|
662
|
-
if (params.threadId != null) receiptParams.threadId = String(params.threadId);
|
|
663
|
-
if (params.reply) receiptParams.reply = params.reply;
|
|
664
582
|
return {
|
|
665
583
|
messageId,
|
|
666
584
|
channelId,
|
|
667
|
-
receipt: createDiscordSendReceipt(
|
|
585
|
+
receipt: createDiscordSendReceipt({
|
|
586
|
+
platformMessageIds: params.result.platformMessageIds?.length ? params.result.platformMessageIds : [messageId],
|
|
587
|
+
channelId,
|
|
588
|
+
kind: params.kind,
|
|
589
|
+
threadId: params.threadId == null ? void 0 : String(params.threadId),
|
|
590
|
+
reply: params.reply
|
|
591
|
+
})
|
|
668
592
|
};
|
|
669
593
|
}
|
|
670
594
|
//#endregion
|
|
671
|
-
export {
|
|
595
|
+
export { recordDiscordMessageCreateAmbiguity as _, createReusableDiscordReplyReference as a, allowFromContainsDiscordUserId as c, normalizeDiscordMessagingTarget as d, normalizeDiscordOutboundTarget as f, hasDiscordMessageCreateAmbiguity as g, createDiscordRetryRunner as h, toDiscordOutboundDeliveryResult as i, looksLikeDiscordTargetId as l, classifyDiscordDeliveryFailure as m, createDiscordSendReceiptFromResults as n, resolveDiscordReplyMessageId as o, canFallbackDiscordWebhookSend as p, createDiscordSendResult as r, resolveDiscordReplyReference as s, createDiscordSendReceipt as t, matchesDiscordToolContextTarget as u, chunkDiscordTextWithMode as v, findGraphemeChunkEnd as y };
|