Require a private passphrase and loopback-or-token admin auth. New vaults use Argon2id; existing PBKDF2 vaults still open, and new snapshot metadata is encrypted. Wormhole tokens survive restart, offset uploads seal into the vault, and client-certificate uploads are real. Reject the command provider and keep Postgres passwords off the process arguments. Keep the interruptible canvas motion.
101 lines
3.8 KiB
TypeScript
101 lines
3.8 KiB
TypeScript
import { useMutation } from "@tanstack/react-query";
|
|
import { motion } from "motion/react";
|
|
import { startPairing } from "../../api";
|
|
import { useReducedMotion } from "../../hooks/useReducedMotion";
|
|
import { ambientPulse } from "../../lib/motion";
|
|
import { Button } from "../ui/Button";
|
|
import { Hint } from "../ui/EmptyState";
|
|
import { TelemetryPanel } from "../ui/Telemetry";
|
|
|
|
export function WormholeView({
|
|
pairing,
|
|
onPaired,
|
|
}: {
|
|
pairing: { code: string; expires_at: string } | null;
|
|
onPaired: (p: { code: string; expires_at: string }) => void;
|
|
}) {
|
|
const gen = useMutation({
|
|
mutationFn: startPairing,
|
|
onSuccess: onPaired,
|
|
});
|
|
const reducedMotion = useReducedMotion();
|
|
|
|
const expires = pairing ? new Date(pairing.expires_at).toLocaleTimeString() : "";
|
|
|
|
return (
|
|
<div className="h-full overflow-y-auto px-4 py-4 pb-28">
|
|
<h2 className="text-2xl font-semibold text-star-100">Outposts & wormholes</h2>
|
|
<p className="text-sm text-star-300 mt-1 mb-6">
|
|
Link a remote machine once — it beams snapshots through an encrypted wormhole.
|
|
</p>
|
|
|
|
{!pairing ? (
|
|
<EmptyWormhole onGenerate={() => gen.mutate()} loading={gen.isPending} />
|
|
) : (
|
|
<motion.div
|
|
className="rounded-2xl border border-wormhole-violet/35 bg-gradient-to-b from-wormhole-violet/10 to-space-900 p-6 text-center"
|
|
initial={reducedMotion ? false : { scale: 0.95, opacity: 0 }}
|
|
animate={{ scale: 1, opacity: 1 }}
|
|
>
|
|
<p className="text-xs uppercase tracking-[0.2em] text-wormhole-violet mb-4">
|
|
Pairing code
|
|
</p>
|
|
<p className="text-4xl font-mono tracking-[0.35em] text-star-100">{pairing.code}</p>
|
|
<p className="text-sm text-star-400 mt-4">Burns at {expires}</p>
|
|
<Hint>
|
|
On the outpost:{" "}
|
|
<code className="font-mono text-orbit-amber">tessera-agent pair {pairing.code}</code>
|
|
</Hint>
|
|
<Button variant="ghost" className="mt-4 w-full" onClick={() => gen.mutate()}>
|
|
Generate fresh code
|
|
</Button>
|
|
<TelemetryPanel label="Pairing metadata">
|
|
{JSON.stringify(pairing, null, 2)}
|
|
</TelemetryPanel>
|
|
</motion.div>
|
|
)}
|
|
|
|
<section className="mt-8 space-y-3">
|
|
<h3 className="text-sm font-medium text-star-200">Outpost health</h3>
|
|
<div className="rounded-xl border border-space-700 bg-space-800/40 p-4 flex items-center gap-3">
|
|
<span className="w-2 h-2 rounded-full bg-star-400/50" />
|
|
<div>
|
|
<p className="text-sm text-star-300">No outposts paired yet</p>
|
|
<p className="text-xs text-star-400">Grey dot means offline or waiting.</p>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
function EmptyWormhole({
|
|
onGenerate,
|
|
loading,
|
|
}: {
|
|
onGenerate: () => void;
|
|
loading: boolean;
|
|
}) {
|
|
const reducedMotion = useReducedMotion();
|
|
return (
|
|
<div className="text-center py-8">
|
|
<div className="relative mx-auto w-24 h-24 rounded-full border border-wormhole-violet/30 flex items-center justify-center text-3xl">
|
|
<motion.span
|
|
aria-hidden="true"
|
|
className="pointer-events-none absolute inset-0 rounded-full shadow-[0_0_32px_rgba(167,139,250,0.25)]"
|
|
initial={{ opacity: 0 }}
|
|
animate={{ opacity: reducedMotion ? 0 : [0, 1] }}
|
|
transition={reducedMotion ? { type: false } : ambientPulse}
|
|
/>
|
|
◉
|
|
</div>
|
|
<p className="mt-4 text-star-300 text-sm max-w-xs mx-auto">
|
|
Open a wormhole when you're ready to claim an outpost.
|
|
</p>
|
|
<Button variant="primary" className="mt-6 w-full max-w-xs mx-auto" disabled={loading} onClick={onGenerate}>
|
|
{loading ? "Opening…" : "Show pairing code"}
|
|
</Button>
|
|
</div>
|
|
);
|
|
}
|