/** * Process-level shutdown handlers. * * Pi's `session_shutdown` event fires on normal session-end paths, but not when * the host Node process is killed by SIGTERM/SIGINT/SIGHUP. Without explicit * cleanup, OS propagates the signal to our `aft` children through the process * group, the bridge's `exit` handler fires, and (before the sibling fix in * bridge.ts) it would auto-restart into orphaned processes. * * This is a mirror of packages/opencode-plugin/src/shutdown-hooks.ts. The * `globalThis` guard ensures OS-level signal handlers are installed exactly * once per Node process, even if the Pi extension loads multiple times. */ type Cleanup = () => Promise | void; /** Conventional exit codes for fatal signals (128 + signal number). */ export declare const SIGNAL_EXIT_CODES: { readonly SIGINT: 130; readonly SIGTERM: 143; readonly SIGHUP: 129; }; /** * Registering ANY listener for SIGINT/SIGTERM/SIGHUP disables Node/Bun's * default terminate-on-signal behavior. If AFT's listener is the only one, * the default was suppressed solely by us, so we must exit or the host hangs * forever. If the host or another extension also listens, terminating is * their call. Mirror of the OpenCode plugin's shutdown-hooks contract. */ export declare function shouldForceExit(otherListenerCount: number): boolean; /** Register a shutdown cleanup. Returns an unregister function. */ export declare function registerShutdownCleanup(fn: Cleanup): () => void; export declare function __shutdownCleanupCountForTests(): number; export declare function __resetShutdownCleanupsForTests(): void; export {}; //# sourceMappingURL=shutdown-hooks.d.ts.map