Per mara: 'i wanted you to put this in .../settings.html' — the toggle belongs with the other operator-local browser preferences, not buried in each agent's own overflow menu. Extracted the get/set + localStorage key into @hive/shared/prefs.js so settings.html (writer) and every per-agent app.js (reader, via HiveTerminal.create's expandDetails option) agree on the exact same key without two independently-typed copies that could drift. Removed the now-unused overflow-menu toggle + its agent.css rules from the agent page. Docs moved from docs/web-ui/agent.md's overflow-button section to docs/web-ui/dashboard.md's S3TT1NGS section, next to the existing browser-notifications preference.
37 lines
1.6 KiB
JavaScript
37 lines
1.6 KiB
JavaScript
// /settings.html — operator-local preferences page.
|
|
//
|
|
// Extracted from the dashboard S3TT1NGS tab. The browser-notification
|
|
// toggle: NOTIF.bind() wires the enable / mute / unmute buttons and
|
|
// persists state to localStorage. The dashboard's NOTIF.show() calls
|
|
// (approvals / questions) read that same localStorage state + the
|
|
// browser-level permission, so firing still works from the dashboard
|
|
// even though the toggle UI now lives on its own page.
|
|
//
|
|
// The agent-terminal-verbosity toggle below is a second, unrelated
|
|
// browser-local preference — @hive/shared/prefs.js owns the key name +
|
|
// get/set so this page and every per-agent page's app.js agree on it
|
|
// without a backend field. Both preferences are per-origin localStorage,
|
|
// so they only apply within this browser (per the page's own copy).
|
|
//
|
|
// initServerWarnings() renders the shared top-of-page warnings banner,
|
|
// matching the other stand-alone pages (FL0W / L0GS / H0M3).
|
|
import { NOTIF, initServerWarnings } from './common.js';
|
|
import { getExpandDetailsPref, setExpandDetailsPref } from '@hive/shared/prefs.js';
|
|
|
|
initServerWarnings();
|
|
NOTIF.bind();
|
|
|
|
(function bindExpandDetailsToggle() {
|
|
const btn = document.getElementById('expand-details-toggle');
|
|
if (!btn) return;
|
|
function render() {
|
|
const on = getExpandDetailsPref();
|
|
btn.textContent = on ? '☑ expand tool output panels' : '☐ expand tool output panels';
|
|
btn.setAttribute('aria-checked', String(on));
|
|
}
|
|
btn.addEventListener('click', () => {
|
|
setExpandDetailsPref(!getExpandDetailsPref());
|
|
render();
|
|
});
|
|
render();
|
|
})();
|