summaryrefslogtreecommitdiff
path: root/frontend/src/components/ContractDetail.tsx
diff options
context:
space:
mode:
authorsoryu <soryu@soryu.co>2026-01-29 02:24:48 +0000
committerGitHub <noreply@github.com>2026-01-29 02:24:48 +0000
commitcfe3ea0aae878ae8f591acdc33a48332ac875b9e (patch)
tree49a7f2d17f494f6c5f88d7c0692d57c21dea3244 /frontend/src/components/ContractDetail.tsx
parent764ace78046e78cce36b64cb3682cc5489bcf9d7 (diff)
downloadsoryu-cfe3ea0aae878ae8f591acdc33a48332ac875b9e.tar.gz
soryu-cfe3ea0aae878ae8f591acdc33a48332ac875b9e.zip
fix: Remove mistaken red team UI from VN frontend (#47)
* feat: Add Red Team UI to makima/frontend contract creation - Add redTeamEnabled and redTeamPrompt state to contracts page - Add "Enable Red Team Monitoring" checkbox with description - Add conditional "Custom Review Criteria" textarea when enabled - Include redTeamEnabled/redTeamPrompt in CreateContractRequest - Reset red team fields when canceling contract creation - Add redTeamEnabled to ContractSummary and Contract types - Add redTeamEnabled/redTeamPrompt to CreateContractRequest type - Add Red Team badge (🔍) to ContractList for enabled contracts Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix: Remove mistaken red team UI from VN frontend PR #39 accidentally added red team UI code to the wrong frontend directory (frontend/ instead of makima/frontend/). The correct implementation is already in makima/frontend/. This commit removes the mistaken changes: - Delete ContractCreateModal.tsx (was added by mistake) - Revert ContractList.tsx to remove red team badge and create modal - Revert ContractDetail.tsx to remove red team tab and notifications - Revert types.ts to remove contract/task types - Revert pc98.css to remove red team styling Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * [WIP] Heartbeat checkpoint - 2026-01-29 02:18:40 UTC --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Diffstat (limited to 'frontend/src/components/ContractDetail.tsx')
-rw-r--r--frontend/src/components/ContractDetail.tsx139
1 files changed, 4 insertions, 135 deletions
diff --git a/frontend/src/components/ContractDetail.tsx b/frontend/src/components/ContractDetail.tsx
index a9dd550..72527ce 100644
--- a/frontend/src/components/ContractDetail.tsx
+++ b/frontend/src/components/ContractDetail.tsx
@@ -12,8 +12,6 @@ interface TaskSummary {
id: string
name: string
status: string
- is_supervisor?: boolean
- is_red_team?: boolean
}
interface ContractRepository {
@@ -32,24 +30,6 @@ interface Contract {
status: string
version: number
created_at: string
- red_team_enabled?: boolean
- red_team_prompt?: string
-}
-
-interface RedTeamNotification {
- id: string
- contract_id: string
- red_team_task_id: string
- related_task_id?: string
- message: string
- severity: 'info' | 'warning' | 'critical'
- file_path?: string
- context?: string
- delivered: boolean
- delivered_at?: string
- acknowledged: boolean
- acknowledged_at?: string
- created_at: string
}
interface ContractWithRelations {
@@ -59,7 +39,7 @@ interface ContractWithRelations {
tasks: TaskSummary[]
}
-type Tab = 'overview' | 'files' | 'tasks' | 'repositories' | 'red-team'
+type Tab = 'overview' | 'files' | 'tasks' | 'repositories'
export function ContractDetail() {
const { id } = useParams<{ id: string }>()
@@ -67,8 +47,6 @@ export function ContractDetail() {
const [loading, setLoading] = useState(true)
const [error, setError] = useState<string | null>(null)
const [activeTab, setActiveTab] = useState<Tab>('overview')
- const [notifications, setNotifications] = useState<RedTeamNotification[]>([])
- const [notificationsLoading, setNotificationsLoading] = useState(false)
useEffect(() => {
async function fetchContract() {
@@ -92,28 +70,6 @@ export function ContractDetail() {
fetchContract()
}, [id])
- // Fetch red team notifications when viewing red-team tab
- useEffect(() => {
- async function fetchNotifications() {
- if (!id || activeTab !== 'red-team' || !data?.contract.red_team_enabled) return
-
- try {
- setNotificationsLoading(true)
- const response = await fetch(`/api/v1/contracts/${id}/red-team/notifications`)
- if (response.ok) {
- const notificationData = await response.json()
- setNotifications(notificationData.notifications || [])
- }
- } catch (err) {
- console.error('Failed to fetch red team notifications:', err)
- } finally {
- setNotificationsLoading(false)
- }
- }
-
- fetchNotifications()
- }, [id, activeTab, data?.contract.red_team_enabled])
-
if (loading) {
return (
<div className="contract-detail-container">
@@ -152,14 +108,7 @@ export function ContractDetail() {
<Link to="/contracts" className="back-link">
Back to Contracts
</Link>
- <h1 className="contract-title">
- {contract.name}
- {contract.red_team_enabled && (
- <span className="red-team-badge" title="Red Team monitoring enabled">
- đŸ›Ąī¸ Red Team
- </span>
- )}
- </h1>
+ <h1 className="contract-title">{contract.name}</h1>
{contract.description && (
<p className="contract-description">{contract.description}</p>
)}
@@ -195,14 +144,6 @@ export function ContractDetail() {
>
Repositories ({repositories.length})
</button>
- {contract.red_team_enabled && (
- <button
- className={`tab-button red-team-tab ${activeTab === 'red-team' ? 'active' : ''}`}
- onClick={() => setActiveTab('red-team')}
- >
- đŸ›Ąī¸ Red Team
- </button>
- )}
</div>
<div className="contract-tab-content">
@@ -253,12 +194,8 @@ export function ContractDetail() {
) : (
<ul className="task-list">
{tasks.map((task) => (
- <li key={task.id} className={`task-item ${task.is_red_team ? 'red-team-task' : ''}`}>
- <h3>
- {task.is_red_team && <span className="task-badge red-team">đŸ›Ąī¸</span>}
- {task.is_supervisor && <span className="task-badge supervisor">👔</span>}
- {task.name}
- </h3>
+ <li key={task.id} className="task-item">
+ <h3>{task.name}</h3>
<span className={`task-status status-${task.status}`}>
{task.status}
</span>
@@ -289,74 +226,6 @@ export function ContractDetail() {
)}
</div>
)}
-
- {activeTab === 'red-team' && contract.red_team_enabled && (
- <div className="tab-panel red-team-panel">
- <h2>đŸ›Ąī¸ Red Team Monitoring</h2>
-
- {contract.red_team_prompt && (
- <div className="red-team-prompt">
- <h3>Review Criteria</h3>
- <p>{contract.red_team_prompt}</p>
- </div>
- )}
-
- <div className="red-team-status">
- <h3>Red Team Task</h3>
- {(() => {
- const redTeamTask = tasks.find(t => t.is_red_team)
- if (redTeamTask) {
- return (
- <div className="red-team-task-info">
- <span className="task-name">{redTeamTask.name}</span>
- <span className={`task-status status-${redTeamTask.status}`}>
- {redTeamTask.status}
- </span>
- </div>
- )
- }
- return <p className="no-task">Red team task not yet spawned</p>
- })()}
- </div>
-
- <div className="red-team-notifications">
- <h3>Alerts ({notifications.length})</h3>
- {notificationsLoading ? (
- <p>Loading notifications...</p>
- ) : notifications.length === 0 ? (
- <p className="no-alerts">No alerts from red team</p>
- ) : (
- <ul className="notification-list">
- {notifications.map((notification) => (
- <li
- key={notification.id}
- className={`notification-item severity-${notification.severity}`}
- >
- <div className="notification-header">
- <span className={`severity-badge ${notification.severity}`}>
- {notification.severity === 'critical' && '🚨'}
- {notification.severity === 'warning' && 'âš ī¸'}
- {notification.severity === 'info' && 'â„šī¸'}
- {notification.severity.toUpperCase()}
- </span>
- <span className="notification-time">
- {new Date(notification.created_at).toLocaleString()}
- </span>
- </div>
- <p className="notification-message">{notification.message}</p>
- {notification.file_path && (
- <span className="notification-file">File: {notification.file_path}</span>
- )}
- {notification.context && (
- <pre className="notification-context">{notification.context}</pre>
- )}
- </li>
- ))}
- </ul>
- )}
- </div>
- </div>
- )}
</div>
</div>
)