Skip to main content

Module launch

Module launch 

Source
Expand description

An agent’s route and model, and the environment that points its harness at the gateway.

The choice is kept on the agent’s definition as a content blob, so it follows the agent’s id and needs no column. The environment is built at every spawn and never persisted: the token in it lives for this srv launch.

Structs§

Choice

Constants§

BLOCK_META_KEY
The block meta key the pane, its footer and its header read for the model the agent really runs: the route’s and the model’s names, or absent on the harness’s own sign-in. Without it they show the harness’s nominal model (the alias the pane was configured with), which on a route is not what answers.
CONTENT_TYPE
The definition content type that holds the Choice.
LEAVING_TYPE
The definition content type that marks a route the agent has left but whose harness may still be running a turn on it: the gateway keeps answering that route’s token until the harness is relaunched (super::switch::finish_leaving).

Functions§

carry_for_block
Adds the gateway environment to the spawn of the agent on block_id when its definition has a route, and records the real model on the pane. Over whatever a persisted cmd:env carried: these are reserved names, set by srv at every spawn.
choice_of
The route and model of the agent definition def_id, if it has chosen one.
env_for
The variables that point Claude Code at the gateway on route. The key is not among them: the token is the harness’s whole credential, and ANTHROPIC_API_KEY is emptied so no other key is used.
env_for_key_route
The variables that point Claude Code at the gateway’s key route: its address and the agent’s token. No model is named (the harness asks for the models it always does and the key’s account answers), and ANTHROPIC_API_KEY is emptied so no other key is used. The key is not among them: it stays in the keychain.
leaving
The route and model the agent has left but may still be running a turn on, if any.
model_on_route
The model the gateway sends the agent’s requests for route to: its chosen one, or, on a route it has just left, the one it was on, so a turn in flight finishes (see super::switch::finish_leaving). None: the agent is not set to it.
pane_meta
What the pane shows for a route and model.
set_choice
Saves the agent’s route and model after the shared validation, with the model made explicit.