refactor(core): delete dead IPC/TTS contract and rewire live payload types (WS-G2)

Wave 5 G2 — 채널·타입 SSOT 정리 (docs/REFACTOR_WAVE5_AUDIT.md W5-02/W5-03).

삭제한 죽은 채널 (값 문자열·`IPC_CHANNELS.X` 참조 모두 0, 빌드 산출물 제외 검증):
- TTS 블록 전체 (tts:speak/stop/getVoices/getActiveVoice/setVoice/getStatus/
  downloadVoice/statusChanged/speakingStateChanged) — preload·handler·렌더러 어디에도 없음
- WINDOW: showRecordingTip, showResultPopup, tipMeasured, tipPrepare, tipShow
- SYSTEM: requestMicPermission, showNotification, getActiveApp, insertText
- HISTORY: export · STATS: getDaily, getWeekly · RAG: queryResult
- SUPPORT: getTickets · POPUP_SUGGESTION: accepted

삭제한 죽은 타입 (참조 0): TTS 9종, ShowRecordingTipParams, ShowResultPopupParams,
TipMeasuredParams, TipPrepareEvent, TipShowEvent, ActiveAppInfo, ShowNotificationParams,
InsertTextParams, InsertTextResult, HistoryExportParams, StatsQueryParams, DailyStats,
WeeklyStats, RAGChunk, CreateSupportTicketParams, DiarizationResult,
MeetingGenerateDocResult (preload는 이미 MeetingDocument를 반환 — 낡은 래퍼).

재배선한 살아있는 계약 (드리프트 수정):
- PullModelParams: 실제 payload는 { modelId } 인데 SSOT는 { modelName } 이었다 →
  타입을 실제에 맞추고 llm-handlers + preload가 코어 타입을 쓰도록 복구
- OpenExternalParams: preload·window-handler 인라인 { url } → 코어 타입
- RecordingTipState/TipStateChangedEvent: WindowManager가 string을 받고 있었다 →
  유니온으로 좁히고 'done'(팝업 렌더러가 실제 사용)을 유니온에 포함

검증:
- npm run typecheck (desktop/web/admin/packages) GREEN
- npm run typecheck:mobile GREEN · lint --max-warnings=0 GREEN
- npm test GREEN (desktop 2800, core 605, web 24, api-client 31)
- npm run test:mobile 599 GREEN · test:hygiene 400 files GREEN
- contract:check GREEN · check:design 0 violations
This commit is contained in:
Yun Chan 2026-11-08 21:06:24 +09:00
parent b8b91901eb
commit f95bc9cdeb
6 changed files with 21 additions and 193 deletions

View file

@ -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)

View file

@ -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')
}

View file

@ -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<TipStateChangedEvent, 'state'>
): 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<TipStateChangedEvent, 'state'>
): void {
if (recordingTipWindow && !recordingTipWindow.isDestroyed()) {
sendToPopupWindow(recordingTipWindow, IPC_CHANNELS.WINDOW.TIP_STATE_CHANGED, { state, _i18n: getPopupI18nStrings(), ...params })

View file

@ -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<void>(IPC_CHANNELS.LLM.PULL_MODEL, params),
startServer: () =>
invoke<'running' | 'starting' | 'not-installed' | 'failed'>(
@ -487,7 +489,7 @@ const electronAPI = {
getVersion: () => invoke<string>(IPC_CHANNELS.SYSTEM.GET_VERSION),
checkMicPermission: () =>
invoke<PermissionStatus>(IPC_CHANNELS.SYSTEM.CHECK_MIC_PERMISSION),
openExternal: (params: { url: string }) =>
openExternal: (params: OpenExternalParams) =>
invoke<void>(IPC_CHANNELS.SYSTEM.OPEN_EXTERNAL, params),
},