Pure `nix fmt` output from the commit before this one — no hand edits. 203 files: 52 md, 42 tsx, 32 js, 32 css, 21 ts, 13 html, 8 json, 3 mjs. Reproduce with `nix develop -c nix fmt` on the parent commit; the result should be byte-identical to this tree. None of the 13 `.prettierignore` entries appears here — verified by intersecting the changed-file list against the ignore file, with a control proving the intersection finds a match when one exists.
31 lines
1.3 KiB
TypeScript
31 lines
1.3 KiB
TypeScript
// Tiny browser-local (localStorage) preference helper, in `@hive/shared`
|
|
// so a future second consumer (e.g. swarm-ui's own terminal) gets the
|
|
// exact same key name for free via the browser's shared per-origin
|
|
// storage, rather than an independent copy that could drift.
|
|
// `ExpandDetailsSetting` (the per-agent page's own settings popover) is
|
|
// the only writer today; `Row.tsx` is the only reader.
|
|
|
|
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 applies to the next rendered row in
|
|
// any already-open agent tab without a reload.
|
|
export function getExpandDetailsPref(): boolean {
|
|
try {
|
|
return localStorage.getItem(EXPAND_DETAILS_KEY) === "1";
|
|
} catch {
|
|
return false;
|
|
}
|
|
}
|
|
export function setExpandDetailsPref(v: boolean): void {
|
|
try {
|
|
if (v) localStorage.setItem(EXPAND_DETAILS_KEY, "1");
|
|
else localStorage.removeItem(EXPAND_DETAILS_KEY);
|
|
} catch {
|
|
/* localStorage unavailable — preference is session-only */
|
|
}
|
|
}
|