b33d2e7b34
Deliver P5 writer workflow: writing cockpit, manual knowledge CRUD with review, chapter bridge with optional AI, publish status, and stock buffer reminders. Co-authored-by: Cursor <cursoragent@cursor.com>
73 lines
3.2 KiB
TypeScript
73 lines
3.2 KiB
TypeScript
import { join } from 'path'
|
|
import { app } from 'electron'
|
|
import { GlobalSettingsService } from '../services/global-settings'
|
|
import { BookRegistryService } from '../services/book-registry'
|
|
import { SnapshotService } from '../services/snapshot.service'
|
|
import { ShortcutManager } from '../shortcuts/manager'
|
|
import { registerSettingsHandlers } from './handlers/settings.handler'
|
|
import { registerBookHandlers } from './handlers/book.handler'
|
|
import { registerChapterHandlers } from './handlers/chapter.handler'
|
|
import { registerShortcutHandlers } from './handlers/shortcut.handler'
|
|
import { registerOutlineHandlers } from './handlers/outline.handler'
|
|
import { registerSettingHandlers } from './handlers/setting.handler'
|
|
import { registerInspirationHandlers } from './handlers/inspiration.handler'
|
|
import { registerSnapshotHandlers } from './handlers/snapshot.handler'
|
|
import { registerBookmarkHandlers } from './handlers/bookmark.handler'
|
|
import { registerSearchHandlers } from './handlers/search.handler'
|
|
import { registerAiHandlers } from './handlers/ai.handler'
|
|
import { registerInteractiveHandlers } from './handlers/interactive.handler'
|
|
import { registerAutoHandlers } from './handlers/auto.handler'
|
|
import { registerWizardHandlers } from './handlers/wizard.handler'
|
|
import { registerKnowledgeHandlers } from './handlers/knowledge.handler'
|
|
import { registerCockpitHandlers } from './handlers/cockpit.handler'
|
|
import { registerBridgeHandlers } from './handlers/bridge.handler'
|
|
import { AiClientService } from '../services/ai-client.service'
|
|
import { NetworkMonitorService } from '../services/network-monitor.service'
|
|
|
|
let shortcutManager: ShortcutManager | null = null
|
|
let snapshotService: SnapshotService | null = null
|
|
let networkMonitor: NetworkMonitorService | null = null
|
|
|
|
export function registerIpc(): { settings: GlobalSettingsService; books: BookRegistryService; shortcuts: ShortcutManager } {
|
|
const userData = app.getPath('userData')
|
|
|
|
const settings = new GlobalSettingsService(userData)
|
|
const books = new BookRegistryService(userData)
|
|
shortcutManager = new ShortcutManager(settings)
|
|
snapshotService = new SnapshotService(() => settings.get())
|
|
networkMonitor = new NetworkMonitorService()
|
|
|
|
registerSettingsHandlers(settings)
|
|
registerBookHandlers(books)
|
|
registerChapterHandlers(books)
|
|
registerShortcutHandlers(shortcutManager)
|
|
registerOutlineHandlers(books)
|
|
registerSettingHandlers(books)
|
|
registerInspirationHandlers(books)
|
|
registerSnapshotHandlers(books, snapshotService!)
|
|
registerBookmarkHandlers(books)
|
|
registerSearchHandlers(books, settings)
|
|
const aiClient = new AiClientService(() => settings.get().aiConfig)
|
|
registerAiHandlers(books, settings, aiClient)
|
|
registerInteractiveHandlers(books, settings, aiClient)
|
|
registerAutoHandlers(books, settings, aiClient)
|
|
registerWizardHandlers(books, settings, aiClient)
|
|
registerKnowledgeHandlers(books)
|
|
registerCockpitHandlers(books, settings)
|
|
registerBridgeHandlers(books, aiClient)
|
|
|
|
return { settings, books, shortcuts: shortcutManager }
|
|
}
|
|
|
|
export function getShortcutManager(): ShortcutManager | null {
|
|
return shortcutManager
|
|
}
|
|
|
|
export function getNetworkMonitor(): NetworkMonitorService | null {
|
|
return networkMonitor
|
|
}
|
|
|
|
export function getSnapshotService(): SnapshotService | null {
|
|
return snapshotService
|
|
}
|