diff --git a/apps/desktop/src/main/ipc/llm-handlers.ts b/apps/desktop/src/main/ipc/llm-handlers.ts index 5392a8a..862f2ef 100644 --- a/apps/desktop/src/main/ipc/llm-handlers.ts +++ b/apps/desktop/src/main/ipc/llm-handlers.ts @@ -11,7 +11,12 @@ import { configGet, configSet } from '../services/ConfigService' import { buildInstructionInvocation, resolveTargetLanguage } from '../services/llm-prompts' import { normalizeLoopbackUrl } from '../utils/loopback' import { getMainWindow } from '../windows/WindowManager' -import type { SetLLMModelParams, SetServerUrlParams, LLMProcessParams } from '@d3ro/core/types' +import type { + SetLLMModelParams, + SetServerUrlParams, + LLMProcessParams, + PullModelParams +} from '@d3ro/core/types' function safeSendToRenderer(channel: string, data: unknown): void { const win = getMainWindow() @@ -29,7 +34,7 @@ export function registerLLMHandlers(): void { safeSendToRenderer(IPC_CHANNELS.LLM.PULL_PROGRESS, payload) }) - ipcMain.handle(IPC_CHANNELS.LLM.PULL_MODEL, async (_event, params: { modelId: string }) => { + ipcMain.handle(IPC_CHANNELS.LLM.PULL_MODEL, async (_event, params: PullModelParams) => { try { await getLocalLLMService().pullModel(params.modelId) return ipcSuccess(undefined) diff --git a/apps/desktop/src/main/ipc/window-handlers.ts b/apps/desktop/src/main/ipc/window-handlers.ts index 866f943..27e5d30 100644 --- a/apps/desktop/src/main/ipc/window-handlers.ts +++ b/apps/desktop/src/main/ipc/window-handlers.ts @@ -2,6 +2,7 @@ import { ipcMain } from 'electron' import { IPC_CHANNELS } from '@d3ro/core/ipc-channels' +import type { OpenExternalParams } from '@d3ro/core/types' import { ErrorCode, ipcError, ipcSuccess } from '@d3ro/core/errors' import { getMainWindow, hideResultPopup, hideRecordingTip } from '../windows/WindowManager' import { isTrustedIpcSender, openExternalSafe } from '../windows/web-contents-hardening' @@ -40,7 +41,7 @@ export function registerWindowHandlers(): void { }) // 외부 URL 열기 — 앱 페이지가 보낸 요청만, 허용 scheme(https/mailto)만 연다. - ipcMain.handle(IPC_CHANNELS.SYSTEM.OPEN_EXTERNAL, async (event, params: { url: string }) => { + ipcMain.handle(IPC_CHANNELS.SYSTEM.OPEN_EXTERNAL, async (event, params: OpenExternalParams) => { if (!isTrustedIpcSender(event)) { return ipcError(ErrorCode.ConfigInvalidValue, 'openExternal: untrusted sender') } diff --git a/apps/desktop/src/main/windows/WindowManager.ts b/apps/desktop/src/main/windows/WindowManager.ts index 0873323..0edb2e3 100644 --- a/apps/desktop/src/main/windows/WindowManager.ts +++ b/apps/desktop/src/main/windows/WindowManager.ts @@ -6,6 +6,7 @@ import { join } from 'path' import { is } from '@electron-toolkit/utils' import { WINDOW_SIZE } from '@d3ro/core/constants' import type { AnchorKind, PhysicalRect, SuggestionCorrection } from '@d3ro/core/input-intelligence' +import type { RecordingTipState, TipStateChangedEvent } from '@d3ro/core/types' import { fitAnchoredPanel, placeAnchoredPanel, @@ -389,8 +390,8 @@ const TIP_WIDTH = 320 const TIP_HEIGHT = 110 export function showRecordingTip( - state: string, - params?: { text?: string; errorMessage?: string } + state: RecordingTipState, + params?: Omit ): void { const win = getRecordingTipWindow() @@ -424,8 +425,8 @@ export function hideRecordingTip(): void { } export function updateRecordingTipState( - state: string, - params?: { text?: string; errorMessage?: string } + state: RecordingTipState, + params?: Omit ): void { if (recordingTipWindow && !recordingTipWindow.isDestroyed()) { sendToPopupWindow(recordingTipWindow, IPC_CHANNELS.WINDOW.TIP_STATE_CHANGED, { state, _i18n: getPopupI18nStrings(), ...params }) diff --git a/apps/desktop/src/preload/index.ts b/apps/desktop/src/preload/index.ts index 818dfbb..e274556 100644 --- a/apps/desktop/src/preload/index.ts +++ b/apps/desktop/src/preload/index.ts @@ -58,6 +58,8 @@ import type { LLMProcessResult, SetLLMModelParams, SetServerUrlParams, + OpenExternalParams, + PullModelParams, LLMStatusChangedEvent, LLMProcessProgressEvent, HistoryQueryParams, @@ -367,7 +369,7 @@ const electronAPI = { on(IPC_CHANNELS.LLM.STATUS_CHANGED, cb), onProcessProgress: (cb: (e: LLMProcessProgressEvent) => void): Unsubscribe => on(IPC_CHANNELS.LLM.PROCESS_PROGRESS, cb), - pullModel: (params: { modelId: string }) => + pullModel: (params: PullModelParams) => invoke(IPC_CHANNELS.LLM.PULL_MODEL, params), startServer: () => invoke<'running' | 'starting' | 'not-installed' | 'failed'>( @@ -487,7 +489,7 @@ const electronAPI = { getVersion: () => invoke(IPC_CHANNELS.SYSTEM.GET_VERSION), checkMicPermission: () => invoke(IPC_CHANNELS.SYSTEM.CHECK_MIC_PERMISSION), - openExternal: (params: { url: string }) => + openExternal: (params: OpenExternalParams) => invoke(IPC_CHANNELS.SYSTEM.OPEN_EXTERNAL, params), }, diff --git a/packages/core/src/ipc-channels.ts b/packages/core/src/ipc-channels.ts index 32e86eb..734ea17 100644 --- a/packages/core/src/ipc-channels.ts +++ b/packages/core/src/ipc-channels.ts @@ -57,19 +57,6 @@ export const IPC_CHANNELS = { DOWNLOAD_PROGRESS: 'stt:downloadProgress' }, - TTS: { - SPEAK: 'tts:speak', - STOP: 'tts:stop', - GET_VOICES: 'tts:getVoices', - GET_ACTIVE_VOICE: 'tts:getActiveVoice', - SET_VOICE: 'tts:setVoice', - GET_STATUS: 'tts:getStatus', - DOWNLOAD_VOICE: 'tts:downloadVoice', - // Main → Renderer events - STATUS_CHANGED: 'tts:statusChanged', - SPEAKING_STATE_CHANGED: 'tts:speakingStateChanged' - }, - LLM: { GET_STATUS: 'llm:getStatus', GET_MODELS: 'llm:getModels', @@ -149,7 +136,6 @@ export const IPC_CHANNELS = { /** 녹음 재생 소스: 로컬 파일 바이트 또는 다른 기기 녹음의 서명 URL */ GET_AUDIO: 'history:getAudio', SEARCH: 'history:search', - EXPORT: 'history:export', // Main → Renderer events ADDED: 'history:added' }, @@ -173,26 +159,17 @@ export const IPC_CHANNELS = { MAXIMIZE: 'window:maximize', CLOSE: 'window:close', IS_MAXIMIZED: 'window:isMaximized', - SHOW_RECORDING_TIP: 'window:showRecordingTip', HIDE_RECORDING_TIP: 'window:hideRecordingTip', - SHOW_RESULT_POPUP: 'window:showResultPopup', HIDE_RESULT_POPUP: 'window:hideResultPopup', - TIP_MEASURED: 'window:tipMeasured', // Main → Renderer events - TIP_STATE_CHANGED: 'window:tipStateChanged', - TIP_PREPARE: 'window:tipPrepare', - TIP_SHOW: 'window:tipShow' + TIP_STATE_CHANGED: 'window:tipStateChanged' }, SYSTEM: { GET_PLATFORM: 'system:getPlatform', GET_VERSION: 'system:getVersion', CHECK_MIC_PERMISSION: 'system:checkMicPermission', - REQUEST_MIC_PERMISSION: 'system:requestMicPermission', - SHOW_NOTIFICATION: 'system:showNotification', OPEN_EXTERNAL: 'system:openExternal', - GET_ACTIVE_APP: 'system:getActiveApp', - INSERT_TEXT: 'system:insertText', PLAY_SOUND: 'system:playSound', SET_SOUND_ENABLED: 'system:setSoundEnabled', IS_SOUND_ENABLED: 'system:isSoundEnabled' @@ -200,8 +177,6 @@ export const IPC_CHANNELS = { STATS: { GET_SUMMARY: 'stats:getSummary', - GET_DAILY: 'stats:getDaily', - GET_WEEKLY: 'stats:getWeekly', // Main → Renderer events UPDATED: 'stats:updated' }, @@ -340,7 +315,6 @@ export const IPC_CHANNELS = { INDEX_COMPLETE: 'rag:indexComplete', /** 색인 실패 { documentId, fileName, code, message } (임베딩 모델 없음·서버 없음 등) */ INDEX_FAILED: 'rag:indexFailed', - QUERY_RESULT: 'rag:queryResult', }, // ── Phase 13: Voice Action / OS Automation (13.3) ── @@ -535,7 +509,6 @@ export const IPC_CHANNELS = { GET_DIAGNOSTICS: 'support:getDiagnostics', QUERY_AI: 'support:queryAI', CREATE_TICKET: 'support:createTicket', - GET_TICKETS: 'support:getTickets', CHECK_REFUND: 'support:checkRefund', }, @@ -579,7 +552,6 @@ export const IPC_CHANNELS = { HIDE: 'suggestionPopup:hide', ACCEPT: 'suggestionPopup:accept', DISMISS: 'suggestionPopup:dismiss', - ACCEPTED: 'suggestionPopup:accepted', DISMISSED: 'suggestionPopup:dismissed', }, diff --git a/packages/core/src/types.ts b/packages/core/src/types.ts index 03129a1..d73f8a7 100644 --- a/packages/core/src/types.ts +++ b/packages/core/src/types.ts @@ -240,60 +240,6 @@ export interface DownloadProgressEvent { bytesPerSecond: number } -// ============================================================ -// TTS (로컬 TTS) -// ============================================================ - -export enum TTSEngineState { - NOT_INSTALLED = 'not-installed', - LOADING = 'loading', - READY = 'ready', - SPEAKING = 'speaking', - ERROR = 'error' -} - -export interface TTSStatus { - engineState: TTSEngineState - activeVoice: string | null - engineVersion: string | null -} - -export interface TTSVoice { - id: string - name: string - language: string - gender: 'male' | 'female' | 'neutral' - downloaded: boolean - sizeBytes: number -} - -export interface TTSSpeakParams { - text: string - voiceId?: string - speed?: number -} - -export interface TTSSpeakResult { - durationMs: number -} - -export interface SetTTSVoiceParams { - voiceId: string -} - -export interface DownloadVoiceParams { - voiceId: string -} - -export interface TTSStatusChangedEvent { - status: TTSStatus -} - -export interface SpeakingStateChangedEvent { - isSpeaking: boolean - text: string -} - // ============================================================ // LLM (Ollama) // ============================================================ @@ -354,7 +300,7 @@ export interface SetServerUrlParams { } export interface PullModelParams { - modelName: string + modelId: string } export interface LLMStatusChangedEvent { @@ -741,12 +687,6 @@ export interface UnifiedSearchResponse { total: number } -export interface HistoryExportParams { - format: 'json' | 'csv' - from?: string - to?: string -} - // ============================================================ // Dictionary (사전) // ============================================================ @@ -820,23 +760,7 @@ export interface DictionarySearchParams { // Window (윈도우 제어) // ============================================================ -export type RecordingTipState = 'opening' | 'recording' | 'thinking' | 'result' | 'error' - -export interface ShowRecordingTipParams { - state: RecordingTipState - text?: string - errorMessage?: string -} - -export interface ShowResultPopupParams { - text: string - autoHideMs?: number -} - -export interface TipMeasuredParams { - width: number - height: number -} +export type RecordingTipState = 'opening' | 'recording' | 'thinking' | 'done' | 'result' | 'error' export interface TipStateChangedEvent { state: RecordingTipState @@ -844,45 +768,14 @@ export interface TipStateChangedEvent { errorMessage?: string } -export interface TipPrepareEvent { - state: RecordingTipState - text?: string -} - -export interface TipShowEvent { - state: RecordingTipState -} - // ============================================================ // System (시스템) // ============================================================ -export interface ActiveAppInfo { - name: string - title: string - pid: number -} - -export interface ShowNotificationParams { - title: string - body: string - type?: 'info' | 'warning' | 'error' -} - export interface OpenExternalParams { url: string } -export interface InsertTextParams { - text: string - method?: 'clipboard' | 'keyboard' -} - -export interface InsertTextResult { - success: boolean - insertedLength: number -} - export type SoundEffect = | 'recording-start' | 'recording-stop' @@ -912,25 +805,6 @@ export interface StatsSummary { streakDays: number } -export interface StatsQueryParams { - from: string - to: string -} - -export interface DailyStats { - date: string - recordingTimeMs: number - wordCount: number - sessionCount: number -} - -export interface WeeklyStats { - weekStart: string - recordingTimeMs: number - wordCount: number - sessionCount: number -} - // ============================================================ // Phase 10: Memo Tags (10.3) // ============================================================ @@ -1487,14 +1361,6 @@ export interface RAGDocument { addedAt: number } -export interface RAGChunk { - id: string - documentId: string - content: string - embedding: number[] - chunkIndex: number -} - export interface RAGQueryParams { query: string topK?: number @@ -1722,10 +1588,6 @@ export interface MeetingGenerateDocParams { customTitle?: string } -export interface MeetingGenerateDocResult { - document: MeetingDocument -} - export interface MeetingUpdateDocParams { documentId: string content: string @@ -1806,12 +1668,6 @@ export interface DiarizationSegment { end: number } -export interface DiarizationResult { - segments: DiarizationSegment[] - numSpeakers: number - processingTime: number -} - export interface DiarizeSessionParams { sessionId: string numSpeakers?: number @@ -2011,15 +1867,6 @@ export interface SupportTicket { assignedTo?: string } -export interface CreateSupportTicketParams { - category: TicketCategory - priority: TicketPriority - subject: string - description: string - customerEmail: string - includeDiagnostics?: boolean -} - export interface AIAssistQuery { question: string diagnostics?: SystemDiagnosticsPayload