import { contextBridge, ipcRenderer } from "electron"; import { CH, type Entry, type Envelope, type FileRead, type SaveResult, } from "../shared/ipc"; const api = { tree: (): Promise> => ipcRenderer.invoke(CH.tree) as Promise>, read: (path: string): Promise> => ipcRenderer.invoke(CH.read, { path }) as Promise>, save: (path: string, content: string): Promise> => ipcRenderer.invoke(CH.save, { path, content }) as Promise< Envelope >, reset: (): Promise> => ipcRenderer.invoke(CH.reset) as Promise>, }; contextBridge.exposeInMainWorld("api", api);