Skip to content

Interface: InterceptorContext

The handle passed to each interceptor.

import { appkit } from "@dbx-tools/appkit";
await appkit.createApp({
plugins: [server()],
interceptor: (ctx) => {
const portr = spawnPortr(ctx.env.databricksHost);
ctx.bindProcess(portr); // app <-> portr live/die together
ctx.onLifecycle("shutdown", () => portr.kill("SIGTERM"));
},
});

readonly env: ResolvedAppEnv

The env auto-configuration computed before boot.

bindProcess(child): void

Supervise a child process alongside the app, concurrently-style: signals pass through, and if EITHER the child or the app dies the whole set comes down. Safe to call for several children; teardown is idempotent.

BindableProcess

void


broadcastSignal(signal): void

Broadcast a termination signal from the main app to every bound process. Called automatically when this process receives SIGINT/SIGTERM/SIGHUP; exposed so an interceptor can trigger teardown itself.

Signals

void


onLifecycle(event, fn): void

Subscribe to an AppKit lifecycle event. Mirrors PluginContext.onLifecycle; the injected lifecycleBridge relays the real events here once the app boots. A handler registered for an event that already fired is NOT called retroactively (same semantics as AppKit).

LifecycleEvent

LifecycleHandler

void