neural_conductor_shared/
protocol.rs

1//! Protocol definitions for Conductor communication
2
3use serde::{Deserialize, Serialize};
4use super::{SessionId, TaskStatus};
5
6/// Request from server to agent
7#[derive(Debug, Clone, Serialize, Deserialize)]
8pub enum Request {
9    /// Ping to check agent health
10    Ping,
11    
12    /// Execute a command in a session
13    ExecuteCommand {
14        session_id: SessionId,
15        command: String,
16        args: Vec<String>,
17        workdir: Option<String>,
18    },
19    
20    /// Create a new session
21    CreateSession {
22        session_id: SessionId,
23        workspace_path: String,
24    },
25    
26    /// Terminate a session
27    TerminateSession {
28        session_id: SessionId,
29    },
30    
31    /// Get session status
32    GetSessionStatus {
33        session_id: SessionId,
34    },
35}
36
37/// Response from agent to server
38#[derive(Debug, Clone, Serialize, Deserialize)]
39pub enum Response {
40    /// Pong response
41    Pong {
42        agent_info: super::AgentInfo,
43    },
44    
45    /// Command execution result
46    CommandResult {
47        session_id: SessionId,
48        exit_code: i32,
49        stdout: String,
50        stderr: String,
51    },
52    
53    /// Session created
54    SessionCreated {
55        session_id: SessionId,
56    },
57    
58    /// Session terminated
59    SessionTerminated {
60        session_id: SessionId,
61    },
62    
63    /// Session status
64    SessionStatus {
65        session_id: SessionId,
66        status: TaskStatus,
67    },
68    
69    /// Error response
70    Error {
71        message: String,
72    },
73}