Files
baji-vc/gateway/README.md
T

4.3 KiB

LAN Voice gateway — recoverable source archive

This directory contains the actual deployed SPARK-2 source, not just an Android-side patch. SOURCE_MANIFEST.json identifies the source files by SHA256, the observed code version, interpreter and dependency versions. No .runtime, chat/history/diagnostic data, token/Cookie, voice reference audio, model, private key, cache or venv is included. Existing Android app/ is unchanged by archiving.

gateway.py is the dialogue gateway; app.py is the separate VAD API. guest_sessions.py, vad.py, history.py, persona_resolver.py, segmentation.py, protocol.py, tts_debug.py and face_context.py are restored alongside them. Public lore is in personas/, browser source in web/, tests in tests/. Upstream documentation, if present, is preserved separately under docs/UPSTREAM_README.md. Legacy scripts may contain deployment-specific addresses/paths: they are source records, not portable install commands.

Restore on a suitable server

  1. Read SOURCE_MANIFEST.json. Create a venv using a compatible Python/platform, then install requirements.lock (exact installed distribution versions from the deployed gateway interpreter). This is a version lock, not a hash-locked wheel bundle; wheels and system libraries must be available for the target platform. Nothing here downloads a model automatically. requirements.txt, if upstream supplied one, records the original direct requirements.
  2. Run python scripts/check-archive.py from this directory, or invoke it by absolute/relative path from the repository root; it fixes the import/cwd paths itself. Tests run in a temporary directory with synthetic persona IDs, no live service, credentials or history. The model-dependent Silero check is explicitly skipped. To run the full VAD test separately, provision the authorized external model first. No model service is restarted by tests.
  3. Provision the existing approved Silero CPU model externally at models/silero_vad.onnx; verify its SHA256 against app.EXPECTED_HASH before service startup. Restore existing ASR/TTS/Qwen endpoints/registered voice resources separately. Large models and voice reference recordings are intentionally outside this source backup.
  4. Copy env.example into a private untracked environment file and replace the secret placeholders. Keep it out of Git and shell logs. Generate/provision the HTTPS certificate and private key outside Git; the private key is never part of this archive. Do not change Android trust/token merely to make a test pass.
  5. Create .runtime/personas/ from config/personas/*.json.example, replacing voice IDs with existing registered voice IDs. For active-profile default selection, create .runtime/active_profile.json from config/active_profile.json.example. These examples deliberately contain no deployed profile/runtime information. Public persona lore in personas/ is required. .runtime/history.sqlite3 is initialized by the service; production history is not backed up here.
  6. Review the LAN origin/source allowlist, fixed backend endpoint addresses and registered default voice in the source for the target network. They reflect the actual deployed implementation; paths such as /home/gorios-spark-2/... in legacy scripts are not assumed valid on another server. Use the placeholder-based deploy/gateway.service.example for new deployments, replacing paths explicitly.
  7. From this directory, start the gateway with the existing private environment loaded, e.g. .venv/bin/python -m uvicorn gateway:app --host 0.0.0.0 --port 5011 --ssl-certfile <PRIVATE_CERT_PATH> --ssl-keyfile <PRIVATE_KEY_PATH>. LAN open mode is only for the trusted LAN/WG source allowlist, never public Internet exposure. Install a reviewed user service from the example if needed. Do not start duplicate gateway instances alongside the existing busy lock owner.
  8. Verify HTTPS health and authorized Origin/auth/hello/history, then run one bounded public-sample protocol check. Real Android speaker playback still needs a real phone; nonempty backend PCM does not prove audible output.

The v0.4.0 repair/context protocol and evidence boundaries are documented in ../docs/VOICE_REPAIR_040.md. Archive and future deployments use this workspace's scripts with hash, backup, tests and busy checks. Archiving itself does not deploy or restart anything.