voicecc 1.1.36 → 1.2.1

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.
Files changed (46) hide show
  1. package/bin/voicecc.js +94 -1
  2. package/dashboard/dist/assets/index-DCeOdulF.js +28 -0
  3. package/dashboard/dist/index.html +1 -1
  4. package/dashboard/routes/agents.ts +28 -8
  5. package/dashboard/routes/browser-call.ts +3 -2
  6. package/dashboard/routes/chat.ts +75 -55
  7. package/dashboard/routes/providers.ts +5 -74
  8. package/dashboard/routes/twilio.ts +104 -5
  9. package/dashboard/routes/voice.ts +98 -0
  10. package/dashboard/routes/webrtc.ts +2 -11
  11. package/dashboard/server.ts +48 -1
  12. package/package.json +2 -3
  13. package/server/index.ts +96 -8
  14. package/server/services/twilio-manager.ts +29 -10
  15. package/dashboard/dist/assets/index-C62C9Gp0.js +0 -28
  16. package/dashboard/dist/audio-processor.js +0 -126
  17. package/server/services/heartbeat.ts +0 -403
  18. package/server/voice/assets/chime.wav +0 -0
  19. package/server/voice/assets/startup.pcm +0 -0
  20. package/server/voice/audio-adapter.ts +0 -60
  21. package/server/voice/audio-inactivity.test.ts +0 -108
  22. package/server/voice/audio-inactivity.ts +0 -91
  23. package/server/voice/browser-audio-playback.test.ts +0 -149
  24. package/server/voice/browser-audio.ts +0 -147
  25. package/server/voice/browser-server.ts +0 -311
  26. package/server/voice/chat-server.ts +0 -236
  27. package/server/voice/chime.test.ts +0 -69
  28. package/server/voice/chime.ts +0 -36
  29. package/server/voice/claude-session.ts +0 -293
  30. package/server/voice/endpointing.ts +0 -163
  31. package/server/voice/mic-vpio +0 -0
  32. package/server/voice/narration.ts +0 -204
  33. package/server/voice/prompt-builder.ts +0 -108
  34. package/server/voice/session-lock.ts +0 -123
  35. package/server/voice/stt-elevenlabs.ts +0 -210
  36. package/server/voice/stt-provider.ts +0 -106
  37. package/server/voice/tts-elevenlabs-hiss.test.ts +0 -183
  38. package/server/voice/tts-elevenlabs.ts +0 -397
  39. package/server/voice/tts-provider.ts +0 -155
  40. package/server/voice/twilio-audio.ts +0 -338
  41. package/server/voice/twilio-server.ts +0 -540
  42. package/server/voice/types.ts +0 -282
  43. package/server/voice/vad.ts +0 -101
  44. package/server/voice/voice-loop-bugs.test.ts +0 -348
  45. package/server/voice/voice-server.ts +0 -129
  46. package/server/voice/voice-session.ts +0 -539
package/bin/voicecc.js CHANGED
@@ -14,7 +14,7 @@ import { spawn, spawnSync, execSync } from "node:child_process";
14
14
  import { copyFileSync, existsSync, mkdirSync, readFileSync, unlinkSync, writeFileSync, openSync, closeSync } from "node:fs";
15
15
  import { writeFile } from "node:fs/promises";
16
16
  import { createInterface } from "node:readline";
17
- import { randomBytes } from "node:crypto";
17
+ import { createHash, randomBytes } from "node:crypto";
18
18
  import { dirname, join } from "node:path";
19
19
  import { fileURLToPath } from "node:url";
20
20
  import { homedir, platform } from "node:os";
@@ -95,6 +95,95 @@ function generatePassword() {
95
95
  return randomBytes(18).toString("base64url");
96
96
  }
97
97
 
98
+ /**
99
+ * Ensure the Python virtual environment exists and dependencies are installed.
100
+ *
101
+ * Creates voice-server/.venv if missing, installs requirements.txt, and
102
+ * stores a checksum so subsequent runs skip installation unless deps change.
103
+ *
104
+ * @returns true if the venv is ready, false if Python is unavailable
105
+ */
106
+ function ensurePythonVenv() {
107
+ const voiceServerDir = join(PKG_ROOT, "voice-server");
108
+ const venvDir = join(voiceServerDir, ".venv");
109
+ const venvPython = join(venvDir, "bin", "python");
110
+ const requirementsFile = join(voiceServerDir, "requirements.txt");
111
+ const checksumFile = join(venvDir, ".requirements-checksum");
112
+
113
+ if (!existsSync(requirementsFile)) {
114
+ return true; // No voice-server requirements, nothing to do
115
+ }
116
+
117
+ // Find a working Python 3.12+
118
+ const pythonCandidates = ["python3.12", "python3.13", "python3", "python"];
119
+ let systemPython = null;
120
+ for (const candidate of pythonCandidates) {
121
+ if (commandExists(candidate)) {
122
+ try {
123
+ const version = execSync(`${candidate} --version 2>&1`, { encoding: "utf-8" }).trim();
124
+ const match = version.match(/Python (\d+)\.(\d+)/);
125
+ if (match && (parseInt(match[1]) > 3 || (parseInt(match[1]) === 3 && parseInt(match[2]) >= 12))) {
126
+ systemPython = candidate;
127
+ break;
128
+ }
129
+ } catch { /* skip */ }
130
+ }
131
+ }
132
+
133
+ if (!systemPython) {
134
+ console.log("");
135
+ console.log("WARNING: Python 3.12+ not found. Voice server will not be available.");
136
+ console.log("Install Python 3.12+ and run 'voicecc' again to enable voice features.");
137
+ console.log("");
138
+ return false;
139
+ }
140
+
141
+ // Check if venv needs to be created
142
+ if (!existsSync(venvPython)) {
143
+ console.log("Setting up Python environment for voice server...");
144
+ try {
145
+ execSync(`${systemPython} -m venv ${venvDir}`, { stdio: "inherit" });
146
+ } catch (err) {
147
+ console.log(`Failed to create Python venv: ${err.message}`);
148
+ console.log("Voice server will not be available.");
149
+ return false;
150
+ }
151
+ }
152
+
153
+ // Check if requirements have changed since last install
154
+ const currentChecksum = (() => {
155
+ try {
156
+ const content = readFileSync(requirementsFile, "utf-8");
157
+ return createHash("sha256").update(content).digest("hex");
158
+ } catch { return ""; }
159
+ })();
160
+
161
+ let installedChecksum = "";
162
+ try {
163
+ installedChecksum = readFileSync(checksumFile, "utf-8").trim();
164
+ } catch { /* no checksum file yet */ }
165
+
166
+ if (currentChecksum && currentChecksum === installedChecksum) {
167
+ return true; // Dependencies up to date
168
+ }
169
+
170
+ // Install/update dependencies
171
+ console.log("Installing Python dependencies for voice server...");
172
+ try {
173
+ execSync(`${venvPython} -m pip install -r ${requirementsFile}`, {
174
+ stdio: "inherit",
175
+ cwd: voiceServerDir,
176
+ });
177
+ writeFileSync(checksumFile, currentChecksum);
178
+ console.log("Python dependencies installed.");
179
+ } catch (err) {
180
+ console.log(`Failed to install Python dependencies: ${err.message}`);
181
+ console.log("Voice server may not work correctly.");
182
+ }
183
+
184
+ return true;
185
+ }
186
+
98
187
  /**
99
188
  * Check if the daemon is currently running.
100
189
  *
@@ -600,6 +689,10 @@ if (!existsSync(ENV_PATH)) {
600
689
  await runSetupWizard();
601
690
  }
602
691
 
692
+ // Ensure Python venv and dependencies are set up for the voice server.
693
+ // Runs on every start but skips pip install if requirements.txt hasn't changed.
694
+ ensurePythonVenv();
695
+
603
696
  // If already running, show info and exit
604
697
  if (isRunning()) {
605
698
  showInfo();