pub struct HookRunner { /* private fields */ }Expand description
Runs registered hooks at a given hook point.
Implementations§
Source§impl HookRunner
impl HookRunner
pub fn new() -> Self
Sourcepub fn register(&mut self, hook: Arc<dyn AgentHook>)
pub fn register(&mut self, hook: Arc<dyn AgentHook>)
Register a hook. Hooks are sorted by priority (lower runs first).
Sourcepub fn with_lifecycle_config(
&self,
config: &LifecycleHooksConfig,
fallback_cwd: Option<PathBuf>,
) -> Self
pub fn with_lifecycle_config( &self, config: &LifecycleHooksConfig, fallback_cwd: Option<PathBuf>, ) -> Self
Clone this registry and append shell hooks from one frozen config snapshot. The original registry remains reusable by future runs.
Sourcepub async fn run_hooks(
&self,
point: AgentHookPoint,
payload: &HookPayload,
session: &Session,
runtime_state: &mut AgentRuntimeState,
event_tx: Option<&Sender<AgentEvent>>,
) -> HookRunOutcome
pub async fn run_hooks( &self, point: AgentHookPoint, payload: &HookPayload, session: &Session, runtime_state: &mut AgentRuntimeState, event_tx: Option<&Sender<AgentEvent>>, ) -> HookRunOutcome
Run all hooks matching the given point.
Records checkpoints in runtime_state. Returns the first
Suspend or Abort result, or the aggregate result otherwise.
Sourcepub fn has_hooks_for(&self, point: AgentHookPoint) -> bool
pub fn has_hooks_for(&self, point: AgentHookPoint) -> bool
Check if any hooks are registered for the given point.
Trait Implementations§
Source§impl Clone for HookRunner
impl Clone for HookRunner
Source§fn clone(&self) -> HookRunner
fn clone(&self) -> HookRunner
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for HookRunner
impl !UnwindSafe for HookRunner
impl Freeze for HookRunner
impl Send for HookRunner
impl Sync for HookRunner
impl Unpin for HookRunner
impl UnsafeUnpin for HookRunner
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