feat(build): word-level transcript → per-beat compose prompt (#204)#237
Merged
Conversation
Closes the `vibe build` half of word-sync animations (#204): the LLM composer now receives Whisper word-level narration timings so it can sync caption / kinetic-type reveals to speech. The deterministic `scene add` emit path already supported this; build did not. - Add `_shared/transcribe-narration.ts`: `transcribeNarrationWords()` (provider-agnostic Whisper word-level transcription of generated narration) + `readBeatTranscript()` + `beatTranscriptRelPath()`. Refactor the inline transcribe block in `vibe scene add` to reuse it. - Asset stage gains `dispatchTranscript()`: after narration, transcribe to `assets/transcript-<beat>.json` when narration exists and an OpenAI key is configured. Cached (skipped when the file exists and narration was not freshly regenerated); best-effort (missing key / no words → skip, never fails the build). Gated by `--skip-transcript`. - `buildUserPrompt` injects a compact, deterministic timing section with a token-budget guard (`formatTranscriptSection`): word-level table at/below 120 words, phrase-level "approximate" anchors above. Folded into the user prompt, so the compose cache key invalidates when timings change. Carries the visual-sync-only guard (no `<audio>`/SFX). - Host-agent path (`compose-prompts`) exposes `transcriptPath` and feeds the same timings into its prompt. - Tests: no/short/oversized transcript, cache invalidation, asset-stage generation + `--skip-transcript`, transcript read/validation.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes the
vibe buildhalf of #204 — word-synced caption / kinetic-type animations.What
The LLM composer now receives Whisper word-level narration timings so it can sync word reveals to speech. The deterministic
vibe scene addemit path already did this;vibe builddid not.How
_shared/transcribe-narration.ts—transcribeNarrationWords()(provider-agnostic Whisper word-level transcription of generated narration),readBeatTranscript(),beatTranscriptRelPath(). The inline transcribe block invibe scene addis refactored to reuse it (single source of truth).dispatchTranscript()— after narration, transcribe toassets/transcript-<beat>.jsonwhen narration exists and an OpenAI key is configured. Cached (skipped when the file exists and narration wasn't freshly regenerated); best-effort (no key / no words → skip, never fails the build). Opt out with--skip-transcript.formatTranscriptSection) — compact, deterministic timing section with a token-budget guard: word-level[start, "word"]table at/below 120 words; phrase-level approximate anchors above. Folded into the user prompt → the compose cache key invalidates when timings change. Carries the existing visual-sync-only guard (no<audio>/SFX).compose-prompts) — exposestranscriptPathand feeds the same timings into its prompt.Behavior
--skip-transcriptopts out. No key → graceful skip (narration still plays, no word-sync). Transcription islow/negligible cost (~$0.002/beat).Tests
formatTranscriptSection: no / short / oversized transcript + clamping/rounding.buildUserPrompt: section omitted without transcript, word-level with, cache-key changes when transcript changes.transcript-<beat>.jsonwhen words exist;--skip-transcriptwrites nothing.readBeatTranscript/ path helper / non-fatal failure path.vibe build --describeschema snapshot updated for--skip-transcript.Notes / follow-ups