feat(V2-1a): Monorepo 구조 전환 — apps/desktop으로 V1 이동
- npm workspaces 루트 (apps/*, packages/*) 세팅 - V1 전체를 apps/desktop/으로 git mv (src, resources, tests, sidecar, scripts, electron.vite.config.ts, electron-builder.yml, vitest.config.ts, tsconfig.node.json, tsconfig.web.json) - apps/desktop/package.json 신규 (name=@d3ro/desktop) - productName: 'd3ro-voice' 명시 — app.getName()을 고정하여 userData 경로 %APPDATA%\d3ro-voice\ 그대로 유지 (기존 DB/설정 연속성 보장) - 루트 package.json을 workspace 루트로 재구성, 공통 devDep만 유지 (typescript, eslint, prettier) - turbo.json, tsconfig.base.json 추가 (Turborepo 자체 설치는 별도 sub-phase) - memory/project_status.md 생성 (규칙 13) 검증: - npm run typecheck 통과 - npm run build 통과 (electron-vite main+preload+renderer) - npm run dev 실제 실행 → DB/핫키/Ollama 자동 실행 모두 정상
This commit is contained in:
parent
3a160b9032
commit
45a580878a
178 changed files with 214 additions and 0 deletions
53
apps/desktop/src/main/ipc/voice-handlers.ts
Normal file
53
apps/desktop/src/main/ipc/voice-handlers.ts
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
// 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 { getVoiceModeService } from '../services/VoiceModeService'
|
||||
import type { StartRecordingParams, StopRecordingParams, CancelRecordingParams, SetVoiceModeParams } from '@shared/types'
|
||||
|
||||
export function registerVoiceHandlers(): void {
|
||||
ipcMain.handle(IPC_CHANNELS.VOICE.START_RECORDING, async (_event, params: StartRecordingParams) => {
|
||||
try {
|
||||
const voice = getVoiceModeService()
|
||||
await voice.startSession('dictation')
|
||||
const session = voice.currentSession
|
||||
return ipcSuccess({ sessionId: session?.id ?? params.sessionId ?? '' })
|
||||
} catch {
|
||||
return ipcError(ErrorCode.AudioCaptureStartFailed, 'Failed to start recording')
|
||||
}
|
||||
})
|
||||
|
||||
ipcMain.handle(IPC_CHANNELS.VOICE.STOP_RECORDING, async (_event, params: StopRecordingParams) => {
|
||||
try {
|
||||
const voice = getVoiceModeService()
|
||||
await voice.stopSession()
|
||||
return ipcSuccess({
|
||||
sessionId: params.sessionId,
|
||||
text: voice.currentSession?.transcription ?? '',
|
||||
durationMs: voice.currentSession ? Date.now() - voice.currentSession.startedAt : 0
|
||||
})
|
||||
} catch {
|
||||
return ipcError(ErrorCode.STTTranscriptionFailed, 'Failed to stop recording')
|
||||
}
|
||||
})
|
||||
|
||||
ipcMain.handle(IPC_CHANNELS.VOICE.CANCEL_RECORDING, async (_event, _params: CancelRecordingParams) => {
|
||||
getVoiceModeService().cancelSession()
|
||||
return ipcSuccess(undefined)
|
||||
})
|
||||
|
||||
ipcMain.handle(IPC_CHANNELS.VOICE.GET_STATE, async () => {
|
||||
return ipcSuccess(getVoiceModeService().getState())
|
||||
})
|
||||
|
||||
ipcMain.handle(IPC_CHANNELS.VOICE.SET_MODE, async (_event, params: SetVoiceModeParams) => {
|
||||
// Phase 2: 모드만 설정에 저장 (실제 모드 전환은 핫키에서 처리)
|
||||
return ipcSuccess(undefined)
|
||||
})
|
||||
|
||||
ipcMain.handle(IPC_CHANNELS.VOICE.GET_MODE, async () => {
|
||||
const voice = getVoiceModeService()
|
||||
return ipcSuccess(voice.currentSession?.mode ?? 'dictation')
|
||||
})
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue