pub struct SubagentWatcher {
event_bus: Arc<EventBus>,
sessions: Mutex<HashMap<String, SessionWatch>>,
watched_agents: Mutex<Vec<WatchedAgent>>,
}Fields§
§event_bus: Arc<EventBus>§sessions: Mutex<HashMap<String, SessionWatch>>§watched_agents: Mutex<Vec<WatchedAgent>>Implementations§
Source§impl SubagentWatcher
impl SubagentWatcher
pub fn new(event_bus: Arc<EventBus>) -> Self
Sourcepub fn spawn(event_bus: Arc<EventBus>) -> Arc<Self>
pub fn spawn(event_bus: Arc<EventBus>) -> Arc<Self>
Create a new SubagentWatcher and return it wrapped in Arc.
Sourcepub fn watch_agent(self: &Arc<Self>, agent_id: &str, config_dir: PathBuf)
pub fn watch_agent(self: &Arc<Self>, agent_id: &str, config_dir: PathBuf)
Start watching a Claude Code agent’s session directory for subagent files. Spawns a background tokio task for debounced file event processing.
Sourcepub fn list_active(&self) -> Vec<SubagentInfo>
pub fn list_active(&self) -> Vec<SubagentInfo>
List all subagents across all sessions (sync — safe to call from RPC dispatch).
Sourcepub fn get_history(&self, agent_id: &str, limit: usize) -> Vec<SubagentEvent>
pub fn get_history(&self, agent_id: &str, limit: usize) -> Vec<SubagentEvent>
Get recent events for a specific subagent (sync — safe to call from RPC dispatch).
Sourcefn scan_existing_subagents(&self, parent_agent: &str, projects_dir: &Path)
fn scan_existing_subagents(&self, parent_agent: &str, projects_dir: &Path)
Scan for existing subagent JSONL files in a projects directory.
Sourcefn process_jsonl_change(&self, parent_agent: &str, jsonl_path: &Path)
fn process_jsonl_change(&self, parent_agent: &str, jsonl_path: &Path)
Process a changed/new JSONL subagent file. Reads new lines, updates state, and broadcasts events via EventBus.
Auto Trait Implementations§
impl !Freeze for SubagentWatcher
impl RefUnwindSafe for SubagentWatcher
impl Send for SubagentWatcher
impl Sync for SubagentWatcher
impl Unpin for SubagentWatcher
impl UnwindSafe for SubagentWatcher
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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§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.§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.§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.§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.