pub struct HttpApiHandler { /* private fields */ }Expand description
The kernel-side HTTP API handler.
This is a transport-agnostic dispatcher: it accepts parsed request types and returns serializable response types. The actual HTTP server binding (hyper, axum, warp, etc.) is left to the binary crate or daemon that embeds the kernel.
§Example
ⓘ
let handler = HttpApiHandler::new(governance_engine);
let resp = handler.handle_execute(request).await;Implementations§
Source§impl HttpApiHandler
impl HttpApiHandler
Sourcepub fn new(governance: GovernanceEngine) -> Self
pub fn new(governance: GovernanceEngine) -> Self
Create a new handler backed by the given governance engine.
Sourcepub fn handle_execute(
&self,
req: &ExecuteRequest,
) -> Result<ExecuteResponse, ErrorResponse>
pub fn handle_execute( &self, req: &ExecuteRequest, ) -> Result<ExecuteResponse, ErrorResponse>
Handle POST /api/v1/execute.
In a full integration this would:
- Look up the agent by
agent_idin the process table. - Feed the task through the 7-stage pipeline.
- Return the pipeline result.
This stub validates the request and returns a structured response so the adapter wire format is exercised end-to-end.
Sourcepub fn handle_govern(
&self,
req: &GovernRequest,
) -> Result<GovernResponse, ErrorResponse>
pub fn handle_govern( &self, req: &GovernRequest, ) -> Result<GovernResponse, ErrorResponse>
Handle POST /api/v1/govern.
Evaluates the proposed action through the WeftOS governance engine and returns the decision with optional ExoChain attestation metadata.
Sourcepub fn handle_health(&self) -> HealthResponse
pub fn handle_health(&self) -> HealthResponse
Handle GET /api/v1/health.
Auto Trait Implementations§
impl !Freeze for HttpApiHandler
impl RefUnwindSafe for HttpApiHandler
impl Send for HttpApiHandler
impl Sync for HttpApiHandler
impl Unpin for HttpApiHandler
impl UnsafeUnpin for HttpApiHandler
impl UnwindSafe for HttpApiHandler
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
Mutably borrows from an owned value. Read more
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> ⓘ
Converts
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> ⓘ
Converts
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