/* global React, HashBadge, AttestationStatePill */ /* ========================================================= COMMAND PALETTE (⌘K) — fuzzy search over attestations, surfaces, actions ========================================================= */ function CommandPalette({ open, onClose, onNav }) { const [query, setQuery] = React.useState(""); const [sel, setSel] = React.useState(0); const inputRef = React.useRef(null); React.useEffect(() => { if (open && inputRef.current) { inputRef.current.focus(); setQuery(""); setSel(0); } }, [open]); const items = React.useMemo(() => { const all = [ { type: "surface", id: "fraud", label: "Fraud Decision Audit", sub: "surface · 1", action: () => onNav("fraud") }, { type: "surface", id: "sca", label: "SCA / 3DS Attestation", sub: "surface · 2", action: () => onNav("sca") }, { type: "surface", id: "orch", label: "Orchestration Audit", sub: "surface · 3", action: () => onNav("orch") }, { type: "surface", id: "settle", label: "Settlement Gate", sub: "surface · 4", action: () => onNav("settle") }, { type: "surface", id: "flow", label: "Dispute → CE 3.0 Flow", sub: "surface · 5", action: () => onNav("flow") }, { type: "att", id: "ATT-7F4A2C91", label: "ATT-7F4A2C91 · APPROVE · €82.40", sub: "fraud · finalized · 14:22:07.384", action: () => onNav("fraud") }, { type: "att", id: "ATT-7F4A2C90", label: "ATT-7F4A2C90 · DECLINE · €1,240.00", sub: "fraud · finalized · 14:22:07.312", action: () => onNav("fraud") }, { type: "att", id: "ATT-7F4A2C8F", label: "ATT-7F4A2C8F · STEP_UP · €340.10", sub: "fraud · witnessed · 14:22:07.294", action: () => onNav("fraud") }, { type: "att", id: "ATT-7F4A2C8D", label: "ATT-7F4A2C8D · DECLINE · €500.00", sub: "fraud · finalized · 14:22:07.140", action: () => onNav("fraud") }, { type: "att", id: "3DS-9A41C2E7", label: "3DS-9A41C2E7 · passkey · ECI 05", sub: "SCA · finalized · 14:22:06.998", action: () => onNav("sca") }, { type: "att", id: "ROUTE-44C812", label: "ROUTE-44C812 · Adyen selected · €1,240", sub: "orch · finalized", action: () => onNav("orch") }, { type: "att", id: "STL-B0C1-4421", label: "STL-B0C1-4421 · €14.2M batch", sub: "settle · threshold", action: () => onNav("settle") }, { type: "action", id: "theme", label: "Toggle theme (light / dark)", sub: "appearance", action: () => { const r = document.documentElement; r.setAttribute("data-theme", r.getAttribute("data-theme") === "light" ? "dark" : "light"); } }, { type: "action", id: "export", label: "Build evidence pack", sub: "dispute flow · CE 3.0", action: () => onNav("flow") }, { type: "action", id: "replay", label: "Replay last fraud decision", sub: "re-verify proof", action: () => onNav("fraud") }, { type: "action", id: "signer", label: "View signer identity", sub: "HSM · EIP-712", action: () => { if (window.__openSignerOverlay) window.__openSignerOverlay(); } }, { type: "action", id: "shortcuts",label: "Show keyboard shortcuts", sub: "help", action: () => {} }, ]; if (!query) return all; const q = query.toLowerCase(); return all.filter(i => i.label.toLowerCase().includes(q) || i.sub.toLowerCase().includes(q) || i.id.toLowerCase().includes(q)); }, [query, onNav]); React.useEffect(() => { setSel(0); }, [query]); const onKeyDown = e => { if (e.key === "Escape") { onClose(); return; } if (e.key === "ArrowDown") { e.preventDefault(); setSel(s => Math.min(s + 1, items.length - 1)); return; } if (e.key === "ArrowUp") { e.preventDefault(); setSel(s => Math.max(s - 1, 0)); return; } if (e.key === "Enter" && items[sel]) { items[sel].action(); onClose(); } }; if (!open) return null; const typeIcons = { surface: "◈", att: "◆", action: "▸" }; const typeColors = { surface: "var(--ak-accent)", att: "var(--ak-state-signed-fg)", action: "var(--ak-fg-2)" }; return (
e.stopPropagation()}> {/* search input */}
⌘K setQuery(e.target.value)} onKeyDown={onKeyDown} className="ak-input" placeholder="Search attestations, surfaces, actions…" style={{ border: "none", background: "transparent", padding: 0, fontSize: "var(--ak-fs-13)" }} />
{/* results */}
{items.length === 0 && (
No results
)} {items.map((item, i) => (
{ item.action(); onClose(); }} style={{ display: "grid", gridTemplateColumns: "20px 1fr auto", alignItems: "center", gap: 10, padding: "8px 16px", cursor: "pointer", background: i === sel ? "var(--ak-bg-3)" : "transparent", borderLeft: i === sel ? "2px solid var(--ak-accent)" : "2px solid transparent", }} > {typeIcons[item.type]}
{item.label}
{item.sub}
{item.type === "surface" && {item.sub.split("· ")[1]}}
))}
{/* footer */}
↑↓ navigate ↵ open esc close {items.length} results
); } /* ========================================================= SIGNER IDENTITY OVERLAY — HSM attestation chain detail ========================================================= */ function SignerOverlay({ open, onClose }) { if (!open) return null; return (
e.stopPropagation()}>
Key Attestation · Signer Identity
EIP-712 domain separator · key origin chain
{/* Active signer */}
active signer
}/> ● HSM · nCipher nShield XC}/>
{/* EIP-712 Domain */}
eip-712 domain separator
{"{"}
  "name": "AnimaKernel",
  "version": "2",
  "chainId": 1,
  "verifyingContract": ,
  "salt":
{"}"}
{/* Key attestation chain */}
key attestation chain · HSM → intermediate → root
{[ { level: "leaf", label: "Production Signing Key", key: "0x7a1c9e44b2f8d031", origin: "HSM · nCipher", state: "finalized", expires: "2026-07-20" }, { level: "interm", label: "Intermediate CA (Ops)", key: "0xA4E2B108CC91DF20", origin: "HSM · Thales", state: "finalized", expires: "2027-11-14" }, { level: "root", label: "Root CA (Cold Storage)", key: "0x0001FF29AB8D4C00", origin: "HSM · airgap", state: "finalized", expires: "2030-01-01" }, ].map((k, i, arr) => (
{k.level}
{k.label}
{k.origin} exp {k.expires}
{i < arr.length - 1 && (
↓ signs
)}
))}
{/* Key ceremony log */}
recent key ceremonies
{[ { t: "2026-03-22 06:00", event: "key rotation", detail: "leaf rotated · 2 witnesses · ceremony #0041" }, { t: "2025-11-14 09:00", event: "key creation", detail: "leaf created from intermediate CA" }, { t: "2025-06-01 12:00", event: "root renewal", detail: "root CA extended to 2030-01-01 · 3 witnesses" }, ].map((e, i) => (
{e.t} {e.event} {e.detail}
))}
); } function SRow({ k, v }) { return (
{k} {v}
); } /* ========================================================= READ-ONLY WATERMARK (auditor mode) ========================================================= */ function AuditorWatermark() { return (
read-only · auditor view · no ops controls
); } /* ========================================================= AUDITOR-AWARE BUTTON — disabled in read-only mode ========================================================= */ function OpsButton({ role, children, ...props }) { if (role === "auditor") { return ( ); } return ; } Object.assign(window, { CommandPalette, SignerOverlay, AuditorWatermark, OpsButton });