import { useState, useEffect } from "react"; import type { AutonomyLevel, RepositoryHistoryEntry } from "../../lib/api"; import { getRepositorySuggestions } from "../../lib/api"; interface CreateDirectiveModalProps { onSubmit: (goal: string, repositoryUrl: string | undefined, autonomyLevel: AutonomyLevel) => void; onCancel: () => void; } export function CreateDirectiveModal({ onSubmit, onCancel }: CreateDirectiveModalProps) { const [goal, setGoal] = useState(""); const [repositoryUrl, setRepositoryUrl] = useState(""); const [autonomyLevel, setAutonomyLevel] = useState("guardrails"); const [suggestions, setSuggestions] = useState([]); const [showSuggestions, setShowSuggestions] = useState(false); // Load suggestions useEffect(() => { getRepositorySuggestions("remote", undefined, 5) .then((res) => { setSuggestions(res.entries); }) .catch(() => { setSuggestions([]); }); }, []); const handleSubmit = () => { if (goal.trim()) { onSubmit(goal.trim(), repositoryUrl.trim() || undefined, autonomyLevel); } }; return (

Create Directive

{/* Goal */}