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: (key: string) => Promise; set: (key: string, value: unknown) => Promise; delete: (key: string) => Promise; }; http: { fetch: (req: HttpProxyRequest) => Promise; streamStart: (id: string, req: HttpProxyRequest) => Promise; streamAbort: (id: string) => void; onStreamEvent: (cb: (event: HttpStreamEvent) => void) => Unsubscribe; }; system: { metrics: () => Promise; appInfo: () => Promise; }; files: { readLocal: (filePath: string) => Promise; writeShared: (filename: string, content: string, isBase64?: boolean) => Promise<{ path: string; url: string }>; openPath: (filePath: string) => Promise; showInFolder: (filePath: string) => Promise; }; hermes: { onPush: (cb: (event: HermesPushEvent) => void) => Unsubscribe; webhookStatus: () => Promise; webhookRestart: () => Promise; }; hotkeys: { on: (cb: (event: HotkeyEvent) => void) => Unsubscribe; }; voice: { status: () => Promise; listModels: () => Promise; downloadModel: (id: string) => Promise; cancelDownload: (id: string) => Promise; removeModel: (id: string) => Promise; onProgress: (cb: (progress: VoiceDownloadProgress) => void) => Unsubscribe; transcribe: (req: TranscribeRequest) => Promise; synthesize: (req: SynthesizeRequest) => Promise; unload: (id?: string) => Promise; kwsStart: (req: KwsStartRequest) => Promise<{ accepted: string[]; rejected: string[] }>; kwsStop: () => Promise; /** Fire-and-forget 16-bit PCM frames for the keyword spotter. */ kwsAudio: (pcm: Uint8Array, sampleRate: number) => void; onKwsDetected: (cb: (detection: KwsDetection) => void) => Unsubscribe; }; }