refactor(main): IPC 채널 SSOT 일원화 + AppConfig 타입 강화 (WS2)

- ipc-channels.ts SSOT에 9개 그룹/키 추가: INSTRUCTION, SYSTEM_AUDIO,
  POPUP_RESULT/HISTORY/COMMAND/CAPTION, VOICE_PARTIAL, CLIPBOARD, APP,
  VOICE_CONVERSATION.FINISH_LISTENING
- WindowManager/handlers/bootstrap 하드코딩 채널 -> IPC_CHANNELS 교체.
  불일치 4건(result:* vs window:tip*)은 preload 재검증 후 SSOT로 통일.
  notifyRenderer channel: string -> IPCChannel 타입 좁힘.
- AppConfig에 7개 누락 키 추가(customInstructions, llmChains,
  voiceCommandRules, voiceCommandsEnabled, activeInstructionId,
  activeChainId, captionAudioSource) -> as never 16건 제거.
- ChainService/CustomInstructionService/WindowManager dynamic require -> static import.
- services/index.ts 데드 레지스트리 제거 (import 0건).
SKIP: ipcSuccess/ipcError 헬퍼 통일, catch 패턴(별도)
정책: docs/REFACTOR_POLICY.md DP2, DP9
This commit is contained in:
Yun Chan 2026-07-22 01:54:18 +09:00
parent b820c789bb
commit aef44289a5
15 changed files with 161 additions and 126 deletions

View file

@ -279,6 +279,7 @@ export const IPC_CHANNELS = {
GET_HISTORY: 'voiceConversation:getHistory',
CLEAR_HISTORY: 'voiceConversation:clearHistory',
CANCEL_RESPONSE: 'voiceConversation:cancelResponse',
FINISH_LISTENING: 'voiceConversation:finishListening',
/** OpenAI Realtime ephemeral token 발급 (Supabase realtime-token 경유) */
GET_REALTIME_TOKEN: 'voiceConversation:getRealtimeToken',
// Main → Renderer events
@ -399,6 +400,70 @@ export const IPC_CHANNELS = {
SYNC_COMPLETE: 'cloudSync:syncComplete',
SYNC_ERROR: 'cloudSync:syncError',
},
// ── Custom Instructions ──
INSTRUCTION: {
GET_ALL: 'instruction:getAll',
GET_BY_ID: 'instruction:getById',
CREATE: 'instruction:create',
UPDATE: 'instruction:update',
DELETE: 'instruction:delete',
REORDER: 'instruction:reorder',
},
// ── System Audio (Caption loopback) ──
SYSTEM_AUDIO: {
ENABLE_LOOPBACK: 'system-audio:enable-loopback',
DISABLE_LOOPBACK: 'system-audio:disable-loopback',
},
// ── Popup Internal Channels (ResultPopup 2-phase) ──
POPUP_RESULT: {
PREPARE: 'result:prepare',
MEASURED: 'result:measured',
SHOW: 'result:show',
},
// ── Popup Internal Channels (HistoryPopup) ──
POPUP_HISTORY: {
SHOW_POPUP: 'history:showPopup',
ITEM_SELECTED: 'history:itemSelected',
POPUP_DISMISSED: 'history:popupDismissed',
SHOW_ITEMS: 'history:showItems',
SHOW: 'history:show',
HIDE: 'history:hide',
KEY_EVENT: 'history:keyEvent',
},
// ── Popup Internal Channels (CommandPopup) ──
POPUP_COMMAND: {
SELECTED: 'command:selected',
DISMISSED: 'command:dismissed',
SHOW_ITEMS: 'command:showItems',
SHOW: 'command:show',
HIDE: 'command:hide',
KEY_EVENT: 'command:keyEvent',
},
// ── Popup Internal Channels (Caption) ──
POPUP_CAPTION: {
HIDE: 'caption:hide',
},
// ── Voice Partial Transcript (RecordingTip) ──
VOICE_PARTIAL: {
PARTIAL_TRANSCRIPT: 'voice:partialTranscript',
},
// ── Clipboard ──
CLIPBOARD: {
COPY: 'clipboard:copy',
},
// ── App-wide events ──
APP: {
DATA_CHANGED: 'app:dataChanged',
},
} as const
// 타입 유틸리티: 채널명 유니온 추출

View file

@ -410,6 +410,20 @@ export interface AppConfig {
cloudSyncLastAt: number | null
/** 빅뱅 Phase 2: 첫 실행 온보딩 완료 여부 (로컬 모드 entry point) */
onboardingCompleted: boolean
/** Phase 6: Custom instructions (CustomInstructionService) */
customInstructions: import('@d3ro/core/types').CustomInstruction[]
/** Phase 10.4: LLM chains (ChainService) */
llmChains: import('@d3ro/core/types').LLMChain[]
/** Phase 10.5: Voice command rules (VoiceCommandService) */
voiceCommandRules: import('@d3ro/core/types').VoiceCommandRule[]
/** Phase 10.5: Voice commands enabled flag */
voiceCommandsEnabled: boolean
/** Phase 6: Active instruction ID (CommandPopup) */
activeInstructionId: string
/** Phase 10.4: Active chain ID (VoiceModeService) */
activeChainId: string | null
/** Phase 10.1: Caption audio source (CaptionService, MeetingModeService) */
captionAudioSource: import('@d3ro/core/types').CaptionAudioSource
}
export interface ConfigGetParams {
@ -777,6 +791,22 @@ export interface SetVoiceCommandEnabledParams {
enabled: boolean
}
// ============================================================
// Phase 6: Custom Instructions
// ============================================================
export interface CustomInstruction {
id: string
name: string
description: string
prompt: string
icon: string
isBuiltin: boolean
order: number
createdAt: number
updatedAt: number
}
// ============================================================
// Phase 10: Screen Context (10.2)
// ============================================================