import type { DirectiveWithChains, DirectiveStatus, DirectiveChain, } from "../../lib/api"; interface DirectiveDetailProps { directive: DirectiveWithChains; onBack: () => void; onDelete?: (id: string) => void; } const statusColors: Record = { draft: "text-[#888]", planning: "text-yellow-400", active: "text-green-400", paused: "text-orange-400", completed: "text-blue-400", archived: "text-[#555]", failed: "text-red-400", }; function ChainCard({ chain }: { chain: DirectiveChain }) { return (
{chain.name} gen {chain.generation} · {chain.status}
{chain.description && (

{chain.description}

)}
{chain.completedSteps}/{chain.totalSteps} steps {chain.failedSteps > 0 && ( {chain.failedSteps} failed )} {chain.currentConfidence != null && ( confidence: {(chain.currentConfidence * 100).toFixed(0)}% )}
); } function JsonSection({ label, data, }: { label: string; data: unknown[] | unknown; }) { const items = Array.isArray(data) ? data : []; if (items.length === 0) return null; return (

{label}

{items.map((item, i) => (
{typeof item === "string" ? item : JSON.stringify(item)}
))}
); } export function DirectiveDetail({ directive, onBack, onDelete, }: DirectiveDetailProps) { return (
{/* Header */}
{directive.status} v{directive.version} {onDelete && ( )}

{directive.title}

{/* Content */}
{/* Goal */}

Goal

{directive.goal}

{/* Config */}
Autonomy
{directive.autonomyLevel}
Chains
{directive.chainGenerationCount} generated
Cost
${directive.totalCostUsd.toFixed(2)}
{directive.repositoryUrl && (
Repository
{directive.repositoryUrl}
)}
{/* Structured sections */} {/* Chains */}

Chains ({directive.chains.length})

{directive.chains.length === 0 ? (

No chains yet. Chains are created during planning.

) : (
{directive.chains.map((chain) => ( ))}
)}
); }