import { useState } from "react"; import { useQuery } from "@tanstack/react-query"; import { motion, AnimatePresence } from "motion/react"; import { fetchOrbits, fetchSnapshots, runOrbit, startPairing, startReconstitute, abortReconstitute, pollReconstitute, } from "./api"; import { VaultRing } from "./components/VaultRing"; import { OrbitsPanel } from "./components/OrbitsPanel"; import { ReconstituteWizard } from "./components/ReconstituteWizard"; type Sheet = "none" | "snapshot" | "reconstitute" | "wormhole"; export default function App() { const [sheet, setSheet] = useState("none"); const [selectedSnap, setSelectedSnap] = useState(null); const [pairing, setPairing] = useState<{ code: string; expires_at: string } | null>(null); const snaps = useQuery({ queryKey: ["snapshots"], queryFn: fetchSnapshots, refetchInterval: 8000 }); const orbits = useQuery({ queryKey: ["orbits"], queryFn: fetchOrbits, refetchInterval: 8000 }); const statusColor = orbits.data?.some((o) => o.last_status === "failed") ? "bg-orbit-red" : orbits.data?.some((o) => o.last_status === "running" || o.last_status === "rehearsed") ? "bg-orbit-amber" : "bg-orbit-green"; return (

Tessera Vault

Only stardust that changed

{ setSelectedSnap(id); setSheet("snapshot"); }} />
{sheet !== "none" && ( {sheet === "snapshot" && selectedSnap && ( setSheet("none")} onReconstitute={() => setSheet("reconstitute")} /> )} {sheet === "reconstitute" && ( )} {sheet === "wormhole" && pairing && (

Open a wormhole

On your outpost, run{" "} tessera-agent pair {pairing.code}

{pairing.code}

)}
)}
runOrbit(id).then(() => orbits.refetch())} />
); } function TabButton({ children, onClick }: { children: React.ReactNode; onClick: () => void }) { return ( ); } function SnapshotDetail({ id, snaps, onClose, onReconstitute, }: { id: string; snaps: { id: string; orbit_name: string; taken_at: string; size_bytes: number }[]; onClose: () => void; onReconstitute: () => void; }) { const snap = snaps.find((s) => s.id === id); if (!snap) return null; return (

Snapshot tile

Orbit {snap.orbit_name}

{new Date(snap.taken_at).toLocaleString()}

{snap.size_bytes} bytes

); }