import { ArrowRight, Bot, ExternalLink, GitCommit, Package, RefreshCw, Server, Shield, Shuffle, X } from "lucide-react" import { cn } from "@/lib/utils" import type { Job, UpdateDetails } from "@/lib/api" export type UpdateDetailState = { kind: "os" | "engine" | "swap" | "hermes"; loading: boolean; data: UpdateDetails | null } // Update-Detail-Fenster des SystemDrawers (Review P2-14: extrahiert): zeigt VOR dem // Anwenden, was genau aktualisiert wird (apt-Pakete, Engine-Builds, Hermes-Commits). export function UpdateDetailModal({ detail, maintenanceJob, onClose, onApply }: { detail: UpdateDetailState maintenanceJob?: Job onClose: () => void onApply: () => void }) { const d = detail.data const meta = { os: { icon: Shield, cls: "text-cyan-400", title: "OS-Pakete (apt)" }, engine: { icon: Server, cls: "text-violet-400", title: "Inferenz-Engine (llama.cpp)" }, swap: { icon: Shuffle, cls: "text-fuchsia-400", title: "Router (llama-swap)" }, hermes: { icon: Bot, cls: "text-amber-400", title: "Hermes-Agent" }, }[detail.kind] const Icon = meta.icon const nothing = !d ? true : detail.kind === "os" ? (d.count ?? 0) === 0 : detail.kind === "hermes" ? (d.behind ?? 0) === 0 : (d.installed_build != null && d.latest_build != null && d.latest_build <= d.installed_build) return (
{/* Header */}

{meta.title}

{/* Body */}
{detail.loading ? (
Details werden geladen…
) : d?.error ? (
{d.error}
) : detail.kind === "os" ? ( (d?.count ?? 0) === 0 ? (
Keine Pakete zu aktualisieren — System ist aktuell.
) : ( <>
{d!.count} Paket(e) werden aktualisiert:
{d!.packages!.map((p) => (
{p.name} {p.current}{p.candidate}
))}
) ) : detail.kind === "engine" || detail.kind === "swap" ? ( <>
Build {d?.installed_build ?? "?"} Build {d?.latest_build ?? "?"}
{(d?.name || d?.latest_tag) && (
Release: {d?.name}{d?.latest_tag ? ` (${d.latest_tag})` : ""}
)} {d?.url && ( Release-Notes auf GitHub )} {d?.body && (
{d.body}
)} ) : ( // hermes (d?.commits?.length ?? 0) === 0 ? (
Keine neuen Commits — Hermes-Agent ist bereits aktuell.
) : ( <>
{d!.behind} neue Commit(s) auf origin/{d!.branch}:
{d!.commits!.map((c) => (
{c.subject}
{c.hash} · {c.when}
))}

Vor dem Update wird automatisch ein Backup erstellt; danach startet der Hermes-Gateway neu.

) )}
{/* Footer */}
) }