Skip to content

interceptor

The createApp INTERCEPTOR context: an in-process handle an app hands to add-ons (the tunnel, chiefly) so they can read the env auto-configuration computed, hook AppKit’s lifecycle, and supervise sibling child processes as one unit - concurrently-style, where any death takes the whole set down.

An interceptor is a plain function (ctx) => void | Promise<void> passed to appkit.createApp’s interceptor option (“one or many”). appkit.createApp runs each one AFTER auto-configuration has populated process.env but as part of booting the app, so an interceptor sees the resolved connection and can bind processes before or during setup.

The names here mirror AppKit’s own vocabulary rather than inventing parallel ones: LifecycleEvent and InterceptorContext.onLifecycle are the exact shape of PluginContext.onLifecycle (setup:complete / server:ready / shutdown). The bridge that makes that hook reachable from OUTSIDE a plugin - where interceptors run - is lifecycleBridge, a tiny internal plugin appkit.createApp injects to capture this.context and relay its events.