"use client"; import { motion } from "framer-motion"; import { CheckCircle2, ClipboardList, GitBranch, Inbox, LockKeyhole, Search, Terminal, UsersRound, } from "lucide-react"; import { StepControls } from "@/components/visualizations/shared/step-controls"; import { useSteppedVisualization } from "@/hooks/useSteppedVisualization"; import { cn } from "@/lib/utils"; const STEPS = [ { title: "Confirm a Small Team", desc: "The Lead proposes focused roles and waits for the user before starting persistent teammates.", event: "lead proposes: backend + tests", }, { title: "Claim Atomically", desc: "A ready task moves to one owner while the task-store file lock protects the persisted transition.", event: "task_store_lock: task_...0042 -> backend", }, { title: "Require and Review a Plan", desc: "The gate is active before the teammate starts; the Lead reviews the typed request for this task and work version.", event: "review_plan(req_000007, approve=true)", }, { title: "Route Tools to the Task Directory", desc: "The claimed task carries its worktree binding; bash, read, and write derive their cwd from that record.", event: "cwd -> .worktrees/auth-refactor", }, { title: "Execute the Approved Work", desc: "Mutating tools run only after the current assignment's plan is approved.", event: "bash / write: allowed", }, { title: "Return the Result, Keep the Teammate", desc: "Completion keeps the task cwd through the turn; IDLE releases the assignment and keeps the teammate available.", event: "complete -> result -> IDLE", }, ] as const; const EVENTS = STEPS.map((step) => step.event); function StateBadge({ label, tone, }: { label: string; tone: "zinc" | "blue" | "amber" | "emerald"; }) { const classes = { zinc: "bg-zinc-100 text-zinc-600 dark:bg-zinc-800 dark:text-zinc-300", blue: "bg-blue-100 text-blue-700 dark:bg-blue-950/50 dark:text-blue-200", amber: "bg-amber-100 text-amber-700 dark:bg-amber-950/50 dark:text-amber-200", emerald: "bg-emerald-100 text-emerald-700 dark:bg-emerald-950/50 dark:text-emerald-200", }[tone]; return ( {label} ); } function RuntimePanel({ step }: { step: number }) { const state = step === 0 ? "awaiting confirmation" : step === 1 ? "working" : step === 5 ? "idle" : "active"; const tone = step === 0 ? "zinc" : step === 5 ? "emerald" : "blue"; return (