Skip to main content

Orchestrator

Struct Orchestrator 

Source
pub struct Orchestrator { /* private fields */ }
Expand description

The runtime that answers a turn (spec §29).

Implementations§

Source§

impl Orchestrator

Source

pub fn builder() -> OrchestratorBuilder

Starts a builder.

Source

pub const fn config(&self) -> &OrchestratorConfig

The configuration in force.

Source

pub const fn stores(&self) -> &Stores

The persistence layer, for a caller that inspects what a turn wrote.

Source

pub const fn workflows(&self) -> &Arc<WorkflowRegistry> ⓘ

The workflows this runtime was built with. An evaluation reads revisions back through them; a second registry would be a second answer to «which executor owns this workflow».

Source

pub const fn recovery(&self) -> &Recovery

The crash-recovery reader (spec §23.1).

Source

pub const fn interactions(&self) -> &InteractionEngine

The interaction engine, for a caller that settles a card out of band.

Source

pub fn planner(&self) -> TurnPlanner

The same runtime with everything that writes taken away: it runs a turn’s decision pipeline and cannot persist anything. See crate::planning.

Source

pub fn seeded_planner(&self) -> SeededTurnPlanner

The same runtime planning from the state it is handed, with no persistence at all: what turns a recorded corpus into a deterministic shadow corpus.

Source

pub async fn plan_turn( &self, input: TurnInput, ) -> Result<PlannedTurn, OrchestratorError>

Runs a turn through resolution, reduction and policy, and returns before the first side effect. Shorthand for self.planner().plan(input).

§Errors

See TurnPlanner::plan.

Source

pub async fn plan_turn_from( &self, input: TurnInput, cases: Vec<SeededCase>, ) -> Result<PlannedTurn, OrchestratorError>

The same, against the cases it is handed. Shorthand for self.seeded_planner().plan(input, cases).

§Errors

See SeededTurnPlanner::plan.

Source

pub async fn handle_turn( &self, input: TurnInput, ) -> Result<AssistantTurn, OrchestratorError>

Handles one turn end to end (spec §23).

§Errors

The OrchestratorError family. The phase marker says how far the turn got, and a command that may have taken effect is in the journal.

Source

pub async fn handle_turn_streaming( &self, input: TurnInput, sink: Arc<dyn TurnSink>, ) -> Result<AssistantTurn, OrchestratorError>

Handles one turn, publishing its events through sink under the §18.5 gate: understanding’s steps as they happen, and nothing that states an outcome before the commit.

§Errors

See Self::handle_turn.

Source

pub fn stream_turn(self: Arc<Self>, input: TurnInput) -> TurnStream

Handles one turn on a background task and streams its events (spec §18.5).

Source

pub async fn plan_recovery( &self, account: &AccountId, turn_id: &TurnId, ) -> Result<RecoveryAction, OrchestratorError>

Decides what an unfinished turn needs, without acting on it (spec §23.1).

§Errors

OrchestratorError::Store when the phase marker or the journal could not be read.

Source

pub async fn resume_turn( &self, account: &AccountId, turn_id: &TurnId, ) -> Result<ResumeOutcome, OrchestratorError>

Acts on that decision, and finishes the turn where it can (spec §23.1): pending commands resume by idempotency key (I14), a committed turn regenerates only its answer, an unknown external outcome is handed back (§16.5).

§Errors

OrchestratorError::Store when the journal, the conversation or the commit could not be reached, and whatever composition returns.

Trait Implementations§

Source§

impl Debug for Orchestrator

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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