export type InitStep = { phase: "server_waiting" } | { phase: "sqlite_waiting" } | { phase: "done" } export type ServerReadyData = { url: string username: string | null password: string | null } export type SqliteMigrationProgress = { type: "InProgress"; value: number } | { type: "Done" } export type WslConfig = { enabled: boolean } export type LinuxDisplayBackend = "wayland" | "auto" export type TitlebarTheme = { mode: "light" | "dark" } export type WindowConfig = { updaterEnabled: boolean } export type ElectronAPI = { killSidecar: () => Promise installCli: () => Promise awaitInitialization: (onStep: (step: InitStep) => void) => Promise getWindowConfig: () => Promise consumeInitialDeepLinks: () => Promise getDefaultServerUrl: () => Promise setDefaultServerUrl: (url: string | null) => Promise getWslConfig: () => Promise setWslConfig: (config: WslConfig) => Promise getDisplayBackend: () => Promise setDisplayBackend: (backend: LinuxDisplayBackend | null) => Promise parseMarkdownCommand: (markdown: string) => Promise checkAppExists: (appName: string) => Promise wslPath: (path: string, mode: "windows" | "linux" | null) => Promise resolveAppPath: (appName: string) => Promise storeGet: (name: string, key: string) => Promise storeSet: (name: string, key: string, value: string) => Promise storeDelete: (name: string, key: string) => Promise storeClear: (name: string) => Promise storeKeys: (name: string) => Promise storeLength: (name: string) => Promise getWindowCount: () => Promise onSqliteMigrationProgress: (cb: (progress: SqliteMigrationProgress) => void) => () => void onMenuCommand: (cb: (id: string) => void) => () => void onDeepLink: (cb: (urls: string[]) => void) => () => void openDirectoryPicker: (opts?: { multiple?: boolean title?: string defaultPath?: string }) => Promise openFilePicker: (opts?: { multiple?: boolean title?: string defaultPath?: string accept?: string[] extensions?: string[] }) => Promise saveFilePicker: (opts?: { title?: string; defaultPath?: string }) => Promise openLink: (url: string) => void openPath: (path: string, app?: string) => Promise readClipboardImage: () => Promise<{ buffer: ArrayBuffer; width: number; height: number } | null> showNotification: (title: string, body?: string) => void getWindowFocused: () => Promise setWindowFocus: () => Promise showWindow: () => Promise relaunch: () => void getZoomFactor: () => Promise setZoomFactor: (factor: number) => Promise setTitlebar: (theme: TitlebarTheme) => Promise loadingWindowComplete: () => void runUpdater: (alertOnFail: boolean) => Promise checkUpdate: () => Promise<{ updateAvailable: boolean; version?: string }> installUpdate: () => Promise setBackgroundColor: (color: string) => Promise }