Expand description
HTTP client for a running mail4agent daemon.
Covers the public mailbox surface the daemon exposes over loopback HTTP:
GET /health (no auth) and the bearer-gated POST /mail/* plus operator
POST /admin/* routes. Wire types for mail transport come from
mail4agent_api; admin / whoami / status display shapes that live only
in the daemon are mirrored here so a caller never needs to depend on the
binary crate.
Sender is never a field. Every /mail/* call authenticates with the
bearer this client was constructed with; the daemon derives from from
that credential plus kernel session attestation on the TCP peer. See
mail4agent README / CLAUDE.md (“The rule that defines this service”).
Hatchery (HQ) consumes this crate as a dependency — the harness holds no
mailbox of its own (extraction plan
mailbox-service-extraction-and-signed-session-identity-2026-09-16.md).
Structs§
- Health
Report - Rich liveness payload from
GET /health(unauthenticated). - Mail
AckRequest - Re-export common wire types so hatchery can
use mail4agent_client::*. Requests an acknowledgement be recorded formessage_id, on behalf of whoever the presented credential authenticated as (same discipline asSendRequest: no reader field to fill in). - Mail
Client - Async HTTP client bound to one mailbox base URL and one bearer credential.
- Mail
Client Builder - Builder for
MailClient. - Mail
Directory - Re-export common wire types so hatchery can
use mail4agent_client::*. Answers a directory request: every participant the mailbox has registered and every room it tracks, from the point of view of whoever asked (seeRoomEntry::member). The whole mailbox’s population in one call, deliberately unpaginated – this is a small, local directory, not a social graph (mail4agent/CLAUDE.md). - Mail
Inbox Request - Re-export common wire types so hatchery can
use mail4agent_client::*. Requests a page of the caller’s inbox.limitdefaults toINBOX_LIMIT_DEFAULTwhen a caller’s JSON omits it, and is bounded byINBOX_LIMIT_MAX. - Mail
Message Id - Re-export common wire types so hatchery can
use mail4agent_client::*. Opaque, prefixed, fixed-width hex id for a storedMessage. Ported fromHarnessMailMessageId(prefixhmail_there,m4a_here so a value can never be mistaken for a harness message id from the crate this was ported out of). - Mail
Participant Id - Re-export common wire types so hatchery can
use mail4agent_client::*. Addresses one participant directly. Distinct fromRoomIdon purpose: a room id must never be accepted where a participant id is meant, and a shared alias would let one slip into the other’s slot. - Mail
Room Id - Re-export common wire types so hatchery can
use mail4agent_client::*. Addresses a named group of participants the mailbox itself tracks. Distinct fromParticipantIdon purpose (see there). - Mail
Send Request - Re-export common wire types so hatchery can
use mail4agent_client::*. Requests a send. Has nofromfield and must never grow one. The sender is whoever the presented credential authenticated as; the mailbox derivesfromfrom the verified identity, never from a field the caller filled in. - Mail
Send Response - Re-export common wire types so hatchery can
use mail4agent_client::*. Answers aSendRequest. Returns the caller its own address so a participant that just wrote immediately knows where it can be answered. - Participant
IdRequest - Body for admin routes that take only a participant id.
- Register
Participant Request - Body for
POST /admin/participant. - Room
IdRequest - Body for
POST /admin/room. - Room
Member Request - Body for room membership add/remove.
- Secret
Response - Answers
POST /admin/participant/…/rotate— secret returned once. - Status
Response - Answers
POST /mail/status(daemondto::StatusResponse). - WhoAmI
Response - Answers
POST /mail/whoami(daemondto::WhoAmIResponse).
Enums§
- Client
Error - Typed failures from the HTTP client itself (transport / decode / HTTP
status that is not a named
MailErrorJSON body). - Mail
Address - Re-export common wire types so hatchery can
use mail4agent_client::*. Where a message goes, or who it is from: one account directly, one of that account’s live sessions, or a room the mailbox tracks membership for. Serde-tagged onkind("direct"/"session"/"room").
Constants§
- DEFAULT_
BASE_ URL - Default loopback bind the daemon uses when
mail4agent.tomlis absent. - INBOX_
LIMIT_ DEFAULT - Re-export common wire types so hatchery can
use mail4agent_client::*. ValueInboxRequest::limitdefaults to when a caller’s JSON omits it.