// Optional UI preferences must never prevent the workspace from opening. export function readWorkspacePreferences(key: string): Record { try { const value: unknown = JSON.parse(localStorage.getItem(key) ?? "{}"); if (!value || typeof value !== "object" || Array.isArray(value)) return {}; return Object.fromEntries(Object.entries(value).filter((entry): entry is [string, string] => typeof entry[1] === "string")); } catch { return {}; } } export function writeWorkspacePreferences(key: string, value: Record) { try { localStorage.setItem(key, JSON.stringify(value)); } catch { /* Storage may be unavailable or full. */ } }