use crate::protocol::{ControlMessage, TerminalInput};
use crate::pty_manager::PtyHandle;
use async_trait::async_trait;
#[async_trait]
pub trait IpcChannel: Send + Sync {
async fn start_streaming(
&self,
terminal_id: String,
pty_handle: PtyHandle,
) -> Result<(), Box<dyn std::error::Error>>;
async fn send_input(
&self,
terminal_id: &str,
input: TerminalInput,
) -> Result<(), Box<dyn std::error::Error>>;
async fn send_control(
&self,
terminal_id: &str,
message: ControlMessage,
) -> Result<(), Box<dyn std::error::Error>>;
async fn stop_streaming(&self, terminal_id: &str) -> Result<(), Box<dyn std::error::Error>>;
}
pub struct DirectChannel;
#[async_trait]
impl IpcChannel for DirectChannel {
async fn start_streaming(
&self,
_terminal_id: String,
_pty_handle: PtyHandle,
) -> Result<(), Box<dyn std::error::Error>> {
Ok(())
}
async fn send_input(
&self,
_terminal_id: &str,
_input: TerminalInput,
) -> Result<(), Box<dyn std::error::Error>> {
Ok(())
}
async fn send_control(
&self,
_terminal_id: &str,
_message: ControlMessage,
) -> Result<(), Box<dyn std::error::Error>> {
Ok(())
}
async fn stop_streaming(&self, _terminal_id: &str) -> Result<(), Box<dyn std::error::Error>> {
Ok(())
}
}