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 async fn run_observer_hooks(
&self,
point: AgentHookPoint,
payload: &HookPayload,
session: &Session,
runtime_state: &mut AgentRuntimeState,
event_tx: Option<&Sender<AgentEvent>>,
) -> HookRunOutcome
pub async fn run_observer_hooks( &self, point: AgentHookPoint, payload: &HookPayload, session: &Session, runtime_state: &mut AgentRuntimeState, event_tx: Option<&Sender<AgentEvent>>, ) -> HookRunOutcome
Run every matching hook while recording checkpoints/events, but never
short-circuit on a control decision. Observer/advisory seams such as
SessionEnd, PreCompact, and Notification use this so a command’s
control-shaped output cannot suppress later hooks or reverse an
operation that must proceed for correctness.
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
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more