Expand description
§Brain HTTP REST API Adapter
Exposes Brain’s signal processing pipeline over HTTP using axum.
§Routes
Unauthenticated:
GET /— redirect to/uiGET /health— liveness probeGET /metrics— Prometheus-format countersGET /ui— embedded memory explorer web UIGET /openapi.json— OpenAPI 3.0 specificationGET /api— Swagger UI
Authenticated (Authorization: Bearer <api-key>):
POST /v1/signals— submit a signal (scope: write)GET /v1/signals/:id— retrieve cached signal response (scope: read)POST /v1/memory/search— semantic search over stored facts (scope: read)GET /v1/memory/facts— paginated fact list (scope: read)GET /v1/memory/namespaces— list namespaces with counts (scope: read)GET /v1/memory/export— full memory export (scope: export)POST /v1/memory/import— import facts/episodes (scope: write)GET /v1/schedules— list scheduled intents (scope: read)DELETE /v1/schedules/:id— cancel a scheduled intent (scope: write)GET /v1/events— SSE stream of signal/notification/brain events (scope: read)POST /v1/webhooks/:id— inbound webhook delivery (scope: write — or a configured signature verifier in lieu of Bearer auth)
§Authentication
A random API key is generated on brain init and printed to stdout.
Configure additional keys (and their permission scopes) under
access.api_keys[] in the config; admin is treated as an implicit
superset of every other scope. Webhook endpoints accept a verifier
(HMAC or Ed25519) as an alternative to Bearer auth — see
adapters.http.webhook_verifiers in the config.
Re-exports§
pub use server::create_router;pub use server::serve;pub use state::AppState;pub use types::HttpAdapterError;
Modules§
- auth
- Authentication middleware helpers for HTTP routes.
- handlers
- HTTP route handlers for the Brain REST API.
- metrics
- Atomic counters and gauge caching exposed at
GET /metrics. - middleware
- Tower middleware applied to
/v1/*routes. - server
- HTTP server construction and lifecycle.
- state
- Shared application state for HTTP handlers.
- types
- Request/response types and error enums for the HTTP adapter.
- validate
- Field-level input validation for HTTP request bodies.