summaryrefslogtreecommitdiff
path: root/makima/src/server/state.rs
diff options
context:
space:
mode:
Diffstat (limited to 'makima/src/server/state.rs')
-rw-r--r--makima/src/server/state.rs26
1 files changed, 26 insertions, 0 deletions
diff --git a/makima/src/server/state.rs b/makima/src/server/state.rs
index b954efe..988f657 100644
--- a/makima/src/server/state.rs
+++ b/makima/src/server/state.rs
@@ -103,6 +103,21 @@ pub struct TaskCompletionNotification {
pub error_message: Option<String>,
}
+/// Notification for merge operation results.
+#[derive(Debug, Clone)]
+pub struct MergeResultNotification {
+ /// ID of the task that was merged
+ pub task_id: Uuid,
+ /// Whether the merge succeeded
+ pub success: bool,
+ /// Message describing the result
+ pub message: String,
+ /// Commit SHA if merge succeeded
+ pub commit_sha: Option<String>,
+ /// List of conflicting files if merge failed due to conflicts
+ pub conflicts: Option<Vec<String>>,
+}
+
/// Notification for supervisor questions requiring user feedback.
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
@@ -507,6 +522,8 @@ pub struct AppState {
pub task_completions: broadcast::Sender<TaskCompletionNotification>,
/// Broadcast channel for supervisor question notifications
pub supervisor_questions: broadcast::Sender<SupervisorQuestionNotification>,
+ /// Broadcast channel for merge result notifications
+ pub merge_results: broadcast::Sender<MergeResultNotification>,
/// Pending supervisor questions awaiting user response (keyed by question_id)
pub pending_questions: DashMap<Uuid, PendingSupervisorQuestion>,
/// Responses to supervisor questions (keyed by question_id)
@@ -539,6 +556,7 @@ impl AppState {
let (task_output, _) = broadcast::channel(1024); // Larger buffer for output streaming
let (task_completions, _) = broadcast::channel(256); // For supervisor task monitoring
let (supervisor_questions, _) = broadcast::channel(256); // For supervisor questions to users
+ let (merge_results, _) = broadcast::channel(256); // For merge operation results
// Initialize JWT verifier from environment (optional)
// Requires SUPABASE_URL and either SUPABASE_JWT_PUBLIC_KEY (RS256) or SUPABASE_JWT_SECRET (HS256)
@@ -581,6 +599,7 @@ impl AppState {
task_output,
task_completions,
supervisor_questions,
+ merge_results,
pending_questions: DashMap::new(),
question_responses: DashMap::new(),
daemon_connections: DashMap::new(),
@@ -670,6 +689,13 @@ impl AppState {
let _ = self.supervisor_questions.send(notification);
}
+ /// Broadcast a merge result notification to all subscribers.
+ ///
+ /// Used to notify waiting handlers when a merge operation completes.
+ pub fn broadcast_merge_result(&self, notification: MergeResultNotification) {
+ let _ = self.merge_results.send(notification);
+ }
+
/// Add a pending supervisor question and broadcast it.
pub fn add_supervisor_question(
&self,