mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-09-14 19:02:17 +03:00
Adds a bounded, allowlisted (mov_text/subrip/webvtt) subtitle probe through the loopback-only Video Bridge broker so "embedded" transcript provenance means subtitles the server actually extracted and verified, never a caller-declared label. At most 2 streams are attempted within a 10s subdeadline bounded by the request deadline, output is capped at 256 KiB with 4096-code-unit lines, and a bounded, ReDoS-safe WebVTT parser normalizes the result. The broker response is Zod-validated end to end (bounded stream/cue shape, container metadata) and must carry the shared broker fingerprint (videoBridgeBrokerAuth.ts) before any cues are trusted as embedded. The adapter always resolves to an explicit success/absent/transient_failure outcome with a cacheable flag so a subtitle failure can never break the visual description path or poison the result cache with a stale "no subtitles" verdict. New modules: videoBridgeSubtitleRuntime.ts (server-owned ffprobe/ffmpeg extraction, mirroring the existing frame extraction lifecycle) and videoBridgeSubtitleProbe.ts (client-side adapter: parsing, Zod validation, fingerprint verification, outcome contract). videoBridgeBrokerClient.ts gained the sibling extractVideoSubtitlesViaBroker() transport call next to the existing frame path; videoBridgeRuntime.ts is otherwise untouched (two existing private helpers exported, same line count, still within its frozen file-size baseline).