pub struct HookRunner { /* private fields */ }Expand description
Engine adapter around the standalone hook dispatcher.
bamboo-hooks owns matching and handler execution. This adapter translates
completed executions into engine checkpoints and lifecycle events.
Implementations§
Source§impl HookRunner
impl HookRunner
pub fn new() -> Self
pub fn register(&mut self, hook: Arc<dyn AgentHook>)
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 configured handlers from one frozen config snapshot. The original registry remains reusable by future runs.
Sourcepub fn mark_user_prompt_prechecked(session: &mut Session, prompt: &str)
pub fn mark_user_prompt_prechecked(session: &mut Session, prompt: &str)
Record the exact accepted prompt from the server submission seam. The shared loop consumes this once, so server and embedded runs cannot fire portable UserPromptSubmit twice for the same admitted prompt.
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.
pub async fn run_hooks_with_tool_input( &self, point: AgentHookPoint, payload: &HookPayload, session: &Session, runtime_state: &mut AgentRuntimeState, event_tx: Option<&Sender<AgentEvent>>, original_tool_input: Option<&Value>, ) -> HookRunOutcome
pub async fn run_hooks_with_inputs( &self, point: AgentHookPoint, payload: &HookPayload, session: &Session, runtime_state: &mut AgentRuntimeState, event_tx: Option<&Sender<AgentEvent>>, inputs: PortableInputs<'_>, ) -> HookRunOutcome
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.