Commit ded598f
Merge main: keep upstream tooling & security, add discord_voice, Wyoming, Polly/Edge/Deepgram, fallbacks (#11)
* feat(tts): add Kokoro TTS provider
- Add `kokoro-js` dependency
- Implement `KokoroTTSProvider` in `src/tts.ts` for offline/local TTS
- Update configuration schema in `src/config.ts` to support Kokoro options
- Update documentation (README, SKILL, CHANGELOG) with usage instructions
Co-Authored-By: Claude (gemini-3-pro-low) <noreply@anthropic.com>
* feat(stt): add Local Whisper STT provider
- Add `@xenova/transformers` and `wavefile` dependencies
- Implement `LocalWhisperSTT` in `src/stt.ts` using Transformers.js
- Update configuration in `src/config.ts` to support `local-whisper` options
- Update documentation with usage instructions for offline STT
Co-Authored-By: Claude (gemini-3-pro-low) <noreply@anthropic.com>
* feat: add local whisper STT support and update docs
* refactor(stt): fix race condition in local model init and use wavefile for wav generation
* fix(voice): prevent stream.push() after EOF crash by handling stream lifecycle manually
* feat: add logging interface and type checking script
- Introduced a `StreamingSTTLogger` interface for improved logging capabilities in the streaming STT classes.
- Updated `DeepgramStreamingSTT` and `StreamingSTTManager` to accept a logger instance for better error and info logging.
- Added a new script in `package.json` for TypeScript type checking.
* fix: improve audio handling during streaming STT sessions
- Implemented a mechanism to buffer audio chunks while the WebSocket connection is being established, preventing audio loss during the handshake.
- Introduced a `waitForReady()` method to ensure callers can await the connection before sending audio.
- Updated `sendAudio` to buffer audio instead of dropping it when the connection is not yet ready.
* fix: enhance audio buffering and connection handling during streaming STT
- Improved the audio buffering mechanism to handle scenarios where the WebSocket connection is delayed.
- Ensured that audio chunks are stored until the connection is ready, preventing loss during the initial handshake.
- Updated the `sendAudio` method to utilize the buffering system effectively.
* feat: OpenClaw compatibility, core-bridge, manifest, smoke test
Co-authored-by: Cursor <cursoragent@cursor.com>
* feat: add support for GPT-4o mini transcription and enhance STT provider options
- Introduced `gpt4o-mini` as a new Speech-to-Text provider for higher quality transcriptions.
- Updated configuration files and documentation to reflect the new STT provider options.
- Enhanced ElevenLabs model ID configuration to support v2, v3, and turbo models.
- Implemented a new `Gpt4oMiniTranscribeSTT` class for handling transcriptions using OpenAI's GPT-4o mini model.
* feat: enhance STT provider options and add thinking sound configuration
- Expanded Speech-to-Text provider options to include `gpt4o-transcribe` and `gpt4o-transcribe-diarize` for improved transcription capabilities.
- Introduced a new `thinkingSound` configuration to play a sound while processing, with customizable options for enabling, file path, and volume.
- Updated documentation and configuration files to reflect these changes, ensuring clarity on new features and usage.
* feat: enhance OpenClaw integration and troubleshooting documentation
- Added a fallback mechanism to resolve the OpenClaw root directory using `require`, improving compatibility with the OpenClaw gateway process.
- Updated README.md to include troubleshooting steps for the "Unable to resolve OpenClaw root" error, detailing how to set the `OPENCLAW_ROOT` environment variable.
- Documented the `OPENCLAW_ROOT` variable in the troubleshooting section for clarity on its usage.
* feat: enhance OpenClaw integration with configurable root path and thinking sound
- Added `openclawRoot` configuration option to specify the OpenClaw package root directory, improving compatibility with the OpenClaw gateway.
- Updated `thinkingSound` documentation in README.md to clarify configuration options for enabling, file path, and volume.
- Refactored core functions to utilize the new `openclawRoot` parameter for loading core dependencies.
- Enhanced JSON schema in plugin manifests to include `openclawRoot` description for better user guidance.
* fix: update README and package.json for troubleshooting and dependency management
- Added troubleshooting steps in README.md for the "Cannot find module structures/ClientUser" error, including commands to reinstall dependencies.
- Updated package.json to include the @sinclair/typebox dependency in the main dependencies section, ensuring it is available for runtime use.
* Phase 0: voice pipeline latency, config safeguards, English docs
- Kokoro: return null from createStreamingTTSProvider (direct batch fallback)
- silenceThresholdMs default 800ms
- thinkingSound.stopDelayMs configurable (default 50ms)
- Validate timeout values (silenceThresholdMs, minAudioMs, etc.) >= 0
- REFACTORING.md: translate to English, update LOC, mark Phase 0 done
- README: stopDelayMs, silenceThresholdMs defaults
Co-authored-by: Cursor <cursoragent@cursor.com>
* feat: configurable no-emoji hint for TTS voice prompt
- noEmojiHint: true | false | string
- true (default): inject default 'no emojis' text
- false: do not inject
- string: use custom hint text
- Export DEFAULT_NO_EMOJI_HINT from config
Co-authored-by: Cursor <cursoragent@cursor.com>
* feat: TTS fallback provider for quota/rate limit errors
- ttsFallbackProvider config (openai | elevenlabs | kokoro)
- Detect retryable errors: quota_exceeded, 401, 429, 503
- Try fallback when primary fails (streaming + batch)
- Kokoro as free local fallback option
- README: fallback config, Kokoro marked as free
Co-authored-by: Cursor <cursoragent@cursor.com>
* fix: convert Kokoro PCM to WAV for Discord playback
Kokoro returns raw PCM; Discord needs a format FFmpeg can decode.
Wrap PCM in WAV header via wavefile before createAudioResource.
Shared createResourceFromTTSResult() for main and fallback flows.
Co-authored-by: Cursor <cursoragent@cursor.com>
* fix: add kokoro and local-whisper to plugin config schema
- ttsProvider enum: add kokoro (was missing, caused validation error)
- sttProvider enum: add local-whisper
- openclaw.plugin.json + clawdbot.plugin.json
Co-authored-by: Cursor <cursoragent@cursor.com>
* fix(kokoro): convert PCM Buffer to Int16Array for wavefile WAV creation
wavefile.fromScratch() expects sample values (-32768..32767), not raw bytes.
Passing a Buffer caused corrupt WAV output and no audio playback.
Co-authored-by: Cursor <cursoragent@cursor.com>
* feat: session fallback, emoji strip, provider voices, ElevenLabs default
- TTS fallback: stay on fallback provider for rest of session once switched
- Emoji stripping: remove emojis before TTS when noEmojiHint is set (Kokoro)
- Provider-specific voices: openai.voice (nova), elevenlabs.voiceId, kokoro.voice
- OpenAI: validate voice, resolve to nova if invalid
- ElevenLabs: default modelId eleven_turbo_v2_5
- README: docs for new options
Co-authored-by: Cursor <cursoragent@cursor.com>
* feat: add Deepgram & Polly TTS, ordered fallback providers
- Add DeepgramTTS (REST API, Opus/OGG)
- Add PollyTTS (AWS SDK, MP3)
- Add ttsFallbackProviders array for ordered fallback chain
- Backward compat: ttsFallbackProvider (single) still supported
- Session stores which fallback succeeded for rest of channel
Co-authored-by: Cursor <cursoragent@cursor.com>
* fix: use deepgram model for TTS when it's an Aura voice (e.g. aura-2-kara-de)
When model is set to an Aura TTS model (aura-*), use it for TTS instead
of defaulting to aura-asteria-en. STT model stays nova-2.
Co-authored-by: Cursor <cursoragent@cursor.com>
* feat: add Wyoming Faster Whisper STT provider (remote over TCP)
- WyomingWhisperSTT connects to wyoming-faster-whisper server via TCP
- Config: wyomingWhisper.host, port, uri, language, connectTimeoutMs
- Wyoming protocol: transcribe -> audio-start/chunk/stop -> transcript
- Default: 127.0.0.1:10300
Co-authored-by: Cursor <cursoragent@cursor.com>
* feat: add STT fallback providers (quota, rate limit, Wyoming unreachable)
- sttFallbackProviders array (sttFallbackProvider legacy)
- isRetryableSttError: quota, 401/429/503, ECONNREFUSED, timeout, wyoming
- Session stores fallbackSttProvider on success
- tryTranscribeWithProvider for fallback transcription
Co-authored-by: Cursor <cursoragent@cursor.com>
* fix: increase Wyoming Whisper default timeout to 60s
faster-whisper inference can take 15-30s; 10s was too short
Co-authored-by: Cursor <cursoragent@cursor.com>
* fix: Wyoming protocol - parse data_length/payload_length correctly
Wyoming sends transcript text in separate data bytes, not in header.
Implement proper Wyoming message parsing (header + data_length + payload_length).
Default timeout back to 10s.
Co-authored-by: Cursor <cursoragent@cursor.com>
* fix(stt): lazy-load Xenova to prevent OpenClaw crash when local-whisper not used
Top-level import of @xenova/transformers could crash OpenClaw/Electron
on startup. Now Xenova is loaded only when LocalWhisperSTT is actually
used (dynamic import in ensureInitialized).
Co-authored-by: Cursor <cursoragent@cursor.com>
* fix(voice): prevent duplicate speech and unheard TTS when agent uses discord_voice speak
- Add spokeViaToolThisRun flag to skip processRecording speak when agent
already spoke via discord_voice tool
- Inject system prompt: 'do not use discord_voice speak tool; just return
reply as text' for voice transcript flow
- Stop thinking sound and re-subscribe main player before speak() when
agent calls speak tool during run (connection was on thinkingPlayer,
so TTS was not heard)
Co-authored-by: Cursor <cursoragent@cursor.com>
* fix(voice): prevent duplicate transcript processing and double speak
- Clear previous silence timer on each 'end' event to avoid multiple
processRecording calls from duplicate Discord speaking.end events
- Add transcript dedupe: skip same transcript within 5s window
- Use current session from map for spokeViaToolThisRun check (agent
auto-join may replace session during run)
- Clear silence timer handle when callback fires
Co-authored-by: Cursor <cursoragent@cursor.com>
* fix: prevent duplicate plugin init when loaded via both openclaw and clawdbot extensions
Add discordVoiceRegistered singleton guard - skip duplicate register() to avoid
two Discord clients and double voice event processing. Reset on stop/enabled=false.
Co-authored-by: Cursor <cursoragent@cursor.com>
* fix(stt): Wyoming always retried, other primaries stick to fallback
- When primary is wyoming-whisper: try primary each time (service may be
temporarily down), never persist fallback
- When primary is other (gpt4o-mini, etc.): stick to fallback for rest
of session once switched
Co-authored-by: Cursor <cursoragent@cursor.com>
* feat: runtime provider/model/think overrides via set-stt, set-tts, set-model, set-think
- Session overrides for STT/TTS provider, model, thinkLevel
- TTS speak() uses effective provider (override or config)
- handleTranscript uses session model/think overrides for agent run
- Gateway: discord-voice.set-stt, set-tts, set-model, set-think, models
- Agent tool: set-stt, set-tts, set-model, set-think actions
- CLI: voice set-stt, set-tts, set-model, set-think
- getAvailableModels() from agents.list/defaults for suggestions
- Status includes model, thinkLevel, availableModels
- README: document new commands
Co-authored-by: Cursor <cursoragent@cursor.com>
* fix: add wyomingWhisper and polly.accessKeyId/secretAccessKey to clawdbot schema
Co-authored-by: Cursor <cursoragent@cursor.com>
* refactor: use discord_voice prefix for slash commands and CLI to avoid overlap with TTS/voice commands
Co-authored-by: Cursor <cursoragent@cursor.com>
* fix: allow additional config properties, add localWhisper and thinkingSound.stopDelayMs to schema
Co-authored-by: Cursor <cursoragent@cursor.com>
* chore: exclude .claude/ and REFACTORING.md from repo
Co-authored-by: Cursor <cursoragent@cursor.com>
* Allow additional config properties in plugin schema
Set additionalProperties: true so OpenClaw config validation
accepts config keys not explicitly listed (fixes 'must NOT have
additional properties' error when loading plugin).
Co-authored-by: Cursor <cursoragent@cursor.com>
* chore: add hono@4.11.9 to satisfy peer dep and fix npm ci
Co-authored-by: Cursor <cursoragent@cursor.com>
---------
Co-authored-by: Minoa <altgithub@minoa.cat>
Co-authored-by: Claude (gemini-3-pro-low) <noreply@anthropic.com>
Co-authored-by: doxy <doxycomp@gmx.net>
Co-authored-by: Cursor <cursoragent@cursor.com>1 parent 0a7723b commit ded598f
File tree
16 files changed
+2158
-1084
lines changed- scripts
- src
16 files changed
+2158
-1084
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| |||
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
184 | 184 | | |
185 | 185 | | |
186 | 186 | | |
187 | | - | |
188 | | - | |
189 | | - | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
190 | 190 | | |
191 | 191 | | |
192 | 192 | | |
193 | 193 | | |
194 | 194 | | |
195 | | - | |
| 195 | + | |
196 | 196 | | |
197 | 197 | | |
198 | | - | |
| 198 | + | |
199 | 199 | | |
200 | 200 | | |
201 | | - | |
| 201 | + | |
202 | 202 | | |
203 | 203 | | |
204 | 204 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
31 | 31 | | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
| 32 | + | |
36 | 33 | | |
37 | 34 | | |
38 | | - | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
39 | 44 | | |
40 | 45 | | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
41 | 62 | | |
42 | 63 | | |
43 | 64 | | |
44 | 65 | | |
45 | 66 | | |
46 | 67 | | |
47 | 68 | | |
48 | | - | |
| 69 | + | |
49 | 70 | | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
| 71 | + | |
55 | 72 | | |
| 73 | + | |
56 | 74 | | |
57 | 75 | | |
58 | 76 | | |
| |||
73 | 91 | | |
74 | 92 | | |
75 | 93 | | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
93 | 98 | | |
94 | 99 | | |
95 | 100 | | |
96 | 101 | | |
97 | 102 | | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
| 103 | + | |
| 104 | + | |
106 | 105 | | |
107 | 106 | | |
108 | 107 | | |
109 | 108 | | |
110 | 109 | | |
111 | | - | |
| 110 | + | |
| 111 | + | |
112 | 112 | | |
113 | 113 | | |
114 | 114 | | |
| |||
124 | 124 | | |
125 | 125 | | |
126 | 126 | | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
127 | 150 | | |
128 | 151 | | |
129 | 152 | | |
| |||
148 | 171 | | |
149 | 172 | | |
150 | 173 | | |
151 | | - | |
| 174 | + | |
| 175 | + | |
152 | 176 | | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
153 | 193 | | |
154 | 194 | | |
155 | 195 | | |
| |||
164 | 204 | | |
165 | 205 | | |
166 | 206 | | |
167 | | - | |
| 207 | + | |
168 | 208 | | |
169 | 209 | | |
170 | 210 | | |
| |||
174 | 214 | | |
175 | 215 | | |
176 | 216 | | |
177 | | - | |
178 | | - | |
179 | | - | |
180 | | - | |
181 | | - | |
182 | | - | |
183 | | - | |
184 | | - | |
185 | | - | |
186 | | - | |
187 | | - | |
188 | | - | |
189 | | - | |
190 | | - | |
191 | | - | |
192 | | - | |
193 | | - | |
194 | | - | |
195 | | - | |
196 | | - | |
197 | | - | |
198 | | - | |
199 | | - | |
200 | | - | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
201 | 223 | | |
202 | 224 | | |
203 | 225 | | |
204 | | - | |
205 | | - | |
206 | | - | |
207 | | - | |
| 226 | + | |
208 | 227 | | |
209 | 228 | | |
0 commit comments