Sound check on the phone page (probe for issue #1); timing logs for name checks and previews; 0.4.1

- apps/even-client: a collapsed "Sound check" on the phone page. Finds out whether the page
  may play sound in the Even app, without a touch, in the background, and which outputs it can
  see. Plays only on a button press; sends nothing to the bridge.
- services/bridge: wake.checked (every name check) and preview.done log the clip length and the
  duration, never the words.
- tests: hands free after a recording in Agents with menu, wake and preview all on; the log
  lines carry only the fields above.
- docs: 0.4.0 rollout and Dan's device report; security 3c, 3e, 3f; 0005 records that the
  Round 20 reading of "agent sub-app" was wrong (not changed here).

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
Dan
2026-11-29 11:24:16 -08:00
co-authored by Claude Fable 5.2
parent e4c102a539
commit b57505406b
9 changed files with 365 additions and 5 deletions
+23
View File
@@ -346,9 +346,25 @@ export async function buildServer(deps: ServerDeps): Promise<FastifyInstance> {
wakeBusy.add(device.id);
const abort = new AbortController();
const timer = setTimeout(() => abort.abort(), config.limits.transcribeDeadlineSeconds * 1000);
const startedAt = Date.now();
// How long the clip was and how long it took, for every check, matched or not. Never what
// was said: without this a slow or silent hands-free session cannot be told apart from a
// microphone that hears nothing.
const checked = (matched: boolean, nearMiss: boolean) =>
req.log.info(
{
device_id: device.id,
audio_ms: Math.round((pcm.length / AUDIO_FORMAT.bytesPerSecond) * 1000),
check_ms: Date.now() - startedAt,
matched,
near_miss: nearMiss,
},
'wake.checked',
);
try {
const transcript = await deps.stt.transcribe({ pcm, locale, signal: abort.signal });
const match = matchWake(transcript, config.agents);
checked(match.matched, !match.matched && match.nearMiss !== null);
if (!match.matched) return { ...none, near_miss: match.nearMiss };
req.log.info({ device_id: device.id, agent_id: match.agentId, name_only: match.text === '' }, 'wake.matched');
return { ...none, matched: true, agent_id: match.agentId, text: match.text.slice(0, config.limits.textMaxChars) };
@@ -383,7 +399,14 @@ export async function buildServer(deps: ServerDeps): Promise<FastifyInstance> {
if (!reply.raw.writableEnded) abort.abort();
});
try {
const startedAt = Date.now();
const text = await deps.stt.transcribe({ pcm, locale, signal: abort.signal });
// Length and duration only, never the words: this is how the delay a preview can add to
// the real transcription gets measured.
req.log.info(
{ device_id: device.id, audio_ms: Math.round((pcm.length / AUDIO_FORMAT.bytesPerSecond) * 1000), preview_ms: Date.now() - startedAt, empty: text.trim() === '' },
'preview.done',
);
return { schema_version: SCHEMA_VERSION, text: text.trim().slice(0, config.limits.textMaxChars) };
} catch (err) {
// No preview this time. The recording itself is unaffected.