/** Accessible HUX-10 privacy status and explicit conversation controls. */ import {useEffect, useState} from "react"; import {privacyControls, privacyEnabled} from "./model.ts"; import type { PrivacyClient, PrivacyControl, PrivacySnapshot, } from "./types.ts"; interface PrivacyCenterProps { flags?: Iterable; client: PrivacyClient; snapshot: PrivacySnapshot | null; disabled?: boolean; onUpdated(snapshot: PrivacySnapshot, action: PrivacyControl): void; } const CONTROL_LABELS: Readonly> = { enable_no_store: "Use no-store here", disable_no_store: "Use standard retention", forget_this_conversation: "Forget this conversation", switch_to_private: "Switch to Private mode", disable_memory_here: "Disable memory here", dismiss: "Dismiss notice", }; function readableTime(timestamp: string): string { return timestamp.replace("T", " ").replace("Z", " UTC"); } /** Render nothing unless both HUX-11 and HUX-10 are explicitly enabled. */ export function PrivacyCenter(props: PrivacyCenterProps) { const [busy, setBusy] = useState(null); const [error, setError] = useState(""); const [confirmForget, setConfirmForget] = useState(false); const enabled = privacyEnabled(props.flags) && props.client?.enabled(); const snapshot = props.snapshot; useEffect(() => { setBusy(null); setError(""); setConfirmForget(false); }, [snapshot?.revision]); if (!enabled || !snapshot) return null; const controls = privacyControls(snapshot); const ordinaryControls = controls.filter((control) => control !== "forget_this_conversation" && control !== "dismiss"); async function apply(action: PrivacyControl): Promise { if (busy || props.disabled) return; setBusy(action); setError(""); try { const updated = await props.client.control(snapshot, action); props.onUpdated(updated, action); } catch (_) { setError("The privacy change could not be verified. Nothing was changed in this view."); } finally { setBusy(null); setConfirmForget(false); } } return (
Conversation privacy

What Hermes keeps

{snapshot.noStore ? "No-store active" : "Standard retention"}
{snapshot.notice && ( )}
Conversation
{snapshot.noStore ? "Session only; not retained afterward" : "Retained under the workspace policy"}
Memory
{snapshot.memoryEnabled ? "Ask before saving sensitive facts" : "Memory writes disabled here"}
Sensitive context
{snapshot.retention.topicContextDecayDays === null ? "Not retained beyond this session" : `Minimized within ${snapshot.retention.topicContextDecayDays} days`}
After the topic changes
Previous sensitive details are not repeated
Across surfaces
{snapshot.retention.crossSurfaceSharing === "never" ? "Never shared" : "Same owner only"}
Retention audit
Every {snapshot.retention.auditIntervalDays} days; next{" "}
{ordinaryControls.map((control) => ( ))} {controls.includes("forget_this_conversation") && !confirmForget && ( )}
{confirmForget && (
Remove this conversation and its saved context? This cannot be undone.
)}
{busy ? "Applying privacy control…" : ""}
{error &&

{error}

}
); }