Remove bracket cues from TTS-aligned tokens, keeping the survivors' timings.
useTtsAlignedTranscript makes the provider's alignment of the text it was sent the
transcript, and that text is post-convertMarkup, so it carries native
[laugh]/[speak calmly] cues as words the agent never spoke. Every bracket span goes:
the provider reads them all as cues, so none is ever audio, and markdown links are
already gone (filterMarkdown runs on TTS input by default).
Alignment arrives in messages finer-grained than a cue — often one word at a time — so
held carries the tail of an unclosed span across calls; pass the same array every time
and call once more with final: true at end of stream to release it.
Remove bracket cues from TTS-aligned tokens, keeping the survivors' timings.
useTtsAlignedTranscriptmakes the provider's alignment of the text it was sent the transcript, and that text is post-convertMarkup, so it carries native[laugh]/[speak calmly]cues as words the agent never spoke. Every bracket span goes: the provider reads them all as cues, so none is ever audio, and markdown links are already gone (filterMarkdownruns on TTS input by default).Alignment arrives in messages finer-grained than a cue — often one word at a time — so
heldcarries the tail of an unclosed span across calls; pass the same array every time and call once more withfinal: trueat end of stream to release it.