diff --git a/app/[workspace]/project/[projectId]/build/page.tsx b/app/[workspace]/project/[projectId]/build/page.tsx index 044eff6..4115426 100644 --- a/app/[workspace]/project/[projectId]/build/page.tsx +++ b/app/[workspace]/project/[projectId]/build/page.tsx @@ -278,6 +278,9 @@ function AgentMode({ projectId, appName, appPath }: { projectId: string; appName const [approveMsg, setApproveMsg] = useState(""); const [showApproveInput, setShowApproveInput] = useState(false); const [approveResult, setApproveResult] = useState(null); + const [retrying, setRetrying] = useState(false); + const [followUp, setFollowUp] = useState(""); + const [showFollowUp, setShowFollowUp] = useState(false); const outputRef = useCallback((el: HTMLDivElement | null) => { if (el) el.scrollTop = el.scrollHeight; }, []); @@ -346,6 +349,24 @@ function AgentMode({ projectId, appName, appPath }: { projectId: string; appName setActiveSession(prev => prev ? { ...prev, status: "stopped" } : null); }; + const handleRetry = async (continueTask?: string) => { + if (!activeSessionId) return; + setRetrying(true); + try { + const r = await fetch(`/api/projects/${projectId}/agent/sessions/${activeSessionId}/retry`, { + method: "POST", + headers: { "Content-Type": "application/json" }, + body: JSON.stringify({ continueTask: continueTask?.trim() || undefined }), + }); + const d = await r.json(); + if (d.sessionId) { + setActiveSession(prev => prev ? { ...prev, status: "running", output: [], error: null } : null); + setShowFollowUp(false); + setFollowUp(""); + } + } finally { setRetrying(false); } + }; + const handleApprove = async () => { if (!activeSessionId || !approveMsg.trim()) return; setApproving(true); @@ -459,6 +480,57 @@ function AgentMode({ projectId, appName, appPath }: { projectId: string; appName )} + {/* Retry / follow-up panel for failed or stopped sessions */} + {["failed", "stopped"].includes(activeSession.status) && ( +
+ {showFollowUp ? ( +
+
+ Add a follow-up instruction (optional) then retry: +
+
+