Files
EveFlow/shared/ipc.ts
T
LogiFlowandClaude af8bdc5e9d feat: fin de phrase Silero, vision d'écran et actions locales (v2.3.0) (#13)
É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>
2026-09-03 20:46:26 +02:00

127 lines
3.1 KiB
TypeScript

/**
* Shared IPC contract between the Electron main process and the renderer.
* Imported by both tsconfig projects; must stay free of Node/DOM-specific types.
*/
export type WindowMode = 'hud' | 'compact';
export interface HttpProxyFile {
name: string;
type: string;
data: Uint8Array;
}
export interface HttpProxyRequest {
url: string;
method?: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
headers?: Record<string, string>;
/** JSON/text body. Ignored when `multipart` is provided. */
body?: string;
/** Multipart form upload (used for speech-to-text). */
multipart?: { fields: Record<string, string>; file: HttpProxyFile; fileField?: string };
responseType?: 'text' | 'binary';
timeoutMs?: number;
}
export interface HttpProxyResponse {
ok: boolean;
status: number;
statusText: string;
headers: Record<string, string>;
/** Present when responseType is 'text' (default). */
text?: string;
/** Present when responseType is 'binary'. */
binary?: Uint8Array;
}
export interface HttpStreamStart {
id: string;
ok: boolean;
status: number;
statusText: string;
headers: Record<string, string>;
}
export type HttpStreamEvent =
| { id: string; type: 'chunk'; text: string }
| { id: string; type: 'end' }
| { id: string; type: 'error'; message: string };
export interface SystemMetrics {
hostname: string;
platform: string;
cpuModel: string;
cpuCores: number;
cpuLoad: number; // 0-100
cpuFreqMhz: number;
memUsedPct: number; // 0-100
memTotalGb: number;
uptimeSec: number;
}
export interface HermesPushEvent {
type: 'message' | 'job' | 'raw';
role: 'user' | 'assistant' | 'system';
text: string;
source: string;
images?: string[];
jobName?: string;
status?: string;
receivedAt: string;
raw?: unknown;
}
export interface LogEntry {
ts: string;
level: 'DEBUG' | 'INFO' | 'WARN' | 'ERROR';
tag: string;
message: string;
data?: unknown;
}
export interface WebhookStatus {
listening: boolean;
port: number;
path: string;
secretConfigured: boolean;
error?: string;
}
export interface AppInfo {
version: string;
platform: string;
isPackaged: boolean;
userDataPath: string;
sharedDir: string;
logPath: string;
}
export const IPC = {
windowControl: 'window:control',
windowSetMode: 'window:set-mode',
windowModeChanged: 'window:mode-changed',
windowVisibility: 'window:visibility',
log: 'log:write',
storeGet: 'store:get',
storeSet: 'store:set',
storeDelete: 'store:delete',
httpFetch: 'http:fetch',
httpStreamStart: 'http:stream:start',
httpStreamAbort: 'http:stream:abort',
httpStreamEvent: 'http:stream:event',
metrics: 'system:metrics',
appInfo: 'app:info',
screenCapture: 'system:screen-capture',
systemAction: 'system:action',
readLocalFile: 'files:read-local',
writeSharedFile: 'files:write-shared',
openPath: 'files:open-path',
showInFolder: 'files:show-in-folder',
hermesPush: 'hermes:push',
webhookStatus: 'webhook:status',
webhookRestart: 'webhook:restart',
hotkey: 'hotkey:event'
} as const;
export type HotkeyEvent = 'ptt-toggle' | 'toggle-window' | 'stop-speaking';