Documentation Index
Fetch the complete documentation index at: https://docs.praison.ai/llms.txt
Use this file to discover all available pages before exploring further.
HookDefinition
Defined in the hooks module.
Rust AI Agent SDK
Hook definition
Fields
| Name | Type | Description |
|---|
id | String | Unique ID |
event | HookEvent | Event to hook |
matcher | Option<String> | Optional matcher pattern (regex for tool names, etc.) |
func | HookFn | Hook function |
enabled | bool | Whether hook is enabled |
name | Option<String> | Hook name (for debugging) |
Methods
new
fn new(
event: HookEvent,
func: impl Fn(&HookInput) -> HookResult + Send + Sync + 'static,
) -> Self
Create a new hook definition
Parameters:
| Name | Type |
|---|
event | HookEvent |
func | impl Fn(&HookInput |
with_matcher
fn with_matcher(mut self, pattern: impl Into<String>) -> Self
Set matcher pattern
Parameters:
| Name | Type |
|---|
pattern | impl Into<String> |
with_name
fn with_name(mut self, name: impl Into<String>) -> Self
Set name
Parameters:
| Name | Type |
|---|
name | impl Into<String> |
matches
fn matches(&self, target: &str) -> bool
Check if this hook matches the target
Parameters:
execute
fn execute(&self, input: &HookInput) -> HookResult
Execute the hook
Parameters:
Source
View on GitHub
praisonai/src/hooks/mod.rs at line 285