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
69
apps/desktop/src/main/ipc/caption-handlers.ts
Normal file
69
apps/desktop/src/main/ipc/caption-handlers.ts
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
// src/main/ipc/caption-handlers.ts
|
||||
// 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 { getCaptionService } from '../services/CaptionService'
|
||||
import type { CaptionConfig } from '@shared/types'
|
||||
|
||||
export function registerCaptionHandlers(): void {
|
||||
// 시스템 오디오 루프백: setDisplayMediaRequestHandler로 audio: 'loopback' 설정
|
||||
ipcMain.handle('system-audio:enable-loopback', async () => {
|
||||
session.defaultSession.setDisplayMediaRequestHandler(async (_request, callback) => {
|
||||
const sources = await desktopCapturer.getSources({ types: ['screen'] })
|
||||
if (sources.length === 0) {
|
||||
callback({})
|
||||
return
|
||||
}
|
||||
callback({ video: sources[0], audio: 'loopback' })
|
||||
})
|
||||
return ipcSuccess(undefined)
|
||||
})
|
||||
|
||||
ipcMain.handle('system-audio:disable-loopback', async () => {
|
||||
session.defaultSession.setDisplayMediaRequestHandler(null)
|
||||
return ipcSuccess(undefined)
|
||||
})
|
||||
ipcMain.handle(IPC_CHANNELS.CAPTION.START, async () => {
|
||||
try {
|
||||
await getCaptionService().start()
|
||||
return ipcSuccess(undefined)
|
||||
} catch (err) {
|
||||
const code =
|
||||
err instanceof Error && 'code' in err
|
||||
? (err as { code: number }).code
|
||||
: ErrorCode.CaptionStartFailed
|
||||
const message = err instanceof Error ? err.message : String(err)
|
||||
return ipcError(code, message)
|
||||
}
|
||||
})
|
||||
|
||||
ipcMain.handle(IPC_CHANNELS.CAPTION.STOP, async () => {
|
||||
try {
|
||||
await getCaptionService().stop()
|
||||
return ipcSuccess(undefined)
|
||||
} catch (err) {
|
||||
const message = err instanceof Error ? err.message : String(err)
|
||||
return ipcError(ErrorCode.CaptionStartFailed, message)
|
||||
}
|
||||
})
|
||||
|
||||
ipcMain.handle(IPC_CHANNELS.CAPTION.GET_STATE, async () => {
|
||||
return ipcSuccess(getCaptionService().getState())
|
||||
})
|
||||
|
||||
ipcMain.handle(IPC_CHANNELS.CAPTION.SET_CONFIG, async (_event, config: Partial<CaptionConfig>) => {
|
||||
getCaptionService().setConfig(config)
|
||||
return ipcSuccess(undefined)
|
||||
})
|
||||
|
||||
ipcMain.handle(IPC_CHANNELS.CAPTION.GET_CONFIG, async () => {
|
||||
return ipcSuccess(getCaptionService().getConfig())
|
||||
})
|
||||
|
||||
// 렌더러 → 메인: 시스템 오디오 PCM 데이터 수신
|
||||
ipcMain.on(IPC_CHANNELS.CAPTION.SYSTEM_AUDIO_DATA, (_event, data: ArrayBuffer) => {
|
||||
getCaptionService().onSystemAudioData(Buffer.from(data))
|
||||
})
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue