move terminal-verbosity toggle from agent overflow menu to /settings.html

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.
This commit is contained in:
iris 2026-08-02 18:34:40 +02:00
commit da3fc9bf95
8 changed files with 79 additions and 83 deletions

View file

@ -299,19 +299,6 @@ h2, h3 {
border-color: var(--purple-dim);
background: color-mix(in srgb, var(--purple) 6%, transparent);
}
.overflow-item-verbosity {
color: var(--muted);
}
.overflow-item-verbosity:hover {
color: var(--fg);
background: color-mix(in srgb, var(--purple) 8%, transparent);
border-color: var(--purple-dim);
}
.overflow-item-verbosity.active {
color: var(--purple);
border-color: var(--purple-dim);
background: color-mix(in srgb, var(--purple) 6%, transparent);
}
/* Header pill — inbox / loose-ends triggers. Compact, count-prominent. */
.header-pill {

View file

@ -6,6 +6,7 @@ import { create as termCreate, linkify as termLinkify } from '@hive/shared/termi
import { asyncBtn, bindAsyncForms } from '@hive/shared/forms.js';
import { themedConfirm } from '@hive/shared/modal.js';
import { el } from '@hive/shared/dom.js';
import { getExpandDetailsPref } from '@hive/shared/prefs.js';
import '@hive/shared/side-panel.js'; // registers <hive-side-panel> — side-effect import
import { marked } from 'marked';
import DOMPurify from 'dompurify';
@ -26,22 +27,6 @@ window.marked = marked;
({ '&':'&amp;', '<':'&lt;', '>':'&gt;', '"':'&quot;' }[c])
);
// "Expand tool output by default" terminal-verbosity preference —
// pure client-side, browser-local (localStorage only, no backend
// field). See the overflow-menu settings toggle below + the
// `expandDetails` option passed to HiveTerminal.create().
const EXPAND_DETAILS_KEY = 'hive-agent-expand-details';
function getExpandDetailsPref() {
try { return localStorage.getItem(EXPAND_DETAILS_KEY) === '1'; }
catch { return false; }
}
function setExpandDetailsPref(v) {
try {
if (v) localStorage.setItem(EXPAND_DETAILS_KEY, '1');
else localStorage.removeItem(EXPAND_DETAILS_KEY);
} catch { /* localStorage unavailable — preference is session-only */ }
}
// Base URL of the host dashboard (core backend). Set once the first
// /api/state lands. Operator-authority actions (answering a question
// as the operator) POST here rather than to this agent's own socket —
@ -310,40 +295,6 @@ window.marked = marked;
}
}
// ─── settings: expand tool output by default ───────────────────
// Pure client-side, browser-local preference (no backend involved) —
// see docs/web-ui/agent.md::Overflow button. Controls the *default*
// open state of otherwise-collapsed `<details>` rows in the live
// terminal (long tool-results, Write/Edit diffs, …); rows that
// already default open (send/ask/answer/recv) are unaffected.
// Read live by the shared terminal factory (HiveTerminal.create's
// `expandDetails` option below), so toggling mid-session applies to
// the next rendered row without a reload.
const settingsSep = el('div', { class: 'overflow-sep', 'aria-hidden': 'true' });
const settingsLabel = el('div', { class: 'overflow-section-label' }, 'settings');
menu.append(settingsSep, settingsLabel);
const expandIcon = el('span', { class: 'overflow-item-icon', 'aria-hidden': 'true' },
getExpandDetailsPref() ? '☑' : '☐');
const expandBtn = el('button', {
type: 'button',
class: 'overflow-item overflow-item-verbosity' + (getExpandDetailsPref() ? ' active' : ''),
role: 'menuitemcheckbox',
'aria-checked': String(getExpandDetailsPref()),
title: 'expand tool output panels by default in this terminal (persisted to this browser only)',
id: 'expand-details-btn',
},
expandIcon,
'expand tool output',
);
expandBtn.addEventListener('click', () => {
const next = !getExpandDetailsPref();
setExpandDetailsPref(next);
expandBtn.classList.toggle('active', next);
expandBtn.setAttribute('aria-checked', String(next));
expandIcon.textContent = next ? '☑' : '☐';
});
menu.append(expandBtn);
overflowMenuPopulated = true;
}