pub struct RoundContext<'a> { /* private fields */ }Expand description
The per-turn steering seam, whole: the trait a host implements and every type its signatures make that host name.
Re-exported rather than wrapped, under the rule stated on
CancellationToken — a mentra type basis’s surface asks a caller to
write is a name basis re-exports, or the caller pins mentra in their own
manifest to spell it. And like the token, a strategy is an identity
rather than a value: TurnOptions::with_round_strategy hands mentra the
caller’s own Arc, so a basis-owned mirror of RoundDecision would be a
translation layer with opinions of its own — the opposite of a seam.
The set is exactly what implementing costs. RoundStrategy is the trait
(spelled with async_trait, which basis already
re-exports); RoundContext and RoundBoundary are its question;
RoundDecision, RoundAdjustment, ReasoningChange and
RoundToolResult are its vocabulary for answering. The last three are
here because the vocabulary’s own signatures demand them:
RoundDecision::inject takes ContentBlocks,
RoundAdjustment::with_model a ModelInfo, and
ReasoningChange::Set a ReasoningOptions — whose effort field an
Effort converts into, so switching effort mid-run never names mentra’s
own level enum.
Read-only view of a round boundary handed to a RoundStrategy.
Implementations§
Source§impl<'a> RoundContext<'a>
impl<'a> RoundContext<'a>
Sourcepub fn boundary(&self) -> RoundBoundary
pub fn boundary(&self) -> RoundBoundary
Which boundary invoked the strategy.
Sourcepub fn assistant_message(&self) -> Option<&Message>
pub fn assistant_message(&self) -> Option<&Message>
The assistant message just committed. Present only at
RoundBoundary::AssistantMessageCommitted, and absent even there if the
terminal turn carried no content.
Sourcepub fn tool_results(&self) -> &[RoundToolResult]
pub fn tool_results(&self) -> &[RoundToolResult]
Summaries of the tool results just committed. Present only at
RoundBoundary::ToolResultsCommitted; empty otherwise.
Sourcepub fn rounds_completed(&self) -> usize
pub fn rounds_completed(&self) -> usize
The number of rounds the run has entered so far, including this one.
Sourcepub fn model_requests(&self) -> usize
pub fn model_requests(&self) -> usize
The number of provider requests the run has issued so far, including transient transport retries. This mirrors mentra’s request counter, which is not a pure logical-round counter.
Sourcepub fn transport_retries(&self) -> usize
pub fn transport_retries(&self) -> usize
The number of transient transport-connection retries the run has made so
far — the subset of model_requests that were
not the round’s successful attempt. Kept distinct from
rounds_completed, which counts only completed
logical rounds: a round that needed retries before its connection opened
still counts as exactly one completed round.