BlaiseBlaise
Documentation
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.

  • onSession wraps one run of the session. Code before next() attaches the plug's resources, and code after it pauses them, in reverse order.
  • onTeardown wraps the destruction of the environment, once the session is over.
  • onMessage wraps 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

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.

On this page