@openclaw/discord 2026.9.5 → 2026.9.7
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/assets/icon.png +0 -0
- package/dist/.setup/{account-inspect-BwQj24ht.mjs → account-inspect-De8hOUxG.mjs} +1 -1
- package/dist/.setup/{accounts-CwJQoLjM.mjs → accounts-ChaMcixG.mjs} +1 -4
- package/dist/.setup/{activities-api-DBwRt5ES.mjs → activities-api-tvbsU2e3.mjs} +38 -66
- package/dist/.setup/{api-CBK9zcq5.mjs → api-DVbJwZVt.mjs} +10 -2
- package/dist/.setup/{approval-handler.runtime-Du3n5ypX.mjs → approval-handler.runtime-DxCK2Rux.mjs} +49 -125
- package/dist/.setup/{approval-message-updates-BN7JtScm.mjs → approval-message-updates-BKFqavHZ.mjs} +2 -2
- package/dist/.setup/{audit-C8uaKoa9.mjs → audit-CLg9I71N.mjs} +5 -5
- package/dist/.setup/{channel-ChKdlBgH.mjs → channel-DxlUVU9t.mjs} +125 -228
- package/dist/.setup/{channel-type-DKnjV1XW.mjs → channel-type-DRCrEMss.mjs} +22 -22
- package/dist/.setup/{channel.setup-BlC3-Kzz.mjs → channel.setup-CRo1GjV7.mjs} +6 -9
- package/dist/.setup/{components-MqMWUWnE.mjs → components-Cq1PvIpN.mjs} +42 -71
- package/dist/.setup/{config-schema-CiZz-mtA.mjs → config-schema-oxELUSDx.mjs} +19 -44
- package/dist/.setup/{conversation-binding-route-_rz33QHO.mjs → conversation-binding-route-Caz_XuFH.mjs} +14 -6
- package/dist/.setup/{directory-config-BytTftz-.mjs → directory-config-esqNn0Eo.mjs} +6 -9
- package/dist/.setup/{directory-live--EGTH0DC.mjs → directory-live-DtKRHuGV.mjs} +6 -12
- package/dist/.setup/{discord-BXpHW-cu.mjs → discord-0xJYfdDD.mjs} +82 -386
- package/dist/.setup/{doctor-DxcdkXzz.mjs → doctor-BCl1H5tl.mjs} +21 -36
- package/dist/.setup/{doctor-contract-Co5vRCZ6.mjs → doctor-contract-CvvgwrrG.mjs} +41 -50
- package/dist/.setup/{channel-actions.runtime-CJmiFfps.mjs → handle-action-CUvQWnE7.mjs} +74 -105
- package/dist/.setup/{handle-action.guild-admin-DAFyh_yV.mjs → handle-action.guild-admin-Df-8gVle.mjs} +63 -121
- package/dist/.setup/{live-policy-config-eKQ-PLdy.mjs → live-policy-config-8Pv20CHc.mjs} +2 -3
- package/dist/.setup/{message-handler-DnUrDpaU.mjs → message-handler-B-Jk4oDk.mjs} +18 -93
- package/dist/.setup/message-handler.preflight-pluralkit-CWLUBVcx.mjs +141 -0
- package/dist/.setup/{message-handler.preflight-CtqaF_fb.mjs → message-handler.preflight-v-__NSDq.mjs} +73 -287
- package/dist/.setup/{message-handler.process-Dz1xvuQU.mjs → message-handler.process-BNFFuChn.mjs} +423 -374
- package/dist/.setup/{outbound-adapter-C8v79z9Z.mjs → outbound-adapter-BobT-kse.mjs} +105 -19
- package/dist/.setup/{outbound-session-route-CqWbuMOm.mjs → outbound-session-route-zVGxxceg.mjs} +142 -109
- package/dist/.setup/{pluralkit-CdAt1G0P.mjs → pluralkit-a6_NLfH9.mjs} +1 -1
- package/dist/.setup/{preflight-audio-DrnqFA8U.mjs → preflight-audio-DHGIHEpv.mjs} +2 -1
- package/dist/.setup/{presence-cache-dYSHPWMx.mjs → presence-cache-Di3H3DIU.mjs} +0 -4
- package/dist/.setup/{probe-CupW4we4.mjs → probe-LYrIHlBF.mjs} +13 -4
- package/dist/.setup/{provider-72zIvN-i.mjs → provider-B_G5hASF.mjs} +1112 -1668
- package/dist/.setup/provider-session.runtime-BYlTBFD2.mjs +6 -0
- package/dist/.setup/provider.runtime-CUE3UxER.mjs +2 -0
- package/dist/.setup/{realtime-session.runtime-DTccTgTM.mjs → realtime-session.runtime-oUd9DOcz.mjs} +372 -345
- package/dist/.setup/receive-recovery-CHPOsnLc.mjs +514 -0
- package/dist/.setup/{resolve-allowlist-common-CwMBzbx9.mjs → resolve-allowlist-common-DPdRggu5.mjs} +4 -7
- package/dist/.setup/{resolve-channels-BbvsLQOZ.mjs → resolve-channels-BFPNRmVv.mjs} +21 -40
- package/dist/.setup/{resolve-users-ByFlR7LQ.mjs → resolve-users-0-aBuCy3.mjs} +4 -4
- package/dist/.setup/{retry-DBfcEgmO.mjs → retry-pz_cSha2.mjs} +81 -16
- package/dist/.setup/rolldown-runtime-B4FMCO8f.mjs +28 -0
- package/dist/.setup/{runtime-SchNfUsQ.mjs → runtime-FN000lxA.mjs} +83 -166
- package/dist/.setup/runtime-doctor-migrations-CshUGl36.mjs +159 -0
- package/dist/.setup/{runtime-BVoa7hhx.mjs → runtime-sUksZ--Q.mjs} +2 -5
- package/dist/.setup/{secret-config-contract-DFu9hfU8.mjs → secret-config-contract-uOE2J7yM.mjs} +15 -85
- package/dist/.setup/{security-audit-s5w50-Ly.mjs → security-audit-Cdaegq7C.mjs} +3 -1
- package/dist/.setup/{send-CKDczUNL.mjs → send-CrfEI6Bs.mjs} +73 -114
- package/dist/.setup/{send.components-DWQjXhPV.mjs → send.components-DxQAMfES.mjs} +62 -107
- package/dist/.setup/{send.outbound-D0hQ7s50.mjs → send.outbound-BISKnb-a.mjs} +79 -154
- package/dist/.setup/{send.shared-Zwx6BxQ5.mjs → send.shared-DGFkbkQR.mjs} +10 -25
- package/dist/.setup/{sender-identity-0Ymgvmaj.mjs → sender-identity-B9X5Vb9R.mjs} +2 -3
- package/dist/.setup/setup-plugin-api-BQUBxbhe.mjs +3 -0
- package/dist/.setup/{shared-CaA3Vv4n.mjs → shared-B3wZ4hN-.mjs} +25 -32
- package/dist/.setup/{subagent-hooks-Bired9q6.mjs → subagent-hooks-nlUE9ow7.mjs} +5 -6
- package/dist/.setup/system-events-CdeZnvPV.mjs +33 -0
- package/dist/.setup/{target-resolver-B6MrxbYv.mjs → target-resolver-BuLapkhy.mjs} +9 -12
- package/dist/.setup/targets-0KUcEIYx.mjs +3 -0
- package/dist/.setup/{thread-bindings-CK5272V3.mjs → thread-bindings-D7TfgjR_.mjs} +33 -35
- package/dist/.setup/thread-bindings.manager-DN-NissX.mjs +819 -0
- package/dist/.setup/thread-bindings.session-updates-CshfKghV.mjs +359 -0
- package/dist/.setup/{thread-bindings.state-BThFQEga.mjs → thread-bindings.state-g6v9zAym.mjs} +21 -62
- package/dist/.setup/{transcripts-source-CuWYgayu.mjs → transcripts-source-p8EV179h.mjs} +133 -238
- package/dist/.setup/{typing-BKZL5fGj.mjs → typing-BiHCzBRu.mjs} +2 -1
- package/dist/.setup/{voice-runtime-DHVQ2mFz.mjs → voice-runtime-B46rcwrG.mjs} +633 -1085
- package/dist/account-inspect-api.js +1 -1
- package/dist/action-runtime-api.js +1 -1
- package/dist/activities-api.js +1 -1
- package/dist/api.js +18 -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 +4 -4
- package/dist/index.js +1 -1
- package/dist/runtime-api.js +20 -20
- package/dist/secret-contract-api.js +1 -1
- package/dist/security-audit-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 +1056 -0
- package/dist/subagent-hooks-api.js +3 -4
- package/dist/transcripts-source-api.js +1 -1
- package/node_modules/@napi-rs/wasm-runtime/dist/emnapi-plugins.cjs +8 -4
- package/node_modules/@napi-rs/wasm-runtime/dist/emnapi-plugins.js +8 -4
- package/node_modules/@napi-rs/wasm-runtime/dist/fs-proxy.cjs +1 -1
- package/node_modules/@napi-rs/wasm-runtime/dist/fs.js +770 -695
- package/node_modules/@napi-rs/wasm-runtime/fs-proxy.js +3 -2
- package/node_modules/@napi-rs/wasm-runtime/package.json +1 -1
- package/node_modules/@tybys/wasm-util/LICENSE +21 -0
- package/node_modules/@tybys/wasm-util/package.json +1 -1
- package/node_modules/@types/node/README.md +2 -2
- package/node_modules/@types/node/child_process.d.ts +1 -1
- package/node_modules/@types/node/crypto.d.ts +20 -8
- package/node_modules/@types/node/ffi.d.ts +14 -0
- package/node_modules/@types/node/http2.d.ts +3 -2
- package/node_modules/@types/node/net.d.ts +16 -4
- package/node_modules/@types/node/package.json +2 -17
- package/node_modules/@types/node/process.d.ts +1 -0
- package/node_modules/@types/node/quic.d.ts +39 -1
- package/node_modules/@types/node/stream/iter.d.ts +9 -12
- package/node_modules/@types/node/test/reporters.d.ts +1 -0
- package/node_modules/@types/node/test.d.ts +72 -0
- package/node_modules/@types/node/tls.d.ts +14 -10
- package/node_modules/@types/node/vm.d.ts +2 -1
- package/node_modules/@types/node/web-globals/streams.d.ts +4 -0
- package/node_modules/@types/node/worker_threads.d.ts +4 -1
- package/node_modules/typebox/build/compile/code.mjs +1 -2
- package/node_modules/typebox/build/compile/validator.mjs +5 -1
- package/node_modules/typebox/build/format/iri.mjs +16 -9
- package/node_modules/typebox/build/guard/emit.mjs +2 -2
- package/node_modules/typebox/build/guard/guard.d.mts +7 -5
- package/node_modules/typebox/build/guard/guard.mjs +14 -9
- package/node_modules/typebox/build/guard/index.mjs +6 -0
- package/node_modules/typebox/build/guard/unicode/unicode.d.mts +6 -0
- package/node_modules/typebox/build/guard/unicode/unicode.mjs +35 -0
- package/node_modules/typebox/build/guard/{string.mjs → unicode/unicode_segment.mjs} +16 -19
- package/node_modules/typebox/build/schema/build.mjs +2 -3
- package/node_modules/typebox/build/schema/engine/_pathing.d.mts +1 -0
- package/node_modules/typebox/build/schema/engine/_pathing.mjs +11 -0
- package/node_modules/typebox/build/schema/engine/_refine.mjs +13 -5
- package/node_modules/typebox/build/schema/engine/additionalProperties.mjs +2 -1
- package/node_modules/typebox/build/schema/engine/dependencies.mjs +2 -1
- package/node_modules/typebox/build/schema/engine/dependentSchemas.mjs +2 -1
- package/node_modules/typebox/build/schema/engine/dynamicRef.d.mts +1 -1
- package/node_modules/typebox/build/schema/engine/dynamicRef.mjs +2 -2
- package/node_modules/typebox/build/schema/engine/format.mjs +9 -2
- package/node_modules/typebox/build/schema/engine/patternProperties.mjs +3 -2
- package/node_modules/typebox/build/schema/engine/properties.mjs +3 -2
- package/node_modules/typebox/build/schema/engine/propertyNames.mjs +2 -1
- package/node_modules/typebox/build/schema/engine/recursiveRef.d.mts +1 -1
- package/node_modules/typebox/build/schema/engine/recursiveRef.mjs +2 -2
- package/node_modules/typebox/build/schema/engine/ref.d.mts +1 -1
- package/node_modules/typebox/build/schema/engine/ref.mjs +2 -2
- package/node_modules/typebox/build/schema/engine/schema.mjs +24 -24
- package/node_modules/typebox/build/schema/parse.mjs +3 -0
- package/node_modules/typebox/build/schema/pointer/pointer.d.mts +1 -6
- package/node_modules/typebox/build/schema/pointer/pointer.mjs +47 -64
- package/node_modules/typebox/build/system/settings/internal.d.mts +2 -0
- package/node_modules/typebox/build/system/settings/internal.mjs +20 -0
- package/node_modules/typebox/build/system/settings/settings.d.mts +11 -0
- package/node_modules/typebox/build/system/settings/settings.mjs +14 -0
- package/node_modules/typebox/build/type/extends/inference.d.mts +1 -1
- package/node_modules/typebox/build/type/extends/inference.mjs +15 -2
- package/node_modules/typebox/build/type/extends/tuple.d.mts +2 -1
- package/node_modules/typebox/build/type/extends/tuple.mjs +21 -1
- package/node_modules/typebox/build/value/parse/parse.mjs +10 -4
- package/node_modules/typebox/package.json +1 -1
- package/node_modules/typebox/readme.md +3 -1
- package/node_modules/zod/README.md +2 -2
- package/node_modules/zod/compile.cjs +19 -0
- package/node_modules/zod/index.cjs +19 -0
- package/node_modules/zod/locales/index.cjs +19 -0
- package/node_modules/zod/mini/index.cjs +19 -0
- package/node_modules/zod/package.json +8 -7
- package/node_modules/zod/src/v3/helpers/errorUtil.ts +1 -1
- package/node_modules/zod/src/v4/classic/external.ts +2 -0
- package/node_modules/zod/src/v4/classic/from-json-schema.ts +248 -25
- package/node_modules/zod/src/v4/classic/schemas.ts +243 -168
- package/node_modules/zod/src/v4/classic/tests/assignability.test.ts +60 -9
- package/node_modules/zod/src/v4/classic/tests/bigint.test.ts +6 -0
- package/node_modules/zod/src/v4/classic/tests/continuability.test.ts +2 -2
- package/node_modules/zod/src/v4/classic/tests/cyclic-data.test.ts +265 -0
- package/node_modules/zod/src/v4/classic/tests/discriminated-unions.test.ts +112 -6
- package/node_modules/zod/src/v4/classic/tests/enum.test.ts +9 -0
- package/node_modules/zod/src/v4/classic/tests/error.test.ts +130 -1
- package/node_modules/zod/src/v4/classic/tests/from-json-schema.test.ts +157 -0
- package/node_modules/zod/src/v4/classic/tests/iban.test.ts +81 -0
- package/node_modules/zod/src/v4/classic/tests/instance-footprint.test.ts +40 -2
- package/node_modules/zod/src/v4/classic/tests/instanceof.test.ts +27 -7
- package/node_modules/zod/src/v4/classic/tests/issue-schema.test.ts +88 -56
- package/node_modules/zod/src/v4/classic/tests/number.test.ts +39 -0
- package/node_modules/zod/src/v4/classic/tests/object.test.ts +56 -0
- package/node_modules/zod/src/v4/classic/tests/optin-ladder.test.ts +3 -2
- package/node_modules/zod/src/v4/classic/tests/prefault.test.ts +70 -0
- package/node_modules/zod/src/v4/classic/tests/properties.test.ts +141 -0
- package/node_modules/zod/src/v4/classic/tests/recursive-types.test.ts +46 -1
- package/node_modules/zod/src/v4/classic/tests/standard-schema.test.ts +19 -0
- package/node_modules/zod/src/v4/classic/tests/string.test.ts +95 -1
- package/node_modules/zod/src/v4/classic/tests/template-literal.test.ts +33 -1
- package/node_modules/zod/src/v4/classic/tests/to-json-schema.test.ts +234 -38
- package/node_modules/zod/src/v4/classic/tests/validate.test.ts +569 -0
- package/node_modules/zod/src/v4/core/api.ts +44 -28
- package/node_modules/zod/src/v4/core/checks.ts +62 -102
- package/node_modules/zod/src/v4/core/compile.ts +218 -93
- package/node_modules/zod/src/v4/core/core.ts +1 -3
- package/node_modules/zod/src/v4/core/doc.ts +6 -2
- package/node_modules/zod/src/v4/core/errors.ts +3 -6
- package/node_modules/zod/src/v4/core/json-schema-generator.ts +2 -2
- package/node_modules/zod/src/v4/core/json-schema-processors.ts +185 -81
- package/node_modules/zod/src/v4/core/memoizer.ts +75 -28
- package/node_modules/zod/src/v4/core/parse.ts +37 -16
- package/node_modules/zod/src/v4/core/regexes.ts +14 -4
- package/node_modules/zod/src/v4/core/schemas.ts +296 -132
- package/node_modules/zod/src/v4/core/tests/cached.test.ts +54 -0
- package/node_modules/zod/src/v4/core/tests/compile-differential.test.ts +35 -0
- package/node_modules/zod/src/v4/core/tests/compile-generative.test.ts +445 -0
- package/node_modules/zod/src/v4/core/tests/compile.test.ts +399 -2
- package/node_modules/zod/src/v4/core/tests/email-regex.test.ts +140 -0
- package/node_modules/zod/src/v4/core/tests/locales/tg.test.ts +85 -0
- package/node_modules/zod/src/v4/core/tests/polyfill-collision.test.ts +46 -0
- package/node_modules/zod/src/v4/core/tests/url-no-canparse.test.ts +118 -16
- package/node_modules/zod/src/v4/core/to-json-schema.ts +9 -7
- package/node_modules/zod/src/v4/core/util.ts +218 -147
- package/node_modules/zod/src/v4/core/versions.ts +2 -2
- package/node_modules/zod/src/v4/locales/ar.ts +2 -0
- package/node_modules/zod/src/v4/locales/az.ts +2 -0
- package/node_modules/zod/src/v4/locales/be.ts +2 -0
- package/node_modules/zod/src/v4/locales/bg.ts +2 -0
- package/node_modules/zod/src/v4/locales/bn.ts +2 -0
- package/node_modules/zod/src/v4/locales/ca.ts +2 -0
- package/node_modules/zod/src/v4/locales/ckb.ts +2 -0
- package/node_modules/zod/src/v4/locales/cs.ts +2 -0
- package/node_modules/zod/src/v4/locales/da.ts +2 -0
- package/node_modules/zod/src/v4/locales/de.ts +2 -0
- package/node_modules/zod/src/v4/locales/el.ts +2 -0
- package/node_modules/zod/src/v4/locales/en.ts +2 -0
- package/node_modules/zod/src/v4/locales/eo.ts +2 -0
- package/node_modules/zod/src/v4/locales/es.ts +2 -0
- package/node_modules/zod/src/v4/locales/fa.ts +2 -0
- package/node_modules/zod/src/v4/locales/fi.ts +2 -0
- package/node_modules/zod/src/v4/locales/fr-CA.ts +2 -0
- package/node_modules/zod/src/v4/locales/fr.ts +2 -0
- package/node_modules/zod/src/v4/locales/gu.ts +2 -0
- package/node_modules/zod/src/v4/locales/he.ts +2 -0
- package/node_modules/zod/src/v4/locales/hi.ts +2 -0
- package/node_modules/zod/src/v4/locales/hr.ts +2 -0
- package/node_modules/zod/src/v4/locales/hu.ts +2 -0
- package/node_modules/zod/src/v4/locales/hy.ts +2 -0
- package/node_modules/zod/src/v4/locales/id.ts +2 -0
- package/node_modules/zod/src/v4/locales/index.ts +1 -0
- package/node_modules/zod/src/v4/locales/is.ts +2 -0
- package/node_modules/zod/src/v4/locales/it.ts +2 -0
- package/node_modules/zod/src/v4/locales/ja.ts +2 -0
- package/node_modules/zod/src/v4/locales/ka.ts +2 -0
- package/node_modules/zod/src/v4/locales/km.ts +2 -0
- package/node_modules/zod/src/v4/locales/kn.ts +2 -0
- package/node_modules/zod/src/v4/locales/ko.ts +2 -0
- package/node_modules/zod/src/v4/locales/lt.ts +2 -0
- package/node_modules/zod/src/v4/locales/mk.ts +2 -0
- package/node_modules/zod/src/v4/locales/ms.ts +2 -0
- package/node_modules/zod/src/v4/locales/ne.ts +2 -0
- package/node_modules/zod/src/v4/locales/nl.ts +2 -0
- package/node_modules/zod/src/v4/locales/nn.ts +2 -0
- package/node_modules/zod/src/v4/locales/no.ts +2 -0
- package/node_modules/zod/src/v4/locales/ota.ts +2 -0
- package/node_modules/zod/src/v4/locales/pl.ts +2 -0
- package/node_modules/zod/src/v4/locales/ps.ts +2 -0
- package/node_modules/zod/src/v4/locales/pt-BR.ts +2 -0
- package/node_modules/zod/src/v4/locales/pt.ts +2 -0
- package/node_modules/zod/src/v4/locales/ro.ts +2 -0
- package/node_modules/zod/src/v4/locales/ru.ts +2 -0
- package/node_modules/zod/src/v4/locales/sk.ts +2 -0
- package/node_modules/zod/src/v4/locales/sl.ts +2 -0
- package/node_modules/zod/src/v4/locales/sv.ts +2 -0
- package/node_modules/zod/src/v4/locales/ta.ts +2 -0
- package/node_modules/zod/src/v4/locales/tg.ts +135 -0
- package/node_modules/zod/src/v4/locales/th.ts +2 -0
- package/node_modules/zod/src/v4/locales/tk.ts +2 -0
- package/node_modules/zod/src/v4/locales/tr.ts +2 -0
- package/node_modules/zod/src/v4/locales/uk.ts +2 -0
- package/node_modules/zod/src/v4/locales/ur.ts +2 -0
- package/node_modules/zod/src/v4/locales/uz.ts +2 -0
- package/node_modules/zod/src/v4/locales/vi.ts +2 -0
- package/node_modules/zod/src/v4/locales/yo.ts +2 -0
- package/node_modules/zod/src/v4/locales/zh-CN.ts +2 -0
- package/node_modules/zod/src/v4/locales/zh-TW.ts +2 -0
- package/node_modules/zod/src/v4/mini/external.ts +2 -0
- package/node_modules/zod/src/v4/mini/schemas.ts +32 -7
- package/node_modules/zod/src/v4/mini/tests/checks.test.ts +1 -1
- package/node_modules/zod/src/v4/mini/tests/computed.test.ts +11 -17
- package/node_modules/zod/src/v4/mini/tests/index.test.ts +86 -0
- package/node_modules/zod/src/v4/mini/tests/recursive-types.test.ts +16 -0
- package/node_modules/zod/src/v4/mini/tests/string.test.ts +23 -0
- package/node_modules/zod/v3/ZodError.cjs +19 -0
- package/node_modules/zod/v3/errors.cjs +19 -0
- package/node_modules/zod/v3/external.cjs +19 -0
- package/node_modules/zod/v3/helpers/enumUtil.cjs +19 -0
- package/node_modules/zod/v3/helpers/errorUtil.cjs +20 -1
- package/node_modules/zod/v3/helpers/errorUtil.js +1 -1
- package/node_modules/zod/v3/helpers/parseUtil.cjs +19 -0
- package/node_modules/zod/v3/helpers/partialUtil.cjs +19 -0
- package/node_modules/zod/v3/helpers/typeAliases.cjs +19 -0
- package/node_modules/zod/v3/helpers/util.cjs +19 -0
- package/node_modules/zod/v3/index.cjs +19 -0
- package/node_modules/zod/v3/standard-schema.cjs +19 -0
- package/node_modules/zod/v3/types.cjs +19 -0
- package/node_modules/zod/v4/classic/checks.cjs +19 -0
- package/node_modules/zod/v4/classic/coerce.cjs +19 -0
- package/node_modules/zod/v4/classic/compat.cjs +19 -0
- package/node_modules/zod/v4/classic/deep-partial.cjs +19 -0
- package/node_modules/zod/v4/classic/errors.cjs +19 -0
- package/node_modules/zod/v4/classic/external.cjs +22 -1
- package/node_modules/zod/v4/classic/external.d.cts +1 -1
- package/node_modules/zod/v4/classic/external.d.ts +1 -1
- package/node_modules/zod/v4/classic/external.js +1 -1
- package/node_modules/zod/v4/classic/from-json-schema.cjs +264 -24
- package/node_modules/zod/v4/classic/from-json-schema.js +245 -24
- package/node_modules/zod/v4/classic/in-out.cjs +19 -0
- package/node_modules/zod/v4/classic/index.cjs +19 -0
- package/node_modules/zod/v4/classic/iso.cjs +19 -0
- package/node_modules/zod/v4/classic/parse.cjs +19 -0
- package/node_modules/zod/v4/classic/schemas.cjs +100 -35
- package/node_modules/zod/v4/classic/schemas.d.cts +15 -1
- package/node_modules/zod/v4/classic/schemas.d.ts +15 -1
- package/node_modules/zod/v4/classic/schemas.js +77 -33
- package/node_modules/zod/v4/core/api.cjs +45 -22
- package/node_modules/zod/v4/core/api.d.cts +12 -6
- package/node_modules/zod/v4/core/api.d.ts +12 -6
- package/node_modules/zod/v4/core/api.js +25 -22
- package/node_modules/zod/v4/core/checks.cjs +51 -97
- package/node_modules/zod/v4/core/checks.d.cts +17 -1
- package/node_modules/zod/v4/core/checks.d.ts +17 -1
- package/node_modules/zod/v4/core/checks.js +31 -96
- package/node_modules/zod/v4/core/compile.cjs +173 -78
- package/node_modules/zod/v4/core/compile.d.cts +18 -4
- package/node_modules/zod/v4/core/compile.d.ts +18 -4
- package/node_modules/zod/v4/core/compile.js +154 -79
- package/node_modules/zod/v4/core/core.cjs +20 -1
- package/node_modules/zod/v4/core/core.js +1 -1
- package/node_modules/zod/v4/core/doc.cjs +26 -2
- package/node_modules/zod/v4/core/doc.js +7 -2
- package/node_modules/zod/v4/core/errors.cjs +21 -5
- package/node_modules/zod/v4/core/errors.js +2 -5
- package/node_modules/zod/v4/core/index.cjs +19 -0
- package/node_modules/zod/v4/core/json-schema-generator.cjs +20 -1
- package/node_modules/zod/v4/core/json-schema-generator.js +2 -2
- package/node_modules/zod/v4/core/json-schema-processors.cjs +188 -72
- package/node_modules/zod/v4/core/json-schema-processors.d.cts +16 -0
- package/node_modules/zod/v4/core/json-schema-processors.d.ts +16 -0
- package/node_modules/zod/v4/core/json-schema-processors.js +170 -74
- package/node_modules/zod/v4/core/json-schema.cjs +19 -0
- package/node_modules/zod/v4/core/memoizer.cjs +111 -23
- package/node_modules/zod/v4/core/memoizer.js +69 -23
- package/node_modules/zod/v4/core/parse.cjs +56 -16
- package/node_modules/zod/v4/core/parse.js +37 -16
- package/node_modules/zod/v4/core/regexes.cjs +31 -6
- package/node_modules/zod/v4/core/regexes.d.cts +3 -0
- package/node_modules/zod/v4/core/regexes.d.ts +3 -0
- package/node_modules/zod/v4/core/regexes.js +10 -4
- package/node_modules/zod/v4/core/registries.cjs +19 -0
- package/node_modules/zod/v4/core/schemas.cjs +302 -114
- package/node_modules/zod/v4/core/schemas.d.cts +28 -8
- package/node_modules/zod/v4/core/schemas.d.ts +28 -8
- package/node_modules/zod/v4/core/schemas.js +279 -113
- package/node_modules/zod/v4/core/standard-schema.cjs +19 -0
- package/node_modules/zod/v4/core/to-json-schema.cjs +28 -7
- package/node_modules/zod/v4/core/to-json-schema.d.cts +4 -3
- package/node_modules/zod/v4/core/to-json-schema.d.ts +4 -3
- package/node_modules/zod/v4/core/to-json-schema.js +7 -6
- package/node_modules/zod/v4/core/util.cjs +177 -143
- package/node_modules/zod/v4/core/util.d.cts +25 -4
- package/node_modules/zod/v4/core/util.d.ts +25 -4
- package/node_modules/zod/v4/core/util.js +156 -143
- package/node_modules/zod/v4/core/versions.cjs +21 -2
- package/node_modules/zod/v4/core/versions.d.cts +1 -1
- package/node_modules/zod/v4/core/versions.d.ts +1 -1
- package/node_modules/zod/v4/core/versions.js +2 -2
- package/node_modules/zod/v4/core/visit.cjs +19 -0
- package/node_modules/zod/v4/index.cjs +19 -0
- package/node_modules/zod/v4/locales/ar.cjs +2 -0
- package/node_modules/zod/v4/locales/ar.js +2 -0
- package/node_modules/zod/v4/locales/az.cjs +2 -0
- package/node_modules/zod/v4/locales/az.js +2 -0
- package/node_modules/zod/v4/locales/be.cjs +2 -0
- package/node_modules/zod/v4/locales/be.js +2 -0
- package/node_modules/zod/v4/locales/bg.cjs +2 -0
- package/node_modules/zod/v4/locales/bg.js +2 -0
- package/node_modules/zod/v4/locales/bn.cjs +2 -0
- package/node_modules/zod/v4/locales/bn.js +2 -0
- package/node_modules/zod/v4/locales/ca.cjs +2 -0
- package/node_modules/zod/v4/locales/ca.js +2 -0
- package/node_modules/zod/v4/locales/ckb.cjs +2 -0
- package/node_modules/zod/v4/locales/ckb.js +2 -0
- package/node_modules/zod/v4/locales/cs.cjs +2 -0
- package/node_modules/zod/v4/locales/cs.js +2 -0
- package/node_modules/zod/v4/locales/da.cjs +2 -0
- package/node_modules/zod/v4/locales/da.js +2 -0
- package/node_modules/zod/v4/locales/de.cjs +2 -0
- package/node_modules/zod/v4/locales/de.js +2 -0
- package/node_modules/zod/v4/locales/el.cjs +2 -0
- package/node_modules/zod/v4/locales/el.js +2 -0
- package/node_modules/zod/v4/locales/en.cjs +2 -0
- package/node_modules/zod/v4/locales/en.js +2 -0
- package/node_modules/zod/v4/locales/eo.cjs +2 -0
- package/node_modules/zod/v4/locales/eo.js +2 -0
- package/node_modules/zod/v4/locales/es.cjs +2 -0
- package/node_modules/zod/v4/locales/es.js +2 -0
- package/node_modules/zod/v4/locales/fa.cjs +2 -0
- package/node_modules/zod/v4/locales/fa.js +2 -0
- package/node_modules/zod/v4/locales/fi.cjs +2 -0
- package/node_modules/zod/v4/locales/fi.js +2 -0
- package/node_modules/zod/v4/locales/fr-CA.cjs +2 -0
- package/node_modules/zod/v4/locales/fr-CA.js +2 -0
- package/node_modules/zod/v4/locales/fr.cjs +2 -0
- package/node_modules/zod/v4/locales/fr.js +2 -0
- package/node_modules/zod/v4/locales/gu.cjs +2 -0
- package/node_modules/zod/v4/locales/gu.js +2 -0
- package/node_modules/zod/v4/locales/he.cjs +2 -0
- package/node_modules/zod/v4/locales/he.js +2 -0
- package/node_modules/zod/v4/locales/hi.cjs +2 -0
- package/node_modules/zod/v4/locales/hi.js +2 -0
- package/node_modules/zod/v4/locales/hr.cjs +2 -0
- package/node_modules/zod/v4/locales/hr.js +2 -0
- package/node_modules/zod/v4/locales/hu.cjs +2 -0
- package/node_modules/zod/v4/locales/hu.js +2 -0
- package/node_modules/zod/v4/locales/hy.cjs +2 -0
- package/node_modules/zod/v4/locales/hy.js +2 -0
- package/node_modules/zod/v4/locales/id.cjs +2 -0
- package/node_modules/zod/v4/locales/id.js +2 -0
- package/node_modules/zod/v4/locales/index.cjs +22 -1
- package/node_modules/zod/v4/locales/index.d.cts +1 -0
- package/node_modules/zod/v4/locales/index.d.ts +1 -0
- package/node_modules/zod/v4/locales/index.js +1 -0
- package/node_modules/zod/v4/locales/is.cjs +2 -0
- package/node_modules/zod/v4/locales/is.js +2 -0
- package/node_modules/zod/v4/locales/it.cjs +2 -0
- package/node_modules/zod/v4/locales/it.js +2 -0
- package/node_modules/zod/v4/locales/ja.cjs +2 -0
- package/node_modules/zod/v4/locales/ja.js +2 -0
- package/node_modules/zod/v4/locales/ka.cjs +2 -0
- package/node_modules/zod/v4/locales/ka.js +2 -0
- package/node_modules/zod/v4/locales/km.cjs +2 -0
- package/node_modules/zod/v4/locales/km.js +2 -0
- package/node_modules/zod/v4/locales/kn.cjs +2 -0
- package/node_modules/zod/v4/locales/kn.js +2 -0
- package/node_modules/zod/v4/locales/ko.cjs +2 -0
- package/node_modules/zod/v4/locales/ko.js +2 -0
- package/node_modules/zod/v4/locales/lt.cjs +2 -0
- package/node_modules/zod/v4/locales/lt.js +2 -0
- package/node_modules/zod/v4/locales/mk.cjs +2 -0
- package/node_modules/zod/v4/locales/mk.js +2 -0
- package/node_modules/zod/v4/locales/ms.cjs +2 -0
- package/node_modules/zod/v4/locales/ms.js +2 -0
- package/node_modules/zod/v4/locales/ne.cjs +2 -0
- package/node_modules/zod/v4/locales/ne.js +2 -0
- package/node_modules/zod/v4/locales/nl.cjs +2 -0
- package/node_modules/zod/v4/locales/nl.js +2 -0
- package/node_modules/zod/v4/locales/nn.cjs +2 -0
- package/node_modules/zod/v4/locales/nn.js +2 -0
- package/node_modules/zod/v4/locales/no.cjs +2 -0
- package/node_modules/zod/v4/locales/no.js +2 -0
- package/node_modules/zod/v4/locales/ota.cjs +2 -0
- package/node_modules/zod/v4/locales/ota.js +2 -0
- package/node_modules/zod/v4/locales/pl.cjs +2 -0
- package/node_modules/zod/v4/locales/pl.js +2 -0
- package/node_modules/zod/v4/locales/ps.cjs +2 -0
- package/node_modules/zod/v4/locales/ps.js +2 -0
- package/node_modules/zod/v4/locales/pt-BR.cjs +2 -0
- package/node_modules/zod/v4/locales/pt-BR.js +2 -0
- package/node_modules/zod/v4/locales/pt.cjs +2 -0
- package/node_modules/zod/v4/locales/pt.js +2 -0
- package/node_modules/zod/v4/locales/ro.cjs +2 -0
- package/node_modules/zod/v4/locales/ro.js +2 -0
- package/node_modules/zod/v4/locales/ru.cjs +2 -0
- package/node_modules/zod/v4/locales/ru.js +2 -0
- package/node_modules/zod/v4/locales/sk.cjs +2 -0
- package/node_modules/zod/v4/locales/sk.js +2 -0
- package/node_modules/zod/v4/locales/sl.cjs +2 -0
- package/node_modules/zod/v4/locales/sl.js +2 -0
- package/node_modules/zod/v4/locales/sv.cjs +2 -0
- package/node_modules/zod/v4/locales/sv.js +2 -0
- package/node_modules/zod/v4/locales/ta.cjs +2 -0
- package/node_modules/zod/v4/locales/ta.js +2 -0
- package/node_modules/zod/v4/locales/tg.cjs +144 -0
- package/node_modules/zod/v4/locales/tg.d.cts +5 -0
- package/node_modules/zod/v4/locales/tg.d.ts +4 -0
- package/node_modules/zod/v4/locales/tg.js +117 -0
- package/node_modules/zod/v4/locales/th.cjs +2 -0
- package/node_modules/zod/v4/locales/th.js +2 -0
- package/node_modules/zod/v4/locales/tk.cjs +2 -0
- package/node_modules/zod/v4/locales/tk.js +2 -0
- package/node_modules/zod/v4/locales/tr.cjs +2 -0
- package/node_modules/zod/v4/locales/tr.js +2 -0
- package/node_modules/zod/v4/locales/uk.cjs +2 -0
- package/node_modules/zod/v4/locales/uk.js +2 -0
- package/node_modules/zod/v4/locales/ur.cjs +2 -0
- package/node_modules/zod/v4/locales/ur.js +2 -0
- package/node_modules/zod/v4/locales/uz.cjs +2 -0
- package/node_modules/zod/v4/locales/uz.js +2 -0
- package/node_modules/zod/v4/locales/vi.cjs +2 -0
- package/node_modules/zod/v4/locales/vi.js +2 -0
- package/node_modules/zod/v4/locales/yo.cjs +2 -0
- package/node_modules/zod/v4/locales/yo.js +2 -0
- package/node_modules/zod/v4/locales/zh-CN.cjs +2 -0
- package/node_modules/zod/v4/locales/zh-CN.js +2 -0
- package/node_modules/zod/v4/locales/zh-TW.cjs +2 -0
- package/node_modules/zod/v4/locales/zh-TW.js +2 -0
- package/node_modules/zod/v4/mini/checks.cjs +19 -0
- package/node_modules/zod/v4/mini/coerce.cjs +19 -0
- package/node_modules/zod/v4/mini/deep-partial.cjs +19 -0
- package/node_modules/zod/v4/mini/external.cjs +22 -1
- package/node_modules/zod/v4/mini/external.d.cts +1 -1
- package/node_modules/zod/v4/mini/external.d.ts +1 -1
- package/node_modules/zod/v4/mini/external.js +1 -1
- package/node_modules/zod/v4/mini/in-out.cjs +19 -0
- package/node_modules/zod/v4/mini/index.cjs +19 -0
- package/node_modules/zod/v4/mini/iso.cjs +19 -0
- package/node_modules/zod/v4/mini/parse.cjs +19 -0
- package/node_modules/zod/v4/mini/schemas.cjs +44 -8
- package/node_modules/zod/v4/mini/schemas.d.cts +6 -1
- package/node_modules/zod/v4/mini/schemas.d.ts +6 -1
- package/node_modules/zod/v4/mini/schemas.js +21 -6
- package/node_modules/zod/v4-mini/index.cjs +19 -0
- package/openclaw.plugin.json +21 -1
- package/package.json +9 -6
- package/dist/.setup/agent-components.runtime-CEPrf2SY.mjs +0 -4
- package/dist/.setup/message-handler.history-CJOsN9w5.mjs +0 -28
- package/dist/.setup/probe.runtime-DBQ_AGPe.mjs +0 -2
- package/dist/.setup/provider-session.runtime-BW7QrF5C.mjs +0 -6
- package/dist/.setup/provider.runtime-DuhmKdDU.mjs +0 -2
- package/dist/.setup/security-audit.runtime-DHtYenx9.mjs +0 -2
- package/dist/.setup/setup-plugin-api-CINIEBLa.mjs +0 -3
- package/dist/.setup/system-events-B2YEEMbS.mjs +0 -34
- package/dist/.setup/targets-D1mAB5yO.mjs +0 -3
- package/dist/.setup/thread-bindings.manager-eexkKyrG.mjs +0 -678
- package/dist/.setup/thread-bindings.session-updates-DCQq1WZ5.mjs +0 -55
- /package/node_modules/typebox/build/guard/{string.d.mts → unicode/unicode_segment.d.mts} +0 -0
|
@@ -0,0 +1,514 @@
|
|
|
1
|
+
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
2
|
+
import { logVerbose, shouldLogVerbose } from "openclaw/plugin-sdk/runtime-env";
|
|
3
|
+
import { Duplex } from "node:stream";
|
|
4
|
+
import { spawn } from "node:child_process";
|
|
5
|
+
import { StringDecoder } from "node:string_decoder";
|
|
6
|
+
import { Application, OpusError, createDecoder, createEncoder } from "libopus-wasm";
|
|
7
|
+
import { resolveFfmpegBin } from "openclaw/plugin-sdk/media-runtime";
|
|
8
|
+
import { createStreamingPcmResampler } from "openclaw/plugin-sdk/realtime-voice-provider";
|
|
9
|
+
import { resolvePreferredOpenClawTmpDir, tempWorkspace } from "openclaw/plugin-sdk/temp-path";
|
|
10
|
+
//#region extensions/discord/src/voice/audio-worker-protocol.ts
|
|
11
|
+
const DISCORD_AUDIO_OUTPUT_STATUS = 1;
|
|
12
|
+
const DiscordAudioOutputStatus = {
|
|
13
|
+
Buffering: 0n,
|
|
14
|
+
Playing: 1n,
|
|
15
|
+
Retiring: 2n,
|
|
16
|
+
Closed: 3n
|
|
17
|
+
};
|
|
18
|
+
const OUTPUT_STATUS_MASK = 3n;
|
|
19
|
+
const OUTPUT_INPUT_RESERVATION = 4n;
|
|
20
|
+
function getDiscordAudioOutputStatus(clock) {
|
|
21
|
+
return Atomics.load(clock, DISCORD_AUDIO_OUTPUT_STATUS) & OUTPUT_STATUS_MASK;
|
|
22
|
+
}
|
|
23
|
+
function setDiscordAudioOutputStatus(clock, status) {
|
|
24
|
+
for (;;) {
|
|
25
|
+
const current = Atomics.load(clock, DISCORD_AUDIO_OUTPUT_STATUS);
|
|
26
|
+
if ((current & OUTPUT_STATUS_MASK) >= status) return;
|
|
27
|
+
const next = current & -4n | status;
|
|
28
|
+
if (Atomics.compareExchange(clock, DISCORD_AUDIO_OUTPUT_STATUS, current, next) === current) return;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
function admitDiscordAudioInput(clock) {
|
|
32
|
+
for (;;) {
|
|
33
|
+
const current = Atomics.load(clock, DISCORD_AUDIO_OUTPUT_STATUS);
|
|
34
|
+
if ((current & OUTPUT_STATUS_MASK) >= DiscordAudioOutputStatus.Retiring) return false;
|
|
35
|
+
if (Atomics.compareExchange(clock, DISCORD_AUDIO_OUTPUT_STATUS, current, current + OUTPUT_INPUT_RESERVATION) === current) return true;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
function releaseDiscordAudioInput(clock) {
|
|
39
|
+
Atomics.sub(clock, DISCORD_AUDIO_OUTPUT_STATUS, OUTPUT_INPUT_RESERVATION);
|
|
40
|
+
}
|
|
41
|
+
function retireDiscordAudioOutput(clock) {
|
|
42
|
+
for (;;) {
|
|
43
|
+
const current = Atomics.load(clock, DISCORD_AUDIO_OUTPUT_STATUS);
|
|
44
|
+
if ((current & OUTPUT_STATUS_MASK) >= DiscordAudioOutputStatus.Retiring) return true;
|
|
45
|
+
if (current >= OUTPUT_INPUT_RESERVATION) return false;
|
|
46
|
+
if (Atomics.compareExchange(clock, DISCORD_AUDIO_OUTPUT_STATUS, current, DiscordAudioOutputStatus.Retiring) === current) return true;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
function serializeDiscordAudioError(error) {
|
|
50
|
+
if (!(error instanceof Error)) return {
|
|
51
|
+
name: "Error",
|
|
52
|
+
message: String(error)
|
|
53
|
+
};
|
|
54
|
+
return {
|
|
55
|
+
name: error.name,
|
|
56
|
+
message: error.message,
|
|
57
|
+
..."code" in error && typeof error.code === "number" ? { code: error.code } : {},
|
|
58
|
+
..."codeName" in error && typeof error.codeName === "string" ? { codeName: error.codeName } : {},
|
|
59
|
+
..."operation" in error && typeof error.operation === "string" ? { operation: error.operation } : {}
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
function restoreDiscordAudioError(error) {
|
|
63
|
+
return Object.assign(new Error(error.message), error);
|
|
64
|
+
}
|
|
65
|
+
//#endregion
|
|
66
|
+
//#region extensions/discord/src/voice/audio.ts
|
|
67
|
+
const SAMPLE_RATE = 48e3;
|
|
68
|
+
const CHANNELS = 2;
|
|
69
|
+
const BIT_DEPTH = 16;
|
|
70
|
+
const FFMPEG_ERROR_OUTPUT_BYTES = 8192;
|
|
71
|
+
const DISCORD_OPUS_FRAME_SIZE = 960;
|
|
72
|
+
const DISCORD_OPUS_MAX_DECODE_FRAME_SIZE = SAMPLE_RATE * 120 / 1e3;
|
|
73
|
+
const DISCORD_OPUS_ENCODE_BATCH_FRAMES = 8;
|
|
74
|
+
const DISCORD_OPUS_FRAME_BYTES = DISCORD_OPUS_FRAME_SIZE * CHANNELS * (BIT_DEPTH / 8);
|
|
75
|
+
const FFMPEG_PCM_ARGUMENTS = [
|
|
76
|
+
"-analyzeduration",
|
|
77
|
+
"0",
|
|
78
|
+
"-loglevel",
|
|
79
|
+
"error",
|
|
80
|
+
"-vn",
|
|
81
|
+
"-sn",
|
|
82
|
+
"-dn",
|
|
83
|
+
"-f",
|
|
84
|
+
"s16le",
|
|
85
|
+
"-ar",
|
|
86
|
+
String(SAMPLE_RATE),
|
|
87
|
+
"-ac",
|
|
88
|
+
String(CHANNELS)
|
|
89
|
+
];
|
|
90
|
+
let warnedOpusMissing = false;
|
|
91
|
+
function buildWavBuffer(chunks) {
|
|
92
|
+
const pcmBytes = chunks.reduce((total, chunk) => total + chunk.length, 0);
|
|
93
|
+
const blockAlign = 4;
|
|
94
|
+
const byteRate = SAMPLE_RATE * blockAlign;
|
|
95
|
+
const wav = Buffer.allocUnsafe(44 + pcmBytes);
|
|
96
|
+
const header = wav.subarray(0, 44);
|
|
97
|
+
header.write("RIFF", 0);
|
|
98
|
+
header.writeUInt32LE(36 + pcmBytes, 4);
|
|
99
|
+
header.write("WAVE", 8);
|
|
100
|
+
header.write("fmt ", 12);
|
|
101
|
+
header.writeUInt32LE(16, 16);
|
|
102
|
+
header.writeUInt16LE(1, 20);
|
|
103
|
+
header.writeUInt16LE(CHANNELS, 22);
|
|
104
|
+
header.writeUInt32LE(SAMPLE_RATE, 24);
|
|
105
|
+
header.writeUInt32LE(byteRate, 28);
|
|
106
|
+
header.writeUInt16LE(blockAlign, 32);
|
|
107
|
+
header.writeUInt16LE(BIT_DEPTH, 34);
|
|
108
|
+
header.write("data", 36);
|
|
109
|
+
header.writeUInt32LE(pcmBytes, 40);
|
|
110
|
+
let offset = 44;
|
|
111
|
+
for (const chunk of chunks) offset += chunk.copy(wav, offset);
|
|
112
|
+
return wav;
|
|
113
|
+
}
|
|
114
|
+
function createDiscordOpusEncodeStream() {
|
|
115
|
+
return new DiscordOpusEncodeStream();
|
|
116
|
+
}
|
|
117
|
+
function createDiscordOpusPlaybackStream(input) {
|
|
118
|
+
const inputSource = typeof input === "string" ? input : "pipe:0";
|
|
119
|
+
const ffmpeg = spawn(resolveFfmpegBin(), [
|
|
120
|
+
"-i",
|
|
121
|
+
inputSource,
|
|
122
|
+
...FFMPEG_PCM_ARGUMENTS,
|
|
123
|
+
"pipe:1"
|
|
124
|
+
], {
|
|
125
|
+
stdio: [
|
|
126
|
+
"pipe",
|
|
127
|
+
"pipe",
|
|
128
|
+
"pipe"
|
|
129
|
+
],
|
|
130
|
+
windowsHide: true
|
|
131
|
+
});
|
|
132
|
+
const opusStream = createDiscordOpusEncodeStream();
|
|
133
|
+
const stderr = Buffer.alloc(FFMPEG_ERROR_OUTPUT_BYTES);
|
|
134
|
+
let stderrBytes = 0;
|
|
135
|
+
let ffmpegClosed = false;
|
|
136
|
+
const killFfmpeg = (signal = "SIGTERM") => {
|
|
137
|
+
if (!ffmpegClosed && !ffmpeg.killed) ffmpeg.kill(signal);
|
|
138
|
+
};
|
|
139
|
+
ffmpeg.stderr.on("data", (chunk) => {
|
|
140
|
+
if (stderrBytes < FFMPEG_ERROR_OUTPUT_BYTES) stderrBytes += chunk.copy(stderr, stderrBytes, 0, FFMPEG_ERROR_OUTPUT_BYTES - stderrBytes);
|
|
141
|
+
});
|
|
142
|
+
ffmpeg.once("error", (err) => {
|
|
143
|
+
opusStream.destroy(err);
|
|
144
|
+
});
|
|
145
|
+
ffmpeg.once("close", (code, signal) => {
|
|
146
|
+
ffmpegClosed = true;
|
|
147
|
+
if (code && code !== 0) {
|
|
148
|
+
const stderrText = new StringDecoder("utf8").write(stderr.subarray(0, stderrBytes)).trim();
|
|
149
|
+
const suffix = stderrText ? `: ${stderrText}` : "";
|
|
150
|
+
opusStream.destroy(/* @__PURE__ */ new Error(`ffmpeg exited with code ${code}${suffix}`));
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
if (signal) opusStream.destroy(/* @__PURE__ */ new Error(`ffmpeg exited with signal ${signal}`));
|
|
154
|
+
});
|
|
155
|
+
for (const readable of [ffmpeg.stdout, ffmpeg.stderr]) readable.on("error", (err) => {
|
|
156
|
+
killFfmpeg("SIGKILL");
|
|
157
|
+
opusStream.destroy(err);
|
|
158
|
+
});
|
|
159
|
+
ffmpeg.stdin.on("error", (err) => {
|
|
160
|
+
if (err.code !== "EPIPE") opusStream.destroy(err);
|
|
161
|
+
});
|
|
162
|
+
ffmpeg.stdout.pipe(opusStream);
|
|
163
|
+
opusStream.once("close", () => {
|
|
164
|
+
if (!opusStream.readableEnded) killFfmpeg();
|
|
165
|
+
});
|
|
166
|
+
if (typeof input !== "string") {
|
|
167
|
+
input.on("error", (err) => {
|
|
168
|
+
ffmpeg.stdin.destroy(err);
|
|
169
|
+
opusStream.destroy(err);
|
|
170
|
+
});
|
|
171
|
+
input.pipe(ffmpeg.stdin);
|
|
172
|
+
} else ffmpeg.stdin.end();
|
|
173
|
+
return opusStream;
|
|
174
|
+
}
|
|
175
|
+
var DiscordOpusEncodeStream = class extends Duplex {
|
|
176
|
+
#partialFrame = Buffer.alloc(DISCORD_OPUS_FRAME_BYTES);
|
|
177
|
+
#partialBytes = 0;
|
|
178
|
+
#pending;
|
|
179
|
+
#scheduled;
|
|
180
|
+
#readBlocked = false;
|
|
181
|
+
#partialFlushRequested = false;
|
|
182
|
+
#encoder;
|
|
183
|
+
#packetPcmBytes = /* @__PURE__ */ new WeakMap();
|
|
184
|
+
constructor() {
|
|
185
|
+
super({ readableObjectMode: true });
|
|
186
|
+
}
|
|
187
|
+
_construct(done) {
|
|
188
|
+
createEncoder({
|
|
189
|
+
application: Application.Audio,
|
|
190
|
+
channels: CHANNELS,
|
|
191
|
+
sampleRate: SAMPLE_RATE
|
|
192
|
+
}).then((encoder) => {
|
|
193
|
+
this.#encoder = encoder;
|
|
194
|
+
done();
|
|
195
|
+
}, (err) => done(err instanceof Error ? err : new Error(formatErrorMessage(err))));
|
|
196
|
+
}
|
|
197
|
+
_write(chunk, _encoding, done) {
|
|
198
|
+
this.#pending = {
|
|
199
|
+
chunk,
|
|
200
|
+
offset: 0,
|
|
201
|
+
done
|
|
202
|
+
};
|
|
203
|
+
this.#schedule();
|
|
204
|
+
}
|
|
205
|
+
_read() {
|
|
206
|
+
this.#readBlocked = false;
|
|
207
|
+
this.#schedule();
|
|
208
|
+
}
|
|
209
|
+
#schedule() {
|
|
210
|
+
if (this.destroyed || this.#scheduled || this.#readBlocked || !this.#pending) return;
|
|
211
|
+
this.#scheduled = setImmediate(() => {
|
|
212
|
+
this.#scheduled = void 0;
|
|
213
|
+
this.#encodeBatch();
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
#encodeBatch() {
|
|
217
|
+
const pending = this.#pending;
|
|
218
|
+
if (!pending || this.destroyed) return;
|
|
219
|
+
try {
|
|
220
|
+
for (let count = 0; count < DISCORD_OPUS_ENCODE_BATCH_FRAMES; count += 1) {
|
|
221
|
+
const remainingBytes = pending.chunk.length - pending.offset;
|
|
222
|
+
if (this.#partialBytes > 0 || remainingBytes < DISCORD_OPUS_FRAME_BYTES) {
|
|
223
|
+
const copied = pending.chunk.copy(this.#partialFrame, this.#partialBytes, pending.offset, pending.offset + DISCORD_OPUS_FRAME_BYTES - this.#partialBytes);
|
|
224
|
+
pending.offset += copied;
|
|
225
|
+
this.#partialBytes += copied;
|
|
226
|
+
if (this.#partialBytes < DISCORD_OPUS_FRAME_BYTES) {
|
|
227
|
+
this.#pending = void 0;
|
|
228
|
+
pending.done();
|
|
229
|
+
this.#flushRequestedPartialFrame();
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
232
|
+
this.#partialBytes = 0;
|
|
233
|
+
this.#readBlocked = !this.#encodeFrame(this.#partialFrame);
|
|
234
|
+
} else {
|
|
235
|
+
const frame = pending.chunk.subarray(pending.offset, pending.offset + DISCORD_OPUS_FRAME_BYTES);
|
|
236
|
+
pending.offset += DISCORD_OPUS_FRAME_BYTES;
|
|
237
|
+
this.#readBlocked = !this.#encodeFrame(frame);
|
|
238
|
+
}
|
|
239
|
+
if (this.destroyed || this.#readBlocked) return;
|
|
240
|
+
}
|
|
241
|
+
this.#schedule();
|
|
242
|
+
} catch (err) {
|
|
243
|
+
this.#pending = void 0;
|
|
244
|
+
pending.done(err instanceof Error ? err : new Error(formatErrorMessage(err)));
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
_final(done) {
|
|
248
|
+
try {
|
|
249
|
+
this.flushPartialFrame();
|
|
250
|
+
this.push(null);
|
|
251
|
+
done();
|
|
252
|
+
} catch (err) {
|
|
253
|
+
done(err instanceof Error ? err : new Error(formatErrorMessage(err)));
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
flushPartialFrameWhenReady() {
|
|
257
|
+
this.#partialFlushRequested = true;
|
|
258
|
+
if (this.#partialBytes > 0) this.#flushRequestedPartialFrame();
|
|
259
|
+
}
|
|
260
|
+
#flushRequestedPartialFrame() {
|
|
261
|
+
if (!this.#partialFlushRequested || this.#pending || this.writableLength > 0) return;
|
|
262
|
+
this.#partialFlushRequested = false;
|
|
263
|
+
try {
|
|
264
|
+
this.flushPartialFrame();
|
|
265
|
+
} catch (error) {
|
|
266
|
+
this.destroy(error instanceof Error ? error : new Error(formatErrorMessage(error)));
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
flushPartialFrame() {
|
|
270
|
+
if (this.destroyed || this.#pending || this.#partialBytes === 0) return false;
|
|
271
|
+
const pcmBytes = this.#partialBytes;
|
|
272
|
+
this.#partialFrame.fill(0, pcmBytes);
|
|
273
|
+
this.#partialBytes = 0;
|
|
274
|
+
this.#readBlocked = !this.#encodeFrame(this.#partialFrame, pcmBytes);
|
|
275
|
+
return true;
|
|
276
|
+
}
|
|
277
|
+
takePcmBytes(packet) {
|
|
278
|
+
const bytes = this.#packetPcmBytes.get(packet) ?? 0;
|
|
279
|
+
this.#packetPcmBytes.delete(packet);
|
|
280
|
+
return bytes;
|
|
281
|
+
}
|
|
282
|
+
_destroy(err, done) {
|
|
283
|
+
this.#encoder?.free();
|
|
284
|
+
clearImmediate(this.#scheduled);
|
|
285
|
+
this.#scheduled = void 0;
|
|
286
|
+
this.#partialFlushRequested = false;
|
|
287
|
+
const pending = this.#pending;
|
|
288
|
+
this.#pending = void 0;
|
|
289
|
+
pending?.done(err ?? /* @__PURE__ */ new Error("Discord Opus encoder was destroyed"));
|
|
290
|
+
this.#partialBytes = 0;
|
|
291
|
+
this.#partialFrame = Buffer.alloc(0);
|
|
292
|
+
done(err);
|
|
293
|
+
}
|
|
294
|
+
#encodeFrame(frame, pcmBytes = frame.length) {
|
|
295
|
+
const packet = Buffer.from(this.#encoder.encode(frame, { frameSize: DISCORD_OPUS_FRAME_SIZE }));
|
|
296
|
+
this.#packetPcmBytes.set(packet, pcmBytes);
|
|
297
|
+
return this.push(packet);
|
|
298
|
+
}
|
|
299
|
+
};
|
|
300
|
+
function pcmInt16ToBuffer(pcm) {
|
|
301
|
+
return Buffer.from(pcm.buffer, pcm.byteOffset, pcm.byteLength);
|
|
302
|
+
}
|
|
303
|
+
async function decodeOpusStreamChunks(stream, params) {
|
|
304
|
+
try {
|
|
305
|
+
for await (const { pcm, packet } of decodeOpusFrames(stream, params)) await params.onChunk(pcm, packet);
|
|
306
|
+
} catch (err) {
|
|
307
|
+
params.onError?.(err);
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
async function* decodeOpusFrames(stream, params) {
|
|
311
|
+
let decoder;
|
|
312
|
+
try {
|
|
313
|
+
decoder = await createDecoder({
|
|
314
|
+
channels: CHANNELS,
|
|
315
|
+
sampleRate: SAMPLE_RATE
|
|
316
|
+
});
|
|
317
|
+
} catch (err) {
|
|
318
|
+
params.onError?.(err);
|
|
319
|
+
if (!warnedOpusMissing) {
|
|
320
|
+
warnedOpusMissing = true;
|
|
321
|
+
params.onWarn(`discord voice: no usable opus decoder available (libopus-wasm: ${formatErrorMessage(err)}); cannot decode voice audio`);
|
|
322
|
+
}
|
|
323
|
+
return;
|
|
324
|
+
}
|
|
325
|
+
params.onVerbose("opus decoder: libopus-wasm");
|
|
326
|
+
try {
|
|
327
|
+
for await (const chunk of stream) {
|
|
328
|
+
if (!chunk || !(chunk instanceof Buffer) || chunk.length === 0) continue;
|
|
329
|
+
const decoded = decoder.decode(chunk, { maxFrameSize: DISCORD_OPUS_MAX_DECODE_FRAME_SIZE });
|
|
330
|
+
if (decoded.length > 0) yield {
|
|
331
|
+
pcm: pcmInt16ToBuffer(decoded),
|
|
332
|
+
packet: chunk
|
|
333
|
+
};
|
|
334
|
+
}
|
|
335
|
+
} catch (err) {
|
|
336
|
+
params.onError?.(err);
|
|
337
|
+
if (shouldLogVerbose()) logVerbose(`discord voice: opus decode failed: ${formatErrorMessage(err)}`);
|
|
338
|
+
} finally {
|
|
339
|
+
decoder.free();
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
function createDiscordPcmToRealtimeConverter() {
|
|
343
|
+
const resampler = createStreamingPcmResampler(SAMPLE_RATE, 24e3);
|
|
344
|
+
let trailingFrame = Buffer.alloc(0);
|
|
345
|
+
return {
|
|
346
|
+
process(pcm) {
|
|
347
|
+
const input = trailingFrame.length > 0 ? Buffer.concat([trailingFrame, pcm]) : pcm;
|
|
348
|
+
const completeBytes = input.length - input.length % 4;
|
|
349
|
+
trailingFrame = Buffer.from(input.subarray(completeBytes));
|
|
350
|
+
const mono = Buffer.alloc(completeBytes / 2);
|
|
351
|
+
for (let offset = 0; offset < completeBytes; offset += 4) mono.writeInt16LE(Math.round((input.readInt16LE(offset) + input.readInt16LE(offset + 2)) / 2), offset / 2);
|
|
352
|
+
return resampler.process(mono);
|
|
353
|
+
},
|
|
354
|
+
flush() {
|
|
355
|
+
trailingFrame = Buffer.alloc(0);
|
|
356
|
+
return resampler.flush();
|
|
357
|
+
}
|
|
358
|
+
};
|
|
359
|
+
}
|
|
360
|
+
function duplicateMonoChannels(mono) {
|
|
361
|
+
const stereo = Buffer.alloc(mono.length * 2);
|
|
362
|
+
for (let offset = 0; offset < mono.length; offset += 2) {
|
|
363
|
+
const sample = mono.readInt16LE(offset);
|
|
364
|
+
stereo.writeInt16LE(sample, offset * 2);
|
|
365
|
+
stereo.writeInt16LE(sample, offset * 2 + 2);
|
|
366
|
+
}
|
|
367
|
+
return stereo;
|
|
368
|
+
}
|
|
369
|
+
function createRealtimePcmToDiscordConverter() {
|
|
370
|
+
let resampler = createStreamingPcmResampler(24e3, SAMPLE_RATE);
|
|
371
|
+
let history = Buffer.alloc(0);
|
|
372
|
+
let trailingByte = Buffer.alloc(0);
|
|
373
|
+
let replayBytes = 0;
|
|
374
|
+
let flushed = false;
|
|
375
|
+
const takeOutput = (pcm) => {
|
|
376
|
+
const skippedBytes = Math.min(replayBytes, pcm.length);
|
|
377
|
+
replayBytes -= skippedBytes;
|
|
378
|
+
return duplicateMonoChannels(pcm.subarray(skippedBytes));
|
|
379
|
+
};
|
|
380
|
+
return {
|
|
381
|
+
process(pcm) {
|
|
382
|
+
const input = trailingByte.length > 0 ? Buffer.concat([trailingByte, pcm]) : pcm;
|
|
383
|
+
const completeBytes = input.length - input.length % 2;
|
|
384
|
+
const completePcm = input.subarray(0, completeBytes);
|
|
385
|
+
trailingByte = Buffer.from(input.subarray(completeBytes));
|
|
386
|
+
history = Buffer.concat([history, completePcm.subarray(-64)]).subarray(-64);
|
|
387
|
+
return takeOutput(resampler.process(completePcm));
|
|
388
|
+
},
|
|
389
|
+
drain() {
|
|
390
|
+
if (flushed) return Buffer.alloc(0);
|
|
391
|
+
const output = takeOutput(resampler.flush());
|
|
392
|
+
resampler = createStreamingPcmResampler(24e3, SAMPLE_RATE);
|
|
393
|
+
replayBytes = history.length * 2 - resampler.process(history).length;
|
|
394
|
+
return output;
|
|
395
|
+
},
|
|
396
|
+
flush() {
|
|
397
|
+
flushed = true;
|
|
398
|
+
trailingByte = Buffer.alloc(0);
|
|
399
|
+
history = Buffer.alloc(0);
|
|
400
|
+
return takeOutput(resampler.flush());
|
|
401
|
+
}
|
|
402
|
+
};
|
|
403
|
+
}
|
|
404
|
+
async function writeVoiceWavFile(chunks) {
|
|
405
|
+
const wav = buildWavBuffer(chunks);
|
|
406
|
+
const workspace = await tempWorkspace({
|
|
407
|
+
rootDir: resolvePreferredOpenClawTmpDir(),
|
|
408
|
+
prefix: "discord-voice-"
|
|
409
|
+
});
|
|
410
|
+
try {
|
|
411
|
+
return {
|
|
412
|
+
path: await workspace.write("segment.wav", wav),
|
|
413
|
+
durationSeconds: (wav.length - 44) / (BIT_DEPTH / 8 * CHANNELS * SAMPLE_RATE),
|
|
414
|
+
cleanup: () => workspace[Symbol.asyncDispose]()
|
|
415
|
+
};
|
|
416
|
+
} catch (error) {
|
|
417
|
+
await workspace.cleanup();
|
|
418
|
+
throw error;
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
//#endregion
|
|
422
|
+
//#region extensions/discord/src/voice/receive-recovery.ts
|
|
423
|
+
const DECRYPT_FAILURE_WINDOW_MS = 3e4;
|
|
424
|
+
const DECRYPT_FAILURE_RECONNECT_THRESHOLD = 3;
|
|
425
|
+
const DECRYPT_FAILURE_MARKER = "DecryptionFailed(";
|
|
426
|
+
const DAVE_PASSTHROUGH_DISABLED_MARKER = "UnencryptedWhenPassthroughDisabled";
|
|
427
|
+
const WASM_MEMORY_ACCESS_MARKER = "memory access out of bounds";
|
|
428
|
+
const OPUS_INVALID_PACKET_CODE = -4;
|
|
429
|
+
function createVoiceReceiveRecoveryState() {
|
|
430
|
+
return {
|
|
431
|
+
decryptFailureCount: 0,
|
|
432
|
+
lastDecryptFailureAt: 0,
|
|
433
|
+
decryptRecoveryInFlight: false
|
|
434
|
+
};
|
|
435
|
+
}
|
|
436
|
+
function isAbortLikeReceiveError(err) {
|
|
437
|
+
if (!err || typeof err !== "object") return false;
|
|
438
|
+
const name = "name" in err && typeof err.name === "string" ? err.name : "";
|
|
439
|
+
const message = "message" in err && typeof err.message === "string" ? err.message : "";
|
|
440
|
+
return name === "AbortError" || message === "Premature close" || message.includes("The operation was aborted") || message.includes("aborted");
|
|
441
|
+
}
|
|
442
|
+
function isOpusDecodeInvalidPacketError(err) {
|
|
443
|
+
if (!err || typeof err !== "object") return false;
|
|
444
|
+
const maybeOpusError = err;
|
|
445
|
+
const isDecodeOperation = maybeOpusError.operation === "decode" || maybeOpusError.operation === "decodeFloat";
|
|
446
|
+
const isInvalidPacket = maybeOpusError.code === OPUS_INVALID_PACKET_CODE || maybeOpusError.codeName === "InvalidPacket";
|
|
447
|
+
return isDecodeOperation && isInvalidPacket && (err instanceof OpusError || maybeOpusError.name === "OpusError");
|
|
448
|
+
}
|
|
449
|
+
function analyzeVoiceReceiveError(err) {
|
|
450
|
+
const message = formatErrorMessage(err);
|
|
451
|
+
const normalizedMessage = message.toLowerCase();
|
|
452
|
+
const shouldAttemptPassthrough = message.includes(DAVE_PASSTHROUGH_DISABLED_MARKER);
|
|
453
|
+
const isWasmMemoryAccessFailure = normalizedMessage.includes(WASM_MEMORY_ACCESS_MARKER);
|
|
454
|
+
return {
|
|
455
|
+
message,
|
|
456
|
+
isAbortLike: isAbortLikeReceiveError(err),
|
|
457
|
+
isDecodeCorruption: isOpusDecodeInvalidPacketError(err),
|
|
458
|
+
shouldAttemptPassthrough,
|
|
459
|
+
countsAsDecryptFailure: message.includes(DECRYPT_FAILURE_MARKER) || shouldAttemptPassthrough || isWasmMemoryAccessFailure
|
|
460
|
+
};
|
|
461
|
+
}
|
|
462
|
+
function noteVoiceDecryptFailure(state, now = Date.now()) {
|
|
463
|
+
if (now - state.lastDecryptFailureAt > 3e4) state.decryptFailureCount = 0;
|
|
464
|
+
state.lastDecryptFailureAt = now;
|
|
465
|
+
state.decryptFailureCount += 1;
|
|
466
|
+
const firstFailure = state.decryptFailureCount === 1;
|
|
467
|
+
if (state.decryptFailureCount < DECRYPT_FAILURE_RECONNECT_THRESHOLD || state.decryptRecoveryInFlight) return {
|
|
468
|
+
firstFailure,
|
|
469
|
+
shouldRecover: false
|
|
470
|
+
};
|
|
471
|
+
state.decryptRecoveryInFlight = true;
|
|
472
|
+
resetVoiceReceiveRecoveryState(state);
|
|
473
|
+
return {
|
|
474
|
+
firstFailure,
|
|
475
|
+
shouldRecover: true
|
|
476
|
+
};
|
|
477
|
+
}
|
|
478
|
+
function resetVoiceReceiveRecoveryState(state) {
|
|
479
|
+
state.decryptFailureCount = 0;
|
|
480
|
+
state.lastDecryptFailureAt = 0;
|
|
481
|
+
}
|
|
482
|
+
function isDaveReinitializing(session) {
|
|
483
|
+
return session.reinitializing === true;
|
|
484
|
+
}
|
|
485
|
+
function recoverDaveZeroTransition(params) {
|
|
486
|
+
const { target, sdk, onWarn } = params;
|
|
487
|
+
const networkingState = target.connection.state.networking?.state;
|
|
488
|
+
const daveSession = networkingState?.dave;
|
|
489
|
+
if (target.connection.state.status !== sdk.VoiceConnectionStatus.Ready || networkingState?.code !== sdk.NetworkingStatusCode.Ready || daveSession?.lastTransitionId !== 0 || daveSession.reinitializing !== false || typeof daveSession.recoverFromInvalidTransition !== "function") return "not-attempted";
|
|
490
|
+
try {
|
|
491
|
+
daveSession.recoverFromInvalidTransition(0);
|
|
492
|
+
return "recovered";
|
|
493
|
+
} catch (err) {
|
|
494
|
+
onWarn(`discord voice: failed to recover DAVE transition 0 guild=${target.guildId} channel=${target.channelId}: ${formatErrorMessage(err)}`);
|
|
495
|
+
return isDaveReinitializing(daveSession) ? "failed" : "not-attempted";
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
function enableDaveReceivePassthrough(params) {
|
|
499
|
+
const { target, sdk, reason, expirySeconds, onVerbose, onWarn } = params;
|
|
500
|
+
const networkingState = target.connection.state.networking?.state;
|
|
501
|
+
if (target.connection.state.status !== sdk.VoiceConnectionStatus.Ready || !networkingState || networkingState.code !== sdk.NetworkingStatusCode.Ready && networkingState.code !== sdk.NetworkingStatusCode.Resuming) return false;
|
|
502
|
+
const daveSession = networkingState.dave?.session;
|
|
503
|
+
if (!daveSession) return false;
|
|
504
|
+
try {
|
|
505
|
+
daveSession.setPassthroughMode(true, expirySeconds);
|
|
506
|
+
onVerbose(`enabled DAVE receive passthrough: guild ${target.guildId} channel ${target.channelId} expiry=${expirySeconds}s reason=${reason}`);
|
|
507
|
+
return true;
|
|
508
|
+
} catch (err) {
|
|
509
|
+
onWarn(`discord voice: failed to enable DAVE passthrough guild=${target.guildId} channel=${target.channelId} reason=${reason}: ${formatErrorMessage(err)}`);
|
|
510
|
+
return false;
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
//#endregion
|
|
514
|
+
export { releaseDiscordAudioInput as _, noteVoiceDecryptFailure as a, serializeDiscordAudioError as b, createDiscordOpusEncodeStream as c, createRealtimePcmToDiscordConverter as d, decodeOpusStreamChunks as f, getDiscordAudioOutputStatus as g, admitDiscordAudioInput as h, enableDaveReceivePassthrough as i, createDiscordOpusPlaybackStream as l, DiscordAudioOutputStatus as m, analyzeVoiceReceiveError as n, recoverDaveZeroTransition as o, writeVoiceWavFile as p, createVoiceReceiveRecoveryState as r, resetVoiceReceiveRecoveryState as s, DECRYPT_FAILURE_WINDOW_MS as t, createDiscordPcmToRealtimeConverter as u, restoreDiscordAudioError as v, setDiscordAudioOutputStatus as x, retireDiscordAudioOutput as y };
|
package/dist/.setup/{resolve-allowlist-common-CwMBzbx9.mjs → resolve-allowlist-common-DPdRggu5.mjs}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { o as normalizeDiscordSlug } from "./channel-type-
|
|
2
|
-
import { m as normalizeDiscordToken } from "./accounts-
|
|
3
|
-
import { r as fetchDiscord } from "./api-
|
|
1
|
+
import { o as normalizeDiscordSlug } from "./channel-type-DRCrEMss.mjs";
|
|
2
|
+
import { m as normalizeDiscordToken } from "./accounts-ChaMcixG.mjs";
|
|
3
|
+
import { r as fetchDiscord } from "./api-DVbJwZVt.mjs";
|
|
4
4
|
//#region extensions/discord/src/guilds.ts
|
|
5
5
|
async function listGuilds(token, fetcher, options) {
|
|
6
6
|
return (await fetchDiscord("/users/@me/guilds", token, fetcher, options)).filter((guild) => typeof guild.id === "string" && typeof guild.name === "string").map((guild) => ({
|
|
@@ -14,9 +14,6 @@ async function listGuilds(token, fetcher, options) {
|
|
|
14
14
|
function resolveDiscordAllowlistToken(token) {
|
|
15
15
|
return normalizeDiscordToken(token, "channels.discord.token");
|
|
16
16
|
}
|
|
17
|
-
function buildDiscordUnresolvedResults(entries, buildResult) {
|
|
18
|
-
return entries.map(buildResult);
|
|
19
|
-
}
|
|
20
17
|
function findDiscordGuildByName(guilds, input) {
|
|
21
18
|
const slug = normalizeDiscordSlug(input);
|
|
22
19
|
if (!slug) return;
|
|
@@ -31,4 +28,4 @@ function filterDiscordGuilds(guilds, params) {
|
|
|
31
28
|
return guilds;
|
|
32
29
|
}
|
|
33
30
|
//#endregion
|
|
34
|
-
export {
|
|
31
|
+
export { resolveDiscordAllowlistToken as n, listGuilds as r, filterDiscordGuilds as t };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { o as normalizeDiscordSlug, t as isDiscordThreadChannelType } from "./channel-type-
|
|
3
|
-
import { n as DiscordApiError, r as fetchDiscord, t as DISCORD_DIRECTORY_LOOKUP_TIMEOUT_MS } from "./api-
|
|
4
|
-
import {
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.mjs";
|
|
2
|
+
import { o as normalizeDiscordSlug, t as isDiscordThreadChannelType } from "./channel-type-DRCrEMss.mjs";
|
|
3
|
+
import { n as DiscordApiError, r as fetchDiscord, t as DISCORD_DIRECTORY_LOOKUP_TIMEOUT_MS } from "./api-DVbJwZVt.mjs";
|
|
4
|
+
import { n as resolveDiscordAllowlistToken, r as listGuilds, t as filterDiscordGuilds } from "./resolve-allowlist-common-DPdRggu5.mjs";
|
|
5
5
|
//#region extensions/discord/src/resolve-channels.ts
|
|
6
6
|
var resolve_channels_exports = /* @__PURE__ */ __exportAll({ resolveDiscordChannelAllowlist: () => resolveDiscordChannelAllowlist });
|
|
7
7
|
function parseDiscordChannelInput(raw) {
|
|
@@ -12,7 +12,7 @@ function parseDiscordChannelInput(raw) {
|
|
|
12
12
|
const channelPrefix = trimmed.match(/^(?:channel:|discord:)?(\d+)$/i);
|
|
13
13
|
if (channelPrefix) return { channelId: channelPrefix[1] };
|
|
14
14
|
const guildPrefix = trimmed.match(/^(?:guild:|server:)?(\d+)$/i);
|
|
15
|
-
if (guildPrefix
|
|
15
|
+
if (guildPrefix) return {
|
|
16
16
|
guildId: guildPrefix[1],
|
|
17
17
|
guildOnly: true
|
|
18
18
|
};
|
|
@@ -88,9 +88,20 @@ function preferActiveMatch(candidates) {
|
|
|
88
88
|
scored.sort((a, b) => b.score - a.score);
|
|
89
89
|
return scored[0]?.channel ?? candidates[0];
|
|
90
90
|
}
|
|
91
|
+
function resolvedChannelResult(input, channel, guildName) {
|
|
92
|
+
return {
|
|
93
|
+
input,
|
|
94
|
+
resolved: true,
|
|
95
|
+
guildId: channel.guildId,
|
|
96
|
+
guildName,
|
|
97
|
+
channelId: channel.id,
|
|
98
|
+
channelName: channel.name,
|
|
99
|
+
archived: channel.archived
|
|
100
|
+
};
|
|
101
|
+
}
|
|
91
102
|
async function resolveDiscordChannelAllowlist(params) {
|
|
92
103
|
const token = resolveDiscordAllowlistToken(params.token);
|
|
93
|
-
if (!token) return
|
|
104
|
+
if (!token) return params.entries.map((input) => ({
|
|
94
105
|
input,
|
|
95
106
|
resolved: false
|
|
96
107
|
}));
|
|
@@ -146,15 +157,7 @@ async function resolveDiscordChannelAllowlist(params) {
|
|
|
146
157
|
continue;
|
|
147
158
|
}
|
|
148
159
|
const guild = guilds.find((entry) => entry.id === channel.guildId);
|
|
149
|
-
results.push(
|
|
150
|
-
input,
|
|
151
|
-
resolved: true,
|
|
152
|
-
guildId: channel.guildId,
|
|
153
|
-
guildName: guild?.name,
|
|
154
|
-
channelId: channel.id,
|
|
155
|
-
channelName: channel.name,
|
|
156
|
-
archived: channel.archived
|
|
157
|
-
});
|
|
160
|
+
results.push(resolvedChannelResult(input, channel, guild?.name));
|
|
158
161
|
continue;
|
|
159
162
|
}
|
|
160
163
|
if (result.status === "not-found" && parsed.guildId) {
|
|
@@ -162,15 +165,7 @@ async function resolveDiscordChannelAllowlist(params) {
|
|
|
162
165
|
if (guild) {
|
|
163
166
|
const match = preferActiveMatch((await getChannels(guild.id)).filter((channel) => normalizeDiscordSlug(channel.name) === normalizeDiscordSlug(channelId)));
|
|
164
167
|
if (match) {
|
|
165
|
-
results.push(
|
|
166
|
-
input,
|
|
167
|
-
resolved: true,
|
|
168
|
-
guildId: guild.id,
|
|
169
|
-
guildName: guild.name,
|
|
170
|
-
channelId: match.id,
|
|
171
|
-
channelName: match.name,
|
|
172
|
-
archived: match.archived
|
|
173
|
-
});
|
|
168
|
+
results.push(resolvedChannelResult(input, match, guild.name));
|
|
174
169
|
continue;
|
|
175
170
|
}
|
|
176
171
|
}
|
|
@@ -205,15 +200,7 @@ async function resolveDiscordChannelAllowlist(params) {
|
|
|
205
200
|
let matches = channels.filter((channel) => isNumericId ? channel.id === channelQuery : normalizeDiscordSlug(channel.name) === normalizedChannelQuery);
|
|
206
201
|
if (isNumericId && matches.length === 0) matches = channels.filter((channel) => normalizeDiscordSlug(channel.name) === normalizedChannelQuery);
|
|
207
202
|
const match = preferActiveMatch(matches);
|
|
208
|
-
if (match) results.push(
|
|
209
|
-
input,
|
|
210
|
-
resolved: true,
|
|
211
|
-
guildId: guild.id,
|
|
212
|
-
guildName: guild.name,
|
|
213
|
-
channelId: match.id,
|
|
214
|
-
channelName: match.name,
|
|
215
|
-
archived: match.archived
|
|
216
|
-
});
|
|
203
|
+
if (match) results.push(resolvedChannelResult(input, match, guild.name));
|
|
217
204
|
else results.push({
|
|
218
205
|
input,
|
|
219
206
|
resolved: false,
|
|
@@ -242,13 +229,7 @@ async function resolveDiscordChannelAllowlist(params) {
|
|
|
242
229
|
if (match) {
|
|
243
230
|
const guild = guilds.find((entry) => entry.id === match.guildId);
|
|
244
231
|
results.push({
|
|
245
|
-
input,
|
|
246
|
-
resolved: true,
|
|
247
|
-
guildId: match.guildId,
|
|
248
|
-
guildName: guild?.name,
|
|
249
|
-
channelId: match.id,
|
|
250
|
-
channelName: match.name,
|
|
251
|
-
archived: match.archived,
|
|
232
|
+
...resolvedChannelResult(input, match, guild?.name),
|
|
252
233
|
note: candidates.length > 1 && guild?.name ? `matched multiple; chose ${guild.name}` : void 0
|
|
253
234
|
});
|
|
254
235
|
continue;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { r as fetchDiscord, t as DISCORD_DIRECTORY_LOOKUP_TIMEOUT_MS } from "./api-
|
|
3
|
-
import {
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.mjs";
|
|
2
|
+
import { r as fetchDiscord, t as DISCORD_DIRECTORY_LOOKUP_TIMEOUT_MS } from "./api-DVbJwZVt.mjs";
|
|
3
|
+
import { n as resolveDiscordAllowlistToken, r as listGuilds, t as filterDiscordGuilds } from "./resolve-allowlist-common-DPdRggu5.mjs";
|
|
4
4
|
import { normalizeLowercaseStringOrEmpty, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
5
5
|
//#region extensions/discord/src/resolve-users.ts
|
|
6
6
|
var resolve_users_exports = /* @__PURE__ */ __exportAll({ resolveDiscordUserAllowlist: () => resolveDiscordUserAllowlist });
|
|
@@ -45,7 +45,7 @@ function scoreDiscordMember(member, query) {
|
|
|
45
45
|
}
|
|
46
46
|
async function resolveDiscordUserAllowlist(params) {
|
|
47
47
|
const token = resolveDiscordAllowlistToken(params.token);
|
|
48
|
-
if (!token) return
|
|
48
|
+
if (!token) return params.entries.map((input) => ({
|
|
49
49
|
input,
|
|
50
50
|
resolved: false
|
|
51
51
|
}));
|