feat(V2-1b): packages/core 추출 — 공유 타입/에러/채널/유틸 분리

packages/core (@d3ro/core) 신규 생성:
- types.ts, errors.ts, ipc-channels.ts, constants.ts (shared에서 이동)
- utils/meeting-markdown.ts, utils/markdown-to-docx.ts (main/utils에서 이동)
- subpath exports 정의 (./types, ./errors, ./ipc-channels, ./constants,
  ./utils/meeting-markdown, ./utils/markdown-to-docx)
- src/index.ts barrel export 추가
- docx를 core 자체 dependency로 선언

apps/desktop 연결:
- package.json에 @d3ro/core: '*' dep 추가
- tsconfig.node/web.json paths에 @d3ro/core/* 추가
- electron.vite.config.ts 3개 섹션 alias 추가 (main/preload/renderer)
- externalizeDepsPlugin exclude에 @d3ro/core (workspace 소스 번들 대상)
- vitest.config.ts alias 추가

일괄 치환 (79 파일, 167건):
- @shared/{types,errors,ipc-channels,constants} → @d3ro/core/*
- static/dynamic import + type expression import 모두 포함
- MeetingModeService.ts의 ../utils/* 상대 경로 → @d3ro/core/utils/*
- @shared/theme-vars는 V2-1c 범위로 남김 (WindowManager만 사용)

M1 수정 포함:
- electron.vite.config.ts의 resolve('src/shared') → resolve(__dirname, ...)
  CWD 독립적으로 동작하도록 견고화

검증:
- typecheck 통과
- build 통과 (main+preload+renderer)
- dev 런타임 → DB/핫키/Ollama 모두 정상, 기존 데이터 연속성 유지
This commit is contained in:
yunchan8804 2026-04-08 14:39:46 +09:00
parent a4cb4c0805
commit 3b0eb3393b
95 changed files with 315 additions and 212 deletions

View file

@ -1,13 +1,13 @@
// src/main/ipc/audio-handlers.ts
import { ipcMain } from 'electron'
import { IPC_CHANNELS } from '@shared/ipc-channels'
import { ipcSuccess, ipcError, ErrorCode } from '@shared/errors'
import { IPC_CHANNELS } from '@d3ro/core/ipc-channels'
import { ipcSuccess, ipcError, ErrorCode } from '@d3ro/core/errors'
import { getAudioCaptureService, calculateRMS } from '../services/AudioCaptureService'
import { getMainWindow } from '../windows/WindowManager'
import { configGet, configSet } from '../services/ConfigService'
import { getLogger } from '../services/LoggerService'
import type { SetDeviceParams } from '@shared/types'
import type { SetDeviceParams } from '@d3ro/core/types'
const logger = getLogger('audio-handlers')

View file

@ -2,10 +2,10 @@
// Phase 10.1: Live Caption IPC 핸들러
import { ipcMain, session, desktopCapturer } from 'electron'
import { IPC_CHANNELS } from '@shared/ipc-channels'
import { ipcSuccess, ipcError, ErrorCode } from '@shared/errors'
import { IPC_CHANNELS } from '@d3ro/core/ipc-channels'
import { ipcSuccess, ipcError, ErrorCode } from '@d3ro/core/errors'
import { getCaptionService } from '../services/CaptionService'
import type { CaptionConfig } from '@shared/types'
import type { CaptionConfig } from '@d3ro/core/types'
export function registerCaptionHandlers(): void {
// 시스템 오디오 루프백: setDisplayMediaRequestHandler로 audio: 'loopback' 설정

View file

@ -2,15 +2,15 @@
// Phase 10.4: Multi-LLM Chain IPC 핸들러
import { ipcMain } from 'electron'
import { IPC_CHANNELS } from '@shared/ipc-channels'
import { ipcSuccess, ipcError, ErrorCode, D3ROError } from '@shared/errors'
import { IPC_CHANNELS } from '@d3ro/core/ipc-channels'
import { ipcSuccess, ipcError, ErrorCode, D3ROError } from '@d3ro/core/errors'
import { getChainService } from '../services/ChainService'
import type {
CreateChainParams,
UpdateChainParams,
DeleteChainParams,
ExecuteChainParams
} from '@shared/types'
} from '@d3ro/core/types'
export function registerChainHandlers(): void {
ipcMain.handle(IPC_CHANNELS.CHAIN.GET_ALL, async () => {

View file

@ -1,8 +1,8 @@
// src/main/ipc/config-handlers.ts
import { ipcMain, BrowserWindow } from 'electron'
import { IPC_CHANNELS } from '@shared/ipc-channels'
import { ipcSuccess, ipcError, ErrorCode } from '@shared/errors'
import { IPC_CHANNELS } from '@d3ro/core/ipc-channels'
import { ipcSuccess, ipcError, ErrorCode } from '@d3ro/core/errors'
import { configGet, configSet, configGetAll, configReset } from '../services/ConfigService'
import { getAutoLaunchService } from '../services/AutoLaunchService'
import { reapplyThemeToAllPopups } from '../windows/WindowManager'
@ -22,7 +22,7 @@ import type {
SetAutoLaunchParams,
SetCloseToTrayParams,
AppConfig
} from '@shared/types'
} from '@d3ro/core/types'
export function registerConfigHandlers(): void {
ipcMain.handle(IPC_CHANNELS.CONFIG.GET, async (_event, params: ConfigGetParams) => {

View file

@ -2,8 +2,8 @@
// Phase 10.2 스크린 컨텍스트 IPC 핸들러
import { ipcMain } from 'electron'
import { IPC_CHANNELS } from '@shared/ipc-channels'
import { ipcSuccess, ipcError, ErrorCode } from '@shared/errors'
import { IPC_CHANNELS } from '@d3ro/core/ipc-channels'
import { ipcSuccess, ipcError, ErrorCode } from '@d3ro/core/errors'
import { getScreenContextService } from '../services/ScreenContextService'
export function registerContextHandlers(): void {

View file

@ -1,8 +1,8 @@
// src/main/ipc/dictionary-handlers.ts
import { ipcMain } from 'electron'
import { IPC_CHANNELS } from '@shared/ipc-channels'
import { ipcSuccess, ipcError, ErrorCode } from '@shared/errors'
import { IPC_CHANNELS } from '@d3ro/core/ipc-channels'
import { ipcSuccess, ipcError, ErrorCode } from '@d3ro/core/errors'
import { getDictionaryService } from '../services/DictionaryService'
import type {
DictionaryQueryParams,
@ -10,7 +10,7 @@ import type {
DictionaryUpdateParams,
DictionaryDeleteParams,
DictionarySearchParams
} from '@shared/types'
} from '@d3ro/core/types'
export function registerDictionaryHandlers(): void {
ipcMain.handle(IPC_CHANNELS.DICTIONARY.GET_ALL, async (_event, params: DictionaryQueryParams) => {

View file

@ -2,11 +2,11 @@
// Phase 12.1: 파일 전사 IPC 핸들러
import { ipcMain, dialog } from 'electron'
import { IPC_CHANNELS } from '@shared/ipc-channels'
import { ErrorCode, ipcSuccess, ipcError } from '@shared/errors'
import { IPC_CHANNELS } from '@d3ro/core/ipc-channels'
import { ErrorCode, ipcSuccess, ipcError } from '@d3ro/core/errors'
import { getFileTranscriptionService } from '../services/FileTranscriptionService'
import { getLogger } from '../services/LoggerService'
import type { FileTranscriptionStartParams } from '@shared/types'
import type { FileTranscriptionStartParams } from '@d3ro/core/types'
const logger = getLogger('file-transcription-handlers')

View file

@ -1,15 +1,15 @@
// src/main/ipc/history-handlers.ts
import { ipcMain } from 'electron'
import { IPC_CHANNELS } from '@shared/ipc-channels'
import { ipcSuccess, ipcError, ErrorCode } from '@shared/errors'
import { IPC_CHANNELS } from '@d3ro/core/ipc-channels'
import { ipcSuccess, ipcError, ErrorCode } from '@d3ro/core/errors'
import { getHistoryService } from '../services/HistoryService'
import type {
HistoryQueryParams,
HistoryGetByIdParams,
HistoryDeleteParams,
HistorySearchParams
} from '@shared/types'
} from '@d3ro/core/types'
export function registerHistoryHandlers(): void {
ipcMain.handle(IPC_CHANNELS.HISTORY.GET_ALL, async (_event, params: HistoryQueryParams) => {

View file

@ -1,11 +1,11 @@
// src/main/ipc/hotkey-handlers.ts
import { ipcMain } from 'electron'
import { IPC_CHANNELS } from '@shared/ipc-channels'
import { ipcSuccess, ipcError, ErrorCode } from '@shared/errors'
import { IPC_CHANNELS } from '@d3ro/core/ipc-channels'
import { ipcSuccess, ipcError, ErrorCode } from '@d3ro/core/errors'
import { getHotkeyService } from '../services/HotkeyService'
import { configGet, configSet } from '../services/ConfigService'
import type { SetHotkeyParams, SetEnabledParams } from '@shared/types'
import type { SetHotkeyParams, SetEnabledParams } from '@d3ro/core/types'
export function registerHotkeyHandlers(): void {
ipcMain.handle(IPC_CHANNELS.HOTKEY.GET_DICTATION_SHORTCUT, async () => {

View file

@ -1,7 +1,7 @@
// src/main/ipc/instruction-handlers.ts
import { ipcMain } from 'electron'
import { ipcSuccess, ipcError, ErrorCode } from '@shared/errors'
import { ipcSuccess, ipcError, ErrorCode } from '@d3ro/core/errors'
import { getCustomInstructionService } from '../services/CustomInstructionService'
import type { CustomInstruction } from '../services/CustomInstructionService'

View file

@ -2,15 +2,15 @@
// Phase 11: 라이센스 IPC 핸들러
import { ipcMain, BrowserWindow } from 'electron'
import { IPC_CHANNELS } from '@shared/ipc-channels'
import { ipcSuccess, ipcError, ErrorCode } from '@shared/errors'
import { IPC_CHANNELS } from '@d3ro/core/ipc-channels'
import { ipcSuccess, ipcError, ErrorCode } from '@d3ro/core/errors'
import { getLicenseService } from '../services/LicenseService'
import type {
ActivateLicenseParams,
UpgradePromptEvent,
LicenseInfo,
} from '@shared/types'
import { Feature } from '@shared/types'
} from '@d3ro/core/types'
import { Feature } from '@d3ro/core/types'
/** 업그레이드 유도 이벤트를 모든 렌더러에 broadcast */
function broadcastUpgradePrompt(event: UpgradePromptEvent): void {

View file

@ -1,12 +1,12 @@
// src/main/ipc/llm-handlers.ts
import { ipcMain } from 'electron'
import { IPC_CHANNELS } from '@shared/ipc-channels'
import { ipcSuccess, ipcError, ErrorCode } from '@shared/errors'
import { IPC_CHANNELS } from '@d3ro/core/ipc-channels'
import { ipcSuccess, ipcError, ErrorCode } from '@d3ro/core/errors'
import { getLocalLLMService } from '../services/LocalLLMService'
import { configGet, configSet } from '../services/ConfigService'
import { getMainWindow } from '../windows/WindowManager'
import type { SetLLMModelParams, SetServerUrlParams, LLMProcessParams } from '@shared/types'
import type { SetLLMModelParams, SetServerUrlParams, LLMProcessParams } from '@d3ro/core/types'
export function registerLLMHandlers(): void {
// LLM 가용성 변경 시 렌더러에 상태 전파

View file

@ -2,15 +2,15 @@
// Phase 14.5: Meeting Document Template IPC 핸들러
import { ipcMain } from 'electron'
import { IPC_CHANNELS } from '@shared/ipc-channels'
import { ErrorCode, ipcSuccess, ipcError } from '@shared/errors'
import { IPC_CHANNELS } from '@d3ro/core/ipc-channels'
import { ErrorCode, ipcSuccess, ipcError } from '@d3ro/core/errors'
import { getMeetingDocTemplateService } from '../services/MeetingDocTemplateService'
import { getLogger } from '../services/LoggerService'
import type {
CreateMeetingDocTemplateParams,
UpdateMeetingDocTemplateParams,
DeleteMeetingDocTemplateParams,
} from '@shared/types'
} from '@d3ro/core/types'
const logger = getLogger('meeting-doc-template-handlers')

View file

@ -2,8 +2,8 @@
// Phase 14 / 14.5: Meeting Mode IPC 핸들러
import { ipcMain } from 'electron'
import { IPC_CHANNELS } from '@shared/ipc-channels'
import { ErrorCode, ipcSuccess, ipcError } from '@shared/errors'
import { IPC_CHANNELS } from '@d3ro/core/ipc-channels'
import { ErrorCode, ipcSuccess, ipcError } from '@d3ro/core/errors'
import { getMeetingModeService } from '../services/MeetingModeService'
import { getLogger } from '../services/LoggerService'
import type {
@ -15,7 +15,7 @@ import type {
MeetingGenerateDocParams,
MeetingExportFormat,
MeetingChatSendParams,
} from '@shared/types'
} from '@d3ro/core/types'
const logger = getLogger('meeting-mode-handlers')

View file

@ -2,11 +2,11 @@
// Phase 12.2: 회의록 요약 IPC 핸들러
import { ipcMain } from 'electron'
import { IPC_CHANNELS } from '@shared/ipc-channels'
import { ErrorCode, ipcSuccess, ipcError } from '@shared/errors'
import { IPC_CHANNELS } from '@d3ro/core/ipc-channels'
import { ErrorCode, ipcSuccess, ipcError } from '@d3ro/core/errors'
import { getMeetingSummaryService } from '../services/MeetingSummaryService'
import { getLogger } from '../services/LoggerService'
import type { MeetingSummarizeParams, MeetingSummaryGetParams, MeetingSummaryExportParams } from '@shared/types'
import type { MeetingSummarizeParams, MeetingSummaryGetParams, MeetingSummaryExportParams } from '@d3ro/core/types'
const logger = getLogger('meeting-summary-handlers')

View file

@ -2,8 +2,8 @@
// Phase 10.3: 음성 메모 태그 IPC 핸들러
import { ipcMain } from 'electron'
import { IPC_CHANNELS } from '@shared/ipc-channels'
import { ipcSuccess, ipcError, ErrorCode, D3ROError } from '@shared/errors'
import { IPC_CHANNELS } from '@d3ro/core/ipc-channels'
import { ipcSuccess, ipcError, ErrorCode, D3ROError } from '@d3ro/core/errors'
import { getMemoService } from '../services/MemoService'
import type {
GetTagsParams,
@ -11,7 +11,7 @@ import type {
RemoveTagParams,
SearchByTagParams,
ExportMemoParams
} from '@shared/types'
} from '@d3ro/core/types'
export function registerMemoHandlers(): void {
ipcMain.handle(IPC_CHANNELS.MEMO.GET_TAGS, async (_event, params: GetTagsParams) => {

View file

@ -2,11 +2,11 @@
// Phase 13.2: 로컬 RAG IPC 핸들러
import { ipcMain, dialog } from 'electron'
import { IPC_CHANNELS } from '@shared/ipc-channels'
import { ErrorCode, ipcSuccess, ipcError } from '@shared/errors'
import { IPC_CHANNELS } from '@d3ro/core/ipc-channels'
import { ErrorCode, ipcSuccess, ipcError } from '@d3ro/core/errors'
import { getRAGService } from '../services/RAGService'
import { getLogger } from '../services/LoggerService'
import type { RAGQueryParams, RAGRemoveDocumentParams } from '@shared/types'
import type { RAGQueryParams, RAGRemoveDocumentParams } from '@d3ro/core/types'
const logger = getLogger('rag-handlers')

View file

@ -1,11 +1,11 @@
// src/main/ipc/stt-handlers.ts
import { ipcMain } from 'electron'
import { IPC_CHANNELS } from '@shared/ipc-channels'
import { ipcSuccess, ipcError, ErrorCode } from '@shared/errors'
import { IPC_CHANNELS } from '@d3ro/core/ipc-channels'
import { ipcSuccess, ipcError, ErrorCode } from '@d3ro/core/errors'
import { getLocalSTTService } from '../services/LocalSTTService'
import { configGet, configSet } from '../services/ConfigService'
import type { SetSTTModelParams, SetSTTLanguageParams } from '@shared/types'
import type { SetSTTModelParams, SetSTTLanguageParams } from '@d3ro/core/types'
export function registerSTTHandlers(): void {
ipcMain.handle(IPC_CHANNELS.STT.GET_STATUS, async () => {

View file

@ -1,9 +1,9 @@
// src/main/ipc/system-handlers.ts
import { ipcMain, app, systemPreferences } from 'electron'
import { IPC_CHANNELS } from '@shared/ipc-channels'
import { ipcSuccess } from '@shared/errors'
import type { PermissionStatus, PlaySoundParams, SetSoundEnabledParams } from '@shared/types'
import { IPC_CHANNELS } from '@d3ro/core/ipc-channels'
import { ipcSuccess } from '@d3ro/core/errors'
import type { PermissionStatus, PlaySoundParams, SetSoundEnabledParams } from '@d3ro/core/types'
import { getSoundEffectService } from '../services/SoundEffectService'
export function registerSystemHandlers(): void {

View file

@ -2,8 +2,8 @@
// Phase 12.3: 딕테이션 템플릿 IPC 핸들러
import { ipcMain } from 'electron'
import { IPC_CHANNELS } from '@shared/ipc-channels'
import { ErrorCode, ipcSuccess, ipcError } from '@shared/errors'
import { IPC_CHANNELS } from '@d3ro/core/ipc-channels'
import { ErrorCode, ipcSuccess, ipcError } from '@d3ro/core/errors'
import { getDictationTemplateService } from '../services/DictationTemplateService'
import { getLogger } from '../services/LoggerService'
import type {
@ -12,7 +12,7 @@ import type {
DeleteTemplateParams,
StartTemplateSessionParams,
SetFieldValueParams,
} from '@shared/types'
} from '@d3ro/core/types'
const logger = getLogger('template-handlers')
@ -33,7 +33,7 @@ export function registerTemplateHandlers(): void {
// 라이센스 체크
try {
const { getLicenseService } = await import('../services/LicenseService')
const { Feature } = await import('@shared/types')
const { Feature } = await import('@d3ro/core/types')
const license = getLicenseService()
const access = license.canUse(Feature.DICTATION_TEMPLATE)
if (!access.allowed) {

View file

@ -2,11 +2,11 @@
// Phase 13.3: OS 자동화 IPC 핸들러
import { ipcMain } from 'electron'
import { IPC_CHANNELS } from '@shared/ipc-channels'
import { ErrorCode, ipcSuccess, ipcError } from '@shared/errors'
import { IPC_CHANNELS } from '@d3ro/core/ipc-channels'
import { ErrorCode, ipcSuccess, ipcError } from '@d3ro/core/errors'
import { getVoiceActionService } from '../services/VoiceActionService'
import { getLogger } from '../services/LoggerService'
import type { VoiceActionExecuteParams } from '@shared/types'
import type { VoiceActionExecuteParams } from '@d3ro/core/types'
const logger = getLogger('voice-action-handlers')

View file

@ -2,10 +2,10 @@
// Phase 10.5: 음성 단축키 IPC 핸들러
import { ipcMain } from 'electron'
import { IPC_CHANNELS } from '@shared/ipc-channels'
import { ipcSuccess, ipcError, ErrorCode } from '@shared/errors'
import { IPC_CHANNELS } from '@d3ro/core/ipc-channels'
import { ipcSuccess, ipcError, ErrorCode } from '@d3ro/core/errors'
import { getVoiceCommandService } from '../services/VoiceCommandService'
import type { SetVoiceCommandKeywordsParams, SetVoiceCommandEnabledParams } from '@shared/types'
import type { SetVoiceCommandKeywordsParams, SetVoiceCommandEnabledParams } from '@d3ro/core/types'
export function registerVoiceCommandHandlers(): void {
const CH = IPC_CHANNELS.VOICE_COMMAND

View file

@ -2,11 +2,11 @@
// Phase 13.1: 음성 대화 모드 IPC 핸들러
import { ipcMain } from 'electron'
import { IPC_CHANNELS } from '@shared/ipc-channels'
import { ErrorCode, ipcSuccess, ipcError } from '@shared/errors'
import { IPC_CHANNELS } from '@d3ro/core/ipc-channels'
import { ErrorCode, ipcSuccess, ipcError } from '@d3ro/core/errors'
import { getVoiceConversationService } from '../services/VoiceConversationService'
import { getLogger } from '../services/LoggerService'
import type { ConversationSendParams } from '@shared/types'
import type { ConversationSendParams } from '@d3ro/core/types'
const logger = getLogger('voice-conversation-handlers')

View file

@ -1,10 +1,10 @@
// src/main/ipc/voice-handlers.ts
import { ipcMain } from 'electron'
import { IPC_CHANNELS } from '@shared/ipc-channels'
import { ipcSuccess, ipcError, ErrorCode } from '@shared/errors'
import { IPC_CHANNELS } from '@d3ro/core/ipc-channels'
import { ipcSuccess, ipcError, ErrorCode } from '@d3ro/core/errors'
import { getVoiceModeService } from '../services/VoiceModeService'
import type { StartRecordingParams, StopRecordingParams, CancelRecordingParams, SetVoiceModeParams } from '@shared/types'
import type { StartRecordingParams, StopRecordingParams, CancelRecordingParams, SetVoiceModeParams } from '@d3ro/core/types'
export function registerVoiceHandlers(): void {
ipcMain.handle(IPC_CHANNELS.VOICE.START_RECORDING, async (_event, params: StartRecordingParams) => {

View file

@ -1,8 +1,8 @@
// src/main/ipc/window-handlers.ts
import { ipcMain, shell } from 'electron'
import { IPC_CHANNELS } from '@shared/ipc-channels'
import { ipcSuccess } from '@shared/errors'
import { IPC_CHANNELS } from '@d3ro/core/ipc-channels'
import { ipcSuccess } from '@d3ro/core/errors'
import { getMainWindow, hideResultPopup, hideRecordingTip } from '../windows/WindowManager'
export function registerWindowHandlers(): void {