|
Download docs/SPEC-DRIVERS.md from LoveLogicAI/freestream: direct link, hf CLI and curl.
- Browser
- Download file 3.67 kB
-
https://huggingface.co/datasets/LoveLogicAI/freestream/resolve/main/docs/SPEC-DRIVERS.md
- Command line
-
hf download hf://datasets/LoveLogicAI/freestream/docs/SPEC-DRIVERS.md
-
curl -L -o SPEC-DRIVERS.md https://huggingface.co/datasets/LoveLogicAI/freestream/resolve/main/docs/SPEC-DRIVERS.md
3.67 kB
SPEC-DRIVERS — backend interface specs
Every layer is a driver with a common interface, chosen per run. A driver never prints; it raises typed errors and the CLI maps them to exit codes.
Error contract
| Exception | Exit | Meaning |
|---|---|---|
ValidationError |
2 | bad input (URL, missing image, unknown driver) |
DriverError |
3 | transport failure (HTTP, WebSocket, track error) |
SessionError |
4 | session refused/failed/closed by remote |
CapabilityShortfall |
6 | driver deps/config missing on this host; carries capability + remediation |
PresenceDriver
class PresenceDriver:
name: str # registry key: "browser" | "livekit" | "sip"
audio: bool # owns a mic track?
video: bool # owns a camera track?
join(meet_url, platform, bot_name, image, voice,
system_prompt, meeting_password) -> session_id
status(session_id) -> "joining" | "ready" | "error" | "closed"
video_connected(session_id) -> bool
bot_connected(session_id) -> bool
leave(session_id) -> None
Contract rules:
joinreturns a driver-global session id stable across CLI invocations (leave is a separate process).- Sessions must survive the joining process — state lives in a driver
registry on disk (
.freestream/sessions/<id>/driver.json), not in memory. joinmust emit event-log entries (driver.join_attempted,session.created,session.status, …) when a log is attached.- Missing host capabilities are
CapabilityShortfall, never crashes. - Sessions must survive process teardown — state lives in a driver
registry on disk (
.freestream/sessions/<id>/driver.json), not in memory.
livekit driver (MVP target)
- Joins a LiveKit room via
livekit-rtcwith a local track: mic-in fed by the persona TTS output, camera-in fed by the avatar frame sink. - ASR subscribes to remote audio tracks; faster-whisper consumes them.
- Lowest jitter of the free drivers; requires the meeting to run on LiveKit/Jitsi (self-hosted or open instance).
- Config:
LIVEKIT_URL,LIVEKIT_TOKEN(room-local token minted byfreestreamfor bot-name).
browser driver (post-MVP)
- Playwright/Chromium joins as a guest; virtual camera (v4l2loopback on Linux, BlackHole + AVFoundation on macOS) supplies avatar frames; virtual mic supplies TTS audio.
- Needs per-platform join packs: URL validation, guest-button selectors, permission-grant selectors, pre-admit waiting-room handling. Selector drift is the maintenance hotspot; packs are versioned and pinned per platform build (see docs/PLATFORMS.md).
- Commercial platforms (Meet/Zoom) are ToS gray zones — shipped last.
sip driver (audio-only)
- Dials a conferencing bridge via SIP; near-zero cost, no video.
- Fidelity rung caps at AUDIO_REACTIVE_WAVE (no camera track).
- Config:
FREESTREAM_SIP_URI, trunk credentials.
Persona drivers
VoiceBackend:piper(default, CPU real-time) →xtts-local(cloning).clone()returns the Pika-compatible dict and writeslife/voice_id.txtlife/voice_config.json. Clones are local files, never uploaded.
AvatarBackend: selected byselect_rung()from the fidelity ladder (FULL_PORTRAIT 4 → STATIC_CARD 1). Rung degrades downward at runtime if measured FPS < target for 5s; every downgrade is an event-log entry.
Cognition
- MCP server (
freestream/mcp_server.py): stdio JSON-RPC by default, HTTP whenFREESTREAM_MCP_HTTP=host:port. Tools:session.observe,session.speak,session.listen,session.leave. The agent is the participant; FREESTREAM owns presence and persona only.