/**
 * @license
 * Copyright 2026 Google LLC
 * SPDX-License-Identifier: Apache-2.0
 */
import { type EnvironmentSanitizationConfig } from './environmentSanitization.js';
export interface SandboxPermissions {
    /** Filesystem permissions. */
    fileSystem?: {
        /** Paths that should be readable by the command. */
        read?: string[];
        /** Paths that should be writable by the command. */
        write?: string[];
    };
    /** Whether the command should have network access. */
    network?: boolean;
}
/**
 * Security boundaries and permissions applied to a specific sandboxed execution.
 */
export interface ExecutionPolicy {
    /** Additional absolute paths to grant full read/write access to. */
    allowedPaths?: string[];
    /** Absolute paths to explicitly deny read/write access to (overrides allowlists). */
    forbiddenPaths?: string[];
    /** Whether network access is allowed. */
    networkAccess?: boolean;
    /** Rules for scrubbing sensitive environment variables. */
    sanitizationConfig?: Partial<EnvironmentSanitizationConfig>;
    /** Additional granular permissions to grant to this command. */
    additionalPermissions?: SandboxPermissions;
}
/**
 * Global configuration options used to initialize a SandboxManager.
 */
export interface GlobalSandboxOptions {
    /**
     * The primary workspace path the sandbox is anchored to.
     * This directory is granted full read and write access.
     */
    workspace: string;
}
/**
 * Request for preparing a command to run in a sandbox.
 */
export interface SandboxRequest {
    /** The program to execute. */
    command: string;
    /** Arguments for the program. */
    args: string[];
    /** The working directory. */
    cwd: string;
    /** Environment variables to be passed to the program. */
    env: NodeJS.ProcessEnv;
    /** Policy to use for this request. */
    policy?: ExecutionPolicy;
}
/**
 * A command that has been prepared for sandboxed execution.
 */
export interface SandboxedCommand {
    /** The program or wrapper to execute. */
    program: string;
    /** Final arguments for the program. */
    args: string[];
    /** Sanitized environment variables. */
    env: NodeJS.ProcessEnv;
    /** The working directory. */
    cwd?: string;
}
/**
 * Interface for a service that prepares commands for sandboxed execution.
 */
export interface SandboxManager {
    /**
     * Prepares a command to run in a sandbox, including environment sanitization.
     */
    prepareCommand(req: SandboxRequest): Promise<SandboxedCommand>;
}
/**
 * Files that represent the governance or "constitution" of the repository
 * and should be write-protected in any sandbox.
 */
export declare const GOVERNANCE_FILES: readonly [{
    readonly path: ".gitignore";
    readonly isDirectory: false;
}, {
    readonly path: ".geminiignore";
    readonly isDirectory: false;
}, {
    readonly path: ".git";
    readonly isDirectory: true;
}];
/**
 * A no-op implementation of SandboxManager that silently passes commands
 * through while applying environment sanitization.
 */
export declare class NoopSandboxManager implements SandboxManager {
    /**
     * Prepares a command by sanitizing the environment and passing through
     * the original program and arguments.
     */
    prepareCommand(req: SandboxRequest): Promise<SandboxedCommand>;
}
/**
 * SandboxManager that implements actual sandboxing.
 */
export declare class LocalSandboxManager implements SandboxManager {
    prepareCommand(_req: SandboxRequest): Promise<SandboxedCommand>;
}
/**
 * Sanitizes an array of paths by deduplicating them and ensuring they are absolute.
 */
export declare function sanitizePaths(paths?: string[]): string[] | undefined;
export { createSandboxManager } from './sandboxManagerFactory.js';
