Skip to main content

HookExecutor

Trait HookExecutor 

Source
pub trait HookExecutor:
    Send
    + Sync
    + Debug
    + 'static {
    // Required method
    fn fire<'life0, 'life1, 'async_trait>(
        &'life0 self,
        event: &'life1 HookEvent,
    ) -> Pin<Box<dyn Future<Output = HookResult> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;

    // Provided methods
    fn fire_outcome<'life0, 'life1, 'async_trait>(
        &'life0 self,
        event: &'life1 HookEvent,
    ) -> Pin<Box<dyn Future<Output = HookOutcome> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn dispatch_observational(self: Arc<Self>, event: HookEvent) { ... }
    fn record_agent_event<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        _event: &'life1 AgentEvent,
        _run_id: &'life2 str,
        _session_id: &'life3 str,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait { ... }
    fn record_run_cancelled<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        _run_id: &'life1 str,
        _session_id: &'life2 str,
        _reason: Option<&'life3 str>,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait { ... }
    fn before_run_control<'life0, 'life1, 'async_trait>(
        &'life0 self,
        request: &'life1 RunControlRequest,
    ) -> Pin<Box<dyn Future<Output = HookOutcome> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn record_run_control<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        request: &'life1 RunControlRequest,
        receipt: &'life2 RunControlReceipt,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait { ... }
}
Expand description

Execution seam for in-process, SDK, and host-provided Hook runtimes.

Required Methods§

Source

fn fire<'life0, 'life1, 'async_trait>( &'life0 self, event: &'life1 HookEvent, ) -> Pin<Box<dyn Future<Output = HookResult> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Provided Methods§

Source

fn fire_outcome<'life0, 'life1, 'async_trait>( &'life0 self, event: &'life1 HookEvent, ) -> Pin<Box<dyn Future<Output = HookOutcome> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn dispatch_observational(self: Arc<Self>, event: HookEvent)

Dispatch an observational event without delaying protected work. Run-scoped executors override this to register the work with their capability supervisor before returning.

Source

fn record_agent_event<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, _event: &'life1 AgentEvent, _run_id: &'life2 str, _session_id: &'life3 str, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Source

fn record_run_cancelled<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, _run_id: &'life1 str, _session_id: &'life2 str, _reason: Option<&'life3 str>, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Source

fn before_run_control<'life0, 'life1, 'async_trait>( &'life0 self, request: &'life1 RunControlRequest, ) -> Pin<Box<dyn Future<Output = HookOutcome> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Gate a typed steer/interrupt request before it enters a Run’s control inbox. Host executors can return Block or Retry without needing to understand the internal loop implementation.

Source

fn record_run_control<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, request: &'life1 RunControlRequest, receipt: &'life2 RunControlReceipt, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Observe the durable acceptance/application receipt for a run-control request. This is intentionally observational and must not mutate the receipt after it has been returned to the caller.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§