pub fn validate(
agent_id: &str,
input: &SeatInput,
now_ms: i64,
is_agent: impl Fn(&str) -> bool,
lead_of: impl Fn(&str) -> Option<String>,
) -> Result<AgentSeat, String>Expand description
Validate the seat the operator asks for on agent agent_id, and stamp it
with now_ms (§2). is_agent says whether a uid is an agent on this
machine; lead_of gives an agent’s current lead (its effective seat’s),
which is how a cycle is found: following leads from the new lead must not
come back to agent_id.
A lead is an agent this machine has a definition for, or one on another machine
(Name@host, is_remote_lead), which the caller has already checked against the LAN
directory and says so through is_agent: a peer lists agents by name, so there is no uid here
to check it against.