Expand description
Transport-agnostic REST + SSE facade types (WEFT-122 / Cognitum gaps #6–#8).
Bound by clawft-services axum handlers; not a standalone server.
HTTP REST facade with SSE streaming for WeftOS.
Closes Cognitum Seed gaps #6, #7, #8:
- Gap #6:
GET /eventsSSE delta stream fromKernelEventLog. - Gap #7:
POST /custody/witnessexternal chain-event injection. - Gap #8: REST API facade wrapping kernel Unix-socket RPC methods.
§Architecture
This module is transport-agnostic: it defines typed request/response
structs, an SSE event formatter, and a dispatch layer that maps HTTP
routes to kernel operations. The actual HTTP server binding (axum, hyper,
etc.) is left to the binary crate or clawft-services.
§Feature Gate
Gated behind http-api. Not included in the default feature set.
Structs§
- Facade
Response - HTTP status code + JSON body returned by the facade.
- SseMessage
- A single SSE message ready for wire formatting.
- Witness
Request - Request body for
POST /custody/witness. - Witness
Response - Response body for
POST /custody/witness.
Enums§
- Facade
Route - A matched facade route with its target RPC method.
- Http
Method - HTTP method for route matching.
- RpcParam
- Extracted route parameters (e.g.,
:pidfrom/api/agents/:pid). - SseEvent
Type - Known SSE event types streamed on
GET /events.
Constants§
- CONTENT_
TYPE_ JSON - Content-Type for JSON responses.
- CONTENT_
TYPE_ SSE - Content-Type for SSE responses.
- SSE_
HEARTBEAT_ COMMENT - SSE heartbeat comment frame (
:heartbeat\n\n). - SSE_
HEARTBEAT_ INTERVAL_ SECS - Default heartbeat interval in seconds.
Functions§
- build_
rpc_ params - Build RPC params JSON from the HTTP request body and route params.
- classify_
boot_ event - Classify a kernel boot event into an SSE event type.
- match_
facade_ route - Match an HTTP method + path to a facade route.
- poll_
events - Snapshot the event log and produce SSE messages for any new events since the given cursor position.
- sse_
response_ headers - Required SSE response headers as
(name, value)pairs. - verify_
witness_ signature - Validate a hex-encoded Ed25519 signature.