Skip to main content

Crate brainos_httpadapter

Crate brainos_httpadapter 

Source
Expand description

§Brain HTTP REST API Adapter

Exposes Brain’s signal processing pipeline over HTTP using axum.

§Routes

  • GET /health — health check (no auth required)
  • GET /metrics — Prometheus-format counters (no auth required)
  • GET /ui — embedded memory explorer web UI (no auth required)
  • GET /openapi.json — OpenAPI 3.0 specification (no auth required)
  • GET /api — Swagger UI (no auth required)
  • POST /v1/signals — submit a signal (requires write)
  • GET /v1/signals/:id — retrieve cached signal response (requires read)
  • POST /v1/memory/search — semantic search over stored facts (requires read)
  • GET /v1/memory/facts — list all semantic facts (requires read)
  • GET /v1/events — SSE stream of proactive notifications (requires read)

§Authentication

All /v1/* routes require Authorization: Bearer <api-key> header. The demo key demokey123 (read+write) is pre-configured in default.yaml.

Structs§

AppState
Shared state for all HTTP handlers.
FactJson
A single fact in JSON form (GET /v1/memory/facts, search results).
HealthResponse
Health check response.
Metrics
Atomic counters exposed at GET /metrics in Prometheus text format.
NamespaceJson
Namespace statistics (GET /v1/memory/namespaces).
SearchRequest
Search request body (POST /v1/memory/search).
SignalRequest
Incoming signal body (POST /v1/signals).

Enums§

HttpAdapterError

Functions§

create_router
Build the axum router with all routes and CORS enabled.
serve
Start the HTTP server, binding to host:port.