import type { SlashCommand } from '@wrongstack/core/types'; /** * Arguments passed to `createExitSlashCommand`. The handler runs inside the * TUI shell, so it owns the lifecycle of in-flight subagents and the exit * decision; the dispatcher above only knows how to bridge the prompt. */ export interface CreateExitSlashCommandOptions { /** True while the leader agent.run() loop is still active. */ isLeaderActive: () => boolean; /** Number of subagents currently in the running state. */ countRunningSubagents: () => number; /** Number of detached jobs that will be preserved when the TUI exits. */ countBackgroundProcesses?: (() => number) | undefined; /** * Bridge into the TUI's `exitConfirm` reducer slot. Returns the user's * decision (`true` to exit, `false` to cancel). When no work is active, * the bridge returns `true` synchronously so the slash command resolves * to `{ exit: true }` without opening the modal. */ confirmExit: (info: { leaderActive: boolean; subagentCount: number; backgroundCount?: number | undefined; }) => Promise; /** * Original host-owned `/exit` handler. It owns pre-exit checks and process * teardown (MCP, fleet host, plugin handlers); the TUI only adds its active * work confirmation in front of that lifecycle. */ runExitLifecycle?: SlashCommand['run'] | undefined; } /** * Register `/exit` as a TUI slash command. The confirmation panel mirrors * the `/clear` invariant: never tear down in-flight work silently. * * The TUI slash dispatcher recognises the `exit: true` flag (it then * asks Ink to unmount and runs the graceful exit). We only return that * flag after the user has explicitly confirmed (or there is nothing to * confirm), so an accidental `/exit` while work is active becomes a * harmless "Exit cancelled." instead of an immediate teardown. */ export declare function createExitSlashCommand(opts: CreateExitSlashCommandOptions): SlashCommand; //# sourceMappingURL=exit-slash.d.ts.map