pub struct PTYManager { /* private fields */ }Expand description
Manager for multiple PTY sessions
Handles lifecycle, message routing, and event aggregation for multiple Claude Code PTY sessions.
Implementations§
Source§impl PTYManager
impl PTYManager
Sourcepub async fn set_permission_policy(&self, policy: Arc<dyn PermissionPolicy>)
pub async fn set_permission_policy(&self, policy: Arc<dyn PermissionPolicy>)
Set permission policy
Sourcepub async fn spawn(
&self,
slot: &Slot,
options: PTYSpawnOptions,
) -> Result<PTYAgentInfo>
pub async fn spawn( &self, slot: &Slot, options: PTYSpawnOptions, ) -> Result<PTYAgentInfo>
Spawn a PTY session for a slot
Sourcepub async fn send(
&self,
slot_id: &str,
message: &str,
timeout_ms: u64,
) -> Result<PTYExecuteResult>
pub async fn send( &self, slot_id: &str, message: &str, timeout_ms: u64, ) -> Result<PTYExecuteResult>
Send message and wait for response
Sourcepub async fn subscribe_session(
&self,
slot_id: &str,
) -> Result<Receiver<SessionEvent>>
pub async fn subscribe_session( &self, slot_id: &str, ) -> Result<Receiver<SessionEvent>>
Subscribe to session events (raw data/state/exit/etc.)
Sourcepub async fn execute_task(
&self,
slot: &Slot,
task_id: &str,
prompt: &str,
) -> Result<PTYExecuteResult>
pub async fn execute_task( &self, slot: &Slot, task_id: &str, prompt: &str, ) -> Result<PTYExecuteResult>
Execute a task
Sourcepub async fn confirm(
&self,
slot_id: &str,
response: ConfirmResponse,
) -> Result<()>
pub async fn confirm( &self, slot_id: &str, response: ConfirmResponse, ) -> Result<()>
Send confirmation response
Sourcepub async fn write(&self, slot_id: &str, data: &str) -> Result<()>
pub async fn write(&self, slot_id: &str, data: &str) -> Result<()>
Write raw input to the PTY (no state checks)
Sourcepub async fn get_screen(&self, slot_id: &str) -> Result<String>
pub async fn get_screen(&self, slot_id: &str) -> Result<String>
Get screen content
Sourcepub async fn get_last_lines(
&self,
slot_id: &str,
n: usize,
) -> Result<Vec<String>>
pub async fn get_last_lines( &self, slot_id: &str, n: usize, ) -> Result<Vec<String>>
Get last N lines
Sourcepub async fn get_history(&self, slot_id: &str) -> Vec<Message>
pub async fn get_history(&self, slot_id: &str) -> Vec<Message>
Get chat history
Sourcepub async fn restart(
&self,
slot: &Slot,
options: PTYSpawnOptions,
) -> Result<PTYAgentInfo>
pub async fn restart( &self, slot: &Slot, options: PTYSpawnOptions, ) -> Result<PTYAgentInfo>
Restart a session
Sourcepub async fn get_status(&self, slot_id: &str) -> Option<PTYAgentInfo>
pub async fn get_status(&self, slot_id: &str) -> Option<PTYAgentInfo>
Get session status
Sourcepub async fn get_all_status(&self) -> Vec<PTYAgentInfo>
pub async fn get_all_status(&self) -> Vec<PTYAgentInfo>
Get all session statuses
Sourcepub async fn is_available(&self, slot_id: &str) -> bool
pub async fn is_available(&self, slot_id: &str) -> bool
Check if session is available (idle)
Sourcepub async fn is_running(&self, slot_id: &str) -> bool
pub async fn is_running(&self, slot_id: &str) -> bool
Check if session is running
Sourcepub async fn get_stats(&self) -> ManagerStats
pub async fn get_stats(&self) -> ManagerStats
Get statistics
Sourcepub fn subscribe(&self) -> Receiver<ManagerEvent>
pub fn subscribe(&self) -> Receiver<ManagerEvent>
Subscribe to manager events
Auto Trait Implementations§
impl !RefUnwindSafe for PTYManager
impl !UnwindSafe for PTYManager
impl Freeze for PTYManager
impl Send for PTYManager
impl Sync for PTYManager
impl Unpin for PTYManager
impl UnsafeUnpin for PTYManager
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
Mutably borrows from an owned value. Read more
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>
Convert
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>
Convert
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)
Convert
&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)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.