diff --git a/apps/web/src/components/RefineSpawnDialog.tsx b/apps/web/src/components/RefineSpawnDialog.tsx index dc70a23..479c7f5 100644 --- a/apps/web/src/components/RefineSpawnDialog.tsx +++ b/apps/web/src/components/RefineSpawnDialog.tsx @@ -22,6 +22,8 @@ interface RefineSpawnDialogProps { showInstructionInput?: boolean; /** Placeholder text for the instruction textarea */ instructionPlaceholder?: string; + /** Pre-populate the instruction field (e.g. from a crashed agent's original instruction) */ + defaultInstruction?: string; /** Whether the spawn mutation is pending */ isSpawning: boolean; /** Error message if spawn failed */ @@ -38,6 +40,7 @@ export function RefineSpawnDialog({ description, showInstructionInput = true, instructionPlaceholder = "What should the agent focus on? (optional)", + defaultInstruction, isSpawning, error, onSpawn, @@ -53,18 +56,25 @@ export function RefineSpawnDialog({ onSpawn(finalInstruction); }; + const openDialog = () => { + setInstruction(defaultInstruction ?? ""); + setShowDialog(true); + }; + const handleOpenChange = (open: boolean) => { - setShowDialog(open); - if (!open) { + if (open) { + setInstruction(defaultInstruction ?? ""); + } else { setInstruction(""); } + setShowDialog(open); }; const defaultTrigger = (