Skip to main content

HilComponent

Struct HilComponent 

Source
pub struct HilComponent { /* private fields */ }
Expand description

Human-in-the-Loop Component.

Manages a queue of approval requests and responds to Human Approve/Reject signals.

Implementations§

Source§

impl HilComponent

Source

pub fn new() -> Self

Creates a new HIL component.

Source

pub fn submit(&mut self, request: ApprovalRequest) -> String

Submits a new approval request.

Returns the request ID that can be used to check status or cancel.

Source

pub fn has_pending(&self) -> bool

Returns true if there are pending approval requests.

Source

pub fn is_pending(&self, id: &str) -> bool

Returns true if the given request ID is pending.

Source

pub fn get_pending(&self, id: &str) -> Option<&ApprovalRequest>

Returns a reference to a pending request.

Source

pub fn pending_requests(&self) -> Vec<&ApprovalRequest>

Returns all pending requests.

Source

pub fn pending_count(&self) -> usize

Returns the number of pending requests.

Source

pub fn get_resolved( &self, id: &str, ) -> Option<&(ApprovalRequest, ApprovalResult)>

Returns a resolved request by ID.

Source

pub fn resolved_count(&self) -> usize

Returns the number of resolved requests.

Source

pub fn resolve( &mut self, id: &str, result: ApprovalResult, ) -> Result<ApprovalResult, ComponentError>

Resolves an approval request.

Returns Ok(result) if the request was found and resolved, or Err if the request ID was not found.

Trait Implementations§

Source§

impl Component for HilComponent

Source§

fn id(&self) -> &ComponentId

Returns the component’s identifier. Read more
Source§

fn subscriptions(&self) -> &[EventCategory]

Returns the event categories this component subscribes to. Read more
Source§

fn status(&self) -> Status

Returns the current execution status. Read more
Source§

fn on_request(&mut self, request: &Request) -> Result<Value, ComponentError>

Handle an incoming request. Read more
Source§

fn on_signal(&mut self, signal: &Signal) -> SignalResponse

Handle an incoming signal. Read more
Source§

fn abort(&mut self)

Immediate abort. Read more
Source§

fn snapshot(&self) -> Result<ComponentSnapshot, SnapshotError>

Captures the component’s current state as a snapshot. Read more
Source§

fn restore(&mut self, snapshot: &ComponentSnapshot) -> Result<(), SnapshotError>

Restores the component’s state from a snapshot. Read more
Source§

fn subscription_entries(&self) -> Vec<SubscriptionEntry>

Returns subscription entries with optional operation-level filtering. Read more
Source§

fn status_detail(&self) -> Option<StatusDetail>

Returns detailed status information. Read more
Source§

fn init(&mut self, _config: &Value) -> Result<(), ComponentError>

Initialize the component with optional configuration. Read more
Source§

fn shutdown(&mut self)

Shutdown the component. Read more
Source§

fn runtime_hints(&self) -> RuntimeHints

Returns runtime hints for this component. Read more
Source§

fn as_packageable(&self) -> Option<&dyn Packageable>

Returns this component as a Packageable if supported. Read more
Source§

fn as_packageable_mut(&mut self) -> Option<&mut dyn Packageable>

Returns this component as a mutable Packageable if supported. Read more
Source§

fn set_emitter(&mut self, _emitter: Box<dyn Emitter>)

Sets the event emitter for this component. Read more
Source§

fn set_child_context(&mut self, _ctx: Box<dyn ChildContext>)

Sets the child context for this component. Read more
Source§

impl Default for HilComponent

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

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