/**
 * Session Backend Factory Module
 *
 * Provides factory functions for creating and accessing session backend instances.
 * Uses a singleton pattern to ensure only one backend instance is active at a time.
 *
 * @module session-backend.factory
 */
import { ISessionBackend, SessionBackendType } from './session-backend.interface.js';
/**
 * Create a new session backend instance.
 *
 * This function creates a new backend instance based on the specified type.
 * If a backend already exists and is of a different type, the existing
 * backend will be destroyed before creating the new one.
 *
 * @param type - Type of backend to create. Defaults to 'pty'.
 * @returns The created session backend instance
 * @throws Error if the backend type is not supported or creation fails
 *
 * @example
 * ```typescript
 * // Create a PTY backend (default)
 * const backend = await createSessionBackend();
 *
 * // Create a specific backend type
 * const ptyBackend = await createSessionBackend('pty');
 * ```
 */
export declare function createSessionBackend(type?: SessionBackendType): Promise<ISessionBackend>;
/**
 * Get the singleton session backend instance.
 *
 * Returns the currently active session backend instance, or creates a new
 * PTY backend if none exists.
 *
 * @returns The session backend instance
 * @throws Error if no backend exists and creation fails
 *
 * @example
 * ```typescript
 * const backend = await getSessionBackend();
 * const session = await backend.createSession('my-session', options);
 * ```
 */
export declare function getSessionBackend(): Promise<ISessionBackend>;
/**
 * Get the singleton session backend instance synchronously.
 *
 * Returns the currently active session backend instance, or null if none exists.
 * This is useful for checking if a backend has been initialized without
 * triggering creation.
 *
 * @returns The session backend instance if it exists, null otherwise
 *
 * @example
 * ```typescript
 * const backend = getSessionBackendSync();
 * if (backend) {
 *   console.log('Backend is initialized');
 * } else {
 *   console.log('No backend initialized yet');
 * }
 * ```
 */
export declare function getSessionBackendSync(): ISessionBackend | null;
/**
 * Get the type of the currently active backend.
 *
 * @returns The backend type if one is active, null otherwise
 *
 * @example
 * ```typescript
 * const type = getSessionBackendType();
 * console.log('Current backend type:', type ?? 'none');
 * ```
 */
export declare function getSessionBackendType(): SessionBackendType | null;
/**
 * Destroy the current session backend and release resources.
 *
 * This function destroys the singleton backend instance, killing all
 * active sessions and releasing any held resources.
 *
 * @returns Promise that resolves when destruction is complete
 *
 * @example
 * ```typescript
 * await destroySessionBackend();
 * console.log('Backend destroyed');
 * ```
 */
export declare function destroySessionBackend(): Promise<void>;
/**
 * Check if a session backend is currently initialized.
 *
 * @returns true if a backend exists, false otherwise
 *
 * @example
 * ```typescript
 * if (isSessionBackendInitialized()) {
 *   console.log('Backend is ready');
 * }
 * ```
 */
export declare function isSessionBackendInitialized(): boolean;
/**
 * Reset the factory state (for testing purposes).
 *
 * This function resets the internal factory state without destroying
 * the backend. Use with caution - this is primarily for testing.
 *
 * @internal
 */
export declare function resetSessionBackendFactory(): void;
/**
 * Set the session backend instance (for testing purposes).
 *
 * This function allows injecting a mock backend for testing.
 * Use with caution - this is primarily for testing.
 *
 * @param backend - The backend instance to set
 * @param type - The type of the backend
 * @internal
 */
export declare function setSessionBackendForTesting(backend: ISessionBackend | null, type: SessionBackendType | null): void;
//# sourceMappingURL=session-backend.factory.d.ts.map