Skip to main content

Crate aonyx_api

Crate aonyx_api 

Source
Expand description

§aonyx-api

The Aonyx Agent automation API: a REST + WebSocket surface over the same core that powers the CLI/TUI. It is a thin transport — every endpoint bottoms out in the existing aonyx-* crates, no agent-loop logic is reimplemented here.

This crate is feature-driven by the binary: aonyx-agent depends on it behind its api feature and serves build_router via aonyx serve api. To avoid a dependency cycle, aonyx-api never depends on aonyx-agent; the agent loop is injected through a trait (added in a later phase), exactly like the channel adapters.

§Surface (grown phase by phase)

  • V4.1 (this scaffold)build_router with /v1/health (open) and /v1/info (bearer-authed), ApiState, AuthConfig, ServerInfo, and the ApiError response type.
  • V4.2 — sessions + blocking turns.
  • V4.3 — WebSocket / SSE streaming.
  • V4.4 — memory palace, tools, skills, config, OpenAPI.

Re-exports§

pub use error::ApiError;
pub use error::ApiResult;

Modules§

error
The API error type and its HTTP rendering.

Structs§

ApiState
State shared with every request handler.
AuthConfig
Authentication + authorization policy for the API.
ConfigInfo
Non-secret server configuration (GET /v1/config). Never carries keys.
ServerInfo
Server identity + capabilities, returned by GET /v1/info.
SkillInfo
Metadata for one loaded skill (GET /v1/skills).
ToolInfo
Metadata for one registered tool (GET /v1/tools).

Enums§

StreamFrame
A single streamed event of a turn, serialized to the client as a JSON frame ({"type": "...", ...}). Mirrors the agent loop’s internal TurnEvent; the binary maps its events onto these.

Traits§

ApiAgent
One agent turn over a full message history — blocking or streaming — plus read-only metadata accessors the binary fills from its live components.

Functions§

build_router
Build the complete API router for the given ApiState.
serve
Bind addr (e.g. 127.0.0.1:8788) and serve the full API until the process is stopped. The binary wires this from aonyx serve api.