Compare commits
2 commits
359b244dc9
...
7e1972a315
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7e1972a315 | ||
|
|
2d585bfc29 |
56 changed files with 1489 additions and 3868 deletions
|
|
@ -41,6 +41,14 @@ jobs:
|
||||||
- name: 의존성 설치
|
- name: 의존성 설치
|
||||||
run: npm ci
|
run: npm ci
|
||||||
|
|
||||||
|
- name: STT 사이드카 빌드 (로컬 전사 엔진)
|
||||||
|
run: |
|
||||||
|
# 로컬 전사는 faster-whisper 사이드카에 의존한다. 이 번들이 빠지면
|
||||||
|
# 설치본에서 전사가 전혀 동작하지 않으므로 패키징 전에 반드시 빌드/검증한다.
|
||||||
|
npm run sidecar:setup --workspace=@d3ro/desktop
|
||||||
|
npm run sidecar:build --workspace=@d3ro/desktop
|
||||||
|
node scripts/ci/verify-sidecar-bundle.mjs
|
||||||
|
|
||||||
- name: 데스크톱 빌드 (서명 필수)
|
- name: 데스크톱 빌드 (서명 필수)
|
||||||
env:
|
env:
|
||||||
WIN_CSC_LINK: "${{ secrets.WIN_CSC_LINK }}"
|
WIN_CSC_LINK: "${{ secrets.WIN_CSC_LINK }}"
|
||||||
|
|
|
||||||
13
.github/workflows/build-mac.yml
vendored
13
.github/workflows/build-mac.yml
vendored
|
|
@ -48,15 +48,14 @@ jobs:
|
||||||
working-directory: apps/desktop
|
working-directory: apps/desktop
|
||||||
run: bash scripts/install-sox.sh
|
run: bash scripts/install-sox.sh
|
||||||
|
|
||||||
- name: Install Python dependencies
|
- name: Build STT sidecar (PyInstaller)
|
||||||
working-directory: apps/desktop
|
working-directory: apps/desktop
|
||||||
run: |
|
run: |
|
||||||
pip install pyinstaller
|
# 로컬 전사는 사이드카 번들에 의존한다. 누락된 채 패키징하면 설치본에서
|
||||||
pip install -r sidecar/requirements.txt
|
# 전사가 전혀 동작하지 않으므로 빌드 후 반드시 검증한다.
|
||||||
|
npm run sidecar:setup
|
||||||
- name: Build sidecar (PyInstaller)
|
npm run sidecar:build
|
||||||
working-directory: apps/desktop
|
node ../../scripts/ci/verify-sidecar-bundle.mjs
|
||||||
run: python scripts/build-sidecar.py
|
|
||||||
|
|
||||||
- name: Rebuild native modules for Electron
|
- name: Rebuild native modules for Electron
|
||||||
run: npx --yes @electron/rebuild@3 --version=33.4.11
|
run: npx --yes @electron/rebuild@3 --version=33.4.11
|
||||||
|
|
|
||||||
7
.github/workflows/release-signing-ca.yml
vendored
7
.github/workflows/release-signing-ca.yml
vendored
|
|
@ -36,6 +36,13 @@ jobs:
|
||||||
trusted-signing-account-name: ${{ secrets.AZURE_SIGNING_ACCOUNT }}
|
trusted-signing-account-name: ${{ secrets.AZURE_SIGNING_ACCOUNT }}
|
||||||
certificate-profile-name: ${{ secrets.AZURE_CERT_PROFILE }}
|
certificate-profile-name: ${{ secrets.AZURE_CERT_PROFILE }}
|
||||||
|
|
||||||
|
- name: Build STT Sidecar (local transcription engine)
|
||||||
|
run: |
|
||||||
|
# Without this bundle the packaged app cannot transcribe at all.
|
||||||
|
npm run sidecar:setup --workspace=@d3ro/desktop
|
||||||
|
npm run sidecar:build --workspace=@d3ro/desktop
|
||||||
|
node scripts/ci/verify-sidecar-bundle.mjs
|
||||||
|
|
||||||
- name: Build and Package Windows (NSIS + RFC 3161 TSA)
|
- name: Build and Package Windows (NSIS + RFC 3161 TSA)
|
||||||
env:
|
env:
|
||||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
|
||||||
18
.github/workflows/release.yml
vendored
18
.github/workflows/release.yml
vendored
|
|
@ -109,6 +109,15 @@ jobs:
|
||||||
npm run typecheck
|
npm run typecheck
|
||||||
npm run build --workspace=@d3ro/desktop
|
npm run build --workspace=@d3ro/desktop
|
||||||
|
|
||||||
|
- name: Build STT Sidecar (local transcription engine)
|
||||||
|
run: |
|
||||||
|
# Local transcription depends on the faster-whisper sidecar; a release
|
||||||
|
# that ships without it cannot transcribe at all, so build and verify
|
||||||
|
# the bundle before packaging.
|
||||||
|
npm run sidecar:setup --workspace=@d3ro/desktop
|
||||||
|
npm run sidecar:build --workspace=@d3ro/desktop
|
||||||
|
node scripts/ci/verify-sidecar-bundle.mjs
|
||||||
|
|
||||||
- name: Package with Electron Builder (NSIS x64)
|
- name: Package with Electron Builder (NSIS x64)
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
run: |
|
run: |
|
||||||
|
|
@ -179,6 +188,15 @@ jobs:
|
||||||
npm run typecheck
|
npm run typecheck
|
||||||
npm run build --workspace=@d3ro/desktop
|
npm run build --workspace=@d3ro/desktop
|
||||||
|
|
||||||
|
- name: Build STT Sidecar (local transcription engine)
|
||||||
|
run: |
|
||||||
|
# Local transcription depends on the faster-whisper sidecar; a release
|
||||||
|
# that ships without it cannot transcribe at all, so build and verify
|
||||||
|
# the bundle before packaging.
|
||||||
|
npm run sidecar:setup --workspace=@d3ro/desktop
|
||||||
|
npm run sidecar:build --workspace=@d3ro/desktop
|
||||||
|
node scripts/ci/verify-sidecar-bundle.mjs
|
||||||
|
|
||||||
- name: Package with Electron Builder (DMG & ZIP arm64)
|
- name: Package with Electron Builder (DMG & ZIP arm64)
|
||||||
run: |
|
run: |
|
||||||
cd apps/desktop
|
cd apps/desktop
|
||||||
|
|
|
||||||
4
.gitignore
vendored
4
.gitignore
vendored
|
|
@ -25,6 +25,10 @@ release/
|
||||||
# Build
|
# Build
|
||||||
*.tsbuildinfo
|
*.tsbuildinfo
|
||||||
build/
|
build/
|
||||||
|
# PyInstaller build artifacts (sidecar) — regenerated by `npm run sidecar:build`
|
||||||
|
apps/desktop/build/sidecar-build/
|
||||||
|
apps/desktop/build/sidecar.spec
|
||||||
|
|
||||||
!apps/desktop/build/
|
!apps/desktop/build/
|
||||||
!apps/desktop/build/entitlements.mac.plist
|
!apps/desktop/build/entitlements.mac.plist
|
||||||
sidecar-dist/
|
sidecar-dist/
|
||||||
|
|
|
||||||
|
|
@ -243,6 +243,11 @@ package-windows:
|
||||||
$env:CSC_LINK = (Resolve-Path -LiteralPath $env:WIN_CSC_PFX_FILE).Path
|
$env:CSC_LINK = (Resolve-Path -LiteralPath $env:WIN_CSC_PFX_FILE).Path
|
||||||
$env:CSC_KEY_PASSWORD = $env:WIN_CSC_KEY_PASSWORD
|
$env:CSC_KEY_PASSWORD = $env:WIN_CSC_KEY_PASSWORD
|
||||||
- node scripts/ci/sync-version.mjs --check --tag "$CI_COMMIT_TAG"
|
- node scripts/ci/sync-version.mjs --check --tag "$CI_COMMIT_TAG"
|
||||||
|
# 로컬 STT는 faster-whisper 사이드카에 의존한다. 이 번들이 빠지면 설치본에서
|
||||||
|
# 전사가 전혀 동작하지 않으므로, 패키징 전에 반드시 빌드하고 검증한다.
|
||||||
|
- npm run sidecar:setup --workspace=@d3ro/desktop
|
||||||
|
- npm run sidecar:build --workspace=@d3ro/desktop
|
||||||
|
- node scripts/ci/verify-sidecar-bundle.mjs
|
||||||
- npm run build --workspace=@d3ro/desktop
|
- npm run build --workspace=@d3ro/desktop
|
||||||
- cd apps/desktop
|
- cd apps/desktop
|
||||||
- npx electron-builder --win --x64 --config electron-builder.yml
|
- npx electron-builder --win --x64 --config electron-builder.yml
|
||||||
|
|
@ -270,6 +275,10 @@ package-macos:
|
||||||
- npm ci
|
- npm ci
|
||||||
script:
|
script:
|
||||||
- node scripts/ci/sync-version.mjs --check --tag "$CI_COMMIT_TAG"
|
- node scripts/ci/sync-version.mjs --check --tag "$CI_COMMIT_TAG"
|
||||||
|
# 로컬 STT(faster-whisper 사이드카) 번들 — 누락 시 설치본 전사 불가.
|
||||||
|
- npm run sidecar:setup --workspace=@d3ro/desktop
|
||||||
|
- npm run sidecar:build --workspace=@d3ro/desktop
|
||||||
|
- node scripts/ci/verify-sidecar-bundle.mjs
|
||||||
- npm run build --workspace=@d3ro/desktop
|
- npm run build --workspace=@d3ro/desktop
|
||||||
- cd apps/desktop
|
- cd apps/desktop
|
||||||
- npx electron-builder --mac --arm64 --config electron-builder.yml
|
- npx electron-builder --mac --arm64 --config electron-builder.yml
|
||||||
|
|
|
||||||
49
CHANGELOG.md
49
CHANGELOG.md
|
|
@ -13,6 +13,55 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
- Cloud-optional backup (encrypted, opt-in)
|
- Cloud-optional backup (encrypted, opt-in)
|
||||||
- Plugin system for custom pipelines
|
- Plugin system for custom pipelines
|
||||||
|
|
||||||
|
## [1.3.0] - 2026-09-18
|
||||||
|
|
||||||
|
> Published from an annotated tag through CI. Installer and update metadata are
|
||||||
|
> served by the canonical Forgejo feed; no binaries are committed to this repository.
|
||||||
|
|
||||||
|
### Added
|
||||||
|
- **Live partial transcript while dictating**: while the hotkey is held, the app now
|
||||||
|
transcribes the recent window of audio every 1.5 seconds and shows it in the recording
|
||||||
|
tip, so the text can be seen forming before the key is released. Partials never reach
|
||||||
|
the clipboard or the result popup; only the final transcription is inserted.
|
||||||
|
- **Instant first dictation**: the local speech engine (sidecar process + Whisper model)
|
||||||
|
is warmed up in the background at app start, so the first press does not wait for the
|
||||||
|
model to load.
|
||||||
|
- **Packaged local speech engine**: desktop installers now ship the faster-whisper
|
||||||
|
sidecar (`sidecar.exe` plus runtime data, including the Silero VAD model) and ffmpeg, so
|
||||||
|
local transcription works on a fresh install without Python on the machine.
|
||||||
|
- Sidecar build tooling: `npm --prefix apps/desktop run sidecar:setup` and
|
||||||
|
`sidecar:build`, plus a packaging-time bundle verifier that fails the build when the
|
||||||
|
engine or its VAD data is missing.
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
- Local engine connections now target the IPv4 loopback (`127.0.0.1`) instead of
|
||||||
|
`localhost`. On machines where `localhost` resolves only to IPv6, every local request
|
||||||
|
(Ollama and the speech sidecar) was refused and local AI silently did nothing.
|
||||||
|
- Whisper decoding is tuned for dictation: previous-text conditioning is disabled so
|
||||||
|
repeated hallucinations cannot compound, silence is trimmed more aggressively, and
|
||||||
|
low-confidence fallbacks are bounded. Same transcript quality, roughly five times
|
||||||
|
faster on the same machine.
|
||||||
|
- The sidecar reuses an already-loaded model instead of reloading it, and reports the
|
||||||
|
load time it measured.
|
||||||
|
- Local engine logs stream to the app log as complete UTF-8 lines instead of mangled
|
||||||
|
fragments, so failures are diagnosable.
|
||||||
|
- Failed local-engine startup now fails immediately with an actionable message (missing
|
||||||
|
bundled engine, damaged virtualenv, or missing SoX) instead of waiting for a 30 second
|
||||||
|
health check and reporting a generic error.
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
- **Local transcription never worked in packaged builds**: the sidecar was not part of
|
||||||
|
the packaged resources and no pipeline step built it, so the app always fell back to a
|
||||||
|
system Python that had no faster-whisper installed.
|
||||||
|
- **Local transcription and local LLM never worked in development**: the sidecar and SoX
|
||||||
|
paths were resolved against the Vite output directory (`out/main`) instead of the app
|
||||||
|
root, so recording failed with a SoX `ENOENT` and the sidecar fell back to a Python
|
||||||
|
without the runtime dependencies.
|
||||||
|
- **Silero VAD data was missing from the bundled engine**, which would have made
|
||||||
|
silence-trimmed transcription fail at runtime even with the engine bundled.
|
||||||
|
- Audio capture and the speech sidecar no longer flash a console window on Windows, and
|
||||||
|
SoX/spawn failures name the fix (`npm --prefix apps/desktop run setup:sox`).
|
||||||
|
|
||||||
## [1.2.0] - 2026-09-16
|
## [1.2.0] - 2026-09-16
|
||||||
|
|
||||||
> Published from an annotated tag through CI. Installer and update metadata are
|
> Published from an annotated tag through CI. Installer and update metadata are
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
"info": {
|
"info": {
|
||||||
"title": "D3RO-VOICE Admin API",
|
"title": "D3RO-VOICE Admin API",
|
||||||
"description": "Admin CRM Edge Functions for user management, subscription CRUD, payment history, and audit logs.",
|
"description": "Admin CRM Edge Functions for user management, subscription CRUD, payment history, and audit logs.",
|
||||||
"version": "1.2.0"
|
"version": "1.3.0"
|
||||||
},
|
},
|
||||||
"servers": [
|
"servers": [
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@d3ro/admin",
|
"name": "@d3ro/admin",
|
||||||
"version": "1.2.0",
|
"version": "1.3.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"description": "D3RO Voice Admin CRM — SaaS 관리 도구",
|
"description": "D3RO Voice Admin CRM — SaaS 관리 도구",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net10.0</TargetFramework>
|
<TargetFramework>net10.0</TargetFramework>
|
||||||
<Version>1.2.0</Version>
|
<Version>1.3.0</Version>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,8 @@ asarUnpack:
|
||||||
- "node_modules/better-sqlite3/**"
|
- "node_modules/better-sqlite3/**"
|
||||||
- "node_modules/uiohook-napi/**"
|
- "node_modules/uiohook-napi/**"
|
||||||
- "node_modules/@nut-tree-fork/**"
|
- "node_modules/@nut-tree-fork/**"
|
||||||
|
# ffmpeg 정적 바이너리는 실행 파일이므로 asar 내부에서 spawn할 수 없다
|
||||||
|
- "node_modules/@ffmpeg-installer/**"
|
||||||
|
|
||||||
# ────────────────────────────────────────────────────────────────────
|
# ────────────────────────────────────────────────────────────────────
|
||||||
# Windows
|
# Windows
|
||||||
|
|
@ -108,16 +110,29 @@ extraResources:
|
||||||
- "*.wav"
|
- "*.wav"
|
||||||
|
|
||||||
# SoX 바이너리
|
# SoX 바이너리
|
||||||
|
# 주의: filter에 "**/*"를 쓰면 하위 디렉토리가 통째로 누락된다(실측).
|
||||||
|
# 디렉토리를 그대로 복사할 때는 filter를 지정하지 않는다.
|
||||||
- from: resources/sox/
|
- from: resources/sox/
|
||||||
to: sox/
|
to: sox/
|
||||||
|
|
||||||
|
# faster-whisper STT 사이드카 (PyInstaller onedir: sidecar.exe + _internal/).
|
||||||
|
# 반드시 존재해야 한다. 누락되면 로컬 전사가 전혀 동작하지 않는다.
|
||||||
|
# 빌드: npm --prefix apps/desktop run sidecar:build
|
||||||
|
# electron-builder는 이 트리를 재귀로 복사한다(_internal 포함).
|
||||||
|
# 서명 검증에 실패하면 복사가 중간에 끊겨 _internal이 빠지므로,
|
||||||
|
# 서명 없이 로컬 검증할 때는 -c.win.forceCodeSigning=false 를 사용한다.
|
||||||
|
- from: sidecar-dist/sidecar/
|
||||||
|
to: sidecar/
|
||||||
filter:
|
filter:
|
||||||
- "**/*"
|
- "**/*"
|
||||||
|
|
||||||
|
# ffmpeg (파일 전사/미디어 변환용). CI가 resources/ffmpeg/에 배치한다.
|
||||||
|
- from: resources/ffmpeg/
|
||||||
|
to: ffmpeg/
|
||||||
|
|
||||||
# Ollama 바이너리 (포터블 zip을 사전 배치)
|
# Ollama 바이너리 (포터블 zip을 사전 배치)
|
||||||
- from: resources/ollama/
|
- from: resources/ollama/
|
||||||
to: ollama/
|
to: ollama/
|
||||||
filter:
|
|
||||||
- "**/*"
|
|
||||||
|
|
||||||
nsis:
|
nsis:
|
||||||
# 파일명 공백 금지 — mac.artifactName 주석과 동일한 이유 (latest.yml url 정합)
|
# 파일명 공백 금지 — mac.artifactName 주석과 동일한 이유 (latest.yml url 정합)
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@d3ro/desktop",
|
"name": "@d3ro/desktop",
|
||||||
"version": "1.2.0",
|
"version": "1.3.0",
|
||||||
"productName": "d3ro-voice",
|
"productName": "d3ro-voice",
|
||||||
"description": "로컬 AI 음성 어시스턴트 (Electron)",
|
"description": "로컬 AI 음성 어시스턴트 (Electron)",
|
||||||
"main": "./out/main/index.js",
|
"main": "./out/main/index.js",
|
||||||
|
|
@ -20,7 +20,10 @@
|
||||||
"dist": "electron-vite build && electron-builder --config electron-builder.yml",
|
"dist": "electron-vite build && electron-builder --config electron-builder.yml",
|
||||||
"dist:win": "electron-vite build && electron-builder --win --config electron-builder.yml --publish never",
|
"dist:win": "electron-vite build && electron-builder --win --config electron-builder.yml --publish never",
|
||||||
"dist:mac": "electron-vite build && electron-builder --mac --config electron-builder.yml --publish never -c.mac.identity=- -c.mac.hardenedRuntime=false",
|
"dist:mac": "electron-vite build && electron-builder --mac --config electron-builder.yml --publish never -c.mac.identity=- -c.mac.hardenedRuntime=false",
|
||||||
"setup:sox": "powershell -ExecutionPolicy Bypass -File scripts/download-sox.ps1"
|
"setup:sox": "powershell -ExecutionPolicy Bypass -File scripts/download-sox.ps1",
|
||||||
|
"sidecar:setup": "node scripts/setup-sidecar.mjs",
|
||||||
|
"sidecar:build": "node scripts/build-sidecar.mjs",
|
||||||
|
"dist:win:full": "npm run sidecar:build && electron-vite build && electron-builder --win --config electron-builder.yml --publish never"
|
||||||
},
|
},
|
||||||
"author": "D3RO",
|
"author": "D3RO",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
|
@ -45,6 +48,7 @@
|
||||||
"@electron-toolkit/utils": "^4.0.0",
|
"@electron-toolkit/utils": "^4.0.0",
|
||||||
"@emotion/react": "^11.14.0",
|
"@emotion/react": "^11.14.0",
|
||||||
"@emotion/styled": "^11.14.0",
|
"@emotion/styled": "^11.14.0",
|
||||||
|
"@ffmpeg-installer/ffmpeg": "^1.1.0",
|
||||||
"@mui/material": "^7.0.0",
|
"@mui/material": "^7.0.0",
|
||||||
"@nut-tree-fork/nut-js": "^4.2.6",
|
"@nut-tree-fork/nut-js": "^4.2.6",
|
||||||
"@supabase/supabase-js": "^2.45.0",
|
"@supabase/supabase-js": "^2.45.0",
|
||||||
|
|
|
||||||
0
apps/desktop/resources/ffmpeg/.gitkeep
Normal file
0
apps/desktop/resources/ffmpeg/.gitkeep
Normal file
127
apps/desktop/scripts/build-sidecar.mjs
Normal file
127
apps/desktop/scripts/build-sidecar.mjs
Normal file
|
|
@ -0,0 +1,127 @@
|
||||||
|
// scripts/build-sidecar.mjs
|
||||||
|
// faster-whisper 사이드카를 PyInstaller(onedir)로 묶어 sidecar-dist/sidecar/ 에 만든다.
|
||||||
|
//
|
||||||
|
// 사용: npm --prefix apps/desktop run sidecar:build
|
||||||
|
// 출력: apps/desktop/sidecar-dist/sidecar/sidecar(.exe) ← electron-builder extraResources 대상
|
||||||
|
//
|
||||||
|
// 주의:
|
||||||
|
// - `--collect-all faster_whisper` 가 필수다. faster-whisper는 VAD용
|
||||||
|
// `assets/silero_vad_v6.onnx` 데이터 파일을 패키지 안에 두는데, 이걸 누락하면
|
||||||
|
// 번들된 앱에서 VAD 사용 시 런타임에 실패한다.
|
||||||
|
// - 콘솔 모드를 유지한다(--noconsole 금지). 메인 프로세스가 stdout/stderr를 로그로
|
||||||
|
// 수집하는데, windowed 모드에서는 스트림이 사라져 진단이 불가능해진다.
|
||||||
|
// 콘솔 창 깜빡임은 메인 프로세스 spawn의 windowsHide로 막는다.
|
||||||
|
|
||||||
|
import { spawnSync } from 'node:child_process'
|
||||||
|
import { existsSync, rmSync, statSync } from 'node:fs'
|
||||||
|
import path from 'node:path'
|
||||||
|
import { fileURLToPath } from 'node:url'
|
||||||
|
|
||||||
|
const scriptDir = path.dirname(fileURLToPath(import.meta.url))
|
||||||
|
const desktopDir = path.resolve(scriptDir, '..')
|
||||||
|
const sidecarDir = path.join(desktopDir, 'sidecar')
|
||||||
|
const mainPy = path.join(sidecarDir, 'main.py')
|
||||||
|
const outputDir = path.join(desktopDir, 'sidecar-dist')
|
||||||
|
const isWindows = process.platform === 'win32'
|
||||||
|
const exeSuffix = isWindows ? '.exe' : ''
|
||||||
|
|
||||||
|
const venvPython = isWindows
|
||||||
|
? path.join(sidecarDir, '.venv', 'Scripts', 'python.exe')
|
||||||
|
: path.join(sidecarDir, '.venv', 'bin', 'python3')
|
||||||
|
|
||||||
|
const python = existsSync(venvPython)
|
||||||
|
? venvPython
|
||||||
|
: isWindows
|
||||||
|
? 'python'
|
||||||
|
: 'python3'
|
||||||
|
|
||||||
|
if (!existsSync(mainPy)) {
|
||||||
|
console.error(`사이드카 소스를 찾을 수 없습니다: ${mainPy}`)
|
||||||
|
process.exit(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
const probe = spawnSync(
|
||||||
|
python,
|
||||||
|
['-c', 'import PyInstaller, faster_whisper; print("ok")'],
|
||||||
|
{ encoding: 'utf-8' },
|
||||||
|
)
|
||||||
|
if (probe.status !== 0) {
|
||||||
|
console.error(
|
||||||
|
[
|
||||||
|
`PyInstaller/faster-whisper를 사용할 수 없습니다 (python: ${python}).`,
|
||||||
|
'먼저 사이드카 환경을 준비하세요:',
|
||||||
|
' npm --prefix apps/desktop run sidecar:setup',
|
||||||
|
probe.stderr?.trim() || '',
|
||||||
|
].join('\n'),
|
||||||
|
)
|
||||||
|
process.exit(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (existsSync(outputDir)) {
|
||||||
|
rmSync(outputDir, { recursive: true, force: true })
|
||||||
|
}
|
||||||
|
|
||||||
|
const args = [
|
||||||
|
'-m',
|
||||||
|
'PyInstaller',
|
||||||
|
'--name',
|
||||||
|
'sidecar',
|
||||||
|
'--distpath',
|
||||||
|
outputDir,
|
||||||
|
'--workpath',
|
||||||
|
path.join(desktopDir, 'build', 'sidecar-build'),
|
||||||
|
'--specpath',
|
||||||
|
path.join(desktopDir, 'build'),
|
||||||
|
'--noconfirm',
|
||||||
|
'--clean',
|
||||||
|
// 패키지 데이터/바이너리 포함 (VAD onnx, ctranslate2 DLL 등)
|
||||||
|
'--collect-all',
|
||||||
|
'faster_whisper',
|
||||||
|
'--collect-all',
|
||||||
|
'ctranslate2',
|
||||||
|
'--collect-all',
|
||||||
|
'tokenizers',
|
||||||
|
'--collect-all',
|
||||||
|
'huggingface_hub',
|
||||||
|
// uvicorn은 동적 임포트를 사용하므로 명시
|
||||||
|
'--hidden-import',
|
||||||
|
'uvicorn.logging',
|
||||||
|
'--hidden-import',
|
||||||
|
'uvicorn.protocols.http',
|
||||||
|
'--hidden-import',
|
||||||
|
'uvicorn.protocols.http.auto',
|
||||||
|
'--hidden-import',
|
||||||
|
'uvicorn.protocols.http.h11_impl',
|
||||||
|
'--hidden-import',
|
||||||
|
'uvicorn.protocols.websockets',
|
||||||
|
'--hidden-import',
|
||||||
|
'uvicorn.protocols.websockets.auto',
|
||||||
|
'--hidden-import',
|
||||||
|
'uvicorn.lifespan',
|
||||||
|
'--hidden-import',
|
||||||
|
'uvicorn.lifespan.on',
|
||||||
|
'--hidden-import',
|
||||||
|
'uvicorn.lifespan.off',
|
||||||
|
mainPy,
|
||||||
|
]
|
||||||
|
|
||||||
|
console.log('='.repeat(64))
|
||||||
|
console.log(`D3RO-VOICE 사이드카 빌드 (${process.platform} ${process.arch})`)
|
||||||
|
console.log('='.repeat(64))
|
||||||
|
console.log(`\n$ ${python} ${args.join(' ')}\n`)
|
||||||
|
|
||||||
|
const result = spawnSync(python, args, { stdio: 'inherit', cwd: sidecarDir })
|
||||||
|
if (result.status !== 0) {
|
||||||
|
console.error(`\nPyInstaller 빌드 실패 (exit ${result.status ?? 'null'})`)
|
||||||
|
process.exit(result.status ?? 1)
|
||||||
|
}
|
||||||
|
|
||||||
|
const exePath = path.join(outputDir, 'sidecar', `sidecar${exeSuffix}`)
|
||||||
|
if (!existsSync(exePath)) {
|
||||||
|
console.error(`\n빌드 산출물을 찾을 수 없습니다: ${exePath}`)
|
||||||
|
process.exit(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
const exeMb = statSync(exePath).size / (1024 * 1024)
|
||||||
|
console.log(`\n빌드 성공: ${exePath} (${exeMb.toFixed(1)} MB)`)
|
||||||
|
console.log('electron-builder가 sidecar-dist/sidecar/ 를 resources/sidecar/ 로 복사한다.')
|
||||||
103
apps/desktop/scripts/setup-sidecar.mjs
Normal file
103
apps/desktop/scripts/setup-sidecar.mjs
Normal file
|
|
@ -0,0 +1,103 @@
|
||||||
|
// scripts/setup-sidecar.mjs
|
||||||
|
// STT 사이드카 개발/빌드 환경을 준비한다.
|
||||||
|
//
|
||||||
|
// - sidecar/.venv 가 없으면 생성한다.
|
||||||
|
// - requirements.txt + pyinstaller 를 설치한다.
|
||||||
|
//
|
||||||
|
// 사용: npm --prefix apps/desktop run sidecar:setup
|
||||||
|
//
|
||||||
|
// 주의: faster-whisper/ctranslate2 휠은 수백 MB이며 최초 실행 시 네트워크가 필요하다.
|
||||||
|
|
||||||
|
import { spawnSync } from 'node:child_process'
|
||||||
|
import { existsSync, mkdirSync } from 'node:fs'
|
||||||
|
import path from 'node:path'
|
||||||
|
import { fileURLToPath } from 'node:url'
|
||||||
|
|
||||||
|
const scriptDir = path.dirname(fileURLToPath(import.meta.url))
|
||||||
|
const desktopDir = path.resolve(scriptDir, '..')
|
||||||
|
const sidecarDir = path.join(desktopDir, 'sidecar')
|
||||||
|
const isWindows = process.platform === 'win32'
|
||||||
|
const venvPython = isWindows
|
||||||
|
? path.join(sidecarDir, '.venv', 'Scripts', 'python.exe')
|
||||||
|
: path.join(sidecarDir, '.venv', 'bin', 'python3')
|
||||||
|
|
||||||
|
function run(command, args, label) {
|
||||||
|
console.log(`\n$ ${command} ${args.join(' ')}`)
|
||||||
|
const result = spawnSync(command, args, { stdio: 'inherit', cwd: sidecarDir })
|
||||||
|
if (result.status !== 0) {
|
||||||
|
console.error(`\n${label} 단계가 실패했습니다 (exit ${result.status ?? 'null'})`)
|
||||||
|
process.exit(result.status ?? 1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function findSystemPython() {
|
||||||
|
const candidates = isWindows
|
||||||
|
? [
|
||||||
|
['py', ['-3.11']],
|
||||||
|
['py', ['-3']],
|
||||||
|
['python', []],
|
||||||
|
['python3', []],
|
||||||
|
]
|
||||||
|
: [
|
||||||
|
['python3.11', []],
|
||||||
|
['python3', []],
|
||||||
|
['python', []],
|
||||||
|
]
|
||||||
|
|
||||||
|
for (const [command, prefixArgs] of candidates) {
|
||||||
|
const probe = spawnSync(command, [...prefixArgs, '--version'], {
|
||||||
|
encoding: 'utf-8',
|
||||||
|
shell: isWindows,
|
||||||
|
})
|
||||||
|
if (probe.status === 0) {
|
||||||
|
console.log(`시스템 Python 발견: ${command} ${prefixArgs.join(' ')} → ${probe.stdout.trim()}`)
|
||||||
|
return { command, prefixArgs, shell: isWindows }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
console.error(
|
||||||
|
'Python 3.11+ 를 찾을 수 없습니다. https://www.python.org/downloads/ 에서 설치하거나 PATH에 추가하세요.',
|
||||||
|
)
|
||||||
|
process.exit(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
function hasModule(python, moduleName) {
|
||||||
|
return (
|
||||||
|
spawnSync(python, ['-c', `import ${moduleName}`], { stdio: 'ignore' }).status === 0
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!existsSync(sidecarDir)) {
|
||||||
|
console.error(`사이드카 디렉토리를 찾을 수 없습니다: ${sidecarDir}`)
|
||||||
|
process.exit(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (existsSync(venvPython) && hasModule(venvPython, 'faster_whisper')) {
|
||||||
|
// CI/재실행 시 불필요한 재설치를 건너뛴다 (수백 MB 다운로드 방지).
|
||||||
|
console.log(`사이드카 환경이 이미 준비되어 있습니다: ${venvPython}`)
|
||||||
|
if (!hasModule(venvPython, 'PyInstaller')) {
|
||||||
|
run(venvPython, ['-m', 'pip', 'install', 'pyinstaller>=6.0'], 'PyInstaller 설치')
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (!existsSync(venvPython)) {
|
||||||
|
const systemPython = findSystemPython()
|
||||||
|
mkdirSync(path.dirname(venvPython), { recursive: true })
|
||||||
|
run(
|
||||||
|
systemPython.command,
|
||||||
|
[...systemPython.prefixArgs, '-m', 'venv', path.join(sidecarDir, '.venv')],
|
||||||
|
'가상환경 생성',
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
console.log(`기존 가상환경 사용: ${venvPython}`)
|
||||||
|
}
|
||||||
|
|
||||||
|
run(venvPython, ['-m', 'pip', 'install', '--upgrade', 'pip'], 'pip 업그레이드')
|
||||||
|
run(
|
||||||
|
venvPython,
|
||||||
|
['-m', 'pip', 'install', '-r', path.join(sidecarDir, 'requirements.txt')],
|
||||||
|
'사이드카 의존성 설치',
|
||||||
|
)
|
||||||
|
run(venvPython, ['-m', 'pip', 'install', 'pyinstaller>=6.0'], 'PyInstaller 설치')
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('\n사이드카 환경 준비 완료.')
|
||||||
|
|
@ -39,6 +39,14 @@ from fastapi.responses import JSONResponse
|
||||||
|
|
||||||
# ── 로깅 설정 ──────────────────────────────────────────────
|
# ── 로깅 설정 ──────────────────────────────────────────────
|
||||||
|
|
||||||
|
# Windows에서 파이프로 연결되면 Python이 로케일(cp949) 인코딩으로 출력해
|
||||||
|
# 메인 프로세스의 UTF-8 로그가 깨진다. 명시적으로 UTF-8로 고정한다.
|
||||||
|
for _stream in (sys.stdout, sys.stderr):
|
||||||
|
try:
|
||||||
|
_stream.reconfigure(encoding="utf-8", errors="replace") # type: ignore[union-attr]
|
||||||
|
except (AttributeError, ValueError):
|
||||||
|
pass
|
||||||
|
|
||||||
logging.basicConfig(
|
logging.basicConfig(
|
||||||
level=logging.INFO,
|
level=logging.INFO,
|
||||||
format="[%(asctime)s] [%(levelname)s] [%(name)s] %(message)s",
|
format="[%(asctime)s] [%(levelname)s] [%(name)s] %(message)s",
|
||||||
|
|
@ -121,6 +129,11 @@ def _detect_gpu() -> None:
|
||||||
logger.info("GPU 감지 실패, CPU 모드로 동작: %s", exc)
|
logger.info("GPU 감지 실패, CPU 모드로 동작: %s", exc)
|
||||||
|
|
||||||
|
|
||||||
|
def _cpu_threads() -> int:
|
||||||
|
"""CPU 추론에 사용할 스레드 수 (과도한 점유 방지 위해 8로 상한)."""
|
||||||
|
return max(1, min(8, os.cpu_count() or 4))
|
||||||
|
|
||||||
|
|
||||||
# ── 모델 다운로드 헬퍼 ─────────────────────────────────────
|
# ── 모델 다운로드 헬퍼 ─────────────────────────────────────
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -250,6 +263,52 @@ def _cleanup_partial(model_id: str) -> None:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
def _build_transcribe_kwargs(
|
||||||
|
language: str,
|
||||||
|
vad_filter: str,
|
||||||
|
initial_prompt: str,
|
||||||
|
is_partial: bool,
|
||||||
|
) -> dict:
|
||||||
|
"""전사 옵션을 만든다.
|
||||||
|
|
||||||
|
받아쓰기 정합성을 위해 컨텍스트 누적(condition_on_previous_text)을 끈다.
|
||||||
|
Whisper가 앞 세그먼트 오류를 반복 증폭하는 현상(환각 루프)을 막는다.
|
||||||
|
미리보기(partial)는 지연이 목표이므로 greedy + VAD 없음으로 디코딩한다.
|
||||||
|
"""
|
||||||
|
if is_partial:
|
||||||
|
kwargs: dict = {
|
||||||
|
"beam_size": 1,
|
||||||
|
"temperature": 0.0,
|
||||||
|
"vad_filter": False,
|
||||||
|
"condition_on_previous_text": False,
|
||||||
|
"word_timestamps": False,
|
||||||
|
}
|
||||||
|
else:
|
||||||
|
kwargs = {
|
||||||
|
"beam_size": 5,
|
||||||
|
# 0.0 단일 온도는 실패 시 재시도가 없어 환각이 남는다.
|
||||||
|
# 낮은 온도 폴백만 허용하되 컨텍스트를 끊어 반복을 차단한다.
|
||||||
|
"temperature": [0.0, 0.2, 0.4],
|
||||||
|
"condition_on_previous_text": False,
|
||||||
|
"no_speech_threshold": 0.6,
|
||||||
|
"compression_ratio_threshold": 2.4,
|
||||||
|
"log_prob_threshold": -1.0,
|
||||||
|
"vad_filter": vad_filter.lower() == "true",
|
||||||
|
"word_timestamps": False,
|
||||||
|
}
|
||||||
|
if kwargs["vad_filter"]:
|
||||||
|
# 무음 구간을 촘촘히 잘라 속도를 올린다.
|
||||||
|
kwargs["vad_parameters"] = {"min_silence_duration_ms": 300}
|
||||||
|
|
||||||
|
if language != "auto":
|
||||||
|
kwargs["language"] = language
|
||||||
|
|
||||||
|
if initial_prompt and not is_partial:
|
||||||
|
kwargs["initial_prompt"] = initial_prompt
|
||||||
|
|
||||||
|
return kwargs
|
||||||
|
|
||||||
|
|
||||||
# ── 엔드포인트 ─────────────────────────────────────────────
|
# ── 엔드포인트 ─────────────────────────────────────────────
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -260,7 +319,9 @@ async def health() -> JSONResponse:
|
||||||
content={
|
content={
|
||||||
"status": "ready" if _model is not None else "no_model",
|
"status": "ready" if _model is not None else "no_model",
|
||||||
"model": _model_id,
|
"model": _model_id,
|
||||||
|
"model_loaded": _model is not None,
|
||||||
"gpu": _gpu_available,
|
"gpu": _gpu_available,
|
||||||
|
"device": "cuda" if _gpu_available else "cpu",
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -282,6 +343,18 @@ async def load_model(body: dict) -> JSONResponse: # noqa: ANN001
|
||||||
|
|
||||||
start_time = time.monotonic()
|
start_time = time.monotonic()
|
||||||
|
|
||||||
|
# 같은 모델이 이미 로딩되어 있으면 재사용 (재로딩은 수초 지연을 만든다)
|
||||||
|
if _model is not None and _model_id == model_id:
|
||||||
|
logger.info("이미 로딩된 모델 재사용: %s", model_id)
|
||||||
|
return JSONResponse(
|
||||||
|
content={
|
||||||
|
"status": "loaded",
|
||||||
|
"model_id": model_id,
|
||||||
|
"load_time_ms": 0,
|
||||||
|
"reused": True,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from faster_whisper import WhisperModel
|
from faster_whisper import WhisperModel
|
||||||
|
|
||||||
|
|
@ -295,10 +368,15 @@ async def load_model(body: dict) -> JSONResponse: # noqa: ANN001
|
||||||
if local_dir:
|
if local_dir:
|
||||||
logger.info("로컬 모델 디렉토리 사용: %s", local_dir)
|
logger.info("로컬 모델 디렉토리 사용: %s", local_dir)
|
||||||
|
|
||||||
|
# 모델 교체 시 이전 모델을 먼저 해제해 VRAM/RAM을 회수한다.
|
||||||
|
_model = None
|
||||||
|
|
||||||
_model = WhisperModel(
|
_model = WhisperModel(
|
||||||
model_source,
|
model_source,
|
||||||
device=device,
|
device=device,
|
||||||
compute_type=compute_type,
|
compute_type=compute_type,
|
||||||
|
cpu_threads=_cpu_threads(),
|
||||||
|
num_workers=1,
|
||||||
)
|
)
|
||||||
_model_id = model_id
|
_model_id = model_id
|
||||||
|
|
||||||
|
|
@ -333,6 +411,7 @@ async def transcribe(
|
||||||
language: str = Form("auto"),
|
language: str = Form("auto"),
|
||||||
vad_filter: str = Form("true"),
|
vad_filter: str = Form("true"),
|
||||||
initial_prompt: str = Form(""),
|
initial_prompt: str = Form(""),
|
||||||
|
partial: str = Form("false"),
|
||||||
) -> JSONResponse:
|
) -> JSONResponse:
|
||||||
"""오디오 파일을 전사한다.
|
"""오디오 파일을 전사한다.
|
||||||
|
|
||||||
|
|
@ -341,6 +420,7 @@ async def transcribe(
|
||||||
language - 언어 코드 ('auto', 'ko', 'en', ...)
|
language - 언어 코드 ('auto', 'ko', 'en', ...)
|
||||||
vad_filter - VAD 필터 활성화 ('true' / 'false')
|
vad_filter - VAD 필터 활성화 ('true' / 'false')
|
||||||
initial_prompt - 초기 프롬프트 (컨텍스트 힌트)
|
initial_prompt - 초기 프롬프트 (컨텍스트 힌트)
|
||||||
|
partial - 녹음 중 미리보기 모드 ('true'면 greedy 디코딩 + 컨텍스트 미사용)
|
||||||
"""
|
"""
|
||||||
if _model is None:
|
if _model is None:
|
||||||
return JSONResponse(
|
return JSONResponse(
|
||||||
|
|
@ -348,6 +428,7 @@ async def transcribe(
|
||||||
content={"status": "error", "message": "모델이 로딩되지 않았습니다"},
|
content={"status": "error", "message": "모델이 로딩되지 않았습니다"},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
is_partial = partial.lower() == "true"
|
||||||
start_time = time.monotonic()
|
start_time = time.monotonic()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
@ -367,22 +448,19 @@ async def transcribe(
|
||||||
audio_duration = len(audio_array) / sample_rate
|
audio_duration = len(audio_array) / sample_rate
|
||||||
|
|
||||||
logger.info(
|
logger.info(
|
||||||
"전사 시작: %.1f초 오디오, language=%s, vad=%s",
|
"전사 시작: %.1f초 오디오, language=%s, vad=%s, partial=%s",
|
||||||
audio_duration,
|
audio_duration,
|
||||||
language,
|
language,
|
||||||
vad_filter,
|
vad_filter,
|
||||||
|
is_partial,
|
||||||
)
|
)
|
||||||
|
|
||||||
transcribe_kwargs: dict = {
|
transcribe_kwargs = _build_transcribe_kwargs(
|
||||||
"vad_filter": vad_filter.lower() == "true",
|
language=language,
|
||||||
"beam_size": 5,
|
vad_filter=vad_filter,
|
||||||
}
|
initial_prompt=initial_prompt,
|
||||||
|
is_partial=is_partial,
|
||||||
if language != "auto":
|
)
|
||||||
transcribe_kwargs["language"] = language
|
|
||||||
|
|
||||||
if initial_prompt:
|
|
||||||
transcribe_kwargs["initial_prompt"] = initial_prompt
|
|
||||||
|
|
||||||
# VAD가 전체 오디오를 제거하면 max() 에러 발생 → VAD 없이 재시도
|
# VAD가 전체 오디오를 제거하면 max() 에러 발생 → VAD 없이 재시도
|
||||||
try:
|
try:
|
||||||
|
|
|
||||||
|
|
@ -63,6 +63,7 @@ export async function bootstrap(): Promise<void> {
|
||||||
{ name: 'popup-preload', critical: false, fn: initPopupWindows },
|
{ name: 'popup-preload', critical: false, fn: initPopupWindows },
|
||||||
{ name: 'hotkey', critical: false, fn: initHotkey },
|
{ name: 'hotkey', critical: false, fn: initHotkey },
|
||||||
{ name: 'voice-mode', critical: false, fn: initVoiceMode },
|
{ name: 'voice-mode', critical: false, fn: initVoiceMode },
|
||||||
|
{ name: 'stt-warmup', critical: false, fn: initSTTWarmup },
|
||||||
{ name: 'llm-polling', critical: false, fn: initLLMPolling },
|
{ name: 'llm-polling', critical: false, fn: initLLMPolling },
|
||||||
{ name: 'meeting-summary-wiring', critical: false, fn: initMeetingSummaryWiring },
|
{ name: 'meeting-summary-wiring', critical: false, fn: initMeetingSummaryWiring },
|
||||||
{ name: 'meeting-mode', critical: false, fn: initMeetingMode },
|
{ name: 'meeting-mode', critical: false, fn: initMeetingMode },
|
||||||
|
|
@ -270,6 +271,20 @@ async function initLLMPolling(): Promise<void> {
|
||||||
await startLocalLLMAvailability()
|
await startLocalLLMAvailability()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 로컬 STT(sidecar + Whisper 모델)를 앱 시작 시 백그라운드로 미리 데운다.
|
||||||
|
* 첫 받아쓰기에서 모델 로딩(수초)을 기다리는 체감 지연을 없앤다.
|
||||||
|
* bootstrap을 막지 않도록 await하지 않는다 — 실패는 warmUpLocal이 흡수한다.
|
||||||
|
*/
|
||||||
|
async function initSTTWarmup(): Promise<void> {
|
||||||
|
try {
|
||||||
|
const { getSTTManager } = await import('./services/stt/STTManager')
|
||||||
|
void getSTTManager().warmUpLocal()
|
||||||
|
} catch (err) {
|
||||||
|
logger.warn('STT warmup scheduling failed:', err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async function initCloudSync(): Promise<void> {
|
async function initCloudSync(): Promise<void> {
|
||||||
const { getCloudSyncService } = await import('./services/CloudSyncService')
|
const { getCloudSyncService } = await import('./services/CloudSyncService')
|
||||||
const sync = getCloudSyncService()
|
const sync = getCloudSyncService()
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ import { getLocalLLMService } from '../services/LocalLLMService'
|
||||||
import { getPremiumLLMService } from '../services/PremiumLLMService'
|
import { getPremiumLLMService } from '../services/PremiumLLMService'
|
||||||
import { getOnlineLLMService } from '../services/OnlineLLMService'
|
import { getOnlineLLMService } from '../services/OnlineLLMService'
|
||||||
import { configGet, configSet } from '../services/ConfigService'
|
import { configGet, configSet } from '../services/ConfigService'
|
||||||
|
import { normalizeLoopbackUrl } from '../utils/loopback'
|
||||||
import { getMainWindow } from '../windows/WindowManager'
|
import { getMainWindow } from '../windows/WindowManager'
|
||||||
import type { SetLLMModelParams, SetServerUrlParams, LLMProcessParams } from '@d3ro/core/types'
|
import type { SetLLMModelParams, SetServerUrlParams, LLMProcessParams } from '@d3ro/core/types'
|
||||||
|
|
||||||
|
|
@ -129,7 +130,7 @@ export function registerLLMHandlers(): void {
|
||||||
|
|
||||||
// ONLINE AUTH HANDLERS
|
// ONLINE AUTH HANDLERS
|
||||||
ipcMain.handle(IPC_CHANNELS.ONLINE_AUTH.REGISTER, async (_event, params: { email: string; password: string }) => {
|
ipcMain.handle(IPC_CHANNELS.ONLINE_AUTH.REGISTER, async (_event, params: { email: string; password: string }) => {
|
||||||
const apiUrl = configGet('onlineApiUrl') ?? 'http://localhost:5000'
|
const apiUrl = normalizeLoopbackUrl(configGet('onlineApiUrl') ?? 'http://127.0.0.1:5000')
|
||||||
try {
|
try {
|
||||||
const res = await fetch(`${apiUrl}/api/auth/register`, {
|
const res = await fetch(`${apiUrl}/api/auth/register`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
|
@ -151,7 +152,7 @@ export function registerLLMHandlers(): void {
|
||||||
})
|
})
|
||||||
|
|
||||||
ipcMain.handle(IPC_CHANNELS.ONLINE_AUTH.LOGIN, async (_event, params: { email: string; password: string }) => {
|
ipcMain.handle(IPC_CHANNELS.ONLINE_AUTH.LOGIN, async (_event, params: { email: string; password: string }) => {
|
||||||
const apiUrl = configGet('onlineApiUrl') ?? 'http://localhost:5000'
|
const apiUrl = normalizeLoopbackUrl(configGet('onlineApiUrl') ?? 'http://127.0.0.1:5000')
|
||||||
try {
|
try {
|
||||||
const res = await fetch(`${apiUrl}/api/auth/login`, {
|
const res = await fetch(`${apiUrl}/api/auth/login`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
|
|
||||||
|
|
@ -135,7 +135,7 @@ class AudioCaptureService extends EventEmitter {
|
||||||
]
|
]
|
||||||
|
|
||||||
logger.info(`SoX args: ${soxArgs.join(' ')}`)
|
logger.info(`SoX args: ${soxArgs.join(' ')}`)
|
||||||
this._soxProcess = spawn(soxExe, soxArgs, { stdio: ['pipe', 'pipe', 'pipe'] })
|
this._soxProcess = spawn(soxExe, soxArgs, { stdio: ['pipe', 'pipe', 'pipe'], windowsHide: true })
|
||||||
this._stream = this._soxProcess.stdout
|
this._stream = this._soxProcess.stdout
|
||||||
this._residualBuffer = Buffer.alloc(0)
|
this._residualBuffer = Buffer.alloc(0)
|
||||||
this._levelAccumulator = []
|
this._levelAccumulator = []
|
||||||
|
|
@ -168,8 +168,12 @@ class AudioCaptureService extends EventEmitter {
|
||||||
|
|
||||||
this._soxProcess.on('error', (err: Error) => {
|
this._soxProcess.on('error', (err: Error) => {
|
||||||
logger.error(`SoX process spawn error: ${err.message}`)
|
logger.error(`SoX process spawn error: ${err.message}`)
|
||||||
|
const hint =
|
||||||
|
soxExe === 'sox' && (err as NodeJS.ErrnoException).code === 'ENOENT'
|
||||||
|
? ' 번들된 SoX(resources/sox/sox.exe)도, 시스템 PATH의 sox도 없습니다. `npm --prefix apps/desktop run setup:sox`로 내려받으세요.'
|
||||||
|
: ''
|
||||||
this._handleError(
|
this._handleError(
|
||||||
new D3ROError(ErrorCode.AudioCaptureStartFailed, `SoX 프로세스 시작 실패: ${err.message}`),
|
new D3ROError(ErrorCode.AudioCaptureStartFailed, `SoX 프로세스 시작 실패: ${err.message}.${hint}`),
|
||||||
'error'
|
'error'
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
@ -392,7 +396,7 @@ class AudioCaptureService extends EventEmitter {
|
||||||
'-b', '16', '-e', 'signed-integer', '-t', 'raw', '-']
|
'-b', '16', '-e', 'signed-integer', '-t', 'raw', '-']
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
const proc = spawn(soxExe, soxArgs, { stdio: ['ignore', 'pipe', 'pipe'] })
|
const proc = spawn(soxExe, soxArgs, { stdio: ['ignore', 'pipe', 'pipe'], windowsHide: true })
|
||||||
const buffers: Buffer[] = []
|
const buffers: Buffer[] = []
|
||||||
let peakRms = 0
|
let peakRms = 0
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,13 +26,13 @@ const CONFIG_DEFAULTS: AppConfig = {
|
||||||
sttProvider: 'local' as const,
|
sttProvider: 'local' as const,
|
||||||
sttProviderConfigs: {
|
sttProviderConfigs: {
|
||||||
local: { modelId: 'large-v3-turbo' },
|
local: { modelId: 'large-v3-turbo' },
|
||||||
'd3ro-cloud': { modelId: 'default', apiKey: '', baseUrl: 'http://localhost:5000' },
|
'd3ro-cloud': { modelId: 'default', apiKey: '', baseUrl: 'http://127.0.0.1:5000' },
|
||||||
openai: { modelId: 'whisper-1', apiKey: '', baseUrl: 'https://api.openai.com/v1' },
|
openai: { modelId: 'whisper-1', apiKey: '', baseUrl: 'https://api.openai.com/v1' },
|
||||||
groq: { modelId: 'whisper-large-v3-turbo', apiKey: '', baseUrl: 'https://api.groq.com/openai/v1' },
|
groq: { modelId: 'whisper-large-v3-turbo', apiKey: '', baseUrl: 'https://api.groq.com/openai/v1' },
|
||||||
deepgram: { modelId: 'nova-3', apiKey: '', baseUrl: 'https://api.deepgram.com' },
|
deepgram: { modelId: 'nova-3', apiKey: '', baseUrl: 'https://api.deepgram.com' },
|
||||||
assemblyai: { modelId: 'best', apiKey: '', baseUrl: 'https://api.assemblyai.com/v2' },
|
assemblyai: { modelId: 'best', apiKey: '', baseUrl: 'https://api.assemblyai.com/v2' },
|
||||||
google: { modelId: 'gemini-2.0-flash', apiKey: '', baseUrl: 'https://generativelanguage.googleapis.com/v1beta' },
|
google: { modelId: 'gemini-2.0-flash', apiKey: '', baseUrl: 'https://generativelanguage.googleapis.com/v1beta' },
|
||||||
custom: { modelId: 'whisper-1', apiKey: '', baseUrl: 'http://localhost:8000/v1' },
|
custom: { modelId: 'whisper-1', apiKey: '', baseUrl: 'http://127.0.0.1:8000/v1' },
|
||||||
},
|
},
|
||||||
sttFallbackToLocal: true,
|
sttFallbackToLocal: true,
|
||||||
// large-v3 대비 6배 빠르고 정확도 손실 1~2%, 다운로드 1.6GB (온보딩에서 사전 다운로드)
|
// large-v3 대비 6배 빠르고 정확도 손실 1~2%, 다운로드 1.6GB (온보딩에서 사전 다운로드)
|
||||||
|
|
@ -40,10 +40,10 @@ const CONFIG_DEFAULTS: AppConfig = {
|
||||||
sttLanguage: 'auto',
|
sttLanguage: 'auto',
|
||||||
ttsVoiceId: null,
|
ttsVoiceId: null,
|
||||||
ttsSpeed: 1.0,
|
ttsSpeed: 1.0,
|
||||||
onlineApiUrl: 'http://localhost:5000',
|
onlineApiUrl: 'http://127.0.0.1:5000',
|
||||||
localModelsDir: '',
|
localModelsDir: '',
|
||||||
llmModelId: 'gemma-2-2b-it.Q4_K_M.gguf',
|
llmModelId: 'gemma-2-2b-it.Q4_K_M.gguf',
|
||||||
ollamaServerUrl: 'http://localhost:11434',
|
ollamaServerUrl: 'http://127.0.0.1:11434',
|
||||||
appUsageMode: null,
|
appUsageMode: null,
|
||||||
authToken: null,
|
authToken: null,
|
||||||
userEmail: null,
|
userEmail: null,
|
||||||
|
|
|
||||||
|
|
@ -12,9 +12,15 @@ import { D3ROError, ErrorCode } from '@d3ro/core/errors'
|
||||||
import type { LLMStatus, LLMModel, LLMAction, LLMConnectionState } from '@d3ro/core/types'
|
import type { LLMStatus, LLMModel, LLMAction, LLMConnectionState } from '@d3ro/core/types'
|
||||||
import { resolveSystemPrompt } from './llm-prompts'
|
import { resolveSystemPrompt } from './llm-prompts'
|
||||||
import { getBundledOllamaPath } from '../utils/paths'
|
import { getBundledOllamaPath } from '../utils/paths'
|
||||||
|
import { normalizeLoopbackUrl } from '../utils/loopback'
|
||||||
|
|
||||||
const logger = getLogger('LocalLLMService')
|
const logger = getLogger('LocalLLMService')
|
||||||
|
|
||||||
|
/** Ollama 서버 URL — localhost는 ::1로 해석되어 실패하므로 IPv4 루프백으로 정규화한다. */
|
||||||
|
export function getOllamaServerUrl(): string {
|
||||||
|
return normalizeLoopbackUrl(configGet('ollamaServerUrl') || 'http://127.0.0.1:11434')
|
||||||
|
}
|
||||||
|
|
||||||
// ============================================================
|
// ============================================================
|
||||||
// 내부 타입
|
// 내부 타입
|
||||||
// ============================================================
|
// ============================================================
|
||||||
|
|
@ -172,7 +178,7 @@ class LocalLLMService extends EventEmitter {
|
||||||
* Ollama /api/version 또는 /api/tags 엔드포인트로 가용성 핑. 지정 타임아웃 내 응답이 오면 true.
|
* Ollama /api/version 또는 /api/tags 엔드포인트로 가용성 핑. 지정 타임아웃 내 응답이 오면 true.
|
||||||
*/
|
*/
|
||||||
private async _ping(timeoutMs: number): Promise<boolean> {
|
private async _ping(timeoutMs: number): Promise<boolean> {
|
||||||
const serverUrl = configGet('ollamaServerUrl') || 'http://localhost:11434'
|
const serverUrl = getOllamaServerUrl()
|
||||||
try {
|
try {
|
||||||
const response = await fetch(`${serverUrl}/api/version`, {
|
const response = await fetch(`${serverUrl}/api/version`, {
|
||||||
signal: AbortSignal.timeout(timeoutMs)
|
signal: AbortSignal.timeout(timeoutMs)
|
||||||
|
|
@ -325,7 +331,7 @@ class LocalLLMService extends EventEmitter {
|
||||||
throw new D3ROError(ErrorCode.LLMServerUnreachable, 'Ollama 서버에 연결할 수 없습니다')
|
throw new D3ROError(ErrorCode.LLMServerUnreachable, 'Ollama 서버에 연결할 수 없습니다')
|
||||||
}
|
}
|
||||||
|
|
||||||
const serverUrl = configGet('ollamaServerUrl')
|
const serverUrl = getOllamaServerUrl()
|
||||||
const model = options?.model ?? configGet('llmModelId') ?? 'gemma4:e4b'
|
const model = options?.model ?? configGet('llmModelId') ?? 'gemma4:e4b'
|
||||||
|
|
||||||
this._state = LLMState.Generating
|
this._state = LLMState.Generating
|
||||||
|
|
@ -392,7 +398,7 @@ class LocalLLMService extends EventEmitter {
|
||||||
throw new D3ROError(ErrorCode.LLMServerUnreachable, 'Ollama 서버에 연결할 수 없습니다')
|
throw new D3ROError(ErrorCode.LLMServerUnreachable, 'Ollama 서버에 연결할 수 없습니다')
|
||||||
}
|
}
|
||||||
|
|
||||||
const serverUrl = configGet('ollamaServerUrl')
|
const serverUrl = getOllamaServerUrl()
|
||||||
const model = options?.model ?? configGet('llmModelId') ?? 'gemma4:e4b'
|
const model = options?.model ?? configGet('llmModelId') ?? 'gemma4:e4b'
|
||||||
|
|
||||||
this._state = LLMState.Generating
|
this._state = LLMState.Generating
|
||||||
|
|
@ -536,7 +542,7 @@ class LocalLLMService extends EventEmitter {
|
||||||
* Ollama에 설치된 모델 목록을 조회한다.
|
* Ollama에 설치된 모델 목록을 조회한다.
|
||||||
*/
|
*/
|
||||||
async getModels(): Promise<LLMModel[]> {
|
async getModels(): Promise<LLMModel[]> {
|
||||||
const serverUrl = configGet('ollamaServerUrl')
|
const serverUrl = getOllamaServerUrl()
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await fetch(`${serverUrl}/api/tags`, {
|
const response = await fetch(`${serverUrl}/api/tags`, {
|
||||||
|
|
@ -582,7 +588,7 @@ class LocalLLMService extends EventEmitter {
|
||||||
}
|
}
|
||||||
|
|
||||||
private async _doPullModel(modelId: string): Promise<void> {
|
private async _doPullModel(modelId: string): Promise<void> {
|
||||||
const serverUrl = configGet('ollamaServerUrl')
|
const serverUrl = getOllamaServerUrl()
|
||||||
logger.info(`Pull 시작: ${modelId}`)
|
logger.info(`Pull 시작: ${modelId}`)
|
||||||
|
|
||||||
const response = await fetch(`${serverUrl}/api/pull`, {
|
const response = await fetch(`${serverUrl}/api/pull`, {
|
||||||
|
|
@ -656,7 +662,7 @@ class LocalLLMService extends EventEmitter {
|
||||||
|
|
||||||
return {
|
return {
|
||||||
connectionState,
|
connectionState,
|
||||||
serverUrl: configGet('ollamaServerUrl') || 'http://localhost:11434',
|
serverUrl: getOllamaServerUrl(),
|
||||||
activeModel: configGet('llmModelId') || 'gemma2:2b',
|
activeModel: configGet('llmModelId') || 'gemma2:2b',
|
||||||
serverVersion: this._serverVersion
|
serverVersion: this._serverVersion
|
||||||
}
|
}
|
||||||
|
|
@ -679,7 +685,7 @@ class LocalLLMService extends EventEmitter {
|
||||||
throw new D3ROError(ErrorCode.LLMServerUnreachable, 'Ollama server not available')
|
throw new D3ROError(ErrorCode.LLMServerUnreachable, 'Ollama server not available')
|
||||||
}
|
}
|
||||||
|
|
||||||
const serverUrl = configGet('ollamaServerUrl') || 'http://localhost:11434'
|
const serverUrl = getOllamaServerUrl()
|
||||||
const model = options?.model ?? configGet('llmModelId') ?? 'gemma2:2b'
|
const model = options?.model ?? configGet('llmModelId') ?? 'gemma2:2b'
|
||||||
|
|
||||||
this._abortController = new AbortController()
|
this._abortController = new AbortController()
|
||||||
|
|
@ -754,7 +760,7 @@ class LocalLLMService extends EventEmitter {
|
||||||
|
|
||||||
private async _checkAvailability(): Promise<void> {
|
private async _checkAvailability(): Promise<void> {
|
||||||
if (this._disposed) return
|
if (this._disposed) return
|
||||||
const serverUrl = configGet('ollamaServerUrl') || 'http://localhost:11434'
|
const serverUrl = getOllamaServerUrl()
|
||||||
|
|
||||||
let isOk = false
|
let isOk = false
|
||||||
let detectedVersion: string | null = null
|
let detectedVersion: string | null = null
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ import { existsSync } from 'fs'
|
||||||
import { join } from 'path'
|
import { join } from 'path'
|
||||||
import { getLogger } from './LoggerService'
|
import { getLogger } from './LoggerService'
|
||||||
import { configGet } from './ConfigService'
|
import { configGet } from './ConfigService'
|
||||||
import { getSidecarCommand, getWhisperModelsDir } from '../utils/paths'
|
import { getSidecarCommand, getSidecarBaseUrl, getWhisperModelsDir } from '../utils/paths'
|
||||||
import { D3ROError, ErrorCode } from '@d3ro/core/errors'
|
import { D3ROError, ErrorCode } from '@d3ro/core/errors'
|
||||||
import type {
|
import type {
|
||||||
STTModel,
|
STTModel,
|
||||||
|
|
@ -52,6 +52,8 @@ export interface TranscribeOptions {
|
||||||
language?: string
|
language?: string
|
||||||
initialPrompt?: string
|
initialPrompt?: string
|
||||||
vadFilter?: boolean
|
vadFilter?: boolean
|
||||||
|
/** 음 중 실시간 미리보기 요청 — 상태/이벤트를 건드리지 않고 greedy 디코딩을 사용한다. */
|
||||||
|
partial?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
/** sidecar /health 응답 */
|
/** sidecar /health 응답 */
|
||||||
|
|
@ -109,6 +111,8 @@ const HEALTH_CHECK_INTERVAL_MS = 1000
|
||||||
const HEALTH_CHECK_TIMEOUT_MS = 30000
|
const HEALTH_CHECK_TIMEOUT_MS = 30000
|
||||||
const MAX_RESTART_COUNT = 3
|
const MAX_RESTART_COUNT = 3
|
||||||
const SIDECAR_REQUEST_TIMEOUT_MS = 120000
|
const SIDECAR_REQUEST_TIMEOUT_MS = 120000
|
||||||
|
/** 부분 전사(미리보기) 타임아웃 — 실패해도 무시되므로 짧게 잡는다 */
|
||||||
|
const SIDECAR_PARTIAL_TIMEOUT_MS = 15000
|
||||||
|
|
||||||
/** 알려진 Whisper 모델 카탈로그 */
|
/** 알려진 Whisper 모델 카탈로그 */
|
||||||
const MODEL_CATALOG: STTModel[] = [
|
const MODEL_CATALOG: STTModel[] = [
|
||||||
|
|
@ -207,6 +211,11 @@ class LocalSTTService extends EventEmitter {
|
||||||
return this._currentModelId
|
return this._currentModelId
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** sidecar HTTP 기본 URL — IPv4 루프백 고정 (localhost는 ::1로 해석되어 실패) */
|
||||||
|
private get _baseUrl(): string {
|
||||||
|
return getSidecarBaseUrl(this._port)
|
||||||
|
}
|
||||||
|
|
||||||
// ── 공개 메서드 ──
|
// ── 공개 메서드 ──
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -300,6 +309,65 @@ class LocalSTTService extends EventEmitter {
|
||||||
return this._sendToSidecar(audioBuffer, options)
|
return this._sendToSidecar(audioBuffer, options)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 앱 시작 시 sidecar와 모델을 미리 데운다.
|
||||||
|
* 첫 받아쓰기에서 모델 로딩(수초)을 기다리지 않게 하는 것이 목적이므로
|
||||||
|
* 실패는 조용히 경고로만 남기고 예외를 던지지 않는다.
|
||||||
|
*/
|
||||||
|
async warmUp(): Promise<boolean> {
|
||||||
|
if (this._disposed) return false
|
||||||
|
if (this._state === STTState.Ready && this._currentModelId) return true
|
||||||
|
|
||||||
|
const modelId = configGet('sttModelId')
|
||||||
|
if (!modelId) {
|
||||||
|
logger.info('STT 워밍업 생략: 모델이 선택되지 않았습니다')
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!existsSync(join(getWhisperModelsDir(), modelId, 'model.bin'))) {
|
||||||
|
logger.info(`STT 워밍업 생략: 모델 미설치 (${modelId})`)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
await this.initialize(modelId)
|
||||||
|
return true
|
||||||
|
} catch (err) {
|
||||||
|
logger.warn(
|
||||||
|
`STT 워밍업 실패: ${err instanceof Error ? err.message : String(err)}`,
|
||||||
|
)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 녹음 중 실시간 미리보기 전사.
|
||||||
|
* 최종 결과와 분리되어 삽입되지 않으며, 실패해도 빈 문자열을 반환한다.
|
||||||
|
* 지연 최소화를 위해 상태/이벤트를 건드리지 않는다.
|
||||||
|
*/
|
||||||
|
async transcribePartial(
|
||||||
|
audioBuffer: Buffer,
|
||||||
|
options?: TranscribeOptions,
|
||||||
|
): Promise<string> {
|
||||||
|
if (this._disposed) return ''
|
||||||
|
if (!this._modelReady) return ''
|
||||||
|
if (audioBuffer.length === 0) return ''
|
||||||
|
if (!this._sidecarProcess || this._sidecarProcess.exitCode !== null) return ''
|
||||||
|
|
||||||
|
try {
|
||||||
|
const result = await this._sendToSidecar(audioBuffer, {
|
||||||
|
...options,
|
||||||
|
partial: true,
|
||||||
|
})
|
||||||
|
return result.text
|
||||||
|
} catch (err) {
|
||||||
|
logger.debug(
|
||||||
|
`부분 전사 실패(무시): ${err instanceof Error ? err.message : String(err)}`,
|
||||||
|
)
|
||||||
|
return ''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 다운로드된 모델 목록 조회.
|
* 다운로드된 모델 목록 조회.
|
||||||
* models-dir 사전 다운로드 여부 + 현재 로딩 여부로 downloaded를 판정한다.
|
* models-dir 사전 다운로드 여부 + 현재 로딩 여부로 downloaded를 판정한다.
|
||||||
|
|
@ -328,7 +396,7 @@ class LocalSTTService extends EventEmitter {
|
||||||
|
|
||||||
await this._ensureSidecarRunning()
|
await this._ensureSidecarRunning()
|
||||||
|
|
||||||
const startRes = await fetch(`http://localhost:${this._port}/download`, {
|
const startRes = await fetch(`${this._baseUrl}/download`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: { 'Content-Type': 'application/json' },
|
headers: { 'Content-Type': 'application/json' },
|
||||||
body: JSON.stringify({ model_id: modelId }),
|
body: JSON.stringify({ model_id: modelId }),
|
||||||
|
|
@ -361,7 +429,7 @@ class LocalSTTService extends EventEmitter {
|
||||||
|
|
||||||
let status: DownloadStatusResponse
|
let status: DownloadStatusResponse
|
||||||
try {
|
try {
|
||||||
const res = await fetch(`http://localhost:${this._port}/download/status`, {
|
const res = await fetch(`${this._baseUrl}/download/status`, {
|
||||||
signal: AbortSignal.timeout(3000),
|
signal: AbortSignal.timeout(3000),
|
||||||
})
|
})
|
||||||
if (!res.ok) throw new Error(`HTTP ${res.status}`)
|
if (!res.ok) throw new Error(`HTTP ${res.status}`)
|
||||||
|
|
@ -408,7 +476,7 @@ class LocalSTTService extends EventEmitter {
|
||||||
/** 진행 중인 모델 다운로드 취소 요청 */
|
/** 진행 중인 모델 다운로드 취소 요청 */
|
||||||
async cancelDownload(): Promise<void> {
|
async cancelDownload(): Promise<void> {
|
||||||
try {
|
try {
|
||||||
await fetch(`http://localhost:${this._port}/download/cancel`, {
|
await fetch(`${this._baseUrl}/download/cancel`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
signal: AbortSignal.timeout(3000),
|
signal: AbortSignal.timeout(3000),
|
||||||
})
|
})
|
||||||
|
|
@ -570,77 +638,120 @@ class LocalSTTService extends EventEmitter {
|
||||||
// dev mode HMR/재시작으로 이전 sidecar가 orphan으로 남아있을 수 있음.
|
// dev mode HMR/재시작으로 이전 sidecar가 orphan으로 남아있을 수 있음.
|
||||||
this._port = await this._findFreePort(SIDECAR_PORT, 20)
|
this._port = await this._findFreePort(SIDECAR_PORT, 20)
|
||||||
|
|
||||||
const { command, args } = getSidecarCommand()
|
// 번들/venv 경로가 깨졌으면 여기서 즉시 실패한다 (조용한 PATH 폴백 금지).
|
||||||
|
const launch = getSidecarCommand()
|
||||||
const fullArgs = [
|
const fullArgs = [
|
||||||
...args,
|
...launch.args,
|
||||||
'--port',
|
'--port',
|
||||||
String(this._port),
|
String(this._port),
|
||||||
'--models-dir',
|
'--models-dir',
|
||||||
getWhisperModelsDir(),
|
getWhisperModelsDir(),
|
||||||
]
|
]
|
||||||
logger.info(`Sidecar 시작: ${command} ${fullArgs.join(' ')}`)
|
logger.info(
|
||||||
|
`Sidecar 시작(${launch.source}): ${launch.command} ${fullArgs.join(' ')}`,
|
||||||
|
)
|
||||||
|
|
||||||
return new Promise<void>((resolve, reject) => {
|
return new Promise<void>((resolve, reject) => {
|
||||||
try {
|
let settled = false
|
||||||
this._sidecarProcess = spawn(
|
const child = spawn(launch.command, fullArgs, {
|
||||||
command,
|
|
||||||
fullArgs,
|
|
||||||
{
|
|
||||||
stdio: ['pipe', 'pipe', 'pipe'],
|
stdio: ['pipe', 'pipe', 'pipe'],
|
||||||
env: { ...process.env },
|
env: {
|
||||||
|
...process.env,
|
||||||
|
// 사이드카 로그와 파일 경로가 UTF-8로 오가도록 고정 (Windows cp949 깨짐 방지)
|
||||||
|
PYTHONIOENCODING: 'utf-8',
|
||||||
|
PYTHONUTF8: '1',
|
||||||
},
|
},
|
||||||
)
|
// Windows에서 콘솔 창이 깜빡이지 않게 한다.
|
||||||
} catch (err) {
|
windowsHide: true,
|
||||||
const d3roErr = new D3ROError(
|
})
|
||||||
ErrorCode.STTSidecarSpawnFailed,
|
this._sidecarProcess = child
|
||||||
`Sidecar 프로세스 생성 실패: ${err instanceof Error ? err.message : String(err)}`,
|
|
||||||
)
|
|
||||||
reject(d3roErr)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
const sidecarLogger = getLogger('sidecar')
|
this._pipeSidecarLogs(child, getLogger('sidecar'))
|
||||||
|
|
||||||
this._sidecarProcess.stdout?.on('data', (data: Buffer) => {
|
// spawn 성공 = 프로세스가 실제로 시작됨. 즉시 resolve해 healthcheck로 넘어간다.
|
||||||
const text = data.toString().trim()
|
child.once('spawn', () => {
|
||||||
if (text) {
|
if (settled) return
|
||||||
sidecarLogger.info(text)
|
settled = true
|
||||||
}
|
resolve()
|
||||||
})
|
})
|
||||||
|
|
||||||
this._sidecarProcess.stderr?.on('data', (data: Buffer) => {
|
// spawn 실패(ENOENT 등)는 즉시 실패시킨다. 예전엔 즉시 resolve 후
|
||||||
const text = data.toString().trim()
|
// healthcheck 30초를 헛되게 태우고 원인을 숨겼다.
|
||||||
if (text) {
|
child.once('error', (err: Error) => {
|
||||||
sidecarLogger.warn(text)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
this._sidecarProcess.on('error', (err: Error) => {
|
|
||||||
logger.error(`Sidecar 프로세스 에러: ${err.message}`)
|
logger.error(`Sidecar 프로세스 에러: ${err.message}`)
|
||||||
reject(
|
this._sidecarProcess = null
|
||||||
new D3ROError(
|
if (settled) return
|
||||||
ErrorCode.STTSidecarSpawnFailed,
|
settled = true
|
||||||
`Sidecar 프로세스 에러: ${err.message}`,
|
reject(this._spawnFailureError(err, launch))
|
||||||
),
|
|
||||||
)
|
|
||||||
})
|
})
|
||||||
|
|
||||||
this._sidecarProcess.on('exit', (code: number | null, signal: string | null) => {
|
child.on('exit', (code: number | null, signal: string | null) => {
|
||||||
logger.warn(`Sidecar 프로세스 종료: code=${code}, signal=${signal}`)
|
logger.warn(`Sidecar 프로세스 종료: code=${code}, signal=${signal}`)
|
||||||
|
if (this._sidecarProcess === child) {
|
||||||
this._sidecarProcess = null
|
this._sidecarProcess = null
|
||||||
|
}
|
||||||
this._modelReady = false
|
this._modelReady = false
|
||||||
|
|
||||||
if (!this._disposed) {
|
if (!this._disposed) {
|
||||||
this._handleSidecarCrash()
|
this._handleSidecarCrash()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
// spawn 자체는 비동기적이므로 즉시 resolve
|
|
||||||
// 실제 준비는 _waitForHealth에서 확인
|
|
||||||
resolve()
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** sidecar stdout/stderr를 줄 단위로 로그에 흘려보낸다. */
|
||||||
|
private _pipeSidecarLogs(
|
||||||
|
child: ChildProcess,
|
||||||
|
sidecarLogger: ReturnType<typeof getLogger>,
|
||||||
|
): void {
|
||||||
|
const consume = (
|
||||||
|
stream: NodeJS.ReadableStream | null | undefined,
|
||||||
|
write: (message: string) => void,
|
||||||
|
): void => {
|
||||||
|
if (!stream) return
|
||||||
|
let pending = ''
|
||||||
|
stream.on('data', (chunk: Buffer) => {
|
||||||
|
pending += chunk.toString('utf8')
|
||||||
|
const lines = pending.split(/\r?\n/)
|
||||||
|
// 마지막 조각은 줄이 완성되지 않았을 수 있으니 다음 청크와 합친다.
|
||||||
|
pending = lines.pop() ?? ''
|
||||||
|
for (const line of lines) {
|
||||||
|
const trimmed = line.trim()
|
||||||
|
if (trimmed) write(trimmed)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
consume(child.stdout, (message) => sidecarLogger.info(message))
|
||||||
|
consume(child.stderr, (message) => sidecarLogger.warn(message))
|
||||||
|
}
|
||||||
|
|
||||||
|
/** sidecar 기동 실패 원인을 사용자가 조치할 수 있는 문구로 바꾼다. */
|
||||||
|
private _spawnFailureError(
|
||||||
|
err: Error,
|
||||||
|
launch: { command: string; source: 'bundled' | 'venv' | 'python' },
|
||||||
|
): D3ROError {
|
||||||
|
const enoent = (err as NodeJS.ErrnoException).code === 'ENOENT'
|
||||||
|
if (!enoent) {
|
||||||
|
return new D3ROError(
|
||||||
|
ErrorCode.STTSidecarSpawnFailed,
|
||||||
|
`Sidecar 프로세스 에러: ${err.message}`,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
const hint =
|
||||||
|
launch.source === 'bundled'
|
||||||
|
? '번들된 사이드카 실행 파일이 손상되었거나 백신이 차단했습니다. 앱을 다시 설치하세요.'
|
||||||
|
: launch.source === 'venv'
|
||||||
|
? '사이드카 가상환경이 손상되었습니다. `npm --prefix apps/desktop run sidecar:setup`을 실행하세요.'
|
||||||
|
: '시스템 Python을 찾을 수 없습니다. `npm --prefix apps/desktop run sidecar:setup`으로 가상환경을 만드세요.'
|
||||||
|
|
||||||
|
return new D3ROError(
|
||||||
|
ErrorCode.STTSidecarSpawnFailed,
|
||||||
|
`Sidecar 실행 파일을 찾을 수 없습니다: ${launch.command} (${launch.source}). ${hint}`,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
private async _waitForHealth(): Promise<void> {
|
private async _waitForHealth(): Promise<void> {
|
||||||
const startTime = Date.now()
|
const startTime = Date.now()
|
||||||
|
|
||||||
|
|
@ -655,7 +766,7 @@ class LocalSTTService extends EventEmitter {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await fetch(`http://localhost:${this._port}/health`, {
|
const response = await fetch(`${this._baseUrl}/health`, {
|
||||||
signal: AbortSignal.timeout(2000),
|
signal: AbortSignal.timeout(2000),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -685,7 +796,7 @@ class LocalSTTService extends EventEmitter {
|
||||||
logger.info(`모델 로딩 시작: ${modelId}`)
|
logger.info(`모델 로딩 시작: ${modelId}`)
|
||||||
const startTime = Date.now()
|
const startTime = Date.now()
|
||||||
|
|
||||||
const response = await fetch(`http://localhost:${this._port}/load`, {
|
const response = await fetch(`${this._baseUrl}/load`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: { 'Content-Type': 'application/json' },
|
headers: { 'Content-Type': 'application/json' },
|
||||||
body: JSON.stringify({ model_id: modelId }),
|
body: JSON.stringify({ model_id: modelId }),
|
||||||
|
|
@ -729,12 +840,16 @@ class LocalSTTService extends EventEmitter {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const isPartial = options?.partial === true
|
||||||
|
|
||||||
|
if (!isPartial) {
|
||||||
this._setState(STTState.Transcribing)
|
this._setState(STTState.Transcribing)
|
||||||
|
}
|
||||||
const startTime = Date.now()
|
const startTime = Date.now()
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const language = options?.language ?? configGet('sttLanguage')
|
const language = options?.language ?? configGet('sttLanguage')
|
||||||
const vadFilter = options?.vadFilter ?? true
|
const vadFilter = options?.vadFilter ?? !isPartial
|
||||||
const initialPrompt = options?.initialPrompt ?? ''
|
const initialPrompt = options?.initialPrompt ?? ''
|
||||||
|
|
||||||
// Node 18+ 내장 fetch + FormData + Blob으로 multipart 전송
|
// Node 18+ 내장 fetch + FormData + Blob으로 multipart 전송
|
||||||
|
|
@ -751,18 +866,19 @@ class LocalSTTService extends EventEmitter {
|
||||||
)
|
)
|
||||||
formData.append('language', language)
|
formData.append('language', language)
|
||||||
formData.append('vad_filter', String(vadFilter))
|
formData.append('vad_filter', String(vadFilter))
|
||||||
|
// 부분 전사는 greedy 디코딩 + 컨텍스트 미사용으로 지연을 최소화한다.
|
||||||
|
formData.append('partial', String(isPartial))
|
||||||
if (initialPrompt) {
|
if (initialPrompt) {
|
||||||
formData.append('initial_prompt', initialPrompt)
|
formData.append('initial_prompt', initialPrompt)
|
||||||
}
|
}
|
||||||
|
|
||||||
const response = await fetch(
|
const response = await fetch(`${this._baseUrl}/transcribe`, {
|
||||||
`http://localhost:${this._port}/transcribe`,
|
|
||||||
{
|
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: formData,
|
body: formData,
|
||||||
signal: AbortSignal.timeout(SIDECAR_REQUEST_TIMEOUT_MS),
|
signal: AbortSignal.timeout(
|
||||||
},
|
isPartial ? SIDECAR_PARTIAL_TIMEOUT_MS : SIDECAR_REQUEST_TIMEOUT_MS,
|
||||||
)
|
),
|
||||||
|
})
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
const errorText = await response.text()
|
const errorText = await response.text()
|
||||||
|
|
@ -788,6 +904,12 @@ class LocalSTTService extends EventEmitter {
|
||||||
processingTime,
|
processingTime,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isPartial) {
|
||||||
|
// 미리보기 — 상태/이벤트를 건드리지 않는다 (최종 삽입과 무관).
|
||||||
|
logger.debug(`부분 전사: "${result.text.substring(0, 40)}" (${processingTime}ms)`)
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
|
||||||
// 중간 결과 이벤트 (isFinal=true)
|
// 중간 결과 이벤트 (isFinal=true)
|
||||||
this.emit('transcription-delta', { text: result.text, isFinal: true })
|
this.emit('transcription-delta', { text: result.text, isFinal: true })
|
||||||
this.emit('transcription-complete', { result })
|
this.emit('transcription-complete', { result })
|
||||||
|
|
@ -800,7 +922,9 @@ class LocalSTTService extends EventEmitter {
|
||||||
|
|
||||||
return result
|
return result
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
if (!isPartial) {
|
||||||
this._setState(STTState.Ready) // 에러 후에도 Ready 복귀 (sidecar가 살아있으면)
|
this._setState(STTState.Ready) // 에러 후에도 Ready 복귀 (sidecar가 살아있으면)
|
||||||
|
}
|
||||||
|
|
||||||
if (err instanceof D3ROError) {
|
if (err instanceof D3ROError) {
|
||||||
throw err
|
throw err
|
||||||
|
|
@ -874,7 +998,7 @@ class LocalSTTService extends EventEmitter {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// POST /shutdown 요청
|
// POST /shutdown 요청
|
||||||
await fetch(`http://localhost:${this._port}/shutdown`, {
|
await fetch(`${this._baseUrl}/shutdown`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
signal: AbortSignal.timeout(3000),
|
signal: AbortSignal.timeout(3000),
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
import { EventEmitter } from 'events'
|
import { EventEmitter } from 'events'
|
||||||
import { configGet, configSet } from './ConfigService'
|
import { configGet, configSet } from './ConfigService'
|
||||||
|
import { normalizeLoopbackUrl } from '../utils/loopback'
|
||||||
import { D3ROError, ErrorCode } from '@d3ro/core/errors'
|
import { D3ROError, ErrorCode } from '@d3ro/core/errors'
|
||||||
import type { LLMAction } from '@d3ro/core/types'
|
import type { LLMAction } from '@d3ro/core/types'
|
||||||
import { resolveSystemPrompt } from './llm-prompts'
|
import { resolveSystemPrompt } from './llm-prompts'
|
||||||
|
|
@ -47,7 +48,7 @@ class OnlineLLMService extends EventEmitter {
|
||||||
customPrompt?: string
|
customPrompt?: string
|
||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
const token = this._ensureAuth()
|
const token = this._ensureAuth()
|
||||||
const apiUrl = configGet('onlineApiUrl') ?? 'http://localhost:5000'
|
const apiUrl = normalizeLoopbackUrl(configGet('onlineApiUrl') ?? 'http://127.0.0.1:5000')
|
||||||
const systemPrompt = resolveSystemPrompt(action, targetLanguage, customPrompt)
|
const systemPrompt = resolveSystemPrompt(action, targetLanguage, customPrompt)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
@ -100,7 +101,7 @@ class OnlineLLMService extends EventEmitter {
|
||||||
options?: { model?: string; temperature?: number }
|
options?: { model?: string; temperature?: number }
|
||||||
): AsyncGenerator<string, string> {
|
): AsyncGenerator<string, string> {
|
||||||
const token = this._ensureAuth()
|
const token = this._ensureAuth()
|
||||||
const apiUrl = configGet('onlineApiUrl') ?? 'http://localhost:5000'
|
const apiUrl = normalizeLoopbackUrl(configGet('onlineApiUrl') ?? 'http://127.0.0.1:5000')
|
||||||
|
|
||||||
const response = await fetch(`${apiUrl}/api/llm/chat`, {
|
const response = await fetch(`${apiUrl}/api/llm/chat`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ import path from 'path'
|
||||||
import { eq } from 'drizzle-orm'
|
import { eq } from 'drizzle-orm'
|
||||||
import { getLogger } from './LoggerService'
|
import { getLogger } from './LoggerService'
|
||||||
import { getPremiumLLMService } from './PremiumLLMService'
|
import { getPremiumLLMService } from './PremiumLLMService'
|
||||||
import { configGet } from './ConfigService'
|
import { getOllamaServerUrl } from './LocalLLMService'
|
||||||
import { getDatabase } from '../db'
|
import { getDatabase } from '../db'
|
||||||
import { ragDocuments, ragChunks } from '../db/schema'
|
import { ragDocuments, ragChunks } from '../db/schema'
|
||||||
import { getMainWindow } from '../windows/WindowManager'
|
import { getMainWindow } from '../windows/WindowManager'
|
||||||
|
|
@ -307,7 +307,7 @@ ${context}`
|
||||||
* Ollama /api/embed 엔드포인트로 텍스트 임베딩
|
* Ollama /api/embed 엔드포인트로 텍스트 임베딩
|
||||||
*/
|
*/
|
||||||
private async _embed(text: string): Promise<number[]> {
|
private async _embed(text: string): Promise<number[]> {
|
||||||
const serverUrl = configGet('ollamaServerUrl')
|
const serverUrl = getOllamaServerUrl()
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await fetch(`${serverUrl}/api/embed`, {
|
const response = await fetch(`${serverUrl}/api/embed`, {
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@ import {
|
||||||
hideRecordingTip,
|
hideRecordingTip,
|
||||||
updateRecordingTipState,
|
updateRecordingTipState,
|
||||||
sendAudioLevelToTip,
|
sendAudioLevelToTip,
|
||||||
|
sendPartialTranscriptToTip,
|
||||||
showResultPopup,
|
showResultPopup,
|
||||||
} from '../windows/WindowManager'
|
} from '../windows/WindowManager'
|
||||||
import type { ScreenContext } from '@d3ro/core/types'
|
import type { ScreenContext } from '@d3ro/core/types'
|
||||||
|
|
@ -98,6 +99,18 @@ const TERMINAL_STATES = new Set<RecognitionState>([
|
||||||
RecognitionState.DESTROYED
|
RecognitionState.DESTROYED
|
||||||
])
|
])
|
||||||
|
|
||||||
|
// ── 실시간 부분 전사(미리보기) ──
|
||||||
|
// 16kHz 16bit mono = 32 bytes/ms
|
||||||
|
const BYTES_PER_MS = 32
|
||||||
|
/** 부분 전사 주기 */
|
||||||
|
const PARTIAL_INTERVAL_MS = 1500
|
||||||
|
/** 부분 전사를 시작할 최소 녹음 길이 */
|
||||||
|
const PARTIAL_MIN_AUDIO_MS = 1200
|
||||||
|
/** 부분 전사에 보낼 최대 오디오 창(끝부분만) — 오래 말해도 지연이 늘지 않게 한다 */
|
||||||
|
const PARTIAL_MAX_WINDOW_MS = 7500
|
||||||
|
/** 녹음 종료 시 진행 중 부분 전사를 기다리는 최대 시간 */
|
||||||
|
const PARTIAL_DRAIN_TIMEOUT_MS = 2500
|
||||||
|
|
||||||
// ============================================================
|
// ============================================================
|
||||||
// VoiceModeService
|
// VoiceModeService
|
||||||
// ============================================================
|
// ============================================================
|
||||||
|
|
@ -123,6 +136,10 @@ class VoiceModeService extends EventEmitter {
|
||||||
/** 녹음 종료 후 STT 준비 대기 타이머 — 전사 시작 시 반드시 해제 */
|
/** 녹음 종료 후 STT 준비 대기 타이머 — 전사 시작 시 반드시 해제 */
|
||||||
private _sttWaitTimer: NodeJS.Timeout | null = null
|
private _sttWaitTimer: NodeJS.Timeout | null = null
|
||||||
|
|
||||||
|
// 실시간 부분 전사(미리보기)
|
||||||
|
private _partialTimer: NodeJS.Timeout | null = null
|
||||||
|
private _partialInFlight: Promise<void> | null = null
|
||||||
|
|
||||||
// Action Queue (이벤트 직렬화)
|
// Action Queue (이벤트 직렬화)
|
||||||
private _actionQueue: VoiceAction[] = []
|
private _actionQueue: VoiceAction[] = []
|
||||||
private _isProcessingQueue = false
|
private _isProcessingQueue = false
|
||||||
|
|
@ -462,6 +479,8 @@ class VoiceModeService extends EventEmitter {
|
||||||
this._setAudioState(AudioState.STREAMING)
|
this._setAudioState(AudioState.STREAMING)
|
||||||
logger.info('Audio capture started')
|
logger.info('Audio capture started')
|
||||||
|
|
||||||
|
this._startPartialLoop()
|
||||||
|
|
||||||
this._tryFlushAll()
|
this._tryFlushAll()
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (this._isInTerminalState()) return
|
if (this._isInTerminalState()) return
|
||||||
|
|
@ -488,6 +507,7 @@ class VoiceModeService extends EventEmitter {
|
||||||
this._audioLevelHandler = null
|
this._audioLevelHandler = null
|
||||||
}
|
}
|
||||||
this._audioStarted = false
|
this._audioStarted = false
|
||||||
|
this._stopPartialLoop()
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await audio.stop()
|
await audio.stop()
|
||||||
|
|
@ -496,6 +516,73 @@ class VoiceModeService extends EventEmitter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ── 실시간 부분 전사(미리보기) ─────────────────────────────
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 녹음 중 주기적으로 지금까지의 오디오를 전사해 RecordingTip에 미리보기를 띄운다.
|
||||||
|
* 최종 삽입 텍스트와는 완전히 분리된 경로이며, 실패는 조용히 무시된다.
|
||||||
|
*/
|
||||||
|
private _startPartialLoop(): void {
|
||||||
|
this._stopPartialLoop()
|
||||||
|
if ((configGet('sttProvider') ?? 'local') !== 'local') return
|
||||||
|
|
||||||
|
this._partialTimer = setInterval(() => {
|
||||||
|
void this._runPartial()
|
||||||
|
}, PARTIAL_INTERVAL_MS)
|
||||||
|
}
|
||||||
|
|
||||||
|
private _stopPartialLoop(): void {
|
||||||
|
if (this._partialTimer) {
|
||||||
|
clearInterval(this._partialTimer)
|
||||||
|
this._partialTimer = null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 진행 중인 부분 전사가 끝나기를 최대 PARTIAL_DRAIN_TIMEOUT_MS까지 기다린다. */
|
||||||
|
private async _drainPartial(): Promise<void> {
|
||||||
|
const inFlight = this._partialInFlight
|
||||||
|
if (!inFlight) return
|
||||||
|
await Promise.race([
|
||||||
|
inFlight,
|
||||||
|
new Promise<void>((resolve) => setTimeout(resolve, PARTIAL_DRAIN_TIMEOUT_MS)),
|
||||||
|
])
|
||||||
|
}
|
||||||
|
|
||||||
|
private async _runPartial(): Promise<void> {
|
||||||
|
if (!this._audioStarted || this._partialInFlight) return
|
||||||
|
if (this._isInTerminalState()) return
|
||||||
|
if (!this._sttReady) return
|
||||||
|
if (this._audioBufferBytes < PARTIAL_MIN_AUDIO_MS * BYTES_PER_MS) return
|
||||||
|
|
||||||
|
const sessionId = this._session?.id
|
||||||
|
const merged = Buffer.concat(this._audioBuffer)
|
||||||
|
const maxBytes = PARTIAL_MAX_WINDOW_MS * BYTES_PER_MS
|
||||||
|
const window = merged.length > maxBytes ? merged.subarray(merged.length - maxBytes) : merged
|
||||||
|
const language = configGet('sttLanguage')
|
||||||
|
|
||||||
|
const task = (async (): Promise<void> => {
|
||||||
|
try {
|
||||||
|
const text = await getSTTManager().transcribePartial(window, {
|
||||||
|
language: language === 'auto' ? undefined : language,
|
||||||
|
vadFilter: false,
|
||||||
|
})
|
||||||
|
// 녹음이 끝났거나 세션이 바뀌었으면 미리보기를 버린다.
|
||||||
|
if (!this._audioStarted || this._isInTerminalState()) return
|
||||||
|
if (this._session?.id !== sessionId) return
|
||||||
|
if (!text) return
|
||||||
|
sendPartialTranscriptToTip(text)
|
||||||
|
} catch (err) {
|
||||||
|
logger.debug(
|
||||||
|
`부분 전사 미리보기 무시: ${err instanceof Error ? err.message : String(err)}`,
|
||||||
|
)
|
||||||
|
} finally {
|
||||||
|
this._partialInFlight = null
|
||||||
|
}
|
||||||
|
})()
|
||||||
|
|
||||||
|
this._partialInFlight = task
|
||||||
|
}
|
||||||
|
|
||||||
// ── 이중 조건 플러시 ───────────────────────────────────
|
// ── 이중 조건 플러시 ───────────────────────────────────
|
||||||
|
|
||||||
private _tryFlushAll(): void {
|
private _tryFlushAll(): void {
|
||||||
|
|
@ -553,6 +640,10 @@ class VoiceModeService extends EventEmitter {
|
||||||
// DictionaryService 미초기화 시 무시
|
// DictionaryService 미초기화 시 무시
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 사이드카는 요청을 직렬 처리하므로, 진행 중인 미리보기 요청이 최종 전사를
|
||||||
|
// 지연시키지 않도록 먼저 배수한다(최대 PARTIAL_DRAIN_TIMEOUT_MS).
|
||||||
|
await this._drainPartial()
|
||||||
|
|
||||||
const result: TranscriptionResult = await stt.transcribe(merged, {
|
const result: TranscriptionResult = await stt.transcribe(merged, {
|
||||||
language: language === 'auto' ? undefined : language,
|
language: language === 'auto' ? undefined : language,
|
||||||
initialPrompt,
|
initialPrompt,
|
||||||
|
|
@ -864,6 +955,8 @@ class VoiceModeService extends EventEmitter {
|
||||||
|
|
||||||
private _resetToIdle(): void {
|
private _resetToIdle(): void {
|
||||||
this._clearSttWaitTimer()
|
this._clearSttWaitTimer()
|
||||||
|
this._stopPartialLoop()
|
||||||
|
this._partialInFlight = null
|
||||||
this._session = null
|
this._session = null
|
||||||
this._audioBuffer = []
|
this._audioBuffer = []
|
||||||
this._audioBufferBytes = 0
|
this._audioBufferBytes = 0
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@ import { AssemblyAIDriver } from './drivers/AssemblyAIDriver'
|
||||||
import { GoogleDriver } from './drivers/GoogleDriver'
|
import { GoogleDriver } from './drivers/GoogleDriver'
|
||||||
import { CustomDriver } from './drivers/CustomDriver'
|
import { CustomDriver } from './drivers/CustomDriver'
|
||||||
import { D3ROCloudDriver } from './drivers/D3ROCloudDriver'
|
import { D3ROCloudDriver } from './drivers/D3ROCloudDriver'
|
||||||
|
import { normalizeLoopbackUrl } from '../../utils/loopback'
|
||||||
|
|
||||||
const logger = getLogger('STTManager')
|
const logger = getLogger('STTManager')
|
||||||
|
|
||||||
|
|
@ -43,7 +44,7 @@ export const STT_PROVIDERS_META: STTProviderInfo[] = [
|
||||||
badge: 'Cloud · Zero Config',
|
badge: 'Cloud · Zero Config',
|
||||||
requiresApiKey: false,
|
requiresApiKey: false,
|
||||||
defaultModel: 'default',
|
defaultModel: 'default',
|
||||||
defaultBaseUrl: 'http://localhost:5000',
|
defaultBaseUrl: 'http://127.0.0.1:5000',
|
||||||
models: ['default', 'whisper-large-v3-turbo', 'nova-3', 'gemini-2.0-flash'],
|
models: ['default', 'whisper-large-v3-turbo', 'nova-3', 'gemini-2.0-flash'],
|
||||||
isCloud: true,
|
isCloud: true,
|
||||||
},
|
},
|
||||||
|
|
@ -109,7 +110,7 @@ export const STT_PROVIDERS_META: STTProviderInfo[] = [
|
||||||
badge: 'Self-Hosted / Proxy',
|
badge: 'Self-Hosted / Proxy',
|
||||||
requiresApiKey: false,
|
requiresApiKey: false,
|
||||||
defaultModel: 'whisper-1',
|
defaultModel: 'whisper-1',
|
||||||
defaultBaseUrl: 'http://localhost:8000/v1',
|
defaultBaseUrl: 'http://127.0.0.1:8000/v1',
|
||||||
models: ['whisper-1', 'custom'],
|
models: ['whisper-1', 'custom'],
|
||||||
isCloud: true,
|
isCloud: true,
|
||||||
},
|
},
|
||||||
|
|
@ -155,7 +156,8 @@ export class STTManager extends EventEmitter {
|
||||||
|
|
||||||
return {
|
return {
|
||||||
apiKey: specificConfig.apiKey ?? '',
|
apiKey: specificConfig.apiKey ?? '',
|
||||||
baseUrl: specificConfig.baseUrl ?? meta?.defaultBaseUrl ?? '',
|
// 저장된 값이 localhost일 수 있다(IPv6 해석 실패) → IPv4 루프백으로 정규화.
|
||||||
|
baseUrl: normalizeLoopbackUrl(specificConfig.baseUrl ?? meta?.defaultBaseUrl ?? ''),
|
||||||
modelId: specificConfig.modelId ?? meta?.defaultModel ?? '',
|
modelId: specificConfig.modelId ?? meta?.defaultModel ?? '',
|
||||||
temperature: specificConfig.temperature ?? 0,
|
temperature: specificConfig.temperature ?? 0,
|
||||||
}
|
}
|
||||||
|
|
@ -245,6 +247,25 @@ export class STTManager extends EventEmitter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 녹음 중 실시간 미리보기 전사(최종 삽입과 무관).
|
||||||
|
* 로컬 Whisper에서만 지원한다 — 클라우드 공급자는 요청 비용/지연이 커서 사용하지 않는다.
|
||||||
|
* 실패는 빈 문자열로 흡수된다.
|
||||||
|
*/
|
||||||
|
async transcribePartial(audioBuffer: Buffer, options?: TranscribeOptions): Promise<string> {
|
||||||
|
if (this.getActiveProvider() !== 'local') return ''
|
||||||
|
return getLocalSTTService().transcribePartial(audioBuffer, options)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 로컬 STT 엔진(sidecar + 모델)을 백그라운드로 미리 데운다.
|
||||||
|
* 첫 받아쓰기 지연을 없애는 것이 목적이며 실패해도 조용히 넘어간다.
|
||||||
|
*/
|
||||||
|
async warmUpLocal(): Promise<boolean> {
|
||||||
|
if (this.getActiveProvider() !== 'local') return false
|
||||||
|
return getLocalSTTService().warmUp()
|
||||||
|
}
|
||||||
|
|
||||||
getStatus(): STTStatus {
|
getStatus(): STTStatus {
|
||||||
const provider = this.getActiveProvider()
|
const provider = this.getActiveProvider()
|
||||||
if (provider === 'local') {
|
if (provider === 'local') {
|
||||||
|
|
|
||||||
39
apps/desktop/src/main/utils/loopback.ts
Normal file
39
apps/desktop/src/main/utils/loopback.ts
Normal file
|
|
@ -0,0 +1,39 @@
|
||||||
|
// src/main/utils/loopback.ts
|
||||||
|
// 로컬 엔진(Ollama, STT sidecar) URL 정규화.
|
||||||
|
//
|
||||||
|
// 배경: Windows 호스트 파일에 `::1 localhost`만 있고 `127.0.0.1 localhost`가 없으면
|
||||||
|
// localhost가 IPv6(::1)로만 해석된다. Ollama/uvicorn은 IPv4(127.0.0.1)에만 바인딩하므로
|
||||||
|
// `http://localhost:<port>` 요청이 전부 ECONNREFUSED로 실패한다(실측).
|
||||||
|
// 로컬 엔진은 바인딩 주소가 IPv4 루프백으로 고정이므로 항상 127.0.0.1로 정규화한다.
|
||||||
|
|
||||||
|
/** IPv4 루프백으로 정규화할 호스트 이름 */
|
||||||
|
const LOOPBACK_HOSTNAMES = new Set(['localhost', 'localhost.'])
|
||||||
|
|
||||||
|
/** 로컬 엔진 기본 호스트 */
|
||||||
|
export const LOOPBACK_HOST = '127.0.0.1'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* URL의 호스트가 localhost 계열이면 127.0.0.1로 바꾼다.
|
||||||
|
* 그 외 호스트/잘못된 URL은 원본을 그대로 반환한다.
|
||||||
|
*/
|
||||||
|
export function normalizeLoopbackUrl(rawUrl: string): string {
|
||||||
|
if (!rawUrl) return rawUrl
|
||||||
|
|
||||||
|
try {
|
||||||
|
const parsed = new URL(rawUrl)
|
||||||
|
if (!LOOPBACK_HOSTNAMES.has(parsed.hostname.toLowerCase())) {
|
||||||
|
return rawUrl
|
||||||
|
}
|
||||||
|
parsed.hostname = LOOPBACK_HOST
|
||||||
|
// URL 직렬화는 경로가 없을 때 '/'를 붙인다. 호출측이 `${base}/api/...`로
|
||||||
|
// 이어 붙이므로 말미 슬래시는 제거해 중복 래시를 막는다.
|
||||||
|
return parsed.toString().replace(/\/$/, '')
|
||||||
|
} catch {
|
||||||
|
return rawUrl.replace(/^(https?:\/\/)localhost(?=[:/]|$)/i, `$1${LOOPBACK_HOST}`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 루프백 호스트로 접속 가능한 로컬 엔진 기본 URL을 만든다. */
|
||||||
|
export function loopbackUrl(port: number, protocol = 'http'): string {
|
||||||
|
return `${protocol}://${LOOPBACK_HOST}:${port}`
|
||||||
|
}
|
||||||
|
|
@ -4,6 +4,8 @@
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
import { app } from 'electron'
|
import { app } from 'electron'
|
||||||
import { existsSync } from 'fs'
|
import { existsSync } from 'fs'
|
||||||
|
import { D3ROError, ErrorCode } from '@d3ro/core/errors'
|
||||||
|
import { loopbackUrl } from './loopback'
|
||||||
|
|
||||||
/** Windows는 .exe 접미사, 그 외는 없음 */
|
/** Windows는 .exe 접미사, 그 외는 없음 */
|
||||||
const EXE_SUFFIX = process.platform === 'win32' ? '.exe' : ''
|
const EXE_SUFFIX = process.platform === 'win32' ? '.exe' : ''
|
||||||
|
|
@ -17,33 +19,112 @@ function isPackaged(): boolean {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SoX 실행 파일 경로. 번들된 게 있으면 그것, 없으면 시스템 PATH의 sox.
|
* dev 실행 시 리소스 루트(apps/desktop)를 찾는다.
|
||||||
* - Windows: sox.exe
|
*
|
||||||
* - macOS/Linux: sox (brew install sox / apt install sox 필요)
|
* electron-vite는 electron을 `out/main/index.js`로 직접 띄우기 때문에
|
||||||
|
* `app.getAppPath()`가 `apps/desktop/out/main`을 가리킨다. 그대로 쓰면
|
||||||
|
* `out/main/sidecar/main.py`, `out/main/resources/sox` 같은 존재하지 않는 경로가
|
||||||
|
* 만들어져 sidecar/SoX가 조용히 시스템 PATH 폴백으로 새고 로컬 전사가 실패한다(실측).
|
||||||
|
* 따라서 상위 디렉토리를 훑어 실제 앱 루트를 찾아 캐시한다.
|
||||||
*/
|
*/
|
||||||
export function getSoxPath(): string {
|
const APP_ROOT_MARKERS = [
|
||||||
const soxBin = `sox${EXE_SUFFIX}`
|
path.join('sidecar', 'main.py'),
|
||||||
const bundledSox = isPackaged()
|
path.join('resources', 'sox'),
|
||||||
? path.join(process.resourcesPath, 'sox', soxBin)
|
'electron-builder.yml',
|
||||||
: path.join(app.getAppPath(), 'resources', 'sox', soxBin)
|
]
|
||||||
|
|
||||||
if (existsSync(bundledSox)) {
|
const MAX_ROOT_WALK_UP = 4
|
||||||
return bundledSox
|
|
||||||
|
let cachedAppRoot: string | null = null
|
||||||
|
|
||||||
|
function looksLikeAppRoot(dir: string): boolean {
|
||||||
|
return APP_ROOT_MARKERS.some((marker) => existsSync(path.join(dir, marker)))
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 리소스 루트(apps/desktop)를 반환한다. dev에서 못 찾으면 app.getAppPath(). */
|
||||||
|
export function getAppRoot(): string {
|
||||||
|
if (cachedAppRoot) return cachedAppRoot
|
||||||
|
|
||||||
|
const bases: string[] = [app.getAppPath(), process.cwd()]
|
||||||
|
// electron-vite는 main 번들을 CJS로 내보내므로 __dirname 사용 가능.
|
||||||
|
if (typeof __dirname === 'string' && __dirname) {
|
||||||
|
bases.push(__dirname)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 번들 없으면 시스템 PATH에서 찾기 (dev 환경 폴백)
|
for (const base of bases) {
|
||||||
return 'sox'
|
let dir = base
|
||||||
|
for (let step = 0; step <= MAX_ROOT_WALK_UP; step++) {
|
||||||
|
if (looksLikeAppRoot(dir)) {
|
||||||
|
cachedAppRoot = dir
|
||||||
|
return dir
|
||||||
|
}
|
||||||
|
const parent = path.dirname(dir)
|
||||||
|
if (parent === dir) break
|
||||||
|
dir = parent
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cachedAppRoot = app.getAppPath()
|
||||||
|
return cachedAppRoot
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 테스트에서 경로 캐시를 초기화한다. */
|
||||||
|
export function resetPathCache(): void {
|
||||||
|
cachedAppRoot = null
|
||||||
|
cachedSoxPath = undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* rec 실행 파일 경로 (SoX의 녹음 명령).
|
* 번들 리소스의 dev 경로.
|
||||||
|
* packaged → process.resourcesPath/<name>, dev → <앱 루트>/resources/<name>
|
||||||
|
*/
|
||||||
|
function devResourcePath(...segments: string[]): string {
|
||||||
|
return path.join(getAppRoot(), 'resources', ...segments)
|
||||||
|
}
|
||||||
|
|
||||||
|
function packagedResourcePath(...segments: string[]): string {
|
||||||
|
return path.join(process.resourcesPath, ...segments)
|
||||||
|
}
|
||||||
|
|
||||||
|
let cachedSoxPath: string | undefined
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SoX 실행 파일 경로. 번들된 실행 파일을 우선 사용한다.
|
||||||
|
* - packaged: resources/sox/sox(.exe)
|
||||||
|
* - dev: <앱 루트>/resources/sox/sox(.exe)
|
||||||
|
* 번들이 없으면 시스템 PATH의 `sox`로 폴백한다(설치 안내는 호출측에서 처리).
|
||||||
|
*/
|
||||||
|
export function getSoxPath(): string {
|
||||||
|
if (cachedSoxPath !== undefined) return cachedSoxPath
|
||||||
|
|
||||||
|
const soxBin = `sox${EXE_SUFFIX}`
|
||||||
|
const candidates = [
|
||||||
|
isPackaged()
|
||||||
|
? packagedResourcePath('sox', soxBin)
|
||||||
|
: devResourcePath('sox', soxBin),
|
||||||
|
]
|
||||||
|
|
||||||
|
for (const candidate of candidates) {
|
||||||
|
if (existsSync(candidate)) {
|
||||||
|
cachedSoxPath = candidate
|
||||||
|
return candidate
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 번들 없으면 시스템 PATH에서 찾기 (dev 환경 폴백)
|
||||||
|
cachedSoxPath = 'sox'
|
||||||
|
return cachedSoxPath
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* rec 실행 파일 경로 (SoX의 음 명령).
|
||||||
* node-record-lpcm16은 rec를 사용한다.
|
* node-record-lpcm16은 rec를 사용한다.
|
||||||
*/
|
*/
|
||||||
export function getRecPath(): string {
|
export function getRecPath(): string {
|
||||||
const recBin = `rec${EXE_SUFFIX}`
|
const recBin = `rec${EXE_SUFFIX}`
|
||||||
const bundledRec = isPackaged()
|
const bundledRec = isPackaged()
|
||||||
? path.join(process.resourcesPath, 'sox', recBin)
|
? packagedResourcePath('sox', recBin)
|
||||||
: path.join(app.getAppPath(), 'resources', 'sox', recBin)
|
: devResourcePath('sox', recBin)
|
||||||
|
|
||||||
if (existsSync(bundledRec)) {
|
if (existsSync(bundledRec)) {
|
||||||
return bundledRec
|
return bundledRec
|
||||||
|
|
@ -52,52 +133,75 @@ export function getRecPath(): string {
|
||||||
return 'rec'
|
return 'rec'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** sidecar 실행 방법 */
|
||||||
|
export interface SidecarLaunch {
|
||||||
|
command: string
|
||||||
|
args: string[]
|
||||||
|
/** 어디에서 결정되었는지 (로그/진단용) */
|
||||||
|
source: 'bundled' | 'venv' | 'python'
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* STT sidecar 실행 경로.
|
* STT sidecar 실행 경로.
|
||||||
* - dev: sidecar/.venv/bin/python (있으면) + sidecar/main.py, 없으면 시스템 python3
|
* - packaged: resources/sidecar/sidecar(.exe) — 없으면 명확한 에러 (조용한 폴백 금지)
|
||||||
* - production: sidecar/sidecar(.exe) (PyInstaller 빌드)
|
* - dev: sidecar/.venv python + sidecar/main.py (없으면 시스템 python 폴백)
|
||||||
*/
|
*/
|
||||||
export function getSidecarCommand(): { command: string; args: string[] } {
|
export function getSidecarCommand(): SidecarLaunch {
|
||||||
const sidecarBin = `sidecar${EXE_SUFFIX}`
|
const sidecarBin = `sidecar${EXE_SUFFIX}`
|
||||||
|
|
||||||
if (isPackaged()) {
|
if (isPackaged()) {
|
||||||
const exePath = path.join(process.resourcesPath, 'sidecar', sidecarBin)
|
const exePath = packagedResourcePath('sidecar', sidecarBin)
|
||||||
if (existsSync(exePath)) {
|
if (existsSync(exePath)) {
|
||||||
return { command: exePath, args: [] }
|
return { command: exePath, args: [], source: 'bundled' }
|
||||||
}
|
}
|
||||||
// PyInstaller 번들 실패 대비 폴백
|
throw new D3ROError(
|
||||||
const pyPath = path.join(process.resourcesPath, 'sidecar', 'main.py')
|
ErrorCode.STTSidecarSpawnFailed,
|
||||||
const pythonCmd = process.platform === 'win32' ? 'python' : 'python3'
|
`번들된 STT 사이드카를 찾을 수 없습니다: ${exePath}. ` +
|
||||||
return { command: pythonCmd, args: [pyPath] }
|
'설치 패키지에 sidecar 리소스가 누락되었습니다(로컬 전사 불가). ' +
|
||||||
|
'앱을 다시 설치하거나 개발 모드에서 `npm run sidecar:build`로 빌드하세요.',
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
// dev: venv 우선 → 없으면 시스템 python
|
// dev: venv 우선 → 없으면 시스템 python
|
||||||
const sidecarDir = path.join(app.getAppPath(), 'sidecar')
|
const sidecarDir = path.join(getAppRoot(), 'sidecar')
|
||||||
const sidecarPath = path.join(sidecarDir, 'main.py')
|
const sidecarPath = path.join(sidecarDir, 'main.py')
|
||||||
|
|
||||||
|
if (!existsSync(sidecarPath)) {
|
||||||
|
throw new D3ROError(
|
||||||
|
ErrorCode.STTSidecarSpawnFailed,
|
||||||
|
`STT 사이드카 소스를 찾을 수 없습니다: ${sidecarPath}`,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
const venvPython =
|
const venvPython =
|
||||||
process.platform === 'win32'
|
process.platform === 'win32'
|
||||||
? path.join(sidecarDir, '.venv', 'Scripts', 'python.exe')
|
? path.join(sidecarDir, '.venv', 'Scripts', 'python.exe')
|
||||||
: path.join(sidecarDir, '.venv', 'bin', 'python3')
|
: path.join(sidecarDir, '.venv', 'bin', 'python3')
|
||||||
|
|
||||||
if (existsSync(venvPython)) {
|
if (existsSync(venvPython)) {
|
||||||
return { command: venvPython, args: [sidecarPath] }
|
return { command: venvPython, args: [sidecarPath], source: 'venv' }
|
||||||
}
|
}
|
||||||
|
|
||||||
const pythonCmd = process.platform === 'win32' ? 'python' : 'python3'
|
const pythonCmd = process.platform === 'win32' ? 'python' : 'python3'
|
||||||
return { command: pythonCmd, args: [sidecarPath] }
|
return { command: pythonCmd, args: [sidecarPath], source: 'python' }
|
||||||
|
}
|
||||||
|
|
||||||
|
/** STT 사이드카 HTTP 기본 URL. sidecar는 IPv4 프백에만 바인딩한다. */
|
||||||
|
export function getSidecarBaseUrl(port: number): string {
|
||||||
|
return loopbackUrl(port)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 번들된 Ollama 실행 파일 경로. 존재하지 않으면 null을 반환해 시스템 설치본 탐색으로 폴백.
|
* 번들된 Ollama 실행 파일 경로. 존재하지 않으면 null을 반환해 시스템 설치본 탐색으로 폴백.
|
||||||
* - Windows: ollama.exe
|
* - Windows: ollama.exe
|
||||||
* - macOS/Linux: ollama
|
* - macOS/Linux: ollama
|
||||||
|
* (Ollama 탐색은 LocalLLMService 참조)
|
||||||
*/
|
*/
|
||||||
export function getBundledOllamaPath(): string | null {
|
export function getBundledOllamaPath(): string | null {
|
||||||
const ollamaBin = `ollama${EXE_SUFFIX}`
|
const ollamaBin = `ollama${EXE_SUFFIX}`
|
||||||
const bundled = isPackaged()
|
const bundled = isPackaged()
|
||||||
? path.join(process.resourcesPath, 'ollama', ollamaBin)
|
? packagedResourcePath('ollama', ollamaBin)
|
||||||
: path.join(app.getAppPath(), 'resources', 'ollama', ollamaBin)
|
: devResourcePath('ollama', ollamaBin)
|
||||||
|
|
||||||
return existsSync(bundled) ? bundled : null
|
return existsSync(bundled) ? bundled : null
|
||||||
}
|
}
|
||||||
|
|
@ -106,35 +210,46 @@ export function getBundledOllamaPath(): string | null {
|
||||||
* 효과음 파일 경로.
|
* 효과음 파일 경로.
|
||||||
*/
|
*/
|
||||||
export function getSoundPath(filename: string): string {
|
export function getSoundPath(filename: string): string {
|
||||||
if (isPackaged()) {
|
return isPackaged()
|
||||||
return path.join(process.resourcesPath, 'sounds', filename)
|
? packagedResourcePath('sounds', filename)
|
||||||
}
|
: devResourcePath('sounds', filename)
|
||||||
return path.join(app.getAppPath(), 'resources', 'sounds', filename)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ffmpeg 실행 파일 경로.
|
* ffmpeg 실행 파일 경로.
|
||||||
* - dev: @ffmpeg-installer/ffmpeg의 node_modules 경로 (플랫폼별 자동)
|
* 1) extraResources로 번들된 resources/ffmpeg/ffmpeg(.exe)
|
||||||
* - production: extraResources로 번들된 경로
|
* 2) @ffmpeg-installer/ffmpeg npm 패키지(플랫폼별 정적 바이너리)
|
||||||
|
* 3) 시스템 PATH의 ffmpeg
|
||||||
*/
|
*/
|
||||||
export function getFfmpegPath(): string {
|
export function getFfmpegPath(): string {
|
||||||
const ffmpegBin = `ffmpeg${EXE_SUFFIX}`
|
const ffmpegBin = `ffmpeg${EXE_SUFFIX}`
|
||||||
|
|
||||||
if (isPackaged()) {
|
const bundled = isPackaged()
|
||||||
const bundled = path.join(process.resourcesPath, 'ffmpeg', ffmpegBin)
|
? packagedResourcePath('ffmpeg', ffmpegBin)
|
||||||
|
: devResourcePath('ffmpeg', ffmpegBin)
|
||||||
|
|
||||||
if (existsSync(bundled)) {
|
if (existsSync(bundled)) {
|
||||||
return bundled
|
return bundled
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// dev: @ffmpeg-installer/ffmpeg에서 제공하는 경로 (플랫폼별 자동 선택)
|
|
||||||
try {
|
try {
|
||||||
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
||||||
const installer = require('@ffmpeg-installer/ffmpeg')
|
const installer = require('@ffmpeg-installer/ffmpeg') as { path?: string }
|
||||||
return installer.path as string
|
const installerPath = installer.path
|
||||||
} catch {
|
if (installerPath) {
|
||||||
return 'ffmpeg'
|
// asar 내부 경로는 실행 파일로 쓸 수 없다 → unpacked 경로로 치환
|
||||||
|
const unpacked = installerPath.replace(
|
||||||
|
`${path.sep}app.asar${path.sep}`,
|
||||||
|
`${path.sep}app.asar.unpacked${path.sep}`,
|
||||||
|
)
|
||||||
|
if (existsSync(unpacked)) return unpacked
|
||||||
|
if (existsSync(installerPath)) return installerPath
|
||||||
}
|
}
|
||||||
|
} catch {
|
||||||
|
// 설치 패키지 없음 → 시스템 PATH 폴백
|
||||||
|
}
|
||||||
|
|
||||||
|
return 'ffmpeg'
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -161,7 +276,7 @@ export function getWhisperModelsDir(): string {
|
||||||
export function getAppIconPath(): string | null {
|
export function getAppIconPath(): string | null {
|
||||||
const filename = process.platform === 'win32' ? 'icon.ico' : 'icon.png'
|
const filename = process.platform === 'win32' ? 'icon.ico' : 'icon.png'
|
||||||
const candidate = isPackaged()
|
const candidate = isPackaged()
|
||||||
? path.join(process.resourcesPath, 'icons', filename)
|
? packagedResourcePath('icons', filename)
|
||||||
: path.join(app.getAppPath(), 'build', filename)
|
: path.join(getAppRoot(), 'build', filename)
|
||||||
return existsSync(candidate) ? candidate : null
|
return existsSync(candidate) ? candidate : null
|
||||||
}
|
}
|
||||||
|
|
@ -383,4 +383,44 @@ describe('STTManager & Multi-provider Drivers', () => {
|
||||||
expect(result.text).toBe('로컬 Whisper 폴백 성공')
|
expect(result.text).toBe('로컬 Whisper 폴백 성공')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
describe('STTManager Live Partial (미리보기)', () => {
|
||||||
|
it('routes partial transcription through the local engine', async () => {
|
||||||
|
const mgr = getSTTManager()
|
||||||
|
mgr.setProvider('local')
|
||||||
|
|
||||||
|
const { getLocalSTTService } = await import('../../../src/main/services/LocalSTTService')
|
||||||
|
const partialSpy = vi
|
||||||
|
.spyOn(getLocalSTTService(), 'transcribePartial')
|
||||||
|
.mockResolvedValue('미리보기 텍스트')
|
||||||
|
|
||||||
|
await expect(mgr.transcribePartial(Buffer.alloc(32000))).resolves.toBe('미리보기 텍스트')
|
||||||
|
expect(partialSpy).toHaveBeenCalledOnce()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('does not call the local engine for cloud providers', async () => {
|
||||||
|
const mgr = getSTTManager()
|
||||||
|
mgr.setProvider('groq')
|
||||||
|
mgr.setProviderConfig('groq', { apiKey: 'gsk-test' })
|
||||||
|
|
||||||
|
const { getLocalSTTService } = await import('../../../src/main/services/LocalSTTService')
|
||||||
|
const partialSpy = vi.spyOn(getLocalSTTService(), 'transcribePartial')
|
||||||
|
|
||||||
|
await expect(mgr.transcribePartial(Buffer.alloc(32000))).resolves.toBe('')
|
||||||
|
expect(partialSpy).not.toHaveBeenCalled()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('warms up the local engine only for the local provider', async () => {
|
||||||
|
const mgr = getSTTManager()
|
||||||
|
const { getLocalSTTService } = await import('../../../src/main/services/LocalSTTService')
|
||||||
|
const warmSpy = vi.spyOn(getLocalSTTService(), 'warmUp').mockResolvedValue(true)
|
||||||
|
|
||||||
|
mgr.setProvider('local')
|
||||||
|
await expect(mgr.warmUpLocal()).resolves.toBe(true)
|
||||||
|
|
||||||
|
mgr.setProvider('deepgram')
|
||||||
|
await expect(mgr.warmUpLocal()).resolves.toBe(false)
|
||||||
|
expect(warmSpy).toHaveBeenCalledOnce()
|
||||||
|
})
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
|
||||||
54
apps/desktop/tests/main/utils/loopback.test.ts
Normal file
54
apps/desktop/tests/main/utils/loopback.test.ts
Normal file
|
|
@ -0,0 +1,54 @@
|
||||||
|
// tests/main/utils/loopback.test.ts
|
||||||
|
// 로컬 엔진 URL 정규화 테스트.
|
||||||
|
// Windows에서 localhost가 ::1로만 해석되어 Ollama/sidecar 연결이 실패했던 회귀를 고정한다.
|
||||||
|
|
||||||
|
import { describe, it, expect } from 'vitest'
|
||||||
|
import { loopbackUrl, normalizeLoopbackUrl } from '../../../src/main/utils/loopback'
|
||||||
|
|
||||||
|
describe('normalizeLoopbackUrl', () => {
|
||||||
|
it('rewrites a bare localhost host to the IPv4 loopback', () => {
|
||||||
|
expect(normalizeLoopbackUrl('http://localhost:11434')).toBe('http://127.0.0.1:11434')
|
||||||
|
})
|
||||||
|
|
||||||
|
it('keeps the port and path', () => {
|
||||||
|
expect(normalizeLoopbackUrl('http://localhost:8000/v1')).toBe('http://127.0.0.1:8000/v1')
|
||||||
|
})
|
||||||
|
|
||||||
|
it('handles https and trailing dot host forms', () => {
|
||||||
|
expect(normalizeLoopbackUrl('https://localhost:5000/health')).toBe(
|
||||||
|
'https://127.0.0.1:5000/health',
|
||||||
|
)
|
||||||
|
expect(normalizeLoopbackUrl('http://localhost.:1234')).toBe('http://127.0.0.1:1234')
|
||||||
|
})
|
||||||
|
|
||||||
|
it('leaves remote hosts untouched', () => {
|
||||||
|
expect(normalizeLoopbackUrl('https://api.openai.com/v1')).toBe('https://api.openai.com/v1')
|
||||||
|
expect(normalizeLoopbackUrl('http://192.168.0.10:11434')).toBe('http://192.168.0.10:11434')
|
||||||
|
expect(normalizeLoopbackUrl('http://127.0.0.1:11434')).toBe('http://127.0.0.1:11434')
|
||||||
|
})
|
||||||
|
|
||||||
|
it('does not treat lookalike hostnames as loopback', () => {
|
||||||
|
expect(normalizeLoopbackUrl('http://localhost.evil.com')).toBe('http://localhost.evil.com')
|
||||||
|
})
|
||||||
|
|
||||||
|
it('falls back to a textual rewrite when the URL is not parseable', () => {
|
||||||
|
// 잘못된 포트는 URL 파서가 던진다 → 정규식 폴백 경로를 탄다.
|
||||||
|
expect(normalizeLoopbackUrl('http://localhost:99999999')).toBe(
|
||||||
|
'http://127.0.0.1:99999999',
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('passes through inputs without a recognizable host', () => {
|
||||||
|
expect(normalizeLoopbackUrl('localhost:11434')).toBe('localhost:11434')
|
||||||
|
})
|
||||||
|
|
||||||
|
it('returns empty input unchanged', () => {
|
||||||
|
expect(normalizeLoopbackUrl('')).toBe('')
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('loopbackUrl', () => {
|
||||||
|
it('builds an IPv4 loopback URL for a port', () => {
|
||||||
|
expect(loopbackUrl(18765)).toBe('http://127.0.0.1:18765')
|
||||||
|
})
|
||||||
|
})
|
||||||
97
apps/desktop/tests/main/utils/paths.test.ts
Normal file
97
apps/desktop/tests/main/utils/paths.test.ts
Normal file
|
|
@ -0,0 +1,97 @@
|
||||||
|
// tests/main/utils/paths.test.ts
|
||||||
|
// dev/packaged 경로 해석 테스트.
|
||||||
|
//
|
||||||
|
// 회귀 배경: electron-vite dev에서 app.getAppPath()가 `out/main`을 가리켜
|
||||||
|
// sidecar/SoX가 존재하지 않는 경로로 잡혔고, 결과적으로 로컬 전사와 녹음이
|
||||||
|
// 모두 실패했다(시스템 python/PATH 폴백). 여기서 그 해석을 고정한다.
|
||||||
|
|
||||||
|
import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest'
|
||||||
|
import { existsSync } from 'node:fs'
|
||||||
|
import path from 'node:path'
|
||||||
|
import { app } from 'electron'
|
||||||
|
import {
|
||||||
|
getAppRoot,
|
||||||
|
getSidecarCommand,
|
||||||
|
getSidecarBaseUrl,
|
||||||
|
getSoxPath,
|
||||||
|
resetPathCache,
|
||||||
|
} from '../../../src/main/utils/paths'
|
||||||
|
|
||||||
|
const desktopDir = path.resolve(__dirname, '..', '..', '..')
|
||||||
|
|
||||||
|
describe('paths (dev)', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
resetPathCache()
|
||||||
|
})
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
vi.restoreAllMocks()
|
||||||
|
resetPathCache()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('resolves the app root a level above the vite out/main bundle', () => {
|
||||||
|
// dev에서 app.getAppPath() = <desktop>/out/main 이다.
|
||||||
|
vi.mocked(app.getAppPath).mockReturnValue(path.join(desktopDir, 'out', 'main'))
|
||||||
|
resetPathCache()
|
||||||
|
|
||||||
|
expect(getAppRoot()).toBe(desktopDir)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('prefers the bundled SoX binary over the system PATH', () => {
|
||||||
|
expect(getSoxPath()).toContain(path.join('resources', 'sox', 'sox'))
|
||||||
|
expect(existsSync(getSoxPath())).toBe(true)
|
||||||
|
expect(getSoxPath()).not.toBe('sox')
|
||||||
|
})
|
||||||
|
|
||||||
|
it('uses the sidecar virtualenv python when it exists', () => {
|
||||||
|
const launch = getSidecarCommand()
|
||||||
|
|
||||||
|
expect(launch.source).toBe('venv')
|
||||||
|
expect(launch.command).toContain('.venv')
|
||||||
|
expect(launch.args[0]).toBe(path.join(desktopDir, 'sidecar', 'main.py'))
|
||||||
|
expect(existsSync(launch.command)).toBe(true)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('builds the sidecar base URL on the IPv4 loopback', () => {
|
||||||
|
expect(getSidecarBaseUrl(18765)).toBe('http://127.0.0.1:18765')
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('paths (packaged)', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
resetPathCache()
|
||||||
|
Object.defineProperty(app, 'isPackaged', { value: true, configurable: true })
|
||||||
|
})
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
Object.defineProperty(app, 'isPackaged', { value: false, configurable: true })
|
||||||
|
vi.restoreAllMocks()
|
||||||
|
resetPathCache()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('fails loudly when the packaged sidecar bundle is missing', () => {
|
||||||
|
Object.defineProperty(process, 'resourcesPath', {
|
||||||
|
value: path.join(desktopDir, 'definitely-not-bundled'),
|
||||||
|
configurable: true,
|
||||||
|
})
|
||||||
|
|
||||||
|
expect(() => getSidecarCommand()).toThrowError(/사이드카를 찾을 수 없습니다/)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('uses the packaged sidecar executable when present', () => {
|
||||||
|
Object.defineProperty(process, 'resourcesPath', {
|
||||||
|
value: path.join(desktopDir, 'resources'),
|
||||||
|
configurable: true,
|
||||||
|
})
|
||||||
|
|
||||||
|
// resources/sox 는 커밋되어 있으므로 resources/sidecar/sidecar(.exe)도
|
||||||
|
// 같은 방식으로 배치된다. 존재하지 않는 플랫폼이면 번들 실패로 처리된다.
|
||||||
|
const exeSuffix = process.platform === 'win32' ? '.exe' : ''
|
||||||
|
const bundled = path.join(desktopDir, 'resources', 'sidecar', `sidecar${exeSuffix}`)
|
||||||
|
if (existsSync(bundled)) {
|
||||||
|
expect(getSidecarCommand().source).toBe('bundled')
|
||||||
|
} else {
|
||||||
|
expect(() => getSidecarCommand()).toThrow()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
@ -151,8 +151,8 @@ def versionSettingsValid = configuredVersionName != null &&
|
||||||
configuredVersionName ==~ strictSemver &&
|
configuredVersionName ==~ strictSemver &&
|
||||||
configuredVersionCodeValue != null &&
|
configuredVersionCodeValue != null &&
|
||||||
configuredVersionCodeValue <= 2100000000L
|
configuredVersionCodeValue <= 2100000000L
|
||||||
def resolvedVersionName = versionSettingsValid ? configuredVersionName : "1.2.0"
|
def resolvedVersionName = versionSettingsValid ? configuredVersionName : "1.3.0"
|
||||||
def resolvedVersionCode = versionSettingsValid ? configuredVersionCodeValue.toInteger() : 1020001
|
def resolvedVersionCode = versionSettingsValid ? configuredVersionCodeValue.toInteger() : 1030001
|
||||||
|
|
||||||
def requiredReleaseSettings = [
|
def requiredReleaseSettings = [
|
||||||
D3RO_RELEASE_STORE_FILE: releaseStoreFilePath,
|
D3RO_RELEASE_STORE_FILE: releaseStoreFilePath,
|
||||||
|
|
|
||||||
|
|
@ -257,7 +257,7 @@
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
CLANG_ENABLE_MODULES = YES;
|
CLANG_ENABLE_MODULES = YES;
|
||||||
CURRENT_PROJECT_VERSION = 1020001;
|
CURRENT_PROJECT_VERSION = 1030001;
|
||||||
ENABLE_BITCODE = NO;
|
ENABLE_BITCODE = NO;
|
||||||
INFOPLIST_FILE = D3ROVoice/Info.plist;
|
INFOPLIST_FILE = D3ROVoice/Info.plist;
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 15.1;
|
IPHONEOS_DEPLOYMENT_TARGET = 15.1;
|
||||||
|
|
@ -265,7 +265,7 @@
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
);
|
);
|
||||||
MARKETING_VERSION = 1.2.0;
|
MARKETING_VERSION = 1.3.0;
|
||||||
OTHER_LDFLAGS = (
|
OTHER_LDFLAGS = (
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"-ObjC",
|
"-ObjC",
|
||||||
|
|
@ -287,14 +287,14 @@
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
CLANG_ENABLE_MODULES = YES;
|
CLANG_ENABLE_MODULES = YES;
|
||||||
CURRENT_PROJECT_VERSION = 1020001;
|
CURRENT_PROJECT_VERSION = 1030001;
|
||||||
INFOPLIST_FILE = D3ROVoice/Info.plist;
|
INFOPLIST_FILE = D3ROVoice/Info.plist;
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 15.1;
|
IPHONEOS_DEPLOYMENT_TARGET = 15.1;
|
||||||
LD_RUNPATH_SEARCH_PATHS = (
|
LD_RUNPATH_SEARCH_PATHS = (
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
);
|
);
|
||||||
MARKETING_VERSION = 1.2.0;
|
MARKETING_VERSION = 1.3.0;
|
||||||
OTHER_LDFLAGS = (
|
OTHER_LDFLAGS = (
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"-ObjC",
|
"-ObjC",
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
A stability and quality update. Recording and transcription failures now explain the cause and the fix, and app startup behaviour is more predictable.
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
안정성과 품질 개선 업데이트입니다. 녹음과 전사가 실패할 때 원인과 해결 방법을 더 분명하게 안내하고, 앱 시작 동작을 정리했습니다.
|
||||||
14
apps/mobile-rn/package-lock.json
generated
14
apps/mobile-rn/package-lock.json
generated
|
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "@d3ro/mobile-rn",
|
"name": "@d3ro/mobile-rn",
|
||||||
"version": "1.2.0",
|
"version": "1.3.0",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@d3ro/mobile-rn",
|
"name": "@d3ro/mobile-rn",
|
||||||
"version": "1.2.0",
|
"version": "1.3.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@d3ro/api-client": "file:../../packages/api-client",
|
"@d3ro/api-client": "file:../../packages/api-client",
|
||||||
"@d3ro/core": "file:../../packages/core",
|
"@d3ro/core": "file:../../packages/core",
|
||||||
|
|
@ -62,7 +62,7 @@
|
||||||
},
|
},
|
||||||
"../..": {
|
"../..": {
|
||||||
"name": "d3ro-voice-monorepo",
|
"name": "d3ro-voice-monorepo",
|
||||||
"version": "1.2.0",
|
"version": "1.3.0",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"workspaces": [
|
"workspaces": [
|
||||||
"apps/desktop",
|
"apps/desktop",
|
||||||
|
|
@ -81,7 +81,7 @@
|
||||||
},
|
},
|
||||||
"../../packages/api-client": {
|
"../../packages/api-client": {
|
||||||
"name": "@d3ro/api-client",
|
"name": "@d3ro/api-client",
|
||||||
"version": "1.2.0",
|
"version": "1.3.0",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@d3ro/core": "*",
|
"@d3ro/core": "*",
|
||||||
|
|
@ -98,7 +98,7 @@
|
||||||
},
|
},
|
||||||
"../../packages/core": {
|
"../../packages/core": {
|
||||||
"name": "@d3ro/core",
|
"name": "@d3ro/core",
|
||||||
"version": "1.2.0",
|
"version": "1.3.0",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"docx": "^9.6.1"
|
"docx": "^9.6.1"
|
||||||
|
|
@ -109,7 +109,7 @@
|
||||||
},
|
},
|
||||||
"../../packages/i18n": {
|
"../../packages/i18n": {
|
||||||
"name": "@d3ro/i18n",
|
"name": "@d3ro/i18n",
|
||||||
"version": "1.2.0",
|
"version": "1.3.0",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/react": "^19.0.0"
|
"@types/react": "^19.0.0"
|
||||||
|
|
@ -120,7 +120,7 @@
|
||||||
},
|
},
|
||||||
"../../packages/ui-native": {
|
"../../packages/ui-native": {
|
||||||
"name": "@d3ro/ui-native",
|
"name": "@d3ro/ui-native",
|
||||||
"version": "1.2.0",
|
"version": "1.3.0",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/react": "*"
|
"@types/react": "*"
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@d3ro/mobile-rn",
|
"name": "@d3ro/mobile-rn",
|
||||||
"version": "1.2.0",
|
"version": "1.3.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"android": "react-native run-android",
|
"android": "react-native run-android",
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@d3ro/web",
|
"name": "@d3ro/web",
|
||||||
"version": "1.2.0",
|
"version": "1.3.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"description": "D3RO Voice 웹 앱 — Next.js 기반 SaaS 인터페이스",
|
"description": "D3RO Voice 웹 앱 — Next.js 기반 SaaS 인터페이스",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
|
||||||
|
|
@ -139,7 +139,7 @@ export function Sidebar(): React.ReactElement {
|
||||||
</PhosphorText>
|
</PhosphorText>
|
||||||
</Box>
|
</Box>
|
||||||
<Box sx={{ fontSize: '10px', fontFamily: 'ui-monospace, monospace', color: d3roPalette.text.muted }}>
|
<Box sx={{ fontSize: '10px', fontFamily: 'ui-monospace, monospace', color: d3roPalette.text.muted }}>
|
||||||
v1.2.0
|
v1.3.0
|
||||||
</Box>
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
> Status: ACTIVE
|
> Status: ACTIVE
|
||||||
> Last full audit: 2026-09-13
|
> Last full audit: 2026-09-13
|
||||||
> Scope: entire monorepo `D:/workspace/D3ROVoice` at product version `1.2.0`
|
> Scope: entire monorepo `D:/workspace/D3ROVoice` at product version `1.3.0`
|
||||||
> Purpose: let any agent (or human) answer two questions in under a minute:
|
> Purpose: let any agent (or human) answer two questions in under a minute:
|
||||||
> 1. **What infrastructure exists?** (build, CI, services, APIs, data, packages, deploy)
|
> 1. **What infrastructure exists?** (build, CI, services, APIs, data, packages, deploy)
|
||||||
> 2. **How far is each feature developed?** (per surface, with file anchors and status)
|
> 2. **How far is each feature developed?** (per surface, with file anchors and status)
|
||||||
|
|
|
||||||
|
|
@ -97,7 +97,7 @@ Per-app commands that matter:
|
||||||
|
|
||||||
| App | Commands |
|
| App | Commands |
|
||||||
|---|---|
|
|---|---|
|
||||||
| desktop | `npm run dev --workspace=@d3ro/desktop`, `build`, `typecheck`, `test` (vitest, 1266 tests), playwright e2e |
|
| desktop | `npm run dev --workspace=@d3ro/desktop`, `build`, `typecheck`, `test` (vitest), playwright e2e; local STT engine: `npm --prefix apps/desktop run sidecar:setup` then `sidecar:build` (PyInstaller → `sidecar-dist/sidecar`), full local Windows package: `npm --prefix apps/desktop run dist:win:full`; `setup:sox` re-downloads the bundled SoX |
|
||||||
| mobile-rn | `npm run typecheck:mobile` / `lint:mobile` / `test:mobile` (root), or `npm --prefix apps/mobile-rn run lint/typecheck/test`; android gradle builds, Maestro E2E |
|
| mobile-rn | `npm run typecheck:mobile` / `lint:mobile` / `test:mobile` (root), or `npm --prefix apps/mobile-rn run lint/typecheck/test`; android gradle builds, Maestro E2E |
|
||||||
| api-server | `dotnet build`, `dotnet test` (also `apps/api-server.Tests`) |
|
| api-server | `dotnet build`, `dotnet test` (also `apps/api-server.Tests`) |
|
||||||
| web | `next build`, playwright e2e in `apps/web/e2e` |
|
| web | `next build`, playwright e2e in `apps/web/e2e` |
|
||||||
|
|
@ -136,7 +136,7 @@ See [`03-shared-packages.md`](./03-shared-packages.md). Summary:
|
||||||
|
|
||||||
### GitLab CI (`.gitlab-ci.yml`)
|
### GitLab CI (`.gitlab-ci.yml`)
|
||||||
|
|
||||||
Stages `validate → test → build → e2e → package → publish → deploy`. Primary pipeline for desktop Windows/macOS releases (Forgejo Generic Registry is the canonical updater feed; GitLab project 1172 is a legacy mirror) and production mobile releases (`mobile-production-release`, manual/protected). Admin NAS deploy job is intentionally **disabled**.
|
Stages `validate → test → build → e2e → package → publish → deploy`. Primary pipeline for desktop Windows/macOS releases (Forgejo Generic Registry is the canonical updater feed; GitLab project 1172 is a legacy mirror) and production mobile releases (`mobile-production-release`, manual/protected). Admin NAS deploy job is intentionally **disabled**. `package-windows`/`package-macos` build the faster-whisper sidecar (`sidecar:setup` → `sidecar:build`) and run `scripts/ci/verify-sidecar-bundle.mjs` before electron-builder, so a release can never ship without the local STT engine.
|
||||||
|
|
||||||
### Forgejo Actions (`.forgejo/workflows/`)
|
### Forgejo Actions (`.forgejo/workflows/`)
|
||||||
|
|
||||||
|
|
@ -190,11 +190,11 @@ Full detail: [`09-supabase-backend.md`](./09-supabase-backend.md).
|
||||||
|
|
||||||
| File | Purpose |
|
| File | Purpose |
|
||||||
|---|---|
|
|---|---|
|
||||||
| `release/product-version.json` | version `1.2.0`, `androidVersionCode`/`iosBuildNumber` `1020001`, releaseDate, desktop license keyId |
|
| `release/product-version.json` | version `1.3.0`, `androidVersionCode`/`iosBuildNumber` `1030001`, releaseDate, desktop license keyId |
|
||||||
| `release/android-release-identity.json` | package `com.d3ro.voice`, Play app ID, app-signing SHA-256, upload cert SHA-256, evidence keyId, AdMob unit IDs |
|
| `release/android-release-identity.json` | package `com.d3ro.voice`, Play app ID, app-signing SHA-256, upload cert SHA-256, evidence keyId, AdMob unit IDs |
|
||||||
| `release/desktop-license-public.pem` | Ed25519 public key for desktop offline licenses |
|
| `release/desktop-license-public.pem` | Ed25519 public key for desktop offline licenses |
|
||||||
| `release/mobile-release-evidence-public.pem` | Ed25519 public key for mobile release evidence |
|
| `release/mobile-release-evidence-public.pem` | Ed25519 public key for mobile release evidence |
|
||||||
| `apps/desktop/electron-builder.yml` | appId `com.d3ro.voice`, NSIS x64 (forced code signing), macOS DMG/ZIP arm64, generic Forgejo publish feed, asarUnpack native modules, extraResources (icons, sounds, sox, ollama) |
|
| `apps/desktop/electron-builder.yml` | appId `com.d3ro.voice`, NSIS x64 (forced code signing), macOS DMG/ZIP arm64, generic Forgejo publish feed, asarUnpack native modules + `@ffmpeg-installer`, extraResources (icons, sounds, sox, **sidecar**, ffmpeg, ollama) |
|
||||||
| `apps/desktop/src/main/update-feed.ts` | Auto-update feed SSOT (canonical Forgejo + legacy GitLab mirror, channels) |
|
| `apps/desktop/src/main/update-feed.ts` | Auto-update feed SSOT (canonical Forgejo + legacy GitLab mirror, channels) |
|
||||||
| `release/update-policy.json` | Update policy SSOT (channels, minimum supported version, forced update, delta/full, staged rollout, kill switch) |
|
| `release/update-policy.json` | Update policy SSOT (channels, minimum supported version, forced update, delta/full, staged rollout, kill switch) |
|
||||||
| `apps/desktop/src/main/update-policy.ts` | Policy parsing/decision logic |
|
| `apps/desktop/src/main/update-policy.ts` | Policy parsing/decision logic |
|
||||||
|
|
@ -207,6 +207,8 @@ Version sync is enforced by `scripts/ci/sync-version.mjs` and `verify-release-me
|
||||||
## 10. Resources & tests
|
## 10. Resources & tests
|
||||||
|
|
||||||
- `resources/sox/` — bundled Windows SoX (`sox.exe` + DLLs) for audio capture.
|
- `resources/sox/` — bundled Windows SoX (`sox.exe` + DLLs) for audio capture.
|
||||||
|
- `resources/ffmpeg/` — optional bundled ffmpeg (CI or manual); `getFfmpegPath()` also resolves the `@ffmpeg-installer/ffmpeg` binary from `app.asar.unpacked`.
|
||||||
|
- `apps/desktop/sidecar-dist/` — PyInstaller sidecar bundle consumed by `extraResources` (gitignored; built by `npm --prefix apps/desktop run sidecar:build`).
|
||||||
- `resources/icons/` — empty; electron-builder falls back to `build/icon.ico|png`.
|
- `resources/icons/` — empty; electron-builder falls back to `build/icon.ico|png`.
|
||||||
- Desktop tests: `apps/desktop/tests/` (vitest unit + playwright e2e), `apps/desktop/test-results/`.
|
- Desktop tests: `apps/desktop/tests/` (vitest unit + playwright e2e), `apps/desktop/test-results/`.
|
||||||
- Mobile tests: `apps/mobile-rn/__tests__/` (57 suites / 353 tests per mobile SSOT), `.maestro/` + `.maestro-output/` E2E evidence. Note: a full parallel Jest run can hit the 5s render timeout on slow machines; re-run the failing spec in isolation before treating it as a regression.
|
- Mobile tests: `apps/mobile-rn/__tests__/` (57 suites / 353 tests per mobile SSOT), `.maestro/` + `.maestro-output/` E2E evidence. Note: a full parallel Jest run can hit the 5s render timeout on slow machines; re-run the failing spec in isolation before treating it as a regression.
|
||||||
|
|
|
||||||
|
|
@ -28,8 +28,8 @@ Singleton + `EventEmitter` pattern (`getXService()` accessors).
|
||||||
| Service | Purpose |
|
| Service | Purpose |
|
||||||
|---|---|
|
|---|---|
|
||||||
| `VoiceModeService` | Orchestrator: 9-state `RecognitionState` + 4-state `AudioState`, dual-condition flush, action queue. Events: session-started/completed/cancelled, transcription-update, audio-level, recognition/audio-state-changed, premium-llm-fallback, error |
|
| `VoiceModeService` | Orchestrator: 9-state `RecognitionState` + 4-state `AudioState`, dual-condition flush, action queue. Events: session-started/completed/cancelled, transcription-update, audio-level, recognition/audio-state-changed, premium-llm-fallback, error |
|
||||||
| `AudioCaptureService` | Mic PCM16 16kHz mono (SoX on Windows, node-record-lpcm16 elsewhere). Events: audio-data, audio-level, device-changed, started, stopped, error |
|
| `AudioCaptureService` | Mic PCM16 16kHz mono (bundled SoX on Windows, node-record-lpcm16 elsewhere). Spawns hidden (`windowsHide`); a missing SoX fails with the exact fix command |
|
||||||
| `LocalSTTService` | faster-whisper Python sidecar manager (state machine, dual-flush, model download/cancel) |
|
| `LocalSTTService` | faster-whisper Python sidecar manager (state machine, dual-flush, model download/cancel, background warm-up, live partial transcription). Connects over IPv4 loopback (`getSidecarBaseUrl`) and fails fast with an actionable message when the bundled engine or virtualenv is missing |
|
||||||
| `HotkeyService` | uiohook-napi global hooking (dictation/hands-free/command/caption). Events: hotkey-pressed/released, double-press, error |
|
| `HotkeyService` | uiohook-napi global hooking (dictation/hands-free/command/caption). Events: hotkey-pressed/released, double-press, error |
|
||||||
| `TextInsertService` | Clipboard save→set→Ctrl+V→restore via nut-js |
|
| `TextInsertService` | Clipboard save→set→Ctrl+V→restore via nut-js |
|
||||||
| `SoundEffectService` | Preloaded WAV feedback (start/stop/error/cancel/chime) |
|
| `SoundEffectService` | Preloaded WAV feedback (start/stop/error/cancel/chime) |
|
||||||
|
|
@ -37,7 +37,7 @@ Singleton + `EventEmitter` pattern (`getXService()` accessors).
|
||||||
### STT engine layer (`services/stt/`)
|
### STT engine layer (`services/stt/`)
|
||||||
| File | Purpose |
|
| File | Purpose |
|
||||||
|---|---|
|
|---|---|
|
||||||
| `STTManager` | Dispatcher across local + 6 cloud providers, auto-fallback (events provider-changed, config-changed, fallback-to-local) |
|
| `STTManager` | Dispatcher across local + 6 cloud providers, auto-fallback (events provider-changed, config-changed, fallback-to-local). `transcribePartial`/`warmUpLocal` route to the local engine only |
|
||||||
| `types.ts` | `ISTTDriver` contract |
|
| `types.ts` | `ISTTDriver` contract |
|
||||||
| `audio-utils.ts` | `pcmToWav`, `createProbeWav` |
|
| `audio-utils.ts` | `pcmToWav`, `createProbeWav` |
|
||||||
| `drivers/OpenAI|Groq|Deepgram|AssemblyAI|Google|Custom|D3ROCloud` | Provider drivers; `D3ROCloudDriver` uses Supabase access token |
|
| `drivers/OpenAI|Groq|Deepgram|AssemblyAI|Google|Custom|D3ROCloud` | Provider drivers; `D3ROCloudDriver` uses Supabase access token |
|
||||||
|
|
@ -184,6 +184,8 @@ DB schema (`src/main/db/schema.ts`, drizzle SQLite): `history`, `dictionary`, `s
|
||||||
- Core dictation/LLM/history pipeline: **implemented + tested** (~590 desktop tests; vitest + playwright).
|
- Core dictation/LLM/history pipeline: **implemented + tested** (~590 desktop tests; vitest + playwright).
|
||||||
- Cross-platform packaging: Windows NSIS (signed, `forceCodeSigning`), macOS DMG/ZIP arm64 (ad-hoc signing); auto-update via canonical Forgejo feed with update policy (`release/update-policy.json`).
|
- Cross-platform packaging: Windows NSIS (signed, `forceCodeSigning`), macOS DMG/ZIP arm64 (ad-hoc signing); auto-update via canonical Forgejo feed with update policy (`release/update-policy.json`).
|
||||||
- Local-first AI (SoX + faster-whisper sidecar + bundled Ollama) and cloud paths both present.
|
- Local-first AI (SoX + faster-whisper sidecar + bundled Ollama) and cloud paths both present.
|
||||||
|
- **Local STT is packaged** (`1.3.0`): `electron-builder.yml` `extraResources` copies `sidecar-dist/sidecar` → `resources/sidecar` and `resources/ffmpeg` → `resources/ffmpeg`; `scripts/ci/verify-sidecar-bundle.mjs` gates packaging. Build locally with `npm --prefix apps/desktop run sidecar:setup && npm --prefix apps/desktop run sidecar:build`. The sidecar stays in console mode so `stdout`/`stderr` reach the app log (UTF-8, line-buffered); a packaged sidecar **must** exist or startup fails loudly instead of silently falling back to a system Python.
|
||||||
|
- All local engine URLs (`LocalSTTService`, `LocalLLMService`, `RAGService`, `OnlineLLMService`, `STTManager`) pass through `src/main/utils/loopback.ts`, which rewrites `localhost` to `127.0.0.1`, because some Windows hosts resolve `localhost` to IPv6 only and local engines bind IPv4.
|
||||||
- Meeting intelligence, RAG, voice conversation (local + Realtime), captions, file transcription: implemented.
|
- Meeting intelligence, RAG, voice conversation (local + Realtime), captions, file transcription: implemented.
|
||||||
- **Ad mediation**: `DirectHouseSponsorAdapter` performs real configurable REST bids; the other 9 adapters remain fail-closed stubs pending official SDKs (see `11-gap-backlog.md` GAP-ADS-01/02).
|
- **Ad mediation**: `DirectHouseSponsorAdapter` performs real configurable REST bids; the other 9 adapters remain fail-closed stubs pending official SDKs (see `11-gap-backlog.md` GAP-ADS-01/02).
|
||||||
- Tier resolution now routes through `@d3ro/core/entitlement` (`resolveEntitlement`, `normalizeEntitlementTier`); `useLicenseState.isPro` includes `pro_plus`.
|
- Tier resolution now routes through `@d3ro/core/entitlement` (`resolveEntitlement`, `normalizeEntitlementTier`); `useLicenseState.isPro` includes `pro_plus`.
|
||||||
|
|
@ -206,3 +208,5 @@ DB schema (`src/main/db/schema.ts`, drizzle SQLite): `history`, `dictionary`, `s
|
||||||
| Renderer shell / routes | `src/renderer/components/AppLayout.tsx` |
|
| Renderer shell / routes | `src/renderer/components/AppLayout.tsx` |
|
||||||
| Update feed SSOT | `src/main/update-feed.ts` |
|
| Update feed SSOT | `src/main/update-feed.ts` |
|
||||||
| Update policy SSOT | `release/update-policy.json` + `src/main/update-policy.ts` |
|
| Update policy SSOT | `release/update-policy.json` + `src/main/update-policy.ts` |
|
||||||
|
| Path/loopback resolution | `src/main/utils/paths.ts`, `src/main/utils/loopback.ts` |
|
||||||
|
| Sidecar source / packaging | `sidecar/main.py`, `scripts/setup-sidecar.mjs`, `scripts/build-sidecar.mjs`, `scripts/ci/verify-sidecar-bundle.mjs` |
|
||||||
|
|
|
||||||
|
|
@ -16,11 +16,11 @@ Status quick-reference: `[x]` done+verified · `[~]` partial/unverified · `[ ]`
|
||||||
|---|---|---|---|---|---|---|
|
|---|---|---|---|---|---|---|
|
||||||
| CAP-01 | Push-to-talk dictation (hold/release) | [x] | [-] | [x] | [-] | Desktop `VoiceModeService`; mobile RecordScreen via app CTA/notification action (no global hotkey) |
|
| CAP-01 | Push-to-talk dictation (hold/release) | [x] | [-] | [x] | [-] | Desktop `VoiceModeService`; mobile RecordScreen via app CTA/notification action (no global hotkey) |
|
||||||
| CAP-02 | Hands-free toggle dictation | [x] | [-] | [x] | [-] | Desktop double-press; mobile toggle |
|
| CAP-02 | Hands-free toggle dictation | [x] | [-] | [x] | [-] | Desktop double-press; mobile toggle |
|
||||||
| CAP-03 | Live partial transcript while recording | [x] | [ ] | [ ] | [-] | Desktop `voice:partialTranscript` + recording-tip |
|
| CAP-03 | Live partial transcript while recording | [x] | [ ] | [ ] | [-] | Desktop `voice:partialTranscript` + recording-tip; producer added in `1.3.0` (`VoiceModeService._runPartial` → `LocalSTTService.transcribePartial`, 1.5 s cadence / 7.5 s window, never inserted). The row was `[x]` before any producer existed. |
|
||||||
| CAP-04 | Recording waveform + level meter | [x] | [x] | [x] | [-] | Desktop 9-bar cos distribution; mobile audio level |
|
| CAP-04 | Recording waveform + level meter | [x] | [x] | [x] | [-] | Desktop 9-bar cos distribution; mobile audio level |
|
||||||
| CAP-05 | Device/mic selection | [x] | [ ] | [~] | [-] | Desktop config; mobile uses system default |
|
| CAP-05 | Device/mic selection | [x] | [ ] | [~] | [-] | Desktop config; mobile uses system default |
|
||||||
| CAP-06 | System/loopback audio capture | [x] | [-] | [ ] | [-] | Desktop only (caption source); mobile policy-limited |
|
| CAP-06 | System/loopback audio capture | [x] | [-] | [ ] | [-] | Desktop only (caption source); mobile policy-limited |
|
||||||
| CAP-07 | Local Whisper STT | [x] | [-] | [x] | [-] | Desktop sidecar; mobile on-device Whisper (supported devices) |
|
| CAP-07 | Local Whisper STT | [x] | [-] | [x] | [-] | Desktop ships the faster-whisper sidecar (`resources/sidecar`, built by `sidecar:build`, verified by `scripts/ci/verify-sidecar-bundle.mjs`), warms it up at app start, and connects over IPv4 loopback; mobile on-device Whisper (supported devices) |
|
||||||
| CAP-08 | Cloud STT (multi-provider) | [x] | [x] | [x] | [x] | Desktop 6 providers + D3RO Cloud; web/mobile via `stt-proxy`; .NET internal gateway |
|
| CAP-08 | Cloud STT (multi-provider) | [x] | [x] | [x] | [x] | Desktop 6 providers + D3RO Cloud; web/mobile via `stt-proxy`; .NET internal gateway |
|
||||||
| CAP-09 | STT auto-fallback + fail-closed | [x] | [x] | [x] | [x] | `STTManager`; SSOT R-021/R-022 GREEN |
|
| CAP-09 | STT auto-fallback + fail-closed | [x] | [x] | [x] | [x] | `STTManager`; SSOT R-021/R-022 GREEN |
|
||||||
| CAP-10 | STT model download/management UI | [x] | [-] | [~] | [-] | Desktop model manager + onboarding; mobile bundled model |
|
| CAP-10 | STT model download/management UI | [x] | [-] | [~] | [-] | Desktop model manager + onboarding; mobile bundled model |
|
||||||
|
|
@ -191,7 +191,8 @@ Status quick-reference: `[x]` done+verified · `[~]` partial/unverified · `[ ]`
|
||||||
| INFRA-11 | Docker + NAS deploy | [x] | `docker-compose.nas.yml`, `scripts/deploy-nas.*` |
|
| INFRA-11 | Docker + NAS deploy | [x] | `docker-compose.nas.yml`, `scripts/deploy-nas.*` |
|
||||||
| INFRA-12 | Cloudflare edge + tunnel | [x] | `server/cloudflare-worker`, Cloudflare Tunnel `kd-nas` |
|
| INFRA-12 | Cloudflare edge + tunnel | [x] | `server/cloudflare-worker`, Cloudflare Tunnel `kd-nas` |
|
||||||
| INFRA-13 | Site deploy (Cloudflare Pages + GitHub Pages) | [x] | `.forgejo/workflows/deploy-site.yml`, `.github/workflows/deploy-site.yml` |
|
| INFRA-13 | Site deploy (Cloudflare Pages + GitHub Pages) | [x] | `.forgejo/workflows/deploy-site.yml`, `.github/workflows/deploy-site.yml` |
|
||||||
| INFRA-15 | Update & release system | [x] | Canonical Forgejo feed + channels/policy (`release/update-policy.json`, `src/main/update-policy.ts`), canonical publisher `scripts/ci/publish-forgejo-release.mjs`, legacy GitLab mirror; `npm run release:metadata:test`. v1.1.0 was published to Forgejo on 2026-09-15; product version moved to `1.2.0` as a forward-fix with CI-only publication, a same-version re-release guard, and download centers that link the feed instead of repository paths. |
|
| INFRA-15 | Update & release system | [x] | Canonical Forgejo feed + channels/policy (`release/update-policy.json`, `src/main/update-policy.ts`), canonical publisher `scripts/ci/publish-forgejo-release.mjs`, legacy GitLab mirror; `npm run release:metadata:test`. v1.1.0 was published to Forgejo on 2026-09-15; product version moved to `1.2.0` as a forward-fix with CI-only publication, a same-version re-release guard, and download centers that link the feed instead of repository paths. `1.3.0` (2026-09-18) carries the local-STT fixes; Windows publication still needs the CI signing secrets (`11` GAP-REL-02). |
|
||||||
|
| INFRA-16 | Desktop STT engine packaging | [x] | `apps/desktop/scripts/setup-sidecar.mjs` + `build-sidecar.mjs`, `electron-builder.yml` `extraResources` (`sidecar-dist/sidecar` → `resources/sidecar`, `resources/ffmpeg`), and `scripts/ci/verify-sidecar-bundle.mjs` run in `package-windows`/`package-macos` before electron-builder. Verified on the real bundle: `sidecar.exe` + `_internal` including `faster_whisper/assets/silero_vad_v6.onnx`, plus a packaged-engine transcription round-trip on GPU. |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ Legend: `[ ]` open · `[~]` in progress · `[!]` blocked externally · `[x]` res
|
||||||
|---|---|---|---|---|
|
|---|---|---|---|---|
|
||||||
| GAP-QA-01 | Quality | Extreme Red Team: headful end-to-end bug hunting across real desktop Electron, Web Next.js, and CI pipelines. | `red_team_log.md`, `tests/e2e/red_team_cycle*.spec.ts`, `apps/web/e2e/red_team_cycle4_web.spec.ts` | `[x]` 2026-09-15: 18 scenarios executed, 14 defects caught and 100% resolved (infinite chunking loop DEF-008, IPC signature mismatch DEF-004, markdown editor typing rollback DEF-006, Web RSC Link serialization DEF-012, secret scanner lookahead DEF-013, etc.). All 18 scenarios GREEN with zero regressions. |
|
| GAP-QA-01 | Quality | Extreme Red Team: headful end-to-end bug hunting across real desktop Electron, Web Next.js, and CI pipelines. | `red_team_log.md`, `tests/e2e/red_team_cycle*.spec.ts`, `apps/web/e2e/red_team_cycle4_web.spec.ts` | `[x]` 2026-09-15: 18 scenarios executed, 14 defects caught and 100% resolved (infinite chunking loop DEF-008, IPC signature mismatch DEF-004, markdown editor typing rollback DEF-006, Web RSC Link serialization DEF-012, secret scanner lookahead DEF-013, etc.). All 18 scenarios GREEN with zero regressions. |
|
||||||
| GAP-REL-01 | Release | Official release publication to Forgejo and active public download center deployment. | `scripts/ci/publish-forgejo-release.mjs`, `apps/web/src/app/download/page.tsx`, `site/src/sections/Download.tsx`, `apps/web/e2e/red_team_cycle4_web.spec.ts` | `[~]` 2026-09-15: v1.1.0 release assets (`D3RO-Voice-Setup-1.1.0-x64.exe`, `.blockmap`, `latest.yml`, `update-policy.json`) published to canonical Forgejo registry and release hub. 2026-09-16: the published 1.1.0 installer carries no Authenticode signature, so it does not satisfy the release policy; product version moved to `1.2.0` and publication must come from CI with the signing gate GREEN. Download centers in `apps/web` (`/download`) and `site` (`#download`) link the canonical Forgejo feed. |
|
| GAP-REL-01 | Release | Official release publication to Forgejo and active public download center deployment. | `scripts/ci/publish-forgejo-release.mjs`, `apps/web/src/app/download/page.tsx`, `site/src/sections/Download.tsx`, `apps/web/e2e/red_team_cycle4_web.spec.ts` | `[~]` 2026-09-15: v1.1.0 release assets (`D3RO-Voice-Setup-1.1.0-x64.exe`, `.blockmap`, `latest.yml`, `update-policy.json`) published to canonical Forgejo registry and release hub. 2026-09-16: the published 1.1.0 installer carries no Authenticode signature, so it does not satisfy the release policy; product version moved to `1.2.0` and publication must come from CI with the signing gate GREEN. Download centers in `apps/web` (`/download`) and `site` (`#download`) link the canonical Forgejo feed. |
|
||||||
| GAP-REL-02 | Release | Windows stable publication needs an external public-trust Authenticode PFX, its password, the exact signer subject, and a Forgejo token, none of which live in the repository. | `.forgejo/workflows/release.yml`, `.gitlab-ci.yml`, `scripts/ci/verify-windows-release-artifact.ps1` | `[!]` 2026-09-16: every publisher fails closed without `WIN_CSC_*` and `FORGEJO_TOKEN`; provide them as protected CI secrets, then re-run the `1.2.0` tag pipeline. |
|
| GAP-REL-02 | Release | Windows stable publication needs an external public-trust Authenticode PFX, its password, the exact signer subject, and a Forgejo token, none of which live in the repository. | `.forgejo/workflows/release.yml`, `.gitlab-ci.yml`, `scripts/ci/verify-windows-release-artifact.ps1` | `[!]` 2026-09-16: every publisher fails closed without `WIN_CSC_*` and `FORGEJO_TOKEN`; provide them as protected CI secrets, then re-run the tag pipeline. Still open as of `1.3.0` (2026-09-18): the `v1.3.0` tag must be built by CI with the signing gate GREEN. Local packaging cannot produce a signed installer (`forceCodeSigning: true`). |
|
||||||
| GAP-ADS-01 | Ads | 9 of 10 desktop ad adapters still extend `UnavailableAdAdapter` (`provider_not_integrated`). | `apps/desktop/src/main/services/ads/*` | `[~]` 2026-09-13: `DirectHouseSponsorAdapter` is now a real configurable REST adapter (bid/impression/click/reward via `endpointUrl`; fail-closed when unconfigured; 22 unit tests GREEN). Remaining 9 need official SDKs/authenticated endpoints. |
|
| GAP-ADS-01 | Ads | 9 of 10 desktop ad adapters still extend `UnavailableAdAdapter` (`provider_not_integrated`). | `apps/desktop/src/main/services/ads/*` | `[~]` 2026-09-13: `DirectHouseSponsorAdapter` is now a real configurable REST adapter (bid/impression/click/reward via `endpointUrl`; fail-closed when unconfigured; 22 unit tests GREEN). Remaining 9 need official SDKs/authenticated endpoints. |
|
||||||
| GAP-ADS-02 | Ads | Desktop mediation reward accounting is not wired to license quota (`claimReward` still returns no tokens). | `AdMediationEngine.ts`, `AppLayout.tsx` | Wire verified `reportRewardCompletion` to `LicenseService` quota after the direct sponsor endpoint exists. |
|
| GAP-ADS-02 | Ads | Desktop mediation reward accounting is not wired to license quota (`claimReward` still returns no tokens). | `AdMediationEngine.ts`, `AppLayout.tsx` | Wire verified `reportRewardCompletion` to `LicenseService` quota after the direct sponsor endpoint exists. |
|
||||||
| GAP-ID-01 | Identity | Supabase, .NET JWT/SQLite, and the desktop offline license each had their own tier/role shape. | `@d3ro/core/entitlement`, `LicenseService`, `entitlement-context` | `[~]` 2026-09-13: canonical `EntitlementSnapshot` + `resolveEntitlement` added with tests; desktop tier normalization + `isPro` fixed. Full adoption tracked as GAP-ID-02. |
|
| GAP-ID-01 | Identity | Supabase, .NET JWT/SQLite, and the desktop offline license each had their own tier/role shape. | `@d3ro/core/entitlement`, `LicenseService`, `entitlement-context` | `[~]` 2026-09-13: canonical `EntitlementSnapshot` + `resolveEntitlement` added with tests; desktop tier normalization + `isPro` fixed. Full adoption tracked as GAP-ID-02. |
|
||||||
|
|
@ -42,6 +42,12 @@ Legend: `[ ]` open · `[~]` in progress · `[!]` blocked externally · `[x]` res
|
||||||
| GAP-PUSH-02 | Push | Nothing triggered `send-push?mode=drain`; enqueued notifications never left the outbox. | `server/cloudflare-worker/src/push-drain.ts`, `wrangler.toml` | `[x]` 2026-09-13: Cloudflare Cron Trigger (`* * * * *`) drains the outbox; tests in CI. Requires `SUPABASE_URL` + `SUPABASE_SERVICE_ROLE_KEY` secret on the worker. |
|
| GAP-PUSH-02 | Push | Nothing triggered `send-push?mode=drain`; enqueued notifications never left the outbox. | `server/cloudflare-worker/src/push-drain.ts`, `wrangler.toml` | `[x]` 2026-09-13: Cloudflare Cron Trigger (`* * * * *`) drains the outbox; tests in CI. Requires `SUPABASE_URL` + `SUPABASE_SERVICE_ROLE_KEY` secret on the worker. |
|
||||||
| GAP-PUSH-03 | Push | Mobile/web clients register only `fcm`; no service worker subscription or APNs device token. | `apps/mobile-rn/src/features/notifications/*`, `apps/web` | Add web service worker + `pushManager.subscribe` (store JSON subscription) and iOS APNs token registration. |
|
| GAP-PUSH-03 | Push | Mobile/web clients register only `fcm`; no service worker subscription or APNs device token. | `apps/mobile-rn/src/features/notifications/*`, `apps/web` | Add web service worker + `pushManager.subscribe` (store JSON subscription) and iOS APNs token registration. |
|
||||||
| GAP-PUSH-04 | Push | Android still depends on FCM (`google-services.json`). | `apps/mobile-rn/android`, `send-push` | Decide: minimal Firebase project, or UnifiedPush/ntfy. See `docs/deployment/push-transport-without-firebase.md`. |
|
| GAP-PUSH-04 | Push | Android still depends on FCM (`google-services.json`). | `apps/mobile-rn/android`, `send-push` | Decide: minimal Firebase project, or UnifiedPush/ntfy. See `docs/deployment/push-transport-without-firebase.md`. |
|
||||||
|
| GAP-STT-01 | Local STT | Packaged desktop builds shipped **no** faster-whisper sidecar: `electron-builder.yml` had no `extraResources` entry for it and no pipeline job built it. Local transcription was impossible on any installed build; the app fell back to a system Python without the runtime. | `apps/desktop/electron-builder.yml`, `.gitlab-ci.yml`, `apps/desktop/scripts/build-sidecar.mjs` | `[x]` 2026-09-18: sidecar bundled via `extraResources` (`sidecar-dist/sidecar` → `resources/sidecar`), `sidecar:setup`/`sidecar:build` scripts, and `scripts/ci/verify-sidecar-bundle.mjs` fails packaging when the engine or its Silero VAD data is missing. Verified on the real 242 MB bundle. |
|
||||||
|
| GAP-STT-02 | Local STT | Dev resolved the sidecar/SoX paths against the Vite output dir (`out/main`), so the sidecar ran a Python without faster-whisper and SoX recording died with `spawn sox ENOENT`. | `apps/desktop/src/main/utils/paths.ts`, `apps/desktop/tests/main/utils/paths.test.ts` | `[x]` 2026-09-18: app root is discovered by walking up for app markers; packaged mode fails loudly instead of silently falling back. Unit tests pin both branches. |
|
||||||
|
| GAP-STT-03 | Local engines | On hosts where `localhost` resolves only to IPv6, every local engine call (STT sidecar and Ollama) was refused. Audio capture and local LLM appeared dead. | `apps/desktop/src/main/utils/loopback.ts`, `LocalSTTService`, `LocalLLMService`, `RAGService`, `OnlineLLMService`, `STTManager` | `[x]` 2026-09-18: loopback normalization to `127.0.0.1` for all local engine URLs; defaults updated; 9 unit tests. Verified against the live sidecar and Ollama on a host with an IPv6-only `localhost`. |
|
||||||
|
| GAP-STT-04 | Local STT | Live partial transcript (`CAP-03`, `voice:partialTranscript`) was marked done but had **no producer**: the channel, popup UI, and preload existed, nothing ever emitted. | `apps/desktop/src/main/services/VoiceModeService.ts`, `LocalSTTService.transcribePartial`, `STTManager.transcribePartial` | `[x]` 2026-09-18: 1.5 s cadence over a 7.5 s trailing window, greedy decode, drained before the final transcription; never inserted. |
|
||||||
|
| GAP-STT-05 | Local STT | The bundled sidecar lacked faster-whisper's Silero VAD data, so `vad_filter=true` transcription would have failed at runtime even with the engine bundled. | `apps/desktop/scripts/build-sidecar.mjs`, `scripts/ci/verify-sidecar-bundle.mjs` | `[x]` 2026-09-18: `--collect-all faster_whisper` plus a packaging-time presence check for `assets/silero_vad_v6.onnx`. |
|
||||||
|
| GAP-STT-06 | Local STT | Decode settings were untuned: previous-text conditioning let repeated hallucinations compound, and no VAD parameters meant slow, uneven segments. | `apps/desktop/sidecar/main.py` | `[x]` 2026-09-18: `condition_on_previous_text=false`, bounded low-temperature fallback, `no_speech`/`compression_ratio`/`log_prob` thresholds, 300 ms silence trimming. Same transcript, ~5x faster on the reference machine (7.7 s audio: 1609 ms → 303 ms). |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
@ -97,7 +103,9 @@ These are the mobile SSOT rows still `[ ]` / `[~]`. Do not duplicate the full te
|
||||||
|
|
||||||
## 5. Quick "is X done?" lookup
|
## 5. Quick "is X done?" lookup
|
||||||
|
|
||||||
- **Desktop local dictation / LLM / history / meetings / RAG / conversation:** yes, tested. Ads: one real adapter, rest stubs.
|
- **Desktop local dictation / LLM / history / meetings / RAG / conversation:** local
|
||||||
|
dictation works in dev **and** in packaged builds as of `1.3.0` (engine bundled, paths
|
||||||
|
fixed, IPv4 loopback). Ads: one real adapter, rest stubs.
|
||||||
- **Web console:** yes, feature-complete for server-shared data; knowledge upload/search and team feed implemented.
|
- **Web console:** yes, feature-complete for server-shared data; knowledge upload/search and team feed implemented.
|
||||||
- **Mobile:** code complete for most flows and tested locally; blocked mainly by external store/console gates, plus a11y and some E2E depth.
|
- **Mobile:** code complete for most flows and tested locally; blocked mainly by external store/console gates, plus a11y and some E2E depth.
|
||||||
- **Backend:** fail-closed AI proxies, RLS, billing, ads SSV implemented; push transports (FCM + webpush + APNs) and cron drain implemented.
|
- **Backend:** fail-closed AI proxies, RLS, billing, ads SSV implemented; push transports (FCM + webpush + APNs) and cron drain implemented.
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,52 @@
|
||||||
# D3RO-VOICE 프로젝트 현황
|
# D3RO-VOICE 프로젝트 현황
|
||||||
|
|
||||||
|
## v1.3.0 — 로컬 전사가 실제로 동작하게 (2026-09-18) 🎙️
|
||||||
|
|
||||||
|
설치본에서 로컬 전사가 **한 번도 성공한 적 없던** 원인을 끝까지 추적해 수정. 엔진 자체는
|
||||||
|
정상이었고, 배선(경로/루프백/패키징)이 전부 어긋나 있었다.
|
||||||
|
|
||||||
|
**원인 (실측 근거)**
|
||||||
|
1. **패키지에 사이드카가 없었다**: `electron-builder.yml` extraResources에 sidecar 항목이
|
||||||
|
없었고 CIS도 PyInstaller 빌드를 하지 않았다. 설치본 `resources/`에는 icons/sounds/sox만
|
||||||
|
존재 → 항상 faster-whisper 없는 시스템 Python으로 폴백 → 즉사.
|
||||||
|
2. **dev 경로 해석 실패**: electron-vite는 `out/main/index.js`를 직접 띄워 `app.getAppPath()`가
|
||||||
|
`apps/desktop/out/main`이 된다. 그래서 `out/main/sidecar/main.py`(없음) + 시스템 Python 3.14,
|
||||||
|
SoX도 `spawn sox ENOENT`. 실제 venv(`apps/desktop/sidecar/.venv`, py3.11 + faster-whisper 1.2.1)는
|
||||||
|
한 번도 사용되지 않았다.
|
||||||
|
3. **localhost = ::1 only**: 이 호스트는 `localhost`가 IPv6로만 해석된다. 사이드카(uvicorn)와
|
||||||
|
Ollama는 127.0.0.1에만 바인딩 → `http://localhost:...` 요청 전부 ECONNREFUSED. STT와 로컬 LLM이
|
||||||
|
동시에 죽어 있었다.
|
||||||
|
4. **VAD 데이터 누락**: faster-whisper의 `assets/silero_vad_v6.onnx`를 PyInstaller가 수집하지
|
||||||
|
않아, 사이드카를 번들했더라도 VAD 사용 시 런타임 실패했을 것.
|
||||||
|
5. **CAP-03(실시간 부분 전사)은 프로듀서가 없었다**: 채널/팝업/preload는 있는데 emit하는 코드가 0.
|
||||||
|
|
||||||
|
**수정**
|
||||||
|
- `paths.ts`: 앱 루트를 마커(`sidecar/main.py`, `resources/sox`)로 탐색. 패키지 모드에서 사이드카가
|
||||||
|
없으면 조용히 폴백하지 않고 즉시 실패(명확한 조치 안내).
|
||||||
|
- `loopback.ts`: `localhost` → `127.0.0.1` 정규화 (LocalSTT/LocalLLM/RAG/OnlineLLM/STTManager,
|
||||||
|
ConfigService 기본값). 단위 테스트 9개.
|
||||||
|
- 패키징: extraResources에 `sidecar-dist/sidecar → resources/sidecar`, `resources/ffmpeg → ffmpeg`,
|
||||||
|
ffmpeg는 `@ffmpeg-installer` 의존성 + asarUnpack. `setup-sidecar.mjs`/`build-sidecar.mjs` +
|
||||||
|
`scripts/ci/verify-sidecar-bundle.mjs`(VAD onnx 존재 검증) → CI `package-windows/macos`에 추가.
|
||||||
|
실측 번들: sidecar.exe 9.4MB + `_internal` 242MB, GPU 전사 왕복 성공.
|
||||||
|
- 사이드카: 모델 재사용, `--collect-all faster_whisper`/`ctranslate2`, console 모드 유지(로그 수집) +
|
||||||
|
spawn `windowsHide`, UTF-8 강제(PYTHONIOENCODING/`reconfigure`), 줄 단위 로그 파이프.
|
||||||
|
- 성능/정합성: `condition_on_previous_text=False`, 온도 폴백 제한([0.0,0.2,0.4]),
|
||||||
|
no_speech/compression/log_prob 임계, VAD `min_silence_duration_ms=300`, `cpu_threads` 8 상한.
|
||||||
|
**7.7초 오디오: 1609ms → 303ms (약 5배)**, 전사문 동일.
|
||||||
|
- 체감: 앱 시작 시 `warmUpLocal()`로 sidecar+모델 예열(bootstrap `stt-warmup`), 녹음 중 1.5초마다
|
||||||
|
최근 7.5초 창 부분 전사 → RecordingTip 미리보기(삽입되지 않음, 최종 전사 전에 drain).
|
||||||
|
|
||||||
|
**검증**: typecheck 0, 변경 파일 lint 0, 신규 테스트 18개 GREEN(loopback 9 / paths 6 / STTManager 3 —
|
||||||
|
기존 361건 실패는 better-sqlite3가 Electron ABI(130)로 빌드되어 Node 23(131)에서 로드 실패하는
|
||||||
|
**선행 환경 문제**로 본 변경과 무관). 실제 사이드카 통합 테스트(실제 PCM 7.7초)로 최종 전사/부분
|
||||||
|
전사 확인. electron-builder `--dir`로 패키지 산출물에 sidecar/_internal/VAD/ffmpeg/sox 존재 확인.
|
||||||
|
|
||||||
|
**미해결(외부)**: Windows 공개 서명(WIN_CSC_*)이 없어 로컬에서 서명된 설치본을 만들 수 없다 →
|
||||||
|
`v1.3.0` 태그는 CI가 서명 게이트와 함께 빌드해야 한다(`11` GAP-REL-02).
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## D3RO NAS Docker 클라우드 서비스 배포 체계 구축 (2026-08-19 /goal) 🚀
|
## D3RO NAS Docker 클라우드 서비스 배포 체계 구축 (2026-08-19 /goal) 🚀
|
||||||
|
|
||||||
D3RO Voice의 클라우드 API 백엔드, AI 프록시, 관리자 백오피스(BackOffice)를 Synology, QNAP, Linux 등 NAS 환경에 Docker 컨테이너로 손쉽게 배포하고 운영할 수 있는 완전 자동화 인프라를 구축 완료.
|
D3RO Voice의 클라우드 API 백엔드, AI 프록시, 관리자 백오피스(BackOffice)를 Synology, QNAP, Linux 등 NAS 환경에 Docker 컨테이너로 손쉽게 배포하고 운영할 수 있는 완전 자동화 인프라를 구축 완료.
|
||||||
|
|
|
||||||
3795
package-lock.json
generated
3795
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "d3ro-voice-monorepo",
|
"name": "d3ro-voice-monorepo",
|
||||||
"version": "1.2.0",
|
"version": "1.3.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"description": "D3RO Voice — 멀티플랫폼 AI 음성 어시스턴트 (Monorepo)",
|
"description": "D3RO Voice — 멀티플랫폼 AI 음성 어시스턴트 (Monorepo)",
|
||||||
"author": "D3RO",
|
"author": "D3RO",
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@d3ro/api-client",
|
"name": "@d3ro/api-client",
|
||||||
"version": "1.2.0",
|
"version": "1.3.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"description": "D3RO Voice API 클라이언트 — Supabase 래퍼 (web/desktop/mobile 공유)",
|
"description": "D3RO Voice API 클라이언트 — Supabase 래퍼 (web/desktop/mobile 공유)",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@d3ro/core",
|
"name": "@d3ro/core",
|
||||||
"version": "1.2.0",
|
"version": "1.3.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"description": "D3RO Voice 공유 비즈니스 로직 — 타입, 에러, IPC 채널, 상수, 유틸",
|
"description": "D3RO Voice 공유 비즈니스 로직 — 타입, 에러, IPC 채널, 상수, 유틸",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@d3ro/i18n",
|
"name": "@d3ro/i18n",
|
||||||
"version": "1.2.0",
|
"version": "1.3.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"description": "D3RO Voice 공유 i18n — 12개 locale, 타입 안전 키, Context, 포맷 유틸",
|
"description": "D3RO Voice 공유 i18n — 12개 locale, 타입 안전 키, Context, 포맷 유틸",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@d3ro/ui-native",
|
"name": "@d3ro/ui-native",
|
||||||
"version": "1.2.0",
|
"version": "1.3.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"description": "D3RO Voice React Native DS — MetalCard/PhosphorText/Led/WaveBars etc.",
|
"description": "D3RO Voice React Native DS — MetalCard/PhosphorText/Led/WaveBars etc.",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@d3ro/ui",
|
"name": "@d3ro/ui",
|
||||||
"version": "1.2.0",
|
"version": "1.3.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"description": "D3RO Voice 공유 UI — 디자인 시스템 컴포넌트 + 테마 토큰 + CSS 변수 맵",
|
"description": "D3RO Voice 공유 UI — 디자인 시스템 컴포넌트 + 테마 토큰 + CSS 변수 맵",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
{
|
{
|
||||||
"schemaVersion": 1,
|
"schemaVersion": 1,
|
||||||
"version": "1.2.0",
|
"version": "1.3.0",
|
||||||
"androidVersionCode": 1020001,
|
"androidVersionCode": 1030001,
|
||||||
"iosBuildNumber": 1020001,
|
"iosBuildNumber": 1030001,
|
||||||
"releaseDate": "2026-09-16",
|
"releaseDate": "2026-09-18",
|
||||||
"desktopLicensePublicKeyId": "5c52b765135ee2531c681b53cd4dc0e96fff8737f496c0b04ba8334fc81a887f"
|
"desktopLicensePublicKeyId": "5c52b765135ee2531c681b53cd4dc0e96fff8737f496c0b04ba8334fc81a887f"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
57
scripts/ci/verify-sidecar-bundle.mjs
Normal file
57
scripts/ci/verify-sidecar-bundle.mjs
Normal file
|
|
@ -0,0 +1,57 @@
|
||||||
|
// scans/ci/verify-sidecar-bundle.mjs
|
||||||
|
// 패키징 전에 STT 사이드카 번들이 실제로 존재하고 필수 데이터가 들어있는지 검증한다.
|
||||||
|
//
|
||||||
|
// 왜 필요한가: electron-builder의 extraResources는 소스 디렉토리가 없으면 조용히
|
||||||
|
// 건너뛴다. 그 결과 로컬 전사가 전혀 동작하지 않는 설치 파일이 배포된 이력이 있다.
|
||||||
|
// 패키징 직전에 하드 실패시켜 같은 회귀를 막는다.
|
||||||
|
//
|
||||||
|
// 사용: node scripts/ci/verify-sidecar-bundle.mjs
|
||||||
|
|
||||||
|
import { existsSync, statSync } from 'node:fs'
|
||||||
|
import path from 'node:path'
|
||||||
|
import { fileURLToPath } from 'node:url'
|
||||||
|
|
||||||
|
const scriptDir = path.dirname(fileURLToPath(import.meta.url))
|
||||||
|
const repoRoot = path.resolve(scriptDir, '..', '..')
|
||||||
|
const desktopDir = path.join(repoRoot, 'apps', 'desktop')
|
||||||
|
const bundleDir = path.join(desktopDir, 'sidecar-dist', 'sidecar')
|
||||||
|
const exeSuffix = process.platform === 'win32' ? '.exe' : ''
|
||||||
|
const exePath = path.join(bundleDir, `sidecar${exeSuffix}`)
|
||||||
|
|
||||||
|
/** 패키지에 반드시 포함돼야 하는 런타임 데이터 (PyInstaller 6은 _internal/ 하위) */
|
||||||
|
const REQUIRED_RELATIVE = [
|
||||||
|
// faster-whisper VAD onnx — 누락하면 vad_filter=true 전사가 런타임에 실패한다.
|
||||||
|
['faster_whisper', 'assets', 'silero_vad_v6.onnx'],
|
||||||
|
]
|
||||||
|
|
||||||
|
const problems = []
|
||||||
|
|
||||||
|
if (!existsSync(exePath)) {
|
||||||
|
problems.push(
|
||||||
|
`사이드카 실행 파일이 없습니다: ${exePath}\n` +
|
||||||
|
' 빌드: npm --prefix apps/desktop run sidecar:setup && npm --prefix apps/desktop run sidecar:build',
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (existsSync(bundleDir)) {
|
||||||
|
for (const parts of REQUIRED_RELATIVE) {
|
||||||
|
const candidates = [
|
||||||
|
path.join(bundleDir, '_internal', ...parts),
|
||||||
|
path.join(bundleDir, ...parts),
|
||||||
|
]
|
||||||
|
if (!candidates.some((candidate) => existsSync(candidate))) {
|
||||||
|
problems.push(
|
||||||
|
`사이드카 번들에 필수 데이터가 없습니다: ${candidates[0]} (또는 ${candidates[1]})`,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (problems.length > 0) {
|
||||||
|
console.error('STT 사이드카 번들 검증 실패:')
|
||||||
|
for (const problem of problems) console.error(`- ${problem}`)
|
||||||
|
process.exit(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
const sizeMb = statSync(exePath).size / (1024 * 1024)
|
||||||
|
console.log(`STT 사이드카 번들 검증 통과: ${exePath} (${sizeMb.toFixed(1)} MB)`)
|
||||||
4
site/package-lock.json
generated
4
site/package-lock.json
generated
|
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "d3ro-voice-site",
|
"name": "d3ro-voice-site",
|
||||||
"version": "1.2.0",
|
"version": "1.3.0",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "d3ro-voice-site",
|
"name": "d3ro-voice-site",
|
||||||
"version": "1.2.0",
|
"version": "1.3.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"react": "^19.0.0",
|
"react": "^19.0.0",
|
||||||
"react-dom": "^19.0.0"
|
"react-dom": "^19.0.0"
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "d3ro-voice-site",
|
"name": "d3ro-voice-site",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "1.2.0",
|
"version": "1.3.0",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite --port 5199 --host",
|
"dev": "vite --port 5199 --host",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue