Metadata-Version: 2.4
Name: fastpluggy-voice
Version: 0.1.6
Summary: FastPluggy voice plugin — WhisperX batch + sherpa-onnx live STT + pyannote diarization + Wyoming TCP. Owns the engine in-process.
Author: FastPluggy Team
License-Expression: MIT
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: FastPluggy>=0.4.33
Requires-Dist: loguru
Requires-Dist: sqlalchemy>=2.0
Requires-Dist: psycopg2-binary>=2.9
Requires-Dist: httpx>=0.27
Requires-Dist: torch
Requires-Dist: torchaudio
Requires-Dist: whisperx>=3.8.2
Requires-Dist: sherpa-onnx
Requires-Dist: pyannote.audio
Requires-Dist: huggingface_hub
Requires-Dist: wyoming
Requires-Dist: python-multipart
Requires-Dist: numpy
Provides-Extra: tests
Requires-Dist: pytest>=7.0; extra == "tests"
Requires-Dist: pytest-cov>=4.0; extra == "tests"
Requires-Dist: pytest-asyncio>=0.24; extra == "tests"
Requires-Dist: respx>=0.21; extra == "tests"
Requires-Dist: testcontainers[postgres]>=4.0; extra == "tests"

# fastpluggy-voice

FastPluggy plugin that **owns** the voice engine — WhisperX batch + sherpa-onnx live + pyannote diarization + Wyoming TCP — in-process. Replaces the standalone `whisper-api` Docker container.

> **Status:** Phase 1 skeleton. The engine port (Phase 3), HTTP/WS routes (Phase 4), and admin UI (Phase 5) are still planned — see [`wip-ia-code/plans/voice-plugin.md`](../../wip-ia-code/plans/voice-plugin.md).

## What this is replacing

| Source | Will become |
|---|---|
| `infra/stacks/voice-stack/whisper_api.py` (971 LOC standalone app) | `src/engine/` + `src/transports/` + `src/routers/` in this plugin |
| `infra/stacks/voice-stack/docker-compose.yml` (whisper-api service) | Plugin deployed on a GPU host via `fp_deployer` |
| `plugins/audio_transcript` (faster-whisper engine + session UI) | Useful UI pieces (`<fp-voice-button>`, sessions, model cache, GPU widgets) move here; plugin retired afterward |

## Requirements

- GPU host with CUDA (production).
- Postgres reachable for transcription history + speaker enrollment.
- Wyoming TCP port `10300` free (Home Assistant integration).

## Install (dev)

```bash
cd plugins/voice
/home/jerome/PycharmProjects/fp-ecosystem/.venv/bin/pip install -e ".[tests]"
```

## Configuration

Settings live on `VoiceSettings` (see `src/config.py`) — backed by the standard FastPluggy `BaseDatabaseSettings`. Defaults mirror the env-var contract of the standalone `whisper-api` container so a like-for-like migration only needs values copied across.

## Architecture

Engine startup happens in `VoicePlugin.on_load_complete` — model loads synchronously, Wyoming TCP server runs as a background `asyncio.create_task` on the FastPluggy event loop. Single-worker `ThreadPoolExecutor` serializes GPU access across HTTP / WS / Wyoming, mirroring how `whisper_api.py` does it today.

Worker-mode (`fast_pluggy.app is None`) skips engine init — the plugin is a no-op outside the HTTP process.

## Layout

```
src/
├── plugin.py             # VoicePlugin(FastPluggyBaseModule)
├── config.py             # VoiceSettings
├── models.py             # Transcription, Speaker, SpeakerEmbedding, VoiceSession
├── engine/               # whisperx, sherpa-onnx, speakers, executor    (Phase 3)
├── transports/           # wyoming_server                                (Phase 3)
├── routers/              # api, speakers, stream, tts                    (Phase 4)
│   └── admin/            # UI routes (sessions, speakers, history, ...)  (Phase 5)
├── services/             # sessions, tts_proxy
├── static/               # JS (fp-voice-button, audio_ws), CSS
└── templates/            # admin UI pages
```
