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>
impl<'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