feat(pheby): add authenticated GPT-Live voice setup

Use Hermes to exchange WebRTC offers for the connector profile. Keep cancellation acknowledgments private and guard replacement runs against stale delivery.
This commit is contained in:
Chris Mendoza
2026-11-20 12:36:28 -05:00
parent 3bfb300a2f
commit 49b180922d
8 changed files with 462 additions and 72 deletions
+21 -1
View File
@@ -210,7 +210,27 @@ another `chat.send` receives `run_active`. Never infer state from text.
Cancellation uses Hermes's supported interrupt mechanism (agent interrupt +
run-generation invalidation) — the conversation stays consistent and
resumable. A stale `run_id`, missing run, or run that Hermes can no longer
interrupt returns `not_found`; success emits exactly one cancelled event.
interrupt returns `not_found`. If the request carries a `request_id`, the caller
gets a correlated `run.finished` reply. Every authenticated client also gets the
same terminal event without the request ID.
### GPT-Live setup
Both HTTP routes accept `Authorization: Bearer <Pheby secret>`.
- `GET /voice-live/status` returns `available`, `reason`, `model`, and `voice`
when supported. Availability describes whether Hermes can resolve a key.
- `POST /voice-live/session` accepts `{"sdp":"<WebRTC offer>"}` and returns
`{"session_id":"<Live session ID>","sdp":"<WebRTC answer>"}`. Keep SDP line
endings intact. The connector supplies the Hermes voice prompt and uses
client delegation.
Submit a delegated voice turn through `chat.send` with the existing
`conversation_id`. `voice_context` marks a spoken turn and can include the
superseded request for a correction (up to 6000 characters, or an empty string
for the initial request). Hermes receives the context as a turn note. The
`run_id` in `run.accepted` correlates the primary
`message.complete` and `run.finished` with that turn.
---
+10
View File
@@ -144,6 +144,7 @@ pheby.example.com {
# WebSocket + API
reverse_proxy /ws 127.0.0.1:8620
reverse_proxy /attachments/* 127.0.0.1:8620
reverse_proxy /voice-live/* 127.0.0.1:8620
reverse_proxy /health 127.0.0.1:8620
# Optionally restrict by source when on a public VPS:
@@ -210,6 +211,15 @@ Notes:
---
## GPT-Live Voice Mode
Voice Mode uses the installed Hermes `tools.voice_live` helper for the same
gateway profile that owns Pheby. Configure an OpenAI key for that profile
(`OPENAI_API_KEY` or `voice.gpt_live.api_key`). The connector authenticates
call setup with the Pheby secret and gives the app an SDP answer. Android
exchanges audio with OpenAI over WebRTC and submits delegated turns through
the existing chat connection.
## Debugging & logging
Set `PHEBY_DEBUG=true` (env) or `extra.debug: true` (YAML) for verbose