pub struct TurnContext(/* private fields */);Expand description
The relay and runtime share this small process-local evidence accumulator.
Implementations§
Source§impl TurnContext
impl TurnContext
Sourcepub fn mark_parent_activity(&self)
pub fn mark_parent_activity(&self)
Process-local parent clock; child traffic and inventory updates never mark it.
Sourcepub fn mark_parent_activity_at(&self, at: Instant)
pub fn mark_parent_activity_at(&self, at: Instant)
Record the monotonic time at which parent activity was observed.
pub fn parent_activity(&self) -> Option<Instant>
pub fn set_decision_log(&self, log: DecisionLog)
pub fn decision_log(&self) -> Option<DecisionLog>
Sourcepub fn reset(&self, command_id: Option<&str>, prompt: &str)
pub fn reset(&self, command_id: Option<&str>, prompt: &str)
Start a turn. user_prompt_tail carries the prompt only when the
person wrote it: a prompt Mjolnir submitted (a mailbox wake, a child
report, a continuation, a parent’s message to a child) is not the
person’s latest request, and Jev scored those turns better without it
(.agents/docs/jev-still-open-20261106.md).
Sourcepub fn observe_prompt_delivery(
&self,
command_id: Option<&str>,
prompt: Option<&str>,
)
pub fn observe_prompt_delivery( &self, command_id: Option<&str>, prompt: Option<&str>, )
A known prompt delivery whose body may no longer be retained.
Sourcepub fn observe_autonomous_turn_start(&self)
pub fn observe_autonomous_turn_start(&self)
Begin a turn the relay owner has identified as autonomous.
Sourcepub fn observe_relay(
&self,
observation: &RelayObservation,
prompt: Option<&str>,
)
pub fn observe_relay( &self, observation: &RelayObservation, prompt: Option<&str>, )
Record durable transcript observations through the same path during live work and replay.
Sourcepub fn invalidate(&self)
pub fn invalidate(&self)
Invalidate a pending verdict at a lifecycle boundary without discarding evidence.
pub fn generation(&self) -> u64
pub fn counts(&self) -> (usize, usize)
pub fn set_counts(&self, background_commands: usize, queued_commands: usize)
pub fn set_session_id(&self, session_id: &str)
pub fn session_id(&self) -> String
Publish the relay owner’s durable user-instruction history to the ACP classifier. A change invalidates any request built from older context.
Sourcepub fn restore_user_prompt_tail(&self, history: &ContextHistory)
pub fn restore_user_prompt_tail(&self, history: &ContextHistory)
Restore the latest human instructions without changing replayed reply boundaries.
Sourcepub fn set_background_inventory(
&self,
commands: Vec<BackgroundCommand>,
native_agent_ids: Vec<String>,
)
pub fn set_background_inventory( &self, commands: Vec<BackgroundCommand>, native_agent_ids: Vec<String>, )
Compare identities as well as counts; identical level reports are not activity.
pub fn observe(&self, update: &SessionUpdate)
pub fn observe_terminal(&self, record: &TerminalOutputRecord)
Sourcepub fn render_transcript(&self, limit: usize) -> String
pub fn render_transcript(&self, limit: usize) -> String
The retained transcript as the guardian reviewer reads it: recent
context first, within limit bytes.
pub fn set_delegated_parent_instructions(&self, snapshot: &RelaySnapshot)
pub fn delegated_parent_instructions( &self, ) -> (Vec<DelegatedParentInstruction>, bool)
pub fn set_trusted_user_inputs(&self, durable: Vec<TrustedUserInput>)
Sourcepub fn record_pending_trusted_user_input(
&self,
elicitation_id: &str,
input: TrustedUserInput,
publish: impl FnOnce(),
)
pub fn record_pending_trusted_user_input( &self, elicitation_id: &str, input: TrustedUserInput, publish: impl FnOnce(), )
Record the answer and enqueue its echo in the same order. The callback must only publish into a channel slot already reserved.
pub fn sync_trusted_user_inputs(&self, durable: Vec<TrustedUserInput>)
pub fn trusted_user_inputs(&self) -> Vec<TrustedUserInput>
pub fn record_prior_guardian_review(&self, review: PriorGuardianReview)
pub fn prior_guardian_reviews(&self) -> Vec<PriorGuardianReview>
pub fn set_prior_guardian_reviews(&self, durable: Vec<PriorGuardianReview>)
pub fn sync_prior_guardian_reviews(&self, durable: Vec<PriorGuardianReview>)
pub fn clear_prior_guardian_reviews(&self)
Sourcepub fn guardian_tripped(&self) -> bool
pub fn guardian_tripped(&self) -> bool
Whether the guardian’s denials tripped the breaker in this request, so its remaining approvals go to the person.
Sourcepub fn record_guardian_review(&self, denied: bool) -> bool
pub fn record_guardian_review(&self, denied: bool) -> bool
Record one completed guardian review in this request. Returns whether this denial tripped the breaker.