Skip to main content

Module caller

Module caller 

Source
Expand description

Who is calling, derived from the request’s credential — identity M4a (docs/specs/SPEC_AGENT_IDENTITY_CARRIED_NOT_DERIVED_2026_09_23.md §6.5.3).

A request that carries X-Agent-Token for a token this srv minted is Caller::Agent with that token’s UID. Anything else is Caller::Unattributed — the UI, bashwrap, muxsh, a tokenless agent, a peer srv. This is attribution, never authorization: at the same-user boundary a request that omits its token cannot be told apart from the UI (§6.5.1), so nothing here refuses a request. An unknown or foreign-channel token is counted and treated as absent — an agent deleted while running, or a token that reached another channel’s srv through a forwarded environment, keeps working exactly as before.

Derived only for requests that authenticated with the full instance key: a token on a LAN-key request must not lift it to host trust (§6.5.3).

Enums§

Caller 🔒
Who a request is attributed to. Inserted into every request’s extensions on the authed and LAN-forward route groups.
Lookup 🔒
Resolve the request’s Caller. Pure, so the rules are testable without a router: token is the header value, full_key whether the request authenticated with the full instance key, lookup the token index. What the token index said about a token.

Constants§

AGENT_TOKEN_HEADER 🔒
The request header an agent’s MCP sets from its inherited AGENTMUX_AGENT_TOKEN.

Functions§

attributed_uid 🔒
The UID to persist beside an actor name (identity M4c-1, spec §6.5.9): the request’s attributed UID, or "" — unknown, never guessed — when the request is Unattributed or carries no Caller at all.
caller_middleware 🔒
Inserts Caller. Layered inside auth_middleware / lan_or_full_auth_middleware; both mark which key authenticated the request (ReactiveAuthVia), and a Caller is derived only when that mark says the full key — a request that reached here unmarked is Unattributed, never assumed full-key (review on #3571). The WebSocket upgrade is always Unattributed (§6.5.3): WebSocket RPC is the UI’s channel, and a token must never ride on it.
derive_caller 🔒
handle_identity_fallbacks 🔒
GET /agentmux/identity/fallbacks — every §9.2 counter and the two live gauges (§6.5.6). The phase gates read this: M4d and M5 wait for live.tokenless_or_unknown to reach zero and for the fallback counters to stop moving. Read-only; auth-gated like every loopback route.