pub struct SubagentHandle {
pub id: String,
pub subagent_id: u64,
pub agent_name: String,
pub task_preview: String,
pub model: String,
pub system_prompt: String,
pub started_at: Instant,
pub timeout_secs: u64,
pub authorization: Option<AuthorizationDiagnostic>,
/* private fields */
}Fields§
§id: String§subagent_id: u64Numeric ID — same value that was passed to SubagentStart/SubagentDone events so the TUI can correlate by id without parsing “sa_N” strings.
agent_name: String§task_preview: String§model: String§system_prompt: String§started_at: Instant§timeout_secs: u64Implementations§
Source§impl SubagentHandle
impl SubagentHandle
Sourcepub fn new(
id: String,
subagent_id: u64,
agent_name: String,
task_preview: String,
model: String,
system_prompt: String,
timeout_secs: u64,
state: Arc<RwLock<SubagentState>>,
steer_tx: Option<UnboundedSender<String>>,
shutdown_tx: Option<Sender<()>>,
result_rx: Option<Receiver<SubagentResult>>,
) -> Self
pub fn new( id: String, subagent_id: u64, agent_name: String, task_preview: String, model: String, system_prompt: String, timeout_secs: u64, state: Arc<RwLock<SubagentState>>, steer_tx: Option<UnboundedSender<String>>, shutdown_tx: Option<Sender<()>>, result_rx: Option<Receiver<SubagentResult>>, ) -> Self
Construct a new handle. The state Arc is shared with the spawned subagent thread.
pub fn set_terminal_diagnostic(&self, diagnostic: TerminalDiagnostic)
Sourcepub fn status(&self) -> SubagentStatus
pub fn status(&self) -> SubagentStatus
Current status snapshot.
Sourcepub fn partial_output(&self) -> String
pub fn partial_output(&self) -> String
Partial output accumulated so far.
pub fn terminal_diagnostic(&self) -> Option<TerminalDiagnostic>
Sourcepub fn conversation_state(&self) -> Vec<Value>
pub fn conversation_state(&self) -> Vec<Value>
Snapshot of conversation state (for resume).
Sourcepub fn elapsed_secs(&self) -> f64
pub fn elapsed_secs(&self) -> f64
Seconds since this handle was created.
Sourcepub fn steer(&self, message: &str) -> Result<(), String>
pub fn steer(&self, message: &str) -> Result<(), String>
Send a steering message into the running subagent.
Sourcepub fn set_thread_handle(&mut self, handle: JoinHandle<()>)
pub fn set_thread_handle(&mut self, handle: JoinHandle<()>)
Signal the subagent to shut down. Store the OS thread handle for graceful shutdown.
pub fn cancel(&mut self)
Sourcepub fn is_finished(&self) -> bool
pub fn is_finished(&self) -> bool
True if the subagent is no longer running.
Sourcepub fn mark_collected(&mut self)
pub fn mark_collected(&mut self)
Mark this handle as collected by subagent_collect.
Sourcepub fn is_collected(&self) -> bool
pub fn is_collected(&self) -> bool
Whether subagent_collect has already read the result.
Sourcepub fn is_tombstone(&self) -> bool
pub fn is_tombstone(&self) -> bool
Whether execution transports and resumable context have been discarded.
Sourcepub fn finished_elapsed(&self) -> Option<Duration>
pub fn finished_elapsed(&self) -> Option<Duration>
Time elapsed since the subagent reached a terminal state.
Returns None if still running or if finished_at has not been stamped yet.
Sourcepub async fn collect(self) -> Result<SubagentResult, String>
pub async fn collect(self) -> Result<SubagentResult, String>
Consume the handle and wait for the final result.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for SubagentHandle
impl !UnwindSafe for SubagentHandle
impl Freeze for SubagentHandle
impl Send for SubagentHandle
impl Sync for SubagentHandle
impl Unpin for SubagentHandle
impl UnsafeUnpin for SubagentHandle
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.