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:
parent
3b299375e3
commit
da3fc9bf95
8 changed files with 79 additions and 83 deletions
|
|
@ -17,6 +17,7 @@
|
|||
"./terminal.css": "./src/terminal/terminal.css",
|
||||
"./chrome.css": "./src/chrome.css",
|
||||
"./forms.js": "./src/forms.js",
|
||||
"./prefs.js": "./src/prefs.js",
|
||||
"./dom.js": "./src/dom.js",
|
||||
"./modal.js": "./src/modal.js",
|
||||
"./shadow-css.js": "./src/shadow-css.js",
|
||||
|
|
|
|||
27
frontend/packages/shared/src/prefs.js
Normal file
27
frontend/packages/shared/src/prefs.js
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
// Tiny browser-local (localStorage) preference helpers shared by the
|
||||
// dashboard's /settings.html and the per-agent page — both need the
|
||||
// exact same key name to actually talk to each other via the browser's
|
||||
// shared per-origin storage (settings.html is where the operator sets
|
||||
// the preference; every per-agent page's terminal reads it), so the
|
||||
// get/set pair — and the key itself — live here once rather than as
|
||||
// independent copies in each package that could drift out of sync.
|
||||
|
||||
const EXPAND_DETAILS_KEY = 'hive-agent-expand-details';
|
||||
|
||||
// Whether a per-agent terminal's otherwise-collapsed `<details>` panels
|
||||
// (long tool-results, Write/Edit diffs, …) should default open. Pure
|
||||
// client-side — no backend field, nothing round-trips through
|
||||
// `/api/*`. Read live (not cached) by the shared terminal factory's
|
||||
// `expandDetails` option — see docs/web-ui/shape.md::Shared terminal
|
||||
// pane — so a preference change on /settings.html applies to the next
|
||||
// rendered row in any already-open agent tab without a reload.
|
||||
export function getExpandDetailsPref() {
|
||||
try { return localStorage.getItem(EXPAND_DETAILS_KEY) === '1'; }
|
||||
catch { return false; }
|
||||
}
|
||||
export 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 */ }
|
||||
}
|
||||
Loading…
Reference in a new issue