Skip to main content

HookInput

Struct HookInput 

Source
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: u32

How 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

Source

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.

Source

pub fn with_depth(self, depth: u32) -> Self

Source

pub fn with_turn_id(self, turn_id: impl Into<String>) -> Self

Source

pub fn with_stop_reason(self, reason: impl Into<String>) -> Self

Source

pub fn with_agent_type(self, agent_type: Option<String>) -> Self

Source

pub fn with_tool(self, name: impl Into<String>, input: Value) -> Self

Source

pub fn with_reason(self, reason: impl Into<String>) -> Self

Source

pub fn with_source(self, source: impl Into<String>) -> Self

Source

pub fn spending_into(self, spend: Option<Arc<SpendNode>>) -> Self

Source

pub fn with_team( self, team_name: impl Into<String>, teammate_name: impl Into<String>, ) -> Self

Source

pub fn from_ambient(ambient: &HookAmbient, event: impl Into<String>) -> Self

ambient’s session, cwd, permission mode, depth and spend under event.

Source

pub fn lifecycle_of(base: HookInput, event: impl Into<String>) -> Self

base’s session, cwd, permission mode, depth and spend under event.

Trait Implementations§

Source§

impl Clone for HookInput

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for HookInput

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for HookInput

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Serialize for HookInput

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl Forget for HookInput

§

impl Freeze for HookInput
where *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
where RawVecInner: Send, NodeRef<Owned, String, Value, LeafOrInternal>: Send, BoxRaw<(String, Value)>: Send, Arc<SpendNode>: Send,

§

impl Sync for HookInput
where RawVecInner: Sync, NodeRef<Owned, String, Value, LeafOrInternal>: Sync, BoxRaw<(String, Value)>: Sync, Arc<SpendNode>: Sync,

§

impl Unpin for HookInput
where *const u8 is !null: Unpin, *const LeafNode<String, Value> is !null: Unpin, Box<(String, Value)>: Unpin, Arc<SpendNode>: Unpin,

§

impl UnsafeUnpin for HookInput

§

impl UnwindSafe for HookInput

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more