export {} declare global { interface Window { hermesDesktop: { getConnection: () => Promise getBootProgress: () => Promise getConnectionConfig: () => Promise saveConnectionConfig: (payload: DesktopConnectionConfigInput) => Promise applyConnectionConfig: (payload: DesktopConnectionConfigInput) => Promise testConnectionConfig: (payload: DesktopConnectionConfigInput) => Promise api: (request: HermesApiRequest) => Promise notify: (payload: HermesNotification) => Promise requestMicrophoneAccess: () => Promise readFileDataUrl: (filePath: string) => Promise readFileText: (filePath: string) => Promise selectPaths: (options?: HermesSelectPathsOptions) => Promise writeClipboard: (text: string) => Promise saveImageFromUrl: (url: string) => Promise saveImageBuffer: (data: ArrayBuffer | Uint8Array, ext: string) => Promise saveClipboardImage: () => Promise getPathForFile: (file: File) => string normalizePreviewTarget: (target: string, baseDir?: string) => Promise watchPreviewFile: (url: string) => Promise stopPreviewFileWatch: (id: string) => Promise setTitleBarTheme?: (payload: HermesTitleBarTheme) => void setPreviewShortcutActive?: (active: boolean) => void openExternal: (url: string) => Promise fetchLinkTitle: (url: string) => Promise readDir: (path: string) => Promise gitRoot?: (path: string) => Promise terminal: { dispose: (id: string) => Promise onData: (id: string, callback: (payload: string) => void) => () => void onExit: (id: string, callback: (payload: HermesTerminalExit) => void) => () => void resize: (id: string, size: { cols: number; rows: number }) => Promise start: (options?: { cols?: number; cwd?: string; rows?: number }) => Promise write: (id: string, data: string) => Promise } onClosePreviewRequested?: (callback: () => void) => () => void onOpenUpdatesRequested?: (callback: () => void) => () => void onWindowStateChanged?: (callback: (payload: HermesWindowState) => void) => () => void onPreviewFileChanged: (callback: (payload: HermesPreviewFileChanged) => void) => () => void onBackendExit: (callback: (payload: BackendExit) => void) => () => void onBootProgress: (callback: (payload: DesktopBootProgress) => void) => () => void getVersion: () => Promise updates: { check: () => Promise apply: (opts?: DesktopUpdateApplyOptions) => Promise getBranch: () => Promise<{ branch: string }> setBranch: (name: string) => Promise<{ branch: string }> onProgress: (callback: (payload: DesktopUpdateProgress) => void) => () => void } } } } export interface HermesTerminalSession { cwd: string id: string shell: string } export interface HermesTerminalExit { code: number | null signal: string | null } export interface DesktopVersionInfo { appVersion: string electronVersion: string nodeVersion: string platform: string hermesRoot: string } export interface DesktopUpdateCommit { sha: string summary: string author: string at: number } export interface DesktopUpdateStatus { supported: boolean branch?: string currentBranch?: string reason?: string message?: string error?: string behind?: number currentSha?: string targetSha?: string commits?: DesktopUpdateCommit[] dirty?: boolean fetchedAt?: number } export type DesktopUpdateDirtyStrategy = 'abort' | 'stash' | 'force' export interface DesktopUpdateApplyOptions { dirtyStrategy?: DesktopUpdateDirtyStrategy } export interface DesktopUpdateApplyResult { ok: boolean branch?: string error?: string message?: string } export type DesktopUpdateStage = 'idle' | 'prepare' | 'fetch' | 'pull' | 'pydeps' | 'restart' | 'error' export interface DesktopUpdateProgress { stage: DesktopUpdateStage message: string percent: number | null error: string | null at: number } export interface HermesConnection { baseUrl: string isFullscreen: boolean mode?: 'local' | 'remote' nativeOverlayWidth: number source?: 'env' | 'local' | 'settings' token: string wsUrl: string logs: string[] windowButtonPosition: { x: number; y: number } | null } export interface HermesTitleBarTheme { background: string foreground: string } export interface HermesWindowState { isFullscreen: boolean nativeOverlayWidth: number windowButtonPosition: { x: number; y: number } | null } export interface DesktopConnectionConfig { envOverride: boolean mode: 'local' | 'remote' remoteTokenPreview: string | null remoteTokenSet: boolean remoteUrl: string } export interface DesktopConnectionConfigInput { mode: 'local' | 'remote' remoteToken?: string remoteUrl?: string } export interface DesktopConnectionTestResult { baseUrl: string ok: boolean version: string | null } export interface DesktopBootProgress { error: string | null fakeMode: boolean message: string phase: string progress: number running: boolean timestamp: number } export interface HermesApiRequest { path: string method?: string body?: unknown timeoutMs?: number } export interface HermesNotification { title?: string body?: string silent?: boolean } export interface HermesPreviewTarget { binary?: boolean byteSize?: number kind: 'file' | 'url' label: string large?: boolean language?: string mimeType?: string path?: string previewKind?: 'binary' | 'html' | 'image' | 'text' renderMode?: 'preview' | 'source' source: string url: string } export interface HermesReadFileTextResult { binary?: boolean byteSize?: number language?: string mimeType?: string path: string text: string truncated?: boolean } export interface HermesPreviewWatch { id: string path: string } export interface HermesReadDirEntry { name: string path: string isDirectory: boolean } export interface HermesReadDirResult { entries: HermesReadDirEntry[] error?: string } export interface HermesPreviewFileChanged { id: string path: string url: string } export interface HermesSelectPathsOptions { title?: string defaultPath?: string directories?: boolean multiple?: boolean filters?: Array<{ name: string; extensions: string[] }> } export interface BackendExit { code: number | null signal: string | null }