/** Strip MOOD tags, tool-call leaks, and other LLM artefacts from displayed text. */ export function cleanDisplayText(text) { if (!text) return ""; return text .replace(/)?/gi, "") .replace(/]*>[\s\S]*?<\/function>/gi, "") .replace(/[\s\S]*?<\/tool_call>/gi, "") .replace(/\[(?:MOOD|VERIFIED|TOOL):[^\]]*\]/gi, "") .replace(/]*>/gi, "") .replace(/^(?:Slt\s*)?Émo\s*[A-Za-zéèê]+\s*/i, "") .replace(/^\s*Émo\s*/i, "") .trim(); }