pub struct TransportSession {
pub session_id: String,
pub tool: CliTool,
/* private fields */
}Expand description
Thin dispatch router for spawning any of the 4 supported PIPE-mode CLI agents.
All four CLIs (Claude Code, Codex, Gemini, OpenCode) use the Pipe
transport. PTY-mode sessions use PtySession directly — there is no PTY
routing through TransportSession.
Fields§
§session_id: StringGate4agent-assigned session ID (not the CLI-native session ID).
tool: CliToolThe CLI tool that was spawned.
Implementations§
Source§impl TransportSession
impl TransportSession
Sourcepub async fn spawn(
tool: CliTool,
working_dir: &Path,
prompt: &str,
options: SpawnOptions,
) -> Result<Self, AgentError>
pub async fn spawn( tool: CliTool, working_dir: &Path, prompt: &str, options: SpawnOptions, ) -> Result<Self, AgentError>
Spawn a new pipe session for the given tool and deliver the initial prompt.
All four CliTool variants use the Pipe transport. PTY mode is not
dispatched here — use PtySession::spawn directly.
§Errors
AgentError::Spawn— the child process failed to start
Sourcepub fn subscribe(&self) -> Receiver<AgentEvent>
pub fn subscribe(&self) -> Receiver<AgentEvent>
Subscribe to all future AgentEvent values from this session.
Events emitted before this call are not replayed. Subscribe before
awaiting spawn if you need the Started event.
Sourcepub fn session_id(&self) -> &str
pub fn session_id(&self) -> &str
Gate4agent-assigned session ID (not the CLI-native session ID).
Sourcepub async fn send_prompt(&self, prompt: &str) -> Result<(), AgentError>
pub async fn send_prompt(&self, prompt: &str) -> Result<(), AgentError>
Send a follow-up prompt via stdin (for CLIs that support multi-turn pipe mode).
Currently only Claude Code supports multi-turn pipe sessions. For other CLIs this will write to stdin but may have no effect.
Sourcepub async fn kill(&self) -> Result<(), AgentError>
pub async fn kill(&self) -> Result<(), AgentError>
Kill the underlying process.
Auto Trait Implementations§
impl Freeze for TransportSession
impl RefUnwindSafe for TransportSession
impl Send for TransportSession
impl Sync for TransportSession
impl Unpin for TransportSession
impl UnsafeUnpin for TransportSession
impl UnwindSafe for TransportSession
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.