feat(clients): google cloud voice: generic client, TTS, STT, Gemini audio, live voice page

src/google: GoogleClient over molo::clients (key in x-goog-api-key, never in
URLs), Service base, TextToSpeech, SpeechToText, Generative (replies, audio
in, audio out), Recognizer/Synthesizer seams with cloud, gemini and vertex
backends, VoicePipeline with bounded history. Example: /voice live
conversation page, /voice/{say,hear,turn,reset}, /google/status. Keys load
from env, .env.json.local, .env.json. Paid routes are excluded from locust.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-24 04:05:41 +02:00
co-authored by Claude Sonnet 5.5
parent dd773d3015
commit 837de58136
54 changed files with 3086 additions and 21 deletions
+26 -5
View File
@@ -45,6 +45,20 @@ owning sibling plan and the file that will close it.
builder, singleflight, ttl store). Each is a skeleton of the real `src/`
module; per-module gaps are in the header of its `fw/` file.
16. Voice (`src/google`, the real framework part, not a skeleton):
`GET /voice` is a hands-free conversation page. The browser detects
speech from the microphone level, records one utterance, posts it to
`POST /voice/turn`, plays the spoken answer, and listens again;
speaking over the answer interrupts it. The server runs Google
speech-to-text, a Gemini reply and Google text-to-speech per turn, with
bounded per-conversation history. `POST /voice/say` and `/voice/hear`
expose the two speech services alone; `GET /google/status` shows
credential state and known services (never the key). No
`GOOGLE_API_KEY`: 503 `google_not_configured`. Upstream failure: 502
`google_error` with Google's status. Bad input: 422 or 415 before any
network call. Routes and tests use a scripted transport; the key lives
only in the `x-goog-api-key` header.
## Caps
All ceilings live as literals in `example/fw/Caps.hpp`: 1 MiB request body,
@@ -76,11 +90,13 @@ auth, 403 bad credentials, 404 unknown, 405 wrong method, 406 no format,
## Isolation
May depend on: C++23 stdlib, POSIX sockets, `example/fw/` only. Build-time
only: the embedder sources in `src/cli/embed` (asset embedding). May NOT
depend on: any `src/` tree (does not exist yet in this worktree), wolfSSL
(stub behind `ITlsContext`), real Postgres/SQLite (in-memory doubles),
real network except loopback. Namespaces mirror directories:
May depend on: C++23 stdlib, POSIX sockets, `example/fw/`, and the real
framework parts it links on purpose: `src/google` over `src/clients` (HTTPS
via wolfSSL) and `src/operability`. Build-time only: the embedder sources in
`src/cli/embed` (asset embedding). May NOT
depend on: other `src/` trees, real Postgres/SQLite (in-memory doubles),
real network except Google through `src/google` (tests script that
transport; only the opt-in `MOLO_LIVE_NET=1` tests touch the network). Namespaces mirror directories:
`molo::example::fw` and `molo::example::app`.
## Gaps
@@ -98,6 +114,11 @@ real network except loopback. Namespaces mirror directories:
- Full validation coercions, template sandbox, DI container, flash
messages: owner 05-request-routing.md, files `example/fw/Validate.*`,
`example/fw/Templates.*`, `example/app/App.*`.
- Voice turns are request/response over REST (about 2 to 4 s per turn).
The loopback server accepts sequentially, so one in-flight turn blocks
other requests meanwhile. Streaming recognition and the Gemini Live API:
owner `src/google/SPEC.md`, gaps section. Owner of concurrent accept:
01-runtime.md, `example/fw/Server.*`.
- Server accepts sequentially and stops after 512 connections (cap above);
the stats page shows connections left. Owner: 01-runtime.md,
`example/fw/Server.*`.