import { Button } from "@code/ui/components/button";
import {
ArrowUpRight,
Bot,
ExternalLink,
FileText,
GitPullRequest,
Layers,
Radio,
TriangleAlert,
} from "lucide-react";
import { formatRelativeTime } from "@/lib/work-os/work-unit-projection";
import type { WorkUnitDetail as WorkUnitDetailData } from "@/lib/work-os/work-unit-projection";
const formatStatus = (
status: WorkUnitDetailData["issue"]["status"]
): string => {
if (status === "needs-input") {
return "Needs input";
}
if (status === "working") {
return "In progress";
}
return status.charAt(0).toUpperCase() + status.slice(1);
};
interface WorkUnitDetailProps {
readonly detail: WorkUnitDetailData;
readonly onOpenPullRequest: (url: string) => void;
readonly onStart: () => void;
readonly startPending: boolean;
}
const Section = ({
children,
icon,
title,
}: {
readonly children: React.ReactNode;
readonly icon: React.ReactNode;
readonly title: string;
}) => (
Work Unit #{issue.number}
{issue.body}
{canStart ? ( ) : null}This work unit needs your input
Resolve the open question or decision to unblock the agent.
{detail.latestSummary}
) : null} {/* Linked Signals — authenticated via signalIssueAttachments */} } title={`Signals (${detail.signalCount})`} > {detail.linkedSignals.length > 0 ? ({signal.title}
{signal.summary}
{signal.sourceCount} source {signal.sourceCount === 1 ? "" : "s"} ·{" "} {formatRelativeTime(signal.createdAt)}
No Signals linked to this Work Unit.
)} {/* Activity timeline */} } title={`Timeline (${detail.stepCount} steps)`} > {detail.activity.length > 0 ? ({item.label}
{item.detail}
{item.time}
No activity recorded yet.
)} {/* Artifacts */} } title={`Artifacts (${detail.artifactCount})`} > {detail.artifactPaths.length > 0 ? (No artifacts produced yet.
)} {/* Pull request */} {detail.hasPullRequest ? ( } title="Pull request" > {detail.pullRequestUrl ? ({detail.pullRequestNumber ? `PR #${detail.pullRequestNumber} ready for review` : "Pull request ready"}
A pull request was opened but the URL is unavailable.
)} ) : null}