diff options
| author | soryu <soryu@soryu.co> | 2026-01-29 01:20:09 +0000 |
|---|---|---|
| committer | soryu <soryu@soryu.co> | 2026-01-29 01:20:09 +0000 |
| commit | 8974ec96d0c487c2e84e225f165cbd9ae4dc47f1 (patch) | |
| tree | b358b7d8b02a3db86a1129141da00eb8f8cd27e0 | |
| parent | 3118b241ccb3fb2d89948726b2f83a82de998cf2 (diff) | |
| download | soryu-8974ec96d0c487c2e84e225f165cbd9ae4dc47f1.tar.gz soryu-8974ec96d0c487c2e84e225f165cbd9ae4dc47f1.zip | |
Add Red Team fields to makima/frontend contract creationmakima/red-team-cli-and-frontend
- Add redTeamEnabled and redTeamPrompt state to contracts.tsx
- Add UI toggle checkbox for 'Enable Red Team monitoring'
- Add conditional textarea for 'Custom review criteria'
- Include red_team_enabled and red_team_prompt in CreateContractRequest
- Reset red team fields on form cancel/success
- Add redTeamEnabled to ContractSummary type in api.ts
- Add redTeamEnabled/redTeamPrompt to CreateContractRequest type
- Add red team badge to ContractList.tsx contract items
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
| -rw-r--r-- | makima/frontend/src/components/contracts/ContractList.tsx | 5 | ||||
| -rw-r--r-- | makima/frontend/src/lib/api.ts | 6 | ||||
| -rw-r--r-- | makima/frontend/src/routes/contracts.tsx | 66 |
3 files changed, 77 insertions, 0 deletions
diff --git a/makima/frontend/src/components/contracts/ContractList.tsx b/makima/frontend/src/components/contracts/ContractList.tsx index 98f8ff6..d56c9fd 100644 --- a/makima/frontend/src/components/contracts/ContractList.tsx +++ b/makima/frontend/src/components/contracts/ContractList.tsx @@ -136,6 +136,11 @@ export function ContractList({ Local </span> )} + {contract.redTeamEnabled && ( + <span className="px-1.5 py-0.5 font-mono text-[9px] uppercase text-red-400 border border-red-400/30 bg-red-400/10 shrink-0" title="Red Team monitoring enabled"> + Red Team + </span> + )} </div> <span className={`text-[10px] font-mono uppercase shrink-0 ${ diff --git a/makima/frontend/src/lib/api.ts b/makima/frontend/src/lib/api.ts index 4390b20..bd172e8 100644 --- a/makima/frontend/src/lib/api.ts +++ b/makima/frontend/src/lib/api.ts @@ -1679,6 +1679,8 @@ export interface ContractSummary { supervisorTaskId: string | null; /** When true, tasks won't auto-push or create PRs - use patch files instead */ localOnly: boolean; + /** Whether red team monitoring is enabled */ + redTeamEnabled?: boolean; fileCount: number; taskCount: number; repositoryCount: number; @@ -1738,6 +1740,10 @@ export interface CreateContractRequest { initialPhase?: ContractPhase; /** When true, tasks won't auto-push or create PRs - use patch files instead */ localOnly?: boolean; + /** Enable red team monitoring for this contract */ + redTeamEnabled?: boolean; + /** Custom review criteria for the red team */ + redTeamPrompt?: string; } export interface UpdateContractRequest { diff --git a/makima/frontend/src/routes/contracts.tsx b/makima/frontend/src/routes/contracts.tsx index aa62bd9..2f1f246 100644 --- a/makima/frontend/src/routes/contracts.tsx +++ b/makima/frontend/src/routes/contracts.tsx @@ -93,6 +93,8 @@ function ContractsPageContent() { const [contractTypes, setContractTypes] = useState<ContractTypeTemplate[]>([]); const [contractTypesLoading, setContractTypesLoading] = useState(false); const [localOnly, setLocalOnly] = useState(false); + const [redTeamEnabled, setRedTeamEnabled] = useState(false); + const [redTeamPrompt, setRedTeamPrompt] = useState(""); // Fetch contract types when modal opens - merges built-in types with user templates useEffect(() => { @@ -265,6 +267,8 @@ function ContractsPageContent() { contractType: contractType, initialPhase: initialPhase !== defaultPhaseForType ? initialPhase : undefined, localOnly: localOnly || undefined, + redTeamEnabled: redTeamEnabled || undefined, + redTeamPrompt: redTeamEnabled && redTeamPrompt.trim() ? redTeamPrompt.trim() : undefined, }; try { @@ -306,6 +310,8 @@ function ContractsPageContent() { setRepoUrl(""); setRepoPath(""); setLocalOnly(false); + setRedTeamEnabled(false); + setRedTeamPrompt(""); navigate(`/contracts/${contract.id}`); } } catch (err) { @@ -340,6 +346,8 @@ function ContractsPageContent() { setRepoUrl(""); setRepoPath(""); setLocalOnly(false); + setRedTeamEnabled(false); + setRedTeamPrompt(""); setCreateError(null); }, []); @@ -705,6 +713,64 @@ function ContractsPageContent() { </p> </div> + {/* Red Team Monitoring */} + <div className="space-y-2"> + <div className="flex items-center space-x-3"> + <button + type="button" + onClick={() => setRedTeamEnabled(!redTeamEnabled)} + className={`w-5 h-5 flex items-center justify-center border transition-colors ${ + redTeamEnabled + ? "bg-[#780f3c] border-[#fc75aa] text-[#ffdbe7]" + : "bg-[#0d1b2d] border-[#3f6fb3] text-transparent" + }`} + > + {redTeamEnabled && ( + <svg + xmlns="http://www.w3.org/2000/svg" + viewBox="0 0 24 24" + fill="none" + stroke="currentColor" + strokeWidth="3" + strokeLinecap="round" + strokeLinejoin="round" + className="w-3 h-3" + > + <polyline points="20 6 9 17 4 12" /> + </svg> + )} + </button> + <label + className="font-mono text-sm text-[#dbe7ff] cursor-pointer select-none" + onClick={() => setRedTeamEnabled(!redTeamEnabled)} + > + Enable Red Team monitoring + </label> + </div> + <p className="font-mono text-xs text-[#8b949e] pl-8"> + Spawns a parallel task that monitors work output for quality and compliance. + </p> + </div> + + {/* Red Team Prompt (shown when red team enabled) */} + {redTeamEnabled && ( + <div> + <label className="block font-mono text-xs text-[#8b949e] uppercase mb-1"> + Custom review criteria (optional) + </label> + <textarea + value={redTeamPrompt} + onChange={(e) => setRedTeamPrompt(e.target.value)} + placeholder="Enter custom criteria for the red team to evaluate against... (e.g., 'Ensure all functions have proper error handling', 'Verify security best practices are followed')" + rows={3} + className="w-full px-3 py-2 bg-[#0d1b2d] border border-[#3f6fb3] text-[#dbe7ff] font-mono text-sm focus:outline-none focus:border-[#fc75aa] resize-none" + /> + <p className="mt-1 font-mono text-xs text-[#8b949e]"> + Provide specific criteria for the red team to focus on during reviews. + </p> + </div> + )} + {/* Repository Configuration */} <div className="border-t border-[rgba(117,170,252,0.2)] pt-4"> <label className="block font-mono text-xs text-[#75aafc] uppercase mb-3"> |
