import { contextBridge, ipcRenderer } from 'electron' export interface AuditorAPI { drives: () => Promise listDir: (dirPath: string, opts?: { maxEntries?: number }) => Promise folderSize: (dirPath: string) => Promise largeFiles: (rootPath: string, minBytes: number, maxResults: number) => Promise processes: () => Promise services: () => Promise installed: () => Promise system: () => Promise network: () => Promise env: (keys?: string[]) => Promise startup: () => Promise temp: () => Promise tasks: () => Promise features: () => Promise openExplorer: (p: string) => Promise killProcess: (pid: number) => Promise openExternal: (url: string) => Promise clipboardWriteText: (text: string) => Promise notesGetAll: () => Promise> notesSet: (key: string, value: string) => Promise> notesDelete: (key: string) => Promise> } const api: AuditorAPI = { drives: () => ipcRenderer.invoke('audit:drives'), listDir: (dirPath, opts) => ipcRenderer.invoke('audit:listDir', dirPath, opts), folderSize: (dirPath) => ipcRenderer.invoke('audit:folderSize', dirPath), largeFiles: (rootPath, minBytes, maxResults) => ipcRenderer.invoke('audit:largeFiles', rootPath, minBytes, maxResults), processes: () => ipcRenderer.invoke('audit:processes'), services: () => ipcRenderer.invoke('audit:services'), installed: () => ipcRenderer.invoke('audit:installed'), system: () => ipcRenderer.invoke('audit:system'), network: () => ipcRenderer.invoke('audit:network'), env: (keys) => ipcRenderer.invoke('audit:env', keys), startup: () => ipcRenderer.invoke('audit:startup'), temp: () => ipcRenderer.invoke('audit:temp'), tasks: () => ipcRenderer.invoke('audit:tasks'), features: () => ipcRenderer.invoke('audit:features'), openExplorer: (p) => ipcRenderer.invoke('audit:openExplorer', p), killProcess: (pid) => ipcRenderer.invoke('audit:killProcess', pid), openExternal: (url) => ipcRenderer.invoke('audit:openExternal', url), clipboardWriteText: (text) => ipcRenderer.invoke('clipboard:writeText', text), notesGetAll: () => ipcRenderer.invoke('notes:getAll'), notesSet: (key, value) => ipcRenderer.invoke('notes:set', key, value), notesDelete: (key) => ipcRenderer.invoke('notes:delete', key), } contextBridge.exposeInMainWorld('auditor', api)