pub struct DriverOrchestrator { /* private fields */ }Implementations§
Source§impl DriverOrchestrator
impl DriverOrchestrator
pub fn builder() -> DriverOrchestratorBuilder
Sourcepub fn register_auto_dream(
&self,
agent_id: String,
hook: Arc<dyn AutoDreamHook>,
) -> Option<Arc<dyn AutoDreamHook>>
pub fn register_auto_dream( &self, agent_id: String, hook: Arc<dyn AutoDreamHook>, ) -> Option<Arc<dyn AutoDreamHook>>
Register a runner for agent_id.
Returns the previous runner under that key (if any) so
callers can take ownership of the displaced hook for
cleanup. Atomic + thread-safe: subsequent run_turn calls
for goals with that agent_id observe the new value on
their next mutex acquire.
Sourcepub fn unregister_auto_dream(
&self,
agent_id: &str,
) -> Option<Arc<dyn AutoDreamHook>>
pub fn unregister_auto_dream( &self, agent_id: &str, ) -> Option<Arc<dyn AutoDreamHook>>
Atomically remove the runner for agent_id. Returns the
removed hook if one was registered.
Sourcepub fn auto_dream_agents(&self) -> Vec<String>
pub fn auto_dream_agents(&self) -> Vec<String>
Sorted list of agent ids that currently have a runner registered. Used by tests + admin-ui observability; the sort makes assertions stable.
Sourcepub fn has_auto_dream(&self) -> bool
pub fn has_auto_dream(&self) -> bool
true when at least one auto_dream runner is registered.
Sourcepub fn set_auto_dream(&self, hook: Option<Arc<dyn AutoDreamHook>>)
👎Deprecated since 0.1.2: use register_auto_dream(agent_id, hook) for multi-runner routing
pub fn set_auto_dream(&self, hook: Option<Arc<dyn AutoDreamHook>>)
use register_auto_dream(agent_id, hook) for multi-runner routing
Compat shim. New code should call
register_auto_dream(agent_id, hook)
for multi-runner routing. Some(hook) registers under the
sentinel "_default" key; None clears every registered
runner. Emits a deprecation warn once per process.
Sourcepub fn pause_goal(&self, goal_id: GoalId) -> bool
pub fn pause_goal(&self, goal_id: GoalId) -> bool
Request the goal’s loop to hold before its next turn. Idempotent. No-op when the goal isn’t running.
Sourcepub fn resume_goal(&self, goal_id: GoalId) -> bool
pub fn resume_goal(&self, goal_id: GoalId) -> bool
Release a paused goal’s loop. Idempotent.
Sourcepub fn is_paused(&self, goal_id: GoalId) -> bool
pub fn is_paused(&self, goal_id: GoalId) -> bool
True if the goal is currently paused. False if it’s running or unknown.
Sourcepub fn set_goal_max_turns(&self, goal_id: GoalId, new_max: u32) -> Option<u32>
pub fn set_goal_max_turns(&self, goal_id: GoalId, new_max: u32) -> Option<u32>
Install or grow the budget override for a running goal.
max_turns only goes up (caller is expected to
guard against shrink-below-used). Returns the effective
max_turns after merge with the prior override (if any).
Sourcepub fn interrupt_goal(
&self,
goal_id: GoalId,
message: impl Into<String>,
) -> usize
pub fn interrupt_goal( &self, goal_id: GoalId, message: impl Into<String>, ) -> usize
Operator-interrupt — push a free-form message that the next turn’s prompt will see prepended as a “[OPERATOR INTERRUPT]” block. Use this when you want to redirect Claude mid-run without cancelling the goal. Multiple queued interrupts are concatenated in FIFO order. Returns the queue depth after the push.
Sourcepub fn pre_register_goal(&self, goal_id: GoalId)
pub fn pre_register_goal(&self, goal_id: GoalId)
Pre-register the per-goal cancel + pause tokens for a goal
that’s being reattached after daemon restart but whose
run_goal hasn’t started yet. Lets cancel_agent /
pause_agent target the goal in the gap between reattach
and the actual respawn. The tokens are removed when the
real run_goal exits, same as for fresh dispatches.
Idempotent — re-registering returns the existing tokens.
Sourcepub fn cancel_goal(&self, goal_id: GoalId) -> bool
pub fn cancel_goal(&self, goal_id: GoalId) -> bool
Cancel a single in-flight goal. Idempotent.
Returns true when a goal was found and signalled. The
underlying run_goal loop will exit at the next safe point
(between turns, or when the active turn’s
CancellationToken propagates into the Claude subprocess).
Sourcepub fn is_cancelled(&self, goal_id: GoalId) -> bool
pub fn is_cancelled(&self, goal_id: GoalId) -> bool
True iff the per-goal token has been cancelled.
Sourcepub fn spawn_goal(
self: Arc<Self>,
goal: Goal,
) -> JoinHandle<Result<GoalOutcome, DriverError>>
pub fn spawn_goal( self: Arc<Self>, goal: Goal, ) -> JoinHandle<Result<GoalOutcome, DriverError>>
Fire-and-forget spawn. Returns the
tokio::task::JoinHandle so the caller (typically the
program_phase tool) can register the goal in the agent
registry without waiting for completion. The orchestrator is
reference-counted (Arc<Self>); long-running goals don’t
pin a single owner.
Sourcepub async fn run_goal(&self, goal: Goal) -> Result<GoalOutcome, DriverError>
pub async fn run_goal(&self, goal: Goal) -> Result<GoalOutcome, DriverError>
Drive a single goal to completion. Long-running.
Sourcepub async fn shutdown(self) -> Result<(), DriverError>
pub async fn shutdown(self) -> Result<(), DriverError>
Cancel every in-flight goal + drain socket server.
Auto Trait Implementations§
impl !Freeze for DriverOrchestrator
impl !RefUnwindSafe for DriverOrchestrator
impl Send for DriverOrchestrator
impl Sync for DriverOrchestrator
impl Unpin for DriverOrchestrator
impl UnsafeUnpin for DriverOrchestrator
impl !UnwindSafe for DriverOrchestrator
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 more