import type { TerminalRuntimeSession } from "../../../core/extensions/builtin/terminal/runtime-session.ts";
export type MachineLifecycle = "starting" | "running" | "waiting_input" | "exited" | "killed" | "lost";
export declare const MACHINE_LIFECYCLES: readonly MachineLifecycle[];
export declare const ENDED: readonly MachineLifecycle[];
export declare const ended: (state: MachineLifecycle) => boolean;
export type HandleExit = Readonly<{
    exitCode: number | null;
    signal: string | null;
}>;
export type HandleEvent = Readonly<{
    kind: "output";
    seq: number;
    bytes: Uint8Array;
}> | Readonly<{
    kind: "state";
    state: MachineLifecycle;
}> | Readonly<{
    kind: "idle";
    foreground: boolean | null;
}>;
export type After = (ms: number, fn: () => void) => () => void;
export interface LiveHandleInit {
    readonly id: string;
    readonly sender: string;
    readonly runtime: TerminalRuntimeSession;
    readonly after: After;
}
export declare function createLiveHandle(init: LiveHandleInit): {
    id: string;
    pid: number | undefined;
    sender: string;
    startedMs: number;
    state: () => MachineLifecycle;
    exit: () => HandleExit | null;
    produced: () => number;
    retainedFrom: () => number;
    /** The retained bytes from `seq` (or from the oldest retained byte, when `seq` is older) to the end. */
    since: (seq: number) => Uint8Array;
    quiet: () => boolean;
    bracketedPaste: () => boolean;
    on: (listener: (e: HandleEvent) => void) => (() => void);
    write: (bytes: Uint8Array) => void;
    markKilled: () => void;
    ended: Promise<void>;
    dispose: () => void;
};
export type LiveHandle = ReturnType<typeof createLiveHandle>;
//# sourceMappingURL=live-handle.d.ts.map