Skip to content

VoiceStudio is the open-source, fully-local ElevenLabs alternative — voice cloning, voice design, video dubbing, dictation, transcription & audiobook creation in 646 languages.

feat(diagnostics): expose the host snapshot over IPC

velixiod557a935aa72
diff --git a/electron/src/main/backend.ts b/electron/src/main/backend.ts
index 2d8901bb1..28f1cade1 100644
--- a/electron/src/main/backend.ts
+++ b/electron/src/main/backend.ts
@@ -10,6 +10,7 @@ import {
stageRuntimeSources,
type RuntimeRegion,
} from './runtime-project';
+import { collectHostSnapshot, type HostSnapshot } from './host-snapshot';
import { runtimeSetupSupported } from './distribution';
import { asciiSafePthFiles } from './pth-ascii';
import { devProbeStamped, writeDevProbeStamp } from './dev-probe-stamp';
@@ -695,6 +696,26 @@ export class BackendSupervisor extends EventEmitter<{
};
}
+ /** Machine and runtime facts for bug reports; works while the backend is down. */
+ async hostSnapshot(): Promise<HostSnapshot> {
+ const project = this.runtimeProject ?? join(storedRuntimeRoot() ?? defaultRuntimeRoot(), 'project');
+ return collectHostSnapshot({
+ runtimeProject: project,
+ runtimePython: runtimePython(project),
+ uv: findUv(),
+ gpu: async () => {
+ const info = (await app.getGPUInfo('basic')) as {
+ gpuDevice?: { vendorId?: number; deviceId?: number; active?: boolean; driverVersion?: string }[];
+ };
+ const devices = info.gpuDevice ?? [];
+ const active = devices.find((device) => device.active) ?? devices[0];
+ return active
+ ? `vendor 0x${(active.vendorId ?? 0).toString(16)} device 0x${(active.deviceId ?? 0).toString(16)}${active.driverVersion ? ` driver ${active.driverVersion}` : ''}`
+ : null;
+ },
+ });
+ }
+
requestHeaders(): Record<string, string> {
const session = this.activeSession();
// Both proxies discard the renderer's Origin. Assert our own identity so
diff --git a/electron/src/main/ipc.ts b/electron/src/main/ipc.ts
index 1cccafa19..bd7e609a2 100644
--- a/electron/src/main/ipc.ts
+++ b/electron/src/main/ipc.ts
@@ -60,6 +60,7 @@ export const CHANNELS = {
backendChooseRuntimeLocation: 'backend:chooseRuntimeLocation',
backendUseDefaultRuntimeLocation: 'backend:useDefaultRuntimeLocation',
backendGetConnection: 'backend:getConnection',
+ backendHostSnapshot: 'backend:hostSnapshot',
backendTestRemote: 'backend:testRemote',
backendUseRemote: 'backend:useRemote',
backendUseLocal: 'backend:useLocal',
@@ -354,6 +355,7 @@ export function registerIpc(
return supervisor.acknowledgeLastCrash();
});
ipcMain.handle(CHANNELS.backendGetConnection, () => supervisor.connection);
+ ipcMain.handle(CHANNELS.backendHostSnapshot, () => supervisor.hostSnapshot());
ipcMain.handle(CHANNELS.backendTestRemote, async (event, raw: unknown) => {
const owner = getMainWindow();
assertTrustedMainFrame(event, owner);
diff --git a/electron/src/preload/index.d.ts b/electron/src/preload/index.d.ts
index e2d41756a..55485e055 100644
--- a/electron/src/preload/index.d.ts
+++ b/electron/src/preload/index.d.ts
@@ -1,3 +1,4 @@
+import type { HostSnapshotLike } from '../shared/utils/hostSnapshot';
/**
* The contextBridge surface exposed to the renderer as `window.voicestudio`.
*
@@ -399,6 +400,7 @@ export interface VoiceStudioBridge {
chooseRuntimeLocation(title: string): Promise<RuntimeLocation | null>;
useDefaultRuntimeLocation(): Promise<RuntimeLocation>;
getConnection(): Promise<BackendConnection>;
+ getHostSnapshot(): Promise<HostSnapshotLike>;
testRemote(input: { url: string; apiKey: string }): Promise<RemoteBackendProbe>;
useRemote(input: { url: string; apiKey: string }): Promise<RemoteBackendProbe>;
useLocal(): Promise<BackendConnection>;
diff --git a/electron/src/preload/index.ts b/electron/src/preload/index.ts
index aebd876e4..0a8a66fd4 100644
--- a/electron/src/preload/index.ts
+++ b/electron/src/preload/index.ts
@@ -103,6 +103,7 @@ const bridge: VoiceStudioBridge = {
useDefaultRuntimeLocation: () => ipcRenderer.invoke('backend:useDefaultRuntimeLocation'),
restart: () => ipcRenderer.invoke('backend:restart') as Promise<void>,
getConnection: () => ipcRenderer.invoke('backend:getConnection'),
+ getHostSnapshot: () => ipcRenderer.invoke('backend:hostSnapshot'),
testRemote: (input) => ipcRenderer.invoke('backend:testRemote', input),
useRemote: (input) => ipcRenderer.invoke('backend:useRemote', input),
useLocal: () => ipcRenderer.invoke('backend:useLocal'),