pub struct Orchestrator { /* private fields */ }Expand description
The runtime that answers a turn (spec §29).
Implementations§
Source§impl Orchestrator
impl Orchestrator
Sourcepub fn builder() -> OrchestratorBuilder
pub fn builder() -> OrchestratorBuilder
Starts a builder.
Sourcepub const fn config(&self) -> &OrchestratorConfig
pub const fn config(&self) -> &OrchestratorConfig
The configuration in force.
Sourcepub const fn stores(&self) -> &Stores
pub const fn stores(&self) -> &Stores
The persistence layer, for a caller that inspects what a turn wrote.
Sourcepub const fn workflows(&self) -> &Arc<WorkflowRegistry> ⓘ
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».
Sourcepub const fn interactions(&self) -> &InteractionEngine
pub const fn interactions(&self) -> &InteractionEngine
The interaction engine, for a caller that settles a card out of band.
Sourcepub fn planner(&self) -> TurnPlanner
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.
Sourcepub fn seeded_planner(&self) -> SeededTurnPlanner
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.
Sourcepub async fn plan_turn(
&self,
input: TurnInput,
) -> Result<PlannedTurn, OrchestratorError>
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.
Sourcepub async fn plan_turn_from(
&self,
input: TurnInput,
cases: Vec<SeededCase>,
) -> Result<PlannedTurn, OrchestratorError>
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
Sourcepub async fn handle_turn(
&self,
input: TurnInput,
) -> Result<AssistantTurn, OrchestratorError>
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.
Sourcepub async fn handle_turn_streaming(
&self,
input: TurnInput,
sink: Arc<dyn TurnSink>,
) -> Result<AssistantTurn, OrchestratorError>
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.
Sourcepub fn stream_turn(self: Arc<Self>, input: TurnInput) -> TurnStream
pub fn stream_turn(self: Arc<Self>, input: TurnInput) -> TurnStream
Handles one turn on a background task and streams its events (spec §18.5).
Sourcepub async fn plan_recovery(
&self,
account: &AccountId,
turn_id: &TurnId,
) -> Result<RecoveryAction, OrchestratorError>
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.
Sourcepub async fn resume_turn(
&self,
account: &AccountId,
turn_id: &TurnId,
) -> Result<ResumeOutcome, OrchestratorError>
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.