/* Brain of Reese — Global Tuning page (phase 27, task 03). * * The standalone manager for steering notes: create / list / edit / * delete WITHOUT a chat conversation. This module is the single owner * of the page's behaviour: * * • loadNotes() — GET /api/steering → the newest-first note list * (#tune-list) + the empty state. A failed fetch (API down, or the * anonymous direct-URL 403) keeps the LAST RENDERED list — * progressive enhancement, never a blanked panel. * • create — #tune-form submit → POST /api/steering. 201 clears the * textarea, announces through the live region, and reloads the * list; any failure keeps the form (the instruction survives) and * shows the API detail inline under the button (role=alert). * #tune-save is disabled while the request is out. * • edit — a row's Edit button swaps the text for an inline * .tuning-edit-form: a prefilled textarea (maxlength 2000) + * Save / Cancel. Save → PUT /api/steering/{id}; 200 replaces the * form with the .tuning-saved status (role=status) and announces; * a failure keeps the form + an inline error; Cancel reverts to * the text span. The note id rides on the form (data attribute). * • delete — DELETE /api/steering/{id}. 204 removes the row * immediately (optimistic) and announces; 404 also drops the row * and reloads to resync; other failures re-enable the button and * announce a retry. The empty state is re-checked on every removal. * • announce(msg) — #tune-announcer (role=status, aria-live=polite), * the screen-reader confirmation for create / edit / delete. * • header boot (task 02) — initSharedHeader(): Sign in / Sign out, * the admin-only Sources link, and this page's own admin-only * "Tuning" nav link (#nav-tuning), all decided by the module's * cached whoami promise (exactly one /api/whoami request per * page). Phase 34 task 02: the New chat binding is module-owned * (assets/header.js, the SINGLE one) — on a non-chat page "new * chat" means going to the chat, fresh (the module clears the * phase-14 conversation key and navigates to "/"). * * Anonymous-safe (task 03): the header already hides the "Tuning" nav * link for anonymous visitors; a DIRECT anonymous URL still gets a safe * page — loadNotes() only runs when the cached whoami says admin (the * Sources page gate pattern), the list stays on its empty state, and * the create form 403s gracefully on submit (the inline error carries * the API detail). Note text is always rendered with textContent — * never innerHTML (XSS-safe, like app.js's steering panel). * * The shared header module loads through this script's own relative * import ("./header.js") — a hoisted import evaluated before this body * runs (single-evaluation design: no direct