@openclaw/discord 2026.8.1-beta.2 → 2026.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{account-inspect-CqzrH14k.js → account-inspect-BDfKyuvL.js} +1 -1
- package/dist/account-inspect-api.js +1 -1
- package/dist/{accounts-DJTf1LtA.js → accounts-CfQ-vSyf.js} +34 -1
- package/dist/action-runtime-api.js +1 -1
- package/dist/{activities-api-DS7vpdtp.js → activities-api-Dl-TOyOX.js} +134 -175
- package/dist/activities-api.js +1 -1
- package/dist/api.js +17 -17
- package/dist/{approval-handler.runtime-B6yEV79q.js → approval-handler.runtime-q4Zqo44V.js} +29 -106
- package/dist/{audit-Db-rlntl.js → audit-DgrvFPGt.js} +5 -5
- package/dist/{channel-CnnbJSt5.js → channel-BsQUalPw.js} +72 -50
- package/dist/{channel-actions.runtime-CLKrx6tr.js → channel-actions.runtime-UMGGIfSy.js} +31 -45
- package/dist/channel-config-api.js +1 -1
- package/dist/channel-plugin-api.js +1 -1
- package/dist/channel-type-CVLZyGYS.js +7 -0
- package/dist/{channel.setup-BFAO-V1P.js → channel.setup-rPs4dsk_.js} +5 -5
- package/dist/{outbound-session-route-DxLkrgKQ.js → components-Dk35LTf_.js} +34 -76
- package/dist/{config-schema-BgEskFAs.js → config-schema-CxPqtVI1.js} +46 -14
- package/dist/conversation-binding-route-BjvX4e35.js +43 -0
- package/dist/{directory-config-BVX7Cflc.js → directory-config-B7DY_pNG.js} +2 -2
- package/dist/directory-contract-api.js +1 -1
- package/dist/{directory-live-DGIGxpIo.js → directory-live-DuAXKkan.js} +3 -3
- package/dist/doctor-contract-api.js +2 -2
- package/dist/{doctor-BzC-TLnB.js → doctor-zQTtn6hm.js} +33 -12
- package/dist/{handle-action.guild-admin-BNVTUISF.js → handle-action.guild-admin-DZewwLr1.js} +9 -5
- package/dist/index.js +3 -4
- package/dist/ingress-identity-CzZKcPK8.js +60 -0
- package/dist/{message-handler-Unk_f10F.js → message-handler-C5By3yl5.js} +82 -6
- package/dist/{message-handler.preflight-C9zecxR9.js → message-handler.preflight-DrszWuHw.js} +44 -118
- package/dist/{message-handler.process-DWQ6UHHu.js → message-handler.process-DyFPDLCt.js} +205 -235
- package/dist/{message-utils-BSCPVgy0.js → message-text-Ca8M6TU8.js} +43 -42
- package/dist/{outbound-adapter-D9nRivT1.js → outbound-adapter-Dif8p481.js} +118 -91
- package/dist/{outbound-components-cTzwBJ60.js → outbound-components-wjv7yyAj.js} +5 -4
- package/dist/outbound-session-route-Bn4uXaoE.js +665 -0
- package/dist/owner-access-UlYi9t0M.js +107 -0
- package/dist/{pluralkit-DdiJ9KMK.js → pluralkit-9EuEN4UD.js} +1 -1
- package/dist/{probe-Bl-k5_Ku.js → probe-n6ZXxK8V.js} +1 -1
- package/dist/{probe.runtime-M9fREKvp.js → probe.runtime-CN4bdPfZ.js} +1 -1
- package/dist/{provider-DvSNb-2v.js → provider-LXiOcJrH.js} +887 -1350
- package/dist/{provider-session.runtime-BUEqD0rA.js → provider-session.runtime-DSNe7r2W.js} +3 -3
- package/dist/provider.runtime-DiInaDXO.js +2 -0
- package/dist/{realtime-session.runtime-C7wen-aF.js → realtime-session.runtime-DOViOIjY.js} +129 -134
- package/dist/{resolve-allowlist-common-D04lpEzb.js → resolve-allowlist-common-BLoYaxEG.js} +2 -2
- package/dist/{resolve-channels-Dm7jEeg6.js → resolve-channels-D2yl_2CN.js} +5 -4
- package/dist/{resolve-users-bktrCUUU.js → resolve-users-BLxfqajZ.js} +2 -2
- package/dist/{retry-CLpJcXXf.js → retry-DqHCW6PV.js} +187 -19
- package/dist/{runtime-DGsSyDTS.js → runtime-BYamRVPN.js} +89 -86
- package/dist/{runtime-DoHjckYm.js → runtime-DrxVBTtp.js} +9 -10
- package/dist/runtime-api.js +19 -25
- package/dist/{sdk-runtime-QpY8PvCh.js → sdk-runtime-6tfgYDjY.js} +57 -89
- package/dist/{secret-config-contract-B1akrlyY.js → secret-config-contract-B3i6WxV5.js} +53 -25
- package/dist/secret-contract-api.js +1 -1
- package/dist/{security-audit-jGnJF__m.js → security-audit-DKfK-iPY.js} +11 -12
- package/dist/security-audit-contract-api.js +1 -1
- package/dist/{security-audit.runtime-CPN0xFYz.js → security-audit.runtime-sKZyKgpx.js} +1 -1
- package/dist/{send-B7Q6Oc1I.js → send-UJHiAm4C.js} +82 -19
- package/dist/{send.components-iJyFXw9L.js → send.components-CrBJpGT_.js} +22 -39
- package/dist/{send.outbound-DS5tHwfR.js → send.outbound-D7JYmfm9.js} +77 -78
- package/dist/{send.shared-BmwFjW6T.js → send.shared-DZJ1akvQ.js} +136 -121
- package/dist/{sender-identity-QtalnCYv.js → sender-identity-BJtfyise.js} +1 -1
- package/dist/setup-plugin-api.js +1 -1
- package/dist/{shared-BIXIX6uJ.js → shared-Dii2HTn7.js} +41 -14
- package/dist/subagent-hooks-JyGrtQIl.js +49 -0
- package/dist/subagent-hooks-api.js +1 -6
- package/dist/{system-events-CTqDf6_s.js → system-events-BEmcj4xJ.js} +2 -2
- package/dist/{target-resolver-maOKSqO0.js → target-resolver-V-IYae6s.js} +3 -3
- package/dist/targets-CQp53cGj.js +3 -0
- package/dist/{thread-bindings-3L8p82GV.js → thread-bindings-DvYP79fy.js} +28 -26
- package/dist/{thread-bindings.manager-DCIH6WDC.js → thread-bindings.manager-Clm77DBM.js} +11 -14
- package/dist/{thread-bindings.session-updates-bJ2KQFY6.js → thread-bindings.session-updates-CJb-BpPL.js} +1 -1
- package/dist/{thread-bindings.state-aeV8HNgV.js → thread-bindings.state-D8OMdk4O.js} +1 -1
- package/dist/threading-CXuu_7o9.js +478 -0
- package/dist/transcripts-source-BLEMH_yi.js +270 -0
- package/dist/transcripts-source-api.js +7 -2
- package/dist/{typing-CS-nNVoe.js → typing-B9snnwMe.js} +1 -1
- package/dist/{voice-runtime-BEdqNcST.js → voice-runtime-DY6_o73o.js} +250 -150
- package/node_modules/@discord/embedded-app-sdk/node_modules/uuid/README.md +19 -19
- package/node_modules/@discord/embedded-app-sdk/node_modules/uuid/dist/v1.js +7 -3
- package/node_modules/@discord/embedded-app-sdk/node_modules/uuid/dist/v7.js +5 -2
- package/node_modules/@discord/embedded-app-sdk/node_modules/uuid/dist-node/v1.js +7 -3
- package/node_modules/@discord/embedded-app-sdk/node_modules/uuid/dist-node/v7.js +5 -2
- package/node_modules/@discord/embedded-app-sdk/node_modules/uuid/package.json +4 -3
- package/node_modules/@discordjs/voice/node_modules/@types/node/README.md +1 -1
- package/node_modules/@discordjs/voice/node_modules/@types/node/child_process.d.ts +0 -1
- package/node_modules/@discordjs/voice/node_modules/@types/node/crypto.d.ts +6 -6
- package/node_modules/@discordjs/voice/node_modules/@types/node/dns/promises.d.ts +5 -5
- package/node_modules/@discordjs/voice/node_modules/@types/node/dns.d.ts +5 -5
- package/node_modules/@discordjs/voice/node_modules/@types/node/fs.d.ts +7 -0
- package/node_modules/@discordjs/voice/node_modules/@types/node/http.d.ts +30 -0
- package/node_modules/@discordjs/voice/node_modules/@types/node/http2.d.ts +4 -4
- package/node_modules/@discordjs/voice/node_modules/@types/node/os.d.ts +30 -30
- package/node_modules/@discordjs/voice/node_modules/@types/node/package.json +2 -2
- package/node_modules/@discordjs/voice/node_modules/@types/node/perf_hooks.d.ts +2 -1
- package/node_modules/@discordjs/voice/node_modules/@types/node/process.d.ts +42 -43
- package/node_modules/@discordjs/voice/node_modules/@types/node/quic.d.ts +1049 -84
- package/node_modules/@discordjs/voice/node_modules/@types/node/sqlite.d.ts +14 -1
- package/node_modules/@discordjs/voice/node_modules/@types/node/stream/iter.d.ts +3 -2
- package/node_modules/@discordjs/voice/node_modules/@types/node/test.d.ts +61 -0
- package/node_modules/@discordjs/voice/node_modules/@types/node/v8.d.ts +20 -23
- package/node_modules/discord-api-types/CHANGELOG.md +8 -0
- package/node_modules/discord-api-types/package.json +4 -4
- package/node_modules/discord-api-types/payloads/v10/channel.d.ts +2 -2
- package/node_modules/discord-api-types/payloads/v10/channel.d.ts.map +1 -1
- package/node_modules/discord-api-types/payloads/v10/gateway.d.ts +4 -0
- package/node_modules/discord-api-types/payloads/v10/gateway.d.ts.map +1 -1
- package/node_modules/discord-api-types/payloads/v10/gateway.js.map +1 -1
- package/node_modules/discord-api-types/payloads/v10/message.d.ts +4 -1
- package/node_modules/discord-api-types/payloads/v10/message.d.ts.map +1 -1
- package/node_modules/discord-api-types/payloads/v10/message.js +1 -0
- package/node_modules/discord-api-types/payloads/v10/message.js.map +1 -1
- package/node_modules/discord-api-types/payloads/v9/channel.d.ts +2 -2
- package/node_modules/discord-api-types/payloads/v9/channel.d.ts.map +1 -1
- package/node_modules/discord-api-types/payloads/v9/gateway.d.ts +4 -0
- package/node_modules/discord-api-types/payloads/v9/gateway.d.ts.map +1 -1
- package/node_modules/discord-api-types/payloads/v9/gateway.js.map +1 -1
- package/node_modules/discord-api-types/payloads/v9/message.d.ts +4 -1
- package/node_modules/discord-api-types/payloads/v9/message.d.ts.map +1 -1
- package/node_modules/discord-api-types/payloads/v9/message.js +1 -0
- package/node_modules/discord-api-types/payloads/v9/message.js.map +1 -1
- package/node_modules/typebox/build/format/date.d.mts +1 -1
- package/node_modules/typebox/build/format/date.mjs +1 -1
- package/node_modules/typebox/build/format/date_time.d.mts +2 -2
- package/node_modules/typebox/build/format/date_time.mjs +3 -3
- package/node_modules/typebox/build/format/email.d.mts +1 -1
- package/node_modules/typebox/build/format/email.mjs +2 -2
- package/node_modules/typebox/build/format/hostname.mjs +2 -10
- package/node_modules/typebox/build/format/idn_email.d.mts +1 -1
- package/node_modules/typebox/build/format/idn_email.mjs +3 -3
- package/node_modules/typebox/build/format/idn_hostname.d.mts +1 -0
- package/node_modules/typebox/build/format/idn_hostname.mjs +3 -11
- package/node_modules/typebox/build/format/idna/format/bidi.d.mts +3 -0
- package/node_modules/typebox/build/format/idna/format/bidi.mjs +98 -0
- package/node_modules/typebox/build/format/idna/format/puny.d.mts +3 -0
- package/node_modules/typebox/build/format/idna/format/puny.mjs +144 -0
- package/node_modules/typebox/build/format/idna/hostname.d.mts +1 -0
- package/node_modules/typebox/build/format/idna/hostname.mjs +16 -0
- package/node_modules/typebox/build/format/idna/idn-hostname.d.mts +1 -0
- package/node_modules/typebox/build/format/idna/idn-hostname.mjs +23 -0
- package/node_modules/typebox/build/format/idna/index.d.mts +2 -0
- package/node_modules/typebox/build/format/idna/index.mjs +2 -0
- package/node_modules/typebox/build/format/idna/label/ascii.d.mts +1 -0
- package/node_modules/typebox/build/format/idna/label/ascii.mjs +9 -0
- package/node_modules/typebox/build/format/idna/label/puny.d.mts +1 -0
- package/node_modules/typebox/build/format/idna/label/puny.mjs +28 -0
- package/node_modules/typebox/build/format/idna/label/unicode.d.mts +1 -0
- package/node_modules/typebox/build/format/idna/label/unicode.mjs +106 -0
- package/node_modules/typebox/build/format/idna/pattern/pattern.d.mts +30 -0
- package/node_modules/typebox/build/format/idna/pattern/pattern.mjs +70 -0
- package/node_modules/typebox/build/format/ipv4.d.mts +0 -1
- package/node_modules/typebox/build/format/ipv4.mjs +2 -32
- package/node_modules/typebox/build/format/ipv6.mjs +2 -61
- package/node_modules/typebox/build/format/iri.d.mts +2 -2
- package/node_modules/typebox/build/format/iri.mjs +26 -8
- package/node_modules/typebox/build/format/iri_reference.d.mts +2 -2
- package/node_modules/typebox/build/format/iri_reference.mjs +9 -55
- package/node_modules/typebox/build/format/regex.d.mts +1 -2
- package/node_modules/typebox/build/format/regex.mjs +2 -6
- package/node_modules/typebox/build/format/time.d.mts +2 -2
- package/node_modules/typebox/build/format/time.mjs +19 -14
- package/node_modules/typebox/build/format/uri.d.mts +1 -1
- package/node_modules/typebox/build/format/uri.mjs +3 -130
- package/node_modules/typebox/build/format/uri_reference.d.mts +1 -1
- package/node_modules/typebox/build/format/uri_reference.mjs +2 -3
- package/node_modules/typebox/build/format/uri_template.d.mts +2 -3
- package/node_modules/typebox/build/format/uri_template.mjs +4 -5
- package/node_modules/typebox/build/format/url.d.mts +3 -3
- package/node_modules/typebox/build/format/url.mjs +4 -5
- package/node_modules/typebox/build/guard/emit.d.mts +3 -1
- package/node_modules/typebox/build/guard/emit.mjs +12 -5
- package/node_modules/typebox/build/guard/guard.d.mts +8 -2
- package/node_modules/typebox/build/guard/guard.mjs +25 -4
- package/node_modules/typebox/build/guard/string.d.mts +2 -2
- package/node_modules/typebox/build/guard/string.mjs +7 -7
- package/node_modules/typebox/build/schema/engine/_context.mjs +3 -3
- package/node_modules/typebox/build/schema/engine/_functions.mjs +1 -2
- package/node_modules/typebox/build/schema/engine/_regexp.d.mts +2 -0
- package/node_modules/typebox/build/schema/engine/_regexp.mjs +4 -0
- package/node_modules/typebox/build/schema/engine/_stack.mjs +12 -13
- package/node_modules/typebox/build/schema/engine/additionalItems.mjs +17 -7
- package/node_modules/typebox/build/schema/engine/additionalProperties.mjs +4 -3
- package/node_modules/typebox/build/schema/engine/contains.mjs +18 -6
- package/node_modules/typebox/build/schema/engine/enum.mjs +1 -1
- package/node_modules/typebox/build/schema/engine/items.mjs +26 -6
- package/node_modules/typebox/build/schema/engine/maxContains.mjs +3 -3
- package/node_modules/typebox/build/schema/engine/minContains.mjs +14 -4
- package/node_modules/typebox/build/schema/engine/not.mjs +4 -2
- package/node_modules/typebox/build/schema/engine/oneOf.mjs +7 -6
- package/node_modules/typebox/build/schema/engine/pattern.mjs +3 -2
- package/node_modules/typebox/build/schema/engine/patternProperties.mjs +4 -3
- package/node_modules/typebox/build/schema/engine/ref.mjs +1 -7
- package/node_modules/typebox/build/schema/engine/schema.mjs +13 -4
- package/node_modules/typebox/build/schema/engine/type.mjs +1 -1
- package/node_modules/typebox/build/schema/resolve/resolve.d.mts +4 -1
- package/node_modules/typebox/build/schema/resolve/resolve.mjs +202 -1
- package/node_modules/typebox/build/schema/static/propertyNames.d.mts +5 -0
- package/node_modules/typebox/build/schema/static/propertyNames.mjs +3 -0
- package/node_modules/typebox/build/schema/static/schema.d.mts +3 -0
- package/node_modules/typebox/build/schema/types/index.d.mts +0 -2
- package/node_modules/typebox/build/schema/types/index.mjs +0 -2
- package/node_modules/typebox/build/system/memory/clone.mjs +14 -11
- package/node_modules/typebox/build/system/memory/discard.mjs +6 -5
- package/node_modules/typebox/build/system/settings/settings.d.mts +9 -0
- package/node_modules/typebox/build/system/settings/settings.mjs +2 -0
- package/node_modules/typebox/build/type/engine/call/distribute_arguments.d.mts +6 -1
- package/node_modules/typebox/build/type/engine/call/distribute_arguments.mjs +16 -3
- package/node_modules/typebox/build/type/engine/call/instantiate.mjs +34 -4
- package/node_modules/typebox/build/type/engine/evaluate/broaden.d.mts +5 -5
- package/node_modules/typebox/build/type/engine/evaluate/broaden.mjs +20 -26
- package/node_modules/typebox/build/type/engine/evaluate/compare.d.mts +6 -10
- package/node_modules/typebox/build/type/engine/evaluate/compare.mjs +9 -13
- package/node_modules/typebox/build/type/engine/evaluate/composite.d.mts +7 -4
- package/node_modules/typebox/build/type/engine/evaluate/composite.mjs +12 -19
- package/node_modules/typebox/build/type/engine/evaluate/distribute.d.mts +4 -20
- package/node_modules/typebox/build/type/engine/evaluate/distribute.mjs +8 -20
- package/node_modules/typebox/build/type/engine/evaluate/evaluate.d.mts +4 -4
- package/node_modules/typebox/build/type/engine/evaluate/evaluate.mjs +11 -8
- package/node_modules/typebox/build/type/engine/evaluate/flatten.d.mts +1 -1
- package/node_modules/typebox/build/type/engine/evaluate/flatten.mjs +3 -4
- package/node_modules/typebox/build/type/engine/evaluate/narrow.d.mts +17 -2
- package/node_modules/typebox/build/type/engine/evaluate/narrow.mjs +26 -6
- package/node_modules/typebox/build/type/engine/exclude/operation.mjs +3 -4
- package/node_modules/typebox/build/type/engine/extract/operation.d.mts +1 -1
- package/node_modules/typebox/build/type/engine/extract/operation.mjs +3 -4
- package/node_modules/typebox/build/type/engine/priority/priority.d.mts +2 -2
- package/node_modules/typebox/build/type/engine/priority/priority.mjs +3 -4
- package/node_modules/typebox/build/type/script/mapping.d.mts +32 -29
- package/node_modules/typebox/build/type/script/mapping.mjs +18 -25
- package/node_modules/typebox/build/type/script/parser.d.mts +19 -25
- package/node_modules/typebox/build/type/script/parser.mjs +27 -23
- package/node_modules/typebox/build/value/errors/errors.d.mts +2 -2
- package/node_modules/typebox/build/value/errors/errors.mjs +1 -1
- package/node_modules/typebox/package.json +27 -27
- package/node_modules/typebox/readme.md +79 -82
- package/node_modules/undici/docs/docs/api/Client.md +21 -8
- package/node_modules/undici/lib/api/readable.js +33 -43
- package/node_modules/undici/lib/core/connect.js +16 -2
- package/node_modules/undici/lib/core/symbols.js +1 -0
- package/node_modules/undici/lib/dispatcher/client-h1.js +3 -3
- package/node_modules/undici/lib/dispatcher/client-h2.js +179 -10
- package/node_modules/undici/lib/dispatcher/client.js +74 -29
- package/node_modules/undici/lib/dispatcher/env-http-proxy-agent.js +28 -6
- package/node_modules/undici/lib/dispatcher/socks5-proxy-agent.js +15 -1
- package/node_modules/undici/lib/handler/retry-handler.js +7 -2
- package/node_modules/undici/lib/interceptor/cache.js +5 -2
- package/node_modules/undici/lib/interceptor/deduplicate.js +1 -1
- package/node_modules/undici/lib/mock/mock-utils.js +213 -24
- package/node_modules/undici/lib/util/cache.js +2 -4
- package/node_modules/undici/lib/web/websocket/websocket.js +22 -0
- package/node_modules/undici/package.json +1 -1
- package/node_modules/undici/types/client.d.ts +40 -0
- package/node_modules/ws/lib/permessage-deflate.js +3 -1
- package/node_modules/ws/package.json +1 -1
- package/openclaw.plugin.json +24 -10
- package/package.json +8 -10
- package/skills/discord/SKILL.md +1 -1
- package/dist/approval-message-safety-AcIxvrf3.js +0 -140
- package/dist/audit-core-xwjIczO0.js +0 -105
- package/dist/channel-actions-5s_hjYKd.js +0 -208
- package/dist/channel-api-CAJ0wMoV.js +0 -21
- package/dist/inbound-event-delivery-De2qxTrP.js +0 -39
- package/dist/provider.runtime-C9PnJZbZ.js +0 -2
- package/dist/runtime-api.actions.js +0 -3
- package/dist/runtime-api.lookup.js +0 -7
- package/dist/runtime-api.monitor-CHxrFPnW.js +0 -5
- package/dist/runtime-api.monitor.js +0 -8
- package/dist/runtime-api.send.js +0 -7
- package/dist/runtime-api.threads.js +0 -5
- package/dist/send.reactions-BAn0iiVQ.js +0 -78
- package/dist/send.receipt-IPI1p-SP.js +0 -66
- package/dist/subagent-hooks-CTt5KCJr.js +0 -120
- package/dist/subagent-progress-DhaE_h8a.js +0 -109
- package/dist/targets-yUFTHoAx.js +0 -3
- package/dist/transcripts-source-CfFMexGt.js +0 -123
- package/node_modules/p-map/index.d.ts +0 -155
- package/node_modules/p-map/index.js +0 -285
- package/node_modules/p-map/license +0 -9
- package/node_modules/p-map/package.json +0 -57
- package/node_modules/p-map/readme.md +0 -190
- package/node_modules/typebox/build/format/_idna.d.mts +0 -2
- package/node_modules/typebox/build/format/_idna.mjs +0 -246
- package/node_modules/typebox/build/format/_puny.d.mts +0 -1
- package/node_modules/typebox/build/format/_puny.mjs +0 -77
- package/node_modules/typebox/build/schema/resolve/ref.d.mts +0 -3
- package/node_modules/typebox/build/schema/resolve/ref.mjs +0 -146
- package/node_modules/typebox/build/schema/types/contentEncoding.d.mts +0 -9
- package/node_modules/typebox/build/schema/types/contentEncoding.mjs +0 -13
- package/node_modules/typebox/build/schema/types/contentMediaType.d.mts +0 -9
- package/node_modules/typebox/build/schema/types/contentMediaType.mjs +0 -13
- package/dist/{allow-list-DnxIlPP2.js → allow-list-BDMimASD.js} +1 -1
- package/dist/{doctor-contract-DLa-BTiU.js → doctor-contract-DsWvKIXF.js} +1 -1
|
@@ -17,6 +17,7 @@ const {
|
|
|
17
17
|
}
|
|
18
18
|
} = require('node:util')
|
|
19
19
|
const { InvalidArgumentError } = require('../core/errors')
|
|
20
|
+
const requestAborted = Symbol('request aborted')
|
|
20
21
|
|
|
21
22
|
function matchValue (match, value) {
|
|
22
23
|
if (typeof match === 'string') {
|
|
@@ -153,6 +154,11 @@ function getResponseData (data) {
|
|
|
153
154
|
return data
|
|
154
155
|
} else if (data instanceof ArrayBuffer) {
|
|
155
156
|
return data
|
|
157
|
+
} else if (ArrayBuffer.isView(data)) {
|
|
158
|
+
// A DataView, or any non-Uint8Array typed array, is a byte container
|
|
159
|
+
// rather than a plain object. Buffer.from() cannot read one directly, so
|
|
160
|
+
// expose the bytes it covers instead of letting it reach JSON.stringify.
|
|
161
|
+
return new Uint8Array(data.buffer, data.byteOffset, data.byteLength)
|
|
156
162
|
} else if (typeof data === 'object') {
|
|
157
163
|
return JSON.stringify(data)
|
|
158
164
|
} else if (data) {
|
|
@@ -225,9 +231,15 @@ function deleteMockDispatch (mockDispatches, key) {
|
|
|
225
231
|
}
|
|
226
232
|
|
|
227
233
|
/**
|
|
228
|
-
* @param {string} path Path to remove trailing slash from
|
|
234
|
+
* @param {string|RegExp|Function} path Path, or path matcher, to remove trailing slash from
|
|
229
235
|
*/
|
|
230
236
|
function removeTrailingSlash (path) {
|
|
237
|
+
// Registered path matchers may be a RegExp or a function, which have no
|
|
238
|
+
// trailing slash to strip; hand those back for matchValue to apply.
|
|
239
|
+
if (typeof path !== 'string') {
|
|
240
|
+
return path
|
|
241
|
+
}
|
|
242
|
+
|
|
231
243
|
while (path.endsWith('/')) {
|
|
232
244
|
path = path.slice(0, -1)
|
|
233
245
|
}
|
|
@@ -302,9 +314,13 @@ function mockDispatch (opts, handler) {
|
|
|
302
314
|
mockDispatch.consumed = !mockDispatch.persist && timesInvoked >= times
|
|
303
315
|
mockDispatch.pending = timesInvoked < times
|
|
304
316
|
|
|
317
|
+
const hasBodyHooks = typeof handler.onBodySent === 'function' ||
|
|
318
|
+
typeof handler.onRequestSent === 'function'
|
|
319
|
+
|
|
305
320
|
// Here's where we resolve a callback if a callback is present for the dispatch data.
|
|
306
|
-
if (mockDispatch.data.callback) {
|
|
307
|
-
const
|
|
321
|
+
if (mockDispatch.data.callback && (!hasBodyHooks || opts.body == null)) {
|
|
322
|
+
const { callback, ...responseDefaults } = mockDispatch.data
|
|
323
|
+
const callbackResult = callback(opts)
|
|
308
324
|
|
|
309
325
|
// An asynchronous reply options callback resolves to the reply data, so
|
|
310
326
|
// the dispatch can only continue once the returned promise settles.
|
|
@@ -313,18 +329,25 @@ function mockDispatch (opts, handler) {
|
|
|
313
329
|
if (isPromise(callbackResult)) {
|
|
314
330
|
callbackResult.then(
|
|
315
331
|
(resolvedData) => {
|
|
316
|
-
|
|
332
|
+
if (resolvedData == null || typeof resolvedData !== 'object') {
|
|
333
|
+
handler.onResponseError(null, new InvalidArgumentError('reply options callback must return an object'))
|
|
334
|
+
return
|
|
335
|
+
}
|
|
336
|
+
mockDispatch.data = { ...responseDefaults, ...resolvedData }
|
|
317
337
|
dispatchMockReply(mockDispatches, mockDispatch, key, opts, handler)
|
|
318
338
|
},
|
|
319
339
|
(error) => {
|
|
320
|
-
deleteMockDispatch(mockDispatches, key)
|
|
321
340
|
handler.onResponseError(null, error)
|
|
322
341
|
}
|
|
323
342
|
)
|
|
324
343
|
return true
|
|
325
344
|
}
|
|
326
345
|
|
|
327
|
-
|
|
346
|
+
if (callbackResult == null || typeof callbackResult !== 'object') {
|
|
347
|
+
throw new InvalidArgumentError('reply options callback must return an object')
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
mockDispatch.data = { ...responseDefaults, ...callbackResult }
|
|
328
351
|
}
|
|
329
352
|
|
|
330
353
|
return dispatchMockReply(mockDispatches, mockDispatch, key, opts, handler)
|
|
@@ -335,12 +358,12 @@ function mockDispatch (opts, handler) {
|
|
|
335
358
|
*/
|
|
336
359
|
function dispatchMockReply (mockDispatches, mockDispatch, key, opts, handler) {
|
|
337
360
|
// Parse mockDispatch data
|
|
338
|
-
const { data:
|
|
361
|
+
const { data: response, delay } = mockDispatch
|
|
339
362
|
|
|
340
363
|
// If specified, trigger dispatch error
|
|
341
|
-
if (error !== null) {
|
|
364
|
+
if (response.error !== null) {
|
|
342
365
|
deleteMockDispatch(mockDispatches, key)
|
|
343
|
-
handler.onResponseError(null, error)
|
|
366
|
+
handler.onResponseError(null, response.error)
|
|
344
367
|
return true
|
|
345
368
|
}
|
|
346
369
|
|
|
@@ -375,32 +398,107 @@ function dispatchMockReply (mockDispatches, mockDispatch, key, opts, handler) {
|
|
|
375
398
|
}
|
|
376
399
|
}
|
|
377
400
|
|
|
401
|
+
let replyOpts = opts
|
|
402
|
+
const dispatches = mockDispatches
|
|
403
|
+
|
|
378
404
|
// Call onRequestStart to allow the handler to receive the controller
|
|
379
405
|
handler.onRequestStart?.(controller, null)
|
|
380
406
|
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
407
|
+
if (aborted) {
|
|
408
|
+
return true
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
const requestBody = dispatchRequestBody(opts.body, handler, controller, () => aborted)
|
|
412
|
+
|
|
413
|
+
if (isPromise(requestBody)) {
|
|
414
|
+
requestBody.then((body) => {
|
|
415
|
+
if (body === requestAborted) {
|
|
416
|
+
return
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
if (body !== opts.body) {
|
|
420
|
+
replyOpts = { ...opts, body }
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
sendReply()
|
|
424
|
+
}, (error) => controller.abort(error))
|
|
425
|
+
return true
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
if (requestBody === requestAborted) {
|
|
429
|
+
return true
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
if (requestBody !== opts.body) {
|
|
433
|
+
replyOpts = { ...opts, body: requestBody }
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
sendReply()
|
|
437
|
+
|
|
438
|
+
function sendReply () {
|
|
439
|
+
if (response.callback) {
|
|
440
|
+
const { callback, ...responseDefaults } = response
|
|
441
|
+
let callbackResult
|
|
442
|
+
try {
|
|
443
|
+
callbackResult = callback(replyOpts)
|
|
444
|
+
} catch (err) {
|
|
445
|
+
deleteMockDispatch(mockDispatches, key)
|
|
446
|
+
handler.onResponseError(null, err)
|
|
447
|
+
return
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
if (isPromise(callbackResult)) {
|
|
451
|
+
callbackResult.then(
|
|
452
|
+
(resolvedData) => {
|
|
453
|
+
if (resolvedData == null || typeof resolvedData !== 'object') {
|
|
454
|
+
handler.onResponseError(null, new InvalidArgumentError('reply options callback must return an object'))
|
|
455
|
+
return
|
|
456
|
+
}
|
|
457
|
+
mockDispatch.data = { ...responseDefaults, ...resolvedData }
|
|
458
|
+
handleReply(dispatches, mockDispatch.data)
|
|
459
|
+
},
|
|
460
|
+
(err) => {
|
|
461
|
+
handler.onResponseError(null, err)
|
|
462
|
+
}
|
|
463
|
+
)
|
|
464
|
+
return
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
if (callbackResult == null || typeof callbackResult !== 'object') {
|
|
468
|
+
throw new InvalidArgumentError('reply options callback must return an object')
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
mockDispatch.data = { ...responseDefaults, ...callbackResult }
|
|
472
|
+
handleReply(dispatches, mockDispatch.data)
|
|
473
|
+
return
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
// Handle the request with a delay if necessary
|
|
477
|
+
if (typeof delay === 'number' && delay > 0) {
|
|
478
|
+
timer = setTimeout(() => {
|
|
479
|
+
timer = null
|
|
480
|
+
handleReply(dispatches)
|
|
481
|
+
}, delay)
|
|
482
|
+
} else {
|
|
483
|
+
handleReply(dispatches)
|
|
484
|
+
}
|
|
389
485
|
}
|
|
390
486
|
|
|
391
|
-
function handleReply (mockDispatches,
|
|
487
|
+
function handleReply (mockDispatches, _response = response) {
|
|
392
488
|
// Don't send response if the request was aborted
|
|
393
489
|
if (aborted) {
|
|
394
490
|
return
|
|
395
491
|
}
|
|
396
492
|
|
|
493
|
+
const { statusCode, data, headers, trailers } = _response
|
|
494
|
+
|
|
397
495
|
// fetch's HeadersList is a 1D string array
|
|
398
496
|
const optsHeaders = Array.isArray(opts.headers)
|
|
399
497
|
? buildHeadersFromArray(opts.headers)
|
|
400
498
|
: opts.headers
|
|
401
|
-
const body = typeof
|
|
402
|
-
?
|
|
403
|
-
:
|
|
499
|
+
const body = typeof data === 'function'
|
|
500
|
+
? data({ ...replyOpts, headers: optsHeaders })
|
|
501
|
+
: data
|
|
404
502
|
|
|
405
503
|
// util.types.isPromise is likely needed for jest.
|
|
406
504
|
if (isPromise(body)) {
|
|
@@ -409,7 +507,7 @@ function dispatchMockReply (mockDispatches, mockDispatch, key, opts, handler) {
|
|
|
409
507
|
// synchronously throw the error, which breaks some tests.
|
|
410
508
|
// Rather, we wait for the callback to resolve if it is a
|
|
411
509
|
// promise, and then re-run handleReply with the new body.
|
|
412
|
-
return body.then((newData) => handleReply(mockDispatches, newData))
|
|
510
|
+
return body.then((newData) => handleReply(mockDispatches, { ..._response, data: newData }))
|
|
413
511
|
}
|
|
414
512
|
|
|
415
513
|
// Check again if aborted after async body resolution
|
|
@@ -418,8 +516,8 @@ function dispatchMockReply (mockDispatches, mockDispatch, key, opts, handler) {
|
|
|
418
516
|
}
|
|
419
517
|
|
|
420
518
|
const responseData = getResponseData(body)
|
|
421
|
-
const responseHeaders = generateKeyValues(headers)
|
|
422
|
-
const responseTrailers = generateKeyValues(trailers)
|
|
519
|
+
const responseHeaders = generateKeyValues(headers ?? {})
|
|
520
|
+
const responseTrailers = generateKeyValues(trailers ?? {})
|
|
423
521
|
|
|
424
522
|
// Update the controller with response data
|
|
425
523
|
controller.rawHeaders = responseHeaders
|
|
@@ -434,6 +532,97 @@ function dispatchMockReply (mockDispatches, mockDispatch, key, opts, handler) {
|
|
|
434
532
|
return true
|
|
435
533
|
}
|
|
436
534
|
|
|
535
|
+
function dispatchRequestBody (body, handler, controller, isAborted) {
|
|
536
|
+
if (typeof handler.onBodySent !== 'function' && typeof handler.onRequestSent !== 'function') {
|
|
537
|
+
return body
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
if (body == null) {
|
|
541
|
+
return callOnRequestSent(handler, controller, isAborted) ? body : requestAborted
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
if (body && typeof body[Symbol.asyncIterator] === 'function') {
|
|
545
|
+
return dispatchAsyncIterableBody(body, handler, controller, isAborted)
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
if (isIterableBody(body)) {
|
|
549
|
+
const chunks = []
|
|
550
|
+
|
|
551
|
+
for (const chunk of body) {
|
|
552
|
+
if (isAborted()) {
|
|
553
|
+
return requestAborted
|
|
554
|
+
}
|
|
555
|
+
chunks.push(chunk)
|
|
556
|
+
if (!callOnBodySent(handler, controller, chunk) || isAborted()) {
|
|
557
|
+
return requestAborted
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
return callOnRequestSent(handler, controller, isAborted) ? chunks : requestAborted
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
if (isAborted()) {
|
|
565
|
+
return requestAborted
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
if (!callOnBodySent(handler, controller, body)) {
|
|
569
|
+
return requestAborted
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
return callOnRequestSent(handler, controller, isAborted) ? body : requestAborted
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
async function dispatchAsyncIterableBody (body, handler, controller, isAborted) {
|
|
576
|
+
const chunks = []
|
|
577
|
+
|
|
578
|
+
for await (const chunk of body) {
|
|
579
|
+
if (isAborted()) {
|
|
580
|
+
return requestAborted
|
|
581
|
+
}
|
|
582
|
+
chunks.push(chunk)
|
|
583
|
+
if (!callOnBodySent(handler, controller, chunk) || isAborted()) {
|
|
584
|
+
return requestAborted
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
if (!callOnRequestSent(handler, controller, isAborted)) {
|
|
589
|
+
return requestAborted
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
return {
|
|
593
|
+
async * [Symbol.asyncIterator] () {
|
|
594
|
+
yield * chunks
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
function callOnBodySent (handler, controller, chunk) {
|
|
600
|
+
try {
|
|
601
|
+
handler.onBodySent?.(chunk)
|
|
602
|
+
return true
|
|
603
|
+
} catch (error) {
|
|
604
|
+
controller.abort(error)
|
|
605
|
+
return false
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
function callOnRequestSent (handler, controller, isAborted) {
|
|
610
|
+
try {
|
|
611
|
+
handler.onRequestSent?.()
|
|
612
|
+
return !isAborted()
|
|
613
|
+
} catch (error) {
|
|
614
|
+
controller.abort(error)
|
|
615
|
+
return false
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
function isIterableBody (body) {
|
|
620
|
+
return typeof body !== 'string' &&
|
|
621
|
+
!Buffer.isBuffer(body) &&
|
|
622
|
+
!ArrayBuffer.isView(body) &&
|
|
623
|
+
typeof body[Symbol.iterator] === 'function'
|
|
624
|
+
}
|
|
625
|
+
|
|
437
626
|
function buildMockDispatch () {
|
|
438
627
|
const agent = this[kMockAgent]
|
|
439
628
|
const origin = this[kOrigin]
|
|
@@ -148,9 +148,7 @@ function getMalformedRestrictiveDirectiveName (key) {
|
|
|
148
148
|
* @param {import('../../types/dispatcher.d.ts').default.DispatchOptions} opts
|
|
149
149
|
*/
|
|
150
150
|
function makeCacheKey (opts) {
|
|
151
|
-
|
|
152
|
-
throw new Error('opts.origin is undefined')
|
|
153
|
-
}
|
|
151
|
+
const origin = opts.origin ? opts.origin.toString() : ''
|
|
154
152
|
|
|
155
153
|
let fullPath = opts.path || '/'
|
|
156
154
|
|
|
@@ -159,7 +157,7 @@ function makeCacheKey (opts) {
|
|
|
159
157
|
}
|
|
160
158
|
|
|
161
159
|
return {
|
|
162
|
-
origin
|
|
160
|
+
origin,
|
|
163
161
|
method: opts.method,
|
|
164
162
|
path: fullPath,
|
|
165
163
|
headers: opts.headers
|
|
@@ -25,6 +25,9 @@ const { SendQueue } = require('./sender')
|
|
|
25
25
|
const { WebsocketFrameSend } = require('./frame')
|
|
26
26
|
const { channels } = require('../../core/diagnostics')
|
|
27
27
|
|
|
28
|
+
const kRef = Symbol.for('nodejs.ref')
|
|
29
|
+
const kUnref = Symbol.for('nodejs.unref')
|
|
30
|
+
|
|
28
31
|
function getSocketAddress (socket) {
|
|
29
32
|
if (typeof socket?.address === 'function') {
|
|
30
33
|
return socket.address()
|
|
@@ -68,6 +71,7 @@ class WebSocket extends EventTarget {
|
|
|
68
71
|
#bufferedAmount = 0
|
|
69
72
|
#protocol = ''
|
|
70
73
|
#extensions = ''
|
|
74
|
+
#refed = true
|
|
71
75
|
|
|
72
76
|
/** @type {SendQueue} */
|
|
73
77
|
#sendQueue
|
|
@@ -194,6 +198,20 @@ class WebSocket extends EventTarget {
|
|
|
194
198
|
this.#binaryType = 'blob'
|
|
195
199
|
}
|
|
196
200
|
|
|
201
|
+
[kRef] () {
|
|
202
|
+
webidl.brandCheck(this, WebSocket)
|
|
203
|
+
|
|
204
|
+
this.#refed = true
|
|
205
|
+
this.#handler.socket?.ref?.()
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
[kUnref] () {
|
|
209
|
+
webidl.brandCheck(this, WebSocket)
|
|
210
|
+
|
|
211
|
+
this.#refed = false
|
|
212
|
+
this.#handler.socket?.unref?.()
|
|
213
|
+
}
|
|
214
|
+
|
|
197
215
|
/**
|
|
198
216
|
* @see https://websockets.spec.whatwg.org/#dom-websocket-close
|
|
199
217
|
* @param {number|undefined} code
|
|
@@ -468,6 +486,10 @@ class WebSocket extends EventTarget {
|
|
|
468
486
|
// once this happens, the connection is open
|
|
469
487
|
this.#handler.socket = response.socket
|
|
470
488
|
|
|
489
|
+
if (!this.#refed) {
|
|
490
|
+
this.#handler.socket.unref?.()
|
|
491
|
+
}
|
|
492
|
+
|
|
471
493
|
// Get options from dispatcher options
|
|
472
494
|
const maxFragments = this.#handler.controller.dispatcher?.webSocketOptions?.maxFragments
|
|
473
495
|
const maxPayloadSize = this.#handler.controller.dispatcher?.webSocketOptions?.maxPayloadSize
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import { URL } from 'node:url'
|
|
2
|
+
import { SessionOptions } from 'node:http2'
|
|
2
3
|
import Dispatcher from './dispatcher'
|
|
3
4
|
import buildConnector from './connector'
|
|
4
5
|
import TClientStats from './client-stats'
|
|
5
6
|
|
|
6
7
|
type ClientConnectOptions<TOpaque = null> = Omit<Dispatcher.ConnectOptions<TOpaque>, 'origin'>
|
|
7
8
|
|
|
9
|
+
// TODO: Pendings
|
|
10
|
+
// 1. Reflect this on Client instantiation
|
|
11
|
+
// 2. Client H2 should use this namespaced options instead.
|
|
12
|
+
|
|
8
13
|
/**
|
|
9
14
|
* A basic HTTP/1.1 client, mapped on top a single TCP/TLS connection. Pipelining is disabled by default.
|
|
10
15
|
*/
|
|
@@ -87,23 +92,31 @@ export declare namespace Client {
|
|
|
87
92
|
/**
|
|
88
93
|
* @description Dictates the maximum number of concurrent streams for a single H2 session. It can be overridden by a SETTINGS remote frame.
|
|
89
94
|
* @default 100
|
|
95
|
+
* @deprecated Use h2Options.maxConcurrentStreams instead
|
|
90
96
|
*/
|
|
91
97
|
maxConcurrentStreams?: number;
|
|
92
98
|
/**
|
|
93
99
|
* @description Sets the HTTP/2 stream-level flow-control window size (SETTINGS_INITIAL_WINDOW_SIZE).
|
|
94
100
|
* @default 262144
|
|
101
|
+
* @deprecated Use h2Options.settings.initialWindowSize instead
|
|
95
102
|
*/
|
|
96
103
|
initialWindowSize?: number;
|
|
97
104
|
/**
|
|
98
105
|
* @description Sets the HTTP/2 connection-level flow-control window size (ClientHttp2Session.setLocalWindowSize).
|
|
99
106
|
* @default 524288
|
|
107
|
+
* @deprecated Use h2Options.connectionWindowSize instead
|
|
100
108
|
*/
|
|
101
109
|
connectionWindowSize?: number;
|
|
102
110
|
/**
|
|
103
111
|
* @description Time interval between PING frames dispatch
|
|
104
112
|
* @default 60000
|
|
113
|
+
* @deprecated Use h2Options.connectionWindowSize instead
|
|
105
114
|
*/
|
|
106
115
|
pingInterval?: number;
|
|
116
|
+
/**
|
|
117
|
+
* @description HTTP/2 configuration options
|
|
118
|
+
*/
|
|
119
|
+
h2Options?: Client.H2Options;
|
|
107
120
|
}
|
|
108
121
|
export interface SocketInfo {
|
|
109
122
|
localAddress?: string
|
|
@@ -129,6 +142,33 @@ export declare namespace Client {
|
|
|
129
142
|
*/
|
|
130
143
|
maxPayloadSize?: number;
|
|
131
144
|
}
|
|
145
|
+
|
|
146
|
+
export interface H2Options extends Omit<SessionOptions, keyof buildConnector.BuildOptions> {
|
|
147
|
+
/**
|
|
148
|
+
* @description Sets the HTTP/2 connection-level flow-control window size (ClientHttp2Session.setLocalWindowSize).
|
|
149
|
+
* @default 524288
|
|
150
|
+
*/
|
|
151
|
+
connectionWindowSize?: number;
|
|
152
|
+
/**
|
|
153
|
+
* @description Time interval between PING frames dispatch
|
|
154
|
+
* @default 60000
|
|
155
|
+
*/
|
|
156
|
+
pingInterval?: number;
|
|
157
|
+
/**
|
|
158
|
+
* @description Dictates the maximum number of concurrent streams for a single H2 session. It can be overridden by a SETTINGS remote frame.
|
|
159
|
+
* @default 100
|
|
160
|
+
*/
|
|
161
|
+
maxConcurrentStreams?: number;
|
|
162
|
+
/**
|
|
163
|
+
* @description Enable support for H2C (plain text)
|
|
164
|
+
* @default false
|
|
165
|
+
*/
|
|
166
|
+
useH2c?: boolean;
|
|
167
|
+
/**
|
|
168
|
+
* @description SETTINGS frame object. Default to 'node:http2' defaults
|
|
169
|
+
*/
|
|
170
|
+
settings?: Omit<SessionOptions['settings'], 'enablePush' | 'maxConcurrentStreams' | 'enableConnectProtocol'>
|
|
171
|
+
}
|
|
132
172
|
}
|
|
133
173
|
|
|
134
174
|
export default Client
|
|
@@ -167,7 +167,9 @@ class PerMessageDeflate {
|
|
|
167
167
|
(typeof opts.serverMaxWindowBits === 'number' &&
|
|
168
168
|
opts.serverMaxWindowBits > params.server_max_window_bits))) ||
|
|
169
169
|
(typeof opts.clientMaxWindowBits === 'number' &&
|
|
170
|
-
|
|
170
|
+
(typeof params.client_max_window_bits === 'number'
|
|
171
|
+
? opts.clientMaxWindowBits > params.client_max_window_bits
|
|
172
|
+
: !params.client_max_window_bits))
|
|
171
173
|
) {
|
|
172
174
|
return false;
|
|
173
175
|
}
|
package/openclaw.plugin.json
CHANGED
|
@@ -17,10 +17,6 @@
|
|
|
17
17
|
"discord"
|
|
18
18
|
],
|
|
19
19
|
"contracts": {
|
|
20
|
-
"tools": [
|
|
21
|
-
"show_widget",
|
|
22
|
-
"discord_widget"
|
|
23
|
-
],
|
|
24
20
|
"transcriptSourceProviders": [
|
|
25
21
|
"discord-voice"
|
|
26
22
|
]
|
|
@@ -67,6 +63,7 @@
|
|
|
67
63
|
"type": "boolean"
|
|
68
64
|
},
|
|
69
65
|
"dmPolicy": {
|
|
66
|
+
"default": "pairing",
|
|
70
67
|
"type": "string",
|
|
71
68
|
"enum": [
|
|
72
69
|
"pairing",
|
|
@@ -363,6 +360,9 @@
|
|
|
363
360
|
}
|
|
364
361
|
]
|
|
365
362
|
},
|
|
363
|
+
"joinIntro": {
|
|
364
|
+
"type": "boolean"
|
|
365
|
+
},
|
|
366
366
|
"commands": {
|
|
367
367
|
"type": "object",
|
|
368
368
|
"properties": {
|
|
@@ -1181,6 +1181,9 @@
|
|
|
1181
1181
|
"channelId": {
|
|
1182
1182
|
"type": "string",
|
|
1183
1183
|
"minLength": 1
|
|
1184
|
+
},
|
|
1185
|
+
"whenOccupied": {
|
|
1186
|
+
"type": "boolean"
|
|
1184
1187
|
}
|
|
1185
1188
|
},
|
|
1186
1189
|
"required": [
|
|
@@ -1893,7 +1896,6 @@
|
|
|
1893
1896
|
"type": "string"
|
|
1894
1897
|
},
|
|
1895
1898
|
"groupPolicy": {
|
|
1896
|
-
"default": "allowlist",
|
|
1897
1899
|
"type": "string",
|
|
1898
1900
|
"enum": [
|
|
1899
1901
|
"open",
|
|
@@ -2171,6 +2173,9 @@
|
|
|
2171
2173
|
}
|
|
2172
2174
|
]
|
|
2173
2175
|
},
|
|
2176
|
+
"joinIntro": {
|
|
2177
|
+
"type": "boolean"
|
|
2178
|
+
},
|
|
2174
2179
|
"commands": {
|
|
2175
2180
|
"type": "object",
|
|
2176
2181
|
"properties": {
|
|
@@ -2989,6 +2994,9 @@
|
|
|
2989
2994
|
"channelId": {
|
|
2990
2995
|
"type": "string",
|
|
2991
2996
|
"minLength": 1
|
|
2997
|
+
},
|
|
2998
|
+
"whenOccupied": {
|
|
2999
|
+
"type": "boolean"
|
|
2992
3000
|
}
|
|
2993
3001
|
},
|
|
2994
3002
|
"required": [
|
|
@@ -3645,9 +3653,6 @@
|
|
|
3645
3653
|
"additionalProperties": false
|
|
3646
3654
|
}
|
|
3647
3655
|
},
|
|
3648
|
-
"required": [
|
|
3649
|
-
"groupPolicy"
|
|
3650
|
-
],
|
|
3651
3656
|
"additionalProperties": false
|
|
3652
3657
|
}
|
|
3653
3658
|
},
|
|
@@ -3656,6 +3661,7 @@
|
|
|
3656
3661
|
}
|
|
3657
3662
|
},
|
|
3658
3663
|
"required": [
|
|
3664
|
+
"dmPolicy",
|
|
3659
3665
|
"groupPolicy"
|
|
3660
3666
|
],
|
|
3661
3667
|
"additionalProperties": false
|
|
@@ -3767,6 +3773,10 @@
|
|
|
3767
3773
|
"label": "Discord Progress Command Text",
|
|
3768
3774
|
"help": "Command/exec detail in progress draft lines: \"status\" is the safe default; \"raw\" opts into command text."
|
|
3769
3775
|
},
|
|
3776
|
+
"joinIntro": {
|
|
3777
|
+
"label": "Discord Guild Join Introduction",
|
|
3778
|
+
"help": "Post one brief, room-specific introduction when the bot joins an allowed Discord guild (default: true). Account settings override the channel-wide setting."
|
|
3779
|
+
},
|
|
3770
3780
|
"proxy": {
|
|
3771
3781
|
"label": "Discord Proxy URL",
|
|
3772
3782
|
"help": "Proxy URL for Discord gateway + API requests (app-id lookup and allowlist resolution). Set per account via channels.discord.accounts.<id>.proxy."
|
|
@@ -3902,7 +3912,11 @@
|
|
|
3902
3912
|
},
|
|
3903
3913
|
"voice.autoJoin": {
|
|
3904
3914
|
"label": "Discord Voice Auto-Join",
|
|
3905
|
-
"help": "Voice channels to auto-join
|
|
3915
|
+
"help": "Voice channels to auto-join (list of guildId/channelId entries). Set whenOccupied on an entry to connect only while humans are present."
|
|
3916
|
+
},
|
|
3917
|
+
"voice.autoJoin.*.whenOccupied": {
|
|
3918
|
+
"label": "Discord Voice Auto-Join When Occupied",
|
|
3919
|
+
"help": "Join and remain in this auto-managed voice channel only while at least one human is present. The OpenClaw bot and other bots do not count. Default: false."
|
|
3906
3920
|
},
|
|
3907
3921
|
"voice.allowedChannels": {
|
|
3908
3922
|
"label": "Discord Voice Allowed Channels",
|
|
@@ -4035,7 +4049,7 @@
|
|
|
4035
4049
|
},
|
|
4036
4050
|
"activities": {
|
|
4037
4051
|
"label": "Discord Activities",
|
|
4038
|
-
"help": "Enable Discord Activity
|
|
4052
|
+
"help": "Enable the Discord Activity presenter for the core show_widget tool on this account. Activity routes and the launch handler remain disabled when this block is absent."
|
|
4039
4053
|
},
|
|
4040
4054
|
"activities.clientSecret": {
|
|
4041
4055
|
"label": "Discord Activities Client Secret",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/discord",
|
|
3
|
-
"version": "2026.8.1
|
|
3
|
+
"version": "2026.8.1",
|
|
4
4
|
"description": "OpenClaw Discord channel plugin for channels, DMs, commands, and app events.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -10,17 +10,16 @@
|
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@discord/embedded-app-sdk": "2.5.0",
|
|
12
12
|
"@discordjs/voice": "0.19.2",
|
|
13
|
-
"discord-api-types": "0.38.
|
|
13
|
+
"discord-api-types": "0.38.53",
|
|
14
14
|
"libopus-wasm": "0.2.0",
|
|
15
15
|
"mdast-util-from-markdown": "2.0.3",
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"ws": "8.21.1",
|
|
16
|
+
"typebox": "1.3.16",
|
|
17
|
+
"undici": "8.10.0",
|
|
18
|
+
"ws": "8.21.3",
|
|
20
19
|
"zod": "4.4.3"
|
|
21
20
|
},
|
|
22
21
|
"peerDependencies": {
|
|
23
|
-
"openclaw": ">=2026.8.1
|
|
22
|
+
"openclaw": ">=2026.8.1"
|
|
24
23
|
},
|
|
25
24
|
"peerDependenciesMeta": {
|
|
26
25
|
"openclaw": {
|
|
@@ -95,10 +94,10 @@
|
|
|
95
94
|
"allowInvalidConfigRecovery": true
|
|
96
95
|
},
|
|
97
96
|
"compat": {
|
|
98
|
-
"pluginApi": ">=2026.8.1
|
|
97
|
+
"pluginApi": ">=2026.8.1"
|
|
99
98
|
},
|
|
100
99
|
"build": {
|
|
101
|
-
"openclawVersion": "2026.8.1
|
|
100
|
+
"openclawVersion": "2026.8.1",
|
|
102
101
|
"staticAssets": [
|
|
103
102
|
{
|
|
104
103
|
"source": "./assets/embedded-app-sdk.mjs",
|
|
@@ -130,7 +129,6 @@
|
|
|
130
129
|
"discord-api-types",
|
|
131
130
|
"libopus-wasm",
|
|
132
131
|
"mdast-util-from-markdown",
|
|
133
|
-
"p-map",
|
|
134
132
|
"typebox",
|
|
135
133
|
"undici",
|
|
136
134
|
"ws",
|
package/skills/discord/SKILL.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: discord
|
|
3
3
|
description: "Discord messaging workflows through OpenClaw's message tool."
|
|
4
|
-
metadata: { "openclaw": { "emoji": "🎮", "requires": { "config": ["channels.discord
|
|
4
|
+
metadata: { "openclaw": { "emoji": "🎮", "requires": { "config": ["channels.discord"] } } }
|
|
5
5
|
allowed-tools: ["message"]
|
|
6
6
|
---
|
|
7
7
|
|