Skip to main content

ElicitationHook

Struct ElicitationHook 

Source
pub struct ElicitationHook;
Expand description

Elicitation hook — drives a human-in-the-loop step through a channel plugin (Keycloak CIBA, Slack, in-band, …).

Payload (ElicitationPayload) — unified input + accumulator. The apl-cpex bridge sets the input fields (operation, elicitation_id, kind, from, purpose, scope, timeout, channel) and invokes the hook; the handler populates the output fields (id, status, outcome, approver, intent_id, expires_at, valid, reason) on a clone of the running payload and returns it via PluginResult::modify_payload. Input fields are private and read through accessors.

Result (PluginResult<ElicitationPayload>) — the executor’s standard envelope. modified_payload carries the updated payload. continue_processing = false halts (the handler could not service the operation — e.g. unknown channel error); the bridge maps that to an ElicitationError.

Three operations, one hook. ElicitationPayload::operation tells the handler whether this is a Dispatch, Check, or Validate call. A handler typically matches on it. The three short, synchronous calls span the (possibly hours-long) human gap, which is owned by the channel — never by a handler call.

Handler signature:

impl HookHandler<ElicitationHook> for CibaApprover {
    async fn handle(
        &self,
        payload: &ElicitationPayload,
        _ext: &Extensions,
        _ctx: &mut PluginContext,
    ) -> PluginResult<ElicitationPayload> {
        let mut out = payload.clone();
        match payload.operation() {
            ElicitationOp::Dispatch => { /* register intent + CIBA backchannel */ }
            ElicitationOp::Check    => { /* poll Keycloak token endpoint */ }
            ElicitationOp::Validate => { /* verify token + intent binding */ }
        }
        PluginResult::modify_payload(out)
    }
}

Registration: manager.register_handler_for_names::<ElicitationHook, _>(plugin, config, &["elicit"]).

Trait Implementations§

Source§

impl HookTypeDef for ElicitationHook

Source§

const NAME: &'static str = "elicit"

Hook name — used as the registry key and in config YAML. Read more
Source§

type Payload = ElicitationPayload

The typed payload that handlers receive. Must implement PluginPayload (Clone + Send + Sync + ’static).
Source§

type Result = PluginResult<ElicitationPayload>

The typed result that handlers return.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more