/** Accessible HUX-02 ledger UI. No network request is made by this module. */ import { EyeOff, History, Pencil, ShieldCheck, Trash2 } from "lucide-react"; import { useMemo, useState } from "react"; import { MEMORY_TOPICS, memoryControlEnabled, normalizeMemoryPage, } from "./model.ts"; import { isControlReference } from "./security.ts"; import type { DoNotRememberTarget, HuxIdentity, MemoryItem, MemoryTopic, RawMemoryPage, } from "./types.ts"; interface MemoryControlCenterProps { flags?: Iterable; identity: HuxIdentity; page: RawMemoryPage; conversationId?: string; messageId?: string; busyId?: string; onApprove?: (memoryId: string) => void; onReject?: (memoryId: string) => void; onEditAsNew?: (memoryId: string, content: string) => void; onForget?: (memoryId: string) => void; onOpenSourceMessage?: (memoryId: string) => void; onDoNotRemember?: (target: DoNotRememberTarget) => void; onRequireSuggestOnly?: () => void; } function LedgerActions({ item, busy, onApprove, onReject, onEdit, onForget, onOpenSource, }: { item: MemoryItem; busy: boolean; onApprove?: () => void; onReject?: () => void; onEdit?: () => void; onForget?: () => void; onOpenSource?: () => void; }) { if (item.status === "forgotten" || item.status === "expired") return null; if (item.status === "proposed") { return (
{item.sourceIsMessage && onOpenSource && ( )}
); } return (
{item.sourceIsMessage && onOpenSource && ( )} {item.content !== null && ( )}
); } function MemoryCard({ item, busy, editing, draft, setDraft, beginEdit, cancelEdit, saveEdit, approve, reject, forget, openSource, }: { item: MemoryItem; busy: boolean; editing: boolean; draft: string; setDraft: (value: string) => void; beginEdit: () => void; cancelEdit: () => void; saveEdit: () => void; approve: () => void; reject: () => void; forget: () => void; openSource?: () => void; }) { return (
  • {item.kind} {item.status}
    {item.content === null ? (

    {item.contentNotice}

    ) : (

    {item.content}

    )}
    Why
    {item.reason}
    Source
    {item.sourceLabel}
    Recorded by
    {item.provenanceLabel}
    Scope
    {item.scopeLabel}
    Sensitivity
    {item.sensitivity}
    Approval
    {item.approvalMode === "ask" ? "Ask first" : "Automatic (historical)"}
    Retention
    {item.ttlLabel}
    Saved
    {editing && (
    { event.preventDefault(); saveEdit(); }} >