export function appendSpokenText(current: string, spoken: string): string { const next = spoken.replace(/\s+/g, ' ').trim(); if (!next) return current; const prev = current.replace(/\s+$/g, ''); if (!prev) return next; const glue = /[\s\n]$/.test(current) ? '' : ' '; return `${prev}${glue}${next}`; }