Build speech-to-text into the bridge; add droplet deployment examples

STT_PROVIDER now defaults to "builtin": Whisper (onnx-community/whisper-base,
q8) runs in the bridge process on the CPU via @huggingface/transformers, so
no provider account is needed and recordings stay on the bridge host. Silent
captures are detected by level before the model runs. The external
OpenAI-compatible adapter remains available.

Tests: 130 unit/integration; 4 scenarios with the real model on a real
speech recording (npm run test:real-stt). Not tested on audio from the
glasses or on a droplet.

deploy/ and docs/deploy-droplet.md are examples that have not been run.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
Dan
2026-11-18 18:31:30 -08:00
co-authored by Claude Fable 5.2
parent 3c9e094977
commit 6d74f9e121
29 changed files with 1602 additions and 42 deletions
+24 -7
View File
@@ -13,13 +13,25 @@ should be read as Cody's assessment. The author's own checks are listed as such.
| Repository | `git@git.xylo.gg:Xylo-Digital/hermeven.git` |
| Base | None. The remote had no refs when work began (empty repository), so there is no base SHA. |
| Branch | `feat/vertical-slice-1`, local only |
| Head under review | `4687cc01147e2167997aa6a252343933070fbebd` |
| Pushed | No. Nothing has been pushed; there is no PR. Pushing and merging are Dan's. |
| Follow-up commit | The commit that adds this file and `docs/test-evidence.md` changes documentation only. |
| First slice | `4687cc01147e2167997aa6a252343933070fbebd` |
| Head under review | The tip of the remote branch `cody/slice-1-review`: the first slice plus built-in speech-to-text and droplet deployment files (see "Added after the first slice"). |
| Pushed | To `cody/slice-1-review` only, at Dan's request on 2026-11-18. Dan works solo and has said no PR is needed. Nothing has been pushed to `main`. |
Repository instructions: there were none to follow (no `AGENTS.md`, `CLAUDE.md`, `README` or
`CONTRIBUTING` existed). The kickoff specification was the only instruction source.
## Added after the first slice
Dan decided speech-to-text should be built into the software and that the bridge will run on a
DigitalOcean droplet.
| Area | Paths |
|---|---|
| Built-in Whisper adapter, now the default `STT_PROVIDER` | `services/bridge/src/stt/builtinWhisper.ts`, `config.ts`, `app.ts`, `main.ts` |
| Tests | `services/bridge/test/builtinWhisper.test.ts`, `tests/real-stt/*` (with a public-domain speech fixture) |
| Deployment examples, **not run on a droplet** | `deploy/*`, `docs/deploy-droplet.md` |
| New dependency | `@huggingface/transformers` 4.3.2 (brings ONNX Runtime and `sharp`) |
## Changed files
Everything is new. 79 files at the head above.
@@ -42,7 +54,8 @@ Full detail, including failures along the way, is in `docs/test-evidence.md`.
|---|---|
| `npm ci` | clean install, 0 vulnerabilities reported |
| `npm run typecheck` | exit 0 |
| `npm test` | 122 passed, 0 failed (7 files) |
| `npm test` | 130 passed, 0 failed (8 files) |
| `npm run test:real-stt` | 4 passed, 0 failed |
| `npm run test:simulator` | 6 passed, 0 failed; 10 consecutive runs of the final revision |
| `npm run test:real-hermes` | 9 passed, 0 failed |
| `npm run client:build` | built; bundle searched for server secrets, none |
@@ -55,7 +68,7 @@ Full detail, including failures along the way, is in `docs/test-evidence.md`.
| Fakes only | 122 tests |
| Even simulator 0.9.5 | 6 scenarios, screenshots in `docs/evidence/simulator/` |
| Real Hermes v0.23.1, stub model | 9 scenarios |
| Real STT | none |
| Real STT | 4 scenarios: built-in Whisper on one clean archive recording |
| Real model or tools | none |
| Physical device | **none** |
@@ -93,15 +106,19 @@ Offered as places to look, not as findings.
- The Hermes adapter does not yet check `/v1/capabilities` for durable idempotency at startup.
- The client holds captured audio in memory for a possible resend until the user discards it.
- The real-Hermes test covers neither approvals nor the `unknown` status.
- The built-in speech model is fetched from the Hugging Face hub at first start with no pinned
revision or hash, and runs in the bridge's own process (a measured 0.4 s event-loop pause).
- The silence threshold in `builtinWhisper.ts` was chosen without any audio from the glasses.
- The systemd hardening options in `deploy/` have never been run with ONNX Runtime.
## Blockers and open decisions
| # | Item | Owner |
|---|---|---|
| 1 | Run `docs/device-test-plan.md`, starting with A13 (locked phone, pocket). | Dan |
| 2 | Choose an STT provider or a self-hosted endpoint. | Dan |
| 2 | ~~Choose an STT provider.~~ Decided: built in. Remaining: measure it on the droplet. | Dan |
| 3 | Name the target Hermes deployment and a safe test profile. | Dan |
| 4 | Decide whether to push this branch and open a PR. | Dan |
| 4 | ~~Push and PR.~~ Decided: no PR; pushed to `cody/slice-1-review`. When to put it on `main` is still open. | Dan |
| 5 | Independent architecture and security review of the head above. | Cody |
| 6 | Distribution model given Even's per-build network whitelist. | Dan, later |