use async_trait::async_trait;
use identity::Principal;
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct TerminalGraphHandles {
pub tool_call_node_id: String,
pub open_event_node_id: String,
}
#[derive(Debug, thiserror::Error)]
pub enum MirrorError {
#[error("graph mirror error: {0}")]
Backend(String),
}
#[async_trait]
pub trait TerminalGraphSink: Send + Sync {
async fn record_open(
&self,
session_id: &str,
program: &str,
args: &[String],
cwd: Option<&str>,
principal: Option<&Principal>,
) -> Result<TerminalGraphHandles, MirrorError>;
async fn record_close(
&self,
handles: &TerminalGraphHandles,
session_id: &str,
exit_code: i32,
was_killed: bool,
) -> Result<(), MirrorError>;
}