pub struct ExternalHookRunner {
pub cancel_token: Option<CancellationToken>,
/* private fields */
}Fields§
§cancel_token: Option<CancellationToken>Implementations§
Source§impl ExternalHookRunner
impl ExternalHookRunner
Sourcepub fn discover(dirs: &[PathBuf]) -> Self
pub fn discover(dirs: &[PathBuf]) -> Self
Scan the given directories and collect all executable files.
This is the legacy discovery mode: every executable in the directory is treated as a hook that fires for all events.
Sourcepub fn from_config(config: HooksConfig) -> Self
pub fn from_config(config: HooksConfig) -> Self
Build a runner from a structured HooksConfig.
Supports command and http types; prompt / agent require an LLM
provider and are handled by [from_config_with_llm].
Sourcepub fn from_config_with_llm(
config: HooksConfig,
llm: Option<Arc<dyn ChatProvider>>,
) -> Self
pub fn from_config_with_llm( config: HooksConfig, llm: Option<Arc<dyn ChatProvider>>, ) -> Self
Build a runner from a structured HooksConfig, with an optional LLM
provider for prompt/agent-type hooks.
Sourcepub fn with_cancel_token(self, token: CancellationToken) -> Self
pub fn with_cancel_token(self, token: CancellationToken) -> Self
Attach a CancellationToken for asyncRewake hooks.
Sourcepub fn with_event_tx(self, tx: UnboundedSender<AgentEvent>) -> Self
pub fn with_event_tx(self, tx: UnboundedSender<AgentEvent>) -> Self
Attach an AgentEvent channel for TUI progress events.
Sourcepub fn with_sdk_forwarder(self, forwarder: Arc<dyn SdkHookForwarder>) -> Self
pub fn with_sdk_forwarder(self, forwarder: Arc<dyn SdkHookForwarder>) -> Self
Attach a Claude SDK hook forwarder (control-channel hook_callback).
Sourcepub fn set_sdk_forwarder(
&mut self,
forwarder: Option<Arc<dyn SdkHookForwarder>>,
)
pub fn set_sdk_forwarder( &mut self, forwarder: Option<Arc<dyn SdkHookForwarder>>, )
Replace the SDK hook forwarder at runtime.
Sourcepub async fn dispatch(&self, input: &HookInput) -> HookResult
pub async fn dispatch(&self, input: &HookInput) -> HookResult
Dispatch an event to all matching hooks.
Returns the first non-Continue HookResult. Hooks that fail,
timeout, or return unparseable output are silently skipped (fail-open).