pub struct AgentOrchestrator { /* private fields */ }Expand description
Orchestrator for running agents via OpenCode Server
Implementations§
Source§impl AgentOrchestrator
impl AgentOrchestrator
Sourcepub async fn new(event_tx: Sender<AgentEvent>) -> Result<Self>
pub async fn new(event_tx: Sender<AgentEvent>) -> Result<Self>
Create a new orchestrator
Sourcepub fn with_manager(
manager: Arc<OpenCodeManager>,
event_tx: Sender<AgentEvent>,
) -> Self
pub fn with_manager( manager: Arc<OpenCodeManager>, event_tx: Sender<AgentEvent>, ) -> Self
Create with a custom manager (for testing)
Sourcepub async fn spawn_agent(
&mut self,
task: &Task,
tag: &str,
prompt: &str,
model: Option<(&str, &str)>,
) -> Result<AgentHandle>
pub async fn spawn_agent( &mut self, task: &Task, tag: &str, prompt: &str, model: Option<(&str, &str)>, ) -> Result<AgentHandle>
Spawn an agent for a task
Sourcepub async fn cancel_agent(&mut self, task_id: &str) -> Result<()>
pub async fn cancel_agent(&mut self, task_id: &str) -> Result<()>
Cancel a running agent
Sourcepub fn active_tasks(&self) -> Vec<String>
pub fn active_tasks(&self) -> Vec<String>
Get all active task IDs
Sourcepub fn is_task_active(&self, task_id: &str) -> bool
pub fn is_task_active(&self, task_id: &str) -> bool
Check if a task has an active session
Sourcepub fn active_count(&self) -> usize
pub fn active_count(&self) -> usize
Get the number of active sessions
Sourcepub async fn process_event(
&mut self,
event: OpenCodeEvent,
) -> Option<AgentEvent>
pub async fn process_event( &mut self, event: OpenCodeEvent, ) -> Option<AgentEvent>
Process an OpenCode event and emit corresponding AgentEvent
Sourcepub async fn wait_all(&mut self) -> Vec<AgentResult>
pub async fn wait_all(&mut self) -> Vec<AgentResult>
Wait for all agents to complete
Auto Trait Implementations§
impl Freeze for AgentOrchestrator
impl !RefUnwindSafe for AgentOrchestrator
impl Send for AgentOrchestrator
impl Sync for AgentOrchestrator
impl Unpin for AgentOrchestrator
impl !UnwindSafe for AgentOrchestrator
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> 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>
Converts
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>
Converts
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 more