// Renderer contract for the Tauri native bridge. export interface DesktopApiContract { takePendingSshLinks: () => Promise appRuntimeInfo: () => Promise<{ appVersion: string os: string arch: string nativeBackend: string sshBackend: string dataPath: string credentialPath: string }> // SSH sshConnect: ( config: import('../shared/types/ipc.types').SSHConnectRequest ) => Promise sshDisconnect: (connectionId: string) => Promise<{ success: boolean; error?: string }> sshExec: ( connectionId: string, command: string ) => Promise<{ success: boolean; result?: string; exitCode?: number; error?: string }> sshKeepalive: (connectionId: string) => Promise<{ success: boolean; error?: string }> sshCreateShell: ( connectionId: string, options?: import('../shared/types/ipc.types').SSHCreateShellRequest, shellId?: string ) => Promise<{ success: boolean; shellId?: string; error?: string }> sshShellWrite: (shellId: string, data: string | Uint8Array) => Promise<{ success: boolean; error?: string }> sshShellResize: (shellId: string, cols: number, rows: number) => Promise<{ success: boolean; error?: string }> sshCloseShell: (shellId: string) => Promise<{ success: boolean; error?: string }> // Local terminal (host shell) localListShells: () => Promise<{ success: boolean shells?: Array<{ path: string; name: string; kind: string; isDefault: boolean }> error?: string }> localCreateShell: ( options?: { cols?: number; rows?: number; cwd?: string; shell?: string }, shellId?: string ) => Promise<{ success: boolean shellId?: string shellPath?: string shellName?: string error?: string }> localWrite: (shellId: string, data: string | Uint8Array) => Promise<{ success: boolean; error?: string }> localResize: (shellId: string, cols: number, rows: number) => Promise<{ success: boolean; error?: string }> localKill: (shellId: string) => Promise<{ success: boolean; error?: string }> onLocalData: (callback: (event: unknown, connectionId: string, shellId: string, data: Uint8Array) => void) => void sshForwardLocal: ( connectionId: string, localPort: number, remoteHost: string, remotePort: number, forwardId?: string ) => Promise sshForwardRemote: ( connectionId: string, remotePort: number, localHost: string, localPort: number, forwardId?: string ) => Promise sshForwardDynamic: ( connectionId: string, localPort: number, forwardId?: string ) => Promise sshForwardStop: (forwardId: string) => Promise<{ success: boolean; error?: string }> sshForwardList: (connectionId?: string) => Promise // Sessions sessionGetAll: () => Promise<{ success: boolean sessions?: import('../shared/types/session.types').Session[] error?: string }> sessionGetById: ( id: string ) => Promise<{ success: boolean; session?: import('../shared/types/session.types').Session; error?: string }> sessionCreate: ( session: Omit ) => Promise sessionUpdate: ( id: string, updates: Partial ) => Promise sessionDelete: (id: string) => Promise<{ success: boolean; error?: string }> // SFTP sftpConnect: (connectionId: string) => Promise<{ success: boolean; sftpId?: string; error?: string }> sftpListDirectory: (sftpId: string, path: string) => Promise<{ success: boolean; files?: unknown[]; error?: string }> sftpUpload: (sftpId: string, localPath: string, remotePath: string) => Promise<{ success: boolean; error?: string }> sftpDownload: (sftpId: string, remotePath: string, localPath: string) => Promise<{ success: boolean; error?: string }> sftpRename: (sftpId: string, oldPath: string, newPath: string) => Promise<{ success: boolean; error?: string }> sftpDelete: (sftpId: string, path: string, isDirectory: boolean) => Promise<{ success: boolean; error?: string }> sftpMkdir: (sftpId: string, path: string) => Promise<{ success: boolean; error?: string }> sftpStat: (sftpId: string, filePath: string) => Promise<{ success: boolean; stats?: unknown; error?: string }> sftpChmod: (sftpId: string, filePath: string, mode: number) => Promise<{ success: boolean; error?: string }> sftpReadText: ( sftpId: string, remotePath: string ) => Promise<{ success: boolean; content?: string; size?: number; encoding?: string; error?: string }> sftpWriteText: (sftpId: string, remotePath: string, content: string) => Promise<{ success: boolean; error?: string }> // Settings settingsGet: (key: string) => Promise<{ success: boolean; value?: unknown; error?: string }> settingsSet: (key: string, value: unknown) => Promise<{ success: boolean; error?: string }> // Terminal AI (API keys stay in the Rust encrypted secret store) aiProviderSaveKey: (providerId: string, apiKey: string) => Promise<{ success: boolean; error?: string }> aiProviderHasKey: (providerId: string) => Promise aiProviderDeleteKey: (providerId: string) => Promise<{ success: boolean; error?: string }> aiListModels: ( provider: import('../shared/types/ai.types').AiProviderConfig ) => Promise aiComplete: ( request: import('../shared/types/ai.types').AiCompleteRequest ) => Promise aiTestProvider: ( request: import('../shared/types/ai.types').AiProviderTestRequest ) => Promise aiCatalogFetch: () => Promise // Dialogs showSaveDialog: ( options: import('../shared/types/ipc.types').DialogOptions ) => Promise showOpenDialog: ( options: import('../shared/types/ipc.types').DialogOptions ) => Promise // File operations readFile: (filePath: string) => Promise<{ success: boolean; data?: string; error?: string }> writeFile: (filePath: string, data: string) => Promise<{ success: boolean; error?: string }> // Local filesystem getHomePath: () => Promise<{ success: boolean; path?: string; error?: string }> getDownloadsPath: () => Promise localReadDir: (dirPath: string) => Promise localGetStats: (filePath: string) => Promise localDelete: (filePath: string) => Promise localRename: (oldPath: string, newPath: string) => Promise localMkdir: (dirPath: string) => Promise // App getVersion: () => Promise openExternal: (url: string) => Promise clipboardReadText: () => Promise clipboardWriteText: (text: string) => Promise // Window toggleMaximize: () => Promise // Events onMenuNewSession: (callback: () => void) => void onMenuQuickConnect: (callback: () => void) => void onMenuLocalTerminal: (callback: () => void) => void onMenuImportSessions: (callback: () => void) => void onMenuExportSessions: (callback: () => void) => void onMenuOpenSettings: (callback: () => void) => void onSshLinkAvailable: (callback: () => void) => void onShellData: (callback: (event: unknown, connectionId: string, shellId: string, data: Uint8Array) => void) => void onShellClosed: ( callback: ( event: unknown, connectionId: string, shellId: string, details: { reason: string; idleTimeout: boolean } ) => void ) => void onConnectionClosed: (callback: (event: unknown, connectionId: string, reason: string) => void) => void onHostKeyPrompt: ( callback: ( event: unknown, payload: { requestId: string host: string port: number keyType: string fingerprint: string isChanged: boolean previousFingerprint?: string } ) => void ) => void respondHostKeyPrompt: (requestId: string, decision: 'accept-once' | 'accept-always' | 'reject') => void knownHostsList: () => Promise<{ success: boolean entries?: import('../shared/types/known-hosts.types').KnownHostEntry[] error?: string }> knownHostsRemove: (host: string, port: number) => Promise<{ success: boolean; error?: string }> knownHostsClear: () => Promise<{ success: boolean; error?: string }> onSFTPProgress: ( callback: ( event: unknown, sftpId: string, progress: { transferred: number; total: number; percentage: number } ) => void ) => void removeListener: (channel: string, callback: (...args: unknown[]) => void) => void removeAllListeners: (channel: string) => void } declare global { interface Window { opsxApi: DesktopApiContract } }