Expand description
REST client and shared wire types for the agent HTTP API (Contract D, port 8080).
The native front (ados-control) serves the API on :8080; this is the
client side used by the Rust TUI (and any other Rust REST consumer). Auth is
the X-ADOS-Key header, or a dashboard PIN session in
X-ADOS-Dashboard-Session; the pairing routes are reachable while unpaired.
The client is blocking (ureq, HTTP-only) because its callers are simple
pollers and worker threads off the flight-critical path.
The client returns raw serde_json::Value bodies. The types submodule
adds typed serde structs for the read-projection shapes that the native
route handlers project out of subsystem sockets and sidecars. Defining each
shape once here keeps the data contract in the shared protocol crate, so a
handler does not re-invent an ad-hoc struct per route. Every type carries an
open extra map (via #[serde(flatten)]) and #[serde(default)] fields, so
a new field on the producer side round-trips through a consumer that does not
yet know about it.
Re-exports§
pub use types::*;
Modules§
- types
- Typed read-projection shapes for the agent HTTP API.
Structs§
- Auth
- The credentials a
RestClientsends. Shared by every clone of a client, so setting a key or session on one applies to all of them. - Rest
Client - A blocking REST client for the agent HTTP API. Cheap to clone; clones share
one
Auth.
Enums§
Constants§
- DEFAULT_
BASE - Default base URL: the agent’s local HTTP API. Matches
cli/main.py’sAPI_BASE. - DEFAULT_
TIMEOUT - Default per-request timeout, matching the Python CLI’s httpx client.
- STREAM_
CONNECT_ TIMEOUT - Connect timeout for a long-lived stream (server-sent events). The stream itself has no read timeout: an idle log stream is not a failure.
Functions§
- status_
detail - The human detail of an error body. Flat bodies carry
detail,messageorerroras a string; nested ones carry an object underdetailand/orerror({"detail": {"error": {"code", "message"}}}). The first string found amongdetail,message,error, each looked up directly and then as<k>.messageand<k>.error.message, wins; empty when there is none.