mirror of
https://github.com/R0m1k3/EveFlow.git
synced 2026-10-23 15:18:13 +02:00
fix: full review pass (main process, voice pipeline, Hermes client, HUD) and e2e-validated local voice (v2.1.0.1)
Electron main - utility-process channel: sherpa output copied into V8 buffers (Electron rejects external buffers), audio exchanged as base64; worker restart on timeout, identity-safe exit handling, deterministic native unload by restart - webhook: loopback by default without secret, UTF-8-safe body assembly, clean restart, port validation - files IPC: realpath-based root check, openPath allow-list (reveal-only outside document folders), Windows reserved names; store: debounced async atomic writes with backup of corrupt files; logger: streaming writes with rotation; log message size cap - HTTP stream proxy: socket released on idle timeout / renderer destroyed, id validation - model manager: inactivity timeout, retrying rm/rename (Windows locks), engine stopped before replacing a model; WAV decoder handles float/24-bit; IPC payload validation - window: opaque rounded window on Windows, navigation lock-down, visibility events; Ctrl+Alt+Escape instead of the Task Manager shortcut; single-instance guard; EVEFLOW_USER_DATA Voice pipeline - abort semantics (SendHandle.aborted), abort before the stream opens, session id prefixes per transport - hands-free re-arm after replies without speech, start/stop race, no chime on auto re-arm, no silence shipped to STT (400 ms pre-roll), no transcription of empty manual stops - TTS: bounded prefetch, cancellable segments, non-interrupting notices, volume applied at play time - SSE CRLF split, usage in chat completions, finish_reason length, phonetic regex hoisted HUD - core renderer: no canvas shadows, cached colours, reusable spectrum buffer, theme read on change, 30 fps idle, stops when the window is hidden; ping flashes on send / tool / speech - deltas coalesced per animation frame; stable auto-scroll; narrow selectors everywhere - bundled fonts (offline), reduce-motion fix, error toasts, ops drawer below 1180 px, interim transcript and first-token latency in the core caption, Ctrl+K, dialog semantics, switch/aria roles, compact widget cleanup, Whisper small recommended for French - docs/ROADMAP.md: audit results, e2e results and the plan towards a real JARVIS Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017Wn5VX9HNbJ7N54hR24u9Y
This commit is contained in:
55 files changed
+1181
-433
No files matched your search
@@ -51,6 +51,7 @@ class VoiceController {
|
||||
private browser = new BrowserRecognizer();
|
||||
private handsFreeTimer: ReturnType<typeof setTimeout> | null = null;
|
||||
private stopping = false;
|
||||
private startSeq = 0;
|
||||
private unsubscribeVoice: (() => void) | null = null;
|
||||
|
||||
init(): void {
|
||||
@@ -61,6 +62,13 @@ class VoiceController {
|
||||
this.scheduleHandsFree(350);
|
||||
}
|
||||
});
|
||||
// Hands-free also re-arms when a reply ends without speech (voice off, empty answer, error).
|
||||
useChat.subscribe((state, prev) => {
|
||||
if (prev.isSending && !state.isSending) {
|
||||
const v = useVoice.getState();
|
||||
if (v.handsFree && v.phase === 'off' && !speech.isSpeaking()) this.scheduleHandsFree(400);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
dispose(): void {
|
||||
@@ -83,6 +91,7 @@ class VoiceController {
|
||||
if (on && !this.isListening && !speech.isSpeaking()) void this.start();
|
||||
if (!on) {
|
||||
this.clearHandsFreeTimer();
|
||||
if (this.isListening) this.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,7 +99,8 @@ class VoiceController {
|
||||
this.clearHandsFreeTimer();
|
||||
this.handsFreeTimer = setTimeout(() => {
|
||||
const v = useVoice.getState();
|
||||
if (v.handsFree && v.phase === 'off' && !useChat.getState().isSending && !speech.isSpeaking()) void this.start();
|
||||
const bargeIn = useSettings.getState().settings.voice.bargeIn;
|
||||
if (v.handsFree && v.phase === 'off' && !useChat.getState().isSending && (bargeIn || !speech.isSpeaking())) void this.start(true);
|
||||
}, delay);
|
||||
}
|
||||
|
||||
@@ -99,14 +109,16 @@ class VoiceController {
|
||||
this.handsFreeTimer = null;
|
||||
}
|
||||
|
||||
async start(): Promise<void> {
|
||||
/** @param auto true when re-armed by the hands-free loop (no chime, patient timeout). */
|
||||
async start(auto = false): Promise<void> {
|
||||
const voice = useVoice.getState();
|
||||
if (voice.phase !== 'off') return;
|
||||
const settings = useSettings.getState().settings.voice;
|
||||
const seq = ++this.startSeq;
|
||||
voice.setError(null);
|
||||
voice.setInterim('');
|
||||
if (!settings.bargeIn) speech.stop();
|
||||
else speech.stop();
|
||||
// Barge-in keeps the assistant talking while the mic opens (echo cancellation handles the overlap).
|
||||
if (!(auto && settings.bargeIn)) speech.stop();
|
||||
useChat.getState().setHud('listening');
|
||||
voice.setPhase('arming');
|
||||
|
||||
@@ -125,18 +137,29 @@ class VoiceController {
|
||||
silenceMs: settings.silenceMs,
|
||||
speechRatio: SENSITIVITY_RATIO[sensitivity],
|
||||
minRms: SENSITIVITY_MIN_RMS[sensitivity],
|
||||
noSpeechTimeoutMs: useVoice.getState().handsFree ? 20_000 : 9_000
|
||||
noSpeechTimeoutMs: useVoice.getState().handsFree ? Number.POSITIVE_INFINITY : 9_000
|
||||
},
|
||||
callbacks: {
|
||||
onLevel: (level) => useVoice.getState().setInputLevel(level),
|
||||
onSpeechStart: () => useVoice.getState().setPhase('speech'),
|
||||
onLevel: (level) => {
|
||||
const q = Math.round(level * 20) / 20;
|
||||
if (q !== useVoice.getState().inputLevel) useVoice.getState().setInputLevel(q);
|
||||
},
|
||||
onSpeechStart: () => {
|
||||
useVoice.getState().setPhase('speech');
|
||||
useChat.getState().ping();
|
||||
},
|
||||
onUtterance: (wav) => void this.transcribe(wav),
|
||||
onEnd: (reason) => this.onCaptureEnd(reason),
|
||||
onError: (message) => useVoice.getState().setError(message)
|
||||
}
|
||||
});
|
||||
if (seq !== this.startSeq || useVoice.getState().phase !== 'arming') {
|
||||
// stop() was called while the microphone was opening.
|
||||
this.capture.cancel();
|
||||
return;
|
||||
}
|
||||
useVoice.getState().setPhase('listening');
|
||||
this.playChime(true);
|
||||
if (!auto) this.playChime(true);
|
||||
} catch (err) {
|
||||
const message = (err as Error).message;
|
||||
useVoice.getState().setError(message);
|
||||
@@ -166,6 +189,7 @@ class VoiceController {
|
||||
|
||||
stop(): void {
|
||||
this.stopping = true;
|
||||
this.startSeq++;
|
||||
this.clearHandsFreeTimer();
|
||||
if (useSettings.getState().settings.voice.provider === 'browser') this.browser.stop();
|
||||
else if (this.capture.isActive) this.capture.stop('stopped');
|
||||
@@ -174,6 +198,7 @@ class VoiceController {
|
||||
}
|
||||
|
||||
cancel(): void {
|
||||
this.startSeq++;
|
||||
this.clearHandsFreeTimer();
|
||||
this.browser.stop();
|
||||
this.capture.cancel();
|
||||
@@ -224,6 +249,7 @@ class VoiceController {
|
||||
this.attentionUntil = 0;
|
||||
if (text.trim()) {
|
||||
await sendMessage(text, [], 'voice');
|
||||
if (useVoice.getState().handsFree && !speech.isSpeaking()) this.scheduleHandsFree(350);
|
||||
} else {
|
||||
voice.setError('Transcription vide.');
|
||||
useChat.getState().setHud('idle');
|
||||
@@ -237,6 +263,7 @@ class VoiceController {
|
||||
useChat.getState().setHud('error');
|
||||
Log.error('voice', `transcription failed: ${message}`);
|
||||
setTimeout(() => useChat.getState().setHud('idle'), 3000);
|
||||
if (useVoice.getState().handsFree) this.scheduleHandsFree(3000);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user