mirror of
https://github.com/R0m1k3/EveFlow.git
synced 2026-10-11 17:29:03 +02:00
Écoute permanente - Silero VAD dans le worker sherpa-onnx (vad.start/audio/stop) ; le renderer envoie des trames de 128 ms pendant la commande et reçoit le segment WAV complet (speech-start / segment). Repli sur le VAD énergétique si le modèle n'est pas installé ou si l'option est désactivée. - Modèle « silero-vad » (0,6 Mo) dans le catalogue, section « Fin de phrase » dans Modèles locaux, réglage dans Paramètres → Micro. Vision d'écran - IPC system:screen-capture (desktopCapturer, JPEG 1600 px) ; bouton dans la barre de commande ; « regarde mon écran… » joint la capture à la question envoyée à Hermes (transport chat completions pour les images). Actions locales - IPC system:action à liste blanche : verrouiller la session, touches média (volume, mute, lecture, piste), ouvrir une application connue ou une URL http(s), presse-papiers, recherche de fichiers dans les dossiers utilisateur. - Routeur d'intentions FR/EN exécuté avant Hermes (« coupe le son », « ouvre Spotify », « verrouille la session »…), résultat affiché et lu ; désactivable. Correctif - Chat completions : les premiers fragments SSE arrivés avant l'événement de démarrage étaient perdus (premier mot manquant) ; ils sont maintenant rejoués. Tests : 26 tests unitaires (intentions locales ajoutées), e2e Electron sous Xvfb avec les vrais modèles (Silero : un segment par phrase, 6,7 s d'audio traités en 190 ms ; capture 109 ko reçue par Hermes ; intention locale traitée sans Hermes). Claude-Session: https://claude.ai/code/session_017Wn5VX9HNbJ7N54hR24u9Y Co-authored-by: Claude <noreply@anthropic.com>
109 lines
3.9 KiB
TypeScript
109 lines
3.9 KiB
TypeScript
import type {
|
|
AppInfo,
|
|
HermesPushEvent,
|
|
HotkeyEvent,
|
|
HttpProxyRequest,
|
|
HttpProxyResponse,
|
|
HttpStreamEvent,
|
|
HttpStreamStart,
|
|
LogEntry,
|
|
SystemMetrics,
|
|
WebhookStatus,
|
|
WindowMode
|
|
} from './ipc';
|
|
import type {
|
|
KwsDetection,
|
|
KwsStartRequest,
|
|
VadEvent,
|
|
VadStartRequest,
|
|
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;
|
|
};
|
|
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;
|
|
vadStart: (req: VadStartRequest) => Promise<void>;
|
|
vadStop: () => Promise<void>;
|
|
vadAudio: (pcm: Uint8Array, sampleRate: number) => void;
|
|
onVadEvent: (cb: (event: VadEvent) => void) => Unsubscribe;
|
|
};
|
|
system: {
|
|
metrics: () => Promise<SystemMetrics>;
|
|
appInfo: () => Promise<AppInfo>;
|
|
/** Screenshot of the primary display as a JPEG data URL. */
|
|
captureScreen: (maxWidth?: number) => Promise<string>;
|
|
/** Allow-listed local actions (lock session, open app/url, media keys, clipboard). */
|
|
action: (action: SystemAction) => Promise<SystemActionResult>;
|
|
};
|
|
}
|
|
|
|
export type SystemAction =
|
|
| { type: 'lock' }
|
|
| { type: 'open-app'; name: string }
|
|
| { type: 'open-url'; url: string }
|
|
| { type: 'media'; key: 'volume-up' | 'volume-down' | 'mute' | 'play-pause' | 'next' | 'previous' }
|
|
| { type: 'clipboard-read' }
|
|
| { type: 'clipboard-write'; text: string }
|
|
| { type: 'find-files'; query: string };
|
|
|
|
export interface SystemActionResult {
|
|
ok: boolean;
|
|
message?: string;
|
|
data?: unknown;
|
|
}
|