Skip to main content

DriverOrchestrator

Struct DriverOrchestrator 

Source
pub struct DriverOrchestrator { /* private fields */ }

Implementations§

Source§

impl DriverOrchestrator

Source

pub fn builder() -> DriverOrchestratorBuilder

Source

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.

Source

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.

Source

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.

Source

pub fn has_auto_dream(&self) -> bool

true when at least one auto_dream runner is registered.

Source

pub 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

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.

Source

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.

Source

pub fn resume_goal(&self, goal_id: GoalId) -> bool

Release a paused goal’s loop. Idempotent.

Source

pub fn is_paused(&self, goal_id: GoalId) -> bool

True if the goal is currently paused. False if it’s running or unknown.

Source

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).

Source

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.

Source

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.

Source

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).

Source

pub fn is_cancelled(&self, goal_id: GoalId) -> bool

True iff the per-goal token has been cancelled.

Source

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.

Source

pub async fn run_goal(&self, goal: Goal) -> Result<GoalOutcome, DriverError>

Drive a single goal to completion. Long-running.

Source

pub async fn shutdown(self) -> Result<(), DriverError>

Cancel every in-flight goal + drain socket server.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more