import type { AppInfo, HermesPushEvent, HotkeyEvent, HttpProxyRequest, HttpProxyResponse, HttpStreamEvent, HttpStreamStart, LogEntry, SystemMetrics, WebhookStatus, WindowMode } from './ipc'; import type { McpToolRequest, McpToolResponse } from './ipc'; import type { EdgeSynthesizeRequest, EdgeSynthesizeResult, EdgeVoice, 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: (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; }; 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; /** Tool calls from Hermes via the local MCP endpoint that need the renderer. */ onToolRequest: (cb: (req: McpToolRequest) => void) => Unsubscribe; toolResponse: (res: McpToolResponse) => void; 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; /** Microsoft Edge neural voices (online, free): MP3 for one sentence. */ edgeSynthesize: (req: EdgeSynthesizeRequest) => Promise; edgeVoices: () => 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; vadStart: (req: VadStartRequest) => Promise; vadStop: () => Promise; vadAudio: (pcm: Uint8Array, sampleRate: number) => void; onVadEvent: (cb: (event: VadEvent) => void) => Unsubscribe; }; system: { metrics: () => Promise; appInfo: () => Promise; /** Screenshot of the primary display as a JPEG data URL. */ captureScreen: (maxWidth?: number) => Promise; /** Allow-listed local actions (lock session, open app/url, media keys, clipboard). */ action: (action: SystemAction) => Promise; }; } 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; }