diff --git a/docs/CURRENT_SYSTEM.md b/docs/CURRENT_SYSTEM.md index fe4ecd7..0aaf4b6 100644 --- a/docs/CURRENT_SYSTEM.md +++ b/docs/CURRENT_SYSTEM.md @@ -23,9 +23,10 @@ zeigte im kontrollierten Kurztest keinen erkennbaren Gewinn durch die sechs neuen Mehrbenutzer-Schalter; sie bleiben produktiv aus. SSD-Druck beim langen Einlesen besteht fort. Das vorherige IQ3-Single-Profil wurde regulär wieder geladen. Das MP3-Update wurde anschließend auf diese Strata-Version aufgesetzt und mit -expliziter Neustartfreigabe aktiviert. [Sprachtests und offene WebUI-Anbindung](experiments/hermes-voice-2026-10-17/README.md). -Browser-Diktat und Browser-Vorlesen sind bestätigt; Athena-TTS am Vorleseknopf -ist wegen der privaten URL noch nicht eingerichtet. +expliziter Neustartfreigabe aktiviert. [Sprachtests und WebUI-Anbindung](experiments/hermes-voice-2026-10-17/README.md). +Browser-Diktat und lokale Athena-TTS-Wiedergabe sind bestätigt. Die ausdrücklich +freigegebene, auf eine LAN-URL begrenzte WebUI-Anpassung ist persistent aktiv. +Offen: OmniVoice braucht eine feste Referenz, damit die Stimme nicht pro Abschnitt wechselt. Am 11. Oktober 2026: Strata-Q4 nach Vergleich verworfen, keine produktive Q4-Profilfreigabe. Isolierte Q4-Testdateien und Gewichte entfernt; historische diff --git a/docs/experiments/hermes-voice-2026-10-17/README.md b/docs/experiments/hermes-voice-2026-10-17/README.md index cef0159..e634d7a 100644 --- a/docs/experiments/hermes-voice-2026-10-17/README.md +++ b/docs/experiments/hermes-voice-2026-10-17/README.md @@ -1,9 +1,9 @@ # Hermes speech integration — 17 October 2026 User requested complete TTS, STT and Live Talk where supported. This report -separates agent tools from browser controls. Native Athena TTS on the browser's -Listen button is still pending a routing/integration decision; do not mark the -whole voice setup complete based on browser speech synthesis. +separates agent tools from browser controls. Local Athena TTS is now active on the Listen button and the user confirmed +hearing the local voice. Voice consistency is NOT resolved: OmniVoice currently +generates without a reference and randomizes the seed for each request. ## Verified components @@ -32,8 +32,8 @@ whole voice setup complete based on browser speech synthesis. ## Persisted WebUI settings and microphone acceptance -`raw_audio_mode=false`, `tts_enabled=true`, `tts_engine=browser`, -`tts_voice=Anna`, `voice_mode_button=true`, `language=de`. +`raw_audio_mode=false`, `tts_enabled=true`, `tts_engine=openai`, +`tts_voice=Anna` (only relevant to the previous browser engine), `voice_mode_button=true`, `language=de`. Regular auto-read remains off; hands-free mode has its own response playback. The regular UI save initially showed raw audio off but a later server read had @@ -52,8 +52,8 @@ OpenAI TTS targets; HTTP is accepted only for literal localhost and HTTPS must resolve to globally routable addresses. The WebUI's own HTTPS origin therefore does not solve a private provider URL. The existing Athena and OI hostnames resolve privately inside this container; no public audio route was -created. No SSRF bypass, fake DNS/loopback mapping, relay or new extension -was installed. +created. No fake DNS/loopback mapping, relay or new extension was installed. The user +subsequently explicitly approved the narrow LAN policy exception below. The built-in hands-free mode uses browser SpeechRecognition, pause detection, send and reply playback. It does not use Parakeet for that mode and is not @@ -62,9 +62,8 @@ path. Browser microphone access requires HTTPS and user permission. Current upstream gallery has no ready TTS extension for this LAN integration. A supported custom TTS extension API exists but writing/integrating a new one -would be our own adaptation. User has been asked to choose between a real -public authenticated HTTPS audio endpoint and evaluating a targeted local -WebUI change. No such change has been made yet. +would be our own adaptation. The user explicitly approved the targeted local WebUI change; this is our +operator adaptation, not an official upstream fix. ## Persistence and restore @@ -80,3 +79,61 @@ Sources: - https://github.com/nesquena/hermes-webui/blob/master/static/boot.js - https://github.com/nesquena/hermes-webui/blob/master/docs/EXTENSIONS.md - https://github.com/hermes-webui/hermes-webui-extensions/blob/main/extensions/README.md + +## Approved local TTS activation + +The existing persistent `integrations/hermes-unraid/webui/start-with-gateway.sh` +now applies a source-hash-pinned insertion before the upstream initializer. +The initializer rsyncs `/apptoo` to `/app`, so the patch targets +`/apptoo/api/routes.py`, not the overwritten runtime copy. The first activation +was corrected for this ordering and the unoccupied container restarted again. +The final runtime and template both match patched SHA256 +`5e51d1e2791804b825bdd3c8f000faaea3989d34cdbcd6c406800573eb8e5710`. +Original SHA256: +`9f32e7ca096a491a36c1e774752af18c2d02ca402af4dad1886a5048deae10dc`. + +Only `HERMES_WEBUI_TRUSTED_TTS_BASE_URL=http://192.168.1.212:8120/v1` +is permitted as the extra literal RFC1918 HTTP destination. Credentials, +queries, fragments, other IPs/ports/paths and metadata addresses remain rejected. +Authentication, no-redirect handling, HTTPS pinning and the response validation +code are unchanged. Eleven isolated checks passed, including unchanged ASTs of +those handlers. Bash syntax validation passed. No own image or extra mount. +An unknown future upstream source is NOT patched: startup warns and retains +upstream policy, so local TTS then needs revalidation after an image update. + +The existing provider key was internally copied to the WebUI-supported +`VOICE_TOOLS_OPENAI_KEY` in its private persistent `.env`; no key was printed +or committed. `api.config.save_settings` persisted the OpenAI server engine. +Regular UI confirms the engine selection; the user confirmed actual local +voice playback. Both WebUI and gateway reported healthy/idle after restart; +Docker restart policy remains `unless-stopped`. + +A real request using the WebUI normalizer/opener/response buffer, existing +credentials and its unchanged 30-second timeout returned HTTP 200, +`audio/mpeg`, 49,965 bytes in 1.23 seconds. Full Mac FFmpeg decoding passed; +FFprobe duration 3.12 seconds. This is the warm short-request transport timing, +not a cold-start latency guarantee. Audio stays outside Git. + +### Remaining voice consistency issue + +User reports a different voice per sentence. Source confirms +`endpoint.py:speech` invokes OmniVoice without a reference; `voxcpm_test.py:start` +uses a randomized seed when OmniVoice seed is omitted. `voice=default` does +not identify a saved speaker. A stable reference must be configured for a +consistent speaker; a constant seed alone is not a reliable speaker identity. +Awaiting the user's choice of reference before implementing that separate fix. +Do not mark complete voice acceptance yet. + +A diagnostic import also reported an existing incomplete Hermes source-update +Node dependency (`libatomic.so.1` missing); it continued with previous dependencies. +TTS succeeded despite that warning. No unrelated dependency installation done. + +### Restore/update requirements + +Keep the deployment wrapper and its read-only container bind in the existing +Unraid XML, encrypted Hermes home (config, `.env`, settings, voices), and Webtop +workspace. On recreation the same upstream source must match the hash; updates +require reviewing/retesting the insertion. To remove the adaptation, remove +its startup block and recreate from the pristine upstream image (a simple +restart retains modified image-layer files). This remains an optional Docker +UI integration; no claim of a native fresh-Debian full restore test is made. diff --git a/integrations/hermes-unraid/webui/start-with-gateway.sh b/integrations/hermes-unraid/webui/start-with-gateway.sh index b9f0b1a..410a953 100644 --- a/integrations/hermes-unraid/webui/start-with-gateway.sh +++ b/integrations/hermes-unraid/webui/start-with-gateway.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Operator integration: keep the upstream initializer and programs unchanged. +# Operator integration: upstream initializer plus the approved, pinned LAN TTS patch. set -Eeuo pipefail web_pid='' gateway_pid='' @@ -52,6 +52,32 @@ stop_children() { trap 'stop_children; exit 0' TERM INT trap stop_children EXIT +# Operator-approved exception for this exact private TTS endpoint only. +# Unknown upstream versions keep their original policy; never patch them blindly. +export HERMES_WEBUI_TRUSTED_TTS_BASE_URL=http://192.168.1.212:8120/v1 +/usr/local/bin/python3 - <<'TTS_PATCH' +import hashlib +from pathlib import Path +# Stock initialization copies /apptoo into /app on every start. +p = Path('/apptoo/api/routes.py') +source = p.read_text() +original_sha = '9f32e7ca096a491a36c1e774752af18c2d02ca402af4dad1886a5048deae10dc' +patched_sha = '5e51d1e2791804b825bdd3c8f000faaea3989d34cdbcd6c406800573eb8e5710' +insertion = ' # Explicit operator trust for one literal RFC1918 OpenAI TTS base URL.\n # Chat input/config cannot broaden this process environment allowlist.\n trusted = os.getenv("HERMES_WEBUI_TRUSTED_TTS_BASE_URL", "").strip().rstrip("/")\n if trusted and raw.rstrip("/") == trusted and parsed.scheme == "http":\n import ipaddress\n try:\n address = ipaddress.ip_address(hostname)\n allowed_networks = ("10.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16")\n trusted_lan = any(address in ipaddress.ip_network(n) for n in allowed_networks)\n if trusted_lan and parsed.port and parsed.path.rstrip("/") == "/v1":\n return urlunsplit((parsed.scheme, parsed.netloc, "/v1", "", ""))\n except ValueError:\n pass\n raise ValueError("invalid trusted OpenAI TTS base_url")\n' +anchor = ' if parsed.scheme == "https":\n # Public https hosts are allowed (a user\'s own OpenAI-compatible server),' +sha = hashlib.sha256(source.encode()).hexdigest() +if sha == patched_sha: + print('LAN TTS adaptation already present', flush=True) +elif sha == original_sha and source.count(anchor) == 1: + updated = source.replace(anchor, insertion + anchor, 1) + assert hashlib.sha256(updated.encode()).hexdigest() == patched_sha + compile(updated, str(p), 'exec') + p.write_text(updated) + print('Approved LAN TTS adaptation applied', flush=True) +else: + print('WARNING: unknown WebUI source; LAN TTS adaptation NOT applied; revalidation required', flush=True) +TTS_PATCH + # setsid gives each service its own process group, including init/su children. setsid /hermeswebui_init.bash & web_pid=$!