/**
 * Sandboxed Terminal
 *
 * Provides secure, isolated terminal execution with:
 * - Network isolation (optional)
 * - Filesystem restrictions
 * - Resource limits
 * - Process isolation
 *
 * Inspired by Cursor 2.0's sandboxed terminals.
 */
import { ChildProcess } from 'child_process';
import { EventEmitter } from 'events';
export interface SandboxTerminalConfig {
    networkEnabled: boolean;
    allowedDomains?: string[];
    workspaceRoot: string;
    readOnlyPaths: string[];
    allowedWritePaths: string[];
    blockedPaths: string[];
    maxMemoryMB: number;
    maxCpuPercent: number;
    maxProcesses: number;
    timeoutMs: number;
    maxOutputSize: number;
    shell: string;
    env: Record<string, string>;
    method: 'none' | 'namespace' | 'firejail' | 'docker' | 'bubblewrap';
}
export interface SandboxExecResult {
    stdout: string;
    stderr: string;
    exitCode: number;
    timedOut: boolean;
    killed: boolean;
    sandboxed: boolean;
    method: string;
    duration: number;
    resourceUsage?: {
        cpuTime: number;
        maxMemory: number;
    };
}
export interface SandboxSession {
    id: string;
    process: ChildProcess | null;
    config: SandboxTerminalConfig;
    startTime: number;
    commandHistory: string[];
    cwd: string;
}
/**
 * Sandboxed Terminal Manager
 */
export declare class SandboxedTerminal extends EventEmitter {
    private config;
    private sessions;
    private availableMethods;
    private sessionCounter;
    constructor(config?: Partial<SandboxTerminalConfig>);
    /**
     * Detect available sandboxing methods
     */
    private detectAvailableMethods;
    /**
     * Check if a command exists
     */
    private checkCommand;
    /**
     * Validate command before execution
     */
    validateCommand(command: string): {
        valid: boolean;
        reason?: string;
    };
    /**
     * Execute command in sandbox
     */
    execute(command: string, options?: Partial<SandboxTerminalConfig>): Promise<SandboxExecResult>;
    /**
     * Select best available sandbox method
     */
    private selectMethod;
    /**
     * Execute with Linux namespaces (unshare)
     */
    private executeWithNamespace;
    /**
     * Execute with firejail
     */
    private executeWithFirejail;
    /**
     * Execute with bubblewrap
     */
    private executeWithBubblewrap;
    /**
     * Execute with Docker
     */
    private executeWithDocker;
    /**
     * Execute without sandbox (fallback)
     */
    private executeNative;
    /**
     * Raw command execution
     */
    private executeRaw;
    /**
     * Create an interactive sandbox session
     */
    createSession(config?: Partial<SandboxTerminalConfig>): SandboxSession;
    /**
     * Execute in session
     */
    executeInSession(sessionId: string, command: string): Promise<SandboxExecResult>;
    /**
     * Close session
     */
    closeSession(sessionId: string): void;
    /**
     * Get available sandboxing methods
     */
    getAvailableMethods(): string[];
    /**
     * Format status
     */
    formatStatus(): string;
    /**
     * Update configuration
     */
    updateConfig(config: Partial<SandboxTerminalConfig>): void;
    /**
     * Get configuration
     */
    getConfig(): SandboxTerminalConfig;
}
export declare function getSandboxedTerminal(config?: Partial<SandboxTerminalConfig>): SandboxedTerminal;
export declare function resetSandboxedTerminal(): void;
