/** Strip markdown artifacts and normalize whitespace. Pure, no side effects. */ export function cleanText(str) { if (!str) return ""; return str .replace(/^#+\s*/gm, "") .replace(/\*\*(.*?)\*\*/g, "$1") .replace(/[*_`]/g, "") .replace(/\s+/g, " ") .trim(); }