import type { ActionId, Bookmark, BookMeta, BookOpenResult, Chapter, CreateBookParams, GlobalSettings, InspirationEntry, AiContextBinding, AiContextBuildResult, AiConfig, AiMessage, AiSession, NamingConflict, AiStreamChunkEvent, AiNetworkStatusEvent, InteractiveFlow, InteractiveGateResult, InteractiveStreamChunkEvent, AutoRhythm, AutoWritingConfig, PlotOption, PlotSelection, IpcResult, LandmarkType, OutlineItem, OutlineStatus, SearchResult, SettingEntry, SettingType, Snapshot, SnapshotType, UpdateChapterParams, UpdateBookMetaParams, ChapterTag, Volume, WordFreqResult, KnowledgeEntry, KnowledgeSuggestOptions, ScoredKnowledge, CreateKnowledgeInput, KnowledgeStatus, KnowledgeType, CockpitSummary, ChapterBridgeResult, PublishStatus, WritingStats, KnowledgeExtractionResult, PomodoroState, GoalNotificationPayload, KnowledgeInjectionLog, WritingAchievement, PomodoroDuration, CharacterGraphData, CharacterRelationship, WritingAnalyticsSummary, ImportPreviewResult, ImportExecuteParams, ImportSplitMode } from './types' import type { PackImportStrategy, PackImportReport, PackProgressEvent } from './novel-pack' export interface ElectronAPI { window: { minimize: () => Promise maximize: () => Promise close: () => Promise } settings: { get: () => Promise> update: (partial: Partial) => Promise> } book: { list: () => Promise> create: (params: CreateBookParams) => Promise> delete: (bookId: string) => Promise> open: (bookId: string) => Promise> updateMeta: (bookId: string, patch: UpdateBookMetaParams) => Promise> pickCover: (bookId: string) => Promise> } bookPrefs: { get: (bookId: string, key: string) => Promise> set: (bookId: string, key: string, value: string) => Promise> } volume: { create: (bookId: string, name: string) => Promise> update: ( bookId: string, volumeId: string, patch: { name?: string; description?: string } ) => Promise> delete: (bookId: string, volumeId: string) => Promise> } chapter: { create: (bookId: string, volumeId: string, title: string) => Promise> get: (bookId: string, chapterId: string) => Promise> update: (params: UpdateChapterParams) => Promise> delete: (bookId: string, chapterId: string) => Promise> reorder: (bookId: string, volumeId: string, orderedIds: string[]) => Promise> moveToVolume: ( bookId: string, chapterId: string, targetVolumeId: string, targetIndex: number ) => Promise> setPublishStatus: ( bookId: string, chapterId: string, publishStatus: PublishStatus ) => Promise> } chapterTag: { list: (bookId: string, chapterId: string) => Promise> set: (bookId: string, chapterId: string, tag: string, color?: string) => Promise> remove: (bookId: string, chapterId: string, tag: string) => Promise> } outline: { list: (bookId: string) => Promise> create: ( bookId: string, title: string, parentId?: string | null, sortOrder?: number ) => Promise> update: ( bookId: string, id: string, patch: Partial<{ title: string description: string status: OutlineStatus expectedWordCount: number | null chapterId: string | null sortOrder: number }> ) => Promise> delete: (bookId: string, id: string) => Promise> move: ( bookId: string, id: string, parentId: string | null, sortOrder: number ) => Promise> } setting: { list: (bookId: string, type?: SettingType) => Promise> create: (bookId: string, type: SettingType, name: string) => Promise> update: ( bookId: string, id: string, patch: Partial<{ name: string; description: string; type: SettingType; properties: Record }> ) => Promise> delete: (bookId: string, id: string) => Promise> syncRefs: (bookId: string, id: string, chapterIds: string[]) => Promise> } inspiration: { list: (bookId: string) => Promise> create: ( bookId: string, title?: string, content?: string, tags?: string[] ) => Promise> update: ( bookId: string, id: string, patch: Partial<{ title: string; content: string; tags: string[] }> ) => Promise> delete: (bookId: string, id: string) => Promise> convert: ( bookId: string, id: string, targetKind: 'outline' | 'setting', settingType?: SettingType ) => Promise> } snapshot: { list: (bookId: string, chapterId: string) => Promise> create: ( bookId: string, chapterId: string, type: SnapshotType, name?: string, content?: string ) => Promise> restore: (bookId: string, chapterId: string, snapshotId: string) => Promise> delete: (bookId: string, snapshotId: string) => Promise> startAutoSave: (bookId: string, chapterId: string) => Promise> stopAutoSave: (bookId: string, chapterId: string) => Promise> } bookmark: { list: (bookId: string, chapterId?: string, resolved?: boolean) => Promise> create: ( bookId: string, chapterId: string, position: number, label: string, landmarkType?: LandmarkType ) => Promise> update: ( bookId: string, id: string, patch: Partial<{ label: string; position: number; landmarkType: LandmarkType }> ) => Promise> resolve: (bookId: string, id: string, resolved: boolean) => Promise> delete: (bookId: string, id: string) => Promise> } search: { query: ( bookId: string, query: string, options?: { regex?: boolean; caseSensitive?: boolean; matchWholeWord?: boolean } ) => Promise> replace: ( bookId: string, query: string, replacement: string, dryRun: boolean, options?: { regex?: boolean; caseSensitive?: boolean } ) => Promise> getHistory: () => Promise> saveHistory: (query: string) => Promise> } ai: { sessionList: (bookId: string, includeArchived?: boolean) => Promise> sessionCreate: (bookId: string, title?: string, model?: string) => Promise> sessionUpdate: ( bookId: string, sessionId: string, patch: Partial<{ title: string; model: string; archived: boolean; context: AiContextBinding }> ) => Promise> sessionDelete: (bookId: string, sessionId: string) => Promise> sessionExport: ( bookId: string, sessionId: string, format?: 'markdown' | 'txt' ) => Promise> messageList: (bookId: string, sessionId: string) => Promise> chat: ( bookId: string, sessionId: string, content: string, prompt?: string ) => Promise> abort: (messageId: string) => Promise> buildContext: (bookId: string, binding: AiContextBinding) => Promise> testConnection: (config?: AiConfig) => Promise> namingCheck: (bookId: string) => Promise> } interactive: { checkGate: (bookId: string) => Promise> getFlow: (bookId: string, sessionId: string) => Promise> start: (bookId: string, sessionId: string) => Promise> confirmContext: ( bookId: string, flowId: string, binding: AiContextBinding ) => Promise> suggestPlots: (bookId: string, flowId: string) => Promise> selectPlot: ( bookId: string, flowId: string, selection: PlotSelection ) => Promise> generateScene: (bookId: string, flowId: string) => Promise> resolveNaming: ( bookId: string, flowId: string, chosenName: string ) => Promise> refineScene: ( bookId: string, flowId: string, instruction: string ) => Promise> acceptScene: (bookId: string, flowId: string) => Promise> finishChapter: ( bookId: string, flowId: string, volumeId: string, title?: string ) => Promise> abort: (flowId: string) => Promise> getSceneDraft: (bookId: string, flowId: string) => Promise> } auto: { checkGate: (bookId: string) => Promise> getFlow: (bookId: string, sessionId: string) => Promise> start: (bookId: string, sessionId: string) => Promise> setGoal: ( bookId: string, flowId: string, config: Partial ) => Promise> confirmContext: ( bookId: string, flowId: string, binding: AiContextBinding ) => Promise> planScenes: ( bookId: string, flowId: string, contextSummary?: string ) => Promise> generate: ( bookId: string, flowId: string, contextSummary?: string ) => Promise> resolveNaming: ( bookId: string, flowId: string, chosenName: string, contextSummary?: string ) => Promise> pause: (bookId: string, flowId: string) => Promise> resume: (bookId: string, flowId: string) => Promise> handoffInteractive: (bookId: string, flowId: string) => Promise> finishChapter: ( bookId: string, flowId: string, volumeId: string, title?: string ) => Promise> abort: (flowId: string) => Promise> getSceneDraft: (bookId: string, flowId: string) => Promise> } wizard: { getFlow: (bookId: string, sessionId: string) => Promise> start: (bookId: string, sessionId: string) => Promise> setGoal: ( bookId: string, flowId: string, config: Partial ) => Promise> setRhythm: ( bookId: string, flowId: string, rhythm: AutoRhythm, styleNote?: string ) => Promise> setPov: (bookId: string, flowId: string, povSettingId: string) => Promise> confirmContext: ( bookId: string, flowId: string, binding: AiContextBinding ) => Promise> buildPreview: ( bookId: string, flowId: string ) => Promise> startGenerate: (bookId: string, flowId: string) => Promise> handoffInteractive: (bookId: string, flowId: string) => Promise> abort: (flowId: string) => Promise> } knowledge: { list: ( bookId: string, filter?: { status?: KnowledgeStatus; type?: KnowledgeType; forgottenOnly?: boolean } ) => Promise> create: (bookId: string, input: CreateKnowledgeInput) => Promise> update: ( bookId: string, id: string, patch: Partial ) => Promise> delete: (bookId: string, id: string) => Promise> approve: (bookId: string, id: string) => Promise> reject: (bookId: string, id: string) => Promise> batchApprove: (bookId: string, ids: string[]) => Promise> createFromBookmark: (bookId: string, bookmarkId: string) => Promise> stats: ( bookId: string ) => Promise> suggestContext: ( bookId: string, opts?: KnowledgeSuggestOptions ) => Promise> extractChapter: ( bookId: string, chapterId: string ) => Promise> approveMerge: (bookId: string, pendingId: string) => Promise> saveMergeAsNew: (bookId: string, pendingId: string) => Promise> batchApproveHighConfidence: (bookId: string, threshold?: number) => Promise> listInjections: ( bookId: string, entryId: string, limit?: number ) => Promise> } writing: { getStats: (bookId: string) => Promise> } pomodoro: { start: (bookId: string) => Promise> pause: () => Promise> resume: () => Promise> cancel: () => Promise> getState: () => Promise> } achievement: { list: (bookId: string) => Promise> } cockpit: { getSummary: (bookId: string, volumeId?: string) => Promise> markSeen: (bookId: string) => Promise> shouldShowOnOpen: (bookId: string) => Promise> } graph: { getData: (bookId: string, filter?: 'all' | 'connected') => Promise> upsertRelationship: ( bookId: string, sourceId: string, relationship: Partial & { targetId: string label: string intimacy: number } ) => Promise> deleteRelationship: ( bookId: string, sourceId: string, relationshipId: string ) => Promise> } analytics: { getSummary: (bookId: string) => Promise> } import: { pickFile: () => Promise> preview: ( filePath: string, splitMode: ImportSplitMode, customRegex?: string ) => Promise> execute: (params: ImportExecuteParams) => Promise> } export: { formatChapter: ( bookId: string, chapterId: string, presetId: string ) => Promise> copyClipboard: (text: string) => Promise> saveTxt: (text: string, defaultName: string) => Promise> } pack: { pickFile: ( mode: 'novel' | 'novel-all' | 'save-novel' | 'save-all' | 'import' ) => Promise> exportBook: (bookId: string, destPath: string) => Promise> importBook: (filePath: string) => Promise> exportAll: (destPath: string) => Promise> importAll: (filePath: string, strategy: PackImportStrategy) => Promise> estimateExportAll: () => Promise> cancel: () => Promise> } bridge: { get: ( bookId: string, chapterId: string, withAi?: boolean ) => Promise> dismiss: (bookId: string, chapterId: string) => Promise> shouldPrompt: (bookId: string, chapterId: string) => Promise> } wordfreq: { analyze: ( bookId: string, scope: { kind: 'book' | 'volume' | 'chapter'; chapterId?: string; volumeId?: string } ) => Promise> } shortcut: { getAll: () => Promise>> register: (action: ActionId, accelerator: string) => Promise> } onShortcutTriggered: (callback: (action: ActionId) => void) => () => void onAiStreamChunk: (callback: (payload: AiStreamChunkEvent) => void) => () => void onAiNetworkStatus: (callback: (payload: AiNetworkStatusEvent) => void) => () => void onInteractiveStreamChunk: (callback: (payload: InteractiveStreamChunkEvent) => void) => () => void onPomodoroTick: (callback: (state: PomodoroState) => void) => () => void onGoalNotification: (callback: (payload: GoalNotificationPayload) => void) => () => void onImportProgress: (callback: (payload: { current: number; total: number }) => void) => () => void onPackProgress: (callback: (payload: PackProgressEvent) => void) => () => void } declare global { interface Window { electronAPI: ElectronAPI } } export {}