voicecc 1.2.0 → 1.2.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.
- package/bin/voicecc.js +57 -10
- package/dashboard/routes/webrtc.ts +2 -11
- package/package.json +1 -1
package/bin/voicecc.js
CHANGED
|
@@ -131,11 +131,52 @@ function ensurePythonVenv() {
|
|
|
131
131
|
}
|
|
132
132
|
|
|
133
133
|
if (!systemPython) {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
134
|
+
// Attempt to install Python 3.12 automatically on Linux
|
|
135
|
+
if (process.platform === "linux") {
|
|
136
|
+
console.log("Python 3.12+ not found. Installing automatically...");
|
|
137
|
+
try {
|
|
138
|
+
if (commandExists("apt-get")) {
|
|
139
|
+
execSync("apt-get update -qq && apt-get install -y -qq python3.12 python3.12-venv python3.12-dev 2>&1", { stdio: "inherit" });
|
|
140
|
+
} else if (commandExists("dnf")) {
|
|
141
|
+
execSync("dnf install -y python3.12 2>&1", { stdio: "inherit" });
|
|
142
|
+
} else if (commandExists("yum")) {
|
|
143
|
+
execSync("yum install -y python3.12 2>&1", { stdio: "inherit" });
|
|
144
|
+
} else {
|
|
145
|
+
console.error("No supported package manager found (apt-get, dnf, yum).");
|
|
146
|
+
console.error("Install Python 3.12+ manually and run 'voicecc' again.");
|
|
147
|
+
process.exit(1);
|
|
148
|
+
}
|
|
149
|
+
// Re-check for Python after installation
|
|
150
|
+
for (const candidate of pythonCandidates) {
|
|
151
|
+
if (commandExists(candidate)) {
|
|
152
|
+
try {
|
|
153
|
+
const version = execSync(`${candidate} --version 2>&1`, { encoding: "utf-8" }).trim();
|
|
154
|
+
const match = version.match(/Python (\d+)\.(\d+)/);
|
|
155
|
+
if (match && (parseInt(match[1]) > 3 || (parseInt(match[1]) === 3 && parseInt(match[2]) >= 12))) {
|
|
156
|
+
systemPython = candidate;
|
|
157
|
+
console.log(`Python installed successfully: ${version}`);
|
|
158
|
+
break;
|
|
159
|
+
}
|
|
160
|
+
} catch { /* skip */ }
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
if (!systemPython) {
|
|
164
|
+
console.error("Python installation completed but Python 3.12+ still not found.");
|
|
165
|
+
console.error("Install Python 3.12+ manually and run 'voicecc' again.");
|
|
166
|
+
process.exit(1);
|
|
167
|
+
}
|
|
168
|
+
} catch (err) {
|
|
169
|
+
console.error(`Failed to install Python 3.12: ${err.message}`);
|
|
170
|
+
console.error("Install Python 3.12+ manually and run 'voicecc' again.");
|
|
171
|
+
process.exit(1);
|
|
172
|
+
}
|
|
173
|
+
} else {
|
|
174
|
+
console.error("");
|
|
175
|
+
console.error("ERROR: Python 3.12+ is required but not found.");
|
|
176
|
+
console.error("Install Python 3.12+ and run 'voicecc' again.");
|
|
177
|
+
console.error("");
|
|
178
|
+
process.exit(1);
|
|
179
|
+
}
|
|
139
180
|
}
|
|
140
181
|
|
|
141
182
|
// Check if venv needs to be created
|
|
@@ -144,9 +185,8 @@ function ensurePythonVenv() {
|
|
|
144
185
|
try {
|
|
145
186
|
execSync(`${systemPython} -m venv ${venvDir}`, { stdio: "inherit" });
|
|
146
187
|
} catch (err) {
|
|
147
|
-
console.
|
|
148
|
-
|
|
149
|
-
return false;
|
|
188
|
+
console.error(`Failed to create Python venv: ${err.message}`);
|
|
189
|
+
process.exit(1);
|
|
150
190
|
}
|
|
151
191
|
}
|
|
152
192
|
|
|
@@ -177,8 +217,8 @@ function ensurePythonVenv() {
|
|
|
177
217
|
writeFileSync(checksumFile, currentChecksum);
|
|
178
218
|
console.log("Python dependencies installed.");
|
|
179
219
|
} catch (err) {
|
|
180
|
-
console.
|
|
181
|
-
|
|
220
|
+
console.error(`Failed to install Python dependencies: ${err.message}`);
|
|
221
|
+
process.exit(1);
|
|
182
222
|
}
|
|
183
223
|
|
|
184
224
|
return true;
|
|
@@ -689,6 +729,13 @@ if (!existsSync(ENV_PATH)) {
|
|
|
689
729
|
await runSetupWizard();
|
|
690
730
|
}
|
|
691
731
|
|
|
732
|
+
// Verify Claude CLI is available
|
|
733
|
+
if (!commandExists("claude")) {
|
|
734
|
+
console.error("ERROR: Claude Code CLI ('claude') is not installed.");
|
|
735
|
+
console.error("Install it with: npm install -g @anthropic-ai/claude-code");
|
|
736
|
+
process.exit(1);
|
|
737
|
+
}
|
|
738
|
+
|
|
692
739
|
// Ensure Python venv and dependencies are set up for the voice server.
|
|
693
740
|
// Runs on every start but skips pip install if requirements.txt hasn't changed.
|
|
694
741
|
ensurePythonVenv();
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* WebRTC device pairing API routes.
|
|
3
3
|
*
|
|
4
4
|
* Handles pairing code generation and device token validation:
|
|
5
|
-
* - POST /generate-code --
|
|
5
|
+
* - POST /generate-code -- create a 6-digit pairing code
|
|
6
6
|
* - POST /pair -- validate a code and issue a device token
|
|
7
7
|
* - GET /validate -- check if a device token is valid
|
|
8
8
|
*/
|
|
@@ -27,17 +27,8 @@ import {
|
|
|
27
27
|
export function webrtcRoutes(): Hono {
|
|
28
28
|
const app = new Hono();
|
|
29
29
|
|
|
30
|
-
/** Generate a pairing code
|
|
30
|
+
/** Generate a pairing code */
|
|
31
31
|
app.post("/generate-code", (c) => {
|
|
32
|
-
const remoteAddr = c.req.header("x-forwarded-for") ?? "";
|
|
33
|
-
const isLocalhost = remoteAddr === "127.0.0.1" || remoteAddr === "::1" || remoteAddr === "::ffff:127.0.0.1" || remoteAddr === "";
|
|
34
|
-
console.log(`[webrtc] generate-code from ${remoteAddr || "(empty)"}, isLocalhost=${isLocalhost}`);
|
|
35
|
-
|
|
36
|
-
if (!isLocalhost) {
|
|
37
|
-
console.log("[webrtc] generate-code REJECTED: not localhost");
|
|
38
|
-
return c.json({ error: "Pairing codes can only be generated from localhost" }, 403);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
32
|
const result = generatePairingCode();
|
|
42
33
|
console.log("[webrtc] generate-code OK, code:", result.code);
|
|
43
34
|
return c.json(result);
|
package/package.json
CHANGED