import type { protocol, IPitcherClient } from "@codesandbox/pitcher-client";
import { Disposable } from "../../utils/disposable";
type ShellSize = {
    cols: number;
    rows: number;
};
export type ShellRunOpts = {
    dimensions?: ShellSize;
    name?: string;
    env?: Record<string, string>;
    cwd?: string;
};
export type CommandStatus = "RUNNING" | "FINISHED" | "ERROR" | "KILLED" | "RESTARTING";
export declare class Commands {
    private pitcherClient;
    private env;
    private disposable;
    constructor(sessionDisposable: Disposable, pitcherClient: IPitcherClient, env?: Record<string, string>);
    /**
     * Create and run command in a new shell. Allows you to listen to the output and kill the command.
     */
    runBackground(command: string | string[], opts?: ShellRunOpts): Promise<Command>;
    /**
     * Run a command in a new shell and wait for it to finish, returning its output.
     */
    run(command: string | string[], opts?: ShellRunOpts): Promise<string>;
    /**
     * Get all running commands.
     */
    getAll(): Command[];
}
export declare function isCommandShell(shell: protocol.shell.ShellDTO): shell is protocol.shell.CommandShellDTO;
export declare class Command {
    private pitcherClient;
    private shell;
    private disposable;
    private onOutputEmitter;
    /**
     * An event that is emitted when the command outputs something.
     */
    readonly onOutput: import("../../utils/event").Event<string>;
    private onStatusChangeEmitter;
    /**
     * An event that is emitted when the command status changes.
     */
    readonly onStatusChange: import("../../utils/event").Event<CommandStatus>;
    private barrier;
    private output;
    /**
     * The status of the command.
     */
    status: CommandStatus;
    /**
     * The command that was run
     */
    command: string;
    /**
     * The name of the command
     */
    name?: string;
    constructor(pitcherClient: IPitcherClient, shell: protocol.shell.ShellDTO & {
        buffer?: string[];
    }, details: {
        command: string;
        name?: string;
    });
    /**
     * Open the command and get its current output, subscribes to future output
     */
    open(dimensions?: {
        cols: number;
        rows: number;
    }): Promise<string>;
    /**
     * Wait for the command to finish with its returned output
     */
    waitUntilComplete(): Promise<string>;
    /**
     * Kill the command and remove it from the session.
     */
    kill(): Promise<void>;
    /**
     * Restart the command.
     */
    restart(): Promise<void>;
}
export {};
