# librefang-api

HTTP / WebSocket API server for the [LibreFang](https://github.com/librefang/librefang) Agent OS daemon.

Exposes agent management, sessions, channels, approvals, MCP, peer/A2A
networking, and the React dashboard SPA over JSON REST and WebSocket
endpoints. The kernel runs in-process; CLI / desktop / mobile clients
connect over this surface.

## Public API entry points

- `server::build_router(kernel, addr)` — assembles the axum router and
  shared `AppState`.
- `routes::*` — endpoint handlers, organised by domain.
- `middleware` — auth (`PUBLIC_ROUTES_ALWAYS`, `PUBLIC_ROUTES_GET_ONLY`,
  `PUBLIC_ROUTES_DASHBOARD_READS`), rate limiting, telemetry.
- `ws` — WebSocket auth + streaming handlers.

The bundled dashboard SPA lives under `dashboard/` (TypeScript / React /
TanStack Query); it is built by `cargo xtask build-web` and embedded
into the binary via `include_dir!`.

## Key dependencies

`librefang-kernel`, `librefang-runtime`, `librefang-types`,
`librefang-memory`, `librefang-channels`, `librefang-llm-drivers`,
`axum`, `tower-http`, `utoipa` (OpenAPI), `schemars`.

## OpenAPI

The committed `openapi.json` at the workspace root is regenerated by
`cargo xtask codegen --openapi` and verified for drift in CI; see
[`xtask/baselines/`](../../xtask/baselines/) for hash baselines.

See the [workspace README](../../README.md).
