pub struct SubAgentHandle {
pub id: String,
pub def: SubAgentDef,
pub task_id: String,
pub state: SubAgentState,
pub join_handle: Option<JoinHandle<Result<String, SubAgentError>>>,
pub cancel: CancellationToken,
pub status_rx: Receiver<SubAgentStatus>,
pub grants: PermissionGrants,
pub pending_secret_rx: Receiver<SecretRequest>,
pub secret_tx: Sender<Option<String>>,
pub started_at_str: String,
pub transcript_dir: Option<PathBuf>,
}Expand description
Handle to a spawned sub-agent task, owned by SubAgentManager.
Fields are public to allow test harnesses in downstream crates to construct handles
without going through the full spawn lifecycle. Production code must not mutate
grants or the cancellation state directly — use the SubAgentManager API instead.
The Drop implementation cancels the task and revokes all grants as a safety net.
Fields§
§id: StringShort display ID (same as task_id for non-resumed sessions).
def: SubAgentDefThe definition that was used to spawn this agent.
task_id: StringUUID assigned at spawn time (currently identical to id; separated for future use).
state: SubAgentStateCached state — may lag the background task by one watch broadcast.
join_handle: Option<JoinHandle<Result<String, SubAgentError>>>Tokio join handle for the background agent loop task.
cancel: CancellationTokenCancellation token; cancelled on SubAgentManager::cancel or drop.
status_rx: Receiver<SubAgentStatus>Watch receiver for live status updates from the agent loop.
grants: PermissionGrantsZero-trust TTL-bounded grants for this agent session.
pending_secret_rx: Receiver<SecretRequest>Receives secret requests from the sub-agent loop.
secret_tx: Sender<Option<String>>Delivers approval outcome to the sub-agent loop: None = denied, Some(_) = approved.
started_at_str: StringISO 8601 UTC timestamp recorded when the agent was spawned or resumed.
transcript_dir: Option<PathBuf>Resolved transcript directory at spawn time; None if transcripts were disabled.
Trait Implementations§
Source§impl Debug for SubAgentHandle
impl Debug for SubAgentHandle
Auto Trait Implementations§
impl Freeze for SubAgentHandle
impl !RefUnwindSafe for SubAgentHandle
impl Send for SubAgentHandle
impl Sync for SubAgentHandle
impl Unpin for SubAgentHandle
impl UnsafeUnpin for SubAgentHandle
impl !UnwindSafe 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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request