@openclaw/discord 2026.11.3 → 2026.11.5-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.setup/{account-inspect-8cCu6uPG.mjs → account-inspect-DGkdWwix.mjs} +1 -1
- package/dist/.setup/{accounts-ljrzXBJi.mjs → accounts-C_25wyxC.mjs} +9 -6
- package/dist/.setup/{active-turn-thread-route-C4tp9noA.mjs → active-turn-thread-route-KvRTAVE3.mjs} +1 -2
- package/dist/.setup/{allow-list-BKqOldGy.mjs → allow-list-BXrS8-R9.mjs} +4 -152
- package/dist/.setup/{api-DqmMUZau.mjs → api-BlBD4ism.mjs} +10 -20
- package/dist/.setup/{approval-handler.runtime-D0qu1um7.mjs → approval-handler.runtime-BGYjX1t9.mjs} +80 -61
- package/dist/.setup/{approval-message-updates-CdurC9Ej.mjs → approval-message-updates-DKsCfxSW.mjs} +2 -2
- package/dist/.setup/{audit-ChorIwio.mjs → audit-5b-FXj9R.mjs} +4 -4
- package/dist/.setup/{channel-ZilgdF5e.mjs → channel-CWwTHWFo.mjs} +134 -202
- package/dist/.setup/channel-access-9cyzozUP.mjs +24 -0
- package/dist/.setup/channel.setup-B3MtmBQG.mjs +238 -0
- package/dist/.setup/{components-Du9NhD8h.mjs → components-YCvQ6YLS.mjs} +209 -430
- package/dist/.setup/components.base-CiS0h_XP.mjs +32 -0
- package/dist/.setup/{config-schema-_uBILpQf.mjs → config-schema-BNKN1cu5.mjs} +6 -7
- package/dist/.setup/{conversation-binding-route-8Ul1KpGF.mjs → conversation-binding-route-kCTw8cij.mjs} +2 -2
- package/dist/.setup/{directory-config-3iVub-3m.mjs → directory-config-Ble81PWH.mjs} +1 -1
- package/dist/.setup/{directory-live-BDVl2DoC.mjs → directory-live-DH3tpS3x.mjs} +52 -57
- package/dist/.setup/{discord-BMD-JiVS.mjs → discord-DGVSguhx.mjs} +1124 -1710
- package/dist/.setup/{doctor-hQKbkNKq.mjs → doctor-eujgbnpZ.mjs} +3 -5
- package/dist/.setup/endpoint-runtime-lf4DeLas.mjs +139 -0
- package/dist/.setup/guilds-eDq22iSM.mjs +22 -0
- package/dist/.setup/{handle-action-B1lmt4ms.mjs → handle-action-CktwmzMz.mjs} +15 -15
- package/dist/.setup/{handle-action.guild-admin-B6g31cwt.mjs → handle-action.guild-admin-WLQ7fRqI.mjs} +5 -5
- package/dist/.setup/listeners-Df8lx3vK.mjs +47 -0
- package/dist/.setup/{live-policy-config-C_Q966Wh.mjs → live-policy-config-DiBVuaU6.mjs} +2 -3
- package/dist/.setup/{message-handler-CkI3yMjL.mjs → message-handler-hhNSioxo.mjs} +154 -115
- package/dist/.setup/{message-handler.preflight-CEfkFV9U.mjs → message-handler.preflight-BZcZE1o-.mjs} +30 -105
- package/dist/.setup/{message-handler.preflight-pluralkit-D5si80_L.mjs → message-handler.preflight-pluralkit-CYZfXXb6.mjs} +9 -22
- package/dist/.setup/{message-handler.process-DsMtetRf.mjs → message-handler.process-B0n-mQ99.mjs} +256 -373
- package/dist/.setup/outbound-payload-BaZmjewa.mjs +447 -0
- package/dist/.setup/{outbound-session-route-BtUpGBTb.mjs → outbound-session-route-Cgx4i9cS.mjs} +139 -86
- package/dist/.setup/{preflight-audio-wWgsZG5F.mjs → preflight-audio-C6QtD6HX.mjs} +1 -5
- package/dist/.setup/{presence-cache-DCeTsL73.mjs → presence-cache-Dq-3nH7R.mjs} +1 -6
- package/dist/.setup/{probe-CBaoCs-c.mjs → probe-DezB-6xz.mjs} +5 -9
- package/dist/.setup/{provider-CI_OLfvz.mjs → provider-BN2bCIUp.mjs} +3440 -4308
- package/dist/.setup/{provider-session.runtime-TWOo_JZx.mjs → provider-session.runtime-Dr_5X43t.mjs} +3 -3
- package/dist/.setup/provider.runtime-BuJpl0Pv.mjs +1 -0
- package/dist/.setup/proxy-fetch-BzXwBAXt.mjs +30 -0
- package/dist/.setup/{realtime-session.runtime-DvfS4vJj.mjs → realtime-session.runtime-BTDWsV4d.mjs} +44 -81
- package/dist/.setup/{receive-recovery-CKvaG2Hf.mjs → receive-recovery-C3Ks4wAQ.mjs} +13 -27
- package/dist/.setup/{resolve-allowlist-common-cIjtqh2F.mjs → resolve-allowlist-common-Bk8Fj6Ik.mjs} +3 -13
- package/dist/.setup/{resolve-channels-Cj5i7hzj.mjs → resolve-channels-Bp8frXvc.mjs} +7 -8
- package/dist/.setup/{resolve-users-BQLbysRB.mjs → resolve-users-Cvcj22sG.mjs} +4 -7
- package/dist/.setup/{runtime-RWnuJgWB.mjs → runtime-BJaCvlmq.mjs} +196 -239
- package/dist/.setup/{runtime-plifsKg9.mjs → runtime-BMgTyuwg.mjs} +6 -6
- package/dist/.setup/{secret-config-contract-z6FhbT8E.mjs → secret-config-contract-B1kE4sDv.mjs} +4 -9
- package/dist/.setup/{send-da6ENJ9f.mjs → send-CVW7V-VZ.mjs} +149 -175
- package/dist/.setup/{send.components-CWZUuGvA.mjs → send.components-C8YXdnO_.mjs} +59 -71
- package/dist/.setup/{send.outbound-qZ3iK3Vq.mjs → send.outbound-Uzcmh3Yd.mjs} +76 -129
- package/dist/.setup/{send.receipt-C18khRYH.mjs → send.receipt-NZDOTZBU.mjs} +30 -32
- package/dist/.setup/{send.shared-CnlMgoqQ.mjs → send.shared-a_6Oeyg1.mjs} +38 -115
- package/dist/.setup/{sender-identity-DgbJykq0.mjs → sender-identity-76HFb8eK.mjs} +3 -9
- package/dist/.setup/setup-plugin-api-BExhGEhL.mjs +2 -0
- package/dist/.setup/shared-interactive-DmzaoKOM.mjs +316 -0
- package/dist/.setup/{shared-CY5vJM48.mjs → shared-yDUSExm2.mjs} +8 -11
- package/dist/.setup/{subagent-hooks-CIu2TFz3.mjs → subagent-hooks-CDkdHQyy.mjs} +1 -1
- package/dist/.setup/{system-events-DCOLXkwS.mjs → system-events-yfWz150v.mjs} +2 -2
- package/dist/.setup/{target-resolver-CApivu3G.mjs → target-resolver-BOOzqxxM.mjs} +3 -3
- package/dist/.setup/{thread-bindings-DcvT_JgI.mjs → thread-bindings-zce4cpu_.mjs} +12 -20
- package/dist/.setup/{thread-bindings.manager-5Sh7yedN.mjs → thread-bindings.manager-NywKzUtc.mjs} +22 -42
- package/dist/.setup/{thread-bindings.session-updates-BMdJeJMc.mjs → thread-bindings.session-updates-D0j7oh8S.mjs} +11 -18
- package/dist/.setup/{threading-CzjFeUSe.mjs → threading-DodLYDt-.mjs} +68 -105
- package/dist/.setup/{timeouts-CuNARfyw.mjs → timeouts-cIxzatmv.mjs} +1 -1
- package/dist/.setup/{transcripts-source-8RDQrSVb.mjs → transcripts-source-ie9GBWaU.mjs} +110 -179
- package/dist/.setup/{voice-runtime-BsDILmAv.mjs → voice-runtime-B7V_LTdX.mjs} +231 -452
- package/dist/.source-module-urls/d6c089460280c5a04184542d6712e04545caeb1ebb290d3504377b4cc5e22fea.json +1 -0
- package/dist/account-inspect-api.js +1 -1
- package/dist/action-runtime-api.js +1 -2
- package/dist/activities-api.js +286 -341
- package/dist/api.js +16 -16
- package/dist/channel-config-api.js +1 -2
- package/dist/channel-plugin-api.js +1 -2
- package/dist/contract-api.js +1 -2
- package/dist/directory-contract-api.js +1 -1
- package/dist/runtime-api.js +22 -22
- package/dist/runtime-setter-api.js +1 -2
- package/dist/secret-contract-api.js +1 -2
- package/dist/security-audit-contract-api.js +1 -2
- package/dist/security-contract-api.js +1 -2
- package/dist/session-key-api.js +1 -2
- package/dist/setup-entry.js +1 -1
- package/dist/setup-plugin-api.js +1 -2
- package/dist/src/voice/audio-worker.runtime.js +56 -68
- package/dist/subagent-hooks-api.js +1 -1
- package/dist/thread-binding-api.js +1 -2
- package/dist/transcripts-source-api.js +1 -1
- package/node_modules/@napi-rs/wasm-runtime/dist/fs.js +3339 -4021
- package/node_modules/@napi-rs/wasm-runtime/package.json +1 -1
- package/node_modules/@types/lodash/README.md +1 -1
- package/node_modules/@types/lodash/common/function.d.ts +2 -2
- package/node_modules/@types/lodash/package.json +2 -2
- package/node_modules/@types/node/README.md +1 -1
- package/node_modules/@types/node/package.json +2 -2
- package/node_modules/@types/node/util.d.ts +6 -3
- package/node_modules/discord-api-types/package.json +4 -4
- package/node_modules/discord-api-types/rest/v10/index.d.ts +8 -0
- package/node_modules/discord-api-types/rest/v10/index.d.ts.map +1 -1
- package/node_modules/discord-api-types/rest/v10/index.js +8 -0
- package/node_modules/discord-api-types/rest/v10/index.js.map +1 -1
- package/node_modules/discord-api-types/rest/v10/oauth2.d.ts +26 -2
- package/node_modules/discord-api-types/rest/v10/oauth2.d.ts.map +1 -1
- package/node_modules/discord-api-types/rest/v9/index.d.ts +8 -0
- package/node_modules/discord-api-types/rest/v9/index.d.ts.map +1 -1
- package/node_modules/discord-api-types/rest/v9/index.js +8 -0
- package/node_modules/discord-api-types/rest/v9/index.js.map +1 -1
- package/node_modules/discord-api-types/rest/v9/oauth2.d.ts +26 -2
- package/node_modules/discord-api-types/rest/v9/oauth2.d.ts.map +1 -1
- package/node_modules/typebox/build/format/duration.d.mts +2 -2
- package/node_modules/typebox/build/format/duration.mjs +2 -2
- package/node_modules/typebox/build/format/idn_email.d.mts +1 -0
- package/node_modules/typebox/build/format/idn_email.mjs +1 -0
- package/node_modules/typebox/build/format/idn_hostname.d.mts +1 -1
- package/node_modules/typebox/build/format/idn_hostname.mjs +1 -1
- package/node_modules/typebox/build/format/ipv4.d.mts +2 -2
- package/node_modules/typebox/build/format/ipv4.mjs +2 -2
- package/node_modules/typebox/build/format/ipv6.d.mts +1 -1
- package/node_modules/typebox/build/format/ipv6.mjs +1 -1
- package/node_modules/typebox/build/format/relative_json_pointer.d.mts +2 -2
- package/node_modules/typebox/build/format/relative_json_pointer.mjs +2 -2
- package/node_modules/typebox/build/schema/build.mjs +1 -0
- package/node_modules/typebox/build/schema/engine/_unique.d.mts +4 -2
- package/node_modules/typebox/build/schema/engine/_unique.mjs +7 -3
- package/node_modules/typebox/build/schema/engine/additionalItems.mjs +3 -3
- package/node_modules/typebox/build/schema/engine/additionalProperties.d.mts +0 -3
- package/node_modules/typebox/build/schema/engine/additionalProperties.mjs +15 -17
- package/node_modules/typebox/build/schema/engine/contains.mjs +3 -3
- package/node_modules/typebox/build/schema/engine/index.d.mts +1 -0
- package/node_modules/typebox/build/schema/engine/index.mjs +1 -0
- package/node_modules/typebox/build/schema/engine/items.mjs +7 -4
- package/node_modules/typebox/build/schema/engine/maxContains.mjs +2 -2
- package/node_modules/typebox/build/schema/engine/minContains.mjs +3 -3
- package/node_modules/typebox/build/schema/engine/oneOf.mjs +2 -2
- package/node_modules/typebox/build/schema/engine/patternProperties.mjs +2 -2
- package/node_modules/typebox/build/schema/engine/propertyNames.mjs +2 -2
- package/node_modules/typebox/build/schema/engine/unevaluatedItems.mjs +2 -2
- package/node_modules/typebox/build/schema/engine/unevaluatedProperties.mjs +2 -2
- package/node_modules/typebox/build/system/hashing/hash.mjs +63 -34
- package/node_modules/typebox/build/system/locale/en_US.mjs +2 -1
- package/node_modules/typebox/build/system/memory/assign.d.mts +2 -8
- package/node_modules/typebox/build/system/memory/assign.mjs +13 -6
- package/node_modules/typebox/build/system/memory/clone.d.mts +4 -5
- package/node_modules/typebox/build/system/memory/clone.mjs +8 -96
- package/node_modules/typebox/build/system/memory/create.d.mts +1 -5
- package/node_modules/typebox/build/system/memory/create.mjs +18 -13
- package/node_modules/typebox/build/system/memory/deep.d.mts +2 -0
- package/node_modules/typebox/build/system/memory/deep.mjs +108 -0
- package/node_modules/typebox/build/system/memory/discard.d.mts +1 -1
- package/node_modules/typebox/build/system/memory/discard.mjs +9 -8
- package/node_modules/typebox/build/system/memory/finalize.d.mts +4 -0
- package/node_modules/typebox/build/system/memory/finalize.mjs +30 -0
- package/node_modules/typebox/build/system/memory/keys.d.mts +2 -0
- package/node_modules/typebox/build/system/memory/keys.mjs +8 -0
- package/node_modules/typebox/build/system/memory/update.d.mts +1 -4
- package/node_modules/typebox/build/system/memory/update.mjs +43 -16
- package/node_modules/typebox/build/type/engine/call/index.d.mts +1 -0
- package/node_modules/typebox/build/type/engine/call/index.mjs +1 -0
- package/node_modules/typebox/build/type/engine/evaluate/composite.d.mts +2 -24
- package/node_modules/typebox/build/type/engine/evaluate/composite.mjs +2 -29
- package/node_modules/typebox/build/type/engine/evaluate/index.d.mts +1 -0
- package/node_modules/typebox/build/type/engine/evaluate/index.mjs +1 -0
- package/node_modules/typebox/build/type/engine/evaluate/narrow.d.mts +5 -1
- package/node_modules/typebox/build/type/engine/evaluate/narrow.mjs +6 -1
- package/node_modules/typebox/build/type/engine/evaluate/property.d.mts +30 -0
- package/node_modules/typebox/build/type/engine/evaluate/property.mjs +29 -0
- package/node_modules/typebox/build/type/engine/immutable/instantiate_add.d.mts +1 -3
- package/node_modules/typebox/build/type/engine/immutable/instantiate_add.mjs +1 -4
- package/node_modules/typebox/build/type/engine/object/from_intersect.d.mts +2 -2
- package/node_modules/typebox/build/type/engine/object/from_intersect.mjs +2 -2
- package/node_modules/typebox/build/type/engine/object/from_union.d.mts +2 -2
- package/node_modules/typebox/build/type/engine/object/from_union.mjs +2 -2
- package/node_modules/typebox/build/type/engine/optional/instantiate_add.d.mts +1 -3
- package/node_modules/typebox/build/type/engine/optional/instantiate_add.mjs +1 -4
- package/node_modules/typebox/build/type/engine/readonly/instantiate_add.d.mts +1 -3
- package/node_modules/typebox/build/type/engine/readonly/instantiate_add.mjs +1 -4
- package/node_modules/typebox/build/type/engine/this/index.d.mts +1 -0
- package/node_modules/typebox/build/type/engine/this/index.mjs +1 -0
- package/node_modules/typebox/build/value/clone/clone.d.mts +4 -3
- package/node_modules/typebox/build/value/clone/clone.mjs +5 -7
- package/node_modules/typebox/build/value/repair/from_cyclic.d.mts +2 -0
- package/node_modules/typebox/build/value/repair/from_cyclic.mjs +6 -0
- package/node_modules/typebox/build/value/shared/union_priority_sort.mjs +25 -14
- package/node_modules/typebox/package.json +1 -1
- package/node_modules/typebox/readme.md +1 -1
- package/node_modules/undici/docs/docs/api/Interceptors.md +15 -2
- package/node_modules/undici/lib/dispatcher/client-h2.js +78 -3
- package/node_modules/undici/lib/dispatcher/pool-base.js +20 -3
- package/node_modules/undici/package.json +3 -3
- package/node_modules/undici/types/api.d.ts +1 -1
- package/node_modules/undici/types/utility.d.ts +4 -4
- package/node_modules/uuid/package.json +17 -17
- package/node_modules/zod/package.json +1 -1
- package/node_modules/zod/src/v4/classic/tests/array.test.ts +27 -0
- package/node_modules/zod/src/v4/classic/tests/map.test.ts +7 -0
- package/node_modules/zod/src/v4/classic/tests/set.test.ts +6 -0
- package/node_modules/zod/src/v4/core/compile.ts +9 -0
- package/node_modules/zod/src/v4/core/schemas.ts +35 -1
- package/node_modules/zod/src/v4/core/util.ts +13 -0
- package/node_modules/zod/src/v4/core/versions.ts +1 -1
- package/node_modules/zod/v4/core/compile.cjs +8 -0
- package/node_modules/zod/v4/core/compile.js +8 -0
- package/node_modules/zod/v4/core/schemas.cjs +30 -0
- package/node_modules/zod/v4/core/schemas.d.cts +3 -1
- package/node_modules/zod/v4/core/schemas.d.ts +3 -1
- package/node_modules/zod/v4/core/schemas.js +30 -0
- package/node_modules/zod/v4/core/util.cjs +15 -0
- package/node_modules/zod/v4/core/util.d.cts +2 -0
- package/node_modules/zod/v4/core/util.d.ts +2 -0
- package/node_modules/zod/v4/core/util.js +14 -0
- package/node_modules/zod/v4/core/versions.cjs +1 -1
- package/node_modules/zod/v4/core/versions.js +1 -1
- package/openclaw.plugin.json +1 -31
- package/package.json +8 -8
- package/dist/.setup/channel-access-DasWY_OV.mjs +0 -48
- package/dist/.setup/channel.setup-DaDQdctj.mjs +0 -249
- package/dist/.setup/outbound-adapter-DfAanoCO.mjs +0 -543
- package/dist/.setup/provider.runtime-DnionCyo.mjs +0 -2
- package/dist/.setup/setup-plugin-api-D1QuM187.mjs +0 -3
- package/dist/.setup/targets-UWWZ6gF7.mjs +0 -3
- package/node_modules/typebox/build/system/memory/freeze.d.mts +0 -4
- package/node_modules/typebox/build/system/memory/freeze.mjs +0 -6
package/dist/.setup/{provider-session.runtime-TWOo_JZx.mjs → provider-session.runtime-Dr_5X43t.mjs}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { i as createNoopThreadBindingManager, t as createThreadBindingManager } from "./thread-bindings.manager-
|
|
2
|
-
import { l as reconcileAcpThreadBindingsOnStartup } from "./thread-bindings-
|
|
3
|
-
import { t as createDiscordMessageHandler } from "./message-handler-
|
|
1
|
+
import { i as createNoopThreadBindingManager, t as createThreadBindingManager } from "./thread-bindings.manager-NywKzUtc.mjs";
|
|
2
|
+
import { l as reconcileAcpThreadBindingsOnStartup } from "./thread-bindings-zce4cpu_.mjs";
|
|
3
|
+
import { t as createDiscordMessageHandler } from "./message-handler-hhNSioxo.mjs";
|
|
4
4
|
import { resolveThreadBindingIdleTimeoutMs, resolveThreadBindingMaxAgeMs, resolveThreadBindingsEnabled } from "openclaw/plugin-sdk/conversation-runtime";
|
|
5
5
|
import { getAcpSessionManager, isAcpRuntimeError, rethrowIncognitoSessionError } from "openclaw/plugin-sdk/acp-runtime";
|
|
6
6
|
export { createDiscordMessageHandler, createNoopThreadBindingManager, createThreadBindingManager, getAcpSessionManager, isAcpRuntimeError, reconcileAcpThreadBindingsOnStartup, resolveThreadBindingIdleTimeoutMs, resolveThreadBindingMaxAgeMs, resolveThreadBindingsEnabled, rethrowIncognitoSessionError };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { t as monitorDiscordProvider } from "./provider-BN2bCIUp.mjs";
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { danger } from "openclaw/plugin-sdk/runtime-env";
|
|
2
|
+
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
3
|
+
import { makeProxyFetch } from "openclaw/plugin-sdk/fetch-runtime";
|
|
4
|
+
//#region extensions/discord/src/proxy-fetch.ts
|
|
5
|
+
function resolveDiscordProxyFetchForAccount(account, cfg) {
|
|
6
|
+
return withValidatedDiscordProxy(normalizeOptionalString(account.config.proxy) ?? normalizeOptionalString(cfg?.channels?.discord?.proxy), void 0, makeProxyFetch);
|
|
7
|
+
}
|
|
8
|
+
function withValidatedDiscordProxy(proxyUrl, runtime, createValue) {
|
|
9
|
+
const proxy = proxyUrl?.trim();
|
|
10
|
+
if (!proxy) return;
|
|
11
|
+
try {
|
|
12
|
+
validateDiscordProxyUrl(proxy);
|
|
13
|
+
return createValue(proxy);
|
|
14
|
+
} catch (err) {
|
|
15
|
+
runtime?.error?.(danger(`discord: invalid rest proxy: ${String(err)}`));
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
function validateDiscordProxyUrl(proxyUrl) {
|
|
20
|
+
let parsed;
|
|
21
|
+
try {
|
|
22
|
+
parsed = new URL(proxyUrl);
|
|
23
|
+
} catch {
|
|
24
|
+
throw new Error("Proxy URL must be a valid http or https URL");
|
|
25
|
+
}
|
|
26
|
+
if (!["http:", "https:"].includes(parsed.protocol)) throw new Error("Proxy URL must use http or https");
|
|
27
|
+
return proxyUrl;
|
|
28
|
+
}
|
|
29
|
+
//#endregion
|
|
30
|
+
export { validateDiscordProxyUrl as n, withValidatedDiscordProxy as r, resolveDiscordProxyFetchForAccount as t };
|
package/dist/.setup/{realtime-session.runtime-DvfS4vJj.mjs → realtime-session.runtime-BTDWsV4d.mjs}
RENAMED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { _ as setDiscordAudioOutputStatus, h as restoreDiscordAudioError, l as createDiscordPcmToRealtimeConverter, m as getDiscordAudioOutputStatus, p as DiscordAudioOutputStatus } from "./receive-recovery-
|
|
1
|
+
import { _ as setDiscordAudioOutputStatus, h as restoreDiscordAudioError, l as createDiscordPcmToRealtimeConverter, m as getDiscordAudioOutputStatus, p as DiscordAudioOutputStatus } from "./receive-recovery-C3Ks4wAQ.mjs";
|
|
2
2
|
import { t as resolveDiscordOutputAudioDelta } from "./output-activity-uBpMSX75.mjs";
|
|
3
|
-
import { n as discordRealtimeVoiceSecretOwnerId } from "./secret-config-contract-
|
|
4
|
-
import { y as logVoiceVerbose } from "./provider-
|
|
5
|
-
import { a as
|
|
3
|
+
import { n as discordRealtimeVoiceSecretOwnerId } from "./secret-config-contract-B1kE4sDv.mjs";
|
|
4
|
+
import { y as logVoiceVerbose } from "./provider-BN2bCIUp.mjs";
|
|
5
|
+
import { a as maybeControlDiscordVoiceAgentRun, i as logDiscordVoiceAgentControlResult, n as formatVoiceIngressPrompt, r as handleDiscordVoiceAgentControlToolCall, t as DiscordRealtimeRecording } from "./voice-runtime-B7V_LTdX.mjs";
|
|
6
6
|
import { MessageChannel } from "node:worker_threads";
|
|
7
7
|
import { formatErrorMessage, readErrorName, toErrorObject, toStringifiedError } from "openclaw/plugin-sdk/error-runtime";
|
|
8
8
|
import { createSubsystemLogger } from "openclaw/plugin-sdk/runtime-env";
|
|
9
9
|
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
10
|
-
import { randomUUID } from "node:crypto";
|
|
11
10
|
import { formatErrorMessage as formatErrorMessage$1 } from "openclaw/plugin-sdk/ssrf-runtime";
|
|
11
|
+
import { randomUUID } from "node:crypto";
|
|
12
12
|
import { sliceUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
13
13
|
import { createDeferred } from "openclaw/plugin-sdk/extension-shared";
|
|
14
14
|
import { REALTIME_VOICE_AGENT_CONSULT_TOOL_NAME, REALTIME_VOICE_AGENT_CONTROL_TOOL, REALTIME_VOICE_AGENT_CONTROL_TOOL_NAME, REALTIME_VOICE_AUDIO_FORMAT_PCM16_24KHZ, buildRealtimeVoiceAgentErrorProviderResult, buildRealtimeVoiceSessionInstructions, buildRealtimeVoiceSpeakExactMessage, canonicalizeRealtimeVoiceProviderId, classifyRealtimeVoiceConsultToolCall, classifySkippableRealtimeVoiceConsultTranscript, createRealtimeVoiceAgentTalkbackQueue, createRealtimeVoiceOutputActivityTracker, createRealtimeVoiceSessionHarness, isRealtimeVoiceAudioAudible, isRealtimeVoiceWakeNameRequired, matchRealtimeVoiceActivationName, matchRealtimeVoiceConsultQuestions, projectInternalRealtimeVoicePublicConfig, realtimeVoiceAudioDurationMs, registerRealtimeVoiceSelection, resolveConfiguredRealtimeVoiceProviderAsync, resolveRealtimeVoiceAgentConsultTools, resolveRealtimeVoiceBargeIn, resolveRealtimeVoiceInterruptResponseOnInputAudio, resolveRealtimeVoiceMinBargeInAudioEndMs, resolveRealtimeVoiceSessionPolicy } from "openclaw/plugin-sdk/realtime-voice";
|
|
@@ -180,6 +180,22 @@ function resolveDiscordRealtimeSpeakerConfig(params) {
|
|
|
180
180
|
};
|
|
181
181
|
}
|
|
182
182
|
//#endregion
|
|
183
|
+
//#region extensions/discord/src/voice/log-preview.ts
|
|
184
|
+
const DISCORD_REALTIME_INTERRUPTION_MESSAGES = /* @__PURE__ */ new Map([
|
|
185
|
+
["client:response.cancel", "interrupt requested"],
|
|
186
|
+
["client:conversation.item.truncate.skipped", "interrupt ignored"],
|
|
187
|
+
["client:conversation.item.truncate", "audio truncated"],
|
|
188
|
+
["server:response.cancelled", "interrupt confirmed"]
|
|
189
|
+
]);
|
|
190
|
+
function formatRealtimeInfoLog(event) {
|
|
191
|
+
const eventKey = `${event.direction}:${event.type}`;
|
|
192
|
+
const message = eventKey === "server:error" && event.detail === "Cancellation failed: no active response found" ? "interrupt raced" : DISCORD_REALTIME_INTERRUPTION_MESSAGES.get(eventKey);
|
|
193
|
+
if (message) return `discord voice: realtime model ${message} ${eventKey}${event.detail ? ` ${event.detail}` : ""}`;
|
|
194
|
+
if (!event.type.startsWith("session.") || event.type.startsWith("session.output_audio") || event.type.endsWith(".delta") || event.type.endsWith(".append")) return;
|
|
195
|
+
const detail = event.detail ? ` ${event.detail}` : "";
|
|
196
|
+
return `discord voice: realtime lifecycle ${event.direction}:${event.type}${detail}`;
|
|
197
|
+
}
|
|
198
|
+
//#endregion
|
|
183
199
|
//#region extensions/discord/src/voice/realtime-transcript.ts
|
|
184
200
|
const PARTIAL_TRANSCRIPT_MAX_CHARS = 240;
|
|
185
201
|
function mergeRealtimePartialTranscript(previous, next) {
|
|
@@ -204,10 +220,10 @@ var DiscordRealtimeTurns = class {
|
|
|
204
220
|
}
|
|
205
221
|
beginSpeakerTurn(context, userId) {
|
|
206
222
|
if (this.source && (this.source.userId !== userId || this.source.senderIsOwner !== context.senderIsOwner)) throw new Error("A Discord realtime connection cannot change speaker authority");
|
|
207
|
-
this.source ??=
|
|
223
|
+
this.source ??= {
|
|
208
224
|
userId,
|
|
209
225
|
senderIsOwner: context.senderIsOwner
|
|
210
|
-
}
|
|
226
|
+
};
|
|
211
227
|
this.resetPartialWakeNameTracking();
|
|
212
228
|
const turn = {
|
|
213
229
|
bridge: this.params.bridge(),
|
|
@@ -217,12 +233,8 @@ var DiscordRealtimeTurns = class {
|
|
|
217
233
|
...context,
|
|
218
234
|
...this.source
|
|
219
235
|
},
|
|
220
|
-
startedAt: Date.now(),
|
|
221
236
|
hasAudio: false,
|
|
222
237
|
closed: false,
|
|
223
|
-
inputDiscordBytes: 0,
|
|
224
|
-
inputRealtimeBytes: 0,
|
|
225
|
-
inputChunks: 0,
|
|
226
238
|
interruptedPlayback: false
|
|
227
239
|
};
|
|
228
240
|
return {
|
|
@@ -233,11 +245,9 @@ var DiscordRealtimeTurns = class {
|
|
|
233
245
|
const tail = turn.converter.flush();
|
|
234
246
|
if (tail.length > 0) {
|
|
235
247
|
this.registerSpeakerTurnAudioStarted(turn);
|
|
236
|
-
turn.inputRealtimeBytes += tail.length;
|
|
237
248
|
if (this.params.recordInputAudio(tail) && this.isTurnProviderCurrent(turn)) turn.bridge?.sendAudio(tail);
|
|
238
249
|
}
|
|
239
250
|
this.sendRealtimeTrailingSilenceForTurn(turn);
|
|
240
|
-
this.logSpeakerTurnClosed(turn);
|
|
241
251
|
}
|
|
242
252
|
turn.closed = true;
|
|
243
253
|
}
|
|
@@ -273,7 +283,6 @@ var DiscordRealtimeTurns = class {
|
|
|
273
283
|
return;
|
|
274
284
|
}
|
|
275
285
|
forcedSpeakerContext = pendingWakeNameFollowup;
|
|
276
|
-
logger$4.info(`discord voice: realtime wake-name follow-up accepted chars=${trimmed.length} speaker=${forcedSpeakerContext.speakerLabel} voiceSession=${this.params.entry.voiceSessionKey} agent=${this.params.entry.route.agentId}`);
|
|
277
286
|
}
|
|
278
287
|
const acceptedText = wakeNameResult.allowed ? wakeNameResult.text || trimmed : trimmed;
|
|
279
288
|
if (wakeNameResult.allowed && !wakeNameResult.text.trim()) {
|
|
@@ -318,18 +327,10 @@ var DiscordRealtimeTurns = class {
|
|
|
318
327
|
turn.hasAudio = false;
|
|
319
328
|
turn.interruptedPlayback = false;
|
|
320
329
|
}
|
|
321
|
-
turn.inputDiscordBytes += discordPcm48kStereo.length;
|
|
322
330
|
const realtimePcm = turn.converter.process(discordPcm48kStereo);
|
|
323
331
|
if (realtimePcm.length > 0) {
|
|
324
332
|
this.registerSpeakerTurnAudioStarted(turn);
|
|
325
|
-
turn.
|
|
326
|
-
turn.inputChunks += 1;
|
|
327
|
-
if (turn.inputChunks === 1) logger$4.info(`discord voice: realtime input audio started guild=${this.params.entry.guildId} channel=${this.params.entry.channelId} user=${turn.context.userId} speaker=${turn.context.speakerLabel} discordBytes=${discordPcm48kStereo.length} realtimeBytes=${realtimePcm.length} outputAudioMs=${this.params.playback.outputAudioMs()} outputActive=${this.params.playback.isOutputAudioActive()}`);
|
|
328
|
-
if (!turn.interruptedPlayback && isRealtimeVoiceAudioAudible(discordPcm48kStereo, REALTIME_VOICE_AUDIO_FORMAT_PCM16_24KHZ) && isRealtimeVoiceAudioAudible(realtimePcm, REALTIME_VOICE_AUDIO_FORMAT_PCM16_24KHZ) && this.params.interruptRoomPlayback()) {
|
|
329
|
-
turn.interruptedPlayback = true;
|
|
330
|
-
logVoiceVerbose(`realtime barge-in from active speaker audio: guild ${this.params.entry.guildId} channel ${this.params.entry.channelId} user ${turn.context.userId}`);
|
|
331
|
-
logger$4.info(`discord voice: realtime barge-in detected source=active-speaker-audio guild=${this.params.entry.guildId} channel=${this.params.entry.channelId} user=${turn.context.userId} speaker=${turn.context.speakerLabel} discordBytes=${discordPcm48kStereo.length} realtimeBytes=${realtimePcm.length}`);
|
|
332
|
-
}
|
|
333
|
+
if (!turn.interruptedPlayback && isRealtimeVoiceAudioAudible(discordPcm48kStereo, REALTIME_VOICE_AUDIO_FORMAT_PCM16_24KHZ) && isRealtimeVoiceAudioAudible(realtimePcm, REALTIME_VOICE_AUDIO_FORMAT_PCM16_24KHZ) && this.params.interruptRoomPlayback()) turn.interruptedPlayback = true;
|
|
333
334
|
if (this.params.recordInputAudio(realtimePcm) && this.isTurnProviderCurrent(turn)) bridge.sendAudio(realtimePcm);
|
|
334
335
|
}
|
|
335
336
|
}
|
|
@@ -339,27 +340,16 @@ var DiscordRealtimeTurns = class {
|
|
|
339
340
|
registerSpeakerTurnAudioStarted(turn) {
|
|
340
341
|
this.pendingAudio = true;
|
|
341
342
|
this.lastSpeakerTurn = turn;
|
|
342
|
-
turn.lastAudioAt = Date.now();
|
|
343
|
-
if (turn.hasAudio) return;
|
|
344
343
|
turn.hasAudio = true;
|
|
345
|
-
logger$4.info(`discord voice: realtime speaker turn opened guild=${this.params.entry.guildId} channel=${this.params.entry.channelId} user=${turn.context.userId} speaker=${turn.context.speakerLabel} owner=${turn.context.senderIsOwner}`);
|
|
346
|
-
}
|
|
347
|
-
logSpeakerTurnClosed(turn) {
|
|
348
|
-
if (turn.closed || !turn.hasAudio) return;
|
|
349
|
-
const elapsedMs = Date.now() - turn.startedAt;
|
|
350
|
-
const sinceLastAudioMs = turn.lastAudioAt ? Date.now() - turn.lastAudioAt : void 0;
|
|
351
|
-
logger$4.info(`discord voice: realtime speaker turn closed guild=${this.params.entry.guildId} channel=${this.params.entry.channelId} user=${turn.context.userId} speaker=${turn.context.speakerLabel} owner=${turn.context.senderIsOwner} hasAudio=${turn.hasAudio} chunks=${turn.inputChunks} discordBytes=${turn.inputDiscordBytes} realtimeBytes=${turn.inputRealtimeBytes} elapsedMs=${elapsedMs}${sinceLastAudioMs === void 0 ? "" : ` sinceLastAudioMs=${sinceLastAudioMs}`} interruptedPlayback=${turn.interruptedPlayback}`);
|
|
352
344
|
}
|
|
353
345
|
sendRealtimeTrailingSilenceForTurn(turn) {
|
|
354
346
|
const bridge = turn.bridge;
|
|
355
347
|
if (!bridge || !this.isTurnProviderCurrent(turn) || bridge.bridge.pacesInputAudio || !turn.hasAudio) return;
|
|
356
348
|
const providerId = this.params.providerId() ?? this.params.realtimeConfig()?.provider ?? "openai";
|
|
357
349
|
const rawSilenceDurationMs = (this.params.realtimeConfig()?.providers?.[providerId])?.silenceDurationMs;
|
|
358
|
-
const
|
|
359
|
-
const silenceBytes = Math.ceil(24e3 * silenceMs / 1e3) * REALTIME_PCM16_BYTES_PER_SAMPLE;
|
|
350
|
+
const silenceBytes = Math.ceil(24e3 * Math.min(DISCORD_REALTIME_TRAILING_SILENCE_MAX_MS, Math.max(DISCORD_REALTIME_TRAILING_SILENCE_MIN_MS, typeof rawSilenceDurationMs === "number" && Number.isFinite(rawSilenceDurationMs) ? rawSilenceDurationMs : 0)) / 1e3) * REALTIME_PCM16_BYTES_PER_SAMPLE;
|
|
360
351
|
const silence = Buffer.alloc(silenceBytes);
|
|
361
352
|
bridge.sendAudio(silence);
|
|
362
|
-
logger$4.info(`discord voice: realtime trailing silence sent guild=${this.params.entry.guildId} channel=${this.params.entry.channelId} user=${turn.context.userId} speaker=${turn.context.speakerLabel} silenceMs=${silenceMs} realtimeBytes=${silence.length}`);
|
|
363
353
|
}
|
|
364
354
|
resolveWakeNameTranscript(text, requireWakeName) {
|
|
365
355
|
if (!requireWakeName) return {
|
|
@@ -371,10 +361,7 @@ var DiscordRealtimeTurns = class {
|
|
|
371
361
|
edge: "leading"
|
|
372
362
|
};
|
|
373
363
|
const wakeNameResult = matchRealtimeVoiceActivationName(text, this.params.wakeNames());
|
|
374
|
-
if (wakeNameResult)
|
|
375
|
-
logger$4.info(`discord voice: realtime wake-name gate matched canonical=${wakeNameResult.activationName} heard=${wakeNameResult.heardName} match=${wakeNameResult.match} voiceSession=${this.params.entry.voiceSessionKey} agent=${this.params.entry.route.agentId}`);
|
|
376
|
-
return wakeNameResult;
|
|
377
|
-
}
|
|
364
|
+
if (wakeNameResult) return wakeNameResult;
|
|
378
365
|
return {
|
|
379
366
|
allowed: false,
|
|
380
367
|
text
|
|
@@ -393,7 +380,6 @@ var DiscordRealtimeTurns = class {
|
|
|
393
380
|
context,
|
|
394
381
|
expiresAt: Date.now() + DISCORD_REALTIME_WAKE_NAME_FOLLOWUP_TTL_MS
|
|
395
382
|
};
|
|
396
|
-
logger$4.info(`discord voice: realtime wake-name follow-up armed speaker=${context.speakerLabel} voiceSession=${this.params.entry.voiceSessionKey} agent=${this.params.entry.route.agentId}`);
|
|
397
383
|
}
|
|
398
384
|
consumePendingWakeNameFollowup() {
|
|
399
385
|
const pending = this.pendingWakeNameFollowup;
|
|
@@ -412,7 +398,6 @@ const logger$3 = createSubsystemLogger("discord/voice");
|
|
|
412
398
|
const DISCORD_REALTIME_TALKBACK_DEBOUNCE_MS = 350;
|
|
413
399
|
const DISCORD_REALTIME_FALLBACK_TEXT = "I hit an error while checking that. Please try again.";
|
|
414
400
|
const DISCORD_REALTIME_FORCED_CONSULT_FALLBACK_DELAY_MS = 200;
|
|
415
|
-
const DISCORD_REALTIME_FORCED_CONSULT_REASON = "provider_final_transcript_without_openclaw_agent_consult";
|
|
416
401
|
const CANCELLED_CONSULT_RESULT = {
|
|
417
402
|
status: "cancelled",
|
|
418
403
|
message: "OpenClaw cancelled this consult before completion. Do not restart it."
|
|
@@ -481,7 +466,6 @@ var DiscordRealtimeConsults = class {
|
|
|
481
466
|
const outcome = classifyRealtimeVoiceConsultToolCall(event.args, { retainedExactSpeechTexts: this.params.playback.retainedExactSpeechTexts() });
|
|
482
467
|
switch (outcome.kind) {
|
|
483
468
|
case "exact-speech-echo":
|
|
484
|
-
logger$3.info(`discord voice: realtime exact speech consult bypassed call=${callId} answerChars=${outcome.text.length}`);
|
|
485
469
|
await session.submitToolResult(callId, { text: outcome.text });
|
|
486
470
|
return;
|
|
487
471
|
case "malformed":
|
|
@@ -490,7 +474,6 @@ var DiscordRealtimeConsults = class {
|
|
|
490
474
|
return;
|
|
491
475
|
}
|
|
492
476
|
const consultMessage = outcome.message;
|
|
493
|
-
logger$3.info(`discord voice: realtime consult requested call=${callId} voiceSession=${this.params.entry.voiceSessionKey} supervisorSession=${this.params.entry.route.sessionKey} agent=${this.params.entry.route.agentId} question=${formatVoiceLogPreview(consultMessage)}`);
|
|
494
477
|
const nativeConsult = this.params.harness.forcedConsults.recordNativeConsult(event.args, callId);
|
|
495
478
|
if (nativeConsult.kind === "already_delivered" && this.params.harness.forcedConsults.isCancelled(nativeConsult.handle)) {
|
|
496
479
|
await this.submitAgentProxyConsultResult(callId, session, CANCELLED_CONSULT_RESULT);
|
|
@@ -540,8 +523,7 @@ var DiscordRealtimeConsults = class {
|
|
|
540
523
|
deliveryOwner: "consult"
|
|
541
524
|
}));
|
|
542
525
|
if (this.params.stopped() || providerEpoch !== this.params.providerEpoch()) return;
|
|
543
|
-
if ("
|
|
544
|
-
else if ("error" in result) logger$3.warn(`discord voice: realtime consult failed call=${callId}: ${result.error}`);
|
|
526
|
+
if ("error" in result) logger$3.warn(`discord voice: realtime consult failed call=${callId}`);
|
|
545
527
|
delivery.submissionStarted = true;
|
|
546
528
|
await this.submitAgentProxyConsultResult(callId, session, result);
|
|
547
529
|
if (state.delivery === "provider-pending") state.delivery = "provider";
|
|
@@ -635,8 +617,8 @@ var DiscordRealtimeConsults = class {
|
|
|
635
617
|
if (!question) return;
|
|
636
618
|
const skipReason = classifySkippableRealtimeVoiceConsultTranscript(question);
|
|
637
619
|
if (skipReason) {
|
|
638
|
-
|
|
639
|
-
logger$3.info(`discord voice: realtime forced agent consult skipped reason=${skipReason} chars=${question.length}
|
|
620
|
+
this.params.turns.consumePendingSpeakerContext();
|
|
621
|
+
logger$3.info(`discord voice: realtime forced agent consult skipped reason=${skipReason} chars=${question.length}`);
|
|
640
622
|
return;
|
|
641
623
|
}
|
|
642
624
|
const context = speakerContext ?? this.params.turns.consumePendingSpeakerContext();
|
|
@@ -669,9 +651,6 @@ var DiscordRealtimeConsults = class {
|
|
|
669
651
|
return;
|
|
670
652
|
}
|
|
671
653
|
const startedAt = Date.now();
|
|
672
|
-
logger$3.info(`discord voice: realtime forced agent consult starting chars=${question.length} voiceSession=${this.params.entry.voiceSessionKey} supervisorSession=${this.params.entry.route.sessionKey} agent=${this.params.entry.route.agentId} speaker=${context.speakerLabel} owner=${context.senderIsOwner}`);
|
|
673
|
-
logger$3.debug(`discord voice: realtime forced agent consult reason=${DISCORD_REALTIME_FORCED_CONSULT_REASON} consultPolicy=${this.params.consultPolicy()} wakeNamePolicy=${this.params.wakeNamePolicy()} requireWakeName=${this.params.isWakeNameRequired()} voiceSession=${this.params.entry.voiceSessionKey} supervisorSession=${this.params.entry.route.sessionKey} agent=${this.params.entry.route.agentId} speaker=${context.speakerLabel}`);
|
|
674
|
-
if (this.params.playback.hasInterruptibleOutputAudio()) logger$3.info(`discord voice: realtime forced agent consult preserving active playback guild=${this.params.entry.guildId} channel=${this.params.entry.channelId} outputAudioMs=${this.params.playback.outputAudioMs()} outputActive=${this.params.playback.isOutputAudioActive()} playbackChunks=${this.params.harness.outputActivity.snapshot().chunks}`);
|
|
675
654
|
state.delivery = "forced-pending";
|
|
676
655
|
const result = await this.trackAgentProxyConsult(pending, this.runAgentTurn({
|
|
677
656
|
context,
|
|
@@ -681,8 +660,7 @@ var DiscordRealtimeConsults = class {
|
|
|
681
660
|
const deliveries = this.providerDeliveries.get(state);
|
|
682
661
|
await Promise.all(Array.from(deliveries ?? [], (delivery) => delivery.promise));
|
|
683
662
|
if (state.providerEpoch !== this.params.providerEpoch() || "status" in result) return;
|
|
684
|
-
if ("
|
|
685
|
-
else logger$3.warn(`discord voice: realtime forced agent consult failed elapsedMs=${Date.now() - startedAt}: ${result.error}`);
|
|
663
|
+
if ("error" in result) logger$3.warn(`discord voice: realtime forced agent consult failed elapsedMs=${Date.now() - startedAt}`);
|
|
686
664
|
const text = "text" in result ? result.text : DISCORD_REALTIME_FALLBACK_TEXT;
|
|
687
665
|
if (text.trim() && state.delivery === "forced-pending") {
|
|
688
666
|
state.delivery = "playback";
|
|
@@ -714,7 +692,6 @@ var DiscordRealtimeConsults = class {
|
|
|
714
692
|
const pendingResult = state.result ?? state.promise;
|
|
715
693
|
if (!pendingResult) return false;
|
|
716
694
|
const providerDelivery = state.delivery === "provider-pending" || state.delivery === "forced-pending" && !state.result && session.bridge.supportsToolResultSuppression === false ? this.beginProviderDelivery(state) : void 0;
|
|
717
|
-
logger$3.info(`discord voice: realtime consult ${state.result ? "reused recent" : "joined in-flight"} agent result call=${callId} speaker=${state.speaker.speakerLabel} owner=${state.speaker.senderIsOwner}`);
|
|
718
695
|
try {
|
|
719
696
|
const result = await pendingResult;
|
|
720
697
|
if (this.params.stopped() || state.providerEpoch !== this.params.providerEpoch() || state.delivery === "detached" || state.delivery === "retired") return true;
|
|
@@ -963,13 +940,13 @@ var DiscordRealtimePlayback = class {
|
|
|
963
940
|
if (event.type === "continuous-flushed" && event.marker === this.pendingDirectCompletion) {
|
|
964
941
|
this.pendingDirectCompletion = void 0;
|
|
965
942
|
this.responseAudio = "completed";
|
|
966
|
-
this.completeExactSpeechResponse(
|
|
943
|
+
this.completeExactSpeechResponse();
|
|
967
944
|
}
|
|
968
945
|
if (event.type === "continuous-idle") {
|
|
969
946
|
this.responseAudio = "completed";
|
|
970
947
|
this.params.harness.finishOutputAudio("player-idle");
|
|
971
948
|
this.params.harness.outputActivity.reset();
|
|
972
|
-
this.completeExactSpeechResponse(
|
|
949
|
+
this.completeExactSpeechResponse();
|
|
973
950
|
}
|
|
974
951
|
};
|
|
975
952
|
const close = () => {
|
|
@@ -1033,7 +1010,6 @@ var DiscordRealtimePlayback = class {
|
|
|
1033
1010
|
logger$2.info(`discord voice: realtime barge-in ignored reason=${reason} outputActive=false guild=${this.params.entry.guildId} channel=${this.params.entry.channelId} playbackChunks=${this.params.harness.outputActivity.snapshot().chunks}`);
|
|
1034
1011
|
return false;
|
|
1035
1012
|
}
|
|
1036
|
-
logger$2.info(`discord voice: realtime barge-in requested reason=${reason} guild=${this.params.entry.guildId} channel=${this.params.entry.channelId} outputAudioMs=${this.outputAudioMs()} outputActive=${this.isOutputAudioActive()} playbackChunks=${this.params.harness.outputActivity.snapshot().chunks}`);
|
|
1037
1013
|
const clearGeneration = this.outputClearGeneration;
|
|
1038
1014
|
const bridge = this.params.bridge();
|
|
1039
1015
|
const outputs = Array.from(this.outputs);
|
|
@@ -1132,7 +1108,7 @@ var DiscordRealtimePlayback = class {
|
|
|
1132
1108
|
id: this.directOutput.id
|
|
1133
1109
|
});
|
|
1134
1110
|
}
|
|
1135
|
-
this.completeExactSpeechResponse(
|
|
1111
|
+
this.completeExactSpeechResponse();
|
|
1136
1112
|
}
|
|
1137
1113
|
handleResponseDone(outcome) {
|
|
1138
1114
|
if (this.directOutput && outcome.status === "completed") {
|
|
@@ -1150,16 +1126,16 @@ var DiscordRealtimePlayback = class {
|
|
|
1150
1126
|
this.generatingItems.clear();
|
|
1151
1127
|
this.responseAudio = "completed";
|
|
1152
1128
|
output?.finish(outcome.status, outcome.status === "completed");
|
|
1153
|
-
this.completeExactSpeechResponse(
|
|
1129
|
+
this.completeExactSpeechResponse();
|
|
1154
1130
|
}
|
|
1155
1131
|
enqueueExactSpeechMessage(text) {
|
|
1156
1132
|
if (this.params.stopped() || !this.retainExactSpeechMessage(text)) return;
|
|
1157
|
-
this.drainQueuedExactSpeechMessages(
|
|
1133
|
+
this.drainQueuedExactSpeechMessages();
|
|
1158
1134
|
}
|
|
1159
1135
|
deliverRetainedSpeech(text) {
|
|
1160
1136
|
if (this.retainedSpeechClosed) return;
|
|
1161
1137
|
if (this.speechSuccessor) this.speechSuccessor.deliverRetainedSpeech(text);
|
|
1162
|
-
else if (this.retainExactSpeechMessage(text)) this.drainQueuedExactSpeechMessages(
|
|
1138
|
+
else if (this.retainExactSpeechMessage(text)) this.drainQueuedExactSpeechMessages();
|
|
1163
1139
|
}
|
|
1164
1140
|
/** Accept completed consult ownership without starting provider work during transport cleanup. */
|
|
1165
1141
|
retainExactSpeechMessage(text) {
|
|
@@ -1173,17 +1149,15 @@ var DiscordRealtimePlayback = class {
|
|
|
1173
1149
|
return false;
|
|
1174
1150
|
}
|
|
1175
1151
|
this.queuedExactSpeechMessages.push(text);
|
|
1176
|
-
logger$2.info(`discord voice: realtime exact speech queued guild=${this.params.entry.guildId} channel=${this.params.entry.channelId} queued=${this.queuedExactSpeechMessages.length} outputAudioMs=${this.outputAudioMs()} outputActive=${this.isOutputAudioActive()}`);
|
|
1177
1152
|
return true;
|
|
1178
1153
|
}
|
|
1179
1154
|
retainedExactSpeechTexts() {
|
|
1180
1155
|
return [...this.exactSpeechState.status === "active" ? [this.exactSpeechState.message] : [], ...this.queuedExactSpeechMessages];
|
|
1181
1156
|
}
|
|
1182
|
-
drainQueuedExactSpeechMessages(
|
|
1157
|
+
drainQueuedExactSpeechMessages() {
|
|
1183
1158
|
if (this.params.stopped() || !this.params.bridgeReady() || this.responseAudio !== "completed" || this.exactSpeechState.status === "active" || this.queuedExactSpeechMessages.length === 0 || this.hasInterruptibleOutputAudio()) return;
|
|
1184
1159
|
const next = this.queuedExactSpeechMessages.shift();
|
|
1185
1160
|
if (!next) return;
|
|
1186
|
-
logger$2.info(`discord voice: realtime exact speech dequeued reason=${reason} guild=${this.params.entry.guildId} channel=${this.params.entry.channelId} queued=${this.queuedExactSpeechMessages.length}`);
|
|
1187
1161
|
this.sendExactSpeechMessage(next);
|
|
1188
1162
|
}
|
|
1189
1163
|
sendWakeNameAck(result) {
|
|
@@ -1194,7 +1168,6 @@ var DiscordRealtimePlayback = class {
|
|
|
1194
1168
|
}
|
|
1195
1169
|
const ack = DISCORD_REALTIME_WAKE_ACKS[this.wakeNameAckIndex % DISCORD_REALTIME_WAKE_ACKS.length];
|
|
1196
1170
|
this.wakeNameAckIndex += 1;
|
|
1197
|
-
logger$2.info(`discord voice: realtime wake-name ack canonical=${result.activationName} heard=${result.heardName} match=${result.match} voiceSession=${this.params.entry.voiceSessionKey} agent=${this.params.entry.route.agentId}`);
|
|
1198
1171
|
this.enqueueExactSpeechMessage(ack ?? "Yeah.");
|
|
1199
1172
|
}
|
|
1200
1173
|
speakControlResult(text) {
|
|
@@ -1231,7 +1204,6 @@ var DiscordRealtimePlayback = class {
|
|
|
1231
1204
|
if (normalizeControlSpeechText(text) !== recent.normalizedText) return;
|
|
1232
1205
|
recent.assistantTranscriptCount += 1;
|
|
1233
1206
|
if (recent.assistantTranscriptCount <= 1) return;
|
|
1234
|
-
logger$2.info(`discord voice: realtime duplicate active-run control speech suppressed guild=${this.params.entry.guildId} channel=${this.params.entry.channelId}`);
|
|
1235
1207
|
this.params.harness.handleBargeIn({
|
|
1236
1208
|
audioPlaybackActive: true,
|
|
1237
1209
|
force: true
|
|
@@ -1271,14 +1243,11 @@ var DiscordRealtimePlayback = class {
|
|
|
1271
1243
|
this.params.onTerminalError(error);
|
|
1272
1244
|
}
|
|
1273
1245
|
createOutput() {
|
|
1274
|
-
const logContext = `guild=${this.params.entry.guildId} channel=${this.params.entry.channelId}`;
|
|
1275
1246
|
const output = new DiscordRealtimeOutput({
|
|
1276
1247
|
player: this.params.player,
|
|
1277
1248
|
continuous: this.isContinuousOutput(),
|
|
1278
1249
|
onStart: () => {
|
|
1279
1250
|
this.params.harness.outputActivity.markPlaybackStarted();
|
|
1280
|
-
const config = this.params.realtimeConfig();
|
|
1281
|
-
logger$2.info(`discord voice: realtime audio playback started ${logContext} mode=${this.params.mode} model=${config?.model ?? "provider-default"} voice=${config?.speakerVoice ?? config?.speakerVoiceId ?? "provider-default"}`);
|
|
1282
1251
|
},
|
|
1283
1252
|
onClose: (closed, reason) => {
|
|
1284
1253
|
if (!this.outputs.delete(closed)) return;
|
|
@@ -1294,7 +1263,7 @@ var DiscordRealtimePlayback = class {
|
|
|
1294
1263
|
}
|
|
1295
1264
|
this.params.harness.outputActivity.reset();
|
|
1296
1265
|
}
|
|
1297
|
-
this.completeExactSpeechResponse(
|
|
1266
|
+
this.completeExactSpeechResponse();
|
|
1298
1267
|
},
|
|
1299
1268
|
onBargeIn: (reason) => this.handleBargeIn(reason),
|
|
1300
1269
|
onError: (error) => this.stopAfterPlaybackFailure("output-playback-error", error instanceof Error ? error : new Error(formatErrorMessage$1(error)))
|
|
@@ -1320,10 +1289,10 @@ var DiscordRealtimePlayback = class {
|
|
|
1320
1289
|
this.beginResponse();
|
|
1321
1290
|
this.params.bridge()?.sendUserMessage(this.params.buildSpeakExactMessage(text));
|
|
1322
1291
|
}
|
|
1323
|
-
completeExactSpeechResponse(
|
|
1292
|
+
completeExactSpeechResponse() {
|
|
1324
1293
|
if (this.pendingDirectCompletion !== void 0 || this.responseAudio !== "completed" || this.isOutputAudioActive()) return;
|
|
1325
1294
|
this.retireExactSpeech();
|
|
1326
|
-
this.drainQueuedExactSpeechMessages(
|
|
1295
|
+
this.drainQueuedExactSpeechMessages();
|
|
1327
1296
|
}
|
|
1328
1297
|
};
|
|
1329
1298
|
//#endregion
|
|
@@ -1353,10 +1322,9 @@ var DiscordRealtimeSpeakerSession = class {
|
|
|
1353
1322
|
this.inputIdleListeners = /* @__PURE__ */ new Set();
|
|
1354
1323
|
this.lastActivityAt = Date.now();
|
|
1355
1324
|
this.outputEnabled = !params.standby;
|
|
1356
|
-
const recordingEpoch = this.providerContinuityEpoch;
|
|
1357
1325
|
this.recording = new DiscordRealtimeRecording({
|
|
1358
1326
|
entry: this.params.entry,
|
|
1359
|
-
isCurrent: () => this.lifecycle.status !== "stopped"
|
|
1327
|
+
isCurrent: () => this.lifecycle.status !== "stopped",
|
|
1360
1328
|
warn: (message) => logger$1.warn(message)
|
|
1361
1329
|
});
|
|
1362
1330
|
this.harness = createRealtimeVoiceSessionHarness({
|
|
@@ -1424,7 +1392,6 @@ var DiscordRealtimeSpeakerSession = class {
|
|
|
1424
1392
|
consultToolsAllow: () => this.policy.consultToolsAllow,
|
|
1425
1393
|
debounceMs: () => this.realtimeConfig?.debounceMs,
|
|
1426
1394
|
isAgentProxy: () => this.params.mode === "agent-proxy" && !this.policy.handlesAgentConsult,
|
|
1427
|
-
isWakeNameRequired: () => this.isWakeNameRequired(),
|
|
1428
1395
|
playback: this.playback,
|
|
1429
1396
|
runAgentTurn: (turn) => this.trackOperation(() => this.params.runAgentTurn(turn)),
|
|
1430
1397
|
turns: this.turns,
|
|
@@ -1451,7 +1418,7 @@ var DiscordRealtimeSpeakerSession = class {
|
|
|
1451
1418
|
const usesRealtimeAgentHandoff = this.params.mode === "bidi" || toolPolicy !== "none";
|
|
1452
1419
|
const onReady = () => {
|
|
1453
1420
|
this.markProviderGenerationObserved();
|
|
1454
|
-
if (this.markLifecycleReady()) this.playback.drainQueuedExactSpeechMessages(
|
|
1421
|
+
if (this.markLifecycleReady()) this.playback.drainQueuedExactSpeechMessages();
|
|
1455
1422
|
};
|
|
1456
1423
|
this.bridge = this.harness.createBridge({
|
|
1457
1424
|
provider: resolved.provider,
|
|
@@ -1488,7 +1455,6 @@ var DiscordRealtimeSpeakerSession = class {
|
|
|
1488
1455
|
return;
|
|
1489
1456
|
}
|
|
1490
1457
|
this.markProviderGenerationObserved();
|
|
1491
|
-
if (isFinal && text.trim()) logger$1.info(`discord voice: realtime ${role} transcript (${text.length} chars): ${formatVoiceLogPreview(text)}`);
|
|
1492
1458
|
if (isFinal && role === "assistant") this.playback.suppressDuplicateControlSpeech(text);
|
|
1493
1459
|
if (role !== "user") return;
|
|
1494
1460
|
if (!isFinal) {
|
|
@@ -1538,7 +1504,7 @@ var DiscordRealtimeSpeakerSession = class {
|
|
|
1538
1504
|
return;
|
|
1539
1505
|
}
|
|
1540
1506
|
this.markProviderGenerationObserved();
|
|
1541
|
-
this.playback.drainQueuedExactSpeechMessages(
|
|
1507
|
+
this.playback.drainQueuedExactSpeechMessages();
|
|
1542
1508
|
logger$1.info(`discord voice: realtime bridge ready mode=${this.params.mode} provider=${resolved.provider.id} model=${resolvedModel ?? "default"} voice=${resolvedVoice ?? "default"}`);
|
|
1543
1509
|
}
|
|
1544
1510
|
close(disposition = "abort") {
|
|
@@ -1653,7 +1619,6 @@ var DiscordRealtimeSpeakerSession = class {
|
|
|
1653
1619
|
return this.harness.transcript.at(-1);
|
|
1654
1620
|
}
|
|
1655
1621
|
activateOutput() {
|
|
1656
|
-
this.readVoiceSelection();
|
|
1657
1622
|
this.outputEnabled = true;
|
|
1658
1623
|
this.playback.activateOutputAudioPort();
|
|
1659
1624
|
}
|
|
@@ -1715,11 +1680,9 @@ var DiscordRealtimeSpeakerSession = class {
|
|
|
1715
1680
|
}
|
|
1716
1681
|
handleBridgeEvent(event) {
|
|
1717
1682
|
if (!(event.direction === "client" && event.type === "session.continuity.reset") && !event.type.endsWith("audio.delta") && event.type !== "output_audio.rtp") this.markProviderGenerationObserved();
|
|
1718
|
-
const detail = event.detail ? ` ${event.detail}` : "";
|
|
1719
1683
|
if (event.direction === "client" && event.type === "session.continuity.reset") this.resetProviderContinuity(event.type);
|
|
1720
1684
|
if (event.direction === "server" && event.type === "response.created") this.playback.beginResponse();
|
|
1721
1685
|
if (event.direction === "server" && event.type === "input_audio_buffer.speech_started") this.turns.resetPartialWakeNameTracking();
|
|
1722
|
-
if (shouldLogRealtimeVerboseEvent(event)) logVoiceVerbose(`realtime ${event.direction}:${event.type}${detail}`);
|
|
1723
1686
|
const info = formatRealtimeInfoLog(event);
|
|
1724
1687
|
if (info) logger$1.info(info);
|
|
1725
1688
|
}
|
|
@@ -1798,7 +1761,7 @@ var DiscordRealtimeVoiceSession = class {
|
|
|
1798
1761
|
assertCurrent: () => this.assertOpen()
|
|
1799
1762
|
});
|
|
1800
1763
|
this.idleTimer = setInterval(() => this.releaseIdleSpeakers(), REALTIME_SPEAKER_IDLE_MS);
|
|
1801
|
-
this.idleTimer.unref
|
|
1764
|
+
this.idleTimer.unref();
|
|
1802
1765
|
}
|
|
1803
1766
|
close(disposition = "abort") {
|
|
1804
1767
|
if (this.closed) return this.closeCompletion;
|
|
@@ -274,13 +274,6 @@ var DiscordOpusEncodeStream = class extends Duplex {
|
|
|
274
274
|
}
|
|
275
275
|
};
|
|
276
276
|
async function decodeOpusStreamChunks(stream, params) {
|
|
277
|
-
try {
|
|
278
|
-
for await (const { pcm, packet } of decodeOpusFrames(stream, params)) await params.onChunk(pcm, packet);
|
|
279
|
-
} catch (err) {
|
|
280
|
-
params.onError?.(err);
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
async function* decodeOpusFrames(stream, params) {
|
|
284
277
|
let decoder;
|
|
285
278
|
try {
|
|
286
279
|
decoder = await createDecoder({
|
|
@@ -291,23 +284,19 @@ async function* decodeOpusFrames(stream, params) {
|
|
|
291
284
|
params.onError?.(err);
|
|
292
285
|
if (!warnedOpusMissing) {
|
|
293
286
|
warnedOpusMissing = true;
|
|
294
|
-
params.onWarn(
|
|
287
|
+
params.onWarn("discord voice: no usable opus decoder available (libopus-wasm); cannot decode voice audio");
|
|
295
288
|
}
|
|
296
289
|
return;
|
|
297
290
|
}
|
|
298
|
-
params.onVerbose("opus decoder: libopus-wasm");
|
|
299
291
|
try {
|
|
300
292
|
for await (const chunk of stream) {
|
|
301
293
|
if (!chunk || !(chunk instanceof Buffer) || chunk.length === 0) continue;
|
|
302
294
|
const decoded = decoder.decode(chunk, { maxFrameSize: DISCORD_OPUS_MAX_DECODE_FRAME_SIZE });
|
|
303
|
-
if (decoded.length > 0)
|
|
304
|
-
pcm: Buffer.from(decoded.buffer, decoded.byteOffset, decoded.byteLength),
|
|
305
|
-
packet: chunk
|
|
306
|
-
};
|
|
295
|
+
if (decoded.length > 0) await params.onChunk(Buffer.from(decoded.buffer, decoded.byteOffset, decoded.byteLength), chunk);
|
|
307
296
|
}
|
|
308
297
|
} catch (err) {
|
|
309
298
|
params.onError?.(err);
|
|
310
|
-
if (shouldLogVerbose()) logVerbose(
|
|
299
|
+
if (shouldLogVerbose()) logVerbose("discord voice: opus decode failed");
|
|
311
300
|
} finally {
|
|
312
301
|
decoder.free();
|
|
313
302
|
}
|
|
@@ -383,7 +372,6 @@ async function writeVoiceWavFile(chunks) {
|
|
|
383
372
|
try {
|
|
384
373
|
return {
|
|
385
374
|
path: await workspace.write("segment.wav", wav),
|
|
386
|
-
durationSeconds: (wav.length - 44) / (BIT_DEPTH / 8 * CHANNELS * SAMPLE_RATE),
|
|
387
375
|
cleanup: () => workspace[Symbol.asyncDispose]()
|
|
388
376
|
};
|
|
389
377
|
} catch (error) {
|
|
@@ -425,7 +413,8 @@ function analyzeVoiceReceiveError(err) {
|
|
|
425
413
|
countsAsDecryptFailure: message.includes(DECRYPT_FAILURE_MARKER) || shouldAttemptPassthrough || isWasmMemoryAccessFailure
|
|
426
414
|
};
|
|
427
415
|
}
|
|
428
|
-
function noteVoiceDecryptFailure(state
|
|
416
|
+
function noteVoiceDecryptFailure(state) {
|
|
417
|
+
const now = Date.now();
|
|
429
418
|
if (now - state.lastDecryptFailureAt > 3e4) state.decryptFailureCount = 0;
|
|
430
419
|
state.lastDecryptFailureAt = now;
|
|
431
420
|
state.decryptFailureCount += 1;
|
|
@@ -452,28 +441,25 @@ function recoverDaveZeroTransition(params) {
|
|
|
452
441
|
const { target, sdk, onWarn } = params;
|
|
453
442
|
const networkingState = target.connection.state.networking?.state;
|
|
454
443
|
const daveSession = networkingState?.dave;
|
|
455
|
-
if (target.connection.state.status !== sdk.VoiceConnectionStatus.Ready || networkingState?.code !== sdk.NetworkingStatusCode.Ready || daveSession?.lastTransitionId !== 0 || daveSession.reinitializing !== false
|
|
444
|
+
if (target.connection.state.status !== sdk.VoiceConnectionStatus.Ready || networkingState?.code !== sdk.NetworkingStatusCode.Ready || daveSession?.lastTransitionId !== 0 || daveSession.reinitializing !== false) return "not-attempted";
|
|
456
445
|
try {
|
|
457
446
|
daveSession.recoverFromInvalidTransition(0);
|
|
458
447
|
return "recovered";
|
|
459
|
-
} catch
|
|
460
|
-
onWarn(`discord voice: failed to recover DAVE transition 0 guild=${target.guildId} channel=${target.channelId}
|
|
448
|
+
} catch {
|
|
449
|
+
onWarn(`discord voice: failed to recover DAVE transition 0 guild=${target.guildId} channel=${target.channelId}`);
|
|
461
450
|
return isDaveReinitializing(daveSession) ? "failed" : "not-attempted";
|
|
462
451
|
}
|
|
463
452
|
}
|
|
464
453
|
function enableDaveReceivePassthrough(params) {
|
|
465
|
-
const { target, sdk, reason, expirySeconds,
|
|
454
|
+
const { target, sdk, reason, expirySeconds, onWarn } = params;
|
|
466
455
|
const networkingState = target.connection.state.networking?.state;
|
|
467
|
-
if (target.connection.state.status !== sdk.VoiceConnectionStatus.Ready || !networkingState || networkingState.code !== sdk.NetworkingStatusCode.Ready && networkingState.code !== sdk.NetworkingStatusCode.Resuming) return
|
|
456
|
+
if (target.connection.state.status !== sdk.VoiceConnectionStatus.Ready || !networkingState || networkingState.code !== sdk.NetworkingStatusCode.Ready && networkingState.code !== sdk.NetworkingStatusCode.Resuming) return;
|
|
468
457
|
const daveSession = networkingState.dave?.session;
|
|
469
|
-
if (!daveSession) return
|
|
458
|
+
if (!daveSession) return;
|
|
470
459
|
try {
|
|
471
460
|
daveSession.setPassthroughMode(true, expirySeconds);
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
} catch (err) {
|
|
475
|
-
onWarn(`discord voice: failed to enable DAVE passthrough guild=${target.guildId} channel=${target.channelId} reason=${reason}: ${formatErrorMessage(err)}`);
|
|
476
|
-
return false;
|
|
461
|
+
} catch {
|
|
462
|
+
onWarn(`discord voice: failed to enable DAVE passthrough guild=${target.guildId} channel=${target.channelId} reason=${reason}`);
|
|
477
463
|
}
|
|
478
464
|
}
|
|
479
465
|
//#endregion
|
package/dist/.setup/{resolve-allowlist-common-cIjtqh2F.mjs → resolve-allowlist-common-Bk8Fj6Ik.mjs}
RENAMED
|
@@ -1,15 +1,5 @@
|
|
|
1
|
-
import { h as normalizeDiscordToken } from "./accounts-
|
|
2
|
-
import { o as normalizeDiscordSlug } from "./allow-list-
|
|
3
|
-
import { r as fetchDiscord } from "./api-DqmMUZau.mjs";
|
|
4
|
-
//#region extensions/discord/src/guilds.ts
|
|
5
|
-
async function listGuilds(token, fetcher, options) {
|
|
6
|
-
return (await fetchDiscord("/users/@me/guilds", token, fetcher, options)).flatMap((guild) => typeof guild.id === "string" && typeof guild.name === "string" ? [{
|
|
7
|
-
id: guild.id,
|
|
8
|
-
name: guild.name,
|
|
9
|
-
slug: normalizeDiscordSlug(guild.name)
|
|
10
|
-
}] : []);
|
|
11
|
-
}
|
|
12
|
-
//#endregion
|
|
1
|
+
import { h as normalizeDiscordToken } from "./accounts-C_25wyxC.mjs";
|
|
2
|
+
import { o as normalizeDiscordSlug } from "./allow-list-BXrS8-R9.mjs";
|
|
13
3
|
//#region extensions/discord/src/resolve-allowlist-common.ts
|
|
14
4
|
function resolveDiscordAllowlistToken(token) {
|
|
15
5
|
return normalizeDiscordToken(token, "channels.discord.token");
|
|
@@ -63,4 +53,4 @@ function parseDiscordAllowlistInput(raw, kind) {
|
|
|
63
53
|
} : { name: trimmed.replace(/^@/, "") };
|
|
64
54
|
}
|
|
65
55
|
//#endregion
|
|
66
|
-
export {
|
|
56
|
+
export { parseDiscordAllowlistInput as n, resolveDiscordAllowlistToken as r, filterDiscordGuilds as t };
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import { n as DiscordApiError, r as fetchDiscord, t as DISCORD_DIRECTORY_LOOKUP_TIMEOUT_MS } from "./api-
|
|
4
|
-
import {
|
|
2
|
+
import { o as normalizeDiscordSlug, w as isDiscordThreadChannelType } from "./allow-list-BXrS8-R9.mjs";
|
|
3
|
+
import { n as DiscordApiError, r as fetchDiscord, t as DISCORD_DIRECTORY_LOOKUP_TIMEOUT_MS } from "./api-BlBD4ism.mjs";
|
|
4
|
+
import { n as listGuilds, t as listDiscordGuildChannels } from "./guilds-eDq22iSM.mjs";
|
|
5
|
+
import { n as parseDiscordAllowlistInput, r as resolveDiscordAllowlistToken, t as filterDiscordGuilds } from "./resolve-allowlist-common-Bk8Fj6Ik.mjs";
|
|
5
6
|
//#region extensions/discord/src/resolve-channels.ts
|
|
6
7
|
var resolve_channels_exports = /* @__PURE__ */ __exportAll({ resolveDiscordChannelAllowlist: () => resolveDiscordChannelAllowlist });
|
|
7
8
|
async function listGuildChannels(token, fetcher, guildId) {
|
|
8
|
-
return (await
|
|
9
|
+
return (await listDiscordGuildChannels(token, fetcher, guildId)).map((channel) => {
|
|
9
10
|
const archived = channel.thread_metadata?.archived;
|
|
10
11
|
return {
|
|
11
12
|
id: typeof channel.id === "string" ? channel.id : "",
|
|
@@ -80,10 +81,8 @@ async function resolveDiscordChannelAllowlist(params) {
|
|
|
80
81
|
const ids = channels.filter((channel) => channel.id === query);
|
|
81
82
|
if (ids.length) return ids;
|
|
82
83
|
}
|
|
83
|
-
const slug =
|
|
84
|
-
|
|
85
|
-
const matchSlug = normalizeDiscordSlug(query) === slug ? normalizeDiscordSlug : normalizeDiscordDisplaySlug;
|
|
86
|
-
return channels.filter((channel) => matchSlug(channel.name) === slug);
|
|
84
|
+
const slug = normalizeDiscordSlug(query);
|
|
85
|
+
return channels.filter((channel) => normalizeDiscordSlug(channel.name) === slug);
|
|
87
86
|
}
|
|
88
87
|
const resolveEntry = async (input) => {
|
|
89
88
|
const parsed = parseDiscordAllowlistInput(input, "channel");
|