feat(dreams): voice capture via mana-stt

Adds a one-tap voice recorder at the top of the Dreams module. Speak
your dream right after waking, the audio is sent through a server-side
proxy to mana-stt, and the transcript appears in the entry as soon as
it lands.

- New /api/v1/dreams/transcribe SvelteKit server route proxies the
  upload to mana-stt with the server-held MANA_STT_API_KEY (never
  exposed to the browser); validates mime, size, missing config
- Adds MANA_STT_URL + MANA_STT_API_KEY to the mana-web env config in
  generate-env.mjs (private, not PUBLIC_ prefixed)
- New DreamRecorder class wraps MediaRecorder with reactive
  $state — status, elapsed timer, error; supports cancel
- dreamsStore.createFromVoice creates a placeholder dream with
  processingStatus='transcribing' and kicks off the upload
- dreamsStore.transcribeBlob uploads, writes the result back into
  the dream, falls back to processingStatus='failed' on errors
- Adds processingStatus + processingError + audioDurationMs to
  LocalDream; backwards-compatible defaults in toDream
- Mic button in ListView with idle / requesting / recording
  (with elapsed timer + pulsing red) / stopping states
- Cancel button discards the in-flight recording
- Transcribing badge ●●● + failed ! badge on dream rows
- Inline editor shows live transcription status; while it's running
  and the user hasn't typed anything, the transcript folds into the
  edit buffer as soon as it arrives

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Till JS 2026-04-07 14:39:11 +02:00
parent 836c9692c5
commit 578c9f3397
9 changed files with 632 additions and 1 deletions

View file

@ -126,6 +126,9 @@ const APP_CONFIGS = [
MIDDLEWARE_URL: (env) => env.MANA_AUTH_URL,
PUBLIC_UMAMI_WEBSITE_ID: (env) => env.UMAMI_WEBSITE_ID_MANA || '',
PUBLIC_GLITCHTIP_DSN: (env) => env.PUBLIC_GLITCHTIP_DSN || '',
// Speech-to-Text proxy (server-side only, never exposed to the client)
MANA_STT_URL: (env) => env.STT_URL || 'http://localhost:3020',
MANA_STT_API_KEY: (env) => env.MANA_STT_API_KEY || '',
},
},