/**
 * Agent Workspace
 *
 * Provides isolated workspaces for agents with separate
 * file access, environment, and state management.
 */
import { EventEmitter } from 'events';
import type { AgentConfig, AgentSession } from './agent-config.js';
/**
 * Workspace state
 */
export interface WorkspaceState {
    /** Working directory */
    workingDirectory: string;
    /** Environment variables */
    environment: Record<string, string>;
    /** Active files (open or modified) */
    activeFiles: Set<string>;
    /** Custom state */
    state: Record<string, unknown>;
}
/**
 * Workspace configuration
 */
export interface WorkspaceConfig {
    /** Base directory for workspace isolation */
    baseDir: string;
    /** Whether to create isolated temp directories */
    isolateTempDir: boolean;
    /** Whether to track file access */
    trackFileAccess: boolean;
    /** Maximum active files */
    maxActiveFiles: number;
}
/**
 * Default workspace configuration
 */
export declare const DEFAULT_WORKSPACE_CONFIG: WorkspaceConfig;
/**
 * Isolated workspace for an agent
 */
export declare class AgentWorkspace extends EventEmitter {
    private config;
    private workspaceConfig;
    private session;
    private state;
    private workspaceDir;
    private initialized;
    constructor(agentConfig: AgentConfig, sessionId: string, workspaceConfig?: Partial<WorkspaceConfig>);
    /**
     * Initialize workspace
     */
    initialize(): Promise<void>;
    /**
     * Get session info
     */
    getSession(): AgentSession;
    /**
     * Get agent config
     */
    getAgentConfig(): AgentConfig;
    /**
     * Get workspace directory
     */
    getWorkspaceDir(): string;
    /**
     * Get working directory
     */
    getWorkingDirectory(): string;
    /**
     * Set working directory
     */
    setWorkingDirectory(dir: string): void;
    /**
     * Get environment
     */
    getEnvironment(): Record<string, string>;
    /**
     * Set environment variable
     */
    setEnvironmentVariable(key: string, value: string): void;
    /**
     * Track file access
     */
    trackFile(filePath: string): void;
    /**
     * Get active files
     */
    getActiveFiles(): string[];
    /**
     * Get/set custom state
     */
    getState<T = unknown>(key: string): T | undefined;
    setState<T>(key: string, value: T): void;
    /**
     * Update last activity timestamp
     */
    private updateActivity;
    /**
     * Check if session is expired
     */
    isExpired(): boolean;
    /**
     * Save workspace state to disk
     */
    saveState(): Promise<void>;
    /**
     * Load workspace state from disk
     */
    loadState(): Promise<boolean>;
    /**
     * Clean up workspace
     */
    cleanup(): Promise<void>;
    /**
     * Destroy workspace (remove all data)
     */
    destroy(): Promise<void>;
}
/**
 * Manages multiple agent workspaces
 */
export declare class WorkspaceManager extends EventEmitter {
    private workspaces;
    private config;
    private cleanupTimer;
    constructor(config?: Partial<WorkspaceConfig>);
    /**
     * Create workspace for an agent
     */
    createWorkspace(agentConfig: AgentConfig, sessionId?: string): Promise<AgentWorkspace>;
    /**
     * Get workspace by session key
     */
    getWorkspace(sessionKey: string): AgentWorkspace | undefined;
    /**
     * Get workspace by agent ID (returns first active)
     */
    getWorkspaceByAgent(agentId: string): AgentWorkspace | undefined;
    /**
     * Get all workspaces for an agent
     */
    getWorkspacesForAgent(agentId: string): AgentWorkspace[];
    /**
     * Remove workspace
     */
    removeWorkspace(sessionKey: string, destroy?: boolean): Promise<boolean>;
    /**
     * Clean up expired workspaces
     */
    cleanupExpired(): Promise<number>;
    /**
     * Get all active workspaces
     */
    getActiveWorkspaces(): AgentWorkspace[];
    /**
     * Load existing workspace from disk
     */
    loadWorkspace(agentConfig: AgentConfig, sessionId: string): Promise<AgentWorkspace | null>;
    /**
     * Clear all workspaces
     */
    clearAll(destroy?: boolean): Promise<void>;
    /**
     * Dispose manager
     */
    dispose(): Promise<void>;
}
/**
 * Get or create WorkspaceManager singleton
 */
export declare function getWorkspaceManager(config?: Partial<WorkspaceConfig>): WorkspaceManager;
/**
 * Reset WorkspaceManager singleton
 */
export declare function resetWorkspaceManager(): Promise<void>;
