opencode-smart-voice-notify 1.2.2 → 1.2.4
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 +167 -403
- package/example.config.jsonc +356 -356
- package/index.js +978 -978
- package/package.json +52 -48
- package/util/ai-messages.js +205 -205
- package/util/config.js +642 -385
package/README.md
CHANGED
|
@@ -15,54 +15,54 @@ 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. **ElevenLabs** (Online) - High-quality, anime-like voices with natural expression
|
|
19
|
-
2. **Edge TTS** (Free) - Microsoft's neural voices, native Node.js implementation (no Python required)
|
|
20
|
-
3. **Windows SAPI** (Offline) - Built-in Windows speech synthesis
|
|
21
|
-
4. **Local Sound Files** (Fallback) - Plays bundled MP3 files if all TTS fails
|
|
22
|
-
|
|
23
|
-
### Smart Notification System
|
|
24
|
-
- **Sound-first mode**: Play a sound immediately, then speak a TTS reminder if user doesn't respond
|
|
25
|
-
- **TTS-first mode**: Speak immediately using TTS
|
|
26
|
-
- **Both mode**: Play sound AND speak TTS at the same time
|
|
27
|
-
- **Sound-only mode**: Just play sounds, no TTS
|
|
28
|
-
|
|
29
|
-
### Intelligent Reminders
|
|
30
|
-
- Delayed TTS reminders if user doesn't respond within configurable time
|
|
31
|
-
- Follow-up reminders with exponential backoff
|
|
32
|
-
- Automatic cancellation when user responds
|
|
33
|
-
- Per-notification type delays (permission requests are more urgent)
|
|
34
|
-
- **Smart Quota Handling**: Automatically falls back to free Edge TTS if ElevenLabs quota is exceeded
|
|
35
|
-
- **Permission Batching**: Multiple simultaneous permission requests are batched into a single notification (e.g., "5 permission requests require your attention")
|
|
36
|
-
- **Question Tool Support** (SDK v1.1.7+): Notifies when the agent asks questions and needs user input
|
|
37
|
-
|
|
38
|
-
### AI-Generated Messages
|
|
39
|
-
- **Dynamic notifications**: Use a local AI to generate unique, contextual messages instead of preset static ones
|
|
40
|
-
- **OpenAI-compatible**: Works with Ollama, LM Studio, LocalAI, vLLM, llama.cpp, Jan.ai, or any OpenAI-compatible endpoint
|
|
41
|
-
- **User-hosted**: You provide your own AI endpoint - no cloud API keys required
|
|
42
|
-
- **Custom prompts**: Configure prompts per notification type for full control over AI personality
|
|
43
|
-
- **Smart fallback**: Automatically falls back to static messages if AI is unavailable
|
|
44
|
-
|
|
45
|
-
### System Integration
|
|
46
|
-
- **Native Edge TTS**: No external dependencies (Python/pip) required
|
|
47
|
-
- Wake monitor from sleep before notifying
|
|
48
|
-
- Auto-boost volume if too low
|
|
49
|
-
- TUI toast notifications
|
|
50
|
-
- Cross-platform support (Windows, macOS, Linux)
|
|
51
|
-
|
|
52
|
-
## Installation
|
|
53
|
-
|
|
54
|
-
### Option 1: From npm/Bun (Recommended)
|
|
55
|
-
|
|
56
|
-
Add to your OpenCode config file (`~/.config/opencode/opencode.json`):
|
|
57
|
-
|
|
58
|
-
```json
|
|
59
|
-
{
|
|
60
|
-
"$schema": "https://opencode.ai/config.json",
|
|
61
|
-
"plugin": ["opencode-smart-voice-notify@latest"]
|
|
62
|
-
}
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
> **Note**: OpenCode will automatically install the plugin using your system's package manager (npm or bun).
|
|
18
|
+
1. **ElevenLabs** (Online) - High-quality, anime-like voices with natural expression
|
|
19
|
+
2. **Edge TTS** (Free) - Microsoft's neural voices, native Node.js implementation (no Python required)
|
|
20
|
+
3. **Windows SAPI** (Offline) - Built-in Windows speech synthesis
|
|
21
|
+
4. **Local Sound Files** (Fallback) - Plays bundled MP3 files if all TTS fails
|
|
22
|
+
|
|
23
|
+
### Smart Notification System
|
|
24
|
+
- **Sound-first mode**: Play a sound immediately, then speak a TTS reminder if user doesn't respond
|
|
25
|
+
- **TTS-first mode**: Speak immediately using TTS
|
|
26
|
+
- **Both mode**: Play sound AND speak TTS at the same time
|
|
27
|
+
- **Sound-only mode**: Just play sounds, no TTS
|
|
28
|
+
|
|
29
|
+
### Intelligent Reminders
|
|
30
|
+
- Delayed TTS reminders if user doesn't respond within configurable time
|
|
31
|
+
- Follow-up reminders with exponential backoff
|
|
32
|
+
- Automatic cancellation when user responds
|
|
33
|
+
- Per-notification type delays (permission requests are more urgent)
|
|
34
|
+
- **Smart Quota Handling**: Automatically falls back to free Edge TTS if ElevenLabs quota is exceeded
|
|
35
|
+
- **Permission Batching**: Multiple simultaneous permission requests are batched into a single notification (e.g., "5 permission requests require your attention")
|
|
36
|
+
- **Question Tool Support** (SDK v1.1.7+): Notifies when the agent asks questions and needs user input
|
|
37
|
+
|
|
38
|
+
### AI-Generated Messages
|
|
39
|
+
- **Dynamic notifications**: Use a local AI to generate unique, contextual messages instead of preset static ones
|
|
40
|
+
- **OpenAI-compatible**: Works with Ollama, LM Studio, LocalAI, vLLM, llama.cpp, Jan.ai, or any OpenAI-compatible endpoint
|
|
41
|
+
- **User-hosted**: You provide your own AI endpoint - no cloud API keys required
|
|
42
|
+
- **Custom prompts**: Configure prompts per notification type for full control over AI personality
|
|
43
|
+
- **Smart fallback**: Automatically falls back to static messages if AI is unavailable
|
|
44
|
+
|
|
45
|
+
### System Integration
|
|
46
|
+
- **Native Edge TTS**: No external dependencies (Python/pip) required
|
|
47
|
+
- Wake monitor from sleep before notifying
|
|
48
|
+
- Auto-boost volume if too low
|
|
49
|
+
- TUI toast notifications
|
|
50
|
+
- Cross-platform support (Windows, macOS, Linux)
|
|
51
|
+
|
|
52
|
+
## Installation
|
|
53
|
+
|
|
54
|
+
### Option 1: From npm/Bun (Recommended)
|
|
55
|
+
|
|
56
|
+
Add to your OpenCode config file (`~/.config/opencode/opencode.json`):
|
|
57
|
+
|
|
58
|
+
```json
|
|
59
|
+
{
|
|
60
|
+
"$schema": "https://opencode.ai/config.json",
|
|
61
|
+
"plugin": ["opencode-smart-voice-notify@latest"]
|
|
62
|
+
}
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
> **Note**: OpenCode will automatically install the plugin using your system's package manager (npm or bun).
|
|
66
66
|
|
|
67
67
|
### Option 2: From GitHub
|
|
68
68
|
|
|
@@ -91,397 +91,161 @@ Add to your OpenCode config file (`~/.config/opencode/opencode.json`):
|
|
|
91
91
|
|
|
92
92
|
### Automatic Setup
|
|
93
93
|
|
|
94
|
-
When you first run OpenCode with this plugin installed, it will **automatically create**:
|
|
95
|
-
|
|
96
|
-
1. **`~/.config/opencode/smart-voice-notify.jsonc`** - A comprehensive configuration file with all available options fully documented.
|
|
97
|
-
2. **`~/.config/opencode/assets/*.mp3`** - Bundled notification sound files.
|
|
98
|
-
3. **`~/.config/opencode/logs/`** - Debug log folder (created when debug logging is enabled).
|
|
99
|
-
|
|
100
|
-
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.
|
|
94
|
+
When you first run OpenCode with this plugin installed, it will **automatically create**:
|
|
101
95
|
|
|
102
|
-
|
|
96
|
+
1. **`~/.config/opencode/smart-voice-notify.jsonc`** - A comprehensive configuration file with all available options fully documented.
|
|
97
|
+
2. **`~/.config/opencode/assets/*.mp3`** - Bundled notification sound files.
|
|
98
|
+
3. **`~/.config/opencode/logs/`** - Debug log folder (created when debug logging is enabled).
|
|
103
99
|
|
|
104
|
-
|
|
100
|
+
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.
|
|
105
101
|
|
|
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
106
|
```jsonc
|
|
107
107
|
{
|
|
108
108
|
// ============================================================
|
|
109
|
-
// OpenCode Smart Voice Notify -
|
|
109
|
+
// OpenCode Smart Voice Notify - Quick Start Configuration
|
|
110
110
|
// ============================================================
|
|
111
|
-
//
|
|
112
|
-
//
|
|
113
|
-
//
|
|
114
|
-
// To use this plugin:
|
|
115
|
-
// 1. Copy this file to: ~/.config/opencode/smart-voice-notify.jsonc
|
|
116
|
-
// (On Windows: C:\Users\<YourUser>\.config\opencode\smart-voice-notify.jsonc)
|
|
117
|
-
// 2. Customize the settings below to your preference
|
|
118
|
-
// 3. The plugin auto-creates a minimal config if none exists
|
|
119
|
-
//
|
|
120
|
-
// Sound files are automatically copied to ~/.config/opencode/assets/
|
|
121
|
-
// on first run. You can also use your own custom sound files.
|
|
122
|
-
//
|
|
111
|
+
// For ALL available options, see example.config.jsonc in the plugin.
|
|
112
|
+
// The plugin auto-creates a comprehensive config on first run.
|
|
123
113
|
// ============================================================
|
|
124
114
|
|
|
125
|
-
//
|
|
126
|
-
|
|
127
|
-
// ============================================================
|
|
128
|
-
// Controls how notifications are delivered:
|
|
129
|
-
// 'sound-first' - Play sound immediately, TTS reminder after delay (RECOMMENDED)
|
|
130
|
-
// 'tts-first' - Speak TTS immediately, no sound
|
|
131
|
-
// 'both' - Play sound AND speak TTS immediately
|
|
132
|
-
// 'sound-only' - Only play sound, no TTS at all
|
|
133
|
-
"notificationMode": "sound-first",
|
|
134
|
-
|
|
135
|
-
// ============================================================
|
|
136
|
-
// TTS REMINDER SETTINGS (When user doesn't respond to sound)
|
|
137
|
-
// ============================================================
|
|
138
|
-
|
|
139
|
-
// Enable TTS reminder if user doesn't respond after sound notification
|
|
140
|
-
"enableTTSReminder": true,
|
|
141
|
-
|
|
142
|
-
// Delay (in seconds) before TTS reminder fires
|
|
143
|
-
// Set globally or per-notification type
|
|
144
|
-
"ttsReminderDelaySeconds": 30, // Global default
|
|
145
|
-
"idleReminderDelaySeconds": 30, // For task completion notifications
|
|
146
|
-
"permissionReminderDelaySeconds": 20, // For permission requests (more urgent)
|
|
147
|
-
|
|
148
|
-
// Follow-up reminders if user STILL doesn't respond after first TTS
|
|
149
|
-
"enableFollowUpReminders": true,
|
|
150
|
-
"maxFollowUpReminders": 3, // Max number of follow-up TTS reminders
|
|
151
|
-
"reminderBackoffMultiplier": 1.5, // Each follow-up waits longer (30s, 45s, 67s...)
|
|
115
|
+
// Master switch to enable/disable the plugin without uninstalling
|
|
116
|
+
"enabled": true,
|
|
152
117
|
|
|
153
|
-
//
|
|
154
|
-
|
|
155
|
-
// ============================================================
|
|
156
|
-
// When multiple permissions arrive simultaneously (e.g., 5 at once),
|
|
157
|
-
// batch them into a single notification instead of playing 5 overlapping sounds.
|
|
158
|
-
// The notification will say "X permission requests require your attention".
|
|
118
|
+
// Notification mode: 'sound-first', 'tts-first', 'both', 'sound-only'
|
|
119
|
+
"notificationMode": "sound-first",
|
|
159
120
|
|
|
160
|
-
//
|
|
161
|
-
"permissionBatchWindowMs": 800,
|
|
162
|
-
|
|
163
|
-
// ============================================================
|
|
164
|
-
// TTS ENGINE SELECTION
|
|
165
|
-
// ============================================================
|
|
166
|
-
// 'elevenlabs' - Best quality, anime-like voices (requires API key, free tier: 10k chars/month)
|
|
167
|
-
// 'edge' - Good quality neural voices (Free, Native Node.js implementation)
|
|
168
|
-
// 'sapi' - Windows built-in voices (free, offline, robotic)
|
|
121
|
+
// TTS engine: 'elevenlabs', 'edge', 'sapi'
|
|
169
122
|
"ttsEngine": "elevenlabs",
|
|
170
|
-
|
|
171
|
-
// Enable TTS for notifications (falls back to sound files if TTS fails)
|
|
172
123
|
"enableTTS": true,
|
|
173
124
|
|
|
174
|
-
//
|
|
175
|
-
// ELEVENLABS SETTINGS (Best Quality - Anime-like Voices)
|
|
176
|
-
// ============================================================
|
|
177
|
-
// Get your API key from: https://elevenlabs.io/app/settings/api-keys
|
|
178
|
-
// Free tier: 10,000 characters/month
|
|
125
|
+
// ElevenLabs settings (get API key from https://elevenlabs.io/app/settings/api-keys)
|
|
179
126
|
"elevenLabsApiKey": "YOUR_API_KEY_HERE",
|
|
127
|
+
"elevenLabsVoiceId": "cgSgspJ2msm6clMCkdW9", // Jessica - Playful, Bright
|
|
180
128
|
|
|
181
|
-
//
|
|
182
|
-
// 'cgSgspJ2msm6clMCkdW9' - Jessica (Playful, Bright, Warm) - RECOMMENDED
|
|
183
|
-
// 'FGY2WhTYpPnrIDTdsKH5' - Laura (Enthusiast, Quirky)
|
|
184
|
-
// 'jsCqWAovK2LkecY7zXl4' - Freya (Expressive, Confident)
|
|
185
|
-
// 'EXAVITQu4vr4xnSDxMaL' - Sarah (Soft, Warm)
|
|
186
|
-
// Browse more at: https://elevenlabs.io/voice-library
|
|
187
|
-
"elevenLabsVoiceId": "cgSgspJ2msm6clMCkdW9",
|
|
188
|
-
|
|
189
|
-
// Model: 'eleven_turbo_v2_5' (fast, good), 'eleven_multilingual_v2' (highest quality)
|
|
190
|
-
"elevenLabsModel": "eleven_turbo_v2_5",
|
|
191
|
-
|
|
192
|
-
// Voice tuning (0.0 to 1.0)
|
|
193
|
-
"elevenLabsStability": 0.5, // Lower = more expressive, Higher = more consistent
|
|
194
|
-
"elevenLabsSimilarity": 0.75, // How closely to match the original voice
|
|
195
|
-
"elevenLabsStyle": 0.5, // Style exaggeration (higher = more expressive)
|
|
196
|
-
|
|
197
|
-
// ============================================================
|
|
198
|
-
// EDGE TTS SETTINGS (Free Neural Voices - Fallback)
|
|
199
|
-
// ============================================================
|
|
200
|
-
// Native Node.js implementation (No external dependencies)
|
|
201
|
-
|
|
202
|
-
// Voice options (run 'edge-tts --list-voices' to see all):
|
|
203
|
-
// 'en-US-AnaNeural' - Young, cute, cartoon-like (RECOMMENDED)
|
|
204
|
-
// 'en-US-JennyNeural' - Friendly, warm
|
|
205
|
-
// 'en-US-AriaNeural' - Confident, clear
|
|
206
|
-
// 'en-GB-SoniaNeural' - British, friendly
|
|
207
|
-
// 'en-AU-NatashaNeural' - Australian, warm
|
|
129
|
+
// Edge TTS settings (free, no API key required)
|
|
208
130
|
"edgeVoice": "en-US-AnaNeural",
|
|
209
|
-
|
|
210
|
-
// Pitch adjustment: +0Hz to +100Hz (higher = more anime-like)
|
|
211
131
|
"edgePitch": "+50Hz",
|
|
212
|
-
|
|
213
|
-
// Speech rate: -50% to +100%
|
|
214
132
|
"edgeRate": "+10%",
|
|
215
133
|
|
|
216
|
-
//
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
// Add-Type -AssemblyName System.Speech; (New-Object System.Speech.Synthesis.SpeechSynthesizer).GetInstalledVoices() | % { $_.VoiceInfo.Name }
|
|
222
|
-
//
|
|
223
|
-
// Common Windows voices:
|
|
224
|
-
// 'Microsoft Zira Desktop' - Female, US English
|
|
225
|
-
// 'Microsoft David Desktop' - Male, US English
|
|
226
|
-
// 'Microsoft Hazel Desktop' - Female, UK English
|
|
227
|
-
"sapiVoice": "Microsoft Zira Desktop",
|
|
228
|
-
|
|
229
|
-
// Speech rate: -10 (slowest) to +10 (fastest), 0 is normal
|
|
230
|
-
"sapiRate": -1,
|
|
231
|
-
|
|
232
|
-
// Pitch: 'x-low', 'low', 'medium', 'high', 'x-high'
|
|
233
|
-
"sapiPitch": "medium",
|
|
234
|
-
|
|
235
|
-
// Volume: 'silent', 'x-soft', 'soft', 'medium', 'loud', 'x-loud'
|
|
236
|
-
"sapiVolume": "loud",
|
|
237
|
-
|
|
238
|
-
// ============================================================
|
|
239
|
-
// INITIAL TTS MESSAGES (Used immediately or after sound)
|
|
240
|
-
// These are randomly selected each time for variety
|
|
241
|
-
// ============================================================
|
|
242
|
-
|
|
243
|
-
// Messages when agent finishes work (task completion)
|
|
244
|
-
"idleTTSMessages": [
|
|
245
|
-
"All done! Your task has been completed successfully.",
|
|
246
|
-
"Hey there! I finished working on your request.",
|
|
247
|
-
"Task complete! Ready for your review whenever you are.",
|
|
248
|
-
"Good news! Everything is done and ready for you.",
|
|
249
|
-
"Finished! Let me know if you need anything else."
|
|
250
|
-
],
|
|
251
|
-
|
|
252
|
-
// Messages for permission requests
|
|
253
|
-
"permissionTTSMessages": [
|
|
254
|
-
"Attention please! I need your permission to continue.",
|
|
255
|
-
"Hey! Quick approval needed to proceed with the task.",
|
|
256
|
-
"Heads up! There is a permission request waiting for you.",
|
|
257
|
-
"Excuse me! I need your authorization before I can continue.",
|
|
258
|
-
"Permission required! Please review and approve when ready."
|
|
259
|
-
],
|
|
260
|
-
|
|
261
|
-
// Messages for MULTIPLE permission requests (use {count} placeholder)
|
|
262
|
-
// Used when several permissions arrive simultaneously
|
|
263
|
-
"permissionTTSMessagesMultiple": [
|
|
264
|
-
"Attention please! There are {count} permission requests waiting for your approval.",
|
|
265
|
-
"Hey! {count} permissions need your approval to continue.",
|
|
266
|
-
"Heads up! You have {count} pending permission requests.",
|
|
267
|
-
"Excuse me! I need your authorization for {count} different actions.",
|
|
268
|
-
"{count} permissions required! Please review and approve when ready."
|
|
269
|
-
],
|
|
270
|
-
|
|
271
|
-
// ============================================================
|
|
272
|
-
// TTS REMINDER MESSAGES (More urgent - used after delay if no response)
|
|
273
|
-
// These are more personalized and urgent to get user attention
|
|
274
|
-
// ============================================================
|
|
275
|
-
|
|
276
|
-
// Reminder messages when agent finished but user hasn't responded
|
|
277
|
-
"idleReminderTTSMessages": [
|
|
278
|
-
"Hey, are you still there? Your task has been waiting for review.",
|
|
279
|
-
"Just a gentle reminder - I finished your request a while ago!",
|
|
280
|
-
"Hello? I completed your task. Please take a look when you can.",
|
|
281
|
-
"Still waiting for you! The work is done and ready for review.",
|
|
282
|
-
"Knock knock! Your completed task is patiently waiting for you."
|
|
283
|
-
],
|
|
284
|
-
|
|
285
|
-
// Reminder messages when permission still needed
|
|
286
|
-
"permissionReminderTTSMessages": [
|
|
287
|
-
"Hey! I still need your permission to continue. Please respond!",
|
|
288
|
-
"Reminder: There is a pending permission request. I cannot proceed without you.",
|
|
289
|
-
"Hello? I am waiting for your approval. This is getting urgent!",
|
|
290
|
-
"Please check your screen! I really need your permission to move forward.",
|
|
291
|
-
"Still waiting for authorization! The task is on hold until you respond."
|
|
292
|
-
],
|
|
293
|
-
|
|
294
|
-
// Reminder messages for MULTIPLE permissions (use {count} placeholder)
|
|
295
|
-
"permissionReminderTTSMessagesMultiple": [
|
|
296
|
-
"Hey! I still need your approval for {count} permissions. Please respond!",
|
|
297
|
-
"Reminder: There are {count} pending permission requests. I cannot proceed without you.",
|
|
298
|
-
"Hello? I am waiting for your approval on {count} items. This is getting urgent!",
|
|
299
|
-
"Please check your screen! {count} permissions are waiting for your response.",
|
|
300
|
-
"Still waiting for authorization on {count} requests! The task is on hold."
|
|
301
|
-
],
|
|
302
|
-
|
|
303
|
-
// ============================================================
|
|
304
|
-
// QUESTION TOOL MESSAGES (SDK v1.1.7+ - Agent asking user questions)
|
|
305
|
-
// ============================================================
|
|
306
|
-
// The "question" tool allows the LLM to ask users questions during execution.
|
|
307
|
-
// This is useful for gathering preferences, clarifying instructions, or getting
|
|
308
|
-
// decisions on implementation choices.
|
|
309
|
-
|
|
310
|
-
// Messages when agent asks user a question
|
|
311
|
-
"questionTTSMessages": [
|
|
312
|
-
"Hey! I have a question for you. Please check your screen.",
|
|
313
|
-
"Attention! I need your input to continue.",
|
|
314
|
-
"Quick question! Please take a look when you have a moment.",
|
|
315
|
-
"I need some clarification. Could you please respond?",
|
|
316
|
-
"Question time! Your input is needed to proceed."
|
|
317
|
-
],
|
|
318
|
-
|
|
319
|
-
// Messages for MULTIPLE questions (use {count} placeholder)
|
|
320
|
-
"questionTTSMessagesMultiple": [
|
|
321
|
-
"Hey! I have {count} questions for you. Please check your screen.",
|
|
322
|
-
"Attention! I need your input on {count} items to continue.",
|
|
323
|
-
"{count} questions need your attention. Please take a look!",
|
|
324
|
-
"I need some clarifications. There are {count} questions waiting for you.",
|
|
325
|
-
"Question time! {count} questions need your response to proceed."
|
|
326
|
-
],
|
|
327
|
-
|
|
328
|
-
// Reminder messages for questions (more urgent - used after delay)
|
|
329
|
-
"questionReminderTTSMessages": [
|
|
330
|
-
"Hey! I am still waiting for your answer. Please check the questions!",
|
|
331
|
-
"Reminder: There is a question waiting for your response.",
|
|
332
|
-
"Hello? I need your input to continue. Please respond when you can.",
|
|
333
|
-
"Still waiting for your answer! The task is on hold.",
|
|
334
|
-
"Your input is needed! Please check the pending question."
|
|
335
|
-
],
|
|
336
|
-
|
|
337
|
-
// Reminder messages for MULTIPLE questions (use {count} placeholder)
|
|
338
|
-
"questionReminderTTSMessagesMultiple": [
|
|
339
|
-
"Hey! I am still waiting for answers to {count} questions. Please respond!",
|
|
340
|
-
"Reminder: There are {count} questions waiting for your response.",
|
|
341
|
-
"Hello? I need your input on {count} items. Please respond when you can.",
|
|
342
|
-
"Still waiting for your answers on {count} questions! The task is on hold.",
|
|
343
|
-
"Your input is needed! {count} questions are pending your response."
|
|
344
|
-
],
|
|
345
|
-
|
|
346
|
-
// Delay (in seconds) before question reminder fires
|
|
347
|
-
"questionReminderDelaySeconds": 25,
|
|
348
|
-
|
|
349
|
-
// Question batch window (ms) - how long to wait for more questions before notifying
|
|
350
|
-
"questionBatchWindowMs": 800,
|
|
351
|
-
|
|
352
|
-
// ============================================================
|
|
353
|
-
// SOUND FILES (For immediate notifications)
|
|
354
|
-
// These are played first before TTS reminder kicks in
|
|
355
|
-
// ============================================================
|
|
356
|
-
// Paths are relative to ~/.config/opencode/ directory
|
|
357
|
-
// The plugin automatically copies bundled sounds to assets/ on first run
|
|
358
|
-
// You can replace with your own custom MP3/WAV files
|
|
359
|
-
|
|
360
|
-
"idleSound": "assets/Soft-high-tech-notification-sound-effect.mp3",
|
|
361
|
-
"permissionSound": "assets/Machine-alert-beep-sound-effect.mp3",
|
|
362
|
-
"questionSound": "assets/Machine-alert-beep-sound-effect.mp3",
|
|
134
|
+
// TTS reminder settings
|
|
135
|
+
"enableTTSReminder": true,
|
|
136
|
+
"ttsReminderDelaySeconds": 30,
|
|
137
|
+
"enableFollowUpReminders": true,
|
|
138
|
+
"maxFollowUpReminders": 3,
|
|
363
139
|
|
|
364
|
-
//
|
|
365
|
-
|
|
366
|
-
|
|
140
|
+
// AI-generated messages (optional - requires local AI server)
|
|
141
|
+
"enableAIMessages": false,
|
|
142
|
+
"aiEndpoint": "http://localhost:11434/v1",
|
|
143
|
+
"aiModel": "llama3",
|
|
144
|
+
"aiApiKey": "",
|
|
145
|
+
"aiFallbackToStatic": true,
|
|
367
146
|
|
|
368
|
-
//
|
|
147
|
+
// General settings
|
|
369
148
|
"wakeMonitor": true,
|
|
370
|
-
|
|
371
|
-
// Force system volume up if below threshold
|
|
372
149
|
"forceVolume": true,
|
|
373
|
-
|
|
374
|
-
// Volume threshold (0-100): force volume if current level is below this
|
|
375
150
|
"volumeThreshold": 50,
|
|
376
|
-
|
|
377
|
-
// Show TUI toast notifications in OpenCode terminal
|
|
378
151
|
"enableToast": true,
|
|
379
|
-
|
|
380
|
-
// Enable audio notifications (sound files and TTS)
|
|
381
152
|
"enableSound": true,
|
|
382
|
-
|
|
383
|
-
// Consider monitor asleep after this many seconds of inactivity (Windows only)
|
|
384
|
-
"idleThresholdSeconds": 60,
|
|
385
|
-
|
|
386
|
-
// Enable debug logging to ~/.config/opencode/logs/smart-voice-notify-debug.log
|
|
387
|
-
// The logs folder is created automatically when debug logging is enabled
|
|
388
|
-
// Useful for troubleshooting notification issues
|
|
389
153
|
"debugLog": false
|
|
390
154
|
}
|
|
391
155
|
```
|
|
392
|
-
|
|
393
|
-
See `example.config.jsonc` for more details.
|
|
394
|
-
|
|
395
|
-
### AI Message Generation (Optional)
|
|
396
|
-
|
|
397
|
-
If you want dynamic, AI-generated notification messages instead of preset ones, you can connect to a local AI server:
|
|
398
|
-
|
|
399
|
-
1. **Install a local AI server** (e.g., [Ollama](https://ollama.ai)):
|
|
400
|
-
```bash
|
|
401
|
-
# Install Ollama and pull a model
|
|
402
|
-
ollama pull llama3
|
|
403
|
-
```
|
|
404
|
-
|
|
405
|
-
2. **Enable AI messages in your config**:
|
|
406
|
-
```jsonc
|
|
407
|
-
{
|
|
408
|
-
"enableAIMessages": true,
|
|
409
|
-
"aiEndpoint": "http://localhost:11434/v1",
|
|
410
|
-
"aiModel": "llama3",
|
|
411
|
-
"aiApiKey": "",
|
|
412
|
-
"aiFallbackToStatic": true
|
|
413
|
-
}
|
|
414
|
-
```
|
|
415
|
-
|
|
416
|
-
3. **The AI will generate unique messages** for each notification, which are then spoken by your TTS engine.
|
|
417
156
|
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
157
|
+
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.
|
|
158
|
+
|
|
159
|
+
### AI Message Generation (Optional)
|
|
160
|
+
|
|
161
|
+
If you want dynamic, AI-generated notification messages instead of preset ones, you can connect to a local AI server:
|
|
162
|
+
|
|
163
|
+
1. **Install a local AI server** (e.g., [Ollama](https://ollama.ai)):
|
|
164
|
+
```bash
|
|
165
|
+
# Install Ollama and pull a model
|
|
166
|
+
ollama pull llama3
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
2. **Enable AI messages in your config**:
|
|
170
|
+
```jsonc
|
|
171
|
+
{
|
|
172
|
+
"enableAIMessages": true,
|
|
173
|
+
"aiEndpoint": "http://localhost:11434/v1",
|
|
174
|
+
"aiModel": "llama3",
|
|
175
|
+
"aiApiKey": "",
|
|
176
|
+
"aiFallbackToStatic": true
|
|
177
|
+
}
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
3. **The AI will generate unique messages** for each notification, which are then spoken by your TTS engine.
|
|
181
|
+
|
|
182
|
+
**Supported AI Servers:**
|
|
183
|
+
| Server | Default Endpoint | API Key |
|
|
184
|
+
|--------|-----------------|---------|
|
|
185
|
+
| Ollama | `http://localhost:11434/v1` | Not needed |
|
|
186
|
+
| LM Studio | `http://localhost:1234/v1` | Not needed |
|
|
187
|
+
| LocalAI | `http://localhost:8080/v1` | Not needed |
|
|
188
|
+
| vLLM | `http://localhost:8000/v1` | Use "EMPTY" |
|
|
189
|
+
| Jan.ai | `http://localhost:1337/v1` | Required |
|
|
190
|
+
|
|
191
|
+
## Requirements
|
|
192
|
+
|
|
193
|
+
### For ElevenLabs TTS
|
|
194
|
+
- ElevenLabs API key (free tier: 10,000 characters/month)
|
|
195
|
+
- Internet connection
|
|
196
|
+
|
|
197
|
+
### For Edge TTS
|
|
198
|
+
- Internet connection (No external dependencies required)
|
|
199
|
+
|
|
200
|
+
### For Windows SAPI
|
|
201
|
+
- Windows OS (uses built-in System.Speech)
|
|
202
|
+
|
|
203
|
+
### For Sound Playback
|
|
440
204
|
- **Windows**: Built-in (uses Windows Media Player)
|
|
441
205
|
- **macOS**: Built-in (`afplay`)
|
|
442
206
|
- **Linux**: `paplay` or `aplay`
|
|
443
207
|
|
|
444
|
-
## Events Handled
|
|
445
|
-
|
|
446
|
-
| Event | Action |
|
|
447
|
-
|-------|--------|
|
|
448
|
-
| `session.idle` | Agent finished working - notify user |
|
|
449
|
-
| `permission.asked` | Permission request (SDK v1.1.1+) - alert user |
|
|
450
|
-
| `permission.updated` | Permission request (SDK v1.0.x) - alert user |
|
|
451
|
-
| `permission.replied` | User responded - cancel pending reminders |
|
|
452
|
-
| `question.asked` | Agent asks question (SDK v1.1.7+) - notify user |
|
|
453
|
-
| `question.replied` | User answered question - cancel pending reminders |
|
|
454
|
-
| `question.rejected` | User dismissed question - cancel pending reminders |
|
|
455
|
-
| `message.updated` | New user message - cancel pending reminders |
|
|
456
|
-
| `session.created` | New session - reset state |
|
|
457
|
-
|
|
458
|
-
> **Note**: The plugin supports OpenCode SDK v1.0.x, v1.1.x, and v1.1.7+ for backward compatibility.
|
|
208
|
+
## Events Handled
|
|
459
209
|
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
210
|
+
| Event | Action |
|
|
211
|
+
|-------|--------|
|
|
212
|
+
| `session.idle` | Agent finished working - notify user |
|
|
213
|
+
| `permission.asked` | Permission request (SDK v1.1.1+) - alert user |
|
|
214
|
+
| `permission.updated` | Permission request (SDK v1.0.x) - alert user |
|
|
215
|
+
| `permission.replied` | User responded - cancel pending reminders |
|
|
216
|
+
| `question.asked` | Agent asks question (SDK v1.1.7+) - notify user |
|
|
217
|
+
| `question.replied` | User answered question - cancel pending reminders |
|
|
218
|
+
| `question.rejected` | User dismissed question - cancel pending reminders |
|
|
219
|
+
| `message.updated` | New user message - cancel pending reminders |
|
|
220
|
+
| `session.created` | New session - reset state |
|
|
221
|
+
|
|
222
|
+
> **Note**: The plugin supports OpenCode SDK v1.0.x, v1.1.x, and v1.1.7+ for backward compatibility.
|
|
223
|
+
|
|
224
|
+
## Development
|
|
225
|
+
|
|
226
|
+
To develop on this plugin locally:
|
|
227
|
+
|
|
228
|
+
1. Clone the repository:
|
|
229
|
+
```bash
|
|
230
|
+
git clone https://github.com/MasuRii/opencode-smart-voice-notify.git
|
|
231
|
+
cd opencode-smart-voice-notify
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
2. Install dependencies:
|
|
235
|
+
```bash
|
|
236
|
+
# Using Bun (recommended)
|
|
237
|
+
bun install
|
|
238
|
+
|
|
239
|
+
# Or using npm
|
|
240
|
+
npm install
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
3. Link to your OpenCode config:
|
|
244
|
+
```json
|
|
245
|
+
{
|
|
246
|
+
"plugin": ["file:///absolute/path/to/opencode-smart-voice-notify"]
|
|
247
|
+
}
|
|
248
|
+
```
|
|
485
249
|
|
|
486
250
|
## Updating
|
|
487
251
|
|