/**
 * @fileoverview Session Manager for coordinating multiple Claude sessions.
 *
 * Lifecycle management for Claude CLI sessions:
 * - Session creation with working directory, concurrent session limits (mutex-guarded)
 * - Event forwarding from individual sessions to subscribers
 * - State persistence via StateStore
 * - Graceful shutdown of all sessions
 *
 * Key exports:
 * - `SessionManager` class — coordinator, extends EventEmitter
 * - `SessionManagerEvents` interface — typed event map
 * - `getSessionManager()` — singleton accessor
 *
 * Key methods: `createSession(workingDir)`, `getSession(id)`, `getAllSessions()`,
 * `removeSession(id)`, `stopAll()`
 *
 * @dependencies session (Session class), state-store (persistence), types (SessionState)
 * @consumedby web/server, ralph-loop, respawn-controller
 * @emits sessionStarted, sessionStopped, sessionError, sessionOutput, sessionCompletion
 *
 * @module session-manager
 */
import { EventEmitter } from 'node:events';
import { Session } from './session.js';
import { SessionState } from './types.js';
export declare class SessionManager extends EventEmitter {
    private sessions;
    private sessionHandlers;
    private store;
    private _sessionCreationLock;
    /**
     * Creates a new SessionManager and loads previous session state.
     */
    constructor();
    private loadFromStore;
    /**
     * Creates and starts a new Claude session.
     * Uses mutex to prevent race conditions when multiple requests arrive simultaneously.
     *
     * @param workingDir - Working directory for the session
     * @returns The newly created session
     * @throws Error if max concurrent sessions limit reached
     */
    createSession(workingDir: string): Promise<Session>;
    /**
     * Stops a session by ID.
     *
     * @param id - Session ID to stop
     */
    stopSession(id: string): Promise<void>;
    /**
     * Stops all active sessions.
     * Uses Promise.allSettled to ensure all sessions are stopped even if some fail.
     */
    stopAllSessions(): Promise<void>;
    /**
     * Gets a session by ID.
     * @param id - Session ID
     * @returns The session or undefined if not found
     */
    getSession(id: string): Session | undefined;
    /** Gets all active sessions. */
    getAllSessions(): Session[];
    /** Gets all sessions currently idle (not processing). */
    getIdleSessions(): Session[];
    /** Gets all sessions currently busy (processing). */
    getBusySessions(): Session[];
    /** Gets the count of active sessions. */
    getSessionCount(): number;
    /** Checks if a session exists by ID. */
    hasSession(id: string): boolean;
    private updateSessionState;
    /** Gets all sessions from persistent storage (including stopped). */
    getStoredSessions(): Record<string, SessionState>;
    /**
     * Sends input to a session.
     *
     * @param sessionId - Session ID to send to
     * @param input - Input string to send
     * @throws Error if session not found
     */
    sendToSession(sessionId: string, input: string): Promise<void>;
    /** Gets the output buffer for a session. */
    getSessionOutput(sessionId: string): string | null;
    /** Gets the error buffer for a session. */
    getSessionError(sessionId: string): string | null;
}
/**
 * Gets or creates the singleton SessionManager instance.
 * @returns The global SessionManager
 */
export declare function getSessionManager(): SessionManager;
//# sourceMappingURL=session-manager.d.ts.map