pub struct TurnOptimizationContext {
pub turn_id: Uuid,
pub processed_input: String,
pub input_context: HashMap<String, Value>,
pub staged_context_writes: HashMap<String, Value>,
pub pre_turn_lifecycle_completed: bool,
pub user_message_committed: bool,
pub post_turn_lifecycle_completed: bool,
pub redispatch_depth: u32,
pub speculative_llm_calls_used: u32,
pub max_speculative_llm_calls: u32,
}Expand description
Tracks lifecycle and staged writes for one optimized runtime turn.
Fields§
§turn_id: UuidStable ID shared by branch and maintenance work for the current turn.
processed_input: StringProcessed user input after the input pipeline.
input_context: HashMap<String, Value>Context values produced by the input process pipeline.
staged_context_writes: HashMap<String, Value>Context writes that must only commit if the selected path wins.
pre_turn_lifecycle_completed: boolWhether actor memory and relationship loading ran for this turn.
user_message_committed: boolWhether the user message has been written to memory.
post_turn_lifecycle_completed: boolWhether post-turn maintenance has been scheduled or completed.
redispatch_depth: u32Redispatch depth used to avoid repeated lifecycle work.
speculative_llm_calls_used: u32Number of speculative LLM calls used in this turn.
max_speculative_llm_calls: u32Maximum speculative LLM calls allowed in this turn.
Implementations§
Source§impl TurnOptimizationContext
impl TurnOptimizationContext
Sourcepub fn new(
processed_input: impl Into<String>,
input_context: HashMap<String, Value>,
max_speculative_llm_calls: u32,
) -> TurnOptimizationContext
pub fn new( processed_input: impl Into<String>, input_context: HashMap<String, Value>, max_speculative_llm_calls: u32, ) -> TurnOptimizationContext
Creates a new turn context with no staged writes.
Sourcepub fn reserve_speculative_llm_call(&mut self) -> bool
pub fn reserve_speculative_llm_call(&mut self) -> bool
Returns true when another speculative LLM call can be scheduled.
pub fn reserve_speculative_llm_call_for( &mut self, _kind: RuntimeOptimizationKind, ) -> bool
pub fn release_or_mark_failed_reservation( &mut self, _kind: RuntimeOptimizationKind, )
pub fn can_schedule_branch( &self, active_tasks: usize, max_parallel_tasks: usize, ) -> bool
pub fn stage_context_write(&mut self, key: impl Into<String>, value: Value)
pub fn take_staged_context_writes(&mut self) -> HashMap<String, Value>
Sourcepub fn reserve_speculative_llm_calls(&mut self, count: u32) -> bool
pub fn reserve_speculative_llm_calls(&mut self, count: u32) -> bool
Returns true when the turn can schedule the requested number of branch calls.
Sourcepub fn mark_user_message_committed(&mut self)
pub fn mark_user_message_committed(&mut self)
Marks the root user message as committed.
Sourcepub fn mark_post_turn_lifecycle_completed(&mut self)
pub fn mark_post_turn_lifecycle_completed(&mut self)
Marks post-turn lifecycle work as completed.
Sourcepub fn enter_redispatch(&mut self)
pub fn enter_redispatch(&mut self)
Enters a redispatch scope.
Sourcepub fn exit_redispatch(&mut self)
pub fn exit_redispatch(&mut self)
Leaves a redispatch scope.
Trait Implementations§
Source§impl Clone for TurnOptimizationContext
impl Clone for TurnOptimizationContext
Source§fn clone(&self) -> TurnOptimizationContext
fn clone(&self) -> TurnOptimizationContext
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for TurnOptimizationContext
impl RefUnwindSafe for TurnOptimizationContext
impl Send for TurnOptimizationContext
impl Sync for TurnOptimizationContext
impl Unpin for TurnOptimizationContext
impl UnsafeUnpin for TurnOptimizationContext
impl UnwindSafe for TurnOptimizationContext
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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