import type { TerminalState } from "@kong-link/protocol/messages";
export interface TerminalExitInfo {
    exitCode: number | null;
    signal: number | null;
    lastOutputLines: string[];
}
export interface TerminalCommandFinishedInfo {
    exitCode: number | null;
}
export interface TerminalStateSnapshot {
    state: TerminalState;
    revision: number;
}
export interface TerminalStateSnapshotOptions {
    scrollbackLines?: number;
    includeWrapFlags?: boolean;
}
export interface TerminalSubscribeOptions {
    initialSnapshot?: "state" | "ready";
}
export type ClientMessage = {
    type: "input";
    data: string;
} | {
    type: "resize";
    rows: number;
    cols: number;
} | {
    type: "mouse";
    row: number;
    col: number;
    button: number;
    action: "down" | "up" | "move";
};
export type ServerMessage = {
    type: "output";
    data: string;
    revision?: number;
} | {
    type: "snapshot";
    state: TerminalState;
    revision?: number;
} | {
    type: "snapshotReady";
    revision?: number;
} | {
    type: "titleChange";
    title?: string;
};
export interface TerminalSession {
    id: string;
    name: string;
    cwd: string;
    send(msg: ClientMessage): void;
    subscribe(listener: (msg: ServerMessage) => void, options?: TerminalSubscribeOptions): () => void;
    onExit(listener: (info: TerminalExitInfo) => void): () => void;
    onCommandFinished(listener: (info: TerminalCommandFinishedInfo) => void): () => void;
    onTitleChange(listener: (title?: string) => void): () => void;
    getSize(): {
        rows: number;
        cols: number;
    };
    getState(): TerminalState;
    getStateSnapshot(options?: TerminalStateSnapshotOptions): TerminalStateSnapshot;
    getReplayPreamble(): string;
    getTitle(): string | undefined;
    setTitle(title: string): void;
    getExitInfo(): TerminalExitInfo | null;
    kill(): void;
    killAndWait(options?: {
        gracefulTimeoutMs?: number;
        forceTimeoutMs?: number;
    }): Promise<void>;
}
export interface CreateTerminalOptions {
    id?: string;
    cwd: string;
    shell?: string;
    env?: Record<string, string>;
    rows?: number;
    cols?: number;
    name?: string;
    title?: string;
    command?: string;
    args?: string[];
}
interface BuildTerminalEnvironmentInput {
    shell: string;
    env: Record<string, string>;
    zshShellIntegrationDir?: string;
}
interface EnsureNodePtySpawnHelperExecutableOptions {
    packageRoot?: string;
    platform?: NodeJS.Platform;
    arch?: string;
    force?: boolean;
}
export declare function ensureNodePtySpawnHelperExecutableForCurrentPlatform(options?: EnsureNodePtySpawnHelperExecutableOptions): void;
export declare function resolveDefaultTerminalShell(options?: {
    platform?: NodeJS.Platform;
    env?: NodeJS.ProcessEnv;
}): string;
export declare function resolveZshShellIntegrationDir(): string;
export declare function buildTerminalEnvironment(input: BuildTerminalEnvironmentInput): Record<string, string>;
export declare function normalizeProcessTitle(processTitle: string): string | undefined;
export declare function humanizeProcessTitle(processTitle: string): string | undefined;
export declare function createTerminal(options: CreateTerminalOptions): Promise<TerminalSession>;
export {};
//# sourceMappingURL=terminal.d.ts.map