/** Enumerates IPC channels shared between renderer and main. */ export const IPC_CHANNELS = { settingsGet: 'settings:get', settingsSetLibrary: 'settings:set-library', dialogSelectLibrary: 'dialog:select-library', dialogSelectImportFolder: 'dialog:select-import-folder', systemListDrives: 'system:list-drives', libraryScan: 'library:scan', libraryList: 'library:list', libraryGetById: 'library:get-by-id', libraryDuplicates: 'library:duplicates', libraryRename: 'library:rename', libraryMove: 'library:move', libraryOrganize: 'library:organize', libraryCustomName: 'library:custom-name', libraryOpenFolder: 'library:open-folder', libraryDelete: 'library:delete', librarySplit: 'library:split', libraryBuffer: 'library:buffer', libraryMetadata: 'library:metadata', libraryMetadataSuggestions: 'library:metadata-suggestions', libraryUpdateMetadata: 'library:update-metadata', libraryWaveformPreview: 'library:waveform-preview', libraryWaveformRange: 'library:waveform-range', libraryImport: 'library:import', tagsUpdate: 'tags:update', categoriesList: 'categories:list', searchQuery: 'search:query' } as const; export type IpcChannelKeys = keyof typeof IPC_CHANNELS; /** * API surface exposed to the renderer through the preload script. */ export interface RendererApi { /** Retrieves the persisted settings object. */ getSettings(): Promise; /** Opens a dialog to select a new library path, returning the chosen directory or null. */ selectLibraryDirectory(): Promise; /** Persists the given library path. */ setLibraryPath(path: string): Promise; /** Triggers a manual rescan of the library. */ rescanLibrary(): Promise; /** Opens a dialog to pick a folder to import audio from. */ selectImportFolder(): Promise; /** Lists available system drives for drive-level imports. */ listSystemDrives(): Promise; /** Fetches the current list of audio files. */ listAudioFiles(): Promise; /** Imports external audio files into the library. */ importExternalSources(paths: string[]): Promise; /** Retrieves a single audio file summary by id, or null if it cannot be resolved. */ getAudioFileById(fileId: number): Promise; /** Fetches groups of duplicate files based on checksum. */ listDuplicates(): Promise<{ checksum: string; files: import('./models').AudioFileSummary[] }[]>; /** Requests a rename for the target file. */ renameFile(fileId: number, newFileName: string): Promise; /** Moves a file to another subdirectory under the library root. */ moveFile(fileId: number, targetRelativeDirectory: string): Promise; /** Automatically organizes a file based on its categories. */ organizeFile( fileId: number, metadata: { customName?: string | null; author?: string | null; copyright?: string | null; rating?: number } ): Promise; /** Updates the custom name for a file. */ updateCustomName(fileId: number, customName: string | null): Promise; /** Opens the file's containing folder in the system file explorer. */ openFileFolder(fileId: number): Promise; /** Deletes files from disk and database. */ deleteFiles(fileIds: number[]): Promise; /** Splits an audio file into segment files. */ splitFile(fileId: number, segments: import('./models').SplitSegmentRequest[]): Promise; /** Fetches the binary data required for playback. */ getAudioBuffer(fileId: number): Promise; /** Returns a lightweight waveform preview for rendering list backgrounds. */ getWaveformPreview(fileId: number, pointCount?: number): Promise<{ samples: number[]; rms: number }>; /** Returns full-resolution waveform samples for a specific time range (for zoomed editor). */ getWaveformRange(fileId: number, startMs: number, endMs: number): Promise<{ samples: number[] }>; /** Updates UCS categories for a file (free-form tags are preserved unless explicitly provided). */ updateTagging(payload: import('./models').TagUpdatePayload): Promise; /** Returns the catalog of UCS categories. */ listCategories(): Promise; /** Runs fuzzy search returning ranked results. */ search(query: string): Promise; /** Reads embedded metadata from a WAV file. */ readFileMetadata(fileId: number): Promise<{ author?: string; copyright?: string; title?: string; rating?: number }>; /** Lists distinct metadata values gathered from the library for quick suggestions. */ listMetadataSuggestions(): Promise<{ authors: string[]; copyrights: string[] }>; /** Updates metadata (author, copyright, rating) without organizing the file. */ updateFileMetadata( fileId: number, metadata: { author?: string | null; copyright?: string | null; rating?: number } ): Promise; /** Listens for menu actions from the main process. Returns a cleanup function. */ onMenuAction(channel: string, callback: (payload?: unknown) => void): () => void; } declare global { interface Window { /** Bridge API injected by the preload script. */ api: RendererApi; } }