Skip to main content

StepHandler

Trait StepHandler 

Source
pub trait StepHandler: Send + Sync {
    // Required method
    fn handle_step<'a>(
        &'a self,
        envelope: &'a Value,
        ctx: HookCtx<'a>,
    ) -> BoxFuture<'a, Result<Option<Value>, HookError>>;
}
Expand description

Step model handler (migration target). The engine gives it an input envelope for a mount point (produced by step::HookStep::to_envelope), and it produces a verdict JSON — the engine then applies the verdict back to the step via step::HookStep::apply_verdict. Both hook types implement this: internal Rust hooks compute the verdict directly; command/prompt hooks feed the envelope to a subprocess/LLM and parse the output into a verdict.

Returns Ok(None) = no intervention (equivalent to an empty verdict); Ok(Some(verdict)) = apply that verdict; Err = failure, handled by the engine according to the degradation table.

Required Methods§

Source

fn handle_step<'a>( &'a self, envelope: &'a Value, ctx: HookCtx<'a>, ) -> BoxFuture<'a, Result<Option<Value>, HookError>>

Process a mount point: input envelope → verdict JSON.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§