/* Brain of Reese — Sources page (knowledge base index view). * * Wires the real `GET /api/docs` endpoint (import phase): stat cards + * full-width document table, or the designed empty state when nothing is * indexed yet. Cells are built with DOM APIs (textContent) — never * innerHTML with document-derived data (XSS-safe by construction). * * Phase 19: the page joins the shared header (assets/header.js) — the * whoami gate below runs on the module's cached promise (one request per * page, shared with the header toggling), and the header gains the New * chat button: on a non-chat page "new chat" means going to the chat, * fresh (clear the phase-14 conversation key, then navigate to "/"). * * Phase 26: the table's path links open the document in the * almost-fullscreen modal overlay (assets/document-modal.js) on the * SAME page — no new tab, no navigation. The link keeps its * /document.html href as the no-JS / context-menu escape hatch; * left-clicks are intercepted (preventDefault) and routed to * openDocumentModal. The module is loaded through the relative import * below — the header.js single-evaluation design (no direct