/**
 * SandboxStrategy — port interface for isolated agent execution environments.
 *
 * Three implementations, selected by task config with automatic fallback:
 *
 * - DockerSandboxStrategy — full isolation via Docker containers
 * - TempDirSandboxStrategy — lightweight fallback using OS temp directories
 * - GitWorktreeSandboxStrategy — uses `git worktree` for repo-based tasks
 *
 * Selection: task config specifies preferred strategy; runtime falls back
 * Docker → TempDir if Docker is unavailable. CI environments prefer Docker.
 *
 * @see docs/archive/exec-plans/architecture-overhaul/phase-4-agent-harness.md
 */
/** Metadata describing a provisioned sandbox */
export interface SandboxInfo {
    /** Unique sandbox identifier */
    id: string;
    /** Absolute path to the sandbox working directory */
    workingDir: string;
    /** Which strategy created this sandbox */
    strategy: SandboxType;
    /** Docker container ID (when strategy is "docker") */
    containerId?: string;
    /** Git worktree ref (when strategy is "git-worktree") */
    gitRef?: string;
    /** Timestamp when the sandbox was provisioned */
    createdAt: string;
}
/** Supported sandbox strategies */
export type SandboxType = "docker" | "git-worktree" | "none" | "tempdir";
/** Configuration for sandbox provisioning */
export interface SandboxProvisionOptions {
    /** Sandbox type to use */
    type: SandboxType;
    /** Task ID (used for naming) */
    taskId: string;
    /** Docker image (for docker strategy) */
    image?: string;
    /** Resource limits */
    limits?: {
        cpus?: number;
        memoryBytes?: number;
        diskBytes?: number;
        networkAccess?: boolean;
    };
    /** Git ref for git-worktree strategy */
    gitRef?: string;
    /** Git repo path for git-worktree strategy */
    repoPath?: string;
}
/** Artifacts collected from sandbox after execution */
export interface SandboxArtifacts {
    /** Files modified during execution (relative paths) */
    modifiedFiles: string[];
    /** Git diff output (if applicable) */
    diff?: string;
    /** Stdout/stderr captured during execution */
    output?: string;
    /** Total execution time in milliseconds */
    durationMs: number;
}
/**
 * Port interface for sandbox lifecycle management.
 *
 * Implementations handle the full lifecycle: provision → use → collect → teardown.
 */
export interface SandboxStrategy {
    /** Human-readable strategy name */
    readonly name: string;
    /** Strategy type identifier */
    readonly type: SandboxType;
    /** Check if this strategy is available in the current environment */
    isAvailable(): Promise<boolean>;
    /** Provision a new sandbox environment */
    provision(options: SandboxProvisionOptions): Promise<SandboxInfo>;
    /** Collect artifacts from the sandbox after execution */
    collectArtifacts(sandbox: SandboxInfo): Promise<SandboxArtifacts>;
    /** Tear down the sandbox (remove files, stop containers) */
    teardown(sandbox: SandboxInfo): Promise<void>;
}
