pub struct ExternalHookRunner {
pub cancel_token: Option<CancellationToken>,
/* private fields */
}Expand description
Discovers and runs external hook executables.
External hooks are scanned from one or more directories. Each
executable file is treated as a hook. When dispatch is called,
the runner sends the event to each hook in order and returns the
first non-Continue decision. Hooks that timeout or return
invalid output are treated as Continue (fail-open).
Fields§
§cancel_token: Option<CancellationToken>Optional cancellation token for asyncRewake hooks.
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 LlmProvider>>,
) -> Self
pub fn from_config_with_llm( config: HooksConfig, llm: Option<Arc<dyn LlmProvider>>, ) -> 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 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).
Trait Implementations§
Source§impl Clone for ExternalHookRunner
impl Clone for ExternalHookRunner
Source§fn clone(&self) -> ExternalHookRunner
fn clone(&self) -> ExternalHookRunner
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for ExternalHookRunner
impl !UnwindSafe for ExternalHookRunner
impl Freeze for ExternalHookRunner
impl Send for ExternalHookRunner
impl Sync for ExternalHookRunner
impl Unpin for ExternalHookRunner
impl UnsafeUnpin for ExternalHookRunner
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more