Runner and PlugsExplanation
Explanation
How plugs wrap a session, how a session lives between messages, and why.
Plugs wrap each other
Plugs are listed under setup and nest in that order: the first plug wraps all the others. Each
plug has up to three handlers, and each handler receives a next function that runs everything
inside it.
onSessionwraps one run of the session. Code beforenext()attaches the plug's resources, and code after it pauses them, in reverse order.onTeardownwraps the destruction of the environment, once the session is over.onMessagewraps every message of the Agent Client Protocol, in both directions.
A plug that does not define a handler is transparent for that event.
The pages
- How sessions find a runner: runners, instances, labels and requirements, queued work, and where a paused session resumes.
- Why plugs are stateless first: plugs derive what they need from the session id, and keep state only for what cannot be derived.
- Why time belongs to Blaise: idle detection, pausing and timeouts are agent settings that Blaise enforces.
- The security model: what plugs can do, what the agent sees, and which protections come from the host.
- Design alternatives: what was considered and why it lost.
For the whole picture, read How plugs wrap a session (the chain, the message proxy and hosts) and The life of a session (runs, pause and resume, teardown and what happens when something fails).
Hosts and where code runs covers what a host is, what runs where, why the runner token never reaches a host, and what each kind of host protects.