build(discord): skip native opus builds by default (#80071) · openclaw/openclaw@487687a
steipete
·
2026-05-10
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -7,6 +7,7 @@ Docs: https://docs.openclaw.ai
|
7 | 7 | ### Changes |
8 | 8 | |
9 | 9 | - Talk: add `talk.realtime.instructions` so operators can append realtime voice style instructions while preserving OpenClaw's built-in agent-consult guidance. (#79081) Thanks @VACInc. |
| 10 | +- Discord/voice: default test and source installs to the pure-JS `opusscript` decoder by ignoring optional native `@discordjs/opus` builds, avoiding slow native addon compiles outside dedicated voice-performance lanes. |
10 | 11 | - Gateway/skills: add an opt-in private skill archive upload install path gated by `skills.install.allowUploadedArchives`, so trusted Gateway clients can stage and install zip-backed skills only when operators explicitly enable the code-install surface. (#74430) Thanks @samzong. |
11 | 12 | - Dependencies: refresh workspace pins and patch targets, including ACPX `@agentclientprotocol/claude-agent-acp` `0.33.1`, Codex ACP `0.14.0`, Baileys `7.0.0-rc10`, Google GenAI `2.0.1`, OpenAI `6.37.0`, AWS SDK `3.1045.0`, Kysely `0.29.0`, Tlon skill `0.3.6`, Aimock `1.19.5`, and tsdown `0.22.0`. |
12 | 13 | - Agents/compaction: preserve scoped background exec/process session references across embedded compaction and after-turn runtime contexts without exposing sessions from unrelated scopes. Fixes #79284. (#79307) Thanks @TurboTheTurtle. |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -1213,6 +1213,7 @@ Notes:
|
1213 | 1213 | - If `voice.autoJoin` has multiple entries for the same guild, OpenClaw joins the last configured channel for that guild. |
1214 | 1214 | - `voice.daveEncryption` and `voice.decryptionFailureTolerance` pass through to `@discordjs/voice` join options. |
1215 | 1215 | - `@discordjs/voice` defaults are `daveEncryption=true` and `decryptionFailureTolerance=24` if unset. |
| 1216 | +- OpenClaw defaults to the pure-JS `opusscript` decoder for Discord voice receive. The optional native `@discordjs/opus` package is ignored by the repo pnpm install policy so normal installs and tests do not compile a native addon; only opt into a native opus build in a dedicated voice-performance or live-lane environment. |
1216 | 1217 | - `voice.connectTimeoutMs` controls the initial `@discordjs/voice` Ready wait for `/vc join` and auto-join attempts. Default: `30000`. |
1217 | 1218 | - `voice.reconnectGraceMs` controls how long OpenClaw waits for a disconnected voice session to begin reconnecting before destroying it. Default: `15000`. |
1218 | 1219 | - In `stt-tts` mode, voice playback does not stop just because another user starts speaking. To avoid feedback loops, OpenClaw ignores new voice capture while TTS is playing; speak after playback finishes for the next turn. Realtime modes forward speaker starts as barge-in signals to the realtime provider. |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -443,6 +443,11 @@ Think of the suites as "increasing realism" (and increasing flakiness/cost):
|
443 | 443 | real bundled plugin source APIs. Real plugin API loads belong in |
444 | 444 | plugin-owned contract/integration suites. |
445 | 445 | |
| 446 | +Native dependency policy: |
| 447 | + |
| 448 | +- Default test installs skip optional native Discord opus builds. Discord voice receive uses the pure-JS `opusscript` decoder, and `@discordjs/opus` stays in `ignoredBuiltDependencies` so local tests and Testbox lanes do not compile the native addon. |
| 449 | +- Use a dedicated Discord voice performance or live lane if you intentionally need to compare a native opus build. Do not add `@discordjs/opus` back to the default `onlyBuiltDependencies`; that makes unrelated install/test loops compile native code. |
| 450 | + |
446 | 451 | <AccordionGroup> |
447 | 452 | <Accordion title="Projects, shards, and scoped lanes"> |
448 | 453 | |
|
| Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +import { Readable } from "node:stream"; |
| 2 | +import { describe, expect, it } from "vitest"; |
| 3 | +import { decodeOpusStream } from "./audio.js"; |
| 4 | + |
| 5 | +describe("discord voice opus decoder selection", () => { |
| 6 | +it("prefers the pure-JS opusscript decoder over optional native opus", async () => { |
| 7 | +const verbose: string[] = []; |
| 8 | +const warnings: string[] = []; |
| 9 | + |
| 10 | +const decoded = await decodeOpusStream(Readable.from([]), { |
| 11 | +onVerbose: (message) => verbose.push(message), |
| 12 | +onWarn: (message) => warnings.push(message), |
| 13 | +}); |
| 14 | + |
| 15 | +expect(decoded.length).toBe(0); |
| 16 | +expect(verbose).toContain("opus decoder: opusscript"); |
| 17 | +expect(warnings).toEqual([]); |
| 18 | +}); |
| 19 | +}); |
| Original file line number | Diff line number | Diff line change |
|---|
@@ -48,6 +48,16 @@ function resolveOpusDecoderFactory(params: {
|
48 | 48 | onWarn: (message: string) => void; |
49 | 49 | }): OpusDecoderFactory | null { |
50 | 50 | const factories: OpusDecoderFactory[] = [ |
| 51 | +{ |
| 52 | +name: "opusscript", |
| 53 | +load: () => { |
| 54 | +const OpusScript = require("opusscript") as { |
| 55 | +new (sampleRate: number, channels: number, application: number): OpusDecoder; |
| 56 | +Application: { AUDIO: number }; |
| 57 | +}; |
| 58 | +return new OpusScript(SAMPLE_RATE, CHANNELS, OpusScript.Application.AUDIO); |
| 59 | +}, |
| 60 | +}, |
51 | 61 | { |
52 | 62 | name: "@discordjs/opus", |
53 | 63 | load: () => { |
@@ -62,16 +72,6 @@ function resolveOpusDecoderFactory(params: {
|
62 | 72 | return new DiscordOpus.OpusEncoder(SAMPLE_RATE, CHANNELS); |
63 | 73 | }, |
64 | 74 | }, |
65 | | -{ |
66 | | -name: "opusscript", |
67 | | -load: () => { |
68 | | -const OpusScript = require("opusscript") as { |
69 | | -new (sampleRate: number, channels: number, application: number): OpusDecoder; |
70 | | -Application: { AUDIO: number }; |
71 | | -}; |
72 | | -return new OpusScript(SAMPLE_RATE, CHANNELS, OpusScript.Application.AUDIO); |
73 | | -}, |
74 | | -}, |
75 | 75 | ]; |
76 | 76 | |
77 | 77 | const failures: string[] = []; |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -1820,7 +1820,6 @@
|
1820 | 1820 | }, |
1821 | 1821 | "onlyBuiltDependencies": [ |
1822 | 1822 | "@openclaw/fs-safe", |
1823 | | -"@discordjs/opus", |
1824 | 1823 | "@google/genai", |
1825 | 1824 | "@lydell/node-pty", |
1826 | 1825 | "@matrix-org/matrix-sdk-crypto-nodejs", |
@@ -1835,6 +1834,7 @@
|
1835 | 1834 | "sharp" |
1836 | 1835 | ], |
1837 | 1836 | "ignoredBuiltDependencies": [ |
| 1837 | +"@discordjs/opus", |
1838 | 1838 | "koffi", |
1839 | 1839 | "tree-sitter-bash" |
1840 | 1840 | ], |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -34,7 +34,6 @@ minimumReleaseAgeExclude:
|
34 | 34 | |
35 | 35 | onlyBuiltDependencies: |
36 | 36 | - "@openclaw/fs-safe" |
37 | | - - "@discordjs/opus" |
38 | 37 | - "@google/genai" |
39 | 38 | - "@lydell/node-pty" |
40 | 39 | - "@matrix-org/matrix-sdk-crypto-nodejs" |
@@ -49,5 +48,6 @@ onlyBuiltDependencies:
|
49 | 48 | - sharp |
50 | 49 | |
51 | 50 | ignoredBuiltDependencies: |
| 51 | + - "@discordjs/opus" |
52 | 52 | - koffi |
53 | 53 | - tree-sitter-bash |
| Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +import fs from "node:fs"; |
| 2 | +import { describe, expect, it } from "vitest"; |
| 3 | +import { parse } from "yaml"; |
| 4 | + |
| 5 | +type PnpmBuildConfig = { |
| 6 | +ignoredBuiltDependencies?: string[]; |
| 7 | +onlyBuiltDependencies?: string[]; |
| 8 | +}; |
| 9 | + |
| 10 | +type RootPackageJson = { |
| 11 | +pnpm?: PnpmBuildConfig; |
| 12 | +}; |
| 13 | + |
| 14 | +type WorkspaceConfig = PnpmBuildConfig; |
| 15 | + |
| 16 | +function readJson<T>(filePath: string): T { |
| 17 | +return JSON.parse(fs.readFileSync(filePath, "utf8")) as T; |
| 18 | +} |
| 19 | + |
| 20 | +describe("package manager build policy", () => { |
| 21 | +it("keeps optional native Discord opus builds disabled by default", () => { |
| 22 | +const packageJson = readJson<RootPackageJson>("package.json"); |
| 23 | +const workspace = parse(fs.readFileSync("pnpm-workspace.yaml", "utf8")) as WorkspaceConfig; |
| 24 | + |
| 25 | +for (const config of [packageJson.pnpm, workspace]) { |
| 26 | +expect(config?.ignoredBuiltDependencies ?? []).toContain("@discordjs/opus"); |
| 27 | +expect(config?.onlyBuiltDependencies ?? []).not.toContain("@discordjs/opus"); |
| 28 | +} |
| 29 | +}); |
| 30 | +}); |
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。