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
+19 -8
View File
@@ -52,7 +52,8 @@ EXAMPLE_SRCS = \
$(EXAMPLE_DIR)/app/SecurityExtraDemo.cpp \
$(EXAMPLE_DIR)/app/PlatformDemo.cpp \
$(EXAMPLE_DIR)/app/EnterpriseDemo.cpp \
$(EXAMPLE_DIR)/app/ResilienceDemo.cpp
$(EXAMPLE_DIR)/app/ResilienceDemo.cpp \
$(EXAMPLE_DIR)/app/VoiceDemo.cpp
# Tests are discovered: every tests/example/**/*_test.cpp is one route test.
EXAMPLE_TEST_JOBS ?= 8
@@ -68,10 +69,15 @@ EXAMPLE_ASSETS = \
$(EXAMPLE_DIR)/assets/app.css \
$(EXAMPLE_DIR)/assets/chart.umd.min.js \
$(EXAMPLE_DIR)/assets/hello.txt \
$(EXAMPLE_DIR)/assets/stats.js
EXAMPLE_INC = -I$(EXAMPLE_DIR) -I$(EXAMPLE_BUILD)
$(EXAMPLE_DIR)/assets/stats.js \
$(EXAMPLE_DIR)/assets/voice.js
EXAMPLE_INC = -I$(EXAMPLE_DIR) -I$(EXAMPLE_BUILD) -Isrc
# Real framework parts the example links: Google Cloud (src/google) over the
# HTTP client (src/clients, wolfSSL TLS) and the operability breaker.
EXAMPLE_REAL_LIBS = build/google/libgoogle.a build/clients/libclients.a \
build/liboperability.a
.PHONY: example example-assets example-test example-clean example-locust
.PHONY: example example-real-libs example-assets example-test example-clean example-locust
# Asset embedding is part of the build: example/assets (Chart.js included)
# becomes generated C++ under build/example/gen via the MoloApp embedder.
@@ -86,7 +92,12 @@ $(EXAMPLE_GEN)/assets.cpp: $(EXAMPLE_ASSETS) $(EXAMPLE_DIR)/tools/embed_assets.c
$(EXAMPLE_BUILD)/embed_assets $(EXAMPLE_DIR)/assets \
$(EXAMPLE_GEN)/assets.cpp $(EXAMPLE_GEN)/assets.hpp molo::example::gen
example: example-assets
example-real-libs:
$(MAKE) -f src/operability.mk build/liboperability.a
$(MAKE) -f src/clients/clients.mk clients
$(MAKE) -f src/google/google.mk google
example: example-assets example-real-libs
mkdir -p $(EXAMPLE_BUILD)/obj
for s in $(EXAMPLE_SRCS); do \
o=$(EXAMPLE_BUILD)/obj/`echo $$s | tr '/' '_'`.o; \
@@ -98,7 +109,7 @@ example: example-assets
$(MAKE) -f src/supervisor/supervisor.mk build/supervisor/libsupervisor.a
$(CXX) $(EXAMPLE_CXXFLAGS) -I$(EXAMPLE_DIR) -Isrc $(EXAMPLE_DIR)/main.cpp \
$(EXAMPLE_BUILD)/libexample.a build/supervisor/libsupervisor.a \
-o $(EXAMPLE_BUILD)/living-server
$(EXAMPLE_REAL_LIBS) -lwolfssl -o $(EXAMPLE_BUILD)/living-server
example-test: example
rm -rf $(EXAMPLE_BUILD)/tests
@@ -107,8 +118,8 @@ example-test: example
xargs -P $(EXAMPLE_TEST_JOBS) -I{} sh -c ' \
t={}; n=`echo $$t | sed "s|$(EXAMPLE_TESTDIR)/||; s|/|_|g; s|\\.cpp$$||"`; \
b=$(EXAMPLE_BUILD)/tests/$$n; \
if $(CXX) $(EXAMPLE_CXXFLAGS) -I$(EXAMPLE_DIR) -I$(EXAMPLE_TESTDIR) \
$$t $(EXAMPLE_BUILD)/libexample.a -o $$b > $$b.log 2>&1; \
if $(CXX) $(EXAMPLE_CXXFLAGS) -I$(EXAMPLE_DIR) -I$(EXAMPLE_TESTDIR) -Isrc \
$$t $(EXAMPLE_BUILD)/libexample.a $(EXAMPLE_REAL_LIBS) -lwolfssl -o $$b > $$b.log 2>&1; \
then $$b >> $$b.log 2>&1; else echo "COMPILE FAILED: $$t" >> $$b.log; false; fi; \
echo $$? > $$b.rc' < $(EXAMPLE_BUILD)/tests/list.txt
pass=0; fail=0; \