diff options
| author | soryu <soryu@soryu.co> | 2026-03-10 17:33:23 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-03-10 17:33:23 +0000 |
| commit | 3679ceb3325033faa2f889ef3dfee5668ef7aeea (patch) | |
| tree | a0975085bd9a3ef4a8545cf33c8669c7b51e4efb | |
| parent | f49aaa39a32661b54c109ba002d24cbdf73f4ea3 (diff) | |
| download | soryu-0.5.0.tar.gz soryu-0.5.0.zip | |
feat: soryu-co/soryu - makima: Fix build errors in daemon protocol and task manager (#89)v0.5.0
| -rw-r--r-- | makima/src/daemon/task/manager.rs | 33 | ||||
| -rw-r--r-- | makima/src/daemon/ws/protocol.rs | 9 | ||||
| -rw-r--r-- | makima/src/server/handlers/mesh_daemon.rs | 17 | ||||
| -rw-r--r-- | makima/src/server/state.rs | 3 |
4 files changed, 62 insertions, 0 deletions
diff --git a/makima/src/daemon/task/manager.rs b/makima/src/daemon/task/manager.rs index acdf4ad..ca97453 100644 --- a/makima/src/daemon/task/manager.rs +++ b/makima/src/daemon/task/manager.rs @@ -3672,6 +3672,39 @@ impl TaskManager { Ok(()) } + /// Resolve the best diff base reference for a given base branch. + /// Tries origin/{base} first, then falls back to local {base} branch. + async fn resolve_diff_base(path: &std::path::PathBuf, base: &str) -> Option<String> { + // Try origin/{base} first + let origin_ref = format!("origin/{}", base); + let check_origin = tokio::process::Command::new("git") + .current_dir(path) + .args(["rev-parse", "--verify", &origin_ref]) + .output() + .await; + + if let Ok(output) = check_origin { + if output.status.success() { + return Some(format!("origin/{}...HEAD", base)); + } + } + + // Fall back to local branch + let check_local = tokio::process::Command::new("git") + .current_dir(path) + .args(["rev-parse", "--verify", base]) + .output() + .await; + + if let Ok(output) = check_local { + if output.status.success() { + return Some(format!("{}...HEAD", base)); + } + } + + None + } + /// Handle GetWorktreeDiff command - get git diff for a task's worktree. async fn handle_get_worktree_diff( &self, diff --git a/makima/src/daemon/ws/protocol.rs b/makima/src/daemon/ws/protocol.rs index 0583783..ced653b 100644 --- a/makima/src/daemon/ws/protocol.rs +++ b/makima/src/daemon/ws/protocol.rs @@ -348,6 +348,15 @@ pub enum DaemonMessage { error: Option<String>, }, + /// Response to GetWorktreeDiff command. + WorktreeDiffResult { + #[serde(rename = "taskId")] + task_id: Uuid, + success: bool, + diff: Option<String>, + error: Option<String>, + }, + /// Response to CreateCheckpoint command. CheckpointCreated { #[serde(rename = "taskId")] diff --git a/makima/src/server/handlers/mesh_daemon.rs b/makima/src/server/handlers/mesh_daemon.rs index 139db70..e5f0a81 100644 --- a/makima/src/server/handlers/mesh_daemon.rs +++ b/makima/src/server/handlers/mesh_daemon.rs @@ -2488,6 +2488,23 @@ async fn handle_daemon_connection(socket: WebSocket, state: SharedState, auth_re } } } + Ok(DaemonMessage::WorktreeDiffResult { task_id, success, diff, error }) => { + tracing::debug!( + task_id = %task_id, + success = success, + "Worktree diff result received" + ); + + // Fulfill pending worktree diff request if any + if let Some((_, tx)) = state.pending_worktree_diff.remove(&task_id) { + let _ = tx.send(crate::server::state::WorktreeDiffResponse { + task_id, + success, + diff: diff.unwrap_or_default(), + error, + }); + } + } Err(e) => { tracing::warn!("Failed to parse daemon message: {}", e); } diff --git a/makima/src/server/state.rs b/makima/src/server/state.rs index 83ac2e8..1f7b264 100644 --- a/makima/src/server/state.rs +++ b/makima/src/server/state.rs @@ -675,6 +675,8 @@ pub struct AppState { pub pending_worktree_info: DashMap<Uuid, oneshot::Sender<WorktreeInfoResponse>>, /// Pending task diff requests awaiting daemon response (keyed by task_id) pub pending_task_diff: DashMap<Uuid, oneshot::Sender<TaskDiffResult>>, + /// Pending worktree diff requests awaiting daemon response (keyed by task_id) + pub pending_worktree_diff: DashMap<Uuid, oneshot::Sender<WorktreeDiffResponse>>, /// Pending worktree commit requests awaiting daemon response (keyed by task_id) pub pending_worktree_commit: DashMap<Uuid, oneshot::Sender<WorktreeCommitResponse>>, /// Lazily-loaded TTS engine (initialized on first Speak connection) @@ -759,6 +761,7 @@ impl AppState { jwt_verifier, pending_worktree_info: DashMap::new(), pending_task_diff: DashMap::new(), + pending_worktree_diff: DashMap::new(), pending_worktree_commit: DashMap::new(), tts_engine: OnceCell::new(), daemon_reauth_status: DashMap::new(), |
