import { type ChildProcess } from "node:child_process";
import type { SandboxProfile } from "@best-agent/protocol";
export interface SpawnCommandOptions {
    debugId?: string;
    disableSandbox?: boolean;
    denyNetwork?: boolean;
    denyWrites?: boolean;
    stdio?: ["ignore" | "pipe", "pipe", "pipe"] | ["pipe", "pipe", "pipe"];
}
export interface RunCommandOptions {
    onHeartbeat?: () => void;
    onOutput?: (output: {
        stream: "stderr" | "stdout";
        text: string;
    }) => void;
    sandboxProfile?: SandboxProfile;
    signal?: AbortSignal;
    timeoutMs?: number;
}
export interface CommandCaptureResult {
    aborted?: boolean;
    exitCode: number | null;
    signalCode?: NodeJS.Signals | null;
    stderr: string;
    stdout: string;
    timedOut: boolean;
}
export interface ProcessSessionSnapshot {
    command: string;
    cwd: string;
    exitCode: number | null;
    id: string;
    signalCode?: NodeJS.Signals | null;
    status: "running" | "completed";
    stderr: string;
    stdout: string;
}
export interface TextFileRangeLine {
    content: string;
    truncated: boolean;
}
export declare class LocalSandbox {
    #private;
    close(): Promise<void>;
    exists(path: string): boolean;
    isDirectory(path: string): boolean;
    readTextFile(path: string): Promise<string>;
    /**
     * Sample the first bytes of a file to detect binary content (NUL bytes).
     * Returns true for likely-binary files that should not be read as text.
     */
    looksLikeBinary(path: string): boolean;
    statFile(path: string): {
        bytes: number;
    };
    inspectTextFile(path: string, options: {
        headLines: number;
        tailLines: number;
        maxCharsPerLine?: number;
    }): Promise<{
        bytes: number;
        headLines: string[];
        tailLines: string[];
        totalLines: number;
    }>;
    readTextFileRange(path: string, startLine: number, endLine: number, options?: {
        maxCharsPerLine?: number;
    }): Promise<{
        endLine: number;
        lines: TextFileRangeLine[];
    }>;
    writeTextFile(path: string, content: string): Promise<void>;
    appendTextFile(path: string, content: string): Promise<void>;
    runCommand(argv: string[], cwd: string, options?: RunCommandOptions): Promise<string>;
    runMutableCommand(argv: string[], cwd: string, options?: RunCommandOptions): Promise<string>;
    runCommandCapture(argv: string[], cwd: string, options?: RunCommandOptions): Promise<CommandCaptureResult>;
    private runCapturedCommandResult;
    startProcessSession(argv: string[], cwd: string, command: string, options?: {
        sandboxProfile?: SandboxProfile;
    }): ProcessSessionSnapshot;
    readProcessSession(id: string, options?: {
        maxBytes?: number;
        signal?: AbortSignal;
        waitMs?: number;
        wakeOnOutput?: boolean;
    }): Promise<ProcessSessionSnapshot>;
    writeProcessSession(id: string, input: string): void;
    stopProcessSession(id: string): Promise<ProcessSessionSnapshot>;
    spawnCommand(argv: string[], cwd: string, options?: SpawnCommandOptions): ChildProcess;
}
//# sourceMappingURL=local-sandbox.d.ts.map