feat(xai): stream TTS over native websocket#99868
Conversation
Dependency GuardThis PR changes dependency-related files. Maintainers should confirm these changes are intentional. Changed files:
Maintainer follow-up:
|
Dependency graph changes are blockedOpenClaw does not accept dependency graph changes through PRs unless a repository admin or security explicitly authorizes the current head SHA. Dependency updates are generated internally by maintainers so external PRs cannot change the resolved graph. Detected dependency graph changes:
Auto-scrub was not attempted because this PR changes package manifest dependency graph fields:
Dependency graph changes must be reviewed by security or handled by maintainers internally. Please remove lockfile changes manually if they are not needed. To remove lockfile changes, restore them from the target branch: git fetch origin
git checkout 'origin/main' -- 'pnpm-lock.yaml'
git commit -m 'chore: remove dependency lockfile change'
git pushIf this PR intentionally needs a dependency graph change, ask a repository admin or member of The action will approve the current head SHA ( |
|
Closing this PR because the author has more than 20 active PRs in this repo. Please reduce the active PR queue and reopen or resubmit once it is back under the limit. You can close your own PRs to get back under the limit. |
Closes #99660
What Problem This Solves
Fixes an issue where xAI could be used for buffered OpenClaw TTS, but streaming playback callers could not use xAI's native lower-latency streaming TTS WebSocket contract.
Why This Change Was Made
The xAI speech provider now exposes
streamSynthesizethrough the documented nativewss://api.x.ai/v1/ttsWebSocket flow while leaving existing bufferedsynthesizeand telephony paths on REST/v1/tts. The streaming path uses Node's native WebSocket client and is restricted to the native xAI host so REST-compatible proxy base URLs are not silently treated as xAI WebSocket endpoints.User Impact
Streaming TTS callers can receive xAI audio chunks as they arrive instead of waiting for a complete buffered audio response, while existing normal TTS attachment and telephony behavior remains unchanged.
Evidence
text.deltathentext.done, consumesaudio.deltachunks untilaudio.done, and is wired through the speech provider streaming contract.node scripts/run-vitest.mjs extensions/xai/tts.test.ts extensions/xai/speech-provider.test.tspassed: 2 files, 21 tests.node scripts/run-vitest.mjs test/scripts/plugin-package-dependencies.test.tspassed: 1 file, 3 tests.git diff --checkpassed.pnpm docs:listwas attempted but local pnpm aborted withERR_PNPM_ABORTED_REMOVE_MODULES_DIR_NO_TTYin this worktree.