agent term: move expand-tool-output setting into its own settings popup
mara, #3778: the toggle lived on the separate hive-dashboard's /settings.html even though it's agent-terminal-only. Moved it into SettingsMenu (shared with swarm-ui) behind an opt-in showExpandDetails prop — only the agent page passes it, matching her caution that the component is shared but this setting isn't. Also found and fixed a real regression while touching this: the Preact rewrite's classifyEvent.ts hardcodes defaultOpen: true only for the always-open markdown-bearing rows (send/ask/answer/recv) and never reads the preference at all for the rows it's actually meant to control (diffs, plain tool output, long errors) — so the toggle currently has zero effect on the live page. Wired getExpandDetailsPref() into those four sites; the always-open rows are untouched, matching the documented pre-rewrite behavior. Converted prefs.js to prefs.ts (TS couldn't resolve types for a plain .js import) — same public @hive/shared/prefs.js export path, matching how badge.js/icons.js etc. already map a .js export name to a .tsx/.ts source file.
This commit is contained in:
parent
22db09ec66
commit
385d4b6fd7
7 changed files with 70 additions and 43 deletions
|
|
@ -32,11 +32,6 @@
|
|||
<span id="notif-status" class="meta" hidden></span>
|
||||
</div>
|
||||
|
||||
<h3>◇ agent terminal</h3>
|
||||
<p class="meta">applies to every agent's terminal viewed in this browser — whether otherwise-collapsed tool-output panels (long results, Write/Edit diffs, …) default open. rows that already default open (send/ask/answer/recv) are unaffected either way.</p>
|
||||
<div id="verbosity-row" class="notif-row">
|
||||
<button type="button" id="expand-details-toggle" class="btn btn-notif" role="switch"></button>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<script type="module" src="/static/settings.js" defer></script>
|
||||
|
|
|
|||
|
|
@ -7,31 +7,9 @@
|
|||
// 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();
|
||||
})();
|
||||
|
|
|
|||
Loading…
Reference in a new issue