pub struct HookInput {Show 21 fields
pub hook_event_name: String,
pub session_id: String,
pub cwd: String,
pub permission_mode: String,
pub depth: u32,
pub tool_name: Option<String>,
pub tool_input: Option<Value>,
pub tool_use_id: Option<String>,
pub tool_result: Option<Value>,
pub is_error: Option<bool>,
pub user_prompt: Option<String>,
pub delivery: Option<String>,
pub turn_id: Option<String>,
pub stop_reason: Option<String>,
pub agent_type: Option<String>,
pub reason: Option<String>,
pub source: Option<String>,
pub stop_hook_active: Option<bool>,
pub team_name: Option<String>,
pub teammate_name: Option<String>,
pub spend: Option<Arc<SpendNode>>,
}Expand description
What a hook is sent. Which optional fields are set depends on the event.
Fields§
§hook_event_name: String§session_id: String§cwd: String§permission_mode: String§depth: u32How many delegations deep the session is; 0 for the root.
tool_name: Option<String>§tool_input: Option<Value>§tool_use_id: Option<String>§tool_result: Option<Value>§is_error: Option<bool>§user_prompt: Option<String>§delivery: Option<String>"turn" opens a turn, "steer" joins the running one.
turn_id: Option<String>§stop_reason: Option<String>§agent_type: Option<String>§reason: Option<String>§source: Option<String>§stop_hook_active: Option<bool>§team_name: Option<String>§teammate_name: Option<String>§spend: Option<Arc<SpendNode>>The turn a hook that calls a model spends into. Never sent to a hook.
Implementations§
Source§impl HookInput
impl HookInput
Sourcepub fn lifecycle(
event: impl Into<String>,
session_id: impl Into<String>,
cwd: impl Into<String>,
permission_mode: impl Into<String>,
) -> Self
pub fn lifecycle( event: impl Into<String>, session_id: impl Into<String>, cwd: impl Into<String>, permission_mode: impl Into<String>, ) -> Self
The payload of event; callers set what their event carries on top.
pub fn with_depth(self, depth: u32) -> Self
pub fn with_turn_id(self, turn_id: impl Into<String>) -> Self
pub fn with_stop_reason(self, reason: impl Into<String>) -> Self
pub fn with_agent_type(self, agent_type: Option<String>) -> Self
pub fn with_tool(self, name: impl Into<String>, input: Value) -> Self
pub fn with_reason(self, reason: impl Into<String>) -> Self
pub fn with_source(self, source: impl Into<String>) -> Self
pub fn spending_into(self, spend: Option<Arc<SpendNode>>) -> Self
pub fn with_team( self, team_name: impl Into<String>, teammate_name: impl Into<String>, ) -> Self
Sourcepub fn from_ambient(ambient: &HookAmbient, event: impl Into<String>) -> Self
pub fn from_ambient(ambient: &HookAmbient, event: impl Into<String>) -> Self
ambient’s session, cwd, permission mode, depth and spend under
event.
Sourcepub fn lifecycle_of(base: HookInput, event: impl Into<String>) -> Self
pub fn lifecycle_of(base: HookInput, event: impl Into<String>) -> Self
base’s session, cwd, permission mode, depth and spend under event.
Trait Implementations§
Auto Trait Implementations§
impl Forget for HookInput
impl Freeze for HookInputwhere
*const u8 is !null: Freeze,
PhantomData<u8>: Freeze,
PhantomData<Value>: Freeze,
*const LeafNode<String, Value> is !null: Freeze,
PhantomData<(Owned, LeafOrInternal)>: Freeze,
PhantomData<Box<(String, Value)>>: Freeze,
*const ArcInner<SpendNode> is !null: Freeze,
PhantomData<ArcInner<SpendNode>>: Freeze,
impl Move for HookInput
impl RefUnwindSafe for HookInput
impl Send for HookInput
impl Sync for HookInput
impl Unpin for HookInput
impl UnsafeUnpin for HookInputwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
PhantomData<Value>: UnsafeUnpin,
*const LeafNode<String, Value> is !null: UnsafeUnpin,
PhantomData<(Owned, LeafOrInternal)>: UnsafeUnpin,
PhantomData<Box<(String, Value)>>: UnsafeUnpin,
*const ArcInner<SpendNode> is !null: UnsafeUnpin,
PhantomData<ArcInner<SpendNode>>: UnsafeUnpin,
impl UnwindSafe for HookInput
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