/** * Container Manager - Docker container lifecycle management * * Handles creating, monitoring, and destroying Docker containers for explorations. * Uses SafeExecutor.execute (spawn with an argument array, no shell) throughout — * container names, images, and especially exploration environment variables * (which carry the user-supplied `` text) are never interpolated into a * shell command string, so shell metacharacters in any of them cannot inject * additional commands. */ import type { ContainerStats } from '../types/exploration.types.js'; export interface ContainerConfig { command?: string[]; container_name: string; cpu_limit: string; environment: Record; image: string; memory_limit: string; port?: number; shared_volume_path: string; worktree_path: string; } export interface ContainerInfo { container_id: string; container_name: string; exit_code?: number; finished_at?: string; started_at?: string; status: 'created' | 'dead' | 'exited' | 'paused' | 'running'; } export declare class ContainerManager { private containers; constructor(); /** * Create and start a container */ createContainer(config: ContainerConfig): Promise; /** Build the `docker run` argument array for createContainer(). Split out to keep that method's complexity down. */ private buildCreateContainerArgs; /** * Create multiple containers in parallel */ createMultipleContainers(configs: ContainerConfig[]): Promise; /** * Stop a container */ stopContainer(containerName: string, timeout?: number): Promise; /** * Stop multiple containers in parallel */ stopMultipleContainers(containerNames: string[], timeout?: number): Promise; /** * Remove a container */ removeContainer(containerName: string, force?: boolean): Promise; /** * Remove multiple containers in parallel */ removeMultipleContainers(containerNames: string[], force?: boolean): Promise; /** * Get container status */ getContainerStatus(containerName: string): Promise; /** * Get container statistics */ getContainerStats(containerName: string, worktreeIndex: number): Promise; /** * Get statistics for multiple containers */ getMultipleContainerStats(containerNames: string[], worktreeIndices: number[]): Promise; /** * Get container logs */ getContainerLogs(containerName: string, tail?: number): Promise; /** * Execute a command in a running container */ execInContainer(containerName: string, command: string[]): Promise<{ stderr: string; stdout: string; }>; /** * Check if a container exists */ containerExists(containerName: string): Promise; /** * Wait for container to exit */ waitForContainer(containerName: string, timeout?: number): Promise; /** * Pull Docker image if not present */ pullImageIfNeeded(image: string): Promise; /** * Pause a container */ pauseContainer(containerName: string): Promise; /** * Unpause a container */ unpauseContainer(containerName: string): Promise; /** * Kill a container (force stop) */ killContainer(containerName: string, signal?: string): Promise; /** * Get all tracked containers */ getTrackedContainers(): ContainerInfo[]; /** * Clear tracking for a container */ untrackContainer(containerName: string): void; /** * Clear all tracking */ clearTracking(): void; /** * Parse memory string (e.g., "256MiB", "2GiB") to MB */ private parseMemoryString; /** * Calculate uptime in seconds */ private calculateUptime; } //# sourceMappingURL=container-manager.d.ts.map