mirror of
https://github.com/R0m1k3/EveFlow.git
synced 2026-10-11 17:29:03 +02:00
- Catalog: 3.3 MB zipformer keyword-spotting model (kws-en). - shared/keywords: BPE encoding of wake phrases (SentencePiece table for common words, greedy longest-match fallback over the model vocabulary) and keywords file builder. - Worker: KeywordSpotter stream fed with 16-bit PCM, detections pushed as unsolicited messages; engine derives the keywords file, maps sensitivity to threshold/score, forwards detections to the renderer and re-arms after a worker restart. - Renderer: WakeListener keeps one microphone stream, batches 256 ms frames to the spotter and captures the command on the same stream after detection (pre-roll, VAD), then resumes spotting; the wake word also interrupts speech. Settings: wake mode (off / always-on / transcript filter), keyword, sensitivity, status and one-click model download; HUD caption shows the active keyword. - Validated: detection in the worker (fork) and through the real Electron IPC path on Kokoro audio, no false positive on an English recording; 23 unit tests. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017Wn5VX9HNbJ7N54hR24u9Y
84 lines
2.9 KiB
TypeScript
84 lines
2.9 KiB
TypeScript
import type {
|
|
AppInfo,
|
|
HermesPushEvent,
|
|
HotkeyEvent,
|
|
HttpProxyRequest,
|
|
HttpProxyResponse,
|
|
HttpStreamEvent,
|
|
HttpStreamStart,
|
|
LogEntry,
|
|
SystemMetrics,
|
|
WebhookStatus,
|
|
WindowMode
|
|
} from './ipc';
|
|
import type {
|
|
KwsDetection,
|
|
KwsStartRequest,
|
|
SynthesizeRequest,
|
|
SynthesizeResult,
|
|
TranscribeRequest,
|
|
TranscribeResult,
|
|
VoiceDownloadProgress,
|
|
VoiceEngineStatus,
|
|
VoiceModelStatus
|
|
} from './voice';
|
|
|
|
export type Unsubscribe = () => void;
|
|
|
|
/** The API exposed on `window.eveflow` by the preload script. */
|
|
export interface EveFlowBridge {
|
|
window: {
|
|
control: (action: 'minimize' | 'maximize' | 'close' | 'hide') => void;
|
|
setMode: (mode: WindowMode) => void;
|
|
onModeChanged: (cb: (mode: WindowMode) => void) => Unsubscribe;
|
|
/** Fires when the window is shown/hidden/minimised (the Page Visibility API is disabled by backgroundThrottling:false). */
|
|
onVisibility: (cb: (visible: boolean) => void) => Unsubscribe;
|
|
};
|
|
log: (entry: LogEntry) => void;
|
|
store: {
|
|
get: <T = unknown>(key: string) => Promise<T | null>;
|
|
set: (key: string, value: unknown) => Promise<boolean>;
|
|
delete: (key: string) => Promise<boolean>;
|
|
};
|
|
http: {
|
|
fetch: (req: HttpProxyRequest) => Promise<HttpProxyResponse>;
|
|
streamStart: (id: string, req: HttpProxyRequest) => Promise<HttpStreamStart>;
|
|
streamAbort: (id: string) => void;
|
|
onStreamEvent: (cb: (event: HttpStreamEvent) => void) => Unsubscribe;
|
|
};
|
|
system: {
|
|
metrics: () => Promise<SystemMetrics>;
|
|
appInfo: () => Promise<AppInfo>;
|
|
};
|
|
files: {
|
|
readLocal: (filePath: string) => Promise<string>;
|
|
writeShared: (filename: string, content: string, isBase64?: boolean) => Promise<{ path: string; url: string }>;
|
|
openPath: (filePath: string) => Promise<boolean>;
|
|
showInFolder: (filePath: string) => Promise<boolean>;
|
|
};
|
|
hermes: {
|
|
onPush: (cb: (event: HermesPushEvent) => void) => Unsubscribe;
|
|
webhookStatus: () => Promise<WebhookStatus>;
|
|
webhookRestart: () => Promise<WebhookStatus>;
|
|
};
|
|
hotkeys: {
|
|
on: (cb: (event: HotkeyEvent) => void) => Unsubscribe;
|
|
};
|
|
voice: {
|
|
status: () => Promise<VoiceEngineStatus>;
|
|
listModels: () => Promise<VoiceModelStatus[]>;
|
|
downloadModel: (id: string) => Promise<VoiceModelStatus>;
|
|
cancelDownload: (id: string) => Promise<boolean>;
|
|
removeModel: (id: string) => Promise<VoiceModelStatus[]>;
|
|
onProgress: (cb: (progress: VoiceDownloadProgress) => void) => Unsubscribe;
|
|
transcribe: (req: TranscribeRequest) => Promise<TranscribeResult>;
|
|
synthesize: (req: SynthesizeRequest) => Promise<SynthesizeResult>;
|
|
unload: (id?: string) => Promise<unknown>;
|
|
kwsStart: (req: KwsStartRequest) => Promise<{ accepted: string[]; rejected: string[] }>;
|
|
kwsStop: () => Promise<void>;
|
|
/** Fire-and-forget 16-bit PCM frames for the keyword spotter. */
|
|
kwsAudio: (pcm: Uint8Array, sampleRate: number) => void;
|
|
onKwsDetected: (cb: (detection: KwsDetection) => void) => Unsubscribe;
|
|
};
|
|
}
|