Expand description
The per-agent token a harness sends to the gateway in place of a model key, minted the way a
container token is (container::credential): kept by digest, valid for one route, attributed to
one agent. It lives for this srv launch, as the instance key an agent is launched with does.
Structs§
- Grant
- What a token was minted for.
Constants§
- TOKEN_
PREFIX - Prefix that marks a gateway token in logs and bug reports.
Functions§
- current_
grant_ of_ replaced - The agent’s current grant for a token that
renew_for_accountreplaced, while the agent still holds one for that route: a message queued during a container agent’s first turn was set up with the token that turn then replaced. The replaced token itself is never accepted (grant_forsays none); this only names whose turn it is. Gone with the agent’s token. - grant_
for - renew_
for_ account - A gateway route’s token (the key route or a model route) for a container turn, accepted only from
peerwhen there is one. The agent’s earlier token stops working at once unless it already holds exactly this grant (the same agent, account and address): two panes of one container agent run turns that overlap, and the second must not end the token the first is running on. A container’s token ends with the container (revoke_agent), so a recreated container, a new address or another account is always given a new one. - revoke
- Ends the agent’s access to
routewithout touching its environment: the next request is refused. - revoke_
agent - Ends every token for
routethat was made for the agentnamenames: its definition id or its routing id (slug). A container is named from the agent’s id, so this is what its stop, recreation and removal can say. - revoke_
agent_ everywhere revoke_agentfor every route: a container’s stop, recreation or removal ends all of its agent’s gateway tokens.- revoke_
agent_ everywhere_ older_ than revoke_agent_older_thanfor every route: a container’s stop ends all of its agent’s gateway tokens, model routes and the key route alike.- revoke_
agent_ older_ than revoke_agentfor the tokens made at leastmin_ageago. A container that ended outside AgentMux is only heard of from Docker’s event stream, which can run behind: a token made since (for the container that took its place) is left alone.- token_
for - The agent’s token for
route: minted on first use and reused after, so a relaunch of the same agent keeps the token a running child still holds. - token_
for_ account token_forfor the key route: the token also names the account it spends, which the gateway checks against the agent’s link at every request. Asked again with another account, the same token now spends that one.- unknown_
token_ reason - Why a request that no token matched was refused, in words for the log and the refusal: it carried no credential, or one that is not a gateway token, or a gateway token this srv does not hold (srv started again since it was made, or the agent was moved to another account, relaunched or had its access ended). Nothing of the credential is read but its prefix. A harness shows all of these as a bare “HTTP 401 Not logged in”; this is where the difference is.