import type { CPUCapabilities, GPUCapabilities, BasicGPUInfo, HardwareInfo, PlatformInfo, } from '@/types/hardware'; interface GitHubAsset { name: string; browser_download_url: string; size: number; created_at: string; isUpdate?: boolean; wasCurrentBinary?: boolean; } export interface GitHubRelease { tag_name: string; name: string; published_at: string; body: string; html_url: string; assets: GitHubAsset[]; } export interface UpdateInfo { currentVersion: string; latestVersion: string; releaseInfo: GitHubRelease; hasUpdate: boolean; } interface ReleaseWithStatus { release: GitHubRelease; availableAssets: Array<{ asset: GitHubAsset; isDownloaded: boolean; installedVersion?: string; }>; } export interface InstalledVersion { version: string; path: string; type: 'github' | 'rocm'; filename: string; size?: number; } export interface DownloadItem { name: string; url: string; size: number; version?: string; type: 'asset' | 'rocm'; } export interface KoboldAPI { getInstalledVersion: () => Promise; getInstalledVersions: () => Promise; getCurrentVersion: () => Promise; getCurrentBinaryInfo: () => Promise<{ path: string; filename: string; } | null>; setCurrentVersion: (version: string) => Promise; getVersionFromBinary: (binaryPath: string) => Promise; getLatestRelease: () => Promise; getPlatform: () => Promise; detectGPU: () => Promise; detectCPU: () => Promise; detectGPUCapabilities: () => Promise; detectROCm: () => Promise<{ supported: boolean; devices: string[] }>; detectAllCapabilities: () => Promise; detectBackendSupport: (binaryPath: string) => Promise<{ rocm: boolean; vulkan: boolean; clblast: boolean; noavx2: boolean; failsafe: boolean; cuda: boolean; }>; getAvailableBackends: () => Promise< Array<{ value: string; label: string; devices?: string[] }> >; getCurrentInstallDir: () => Promise; selectInstallDirectory: () => Promise; downloadRelease: ( asset: GitHubAsset ) => Promise<{ success: boolean; path?: string; error?: string }>; downloadROCm: () => Promise<{ success: boolean; path?: string; error?: string; }>; getROCmDownload: () => Promise; checkForUpdates: () => Promise; getLatestReleaseWithStatus: () => Promise; launchKoboldCpp: ( args?: string[], configFilePath?: string ) => Promise<{ success: boolean; pid?: number; error?: string }>; getConfigFiles: () => Promise< Array<{ name: string; path: string; size: number }> >; saveConfigFile: ( configName: string, configData: { gpulayers?: number; contextsize?: number; model_param?: string; port?: number; host?: string; multiuser?: number; multiplayer?: boolean; remotetunnel?: boolean; nocertify?: boolean; websearch?: boolean; noshift?: boolean; flashattention?: boolean; noavx2?: boolean; failsafe?: boolean; usecuda?: boolean; usevulkan?: boolean; useclblast?: boolean; clBlastInfo?: [number, number]; sdmodel?: string; sdt5xxl?: string; sdclipl?: string; sdclipg?: string; sdphotomaker?: string; sdvae?: string; [key: string]: unknown; } ) => Promise; getSelectedConfig: () => Promise; setSelectedConfig: (configName: string) => Promise; parseConfigFile: (filePath: string) => Promise<{ gpulayers?: number; contextsize?: number; model_param?: string; [key: string]: unknown; } | null>; selectModelFile: () => Promise; stopKoboldCpp: () => void; onDownloadProgress: (callback: (progress: number) => void) => void; onUpdateAvailable: (callback: (updateInfo: UpdateInfo) => void) => void; onInstallDirChanged: (callback: (newPath: string) => void) => () => void; onVersionsUpdated: (callback: () => void) => () => void; onKoboldOutput: (callback: (data: string) => void) => () => void; removeAllListeners: (channel: string) => void; } export interface AppAPI { getVersion: () => Promise; openExternal: (url: string) => Promise; } export interface ConfigAPI { get: (key: string) => Promise; set: (key: string, value: unknown) => Promise; } export interface LogsAPI { logError: (message: string, error?: Error) => Promise; } declare global { interface Window { electronAPI: { kobold: KoboldAPI; app: AppAPI; config: ConfigAPI; logs: LogsAPI; }; } }