opencode-smart-voice-notify 1.2.3 → 1.2.5
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/README.md +94 -59
- package/example.config.jsonc +37 -5
- package/package.json +52 -52
- package/util/config.js +318 -23
- package/util/tts.js +666 -596
package/README.md
CHANGED
|
@@ -15,10 +15,11 @@ A smart voice notification plugin for [OpenCode](https://opencode.ai) with **mul
|
|
|
15
15
|
### Smart TTS Engine Selection
|
|
16
16
|
The plugin automatically tries multiple TTS engines in order, falling back if one fails:
|
|
17
17
|
|
|
18
|
-
1. **
|
|
19
|
-
2. **
|
|
20
|
-
3. **
|
|
21
|
-
4. **
|
|
18
|
+
1. **OpenAI-Compatible** (Cloud/Self-hosted) - Any OpenAI-compatible `/v1/audio/speech` endpoint (Kokoro, LocalAI, Coqui, AllTalk, OpenAI API, etc.)
|
|
19
|
+
2. **ElevenLabs** (Online) - High-quality, anime-like voices with natural expression
|
|
20
|
+
3. **Edge TTS** (Free) - Microsoft's neural voices, native Node.js implementation (no Python required)
|
|
21
|
+
4. **Windows SAPI** (Offline) - Built-in Windows speech synthesis
|
|
22
|
+
5. **Local Sound Files** (Fallback) - Plays bundled MP3 files if all TTS fails
|
|
22
23
|
|
|
23
24
|
### Smart Notification System
|
|
24
25
|
- **Sound-first mode**: Play a sound immediately, then speak a TTS reminder if user doesn't respond
|
|
@@ -99,62 +100,91 @@ When you first run OpenCode with this plugin installed, it will **automatically
|
|
|
99
100
|
|
|
100
101
|
The auto-generated configuration includes all advanced settings, message arrays, and engine options, so you don't have to refer back to the documentation for available settings.
|
|
101
102
|
|
|
102
|
-
### Manual Configuration
|
|
103
|
-
|
|
104
|
-
If you prefer to create the config manually, add a `smart-voice-notify.jsonc` file in your OpenCode config directory (`~/.config/opencode/`):
|
|
105
|
-
|
|
106
|
-
```jsonc
|
|
107
|
-
{
|
|
108
|
-
// ============================================================
|
|
109
|
-
// OpenCode Smart Voice Notify - Quick Start Configuration
|
|
110
|
-
// ============================================================
|
|
111
|
-
// For ALL available options, see example.config.jsonc in the plugin.
|
|
112
|
-
// The plugin auto-creates a comprehensive config on first run.
|
|
113
|
-
// ============================================================
|
|
114
|
-
|
|
115
|
-
// Master switch to enable/disable the plugin without uninstalling
|
|
116
|
-
"enabled": true,
|
|
117
|
-
|
|
118
|
-
// Notification mode: 'sound-first', 'tts-first', 'both', 'sound-only'
|
|
119
|
-
"notificationMode": "sound-first",
|
|
120
|
-
|
|
121
|
-
// TTS engine: 'elevenlabs', 'edge', 'sapi'
|
|
122
|
-
"ttsEngine": "
|
|
123
|
-
"enableTTS": true,
|
|
124
|
-
|
|
125
|
-
// ElevenLabs settings (get API key from https://elevenlabs.io/app/settings/api-keys)
|
|
126
|
-
"elevenLabsApiKey": "YOUR_API_KEY_HERE",
|
|
127
|
-
"elevenLabsVoiceId": "cgSgspJ2msm6clMCkdW9", // Jessica - Playful, Bright
|
|
128
|
-
|
|
129
|
-
//
|
|
130
|
-
"
|
|
131
|
-
"
|
|
132
|
-
"
|
|
133
|
-
|
|
134
|
-
// TTS
|
|
135
|
-
"
|
|
136
|
-
"
|
|
137
|
-
"
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
"
|
|
142
|
-
"
|
|
143
|
-
"
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
"
|
|
149
|
-
"
|
|
150
|
-
"
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
"
|
|
154
|
-
|
|
155
|
-
|
|
103
|
+
### Manual Configuration
|
|
104
|
+
|
|
105
|
+
If you prefer to create the config manually, add a `smart-voice-notify.jsonc` file in your OpenCode config directory (`~/.config/opencode/`):
|
|
106
|
+
|
|
107
|
+
```jsonc
|
|
108
|
+
{
|
|
109
|
+
// ============================================================
|
|
110
|
+
// OpenCode Smart Voice Notify - Quick Start Configuration
|
|
111
|
+
// ============================================================
|
|
112
|
+
// For ALL available options, see example.config.jsonc in the plugin.
|
|
113
|
+
// The plugin auto-creates a comprehensive config on first run.
|
|
114
|
+
// ============================================================
|
|
115
|
+
|
|
116
|
+
// Master switch to enable/disable the plugin without uninstalling
|
|
117
|
+
"enabled": true,
|
|
118
|
+
|
|
119
|
+
// Notification mode: 'sound-first', 'tts-first', 'both', 'sound-only'
|
|
120
|
+
"notificationMode": "sound-first",
|
|
121
|
+
|
|
122
|
+
// TTS engine: 'openai', 'elevenlabs', 'edge', 'sapi'
|
|
123
|
+
"ttsEngine": "openai",
|
|
124
|
+
"enableTTS": true,
|
|
125
|
+
|
|
126
|
+
// ElevenLabs settings (get API key from https://elevenlabs.io/app/settings/api-keys)
|
|
127
|
+
"elevenLabsApiKey": "YOUR_API_KEY_HERE",
|
|
128
|
+
"elevenLabsVoiceId": "cgSgspJ2msm6clMCkdW9", // Jessica - Playful, Bright
|
|
129
|
+
|
|
130
|
+
// OpenAI-compatible TTS (Kokoro, LocalAI, OpenAI, Coqui, AllTalk, etc.)
|
|
131
|
+
"openaiTtsEndpoint": "http://localhost:8880",
|
|
132
|
+
"openaiTtsVoice": "af_heart",
|
|
133
|
+
"openaiTtsModel": "kokoro",
|
|
134
|
+
|
|
135
|
+
// Edge TTS settings (free, no API key required)
|
|
136
|
+
"edgeVoice": "en-US-AnaNeural",
|
|
137
|
+
"edgePitch": "+50Hz",
|
|
138
|
+
"edgeRate": "+10%",
|
|
139
|
+
|
|
140
|
+
// TTS reminder settings
|
|
141
|
+
"enableTTSReminder": true,
|
|
142
|
+
"ttsReminderDelaySeconds": 30,
|
|
143
|
+
"enableFollowUpReminders": true,
|
|
144
|
+
"maxFollowUpReminders": 3,
|
|
145
|
+
|
|
146
|
+
// AI-generated messages (optional - requires local AI server)
|
|
147
|
+
"enableAIMessages": false,
|
|
148
|
+
"aiEndpoint": "http://localhost:11434/v1",
|
|
149
|
+
"aiModel": "llama3",
|
|
150
|
+
"aiApiKey": "",
|
|
151
|
+
"aiFallbackToStatic": true,
|
|
152
|
+
|
|
153
|
+
// General settings
|
|
154
|
+
"wakeMonitor": true,
|
|
155
|
+
"forceVolume": true,
|
|
156
|
+
"volumeThreshold": 50,
|
|
157
|
+
"enableToast": true,
|
|
158
|
+
"enableSound": true,
|
|
159
|
+
"debugLog": false
|
|
160
|
+
}
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
For the complete configuration with all TTS engine settings, message arrays, AI prompts, and advanced options, see [`example.config.jsonc`](./example.config.jsonc) in the plugin directory.
|
|
164
|
+
|
|
165
|
+
### OpenAI-Compatible TTS Setup (Kokoro, LocalAI, OpenAI API, etc.)
|
|
156
166
|
|
|
157
|
-
For
|
|
167
|
+
For cloud-based or self-hosted TTS using any OpenAI-compatible `/v1/audio/speech` endpoint:
|
|
168
|
+
|
|
169
|
+
```jsonc
|
|
170
|
+
{
|
|
171
|
+
"ttsEngine": "openai",
|
|
172
|
+
"openaiTtsEndpoint": "http://192.168.86.43:8880", // Your TTS server
|
|
173
|
+
"openaiTtsVoice": "af_heart", // Server-dependent
|
|
174
|
+
"openaiTtsModel": "kokoro", // Server-dependent
|
|
175
|
+
"openaiTtsApiKey": "", // Optional, if server requires auth
|
|
176
|
+
"openaiTtsSpeed": 1.0 // 0.25 to 4.0
|
|
177
|
+
}
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
**Supported OpenAI-Compatible TTS Servers:**
|
|
181
|
+
| Server | Example Endpoint | Voices |
|
|
182
|
+
|--------|------------------|--------|
|
|
183
|
+
| Kokoro | `http://localhost:8880` | `af_heart`, `af_bella`, `am_adam`, etc. |
|
|
184
|
+
| LocalAI | `http://localhost:8080` | Model-dependent |
|
|
185
|
+
| AllTalk | `http://localhost:7851` | Model-dependent |
|
|
186
|
+
| OpenAI | `https://api.openai.com` | `alloy`, `echo`, `fable`, `onyx`, `nova`, `shimmer` |
|
|
187
|
+
| Coqui | `http://localhost:5002` | Model-dependent |
|
|
158
188
|
|
|
159
189
|
### AI Message Generation (Optional)
|
|
160
190
|
|
|
@@ -190,6 +220,11 @@ If you want dynamic, AI-generated notification messages instead of preset ones,
|
|
|
190
220
|
|
|
191
221
|
## Requirements
|
|
192
222
|
|
|
223
|
+
### For OpenAI-Compatible TTS
|
|
224
|
+
- Any server implementing the `/v1/audio/speech` endpoint
|
|
225
|
+
- Examples: [Kokoro](https://github.com/remsky/Kokoro-FastAPI), [LocalAI](https://localai.io), [AllTalk](https://github.com/erew123/alltalk_tts), OpenAI API, etc.
|
|
226
|
+
- Works with both local self-hosted servers and cloud-based providers.
|
|
227
|
+
|
|
193
228
|
### For ElevenLabs TTS
|
|
194
229
|
- ElevenLabs API key (free tier: 10,000 characters/month)
|
|
195
230
|
- Internet connection
|
package/example.config.jsonc
CHANGED
|
@@ -64,9 +64,10 @@
|
|
|
64
64
|
// ============================================================
|
|
65
65
|
// TTS ENGINE SELECTION
|
|
66
66
|
// ============================================================
|
|
67
|
-
// '
|
|
68
|
-
// '
|
|
69
|
-
// '
|
|
67
|
+
// 'openai' - OpenAI-compatible TTS (Self-hosted/Cloud, e.g. Kokoro, LocalAI)
|
|
68
|
+
// 'elevenlabs' - Best quality, anime-like voices (requires API key, free tier: 10k chars/month)
|
|
69
|
+
// 'edge' - Good quality neural voices (Free, Native Node.js implementation)
|
|
70
|
+
// 'sapi' - Windows built-in voices (free, offline, robotic)
|
|
70
71
|
"ttsEngine": "elevenlabs",
|
|
71
72
|
|
|
72
73
|
// Enable TTS for notifications (falls back to sound files if TTS fails)
|
|
@@ -136,8 +137,39 @@
|
|
|
136
137
|
// Volume: 'silent', 'x-soft', 'soft', 'medium', 'loud', 'x-loud'
|
|
137
138
|
"sapiVolume": "loud",
|
|
138
139
|
|
|
139
|
-
// ============================================================
|
|
140
|
-
//
|
|
140
|
+
// ============================================================
|
|
141
|
+
// OPENAI-COMPATIBLE TTS SETTINGS (Kokoro, LocalAI, OpenAI, etc.)
|
|
142
|
+
// ============================================================
|
|
143
|
+
// Any OpenAI-compatible /v1/audio/speech endpoint.
|
|
144
|
+
// Examples: Kokoro, OpenAI, LocalAI, Coqui, AllTalk, etc.
|
|
145
|
+
//
|
|
146
|
+
// To use OpenAI-compatible TTS:
|
|
147
|
+
// 1. Set ttsEngine above to "openai"
|
|
148
|
+
// 2. Set openaiTtsEndpoint to your server URL (without /v1/audio/speech)
|
|
149
|
+
// 3. Configure voice and model for your server
|
|
150
|
+
|
|
151
|
+
// Base URL for your TTS server (e.g., "http://192.168.86.43:8880")
|
|
152
|
+
"openaiTtsEndpoint": "",
|
|
153
|
+
|
|
154
|
+
// API key (leave empty if your server doesn't require auth)
|
|
155
|
+
"openaiTtsApiKey": "",
|
|
156
|
+
|
|
157
|
+
// Model name (server-dependent, e.g., "tts-1", "kokoro", "xtts")
|
|
158
|
+
"openaiTtsModel": "tts-1",
|
|
159
|
+
|
|
160
|
+
// Voice name (server-dependent)
|
|
161
|
+
// Kokoro voices: "af_heart", "af_bella", "am_adam", etc.
|
|
162
|
+
// OpenAI voices: "alloy", "echo", "fable", "onyx", "nova", "shimmer"
|
|
163
|
+
"openaiTtsVoice": "alloy",
|
|
164
|
+
|
|
165
|
+
// Audio format: "mp3", "opus", "aac", "flac", "wav", "pcm"
|
|
166
|
+
"openaiTtsFormat": "mp3",
|
|
167
|
+
|
|
168
|
+
// Speech speed: 0.25 to 4.0 (1.0 = normal)
|
|
169
|
+
"openaiTtsSpeed": 1.0,
|
|
170
|
+
|
|
171
|
+
// ============================================================
|
|
172
|
+
// INITIAL TTS MESSAGES (Used immediately or after sound)
|
|
141
173
|
// These are randomly selected each time for variety
|
|
142
174
|
// ============================================================
|
|
143
175
|
|
package/package.json
CHANGED
|
@@ -1,52 +1,52 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "opencode-smart-voice-notify",
|
|
3
|
-
"version": "1.2.
|
|
4
|
-
"description": "Smart voice notification plugin for OpenCode with multiple TTS engines (ElevenLabs, Edge TTS, Windows SAPI), AI-generated dynamic messages, and intelligent reminder system",
|
|
5
|
-
"main": "index.js",
|
|
6
|
-
"type": "module",
|
|
7
|
-
"author": "MasuRii",
|
|
8
|
-
"license": "MIT",
|
|
9
|
-
"keywords": [
|
|
10
|
-
"opencode",
|
|
11
|
-
"opencode-plugins",
|
|
12
|
-
"plugin",
|
|
13
|
-
"notification",
|
|
14
|
-
"tts",
|
|
15
|
-
"text-to-speech",
|
|
16
|
-
"elevenlabs",
|
|
17
|
-
"edge-tts",
|
|
18
|
-
"sapi",
|
|
19
|
-
"voice",
|
|
20
|
-
"alert",
|
|
21
|
-
"smart",
|
|
22
|
-
"ai",
|
|
23
|
-
"ai-generated",
|
|
24
|
-
"ollama",
|
|
25
|
-
"local-ai"
|
|
26
|
-
],
|
|
27
|
-
"files": [
|
|
28
|
-
"index.js",
|
|
29
|
-
"util/",
|
|
30
|
-
"assets/",
|
|
31
|
-
"example.config.jsonc"
|
|
32
|
-
],
|
|
33
|
-
"repository": {
|
|
34
|
-
"type": "git",
|
|
35
|
-
"url": "git+https://github.com/MasuRii/opencode-smart-voice-notify.git"
|
|
36
|
-
},
|
|
37
|
-
"bugs": {
|
|
38
|
-
"url": "https://github.com/MasuRii/opencode-smart-voice-notify/issues"
|
|
39
|
-
},
|
|
40
|
-
"homepage": "https://github.com/MasuRii/opencode-smart-voice-notify#readme",
|
|
41
|
-
"engines": {
|
|
42
|
-
"node": ">=18.0.0",
|
|
43
|
-
"bun": ">=1.0.0"
|
|
44
|
-
},
|
|
45
|
-
"dependencies": {
|
|
46
|
-
"@elevenlabs/elevenlabs-js": "^2.30.0",
|
|
47
|
-
"msedge-tts": "^2.0.3"
|
|
48
|
-
},
|
|
49
|
-
"peerDependencies": {
|
|
50
|
-
"@opencode-ai/plugin": "^1.1.8"
|
|
51
|
-
}
|
|
52
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "opencode-smart-voice-notify",
|
|
3
|
+
"version": "1.2.5",
|
|
4
|
+
"description": "Smart voice notification plugin for OpenCode with multiple TTS engines (ElevenLabs, Edge TTS, Windows SAPI), AI-generated dynamic messages, and intelligent reminder system",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"author": "MasuRii",
|
|
8
|
+
"license": "MIT",
|
|
9
|
+
"keywords": [
|
|
10
|
+
"opencode",
|
|
11
|
+
"opencode-plugins",
|
|
12
|
+
"plugin",
|
|
13
|
+
"notification",
|
|
14
|
+
"tts",
|
|
15
|
+
"text-to-speech",
|
|
16
|
+
"elevenlabs",
|
|
17
|
+
"edge-tts",
|
|
18
|
+
"sapi",
|
|
19
|
+
"voice",
|
|
20
|
+
"alert",
|
|
21
|
+
"smart",
|
|
22
|
+
"ai",
|
|
23
|
+
"ai-generated",
|
|
24
|
+
"ollama",
|
|
25
|
+
"local-ai"
|
|
26
|
+
],
|
|
27
|
+
"files": [
|
|
28
|
+
"index.js",
|
|
29
|
+
"util/",
|
|
30
|
+
"assets/",
|
|
31
|
+
"example.config.jsonc"
|
|
32
|
+
],
|
|
33
|
+
"repository": {
|
|
34
|
+
"type": "git",
|
|
35
|
+
"url": "git+https://github.com/MasuRii/opencode-smart-voice-notify.git"
|
|
36
|
+
},
|
|
37
|
+
"bugs": {
|
|
38
|
+
"url": "https://github.com/MasuRii/opencode-smart-voice-notify/issues"
|
|
39
|
+
},
|
|
40
|
+
"homepage": "https://github.com/MasuRii/opencode-smart-voice-notify#readme",
|
|
41
|
+
"engines": {
|
|
42
|
+
"node": ">=18.0.0",
|
|
43
|
+
"bun": ">=1.0.0"
|
|
44
|
+
},
|
|
45
|
+
"dependencies": {
|
|
46
|
+
"@elevenlabs/elevenlabs-js": "^2.30.0",
|
|
47
|
+
"msedge-tts": "^2.0.3"
|
|
48
|
+
},
|
|
49
|
+
"peerDependencies": {
|
|
50
|
+
"@opencode-ai/plugin": "^1.1.8"
|
|
51
|
+
}
|
|
52
|
+
}
|