agentvibes 3.5.0-alpha.1 → 3.5.0-alpha.2

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.
@@ -0,0 +1,76 @@
1
+ #
2
+ # File: download-piper-voices.ps1
3
+ #
4
+ # AgentVibes - Download Piper Voice Models
5
+ # Downloads voice models from HuggingFace for offline TTS
6
+ #
7
+
8
+ Write-Host ""
9
+ Write-Host "======================================================" -ForegroundColor Cyan
10
+ Write-Host " Piper Voice Model Downloader" -ForegroundColor Cyan
11
+ Write-Host "======================================================" -ForegroundColor Cyan
12
+ Write-Host ""
13
+
14
+ # Configuration
15
+ $VoiceDir = "$env:USERPROFILE\.claude\piper-voices"
16
+
17
+ # Create directory if it doesn't exist
18
+ if (-not (Test-Path $VoiceDir)) {
19
+ Write-Host "Creating directory: $VoiceDir" -ForegroundColor Yellow
20
+ New-Item -ItemType Directory -Path $VoiceDir -Force | Out-Null
21
+ }
22
+
23
+ Write-Host "Voice directory: $VoiceDir" -ForegroundColor Gray
24
+ Write-Host ""
25
+
26
+ # Voice models to download
27
+ $Voices = @(
28
+ @{
29
+ name = "en_US-ryan-high"
30
+ description = "Male voice (high quality) - DEFAULT"
31
+ modelUrl = "https://huggingface.co/rhasspy/piper-voices/resolve/main/en/en_US/ryan/high/en_US-ryan-high.onnx"
32
+ configUrl = "https://huggingface.co/rhasspy/piper-voices/resolve/main/en/en_US/ryan/high/en_US-ryan-high.onnx.json"
33
+ }
34
+ )
35
+
36
+ # Download voices
37
+ foreach ($voice in $Voices) {
38
+ Write-Host "Downloading: $($voice.name)" -ForegroundColor Cyan
39
+ Write-Host " Description: $($voice.description)" -ForegroundColor Gray
40
+
41
+ $modelFile = "$VoiceDir\$($voice.name).onnx"
42
+ $configFile = "$VoiceDir\$($voice.name).onnx.json"
43
+
44
+ # Check if already exists
45
+ if ((Test-Path $modelFile) -and (Test-Path $configFile)) {
46
+ Write-Host " [OK] Already downloaded" -ForegroundColor Green
47
+ continue
48
+ }
49
+
50
+ try {
51
+ Write-Host " Downloading model file..." -ForegroundColor Yellow
52
+ Invoke-WebRequest -Uri $voice.modelUrl -OutFile $modelFile -ErrorAction Stop
53
+
54
+ Write-Host " Downloading config file..." -ForegroundColor Yellow
55
+ Invoke-WebRequest -Uri $voice.configUrl -OutFile $configFile -ErrorAction Stop
56
+
57
+ $modelSize = (Get-Item $modelFile).Length / 1MB
58
+ Write-Host " [OK] Downloaded ($([math]::Round($modelSize, 2)) MB)" -ForegroundColor Green
59
+ }
60
+ catch {
61
+ Write-Host " [ERROR] Failed to download: $_" -ForegroundColor Red
62
+ Write-Host " Check your internet connection and try again" -ForegroundColor Yellow
63
+ }
64
+
65
+ Write-Host ""
66
+ }
67
+
68
+ # Summary
69
+ Write-Host "======================================================" -ForegroundColor Green
70
+ Write-Host " Download Complete!" -ForegroundColor Green
71
+ Write-Host "======================================================" -ForegroundColor Green
72
+ Write-Host ""
73
+
74
+ Write-Host "Voice models are ready. You can now test Piper:" -ForegroundColor Cyan
75
+ Write-Host " .\.claude\hooks-windows\play-tts.ps1 `"Hello from Piper`"" -ForegroundColor Gray
76
+ Write-Host ""
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "agentvibes",
4
- "version": "3.5.0-alpha.1",
4
+ "version": "3.5.0-alpha.2",
5
5
  "description": "Now your AI Agents can finally talk back! Professional TTS voice for Claude Code, Claude Desktop (via MCP), and Clawdbot with multi-provider support.",
6
6
  "homepage": "https://agentvibes.org",
7
7
  "keywords": [
@@ -35,6 +35,8 @@
35
35
  "files": [
36
36
  "bin/",
37
37
  "src/",
38
+ "setup-windows.ps1",
39
+ "download-piper-voices.ps1",
38
40
  "templates/*.sh",
39
41
  "templates/*.md",
40
42
  "templates/audio/*.mp3",
@@ -0,0 +1,282 @@
1
+ #
2
+ # File: setup-windows.ps1
3
+ #
4
+ # AgentVibes Windows Native Setup Script
5
+ # Installs and configures AgentVibes for Windows
6
+ #
7
+
8
+ param(
9
+ [Parameter(Mandatory = $false)]
10
+ [ValidateSet('piper', 'sapi')]
11
+ [string]$Provider
12
+ )
13
+
14
+ $ErrorActionPreference = "Stop"
15
+
16
+ Write-Host ""
17
+ Write-Host "======================================================" -ForegroundColor Cyan
18
+ Write-Host " AgentVibes - Windows Native Setup" -ForegroundColor Cyan
19
+ Write-Host "======================================================" -ForegroundColor Cyan
20
+ Write-Host ""
21
+
22
+ # PowerShell version check
23
+ $PSVersionRequired = [Version]"5.1"
24
+ if ($PSVersionTable.PSVersion -lt $PSVersionRequired) {
25
+ Write-Host "[ERROR] PowerShell 5.1+ required" -ForegroundColor Red
26
+ Write-Host "Current: $($PSVersionTable.PSVersion)" -ForegroundColor Yellow
27
+ exit 1
28
+ }
29
+
30
+ Write-Host "[OK] PowerShell version: $($PSVersionTable.PSVersion)" -ForegroundColor Green
31
+
32
+ # Setup paths
33
+ $ClaudeDir = "$env:USERPROFILE\.claude"
34
+ $HooksDir = "$ClaudeDir\hooks-windows"
35
+ $AudioDir = "$ClaudeDir\audio"
36
+ $VoicesDir = "$ClaudeDir\piper-voices"
37
+ $PiperDir = "$env:LOCALAPPDATA\Programs\Piper"
38
+ $PiperExe = "$PiperDir\piper.exe"
39
+
40
+ Write-Host ""
41
+ Write-Host "Setting up directories..." -ForegroundColor Cyan
42
+
43
+ foreach ($dir in @($ClaudeDir, $AudioDir, $VoicesDir, $PiperDir)) {
44
+ if (-not (Test-Path $dir)) {
45
+ New-Item -ItemType Directory -Path $dir -Force | Out-Null
46
+ Write-Host " [OK] Created: $dir" -ForegroundColor Green
47
+ }
48
+ else {
49
+ Write-Host " [OK] Exists: $dir" -ForegroundColor Green
50
+ }
51
+ }
52
+
53
+ # Copy hook scripts from project to user profile
54
+ Write-Host ""
55
+ Write-Host "Installing hook scripts..." -ForegroundColor Cyan
56
+
57
+ $SourceHooksDir = Join-Path $PSScriptRoot ".claude\hooks-windows"
58
+
59
+ # Validate source path is within the project directory (path traversal prevention)
60
+ $ResolvedSource = (Resolve-Path -Path $SourceHooksDir -ErrorAction SilentlyContinue).Path
61
+ $ResolvedProject = (Resolve-Path -Path $PSScriptRoot).Path
62
+
63
+ if (-not $ResolvedSource -or -not $ResolvedSource.StartsWith($ResolvedProject)) {
64
+ Write-Host "[ERROR] Hook scripts source path is outside the project directory" -ForegroundColor Red
65
+ exit 1
66
+ }
67
+
68
+ if (-not (Test-Path $SourceHooksDir)) {
69
+ Write-Host "[ERROR] Hook scripts not found at: $SourceHooksDir" -ForegroundColor Red
70
+ Write-Host " Make sure you're running this from the AgentVibes project directory" -ForegroundColor Yellow
71
+ exit 1
72
+ }
73
+
74
+ # Ensure destination hooks directory exists
75
+ if (-not (Test-Path $HooksDir)) {
76
+ New-Item -ItemType Directory -Path $HooksDir -Force | Out-Null
77
+ }
78
+
79
+ $HookScripts = @(
80
+ "play-tts.ps1",
81
+ "play-tts-windows-piper.ps1",
82
+ "play-tts-windows-sapi.ps1",
83
+ "provider-manager.ps1",
84
+ "voice-manager-windows.ps1",
85
+ "audio-cache-utils.ps1"
86
+ )
87
+
88
+ $CopiedCount = 0
89
+ foreach ($script in $HookScripts) {
90
+ $SourceFile = Join-Path $SourceHooksDir $script
91
+ $DestFile = Join-Path $HooksDir $script
92
+
93
+ if (Test-Path $SourceFile) {
94
+ Copy-Item -Path $SourceFile -Destination $DestFile -Force
95
+ Write-Host " [OK] Copied: $script" -ForegroundColor Green
96
+ $CopiedCount++
97
+ }
98
+ else {
99
+ Write-Host " [WARNING] Missing: $script" -ForegroundColor Yellow
100
+ }
101
+ }
102
+
103
+ if ($CopiedCount -eq 0) {
104
+ Write-Host "[ERROR] No hook scripts were copied" -ForegroundColor Red
105
+ exit 1
106
+ }
107
+
108
+ Write-Host "[OK] Installed $CopiedCount hook scripts to: $HooksDir" -ForegroundColor Green
109
+
110
+ # Provider selection
111
+ if (-not $Provider) {
112
+ Write-Host ""
113
+ Write-Host "Choose TTS Provider:" -ForegroundColor Cyan
114
+ Write-Host " [1] Piper (High Quality, ~100MB download)" -ForegroundColor White
115
+ Write-Host " [2] Windows SAPI (Built-in, Basic Quality)" -ForegroundColor White
116
+ Write-Host ""
117
+ $choice = Read-Host "Enter your choice (1 or 2, default: 1)"
118
+
119
+ $Provider = if ([string]::IsNullOrWhiteSpace($choice) -or $choice -eq "1") { "piper" } else { "sapi" }
120
+ }
121
+
122
+ Write-Host ""
123
+ Write-Host "Provider: $Provider" -ForegroundColor Green
124
+
125
+ # Install Piper if selected
126
+ if ($Provider -eq "piper") {
127
+ Write-Host ""
128
+ Write-Host "Installing Piper..." -ForegroundColor Cyan
129
+
130
+ if (Test-Path $PiperExe) {
131
+ Write-Host "[OK] Piper already installed" -ForegroundColor Green
132
+ }
133
+ else {
134
+ Write-Host " Downloading Piper from GitHub..." -ForegroundColor Yellow
135
+
136
+ # Download Piper from GitHub releases
137
+ $DownloadUrl = "https://github.com/rhasspy/piper/releases/download/2023.11.14-2/piper_windows_amd64.zip"
138
+ $DownloadFile = "$env:TEMP\piper-windows.zip"
139
+
140
+ try {
141
+ Write-Host " URL: $DownloadUrl" -ForegroundColor Gray
142
+
143
+ [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
144
+ Invoke-WebRequest -Uri $DownloadUrl -OutFile $DownloadFile -ErrorAction Stop
145
+
146
+ Write-Host "[OK] Downloaded ($('{0:N2}' -f ((Get-Item $DownloadFile).Length / 1MB)) MB)" -ForegroundColor Green
147
+
148
+ # Extract to temp location first
149
+ Write-Host " Extracting..." -ForegroundColor Yellow
150
+ $TempExtractDir = "$env:TEMP\piper-extract"
151
+ Remove-Item -Path $TempExtractDir -Recurse -Force -ErrorAction SilentlyContinue
152
+ Expand-Archive -Path $DownloadFile -DestinationPath $TempExtractDir -Force
153
+
154
+ # Find piper.exe recursively
155
+ $PiperFound = Get-ChildItem -Path $TempExtractDir -Name "piper.exe" -Recurse
156
+
157
+ if ($PiperFound) {
158
+ # Get the full path to piper.exe
159
+ $PiperExePath = (Get-ChildItem -Path $TempExtractDir -Filter "piper.exe" -Recurse).FullName | Select-Object -First 1
160
+ $PiperSourceDir = Split-Path -Parent $PiperExePath
161
+
162
+ # Copy entire piper directory to destination
163
+ Write-Host " Copying Piper to: $PiperDir" -ForegroundColor Yellow
164
+ Copy-Item -Path "$PiperSourceDir\*" -Destination $PiperDir -Recurse -Force
165
+
166
+ # Verify
167
+ if (Test-Path $PiperExe) {
168
+ Write-Host "[OK] Piper installed to: $PiperDir" -ForegroundColor Green
169
+ }
170
+ else {
171
+ throw "Failed to copy Piper executable"
172
+ }
173
+ }
174
+ else {
175
+ throw "piper.exe not found in extracted files"
176
+ }
177
+
178
+ # Cleanup temp extract directory
179
+ Remove-Item -Path $TempExtractDir -Recurse -Force -ErrorAction SilentlyContinue
180
+
181
+ # Cleanup
182
+ Remove-Item $DownloadFile -Force -ErrorAction SilentlyContinue
183
+ }
184
+ catch {
185
+ Write-Host "[ERROR] Failed to install Piper: $_" -ForegroundColor Red
186
+ Write-Host " Please check your internet connection and try again" -ForegroundColor Yellow
187
+ exit 1
188
+ }
189
+ }
190
+
191
+ # Download a default voice
192
+ Write-Host ""
193
+ Write-Host "Setting up default voice..." -ForegroundColor Cyan
194
+
195
+ $DefaultVoice = "en_US-ryan-high"
196
+ $VoiceDir = $VoicesDir
197
+
198
+ # Check if voice already exists
199
+ if ((Test-Path "$VoiceDir\$DefaultVoice.onnx") -and (Test-Path "$VoiceDir\$DefaultVoice.onnx.json")) {
200
+ Write-Host "[OK] Default voice already downloaded" -ForegroundColor Green
201
+ }
202
+ else {
203
+ Write-Host " Downloading $DefaultVoice..." -ForegroundColor Yellow
204
+
205
+ try {
206
+ $HFBase = "https://huggingface.co/rhasspy/piper-voices/resolve/main/en/en_US/ryan/high"
207
+
208
+ [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
209
+
210
+ Write-Host " Model file..." -ForegroundColor Gray
211
+ Invoke-WebRequest -Uri "$HFBase/$DefaultVoice.onnx" `
212
+ -OutFile "$VoiceDir\$DefaultVoice.onnx" `
213
+ -ErrorAction Stop
214
+
215
+ Write-Host " Config file..." -ForegroundColor Gray
216
+ Invoke-WebRequest -Uri "$HFBase/$DefaultVoice.onnx.json" `
217
+ -OutFile "$VoiceDir\$DefaultVoice.onnx.json" `
218
+ -ErrorAction Stop
219
+
220
+ Write-Host "[OK] Voice downloaded" -ForegroundColor Green
221
+ }
222
+ catch {
223
+ Write-Host "[WARNING] Could not download voice: $_" -ForegroundColor Yellow
224
+ Write-Host " You can download voices manually later" -ForegroundColor Gray
225
+ }
226
+ }
227
+ }
228
+
229
+ # Set active provider
230
+ Write-Host ""
231
+ Write-Host "Configuring provider..." -ForegroundColor Cyan
232
+
233
+ $ProviderFile = "$ClaudeDir\tts-provider.txt"
234
+ $ProviderName = if ($Provider -eq "piper") { "windows-piper" } else { "windows-sapi" }
235
+
236
+ Set-Content -Path $ProviderFile -Value $ProviderName
237
+ Write-Host "[OK] Active provider: $ProviderName" -ForegroundColor Green
238
+
239
+ # Test TTS
240
+ Write-Host ""
241
+ Write-Host "Testing TTS..." -ForegroundColor Cyan
242
+
243
+ $HooksDir = "$ClaudeDir\hooks-windows"
244
+
245
+ try {
246
+ if ($Provider -eq "piper") {
247
+ Write-Host " Testing Piper provider..." -ForegroundColor Gray
248
+ & "$HooksDir\play-tts-windows-piper.ps1" "AgentVibes is ready to speak on Windows" | Out-Null
249
+ }
250
+ else {
251
+ Write-Host " Testing SAPI provider..." -ForegroundColor Gray
252
+ & "$HooksDir\play-tts-windows-sapi.ps1" "AgentVibes is ready to speak on Windows" | Out-Null
253
+ }
254
+
255
+ Write-Host "[OK] TTS working!" -ForegroundColor Green
256
+ }
257
+ catch {
258
+ Write-Host "[WARNING] TTS test failed: $_" -ForegroundColor Yellow
259
+ Write-Host " But AgentVibes should still work" -ForegroundColor Gray
260
+ }
261
+
262
+ # Summary
263
+ Write-Host ""
264
+ Write-Host "======================================================" -ForegroundColor Green
265
+ Write-Host " SETUP COMPLETE!" -ForegroundColor Green
266
+ Write-Host "======================================================" -ForegroundColor Green
267
+ Write-Host ""
268
+
269
+ Write-Host "Next Steps:" -ForegroundColor Cyan
270
+ Write-Host " 1. Install AgentVibes: npm install" -ForegroundColor White
271
+ Write-Host " 2. Try it out: npm run dev" -ForegroundColor White
272
+ Write-Host ""
273
+
274
+ Write-Host "Useful Commands:" -ForegroundColor Cyan
275
+ Write-Host " Test TTS: .\.claude\hooks-windows\play-tts.ps1 'Hello'" -ForegroundColor Gray
276
+ Write-Host " List voices: .\.claude\hooks-windows\voice-manager-windows.ps1 list" -ForegroundColor Gray
277
+ Write-Host " Switch voice: .\.claude\hooks-windows\voice-manager-windows.ps1 switch <voice>" -ForegroundColor Gray
278
+ Write-Host " Switch provider: .\.claude\hooks-windows\provider-manager.ps1 switch windows-sapi" -ForegroundColor Gray
279
+ Write-Host ""
280
+
281
+ Write-Host "Documentation: https://agentvibes.org" -ForegroundColor Cyan
282
+ Write-Host ""