pub struct BeforeTurnEnd {
pub stop_reason: StopReason,
pub continues_so_far: u32,
pub voluntary: bool,
pub feedback: Vec<ContentBlock>,
}Expand description
before turn-end: the turn’s only voluntary exit point. Defaults to Break — “do
nothing” = let it stop.
A hook returning HookControl::Continue extends the turn: it injects
Self::feedback into history (appended as a user message when committed), does not
end the turn, and loops back to the top for another round. Continue only takes
effect when Self::voluntary is true — involuntary stops (Refusal / MaxTokens /
Cancelled / MaxTurnRequests) ignore it; otherwise the hook could bypass the request
cap and extend indefinitely.
Fields§
§stop_reason: StopReasonThe reason this turn stopped.
continues_so_far: u32How many times this turn has been extended by a hook (the hook decides when to stop; a hard cap in the loop provides a safety net).
voluntary: boolWhether the stop is voluntary (LLM said EndTurn or returned empty tool_use).
Continue only takes effect when voluntary.
feedback: Vec<ContentBlock>Feedback to inject into history when continuing the turn. apply_verdict fills
this from the verdict’s additional_context; internal Rust hooks push directly.
On finalization, the loop appends it as a user message.
Trait Implementations§
Source§impl Clone for BeforeTurnEnd
impl Clone for BeforeTurnEnd
Source§fn clone(&self) -> BeforeTurnEnd
fn clone(&self) -> BeforeTurnEnd
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for BeforeTurnEnd
impl Debug for BeforeTurnEnd
Source§impl HookStep for BeforeTurnEnd
impl HookStep for BeforeTurnEnd
Source§fn event_name(&self) -> &'static str
fn event_name(&self) -> &'static str
Source§fn to_envelope(&self) -> Value
fn to_envelope(&self) -> Value
Source§fn apply_verdict(
&mut self,
verdict: &Value,
) -> Result<HookControl, VerdictError>
fn apply_verdict( &mut self, verdict: &Value, ) -> Result<HookControl, VerdictError>
control / additional_context fields, then handle the step-specific “fill
output” fields. Returns a control directive. Read more