Podcast mode: notes read aloud with a lyric-style word highlight

The third segment of the note-powered wizards (Study deck / Homework /
Podcast) takes the same intake - photos, documents, pasted text, the share
target - and turns it into a spoken episode.

- prompts: PODCAST_SYSTEM_PROMPT writes for the ear (plain prose, no markdown,
  no visual references), chaptered into 3-8 sections around a length target.
- /api/podcast mirrors /api/generate's plumbing (rate limit, model gate,
  provider keys, heartbeats, the 2x deadline, the optional vision pass).
- storage: frezmo.podcasts.v1, zod-validated, included in the backup and the
  encrypted sync payload; a new library tab lists episodes with listen /
  rename / delete-with-undo, and the wizard switch deep-links in.
- player: the transcript is word-wrapped spans and the word under the voice
  rides a lyric-style highlight that keeps itself centred. Two clocks: exact
  onboundary events where the browser reports them, a per-word length timer
  where it does not (iOS Safari); the first boundary retires the timer.
  Pause = cancel + re-speak from the word, which makes resume, chapter jumps
  and tap-any-word-to-seek the same operation; the position saves on pause,
  page-hide and unmount, so reopening resumes. Speed rebuilds the engine and
  keeps playing; the Aero soundtrack pauses itself when the voice starts; a
  browser with no voice gets an honest note and a readable transcript.
- the script sits on a glass pane (plain paragraphs over Aero's grass failed
  contrast; the scan now covers the player too).

tests/podcast-test.mjs (17th suite) stubs the model and the speech engine and
drives the highlight by hand: 26 checks. All suites green, contrast clean.
Version 0.7.3, SW v95.
This commit is contained in:
Martin Dvořák 2026-10-16 11:42:15 +00:00
commit d95c5c7151
30 changed files with 2575 additions and 26 deletions

View file

@ -1492,6 +1492,32 @@ Things I chose while building, with the reasoning:
into view as you type. No strings, so no i18n; the additive change sits on top of the merged
scene-heat rework unchanged.
103. **Podcast mode: your notes, read aloud, highlighted word by word.** The third segment of
the note-powered wizards (Study deck ⇄ Homework ⇄ Podcast) takes the same intake — photos,
documents, pasted text, the share target — and turns it into a spoken episode instead of
activities: `PODCAST_SYSTEM_PROMPT` asks for plain prose written for the ear (no markdown, no
lists, no "as you can see"), chaptered into 3-8 sections of 60-140 words around a
length target, and the new `/api/podcast` route mirrors `/api/generate`'s plumbing exactly
(rate limit, model gate, provider keys, heartbeats, the 2x deadline, the optional vision pass).
Episodes are stored like homework results (`freezmo.podcasts.v1`, zod-validated, riding the
backup and the encrypted sync payload) and listed in a new library tab with listen / rename /
delete-with-undo.
The player is the Spotify-lyrics part: the transcript is word-wrapped spans, and the word
under the voice rides a highlight that keeps itself centred as the episode plays. Two clocks
drive it — `onboundary` where the browser reports it (the character index maps onto the word
list) and a per-word length timer where it does not (iOS Safari, several Android engines);
the first boundary seen retires the timer for the session. Pause is a cancel plus a
re-speak-from-word, which makes "resume", "jump to a chapter" and "tap any word to seek" the
same operation, and the position is saved on pause, page-hide and unmount, so reopening an
episode resumes where you stopped. A speed button rebuilds the engine and keeps playing, the
Aero soundtrack pauses itself when the voice starts (`freezmo:foreground-audio`), and a
browser with no installed voice gets an honest note with the transcript still readable. The
script sits on one glass pane — in Aero, plain paragraphs over grass and sun failed
contrast, and the scan now covers this screen too. `tests/podcast-test.mjs` (17th suite)
stubs both the model and the speech engine: it drives a boundary event, checks the
pause/resume word, the chapter jump, the speed change, the stored position and the plugin's
400/stream guards (26 checks).
102. **An API key is not a login.** "When trying to use a different provider on the web app it
glitches out completely" — a photo of the first-run gate with iOS's saved-password sheet laid
over it ("password for proxmox…"). Two causes, both fixed. (1) The key fields were