summaryrefslogtreecommitdiff
path: root/makima/src/db/models.rs
diff options
context:
space:
mode:
Diffstat (limited to 'makima/src/db/models.rs')
-rw-r--r--makima/src/db/models.rs44
1 files changed, 44 insertions, 0 deletions
diff --git a/makima/src/db/models.rs b/makima/src/db/models.rs
index 9c2d072..8207ba2 100644
--- a/makima/src/db/models.rs
+++ b/makima/src/db/models.rs
@@ -441,6 +441,11 @@ pub struct Task {
#[serde(default)]
pub is_supervisor: bool,
+ // Red team flag
+ /// True for red team tasks that monitor and review other tasks' work.
+ #[serde(default)]
+ pub is_red_team: bool,
+
// Daemon/container info
pub daemon_id: Option<Uuid>,
pub container_id: Option<String>,
@@ -570,6 +575,9 @@ pub struct TaskSummary {
/// True for contract supervisor tasks
#[serde(default)]
pub is_supervisor: bool,
+ /// True for red team tasks that monitor and review other tasks' work
+ #[serde(default)]
+ pub is_red_team: bool,
/// Whether this task is hidden from the UI (user dismissed it)
#[serde(default)]
pub hidden: bool,
@@ -595,6 +603,7 @@ impl From<Task> for TaskSummary {
subtask_count: 0, // Would need separate query
version: task.version,
is_supervisor: task.is_supervisor,
+ is_red_team: task.is_red_team,
hidden: task.hidden,
created_at: task.created_at,
updated_at: task.updated_at,
@@ -627,6 +636,9 @@ pub struct CreateTaskRequest {
/// True for contract supervisor tasks. Only supervisors can spawn new tasks.
#[serde(default)]
pub is_supervisor: bool,
+ /// True for red team tasks that monitor and review other tasks' work.
+ #[serde(default)]
+ pub is_red_team: bool,
/// Priority (higher = more urgent)
#[serde(default)]
pub priority: i32,
@@ -2074,3 +2086,35 @@ pub struct CheckpointPatchInfo {
pub created_at: DateTime<Utc>,
pub expires_at: DateTime<Utc>,
}
+
+// ============================================================================
+// Red Team Notifications
+// ============================================================================
+
+/// A notification from a red team task to the contract supervisor.
+/// Red team tasks monitor implementation work and send alerts when issues are detected.
+#[derive(Debug, Clone, FromRow, Serialize, ToSchema)]
+#[serde(rename_all = "camelCase")]
+pub struct RedTeamNotification {
+ pub id: Uuid,
+ /// The contract this notification relates to
+ pub contract_id: Uuid,
+ /// The red team task that created this notification
+ pub red_team_task_id: Uuid,
+ /// The task being reviewed (if applicable)
+ pub related_task_id: Option<Uuid>,
+ /// The notification message
+ pub message: String,
+ /// Severity level: "info", "warning", "error", "critical"
+ pub severity: String,
+ /// File path being reviewed (if applicable)
+ pub file_path: Option<String>,
+ /// Additional context (code snippet, reason, etc.)
+ pub context: Option<String>,
+ /// Whether this notification has been delivered to the supervisor
+ #[serde(default)]
+ pub delivered: bool,
+ /// When the notification was delivered
+ pub delivered_at: Option<DateTime<Utc>>,
+ pub created_at: DateTime<Utc>,
+}