pub struct HookSet { /* private fields */ }Expand description
The validated hook set for one process. Empty is the common case and free.
Implementations§
Source§impl HookSet
impl HookSet
Sourcepub fn from_config(configs: &[HookConfig]) -> Result<Self>
pub fn from_config(configs: &[HookConfig]) -> Result<Self>
Validate config into a runnable set. Unknown events and empty commands are startup errors: a hook that can never fire is a typo, and finding out at startup beats finding out during an incident.
pub fn is_empty(&self) -> bool
Sourcepub fn watches_tools(&self) -> bool
pub fn watches_tools(&self) -> bool
True when any pre_tool or post_tool hook exists — lets the dispatch
path skip payload construction entirely in the common empty case.
Sourcepub async fn pre_tool(
&self,
tool: &str,
input: &Value,
workdir: &Path,
) -> HookVerdict
pub async fn pre_tool( &self, tool: &str, input: &Value, workdir: &Path, ) -> HookVerdict
Run the matching pre_tool hooks in order. First denial wins.
Sourcepub async fn post_tool(
&self,
tool: &str,
input: &Value,
is_error: bool,
content: &str,
workdir: &Path,
)
pub async fn post_tool( &self, tool: &str, input: &Value, is_error: bool, content: &str, workdir: &Path, )
Notify post_tool observers. Best-effort by design.
Sourcepub async fn session_end(&self, session_id: &str, path: &Path, workdir: &Path)
pub async fn session_end(&self, session_id: &str, path: &Path, workdir: &Path)
Notify session_end observers. Best-effort by design.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for HookSet
impl RefUnwindSafe for HookSet
impl Send for HookSet
impl Sync for HookSet
impl Unpin for HookSet
impl UnsafeUnpin for HookSet
impl UnwindSafe for HookSet
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