/**
 * Workspace Manager - Isolation par workspace
 *
 * Permet d'isoler les sessions, checkpoints et configurations par projet.
 * Chaque projet (workspace) a son propre etat dans .grok/ ou dans ~/.codebuddy/workspaces/<hash>
 *
 * Detection automatique du root projet:
 * - .git directory
 * - package.json
 * - Cargo.toml
 * - go.mod
 * - pyproject.toml
 * - .grok/ directory (marker explicite)
 *
 * Structure:
 *   <project>/.grok/           # Config locale au projet
 *   ├── config.json            # Configuration du workspace
 *   ├── sessions/              # Sessions locales
 *   ├── checkpoints/           # Checkpoints locaux
 *   └── memory/                # Memoire locale
 *
 *   ~/.codebuddy/workspaces/   # Donnees globales par workspace
 *   └── <workspace-hash>/
 *       ├── sessions/
 *       ├── checkpoints/
 *       └── state.json
 */
import { EventEmitter } from 'events';
export interface WorkspaceInfo {
    /** Unique identifier for the workspace (hash of root path) */
    id: string;
    /** Human-readable name (directory name) */
    name: string;
    /** Absolute path to workspace root */
    rootPath: string;
    /** How the root was detected */
    detectedBy: WorkspaceRootMarker;
    /** Whether workspace has local .grok/ directory */
    hasLocalConfig: boolean;
    /** Timestamp of last access */
    lastAccessed: Date;
    /** Project type if detected */
    projectType?: string;
}
export interface WorkspaceState {
    /** Current session ID in this workspace */
    currentSessionId?: string;
    /** Last used model */
    lastModel?: string;
    /** Security mode for this workspace */
    securityMode?: 'suggest' | 'auto-edit' | 'full-auto';
    /** Agent mode for this workspace */
    agentMode?: 'plan' | 'code' | 'ask' | 'architect';
    /** Custom settings */
    settings?: Record<string, unknown>;
    /** Last accessed */
    lastAccessed: string;
}
export interface WorkspaceConfig {
    /** Use local .grok/ directory for workspace data */
    useLocalStorage: boolean;
    /** Automatically create .grok/ in new workspaces */
    autoCreateLocal: boolean;
    /** Root markers to search for */
    rootMarkers: WorkspaceRootMarker[];
    /** Maximum search depth for root detection */
    maxSearchDepth: number;
    /** Isolated data per workspace */
    isolateSessions: boolean;
    isolateCheckpoints: boolean;
    isolateMemory: boolean;
}
export type WorkspaceRootMarker = '.git' | 'package.json' | 'Cargo.toml' | 'go.mod' | 'pyproject.toml' | 'pom.xml' | 'build.gradle' | '.grok' | 'tsconfig.json' | '.hg' | '.svn';
export declare class WorkspaceManager extends EventEmitter {
    private config;
    private currentWorkspace;
    private workspaceCache;
    private globalDataDir;
    constructor(config?: Partial<WorkspaceConfig>);
    /**
     * Ensure global workspaces directory exists
     */
    private ensureGlobalDir;
    /**
     * Hash a path to create workspace ID
     */
    private hashPath;
    /**
     * Detect workspace root from a given directory
     */
    detectWorkspaceRoot(startDir?: string): {
        root: string;
        marker: WorkspaceRootMarker;
    } | null;
    /**
     * Initialize workspace from current directory
     */
    initializeWorkspace(startDir?: string): Promise<WorkspaceInfo>;
    /**
     * Create workspace info object
     */
    private createWorkspaceInfo;
    /**
     * Get current workspace
     */
    getCurrentWorkspace(): WorkspaceInfo | null;
    /**
     * Set current workspace
     */
    setCurrentWorkspace(workspace: WorkspaceInfo): void;
    /**
     * Switch to a different workspace by path
     */
    switchWorkspace(workspacePath: string): Promise<WorkspaceInfo>;
    /**
     * Get workspace data directory (local or global)
     */
    getWorkspaceDataDir(workspace?: WorkspaceInfo): string;
    /**
     * Get workspace sessions directory
     */
    getSessionsDir(workspace?: WorkspaceInfo): string;
    /**
     * Get workspace checkpoints directory
     */
    getCheckpointsDir(workspace?: WorkspaceInfo): string;
    /**
     * Get workspace memory directory
     */
    getMemoryDir(workspace?: WorkspaceInfo): string;
    /**
     * Initialize local .grok directory in workspace
     */
    initializeLocalConfig(workspace?: WorkspaceInfo): string;
    /**
     * Add .grok to .gitignore
     */
    private addToGitignore;
    /**
     * Load workspace state
     */
    loadWorkspaceState(workspace?: WorkspaceInfo): WorkspaceState | null;
    /**
     * Save workspace state
     */
    saveWorkspaceState(state: WorkspaceState, workspace?: WorkspaceInfo): void;
    /**
     * Update workspace state
     */
    updateWorkspaceState(updates: Partial<WorkspaceState>, workspace?: WorkspaceInfo): void;
    /**
     * Save to recent workspaces list
     */
    private saveRecentWorkspace;
    /**
     * Get recent workspaces
     */
    getRecentWorkspaces(): WorkspaceInfo[];
    /**
     * Format workspace info for display
     */
    formatWorkspaceInfo(workspace?: WorkspaceInfo): string;
    /**
     * Format recent workspaces list
     */
    formatRecentWorkspaces(): string;
    /**
     * Clean up orphaned workspace data
     */
    cleanupOrphanedWorkspaces(): number;
}
export declare function getWorkspaceManager(config?: Partial<WorkspaceConfig>): WorkspaceManager;
export declare function resetWorkspaceManager(): void;
/**
 * Initialize workspace from current directory
 */
export declare function initializeCurrentWorkspace(): Promise<WorkspaceInfo>;
/**
 * Get current workspace info
 */
export declare function getCurrentWorkspaceInfo(): WorkspaceInfo | null;
/**
 * Get workspace-aware sessions directory
 */
export declare function getWorkspaceSessionsDir(): string;
/**
 * Get workspace-aware checkpoints directory
 */
export declare function getWorkspaceCheckpointsDir(): string;
/**
 * Get workspace-aware memory directory
 */
export declare function getWorkspaceMemoryDir(): string;
