feat: harden runtime readiness and session workflow

This commit is contained in:
User
2026-07-14 10:27:25 +02:00
parent 6d7738d538
commit 6dbf93fff9
52 changed files with 1464 additions and 169 deletions
+24 -13
View File
@@ -1,15 +1,28 @@
// frontend/src/shell/NavSessions.tsx
import type { ReactNode } from "react";
import type { SessionSummary } from "../api/types";
import { Checkbox } from "../components/ui/checkbox";
interface Props {
sessions: SessionSummary[];
activeSessionId: string | null;
onOpenPanel: (id: string) => void;
menuFor: (session: SessionSummary) => ReactNode;
selectedIds?: ReadonlySet<string>;
onSelectionChange?: (id: string, selected: boolean) => void;
}
export function NavSessions({ sessions, activeSessionId, onOpenPanel, menuFor }: Props) {
function statusIndicator(status: string) {
if (status === "finalized") return { color: "bg-[oklch(var(--success))]", label: "Completed" };
if (status === "closed") return { color: "bg-[oklch(var(--warning))]", label: "Stopped by user" };
if (status === "failed") return { color: "bg-destructive", label: "Stopped by system error" };
return { color: "bg-muted-foreground/50", label: "In progress" };
}
export function NavSessions({
sessions, activeSessionId, onOpenPanel, menuFor,
selectedIds = new Set<string>(), onSelectionChange = () => undefined,
}: Props) {
if (sessions.length === 0) {
return (
<p className="px-1 py-6 text-center text-xs text-muted-foreground">
@@ -22,6 +35,7 @@ export function NavSessions({ sessions, activeSessionId, onOpenPanel, menuFor }:
{sessions.map((s) => {
const active = s.id === activeSessionId;
const label = s.name || s.question || s.id;
const indicator = statusIndicator(s.status);
return (
<li key={s.id}>
<div
@@ -42,22 +56,19 @@ export function NavSessions({ sessions, activeSessionId, onOpenPanel, menuFor }:
"group flex w-full cursor-pointer items-center gap-2 rounded-lg px-2 py-1 text-left transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-ring/40",
// The in-progress (active) session is marked in yellow — both its dot
// and its row background — so it stands out from the rest of the rail.
active ? "bg-[oklch(var(--warning)/0.22)]" : "hover:bg-accent",
active ? "bg-accent" : "hover:bg-accent",
].join(" ")}
>
<Checkbox
checked={selectedIds.has(s.id)}
aria-label={`Select ${label}`}
onCheckedChange={(selected) => onSelectionChange(s.id, selected === true)}
onClick={(event) => event.stopPropagation()}
/>
<span
aria-hidden
title={s.status}
className={[
"size-1.5 shrink-0 rounded-full",
active
? "bg-[oklch(var(--warning))]"
: s.status === "open"
? "bg-[oklch(var(--success))]"
: s.status === "finalized"
? "bg-primary"
: "bg-muted-foreground/50",
].join(" ")}
title={indicator.label}
className={["size-1.5 shrink-0 rounded-full", indicator.color].join(" ")}
/>
<span
className={[