pub struct HookContext<'a> {
pub run_id: RunId,
pub agent_id: &'a str,
pub session_id: &'a str,
pub turn: u32,
pub messages: &'a [Message],
pub receipts: &'a [Receipt],
pub usage: Usage,
pub run_usage: Usage,
pub untrusted_seen: bool,
pub declined: &'a [EffectKey],
}Expand description
Read-only view of the run handed to every hook.
Fields§
§run_id: RunId§agent_id: &'a str§session_id: &'a str§turn: u32§messages: &'a [Message]§receipts: &'a [Receipt]Receipts of the whole session; see HookContext::run_receipts.
usage: UsageUsage of the whole session.
run_usage: UsageUsage of the current run.
untrusted_seen: boolThe run has read untrusted content so far (see
crate::RunState::untrusted_seen).
declined: &'a [EffectKey]Effects the owner declined earlier in this run (see
crate::RunState::declined).
Implementations§
Source§impl HookContext<'_>
impl HookContext<'_>
Sourcepub fn run_receipts(&self) -> impl Iterator<Item = &Receipt>
pub fn run_receipts(&self) -> impl Iterator<Item = &Receipt>
Receipts produced by the current run only. Completion checks should use this so work from an earlier run in the session is not credited.
Trait Implementations§
Source§impl<'a> Clone for HookContext<'a>
impl<'a> Clone for HookContext<'a>
Source§fn clone(&self) -> HookContext<'a>
fn clone(&self) -> HookContext<'a>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl<'a> Copy for HookContext<'a>
Auto Trait Implementations§
impl<'a> Forget for HookContext<'a>
impl<'a> Freeze for HookContext<'a>
impl<'a> Move for HookContext<'a>
impl<'a> RefUnwindSafe for HookContext<'a>
impl<'a> Send for HookContext<'a>
impl<'a> Sync for HookContext<'a>
impl<'a> Unpin for HookContext<'a>
impl<'a> UnsafeUnpin for HookContext<'a>where
&'a str: UnsafeUnpin,
&'a [Message]: UnsafeUnpin,
&'a [Receipt]: UnsafeUnpin,
&'a [EffectKey]: UnsafeUnpin,
impl<'a> UnwindSafe for HookContext<'a>where
&'a str: UnwindSafe,
&'a [Message]: UnwindSafe,
&'a [Receipt]: UnwindSafe,
&'a [EffectKey]: UnwindSafe,
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
Mutably borrows from an owned value. Read more
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> ⓘ
Converts
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> ⓘ
Converts
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