/** * chatRenderer — produces the full self-contained HTML document for the chat * webview. All CSS and JS are inlined (no external bundles). * * The webview JS communicates with the extension host via postMessage. * Incoming messages update the DOM incrementally so streaming feels fluid. */ function escapeHtml(value) { return String(value) .replace(/&/g, '&') .replace(//g, '>') .replace(/"/g, '"') .replace(/'/g, '''); } function renderChatHtml({ nonce, platform }) { const modKey = platform === 'darwin' ? 'Cmd' : 'Ctrl'; return `