123 lines
7.0 KiB
Markdown
123 lines
7.0 KiB
Markdown
# Handoff for Cody, Round 24
|
|
|
|
From: Claude (implementation). Date: 2026-11-29 (UTC).
|
|
|
|
**Not reviewed.** Your Round 23 on `d65beeab77288049b801e4969ac9b68821833b23`: SHIP / SHIP FOR
|
|
TRIAL. That commit **was** deployed and uploaded as 0.4.1 (Dan: "go"); record in
|
|
`docs/evidence/device/2026-11-29.md`. The package hash matched yours.
|
|
|
|
| Item | Value |
|
|
|---|---|
|
|
| Branch | `cody/droplet-deploy` |
|
|
| `main` | `f02715fb6487f4e2ff0adeccfaad2403e1724aa5` (unchanged) |
|
|
| Code change | `9874e1bb5b38458a6bc55159362f39234746fb67` |
|
|
| New head | the tip after this push (this file and evidence only on top of the code change) |
|
|
|
|
## 0. This goes beyond your Round 23 constraints, on Dan's instruction
|
|
|
|
Round 23 said not to add "ElevenLabs or another provider, credentials, automatic playback" under
|
|
that verdict, and that issue #1 stays an investigation. This round adds an ElevenLabs adapter and
|
|
playback of answers. It is a new change for a new verdict, not a claim under the old one. What
|
|
authorises it:
|
|
|
|
1. The probe ran on Dan's phone (results below).
|
|
2. I proposed a "Voice: on/off" entry on the opening menu, off at every launch, with the bridge
|
|
calling ElevenLabs per agent, and asked whether to cap long answers. Dan: "yes on the voice
|
|
menu entry, cap it".
|
|
3. Shown the finished build and told a push starts a review round, Dan: "to cody".
|
|
|
|
No credential is in the repository. No key has been given to me or placed on the server. No
|
|
native code. Nothing plays unless the user switched Voice on in that session.
|
|
|
|
## 1. What the sound check found
|
|
|
|
Dan, earbuds connected, verbatim in the evidence file: tone heard "in buds"; delayed tone "yes,
|
|
in 20s"; "without touching phone: allowed"; "phone voice: not available in this page"; outputs
|
|
"1. without names". Not stated: whether the phone was locked for the delayed tone, phone model,
|
|
Android and Even app versions, whether the earbuds were worn or what Android had selected.
|
|
|
|
Consequences drawn in `docs/decisions/0006-spoken-answers.md`: the page can play and Android
|
|
routes; the voice must be synthesised elsewhere; the page cannot know the route, hence a manual
|
|
switch that is never remembered.
|
|
|
|
## 2. The change
|
|
|
|
Bridge:
|
|
- `services/bridge/src/tts.ts`: `ElevenLabsTts` (`POST {base}/v1/text-to-speech/{voice}?output_format=mp3_44100_64`,
|
|
`xi-api-key`, body `{text, model_id}`), written from the provider's documentation as fetched
|
|
on 2026-11-29. **Never called against the real service.** A non-2xx body is read and discarded
|
|
(it may quote the text). `speechText()` removes markup, fenced code and web addresses and cuts
|
|
at a sentence end within the limit.
|
|
- Config: `HERMEVEN_ELEVENLABS_API_KEY` (absent = off), `_MODEL` (default `eleven_flash_v2_5`),
|
|
`_BASE_URL` (https unless loopback; exists so the tests can point at a fake),
|
|
`HERMEVEN_AGENT_VOICE` / `HERMEVEN_AGENT_<ID>_VOICE`, `HERMEVEN_SPEECH_MAX_CHARS` (900),
|
|
`HERMEVEN_SPEECH_PER_MINUTE` (6), `HERMEVEN_SPEECH_TIMEOUT_SECONDS` (20).
|
|
- `GET /v1/speech`: `{available, agent_ids, max_chars}`. A new route rather than a new field on
|
|
`/v1/device` or `/v1/agents` because those schemas are closed and the deployed 0.4.1 client
|
|
would reject an added field.
|
|
- `GET /v1/turns/{id}/speech`: `audio/mpeg`. Only the caller's own turn, only `succeeded` or
|
|
`incomplete`, only if its agent has a voice; everything else is one indistinguishable 404.
|
|
Per-device limiter counts new syntheses only; concurrent requests for one turn share one
|
|
provider call; the last three clips are kept in memory (not on disk) so a retry is not paid
|
|
for twice. Logs `speech.done` / `speech.failed`: ids, character count, byte count, duration,
|
|
provider status. No text.
|
|
|
|
Client (0.5.0):
|
|
- Reducer: `voiceOffered`, `voice`; menu entry `voice` is a switch that flips in place;
|
|
`init` resets both, so it is off at every launch and after pairing.
|
|
- Controller: `speaker` option (absent = nothing is asked or played). After a successful or
|
|
partial answer, if Voice is on and the agent has a voice, fetch then play. Stopped by any
|
|
dispatch that leaves `answer`, changes the request, or switches Voice off; the fetch is
|
|
aborted too, and audio arriving after that is dropped. Idle exit is not scheduled while
|
|
fetching or playing and restarts when it ends.
|
|
- `ui/speaker.ts`: Web Audio `decodeAudioData` and a buffer source. **Not covered by any
|
|
test; never run in a browser.** The tests use a fake `SpeakerPort`.
|
|
- Phone page: one status row saying whether spoken answers are available, on, speaking.
|
|
|
|
## 3. A shutdown fault found on the way (also in what is deployed)
|
|
|
|
A test that abandoned a slow speech request hung in `bridge.close()`. Reproduced in isolation,
|
|
and equally with `/v1/transcribe` (deployed since 0.4.0): once a handler finishes on a
|
|
connection whose client aborted, the server still counts one open connection and
|
|
`server.close()` never calls back. Closing while the handler is still running, or with no
|
|
abort, returns at once. I did not find out why the connection stays open (the test client is
|
|
Node's fetch; behind Caddy it may differ); I am reporting the observation, not a diagnosis.
|
|
|
|
Change: `forceCloseConnections: true`. To judge: shutdown no longer waits for in-flight
|
|
requests. A turn being submitted at that instant is cut off and retried by the app with the same
|
|
request id (deduplicated); polls are retried. On the droplet the alternative was systemd's
|
|
`TimeoutStopSec=20` then SIGKILL; I have no evidence it ever happened there (both restarts in
|
|
the evidence returned promptly), and previews may never have been requested by the device.
|
|
Regression test: "closes promptly after an abandoned speech/transcribe request"; without the
|
|
option both fail (observed before the change, as `HUNG` in a throwaway reproduction, not
|
|
re-run as a formal control on the final tree).
|
|
|
|
## 4. Things to judge
|
|
|
|
- **Answers leave Dan's infrastructure when Voice is on** (security 3g). Questions do not.
|
|
- **Loudspeaker** with no earbuds (3h). Mitigation is only that Voice is manual and not saved.
|
|
- **Cost:** bounded per answer and per minute per device, not per day.
|
|
- **Hands free with Voice on:** the microphone is open while the answer plays. Through earbuds
|
|
the glasses should not hear it; through a loudspeaker they will, and an answer that contains
|
|
an agent's name as the first word after a pause could start a turn. Not mitigated.
|
|
- **The in-memory clip cache** holds up to three answers' audio (each at most a few hundred kB)
|
|
until replaced or restart.
|
|
- The cap is 900 characters. Dan agreed to "cap it" against my "say the first 60 seconds"; the
|
|
mapping from characters to seconds is my estimate.
|
|
- Your constraint from Round 20, no live preview in hands free, is untouched by this round.
|
|
|
|
## 5. Not done
|
|
|
|
Live words in hands free and why they did not appear on the device; the background-music cut-off;
|
|
route or wear detection; audio focus; a Voice marker outside the menu. Dan's stated order is
|
|
voice first, then that list.
|
|
|
|
## State
|
|
|
|
Server: bridge `d65beea`. Even account: 0.4.1 on beta. Nothing in this round is deployed,
|
|
uploaded or installed, and `/etc/hermeven/bridge.env` has no speech settings.
|
|
|
|
## Checks
|
|
|
|
`docs/test-evidence.md`, "Round 24".
|